From 605fbe5e07e9ff9e45c500e8dcaad0857d5c84d2 Mon Sep 17 00:00:00 2001 From: Charles Xie Date: Fri, 14 Feb 2025 20:30:49 -0500 Subject: [PATCH] Updates --- .../{index-Dl32_aMa.js => index-BJ_xXvIy.js} | 196 +++++++++--------- index.html | 2 +- 2 files changed, 99 insertions(+), 99 deletions(-) rename assets/{index-Dl32_aMa.js => index-BJ_xXvIy.js} (98%) diff --git a/assets/index-Dl32_aMa.js b/assets/index-BJ_xXvIy.js similarity index 98% rename from assets/index-Dl32_aMa.js rename to assets/index-BJ_xXvIy.js index 774cee35..55e5e848 100644 --- a/assets/index-Dl32_aMa.js +++ b/assets/index-BJ_xXvIy.js @@ -22,7 +22,7 @@ var agt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Snr=agt((lm, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function e(L,j){var Y=L.length;L.push(j);e:for(;0>>1,_=L[O];if(0>>1;Or(oe,Y))ee<_&&0>r(q,oe)?(L[O]=q,L[ee]=Y,O=ee):(L[O]=oe,L[Q]=Y,O=Q);else if(ee<_&&0>r(q,Y))L[O]=q,L[ee]=Y,O=ee;else break e}}return j}function r(L,j){var Y=L.sortIndex-j.sortIndex;return Y!==0?Y:L.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var s=[],c=[],u=1,d=null,f=3,p=!1,m=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(L){for(var j=n(c);j!==null;){if(j.callback===null)o(c);else if(j.startTime<=L)o(c),j.sortIndex=j.expirationTime,e(s,j);else break;j=n(c)}}function A(L){if(y=!1,P(L),!m)if(n(s)!==null)m=!0,F(S);else{var j=n(c);j!==null&&E(A,j.startTime-L)}}function S(L,j){m=!1,y&&(y=!1,x(T),T=-1),p=!0;var Y=f;try{for(P(j),d=n(s);d!==null&&(!(d.expirationTime>j)||L&&!D());){var O=d.callback;if(typeof O=="function"){d.callback=null,f=d.priorityLevel;var _=O(d.expirationTime<=j);j=t.unstable_now(),typeof _=="function"?d.callback=_:d===n(s)&&o(s),P(j)}else o(s);d=n(s)}if(d!==null)var G=!0;else{var Q=n(c);Q!==null&&E(A,Q.startTime-j),G=!1}return G}finally{d=null,f=Y,p=!1}}var v=!1,b=null,T=-1,R=5,M=-1;function D(){return!(t.unstable_now()-ML||125O?(L.sortIndex=Y,e(c,L),n(s)===null&&L===n(c)&&(y?(x(T),T=-1):y=!0,E(A,Y-O))):(L.sortIndex=_,e(s,L),m||p||(m=!0,F(S))),L},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(L){var j=f;return function(){var Y=f;f=j;try{return L.apply(this,arguments)}finally{f=Y}}}})(ZUe);QUe.exports=ZUe;var Hgt=QUe.exports;/** + */(function(t){function e(L,j){var Y=L.length;L.push(j);e:for(;0>>1,_=L[O];if(0>>1;Or(oe,Y))ee<_&&0>r($,oe)?(L[O]=$,L[ee]=Y,O=ee):(L[O]=oe,L[Q]=Y,O=Q);else if(ee<_&&0>r($,Y))L[O]=$,L[ee]=Y,O=ee;else break e}}return j}function r(L,j){var Y=L.sortIndex-j.sortIndex;return Y!==0?Y:L.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var s=[],c=[],u=1,d=null,f=3,p=!1,m=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(L){for(var j=n(c);j!==null;){if(j.callback===null)o(c);else if(j.startTime<=L)o(c),j.sortIndex=j.expirationTime,e(s,j);else break;j=n(c)}}function A(L){if(y=!1,P(L),!m)if(n(s)!==null)m=!0,F(S);else{var j=n(c);j!==null&&E(A,j.startTime-L)}}function S(L,j){m=!1,y&&(y=!1,x(T),T=-1),p=!0;var Y=f;try{for(P(j),d=n(s);d!==null&&(!(d.expirationTime>j)||L&&!D());){var O=d.callback;if(typeof O=="function"){d.callback=null,f=d.priorityLevel;var _=O(d.expirationTime<=j);j=t.unstable_now(),typeof _=="function"?d.callback=_:d===n(s)&&o(s),P(j)}else o(s);d=n(s)}if(d!==null)var G=!0;else{var Q=n(c);Q!==null&&E(A,Q.startTime-j),G=!1}return G}finally{d=null,f=Y,p=!1}}var v=!1,b=null,T=-1,R=5,M=-1;function D(){return!(t.unstable_now()-ML||125O?(L.sortIndex=Y,e(c,L),n(s)===null&&L===n(c)&&(y?(x(T),T=-1):y=!0,E(A,Y-O))):(L.sortIndex=_,e(s,L),m||p||(m=!0,F(S))),L},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(L){var j=f;return function(){var Y=f;f=j;try{return L.apply(this,arguments)}finally{f=Y}}}})(ZUe);QUe.exports=ZUe;var Hgt=QUe.exports;/** * @license React * react-dom.production.min.js * @@ -53,21 +53,21 @@ Error generating stack: `+i.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var hq=g,Yyt=Byt;function Oyt(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _yt=typeof Object.is=="function"?Object.is:Oyt,Vyt=Yyt.useSyncExternalStore,Gyt=hq.useRef,Xyt=hq.useEffect,Jyt=hq.useMemo,Kyt=hq.useDebugValue;nYe.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=Gyt(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=Jyt(function(){function s(p){if(!c){if(c=!0,u=p,p=o(p),r!==void 0&&a.hasValue){var m=a.value;if(r(m,p))return d=m}return d=p}if(m=d,_yt(u,p))return m;var y=o(p);return r!==void 0&&r(m,y)?m:(u=p,d=y)}var c=!1,u,d,f=n===void 0?null:n;return[function(){return s(e())},f===null?void 0:function(){return s(f())}]},[e,n,o,r]);var l=Vyt(t,i[0],i[1]);return Xyt(function(){a.hasValue=!0,a.value=l},[l]),Kyt(l),l};tYe.exports=nYe;var $yt=tYe.exports;const qyt=ji($yt),Qyt={},Y7e=t=>{let e;const n=new Set,o=(s,c)=>{const u=typeof s=="function"?s(e):s;if(!Object.is(u,e)){const d=e;e=c??typeof u!="object"?u:Object.assign({},e,u),n.forEach(f=>f(e,d))}},r=()=>e,l={setState:o,getState:r,subscribe:s=>(n.add(s),()=>n.delete(s)),destroy:()=>{(Qyt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(o,r,l),l},Zyt=t=>t?Y7e(t):Y7e,{useDebugValue:e2t}=xe,{useSyncExternalStoreWithSelector:t2t}=qyt;function n2t(t,e=t.getState,n){const o=t2t(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return e2t(o),o}const o2t=(t,e)=>{const n=Zyt(t),o=(r,i=e)=>n2t(n,r,i);return Object.assign(o,n),o},pq=(t,e)=>o2t;var TY,r2t=new Uint8Array(16);function iYe(){if(!TY&&(TY=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!TY))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return TY(r2t)}const i2t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function gq(t){return typeof t=="string"&&i2t.test(t)}var lf=[];for(var Yie=0;Yie<256;++Yie)lf.push((Yie+256).toString(16).substr(1));function mq(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(lf[t[e+0]]+lf[t[e+1]]+lf[t[e+2]]+lf[t[e+3]]+"-"+lf[t[e+4]]+lf[t[e+5]]+"-"+lf[t[e+6]]+lf[t[e+7]]+"-"+lf[t[e+8]]+lf[t[e+9]]+"-"+lf[t[e+10]]+lf[t[e+11]]+lf[t[e+12]]+lf[t[e+13]]+lf[t[e+14]]+lf[t[e+15]]).toLowerCase();if(!gq(n))throw TypeError("Stringified UUID is invalid");return n}var O7e,Oie,_ie=0,Vie=0;function a2t(t,e,n){var o=e&&n||0,r=e||new Array(16);t=t||{};var i=t.node||O7e,a=t.clockseq!==void 0?t.clockseq:Oie;if(i==null||a==null){var l=t.random||(t.rng||iYe)();i==null&&(i=O7e=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),a==null&&(a=Oie=(l[6]<<8|l[7])&16383)}var s=t.msecs!==void 0?t.msecs:Date.now(),c=t.nsecs!==void 0?t.nsecs:Vie+1,u=s-_ie+(c-Vie)/1e4;if(u<0&&t.clockseq===void 0&&(a=a+1&16383),(u<0||s>_ie)&&t.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_ie=s,Vie=c,Oie=a,s+=122192928e5;var d=((s&268435455)*1e4+c)%4294967296;r[o++]=d>>>24&255,r[o++]=d>>>16&255,r[o++]=d>>>8&255,r[o++]=d&255;var f=s/4294967296*1e4&268435455;r[o++]=f>>>8&255,r[o++]=f&255,r[o++]=f>>>24&15|16,r[o++]=f>>>16&255,r[o++]=a>>>8|128,r[o++]=a&255;for(var p=0;p<6;++p)r[o+p]=i[p];return e||mq(r)}function aYe(t){if(!gq(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}function l2t(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n>5]>>>r%32&255,a=parseInt(o.charAt(i>>>4&15)+o.charAt(i&15),16);e.push(a)}return e}function sYe(t){return(t+64>>>9<<4)+14+1}function f2t(t,e){t[e>>5]|=128<>5]|=(t[o/8]&255)<>16)+(e>>16)+(n>>16);return o<<16|n&65535}function p2t(t,e){return t<>>32-e}function yq(t,e,n,o,r,i){return r8(p2t(r8(r8(e,t),r8(o,i)),r),n)}function Zf(t,e,n,o,r,i,a){return yq(e&n|~e&o,t,e,r,i,a)}function eh(t,e,n,o,r,i,a){return yq(e&o|n&~o,t,e,r,i,a)}function th(t,e,n,o,r,i,a){return yq(e^n^o,t,e,r,i,a)}function nh(t,e,n,o,r,i,a){return yq(n^(e|~o),t,e,r,i,a)}var g2t=lYe("v3",48,u2t);function m2t(t,e,n){t=t||{};var o=t.random||(t.rng||iYe)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,e){n=n||0;for(var r=0;r<16;++r)e[n+r]=o[r];return e}return mq(o)}function y2t(t,e,n,o){switch(t){case 0:return e&n^~e&o;case 1:return e^n^o;case 2:return e&n^e&o^n&o;case 3:return e^n^o}}function Gie(t,e){return t<>>32-e}function A2t(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var o=unescape(encodeURIComponent(t));t=[];for(var r=0;r>>0;P=C,C=x,x=Gie(w,30)>>>0,w=y,y=v}n[0]=n[0]+y>>>0,n[1]=n[1]+w>>>0,n[2]=n[2]+x>>>0,n[3]=n[3]+C>>>0,n[4]=n[4]+P>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var w2t=lYe("v5",80,A2t);const x2t="00000000-0000-0000-0000-000000000000";function v2t(t){if(!gq(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const b2t=Object.freeze(Object.defineProperty({__proto__:null,NIL:x2t,parse:aYe,stringify:mq,v1:a2t,v3:g2t,v4:m2t,v5:w2t,validate:gq,version:v2t},Symbol.toStringTag,{value:"Module"})),S2t=jUe(b2t);function jye(t,e){if(!t||!e||!t.length||!e.length)throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}jye.prototype.convert=function(t){var e,n,o,r={},i=this.srcAlphabet.length,a=this.dstAlphabet.length,l=t.length,s=typeof t=="string"?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e=a?(r[o++]=parseInt(n/a,10),n=n%a):o>0&&(r[o++]=0);l=o,s=this.dstAlphabet.slice(n,n+1).concat(s)}while(o!==0);return s};jye.prototype.isValid=function(t){for(var e=0;e?@[]^_`{|}~",H2t={consistentLength:!0};let Kie;const _7e=(t,e,n)=>{const o=e(t.toLowerCase().replace(/-/g,""));return!n||!n.consistentLength?o:o.padStart(n.shortIdLength,n.paddingChar)},M2t=(t,e)=>{const o=e(t).padStart(32,"0").match(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/);return[o[1],o[2],o[3],o[4],o[5]].join("-")},I2t=t=>Math.ceil(Math.log(2**128)/Math.log(t));var z2t=(()=>{const t=(e,n)=>{const o=e||Jie,r={...H2t,...n};if([...new Set(Array.from(o))].length!==o.length)throw new Error("The provided Alphabet has duplicate characters resulting in unreliable results");const i=I2t(o.length),a={shortIdLength:i,consistentLength:r.consistentLength,paddingChar:o[0]},l=PY(PY.HEX,o),s=PY(o,PY.HEX),c=()=>_7e(Xie(),l,a),u={new:c,generate:c,uuid:Xie,fromUUID:d=>_7e(d,l,a),toUUID:d=>M2t(d,s),alphabet:o,maxLength:i};return Object.freeze(u),u};return t.constants={flickrBase58:Jie,cookieBase90:R2t},t.uuid=Xie,t.generate=()=>(Kie||(Kie=t(Jie).generate),Kie()),t})();const Oi=ji(z2t);var cYe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){var n=1e3,o=6e4,r=36e5,i="millisecond",a="second",l="minute",s="hour",c="day",u="week",d="month",f="quarter",p="year",m="date",y="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(U){var W=["th","st","nd","rd"],F=U%100;return"["+U+(W[(F-20)%10]||W[F]||W[0])+"]"}},P=function(U,W,F){var E=String(U);return!E||E.length>=W?U:""+Array(W+1-E.length).join(F)+U},A={s:P,z:function(U){var W=-U.utcOffset(),F=Math.abs(W),E=Math.floor(F/60),L=F%60;return(W<=0?"+":"-")+P(E,2,"0")+":"+P(L,2,"0")},m:function U(W,F){if(W.date()1)return U(Y[0])}else{var O=W.name;v[O]=W,L=O}return!E&&L&&(S=L),L||!E&&S},M=function(U,W){if(T(U))return U.clone();var F=typeof W=="object"?W:{};return F.date=U,F.args=arguments,new k(F)},D=A;D.l=R,D.i=T,D.w=function(U,W){return M(U,{locale:W.$L,utc:W.$u,x:W.$x,$offset:W.$offset})};var k=function(){function U(F){this.$L=R(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[b]=!0}var W=U.prototype;return W.parse=function(F){this.$d=function(E){var L=E.date,j=E.utc;if(L===null)return new Date(NaN);if(D.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var Y=L.match(w);if(Y){var O=Y[2]-1||0,_=(Y[7]||"0").substring(0,3);return j?new Date(Date.UTC(Y[1],O,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)):new Date(Y[1],O,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)}}return new Date(L)}(F),this.init()},W.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},W.$utils=function(){return D},W.isValid=function(){return this.$d.toString()!==y},W.isSame=function(F,E){var L=M(F);return this.startOf(E)<=L&&L<=this.endOf(E)},W.isAfter=function(F,E){return M(F){let e;const n=new Set,o=(s,c)=>{const u=typeof s=="function"?s(e):s;if(!Object.is(u,e)){const d=e;e=c??typeof u!="object"?u:Object.assign({},e,u),n.forEach(f=>f(e,d))}},r=()=>e,l={setState:o,getState:r,subscribe:s=>(n.add(s),()=>n.delete(s)),destroy:()=>{(Qyt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(o,r,l),l},Zyt=t=>t?Y7e(t):Y7e,{useDebugValue:e2t}=xe,{useSyncExternalStoreWithSelector:t2t}=qyt;function n2t(t,e=t.getState,n){const o=t2t(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return e2t(o),o}const o2t=(t,e)=>{const n=Zyt(t),o=(r,i=e)=>n2t(n,r,i);return Object.assign(o,n),o},pq=(t,e)=>o2t;var TY,r2t=new Uint8Array(16);function iYe(){if(!TY&&(TY=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!TY))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return TY(r2t)}const i2t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function gq(t){return typeof t=="string"&&i2t.test(t)}var lf=[];for(var Yie=0;Yie<256;++Yie)lf.push((Yie+256).toString(16).substr(1));function mq(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(lf[t[e+0]]+lf[t[e+1]]+lf[t[e+2]]+lf[t[e+3]]+"-"+lf[t[e+4]]+lf[t[e+5]]+"-"+lf[t[e+6]]+lf[t[e+7]]+"-"+lf[t[e+8]]+lf[t[e+9]]+"-"+lf[t[e+10]]+lf[t[e+11]]+lf[t[e+12]]+lf[t[e+13]]+lf[t[e+14]]+lf[t[e+15]]).toLowerCase();if(!gq(n))throw TypeError("Stringified UUID is invalid");return n}var O7e,Oie,_ie=0,Vie=0;function a2t(t,e,n){var o=e&&n||0,r=e||new Array(16);t=t||{};var i=t.node||O7e,a=t.clockseq!==void 0?t.clockseq:Oie;if(i==null||a==null){var l=t.random||(t.rng||iYe)();i==null&&(i=O7e=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),a==null&&(a=Oie=(l[6]<<8|l[7])&16383)}var s=t.msecs!==void 0?t.msecs:Date.now(),c=t.nsecs!==void 0?t.nsecs:Vie+1,u=s-_ie+(c-Vie)/1e4;if(u<0&&t.clockseq===void 0&&(a=a+1&16383),(u<0||s>_ie)&&t.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_ie=s,Vie=c,Oie=a,s+=122192928e5;var d=((s&268435455)*1e4+c)%4294967296;r[o++]=d>>>24&255,r[o++]=d>>>16&255,r[o++]=d>>>8&255,r[o++]=d&255;var f=s/4294967296*1e4&268435455;r[o++]=f>>>8&255,r[o++]=f&255,r[o++]=f>>>24&15|16,r[o++]=f>>>16&255,r[o++]=a>>>8|128,r[o++]=a&255;for(var p=0;p<6;++p)r[o+p]=i[p];return e||mq(r)}function aYe(t){if(!gq(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}function l2t(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n>5]>>>r%32&255,a=parseInt(o.charAt(i>>>4&15)+o.charAt(i&15),16);e.push(a)}return e}function sYe(t){return(t+64>>>9<<4)+14+1}function f2t(t,e){t[e>>5]|=128<>5]|=(t[o/8]&255)<>16)+(e>>16)+(n>>16);return o<<16|n&65535}function p2t(t,e){return t<>>32-e}function yq(t,e,n,o,r,i){return r8(p2t(r8(r8(e,t),r8(o,i)),r),n)}function Zf(t,e,n,o,r,i,a){return yq(e&n|~e&o,t,e,r,i,a)}function eh(t,e,n,o,r,i,a){return yq(e&o|n&~o,t,e,r,i,a)}function th(t,e,n,o,r,i,a){return yq(e^n^o,t,e,r,i,a)}function nh(t,e,n,o,r,i,a){return yq(n^(e|~o),t,e,r,i,a)}var g2t=lYe("v3",48,u2t);function m2t(t,e,n){t=t||{};var o=t.random||(t.rng||iYe)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,e){n=n||0;for(var r=0;r<16;++r)e[n+r]=o[r];return e}return mq(o)}function y2t(t,e,n,o){switch(t){case 0:return e&n^~e&o;case 1:return e^n^o;case 2:return e&n^e&o^n&o;case 3:return e^n^o}}function Gie(t,e){return t<>>32-e}function A2t(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var o=unescape(encodeURIComponent(t));t=[];for(var r=0;r>>0;P=C,C=x,x=Gie(w,30)>>>0,w=y,y=v}n[0]=n[0]+y>>>0,n[1]=n[1]+w>>>0,n[2]=n[2]+x>>>0,n[3]=n[3]+C>>>0,n[4]=n[4]+P>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var w2t=lYe("v5",80,A2t);const x2t="00000000-0000-0000-0000-000000000000";function v2t(t){if(!gq(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const b2t=Object.freeze(Object.defineProperty({__proto__:null,NIL:x2t,parse:aYe,stringify:mq,v1:a2t,v3:g2t,v4:m2t,v5:w2t,validate:gq,version:v2t},Symbol.toStringTag,{value:"Module"})),S2t=jUe(b2t);function jye(t,e){if(!t||!e||!t.length||!e.length)throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}jye.prototype.convert=function(t){var e,n,o,r={},i=this.srcAlphabet.length,a=this.dstAlphabet.length,l=t.length,s=typeof t=="string"?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e=a?(r[o++]=parseInt(n/a,10),n=n%a):o>0&&(r[o++]=0);l=o,s=this.dstAlphabet.slice(n,n+1).concat(s)}while(o!==0);return s};jye.prototype.isValid=function(t){for(var e=0;e?@[]^_`{|}~",H2t={consistentLength:!0};let Kie;const _7e=(t,e,n)=>{const o=e(t.toLowerCase().replace(/-/g,""));return!n||!n.consistentLength?o:o.padStart(n.shortIdLength,n.paddingChar)},M2t=(t,e)=>{const o=e(t).padStart(32,"0").match(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/);return[o[1],o[2],o[3],o[4],o[5]].join("-")},I2t=t=>Math.ceil(Math.log(2**128)/Math.log(t));var z2t=(()=>{const t=(e,n)=>{const o=e||Jie,r={...H2t,...n};if([...new Set(Array.from(o))].length!==o.length)throw new Error("The provided Alphabet has duplicate characters resulting in unreliable results");const i=I2t(o.length),a={shortIdLength:i,consistentLength:r.consistentLength,paddingChar:o[0]},l=PY(PY.HEX,o),s=PY(o,PY.HEX),c=()=>_7e(Xie(),l,a),u={new:c,generate:c,uuid:Xie,fromUUID:d=>_7e(d,l,a),toUUID:d=>M2t(d,s),alphabet:o,maxLength:i};return Object.freeze(u),u};return t.constants={flickrBase58:Jie,cookieBase90:R2t},t.uuid=Xie,t.generate=()=>(Kie||(Kie=t(Jie).generate),Kie()),t})();const Oi=ji(z2t);var cYe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){var n=1e3,o=6e4,r=36e5,i="millisecond",a="second",l="minute",s="hour",c="day",u="week",d="month",f="quarter",p="year",m="date",y="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(U){var W=["th","st","nd","rd"],F=U%100;return"["+U+(W[(F-20)%10]||W[F]||W[0])+"]"}},P=function(U,W,F){var E=String(U);return!E||E.length>=W?U:""+Array(W+1-E.length).join(F)+U},A={s:P,z:function(U){var W=-U.utcOffset(),F=Math.abs(W),E=Math.floor(F/60),L=F%60;return(W<=0?"+":"-")+P(E,2,"0")+":"+P(L,2,"0")},m:function U(W,F){if(W.date()1)return U(Y[0])}else{var O=W.name;v[O]=W,L=O}return!E&&L&&(S=L),L||!E&&S},M=function(U,W){if(T(U))return U.clone();var F=typeof W=="object"?W:{};return F.date=U,F.args=arguments,new k(F)},D=A;D.l=R,D.i=T,D.w=function(U,W){return M(U,{locale:W.$L,utc:W.$u,x:W.$x,$offset:W.$offset})};var k=function(){function U(F){this.$L=R(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[b]=!0}var W=U.prototype;return W.parse=function(F){this.$d=function(E){var L=E.date,j=E.utc;if(L===null)return new Date(NaN);if(D.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var Y=L.match(w);if(Y){var O=Y[2]-1||0,_=(Y[7]||"0").substring(0,3);return j?new Date(Date.UTC(Y[1],O,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)):new Date(Y[1],O,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,_)}}return new Date(L)}(F),this.init()},W.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},W.$utils=function(){return D},W.isValid=function(){return this.$d.toString()!==y},W.isSame=function(F,E){var L=M(F);return this.startOf(E)<=L&&L<=this.endOf(E)},W.isAfter=function(F,E){return M(F)=this._config.preview;if(i)o.postMessage({results:N,workerId:s.WORKER_ID,finished:W});else if(b(this._config.chunk)&&!M){if(this._config.chunk(N,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);N=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(N.data),this._completeResults.errors=this._completeResults.errors.concat(N.errors),this._completeResults.meta=N.meta),this._completed||!W||!b(this._config.complete)||N&&N.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),W||N&&N.meta.paused||this._nextChunk(),N}this._halted=!0},this._sendError=function(R){b(this._config.error)?this._config.error(R):i&&this._config.error&&o.postMessage({workerId:s.WORKER_ID,error:R,finished:!1})}}function d(T){var R;(T=T||{}).chunkSize||(T.chunkSize=s.RemoteChunkSize),u.call(this,T),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(M){this._input=M,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(R=new XMLHttpRequest,this._config.withCredentials&&(R.withCredentials=this._config.withCredentials),r||(R.onload=v(this._chunkLoaded,this),R.onerror=v(this._chunkError,this)),R.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var M=this._config.downloadRequestHeaders;for(var D in M)R.setRequestHeader(D,M[D])}if(this._config.chunkSize){var k=this._start+this._config.chunkSize-1;R.setRequestHeader("Range","bytes="+this._start+"-"+k)}try{R.send(this._config.downloadRequestBody)}catch(N){this._chunkError(N.message)}r&&R.status===0&&this._chunkError()}},this._chunkLoaded=function(){R.readyState===4&&(R.status<200||400<=R.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:R.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(M){var D=M.getResponseHeader("Content-Range");return D===null?-1:parseInt(D.substring(D.lastIndexOf("/")+1))}(R),this.parseChunk(R.responseText)))},this._chunkError=function(M){var D=R.statusText||M;this._sendError(new Error(D))}}function f(T){var R,M;(T=T||{}).chunkSize||(T.chunkSize=s.LocalChunkSize),u.call(this,T);var D=typeof FileReader<"u";this.stream=function(k){this._input=k,M=k.slice||k.webkitSlice||k.mozSlice,D?((R=new FileReader).onload=v(this._chunkLoaded,this),R.onerror=v(this._chunkError,this)):R=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(k.target.result)},this._chunkError=function(){this._sendError(R.error)}}function p(T){var R;u.call(this,T=T||{}),this.stream=function(M){return R=M,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var M,D=this._config.chunkSize;return D?(M=R.substring(0,D),R=R.substring(D)):(M=R,R=""),this._finished=!R,this.parseChunk(M)}}}function m(T){u.call(this,T=T||{});var R=[],M=!0,D=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(k){this._input=k,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){D&&R.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),R.length?this.parseChunk(R.shift()):M=!0},this._streamData=v(function(k){try{R.push(typeof k=="string"?k:k.toString(this._config.encoding)),M&&(M=!1,this._checkIsFinished(),this.parseChunk(R.shift()))}catch(N){this._streamError(N)}},this),this._streamError=v(function(k){this._streamCleanUp(),this._sendError(k)},this),this._streamEnd=v(function(){this._streamCleanUp(),D=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function y(T){var R,M,D,k=Math.pow(2,53),N=-k,U=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,W=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,F=this,E=0,L=0,j=!1,Y=!1,O=[],_={data:[],errors:[],meta:{}};if(b(T.step)){var G=T.step;T.step=function(Z){if(_=Z,ee())oe();else{if(oe(),_.data.length===0)return;E+=Z.data.length,T.preview&&E>T.preview?M.abort():(_.data=_.data[0],G(_,F))}}}function Q(Z){return T.skipEmptyLines==="greedy"?Z.join("").trim()==="":Z.length===1&&Z[0].length===0}function oe(){return _&&D&&(ae("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),D=!1),T.skipEmptyLines&&(_.data=_.data.filter(function(Z){return!Q(Z)})),ee()&&function(){if(!_)return;function Z(te,$){b(T.transformHeader)&&(te=T.transformHeader(te,$)),O.push(te)}if(Array.isArray(_.data[0])){for(var ne=0;ee()&&ne<_.data.length;ne++)_.data[ne].forEach(Z);_.data.splice(0,1)}else _.data.forEach(Z)}(),function(){if(!_||!T.header&&!T.dynamicTyping&&!T.transform)return _;function Z(te,$){var le,de=T.header?{}:[];for(le=0;le=O.length?"__parsed_extra":O[le]),T.transform&&(me=T.transform(me,he)),me=q(he,me),he==="__parsed_extra"?(de[he]=de[he]||[],de[he].push(me)):de[he]=me}return T.header&&(le>O.length?ae("FieldMismatch","TooManyFields","Too many fields: expected "+O.length+" fields but parsed "+le,L+$):le=this._config.preview;if(i)o.postMessage({results:N,workerId:s.WORKER_ID,finished:W});else if(b(this._config.chunk)&&!M){if(this._config.chunk(N,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);N=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(N.data),this._completeResults.errors=this._completeResults.errors.concat(N.errors),this._completeResults.meta=N.meta),this._completed||!W||!b(this._config.complete)||N&&N.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),W||N&&N.meta.paused||this._nextChunk(),N}this._halted=!0},this._sendError=function(R){b(this._config.error)?this._config.error(R):i&&this._config.error&&o.postMessage({workerId:s.WORKER_ID,error:R,finished:!1})}}function d(T){var R;(T=T||{}).chunkSize||(T.chunkSize=s.RemoteChunkSize),u.call(this,T),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(M){this._input=M,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(R=new XMLHttpRequest,this._config.withCredentials&&(R.withCredentials=this._config.withCredentials),r||(R.onload=v(this._chunkLoaded,this),R.onerror=v(this._chunkError,this)),R.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var M=this._config.downloadRequestHeaders;for(var D in M)R.setRequestHeader(D,M[D])}if(this._config.chunkSize){var k=this._start+this._config.chunkSize-1;R.setRequestHeader("Range","bytes="+this._start+"-"+k)}try{R.send(this._config.downloadRequestBody)}catch(N){this._chunkError(N.message)}r&&R.status===0&&this._chunkError()}},this._chunkLoaded=function(){R.readyState===4&&(R.status<200||400<=R.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:R.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(M){var D=M.getResponseHeader("Content-Range");return D===null?-1:parseInt(D.substring(D.lastIndexOf("/")+1))}(R),this.parseChunk(R.responseText)))},this._chunkError=function(M){var D=R.statusText||M;this._sendError(new Error(D))}}function f(T){var R,M;(T=T||{}).chunkSize||(T.chunkSize=s.LocalChunkSize),u.call(this,T);var D=typeof FileReader<"u";this.stream=function(k){this._input=k,M=k.slice||k.webkitSlice||k.mozSlice,D?((R=new FileReader).onload=v(this._chunkLoaded,this),R.onerror=v(this._chunkError,this)):R=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(k.target.result)},this._chunkError=function(){this._sendError(R.error)}}function p(T){var R;u.call(this,T=T||{}),this.stream=function(M){return R=M,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var M,D=this._config.chunkSize;return D?(M=R.substring(0,D),R=R.substring(D)):(M=R,R=""),this._finished=!R,this.parseChunk(M)}}}function m(T){u.call(this,T=T||{});var R=[],M=!0,D=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(k){this._input=k,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){D&&R.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),R.length?this.parseChunk(R.shift()):M=!0},this._streamData=v(function(k){try{R.push(typeof k=="string"?k:k.toString(this._config.encoding)),M&&(M=!1,this._checkIsFinished(),this.parseChunk(R.shift()))}catch(N){this._streamError(N)}},this),this._streamError=v(function(k){this._streamCleanUp(),this._sendError(k)},this),this._streamEnd=v(function(){this._streamCleanUp(),D=!0,this._streamData("")},this),this._streamCleanUp=v(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function y(T){var R,M,D,k=Math.pow(2,53),N=-k,U=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,W=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,F=this,E=0,L=0,j=!1,Y=!1,O=[],_={data:[],errors:[],meta:{}};if(b(T.step)){var G=T.step;T.step=function(Z){if(_=Z,ee())oe();else{if(oe(),_.data.length===0)return;E+=Z.data.length,T.preview&&E>T.preview?M.abort():(_.data=_.data[0],G(_,F))}}}function Q(Z){return T.skipEmptyLines==="greedy"?Z.join("").trim()==="":Z.length===1&&Z[0].length===0}function oe(){return _&&D&&(ae("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),D=!1),T.skipEmptyLines&&(_.data=_.data.filter(function(Z){return!Q(Z)})),ee()&&function(){if(!_)return;function Z(te,q){b(T.transformHeader)&&(te=T.transformHeader(te,q)),O.push(te)}if(Array.isArray(_.data[0])){for(var ne=0;ee()&&ne<_.data.length;ne++)_.data[ne].forEach(Z);_.data.splice(0,1)}else _.data.forEach(Z)}(),function(){if(!_||!T.header&&!T.dynamicTyping&&!T.transform)return _;function Z(te,q){var le,de=T.header?{}:[];for(le=0;le=O.length?"__parsed_extra":O[le]),T.transform&&(me=T.transform(me,he)),me=$(he,me),he==="__parsed_extra"?(de[he]=de[he]||[],de[he].push(me)):de[he]=me}return T.header&&(le>O.length?ae("FieldMismatch","TooManyFields","Too many fields: expected "+O.length+" fields but parsed "+le,L+q):le=Pe.length/2?`\r -`:"\r"}(Z,$)),D=!1,T.delimiter)b(T.delimiter)&&(T.delimiter=T.delimiter(Z),_.meta.delimiter=T.delimiter);else{var le=function(he,me,ce,Pe,pe){var Ie,ve,ze,Ae;pe=pe||[","," ","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var se=0;se=U)return Ne(!0)}else for(ge=E,E++;;){if((ge=j.indexOf(R,ge+1))===-1)return O||ae.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:q.length,index:E}),Te();if(ge===_-1)return Te(j.substring(E,ge).replace(se,R));if(R!==F||j[ge+1]!==F){if(R===F||ge===0||j[ge-1]!==F){ze!==-1&&ze=U)return Ne(!0);break}ae.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:q.length,index:E}),ge++}}else ge++}return Te();function Me(Ue){q.push(Ue),ne=E}function Ce(Ue){var qe=0;if(Ue!==-1){var Fe=j.substring(ge+1,Ue);Fe&&Fe.trim()===""&&(qe=Fe.length)}return qe}function Te(Ue){return O||(Ue===void 0&&(Ue=j.substring(E)),Z.push(Ue),E=_,Me(Z),ee&&_e()),Ne()}function Re(Ue){E=Ue,Me(Z),Z=[],Ae=j.indexOf(D,E)}function Ne(Ue){return{data:q,errors:ae,meta:{delimiter:M,linebreak:D,aborted:L,truncated:!!Ue,cursor:ne+(Y||0)}}}function _e(){N(Ne()),q=[],ae=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return E}}function C(T){var R=T.data,M=a[R.workerId],D=!1;if(R.error)M.userError(R.error,R.file);else if(R.results&&R.results.data){var k={abort:function(){D=!0,P(R.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:A,resume:A};if(b(M.userStep)){for(var N=0;N1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||k2t,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),o=0;o{this.observers[o]||(this.observers[o]=new Map);const r=this.observers[o].get(n)||0;this.observers[o].set(n,r+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r{let[l,s]=a;for(let c=0;c{let[l,s]=a;for(let c=0;c{t=o,e=r});return n.resolve=t,n.reject=e,n}function V7e(t){return t==null?"":""+t}function L2t(t,e,n){t.forEach(o=>{e[o]&&(n[o]=e[o])})}const W2t=/###/g;function Hk(t,e,n){function o(l){return l&&l.indexOf("###")>-1?l.replace(W2t,"."):l}function r(){return!t||typeof t=="string"}const i=typeof e!="string"?e:e.split(".");let a=0;for(;a":">",'"':""","'":"'","/":"/"};function B2t(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,e=>j2t[e]):t}class Y2t{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const o=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,o),this.regExpQueue.push(e),o}}const O2t=[" ",",","?","!",";"],_2t=new Y2t(20);function V2t(t,e,n){e=e||"",n=n||"";const o=O2t.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(o.length===0)return!0;const r=_2t.getRegExp(`(${o.map(a=>a==="?"?"\\?":a).join("|")})`);let i=!r.test(t);if(!i){const a=t.indexOf(n);a>0&&!r.test(t.substring(0,a))&&(i=!0)}return i}function I0e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const o=e.split(n);let r=t;for(let i=0;i-1&&s0?t.replace("_","-"):t}class X7e extends Aq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,n],o&&(Array.isArray(o)?l.push(...o):typeof o=="string"&&i?l.push(...o.split(i)):l.push(o)));const s=fX(this.data,l);return!s&&!n&&!o&&e.indexOf(".")>-1&&(e=l[0],n=l[1],o=l.slice(2).join(".")),s||!a||typeof o!="string"?s:I0e(this.data&&this.data[e]&&this.data[e][n],o,i)}addResource(e,n,o,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[e,n];o&&(l=l.concat(a?o.split(a):o)),e.indexOf(".")>-1&&(l=e.split("."),r=n,n=l[1]),this.addNamespaces(n),G7e(this.data,l,r),i.silent||this.emit("added",e,n,o,r)}addResources(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in o)(typeof o[i]=="string"||Object.prototype.toString.apply(o[i])==="[object Array]")&&this.addResource(e,n,i,o[i],{silent:!0});r.silent||this.emit("added",e,n,o)}addResourceBundle(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),r=o,o=n,n=l[1]),this.addNamespaces(n);let s=fX(this.data,l)||{};a.skipCopy||(o=JSON.parse(JSON.stringify(o))),r?dYe(s,o,i):s={...s,...o},G7e(this.data,l,s),a.silent||this.emit("added",e,n,o)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var fYe={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,o,r){return t.forEach(i=>{this.processors[i]&&(e=this.processors[i].process(e,n,o,r))}),e}};const J7e={};class pX extends Aq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),L2t(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=e3.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const o=this.resolve(e,n);return o&&o.res!==void 0}extractFromKey(e,n){let o=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const a=o&&e.indexOf(o)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!V2t(e,o,r);if(a&&!l){const s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};const c=e.split(o);(o!==r||o===r&&this.options.ns.indexOf(c[0])>-1)&&(i=c.shift()),e=c.join(r)}return typeof i=="string"&&(i=[i]),{key:e,namespaces:i}}translate(e,n,o){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],n),s=l[l.length-1],c=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(u){const A=n.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${A}${a}`,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:`${s}${A}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:a}const d=this.resolve(e,n);let f=d&&d.res;const p=d&&d.usedKey||a,m=d&&d.exactUsedKey||a,y=Object.prototype.toString.apply(f),w=["[object Number]","[object Function]","[object RegExp]"],x=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,C=!this.i18nFormat||this.i18nFormat.handleAsObject;if(C&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&w.indexOf(y)<0&&!(typeof x=="string"&&y==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const A=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(d.res=A,d.usedParams=this.getUsedParamsDetails(n),d):A}if(i){const A=y==="[object Array]",S=A?[]:{},v=A?m:p;for(const b in f)if(Object.prototype.hasOwnProperty.call(f,b)){const T=`${v}${i}${b}`;S[b]=this.translate(T,{...n,joinArrays:!1,ns:l}),S[b]===T&&(S[b]=f[b])}f=S}}else if(C&&typeof x=="string"&&y==="[object Array]")f=f.join(x),f&&(f=this.extendTranslation(f,e,n,o));else{let A=!1,S=!1;const v=n.count!==void 0&&typeof n.count!="string",b=pX.hasDefaultValue(n),T=v?this.pluralResolver.getSuffix(c,n.count,n):"",R=n.ordinal&&v?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",M=v&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),D=M&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${T}`]||n[`defaultValue${R}`]||n.defaultValue;!this.isValidLookup(f)&&b&&(A=!0,f=D),this.isValidLookup(f)||(S=!0,f=a);const N=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,U=b&&D!==f&&this.options.updateMissing;if(S||A||U){if(this.logger.log(U?"updateKey":"missingKey",c,s,a,U?D:f),i){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let W=[];const F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&F&&F[0])for(let L=0;L{const O=b&&Y!==f?Y:N;this.options.missingKeyHandler?this.options.missingKeyHandler(L,s,j,O,U,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,s,j,O,U,n),this.emit("missingKey",L,s,j,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?W.forEach(L=>{const j=this.pluralResolver.getSuffixes(L,n);M&&n[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(Y=>{E([L],a+Y,n[`defaultValue${Y}`]||D)})}):E(W,a,D))}f=this.extendTranslation(f,e,n,d,o),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${s}:${a}`),(S||A)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${a}`:a,A?f:void 0):f=this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(e,n,o,r,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const c=typeof e=="string"&&(o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let d=o.replace&&typeof o.replace!="string"?o.replace:o;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,o.lng||this.language,o),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;u1&&arguments[1]!==void 0?arguments[1]:{},o,r,i,a,l;return typeof e=="string"&&(e=[e]),e.forEach(s=>{if(this.isValidLookup(o))return;const c=this.extractFromKey(s,n),u=c.key;r=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),m=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(w=>{this.isValidLookup(o)||(l=w,!J7e[`${y[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(J7e[`${y[0]}-${w}`]=!0,this.logger.warn(`key "${r}" for languages "${y.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(x=>{if(this.isValidLookup(o))return;a=x;const C=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(C,u,x,w,n);else{let A;f&&(A=this.pluralResolver.getSuffix(x,n.count,n));const S=`${this.options.pluralSeparator}zero`,v=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(C.push(u+A),n.ordinal&&A.indexOf(v)===0&&C.push(u+A.replace(v,this.options.pluralSeparator)),p&&C.push(u+S)),m){const b=`${u}${this.options.contextSeparator}${n.context}`;C.push(b),f&&(C.push(b+A),n.ordinal&&A.indexOf(v)===0&&C.push(b+A.replace(v,this.options.pluralSeparator)),p&&C.push(b+S))}}let P;for(;P=C.pop();)this.isValidLookup(o)||(i=P,o=this.getResource(x,w,P,n))}))})}),{res:o,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,o,r):this.resourceStore.getResource(e,n,o,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=e.replace&&typeof e.replace!="string";let r=o?e.replace:e;if(o&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!o){r={...r};for(const i of n)delete r[i]}return r}static hasDefaultValue(e){const n="defaultValue";for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&n===o.substring(0,n.length)&&e[o]!==void 0)return!0;return!1}}function $ie(t){return t.charAt(0).toUpperCase()+t.slice(1)}class K7e{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=e3.create("languageUtils")}getScriptPartFromCode(e){if(e=hX(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=hX(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let o=e.split("-");return this.options.lowerCaseLng?o=o.map(r=>r.toLowerCase()):o.length===2?(o[0]=o[0].toLowerCase(),o[1]=o[1].toUpperCase(),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=$ie(o[1].toLowerCase()))):o.length===3&&(o[0]=o[0].toLowerCase(),o[1].length===2&&(o[1]=o[1].toUpperCase()),o[0]!=="sgn"&&o[2].length===2&&(o[2]=o[2].toUpperCase()),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=$ie(o[1].toLowerCase())),n.indexOf(o[2].toLowerCase())>-1&&(o[2]=$ie(o[2].toLowerCase()))),o.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(o=>{if(n)return;const r=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(o=>{if(n)return;const r=this.getLanguagePartFromCode(o);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(i=>{if(i===r)return i;if(!(i.indexOf("-")<0&&r.indexOf("-")<0)&&(i.indexOf("-")>0&&r.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===r||i.indexOf(r)===0&&r.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!n)return e.default||[];let o=e[n];return o||(o=e[this.getScriptPartFromCode(n)]),o||(o=e[this.formatLanguageCode(n)]),o||(o=e[this.getLanguagePartFromCode(n)]),o||(o=e.default),o||[]}toResolveHierarchy(e,n){const o=this.getFallbackCodes(n||this.options.fallbackLng||[],e),r=[],i=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(e))):typeof e=="string"&&i(this.formatLanguageCode(e)),o.forEach(a=>{r.indexOf(a)<0&&i(this.formatLanguageCode(a))}),r}}let G2t=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],X2t={1:function(t){return+(t>1)},2:function(t){return+(t!=1)},3:function(t){return 0},4:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},5:function(t){return t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},6:function(t){return t==1?0:t>=2&&t<=4?1:2},7:function(t){return t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},8:function(t){return t==1?0:t==2?1:t!=8&&t!=11?2:3},9:function(t){return+(t>=2)},10:function(t){return t==1?0:t==2?1:t<7?2:t<11?3:4},11:function(t){return t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3},12:function(t){return+(t%10!=1||t%100==11)},13:function(t){return+(t!==0)},14:function(t){return t==1?0:t==2?1:t==3?2:3},15:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2},16:function(t){return t%10==1&&t%100!=11?0:t!==0?1:2},17:function(t){return t==1||t%10==1&&t%100!=11?0:1},18:function(t){return t==0?0:t==1?1:2},19:function(t){return t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3},20:function(t){return t==1?0:t==0||t%100>0&&t%100<20?1:2},21:function(t){return t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0},22:function(t){return t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3}};const J2t=["v1","v2","v3"],K2t=["v4"],$7e={zero:0,one:1,two:2,few:3,many:4,other:5};function $2t(){const t={};return G2t.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:X2t[e.fc]}})}),t}class q2t{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=e3.create("pluralResolver"),(!this.options.compatibilityJSON||K2t.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=$2t()}addRule(e,n){this.rules[e]=n}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(hX(e==="dev"?"en":e),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return this.shouldUseIntlApi()?o&&o.resolvedOptions().pluralCategories.length>1:o&&o.numbers.length>1}getPluralFormsOfKey(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,o).map(r=>`${n}${r}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort((r,i)=>$7e[r]-$7e[i]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):o.numbers.map(r=>this.getSuffix(e,r,n)):[]}getSuffix(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,o);return r?this.shouldUseIntlApi()?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:this.getSuffixRetroCompatible(r,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const o=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let r=e.numbers[o];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(r===2?r="plural":r===1&&(r=""));const i=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return this.options.compatibilityJSON==="v1"?r===1?"":typeof r=="number"?`_plural_${r.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?i():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}shouldUseIntlApi(){return!J2t.includes(this.options.compatibilityJSON)}}function q7e(t,e,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=U2t(t,e,n);return!i&&r&&typeof n=="string"&&(i=I0e(t,n,o),i===void 0&&(i=I0e(e,n,o))),i}class Q2t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=e3.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const n=e.interpolation;this.escape=n.escape!==void 0?n.escape:B2t,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?nP(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?nP(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?nP(n.nestingPrefix):n.nestingPrefixEscaped||nP("$t("),this.nestingSuffix=n.nestingSuffix?nP(n.nestingSuffix):n.nestingSuffixEscaped||nP(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,o)=>n&&n.source===o?(n.lastIndex=0,n):new RegExp(o,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,o,r){let i,a,l;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(m){return m.replace(/\$/g,"$$$$")}const u=m=>{if(m.indexOf(this.formatSeparator)<0){const C=q7e(n,s,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,o,{...r,...n,interpolationkey:m}):C}const y=m.split(this.formatSeparator),w=y.shift().trim(),x=y.join(this.formatSeparator).trim();return this.format(q7e(n,s,w,this.options.keySeparator,this.options.ignoreJSONStructure),x,o,{...r,...n,interpolationkey:w})};this.resetRegExp();const d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>c(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?c(this.escape(m)):c(m)}].forEach(m=>{for(l=0;i=m.regex.exec(e);){const y=i[1].trim();if(a=u(y),a===void 0)if(typeof d=="function"){const x=d(e,i,r);a=typeof x=="string"?x:""}else if(r&&Object.prototype.hasOwnProperty.call(r,y))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=V7e(a));const w=m.safeValue(a);if(e=e.replace(i[0],w),f?(m.regex.lastIndex+=a.length,m.regex.lastIndex-=i[0].length):m.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,i,a;function l(s,c){const u=this.nestingOptionsSeparator;if(s.indexOf(u)<0)return s;const d=s.split(new RegExp(`${u}[ ]*{`));let f=`{${d[1]}`;s=d[0],f=this.interpolate(f,a);const p=f.match(/'/g),m=f.match(/"/g);(p&&p.length%2===0&&!m||m.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),c&&(a={...c,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${s}`,y),`${s}${u}${f}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,s}for(;r=this.nestingRegexp.exec(e);){let s=[];a={...o},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const u=r[1].split(this.formatSeparator).map(d=>d.trim());r[1]=u.shift(),s=u,c=!0}if(i=n(l.call(this,r[1].trim(),a),a),i&&r[0]===e&&typeof i!="string")return i;typeof i!="string"&&(i=V7e(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),i=""),c&&(i=s.reduce((u,d)=>this.format(u,d,o.lng,{...o,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}}function Z2t(t){let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const o=t.split("(");e=o[0].toLowerCase().trim();const r=o[1].substring(0,o[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(a=>{if(!a)return;const[l,...s]=a.split(":"),c=s.join(":").trim().replace(/^'+|'+$/g,"");n[l.trim()]||(n[l.trim()]=c),c==="false"&&(n[l.trim()]=!1),c==="true"&&(n[l.trim()]=!0),isNaN(c)||(n[l.trim()]=parseInt(c,10))})}return{formatName:e,formatOptions:n}}function oP(t){const e={};return function(o,r,i){const a=r+JSON.stringify(i);let l=e[a];return l||(l=t(hX(r),i),e[a]=l),l(o)}}class e5t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=e3.create("formatter"),this.options=e,this.formats={number:oP((n,o)=>{const r=new Intl.NumberFormat(n,{...o});return i=>r.format(i)}),currency:oP((n,o)=>{const r=new Intl.NumberFormat(n,{...o,style:"currency"});return i=>r.format(i)}),datetime:oP((n,o)=>{const r=new Intl.DateTimeFormat(n,{...o});return i=>r.format(i)}),relativetime:oP((n,o)=>{const r=new Intl.RelativeTimeFormat(n,{...o});return i=>r.format(i,o.range||"day")}),list:oP((n,o)=>{const r=new Intl.ListFormat(n,{...o});return i=>r.format(i)})},this.init(e)}init(e){const o=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=o.formatSeparator?o.formatSeparator:o.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=oP(n)}format(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((l,s)=>{const{formatName:c,formatOptions:u}=Z2t(s);if(this.formats[c]){let d=l;try{const f=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},p=f.locale||f.lng||r.locale||r.lng||o;d=this.formats[c](l,p,{...u,...r,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return l},e)}}function t5t(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}class n5t extends Aq{constructor(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=o,this.languageUtils=o.languageUtils,this.options=r,this.logger=e3.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(o,r.backend,r)}queueLoad(e,n,o,r){const i={},a={},l={},s={};return e.forEach(c=>{let u=!0;n.forEach(d=>{const f=`${c}|${d}`;!o.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,u=!1,a[f]===void 0&&(a[f]=!0),i[f]===void 0&&(i[f]=!0),s[d]===void 0&&(s[d]=!0)))}),u||(l[c]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(s)}}loaded(e,n,o){const r=e.split("|"),i=r[0],a=r[1];n&&this.emit("failedLoading",i,a,n),o&&this.store.addResourceBundle(i,a,o,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2;const l={};this.queue.forEach(s=>{N2t(s.loaded,[i],a),t5t(s,e),n&&s.errors.push(n),s.pendingCount===0&&!s.done&&(Object.keys(s.loaded).forEach(c=>{l[c]||(l[c]={});const u=s.loaded[c];u.length&&u.forEach(d=>{l[c][d]===void 0&&(l[c][d]=!0)})}),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(s=>!s.done)}read(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:o,tried:r,wait:i,callback:a});return}this.readingCalls++;const l=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&r{this.read.call(this,e,n,o,r+1,i*2,a)},i);return}a(c,u)},s=this.backend[o].bind(this.backend);if(s.length===2){try{const c=s(e,n);c&&typeof c.then=="function"?c.then(u=>l(null,u)).catch(l):l(null,c)}catch(c){l(c)}return}return s(e,n,l)}prepareLoading(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof n=="string"&&(n=[n]);const i=this.queueLoad(e,n,o,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,o){this.prepareLoading(e,n,{},o)}reload(e,n,o){this.prepareLoading(e,n,{reload:!0},o)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const o=e.split("|"),r=o[0],i=o[1];this.read(r,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${r} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${r}`,l),this.loaded(e,a,l)})}saveMissing(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${o}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){const s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,n,o,r,s):u=c(e,n,o,r),u&&typeof u.then=="function"?u.then(d=>l(null,d)).catch(l):l(null,u)}catch(u){l(u)}else c(e,n,o,r,l,s)}!e||!e[0]||this.store.addResource(e[0],n,o,r)}}}function Q7e(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let n={};if(typeof e[1]=="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const o=e[3]||e[2];Object.keys(o).forEach(r=>{n[r]=o[r]})}return n},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Z7e(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function RY(){}function o5t(t){Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}class jF extends Aq{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Z7e(e),this.services={},this.logger=e3,this.modules={external:[]},o5t(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(o=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const r=Q7e();this.options={...r,...this.options,...Z7e(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function i(u){return u?typeof u=="function"?new u:u:null}if(!this.options.isClone){this.modules.logger?e3.init(i(this.modules.logger),this.options):e3.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=e5t);const d=new K7e(this.options);this.store=new X7e(this.options.resources,this.options);const f=this.services;f.logger=e3,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new q2t(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(f.formatter=i(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Q2t(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new n5t(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var m=arguments.length,y=new Array(m>1?m-1:0),w=1;w1?m-1:0),w=1;w{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,o||(o=RY),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const s=HD(),c=()=>{const u=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(f),o(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),s}loadResources(e){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:RY;const r=typeof e=="string"?e:this.language;if(typeof e=="function"&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&r.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(c=>{c!=="cimode"&&i.indexOf(c)<0&&i.push(c)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(s=>a(s)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(l)})}else o(null)}reloadResources(e,n,o){const r=HD();return e||(e=this.languages),n||(n=this.options.ns),o||(o=RY),this.services.backendConnector.reload(e,n,i=>{r.resolve(),o(i)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&fYe.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}changeLanguage(e,n){var o=this;this.isLanguageChangingTo=e;const r=HD();this.emit("languageChanging",e);const i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve(function(){return o.t(...arguments)}),n&&n(s,function(){return o.t(...arguments)})},l=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const c=typeof s=="string"?s:this.services.languageUtils.getBestMatchFromCodes(s);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,u=>{a(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),r}getFixedT(e,n,o){var r=this;const i=function(a,l){let s;if(typeof l!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${s.keyPrefix}${f}${m}`):p=s.keyPrefix?`${s.keyPrefix}${f}${a}`:a,r.t(p,s)};return typeof e=="string"?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=o,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=this.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(o,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(o,e)&&(!r||a(i,e)))}loadNamespaces(e,n){const o=HD();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{o.resolve(),n&&n(r)}),o):(n&&n(),Promise.resolve())}loadLanguages(e,n){const o=HD();typeof e=="string"&&(e=[e]);const r=this.options.preload||[],i=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=r.concat(i),this.loadResources(a=>{o.resolve(),n&&n(a)}),o):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new K7e(Q7e());return n.indexOf(o.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new jF(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:RY;const o=e.forkResourceStore;o&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},i=new jF(r);return(e.debug!==void 0||e.prefix!==void 0)&&(i.logger=i.logger.clone(e)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},o&&(i.store=new X7e(this.store.data,r),i.services.resourceStore=i.store),i.translator=new pX(i.services,r),i.translator.on("*",function(l){for(var s=arguments.length,c=new Array(s>1?s-1:0),u=1;u()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function txe(t,e,n){t.loadNamespaces(e,hYe(t,n))}function nxe(t,e,n,o){typeof n=="string"&&(n=[n]),n.forEach(r=>{t.options.ns.indexOf(r)<0&&t.options.ns.push(r)}),t.loadLanguages(e,hYe(t,o))}function i5t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=e.languages[0],r=e.options?e.options.fallbackLng:!1,i=e.languages[e.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=e.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!a(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(o,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||a(o,t)&&(!r||a(i,t)))}function a5t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(z0e("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!i(r.isLanguageChangingTo,t))return!1}}):i5t(t,e,n)}const l5t=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,s5t={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},c5t=t=>s5t[t],u5t=t=>t.replace(l5t,c5t);let D0e={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:u5t};function d5t(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};D0e={...D0e,...t}}function f5t(){return D0e}let pYe;function h5t(t){pYe=t}function p5t(){return pYe}const g5t={type:"3rdParty",init(t){d5t(t.options.react),h5t(t)}},m5t=g.createContext();class y5t{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const A5t=(t,e)=>{const n=g.useRef();return g.useEffect(()=>{n.current=t},[t,e]),n.current};function Jl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:o,defaultNS:r}=g.useContext(m5t)||{},i=n||o||p5t();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new y5t),!i){z0e("You will need to pass in an i18next instance by using initReactI18next");const P=(S,v)=>typeof v=="string"?v:v&&typeof v=="object"&&typeof v.defaultValue=="string"?v.defaultValue:Array.isArray(S)?S[S.length-1]:S,A=[P,{},!1];return A.t=P,A.i18n={},A.ready=!1,A}i.options.react&&i.options.react.wait!==void 0&&z0e("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...f5t(),...i.options.react,...e},{useSuspense:l,keyPrefix:s}=a;let c=r||i.options&&i.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(c);const u=(i.isInitialized||i.initializedStoreOnce)&&c.every(P=>a5t(P,i,a));function d(){return i.getFixedT(e.lng||null,a.nsMode==="fallback"?c:c[0],s)}const[f,p]=g.useState(d);let m=c.join();e.lng&&(m=`${e.lng}${m}`);const y=A5t(m),w=g.useRef(!0);g.useEffect(()=>{const{bindI18n:P,bindI18nStore:A}=a;w.current=!0,!u&&!l&&(e.lng?nxe(i,e.lng,c,()=>{w.current&&p(d)}):txe(i,c,()=>{w.current&&p(d)})),u&&y&&y!==m&&w.current&&p(d);function S(){w.current&&p(d)}return P&&i&&i.on(P,S),A&&i&&i.store.on(A,S),()=>{w.current=!1,P&&i&&P.split(" ").forEach(v=>i.off(v,S)),A&&i&&A.split(" ").forEach(v=>i.store.off(v,S))}},[i,m]);const x=g.useRef(!0);g.useEffect(()=>{w.current&&!x.current&&p(d),x.current=!1},[i,s]);const C=[f,i,u];if(C.t=f,C.i18n=i,C.ready=u,u||!u&&!l)return C;throw new Promise(P=>{e.lng?nxe(i,e.lng,c,()=>P()):txe(i,c,()=>P())})}function w5t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BF(t){"@babel/helpers - typeof";return BF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},BF(t)}function x5t(t,e){if(BF(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(BF(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function v5t(t){var e=x5t(t,"string");return BF(e)==="symbol"?e:String(e)}function b5t(t,e){for(var n=0;n0){var l=r.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(l))}if(r.domain){if(!oxe.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(r.domain)}if(r.path){if(!oxe.test(r.path))throw new TypeError("option path is invalid");a+="; Path=".concat(r.path)}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){var s=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(s){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},rxe={create:function(e,n,o,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};o&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+o*60*1e3)),r&&(i.domain=r),document.cookie=R5t(e,encodeURIComponent(n),i)},read:function(e){for(var n="".concat(e,"="),o=document.cookie.split(";"),r=0;r-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=o.substring(1),i=r.split("&"),a=0;a0){var s=i[a].substring(0,l);s===e.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},MD=null,ixe=function(){if(MD!==null)return MD;try{MD=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{MD=!1}return MD},I5t={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&ixe()){var o=window.localStorage.getItem(e.lookupLocalStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&ixe()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},ID=null,axe=function(){if(ID!==null)return ID;try{ID=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{ID=!1}return ID},z5t={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&axe()){var o=window.sessionStorage.getItem(e.lookupSessionStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&axe()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},D5t={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var o=0;o0?n:void 0}},E5t={name:"htmlTag",lookup:function(e){var n,o=e.htmlTag||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(n=o.getAttribute("lang")),n}},k5t={name:"path",lookup:function(e){var n;if(typeof window<"u"){var o=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(o instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof o[e.lookupFromPathIndex]!="string")return;n=o[e.lookupFromPathIndex].replace("/","")}else n=o[0].replace("/","")}return n}},F5t={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,o=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[n]}};function L5t(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var mYe=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w5t(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return S5t(t,[{key:"init",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=C5t(o,this.options||{},L5t()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(H5t),this.addDetector(M5t),this.addDetector(I5t),this.addDetector(z5t),this.addDetector(D5t),this.addDetector(E5t),this.addDetector(k5t),this.addDetector(F5t)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var o=this;n||(n=this.options.order);var r=[];return n.forEach(function(i){if(o.detectors[i]){var a=o.detectors[i].lookup(o.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.map(function(i){return o.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}},{key:"cacheUserLanguage",value:function(n,o){var r=this;o||(o=this.options.caches),o&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||o.forEach(function(i){r.detectors[i]&&r.detectors[i].cacheUserLanguage(n,r.options)}))}}]),t}();mYe.type="languageDetector";const W5t={translation:{name:{IFI:"Institute for Future Intelligence",Aladdin:"Aladdin",Tagline:"Aladdin: Reimagining Design with Explainable AI — Institute for Future Intelligence"},cookie:{Statement:"By clicking Accept, you agree to our use of cookies to improve your experience with Aladdin.",Accept:"Accept"},aboutUs:{ProductBroughtToYouBy:"This product is brought to you by",TermsOfService:"Terms of Service",PrivacyPolicy:"Privacy Policy",Software:"Software",Content:"Content",Research:"Research",Support:"Support",Acknowledgment:"Acknowledgment",FundingInformation:"The National Science Foundation (NSF) generously provided funding for the research and development of this product through grants #2105695, #2131097, and #2301164. Any opinions, findings, and conclusions or recommendations expressed in this product, however, are those of the authors and do not necessarily reflect the views of NSF.",Contact:"For more information, please contact Charles Xie (charles@intofuture.org).",Translators:"Translators"},word:{Mute:"Mute",BrandName:"Brand Name",Name:"Name",Refresh:"Refresh",LastUpdate:"Last Update",Small:"Small",Medium:"Medium",Large:"Large",Design:"Design",Information:"Information",Type:"Type",Text:"Text",FontSize:"Font Size",FontColor:"Font Color",Model:"Model",Models:"Models",Upload:"Upload",ClickCount:"Click Count",Share:"Share",AlreadyLike:"Already like",Like:"Like",MustLogInToLike:"Must log in to like",AllRightsReserved:"All Rights Reserved",MeterAbbreviation:"m",VoltAbbreviation:"V",AmpereAbbreviation:"A",WattAbbreviation:"W",Version:"Version",VersionInitial:"V",Options:"Options",Maximum:"Maximum",Minimum:"Minimum",MaximumNumber:"Maximum Number",MinimumNumber:"Minimum Number",MaximumValue:"Maximum Value",MinimumValue:"Minimum Value",Or:"Or",None:"None",High:"High",Partial:"Partial",Teacher:"Teacher",Class:"Class",Total:"Total",Leaderboard:"Leaderboard",Latest:"Latest",Range:"Range",SIUnit:"SI Unit",USUnit:"US Unit",ThermalTransmittance:"Thermal Transmittance",ThermalResistance:"Thermal Resistance",UValue:"U-Value",RValue:"R-Value",VolumetricHeatCapacity:"Volumetric Heat Capacity",Press:"Press",Open:"Open",Save:"Save",SaveAsImage:"Save as Image",SaveAsCsv:"Save as CSV",Update:"Update",Paste:"Paste",Copy:"Copy",Cut:"Cut",Delete:"Delete",Add:"Add",Lock:"Lock",Translucent:"Translucent",Transparency:"Transparency",Color:"Color",Pattern:"Pattern",Texture:"Texture",Size:"Size",Thickness:"Thickness",Yes:"Yes",No:"No",NoAndDoNotAskAgain:"No and don't ask again",OK:"OK",Cancel:"Cancel",Apply:"Apply",Close:"Close",ApplyTo:"Apply to",Run:"Run",Pause:"Pause",Resume:"Resume",Clear:"Clear",Warning:"Warning",Caution:"Caution",Reminder:"Reminder",Length:"Length",Width:"Width",Height:"Height",Radius:"Radius",Angle:"Angle",Azimuth:"Azimuth",Coordinates:"Coordinates",Weather:"Weather",Show:"Show",Animate:"Animate",Date:"Date",Time:"Time",Title:"Title",Owner:"Owner",Action:"Action",Rename:"Rename",Location:"Location",Latitude:"Latitude",Month:"Month",Day:"Day",Hour:"Hour",Daylight:"Daylight",Radiation:"Radiation",Temperature:"Temperature",kWh:"kWh",dollar:"dollar",MeterPerSecond:"m/s",NorthInitial:"N",SouthInitial:"S",EastInitial:"E",WestInitial:"W",Fixed:"Fixed",Elements:"Elements",Energy:"Energy",Unknown:"Unknown",Label:"Label",Description:"Description",NoDescription:"No description",MaximumCharacters:"Maximum characters",Author:"Author",Publisher:"Publisher",Building:"Building",ResidentialBuilding:"Residential Building",CommercialBuilding:"Commercial Building",SchoolBuilding:"School Building",TouristAttraction:"Tourist Attraction",UnderConstruction:"Under Construction",Photovoltaic:"Photovoltaic",WindPower:"Wind Power",ColocationProjects:"Colocation Projects",Anonymous:"Anonymous",Nickname:"Nickname",Pin:"Pin",Unpin:"Unpin"},shared:{NoTexture:"No Texture",FoundationElement:"Foundation",CuboidElement:"Cuboid",PolygonElement:"Polygon",SensorElement:"Sensor",SolarPanelElement:"Solar Panel",SolarWaterHeaterElement:"Solar Water Heater",ParabolicDishElement:"Parabolic Dish",ParabolicTroughElement:"Parabolic Trough",FresnelReflectorElement:"Fresnel Reflector",HeliostatElement:"Heliostat",WindTurbineElement:"Wind Turbine",LightElement:"Light",ElementLocked:"Locked",ModelType:"Model Type",OutputBreakdown:"Breakdown",MoreResults:"More Results"},message:{DoNotShowAgain:"Don't show again",NewVersionAvailable:"A new version is available",CalculationMayBeSlowDoYouWantToContinue:"Calculation may be slow. Do you want to continue?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"Increase solar radiation heatmap grid cell size to speed up",ModelNotFound:"Model not found",CannotSignIn:"Cannot sign in",CannotSignOut:"Cannot sign out",YourAccountWasCreated:"Your account was created.",CannotCreateAccount:"Cannot create an account",YourAccountSettingsWereSaved:"Your account settings were saved.",CannotSaveYourAccountSettings:"Cannot save your account settings",CannotSaveYourFileToCloud:"Cannot save your file to the cloud",CannotCreateNewProject:"Cannot create a new project",CannotCreateNewProjectWithoutTitle:"Cannot create a new project without a title",CannotOpenYourProjects:"Cannot open your projects",CannotOpenProject:"Cannot open the project",CannotDeleteProject:"Cannot delete the project",CannotRenameProject:"Cannot rename the project",CannotAddDesignToProject:"Cannot add this design to the project",CannotAddDesignToProjectOwnedByOthers:"Cannot add this design to a project owned by others",DesignRemovedFromProject:"The design was successfully removed from the project",CannotRemoveDesignFromProject:"Cannot remove this design from the project",CannotUpdateProject:"Cannot update the project",CannotFetchProjectData:"Cannot fetch project data",TitleUsedChooseDifferentOne:"This title has been used. Choose a different one",CloudFileWithTitleExistsDoYouWantToOverwrite:"A cloud file with the title exists. Do you want to overwrite it?",CloudFileNotFound:"The cloud file was not found",CannotLoadModelsOnMap:"Cannot load models on map",CannotLoadLeaderboard:"Cannot load leaderboard",CannotPublishModelOnMap:"Cannot publish model on map",CannotLikeModelFromMap:"Cannot like model from map",CannotDeleteModelFromMap:"Cannot delete model from map",ModelDeletedFromMap:"Model is deleted from map",DoYouWantToDeleteModelFromMap:"Do you want to delete the model from map?",CannotOpenCloudFile:"Cannot open the cloud file",CannotReadCloudFile:"Cannot read the cloud file",CannotWriteCloudFile:"Cannot write the cloud file",CloudFileCopied:"Cloud file copied",CannotOpenCloudFolder:"Cannot open your cloud folder",CannotDeleteCloudFile:"Cannot delete the cloud file",CannotRenameCloudFile:"Cannot rename the cloud file",DoYouWantToSaveChanges:"Do you want to save changes?",DoYouWantToUpdateDesign:"Do you want to update this design?",NotApplicableToSelectedAction:"Not Applicable to Selected Action",ThisElementIsLocked:"This element is locked.",ThisCannotBeUndone:"This cannot be undone.",AzimuthOfNorthIsZero:"Azimuth of north is 0°",CounterclockwiseAzimuthIsPositive:"Counter-clockwise is positive",SouthFacingIsZero:"South-facing is 0°",ClockwiseRotationIsPositive:"Clockwise is positive",MoveCancelledBecauseOfOverlap:"Move cancelled because of overlap.",MoveOutsideBoundaryCancelled:"Move outside the boundary cancelled.",RotationCancelledBecauseOfOverlap:"Rotation cancelled because of overlap.",RotationOutsideBoundaryCancelled:"Rotation outside the boundary cancelled.",ResizingCancelledBecauseOfOverlap:"Resizing cancelled because of overlap.",ResizingOutsideBoundaryCancelled:"Resizing outside the boundary cancelled.",CannotPasteOutsideBoundary:"Cannot paste outside the boundary.",CannotPasteBecauseOfOverlap:"Cannot paste because of overlap.",CannotMoveObjectTooFar:"Cannot move object too far.",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"Existing solar panels will be removed before applying the new layout.",DoYouWantToContinue:"Do you want to continue?",SolarPanelsCannotIntersectWithGround:"Solar panels cannot intersect with the ground.",SolarPanelsCannotOverlapWithOneAnother:"Solar panels cannot overlap with one another.",ScreenshotSaved:"A screenshot was saved.",CsvFileSaved:"A CSV file was saved.",SimulationStarted:"Simulation started.",SimulationCompleted:"Simulation completed.",SimulationAborted:"Simulation aborted.",SimulationPaused:"Simulation paused.",CancelSimulation:"Cancel simulation",PauseSimulation:"Pause simulation",ResumeSimulation:"Resume simulation",SimulationWillNotStartDueToErrors:"Simulation will not start due to errors",SimulationWillStartDespiteWarnings:"Simulation will start despite warnings.",EvolutionStarted:"Evolution started.",EvolutionCompleted:"Evolution completed.",EvolutionAborted:"Evolution aborted.",EvolutionPaused:"Evolution paused.",EncounterEvolutionError:"Encountered an evolution error.",CancelEvolution:"Cancel evolution",PauseEvolution:"Pause evolution",ResumeEvolution:"Resume evolution",ConvergenceThresholdHasBeenReached:"The convergence threshold has been reached.",MaximumNumberOfGenerationsHasBeenReached:"The maximum number of generations has been reached.",MaximumNumberOfStepsHasBeenReached:"The maximum number of steps has been reached.",ObjectiveFunctionTypeError:"The current objective function is not supported by this operation. Please start from the menu.",WallsAreNotAtSameHeight:"Walls are not at the same height.",WallsAreNotPerpendicular:"Walls are not perpendicular.",WallsAreNotConnected:"Walls are not connected.",WallsNumberNeedToBeFour:"The number of walls needs to be four.",BuildingContainsEmptyWall:"Building contains one or more empty wall.",BuildingRoofMissing:"Building has a missing roof.",UnknownErrors:"Unknown errors.",SigningOutAnonymousAccount:"Are you sure you want to sign out? This anonymous account will be lost.",SigningInAnonymousAccount:"Are you sure you want to sign in anonymously? An anonymous account will be lost if you sign out. It should be used only for temporary purposes and on the same computer."},menu:{AnalysisOptions:"Analysis Options",option:{GridCellSize:"Grid Cell Size",SamplingFrequency:"Sampling Frequency",TimesPerHour:"Times per Hour",DaysPerYear:"Days per Year"},mainMenu:"Main Menu",cloudMenu:"Cloud Menu",projectSubMenu:"Project",project:{CreateNewProject:"Create New Project",OpenProject:"Open Project",SaveProject:"Save Project",SaveProjectAs:"Save Project As",YouMustLogInToCreateProject:"You must log in to create a new project",YouMustLogInToOpenProject:"You must log in to open a project"},fileSubMenu:"File",file:{CreateNewFile:"Create New File",OpenLocalFile:"Open Local File",SaveAsLocalFile:"Save as Local File",SavingAbortedMustHaveValidFileName:"Saving aborted! You must have a valid file name",OpenCloudFile:"Open Cloud File",SaveCloudFile:"Save Cloud File",SaveAsCloudFile:"Save as Cloud File",SavingAbortedMustHaveValidTitle:"Saving aborted! You must have a valid title for a cloud file",ToSaveYourWorkPleaseSignIn:"To save your work, please sign in.",TakeScreenshot:"Take Screenshot",UseCloudFileName:"Use Cloud File Name",PublishOnModelsMap:"Publish on Models Map",PublishedOnModelsMap:"Your model has been published on the Models Map",UpdatedOnModelsMap:"Your model has been updated on the Models Map",YouMustLogInToPublishYourModel:"You must log in to publish your model",YouCannotPublishAModelThatYouDoNotOwn:"You cannot publish a model that you do not own",YouMustSaveModelOnCloudBeforePublishingIt:"You must save the model on the cloud before publishing it"},editSubMenu:"Edit",edit:{Undo:"Undo",Redo:"Redo",Undone:"Undone"},viewSubMenu:"View",view:{ModelTree:"Model Tree",NavigationView:"Navigation View",TwoDimensionalView:"2D View",ResetView:"Reset",ZoomIn:"Zoom In",ZoomOut:"Zoom Out",AutoRotate:"Auto Rotate",ShowShadow:"Show Shadow",ShowSurfaceShininess:"Show Surface Shininess",TranslucentFloatingWindows:"Translucent Floating Windows",accessoriesSubMenu:"Accessories",accessories:{SiteInformation:"Site Information",DesignInformation:"Design Information",Instruction:"Instruction",StickyNote:"Sticky Note",Note:"Note"}},settingsSubMenu:"Settings",settings:{WeatherData:"Weather Data",DiurnalTemperature:"Diurnal Temperature",Heliodon:"Heliodon",SunAndTime:"Sun & Time",CustomSolarPanels:"Custom Solar Panels",CustomizeSolarPanel:"Customize Solar Panel"},benchmarksSubMenu:"Benchmarks",benchmarks:{SolarRadiationPredictionVsMeasurement:"Solar Radiation Prediction vs. Measurement",BESTESTCase600:"Building Energy Simulation Test: BESTEST Case 600",BESTESTCase610:"Building Energy Simulation Test: BESTEST Case 610",BESTESTCase620:"Building Energy Simulation Test: BESTEST Case 620",BESTESTCase630:"Building Energy Simulation Test: BESTEST Case 630"},graph:{LineWidth:"Line Width",SymbolSize:"Symbol Size",BarCategoryGap:"Bar Category Gap",ShowHorizontalGridLines:"Show Horizontal Grid Lines",ShowVerticalGridLines:"Show Vertical Grid Lines"},analysisSubMenu:"Analysis",physicsSubMenu:"Physics",physics:{DailySolarRadiationHeatmap:"Daily Solar Radiation Heatmap",SolarRadiationHeatmapOptions:"Solar Radiation Heatmap Options",SolarRadiationHeatmapGridCellSize:"Solar Radiation Heatmap Grid Cell Size",SolarRadiationHeatmapMaxValue:"Solar Radiation Heatmap Maximum Value",SolarRadiationHeatmapNoAnimation:"No Animation for Static Model",ReflectionHeatmap:"Reflection Heatmap"},sensorSubMenu:"Sensor",sensor:{CollectDailyData:"Collect Daily Data",CollectYearlyData:"Collect Yearly Data",SensorSimulationNoAnimation:"No Animation for Collecting Sensor Data"},buildingSubMenu:"Building",building:{AnalyzeDailyBuildingEnergy:"Analyze Daily Building Energy",AnalyzeYearlyBuildingEnergy:"Analyze Yearly Building Energy",EnergyAnalysisOptions:"Energy Analysis Options",EnergyGridCellSize:"Energy Grid Cell Size",BuildingEnergySimulationNoAnimation:"No Animation for Building Energy Simulation"},solarPanelSubMenu:"Solar Panel",solarPanel:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield",AnalyzeVisibility:"Analyze Visibility",PanelDiscretization:"Panel Discretization",Exact:"Exact",Approximate:"Approximate",EnergyGridCellSize:"Energy Grid Cell Size",VisibilityGridCellSize:"View Factor Grid Cell Size",EnergyAnalysisOptions:"Energy Analysis Options",VisibilityAnalysisOptions:"Visibility Analysis Options",SolarPanelSimulationNoAnimation:"No Animation for Solar Panel Simulation"},parabolicTroughSubMenu:"Parabolic Trough",parabolicTrough:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},parabolicDishSubMenu:"Parabolic Dish",parabolicDish:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},fresnelReflectorSubMenu:"Fresnel Reflector",fresnelReflector:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},heliostatSubMenu:"Heliostat",heliostat:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},solarUpdraftTowerSubMenu:"Solar Updraft Tower",solarUpdraftTower:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield",SolarUpdraftTowerSimulationNoAnimation:"No Animation for Solar Updraft Tower Simulation"},tutorialsSubMenu:"Tutorials",solarEnergyScienceSubMenu:"Solar Science",solarEnergyScienceTutorials:{SunAngles:"Sun Angles Relative to an Observer on the Ground",InsolationAndClimate:"Insolation and Climate",SolarRadiationToBox:"Solar Radiation to a Box"},buildingScienceSubMenu:"Building Science",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"Thermal Envelope vs. Building Envelope",EffectOfSizeOnBuildingEnergy:"Effect of Size on Building Energy",EffectOfOrientationOnBuildingEnergy:"Effect of Orientation on Building Energy",EffectOfInsulationOnBuildingEnergy:"Effect of Insulation on Building Energy",EffectOfRoofColorOnBuildingEnergy:"Effect of Roof Color on Building Energy",EffectOfEavesOverhangLengthOnBuildingEnergy:"Effect of Eaves Overhang Length on Building Energy",EffectOfWindowSHGCOnBuildingEnergy:"Effect of Window Solar Heat Gain on Building Energy",EffectOfThermostatSetpointOnBuildingEnergy:"Effect of Thermostat Setpoint on Building Energy",EffectOfProgrammableThermostatOnBuildingEnergy:"Effect of Programmable Thermostat on Building Energy",EffectOfSolarPanelsOnBuildingEnergy:"Effect of Solar Panels on Building Energy",EffectOfGroundTemperatureOnBuildingEnergy:"Effect of Ground Temperature on Building Energy",EffectOfTreesOnBuildingEnergy:"Effect of Trees on Building Energy"},buildingDesignSubMenu:"Building Design",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"Cape Cod Style House with Shed Dormer",MansardRoofWithDormers:"Mansard Roof with Dormers",GableRoofVsHipRoof:"Gable Roof vs. Hip Roof",ColonialVsSaltbox:"Colonial vs. Saltbox",GambrelRoofVsMansardRoof:"Gambrel Roof vs. Mansard Roof",CombinationRoofVsBonnetRoof:"Combination Roof vs. Bonnet Roof",DutchGableRoof:"Dutch Gable Roof",GableAndValleyRoof:"Gable and Valley Roof",ClerestoryRoof:"Clerestory Roof",MonitorRoof:"Monitor Roof",AFrameHouse:"A-Frame House",HalfTimberedHouse:"Half-Timbered House",AllBasicRoofTypes:"All Basic Roof Types"},photovoltaicSolarPowerSubMenu:"Photovoltaic Solar Power",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"Effect of Tilt Angle of a Solar Panel",EffectOfAzimuthOfSolarPanel:"Effect of Azimuth of a Solar Panel",SolarPanelTypes:"Solar Panel Types",DefineYourOwnSolarPanels:"Define Your Own Solar Panels",VerticalBifacialSolarPanels:"Vertical Bifacial Solar Panels",CompareMonofacialAndBifacialSolarPanels:"Monofacial vs. Bifacial Solar Panels",SolarTrackers:"Solar Trackers",CoveringGroundWithSolarPanels:"Why Just Covering the Ground with Solar Panels is not a Good Idea",InterRowSpacingOfSolarPanelArray:"Effect of Inter-Row Spacing in a Solar Panel Array",EffectOfOrientationOfSolarPanels:"Effect of Orientation of Solar Panels",SolarPanelArrayAutomaticLayout:"Solar Panel Array Automatic Layout"},concentratedSolarPowerSubMenu:"Concentrated Solar Power",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"Effect of Azimuth of a Parabolic Trough",EffectOfLatusRectumOfParabolicTrough:"Effect of Latus Rectum of a Parabolic Trough",FocusSunlightWithParabolicDish:"Focus Sunlight with a Parabolic Dish",LinearFresnelReflectors:"Linear Fresnel Reflectors",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"Effect of Absorber Pipe Height for Linear Fresnel Reflectors",EffectOfAzimuthOfLinearFresnelReflectors:"Effect of Azimuth of Linear Fresnel Reflectors",LinearFresnelReflectorsWithTwoAbsorbers:"Linear Fresnel Reflectors with Two Absorbers",CosineEfficiencyOfHeliostats:"Cosine Efficiency of Heliostats",ShadowingAndBlockingOfHeliostats:"Shadowing and Blocking of Heliostats",EffectSolarPowerTowerHeight:"Effect of Solar Power Tower Height",SolarPowerTower:"Solar Power Tower"},otherTypesOfSolarPowerSubMenu:"Other Types of Solar Power",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"Solar Water Heaters",SolarUpdraftTower:"Solar Updraft Tower"},windPowerSubMenu:"Wind Power",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"Effect of Blade Number of Wind Turbine",EffectOfPitchAngleOfWindTurbineBlades:"Effect of Pitch Angle of Wind Turbine Blades",BirdSafeBladeDesign:"Bird-Safe Blade Design",OffshoreWindFarm:"Offshore Wind Farm"},colocationSubMenu:"Colocation",colocationTutorials:{AgricultureSolarWindColocation:"Agriculture-Solar-Wind Colocation"},generativeDesignSubMenu:"Generative Design",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Monofacial Solar Panel Array",BifacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Bifacial Solar Panel Array",SolarPanelArrayInterRowSpacing:"The Inter-Row Spacing of a Solar Panel Array",OutputOfSolarPanelArrayInDifferentPlaces:"The Output of a Solar Panel Array in Different Places",SimpleSolarFarmParetoFront:"The Pareto Front for Designing a Simple Solar Farm"},examplesSubMenu:"Examples",solarEnergySubMenu:"Solar Energy",solarEnergyExamples:{SunBeamAndHeliodon:"Sun Beam and Heliodon",RooftopSolarPanels:"Rooftop Solar Panels",NevadaSolarOneParabolicTroughArray:"Nevada Solar One Parabolic Trough Array",TooeleParabolicDishArray:"Tooele Parabolic Dish Array",PS10SolarPowerTower:"PS10 Solar Power Tower",TucsonLinearFresnelReflectors:"Tucson Linear Fresnel Reflectors",SolarCanopyFormFactors:"Solar Canopy Form Factors",SolarCanopyOverBleachers:"Solar Canopy Over Bleachers",SolarCanopyOverGarage:"Solar Canopy Over Garage",SolarBusStop:"Solar Bus Stop",SolarFacadeTesla:"Tesla Solar Façade",BuildingIntegratedPhotovoltaics:"Building-Integrated Photovoltaics",Floatovoltaics:"Floatovoltaics",Agrivoltaics:"Agrivoltaics",VegetativeBuffer:"Vegetative Buffer",RainbowSwashSolarFarmBostonMA:"Rainbow Swash Solar Farm in Boston, MA",MickeyMouseSolarFarmOrlandoFL:"Mickey Mouse Solar Farm in Orlando, FL",SolarPanelsOverCanalBakersfieldCA:"Hypothetical Solar Panels Over Canal in Bakersfield, CA",SolarNoiseBarrierLexingtonMA:"Hypothetical Solar Noise Barrier in Lexington, MA",HSATSolarTrackersRaleighNC:"Horizontal Single Axis Trackers (HSAT) in Raleigh, NC",AADATSolarTrackersLancasterCA:"Azimuth–Altitude Dual Axis Trackers (AADAT) in Lancaster, CA",SolarUpdraftTowerInCity:"Solar Updraft Tower in City"},builtEnvironmentSubMenu:"Built Environment",residentialBuildingsSubMenu:"Residential Buildings",residentialBuildingExamples:{ColonialHouse:"Colonial House",DutchColonialHouse:"Dutch Colonial House",TShapedHouse:"T-Shaped House",CapeCodHouseWithGarage:"Cape Cod House with Garage",Solarium:"Solarium",Church1:"Church 1",Cathedral1:"Cathedral 1",Cathedral2:"Cathedral 2",Mosque1:"Mosque 1",AdobeTaosHouse:"Adobe Taos House",RanchHouse:"Ranch House",BonnetHouse:"Bonnet House",BarnStyleHouse:"Barn Style House",ModernHouse:"Modern House",ButterflyRoofHouse:"Butterfly Roof House"},commercialBuildingsSubMenu:"Commercial Buildings",commercialBuildingExamples:{WhiteHouse:"White House",HaroldWashingtonCollege:"Harold Washington College",BilimMersinTurkiye:"BILIM, Mersin, Turkiye",SpanishStyleHotel:"Spanish Style Hotel",ApartmentBuilding:"Apartment Building",OfficeBuilding:"Office Building",Hotel:"Hotel"},buildingComplexesSubMenu:"Building Complexes",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"South Burlington High School, VT",MescaleroApacheSchoolNewMexico:"Mescalero Apache School, NM"},urbanPlanningSubMenu:"Urban Planning",urbanPlanningExamples:{CityBlockHeatmap:"City Block Heatmap",ChicagoSkyline:"Chicago Skyline"},otherBuildingsSubMenu:"Other Buildings",otherBuildingExamples:{Greenhouse:"Greenhouse",Pavilion:"Pavilion in a Park",OctagonalPagoda:"Octagonal Pagoda",OceanFront:"Ocean Front",EgyptianPyramids:"Egyptian Pyramids",MayanPyramid:"Mayan Pyramid",SiOSePol:"Si-o-se-pol",StackedCuboids:"Stacked Cuboids"},artificialIntelligenceSubMenu:"Artificial Intelligence",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"Optimizing the Tilt Angle of a Solar Panel Row",OptimizingTiltAnglesOfMultipleSolarPanelRows:"Optimizing the Tilt Angles of Multiple Solar Panel Rows",SolarFarmGenerativeDesign:"Solar Farm Generative Design",SolarFarmGenerativeDesignWithBlock:"Solar Farm Generative Design in the Presence of a Block",FitchburgSolarFarmGenerativeDesign:"Fitchburg Solar Farm Generative Design"},languageSubMenu:"Language",publicSubMenu:"Public",ModelsGallery:"Models Gallery",ModelsMap:"Models Map",AboutUs:"About Us"},HVACMenu:{BuildingHVACSystem:"Building HVAC System",ID:"ID",Tolerance:"Tolerance",ToleranceExplanation:`Heater will not run if the lowest outside temperature of the day is higher than the setpoint minus this threshold. +`);var E=0,L=!1;this.parse=function(j,Y,O){if(typeof j!="string")throw new Error("Input must be a string");var _=j.length,G=M.length,Q=D.length,oe=k.length,ee=b(N),$=[],ae=[],Z=[],ne=E=0;if(!j)return Ne();if(T.header&&!Y){var te=j.split(D)[0].split(M),q=[],le={},de=!1;for(var he in te){var me=te[he];b(T.transformHeader)&&(me=T.transformHeader(me,he));var ce=me,Pe=le[me]||0;for(0=U)return Ne(!0)}else for(ge=E,E++;;){if((ge=j.indexOf(R,ge+1))===-1)return O||ae.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:$.length,index:E}),Te();if(ge===_-1)return Te(j.substring(E,ge).replace(se,R));if(R!==F||j[ge+1]!==F){if(R===F||ge===0||j[ge-1]!==F){ze!==-1&&ze=U)return Ne(!0);break}ae.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:$.length,index:E}),ge++}}else ge++}return Te();function Me(Ue){$.push(Ue),ne=E}function Ce(Ue){var qe=0;if(Ue!==-1){var Fe=j.substring(ge+1,Ue);Fe&&Fe.trim()===""&&(qe=Fe.length)}return qe}function Te(Ue){return O||(Ue===void 0&&(Ue=j.substring(E)),Z.push(Ue),E=_,Me(Z),ee&&_e()),Ne()}function Re(Ue){E=Ue,Me(Z),Z=[],Ae=j.indexOf(D,E)}function Ne(Ue){return{data:$,errors:ae,meta:{delimiter:M,linebreak:D,aborted:L,truncated:!!Ue,cursor:ne+(Y||0)}}}function _e(){N(Ne()),$=[],ae=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return E}}function C(T){var R=T.data,M=a[R.workerId],D=!1;if(R.error)M.userError(R.error,R.file);else if(R.results&&R.results.data){var k={abort:function(){D=!0,P(R.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:A,resume:A};if(b(M.userStep)){for(var N=0;N1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||k2t,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),o=0;o{this.observers[o]||(this.observers[o]=new Map);const r=this.observers[o].get(n)||0;this.observers[o].set(n,r+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r{let[l,s]=a;for(let c=0;c{let[l,s]=a;for(let c=0;c{t=o,e=r});return n.resolve=t,n.reject=e,n}function V7e(t){return t==null?"":""+t}function L2t(t,e,n){t.forEach(o=>{e[o]&&(n[o]=e[o])})}const W2t=/###/g;function Hk(t,e,n){function o(l){return l&&l.indexOf("###")>-1?l.replace(W2t,"."):l}function r(){return!t||typeof t=="string"}const i=typeof e!="string"?e:e.split(".");let a=0;for(;a":">",'"':""","'":"'","/":"/"};function B2t(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,e=>j2t[e]):t}class Y2t{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const o=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,o),this.regExpQueue.push(e),o}}const O2t=[" ",",","?","!",";"],_2t=new Y2t(20);function V2t(t,e,n){e=e||"",n=n||"";const o=O2t.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(o.length===0)return!0;const r=_2t.getRegExp(`(${o.map(a=>a==="?"?"\\?":a).join("|")})`);let i=!r.test(t);if(!i){const a=t.indexOf(n);a>0&&!r.test(t.substring(0,a))&&(i=!0)}return i}function I0e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const o=e.split(n);let r=t;for(let i=0;i-1&&s0?t.replace("_","-"):t}class X7e extends Aq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,n],o&&(Array.isArray(o)?l.push(...o):typeof o=="string"&&i?l.push(...o.split(i)):l.push(o)));const s=fX(this.data,l);return!s&&!n&&!o&&e.indexOf(".")>-1&&(e=l[0],n=l[1],o=l.slice(2).join(".")),s||!a||typeof o!="string"?s:I0e(this.data&&this.data[e]&&this.data[e][n],o,i)}addResource(e,n,o,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[e,n];o&&(l=l.concat(a?o.split(a):o)),e.indexOf(".")>-1&&(l=e.split("."),r=n,n=l[1]),this.addNamespaces(n),G7e(this.data,l,r),i.silent||this.emit("added",e,n,o,r)}addResources(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in o)(typeof o[i]=="string"||Object.prototype.toString.apply(o[i])==="[object Array]")&&this.addResource(e,n,i,o[i],{silent:!0});r.silent||this.emit("added",e,n,o)}addResourceBundle(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),r=o,o=n,n=l[1]),this.addNamespaces(n);let s=fX(this.data,l)||{};a.skipCopy||(o=JSON.parse(JSON.stringify(o))),r?dYe(s,o,i):s={...s,...o},G7e(this.data,l,s),a.silent||this.emit("added",e,n,o)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var fYe={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,o,r){return t.forEach(i=>{this.processors[i]&&(e=this.processors[i].process(e,n,o,r))}),e}};const J7e={};class pX extends Aq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),L2t(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=e3.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const o=this.resolve(e,n);return o&&o.res!==void 0}extractFromKey(e,n){let o=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const a=o&&e.indexOf(o)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!V2t(e,o,r);if(a&&!l){const s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};const c=e.split(o);(o!==r||o===r&&this.options.ns.indexOf(c[0])>-1)&&(i=c.shift()),e=c.join(r)}return typeof i=="string"&&(i=[i]),{key:e,namespaces:i}}translate(e,n,o){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],n),s=l[l.length-1],c=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(u){const A=n.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${A}${a}`,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:`${s}${A}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:a}const d=this.resolve(e,n);let f=d&&d.res;const p=d&&d.usedKey||a,m=d&&d.exactUsedKey||a,y=Object.prototype.toString.apply(f),w=["[object Number]","[object Function]","[object RegExp]"],x=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,C=!this.i18nFormat||this.i18nFormat.handleAsObject;if(C&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&w.indexOf(y)<0&&!(typeof x=="string"&&y==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const A=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(d.res=A,d.usedParams=this.getUsedParamsDetails(n),d):A}if(i){const A=y==="[object Array]",S=A?[]:{},v=A?m:p;for(const b in f)if(Object.prototype.hasOwnProperty.call(f,b)){const T=`${v}${i}${b}`;S[b]=this.translate(T,{...n,joinArrays:!1,ns:l}),S[b]===T&&(S[b]=f[b])}f=S}}else if(C&&typeof x=="string"&&y==="[object Array]")f=f.join(x),f&&(f=this.extendTranslation(f,e,n,o));else{let A=!1,S=!1;const v=n.count!==void 0&&typeof n.count!="string",b=pX.hasDefaultValue(n),T=v?this.pluralResolver.getSuffix(c,n.count,n):"",R=n.ordinal&&v?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",M=v&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),D=M&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${T}`]||n[`defaultValue${R}`]||n.defaultValue;!this.isValidLookup(f)&&b&&(A=!0,f=D),this.isValidLookup(f)||(S=!0,f=a);const N=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,U=b&&D!==f&&this.options.updateMissing;if(S||A||U){if(this.logger.log(U?"updateKey":"missingKey",c,s,a,U?D:f),i){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let W=[];const F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&F&&F[0])for(let L=0;L{const O=b&&Y!==f?Y:N;this.options.missingKeyHandler?this.options.missingKeyHandler(L,s,j,O,U,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,s,j,O,U,n),this.emit("missingKey",L,s,j,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?W.forEach(L=>{const j=this.pluralResolver.getSuffixes(L,n);M&&n[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(Y=>{E([L],a+Y,n[`defaultValue${Y}`]||D)})}):E(W,a,D))}f=this.extendTranslation(f,e,n,d,o),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${s}:${a}`),(S||A)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${a}`:a,A?f:void 0):f=this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(e,n,o,r,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const c=typeof e=="string"&&(o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let d=o.replace&&typeof o.replace!="string"?o.replace:o;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,o.lng||this.language,o),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;u1&&arguments[1]!==void 0?arguments[1]:{},o,r,i,a,l;return typeof e=="string"&&(e=[e]),e.forEach(s=>{if(this.isValidLookup(o))return;const c=this.extractFromKey(s,n),u=c.key;r=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),m=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(w=>{this.isValidLookup(o)||(l=w,!J7e[`${y[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(J7e[`${y[0]}-${w}`]=!0,this.logger.warn(`key "${r}" for languages "${y.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(x=>{if(this.isValidLookup(o))return;a=x;const C=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(C,u,x,w,n);else{let A;f&&(A=this.pluralResolver.getSuffix(x,n.count,n));const S=`${this.options.pluralSeparator}zero`,v=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(C.push(u+A),n.ordinal&&A.indexOf(v)===0&&C.push(u+A.replace(v,this.options.pluralSeparator)),p&&C.push(u+S)),m){const b=`${u}${this.options.contextSeparator}${n.context}`;C.push(b),f&&(C.push(b+A),n.ordinal&&A.indexOf(v)===0&&C.push(b+A.replace(v,this.options.pluralSeparator)),p&&C.push(b+S))}}let P;for(;P=C.pop();)this.isValidLookup(o)||(i=P,o=this.getResource(x,w,P,n))}))})}),{res:o,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,o,r):this.resourceStore.getResource(e,n,o,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=e.replace&&typeof e.replace!="string";let r=o?e.replace:e;if(o&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!o){r={...r};for(const i of n)delete r[i]}return r}static hasDefaultValue(e){const n="defaultValue";for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&n===o.substring(0,n.length)&&e[o]!==void 0)return!0;return!1}}function $ie(t){return t.charAt(0).toUpperCase()+t.slice(1)}class K7e{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=e3.create("languageUtils")}getScriptPartFromCode(e){if(e=hX(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=hX(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let o=e.split("-");return this.options.lowerCaseLng?o=o.map(r=>r.toLowerCase()):o.length===2?(o[0]=o[0].toLowerCase(),o[1]=o[1].toUpperCase(),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=$ie(o[1].toLowerCase()))):o.length===3&&(o[0]=o[0].toLowerCase(),o[1].length===2&&(o[1]=o[1].toUpperCase()),o[0]!=="sgn"&&o[2].length===2&&(o[2]=o[2].toUpperCase()),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=$ie(o[1].toLowerCase())),n.indexOf(o[2].toLowerCase())>-1&&(o[2]=$ie(o[2].toLowerCase()))),o.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(o=>{if(n)return;const r=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(o=>{if(n)return;const r=this.getLanguagePartFromCode(o);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(i=>{if(i===r)return i;if(!(i.indexOf("-")<0&&r.indexOf("-")<0)&&(i.indexOf("-")>0&&r.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===r||i.indexOf(r)===0&&r.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!n)return e.default||[];let o=e[n];return o||(o=e[this.getScriptPartFromCode(n)]),o||(o=e[this.formatLanguageCode(n)]),o||(o=e[this.getLanguagePartFromCode(n)]),o||(o=e.default),o||[]}toResolveHierarchy(e,n){const o=this.getFallbackCodes(n||this.options.fallbackLng||[],e),r=[],i=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(e))):typeof e=="string"&&i(this.formatLanguageCode(e)),o.forEach(a=>{r.indexOf(a)<0&&i(this.formatLanguageCode(a))}),r}}let G2t=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],X2t={1:function(t){return+(t>1)},2:function(t){return+(t!=1)},3:function(t){return 0},4:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},5:function(t){return t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},6:function(t){return t==1?0:t>=2&&t<=4?1:2},7:function(t){return t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},8:function(t){return t==1?0:t==2?1:t!=8&&t!=11?2:3},9:function(t){return+(t>=2)},10:function(t){return t==1?0:t==2?1:t<7?2:t<11?3:4},11:function(t){return t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3},12:function(t){return+(t%10!=1||t%100==11)},13:function(t){return+(t!==0)},14:function(t){return t==1?0:t==2?1:t==3?2:3},15:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2},16:function(t){return t%10==1&&t%100!=11?0:t!==0?1:2},17:function(t){return t==1||t%10==1&&t%100!=11?0:1},18:function(t){return t==0?0:t==1?1:2},19:function(t){return t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3},20:function(t){return t==1?0:t==0||t%100>0&&t%100<20?1:2},21:function(t){return t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0},22:function(t){return t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3}};const J2t=["v1","v2","v3"],K2t=["v4"],$7e={zero:0,one:1,two:2,few:3,many:4,other:5};function $2t(){const t={};return G2t.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:X2t[e.fc]}})}),t}class q2t{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=e3.create("pluralResolver"),(!this.options.compatibilityJSON||K2t.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=$2t()}addRule(e,n){this.rules[e]=n}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(hX(e==="dev"?"en":e),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return this.shouldUseIntlApi()?o&&o.resolvedOptions().pluralCategories.length>1:o&&o.numbers.length>1}getPluralFormsOfKey(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,o).map(r=>`${n}${r}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort((r,i)=>$7e[r]-$7e[i]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):o.numbers.map(r=>this.getSuffix(e,r,n)):[]}getSuffix(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,o);return r?this.shouldUseIntlApi()?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:this.getSuffixRetroCompatible(r,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const o=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let r=e.numbers[o];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(r===2?r="plural":r===1&&(r=""));const i=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return this.options.compatibilityJSON==="v1"?r===1?"":typeof r=="number"?`_plural_${r.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?i():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}shouldUseIntlApi(){return!J2t.includes(this.options.compatibilityJSON)}}function q7e(t,e,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=U2t(t,e,n);return!i&&r&&typeof n=="string"&&(i=I0e(t,n,o),i===void 0&&(i=I0e(e,n,o))),i}class Q2t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=e3.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const n=e.interpolation;this.escape=n.escape!==void 0?n.escape:B2t,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?nP(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?nP(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?nP(n.nestingPrefix):n.nestingPrefixEscaped||nP("$t("),this.nestingSuffix=n.nestingSuffix?nP(n.nestingSuffix):n.nestingSuffixEscaped||nP(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,o)=>n&&n.source===o?(n.lastIndex=0,n):new RegExp(o,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,o,r){let i,a,l;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(m){return m.replace(/\$/g,"$$$$")}const u=m=>{if(m.indexOf(this.formatSeparator)<0){const C=q7e(n,s,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,o,{...r,...n,interpolationkey:m}):C}const y=m.split(this.formatSeparator),w=y.shift().trim(),x=y.join(this.formatSeparator).trim();return this.format(q7e(n,s,w,this.options.keySeparator,this.options.ignoreJSONStructure),x,o,{...r,...n,interpolationkey:w})};this.resetRegExp();const d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>c(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?c(this.escape(m)):c(m)}].forEach(m=>{for(l=0;i=m.regex.exec(e);){const y=i[1].trim();if(a=u(y),a===void 0)if(typeof d=="function"){const x=d(e,i,r);a=typeof x=="string"?x:""}else if(r&&Object.prototype.hasOwnProperty.call(r,y))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=V7e(a));const w=m.safeValue(a);if(e=e.replace(i[0],w),f?(m.regex.lastIndex+=a.length,m.regex.lastIndex-=i[0].length):m.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,i,a;function l(s,c){const u=this.nestingOptionsSeparator;if(s.indexOf(u)<0)return s;const d=s.split(new RegExp(`${u}[ ]*{`));let f=`{${d[1]}`;s=d[0],f=this.interpolate(f,a);const p=f.match(/'/g),m=f.match(/"/g);(p&&p.length%2===0&&!m||m.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),c&&(a={...c,...a})}catch(y){return this.logger.warn(`failed parsing options string in nesting for key ${s}`,y),`${s}${u}${f}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,s}for(;r=this.nestingRegexp.exec(e);){let s=[];a={...o},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const u=r[1].split(this.formatSeparator).map(d=>d.trim());r[1]=u.shift(),s=u,c=!0}if(i=n(l.call(this,r[1].trim(),a),a),i&&r[0]===e&&typeof i!="string")return i;typeof i!="string"&&(i=V7e(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),i=""),c&&(i=s.reduce((u,d)=>this.format(u,d,o.lng,{...o,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}}function Z2t(t){let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const o=t.split("(");e=o[0].toLowerCase().trim();const r=o[1].substring(0,o[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(a=>{if(!a)return;const[l,...s]=a.split(":"),c=s.join(":").trim().replace(/^'+|'+$/g,"");n[l.trim()]||(n[l.trim()]=c),c==="false"&&(n[l.trim()]=!1),c==="true"&&(n[l.trim()]=!0),isNaN(c)||(n[l.trim()]=parseInt(c,10))})}return{formatName:e,formatOptions:n}}function oP(t){const e={};return function(o,r,i){const a=r+JSON.stringify(i);let l=e[a];return l||(l=t(hX(r),i),e[a]=l),l(o)}}class e5t{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=e3.create("formatter"),this.options=e,this.formats={number:oP((n,o)=>{const r=new Intl.NumberFormat(n,{...o});return i=>r.format(i)}),currency:oP((n,o)=>{const r=new Intl.NumberFormat(n,{...o,style:"currency"});return i=>r.format(i)}),datetime:oP((n,o)=>{const r=new Intl.DateTimeFormat(n,{...o});return i=>r.format(i)}),relativetime:oP((n,o)=>{const r=new Intl.RelativeTimeFormat(n,{...o});return i=>r.format(i,o.range||"day")}),list:oP((n,o)=>{const r=new Intl.ListFormat(n,{...o});return i=>r.format(i)})},this.init(e)}init(e){const o=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=o.formatSeparator?o.formatSeparator:o.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=oP(n)}format(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((l,s)=>{const{formatName:c,formatOptions:u}=Z2t(s);if(this.formats[c]){let d=l;try{const f=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},p=f.locale||f.lng||r.locale||r.lng||o;d=this.formats[c](l,p,{...u,...r,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return l},e)}}function t5t(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}class n5t extends Aq{constructor(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=o,this.languageUtils=o.languageUtils,this.options=r,this.logger=e3.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(o,r.backend,r)}queueLoad(e,n,o,r){const i={},a={},l={},s={};return e.forEach(c=>{let u=!0;n.forEach(d=>{const f=`${c}|${d}`;!o.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,u=!1,a[f]===void 0&&(a[f]=!0),i[f]===void 0&&(i[f]=!0),s[d]===void 0&&(s[d]=!0)))}),u||(l[c]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(s)}}loaded(e,n,o){const r=e.split("|"),i=r[0],a=r[1];n&&this.emit("failedLoading",i,a,n),o&&this.store.addResourceBundle(i,a,o,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2;const l={};this.queue.forEach(s=>{N2t(s.loaded,[i],a),t5t(s,e),n&&s.errors.push(n),s.pendingCount===0&&!s.done&&(Object.keys(s.loaded).forEach(c=>{l[c]||(l[c]={});const u=s.loaded[c];u.length&&u.forEach(d=>{l[c][d]===void 0&&(l[c][d]=!0)})}),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(s=>!s.done)}read(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:o,tried:r,wait:i,callback:a});return}this.readingCalls++;const l=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&r{this.read.call(this,e,n,o,r+1,i*2,a)},i);return}a(c,u)},s=this.backend[o].bind(this.backend);if(s.length===2){try{const c=s(e,n);c&&typeof c.then=="function"?c.then(u=>l(null,u)).catch(l):l(null,c)}catch(c){l(c)}return}return s(e,n,l)}prepareLoading(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof n=="string"&&(n=[n]);const i=this.queueLoad(e,n,o,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,o){this.prepareLoading(e,n,{},o)}reload(e,n,o){this.prepareLoading(e,n,{reload:!0},o)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const o=e.split("|"),r=o[0],i=o[1];this.read(r,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${r} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${r}`,l),this.loaded(e,a,l)})}saveMissing(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${o}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){const s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,n,o,r,s):u=c(e,n,o,r),u&&typeof u.then=="function"?u.then(d=>l(null,d)).catch(l):l(null,u)}catch(u){l(u)}else c(e,n,o,r,l,s)}!e||!e[0]||this.store.addResource(e[0],n,o,r)}}}function Q7e(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let n={};if(typeof e[1]=="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const o=e[3]||e[2];Object.keys(o).forEach(r=>{n[r]=o[r]})}return n},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Z7e(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function RY(){}function o5t(t){Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}class jF extends Aq{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Z7e(e),this.services={},this.logger=e3,this.modules={external:[]},o5t(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(o=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const r=Q7e();this.options={...r,...this.options,...Z7e(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function i(u){return u?typeof u=="function"?new u:u:null}if(!this.options.isClone){this.modules.logger?e3.init(i(this.modules.logger),this.options):e3.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=e5t);const d=new K7e(this.options);this.store=new X7e(this.options.resources,this.options);const f=this.services;f.logger=e3,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new q2t(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(f.formatter=i(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Q2t(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new n5t(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var m=arguments.length,y=new Array(m>1?m-1:0),w=1;w1?m-1:0),w=1;w{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,o||(o=RY),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const s=HD(),c=()=>{const u=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(f),o(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),s}loadResources(e){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:RY;const r=typeof e=="string"?e:this.language;if(typeof e=="function"&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&r.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(c=>{c!=="cimode"&&i.indexOf(c)<0&&i.push(c)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(s=>a(s)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(l)})}else o(null)}reloadResources(e,n,o){const r=HD();return e||(e=this.languages),n||(n=this.options.ns),o||(o=RY),this.services.backendConnector.reload(e,n,i=>{r.resolve(),o(i)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&fYe.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}changeLanguage(e,n){var o=this;this.isLanguageChangingTo=e;const r=HD();this.emit("languageChanging",e);const i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve(function(){return o.t(...arguments)}),n&&n(s,function(){return o.t(...arguments)})},l=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const c=typeof s=="string"?s:this.services.languageUtils.getBestMatchFromCodes(s);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,u=>{a(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),r}getFixedT(e,n,o){var r=this;const i=function(a,l){let s;if(typeof l!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${s.keyPrefix}${f}${m}`):p=s.keyPrefix?`${s.keyPrefix}${f}${a}`:a,r.t(p,s)};return typeof e=="string"?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=o,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=this.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(o,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(o,e)&&(!r||a(i,e)))}loadNamespaces(e,n){const o=HD();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{o.resolve(),n&&n(r)}),o):(n&&n(),Promise.resolve())}loadLanguages(e,n){const o=HD();typeof e=="string"&&(e=[e]);const r=this.options.preload||[],i=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=r.concat(i),this.loadResources(a=>{o.resolve(),n&&n(a)}),o):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new K7e(Q7e());return n.indexOf(o.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new jF(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:RY;const o=e.forkResourceStore;o&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},i=new jF(r);return(e.debug!==void 0||e.prefix!==void 0)&&(i.logger=i.logger.clone(e)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},o&&(i.store=new X7e(this.store.data,r),i.services.resourceStore=i.store),i.translator=new pX(i.services,r),i.translator.on("*",function(l){for(var s=arguments.length,c=new Array(s>1?s-1:0),u=1;u()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function txe(t,e,n){t.loadNamespaces(e,hYe(t,n))}function nxe(t,e,n,o){typeof n=="string"&&(n=[n]),n.forEach(r=>{t.options.ns.indexOf(r)<0&&t.options.ns.push(r)}),t.loadLanguages(e,hYe(t,o))}function i5t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=e.languages[0],r=e.options?e.options.fallbackLng:!1,i=e.languages[e.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=e.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!a(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(o,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||a(o,t)&&(!r||a(i,t)))}function a5t(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(z0e("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!i(r.isLanguageChangingTo,t))return!1}}):i5t(t,e,n)}const l5t=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,s5t={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},c5t=t=>s5t[t],u5t=t=>t.replace(l5t,c5t);let D0e={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:u5t};function d5t(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};D0e={...D0e,...t}}function f5t(){return D0e}let pYe;function h5t(t){pYe=t}function p5t(){return pYe}const g5t={type:"3rdParty",init(t){d5t(t.options.react),h5t(t)}},m5t=g.createContext();class y5t{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const A5t=(t,e)=>{const n=g.useRef();return g.useEffect(()=>{n.current=t},[t,e]),n.current};function Jl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:o,defaultNS:r}=g.useContext(m5t)||{},i=n||o||p5t();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new y5t),!i){z0e("You will need to pass in an i18next instance by using initReactI18next");const P=(S,v)=>typeof v=="string"?v:v&&typeof v=="object"&&typeof v.defaultValue=="string"?v.defaultValue:Array.isArray(S)?S[S.length-1]:S,A=[P,{},!1];return A.t=P,A.i18n={},A.ready=!1,A}i.options.react&&i.options.react.wait!==void 0&&z0e("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...f5t(),...i.options.react,...e},{useSuspense:l,keyPrefix:s}=a;let c=r||i.options&&i.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(c);const u=(i.isInitialized||i.initializedStoreOnce)&&c.every(P=>a5t(P,i,a));function d(){return i.getFixedT(e.lng||null,a.nsMode==="fallback"?c:c[0],s)}const[f,p]=g.useState(d);let m=c.join();e.lng&&(m=`${e.lng}${m}`);const y=A5t(m),w=g.useRef(!0);g.useEffect(()=>{const{bindI18n:P,bindI18nStore:A}=a;w.current=!0,!u&&!l&&(e.lng?nxe(i,e.lng,c,()=>{w.current&&p(d)}):txe(i,c,()=>{w.current&&p(d)})),u&&y&&y!==m&&w.current&&p(d);function S(){w.current&&p(d)}return P&&i&&i.on(P,S),A&&i&&i.store.on(A,S),()=>{w.current=!1,P&&i&&P.split(" ").forEach(v=>i.off(v,S)),A&&i&&A.split(" ").forEach(v=>i.store.off(v,S))}},[i,m]);const x=g.useRef(!0);g.useEffect(()=>{w.current&&!x.current&&p(d),x.current=!1},[i,s]);const C=[f,i,u];if(C.t=f,C.i18n=i,C.ready=u,u||!u&&!l)return C;throw new Promise(P=>{e.lng?nxe(i,e.lng,c,()=>P()):txe(i,c,()=>P())})}function w5t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BF(t){"@babel/helpers - typeof";return BF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},BF(t)}function x5t(t,e){if(BF(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(BF(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function v5t(t){var e=x5t(t,"string");return BF(e)==="symbol"?e:String(e)}function b5t(t,e){for(var n=0;n0){var l=r.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(l))}if(r.domain){if(!oxe.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(r.domain)}if(r.path){if(!oxe.test(r.path))throw new TypeError("option path is invalid");a+="; Path=".concat(r.path)}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){var s=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(s){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},rxe={create:function(e,n,o,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};o&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+o*60*1e3)),r&&(i.domain=r),document.cookie=R5t(e,encodeURIComponent(n),i)},read:function(e){for(var n="".concat(e,"="),o=document.cookie.split(";"),r=0;r-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=o.substring(1),i=r.split("&"),a=0;a0){var s=i[a].substring(0,l);s===e.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},MD=null,ixe=function(){if(MD!==null)return MD;try{MD=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{MD=!1}return MD},I5t={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&ixe()){var o=window.localStorage.getItem(e.lookupLocalStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&ixe()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},ID=null,axe=function(){if(ID!==null)return ID;try{ID=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{ID=!1}return ID},z5t={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&axe()){var o=window.sessionStorage.getItem(e.lookupSessionStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&axe()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},D5t={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var o=0;o0?n:void 0}},E5t={name:"htmlTag",lookup:function(e){var n,o=e.htmlTag||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(n=o.getAttribute("lang")),n}},k5t={name:"path",lookup:function(e){var n;if(typeof window<"u"){var o=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(o instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof o[e.lookupFromPathIndex]!="string")return;n=o[e.lookupFromPathIndex].replace("/","")}else n=o[0].replace("/","")}return n}},F5t={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,o=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[n]}};function L5t(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var mYe=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w5t(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return S5t(t,[{key:"init",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=C5t(o,this.options||{},L5t()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(H5t),this.addDetector(M5t),this.addDetector(I5t),this.addDetector(z5t),this.addDetector(D5t),this.addDetector(E5t),this.addDetector(k5t),this.addDetector(F5t)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var o=this;n||(n=this.options.order);var r=[];return n.forEach(function(i){if(o.detectors[i]){var a=o.detectors[i].lookup(o.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.map(function(i){return o.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}},{key:"cacheUserLanguage",value:function(n,o){var r=this;o||(o=this.options.caches),o&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||o.forEach(function(i){r.detectors[i]&&r.detectors[i].cacheUserLanguage(n,r.options)}))}}]),t}();mYe.type="languageDetector";const W5t={translation:{name:{IFI:"Institute for Future Intelligence",Aladdin:"Aladdin",Tagline:"Aladdin: Reimagining Design with Explainable AI — Institute for Future Intelligence"},cookie:{Statement:"By clicking Accept, you agree to our use of cookies to improve your experience with Aladdin.",Accept:"Accept"},aboutUs:{ProductBroughtToYouBy:"This product is brought to you by",TermsOfService:"Terms of Service",PrivacyPolicy:"Privacy Policy",Software:"Software",Content:"Content",Research:"Research",Support:"Support",Acknowledgment:"Acknowledgment",FundingInformation:"The National Science Foundation (NSF) generously provided funding for the research and development of this product through grants #2105695, #2131097, and #2301164. Any opinions, findings, and conclusions or recommendations expressed in this product, however, are those of the authors and do not necessarily reflect the views of NSF.",Contact:"For more information, please contact Charles Xie (charles@intofuture.org).",Translators:"Translators"},word:{Mute:"Mute",BrandName:"Brand Name",Name:"Name",Refresh:"Refresh",LastUpdate:"Last Update",Small:"Small",Medium:"Medium",Large:"Large",Design:"Design",Information:"Information",Type:"Type",Text:"Text",FontSize:"Font Size",FontColor:"Font Color",Model:"Model",Models:"Models",Upload:"Upload",ClickCount:"Click Count",Share:"Share",AlreadyLike:"Already like",Like:"Like",MustLogInToLike:"Must log in to like",AllRightsReserved:"All Rights Reserved",MeterAbbreviation:"m",VoltAbbreviation:"V",AmpereAbbreviation:"A",WattAbbreviation:"W",Version:"Version",VersionInitial:"V",Options:"Options",Maximum:"Maximum",Minimum:"Minimum",MaximumNumber:"Maximum Number",MinimumNumber:"Minimum Number",MaximumValue:"Maximum Value",MinimumValue:"Minimum Value",Or:"Or",None:"None",High:"High",Partial:"Partial",Teacher:"Teacher",Class:"Class",Total:"Total",Leaderboard:"Leaderboard",Latest:"Latest",Range:"Range",SIUnit:"SI Unit",USUnit:"US Unit",ThermalTransmittance:"Thermal Transmittance",ThermalResistance:"Thermal Resistance",UValue:"U-Value",RValue:"R-Value",VolumetricHeatCapacity:"Volumetric Heat Capacity",Press:"Press",Open:"Open",Save:"Save",SaveAsImage:"Save as Image",SaveAsCsv:"Save as CSV",Update:"Update",Paste:"Paste",Copy:"Copy",Cut:"Cut",Delete:"Delete",Add:"Add",Lock:"Lock",Translucent:"Translucent",Transparency:"Transparency",Color:"Color",Pattern:"Pattern",Texture:"Texture",Size:"Size",Thickness:"Thickness",Yes:"Yes",No:"No",NoAndDoNotAskAgain:"No and don't ask again",OK:"OK",Cancel:"Cancel",Apply:"Apply",Close:"Close",ApplyTo:"Apply to",Run:"Run",Pause:"Pause",Resume:"Resume",Clear:"Clear",Warning:"Warning",Caution:"Caution",Reminder:"Reminder",Length:"Length",Width:"Width",Height:"Height",Radius:"Radius",Angle:"Angle",Azimuth:"Azimuth",Coordinates:"Coordinates",Weather:"Weather",Show:"Show",Animate:"Animate",Date:"Date",Time:"Time",Title:"Title",Owner:"Owner",Action:"Action",Rename:"Rename",Location:"Location",Latitude:"Latitude",Month:"Month",Day:"Day",Hour:"Hour",Daylight:"Daylight",Radiation:"Radiation",Temperature:"Temperature",kWh:"kWh",dollar:"dollar",MeterPerSecond:"m/s",NorthInitial:"N",SouthInitial:"S",EastInitial:"E",WestInitial:"W",Fixed:"Fixed",Elements:"Elements",Energy:"Energy",Unknown:"Unknown",Label:"Label",Description:"Description",NoDescription:"No description",MaximumCharacters:"Maximum characters",Author:"Author",Publisher:"Publisher",Building:"Building",ResidentialBuilding:"Residential Building",CommercialBuilding:"Commercial Building",SchoolBuilding:"School Building",TouristAttraction:"Tourist Attraction",UnderConstruction:"Under Construction",Photovoltaic:"Photovoltaic",WindPower:"Wind Power",ColocationProjects:"Colocation Projects",Anonymous:"Anonymous",Nickname:"Nickname",Pin:"Pin",Unpin:"Unpin"},shared:{NoTexture:"No Texture",FoundationElement:"Foundation",CuboidElement:"Cuboid",PolygonElement:"Polygon",SensorElement:"Sensor",SolarPanelElement:"Solar Panel",SolarWaterHeaterElement:"Solar Water Heater",ParabolicDishElement:"Parabolic Dish",ParabolicTroughElement:"Parabolic Trough",FresnelReflectorElement:"Fresnel Reflector",HeliostatElement:"Heliostat",WindTurbineElement:"Wind Turbine",LightElement:"Light",ElementLocked:"Locked",ModelType:"Model Type",OutputBreakdown:"Breakdown",MoreResults:"More Results"},message:{DoNotShowAgain:"Don't show again",NewVersionAvailable:"A new version is available",CalculationMayBeSlowDoYouWantToContinue:"Calculation may be slow. Do you want to continue?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"Increase solar radiation heatmap grid cell size to speed up",ModelNotFound:"Model not found",CannotSignIn:"Cannot sign in",CannotSignOut:"Cannot sign out",YourAccountWasCreated:"Your account was created.",CannotCreateAccount:"Cannot create an account",YourAccountSettingsWereSaved:"Your account settings were saved.",CannotSaveYourAccountSettings:"Cannot save your account settings",CannotSaveYourFileToCloud:"Cannot save your file to the cloud",CannotCreateNewProject:"Cannot create a new project",CannotCreateNewProjectWithoutTitle:"Cannot create a new project without a title",CannotOpenYourProjects:"Cannot open your projects",CannotOpenProject:"Cannot open the project",CannotDeleteProject:"Cannot delete the project",CannotRenameProject:"Cannot rename the project",CannotAddDesignToProject:"Cannot add this design to the project",CannotAddDesignToProjectOwnedByOthers:"Cannot add this design to a project owned by others",DesignRemovedFromProject:"The design was successfully removed from the project",CannotRemoveDesignFromProject:"Cannot remove this design from the project",CannotUpdateProject:"Cannot update the project",CannotFetchProjectData:"Cannot fetch project data",TitleUsedChooseDifferentOne:"This title has been used. Choose a different one",CloudFileWithTitleExistsDoYouWantToOverwrite:"A cloud file with the title exists. Do you want to overwrite it?",CloudFileNotFound:"The cloud file was not found",CannotLoadModelsOnMap:"Cannot load models on map",CannotLoadLeaderboard:"Cannot load leaderboard",CannotPublishModelOnMap:"Cannot publish model on map",CannotLikeModelFromMap:"Cannot like model from map",CannotDeleteModelFromMap:"Cannot delete model from map",ModelDeletedFromMap:"Model is deleted from map",DoYouWantToDeleteModelFromMap:"Do you want to delete the model from map?",CannotOpenCloudFile:"Cannot open the cloud file",CannotReadCloudFile:"Cannot read the cloud file",CannotWriteCloudFile:"Cannot write the cloud file",CloudFileCopied:"Cloud file copied",CannotOpenCloudFolder:"Cannot open your cloud folder",CannotDeleteCloudFile:"Cannot delete the cloud file",CannotRenameCloudFile:"Cannot rename the cloud file",DoYouWantToSaveChanges:"Do you want to save changes?",DoYouWantToUpdateDesign:"Do you want to update this design?",NotApplicableToSelectedAction:"Not Applicable to Selected Action",ThisElementIsLocked:"This element is locked.",ThisCannotBeUndone:"This cannot be undone.",AzimuthOfNorthIsZero:"Azimuth of north is 0°",CounterclockwiseAzimuthIsPositive:"Counter-clockwise is positive",SouthFacingIsZero:"South-facing is 0°",ClockwiseRotationIsPositive:"Clockwise is positive",MoveCancelledBecauseOfOverlap:"Move cancelled because of overlap.",MoveOutsideBoundaryCancelled:"Move outside the boundary cancelled.",RotationCancelledBecauseOfOverlap:"Rotation cancelled because of overlap.",RotationOutsideBoundaryCancelled:"Rotation outside the boundary cancelled.",ResizingCancelledBecauseOfOverlap:"Resizing cancelled because of overlap.",ResizingOutsideBoundaryCancelled:"Resizing outside the boundary cancelled.",CannotPasteOutsideBoundary:"Cannot paste outside the boundary.",CannotPasteBecauseOfOverlap:"Cannot paste because of overlap.",CannotMoveObjectTooFar:"Cannot move object too far.",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"Existing solar panels will be removed before applying the new layout.",DoYouWantToContinue:"Do you want to continue?",SolarPanelsCannotIntersectWithGround:"Solar panels cannot intersect with the ground.",SolarPanelsCannotOverlapWithOneAnother:"Solar panels cannot overlap with one another.",ScreenshotSaved:"A screenshot was saved.",CsvFileSaved:"A CSV file was saved.",SimulationStarted:"Simulation started.",SimulationCompleted:"Simulation completed.",SimulationAborted:"Simulation aborted.",SimulationPaused:"Simulation paused.",CancelSimulation:"Cancel simulation",PauseSimulation:"Pause simulation",ResumeSimulation:"Resume simulation",SimulationWillNotStartDueToErrors:"Simulation will not start due to errors",SimulationWillStartDespiteWarnings:"Simulation will start despite warnings.",EvolutionStarted:"Evolution started.",EvolutionCompleted:"Evolution completed.",EvolutionAborted:"Evolution aborted.",EvolutionPaused:"Evolution paused.",EncounterEvolutionError:"Encountered an evolution error.",CancelEvolution:"Cancel evolution",PauseEvolution:"Pause evolution",ResumeEvolution:"Resume evolution",ConvergenceThresholdHasBeenReached:"The convergence threshold has been reached.",MaximumNumberOfGenerationsHasBeenReached:"The maximum number of generations has been reached.",MaximumNumberOfStepsHasBeenReached:"The maximum number of steps has been reached.",ObjectiveFunctionTypeError:"The current objective function is not supported by this operation. Please start from the menu.",WallsAreNotAtSameHeight:"Walls are not at the same height.",WallsAreNotPerpendicular:"Walls are not perpendicular.",WallsAreNotConnected:"Walls are not connected.",WallsNumberNeedToBeFour:"The number of walls needs to be four.",BuildingContainsEmptyWall:"Building contains one or more empty wall.",BuildingRoofMissing:"Building has a missing roof.",UnknownErrors:"Unknown errors.",SigningOutAnonymousAccount:"Are you sure you want to sign out? This anonymous account will be lost.",SigningInAnonymousAccount:"Are you sure you want to sign in anonymously? An anonymous account will be lost if you sign out. It should be used only for temporary purposes and on the same computer."},menu:{AnalysisOptions:"Analysis Options",option:{GridCellSize:"Grid Cell Size",SamplingFrequency:"Sampling Frequency",TimesPerHour:"Times per Hour",DaysPerYear:"Days per Year"},mainMenu:"Main Menu",cloudMenu:"Cloud Menu",projectSubMenu:"Project",project:{CreateNewProject:"Create New Project",OpenProject:"Open Project",SaveProject:"Save Project",SaveProjectAs:"Save Project As",YouMustLogInToCreateProject:"You must log in to create a new project",YouMustLogInToOpenProject:"You must log in to open a project"},fileSubMenu:"File",file:{CreateNewFile:"Create New File",OpenLocalFile:"Open Local File",SaveAsLocalFile:"Save as Local File",SavingAbortedMustHaveValidFileName:"Saving aborted! You must have a valid file name",OpenCloudFile:"Open Cloud File",SaveCloudFile:"Save Cloud File",SaveAsCloudFile:"Save as Cloud File",SavingAbortedMustHaveValidTitle:"Saving aborted! You must have a valid title for a cloud file",ToSaveYourWorkPleaseSignIn:"To save your work, please sign in.",TakeScreenshot:"Take Screenshot",UseCloudFileName:"Use Cloud File Name",PublishOnModelsMap:"Publish on Models Map",PublishedOnModelsMap:"Your model has been published on the Models Map",UpdatedOnModelsMap:"Your model has been updated on the Models Map",YouMustLogInToPublishYourModel:"You must log in to publish your model",YouCannotPublishAModelThatYouDoNotOwn:"You cannot publish a model that you do not own",YouMustSaveModelOnCloudBeforePublishingIt:"You must save the model on the cloud before publishing it"},editSubMenu:"Edit",edit:{Undo:"Undo",Redo:"Redo",Undone:"Undone"},viewSubMenu:"View",view:{ModelTree:"Model Tree",NavigationView:"Navigation View",TwoDimensionalView:"2D View",ResetView:"Reset",ZoomIn:"Zoom In",ZoomOut:"Zoom Out",AutoRotate:"Auto Rotate",ShowShadow:"Show Shadow",ShowSurfaceShininess:"Show Surface Shininess",TranslucentFloatingWindows:"Translucent Floating Windows",accessoriesSubMenu:"Accessories",accessories:{SiteInformation:"Site Information",DesignInformation:"Design Information",Instruction:"Instruction",StickyNote:"Sticky Note",Note:"Note"}},settingsSubMenu:"Settings",settings:{WeatherData:"Weather Data",DiurnalTemperature:"Diurnal Temperature",Heliodon:"Heliodon",SunAndTime:"Sun & Time",CustomSolarPanels:"Custom Solar Panels",CustomizeSolarPanel:"Customize Solar Panel"},benchmarksSubMenu:"Benchmarks",benchmarks:{SolarRadiationPredictionVsMeasurement:"Solar Radiation Prediction vs. Measurement",BESTESTCase600:"Building Energy Simulation Test: BESTEST Case 600",BESTESTCase610:"Building Energy Simulation Test: BESTEST Case 610",BESTESTCase620:"Building Energy Simulation Test: BESTEST Case 620",BESTESTCase630:"Building Energy Simulation Test: BESTEST Case 630"},graph:{LineWidth:"Line Width",SymbolSize:"Symbol Size",BarCategoryGap:"Bar Category Gap",ShowHorizontalGridLines:"Show Horizontal Grid Lines",ShowVerticalGridLines:"Show Vertical Grid Lines"},analysisSubMenu:"Analysis",physicsSubMenu:"Physics",physics:{DailySolarRadiationHeatmap:"Daily Solar Radiation Heatmap",SolarRadiationHeatmapOptions:"Solar Radiation Heatmap Options",SolarRadiationHeatmapGridCellSize:"Solar Radiation Heatmap Grid Cell Size",SolarRadiationHeatmapMaxValue:"Solar Radiation Heatmap Maximum Value",SolarRadiationHeatmapNoAnimation:"No Animation for Static Model",ReflectionHeatmap:"Reflection Heatmap"},sensorSubMenu:"Sensor",sensor:{CollectDailyData:"Collect Daily Data",CollectYearlyData:"Collect Yearly Data",SensorSimulationNoAnimation:"No Animation for Collecting Sensor Data"},buildingSubMenu:"Building",building:{AnalyzeDailyBuildingEnergy:"Analyze Daily Building Energy",AnalyzeYearlyBuildingEnergy:"Analyze Yearly Building Energy",EnergyAnalysisOptions:"Energy Analysis Options",EnergyGridCellSize:"Energy Grid Cell Size",BuildingEnergySimulationNoAnimation:"No Animation for Building Energy Simulation"},solarPanelSubMenu:"Solar Panel",solarPanel:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield",AnalyzeVisibility:"Analyze Visibility",PanelDiscretization:"Panel Discretization",Exact:"Exact",Approximate:"Approximate",EnergyGridCellSize:"Energy Grid Cell Size",VisibilityGridCellSize:"View Factor Grid Cell Size",EnergyAnalysisOptions:"Energy Analysis Options",VisibilityAnalysisOptions:"Visibility Analysis Options",SolarPanelSimulationNoAnimation:"No Animation for Solar Panel Simulation"},parabolicTroughSubMenu:"Parabolic Trough",parabolicTrough:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},parabolicDishSubMenu:"Parabolic Dish",parabolicDish:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},fresnelReflectorSubMenu:"Fresnel Reflector",fresnelReflector:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},heliostatSubMenu:"Heliostat",heliostat:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},solarUpdraftTowerSubMenu:"Solar Updraft Tower",solarUpdraftTower:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield",SolarUpdraftTowerSimulationNoAnimation:"No Animation for Solar Updraft Tower Simulation"},tutorialsSubMenu:"Tutorials",solarEnergyScienceSubMenu:"Solar Science",solarEnergyScienceTutorials:{SunAngles:"Sun Angles Relative to an Observer on the Ground",InsolationAndClimate:"Insolation and Climate",SolarRadiationToBox:"Solar Radiation to a Box"},buildingScienceSubMenu:"Building Science",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"Thermal Envelope vs. Building Envelope",EffectOfSizeOnBuildingEnergy:"Effect of Size on Building Energy",EffectOfOrientationOnBuildingEnergy:"Effect of Orientation on Building Energy",EffectOfInsulationOnBuildingEnergy:"Effect of Insulation on Building Energy",EffectOfRoofColorOnBuildingEnergy:"Effect of Roof Color on Building Energy",EffectOfEavesOverhangLengthOnBuildingEnergy:"Effect of Eaves Overhang Length on Building Energy",EffectOfWindowSHGCOnBuildingEnergy:"Effect of Window Solar Heat Gain on Building Energy",EffectOfThermostatSetpointOnBuildingEnergy:"Effect of Thermostat Setpoint on Building Energy",EffectOfProgrammableThermostatOnBuildingEnergy:"Effect of Programmable Thermostat on Building Energy",EffectOfSolarPanelsOnBuildingEnergy:"Effect of Solar Panels on Building Energy",EffectOfGroundTemperatureOnBuildingEnergy:"Effect of Ground Temperature on Building Energy",EffectOfTreesOnBuildingEnergy:"Effect of Trees on Building Energy"},buildingDesignSubMenu:"Building Design",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"Cape Cod Style House with Shed Dormer",MansardRoofWithDormers:"Mansard Roof with Dormers",GableRoofVsHipRoof:"Gable Roof vs. Hip Roof",ColonialVsSaltbox:"Colonial vs. Saltbox",GambrelRoofVsMansardRoof:"Gambrel Roof vs. Mansard Roof",CombinationRoofVsBonnetRoof:"Combination Roof vs. Bonnet Roof",DutchGableRoof:"Dutch Gable Roof",GableAndValleyRoof:"Gable and Valley Roof",ClerestoryRoof:"Clerestory Roof",MonitorRoof:"Monitor Roof",AFrameHouse:"A-Frame House",HalfTimberedHouse:"Half-Timbered House",AllBasicRoofTypes:"All Basic Roof Types"},photovoltaicSolarPowerSubMenu:"Photovoltaic Solar Power",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"Effect of Tilt Angle of a Solar Panel",EffectOfAzimuthOfSolarPanel:"Effect of Azimuth of a Solar Panel",SolarPanelTypes:"Solar Panel Types",DefineYourOwnSolarPanels:"Define Your Own Solar Panels",VerticalBifacialSolarPanels:"Vertical Bifacial Solar Panels",CompareMonofacialAndBifacialSolarPanels:"Monofacial vs. Bifacial Solar Panels",SolarTrackers:"Solar Trackers",CoveringGroundWithSolarPanels:"Why Just Covering the Ground with Solar Panels is not a Good Idea",InterRowSpacingOfSolarPanelArray:"Effect of Inter-Row Spacing in a Solar Panel Array",EffectOfOrientationOfSolarPanels:"Effect of Orientation of Solar Panels",SolarPanelArrayAutomaticLayout:"Solar Panel Array Automatic Layout"},concentratedSolarPowerSubMenu:"Concentrated Solar Power",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"Effect of Azimuth of a Parabolic Trough",EffectOfLatusRectumOfParabolicTrough:"Effect of Latus Rectum of a Parabolic Trough",FocusSunlightWithParabolicDish:"Focus Sunlight with a Parabolic Dish",LinearFresnelReflectors:"Linear Fresnel Reflectors",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"Effect of Absorber Pipe Height for Linear Fresnel Reflectors",EffectOfAzimuthOfLinearFresnelReflectors:"Effect of Azimuth of Linear Fresnel Reflectors",LinearFresnelReflectorsWithTwoAbsorbers:"Linear Fresnel Reflectors with Two Absorbers",CosineEfficiencyOfHeliostats:"Cosine Efficiency of Heliostats",ShadowingAndBlockingOfHeliostats:"Shadowing and Blocking of Heliostats",EffectSolarPowerTowerHeight:"Effect of Solar Power Tower Height",SolarPowerTower:"Solar Power Tower"},otherTypesOfSolarPowerSubMenu:"Other Types of Solar Power",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"Solar Water Heaters",SolarUpdraftTower:"Solar Updraft Tower"},windPowerSubMenu:"Wind Power",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"Effect of Blade Number of Wind Turbine",EffectOfPitchAngleOfWindTurbineBlades:"Effect of Pitch Angle of Wind Turbine Blades",BirdSafeBladeDesign:"Bird-Safe Blade Design",OffshoreWindFarm:"Offshore Wind Farm"},colocationSubMenu:"Colocation",colocationTutorials:{AgricultureSolarWindColocation:"Agriculture-Solar-Wind Colocation"},generativeDesignSubMenu:"Generative Design",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Monofacial Solar Panel Array",BifacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Bifacial Solar Panel Array",SolarPanelArrayInterRowSpacing:"The Inter-Row Spacing of a Solar Panel Array",OutputOfSolarPanelArrayInDifferentPlaces:"The Output of a Solar Panel Array in Different Places",SimpleSolarFarmParetoFront:"The Pareto Front for Designing a Simple Solar Farm"},examplesSubMenu:"Examples",solarEnergySubMenu:"Solar Energy",solarEnergyExamples:{SunBeamAndHeliodon:"Sun Beam and Heliodon",RooftopSolarPanels:"Rooftop Solar Panels",NevadaSolarOneParabolicTroughArray:"Nevada Solar One Parabolic Trough Array",TooeleParabolicDishArray:"Tooele Parabolic Dish Array",PS10SolarPowerTower:"PS10 Solar Power Tower",TucsonLinearFresnelReflectors:"Tucson Linear Fresnel Reflectors",SolarCanopyFormFactors:"Solar Canopy Form Factors",SolarCanopyOverBleachers:"Solar Canopy Over Bleachers",SolarCanopyOverGarage:"Solar Canopy Over Garage",SolarBusStop:"Solar Bus Stop",SolarFacadeTesla:"Tesla Solar Façade",BuildingIntegratedPhotovoltaics:"Building-Integrated Photovoltaics",Floatovoltaics:"Floatovoltaics",Agrivoltaics:"Agrivoltaics",VegetativeBuffer:"Vegetative Buffer",RainbowSwashSolarFarmBostonMA:"Rainbow Swash Solar Farm in Boston, MA",MickeyMouseSolarFarmOrlandoFL:"Mickey Mouse Solar Farm in Orlando, FL",SolarPanelsOverCanalBakersfieldCA:"Hypothetical Solar Panels Over Canal in Bakersfield, CA",SolarNoiseBarrierLexingtonMA:"Hypothetical Solar Noise Barrier in Lexington, MA",HSATSolarTrackersRaleighNC:"Horizontal Single Axis Trackers (HSAT) in Raleigh, NC",AADATSolarTrackersLancasterCA:"Azimuth–Altitude Dual Axis Trackers (AADAT) in Lancaster, CA",SolarUpdraftTowerInCity:"Solar Updraft Tower in City"},builtEnvironmentSubMenu:"Built Environment",residentialBuildingsSubMenu:"Residential Buildings",residentialBuildingExamples:{ColonialHouse:"Colonial House",DutchColonialHouse:"Dutch Colonial House",TShapedHouse:"T-Shaped House",CapeCodHouseWithGarage:"Cape Cod House with Garage",Solarium:"Solarium",Church1:"Church 1",Cathedral1:"Cathedral 1",Cathedral2:"Cathedral 2",Mosque1:"Mosque 1",AdobeTaosHouse:"Adobe Taos House",RanchHouse:"Ranch House",BonnetHouse:"Bonnet House",BarnStyleHouse:"Barn Style House",ModernHouse:"Modern House",ButterflyRoofHouse:"Butterfly Roof House"},commercialBuildingsSubMenu:"Commercial Buildings",commercialBuildingExamples:{WhiteHouse:"White House",HaroldWashingtonCollege:"Harold Washington College",BilimMersinTurkiye:"BILIM, Mersin, Turkiye",SpanishStyleHotel:"Spanish Style Hotel",ApartmentBuilding:"Apartment Building",OfficeBuilding:"Office Building",Hotel:"Hotel"},buildingComplexesSubMenu:"Building Complexes",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"South Burlington High School, VT",MescaleroApacheSchoolNewMexico:"Mescalero Apache School, NM"},urbanPlanningSubMenu:"Urban Planning",urbanPlanningExamples:{CityBlockHeatmap:"City Block Heatmap",ChicagoSkyline:"Chicago Skyline"},otherBuildingsSubMenu:"Other Buildings",otherBuildingExamples:{Greenhouse:"Greenhouse",Pavilion:"Pavilion in a Park",OctagonalPagoda:"Octagonal Pagoda",OceanFront:"Ocean Front",EgyptianPyramids:"Egyptian Pyramids",MayanPyramid:"Mayan Pyramid",SiOSePol:"Si-o-se-pol",StackedCuboids:"Stacked Cuboids"},artificialIntelligenceSubMenu:"Artificial Intelligence",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"Optimizing the Tilt Angle of a Solar Panel Row",OptimizingTiltAnglesOfMultipleSolarPanelRows:"Optimizing the Tilt Angles of Multiple Solar Panel Rows",SolarFarmGenerativeDesign:"Solar Farm Generative Design",SolarFarmGenerativeDesignWithBlock:"Solar Farm Generative Design in the Presence of a Block",FitchburgSolarFarmGenerativeDesign:"Fitchburg Solar Farm Generative Design"},languageSubMenu:"Language",publicSubMenu:"Public",ModelsGallery:"Models Gallery",ModelsMap:"Models Map",AboutUs:"About Us"},HVACMenu:{BuildingHVACSystem:"Building HVAC System",ID:"ID",Tolerance:"Tolerance",ToleranceExplanation:`Heater will not run if the lowest outside temperature of the day is higher than the setpoint minus this threshold. AC will not run if the highest outside temperature of the day is lower than the setpoint plus this threshold.`,ThermostatType:"Thermostat Type",Simple:"Simple",Programmable:"Programmable",ThermostatSetpoint:"Thermostat Setpoint",HeatingSetpoint:"Heating Setpoint",CoolingSetpoint:"Cooling Setpoint",Period:"Period",StartTime:"Start Time",Setpoint:"Setpoint",Wake:"Wake",Day:"Day",Evening:"Evening",Sleep:"Sleep",TimeErrorMessage:"Start time should be later than previous period."},avatarMenu:{AccountSettings:"Account Settings",SignIn:"Sign In",SignInAsMe:"Sign in as me",SignInAnonymously:"Sign in anonymously",SignOut:"Sign Out",IfYouAreAStudent:"If you are a student"},skyMenu:{Axes:"Axes",Theme:"Theme",ThemeDefault:"Default",ThemeDesert:"Desert",ThemeDune:"Dune",ThemeForest:"Forest",ThemeGrassland:"Grassland",ThemeHill:"Hill",ThemeLake:"Lake",ThemeMountain:"Mountain",ThemeRural:"Rural",SunlightAttenuationCoefficientInAir:"Sunlight Attenuation Coefficient in Air",ConvectiveCoefficientOfAir:"Convective Coefficient of Air",HighestTemperatureTimeInMinutes:"Highest Temperature Time (Minutes)",SelectSunAnglesToShow:"Select Sun Angles to Show",ShowAzimuthAngle:"Show Azimuth Angle",ShowElevationAngle:"Show Elevation Angle",ShowZenithAngle:"Show Zenith Angle",DirectLightBrightnessAtNoon:"Direct Light Brightness at Noon",AmbientLightBrightnessAtNoon:"Ambient Light Brightness at Noon"},groundMenu:{MonthlyIrradianceLoss:"Monthly Irradiance Loss",Vegetation:"Vegetation",LeafOutDay:"Leaf-Out Day",LeafOffDay:"Leaf-Off Day",Albedo:"Albedo",ImageOnGround:"Image on Ground",WaterSurface:"Water Surface",RemoveAllUnlockedTrees:"Remove All Unlocked Trees",RemoveAllUnlockedFlowers:"Remove All Unlocked Flowers",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",RemoveAllUnlockedPeople:"Remove All Unlocked People",RemoveAllUnlockedFoundations:"Remove All Unlocked Foundations",RemoveAllUnlockedCuboids:"Remove All Unlocked Cuboids",DoYouReallyWantToRemoveAllPeople:"Do you really want to remove all the people who are not locked",DoYouReallyWantToRemoveAllTrees:"Do you really want to remove all the trees that are not locked",DoYouReallyWantToRemoveAllFlowers:"Do you really want to remove all the flowers that are not locked",DoYouReallyWantToRemoveAllSolarPanels:"Do you really want to remove all the solar panels that are not locked",DoYouReallyWantToRemoveAllFoundations:"Do you really want to remove all the foundations that are not locked",DoYouReallyWantToRemoveAllCuboids:"Do you really want to remove all the cuboids that are not locked",LockAllUnlockedElements:"Lock All Unlocked Elements",UnlockAllLockedElements:"Unlock All Locked Elements"},labelSubMenu:{Label:"Label",LabelText:"Label Text",LabelHeight:"Label Height",LabelSize:"Label Size",LabelFontSize:"Font Size",LabelColor:"Label Color",KeepShowingLabel:"Keep Showing Label"},foundationMenu:{RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",RemoveAllUnlockedParabolicTroughs:"Remove All Unlocked Parabolic Troughs",RemoveAllUnlockedParabolicDishes:"Remove All Unlocked Parabolic Dishes",RemoveAllUnlockedFresnelReflectors:"Remove All Unlocked Fresnel Reflectors",RemoveAllUnlockedHeliostats:"Remove All Unlocked Heliostats",RemoveAllUnlockedWindTurbines:"Remove All Unlocked Wind Turbines",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",RemoveAllUnlockedLights:"Remove All Unlocked Lights",RemoveAllUnlockedWalls:"Remove All Unlocked Walls",RemoveAllUnlockedWindows:"Remove All Unlocked Windows",RemoveAllUnlockedDoors:"Remove All Unlocked Doors",RemoveAllUnlockedPolygons:"Remove All Unlocked Polygons",RemoveAllUnlockedHumans:"Remove All Unlocked Humans",RemoveAllUnlockedTrees:"Remove All Unlocked Trees",RemoveAllUnlockedFlowers:"Remove All Unlocked Flowers",Racks:"Racks",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",SolarPanels:"Solar Panels",SolarPanelArray:"Solar Panel Array",DoYouReallyWantToRemoveAllSolarPanelsOnFoundation:"Do you really want to remove all the solar panels on this foundation that are not locked",ParabolicTroughs:"Parabolic Troughs",DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation:"Do you really want to remove all the parabolic troughs on this foundation that are not locked",ParabolicDishes:"Parabolic Dishes",DoYouReallyWantToRemoveAllParabolicDishesOnFoundation:"Do you really want to remove all the parabolic dishes on this foundation that are not locked",FresnelReflectors:"Fresnel Reflectors",DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation:"Do you really want to remove all the Fresnel reflectors on this foundation that are not locked",Heliostats:"Heliostats",DoYouReallyWantToRemoveAllHeliostatsOnFoundation:"Do you really want to remove all the heliostats on this foundation that are not locked",WindTurbines:"Wind Turbines",DoYouReallyWantToRemoveAllWindTurbinesOnFoundation:"Do you really want to remove all the wind turbines on this foundation that are not locked",Sensors:"Sensors",DoYouReallyWantToRemoveAllSensorsOnFoundation:"Do you really want to remove all the sensors on this foundation that are not locked",Lights:"Lights",DoYouReallyWantToRemoveAllLightsOnFoundation:"Do you really want to remove all the lights on this foundation that are not locked",Walls:"Walls",DoYouReallyWantToRemoveAllWallsOnFoundation:"Do you really want to remove all the walls on this foundation that are not locked",Windows:"Windows",DoYouReallyWantToRemoveAllWindowsOnFoundation:"Do you really want to remove all the windows on this foundation that are not locked",Doors:"Doors",DoYouReallyWantToRemoveAllDoorsOnFoundation:"Do you really want to remove all the doors on this foundation that are not locked",Polygons:"Polygons",DoYouReallyWantToRemoveAllPolygonsOnFoundation:"Do you really want to remove all the polygons on this foundation that are not locked",Humans:"Humans",DoYouReallyWantToRemoveAllHumansOnFoundation:"Do you really want to remove all the humans on this foundation who are not locked",Trees:"Trees",DoYouReallyWantToRemoveAllTreesOnFoundation:"Do you really want to remove all the trees on this foundation that are not locked",Flowers:"Flowers",DoYouReallyWantToRemoveAllFlowersOnFoundation:"Do you really want to remove all the flowers on this foundation that are not locked",OnlyThisFoundation:"Only This Foundation",AllConnectedFoundations:"All Connected Foundations",AllSelectedFoundations:"All Selected Foundations",AllFoundations:"All Foundations",AddPolygon:"Add Polygon",SolarStructure:"Solar Structure",GroupMaster:"Group Master",LockAllUnlockedElementsOnThisFoundation:"Lock All Unlocked Elements on This Foundation",UnlockAllLockedElementsOnThisFoundation:"Unlock All Locked Elements on This Foundation",GroundFloorRValue:"Ground Floor R-Value",OnlyThisGroundFloor:"Only This Ground Floor",AllGroundFloors:"All Ground Floors"},solarPowerTowerMenu:{ReceiverTowerForHeliostats:"Receiver Tower for Heliostats",ReceiverTowerPhysicalProperties:"Physical Properties of Receiver Tower",ReceiverTowerHeight:"Height of Receiver Tower",ReceiverTowerRadius:"Radius of Receiver Tower",ReceiverAbsorptance:"Absorptance of Receiver",ReceiverOpticalEfficiency:"Optical Efficiency of Receiver",ReceiverThermalEfficiency:"Thermal Efficiency of Receiver"},solarAbsorberPipeMenu:{AbsorberPipeForFresnelReflectors:"Absorber Pipe for Fresnel Reflectors",AbsorberPipePhysicalProperties:"Physical Properties of Absorber Pipe",AbsorberHeight:"Height of Absorber Pipe",AbsorberApertureWidth:"Aperture Width of Absorber Pipe",AbsorberPipePoleNumber:"Pole Number for Absorber Pipe",AbsorberAbsorptance:"Absorptance of Absorber",AbsorberOpticalEfficiency:"Optical Efficiency of Absorber",AbsorberThermalEfficiency:"Thermal Efficiency of Absorber"},solarUpdraftTowerMenu:{SolarUpdraftTower:"Solar Updraft Tower",SolarUpdraftTowerPhysicalProperties:"Physical Properties of Solar Updraft Tower",SolarUpdraftTowerChimneyHeight:"Solar Updraft Tower Chimney Height",SolarUpdraftTowerChimneyRadius:"Solar Updraft Tower Chimney Radius",SolarUpdraftTowerCollectorHeight:"Solar Updraft Tower Collector Height",SolarUpdraftTowerCollectorRadius:"Solar Updraft Tower Collector Radius",SolarUpdraftTowerCollectorTransmissivity:"Solar Updraft Tower Collector Transmissivity",SolarUpdraftTowerCollectorEmissivity:"Solar Updraft Tower Collector Emissivity",SolarUpdraftTowerDischargeCoefficient:"Solar Updraft Tower Discharge Coefficient",SolarUpdraftTowerTurbineEfficiency:"Solar Updraft Tower Turbine Efficiency"},batteryStorageMenu:{BatteryStorage:"Battery Storage",OnlyThisBatteryStorage:"Only This Battery Storage",AllBatteryStoragesAboveSameBase:"All Battery Storages Above Same Base",AllSelectedBatteryStorages:"All Selected Battery Storages",AllBatteryStorages:"All Battery Storages"},cuboidMenu:{Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",RemoveAllUnlockedPolygons:"Remove All Unlocked Polygons",RemoveAllUnlockedHumans:"Remove All Unlocked Humans",RemoveAllUnlockedTrees:"Remove All Unlocked Trees",RemoveAllUnlockedFlowers:"Remove All Unlocked Flowers",RemoveAllUnlockedLights:"Remove All Unlocked Lights",Racks:"Racks",SolarPanels:"Solar Panels",DoYouReallyWantToRemoveAllSolarPanelsOnCuboid:"Do you really want to remove all the solar panels on this cuboid that are not locked",Lights:"Lights",DoYouReallyWantToRemoveAllLightsOnCuboid:"Do you really want to remove all the lights on this cuboid that are not locked",Sensors:"Sensors",DoYouReallyWantToRemoveAllSensorsOnCuboid:"Do you really want to remove all the sensors on this cuboid that are not locked",Polygons:"Polygons",DoYouReallyWantToRemoveAllPolygonsOnCuboid:"Do you really want to remove all the polygons on this cuboid that are not locked",Humans:"Humans",DoYouReallyWantToRemoveAllHumansOnCuboid:"Do you really want to remove all the humans on this cuboid who are not locked",Trees:"Trees",DoYouReallyWantToRemoveAllTreesOnCuboid:"Do you really want to remove all the trees on this cuboid that are not locked",Flowers:"Flowers",DoYouReallyWantToRemoveAllFlowersOnCuboid:"Do you really want to remove all the flowers on this cuboid that are not locked",OnlyThisCuboid:"Only This Cuboid",AllCuboidsOnSameSurface:"All Cuboids on Same Surface",AllCuboidsAboveSameBase:"All Cuboids Above Same Base",AllSelectedCuboids:"All Selected Cuboids",AllCuboids:"All Cuboids",OnlyThisSide:"Only This Side",AllSidesOfThisCuboid:"All Sides of This Cuboid",AllSidesOfSelectedCuboids:"All Sides of Selected Cuboids",AllSidesOfAllCuboids:"All Sides of All Cuboids",AddPolygon:"Add Polygon",Stackable:"Stackable",GroupMaster:"Group Master"},polygonMenu:{Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",TextBox:"Text Box",FontOutlineColor:"Font Outline Color",FontOutlineWidth:"Font Outline Width",FontStrokeColor:"Font Stroke Color",FontStrokeWidth:"Font Stroke Width",NoOutline:"No Outline",Shiny:"Shiny",Filled:"Filled",FillTexture:"Fill Texture",FillColor:"Fill Color",Opacity:"Opacity",LineColor:"Line Color",LineWidth:"Line Width",LineStyle:"Line Style",SolidLine:"Solid Line",DashedLine:"Dashed Line",DottedLine:"Dotted Line",InsertVertexBeforeIndex:"Insert Vertex Before Index",InsertVertexAfterIndex:"Insert Vertex After Index",DeleteVertex:"Delete Vertex",OnlyThisPolygon:"Only This Polygon",AllPolygonsOnSurface:"All Polygons on the Same Surface",AllPolygonsAboveFoundation:"All Polygons Above Foundation",AllSelectedPolygons:"All Selected Polygons",AllPolygons:"All Polygons",Layout:"Layout",SolarPanelArrayLayout:"Solar Panel Array Layout",SolarPanelArrayLayoutParametricDesign:"Solar Panel Array Layout: Parametric Design",SolarPanelArrayLayoutGenerativeDesign:"Solar Panel Array Layout: Generative Design",SolarPanelArrayModel:"Solar Panel Model",SolarPanelArrayOrientation:"Orientation",SolarPanelArrayTiltAngle:"Tilt Angle",SolarPanelArrayRowWidth:"Row Width",SolarPanelArrayInterRowSpacing:"Inter-Row Spacing",SolarPanelArrayRowSpacing:"Row Spacing",SolarPanelArrayRowAxis:"Row Axis",SolarPanelArrayLeftRightRowAxis:"Left-Right (Relative)",SolarPanelArrayUpDownRowAxis:"Up-Down (Relative)",SolarPanelArrayEastWestRowAxis:"East-West (Absolute)",SolarPanelArrayNorthSouthRowAxis:"North-South (Absolute)",SolarPanelArrayMargin:"Margin",SolarPanelArrayPoleHeight:"Pole Height",SolarPanelArrayPoleSpacing:"Pole Spacing",SolarPanelArrayTotalYearlyCost:"Total Cost",SolarPanelArrayTotalYearlyRevenue:"Total Revenue",SolarPanelArrayTotalYearlyYield:"Total Yield",SolarPanelArrayMeanYearlyYield:"Mean Yield",SolarPanelArrayYearlyProfit:"Profit",LayoutNotAcceptedCheckYourParameters:"This layout is not accepted. Please check your parameters."},optimizationMenu:{Optimization:"Optimization",Parameters:"Parameters",Variables:"Variables",Constants:"Constants",GeneticAlgorithm:"Genetic Algorithm",GeneticAlgorithmSettings:"Genetic Algorithm Settings",ParticleSwarmOptimization:"Particle Swarm Optimization",ParticleSwarmOptimizationSettings:"Particle Swarm Optimization Settings",SolarPanelTiltAngleOptimization:"Solar Panel Tilt Angle Optimization",SolarPanelArrayLayout:"Solar Panel Array Layout",Generation:"Generation",Gene:"Gene",NormalizedVariables:"Normalized Variables",Objective:"Objective",ObjectiveFunctionDailyTotalYield:"Daily Total Yield",ObjectiveFunctionYearlyTotalYield:"Yearly Total Yield",ObjectiveFunctionDailyMeanYield:"Daily Mean Yield",ObjectiveFunctionYearlyMeanYield:"Yearly Mean Yield",ObjectiveFunctionDailyProfit:"Daily Profit",ObjectiveFunctionYearlyProfit:"Yearly Profit",GeneticAlgorithmSelectionMethod:"Genetic Algorithm Selection Method",RouletteWheel:"Roulette Wheel",Tournament:"Tournament",SearchMethod:"Search Method",GlobalSearchUniformSelection:"Global Search Uniform Selection",LocalSearchRandomOptimization:"Local Search Random Optimization",PopulationSize:"Population Size",MaximumGenerations:"Maximum Generations",SelectionRate:"Selection Rate",CrossoverRate:"Crossover Rate",MutationRate:"Mutation Rate",Step:"Step",SwarmSize:"Swarm Size",MaximumSteps:"Maximum Steps",MaximumVelocity:"Maximum Velocity",InertiaWeight:"Inertia Weight",CognitiveCoefficient:"Cognitive Coefficient",SocialCoefficient:"Social Coefficient",ConvergenceThreshold:"Convergence Threshold for Termination",LocalSearchRadius:"Local Search Radius",RowsPerRackRange:"Range for Rows per Rack",TiltAngleRange:"Range for Tilt Angle",InterRowSpacingRange:"Range for Inter-Row Spacing",ClickTargetPolygonToActivate:"Click Target Polygon to Activate",ClickTargetFoundationToActivate:"Click Target Foundation to Activate"},treeMenu:{ShowModel:"Show Model",Flip:"Flip",Type:"Type",Spread:"Spread"},flowerMenu:{Flip:"Flip",Type:"Type",Spread:"Spread"},peopleMenu:{ChangePerson:"Change Person",Flip:"Flip",Observer:"Observer",ViewFromThisPerson:"View from This Person"},lightMenu:{Color:"Color",Intensity:"Intensity",Decay:"Decay",MaximumDistance:"Distance",Inside:"Inside"},solarCollectorMenu:{Coordinates:"Coordinates",RelativeXCoordinateOfCenter:"Relative X Coordinate of Center",RelativeYCoordinateOfCenter:"Relative Y Coordinate of Center",RelativeAzimuth:"Relative Azimuth",Pole:"Pole",PoleHeight:"Pole Height",PoleRadius:"Pole Radius",ExtraPoleHeight:"Extra Pole Height",ExtraPoleHeightInAdditionToHalfWidth:"Extra Pole Height in Addition to Half Width",DrawSunBeam:"Draw Sun Beam"},concentratedSolarPowerCollectorMenu:{ReflectorReflectance:"Reflector Reflectance",ReceiverAbsorptance:"Receiver Absorptance",ReflectorOpticalEfficiency:"Reflector Optical Efficiency",ReceiverThermalEfficiency:"Receiver Thermal Efficiency"},solarPanelMenu:{ElectricalProperties:"Electrical Properties",InverterEfficiency:"Inverter Efficiency",InverterEfficiencyExplained:"The efficiency for converting direct current (DC) to alternating current (AC).",DcToAcSizeRatio:"DC-to-AC Size Ratio",DcToAcSizeRatioExplained:"The ratio of the solar panels' DC-rated size to the inverter's AC-rated size.",ChangePvModel:"Change PV Model",Orientation:"Orientation",Portrait:"Portrait",Landscape:"Landscape",FrameColor:"Frame Color",Panels:"panels",PanelsWide:"panels wide",PanelsLong:"panels long",TiltAngle:"Tilt Angle",SouthFacingIsPositive:"South facing is positive",Tracker:"Tracker",SolarTrackerFollowsSun:"A tracker follows the sun to increase solar panel outputs.",PoleSpacing:"Pole Spacing",NoTracker:"No Tracker",HorizontalSingleAxisTracker:"Horizontal Single Axis Tracker",VerticalSingleAxisTracker:"Vertical Single Axis Tracker",AltazimuthDualAxisTracker:"Altazimuth Dual Axis Tracker",OnlyThisSolarPanel:"Only This Solar Panel",AllSolarPanelsOnSurface:"All Solar Panels on the Same Surface",AllSolarPanelsAboveFoundation:"All Solar Panels Above the Same Foundation",AllSelectedSolarPanels:"All Selected Solar Panels",AllSolarPanels:"All Solar Panels"},solarWaterHeaterMenu:{OnlyThisSolarWaterHeater:"Only This Solar Water Heater",AllSolarWaterHeatersOnSurface:"All Solar Water Heaters on the Same Surface",AllSolarWaterHeatersAboveFoundation:"All Solar Water Heaters Above the Same Foundation",AllSelectedSolarWaterHeaters:"All Selected Solar Water Heaters",AllSolarWaterHeaters:"All Solar Water Heaters"},pvModelPanel:{SolarPanelSpecs:"Solar Panel Specs",General:"General",Electrical:"Electrical",CellCountInXDirection:"Cell Count in X Direction",CellCountInYDirection:"Cell Count in Y Direction",Weight:"Weight",Kilogram:"kg",RatedVoltage:"Rated Voltage",RatedCurrent:"Rated Current",OpenCircuitVoltage:"Open-Circuit Voltage",ShortCircuitCurrent:"Short-Circuit Current",MaximumRatedPower:"Maximum Rated Power",Model:"Model",PanelSize:"Panel Size",Cells:"Cells",CellType:"Cell Type",Monocrystalline:"Monocrystalline",Polycrystalline:"Polycrystalline",ThinFilm:"Thin Film",Bifacial:"Bifacial",PowerBifaciality:"Power Bifaciality (Rear/Front)",Black:"Black",Blue:"Blue",ShadeTolerance:"Shade Tolerance",SolarCellEfficiency:"Solar Cell Efficiency",NominalOperatingCellTemperature:"Nominal Operating Cell Temperature",TemperatureCoefficientOfPmax:"Temperature Coefficient of Pmax",AddedCustomSolarPanels:"Added",DisplayThisCustomSolarPanel:"Display this custom solar panel",ExportThisCustomSolarPanel:"Export this custom solar panel",ImportCustomSolarPanelFromClipboard:"Import custom solar panel from clipboard",CustomSolarPanelExportedToClipboard:"Custom solar panel exported to Clipboard",DoYouReallyWantToRemoveThisCustomSolarPanel:"Do you really want to remove this custom solar panel",MakeSureThisCustomSolarPanelIsNotUsed:"Make sure this custom solar panel is not used in the current file",ThisCustomSolarPanelIsUsed:"This custom solar panel is used in the current file",DoYouReallyWantToImportCustomSolarPanel:"Do you really want to import a custom solar panel",ExistingSettingsWillBeOverwritten:"The existing settings will be overwritten",CannotAddCustomSolarPanel:"Cannot add custom solar panel",CustomSolarPanelMustHaveModelName:"A custom solar panel must have a model name",CustomSolarPanelExists:"A custom solar panel with this name already exists",FailInImportingDataFromClipboard:"Failed in importing data from the clipboard",NoNeedToAddThisCustomSolarPanel:"No Need to Add This",SolarPanelModelAlreadyProvidedBySystem:"This solar panel model is already provided by the system"},parabolicTroughMenu:{ModuleLength:"Module Length",Modules:"modules",ModulesLong:"modules long",LatusRectum:"Latus Rectum",OnlyThisParabolicTrough:"Only This Parabolic Trough",AllParabolicTroughsAboveFoundation:"All Parabolic Troughs Above the Same Foundation",AllSelectedParabolicTroughs:"All Selected Parabolic Troughs",AllParabolicTroughs:"All Parabolic Troughs"},fresnelReflectorMenu:{AbsorberPipe:"Absorber Pipe",SelectAbsorberToReflectSunlightTo:"Select Absorber to Reflect Sunlight to",ModuleLength:"Module Length",Modules:"modules",ModulesLong:"modules long",OnlyThisFresnelReflector:"Only This Fresnel Reflector",AllFresnelReflectorsAboveFoundation:"All Fresnel Reflectors Above the Same Foundation",AllSelectedFresnelReflectors:"All Selected Fresnel Reflectors",AllFresnelReflectors:"All Fresnel Reflectors"},heliostatMenu:{Tower:"Tower",SelectTowerToReflectSunlightTo:"Select Tower to Reflect Sunlight to",OnlyThisHeliostat:"Only This Heliostat",AllHeliostatsAboveFoundation:"All Heliostats Above the Same Foundation",AllSelectedHeliostats:"All Selected Heliostats",AllHeliostats:"All Heliostats"},parabolicDishMenu:{ReceiverStructure:"Receiver Structure",CentralPole:"Central Pole",CentralPoleWithTripod:"Central Pole with Tripod",Quadrupod:"Quadrupod",RimDiameter:"Rim Diameter",LatusRectum:"Latus Rectum",ExtraPoleHeightInAdditionToRadius:"Extra Pole Height in Addition to Radius",OnlyThisParabolicDish:"Only This Parabolic Dish",AllParabolicDishesAboveFoundation:"All Parabolic Dishes Above the Same Foundation",AllSelectedParabolicDishes:"All Selected Parabolic Dishes",AllParabolicDishes:"All Parabolic Dishes"},windTurbineMenu:{BirdSafeDesign:"Bird-Safe Design",BirdSafeNone:"None",BirdSafeBicolor:"Bicolor",BirdSafeStriped:"Striped",Rotor:"Rotor",BladeNumber:"Blade Number",RotorInitialAngle:"Rotor Initial Angle",RotorBladeDesign:"Rotor Blade Design",RotorBladeRadius:"Rotor Blade Radius",RotorBladePitchAngle:"Rotor Blade Pitch Angle",RelativeYawAngle:"Relative Yaw Angle",MaximumChordLength:"Maximum Chord Length",Tower:"Tower",TowerHeight:"Tower Height",TowerRadius:"Tower Radius",HubDesign:"Hub Design",HubRadius:"Hub Radius",HubLength:"Hub Length",OnlyThisWindTurbine:"Only This Wind Turbine",AllWindTurbinesAboveFoundation:"All Wind Turbines Above the Same Foundation",AllSelectedWindTurbines:"All Selected Wind Turbines",AllWindTurbines:"All Wind Turbines"},wallMenu:{TextureDefault:"Default",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",SizeOfWall:"Size of Wall",OnlyThisWall:"Only This Wall",AllConnectedWalls:"All Connected Walls",AllWallsAboveFoundation:"All Walls Above the Same Foundation",AllSelectedWalls:"All Selected Walls",AllWalls:"All Walls",Windows:"Windows",LockAllUnlockedWindows:"Lock All Unlocked Windows",UnlockAllLockedWindows:"Unlock All Locked Windows",RemoveAllUnlockedWindows:"Remove All Unlocked Windows",DoYouReallyWantToRemoveAllWindowsOnThisWall:"Do you really want to remove all the windows on this wall",Doors:"Doors",LockAllUnlockedDoors:"Lock All Unlocked Doors",UnlockAllLockedDoors:"Unlock All Locked Doors",RemoveAllUnlockedDoors:"Remove All Unlocked Doors",DoYouReallyWantToRemoveAllDoorsOnThisWall:"Do you really want to remove all the doors on this wall",SolarPanels:"Solar Panels",LockAllUnlockedSolarPanels:"Lock All Unlocked Solar Panels",UnlockAllLockedSolarPanels:"Unlock All Locked Solar Panels",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",DoYouReallyWantToRemoveAllSolarPanelsOnThisWall:"Do you really want to remove all the solar panels on this wall",Sensors:"Sensors",LockAllUnlockedSensors:"Lock All Unlocked Sensors",UnlockAllLockedSensors:"Unlock All Locked Sensors",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",DoYouReallyWantToRemoveAllSensorsOnThisWall:"Do you really want to remove all the sensors on this wall",Lights:"Lights",LockAllUnlockedLights:"Lock All Unlocked Lights",UnlockAllLockedLights:"Unlock All Locked Lights",RemoveAllUnlockedLights:"Remove All Unlocked Lights",DoYouReallyWantToRemoveAllLightsOnThisWall:"Do you really want to remove all the lights on this wall",Polygons:"Polygons",LockAllUnlockedPolygons:"Lock All Unlocked Polygons",UnlockAllLockedPolygons:"Unlock All Locked Polygons",RemoveAllUnlockedPolygons:"Remove All Unlocked Polygons",DoYouReallyWantToRemoveAllPolygonsOnThisWall:"Do you really want to remove all the polygons on this wall",WallStructure:"Wall Structure",DefaultStructure:"Default",StudStructure:"Stud",PillarStructure:"Pillar",Opacity:"Opacity",StructureSpacing:"Structure Spacing",StructureWidth:"Structure Width",StructureThickness:"Structure Thickness",StructureColor:"Structure Color",Color:"Wall Color",Height:"Height",Thickness:"Thickness",Texture:"Texture",AllLightsOnWallInside:"All Lights on Wall Inside",AllLightsOnWallOutside:"All Lights on Wall Outside",Fill:"Fill",Full:"Full",Partial:"Partial",Empty:"Empty",OpenToOutside:"Open to Outside",EavesLength:"Eaves Overhang Length",Parapet:"Parapet",ParapetColor:"Parapet Color",ParapetTexture:"Parapet Texture",ParapetHeight:"Parapet Height",CopingsHeight:"Copings Height",CopingsWidth:"Copings Width"},windowMenu:{OnlyThisWindow:"Only This Window",AllWindowsOnSurface:"All Windows on the Same Surface",AllWindowsAboveFoundation:"All Windows Above the Same Foundation",AllSelectedWindows:"All Selected Windows",AllWindows:"All Windows",Width:"Width",Height:"Height",Setback:"Setback from Exterior Surface",RelativeToWallThickness:"Relative to wall thickness",Mullion:"Mullion",HorizontalMullion:"Horizontal Mullion",VerticalMullion:"Vertical Mullion",MullionWidth:"Mullion Width",HorizontalMullionSpacing:"Horizontal Mullion Spacing",VerticalMullionSpacing:"Vertical Mullion Spacing",MullionColor:"Mullion Color",Tint:"Tint",Opacity:"Opacity",SolarHeatGainCoefficient:"Solar heat gain coefficient (SHGC) = 1 - opacity",Shutter:"Shutter",LeftShutter:"Left Shutter",RightShutter:"Right Shutter",BothShutters:"Both Shutters",ShutterWidth:"Relative Width",ShutterColor:"Shutter Color",Frame:"Frame",FrameWidth:"Frame Width",SillWidth:"Sill Width",Color:"Frame Color",WindowType:"Window Type",Default:"Default",Arched:"Arched",Polygonal:"Polygonal",Interior:"Interior",Empty:"Empty"},roofMenu:{TextureDefault:"Default",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",OnlyThisRoof:"Only This Roof",AllRoofsAboveFoundation:"All Roofs Above the Same Foundation",AllSelectedRoofs:"All Selected Roofs",AllRoofs:"All Roofs",OnlyThisCeiling:"Only This Ceiling",AllCeilingsAboveFoundation:"All Ceilings Above the Same Foundation",AllCeilings:"All Ceilings",EavesOverhangLength:"Eaves Overhang Length",RafterSpacing:"Rafter Spacing",RafterWidth:"Rafter Width",RafterThickness:"Rafter Thickness",RafterColor:"Rafter Color",RoofColor:"Roof Color",RoofSideColor:"Roof Side Color",GlassTint:"Glass Tint",Opacity:"Opacity",RoofStructure:"Roof Structure",DefaultStructure:"Default",RafterStructure:"Rafter",GlassStructure:"Glass",SolarPanels:"Solar Panels",LockAllUnlockedSolarPanels:"Lock All Unlocked Solar Panels",UnlockAllLockedSolarPanels:"Unlock All Locked Solar Panels",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof:"Do you really want to remove all the solar panels on this roof",Windows:"Windows",LockAllUnlockedWindows:"Lock All Unlocked Windows",UnlockAllLockedWindows:"Unlock All Locked Windows",RemoveAllUnlockedWindows:"Remove All Unlocked Windows",DoYouReallyWantToRemoveAllWindowsOnThisRoof:"Do you really want to remove all the windows on this roof",Sensors:"Sensors",LockAllUnlockedSensors:"Lock All Unlocked Sensors",UnlockAllLockedSensors:"Unlock All Locked Sensors",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",DoYouReallyWantToRemoveAllSensorsOnThisRoof:"Do you really want to remove all the sensors on this roof",Lights:"Lights",RemoveAllUnlockedLights:"Remove All Unlocked Lights",DoYouReallyWantToRemoveAllLightsOnThisRoof:"Do you really want to remove all the lights on this roof",AllLightsOnRoofInside:"All Lights on Roof Inside",AllLightsOnRoofOutside:"All Lights on Roof Outside",Rise:"Rise",Ceiling:"Ceiling",RoofRValue:"Roof R-Value",CeilingRValue:"Ceiling R-Value"},doorMenu:{TextureDefault:"Default",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",Texture11:"Texture 11",Texture12:"Texture 12",Texture13:"Texture 13",Texture14:"Texture 14",Texture15:"Texture 15",Texture16:"Texture 16",Texture17:"Texture 17",OnlyThisDoor:"Only This Door",AllDoorsOnWall:"All Doors on the Same Wall",AllDoorsAboveFoundation:"All Doors Above the Same Foundation",AllSelectedDoors:"All Selected Doors",AllDoors:"All Doors",DoorType:"Door Type",Default:"Default",Arched:"Arched",Filled:"Filled",FrameColor:"Frame Color",Interior:"Interior"},siteInfoPanel:{High:"High",Low:"Low"},designInfoPanel:{NumberOfSelectedHeliostats:"Number of selected heliostats",NumberOfSelectedSolarPanels:"Number of selected solar panels",ElectricityGeneratedDailyBySolarPanels:"Electricity generated daily by these solar panels",SceneDiameter:"Scene diameter",BuildingArea:"Building area"},visualizationControlPanel:{ColorContrast:"Color Contrast",FluxScale:"Flux Scale",ClickUpOrDownArrowButtonsToChange:"Click up or down arrow buttons to change"},instructionPanel:{Rotate:"Rotate",DragMouse:"Drag mouse",Zoom:"Zoom",MouseWheelOrKeys:"Rotate mouse wheel or press Ctrl+[ or Ctrl+]",MouseWheelOrKeysMac:"Rotate mouse wheel or press ⌘+[ or ⌘+]",Pan:"Pan",HoldCtrlDragMouse:"Hold Ctrl and drag mouse",HoldMetaDragMouse:"Hold ⌘ and drag mouse",Enter2DMode:"Enter 2D mode",Exit2DMode:"Exit 2D mode",NavigationMode:"Navigation mode",EnableNavigation:"Enable navigation",DisableNavigation:"Disable navigation",MoveForwardBack:"Move forward/back",MoveForwardBackInstruction:"Press W/S",MoveLeftRight:"Move left/right",MoveLeftRightInstruction:"Press A/D",MoveUpDown:"Move up/down",MoveUpDownInstruction:"Press Z/X",Turn:"Turn",TurnInstruction:"Press arrow keys",ResetView:"Reset",AutoRotate:"Auto rotate",StartOrStop:"Press F4 to start or stop"},mapPanel:{ImageOnGround:"Image on Ground",HideAddress:"Hide Address",WeatherStations:"Weather Stations",WeatherStationsNote:"Turn this off to speed up",Coordinates:"Coordinates",Zoom:"Zoom"},visibilityPanel:{SolarPanelVisibility:"Solar Panel Visibility",Observer:"Observer",VantagePoint:"Vantage Point",ItemizedVisibilityByFields:"Itemized by Fields",TotalVisibility:"Total"},sensorPanel:{LightSensor:"Light Sensor",WeatherDataFrom:"Weather Data from"},buildingEnergyPanel:{DailyBuildingEnergy:"Daily Building Energy",YearlyBuildingEnergy:"Yearly Building Energy",Heater:"Heater",AC:"AC",SolarPanel:"Solar Panel",Net:"Net"},solarPanelYieldPanel:{SolarPanelDailyYield:"Solar Panel Daily Yield",SolarPanelYearlyYield:"Solar Panel Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualSolarPanels:"Show outputs of individual solar panels",Profit:"Profit",TotalCost:"Total Cost",TotalRevenue:"Total Revenue",TotalYield:"Total Yield",MeanYield:"Mean Yield",ModuleCount:"Module Count"},parabolicTroughYieldPanel:{ParabolicTroughDailyYield:"Parabolic Trough Daily Yield",ParabolicTroughYearlyYield:"Parabolic Trough Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualParabolicTroughs:"Show outputs of individual parabolic troughs"},parabolicDishYieldPanel:{ParabolicDishDailyYield:"Parabolic Dish Daily Yield",ParabolicDishYearlyYield:"Parabolic Dish Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualParabolicDishes:"Show outputs of individual parabolic dishes"},fresnelReflectorYieldPanel:{FresnelReflectorDailyYield:"Fresnel Reflector Daily Yield",FresnelReflectorYearlyYield:"Fresnel Reflector Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualFresnelReflectors:"Show outputs of individual Fresnel feflectors"},heliostatYieldPanel:{HeliostatDailyYield:"Heliostat Daily Yield",HeliostatYearlyYield:"Heliostat Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualHeliostats:"Show outputs of individual heliostats"},updraftTowerYieldPanel:{UpdraftTowerDailyYield:"Solar Updraft Tower Daily Yield",UpdraftTowerYearlyYield:"Solar Updraft Tower Yearly Yield",ChimneyAirTemperature:"Chimney Air Temperature",ChimneyWindSpeed:"Chimney Wind Speed",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualUpdraftTowers:"Show outputs of individual updraft towers"},heliodonPanel:{SunAndTimeSettings:"Sun & Time Settings",SunAngles:"Angles",TwentyFourHours:"24 Hours"},cloudFilePanel:{CopyTitle:"Copy Title",TitleCopiedToClipBoard:"The title was copied to the clip board",SearchByTitle:"Search by title",MyLikes:"My Likes",MyCloudFiles:"My Cloud Files",GenerateLink:"Generate Link",LinkGeneratedInClipBoard:"A link was generated in the clip board",DoYouReallyWantToDelete:"Do you really want to delete",IfSharedOrPublishedRenamingFileBreaksExistingLinks:"If this file has been shared or published, renaming it breaks existing links"},projectListPanel:{CopyTitle:"Copy Title",TitleCopiedToClipBoard:"The title was copied to the clip board",SearchByTitle:"Search by title",MyProjects:"My Projects",GenerateProjectLink:"Generate Project Link",ProjectLinkGeneratedInClipBoard:"A link to the project was generated in the clip board",DoYouReallyWantToDeleteProject:"Do you really want to delete Project",IfSharedOrPublishedRenamingProjectBreaksExistingLinks:"If this project has been shared or published, renaming it breaks existing links"},projectPanel:{ProjectSettings:"Project Settings",ThumbnailImageSize:"Thumbnail Image Size",ProjectByOtherPeople:"Project by Other People",Project:"Project",ProjectType:"Type",ProjectDescription:"Description",MakeDescriptionEditable:"Make this description editable",MakeDescriptionNonEditable:"Make this description non-editable",DoubleClickToMakeDescriptionEditable:"Double-click to make this description editable",SolarPanelArray:"Solar Panel Array",CurateCurrentDesign:"Curate current design",UpdateSelectedDesign:"Update selected design",RemoveSelectedDesign:"Remove selected design",ClickToFlipSortingOrder:"Click to flip the sorting order",DesignNotShownInSolutionSpaceClickToShow:"This design is not shown in solution space; click to show",DesignShownInSolutionSpaceClickToHide:"This design is shown in solution space; click to hide",SolutionSpace:"Solution Space",ChooseSolutionSpace:"Choose solution space",ChooseDataColoring:"Choose data coloring",SameColorForAllDesigns:"Same color for all designs",OneColorForEachDesign:"One color for each design",SolutionSpaceScreenshot:"Take a screenshot of the solution space",ScatterPlotScreenshot:"Take a screenshot of the scatter plot",SingleClickToSelectDoubleClickToOpen:"Single-click to select, double-click to open.",SingleClickToDeselectDoubleClickToOpen:"Single-click to deselect, double-click to open.",GenerateScatterPlot:"Generate Scatter Plot",SelectXAxis:"Select X Axis",SelectYAxis:"Select Y Axis"},accountSettingsPanel:{MyAccountSettings:"My Account Settings",MyID:"My 🆔",ClickToCopyMyID:"Click to copy my ID",IDInClipBoard:"Your ID was copied and is ready to paste.",StoreMyNameInMyFilesWhenSaving:"Store my name in my files when saving",DoYouReallyWantToShowYourNameInYourFiles:"Do you really want to show your display name in your files?",SignFileDisclaimer:"If yes, your display name may be seen by anyone who can access your files.",Likes:"Likes",AllPublished:"All Published",PublishedUnderAliases:"Aliases",UserCount:"User Count",SchoolID:"School ID",ClassID:"Class ID"},weatherPanel:{SunshineHours:"Sunshine"},diurnalTemperaturePanel:{SelectAirTemperatureModel:"Select Air Temperature Model",Sinusoidal:"Sinusoidal"},economicsPanel:{EconomicsParameters:"Economics Parameters",ElectricitySellingPrice:"Electricity Selling Price",OperationalCostPerUnit:"Operational Cost per Unit",SellingPrice:"Selling Price",UnitCost:"Unit Cost"},navigationPanel:{NavigationParameters:"Navigation Parameters",MinimumMoveSpeed:"Minimum Move Speed",MinimumTurnSpeed:"Minimum Turn Speed"},shadowSettingsPanel:{ShadowSettings:"Shadow Settings",ShadowCameraFarDistance:"Shadow Camera Far Distance",ShadowMapSize:"Shadow Map Size",Notes:"Notes",RefreshPageNote:"Refresh the page for the new settings to take effect.",MapSizeWarning:"A large shadow map size may cause Aladdin to crash on some computers."},yearlyLightSensorPanel:{SkyClearness:"Clearness",ShowDaylightResults:"Show daylight results",ShowSkyClearnessResults:"Show sky clearness results",ShowAverageDailySolarRadiation:"Show average daily solar radiation"},analysisManager:{NoSensorForCollectingData:"There is no sensor for collecting data.",NoSolarPanelForAnalysis:"There is no solar panel for analysis.",NoObserverForVisibilityAnalysis:"There is no observer for visibility analysis.",NoSolarWaterHeaterForAnalysis:"There is no solar water heater for analysis.",NoParabolicDishForAnalysis:"There is no parabolic dish for analysis.",NoParabolicTroughForAnalysis:"There is no parabolic trough for analysis.",NoFresnelReflectorForAnalysis:"There is no Fresnel reflector for analysis.",NoHeliostatForAnalysis:"There is no heliostat for analysis.",NoSolarUpdraftTowerForAnalysis:"There is no solar updraft tower for analysis.",NoBuildingForAnalysis:"There is no building for analysis."},toolbar:{CloudFile:"Cloud file",Select:"Select",AddFoundation:"Add Foundation",AddWall:"Add Wall",AddWindow:"Add Window",AddDoor:"Add Door",AddPyramidRoof:"Add Pyramid Roof",AddGableRoof:"Add Gable Roof",AddHipRoof:"Add Hip Roof",AddGambrelRoof:"Add Gambrel Roof",AddMansardRoof:"Add Mansard Roof",AddCuboid:"Add Cuboid",AddSensor:"Add Sensor",AddSolarPanel:"Add Solar Panel",AddSolarWaterHeater:"Add Solar Water Heater",AddBatteryStorage:"Add Battery Storage",AddParabolicDish:"Add Parabolic Dish",AddParabolicTrough:"Add Parabolic Trough",AddFresnelReflector:"Add Fresnel Reflector",AddHeliostat:"Add Heliostat",AddWindTurbine:"Add Horizontal Axis Wind Turbine",AddVerticalAxisWindTurbine:"Add Vertical Axis Wind Turbine",AddLight:"Add Light",AddTree:"Add Tree",AddFlower:"Add Flower",AddPeople:"Add People",DoubleClickToLockThisModeForNextAction:"Double-click to lock this mode for next action",ClickToUnlockThisModeForNextAction:"Click to unlock this mode for next action",ManipulateGroup:"Manipulate a group",ClearScene:"Clear scene",ShowSunAndTimeSettings:"Show sun and time settings",SpatialAnalysisOfEnergy:"Spatial analysis of energy",DoYouReallyWantToClearContent:"Do you really want to clear the content",ClickForMoreButtons:"Click for more buttons"},tooltip:{gotoIFI:"Go to Institute for Future Intelligence",visitAladdinHomePage:"Visit Aladdin Homepage",clickToOpenMenu:"Click to open main menu",clickToAccessAccountSettings:"Click to access account settings"},tree:{Apple:"Apple",Birch:"Birch",Coconut:"Coconut",Dogwood:"Dogwood",Elm:"Elm",FanPalm:"Fan Palm",Linden:"Linden",Magnolia:"Magnolia",Maple:"Maple",Oak:"Oak",Pine:"Pine",Spruce:"Spruce"},flower:{Bellflower:"Bellflower",Boxwood:"Boxwood",CactusCombo1:"Cactus Combo 1",CactusCombo2:"Cactus Combo 2",CactusCombo3:"Cactus Combo 3",CactusCombo4:"Cactus Combo 4",Hibiscus:"Hibiscus",Hosta:"Hosta",Hydrangea:"Hydrangea",Peony:"Peony",RedRose:"Red Rose",Spirea:"Spirea",Sunflower:"Sunflower",TallBush:"Tall Bush",Tulip:"Tulip",WhiteFlower:"White Flower",YellowFlower:"Yellow Flower"},people:{Jaah:"Jaah",Jack:"Jack",Jacob:"Jacob",Jacqueline:"Jacqueline",Jade:"Jade",Jamelia:"Jamelia",James:"James",Jane:"Jane",Jaya:"Jaya",Jaye:"Jaye",Jeanette:"Jeanette",Jedi:"Jedi",Jeff:"Jeff",Jena:"Jena",Jennifer:"Jennifer",Jess:"Jess",Jett:"Jett",Jill:"Jill",Jiya:"Jiya",Joan:"Joan",Jocelyn:"Jocelyn",Joel:"Joel",Joey:"Joey",John:"John",Jonathon:"Jonathon",Jose:"Jose",Joseph:"Joseph",Joshua:"Joshua",Judd:"Judd",Judy:"Judy",Julia:"Julia",Julio:"Julio",Jumapili:"Jumapili",June:"June",Juro:"Juro",Justin:"Justin"},compass:{N:"N",S:"S",W:"W",E:"E"},month:{January:"Jan",February:"Feb",March:"Mar",April:"Apr",May:"May",June:"Jun",July:"Jul",August:"Aug",September:"Sep",October:"Oct",November:"Nov",December:"Dec"},modelsMap:{AllTime:"All Time",SearchByPublisher:"Search by publisher",SearchByLabel:"Search by label",MyPublishedModels:"My Published Models",TotalNumberOfUserPublishedModelsInSelectedPeriod:"Total number of user-published models in the selected period",AllTimeTotal:"All-time total",SortFromOldestToNewest:"Sort from oldest to newest",SortFromNewestToOldest:"Sort from newest to oldest",SitesFound:"sites found",ModelsFoundOnThisSite:"models found on this site",ShowModelsPublishedByThisAuthor:"Show the models published by this author"},modelTree:{Human:"Human",Flower:"Flower",Tree:"Tree",Foundation:"Foundation",Wall:"Wall",Roof:"Roof",Window:"Window",SkylightWindow:"Skylight Window",Door:"Door",SolarWaterHeater:"Solar Water Heater",RooftopSolarPanels:"Rooftop Solar Panels",WallMountedSolarPanels:"Wall-Mounted Solar Panels",GroundMountedSolarPanels:"Ground-Mounted Solar Panels",Sensor:"Sensor",Light:"Light"}}},N5t={translation:{name:{IFI:"未来智能研究所",Aladdin:"阿拉丁",Tagline:"阿拉丁: 探索人工智能时代的设计软件 — 未来智能研究所研发"},cookie:{Statement:"声明:为了改善您的用户体验,阿拉丁采用cookie储存少量数据。",Accept:"同意"},aboutUs:{ProductBroughtToYouBy:"未来智能研究所荣誉出品",TermsOfService:"服务条款",PrivacyPolicy:"隐私政策",Software:"软件",Content:"课件",Research:"研究",Support:"服务",Acknowledgment:"鸣谢",FundingInformation:"本产品的研发承蒙美国国家科学基金会慷慨资助(项目号#2105695,#2131097,#2301164)。本产品的任何观点或结论仅代表创作者个人意见。",Contact:"如您需要更多信息,请联系 Charles Xie (charles@intofuture.org)。我们会尽快回复。",Translators:"翻译"},word:{Mute:"勿扰",BrandName:"品牌",Name:"名字",Refresh:"刷新",LastUpdate:"上一次更新",Small:"小",Medium:"中",Large:"大",Design:"设计",Information:"信息",Type:"类别",Text:"文字",FontSize:"字体大小",FontColor:"字体颜色",Model:"模型",Models:"模型",Upload:"上传",ClickCount:"点击数",Share:"分享",AlreadyLike:"已点赞",Like:"点赞",MustLogInToLike:"必须登录才能点赞",AllRightsReserved:"版权所有",MeterAbbreviation:"米",VoltAbbreviation:"伏",AmpereAbbreviation:"安",WattAbbreviation:"瓦",Version:"版本",VersionInitial:"版本",Options:"选项",Maximum:"最大",Minimum:"最小",MaximumNumber:"最多",MinimumNumber:"最少",MaximumValue:"最大值",MinimumValue:"最小值",Or:"或",None:"无",High:"高",Partial:"部分",Teacher:"老师",Class:"班级",Total:"总数",Leaderboard:"用戶排行榜",Latest:"最新",Range:"范围",SIUnit:"国际单位制",USUnit:"美国单位制",ThermalTransmittance:"热透过率",ThermalResistance:"热阻",UValue:"U值",RValue:"R值",VolumetricHeatCapacity:"容积热容",Press:"按",Open:"打开",Save:"保存",SaveAsImage:"保存为图像",SaveAsCsv:"保存为CSV",Update:"刷新",Paste:"粘贴",Copy:"复制",Cut:"剪切",Delete:"删除",Add:"添加",Lock:"固定",Translucent:"半透明",Transparency:"透明度",Color:"颜色",Pattern:"图案",Texture:"材质",Thickness:"厚度",Size:"尺寸",Yes:"是",No:"不",NoAndDoNotAskAgain:"不,别再问",OK:"确定",Cancel:"取消",Apply:"应用",Close:"关闭",ApplyTo:"适用于",Run:"运行",Pause:"暂停",Resume:"继续",Clear:"清空",Warning:"警告",Caution:"小心",Reminder:"提醒",Length:"长度",Width:"宽度",Height:"高度",Radius:"半径",Angle:"角度",Azimuth:"方位角",Coordinates:"坐标",Weather:"天气",Show:"显示",Animate:"动画",Date:"日期",Time:"时间",Title:"标题",Owner:"所有者",Action:"操作",Rename:"改名",Location:"位置",Latitude:"纬度",Month:"月份",Day:"天",Hour:"小时",Daylight:"白天长度",Radiation:"辐射",Temperature:"温度",kWh:"千瓦时",dollar:"元",MeterPerSecond:"米/秒",NorthInitial:"北",SouthInitial:"南",EastInitial:"东",WestInitial:"西",Fixed:"固定",Elements:"部件",Energy:"能量",Unknown:"未知",Label:"标签",Description:"描述",NoDescription:"无描述",MaximumCharacters:"最多字符数",Author:"作者",Publisher:"发布者",Building:"建筑",ResidentialBuilding:"住宅建筑",CommercialBuilding:"商用建筑",SchoolBuilding:"学校建筑",TouristAttraction:"旅游景点",UnderConstruction:"在建",Photovoltaic:"光伏",WindPower:"风能",ColocationProjects:"共用空间项目",Anonymous:"无名氏",Nickname:"别名",Pin:"置顶",Unpin:"解除置顶"},shared:{NoTexture:"无材质",FoundationElement:"地基",CuboidElement:"长方体",PolygonElement:"多边形",SensorElement:"传感器",SolarPanelElement:"光伏板",SolarWaterHeaterElement:"太阳能热水器",ParabolicDishElement:"抛物线碟",ParabolicTroughElement:"抛物线槽",FresnelReflectorElement:"菲涅耳反射镜",HeliostatElement:"定日镜",WindTurbineElement:"风力涡轮机",LightElement:"电灯",ElementLocked:"固定",ModelType:"模型类别",OutputBreakdown:"分列发电量",MoreResults:"更多结果"},message:{DoNotShowAgain:"别再显示",NewVersionAvailable:"有新版本",CalculationMayBeSlowDoYouWantToContinue:"计算可能会很慢。您想继续吗?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"加大太阳辐射热图网格的尺寸可加速",ModelNotFound:"没有找到模型",CannotSignIn:"登录失败",CannotSignOut:"退出失败",YourAccountWasCreated:"成功建立您的账号。",CannotCreateAccount:"无法创建账号",YourAccountSettingsWereSaved:"您的账号设定已保存。",CannotSaveYourAccountSettings:"您的账号设定无法保存",CannotSaveYourFileToCloud:"无法保存您的文件到云端",CannotCreateNewProject:"无法创建新项目",CannotCreateNewProjectWithoutTitle:"没有标题, 无法创建新项目",CannotOpenYourProjects:"无法打开您的项目列表",CannotOpenProject:"无法打开项目",CannotDeleteProject:"无法删除项目",CannotRenameProject:"无法给项目改名",CannotAddDesignToProject:"无法把此设计加到项目里",CannotAddDesignToProjectOwnedByOthers:"不能把此设计加到别人的项目里",DesignRemovedFromProject:"设计被成功地从项目里删除",CannotRemoveDesignFromProject:"无法把此设计从项目里删除",CannotUpdateProject:"无法更新项目",CannotFetchProjectData:"无法取得项目数据",TitleUsedChooseDifferentOne:"此标题已经被使用, 请采用不同的标题",CloudFileWithTitleExistsDoYouWantToOverwrite:"使用此标题的云文件已经存在,您确定要覆盖它吗?",CloudFileNotFound:"找不到此云端文件",CannotLoadModelsOnMap:"无法下载地图上的模型",CannotLoadLeaderboard:"无法下载排行榜",CannotPublishModelOnMap:"模型无法发布到地图上",CannotLikeModelFromMap:"无法点赞地图上的模型",CannotDeleteModelFromMap:"无法删除地图上的模型",ModelDeletedFromMap:"模型已从地图上删除",DoYouWantToDeleteModelFromMap:"您要删除地图上的这个模型吗?",CannotOpenCloudFile:"此云端文件无法打开",CannotReadCloudFile:"无法读取此云端文件",CannotWriteCloudFile:"无法存储此云端文件",CloudFileCopied:"拷贝云端文件",CannotOpenCloudFolder:"您的云端文件夹无法打开",CannotDeleteCloudFile:"无法删除此云端文件",CannotRenameCloudFile:"此云端文件的名字无法更改",DoYouWantToSaveChanges:"您要保存当前文件吗?",DoYouWantToUpdateDesign:"您要更新选中设计吗?",NotApplicableToSelectedAction:"此值不适用于当前选择范围",ThisElementIsLocked:"这个部件被锁定。",ThisCannotBeUndone:"这个操作一旦执行就不能撤销。",AzimuthOfNorthIsZero:"正北的方位角为零度",CounterclockwiseAzimuthIsPositive:"逆时针为正",SouthFacingIsZero:"朝南为零度",ClockwiseRotationIsPositive:"顺时针为正",MoveCancelledBecauseOfOverlap:"位置重叠,移动取消。",MoveOutsideBoundaryCancelled:"位置出界,移动取消。",RotationCancelledBecauseOfOverlap:"位置重叠,旋转取消。",RotationOutsideBoundaryCancelled:"位置出界,旋转取消。",ResizingCancelledBecauseOfOverlap:"位置重叠,尺寸调整取消。",ResizingOutsideBoundaryCancelled:"位置出界,尺寸调整取消。",CannotPasteOutsideBoundary:"位置出界,不能复制。",CannotPasteBecauseOfOverlap:"位置重叠,不能复制。",CannotMoveObjectTooFar:"位置太远,移动取消。",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"采用新布局之前必须移除现有的光伏板。",DoYouWantToContinue:"您想继续吗?",SolarPanelsCannotIntersectWithGround:"光伏板不能和地面接触。",SolarPanelsCannotOverlapWithOneAnother:"光伏板不能重叠。",ScreenshotSaved:"截屏图片保存在下载文件夹里。",CsvFileSaved:"CSV保存在下载文件夹里。",SimulationStarted:"模拟开始。",SimulationCompleted:"模拟结束。",SimulationAborted:"模拟取消。",SimulationPaused:"模拟暂停。",CancelSimulation:"取消模拟",PauseSimulation:"暂停模拟",ResumeSimulation:"继续模拟",SimulationWillNotStartDueToErrors:"由于错误模拟无法运行",SimulationWillStartDespiteWarnings:"发现问题,但模拟仍然将运行。",EvolutionStarted:"演化开始。",EvolutionCompleted:"演化结束。",EvolutionAborted:"演化取消。",EvolutionPaused:"演化暂停。",EncounterEvolutionError:"演化出错。",CancelEvolution:"取消演化",PauseEvolution:"暂停演化",ResumeEvolution:"继续演化",ConvergenceThresholdHasBeenReached:"收敛阈值已达到。",MaximumNumberOfGenerationsHasBeenReached:"最大世代数已达到。",MaximumNumberOfStepsHasBeenReached:"最大步数已达到。",ObjectiveFunctionTypeError:"此操作不支持当前的目标函数。请从菜单启动此功能。",WallsAreNotAtSameHeight:"墙体高度不同。",WallsAreNotPerpendicular:"墙体不垂直。",WallsAreNotConnected:"墙体不相连。",WallsNumberNeedToBeFour:"墙体数量必须为四个。",BuildingContainsEmptyWall:"建筑物有空墙。",BuildingRoofMissing:"建筑物没有屋顶。",UnknownErrors:"未知错误。",SigningOutAnonymousAccount:"你确定退出吗?一旦退出,此匿名账号将不可恢复。",SigningInAnonymousAccount:"你确定匿名登录吗?一旦退出,匿名账号将无法恢复。匿名登录主要是为无法实名登录的用户提供临时方便。"},menu:{AnalysisOptions:"分析选项",option:{GridCellSize:"计算网格的尺寸",SamplingFrequency:"采样频率",TimesPerHour:"每小时采样次数",DaysPerYear:"每一年采样天数"},mainMenu:"主菜单",cloudMenu:"云菜单",projectSubMenu:"项目",project:{CreateNewProject:"创建新项目",OpenProject:"打开项目",SaveProject:"保存项目",SaveProjectAs:"另存项目为",YouMustLogInToCreateProject:"您必须登录才能创建项目",YouMustLogInToOpenProject:"您必须登录才能打开项目"},fileSubMenu:"文件",file:{CreateNewFile:"创建新文件",OpenLocalFile:"打开本地文件",SaveAsLocalFile:"保存为本地文件",SavingAbortedMustHaveValidFileName:"文件名无效,保存失败",OpenCloudFile:"打开云端文件",SaveCloudFile:"保存云端文件",SaveAsCloudFile:"另存云端文件为",SavingAbortedMustHaveValidTitle:"云端文件名无效,保存失败",ToSaveYourWorkPleaseSignIn:"为了保存您的云端文件,请先登录。",TakeScreenshot:"截屏",UseCloudFileName:"采用云端文件名",PublishOnModelsMap:"发布到地图上",PublishedOnModelsMap:"您的模型成功发布到地图上",UpdatedOnModelsMap:"您的模型更新成功",YouMustLogInToPublishYourModel:"您必须登录才能发布模型",YouCannotPublishAModelThatYouDoNotOwn:"您不能发布他人的模型",YouMustSaveModelOnCloudBeforePublishingIt:"您必须先把此模型保存在云端才能发布它"},editSubMenu:"编辑",edit:{Undo:"撤销",Redo:"重做",Undone:"已撤销"},viewSubMenu:"视界",view:{ModelTree:"模型树图",NavigationView:"导航模式",TwoDimensionalView:"二维模式",ResetView:"重置视角",ZoomIn:"放大",ZoomOut:"缩小",AutoRotate:"自动旋转",ShowShadow:"显示阴影",ShowSurfaceShininess:"显示表面光泽",TranslucentFloatingWindows:"透明浮动窗口",accessoriesSubMenu:"配件",accessories:{SiteInformation:"位置信息",DesignInformation:"设计信息",Instruction:"操作说明",StickyNote:"便签",Note:"便签"}},settingsSubMenu:"设置",settings:{WeatherData:"气象数据",DiurnalTemperature:"昼夜温度",Heliodon:"日影仪",SunAndTime:"太阳和时间",CustomSolarPanels:"定制的光伏板",CustomizeSolarPanel:"定制光伏板"},benchmarksSubMenu:"基准",benchmarks:{SolarRadiationPredictionVsMeasurement:"太阳能辐射模型预测和实际测量的对比",BESTESTCase600:"建筑物能耗模拟测试:BESTEST案例600",BESTESTCase610:"建筑物能耗模拟测试:BESTEST案例610",BESTESTCase620:"建筑物能耗模拟测试:BESTEST案例620",BESTESTCase630:"建筑物能耗模拟测试:BESTEST案例630"},graph:{LineWidth:"线条宽度",SymbolSize:"符号大小",BarCategoryGap:"直条间隙",ShowHorizontalGridLines:"显示格子的水平线条",ShowVerticalGridLines:"显示格子的竖直线条"},analysisSubMenu:"分析",physicsSubMenu:"物理",physics:{DailySolarRadiationHeatmap:"当日太阳辐射总量分布热图",SolarRadiationHeatmapOptions:"太阳辐射热图选项",SolarRadiationHeatmapGridCellSize:"太阳辐射热图网格的尺寸",SolarRadiationHeatmapMaxValue:"太阳辐射热图最大值",SolarRadiationHeatmapNoAnimation:"若无移动部件则省略动画",ReflectionHeatmap:"反射热图"},sensorSubMenu:"传感器",sensor:{CollectDailyData:"收集当天数据",CollectYearlyData:"收集全年数据",SensorSimulationNoAnimation:"若无移动部件则省略动画"},buildingSubMenu:"建筑物",building:{AnalyzeDailyBuildingEnergy:"建筑物当天能耗分析",AnalyzeYearlyBuildingEnergy:"建筑物全年能耗分析",EnergyAnalysisOptions:"能耗分析选项",EnergyGridCellSize:"计算网格的尺寸",BuildingEnergySimulationNoAnimation:"若无移动部件则省略动画"},solarPanelSubMenu:"太阳能光伏板",solarPanel:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出",AnalyzeVisibility:"分析可见度",PanelDiscretization:"光伏板离散化方法",Exact:"准确",Approximate:"近似",EnergyGridCellSize:"计算网格的尺寸",VisibilityGridCellSize:"视界因子计算网格的尺寸",EnergyAnalysisOptions:"能量分析选项",VisibilityAnalysisOptions:"可见度分析选项",SolarPanelSimulationNoAnimation:"若无移动部件则省略动画"},parabolicTroughSubMenu:"抛物线槽",parabolicTrough:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},parabolicDishSubMenu:"抛物线碟",parabolicDish:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},fresnelReflectorSubMenu:"菲涅尔反射镜",fresnelReflector:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},heliostatSubMenu:"定日镜",heliostat:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},solarUpdraftTowerSubMenu:"太阳能上升气流塔",solarUpdraftTower:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出",SolarUpdraftTowerSimulationNoAnimation:"若无移动部件则省略动画"},tutorialsSubMenu:"教程",solarEnergyScienceSubMenu:"太阳能科学",solarEnergyScienceTutorials:{SunAngles:"太阳相对于地面观察者的角度",InsolationAndClimate:"太阳辐射和气候的关系",SolarRadiationToBox:"一个长方体受到的太阳能辐射分析"},buildingScienceSubMenu:"建筑科学",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"房屋的热学封套和围护封套",EffectOfSizeOnBuildingEnergy:"房屋大小对能耗的影响",EffectOfOrientationOnBuildingEnergy:"房屋方位对能耗的影响",EffectOfInsulationOnBuildingEnergy:"房屋隔热对能耗的影响",EffectOfRoofColorOnBuildingEnergy:"屋顶颜色对建筑物能耗的影响",EffectOfEavesOverhangLengthOnBuildingEnergy:"屋檐延伸长度对建筑物能耗的影响",EffectOfWindowSHGCOnBuildingEnergy:"窗户太阳能输入对房屋能耗的影响",EffectOfThermostatSetpointOnBuildingEnergy:"恒温器设定值对房屋能耗的影响",EffectOfProgrammableThermostatOnBuildingEnergy:"可编程恒温器对房屋能耗的影响",EffectOfSolarPanelsOnBuildingEnergy:"光伏板对房屋能耗的影响",EffectOfGroundTemperatureOnBuildingEnergy:"地表温度对房屋能耗的影响",EffectOfTreesOnBuildingEnergy:"树荫对房屋能耗的影响"},buildingDesignSubMenu:"建筑设计",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"有棚顶窗的科德角风格的住宅",MansardRoofWithDormers:"有天窗的折线屋顶",GableRoofVsHipRoof:"双坡屋顶和四坡屋顶的对比",ColonialVsSaltbox:"殖民地风格和盐盒风格的对比",GambrelRoofVsMansardRoof:"复斜屋顶和折线屋顶的对比",CombinationRoofVsBonnetRoof:"组合屋顶和帽檐屋顶的对比",DutchGableRoof:"荷兰双坡屋顶",GableAndValleyRoof:"坡谷屋顶",ClerestoryRoof:"天窗屋顶",MonitorRoof:"采光屋顶",AFrameHouse:"A字形房子",HalfTimberedHouse:"半木骨架房子",AllBasicRoofTypes:"所有的基本屋顶类型"},photovoltaicSolarPowerSubMenu:"光伏发电",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"光伏板倾斜角对发电量的影响",EffectOfAzimuthOfSolarPanel:"光伏板方位角对发电量的影响",SolarPanelTypes:"光伏板类型",DefineYourOwnSolarPanels:"定义自己的光伏板",VerticalBifacialSolarPanels:"竖直的双面光伏板",CompareMonofacialAndBifacialSolarPanels:"单面光伏板和双面光伏板的对比",SolarTrackers:"自动追日器",CoveringGroundWithSolarPanels:"为什么我们不简单地用光伏板覆盖地面",InterRowSpacingOfSolarPanelArray:"光伏板阵列行间距对发电量的影响",EffectOfOrientationOfSolarPanels:"光伏板排列方向对发电量的影响",SolarPanelArrayAutomaticLayout:"光伏板自动排列"},concentratedSolarPowerSubMenu:"光热发电",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"抛物线槽方位角对发电量的影响",EffectOfLatusRectumOfParabolicTrough:"抛物线槽通径对发电量的影响",FocusSunlightWithParabolicDish:"用抛物线碟聚焦陽光",LinearFresnelReflectors:"用直线式菲涅尔反射镜聚焦陽光",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"吸热管的安装高度对直线式菲涅尔反射镜发电量的影响",EffectOfAzimuthOfLinearFresnelReflectors:"直线式菲涅尔反射镜方位角对发电量的影响",LinearFresnelReflectorsWithTwoAbsorbers:"配备两个吸收管的直线式菲涅尔反射镜阵列",CosineEfficiencyOfHeliostats:"定日镜的余弦效率",ShadowingAndBlockingOfHeliostats:"定日镜的阴影和遮挡",EffectSolarPowerTowerHeight:"吸收塔高度对发电量的影响",SolarPowerTower:"塔式光热发电站"},otherTypesOfSolarPowerSubMenu:"其它类型的太阳能发电",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"太阳能热水器",SolarUpdraftTower:"太阳能上升气流塔"},windPowerSubMenu:"风力发电",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"转子叶片的数目对风力涡轮机输出的影响",EffectOfPitchAngleOfWindTurbineBlades:"转子叶片的俯仰角对风力涡轮机输出的影响",BirdSafeBladeDesign:"对鸟类安全的叶片设计",OffshoreWindFarm:"海上风电场"},colocationSubMenu:"共用空间项目",colocationTutorials:{AgricultureSolarWindColocation:"农业光伏风力共用空间"},generativeDesignSubMenu:"生成式设计",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"单面光伏板阵列的倾斜角",BifacialSolarPanelArrayTiltAngle:"双面光伏板阵列的倾斜角",SolarPanelArrayInterRowSpacing:"光伏板阵列的行间距",OutputOfSolarPanelArrayInDifferentPlaces:"一个光伏板阵列在不同地区的产出",SimpleSolarFarmParetoFront:"简单太阳能农场设计的帕累托前沿"},examplesSubMenu:"例子",solarEnergySubMenu:"太阳能",solarEnergyExamples:{SunBeamAndHeliodon:"太阳光束和日影仪",RooftopSolarPanels:"屋顶光伏板",NevadaSolarOneParabolicTroughArray:"内华达州太阳能一号的抛物线槽阵列",TooeleParabolicDishArray:"犹他州图埃勒的抛物线碟阵列",PS10SolarPowerTower:"西班牙塞维利亚的PS10太阳能发电塔",TucsonLinearFresnelReflectors:"亚利桑那州图森的直线式菲涅尔反射镜阵列",SolarCanopyFormFactors:"太阳能天篷外形设计",SolarCanopyOverBleachers:"看台太阳能天篷",SolarCanopyOverGarage:"车库太阳能天篷",SolarBusStop:"太阳能候车亭",SolarFacadeTesla:"特斯拉光伏墙",BuildingIntegratedPhotovoltaics:"建筑整合光伏",Floatovoltaics:"浮动光伏",Agrivoltaics:"农业光伏",VegetativeBuffer:"太阳能农场绿化带",RainbowSwashSolarFarmBostonMA:"马萨诸塞州波士顿彩虹激流旁边的光伏板阵列",MickeyMouseSolarFarmOrlandoFL:"佛罗里达州奥兰多的米老鼠形状光伏板阵列",SolarPanelsOverCanalBakersfieldCA:"加利福尼亚州贝克斯菲尔德灌溉渠上假想的光伏板阵列",SolarNoiseBarrierLexingtonMA:"马萨诸塞州列克星敦高速公路噪音墙上假想的光伏板",HSATSolarTrackersRaleighNC:"北卡罗来纳州罗利的一个水平方向单轴旋转追日光伏板阵列(HSAT)",AADATSolarTrackersLancasterCA:"加利福尼亚州兰开斯特的一个双轴旋转追日光伏板阵列(AADAT)",SolarUpdraftTowerInCity:"太阳能上升气流塔在城市中的应用"},builtEnvironmentSubMenu:"建造环境",residentialBuildingsSubMenu:"住宅建筑",residentialBuildingExamples:{ColonialHouse:"殖民地风格的住宅",DutchColonialHouse:"荷兰殖民地风格的住宅",TShapedHouse:"T字型房子",CapeCodHouseWithGarage:"有车库的科德角风格的住宅",Solarium:"有日光浴室的房子",Church1:"教堂例一",Cathedral1:"主教座堂例一",Cathedral2:"主教座堂例二",Mosque1:"清真寺例一",AdobeTaosHouse:"陶斯土坯房",RanchHouse:"牧场风格的住宅",BonnetHouse:"有帽檐屋顶的住宅",BarnStyleHouse:"谷仓式风格的住宅",ModernHouse:"现代风格的住宅",ButterflyRoofHouse:"蝴蝶型屋顶的住宅"},commercialBuildingsSubMenu:"商用建筑",commercialBuildingExamples:{WhiteHouse:"白宫",HaroldWashingtonCollege:"哈罗德华盛顿学院",BilimMersinTurkiye:"土耳其梅尔辛科学教育中心",SpanishStyleHotel:"西班牙风格旅馆",ApartmentBuilding:"公寓楼",OfficeBuilding:"办公楼",Hotel:"旅馆"},buildingComplexesSubMenu:"建筑群",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"佛蒙特州南伯灵顿高中",MescaleroApacheSchoolNewMexico:"新墨西哥州梅斯卡勒罗阿帕奇学校"},urbanPlanningSubMenu:"城市规划",urbanPlanningExamples:{CityBlockHeatmap:"城市街区热图",ChicagoSkyline:"芝加哥天际线"},otherBuildingsSubMenu:"其它建筑",otherBuildingExamples:{Greenhouse:"温室",Pavilion:"公园的亭子",OctagonalPagoda:"八角塔",OceanFront:"海边",EgyptianPyramids:"埃及金字塔",MayanPyramid:"玛雅金字塔",SiOSePol:"三十三孔桥",StackedCuboids:"堆砌长方体"},artificialIntelligenceSubMenu:"人工智能",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"优化单排光伏板的倾斜角",OptimizingTiltAnglesOfMultipleSolarPanelRows:"优化多排光伏板的倾斜角",SolarFarmGenerativeDesign:"生成式设计太阳能农场",SolarFarmGenerativeDesignWithBlock:"生成式设计太阳能农场:周边有建筑物的情况",FitchburgSolarFarmGenerativeDesign:"生成式设计太阳能农场:真实世界案例"},languageSubMenu:"语言",publicSubMenu:"公共",ModelsGallery:"模型画廊",ModelsMap:"模型地图",AboutUs:"关于我们"},HVACMenu:{BuildingHVACSystem:"建筑物暖通空调系统",Tolerance:"温度忍耐阈值",ToleranceExplanation:`当日最低外面温度高于恒温器设定值减去此阈值,暖气不开。 当日最高外面温度低于恒温器设定值加上此阈值,空调不开。`,ID:"ID",ThermostatType:"恒温器类型",Simple:"简单",Programmable:"编程",ThermostatSetpoint:"恒温器设定值",HeatingSetpoint:"供暖温度设定值",CoolingSetpoint:"空调温度设定值",Period:"时段",StartTime:"开始时间",Setpoint:"设定值",Wake:"起床",Day:"白天",Evening:"夜晚",Sleep:"睡眠",TimeErrorMessage:"开始时间应晚于上一个时段"},avatarMenu:{AccountSettings:"账号设定",SignIn:"登录",SignInAsMe:"实名登录",SignInAnonymously:"匿名登录",SignOut:"退出账号",IfYouAreAStudent:"如果您是一个学生"},skyMenu:{Axes:"显示坐标轴",Theme:"环境主题",ThemeDefault:"默认",ThemeDesert:"沙漠",ThemeDune:"沙丘",ThemeForest:"森林",ThemeGrassland:"草原",ThemeHill:"丘陵",ThemeLake:"湖泊",ThemeMountain:"山脉",ThemeRural:"田园",SunlightAttenuationCoefficientInAir:"阳光在空气中传播的衰减系数",ConvectiveCoefficientOfAir:"空气对流传热系数",HighestTemperatureTimeInMinutes:"最高气温时间(分钟)",SelectSunAnglesToShow:"选择太阳角度显示",ShowAzimuthAngle:"显示方位角",ShowElevationAngle:"显示高度角",ShowZenithAngle:"显示天顶角",DirectLightBrightnessAtNoon:"正午直射光照度",AmbientLightBrightnessAtNoon:"正午环境光照度"},groundMenu:{MonthlyIrradianceLoss:"月份辐射度损失比",Vegetation:"植被",LeafOutDay:"树叶长出的日子",LeafOffDay:"树叶脱落的日子",Albedo:"反照率",ImageOnGround:"地面显示图像",WaterSurface:"水面",RemoveAllUnlockedTrees:"删除所有非固定的树木",RemoveAllUnlockedFlowers:"删除所有非固定的花草",RemoveAllUnlockedSolarPanels:"删除所有非固定的光伏板",RemoveAllUnlockedPeople:"删除所有非固定的人物",RemoveAllUnlockedFoundations:"删除所有非固定的地基",RemoveAllUnlockedCuboids:"删除所有非固定的长方体",DoYouReallyWantToRemoveAllPeople:"你确定删除所有非固定的人物吗",DoYouReallyWantToRemoveAllTrees:"你确定删除所有非固定的树木吗",DoYouReallyWantToRemoveAllFlowers:"你确定删除所有非固定的花草吗",DoYouReallyWantToRemoveAllSolarPanels:"你确定删除所有非固定的光伏板吗",DoYouReallyWantToRemoveAllFoundations:"你确定删除所有非固定的地基吗",DoYouReallyWantToRemoveAllCuboids:"你确定删除所有非固定的长方体吗",LockAllUnlockedElements:"固定所有非固定的部件",UnlockAllLockedElements:"解除所有的固定"},labelSubMenu:{Label:"标签",LabelText:"标签的内容",LabelHeight:"标签的高度",LabelSize:"标签的大小",LabelFontSize:"字体的大小",LabelColor:"标签的颜色",KeepShowingLabel:"显示标签"},foundationMenu:{RemoveAllUnlockedSolarPanels:"删除此地基上所有非固定的光伏板",RemoveAllUnlockedParabolicTroughs:"删除此地基上所有非固定的抛物线槽",RemoveAllUnlockedParabolicDishes:"删除此地基上所有非固定的抛物线碟",RemoveAllUnlockedFresnelReflectors:"删除此地基上所有非固定的菲涅耳反射镜",RemoveAllUnlockedHeliostats:"删除此地基上所有非固定的定日镜",RemoveAllUnlockedWindTurbines:"删除此地基上所有非固定的风力涡轮机",RemoveAllUnlockedSensors:"删除此地基上所有非固定的传感器",RemoveAllUnlockedLights:"删除此地基上所有非固定的电灯",RemoveAllUnlockedWalls:"删除此地基上所有非固定的墙",RemoveAllUnlockedWindows:"删除此地基上所有非固定的窗户",RemoveAllUnlockedDoors:"删除此地基上所有非固定的门",RemoveAllUnlockedPolygons:"删除此地基上所有非固定的多边形",RemoveAllUnlockedHumans:"删除此地基上所有非固定的人物",RemoveAllUnlockedTrees:"删除此地基上所有非固定的树木",RemoveAllUnlockedFlowers:"删除此地基上所有非固定的花草",Racks:"支架",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",SolarPanels:"光伏板",SolarPanelArray:"光伏板阵列",DoYouReallyWantToRemoveAllSolarPanelsOnFoundation:"你确定删除此地基上所有非固定的光伏板吗",ParabolicTroughs:"抛物线槽",DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation:"你确定删除此地基上所有非固定的抛物线槽吗",ParabolicDishes:"抛物线碟",DoYouReallyWantToRemoveAllParabolicDishesOnFoundation:"你确定删除此地基上所有非固定的抛物线碟吗",FresnelReflectors:"菲涅耳反射镜",DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation:"你确定删除此地基上所有非固定的菲涅耳反射镜吗",Heliostats:"定日镜",DoYouReallyWantToRemoveAllHeliostatsOnFoundation:"你确定删除此地基上所有非固定的定日镜吗",WindTurbines:"风力涡轮机",DoYouReallyWantToRemoveAllWindTurbinesOnFoundation:"你确定删除此地基上所有非固定的风力涡轮机吗",Sensors:"传感器",DoYouReallyWantToRemoveAllSensorsOnFoundation:"你确定删除此地基上所有非固定的传感器吗",Lights:"电灯",DoYouReallyWantToRemoveAllLightsOnFoundation:"你确定删除此地基上所有非固定的电灯吗",Walls:"墙",DoYouReallyWantToRemoveAllWallsOnFoundation:"你确定删除此地基上所有非固定的墙吗",Windows:"窗户",DoYouReallyWantToRemoveAllWindowsOnFoundation:"你确定删除此地基上所有非固定的窗户吗",Doors:"门",DoYouReallyWantToRemoveAllDoorsOnFoundation:"你确定删除此地基上所有非固定的门吗",Polygons:"多边形",DoYouReallyWantToRemoveAllPolygonsOnFoundation:"你确定删除此地基上所有非固定的多边形吗",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnFoundation:"你确定删除此地基上所有非固定的人物吗",Trees:"树木",DoYouReallyWantToRemoveAllTreesOnFoundation:"你确定删除此地基上所有非固定的树木吗",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnFoundation:"你确定删除此地基上所有非固定的花草吗",OnlyThisFoundation:"只这块地基",AllSelectedFoundations:"所有选中的地基",AllConnectedFoundations:"所有相连的地基",AllFoundations:"所有的地基",AddPolygon:"添加多边形",SolarStructure:"太阳能构型",GroupMaster:"主地基",LockAllUnlockedElementsOnThisFoundation:"固定此地基上所有非固定的部件",UnlockAllLockedElementsOnThisFoundation:"解除此地基上所有的固定",GroundFloorRValue:"建筑物地板的R值",OnlyThisGroundFloor:"只这个建筑物的地板",AllGroundFloors:"所有建筑物的地板"},solarPowerTowerMenu:{ReceiverTowerForHeliostats:"和定日镜配套的吸收塔",ReceiverTowerPhysicalProperties:"太阳能吸收塔的物理性质",ReceiverTowerHeight:"太阳能吸收塔的高度",ReceiverTowerRadius:"太阳能吸收塔的半径",ReceiverAbsorptance:"太阳能吸收器的吸收率",ReceiverOpticalEfficiency:"太阳能吸收器的光效率",ReceiverThermalEfficiency:"太阳能吸收器的热效率"},solarAbsorberPipeMenu:{AbsorberPipeForFresnelReflectors:"和菲涅尔反射镜配套的吸收管",AbsorberPipePhysicalProperties:"太阳能吸收管的物理性质",AbsorberHeight:"太阳能吸收管的安装高度",AbsorberApertureWidth:"太阳能吸收管的孔径",AbsorberPipePoleNumber:"太阳能吸收管的支柱数量",AbsorberAbsorptance:"太阳能吸收管的吸收率",AbsorberOpticalEfficiency:"太阳能吸收管的光效率",AbsorberThermalEfficiency:"太阳能吸收管的热效率"},solarUpdraftTowerMenu:{SolarUpdraftTower:"太阳能上升气流塔",SolarUpdraftTowerPhysicalProperties:"太阳能上升气流塔的物理性质",SolarUpdraftTowerChimneyHeight:"太阳能上升气流塔烟囱的高度",SolarUpdraftTowerChimneyRadius:"太阳能上升气流塔烟囱的半径",SolarUpdraftTowerCollectorHeight:"太阳能上升气流塔集热棚的高度",SolarUpdraftTowerCollectorRadius:"太阳能上升气流塔集热棚的半径",SolarUpdraftTowerCollectorTransmissivity:"太阳能上升气流塔集热棚的透射率",SolarUpdraftTowerCollectorEmissivity:"太阳能上升气流塔集热棚的发射率",SolarUpdraftTowerDischargeCoefficient:"太阳能上升气流塔的流量系数",SolarUpdraftTowerTurbineEfficiency:"太阳能上升气流塔的涡轮机效率"},batteryStorageMenu:{BatteryStorage:"蓄电池",OnlyThisBatteryStorage:"只这个蓄电池",AllBatteryStoragesAboveSameBase:"同一地基上的蓄电池",AllSelectedBatteryStorages:"所有选中的蓄电池",AllBatteryStorages:"所有蓄电池"},cuboidMenu:{Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",RemoveAllUnlockedSolarPanels:"删除此长方体表面上所有非固定的光伏板",RemoveAllUnlockedSensors:"删除此长方体表面上所有非固定的传感器",RemoveAllUnlockedPolygons:"删除此长方体表面上所有非固定的多边形",RemoveAllUnlockedHumans:"删除此长方体表面上所有非固定的人物",RemoveAllUnlockedTrees:"删除此长方体表面上所有非固定的树木",RemoveAllUnlockedFlowers:"删除此长方体表面上所有非固定的花草",RemoveAllUnlockedLights:"删除此长方体表面上所有非固定的电灯",Racks:"支架",SolarPanels:"光伏板",Lights:"电灯",DoYouReallyWantToRemoveAllLightsOnCuboid:"你确定删除此长方体表面上所有非固定的电灯吗",DoYouReallyWantToRemoveAllSolarPanelsOnCuboid:"你确定删除此长方体表面上所有非固定的光伏板吗",Sensors:"传感器",DoYouReallyWantToRemoveAllSensorsOnCuboid:"你确定删除此长方体表面上所有非固定的传感器吗",Polygons:"多边形",DoYouReallyWantToRemoveAllPolygonsOnCuboid:"你确定删除此长方体表面上所有非固定的多边形吗",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnCuboid:"你确定删除此长方体表面上所有非固定的人物吗",Trees:"树木",DoYouReallyWantToRemoveAllTreesOnCuboid:"你确定删除此长方体表面上所有非固定的树木吗",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnCuboid:"你确定删除此长方体表面上所有非固定的花草吗",OnlyThisCuboid:"只这个长方体",AllCuboidsOnSameSurface:"同一表面上所有的长方体",AllCuboidsAboveSameBase:"同一地基上所有的长方体",AllSelectedCuboids:"所有选中的长方体",AllCuboids:"所有的长方体",OnlyThisSide:"只这个表面",AllSidesOfThisCuboid:"这个长方体所有的侧面",AllSidesOfSelectedCuboids:"所有选中长方体所有的侧面",AllSidesOfAllCuboids:"所有的长方体所有的侧面",AddPolygon:"添加多边形",Stackable:"可堆砌",GroupMaster:"主长方体"},polygonMenu:{Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",TextBox:"文字框",FontOutlineColor:"字体轮廓颜色",FontOutlineWidth:"字体轮廓线宽",FontStrokeColor:"字体描边颜色",FontStrokeWidth:"字体描边线宽",NoOutline:"无轮廓线",Shiny:"光泽",Filled:"填充",FillTexture:"填充材质",FillColor:"填充颜色",Opacity:"遮光度",LineColor:"线条颜色",LineWidth:"线条宽度",LineStyle:"线条样式",SolidLine:"实线",DashedLine:"虚线",DottedLine:"点线",InsertVertexBeforeIndex:"前面插入顶点",InsertVertexAfterIndex:"后面插入顶点",DeleteVertex:"移除顶点",OnlyThisPolygon:"只这个多边形",AllPolygonsOnSurface:"同一表面上所有的多边形",AllPolygonsAboveFoundation:"同一地基上所有的多边形",AllSelectedPolygons:"所有选中的多边形",AllPolygons:"所有的多边形",Layout:"布局",SolarPanelArrayLayout:"光伏板阵列布局",SolarPanelArrayLayoutParametricDesign:"光伏板阵列布局参数化设计",SolarPanelArrayLayoutGenerativeDesign:"光伏板阵列布局生成式设计",SolarPanelArrayModel:"光伏板型号",SolarPanelArrayOrientation:"排列方向",SolarPanelArrayTiltAngle:"倾斜角度",SolarPanelArrayRowWidth:"行宽度",SolarPanelArrayInterRowSpacing:"行间距",SolarPanelArrayRowSpacing:"行间距",SolarPanelArrayRowAxis:"行轴方向",SolarPanelArrayLeftRightRowAxis:"左右方向(相对)",SolarPanelArrayUpDownRowAxis:"上下方向(相对)",SolarPanelArrayEastWestRowAxis:"东西方向(绝对)",SolarPanelArrayNorthSouthRowAxis:"南北方向(绝对)",SolarPanelArrayMargin:"边缘余地",SolarPanelArrayPoleHeight:"支架高度",SolarPanelArrayPoleSpacing:"支柱间隔",SolarPanelArrayTotalYearlyCost:"全年总成本",SolarPanelArrayTotalYearlyRevenue:"全年总收入",SolarPanelArrayTotalYearlyYield:"全年总发电量",SolarPanelArrayMeanYearlyYield:"平均年发电量",SolarPanelArrayYearlyProfit:"全年利润",LayoutNotAcceptedCheckYourParameters:"恕不能采用此布局。请检查您的参数设置。"},optimizationMenu:{Optimization:"优化",Parameters:"参数",Variables:"变量",Constants:"常量",GeneticAlgorithm:"遗传算法",GeneticAlgorithmSettings:"遗传算法设定",ParticleSwarmOptimization:"粒子群优化",ParticleSwarmOptimizationSettings:"粒子群优化设定",SolarPanelTiltAngleOptimization:"光伏板倾斜角度优化",SolarPanelArrayLayout:"光伏板阵列布局",Generation:"世代",Gene:"基因",NormalizedVariables:"标准化变量",Objective:"目标函数",ObjectiveFunctionDailyTotalYield:"当日总产出",ObjectiveFunctionYearlyTotalYield:"全年总产出",ObjectiveFunctionDailyMeanYield:"当日平均产出",ObjectiveFunctionYearlyMeanYield:"全年平均产出",ObjectiveFunctionDailyProfit:"当日利润",ObjectiveFunctionYearlyProfit:"全年利润",GeneticAlgorithmSelectionMethod:"遗传算法选择方法",RouletteWheel:"轮盘制",Tournament:"淘汰制",SearchMethod:"搜索方法",GlobalSearchUniformSelection:"全局搜索均匀取样",LocalSearchRandomOptimization:"局部搜索随机优化",PopulationSize:"种群个体数目",MaximumGenerations:"最大世代数目",SelectionRate:"选择概率",CrossoverRate:"交配概率",MutationRate:"突变概率",Step:"步数",SwarmSize:"粒子数目",MaximumSteps:"最大步数",MaximumVelocity:"最大速度",InertiaWeight:"惯性权重",CognitiveCoefficient:"认知系数",SocialCoefficient:"社会系数",ConvergenceThreshold:"终止条件的收敛阈值",LocalSearchRadius:"局部搜索的半径",RowsPerRackRange:"单个支架上光伏板行数的变化范围",TiltAngleRange:"光伏板倾斜角度的变化范围",InterRowSpacingRange:"光伏板阵列行间距的变化范围",ClickTargetPolygonToActivate:"点击目标多边形激活",ClickTargetFoundationToActivate:"点击目标地基激活"},treeMenu:{ShowModel:"显示近似模型",Flip:"翻转",Type:"树种",Spread:"树冠直径"},flowerMenu:{Flip:"翻转",Type:"品种",Spread:"直径"},peopleMenu:{ChangePerson:"改变人物",Flip:"转身",Observer:"观察者",ViewFromThisPerson:"视角移到此人位置"},lightMenu:{Color:"颜色",Intensity:"亮度",Decay:"衰减",MaximumDistance:"最大距离",Inside:"内部"},solarCollectorMenu:{Coordinates:"坐标",RelativeXCoordinateOfCenter:"中心的相对X坐标",RelativeYCoordinateOfCenter:"中心的相对Y坐标",RelativeAzimuth:"相对方位角",Pole:"支柱",PoleHeight:"支柱高度",PoleRadius:"支柱半径",ExtraPoleHeight:"额外的支柱高度",ExtraPoleHeightInAdditionToHalfWidth:"宽度一半额外的支柱高度",DrawSunBeam:"显示光束"},concentratedSolarPowerCollectorMenu:{ReflectorReflectance:"反射器镜面反射率",ReceiverAbsorptance:"接收器吸收率",ReflectorOpticalEfficiency:"反射器光效率",ReceiverThermalEfficiency:"接收器热效率"},solarWaterHeaterMenu:{OnlyThisSolarWaterHeater:"只这个太阳能热水器",AllSolarWaterHeatersOnSurface:"同一表面上所有的太阳能热水器",AllSolarWaterHeatersAboveFoundation:"同一地基上所有的太阳能热水器",AllSelectedSolarWaterHeaters:"所有选中的太阳能热水器",AllSolarWaterHeaters:"所有的太阳能热水器"},solarPanelMenu:{ElectricalProperties:"电气特性",InverterEfficiency:"逆变器效率",InverterEfficiencyExplained:"直流电转换为交流电的效率。",DcToAcSizeRatio:"直流-交流容量比例",DcToAcSizeRatioExplained:"直流电容量和交流电容量的比例。",ChangePvModel:"改变光伏板型号",Orientation:"排列方向",Portrait:"纵向",Landscape:"橫向",FrameColor:"框架颜色",Panels:"块",PanelsWide:"块光伏板宽",PanelsLong:"块光伏板长",TiltAngle:"倾斜角度",SouthFacingIsPositive:"朝南为正",Tracker:"追日系统",SolarTrackerFollowsSun:"追日系统提高光伏板产出。",PoleSpacing:"支柱间隔",NoTracker:"无追日系统",HorizontalSingleAxisTracker:"水平单轴追日系统",VerticalSingleAxisTracker:"竖直单轴追日系统",AltazimuthDualAxisTracker:"地平双轴追日系统",OnlyThisSolarPanel:"只这个光伏板",AllSolarPanelsOnSurface:"同一表面上所有的光伏板",AllSolarPanelsAboveFoundation:"同一地基上所有的光伏板",AllSelectedSolarPanels:"所有选中的光伏板",AllSolarPanels:"所有的光伏板"},pvModelPanel:{SolarPanelSpecs:"光伏板型号性能",General:"概况",Electrical:"电气",CellCountInXDirection:"X方向电池数目",CellCountInYDirection:"Y方向电池数目",Weight:"重量",Kilogram:"千克",RatedVoltage:"额定电压",RatedCurrent:"额定电流",OpenCircuitVoltage:"开路电压",ShortCircuitCurrent:"短路电流",MaximumRatedPower:"最大额定功率",Model:"型号",PanelSize:"尺寸",Cells:"电池組",CellType:"光伏电池类型",Monocrystalline:"单晶硅",Polycrystalline:"多晶硅",ThinFilm:"薄膜",Bifacial:"双面",PowerBifaciality:"功率双面性因子(背面对正面)",Black:"黑色",Blue:"蓝色",ShadeTolerance:"阴影耐受度",SolarCellEfficiency:"光伏电池效率",NominalOperatingCellTemperature:"名义电池运行温度",TemperatureCoefficientOfPmax:"Pmax温度系数",AddedCustomSolarPanels:"已有",DisplayThisCustomSolarPanel:"展示这个定制光伏板",ExportThisCustomSolarPanel:"输出此定制光伏板",ImportCustomSolarPanelFromClipboard:"从系统剪切板输入定制光伏板数据",CustomSolarPanelExportedToClipboard:"定制光伏板拷贝到剪贴板",DoYouReallyWantToRemoveThisCustomSolarPanel:"你确定删除此定制光伏板",MakeSureThisCustomSolarPanelIsNotUsed:"删除之前请确认此定制光伏板没有被当前文件采用",ThisCustomSolarPanelIsUsed:"此定制光伏板被当前文件采用",DoYouReallyWantToImportCustomSolarPanel:"你确定輸入定制光伏板",ExistingSettingsWillBeOverwritten:"现有的设定将被取代",CannotAddCustomSolarPanel:"无法添加此定制光伏板",CustomSolarPanelMustHaveModelName:"定制光伏板必须要有型号",CustomSolarPanelExists:"当前文件已经定义了此名字的定制光伏板",FailInImportingDataFromClipboard:"从系统剪切板输入数据失败",NoNeedToAddThisCustomSolarPanel:"无需定义此光伏板",SolarPanelModelAlreadyProvidedBySystem:"系统已提供此光伏板"},parabolicTroughMenu:{ModuleLength:"模块长度",Modules:"模块",ModulesLong:"模块长",LatusRectum:"通径",OnlyThisParabolicTrough:"只这个抛物线槽",AllParabolicTroughsAboveFoundation:"同一地基上所有的抛物线槽",AllSelectedParabolicTroughs:"所有选中的抛物线槽",AllParabolicTroughs:"所有的抛物线槽"},fresnelReflectorMenu:{AbsorberPipe:"吸收管",SelectAbsorberToReflectSunlightTo:"选择阳光反射到的吸收管",ModuleLength:"模块长度",Modules:"模块",ModulesLong:"模块长",OnlyThisFresnelReflector:"只这个菲涅耳反射镜",AllFresnelReflectorsAboveFoundation:"同一地基上所有的菲涅耳反射镜",AllSelectedFresnelReflectors:"所有选中的菲涅耳反射镜",AllFresnelReflectors:"所有的菲涅耳反射镜"},heliostatMenu:{Tower:"吸收塔",SelectTowerToReflectSunlightTo:"选择阳光反射到的吸收塔",OnlyThisHeliostat:"只这个定日镜",AllHeliostatsAboveFoundation:"同一地基上所有的定日镜",AllSelectedHeliostats:"所有选中的定日镜",AllHeliostats:"所有的定日镜"},parabolicDishMenu:{ReceiverStructure:"接收器结构",CentralPole:"中心直柱",CentralPoleWithTripod:"三脚架和中心直柱",Quadrupod:"四脚架",RimDiameter:"外圈直径",LatusRectum:"通径",ExtraPoleHeightInAdditionToRadius:"半径之外额外的支架高度",OnlyThisParabolicDish:"只这个抛物线碟",AllParabolicDishesAboveFoundation:"同一地基上所有的抛物线碟",AllSelectedParabolicDishes:"所有选中的抛物线碟",AllParabolicDishes:"所有的抛物线碟"},windTurbineMenu:{BirdSafeDesign:"鸟类安全设计",BirdSafeNone:"无",BirdSafeBicolor:"双色",BirdSafeStriped:"条纹",Rotor:"转子",BladeNumber:"叶片数目",RotorInitialAngle:"转子初始角度",RotorBladeDesign:"转子叶片设计",RotorBladeRadius:"转子叶片半径",RotorBladePitchAngle:"转子叶片俯仰角",RelativeYawAngle:"相对偏流角",MaximumChordLength:"最大弦长度",Tower:"塔架",TowerHeight:"塔架高度",TowerRadius:"塔架半径",HubDesign:"转子轮毂设计",HubRadius:"轮毂半径",HubLength:"轮毂长度",OnlyThisWindTurbine:"只这个风力涡轮机",AllWindTurbinesAboveFoundation:"同一地基上所有的风力涡轮机",AllSelectedWindTurbines:"所有选中的风力涡轮机",AllWindTurbines:"所有的风力涡轮机"},wallMenu:{TextureDefault:"默认材质",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",SizeOfWall:"墙的尺寸",OnlyThisWall:"只这堵墙",AllConnectedWalls:"所有连接的墙",AllWallsAboveFoundation:"同一地基上所有的墙",AllSelectedWalls:"所有选中的墙",AllWalls:"所有的墙",Windows:"窗户",LockAllUnlockedWindows:"固定所有非固定的窗户",UnlockAllLockedWindows:"解除所有的窗户固定",RemoveAllUnlockedWindows:"删除这堵墙上所有非固定的窗户",DoYouReallyWantToRemoveAllWindowsOnThisWall:"你确定删除这堵墙上所有非固定的窗户吗",Doors:"门",LockAllUnlockedDoors:"固定所有非固定的门",UnlockAllLockedDoors:"解除所有的门固定",RemoveAllUnlockedDoors:"删除这堵墙上所有非固定的门",DoYouReallyWantToRemoveAllDoorsOnThisWall:"你确定删除这堵墙上所有非固定的门吗",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"删除这堵墙上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisWall:"你确定删除这堵墙上所有非固定的光伏板吗",Sensors:"传感器",LockAllUnlockedSensors:"固定所有非固定的传感器",UnlockAllLockedSensors:"解除所有的传感器固定",RemoveAllUnlockedSensors:"删除这堵墙上所有非固定的传感器",DoYouReallyWantToRemoveAllSensorsOnThisWall:"你确定删除这堵墙上所有非固定的传感器吗",Lights:"电灯",LockAllUnlockedLights:"固定这堵墙上所有非固定的电灯",UnlockAllLockedLights:"解除这堵墙上所有的电灯固定",RemoveAllUnlockedLights:"删除这堵墙上所有非固定的电灯",DoYouReallyWantToRemoveAllLightsOnThisWall:"你确定删除这堵墙上所有非固定的电灯吗",Polygons:"多边形",LockAllUnlockedPolygons:"固定这堵墙上所有非固定的多边形",UnlockAllLockedPolygons:"解除这堵墙上所有的多边形固定",RemoveAllUnlockedPolygons:"删除这堵墙上所有非固定的多边形",DoYouReallyWantToRemoveAllPolygonsOnThisWall:"你确定删除这堵墙上所有非固定的多边形吗",WallStructure:"墙结构",DefaultStructure:"默认",StudStructure:"墙柱",PillarStructure:"圆柱",Opacity:"遮光度",StructureSpacing:"结构间距",StructureWidth:"结构宽度",StructureThickness:"结构厚度",StructureColor:"结构颜色",Color:"牆体颜色",Height:"高度",Thickness:"厚度",Texture:"材质",AllLightsOnWallInside:"所有电灯在牆内",AllLightsOnWallOutside:"所有电灯在牆外",Fill:"填充",Full:"全部",Partial:"部分",Empty:"空白",OpenToOutside:"对外面开放",EavesLength:"屋檐延伸长度",Parapet:"女墙",ParapetColor:"女墙颜色",ParapetTexture:"女墙材质",ParapetHeight:"女墙高度",CopingsHeight:"顶盖高度",CopingsWidth:"顶盖宽度"},windowMenu:{OnlyThisWindow:"只这个窗户",AllWindowsOnSurface:"同一表面上所有的窗户",AllWindowsAboveFoundation:"同一地基上所有的窗户",AllSelectedWindows:"所有选中的窗户",AllWindows:"所有的窗户",Width:"宽度",Height:"高度",Setback:"离墙体外表面的距离",RelativeToWallThickness:"相对于墙的厚度",Mullion:"直棂",HorizontalMullion:"水平的直棂",VerticalMullion:"竖直的直棂",MullionWidth:"直棂宽度",HorizontalMullionSpacing:"水平直棂的间距",VerticalMullionSpacing:"竖直直棂的间距",MullionColor:"直棂颜色",Tint:"着色",Opacity:"不透明度",SolarHeatGainCoefficient:"太阳辐射热获取系数(SHGC) = 1 - 不透明度",Shutter:"百叶窗",LeftShutter:"左侧百叶窗",RightShutter:"右侧百叶窗",BothShutters:"两侧百叶窗",ShutterWidth:"相对宽度",ShutterColor:"百叶窗颜色",Frame:"边框",FrameWidth:"边框宽度",SillWidth:"窗台宽度",Color:"边框颜色",WindowType:"窗户种类",Default:"默认",Arched:"拱形",Polygonal:"多边形",Interior:"内窗",Empty:"空白"},roofMenu:{TextureDefault:"默认材质",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",OnlyThisRoof:"只这个屋顶",AllRoofsAboveFoundation:"同一地基上所有的屋顶",AllSelectedRoofs:"所有选中的屋顶",AllRoofs:"所有的屋顶",OnlyThisCeiling:"只这个天花板",AllCeilingsAboveFoundation:"同一地基上所有的天花板",AllCeilings:"所有的天花板",EavesOverhangLength:"屋檐延伸长度",RafterSpacing:"屋椽间距",RafterWidth:"屋椽宽度",RafterThickness:"屋椽厚度",RafterColor:"屋椽颜色",RoofColor:"屋顶颜色",RoofSideColor:"屋顶侧面颜色",GlassTint:"玻璃颜色",Opacity:"遮光度",RoofStructure:"屋顶结构",DefaultStructure:"默认",RafterStructure:"屋椽",GlassStructure:"玻璃",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"删除这个屋顶上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof:"你确定删除这个屋顶上所有非固定的光伏板吗",Windows:"天窗",LockAllUnlockedWindows:"固定所有非固定的天窗",UnlockAllLockedWindows:"解除所有的天窗固定",RemoveAllUnlockedWindows:"删除这个屋顶上所有非固定的天窗",DoYouReallyWantToRemoveAllWindowsOnThisRoof:"你确定删除这个屋顶上所有非固定的天窗吗",Sensors:"传感器",LockAllUnlockedSensors:"固定所有非固定的传感器",UnlockAllLockedSensors:"解除所有的传感器固定",RemoveAllUnlockedSensors:"删除这个屋顶上所有非固定的传感器",DoYouReallyWantToRemoveAllSensorsOnThisRoof:"你确定删除这个屋顶上所有非固定的传感器吗",Lights:"电灯",RemoveAllUnlockedLights:"删除这个屋顶上所有非固定的电灯",DoYouReallyWantToRemoveAllLightsOnThisRoof:"你确定删除这个屋顶上所有非固定的电灯吗",AllLightsOnRoofInside:"所有电灯在屋顶内",AllLightsOnRoofOutside:"所有电灯在屋顶外",Rise:"相对高度",Ceiling:"天花板",RoofRValue:"屋顶R值",CeilingRValue:"天花板R值"},doorMenu:{TextureDefault:"默认材质",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",Texture11:"十一号材质",Texture12:"十二号材质",Texture13:"十三号材质",Texture14:"十四号材质",Texture15:"十五号材质",Texture16:"十六号材质",Texture17:"十七号材质",OnlyThisDoor:"只这个门",AllDoorsOnWall:"同一面墙上所有的门",AllDoorsAboveFoundation:"同一地基上所有的门",AllSelectedDoors:"所有选中的门",AllDoors:"所有的门",DoorType:"门种类",Default:"默认",Arched:"拱形",Filled:"填充",FrameColor:"门框颜色",Interior:"内门"},siteInfoPanel:{High:"最高温度",Low:"最低温度"},designInfoPanel:{NumberOfSelectedHeliostats:"选中的定日镜总数",NumberOfSelectedSolarPanels:"选中的光伏板总数",ElectricityGeneratedDailyBySolarPanels:"这些光伏板的日发电量",SceneDiameter:"场景直径",BuildingArea:"建筑面积"},visualizationControlPanel:{ColorContrast:"热图颜色对比度",FluxScale:"热通量长度",ClickUpOrDownArrowButtonsToChange:"点击上下箭头改变参数"},instructionPanel:{Rotate:"旋转",DragMouse:"拖动鼠标",Zoom:"缩放",MouseWheelOrKeys:"鼠标滚轮或者Ctrl+[和Ctrl+]",MouseWheelOrKeysMac:"鼠标滚轮或者⌘+[和⌘+]",Pan:"平移",HoldCtrlDragMouse:"按下Ctrl键并拖动鼠标",HoldMetaDragMouse:"按下⌘键并拖动鼠标",Enter2DMode:"進入二维模式",Exit2DMode:"退出二维模式",NavigationMode:"导航模式",EnableNavigation:"進入导航模式",DisableNavigation:"退出导航模式",MoveForwardBack:"前后移动",MoveForwardBackInstruction:"按W/S键",MoveLeftRight:"左右移动",MoveLeftRightInstruction:"按A/D键",MoveUpDown:"上下移动",MoveUpDownInstruction:"按Z/X键",Turn:"拐弯",TurnInstruction:"按方向键",ResetView:"重置视角",AutoRotate:"自动旋转",StartOrStop:"按F4键启动或停止"},mapPanel:{ImageOnGround:"地面显示图像",HideAddress:"隐藏地址",WeatherStations:"气象站",WeatherStationsNote:"关闭此选项以提高地图速度",Coordinates:"经纬度坐标",Zoom:"放大程度"},visibilityPanel:{SolarPanelVisibility:"光伏板对观察者的可见度",Observer:"观察者",VantagePoint:"观察位置",ItemizedVisibilityByFields:"每个场的可见度",TotalVisibility:"总可见度"},sensorPanel:{LightSensor:"光传感器",WeatherDataFrom:"气象数据来自"},buildingEnergyPanel:{DailyBuildingEnergy:"建筑物日能耗",YearlyBuildingEnergy:"建筑物年能耗",Heater:"暖气",AC:"空调",SolarPanel:"光伏",Net:"净能耗"},solarPanelYieldPanel:{SolarPanelDailyYield:"光伏日发电量",SolarPanelYearlyYield:"光伏年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualSolarPanels:"显示每行光伏板单独发电量",Profit:"利润",TotalCost:"总成本",TotalRevenue:"总收入",TotalYield:"总发电量",MeanYield:"平均发电量",ModuleCount:"光伏板总数"},parabolicTroughYieldPanel:{ParabolicTroughDailyYield:"抛物线槽日发电量",ParabolicTroughYearlyYield:"抛物线槽年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualParabolicTroughs:"显示每行抛物线槽单独发电量"},parabolicDishYieldPanel:{ParabolicDishDailyYield:"抛物线碟日发电量",ParabolicDishYearlyYield:"抛物线碟年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualParabolicDishes:"显示每个抛物线碟单独发电量"},fresnelReflectorYieldPanel:{FresnelReflectorDailyYield:"菲涅耳反射镜日发电量",FresnelReflectorYearlyYield:"菲涅耳反射镜年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualFresnelReflectors:"显示每个菲涅耳反射镜单独发电量"},heliostatYieldPanel:{HeliostatDailyYield:"定日镜日发电量",HeliostatYearlyYield:"定日镜年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualHeliostats:"显示每个定日镜单独发电量"},updraftTowerYieldPanel:{UpdraftTowerDailyYield:"太阳能上升气流塔日发电量",UpdraftTowerYearlyYield:"太阳能上升气流塔年发电量",ChimneyAirTemperature:"烟囱空气温度",ChimneyWindSpeed:"烟囱风速",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualUpdraftTowers:"显示每个太阳能上升气流塔单独发电量"},heliodonPanel:{SunAndTimeSettings:"太阳和时间设置",SunAngles:"角度",TwentyFourHours:"24小时"},cloudFilePanel:{CopyTitle:"拷贝标题",TitleCopiedToClipBoard:"标题拷贝到剪贴板",SearchByTitle:"按标题搜索",MyLikes:"我喜欢的模型",MyCloudFiles:"我的云文件",GenerateLink:"生成链接",LinkGeneratedInClipBoard:"链接生成到剪贴板",DoYouReallyWantToDelete:"您确定删除此文件",IfSharedOrPublishedRenamingFileBreaksExistingLinks:"如果此文件已被分享或发布, 改名会使已有链接失效"},projectListPanel:{CopyTitle:"拷贝标题",TitleCopiedToClipBoard:"标题拷贝到剪贴板",SearchByTitle:"按标题搜索",MyProjects:"我的项目",GenerateProjectLink:"生成项目链接",ProjectLinkGeneratedInClipBoard:"项目链接生成到剪贴板",DoYouReallyWantToDeleteProject:"您确定删除项目",IfSharedOrPublishedRenamingProjectBreaksExistingLinks:"如果此项目已被分享或发布, 改名会使已有链接失效"},projectPanel:{ProjectSettings:"项目设定",ThumbnailImageSize:"缩略图大小",ProjectByOtherPeople:"别人的项目",Project:"项目",ProjectType:"类别",ProjectDescription:"描述",MakeDescriptionEditable:"编辑描述",MakeDescriptionNonEditable:"不编辑描述",DoubleClickToMakeDescriptionEditable:"双击此描述激活编辑功能",SolarPanelArray:"光伏板阵列设计",CurateCurrentDesign:"收藏当前设计",UpdateSelectedDesign:"更新选中设计",RemoveSelectedDesign:"删除选中设计",ClickToFlipSortingOrder:"点击逆转排序方向",DesignNotShownInSolutionSpaceClickToShow:"此设计目前不显示在设计空间内,点击显示",DesignShownInSolutionSpaceClickToHide:"此设计目前显示在设计空间内,点击隐藏",SolutionSpace:"设计空间",ChooseSolutionSpace:"选择设计空间",ChooseDataColoring:"选择数据着色",SameColorForAllDesigns:"所有设计一个颜色",OneColorForEachDesign:"每个设计一个颜色",SolutionSpaceScreenshot:"设计空间截屏",ScatterPlotScreenshot:"散点图截屏",SingleClickToSelectDoubleClickToOpen:"单击选择,双击打开。",SingleClickToDeselectDoubleClickToOpen:"单击取消选择,双击打开。",GenerateScatterPlot:"生成散点图",SelectXAxis:"选择X轴",SelectYAxis:"选择Y轴"},accountSettingsPanel:{MyAccountSettings:"我的账户设定",MyID:"我的🆔",ClickToCopyMyID:"点击此处拷贝我的ID",IDInClipBoard:"您现在可以粘贴ID了。",StoreMyNameInMyFilesWhenSaving:"保存文件时签上我的大名",DoYouReallyWantToShowYourNameInYourFiles:"您确定在您的文件里保存您的大名吗?",SignFileDisclaimer:"如果您选择保存,您的大名可能被所有打开您的文件的人看到。",Likes:"点赞总数",AllPublished:"发布总数",PublishedUnderAliases:"别名发布",UserCount:"用户总数",SchoolID:"学校编号",ClassID:"班级编号"},weatherPanel:{SunshineHours:"日照时间"},diurnalTemperaturePanel:{SelectAirTemperatureModel:"选择气温模型",Sinusoidal:"正弦函数"},economicsPanel:{EconomicsParameters:"经济学参数",ElectricitySellingPrice:"销售电价",OperationalCostPerUnit:"单位运行成本",SellingPrice:"销售电价",UnitCost:"单位成本"},navigationPanel:{NavigationParameters:"导航模式参数",MinimumMoveSpeed:"最小移动速度",MinimumTurnSpeed:"最小拐弯速度"},shadowSettingsPanel:{ShadowSettings:"阴影设定",ShadowCameraFarDistance:"最远距离",ShadowMapSize:"映射图长宽",Notes:"注意事项",RefreshPageNote:"改变设置后须刷新页面。",MapSizeWarning:"大的映射图长宽可能导致阿拉丁无法在某些电脑上运行。"},yearlyLightSensorPanel:{SkyClearness:"天空清晰度",ShowDaylightResults:"显示日照时间结果",ShowSkyClearnessResults:"显示天空清晰度结果",ShowAverageDailySolarRadiation:"显示日平均辐射结果"},analysisManager:{NoSensorForCollectingData:"没有传感器收集数据。",NoSolarPanelForAnalysis:"没有光伏板可以分析。",NoObserverForVisibilityAnalysis:"没有找到可见度分析的观察者。",NoSolarWaterHeaterForAnalysis:"沒有太阳能热水器可以分析。",NoParabolicDishForAnalysis:"沒有抛物线碟可以分析。",NoParabolicTroughForAnalysis:"沒有抛物线槽可以分析。",NoFresnelReflectorForAnalysis:"沒有菲涅耳反射镜可以分析。",NoHeliostatForAnalysis:"沒有定日镜可以分析。",NoSolarUpdraftTowerForAnalysis:"沒有太阳能上升气流塔可以分析。",NoBuildingForAnalysis:"沒有建筑物可以分析。"},toolbar:{CloudFile:"云文件",Select:"选择",AddFoundation:"添加地基",AddWall:"添加墙体",AddWindow:"添加窗户",AddDoor:"添加门",AddPyramidRoof:"添加金字塔屋顶",AddGableRoof:"添加双坡屋顶",AddHipRoof:"添加四坡屋顶",AddGambrelRoof:"添加复斜屋顶",AddMansardRoof:"添加折线屋顶",AddCuboid:"添加长方体",AddSensor:"添加传感器",AddSolarPanel:"添加光伏板",AddSolarWaterHeater:"添加太阳能热水器",AddBatteryStorage:"添加储蓄电池",AddParabolicDish:"添加抛物线碟",AddParabolicTrough:"添加抛物线槽",AddFresnelReflector:"添加菲涅耳反射镜",AddHeliostat:"添加定日镜",AddWindTurbine:"添加水平轴风力涡轮机",AddVerticalAxisWindTurbine:"添加垂直轴风力涡轮机",AddLight:"添加电灯",AddTree:"添加树木",AddFlower:"添加花草",AddPeople:"添加人物",DoubleClickToLockThisModeForNextAction:"双击按钮给下个动作锁定此模式",ClickToUnlockThisModeForNextAction:"点击按钮让动作完成即离开此模式",ManipulateGroup:"整体操作一个组",ClearScene:"清空场景",ShowSunAndTimeSettings:"显示太阳和时间设置",SpatialAnalysisOfEnergy:"能量的空间分析",DoYouReallyWantToClearContent:"您确定清空场景吗",ClickForMoreButtons:"点击此处切换到更多的按钮模式"},tooltip:{gotoIFI:"访问未来智能研究所",visitAladdinHomePage:"访问阿拉丁主页",clickToOpenMenu:"点击打开主菜单",clickToAccessAccountSettings:"点击打开账号设定"},tree:{Apple:"苹果树",Birch:"白桦",Coconut:"椰子树",Dogwood:"茱萸",Elm:"榆树",FanPalm:"扇叶棕榈",Linden:"菩提",Magnolia:"玉兰",Maple:"枫树",Oak:"橡树",Pine:"松树",Spruce:"云杉"},flower:{Bellflower:"铃兰",Boxwood:"黄杨",CactusCombo1:"仙人掌组合一",CactusCombo2:"仙人掌组合二",CactusCombo3:"仙人掌组合三",CactusCombo4:"仙人掌组合四",Hibiscus:"木槿",Hosta:"玉簪",Hydrangea:"绣球花",Peony:"牡丹",RedRose:"红玫瑰",Spirea:"绣线菊",Sunflower:"向日葵",TallBush:"高灌木",Tulip:"郁金香",WhiteFlower:"白花",YellowFlower:"黄花"},people:{Jaah:"贾阿",Jack:"杰克",Jacob:"雅各布",Jacqueline:"杰奎琳",Jade:"美玉",Jamelia:"洁米莉雅",James:"詹姆斯",Jane:"简",Jaya:"佳娅",Jaye:"杰伊",Jeanette:"珍妮特",Jedi:"杰迪",Jeff:"杰夫",Jena:"珍娜",Jennifer:"珍尼弗",Jess:"杰西",Jett:"杰特",Jill:"吉尔",Jiya:"吉娅",Joan:"琼",Jocelyn:"乔斯林",Joel:"乔尔",Joey:"乔伊",John:"约翰",Jonathon:"乔纳森",Jose:"何塞",Joseph:"约瑟夫",Joshua:"约书亚",Judd:"贾德",Judy:"朱蒂",Julia:"朱莉娅",Julio:"胡里奥",Jumapili:"祖玛匹莉",June:"准卫",Juro:"朱诺",Justin:"贾斯汀"},compass:{N:"北",S:"南",W:"西",E:"东"},month:{January:"一月",February:"二月",March:"三月",April:"四月",May:"五月",June:"六月",July:"七月",August:"八月",September:"九月",October:"十月",November:"十一月",December:"十二月"},modelsMap:{AllTime:"全部时间",SearchByPublisher:"按发布者搜索",SearchByLabel:"按标签搜索",MyPublishedModels:"我发布的模型",TotalNumberOfUserPublishedModelsInSelectedPeriod:"选定时间段用户发布的模型总数",AllTimeTotal:"全部时间用户发布的模型总数",SortFromOldestToNewest:"从早到晚排序",SortFromNewestToOldest:"从晚到早排序",SitesFound:"个位置",ModelsFoundOnThisSite:"个模型在此位置",ShowModelsPublishedByThisAuthor:"展示此用户发布的模型"},modelTree:{Human:"人物",Flower:"花草",Tree:"树木",Foundation:"地基",Wall:"墙体",Roof:"屋顶",Window:"窗户",SkylightWindow:"天窗",Door:"门",SolarWaterHeater:"太阳能热水器",RooftopSolarPanels:"屋顶光伏板",WallMountedSolarPanels:"壁挂光伏板",GroundMountedSolarPanels:"地面安装的光伏板",Sensor:"传感器",Light:"电灯"}}},U5t={translation:{name:{IFI:"未來智能研究所",Aladdin:"阿拉丁",Tagline:"阿拉丁: 探索人工智慧時代的設計軟體 — 未來智能研究所研發"},cookie:{Statement:"聲明:為了改善您的用戶體驗,阿拉丁採用cookie儲存少量數據。",Accept:"同意"},aboutUs:{ProductBroughtToYouBy:"未來智能研究所榮譽出品",TermsOfService:"服務條款",PrivacyPolicy:"隱私政策",Software:"軟體",Content:"課件",Research:"研究",Support:"服務",Acknowledgment:"鳴謝",FundingInformation:"本產品的研發承蒙美國國家科學基金會慷慨資助(項目號#2105695,#2131097,#2301164)。本產品的任何觀點或結論僅代表創作者個人意見。",Contact:"如您需要更多資訊,請聯繫 Charles Xie (charles@intofuture.org)。我們會盡快回复。",Translators:"翻譯"},word:{Mute:"勿擾",BrandName:"品牌",Name:"名字",Refresh:"刷新",LastUpdate:"上一次更新",Small:"小",Medium:"中",Large:"大",Design:"設計",Information:"資訊",Type:"類别",Text:"文字",FontSize:"字體大小",FontColor:"字體顏色",Model:"模型",Models:"模型",Upload:"上傳",ClickCount:"點擊數",Share:"分享",AlreadyLike:"已點贊",Like:"點贊",MustLogInToLike:"必須登錄才能點贊",AllRightsReserved:"版權所有",MeterAbbreviation:"米",VoltAbbreviation:"伏",AmpereAbbreviation:"安",WattAbbreviation:"瓦",Version:"版本",VersionInitial:"版本",Options:"選項",Maximum:"最大",Minimum:"最小",MaximumNumber:"最多",MinimumNumber:"最少",MaximumValue:"最大值",MinimumValue:"最小值",Or:"或",None:"無",High:"高",Partial:"部分",Teacher:"老師",Class:"班級",Total:"總數",Leaderboard:"用戶排行榜",Latest:"最新",Range:"範圍",SIUnit:"國際單位制",USUnit:"美國單位制",ThermalTransmittance:"熱透過率",ThermalResistance:"熱阻",UValue:"U值",RValue:"R值",VolumetricHeatCapacity:"容積熱容",Press:"按",Open:"打開",Save:"保存",SaveAsImage:"保存為圖像",SaveAsCsv:"保存為CSV",Update:"刷新",Paste:"粘貼",Copy:"複製",Cut:"剪切",Delete:"删除",Add:"添加",Lock:"固定",Translucent:"半透明",Transparency:"透明度",Color:"顏色",Pattern:"圖案",Texture:"材質",Thickness:"厚度",Size:"尺寸",Yes:"是",No:"不",NoAndDoNotAskAgain:"不,別再問",OK:"確定",Cancel:"取消",Apply:"應用",Close:"關閉",ApplyTo:"適用於",Run:"運行",Pause:"暫停",Resume:"繼續",Clear:"清空",Warning:"警告",Caution:"小心",Reminder:"提醒",Length:"長度",Width:"寬度",Height:"高度",Radius:"半徑",Angle:"角度",Azimuth:"方位角",Coordinates:"坐標",Weather:"天氣",Show:"顯示",Animate:"動畫",Date:"日期",Time:"時間",Title:"標題",Owner:"所有者",Action:"操作",Rename:"改名",Location:"位置",Latitude:"緯度",Month:"月份",Day:"天",Hour:"小時",Daylight:"白天長度",Radiation:"輻射",Temperature:"温度",kWh:"千瓦時",dollar:"元",MeterPerSecond:"米/秒",NorthInitial:"北",SouthInitial:"南",EastInitial:"東",WestInitial:"西",Fixed:"固定",Elements:"部件",Energy:"能量",Unknown:"未知",Label:"標籤",Description:"描述",NoDescription:"無描述",MaximumCharacters:"最多字符數",Author:"作者",Publisher:"發布者",Building:"建築",ResidentialBuilding:"住宅建築",CommercialBuilding:"商用建築",SchoolBuilding:"學校建築",TouristAttraction:"旅遊景點",UnderConstruction:"在建",Photovoltaic:"光伏",WindPower:"風能",ColocationProjects:"共用空間專案",Anonymous:"無名氏",Nickname:"别名",Pin:"置頂",Unpin:"解除置頂"},shared:{NoTexture:"無材質",FoundationElement:"地基",CuboidElement:"長方體",PolygonElement:"多邊形",SensorElement:"傳感器",SolarPanelElement:"光伏板",SolarWaterHeaterElement:"太陽能熱水器",ParabolicDishElement:"拋物線碟",ParabolicTroughElement:"拋物線槽",FresnelReflectorElement:"菲涅耳反射鏡",HeliostatElement:"定日鏡",WindTurbineElement:"風力渦輪機",LightElement:"電燈",ElementLocked:"固定",ModelType:"模型類别",OutputBreakdown:"分列發電量",MoreResults:"更多結果"},message:{DoNotShowAgain:"別再顯示",NewVersionAvailable:"有新版本",CalculationMayBeSlowDoYouWantToContinue:"計算可能會很慢。您想繼續嗎?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"加大太陽輻射熱圖網格的尺寸可加速",ModelNotFound:"沒有找到模型",CannotSignIn:"登錄失敗",CannotSignOut:"退出失敗",YourAccountWasCreated:"成功建立您的賬號。",CannotCreateAccount:"無法創建賬號",YourAccountSettingsWereSaved:"您的賬號設定已保存。",CannotSaveYourAccountSettings:"您的賬號設定無法保存",CannotSaveYourFileToCloud:"無法保存您的文檔到雲端",CannotCreateNewProject:"無法創建新專案",CannotCreateNewProjectWithoutTitle:"沒有標題, 無法創建新專案",CannotOpenYourProjects:"無法打開您的專案列表",CannotOpenProject:"無法打開專案",CannotDeleteProject:"無法刪除專案",CannotRenameProject:"無法給專案改名",CannotAddDesignToProject:"無法把此設計加到專案裡",CannotAddDesignToProjectOwnedByOthers:"不能把此設計加到別人的專案裡",DesignRemovedFromProject:"設計被成功地從專案裡刪除",CannotRemoveDesignFromProject:"無法把此設計從專案裡刪除",CannotUpdateProject:"無法更新專案",CannotFetchProjectData:"無法取得專案數據",TitleUsedChooseDifferentOne:"此標題已經被使用, 請採用不同的標題",CloudFileWithTitleExistsDoYouWantToOverwrite:"使用此標題的雲文檔已經存在,您確定要覆蓋它嗎?",CloudFileNotFound:"找不到此云端文檔",CannotLoadModelsOnMap:"無法下載地圖上的模型",CannotLoadLeaderboard:"無法下載排行榜",CannotPublishModelOnMap:"模型無法發佈到地圖上",CannotLikeModelFromMap:"無法點贊地圖上的模型",CannotDeleteModelFromMap:"無法删除地圖上的模型",ModelDeletedFromMap:"模型已從地圖上刪除",DoYouWantToDeleteModelFromMap:"您要删除地圖上的這個模型嗎?",CannotOpenCloudFile:"此云端文檔無法打開",CannotReadCloudFile:"無法讀取此云端文檔",CannotWriteCloudFile:"無法存儲此云端文檔",CloudFileCopied:"拷貝云端文檔",CannotOpenCloudFolder:"您的雲端文檔夾無法打開",CannotDeleteCloudFile:"無法刪除此云端文檔",CannotRenameCloudFile:"此云端文檔的名字無法更改",DoYouWantToSaveChanges:"您要保存當前文檔嗎?",DoYouWantToUpdateDesign:"您要更新選中設計嗎?",NotApplicableToSelectedAction:"此值不適用於當前選擇範圍",ThisElementIsLocked:"這個部件被鎖定。",ThisCannotBeUndone:"這個操作一旦執行就不能撤銷。",AzimuthOfNorthIsZero:"正北的方位角為零度",CounterclockwiseAzimuthIsPositive:"逆時針為正",SouthFacingIsZero:"朝南為零度",ClockwiseRotationIsPositive:"順時針為正",MoveCancelledBecauseOfOverlap:"位置重疊,移動取消。",MoveOutsideBoundaryCancelled:"位置出界,移動取消。",RotationCancelledBecauseOfOverlap:"位置重疊,旋轉取消。",RotationOutsideBoundaryCancelled:"位置出界,旋轉取消。",ResizingCancelledBecauseOfOverlap:"位置重疊,尺寸調整取消。",ResizingOutsideBoundaryCancelled:"位置出界,尺寸調整取消。",CannotPasteOutsideBoundary:"位置出界,不能複制。",CannotPasteBecauseOfOverlap:"位置重疊,不能複制。",CannotMoveObjectTooFar:"位置太遠,移動取消。",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"採用新佈局之前必須移除現有的光伏板。",DoYouWantToContinue:"您想繼續嗎?",SolarPanelsCannotIntersectWithGround:"光伏板不能和地面接觸。",SolarPanelsCannotOverlapWithOneAnother:"光伏板不能重疊。",ScreenshotSaved:"截屏圖片保存在下載文檔夾裡。",CsvFileSaved:"CSV保存在下載文檔夾裡。",SimulationStarted:"模擬開始。",SimulationCompleted:"模擬結束。",SimulationAborted:"模擬取消。",SimulationPaused:"模擬暫停。",CancelSimulation:"取消模擬",PauseSimulation:"暫停模擬",ResumeSimulation:"繼續模擬",SimulationWillNotStartDueToErrors:"由於錯誤模擬無法運行",SimulationWillStartDespiteWarnings:"發現問題,但模擬仍然將運行。",EvolutionStarted:"演化開始。",EvolutionCompleted:"演化結束。",EvolutionAborted:"演化取消。",EvolutionPaused:"演化暫停。",EncounterEvolutionError:"演化出錯。",CancelEvolution:"取消演化",PauseEvolution:"暫停演化",ResumeEvolution:"繼續演化",ConvergenceThresholdHasBeenReached:"收斂閾值已達到。",MaximumNumberOfGenerationsHasBeenReached:"最大世代數已達到。",MaximumNumberOfStepsHasBeenReached:"最大步數已達到。",ObjectiveFunctionTypeError:"此操作不支持當前的目標函數。請從菜單啟動此功能。",WallsAreNotAtSameHeight:"墻體高度不同。",WallsAreNotPerpendicular:"墻體不垂直。",WallsAreNotConnected:"墻體不相連。",WallsNumberNeedToBeFour:"墻體數量必須為四個。",BuildingContainsEmptyWall:"建築物有空牆。",BuildingRoofMissing:"建築物沒有屋頂。",UnknownErrors:"未知錯誤。",SigningOutAnonymousAccount:"你確定退出嗎?一旦退出,此匿名帳號將不可恢復。",SigningInAnonymousAccount:"你確定匿名登入嗎?一旦退出,匿名帳號將無法恢復。匿名登入主要是為無法實名登入的使用者提供臨時方便。"},menu:{AnalysisOptions:"分析選項",option:{GridCellSize:"計算網格的尺寸",SamplingFrequency:"採樣頻率",TimesPerHour:"每小時採樣次數",DaysPerYear:"每一年採樣天數"},mainMenu:"主菜單",cloudMenu:"雲菜單",projectSubMenu:"專案",project:{CreateNewProject:"創建新專案",OpenProject:"打開專案",SaveProject:"保存專案",SaveProjectAs:"另存專案為",YouMustLogInToCreateProject:"您必須登錄才能創建專案",YouMustLogInToOpenProject:"您必須登錄才能打開專案"},fileSubMenu:"文檔",file:{CreateNewFile:"創建新文檔",OpenLocalFile:"打開本地文檔",SaveAsLocalFile:"保存為本地文檔",SavingAbortedMustHaveValidFileName:"文檔名無效,保存失敗",OpenCloudFile:"打開雲端文檔",SaveCloudFile:"保存雲端文檔",SaveAsCloudFile:"另存雲端文檔為",SavingAbortedMustHaveValidTitle:"雲端文檔名無效,保存失敗",ToSaveYourWorkPleaseSignIn:"為了保存您的雲端文檔,請先登錄。",TakeScreenshot:"截屏",UseCloudFileName:"採用雲端文檔名",PublishOnModelsMap:"發佈到地圖上",PublishedOnModelsMap:"您的模型成功發佈到地圖上",UpdatedOnModelsMap:"您的模型更新成功",YouMustLogInToPublishYourModel:"您必須登錄才能發布模型",YouCannotPublishAModelThatYouDoNotOwn:"您不能發布他人的模型",YouMustSaveModelOnCloudBeforePublishingIt:"您必須先把此模型保存在雲端才能發布它"},editSubMenu:"編輯",edit:{Undo:"撤銷",Redo:"重做",Undone:"已撤銷"},viewSubMenu:"視界",view:{ModelTree:"模型樹圖",NavigationView:"導航模式",TwoDimensionalView:"二維模式",ResetView:"重置視角",ZoomIn:"放大",ZoomOut:"縮小",AutoRotate:"自動旋轉",ShowShadow:"顯示陰影",ShowSurfaceShininess:"顯示表面光澤",TranslucentFloatingWindows:"透明浮動窗口",accessoriesSubMenu:"配件",accessories:{SiteInformation:"位置資訊",DesignInformation:"設計資訊",Instruction:"操作說明",StickyNote:"便簽",Note:"便簽"}},settingsSubMenu:"設置",settings:{WeatherData:"氣象數據",DiurnalTemperature:"晝夜溫度",Heliodon:"日影儀",SunAndTime:"太陽和時間",CustomSolarPanels:"客製化的光伏板",CustomizeSolarPanel:"客製化光伏板"},benchmarksSubMenu:"基準",benchmarks:{SolarRadiationPredictionVsMeasurement:"太陽能輻射模型預測和實際測量的對比",BESTESTCase600:"建築物能耗模擬測試:BESTEST案例600",BESTESTCase610:"建築物能耗模擬測試:BESTEST案例610",BESTESTCase620:"建築物能耗模擬測試:BESTEST案例620",BESTESTCase630:"建築物能耗模擬測試:BESTEST案例630"},graph:{LineWidth:"線條寬度",SymbolSize:"符號大小",BarCategoryGap:"直條間隙",ShowHorizontalGridLines:"顯示格子的水平線條",ShowVerticalGridLines:"顯示格子的豎直線條"},analysisSubMenu:"分析",physicsSubMenu:"物理",physics:{DailySolarRadiationHeatmap:"當日太陽輻射總量分佈熱圖",SolarRadiationHeatmapOptions:"太陽輻射熱圖選項",SolarRadiationHeatmapGridCellSize:"太陽輻射熱圖網格的尺寸",SolarRadiationHeatmapMaxValue:"太陽輻射熱圖最大值",SolarRadiationHeatmapNoAnimation:"若無移動部件則省略動畫",ReflectionHeatmap:"反射熱圖"},sensorSubMenu:"傳感器",sensor:{CollectDailyData:"收集當天數據",CollectYearlyData:"收集全年數據",SensorSimulationNoAnimation:"若無移動部件則省略動畫"},buildingSubMenu:"建築物",building:{AnalyzeDailyBuildingEnergy:"建築物當天能耗分析",AnalyzeYearlyBuildingEnergy:"建築物全年能耗分析",EnergyAnalysisOptions:"能耗分析選項",EnergyGridCellSize:"計算網格的尺寸",BuildingEnergySimulationNoAnimation:"若無移動部件則省略動畫"},solarPanelSubMenu:"太陽能光伏板",solarPanel:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出",AnalyzeVisibility:"分析可見度",PanelDiscretization:"光伏板離散化方法",Exact:"準確",Approximate:"近似",EnergyGridCellSize:"計算網格的尺寸",VisibilityGridCellSize:"視界因子計算網格的尺寸",EnergyAnalysisOptions:"能量分析選項",VisibilityAnalysisOptions:"可見度分析選項",SolarPanelSimulationNoAnimation:"若無移動部件則省略動畫"},parabolicTroughSubMenu:"拋物線槽",parabolicTrough:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},parabolicDishSubMenu:"拋物線碟",parabolicDish:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},fresnelReflectorSubMenu:"菲涅爾反射鏡",fresnelReflector:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},heliostatSubMenu:"定日鏡",heliostat:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},solarUpdraftTowerSubMenu:"太陽能上升氣流塔",solarUpdraftTower:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出",SolarUpdraftTowerSimulationNoAnimation:"若無移動部件則省略動畫"},tutorialsSubMenu:"教程",solarEnergyScienceSubMenu:"太陽能科學",solarEnergyScienceTutorials:{SunAngles:"太陽相對於地面觀察者的角度",InsolationAndClimate:"太陽輻射和氣候的關係",SolarRadiationToBox:"一個長方體受到的太陽能輻射分析"},buildingScienceSubMenu:"建築科學",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"房屋的熱學封套和圍護封套",EffectOfSizeOnBuildingEnergy:"房屋大小對能耗的影響",EffectOfOrientationOnBuildingEnergy:"房屋方位對能耗的影響",EffectOfInsulationOnBuildingEnergy:"房屋隔熱對能耗的影響",EffectOfRoofColorOnBuildingEnergy:"屋頂顏色對建築物能耗的影響",EffectOfEavesOverhangLengthOnBuildingEnergy:"屋簷延伸長度對建築物能耗的影響",EffectOfWindowSHGCOnBuildingEnergy:"窗戶太陽能輸入對房屋能耗的影響",EffectOfThermostatSetpointOnBuildingEnergy:"恆溫器設定值對房屋能耗的影響",EffectOfProgrammableThermostatOnBuildingEnergy:"可程式恆溫器對房屋能耗的影響",EffectOfSolarPanelsOnBuildingEnergy:"光伏板對房屋能耗的影響",EffectOfGroundTemperatureOnBuildingEnergy:"地表温度對房屋能耗的影響",EffectOfTreesOnBuildingEnergy:"樹蔭對房屋能耗的影響"},buildingDesignSubMenu:"建築設計",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"有棚頂窗的科德角風格的住宅",MansardRoofWithDormers:"有天窗的折線屋頂",GableRoofVsHipRoof:"雙坡屋頂和四坡屋顶的對比",ColonialVsSaltbox:"殖民地風格和鹽盒風格的對比",GambrelRoofVsMansardRoof:"复斜屋顶和折線屋頂的對比",CombinationRoofVsBonnetRoof:"組合屋頂和帽簷屋頂的對比",DutchGableRoof:"荷蘭雙坡屋頂",GableAndValleyRoof:"坡谷屋頂",ClerestoryRoof:"天窗屋頂",MonitorRoof:"採光屋頂",AFrameHouse:"A字形房子",HalfTimberedHouse:"半木骨架房子",AllBasicRoofTypes:"所有的基本屋頂類型"},photovoltaicSolarPowerSubMenu:"光伏發電",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"光伏板傾斜角對發電量的影響",EffectOfAzimuthOfSolarPanel:"光伏板方位角對發電量的影響",SolarPanelTypes:"光伏板類型",DefineYourOwnSolarPanels:"定義自己的光伏板",VerticalBifacialSolarPanels:"豎直的雙面光伏板",CompareMonofacialAndBifacialSolarPanels:"單面光伏板和雙面光伏板的對比",SolarTrackers:"自動追日器",CoveringGroundWithSolarPanels:"為什麼我們不簡單地用光伏板覆蓋地面",InterRowSpacingOfSolarPanelArray:"光伏板陣列行間距對發電量的影響",EffectOfOrientationOfSolarPanels:"光伏板排列方向對發電量的影響",SolarPanelArrayAutomaticLayout:"光伏板自動排列"},concentratedSolarPowerSubMenu:"光熱發電",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"拋物線槽方位角對發電量的影響",EffectOfLatusRectumOfParabolicTrough:"拋物線槽通徑對發電量的影響",FocusSunlightWithParabolicDish:"用拋物線碟聚焦阳光",LinearFresnelReflectors:"用直線式菲涅爾反射鏡聚焦阳光",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"吸熱管的安装高度對直線式菲涅爾反射鏡發電量的影響",EffectOfAzimuthOfLinearFresnelReflectors:"直線式菲涅爾反射鏡方位角對發電量的影響",LinearFresnelReflectorsWithTwoAbsorbers:"配備兩個吸收管的直線式菲涅爾反射鏡陣列",CosineEfficiencyOfHeliostats:"定日鏡的餘弦效率",ShadowingAndBlockingOfHeliostats:"定日鏡的陰影和遮擋",EffectSolarPowerTowerHeight:"吸收塔高度對發電量的影響",SolarPowerTower:"塔式光熱發電站"},otherTypesOfSolarPowerSubMenu:"其它類型的太陽能發電",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"太陽能熱水器",SolarUpdraftTower:"太陽能上升氣流塔"},windPowerSubMenu:"風力發電",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"轉子葉片的數目對風力渦輪機輸出的影響",EffectOfPitchAngleOfWindTurbineBlades:"轉子葉片的俯仰角對風力渦輪機輸出的影響",BirdSafeBladeDesign:"對鳥類安全的葉片設計",OffshoreWindFarm:"離岸風電場"},colocationSubMenu:"共用空間項目",colocationTutorials:{AgricultureSolarWindColocation:"農業光電風力共用空間"},generativeDesignSubMenu:"生成式設計",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"單面光伏板陣列的傾斜角",BifacialSolarPanelArrayTiltAngle:"雙面光伏板陣列的傾斜角",SolarPanelArrayInterRowSpacing:"光伏板陣列的行間距",OutputOfSolarPanelArrayInDifferentPlaces:"一個光伏板陣列在不同地區的產出",SimpleSolarFarmParetoFront:"簡單太陽能農場設計的帕累托前沿"},examplesSubMenu:"例子",solarEnergySubMenu:"太陽能",solarEnergyExamples:{SunBeamAndHeliodon:"太陽光束和日影儀",RooftopSolarPanels:"屋頂光伏板",NevadaSolarOneParabolicTroughArray:"內華達州太陽能一號的拋物線槽陣列",TooeleParabolicDishArray:"猶他州圖埃勒的拋物線碟陣列",PS10SolarPowerTower:"西班牙塞維利亞的PS10太陽能發電塔",TucsonLinearFresnelReflectors:"亞利桑那州圖森的直線式菲涅爾反射鏡陣列",SolarCanopyFormFactors:"太陽能天篷外形設計",SolarCanopyOverBleachers:"看台太陽能天篷",SolarCanopyOverGarage:"車庫太陽能天篷",SolarBusStop:"太陽能候車亭",SolarFacadeTesla:"特斯拉光伏牆",BuildingIntegratedPhotovoltaics:"建築整合光伏",Floatovoltaics:"浮動光伏",Agrivoltaics:"農業光伏",VegetativeBuffer:"太陽能農場绿化带",RainbowSwashSolarFarmBostonMA:"馬薩諸塞州波士頓彩虹激流旁邊的光伏板陣列",MickeyMouseSolarFarmOrlandoFL:"佛羅里達州奧蘭多的米老鼠形狀光伏板陣列",SolarPanelsOverCanalBakersfieldCA:"加利福尼亞州貝克斯菲爾德灌溉渠上假想的光伏板陣列",SolarNoiseBarrierLexingtonMA:"馬薩諸塞州列剋星敦高速公路噪音牆上假想的光伏板",HSATSolarTrackersRaleighNC:"北卡羅來納州羅利的一個水平方向單軸旋轉追日光伏板陣列(HSAT)",AADATSolarTrackersLancasterCA:"加利福尼亞州蘭開斯特的一個雙軸旋轉追日光伏板陣列(AADAT)",SolarTrackersInRealWorld:"模擬",SolarUpdraftTowerInCity:"太陽能上升氣流塔在城市中的應用"},builtEnvironmentSubMenu:"建造環境",residentialBuildingsSubMenu:"住宅建築",residentialBuildingExamples:{ColonialHouse:"殖民地風格的住宅",DutchColonialHouse:"荷蘭殖民地風格的住宅",TShapedHouse:"T字型房子",CapeCodHouseWithGarage:"有車庫的科德角風格的住宅",Solarium:"有日光浴室的房子",Church1:"教堂例一",Cathedral1:"主教座堂例一",Cathedral2:"主教座堂例二",Mosque1:"清真寺例一",AdobeTaosHouse:"陶斯土坯房",RanchHouse:"牧場風格的住宅",BonnetHouse:"有帽簷屋頂的住宅",BarnStyleHouse:"穀倉式風格的住宅",ModernHouse:"現代風格的住宅",ButterflyRoofHouse:"蝴蝶型屋頂的住宅"},commercialBuildingsSubMenu:"商用建築",commercialBuildingExamples:{WhiteHouse:"白宫",HaroldWashingtonCollege:"哈羅德華盛頓學院",BilimMersinTurkiye:"土耳其梅爾辛科學教育中心",SpanishStyleHotel:"西班牙風格旅館",ApartmentBuilding:"公寓樓",OfficeBuilding:"寫字樓",Hotel:"旅館"},buildingComplexesSubMenu:"建築群",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"佛蒙特州南伯靈頓高中",MescaleroApacheSchoolNewMexico:"新墨西哥州梅斯卡勒羅阿帕奇學校"},urbanPlanningSubMenu:"城市規劃",urbanPlanningExamples:{CityBlockHeatmap:"城市街區熱圖",ChicagoSkyline:"芝加哥天際線"},otherBuildingsSubMenu:"其它建築",otherBuildingExamples:{Greenhouse:"溫室",Pavilion:"公園的亭子",OctagonalPagoda:"八角塔",OceanFront:"海邊",EgyptianPyramids:"埃及金字塔",MayanPyramid:"瑪雅金字塔",SiOSePol:"三十三孔橋",StackedCuboids:"堆砌長方體"},artificialIntelligenceSubMenu:"人工智慧",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"優化單排光伏板的傾斜角",OptimizingTiltAnglesOfMultipleSolarPanelRows:"優化多排光伏板的傾斜角",SolarFarmGenerativeDesign:"生成式設計太陽能農場",SolarFarmGenerativeDesignWithBlock:"生成式設計太陽能農場:周邊有建築物的情況",FitchburgSolarFarmGenerativeDesign:"生成式設計太陽能農場:真實世界案例"},languageSubMenu:"語言",publicSubMenu:"公共",ModelsGallery:"模型畫廊",ModelsMap:"模型地圖",AboutUs:"關於我們"},HVACMenu:{BuildingHVACSystem:"建築物暖通空調系統",Tolerance:"溫度忍耐閾值",ToleranceExplanation:`當日最低外面溫度高於恆溫器設定值減去此閾值,暖氣不開。 當日最高外面溫度低於恆溫器設定值加上此閾值,空調不開。`,ID:"ID",ThermostatType:"恆溫器類型",Simple:"簡單",Programmable:"編程",ThermostatSetpoint:"恆溫器設定值",HeatingSetpoint:"暖氣溫度設定值",CoolingSetpoint:"空調溫度設定值",Period:"時段",StartTime:"開始時間",Setpoint:"設定值",Wake:"起床",Day:"白天",Evening:"夜晚",Sleep:"睡眠",TimeErrorMessage:"開始時間應晚於上一個時段"},avatarMenu:{AccountSettings:"賬號設定",SignIn:"登錄",SignInAsMe:"實名登錄",SignInAnonymously:"匿名登錄",SignOut:"退出賬號",IfYouAreAStudent:"如果您是一個學生"},skyMenu:{Axes:"顯示坐標軸",Theme:"環境主題",ThemeDefault:"默認",ThemeDesert:"沙漠",ThemeDune:"沙丘",ThemeForest:"森林",ThemeGrassland:"草原",ThemeHill:"丘陵",ThemeLake:"湖泊",ThemeMountain:"山脈",ThemeRural:"田園",SunlightAttenuationCoefficientInAir:"陽光在空氣中傳播的衰減係數",ConvectiveCoefficientOfAir:"空氣對流傳熱係數",HighestTemperatureTimeInMinutes:"最高氣溫時間(分鐘)",SelectSunAnglesToShow:"選擇太陽角度顯示",ShowAzimuthAngle:"顯示方位角",ShowElevationAngle:"顯示高度角",ShowZenithAngle:"顯示天頂角",DirectLightBrightnessAtNoon:"正午直射光照度",AmbientLightBrightnessAtNoon:"正午環境光照度"},groundMenu:{MonthlyIrradianceLoss:"月份輻射度損失比",Vegetation:"植被",LeafOutDay:"樹葉長出的日子",LeafOffDay:"樹葉脫落的日子",Albedo:"反照率",ImageOnGround:"地面顯示圖像",WaterSurface:"水面",RemoveAllUnlockedTrees:"刪除所有非固定的樹木",RemoveAllUnlockedFlowers:"删除所有非固定的花草",RemoveAllUnlockedSolarPanels:"删除所有非固定的光伏板",RemoveAllUnlockedPeople:"删除所有非固定的人物",RemoveAllUnlockedFoundations:"删除所有非固定的地基",RemoveAllUnlockedCuboids:"删除所有非固定的長方體",DoYouReallyWantToRemoveAllPeople:"你確定刪除所有非固定的人物嗎",DoYouReallyWantToRemoveAllTrees:"你確定刪除所有非固定的樹木嗎",DoYouReallyWantToRemoveAllFlowers:"你確定刪除所有非固定的花草嗎",DoYouReallyWantToRemoveAllSolarPanels:"你確定刪除所有非固定的光伏板嗎",DoYouReallyWantToRemoveAllFoundations:"你確定刪除所有非固定的地基嗎",DoYouReallyWantToRemoveAllCuboids:"你確定刪除所有非固定的長方體嗎",LockAllUnlockedElements:"固定所有非固定的部件",UnlockAllLockedElements:"解除所有的固定"},labelSubMenu:{Label:"標籤",LabelText:"標籤的内容",LabelHeight:"標籤的高度",LabelSize:"標籤的大小",LabelFontSize:"字體的大小",LabelColor:"標籤的顏色",KeepShowingLabel:"顯示標籤"},foundationMenu:{RemoveAllUnlockedSolarPanels:"刪除此地基上所有非固定的光伏板",RemoveAllUnlockedParabolicTroughs:"刪除此地基上所有非固定的拋物線槽",RemoveAllUnlockedParabolicDishes:"刪除此地基上所有非固定的拋物線碟",RemoveAllUnlockedFresnelReflectors:"刪除此地基上所有非固定的菲涅耳反射鏡",RemoveAllUnlockedHeliostats:"刪除此地基上所有非固定的定日鏡",RemoveAllUnlockedWindTurbines:"刪除此地基上所有非固定的風力渦輪機",RemoveAllUnlockedSensors:"刪除此地基上所有非固定的傳感器",RemoveAllUnlockedLights:"刪除此地基上所有非固定的電燈",RemoveAllUnlockedWalls:"刪除此地基上所有非固定的牆",RemoveAllUnlockedWindows:"刪除此地基上所有非固定的窗戶",RemoveAllUnlockedDoors:"刪除此地基上所有非固定的門",RemoveAllUnlockedPolygons:"刪除此地基上所有非固定的多邊形",RemoveAllUnlockedHumans:"刪除此地基上所有非固定的人物",RemoveAllUnlockedTrees:"刪除此地基上所有非固定的樹木",RemoveAllUnlockedFlowers:"刪除此地基上所有非固定的花草",Racks:"支架",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",SolarPanels:"光伏板",SolarPanelArray:"光伏板陣列",DoYouReallyWantToRemoveAllSolarPanelsOnFoundation:"你確定刪除此地基上所有非固定的光伏板嗎",ParabolicTroughs:"拋物線槽",DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation:"你確定刪除此地基上所有非固定的拋物線槽嗎",ParabolicDishes:"拋物線碟",DoYouReallyWantToRemoveAllParabolicDishesOnFoundation:"你確定刪除此地基上所有非固定的拋物線碟嗎",FresnelReflectors:"菲涅耳反射鏡",DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation:"你確定刪除此地基上所有非固定的菲涅耳反射鏡嗎",Heliostats:"定日鏡",DoYouReallyWantToRemoveAllHeliostatsOnFoundation:"你確定刪除此地基上所有非固定的定日鏡嗎",WindTurbines:"風力渦輪機",DoYouReallyWantToRemoveAllWindTurbinesOnFoundation:"你確定刪除此地基上所有非固定的風力渦輪機嗎",Sensors:"傳感器",DoYouReallyWantToRemoveAllSensorsOnFoundation:"你確定刪除此地基上所有非固定的傳感器嗎",Lights:"電燈",DoYouReallyWantToRemoveAllLightsOnFoundation:"你確定刪除此地基上所有非固定的電燈嗎",Walls:"牆",DoYouReallyWantToRemoveAllWallsOnFoundation:"你確定刪除此地基上所有非固定的牆嗎",Windows:"窗戶",DoYouReallyWantToRemoveAllWindowsOnFoundation:"你確定刪除此地基上所有非固定的窗戶嗎",Doors:"門",DoYouReallyWantToRemoveAllDoorsOnFoundation:"你確定刪除此地基上所有非固定的門嗎",Polygons:"多邊形",DoYouReallyWantToRemoveAllPolygonsOnFoundation:"你確定刪除此地基上所有非固定的多邊形嗎",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnFoundation:"你確定刪除此地基上所有非固定的人物嗎",Trees:"樹木",DoYouReallyWantToRemoveAllTreesOnFoundation:"你確定刪除此地基上所有非固定的樹木嗎",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnFoundation:"你確定刪除此地基上所有非固定的花草嗎",OnlyThisFoundation:"只這塊地基",AllConnectedFoundations:"所有相連的地基",AllSelectedFoundations:"所有選中的地基",AllFoundations:"所有的地基",AddPolygon:"添加多邊形",SolarStructure:"太陽能構型",GroupMaster:"主地基",LockAllUnlockedElementsOnThisFoundation:"固定此地基上所有非固定的部件",UnlockAllLockedElementsOnThisFoundation:"解除此地基上所有的固定",GroundFloorRValue:"建築物地板的R值",OnlyThisGroundFloor:"只這個建築物的地板",AllGroundFloors:"所有建築物的地板"},solarPowerTowerMenu:{ReceiverTowerForHeliostats:"和定日鏡配套的吸收塔",ReceiverTowerPhysicalProperties:"太陽能吸收塔的物理性質",ReceiverTowerHeight:"太陽能吸收塔的高度",ReceiverTowerRadius:"太陽能吸收塔的半徑",ReceiverAbsorptance:"太陽能吸收器的吸收率",ReceiverOpticalEfficiency:"太陽能吸收器的光效率",ReceiverThermalEfficiency:"太陽能吸收器的熱效率"},solarAbsorberPipeMenu:{AbsorberPipeForFresnelReflectors:"和菲涅爾反射鏡配套的吸收管",AbsorberPipePhysicalProperties:"太陽能吸收管的物理性質",AbsorberHeight:"太陽能吸收管的安装高度",AbsorberApertureWidth:"太陽能吸收管的孔徑",AbsorberPipePoleNumber:"太陽能吸收管的支柱數量",AbsorberAbsorptance:"太陽能吸收管的吸收率",AbsorberOpticalEfficiency:"太陽能吸收管的光效率",AbsorberThermalEfficiency:"太陽能吸收管的熱效率"},solarUpdraftTowerMenu:{SolarUpdraftTower:"太陽能上升氣流塔",SolarUpdraftTowerPhysicalProperties:"太陽能上升氣流塔的物理性質",SolarUpdraftTowerChimneyHeight:"太陽能上升氣流塔煙囪的高度",SolarUpdraftTowerChimneyRadius:"太陽能上升氣流塔煙囪的半徑",SolarUpdraftTowerCollectorHeight:"太陽能上升氣流塔集熱棚的高度",SolarUpdraftTowerCollectorRadius:"太陽能上升氣流塔集熱棚的半徑",SolarUpdraftTowerCollectorTransmissivity:"太陽能上升氣流塔集熱棚的透射率",SolarUpdraftTowerCollectorEmissivity:"太陽能上升氣流塔集熱棚的發射率",SolarUpdraftTowerDischargeCoefficient:"太陽能上升氣流塔的流量係數",SolarUpdraftTowerTurbineEfficiency:"太陽能上升氣流塔的渦輪機效率"},batteryStorageMenu:{BatteryStorage:"蓄電池",OnlyThisBatteryStorage:"只這個蓄電池",AllBatteryStoragesAboveSameBase:"同一地基上的蓄電池",AllSelectedBatteryStorages:"所有選中的蓄電池",AllBatteryStorages:"所有蓄電池"},cuboidMenu:{Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",RemoveAllUnlockedSolarPanels:"刪除此長方體表面上所有非固定的光伏板",RemoveAllUnlockedSensors:"刪除此長方體表面上所有非固定的傳感器",RemoveAllUnlockedPolygons:"刪除此長方體表面上所有非固定的多邊形",RemoveAllUnlockedHumans:"刪除此長方體表面上所有非固定的人物",RemoveAllUnlockedTrees:"刪除此長方體表面上所有非固定的樹木",RemoveAllUnlockedFlowers:"刪除此長方體表面上所有非固定的花草",RemoveAllUnlockedLights:"刪除此長方體表面上所有非固定的電燈",Racks:"支架",Lights:"電燈",DoYouReallyWantToRemoveAllLightsOnCuboid:"你確定刪除此長方體表面上所有非固定的電燈嗎",SolarPanels:"光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnCuboid:"你確定刪除此長方體表面上所有非固定的光伏板嗎",Sensors:"傳感器",DoYouReallyWantToRemoveAllSensorsOnCuboid:"你確定刪除此長方體表面上所有非固定的傳感器嗎",Polygons:"多邊形",DoYouReallyWantToRemoveAllPolygonsOnCuboid:"你確定刪除此長方體表面上所有非固定的多邊形嗎",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnCuboid:"你確定刪除此長方體表面上所有非固定的人物嗎",Trees:"樹木",DoYouReallyWantToRemoveAllTreesOnCuboid:"你確定刪除此長方體表面上所有非固定的樹木嗎",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnCuboid:"你確定刪除此長方體表面上所有非固定的花草嗎",OnlyThisCuboid:"只這個長方體",AllCuboidsOnSameSurface:"同一表面上所有的長方體",AllCuboidsAboveSameBase:"同一地基上所有的長方體",AllSelectedCuboids:"所有選中的長方體",AllCuboids:"所有的長方體",OnlyThisSide:"只這個表面",AllSidesOfThisCuboid:"這個長方體所有的側面",AllSidesOfSelectedCuboids:"所有選中長方體所有的側面",AllSidesOfAllCuboids:"所有的長方體所有的側面",AddPolygon:"添加多邊形",Stackable:"可堆砌",GroupMaster:"主長方體"},polygonMenu:{Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",TextBox:"文字框",FontOutlineColor:"字體輪廓顏色",FontOutlineWidth:"字體輪廓線寬",FontStrokeColor:"字體描邊顏色",FontStrokeWidth:"字體描邊線寬",NoOutline:"無輪廓線",Shiny:"光澤",Filled:"填充",FillTexture:"填充材質",FillColor:"填充顏色",Opacity:"遮光度",LineColor:"線條顏色",LineWidth:"線條寬度",LineStyle:"線條樣式",SolidLine:"實線",DashedLine:"虛線",DottedLine:"點線",InsertVertexBeforeIndex:"前面插入頂點",InsertVertexAfterIndex:"後面插入頂點",DeleteVertex:"移除頂點",OnlyThisPolygon:"只這個多邊形",AllPolygonsOnSurface:"同一表面上所有的多邊形",AllPolygonsAboveFoundation:"同一地基上所有的多邊形",AllSelectedPolygons:"所有選中的多邊形",AllPolygons:"所有的多邊形",Layout:"佈局",SolarPanelArrayLayout:"光伏板陣列佈局",SolarPanelArrayLayoutParametricDesign:"光伏板陣列佈局參數化設計",SolarPanelArrayLayoutGenerativeDesign:"光伏板陣列佈局生成式設計",SolarPanelArrayModel:"光伏板型號",SolarPanelArrayOrientation:"排列方向",SolarPanelArrayTiltAngle:"傾斜角度",SolarPanelArrayRowWidth:"行寬度",SolarPanelArrayInterRowSpacing:"行間距",SolarPanelArrayRowSpacing:"行間距",SolarPanelArrayRowAxis:"行軸方向",SolarPanelArrayLeftRightRowAxis:"左右方向(相對)",SolarPanelArrayUpDownRowAxis:"上下方向(相對)",SolarPanelArrayEastWestRowAxis:"東西方向(絕對)",SolarPanelArrayNorthSouthRowAxis:"南北方向(絕對)",SolarPanelArrayMargin:"邊緣餘地",SolarPanelArrayPoleHeight:"支架高度",SolarPanelArrayPoleSpacing:"支柱間隔",SolarPanelArrayTotalYearlyCost:"全年總成本",SolarPanelArrayTotalYearlyRevenue:"全年總收入",SolarPanelArrayTotalYearlyYield:"全年總發電量",SolarPanelArrayMeanYearlyYield:"平均年發電量",SolarPanelArrayYearlyProfit:"全年利潤",LayoutNotAcceptedCheckYourParameters:"恕不能採用此佈局。請檢查您的參數設置。"},optimizationMenu:{Optimization:"優化",Parameters:"參數",Variables:"變量",Constants:"常量",GeneticAlgorithm:"遺傳算法",GeneticAlgorithmSettings:"遺傳算法設定",ParticleSwarmOptimization:"粒子群優化",ParticleSwarmOptimizationSettings:"粒子群優化設定",SolarPanelTiltAngleOptimization:"光伏板傾斜角度優化",SolarPanelArrayLayout:"光伏板陣列佈局",Generation:"世代",Gene:"基因",NormalizedVariables:"標準化變量",Objective:"目標函數",ObjectiveFunctionDailyTotalYield:"當日總產出",ObjectiveFunctionYearlyTotalYield:"全年總產出",ObjectiveFunctionDailyMeanYield:"當日平均產出",ObjectiveFunctionYearlyMeanYield:"全年平均產出",ObjectiveFunctionDailyProfit:"當日利潤",ObjectiveFunctionYearlyProfit:"全年利潤",GeneticAlgorithmSelectionMethod:"遺傳算法選擇方法",RouletteWheel:"輪盤制",Tournament:"淘汰制",SearchMethod:"搜索方法",GlobalSearchUniformSelection:"全局搜索均勻取樣",LocalSearchRandomOptimization:"局部搜索隨機優化",PopulationSize:"種群個體數目",MaximumGenerations:"最大世代數目",SelectionRate:"選擇概率",CrossoverRate:"交配概率",MutationRate:"突變概率",Step:"步數",SwarmSize:"粒子數目",MaximumSteps:"最大步數",MaximumVelocity:"最大速度",InertiaWeight:"慣性權重",CognitiveCoefficient:"認知係數",SocialCoefficient:"社會係數",ConvergenceThreshold:"終止條件的收斂閾值",LocalSearchRadius:"局部搜索的半徑",RowsPerRackRange:"單個支架上光伏板行數的變化範圍",TiltAngleRange:"光伏板傾斜角度的變化範圍",InterRowSpacingRange:"光伏板陣列行間距的變化範圍",ClickTargetPolygonToActivate:"點擊目標多邊形激活",ClickTargetFoundationToActivate:"點擊目標地基激活"},treeMenu:{ShowModel:"顯示近似模型",Flip:"翻轉",Type:"樹種",Spread:"樹冠直徑"},flowerMenu:{Flip:"翻轉",Type:"品種",Spread:"直徑"},peopleMenu:{ChangePerson:"改變人物",Flip:"轉身",Observer:"觀察者",ViewFromThisPerson:"視角移到此人位置"},lightMenu:{Color:"顏色",Intensity:"亮度",Decay:"衰减",MaximumDistance:"最大距離",Inside:"内部"},solarCollectorMenu:{Coordinates:"座標",RelativeXCoordinateOfCenter:"中心的相對X座標",RelativeYCoordinateOfCenter:"中心的相對Y座標",RelativeAzimuth:"相對方位角",Pole:"支柱",PoleHeight:"支柱高度",PoleRadius:"支柱半徑",ExtraPoleHeight:"額外的支柱高度",ExtraPoleHeightInAdditionToHalfWidth:"寬度一半額外的支柱高度",DrawSunBeam:"顯示光束"},concentratedSolarPowerCollectorMenu:{ReflectorReflectance:"反射器鏡面反射率",ReceiverAbsorptance:"接收器吸收率",ReflectorOpticalEfficiency:"反射器光效率",ReceiverThermalEfficiency:"接收器熱效率"},solarWaterHeaterMenu:{OnlyThisSolarWaterHeater:"只這個太陽能熱水器",AllSolarWaterHeatersOnSurface:"同一表面上所有的太陽能熱水器",AllSolarWaterHeatersAboveFoundation:"同一地基上所有的太陽能熱水器",AllSelectedSolarWaterHeaters:"所有選中的太陽能熱水器",AllSolarWaterHeaters:"所有的太陽能熱水器"},solarPanelMenu:{ElectricalProperties:"電氣特性",InverterEfficiency:"逆變器效率",InverterEfficiencyExplained:"直流電轉換為交流電的效率。",DcToAcSizeRatio:"直流-交流容量比例",DcToAcSizeRatioExplained:"直流電容量和交流電容量的比例。",ChangePvModel:"改變光伏板型號",Orientation:"排列方向",Portrait:"縱向",Landscape:"橫向",FrameColor:"框架顏色",Panels:"塊",PanelsWide:"塊光伏板寬",PanelsLong:"塊光伏板長",TiltAngle:"傾斜角度",SouthFacingIsPositive:"朝南為正",Tracker:"追日系統",SolarTrackerFollowsSun:"追日系統提高光伏板產出。",PoleSpacing:"支柱間隔",NoTracker:"無追日系統",HorizontalSingleAxisTracker:"水平單軸追日系統",VerticalSingleAxisTracker:"豎直單軸追日系統",AltazimuthDualAxisTracker:"地平雙軸追日系統",OnlyThisSolarPanel:"只這個光伏板",AllSolarPanelsOnSurface:"同一表面上所有的光伏板",AllSolarPanelsAboveFoundation:"同一地基上所有的光伏板",AllSelectedSolarPanels:"所有選中的光伏板",AllSolarPanels:"所有的光伏板"},pvModelPanel:{SolarPanelSpecs:"光伏板型號性能",General:"概況",Electrical:"電力",CellCountInXDirection:"X方向電池數目",CellCountInYDirection:"Y方向電池數目",Weight:"重量",Kilogram:"公斤",RatedVoltage:"額定電壓",RatedCurrent:"額定電流",OpenCircuitVoltage:"開路電壓",ShortCircuitCurrent:"短路電流",MaximumRatedPower:"最大額定功率",Model:"型號",PanelSize:"尺寸",Cells:"電池組",CellType:"光伏電池類型",Monocrystalline:"單晶矽",Polycrystalline:"多晶矽",ThinFilm:"薄膜",Bifacial:"雙面",PowerBifaciality:"功率雙面性因子(背面對正面)",Black:"黑色",Blue:"藍色",ShadeTolerance:"陰影耐受度",SolarCellEfficiency:"光伏電池效率",NominalOperatingCellTemperature:"名義電池運行溫度",TemperatureCoefficientOfPmax:"Pmax溫度係數",AddedCustomSolarPanels:"已有",DisplayThisCustomSolarPanel:"展示這個客製化光伏板",ExportThisCustomSolarPanel:"輸出此客製化光伏板",ImportCustomSolarPanelFromClipboard:"從系統剪切板輸入客製化光伏板數據",CustomSolarPanelExportedToClipboard:"客製化光伏板拷貝到剪貼板",DoYouReallyWantToRemoveThisCustomSolarPanel:"你確定刪除此客製化光伏板",MakeSureThisCustomSolarPanelIsNotUsed:"刪除之前請確認此客製化光伏板沒有被當前文檔採用",ThisCustomSolarPanelIsUsed:"此客製化光伏板被當前文檔採用",DoYouReallyWantToImportCustomSolarPanel:"你確定輸入客製化光伏板",ExistingSettingsWillBeOverwritten:"現有的設定將被取代",CannotAddCustomSolarPanel:"無法添加此客製化光伏板",CustomSolarPanelMustHaveModelName:"客製化光伏板必須要有型號",CustomSolarPanelExists:"目前文件已經定義了此名字的客製化光伏板",FailInImportingDataFromClipboard:"從系統剪切板輸入資料失敗",NoNeedToAddThisCustomSolarPanel:"無需定義此光伏板",SolarPanelModelAlreadyProvidedBySystem:"系統已提供此光伏板"},parabolicTroughMenu:{ModuleLength:"模塊長度",Modules:"模塊",ModulesLong:"模塊長",LatusRectum:"通徑",OnlyThisParabolicTrough:"只這個拋物線槽",AllParabolicTroughsAboveFoundation:"同一地基上所有的拋物線槽",AllSelectedParabolicTroughs:"所有選中的抛物线槽",AllParabolicTroughs:"所有的拋物線槽"},fresnelReflectorMenu:{AbsorberPipe:"吸收管",SelectAbsorberToReflectSunlightTo:"選擇陽光反射到的吸收管",ModuleLength:"模塊長度",Modules:"模塊",ModulesLong:"模塊長",OnlyThisFresnelReflector:"只這個菲涅耳反射鏡",AllFresnelReflectorsAboveFoundation:"同一地基上所有的菲涅耳反射鏡",AllSelectedFresnelReflectors:"所有選中的菲涅耳反射镜",AllFresnelReflectors:"所有的菲涅耳反射鏡"},heliostatMenu:{Tower:"吸收塔",SelectTowerToReflectSunlightTo:"選擇陽光反射到的吸收塔",OnlyThisHeliostat:"只這個定日鏡",AllHeliostatsAboveFoundation:"同一地基上所有的定日鏡",AllSelectedHeliostats:"所有選中的定日镜",AllHeliostats:"所有的定日鏡"},parabolicDishMenu:{ReceiverStructure:"接收器結構",CentralPole:"中心直柱",CentralPoleWithTripod:"三腳架和中心直柱",Quadrupod:"四脚架",RimDiameter:"外圈直徑",LatusRectum:"通徑",ExtraPoleHeightInAdditionToRadius:"半徑之外額外的支架高度",OnlyThisParabolicDish:"只這個拋物線碟",AllParabolicDishesAboveFoundation:"同一地基上所有的拋物線碟",AllSelectedParabolicDishes:"所有選中的抛物线碟",AllParabolicDishes:"所有的拋物線碟"},windTurbineMenu:{BirdSafeDesign:"鳥類安全設計",BirdSafeNone:"無",BirdSafeBicolor:"雙色",BirdSafeStriped:"條紋",Rotor:"轉子",BladeNumber:"葉片數目",RotorInitialAngle:"轉子初始角度",RotorBladeDesign:"轉子葉片設計",RotorBladeRadius:"轉子葉片半徑",RotorBladePitchAngle:"轉子葉片俯仰角",RelativeYawAngle:"相對偏流角",MaximumChordLength:"最大弦長度",Tower:"塔架",TowerHeight:"塔架高度",TowerRadius:"塔架半徑",HubDesign:"轉子輪轂設計",HubRadius:"輪轂半徑",HubLength:"輪轂長度",OnlyThisWindTurbine:"只這個風力渦輪機",AllWindTurbinesAboveFoundation:"同一地基上所有的風力渦輪機",AllSelectedWindTurbines:"所有選中的風力渦輪機",AllWindTurbines:"所有的風力渦輪機"},wallMenu:{TextureDefault:"默認材質",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",SizeOfWall:"牆的尺寸",OnlyThisWall:"只這堵牆",AllConnectedWalls:"所有連接的牆",AllWallsAboveFoundation:"同一地基上所有的牆",AllSelectedWalls:"所有選中的墙",AllWalls:"所有的牆",Windows:"窗戶",LockAllUnlockedWindows:"固定所有非固定的窗戶",UnlockAllLockedWindows:"解除所有的窗戶固定",RemoveAllUnlockedWindows:"刪除這堵牆上所有非固定的窗戶",DoYouReallyWantToRemoveAllWindowsOnThisWall:"你確定刪除這堵牆上所有非固定的窗戶嗎",Doors:"門",LockAllUnlockedDoors:"固定所有非固定的門",UnlockAllLockedDoors:"解除所有的門固定",RemoveAllUnlockedDoors:"刪除這堵牆上所有非固定的門",DoYouReallyWantToRemoveAllDoorsOnThisWall:"你確定刪除這堵牆上所有非固定的門嗎",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"刪除這堵牆上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisWall:"你確定刪除這堵牆上所有非固定的光伏板嗎",Sensors:"傳感器",LockAllUnlockedSensors:"固定所有非固定的傳感器",UnlockAllLockedSensors:"解除所有的傳感器固定",RemoveAllUnlockedSensors:"刪除這堵牆上所有非固定的傳感器",DoYouReallyWantToRemoveAllSensorsOnThisWall:"你確定刪除這堵牆上所有非固定的傳感器嗎",Lights:"電燈",LockAllUnlockedLights:"固定這堵牆上所有非固定的電燈",UnlockAllLockedLights:"解除這堵牆上所有的電燈固定",RemoveAllUnlockedLights:"刪除這堵牆上所有非固定的電燈",DoYouReallyWantToRemoveAllLightsOnThisWall:"你確定刪除這堵牆上所有非固定的電燈嗎",Polygons:"多邊形",LockAllUnlockedPolygons:"固定這堵牆上所有非固定的多邊形",UnlockAllLockedPolygons:"解除這堵牆上所有的多邊形固定",RemoveAllUnlockedPolygons:"刪除這堵牆上所有非固定的多邊形",DoYouReallyWantToRemoveAllPolygonsOnThisWall:"你確定刪除這堵牆上所有非固定的多邊形嗎",WallStructure:"牆結構",DefaultStructure:"默認",StudStructure:"牆柱",PillarStructure:"圓柱",Opacity:"遮光度",StructureSpacing:"結構間距",StructureWidth:"結構寬度",StructureThickness:"結構厚度",StructureColor:"結構颜色",Color:"牆体颜色",Height:"高度",Thickness:"厚度",Texture:"材質",AllLightsOnWallInside:"所有電燈在牆內",AllLightsOnWallOutside:"所有電燈在牆外",Fill:"填充",Full:"全部",Partial:"部分",Empty:"空白",OpenToOutside:"對外面開放",EavesLength:"屋簷延伸長度",Parapet:"女牆",ParapetColor:"女牆颜色",ParapetTexture:"女牆材質",ParapetHeight:"女牆高度",CopingsHeight:"頂蓋高度",CopingsWidth:"頂蓋寬度"},windowMenu:{OnlyThisWindow:"只這個窗戶",AllWindowsOnSurface:"同一表面上所有的窗戶",AllWindowsAboveFoundation:"同一地基上所有的窗戶",AllSelectedWindows:"所有選中的窗户",AllWindows:"所有的窗戶",Width:"寬度",Height:"高度",Setback:"離牆體外表面的距離",RelativeToWallThickness:"相對於牆的厚度",Mullion:"直櫺",HorizontalMullion:"水平的直櫺",VerticalMullion:"豎直的直櫺",MullionWidth:"直櫺寬度",HorizontalMullionSpacing:"水平直櫺的間距",VerticalMullionSpacing:"豎直直櫺的間距",MullionColor:"直櫺颜色",Tint:"著色",Opacity:"不透明度",SolarHeatGainCoefficient:"太陽輻射熱獲取係數(SHGC) = 1 - 不透明度",Shutter:"百葉窗",LeftShutter:"左側百葉窗",RightShutter:"右側百葉窗",BothShutters:"兩側百葉窗",ShutterWidth:"相對寬度",ShutterColor:"百葉窗顏色",Frame:"邊框",FrameWidth:"邊框寬度",SillWidth:"窗台寬度",Color:"邊框顔色",WindowType:"窗戶種類",Default:"默認",Arched:"拱形",Polygonal:"多邊形",Interior:"内窗",Empty:"空白"},roofMenu:{TextureDefault:"默認材質",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",OnlyThisRoof:"只這個屋顶",AllRoofsAboveFoundation:"同一地基上所有的屋顶",AllSelectedRoofs:"所有選中的屋顶",AllRoofs:"所有的屋顶",OnlyThisCeiling:"只這個天花板",AllCeilingsAboveFoundation:"同一地基上所有的天花板",AllCeilings:"所有的天花板",EavesOverhangLength:"屋簷延伸長度",RafterSpacing:"屋椽間距",RafterWidth:"屋椽寬度",RafterThickness:"屋椽厚度",RafterColor:"屋椽颜色",RoofColor:"屋顶颜色",RoofSideColor:"屋顶側面颜色",GlassTint:"玻璃顏色",Opacity:"遮光度",RoofStructure:"屋頂結構",DefaultStructure:"默認",RafterStructure:"屋椽",GlassStructure:"玻璃",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"刪除這個屋顶上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof:"你確定刪除這個屋顶上所有非固定的光伏板嗎",Windows:"天窗",LockAllUnlockedWindows:"固定所有非固定的天窗",UnlockAllLockedWindows:"解除所有的天窗固定",RemoveAllUnlockedWindows:"刪除這個屋顶上所有非固定的天窗",DoYouReallyWantToRemoveAllWindowsOnThisRoof:"你確定刪除這個屋顶上所有非固定的天窗嗎",Sensors:"傳感器",LockAllUnlockedSensors:"固定所有非固定的傳感器",UnlockAllLockedSensors:"解除所有的傳感器固定",RemoveAllUnlockedSensors:"刪除這個屋顶上所有非固定的傳感器",DoYouReallyWantToRemoveAllSensorsOnThisRoof:"你確定刪除這個屋顶上所有非固定的傳感器嗎",Lights:"電燈",RemoveAllUnlockedLights:"刪除這個屋顶上所有非固定的電燈",DoYouReallyWantToRemoveAllLightsOnThisRoof:"你確定刪除這個屋顶上所有非固定的電燈嗎",AllLightsOnRoofInside:"所有電燈在屋頂內",AllLightsOnRoofOutside:"所有電燈在屋頂外",Rise:"相對高度",Ceiling:"天花板",RoofRValue:"屋顶R值",CeilingRValue:"天花板R值"},doorMenu:{TextureDefault:"默認材質",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",Texture11:"十一號材質",Texture12:"十二號材質",Texture13:"十三號材質",Texture14:"十四號材質",Texture15:"十五號材質",Texture16:"十六號材質",Texture17:"十七號材質",OnlyThisDoor:"只這個門",AllDoorsOnWall:"同一面牆上所有的門",AllDoorsAboveFoundation:"同一地基上所有的門",AllSelectedDoors:"所有選中的门",AllDoors:"所有的門",DoorType:"門種類",Default:"默認",Arched:"拱形",Filled:"填充",FrameColor:"門框顏色",Interior:"內門"},siteInfoPanel:{High:"最高溫度",Low:"最低温度"},designInfoPanel:{NumberOfSelectedHeliostats:"選中的定日鏡總數",NumberOfSelectedSolarPanels:"選中的光伏板總數",ElectricityGeneratedDailyBySolarPanels:"這些光伏板的日發電量",SceneDiameter:"場景直徑",BuildingArea:"建築面積"},visualizationControlPanel:{ColorContrast:"熱圖顏色對比度",FluxScale:"熱通量長度",ClickUpOrDownArrowButtonsToChange:"點擊上下箭頭改變參數"},instructionPanel:{Rotate:"旋轉",DragMouse:"拖動滑鼠",Zoom:"缩放",MouseWheelOrKeys:"滑鼠滾輪或者Ctrl+[和Ctrl+]",MouseWheelOrKeysMac:"滑鼠滾輪或者⌘+[和⌘+]",Pan:"平移",HoldCtrlDragMouse:"按下Ctrl鍵並拖動滑鼠",HoldMetaDragMouse:"按下⌘鍵並拖動滑鼠",Enter2DMode:"進入二維模式",Exit2DMode:"退出二維模式",NavigationMode:"導航模式",EnableNavigation:"進入導航模式",DisableNavigation:"退出導航模式",MoveForwardBack:"前後移動",MoveForwardBackInstruction:"按W/S鍵",MoveLeftRight:"左右移動",MoveLeftRightInstruction:"按A/D鍵",MoveUpDown:"上下移動",MoveUpDownInstruction:"按Z/X鍵",Turn:"拐彎",TurnInstruction:"按方向鍵",ResetView:"重置視角",AutoRotate:"自動旋轉",StartOrStop:"按F4鍵啟動或停止"},mapPanel:{ImageOnGround:"地面顯示圖像",HideAddress:"隱藏地址",WeatherStations:"氣象站",WeatherStationsNote:"關閉此選項以提高地圖速度",Coordinates:"經緯度坐標",Zoom:"放大程度"},visibilityPanel:{SolarPanelVisibility:"光伏板對觀察者的可見度",Observer:"觀察者",VantagePoint:"觀察位置",ItemizedVisibilityByFields:"每個場的可見度",TotalVisibility:"總可見度"},sensorPanel:{LightSensor:"光傳感器",WeatherDataFrom:"氣象數據來自"},buildingEnergyPanel:{DailyBuildingEnergy:"建築物日能耗",YearlyBuildingEnergy:"建築物年能耗",Heater:"暖氣",AC:"空調",SolarPanel:"光伏",Net:"淨能耗"},solarPanelYieldPanel:{SolarPanelDailyYield:"光伏日發電量",SolarPanelYearlyYield:"光伏年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualSolarPanels:"顯示每行光伏板單獨發電量",Profit:"利潤",TotalCost:"總成本",TotalRevenue:"總收入",TotalYield:"總發電量",MeanYield:"平均發電量",ModuleCount:"光伏板總數"},parabolicTroughYieldPanel:{ParabolicTroughDailyYield:"拋物線槽日發電量",ParabolicTroughYearlyYield:"拋物線槽年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualParabolicTroughs:"顯示每行拋物線槽單獨發電量"},parabolicDishYieldPanel:{ParabolicDishDailyYield:"拋物線碟日發電量",ParabolicDishYearlyYield:"拋物線碟年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualParabolicDishes:"顯示每個拋物線碟單獨發電量"},fresnelReflectorYieldPanel:{FresnelReflectorDailyYield:"菲涅耳反射鏡日發電量",FresnelReflectorYearlyYield:"菲涅耳反射鏡年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualFresnelReflectors:"顯示每個菲涅耳反射鏡單獨發電量"},heliostatYieldPanel:{HeliostatDailyYield:"定日鏡日發電量",HeliostatYearlyYield:"定日鏡年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualHeliostats:"顯示每個定日鏡單獨發電量"},updraftTowerYieldPanel:{UpdraftTowerDailyYield:"太陽能上升氣流塔日發電量",UpdraftTowerYearlyYield:"太陽能上升氣流塔年發電量",ChimneyAirTemperature:"煙囪空氣溫度",ChimneyWindSpeed:"煙囪風速",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualUpdraftTowers:"顯示每個太陽能上升氣流塔單獨發電量"},heliodonPanel:{SunAndTimeSettings:"太陽和時間設置",SunAngles:"角度",TwentyFourHours:"24小時"},cloudFilePanel:{CopyTitle:"拷貝標題",TitleCopiedToClipBoard:"標題拷貝到剪貼板",SearchByTitle:"按標題搜索",MyLikes:"我喜歡的模型",MyCloudFiles:"我的雲文檔",GenerateLink:"生成鏈接",LinkGeneratedInClipBoard:"鏈接生成到剪貼板",DoYouReallyWantToDelete:"您確定刪除此文檔",IfSharedOrPublishedRenamingFileBreaksExistingLinks:"如果此文檔已被分享或發布, 改名會使已有鏈接失效"},projectListPanel:{CopyTitle:"拷貝標題",TitleCopiedToClipBoard:"標題拷貝到剪貼板",SearchByTitle:"按標題搜索",MyProjects:"我的專案",GenerateProjectLink:"生成專案鏈接",ProjectLinkGeneratedInClipBoard:"專案鏈接生成到剪貼板",DoYouReallyWantToDeleteProject:"您確定刪除專案",IfSharedOrPublishedRenamingProjectBreaksExistingLinks:"如果此專案已被分享或發布, 改名會使已有鏈接失效"},projectPanel:{ProjectSettings:"專案設定",ThumbnailImageSize:"縮略圖大小",ProjectByOtherPeople:"別人的專案",Project:"專案",ProjectType:"類别",ProjectDescription:"描述",MakeDescriptionEditable:"編輯描述",MakeDescriptionNonEditable:"不編輯描述",DoubleClickToMakeDescriptionEditable:"雙擊此描述激活編輯功能",SolarPanelArray:"光伏板陣列設計",CurateCurrentDesign:"收藏當前設計",UpdateSelectedDesign:"更新選中設計",RemoveSelectedDesign:"刪除選中設計",ClickToFlipSortingOrder:"點擊逆轉排序方向",DesignNotShownInSolutionSpaceClickToShow:"此設計目前不顯示在設計空間內,點擊顯示",DesignShownInSolutionSpaceClickToHide:"此設計目前顯示在設計空間內,點擊隱藏",SolutionSpace:"設計空間",ChooseSolutionSpace:"選擇設計空間",ChooseDataColoring:"選擇數據著色",SameColorForAllDesigns:"所有設計一個顏色",OneColorForEachDesign:"每個設計一個顏色",SolutionSpaceScreenshot:"設計空間截屏",ScatterPlotScreenshot:"散點圖截屏",SingleClickToSelectDoubleClickToOpen:"單擊選擇,雙擊打開。",SingleClickToDeselectDoubleClickToOpen:"單擊取消選擇,雙擊打開。",GenerateScatterPlot:"生成散點圖",SelectXAxis:"選擇X軸",SelectYAxis:"選擇Y軸"},accountSettingsPanel:{MyAccountSettings:"我的賬戶設定",MyID:"我的🆔",ClickToCopyMyID:"點擊此處拷貝我的ID",IDInClipBoard:"您現在可以粘貼ID了。",StoreMyNameInMyFilesWhenSaving:"保存文檔時籤上我的大名",DoYouReallyWantToShowYourNameInYourFiles:"您確定在您的文檔裡保存您的大名嗎?",SignFileDisclaimer:"如果您選擇保存,您的大名可能被所有打開您的文檔的人看到。",Likes:"點贊總數",AllPublished:"發佈總數",PublishedUnderAliases:"别名發佈",UserCount:"用戶總數",SchoolID:"學校編號",ClassID:"班級編號"},weatherPanel:{SunshineHours:"日照時間"},diurnalTemperaturePanel:{SelectAirTemperatureModel:"選擇氣溫模型",Sinusoidal:"正弦函數"},economicsPanel:{EconomicsParameters:"經濟學參數",ElectricitySellingPrice:"銷售電價",OperationalCostPerUnit:"單位運行成本",SellingPrice:"銷售電價",UnitCost:"單位成本"},navigationPanel:{NavigationParameters:"導航模式參數",MinimumMoveSpeed:"最小移動速度",MinimumTurnSpeed:"最小拐彎速度"},shadowSettingsPanel:{ShadowSettings:"陰影設定",ShadowCameraFarDistance:"最遠距離",ShadowMapSize:"映射圖長寬",Notes:"注意事項",RefreshPageNote:"改變設定後須刷新頁面。",MapSizeWarning:"大的映射圖長寬可能導致阿拉丁無法在某些電腦上運作。"},yearlyLightSensorPanel:{SkyClearness:"天空清晰度",ShowDaylightResults:"顯示日照時間結果",ShowSkyClearnessResults:"顯示天空清晰度結果",ShowAverageDailySolarRadiation:"顯示日平均輻射結果"},analysisManager:{NoSensorForCollectingData:"沒有傳感器收集數據。",NoSolarPanelForAnalysis:"沒有光伏板可以分析。",NoObserverForVisibilityAnalysis:"沒有找到可見度分析的觀察者。",NoSolarWaterHeaterForAnalysis:"沒有太陽能熱水器可以分析。",NoParabolicDishForAnalysis:"沒有拋物線碟可以分析。",NoParabolicTroughForAnalysis:"沒有拋物線槽可以分析。",NoFresnelReflectorForAnalysis:"沒有菲涅耳反射鏡可以分析。",NoHeliostatForAnalysis:"沒有定日鏡可以分析。",NoSolarUpdraftTowerForAnalysis:"沒有太陽能上升氣流塔可以分析。",NoBuildingForAnalysis:"沒有建築物可以分析。"},toolbar:{CloudFile:"雲文檔",Select:"選擇",AddFoundation:"添加地基",AddWall:"添加牆體",AddWindow:"添加窗戶",AddDoor:"添加門",AddPyramidRoof:"添加金字塔屋頂",AddGableRoof:"添加雙坡屋頂",AddHipRoof:"添加四坡屋顶",AddGambrelRoof:"添加复斜屋顶",AddMansardRoof:"添加折線屋顶",AddCuboid:"添加長方體",AddSensor:"添加傳感器",AddSolarPanel:"添加光伏板",AddSolarWaterHeater:"添加太陽能熱水器",AddBatteryStorage:"添加儲蓄電池",AddParabolicDish:"添加拋物線碟",AddParabolicTrough:"添加拋物線槽",AddFresnelReflector:"添加菲涅耳反射鏡",AddHeliostat:"添加定日鏡",AddWindTurbine:"添加水平轴風力渦輪機",AddVerticalAxisWindTurbine:"添加垂直軸風力渦輪機",AddLight:"添加電燈",AddTree:"添加樹木",AddFlower:"添加花草",AddPeople:"添加人物",DoubleClickToLockThisModeForNextAction:"雙擊按鈕給下個動作鎖定此模式",ClickToUnlockThisModeForNextAction:"點擊按鈕讓動作完成即離開此模式",ManipulateGroup:"整體操作一個組",ClearScene:"清空場景",ShowSunAndTimeSettings:"顯示太陽和時間設置",SpatialAnalysisOfEnergy:"能量的空間分析",DoYouReallyWantToClearContent:"您確定清空場景嗎",ClickForMoreButtons:"點擊此處切換到更多的按鈕模式"},tooltip:{gotoIFI:"訪問未來智能研究所",visitAladdinHomePage:"訪問阿拉丁主頁",clickToOpenMenu:"點擊打開主菜單",clickToAccessAccountSettings:"點擊打開賬號設定"},tree:{Apple:"蘋果樹",Birch:"白樺",Coconut:"椰子樹",Dogwood:"茱萸",Elm:"榆樹",FanPalm:"扇葉棕櫚",Linden:"菩提",Magnolia:"玉蘭",Maple:"楓樹",Oak:"橡樹",Pine:"松樹",Spruce:"雲杉"},flower:{Bellflower:"鈴蘭",Boxwood:"黃楊",CactusCombo1:"仙人掌組合一",CactusCombo2:"仙人掌組合二",CactusCombo3:"仙人掌組合三",CactusCombo4:"仙人掌組合四",Hibiscus:"木槿",Hosta:"玉簪",Hydrangea:"繡球花",Peony:"牡丹",RedRose:"紅玫瑰",Spirea:"繡線菊",Sunflower:"向日葵",TallBush:"高灌木",Tulip:"鬱金香",WhiteFlower:"白花",YellowFlower:"黄花"},people:{Jaah:"賈阿",Jack:"傑克",Jacob:"雅各布",Jacqueline:"杰奎琳",Jade:"美玉",Jamelia:"潔米莉雅",James:"詹姆斯",Jane:"簡",Jaya:"佳婭",Jaye:"傑伊",Jeanette:"珍妮特",Jedi:"傑迪",Jeff:"傑夫",Jena:"珍娜",Jennifer:"珍尼弗",Jess:"傑西",Jett:"傑特",Jill:"吉爾",Jiya:"吉娅",Joan:"瓊",Jocelyn:"喬斯林",Joel:"喬爾",Joey:"喬伊",John:"約翰",Jonathon:"喬納森",Jose:"何塞",Joseph:"約瑟夫",Joshua:"約書亞",Judd:"賈德",Judy:"朱蒂",Julia:"朱莉婭",Julio:"胡里奥",Jumapili:"祖瑪匹莉",June:"準衛",Juro:"朱諾",Justin:"賈斯汀"},compass:{N:"北",S:"南",W:"西",E:"東"},month:{January:"一月",February:"二月",March:"三月",April:"四月",May:"五月",June:"六月",July:"七月",August:"八月",September:"九月",October:"十月",November:"十一月",December:"十二月"},modelsMap:{AllTime:"全部時間",SearchByPublisher:"按發布者搜索",SearchByLabel:"按標籤搜索",MyPublishedModels:"我發布的模型",TotalNumberOfUserPublishedModelsInSelectedPeriod:"選定時間段用戶發布的模型總數",AllTimeTotal:"全部時間用戶發布的模型總數",SortFromOldestToNewest:"從早到晚排序",SortFromNewestToOldest:"從晚到早排序",SitesFound:"個位置",ModelsFoundOnThisSite:"個模型在此位置",ShowModelsPublishedByThisAuthor:"展示此用戶發布的模型"},modelTree:{Human:"人物",Flower:"花草",Tree:"樹木",Foundation:"地基",Wall:"墻體",Roof:"屋頂",Window:"窗户",SkylightWindow:"天窗",Door:"門",SolarWaterHeater:"太陽能熱水器",RooftopSolarPanels:"屋頂光伏板",WallMountedSolarPanels:"壁掛光伏板",GroundMountedSolarPanels:"地面安裝的光伏板",Sensor:"傳感器",Light:"電燈"}}},j5t={translation:{name:{IFI:"Instituto de inteligencia futura",Aladdin:"Aladdin",Tagline:"Aladdin: Reimagining Design with Explainable AI — Institute for Future Intelligence"},cookie:{Statement:"Clicando Aceptar, autoriza el uso de cookies para mejora la experiencia con Aladdin",Accept:"Aceptar"},aboutUs:{ProductBroughtToYouBy:"Este producto esta hecho por",TermsOfService:"Términos de servicio",PrivacyPolicy:"Política de privacidad",Software:"Programa",Content:"Contenido",Research:"Investigación",Support:"Ayuda",Acknowledgment:"Agradecimientos",FundingInformation:"La National Science Foundation (NSF) proporcionó generosamente fondos para la investigación y el desarrollo de este producto a través de las subvenciones con número #2105695, #2131097, y #2301164. Sin embargo, todas las opiniones, hallazgos y conclusiones o recomendaciones expresados en este producto pertenecen a los autores y no reflejan necesariamente los puntos de vista de la NSF.",Contact:"Para más información, por favor contacte con Charles Xie (charles@intofuture.org).",Translators:"Translators"},word:{Mute:"Mute",BrandName:"Brand Name",Name:"Name",Refresh:"Refresh",LastUpdate:"Last Update",Small:"Small",Medium:"Medium",Large:"Large",Design:"Design",Information:"Information",Type:"Type",Text:"Text",FontSize:"Font Size",FontColor:"Font Color",Model:"Model",Models:"Models",Upload:"Upload",ClickCount:"Click Count",Share:"Share",AlreadyLike:"Already like",Like:"Like",MustLogInToLike:"Must log in to like",AllRightsReserved:"Todos los derechos reservados",MeterAbbreviation:"m",VoltAbbreviation:"V",AmpereAbbreviation:"A",WattAbbreviation:"W",Version:"Versión",VersionInitial:"V",Options:"Opciones",Maximum:"Maximum",Minimum:"Minimum",MaximumNumber:"Número máximo",MinimumNumber:"Minimum Number",MaximumValue:"Maximum Value",MinimumValue:"Minimum Value",Or:"O",None:"Ninguno",High:"High",Partial:"Partial",Teacher:"Profesor",Class:"Clase",Total:"Total",Leaderboard:"Leaderboard",Latest:"Latest",Range:"Rango",SIUnit:"SI Unit",USUnit:"US Unit",ThermalTransmittance:"Thermal Transmittance",ThermalResistance:"Thermal Resistance",UValue:"U-Value",RValue:"R-Value",VolumetricHeatCapacity:"Volumetric Heat Capacity",Press:"Press",Open:"Abrir",Save:"Guardar",SaveAsImage:"Guardar como imagen",SaveAsCsv:"Save as CSV",Update:"Actualizar",Paste:"Pegar",Copy:"Copiar",Cut:"Cortar",Delete:"Eliminar",Add:"Add",Lock:"Cerrar con llave",Translucent:"Translucent",Transparency:"Transparency",Color:"Color",Pattern:"Pattern",Texture:"Textura",Size:"Tamaño",Thickness:"Grosor",Yes:"Sí",No:"No",NoAndDoNotAskAgain:"No and don't ask again",OK:"OK",Cancel:"Cancelar",Apply:"Aplicar",Close:"Cerrar",ApplyTo:"Aplicar a",Run:"Run",Pause:"Pause",Resume:"Resume",Clear:"Limpiar",Warning:"Aviso",Caution:"Caution",Reminder:"Reminder",Length:"Longitud",Width:"Ancho",Height:"Altura",Radius:"Radius",Angle:"Ángulo",Azimuth:"Azimut",Coordinates:"Coordinates",Weather:"Tiempo",Show:"Mostrar",Animate:"Animar",Date:"Fecha",Time:"Tiempo",Title:"Título",Owner:"Propietario",Action:"Acción",Rename:"Renombrar",Location:"Location",Latitude:"Latitud",Month:"Mes",Day:"Día",Hour:"Hora",Daylight:"Luz solar",Radiation:"Radiación",Temperature:"Temperatura",kWh:"kWh",dollar:"dollar",MeterPerSecond:"m/s",NorthInitial:"N",SouthInitial:"S",EastInitial:"E",WestInitial:"O",Fixed:"Fixed",Elements:"Elements",Energy:"Energy",Unknown:"Unknown",Label:"Label",Description:"Description",NoDescription:"No description",MaximumCharacters:"Maximum characters",Author:"Author",Publisher:"Publisher",Building:"Building",ResidentialBuilding:"Residential Building",CommercialBuilding:"Commercial Building",SchoolBuilding:"School Building",TouristAttraction:"Tourist Attraction",UnderConstruction:"Under Construction",Photovoltaic:"Photovoltaic",WindPower:"Wind Power",ColocationProjects:"Colocation Projects",Anonymous:"Anonymous",Nickname:"Nickname",Pin:"Pin",Unpin:"Unpin"},shared:{NoTexture:"Sin textura",FoundationElement:"Bases",CuboidElement:"Cuboide",PolygonElement:"Polígon",SensorElement:"Sensor",SolarPanelElement:"Panel solar",SolarWaterHeaterElement:"Solar Water Heater",ParabolicDishElement:"Parabolic Dish",ParabolicTroughElement:"Parabolic Trough",FresnelReflectorElement:"Fresnel Reflector",HeliostatElement:"Heliostat",WindTurbineElement:"Wind Turbine",LightElement:"Light",ElementLocked:"Bloqueado",ModelType:"Model Type",OutputBreakdown:"Breakdown",MoreResults:"More Results"},message:{DoNotShowAgain:"Don't show again",NewVersionAvailable:"A new version is available",CalculationMayBeSlowDoYouWantToContinue:"Calculation may be slow. Do you want to continue?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"Increase solar radiation heatmap grid cell size to speed up",ModelNotFound:"Model not found",CannotSignIn:"Cannot sign in",CannotSignOut:"Cannot sign out",YourAccountWasCreated:"Your account was created.",CannotCreateAccount:"Cannot create an account",YourAccountSettingsWereSaved:"Your account settings were saved.",CannotSaveYourAccountSettings:"Cannot save your account settings",CannotSaveYourFileToCloud:"Cannot save your file to the cloud",CannotCreateNewProject:"Cannot create a new project",CannotCreateNewProjectWithoutTitle:"Cannot create a new project without a title",CannotOpenYourProjects:"Cannot open your projects",CannotOpenProject:"Cannot open the project",CannotDeleteProject:"Cannot delete the project",CannotRenameProject:"Cannot rename the project",CannotAddDesignToProject:"Cannot add this design to the project",CannotAddDesignToProjectOwnedByOthers:"Cannot add this design to a project owned by others",DesignRemovedFromProject:"The design was successfully removed from the project",CannotRemoveDesignFromProject:"Cannot remove this design from the project",CannotUpdateProject:"Cannot update the project",CannotFetchProjectData:"Cannot fetch project data",TitleUsedChooseDifferentOne:"This title has been used. Choose a different one",CloudFileWithTitleExistsDoYouWantToOverwrite:"A cloud file with the title exists. Do you want to overwrite it?",CloudFileNotFound:"The cloud file was not found",CannotLoadModelsOnMap:"Cannot load models on map",CannotLoadLeaderboard:"Cannot load leaderboard",CannotPublishModelOnMap:"Cannot publish model on map",CannotLikeModelFromMap:"Cannot like model from map",CannotDeleteModelFromMap:"Cannot delete model from map",ModelDeletedFromMap:"Model is deleted from map",DoYouWantToDeleteModelFromMap:"Do you want to delete the model from map?",CannotOpenCloudFile:"Cannot open the cloud file",CannotReadCloudFile:"Cannot read the cloud file",CannotWriteCloudFile:"Cannot write the cloud file",CloudFileCopied:"Cloud file copied",CannotOpenCloudFolder:"Cannot open your cloud folder",CannotDeleteCloudFile:"Cannot delete the cloud file",CannotRenameCloudFile:"Cannot rename the cloud file",DoYouWantToSaveChanges:"¿Quieres guardar los cambios?",DoYouWantToUpdateDesign:"Do you want to update this design?",NotApplicableToSelectedAction:"No se aplica a la acción seleccionada",ThisElementIsLocked:"Este elemento está bloqueado",ThisCannotBeUndone:"Esto no se puede deshacer",AzimuthOfNorthIsZero:"Azimut del norte es 0°",CounterclockwiseAzimuthIsPositive:"Hacia la izquierda es positivo",SouthFacingIsZero:"South-facing is 0°",ClockwiseRotationIsPositive:"Clockwise is positive",MoveCancelledBecauseOfOverlap:"Move cancelled because of overlap.",MoveOutsideBoundaryCancelled:"Move outside the boundary cancelled.",RotationCancelledBecauseOfOverlap:"Rotation cancelled because of overlap.",RotationOutsideBoundaryCancelled:"Rotation outside the boundary cancelled.",ResizingCancelledBecauseOfOverlap:"Resizing cancelled because of overlap.",ResizingOutsideBoundaryCancelled:"Resizing outside the boundary cancelled.",CannotPasteOutsideBoundary:"Cannot paste outside this surface.",CannotPasteBecauseOfOverlap:"Cannot paste because of overlap.",CannotMoveObjectTooFar:"Cannot move object too far.",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"Existing solar panels will be removed before applying the new layout.",DoYouWantToContinue:"Do you want to continue?",SolarPanelsCannotIntersectWithGround:"Solar panels cannot intersect with the ground.",SolarPanelsCannotOverlapWithOneAnother:"Solar panels cannot overlap with one another.",ScreenshotSaved:"A screenshot was saved.",CsvFileSaved:"A CSV file was saved.",SimulationStarted:"Simulation started.",SimulationCompleted:"Simulation completed.",SimulationAborted:"Simulation aborted.",SimulationPaused:"Simulation paused.",CancelSimulation:"Cancel simulation",PauseSimulation:"Pause simulation",ResumeSimulation:"Resume simulation",SimulationWillNotStartDueToErrors:"Simulation will not start due to errors",SimulationWillStartDespiteWarnings:"Simulation will start despite warnings.",EvolutionStarted:"Evolution started.",EvolutionCompleted:"Evolution completed.",EvolutionAborted:"Evolution aborted.",EvolutionPaused:"Evolution paused.",EncounterEvolutionError:"Encountered an evolution error.",CancelEvolution:"Cancel evolution",PauseEvolution:"Pause evolution",ResumeEvolution:"Resume evolution",ConvergenceThresholdHasBeenReached:"The convergence threshold has been reached.",MaximumNumberOfGenerationsHasBeenReached:"The maximum number of generations has been reached.",MaximumNumberOfStepsHasBeenReached:"The maximum number of steps has been reached.",ObjectiveFunctionTypeError:"The current objective function is not supported by this operation. Please start from the menu.",WallsAreNotAtSameHeight:"Walls are not at the same height.",WallsAreNotPerpendicular:"Walls are not perpendicular.",WallsAreNotConnected:"Walls are not connected.",WallsNumberNeedToBeFour:"The number of walls needs to be four.",BuildingContainsEmptyWall:"Building contains one or more empty wall.",BuildingRoofMissing:"Building has a missing roof.",UnknownErrors:"Unknown errors.",SigningOutAnonymousAccount:"Are you sure you want to sign out? This anonymous account will be lost.",SigningInAnonymousAccount:"Are you sure you want to sign in anonymously? An anonymous account will be lost if you sign out. It should be used only for temporary purposes and on the same computer."},menu:{AnalysisOptions:"Analysis Options",option:{GridCellSize:"Grid Cell Size",SamplingFrequency:"Frecuencia de muestreo",TimesPerHour:"Veces per hora",DaysPerYear:"Days per Year"},mainMenu:"Menu principal",cloudMenu:"Menú en la nube",projectSubMenu:"Project",project:{CreateNewProject:"Create New Project",OpenProject:"Open Project",SaveProject:"Save Project",SaveProjectAs:"Save Project As",YouMustLogInToCreateProject:"You must log in to create a new project",YouMustLogInToOpenProject:"You must log in to open a project"},fileSubMenu:"Archivo",file:{CreateNewFile:"Crear nuevo archivo",OpenLocalFile:"Abrir archivo local",SaveAsLocalFile:"Guardar como archivo local",SavingAbortedMustHaveValidFileName:"!Error guardando! Debes tener un nombre de archivo válido",OpenCloudFile:"Abrir archivo en la nube",SaveCloudFile:"Guardar archivo en la nube",SaveAsCloudFile:"Guardar como archivo en la nube",SavingAbortedMustHaveValidTitle:"!Error guardando! Debes tener un título válido para el archivo en la nube",ToSaveYourWorkPleaseSignIn:"Para guardar tu trabajo, por favor regístrese.",TakeScreenshot:"Hacer captura de pantalla",UseCloudFileName:"Use Cloud File Name",PublishOnModelsMap:"Publish on Models Map",PublishedOnModelsMap:"Your model has been published on the Models Map",UpdatedOnModelsMap:"Your model has been updated on the Models Map",YouMustLogInToPublishYourModel:"You must log in to publish your model",YouCannotPublishAModelThatYouDoNotOwn:"You cannot publish a model that you do not own",YouMustSaveModelOnCloudBeforePublishingIt:"You must save the model on the cloud before publishing it"},editSubMenu:"Editar",edit:{Undo:"Deshacer",Redo:"Repetir",Undone:"Undone"},viewSubMenu:"Vista",view:{ModelTree:"Model Tree",NavigationView:"Navigation View",TwoDimensionalView:"Vista 2D",ResetView:"Resetear",ZoomIn:"Acercar",ZoomOut:"Alejar",AutoRotate:"Auto rotación",ShowShadow:"Mostrar sombra",ShowSurfaceShininess:"Show Surface Shininess",TranslucentFloatingWindows:"Translucent Floating Windows",accessoriesSubMenu:"Accessories",accessories:{SiteInformation:"Información del sitio",DesignInformation:"Información de diseño",Instruction:"Instrucción",StickyNote:"Nota adhesiva",Note:"Nota"}},settingsSubMenu:"Settings",settings:{WeatherData:"Datos del tiempo",DiurnalTemperature:"Diurnal Temperature",Heliodon:"Heliodon",SunAndTime:"Sun & Time",CustomSolarPanels:"Custom Solar Panels",CustomizeSolarPanel:"Customize Solar Panel"},benchmarksSubMenu:"Benchmarks",benchmarks:{SolarRadiationPredictionVsMeasurement:"Solar Radiation Prediction vs. Measurement",BESTESTCase600:"Building Energy Simulation Test: BESTEST Case 600",BESTESTCase610:"Building Energy Simulation Test: BESTEST Case 610",BESTESTCase620:"Building Energy Simulation Test: BESTEST Case 620",BESTESTCase630:"Building Energy Simulation Test: BESTEST Case 630"},graph:{LineWidth:"Line Width",SymbolSize:"Symbol Size",BarCategoryGap:"Bar Category Gap",ShowHorizontalGridLines:"Show Horizontal Grid Lines",ShowVerticalGridLines:"Show Vertical Grid Lines"},analysisSubMenu:"Análisis",physicsSubMenu:"Physics",physics:{DailySolarRadiationHeatmap:"Daily Solar Radiation Heatmap",SolarRadiationHeatmapOptions:"Solar Radiation Heatmap Options",SolarRadiationHeatmapGridCellSize:"Solar Radiation Heatmap Grid Cell Size",SolarRadiationHeatmapMaxValue:"Solar Radiation Heatmap Maximum Value",SolarRadiationHeatmapNoAnimation:"No Animation for Static Model",ReflectionHeatmap:"Reflection Heatmap"},sensorSubMenu:"Sensores",sensor:{CollectDailyData:"Recoger datos diarios",CollectYearlyData:"Recoger datos anuales",SensorSimulationNoAnimation:"No Animation for Collecting Sensor Data"},buildingSubMenu:"Building",building:{AnalyzeDailyBuildingEnergy:"Analyze Daily Building Energy",AnalyzeYearlyBuildingEnergy:"Analyze Yearly Building Energy",EnergyAnalysisOptions:"Energy Analysis Options",EnergyGridCellSize:"Energy Grid Cell Size",BuildingEnergySimulationNoAnimation:"No Animation for Building Energy Simulation"},solarPanelSubMenu:"Paneles solares",solarPanel:{AnalyzeDailyYield:"Analizar el rendimiento diario",AnalyzeYearlyYield:"Analizar el rendimiento anual",AnalyzeVisibility:"Analyze Visibility",PanelDiscretization:"Discretización del panel",Exact:"Exacto",Approximate:"Aproximado",EnergyGridCellSize:"Energy Grid Cell Size",VisibilityGridCellSize:"View Factor Grid Cell Size",EnergyAnalysisOptions:"Energy Analysis Options",VisibilityAnalysisOptions:"Visibility Analysis Options",SolarPanelSimulationNoAnimation:"No Animation for Solar Panel Simulation"},parabolicTroughSubMenu:"Parabolic Trough",parabolicTrough:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},parabolicDishSubMenu:"Parabolic Dish",parabolicDish:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},fresnelReflectorSubMenu:"Fresnel Reflector",fresnelReflector:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},heliostatSubMenu:"Heliostat",heliostat:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},solarUpdraftTowerSubMenu:"Solar Updraft Tower",solarUpdraftTower:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield",SolarUpdraftTowerSimulationNoAnimation:"No Animation for Solar Updraft Tower Simulation"},tutorialsSubMenu:"Tutorials",solarEnergyScienceSubMenu:"Solar Science",solarEnergyScienceTutorials:{SunAngles:"Ángulos solares relativos a un observador en el suelo",InsolationAndClimate:"Insolation and Climate",SolarRadiationToBox:"Radiación solar a una caja"},buildingScienceSubMenu:"Building Science",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"Thermal Envelope vs. Building Envelope",EffectOfSizeOnBuildingEnergy:"Effect of Size on Building Energy",EffectOfOrientationOnBuildingEnergy:"Effect of Orientation on Building Energy",EffectOfInsulationOnBuildingEnergy:"Effect of Insulation on Building Energy",EffectOfRoofColorOnBuildingEnergy:"Effect of Roof Color on Building Energy",EffectOfEavesOverhangLengthOnBuildingEnergy:"Effect of Eaves Overhang Length on Building Energy",EffectOfWindowSHGCOnBuildingEnergy:"Effect of Window Solar Heat Gain on Building Energy",EffectOfThermostatSetpointOnBuildingEnergy:"Effect of Thermostat Setpoint on Building Energy",EffectOfProgrammableThermostatOnBuildingEnergy:"Effect of Programmable Thermostat on Building Energy",EffectOfSolarPanelsOnBuildingEnergy:"Effect of Solar Panels on Building Energy",EffectOfGroundTemperatureOnBuildingEnergy:"Effect of Ground Temperature on Building Energy",EffectOfTreesOnBuildingEnergy:"Effect of Trees on Building Energy"},buildingDesignSubMenu:"Building Design",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"Cape Cod Style House with Shed Dormer",MansardRoofWithDormers:"Mansard Roof with Dormers",GableRoofVsHipRoof:"Gable Roof vs. Hip Roof",ColonialVsSaltbox:"Colonial vs. Saltbox",GambrelRoofVsMansardRoof:"Gambrel Roof vs. Mansard Roof",CombinationRoofVsBonnetRoof:"Combination Roof vs. Bonnet Roof",DutchGableRoof:"Dutch Gable Roof",GableAndValleyRoof:"Gable and Valley Roof",ClerestoryRoof:"Clerestory Roof",MonitorRoof:"Monitor Roof",AFrameHouse:"A-Frame House",HalfTimberedHouse:"Half-Timbered House",AllBasicRoofTypes:"All Basic Roof Types"},photovoltaicSolarPowerSubMenu:"Photovoltaic Solar Power",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"Effect of Tilt Angle",EffectOfAzimuthOfSolarPanel:"Effect of Azimuth",SolarPanelTypes:"Solar Panel Types",DefineYourOwnSolarPanels:"Define Your Own Solar Panels",VerticalBifacialSolarPanels:"Vertical Bifacial Solar Panels",CompareMonofacialAndBifacialSolarPanels:"Monofacial vs. Bifacial Solar Panels",SolarTrackers:"Seguidores solares",CoveringGroundWithSolarPanels:"Why Just Covering the Ground with Solar Panels is not a Good Idea",InterRowSpacingOfSolarPanelArray:"Effect of Inter-Row Spacing in a Solar Panel Array",EffectOfOrientationOfSolarPanels:"Effect of Orientation of Solar Panels",SolarPanelArrayAutomaticLayout:"Solar Panel Array Automatic Layout"},concentratedSolarPowerSubMenu:"Concentrated Solar Power",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"Effect of Azimuth of a Parabolic Trough",EffectOfLatusRectumOfParabolicTrough:"Effect of Latus Rectum of a Parabolic Trough",FocusSunlightWithParabolicDish:"Focus Sunlight with a Parabolic Dish",LinearFresnelReflectors:"Linear Fresnel Reflectors",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"Effect of Absorber Pipe Height for Linear Fresnel Reflectors",EffectOfAzimuthOfLinearFresnelReflectors:"Effect of Azimuth of Linear Fresnel Reflectors",LinearFresnelReflectorsWithTwoAbsorbers:"Linear Fresnel Reflectors with Two Absorbers",CosineEfficiencyOfHeliostats:"Cosine Efficiency of Heliostats",ShadowingAndBlockingOfHeliostats:"Shadowing and Blocking of Heliostats",EffectSolarPowerTowerHeight:"Effect of Solar Power Tower Height",SolarPowerTower:"Solar Power Tower"},otherTypesOfSolarPowerSubMenu:"Other Types of Solar Power",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"Solar Water Heaters",SolarUpdraftTower:"Solar Updraft Tower"},windPowerSubMenu:"Wind Power",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"Effect of Blade Number of Wind Turbine",EffectOfPitchAngleOfWindTurbineBlades:"Effect of Pitch Angle of Wind Turbine Blades",BirdSafeBladeDesign:"Bird-Safe Blade Design",OffshoreWindFarm:"Offshore Wind Farm"},colocationSubMenu:"Colocation",colocationTutorials:{AgricultureSolarWindColocation:"Agriculture-Solar-Wind Colocation"},generativeDesignSubMenu:"Generative Design",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Monofacial Solar Panel Array",BifacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Bifacial Solar Panel Array",SolarPanelArrayInterRowSpacing:"The Inter-Row Spacing of a Solar Panel Array",OutputOfSolarPanelArrayInDifferentPlaces:"The Output of a Solar Panel Array in Different Places",SimpleSolarFarmParetoFront:"The Pareto Front for Designing a Simple Solar Farm"},examplesSubMenu:"Ejemplos",solarEnergySubMenu:"Energía Solar",solarEnergyExamples:{SunBeamAndHeliodon:"Rayo de sol y heliodon",RooftopSolarPanels:"Rooftop Solar Panels",NevadaSolarOneParabolicTroughArray:"Nevada Solar One Parabolic Trough Array",TooeleParabolicDishArray:"Tooele Parabolic Dish Array",PS10SolarPowerTower:"PS10 Solar Power Tower",TucsonLinearFresnelReflectors:"Tucson Linear Fresnel Reflectors",SolarCanopyFormFactors:"Solar Canopy Form Factors",SolarCanopyOverBleachers:"Solar Canopy Over Bleachers",SolarCanopyOverGarage:"Solar Canopy Over Garage",SolarBusStop:"Solar Bus Stop",SolarFacadeTesla:"Tesla Solar Façade",BuildingIntegratedPhotovoltaics:"Building-Integrated Photovoltaics",Floatovoltaics:"Floatovoltaics",Agrivoltaics:"Agrivoltaics",VegetativeBuffer:"Vegetative Buffer",RainbowSwashSolarFarmBostonMA:"Rainbow Swash Solar Farm in Boston, MA",MickeyMouseSolarFarmOrlandoFL:"Mickey Mouse Solar Farm in Orlando, FL",SolarPanelsOverCanalBakersfieldCA:"Hypothetical Solar Panels Over Canal in Bakersfield, CA",SolarNoiseBarrierLexingtonMA:"Hypothetical Solar Noise Barrier in Lexington, MA",HSATSolarTrackersRaleighNC:"Horizontal Single Axis Trackers (HSAT) in Raleigh, NC",AADATSolarTrackersLancasterCA:"Azimuth–Altitude Dual Axis Trackers (AADAT) in Lancaster, CA",SolarUpdraftTowerInCity:"Solar Updraft Tower in City"},builtEnvironmentSubMenu:"Built Environment",residentialBuildingsSubMenu:"Residential Buildings",residentialBuildingExamples:{ColonialHouse:"Colonial House",DutchColonialHouse:"Dutch Colonial House",TShapedHouse:"T-Shaped House",CapeCodHouseWithGarage:"Cape Cod House with Garage",Solarium:"Solarium",Church1:"Church 1",Cathedral1:"Cathedral 1",Cathedral2:"Cathedral 2",Mosque1:"Mosque 1",AdobeTaosHouse:"Adobe Taos House",RanchHouse:"Ranch House",BonnetHouse:"Bonnet House",BarnStyleHouse:"Barn Style House",ModernHouse:"Modern House",ButterflyRoofHouse:"Butterfly Roof House"},commercialBuildingsSubMenu:"Commercial Buildings",commercialBuildingExamples:{WhiteHouse:"White House",HaroldWashingtonCollege:"Harold Washington College",BilimMersinTurkiye:"BILIM, Mersin, Turkiye",SpanishStyleHotel:"Spanish Style Hotel",ApartmentBuilding:"Apartment Building",OfficeBuilding:"Edificio de oficinas",Hotel:"Hotel"},buildingComplexesSubMenu:"Building Complexes",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"South Burlington High School, VT",MescaleroApacheSchoolNewMexico:"Mescalero Apache School, NM"},urbanPlanningSubMenu:"Urban Planning",urbanPlanningExamples:{CityBlockHeatmap:"City Block Heatmap",ChicagoSkyline:"Chicago Skyline"},otherBuildingsSubMenu:"Other Buildings",otherBuildingExamples:{Greenhouse:"Greenhouse",Pavilion:"Pavilion in a Park",OctagonalPagoda:"Octagonal Pagoda",OceanFront:"Ocean Front",EgyptianPyramids:"Egyptian Pyramids",MayanPyramid:"Mayan Pyramid",SiOSePol:"Si-o-se-pol",StackedCuboids:"Stacked Cuboids"},artificialIntelligenceSubMenu:"Artificial Intelligence",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"Optimizing the Tilt Angle of a Solar Panel Row",OptimizingTiltAnglesOfMultipleSolarPanelRows:"Optimizing the Tilt Angles of Multiple Solar Panel Rows",SolarFarmGenerativeDesign:"Solar Farm Generative Design",SolarFarmGenerativeDesignWithBlock:"Solar Farm Generative Design in the Presence of a Block",FitchburgSolarFarmGenerativeDesign:"Fitchburg Solar Farm Generative Design"},languageSubMenu:"Idioma",publicSubMenu:"Public",ModelsGallery:"Models Gallery",ModelsMap:"Models Map",AboutUs:"Sobre nosotros"},HVACMenu:{BuildingHVACSystem:"Building HVAC System",ID:"ID",TemperatureTolerance:"Tolerance",TemperatureToleranceExplanation:`Heater will not run if the lowest outside temperature of the day is higher than the setpoint minus this threshold. @@ -3452,7 +3452,7 @@ void main() { #include #include #include -}`,pa={alphahash_fragment:X3t,alphahash_pars_fragment:J3t,alphamap_fragment:K3t,alphamap_pars_fragment:$3t,alphatest_fragment:q3t,alphatest_pars_fragment:Q3t,aomap_fragment:Z3t,aomap_pars_fragment:e6t,begin_vertex:t6t,beginnormal_vertex:n6t,bsdfs:o6t,iridescence_fragment:r6t,bumpmap_pars_fragment:i6t,clipping_planes_fragment:a6t,clipping_planes_pars_fragment:l6t,clipping_planes_pars_vertex:s6t,clipping_planes_vertex:c6t,color_fragment:u6t,color_pars_fragment:d6t,color_pars_vertex:f6t,color_vertex:h6t,common:p6t,cube_uv_reflection_fragment:g6t,defaultnormal_vertex:m6t,displacementmap_pars_vertex:y6t,displacementmap_vertex:A6t,emissivemap_fragment:w6t,emissivemap_pars_fragment:x6t,colorspace_fragment:v6t,colorspace_pars_fragment:b6t,envmap_fragment:S6t,envmap_common_pars_fragment:T6t,envmap_pars_fragment:P6t,envmap_pars_vertex:C6t,envmap_physical_pars_fragment:N6t,envmap_vertex:R6t,fog_vertex:H6t,fog_pars_vertex:M6t,fog_fragment:I6t,fog_pars_fragment:z6t,gradientmap_pars_fragment:D6t,lightmap_fragment:E6t,lightmap_pars_fragment:k6t,lights_lambert_fragment:F6t,lights_lambert_pars_fragment:L6t,lights_pars_begin:W6t,lights_toon_fragment:U6t,lights_toon_pars_fragment:j6t,lights_phong_fragment:B6t,lights_phong_pars_fragment:Y6t,lights_physical_fragment:O6t,lights_physical_pars_fragment:_6t,lights_fragment_begin:V6t,lights_fragment_maps:G6t,lights_fragment_end:X6t,logdepthbuf_fragment:J6t,logdepthbuf_pars_fragment:K6t,logdepthbuf_pars_vertex:$6t,logdepthbuf_vertex:q6t,map_fragment:Q6t,map_pars_fragment:Z6t,map_particle_fragment:eAt,map_particle_pars_fragment:tAt,metalnessmap_fragment:nAt,metalnessmap_pars_fragment:oAt,morphcolor_vertex:rAt,morphnormal_vertex:iAt,morphtarget_pars_vertex:aAt,morphtarget_vertex:lAt,normal_fragment_begin:sAt,normal_fragment_maps:cAt,normal_pars_fragment:uAt,normal_pars_vertex:dAt,normal_vertex:fAt,normalmap_pars_fragment:hAt,clearcoat_normal_fragment_begin:pAt,clearcoat_normal_fragment_maps:gAt,clearcoat_pars_fragment:mAt,iridescence_pars_fragment:yAt,opaque_fragment:AAt,packing:wAt,premultiplied_alpha_fragment:xAt,project_vertex:vAt,dithering_fragment:bAt,dithering_pars_fragment:SAt,roughnessmap_fragment:TAt,roughnessmap_pars_fragment:PAt,shadowmap_pars_fragment:CAt,shadowmap_pars_vertex:RAt,shadowmap_vertex:HAt,shadowmask_pars_fragment:MAt,skinbase_vertex:IAt,skinning_pars_vertex:zAt,skinning_vertex:DAt,skinnormal_vertex:EAt,specularmap_fragment:kAt,specularmap_pars_fragment:FAt,tonemapping_fragment:LAt,tonemapping_pars_fragment:WAt,transmission_fragment:NAt,transmission_pars_fragment:UAt,uv_pars_fragment:jAt,uv_pars_vertex:BAt,uv_vertex:YAt,worldpos_vertex:OAt,background_vert:_At,background_frag:VAt,backgroundCube_vert:GAt,backgroundCube_frag:XAt,cube_vert:JAt,cube_frag:KAt,depth_vert:$At,depth_frag:qAt,distanceRGBA_vert:QAt,distanceRGBA_frag:ZAt,equirect_vert:e4t,equirect_frag:t4t,linedashed_vert:n4t,linedashed_frag:o4t,meshbasic_vert:r4t,meshbasic_frag:i4t,meshlambert_vert:a4t,meshlambert_frag:l4t,meshmatcap_vert:s4t,meshmatcap_frag:c4t,meshnormal_vert:u4t,meshnormal_frag:d4t,meshphong_vert:f4t,meshphong_frag:h4t,meshphysical_vert:p4t,meshphysical_frag:g4t,meshtoon_vert:m4t,meshtoon_frag:y4t,points_vert:A4t,points_frag:w4t,shadow_vert:x4t,shadow_frag:v4t,sprite_vert:b4t,sprite_frag:S4t},xr={common:{diffuse:{value:new ir(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ma},alphaMap:{value:null},alphaMapTransform:{value:new ma},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ma}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ma}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ma}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ma},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ma},normalScale:{value:new _t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ma},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ma}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ma}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ma}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ir(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ir(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ma},alphaTest:{value:0},uvTransform:{value:new ma}},sprite:{diffuse:{value:new ir(16777215)},opacity:{value:1},center:{value:new _t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ma},alphaMap:{value:null},alphaMapTransform:{value:new ma},alphaTest:{value:0}}},i5={basic:{uniforms:mp([xr.common,xr.specularmap,xr.envmap,xr.aomap,xr.lightmap,xr.fog]),vertexShader:pa.meshbasic_vert,fragmentShader:pa.meshbasic_frag},lambert:{uniforms:mp([xr.common,xr.specularmap,xr.envmap,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.fog,xr.lights,{emissive:{value:new ir(0)}}]),vertexShader:pa.meshlambert_vert,fragmentShader:pa.meshlambert_frag},phong:{uniforms:mp([xr.common,xr.specularmap,xr.envmap,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.fog,xr.lights,{emissive:{value:new ir(0)},specular:{value:new ir(1118481)},shininess:{value:30}}]),vertexShader:pa.meshphong_vert,fragmentShader:pa.meshphong_frag},standard:{uniforms:mp([xr.common,xr.envmap,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.roughnessmap,xr.metalnessmap,xr.fog,xr.lights,{emissive:{value:new ir(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pa.meshphysical_vert,fragmentShader:pa.meshphysical_frag},toon:{uniforms:mp([xr.common,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.gradientmap,xr.fog,xr.lights,{emissive:{value:new ir(0)}}]),vertexShader:pa.meshtoon_vert,fragmentShader:pa.meshtoon_frag},matcap:{uniforms:mp([xr.common,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.fog,{matcap:{value:null}}]),vertexShader:pa.meshmatcap_vert,fragmentShader:pa.meshmatcap_frag},points:{uniforms:mp([xr.points,xr.fog]),vertexShader:pa.points_vert,fragmentShader:pa.points_frag},dashed:{uniforms:mp([xr.common,xr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pa.linedashed_vert,fragmentShader:pa.linedashed_frag},depth:{uniforms:mp([xr.common,xr.displacementmap]),vertexShader:pa.depth_vert,fragmentShader:pa.depth_frag},normal:{uniforms:mp([xr.common,xr.bumpmap,xr.normalmap,xr.displacementmap,{opacity:{value:1}}]),vertexShader:pa.meshnormal_vert,fragmentShader:pa.meshnormal_frag},sprite:{uniforms:mp([xr.sprite,xr.fog]),vertexShader:pa.sprite_vert,fragmentShader:pa.sprite_frag},background:{uniforms:{uvTransform:{value:new ma},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pa.background_vert,fragmentShader:pa.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:pa.backgroundCube_vert,fragmentShader:pa.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pa.cube_vert,fragmentShader:pa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pa.equirect_vert,fragmentShader:pa.equirect_frag},distanceRGBA:{uniforms:mp([xr.common,xr.displacementmap,{referencePosition:{value:new ue},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pa.distanceRGBA_vert,fragmentShader:pa.distanceRGBA_frag},shadow:{uniforms:mp([xr.lights,xr.fog,{color:{value:new ir(0)},opacity:{value:1}}]),vertexShader:pa.shadow_vert,fragmentShader:pa.shadow_frag}};i5.physical={uniforms:mp([i5.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ma},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ma},clearcoatNormalScale:{value:new _t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ma},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ma},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ma},sheen:{value:0},sheenColor:{value:new ir(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ma},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ma},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ma},transmissionSamplerSize:{value:new _t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ma},attenuationDistance:{value:0},attenuationColor:{value:new ir(0)},specularColor:{value:new ir(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ma},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ma},anisotropyVector:{value:new _t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ma}}]),vertexShader:pa.meshphysical_vert,fragmentShader:pa.meshphysical_frag};const KY={r:0,b:0,g:0};function T4t(t,e,n,o,r,i,a){const l=new ir(0);let s=i===!0?0:1,c,u,d=null,f=0,p=null;function m(w,x){let C=!1,P=x.isScene===!0?x.background:null;P&&P.isTexture&&(P=(x.backgroundBlurriness>0?n:e).get(P)),P===null?y(l,s):P&&P.isColor&&(y(P,1),C=!0);const A=t.xr.getEnvironmentBlendMode();A==="additive"?o.buffers.color.setClear(0,0,0,1,a):A==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,a),(t.autoClear||C)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),P&&(P.isCubeTexture||P.mapping===zM)?(u===void 0&&(u=new os(new V3(1,1,1),new Z0({name:"BackgroundCubeMaterial",uniforms:sH(i5.backgroundCube.uniforms),vertexShader:i5.backgroundCube.vertexShader,fragmentShader:i5.backgroundCube.fragmentShader,side:js,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(S,v,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=P,u.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.toneMapped=ys.getTransfer(P.colorSpace)!==$s,(d!==P||f!==P.version||p!==t.toneMapping)&&(u.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null)):P&&P.isTexture&&(c===void 0&&(c=new os(new T7(2,2),new Z0({name:"BackgroundMaterial",uniforms:sH(i5.background.uniforms),vertexShader:i5.background.vertexShader,fragmentShader:i5.background.fragmentShader,side:$i,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=P,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=ys.getTransfer(P.colorSpace)!==$s,P.matrixAutoUpdate===!0&&P.updateMatrix(),c.material.uniforms.uvTransform.value.copy(P.matrix),(d!==P||f!==P.version||p!==t.toneMapping)&&(c.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function y(w,x){w.getRGB(KY,kOe(t)),o.buffers.color.setClear(KY.r,KY.g,KY.b,x,a)}return{getClearColor:function(){return l},setClearColor:function(w,x=1){l.set(w),s=x,y(l,s)},getClearAlpha:function(){return s},setClearAlpha:function(w){s=w,y(l,s)},render:m}}function P4t(t,e,n,o){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),i=o.isWebGL2?null:e.get("OES_vertex_array_object"),a=o.isWebGL2||i!==null,l={},s=w(null);let c=s,u=!1;function d(U,W,F,E,L){let j=!1;if(a){const Y=y(E,F,W);c!==Y&&(c=Y,p(c.object)),j=x(U,E,F,L),j&&C(U,E,F,L)}else{const Y=W.wireframe===!0;(c.geometry!==E.id||c.program!==F.id||c.wireframe!==Y)&&(c.geometry=E.id,c.program=F.id,c.wireframe=Y,j=!0)}L!==null&&n.update(L,t.ELEMENT_ARRAY_BUFFER),(j||u)&&(u=!1,T(U,W,F,E),L!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(L).buffer))}function f(){return o.isWebGL2?t.createVertexArray():i.createVertexArrayOES()}function p(U){return o.isWebGL2?t.bindVertexArray(U):i.bindVertexArrayOES(U)}function m(U){return o.isWebGL2?t.deleteVertexArray(U):i.deleteVertexArrayOES(U)}function y(U,W,F){const E=F.wireframe===!0;let L=l[U.id];L===void 0&&(L={},l[U.id]=L);let j=L[W.id];j===void 0&&(j={},L[W.id]=j);let Y=j[E];return Y===void 0&&(Y=w(f()),j[E]=Y),Y}function w(U){const W=[],F=[],E=[];for(let L=0;L=0){const Q=L[_];let oe=j[_];if(oe===void 0&&(_==="instanceMatrix"&&U.instanceMatrix&&(oe=U.instanceMatrix),_==="instanceColor"&&U.instanceColor&&(oe=U.instanceColor)),Q===void 0||Q.attribute!==oe||oe&&Q.data!==oe.data)return!0;Y++}return c.attributesNum!==Y||c.index!==E}function C(U,W,F,E){const L={},j=W.attributes;let Y=0;const O=F.getAttributes();for(const _ in O)if(O[_].location>=0){let Q=j[_];Q===void 0&&(_==="instanceMatrix"&&U.instanceMatrix&&(Q=U.instanceMatrix),_==="instanceColor"&&U.instanceColor&&(Q=U.instanceColor));const oe={};oe.attribute=Q,Q&&Q.data&&(oe.data=Q.data),L[_]=oe,Y++}c.attributes=L,c.attributesNum=Y,c.index=E}function P(){const U=c.newAttributes;for(let W=0,F=U.length;W=0){let G=L[O];if(G===void 0&&(O==="instanceMatrix"&&U.instanceMatrix&&(G=U.instanceMatrix),O==="instanceColor"&&U.instanceColor&&(G=U.instanceColor)),G!==void 0){const Q=G.normalized,oe=G.itemSize,ee=n.get(G);if(ee===void 0)continue;const q=ee.buffer,ae=ee.type,Z=ee.bytesPerElement,ne=o.isWebGL2===!0&&(ae===t.INT||ae===t.UNSIGNED_INT||G.gpuType===Qye);if(G.isInterleavedBufferAttribute){const te=G.data,$=te.stride,le=G.offset;if(te.isInstancedInterleavedBuffer){for(let de=0;de<_.locationSize;de++)S(_.location+de,te.meshPerAttribute);U.isInstancedMesh!==!0&&E._maxInstanceCount===void 0&&(E._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let de=0;de<_.locationSize;de++)A(_.location+de);t.bindBuffer(t.ARRAY_BUFFER,q);for(let de=0;de<_.locationSize;de++)b(_.location+de,oe/_.locationSize,ae,Q,$*Z,(le+oe/_.locationSize*de)*Z,ne)}else{if(G.isInstancedBufferAttribute){for(let te=0;te<_.locationSize;te++)S(_.location+te,G.meshPerAttribute);U.isInstancedMesh!==!0&&E._maxInstanceCount===void 0&&(E._maxInstanceCount=G.meshPerAttribute*G.count)}else for(let te=0;te<_.locationSize;te++)A(_.location+te);t.bindBuffer(t.ARRAY_BUFFER,q);for(let te=0;te<_.locationSize;te++)b(_.location+te,oe/_.locationSize,ae,Q,oe*Z,oe/_.locationSize*te*Z,ne)}}else if(Y!==void 0){const Q=Y[O];if(Q!==void 0)switch(Q.length){case 2:t.vertexAttrib2fv(_.location,Q);break;case 3:t.vertexAttrib3fv(_.location,Q);break;case 4:t.vertexAttrib4fv(_.location,Q);break;default:t.vertexAttrib1fv(_.location,Q)}}}}v()}function R(){k();for(const U in l){const W=l[U];for(const F in W){const E=W[F];for(const L in E)m(E[L].object),delete E[L];delete W[F]}delete l[U]}}function M(U){if(l[U.id]===void 0)return;const W=l[U.id];for(const F in W){const E=W[F];for(const L in E)m(E[L].object),delete E[L];delete W[F]}delete l[U.id]}function D(U){for(const W in l){const F=l[W];if(F[U.id]===void 0)continue;const E=F[U.id];for(const L in E)m(E[L].object),delete E[L];delete F[U.id]}}function k(){N(),u=!0,c!==s&&(c=s,p(c.object))}function N(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:d,reset:k,resetDefaultState:N,dispose:R,releaseStatesOfGeometry:M,releaseStatesOfProgram:D,initAttributes:P,enableAttribute:A,disableUnusedAttributes:v}}function C4t(t,e,n,o){const r=o.isWebGL2;let i;function a(c){i=c}function l(c,u){t.drawArrays(i,c,u),n.update(u,i,1)}function s(c,u,d){if(d===0)return;let f,p;if(r)f=t,p="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[p](i,c,u,d),n.update(u,i,d)}this.setMode=a,this.render=l,this.renderInstances=s}function R4t(t,e,n){let o;function r(){if(o!==void 0)return o;if(e.has("EXT_texture_filter_anisotropic")===!0){const b=e.get("EXT_texture_filter_anisotropic");o=t.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function i(b){if(b==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let l=n.precision!==void 0?n.precision:"highp";const s=i(l);s!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",s,"instead."),l=s);const c=a||e.has("WEBGL_draw_buffers"),u=n.logarithmicDepthBuffer===!0,d=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),f=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_TEXTURE_SIZE),m=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),y=t.getParameter(t.MAX_VERTEX_ATTRIBS),w=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),x=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),P=f>0,A=a||e.has("OES_texture_float"),S=P&&A,v=a?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:i,precision:l,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:m,maxAttributes:y,maxVertexUniforms:w,maxVaryings:x,maxFragmentUniforms:C,vertexTextures:P,floatFragmentTextures:A,floatVertexTextures:S,maxSamples:v}}function H4t(t){const e=this;let n=null,o=0,r=!1,i=!1;const a=new V9,l=new ma,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||o!==0||r;return r=f,o=d.length,p},this.beginShadows=function(){i=!0,u(null)},this.endShadows=function(){i=!1},this.setGlobalState=function(d,f){n=u(d,f,0)},this.setState=function(d,f,p){const m=d.clippingPlanes,y=d.clipIntersection,w=d.clipShadows,x=t.get(d);if(!r||m===null||m.length===0||i&&!w)i?u(null):c();else{const C=i?0:o,P=C*4;let A=x.clippingState||null;s.value=A,A=u(m,f,P,p);for(let S=0;S!==P;++S)A[S]=n[S];x.clippingState=A,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=C}};function c(){s.value!==n&&(s.value=n,s.needsUpdate=o>0),e.numPlanes=o,e.numIntersection=0}function u(d,f,p,m){const y=d!==null?d.length:0;let w=null;if(y!==0){if(w=s.value,m!==!0||w===null){const x=p+y*4,C=f.matrixWorldInverse;l.getNormalMatrix(C),(w===null||w.length0){const c=new LOe(s.height/2);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",r),n(c.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const s=e.get(l);s!==void 0&&(e.delete(l),s.dispose())}function i(){e=new WeakMap}return{get:o,dispose:i}}let zN=class extends EM{constructor(e=-1,n=1,o=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=o,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,o,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=o,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=o-e,a=o+e,l=r+n,s=r-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,l-=u*this.view.offsetY,s=l-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,l,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};const JC=4,zxe=[.125,.215,.35,.446,.526,.582],wv=20,Aae=new zN,Dxe=new ir;let wae=null,xae=0,vae=0;const cv=(1+Math.sqrt(5))/2,AP=1/cv,Exe=[new ue(1,1,1),new ue(-1,1,1),new ue(1,1,-1),new ue(-1,1,-1),new ue(0,cv,AP),new ue(0,cv,-AP),new ue(AP,0,cv),new ue(-AP,0,cv),new ue(cv,AP,0),new ue(-cv,AP,0)];class yde{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,o=.1,r=100){wae=this._renderer.getRenderTarget(),xae=this._renderer.getActiveCubeFace(),vae=this._renderer.getActiveMipmapLevel(),this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,o,r,i),n>0&&this._blur(i,0,0,n),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Lxe(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fxe(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),u.setRenderTarget(r),y&&u.render(m,l),u.render(e,l)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=w}_textureToCubeUV(e,n){const o=this._renderer,r=e.mapping===KA||e.mapping===_8;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Lxe()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fxe());const i=r?this._cubemapMaterial:this._equirectMaterial,a=new os(this._lodPlanes[0],i),l=i.uniforms;l.envMap.value=e;const s=this._cubeSize;$Y(n,0,0,3*s,2*s),o.setRenderTarget(n),o.render(a,Aae)}_applyPMREM(e){const n=this._renderer,o=n.autoClear;n.autoClear=!1;for(let r=1;rwv&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${wv}`);const x=[];let C=0;for(let b=0;bP-JC?r-P+JC:0),v=4*(this._cubeSize-A);$Y(n,S,v,3*A,2*A),s.setRenderTarget(n),s.render(d,Aae)}}function I4t(t){const e=[],n=[],o=[];let r=t;const i=t-JC+1+zxe.length;for(let a=0;at-JC?s=zxe[a-t+JC-1]:a===0&&(s=0),o.push(s);const c=1/(l-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],p=6,m=6,y=3,w=2,x=1,C=new Float32Array(y*m*p),P=new Float32Array(w*m*p),A=new Float32Array(x*m*p);for(let v=0;v2?0:-1,R=[b,T,0,b+2/3,T,0,b+2/3,T+1,0,b,T,0,b+2/3,T+1,0,b,T+1,0];C.set(R,y*m*v),P.set(f,w*m*v);const M=[v,v,v,v,v,v];A.set(M,x*m*v)}const S=new Ni;S.setAttribute("position",new _a(C,y)),S.setAttribute("uv",new _a(P,w)),S.setAttribute("faceIndex",new _a(A,x)),e.push(S),r>JC&&r--}return{lodPlanes:e,sizeLods:n,sigmas:o}}function kxe(t,e,n){const o=new ku(t,e,n);return o.texture.mapping=zM,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function $Y(t,e,n,o,r){t.viewport.set(e,n,o,r),t.scissor.set(e,n,o,r)}function z4t(t,e,n){const o=new Float32Array(wv),r=new ue(0,1,0);return new Z0({name:"SphericalGaussianBlur",defines:{n:wv,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:f2e(),fragmentShader:` +}`,pa={alphahash_fragment:X3t,alphahash_pars_fragment:J3t,alphamap_fragment:K3t,alphamap_pars_fragment:$3t,alphatest_fragment:q3t,alphatest_pars_fragment:Q3t,aomap_fragment:Z3t,aomap_pars_fragment:e6t,begin_vertex:t6t,beginnormal_vertex:n6t,bsdfs:o6t,iridescence_fragment:r6t,bumpmap_pars_fragment:i6t,clipping_planes_fragment:a6t,clipping_planes_pars_fragment:l6t,clipping_planes_pars_vertex:s6t,clipping_planes_vertex:c6t,color_fragment:u6t,color_pars_fragment:d6t,color_pars_vertex:f6t,color_vertex:h6t,common:p6t,cube_uv_reflection_fragment:g6t,defaultnormal_vertex:m6t,displacementmap_pars_vertex:y6t,displacementmap_vertex:A6t,emissivemap_fragment:w6t,emissivemap_pars_fragment:x6t,colorspace_fragment:v6t,colorspace_pars_fragment:b6t,envmap_fragment:S6t,envmap_common_pars_fragment:T6t,envmap_pars_fragment:P6t,envmap_pars_vertex:C6t,envmap_physical_pars_fragment:N6t,envmap_vertex:R6t,fog_vertex:H6t,fog_pars_vertex:M6t,fog_fragment:I6t,fog_pars_fragment:z6t,gradientmap_pars_fragment:D6t,lightmap_fragment:E6t,lightmap_pars_fragment:k6t,lights_lambert_fragment:F6t,lights_lambert_pars_fragment:L6t,lights_pars_begin:W6t,lights_toon_fragment:U6t,lights_toon_pars_fragment:j6t,lights_phong_fragment:B6t,lights_phong_pars_fragment:Y6t,lights_physical_fragment:O6t,lights_physical_pars_fragment:_6t,lights_fragment_begin:V6t,lights_fragment_maps:G6t,lights_fragment_end:X6t,logdepthbuf_fragment:J6t,logdepthbuf_pars_fragment:K6t,logdepthbuf_pars_vertex:$6t,logdepthbuf_vertex:q6t,map_fragment:Q6t,map_pars_fragment:Z6t,map_particle_fragment:eAt,map_particle_pars_fragment:tAt,metalnessmap_fragment:nAt,metalnessmap_pars_fragment:oAt,morphcolor_vertex:rAt,morphnormal_vertex:iAt,morphtarget_pars_vertex:aAt,morphtarget_vertex:lAt,normal_fragment_begin:sAt,normal_fragment_maps:cAt,normal_pars_fragment:uAt,normal_pars_vertex:dAt,normal_vertex:fAt,normalmap_pars_fragment:hAt,clearcoat_normal_fragment_begin:pAt,clearcoat_normal_fragment_maps:gAt,clearcoat_pars_fragment:mAt,iridescence_pars_fragment:yAt,opaque_fragment:AAt,packing:wAt,premultiplied_alpha_fragment:xAt,project_vertex:vAt,dithering_fragment:bAt,dithering_pars_fragment:SAt,roughnessmap_fragment:TAt,roughnessmap_pars_fragment:PAt,shadowmap_pars_fragment:CAt,shadowmap_pars_vertex:RAt,shadowmap_vertex:HAt,shadowmask_pars_fragment:MAt,skinbase_vertex:IAt,skinning_pars_vertex:zAt,skinning_vertex:DAt,skinnormal_vertex:EAt,specularmap_fragment:kAt,specularmap_pars_fragment:FAt,tonemapping_fragment:LAt,tonemapping_pars_fragment:WAt,transmission_fragment:NAt,transmission_pars_fragment:UAt,uv_pars_fragment:jAt,uv_pars_vertex:BAt,uv_vertex:YAt,worldpos_vertex:OAt,background_vert:_At,background_frag:VAt,backgroundCube_vert:GAt,backgroundCube_frag:XAt,cube_vert:JAt,cube_frag:KAt,depth_vert:$At,depth_frag:qAt,distanceRGBA_vert:QAt,distanceRGBA_frag:ZAt,equirect_vert:e4t,equirect_frag:t4t,linedashed_vert:n4t,linedashed_frag:o4t,meshbasic_vert:r4t,meshbasic_frag:i4t,meshlambert_vert:a4t,meshlambert_frag:l4t,meshmatcap_vert:s4t,meshmatcap_frag:c4t,meshnormal_vert:u4t,meshnormal_frag:d4t,meshphong_vert:f4t,meshphong_frag:h4t,meshphysical_vert:p4t,meshphysical_frag:g4t,meshtoon_vert:m4t,meshtoon_frag:y4t,points_vert:A4t,points_frag:w4t,shadow_vert:x4t,shadow_frag:v4t,sprite_vert:b4t,sprite_frag:S4t},xr={common:{diffuse:{value:new ir(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ma},alphaMap:{value:null},alphaMapTransform:{value:new ma},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ma}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ma}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ma}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ma},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ma},normalScale:{value:new _t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ma},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ma}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ma}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ma}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ir(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ir(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ma},alphaTest:{value:0},uvTransform:{value:new ma}},sprite:{diffuse:{value:new ir(16777215)},opacity:{value:1},center:{value:new _t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ma},alphaMap:{value:null},alphaMapTransform:{value:new ma},alphaTest:{value:0}}},i5={basic:{uniforms:mp([xr.common,xr.specularmap,xr.envmap,xr.aomap,xr.lightmap,xr.fog]),vertexShader:pa.meshbasic_vert,fragmentShader:pa.meshbasic_frag},lambert:{uniforms:mp([xr.common,xr.specularmap,xr.envmap,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.fog,xr.lights,{emissive:{value:new ir(0)}}]),vertexShader:pa.meshlambert_vert,fragmentShader:pa.meshlambert_frag},phong:{uniforms:mp([xr.common,xr.specularmap,xr.envmap,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.fog,xr.lights,{emissive:{value:new ir(0)},specular:{value:new ir(1118481)},shininess:{value:30}}]),vertexShader:pa.meshphong_vert,fragmentShader:pa.meshphong_frag},standard:{uniforms:mp([xr.common,xr.envmap,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.roughnessmap,xr.metalnessmap,xr.fog,xr.lights,{emissive:{value:new ir(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pa.meshphysical_vert,fragmentShader:pa.meshphysical_frag},toon:{uniforms:mp([xr.common,xr.aomap,xr.lightmap,xr.emissivemap,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.gradientmap,xr.fog,xr.lights,{emissive:{value:new ir(0)}}]),vertexShader:pa.meshtoon_vert,fragmentShader:pa.meshtoon_frag},matcap:{uniforms:mp([xr.common,xr.bumpmap,xr.normalmap,xr.displacementmap,xr.fog,{matcap:{value:null}}]),vertexShader:pa.meshmatcap_vert,fragmentShader:pa.meshmatcap_frag},points:{uniforms:mp([xr.points,xr.fog]),vertexShader:pa.points_vert,fragmentShader:pa.points_frag},dashed:{uniforms:mp([xr.common,xr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pa.linedashed_vert,fragmentShader:pa.linedashed_frag},depth:{uniforms:mp([xr.common,xr.displacementmap]),vertexShader:pa.depth_vert,fragmentShader:pa.depth_frag},normal:{uniforms:mp([xr.common,xr.bumpmap,xr.normalmap,xr.displacementmap,{opacity:{value:1}}]),vertexShader:pa.meshnormal_vert,fragmentShader:pa.meshnormal_frag},sprite:{uniforms:mp([xr.sprite,xr.fog]),vertexShader:pa.sprite_vert,fragmentShader:pa.sprite_frag},background:{uniforms:{uvTransform:{value:new ma},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pa.background_vert,fragmentShader:pa.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:pa.backgroundCube_vert,fragmentShader:pa.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pa.cube_vert,fragmentShader:pa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pa.equirect_vert,fragmentShader:pa.equirect_frag},distanceRGBA:{uniforms:mp([xr.common,xr.displacementmap,{referencePosition:{value:new ue},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pa.distanceRGBA_vert,fragmentShader:pa.distanceRGBA_frag},shadow:{uniforms:mp([xr.lights,xr.fog,{color:{value:new ir(0)},opacity:{value:1}}]),vertexShader:pa.shadow_vert,fragmentShader:pa.shadow_frag}};i5.physical={uniforms:mp([i5.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ma},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ma},clearcoatNormalScale:{value:new _t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ma},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ma},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ma},sheen:{value:0},sheenColor:{value:new ir(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ma},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ma},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ma},transmissionSamplerSize:{value:new _t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ma},attenuationDistance:{value:0},attenuationColor:{value:new ir(0)},specularColor:{value:new ir(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ma},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ma},anisotropyVector:{value:new _t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ma}}]),vertexShader:pa.meshphysical_vert,fragmentShader:pa.meshphysical_frag};const KY={r:0,b:0,g:0};function T4t(t,e,n,o,r,i,a){const l=new ir(0);let s=i===!0?0:1,c,u,d=null,f=0,p=null;function m(w,x){let C=!1,P=x.isScene===!0?x.background:null;P&&P.isTexture&&(P=(x.backgroundBlurriness>0?n:e).get(P)),P===null?y(l,s):P&&P.isColor&&(y(P,1),C=!0);const A=t.xr.getEnvironmentBlendMode();A==="additive"?o.buffers.color.setClear(0,0,0,1,a):A==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,a),(t.autoClear||C)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),P&&(P.isCubeTexture||P.mapping===zM)?(u===void 0&&(u=new os(new V3(1,1,1),new Z0({name:"BackgroundCubeMaterial",uniforms:sH(i5.backgroundCube.uniforms),vertexShader:i5.backgroundCube.vertexShader,fragmentShader:i5.backgroundCube.fragmentShader,side:js,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(S,v,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=P,u.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,u.material.toneMapped=ys.getTransfer(P.colorSpace)!==$s,(d!==P||f!==P.version||p!==t.toneMapping)&&(u.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null)):P&&P.isTexture&&(c===void 0&&(c=new os(new T7(2,2),new Z0({name:"BackgroundMaterial",uniforms:sH(i5.background.uniforms),vertexShader:i5.background.vertexShader,fragmentShader:i5.background.fragmentShader,side:$i,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=P,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=ys.getTransfer(P.colorSpace)!==$s,P.matrixAutoUpdate===!0&&P.updateMatrix(),c.material.uniforms.uvTransform.value.copy(P.matrix),(d!==P||f!==P.version||p!==t.toneMapping)&&(c.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function y(w,x){w.getRGB(KY,kOe(t)),o.buffers.color.setClear(KY.r,KY.g,KY.b,x,a)}return{getClearColor:function(){return l},setClearColor:function(w,x=1){l.set(w),s=x,y(l,s)},getClearAlpha:function(){return s},setClearAlpha:function(w){s=w,y(l,s)},render:m}}function P4t(t,e,n,o){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),i=o.isWebGL2?null:e.get("OES_vertex_array_object"),a=o.isWebGL2||i!==null,l={},s=w(null);let c=s,u=!1;function d(U,W,F,E,L){let j=!1;if(a){const Y=y(E,F,W);c!==Y&&(c=Y,p(c.object)),j=x(U,E,F,L),j&&C(U,E,F,L)}else{const Y=W.wireframe===!0;(c.geometry!==E.id||c.program!==F.id||c.wireframe!==Y)&&(c.geometry=E.id,c.program=F.id,c.wireframe=Y,j=!0)}L!==null&&n.update(L,t.ELEMENT_ARRAY_BUFFER),(j||u)&&(u=!1,T(U,W,F,E),L!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(L).buffer))}function f(){return o.isWebGL2?t.createVertexArray():i.createVertexArrayOES()}function p(U){return o.isWebGL2?t.bindVertexArray(U):i.bindVertexArrayOES(U)}function m(U){return o.isWebGL2?t.deleteVertexArray(U):i.deleteVertexArrayOES(U)}function y(U,W,F){const E=F.wireframe===!0;let L=l[U.id];L===void 0&&(L={},l[U.id]=L);let j=L[W.id];j===void 0&&(j={},L[W.id]=j);let Y=j[E];return Y===void 0&&(Y=w(f()),j[E]=Y),Y}function w(U){const W=[],F=[],E=[];for(let L=0;L=0){const Q=L[_];let oe=j[_];if(oe===void 0&&(_==="instanceMatrix"&&U.instanceMatrix&&(oe=U.instanceMatrix),_==="instanceColor"&&U.instanceColor&&(oe=U.instanceColor)),Q===void 0||Q.attribute!==oe||oe&&Q.data!==oe.data)return!0;Y++}return c.attributesNum!==Y||c.index!==E}function C(U,W,F,E){const L={},j=W.attributes;let Y=0;const O=F.getAttributes();for(const _ in O)if(O[_].location>=0){let Q=j[_];Q===void 0&&(_==="instanceMatrix"&&U.instanceMatrix&&(Q=U.instanceMatrix),_==="instanceColor"&&U.instanceColor&&(Q=U.instanceColor));const oe={};oe.attribute=Q,Q&&Q.data&&(oe.data=Q.data),L[_]=oe,Y++}c.attributes=L,c.attributesNum=Y,c.index=E}function P(){const U=c.newAttributes;for(let W=0,F=U.length;W=0){let G=L[O];if(G===void 0&&(O==="instanceMatrix"&&U.instanceMatrix&&(G=U.instanceMatrix),O==="instanceColor"&&U.instanceColor&&(G=U.instanceColor)),G!==void 0){const Q=G.normalized,oe=G.itemSize,ee=n.get(G);if(ee===void 0)continue;const $=ee.buffer,ae=ee.type,Z=ee.bytesPerElement,ne=o.isWebGL2===!0&&(ae===t.INT||ae===t.UNSIGNED_INT||G.gpuType===Qye);if(G.isInterleavedBufferAttribute){const te=G.data,q=te.stride,le=G.offset;if(te.isInstancedInterleavedBuffer){for(let de=0;de<_.locationSize;de++)S(_.location+de,te.meshPerAttribute);U.isInstancedMesh!==!0&&E._maxInstanceCount===void 0&&(E._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let de=0;de<_.locationSize;de++)A(_.location+de);t.bindBuffer(t.ARRAY_BUFFER,$);for(let de=0;de<_.locationSize;de++)b(_.location+de,oe/_.locationSize,ae,Q,q*Z,(le+oe/_.locationSize*de)*Z,ne)}else{if(G.isInstancedBufferAttribute){for(let te=0;te<_.locationSize;te++)S(_.location+te,G.meshPerAttribute);U.isInstancedMesh!==!0&&E._maxInstanceCount===void 0&&(E._maxInstanceCount=G.meshPerAttribute*G.count)}else for(let te=0;te<_.locationSize;te++)A(_.location+te);t.bindBuffer(t.ARRAY_BUFFER,$);for(let te=0;te<_.locationSize;te++)b(_.location+te,oe/_.locationSize,ae,Q,oe*Z,oe/_.locationSize*te*Z,ne)}}else if(Y!==void 0){const Q=Y[O];if(Q!==void 0)switch(Q.length){case 2:t.vertexAttrib2fv(_.location,Q);break;case 3:t.vertexAttrib3fv(_.location,Q);break;case 4:t.vertexAttrib4fv(_.location,Q);break;default:t.vertexAttrib1fv(_.location,Q)}}}}v()}function R(){k();for(const U in l){const W=l[U];for(const F in W){const E=W[F];for(const L in E)m(E[L].object),delete E[L];delete W[F]}delete l[U]}}function M(U){if(l[U.id]===void 0)return;const W=l[U.id];for(const F in W){const E=W[F];for(const L in E)m(E[L].object),delete E[L];delete W[F]}delete l[U.id]}function D(U){for(const W in l){const F=l[W];if(F[U.id]===void 0)continue;const E=F[U.id];for(const L in E)m(E[L].object),delete E[L];delete F[U.id]}}function k(){N(),u=!0,c!==s&&(c=s,p(c.object))}function N(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:d,reset:k,resetDefaultState:N,dispose:R,releaseStatesOfGeometry:M,releaseStatesOfProgram:D,initAttributes:P,enableAttribute:A,disableUnusedAttributes:v}}function C4t(t,e,n,o){const r=o.isWebGL2;let i;function a(c){i=c}function l(c,u){t.drawArrays(i,c,u),n.update(u,i,1)}function s(c,u,d){if(d===0)return;let f,p;if(r)f=t,p="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[p](i,c,u,d),n.update(u,i,d)}this.setMode=a,this.render=l,this.renderInstances=s}function R4t(t,e,n){let o;function r(){if(o!==void 0)return o;if(e.has("EXT_texture_filter_anisotropic")===!0){const b=e.get("EXT_texture_filter_anisotropic");o=t.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function i(b){if(b==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let l=n.precision!==void 0?n.precision:"highp";const s=i(l);s!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",s,"instead."),l=s);const c=a||e.has("WEBGL_draw_buffers"),u=n.logarithmicDepthBuffer===!0,d=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),f=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_TEXTURE_SIZE),m=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),y=t.getParameter(t.MAX_VERTEX_ATTRIBS),w=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),x=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),P=f>0,A=a||e.has("OES_texture_float"),S=P&&A,v=a?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:i,precision:l,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:m,maxAttributes:y,maxVertexUniforms:w,maxVaryings:x,maxFragmentUniforms:C,vertexTextures:P,floatFragmentTextures:A,floatVertexTextures:S,maxSamples:v}}function H4t(t){const e=this;let n=null,o=0,r=!1,i=!1;const a=new V9,l=new ma,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||o!==0||r;return r=f,o=d.length,p},this.beginShadows=function(){i=!0,u(null)},this.endShadows=function(){i=!1},this.setGlobalState=function(d,f){n=u(d,f,0)},this.setState=function(d,f,p){const m=d.clippingPlanes,y=d.clipIntersection,w=d.clipShadows,x=t.get(d);if(!r||m===null||m.length===0||i&&!w)i?u(null):c();else{const C=i?0:o,P=C*4;let A=x.clippingState||null;s.value=A,A=u(m,f,P,p);for(let S=0;S!==P;++S)A[S]=n[S];x.clippingState=A,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=C}};function c(){s.value!==n&&(s.value=n,s.needsUpdate=o>0),e.numPlanes=o,e.numIntersection=0}function u(d,f,p,m){const y=d!==null?d.length:0;let w=null;if(y!==0){if(w=s.value,m!==!0||w===null){const x=p+y*4,C=f.matrixWorldInverse;l.getNormalMatrix(C),(w===null||w.length0){const c=new LOe(s.height/2);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",r),n(c.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const s=e.get(l);s!==void 0&&(e.delete(l),s.dispose())}function i(){e=new WeakMap}return{get:o,dispose:i}}let zN=class extends EM{constructor(e=-1,n=1,o=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=o,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,o,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=o,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=o-e,a=o+e,l=r+n,s=r-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,l-=u*this.view.offsetY,s=l-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,l,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};const JC=4,zxe=[.125,.215,.35,.446,.526,.582],wv=20,Aae=new zN,Dxe=new ir;let wae=null,xae=0,vae=0;const cv=(1+Math.sqrt(5))/2,AP=1/cv,Exe=[new ue(1,1,1),new ue(-1,1,1),new ue(1,1,-1),new ue(-1,1,-1),new ue(0,cv,AP),new ue(0,cv,-AP),new ue(AP,0,cv),new ue(-AP,0,cv),new ue(cv,AP,0),new ue(-cv,AP,0)];class yde{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,o=.1,r=100){wae=this._renderer.getRenderTarget(),xae=this._renderer.getActiveCubeFace(),vae=this._renderer.getActiveMipmapLevel(),this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,o,r,i),n>0&&this._blur(i,0,0,n),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Lxe(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fxe(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),u.setRenderTarget(r),y&&u.render(m,l),u.render(e,l)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=w}_textureToCubeUV(e,n){const o=this._renderer,r=e.mapping===KA||e.mapping===_8;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Lxe()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fxe());const i=r?this._cubemapMaterial:this._equirectMaterial,a=new os(this._lodPlanes[0],i),l=i.uniforms;l.envMap.value=e;const s=this._cubeSize;$Y(n,0,0,3*s,2*s),o.setRenderTarget(n),o.render(a,Aae)}_applyPMREM(e){const n=this._renderer,o=n.autoClear;n.autoClear=!1;for(let r=1;rwv&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${wv}`);const x=[];let C=0;for(let b=0;bP-JC?r-P+JC:0),v=4*(this._cubeSize-A);$Y(n,S,v,3*A,2*A),s.setRenderTarget(n),s.render(d,Aae)}}function I4t(t){const e=[],n=[],o=[];let r=t;const i=t-JC+1+zxe.length;for(let a=0;at-JC?s=zxe[a-t+JC-1]:a===0&&(s=0),o.push(s);const c=1/(l-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],p=6,m=6,y=3,w=2,x=1,C=new Float32Array(y*m*p),P=new Float32Array(w*m*p),A=new Float32Array(x*m*p);for(let v=0;v2?0:-1,R=[b,T,0,b+2/3,T,0,b+2/3,T+1,0,b,T,0,b+2/3,T+1,0,b,T+1,0];C.set(R,y*m*v),P.set(f,w*m*v);const M=[v,v,v,v,v,v];A.set(M,x*m*v)}const S=new Ni;S.setAttribute("position",new _a(C,y)),S.setAttribute("uv",new _a(P,w)),S.setAttribute("faceIndex",new _a(A,x)),e.push(S),r>JC&&r--}return{lodPlanes:e,sizeLods:n,sigmas:o}}function kxe(t,e,n){const o=new ku(t,e,n);return o.texture.mapping=zM,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function $Y(t,e,n,o,r){t.viewport.set(e,n,o,r),t.scissor.set(e,n,o,r)}function z4t(t,e,n){const o=new Float32Array(wv),r=new ue(0,1,0);return new Z0({name:"SphericalGaussianBlur",defines:{n:wv,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:f2e(),fragmentShader:` precision mediump float; precision mediump int; @@ -3632,7 +3632,7 @@ precision `+t.precision+" int;";return t.precision==="highp"?e+=` Program Info Log: `+k+` `+E+` -`+L)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(N===""||U==="")&&(F=!1);F&&(D.diagnostics={runnable:W,programLog:k,vertexShader:{log:N,prefix:w},fragmentShader:{log:U,prefix:x}})}r.deleteShader(S),r.deleteShader(v),T=new qV(r,y),R=Uwt(r,y)}let T;this.getUniforms=function(){return T===void 0&&b(this),T};let R;this.getAttributes=function(){return R===void 0&&b(this),R};let M=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(y,zwt)),M},this.destroy=function(){o.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Dwt++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=S,this.fragmentShader=v,this}let qwt=0;class Qwt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,o=e.fragmentShader,r=this._getShaderStage(n),i=this._getShaderStage(o),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const o of n)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let o=n.get(e);return o===void 0&&(o=new Set,n.set(e,o)),o}_getShaderStage(e){const n=this.shaderCache;let o=n.get(e);return o===void 0&&(o=new Zwt(e),n.set(e,o)),o}}class Zwt{constructor(e){this.id=qwt++,this.code=e,this.usedTimes=0}}function e8t(t,e,n,o,r,i,a){const l=new ub,s=new Qwt,c=[],u=r.isWebGL2,d=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 y(R){return R===0?"uv":`uv${R}`}function w(R,M,D,k,N){const U=k.fog,W=N.geometry,F=R.isMeshStandardMaterial?k.environment:null,E=(R.isMeshStandardMaterial?n:e).get(R.envMap||F),L=E&&E.mapping===zM?E.image.height:null,j=m[R.type];R.precision!==null&&(p=r.getMaxPrecision(R.precision),p!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",p,"instead."));const Y=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,O=Y!==void 0?Y.length:0;let _=0;W.morphAttributes.position!==void 0&&(_=1),W.morphAttributes.normal!==void 0&&(_=2),W.morphAttributes.color!==void 0&&(_=3);let G,Q,oe,ee;if(j){const gt=i5[j];G=gt.vertexShader,Q=gt.fragmentShader}else G=R.vertexShader,Q=R.fragmentShader,s.update(R),oe=s.getVertexShaderID(R),ee=s.getFragmentShaderID(R);const q=t.getRenderTarget(),ae=N.isInstancedMesh===!0,Z=!!R.map,ne=!!R.matcap,te=!!E,$=!!R.aoMap,le=!!R.lightMap,de=!!R.bumpMap,he=!!R.normalMap,me=!!R.displacementMap,ce=!!R.emissiveMap,Pe=!!R.metalnessMap,pe=!!R.roughnessMap,Ie=R.anisotropy>0,ve=R.clearcoat>0,ze=R.iridescence>0,Ae=R.sheen>0,se=R.transmission>0,ge=Ie&&!!R.anisotropyMap,we=ve&&!!R.clearcoatMap,Se=ve&&!!R.clearcoatNormalMap,Me=ve&&!!R.clearcoatRoughnessMap,Ce=ze&&!!R.iridescenceMap,Te=ze&&!!R.iridescenceThicknessMap,Re=Ae&&!!R.sheenColorMap,Ne=Ae&&!!R.sheenRoughnessMap,_e=!!R.specularMap,Ue=!!R.specularColorMap,qe=!!R.specularIntensityMap,Fe=se&&!!R.transmissionMap,He=se&&!!R.thicknessMap,Le=!!R.gradientMap,Ye=!!R.alphaMap,lt=R.alphaTest>0,Oe=!!R.alphaHash,ut=!!R.extensions,ht=!!W.attributes.uv1,Qe=!!W.attributes.uv2,nt=!!W.attributes.uv3;let mt=w5;return R.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(mt=t.toneMapping),{isWebGL2:u,shaderID:j,shaderType:R.type,shaderName:R.name,vertexShader:G,fragmentShader:Q,defines:R.defines,customVertexShaderID:oe,customFragmentShaderID:ee,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:p,instancing:ae,instancingColor:ae&&N.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:q===null?t.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:Wy,map:Z,matcap:ne,envMap:te,envMapMode:te&&E.mapping,envMapCubeUVHeight:L,aoMap:$,lightMap:le,bumpMap:de,normalMap:he,displacementMap:f&&me,emissiveMap:ce,normalMapObjectSpace:he&&R.normalMapType===wOe,normalMapTangentSpace:he&&R.normalMapType===S7,metalnessMap:Pe,roughnessMap:pe,anisotropy:Ie,anisotropyMap:ge,clearcoat:ve,clearcoatMap:we,clearcoatNormalMap:Se,clearcoatRoughnessMap:Me,iridescence:ze,iridescenceMap:Ce,iridescenceThicknessMap:Te,sheen:Ae,sheenColorMap:Re,sheenRoughnessMap:Ne,specularMap:_e,specularColorMap:Ue,specularIntensityMap:qe,transmission:se,transmissionMap:Fe,thicknessMap:He,gradientMap:Le,opaque:R.transparent===!1&&R.blending===sb,alphaMap:Ye,alphaTest:lt,alphaHash:Oe,combine:R.combine,mapUv:Z&&y(R.map.channel),aoMapUv:$&&y(R.aoMap.channel),lightMapUv:le&&y(R.lightMap.channel),bumpMapUv:de&&y(R.bumpMap.channel),normalMapUv:he&&y(R.normalMap.channel),displacementMapUv:me&&y(R.displacementMap.channel),emissiveMapUv:ce&&y(R.emissiveMap.channel),metalnessMapUv:Pe&&y(R.metalnessMap.channel),roughnessMapUv:pe&&y(R.roughnessMap.channel),anisotropyMapUv:ge&&y(R.anisotropyMap.channel),clearcoatMapUv:we&&y(R.clearcoatMap.channel),clearcoatNormalMapUv:Se&&y(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&y(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&y(R.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&y(R.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&y(R.sheenColorMap.channel),sheenRoughnessMapUv:Ne&&y(R.sheenRoughnessMap.channel),specularMapUv:_e&&y(R.specularMap.channel),specularColorMapUv:Ue&&y(R.specularColorMap.channel),specularIntensityMapUv:qe&&y(R.specularIntensityMap.channel),transmissionMapUv:Fe&&y(R.transmissionMap.channel),thicknessMapUv:He&&y(R.thicknessMap.channel),alphaMapUv:Ye&&y(R.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(he||Ie),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,vertexUv1s:ht,vertexUv2s:Qe,vertexUv3s:nt,pointsUvs:N.isPoints===!0&&!!W.attributes.uv&&(Z||Ye),fog:!!U,useFog:R.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:N.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:O,morphTextureStride:_,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&D.length>0,shadowMapType:t.shadowMap.type,toneMapping:mt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:Z&&R.map.isVideoTexture===!0&&ys.getTransfer(R.map.colorSpace)===$s,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===zr,flipSided:R.side===js,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:ut&&R.extensions.derivatives===!0,extensionFragDepth:ut&&R.extensions.fragDepth===!0,extensionDrawBuffers:ut&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:ut&&R.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||o.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:o.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()}}function x(R){const M=[];if(R.shaderID?M.push(R.shaderID):(M.push(R.customVertexShaderID),M.push(R.customFragmentShaderID)),R.defines!==void 0)for(const D in R.defines)M.push(D),M.push(R.defines[D]);return R.isRawShaderMaterial===!1&&(C(M,R),P(M,R),M.push(t.outputColorSpace)),M.push(R.customProgramCacheKey),M.join()}function C(R,M){R.push(M.precision),R.push(M.outputColorSpace),R.push(M.envMapMode),R.push(M.envMapCubeUVHeight),R.push(M.mapUv),R.push(M.alphaMapUv),R.push(M.lightMapUv),R.push(M.aoMapUv),R.push(M.bumpMapUv),R.push(M.normalMapUv),R.push(M.displacementMapUv),R.push(M.emissiveMapUv),R.push(M.metalnessMapUv),R.push(M.roughnessMapUv),R.push(M.anisotropyMapUv),R.push(M.clearcoatMapUv),R.push(M.clearcoatNormalMapUv),R.push(M.clearcoatRoughnessMapUv),R.push(M.iridescenceMapUv),R.push(M.iridescenceThicknessMapUv),R.push(M.sheenColorMapUv),R.push(M.sheenRoughnessMapUv),R.push(M.specularMapUv),R.push(M.specularColorMapUv),R.push(M.specularIntensityMapUv),R.push(M.transmissionMapUv),R.push(M.thicknessMapUv),R.push(M.combine),R.push(M.fogExp2),R.push(M.sizeAttenuation),R.push(M.morphTargetsCount),R.push(M.morphAttributeCount),R.push(M.numDirLights),R.push(M.numPointLights),R.push(M.numSpotLights),R.push(M.numSpotLightMaps),R.push(M.numHemiLights),R.push(M.numRectAreaLights),R.push(M.numDirLightShadows),R.push(M.numPointLightShadows),R.push(M.numSpotLightShadows),R.push(M.numSpotLightShadowsWithMaps),R.push(M.numLightProbes),R.push(M.shadowMapType),R.push(M.toneMapping),R.push(M.numClippingPlanes),R.push(M.numClipIntersection),R.push(M.depthPacking)}function P(R,M){l.disableAll(),M.isWebGL2&&l.enable(0),M.supportsVertexTextures&&l.enable(1),M.instancing&&l.enable(2),M.instancingColor&&l.enable(3),M.matcap&&l.enable(4),M.envMap&&l.enable(5),M.normalMapObjectSpace&&l.enable(6),M.normalMapTangentSpace&&l.enable(7),M.clearcoat&&l.enable(8),M.iridescence&&l.enable(9),M.alphaTest&&l.enable(10),M.vertexColors&&l.enable(11),M.vertexAlphas&&l.enable(12),M.vertexUv1s&&l.enable(13),M.vertexUv2s&&l.enable(14),M.vertexUv3s&&l.enable(15),M.vertexTangents&&l.enable(16),M.anisotropy&&l.enable(17),M.alphaHash&&l.enable(18),R.push(l.mask),l.disableAll(),M.fog&&l.enable(0),M.useFog&&l.enable(1),M.flatShading&&l.enable(2),M.logarithmicDepthBuffer&&l.enable(3),M.skinning&&l.enable(4),M.morphTargets&&l.enable(5),M.morphNormals&&l.enable(6),M.morphColors&&l.enable(7),M.premultipliedAlpha&&l.enable(8),M.shadowMapEnabled&&l.enable(9),M.useLegacyLights&&l.enable(10),M.doubleSided&&l.enable(11),M.flipSided&&l.enable(12),M.useDepthPacking&&l.enable(13),M.dithering&&l.enable(14),M.transmission&&l.enable(15),M.sheen&&l.enable(16),M.opaque&&l.enable(17),M.pointsUvs&&l.enable(18),M.decodeVideoTexture&&l.enable(19),R.push(l.mask)}function A(R){const M=m[R.type];let D;if(M){const k=i5[M];D=oL.clone(k.uniforms)}else D=R.uniforms;return D}function S(R,M){let D;for(let k=0,N=c.length;k0?o.push(x):p.transparent===!0?r.push(x):n.push(x)}function s(d,f,p,m,y,w){const x=a(d,f,p,m,y,w);p.transmission>0?o.unshift(x):p.transparent===!0?r.unshift(x):n.unshift(x)}function c(d,f){n.length>1&&n.sort(d||n8t),o.length>1&&o.sort(f||Kxe),r.length>1&&r.sort(f||Kxe)}function u(){for(let d=e,f=t.length;d=i.length?(a=new $xe,i.push(a)):a=i[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function r8t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new ue,color:new ir};break;case"SpotLight":n={position:new ue,direction:new ue,color:new ir,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ue,color:new ir,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ue,skyColor:new ir,groundColor:new ir};break;case"RectAreaLight":n={color:new ir,position:new ue,halfWidth:new ue,halfHeight:new ue};break}return t[e.id]=n,n}}}function i8t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _t};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _t};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _t,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let a8t=0;function l8t(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function s8t(t,e){const n=new r8t,o=i8t(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],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 u=0;u<9;u++)r.probe.push(new ue);const i=new ue,a=new qi,l=new qi;function s(u,d){let f=0,p=0,m=0;for(let k=0;k<9;k++)r.probe[k].set(0,0,0);let y=0,w=0,x=0,C=0,P=0,A=0,S=0,v=0,b=0,T=0,R=0;u.sort(l8t);const M=d===!0?Math.PI:1;for(let k=0,N=u.length;k0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=xr.LTC_FLOAT_1,r.rectAreaLTC2=xr.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=xr.LTC_HALF_1,r.rectAreaLTC2=xr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=p,r.ambient[2]=m;const D=r.hash;(D.directionalLength!==y||D.pointLength!==w||D.spotLength!==x||D.rectAreaLength!==C||D.hemiLength!==P||D.numDirectionalShadows!==A||D.numPointShadows!==S||D.numSpotShadows!==v||D.numSpotMaps!==b||D.numLightProbes!==R)&&(r.directional.length=y,r.spot.length=x,r.rectArea.length=C,r.point.length=w,r.hemi.length=P,r.directionalShadow.length=A,r.directionalShadowMap.length=A,r.pointShadow.length=S,r.pointShadowMap.length=S,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=A,r.pointShadowMatrix.length=S,r.spotLightMatrix.length=v+b-T,r.spotLightMap.length=b,r.numSpotLightShadowsWithMaps=T,r.numLightProbes=R,D.directionalLength=y,D.pointLength=w,D.spotLength=x,D.rectAreaLength=C,D.hemiLength=P,D.numDirectionalShadows=A,D.numPointShadows=S,D.numSpotShadows=v,D.numSpotMaps=b,D.numLightProbes=R,r.version=a8t++)}function c(u,d){let f=0,p=0,m=0,y=0,w=0;const x=d.matrixWorldInverse;for(let C=0,P=u.length;C=l.length?(s=new qxe(t,e),l.push(s)):s=l[a],s}function r(){n=new WeakMap}return{get:o,dispose:r}}class zq extends id{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=b7,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}}class Dq extends id{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}}const u8t=`void main() { +`+L)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(N===""||U==="")&&(F=!1);F&&(D.diagnostics={runnable:W,programLog:k,vertexShader:{log:N,prefix:w},fragmentShader:{log:U,prefix:x}})}r.deleteShader(S),r.deleteShader(v),T=new qV(r,y),R=Uwt(r,y)}let T;this.getUniforms=function(){return T===void 0&&b(this),T};let R;this.getAttributes=function(){return R===void 0&&b(this),R};let M=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(y,zwt)),M},this.destroy=function(){o.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Dwt++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=S,this.fragmentShader=v,this}let qwt=0;class Qwt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,o=e.fragmentShader,r=this._getShaderStage(n),i=this._getShaderStage(o),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const o of n)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let o=n.get(e);return o===void 0&&(o=new Set,n.set(e,o)),o}_getShaderStage(e){const n=this.shaderCache;let o=n.get(e);return o===void 0&&(o=new Zwt(e),n.set(e,o)),o}}class Zwt{constructor(e){this.id=qwt++,this.code=e,this.usedTimes=0}}function e8t(t,e,n,o,r,i,a){const l=new ub,s=new Qwt,c=[],u=r.isWebGL2,d=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 y(R){return R===0?"uv":`uv${R}`}function w(R,M,D,k,N){const U=k.fog,W=N.geometry,F=R.isMeshStandardMaterial?k.environment:null,E=(R.isMeshStandardMaterial?n:e).get(R.envMap||F),L=E&&E.mapping===zM?E.image.height:null,j=m[R.type];R.precision!==null&&(p=r.getMaxPrecision(R.precision),p!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",p,"instead."));const Y=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,O=Y!==void 0?Y.length:0;let _=0;W.morphAttributes.position!==void 0&&(_=1),W.morphAttributes.normal!==void 0&&(_=2),W.morphAttributes.color!==void 0&&(_=3);let G,Q,oe,ee;if(j){const gt=i5[j];G=gt.vertexShader,Q=gt.fragmentShader}else G=R.vertexShader,Q=R.fragmentShader,s.update(R),oe=s.getVertexShaderID(R),ee=s.getFragmentShaderID(R);const $=t.getRenderTarget(),ae=N.isInstancedMesh===!0,Z=!!R.map,ne=!!R.matcap,te=!!E,q=!!R.aoMap,le=!!R.lightMap,de=!!R.bumpMap,he=!!R.normalMap,me=!!R.displacementMap,ce=!!R.emissiveMap,Pe=!!R.metalnessMap,pe=!!R.roughnessMap,Ie=R.anisotropy>0,ve=R.clearcoat>0,ze=R.iridescence>0,Ae=R.sheen>0,se=R.transmission>0,ge=Ie&&!!R.anisotropyMap,we=ve&&!!R.clearcoatMap,Se=ve&&!!R.clearcoatNormalMap,Me=ve&&!!R.clearcoatRoughnessMap,Ce=ze&&!!R.iridescenceMap,Te=ze&&!!R.iridescenceThicknessMap,Re=Ae&&!!R.sheenColorMap,Ne=Ae&&!!R.sheenRoughnessMap,_e=!!R.specularMap,Ue=!!R.specularColorMap,qe=!!R.specularIntensityMap,Fe=se&&!!R.transmissionMap,He=se&&!!R.thicknessMap,Le=!!R.gradientMap,Ye=!!R.alphaMap,lt=R.alphaTest>0,Oe=!!R.alphaHash,ut=!!R.extensions,ht=!!W.attributes.uv1,Qe=!!W.attributes.uv2,nt=!!W.attributes.uv3;let mt=w5;return R.toneMapped&&($===null||$.isXRRenderTarget===!0)&&(mt=t.toneMapping),{isWebGL2:u,shaderID:j,shaderType:R.type,shaderName:R.name,vertexShader:G,fragmentShader:Q,defines:R.defines,customVertexShaderID:oe,customFragmentShaderID:ee,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:p,instancing:ae,instancingColor:ae&&N.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:$===null?t.outputColorSpace:$.isXRRenderTarget===!0?$.texture.colorSpace:Wy,map:Z,matcap:ne,envMap:te,envMapMode:te&&E.mapping,envMapCubeUVHeight:L,aoMap:q,lightMap:le,bumpMap:de,normalMap:he,displacementMap:f&&me,emissiveMap:ce,normalMapObjectSpace:he&&R.normalMapType===wOe,normalMapTangentSpace:he&&R.normalMapType===S7,metalnessMap:Pe,roughnessMap:pe,anisotropy:Ie,anisotropyMap:ge,clearcoat:ve,clearcoatMap:we,clearcoatNormalMap:Se,clearcoatRoughnessMap:Me,iridescence:ze,iridescenceMap:Ce,iridescenceThicknessMap:Te,sheen:Ae,sheenColorMap:Re,sheenRoughnessMap:Ne,specularMap:_e,specularColorMap:Ue,specularIntensityMap:qe,transmission:se,transmissionMap:Fe,thicknessMap:He,gradientMap:Le,opaque:R.transparent===!1&&R.blending===sb,alphaMap:Ye,alphaTest:lt,alphaHash:Oe,combine:R.combine,mapUv:Z&&y(R.map.channel),aoMapUv:q&&y(R.aoMap.channel),lightMapUv:le&&y(R.lightMap.channel),bumpMapUv:de&&y(R.bumpMap.channel),normalMapUv:he&&y(R.normalMap.channel),displacementMapUv:me&&y(R.displacementMap.channel),emissiveMapUv:ce&&y(R.emissiveMap.channel),metalnessMapUv:Pe&&y(R.metalnessMap.channel),roughnessMapUv:pe&&y(R.roughnessMap.channel),anisotropyMapUv:ge&&y(R.anisotropyMap.channel),clearcoatMapUv:we&&y(R.clearcoatMap.channel),clearcoatNormalMapUv:Se&&y(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&y(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&y(R.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&y(R.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&y(R.sheenColorMap.channel),sheenRoughnessMapUv:Ne&&y(R.sheenRoughnessMap.channel),specularMapUv:_e&&y(R.specularMap.channel),specularColorMapUv:Ue&&y(R.specularColorMap.channel),specularIntensityMapUv:qe&&y(R.specularIntensityMap.channel),transmissionMapUv:Fe&&y(R.transmissionMap.channel),thicknessMapUv:He&&y(R.thicknessMap.channel),alphaMapUv:Ye&&y(R.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(he||Ie),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,vertexUv1s:ht,vertexUv2s:Qe,vertexUv3s:nt,pointsUvs:N.isPoints===!0&&!!W.attributes.uv&&(Z||Ye),fog:!!U,useFog:R.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:N.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:O,morphTextureStride:_,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&D.length>0,shadowMapType:t.shadowMap.type,toneMapping:mt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:Z&&R.map.isVideoTexture===!0&&ys.getTransfer(R.map.colorSpace)===$s,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===zr,flipSided:R.side===js,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:ut&&R.extensions.derivatives===!0,extensionFragDepth:ut&&R.extensions.fragDepth===!0,extensionDrawBuffers:ut&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:ut&&R.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||o.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:o.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()}}function x(R){const M=[];if(R.shaderID?M.push(R.shaderID):(M.push(R.customVertexShaderID),M.push(R.customFragmentShaderID)),R.defines!==void 0)for(const D in R.defines)M.push(D),M.push(R.defines[D]);return R.isRawShaderMaterial===!1&&(C(M,R),P(M,R),M.push(t.outputColorSpace)),M.push(R.customProgramCacheKey),M.join()}function C(R,M){R.push(M.precision),R.push(M.outputColorSpace),R.push(M.envMapMode),R.push(M.envMapCubeUVHeight),R.push(M.mapUv),R.push(M.alphaMapUv),R.push(M.lightMapUv),R.push(M.aoMapUv),R.push(M.bumpMapUv),R.push(M.normalMapUv),R.push(M.displacementMapUv),R.push(M.emissiveMapUv),R.push(M.metalnessMapUv),R.push(M.roughnessMapUv),R.push(M.anisotropyMapUv),R.push(M.clearcoatMapUv),R.push(M.clearcoatNormalMapUv),R.push(M.clearcoatRoughnessMapUv),R.push(M.iridescenceMapUv),R.push(M.iridescenceThicknessMapUv),R.push(M.sheenColorMapUv),R.push(M.sheenRoughnessMapUv),R.push(M.specularMapUv),R.push(M.specularColorMapUv),R.push(M.specularIntensityMapUv),R.push(M.transmissionMapUv),R.push(M.thicknessMapUv),R.push(M.combine),R.push(M.fogExp2),R.push(M.sizeAttenuation),R.push(M.morphTargetsCount),R.push(M.morphAttributeCount),R.push(M.numDirLights),R.push(M.numPointLights),R.push(M.numSpotLights),R.push(M.numSpotLightMaps),R.push(M.numHemiLights),R.push(M.numRectAreaLights),R.push(M.numDirLightShadows),R.push(M.numPointLightShadows),R.push(M.numSpotLightShadows),R.push(M.numSpotLightShadowsWithMaps),R.push(M.numLightProbes),R.push(M.shadowMapType),R.push(M.toneMapping),R.push(M.numClippingPlanes),R.push(M.numClipIntersection),R.push(M.depthPacking)}function P(R,M){l.disableAll(),M.isWebGL2&&l.enable(0),M.supportsVertexTextures&&l.enable(1),M.instancing&&l.enable(2),M.instancingColor&&l.enable(3),M.matcap&&l.enable(4),M.envMap&&l.enable(5),M.normalMapObjectSpace&&l.enable(6),M.normalMapTangentSpace&&l.enable(7),M.clearcoat&&l.enable(8),M.iridescence&&l.enable(9),M.alphaTest&&l.enable(10),M.vertexColors&&l.enable(11),M.vertexAlphas&&l.enable(12),M.vertexUv1s&&l.enable(13),M.vertexUv2s&&l.enable(14),M.vertexUv3s&&l.enable(15),M.vertexTangents&&l.enable(16),M.anisotropy&&l.enable(17),M.alphaHash&&l.enable(18),R.push(l.mask),l.disableAll(),M.fog&&l.enable(0),M.useFog&&l.enable(1),M.flatShading&&l.enable(2),M.logarithmicDepthBuffer&&l.enable(3),M.skinning&&l.enable(4),M.morphTargets&&l.enable(5),M.morphNormals&&l.enable(6),M.morphColors&&l.enable(7),M.premultipliedAlpha&&l.enable(8),M.shadowMapEnabled&&l.enable(9),M.useLegacyLights&&l.enable(10),M.doubleSided&&l.enable(11),M.flipSided&&l.enable(12),M.useDepthPacking&&l.enable(13),M.dithering&&l.enable(14),M.transmission&&l.enable(15),M.sheen&&l.enable(16),M.opaque&&l.enable(17),M.pointsUvs&&l.enable(18),M.decodeVideoTexture&&l.enable(19),R.push(l.mask)}function A(R){const M=m[R.type];let D;if(M){const k=i5[M];D=oL.clone(k.uniforms)}else D=R.uniforms;return D}function S(R,M){let D;for(let k=0,N=c.length;k0?o.push(x):p.transparent===!0?r.push(x):n.push(x)}function s(d,f,p,m,y,w){const x=a(d,f,p,m,y,w);p.transmission>0?o.unshift(x):p.transparent===!0?r.unshift(x):n.unshift(x)}function c(d,f){n.length>1&&n.sort(d||n8t),o.length>1&&o.sort(f||Kxe),r.length>1&&r.sort(f||Kxe)}function u(){for(let d=e,f=t.length;d=i.length?(a=new $xe,i.push(a)):a=i[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function r8t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new ue,color:new ir};break;case"SpotLight":n={position:new ue,direction:new ue,color:new ir,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ue,color:new ir,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ue,skyColor:new ir,groundColor:new ir};break;case"RectAreaLight":n={color:new ir,position:new ue,halfWidth:new ue,halfHeight:new ue};break}return t[e.id]=n,n}}}function i8t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _t};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _t};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _t,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let a8t=0;function l8t(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function s8t(t,e){const n=new r8t,o=i8t(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],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 u=0;u<9;u++)r.probe.push(new ue);const i=new ue,a=new qi,l=new qi;function s(u,d){let f=0,p=0,m=0;for(let k=0;k<9;k++)r.probe[k].set(0,0,0);let y=0,w=0,x=0,C=0,P=0,A=0,S=0,v=0,b=0,T=0,R=0;u.sort(l8t);const M=d===!0?Math.PI:1;for(let k=0,N=u.length;k0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=xr.LTC_FLOAT_1,r.rectAreaLTC2=xr.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=xr.LTC_HALF_1,r.rectAreaLTC2=xr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=p,r.ambient[2]=m;const D=r.hash;(D.directionalLength!==y||D.pointLength!==w||D.spotLength!==x||D.rectAreaLength!==C||D.hemiLength!==P||D.numDirectionalShadows!==A||D.numPointShadows!==S||D.numSpotShadows!==v||D.numSpotMaps!==b||D.numLightProbes!==R)&&(r.directional.length=y,r.spot.length=x,r.rectArea.length=C,r.point.length=w,r.hemi.length=P,r.directionalShadow.length=A,r.directionalShadowMap.length=A,r.pointShadow.length=S,r.pointShadowMap.length=S,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=A,r.pointShadowMatrix.length=S,r.spotLightMatrix.length=v+b-T,r.spotLightMap.length=b,r.numSpotLightShadowsWithMaps=T,r.numLightProbes=R,D.directionalLength=y,D.pointLength=w,D.spotLength=x,D.rectAreaLength=C,D.hemiLength=P,D.numDirectionalShadows=A,D.numPointShadows=S,D.numSpotShadows=v,D.numSpotMaps=b,D.numLightProbes=R,r.version=a8t++)}function c(u,d){let f=0,p=0,m=0,y=0,w=0;const x=d.matrixWorldInverse;for(let C=0,P=u.length;C=l.length?(s=new qxe(t,e),l.push(s)):s=l[a],s}function r(){n=new WeakMap}return{get:o,dispose:r}}class zq extends id{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=b7,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}}class Dq extends id{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}}const u8t=`void main() { gl_Position = vec4( position, 1.0 ); }`,d8t=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3660,7 +3660,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function f8t(t,e,n){let o=new Mq;const r=new _t,i=new _t,a=new Ba,l=new zq({depthPacking:a2e}),s=new Dq,c={},u=n.maxTextureSize,d={[$i]:js,[js]:$i,[zr]:zr},f=new Z0({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new _t},radius:{value:4}},vertexShader:u8t,fragmentShader:d8t}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const m=new Ni;m.setAttribute("position",new _a(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new os(m,f),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Sq;let x=this.type;this.render=function(S,v,b){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||S.length===0)return;const T=t.getRenderTarget(),R=t.getActiveCubeFace(),M=t.getActiveMipmapLevel(),D=t.state;D.setBlending(zh),D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);const k=x!==$2&&this.type===$2,N=x===$2&&this.type!==$2;for(let U=0,W=S.length;Uu||r.y>u)&&(r.x>u&&(i.x=Math.floor(u/L.x),r.x=i.x*L.x,E.mapSize.x=i.x),r.y>u&&(i.y=Math.floor(u/L.y),r.y=i.y*L.y,E.mapSize.y=i.y)),E.map===null||k===!0||N===!0){const Y=this.type!==$2?{minFilter:Cc,magFilter:Cc}:{};E.map!==null&&E.map.dispose(),E.map=new ku(r.x,r.y,Y),E.map.texture.name=F.name+".shadowMap",E.camera.updateProjectionMatrix()}t.setRenderTarget(E.map),t.clear();const j=E.getViewportCount();for(let Y=0;Y0||v.map&&v.alphaTest>0){const D=R.uuid,k=v.uuid;let N=c[D];N===void 0&&(N={},c[D]=N);let U=N[k];U===void 0&&(U=R.clone(),N[k]=U),R=U}if(R.visible=v.visible,R.wireframe=v.wireframe,T===$2?R.side=v.shadowSide!==null?v.shadowSide:v.side:R.side=v.shadowSide!==null?v.shadowSide:d[v.side],R.alphaMap=v.alphaMap,R.alphaTest=v.alphaTest,R.map=v.map,R.clipShadows=v.clipShadows,R.clippingPlanes=v.clippingPlanes,R.clipIntersection=v.clipIntersection,R.displacementMap=v.displacementMap,R.displacementScale=v.displacementScale,R.displacementBias=v.displacementBias,R.wireframeLinewidth=v.wireframeLinewidth,R.linewidth=v.linewidth,b.isPointLight===!0&&R.isMeshDistanceMaterial===!0){const D=t.properties.get(R);D.light=b}return R}function A(S,v,b,T,R){if(S.visible===!1)return;if(S.layers.test(v.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&R===$2)&&(!S.frustumCulled||o.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,S.matrixWorld);const k=e.update(S),N=S.material;if(Array.isArray(N)){const U=k.groups;for(let W=0,F=U.length;W=1):Y.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),L=j>=2);let O=null,_={};const G=t.getParameter(t.SCISSOR_BOX),Q=t.getParameter(t.VIEWPORT),oe=new Ba().fromArray(G),ee=new Ba().fromArray(Q);function q(Oe,ut,ht,Qe){const nt=new Uint8Array(4),mt=t.createTexture();t.bindTexture(Oe,mt),t.texParameteri(Oe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Oe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let tt=0;tt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let y;const w=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function C(Ae,se){return x?new OffscreenCanvas(Ae,se):nL("canvas")}function P(Ae,se,ge,we){let Se=1;if((Ae.width>we||Ae.height>we)&&(Se=we/Math.max(Ae.width,Ae.height)),Se<1||se===!0)if(typeof HTMLImageElement<"u"&&Ae instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Ae instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Ae instanceof ImageBitmap){const Me=se?SX:Math.floor,Ce=Me(Se*Ae.width),Te=Me(Se*Ae.height);y===void 0&&(y=C(Ce,Te));const Re=ge?C(Ce,Te):y;return Re.width=Ce,Re.height=Te,Re.getContext("2d").drawImage(Ae,0,0,Ce,Te),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+Ce+"x"+Te+")."),Re}else return"data"in Ae&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),Ae;return Ae}function A(Ae){return mde(Ae.width)&&mde(Ae.height)}function S(Ae){return l?!1:Ae.wrapS!==Ph||Ae.wrapT!==Ph||Ae.minFilter!==Cc&&Ae.minFilter!==cs}function v(Ae,se){return Ae.generateMipmaps&&se&&Ae.minFilter!==Cc&&Ae.minFilter!==cs}function b(Ae){t.generateMipmap(Ae)}function T(Ae,se,ge,we,Se=!1){if(l===!1)return se;if(Ae!==null){if(t[Ae]!==void 0)return t[Ae];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Ae+"'")}let Me=se;if(se===t.RED&&(ge===t.FLOAT&&(Me=t.R32F),ge===t.HALF_FLOAT&&(Me=t.R16F),ge===t.UNSIGNED_BYTE&&(Me=t.R8)),se===t.RED_INTEGER&&(ge===t.UNSIGNED_BYTE&&(Me=t.R8UI),ge===t.UNSIGNED_SHORT&&(Me=t.R16UI),ge===t.UNSIGNED_INT&&(Me=t.R32UI),ge===t.BYTE&&(Me=t.R8I),ge===t.SHORT&&(Me=t.R16I),ge===t.INT&&(Me=t.R32I)),se===t.RG&&(ge===t.FLOAT&&(Me=t.RG32F),ge===t.HALF_FLOAT&&(Me=t.RG16F),ge===t.UNSIGNED_BYTE&&(Me=t.RG8)),se===t.RGBA){const Ce=Se?qF:ys.getTransfer(we);ge===t.FLOAT&&(Me=t.RGBA32F),ge===t.HALF_FLOAT&&(Me=t.RGBA16F),ge===t.UNSIGNED_BYTE&&(Me=Ce===$s?t.SRGB8_ALPHA8:t.RGBA8),ge===t.UNSIGNED_SHORT_4_4_4_4&&(Me=t.RGBA4),ge===t.UNSIGNED_SHORT_5_5_5_1&&(Me=t.RGB5_A1)}return(Me===t.R16F||Me===t.R32F||Me===t.RG16F||Me===t.RG32F||Me===t.RGBA16F||Me===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Me}function R(Ae,se,ge){return v(Ae,ge)===!0||Ae.isFramebufferTexture&&Ae.minFilter!==Cc&&Ae.minFilter!==cs?Math.log2(Math.max(se.width,se.height))+1:Ae.mipmaps!==void 0&&Ae.mipmaps.length>0?Ae.mipmaps.length:Ae.isCompressedTexture&&Array.isArray(Ae.image)?se.mipmaps.length:1}function M(Ae){return Ae===Cc||Ae===vX||Ae===Ik?t.NEAREST:t.LINEAR}function D(Ae){const se=Ae.target;se.removeEventListener("dispose",D),N(se),se.isVideoTexture&&m.delete(se)}function k(Ae){const se=Ae.target;se.removeEventListener("dispose",k),W(se)}function N(Ae){const se=o.get(Ae);if(se.__webglInit===void 0)return;const ge=Ae.source,we=w.get(ge);if(we){const Se=we[se.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&U(Ae),Object.keys(we).length===0&&w.delete(ge)}o.remove(Ae)}function U(Ae){const se=o.get(Ae);t.deleteTexture(se.__webglTexture);const ge=Ae.source,we=w.get(ge);delete we[se.__cacheKey],a.memory.textures--}function W(Ae){const se=Ae.texture,ge=o.get(Ae),we=o.get(se);if(we.__webglTexture!==void 0&&(t.deleteTexture(we.__webglTexture),a.memory.textures--),Ae.depthTexture&&Ae.depthTexture.dispose(),Ae.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++){if(Array.isArray(ge.__webglFramebuffer[Se]))for(let Me=0;Me=s&&console.warn("THREE.WebGLTextures: Trying to use "+Ae+" texture units while this GPU supports only "+s),F+=1,Ae}function j(Ae){const se=[];return se.push(Ae.wrapS),se.push(Ae.wrapT),se.push(Ae.wrapR||0),se.push(Ae.magFilter),se.push(Ae.minFilter),se.push(Ae.anisotropy),se.push(Ae.internalFormat),se.push(Ae.format),se.push(Ae.type),se.push(Ae.generateMipmaps),se.push(Ae.premultiplyAlpha),se.push(Ae.flipY),se.push(Ae.unpackAlignment),se.push(Ae.colorSpace),se.join()}function Y(Ae,se){const ge=o.get(Ae);if(Ae.isVideoTexture&&ve(Ae),Ae.isRenderTargetTexture===!1&&Ae.version>0&&ge.__version!==Ae.version){const we=Ae.image;if(we===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(we.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Z(ge,Ae,se);return}}n.bindTexture(t.TEXTURE_2D,ge.__webglTexture,t.TEXTURE0+se)}function O(Ae,se){const ge=o.get(Ae);if(Ae.version>0&&ge.__version!==Ae.version){Z(ge,Ae,se);return}n.bindTexture(t.TEXTURE_2D_ARRAY,ge.__webglTexture,t.TEXTURE0+se)}function _(Ae,se){const ge=o.get(Ae);if(Ae.version>0&&ge.__version!==Ae.version){Z(ge,Ae,se);return}n.bindTexture(t.TEXTURE_3D,ge.__webglTexture,t.TEXTURE0+se)}function G(Ae,se){const ge=o.get(Ae);if(Ae.version>0&&ge.__version!==Ae.version){ne(ge,Ae,se);return}n.bindTexture(t.TEXTURE_CUBE_MAP,ge.__webglTexture,t.TEXTURE0+se)}const Q={[es]:t.REPEAT,[Ph]:t.CLAMP_TO_EDGE,[XF]:t.MIRRORED_REPEAT},oe={[Cc]:t.NEAREST,[vX]:t.NEAREST_MIPMAP_NEAREST,[Ik]:t.NEAREST_MIPMAP_LINEAR,[cs]:t.LINEAR,[qye]:t.LINEAR_MIPMAP_NEAREST,[V8]:t.LINEAR_MIPMAP_LINEAR},ee={[xOe]:t.NEVER,[ROe]:t.ALWAYS,[vOe]:t.LESS,[SOe]:t.LEQUAL,[bOe]:t.EQUAL,[COe]:t.GEQUAL,[TOe]:t.GREATER,[POe]:t.NOTEQUAL};function q(Ae,se,ge){if(ge?(t.texParameteri(Ae,t.TEXTURE_WRAP_S,Q[se.wrapS]),t.texParameteri(Ae,t.TEXTURE_WRAP_T,Q[se.wrapT]),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,Q[se.wrapR]),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,oe[se.magFilter]),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,oe[se.minFilter])):(t.texParameteri(Ae,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(Ae,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(se.wrapS!==Ph||se.wrapT!==Ph)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,M(se.magFilter)),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,M(se.minFilter)),se.minFilter!==Cc&&se.minFilter!==cs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),se.compareFunction&&(t.texParameteri(Ae,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(Ae,t.TEXTURE_COMPARE_FUNC,ee[se.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const we=e.get("EXT_texture_filter_anisotropic");if(se.magFilter===Cc||se.minFilter!==Ik&&se.minFilter!==V8||se.type===vy&&e.has("OES_texture_float_linear")===!1||l===!1&&se.type===G8&&e.has("OES_texture_half_float_linear")===!1)return;(se.anisotropy>1||o.get(se).__currentAnisotropy)&&(t.texParameterf(Ae,we.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(se.anisotropy,r.getMaxAnisotropy())),o.get(se).__currentAnisotropy=se.anisotropy)}}function ae(Ae,se){let ge=!1;Ae.__webglInit===void 0&&(Ae.__webglInit=!0,se.addEventListener("dispose",D));const we=se.source;let Se=w.get(we);Se===void 0&&(Se={},w.set(we,Se));const Me=j(se);if(Me!==Ae.__cacheKey){Se[Me]===void 0&&(Se[Me]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,ge=!0),Se[Me].usedTimes++;const Ce=Se[Ae.__cacheKey];Ce!==void 0&&(Se[Ae.__cacheKey].usedTimes--,Ce.usedTimes===0&&U(se)),Ae.__cacheKey=Me,Ae.__webglTexture=Se[Me].texture}return ge}function Z(Ae,se,ge){let we=t.TEXTURE_2D;(se.isDataArrayTexture||se.isCompressedArrayTexture)&&(we=t.TEXTURE_2D_ARRAY),se.isData3DTexture&&(we=t.TEXTURE_3D);const Se=ae(Ae,se),Me=se.source;n.bindTexture(we,Ae.__webglTexture,t.TEXTURE0+ge);const Ce=o.get(Me);if(Me.version!==Ce.__version||Se===!0){n.activeTexture(t.TEXTURE0+ge);const Te=ys.getPrimaries(ys.workingColorSpace),Re=se.colorSpace===Rp?null:ys.getPrimaries(se.colorSpace),Ne=se.colorSpace===Rp||Te===Re?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,se.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,se.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ne);const _e=S(se)&&A(se.image)===!1;let Ue=P(se.image,_e,!1,u);Ue=ze(se,Ue);const qe=A(Ue)||l,Fe=i.convert(se.format,se.colorSpace);let He=i.convert(se.type),Le=T(se.internalFormat,Fe,He,se.colorSpace,se.isVideoTexture);q(we,se,qe);let Ye;const lt=se.mipmaps,Oe=l&&se.isVideoTexture!==!0,ut=Ce.__version===void 0||Se===!0,ht=R(se,Ue,qe);if(se.isDepthTexture)Le=t.DEPTH_COMPONENT,l?se.type===vy?Le=t.DEPTH_COMPONENT32F:se.type===t3?Le=t.DEPTH_COMPONENT24:se.type===HA?Le=t.DEPTH24_STENCIL8:Le=t.DEPTH_COMPONENT16:se.type===vy&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),se.format===z8&&Le===t.DEPTH_COMPONENT&&se.type!==Pq&&se.type!==t3&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),se.type=t3,He=i.convert(se.type)),se.format===X8&&Le===t.DEPTH_COMPONENT&&(Le=t.DEPTH_STENCIL,se.type!==HA&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),se.type=HA,He=i.convert(se.type))),ut&&(Oe?n.texStorage2D(t.TEXTURE_2D,1,Le,Ue.width,Ue.height):n.texImage2D(t.TEXTURE_2D,0,Le,Ue.width,Ue.height,0,Fe,He,null));else if(se.isDataTexture)if(lt.length>0&&qe){Oe&&ut&&n.texStorage2D(t.TEXTURE_2D,ht,Le,lt[0].width,lt[0].height);for(let Qe=0,nt=lt.length;Qe>=1,nt>>=1}}else if(lt.length>0&&qe){Oe&&ut&&n.texStorage2D(t.TEXTURE_2D,ht,Le,lt[0].width,lt[0].height);for(let Qe=0,nt=lt.length;Qe0&&ut++,n.texStorage2D(t.TEXTURE_CUBE_MAP,ut,Ye,Ue[0].width,Ue[0].height));for(let Qe=0;Qe<6;Qe++)if(_e){lt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,0,0,Ue[Qe].width,Ue[Qe].height,He,Le,Ue[Qe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,Ye,Ue[Qe].width,Ue[Qe].height,0,He,Le,Ue[Qe].data);for(let nt=0;nt>Me),Ue=Math.max(1,se.height>>Me);Se===t.TEXTURE_3D||Se===t.TEXTURE_2D_ARRAY?n.texImage3D(Se,Me,Re,_e,Ue,se.depth,0,Ce,Te,null):n.texImage2D(Se,Me,Re,_e,Ue,0,Ce,Te,null)}n.bindFramebuffer(t.FRAMEBUFFER,Ae),Ie(se)?f.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,we,Se,o.get(ge).__webglTexture,0,pe(se)):(Se===t.TEXTURE_2D||Se>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Se<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,we,Se,o.get(ge).__webglTexture,Me),n.bindFramebuffer(t.FRAMEBUFFER,null)}function $(Ae,se,ge){if(t.bindRenderbuffer(t.RENDERBUFFER,Ae),se.depthBuffer&&!se.stencilBuffer){let we=l===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(ge||Ie(se)){const Se=se.depthTexture;Se&&Se.isDepthTexture&&(Se.type===vy?we=t.DEPTH_COMPONENT32F:Se.type===t3&&(we=t.DEPTH_COMPONENT24));const Me=pe(se);Ie(se)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Me,we,se.width,se.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,Me,we,se.width,se.height)}else t.renderbufferStorage(t.RENDERBUFFER,we,se.width,se.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,Ae)}else if(se.depthBuffer&&se.stencilBuffer){const we=pe(se);ge&&Ie(se)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,we,t.DEPTH24_STENCIL8,se.width,se.height):Ie(se)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,we,t.DEPTH24_STENCIL8,se.width,se.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,se.width,se.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,Ae)}else{const we=se.isWebGLMultipleRenderTargets===!0?se.texture:[se.texture];for(let Se=0;Se0){ge.__webglFramebuffer[Te]=[];for(let Re=0;Re0){ge.__webglFramebuffer=[];for(let Te=0;Te0&&Ie(Ae)===!1){const Te=Me?se:[se];ge.__webglMultisampledFramebuffer=t.createFramebuffer(),ge.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglMultisampledFramebuffer);for(let Re=0;Re0)for(let Re=0;Re0)for(let Re=0;Re0&&Ie(Ae)===!1){const se=Ae.isWebGLMultipleRenderTargets?Ae.texture:[Ae.texture],ge=Ae.width,we=Ae.height;let Se=t.COLOR_BUFFER_BIT;const Me=[],Ce=Ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Te=o.get(Ae),Re=Ae.isWebGLMultipleRenderTargets===!0;if(Re)for(let Ne=0;Ne0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&se.__useRenderToTexture!==!1}function ve(Ae){const se=a.render.frame;m.get(Ae)!==se&&(m.set(Ae,se),Ae.update())}function ze(Ae,se){const ge=Ae.colorSpace,we=Ae.format,Se=Ae.type;return Ae.isCompressedTexture===!0||Ae.isVideoTexture===!0||Ae.format===bX||ge!==Wy&&ge!==Rp&&(ys.getTransfer(ge)===$s?l===!1?e.has("EXT_sRGB")===!0&&we===y1?(Ae.format=bX,Ae.minFilter=cs,Ae.generateMipmaps=!1):se=s2e.sRGBToLinear(se):(we!==y1||Se!==xf)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ge)),se}this.allocateTextureUnit=L,this.resetTextureUnits=E,this.setTexture2D=Y,this.setTexture2DArray=O,this.setTexture3D=_,this.setTextureCube=G,this.rebindTextures=he,this.setupRenderTarget=me,this.updateRenderTargetMipmap=ce,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=te,this.useMultisampledRTT=Ie}function YOe(t,e,n){const o=n.isWebGL2;function r(i,a=Rp){let l;const s=ys.getTransfer(a);if(i===xf)return t.UNSIGNED_BYTE;if(i===Zye)return t.UNSIGNED_SHORT_4_4_4_4;if(i===e2e)return t.UNSIGNED_SHORT_5_5_5_1;if(i===lOe)return t.BYTE;if(i===sOe)return t.SHORT;if(i===Pq)return t.UNSIGNED_SHORT;if(i===Qye)return t.INT;if(i===t3)return t.UNSIGNED_INT;if(i===vy)return t.FLOAT;if(i===G8)return o?t.HALF_FLOAT:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(i===cOe)return t.ALPHA;if(i===y1)return t.RGBA;if(i===uOe)return t.LUMINANCE;if(i===dOe)return t.LUMINANCE_ALPHA;if(i===z8)return t.DEPTH_COMPONENT;if(i===X8)return t.DEPTH_STENCIL;if(i===bX)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(i===fOe)return t.RED;if(i===t2e)return t.RED_INTEGER;if(i===hOe)return t.RG;if(i===n2e)return t.RG_INTEGER;if(i===o2e)return t.RGBA_INTEGER;if(i===VV||i===GV||i===XV||i===JV)if(s===$s)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(i===VV)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===GV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===XV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===JV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(i===VV)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===GV)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===XV)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===JV)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===O0e||i===_0e||i===V0e||i===G0e)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(i===O0e)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===_0e)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===V0e)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===G0e)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===pOe)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===X0e||i===J0e)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(i===X0e)return s===$s?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(i===J0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===K0e||i===$0e||i===q0e||i===Q0e||i===Z0e||i===ede||i===tde||i===nde||i===ode||i===rde||i===ide||i===ade||i===lde||i===sde)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(i===K0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===$0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===q0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Q0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Z0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ede)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===tde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===nde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ode)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===rde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===ide)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===ade)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===lde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===sde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===KV||i===cde||i===ude)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(i===KV)return s===$s?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===cde)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ude)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===gOe||i===dde||i===fde||i===hde)if(l=e.get("EXT_texture_compression_rgtc"),l!==null){if(i===KV)return l.COMPRESSED_RED_RGTC1_EXT;if(i===dde)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===fde)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===hde)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===HA?o?t.UNSIGNED_INT_24_8:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):t[i]!==void 0?t[i]:null}return{convert:r}}class OOe extends A0{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let KC=class extends _l{constructor(){super(),this.isGroup=!0,this.type="Group"}};const g8t={type:"move"};class Sae{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new KC,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new KC,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ue,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ue),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new KC,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ue,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ue),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const o of e.hand.values())this._getHandJoint(n,o)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,o){let r=null,i=null,a=null;const l=this._targetRay,s=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const y of e.hand.values()){const w=n.getJointPose(y,o),x=this._getHandJoint(c,y);w!==null&&(x.matrix.fromArray(w.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=w.radius),x.visible=w!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),p=.02,m=.005;c.inputState.pinching&&f>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=n.getPose(e.gripSpace,o),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));l!==null&&(r=n.getPose(e.targetRaySpace,o),r===null&&i!==null&&(r=i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(g8t)))}return l!==null&&(l.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const o=new KC;o.matrixAutoUpdate=!1,o.visible=!1,e.joints[n.jointName]=o,e.add(o)}return e.joints[n.jointName]}}class Eq extends ic{constructor(e,n,o,r,i,a,l,s,c,u){if(u=u!==void 0?u:z8,u!==z8&&u!==X8)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&u===z8&&(o=t3),o===void 0&&u===X8&&(o=HA),super(null,r,i,a,l,s,u,o,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:Cc,this.minFilter=s!==void 0?s:Cc,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class m8t extends Sm{constructor(e,n){super();const o=this;let r=null,i=1,a=null,l="local-floor",s=1,c=null,u=null,d=null,f=null,p=null,m=null;const y=n.getContextAttributes();let w=null,x=null;const C=[],P=[],A=new A0;A.layers.enable(1),A.viewport=new Ba;const S=new A0;S.layers.enable(2),S.viewport=new Ba;const v=[A,S],b=new OOe;b.layers.enable(1),b.layers.enable(2);let T=null,R=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let _=C[O];return _===void 0&&(_=new Sae,C[O]=_),_.getTargetRaySpace()},this.getControllerGrip=function(O){let _=C[O];return _===void 0&&(_=new Sae,C[O]=_),_.getGripSpace()},this.getHand=function(O){let _=C[O];return _===void 0&&(_=new Sae,C[O]=_),_.getHandSpace()};function M(O){const _=P.indexOf(O.inputSource);if(_===-1)return;const G=C[_];G!==void 0&&(G.update(O.inputSource,O.frame,c||a),G.dispatchEvent({type:O.type,data:O.inputSource}))}function D(){r.removeEventListener("select",M),r.removeEventListener("selectstart",M),r.removeEventListener("selectend",M),r.removeEventListener("squeeze",M),r.removeEventListener("squeezestart",M),r.removeEventListener("squeezeend",M),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",k);for(let O=0;O=0&&(P[Q]=null,C[Q].disconnect(G))}for(let _=0;_=P.length){P.push(G),Q=ee;break}else if(P[ee]===null){P[ee]=G,Q=ee;break}if(Q===-1)break}const oe=C[Q];oe&&oe.connect(G)}}const N=new ue,U=new ue;function W(O,_,G){N.setFromMatrixPosition(_.matrixWorld),U.setFromMatrixPosition(G.matrixWorld);const Q=N.distanceTo(U),oe=_.projectionMatrix.elements,ee=G.projectionMatrix.elements,q=oe[14]/(oe[10]-1),ae=oe[14]/(oe[10]+1),Z=(oe[9]+1)/oe[5],ne=(oe[9]-1)/oe[5],te=(oe[8]-1)/oe[0],$=(ee[8]+1)/ee[0],le=q*te,de=q*$,he=Q/(-te+$),me=he*-te;_.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(me),O.translateZ(he),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const ce=q+he,Pe=ae+he,pe=le-me,Ie=de+(Q-me),ve=Z*ae/Pe*ce,ze=ne*ae/Pe*ce;O.projectionMatrix.makePerspective(pe,Ie,ve,ze,ce,Pe),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function F(O,_){_===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(_.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;b.near=S.near=A.near=O.near,b.far=S.far=A.far=O.far,(T!==b.near||R!==b.far)&&(r.updateRenderState({depthNear:b.near,depthFar:b.far}),T=b.near,R=b.far);const _=O.parent,G=b.cameras;F(b,_);for(let Q=0;Q0&&(w.alphaTest.value=x.alphaTest);const C=e.get(x).envMap;if(C&&(w.envMap.value=C,w.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=x.reflectivity,w.ior.value=x.ior,w.refractionRatio.value=x.refractionRatio),x.lightMap){w.lightMap.value=x.lightMap;const P=t._useLegacyLights===!0?Math.PI:1;w.lightMapIntensity.value=x.lightMapIntensity*P,n(x.lightMap,w.lightMapTransform)}x.aoMap&&(w.aoMap.value=x.aoMap,w.aoMapIntensity.value=x.aoMapIntensity,n(x.aoMap,w.aoMapTransform))}function a(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform))}function l(w,x){w.dashSize.value=x.dashSize,w.totalSize.value=x.dashSize+x.gapSize,w.scale.value=x.scale}function s(w,x,C,P){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.size.value=x.size*C,w.scale.value=P*.5,x.map&&(w.map.value=x.map,n(x.map,w.uvTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function c(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.rotation.value=x.rotation,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function u(w,x){w.specular.value.copy(x.specular),w.shininess.value=Math.max(x.shininess,1e-4)}function d(w,x){x.gradientMap&&(w.gradientMap.value=x.gradientMap)}function f(w,x){w.metalness.value=x.metalness,x.metalnessMap&&(w.metalnessMap.value=x.metalnessMap,n(x.metalnessMap,w.metalnessMapTransform)),w.roughness.value=x.roughness,x.roughnessMap&&(w.roughnessMap.value=x.roughnessMap,n(x.roughnessMap,w.roughnessMapTransform)),e.get(x).envMap&&(w.envMapIntensity.value=x.envMapIntensity)}function p(w,x,C){w.ior.value=x.ior,x.sheen>0&&(w.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),w.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(w.sheenColorMap.value=x.sheenColorMap,n(x.sheenColorMap,w.sheenColorMapTransform)),x.sheenRoughnessMap&&(w.sheenRoughnessMap.value=x.sheenRoughnessMap,n(x.sheenRoughnessMap,w.sheenRoughnessMapTransform))),x.clearcoat>0&&(w.clearcoat.value=x.clearcoat,w.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(w.clearcoatMap.value=x.clearcoatMap,n(x.clearcoatMap,w.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,n(x.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(w.clearcoatNormalMap.value=x.clearcoatNormalMap,n(x.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===js&&w.clearcoatNormalScale.value.negate())),x.iridescence>0&&(w.iridescence.value=x.iridescence,w.iridescenceIOR.value=x.iridescenceIOR,w.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(w.iridescenceMap.value=x.iridescenceMap,n(x.iridescenceMap,w.iridescenceMapTransform)),x.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=x.iridescenceThicknessMap,n(x.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),x.transmission>0&&(w.transmission.value=x.transmission,w.transmissionSamplerMap.value=C.texture,w.transmissionSamplerSize.value.set(C.width,C.height),x.transmissionMap&&(w.transmissionMap.value=x.transmissionMap,n(x.transmissionMap,w.transmissionMapTransform)),w.thickness.value=x.thickness,x.thicknessMap&&(w.thicknessMap.value=x.thicknessMap,n(x.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=x.attenuationDistance,w.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(w.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(w.anisotropyMap.value=x.anisotropyMap,n(x.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=x.specularIntensity,w.specularColor.value.copy(x.specularColor),x.specularColorMap&&(w.specularColorMap.value=x.specularColorMap,n(x.specularColorMap,w.specularColorMapTransform)),x.specularIntensityMap&&(w.specularIntensityMap.value=x.specularIntensityMap,n(x.specularIntensityMap,w.specularIntensityMapTransform))}function m(w,x){x.matcap&&(w.matcap.value=x.matcap)}function y(w,x){const C=e.get(x).light;w.referencePosition.value.setFromMatrixPosition(C.matrixWorld),w.nearDistance.value=C.shadow.camera.near,w.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:r}}function A8t(t,e,n,o){let r={},i={},a=[];const l=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function s(C,P){const A=P.program;o.uniformBlockBinding(C,A)}function c(C,P){let A=r[C.id];A===void 0&&(m(C),A=u(C),r[C.id]=A,C.addEventListener("dispose",w));const S=P.program;o.updateUBOMapping(C,S);const v=e.render.frame;i[C.id]!==v&&(f(C),i[C.id]=v)}function u(C){const P=d();C.__bindingPointIndex=P;const A=t.createBuffer(),S=C.__size,v=C.usage;return t.bindBuffer(t.UNIFORM_BUFFER,A),t.bufferData(t.UNIFORM_BUFFER,S,v),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,P,A),A}function d(){for(let C=0;C0){v=A%S;const k=S-v;v!==0&&k-M.boundary<0&&(A+=S-v,R.__offset=A)}A+=M.storage}return v=A%S,v>0&&(A+=S-v),C.__size=A,C.__cache={},this}function y(C){const P={boundary:0,storage:0};return typeof C=="number"?(P.boundary=4,P.storage=4):C.isVector2?(P.boundary=8,P.storage=8):C.isVector3||C.isColor?(P.boundary=16,P.storage=12):C.isVector4?(P.boundary=16,P.storage=16):C.isMatrix3?(P.boundary=48,P.storage=48):C.isMatrix4?(P.boundary=64,P.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),P}function w(C){const P=C.target;P.removeEventListener("dispose",w);const A=a.indexOf(P.__bindingPointIndex);a.splice(A,1),t.deleteBuffer(r[P.id]),delete r[P.id],delete i[P.id]}function x(){for(const C in r)t.deleteBuffer(r[C]);a=[],r={},i={}}return{bind:s,update:c,dispose:x}}class h2e{constructor(e={}){const{canvas:n=zOe(),context:o=null,depth:r=!0,stencil:i=!0,alpha:a=!1,antialias:l=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let f;o!==null?f=o.getContextAttributes().alpha:f=a;const p=new Uint32Array(4),m=new Int32Array(4);let y=null,w=null;const x=[],C=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=al,this._useLegacyLights=!1,this.toneMapping=w5,this.toneMappingExposure=1;const P=this;let A=!1,S=0,v=0,b=null,T=-1,R=null;const M=new Ba,D=new Ba;let k=null;const N=new ir(0);let U=0,W=n.width,F=n.height,E=1,L=null,j=null;const Y=new Ba(0,0,W,F),O=new Ba(0,0,W,F);let _=!1;const G=new Mq;let Q=!1,oe=!1,ee=null;const q=new qi,ae=new _t,Z=new ue,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return b===null?E:1}let $=o;function le(Je,st){for(let It=0;It{function Be(){if(ot.forEach(function(pt){Pe.get(pt).currentProgram.isReady()&&ot.delete(pt)}),ot.size===0){it(Je);return}setTimeout(Be,10)}de.get("KHR_parallel_shader_compile")!==null?Be():setTimeout(Be,10)})};let tt=null;function gt(Je){tt&&tt(Je)}function Ve(){et.stop()}function je(){et.start()}const et=new WOe;et.setAnimationLoop(gt),typeof self<"u"&&et.setContext(self),this.setAnimationLoop=function(Je){tt=Je,Ye.setAnimationLoop(Je),Je===null?et.stop():et.start()},Ye.addEventListener("sessionstart",Ve),Ye.addEventListener("sessionend",je),this.render=function(Je,st){if(st!==void 0&&st.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;Je.matrixWorldAutoUpdate===!0&&Je.updateMatrixWorld(),st.parent===null&&st.matrixWorldAutoUpdate===!0&&st.updateMatrixWorld(),Ye.enabled===!0&&Ye.isPresenting===!0&&(Ye.cameraAutoUpdate===!0&&Ye.updateCamera(st),st=Ye.getCamera()),Je.isScene===!0&&Je.onBeforeRender(P,Je,st,b),w=Me.get(Je,C.length),w.init(),C.push(w),q.multiplyMatrices(st.projectionMatrix,st.matrixWorldInverse),G.setFromProjectionMatrix(q),oe=this.localClippingEnabled,Q=Ce.init(this.clippingPlanes,oe),y=Se.get(Je,x.length),y.init(),x.push(y),bt(Je,st,0,P.sortObjects),y.finish(),P.sortObjects===!0&&y.sort(L,j),this.info.render.frame++,Q===!0&&Ce.beginShadows();const It=w.state.shadowsArray;if(Te.render(It,Je,st),Q===!0&&Ce.endShadows(),this.info.autoReset===!0&&this.info.reset(),Re.render(y,Je),w.setupLights(P._useLegacyLights),st.isArrayCamera){const ot=st.cameras;for(let it=0,Be=ot.length;it0?w=C[C.length-1]:w=null,x.pop(),x.length>0?y=x[x.length-1]:y=null};function bt(Je,st,It,ot){if(Je.visible===!1)return;if(Je.layers.test(st.layers)){if(Je.isGroup)It=Je.renderOrder;else if(Je.isLOD)Je.autoUpdate===!0&&Je.update(st);else if(Je.isLight)w.pushLight(Je),Je.castShadow&&w.pushShadow(Je);else if(Je.isSprite){if(!Je.frustumCulled||G.intersectsSprite(Je)){ot&&Z.setFromMatrixPosition(Je.matrixWorld).applyMatrix4(q);const pt=se.update(Je),ct=Je.material;ct.visible&&y.push(Je,pt,ct,It,Z.z,null)}}else if((Je.isMesh||Je.isLine||Je.isPoints)&&(!Je.frustumCulled||G.intersectsObject(Je))){const pt=se.update(Je),ct=Je.material;if(ot&&(Je.boundingSphere!==void 0?(Je.boundingSphere===null&&Je.computeBoundingSphere(),Z.copy(Je.boundingSphere.center)):(pt.boundingSphere===null&&pt.computeBoundingSphere(),Z.copy(pt.boundingSphere.center)),Z.applyMatrix4(Je.matrixWorld).applyMatrix4(q)),Array.isArray(ct)){const Xe=pt.groups;for(let ft=0,wt=Xe.length;ft0&&Pt(it,Be,st,It),ot&&me.viewport(M.copy(ot)),it.length>0&&Yt(it,st,It),Be.length>0&&Yt(Be,st,It),pt.length>0&&Yt(pt,st,It),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function Pt(Je,st,It,ot){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;const Be=he.isWebGL2;ee===null&&(ee=new ku(1,1,{generateMipmaps:!0,type:de.has("EXT_color_buffer_half_float")?G8:xf,minFilter:V8,samples:Be?4:0})),P.getDrawingBufferSize(ae),Be?ee.setSize(ae.x,ae.y):ee.setSize(SX(ae.x),SX(ae.y));const pt=P.getRenderTarget();P.setRenderTarget(ee),P.getClearColor(N),U=P.getClearAlpha(),U<1&&P.setClearColor(16777215,.5),P.clear();const ct=P.toneMapping;P.toneMapping=w5,Yt(Je,It,ot),pe.updateMultisampleRenderTarget(ee),pe.updateRenderTargetMipmap(ee);let Xe=!1;for(let ft=0,wt=st.length;ft0),kt=!!It.morphAttributes.position,Zt=!!It.morphAttributes.normal,Ot=!!It.morphAttributes.color;let on=w5;ot.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(on=P.toneMapping);const qt=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,rn=qt!==void 0?qt.length:0,Pn=Pe.get(ot),fo=w.state.lights;if(Q===!0&&(oe===!0||Je!==R)){const wo=Je===R&&ot.id===T;Ce.setState(ot,Je,wo)}let to=!1;ot.version===Pn.__version?(Pn.needsLights&&Pn.lightsStateVersion!==fo.state.version||Pn.outputColorSpace!==ct||it.isInstancedMesh&&Pn.instancing===!1||!it.isInstancedMesh&&Pn.instancing===!0||it.isSkinnedMesh&&Pn.skinning===!1||!it.isSkinnedMesh&&Pn.skinning===!0||it.isInstancedMesh&&Pn.instancingColor===!0&&it.instanceColor===null||it.isInstancedMesh&&Pn.instancingColor===!1&&it.instanceColor!==null||Pn.envMap!==Xe||ot.fog===!0&&Pn.fog!==Be||Pn.numClippingPlanes!==void 0&&(Pn.numClippingPlanes!==Ce.numPlanes||Pn.numIntersection!==Ce.numIntersection)||Pn.vertexAlphas!==ft||Pn.vertexTangents!==wt||Pn.morphTargets!==kt||Pn.morphNormals!==Zt||Pn.morphColors!==Ot||Pn.toneMapping!==on||he.isWebGL2===!0&&Pn.morphTargetsCount!==rn)&&(to=!0):(to=!0,Pn.__version=ot.version);let Dt=Pn.currentProgram;to===!0&&(Dt=Rt(ot,st,it));let fn=!1,kn=!1,yo=!1;const ur=Dt.getUniforms(),lr=Pn.uniforms;if(me.useProgram(Dt.program)&&(fn=!0,kn=!0,yo=!0),ot.id!==T&&(T=ot.id,kn=!0),fn||R!==Je){ur.setValue($,"projectionMatrix",Je.projectionMatrix),ur.setValue($,"viewMatrix",Je.matrixWorldInverse);const wo=ur.map.cameraPosition;wo!==void 0&&wo.setValue($,Z.setFromMatrixPosition(Je.matrixWorld)),he.logarithmicDepthBuffer&&ur.setValue($,"logDepthBufFC",2/(Math.log(Je.far+1)/Math.LN2)),(ot.isMeshPhongMaterial||ot.isMeshToonMaterial||ot.isMeshLambertMaterial||ot.isMeshBasicMaterial||ot.isMeshStandardMaterial||ot.isShaderMaterial)&&ur.setValue($,"isOrthographic",Je.isOrthographicCamera===!0),R!==Je&&(R=Je,kn=!0,yo=!0)}if(it.isSkinnedMesh){ur.setOptional($,it,"bindMatrix"),ur.setOptional($,it,"bindMatrixInverse");const wo=it.skeleton;wo&&(he.floatVertexTextures?(wo.boneTexture===null&&wo.computeBoneTexture(),ur.setValue($,"boneTexture",wo.boneTexture,pe),ur.setValue($,"boneTextureSize",wo.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const xo=It.morphAttributes;if((xo.position!==void 0||xo.normal!==void 0||xo.color!==void 0&&he.isWebGL2===!0)&&Ne.update(it,It,Dt),(kn||Pn.receiveShadow!==it.receiveShadow)&&(Pn.receiveShadow=it.receiveShadow,ur.setValue($,"receiveShadow",it.receiveShadow)),ot.isMeshGouraudMaterial&&ot.envMap!==null&&(lr.envMap.value=Xe,lr.flipEnvMap.value=Xe.isCubeTexture&&Xe.isRenderTargetTexture===!1?-1:1),kn&&(ur.setValue($,"toneMappingExposure",P.toneMappingExposure),Pn.needsLights&&Et(lr,yo),Be&&ot.fog===!0&&we.refreshFogUniforms(lr,Be),we.refreshMaterialUniforms(lr,ot,E,F,ee),qV.upload($,Ct(Pn),lr,pe)),ot.isShaderMaterial&&ot.uniformsNeedUpdate===!0&&(qV.upload($,Ct(Pn),lr,pe),ot.uniformsNeedUpdate=!1),ot.isSpriteMaterial&&ur.setValue($,"center",it.center),ur.setValue($,"modelViewMatrix",it.modelViewMatrix),ur.setValue($,"normalMatrix",it.normalMatrix),ur.setValue($,"modelMatrix",it.matrixWorld),ot.isShaderMaterial||ot.isRawShaderMaterial){const wo=ot.uniformsGroups;for(let Rr=0,Eo=wo.length;Rr0&&pe.useMultisampledRTT(Je)===!1?it=Pe.get(Je).__webglMultisampledFramebuffer:Array.isArray(wt)?it=wt[It]:it=wt,M.copy(Je.viewport),D.copy(Je.scissor),k=Je.scissorTest}else M.copy(Y).multiplyScalar(E).floor(),D.copy(O).multiplyScalar(E).floor(),k=_;if(me.bindFramebuffer($.FRAMEBUFFER,it)&&he.drawBuffers&&ot&&me.drawBuffers(Je,it),me.viewport(M),me.scissor(D),me.setScissorTest(k),Be){const Xe=Pe.get(Je.texture);$.framebufferTexture2D($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,$.TEXTURE_CUBE_MAP_POSITIVE_X+st,Xe.__webglTexture,It)}else if(pt){const Xe=Pe.get(Je.texture),ft=st||0;$.framebufferTextureLayer($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,Xe.__webglTexture,It||0,ft)}T=-1},this.readRenderTargetPixels=function(Je,st,It,ot,it,Be,pt){if(!(Je&&Je.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=Pe.get(Je).__webglFramebuffer;if(Je.isWebGLCubeRenderTarget&&pt!==void 0&&(ct=ct[pt]),ct){me.bindFramebuffer($.FRAMEBUFFER,ct);try{const Xe=Je.texture,ft=Xe.format,wt=Xe.type;if(ft!==y1&&qe.convert(ft)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const kt=wt===G8&&(de.has("EXT_color_buffer_half_float")||he.isWebGL2&&de.has("EXT_color_buffer_float"));if(wt!==xf&&qe.convert(wt)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_TYPE)&&!(wt===vy&&(he.isWebGL2||de.has("OES_texture_float")||de.has("WEBGL_color_buffer_float")))&&!kt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}st>=0&&st<=Je.width-ot&&It>=0&&It<=Je.height-it&&$.readPixels(st,It,ot,it,qe.convert(ft),qe.convert(wt),Be)}finally{const Xe=b!==null?Pe.get(b).__webglFramebuffer:null;me.bindFramebuffer($.FRAMEBUFFER,Xe)}}},this.copyFramebufferToTexture=function(Je,st,It=0){const ot=Math.pow(2,-It),it=Math.floor(st.image.width*ot),Be=Math.floor(st.image.height*ot);pe.setTexture2D(st,0),$.copyTexSubImage2D($.TEXTURE_2D,It,0,0,Je.x,Je.y,it,Be),me.unbindTexture()},this.copyTextureToTexture=function(Je,st,It,ot=0){const it=st.image.width,Be=st.image.height,pt=qe.convert(It.format),ct=qe.convert(It.type);pe.setTexture2D(It,0),$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,It.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,It.unpackAlignment),st.isDataTexture?$.texSubImage2D($.TEXTURE_2D,ot,Je.x,Je.y,it,Be,pt,ct,st.image.data):st.isCompressedTexture?$.compressedTexSubImage2D($.TEXTURE_2D,ot,Je.x,Je.y,st.mipmaps[0].width,st.mipmaps[0].height,pt,st.mipmaps[0].data):$.texSubImage2D($.TEXTURE_2D,ot,Je.x,Je.y,pt,ct,st.image),ot===0&&It.generateMipmaps&&$.generateMipmap($.TEXTURE_2D),me.unbindTexture()},this.copyTextureToTexture3D=function(Je,st,It,ot,it=0){if(P.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Be=Je.max.x-Je.min.x+1,pt=Je.max.y-Je.min.y+1,ct=Je.max.z-Je.min.z+1,Xe=qe.convert(ot.format),ft=qe.convert(ot.type);let wt;if(ot.isData3DTexture)pe.setTexture3D(ot,0),wt=$.TEXTURE_3D;else if(ot.isDataArrayTexture)pe.setTexture2DArray(ot,0),wt=$.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,ot.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ot.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,ot.unpackAlignment);const kt=$.getParameter($.UNPACK_ROW_LENGTH),Zt=$.getParameter($.UNPACK_IMAGE_HEIGHT),Ot=$.getParameter($.UNPACK_SKIP_PIXELS),on=$.getParameter($.UNPACK_SKIP_ROWS),qt=$.getParameter($.UNPACK_SKIP_IMAGES),rn=It.isCompressedTexture?It.mipmaps[0]:It.image;$.pixelStorei($.UNPACK_ROW_LENGTH,rn.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,rn.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,Je.min.x),$.pixelStorei($.UNPACK_SKIP_ROWS,Je.min.y),$.pixelStorei($.UNPACK_SKIP_IMAGES,Je.min.z),It.isDataTexture||It.isData3DTexture?$.texSubImage3D(wt,it,st.x,st.y,st.z,Be,pt,ct,Xe,ft,rn.data):It.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),$.compressedTexSubImage3D(wt,it,st.x,st.y,st.z,Be,pt,ct,Xe,rn.data)):$.texSubImage3D(wt,it,st.x,st.y,st.z,Be,pt,ct,Xe,ft,rn),$.pixelStorei($.UNPACK_ROW_LENGTH,kt),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,Zt),$.pixelStorei($.UNPACK_SKIP_PIXELS,Ot),$.pixelStorei($.UNPACK_SKIP_ROWS,on),$.pixelStorei($.UNPACK_SKIP_IMAGES,qt),it===0&&ot.generateMipmaps&&$.generateMipmap(wt),me.unbindTexture()},this.initTexture=function(Je){Je.isCubeTexture?pe.setTextureCube(Je,0):Je.isData3DTexture?pe.setTexture3D(Je,0):Je.isDataArrayTexture||Je.isCompressedArrayTexture?pe.setTexture2DArray(Je,0):pe.setTexture2D(Je,0),me.unbindTexture()},this.resetState=function(){S=0,v=0,b=null,me.reset(),Fe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return n3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===Rq?"display-p3":"srgb",n.unpackColorSpace=ys.workingColorSpace===MN?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===al?D8:i2e}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===D8?al:Wy}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class _Oe extends h2e{}_Oe.prototype.isWebGL1Renderer=!0;class kq{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ir(e),this.density=n}clone(){return new kq(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Fq{constructor(e,n=1,o=1e3){this.isFog=!0,this.name="",this.color=new ir(e),this.near=n,this.far=o}clone(){return new Fq(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class cH extends _l{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class Lq{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=eL,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=cm()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,o){e*=this.stride,o*=n.stride;for(let r=0,i=this.stride;re.far||n.push({distance:s,point:FD.clone(),uv:wh.getInterpolation(FD,qY,WD,QY,Qxe,Tae,Zxe,new _t),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function ZY(t,e,n,o,r,i){bP.subVectors(t,n).addScalar(.5).multiply(o),r!==void 0?(LD.x=i*bP.x-r*bP.y,LD.y=r*bP.x+i*bP.y):LD.copy(bP),t.copy(e),t.x+=LD.x,t.y+=LD.y,t.applyMatrix4(VOe)}const eO=new ue,eve=new ue;class GOe extends _l{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let o=0,r=n.length;o0){let o,r;for(o=1,r=n.length;o0){eO.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(eO);this.getObjectForDistance(r).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){eO.setFromMatrixPosition(e.matrixWorld),eve.setFromMatrixPosition(this.matrixWorld);const o=eO.distanceTo(eve)/e.zoom;n[0].object.visible=!0;let r,i;for(r=1,i=n.length;r=a)n[r-1].object.visible=!1,n[r].object.visible=!0;else break}for(this._currentLevel=r-1;rs)continue;f.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(f);Te.far||n.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}else{const x=Math.max(0,a.start),C=Math.min(w.count,a.start+a.count);for(let P=x,A=C-1;Ps)continue;f.applyMatrix4(this.matrixWorld);const v=e.ray.origin.distanceTo(f);ve.far||n.push({distance:v,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,o=Object.keys(n);if(o.length>0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;i0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;ir.far)return;i.push({distance:c,distanceToRay:Math.sqrt(l),point:s,index:e,face:null,object:a})}}class b8t extends ic{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:cs,this.magFilter=i!==void 0?i:cs,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class S8t extends ic{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Cc,this.minFilter=Cc,this.generateMipmaps=!1,this.needsUpdate=!0}}class Nq extends ic{constructor(e,n,o,r,i,a,l,s,c,u,d,f){super(null,a,l,s,c,u,r,i,d,f),this.isCompressedTexture=!0,this.image={width:n,height:o},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class T8t extends Nq{constructor(e,n,o,r,i,a){super(e,n,o,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Ph}}class P8t extends Nq{constructor(e,n,o){super(void 0,e[0].width,e[0].height,n,o,KA),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class o3 extends ic{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}let U5=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const o=this.getUtoTmapping(e);return this.getPoint(o,n)}getPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPoint(o/e));return n}getSpacedPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPointAt(o/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let o,r=this.getPoint(0),i=0;n.push(0);for(let a=1;a<=e;a++)o=this.getPoint(a/e),i+=o.distanceTo(r),n.push(i),r=o;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const o=this.getLengths();let r=0;const i=o.length;let a;n?a=n:a=e*o[i-1];let l=0,s=i-1,c;for(;l<=s;)if(r=Math.floor(l+(s-l)/2),c=o[r]-a,c<0)l=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,o[r]===a)return r/(i-1);const u=o[r],f=o[r+1]-u,p=(a-u)/f;return(r+p)/(i-1)}getTangent(e,n){let r=e-1e-4,i=e+1e-4;r<0&&(r=0),i>1&&(i=1);const a=this.getPoint(r),l=this.getPoint(i),s=n||(a.isVector2?new _t:new ue);return s.copy(l).sub(a).normalize(),s}getTangentAt(e,n){const o=this.getUtoTmapping(e);return this.getTangent(o,n)}computeFrenetFrames(e,n){const o=new ue,r=[],i=[],a=[],l=new ue,s=new qi;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new ue)}i[0]=new ue,a[0]=new ue;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,o.set(1,0,0)),d<=c&&(c=d,o.set(0,1,0)),f<=c&&o.set(0,0,1),l.crossVectors(r[0],o).normalize(),i[0].crossVectors(r[0],l),a[0].crossVectors(r[0],i[0]);for(let p=1;p<=e;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),l.crossVectors(r[p-1],r[p]),l.length()>Number.EPSILON){l.normalize();const m=Math.acos(Eu(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(l,m))}a[p].crossVectors(r[p],i[p])}if(n===!0){let p=Math.acos(Eu(i[0].dot(i[e]),-1,1));p/=e,r[0].dot(l.crossVectors(i[0],i[e]))>0&&(p=-p);for(let m=1;m<=e;m++)i[m].applyMatrix4(s.makeRotationAxis(r[m],p*m)),a[m].crossVectors(r[m],i[m])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}};class x5 extends U5{constructor(e=0,n=0,o=1,r=1,i=0,a=Math.PI*2,l=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=o,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=l,this.aRotation=s}getPoint(e,n){const o=n||new _t,r=Math.PI*2;let i=this.aEndAngle-this.aStartAngle;const a=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:s===0&&l===i-1&&(l=i-2,s=1);let c,u;this.closed||l>0?c=r[(l-1)%i]:(aO.subVectors(r[0],r[1]).add(r[0]),c=aO);const d=r[l%i],f=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return o.set(mve(l,s.x,c.x,u.x,d.x),mve(l,s.y,c.y,u.y,d.y)),o}copy(e){super.copy(e),this.points=[];for(let n=0,o=e.points.length;n=o){const a=r[i]-o,l=this.curves[i],s=l.getLength(),c=s===0?0:1-a/s;return l.getPointAt(c,n)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let o=0,r=this.curves.length;o1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,o=e.curves.length;n0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class DN extends Ni{constructor(e=[new _t(0,-.5),new _t(.5,0),new _t(0,.5)],n=12,o=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:o,phiLength:r},n=Math.floor(n),r=Eu(r,0,Math.PI*2);const i=[],a=[],l=[],s=[],c=[],u=1/n,d=new ue,f=new _t,p=new ue,m=new ue,y=new ue;let w=0,x=0;for(let C=0;C<=e.length-1;C++)switch(C){case 0:w=e[C+1].x-e[C].x,x=e[C+1].y-e[C].y,p.x=x*1,p.y=-w,p.z=x*0,y.copy(p),p.normalize(),s.push(p.x,p.y,p.z);break;case e.length-1:s.push(y.x,y.y,y.z);break;default:w=e[C+1].x-e[C].x,x=e[C+1].y-e[C].y,p.x=x*1,p.y=-w,p.z=x*0,m.copy(p),p.x+=y.x,p.y+=y.y,p.z+=y.z,p.normalize(),s.push(p.x,p.y,p.z),y.copy(m)}for(let C=0;C<=n;C++){const P=o+C*u*r,A=Math.sin(P),S=Math.cos(P);for(let v=0;v<=e.length-1;v++){d.x=e[v].x*A,d.y=e[v].y,d.z=e[v].x*S,a.push(d.x,d.y,d.z),f.x=C/n,f.y=v/(e.length-1),l.push(f.x,f.y);const b=s[3*v+0]*A,T=s[3*v+1],R=s[3*v+0]*S;c.push(b,T,R)}}for(let C=0;C0&&P(!0),n>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new Ar(d,3)),this.setAttribute("normal",new Ar(f,3)),this.setAttribute("uv",new Ar(p,2));function C(){const A=new ue,S=new ue;let v=0;const b=(n-e)/o;for(let T=0;T<=i;T++){const R=[],M=T/i,D=M*(n-e)+e;for(let k=0;k<=r;k++){const N=k/r,U=N*s+l,W=Math.sin(U),F=Math.cos(U);S.x=D*W,S.y=-M*o+w,S.z=D*F,d.push(S.x,S.y,S.z),A.set(W,b,F).normalize(),f.push(A.x,A.y,A.z),p.push(N,1-M),R.push(m++)}y.push(R)}for(let T=0;T.9&&b<.1&&(P<.2&&(a[C+0]+=1),A<.2&&(a[C+2]+=1),S<.2&&(a[C+4]+=1))}}function f(C){i.push(C.x,C.y,C.z)}function p(C,P){const A=C*3;P.x=e[A+0],P.y=e[A+1],P.z=e[A+2]}function m(){const C=new ue,P=new ue,A=new ue,S=new ue,v=new _t,b=new _t,T=new _t;for(let R=0,M=0;R80*n){l=c=t[0],s=u=t[1];for(let m=n;mc&&(c=d),f>u&&(u=f);p=Math.max(c-l,u-s),p=p!==0?32767/p:0}return iL(i,a,n,l,s,p,0),a}};function r_e(t,e,n,o,r){let i,a;if(r===K8t(t,e,n,o)>0)for(i=e;i=e;i-=o)a=yve(i,t[i],t[i+1],a);return a&&Vq(a,a.next)&&(lL(a),a=a.next),a}function Bb(t,e){if(!t)return t;e||(e=t);let n=t,o;do if(o=!1,!n.steiner&&(Vq(n,n.next)||fu(n.prev,n,n.next)===0)){if(lL(n),n=e=n.prev,n===n.next)break;o=!0}else n=n.next;while(o||n!==e);return e}function iL(t,e,n,o,r,i,a){if(!t)return;!a&&i&&O8t(t,o,r,i);let l=t,s,c;for(;t.prev!==t.next;){if(s=t.prev,c=t.next,i?F8t(t,o,r,i):k8t(t)){e.push(s.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),lL(t),t=c.next,l=c.next;continue}if(t=c,t===l){a?a===1?(t=L8t(Bb(t),e,n),iL(t,e,n,o,r,i,2)):a===2&&W8t(t,e,n,o,r,i):iL(Bb(t),e,n,o,r,i,1);break}}}function k8t(t){const e=t.prev,n=t,o=t.next;if(fu(e,n,o)>=0)return!1;const r=e.x,i=n.x,a=o.x,l=e.y,s=n.y,c=o.y,u=ri?r>a?r:a:i>a?i:a,p=l>s?l>c?l:c:s>c?s:c;let m=o.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&$C(r,l,i,s,a,c,m.x,m.y)&&fu(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function F8t(t,e,n,o){const r=t.prev,i=t,a=t.next;if(fu(r,i,a)>=0)return!1;const l=r.x,s=i.x,c=a.x,u=r.y,d=i.y,f=a.y,p=ls?l>c?l:c:s>c?s:c,w=u>d?u>f?u:f:d>f?d:f,x=xde(p,m,e,n,o),C=xde(y,w,e,n,o);let P=t.prevZ,A=t.nextZ;for(;P&&P.z>=x&&A&&A.z<=C;){if(P.x>=p&&P.x<=y&&P.y>=m&&P.y<=w&&P!==r&&P!==a&&$C(l,u,s,d,c,f,P.x,P.y)&&fu(P.prev,P,P.next)>=0||(P=P.prevZ,A.x>=p&&A.x<=y&&A.y>=m&&A.y<=w&&A!==r&&A!==a&&$C(l,u,s,d,c,f,A.x,A.y)&&fu(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;P&&P.z>=x;){if(P.x>=p&&P.x<=y&&P.y>=m&&P.y<=w&&P!==r&&P!==a&&$C(l,u,s,d,c,f,P.x,P.y)&&fu(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;A&&A.z<=C;){if(A.x>=p&&A.x<=y&&A.y>=m&&A.y<=w&&A!==r&&A!==a&&$C(l,u,s,d,c,f,A.x,A.y)&&fu(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function L8t(t,e,n){let o=t;do{const r=o.prev,i=o.next.next;!Vq(r,i)&&i_e(r,o,o.next,i)&&aL(r,i)&&aL(i,r)&&(e.push(r.i/n|0),e.push(o.i/n|0),e.push(i.i/n|0),lL(o),lL(o.next),o=t=i),o=o.next}while(o!==t);return Bb(o)}function W8t(t,e,n,o,r,i){let a=t;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&G8t(a,l)){let s=a_e(a,l);a=Bb(a,a.next),s=Bb(s,s.next),iL(a,e,n,o,r,i,0),iL(s,e,n,o,r,i,0);return}l=l.next}a=a.next}while(a!==t)}function N8t(t,e,n,o){const r=[];let i,a,l,s,c;for(i=0,a=e.length;i=n.next.y&&n.next.y!==n.y){const f=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=i&&f>o&&(o=f,r=n.x=n.x&&n.x>=s&&i!==n.x&&$C(ar.x||n.x===r.x&&Y8t(r,n)))&&(r=n,u=d)),n=n.next;while(n!==l);return r}function Y8t(t,e){return fu(t.prev,t,e.prev)<0&&fu(e.next,t,t.next)<0}function O8t(t,e,n,o){let r=t;do r.z===0&&(r.z=xde(r.x,r.y,e,n,o)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,_8t(r)}function _8t(t){let e,n,o,r,i,a,l,s,c=1;do{for(n=t,t=null,i=null,a=0;n;){for(a++,o=n,l=0,e=0;e0||s>0&&o;)l!==0&&(s===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,l--):(r=o,o=o.nextZ,s--),i?i.nextZ=r:t=r,r.prevZ=i,i=r;n=o}i.nextZ=null,c*=2}while(a>1);return t}function xde(t,e,n,o,r){return t=(t-n)*r|0,e=(e-o)*r|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function V8t(t){let e=t,n=t;do(e.x=(t-a)*(i-l)&&(t-a)*(o-l)>=(n-a)*(e-l)&&(n-a)*(i-l)>=(r-a)*(o-l)}function G8t(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!X8t(t,e)&&(aL(t,e)&&aL(e,t)&&J8t(t,e)&&(fu(t.prev,t,e.prev)||fu(t,e.prev,e))||Vq(t,e)&&fu(t.prev,t,t.next)>0&&fu(e.prev,e,e.next)>0)}function fu(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Vq(t,e){return t.x===e.x&&t.y===e.y}function i_e(t,e,n,o){const r=dO(fu(t,e,n)),i=dO(fu(t,e,o)),a=dO(fu(n,o,t)),l=dO(fu(n,o,e));return!!(r!==i&&a!==l||r===0&&uO(t,n,e)||i===0&&uO(t,o,e)||a===0&&uO(n,t,o)||l===0&&uO(n,e,o))}function uO(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function dO(t){return t>0?1:t<0?-1:0}function X8t(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&i_e(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function aL(t,e){return fu(t.prev,t,t.next)<0?fu(t,e,t.next)>=0&&fu(t,t.prev,e)>=0:fu(t,e,t.prev)<0||fu(t,t.next,e)<0}function J8t(t,e){let n=t,o=!1;const r=(t.x+e.x)/2,i=(t.y+e.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==t);return o}function a_e(t,e){const n=new vde(t.i,t.x,t.y),o=new vde(e.i,e.x,e.y),r=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,o.next=n,n.prev=o,i.next=o,o.prev=i,o}function yve(t,e,n,o){const r=new vde(t,e,n);return o?(r.next=o.next,r.prev=o,o.next.prev=r,o.next=r):(r.prev=r,r.next=r),r}function lL(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function vde(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function K8t(t,e,n,o){let r=0;for(let i=e,a=n-o;i2&&t[e-1].equals(t[0])&&t.pop()}function wve(t,e){for(let n=0;nNumber.EPSILON){const se=Math.sqrt(ze),ge=Math.sqrt(Ie*Ie+ve*ve),we=le.x-pe/se,Se=le.y+Pe/se,Me=de.x-ve/ge,Ce=de.y+Ie/ge,Te=((Me-we)*ve-(Ce-Se)*Ie)/(Pe*ve-pe*Ie);he=we+Pe*Te-$.x,me=Se+pe*Te-$.y;const Re=he*he+me*me;if(Re<=2)return new _t(he,me);ce=Math.sqrt(Re/2)}else{let se=!1;Pe>Number.EPSILON?Ie>Number.EPSILON&&(se=!0):Pe<-Number.EPSILON?Ie<-Number.EPSILON&&(se=!0):Math.sign(pe)===Math.sign(ve)&&(se=!0),se?(he=-pe,me=Pe,ce=Math.sqrt(ze)):(he=Pe,me=pe,ce=Math.sqrt(ze/2))}return new _t(he/ce,me/ce)}const j=[];for(let $=0,le=U.length,de=le-1,he=$+1;$=0;$--){const le=$/w,de=p*Math.cos(le*Math.PI/2),he=m*Math.sin(le*Math.PI/2)+y;for(let me=0,ce=U.length;me=0;){const he=de;let me=de-1;me<0&&(me=$.length-1);for(let ce=0,Pe=u+w*2;ce0)&&p.push(P,A,v),(x!==o-1||s0!=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 iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=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}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.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,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}}class S2e extends id{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ir(16777215),this.specular=new ir(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ir(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=HN,this.reflectivity=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.specular.copy(e.specular),this.shininess=e.shininess,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.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.flatShading=e.flatShading,this.fog=e.fog,this}}class u_e extends id{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ir(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ir(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class T2e extends id{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class d_e extends id{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ir(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ir(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=HN,this.reflectivity=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.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.flatShading=e.flatShading,this.fog=e.fog,this}}class f_e extends id{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ir(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class h_e extends _p{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Lv(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function p_e(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function g_e(t){function e(r,i){return t[r]-t[i]}const n=t.length,o=new Array(n);for(let r=0;r!==n;++r)o[r]=r;return o.sort(e),o}function bde(t,e,n){const o=t.length,r=new t.constructor(o);for(let i=0,a=0;a!==o;++i){const l=n[i]*e;for(let s=0;s!==e;++s)r[a++]=t[l+s]}return r}function P2e(t,e,n,o){let r=1,i=t[0];for(;i!==void 0&&i[o]===void 0;)i=t[r++];if(i===void 0)return;let a=i[o];if(a!==void 0)if(Array.isArray(a))do a=i[o],a!==void 0&&(e.push(i.time),n.push.apply(n,a)),i=t[r++];while(i!==void 0);else if(a.toArray!==void 0)do a=i[o],a!==void 0&&(e.push(i.time),a.toArray(n,n.length)),i=t[r++];while(i!==void 0);else do a=i[o],a!==void 0&&(e.push(i.time),n.push(a)),i=t[r++];while(i!==void 0)}function Z8t(t,e,n,o,r=30){const i=t.clone();i.name=e;const a=[];for(let s=0;s=o)){d.push(c.times[p]);for(let y=0;yi.tracks[s].times[0]&&(l=i.tracks[s].times[0]);for(let s=0;s=l.times[m]){const x=m*d+u,C=x+d-u;y=l.values.slice(x,C)}else{const x=l.createInterpolant(),C=u,P=d-u;x.evaluate(i),y=x.resultBuffer.slice(C,P)}s==="quaternion"&&new zs().fromArray(y).normalize().conjugate().toArray(y);const w=c.times.length;for(let x=0;x=i)){const l=n[1];e=i)break t}a=o,o=0;break n}break e}for(;o>>1;en;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);const l=this.getValueSize();this.times=o.slice(i,a),this.values=this.values.slice(i*l,a*l)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const o=this.times,r=this.values,i=o.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==i;l++){const s=o[l];if(typeof s=="number"&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,s),e=!1;break}if(a!==null&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,s,a),e=!1;break}a=s}if(r!==void 0&&p_e(r))for(let l=0,s=r.length;l!==s;++l){const c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),o=this.getValueSize(),r=this.getInterpolation()===$V,i=e.length-1;let a=1;for(let l=1;l0){e[a]=e[i];for(let l=i*o,s=a*o,c=0;c!==o;++c)n[s+c]=n[l+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*o)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),o=this.constructor,r=new o(this.name,e,n);return r.createInterpolant=this.createInterpolant,r}}j5.prototype.TimeBufferType=Float32Array;j5.prototype.ValueBufferType=Float32Array;j5.prototype.DefaultInterpolation=KF;class vS extends j5{}vS.prototype.ValueTypeName="bool";vS.prototype.ValueBufferType=Array;vS.prototype.DefaultInterpolation=JF;vS.prototype.InterpolantFactoryMethodLinear=void 0;vS.prototype.InterpolantFactoryMethodSmooth=void 0;class R2e extends j5{}R2e.prototype.ValueTypeName="color";class sL extends j5{}sL.prototype.ValueTypeName="number";class A_e extends FN{constructor(e,n,o,r){super(e,n,o,r)}interpolate_(e,n,o,r){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,s=(o-n)/(r-n);let c=e*l;for(let u=c+l;c!==u;c+=4)zs.slerpFlat(i,0,a,c-l,a,c,s);return i}}class LM extends j5{InterpolantFactoryMethodLinear(e){return new A_e(this.times,this.values,this.getValueSize(),e)}}LM.prototype.ValueTypeName="quaternion";LM.prototype.DefaultInterpolation=KF;LM.prototype.InterpolantFactoryMethodSmooth=void 0;class bS extends j5{}bS.prototype.ValueTypeName="string";bS.prototype.ValueBufferType=Array;bS.prototype.DefaultInterpolation=JF;bS.prototype.InterpolantFactoryMethodLinear=void 0;bS.prototype.InterpolantFactoryMethodSmooth=void 0;class cL extends j5{}cL.prototype.ValueTypeName="vector";class uL{constructor(e,n=-1,o,r=Cq){this.name=e,this.tracks=o,this.duration=n,this.blendMode=r,this.uuid=cm(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],o=e.tracks,r=1/(e.fps||1);for(let a=0,l=o.length;a!==l;++a)n.push(o7t(o[a]).scale(r));const i=new this(e.name,e.duration,n,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){const n=[],o=e.tracks,r={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let i=0,a=o.length;i!==a;++i)n.push(j5.toJSON(o[i]));return r}static CreateFromMorphTargetSequence(e,n,o,r){const i=n.length,a=[];for(let l=0;l1){const d=u[1];let f=r[d];f||(r[d]=f=[]),f.push(c)}}const a=[];for(const l in r)a.push(this.CreateFromMorphTargetSequence(l,r[l],n,o));return a}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const o=function(d,f,p,m,y){if(p.length!==0){const w=[],x=[];P2e(p,w,x,m),w.length!==0&&y.push(new d(f,w,x))}},r=[],i=e.name||"default",a=e.fps||30,l=e.blendMode;let s=e.length||-1;const c=e.hierarchy||[];for(let d=0;d{n&&n(i),this.manager.itemEnd(e)},0),i;if(q6[e]!==void 0){q6[e].push({onLoad:n,onProgress:o,onError:r});return}q6[e]=[],q6[e].push({onLoad:n,onProgress:o,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,s=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=q6[e],d=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=f?parseInt(f):0,m=p!==0;let y=0;const w=new ReadableStream({start(x){C();function C(){d.read().then(({done:P,value:A})=>{if(P)x.close();else{y+=A.byteLength;const S=new ProgressEvent("progress",{lengthComputable:m,loaded:y,total:p});for(let v=0,b=u.length;v{switch(s){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,l));case"json":return c.json();default:if(l===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(l),f=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{Yb.add(e,c);const u=q6[e];delete q6[e];for(let d=0,f=u.length;d{const u=q6[e];if(u===void 0)throw this.manager.itemError(e),c;delete q6[e];for(let d=0,f=u.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class i7t extends Vp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new R3(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{n(i.parse(JSON.parse(l)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},o,r)}parse(e){const n=[];for(let o=0;o0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const i in e.uniforms){const a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=o(a.value);break;case"c":r.uniforms[i].value=new ir().setHex(a.value);break;case"v2":r.uniforms[i].value=new _t().fromArray(a.value);break;case"v3":r.uniforms[i].value=new ue().fromArray(a.value);break;case"v4":r.uniforms[i].value=new Ba().fromArray(a.value);break;case"m3":r.uniforms[i].value=new ma().fromArray(a.value);break;case"m4":r.uniforms[i].value=new qi().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const i in e.extensions)r.extensions[i]=e.extensions[i];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=o(e.map)),e.matcap!==void 0&&(r.matcap=o(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=o(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=o(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=o(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),r.normalScale=new _t().fromArray(i)}return e.displacementMap!==void 0&&(r.displacementMap=o(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=o(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=o(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=o(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=o(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=o(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=o(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=o(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=o(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=o(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=o(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=o(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=o(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=o(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new _t().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=o(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=o(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=o(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=o(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=o(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=o(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=o(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const n={ShadowMaterial:l_e,SpriteMaterial:Wq,RawShaderMaterial:s_e,ShaderMaterial:Z0,PointsMaterial:m2e,MeshPhysicalMaterial:c_e,MeshStandardMaterial:vf,MeshPhongMaterial:S2e,MeshToonMaterial:u_e,MeshNormalMaterial:T2e,MeshLambertMaterial:d_e,MeshDepthMaterial:zq,MeshDistanceMaterial:Dq,MeshBasicMaterial:_3,MeshMatcapMaterial:f_e,LineDashedMaterial:h_e,LineBasicMaterial:_p,Material:id};return new n[e]}}class Sde{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let o=0,r=e.length;o0){const s=new H2e(n);i=new dL(s),i.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){r=new dL(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,l=e.length;a"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,o,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,a=Yb.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){n&&n(a),i.manager.itemEnd(e)},0),a;const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,fetch(e,l).then(function(s){return s.blob()}).then(function(s){return createImageBitmap(s,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(s){Yb.add(e,s),n&&n(s),i.manager.itemEnd(e)}).catch(function(s){r&&r(s),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}let fO;class I2e{static getContext(){return fO===void 0&&(fO=new(window.AudioContext||window.webkitAudioContext)),fO}static setContext(e){fO=e}}class g7t extends Vp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new R3(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(s){try{const c=s.slice(0);I2e.getContext().decodeAudioData(c,function(d){n(d)},l)}catch(c){l(c)}},o,r);function l(s){r?r(s):console.error(s),i.manager.itemError(e)}}}const Rve=new qi,Hve=new qi,Lx=new qi;class m7t{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new A0,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new A0,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Lx.copy(e.projectionMatrix);const r=n.eyeSep/2,i=r*n.near/n.focus,a=n.near*Math.tan(cb*n.fov*.5)/n.zoom;let l,s;Hve.elements[12]=-r,Rve.elements[12]=r,l=-a*n.aspect+i,s=a*n.aspect+i,Lx.elements[0]=2*n.near/(s-l),Lx.elements[8]=(s+l)/(s-l),this.cameraL.projectionMatrix.copy(Lx),l=-a*n.aspect-i,s=a*n.aspect-i,Lx.elements[0]=2*n.near/(s-l),Lx.elements[8]=(s+l)/(s-l),this.cameraR.projectionMatrix.copy(Lx)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Hve),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Rve)}}class z2e{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Mve(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=Mve();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function Mve(){return(typeof performance>"u"?Date:performance).now()}const Wx=new ue,Ive=new zs,y7t=new ue,Nx=new ue;class A7t extends _l{constructor(){super(),this.type="AudioListener",this.context=I2e.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new z2e}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,o=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Wx,Ive,y7t),Nx.set(0,0,-1).applyQuaternion(Ive),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Wx.x,r),n.positionY.linearRampToValueAtTime(Wx.y,r),n.positionZ.linearRampToValueAtTime(Wx.z,r),n.forwardX.linearRampToValueAtTime(Nx.x,r),n.forwardY.linearRampToValueAtTime(Nx.y,r),n.forwardZ.linearRampToValueAtTime(Nx.z,r),n.upX.linearRampToValueAtTime(o.x,r),n.upY.linearRampToValueAtTime(o.y,r),n.upZ.linearRampToValueAtTime(o.z,r)}else n.setPosition(Wx.x,Wx.y,Wx.z),n.setOrientation(Nx.x,Nx.y,Nx.z,o.x,o.y,o.z)}}class M_e extends _l{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(o,r,this._addIndex*n,1,n);for(let s=n,c=n+n;s!==c;++s)if(o[s]!==o[s+n]){l.setValue(o,r);break}}saveOriginalState(){const e=this.binding,n=this.buffer,o=this.valueSize,r=o*this._origIndex;e.getValue(n,r);for(let i=o,a=r;i!==a;++i)n[i]=n[r+i%o];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let o=e;o=.5)for(let a=0;a!==i;++a)e[n+a]=e[o+a]}_slerp(e,n,o,r){zs.slerpFlat(e,n,e,n,e,o,r)}_slerpAdditive(e,n,o,r,i){const a=this._workIndex*i;zs.multiplyQuaternionsFlat(e,a,e,n,e,o),zs.slerpFlat(e,n,e,n,e,a,r)}_lerp(e,n,o,r,i){const a=1-r;for(let l=0;l!==i;++l){const s=n+l;e[s]=e[s]*a+e[o+l]*r}}_lerpAdditive(e,n,o,r,i){for(let a=0;a!==i;++a){const l=n+a;e[l]=e[l]+e[o+a]*r}}}const D2e="\\[\\]\\.:\\/",b7t=new RegExp("["+D2e+"]","g"),E2e="[^"+D2e+"]",S7t="[^"+D2e.replace("\\.","")+"]",T7t=/((?:WC+[\/:])*)/.source.replace("WC",E2e),P7t=/(WCOD+)?/.source.replace("WCOD",S7t),C7t=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",E2e),R7t=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",E2e),H7t=new RegExp("^"+T7t+P7t+C7t+R7t+"$"),M7t=["material","materials","bones","map"];class I7t{constructor(e,n,o){const r=o||Cl.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,r)}getValue(e,n){this.bind();const o=this._targetGroup.nCachedObjects_,r=this._bindings[o];r!==void 0&&r.getValue(e,n)}setValue(e,n){const o=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=o.length;r!==i;++r)o[r].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].unbind()}}class Cl{constructor(e,n,o){this.path=n,this.parsedPath=o||Cl.parseTrackName(n),this.node=Cl.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,o){return e&&e.isAnimationObjectGroup?new Cl.Composite(e,n,o):new Cl(e,n,o)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(b7t,"")}static parseTrackName(e){const n=H7t.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const o={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=o.nodeName&&o.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const i=o.nodeName.substring(r+1);M7t.indexOf(i)!==-1&&(o.nodeName=o.nodeName.substring(0,r),o.objectName=i)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return o}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const o=e.skeleton.getBoneByName(n);if(o!==void 0)return o}if(e.children){const o=function(i){for(let a=0;a=i){const d=i++,f=e[d];n[f.uuid]=u,e[u]=f,n[c]=d,e[d]=s;for(let p=0,m=r;p!==m;++p){const y=o[p],w=y[d],x=y[u];y[u]=w,y[d]=x}}}this.nCachedObjects_=i}uncache(){const e=this._objects,n=this._indicesByUUID,o=this._bindings,r=o.length;let i=this.nCachedObjects_,a=e.length;for(let l=0,s=arguments.length;l!==s;++l){const c=arguments[l],u=c.uuid,d=n[u];if(d!==void 0)if(delete n[u],d0&&(n[p.uuid]=d),e[d]=p,e.pop();for(let m=0,y=r;m!==y;++m){const w=o[m];w[d]=w[f],w.pop()}}}this.nCachedObjects_=i}subscribe_(e,n){const o=this._bindingsIndicesByPath;let r=o[e];const i=this._bindings;if(r!==void 0)return i[r];const a=this._paths,l=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,d=new Array(c);r=i.length,o[e]=r,a.push(e),l.push(n),i.push(d);for(let f=u,p=s.length;f!==p;++f){const m=s[f];d[f]=new Cl(m,e,n)}return d}unsubscribe_(e){const n=this._bindingsIndicesByPath,o=n[e];if(o!==void 0){const r=this._paths,i=this._parsedPaths,a=this._bindings,l=a.length-1,s=a[l],c=e[l];n[c]=o,a[o]=s,a.pop(),i[o]=i[l],i.pop(),r[o]=r[l],r.pop()}}}class z_e{constructor(e,n,o=null,r=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=o,this.blendMode=r;const i=n.tracks,a=i.length,l=new Array(a),s={endingStart:Ev,endingEnd:Ev};for(let c=0;c!==a;++c){const u=i[c].createInterpolant(null);l[c]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=yOe,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,o){if(e.fadeOut(n),this.fadeIn(n),o){const r=this._clip.duration,i=e._clip.duration,a=i/r,l=r/i;e.warp(1,a,n),this.warp(l,1,n)}return this}crossFadeTo(e,n,o){return e.crossFadeFrom(this,n,o)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,o){const r=this._mixer,i=r.time,a=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);const s=l.parameterPositions,c=l.sampleValues;return s[0]=i,s[1]=i+o,c[0]=e/a,c[1]=n/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,o,r){if(!this.enabled){this._updateWeight(e);return}const i=this._startTime;if(i!==null){const s=(e-i)*o;s<0||o===0?n=0:(this._startTime=null,n=o*s)}n*=this._updateTimeScale(e);const a=this._updateTime(n),l=this._updateWeight(e);if(l>0){const s=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case r2e:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulateAdditive(l);break;case Cq:default:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulate(r,l)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const o=this._weightInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const o=this._timeScaleInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,o=this.loop;let r=this.time+e,i=this._loopCount;const a=o===AOe;if(e===0)return i===-1?r:a&&(i&1)===1?n-r:r;if(o===mOe){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=n)r=n;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=n||r<0){const l=Math.floor(r/n);r-=n*l,i+=Math.abs(l);const s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?n:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(s===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=r;if(a&&(i&1)===1)return n-r}return r}_setEndings(e,n,o){const r=this._interpolantSettings;o?(r.endingStart=kv,r.endingEnd=kv):(e?r.endingStart=this.zeroSlopeAtStart?kv:Ev:r.endingStart=$F,n?r.endingEnd=this.zeroSlopeAtEnd?kv:Ev:r.endingEnd=$F)}_scheduleFading(e,n,o){const r=this._mixer,i=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const l=a.parameterPositions,s=a.sampleValues;return l[0]=i,s[0]=n,l[1]=i+e,s[1]=o,this}}const D7t=new Float32Array(1);class E7t extends Sm{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const o=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,l=e._interpolants,s=o.uuid,c=this._bindingsByRootAndName;let u=c[s];u===void 0&&(u={},c[s]=u);for(let d=0;d!==i;++d){const f=r[d],p=f.name;let m=u[p];if(m!==void 0)++m.referenceCount,a[d]=m;else{if(m=a[d],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,s,p));continue}const y=n&&n._propertyBindings[d].binding.parsedPath;m=new I_e(Cl.create(o,p,y),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,s,p),a[d]=m}l[d].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const o=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,o)}const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];i.useCount++===0&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--o)e[o].stop();return this}update(e){e*=this.timeScale;const n=this._actions,o=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==o;++c)n[c]._update(r,e,i,a);const l=this._bindings,s=this._nActiveBindings;for(let c=0;c!==s;++c)l[c].apply(a);return this}setTime(e){this.time=0;for(let n=0;nthis.max.x||e.ythis.max.y)}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}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Eve).distanceTo(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}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)}}const kve=new ue,hO=new ue;class k2e{constructor(e=new ue,n=new ue){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){kve.subVectors(e,this.start),hO.subVectors(this.end,this.start);const o=hO.dot(hO);let i=hO.dot(kve)/o;return n&&(i=Eu(i,0,1)),i}closestPointToPoint(e,n,o){const r=this.closestPointToPointParameter(e,n);return this.delta(o).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Fve=new ue;class U7t extends _l{constructor(e,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const o=new Ni,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,l=1,s=32;a1)for(let d=0;d.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{jve.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(jve,n)}}setLength(e,n=e*.2,o=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(o,n,o),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Q7t extends G3{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],o=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Ni;r.setAttribute("position",new Ar(n,3)),r.setAttribute("color",new Ar(o,3));const i=new _p({vertexColors:!0,toneMapped:!1});super(r,i),this.type="AxesHelper"}setColors(e,n,o){const r=new ir,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(n),r.toArray(i,6),r.toArray(i,9),r.set(o),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class E_e{constructor(){this.type="ShapePath",this.color=new ir,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new rL,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,o,r){return this.currentPath.quadraticCurveTo(e,n,o,r),this}bezierCurveTo(e,n,o,r,i,a){return this.currentPath.bezierCurveTo(e,n,o,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(x){const C=[];for(let P=0,A=x.length;PNumber.EPSILON){if(M<0&&(b=C[v],R=-R,T=C[S],M=-M),x.yT.y)continue;if(x.y===b.y){if(x.x===b.x)return!0}else{const D=M*(x.x-b.x)-R*(x.y-b.y);if(D===0)return!0;if(D<0)continue;A=!A}}else{if(x.y!==b.y)continue;if(T.x<=x.x&&x.x<=b.x||b.x<=x.x&&x.x<=T.x)return!0}}return A}const r=p3.isClockWise,i=this.subPaths;if(i.length===0)return[];let a,l,s;const c=[];if(i.length===1)return l=i[0],s=new jl,s.curves=l.curves,c.push(s),c;let u=!r(i[0].getPoints());u=e?!u:u;const d=[],f=[];let p=[],m=0,y;f[m]=void 0,p[m]=[];for(let x=0,C=i.length;x1){let x=!1,C=0;for(let P=0,A=f.length;P0&&x===!1&&(p=d)}let w;for(let x=0,C=f.length;xu||r.y>u)&&(r.x>u&&(i.x=Math.floor(u/L.x),r.x=i.x*L.x,E.mapSize.x=i.x),r.y>u&&(i.y=Math.floor(u/L.y),r.y=i.y*L.y,E.mapSize.y=i.y)),E.map===null||k===!0||N===!0){const Y=this.type!==$2?{minFilter:Cc,magFilter:Cc}:{};E.map!==null&&E.map.dispose(),E.map=new ku(r.x,r.y,Y),E.map.texture.name=F.name+".shadowMap",E.camera.updateProjectionMatrix()}t.setRenderTarget(E.map),t.clear();const j=E.getViewportCount();for(let Y=0;Y0||v.map&&v.alphaTest>0){const D=R.uuid,k=v.uuid;let N=c[D];N===void 0&&(N={},c[D]=N);let U=N[k];U===void 0&&(U=R.clone(),N[k]=U),R=U}if(R.visible=v.visible,R.wireframe=v.wireframe,T===$2?R.side=v.shadowSide!==null?v.shadowSide:v.side:R.side=v.shadowSide!==null?v.shadowSide:d[v.side],R.alphaMap=v.alphaMap,R.alphaTest=v.alphaTest,R.map=v.map,R.clipShadows=v.clipShadows,R.clippingPlanes=v.clippingPlanes,R.clipIntersection=v.clipIntersection,R.displacementMap=v.displacementMap,R.displacementScale=v.displacementScale,R.displacementBias=v.displacementBias,R.wireframeLinewidth=v.wireframeLinewidth,R.linewidth=v.linewidth,b.isPointLight===!0&&R.isMeshDistanceMaterial===!0){const D=t.properties.get(R);D.light=b}return R}function A(S,v,b,T,R){if(S.visible===!1)return;if(S.layers.test(v.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&R===$2)&&(!S.frustumCulled||o.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,S.matrixWorld);const k=e.update(S),N=S.material;if(Array.isArray(N)){const U=k.groups;for(let W=0,F=U.length;W=1):Y.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),L=j>=2);let O=null,_={};const G=t.getParameter(t.SCISSOR_BOX),Q=t.getParameter(t.VIEWPORT),oe=new Ba().fromArray(G),ee=new Ba().fromArray(Q);function $(Oe,ut,ht,Qe){const nt=new Uint8Array(4),mt=t.createTexture();t.bindTexture(Oe,mt),t.texParameteri(Oe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Oe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let tt=0;tt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let y;const w=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function C(Ae,se){return x?new OffscreenCanvas(Ae,se):nL("canvas")}function P(Ae,se,ge,we){let Se=1;if((Ae.width>we||Ae.height>we)&&(Se=we/Math.max(Ae.width,Ae.height)),Se<1||se===!0)if(typeof HTMLImageElement<"u"&&Ae instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Ae instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Ae instanceof ImageBitmap){const Me=se?SX:Math.floor,Ce=Me(Se*Ae.width),Te=Me(Se*Ae.height);y===void 0&&(y=C(Ce,Te));const Re=ge?C(Ce,Te):y;return Re.width=Ce,Re.height=Te,Re.getContext("2d").drawImage(Ae,0,0,Ce,Te),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+Ce+"x"+Te+")."),Re}else return"data"in Ae&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),Ae;return Ae}function A(Ae){return mde(Ae.width)&&mde(Ae.height)}function S(Ae){return l?!1:Ae.wrapS!==Ph||Ae.wrapT!==Ph||Ae.minFilter!==Cc&&Ae.minFilter!==cs}function v(Ae,se){return Ae.generateMipmaps&&se&&Ae.minFilter!==Cc&&Ae.minFilter!==cs}function b(Ae){t.generateMipmap(Ae)}function T(Ae,se,ge,we,Se=!1){if(l===!1)return se;if(Ae!==null){if(t[Ae]!==void 0)return t[Ae];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Ae+"'")}let Me=se;if(se===t.RED&&(ge===t.FLOAT&&(Me=t.R32F),ge===t.HALF_FLOAT&&(Me=t.R16F),ge===t.UNSIGNED_BYTE&&(Me=t.R8)),se===t.RED_INTEGER&&(ge===t.UNSIGNED_BYTE&&(Me=t.R8UI),ge===t.UNSIGNED_SHORT&&(Me=t.R16UI),ge===t.UNSIGNED_INT&&(Me=t.R32UI),ge===t.BYTE&&(Me=t.R8I),ge===t.SHORT&&(Me=t.R16I),ge===t.INT&&(Me=t.R32I)),se===t.RG&&(ge===t.FLOAT&&(Me=t.RG32F),ge===t.HALF_FLOAT&&(Me=t.RG16F),ge===t.UNSIGNED_BYTE&&(Me=t.RG8)),se===t.RGBA){const Ce=Se?qF:ys.getTransfer(we);ge===t.FLOAT&&(Me=t.RGBA32F),ge===t.HALF_FLOAT&&(Me=t.RGBA16F),ge===t.UNSIGNED_BYTE&&(Me=Ce===$s?t.SRGB8_ALPHA8:t.RGBA8),ge===t.UNSIGNED_SHORT_4_4_4_4&&(Me=t.RGBA4),ge===t.UNSIGNED_SHORT_5_5_5_1&&(Me=t.RGB5_A1)}return(Me===t.R16F||Me===t.R32F||Me===t.RG16F||Me===t.RG32F||Me===t.RGBA16F||Me===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Me}function R(Ae,se,ge){return v(Ae,ge)===!0||Ae.isFramebufferTexture&&Ae.minFilter!==Cc&&Ae.minFilter!==cs?Math.log2(Math.max(se.width,se.height))+1:Ae.mipmaps!==void 0&&Ae.mipmaps.length>0?Ae.mipmaps.length:Ae.isCompressedTexture&&Array.isArray(Ae.image)?se.mipmaps.length:1}function M(Ae){return Ae===Cc||Ae===vX||Ae===Ik?t.NEAREST:t.LINEAR}function D(Ae){const se=Ae.target;se.removeEventListener("dispose",D),N(se),se.isVideoTexture&&m.delete(se)}function k(Ae){const se=Ae.target;se.removeEventListener("dispose",k),W(se)}function N(Ae){const se=o.get(Ae);if(se.__webglInit===void 0)return;const ge=Ae.source,we=w.get(ge);if(we){const Se=we[se.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&U(Ae),Object.keys(we).length===0&&w.delete(ge)}o.remove(Ae)}function U(Ae){const se=o.get(Ae);t.deleteTexture(se.__webglTexture);const ge=Ae.source,we=w.get(ge);delete we[se.__cacheKey],a.memory.textures--}function W(Ae){const se=Ae.texture,ge=o.get(Ae),we=o.get(se);if(we.__webglTexture!==void 0&&(t.deleteTexture(we.__webglTexture),a.memory.textures--),Ae.depthTexture&&Ae.depthTexture.dispose(),Ae.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++){if(Array.isArray(ge.__webglFramebuffer[Se]))for(let Me=0;Me=s&&console.warn("THREE.WebGLTextures: Trying to use "+Ae+" texture units while this GPU supports only "+s),F+=1,Ae}function j(Ae){const se=[];return se.push(Ae.wrapS),se.push(Ae.wrapT),se.push(Ae.wrapR||0),se.push(Ae.magFilter),se.push(Ae.minFilter),se.push(Ae.anisotropy),se.push(Ae.internalFormat),se.push(Ae.format),se.push(Ae.type),se.push(Ae.generateMipmaps),se.push(Ae.premultiplyAlpha),se.push(Ae.flipY),se.push(Ae.unpackAlignment),se.push(Ae.colorSpace),se.join()}function Y(Ae,se){const ge=o.get(Ae);if(Ae.isVideoTexture&&ve(Ae),Ae.isRenderTargetTexture===!1&&Ae.version>0&&ge.__version!==Ae.version){const we=Ae.image;if(we===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(we.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Z(ge,Ae,se);return}}n.bindTexture(t.TEXTURE_2D,ge.__webglTexture,t.TEXTURE0+se)}function O(Ae,se){const ge=o.get(Ae);if(Ae.version>0&&ge.__version!==Ae.version){Z(ge,Ae,se);return}n.bindTexture(t.TEXTURE_2D_ARRAY,ge.__webglTexture,t.TEXTURE0+se)}function _(Ae,se){const ge=o.get(Ae);if(Ae.version>0&&ge.__version!==Ae.version){Z(ge,Ae,se);return}n.bindTexture(t.TEXTURE_3D,ge.__webglTexture,t.TEXTURE0+se)}function G(Ae,se){const ge=o.get(Ae);if(Ae.version>0&&ge.__version!==Ae.version){ne(ge,Ae,se);return}n.bindTexture(t.TEXTURE_CUBE_MAP,ge.__webglTexture,t.TEXTURE0+se)}const Q={[es]:t.REPEAT,[Ph]:t.CLAMP_TO_EDGE,[XF]:t.MIRRORED_REPEAT},oe={[Cc]:t.NEAREST,[vX]:t.NEAREST_MIPMAP_NEAREST,[Ik]:t.NEAREST_MIPMAP_LINEAR,[cs]:t.LINEAR,[qye]:t.LINEAR_MIPMAP_NEAREST,[V8]:t.LINEAR_MIPMAP_LINEAR},ee={[xOe]:t.NEVER,[ROe]:t.ALWAYS,[vOe]:t.LESS,[SOe]:t.LEQUAL,[bOe]:t.EQUAL,[COe]:t.GEQUAL,[TOe]:t.GREATER,[POe]:t.NOTEQUAL};function $(Ae,se,ge){if(ge?(t.texParameteri(Ae,t.TEXTURE_WRAP_S,Q[se.wrapS]),t.texParameteri(Ae,t.TEXTURE_WRAP_T,Q[se.wrapT]),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,Q[se.wrapR]),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,oe[se.magFilter]),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,oe[se.minFilter])):(t.texParameteri(Ae,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(Ae,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(se.wrapS!==Ph||se.wrapT!==Ph)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,M(se.magFilter)),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,M(se.minFilter)),se.minFilter!==Cc&&se.minFilter!==cs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),se.compareFunction&&(t.texParameteri(Ae,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(Ae,t.TEXTURE_COMPARE_FUNC,ee[se.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const we=e.get("EXT_texture_filter_anisotropic");if(se.magFilter===Cc||se.minFilter!==Ik&&se.minFilter!==V8||se.type===vy&&e.has("OES_texture_float_linear")===!1||l===!1&&se.type===G8&&e.has("OES_texture_half_float_linear")===!1)return;(se.anisotropy>1||o.get(se).__currentAnisotropy)&&(t.texParameterf(Ae,we.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(se.anisotropy,r.getMaxAnisotropy())),o.get(se).__currentAnisotropy=se.anisotropy)}}function ae(Ae,se){let ge=!1;Ae.__webglInit===void 0&&(Ae.__webglInit=!0,se.addEventListener("dispose",D));const we=se.source;let Se=w.get(we);Se===void 0&&(Se={},w.set(we,Se));const Me=j(se);if(Me!==Ae.__cacheKey){Se[Me]===void 0&&(Se[Me]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,ge=!0),Se[Me].usedTimes++;const Ce=Se[Ae.__cacheKey];Ce!==void 0&&(Se[Ae.__cacheKey].usedTimes--,Ce.usedTimes===0&&U(se)),Ae.__cacheKey=Me,Ae.__webglTexture=Se[Me].texture}return ge}function Z(Ae,se,ge){let we=t.TEXTURE_2D;(se.isDataArrayTexture||se.isCompressedArrayTexture)&&(we=t.TEXTURE_2D_ARRAY),se.isData3DTexture&&(we=t.TEXTURE_3D);const Se=ae(Ae,se),Me=se.source;n.bindTexture(we,Ae.__webglTexture,t.TEXTURE0+ge);const Ce=o.get(Me);if(Me.version!==Ce.__version||Se===!0){n.activeTexture(t.TEXTURE0+ge);const Te=ys.getPrimaries(ys.workingColorSpace),Re=se.colorSpace===Rp?null:ys.getPrimaries(se.colorSpace),Ne=se.colorSpace===Rp||Te===Re?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,se.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,se.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ne);const _e=S(se)&&A(se.image)===!1;let Ue=P(se.image,_e,!1,u);Ue=ze(se,Ue);const qe=A(Ue)||l,Fe=i.convert(se.format,se.colorSpace);let He=i.convert(se.type),Le=T(se.internalFormat,Fe,He,se.colorSpace,se.isVideoTexture);$(we,se,qe);let Ye;const lt=se.mipmaps,Oe=l&&se.isVideoTexture!==!0,ut=Ce.__version===void 0||Se===!0,ht=R(se,Ue,qe);if(se.isDepthTexture)Le=t.DEPTH_COMPONENT,l?se.type===vy?Le=t.DEPTH_COMPONENT32F:se.type===t3?Le=t.DEPTH_COMPONENT24:se.type===HA?Le=t.DEPTH24_STENCIL8:Le=t.DEPTH_COMPONENT16:se.type===vy&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),se.format===z8&&Le===t.DEPTH_COMPONENT&&se.type!==Pq&&se.type!==t3&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),se.type=t3,He=i.convert(se.type)),se.format===X8&&Le===t.DEPTH_COMPONENT&&(Le=t.DEPTH_STENCIL,se.type!==HA&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),se.type=HA,He=i.convert(se.type))),ut&&(Oe?n.texStorage2D(t.TEXTURE_2D,1,Le,Ue.width,Ue.height):n.texImage2D(t.TEXTURE_2D,0,Le,Ue.width,Ue.height,0,Fe,He,null));else if(se.isDataTexture)if(lt.length>0&&qe){Oe&&ut&&n.texStorage2D(t.TEXTURE_2D,ht,Le,lt[0].width,lt[0].height);for(let Qe=0,nt=lt.length;Qe>=1,nt>>=1}}else if(lt.length>0&&qe){Oe&&ut&&n.texStorage2D(t.TEXTURE_2D,ht,Le,lt[0].width,lt[0].height);for(let Qe=0,nt=lt.length;Qe0&&ut++,n.texStorage2D(t.TEXTURE_CUBE_MAP,ut,Ye,Ue[0].width,Ue[0].height));for(let Qe=0;Qe<6;Qe++)if(_e){lt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,0,0,Ue[Qe].width,Ue[Qe].height,He,Le,Ue[Qe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,Ye,Ue[Qe].width,Ue[Qe].height,0,He,Le,Ue[Qe].data);for(let nt=0;nt>Me),Ue=Math.max(1,se.height>>Me);Se===t.TEXTURE_3D||Se===t.TEXTURE_2D_ARRAY?n.texImage3D(Se,Me,Re,_e,Ue,se.depth,0,Ce,Te,null):n.texImage2D(Se,Me,Re,_e,Ue,0,Ce,Te,null)}n.bindFramebuffer(t.FRAMEBUFFER,Ae),Ie(se)?f.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,we,Se,o.get(ge).__webglTexture,0,pe(se)):(Se===t.TEXTURE_2D||Se>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Se<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,we,Se,o.get(ge).__webglTexture,Me),n.bindFramebuffer(t.FRAMEBUFFER,null)}function q(Ae,se,ge){if(t.bindRenderbuffer(t.RENDERBUFFER,Ae),se.depthBuffer&&!se.stencilBuffer){let we=l===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(ge||Ie(se)){const Se=se.depthTexture;Se&&Se.isDepthTexture&&(Se.type===vy?we=t.DEPTH_COMPONENT32F:Se.type===t3&&(we=t.DEPTH_COMPONENT24));const Me=pe(se);Ie(se)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Me,we,se.width,se.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,Me,we,se.width,se.height)}else t.renderbufferStorage(t.RENDERBUFFER,we,se.width,se.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,Ae)}else if(se.depthBuffer&&se.stencilBuffer){const we=pe(se);ge&&Ie(se)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,we,t.DEPTH24_STENCIL8,se.width,se.height):Ie(se)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,we,t.DEPTH24_STENCIL8,se.width,se.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,se.width,se.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,Ae)}else{const we=se.isWebGLMultipleRenderTargets===!0?se.texture:[se.texture];for(let Se=0;Se0){ge.__webglFramebuffer[Te]=[];for(let Re=0;Re0){ge.__webglFramebuffer=[];for(let Te=0;Te0&&Ie(Ae)===!1){const Te=Me?se:[se];ge.__webglMultisampledFramebuffer=t.createFramebuffer(),ge.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglMultisampledFramebuffer);for(let Re=0;Re0)for(let Re=0;Re0)for(let Re=0;Re0&&Ie(Ae)===!1){const se=Ae.isWebGLMultipleRenderTargets?Ae.texture:[Ae.texture],ge=Ae.width,we=Ae.height;let Se=t.COLOR_BUFFER_BIT;const Me=[],Ce=Ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Te=o.get(Ae),Re=Ae.isWebGLMultipleRenderTargets===!0;if(Re)for(let Ne=0;Ne0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&se.__useRenderToTexture!==!1}function ve(Ae){const se=a.render.frame;m.get(Ae)!==se&&(m.set(Ae,se),Ae.update())}function ze(Ae,se){const ge=Ae.colorSpace,we=Ae.format,Se=Ae.type;return Ae.isCompressedTexture===!0||Ae.isVideoTexture===!0||Ae.format===bX||ge!==Wy&&ge!==Rp&&(ys.getTransfer(ge)===$s?l===!1?e.has("EXT_sRGB")===!0&&we===y1?(Ae.format=bX,Ae.minFilter=cs,Ae.generateMipmaps=!1):se=s2e.sRGBToLinear(se):(we!==y1||Se!==xf)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ge)),se}this.allocateTextureUnit=L,this.resetTextureUnits=E,this.setTexture2D=Y,this.setTexture2DArray=O,this.setTexture3D=_,this.setTextureCube=G,this.rebindTextures=he,this.setupRenderTarget=me,this.updateRenderTargetMipmap=ce,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=te,this.useMultisampledRTT=Ie}function YOe(t,e,n){const o=n.isWebGL2;function r(i,a=Rp){let l;const s=ys.getTransfer(a);if(i===xf)return t.UNSIGNED_BYTE;if(i===Zye)return t.UNSIGNED_SHORT_4_4_4_4;if(i===e2e)return t.UNSIGNED_SHORT_5_5_5_1;if(i===lOe)return t.BYTE;if(i===sOe)return t.SHORT;if(i===Pq)return t.UNSIGNED_SHORT;if(i===Qye)return t.INT;if(i===t3)return t.UNSIGNED_INT;if(i===vy)return t.FLOAT;if(i===G8)return o?t.HALF_FLOAT:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(i===cOe)return t.ALPHA;if(i===y1)return t.RGBA;if(i===uOe)return t.LUMINANCE;if(i===dOe)return t.LUMINANCE_ALPHA;if(i===z8)return t.DEPTH_COMPONENT;if(i===X8)return t.DEPTH_STENCIL;if(i===bX)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(i===fOe)return t.RED;if(i===t2e)return t.RED_INTEGER;if(i===hOe)return t.RG;if(i===n2e)return t.RG_INTEGER;if(i===o2e)return t.RGBA_INTEGER;if(i===VV||i===GV||i===XV||i===JV)if(s===$s)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(i===VV)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===GV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===XV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===JV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(i===VV)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===GV)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===XV)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===JV)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===O0e||i===_0e||i===V0e||i===G0e)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(i===O0e)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===_0e)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===V0e)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===G0e)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===pOe)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===X0e||i===J0e)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(i===X0e)return s===$s?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(i===J0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===K0e||i===$0e||i===q0e||i===Q0e||i===Z0e||i===ede||i===tde||i===nde||i===ode||i===rde||i===ide||i===ade||i===lde||i===sde)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(i===K0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===$0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===q0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Q0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Z0e)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ede)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===tde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===nde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ode)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===rde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===ide)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===ade)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===lde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===sde)return s===$s?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===KV||i===cde||i===ude)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(i===KV)return s===$s?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===cde)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ude)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===gOe||i===dde||i===fde||i===hde)if(l=e.get("EXT_texture_compression_rgtc"),l!==null){if(i===KV)return l.COMPRESSED_RED_RGTC1_EXT;if(i===dde)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===fde)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===hde)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===HA?o?t.UNSIGNED_INT_24_8:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):t[i]!==void 0?t[i]:null}return{convert:r}}class OOe extends A0{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let KC=class extends _l{constructor(){super(),this.isGroup=!0,this.type="Group"}};const g8t={type:"move"};class Sae{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new KC,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new KC,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ue,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ue),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new KC,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ue,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ue),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const o of e.hand.values())this._getHandJoint(n,o)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,o){let r=null,i=null,a=null;const l=this._targetRay,s=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const y of e.hand.values()){const w=n.getJointPose(y,o),x=this._getHandJoint(c,y);w!==null&&(x.matrix.fromArray(w.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=w.radius),x.visible=w!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),p=.02,m=.005;c.inputState.pinching&&f>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=n.getPose(e.gripSpace,o),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));l!==null&&(r=n.getPose(e.targetRaySpace,o),r===null&&i!==null&&(r=i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(g8t)))}return l!==null&&(l.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const o=new KC;o.matrixAutoUpdate=!1,o.visible=!1,e.joints[n.jointName]=o,e.add(o)}return e.joints[n.jointName]}}class Eq extends ic{constructor(e,n,o,r,i,a,l,s,c,u){if(u=u!==void 0?u:z8,u!==z8&&u!==X8)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&u===z8&&(o=t3),o===void 0&&u===X8&&(o=HA),super(null,r,i,a,l,s,u,o,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:Cc,this.minFilter=s!==void 0?s:Cc,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class m8t extends Sm{constructor(e,n){super();const o=this;let r=null,i=1,a=null,l="local-floor",s=1,c=null,u=null,d=null,f=null,p=null,m=null;const y=n.getContextAttributes();let w=null,x=null;const C=[],P=[],A=new A0;A.layers.enable(1),A.viewport=new Ba;const S=new A0;S.layers.enable(2),S.viewport=new Ba;const v=[A,S],b=new OOe;b.layers.enable(1),b.layers.enable(2);let T=null,R=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let _=C[O];return _===void 0&&(_=new Sae,C[O]=_),_.getTargetRaySpace()},this.getControllerGrip=function(O){let _=C[O];return _===void 0&&(_=new Sae,C[O]=_),_.getGripSpace()},this.getHand=function(O){let _=C[O];return _===void 0&&(_=new Sae,C[O]=_),_.getHandSpace()};function M(O){const _=P.indexOf(O.inputSource);if(_===-1)return;const G=C[_];G!==void 0&&(G.update(O.inputSource,O.frame,c||a),G.dispatchEvent({type:O.type,data:O.inputSource}))}function D(){r.removeEventListener("select",M),r.removeEventListener("selectstart",M),r.removeEventListener("selectend",M),r.removeEventListener("squeeze",M),r.removeEventListener("squeezestart",M),r.removeEventListener("squeezeend",M),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",k);for(let O=0;O=0&&(P[Q]=null,C[Q].disconnect(G))}for(let _=0;_=P.length){P.push(G),Q=ee;break}else if(P[ee]===null){P[ee]=G,Q=ee;break}if(Q===-1)break}const oe=C[Q];oe&&oe.connect(G)}}const N=new ue,U=new ue;function W(O,_,G){N.setFromMatrixPosition(_.matrixWorld),U.setFromMatrixPosition(G.matrixWorld);const Q=N.distanceTo(U),oe=_.projectionMatrix.elements,ee=G.projectionMatrix.elements,$=oe[14]/(oe[10]-1),ae=oe[14]/(oe[10]+1),Z=(oe[9]+1)/oe[5],ne=(oe[9]-1)/oe[5],te=(oe[8]-1)/oe[0],q=(ee[8]+1)/ee[0],le=$*te,de=$*q,he=Q/(-te+q),me=he*-te;_.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(me),O.translateZ(he),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const ce=$+he,Pe=ae+he,pe=le-me,Ie=de+(Q-me),ve=Z*ae/Pe*ce,ze=ne*ae/Pe*ce;O.projectionMatrix.makePerspective(pe,Ie,ve,ze,ce,Pe),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function F(O,_){_===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(_.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;b.near=S.near=A.near=O.near,b.far=S.far=A.far=O.far,(T!==b.near||R!==b.far)&&(r.updateRenderState({depthNear:b.near,depthFar:b.far}),T=b.near,R=b.far);const _=O.parent,G=b.cameras;F(b,_);for(let Q=0;Q0&&(w.alphaTest.value=x.alphaTest);const C=e.get(x).envMap;if(C&&(w.envMap.value=C,w.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=x.reflectivity,w.ior.value=x.ior,w.refractionRatio.value=x.refractionRatio),x.lightMap){w.lightMap.value=x.lightMap;const P=t._useLegacyLights===!0?Math.PI:1;w.lightMapIntensity.value=x.lightMapIntensity*P,n(x.lightMap,w.lightMapTransform)}x.aoMap&&(w.aoMap.value=x.aoMap,w.aoMapIntensity.value=x.aoMapIntensity,n(x.aoMap,w.aoMapTransform))}function a(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform))}function l(w,x){w.dashSize.value=x.dashSize,w.totalSize.value=x.dashSize+x.gapSize,w.scale.value=x.scale}function s(w,x,C,P){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.size.value=x.size*C,w.scale.value=P*.5,x.map&&(w.map.value=x.map,n(x.map,w.uvTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function c(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.rotation.value=x.rotation,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function u(w,x){w.specular.value.copy(x.specular),w.shininess.value=Math.max(x.shininess,1e-4)}function d(w,x){x.gradientMap&&(w.gradientMap.value=x.gradientMap)}function f(w,x){w.metalness.value=x.metalness,x.metalnessMap&&(w.metalnessMap.value=x.metalnessMap,n(x.metalnessMap,w.metalnessMapTransform)),w.roughness.value=x.roughness,x.roughnessMap&&(w.roughnessMap.value=x.roughnessMap,n(x.roughnessMap,w.roughnessMapTransform)),e.get(x).envMap&&(w.envMapIntensity.value=x.envMapIntensity)}function p(w,x,C){w.ior.value=x.ior,x.sheen>0&&(w.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),w.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(w.sheenColorMap.value=x.sheenColorMap,n(x.sheenColorMap,w.sheenColorMapTransform)),x.sheenRoughnessMap&&(w.sheenRoughnessMap.value=x.sheenRoughnessMap,n(x.sheenRoughnessMap,w.sheenRoughnessMapTransform))),x.clearcoat>0&&(w.clearcoat.value=x.clearcoat,w.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(w.clearcoatMap.value=x.clearcoatMap,n(x.clearcoatMap,w.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,n(x.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(w.clearcoatNormalMap.value=x.clearcoatNormalMap,n(x.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===js&&w.clearcoatNormalScale.value.negate())),x.iridescence>0&&(w.iridescence.value=x.iridescence,w.iridescenceIOR.value=x.iridescenceIOR,w.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(w.iridescenceMap.value=x.iridescenceMap,n(x.iridescenceMap,w.iridescenceMapTransform)),x.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=x.iridescenceThicknessMap,n(x.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),x.transmission>0&&(w.transmission.value=x.transmission,w.transmissionSamplerMap.value=C.texture,w.transmissionSamplerSize.value.set(C.width,C.height),x.transmissionMap&&(w.transmissionMap.value=x.transmissionMap,n(x.transmissionMap,w.transmissionMapTransform)),w.thickness.value=x.thickness,x.thicknessMap&&(w.thicknessMap.value=x.thicknessMap,n(x.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=x.attenuationDistance,w.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(w.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(w.anisotropyMap.value=x.anisotropyMap,n(x.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=x.specularIntensity,w.specularColor.value.copy(x.specularColor),x.specularColorMap&&(w.specularColorMap.value=x.specularColorMap,n(x.specularColorMap,w.specularColorMapTransform)),x.specularIntensityMap&&(w.specularIntensityMap.value=x.specularIntensityMap,n(x.specularIntensityMap,w.specularIntensityMapTransform))}function m(w,x){x.matcap&&(w.matcap.value=x.matcap)}function y(w,x){const C=e.get(x).light;w.referencePosition.value.setFromMatrixPosition(C.matrixWorld),w.nearDistance.value=C.shadow.camera.near,w.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:r}}function A8t(t,e,n,o){let r={},i={},a=[];const l=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function s(C,P){const A=P.program;o.uniformBlockBinding(C,A)}function c(C,P){let A=r[C.id];A===void 0&&(m(C),A=u(C),r[C.id]=A,C.addEventListener("dispose",w));const S=P.program;o.updateUBOMapping(C,S);const v=e.render.frame;i[C.id]!==v&&(f(C),i[C.id]=v)}function u(C){const P=d();C.__bindingPointIndex=P;const A=t.createBuffer(),S=C.__size,v=C.usage;return t.bindBuffer(t.UNIFORM_BUFFER,A),t.bufferData(t.UNIFORM_BUFFER,S,v),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,P,A),A}function d(){for(let C=0;C0){v=A%S;const k=S-v;v!==0&&k-M.boundary<0&&(A+=S-v,R.__offset=A)}A+=M.storage}return v=A%S,v>0&&(A+=S-v),C.__size=A,C.__cache={},this}function y(C){const P={boundary:0,storage:0};return typeof C=="number"?(P.boundary=4,P.storage=4):C.isVector2?(P.boundary=8,P.storage=8):C.isVector3||C.isColor?(P.boundary=16,P.storage=12):C.isVector4?(P.boundary=16,P.storage=16):C.isMatrix3?(P.boundary=48,P.storage=48):C.isMatrix4?(P.boundary=64,P.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),P}function w(C){const P=C.target;P.removeEventListener("dispose",w);const A=a.indexOf(P.__bindingPointIndex);a.splice(A,1),t.deleteBuffer(r[P.id]),delete r[P.id],delete i[P.id]}function x(){for(const C in r)t.deleteBuffer(r[C]);a=[],r={},i={}}return{bind:s,update:c,dispose:x}}class h2e{constructor(e={}){const{canvas:n=zOe(),context:o=null,depth:r=!0,stencil:i=!0,alpha:a=!1,antialias:l=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let f;o!==null?f=o.getContextAttributes().alpha:f=a;const p=new Uint32Array(4),m=new Int32Array(4);let y=null,w=null;const x=[],C=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=al,this._useLegacyLights=!1,this.toneMapping=w5,this.toneMappingExposure=1;const P=this;let A=!1,S=0,v=0,b=null,T=-1,R=null;const M=new Ba,D=new Ba;let k=null;const N=new ir(0);let U=0,W=n.width,F=n.height,E=1,L=null,j=null;const Y=new Ba(0,0,W,F),O=new Ba(0,0,W,F);let _=!1;const G=new Mq;let Q=!1,oe=!1,ee=null;const $=new qi,ae=new _t,Z=new ue,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return b===null?E:1}let q=o;function le(Je,st){for(let It=0;It{function Be(){if(ot.forEach(function(pt){Pe.get(pt).currentProgram.isReady()&&ot.delete(pt)}),ot.size===0){it(Je);return}setTimeout(Be,10)}de.get("KHR_parallel_shader_compile")!==null?Be():setTimeout(Be,10)})};let tt=null;function gt(Je){tt&&tt(Je)}function Ve(){et.stop()}function je(){et.start()}const et=new WOe;et.setAnimationLoop(gt),typeof self<"u"&&et.setContext(self),this.setAnimationLoop=function(Je){tt=Je,Ye.setAnimationLoop(Je),Je===null?et.stop():et.start()},Ye.addEventListener("sessionstart",Ve),Ye.addEventListener("sessionend",je),this.render=function(Je,st){if(st!==void 0&&st.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;Je.matrixWorldAutoUpdate===!0&&Je.updateMatrixWorld(),st.parent===null&&st.matrixWorldAutoUpdate===!0&&st.updateMatrixWorld(),Ye.enabled===!0&&Ye.isPresenting===!0&&(Ye.cameraAutoUpdate===!0&&Ye.updateCamera(st),st=Ye.getCamera()),Je.isScene===!0&&Je.onBeforeRender(P,Je,st,b),w=Me.get(Je,C.length),w.init(),C.push(w),$.multiplyMatrices(st.projectionMatrix,st.matrixWorldInverse),G.setFromProjectionMatrix($),oe=this.localClippingEnabled,Q=Ce.init(this.clippingPlanes,oe),y=Se.get(Je,x.length),y.init(),x.push(y),bt(Je,st,0,P.sortObjects),y.finish(),P.sortObjects===!0&&y.sort(L,j),this.info.render.frame++,Q===!0&&Ce.beginShadows();const It=w.state.shadowsArray;if(Te.render(It,Je,st),Q===!0&&Ce.endShadows(),this.info.autoReset===!0&&this.info.reset(),Re.render(y,Je),w.setupLights(P._useLegacyLights),st.isArrayCamera){const ot=st.cameras;for(let it=0,Be=ot.length;it0?w=C[C.length-1]:w=null,x.pop(),x.length>0?y=x[x.length-1]:y=null};function bt(Je,st,It,ot){if(Je.visible===!1)return;if(Je.layers.test(st.layers)){if(Je.isGroup)It=Je.renderOrder;else if(Je.isLOD)Je.autoUpdate===!0&&Je.update(st);else if(Je.isLight)w.pushLight(Je),Je.castShadow&&w.pushShadow(Je);else if(Je.isSprite){if(!Je.frustumCulled||G.intersectsSprite(Je)){ot&&Z.setFromMatrixPosition(Je.matrixWorld).applyMatrix4($);const pt=se.update(Je),ct=Je.material;ct.visible&&y.push(Je,pt,ct,It,Z.z,null)}}else if((Je.isMesh||Je.isLine||Je.isPoints)&&(!Je.frustumCulled||G.intersectsObject(Je))){const pt=se.update(Je),ct=Je.material;if(ot&&(Je.boundingSphere!==void 0?(Je.boundingSphere===null&&Je.computeBoundingSphere(),Z.copy(Je.boundingSphere.center)):(pt.boundingSphere===null&&pt.computeBoundingSphere(),Z.copy(pt.boundingSphere.center)),Z.applyMatrix4(Je.matrixWorld).applyMatrix4($)),Array.isArray(ct)){const Xe=pt.groups;for(let ft=0,wt=Xe.length;ft0&&Pt(it,Be,st,It),ot&&me.viewport(M.copy(ot)),it.length>0&&Yt(it,st,It),Be.length>0&&Yt(Be,st,It),pt.length>0&&Yt(pt,st,It),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function Pt(Je,st,It,ot){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;const Be=he.isWebGL2;ee===null&&(ee=new ku(1,1,{generateMipmaps:!0,type:de.has("EXT_color_buffer_half_float")?G8:xf,minFilter:V8,samples:Be?4:0})),P.getDrawingBufferSize(ae),Be?ee.setSize(ae.x,ae.y):ee.setSize(SX(ae.x),SX(ae.y));const pt=P.getRenderTarget();P.setRenderTarget(ee),P.getClearColor(N),U=P.getClearAlpha(),U<1&&P.setClearColor(16777215,.5),P.clear();const ct=P.toneMapping;P.toneMapping=w5,Yt(Je,It,ot),pe.updateMultisampleRenderTarget(ee),pe.updateRenderTargetMipmap(ee);let Xe=!1;for(let ft=0,wt=st.length;ft0),kt=!!It.morphAttributes.position,Zt=!!It.morphAttributes.normal,Ot=!!It.morphAttributes.color;let on=w5;ot.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(on=P.toneMapping);const qt=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,rn=qt!==void 0?qt.length:0,Pn=Pe.get(ot),fo=w.state.lights;if(Q===!0&&(oe===!0||Je!==R)){const wo=Je===R&&ot.id===T;Ce.setState(ot,Je,wo)}let to=!1;ot.version===Pn.__version?(Pn.needsLights&&Pn.lightsStateVersion!==fo.state.version||Pn.outputColorSpace!==ct||it.isInstancedMesh&&Pn.instancing===!1||!it.isInstancedMesh&&Pn.instancing===!0||it.isSkinnedMesh&&Pn.skinning===!1||!it.isSkinnedMesh&&Pn.skinning===!0||it.isInstancedMesh&&Pn.instancingColor===!0&&it.instanceColor===null||it.isInstancedMesh&&Pn.instancingColor===!1&&it.instanceColor!==null||Pn.envMap!==Xe||ot.fog===!0&&Pn.fog!==Be||Pn.numClippingPlanes!==void 0&&(Pn.numClippingPlanes!==Ce.numPlanes||Pn.numIntersection!==Ce.numIntersection)||Pn.vertexAlphas!==ft||Pn.vertexTangents!==wt||Pn.morphTargets!==kt||Pn.morphNormals!==Zt||Pn.morphColors!==Ot||Pn.toneMapping!==on||he.isWebGL2===!0&&Pn.morphTargetsCount!==rn)&&(to=!0):(to=!0,Pn.__version=ot.version);let Dt=Pn.currentProgram;to===!0&&(Dt=Rt(ot,st,it));let fn=!1,kn=!1,yo=!1;const ur=Dt.getUniforms(),lr=Pn.uniforms;if(me.useProgram(Dt.program)&&(fn=!0,kn=!0,yo=!0),ot.id!==T&&(T=ot.id,kn=!0),fn||R!==Je){ur.setValue(q,"projectionMatrix",Je.projectionMatrix),ur.setValue(q,"viewMatrix",Je.matrixWorldInverse);const wo=ur.map.cameraPosition;wo!==void 0&&wo.setValue(q,Z.setFromMatrixPosition(Je.matrixWorld)),he.logarithmicDepthBuffer&&ur.setValue(q,"logDepthBufFC",2/(Math.log(Je.far+1)/Math.LN2)),(ot.isMeshPhongMaterial||ot.isMeshToonMaterial||ot.isMeshLambertMaterial||ot.isMeshBasicMaterial||ot.isMeshStandardMaterial||ot.isShaderMaterial)&&ur.setValue(q,"isOrthographic",Je.isOrthographicCamera===!0),R!==Je&&(R=Je,kn=!0,yo=!0)}if(it.isSkinnedMesh){ur.setOptional(q,it,"bindMatrix"),ur.setOptional(q,it,"bindMatrixInverse");const wo=it.skeleton;wo&&(he.floatVertexTextures?(wo.boneTexture===null&&wo.computeBoneTexture(),ur.setValue(q,"boneTexture",wo.boneTexture,pe),ur.setValue(q,"boneTextureSize",wo.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const xo=It.morphAttributes;if((xo.position!==void 0||xo.normal!==void 0||xo.color!==void 0&&he.isWebGL2===!0)&&Ne.update(it,It,Dt),(kn||Pn.receiveShadow!==it.receiveShadow)&&(Pn.receiveShadow=it.receiveShadow,ur.setValue(q,"receiveShadow",it.receiveShadow)),ot.isMeshGouraudMaterial&&ot.envMap!==null&&(lr.envMap.value=Xe,lr.flipEnvMap.value=Xe.isCubeTexture&&Xe.isRenderTargetTexture===!1?-1:1),kn&&(ur.setValue(q,"toneMappingExposure",P.toneMappingExposure),Pn.needsLights&&Et(lr,yo),Be&&ot.fog===!0&&we.refreshFogUniforms(lr,Be),we.refreshMaterialUniforms(lr,ot,E,F,ee),qV.upload(q,Ct(Pn),lr,pe)),ot.isShaderMaterial&&ot.uniformsNeedUpdate===!0&&(qV.upload(q,Ct(Pn),lr,pe),ot.uniformsNeedUpdate=!1),ot.isSpriteMaterial&&ur.setValue(q,"center",it.center),ur.setValue(q,"modelViewMatrix",it.modelViewMatrix),ur.setValue(q,"normalMatrix",it.normalMatrix),ur.setValue(q,"modelMatrix",it.matrixWorld),ot.isShaderMaterial||ot.isRawShaderMaterial){const wo=ot.uniformsGroups;for(let Rr=0,Eo=wo.length;Rr0&&pe.useMultisampledRTT(Je)===!1?it=Pe.get(Je).__webglMultisampledFramebuffer:Array.isArray(wt)?it=wt[It]:it=wt,M.copy(Je.viewport),D.copy(Je.scissor),k=Je.scissorTest}else M.copy(Y).multiplyScalar(E).floor(),D.copy(O).multiplyScalar(E).floor(),k=_;if(me.bindFramebuffer(q.FRAMEBUFFER,it)&&he.drawBuffers&&ot&&me.drawBuffers(Je,it),me.viewport(M),me.scissor(D),me.setScissorTest(k),Be){const Xe=Pe.get(Je.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+st,Xe.__webglTexture,It)}else if(pt){const Xe=Pe.get(Je.texture),ft=st||0;q.framebufferTextureLayer(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,Xe.__webglTexture,It||0,ft)}T=-1},this.readRenderTargetPixels=function(Je,st,It,ot,it,Be,pt){if(!(Je&&Je.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=Pe.get(Je).__webglFramebuffer;if(Je.isWebGLCubeRenderTarget&&pt!==void 0&&(ct=ct[pt]),ct){me.bindFramebuffer(q.FRAMEBUFFER,ct);try{const Xe=Je.texture,ft=Xe.format,wt=Xe.type;if(ft!==y1&&qe.convert(ft)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const kt=wt===G8&&(de.has("EXT_color_buffer_half_float")||he.isWebGL2&&de.has("EXT_color_buffer_float"));if(wt!==xf&&qe.convert(wt)!==q.getParameter(q.IMPLEMENTATION_COLOR_READ_TYPE)&&!(wt===vy&&(he.isWebGL2||de.has("OES_texture_float")||de.has("WEBGL_color_buffer_float")))&&!kt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}st>=0&&st<=Je.width-ot&&It>=0&&It<=Je.height-it&&q.readPixels(st,It,ot,it,qe.convert(ft),qe.convert(wt),Be)}finally{const Xe=b!==null?Pe.get(b).__webglFramebuffer:null;me.bindFramebuffer(q.FRAMEBUFFER,Xe)}}},this.copyFramebufferToTexture=function(Je,st,It=0){const ot=Math.pow(2,-It),it=Math.floor(st.image.width*ot),Be=Math.floor(st.image.height*ot);pe.setTexture2D(st,0),q.copyTexSubImage2D(q.TEXTURE_2D,It,0,0,Je.x,Je.y,it,Be),me.unbindTexture()},this.copyTextureToTexture=function(Je,st,It,ot=0){const it=st.image.width,Be=st.image.height,pt=qe.convert(It.format),ct=qe.convert(It.type);pe.setTexture2D(It,0),q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,It.flipY),q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),q.pixelStorei(q.UNPACK_ALIGNMENT,It.unpackAlignment),st.isDataTexture?q.texSubImage2D(q.TEXTURE_2D,ot,Je.x,Je.y,it,Be,pt,ct,st.image.data):st.isCompressedTexture?q.compressedTexSubImage2D(q.TEXTURE_2D,ot,Je.x,Je.y,st.mipmaps[0].width,st.mipmaps[0].height,pt,st.mipmaps[0].data):q.texSubImage2D(q.TEXTURE_2D,ot,Je.x,Je.y,pt,ct,st.image),ot===0&&It.generateMipmaps&&q.generateMipmap(q.TEXTURE_2D),me.unbindTexture()},this.copyTextureToTexture3D=function(Je,st,It,ot,it=0){if(P.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Be=Je.max.x-Je.min.x+1,pt=Je.max.y-Je.min.y+1,ct=Je.max.z-Je.min.z+1,Xe=qe.convert(ot.format),ft=qe.convert(ot.type);let wt;if(ot.isData3DTexture)pe.setTexture3D(ot,0),wt=q.TEXTURE_3D;else if(ot.isDataArrayTexture)pe.setTexture2DArray(ot,0),wt=q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,ot.flipY),q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ot.premultiplyAlpha),q.pixelStorei(q.UNPACK_ALIGNMENT,ot.unpackAlignment);const kt=q.getParameter(q.UNPACK_ROW_LENGTH),Zt=q.getParameter(q.UNPACK_IMAGE_HEIGHT),Ot=q.getParameter(q.UNPACK_SKIP_PIXELS),on=q.getParameter(q.UNPACK_SKIP_ROWS),qt=q.getParameter(q.UNPACK_SKIP_IMAGES),rn=It.isCompressedTexture?It.mipmaps[0]:It.image;q.pixelStorei(q.UNPACK_ROW_LENGTH,rn.width),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,rn.height),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Je.min.x),q.pixelStorei(q.UNPACK_SKIP_ROWS,Je.min.y),q.pixelStorei(q.UNPACK_SKIP_IMAGES,Je.min.z),It.isDataTexture||It.isData3DTexture?q.texSubImage3D(wt,it,st.x,st.y,st.z,Be,pt,ct,Xe,ft,rn.data):It.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),q.compressedTexSubImage3D(wt,it,st.x,st.y,st.z,Be,pt,ct,Xe,rn.data)):q.texSubImage3D(wt,it,st.x,st.y,st.z,Be,pt,ct,Xe,ft,rn),q.pixelStorei(q.UNPACK_ROW_LENGTH,kt),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,Zt),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Ot),q.pixelStorei(q.UNPACK_SKIP_ROWS,on),q.pixelStorei(q.UNPACK_SKIP_IMAGES,qt),it===0&&ot.generateMipmaps&&q.generateMipmap(wt),me.unbindTexture()},this.initTexture=function(Je){Je.isCubeTexture?pe.setTextureCube(Je,0):Je.isData3DTexture?pe.setTexture3D(Je,0):Je.isDataArrayTexture||Je.isCompressedArrayTexture?pe.setTexture2DArray(Je,0):pe.setTexture2D(Je,0),me.unbindTexture()},this.resetState=function(){S=0,v=0,b=null,me.reset(),Fe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return n3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===Rq?"display-p3":"srgb",n.unpackColorSpace=ys.workingColorSpace===MN?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===al?D8:i2e}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===D8?al:Wy}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class _Oe extends h2e{}_Oe.prototype.isWebGL1Renderer=!0;class kq{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ir(e),this.density=n}clone(){return new kq(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Fq{constructor(e,n=1,o=1e3){this.isFog=!0,this.name="",this.color=new ir(e),this.near=n,this.far=o}clone(){return new Fq(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class cH extends _l{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class Lq{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=eL,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=cm()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,o){e*=this.stride,o*=n.stride;for(let r=0,i=this.stride;re.far||n.push({distance:s,point:FD.clone(),uv:wh.getInterpolation(FD,qY,WD,QY,Qxe,Tae,Zxe,new _t),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function ZY(t,e,n,o,r,i){bP.subVectors(t,n).addScalar(.5).multiply(o),r!==void 0?(LD.x=i*bP.x-r*bP.y,LD.y=r*bP.x+i*bP.y):LD.copy(bP),t.copy(e),t.x+=LD.x,t.y+=LD.y,t.applyMatrix4(VOe)}const eO=new ue,eve=new ue;class GOe extends _l{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let o=0,r=n.length;o0){let o,r;for(o=1,r=n.length;o0){eO.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(eO);this.getObjectForDistance(r).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){eO.setFromMatrixPosition(e.matrixWorld),eve.setFromMatrixPosition(this.matrixWorld);const o=eO.distanceTo(eve)/e.zoom;n[0].object.visible=!0;let r,i;for(r=1,i=n.length;r=a)n[r-1].object.visible=!1,n[r].object.visible=!0;else break}for(this._currentLevel=r-1;rs)continue;f.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(f);Te.far||n.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}else{const x=Math.max(0,a.start),C=Math.min(w.count,a.start+a.count);for(let P=x,A=C-1;Ps)continue;f.applyMatrix4(this.matrixWorld);const v=e.ray.origin.distanceTo(f);ve.far||n.push({distance:v,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,o=Object.keys(n);if(o.length>0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;i0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;ir.far)return;i.push({distance:c,distanceToRay:Math.sqrt(l),point:s,index:e,face:null,object:a})}}class b8t extends ic{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:cs,this.magFilter=i!==void 0?i:cs,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class S8t extends ic{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Cc,this.minFilter=Cc,this.generateMipmaps=!1,this.needsUpdate=!0}}class Nq extends ic{constructor(e,n,o,r,i,a,l,s,c,u,d,f){super(null,a,l,s,c,u,r,i,d,f),this.isCompressedTexture=!0,this.image={width:n,height:o},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class T8t extends Nq{constructor(e,n,o,r,i,a){super(e,n,o,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Ph}}class P8t extends Nq{constructor(e,n,o){super(void 0,e[0].width,e[0].height,n,o,KA),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class o3 extends ic{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}let U5=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const o=this.getUtoTmapping(e);return this.getPoint(o,n)}getPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPoint(o/e));return n}getSpacedPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPointAt(o/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let o,r=this.getPoint(0),i=0;n.push(0);for(let a=1;a<=e;a++)o=this.getPoint(a/e),i+=o.distanceTo(r),n.push(i),r=o;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const o=this.getLengths();let r=0;const i=o.length;let a;n?a=n:a=e*o[i-1];let l=0,s=i-1,c;for(;l<=s;)if(r=Math.floor(l+(s-l)/2),c=o[r]-a,c<0)l=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,o[r]===a)return r/(i-1);const u=o[r],f=o[r+1]-u,p=(a-u)/f;return(r+p)/(i-1)}getTangent(e,n){let r=e-1e-4,i=e+1e-4;r<0&&(r=0),i>1&&(i=1);const a=this.getPoint(r),l=this.getPoint(i),s=n||(a.isVector2?new _t:new ue);return s.copy(l).sub(a).normalize(),s}getTangentAt(e,n){const o=this.getUtoTmapping(e);return this.getTangent(o,n)}computeFrenetFrames(e,n){const o=new ue,r=[],i=[],a=[],l=new ue,s=new qi;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new ue)}i[0]=new ue,a[0]=new ue;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,o.set(1,0,0)),d<=c&&(c=d,o.set(0,1,0)),f<=c&&o.set(0,0,1),l.crossVectors(r[0],o).normalize(),i[0].crossVectors(r[0],l),a[0].crossVectors(r[0],i[0]);for(let p=1;p<=e;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),l.crossVectors(r[p-1],r[p]),l.length()>Number.EPSILON){l.normalize();const m=Math.acos(Eu(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(l,m))}a[p].crossVectors(r[p],i[p])}if(n===!0){let p=Math.acos(Eu(i[0].dot(i[e]),-1,1));p/=e,r[0].dot(l.crossVectors(i[0],i[e]))>0&&(p=-p);for(let m=1;m<=e;m++)i[m].applyMatrix4(s.makeRotationAxis(r[m],p*m)),a[m].crossVectors(r[m],i[m])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}};class x5 extends U5{constructor(e=0,n=0,o=1,r=1,i=0,a=Math.PI*2,l=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=o,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=l,this.aRotation=s}getPoint(e,n){const o=n||new _t,r=Math.PI*2;let i=this.aEndAngle-this.aStartAngle;const a=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:s===0&&l===i-1&&(l=i-2,s=1);let c,u;this.closed||l>0?c=r[(l-1)%i]:(aO.subVectors(r[0],r[1]).add(r[0]),c=aO);const d=r[l%i],f=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return o.set(mve(l,s.x,c.x,u.x,d.x),mve(l,s.y,c.y,u.y,d.y)),o}copy(e){super.copy(e),this.points=[];for(let n=0,o=e.points.length;n=o){const a=r[i]-o,l=this.curves[i],s=l.getLength(),c=s===0?0:1-a/s;return l.getPointAt(c,n)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let o=0,r=this.curves.length;o1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,o=e.curves.length;n0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class DN extends Ni{constructor(e=[new _t(0,-.5),new _t(.5,0),new _t(0,.5)],n=12,o=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:o,phiLength:r},n=Math.floor(n),r=Eu(r,0,Math.PI*2);const i=[],a=[],l=[],s=[],c=[],u=1/n,d=new ue,f=new _t,p=new ue,m=new ue,y=new ue;let w=0,x=0;for(let C=0;C<=e.length-1;C++)switch(C){case 0:w=e[C+1].x-e[C].x,x=e[C+1].y-e[C].y,p.x=x*1,p.y=-w,p.z=x*0,y.copy(p),p.normalize(),s.push(p.x,p.y,p.z);break;case e.length-1:s.push(y.x,y.y,y.z);break;default:w=e[C+1].x-e[C].x,x=e[C+1].y-e[C].y,p.x=x*1,p.y=-w,p.z=x*0,m.copy(p),p.x+=y.x,p.y+=y.y,p.z+=y.z,p.normalize(),s.push(p.x,p.y,p.z),y.copy(m)}for(let C=0;C<=n;C++){const P=o+C*u*r,A=Math.sin(P),S=Math.cos(P);for(let v=0;v<=e.length-1;v++){d.x=e[v].x*A,d.y=e[v].y,d.z=e[v].x*S,a.push(d.x,d.y,d.z),f.x=C/n,f.y=v/(e.length-1),l.push(f.x,f.y);const b=s[3*v+0]*A,T=s[3*v+1],R=s[3*v+0]*S;c.push(b,T,R)}}for(let C=0;C0&&P(!0),n>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new Ar(d,3)),this.setAttribute("normal",new Ar(f,3)),this.setAttribute("uv",new Ar(p,2));function C(){const A=new ue,S=new ue;let v=0;const b=(n-e)/o;for(let T=0;T<=i;T++){const R=[],M=T/i,D=M*(n-e)+e;for(let k=0;k<=r;k++){const N=k/r,U=N*s+l,W=Math.sin(U),F=Math.cos(U);S.x=D*W,S.y=-M*o+w,S.z=D*F,d.push(S.x,S.y,S.z),A.set(W,b,F).normalize(),f.push(A.x,A.y,A.z),p.push(N,1-M),R.push(m++)}y.push(R)}for(let T=0;T.9&&b<.1&&(P<.2&&(a[C+0]+=1),A<.2&&(a[C+2]+=1),S<.2&&(a[C+4]+=1))}}function f(C){i.push(C.x,C.y,C.z)}function p(C,P){const A=C*3;P.x=e[A+0],P.y=e[A+1],P.z=e[A+2]}function m(){const C=new ue,P=new ue,A=new ue,S=new ue,v=new _t,b=new _t,T=new _t;for(let R=0,M=0;R80*n){l=c=t[0],s=u=t[1];for(let m=n;mc&&(c=d),f>u&&(u=f);p=Math.max(c-l,u-s),p=p!==0?32767/p:0}return iL(i,a,n,l,s,p,0),a}};function r_e(t,e,n,o,r){let i,a;if(r===K8t(t,e,n,o)>0)for(i=e;i=e;i-=o)a=yve(i,t[i],t[i+1],a);return a&&Vq(a,a.next)&&(lL(a),a=a.next),a}function Bb(t,e){if(!t)return t;e||(e=t);let n=t,o;do if(o=!1,!n.steiner&&(Vq(n,n.next)||fu(n.prev,n,n.next)===0)){if(lL(n),n=e=n.prev,n===n.next)break;o=!0}else n=n.next;while(o||n!==e);return e}function iL(t,e,n,o,r,i,a){if(!t)return;!a&&i&&O8t(t,o,r,i);let l=t,s,c;for(;t.prev!==t.next;){if(s=t.prev,c=t.next,i?F8t(t,o,r,i):k8t(t)){e.push(s.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),lL(t),t=c.next,l=c.next;continue}if(t=c,t===l){a?a===1?(t=L8t(Bb(t),e,n),iL(t,e,n,o,r,i,2)):a===2&&W8t(t,e,n,o,r,i):iL(Bb(t),e,n,o,r,i,1);break}}}function k8t(t){const e=t.prev,n=t,o=t.next;if(fu(e,n,o)>=0)return!1;const r=e.x,i=n.x,a=o.x,l=e.y,s=n.y,c=o.y,u=ri?r>a?r:a:i>a?i:a,p=l>s?l>c?l:c:s>c?s:c;let m=o.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&$C(r,l,i,s,a,c,m.x,m.y)&&fu(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function F8t(t,e,n,o){const r=t.prev,i=t,a=t.next;if(fu(r,i,a)>=0)return!1;const l=r.x,s=i.x,c=a.x,u=r.y,d=i.y,f=a.y,p=ls?l>c?l:c:s>c?s:c,w=u>d?u>f?u:f:d>f?d:f,x=xde(p,m,e,n,o),C=xde(y,w,e,n,o);let P=t.prevZ,A=t.nextZ;for(;P&&P.z>=x&&A&&A.z<=C;){if(P.x>=p&&P.x<=y&&P.y>=m&&P.y<=w&&P!==r&&P!==a&&$C(l,u,s,d,c,f,P.x,P.y)&&fu(P.prev,P,P.next)>=0||(P=P.prevZ,A.x>=p&&A.x<=y&&A.y>=m&&A.y<=w&&A!==r&&A!==a&&$C(l,u,s,d,c,f,A.x,A.y)&&fu(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;P&&P.z>=x;){if(P.x>=p&&P.x<=y&&P.y>=m&&P.y<=w&&P!==r&&P!==a&&$C(l,u,s,d,c,f,P.x,P.y)&&fu(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;A&&A.z<=C;){if(A.x>=p&&A.x<=y&&A.y>=m&&A.y<=w&&A!==r&&A!==a&&$C(l,u,s,d,c,f,A.x,A.y)&&fu(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function L8t(t,e,n){let o=t;do{const r=o.prev,i=o.next.next;!Vq(r,i)&&i_e(r,o,o.next,i)&&aL(r,i)&&aL(i,r)&&(e.push(r.i/n|0),e.push(o.i/n|0),e.push(i.i/n|0),lL(o),lL(o.next),o=t=i),o=o.next}while(o!==t);return Bb(o)}function W8t(t,e,n,o,r,i){let a=t;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&G8t(a,l)){let s=a_e(a,l);a=Bb(a,a.next),s=Bb(s,s.next),iL(a,e,n,o,r,i,0),iL(s,e,n,o,r,i,0);return}l=l.next}a=a.next}while(a!==t)}function N8t(t,e,n,o){const r=[];let i,a,l,s,c;for(i=0,a=e.length;i=n.next.y&&n.next.y!==n.y){const f=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=i&&f>o&&(o=f,r=n.x=n.x&&n.x>=s&&i!==n.x&&$C(ar.x||n.x===r.x&&Y8t(r,n)))&&(r=n,u=d)),n=n.next;while(n!==l);return r}function Y8t(t,e){return fu(t.prev,t,e.prev)<0&&fu(e.next,t,t.next)<0}function O8t(t,e,n,o){let r=t;do r.z===0&&(r.z=xde(r.x,r.y,e,n,o)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,_8t(r)}function _8t(t){let e,n,o,r,i,a,l,s,c=1;do{for(n=t,t=null,i=null,a=0;n;){for(a++,o=n,l=0,e=0;e0||s>0&&o;)l!==0&&(s===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,l--):(r=o,o=o.nextZ,s--),i?i.nextZ=r:t=r,r.prevZ=i,i=r;n=o}i.nextZ=null,c*=2}while(a>1);return t}function xde(t,e,n,o,r){return t=(t-n)*r|0,e=(e-o)*r|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function V8t(t){let e=t,n=t;do(e.x=(t-a)*(i-l)&&(t-a)*(o-l)>=(n-a)*(e-l)&&(n-a)*(i-l)>=(r-a)*(o-l)}function G8t(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!X8t(t,e)&&(aL(t,e)&&aL(e,t)&&J8t(t,e)&&(fu(t.prev,t,e.prev)||fu(t,e.prev,e))||Vq(t,e)&&fu(t.prev,t,t.next)>0&&fu(e.prev,e,e.next)>0)}function fu(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Vq(t,e){return t.x===e.x&&t.y===e.y}function i_e(t,e,n,o){const r=dO(fu(t,e,n)),i=dO(fu(t,e,o)),a=dO(fu(n,o,t)),l=dO(fu(n,o,e));return!!(r!==i&&a!==l||r===0&&uO(t,n,e)||i===0&&uO(t,o,e)||a===0&&uO(n,t,o)||l===0&&uO(n,e,o))}function uO(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function dO(t){return t>0?1:t<0?-1:0}function X8t(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&i_e(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function aL(t,e){return fu(t.prev,t,t.next)<0?fu(t,e,t.next)>=0&&fu(t,t.prev,e)>=0:fu(t,e,t.prev)<0||fu(t,t.next,e)<0}function J8t(t,e){let n=t,o=!1;const r=(t.x+e.x)/2,i=(t.y+e.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==t);return o}function a_e(t,e){const n=new vde(t.i,t.x,t.y),o=new vde(e.i,e.x,e.y),r=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,o.next=n,n.prev=o,i.next=o,o.prev=i,o}function yve(t,e,n,o){const r=new vde(t,e,n);return o?(r.next=o.next,r.prev=o,o.next.prev=r,o.next=r):(r.prev=r,r.next=r),r}function lL(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function vde(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function K8t(t,e,n,o){let r=0;for(let i=e,a=n-o;i2&&t[e-1].equals(t[0])&&t.pop()}function wve(t,e){for(let n=0;nNumber.EPSILON){const se=Math.sqrt(ze),ge=Math.sqrt(Ie*Ie+ve*ve),we=le.x-pe/se,Se=le.y+Pe/se,Me=de.x-ve/ge,Ce=de.y+Ie/ge,Te=((Me-we)*ve-(Ce-Se)*Ie)/(Pe*ve-pe*Ie);he=we+Pe*Te-q.x,me=Se+pe*Te-q.y;const Re=he*he+me*me;if(Re<=2)return new _t(he,me);ce=Math.sqrt(Re/2)}else{let se=!1;Pe>Number.EPSILON?Ie>Number.EPSILON&&(se=!0):Pe<-Number.EPSILON?Ie<-Number.EPSILON&&(se=!0):Math.sign(pe)===Math.sign(ve)&&(se=!0),se?(he=-pe,me=Pe,ce=Math.sqrt(ze)):(he=Pe,me=pe,ce=Math.sqrt(ze/2))}return new _t(he/ce,me/ce)}const j=[];for(let q=0,le=U.length,de=le-1,he=q+1;q=0;q--){const le=q/w,de=p*Math.cos(le*Math.PI/2),he=m*Math.sin(le*Math.PI/2)+y;for(let me=0,ce=U.length;me=0;){const he=de;let me=de-1;me<0&&(me=q.length-1);for(let ce=0,Pe=u+w*2;ce0)&&p.push(P,A,v),(x!==o-1||s0!=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 iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=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}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.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,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}}class S2e extends id{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ir(16777215),this.specular=new ir(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ir(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=HN,this.reflectivity=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.specular.copy(e.specular),this.shininess=e.shininess,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.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.flatShading=e.flatShading,this.fog=e.fog,this}}class u_e extends id{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ir(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ir(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class T2e extends id{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class d_e extends id{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ir(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ir(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=HN,this.reflectivity=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.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.flatShading=e.flatShading,this.fog=e.fog,this}}class f_e extends id{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ir(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=S7,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class h_e extends _p{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Lv(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function p_e(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function g_e(t){function e(r,i){return t[r]-t[i]}const n=t.length,o=new Array(n);for(let r=0;r!==n;++r)o[r]=r;return o.sort(e),o}function bde(t,e,n){const o=t.length,r=new t.constructor(o);for(let i=0,a=0;a!==o;++i){const l=n[i]*e;for(let s=0;s!==e;++s)r[a++]=t[l+s]}return r}function P2e(t,e,n,o){let r=1,i=t[0];for(;i!==void 0&&i[o]===void 0;)i=t[r++];if(i===void 0)return;let a=i[o];if(a!==void 0)if(Array.isArray(a))do a=i[o],a!==void 0&&(e.push(i.time),n.push.apply(n,a)),i=t[r++];while(i!==void 0);else if(a.toArray!==void 0)do a=i[o],a!==void 0&&(e.push(i.time),a.toArray(n,n.length)),i=t[r++];while(i!==void 0);else do a=i[o],a!==void 0&&(e.push(i.time),n.push(a)),i=t[r++];while(i!==void 0)}function Z8t(t,e,n,o,r=30){const i=t.clone();i.name=e;const a=[];for(let s=0;s=o)){d.push(c.times[p]);for(let y=0;yi.tracks[s].times[0]&&(l=i.tracks[s].times[0]);for(let s=0;s=l.times[m]){const x=m*d+u,C=x+d-u;y=l.values.slice(x,C)}else{const x=l.createInterpolant(),C=u,P=d-u;x.evaluate(i),y=x.resultBuffer.slice(C,P)}s==="quaternion"&&new zs().fromArray(y).normalize().conjugate().toArray(y);const w=c.times.length;for(let x=0;x=i)){const l=n[1];e=i)break t}a=o,o=0;break n}break e}for(;o>>1;en;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);const l=this.getValueSize();this.times=o.slice(i,a),this.values=this.values.slice(i*l,a*l)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const o=this.times,r=this.values,i=o.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==i;l++){const s=o[l];if(typeof s=="number"&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,s),e=!1;break}if(a!==null&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,s,a),e=!1;break}a=s}if(r!==void 0&&p_e(r))for(let l=0,s=r.length;l!==s;++l){const c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),o=this.getValueSize(),r=this.getInterpolation()===$V,i=e.length-1;let a=1;for(let l=1;l0){e[a]=e[i];for(let l=i*o,s=a*o,c=0;c!==o;++c)n[s+c]=n[l+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*o)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),o=this.constructor,r=new o(this.name,e,n);return r.createInterpolant=this.createInterpolant,r}}j5.prototype.TimeBufferType=Float32Array;j5.prototype.ValueBufferType=Float32Array;j5.prototype.DefaultInterpolation=KF;class vS extends j5{}vS.prototype.ValueTypeName="bool";vS.prototype.ValueBufferType=Array;vS.prototype.DefaultInterpolation=JF;vS.prototype.InterpolantFactoryMethodLinear=void 0;vS.prototype.InterpolantFactoryMethodSmooth=void 0;class R2e extends j5{}R2e.prototype.ValueTypeName="color";class sL extends j5{}sL.prototype.ValueTypeName="number";class A_e extends FN{constructor(e,n,o,r){super(e,n,o,r)}interpolate_(e,n,o,r){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,s=(o-n)/(r-n);let c=e*l;for(let u=c+l;c!==u;c+=4)zs.slerpFlat(i,0,a,c-l,a,c,s);return i}}class LM extends j5{InterpolantFactoryMethodLinear(e){return new A_e(this.times,this.values,this.getValueSize(),e)}}LM.prototype.ValueTypeName="quaternion";LM.prototype.DefaultInterpolation=KF;LM.prototype.InterpolantFactoryMethodSmooth=void 0;class bS extends j5{}bS.prototype.ValueTypeName="string";bS.prototype.ValueBufferType=Array;bS.prototype.DefaultInterpolation=JF;bS.prototype.InterpolantFactoryMethodLinear=void 0;bS.prototype.InterpolantFactoryMethodSmooth=void 0;class cL extends j5{}cL.prototype.ValueTypeName="vector";class uL{constructor(e,n=-1,o,r=Cq){this.name=e,this.tracks=o,this.duration=n,this.blendMode=r,this.uuid=cm(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],o=e.tracks,r=1/(e.fps||1);for(let a=0,l=o.length;a!==l;++a)n.push(o7t(o[a]).scale(r));const i=new this(e.name,e.duration,n,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){const n=[],o=e.tracks,r={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let i=0,a=o.length;i!==a;++i)n.push(j5.toJSON(o[i]));return r}static CreateFromMorphTargetSequence(e,n,o,r){const i=n.length,a=[];for(let l=0;l1){const d=u[1];let f=r[d];f||(r[d]=f=[]),f.push(c)}}const a=[];for(const l in r)a.push(this.CreateFromMorphTargetSequence(l,r[l],n,o));return a}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const o=function(d,f,p,m,y){if(p.length!==0){const w=[],x=[];P2e(p,w,x,m),w.length!==0&&y.push(new d(f,w,x))}},r=[],i=e.name||"default",a=e.fps||30,l=e.blendMode;let s=e.length||-1;const c=e.hierarchy||[];for(let d=0;d{n&&n(i),this.manager.itemEnd(e)},0),i;if(q6[e]!==void 0){q6[e].push({onLoad:n,onProgress:o,onError:r});return}q6[e]=[],q6[e].push({onLoad:n,onProgress:o,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,s=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=q6[e],d=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=f?parseInt(f):0,m=p!==0;let y=0;const w=new ReadableStream({start(x){C();function C(){d.read().then(({done:P,value:A})=>{if(P)x.close();else{y+=A.byteLength;const S=new ProgressEvent("progress",{lengthComputable:m,loaded:y,total:p});for(let v=0,b=u.length;v{switch(s){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,l));case"json":return c.json();default:if(l===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(l),f=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{Yb.add(e,c);const u=q6[e];delete q6[e];for(let d=0,f=u.length;d{const u=q6[e];if(u===void 0)throw this.manager.itemError(e),c;delete q6[e];for(let d=0,f=u.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class i7t extends Vp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new R3(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{n(i.parse(JSON.parse(l)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},o,r)}parse(e){const n=[];for(let o=0;o0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const i in e.uniforms){const a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=o(a.value);break;case"c":r.uniforms[i].value=new ir().setHex(a.value);break;case"v2":r.uniforms[i].value=new _t().fromArray(a.value);break;case"v3":r.uniforms[i].value=new ue().fromArray(a.value);break;case"v4":r.uniforms[i].value=new Ba().fromArray(a.value);break;case"m3":r.uniforms[i].value=new ma().fromArray(a.value);break;case"m4":r.uniforms[i].value=new qi().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const i in e.extensions)r.extensions[i]=e.extensions[i];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=o(e.map)),e.matcap!==void 0&&(r.matcap=o(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=o(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=o(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=o(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),r.normalScale=new _t().fromArray(i)}return e.displacementMap!==void 0&&(r.displacementMap=o(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=o(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=o(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=o(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=o(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=o(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=o(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=o(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=o(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=o(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=o(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=o(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=o(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=o(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new _t().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=o(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=o(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=o(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=o(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=o(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=o(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=o(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const n={ShadowMaterial:l_e,SpriteMaterial:Wq,RawShaderMaterial:s_e,ShaderMaterial:Z0,PointsMaterial:m2e,MeshPhysicalMaterial:c_e,MeshStandardMaterial:vf,MeshPhongMaterial:S2e,MeshToonMaterial:u_e,MeshNormalMaterial:T2e,MeshLambertMaterial:d_e,MeshDepthMaterial:zq,MeshDistanceMaterial:Dq,MeshBasicMaterial:_3,MeshMatcapMaterial:f_e,LineDashedMaterial:h_e,LineBasicMaterial:_p,Material:id};return new n[e]}}class Sde{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let o=0,r=e.length;o0){const s=new H2e(n);i=new dL(s),i.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){r=new dL(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,l=e.length;a"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,o,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,a=Yb.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){n&&n(a),i.manager.itemEnd(e)},0),a;const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,fetch(e,l).then(function(s){return s.blob()}).then(function(s){return createImageBitmap(s,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(s){Yb.add(e,s),n&&n(s),i.manager.itemEnd(e)}).catch(function(s){r&&r(s),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}let fO;class I2e{static getContext(){return fO===void 0&&(fO=new(window.AudioContext||window.webkitAudioContext)),fO}static setContext(e){fO=e}}class g7t extends Vp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new R3(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(s){try{const c=s.slice(0);I2e.getContext().decodeAudioData(c,function(d){n(d)},l)}catch(c){l(c)}},o,r);function l(s){r?r(s):console.error(s),i.manager.itemError(e)}}}const Rve=new qi,Hve=new qi,Lx=new qi;class m7t{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new A0,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new A0,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Lx.copy(e.projectionMatrix);const r=n.eyeSep/2,i=r*n.near/n.focus,a=n.near*Math.tan(cb*n.fov*.5)/n.zoom;let l,s;Hve.elements[12]=-r,Rve.elements[12]=r,l=-a*n.aspect+i,s=a*n.aspect+i,Lx.elements[0]=2*n.near/(s-l),Lx.elements[8]=(s+l)/(s-l),this.cameraL.projectionMatrix.copy(Lx),l=-a*n.aspect-i,s=a*n.aspect-i,Lx.elements[0]=2*n.near/(s-l),Lx.elements[8]=(s+l)/(s-l),this.cameraR.projectionMatrix.copy(Lx)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Hve),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Rve)}}class z2e{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Mve(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=Mve();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function Mve(){return(typeof performance>"u"?Date:performance).now()}const Wx=new ue,Ive=new zs,y7t=new ue,Nx=new ue;class A7t extends _l{constructor(){super(),this.type="AudioListener",this.context=I2e.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new z2e}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,o=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Wx,Ive,y7t),Nx.set(0,0,-1).applyQuaternion(Ive),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Wx.x,r),n.positionY.linearRampToValueAtTime(Wx.y,r),n.positionZ.linearRampToValueAtTime(Wx.z,r),n.forwardX.linearRampToValueAtTime(Nx.x,r),n.forwardY.linearRampToValueAtTime(Nx.y,r),n.forwardZ.linearRampToValueAtTime(Nx.z,r),n.upX.linearRampToValueAtTime(o.x,r),n.upY.linearRampToValueAtTime(o.y,r),n.upZ.linearRampToValueAtTime(o.z,r)}else n.setPosition(Wx.x,Wx.y,Wx.z),n.setOrientation(Nx.x,Nx.y,Nx.z,o.x,o.y,o.z)}}class M_e extends _l{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(o,r,this._addIndex*n,1,n);for(let s=n,c=n+n;s!==c;++s)if(o[s]!==o[s+n]){l.setValue(o,r);break}}saveOriginalState(){const e=this.binding,n=this.buffer,o=this.valueSize,r=o*this._origIndex;e.getValue(n,r);for(let i=o,a=r;i!==a;++i)n[i]=n[r+i%o];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let o=e;o=.5)for(let a=0;a!==i;++a)e[n+a]=e[o+a]}_slerp(e,n,o,r){zs.slerpFlat(e,n,e,n,e,o,r)}_slerpAdditive(e,n,o,r,i){const a=this._workIndex*i;zs.multiplyQuaternionsFlat(e,a,e,n,e,o),zs.slerpFlat(e,n,e,n,e,a,r)}_lerp(e,n,o,r,i){const a=1-r;for(let l=0;l!==i;++l){const s=n+l;e[s]=e[s]*a+e[o+l]*r}}_lerpAdditive(e,n,o,r,i){for(let a=0;a!==i;++a){const l=n+a;e[l]=e[l]+e[o+a]*r}}}const D2e="\\[\\]\\.:\\/",b7t=new RegExp("["+D2e+"]","g"),E2e="[^"+D2e+"]",S7t="[^"+D2e.replace("\\.","")+"]",T7t=/((?:WC+[\/:])*)/.source.replace("WC",E2e),P7t=/(WCOD+)?/.source.replace("WCOD",S7t),C7t=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",E2e),R7t=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",E2e),H7t=new RegExp("^"+T7t+P7t+C7t+R7t+"$"),M7t=["material","materials","bones","map"];class I7t{constructor(e,n,o){const r=o||Cl.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,r)}getValue(e,n){this.bind();const o=this._targetGroup.nCachedObjects_,r=this._bindings[o];r!==void 0&&r.getValue(e,n)}setValue(e,n){const o=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=o.length;r!==i;++r)o[r].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].unbind()}}class Cl{constructor(e,n,o){this.path=n,this.parsedPath=o||Cl.parseTrackName(n),this.node=Cl.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,o){return e&&e.isAnimationObjectGroup?new Cl.Composite(e,n,o):new Cl(e,n,o)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(b7t,"")}static parseTrackName(e){const n=H7t.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const o={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=o.nodeName&&o.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const i=o.nodeName.substring(r+1);M7t.indexOf(i)!==-1&&(o.nodeName=o.nodeName.substring(0,r),o.objectName=i)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return o}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const o=e.skeleton.getBoneByName(n);if(o!==void 0)return o}if(e.children){const o=function(i){for(let a=0;a=i){const d=i++,f=e[d];n[f.uuid]=u,e[u]=f,n[c]=d,e[d]=s;for(let p=0,m=r;p!==m;++p){const y=o[p],w=y[d],x=y[u];y[u]=w,y[d]=x}}}this.nCachedObjects_=i}uncache(){const e=this._objects,n=this._indicesByUUID,o=this._bindings,r=o.length;let i=this.nCachedObjects_,a=e.length;for(let l=0,s=arguments.length;l!==s;++l){const c=arguments[l],u=c.uuid,d=n[u];if(d!==void 0)if(delete n[u],d0&&(n[p.uuid]=d),e[d]=p,e.pop();for(let m=0,y=r;m!==y;++m){const w=o[m];w[d]=w[f],w.pop()}}}this.nCachedObjects_=i}subscribe_(e,n){const o=this._bindingsIndicesByPath;let r=o[e];const i=this._bindings;if(r!==void 0)return i[r];const a=this._paths,l=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,d=new Array(c);r=i.length,o[e]=r,a.push(e),l.push(n),i.push(d);for(let f=u,p=s.length;f!==p;++f){const m=s[f];d[f]=new Cl(m,e,n)}return d}unsubscribe_(e){const n=this._bindingsIndicesByPath,o=n[e];if(o!==void 0){const r=this._paths,i=this._parsedPaths,a=this._bindings,l=a.length-1,s=a[l],c=e[l];n[c]=o,a[o]=s,a.pop(),i[o]=i[l],i.pop(),r[o]=r[l],r.pop()}}}class z_e{constructor(e,n,o=null,r=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=o,this.blendMode=r;const i=n.tracks,a=i.length,l=new Array(a),s={endingStart:Ev,endingEnd:Ev};for(let c=0;c!==a;++c){const u=i[c].createInterpolant(null);l[c]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=yOe,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,o){if(e.fadeOut(n),this.fadeIn(n),o){const r=this._clip.duration,i=e._clip.duration,a=i/r,l=r/i;e.warp(1,a,n),this.warp(l,1,n)}return this}crossFadeTo(e,n,o){return e.crossFadeFrom(this,n,o)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,o){const r=this._mixer,i=r.time,a=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);const s=l.parameterPositions,c=l.sampleValues;return s[0]=i,s[1]=i+o,c[0]=e/a,c[1]=n/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,o,r){if(!this.enabled){this._updateWeight(e);return}const i=this._startTime;if(i!==null){const s=(e-i)*o;s<0||o===0?n=0:(this._startTime=null,n=o*s)}n*=this._updateTimeScale(e);const a=this._updateTime(n),l=this._updateWeight(e);if(l>0){const s=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case r2e:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulateAdditive(l);break;case Cq:default:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulate(r,l)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const o=this._weightInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const o=this._timeScaleInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,o=this.loop;let r=this.time+e,i=this._loopCount;const a=o===AOe;if(e===0)return i===-1?r:a&&(i&1)===1?n-r:r;if(o===mOe){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=n)r=n;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=n||r<0){const l=Math.floor(r/n);r-=n*l,i+=Math.abs(l);const s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?n:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(s===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=r;if(a&&(i&1)===1)return n-r}return r}_setEndings(e,n,o){const r=this._interpolantSettings;o?(r.endingStart=kv,r.endingEnd=kv):(e?r.endingStart=this.zeroSlopeAtStart?kv:Ev:r.endingStart=$F,n?r.endingEnd=this.zeroSlopeAtEnd?kv:Ev:r.endingEnd=$F)}_scheduleFading(e,n,o){const r=this._mixer,i=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const l=a.parameterPositions,s=a.sampleValues;return l[0]=i,s[0]=n,l[1]=i+e,s[1]=o,this}}const D7t=new Float32Array(1);class E7t extends Sm{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const o=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,l=e._interpolants,s=o.uuid,c=this._bindingsByRootAndName;let u=c[s];u===void 0&&(u={},c[s]=u);for(let d=0;d!==i;++d){const f=r[d],p=f.name;let m=u[p];if(m!==void 0)++m.referenceCount,a[d]=m;else{if(m=a[d],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,s,p));continue}const y=n&&n._propertyBindings[d].binding.parsedPath;m=new I_e(Cl.create(o,p,y),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,s,p),a[d]=m}l[d].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const o=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,o)}const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];i.useCount++===0&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--o)e[o].stop();return this}update(e){e*=this.timeScale;const n=this._actions,o=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==o;++c)n[c]._update(r,e,i,a);const l=this._bindings,s=this._nActiveBindings;for(let c=0;c!==s;++c)l[c].apply(a);return this}setTime(e){this.time=0;for(let n=0;nthis.max.x||e.ythis.max.y)}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}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Eve).distanceTo(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}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)}}const kve=new ue,hO=new ue;class k2e{constructor(e=new ue,n=new ue){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){kve.subVectors(e,this.start),hO.subVectors(this.end,this.start);const o=hO.dot(hO);let i=hO.dot(kve)/o;return n&&(i=Eu(i,0,1)),i}closestPointToPoint(e,n,o){const r=this.closestPointToPointParameter(e,n);return this.delta(o).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Fve=new ue;class U7t extends _l{constructor(e,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const o=new Ni,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,l=1,s=32;a1)for(let d=0;d.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{jve.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(jve,n)}}setLength(e,n=e*.2,o=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(o,n,o),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Q7t extends G3{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],o=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Ni;r.setAttribute("position",new Ar(n,3)),r.setAttribute("color",new Ar(o,3));const i=new _p({vertexColors:!0,toneMapped:!1});super(r,i),this.type="AxesHelper"}setColors(e,n,o){const r=new ir,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(n),r.toArray(i,6),r.toArray(i,9),r.set(o),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class E_e{constructor(){this.type="ShapePath",this.color=new ir,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new rL,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,o,r){return this.currentPath.quadraticCurveTo(e,n,o,r),this}bezierCurveTo(e,n,o,r,i,a){return this.currentPath.bezierCurveTo(e,n,o,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(x){const C=[];for(let P=0,A=x.length;PNumber.EPSILON){if(M<0&&(b=C[v],R=-R,T=C[S],M=-M),x.yT.y)continue;if(x.y===b.y){if(x.x===b.x)return!0}else{const D=M*(x.x-b.x)-R*(x.y-b.y);if(D===0)return!0;if(D<0)continue;A=!A}}else{if(x.y!==b.y)continue;if(T.x<=x.x&&x.x<=b.x||b.x<=x.x&&x.x<=T.x)return!0}}return A}const r=p3.isClockWise,i=this.subPaths;if(i.length===0)return[];let a,l,s;const c=[];if(i.length===1)return l=i[0],s=new jl,s.curves=l.curves,c.push(s),c;let u=!r(i[0].getPoints());u=e?!u:u;const d=[],f=[];let p=[],m=0,y;f[m]=void 0,p[m]=[];for(let x=0,C=i.length;x1){let x=!1,C=0;for(let P=0,A=f.length;P0&&x===!1&&(p=d)}let w;for(let x=0,C=f.length;x>>1,_=L[O];if(0>>1;Or(oe,Y))ee<_&&0>r(q,oe)?(L[O]=q,L[ee]=Y,O=ee):(L[O]=oe,L[Q]=Y,O=Q);else if(ee<_&&0>r(q,Y))L[O]=q,L[ee]=Y,O=ee;else break e}}return j}function r(L,j){var Y=L.sortIndex-j.sortIndex;return Y!==0?Y:L.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var s=[],c=[],u=1,d=null,f=3,p=!1,m=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(L){for(var j=n(c);j!==null;){if(j.callback===null)o(c);else if(j.startTime<=L)o(c),j.sortIndex=j.expirationTime,e(s,j);else break;j=n(c)}}function A(L){if(y=!1,P(L),!m)if(n(s)!==null)m=!0,F(S);else{var j=n(c);j!==null&&E(A,j.startTime-L)}}function S(L,j){m=!1,y&&(y=!1,x(T),T=-1),p=!0;var Y=f;try{for(P(j),d=n(s);d!==null&&(!(d.expirationTime>j)||L&&!D());){var O=d.callback;if(typeof O=="function"){d.callback=null,f=d.priorityLevel;var _=O(d.expirationTime<=j);j=t.unstable_now(),typeof _=="function"?d.callback=_:d===n(s)&&o(s),P(j)}else o(s);d=n(s)}if(d!==null)var G=!0;else{var Q=n(c);Q!==null&&E(A,Q.startTime-j),G=!1}return G}finally{d=null,f=Y,p=!1}}var v=!1,b=null,T=-1,R=5,M=-1;function D(){return!(t.unstable_now()-ML||125O?(L.sortIndex=Y,e(c,L),n(s)===null&&L===n(c)&&(y?(x(T),T=-1):y=!0,E(A,Y-O))):(L.sortIndex=_,e(s,L),m||p||(m=!0,F(S))),L},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(L){var j=f;return function(){var Y=f;f=j;try{return L.apply(this,arguments)}finally{f=Y}}}})(W_e);L_e.exports=W_e;var Cde=L_e.exports;/** + */(function(t){function e(L,j){var Y=L.length;L.push(j);e:for(;0>>1,_=L[O];if(0>>1;Or(oe,Y))ee<_&&0>r($,oe)?(L[O]=$,L[ee]=Y,O=ee):(L[O]=oe,L[Q]=Y,O=Q);else if(ee<_&&0>r($,Y))L[O]=$,L[ee]=Y,O=ee;else break e}}return j}function r(L,j){var Y=L.sortIndex-j.sortIndex;return Y!==0?Y:L.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var s=[],c=[],u=1,d=null,f=3,p=!1,m=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(L){for(var j=n(c);j!==null;){if(j.callback===null)o(c);else if(j.startTime<=L)o(c),j.sortIndex=j.expirationTime,e(s,j);else break;j=n(c)}}function A(L){if(y=!1,P(L),!m)if(n(s)!==null)m=!0,F(S);else{var j=n(c);j!==null&&E(A,j.startTime-L)}}function S(L,j){m=!1,y&&(y=!1,x(T),T=-1),p=!0;var Y=f;try{for(P(j),d=n(s);d!==null&&(!(d.expirationTime>j)||L&&!D());){var O=d.callback;if(typeof O=="function"){d.callback=null,f=d.priorityLevel;var _=O(d.expirationTime<=j);j=t.unstable_now(),typeof _=="function"?d.callback=_:d===n(s)&&o(s),P(j)}else o(s);d=n(s)}if(d!==null)var G=!0;else{var Q=n(c);Q!==null&&E(A,Q.startTime-j),G=!1}return G}finally{d=null,f=Y,p=!1}}var v=!1,b=null,T=-1,R=5,M=-1;function D(){return!(t.unstable_now()-ML||125O?(L.sortIndex=Y,e(c,L),n(s)===null&&L===n(c)&&(y?(x(T),T=-1):y=!0,E(A,Y-O))):(L.sortIndex=_,e(s,L),m||p||(m=!0,F(S))),L},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(L){var j=f;return function(){var Y=f;f=j;try{return L.apply(this,arguments)}finally{f=Y}}}})(W_e);L_e.exports=W_e;var Cde=L_e.exports;/** * @license React * react-reconciler.production.min.js * @@ -3684,20 +3684,20 @@ void main() { * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var oxt=function(e){var n={},o=g,r=Cde,i=Object.assign;function a(J){for(var K="https://reactjs.org/docs/error-decoder.html?invariant="+J,be=1;beHn||$e[an]!==At[Hn]){var io=` `+$e[an].replace(" at new "," at ");return J.displayName&&io.includes("")&&(io=io.replace("",J.displayName)),io}while(1<=an&&0<=Hn);break}}}finally{wt=!1,Error.prepareStackTrace=be}return(J=J?J.displayName||J.name:"")?ft(J):""}var Zt=Object.prototype.hasOwnProperty,Ot=[],on=-1;function qt(J){return{current:J}}function rn(J){0>on||(J.current=Ot[on],Ot[on]=null,on--)}function Pn(J,K){on++,Ot[on]=J.current,J.current=K}var fo={},to=qt(fo),Dt=qt(!1),fn=fo;function kn(J,K){var be=J.type.contextTypes;if(!be)return fo;var ke=J.stateNode;if(ke&&ke.__reactInternalMemoizedUnmaskedChildContext===K)return ke.__reactInternalMemoizedMaskedChildContext;var $e={},At;for(At in be)$e[At]=K[At];return ke&&(J=J.stateNode,J.__reactInternalMemoizedUnmaskedChildContext=K,J.__reactInternalMemoizedMaskedChildContext=$e),$e}function yo(J){return J=J.childContextTypes,J!=null}function ur(){rn(Dt),rn(to)}function lr(J,K,be){if(to.current!==fo)throw Error(a(168));Pn(to,K),Pn(Dt,be)}function xo(J,K,be){var ke=J.stateNode;if(K=K.childContextTypes,typeof ke.getChildContext!="function")return be;ke=ke.getChildContext();for(var $e in ke)if(!($e in K))throw Error(a(108,T(J)||"Unknown",$e));return i({},be,ke)}function wo(J){return J=(J=J.stateNode)&&J.__reactInternalMemoizedMergedChildContext||fo,fn=to.current,Pn(to,J),Pn(Dt,Dt.current),!0}function Rr(J,K,be){var ke=J.stateNode;if(!ke)throw Error(a(169));be?(J=xo(J,K,fn),ke.__reactInternalMemoizedMergedChildContext=J,rn(Dt),rn(to),Pn(to,J)):rn(Dt),Pn(Dt,be)}var Eo=Math.clz32?Math.clz32:sr,An=Math.log,Dn=Math.LN2;function sr(J){return J>>>=0,J===0?32:31-(An(J)/Dn|0)|0}var Vo=64,Wo=4194304;function To(J){switch(J&-J){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return J&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return J&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return J}}function Go(J,K){var be=J.pendingLanes;if(be===0)return 0;var ke=0,$e=J.suspendedLanes,At=J.pingedLanes,an=be&268435455;if(an!==0){var Hn=an&~$e;Hn!==0?ke=To(Hn):(At&=an,At!==0&&(ke=To(At)))}else an=be&~$e,an!==0?ke=To(an):At!==0&&(ke=To(At));if(ke===0)return 0;if(K!==0&&K!==ke&&!(K&$e)&&($e=ke&-ke,At=K&-K,$e>=At||$e===16&&(At&4194240)!==0))return K;if(ke&4&&(ke|=be&16),K=J.entangledLanes,K!==0)for(J=J.entanglements,K&=ke;0be;be++)K.push(J);return K}function Bo(J,K,be){J.pendingLanes|=K,K!==536870912&&(J.suspendedLanes=0,J.pingedLanes=0),J=J.eventTimes,K=31-Eo(K),J[K]=be}function Pr(J,K){var be=J.pendingLanes&~K;J.pendingLanes=K,J.suspendedLanes=0,J.pingedLanes=0,J.expiredLanes&=K,J.mutableReadLanes&=K,J.entangledLanes&=K,K=J.entanglements;var ke=J.eventTimes;for(J=J.expirationTimes;0>=an,$e-=an,F0=1<<32-Eo(K)+$e|be<<$e|ke,Uf=At+J}else F0=1<la?(Bc=ki,ki=null):Bc=ki.sibling;var ja=ni(Yn,ki,Kn[la],Cr);if(ja===null){ki===null&&(ki=Bc);break}J&&ki&&ja.alternate===null&&K(Yn,ki),zn=At(ja,zn,la),ci===null?Kr=ja:ci.sibling=ja,ci=ja,ki=Bc}if(la===Kn.length)return be(Yn,ki),Ha&&$1(Yn,la),Kr;if(ki===null){for(;lala?(Bc=ki,ki=null):Bc=ki.sibling;var sp=ni(Yn,ki,ja.value,Cr);if(sp===null){ki===null&&(ki=Bc);break}J&&ki&&sp.alternate===null&&K(Yn,ki),zn=At(sp,zn,la),ci===null?Kr=sp:ci.sibling=sp,ci=sp,ki=Bc}if(ja.done)return be(Yn,ki),Ha&&$1(Yn,la),Kr;if(ki===null){for(;!ja.done;la++,ja=Kn.next())ja=Ei(Yn,ja.value,Cr),ja!==null&&(zn=At(ja,zn,la),ci===null?Kr=ja:ci.sibling=ja,ci=ja);return Ha&&$1(Yn,la),Kr}for(ki=ke(Yn,ki);!ja.done;la++,ja=Kn.next())ja=Fl(ki,Yn,la,ja.value,Cr),ja!==null&&(J&&ja.alternate!==null&&ki.delete(ja.key===null?la:ja.key),zn=At(ja,zn,la),ci===null?Kr=ja:ci.sibling=ja,ci=ja);return J&&ki.forEach(function(X4){return K(Yn,X4)}),Ha&&$1(Yn,la),Kr}function Qd(Yn,zn,Kn,Cr){if(typeof Kn=="object"&&Kn!==null&&Kn.type===u&&Kn.key===null&&(Kn=Kn.props.children),typeof Kn=="object"&&Kn!==null){switch(Kn.$$typeof){case s:e:{for(var Kr=Kn.key,ci=zn;ci!==null;){if(ci.key===Kr){if(Kr=Kn.type,Kr===u){if(ci.tag===7){be(Yn,ci.sibling),zn=$e(ci,Kn.props.children),zn.return=Yn,Yn=zn;break e}}else if(ci.elementType===Kr||typeof Kr=="object"&&Kr!==null&&Kr.$$typeof===P&&r9(Kr)===ci.type){be(Yn,ci.sibling),zn=$e(ci,Kn.props),zn.ref=jf(Yn,ci,Kn),zn.return=Yn,Yn=zn;break e}be(Yn,ci);break}else K(Yn,ci);ci=ci.sibling}Kn.type===u?(zn=pg(Kn.props.children,Yn.mode,Cr,Kn.key),zn.return=Yn,Yn=zn):(Cr=F6(Kn.type,Kn.key,Kn.props,null,Yn.mode,Cr),Cr.ref=jf(Yn,zn,Kn),Cr.return=Yn,Yn=Cr)}return an(Yn);case c:e:{for(ci=Kn.key;zn!==null;){if(zn.key===ci)if(zn.tag===4&&zn.stateNode.containerInfo===Kn.containerInfo&&zn.stateNode.implementation===Kn.implementation){be(Yn,zn.sibling),zn=$e(zn,Kn.children||[]),zn.return=Yn,Yn=zn;break e}else{be(Yn,zn);break}else K(Yn,zn);zn=zn.sibling}zn=qd(Kn,Yn.mode,Cr),zn.return=Yn,Yn=zn}return an(Yn);case P:return ci=Kn._init,Qd(Yn,zn,ci(Kn._payload),Cr)}if(W(Kn))return Jr(Yn,zn,Kn,Cr);if(v(Kn))return d0(Yn,zn,Kn,Cr);xu(Yn,Kn)}return typeof Kn=="string"&&Kn!==""||typeof Kn=="number"?(Kn=""+Kn,zn!==null&&zn.tag===6?(be(Yn,zn.sibling),zn=$e(zn,Kn),zn.return=Yn,Yn=zn):(be(Yn,zn),zn=jc(Kn,Yn.mode,Cr),zn.return=Yn,Yn=zn),an(Yn)):be(Yn,zn)}return Qd}var zm=Jh(!0),q7=Jh(!1),Kh={},$l=qt(Kh),i9=qt(Kh),p2=qt(Kh);function e1(J){if(J===Kh)throw Error(a(174));return J}function m6(J,K){Pn(p2,K),Pn(i9,J),Pn($l,Kh),J=E(K),rn($l),Pn($l,J)}function g2(){rn($l),rn(i9),rn(p2)}function mT(J){var K=e1(p2.current),be=e1($l.current);K=L(be,J.type,K),be!==K&&(Pn(i9,J),Pn($l,K))}function Q1(J){i9.current===J&&(rn($l),rn(i9))}var vn=qt(0);function lo(J){for(var K=J;K!==null;){if(K.tag===13){var be=K.memoizedState;if(be!==null&&(be=be.dehydrated,be===null||St(be)||Pt(be)))return K}else if(K.tag===19&&K.memoizedProps.revealOrder!==void 0){if(K.flags&128)return K}else if(K.child!==null){K.child.return=K,K=K.child;continue}if(K===J)break;for(;K.sibling===null;){if(K.return===null||K.return===J)return null;K=K.return}K.sibling.return=K.return,K=K.sibling}return null}var Xn=[];function Ir(){for(var J=0;Jbe?be:4,J(!0);var ke=Gi.transition;Gi.transition={};try{J(!1),K()}finally{zo=be,Gi.transition=ke}}function tx(){return W0().memoizedState}function dc(J,K,be){var ke=yd(J);be={lane:ke,action:be,hasEagerState:!1,eagerState:null,next:null},D4(J)?Nr(K,be):(Yu(J,K,be),be=Ru(),J=Kd(J,ke,be),J!==null&&Qh(J,K,ke))}function Su(J,K,be){var ke=yd(J),$e={lane:ke,action:be,hasEagerState:!1,eagerState:null,next:null};if(D4(J))Nr(K,$e);else{Yu(J,K,$e);var At=J.alternate;if(J.lanes===0&&(At===null||At.lanes===0)&&(At=K.lastRenderedReducer,At!==null))try{var an=K.lastRenderedState,Hn=At(an,be);if($e.hasEagerState=!0,$e.eagerState=Hn,Cs(Hn,an))return}catch{}finally{}be=Ru(),J=Kd(J,ke,be),J!==null&&Qh(J,K,ke)}}function D4(J){var K=J.alternate;return J===vi||K!==null&&K===vi}function Nr(J,K){$h=L0=!0;var be=J.pending;be===null?K.next=K:(K.next=be.next,be.next=K),J.pending=K}function Yu(J,K,be){Gs!==null&&J.mode&1&&!(oa&2)?(J=K.interleaved,J===null?(be.next=be,Tn===null?Tn=[K]:Tn.push(K)):(be.next=J.next,J.next=be),K.interleaved=be):(J=K.pending,J===null?be.next=be:(be.next=J.next,J.next=be),K.pending=be)}function Qh(J,K,be){if(be&4194240){var ke=K.lanes;ke&=J.pendingLanes,be|=ke,K.lanes=be,so(J,be)}}var s9={readContext:xn,useCallback:uc,useContext:uc,useEffect:uc,useImperativeHandle:uc,useInsertionEffect:uc,useLayoutEffect:uc,useMemo:uc,useReducer:uc,useRef:uc,useState:uc,useDebugValue:uc,useDeferredValue:uc,useTransition:uc,useMutableSource:uc,useSyncExternalStore:uc,useId:uc,unstable_isNewReconciler:!1},v6={readContext:xn,useCallback:function(J,K){return t1().memoizedState=[J,K===void 0?null:K],J},useContext:xn,useEffect:Yf,useImperativeHandle:function(J,K,be){return be=be!=null?be.concat([J]):null,tg(4194308,4,y2.bind(null,K,J),be)},useLayoutEffect:function(J,K){return tg(4194308,4,J,K)},useInsertionEffect:function(J,K){return tg(4,2,J,K)},useMemo:function(J,K){var be=t1();return K=K===void 0?null:K,J=J(),be.memoizedState=[J,K],J},useReducer:function(J,K,be){var ke=t1();return K=be!==void 0?be(K):K,ke.memoizedState=ke.baseState=K,J={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:J,lastRenderedState:K},ke.queue=J,J=J.dispatch=dc.bind(null,vi,J),[ke.memoizedState,J]},useRef:function(J){var K=t1();return J={current:J},K.memoizedState=J},useState:eg,useDebugValue:og,useDeferredValue:function(J){var K=eg(J),be=K[0],ke=K[1];return Yf(function(){var $e=Gi.transition;Gi.transition={};try{ke(J)}finally{Gi.transition=$e}},[J]),be},useTransition:function(){var J=eg(!1),K=J[0];return J=oz.bind(null,J[1]),t1().memoizedState=J,[K,J]},useMutableSource:function(){},useSyncExternalStore:function(J,K,be){var ke=vi,$e=t1();if(Ha){if(be===void 0)throw Error(a(407));be=be()}else{if(be=K(),Gs===null)throw Error(a(349));yl&30||kl(ke,K,be)}$e.memoizedState=be;var At={value:be,getSnapshot:K};return $e.queue=At,Yf(qh.bind(null,ke,At,J),[J]),ke.flags|=2048,Bf(9,w6.bind(null,ke,At,be,K),void 0,null),be},useId:function(){var J=t1(),K=Gs.identifierPrefix;if(Ha){var be=Uf,ke=F0;be=(ke&~(1<<32-Eo(ke)-1)).toString(32)+be,K=":"+K+"R"+be,be=y6++,0S2&&(K.flags|=128,ke=!0,Ou($e,!1),K.lanes=4194304)}else{if(!ke)if(J=lo(At),J!==null){if(K.flags|=128,ke=!0,J=J.updateQueue,J!==null&&(K.updateQueue=J,K.flags|=4),Ou($e,!0),$e.tail===null&&$e.tailMode==="hidden"&&!At.alternate&&!Ha)return gi(K),null}else 2*cr()-$e.renderingStartTime>S2&&be!==1073741824&&(K.flags|=128,ke=!0,Ou($e,!1),K.lanes=4194304);$e.isBackwards?(At.sibling=K.child,K.child=At):(J=$e.last,J!==null?J.sibling=At:K.child=At,$e.last=At)}return $e.tail!==null?(K=$e.tail,$e.rendering=K,$e.tail=K.sibling,$e.renderingStartTime=cr(),K.sibling=null,J=vn.current,Pn(vn,ke?J&1|2:J&1),K):(gi(K),null);case 22:case 23:return v9(),ke=K.memoizedState!==null,J!==null&&J.memoizedState!==null!==ke&&(K.flags|=8192),ke&&K.mode&1?_u&1073741824&&(gi(K),te&&K.subtreeFlags&6&&(K.flags|=8192)):gi(K),null;case 24:return null;case 25:return null}throw Error(a(156,K.tag))}var rz=l.ReactCurrentOwner,Gd=!1;function Ws(J,K,be,ke){K.child=J===null?q7(K,null,be,ke):zm(K,J.child,be,ke)}function nx(J,K,be,ke,$e){be=be.render;var At=K.ref;return En(K,$e),ke=aa(J,K,be,ke,At,$e),be=z4(),J!==null&&!Gd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~$e,Ns(J,K,$e)):(Ha&&be&&Im(K),K.flags|=1,Ws(J,K,ke,$e),K.child)}function ox(J,K,be,ke,$e){if(J===null){var At=be.type;return typeof At=="function"&&!b9(At)&&At.defaultProps===void 0&&be.compare===null&&be.defaultProps===void 0?(K.tag=15,K.type=At,wT(J,K,At,ke,$e)):(J=F6(be.type,null,ke,K,K.mode,$e),J.ref=K.ref,J.return=K,K.child=J)}if(At=J.child,!(J.lanes&$e)){var an=At.memoizedProps;if(be=be.compare,be=be!==null?be:wn,be(an,ke)&&J.ref===K.ref)return Ns(J,K,$e)}return K.flags|=1,J=lp(At,ke),J.ref=K.ref,J.return=K,K.child=J}function wT(J,K,be,ke,$e){if(J!==null&&wn(J.memoizedProps,ke)&&J.ref===K.ref)if(Gd=!1,(J.lanes&$e)!==0)J.flags&131072&&(Gd=!0);else return K.lanes=J.lanes,Ns(J,K,$e);return Zh(J,K,be,ke,$e)}function xT(J,K,be){var ke=K.pendingProps,$e=ke.children,At=J!==null?J.memoizedState:null;if(ke.mode==="hidden")if(!(K.mode&1))K.memoizedState={baseLanes:0,cachePool:null},Pn(gd,_u),_u|=be;else if(be&1073741824)K.memoizedState={baseLanes:0,cachePool:null},ke=At!==null?At.baseLanes:be,Pn(gd,_u),_u|=ke;else return J=At!==null?At.baseLanes|be:be,K.lanes=K.childLanes=1073741824,K.memoizedState={baseLanes:J,cachePool:null},K.updateQueue=null,Pn(gd,_u),_u|=J,null;else At!==null?(ke=At.baseLanes|be,K.memoizedState=null):ke=be,Pn(gd,_u),_u|=ke;return Ws(J,K,$e,be),K.child}function rx(J,K){var be=K.ref;(J===null&&be!==null||J!==null&&J.ref!==be)&&(K.flags|=512,K.flags|=2097152)}function Zh(J,K,be,ke,$e){var At=yo(be)?fn:to.current;return At=kn(K,At),En(K,$e),be=aa(J,K,be,ke,At,$e),ke=z4(),J!==null&&!Gd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~$e,Ns(J,K,$e)):(Ha&&ke&&Im(K),K.flags|=1,Ws(J,K,be,$e),K.child)}function vT(J,K,be,ke,$e){if(yo(be)){var At=!0;wo(K)}else At=!1;if(En(K,$e),K.stateNode===null)J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),ud(K,be,ke),Xh(K,be,ke,$e),ke=!0;else if(J===null){var an=K.stateNode,Hn=K.memoizedProps;an.props=Hn;var io=an.context,Xo=be.contextType;typeof Xo=="object"&&Xo!==null?Xo=xn(Xo):(Xo=yo(be)?fn:to.current,Xo=kn(K,Xo));var Er=be.getDerivedStateFromProps,Ei=typeof Er=="function"||typeof an.getSnapshotBeforeUpdate=="function";Ei||typeof an.UNSAFE_componentWillReceiveProps!="function"&&typeof an.componentWillReceiveProps!="function"||(Hn!==ke||io!==Xo)&&Mm(K,an,ke,Xo),_n=!1;var ni=K.memoizedState;an.state=ni,na(K,ke,an,$e),io=K.memoizedState,Hn!==ke||ni!==io||Dt.current||_n?(typeof Er=="function"&&(cc(K,be,Er,ke),io=K.memoizedState),(Hn=_n||ps(K,be,Hn,ke,ni,io,Xo))?(Ei||typeof an.UNSAFE_componentWillMount!="function"&&typeof an.componentWillMount!="function"||(typeof an.componentWillMount=="function"&&an.componentWillMount(),typeof an.UNSAFE_componentWillMount=="function"&&an.UNSAFE_componentWillMount()),typeof an.componentDidMount=="function"&&(K.flags|=4194308)):(typeof an.componentDidMount=="function"&&(K.flags|=4194308),K.memoizedProps=ke,K.memoizedState=io),an.props=ke,an.state=io,an.context=Xo,ke=Hn):(typeof an.componentDidMount=="function"&&(K.flags|=4194308),ke=!1)}else{an=K.stateNode,Gn(J,K),Hn=K.memoizedProps,Xo=K.type===K.elementType?Hn:Wn(K.type,Hn),an.props=Xo,Ei=K.pendingProps,ni=an.context,io=be.contextType,typeof io=="object"&&io!==null?io=xn(io):(io=yo(be)?fn:to.current,io=kn(K,io));var Fl=be.getDerivedStateFromProps;(Er=typeof Fl=="function"||typeof an.getSnapshotBeforeUpdate=="function")||typeof an.UNSAFE_componentWillReceiveProps!="function"&&typeof an.componentWillReceiveProps!="function"||(Hn!==Ei||ni!==io)&&Mm(K,an,ke,io),_n=!1,ni=K.memoizedState,an.state=ni,na(K,ke,an,$e);var Jr=K.memoizedState;Hn!==Ei||ni!==Jr||Dt.current||_n?(typeof Fl=="function"&&(cc(K,be,Fl,ke),Jr=K.memoizedState),(Xo=_n||ps(K,be,Xo,ke,ni,Jr,io)||!1)?(Er||typeof an.UNSAFE_componentWillUpdate!="function"&&typeof an.componentWillUpdate!="function"||(typeof an.componentWillUpdate=="function"&&an.componentWillUpdate(ke,Jr,io),typeof an.UNSAFE_componentWillUpdate=="function"&&an.UNSAFE_componentWillUpdate(ke,Jr,io)),typeof an.componentDidUpdate=="function"&&(K.flags|=4),typeof an.getSnapshotBeforeUpdate=="function"&&(K.flags|=1024)):(typeof an.componentDidUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=4),typeof an.getSnapshotBeforeUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=1024),K.memoizedProps=ke,K.memoizedState=Jr),an.props=ke,an.state=Jr,an.context=io,ke=Xo):(typeof an.componentDidUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=4),typeof an.getSnapshotBeforeUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=1024),ke=!1)}return F4(J,K,be,ke,At,$e)}function F4(J,K,be,ke,$e,At){rx(J,K);var an=(K.flags&128)!==0;if(!ke&&!an)return $e&&Rr(K,be,!1),Ns(J,K,At);ke=K.stateNode,rz.current=K;var Hn=an&&typeof be.getDerivedStateFromError!="function"?null:ke.render();return K.flags|=1,J!==null&&an?(K.child=zm(K,J.child,null,At),K.child=zm(K,null,Hn,At)):Ws(J,K,Hn,At),K.memoizedState=ke.state,$e&&Rr(K,be,!0),K.child}function S6(J){var K=J.stateNode;K.pendingContext?lr(J,K.pendingContext,K.pendingContext!==K.context):K.context&&lr(J,K.context,!1),m6(J,K.containerInfo)}function ix(J,K,be,ke,$e){return o9(),g6($e),K.flags|=256,Ws(J,K,be,ke),K.child}var T6={dehydrated:null,treeContext:null,retryLane:0};function fd(J){return{baseLanes:J,cachePool:null}}function ax(J,K,be){var ke=K.pendingProps,$e=vn.current,At=!1,an=(K.flags&128)!==0,Hn;if((Hn=an)||(Hn=J!==null&&J.memoizedState===null?!1:($e&2)!==0),Hn?(At=!0,K.flags&=-129):(J===null||J.memoizedState!==null)&&($e|=1),Pn(vn,$e&1),J===null)return I4(K),J=K.memoizedState,J!==null&&(J=J.dehydrated,J!==null)?(K.mode&1?Pt(J)?K.lanes=8:K.lanes=1073741824:K.lanes=1,null):($e=ke.children,J=ke.fallback,At?(ke=K.mode,At=K.child,$e={mode:"hidden",children:$e},!(ke&1)&&At!==null?(At.childLanes=0,At.pendingProps=$e):At=Gm($e,ke,0,null),J=pg(J,ke,be,null),At.return=K,J.return=K,At.sibling=J,K.child=At,K.child.memoizedState=fd(be),K.memoizedState=T6,J):lx(K,$e));if($e=J.memoizedState,$e!==null){if(Hn=$e.dehydrated,Hn!==null){if(an)return K.flags&256?(K.flags&=-257,P6(J,K,be,Error(a(422)))):K.memoizedState!==null?(K.child=J.child,K.flags|=128,null):(At=ke.fallback,$e=K.mode,ke=Gm({mode:"visible",children:ke.children},$e,0,null),At=pg(At,$e,be,null),At.flags|=2,ke.return=K,At.return=K,ke.sibling=At,K.child=ke,K.mode&1&&zm(K,J.child,null,be),K.child.memoizedState=fd(be),K.memoizedState=T6,At);if(!(K.mode&1))K=P6(J,K,be,null);else if(Pt(Hn))K=P6(J,K,be,Error(a(419)));else if(ke=(be&J.childLanes)!==0,Gd||ke){if(ke=Gs,ke!==null){switch(be&-be){case 4:At=2;break;case 16:At=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:At=32;break;case 536870912:At=268435456;break;default:At=0}ke=At&(ke.suspendedLanes|be)?0:At,ke!==0&&ke!==$e.retryLane&&($e.retryLane=ke,Kd(J,ke,-1))}_m(),K=P6(J,K,be,Error(a(421)))}else St(Hn)?(K.flags|=128,K.child=J.child,K=Jf.bind(null,J),Yt(Hn,K),K=null):(be=$e.treeContext,le&&(va=yt(Hn),Bu=K,Ha=!0,dd=null,iu=!1,be!==null&&(a0[ou++]=F0,a0[ou++]=Uf,a0[ou++]=Zp,F0=be.id,Uf=be.overflow,Zp=K)),K=lx(K,K.pendingProps.children),K.flags|=4096);return K}return At?(ke=cx(J,K,ke.children,ke.fallback,be),At=K.child,$e=J.child.memoizedState,At.memoizedState=$e===null?fd(be):{baseLanes:$e.baseLanes|be,cachePool:null},At.childLanes=J.childLanes&~be,K.memoizedState=T6,ke):(be=sx(J,K,ke.children,be),K.memoizedState=null,be)}return At?(ke=cx(J,K,ke.children,ke.fallback,be),At=K.child,$e=J.child.memoizedState,At.memoizedState=$e===null?fd(be):{baseLanes:$e.baseLanes|be,cachePool:null},At.childLanes=J.childLanes&~be,K.memoizedState=T6,ke):(be=sx(J,K,ke.children,be),K.memoizedState=null,be)}function lx(J,K){return K=Gm({mode:"visible",children:K},J.mode,0,null),K.return=J,J.child=K}function sx(J,K,be,ke){var $e=J.child;return J=$e.sibling,be=lp($e,{mode:"visible",children:be}),!(K.mode&1)&&(be.lanes=ke),be.return=K,be.sibling=null,J!==null&&(ke=K.deletions,ke===null?(K.deletions=[J],K.flags|=16):ke.push(J)),K.child=be}function cx(J,K,be,ke,$e){var At=K.mode;J=J.child;var an=J.sibling,Hn={mode:"hidden",children:be};return!(At&1)&&K.child!==J?(be=K.child,be.childLanes=0,be.pendingProps=Hn,K.deletions=null):(be=lp(J,Hn),be.subtreeFlags=J.subtreeFlags&14680064),an!==null?ke=lp(an,ke):(ke=pg(ke,At,$e,null),ke.flags|=2),ke.return=K,be.return=K,be.sibling=ke,K.child=be,ke}function P6(J,K,be,ke){return ke!==null&&g6(ke),zm(K,J.child,null,be),J=lx(K,K.pendingProps.children),J.flags|=2,K.memoizedState=null,J}function cg(J,K,be){J.lanes|=K;var ke=J.alternate;ke!==null&&(ke.lanes|=K),dn(J.return,K,be)}function h9(J,K,be,ke,$e){var At=J.memoizedState;At===null?J.memoizedState={isBackwards:K,rendering:null,renderingStartTime:0,last:ke,tail:be,tailMode:$e}:(At.isBackwards=K,At.rendering=null,At.renderingStartTime=0,At.last=ke,At.tail=be,At.tailMode=$e)}function bT(J,K,be){var ke=K.pendingProps,$e=ke.revealOrder,At=ke.tail;if(Ws(J,K,ke.children,be),ke=vn.current,ke&2)ke=ke&1|2,K.flags|=128;else{if(J!==null&&J.flags&128)e:for(J=K.child;J!==null;){if(J.tag===13)J.memoizedState!==null&&cg(J,be,K);else if(J.tag===19)cg(J,be,K);else if(J.child!==null){J.child.return=J,J=J.child;continue}if(J===K)break e;for(;J.sibling===null;){if(J.return===null||J.return===K)break e;J=J.return}J.sibling.return=J.return,J=J.sibling}ke&=1}if(Pn(vn,ke),!(K.mode&1))K.memoizedState=null;else switch($e){case"forwards":for(be=K.child,$e=null;be!==null;)J=be.alternate,J!==null&&lo(J)===null&&($e=be),be=be.sibling;be=$e,be===null?($e=K.child,K.child=null):($e=be.sibling,be.sibling=null),h9(K,!1,$e,be,At);break;case"backwards":for(be=null,$e=K.child,K.child=null;$e!==null;){if(J=$e.alternate,J!==null&&lo(J)===null){K.child=$e;break}J=$e.sibling,$e.sibling=be,be=$e,$e=J}h9(K,!0,be,null,At);break;case"together":h9(K,!1,null,null,void 0);break;default:K.memoizedState=null}return K.child}function Ns(J,K,be){if(J!==null&&(K.dependencies=J.dependencies),Nm|=K.lanes,!(be&K.childLanes))return null;if(J!==null&&K.child!==J.child)throw Error(a(153));if(K.child!==null){for(J=K.child,be=lp(J,J.pendingProps),K.child=be,be.return=K;J.sibling!==null;)J=J.sibling,be=be.sibling=lp(J,J.pendingProps),be.return=K;be.sibling=null}return K.child}function iz(J,K,be){switch(K.tag){case 3:S6(K),o9();break;case 5:mT(K);break;case 1:yo(K.type)&&wo(K);break;case 4:m6(K,K.stateNode.containerInfo);break;case 10:en(K,K.type._context,K.memoizedProps.value);break;case 13:var ke=K.memoizedState;if(ke!==null)return ke.dehydrated!==null?(Pn(vn,vn.current&1),K.flags|=128,null):be&K.child.childLanes?ax(J,K,be):(Pn(vn,vn.current&1),J=Ns(J,K,be),J!==null?J.sibling:null);Pn(vn,vn.current&1);break;case 19:if(ke=(be&K.childLanes)!==0,J.flags&128){if(ke)return bT(J,K,be);K.flags|=128}var $e=K.memoizedState;if($e!==null&&($e.rendering=null,$e.tail=null,$e.lastEffect=null),Pn(vn,vn.current),ke)break;return null;case 22:case 23:return K.lanes=0,xT(J,K,be)}return Ns(J,K,be)}function az(J,K){switch(ru(K),K.tag){case 1:return yo(K.type)&&ur(),J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 3:return g2(),rn(Dt),rn(to),Ir(),J=K.flags,J&65536&&!(J&128)?(K.flags=J&-65537|128,K):null;case 5:return Q1(K),null;case 13:if(rn(vn),J=K.memoizedState,J!==null&&J.dehydrated!==null){if(K.alternate===null)throw Error(a(340));o9()}return J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 19:return rn(vn),null;case 4:return g2(),null;case 10:return sn(K.type._context),null;case 22:case 23:return v9(),null;case 24:return null;default:return null}}var L4=!1,o1=!1,W4=typeof WeakSet=="function"?WeakSet:Set,wr=null;function p9(J,K){var be=J.ref;if(be!==null)if(typeof be=="function")try{be(null)}catch(ke){Vu(J,K,ke)}else be.current=null}function g9(J,K,be){try{be()}catch(ke){Vu(J,K,ke)}}var N4=!1;function C6(J,K){for(j(J.containerInfo),wr=K;wr!==null;)if(J=wr,K=J.child,(J.subtreeFlags&1028)!==0&&K!==null)K.return=J,wr=K;else for(;wr!==null;){J=wr;try{var be=J.alternate;if(J.flags&1024)switch(J.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var ke=be.memoizedProps,$e=be.memoizedState,At=J.stateNode,an=At.getSnapshotBeforeUpdate(J.elementType===J.type?ke:Wn(J.type,ke),$e);At.__reactInternalSnapshotBeforeUpdate=an}break;case 3:te&&ut(J.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(Hn){Vu(J,J.return,Hn)}if(K=J.sibling,K!==null){K.return=J.return,wr=K;break}wr=J.return}return be=N4,N4=!1,be}function Of(J,K,be){var ke=K.updateQueue;if(ke=ke!==null?ke.lastEffect:null,ke!==null){var $e=ke=ke.next;do{if(($e.tag&J)===J){var At=$e.destroy;$e.destroy=void 0,At!==void 0&&g9(K,be,At)}$e=$e.next}while($e!==ke)}}function r1(J,K){if(K=K.updateQueue,K=K!==null?K.lastEffect:null,K!==null){var be=K=K.next;do{if((be.tag&J)===J){var ke=be.create;be.destroy=ke()}be=be.next}while(be!==K)}}function U4(J){var K=J.ref;if(K!==null){var be=J.stateNode;switch(J.tag){case 5:J=F(be);break;default:J=be}typeof K=="function"?K(J):K.current=J}}function R6(J,K,be){if(sc&&typeof sc.onCommitFiberUnmount=="function")try{sc.onCommitFiberUnmount(_s,K)}catch{}switch(K.tag){case 0:case 11:case 14:case 15:if(J=K.updateQueue,J!==null&&(J=J.lastEffect,J!==null)){var ke=J=J.next;do{var $e=ke,At=$e.destroy;$e=$e.tag,At!==void 0&&($e&2||$e&4)&&g9(K,be,At),ke=ke.next}while(ke!==J)}break;case 1:if(p9(K,be),J=K.stateNode,typeof J.componentWillUnmount=="function")try{J.props=K.memoizedProps,J.state=K.memoizedState,J.componentWillUnmount()}catch(an){Vu(K,be,an)}break;case 5:p9(K,be);break;case 4:te?w2(J,K,be):$&&$&&(K=K.stateNode.containerInfo,be=Qe(K),tt(K,be))}}function ep(J,K,be){for(var ke=K;;)if(R6(J,ke,be),ke.child===null||te&&ke.tag===4){if(ke===K)break;for(;ke.sibling===null;){if(ke.return===null||ke.return===K)return;ke=ke.return}ke.sibling.return=ke.return,ke=ke.sibling}else ke.child.return=ke,ke=ke.child}function tp(J){var K=J.alternate;K!==null&&(J.alternate=null,tp(K)),J.child=null,J.deletions=null,J.sibling=null,J.tag===5&&(K=J.stateNode,K!==null&&ce(K)),J.stateNode=null,J.return=null,J.dependencies=null,J.memoizedProps=null,J.memoizedState=null,J.pendingProps=null,J.stateNode=null,J.updateQueue=null}function H6(J){return J.tag===5||J.tag===3||J.tag===4}function ug(J){e:for(;;){for(;J.sibling===null;){if(J.return===null||H6(J.return))return null;J=J.return}for(J.sibling.return=J.return,J=J.sibling;J.tag!==5&&J.tag!==6&&J.tag!==18;){if(J.flags&2||J.child===null||J.tag===4)continue e;J.child.return=J,J=J.child}if(!(J.flags&2))return J.stateNode}}function hd(J){if(te){e:{for(var K=J.return;K!==null;){if(H6(K))break e;K=K.return}throw Error(a(160))}var be=K;switch(be.tag){case 5:K=be.stateNode,be.flags&32&&(He(K),be.flags&=-33),be=ug(J),A2(J,be,K);break;case 3:case 4:K=be.stateNode.containerInfo,be=ug(J),j4(J,be,K);break;default:throw Error(a(161))}}}function j4(J,K,be){var ke=J.tag;if(ke===5||ke===6)J=J.stateNode,K?Ue(be,J,K):Ce(be,J);else if(ke!==4&&(J=J.child,J!==null))for(j4(J,K,be),J=J.sibling;J!==null;)j4(J,K,be),J=J.sibling}function A2(J,K,be){var ke=J.tag;if(ke===5||ke===6)J=J.stateNode,K?_e(be,J,K):Me(be,J);else if(ke!==4&&(J=J.child,J!==null))for(A2(J,K,be),J=J.sibling;J!==null;)A2(J,K,be),J=J.sibling}function w2(J,K,be){for(var ke=K,$e=!1,At,an;;){if(!$e){$e=ke.return;e:for(;;){if($e===null)throw Error(a(160));switch(At=$e.stateNode,$e.tag){case 5:an=!1;break e;case 3:At=At.containerInfo,an=!0;break e;case 4:At=At.containerInfo,an=!0;break e}$e=$e.return}$e=!0}if(ke.tag===5||ke.tag===6)ep(J,ke,be),an?Fe(At,ke.stateNode):qe(At,ke.stateNode);else if(ke.tag===18)an?it(At,ke.stateNode):ot(At,ke.stateNode);else if(ke.tag===4){if(ke.child!==null){At=ke.stateNode.containerInfo,an=!0,ke.child.return=ke,ke=ke.child;continue}}else if(R6(J,ke,be),ke.child!==null){ke.child.return=ke,ke=ke.child;continue}if(ke===K)break;for(;ke.sibling===null;){if(ke.return===null||ke.return===K)return;ke=ke.return,ke.tag===4&&($e=!1)}ke.sibling.return=ke.return,ke=ke.sibling}}function i1(J,K){if(te){switch(K.tag){case 0:case 11:case 14:case 15:Of(3,K,K.return),r1(3,K),Of(5,K,K.return);return;case 1:return;case 5:var be=K.stateNode;if(be!=null){var ke=K.memoizedProps;J=J!==null?J.memoizedProps:ke;var $e=K.type,At=K.updateQueue;K.updateQueue=null,At!==null&&Ne(be,At,$e,J,ke,K)}return;case 6:if(K.stateNode===null)throw Error(a(162));be=K.memoizedProps,Te(K.stateNode,J!==null?J.memoizedProps:be,be);return;case 3:le&&J!==null&&J.memoizedState.isDehydrated&&st(K.stateNode.containerInfo);return;case 12:return;case 13:s0(K);return;case 19:s0(K);return;case 17:return}throw Error(a(163))}switch(K.tag){case 0:case 11:case 14:case 15:Of(3,K,K.return),r1(3,K),Of(5,K,K.return);return;case 12:return;case 13:s0(K);return;case 19:s0(K);return;case 3:le&&J!==null&&J.memoizedState.isDehydrated&&st(K.stateNode.containerInfo);break;case 22:case 23:return}e:if($){switch(K.tag){case 1:case 5:case 6:break e;case 3:case 4:K=K.stateNode,tt(K.containerInfo,K.pendingChildren);break e}throw Error(a(163))}}function s0(J){var K=J.updateQueue;if(K!==null){J.updateQueue=null;var be=J.stateNode;be===null&&(be=J.stateNode=new W4),K.forEach(function(ke){var $e=k6.bind(null,J,ke);be.has(ke)||(be.add(ke),ke.then($e,$e))})}}function x2(J,K){for(wr=K;wr!==null;){K=wr;var be=K.deletions;if(be!==null)for(var ke=0;ke";case op:return":has("+(rp(J)||"")+")";case pd:return'[role="'+J.value+'"]';case Xd:return'"'+J.value+'"';case Tu:return'[data-testname="'+J.value+'"]';default:throw Error(a(365))}}function ux(J,K){var be=[];J=[J,0];for(var ke=0;ke$e&&($e=an),ke&=~At}if(ke=$e,ke=cr()-ke,ke=(120>ke?120:480>ke?480:1080>ke?1080:1920>ke?1920:3e3>ke?3e3:4320>ke?4320:1960*TT(ke/1960))-ke,10J?16:J,Gf===null)var ke=!1;else{if(J=Gf,Gf=null,w9=0,oa&6)throw Error(a(331));var $e=oa;for(oa|=4,wr=J.current;wr!==null;){var At=wr,an=At.child;if(wr.flags&16){var Hn=At.deletions;if(Hn!==null){for(var io=0;iocr()-fx?Xf(J,0):B4|=be),fi(J,K)}function mx(J,K){K===0&&(J.mode&1?(K=Wo,Wo<<=1,!(Wo&130023424)&&(Wo=4194304)):K=1);var be=Ru();J=Om(J,K),J!==null&&(Bo(J,K,be),fi(J,be))}function Jf(J){var K=J.memoizedState,be=0;K!==null&&(be=K.retryLane),mx(J,be)}function k6(J,K){var be=0;switch(J.tag){case 13:var ke=J.stateNode,$e=J.memoizedState;$e!==null&&(be=$e.retryLane);break;case 19:ke=J.stateNode;break;default:throw Error(a(314))}ke!==null&&ke.delete(K),mx(J,be)}var yx;yx=function(J,K,be){if(J!==null)if(J.memoizedProps!==K.pendingProps||Dt.current)Gd=!0;else{if(!(J.lanes&be)&&!(K.flags&128))return Gd=!1,iz(J,K,be);Gd=!!(J.flags&131072)}else Gd=!1,Ha&&K.flags&1048576&&q1(K,K1,K.index);switch(K.lanes=0,K.tag){case 2:var ke=K.type;J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps;var $e=kn(K,to.current);En(K,be),$e=aa(null,K,ke,J,$e,be);var At=z4();return K.flags|=1,typeof $e=="object"&&$e!==null&&typeof $e.render=="function"&&$e.$$typeof===void 0?(K.tag=1,K.memoizedState=null,K.updateQueue=null,yo(ke)?(At=!0,wo(K)):At=!1,K.memoizedState=$e.state!==null&&$e.state!==void 0?$e.state:null,Vn(K),$e.updater=wu,K.stateNode=$e,$e._reactInternals=K,Xh(K,ke,J,be),K=F4(null,K,ke,!0,At,be)):(K.tag=0,Ha&&At&&Im(K),Ws(null,K,$e,be),K=K.child),K;case 16:ke=K.elementType;e:{switch(J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps,$e=ke._init,ke=$e(ke._payload),K.type=ke,$e=K.tag=CT(ke),J=Wn(ke,J),$e){case 0:K=Zh(null,K,ke,J,be);break e;case 1:K=vT(null,K,ke,J,be);break e;case 11:K=nx(null,K,ke,J,be);break e;case 14:K=ox(null,K,ke,Wn(ke.type,J),be);break e}throw Error(a(306,ke,""))}return K;case 0:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),Zh(J,K,ke,$e,be);case 1:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),vT(J,K,ke,$e,be);case 3:e:{if(S6(K),J===null)throw Error(a(387));ke=K.pendingProps,At=K.memoizedState,$e=At.element,Gn(J,K),na(K,ke,null,be);var an=K.memoizedState;if(ke=an.element,le&&At.isDehydrated)if(At={element:ke,isDehydrated:!1,cache:an.cache,transitions:an.transitions},K.updateQueue.baseState=At,K.memoizedState=At,K.flags&256){$e=Error(a(423)),K=ix(J,K,ke,be,$e);break e}else if(ke!==$e){$e=Error(a(424)),K=ix(J,K,ke,be,$e);break e}else for(le&&(va=Ct(K.stateNode.containerInfo),Bu=K,Ha=!0,dd=null,iu=!1),be=q7(K,null,ke,be),K.child=be;be;)be.flags=be.flags&-3|4096,be=be.sibling;else{if(o9(),ke===$e){K=Ns(J,K,be);break e}Ws(J,K,ke,be)}K=K.child}return K;case 5:return mT(K),J===null&&I4(K),ke=K.type,$e=K.pendingProps,At=J!==null?J.memoizedProps:null,an=$e.children,oe(ke,$e)?an=null:At!==null&&oe(ke,At)&&(K.flags|=32),rx(J,K),Ws(J,K,an,be),K.child;case 6:return J===null&&I4(K),null;case 13:return ax(J,K,be);case 4:return m6(K,K.stateNode.containerInfo),ke=K.pendingProps,J===null?K.child=zm(K,null,ke,be):Ws(J,K,ke,be),K.child;case 11:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),nx(J,K,ke,$e,be);case 7:return Ws(J,K,K.pendingProps,be),K.child;case 8:return Ws(J,K,K.pendingProps.children,be),K.child;case 12:return Ws(J,K,K.pendingProps.children,be),K.child;case 10:e:{if(ke=K.type._context,$e=K.pendingProps,At=K.memoizedProps,an=$e.value,en(K,ke,an),At!==null)if(Cs(At.value,an)){if(At.children===$e.children&&!Dt.current){K=Ns(J,K,be);break e}}else for(At=K.child,At!==null&&(At.return=K);At!==null;){var Hn=At.dependencies;if(Hn!==null){an=At.child;for(var io=Hn.firstContext;io!==null;){if(io.context===ke){if(At.tag===1){io=go(-1,be&-be),io.tag=2;var Xo=At.updateQueue;if(Xo!==null){Xo=Xo.shared;var Er=Xo.pending;Er===null?io.next=io:(io.next=Er.next,Er.next=io),Xo.pending=io}}At.lanes|=be,io=At.alternate,io!==null&&(io.lanes|=be),dn(At.return,be,K),Hn.lanes|=be;break}io=io.next}}else if(At.tag===10)an=At.type===K.type?null:At.child;else if(At.tag===18){if(an=At.return,an===null)throw Error(a(341));an.lanes|=be,Hn=an.alternate,Hn!==null&&(Hn.lanes|=be),dn(an,be,K),an=At.sibling}else an=At.child;if(an!==null)an.return=At;else for(an=At;an!==null;){if(an===K){an=null;break}if(At=an.sibling,At!==null){At.return=an.return,an=At;break}an=an.return}At=an}Ws(J,K,$e.children,be),K=K.child}return K;case 9:return $e=K.type,ke=K.pendingProps.children,En(K,be),$e=xn($e),ke=ke($e),K.flags|=1,Ws(J,K,ke,be),K.child;case 14:return ke=K.type,$e=Wn(ke,K.pendingProps),$e=Wn(ke.type,$e),ox(J,K,ke,$e,be);case 15:return wT(J,K,K.type,K.pendingProps,be);case 17:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),K.tag=1,yo(ke)?(J=!0,wo(K)):J=!1,En(K,be),ud(K,ke,$e),Xh(K,ke,$e,be),F4(null,K,ke,!0,J,be);case 19:return bT(J,K,be);case 22:return xT(J,K,be)}throw Error(a(156,K.tag))};function Kf(J,K){return ea(J,K)}function P2(J,K,be,ke){this.tag=J,this.key=be,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=K,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=ke,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function u0(J,K,be,ke){return new P2(J,K,be,ke)}function b9(J){return J=J.prototype,!(!J||!J.isReactComponent)}function CT(J){if(typeof J=="function")return b9(J)?1:0;if(J!=null){if(J=J.$$typeof,J===y)return 11;if(J===C)return 14}return 2}function lp(J,K){var be=J.alternate;return be===null?(be=u0(J.tag,K,J.key,J.mode),be.elementType=J.elementType,be.type=J.type,be.stateNode=J.stateNode,be.alternate=J,J.alternate=be):(be.pendingProps=K,be.type=J.type,be.flags=0,be.subtreeFlags=0,be.deletions=null),be.flags=J.flags&14680064,be.childLanes=J.childLanes,be.lanes=J.lanes,be.child=J.child,be.memoizedProps=J.memoizedProps,be.memoizedState=J.memoizedState,be.updateQueue=J.updateQueue,K=J.dependencies,be.dependencies=K===null?null:{lanes:K.lanes,firstContext:K.firstContext},be.sibling=J.sibling,be.index=J.index,be.ref=J.ref,be}function F6(J,K,be,ke,$e,At){var an=2;if(ke=J,typeof J=="function")b9(J)&&(an=1);else if(typeof J=="string")an=5;else e:switch(J){case u:return pg(be.children,$e,At,K);case d:an=8,$e|=8;break;case f:return J=u0(12,be,K,$e|2),J.elementType=f,J.lanes=At,J;case w:return J=u0(13,be,K,$e),J.elementType=w,J.lanes=At,J;case x:return J=u0(19,be,K,$e),J.elementType=x,J.lanes=At,J;case A:return Gm(be,$e,At,K);default:if(typeof J=="object"&&J!==null)switch(J.$$typeof){case p:an=10;break e;case m:an=9;break e;case y:an=11;break e;case C:an=14;break e;case P:an=16,ke=null;break e}throw Error(a(130,J==null?J:typeof J,""))}return K=u0(an,be,K,$e),K.elementType=J,K.type=ke,K.lanes=At,K}function pg(J,K,be,ke){return J=u0(7,J,ke,K),J.lanes=be,J}function Gm(J,K,be,ke){return J=u0(22,J,ke,K),J.elementType=A,J.lanes=be,J.stateNode={},J}function jc(J,K,be){return J=u0(6,J,null,K),J.lanes=be,J}function qd(J,K,be){return K=u0(4,J.children!==null?J.children:[],J.key,K),K.lanes=be,K.stateNode={containerInfo:J.containerInfo,pendingChildren:null,implementation:J.implementation},K}function O4(J,K,be,ke,$e){this.tag=K,this.containerInfo=J,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Z,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=bo(0),this.expirationTimes=bo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bo(0),this.identifierPrefix=ke,this.onRecoverableError=$e,le&&(this.mutableSourceEagerHydrationData=null)}function _4(J,K,be,ke,$e,At,an,Hn,io){return J=new O4(J,K,be,Hn,io),K===1?(K=1,At===!0&&(K|=8)):K=0,At=u0(3,null,null,K),J.current=At,At.stateNode=J,At.memoizedState={element:ke,isDehydrated:be,cache:null,transitions:null},Vn(At),J}function L6(J){if(!J)return fo;J=J._reactInternals;e:{if(R(J)!==J||J.tag!==1)throw Error(a(170));var K=J;do{switch(K.tag){case 3:K=K.stateNode.context;break e;case 1:if(yo(K.type)){K=K.stateNode.__reactInternalMemoizedMergedChildContext;break e}}K=K.return}while(K!==null);throw Error(a(171))}if(J.tag===1){var be=J.type;if(yo(be))return xo(J,be,K)}return K}function C2(J){var K=J._reactInternals;if(K===void 0)throw typeof J.render=="function"?Error(a(188)):(J=Object.keys(J).join(","),Error(a(268,J)));return J=k(K),J===null?null:J.stateNode}function S9(J,K){if(J=J.memoizedState,J!==null&&J.dehydrated!==null){var be=J.retryLane;J.retryLane=be!==0&&be=Xo&&At>=Ei&&$e<=Er&&an<=ni){J.splice(K,1);break}else if(ke!==Xo||be.width!==io.width||nian){if(!(At!==Ei||be.height!==io.height||Er$e)){Xo>ke&&(io.width+=Xo-ke,io.x=ke),Er<$e&&(io.width=$e-Xo),J.splice(K,1);break}}else{Ei>At&&(io.height+=Ei-At,io.y=At),nibe&&(be=an)),anS2&&(K.flags|=128,ke=!0,Ou($e,!1),K.lanes=4194304)}else{if(!ke)if(J=lo(At),J!==null){if(K.flags|=128,ke=!0,J=J.updateQueue,J!==null&&(K.updateQueue=J,K.flags|=4),Ou($e,!0),$e.tail===null&&$e.tailMode==="hidden"&&!At.alternate&&!Ha)return gi(K),null}else 2*cr()-$e.renderingStartTime>S2&&be!==1073741824&&(K.flags|=128,ke=!0,Ou($e,!1),K.lanes=4194304);$e.isBackwards?(At.sibling=K.child,K.child=At):(J=$e.last,J!==null?J.sibling=At:K.child=At,$e.last=At)}return $e.tail!==null?(K=$e.tail,$e.rendering=K,$e.tail=K.sibling,$e.renderingStartTime=cr(),K.sibling=null,J=vn.current,Pn(vn,ke?J&1|2:J&1),K):(gi(K),null);case 22:case 23:return v9(),ke=K.memoizedState!==null,J!==null&&J.memoizedState!==null!==ke&&(K.flags|=8192),ke&&K.mode&1?_u&1073741824&&(gi(K),te&&K.subtreeFlags&6&&(K.flags|=8192)):gi(K),null;case 24:return null;case 25:return null}throw Error(a(156,K.tag))}var rz=l.ReactCurrentOwner,Gd=!1;function Ws(J,K,be,ke){K.child=J===null?q7(K,null,be,ke):zm(K,J.child,be,ke)}function nx(J,K,be,ke,$e){be=be.render;var At=K.ref;return En(K,$e),ke=aa(J,K,be,ke,At,$e),be=z4(),J!==null&&!Gd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~$e,Ns(J,K,$e)):(Ha&&be&&Im(K),K.flags|=1,Ws(J,K,ke,$e),K.child)}function ox(J,K,be,ke,$e){if(J===null){var At=be.type;return typeof At=="function"&&!b9(At)&&At.defaultProps===void 0&&be.compare===null&&be.defaultProps===void 0?(K.tag=15,K.type=At,wT(J,K,At,ke,$e)):(J=F6(be.type,null,ke,K,K.mode,$e),J.ref=K.ref,J.return=K,K.child=J)}if(At=J.child,!(J.lanes&$e)){var an=At.memoizedProps;if(be=be.compare,be=be!==null?be:wn,be(an,ke)&&J.ref===K.ref)return Ns(J,K,$e)}return K.flags|=1,J=lp(At,ke),J.ref=K.ref,J.return=K,K.child=J}function wT(J,K,be,ke,$e){if(J!==null&&wn(J.memoizedProps,ke)&&J.ref===K.ref)if(Gd=!1,(J.lanes&$e)!==0)J.flags&131072&&(Gd=!0);else return K.lanes=J.lanes,Ns(J,K,$e);return Zh(J,K,be,ke,$e)}function xT(J,K,be){var ke=K.pendingProps,$e=ke.children,At=J!==null?J.memoizedState:null;if(ke.mode==="hidden")if(!(K.mode&1))K.memoizedState={baseLanes:0,cachePool:null},Pn(gd,_u),_u|=be;else if(be&1073741824)K.memoizedState={baseLanes:0,cachePool:null},ke=At!==null?At.baseLanes:be,Pn(gd,_u),_u|=ke;else return J=At!==null?At.baseLanes|be:be,K.lanes=K.childLanes=1073741824,K.memoizedState={baseLanes:J,cachePool:null},K.updateQueue=null,Pn(gd,_u),_u|=J,null;else At!==null?(ke=At.baseLanes|be,K.memoizedState=null):ke=be,Pn(gd,_u),_u|=ke;return Ws(J,K,$e,be),K.child}function rx(J,K){var be=K.ref;(J===null&&be!==null||J!==null&&J.ref!==be)&&(K.flags|=512,K.flags|=2097152)}function Zh(J,K,be,ke,$e){var At=yo(be)?fn:to.current;return At=kn(K,At),En(K,$e),be=aa(J,K,be,ke,At,$e),ke=z4(),J!==null&&!Gd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~$e,Ns(J,K,$e)):(Ha&&ke&&Im(K),K.flags|=1,Ws(J,K,be,$e),K.child)}function vT(J,K,be,ke,$e){if(yo(be)){var At=!0;wo(K)}else At=!1;if(En(K,$e),K.stateNode===null)J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),ud(K,be,ke),Xh(K,be,ke,$e),ke=!0;else if(J===null){var an=K.stateNode,Hn=K.memoizedProps;an.props=Hn;var io=an.context,Xo=be.contextType;typeof Xo=="object"&&Xo!==null?Xo=xn(Xo):(Xo=yo(be)?fn:to.current,Xo=kn(K,Xo));var Er=be.getDerivedStateFromProps,Ei=typeof Er=="function"||typeof an.getSnapshotBeforeUpdate=="function";Ei||typeof an.UNSAFE_componentWillReceiveProps!="function"&&typeof an.componentWillReceiveProps!="function"||(Hn!==ke||io!==Xo)&&Mm(K,an,ke,Xo),_n=!1;var ni=K.memoizedState;an.state=ni,na(K,ke,an,$e),io=K.memoizedState,Hn!==ke||ni!==io||Dt.current||_n?(typeof Er=="function"&&(cc(K,be,Er,ke),io=K.memoizedState),(Hn=_n||ps(K,be,Hn,ke,ni,io,Xo))?(Ei||typeof an.UNSAFE_componentWillMount!="function"&&typeof an.componentWillMount!="function"||(typeof an.componentWillMount=="function"&&an.componentWillMount(),typeof an.UNSAFE_componentWillMount=="function"&&an.UNSAFE_componentWillMount()),typeof an.componentDidMount=="function"&&(K.flags|=4194308)):(typeof an.componentDidMount=="function"&&(K.flags|=4194308),K.memoizedProps=ke,K.memoizedState=io),an.props=ke,an.state=io,an.context=Xo,ke=Hn):(typeof an.componentDidMount=="function"&&(K.flags|=4194308),ke=!1)}else{an=K.stateNode,Gn(J,K),Hn=K.memoizedProps,Xo=K.type===K.elementType?Hn:Wn(K.type,Hn),an.props=Xo,Ei=K.pendingProps,ni=an.context,io=be.contextType,typeof io=="object"&&io!==null?io=xn(io):(io=yo(be)?fn:to.current,io=kn(K,io));var Fl=be.getDerivedStateFromProps;(Er=typeof Fl=="function"||typeof an.getSnapshotBeforeUpdate=="function")||typeof an.UNSAFE_componentWillReceiveProps!="function"&&typeof an.componentWillReceiveProps!="function"||(Hn!==Ei||ni!==io)&&Mm(K,an,ke,io),_n=!1,ni=K.memoizedState,an.state=ni,na(K,ke,an,$e);var Jr=K.memoizedState;Hn!==Ei||ni!==Jr||Dt.current||_n?(typeof Fl=="function"&&(cc(K,be,Fl,ke),Jr=K.memoizedState),(Xo=_n||ps(K,be,Xo,ke,ni,Jr,io)||!1)?(Er||typeof an.UNSAFE_componentWillUpdate!="function"&&typeof an.componentWillUpdate!="function"||(typeof an.componentWillUpdate=="function"&&an.componentWillUpdate(ke,Jr,io),typeof an.UNSAFE_componentWillUpdate=="function"&&an.UNSAFE_componentWillUpdate(ke,Jr,io)),typeof an.componentDidUpdate=="function"&&(K.flags|=4),typeof an.getSnapshotBeforeUpdate=="function"&&(K.flags|=1024)):(typeof an.componentDidUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=4),typeof an.getSnapshotBeforeUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=1024),K.memoizedProps=ke,K.memoizedState=Jr),an.props=ke,an.state=Jr,an.context=io,ke=Xo):(typeof an.componentDidUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=4),typeof an.getSnapshotBeforeUpdate!="function"||Hn===J.memoizedProps&&ni===J.memoizedState||(K.flags|=1024),ke=!1)}return F4(J,K,be,ke,At,$e)}function F4(J,K,be,ke,$e,At){rx(J,K);var an=(K.flags&128)!==0;if(!ke&&!an)return $e&&Rr(K,be,!1),Ns(J,K,At);ke=K.stateNode,rz.current=K;var Hn=an&&typeof be.getDerivedStateFromError!="function"?null:ke.render();return K.flags|=1,J!==null&&an?(K.child=zm(K,J.child,null,At),K.child=zm(K,null,Hn,At)):Ws(J,K,Hn,At),K.memoizedState=ke.state,$e&&Rr(K,be,!0),K.child}function S6(J){var K=J.stateNode;K.pendingContext?lr(J,K.pendingContext,K.pendingContext!==K.context):K.context&&lr(J,K.context,!1),m6(J,K.containerInfo)}function ix(J,K,be,ke,$e){return o9(),g6($e),K.flags|=256,Ws(J,K,be,ke),K.child}var T6={dehydrated:null,treeContext:null,retryLane:0};function fd(J){return{baseLanes:J,cachePool:null}}function ax(J,K,be){var ke=K.pendingProps,$e=vn.current,At=!1,an=(K.flags&128)!==0,Hn;if((Hn=an)||(Hn=J!==null&&J.memoizedState===null?!1:($e&2)!==0),Hn?(At=!0,K.flags&=-129):(J===null||J.memoizedState!==null)&&($e|=1),Pn(vn,$e&1),J===null)return I4(K),J=K.memoizedState,J!==null&&(J=J.dehydrated,J!==null)?(K.mode&1?Pt(J)?K.lanes=8:K.lanes=1073741824:K.lanes=1,null):($e=ke.children,J=ke.fallback,At?(ke=K.mode,At=K.child,$e={mode:"hidden",children:$e},!(ke&1)&&At!==null?(At.childLanes=0,At.pendingProps=$e):At=Gm($e,ke,0,null),J=pg(J,ke,be,null),At.return=K,J.return=K,At.sibling=J,K.child=At,K.child.memoizedState=fd(be),K.memoizedState=T6,J):lx(K,$e));if($e=J.memoizedState,$e!==null){if(Hn=$e.dehydrated,Hn!==null){if(an)return K.flags&256?(K.flags&=-257,P6(J,K,be,Error(a(422)))):K.memoizedState!==null?(K.child=J.child,K.flags|=128,null):(At=ke.fallback,$e=K.mode,ke=Gm({mode:"visible",children:ke.children},$e,0,null),At=pg(At,$e,be,null),At.flags|=2,ke.return=K,At.return=K,ke.sibling=At,K.child=ke,K.mode&1&&zm(K,J.child,null,be),K.child.memoizedState=fd(be),K.memoizedState=T6,At);if(!(K.mode&1))K=P6(J,K,be,null);else if(Pt(Hn))K=P6(J,K,be,Error(a(419)));else if(ke=(be&J.childLanes)!==0,Gd||ke){if(ke=Gs,ke!==null){switch(be&-be){case 4:At=2;break;case 16:At=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:At=32;break;case 536870912:At=268435456;break;default:At=0}ke=At&(ke.suspendedLanes|be)?0:At,ke!==0&&ke!==$e.retryLane&&($e.retryLane=ke,Kd(J,ke,-1))}_m(),K=P6(J,K,be,Error(a(421)))}else St(Hn)?(K.flags|=128,K.child=J.child,K=Jf.bind(null,J),Yt(Hn,K),K=null):(be=$e.treeContext,le&&(va=yt(Hn),Bu=K,Ha=!0,dd=null,iu=!1,be!==null&&(a0[ou++]=F0,a0[ou++]=Uf,a0[ou++]=Zp,F0=be.id,Uf=be.overflow,Zp=K)),K=lx(K,K.pendingProps.children),K.flags|=4096);return K}return At?(ke=cx(J,K,ke.children,ke.fallback,be),At=K.child,$e=J.child.memoizedState,At.memoizedState=$e===null?fd(be):{baseLanes:$e.baseLanes|be,cachePool:null},At.childLanes=J.childLanes&~be,K.memoizedState=T6,ke):(be=sx(J,K,ke.children,be),K.memoizedState=null,be)}return At?(ke=cx(J,K,ke.children,ke.fallback,be),At=K.child,$e=J.child.memoizedState,At.memoizedState=$e===null?fd(be):{baseLanes:$e.baseLanes|be,cachePool:null},At.childLanes=J.childLanes&~be,K.memoizedState=T6,ke):(be=sx(J,K,ke.children,be),K.memoizedState=null,be)}function lx(J,K){return K=Gm({mode:"visible",children:K},J.mode,0,null),K.return=J,J.child=K}function sx(J,K,be,ke){var $e=J.child;return J=$e.sibling,be=lp($e,{mode:"visible",children:be}),!(K.mode&1)&&(be.lanes=ke),be.return=K,be.sibling=null,J!==null&&(ke=K.deletions,ke===null?(K.deletions=[J],K.flags|=16):ke.push(J)),K.child=be}function cx(J,K,be,ke,$e){var At=K.mode;J=J.child;var an=J.sibling,Hn={mode:"hidden",children:be};return!(At&1)&&K.child!==J?(be=K.child,be.childLanes=0,be.pendingProps=Hn,K.deletions=null):(be=lp(J,Hn),be.subtreeFlags=J.subtreeFlags&14680064),an!==null?ke=lp(an,ke):(ke=pg(ke,At,$e,null),ke.flags|=2),ke.return=K,be.return=K,be.sibling=ke,K.child=be,ke}function P6(J,K,be,ke){return ke!==null&&g6(ke),zm(K,J.child,null,be),J=lx(K,K.pendingProps.children),J.flags|=2,K.memoizedState=null,J}function cg(J,K,be){J.lanes|=K;var ke=J.alternate;ke!==null&&(ke.lanes|=K),dn(J.return,K,be)}function h9(J,K,be,ke,$e){var At=J.memoizedState;At===null?J.memoizedState={isBackwards:K,rendering:null,renderingStartTime:0,last:ke,tail:be,tailMode:$e}:(At.isBackwards=K,At.rendering=null,At.renderingStartTime=0,At.last=ke,At.tail=be,At.tailMode=$e)}function bT(J,K,be){var ke=K.pendingProps,$e=ke.revealOrder,At=ke.tail;if(Ws(J,K,ke.children,be),ke=vn.current,ke&2)ke=ke&1|2,K.flags|=128;else{if(J!==null&&J.flags&128)e:for(J=K.child;J!==null;){if(J.tag===13)J.memoizedState!==null&&cg(J,be,K);else if(J.tag===19)cg(J,be,K);else if(J.child!==null){J.child.return=J,J=J.child;continue}if(J===K)break e;for(;J.sibling===null;){if(J.return===null||J.return===K)break e;J=J.return}J.sibling.return=J.return,J=J.sibling}ke&=1}if(Pn(vn,ke),!(K.mode&1))K.memoizedState=null;else switch($e){case"forwards":for(be=K.child,$e=null;be!==null;)J=be.alternate,J!==null&&lo(J)===null&&($e=be),be=be.sibling;be=$e,be===null?($e=K.child,K.child=null):($e=be.sibling,be.sibling=null),h9(K,!1,$e,be,At);break;case"backwards":for(be=null,$e=K.child,K.child=null;$e!==null;){if(J=$e.alternate,J!==null&&lo(J)===null){K.child=$e;break}J=$e.sibling,$e.sibling=be,be=$e,$e=J}h9(K,!0,be,null,At);break;case"together":h9(K,!1,null,null,void 0);break;default:K.memoizedState=null}return K.child}function Ns(J,K,be){if(J!==null&&(K.dependencies=J.dependencies),Nm|=K.lanes,!(be&K.childLanes))return null;if(J!==null&&K.child!==J.child)throw Error(a(153));if(K.child!==null){for(J=K.child,be=lp(J,J.pendingProps),K.child=be,be.return=K;J.sibling!==null;)J=J.sibling,be=be.sibling=lp(J,J.pendingProps),be.return=K;be.sibling=null}return K.child}function iz(J,K,be){switch(K.tag){case 3:S6(K),o9();break;case 5:mT(K);break;case 1:yo(K.type)&&wo(K);break;case 4:m6(K,K.stateNode.containerInfo);break;case 10:en(K,K.type._context,K.memoizedProps.value);break;case 13:var ke=K.memoizedState;if(ke!==null)return ke.dehydrated!==null?(Pn(vn,vn.current&1),K.flags|=128,null):be&K.child.childLanes?ax(J,K,be):(Pn(vn,vn.current&1),J=Ns(J,K,be),J!==null?J.sibling:null);Pn(vn,vn.current&1);break;case 19:if(ke=(be&K.childLanes)!==0,J.flags&128){if(ke)return bT(J,K,be);K.flags|=128}var $e=K.memoizedState;if($e!==null&&($e.rendering=null,$e.tail=null,$e.lastEffect=null),Pn(vn,vn.current),ke)break;return null;case 22:case 23:return K.lanes=0,xT(J,K,be)}return Ns(J,K,be)}function az(J,K){switch(ru(K),K.tag){case 1:return yo(K.type)&&ur(),J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 3:return g2(),rn(Dt),rn(to),Ir(),J=K.flags,J&65536&&!(J&128)?(K.flags=J&-65537|128,K):null;case 5:return Q1(K),null;case 13:if(rn(vn),J=K.memoizedState,J!==null&&J.dehydrated!==null){if(K.alternate===null)throw Error(a(340));o9()}return J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 19:return rn(vn),null;case 4:return g2(),null;case 10:return sn(K.type._context),null;case 22:case 23:return v9(),null;case 24:return null;default:return null}}var L4=!1,o1=!1,W4=typeof WeakSet=="function"?WeakSet:Set,wr=null;function p9(J,K){var be=J.ref;if(be!==null)if(typeof be=="function")try{be(null)}catch(ke){Vu(J,K,ke)}else be.current=null}function g9(J,K,be){try{be()}catch(ke){Vu(J,K,ke)}}var N4=!1;function C6(J,K){for(j(J.containerInfo),wr=K;wr!==null;)if(J=wr,K=J.child,(J.subtreeFlags&1028)!==0&&K!==null)K.return=J,wr=K;else for(;wr!==null;){J=wr;try{var be=J.alternate;if(J.flags&1024)switch(J.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var ke=be.memoizedProps,$e=be.memoizedState,At=J.stateNode,an=At.getSnapshotBeforeUpdate(J.elementType===J.type?ke:Wn(J.type,ke),$e);At.__reactInternalSnapshotBeforeUpdate=an}break;case 3:te&&ut(J.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(Hn){Vu(J,J.return,Hn)}if(K=J.sibling,K!==null){K.return=J.return,wr=K;break}wr=J.return}return be=N4,N4=!1,be}function Of(J,K,be){var ke=K.updateQueue;if(ke=ke!==null?ke.lastEffect:null,ke!==null){var $e=ke=ke.next;do{if(($e.tag&J)===J){var At=$e.destroy;$e.destroy=void 0,At!==void 0&&g9(K,be,At)}$e=$e.next}while($e!==ke)}}function r1(J,K){if(K=K.updateQueue,K=K!==null?K.lastEffect:null,K!==null){var be=K=K.next;do{if((be.tag&J)===J){var ke=be.create;be.destroy=ke()}be=be.next}while(be!==K)}}function U4(J){var K=J.ref;if(K!==null){var be=J.stateNode;switch(J.tag){case 5:J=F(be);break;default:J=be}typeof K=="function"?K(J):K.current=J}}function R6(J,K,be){if(sc&&typeof sc.onCommitFiberUnmount=="function")try{sc.onCommitFiberUnmount(_s,K)}catch{}switch(K.tag){case 0:case 11:case 14:case 15:if(J=K.updateQueue,J!==null&&(J=J.lastEffect,J!==null)){var ke=J=J.next;do{var $e=ke,At=$e.destroy;$e=$e.tag,At!==void 0&&($e&2||$e&4)&&g9(K,be,At),ke=ke.next}while(ke!==J)}break;case 1:if(p9(K,be),J=K.stateNode,typeof J.componentWillUnmount=="function")try{J.props=K.memoizedProps,J.state=K.memoizedState,J.componentWillUnmount()}catch(an){Vu(K,be,an)}break;case 5:p9(K,be);break;case 4:te?w2(J,K,be):q&&q&&(K=K.stateNode.containerInfo,be=Qe(K),tt(K,be))}}function ep(J,K,be){for(var ke=K;;)if(R6(J,ke,be),ke.child===null||te&&ke.tag===4){if(ke===K)break;for(;ke.sibling===null;){if(ke.return===null||ke.return===K)return;ke=ke.return}ke.sibling.return=ke.return,ke=ke.sibling}else ke.child.return=ke,ke=ke.child}function tp(J){var K=J.alternate;K!==null&&(J.alternate=null,tp(K)),J.child=null,J.deletions=null,J.sibling=null,J.tag===5&&(K=J.stateNode,K!==null&&ce(K)),J.stateNode=null,J.return=null,J.dependencies=null,J.memoizedProps=null,J.memoizedState=null,J.pendingProps=null,J.stateNode=null,J.updateQueue=null}function H6(J){return J.tag===5||J.tag===3||J.tag===4}function ug(J){e:for(;;){for(;J.sibling===null;){if(J.return===null||H6(J.return))return null;J=J.return}for(J.sibling.return=J.return,J=J.sibling;J.tag!==5&&J.tag!==6&&J.tag!==18;){if(J.flags&2||J.child===null||J.tag===4)continue e;J.child.return=J,J=J.child}if(!(J.flags&2))return J.stateNode}}function hd(J){if(te){e:{for(var K=J.return;K!==null;){if(H6(K))break e;K=K.return}throw Error(a(160))}var be=K;switch(be.tag){case 5:K=be.stateNode,be.flags&32&&(He(K),be.flags&=-33),be=ug(J),A2(J,be,K);break;case 3:case 4:K=be.stateNode.containerInfo,be=ug(J),j4(J,be,K);break;default:throw Error(a(161))}}}function j4(J,K,be){var ke=J.tag;if(ke===5||ke===6)J=J.stateNode,K?Ue(be,J,K):Ce(be,J);else if(ke!==4&&(J=J.child,J!==null))for(j4(J,K,be),J=J.sibling;J!==null;)j4(J,K,be),J=J.sibling}function A2(J,K,be){var ke=J.tag;if(ke===5||ke===6)J=J.stateNode,K?_e(be,J,K):Me(be,J);else if(ke!==4&&(J=J.child,J!==null))for(A2(J,K,be),J=J.sibling;J!==null;)A2(J,K,be),J=J.sibling}function w2(J,K,be){for(var ke=K,$e=!1,At,an;;){if(!$e){$e=ke.return;e:for(;;){if($e===null)throw Error(a(160));switch(At=$e.stateNode,$e.tag){case 5:an=!1;break e;case 3:At=At.containerInfo,an=!0;break e;case 4:At=At.containerInfo,an=!0;break e}$e=$e.return}$e=!0}if(ke.tag===5||ke.tag===6)ep(J,ke,be),an?Fe(At,ke.stateNode):qe(At,ke.stateNode);else if(ke.tag===18)an?it(At,ke.stateNode):ot(At,ke.stateNode);else if(ke.tag===4){if(ke.child!==null){At=ke.stateNode.containerInfo,an=!0,ke.child.return=ke,ke=ke.child;continue}}else if(R6(J,ke,be),ke.child!==null){ke.child.return=ke,ke=ke.child;continue}if(ke===K)break;for(;ke.sibling===null;){if(ke.return===null||ke.return===K)return;ke=ke.return,ke.tag===4&&($e=!1)}ke.sibling.return=ke.return,ke=ke.sibling}}function i1(J,K){if(te){switch(K.tag){case 0:case 11:case 14:case 15:Of(3,K,K.return),r1(3,K),Of(5,K,K.return);return;case 1:return;case 5:var be=K.stateNode;if(be!=null){var ke=K.memoizedProps;J=J!==null?J.memoizedProps:ke;var $e=K.type,At=K.updateQueue;K.updateQueue=null,At!==null&&Ne(be,At,$e,J,ke,K)}return;case 6:if(K.stateNode===null)throw Error(a(162));be=K.memoizedProps,Te(K.stateNode,J!==null?J.memoizedProps:be,be);return;case 3:le&&J!==null&&J.memoizedState.isDehydrated&&st(K.stateNode.containerInfo);return;case 12:return;case 13:s0(K);return;case 19:s0(K);return;case 17:return}throw Error(a(163))}switch(K.tag){case 0:case 11:case 14:case 15:Of(3,K,K.return),r1(3,K),Of(5,K,K.return);return;case 12:return;case 13:s0(K);return;case 19:s0(K);return;case 3:le&&J!==null&&J.memoizedState.isDehydrated&&st(K.stateNode.containerInfo);break;case 22:case 23:return}e:if(q){switch(K.tag){case 1:case 5:case 6:break e;case 3:case 4:K=K.stateNode,tt(K.containerInfo,K.pendingChildren);break e}throw Error(a(163))}}function s0(J){var K=J.updateQueue;if(K!==null){J.updateQueue=null;var be=J.stateNode;be===null&&(be=J.stateNode=new W4),K.forEach(function(ke){var $e=k6.bind(null,J,ke);be.has(ke)||(be.add(ke),ke.then($e,$e))})}}function x2(J,K){for(wr=K;wr!==null;){K=wr;var be=K.deletions;if(be!==null)for(var ke=0;ke";case op:return":has("+(rp(J)||"")+")";case pd:return'[role="'+J.value+'"]';case Xd:return'"'+J.value+'"';case Tu:return'[data-testname="'+J.value+'"]';default:throw Error(a(365))}}function ux(J,K){var be=[];J=[J,0];for(var ke=0;ke$e&&($e=an),ke&=~At}if(ke=$e,ke=cr()-ke,ke=(120>ke?120:480>ke?480:1080>ke?1080:1920>ke?1920:3e3>ke?3e3:4320>ke?4320:1960*TT(ke/1960))-ke,10J?16:J,Gf===null)var ke=!1;else{if(J=Gf,Gf=null,w9=0,oa&6)throw Error(a(331));var $e=oa;for(oa|=4,wr=J.current;wr!==null;){var At=wr,an=At.child;if(wr.flags&16){var Hn=At.deletions;if(Hn!==null){for(var io=0;iocr()-fx?Xf(J,0):B4|=be),fi(J,K)}function mx(J,K){K===0&&(J.mode&1?(K=Wo,Wo<<=1,!(Wo&130023424)&&(Wo=4194304)):K=1);var be=Ru();J=Om(J,K),J!==null&&(Bo(J,K,be),fi(J,be))}function Jf(J){var K=J.memoizedState,be=0;K!==null&&(be=K.retryLane),mx(J,be)}function k6(J,K){var be=0;switch(J.tag){case 13:var ke=J.stateNode,$e=J.memoizedState;$e!==null&&(be=$e.retryLane);break;case 19:ke=J.stateNode;break;default:throw Error(a(314))}ke!==null&&ke.delete(K),mx(J,be)}var yx;yx=function(J,K,be){if(J!==null)if(J.memoizedProps!==K.pendingProps||Dt.current)Gd=!0;else{if(!(J.lanes&be)&&!(K.flags&128))return Gd=!1,iz(J,K,be);Gd=!!(J.flags&131072)}else Gd=!1,Ha&&K.flags&1048576&&q1(K,K1,K.index);switch(K.lanes=0,K.tag){case 2:var ke=K.type;J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps;var $e=kn(K,to.current);En(K,be),$e=aa(null,K,ke,J,$e,be);var At=z4();return K.flags|=1,typeof $e=="object"&&$e!==null&&typeof $e.render=="function"&&$e.$$typeof===void 0?(K.tag=1,K.memoizedState=null,K.updateQueue=null,yo(ke)?(At=!0,wo(K)):At=!1,K.memoizedState=$e.state!==null&&$e.state!==void 0?$e.state:null,Vn(K),$e.updater=wu,K.stateNode=$e,$e._reactInternals=K,Xh(K,ke,J,be),K=F4(null,K,ke,!0,At,be)):(K.tag=0,Ha&&At&&Im(K),Ws(null,K,$e,be),K=K.child),K;case 16:ke=K.elementType;e:{switch(J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps,$e=ke._init,ke=$e(ke._payload),K.type=ke,$e=K.tag=CT(ke),J=Wn(ke,J),$e){case 0:K=Zh(null,K,ke,J,be);break e;case 1:K=vT(null,K,ke,J,be);break e;case 11:K=nx(null,K,ke,J,be);break e;case 14:K=ox(null,K,ke,Wn(ke.type,J),be);break e}throw Error(a(306,ke,""))}return K;case 0:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),Zh(J,K,ke,$e,be);case 1:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),vT(J,K,ke,$e,be);case 3:e:{if(S6(K),J===null)throw Error(a(387));ke=K.pendingProps,At=K.memoizedState,$e=At.element,Gn(J,K),na(K,ke,null,be);var an=K.memoizedState;if(ke=an.element,le&&At.isDehydrated)if(At={element:ke,isDehydrated:!1,cache:an.cache,transitions:an.transitions},K.updateQueue.baseState=At,K.memoizedState=At,K.flags&256){$e=Error(a(423)),K=ix(J,K,ke,be,$e);break e}else if(ke!==$e){$e=Error(a(424)),K=ix(J,K,ke,be,$e);break e}else for(le&&(va=Ct(K.stateNode.containerInfo),Bu=K,Ha=!0,dd=null,iu=!1),be=q7(K,null,ke,be),K.child=be;be;)be.flags=be.flags&-3|4096,be=be.sibling;else{if(o9(),ke===$e){K=Ns(J,K,be);break e}Ws(J,K,ke,be)}K=K.child}return K;case 5:return mT(K),J===null&&I4(K),ke=K.type,$e=K.pendingProps,At=J!==null?J.memoizedProps:null,an=$e.children,oe(ke,$e)?an=null:At!==null&&oe(ke,At)&&(K.flags|=32),rx(J,K),Ws(J,K,an,be),K.child;case 6:return J===null&&I4(K),null;case 13:return ax(J,K,be);case 4:return m6(K,K.stateNode.containerInfo),ke=K.pendingProps,J===null?K.child=zm(K,null,ke,be):Ws(J,K,ke,be),K.child;case 11:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),nx(J,K,ke,$e,be);case 7:return Ws(J,K,K.pendingProps,be),K.child;case 8:return Ws(J,K,K.pendingProps.children,be),K.child;case 12:return Ws(J,K,K.pendingProps.children,be),K.child;case 10:e:{if(ke=K.type._context,$e=K.pendingProps,At=K.memoizedProps,an=$e.value,en(K,ke,an),At!==null)if(Cs(At.value,an)){if(At.children===$e.children&&!Dt.current){K=Ns(J,K,be);break e}}else for(At=K.child,At!==null&&(At.return=K);At!==null;){var Hn=At.dependencies;if(Hn!==null){an=At.child;for(var io=Hn.firstContext;io!==null;){if(io.context===ke){if(At.tag===1){io=go(-1,be&-be),io.tag=2;var Xo=At.updateQueue;if(Xo!==null){Xo=Xo.shared;var Er=Xo.pending;Er===null?io.next=io:(io.next=Er.next,Er.next=io),Xo.pending=io}}At.lanes|=be,io=At.alternate,io!==null&&(io.lanes|=be),dn(At.return,be,K),Hn.lanes|=be;break}io=io.next}}else if(At.tag===10)an=At.type===K.type?null:At.child;else if(At.tag===18){if(an=At.return,an===null)throw Error(a(341));an.lanes|=be,Hn=an.alternate,Hn!==null&&(Hn.lanes|=be),dn(an,be,K),an=At.sibling}else an=At.child;if(an!==null)an.return=At;else for(an=At;an!==null;){if(an===K){an=null;break}if(At=an.sibling,At!==null){At.return=an.return,an=At;break}an=an.return}At=an}Ws(J,K,$e.children,be),K=K.child}return K;case 9:return $e=K.type,ke=K.pendingProps.children,En(K,be),$e=xn($e),ke=ke($e),K.flags|=1,Ws(J,K,ke,be),K.child;case 14:return ke=K.type,$e=Wn(ke,K.pendingProps),$e=Wn(ke.type,$e),ox(J,K,ke,$e,be);case 15:return wT(J,K,K.type,K.pendingProps,be);case 17:return ke=K.type,$e=K.pendingProps,$e=K.elementType===ke?$e:Wn(ke,$e),J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),K.tag=1,yo(ke)?(J=!0,wo(K)):J=!1,En(K,be),ud(K,ke,$e),Xh(K,ke,$e,be),F4(null,K,ke,!0,J,be);case 19:return bT(J,K,be);case 22:return xT(J,K,be)}throw Error(a(156,K.tag))};function Kf(J,K){return ea(J,K)}function P2(J,K,be,ke){this.tag=J,this.key=be,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=K,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=ke,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function u0(J,K,be,ke){return new P2(J,K,be,ke)}function b9(J){return J=J.prototype,!(!J||!J.isReactComponent)}function CT(J){if(typeof J=="function")return b9(J)?1:0;if(J!=null){if(J=J.$$typeof,J===y)return 11;if(J===C)return 14}return 2}function lp(J,K){var be=J.alternate;return be===null?(be=u0(J.tag,K,J.key,J.mode),be.elementType=J.elementType,be.type=J.type,be.stateNode=J.stateNode,be.alternate=J,J.alternate=be):(be.pendingProps=K,be.type=J.type,be.flags=0,be.subtreeFlags=0,be.deletions=null),be.flags=J.flags&14680064,be.childLanes=J.childLanes,be.lanes=J.lanes,be.child=J.child,be.memoizedProps=J.memoizedProps,be.memoizedState=J.memoizedState,be.updateQueue=J.updateQueue,K=J.dependencies,be.dependencies=K===null?null:{lanes:K.lanes,firstContext:K.firstContext},be.sibling=J.sibling,be.index=J.index,be.ref=J.ref,be}function F6(J,K,be,ke,$e,At){var an=2;if(ke=J,typeof J=="function")b9(J)&&(an=1);else if(typeof J=="string")an=5;else e:switch(J){case u:return pg(be.children,$e,At,K);case d:an=8,$e|=8;break;case f:return J=u0(12,be,K,$e|2),J.elementType=f,J.lanes=At,J;case w:return J=u0(13,be,K,$e),J.elementType=w,J.lanes=At,J;case x:return J=u0(19,be,K,$e),J.elementType=x,J.lanes=At,J;case A:return Gm(be,$e,At,K);default:if(typeof J=="object"&&J!==null)switch(J.$$typeof){case p:an=10;break e;case m:an=9;break e;case y:an=11;break e;case C:an=14;break e;case P:an=16,ke=null;break e}throw Error(a(130,J==null?J:typeof J,""))}return K=u0(an,be,K,$e),K.elementType=J,K.type=ke,K.lanes=At,K}function pg(J,K,be,ke){return J=u0(7,J,ke,K),J.lanes=be,J}function Gm(J,K,be,ke){return J=u0(22,J,ke,K),J.elementType=A,J.lanes=be,J.stateNode={},J}function jc(J,K,be){return J=u0(6,J,null,K),J.lanes=be,J}function qd(J,K,be){return K=u0(4,J.children!==null?J.children:[],J.key,K),K.lanes=be,K.stateNode={containerInfo:J.containerInfo,pendingChildren:null,implementation:J.implementation},K}function O4(J,K,be,ke,$e){this.tag=K,this.containerInfo=J,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Z,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=bo(0),this.expirationTimes=bo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bo(0),this.identifierPrefix=ke,this.onRecoverableError=$e,le&&(this.mutableSourceEagerHydrationData=null)}function _4(J,K,be,ke,$e,At,an,Hn,io){return J=new O4(J,K,be,Hn,io),K===1?(K=1,At===!0&&(K|=8)):K=0,At=u0(3,null,null,K),J.current=At,At.stateNode=J,At.memoizedState={element:ke,isDehydrated:be,cache:null,transitions:null},Vn(At),J}function L6(J){if(!J)return fo;J=J._reactInternals;e:{if(R(J)!==J||J.tag!==1)throw Error(a(170));var K=J;do{switch(K.tag){case 3:K=K.stateNode.context;break e;case 1:if(yo(K.type)){K=K.stateNode.__reactInternalMemoizedMergedChildContext;break e}}K=K.return}while(K!==null);throw Error(a(171))}if(J.tag===1){var be=J.type;if(yo(be))return xo(J,be,K)}return K}function C2(J){var K=J._reactInternals;if(K===void 0)throw typeof J.render=="function"?Error(a(188)):(J=Object.keys(J).join(","),Error(a(268,J)));return J=k(K),J===null?null:J.stateNode}function S9(J,K){if(J=J.memoizedState,J!==null&&J.dehydrated!==null){var be=J.retryLane;J.retryLane=be!==0&&be=Xo&&At>=Ei&&$e<=Er&&an<=ni){J.splice(K,1);break}else if(ke!==Xo||be.width!==io.width||nian){if(!(At!==Ei||be.height!==io.height||Er$e)){Xo>ke&&(io.width+=Xo-ke,io.x=ke),Er<$e&&(io.width=$e-Xo),J.splice(K,1);break}}else{Ei>At&&(io.height+=Ei-At,io.y=At),nibe&&(be=an)),an ")+` No matching component was found for: - `)+J.join(" > ")}return null},n.getPublicRootInstance=function(J){if(J=J.current,!J.child)return null;switch(J.child.tag){case 5:return F(J.child.stateNode);default:return J.child.stateNode}},n.injectIntoDevTools=function(J){if(J={bundleType:J.bundleType,version:J.version,rendererPackageName:J.rendererPackageName,rendererConfig:J.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:lz,findFiberByHostInstance:J.findFiberByHostInstance||G4,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")J=!1;else{var K=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(K.isDisabled||!K.supportsFiber)J=!0;else{try{_s=K.inject(J),sc=K}catch{}J=!!K.checkDCE}}return J},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(J,K,be,ke){if(!Ie)throw Error(a(363));J=Lm(J,K);var $e=Se(J,be,ke).disconnect;return{disconnect:function(){$e()}}},n.registerMutableSourceForHydration=function(J,K){var be=K._getVersion;be=be(K._source),J.mutableSourceEagerHydrationData==null?J.mutableSourceEagerHydrationData=[K,be]:J.mutableSourceEagerHydrationData.push(K,be)},n.runWithPriority=function(J,K){var be=zo;try{return zo=J,K()}finally{zo=be}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(J,K,be,ke){var $e=K.current,At=Ru(),an=yd($e);return be=L6(be),K.context===null?K.context=be:K.pendingContext=be,K=go(At,an),K.payload={element:J},ke=ke===void 0?null:ke,ke!==null&&(K.callback=ke),qo($e,K),J=Kd($e,an,At),J!==null&&Xr(J,$e,an),an},n};F_e.exports=oxt;var rxt=F_e.exports;const ixt=ji(rxt),axt=t=>typeof t=="object"&&typeof t.then=="function",Wv=[];function N_e(t,e,n=(o,r)=>o===r){if(t===e)return!0;if(!t||!e)return!1;const o=t.length;if(e.length!==o)return!1;for(let r=0;r0&&(i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.remove,o.lifespan)),i.response;if(!n)throw i.promise}const r={keys:e,equal:o.equal,remove:()=>{const i=Wv.indexOf(r);i!==-1&&Wv.splice(i,1)},promise:(axt(t)?t:t(...e)).then(i=>{r.response=i,o.lifespan&&o.lifespan>0&&(r.timeout=setTimeout(r.remove,o.lifespan))}).catch(i=>r.error=i)};if(Wv.push(r),!n)throw r.promise}const j_e=(t,e,n)=>U_e(t,e,!1,n),lxt=(t,e,n)=>void U_e(t,e,!0,n),sxt=t=>{if(t===void 0||t.length===0)Wv.splice(0,Wv.length);else{const e=Wv.find(n=>N_e(t,n.keys,n.equal));e&&e.remove()}},F2e={},R7=t=>void Object.assign(F2e,t);function cxt(t,e){function n(u,{args:d=[],attach:f,...p},m){let y=`${u[0].toUpperCase()}${u.slice(1)}`,w;if(u==="primitive"){if(p.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const x=p.object;w=lC(x,{type:u,root:m,attach:f,primitive:!0})}else{const x=F2e[y];if(!x)throw new Error(`R3F: ${y} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");w=lC(new x(...d),{type:u,root:m,attach:f,memoizedProps:{args:d}})}return w.__r3f.attach===void 0&&(w instanceof Ni?w.__r3f.attach="geometry":w instanceof id&&(w.__r3f.attach="material")),y!=="inject"&&Nae(w,p),w}function o(u,d){let f=!1;if(d){var p,m;(p=d.__r3f)!=null&&p.attach?Wae(u,d,d.__r3f.attach):d.isObject3D&&u.isObject3D&&(u.add(d),f=!0),f||(m=u.__r3f)==null||m.objects.push(d),d.__r3f||lC(d,{}),d.__r3f.parent=u,Hde(d),sC(d)}}function r(u,d,f){let p=!1;if(d){var m,y;if((m=d.__r3f)!=null&&m.attach)Wae(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){d.parent=u,d.dispatchEvent({type:"added"});const w=u.children.filter(C=>C!==d),x=w.indexOf(f);u.children=[...w.slice(0,x),d,...w.slice(x)],p=!0}p||(y=u.__r3f)==null||y.objects.push(d),d.__r3f||lC(d,{}),d.__r3f.parent=u,Hde(d),sC(d)}}function i(u,d,f=!1){u&&[...u].forEach(p=>a(d,p,f))}function a(u,d,f){if(d){var p,m,y;if(d.__r3f&&(d.__r3f.parent=null),(p=u.__r3f)!=null&&p.objects&&(u.__r3f.objects=u.__r3f.objects.filter(A=>A!==d)),(m=d.__r3f)!=null&&m.attach)Gve(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){var w;u.remove(d),(w=d.__r3f)!=null&&w.root&&yxt(d.__r3f.root,d)}const C=(y=d.__r3f)==null?void 0:y.primitive,P=f===void 0?d.dispose!==null&&!C:f;if(!C){var x;i((x=d.__r3f)==null?void 0:x.objects,d,P),i(d.children,d,P)}delete d.__r3f,P&&d.dispose&&d.type!=="Scene"&&Cde.unstable_scheduleCallback(Cde.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),sC(u)}}function l(u,d,f,p){var m;const y=(m=u.__r3f)==null?void 0:m.parent;if(!y)return;const w=n(d,f,u.__r3f.root);if(u.children){for(const x of u.children)x.__r3f&&o(w,x);u.children=u.children.filter(x=>!x.__r3f)}u.__r3f.objects.forEach(x=>o(w,x)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||a(y,u),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),o(y,w),w.raycast&&w.__r3f.eventCount&&w.__r3f.root.getState().internal.interaction.push(w),[p,p.alternate].forEach(x=>{x!==null&&(x.stateNode=w,x.ref&&(typeof x.ref=="function"?x.ref(w):x.ref.current=w))})}const s=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:ixt({createInstance:n,removeChild:a,appendChild:o,appendInitialChild:o,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,d)=>{if(!d)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,o(f,d))},removeChildFromContainer:(u,d)=>{d&&a(u.getState().scene,d)},insertInContainerBefore:(u,d,f)=>{if(!d||!f)return;const p=u.getState().scene;p.__r3f&&r(p,d,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var d;return!!((d=u==null?void 0:u.__r3f)!=null?d:{}).handlers},prepareUpdate(u,d,f,p){var m;if(((m=u==null?void 0:u.__r3f)!=null?m:{}).primitive&&p.object&&p.object!==u)return[!0];{const{args:w=[],children:x,...C}=p,{args:P=[],children:A,...S}=f;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((b,T)=>b!==P[T]))return[!0];const v=X_e(u,C,S,!0);return v.changes.length?[!1,v]:null}},commitUpdate(u,[d,f],p,m,y,w){d?l(u,p,y,w):Nae(u,f)},commitMount(u,d,f,p){var m;const y=(m=u.__r3f)!=null?m:{};u.raycast&&y.handlers&&y.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>lC(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var d;const{attach:f,parent:p}=(d=u.__r3f)!=null?d:{};f&&p&&Gve(p,u,f),u.isObject3D&&(u.visible=!1),sC(u)},unhideInstance(u,d){var f;const{attach:p,parent:m}=(f=u.__r3f)!=null?f:{};p&&m&&Wae(m,u,p),(u.isObject3D&&d.visible==null||d.visible)&&(u.visible=!0),sC(u)},createTextInstance:s,hideTextInstance:s,unhideTextInstance:s,getCurrentEventPriority:()=>e?e():qC.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Sc.fun(performance.now)?performance.now:Sc.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Sc.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Sc.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Nae}}var Yve,Ove;const Lae=t=>"colorSpace"in t||"outputColorSpace"in t,B_e=()=>{var t;return(t=F2e.ColorManagement)!=null?t:null},Y_e=t=>t&&t.isOrthographicCamera,uxt=t=>t&&t.hasOwnProperty("current"),WM=typeof window<"u"&&((Yve=window.document)!=null&&Yve.createElement||((Ove=window.navigator)==null?void 0:Ove.product)==="ReactNative")?g.useLayoutEffect:g.useEffect;function O_e(t){const e=g.useRef(t);return WM(()=>void(e.current=t),[t]),e}function dxt({set:t}){return WM(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class __e extends g.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}__e.getDerivedStateFromError=()=>({error:!0});const V_e="__default",_ve=new Map,fxt=t=>t&&!!t.memoized&&!!t.changes;function G_e(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const BD=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()},Sc={obj:t=>t===Object(t)&&!Sc.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:o="reference",strict:r=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(Sc.str(t)||Sc.num(t))return t===e;const i=Sc.obj(t);if(i&&o==="reference")return t===e;const a=Sc.arr(t);if(a&&n==="reference")return t===e;if((a||i)&&t===e)return!0;let l;for(l in t)if(!(l in e))return!1;if(i&&n==="shallow"&&o==="shallow"){for(l in r?e:t)if(!Sc.equ(t[l],e[l],{strict:r,objects:"reference"}))return!1}else for(l in r?e:t)if(t[l]!==e[l])return!1;if(Sc.und(l)){if(a&&t.length===0&&e.length===0||i&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function hxt(t){const e={nodes:{},materials:{}};return t&&t.traverse(n=>{n.name&&(e.nodes[n.name]=n),n.material&&!e.materials[n.material.name]&&(e.materials[n.material.name]=n.material)}),e}function pxt(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function lC(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function Rde(t,e){let n=t;if(e.includes("-")){const o=e.split("-"),r=o.pop();return n=o.reduce((i,a)=>i[a],t),{target:n,key:r}}else return{target:n,key:e}}const Vve=/-\d+$/;function Wae(t,e,n){if(Sc.str(n)){if(Vve.test(n)){const i=n.replace(Vve,""),{target:a,key:l}=Rde(t,i);Array.isArray(a[l])||(a[l]=[])}const{target:o,key:r}=Rde(t,n);e.__r3f.previousAttach=o[r],o[r]=e}else e.__r3f.previousAttach=n(t,e)}function Gve(t,e,n){var o,r;if(Sc.str(n)){const{target:i,key:a}=Rde(t,n),l=e.__r3f.previousAttach;l===void 0?delete i[a]:i[a]=l}else(o=e.__r3f)==null||o.previousAttach==null||o.previousAttach(t,e);(r=e.__r3f)==null||delete r.previousAttach}function X_e(t,{children:e,key:n,ref:o,...r},{children:i,key:a,ref:l,...s}={},c=!1){var u;const d=(u=t==null?void 0:t.__r3f)!=null?u:{},f=Object.entries(r),p=[];if(c){const y=Object.keys(s);for(let w=0;w{var x;if((x=t.__r3f)!=null&&x.primitive&&y==="object"||Sc.equ(w,s[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return p.push([y,w,!0,[]]);let C=[];y.includes("-")&&(C=y.split("-")),p.push([y,w,!1,C]);for(const P in r){const A=r[P];P.startsWith(`${y}-`)&&p.push([P,A,!1,P.split("-")])}});const m={...r};return d.memoizedProps&&d.memoizedProps.args&&(m.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(m.attach=d.memoizedProps.attach),{memoized:m,changes:p}}function Nae(t,e){var n,o,r;const i=(n=t.__r3f)!=null?n:{},a=i.root,l=(o=a==null||a.getState==null?void 0:a.getState())!=null?o:{},{memoized:s,changes:c}=fxt(e)?e:X_e(t,e),u=i.eventCount;t.__r3f&&(t.__r3f.memoizedProps=s);for(let f=0;fP[A],t),!(C&&C.set))){const[P,...A]=w.reverse();x=A.reverse().reduce((S,v)=>S[v],t),p=P}if(m===V_e+"remove")if(x.constructor){let P=_ve.get(x.constructor);P||(P=new x.constructor,_ve.set(x.constructor,P)),m=P[p]}else m=0;if(y)m?i.handlers[p]=m:delete i.handlers[p],i.eventCount=Object.keys(i.handlers).length;else if(C&&C.set&&(C.copy||C instanceof ub)){if(Array.isArray(m))C.fromArray?C.fromArray(m):C.set(...m);else if(C.copy&&m&&m.constructor&&C.constructor===m.constructor)C.copy(m);else if(m!==void 0){const P=C instanceof ir;!P&&C.setScalar?C.setScalar(m):C instanceof ub&&m instanceof ub?C.mask=m.mask:C.set(m),!B_e()&&!l.linear&&P&&C.convertSRGBToLinear()}}else if(x[p]=m,x[p]instanceof ic&&x[p].format===y1&&x[p].type===xf){const P=x[p];Lae(P)&&Lae(l.gl)?P.colorSpace=l.gl.outputColorSpace:P.encoding=l.gl.outputEncoding}sC(t)}if(i.parent&&l.internal&&t.raycast&&u!==i.eventCount){const f=l.internal.interaction.indexOf(t);f>-1&&l.internal.interaction.splice(f,1),i.eventCount&&l.internal.interaction.push(t)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(r=t.__r3f)!=null&&r.parent&&Hde(t),t}function sC(t){var e,n;const o=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();o&&o.internal.frames===0&&o.invalidate()}function Hde(t){t.onUpdate==null||t.onUpdate(t)}function gxt(t,e){t.manual||(Y_e(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function wO(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function mxt(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return qC.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return qC.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return qC.ContinuousEventPriority;default:return qC.DefaultEventPriority}}function J_e(t,e,n,o){const r=n.get(e);r&&(n.delete(e),n.size===0&&(t.delete(o),r.target.releasePointerCapture(o)))}function yxt(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(o=>o!==e),n.initialHits=n.initialHits.filter(o=>o!==e),n.hovered.forEach((o,r)=>{(o.eventObject===e||o.object===e)&&n.hovered.delete(r)}),n.capturedMap.forEach((o,r)=>{J_e(n.capturedMap,e,o,r)})}function Axt(t){function e(s){const{internal:c}=t.getState(),u=s.offsetX-c.initialClick[0],d=s.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+d*d))}function n(s){return s.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var d;return(d=c.__r3f)==null?void 0:d.handlers["onPointer"+u]}))}function o(s,c){const u=t.getState(),d=new Set,f=[],p=c?c(u.internal.interaction):u.internal.interaction;for(let x=0;x{const P=BD(x.object),A=BD(C.object);return!P||!A?x.distance-C.distance:A.events.priority-P.events.priority||x.distance-C.distance}).filter(x=>{const C=wO(x);return d.has(C)?!1:(d.add(C),!0)});u.events.filter&&(y=u.events.filter(y,u));for(const x of y){let C=x.object;for(;C;){var w;(w=C.__r3f)!=null&&w.eventCount&&f.push({...x,eventObject:C}),C=C.parent}}if("pointerId"in s&&u.internal.capturedMap.has(s.pointerId))for(let x of u.internal.capturedMap.get(s.pointerId).values())d.has(wO(x.intersection))||f.push(x.intersection);return f}function r(s,c,u,d){const f=t.getState();if(s.length){const p={stopped:!1};for(const m of s){const y=BD(m.object)||f,{raycaster:w,pointer:x,camera:C,internal:P}=y,A=new ue(x.x,x.y,0).unproject(C),S=M=>{var D,k;return(D=(k=P.capturedMap.get(M))==null?void 0:k.has(m.eventObject))!=null?D:!1},v=M=>{const D={intersection:m,target:c.target};P.capturedMap.has(M)?P.capturedMap.get(M).set(m.eventObject,D):P.capturedMap.set(M,new Map([[m.eventObject,D]])),c.target.setPointerCapture(M)},b=M=>{const D=P.capturedMap.get(M);D&&J_e(P.capturedMap,m.eventObject,D,M)};let T={};for(let M in c){let D=c[M];typeof D!="function"&&(T[M]=D)}let R={...m,...T,pointer:x,intersections:s,stopped:p.stopped,delta:u,unprojectedPoint:A,ray:w.ray,camera:C,stopPropagation(){const M="pointerId"in c&&P.capturedMap.get(c.pointerId);if((!M||M.has(m.eventObject))&&(R.stopped=p.stopped=!0,P.hovered.size&&Array.from(P.hovered.values()).find(D=>D.eventObject===m.eventObject))){const D=s.slice(0,s.indexOf(m));i([...D,m])}},target:{hasPointerCapture:S,setPointerCapture:v,releasePointerCapture:b},currentTarget:{hasPointerCapture:S,setPointerCapture:v,releasePointerCapture:b},nativeEvent:c};if(d(R),p.stopped===!0)break}}return s}function i(s){const{internal:c}=t.getState();for(const u of c.hovered.values())if(!s.length||!s.find(d=>d.object===u.object&&d.index===u.index&&d.instanceId===u.instanceId)){const f=u.eventObject.__r3f,p=f==null?void 0:f.handlers;if(c.hovered.delete(wO(u)),f!=null&&f.eventCount){const m={...u,intersections:s};p.onPointerOut==null||p.onPointerOut(m),p.onPointerLeave==null||p.onPointerLeave(m)}}}function a(s,c){for(let u=0;ui([]);case"onLostPointerCapture":return c=>{const{internal:u}=t.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),i([]))})}}return function(u){const{onPointerMissed:d,internal:f}=t.getState();f.lastEvent.current=u;const p=s==="onPointerMove",m=s==="onClick"||s==="onContextMenu"||s==="onDoubleClick",w=o(u,p?n:void 0),x=m?e(u):0;s==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=w.map(P=>P.eventObject)),m&&!w.length&&x<=2&&(a(u,f.interaction),d&&d(u)),p&&i(w);function C(P){const A=P.eventObject,S=A.__r3f,v=S==null?void 0:S.handlers;if(S!=null&&S.eventCount)if(p){if(v.onPointerOver||v.onPointerEnter||v.onPointerOut||v.onPointerLeave){const b=wO(P),T=f.hovered.get(b);T?T.stopped&&P.stopPropagation():(f.hovered.set(b,P),v.onPointerOver==null||v.onPointerOver(P),v.onPointerEnter==null||v.onPointerEnter(P))}v.onPointerMove==null||v.onPointerMove(P)}else{const b=v[s];b?(!m||f.initialHits.includes(A))&&(a(u,f.interaction.filter(T=>!f.initialHits.includes(T))),b(P)):m&&f.initialHits.includes(A)&&a(u,f.interaction.filter(T=>!f.initialHits.includes(T)))}}r(w,u,x,C)}}return{handlePointer:l}}const K_e=t=>!!(t!=null&&t.render),$_e=g.createContext(null),wxt=(t,e)=>{const n=nxt((l,s)=>{const c=new ue,u=new ue,d=new ue;function f(x=s().camera,C=u,P=s().size){const{width:A,height:S,top:v,left:b}=P,T=A/S;C instanceof ue?d.copy(C):d.set(...C);const R=x.getWorldPosition(c).distanceTo(d);if(Y_e(x))return{width:A/x.zoom,height:S/x.zoom,top:v,left:b,factor:1,distance:R,aspect:T};{const M=x.fov*Math.PI/180,D=2*Math.tan(M/2)*R,k=D*(A/S);return{width:k,height:D,top:v,left:b,factor:A/k,distance:R,aspect:T}}}let p;const m=x=>l(C=>({performance:{...C.performance,current:x}})),y=new _t;return{set:l,get:s,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(x=1)=>t(s(),x),advance:(x,C)=>e(x,C,s()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new z2e,pointer:y,mouse:y,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const x=s();p&&clearTimeout(p),x.performance.current!==x.performance.min&&m(x.performance.min),p=setTimeout(()=>m(s().performance.max),x.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:f},setEvents:x=>l(C=>({...C,events:{...C.events,...x}})),setSize:(x,C,P,A,S)=>{const v=s().camera,b={width:x,height:C,top:A||0,left:S||0,updateStyle:P};l(T=>({size:b,viewport:{...T.viewport,...f(v,u,b)}}))},setDpr:x=>l(C=>{const P=G_e(x);return{viewport:{...C.viewport,dpr:P,initialDpr:C.viewport.initialDpr||P}}}),setFrameloop:(x="always")=>{const C=s().clock;C.stop(),C.elapsedTime=0,x!=="never"&&(C.start(),C.elapsedTime=0),l(()=>({frameloop:x}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:g.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(x,C,P)=>{const A=s().internal;return A.priority=A.priority+(C>0?1:0),A.subscribers.push({ref:x,priority:C,store:P}),A.subscribers=A.subscribers.sort((S,v)=>S.priority-v.priority),()=>{const S=s().internal;S!=null&&S.subscribers&&(S.priority=S.priority-(C>0?1:0),S.subscribers=S.subscribers.filter(v=>v.ref!==x))}}}}}),o=n.getState();let r=o.size,i=o.viewport.dpr,a=o.camera;return n.subscribe(()=>{const{camera:l,size:s,viewport:c,gl:u,set:d}=n.getState();if(s.width!==r.width||s.height!==r.height||c.dpr!==i){var f;r=s,i=c.dpr,gxt(l,s),u.setPixelRatio(c.dpr);const p=(f=s.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(s.width,s.height,p)}l!==a&&(a=l,d(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(l)}})))}),n.subscribe(l=>t(l)),n};let xO,xxt=new Set,vxt=new Set,bxt=new Set;function Uae(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function YD(t,e){switch(t){case"before":return Uae(xxt,e);case"after":return Uae(vxt,e);case"tail":return Uae(bxt,e)}}let jae,Bae;function Yae(t,e,n){let o=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(o=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),jae=e.internal.subscribers,xO=0;xO0)&&!((c=r.gl.xr)!=null&&c.isPresenting)&&(n+=Yae(s,r))}if(YD("after",s),n===0)return YD("tail",s),e=!1,cancelAnimationFrame(o)}function a(s,c=1){var u;if(!s)return t.forEach(d=>a(d.store.getState()),c);(u=s.gl.xr)!=null&&u.isPresenting||!s.internal.active||s.frameloop==="never"||(s.internal.frames=Math.min(60,s.internal.frames+c),e||(e=!0,requestAnimationFrame(i)))}function l(s,c=!0,u,d){if(c&&YD("before",s),u)Yae(s,u,d);else for(const f of t.values())Yae(s,f.store.getState());c&&YD("after",s)}return{loop:i,invalidate:a,advance:l}}function Txt(t){const e=g.useRef(null);return WM(()=>void(e.current=t.current.__r3f),[t]),e}function q_e(){const t=g.useContext($_e);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function ti(t=n=>n,e){return q_e()(t,e)}function Gp(t,e=0){const n=q_e(),o=n.getState().internal.subscribe,r=O_e(t);return WM(()=>o(r,e,n),[e,o,n]),null}const Xve=new WeakMap;function Q_e(t,e){return function(n,...o){let r=Xve.get(n);return r||(r=new n,Xve.set(n,r)),t&&t(r),Promise.all(o.map(i=>new Promise((a,l)=>r.load(i,s=>{s.scene&&Object.assign(s,hxt(s.scene)),a(s)},e,s=>l(new Error(`Could not load ${i}: ${s==null?void 0:s.message}`)))))).finally(()=>r.dispose==null?void 0:r.dispose())}}function B5(t,e,n,o){const r=Array.isArray(e)?e:[e],i=j_e(Q_e(n,o),[t,...r],{equal:Sc.equ});return Array.isArray(e)?i:i[0]}B5.preload=function(t,e,n){const o=Array.isArray(e)?e:[e];return lxt(Q_e(n),[t,...o])};B5.clear=function(t,e){const n=Array.isArray(e)?e:[e];return sxt([t,...n])};const uH=new Map,{invalidate:Ip,advance:Jve}=Sxt(uH),{reconciler:CX,applyProps:TP}=cxt(uH,mxt),PP={objects:"shallow",strict:!1},Pxt=(t,e)=>{const n=typeof t=="function"?t(e):t;return K_e(n)?n:new h2e({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Cxt(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:o,height:r,top:i,left:a,updateStyle:l=n}=e;return{width:o,height:r,top:i,left:a,updateStyle:l}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:o,height:r,top:i,left:a}=t.parentElement.getBoundingClientRect();return{width:o,height:r,top:i,left:a,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Rxt(t){const e=uH.get(t),n=e==null?void 0:e.fiber,o=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,i=o||wxt(Ip,Jve),a=n||CX.createContainer(i,qC.ConcurrentRoot,null,!1,null,"",r,null);e||uH.set(t,{fiber:a,store:i});let l,s=!1,c;return{configure(u={}){let{gl:d,size:f,scene:p,events:m,onCreated:y,shadows:w=!1,linear:x=!1,flat:C=!1,legacy:P=!1,orthographic:A=!1,frameloop:S="always",dpr:v=[1,2],performance:b,raycaster:T,camera:R,onPointerMissed:M}=u,D=i.getState(),k=D.gl;D.gl||D.set({gl:k=Pxt(d,t)});let N=D.raycaster;N||D.set({raycaster:N=new yu});const{params:U,...W}=T||{};if(Sc.equ(W,N,PP)||TP(N,{...W}),Sc.equ(U,N.params,PP)||TP(N,{params:{...N.params,...U}}),!D.camera||D.camera===c&&!Sc.equ(c,R,PP)){c=R;const _=R instanceof EM,G=_?R:A?new zN(0,0,0,0,.1,1e3):new A0(75,0,.1,1e3);_||(G.position.z=5,R&&TP(G,R),!D.camera&&!(R!=null&&R.rotation)&&G.lookAt(0,0,0)),D.set({camera:G}),N.camera=G}if(!D.scene){let _;p instanceof cH?_=p:(_=new cH,p&&TP(_,p)),D.set({scene:lC(_)})}if(!D.xr){var F;const _=(oe,ee)=>{const q=i.getState();q.frameloop!=="never"&&Jve(oe,!0,q,ee)},G=()=>{const oe=i.getState();oe.gl.xr.enabled=oe.gl.xr.isPresenting,oe.gl.xr.setAnimationLoop(oe.gl.xr.isPresenting?_:null),oe.gl.xr.isPresenting||Ip(oe)},Q={connect(){const oe=i.getState().gl;oe.xr.addEventListener("sessionstart",G),oe.xr.addEventListener("sessionend",G)},disconnect(){const oe=i.getState().gl;oe.xr.removeEventListener("sessionstart",G),oe.xr.removeEventListener("sessionend",G)}};typeof((F=k.xr)==null?void 0:F.addEventListener)=="function"&&Q.connect(),D.set({xr:Q})}if(k.shadowMap){const _=k.shadowMap.enabled,G=k.shadowMap.type;if(k.shadowMap.enabled=!!w,Sc.boo(w))k.shadowMap.type=Mk;else if(Sc.str(w)){var E;const Q={basic:IYe,percentage:Sq,soft:Mk,variance:$2};k.shadowMap.type=(E=Q[w])!=null?E:Mk}else Sc.obj(w)&&Object.assign(k.shadowMap,w);(_!==k.shadowMap.enabled||G!==k.shadowMap.type)&&(k.shadowMap.needsUpdate=!0)}const L=B_e();L&&("enabled"in L?L.enabled=!P:"legacyMode"in L&&(L.legacyMode=P)),TP(k,{outputEncoding:x?3e3:3001,toneMapping:C?w5:$ye}),D.legacy!==P&&D.set(()=>({legacy:P})),D.linear!==x&&D.set(()=>({linear:x})),D.flat!==C&&D.set(()=>({flat:C})),d&&!Sc.fun(d)&&!K_e(d)&&!Sc.equ(d,k,PP)&&TP(k,d),m&&!D.events.handlers&&D.set({events:m(i)});const O=Cxt(t,f);return Sc.equ(O,D.size,PP)||D.setSize(O.width,O.height,O.updateStyle,O.top,O.left),v&&D.viewport.dpr!==G_e(v)&&D.setDpr(v),D.frameloop!==S&&D.setFrameloop(S),D.onPointerMissed||D.set({onPointerMissed:M}),b&&!Sc.equ(b,D.performance,PP)&&D.set(_=>({performance:{..._.performance,...b}})),l=y,s=!0,this},render(u){return s||this.configure(),CX.updateContainer(g.createElement(Hxt,{store:i,children:u,onCreated:l,rootElement:t}),a,null,()=>{}),i},unmount(){Z_e(t)}}}function Hxt({store:t,children:e,onCreated:n,rootElement:o}){return WM(()=>{const r=t.getState();r.set(i=>({internal:{...i.internal,active:!0}})),n&&n(r),t.getState().events.connected||r.events.connect==null||r.events.connect(o)},[]),g.createElement($_e.Provider,{value:t},e)}function Z_e(t,e){const n=uH.get(t),o=n==null?void 0:n.fiber;if(o){const r=n==null?void 0:n.store.getState();r&&(r.internal.active=!1),CX.updateContainer(null,o,null,()=>{r&&setTimeout(()=>{try{var i,a,l,s;r.events.disconnect==null||r.events.disconnect(),(i=r.gl)==null||(a=i.renderLists)==null||a.dispose==null||a.dispose(),(l=r.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(s=r.gl)!=null&&s.xr&&r.xr.disconnect(),pxt(r),uH.delete(t)}catch{}},500)})}}CX.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:g.version});function RX(){return RX=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0?o=setTimeout(s,e-u):(o=null,n||(l=t.apply(i,r),i=r=null))}var c=function(){i=this,r=arguments,a=Date.now();var u=n&&!o;return o||(o=setTimeout(s,e)),u&&(l=t.apply(i,r),i=r=null),l};return c.clear=function(){o&&(clearTimeout(o),o=null)},c.flush=function(){o&&(l=t.apply(i,r),i=r=null,clearTimeout(o),o=null)},c}Mde.debounce=Mde;var Mxt=Mde;const Kve=ji(Mxt);function Ixt(t){let{debounce:e,scroll:n,polyfill:o,offsetSize:r}=t===void 0?{debounce:0,scroll:!1,offsetSize:!1}:t;const i=o||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,l]=g.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),s=g.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,d=g.useRef(!1);g.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,p,m]=g.useMemo(()=>{const C=()=>{if(!s.current.element)return;const{left:P,top:A,width:S,height:v,bottom:b,right:T,x:R,y:M}=s.current.element.getBoundingClientRect(),D={left:P,top:A,width:S,height:v,bottom:b,right:T,x:R,y:M};s.current.element instanceof HTMLElement&&r&&(D.height=s.current.element.offsetHeight,D.width=s.current.element.offsetWidth),Object.freeze(D),d.current&&!kxt(s.current.lastBounds,D)&&l(s.current.lastBounds=D)};return[C,u?Kve(C,u):C,c?Kve(C,c):C]},[l,r,c,u]);function y(){s.current.scrollContainers&&(s.current.scrollContainers.forEach(C=>C.removeEventListener("scroll",m,!0)),s.current.scrollContainers=null),s.current.resizeObserver&&(s.current.resizeObserver.disconnect(),s.current.resizeObserver=null)}function w(){s.current.element&&(s.current.resizeObserver=new i(m),s.current.resizeObserver.observe(s.current.element),n&&s.current.scrollContainers&&s.current.scrollContainers.forEach(C=>C.addEventListener("scroll",m,{capture:!0,passive:!0})))}const x=C=>{!C||C===s.current.element||(y(),s.current.element=C,s.current.scrollContainers=eVe(C),w())};return Dxt(m,!!n),zxt(p),g.useEffect(()=>{y(),w()},[n,m,p]),g.useEffect(()=>y,[]),[x,a,f]}function zxt(t){g.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Dxt(t,e){g.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function eVe(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:o,overflowY:r}=window.getComputedStyle(t);return[n,o,r].some(i=>i==="auto"||i==="scroll")&&e.push(t),[...e,...eVe(t.parentElement)]}const Ext=["x","y","top","bottom","left","right","width","height"],kxt=(t,e)=>Ext.every(n=>t[n]===e[n]);var Fxt=Object.defineProperty,Lxt=Object.defineProperties,Wxt=Object.getOwnPropertyDescriptors,$ve=Object.getOwnPropertySymbols,Nxt=Object.prototype.hasOwnProperty,Uxt=Object.prototype.propertyIsEnumerable,qve=(t,e,n)=>e in t?Fxt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qve=(t,e)=>{for(var n in e||(e={}))Nxt.call(e,n)&&qve(t,n,e[n]);if($ve)for(var n of $ve(e))Uxt.call(e,n)&&qve(t,n,e[n]);return t},jxt=(t,e)=>Lxt(t,Wxt(e));function tVe(t,e,n){if(!t)return;if(n(t)===!0)return t;let o=t.child;for(;o;){const r=tVe(o,e,n);if(r)return r;o=o.sibling}}function nVe(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const L2e=nVe(g.createContext(null));class oVe extends g.Component{render(){return g.createElement(L2e.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:Zve,ReactCurrentDispatcher:ebe}=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Bxt(){const t=g.useContext(L2e);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=g.useId();return g.useMemo(()=>{for(const o of[Zve==null?void 0:Zve.current,t,t==null?void 0:t.alternate]){if(!o)continue;const r=tVe(o,!1,i=>{let a=i.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[t,e])}function Yxt(){var t,e;const n=Bxt(),[o]=g.useState(()=>new Map);o.clear();let r=n;for(;r;){const i=(t=r.type)==null?void 0:t._context;i&&i!==L2e&&!o.has(i)&&o.set(i,(e=ebe==null?void 0:ebe.current)==null?void 0:e.readContext(nVe(i))),r=r.return}return o}function Oxt(){const t=Yxt();return g.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>o=>g.createElement(e,null,g.createElement(n.Provider,jxt(Qve({},o),{value:t.get(n)}))),e=>g.createElement(oVe,Qve({},e))),[t])}const Oae={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function _xt(t){const{handlePointer:e}=Axt(t);return{priority:1,enabled:!0,compute(n,o,r){o.pointer.set(n.offsetX/o.size.width*2-1,-(n.offsetY/o.size.height)*2+1),o.raycaster.setFromCamera(o.pointer,o.camera)},connected:void 0,handlers:Object.keys(Oae).reduce((n,o)=>({...n,[o]:e(o)}),{}),update:()=>{var n;const{events:o,internal:r}=t.getState();(n=r.lastEvent)!=null&&n.current&&o.handlers&&o.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{var o;const{set:r,events:i}=t.getState();i.disconnect==null||i.disconnect(),r(a=>({events:{...a.events,connected:n}})),Object.entries((o=i.handlers)!=null?o:[]).forEach(([a,l])=>{const[s,c]=Oae[a];n.addEventListener(s,l,{passive:c})})},disconnect:()=>{const{set:n,events:o}=t.getState();if(o.connected){var r;Object.entries((r=o.handlers)!=null?r:[]).forEach(([i,a])=>{if(o&&o.connected instanceof HTMLElement){const[l]=Oae[i];o.connected.removeEventListener(l,a)}}),n(i=>({events:{...i.events,connected:void 0}}))}}}}const Vxt=g.forwardRef(function({children:e,fallback:n,resize:o,style:r,gl:i,events:a=_xt,eventSource:l,eventPrefix:s,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:w,raycaster:x,camera:C,scene:P,onPointerMissed:A,onCreated:S,...v},b){g.useMemo(()=>R7(Z7t),[]);const T=Oxt(),[R,M]=Ixt({scroll:!0,debounce:{scroll:50,resize:0},...o}),D=g.useRef(null),k=g.useRef(null);g.useImperativeHandle(b,()=>D.current);const N=O_e(A),[U,W]=g.useState(!1),[F,E]=g.useState(!1);if(U)throw U;if(F)throw F;const L=g.useRef(null);WM(()=>{const Y=D.current;M.width>0&&M.height>0&&Y&&(L.current||(L.current=Rxt(Y)),L.current.configure({gl:i,events:a,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:w,raycaster:x,camera:C,scene:P,size:M,onPointerMissed:(...O)=>N.current==null?void 0:N.current(...O),onCreated:O=>{O.events.connect==null||O.events.connect(l?uxt(l)?l.current:l:k.current),s&&O.setEvents({compute:(_,G)=>{const Q=_[s+"X"],oe=_[s+"Y"];G.pointer.set(Q/G.size.width*2-1,-(oe/G.size.height)*2+1),G.raycaster.setFromCamera(G.pointer,G.camera)}}),S==null||S(O)}}),L.current.render(g.createElement(T,null,g.createElement(__e,{set:E},g.createElement(g.Suspense,{fallback:g.createElement(dxt,{set:W})},e)))))}),g.useEffect(()=>{const Y=D.current;if(Y)return()=>Z_e(Y)},[]);const j=l?"none":"auto";return g.createElement("div",RX({ref:k,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...r}},v),g.createElement("div",{ref:R,style:{width:"100%",height:"100%"}},g.createElement("canvas",{ref:D,style:{display:"block"}},n)))}),Gxt=g.forwardRef(function(e,n){return g.createElement(oVe,null,g.createElement(Vxt,RX({},e,{ref:n})))});function Xxt(t,e,n){return e=HX(e),nvt(t,rVe()?Reflect.construct(e,n||[],HX(t).constructor):e.apply(t,n))}function rVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rVe=function(){return!!t})()}function Jxt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}function Kxt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function $xt(t){var e=Kxt(t,"string");return typeof e=="symbol"?e:String(e)}function qxt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qxt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n ")}return null},n.getPublicRootInstance=function(J){if(J=J.current,!J.child)return null;switch(J.child.tag){case 5:return F(J.child.stateNode);default:return J.child.stateNode}},n.injectIntoDevTools=function(J){if(J={bundleType:J.bundleType,version:J.version,rendererPackageName:J.rendererPackageName,rendererConfig:J.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:lz,findFiberByHostInstance:J.findFiberByHostInstance||G4,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")J=!1;else{var K=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(K.isDisabled||!K.supportsFiber)J=!0;else{try{_s=K.inject(J),sc=K}catch{}J=!!K.checkDCE}}return J},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(J,K,be,ke){if(!Ie)throw Error(a(363));J=Lm(J,K);var $e=Se(J,be,ke).disconnect;return{disconnect:function(){$e()}}},n.registerMutableSourceForHydration=function(J,K){var be=K._getVersion;be=be(K._source),J.mutableSourceEagerHydrationData==null?J.mutableSourceEagerHydrationData=[K,be]:J.mutableSourceEagerHydrationData.push(K,be)},n.runWithPriority=function(J,K){var be=zo;try{return zo=J,K()}finally{zo=be}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(J,K,be,ke){var $e=K.current,At=Ru(),an=yd($e);return be=L6(be),K.context===null?K.context=be:K.pendingContext=be,K=go(At,an),K.payload={element:J},ke=ke===void 0?null:ke,ke!==null&&(K.callback=ke),qo($e,K),J=Kd($e,an,At),J!==null&&Xr(J,$e,an),an},n};F_e.exports=oxt;var rxt=F_e.exports;const ixt=ji(rxt),axt=t=>typeof t=="object"&&typeof t.then=="function",Wv=[];function N_e(t,e,n=(o,r)=>o===r){if(t===e)return!0;if(!t||!e)return!1;const o=t.length;if(e.length!==o)return!1;for(let r=0;r0&&(i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.remove,o.lifespan)),i.response;if(!n)throw i.promise}const r={keys:e,equal:o.equal,remove:()=>{const i=Wv.indexOf(r);i!==-1&&Wv.splice(i,1)},promise:(axt(t)?t:t(...e)).then(i=>{r.response=i,o.lifespan&&o.lifespan>0&&(r.timeout=setTimeout(r.remove,o.lifespan))}).catch(i=>r.error=i)};if(Wv.push(r),!n)throw r.promise}const j_e=(t,e,n)=>U_e(t,e,!1,n),lxt=(t,e,n)=>void U_e(t,e,!0,n),sxt=t=>{if(t===void 0||t.length===0)Wv.splice(0,Wv.length);else{const e=Wv.find(n=>N_e(t,n.keys,n.equal));e&&e.remove()}},F2e={},R7=t=>void Object.assign(F2e,t);function cxt(t,e){function n(u,{args:d=[],attach:f,...p},m){let y=`${u[0].toUpperCase()}${u.slice(1)}`,w;if(u==="primitive"){if(p.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const x=p.object;w=lC(x,{type:u,root:m,attach:f,primitive:!0})}else{const x=F2e[y];if(!x)throw new Error(`R3F: ${y} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");w=lC(new x(...d),{type:u,root:m,attach:f,memoizedProps:{args:d}})}return w.__r3f.attach===void 0&&(w instanceof Ni?w.__r3f.attach="geometry":w instanceof id&&(w.__r3f.attach="material")),y!=="inject"&&Nae(w,p),w}function o(u,d){let f=!1;if(d){var p,m;(p=d.__r3f)!=null&&p.attach?Wae(u,d,d.__r3f.attach):d.isObject3D&&u.isObject3D&&(u.add(d),f=!0),f||(m=u.__r3f)==null||m.objects.push(d),d.__r3f||lC(d,{}),d.__r3f.parent=u,Hde(d),sC(d)}}function r(u,d,f){let p=!1;if(d){var m,y;if((m=d.__r3f)!=null&&m.attach)Wae(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){d.parent=u,d.dispatchEvent({type:"added"});const w=u.children.filter(C=>C!==d),x=w.indexOf(f);u.children=[...w.slice(0,x),d,...w.slice(x)],p=!0}p||(y=u.__r3f)==null||y.objects.push(d),d.__r3f||lC(d,{}),d.__r3f.parent=u,Hde(d),sC(d)}}function i(u,d,f=!1){u&&[...u].forEach(p=>a(d,p,f))}function a(u,d,f){if(d){var p,m,y;if(d.__r3f&&(d.__r3f.parent=null),(p=u.__r3f)!=null&&p.objects&&(u.__r3f.objects=u.__r3f.objects.filter(A=>A!==d)),(m=d.__r3f)!=null&&m.attach)Gve(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){var w;u.remove(d),(w=d.__r3f)!=null&&w.root&&yxt(d.__r3f.root,d)}const C=(y=d.__r3f)==null?void 0:y.primitive,P=f===void 0?d.dispose!==null&&!C:f;if(!C){var x;i((x=d.__r3f)==null?void 0:x.objects,d,P),i(d.children,d,P)}delete d.__r3f,P&&d.dispose&&d.type!=="Scene"&&Cde.unstable_scheduleCallback(Cde.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),sC(u)}}function l(u,d,f,p){var m;const y=(m=u.__r3f)==null?void 0:m.parent;if(!y)return;const w=n(d,f,u.__r3f.root);if(u.children){for(const x of u.children)x.__r3f&&o(w,x);u.children=u.children.filter(x=>!x.__r3f)}u.__r3f.objects.forEach(x=>o(w,x)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||a(y,u),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),o(y,w),w.raycast&&w.__r3f.eventCount&&w.__r3f.root.getState().internal.interaction.push(w),[p,p.alternate].forEach(x=>{x!==null&&(x.stateNode=w,x.ref&&(typeof x.ref=="function"?x.ref(w):x.ref.current=w))})}const s=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:ixt({createInstance:n,removeChild:a,appendChild:o,appendInitialChild:o,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,d)=>{if(!d)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,o(f,d))},removeChildFromContainer:(u,d)=>{d&&a(u.getState().scene,d)},insertInContainerBefore:(u,d,f)=>{if(!d||!f)return;const p=u.getState().scene;p.__r3f&&r(p,d,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var d;return!!((d=u==null?void 0:u.__r3f)!=null?d:{}).handlers},prepareUpdate(u,d,f,p){var m;if(((m=u==null?void 0:u.__r3f)!=null?m:{}).primitive&&p.object&&p.object!==u)return[!0];{const{args:w=[],children:x,...C}=p,{args:P=[],children:A,...S}=f;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((b,T)=>b!==P[T]))return[!0];const v=X_e(u,C,S,!0);return v.changes.length?[!1,v]:null}},commitUpdate(u,[d,f],p,m,y,w){d?l(u,p,y,w):Nae(u,f)},commitMount(u,d,f,p){var m;const y=(m=u.__r3f)!=null?m:{};u.raycast&&y.handlers&&y.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>lC(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var d;const{attach:f,parent:p}=(d=u.__r3f)!=null?d:{};f&&p&&Gve(p,u,f),u.isObject3D&&(u.visible=!1),sC(u)},unhideInstance(u,d){var f;const{attach:p,parent:m}=(f=u.__r3f)!=null?f:{};p&&m&&Wae(m,u,p),(u.isObject3D&&d.visible==null||d.visible)&&(u.visible=!0),sC(u)},createTextInstance:s,hideTextInstance:s,unhideTextInstance:s,getCurrentEventPriority:()=>e?e():qC.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Sc.fun(performance.now)?performance.now:Sc.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Sc.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Sc.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Nae}}var Yve,Ove;const Lae=t=>"colorSpace"in t||"outputColorSpace"in t,B_e=()=>{var t;return(t=F2e.ColorManagement)!=null?t:null},Y_e=t=>t&&t.isOrthographicCamera,uxt=t=>t&&t.hasOwnProperty("current"),WM=typeof window<"u"&&((Yve=window.document)!=null&&Yve.createElement||((Ove=window.navigator)==null?void 0:Ove.product)==="ReactNative")?g.useLayoutEffect:g.useEffect;function O_e(t){const e=g.useRef(t);return WM(()=>void(e.current=t),[t]),e}function dxt({set:t}){return WM(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class __e extends g.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}__e.getDerivedStateFromError=()=>({error:!0});const V_e="__default",_ve=new Map,fxt=t=>t&&!!t.memoized&&!!t.changes;function G_e(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const BD=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()},Sc={obj:t=>t===Object(t)&&!Sc.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:o="reference",strict:r=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(Sc.str(t)||Sc.num(t))return t===e;const i=Sc.obj(t);if(i&&o==="reference")return t===e;const a=Sc.arr(t);if(a&&n==="reference")return t===e;if((a||i)&&t===e)return!0;let l;for(l in t)if(!(l in e))return!1;if(i&&n==="shallow"&&o==="shallow"){for(l in r?e:t)if(!Sc.equ(t[l],e[l],{strict:r,objects:"reference"}))return!1}else for(l in r?e:t)if(t[l]!==e[l])return!1;if(Sc.und(l)){if(a&&t.length===0&&e.length===0||i&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function hxt(t){const e={nodes:{},materials:{}};return t&&t.traverse(n=>{n.name&&(e.nodes[n.name]=n),n.material&&!e.materials[n.material.name]&&(e.materials[n.material.name]=n.material)}),e}function pxt(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function lC(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function Rde(t,e){let n=t;if(e.includes("-")){const o=e.split("-"),r=o.pop();return n=o.reduce((i,a)=>i[a],t),{target:n,key:r}}else return{target:n,key:e}}const Vve=/-\d+$/;function Wae(t,e,n){if(Sc.str(n)){if(Vve.test(n)){const i=n.replace(Vve,""),{target:a,key:l}=Rde(t,i);Array.isArray(a[l])||(a[l]=[])}const{target:o,key:r}=Rde(t,n);e.__r3f.previousAttach=o[r],o[r]=e}else e.__r3f.previousAttach=n(t,e)}function Gve(t,e,n){var o,r;if(Sc.str(n)){const{target:i,key:a}=Rde(t,n),l=e.__r3f.previousAttach;l===void 0?delete i[a]:i[a]=l}else(o=e.__r3f)==null||o.previousAttach==null||o.previousAttach(t,e);(r=e.__r3f)==null||delete r.previousAttach}function X_e(t,{children:e,key:n,ref:o,...r},{children:i,key:a,ref:l,...s}={},c=!1){var u;const d=(u=t==null?void 0:t.__r3f)!=null?u:{},f=Object.entries(r),p=[];if(c){const y=Object.keys(s);for(let w=0;w{var x;if((x=t.__r3f)!=null&&x.primitive&&y==="object"||Sc.equ(w,s[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return p.push([y,w,!0,[]]);let C=[];y.includes("-")&&(C=y.split("-")),p.push([y,w,!1,C]);for(const P in r){const A=r[P];P.startsWith(`${y}-`)&&p.push([P,A,!1,P.split("-")])}});const m={...r};return d.memoizedProps&&d.memoizedProps.args&&(m.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(m.attach=d.memoizedProps.attach),{memoized:m,changes:p}}function Nae(t,e){var n,o,r;const i=(n=t.__r3f)!=null?n:{},a=i.root,l=(o=a==null||a.getState==null?void 0:a.getState())!=null?o:{},{memoized:s,changes:c}=fxt(e)?e:X_e(t,e),u=i.eventCount;t.__r3f&&(t.__r3f.memoizedProps=s);for(let f=0;fP[A],t),!(C&&C.set))){const[P,...A]=w.reverse();x=A.reverse().reduce((S,v)=>S[v],t),p=P}if(m===V_e+"remove")if(x.constructor){let P=_ve.get(x.constructor);P||(P=new x.constructor,_ve.set(x.constructor,P)),m=P[p]}else m=0;if(y)m?i.handlers[p]=m:delete i.handlers[p],i.eventCount=Object.keys(i.handlers).length;else if(C&&C.set&&(C.copy||C instanceof ub)){if(Array.isArray(m))C.fromArray?C.fromArray(m):C.set(...m);else if(C.copy&&m&&m.constructor&&C.constructor===m.constructor)C.copy(m);else if(m!==void 0){const P=C instanceof ir;!P&&C.setScalar?C.setScalar(m):C instanceof ub&&m instanceof ub?C.mask=m.mask:C.set(m),!B_e()&&!l.linear&&P&&C.convertSRGBToLinear()}}else if(x[p]=m,x[p]instanceof ic&&x[p].format===y1&&x[p].type===xf){const P=x[p];Lae(P)&&Lae(l.gl)?P.colorSpace=l.gl.outputColorSpace:P.encoding=l.gl.outputEncoding}sC(t)}if(i.parent&&l.internal&&t.raycast&&u!==i.eventCount){const f=l.internal.interaction.indexOf(t);f>-1&&l.internal.interaction.splice(f,1),i.eventCount&&l.internal.interaction.push(t)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(r=t.__r3f)!=null&&r.parent&&Hde(t),t}function sC(t){var e,n;const o=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();o&&o.internal.frames===0&&o.invalidate()}function Hde(t){t.onUpdate==null||t.onUpdate(t)}function gxt(t,e){t.manual||(Y_e(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function wO(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function mxt(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return qC.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return qC.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return qC.ContinuousEventPriority;default:return qC.DefaultEventPriority}}function J_e(t,e,n,o){const r=n.get(e);r&&(n.delete(e),n.size===0&&(t.delete(o),r.target.releasePointerCapture(o)))}function yxt(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(o=>o!==e),n.initialHits=n.initialHits.filter(o=>o!==e),n.hovered.forEach((o,r)=>{(o.eventObject===e||o.object===e)&&n.hovered.delete(r)}),n.capturedMap.forEach((o,r)=>{J_e(n.capturedMap,e,o,r)})}function Axt(t){function e(s){const{internal:c}=t.getState(),u=s.offsetX-c.initialClick[0],d=s.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+d*d))}function n(s){return s.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var d;return(d=c.__r3f)==null?void 0:d.handlers["onPointer"+u]}))}function o(s,c){const u=t.getState(),d=new Set,f=[],p=c?c(u.internal.interaction):u.internal.interaction;for(let x=0;x{const P=BD(x.object),A=BD(C.object);return!P||!A?x.distance-C.distance:A.events.priority-P.events.priority||x.distance-C.distance}).filter(x=>{const C=wO(x);return d.has(C)?!1:(d.add(C),!0)});u.events.filter&&(y=u.events.filter(y,u));for(const x of y){let C=x.object;for(;C;){var w;(w=C.__r3f)!=null&&w.eventCount&&f.push({...x,eventObject:C}),C=C.parent}}if("pointerId"in s&&u.internal.capturedMap.has(s.pointerId))for(let x of u.internal.capturedMap.get(s.pointerId).values())d.has(wO(x.intersection))||f.push(x.intersection);return f}function r(s,c,u,d){const f=t.getState();if(s.length){const p={stopped:!1};for(const m of s){const y=BD(m.object)||f,{raycaster:w,pointer:x,camera:C,internal:P}=y,A=new ue(x.x,x.y,0).unproject(C),S=M=>{var D,k;return(D=(k=P.capturedMap.get(M))==null?void 0:k.has(m.eventObject))!=null?D:!1},v=M=>{const D={intersection:m,target:c.target};P.capturedMap.has(M)?P.capturedMap.get(M).set(m.eventObject,D):P.capturedMap.set(M,new Map([[m.eventObject,D]])),c.target.setPointerCapture(M)},b=M=>{const D=P.capturedMap.get(M);D&&J_e(P.capturedMap,m.eventObject,D,M)};let T={};for(let M in c){let D=c[M];typeof D!="function"&&(T[M]=D)}let R={...m,...T,pointer:x,intersections:s,stopped:p.stopped,delta:u,unprojectedPoint:A,ray:w.ray,camera:C,stopPropagation(){const M="pointerId"in c&&P.capturedMap.get(c.pointerId);if((!M||M.has(m.eventObject))&&(R.stopped=p.stopped=!0,P.hovered.size&&Array.from(P.hovered.values()).find(D=>D.eventObject===m.eventObject))){const D=s.slice(0,s.indexOf(m));i([...D,m])}},target:{hasPointerCapture:S,setPointerCapture:v,releasePointerCapture:b},currentTarget:{hasPointerCapture:S,setPointerCapture:v,releasePointerCapture:b},nativeEvent:c};if(d(R),p.stopped===!0)break}}return s}function i(s){const{internal:c}=t.getState();for(const u of c.hovered.values())if(!s.length||!s.find(d=>d.object===u.object&&d.index===u.index&&d.instanceId===u.instanceId)){const f=u.eventObject.__r3f,p=f==null?void 0:f.handlers;if(c.hovered.delete(wO(u)),f!=null&&f.eventCount){const m={...u,intersections:s};p.onPointerOut==null||p.onPointerOut(m),p.onPointerLeave==null||p.onPointerLeave(m)}}}function a(s,c){for(let u=0;ui([]);case"onLostPointerCapture":return c=>{const{internal:u}=t.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),i([]))})}}return function(u){const{onPointerMissed:d,internal:f}=t.getState();f.lastEvent.current=u;const p=s==="onPointerMove",m=s==="onClick"||s==="onContextMenu"||s==="onDoubleClick",w=o(u,p?n:void 0),x=m?e(u):0;s==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=w.map(P=>P.eventObject)),m&&!w.length&&x<=2&&(a(u,f.interaction),d&&d(u)),p&&i(w);function C(P){const A=P.eventObject,S=A.__r3f,v=S==null?void 0:S.handlers;if(S!=null&&S.eventCount)if(p){if(v.onPointerOver||v.onPointerEnter||v.onPointerOut||v.onPointerLeave){const b=wO(P),T=f.hovered.get(b);T?T.stopped&&P.stopPropagation():(f.hovered.set(b,P),v.onPointerOver==null||v.onPointerOver(P),v.onPointerEnter==null||v.onPointerEnter(P))}v.onPointerMove==null||v.onPointerMove(P)}else{const b=v[s];b?(!m||f.initialHits.includes(A))&&(a(u,f.interaction.filter(T=>!f.initialHits.includes(T))),b(P)):m&&f.initialHits.includes(A)&&a(u,f.interaction.filter(T=>!f.initialHits.includes(T)))}}r(w,u,x,C)}}return{handlePointer:l}}const K_e=t=>!!(t!=null&&t.render),$_e=g.createContext(null),wxt=(t,e)=>{const n=nxt((l,s)=>{const c=new ue,u=new ue,d=new ue;function f(x=s().camera,C=u,P=s().size){const{width:A,height:S,top:v,left:b}=P,T=A/S;C instanceof ue?d.copy(C):d.set(...C);const R=x.getWorldPosition(c).distanceTo(d);if(Y_e(x))return{width:A/x.zoom,height:S/x.zoom,top:v,left:b,factor:1,distance:R,aspect:T};{const M=x.fov*Math.PI/180,D=2*Math.tan(M/2)*R,k=D*(A/S);return{width:k,height:D,top:v,left:b,factor:A/k,distance:R,aspect:T}}}let p;const m=x=>l(C=>({performance:{...C.performance,current:x}})),y=new _t;return{set:l,get:s,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(x=1)=>t(s(),x),advance:(x,C)=>e(x,C,s()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new z2e,pointer:y,mouse:y,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const x=s();p&&clearTimeout(p),x.performance.current!==x.performance.min&&m(x.performance.min),p=setTimeout(()=>m(s().performance.max),x.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:f},setEvents:x=>l(C=>({...C,events:{...C.events,...x}})),setSize:(x,C,P,A,S)=>{const v=s().camera,b={width:x,height:C,top:A||0,left:S||0,updateStyle:P};l(T=>({size:b,viewport:{...T.viewport,...f(v,u,b)}}))},setDpr:x=>l(C=>{const P=G_e(x);return{viewport:{...C.viewport,dpr:P,initialDpr:C.viewport.initialDpr||P}}}),setFrameloop:(x="always")=>{const C=s().clock;C.stop(),C.elapsedTime=0,x!=="never"&&(C.start(),C.elapsedTime=0),l(()=>({frameloop:x}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:g.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(x,C,P)=>{const A=s().internal;return A.priority=A.priority+(C>0?1:0),A.subscribers.push({ref:x,priority:C,store:P}),A.subscribers=A.subscribers.sort((S,v)=>S.priority-v.priority),()=>{const S=s().internal;S!=null&&S.subscribers&&(S.priority=S.priority-(C>0?1:0),S.subscribers=S.subscribers.filter(v=>v.ref!==x))}}}}}),o=n.getState();let r=o.size,i=o.viewport.dpr,a=o.camera;return n.subscribe(()=>{const{camera:l,size:s,viewport:c,gl:u,set:d}=n.getState();if(s.width!==r.width||s.height!==r.height||c.dpr!==i){var f;r=s,i=c.dpr,gxt(l,s),u.setPixelRatio(c.dpr);const p=(f=s.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(s.width,s.height,p)}l!==a&&(a=l,d(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(l)}})))}),n.subscribe(l=>t(l)),n};let xO,xxt=new Set,vxt=new Set,bxt=new Set;function Uae(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function YD(t,e){switch(t){case"before":return Uae(xxt,e);case"after":return Uae(vxt,e);case"tail":return Uae(bxt,e)}}let jae,Bae;function Yae(t,e,n){let o=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(o=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),jae=e.internal.subscribers,xO=0;xO0)&&!((c=r.gl.xr)!=null&&c.isPresenting)&&(n+=Yae(s,r))}if(YD("after",s),n===0)return YD("tail",s),e=!1,cancelAnimationFrame(o)}function a(s,c=1){var u;if(!s)return t.forEach(d=>a(d.store.getState()),c);(u=s.gl.xr)!=null&&u.isPresenting||!s.internal.active||s.frameloop==="never"||(s.internal.frames=Math.min(60,s.internal.frames+c),e||(e=!0,requestAnimationFrame(i)))}function l(s,c=!0,u,d){if(c&&YD("before",s),u)Yae(s,u,d);else for(const f of t.values())Yae(s,f.store.getState());c&&YD("after",s)}return{loop:i,invalidate:a,advance:l}}function Txt(t){const e=g.useRef(null);return WM(()=>void(e.current=t.current.__r3f),[t]),e}function q_e(){const t=g.useContext($_e);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function ti(t=n=>n,e){return q_e()(t,e)}function Gp(t,e=0){const n=q_e(),o=n.getState().internal.subscribe,r=O_e(t);return WM(()=>o(r,e,n),[e,o,n]),null}const Xve=new WeakMap;function Q_e(t,e){return function(n,...o){let r=Xve.get(n);return r||(r=new n,Xve.set(n,r)),t&&t(r),Promise.all(o.map(i=>new Promise((a,l)=>r.load(i,s=>{s.scene&&Object.assign(s,hxt(s.scene)),a(s)},e,s=>l(new Error(`Could not load ${i}: ${s==null?void 0:s.message}`)))))).finally(()=>r.dispose==null?void 0:r.dispose())}}function B5(t,e,n,o){const r=Array.isArray(e)?e:[e],i=j_e(Q_e(n,o),[t,...r],{equal:Sc.equ});return Array.isArray(e)?i:i[0]}B5.preload=function(t,e,n){const o=Array.isArray(e)?e:[e];return lxt(Q_e(n),[t,...o])};B5.clear=function(t,e){const n=Array.isArray(e)?e:[e];return sxt([t,...n])};const uH=new Map,{invalidate:Ip,advance:Jve}=Sxt(uH),{reconciler:CX,applyProps:TP}=cxt(uH,mxt),PP={objects:"shallow",strict:!1},Pxt=(t,e)=>{const n=typeof t=="function"?t(e):t;return K_e(n)?n:new h2e({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Cxt(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:o,height:r,top:i,left:a,updateStyle:l=n}=e;return{width:o,height:r,top:i,left:a,updateStyle:l}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:o,height:r,top:i,left:a}=t.parentElement.getBoundingClientRect();return{width:o,height:r,top:i,left:a,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Rxt(t){const e=uH.get(t),n=e==null?void 0:e.fiber,o=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,i=o||wxt(Ip,Jve),a=n||CX.createContainer(i,qC.ConcurrentRoot,null,!1,null,"",r,null);e||uH.set(t,{fiber:a,store:i});let l,s=!1,c;return{configure(u={}){let{gl:d,size:f,scene:p,events:m,onCreated:y,shadows:w=!1,linear:x=!1,flat:C=!1,legacy:P=!1,orthographic:A=!1,frameloop:S="always",dpr:v=[1,2],performance:b,raycaster:T,camera:R,onPointerMissed:M}=u,D=i.getState(),k=D.gl;D.gl||D.set({gl:k=Pxt(d,t)});let N=D.raycaster;N||D.set({raycaster:N=new yu});const{params:U,...W}=T||{};if(Sc.equ(W,N,PP)||TP(N,{...W}),Sc.equ(U,N.params,PP)||TP(N,{params:{...N.params,...U}}),!D.camera||D.camera===c&&!Sc.equ(c,R,PP)){c=R;const _=R instanceof EM,G=_?R:A?new zN(0,0,0,0,.1,1e3):new A0(75,0,.1,1e3);_||(G.position.z=5,R&&TP(G,R),!D.camera&&!(R!=null&&R.rotation)&&G.lookAt(0,0,0)),D.set({camera:G}),N.camera=G}if(!D.scene){let _;p instanceof cH?_=p:(_=new cH,p&&TP(_,p)),D.set({scene:lC(_)})}if(!D.xr){var F;const _=(oe,ee)=>{const $=i.getState();$.frameloop!=="never"&&Jve(oe,!0,$,ee)},G=()=>{const oe=i.getState();oe.gl.xr.enabled=oe.gl.xr.isPresenting,oe.gl.xr.setAnimationLoop(oe.gl.xr.isPresenting?_:null),oe.gl.xr.isPresenting||Ip(oe)},Q={connect(){const oe=i.getState().gl;oe.xr.addEventListener("sessionstart",G),oe.xr.addEventListener("sessionend",G)},disconnect(){const oe=i.getState().gl;oe.xr.removeEventListener("sessionstart",G),oe.xr.removeEventListener("sessionend",G)}};typeof((F=k.xr)==null?void 0:F.addEventListener)=="function"&&Q.connect(),D.set({xr:Q})}if(k.shadowMap){const _=k.shadowMap.enabled,G=k.shadowMap.type;if(k.shadowMap.enabled=!!w,Sc.boo(w))k.shadowMap.type=Mk;else if(Sc.str(w)){var E;const Q={basic:IYe,percentage:Sq,soft:Mk,variance:$2};k.shadowMap.type=(E=Q[w])!=null?E:Mk}else Sc.obj(w)&&Object.assign(k.shadowMap,w);(_!==k.shadowMap.enabled||G!==k.shadowMap.type)&&(k.shadowMap.needsUpdate=!0)}const L=B_e();L&&("enabled"in L?L.enabled=!P:"legacyMode"in L&&(L.legacyMode=P)),TP(k,{outputEncoding:x?3e3:3001,toneMapping:C?w5:$ye}),D.legacy!==P&&D.set(()=>({legacy:P})),D.linear!==x&&D.set(()=>({linear:x})),D.flat!==C&&D.set(()=>({flat:C})),d&&!Sc.fun(d)&&!K_e(d)&&!Sc.equ(d,k,PP)&&TP(k,d),m&&!D.events.handlers&&D.set({events:m(i)});const O=Cxt(t,f);return Sc.equ(O,D.size,PP)||D.setSize(O.width,O.height,O.updateStyle,O.top,O.left),v&&D.viewport.dpr!==G_e(v)&&D.setDpr(v),D.frameloop!==S&&D.setFrameloop(S),D.onPointerMissed||D.set({onPointerMissed:M}),b&&!Sc.equ(b,D.performance,PP)&&D.set(_=>({performance:{..._.performance,...b}})),l=y,s=!0,this},render(u){return s||this.configure(),CX.updateContainer(g.createElement(Hxt,{store:i,children:u,onCreated:l,rootElement:t}),a,null,()=>{}),i},unmount(){Z_e(t)}}}function Hxt({store:t,children:e,onCreated:n,rootElement:o}){return WM(()=>{const r=t.getState();r.set(i=>({internal:{...i.internal,active:!0}})),n&&n(r),t.getState().events.connected||r.events.connect==null||r.events.connect(o)},[]),g.createElement($_e.Provider,{value:t},e)}function Z_e(t,e){const n=uH.get(t),o=n==null?void 0:n.fiber;if(o){const r=n==null?void 0:n.store.getState();r&&(r.internal.active=!1),CX.updateContainer(null,o,null,()=>{r&&setTimeout(()=>{try{var i,a,l,s;r.events.disconnect==null||r.events.disconnect(),(i=r.gl)==null||(a=i.renderLists)==null||a.dispose==null||a.dispose(),(l=r.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(s=r.gl)!=null&&s.xr&&r.xr.disconnect(),pxt(r),uH.delete(t)}catch{}},500)})}}CX.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:g.version});function RX(){return RX=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0?o=setTimeout(s,e-u):(o=null,n||(l=t.apply(i,r),i=r=null))}var c=function(){i=this,r=arguments,a=Date.now();var u=n&&!o;return o||(o=setTimeout(s,e)),u&&(l=t.apply(i,r),i=r=null),l};return c.clear=function(){o&&(clearTimeout(o),o=null)},c.flush=function(){o&&(l=t.apply(i,r),i=r=null,clearTimeout(o),o=null)},c}Mde.debounce=Mde;var Mxt=Mde;const Kve=ji(Mxt);function Ixt(t){let{debounce:e,scroll:n,polyfill:o,offsetSize:r}=t===void 0?{debounce:0,scroll:!1,offsetSize:!1}:t;const i=o||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,l]=g.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),s=g.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,d=g.useRef(!1);g.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,p,m]=g.useMemo(()=>{const C=()=>{if(!s.current.element)return;const{left:P,top:A,width:S,height:v,bottom:b,right:T,x:R,y:M}=s.current.element.getBoundingClientRect(),D={left:P,top:A,width:S,height:v,bottom:b,right:T,x:R,y:M};s.current.element instanceof HTMLElement&&r&&(D.height=s.current.element.offsetHeight,D.width=s.current.element.offsetWidth),Object.freeze(D),d.current&&!kxt(s.current.lastBounds,D)&&l(s.current.lastBounds=D)};return[C,u?Kve(C,u):C,c?Kve(C,c):C]},[l,r,c,u]);function y(){s.current.scrollContainers&&(s.current.scrollContainers.forEach(C=>C.removeEventListener("scroll",m,!0)),s.current.scrollContainers=null),s.current.resizeObserver&&(s.current.resizeObserver.disconnect(),s.current.resizeObserver=null)}function w(){s.current.element&&(s.current.resizeObserver=new i(m),s.current.resizeObserver.observe(s.current.element),n&&s.current.scrollContainers&&s.current.scrollContainers.forEach(C=>C.addEventListener("scroll",m,{capture:!0,passive:!0})))}const x=C=>{!C||C===s.current.element||(y(),s.current.element=C,s.current.scrollContainers=eVe(C),w())};return Dxt(m,!!n),zxt(p),g.useEffect(()=>{y(),w()},[n,m,p]),g.useEffect(()=>y,[]),[x,a,f]}function zxt(t){g.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Dxt(t,e){g.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function eVe(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:o,overflowY:r}=window.getComputedStyle(t);return[n,o,r].some(i=>i==="auto"||i==="scroll")&&e.push(t),[...e,...eVe(t.parentElement)]}const Ext=["x","y","top","bottom","left","right","width","height"],kxt=(t,e)=>Ext.every(n=>t[n]===e[n]);var Fxt=Object.defineProperty,Lxt=Object.defineProperties,Wxt=Object.getOwnPropertyDescriptors,$ve=Object.getOwnPropertySymbols,Nxt=Object.prototype.hasOwnProperty,Uxt=Object.prototype.propertyIsEnumerable,qve=(t,e,n)=>e in t?Fxt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qve=(t,e)=>{for(var n in e||(e={}))Nxt.call(e,n)&&qve(t,n,e[n]);if($ve)for(var n of $ve(e))Uxt.call(e,n)&&qve(t,n,e[n]);return t},jxt=(t,e)=>Lxt(t,Wxt(e));function tVe(t,e,n){if(!t)return;if(n(t)===!0)return t;let o=t.child;for(;o;){const r=tVe(o,e,n);if(r)return r;o=o.sibling}}function nVe(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const L2e=nVe(g.createContext(null));class oVe extends g.Component{render(){return g.createElement(L2e.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:Zve,ReactCurrentDispatcher:ebe}=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Bxt(){const t=g.useContext(L2e);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=g.useId();return g.useMemo(()=>{for(const o of[Zve==null?void 0:Zve.current,t,t==null?void 0:t.alternate]){if(!o)continue;const r=tVe(o,!1,i=>{let a=i.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[t,e])}function Yxt(){var t,e;const n=Bxt(),[o]=g.useState(()=>new Map);o.clear();let r=n;for(;r;){const i=(t=r.type)==null?void 0:t._context;i&&i!==L2e&&!o.has(i)&&o.set(i,(e=ebe==null?void 0:ebe.current)==null?void 0:e.readContext(nVe(i))),r=r.return}return o}function Oxt(){const t=Yxt();return g.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>o=>g.createElement(e,null,g.createElement(n.Provider,jxt(Qve({},o),{value:t.get(n)}))),e=>g.createElement(oVe,Qve({},e))),[t])}const Oae={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function _xt(t){const{handlePointer:e}=Axt(t);return{priority:1,enabled:!0,compute(n,o,r){o.pointer.set(n.offsetX/o.size.width*2-1,-(n.offsetY/o.size.height)*2+1),o.raycaster.setFromCamera(o.pointer,o.camera)},connected:void 0,handlers:Object.keys(Oae).reduce((n,o)=>({...n,[o]:e(o)}),{}),update:()=>{var n;const{events:o,internal:r}=t.getState();(n=r.lastEvent)!=null&&n.current&&o.handlers&&o.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{var o;const{set:r,events:i}=t.getState();i.disconnect==null||i.disconnect(),r(a=>({events:{...a.events,connected:n}})),Object.entries((o=i.handlers)!=null?o:[]).forEach(([a,l])=>{const[s,c]=Oae[a];n.addEventListener(s,l,{passive:c})})},disconnect:()=>{const{set:n,events:o}=t.getState();if(o.connected){var r;Object.entries((r=o.handlers)!=null?r:[]).forEach(([i,a])=>{if(o&&o.connected instanceof HTMLElement){const[l]=Oae[i];o.connected.removeEventListener(l,a)}}),n(i=>({events:{...i.events,connected:void 0}}))}}}}const Vxt=g.forwardRef(function({children:e,fallback:n,resize:o,style:r,gl:i,events:a=_xt,eventSource:l,eventPrefix:s,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:w,raycaster:x,camera:C,scene:P,onPointerMissed:A,onCreated:S,...v},b){g.useMemo(()=>R7(Z7t),[]);const T=Oxt(),[R,M]=Ixt({scroll:!0,debounce:{scroll:50,resize:0},...o}),D=g.useRef(null),k=g.useRef(null);g.useImperativeHandle(b,()=>D.current);const N=O_e(A),[U,W]=g.useState(!1),[F,E]=g.useState(!1);if(U)throw U;if(F)throw F;const L=g.useRef(null);WM(()=>{const Y=D.current;M.width>0&&M.height>0&&Y&&(L.current||(L.current=Rxt(Y)),L.current.configure({gl:i,events:a,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:w,raycaster:x,camera:C,scene:P,size:M,onPointerMissed:(...O)=>N.current==null?void 0:N.current(...O),onCreated:O=>{O.events.connect==null||O.events.connect(l?uxt(l)?l.current:l:k.current),s&&O.setEvents({compute:(_,G)=>{const Q=_[s+"X"],oe=_[s+"Y"];G.pointer.set(Q/G.size.width*2-1,-(oe/G.size.height)*2+1),G.raycaster.setFromCamera(G.pointer,G.camera)}}),S==null||S(O)}}),L.current.render(g.createElement(T,null,g.createElement(__e,{set:E},g.createElement(g.Suspense,{fallback:g.createElement(dxt,{set:W})},e)))))}),g.useEffect(()=>{const Y=D.current;if(Y)return()=>Z_e(Y)},[]);const j=l?"none":"auto";return g.createElement("div",RX({ref:k,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...r}},v),g.createElement("div",{ref:R,style:{width:"100%",height:"100%"}},g.createElement("canvas",{ref:D,style:{display:"block"}},n)))}),Gxt=g.forwardRef(function(e,n){return g.createElement(oVe,null,g.createElement(Vxt,RX({},e,{ref:n})))});function Xxt(t,e,n){return e=HX(e),nvt(t,rVe()?Reflect.construct(e,n||[],HX(t).constructor):e.apply(t,n))}function rVe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rVe=function(){return!!t})()}function Jxt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}function Kxt(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function $xt(t){var e=Kxt(t,"string");return typeof e=="symbol"?e:String(e)}function qxt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qxt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:10,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"rgba(255, 255, 255, 1)";return qxt(this,e),n=Xxt(this,e,[new CP.SpriteMaterial]),n._text="".concat(o),n._textHeight=r,n._color=i,n._backgroundColor=!1,n._padding=0,n._borderWidth=0,n._borderRadius=0,n._borderColor="white",n._strokeWidth=0,n._strokeColor="white",n._fontFace="system-ui",n._fontSize=90,n._fontWeight="normal",n._canvas=document.createElement("canvas"),n._genCanvas(),n}return Zxt(e,[{key:"text",get:function(){return this._text},set:function(o){this._text=o,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(o){this._textHeight=o,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(o){this._color=o,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(o){this._backgroundColor=o,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(o){this._padding=o,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(o){this._borderWidth=o,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(o){this._borderRadius=o,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(o){this._borderColor=o,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(o){this._fontFace=o,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(o){this._fontSize=o,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(o){this._fontWeight=o,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(o){this._strokeWidth=o,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(o){this._strokeColor=o,this._genCanvas()}},{key:"_genCanvas",value:function(){var o=this,r=this._canvas,i=r.getContext("2d"),a=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],l=a.map(function(b){return b*o.fontSize*.1}),s=Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius],c=s.map(function(b){return b*o.fontSize*.1}),u=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],d=u.map(function(b){return b*o.fontSize*.1}),f=this.text.split(` -`),p="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);i.font=p;var m=Math.max.apply(Math,vO(f.map(function(b){return i.measureText(b).width}))),y=this.fontSize*f.length;if(r.width=m+l[0]*2+d[0]*2,r.height=y+l[1]*2+d[1]*2,this.borderWidth){if(i.strokeStyle=this.borderColor,l[0]){var w=l[0]/2;i.lineWidth=l[0],i.beginPath(),i.moveTo(w,c[0]),i.lineTo(w,r.height-c[3]),i.moveTo(r.width-w,c[1]),i.lineTo(r.width-w,r.height-c[2]),i.stroke()}if(l[1]){var x=l[1]/2;i.lineWidth=l[1],i.beginPath(),i.moveTo(Math.max(l[0],c[0]),x),i.lineTo(r.width-Math.max(l[0],c[1]),x),i.moveTo(Math.max(l[0],c[3]),r.height-x),i.lineTo(r.width-Math.max(l[0],c[2]),r.height-x),i.stroke()}if(this.borderRadius){var C=Math.max.apply(Math,vO(l)),P=C/2;i.lineWidth=C,i.beginPath(),[!!c[0]&&[c[0],P,P,c[0]],!!c[1]&&[r.width-c[1],r.width-P,P,c[1]],!!c[2]&&[r.width-c[2],r.width-P,r.height-P,r.height-c[2]],!!c[3]&&[c[3],P,r.height-P,r.height-c[3]]].filter(function(b){return b}).forEach(function(b){var T=tbe(b,4),R=T[0],M=T[1],D=T[2],k=T[3];i.moveTo(R,D),i.quadraticCurveTo(M,D,M,k)}),i.stroke()}}this.backgroundColor&&(i.fillStyle=this.backgroundColor,this.borderRadius?(i.beginPath(),i.moveTo(l[0],c[0]),[[l[0],c[0],r.width-c[1],l[1],l[1],l[1]],[r.width-l[0],r.width-l[0],r.width-l[0],l[1],c[1],r.height-c[2]],[r.width-l[0],r.width-c[2],c[3],r.height-l[1],r.height-l[1],r.height-l[1]],[l[0],l[0],l[0],r.height-l[1],r.height-c[3],c[0]]].forEach(function(b){var T=tbe(b,6),R=T[0],M=T[1],D=T[2],k=T[3],N=T[4],U=T[5];i.quadraticCurveTo(R,k,M,N),i.lineTo(D,U)}),i.closePath(),i.fill()):i.fillRect(l[0],l[1],r.width-l[0]*2,r.height-l[1]*2)),i.translate.apply(i,vO(l)),i.translate.apply(i,vO(d)),i.font=p,i.fillStyle=this.color,i.textBaseline="bottom";var A=this.strokeWidth>0;A&&(i.lineWidth=this.strokeWidth*this.fontSize/10,i.strokeStyle=this.strokeColor),f.forEach(function(b,T){var R=(m-i.measureText(b).width)/2,M=(T+1)*o.fontSize;A&&i.strokeText(b,R,M),i.fillText(b,R,M)}),this.material.map&&this.material.map.dispose();var S=this.material.map=new CP.Texture(r);S.minFilter=CP.LinearFilter,S.colorSpace=CP.SRGBColorSpace,S.needsUpdate=!0;var v=this.textHeight*f.length+a[1]*2+u[1]*2;this.scale.set(v*r.width/r.height,v,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(o){return CP.Sprite.prototype.copy.call(this,o),this.color=o.color,this.backgroundColor=o.backgroundColor,this.padding=o.padding,this.borderWidth=o.borderWidth,this.borderColor=o.borderColor,this.fontFace=o.fontFace,this.fontSize=o.fontSize,this.fontWeight=o.fontWeight,this.strokeWidth=o.strokeWidth,this.strokeColor=o.strokeColor,this}}]),e}(CP.Sprite);const Bx={type:"change"},_ae={type:"start"},Yx={type:"end"};class cvt extends Sm{constructor(e,n){super(),n===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new ue,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.moveSpeed=1,this.turnSpeed=1,this.keys={MOVE_LEFT:"KeyA",MOVE_RIGHT:"KeyD",MOVE_FORWARD:"KeyW",MOVE_BACKWARD:"KeyS",MOVE_UP:"KeyZ",MOVE_DOWN:"KeyX",ROTATE_LEFT:"ArrowLeft",ROTATE_UP:"ArrowUp",ROTATE_RIGHT:"ArrowRight",ROTATE_DOWN:"ArrowDown"},this.mouseButtons={LEFT:av.ROTATE,MIDDLE:av.DOLLY,RIGHT:av.PAN},this.touches={ONE:lv.ROTATE,TWO:lv.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(Fe){Fe.addEventListener("keydown",Me),this._domElementKeyEvents=Fe,b=!1,T=0},this.removeKeyEvents=function(){o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Me)},this.saveState=function(){o.target0.copy(o.target),o.position0.copy(o.object.position),o.zoom0=o.object.zoom},this.reset=function(){o.target.copy(o.target0),o.object.position.copy(o.position0),o.object.zoom=o.zoom0,o.object.updateProjectionMatrix(),o.dispatchEvent(Bx),o.update(),i=r.NONE},this.update=function(){const Fe=new ue,He=new zs().setFromUnitVectors(e.up,new ue(0,1,0)),Le=He.clone().invert(),Ye=new ue,lt=new zs,Oe=2*Math.PI;return function(){const ht=o.object.position;Fe.copy(ht).sub(o.target),Fe.applyQuaternion(He),l.setFromVector3(Fe),o.autoRotate&&i===r.NONE&&D(R()),o.enableDamping?(l.theta+=s.theta*o.dampingFactor,l.phi+=s.phi*o.dampingFactor):(l.theta+=s.theta,l.phi+=s.phi);let Qe=o.minAzimuthAngle,nt=o.maxAzimuthAngle;return isFinite(Qe)&&isFinite(nt)&&(Qe<-Math.PI?Qe+=Oe:Qe>Math.PI&&(Qe-=Oe),nt<-Math.PI?nt+=Oe:nt>Math.PI&&(nt-=Oe),Qe<=nt?l.theta=Math.max(Qe,Math.min(nt,l.theta)):l.theta=l.theta>(Qe+nt)/2?Math.max(Qe,l.theta):Math.min(nt,l.theta)),l.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=c,l.radius=Math.max(o.minDistance,Math.min(o.maxDistance,l.radius)),o.enableDamping===!0?o.target.addScaledVector(u,o.dampingFactor):o.target.add(u),Fe.setFromSpherical(l),Fe.applyQuaternion(Le),ht.copy(o.target).add(Fe),o.object.lookAt(o.target),o.enableDamping===!0?(s.theta*=1-o.dampingFactor,s.phi*=1-o.dampingFactor,u.multiplyScalar(1-o.dampingFactor)):(s.set(0,0,0),u.set(0,0,0)),c=1,d||Ye.distanceToSquared(o.object.position)>a||8*(1-lt.dot(o.object.quaternion))>a?(o.dispatchEvent(Bx),Ye.copy(o.object.position),lt.copy(o.object.quaternion),d=!1,!0):!1}}(),this.dispose=function(){o.domElement.removeEventListener("contextmenu",Re),o.domElement.removeEventListener("pointerdown",ve),o.domElement.removeEventListener("pointercancel",se),o.domElement.removeEventListener("wheel",Se),o.domElement.removeEventListener("pointermove",ze),o.domElement.removeEventListener("pointerup",Ae),o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Me)};const o=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=r.NONE;const a=1e-6,l=new Pde,s=new Pde;let c=1;const u=new ue;let d=!1;const f=new _t,p=new _t,m=new _t,y=new _t,w=new _t,x=new _t,C=new _t,P=new _t,A=new _t,S=[],v={};let b=!1,T=0;function R(){return 2*Math.PI/60/60*o.autoRotateSpeed}function M(){return Math.pow(.95,o.zoomSpeed)}function D(Fe){s.theta-=Fe}function k(Fe){s.phi-=Fe}const N=function(){const Fe=new ue;return function(Le,Ye){Fe.setFromMatrixColumn(Ye,0),Fe.multiplyScalar(-Le),u.add(Fe)}}(),U=function(){const Fe=new ue;return function(Le,Ye){o.screenSpacePanning===!0?Fe.setFromMatrixColumn(Ye,1):(Fe.setFromMatrixColumn(Ye,0),Fe.crossVectors(o.object.up,Fe)),Fe.multiplyScalar(Le),u.add(Fe)}}(),W=function(){const Fe=new ue;return function(Le,Ye){const lt=o.domElement;if(o.object.isPerspectiveCamera){const Oe=o.object.position;Fe.copy(Oe).sub(o.target);let ut=Fe.length();ut*=Math.tan(o.object.fov/2*Math.PI/180),N(2*Le*ut/lt.clientHeight,o.object.matrix),U(2*Ye*ut/lt.clientHeight,o.object.matrix)}else o.object.isOrthographicCamera?(N(Le*(o.object.right-o.object.left)/o.object.zoom/lt.clientWidth,o.object.matrix),U(Ye*(o.object.top-o.object.bottom)/o.object.zoom/lt.clientHeight,o.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),o.enablePan=!1)}}(),F=function(){const Fe=new ue;return function(Le){const Ye=o.object;Fe.setFromMatrixColumn(Ye.matrix,1),Fe.multiplyScalar(Le*.1),Ye.position.add(Fe),Ye.position.z=Math.max(0,Ye.position.z),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),E=function(){const Fe=new ue;return function(Le){const Ye=o.object;Fe.setFromMatrixColumn(Ye.matrix,0),Fe.crossVectors(Ye.up,Fe),Fe.multiplyScalar(Le*.1),Ye.position.add(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),L=function(){const Fe=new ue;return function(Le){const Ye=o.object;Fe.setFromMatrixColumn(Ye.matrix,0),Fe.multiplyScalar(Le*.1),Ye.position.add(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),j=function(){const Fe=new cn(0,0,0,"ZXY");return function(Le){const Ye=o.object;Fe.setFromQuaternion(Ye.quaternion),Math.abs(Math.abs(Fe.z-T)-Math.PI)<.01&&(b=!b),b?Fe.x-=.01*Le:Fe.x+=.01*Le,Fe.x=Math.max(.1,Fe.x),T=Fe.z,Ye.quaternion.setFromEuler(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),Y=function(){const Fe=new cn(0,0,0,"ZXY");return function(Le){const Ye=o.object;Fe.setFromQuaternion(Ye.quaternion),Fe.z-=.01*Le,Ye.quaternion.setFromEuler(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}();function O(Fe){o.object.isPerspectiveCamera?c/=Fe:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom*Fe)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function _(Fe){o.object.isPerspectiveCamera?c*=Fe:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom/Fe)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function G(Fe){f.set(Fe.clientX,Fe.clientY)}function Q(Fe){C.set(Fe.clientX,Fe.clientY)}function oe(Fe){y.set(Fe.clientX,Fe.clientY)}function ee(Fe){p.set(Fe.clientX,Fe.clientY),m.subVectors(p,f).multiplyScalar(o.rotateSpeed);const He=o.domElement;D(2*Math.PI*m.x/He.clientHeight),k(2*Math.PI*m.y/He.clientHeight),f.copy(p),o.update()}function q(Fe){P.set(Fe.clientX,Fe.clientY),A.subVectors(P,C),A.y>0?O(M()):A.y<0&&_(M()),C.copy(P),o.update()}function ae(Fe){w.set(Fe.clientX,Fe.clientY),x.subVectors(w,y).multiplyScalar(o.panSpeed),W(x.x,x.y),y.copy(w),o.update()}function Z(Fe){Fe.deltaY<0?_(M()):Fe.deltaY>0&&O(M()),o.update()}function ne(Fe){switch(Fe.code){case o.keys.MOVE_FORWARD:E(o.moveSpeed);break;case o.keys.MOVE_BACKWARD:E(-o.moveSpeed);break;case o.keys.MOVE_UP:F(o.moveSpeed);break;case o.keys.MOVE_DOWN:F(-o.moveSpeed);break;case o.keys.MOVE_RIGHT:L(o.moveSpeed);break;case o.keys.MOVE_LEFT:L(-o.moveSpeed);break;case o.keys.ROTATE_UP:j(o.turnSpeed);break;case o.keys.ROTATE_DOWN:j(-o.turnSpeed);break;case o.keys.ROTATE_LEFT:Y(-o.turnSpeed);break;case o.keys.ROTATE_RIGHT:Y(o.turnSpeed);break}}function te(){if(S.length===1)f.set(S[0].pageX,S[0].pageY);else{const Fe=.5*(S[0].pageX+S[1].pageX),He=.5*(S[0].pageY+S[1].pageY);f.set(Fe,He)}}function $(){if(S.length===1)y.set(S[0].pageX,S[0].pageY);else{const Fe=.5*(S[0].pageX+S[1].pageX),He=.5*(S[0].pageY+S[1].pageY);y.set(Fe,He)}}function le(){const Fe=S[0].pageX-S[1].pageX,He=S[0].pageY-S[1].pageY,Le=Math.sqrt(Fe*Fe+He*He);C.set(0,Le)}function de(){o.enableZoom&&le(),o.enablePan&&$()}function he(){o.enableZoom&&le(),o.enableRotate&&te()}function me(Fe){if(S.length===1)p.set(Fe.pageX,Fe.pageY);else{const Le=qe(Fe),Ye=.5*(Fe.pageX+Le.x),lt=.5*(Fe.pageY+Le.y);p.set(Ye,lt)}m.subVectors(p,f).multiplyScalar(o.rotateSpeed);const He=o.domElement;D(2*Math.PI*m.x/He.clientHeight),k(2*Math.PI*m.y/He.clientHeight),f.copy(p)}function ce(Fe){if(S.length===1)w.set(Fe.pageX,Fe.pageY);else{const He=qe(Fe),Le=.5*(Fe.pageX+He.x),Ye=.5*(Fe.pageY+He.y);w.set(Le,Ye)}x.subVectors(w,y).multiplyScalar(o.panSpeed),W(x.x,x.y),y.copy(w)}function Pe(Fe){const He=qe(Fe),Le=Fe.pageX-He.x,Ye=Fe.pageY-He.y,lt=Math.sqrt(Le*Le+Ye*Ye);P.set(0,lt),A.set(0,Math.pow(P.y/C.y,o.zoomSpeed)),O(A.y),C.copy(P)}function pe(Fe){o.enableZoom&&Pe(Fe),o.enablePan&&ce(Fe)}function Ie(Fe){o.enableZoom&&Pe(Fe),o.enableRotate&&me(Fe)}function ve(Fe){o.enabled!==!1&&(S.length===0&&(o.domElement.setPointerCapture(Fe.pointerId),o.domElement.addEventListener("pointermove",ze),o.domElement.addEventListener("pointerup",Ae)),Ne(Fe),Fe.pointerType==="touch"?Ce(Fe):ge(Fe))}function ze(Fe){o.enabled!==!1&&(Fe.pointerType==="touch"?Te(Fe):we(Fe))}function Ae(Fe){_e(Fe),S.length===0&&(o.domElement.releasePointerCapture(Fe.pointerId),o.domElement.removeEventListener("pointermove",ze),o.domElement.removeEventListener("pointerup",Ae)),o.dispatchEvent(Yx),i=r.NONE}function se(Fe){_e(Fe)}function ge(Fe){let He;switch(Fe.button){case 0:He=o.mouseButtons.LEFT;break;case 1:He=o.mouseButtons.MIDDLE;break;case 2:He=o.mouseButtons.RIGHT;break;default:He=-1}switch(He){case av.DOLLY:if(o.enableZoom===!1)return;Q(Fe),i=r.DOLLY;break;case av.ROTATE:if(o.object.isOrthographicCamera){if(o.enablePan===!1)return;oe(Fe),i=r.PAN}else if(Fe.ctrlKey||Fe.metaKey){if(o.enablePan===!1)return;oe(Fe),i=r.PAN}else{if(o.enableRotate===!1)return;G(Fe),i=r.ROTATE}break;case av.PAN:if(Fe.ctrlKey||Fe.metaKey){if(o.enableRotate===!1)return;G(Fe),i=r.ROTATE}else{if(o.enablePan===!1)return;oe(Fe),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(_ae)}function we(Fe){if(o.enabled!==!1)switch(i){case r.ROTATE:if(o.enableRotate===!1)return;ee(Fe);break;case r.DOLLY:if(o.enableZoom===!1)return;q(Fe);break;case r.PAN:if(o.enablePan===!1)return;ae(Fe);break}}function Se(Fe){o.enabled===!1||o.enableZoom===!1||i!==r.NONE||(Fe.preventDefault(),o.dispatchEvent(_ae),Z(Fe),o.dispatchEvent(Yx))}function Me(Fe){o.enabled===!1||o.enablePan===!1||ne(Fe)}function Ce(Fe){switch(Ue(Fe),S.length){case 1:switch(o.touches.ONE){case lv.ROTATE:if(o.enableRotate===!1)return;te(),i=r.TOUCH_ROTATE;break;case lv.PAN:if(o.enablePan===!1)return;$(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(o.touches.TWO){case lv.DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;de(),i=r.TOUCH_DOLLY_PAN;break;case lv.DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;he(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(_ae)}function Te(Fe){switch(Ue(Fe),i){case r.TOUCH_ROTATE:if(o.enableRotate===!1)return;me(Fe),o.update();break;case r.TOUCH_PAN:if(o.enablePan===!1)return;ce(Fe),o.update();break;case r.TOUCH_DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;pe(Fe),o.update();break;case r.TOUCH_DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;Ie(Fe),o.update();break;default:i=r.NONE}}function Re(Fe){o.enabled!==!1&&Fe.preventDefault()}function Ne(Fe){S.push(Fe)}function _e(Fe){delete v[Fe.pointerId];for(let He=0;He=4){this.makeEmpty();for(let n=0,o=e.length;nthis.tolerance)return!1;return!0}intersectRay(e,n){const o=this.faces;let r=-1/0,i=1/0;for(let a=0,l=o.length;a0&&u>=0)return null;const d=u!==0?-c/u:0;if(!(d<=0)&&(u>0?i=Math.min(d,i):r=Math.max(d,r),r>i))return null}return r!==-1/0?e.at(r,n):e.at(i,n),n}intersectsRay(e){return this.intersectRay(e,dvt)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,n){return e.face=n,n.outside===null?this.assigned.append(e):this.assigned.insertBefore(n.outside,e),n.outside=e,this}removeVertexFromFace(e,n){return e===n.outside&&(e.next!==null&&e.next.face===n?n.outside=e.next:n.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const n=e.outside;let o=e.outside;for(;o.next!==null&&o.next.face===e;)o=o.next;return this.assigned.removeSubList(n,o),n.prev=o.next=null,e.outside=null,n}}deleteFaceVertices(e,n){const o=this.removeAllVerticesFromFace(e);if(o!==void 0)if(n===void 0)this.unassigned.appendChain(o);else{let r=o;do{const i=r.next;n.distanceToPoint(r.point)>this.tolerance?this.addVertexToFace(r,n):this.unassigned.append(r),r=i}while(r!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let n=this.unassigned.first();do{const o=n.next;let r=this.tolerance,i=null;for(let a=0;ar&&(r=s,i=l),r>1e3*this.tolerance)break}}i!==null&&this.addVertexToFace(n,i),n=o}while(n!==null)}return this}computeExtremes(){const e=new ue,n=new ue,o=[],r=[];for(let i=0;i<3;i++)o[i]=r[i]=this.vertices[0];e.copy(this.vertices[0].point),n.copy(this.vertices[0].point);for(let i=0,a=this.vertices.length;in.getComponent(c)&&(n.setComponent(c,s.getComponent(c)),r[c]=l)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(n.x))+Math.max(Math.abs(e.y),Math.abs(n.y))+Math.max(Math.abs(e.z),Math.abs(n.z))),{min:o,max:r}}computeInitialHull(){const e=this.vertices,n=this.computeExtremes(),o=n.min,r=n.max;let i=0,a=0;for(let f=0;f<3;f++){const p=r[f].point.getComponent(f)-o[f].point.getComponent(f);p>i&&(i=p,a=f)}const l=o[a],s=r[a];let c,u;i=0,nbe.set(l.point,s.point);for(let f=0,p=this.vertices.length;fi&&(i=y,c=m)}}i=-1,Vae.setFromCoplanarPoints(l.point,s.point,c.point);for(let f=0,p=this.vertices.length;fi&&(i=y,u=m)}}const d=[];if(Vae.distanceToPoint(u.point)<0){d.push(G2.create(l,s,c),G2.create(u,s,l),G2.create(u,c,s),G2.create(u,l,c));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge(p)),d[f+1].getEdge(1).setTwin(d[p+1].getEdge(0))}}else{d.push(G2.create(l,c,s),G2.create(u,l,s),G2.create(u,s,c),G2.create(u,c,l));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge((3-f)%3)),d[f+1].getEdge(0).setTwin(d[p+1].getEdge(1))}}for(let f=0;f<4;f++)this.faces.push(d[f]);for(let f=0,p=e.length;fi&&(i=x,y=this.faces[w])}y!==null&&this.addVertexToFace(m,y)}}return this}reindexFaces(){const e=[];for(let n=0;nn&&(n=i,e=r),r=r.next}while(r!==null&&r.face===o);return e}}computeHorizon(e,n,o,r){this.deleteFaceVertices(o),o.mark=uvt;let i;n===null?i=n=o.getEdge(0):i=n.next;do{const a=i.twin,l=a.face;l.mark===QV&&(l.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,a,l,r):r.push(i)),i=i.next}while(i!==n);return this}addAdjoiningFace(e,n){const o=G2.create(e,n.tail(),n.head());return this.faces.push(o),o.getEdge(-1).setTwin(n.twin),o.getEdge(0)}addNewFaces(e,n){this.newFaces=[];let o=null,r=null;for(let i=0;i0;)n=n.next,e--;for(;e<0;)n=n.prev,e++;return n}compute(){const e=this.edge.tail(),n=this.edge.head(),o=this.edge.next.head();return bO.set(e.point,n.point,o.point),bO.getNormal(this.normal),bO.getMidpoint(this.midpoint),this.area=bO.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class Gae{constructor(e,n){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=n}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class hvt{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class rbe{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,n){return n.prev=e.prev,n.next=e,n.prev===null?this.head=n:n.prev.next=n,e.prev=n,this}insertAfter(e,n){return n.prev=e,n.next=e.next,n.next===null?this.tail=n:n.next.prev=n,e.next=n,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,n){return e.prev===null?this.head=n.next:e.prev.next=n.next,n.next===null?this.tail=e.prev:n.next.prev=e.prev,this}isEmpty(){return this.head===null}}class Dde extends Ni{constructor(e,n,o){super();const r=[],i=[],a=[],l=new cn(0,0,n),c=new fvt().setFromPoints(e).faces;for(let u=0;u0;A&&(i.lineWidth=this.strokeWidth*this.fontSize/10,i.strokeStyle=this.strokeColor),f.forEach(function(b,T){var R=(m-i.measureText(b).width)/2,M=(T+1)*o.fontSize;A&&i.strokeText(b,R,M),i.fillText(b,R,M)}),this.material.map&&this.material.map.dispose();var S=this.material.map=new CP.Texture(r);S.minFilter=CP.LinearFilter,S.colorSpace=CP.SRGBColorSpace,S.needsUpdate=!0;var v=this.textHeight*f.length+a[1]*2+u[1]*2;this.scale.set(v*r.width/r.height,v,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(o){return CP.Sprite.prototype.copy.call(this,o),this.color=o.color,this.backgroundColor=o.backgroundColor,this.padding=o.padding,this.borderWidth=o.borderWidth,this.borderColor=o.borderColor,this.fontFace=o.fontFace,this.fontSize=o.fontSize,this.fontWeight=o.fontWeight,this.strokeWidth=o.strokeWidth,this.strokeColor=o.strokeColor,this}}]),e}(CP.Sprite);const Bx={type:"change"},_ae={type:"start"},Yx={type:"end"};class cvt extends Sm{constructor(e,n){super(),n===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new ue,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.moveSpeed=1,this.turnSpeed=1,this.keys={MOVE_LEFT:"KeyA",MOVE_RIGHT:"KeyD",MOVE_FORWARD:"KeyW",MOVE_BACKWARD:"KeyS",MOVE_UP:"KeyZ",MOVE_DOWN:"KeyX",ROTATE_LEFT:"ArrowLeft",ROTATE_UP:"ArrowUp",ROTATE_RIGHT:"ArrowRight",ROTATE_DOWN:"ArrowDown"},this.mouseButtons={LEFT:av.ROTATE,MIDDLE:av.DOLLY,RIGHT:av.PAN},this.touches={ONE:lv.ROTATE,TWO:lv.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(Fe){Fe.addEventListener("keydown",Me),this._domElementKeyEvents=Fe,b=!1,T=0},this.removeKeyEvents=function(){o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Me)},this.saveState=function(){o.target0.copy(o.target),o.position0.copy(o.object.position),o.zoom0=o.object.zoom},this.reset=function(){o.target.copy(o.target0),o.object.position.copy(o.position0),o.object.zoom=o.zoom0,o.object.updateProjectionMatrix(),o.dispatchEvent(Bx),o.update(),i=r.NONE},this.update=function(){const Fe=new ue,He=new zs().setFromUnitVectors(e.up,new ue(0,1,0)),Le=He.clone().invert(),Ye=new ue,lt=new zs,Oe=2*Math.PI;return function(){const ht=o.object.position;Fe.copy(ht).sub(o.target),Fe.applyQuaternion(He),l.setFromVector3(Fe),o.autoRotate&&i===r.NONE&&D(R()),o.enableDamping?(l.theta+=s.theta*o.dampingFactor,l.phi+=s.phi*o.dampingFactor):(l.theta+=s.theta,l.phi+=s.phi);let Qe=o.minAzimuthAngle,nt=o.maxAzimuthAngle;return isFinite(Qe)&&isFinite(nt)&&(Qe<-Math.PI?Qe+=Oe:Qe>Math.PI&&(Qe-=Oe),nt<-Math.PI?nt+=Oe:nt>Math.PI&&(nt-=Oe),Qe<=nt?l.theta=Math.max(Qe,Math.min(nt,l.theta)):l.theta=l.theta>(Qe+nt)/2?Math.max(Qe,l.theta):Math.min(nt,l.theta)),l.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=c,l.radius=Math.max(o.minDistance,Math.min(o.maxDistance,l.radius)),o.enableDamping===!0?o.target.addScaledVector(u,o.dampingFactor):o.target.add(u),Fe.setFromSpherical(l),Fe.applyQuaternion(Le),ht.copy(o.target).add(Fe),o.object.lookAt(o.target),o.enableDamping===!0?(s.theta*=1-o.dampingFactor,s.phi*=1-o.dampingFactor,u.multiplyScalar(1-o.dampingFactor)):(s.set(0,0,0),u.set(0,0,0)),c=1,d||Ye.distanceToSquared(o.object.position)>a||8*(1-lt.dot(o.object.quaternion))>a?(o.dispatchEvent(Bx),Ye.copy(o.object.position),lt.copy(o.object.quaternion),d=!1,!0):!1}}(),this.dispose=function(){o.domElement.removeEventListener("contextmenu",Re),o.domElement.removeEventListener("pointerdown",ve),o.domElement.removeEventListener("pointercancel",se),o.domElement.removeEventListener("wheel",Se),o.domElement.removeEventListener("pointermove",ze),o.domElement.removeEventListener("pointerup",Ae),o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Me)};const o=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=r.NONE;const a=1e-6,l=new Pde,s=new Pde;let c=1;const u=new ue;let d=!1;const f=new _t,p=new _t,m=new _t,y=new _t,w=new _t,x=new _t,C=new _t,P=new _t,A=new _t,S=[],v={};let b=!1,T=0;function R(){return 2*Math.PI/60/60*o.autoRotateSpeed}function M(){return Math.pow(.95,o.zoomSpeed)}function D(Fe){s.theta-=Fe}function k(Fe){s.phi-=Fe}const N=function(){const Fe=new ue;return function(Le,Ye){Fe.setFromMatrixColumn(Ye,0),Fe.multiplyScalar(-Le),u.add(Fe)}}(),U=function(){const Fe=new ue;return function(Le,Ye){o.screenSpacePanning===!0?Fe.setFromMatrixColumn(Ye,1):(Fe.setFromMatrixColumn(Ye,0),Fe.crossVectors(o.object.up,Fe)),Fe.multiplyScalar(Le),u.add(Fe)}}(),W=function(){const Fe=new ue;return function(Le,Ye){const lt=o.domElement;if(o.object.isPerspectiveCamera){const Oe=o.object.position;Fe.copy(Oe).sub(o.target);let ut=Fe.length();ut*=Math.tan(o.object.fov/2*Math.PI/180),N(2*Le*ut/lt.clientHeight,o.object.matrix),U(2*Ye*ut/lt.clientHeight,o.object.matrix)}else o.object.isOrthographicCamera?(N(Le*(o.object.right-o.object.left)/o.object.zoom/lt.clientWidth,o.object.matrix),U(Ye*(o.object.top-o.object.bottom)/o.object.zoom/lt.clientHeight,o.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),o.enablePan=!1)}}(),F=function(){const Fe=new ue;return function(Le){const Ye=o.object;Fe.setFromMatrixColumn(Ye.matrix,1),Fe.multiplyScalar(Le*.1),Ye.position.add(Fe),Ye.position.z=Math.max(0,Ye.position.z),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),E=function(){const Fe=new ue;return function(Le){const Ye=o.object;Fe.setFromMatrixColumn(Ye.matrix,0),Fe.crossVectors(Ye.up,Fe),Fe.multiplyScalar(Le*.1),Ye.position.add(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),L=function(){const Fe=new ue;return function(Le){const Ye=o.object;Fe.setFromMatrixColumn(Ye.matrix,0),Fe.multiplyScalar(Le*.1),Ye.position.add(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),j=function(){const Fe=new cn(0,0,0,"ZXY");return function(Le){const Ye=o.object;Fe.setFromQuaternion(Ye.quaternion),Math.abs(Math.abs(Fe.z-T)-Math.PI)<.01&&(b=!b),b?Fe.x-=.01*Le:Fe.x+=.01*Le,Fe.x=Math.max(.1,Fe.x),T=Fe.z,Ye.quaternion.setFromEuler(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}(),Y=function(){const Fe=new cn(0,0,0,"ZXY");return function(Le){const Ye=o.object;Fe.setFromQuaternion(Ye.quaternion),Fe.z-=.01*Le,Ye.quaternion.setFromEuler(Fe),o.dispatchEvent(Bx),o.dispatchEvent(Yx)}}();function O(Fe){o.object.isPerspectiveCamera?c/=Fe:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom*Fe)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function _(Fe){o.object.isPerspectiveCamera?c*=Fe:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom/Fe)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function G(Fe){f.set(Fe.clientX,Fe.clientY)}function Q(Fe){C.set(Fe.clientX,Fe.clientY)}function oe(Fe){y.set(Fe.clientX,Fe.clientY)}function ee(Fe){p.set(Fe.clientX,Fe.clientY),m.subVectors(p,f).multiplyScalar(o.rotateSpeed);const He=o.domElement;D(2*Math.PI*m.x/He.clientHeight),k(2*Math.PI*m.y/He.clientHeight),f.copy(p),o.update()}function $(Fe){P.set(Fe.clientX,Fe.clientY),A.subVectors(P,C),A.y>0?O(M()):A.y<0&&_(M()),C.copy(P),o.update()}function ae(Fe){w.set(Fe.clientX,Fe.clientY),x.subVectors(w,y).multiplyScalar(o.panSpeed),W(x.x,x.y),y.copy(w),o.update()}function Z(Fe){Fe.deltaY<0?_(M()):Fe.deltaY>0&&O(M()),o.update()}function ne(Fe){switch(Fe.code){case o.keys.MOVE_FORWARD:E(o.moveSpeed);break;case o.keys.MOVE_BACKWARD:E(-o.moveSpeed);break;case o.keys.MOVE_UP:F(o.moveSpeed);break;case o.keys.MOVE_DOWN:F(-o.moveSpeed);break;case o.keys.MOVE_RIGHT:L(o.moveSpeed);break;case o.keys.MOVE_LEFT:L(-o.moveSpeed);break;case o.keys.ROTATE_UP:j(o.turnSpeed);break;case o.keys.ROTATE_DOWN:j(-o.turnSpeed);break;case o.keys.ROTATE_LEFT:Y(-o.turnSpeed);break;case o.keys.ROTATE_RIGHT:Y(o.turnSpeed);break}}function te(){if(S.length===1)f.set(S[0].pageX,S[0].pageY);else{const Fe=.5*(S[0].pageX+S[1].pageX),He=.5*(S[0].pageY+S[1].pageY);f.set(Fe,He)}}function q(){if(S.length===1)y.set(S[0].pageX,S[0].pageY);else{const Fe=.5*(S[0].pageX+S[1].pageX),He=.5*(S[0].pageY+S[1].pageY);y.set(Fe,He)}}function le(){const Fe=S[0].pageX-S[1].pageX,He=S[0].pageY-S[1].pageY,Le=Math.sqrt(Fe*Fe+He*He);C.set(0,Le)}function de(){o.enableZoom&&le(),o.enablePan&&q()}function he(){o.enableZoom&&le(),o.enableRotate&&te()}function me(Fe){if(S.length===1)p.set(Fe.pageX,Fe.pageY);else{const Le=qe(Fe),Ye=.5*(Fe.pageX+Le.x),lt=.5*(Fe.pageY+Le.y);p.set(Ye,lt)}m.subVectors(p,f).multiplyScalar(o.rotateSpeed);const He=o.domElement;D(2*Math.PI*m.x/He.clientHeight),k(2*Math.PI*m.y/He.clientHeight),f.copy(p)}function ce(Fe){if(S.length===1)w.set(Fe.pageX,Fe.pageY);else{const He=qe(Fe),Le=.5*(Fe.pageX+He.x),Ye=.5*(Fe.pageY+He.y);w.set(Le,Ye)}x.subVectors(w,y).multiplyScalar(o.panSpeed),W(x.x,x.y),y.copy(w)}function Pe(Fe){const He=qe(Fe),Le=Fe.pageX-He.x,Ye=Fe.pageY-He.y,lt=Math.sqrt(Le*Le+Ye*Ye);P.set(0,lt),A.set(0,Math.pow(P.y/C.y,o.zoomSpeed)),O(A.y),C.copy(P)}function pe(Fe){o.enableZoom&&Pe(Fe),o.enablePan&&ce(Fe)}function Ie(Fe){o.enableZoom&&Pe(Fe),o.enableRotate&&me(Fe)}function ve(Fe){o.enabled!==!1&&(S.length===0&&(o.domElement.setPointerCapture(Fe.pointerId),o.domElement.addEventListener("pointermove",ze),o.domElement.addEventListener("pointerup",Ae)),Ne(Fe),Fe.pointerType==="touch"?Ce(Fe):ge(Fe))}function ze(Fe){o.enabled!==!1&&(Fe.pointerType==="touch"?Te(Fe):we(Fe))}function Ae(Fe){_e(Fe),S.length===0&&(o.domElement.releasePointerCapture(Fe.pointerId),o.domElement.removeEventListener("pointermove",ze),o.domElement.removeEventListener("pointerup",Ae)),o.dispatchEvent(Yx),i=r.NONE}function se(Fe){_e(Fe)}function ge(Fe){let He;switch(Fe.button){case 0:He=o.mouseButtons.LEFT;break;case 1:He=o.mouseButtons.MIDDLE;break;case 2:He=o.mouseButtons.RIGHT;break;default:He=-1}switch(He){case av.DOLLY:if(o.enableZoom===!1)return;Q(Fe),i=r.DOLLY;break;case av.ROTATE:if(o.object.isOrthographicCamera){if(o.enablePan===!1)return;oe(Fe),i=r.PAN}else if(Fe.ctrlKey||Fe.metaKey){if(o.enablePan===!1)return;oe(Fe),i=r.PAN}else{if(o.enableRotate===!1)return;G(Fe),i=r.ROTATE}break;case av.PAN:if(Fe.ctrlKey||Fe.metaKey){if(o.enableRotate===!1)return;G(Fe),i=r.ROTATE}else{if(o.enablePan===!1)return;oe(Fe),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(_ae)}function we(Fe){if(o.enabled!==!1)switch(i){case r.ROTATE:if(o.enableRotate===!1)return;ee(Fe);break;case r.DOLLY:if(o.enableZoom===!1)return;$(Fe);break;case r.PAN:if(o.enablePan===!1)return;ae(Fe);break}}function Se(Fe){o.enabled===!1||o.enableZoom===!1||i!==r.NONE||(Fe.preventDefault(),o.dispatchEvent(_ae),Z(Fe),o.dispatchEvent(Yx))}function Me(Fe){o.enabled===!1||o.enablePan===!1||ne(Fe)}function Ce(Fe){switch(Ue(Fe),S.length){case 1:switch(o.touches.ONE){case lv.ROTATE:if(o.enableRotate===!1)return;te(),i=r.TOUCH_ROTATE;break;case lv.PAN:if(o.enablePan===!1)return;q(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(o.touches.TWO){case lv.DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;de(),i=r.TOUCH_DOLLY_PAN;break;case lv.DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;he(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(_ae)}function Te(Fe){switch(Ue(Fe),i){case r.TOUCH_ROTATE:if(o.enableRotate===!1)return;me(Fe),o.update();break;case r.TOUCH_PAN:if(o.enablePan===!1)return;ce(Fe),o.update();break;case r.TOUCH_DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;pe(Fe),o.update();break;case r.TOUCH_DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;Ie(Fe),o.update();break;default:i=r.NONE}}function Re(Fe){o.enabled!==!1&&Fe.preventDefault()}function Ne(Fe){S.push(Fe)}function _e(Fe){delete v[Fe.pointerId];for(let He=0;He=4){this.makeEmpty();for(let n=0,o=e.length;nthis.tolerance)return!1;return!0}intersectRay(e,n){const o=this.faces;let r=-1/0,i=1/0;for(let a=0,l=o.length;a0&&u>=0)return null;const d=u!==0?-c/u:0;if(!(d<=0)&&(u>0?i=Math.min(d,i):r=Math.max(d,r),r>i))return null}return r!==-1/0?e.at(r,n):e.at(i,n),n}intersectsRay(e){return this.intersectRay(e,dvt)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,n){return e.face=n,n.outside===null?this.assigned.append(e):this.assigned.insertBefore(n.outside,e),n.outside=e,this}removeVertexFromFace(e,n){return e===n.outside&&(e.next!==null&&e.next.face===n?n.outside=e.next:n.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const n=e.outside;let o=e.outside;for(;o.next!==null&&o.next.face===e;)o=o.next;return this.assigned.removeSubList(n,o),n.prev=o.next=null,e.outside=null,n}}deleteFaceVertices(e,n){const o=this.removeAllVerticesFromFace(e);if(o!==void 0)if(n===void 0)this.unassigned.appendChain(o);else{let r=o;do{const i=r.next;n.distanceToPoint(r.point)>this.tolerance?this.addVertexToFace(r,n):this.unassigned.append(r),r=i}while(r!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let n=this.unassigned.first();do{const o=n.next;let r=this.tolerance,i=null;for(let a=0;ar&&(r=s,i=l),r>1e3*this.tolerance)break}}i!==null&&this.addVertexToFace(n,i),n=o}while(n!==null)}return this}computeExtremes(){const e=new ue,n=new ue,o=[],r=[];for(let i=0;i<3;i++)o[i]=r[i]=this.vertices[0];e.copy(this.vertices[0].point),n.copy(this.vertices[0].point);for(let i=0,a=this.vertices.length;in.getComponent(c)&&(n.setComponent(c,s.getComponent(c)),r[c]=l)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(n.x))+Math.max(Math.abs(e.y),Math.abs(n.y))+Math.max(Math.abs(e.z),Math.abs(n.z))),{min:o,max:r}}computeInitialHull(){const e=this.vertices,n=this.computeExtremes(),o=n.min,r=n.max;let i=0,a=0;for(let f=0;f<3;f++){const p=r[f].point.getComponent(f)-o[f].point.getComponent(f);p>i&&(i=p,a=f)}const l=o[a],s=r[a];let c,u;i=0,nbe.set(l.point,s.point);for(let f=0,p=this.vertices.length;fi&&(i=y,c=m)}}i=-1,Vae.setFromCoplanarPoints(l.point,s.point,c.point);for(let f=0,p=this.vertices.length;fi&&(i=y,u=m)}}const d=[];if(Vae.distanceToPoint(u.point)<0){d.push(G2.create(l,s,c),G2.create(u,s,l),G2.create(u,c,s),G2.create(u,l,c));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge(p)),d[f+1].getEdge(1).setTwin(d[p+1].getEdge(0))}}else{d.push(G2.create(l,c,s),G2.create(u,l,s),G2.create(u,s,c),G2.create(u,c,l));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge((3-f)%3)),d[f+1].getEdge(0).setTwin(d[p+1].getEdge(1))}}for(let f=0;f<4;f++)this.faces.push(d[f]);for(let f=0,p=e.length;fi&&(i=x,y=this.faces[w])}y!==null&&this.addVertexToFace(m,y)}}return this}reindexFaces(){const e=[];for(let n=0;nn&&(n=i,e=r),r=r.next}while(r!==null&&r.face===o);return e}}computeHorizon(e,n,o,r){this.deleteFaceVertices(o),o.mark=uvt;let i;n===null?i=n=o.getEdge(0):i=n.next;do{const a=i.twin,l=a.face;l.mark===QV&&(l.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,a,l,r):r.push(i)),i=i.next}while(i!==n);return this}addAdjoiningFace(e,n){const o=G2.create(e,n.tail(),n.head());return this.faces.push(o),o.getEdge(-1).setTwin(n.twin),o.getEdge(0)}addNewFaces(e,n){this.newFaces=[];let o=null,r=null;for(let i=0;i0;)n=n.next,e--;for(;e<0;)n=n.prev,e++;return n}compute(){const e=this.edge.tail(),n=this.edge.head(),o=this.edge.next.head();return bO.set(e.point,n.point,o.point),bO.getNormal(this.normal),bO.getMidpoint(this.midpoint),this.area=bO.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class Gae{constructor(e,n){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=n}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class hvt{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class rbe{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,n){return n.prev=e.prev,n.next=e,n.prev===null?this.head=n:n.prev.next=n,e.prev=n,this}insertAfter(e,n){return n.prev=e,n.next=e.next,n.next===null?this.tail=n:n.next.prev=n,e.next=n,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,n){return e.prev===null?this.head=n.next:e.prev.next=n.next,n.next===null?this.tail=e.prev:n.next.prev=e.prev,this}isEmpty(){return this.head===null}}class Dde extends Ni{constructor(e,n,o){super();const r=[],i=[],a=[],l=new cn(0,0,n),c=new fvt().setFromPoints(e).faces;for(let u=0;u(t.FILES="Files",t.LOG_DATA="Log Data",t))(MX||{}),yc=(t=>(t.UNKNOWN="UNKNOWN SCHOOL",t.SCHOOL1="SCHOOL 1",t.SCHOOL2="SCHOOL 2",t.SCHOOL3="SCHOOL 3",t.SCHOOL4="SCHOOL 4",t.SCHOOL5="SCHOOL 5",t))(yc||{}),$a=(t=>(t.UNKNOWN="UNKNOWN CLASS",t.CLASS1="CLASS 1",t.CLASS2="CLASS 2",t.CLASS3="CLASS 3",t.CLASS4="CLASS 4",t.CLASS5="CLASS 5",t.CLASS6="CLASS 6",t.CLASS7="CLASS 7",t.CLASS8="CLASS 8",t.CLASS9="CLASS 9",t))($a||{}),$9=(t=>(t[t.ALL=0]="ALL",t[t.INDIVIDUALS=1]="INDIVIDUALS",t[t.GROUPS=2]="GROUPS",t))($9||{}),ga=(t=>(t.UNKNOWN="Unknown",t.UNDER_CONSTRUCTION="Under Construction",t.RESIDENTIAL_BUILDING="Residential Building",t.COMMERCIAL_BUILDING="Commercial Building",t.SCHOOL_BUILDING="School Building",t.TOURIST_ATTRACTION="Tourist Attraction",t.PHOTOVOLTAIC="Photovoltaic",t.PARABOLIC_DISH="Parabolic Dish",t.PARABOLIC_TROUGH="Parabolic Trough",t.FRESNEL_REFLECTOR="Fresnel Reflector",t.SOLAR_POWER_TOWER="Solar Power Tower",t.WIND_TURBINE="Wind Turbine",t.COLOCATION_PROJECTS="Colocation Projects",t))(ga||{}),$c=(t=>(t[t.COMPLETE=0]="COMPLETE",t[t.ROOF_MISSING=1]="ROOF_MISSING",t[t.WALL_DISJOINED=2]="WALL_DISJOINED",t[t.WALL_EMPTY=3]="WALL_EMPTY",t))($c||{}),Pi=(t=>(t.SOLAR_PANEL_TILT_ANGLE="Solar Panel Tilt Angle",t.SOLAR_PANEL_ARRAY="Solar Panel Array",t))(Pi||{}),Mo=(t=>(t[t.DAILY_TOTAL_OUTPUT=1]="DAILY_TOTAL_OUTPUT",t[t.YEARLY_TOTAL_OUTPUT=2]="YEARLY_TOTAL_OUTPUT",t[t.DAILY_AVERAGE_OUTPUT=3]="DAILY_AVERAGE_OUTPUT",t[t.YEARLY_AVERAGE_OUTPUT=4]="YEARLY_AVERAGE_OUTPUT",t[t.DAILY_PROFIT=5]="DAILY_PROFIT",t[t.YEARLY_PROFIT=6]="YEARLY_PROFIT",t))(Mo||{}),ec=(t=>(t[t.GENETIC_ALGORITHM=1]="GENETIC_ALGORITHM",t[t.PARTICLE_SWARM_OPTIMIZATION=2]="PARTICLE_SWARM_OPTIMIZATION",t))(ec||{}),by=(t=>(t[t.ROULETTE_WHEEL=1]="ROULETTE_WHEEL",t[t.TOURNAMENT=2]="TOURNAMENT",t))(by||{}),As=(t=>(t[t.GLOBAL_SEARCH_UNIFORM_SELECTION=1]="GLOBAL_SEARCH_UNIFORM_SELECTION",t[t.LOCAL_SEARCH_RANDOM_OPTIMIZATION=2]="LOCAL_SEARCH_RANDOM_OPTIMIZATION",t[t.GLOBAL_SEARCH_FITNESS_SHARING=3]="GLOBAL_SEARCH_FITNESS_SHARING",t))(As||{}),Ap=(t=>(t[t.Solid=1]="Solid",t[t.Dashed=2]="Dashed",t[t.Dotted=3]="Dotted",t))(Ap||{}),j2=(t=>(t[t.One=1]="One",t[t.Two=2]="Two",t[t.Three=3]="Three",t[t.Four=4]="Four",t[t.Five=5]="Five",t))(j2||{}),Dl=(t=>(t[t.Line=1]="Line",t[t.Area=2]="Area",t))(Dl||{}),bi=(t=>(t[t.HourlyTemperatures=1]="HourlyTemperatures",t[t.MonthlyTemperatures=2]="MonthlyTemperatures",t[t.SunshineHours=3]="SunshineHours",t[t.DaylightData=4]="DaylightData",t[t.ClearnessData=5]="ClearnessData",t[t.YearlyRadiationSensorData=6]="YearlyRadiationSensorData",t[t.DailyRadiationSensorData=7]="DailyRadiationSensorData",t[t.YearlyPvYield=8]="YearlyPvYield",t[t.DailyPvYield=9]="DailyPvYield",t[t.YearlyParabolicTroughYield=10]="YearlyParabolicTroughYield",t[t.DailyParabolicTroughYield=11]="DailyParabolicTroughYield",t[t.YearlyParabolicDishYield=12]="YearlyParabolicDishYield",t[t.DailyParabolicDishYield=13]="DailyParabolicDishYield",t[t.YearlyFresnelReflectorYield=14]="YearlyFresnelReflectorYield",t[t.DailyFresnelReflectorYield=15]="DailyFresnelReflectorYield",t[t.YearlyHeliostatYield=16]="YearlyHeliostatYield",t[t.DailyHeliostatYield=17]="DailyHeliostatYield",t[t.YearlyUpdraftTowerYield=18]="YearlyUpdraftTowerYield",t[t.DailyUpdraftTowerYield=19]="DailyUpdraftTowerYield",t[t.YearlyBuildingEnergy=20]="YearlyBuildingEnergy",t[t.DailyBuildingEnergy=21]="DailyBuildingEnergy",t))(bi||{}),qs=(t=>(t.Default="Default",t.Desert="Desert",t.Dune="Dune",t.Forest="Forest",t.Grassland="Grassland",t.Hill="Hill",t.Lake="Lake",t.Mountain="Mountain",t.Rural="Rural",t))(qs||{}),a5=(t=>(t[t.Sinusoidal=1]="Sinusoidal",t[t.PartonLogan=2]="PartonLogan",t))(a5||{}),G9=(t=>(t.English="English",t.ChineseSimplified="简体中文",t.ChineseTraditional="繁体中文",t.Turkish="Türkçe",t.Spanish="Español",t.Ukrainian="Українська",t))(G9||{}),z=(t=>(t.Sky="Sky",t.Ground="Ground",t.Foundation="Foundation",t.Wall="Wall",t.Window="Window",t.Door="Door",t.Roof="Roof",t.PyramidRoof="Pyramid Roof",t.GableRoof="Gable Roof",t.HipRoof="Hip Roof",t.GambrelRoof="Gambrel Roof",t.MansardRoof="Mansard Roof",t.Sensor="Sensor",t.SolarPanel="Solar Panel",t.SolarWaterHeater="Solar Water Heater",t.ParabolicDish="Parabolic Dish",t.ParabolicTrough="Parabolic Trough",t.FresnelReflector="Fresnel Reflector",t.Heliostat="Heliostat",t.WindTurbine="Wind Turbine",t.VerticalAxisWindTurbine="Vertical Axis Wind Turbine",t.Cuboid="Cuboid",t.Human="Human",t.Tree="Tree",t.Flower="Flower",t.Polygon="Polygon",t.PolygonVertex="Polygon Vertex",t.Light="Light",t.BatteryStorage="Battery Storage",t.None="None",t))(z||{}),pf=(t=>(t[t.CentralPole=1]="CentralPole",t[t.CentralPoleWithTripod=2]="CentralPoleWithTripod",t[t.Quadrupod=3]="Quadrupod",t))(pf||{}),Nn=(t=>(t[t.None=0]="None",t[t.FocusPipe=1]="FocusPipe",t[t.FocusTower=2]="FocusTower",t[t.UpdraftTower=3]="UpdraftTower",t))(Nn||{}),wc=(t=>(t[t.None=0]="None",t[t.Bicolor=1]="Bicolor",t[t.Striped=2]="Striped",t))(wc||{}),er=(t=>(t.Select="Select",t.Move="Move",t.Resize="Resize",t.Rotate="Rotate",t.ContextMenu="ContextMenu",t))(er||{}),Ho=(t=>(t.Default="Move Handle",t.Lower="Move Handle Lower",t.Upper="Move Handle Upper",t.Left="Move Handle Left",t.Right="Move Handle Right",t.Top="Move Handle Top",t.Mid="Move Handle Mid",t))(Ho||{}),Sl=(t=>(t.Left="Left",t.Right="Right",t.Up="Up",t.Down="Down",t))(Sl||{}),xt=(t=>(t.LowerLeft="Resize Handle Lower Left",t.UpperLeft="Resize Handle Upper Left",t.LowerRight="Resize Handle Lower Right",t.UpperRight="Resize Handle Upper Right",t.LowerLeftTop="Resize Handle Lower Left Top",t.UpperLeftTop="Resize Handle Upper Left Top",t.LowerRightTop="Resize Handle Lower Right Top",t.UpperRightTop="Resize Handle Upper Right Top",t.Lower="Resize Handle Lower",t.Upper="Resize Handle Upper",t.Left="Resize Handle Left",t.Right="Resize Handle Right",t.Top="Resize Handle Top",t.Default="Resize Handle",t.Arch="Resize Handle Arch",t.WallPartialResizeLeft="Wall Partial Resize Handle Left",t.WallPartialResizeRight="Wall Partial Resize Handle Right",t.WallPartialResizeLeftTop="Wall Partial Resize Handle Left Top",t.WallPartialResizeRightTop="Wall Partial Resize Handle Right Top",t))(xt||{}),ai=(t=>(t.Lower="Rotate Handle Lower",t.Upper="Rotate Handle Upper",t.Tilt="Rotate Handle Tilt",t))(ai||{}),db=(t=>(t.Delete="Delete Vertex",t.InsertBeforeIndex="Insert Vertex Before Index",t.InsertAfterIndex="Insert Vertex After Index",t))(db||{}),dh=(t=>(t.Horizontal="Horizontal",t.Vertical="Vertical",t.Ground="Ground",t.Sky="Sky",t))(dh||{}),ie=(t=>(t[t.OnlyThisObject=1]="OnlyThisObject",t[t.AllObjectsOfThisTypeOnSurface=2]="AllObjectsOfThisTypeOnSurface",t[t.AllObjectsOfThisTypeAboveFoundation=3]="AllObjectsOfThisTypeAboveFoundation",t[t.AllObjectsOfThisType=4]="AllObjectsOfThisType",t[t.AllConnectedObjects=5]="AllConnectedObjects",t[t.OnlyThisSide=6]="OnlyThisSide",t[t.AllSelectedObjectsOfThisType=7]="AllSelectedObjectsOfThisType",t))(ie||{}),br=(t=>(t.portrait="Portrait",t.landscape="Landscape",t))(br||{}),Nl=(t=>(t.eastWest="East-West",t.northSouth="North-South",t.leftRight="Left-Right",t.upDown="Up-Down",t))(Nl||{}),Bl=(t=>(t.NO_TRACKER="None",t.HORIZONTAL_SINGLE_AXIS_TRACKER="HSAT",t.ALTAZIMUTH_DUAL_AXIS_TRACKER="AADAT",t.VERTICAL_SINGLE_AXIS_TRACKER="VSAT",t.TILTED_SINGLE_AXIS_TRACKER="TSAT",t))(Bl||{}),i8=(t=>(t.NONE="None",t.HIGH="High",t.PARTIAL="Partial",t))(i8||{}),Ay=(t=>(t.EXACT="Exact",t.APPROXIMATE="Approximate",t))(Ay||{}),yr=(t=>(t.Apple="Apple",t.Birch="Birch",t.Coconut="Coconut",t.Dogwood="Dogwood",t.Elm="Elm",t.FanPalm="Fan Palm",t.Linden="Linden",t.Magnolia="Magnolia",t.Maple="Maple",t.Oak="Oak",t.Pine="Pine",t.Spruce="Spruce",t))(yr||{}),uo=(t=>(t.Bellflower="Bellflower",t.Boxwood="Boxwood",t.CactusCombo1="Cactus Combo 1",t.CactusCombo2="Cactus Combo 2",t.CactusCombo3="Cactus Combo 3",t.CactusCombo4="Cactus Combo 4",t.Hibiscus="Hibiscus",t.Hosta="Hosta",t.Hydrangea="Hydrangea",t.Peony="Peony",t.RedRose="Red Rose",t.Spirea="Spirea",t.Sunflower="Sunflower",t.TallBush="Tall Bush",t.Tulip="Tulip",t.WhiteFlower="White Flower",t.YellowFlower="Yellow Flower",t))(uo||{}),Fa=(t=>(t.Male="Male",t.Female="Female",t.Other="Other",t))(Fa||{}),Vt=(t=>(t.Jaah="Jaah",t.Jack="Jack",t.Jacob="Jacob",t.Jacqueline="Jacqueline",t.Jade="Jade",t.Jamelia="Jamelia",t.James="James",t.Jane="Jane",t.Jaya="Jaya",t.Jaye="Jaye",t.Jeanette="Jeanette",t.Jedi="Jedi",t.Jeff="Jeff",t.Jena="Jena",t.Jennifer="Jennifer",t.Jess="Jess",t.Jett="Jett",t.Jill="Jill",t.Jiya="Jiya",t.Jocelyn="Jocelyn",t.Joan="Joan",t.Joel="Joel",t.Joey="Joey",t.John="John",t.Jonathon="Jonathon",t.Joseph="Joseph",t.Jose="Jose",t.Joshua="Joshua",t.Judd="Judd",t.Judy="Judy",t.Julia="Julia",t.Julio="Julio",t.Jumapili="Jumapili",t.June="June",t.Juro="Juro",t.Justin="Justin",t))(Vt||{}),Zr=(t=>(t.Texture01="Polygon Texture #1",t.Texture02="Polygon Texture #2",t.Texture03="Polygon Texture #3",t.Texture04="Polygon Texture #4",t.Texture05="Polygon Texture #5",t.Texture06="Polygon Texture #6",t.Texture07="Polygon Texture #7",t.Texture08="Polygon Texture #8",t.Texture09="Polygon Texture #9",t.Texture10="Polygon Texture #10",t.NoTexture="No Polygon Texture",t))(Zr||{}),Xi=(t=>(t.Texture01="Foundation Texture #1",t.Texture02="Foundation Texture #2",t.Texture03="Foundation Texture #3",t.Texture04="Foundation Texture #4",t.Texture05="Foundation Texture #5",t.Texture06="Foundation Texture #6",t.Texture07="Foundation Texture #7",t.Texture08="Foundation Texture #8",t.Texture09="Foundation Texture #9",t.Texture10="Foundation Texture #10",t.NoTexture="No Foundation Texture",t))(Xi||{}),Do=(t=>(t.Facade01="Facade #1",t.Facade02="Facade #2",t.Facade03="Facade #3",t.Facade04="Facade #4",t.Facade05="Facade #5",t.Facade06="Facade #6",t.Facade07="Facade #7",t.Facade08="Facade #8",t.Facade09="Facade #9",t.Facade10="Facade #10",t.NoTexture="No Facade Texture",t))(Do||{}),Jo=(t=>(t.Default="Wall Texture Default",t.Texture01="Wall Texture #1",t.Texture02="Wall Texture #2",t.Texture03="Wall Texture #3",t.Texture04="Wall Texture #4",t.Texture05="Wall Texture #5",t.Texture06="Wall Texture #6",t.Texture07="Wall Texture #7",t.Texture08="Wall Texture #8",t.Texture09="Wall Texture #9",t.Texture10="Wall Texture #10",t.NoTexture="No Wall Texture",t))(Jo||{}),dr=(t=>(t.Default="Door Texture Default",t.Texture01="Door Texture #1",t.Texture02="Door Texture #2",t.Texture03="Door Texture #3",t.Texture04="Door Texture #4",t.Texture05="Door Texture #5",t.Texture06="Door Texture #6",t.Texture07="Door Texture #7",t.Texture08="Door Texture #8",t.Texture09="Door Texture #9",t.Texture10="Door Texture #10",t.Texture11="Door Texture #11",t.Texture12="Door Texture #12",t.Texture13="Door Texture #13",t.Texture14="Door Texture #14",t.Texture15="Door Texture #15",t.Texture16="Door Texture #16",t.Texture17="Door Texture #17",t.NoTexture="No Door Texture",t))(dr||{}),Yr=(t=>(t.Default="Roof Texture Default",t.Texture01="Roof Texture #1",t.Texture02="Roof Texture #2",t.Texture03="Roof Texture #3",t.Texture04="Roof Texture #4",t.Texture05="Roof Texture #5",t.Texture06="Roof Texture #6",t.Texture07="Roof Texture #7",t.NoTexture="No Roof Texture",t))(Yr||{}),Eg=(t=>(t.Left="Left",t.Right="Right",t))(Eg||{}),ya=(t=>(t.Valid="Valid",t.OverLap="OverLap",t.OutsideBoundary="OutsideBoundary",t.Invalid="Invalid",t))(ya||{}),Ur=(t=>(t.Mid="Mid",t.Left="Left",t.Right="Right",t.TopMid="TopMid",t.TopLeft="TopLeft",t.TopRight="TopRight",t.FrontLeft="FrontLeft",t.FrontRight="FrontRight",t.BackLeft="BackLeft",t.BackRight="BackRight",t.Top="Top",t.Ridge="Ridge",t.Null="Null",t))(Ur||{}),us=(t=>(t.BUILDING="Building",t.PV="PV",t.CSP="CSP",t.SUT="SUT",t.WIND="Wind",t))(us||{});const ZV={},Ede=new Map,SO=t=>{const e=Ede.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},Avt=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=Ede.get(n.name);if(o)return{type:"tracked",store:t,...o};const r={connection:e.connect(n),stores:{}};return Ede.set(n.name,r),{type:"tracked",store:t,...r}},wvt=(t,e={})=>(n,o,r)=>{const{enabled:i,anonymousActionType:a,store:l,...s}=e;let c;try{c=(i??(ZV?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(ZV?"production":void 0)!=="production"&&i&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,r);const{connection:u,...d}=Avt(l,c,s);let f=!0;r.setState=(y,w,x)=>{const C=n(y,w);if(!f)return C;const P=x===void 0?{type:a||"anonymous"}:typeof x=="string"?{type:x}:x;return l===void 0?(u==null||u.send(P,o()),C):(u==null||u.send({...P,type:`${l}/${P.type}`},{...SO(s.name),[l]:r.getState()}),C)};const p=(...y)=>{const w=f;f=!1,n(...y),f=w},m=t(r.setState,o,r);if(d.type==="untracked"?u==null||u.init(m):(d.stores[d.store]=r,u==null||u.init(Object.fromEntries(Object.entries(d.stores).map(([y,w])=>[y,y===d.store?m:w.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let y=!1;const w=r.dispatch;r.dispatch=(...x)=>{(ZV?"production":void 0)!=="production"&&x[0].type==="__setState"&&!y&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),y=!0),w(...x)}}return u.subscribe(y=>{var w;switch(y.type){case"ACTION":if(typeof y.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return Xae(y.payload,x=>{if(x.type==="__setState"){if(l===void 0){p(x.state);return}Object.keys(x.state).length!==1&&console.error(` [zustand devtools middleware] Unsupported __setState action format. When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(), @@ -3707,7 +3707,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * Copyright 2014-2020 Benjamin Tan * Copyright 2011-2013 John-David Dalton * Available under MIT license - */IX.exports;(function(t,e){(function(){var n={function:!0,object:!0},o=n[typeof window]&&window||this,r=e,i=t&&!t.nodeType&&t,a=r&&i&&typeof Rc=="object"&&Rc;a&&(a.global===a||a.window===a||a.self===a)&&(o=a);var l=Math.pow(2,53)-1,s=/\bOpera/,c=Object.prototype,u=c.hasOwnProperty,d=c.toString;function f(T){return T=String(T),T.charAt(0).toUpperCase()+T.slice(1)}function p(T,R,M){var D={"10.0":"10","6.4":"10 Technical Preview","6.3":"8.1","6.2":"8","6.1":"Server 2008 R2 / 7","6.0":"Server 2008 / Vista","5.2":"Server 2003 / XP 64-bit","5.1":"XP","5.01":"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return R&&M&&/^Win/i.test(T)&&!/^Windows Phone /i.test(T)&&(D=D[/[\d.]+$/.exec(T)])&&(T="Windows "+D),T=String(T),R&&M&&(T=T.replace(RegExp(R,"i"),M)),T=y(T.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0]),T}function m(T,R){var M=-1,D=T?T.length:0;if(typeof D=="number"&&D>-1&&D<=l)for(;++M3&&"WebKit"||/\bOpera\b/.test(de)&&(/\bOPR\b/.test(T)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(T)&&!/^(?:Trident|EdgeHTML)$/.test(le)&&"WebKit"||!le&&/\bMSIE\b/i.test(T)&&(ce=="Mac OS"?"Tasman":"Trident")||le=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(de)&&"NetFront")&&(le=[ee]),de=="IE"&&(ee=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(T)||0)[1])?(de+=" Mobile",ce="Windows Phone "+(/\+$/.test(ee)?ee:ee+".x"),ae.unshift("desktop mode")):/\bWPDesktop\b/i.test(T)?(de="IE Mobile",ce="Windows Phone 8.x",ae.unshift("desktop mode"),te||(te=(/\brv:([\d.]+)/.exec(T)||0)[1])):de!="IE"&&le=="Trident"&&(ee=/\brv:([\d.]+)/.exec(T))&&(de&&ae.push("identifying as "+de+(te?" "+te:"")),de="IE",te=ee[1]),ne){if(C(R,"global"))if(j&&(ee=j.lang.System,q=ee.getProperty("os.arch"),ce=ce||ee.getProperty("os.name")+" "+ee.getProperty("os.version")),Y){try{te=R.require("ringo/engine").version.join("."),de="RingoJS"}catch{(ee=R.system)&&ee.global.system==R.system&&(de="Narwhal",ce||(ce=ee[0].os||null))}de||(de="Rhino")}else typeof R.process=="object"&&!R.process.browser&&(ee=R.process)&&(typeof ee.versions=="object"&&(typeof ee.versions.electron=="string"?(ae.push("Node "+ee.versions.node),de="Electron",te=ee.versions.electron):typeof ee.versions.nw=="string"&&(ae.push("Chromium "+te,"Node "+ee.versions.node),de="NW.js",te=ee.versions.nw)),de||(de="Node.js",q=ee.arch,ce=ee.platform,te=/[\d.]+/.exec(ee.version),te=te?te[0]:null));else x(ee=R.runtime)==W?(de="Adobe AIR",ce=ee.flash.system.Capabilities.os):x(ee=R.phantom)==L?(de="PhantomJS",te=(ee=ee.version||null)&&ee.major+"."+ee.minor+"."+ee.patch):typeof G.documentMode=="number"&&(ee=/\bTrident\/(\d+)/i.exec(T))?(te=[te,G.documentMode],(ee=+ee[1]+4)!=te[1]&&(ae.push("IE "+te[1]+" mode"),le&&(le[1]=""),te[1]=ee),te=de=="IE"?String(te[1].toFixed(1)):te[0]):typeof G.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(de)&&(ae.push("masking as "+de+" "+te),de="IE",te="11.0",le=["Trident"],ce="Windows");ce=ce&&y(ce)}if(te&&(ee=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(te)||/(?:alpha|beta)(?: ?\d)?/i.exec(T+";"+(ne&&D.appMinorVersion))||/\bMinefield\b/i.test(T)&&"a")&&(Z=/b/i.test(ee)?"beta":"alpha",te=te.replace(RegExp(ee+"\\+?$"),"")+(Z=="beta"?_:O)+(/\d+\+?/.exec(ee)||"")),de=="Fennec"||de=="Firefox"&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(ce))de="Firefox Mobile";else if(de=="Maxthon"&&te)te=te.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(he))he=="Xbox 360"&&(ce=null),he=="Xbox 360"&&/\bIEMobile\b/.test(T)&&ae.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(de)||de&&!he&&!/Browser|Mobi/.test(de))&&(ce=="Windows CE"||/Mobi/i.test(T)))de+=" Mobile";else if(de=="IE"&&ne)try{R.external===null&&ae.unshift("platform preview")}catch{ae.unshift("embedded")}else(/\bBlackBerry\b/.test(he)||/\bBB10\b/.test(T))&&(ee=(RegExp(he.replace(/ +/g," *")+"/([.\\d]+)","i").exec(T)||0)[1]||te)?(ee=[ee,/BB10/.test(T)],ce=(ee[1]?(he=null,me="BlackBerry"):"Device Software")+" "+ee[0],te=null):this!=w&&he!="Wii"&&(ne&&Q||/Opera/.test(de)&&/\b(?:MSIE|Firefox)\b/i.test(T)||de=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(ce)||de=="IE"&&(ce&&!/^Win/.test(ce)&&te>5.5||/\bWindows XP\b/.test(ce)&&te>8||te==8&&!/\bTrident\b/.test(T)))&&!s.test(ee=v.call(w,T.replace(s,"")+";"))&&ee.name&&(ee="ing as "+ee.name+((ee=ee.version)?" "+ee:""),s.test(de)?(/\bIE\b/.test(ee)&&ce=="Mac OS"&&(ce=null),ee="identify"+ee):(ee="mask"+ee,oe?de=y(oe.replace(/([a-z])([A-Z])/g,"$1 $2")):de="Opera",/\bIE\b/.test(ee)&&(ce=null),ne||(te=null)),le=["Presto"],ae.push(ee));(ee=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(T)||0)[1])&&(ee=[parseFloat(ee.replace(/\.(\d)$/,".0$1")),ee],de=="Safari"&&ee[1].slice(-1)=="+"?(de="WebKit Nightly",Z="alpha",te=ee[1].slice(0,-1)):(te==ee[1]||te==(ee[2]=(/\bSafari\/([\d.]+\+?)/i.exec(T)||0)[1]))&&(te=null),ee[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(T)||0)[1],ee[0]==537.36&&ee[2]==537.36&&parseFloat(ee[1])>=28&&le=="WebKit"&&(le=["Blink"]),!ne||!N&&!ee[1]?(le&&(le[1]="like Safari"),ee=(ee=ee[0],ee<400?1:ee<500?2:ee<526?3:ee<533?4:ee<534?"4+":ee<535?5:ee<537?6:ee<538?7:ee<601?8:ee<602?9:ee<604?10:ee<606?11:ee<608?12:"12")):(le&&(le[1]="like Chrome"),ee=ee[1]||(ee=ee[0],ee<530?1:ee<532?2:ee<532.05?3:ee<533?4:ee<534.03?5:ee<534.07?6:ee<534.1?7:ee<534.13?8:ee<534.16?9:ee<534.24?10:ee<534.3?11:ee<535.01?12:ee<535.02?"13+":ee<535.07?15:ee<535.11?16:ee<535.19?17:ee<536.05?18:ee<536.1?19:ee<537.01?20:ee<537.11?"21+":ee<537.13?23:ee<537.18?24:ee<537.24?25:ee<537.36?26:le!="Blink"?"27":"28")),le&&(le[1]+=" "+(ee+=typeof ee=="number"?".x":/[.+]/.test(ee)?"":"+")),de=="Safari"&&(!te||parseInt(te)>45)?te=ee:de=="Chrome"&&/\bHeadlessChrome/i.test(T)&&ae.unshift("headless")),de=="Opera"&&(ee=/\bzbov|zvav$/.exec(ce))?(de+=" ",ae.unshift("desktop mode"),ee=="zvav"?(de+="Mini",te=null):de+="Mobile",ce=ce.replace(RegExp(" *"+ee+"$"),"")):de=="Safari"&&/\bChrome\b/.exec(le&&le[1])?(ae.unshift("desktop mode"),de="Chrome Mobile",te=null,/\bOS X\b/.test(ce)?(me="Apple",ce="iOS 4.3+"):ce=null):/\bSRWare Iron\b/.test(de)&&!te&&(te=Ae("Chrome")),te&&te.indexOf(ee=/[\d.]+$/.exec(ce))==0&&T.indexOf("/"+ee+"-")>-1&&(ce=S(ce.replace(ee,""))),ce&&ce.indexOf(de)!=-1&&!RegExp(de+" OS").test(ce)&&(ce=ce.replace(RegExp(" *"+P(de)+" *"),"")),le&&!/\b(?:Avant|Nook)\b/.test(de)&&(/Browser|Lunascape|Maxthon/.test(de)||de!="Safari"&&/^iOS/.test(ce)&&/\bSafari\b/.test(le[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(de)&&le[1])&&(ee=le[le.length-1])&&ae.push(ee),ae.length&&(ae=["("+ae.join("; ")+")"]),me&&he&&he.indexOf(me)<0&&ae.push("on "+me),he&&ae.push((/^on /.test(ae[ae.length-1])?"":"on ")+he),ce&&(ee=/ ([\d.+]+)$/.exec(ce),$=ee&&ce.charAt(ce.length-ee[0].length-1)=="/",ce={architecture:32,family:ee&&!$?ce.replace(ee[0],""):ce,version:ee?ee[1]:null,toString:function(){var we=this.version;return this.family+(we&&!$?" "+we:"")+(this.architecture==64?" 64-bit":"")}}),(ee=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(q))&&!/\bi686\b/i.test(q)?(ce&&(ce.architecture=64,ce.family=ce.family.replace(RegExp(" *"+ee),"")),de&&(/\bWOW64\b/i.test(T)||ne&&/\w(?:86|32)$/.test(D.cpuClass||D.platform)&&!/\bWin64; x64\b/i.test(T))&&ae.unshift("32-bit")):ce&&/^OS X/.test(ce.family)&&de=="Chrome"&&parseFloat(te)>=39&&(ce.architecture=64),T||(T=null);var ge={};return ge.description=T,ge.layout=le&&le[0],ge.manufacturer=me,ge.name=de,ge.prerelease=Z,ge.product=he,ge.ua=T,ge.version=de&&te,ge.os=ce||{architecture:null,family:null,version:null,toString:function(){return"null"}},ge.parse=v,ge.toString=se,ge.version&&ae.unshift(te),ge.name&&ae.unshift(de),ce&&de&&!(ce==String(ce).split(" ")[0]&&(ce==de.split(" ")[0]||he))&&ae.push(he?"("+ce+")":"on "+ce),ae.length&&(ge.description=ae.join(" ")),ge}var b=v();r&&i?w(b,function(T,R){r[R]=T}):o.platform=b}).call(Rc)})(IX,IX.exports);var Pvt=IX.exports;const lVe=ji(Pvt),HR="1.7.2",Cvt="1.5.0",k1="https://institute-for-future-intelligence.github.io/aladdin/",zX="Natick, MA",Vg=["#627682","#8884d8","#f97356","#1bc32c","#c6502d","#82ca9d","#3eaec0","#445111"],Ec=15,hL=50,Ob=.5,Lu=.8,Rvt=new ir(0,0,1),Hvt=new ir(0,1,0),Mvt=new ir(1,1,0),Ivt=new ir(1,0,0),OD=[Rvt,Hvt,Mvt,Ivt],Ny=20,Fu="gray",Uy=.5,X3=4,Kw=2,U9=2,pA=2,dA=2,X9=2,fA=1,sVe=1,g3="SPR-X21-335-BLK",K8=100,DX=200,ibe="#3BB9FF",EX="#36454F",j9="#FFFFFF",B9="#404040",cVe=10,a8=4,Bs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],abe=["January","February","March","April","May","June","July","August","September","October","November","December"],tQ=105,nQ=320,zvt=5e3,uVe=45,pL=1e4,Dvt=4096,Evt=.1,Tm=.1,$8=.16,q8="orange",gL="orchid",kvt="pink",ll="white",Aa="red",i0="yellow",W9=5,r3=.1,yA=W9*r3,dVe=1e4,lbe=250,Fvt=.01,Lvt=.005,Wvt="#000",Nvt="#01345B",kde="#fe6f5e",rr="Ground",$t=Math.PI/2,fa=Math.PI*2,Ht=1e-4,fs=[0,0,1],Uvt=[0,-1,0],b1=new ue(1,0,0),S1=new ue(-1,0,0),Zc=new ue(0,1,0),T1=new ue(0,-1,0),Oo=new ue(0,0,1);new ue(0,0,-1);const ui=new _t(0,0);new ue(0,0,0);const kX=new cn(0,0,$t),dH=/^[A-Za-z0-9\s-_()!?%&,]*$/,Jae=jvt()?"⌘":"Ctrl",fVe={heatingSetpoint:20,coolingSetpoint:20,temperatureThreshold:3};var Fr=(t=>(t.Move="Move",t.RotateUpper="RotateUpper",t.RotateLower="RotateLower",t.ResizeX="ResizeX",t.ResizeY="ResizeY",t.ResizeHeight="ResizeHeight",t.Tilt="Tilt",t.None="None",t))(Fr||{}),qa=(t=>(t.Vertical="Vertical",t.Horizontal="Horizontal",t.Inclined="Inclined",t))(qa||{});function jvt(){var e;const t=(e=lVe.os)==null?void 0:e.family;return t?t.includes("Mac")||t.includes("OS X"):!1}var Ul=(t=>(t.Full="Full",t.Partial="Partial",t.Empty="Empty",t))(Ul||{}),Tc=(t=>(t.Default="Default",t.Stud="Stud",t.Pillar="Pillar",t))(Tc||{});let fr=class{constructor(e,n,o,r){this.x=e,this.y=n,this.width=o,this.height=r}centerX(){return this.x+this.width/2}centerY(){return this.y+this.height/2}minX(){return this.x}maxX(){return this.x+this.width}minY(){return this.y}maxY(){return this.y+this.height}contains(e,n){return e>this.x&&ethis.y&&n(t.Pyramid="Pyramid",t.Gable="Gable",t.Hip="Hip",t.Gambrel="Gambrel",t.Mansard="Mansard",t))(Zo||{}),Hc=(t=>(t.Default="Default",t.Rafter="Rafter",t.Glass="Glass",t))(Hc||{});function H3(){return H3=Object.assign?Object.assign.bind():function(t){for(var e=1;en&&s.add(D)}s.normalize(),m.setXYZ(x+S,s.x,s.y,s.z)}}return u.setAttribute("normal",m),u}const sbe=new Cf,TO=new ue;class j2e extends eQ{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new Ar(e,3)),this.setAttribute("uv",new Ar(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new PX(n,6,1);return this.setAttribute("instanceStart",new nm(o,3,0)),this.setAttribute("instanceEnd",new nm(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new PX(n,6,1);return this.setAttribute("instanceColorStart",new nm(o,3,0)),this.setAttribute("instanceColorEnd",new nm(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new b2e(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Cf);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),sbe.setFromBufferAttribute(n),this.boundingBox.union(sbe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Y1),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let r=0;for(let i=0,a=e.count;i-1&&D<=l)for(;++M3&&"WebKit"||/\bOpera\b/.test(de)&&(/\bOPR\b/.test(T)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(T)&&!/^(?:Trident|EdgeHTML)$/.test(le)&&"WebKit"||!le&&/\bMSIE\b/i.test(T)&&(ce=="Mac OS"?"Tasman":"Trident")||le=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(de)&&"NetFront")&&(le=[ee]),de=="IE"&&(ee=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(T)||0)[1])?(de+=" Mobile",ce="Windows Phone "+(/\+$/.test(ee)?ee:ee+".x"),ae.unshift("desktop mode")):/\bWPDesktop\b/i.test(T)?(de="IE Mobile",ce="Windows Phone 8.x",ae.unshift("desktop mode"),te||(te=(/\brv:([\d.]+)/.exec(T)||0)[1])):de!="IE"&&le=="Trident"&&(ee=/\brv:([\d.]+)/.exec(T))&&(de&&ae.push("identifying as "+de+(te?" "+te:"")),de="IE",te=ee[1]),ne){if(C(R,"global"))if(j&&(ee=j.lang.System,$=ee.getProperty("os.arch"),ce=ce||ee.getProperty("os.name")+" "+ee.getProperty("os.version")),Y){try{te=R.require("ringo/engine").version.join("."),de="RingoJS"}catch{(ee=R.system)&&ee.global.system==R.system&&(de="Narwhal",ce||(ce=ee[0].os||null))}de||(de="Rhino")}else typeof R.process=="object"&&!R.process.browser&&(ee=R.process)&&(typeof ee.versions=="object"&&(typeof ee.versions.electron=="string"?(ae.push("Node "+ee.versions.node),de="Electron",te=ee.versions.electron):typeof ee.versions.nw=="string"&&(ae.push("Chromium "+te,"Node "+ee.versions.node),de="NW.js",te=ee.versions.nw)),de||(de="Node.js",$=ee.arch,ce=ee.platform,te=/[\d.]+/.exec(ee.version),te=te?te[0]:null));else x(ee=R.runtime)==W?(de="Adobe AIR",ce=ee.flash.system.Capabilities.os):x(ee=R.phantom)==L?(de="PhantomJS",te=(ee=ee.version||null)&&ee.major+"."+ee.minor+"."+ee.patch):typeof G.documentMode=="number"&&(ee=/\bTrident\/(\d+)/i.exec(T))?(te=[te,G.documentMode],(ee=+ee[1]+4)!=te[1]&&(ae.push("IE "+te[1]+" mode"),le&&(le[1]=""),te[1]=ee),te=de=="IE"?String(te[1].toFixed(1)):te[0]):typeof G.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(de)&&(ae.push("masking as "+de+" "+te),de="IE",te="11.0",le=["Trident"],ce="Windows");ce=ce&&y(ce)}if(te&&(ee=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(te)||/(?:alpha|beta)(?: ?\d)?/i.exec(T+";"+(ne&&D.appMinorVersion))||/\bMinefield\b/i.test(T)&&"a")&&(Z=/b/i.test(ee)?"beta":"alpha",te=te.replace(RegExp(ee+"\\+?$"),"")+(Z=="beta"?_:O)+(/\d+\+?/.exec(ee)||"")),de=="Fennec"||de=="Firefox"&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(ce))de="Firefox Mobile";else if(de=="Maxthon"&&te)te=te.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(he))he=="Xbox 360"&&(ce=null),he=="Xbox 360"&&/\bIEMobile\b/.test(T)&&ae.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(de)||de&&!he&&!/Browser|Mobi/.test(de))&&(ce=="Windows CE"||/Mobi/i.test(T)))de+=" Mobile";else if(de=="IE"&&ne)try{R.external===null&&ae.unshift("platform preview")}catch{ae.unshift("embedded")}else(/\bBlackBerry\b/.test(he)||/\bBB10\b/.test(T))&&(ee=(RegExp(he.replace(/ +/g," *")+"/([.\\d]+)","i").exec(T)||0)[1]||te)?(ee=[ee,/BB10/.test(T)],ce=(ee[1]?(he=null,me="BlackBerry"):"Device Software")+" "+ee[0],te=null):this!=w&&he!="Wii"&&(ne&&Q||/Opera/.test(de)&&/\b(?:MSIE|Firefox)\b/i.test(T)||de=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(ce)||de=="IE"&&(ce&&!/^Win/.test(ce)&&te>5.5||/\bWindows XP\b/.test(ce)&&te>8||te==8&&!/\bTrident\b/.test(T)))&&!s.test(ee=v.call(w,T.replace(s,"")+";"))&&ee.name&&(ee="ing as "+ee.name+((ee=ee.version)?" "+ee:""),s.test(de)?(/\bIE\b/.test(ee)&&ce=="Mac OS"&&(ce=null),ee="identify"+ee):(ee="mask"+ee,oe?de=y(oe.replace(/([a-z])([A-Z])/g,"$1 $2")):de="Opera",/\bIE\b/.test(ee)&&(ce=null),ne||(te=null)),le=["Presto"],ae.push(ee));(ee=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(T)||0)[1])&&(ee=[parseFloat(ee.replace(/\.(\d)$/,".0$1")),ee],de=="Safari"&&ee[1].slice(-1)=="+"?(de="WebKit Nightly",Z="alpha",te=ee[1].slice(0,-1)):(te==ee[1]||te==(ee[2]=(/\bSafari\/([\d.]+\+?)/i.exec(T)||0)[1]))&&(te=null),ee[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(T)||0)[1],ee[0]==537.36&&ee[2]==537.36&&parseFloat(ee[1])>=28&&le=="WebKit"&&(le=["Blink"]),!ne||!N&&!ee[1]?(le&&(le[1]="like Safari"),ee=(ee=ee[0],ee<400?1:ee<500?2:ee<526?3:ee<533?4:ee<534?"4+":ee<535?5:ee<537?6:ee<538?7:ee<601?8:ee<602?9:ee<604?10:ee<606?11:ee<608?12:"12")):(le&&(le[1]="like Chrome"),ee=ee[1]||(ee=ee[0],ee<530?1:ee<532?2:ee<532.05?3:ee<533?4:ee<534.03?5:ee<534.07?6:ee<534.1?7:ee<534.13?8:ee<534.16?9:ee<534.24?10:ee<534.3?11:ee<535.01?12:ee<535.02?"13+":ee<535.07?15:ee<535.11?16:ee<535.19?17:ee<536.05?18:ee<536.1?19:ee<537.01?20:ee<537.11?"21+":ee<537.13?23:ee<537.18?24:ee<537.24?25:ee<537.36?26:le!="Blink"?"27":"28")),le&&(le[1]+=" "+(ee+=typeof ee=="number"?".x":/[.+]/.test(ee)?"":"+")),de=="Safari"&&(!te||parseInt(te)>45)?te=ee:de=="Chrome"&&/\bHeadlessChrome/i.test(T)&&ae.unshift("headless")),de=="Opera"&&(ee=/\bzbov|zvav$/.exec(ce))?(de+=" ",ae.unshift("desktop mode"),ee=="zvav"?(de+="Mini",te=null):de+="Mobile",ce=ce.replace(RegExp(" *"+ee+"$"),"")):de=="Safari"&&/\bChrome\b/.exec(le&&le[1])?(ae.unshift("desktop mode"),de="Chrome Mobile",te=null,/\bOS X\b/.test(ce)?(me="Apple",ce="iOS 4.3+"):ce=null):/\bSRWare Iron\b/.test(de)&&!te&&(te=Ae("Chrome")),te&&te.indexOf(ee=/[\d.]+$/.exec(ce))==0&&T.indexOf("/"+ee+"-")>-1&&(ce=S(ce.replace(ee,""))),ce&&ce.indexOf(de)!=-1&&!RegExp(de+" OS").test(ce)&&(ce=ce.replace(RegExp(" *"+P(de)+" *"),"")),le&&!/\b(?:Avant|Nook)\b/.test(de)&&(/Browser|Lunascape|Maxthon/.test(de)||de!="Safari"&&/^iOS/.test(ce)&&/\bSafari\b/.test(le[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(de)&&le[1])&&(ee=le[le.length-1])&&ae.push(ee),ae.length&&(ae=["("+ae.join("; ")+")"]),me&&he&&he.indexOf(me)<0&&ae.push("on "+me),he&&ae.push((/^on /.test(ae[ae.length-1])?"":"on ")+he),ce&&(ee=/ ([\d.+]+)$/.exec(ce),q=ee&&ce.charAt(ce.length-ee[0].length-1)=="/",ce={architecture:32,family:ee&&!q?ce.replace(ee[0],""):ce,version:ee?ee[1]:null,toString:function(){var we=this.version;return this.family+(we&&!q?" "+we:"")+(this.architecture==64?" 64-bit":"")}}),(ee=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec($))&&!/\bi686\b/i.test($)?(ce&&(ce.architecture=64,ce.family=ce.family.replace(RegExp(" *"+ee),"")),de&&(/\bWOW64\b/i.test(T)||ne&&/\w(?:86|32)$/.test(D.cpuClass||D.platform)&&!/\bWin64; x64\b/i.test(T))&&ae.unshift("32-bit")):ce&&/^OS X/.test(ce.family)&&de=="Chrome"&&parseFloat(te)>=39&&(ce.architecture=64),T||(T=null);var ge={};return ge.description=T,ge.layout=le&&le[0],ge.manufacturer=me,ge.name=de,ge.prerelease=Z,ge.product=he,ge.ua=T,ge.version=de&&te,ge.os=ce||{architecture:null,family:null,version:null,toString:function(){return"null"}},ge.parse=v,ge.toString=se,ge.version&&ae.unshift(te),ge.name&&ae.unshift(de),ce&&de&&!(ce==String(ce).split(" ")[0]&&(ce==de.split(" ")[0]||he))&&ae.push(he?"("+ce+")":"on "+ce),ae.length&&(ge.description=ae.join(" ")),ge}var b=v();r&&i?w(b,function(T,R){r[R]=T}):o.platform=b}).call(Rc)})(IX,IX.exports);var Pvt=IX.exports;const lVe=ji(Pvt),HR="1.7.2",Cvt="1.5.0",k1="https://institute-for-future-intelligence.github.io/aladdin/",zX="Natick, MA",Vg=["#627682","#8884d8","#f97356","#1bc32c","#c6502d","#82ca9d","#3eaec0","#445111"],Ec=15,hL=50,Ob=.5,Lu=.8,Rvt=new ir(0,0,1),Hvt=new ir(0,1,0),Mvt=new ir(1,1,0),Ivt=new ir(1,0,0),OD=[Rvt,Hvt,Mvt,Ivt],Ny=20,Fu="gray",Uy=.5,X3=4,Kw=2,U9=2,pA=2,dA=2,X9=2,fA=1,sVe=1,g3="SPR-X21-335-BLK",K8=100,DX=200,ibe="#3BB9FF",EX="#36454F",j9="#FFFFFF",B9="#404040",cVe=10,a8=4,Bs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],abe=["January","February","March","April","May","June","July","August","September","October","November","December"],tQ=105,nQ=320,zvt=5e3,uVe=45,pL=1e4,Dvt=4096,Evt=.1,Tm=.1,$8=.16,q8="orange",gL="orchid",kvt="pink",ll="white",Aa="red",i0="yellow",W9=5,r3=.1,yA=W9*r3,dVe=1e4,lbe=250,Fvt=.01,Lvt=.005,Wvt="#000",Nvt="#01345B",kde="#fe6f5e",rr="Ground",$t=Math.PI/2,fa=Math.PI*2,Ht=1e-4,fs=[0,0,1],Uvt=[0,-1,0],b1=new ue(1,0,0),S1=new ue(-1,0,0),Zc=new ue(0,1,0),T1=new ue(0,-1,0),Oo=new ue(0,0,1);new ue(0,0,-1);const ui=new _t(0,0);new ue(0,0,0);const kX=new cn(0,0,$t),dH=/^[A-Za-z0-9\s-_()!?%&,]*$/,Jae=jvt()?"⌘":"Ctrl",fVe={heatingSetpoint:20,coolingSetpoint:20,temperatureThreshold:3};var Fr=(t=>(t.Move="Move",t.RotateUpper="RotateUpper",t.RotateLower="RotateLower",t.ResizeX="ResizeX",t.ResizeY="ResizeY",t.ResizeHeight="ResizeHeight",t.Tilt="Tilt",t.None="None",t))(Fr||{}),qa=(t=>(t.Vertical="Vertical",t.Horizontal="Horizontal",t.Inclined="Inclined",t))(qa||{});function jvt(){var e;const t=(e=lVe.os)==null?void 0:e.family;return t?t.includes("Mac")||t.includes("OS X"):!1}var Ul=(t=>(t.Full="Full",t.Partial="Partial",t.Empty="Empty",t))(Ul||{}),Tc=(t=>(t.Default="Default",t.Stud="Stud",t.Pillar="Pillar",t))(Tc||{});let fr=class{constructor(e,n,o,r){this.x=e,this.y=n,this.width=o,this.height=r}centerX(){return this.x+this.width/2}centerY(){return this.y+this.height/2}minX(){return this.x}maxX(){return this.x+this.width}minY(){return this.y}maxY(){return this.y+this.height}contains(e,n){return e>this.x&&ethis.y&&n(t.Pyramid="Pyramid",t.Gable="Gable",t.Hip="Hip",t.Gambrel="Gambrel",t.Mansard="Mansard",t))(Zo||{}),Hc=(t=>(t.Default="Default",t.Rafter="Rafter",t.Glass="Glass",t))(Hc||{});function H3(){return H3=Object.assign?Object.assign.bind():function(t){for(var e=1;en&&s.add(D)}s.normalize(),m.setXYZ(x+S,s.x,s.y,s.z)}}return u.setAttribute("normal",m),u}const sbe=new Cf,TO=new ue;class j2e extends eQ{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new Ar(e,3)),this.setAttribute("uv",new Ar(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new PX(n,6,1);return this.setAttribute("instanceStart",new nm(o,3,0)),this.setAttribute("instanceEnd",new nm(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new PX(n,6,1);return this.setAttribute("instanceColorStart",new nm(o,3,0)),this.setAttribute("instanceColorEnd",new nm(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new b2e(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Cf);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),sbe.setFromBufferAttribute(n),this.boundingBox.union(sbe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Y1),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let r=0;for(let i=0,a=e.count;i #include #include @@ -4102,7 +4102,7 @@ troikaDefine( `+eG(c)+` )}`}),qae=!1),c&&c.workerModuleData&&(c=c.workerModuleData),c});function s(){for(var c=[],u=arguments.length;u--;)c[u]=arguments[u];if(!l){l=hbe(r,"registerModule",s.workerModuleData);var d=function(){l=null,Lk[r].delete(d)};(Lk[r]||(Lk[r]=new Set)).add(d)}return l.then(function(f){var p=f.isCallable;if(p)return hbe(r,"callModule",{id:i,args:c});throw new Error("Worker module function was called but `init` did not return a callable function")})}return s.workerModuleData={isWorkerModule:!0,id:i,name:a,dependencies:e,init:eG(n),getTransferables:o&&eG(o)},s}function Kvt(t){Lk[t]&&Lk[t].forEach(function(e){e()}),Fk[t]&&(Fk[t].terminate(),delete Fk[t])}function eG(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function $vt(t){var e=Fk[t];if(!e){var n=eG(Vvt);e=Fk[t]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+t.replace(/\*/g,"")+` **/ -;(`+n+")()"],{type:"application/javascript"}))),e.onmessage=function(o){var r=o.data,i=r.messageId,a=Lde[i];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete Lde[i],a(r)}}return e}function hbe(t,e,n){return new Promise(function(o,r){var i=++Jvt;Lde[i]=function(a){a.success?o(a.result):r(new Error("Error in worker "+e+" call: "+a.error))},$vt(t).postMessage({messageId:i,action:e,data:n})})}function yVe(){var t=function(e){function n(j,Y,O,_,G,Q,oe,ee){var q=1-oe;ee.x=q*q*j+2*q*oe*O+oe*oe*G,ee.y=q*q*Y+2*q*oe*_+oe*oe*Q}function o(j,Y,O,_,G,Q,oe,ee,q,ae){var Z=1-q;ae.x=Z*Z*Z*j+3*Z*Z*q*O+3*Z*q*q*G+q*q*q*oe,ae.y=Z*Z*Z*Y+3*Z*Z*q*_+3*Z*q*q*Q+q*q*q*ee}function r(j,Y){for(var O=/([MLQCZ])([^MLQCZ]*)/g,_,G,Q,oe,ee;_=O.exec(j);){var q=_[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(ae){return parseFloat(ae)});switch(_[1]){case"M":oe=G=q[0],ee=Q=q[1];break;case"L":(q[0]!==oe||q[1]!==ee)&&Y("L",oe,ee,oe=q[0],ee=q[1]);break;case"Q":{Y("Q",oe,ee,oe=q[2],ee=q[3],q[0],q[1]);break}case"C":{Y("C",oe,ee,oe=q[4],ee=q[5],q[0],q[1],q[2],q[3]);break}case"Z":(oe!==G||ee!==Q)&&Y("L",oe,ee,G,Q);break}}}function i(j,Y,O){O===void 0&&(O=16);var _={x:0,y:0};r(j,function(G,Q,oe,ee,q,ae,Z,ne,te){switch(G){case"L":Y(Q,oe,ee,q);break;case"Q":{for(var $=Q,le=oe,de=1;de0;)_e[Ue]=arguments[Ue+2];var qe=we[Ne]||(we[Ne]=O.getUniformLocation(Se,Ne));O["uniform"+Re].apply(O,[qe].concat(_e))},setAttribute:function(Re,Ne,_e,Ue,qe){var Fe=ge[Re];Fe||(Fe=ge[Re]={buf:O.createBuffer(),loc:O.getAttribLocation(Se,Re),data:null}),O.bindBuffer(O.ARRAY_BUFFER,Fe.buf),O.vertexAttribPointer(Fe.loc,Ne,O.FLOAT,!1,0,0),O.enableVertexAttribArray(Fe.loc),G?O.vertexAttribDivisor(Fe.loc,Ue):he("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Fe.loc,Ue),qe!==Fe.data&&(O.bufferData(O.ARRAY_BUFFER,qe,_e),Fe.data=qe)}})}}}oe[ve].transaction(se)},Pe=function(ve,ze){q++;try{O.activeTexture(O.TEXTURE0+q);var Ae=ee[ve];Ae||(Ae=ee[ve]=O.createTexture(),O.bindTexture(O.TEXTURE_2D,Ae),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MIN_FILTER,O.NEAREST),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MAG_FILTER,O.NEAREST)),O.bindTexture(O.TEXTURE_2D,Ae),ze(Ae,q)}finally{q--}},pe=function(ve,ze,Ae){var se=O.createFramebuffer();ae.push(se),O.bindFramebuffer(O.FRAMEBUFFER,se),O.activeTexture(O.TEXTURE0+ze),O.bindTexture(O.TEXTURE_2D,ve),O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,ve,0);try{Ae(se)}finally{O.deleteFramebuffer(se),O.bindFramebuffer(O.FRAMEBUFFER,ae[--ae.length-1]||null)}},Ie=function(){Q={},oe={},ee={},q=-1,ae.length=0};var Z=he,ne=me,te=ce,$=Pe,le=pe,de=Ie,G=typeof WebGL2RenderingContext<"u"&&O instanceof WebGL2RenderingContext,Q={},oe={},ee={},q=-1,ae=[];O.canvas.addEventListener("webglcontextlost",function(ve){Ie(),ve.preventDefault()},!1),s.set(O,_={gl:O,isWebGL2:G,getExtension:he,withProgram:ce,withTexture:Pe,withTextureFramebuffer:pe,handleContextLoss:Ie})}Y(_)}function d(j,Y,O,_,G,Q,oe,ee){oe===void 0&&(oe=15),ee===void 0&&(ee=null),u(j,function(q){var ae=q.gl,Z=q.withProgram,ne=q.withTexture;ne("copy",function(te,$){ae.texImage2D(ae.TEXTURE_2D,0,ae.RGBA,G,Q,0,ae.RGBA,ae.UNSIGNED_BYTE,Y),Z("copy",a,l,function(le){var de=le.setUniform,he=le.setAttribute;he("aUV",2,ae.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),de("1i","image",$),ae.bindFramebuffer(ae.FRAMEBUFFER,ee||null),ae.disable(ae.BLEND),ae.colorMask(oe&8,oe&4,oe&2,oe&1),ae.viewport(O,_,G,Q),ae.scissor(O,_,G,Q),ae.drawArrays(ae.TRIANGLES,0,3)})})})}function f(j,Y,O){var _=j.width,G=j.height;u(j,function(Q){var oe=Q.gl,ee=new Uint8Array(_*G*4);oe.readPixels(0,0,_,G,oe.RGBA,oe.UNSIGNED_BYTE,ee),j.width=Y,j.height=O,d(oe,ee,0,0,_,G)})}var p=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:d,resizeWebGLCanvasWithoutClearing:f});function m(j,Y,O,_,G,Q){Q===void 0&&(Q=1);var oe=new Uint8Array(j*Y),ee=_[2]-_[0],q=_[3]-_[1],ae=[];i(O,function(he,me,ce,Pe){ae.push({x1:he,y1:me,x2:ce,y2:Pe,minX:Math.min(he,ce),minY:Math.min(me,Pe),maxX:Math.max(he,ce),maxY:Math.max(me,Pe)})}),ae.sort(function(he,me){return he.maxX-me.maxX});for(var Z=0;ZIe.minX&&me-PeIe.minY){var ve=x(he,me,Ie.x1,Ie.y1,Ie.x2,Ie.y2);veme!=pe.y2>me&&he<(pe.x2-pe.x1)*(me-pe.y1)/(pe.y2-pe.y1)+pe.x1;Ie&&(ce+=pe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function y(Pe,pe){var Ie=36,ve=0,ze=new Map,Ae=pe&&new Map,se;return Pe.split(",").forEach(function ge(we){if(we.indexOf("+")!==-1)for(var Se=+we;Se--;)ge(se);else{se=we;var Me=we.split(">"),Ce=Me[0],Te=Me[1];Ce=String.fromCodePoint(ve+=parseInt(Ce,Ie)),Te=String.fromCodePoint(ve+=parseInt(Te,Ie)),ze.set(Ce,Te),pe&&Ae.set(Te,Ce)}}),{map:ze,reverseMap:Ae}}var w,x,C;function P(){if(!w){var Pe=y(m.pairs,!0),pe=Pe.map,Ie=Pe.reverseMap;w=pe,x=Ie,C=y(m.canonical,!1).map}}function A(Pe){return P(),w.get(Pe)||null}function S(Pe){return P(),x.get(Pe)||null}function v(Pe){return P(),C.get(Pe)||null}var b=o.L,T=o.R,R=o.EN,M=o.ES,D=o.ET,k=o.AN,N=o.CS,U=o.B,W=o.S,F=o.ON,E=o.BN,L=o.NSM,j=o.AL,Y=o.LRO,O=o.RLO,_=o.LRE,G=o.RLE,Q=o.PDF,oe=o.LRI,ee=o.RLI,q=o.FSI,ae=o.PDI;function Z(Pe,pe){for(var Ie=125,ve=new Uint32Array(Pe.length),ze=0;ze0)Fe--;else if(Le>0){for(He=0;!Ue[Ue.length-1]._isolate;)Ue.pop();var Qe=Ue[Ue.length-1]._isolInitIndex;Qe!=null&&(we.set(Qe,Ye),we.set(Ye,Qe)),Ue.pop(),Le--}qe=Ue[Ue.length-1],ge[Ye]=qe._level,qe._override&&se(Ye,qe._override)}else lt&Q?(Fe===0&&(He>0?He--:!qe._isolate&&Ue.length>1&&(Ue.pop(),qe=Ue[Ue.length-1])),ge[Ye]=qe._level):lt&U&&(ge[Ye]=Me.level);else ge[Ye]=qe._level,qe._override&<!==E&&se(Ye,qe._override)}for(var nt=[],mt=null,tt=Me.start;tt<=Me.end;tt++){var gt=ve[tt];if(!(gt&s)){var Ve=ge[tt],je=gt&i,et=gt===ae;mt&&Ve===mt._level?(mt._end=tt,mt._endsWithIsolInit=je):nt.push(mt={_start:tt,_end:tt,_level:Ve,_startsWithPDI:et,_endsWithIsolInit:je})}}for(var bt=[],St=0;St=0;st--)if(!(ve[st]&s)){Je=ge[st];break}var It=Ct[Ct.length-1],ot=ge[It],it=Me.level;if(!(ve[It]&i)){for(var Be=It+1;Be<=Me.end;Be++)if(!(ve[Be]&s)){it=ge[Be];break}}bt.push({_seqIndices:Ct,_sosType:Math.max(Je,Lt)%2?T:b,_eosType:Math.max(it,ot)%2?T:b})}}for(var pt=0;pt=0;qt--)if(!(ve[Xe[qt]]&s)){on=ve[Xe[qt]];break}se(Ot,on&(i|ae)?F:on)}}if(Ae.get(R))for(var rn=0;rn=-1;fo--){var to=fo===-1?ft:ve[Xe[fo]];if(to&a){to===j&&se(Pn,k);break}}}if(Ae.get(j))for(var Dt=0;Dt=0&&(ur=ve[Xe[xo]],!!(ur&s));xo--);for(var wo=kn+1;wo=0&&ve[Xe[An]]&(D|s);An--)se(Xe[An],R);for(Rr++;Rr=0&&ve[Xe[Vo]]&s;Vo--)se(Xe[Vo],F);for(var Wo=Dn+1;Wo=0;ea--){var rs=Pr[ea].char;if(rs===Ci||rs===S(v(zo))||A(v(rs))===zo){Bo.push([Pr[ea].seqIndex,so]),Pr.length=ea;break}}}Bo.sort(function(sn,dn){return sn[0]-dn[0]})}for(var Da=0;Da=0;ta--){var Ea=Xe[ta];if(ve[Ea]&bo){var Cs=ve[Ea]&vo?T:b;Cs!==kt?xi=Cs:xi=kt;break}}}if(xi){if(ve[Xe[cr]]=ve[Xe[ii]]=xi,xi!==kt){for(var El=cr+1;El=0;Gt--)if(ve[Xe[Gt]]&s)qp=Gt;else{tn=ve[Xe[Gt]]&vo?T:b;break}for(var wn=wt,Cn=Rs+1;Cn=0&&f(Pe[Nt])&c;Nt--)ge[Nt]=Me.level}}return{levels:ge,paragraphs:Se};function Ft(sn,dn){for(var En=sn;En=ge&&f(Pe[Me])&c;Me--)Se[Me]=se.level;for(var Ce=se.level,Te=1/0,Re=0;ReCe&&(Ce=Ne),Ne=Te;_e--)for(var Ue=0;Ue=_e){for(var qe=Ue;Ue+1=_e;)Ue++;Ue>qe&&Ae.push([qe+ge,Ue+ge])}}}),Ae}function me(Pe,pe,Ie,ve){var ze=ce(Pe,pe,Ie,ve),Ae=[].concat(Pe);return ze.forEach(function(se,ge){Ae[ge]=(pe.levels[se]&1?le(Pe[se]):null)||Pe[se]}),Ae.join("")}function ce(Pe,pe,Ie,ve){for(var ze=he(Pe,pe,Ie,ve),Ae=[],se=0;se/gm;function n(o,r){let i=pa[r];return i?Wde(i):o}return t.replace(e,n)}const sf=[];for(let t=0;t<256;t++)sf[t]=(t<16?"0":"")+t.toString(16);function Qvt(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(sf[t&255]+sf[t>>8&255]+sf[t>>16&255]+sf[t>>24&255]+"-"+sf[e&255]+sf[e>>8&255]+"-"+sf[e>>16&15|64]+sf[e>>24&255]+"-"+sf[n&63|128]+sf[n>>8&255]+"-"+sf[n>>16&255]+sf[n>>24&255]+sf[o&255]+sf[o>>8&255]+sf[o>>16&255]+sf[o>>24&255]).toUpperCase()}const Ox=Object.assign||function(){let t=arguments[0];for(let e=1,n=arguments.length;e/gm,` +;(`+n+")()"],{type:"application/javascript"}))),e.onmessage=function(o){var r=o.data,i=r.messageId,a=Lde[i];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete Lde[i],a(r)}}return e}function hbe(t,e,n){return new Promise(function(o,r){var i=++Jvt;Lde[i]=function(a){a.success?o(a.result):r(new Error("Error in worker "+e+" call: "+a.error))},$vt(t).postMessage({messageId:i,action:e,data:n})})}function yVe(){var t=function(e){function n(j,Y,O,_,G,Q,oe,ee){var $=1-oe;ee.x=$*$*j+2*$*oe*O+oe*oe*G,ee.y=$*$*Y+2*$*oe*_+oe*oe*Q}function o(j,Y,O,_,G,Q,oe,ee,$,ae){var Z=1-$;ae.x=Z*Z*Z*j+3*Z*Z*$*O+3*Z*$*$*G+$*$*$*oe,ae.y=Z*Z*Z*Y+3*Z*Z*$*_+3*Z*$*$*Q+$*$*$*ee}function r(j,Y){for(var O=/([MLQCZ])([^MLQCZ]*)/g,_,G,Q,oe,ee;_=O.exec(j);){var $=_[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(ae){return parseFloat(ae)});switch(_[1]){case"M":oe=G=$[0],ee=Q=$[1];break;case"L":($[0]!==oe||$[1]!==ee)&&Y("L",oe,ee,oe=$[0],ee=$[1]);break;case"Q":{Y("Q",oe,ee,oe=$[2],ee=$[3],$[0],$[1]);break}case"C":{Y("C",oe,ee,oe=$[4],ee=$[5],$[0],$[1],$[2],$[3]);break}case"Z":(oe!==G||ee!==Q)&&Y("L",oe,ee,G,Q);break}}}function i(j,Y,O){O===void 0&&(O=16);var _={x:0,y:0};r(j,function(G,Q,oe,ee,$,ae,Z,ne,te){switch(G){case"L":Y(Q,oe,ee,$);break;case"Q":{for(var q=Q,le=oe,de=1;de0;)_e[Ue]=arguments[Ue+2];var qe=we[Ne]||(we[Ne]=O.getUniformLocation(Se,Ne));O["uniform"+Re].apply(O,[qe].concat(_e))},setAttribute:function(Re,Ne,_e,Ue,qe){var Fe=ge[Re];Fe||(Fe=ge[Re]={buf:O.createBuffer(),loc:O.getAttribLocation(Se,Re),data:null}),O.bindBuffer(O.ARRAY_BUFFER,Fe.buf),O.vertexAttribPointer(Fe.loc,Ne,O.FLOAT,!1,0,0),O.enableVertexAttribArray(Fe.loc),G?O.vertexAttribDivisor(Fe.loc,Ue):he("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Fe.loc,Ue),qe!==Fe.data&&(O.bufferData(O.ARRAY_BUFFER,qe,_e),Fe.data=qe)}})}}}oe[ve].transaction(se)},Pe=function(ve,ze){$++;try{O.activeTexture(O.TEXTURE0+$);var Ae=ee[ve];Ae||(Ae=ee[ve]=O.createTexture(),O.bindTexture(O.TEXTURE_2D,Ae),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MIN_FILTER,O.NEAREST),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MAG_FILTER,O.NEAREST)),O.bindTexture(O.TEXTURE_2D,Ae),ze(Ae,$)}finally{$--}},pe=function(ve,ze,Ae){var se=O.createFramebuffer();ae.push(se),O.bindFramebuffer(O.FRAMEBUFFER,se),O.activeTexture(O.TEXTURE0+ze),O.bindTexture(O.TEXTURE_2D,ve),O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,ve,0);try{Ae(se)}finally{O.deleteFramebuffer(se),O.bindFramebuffer(O.FRAMEBUFFER,ae[--ae.length-1]||null)}},Ie=function(){Q={},oe={},ee={},$=-1,ae.length=0};var Z=he,ne=me,te=ce,q=Pe,le=pe,de=Ie,G=typeof WebGL2RenderingContext<"u"&&O instanceof WebGL2RenderingContext,Q={},oe={},ee={},$=-1,ae=[];O.canvas.addEventListener("webglcontextlost",function(ve){Ie(),ve.preventDefault()},!1),s.set(O,_={gl:O,isWebGL2:G,getExtension:he,withProgram:ce,withTexture:Pe,withTextureFramebuffer:pe,handleContextLoss:Ie})}Y(_)}function d(j,Y,O,_,G,Q,oe,ee){oe===void 0&&(oe=15),ee===void 0&&(ee=null),u(j,function($){var ae=$.gl,Z=$.withProgram,ne=$.withTexture;ne("copy",function(te,q){ae.texImage2D(ae.TEXTURE_2D,0,ae.RGBA,G,Q,0,ae.RGBA,ae.UNSIGNED_BYTE,Y),Z("copy",a,l,function(le){var de=le.setUniform,he=le.setAttribute;he("aUV",2,ae.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),de("1i","image",q),ae.bindFramebuffer(ae.FRAMEBUFFER,ee||null),ae.disable(ae.BLEND),ae.colorMask(oe&8,oe&4,oe&2,oe&1),ae.viewport(O,_,G,Q),ae.scissor(O,_,G,Q),ae.drawArrays(ae.TRIANGLES,0,3)})})})}function f(j,Y,O){var _=j.width,G=j.height;u(j,function(Q){var oe=Q.gl,ee=new Uint8Array(_*G*4);oe.readPixels(0,0,_,G,oe.RGBA,oe.UNSIGNED_BYTE,ee),j.width=Y,j.height=O,d(oe,ee,0,0,_,G)})}var p=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:d,resizeWebGLCanvasWithoutClearing:f});function m(j,Y,O,_,G,Q){Q===void 0&&(Q=1);var oe=new Uint8Array(j*Y),ee=_[2]-_[0],$=_[3]-_[1],ae=[];i(O,function(he,me,ce,Pe){ae.push({x1:he,y1:me,x2:ce,y2:Pe,minX:Math.min(he,ce),minY:Math.min(me,Pe),maxX:Math.max(he,ce),maxY:Math.max(me,Pe)})}),ae.sort(function(he,me){return he.maxX-me.maxX});for(var Z=0;ZIe.minX&&me-PeIe.minY){var ve=x(he,me,Ie.x1,Ie.y1,Ie.x2,Ie.y2);veme!=pe.y2>me&&he<(pe.x2-pe.x1)*(me-pe.y1)/(pe.y2-pe.y1)+pe.x1;Ie&&(ce+=pe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function y(Pe,pe){var Ie=36,ve=0,ze=new Map,Ae=pe&&new Map,se;return Pe.split(",").forEach(function ge(we){if(we.indexOf("+")!==-1)for(var Se=+we;Se--;)ge(se);else{se=we;var Me=we.split(">"),Ce=Me[0],Te=Me[1];Ce=String.fromCodePoint(ve+=parseInt(Ce,Ie)),Te=String.fromCodePoint(ve+=parseInt(Te,Ie)),ze.set(Ce,Te),pe&&Ae.set(Te,Ce)}}),{map:ze,reverseMap:Ae}}var w,x,C;function P(){if(!w){var Pe=y(m.pairs,!0),pe=Pe.map,Ie=Pe.reverseMap;w=pe,x=Ie,C=y(m.canonical,!1).map}}function A(Pe){return P(),w.get(Pe)||null}function S(Pe){return P(),x.get(Pe)||null}function v(Pe){return P(),C.get(Pe)||null}var b=o.L,T=o.R,R=o.EN,M=o.ES,D=o.ET,k=o.AN,N=o.CS,U=o.B,W=o.S,F=o.ON,E=o.BN,L=o.NSM,j=o.AL,Y=o.LRO,O=o.RLO,_=o.LRE,G=o.RLE,Q=o.PDF,oe=o.LRI,ee=o.RLI,$=o.FSI,ae=o.PDI;function Z(Pe,pe){for(var Ie=125,ve=new Uint32Array(Pe.length),ze=0;ze0)Fe--;else if(Le>0){for(He=0;!Ue[Ue.length-1]._isolate;)Ue.pop();var Qe=Ue[Ue.length-1]._isolInitIndex;Qe!=null&&(we.set(Qe,Ye),we.set(Ye,Qe)),Ue.pop(),Le--}qe=Ue[Ue.length-1],ge[Ye]=qe._level,qe._override&&se(Ye,qe._override)}else lt&Q?(Fe===0&&(He>0?He--:!qe._isolate&&Ue.length>1&&(Ue.pop(),qe=Ue[Ue.length-1])),ge[Ye]=qe._level):lt&U&&(ge[Ye]=Me.level);else ge[Ye]=qe._level,qe._override&<!==E&&se(Ye,qe._override)}for(var nt=[],mt=null,tt=Me.start;tt<=Me.end;tt++){var gt=ve[tt];if(!(gt&s)){var Ve=ge[tt],je=gt&i,et=gt===ae;mt&&Ve===mt._level?(mt._end=tt,mt._endsWithIsolInit=je):nt.push(mt={_start:tt,_end:tt,_level:Ve,_startsWithPDI:et,_endsWithIsolInit:je})}}for(var bt=[],St=0;St=0;st--)if(!(ve[st]&s)){Je=ge[st];break}var It=Ct[Ct.length-1],ot=ge[It],it=Me.level;if(!(ve[It]&i)){for(var Be=It+1;Be<=Me.end;Be++)if(!(ve[Be]&s)){it=ge[Be];break}}bt.push({_seqIndices:Ct,_sosType:Math.max(Je,Lt)%2?T:b,_eosType:Math.max(it,ot)%2?T:b})}}for(var pt=0;pt=0;qt--)if(!(ve[Xe[qt]]&s)){on=ve[Xe[qt]];break}se(Ot,on&(i|ae)?F:on)}}if(Ae.get(R))for(var rn=0;rn=-1;fo--){var to=fo===-1?ft:ve[Xe[fo]];if(to&a){to===j&&se(Pn,k);break}}}if(Ae.get(j))for(var Dt=0;Dt=0&&(ur=ve[Xe[xo]],!!(ur&s));xo--);for(var wo=kn+1;wo=0&&ve[Xe[An]]&(D|s);An--)se(Xe[An],R);for(Rr++;Rr=0&&ve[Xe[Vo]]&s;Vo--)se(Xe[Vo],F);for(var Wo=Dn+1;Wo=0;ea--){var rs=Pr[ea].char;if(rs===Ci||rs===S(v(zo))||A(v(rs))===zo){Bo.push([Pr[ea].seqIndex,so]),Pr.length=ea;break}}}Bo.sort(function(sn,dn){return sn[0]-dn[0]})}for(var Da=0;Da=0;ta--){var Ea=Xe[ta];if(ve[Ea]&bo){var Cs=ve[Ea]&vo?T:b;Cs!==kt?xi=Cs:xi=kt;break}}}if(xi){if(ve[Xe[cr]]=ve[Xe[ii]]=xi,xi!==kt){for(var El=cr+1;El=0;Gt--)if(ve[Xe[Gt]]&s)qp=Gt;else{tn=ve[Xe[Gt]]&vo?T:b;break}for(var wn=wt,Cn=Rs+1;Cn=0&&f(Pe[Nt])&c;Nt--)ge[Nt]=Me.level}}return{levels:ge,paragraphs:Se};function Ft(sn,dn){for(var En=sn;En=ge&&f(Pe[Me])&c;Me--)Se[Me]=se.level;for(var Ce=se.level,Te=1/0,Re=0;ReCe&&(Ce=Ne),Ne=Te;_e--)for(var Ue=0;Ue=_e){for(var qe=Ue;Ue+1=_e;)Ue++;Ue>qe&&Ae.push([qe+ge,Ue+ge])}}}),Ae}function me(Pe,pe,Ie,ve){var ze=ce(Pe,pe,Ie,ve),Ae=[].concat(Pe);return ze.forEach(function(se,ge){Ae[ge]=(pe.levels[se]&1?le(Pe[se]):null)||Pe[se]}),Ae.join("")}function ce(Pe,pe,Ie,ve){for(var ze=he(Pe,pe,Ie,ve),Ae=[],se=0;se/gm;function n(o,r){let i=pa[r];return i?Wde(i):o}return t.replace(e,n)}const sf=[];for(let t=0;t<256;t++)sf[t]=(t<16?"0":"")+t.toString(16);function Qvt(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(sf[t&255]+sf[t>>8&255]+sf[t>>16&255]+sf[t>>24&255]+"-"+sf[e&255]+sf[e>>8&255]+"-"+sf[e>>16&15|64]+sf[e>>24&255]+"-"+sf[n&63|128]+sf[n>>8&255]+"-"+sf[n>>16&255]+sf[n>>24&255]+sf[o&255]+sf[o>>8&255]+sf[o>>16&255]+sf[o>>24&255]).toUpperCase()}const Ox=Object.assign||function(){let t=arguments[0];for(let e=1,n=arguments.length;e/gm,` //!BEGIN_POST_CHUNK $1 $& //!END_POST_CHUNK @@ -4134,17 +4134,17 @@ void main() { ${r} }`),t}function nbt(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let obt=0;const ybe=new Map;function rbt(t){const e=JSON.stringify(t,nbt);let n=ybe.get(e);return n==null&&ybe.set(e,n=++obt),n}function ibt(t,e,n){const{defaultFontURL:o}=n,r=Object.create(null),i=1/0,a=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,l="[^\\S\\u00A0]",s=new RegExp(`${l}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function c(C,P){function A(){const S=v=>{console.error(`Failure loading font ${C}${C===o?"":"; trying fallback"}`,v),C!==o&&(C=o,A())};try{const v=new XMLHttpRequest;v.open("get",C,!0),v.responseType="arraybuffer",v.onload=function(){if(v.status>=400)S(new Error(v.statusText));else if(v.status>0)try{const b=t(v.response);P(b)}catch(b){S(b)}},v.onerror=S,v.send()}catch(v){S(v)}}A()}function u(C,P){C||(C=o);let A=r[C];A?A.pending?A.pending.push(P):P(A):(r[C]={pending:[P]},c(C,S=>{let v=r[C].pending;r[C]=S,v.forEach(b=>b(S))}))}function d({text:C="",font:P=o,sdfGlyphSize:A=64,fontSize:S=1,letterSpacing:v=0,lineHeight:b="normal",maxWidth:T=i,direction:R,textAlign:M="left",textIndent:D=0,whiteSpace:k="normal",overflowWrap:N="normal",anchorX:U=0,anchorY:W=0,includeCaretPositions:F=!1,chunkedBoundsSize:E=8192,colorRanges:L=null},j,Y=!1){const O=y(),_={fontLoad:0,typesetting:0};C.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),C=C.replace(/\r\n/g,` `).replace(/\r/g,` -`)),S=+S,v=+v,T=+T,b=b||"normal",D=+D,u(P,G=>{const Q=isFinite(T);let oe=null,ee=null,q=null,ae=null,Z=null,ne=null,te=null,$=0,le=0,de=k!=="nowrap";const{ascender:he,descender:me,unitsPerEm:ce,lineGap:Pe,capHeight:pe,xHeight:Ie}=G;_.fontLoad=y()-O;const ve=y(),ze=S/ce;b==="normal"&&(b=(he-me+Pe)/ce),b=b*S;const Ae=(b-(he-me)*ze)/2,se=-(he*ze+Ae),ge=Math.min(b,(he-me)*ze),we=(he+me)/2*ze-ge/2;let Se=D,Me=new w;const Ce=[Me];G.forEachGlyph(C,S,v,(Ne,_e,Ue)=>{const qe=C.charAt(Ue),Fe=Ne.advanceWidth*ze,He=Me.count;let Le;if("isEmpty"in Ne||(Ne.isWhitespace=!!qe&&new RegExp(l).test(qe),Ne.canBreakAfter=!!qe&&s.test(qe),Ne.isEmpty=Ne.xMin===Ne.xMax||Ne.yMin===Ne.yMax||a.test(qe)),!Ne.isWhitespace&&!Ne.isEmpty&&le++,de&&Q&&!Ne.isWhitespace&&_e+Fe+Se>T&&He){if(Me.glyphAt(He-1).glyphObj.canBreakAfter)Le=new w,Se=-_e;else for(let lt=He;lt--;)if(lt===0&&N==="break-word"){Le=new w,Se=-_e;break}else if(Me.glyphAt(lt).glyphObj.canBreakAfter){Le=Me.splitAt(lt+1);const Oe=Le.glyphAt(0).x;Se-=Oe;for(let ut=Le.count;ut--;)Le.glyphAt(ut).x-=Oe;break}Le&&(Me.isSoftWrapped=!0,Me=Le,Ce.push(Me),$=T)}let Ye=Me.glyphAt(Me.count);Ye.glyphObj=Ne,Ye.x=_e+Se,Ye.width=Fe,Ye.charIndex=Ue,qe===` -`&&(Me=new w,Ce.push(Me),Se=-(_e+Fe+v*S)+D)}),Ce.forEach(Ne=>{for(let _e=Ne.count;_e--;){let{glyphObj:Ue,x:qe,width:Fe}=Ne.glyphAt(_e);if(!Ue.isWhitespace){Ne.width=qe+Fe,Ne.width>$&&($=Ne.width);return}}});let Te=0,Re=0;if(U&&(typeof U=="number"?Te=-U:typeof U=="string"&&(Te=-$*(U==="left"?0:U==="center"?.5:U==="right"?1:p(U)))),W){if(typeof W=="number")Re=-W;else if(typeof W=="string"){let Ne=Ce.length*b;Re=W==="top"?0:W==="top-baseline"?-se:W==="top-cap"?-se-pe*ze:W==="top-ex"?-se-Ie*ze:W==="middle"?Ne/2:W==="bottom"?Ne:W==="bottom-baseline"?Ne-Ae+me*ze:p(W)*Ne}}if(!Y){const Ne=e.getEmbeddingLevels(C,R);oe=new Uint16Array(le),ee=new Float32Array(le*2),q={},ne=[i,i,-i,-i],te=[];let _e=se;F&&(Z=new Float32Array(C.length*3)),L&&(ae=new Uint8Array(le*3));let Ue=0,qe=-1,Fe=-1,He,Le;if(Ce.forEach((Ye,lt)=>{let{count:Oe,width:ut}=Ye;if(Oe>0){let ht=0;for(let Ve=Oe;Ve--&&Ye.glyphAt(Ve).glyphObj.isWhitespace;)ht++;let Qe=0,nt=0;if(M==="center")Qe=($-ut)/2;else if(M==="right")Qe=$-ut;else if(M==="justify"&&Ye.isSoftWrapped){let Ve=0;for(let je=Oe-ht;je--;)Ye.glyphAt(je).glyphObj.isWhitespace&&Ve++;nt=($-ut)/Ve}if(nt||Qe){let Ve=0;for(let je=0;je=je){let Yt=Pt,zt=Pt;for(;ztet)break;zttt=Ve;for(let Ve=0;Ve1&&m(Z,qe,zt),qe=St}if(L){const{charIndex:St}=je;for(;St>Fe;)Fe++,L.hasOwnProperty(Fe)&&(Le=L[Fe])}if(!tt.isWhitespace&&!tt.isEmpty){const St=Ue++;q[et]||(q[et]={path:tt.path,pathBounds:[tt.xMin,tt.yMin,tt.xMax,tt.yMax]});const Pt=je.x+Te,Yt=_e+Re;ee[St*2]=Pt,ee[St*2+1]=Yt;const zt=Pt+tt.xMin*ze,Rt=Yt+tt.yMin*ze,Ct=Pt+tt.xMax*ze,yt=Yt+tt.yMax*ze;ztne[2]&&(ne[2]=Ct),yt>ne[3]&&(ne[3]=yt),St%E===0&&(He={start:St,end:St,rect:[i,i,-i,-i]},te.push(He)),He.end++;const at=He.rect;if(ztat[2]&&(at[2]=Ct),yt>at[3]&&(at[3]=yt),oe[St]=et,L){const Et=St*3;ae[Et]=Le>>16&255,ae[Et+1]=Le>>8&255,ae[Et+2]=Le&255}}}}_e-=b}),Z){const Ye=C.length-qe;Ye>1&&m(Z,qe,Ye)}}_.typesetting=y()-ve,j({glyphIds:oe,glyphPositions:ee,glyphData:q,caretPositions:Z,caretHeight:ge,glyphColors:ae,chunkedBounds:te,fontSize:S,unitsPerEm:ce,ascender:he*ze,descender:me*ze,capHeight:pe*ze,xHeight:Ie*ze,lineHeight:b,topBaseline:se,blockBounds:[Te,Re-Ce.length*b,Te+$,Re],visibleBounds:ne,timings:_})})}function f(C,P){d(C,A=>{const[S,v,b,T]=A.blockBounds;P({width:b-S,height:T-v})},{})}function p(C){let P=C.match(/^([\d.]+)%$/),A=P?parseFloat(P[1]):NaN;return isNaN(A)?0:A/100}function m(C,P,A){const S=C[P*3],v=C[P*3+1],b=C[P*3+2],T=(v-S)/A;for(let R=0;R(Object.defineProperty(C,P,{get(){return this.data[this.index*x.length+A]},set(v){this.data[this.index*x.length+A]=v}}),C),{data:null,index:0}),{typeset:d,measure:f,loadFont:u}}const hb=()=>(self.performance||Date).now(),oQ=yVe();let Abe;function abt(t,e,n,o,r,i,a,l,s,c,u=!0){return u?sbt(t,e,n,o,r,i,a,l,s,c).then(null,d=>(Abe||(console.warn("WebGL SDF generation failed, falling back to JS",d),Abe=!0),xbe(t,e,n,o,r,i,a,l,s,c))):xbe(t,e,n,o,r,i,a,l,s,c)}const tG=[],lbt=5;let Ude=0;function wVe(){const t=hb();for(;tG.length&&hb()-tnew Promise((e,n)=>{tG.push(()=>{const o=hb();try{oQ.webgl.generateIntoCanvas(...t),e({timing:hb()-o})}catch(r){n(r)}}),Ude||(Ude=setTimeout(wVe,0))}),cbt=4,ubt=2e3,wbe={};let dbt=0;function xbe(t,e,n,o,r,i,a,l,s,c){const u="TroikaTextSDFGenerator_JS_"+dbt++%cbt;let d=wbe[u];return d||(d=wbe[u]={workerModule:LN({name:u,workerId:u,dependencies:[yVe,hb],init(f,p){const m=f().javascript.generate;return function(...y){const w=p();return{textureData:m(...y),timing:p()-w}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(t,e,n,o,r,i).then(({textureData:f,timing:p})=>{const m=hb(),y=new Uint8Array(f.length*4);for(let w=0;w{Kvt(u)},ubt)),{timing:p}})}function fbt(t){t._warm||(oQ.webgl.isSupported(t),t._warm=!0)}const hbt=oQ.webglUtils.resizeWebGLCanvasWithoutClearing;/*! +`)),S=+S,v=+v,T=+T,b=b||"normal",D=+D,u(P,G=>{const Q=isFinite(T);let oe=null,ee=null,$=null,ae=null,Z=null,ne=null,te=null,q=0,le=0,de=k!=="nowrap";const{ascender:he,descender:me,unitsPerEm:ce,lineGap:Pe,capHeight:pe,xHeight:Ie}=G;_.fontLoad=y()-O;const ve=y(),ze=S/ce;b==="normal"&&(b=(he-me+Pe)/ce),b=b*S;const Ae=(b-(he-me)*ze)/2,se=-(he*ze+Ae),ge=Math.min(b,(he-me)*ze),we=(he+me)/2*ze-ge/2;let Se=D,Me=new w;const Ce=[Me];G.forEachGlyph(C,S,v,(Ne,_e,Ue)=>{const qe=C.charAt(Ue),Fe=Ne.advanceWidth*ze,He=Me.count;let Le;if("isEmpty"in Ne||(Ne.isWhitespace=!!qe&&new RegExp(l).test(qe),Ne.canBreakAfter=!!qe&&s.test(qe),Ne.isEmpty=Ne.xMin===Ne.xMax||Ne.yMin===Ne.yMax||a.test(qe)),!Ne.isWhitespace&&!Ne.isEmpty&&le++,de&&Q&&!Ne.isWhitespace&&_e+Fe+Se>T&&He){if(Me.glyphAt(He-1).glyphObj.canBreakAfter)Le=new w,Se=-_e;else for(let lt=He;lt--;)if(lt===0&&N==="break-word"){Le=new w,Se=-_e;break}else if(Me.glyphAt(lt).glyphObj.canBreakAfter){Le=Me.splitAt(lt+1);const Oe=Le.glyphAt(0).x;Se-=Oe;for(let ut=Le.count;ut--;)Le.glyphAt(ut).x-=Oe;break}Le&&(Me.isSoftWrapped=!0,Me=Le,Ce.push(Me),q=T)}let Ye=Me.glyphAt(Me.count);Ye.glyphObj=Ne,Ye.x=_e+Se,Ye.width=Fe,Ye.charIndex=Ue,qe===` +`&&(Me=new w,Ce.push(Me),Se=-(_e+Fe+v*S)+D)}),Ce.forEach(Ne=>{for(let _e=Ne.count;_e--;){let{glyphObj:Ue,x:qe,width:Fe}=Ne.glyphAt(_e);if(!Ue.isWhitespace){Ne.width=qe+Fe,Ne.width>q&&(q=Ne.width);return}}});let Te=0,Re=0;if(U&&(typeof U=="number"?Te=-U:typeof U=="string"&&(Te=-q*(U==="left"?0:U==="center"?.5:U==="right"?1:p(U)))),W){if(typeof W=="number")Re=-W;else if(typeof W=="string"){let Ne=Ce.length*b;Re=W==="top"?0:W==="top-baseline"?-se:W==="top-cap"?-se-pe*ze:W==="top-ex"?-se-Ie*ze:W==="middle"?Ne/2:W==="bottom"?Ne:W==="bottom-baseline"?Ne-Ae+me*ze:p(W)*Ne}}if(!Y){const Ne=e.getEmbeddingLevels(C,R);oe=new Uint16Array(le),ee=new Float32Array(le*2),$={},ne=[i,i,-i,-i],te=[];let _e=se;F&&(Z=new Float32Array(C.length*3)),L&&(ae=new Uint8Array(le*3));let Ue=0,qe=-1,Fe=-1,He,Le;if(Ce.forEach((Ye,lt)=>{let{count:Oe,width:ut}=Ye;if(Oe>0){let ht=0;for(let Ve=Oe;Ve--&&Ye.glyphAt(Ve).glyphObj.isWhitespace;)ht++;let Qe=0,nt=0;if(M==="center")Qe=(q-ut)/2;else if(M==="right")Qe=q-ut;else if(M==="justify"&&Ye.isSoftWrapped){let Ve=0;for(let je=Oe-ht;je--;)Ye.glyphAt(je).glyphObj.isWhitespace&&Ve++;nt=(q-ut)/Ve}if(nt||Qe){let Ve=0;for(let je=0;je=je){let Yt=Pt,zt=Pt;for(;ztet)break;zttt=Ve;for(let Ve=0;Ve1&&m(Z,qe,zt),qe=St}if(L){const{charIndex:St}=je;for(;St>Fe;)Fe++,L.hasOwnProperty(Fe)&&(Le=L[Fe])}if(!tt.isWhitespace&&!tt.isEmpty){const St=Ue++;$[et]||($[et]={path:tt.path,pathBounds:[tt.xMin,tt.yMin,tt.xMax,tt.yMax]});const Pt=je.x+Te,Yt=_e+Re;ee[St*2]=Pt,ee[St*2+1]=Yt;const zt=Pt+tt.xMin*ze,Rt=Yt+tt.yMin*ze,Ct=Pt+tt.xMax*ze,yt=Yt+tt.yMax*ze;ztne[2]&&(ne[2]=Ct),yt>ne[3]&&(ne[3]=yt),St%E===0&&(He={start:St,end:St,rect:[i,i,-i,-i]},te.push(He)),He.end++;const at=He.rect;if(ztat[2]&&(at[2]=Ct),yt>at[3]&&(at[3]=yt),oe[St]=et,L){const Et=St*3;ae[Et]=Le>>16&255,ae[Et+1]=Le>>8&255,ae[Et+2]=Le&255}}}}_e-=b}),Z){const Ye=C.length-qe;Ye>1&&m(Z,qe,Ye)}}_.typesetting=y()-ve,j({glyphIds:oe,glyphPositions:ee,glyphData:$,caretPositions:Z,caretHeight:ge,glyphColors:ae,chunkedBounds:te,fontSize:S,unitsPerEm:ce,ascender:he*ze,descender:me*ze,capHeight:pe*ze,xHeight:Ie*ze,lineHeight:b,topBaseline:se,blockBounds:[Te,Re-Ce.length*b,Te+q,Re],visibleBounds:ne,timings:_})})}function f(C,P){d(C,A=>{const[S,v,b,T]=A.blockBounds;P({width:b-S,height:T-v})},{})}function p(C){let P=C.match(/^([\d.]+)%$/),A=P?parseFloat(P[1]):NaN;return isNaN(A)?0:A/100}function m(C,P,A){const S=C[P*3],v=C[P*3+1],b=C[P*3+2],T=(v-S)/A;for(let R=0;R(Object.defineProperty(C,P,{get(){return this.data[this.index*x.length+A]},set(v){this.data[this.index*x.length+A]=v}}),C),{data:null,index:0}),{typeset:d,measure:f,loadFont:u}}const hb=()=>(self.performance||Date).now(),oQ=yVe();let Abe;function abt(t,e,n,o,r,i,a,l,s,c,u=!0){return u?sbt(t,e,n,o,r,i,a,l,s,c).then(null,d=>(Abe||(console.warn("WebGL SDF generation failed, falling back to JS",d),Abe=!0),xbe(t,e,n,o,r,i,a,l,s,c))):xbe(t,e,n,o,r,i,a,l,s,c)}const tG=[],lbt=5;let Ude=0;function wVe(){const t=hb();for(;tG.length&&hb()-tnew Promise((e,n)=>{tG.push(()=>{const o=hb();try{oQ.webgl.generateIntoCanvas(...t),e({timing:hb()-o})}catch(r){n(r)}}),Ude||(Ude=setTimeout(wVe,0))}),cbt=4,ubt=2e3,wbe={};let dbt=0;function xbe(t,e,n,o,r,i,a,l,s,c){const u="TroikaTextSDFGenerator_JS_"+dbt++%cbt;let d=wbe[u];return d||(d=wbe[u]={workerModule:LN({name:u,workerId:u,dependencies:[yVe,hb],init(f,p){const m=f().javascript.generate;return function(...y){const w=p();return{textureData:m(...y),timing:p()-w}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(t,e,n,o,r,i).then(({textureData:f,timing:p})=>{const m=hb(),y=new Uint8Array(f.length*4);for(let w=0;w{Kvt(u)},ubt)),{timing:p}})}function fbt(t){t._warm||(oQ.webgl.isSupported(t),t._warm=!0)}const hbt=oQ.webglUtils.resizeWebGLCanvasWithoutClearing;/*! Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE -*/function pbt(){return typeof window>"u"&&(self.window=self),function(t){var e={parse:function(r){var i=e._bin,a=new Uint8Array(r);if(i.readASCII(a,0,4)=="ttcf"){var l=4;i.readUshort(a,l),l+=2,i.readUshort(a,l),l+=2;var s=i.readUint(a,l);l+=4;for(var c=[],u=0;u>>a&1&&i++;return i},e._lctf.readClassDef=function(r,i){var a=e._bin,l=[],s=a.readUshort(r,i);if(i+=2,s==1){var c=a.readUshort(r,i);i+=2;var u=a.readUshort(r,i);i+=2;for(var d=0;d0&&(s.featureParams=l+c);var u=a.readUshort(r,i);i+=2,s.tab=[];for(var d=0;d255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[i])},e.CFF.readEncoding=function(r,i,a){e._bin;var l=[".notdef"],s=r[i];if(i++,s!=0)throw"error: unknown encoding format: "+s;var c=r[i];i++;for(var u=0;u>4,C=15&w;if(x!=15&&y.push(x),C!=15&&y.push(C),C==15)break}for(var P="",A=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],S=0;S=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u=1&&u.fmt<=2){f=s.readUshort(r,a),a+=2;var m=s.readUshort(r,a);a+=2,p=e._lctf.numOfOnes(f);var y=e._lctf.numOfOnes(m);if(u.fmt==1){u.pairsets=[];var w=s.readUshort(r,a);a+=2;for(var x=0;x=1&&u.fmt<=2){if(u.fmt==1)u.delta=s.readShort(r,a),a+=2;else if(u.fmt==2){var f=s.readUshort(r,a);a+=2,u.newg=s.readUshorts(r,a,f),a+=2*u.newg.length}}else if(i==4){u.vals=[],f=s.readUshort(r,a),a+=2;for(var p=0;p>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;i=e.kern.readFormat0(r,i,d)}return d},e.kern.parseV1=function(r,i,a,l){var s=e._bin;s.readFixed(r,i),i+=4;var c=s.readUint(r,i);i+=4;for(var u={glyph1:[],rval:[]},d=0;d>>8;if((p&=15)!=0)throw"unknown kern table format: "+p;i=e.kern.readFormat0(r,i,u)}return u},e.kern.readFormat0=function(r,i,a){var l=e._bin,s=-1,c=l.readUshort(r,i);i+=2,l.readUshort(r,i),i+=2,l.readUshort(r,i),i+=2,l.readUshort(r,i),i+=2;for(var u=0;u=s.map.length?0:s.map[i];if(s.format==4){for(var c=-1,u=0;ui?0:65535&(s.idRangeOffset[c]!=0?s.glyphIdArray[i-s.startCount[c]+(s.idRangeOffset[c]>>1)-(s.idRangeOffset.length-c)]:i+s.idDelta[c])}if(s.format==12){if(i>s.groups[s.groups.length-1][1])return 0;for(u=0;u-1?e.U._simpleGlyph(l,a):e.U._compoGlyph(l,i,a))},e.U._simpleGlyph=function(r,i){for(var a=0;as)){for(var w=!0,x=0,C=0;Cs)){for(w=!0,C=0;C>1,c.length=0,d=!0;else if(k=="o3"||k=="o23")c.length%2!=0&&!d&&(f=c.shift()+l.nominalWidthX),u+=c.length>>1,c.length=0,d=!0;else if(k=="o4")c.length>1&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),p&&e.U.P.closePath(s),w+=c.pop(),e.U.P.moveTo(s,y,w),p=!0;else if(k=="o5")for(;c.length>0;)y+=c.shift(),w+=c.shift(),e.U.P.lineTo(s,y,w);else if(k=="o6"||k=="o7")for(var N=c.length,U=k=="o6",W=0;WMath.abs(T-w)?y=b+c.shift():w=T+c.shift(),e.U.P.curveTo(s,x,C,P,A,R,M),e.U.P.curveTo(s,S,v,b,T,y,w));else if(k=="o14"){if(c.length>0&&!d&&(f=c.shift()+a.nominalWidthX,d=!0),c.length==4){var L=c.shift(),j=c.shift(),Y=c.shift(),O=c.shift(),_=e.CFF.glyphBySE(a,Y),G=e.CFF.glyphBySE(a,O);e.U._drawCFF(a.CharStrings[_],i,a,l,s),i.x=L,i.y=j,e.U._drawCFF(a.CharStrings[G],i,a,l,s)}p&&(e.U.P.closePath(s),p=!1)}else if(k=="o19"||k=="o20")c.length%2!=0&&!d&&(f=c.shift()+l.nominalWidthX),u+=c.length>>1,c.length=0,d=!0,m+=u+7>>3;else if(k=="o21")c.length>2&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),w+=c.pop(),y+=c.pop(),p&&e.U.P.closePath(s),e.U.P.moveTo(s,y,w),p=!0;else if(k=="o22")c.length>1&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),y+=c.pop(),p&&e.U.P.closePath(s),e.U.P.moveTo(s,y,w),p=!0;else if(k=="o25"){for(;c.length>6;)y+=c.shift(),w+=c.shift(),e.U.P.lineTo(s,y,w);x=y+c.shift(),C=w+c.shift(),P=x+c.shift(),A=C+c.shift(),y=P+c.shift(),w=A+c.shift(),e.U.P.curveTo(s,x,C,P,A,y,w)}else if(k=="o26")for(c.length%2&&(y+=c.shift());c.length>0;)x=y,C=w+c.shift(),y=P=x+c.shift(),w=(A=C+c.shift())+c.shift(),e.U.P.curveTo(s,x,C,P,A,y,w);else if(k=="o27")for(c.length%2&&(w+=c.shift());c.length>0;)C=w,P=(x=y+c.shift())+c.shift(),A=C+c.shift(),y=P+c.shift(),w=A,e.U.P.curveTo(s,x,C,P,A,y,w);else if(k=="o10"||k=="o29"){var Q=k=="o10"?l:a;if(c.length==0)console.debug("error: empty stack");else{var oe=c.pop(),ee=Q.Subrs[oe+Q.Bias];i.x=y,i.y=w,i.nStems=u,i.haveWidth=d,i.width=f,i.open=p,e.U._drawCFF(ee,i,a,l,s),y=i.x,w=i.y,u=i.nStems,d=i.haveWidth,f=i.width,p=i.open}}else if(k=="o30"||k=="o31"){var q=c.length,ae=(E=0,k=="o31");for(E+=q-(N=-3&q);E"u"&&(self.window=self),function(t){var e={parse:function(r){var i=e._bin,a=new Uint8Array(r);if(i.readASCII(a,0,4)=="ttcf"){var l=4;i.readUshort(a,l),l+=2,i.readUshort(a,l),l+=2;var s=i.readUint(a,l);l+=4;for(var c=[],u=0;u>>a&1&&i++;return i},e._lctf.readClassDef=function(r,i){var a=e._bin,l=[],s=a.readUshort(r,i);if(i+=2,s==1){var c=a.readUshort(r,i);i+=2;var u=a.readUshort(r,i);i+=2;for(var d=0;d0&&(s.featureParams=l+c);var u=a.readUshort(r,i);i+=2,s.tab=[];for(var d=0;d255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[i])},e.CFF.readEncoding=function(r,i,a){e._bin;var l=[".notdef"],s=r[i];if(i++,s!=0)throw"error: unknown encoding format: "+s;var c=r[i];i++;for(var u=0;u>4,C=15&w;if(x!=15&&y.push(x),C!=15&&y.push(C),C==15)break}for(var P="",A=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],S=0;S=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u=1&&u.fmt<=2){f=s.readUshort(r,a),a+=2;var m=s.readUshort(r,a);a+=2,p=e._lctf.numOfOnes(f);var y=e._lctf.numOfOnes(m);if(u.fmt==1){u.pairsets=[];var w=s.readUshort(r,a);a+=2;for(var x=0;x=1&&u.fmt<=2){if(u.fmt==1)u.delta=s.readShort(r,a),a+=2;else if(u.fmt==2){var f=s.readUshort(r,a);a+=2,u.newg=s.readUshorts(r,a,f),a+=2*u.newg.length}}else if(i==4){u.vals=[],f=s.readUshort(r,a),a+=2;for(var p=0;p>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;i=e.kern.readFormat0(r,i,d)}return d},e.kern.parseV1=function(r,i,a,l){var s=e._bin;s.readFixed(r,i),i+=4;var c=s.readUint(r,i);i+=4;for(var u={glyph1:[],rval:[]},d=0;d>>8;if((p&=15)!=0)throw"unknown kern table format: "+p;i=e.kern.readFormat0(r,i,u)}return u},e.kern.readFormat0=function(r,i,a){var l=e._bin,s=-1,c=l.readUshort(r,i);i+=2,l.readUshort(r,i),i+=2,l.readUshort(r,i),i+=2,l.readUshort(r,i),i+=2;for(var u=0;u=s.map.length?0:s.map[i];if(s.format==4){for(var c=-1,u=0;ui?0:65535&(s.idRangeOffset[c]!=0?s.glyphIdArray[i-s.startCount[c]+(s.idRangeOffset[c]>>1)-(s.idRangeOffset.length-c)]:i+s.idDelta[c])}if(s.format==12){if(i>s.groups[s.groups.length-1][1])return 0;for(u=0;u-1?e.U._simpleGlyph(l,a):e.U._compoGlyph(l,i,a))},e.U._simpleGlyph=function(r,i){for(var a=0;as)){for(var w=!0,x=0,C=0;Cs)){for(w=!0,C=0;C>1,c.length=0,d=!0;else if(k=="o3"||k=="o23")c.length%2!=0&&!d&&(f=c.shift()+l.nominalWidthX),u+=c.length>>1,c.length=0,d=!0;else if(k=="o4")c.length>1&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),p&&e.U.P.closePath(s),w+=c.pop(),e.U.P.moveTo(s,y,w),p=!0;else if(k=="o5")for(;c.length>0;)y+=c.shift(),w+=c.shift(),e.U.P.lineTo(s,y,w);else if(k=="o6"||k=="o7")for(var N=c.length,U=k=="o6",W=0;WMath.abs(T-w)?y=b+c.shift():w=T+c.shift(),e.U.P.curveTo(s,x,C,P,A,R,M),e.U.P.curveTo(s,S,v,b,T,y,w));else if(k=="o14"){if(c.length>0&&!d&&(f=c.shift()+a.nominalWidthX,d=!0),c.length==4){var L=c.shift(),j=c.shift(),Y=c.shift(),O=c.shift(),_=e.CFF.glyphBySE(a,Y),G=e.CFF.glyphBySE(a,O);e.U._drawCFF(a.CharStrings[_],i,a,l,s),i.x=L,i.y=j,e.U._drawCFF(a.CharStrings[G],i,a,l,s)}p&&(e.U.P.closePath(s),p=!1)}else if(k=="o19"||k=="o20")c.length%2!=0&&!d&&(f=c.shift()+l.nominalWidthX),u+=c.length>>1,c.length=0,d=!0,m+=u+7>>3;else if(k=="o21")c.length>2&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),w+=c.pop(),y+=c.pop(),p&&e.U.P.closePath(s),e.U.P.moveTo(s,y,w),p=!0;else if(k=="o22")c.length>1&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),y+=c.pop(),p&&e.U.P.closePath(s),e.U.P.moveTo(s,y,w),p=!0;else if(k=="o25"){for(;c.length>6;)y+=c.shift(),w+=c.shift(),e.U.P.lineTo(s,y,w);x=y+c.shift(),C=w+c.shift(),P=x+c.shift(),A=C+c.shift(),y=P+c.shift(),w=A+c.shift(),e.U.P.curveTo(s,x,C,P,A,y,w)}else if(k=="o26")for(c.length%2&&(y+=c.shift());c.length>0;)x=y,C=w+c.shift(),y=P=x+c.shift(),w=(A=C+c.shift())+c.shift(),e.U.P.curveTo(s,x,C,P,A,y,w);else if(k=="o27")for(c.length%2&&(w+=c.shift());c.length>0;)C=w,P=(x=y+c.shift())+c.shift(),A=C+c.shift(),y=P+c.shift(),w=A,e.U.P.curveTo(s,x,C,P,A,y,w);else if(k=="o10"||k=="o29"){var Q=k=="o10"?l:a;if(c.length==0)console.debug("error: empty stack");else{var oe=c.pop(),ee=Q.Subrs[oe+Q.Bias];i.x=y,i.y=w,i.nStems=u,i.haveWidth=d,i.width=f,i.open=p,e.U._drawCFF(ee,i,a,l,s),y=i.x,w=i.y,u=i.nStems,d=i.haveWidth,f=i.width,p=i.open}}else if(k=="o30"||k=="o31"){var $=c.length,ae=(E=0,k=="o31");for(E+=$-(N=-3&$);E>>1|(21845&p)<<1;m=(61680&(m=(52428&m)>>>2|(13107&m)<<2))>>>4|(3855&m)<<4,f[p]=((65280&m)>>>8|(255&m)<<8)>>>1}var y=function(k,N,U){for(var W=k.length,F=0,E=new n(N);F>>Y]=O}return L},w=new e(288);for(p=0;p<144;++p)w[p]=8;for(p=144;p<256;++p)w[p]=9;for(p=256;p<280;++p)w[p]=7;for(p=280;p<288;++p)w[p]=8;var x=new e(32);for(p=0;p<32;++p)x[p]=5;var C=y(w,9),P=y(x,5),A=function(k){for(var N=k[0],U=1;UN&&(N=k[U]);return N},S=function(k,N,U){var W=N/8|0;return(k[W]|k[W+1]<<8)>>(7&N)&U},v=function(k,N){var U=N/8|0;return(k[U]|k[U+1]<<8|k[U+2]<<16)>>(7&N)},b=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],T=function(k,N,U){var W=new Error(N||b[k]);if(W.code=k,Error.captureStackTrace&&Error.captureStackTrace(W,T),!U)throw W;return W},R=function(k,N,U){var W=k.length;if(!W||U&&!U.l&&W<5)return N||new e(0);var F=!N||U,E=!U||U.i;U||(U={}),N||(N=new e(3*W));var L,j=function(qe){var Fe=N.length;if(qe>Fe){var He=new e(Math.max(2*Fe,qe));He.set(N),N=He}},Y=U.f||0,O=U.p||0,_=U.b||0,G=U.l,Q=U.d,oe=U.m,ee=U.n,q=8*W;do{if(!G){U.f=Y=S(k,O,1);var ae=S(k,O+1,3);if(O+=3,!ae){var Z=k[(Ie=((L=O)/8|0)+(7&L&&1)+4)-4]|k[Ie-3]<<8,ne=Ie+Z;if(ne>W){E&&T(0);break}F&&j(_+Z),N.set(k.subarray(Ie,ne),_),U.b=_+=Z,U.p=O=8*ne;continue}if(ae==1)G=C,Q=P,oe=9,ee=5;else if(ae==2){var te=S(k,O,31)+257,$=S(k,O+10,15)+4,le=te+S(k,O+5,31)+1;O+=14;for(var de=new e(le),he=new e(19),me=0;me<$;++me)he[a[me]]=S(k,O+3*me,7);O+=3*$;var ce=A(he),Pe=(1<>>4)<16)de[me++]=Ie;else{var ze=0,Ae=0;for(Ie==16?(Ae=3+S(k,O,3),O+=2,ze=de[me-1]):Ie==17?(Ae=3+S(k,O,7),O+=3):Ie==18&&(Ae=11+S(k,O,127),O+=7);Ae--;)de[me++]=ze}}var se=de.subarray(0,te),ge=de.subarray(te);oe=A(se),ee=A(ge),G=y(se,oe),Q=y(ge,ee)}else T(1);if(O>q){E&&T(0);break}}F&&j(_+131072);for(var we=(1<>>4;if((O+=15&ze)>q){E&&T(0);break}if(ze||T(2),Ce<256)N[_++]=Ce;else{if(Ce==256){Me=O,G=null;break}var Te=Ce-254;if(Ce>264){var Re=r[me=Ce-257];Te=S(k,O,(1<>>4;if(Ne||T(3),O+=15&Ne,ge=d[_e],_e>3&&(Re=i[_e],ge+=v(k,O)&(1<q){E&&T(0);break}F&&j(_+131072);for(var Ue=_+Te;_qe.length)&&(He=qe.length);var Le=new(qe instanceof n?n:qe instanceof o?o:e)(He-Fe);return Le.set(qe.subarray(Fe,He)),Le}(N,0,_)},M=new e(0),D=typeof TextDecoder<"u"&&new TextDecoder;try{D.decode(M,{stream:!0})}catch{}return t.convert_streams=function(k){var N=new DataView(k),U=0;function W(){var te=N.getUint16(U);return U+=2,te}function F(){var te=N.getUint32(U);return U+=4,te}function E(te){Z.setUint16(ne,te),ne+=2}function L(te){Z.setUint32(ne,te),ne+=4}for(var j={signature:F(),flavor:F(),length:F(),numTables:W(),reserved:W(),totalSfntSize:F(),majorVersion:W(),minorVersion:W(),metaOffset:F(),metaLength:F(),metaOrigLength:F(),privOffset:F(),privLength:F()},Y=0;Math.pow(2,Y)<=j.numTables;)Y++;Y--;for(var O=16*Math.pow(2,Y),_=16*j.numTables-O,G=12,Q=[],oe=0;oe{let[M,D]=R.split("+");M=parseInt(M,36),D=D?parseInt(D,36):0,u.set(T+=M,v[b]);for(let k=D;k--;)u.set(++T,v[b])})}}return u.get(S)||c}const f=1,p=2,m=3,y=4,w=[null,"isol","init","fina","medi"];function x(S){const v=new Uint8Array(S.length);let b=c,T=f,R=-1;for(let M=0;M65535&&M++)}return v}function C(S,v){const b=[];for(let R=0;R65535&&R++,b.push(t.U.codeToGlyph(S,M))}const T=S.GSUB;if(T){const{lookupList:R,featureList:M}=T;let D;const k=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,N=[];M.forEach(U=>{if(k.test(U.tag))for(let W=0;W{if(O!==-1){let G=v[O];if(!G){const{cmds:Q,crds:oe}=t.U.glyphToPath(S,O);let ee="",q=0;for(let $=0,le=Q.length;$1?",":"")+oe[q++]}let ae,Z,ne,te;if(oe.length){ae=Z=1/0,ne=te=-1/0;for(let $=0,le=oe.length;$ne&&(ne=de),he>te&&(te=he)}}else ae=ne=Z=te=0;G=v[O]={index:O,advanceWidth:S.hmtx.aWidth[O],xMin:ae,yMin:Z,xMax:ne,yMax:te,path:ee,pathCommandCount:Q.length}}Y!==-1&&(F+=t.U.getPairAdjustment(S,Y,O)*E),W.call(null,G,F,j),G.advanceWidth&&(F+=G.advanceWidth*E),U&&(F+=U*N),Y=O}j+=k.codePointAt(j)>65535?2:1}),F}};return D}return function(v){const b=new Uint8Array(v,0,4),T=t._bin.readASCII(b,0,4);if(T==="wOFF")v=e(v);else if(T==="wOF2")throw new Error("woff2 fonts not supported");return A(t.parse(v)[0])}}const ybt=LN({name:"Typr Font Parser",dependencies:[pbt,gbt,mbt],init(t,e,n){const o=t(),r=e();return n(o,r)}}),QC={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},Abt=new ir;function RP(){return(self.performance||Date).now()}const vbe=Object.create(null);function xVe(t,e){t=vbt({},t);const n=RP();if(t.font=bbt(t.font||QC.defaultFontURL),t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||QC.sdfGlyphSize,t.colorRanges!=null){let d={};for(let f in t.colorRanges)if(t.colorRanges.hasOwnProperty(f)){let p=t.colorRanges[f];typeof p!="number"&&(p=Abt.set(p).getHex()),d[f]=p}t.colorRanges=d}Object.freeze(t);const{textureWidth:o,sdfExponent:r}=QC,{sdfGlyphSize:i}=t,a=o/i*4;let l=vbe[i];if(!l){const d=document.createElement("canvas");d.width=o,d.height=i*256/a,l=vbe[i]={glyphCount:0,sdfGlyphSize:i,sdfCanvas:d,sdfTexture:new ic(d,void 0,void 0,void 0,cs,cs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,wbt(l)}const{sdfTexture:s,sdfCanvas:c}=l;let u=l.glyphsByFont.get(t.font);u||l.glyphsByFont.set(t.font,u=new Map),Tbt(t).then(d=>{const{glyphIds:f,glyphPositions:p,fontSize:m,unitsPerEm:y,timings:w}=d,x=[],C=new Float32Array(f.length*4),P=m/y;let A=0,S=0;const v=RP();f.forEach((D,k)=>{let N=u.get(D);if(!N){const{path:E,pathBounds:L}=d.glyphData[D],j=Math.max(L[2]-L[0],L[3]-L[1])/i*(QC.sdfMargin*i+.5),Y=l.glyphCount++,O=[L[0]-j,L[1]-j,L[2]+j,L[3]+j];u.set(D,N={path:E,atlasIndex:Y,sdfViewBox:O}),x.push(N)}const{sdfViewBox:U}=N,W=p[S++],F=p[S++];C[A++]=W+U[0]*P,C[A++]=F+U[1]*P,C[A++]=W+U[2]*P,C[A++]=F+U[3]*P,f[k]=N.atlasIndex}),w.quads=(w.quads||0)+(RP()-v);const b=RP();w.sdf={};const T=c.height,R=Math.ceil(l.glyphCount/a),M=Math.pow(2,Math.ceil(Math.log2(R*i)));M>T&&(console.info(`Increasing SDF texture size ${T}->${M}`),hbt(c,o,M),s.dispose()),Promise.all(x.map(D=>vVe(D,l,t.gpuAccelerateSDF).then(({timing:k})=>{w.sdf[D.atlasIndex]=k}))).then(()=>{x.length&&!l.contextLost&&(bVe(l),s.needsUpdate=!0),w.sdfTotal=RP()-b,w.total=RP()-n,e(Object.freeze({parameters:t,sdfTexture:s,sdfGlyphSize:i,sdfExponent:r,glyphBounds:C,glyphAtlasIndices:f,glyphColors:d.glyphColors,caretPositions:d.caretPositions,caretHeight:d.caretHeight,chunkedBounds:d.chunkedBounds,ascender:d.ascender,descender:d.descender,lineHeight:d.lineHeight,capHeight:d.capHeight,xHeight:d.xHeight,topBaseline:d.topBaseline,blockBounds:d.blockBounds,visibleBounds:d.visibleBounds,timings:d.timings}))})}),Promise.resolve().then(()=>{l.contextLost||fbt(c)})}function vVe({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:o,sdfCanvas:r,contextLost:i},a){if(i)return Promise.resolve({timing:-1});const{textureWidth:l,sdfExponent:s}=QC,c=Math.max(n[2]-n[0],n[3]-n[1]),u=Math.floor(e/4),d=u%(l/o)*o,f=Math.floor(u/(l/o))*o,p=e%4;return abt(o,o,t,n,c,s,r,d,f,p,a)}function wbt(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",n=>{console.log("Context Lost",n),n.preventDefault(),t.contextLost=!0}),e.addEventListener("webglcontextrestored",n=>{console.log("Context Restored",n),t.contextLost=!1;const o=[];t.glyphsByFont.forEach(r=>{r.forEach(i=>{o.push(vVe(i,t,!0))})}),Promise.all(o).then(()=>{bVe(t),t.sdfTexture.needsUpdate=!0})})}function xbt({font:t,characters:e,sdfGlyphSize:n},o){let r=Array.isArray(e)?e.join(` +*/function gbt(){return function(t){var e=Uint8Array,n=Uint16Array,o=Uint32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(k,N){for(var U=new n(31),W=0;W<31;++W)U[W]=N+=1<>>1|(21845&p)<<1;m=(61680&(m=(52428&m)>>>2|(13107&m)<<2))>>>4|(3855&m)<<4,f[p]=((65280&m)>>>8|(255&m)<<8)>>>1}var y=function(k,N,U){for(var W=k.length,F=0,E=new n(N);F>>Y]=O}return L},w=new e(288);for(p=0;p<144;++p)w[p]=8;for(p=144;p<256;++p)w[p]=9;for(p=256;p<280;++p)w[p]=7;for(p=280;p<288;++p)w[p]=8;var x=new e(32);for(p=0;p<32;++p)x[p]=5;var C=y(w,9),P=y(x,5),A=function(k){for(var N=k[0],U=1;UN&&(N=k[U]);return N},S=function(k,N,U){var W=N/8|0;return(k[W]|k[W+1]<<8)>>(7&N)&U},v=function(k,N){var U=N/8|0;return(k[U]|k[U+1]<<8|k[U+2]<<16)>>(7&N)},b=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],T=function(k,N,U){var W=new Error(N||b[k]);if(W.code=k,Error.captureStackTrace&&Error.captureStackTrace(W,T),!U)throw W;return W},R=function(k,N,U){var W=k.length;if(!W||U&&!U.l&&W<5)return N||new e(0);var F=!N||U,E=!U||U.i;U||(U={}),N||(N=new e(3*W));var L,j=function(qe){var Fe=N.length;if(qe>Fe){var He=new e(Math.max(2*Fe,qe));He.set(N),N=He}},Y=U.f||0,O=U.p||0,_=U.b||0,G=U.l,Q=U.d,oe=U.m,ee=U.n,$=8*W;do{if(!G){U.f=Y=S(k,O,1);var ae=S(k,O+1,3);if(O+=3,!ae){var Z=k[(Ie=((L=O)/8|0)+(7&L&&1)+4)-4]|k[Ie-3]<<8,ne=Ie+Z;if(ne>W){E&&T(0);break}F&&j(_+Z),N.set(k.subarray(Ie,ne),_),U.b=_+=Z,U.p=O=8*ne;continue}if(ae==1)G=C,Q=P,oe=9,ee=5;else if(ae==2){var te=S(k,O,31)+257,q=S(k,O+10,15)+4,le=te+S(k,O+5,31)+1;O+=14;for(var de=new e(le),he=new e(19),me=0;me>>4)<16)de[me++]=Ie;else{var ze=0,Ae=0;for(Ie==16?(Ae=3+S(k,O,3),O+=2,ze=de[me-1]):Ie==17?(Ae=3+S(k,O,7),O+=3):Ie==18&&(Ae=11+S(k,O,127),O+=7);Ae--;)de[me++]=ze}}var se=de.subarray(0,te),ge=de.subarray(te);oe=A(se),ee=A(ge),G=y(se,oe),Q=y(ge,ee)}else T(1);if(O>$){E&&T(0);break}}F&&j(_+131072);for(var we=(1<>>4;if((O+=15&ze)>$){E&&T(0);break}if(ze||T(2),Ce<256)N[_++]=Ce;else{if(Ce==256){Me=O,G=null;break}var Te=Ce-254;if(Ce>264){var Re=r[me=Ce-257];Te=S(k,O,(1<>>4;if(Ne||T(3),O+=15&Ne,ge=d[_e],_e>3&&(Re=i[_e],ge+=v(k,O)&(1<$){E&&T(0);break}F&&j(_+131072);for(var Ue=_+Te;_qe.length)&&(He=qe.length);var Le=new(qe instanceof n?n:qe instanceof o?o:e)(He-Fe);return Le.set(qe.subarray(Fe,He)),Le}(N,0,_)},M=new e(0),D=typeof TextDecoder<"u"&&new TextDecoder;try{D.decode(M,{stream:!0})}catch{}return t.convert_streams=function(k){var N=new DataView(k),U=0;function W(){var te=N.getUint16(U);return U+=2,te}function F(){var te=N.getUint32(U);return U+=4,te}function E(te){Z.setUint16(ne,te),ne+=2}function L(te){Z.setUint32(ne,te),ne+=4}for(var j={signature:F(),flavor:F(),length:F(),numTables:W(),reserved:W(),totalSfntSize:F(),majorVersion:W(),minorVersion:W(),metaOffset:F(),metaLength:F(),metaOrigLength:F(),privOffset:F(),privLength:F()},Y=0;Math.pow(2,Y)<=j.numTables;)Y++;Y--;for(var O=16*Math.pow(2,Y),_=16*j.numTables-O,G=12,Q=[],oe=0;oe{let[M,D]=R.split("+");M=parseInt(M,36),D=D?parseInt(D,36):0,u.set(T+=M,v[b]);for(let k=D;k--;)u.set(++T,v[b])})}}return u.get(S)||c}const f=1,p=2,m=3,y=4,w=[null,"isol","init","fina","medi"];function x(S){const v=new Uint8Array(S.length);let b=c,T=f,R=-1;for(let M=0;M65535&&M++)}return v}function C(S,v){const b=[];for(let R=0;R65535&&R++,b.push(t.U.codeToGlyph(S,M))}const T=S.GSUB;if(T){const{lookupList:R,featureList:M}=T;let D;const k=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,N=[];M.forEach(U=>{if(k.test(U.tag))for(let W=0;W{if(O!==-1){let G=v[O];if(!G){const{cmds:Q,crds:oe}=t.U.glyphToPath(S,O);let ee="",$=0;for(let q=0,le=Q.length;q1?",":"")+oe[$++]}let ae,Z,ne,te;if(oe.length){ae=Z=1/0,ne=te=-1/0;for(let q=0,le=oe.length;qne&&(ne=de),he>te&&(te=he)}}else ae=ne=Z=te=0;G=v[O]={index:O,advanceWidth:S.hmtx.aWidth[O],xMin:ae,yMin:Z,xMax:ne,yMax:te,path:ee,pathCommandCount:Q.length}}Y!==-1&&(F+=t.U.getPairAdjustment(S,Y,O)*E),W.call(null,G,F,j),G.advanceWidth&&(F+=G.advanceWidth*E),U&&(F+=U*N),Y=O}j+=k.codePointAt(j)>65535?2:1}),F}};return D}return function(v){const b=new Uint8Array(v,0,4),T=t._bin.readASCII(b,0,4);if(T==="wOFF")v=e(v);else if(T==="wOF2")throw new Error("woff2 fonts not supported");return A(t.parse(v)[0])}}const ybt=LN({name:"Typr Font Parser",dependencies:[pbt,gbt,mbt],init(t,e,n){const o=t(),r=e();return n(o,r)}}),QC={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},Abt=new ir;function RP(){return(self.performance||Date).now()}const vbe=Object.create(null);function xVe(t,e){t=vbt({},t);const n=RP();if(t.font=bbt(t.font||QC.defaultFontURL),t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||QC.sdfGlyphSize,t.colorRanges!=null){let d={};for(let f in t.colorRanges)if(t.colorRanges.hasOwnProperty(f)){let p=t.colorRanges[f];typeof p!="number"&&(p=Abt.set(p).getHex()),d[f]=p}t.colorRanges=d}Object.freeze(t);const{textureWidth:o,sdfExponent:r}=QC,{sdfGlyphSize:i}=t,a=o/i*4;let l=vbe[i];if(!l){const d=document.createElement("canvas");d.width=o,d.height=i*256/a,l=vbe[i]={glyphCount:0,sdfGlyphSize:i,sdfCanvas:d,sdfTexture:new ic(d,void 0,void 0,void 0,cs,cs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,wbt(l)}const{sdfTexture:s,sdfCanvas:c}=l;let u=l.glyphsByFont.get(t.font);u||l.glyphsByFont.set(t.font,u=new Map),Tbt(t).then(d=>{const{glyphIds:f,glyphPositions:p,fontSize:m,unitsPerEm:y,timings:w}=d,x=[],C=new Float32Array(f.length*4),P=m/y;let A=0,S=0;const v=RP();f.forEach((D,k)=>{let N=u.get(D);if(!N){const{path:E,pathBounds:L}=d.glyphData[D],j=Math.max(L[2]-L[0],L[3]-L[1])/i*(QC.sdfMargin*i+.5),Y=l.glyphCount++,O=[L[0]-j,L[1]-j,L[2]+j,L[3]+j];u.set(D,N={path:E,atlasIndex:Y,sdfViewBox:O}),x.push(N)}const{sdfViewBox:U}=N,W=p[S++],F=p[S++];C[A++]=W+U[0]*P,C[A++]=F+U[1]*P,C[A++]=W+U[2]*P,C[A++]=F+U[3]*P,f[k]=N.atlasIndex}),w.quads=(w.quads||0)+(RP()-v);const b=RP();w.sdf={};const T=c.height,R=Math.ceil(l.glyphCount/a),M=Math.pow(2,Math.ceil(Math.log2(R*i)));M>T&&(console.info(`Increasing SDF texture size ${T}->${M}`),hbt(c,o,M),s.dispose()),Promise.all(x.map(D=>vVe(D,l,t.gpuAccelerateSDF).then(({timing:k})=>{w.sdf[D.atlasIndex]=k}))).then(()=>{x.length&&!l.contextLost&&(bVe(l),s.needsUpdate=!0),w.sdfTotal=RP()-b,w.total=RP()-n,e(Object.freeze({parameters:t,sdfTexture:s,sdfGlyphSize:i,sdfExponent:r,glyphBounds:C,glyphAtlasIndices:f,glyphColors:d.glyphColors,caretPositions:d.caretPositions,caretHeight:d.caretHeight,chunkedBounds:d.chunkedBounds,ascender:d.ascender,descender:d.descender,lineHeight:d.lineHeight,capHeight:d.capHeight,xHeight:d.xHeight,topBaseline:d.topBaseline,blockBounds:d.blockBounds,visibleBounds:d.visibleBounds,timings:d.timings}))})}),Promise.resolve().then(()=>{l.contextLost||fbt(c)})}function vVe({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:o,sdfCanvas:r,contextLost:i},a){if(i)return Promise.resolve({timing:-1});const{textureWidth:l,sdfExponent:s}=QC,c=Math.max(n[2]-n[0],n[3]-n[1]),u=Math.floor(e/4),d=u%(l/o)*o,f=Math.floor(u/(l/o))*o,p=e%4;return abt(o,o,t,n,c,s,r,d,f,p,a)}function wbt(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",n=>{console.log("Context Lost",n),n.preventDefault(),t.contextLost=!0}),e.addEventListener("webglcontextrestored",n=>{console.log("Context Restored",n),t.contextLost=!1;const o=[];t.glyphsByFont.forEach(r=>{r.forEach(i=>{o.push(vVe(i,t,!0))})}),Promise.all(o).then(()=>{bVe(t),t.sdfTexture.needsUpdate=!0})})}function xbt({font:t,characters:e,sdfGlyphSize:n},o){let r=Array.isArray(e)?e.join(` `):""+e;xVe({font:t,sdfGlyphSize:n,text:r},o)}function vbt(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let RO;function bbt(t){return RO||(RO=typeof document>"u"?{}:document.createElement("a")),RO.href=t,RO.href}function bVe(t){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:n}=t,{width:o,height:r}=e,i=t.sdfCanvas.getContext("webgl");let a=n.image.data;(!a||a.length!==o*r*4)&&(a=new Uint8Array(o*r*4),n.image={width:o,height:r,data:a},n.flipY=!1,n.isDataTexture=!0),i.readPixels(0,0,o,r,i.RGBA,i.UNSIGNED_BYTE,a)}}const Sbt=LN({name:"Typesetter",dependencies:[QC,ybt,ibt,qvt],init(t,e,n,o){const{defaultFontURL:r}=t;return n(e,o(),{defaultFontURL:r})}}),Tbt=LN({name:"Typesetter",dependencies:[Sbt],init(t){return function(e){return new Promise(n=>{t.typeset(e,n)})}},getTransferables(t){const e=[t.glyphPositions.buffer,t.glyphIds.buffer];return t.caretPositions&&e.push(t.caretPositions.buffer),t.glyphColors&&e.push(t.glyphColors.buffer),e}}),bbe={};function Pbt(t){let e=bbe[t];if(!e){const n=new T7(1,1,t,t),o=n.clone(),r=n.attributes,i=o.attributes,a=new Ni,l=r.uv.count;for(let s=0;s{a.setAttribute(s,new Ar([...r[s].array,...i[s].array],r[s].itemSize))}),a.setIndex([...n.index.array,...o.index.array.map(s=>s+l)]),a.translate(.5,.5,0),e=bbe[t]=a}return e}const Cbt="aTroikaGlyphBounds",Sbe="aTroikaGlyphIndex",Rbt="aTroikaGlyphColor";class Hbt extends eQ{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Y1,this.boundingBox=new Cf}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const n=this.getIndex().count;this.setDrawRange(e===js?n/2:0,e===zr?n:n/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=Pbt(e);["position","normal","uv"].forEach(o=>{this.attributes[o]=n.attributes[o].clone()}),this.setIndex(n.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,n,o,r,i){Qae(this,Cbt,e,4),Qae(this,Sbe,n,1),Qae(this,Rbt,i,3),this._blockBounds=o,this._chunkedBounds=r,this.instanceCount=n.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:n,boundingBox:o}=this;if(n){const{PI:r,floor:i,min:a,max:l,sin:s,cos:c}=Math,u=r/2,d=r*2,f=Math.abs(n),p=e[0]/f,m=e[2]/f,y=i((p+u)/d)!==i((m+u)/d)?-f:a(s(p)*f,s(m)*f),w=i((p-u)/d)!==i((m-u)/d)?f:l(s(p)*f,s(m)*f),x=i((p+r)/d)!==i((m+r)/d)?f*2:l(f-c(p)*f,f-c(m)*f);o.min.set(y,e[1],n<0?-x:0),o.max.set(w,e[3],n<0?0:x)}else o.min.set(e[0],e[1],0),o.max.set(e[2],e[3],0);o.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let n=this.getAttribute(Sbe).count,o=this._chunkedBounds;if(o)for(let r=o.length;r--;){n=o[r].end;let i=o[r].rect;if(i[1]e.y&&i[0]e.x)break}this.instanceCount=n}}function Qae(t,e,n,o){const r=t.getAttribute(e);n?r&&r.array.length===n.length?(r.array.set(n),r.needsUpdate=!0):(t.setAttribute(e,new jb(n,o)),delete t._maxInstanceCount,t.dispose()):r&&t.deleteAttribute(e)}const Mbt=` uniform vec2 uTroikaSDFTextureSize; uniform float uTroikaSDFGlyphSize; @@ -4306,7 +4306,7 @@ if (edgeAlpha == 0.0) { `;function Ebt(t){const e=Nde(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new _t},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Ba(0,0,0,0)},uTroikaClipRect:{value:new Ba(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new _t},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new ir},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new ma},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:Mbt,vertexTransform:Ibt,fragmentDefs:zbt,fragmentColorTransform:Dbt,customRewriter({vertexShader:n,fragmentShader:o}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(o)&&(o=o.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(n)||(n=n.replace(AVe,`uniform vec3 diffuse; $& vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; -`))),{vertexShader:n,fragmentShader:o}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const Y2e=new _3({color:16777215,side:zr,transparent:!0}),Tbe=8421504,Pbe=new qi,HO=new ue,Zae=new ue,_D=[],kbt=new ue,ele="+x+y";function Cbe(t){return Array.isArray(t)?t[0]:t}let SVe=()=>{const t=new os(new T7(1,1),Y2e);return SVe=()=>t,t},TVe=()=>{const t=new os(new T7(1,1,32,1),Y2e);return TVe=()=>t,t};const Fbt={type:"syncstart"},Lbt={type:"synccomplete"},PVe=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Wbt=PVe.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let CVe=class extends os{constructor(){const e=new Hbt;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Tbe,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=ele,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(Fbt),xVe({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},n=>{this._isSyncing=!1,this._textRenderInfo=n,this.geometry.updateGlyphs(n.glyphBounds,n.glyphAtlasIndices,n.blockBounds,n.chunkedBounds,n.glyphColors);const o=this._queuedSyncs;o&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{o.forEach(r=>r&&r())})),this.dispatchEvent(Lbt),e&&e()})))}onBeforeRender(e,n,o,r,i,a){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i),i._hadOwnSide=i.hasOwnProperty("side"),this.geometry.setSide(i._actualSide=i.side),i.side=$i}onAfterRender(e,n,o,r,i,a){i._hadOwnSide?i.side=i._actualSide:delete i.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Y2e.clone());if((!e||e.baseMaterial!==n)&&(e=this._derivedMaterial=Ebt(n),n.addEventListener("dispose",function o(){n.removeEventListener("dispose",o),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let o=e._outlineMtl;return o||(o=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),o.isTextOutlineMaterial=!0,o.depthWrite=!1,o.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),o.dispose()})),[o,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return Cbe(this.material).getDepthMaterial()}get customDistanceMaterial(){return Cbe(this.material).getDistanceMaterial()}_prepareForRender(e){const n=e.isTextOutlineMaterial,o=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:l,blockBounds:s}=r;o.uTroikaSDFTexture.value=l,o.uTroikaSDFTextureSize.value.set(l.image.width,l.image.height),o.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,o.uTroikaSDFExponent.value=r.sdfExponent,o.uTroikaTotalBounds.value.fromArray(s),o.uTroikaUseGlyphColors.value=!n&&!!r.glyphColors;let c=0,u=0,d=0,f,p,m,y=0,w=0;if(n){let{outlineWidth:C,outlineOffsetX:P,outlineOffsetY:A,outlineBlur:S,outlineOpacity:v}=this;c=this._parsePercent(C)||0,u=Math.max(0,this._parsePercent(S)||0),f=v,y=this._parsePercent(P)||0,w=this._parsePercent(A)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(m=this.strokeColor,o.uTroikaStrokeColor.value.set(m??Tbe),p=this.strokeOpacity,p==null&&(p=1)),f=this.fillOpacity;o.uTroikaDistanceOffset.value=c,o.uTroikaPositionOffset.value.set(y,w),o.uTroikaBlurRadius.value=u,o.uTroikaStrokeWidth.value=d,o.uTroikaStrokeOpacity.value=p,o.uTroikaFillOpacity.value=f??1,o.uTroikaCurveRadius.value=this.curveRadius||0;let x=this.clipRect;if(x&&Array.isArray(x)&&x.length===4)o.uTroikaClipRect.value.fromArray(x);else{const C=(this.fontSize||.1)*100;o.uTroikaClipRect.value.set(s[0]-C,s[1]-C,s[2]+C,s[3]+C)}this.geometry.applyClipRect(o.uTroikaClipRect.value)}o.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const i=n?this.outlineColor||0:this.color;if(i==null)delete e.color;else{const l=e.hasOwnProperty("color")?e.color:e.color=new ir;(i!==l._input||typeof i=="object")&&l.set(l._input=i)}let a=this.orientation||ele;if(a!==e._orientation){let l=o.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let s=a!==ele&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(s){let[,c,u,d,f]=s;HO.set(0,0,0)[u]=c==="-"?1:-1,Zae.set(0,0,0)[f]=d==="-"?-1:1,Pbe.lookAt(kbt,HO.cross(Zae),Zae),l.setFromMatrix4(Pbe)}else l.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let n=e.match(/^(-?[\d.]+)%$/),o=n?parseFloat(n[1]):NaN;e=(isNaN(o)?0:o/100)*this.fontSize}return e}localPositionToTextCoords(e,n=new _t){n.copy(e);const o=this.curveRadius;return o&&(n.x=Math.atan2(e.x,Math.abs(o)-Math.abs(e.z))*Math.abs(o)),n}worldPositionToTextCoords(e,n=new _t){return HO.copy(e),this.localPositionToTextCoords(this.worldToLocal(HO),n)}raycast(e,n){const{textRenderInfo:o,curveRadius:r}=this;if(o){const i=o.blockBounds,a=r?TVe():SVe(),l=a.geometry,{position:s,uv:c}=l.attributes;for(let u=0;u{this[o]=e[o]}),this}clone(){return new this.constructor().copy(this)}};PVe.forEach(t=>{const e="_private_"+t;Object.defineProperty(CVe.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});const Nbt=g.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:o,fontSize:r=1,children:i,characters:a,onSync:l,...s},c)=>{const u=ti(({invalidate:m})=>m),[d]=g.useState(()=>new CVe),[f,p]=g.useMemo(()=>{const m=[];let y="";return g.Children.forEach(i,w=>{typeof w=="string"||typeof w=="number"?y+=w:m.push(w)}),[m,y]},[i]);return j_e(()=>new Promise(m=>xbt({font:o,characters:a},m)),["troika-text",o,a]),g.useLayoutEffect(()=>void d.sync(()=>{u(),l&&l(d)})),g.useEffect(()=>()=>d.dispose(),[d]),g.createElement("primitive",H3({object:d,ref:c,font:o,text:p,anchorX:e,anchorY:n,fontSize:r,sdfGlyphSize:t},s),f)}),Rbe=t=>t===Object(t)&&!Array.isArray(t)&&typeof t!="function";function Up(t,e){const n=ti(r=>r.gl),o=B5(Qg,Rbe(t)?Object.values(t):t);if(g.useLayoutEffect(()=>{e==null||e(o)},[e]),g.useEffect(()=>{"initTexture"in n&&(Array.isArray(o)?o:[o]).forEach(n.initTexture)},[n,o]),Rbe(t)){const r=Object.keys(t),i={};return r.forEach(a=>Object.assign(i,{[a]:o[r.indexOf(a)]})),i}else return o}Up.preload=t=>B5.preload(Qg,t);Up.clear=t=>B5.clear(Qg,t);function RVe(t,e,n){const o=ti(f=>f.size),r=ti(f=>f.viewport),i=typeof t=="number"?t:o.width*r.dpr,a=o.height*r.dpr,l=(typeof t=="number"?n:t)||{},{samples:s=0,depth:c,...u}=l,d=g.useMemo(()=>{const f=new ku(i,a,{minFilter:cs,magFilter:cs,type:G8,...u});return c&&(f.depthTexture=new Eq(i,a,vy)),f.samples=s,f},[]);return g.useLayoutEffect(()=>{d.setSize(i,a),s&&(d.samples=s)},[s,d,i,a]),g.useEffect(()=>()=>d.dispose(),[]),d}const Ubt=t=>typeof t=="function",jbt=g.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,children:o,makeDefault:r,...i},a)=>{const l=ti(({set:w})=>w),s=ti(({camera:w})=>w),c=ti(({size:w})=>w),u=g.useRef(null),d=g.useRef(null),f=RVe(e);g.useLayoutEffect(()=>{i.manual||u.current.updateProjectionMatrix()},[c,i]),g.useLayoutEffect(()=>{u.current.updateProjectionMatrix()}),g.useLayoutEffect(()=>{if(r){const w=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:w}))}},[u,r,l]);let p=0,m=null;const y=Ubt(o);return Gp(w=>{y&&(n===1/0||ptypeof t=="function",Ybt=g.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,makeDefault:o,children:r,...i},a)=>{const l=ti(({set:w})=>w),s=ti(({camera:w})=>w),c=ti(({size:w})=>w),u=g.useRef(null),d=g.useRef(null),f=RVe(e);g.useLayoutEffect(()=>{i.manual||(u.current.aspect=c.width/c.height)},[c,i]),g.useLayoutEffect(()=>{u.current.updateProjectionMatrix()});let p=0,m=null;const y=Bbt(r);return Gp(w=>{y&&(n===1/0||p{if(o){const w=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:w}))}},[u,o,l]),g.createElement(g.Fragment,null,g.createElement("perspectiveCamera",H3({ref:U2e([u,a])},i),!y&&r),g.createElement("group",{ref:d},y&&r(f.texture)))});function f4(t,e){const n=t+"Geometry";return g.forwardRef(({args:o,children:r,...i},a)=>{const l=g.useRef(null);return g.useImperativeHandle(a,()=>l.current),g.useLayoutEffect(()=>void(e==null?void 0:e(l.current))),g.createElement("mesh",H3({ref:l},i),g.createElement(n,{attach:"geometry",args:o}),r)})}const di=f4("box"),fH=f4("circle"),Rf=f4("cone"),wa=f4("cylinder"),Ys=f4("sphere"),yi=f4("plane"),O2e=f4("torus"),FX=f4("ring"),Q8=f4("extrude"),E9=1e-5;function Obt(t,e,n){const o=new jl,r=n-E9;return o.absarc(E9,E9,E9,-Math.PI/2,-Math.PI,!0),o.absarc(E9,e-r*2,E9,Math.PI,Math.PI/2,!0),o.absarc(t-r*2,e-r*2,E9,Math.PI/2,0,!0),o.absarc(t-r*2,E9,E9,0,-Math.PI/2,!0),o}const _bt=g.forwardRef(function({args:[e=1,n=1,o=1]=[],radius:r=.05,steps:i=1,smoothness:a=4,bevelSegments:l=4,creaseAngle:s=.4,children:c,...u},d){const f=g.useMemo(()=>Obt(e,n,r),[e,n,r]),p=g.useMemo(()=>({depth:o-r*2,bevelEnabled:!0,bevelSegments:l*2,steps:i,bevelSize:r-E9,bevelThickness:r,curveSegments:a}),[o,r,a]),m=g.useRef(null);return g.useLayoutEffect(()=>{m.current&&(m.current.center(),Bvt(m.current,s))},[f,p]),g.createElement("mesh",H3({ref:d},u),g.createElement("extrudeGeometry",{ref:m,args:[f,p]}),c)});var HVe={exports:{}},Vbt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Gbt=Vbt,Xbt=Gbt;function MVe(){}function IVe(){}IVe.resetWarningCache=MVe;var Jbt=function(){function t(o,r,i,a,l,s){if(s!==Xbt){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:IVe,resetWarningCache:MVe};return n.PropTypes=n,n};HVe.exports=Jbt();var rQ=HVe.exports;const Ao=ji(rQ),jn=pq()((t,e)=>({setEnableOrbitController:n=>{H.getState().viewState.navigationView||t(o=>{var r;return(r=o.orbitControlsRef)!=null&&r.current&&(o.orbitControlsRef.current.enabled=n),o})},selectNone:()=>{t({humanRef:null,treeRef:null,foundationRef:null})},contentRef:null,compassRef:null,orbitControlsRef:null,humanRef:null,treeRef:null,flowerRef:null,foundationRef:null,cuboidRef:null,listenToAutoDeletionByCutRef:null,listenToAutoDeletionByDeleteRef:null,setListenToAutoDeletionByCut:n=>{const o=e().listenToAutoDeletionByCutRef;o&&(o.current=n)},setListenToAutoDeletionByDelete:n=>{const o=e().listenToAutoDeletionByDeleteRef;o&&(o.current=n)},canvas:null,pointer:new _t,solarPanelCountRef:null}));var Ti=(t=>(t.Default="Default",t.Arched="Arched",t.Circular="Circular",t.Polygonal="Polygonal",t))(Ti||{});const zVe="/aladdin/assets/jaah-XpG2K-Xo.png",DVe="/aladdin/assets/jack-DVed1dhl.png",EVe="/aladdin/assets/jacob-D-6uVZRV.png",kVe="/aladdin/assets/jacqueline-DZtJs4FX.png",FVe="/aladdin/assets/jade-Cxa-afE4.png",LVe="/aladdin/assets/jamelia-Bmq4EsGl.png",WVe="/aladdin/assets/james-QtBSrtsa.png",NVe="/aladdin/assets/jane-ZqCTWK8F.png",UVe="/aladdin/assets/jaya-DD0RNxX8.png",jVe="/aladdin/assets/jaye-DPA2kSta.png",BVe="/aladdin/assets/jeanette-D3EEzZKV.png",YVe="/aladdin/assets/jedi-CUm23-QH.png",OVe="/aladdin/assets/jeff-931UF5LC.png",_Ve="/aladdin/assets/jena-qnIKFCdf.png",VVe="/aladdin/assets/jennifer-Cvadr5-Q.png",GVe="/aladdin/assets/jess-DyGUx_b1.png",XVe="/aladdin/assets/jett-B01M7z86.png",JVe="/aladdin/assets/jill-CxIC2A4v.png",KVe="/aladdin/assets/jiya-CF0SpO2m.png",$Ve="/aladdin/assets/joan-DWpjHIrM.png",qVe="/aladdin/assets/jocelyn-DGLHmbKA.png",QVe="/aladdin/assets/joel-DhW3d8dZ.png",ZVe="/aladdin/assets/joey-Dmd3kcA2.png",eGe="/aladdin/assets/john-QF2zQU-p.png",tGe="/aladdin/assets/jonathon-TM1sY2jf.png",nGe="/aladdin/assets/jose-CtYKGQoQ.png",oGe="/aladdin/assets/joseph-C7wga7kl.png",rGe="/aladdin/assets/joshua-CqTzsm-K.png",iGe="/aladdin/assets/judd-C8GabaWl.png",aGe="/aladdin/assets/judy-Cv4UEjOl.png",lGe="/aladdin/assets/julia-Ckjw2r2H.png",sGe="/aladdin/assets/julio-CPCcOGMU.png",cGe="/aladdin/assets/jumapili-TjSAWyhv.png",uGe="/aladdin/assets/june-Bkxc2WDe.png",dGe="/aladdin/assets/juro-BAi3R6Hw.png",fGe="/aladdin/assets/justin-DLG1o6Q7.png";class hh{static fetchGender(e){switch(e){case Vt.Jaah:return Fa.Male;case Vt.Jacqueline:return Fa.Female;case Vt.Jade:return Fa.Female;case Vt.Jamelia:return Fa.Female;case Vt.James:return Fa.Male;case Vt.Jane:return Fa.Female;case Vt.Jaya:return Fa.Female;case Vt.Jaye:return Fa.Male;case Vt.Jeanette:return Fa.Female;case Vt.Jedi:return Fa.Male;case Vt.Jeff:return Fa.Male;case Vt.Jena:return Fa.Female;case Vt.Jennifer:return Fa.Female;case Vt.Jess:return Fa.Female;case Vt.Jett:return Fa.Male;case Vt.Jill:return Fa.Female;case Vt.Jiya:return Fa.Female;case Vt.Joan:return Fa.Female;case Vt.Jocelyn:return Fa.Female;case Vt.Joel:return Fa.Male;case Vt.Joey:return Fa.Female;case Vt.John:return Fa.Male;case Vt.Jonathon:return Fa.Male;case Vt.Jose:return Fa.Male;case Vt.Joseph:return Fa.Male;case Vt.Joshua:return Fa.Male;case Vt.Judd:return Fa.Male;case Vt.Judy:return Fa.Female;case Vt.Julia:return Fa.Female;case Vt.Julio:return Fa.Male;case Vt.Jumapili:return Fa.Female;case Vt.June:return Fa.Female;case Vt.Juro:return Fa.Male;case Vt.Justin:return Fa.Male;default:return Fa.Male}}static fetchLabel(e,n){switch(e){case Vt.Jaah:return B.t("people.Jaah",n);case Vt.Jacob:return B.t("people.Jacob",n);case Vt.Jacqueline:return B.t("people.Jacqueline",n);case Vt.Jade:return B.t("people.Jade",n);case Vt.Jamelia:return B.t("people.Jamelia",n);case Vt.James:return B.t("people.James",n);case Vt.Jane:return B.t("people.Jane",n);case Vt.Jaya:return B.t("people.Jaya",n);case Vt.Jaye:return B.t("people.Jaye",n);case Vt.Jeanette:return B.t("people.Jeanette",n);case Vt.Jedi:return B.t("people.Jedi",n);case Vt.Jeff:return B.t("people.Jeff",n);case Vt.Jena:return B.t("people.Jena",n);case Vt.Jennifer:return B.t("people.Jennifer",n);case Vt.Jess:return B.t("people.Jess",n);case Vt.Jett:return B.t("people.Jett",n);case Vt.Jill:return B.t("people.Jill",n);case Vt.Jiya:return B.t("people.Jiya",n);case Vt.Joan:return B.t("people.Joan",n);case Vt.Jocelyn:return B.t("people.Jocelyn",n);case Vt.Joel:return B.t("people.Joel",n);case Vt.Joey:return B.t("people.Joey",n);case Vt.John:return B.t("people.John",n);case Vt.Jonathon:return B.t("people.Jonathon",n);case Vt.Jose:return B.t("people.Jose",n);case Vt.Joseph:return B.t("people.Joseph",n);case Vt.Joshua:return B.t("people.Joshua",n);case Vt.Judd:return B.t("people.Judd",n);case Vt.Judy:return B.t("people.Judy",n);case Vt.Julia:return B.t("people.Julia",n);case Vt.Julio:return B.t("people.Julio",n);case Vt.Jumapili:return B.t("people.Jumapili",n);case Vt.June:return B.t("people.June",n);case Vt.Juro:return B.t("people.Juro",n);case Vt.Justin:return B.t("people.Justin",n);default:return B.t("people.Jack",n)}}static fetchHatOffsetY(e){switch(e){case Vt.Jonathon:return-.22}return 0}static fetchHatOffsetX(e){switch(e){case Vt.Jaah:return-.05;case Vt.Jack:return-.05;case Vt.Jacob:return .09;case Vt.Jade:return-.04;case Vt.Jaya:return .04;case Vt.Jaye:return 0;case Vt.Jamelia:return .05;case Vt.Jane:return .02;case Vt.Jeanette:return .08;case Vt.Jedi:return-.02;case Vt.Jeff:return-.05;case Vt.Jena:return .05;case Vt.Jennifer:return .02;case Vt.Jess:return .01;case Vt.Jett:return-.04;case Vt.Jill:return-.03;case Vt.Jiya:return-.03;case Vt.Joan:return-.45;case Vt.Jocelyn:return-.01;case Vt.Joel:return-.48;case Vt.Joey:return .01;case Vt.John:return .01;case Vt.Jonathon:return .02;case Vt.Jose:return .05;case Vt.Joseph:return .05;case Vt.Joshua:return-.01;case Vt.Judy:return .02;case Vt.Julia:return-.02;case Vt.Jumapili:return-.04;case Vt.June:return-.1;case Vt.Juro:return-.08;case Vt.Justin:return-.06;default:return 0}}static fetchHeight(e){switch(e){case Vt.Jaah:return 1.78;case Vt.Jack:return 1.8;case Vt.Jacob:return 1.82;case Vt.Jacqueline:return 1.78;case Vt.Jade:return 1.6;case Vt.James:return 1.75;case Vt.Jane:return 1.67;case Vt.Jaya:return 1.55;case Vt.Jaye:return 1.65;case Vt.Jamelia:return 1.8;case Vt.Jeanette:return 1.62;case Vt.Jedi:return 1.75;case Vt.Jeff:return 1.65;case Vt.Jena:return 1.6;case Vt.Jennifer:return 1.7;case Vt.Jess:return 1.5;case Vt.Jett:return 1.85;case Vt.Jill:return 1.71;case Vt.Jiya:return 1.74;case Vt.Joan:return 1.68;case Vt.Jocelyn:return 1.72;case Vt.Joel:return 1.75;case Vt.Joey:return 1.72;case Vt.John:return 1.85;case Vt.Jonathon:return 1.9;case Vt.Jose:return 1.6;case Vt.Joseph:return 1.88;case Vt.Joshua:return 1.79;case Vt.Judd:return 1.68;case Vt.Judy:return 1.75;case Vt.Julia:return 1.71;case Vt.Julio:return 1.76;case Vt.Jumapili:return 1.65;case Vt.June:return 1.85;case Vt.Juro:return 1.72;case Vt.Justin:return 1.755;default:return 1.8}}static fetchWidth(e){switch(e){case Vt.Jaah:return .74;case Vt.Jack:return .42;case Vt.Jacqueline:return .43;case Vt.Jacob:return .8;case Vt.Jade:return .48;case Vt.James:return .472;case Vt.Jane:return .4;case Vt.Jaya:return .6;case Vt.Jaye:return .55;case Vt.Jamelia:return .65;case Vt.Jeanette:return .4;case Vt.Jedi:return .56;case Vt.Jena:return .695;case Vt.Jennifer:return .45;case Vt.Jess:return .43;case Vt.Jill:return .42;case Vt.Joan:return 1.7;case Vt.Jocelyn:return .4;case Vt.Joel:return 1.8;case Vt.Joey:return .462;case Vt.John:return .6;case Vt.Jonathon:return .6;case Vt.Jose:return 2;case Vt.Joseph:return .6;case Vt.Joshua:return .5;case Vt.Judd:return .544;case Vt.Judy:return .41;case Vt.Julia:return .43;case Vt.Julio:return .5;case Vt.Jumapili:return .75;case Vt.June:return .65;case Vt.Juro:return .494;case Vt.Justin:return .6;default:return .6}}static fetchTextureImage(e){let n;switch(e){case Vt.Jaah:n=zVe;break;case Vt.Jacob:n=EVe;break;case Vt.Jacqueline:n=kVe;break;case Vt.Jade:n=FVe;break;case Vt.Jamelia:n=LVe;break;case Vt.James:n=WVe;break;case Vt.Jane:n=NVe;break;case Vt.Jaya:n=UVe;break;case Vt.Jaye:n=jVe;break;case Vt.Jeanette:n=BVe;break;case Vt.Jedi:n=YVe;break;case Vt.Jeff:n=OVe;break;case Vt.Jena:n=_Ve;break;case Vt.Jennifer:n=VVe;break;case Vt.Jess:n=GVe;break;case Vt.Jett:n=XVe;break;case Vt.Jill:n=JVe;break;case Vt.Jiya:n=KVe;break;case Vt.Joan:n=$Ve;break;case Vt.Jocelyn:n=qVe;break;case Vt.Joel:n=QVe;break;case Vt.Joey:n=ZVe;break;case Vt.John:n=eGe;break;case Vt.Jonathon:n=tGe;break;case Vt.Jose:n=nGe;break;case Vt.Joseph:n=oGe;break;case Vt.Joshua:n=rGe;break;case Vt.Judd:n=iGe;break;case Vt.Judy:n=aGe;break;case Vt.Julia:n=lGe;break;case Vt.Julio:n=sGe;break;case Vt.Jumapili:n=cGe;break;case Vt.June:n=uGe;break;case Vt.Juro:n=dGe;break;case Vt.Justin:n=fGe;break;default:n=DVe}return n}}const Kbt="/aladdin/assets/no_leaf_flower-CjefG9cq.png",$bt="/aladdin/assets/no_leaf_shrub-DDlKdxg_.png",hGe="/aladdin/assets/bellflower-C5sA-Fge.png",jde="/aladdin/assets/boxwood-cAqkPwU6.png",Bde="/aladdin/assets/cactus_combo_1-DgrI_pBB.png",Yde="/aladdin/assets/cactus_combo_2-CnD7zsEV.png",Ode="/aladdin/assets/cactus_combo_3-CTLr6iHA.png",_de="/aladdin/assets/cactus_combo_4-Bv3aYeWB.png",pGe="/aladdin/assets/hibiscus-DqTQjw28.png",gGe="/aladdin/assets/hydrangea-D6uimbNa.png",mGe="/aladdin/assets/hosta-Ds5QIDtm.png",yGe="/aladdin/assets/peony-pnxufFxy.png",AGe="/aladdin/assets/red_rose-BhP67K90.png",wGe="/aladdin/assets/spirea-aOcGALMo.png",xGe="/aladdin/assets/sunflower-l75w306z.png",Vde="/aladdin/assets/tall_bush-g5bJ_GuV.png",vGe="/aladdin/assets/tulip-BqSv3XYD.png",bGe="/aladdin/assets/white_flower-BUfV78a-.png",SGe="/aladdin/assets/yellow_flower-BQ5dOM0H.png";class i3{static fetchSpread(e){switch(e){case uo.Bellflower:return .45;case uo.Boxwood:return 1.6;case uo.CactusCombo1:return 1;case uo.CactusCombo2:return 1;case uo.CactusCombo3:return 1;case uo.CactusCombo4:return 1;case uo.Hosta:return 1;case uo.Hibiscus:return 2;case uo.Hydrangea:return 2;case uo.Peony:return 1.5;case uo.RedRose:return .5;case uo.Spirea:return 1.8;case uo.Sunflower:return 1;case uo.TallBush:return 1;case uo.Tulip:return .4;case uo.YellowFlower:return 2;default:return .8}}static fetchHeight(e){switch(e){case uo.Bellflower:return .4;case uo.Boxwood:return 1.44;case uo.CactusCombo1:return 1.18;case uo.CactusCombo2:return 1.35;case uo.CactusCombo3:return 1.24;case uo.CactusCombo4:return 1.35;case uo.Hosta:return .7;case uo.Hibiscus:return 1.7;case uo.Hydrangea:return 1.5;case uo.Peony:return 1;case uo.RedRose:return .8;case uo.Spirea:return 1.6;case uo.Sunflower:return 2;case uo.TallBush:return 2;case uo.Tulip:return .7;case uo.YellowFlower:return 1.4;default:return .5}}static fetchLabel(e,n){switch(e){case uo.Bellflower:return B.t("flower.Bellflower",n);case uo.Boxwood:return B.t("flower.Boxwood",n);case uo.CactusCombo1:return B.t("flower.CactusCombo1",n);case uo.CactusCombo2:return B.t("flower.CactusCombo2",n);case uo.CactusCombo3:return B.t("flower.CactusCombo3",n);case uo.CactusCombo4:return B.t("flower.CactusCombo4",n);case uo.Hibiscus:return B.t("flower.Hibiscus",n);case uo.Hydrangea:return B.t("flower.Hydrangea",n);case uo.Hosta:return B.t("flower.Hosta",n);case uo.Peony:return B.t("flower.Peony",n);case uo.RedRose:return B.t("flower.RedRose",n);case uo.Spirea:return B.t("flower.Spirea",n);case uo.Sunflower:return B.t("flower.Sunflower",n);case uo.TallBush:return B.t("flower.TallBush",n);case uo.Tulip:return B.t("flower.Tulip",n);case uo.YellowFlower:return B.t("flower.YellowFlower",n);default:return B.t("flower.WhiteFlower",n)}}static fetchTextureImage(e,n){if(n)return e===uo.Hibiscus||e===uo.Hydrangea||e===uo.YellowFlower||e===uo.Spirea?$bt:e===uo.Boxwood?jde:e===uo.TallBush?Vde:e===uo.CactusCombo1?Bde:e===uo.CactusCombo2?Yde:e===uo.CactusCombo3?Ode:e===uo.CactusCombo4?_de:Kbt;let o;switch(e){case uo.Bellflower:o=hGe;break;case uo.Boxwood:o=jde;break;case uo.CactusCombo1:o=Bde;break;case uo.CactusCombo2:o=Yde;break;case uo.CactusCombo3:o=Ode;break;case uo.CactusCombo4:o=_de;break;case uo.Hibiscus:o=pGe;break;case uo.Hydrangea:o=gGe;break;case uo.Hosta:o=mGe;break;case uo.Peony:o=yGe;break;case uo.RedRose:o=AGe;break;case uo.Spirea:o=wGe;break;case uo.Sunflower:o=xGe;break;case uo.TallBush:o=Vde;break;case uo.Tulip:o=vGe;break;case uo.YellowFlower:o=SGe;break;default:o=bGe}return o}}class Qa{static makeHuman(e,n,o,r,i){return{type:z.Human,name:e??Vt.Jack,cx:o,cy:r,cz:i,lx:hh.fetchWidth(e??Vt.Jack),lz:hh.fetchHeight(e??Vt.Jack),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Oi.generate()}}static makeTree(e,n,o,r,i,a,l){return{type:z.Tree,name:e??yr.Dogwood,cx:i,cy:a,cz:l,lx:n??3,lz:o??4,normal:[0,1,0],rotation:[0,0,0],parentId:r,id:Oi.generate()}}static makeSolarPanel(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y,w){let x;switch(e.type){case z.Foundation:x=e.id,w=z.Foundation;break;case z.Cuboid:x=e.id,w=z.Cuboid;break;case z.Wall:case z.Roof:x=e.parentId;break}return{type:z.SolarPanel,pvModelName:n.name,trackerType:Bl.NO_TRACKER,relativeAzimuth:u??0,tiltAngle:c??0,orientation:a??br.landscape,drawSunBeam:!1,poleHeight:l??1,poleRadius:.05,poleSpacing:s??3,cx:o,cy:r,cz:i,lx:m??(a===br.landscape?n.length:n.width),ly:y??(a===br.landscape?n.width:n.length),lz:n.thickness,showLabel:!1,normal:d?d.toArray():[0,0,1],rotation:f||[0,0,0],color:"#fff",frameColor:p??"white",parentType:w??e.type,parentId:e.id,foundationId:x,id:Oi.generate(),version:1}}static makeSolarWaterHeater(e,n,o,r,i,a){const l=H.getState().actionState;return{type:z.SolarWaterHeater,cx:n,cy:o,cz:r,lx:2.092,ly:1.558+l.solarWaterHeaterTankRadius,lz:l.solarWaterHeaterHeight,waterTankRadius:l.solarWaterHeaterTankRadius,relativeAzimuth:l.solarWaterHeaterRelativeAzimuth,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],color:l.solarWaterHeaterColor,parentType:e.type,parentId:e.id,foundationId:e.parentId,id:Oi.generate()}}static makeBatteryStorage(e,n,o,r){return{type:z.BatteryStorage,id:Oi.generate(),parentId:e.id,foundationId:e.id,cx:n,cy:o,cz:r,lx:1.5,ly:2,lz:1.5,normal:[0,0,0],rotation:[0,0,0],color:"#C7BABE"}}static makeFlower(e,n,o,r,i){return{type:z.Flower,name:e??uo.YellowFlower,cx:o,cy:r,cz:i,lx:i3.fetchSpread(e??uo.YellowFlower),lz:i3.fetchHeight(e??uo.YellowFlower),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Oi.generate()}}static makeCuboid(e,n,o,r,i){return{type:z.Cuboid,cx:e,cy:n,cz:o?o/2:2,lx:.1,ly:.1,lz:o??4,color:"#808080",faceColors:r??["#808080","#808080","#808080","#808080","#808080","#808080"],textureTypes:i??[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture],stackable:H.getState().actionState.cuboidStackable,transparency:H.getState().actionState.cuboidTransparency,normal:[0,0,1],rotation:[0,0,0],parentId:rr,selected:!1,id:Oi.generate()}}static makeFoundation(e,n,o,r,i){return{type:z.Foundation,cx:e,cy:n,cz:o?o/2:.05,lx:0,ly:0,lz:o??.1,normal:[0,0,1],rotation:[0,0,0],parentId:rr,selected:!1,color:r??"#808080",textureType:i??Xi.NoTexture,solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{...fVe},id:Oi.generate()}}static makeParabolicTrough(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y){let w;switch(e.type){case z.Foundation:w=e.id;break}return{type:z.ParabolicTrough,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:s??3,latusRectum:a??2,relativeAzimuth:0,tiltAngle:0,absorberTubeRadius:.05,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.05,cx:c,cy:u,cz:d,lx:m??2,ly:y??9,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:w,id:Oi.generate()}}static makeParabolicDish(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y){let w;switch(e.type){case z.Foundation:w=e.id;break}return{type:z.ParabolicDish,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:3,latusRectum:a??8,relativeAzimuth:0,tiltAngle:0,structureType:s??pf.CentralPole,receiverRadius:.25,receiverPoleRadius:.1,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.2,cx:c,cy:u,cz:d,lx:m??4,ly:y??4,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:w,id:Oi.generate()}}static makeFresnelReflector(e,n,o,r,i,a,l,s,c,u,d,f){let p;switch(e.type){case z.Foundation:p=e.id;break}return{type:z.FresnelReflector,receiverId:n??"None",reflectance:o??.9,moduleLength:i??3,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.05,cx:a,cy:l,cz:s,lx:d??2,ly:f??9,lz:.1,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:p,id:Oi.generate()}}static makeWindTurbine(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y,w,x,C,P){let A;switch(e.type){case z.Foundation:A=e.id;break}return{type:z.WindTurbine,birdSafe:n,bladeColor:o,stripeColor:r,numberOfBlades:i,initialRotorAngle:a,relativeYawAngle:l,pitchAngle:s,bladeRadius:c,bladeTipWidth:.2,bladeRootRadius:u,maximumChordRadius:f,maximumChordLength:d,towerRadius:p,towerHeight:m,hubRadius:y,hubLength:w,cx:x,cy:C,cz:P,lx:p*4,ly:p*4,lz:m+c,normal:[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:A,id:Oi.generate()}}static makeHeliostat(e,n,o,r,i,a,l,s,c,u,d){let f;switch(e.type){case z.Foundation:f=e.id;break}return{type:z.Heliostat,towerId:n??"None",reflectance:o??.9,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.1,cx:i,cy:a,cz:l,lx:u??2,ly:d??4,lz:.1,showLabel:!1,normal:s?s.toArray():[0,0,1],rotation:c||[0,0,0],parentId:e.id,foundationId:f,id:Oi.generate()}}static makePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=.2,u=.2,d=.2;let f=n,p=o;return e.type===z.Cuboid&&i?ye.isUnitVectorX(i)?f=r:ye.isUnitVectorY(i)&&(p=r):e.type===z.Wall&&(p=r),{type:z.Polygon,cx:f,cy:p,cz:0,lx:2*c,ly:2*u,lz:2*d,color:"#ffffff",normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],vertices:[{x:Math.max(-.5,f-c),y:Math.max(-.5,p-u)},{x:Math.max(-.5,f-c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.max(-.5,p-u)}],parentId:e.id,parentType:l,foundationId:s,selected:!1,filled:!0,selectedIndex:-1,id:Oi.generate()}}static makeWall(e,n,o,r,i){const a=H.getState().actionState;return{type:z.Wall,cx:n,cy:o,cz:r,lx:0,ly:a.wallThickness??.3,lz:a.wallHeight??5,parapet:a.wallParapet,eavesLength:a.wallEavesLength??.3,rValue:a.wallRValue??3,fill:Ul.Full,leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:a.wallHeight-.5,rightTopPartialHeight:a.wallHeight-.5,relativeAngle:0,leftPoint:[],rightPoint:[],leftJoints:[],rightJoints:[],textureType:a.wallTexture??Jo.Default,color:a.wallColor??"#ffffff",volumetricHeatCapacity:a.wallVolumetricHeatCapacity??.5,wallStructure:a.wallStructure??Tc.Default,studSpacing:a.wallStructureSpacing??2,studWidth:a.wallStructureWidth??.1,studColor:a.wallStructureColor??"#ffffff",opacity:a.wallOpacity!==void 0?a.wallOpacity:.5,selected:!1,lineWidth:.2,lineColor:"#000000",windows:[],showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:e.id,id:Oi.generate()}}static makeSensor(e,n,o,r,i,a){let l;switch(e.type){case z.Foundation:case z.Cuboid:l=e.id;break;case z.Wall:case z.Roof:l=e.parentId;break}return{type:z.Sensor,cx:n,cy:o,cz:r,lx:.1,ly:.1,lz:.01,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],parentId:e.id,foundationId:l,parentType:e.type,id:Oi.generate()}}static makeLight(e,n,o,r,i,a,l,s,c,u){let d;switch(e.type){case z.Foundation:case z.Cuboid:d=e.id;break;case z.Wall:case z.Roof:d=e.parentId;break}return{type:z.Light,decay:n??2,distance:o??5,intensity:r??3,color:i??"#ffff99",cx:a,cy:l,cz:s,lx:.16,ly:.16,lz:.08,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:d,parentType:e.type,id:Oi.generate()}}static makeWindow(e,n,o,r,i,a,l=0,s=0){let c,u=0;switch(e.type){case z.Cuboid:c=e.id;break;case z.Wall:c=e.parentId,u=e.ly;break;case z.Roof:c=e.parentId,u=e.thickness;break}const d=H.getState().actionState;return{type:z.Window,cx:n,cy:o,cz:r,lx:l,ly:u,lz:s,leftShutter:d.windowShutterLeft,rightShutter:d.windowShutterRight,shutterColor:d.windowShutterColor,shutterWidth:d.windowShutterWidth,horizontalMullion:d.windowHorizontalMullion,verticalMullion:d.windowVerticalMullion,mullionWidth:d.windowMullionWidth,horizontalMullionSpacing:d.windowHorizontalMullionSpacing,verticalMullionSpacing:d.windowVerticalMullionSpacing,mullionColor:d.windowMullionColor,frame:d.windowFrame,frameWidth:d.windowFrameWidth,sillWidth:Rn.isTypeRoof(i)?0:d.windowSillWidth,windowType:d.windowType,empty:d.windowEmpty,interior:d.windowInterior,archHeight:d.windowArchHeight,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,color:d.windowColor??"#ffffff",tint:d.windowTint??"#73D8FF",opacity:d.windowOpacity!==void 0?d.windowOpacity:.5,uValue:d.windowUValue??.5,normal:[0,-1,0],rotation:a?[...a]:[0,0,0],parentId:e.id,parentType:i,foundationId:c,id:Oi.generate()}}static makeDoor(e){let n;switch(e.type){case z.Cuboid:n=e.id;break;case z.Wall:n=e.parentId;break}const o=H.getState().actionState;return{type:z.Door,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,doorType:o.doorType,filled:o.doorFilled,interior:o.doorInterior,archHeight:o.doorArchHeight,textureType:o.doorTexture??dr.Default,color:o.doorColor??"#ffffff",uValue:o.doorUValue??.5,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:e.id,foundationId:n,id:Oi.generate()}}static makePyramidRoof(e,n){const o=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Yr.Default,roofType:Zo.Pyramid,roofStructure:Hc.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate()}}static makeGableRoof(e,n){const o=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Yr.Default,roofType:Zo.Gable,roofStructure:Hc.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate(),ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1]}}static makeHipRoof(e,n,o){const r=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Yr.Default,roofType:Zo.Hip,roofStructure:Hc.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate(),leftRidgeLength:(o??2)/2,rightRidgeLength:(o??2)/2}}static makeGambrelRoof(e,n){const r=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Yr.Default,roofType:Zo.Gambrel,roofStructure:Hc.Default,wallsId:[...e],topRidgePoint:[0,1],frontRidgePoint:[.35,.5],backRidgePoint:[.35,.5],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate()}}static makeMansardRoof(e,n){const o=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Yr.Default,roofType:Zo.Mansard,roofStructure:Hc.Default,wallsId:[...e],ridgeWidth:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate()}}}const qbt=t=>t.solarPanelArrayLayoutParams.pvModelName,Qbt=t=>t.solarPanelArrayLayoutParams.rowAxis,Zbt=t=>t.solarPanelArrayLayoutParams.rowsPerRack,eSt=t=>t.solarPanelArrayLayoutParams.interRowSpacing,tSt=t=>t.solarPanelArrayLayoutParams.margin,nSt=t=>t.solarPanelArrayLayoutParams.poleHeight,oSt=t=>t.solarPanelArrayLayoutParams.poleSpacing,rSt=t=>t.solarPanelArrayLayoutParams.tiltAngle,iSt=t=>t.solarPanelArrayLayoutParams.orientation,iQ=t=>t.viewState.navigationView,xs=t=>t.viewState.shadowEnabled,aQ=t=>t.viewState.shadowCameraFar,_2e=t=>t.viewState.solarPanelShininess,TGe=t=>t.viewState.windowShininess,Y5=t=>t.viewState.heatFluxScaleFactor,J3=t=>t.viewState.heatFluxColor,K3=t=>t.viewState.heatFluxWidth,Df=t=>t.viewState.solarRadiationHeatMapMaxValue,V2e=t=>t.viewState.solarRadiationHeatMapReflectionOnly,G2e=t=>t.viewState.axes,PGe=t=>t.viewState.ambientLightIntensity,CGe=t=>t.viewState.directLightIntensity,RGe=t=>t.viewState.theme,HGe=t=>t.viewState.showAzimuthAngle,MGe=t=>t.viewState.showElevationAngle,IGe=t=>t.viewState.showZenithAngle,zGe=t=>t.viewState.autoRotate,DGe=t=>t.viewState.hideAddress,h4=t=>t.viewState.groundImage,aSt=t=>t.viewState.groundImageType,EGe=t=>t.viewState.groundColor,kGe=t=>t.viewState.waterSurface,M0=t=>t.viewState.orthographic,lSt=t=>t.viewState.enableRotate,sSt=t=>t.viewState.cameraPosition,cSt=t=>t.viewState.cameraZoom,FGe=t=>t.viewState.heliodon,LGe=t=>t.viewState.showSunAngles,X2e=t=>t.viewState.mapZoom,uSt=t=>t.viewState.mapTilt,WGe=t=>t.viewState.mapType,J2e=t=>t.viewState.showSiteInfoPanel,lQ=t=>t.viewState.showDesignInfoPanel,NGe=t=>t.viewState.showInstructionPanel,UGe=t=>t.viewState.showHeliodonPanel,dSt=t=>t.viewState.heliodonPanelX,fSt=t=>t.viewState.heliodonPanelY,sQ=t=>t.viewState.showModelTree,hSt=t=>t.viewState.showMapPanel,pSt=t=>t.viewState.mapPanelX,gSt=t=>t.viewState.mapPanelY,mSt=t=>t.viewState.showWeatherPanel,ySt=t=>t.viewState.weatherPanelRect,ASt=t=>t.viewState.showDiurnalTemperaturePanel,wSt=t=>t.viewState.diurnalTemperaturePanelRect,jGe=t=>t.viewState.showStickyNotePanel,xSt=t=>t.viewState.stickyNotePanelRect,vSt=t=>t.viewState.showDailyBuildingEnergyPanel,bSt=t=>t.viewState.dailyBuildingEnergyPanelRect,SSt=t=>t.viewState.showYearlyBuildingEnergyPanel,TSt=t=>t.viewState.yearlyBuildingEnergyPanelRect,BGe=t=>t.viewState.showDailyLightSensorPanel,PSt=t=>t.viewState.dailyLightSensorPanelRect,CSt=t=>t.viewState.showYearlyLightSensorPanel,RSt=t=>t.viewState.yearlyLightSensorPanelRect,HSt=t=>t.viewState.yearlyLightSensorPanelShowDaylight,MSt=t=>t.viewState.yearlyLightSensorPanelShowClearness,YGe=t=>t.viewState.showDailyPvYieldPanel,ISt=t=>t.viewState.dailyPvYieldPanelRect,zSt=t=>t.viewState.showYearlyPvYieldPanel,DSt=t=>t.viewState.yearlyPvYieldPanelRect,ESt=t=>t.viewState.showSolarPanelVisibilityResultsPanel,kSt=t=>t.viewState.visibilityResultsPanelRect,OGe=t=>t.viewState.showDailyParabolicTroughYieldPanel,FSt=t=>t.viewState.dailyParabolicTroughYieldPanelRect,LSt=t=>t.viewState.showYearlyParabolicTroughYieldPanel,WSt=t=>t.viewState.yearlyParabolicTroughYieldPanelRect,_Ge=t=>t.viewState.showDailyParabolicDishYieldPanel,NSt=t=>t.viewState.dailyParabolicDishYieldPanelRect,USt=t=>t.viewState.showYearlyParabolicDishYieldPanel,jSt=t=>t.viewState.yearlyParabolicDishYieldPanelRect,VGe=t=>t.viewState.showDailyFresnelReflectorYieldPanel,BSt=t=>t.viewState.dailyFresnelReflectorYieldPanelRect,YSt=t=>t.viewState.showYearlyFresnelReflectorYieldPanel,OSt=t=>t.viewState.yearlyFresnelReflectorYieldPanelRect,GGe=t=>t.viewState.showDailyHeliostatYieldPanel,_St=t=>t.viewState.dailyHeliostatYieldPanelRect,VSt=t=>t.viewState.showYearlyHeliostatYieldPanel,GSt=t=>t.viewState.yearlyHeliostatYieldPanelRect,XGe=t=>t.viewState.showDailyUpdraftTowerYieldPanel,XSt=t=>t.viewState.dailyUpdraftTowerYieldPanelRect,JSt=t=>t.viewState.showYearlyUpdraftTowerYieldPanel,KSt=t=>t.viewState.yearlyUpdraftTowerYieldPanelRect,$St=t=>t.viewState.showEvolutionPanel,qSt=t=>t.viewState.evolutionPanelRect,tu=t=>t.world.latitude,TS=t=>t.world.longitude,ml=t=>t.world.date,K2e=t=>t.world.leafDayOfYear1,$2e=t=>t.world.leafDayOfYear2,QSt=t=>t.world.ground,cQ=t=>t.world.address,ZSt=t=>t.world.countryCode,eTt=t=>t.world.airAttenuationCoefficient,tTt=t=>t.world.airConvectiveCoefficient,JGe=t=>t.world.timesPerHour,UM=t=>t.world.daysPerYear,nTt=t=>t.world.discretization,KGe=t=>t.world.diurnalTemperatureModel,WN=t=>t.world.highestTemperatureTimeInMinutes,oTt=t=>t.world.solarRadiationHeatmapGridCellSize,rTt=t=>t.world.pvGridCellSize,iTt=t=>t.world.solarPanelVisibilityGridCellSize,aTt=t=>t.world.cspTimesPerHour,NN=t=>t.world.cspDaysPerYear,lTt=t=>t.world.cspGridCellSize,sTt=t=>t.world.sutTimesPerHour,$Ge=t=>t.world.sutDaysPerYear,cTt=t=>t.world.sutGridCellSize,q2e=t=>t.world.noAnimationForHeatmapSimulation,uTt=t=>t.world.noAnimationForThermalSimulation,Q2e=t=>t.world.noAnimationForSensorDataCollection,Z2e=t=>t.world.noAnimationForSolarPanelSimulation,qGe=t=>t.world.noAnimationForSolarUpdraftTowerSimulation,pn=t=>t.set,Xp=t=>t.user,dTt=t=>t.userCount,fTt=t=>t.modelTreeExpandedKeys,hTt=t=>t.showSolarPanelCustomizationPanel,pTt=t=>t.showEconomicsPanel,gTt=t=>t.showNavigationPanel,mTt=t=>t.showShadowSettings,yTt=t=>t.minimumNavigationMoveSpeed,ATt=t=>t.minimumNavigationTurnSpeed,wTt=t=>t.navigationMoveSpeed,xTt=t=>t.navigationTurnSpeed,O1=t=>t.getHeatmap,e5e=t=>t.setHeatmap,QGe=t=>t.clearHeatmaps,t5e=t=>t.flagOfDailySimulation,PS=t=>t.hourlyHeatExchangeArrayMap,vTt=t=>t.setHourlyHeatExchangeArray,bTt=t=>t.hourlySolarHeatGainArrayMap,STt=t=>t.setHourlySolarHeatGainArray,TTt=t=>t.hourlySolarPanelOutputArrayMap,PTt=t=>t.setHourlySolarPanelOutputArray,n5e=t=>t.getRoofSegmentVertices,UN=t=>t.getRoofSegmentVerticesWithoutOverhang,CTt=t=>t.latestVersion,o5e=t=>t.changed,RTt=t=>t.setChanged,HTt=t=>t.setSkipChange,no=t=>t.applyCount,qn=t=>t.setApplyCount,Ji=t=>t.revertApply,Qn=t=>t.elements,MTt=t=>t.notes,jM=t=>t.supportedPvModules,BM=t=>t.customPvModules,ITt=t=>t.loadSupportedPvModules,zTt=t=>t.addCustomPvModule,O5=t=>t.getPvModule,I0=t=>t.floatingWindowOpacity,kc=t=>t.selectedFloatingWindow,Au=t=>t.language,DTt=t=>t.locale,Qi=t=>t.loggable,ETt=t=>t.actionInfo,YM=t=>t.logAction,kTt=t=>t.currentUndoable,uQ=t=>t.openModelsMap,FTt=t=>t.modelsMapLatitude,LTt=t=>t.modelsMapLongitude,WTt=t=>t.modelsMapZoom,NTt=t=>t.modelsMapTilt,r5e=t=>t.modelsMapType,ZGe=t=>t.modelsMapWeatherStations,UTt=t=>t.showCloudFileTitleDialog,eXe=t=>t.showCloudFileTitleDialogFlag,CS=t=>t.cloudFile,jTt=t=>t.latestModelSite,tXe=t=>t.modelSites,BTt=t=>t.allModelSites,nXe=t=>t.peopleModels,YTt=t=>t.allPeopleModels,OTt=t=>t.saveAccountSettingsFlag,_Tt=t=>t.saveCloudFileFlag,VTt=t=>t.createProjectFlag,GTt=t=>t.saveProjectAsFlag,XTt=t=>t.curateDesignToProjectFlag,JTt=t=>t.showProjectsFlag,KTt=t=>t.updateProjectsFlag,$Tt=t=>t.confirmOpeningDesign,qTt=t=>t.modelsMapFlag,oXe=t=>t.showModelsAllTime,rXe=t=>t.showModelsFromDate,iXe=t=>t.showModelsToDate,QTt=t=>t.leaderboardFlag,ZTt=t=>t.showLeaderboard,ePt=t=>t.publishOnModelsMapFlag,tPt=t=>t.listCloudFilesFlag,nPt=t=>t.refreshCloudFilesFlag,oPt=t=>t.localContentToImportAfterCloudFileUpdate,rPt=t=>t.localFileName,iPt=t=>t.createNewFileFlag,aPt=t=>t.openLocalFileFlag,aXe=t=>t.saveLocalFileDialogVisible,OM=t=>t.fileChanged,i5e=t=>t.undoManager,Fn=t=>t.addUndoable,a5e=t=>t.importContent,lXe=t=>t.exportContent,lPt=t=>t.clearContent,sXe=t=>t.createEmptyFile,sPt=t=>t.aabb,cXe=t=>t.animateSun,cPt=t=>t.animate24Hours,jN=t=>t.runDailyThermalSimulation,uPt=t=>t.pauseDailyThermalSimulation,dQ=t=>t.runYearlyThermalSimulation,dPt=t=>t.pauseYearlyThermalSimulation,fPt=t=>t.clearDailySimulationResultsFlag,hPt=t=>t.clearYearlySimulationResultsFlag,BN=t=>t.runDynamicSimulation,l5e=t=>t.runStaticSimulation,pPt=t=>t.pauseSimulation,_5=t=>t.runEvolution,fQ=t=>t.pauseEvolution,hQ=t=>t.objectiveEvaluationIndex,_M=t=>t.evolutionMethod,gPt=t=>t.updateSceneRadiusFlag,uXe=t=>t.updateSceneRadius,Ky=t=>t.sceneRadius,mPt=t=>t.cameraDirection,s5e=t=>t.getCameraDirection,Jn=t=>t.getElementById,p4=t=>t.getFoundation,$r=t=>t.getParent,RS=t=>t.getChildren,$3=t=>t.getChildrenOfType,q3=t=>t.selectedElement,yPt=t=>t.selectedElementIdSet,HS=t=>t.getSelectedElement,c5e=t=>t.overlapWithSibling,dXe=t=>t.selectedSideIndex,Q3=t=>t.setElementPosition,u5e=t=>t.setElementSize,APt=t=>t.setElementNormal,wPt=t=>t.updateElementLockById,xPt=t=>t.updateElementReferenceById,vPt=t=>t.updateElementLabelById,bPt=t=>t.updateElementShowLabelById,fXe=t=>t.updateElementCxById,hXe=t=>t.updateElementCyById,SPt=t=>t.updateElementCzById,TPt=t=>t.updateElementCzForAll,Z3=t=>t.updateElementLxById,pQ=t=>t.updateElementLxAboveFoundation,YN=t=>t.updateElementLxForAll,H7=t=>t.updateElementLyById,gQ=t=>t.updateElementLyAboveFoundation,ON=t=>t.updateElementLyForAll,d5e=t=>t.updateElementLzById,PPt=t=>t.updateElementLzForAll,f5e=t=>t.updateElementColorById,CPt=t=>t.updateElementColorOnSurface,RPt=t=>t.updateElementColorAboveFoundation,h5e=t=>t.updateElementColorForAll,HPt=t=>t.updateElementLineColorById,MPt=t=>t.updateElementLineColorOnSurface,IPt=t=>t.updateElementLineColorAboveFoundation,zPt=t=>t.updateElementLineColorForAll,DPt=t=>t.updateElementLineWidthById,EPt=t=>t.updateElementLineWidthOnSurface,kPt=t=>t.updateElementLineWidthAboveFoundation,FPt=t=>t.updateElementLineWidthForAll,mQ=t=>t.updateElementRotationById,LPt=t=>t.updateElementRotationForAll,ac=t=>t.foundationActionScope,WPt=t=>t.setFoundationActionScope,VM=t=>t.polygonActionScope,GM=t=>t.setPolygonActionScope,pXe=t=>t.updatePolygonVertexPositionById,M7=t=>t.updatePolygonVerticesById,MS=t=>t.cuboidActionScope,IS=t=>t.setCuboidActionScope,_N=t=>t.batteryStorageActionScope,VN=t=>t.setBatteryStorageActionScope,Wh=t=>t.solarPanelActionScope,Nh=t=>t.setSolarPanelActionScope,p5e=t=>t.solarWaterHeaterActionScope,g5e=t=>t.setSolarWaterHeaterActionScope,GN=t=>t.updateSolarCollectorDailyYieldById,XN=t=>t.updateSolarCollectorYearlyYieldById,NPt=t=>t.updateSolarPanelTiltAngleById,gXe=t=>t.updateSolarCollectorDrawSunBeamById,mXe=t=>t.updateSolarCollectorDrawSunBeamAboveFoundation,yXe=t=>t.updateSolarCollectorDrawSunBeamForAll,yQ=t=>t.updateSolarCollectorRelativeAzimuthById,AXe=t=>t.updateSolarCollectorRelativeAzimuthOnSurface,wXe=t=>t.updateSolarCollectorRelativeAzimuthAboveFoundation,xXe=t=>t.updateSolarCollectorRelativeAzimuthForAll,UPt=t=>t.updateSolarCollectorXById,jPt=t=>t.updateSolarCollectorXAboveFoundation,BPt=t=>t.updateSolarCollectorXForAll,YPt=t=>t.updateSolarCollectorYById,OPt=t=>t.updateSolarCollectorYAboveFoundation,_Pt=t=>t.updateSolarCollectorYForAll,JN=t=>t.updateSolarCollectorPoleHeightById,VPt=t=>t.updateSolarCollectorPoleHeightOnSurface,KN=t=>t.updateSolarCollectorPoleHeightAboveFoundation,$N=t=>t.updateSolarCollectorPoleHeightForAll,vXe=t=>t.updateSolarCollectorPoleRadiusById,bXe=t=>t.updateSolarCollectorPoleRadiusAboveFoundation,SXe=t=>t.updateSolarCollectorPoleRadiusForAll,AQ=t=>t.updateCspReflectanceById,wQ=t=>t.updateCspReflectanceAboveFoundation,xQ=t=>t.updateCspReflectanceForAll,TXe=t=>t.updateParabolicCollectorAbsorptanceById,PXe=t=>t.updateParabolicCollectorAbsorptanceAboveFoundation,CXe=t=>t.updateParabolicCollectorAbsorptanceForAll,RXe=t=>t.updateParabolicCollectorOpticalEfficiencyById,HXe=t=>t.updateParabolicCollectorOpticalEfficiencyAboveFoundation,MXe=t=>t.updateParabolicCollectorOpticalEfficiencyForAll,IXe=t=>t.updateParabolicCollectorThermalEfficiencyById,zXe=t=>t.updateParabolicCollectorThermalEfficiencyAboveFoundation,DXe=t=>t.updateParabolicCollectorThermalEfficiencyForAll,g4=t=>t.parabolicTroughActionScope,m4=t=>t.setParabolicTroughActionScope,zS=t=>t.fresnelReflectorActionScope,DS=t=>t.setFresnelReflectorActionScope,ES=t=>t.heliostatActionScope,kS=t=>t.setHeliostatActionScope,EXe=t=>t.updateSolarReceiverById,kXe=t=>t.updateSolarReceiverAboveFoundation,FXe=t=>t.updateSolarReceiverForAll,y4=t=>t.parabolicDishActionScope,A4=t=>t.setParabolicDishActionScope,LXe=t=>t.updateParabolaLatusRectumById,WXe=t=>t.updateParabolaLatusRectumAboveFoundation,NXe=t=>t.updateParabolaLatusRectumForAll,UXe=t=>t.updateModuleLengthById,jXe=t=>t.updateModuleLengthAboveFoundation,BXe=t=>t.updateModuleLengthForAll,e6=t=>t.windTurbineActionScope,t6=t=>t.setWindTurbineActionScope,YXe=t=>t.copyElementById,Jp=t=>t.removeElementById,GPt=t=>t.clearDeletedElements,XPt=t=>t.countElementsByReferenceId,m5e=t=>t.removeElementsByReferenceId,OXe=t=>t.pasteElementsToPoint,JPt=t=>t.pasteElementsByKey,_Xe=t=>t.elementsToPaste,z0=t=>t.selectMe,qN=t=>t.selectNone,vQ=t=>t.selectElement,y5e=t=>t.addElement,bQ=t=>t.objectTypeToAdd,KPt=t=>t.actionModeLock,Pm=t=>t.countElementsByType,VXe=t=>t.countSolarStructuresByType,$Pt=t=>t.countObservers,qPt=t=>t.countSolarPanelsOnRack,QPt=t=>t.selectedElementAngle,ZPt=t=>t.waiting,Ef=t=>t.simulationInProgress,A5e=t=>t.simulationPaused,GXe=t=>t.evolutionInProgress,XXe=t=>t.evolutionPaused,eCt=t=>t.contextMenuObjectType,tCt=t=>t.enableFineGrid,nCt=t=>t.setEnableFineGrid,oCt=t=>t.showCloudFilePanel,w5e=t=>t.projectState.title,JXe=t=>t.projectState.owner,rCt=t=>t.projectState.description,iCt=t=>t.projectState.designs,aCt=t=>t.projectState.type,KXe=t=>t.projectState.selectedProperty,lCt=t=>t.projectState.dataColoring,sCt=t=>t.projectState.thumbnailWidth,cCt=t=>t.projectState.xAxisNameScatterPlot,uCt=t=>t.projectState.yAxisNameScatterPlot,dCt=t=>t.projectState.dotSizeScatterPlot,fCt=t=>t.projectState.sortDescending,hCt=t=>t.projectState.filters,pCt=t=>t.projectState.ranges,gCt=t=>t.projectState.hiddenParameters,QN=t=>t.projectView,mCt=t=>t.canvasPercentWidth,$Xe=t=>t.cloudFileBelongToProject,qXe=t=>t.closeProject,yCt=t=>t.showProjectListPanel,ACt=t=>t.showModelsGallery,wCt=t=>t.showAccountSettingsPanel,xCt=t=>t.showLikesPanel,vCt=t=>t.showPublishedModelsPanel,bCt=t=>t.weatherModel,QXe=t=>t.setWeatherModel,x5e=t=>t.weatherData,SCt=t=>t.loadWeatherData,TCt=t=>t.loadHorizontalSolarRadiationData,PCt=t=>t.getHorizontalSolarRadiation,CCt=t=>t.loadVerticalSolarRadiationData,RCt=t=>t.getVerticalSolarRadiation,ZXe=t=>t.getClosestCity,I7=t=>t.sunlightDirection,HCt=t=>t.setSunlightDirection,vs=t=>t.showSolarRadiationHeatmap,MCt=t=>t.selectButtonClicked,n6=t=>t.showHeatFluxes,ICt=t=>t.runSolarPanelVisibilityAnalysis,zCt=t=>t.solarPanelVisibilityResults,eJe=t=>t.runDailySimulationForSolarPanels,DCt=t=>t.runDailySimulationForSolarPanelsLastStep,tJe=t=>t.runYearlySimulationForSolarPanels,ECt=t=>t.runYearlySimulationForSolarPanelsLastStep,kCt=t=>t.pauseDailySimulationForSolarPanels,FCt=t=>t.pauseYearlySimulationForSolarPanels,LCt=t=>t.dailyPvYield,nJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyPvIndividualOutputs},WCt=t=>t.setDailyPvYield,NCt=t=>t.yearlyPvYield,oJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyPvIndividualOutputs},UCt=t=>t.setYearlyPvYield,rJe=t=>t.solarPanelLabels,jCt=t=>t.setSolarPanelLabels,iJe=t=>t.setTotalBuildingHeater,aJe=t=>t.setTotalBuildingAc,lJe=t=>t.setTotalBuildingSolarPanel,BCt=t=>t.runDailySimulationForParabolicTroughs,YCt=t=>t.runYearlySimulationForParabolicTroughs,OCt=t=>t.pauseDailySimulationForParabolicTroughs,_Ct=t=>t.pauseYearlySimulationForParabolicTroughs,VCt=t=>t.dailyParabolicTroughYield,sJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicTroughIndividualOutputs},GCt=t=>t.setDailyParabolicTroughYield,XCt=t=>t.yearlyParabolicTroughYield,cJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicTroughIndividualOutputs},JCt=t=>t.setYearlyParabolicTroughYield,uJe=t=>t.parabolicTroughLabels,KCt=t=>t.setParabolicTroughLabels,$Ct=t=>t.runDailySimulationForFresnelReflectors,qCt=t=>t.runYearlySimulationForFresnelReflectors,QCt=t=>t.pauseDailySimulationForFresnelReflectors,ZCt=t=>t.pauseYearlySimulationForFresnelReflectors,eRt=t=>t.dailyFresnelReflectorYield,dJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyFresnelReflectorIndividualOutputs},tRt=t=>t.setDailyFresnelReflectorYield,nRt=t=>t.yearlyFresnelReflectorYield,fJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyFresnelReflectorIndividualOutputs},oRt=t=>t.setYearlyFresnelReflectorYield,hJe=t=>t.fresnelReflectorLabels,rRt=t=>t.setFresnelReflectorLabels,iRt=t=>t.runDailySimulationForHeliostats,aRt=t=>t.runYearlySimulationForHeliostats,lRt=t=>t.pauseDailySimulationForHeliostats,sRt=t=>t.pauseYearlySimulationForHeliostats,cRt=t=>t.dailyHeliostatYield,pJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyHeliostatIndividualOutputs},uRt=t=>t.setDailyHeliostatYield,dRt=t=>t.yearlyHeliostatYield,gJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyHeliostatIndividualOutputs},fRt=t=>t.setYearlyHeliostatYield,mJe=t=>t.heliostatLabels,hRt=t=>t.setHeliostatLabels,yJe=t=>t.runDailySimulationForUpdraftTower,AJe=t=>t.runYearlySimulationForUpdraftTower,pRt=t=>t.pauseDailySimulationForUpdraftTower,gRt=t=>t.pauseYearlySimulationForUpdraftTower,mRt=t=>t.dailyUpdraftTowerResults,yRt=t=>t.dailyUpdraftTowerYield,ARt=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyUpdraftTowerIndividualOutputs},wRt=t=>t.setDailyUpdraftTowerResults,xRt=t=>t.setDailyUpdraftTowerYield,vRt=t=>t.yearlyUpdraftTowerYield,bRt=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyUpdraftTowerIndividualOutputs},SRt=t=>t.setYearlyUpdraftTowerYield,wJe=t=>t.updraftTowerLabels,TRt=t=>t.setUpdraftTowerLabels,PRt=t=>t.runDailySimulationForParabolicDishes,CRt=t=>t.runYearlySimulationForParabolicDishes,RRt=t=>t.pauseDailySimulationForParabolicDishes,HRt=t=>t.pauseYearlySimulationForParabolicDishes,MRt=t=>t.dailyParabolicDishYield,xJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicDishIndividualOutputs},IRt=t=>t.setDailyParabolicDishYield,zRt=t=>t.yearlyParabolicDishYield,vJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicDishIndividualOutputs},DRt=t=>t.setYearlyParabolicDishYield,bJe=t=>t.parabolicDishLabels,ERt=t=>t.setParabolicDishLabels,SJe=t=>t.runDailyLightSensor,kRt=t=>t.pauseDailyLightSensor,TJe=t=>t.runYearlyLightSensor,FRt=t=>t.pauseYearlyLightSensor,LRt=t=>t.dailyLightSensorData,WRt=t=>t.setDailyLightSensorData,NRt=t=>t.yearlyLightSensorData,URt=t=>t.setYearlyLightSensorData,PJe=t=>t.sensorLabels,jRt=t=>t.setSensorLabels,$y=t=>t.hoveredHandle,FS=t=>t.moveHandleType,Cm=t=>t.resizeHandleType,v5e=t=>t.getResizeHandlePosition,SQ=t=>t.rotateHandleType,BRt=t=>t.resizeAnchor,b5e=t=>t.isAddingElement,TQ=t=>t.addedFoundationId,YRt=t=>t.deletedFoundationId,PQ=t=>t.addedCuboidId,ORt=t=>t.deletedCuboidId,CJe=t=>t.addedWallId,_Rt=t=>t.deletedWallId,VRt=t=>t.deletedRoofId,S5e=t=>t.deletedRoofIdSet,RJe=t=>t.autoDeletedRoofIdSet,GRt=t=>t.autoDeletedRoofs,HJe=t=>t.autoDeletedChild,MJe=t=>t.groupActionMode,XRt=t=>t.groupActionUpdateFlag,JRt=t=>t.addedWindowId,KRt=t=>t.addedDoorId,$Rt=t=>t.updateWallMapOnFoundationFlag,o6=t=>t.wallActionScope,qy=t=>t.roofActionScope,ZN=t=>t.windowActionScope,z7=t=>t.doorActionScope,IJe=t=>t.setRoofActionScope,T5e=t=>t.updateWallLeftJointsById,P5e=t=>t.updateWallRightJointsById,qRt=t=>t.updateWallLeftPointById,CQ=t=>t.economicsParams,QRt=t=>t.fittestIndividualResults,RQ=t=>t.setFittestIndividualResults,eU=t=>t.variableLabels,HQ=t=>t.setVariableLabels,w4=t=>t.evolutionaryAlgorithmState,MQ=t=>t.solarPanelArrayLayoutConstraints,ZRt=t=>t.geneticAlgorithmWizardSelectedTab,eHt=t=>t.particleSwarmOptimizationWizardSelectedTab,tHt=t=>t.countHeatmapCells,kf=t=>t.setPrimitiveStore,C5e=xe.memo(({hx:t,hy:e,hz:n,position:o,rotation:r})=>{const i=H(tCt),a=H(h4),l=a?"#888888":"#444444",s=Math.max(t,e),[c,u]=g.useState(Math.floor(s/50)+1),[d,f]=g.useState(.5);g.useEffect(()=>{i?(u((Math.floor(s/25)+1)*r3),f(a?.05:.1)):(u((Math.floor(s/25)+1)*yA),f((a?.05:.1)*W9))},[i,s,a]);const p=g.useMemo(()=>{const y=[0];for(let w=c;w<=t;w+=c)y.push(w),y.push(-w);return y},[c,t]),m=g.useMemo(()=>{const y=[0];for(let w=c;w<=e;w+=c)y.push(w),y.push(-w);return y},[c,e]);return h.jsxs("group",{position:o??[0,0,n+.01],rotation:r,children:[p.map(y=>h.jsx(On,{points:[[y,-e,0],[y,e,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},y)),m.map(y=>h.jsx(On,{points:[[-t,y,0],[t,y,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},y))]})}),tle=.2,nHt=({x:t,z:e,handleType:n,scale:o=[1,1,1]})=>{const r=H(pn),i=H(Cm),a=g.useRef(null),[l,s]=g.useState("white"),[c,u,d]=o;return g.useEffect(()=>{s(i===n?"red":"white")},[i]),h.jsx(di,{ref:a,name:n,args:[tle*c,tle*u,tle*d],position:[t,0,e],onPointerEnter:()=>{s("red"),r(f=>{f.hoveredHandle=n})},onPointerLeave:()=>{i===null&&s("white"),r(f=>{f.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:l})})},xv=xe.memo(nHt),oHt=({handleType:t})=>{const e=H(FS),n=g.useRef(null),[o,r]=g.useState("white");return g.useEffect(()=>{e===Ho.Mid?r("red"):r("white")},[e]),h.jsx(Ys,{ref:n,name:t,args:[.1,6,6],onPointerEnter:()=>{r("red")},onPointerLeave:()=>{e===null&&r("white")},children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},rHt=xe.memo(oHt);class nle{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y,this.array[this.top++]=e.z}}class iHt{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y}}let HP=class nG{constructor(e){this.plane=null,this.front=null,this.back=null,this.polygons=[],e&&this.build(e)}clone(){const e=new nG;return e.plane=this.plane&&this.plane.clone(),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e.polygons=this.polygons.map(n=>n.clone()),e}invert(){for(let n=0;nNv.EPSILON?1:0;u|=m,d.push(m)}switch(u){case 0:(this.normal.dot(e.plane.normal)>0?n:o).push(e);break;case 1:r.push(e);break;case 2:i.push(e);break;case 3:{const f=[],p=[];for(let m=0;m=3&&r.push(new LX(f,e.shared)),p.length>=3&&i.push(new LX(p,e.shared));break}}}static fromPoints(e,n,o){const r=new c5().copy(n).sub(e).cross(new c5().copy(o).sub(e)).normalize();return new Nv(r.clone(),r.dot(e))}}Nv.EPSILON=1e-5;let LX=class zJe{constructor(e,n){this.vertices=e,this.shared=n,this.plane=Nv.fromPoints(e[0].pos,e[1].pos,e[2].pos)}clone(){return new zJe(this.vertices.map(e=>e.clone()),this.shared)}flip(){this.vertices.reverse().map(e=>e.flip()),this.plane.flip()}};class WX{constructor(e,n,o,r){this.pos=new c5().copy(e),this.normal=new c5().copy(n),this.uv=new c5().copy(o),this.uv.z=0,r&&(this.color=new c5().copy(r))}clone(){return new WX(this.pos,this.normal,this.uv,this.color)}flip(){this.normal.negate()}interpolate(e,n){return new WX(this.pos.clone().lerp(e.pos,n),this.normal.clone().lerp(e.normal,n),this.uv.clone().lerp(e.uv,n),this.color&&e.color&&this.color.clone().lerp(e.color,n))}}class Ac{constructor(){this.polygons=[]}static fromPolygons(e){const n=new Ac;return n.polygons=e,n}static fromGeometry(e,n){let o=[];const r=e.attributes.position,i=e.attributes.normal,a=e.attributes.uv,l=e.attributes.color,s=e.groups;let c;if(e.index)c=e.index.array;else{c=new Array(r.array.length/r.itemSize|0);for(let d=0;d0)for(const y of s)d>=y.start&&d!Number.isNaN(d.plane.normal.x)))}static toGeometry(e,n){let o=0;const r=e.polygons;for(const p of r)o+=p.vertices.length-2;const i=new Ni,a=new nle(o*3*3),l=new nle(o*3*3),s=new iHt(o*2*3);let c;const u=[],d=[];for(const p of r){const m=p.vertices,y=m.length;p.shared!==void 0&&(u[p.shared]||(u[p.shared]=[])),y&&m[0].color!==void 0&&(c||(c=new nle(o*3*3)));for(let w=3;w<=y;w++)(p.shared===void 0?d:u[p.shared]).push(a.top/3,a.top/3+1,a.top/3+2),a.write(m[0].pos),a.write(m[w-2].pos),a.write(m[w-1].pos),l.write(m[0].normal),l.write(m[w-2].normal),l.write(m[w-1].normal),s&&(s.write(m[0].uv),s.write(m[w-2].uv),s.write(m[w-1].uv)),c&&(c.write(m[0].color),c.write(m[w-2].color),c.write(m[w-1].color))}i.setAttribute("position",new _a(a.array,3)),i.setAttribute("normal",new _a(l.array,3)),s&&i.setAttribute("uv",new _a(s.array,2)),c&&i.setAttribute("color",new _a(c.array,3));for(let p=0;pn.clone()).filter(n=>Number.isFinite(n.plane.w)),e}toPolygons(){return this.polygons}union(e){const n=new HP(this.clone().polygons),o=new HP(e.clone().polygons);return n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),Ac.fromPolygons(n.allPolygons())}subtract(e){const n=new HP(this.clone().polygons),o=new HP(e.clone().polygons);return n.invert(),n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),n.invert(),Ac.fromPolygons(n.allPolygons())}intersect(e){const n=new HP(this.clone().polygons),o=new HP(e.clone().polygons);return n.invert(),o.clipTo(n),o.invert(),n.clipTo(o),o.clipTo(n),n.build(o.allPolygons()),n.invert(),Ac.fromPolygons(n.allPolygons())}inverse(){const e=this.clone();for(const n of e.polygons)n.flip();return e}toMesh(e,n){return Ac.toMesh(this,e,n)}toGeometry(e){return Ac.toGeometry(this,e)}}const dt=pq()((t,e)=>{const n=o=>t(Dv(o));return{set:o=>{try{n(o)}catch(r){console.log(r)}},setPrimitiveStore(o,r){n(i=>{i[o]!==void 0?i[o]=r:console.error(`key ${o} is not defined in PrimitiveStoreState`)})},latestVersion:void 0,changed:!1,setChanged(o){n(r=>{r.changed=o})},skipChange:!0,setSkipChange(o){n(r=>{r.skipChange=o})},muteUndoMessage:!1,localFileName:"aladdin.ala",createNewFileFlag:!1,setCreateNewFileFlag(o){n(r=>{r.createNewFileFlag=o})},openLocalFileFlag:!1,setOpenLocalFileFlag(o){n(r=>{r.openLocalFileFlag=o})},waiting:!1,contextMenuFlag:!1,updateContextMenu(){n(o=>{o.contextMenuFlag=!o.contextMenuFlag})},modelTreeExpandedKeys:[],showSolarPanelCustomizationPanel:!1,showEconomicsPanel:!1,showNavigationPanel:!1,showShadowSettings:!1,saveAccountSettingsFlag:!1,saveCloudFileFlag:!1,setSaveCloudFileFlag(o){n(r=>{r.saveCloudFileFlag=o})},listCloudFilesFlag:!1,refreshCloudFilesFlag:!1,saveLocalFileDialogVisible:!1,modelsMapFlag:!1,modelsMapSelectedSite:void 0,leaderboardFlag:!1,showLeaderboard:!1,publishOnModelsMapFlag:!1,modelsMapWeatherStations:!1,createProjectFlag:!1,saveProjectAsFlag:!1,curateDesignToProjectFlag:!1,showProjectsFlag:!1,updateProjectsFlag:!1,showProjectListPanel:!1,projectImagesUpdateFlag:!1,confirmOpeningDesign:!0,projectType:Pi.SOLAR_PANEL_ARRAY,projectTitle:null,projectDescription:null,userCount:0,showCloudFilePanel:!1,openModelsMap:!1,showModelsGallery:!1,showAccountSettingsPanel:!1,showLikesPanel:!1,showPublishedModelsPanel:!1,animateSun:!1,simulationInProgress:!1,simulationPaused:!1,evolutionInProgress:!1,evolutionPaused:!1,runEvolution:!1,pauseEvolution:!1,objectiveEvaluationIndex:0,runDailyThermalSimulation:!1,pauseDailyThermalSimulation:!1,runYearlyThermalSimulation:!1,pauseYearlyThermalSimulation:!1,clearDailySimulationResultsFlag:!1,clearYearlySimulationResultsFlag:!1,runDynamicSimulation:!1,runStaticSimulation:!1,pauseSimulation:!1,runDailySimulationForParabolicDishes:!1,runYearlySimulationForParabolicDishes:!1,pauseDailySimulationForParabolicDishes:!1,pauseYearlySimulationForParabolicDishes:!1,runDailySimulationForParabolicTroughs:!1,runYearlySimulationForParabolicTroughs:!1,pauseDailySimulationForParabolicTroughs:!1,pauseYearlySimulationForParabolicTroughs:!1,runDailySimulationForFresnelReflectors:!1,runYearlySimulationForFresnelReflectors:!1,pauseDailySimulationForFresnelReflectors:!1,pauseYearlySimulationForFresnelReflectors:!1,runDailySimulationForHeliostats:!1,runYearlySimulationForHeliostats:!1,pauseDailySimulationForHeliostats:!1,pauseYearlySimulationForHeliostats:!1,runSolarPanelVisibilityAnalysis:!1,runDailySimulationForSolarPanels:!1,pauseDailySimulationForSolarPanels:!1,runYearlySimulationForSolarPanels:!1,pauseYearlySimulationForSolarPanels:!1,runDailySimulationForSolarPanelsLastStep:!1,runYearlySimulationForSolarPanelsLastStep:!1,runDailyLightSensor:!1,pauseDailyLightSensor:!1,runYearlyLightSensor:!1,pauseYearlyLightSensor:!1,runDailySimulationForUpdraftTower:!1,runYearlySimulationForUpdraftTower:!1,pauseDailySimulationForUpdraftTower:!1,pauseYearlySimulationForUpdraftTower:!1,flagOfDailySimulation:!1,showSolarRadiationHeatmap:!1,showHeatFluxes:!1,duringCameraInteraction:!1,navigationMoveSpeed:3,navigationTurnSpeed:3,elementBeingCanceledId:null,showWallIntersectionPlaneId:null,oldParentId:null,oldFoundationId:null,selectedElementId:null,foundationMovedFlag:!1,updateFoundationMovedFlag(){n(o=>{o.foundationMovedFlag=!o.foundationMovedFlag})},isCameraUnderGround:!1,selectButtonClicked:!1,setSelectButtonClicked(o){n(r=>{r.selectButtonClicked=o})}}}),In=pq()((t,e)=>({roofSegmentVerticesMap:new Map,setRoofSegmentVertices(n,o){t(r=>(r.roofSegmentVerticesMap.set(n,[...o]),r))},getRoofSegmentVertices(n){return e().roofSegmentVerticesMap.get(n)},deleteRoofSegmentVertices(n){t(o=>(o.roofSegmentVerticesMap.delete(n),o))},roofSegmentVerticesWithoutOverhangMap:new Map,setRoofSegmentVerticesWithoutOverhang(n,o){t(r=>(r.roofSegmentVerticesWithoutOverhangMap.set(n,o),r))},getRoofSegmentVerticesWithoutOverhang(n){return e().roofSegmentVerticesWithoutOverhangMap.get(n)},deleteRoofSegmentVerticesWithoutOverhang(n){t(o=>(o.roofSegmentVerticesWithoutOverhangMap.delete(n),o))},dailyLightSensorData:[],setDailyLightSensorData(n){t({dailyLightSensorData:[...n]})},yearlyLightSensorData:[],setYearlyLightSensorData(n){t({yearlyLightSensorData:[...n]})},sensorLabels:[],setSensorLabels(n){t({sensorLabels:[...n]})},dailyPvYield:[],setDailyPvYield(n){t({dailyPvYield:[...n]}),dt.getState().set(o=>{o.runEvolution&&o.objectiveEvaluationIndex++})},sumDailyPvYield(){let n=0;for(const o of this.dailyPvYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},getDailyPvProfit(){const n=this.sumDailyPvYield(),o=ye.countAllSolarPanels();return n*H.getState().economicsParams.electricitySellingPrice-o*H.getState().economicsParams.operationalCostPerUnit},yearlyPvYield:[],setYearlyPvYield(n){t({yearlyPvYield:[...n]}),dt.getState().set(o=>(o.runEvolution&&o.objectiveEvaluationIndex++,o))},sumYearlyPvYield(){var r;let n=0;for(const i of this.yearlyPvYield)for(const a in i)Object.hasOwn(i,a)&&a!=="Month"&&(n+=i[a]);const o=12/(((r=H.getState().world)==null?void 0:r.daysPerYear)??6);return n*o},getYearlyPvProfit(){const n=ye.countAllSolarPanels();return this.sumYearlyPvYield()*H.getState().economicsParams.electricitySellingPrice-n*H.getState().economicsParams.operationalCostPerUnit*365},solarPanelLabels:[],setSolarPanelLabels(n){t({solarPanelLabels:[...n]})},solarPanelVisibilityResults:new Map,setSolarPanelVisibilityResult(n,o){t(r=>(r.solarPanelVisibilityResults.set(n,o),r))},clearSolarPanelVisibilityResults(){t({solarPanelVisibilityResults:new Map})},dailyParabolicDishYield:[],setDailyParabolicDishYield(n){t({dailyParabolicDishYield:[...n]})},sumDailyParabolicDishYield(){let n=0;for(const o of this.dailyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicDishYield:[],setYearlyParabolicDishYield(n){t({yearlyParabolicDishYield:[...n]})},sumYearlyParabolicDishYield(){let n=0;for(const o of this.yearlyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicDishLabels:[],setParabolicDishLabels(n){t({parabolicDishLabels:[...n]})},dailyParabolicTroughYield:[],setDailyParabolicTroughYield(n){t({dailyParabolicTroughYield:[...n]})},sumDailyParabolicTroughYield(){let n=0;for(const o of this.dailyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicTroughYield:[],setYearlyParabolicTroughYield(n){t({yearlyParabolicTroughYield:[...n]})},sumYearlyParabolicTroughYield(){let n=0;for(const o of this.yearlyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicTroughLabels:[],setParabolicTroughLabels(n){t({parabolicTroughLabels:[...n]})},dailyFresnelReflectorYield:[],setDailyFresnelReflectorYield(n){t({dailyFresnelReflectorYield:[...n]})},sumDailyFresnelReflectorYield(){let n=0;for(const o of this.dailyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyFresnelReflectorYield:[],setYearlyFresnelReflectorYield(n){t({yearlyFresnelReflectorYield:[...n]})},sumYearlyFresnelReflectorYield(){let n=0;for(const o of this.yearlyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},fresnelReflectorLabels:[],setFresnelReflectorLabels(n){t({fresnelReflectorLabels:[...n]})},dailyHeliostatYield:[],setDailyHeliostatYield(n){t({dailyHeliostatYield:[...n]})},sumDailyHeliostatYield(){let n=0;for(const o of this.dailyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyHeliostatYield:[],setYearlyHeliostatYield(n){t({yearlyHeliostatYield:[...n]})},sumYearlyHeliostatYield(){let n=0;for(const o of this.yearlyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},heliostatLabels:[],setHeliostatLabels(n){t({heliostatLabels:[...n]})},dailyUpdraftTowerResults:[],dailyUpdraftTowerYield:[],setDailyUpdraftTowerResults(n){t({dailyUpdraftTowerResults:[...n]})},setDailyUpdraftTowerYield(n){t({dailyUpdraftTowerYield:[...n]})},sumDailyUpdraftTowerYield(){let n=0;for(const o of this.dailyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyUpdraftTowerYield:[],setYearlyUpdraftTowerYield(n){t({yearlyUpdraftTowerYield:[...n]})},sumYearlyUpdraftTowerYield(){let n=0;for(const o of this.yearlyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},updraftTowerLabels:[],setUpdraftTowerLabels(n){t({updraftTowerLabels:[...n]})},heatmaps:new Map,setHeatmap(n,o){t(r=>(r.heatmaps.set(n,o),r))},getHeatmap(n){return e().heatmaps.get(n)},hourlyHeatExchangeArrayMap:new Map,setHourlyHeatExchangeArray(n,o){t(r=>(r.hourlyHeatExchangeArrayMap.set(n,o),r))},hourlySolarHeatGainArrayMap:new Map,setHourlySolarHeatGainArray(n,o){t(r=>(r.hourlySolarHeatGainArrayMap.set(n,o),r))},hourlySolarPanelOutputArrayMap:new Map,setHourlySolarPanelOutputArray(n,o){t(r=>(r.hourlySolarPanelOutputArrayMap.set(n,o),r))},totalBuildingHeater:0,setTotalBuildingHeater:n=>{t({totalBuildingHeater:n})},totalBuildingAc:0,setTotalBuildingAc:n=>{t({totalBuildingAc:n})},totalBuildingSolarPanel:0,setTotalBuildingSolarPanel:n=>{t({totalBuildingSolarPanel:n})},clearHeatmaps(){t(n=>(n.heatmaps.clear(),n))},clearDataStore(){t({heatmaps:new Map,hourlyHeatExchangeArrayMap:new Map,hourlySolarHeatGainArrayMap:new Map,hourlySolarPanelOutputArrayMap:new Map,solarPanelVisibilityResults:new Map,dailyLightSensorData:[],yearlyLightSensorData:[],sensorLabels:[],dailyPvYield:[],yearlyPvYield:[],solarPanelLabels:[],dailyParabolicDishYield:[],yearlyParabolicDishYield:[],parabolicDishLabels:[],dailyParabolicTroughYield:[],yearlyParabolicTroughYield:[],parabolicTroughLabels:[],dailyFresnelReflectorYield:[],yearlyFresnelReflectorYield:[],fresnelReflectorLabels:[],dailyHeliostatYield:[],yearlyHeliostatYield:[],heliostatLabels:[],dailyUpdraftTowerYield:[],dailyUpdraftTowerResults:[],yearlyUpdraftTowerYield:[],updraftTowerLabels:[]})},clearRoofVerticesMap(){t(n=>(n.roofSegmentVerticesMap.clear(),n.roofSegmentVerticesWithoutOverhangMap.clear(),n))}})),aHt="/aladdin/assets/roof_edge-DBy_1Q5D.png",Gg="/aladdin/assets/tiny_white_square-B_qAXRfa.png",lHt="/aladdin/assets/roof_01-BwuyLpwq.png",sHt="/aladdin/assets/roof_02-DAbYjnV7.png",cHt="/aladdin/assets/roof_03-haZGIixv.png",uHt="/aladdin/assets/roof_04-DDuwUcDr.png",dHt="/aladdin/assets/roof_05-CtBb5xIW.png",fHt="/aladdin/assets/roof_06-DuyyebV8.png",hHt="/aladdin/assets/roof_07-DXWGQN8a.png",pHt=new vf({color:"white",side:$i}),gHt=xe.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=Math.min(a,i,o/2),{width:s,horizontalMullionSpacing:c,verticalMullionSpacing:u,color:d}=e,f=3,p=1,m=s/2,y=g.useMemo(()=>Math.atan2(o/2,l),[o,l]),w=g.useMemo(()=>{if(l===0||o===0)return 0;const T=l/2+o**2/(8*l),R=T-l,M=Math.PI-y,D=R**2,k=T**2,N=D+k-2*D*Math.sin(M)**2-2*R*Math.sqrt((k-D*Math.sin(M)**2)*Math.cos(M)**2);return Math.sqrt(N)},[o,l,y]),x=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:d}),[d]),C=T=>new jl().moveTo(0,T).quadraticCurveTo(T,T,T,0).quadraticCurveTo(T,-T,0,-T).quadraticCurveTo(-T,-T,-T,0).quadraticCurveTo(-T,T,0,T),P=(T,R)=>{const M=T*R/(o/2),D=M/2+(R*2)**2/(8*M),k=Math.acos(Math.min(1,R/D)),N=Math.PI-k,U=new x5(0,M-D,D,D,k,N,!1,0).getPoints(24).map(W=>new ue(W.x,W.y));return new Uq(U)},A=g.useMemo(()=>{const T=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const M=o/(R+1);let D=M/2;R%2!==0&&(T.push(0),D=M);for(let k=0;k{const T=[];if(s===0)return T;const R=i/2-l,M=i-l,D=Math.ceil(M/c);let k=R;for(let N=0;N{const T=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const M=o/(R+1);let D=M/2;R%2!==0&&(D=M);for(let N=0;Nlh.jsx("group",{position:[0,0,i/2-l],rotation:[0,R,0],children:h.jsx(wa,{position:[0,0,T/2],args:[m,m,T,f,p],rotation:[$t,$t,0],receiveShadow:n,castShadow:n,children:x})});return h.jsxs("group",{name:"Window Mullion Group",position:[0,-.001,0],children:[e.horizontalMullion&&S.map((T,R)=>h.jsx(wa,{position:[0,0,T],args:[m,m,o,f,p],rotation:[0,0,$t],receiveShadow:n,castShadow:n,children:x},R)),e.verticalMullion&&(A==null?void 0:A.map((T,R)=>h.jsx(wa,{position:[T,0,-l/2],args:[m,m,i-l,f,p],rotation:[$t,$t,0],receiveShadow:n,castShadow:n,children:x},R))),l>0&&(v==null?void 0:v.map((T,R)=>{if(T===null)return null;const{shape:M,path:D}=T;return h.jsx(Q8,{position:[0,m/2,i/2-l],rotation:[$t,0,0],args:[M,{extrudePath:D,steps:12,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:x},R)})),w>0&&h.jsxs(h.Fragment,{children:[b(l,0),b(w,y),b(w,-y)]})]})}),mHt=xe.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=o/2,s=Math.min(a,i,l),{color:c,width:u,sillWidth:d}=e,f=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),p=u/2,m=p/2,y=o+u*3,w=u,x=g.useMemo(()=>{const[C,P]=[l+u,l],A=s+u,S=A/2+(C*2)**2/(8*A),v=Math.acos(Math.min(1,C/S)),b=Math.PI-v,T=A-S,R=s,M=R/2+(P*2)**2/(8*R),D=Math.acos(Math.min(1,P/M)),k=Math.PI-D,N=R-M,U=new x5(0,T,S,S,v,b,!1,0).getPoints(36),W=new x5(0,N,M,M,k,D,!0,0).getPoints(36);return new jl([...U,...W])},[a,i,o,u]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-m/2,0],children:[s>.1?h.jsx(Q8,{position:[0,m/2,i/2-s],rotation:[$t,0,0],args:[x,{depth:m,steps:1,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:f}):h.jsx(di,{position:[0,0,i/2],args:[o+2*u,m,u],castShadow:n,receiveShadow:n,children:f}),h.jsx(di,{position:[-o/2-p,0,-s/2],args:[u,m,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(di,{position:[o/2+p,0,-s/2],args:[u,m,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(di,{position:[0,0,-i/2-(d===0?0:w/2)],args:d===0?[o+2*u,m,u]:[y,d??u,w],castShadow:n,receiveShadow:n,children:f})]})}),Xde=xe.memo(({cy:t,dimension:e,wireframeData:n,drawBottom:o})=>{const[r,i,a,l]=e,{lineWidth:s,lineColor:c,selected:u,locked:d,opacity:f}=n,p=s/20,m=s/5,y=r/2,w=a/2,x=Math.min(l,a,y),C=6,P=1,A=(R,M)=>{const D=R/2+(M*2)**2/(8*R),k=Math.acos(Math.min(1,M/D)),N=Math.PI-k,U=new x5(0,R-D,D,D,k,N,!1,0).getPoints(24).map(W=>new ue(W.x,W.y));return new Uq(U)},S=R=>new jl().moveTo(0,R).quadraticCurveTo(R,R,R,0).quadraticCurveTo(R,-R,0,-R).quadraticCurveTo(-R,-R,-R,0).quadraticCurveTo(-R,R,0,R),v=g.useMemo(()=>new vf({color:c}),[c]),b=g.useMemo(()=>new vf({color:i0}),[]),T=(R,M)=>h.jsxs(h.Fragment,{children:[x>.1?h.jsx(Q8,{position:[0,0,a/2-x],rotation:[$t,0,0],args:[S(R),{extrudePath:A(x,y),steps:24,bevelEnabled:!1}],material:M}):h.jsx(wa,{args:[R,R,r,C,P],rotation:[0,0,$t],position:[0,0,w-R/2],material:M}),o&&h.jsx(wa,{args:[R,R,r,C,P],rotation:[0,0,$t],position:[0,0,-w],material:M}),h.jsx(wa,{args:[R,R,a-x,C,P],rotation:[$t,$t,0],position:[y,0,-x/2],material:M}),h.jsx(wa,{args:[R,R,a-x,C,P],rotation:[$t,$t,0],position:[-y,0,-x/2],material:M})]});return h.jsxs("group",{name:"Window Wireframe Group",children:[f>0&&h.jsx("group",{position:[0,t,0],children:T(p,v)}),d&&u&&T(m,b)]})}),yHt=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:m,foundation:y})=>{const w=H.getState().world,x=H(Y5),C=H(J3),P=H(K3),A=H(xs),S=In(PS),v=g.useRef(0),b=g.useRef(),[T,R,M,D]=e,[k,N,U]=n,W=(G,Q)=>{if(D>0){const oe=.5*T,ee=.5*M,q=Math.min(D,M,oe),ae=.5*(q+oe*oe/q);if(Math.abs(G)-ee)return!0;const Z=Q-(M-ae-ee);return G*G+Z*Z{if(!d||m||y&&y.notBuilding)return;const G=S.get(t);if(!G)return;const Q=G.reduce(($,le)=>$+le,0);if(f===0)return;const oe=X3*(w.solarRadiationHeatmapGridCellSize??.5),ee=Math.max(2,Math.round(T/oe)),q=Math.max(2,Math.round(M/oe)),ae=T/ee,Z=M/q,ne=Q/f*(x??Ny);v.current=ne<0?1:0,b.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(ne)*$t);const te=[];if(ne<0)for(let $=0;$c*T,[T,c]),L=g.useMemo(()=>M-Math.min(D,M,T/2),[T,M,D]),j=g.useMemo(()=>(E+r.width+T)/2*1.025,[T,E,r.width]),Y=g.useMemo(()=>-Math.min(D,M,T/2)/2,[M,L]),O=g.useMemo(()=>NX(T,M,D),[T,M,D]),_=(G,Q,oe)=>h.jsx(yi,{name:"Window Seal Plane",args:G,position:Q,rotation:oe,material:pHt,receiveShadow:A,castShadow:A});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Arched Window Plane Group",position:[0,N,0],children:[h.jsxs("mesh",{name:"Window Glass mesh",rotation:[$t,0,0],children:[h.jsx("shapeGeometry",{args:[O]}),u]}),(o.horizontalMullion||o.verticalMullion)&&D!==void 0&&h.jsx(gHt,{dimension:e,mullionData:o,shadowEnabled:A})]}),r.showFrame&&h.jsx(mHt,{dimension:e,frameData:r,shadowEnabled:A}),h.jsx(Xde,{cy:N,dimension:e,wireframeData:i,drawBottom:!0}),h.jsx(J3e,{cx:j,cz:Y,lx:E,lz:L,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),_([R,M],[-T/2,R/2,0],[$t,$t,0]),_([R,M],[T/2,R/2,0],[$t,-$t,0]),_([T,R],[0,R/2,-M/2]),F&&F.map((G,Q)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:G,name:"Heat Flux "+Q,lineWidth:P??Uy,color:C??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:G[v.current].clone().add(new ue(0,v.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:b.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??Fu})})]},Q))]})},NX=(t,e,n,o=0,r=0)=>{const i=new jl,a=t/2,l=e/2,s=Math.min(n,e,a);if(i.moveTo(o-a,r-l),i.lineTo(o+a,r-l),i.lineTo(o+a,r+l-s),s>.01){const c=s/2+t**2/(8*s),[u,d]=[o,r+l-c],f=Math.acos(Math.min(1,a/c)),p=Math.PI-f;i.absarc(u,d,c,f,p,!1)}else i.lineTo(o-a,r+l);return i.closePath(),i},AHt=xe.memo(yHt),wHt=1,xHt=3,vHt=new vf({color:"white",side:zr}),bHt=new cn(0,0,-$t),SHt=xe.memo(({dimension:t,polygonTop:e,frameData:n,shadowEnabled:o})=>{const[r,i,a]=t,[l,s]=e,{color:c,width:u,sillWidth:d}=n,f=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),[p,m]=[r/2,a/2],w=u/2/2,x=r+u*3,C=u,P=g.useMemo(()=>{const v=new ue(p,-m),b=new ue(p,m),T=new ue(-p,m),R=new ue(-p,-m),M=new ue(l*r,s+m);return[v,b,M,T,R]},[p,m,l,s]),A=g.useMemo(()=>{const v=[];for(let R=1;R{const v=new jl;for(let b=0;b=0;b--){const T=P[b];v.lineTo(T.x,T.y)}return v.closePath(),v},[P,A]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-w/2,0],children:[h.jsx(Q8,{position:[0,w/2,0],rotation:[$t,0,0],args:[S,{steps:1,depth:w,bevelEnabled:!1}],children:f}),h.jsx(di,{position:[0,0,-a/2-(d===0?0:C/2)],args:d===0?[r+2*u,w,u]:[x,d??u,C],castShadow:o,receiveShadow:o,children:f})]})}),THt=({id:t,dimension:e,polygonTop:n,position:o,glassMaterial:r,empty:i,interior:a,wireframeData:l,frameData:s,leftShutter:c,rightShutter:u,shutterColor:d,shutterWidth:f,area:p,showHeatFluxes:m,foundation:y})=>{const w=H.getState().world,x=H(Y5),C=H(J3),P=H(K3),A=In(PS),S=g.useRef(0),v=g.useRef(),[b,T,R]=o,[M,D,k]=e,[N,U,W]=e.map(pe=>pe/2),[F,E]=n,{lineWidth:L,lineColor:j,selected:Y,locked:O,opacity:_}=l,G=F*M,Q=Math.hypot(E,N-G),oe=Math.asin(E/Q),ee=Math.hypot(E,N+G),q=-Math.asin(E/ee),ae=H(xs),Z=(pe,Ie)=>{const ve=.5*M,ze=.5*(k+n[1]),Ae=n[1],se=[{x:-ve,y:-ze},{x:ve,y:-ze},{x:ve,y:ze-Ae},{x:M*n[0],y:ze},{x:-ve,y:ze-Ae}];return ye.isPointInside(pe,Ie,se)},ne=g.useMemo(()=>{if(!m||a||y&&y.notBuilding)return;const pe=A.get(t);if(!pe)return;const Ie=pe.reduce((Te,Re)=>Te+Re,0);if(p===0)return;const ve=X3*(w.solarRadiationHeatmapGridCellSize??.5),ze=k+n[1],Ae=Math.max(2,Math.round(M/ve)),se=Math.max(2,Math.round(ze/ve)),ge=M/Ae,we=ze/se,Se=Ie/p*(x??Ny);S.current=Se<0?1:0,v.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(Se)*$t);const Me=[],Ce=n[1]/2;if(Se<0)for(let Te=0;Tef*M,[M,f]),$=g.useMemo(()=>(te+s.width+M)/2*1.025,[M,te,s.width]),le=g.useMemo(()=>{const[pe,Ie]=[M/2,k/2],ve=F*M;return UX(pe,Ie,ve,E)},[M,k,F,E]),de=g.useMemo(()=>Y&&O?new vf({color:i0}):new vf({color:j}),[j,Y,O]),he=g.useMemo(()=>O&&Y?L/5:L/20,[L,Y,O]),me=g.useMemo(()=>O&&Y?-D/2:-T,[T,D,Y,O]),ce=(pe,Ie=0)=>h.jsx(wa,{args:[he,he,pe,xHt,wHt],position:[Ie,me,0],rotation:[0,0,$t],material:de}),Pe=(pe,Ie=0)=>h.jsx(yi,{args:[pe,D],position:[Ie,0,0],material:vHt,receiveShadow:ae,castShadow:ae});return h.jsxs(h.Fragment,{children:[!i&&h.jsxs("mesh",{name:"Triangle Glass Plane",position:[0,T,0],rotation:[$t,0,0],children:[h.jsx("shapeGeometry",{args:[le]}),r]}),s.showFrame&&h.jsx(SHt,{dimension:e,polygonTop:n,frameData:s,shadowEnabled:ae}),h.jsx(J3e,{cx:$,lx:te,lz:k,color:d,showLeft:c,showRight:u,spacing:s.showFrame?s.width/2:0}),h.jsxs("group",{position:[0,U,-W+.001],children:[Pe(M),ce(M)]}),h.jsxs("group",{position:[-N+.001,U,0],rotation:[0,$t,0],children:[Pe(k),ce(k)]}),h.jsxs("group",{position:[N-.001,U,0],rotation:[0,-$t,0],children:[Pe(k),ce(k)]}),h.jsxs("group",{position:[-N+.001,U,W-.01],rotation:[0,q,0],children:[Pe(ee,ee/2),ce(ee,ee/2)]}),h.jsxs("group",{position:[N-.001,U,W-.01],rotation:[0,oe,0],children:[Pe(Q,-Q/2),ce(Q,-Q/2)]}),ne&&ne.map((pe,Ie)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:pe,name:"Heat Flux "+Ie,lineWidth:P??Uy,color:C??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:pe[S.current].clone().add(new ue(0,S.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:v.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??Fu})})]},Ie))]})},UX=(t,e,n,o,r=0,i=0)=>{const a=new jl;return a.moveTo(r-t,i-e),a.lineTo(r+t,i-e),a.lineTo(r+t,i+e),a.lineTo(r+n,i+e+o),a.lineTo(r-t,i+e),a.closePath(),a},PHt=xe.memo(THt),CHt=({id:t,index:e,foundationModel:n,roofType:o,segment:r,centroid:i,thickness:a,color:l,sideColor:s,texture:c,heatmap:u,windows:d})=>{const f=H($3),p=dt(n6),m=H(Y5),y=H(J3),w=H(K3),x=In(UN),{transparent:C,opacity:P}=pI(),A=g.useRef(0),S=g.useRef(),v=g.useRef(),b=H.getState().world,T=In.getState().hourlyHeatExchangeArrayMap,{points:R}=r,M=g.useMemo(()=>{if(!p)return;const k=x(t);if(!k)return;const N=[],U=new ue(0,0,a+.1);switch(o){case Zo.Hip:case Zo.Pyramid:for(const W of k){const F=[];F.push(W[0].clone().sub(i).add(U)),F.push(W[1].clone().sub(i).add(U)),N.push(F)}break;case Zo.Mansard:for(const[W,F]of k.entries()){if(W===k.length-1)continue;const E=[];E.push(F[0].clone().sub(i).add(U)),E.push(F[1].clone().sub(i).add(U)),N.push(E)}break;case Zo.Gambrel:for(const[W,F]of k.entries()){if(W===0||W===3){const L=[];L.push(F[0].clone().sub(i).add(U)),L.push(F[1].clone().sub(i).add(U)),N.push(L)}let E=[];E.push(F[0].clone().sub(i).add(U)),E.push(F[3].clone().sub(i).add(U)),N.push(E),E=[],E.push(F[1].clone().sub(i).add(U)),E.push(F[2].clone().sub(i).add(U)),N.push(E)}break}return N},[p]),D=g.useMemo(()=>{if(!p||n&&n.notBuilding)return;const k=T.get(t+"-"+e);if(!k)return;const N=k.reduce((ge,we)=>ge+we,0),U=x(t);if(!U||!U[e])return;const[W,F,E,L,j]=R,Y=j.z-W.z,O=U[e].map(ge=>ge.clone().sub(i).add(new ue(0,0,Y)));if(!O)return;const _=[];for(const ge of O)_.push({x:ge.x,y:ge.y});const G=X3*(b.solarRadiationHeatmapGridCellSize??.5),Q=O[0].clone(),oe=O[1].clone(),ee=O[2].clone(),q=new ue().subVectors(oe,Q),ae=new ue().subVectors(ee,Q),Z=new ue().subVectors(ee,oe),ne=q.length(),te=new ue().crossVectors(ae,Z).length()/ne,$=Math.max(2,Math.floor(ne/G)),le=Math.max(2,Math.floor(te/G));q.normalize(),ae.normalize(),Z.normalize();const de=new ue().crossVectors(ae,Z).normalize(),he=q.multiplyScalar(.5*ne/$),me=new ue().crossVectors(de,q).normalize().multiplyScalar(.5*te/le),ce=Q.clone().add(he).add(me);he.multiplyScalar(2),me.multiplyScalar(2),S.current=de.clone().multiplyScalar(.1);const Pe=[],pe=new ue;let Ie=O.length===4?ye.getTriangleArea(O[0],O[1],O[2])+ye.getTriangleArea(O[2],O[3],O[0]):ye.getTriangleArea(O[0],O[1],O[2]);if(Ie===0)return;let ve=f(z.Window,t);const ze=x(t);if(ze&&ze[e]&&(ve=ve.filter(ge=>{const we=ge,Se=we.cy+(we.windowType===Ti.Polygonal&&we.polygonTop?we.polygonTop[1]/2:0);return Rn.onSegment(ze[e],ge.cx,Se)})),ve&&ve.length>0)for(const ge of ve)Ie-=ye.getWindowArea(ge);const Ae=N/Ie*(m??Ny);A.current=Ae<0?1:0,v.current=ye.getEuler(Oo,de,"YXZ",-Math.sign(Ae)*$t);let se;for(let ge=0;ge<$;ge++){const we=he.clone().multiplyScalar(ge);for(let Se=0;Se0){const Me=pe.x+i.x,Ce=pe.y+i.y;for(const Te of ve){const Re=Rn.getRelativeWindowVerticesOnRoof(Te),Ne=ye.getPoints(Re);if(ye.isPointInside(Me,Ce,Ne)){se=!1;break}}}if(se&&ye.isPointInside(pe.x,pe.y,_)){const Me=[];Ae<0?(Me.push(pe.clone()),Me.push(pe.clone().add(de.clone().multiplyScalar(-Ae)))):(Me.push(pe.clone()),Me.push(pe.clone().add(de.clone().multiplyScalar(Ae)))),Pe.push(Me)}}}return Pe},[p,m]);return h.jsxs(h.Fragment,{children:[h.jsx(DJe,{id:t,index:e,segment:r,color:l,sideColor:s,texture:c,heatmap:u,transparent:C,opacity:P,windows:d,centroid:i}),M&&M.map((k,N)=>h.jsx(On,{points:k,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+N},N)),D&&D.map((k,N)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:k,name:"Heat Flux "+N,lineWidth:w??Uy,color:y??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:S.current?k[A.current].clone().add(S.current):k[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head "+N,rotation:v.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:y??Fu})})]},N))]})},DJe=xe.memo(({id:t,index:e,segment:n,color:o,sideColor:r,texture:i,heatmap:a,transparent:l,opacity:s,windows:c,centroid:u})=>{const d=dt(vs),f=g.useRef(null),{points:p}=n,m=d?a:i,y=p.length===6,w=p.length===8,x=g.useMemo(()=>c.map(R=>{const M=new ue(R.lx,R.lz,R.ly*2),D=new ue(R.cx,R.cy,R.cz).sub(u),k=new cn().fromArray([R.rotation[0],R.rotation[1],R.rotation[2],"ZXY"]);if(R.windowType===Ti.Polygonal){const[N,U]=R.polygonTop??P1,[W,F,E]=[M.x/2,M.y/2,N*M.x],L=UX(W,F,E,U),j=new os(new C3([L],{steps:1,depth:M.z,bevelEnabled:!1})),Y=new ue(0,0,-M.z).applyEuler(k);return j.position.copy(D.clone().add(Y)),j.rotation.copy(k),j.updateMatrix(),j}else if(R.windowType===Ti.Arched){const N=NX(M.x,M.y,R.archHeight),U=new os(new C3([N],{steps:1,depth:M.z,bevelEnabled:!1})),W=new ue(0,0,-M.z).applyEuler(k);return U.position.copy(D.clone().add(W)),U.rotation.copy(k),U.updateMatrix(),U}else{const N=new os(new V3(M.x,M.y,M.z));return N.position.copy(D),N.rotation.copy(k),N.updateMatrix(),N}}),[c,u]),C=A()??6,P=g.useMemo(()=>Array(C).fill(0),[C]);if(g.useEffect(()=>{A()},[]),!y&&!w)return null;function A(){if(!f.current||!y&&!w)return;const R=f.current.geometry;R.index=null,R.clearGroups();const M=[],D=[];let k=0,N=0;if(y){const j=p.slice(p.length/2);U(j),d?F():W(j),E(3);const Y=p.slice(0,p.length/2).reverse();U(Y),D.push(0,0,1,0,0,1),E(3),L([[0,1,4,3],[1,2,5,4],[2,0,3,5]])}else if(w){const j=p.slice(p.length/2),[Y,O]=S(j);U(Y),U(O);const[_,G,Q,oe]=j,ee=Y[2].equals(oe);if(d)F(ee);else{const ne=new ue().subVectors(G,_),te=new ue().subVectors(Q,_),$=new ue().subVectors(oe,_),de=new _t(G.x-_.x,G.y-_.y).length(),he=de,me=0,ce=ne.dot(te)/de,Pe=ne.clone().cross(te).length()/de,pe=ne.dot($)/de,Ie=ne.clone().cross($).length()/de;ee?(D.push(0,0,he,me,pe,Ie),D.push(he,me,ce,Pe,pe,Ie)):(D.push(0,0,he,me,ce,Pe),D.push(0,0,ce,Pe,pe,Ie))}E(6);const q=p.slice(0,p.length/2),[ae,Z]=S(q);U(ae.reverse()),U(Z.reverse()),D.push(0,0,1,0,0,1),D.push(0,1,1,0,1,1),E(6),L([[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7]])}else throw new Error("segment is neither quad nor tri");if(R.setAttribute("position",new Ar(M,3)),R.setAttribute("uv",new Ar(D,2)),R.computeVertexNormals(),R.computeBoundingSphere(),c.length>0){const j=[];for(let O=0;Oq.concat(p[ae].x,p[ae].y,p[ae].z),[]),ee=[Q,_,G].reduce((q,ae)=>q.concat(p[ae].x,p[ae].y,p[ae].z),[]);M.push(...oe),M.push(...ee),D.push(0,0,1,0,0,1),D.push(0,1,1,0,1,1),E(6)}}}function S(R){const[M,D,k,N]=R,U=ye.distanceFromPointToLine2D(N,M,D),W=ye.distanceFromPointToLine2D(k,M,D),F=[],E=[];return Math.abs(U-W)<.01?M.z>D.z?(F.push(M,D,k),E.push(M,k,N)):(F.push(M,D,N),E.push(D,k,N)):U<=W?(F.push(M,D,N),E.push(D,k,N)):(F.push(M,D,k),E.push(M,k,N)),[F,E]}const v=({i:R})=>h.jsx("meshBasicMaterial",{attach:`material-${R}`,map:m,transparent:l,opacity:s}),b=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:o,map:m,transparent:l,opacity:s}),T=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:r,transparent:l,opacity:s});return h.jsx("mesh",{ref:f,name:`Buffer Roof Segment ${e}`,uuid:t+"-"+e,userData:{simulation:!0},receiveShadow:!d,castShadow:!0,frustumCulled:!1,children:P.map((R,M)=>M!==0?h.jsx(T,{i:M},"side"+M):d?h.jsx(v,{i:M},"heatmap"+M):h.jsx(b,{i:M},"texture"+M))})}),IQ=xe.memo(CHt),RHt=({cz:t,points:e})=>{const n=new jl;n.moveTo(e[0].x,e[0].y);for(const{x:o,y:r}of e)n.lineTo(o,r);return n.closePath(),h.jsx(Q8,{scale:.99,position:[0,0,t],args:[n,{steps:1,depth:.1,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{side:zr,color:"white"})})},tU=xe.memo(RHt);function Qy(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;o{const t=new os(new T7(1,1),Y2e);return SVe=()=>t,t},TVe=()=>{const t=new os(new T7(1,1,32,1),Y2e);return TVe=()=>t,t};const Fbt={type:"syncstart"},Lbt={type:"synccomplete"},PVe=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Wbt=PVe.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let CVe=class extends os{constructor(){const e=new Hbt;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Tbe,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=ele,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(Fbt),xVe({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},n=>{this._isSyncing=!1,this._textRenderInfo=n,this.geometry.updateGlyphs(n.glyphBounds,n.glyphAtlasIndices,n.blockBounds,n.chunkedBounds,n.glyphColors);const o=this._queuedSyncs;o&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{o.forEach(r=>r&&r())})),this.dispatchEvent(Lbt),e&&e()})))}onBeforeRender(e,n,o,r,i,a){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i),i._hadOwnSide=i.hasOwnProperty("side"),this.geometry.setSide(i._actualSide=i.side),i.side=$i}onAfterRender(e,n,o,r,i,a){i._hadOwnSide?i.side=i._actualSide:delete i.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Y2e.clone());if((!e||e.baseMaterial!==n)&&(e=this._derivedMaterial=Ebt(n),n.addEventListener("dispose",function o(){n.removeEventListener("dispose",o),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let o=e._outlineMtl;return o||(o=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),o.isTextOutlineMaterial=!0,o.depthWrite=!1,o.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),o.dispose()})),[o,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return Cbe(this.material).getDepthMaterial()}get customDistanceMaterial(){return Cbe(this.material).getDistanceMaterial()}_prepareForRender(e){const n=e.isTextOutlineMaterial,o=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:l,blockBounds:s}=r;o.uTroikaSDFTexture.value=l,o.uTroikaSDFTextureSize.value.set(l.image.width,l.image.height),o.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,o.uTroikaSDFExponent.value=r.sdfExponent,o.uTroikaTotalBounds.value.fromArray(s),o.uTroikaUseGlyphColors.value=!n&&!!r.glyphColors;let c=0,u=0,d=0,f,p,m,y=0,w=0;if(n){let{outlineWidth:C,outlineOffsetX:P,outlineOffsetY:A,outlineBlur:S,outlineOpacity:v}=this;c=this._parsePercent(C)||0,u=Math.max(0,this._parsePercent(S)||0),f=v,y=this._parsePercent(P)||0,w=this._parsePercent(A)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(m=this.strokeColor,o.uTroikaStrokeColor.value.set(m??Tbe),p=this.strokeOpacity,p==null&&(p=1)),f=this.fillOpacity;o.uTroikaDistanceOffset.value=c,o.uTroikaPositionOffset.value.set(y,w),o.uTroikaBlurRadius.value=u,o.uTroikaStrokeWidth.value=d,o.uTroikaStrokeOpacity.value=p,o.uTroikaFillOpacity.value=f??1,o.uTroikaCurveRadius.value=this.curveRadius||0;let x=this.clipRect;if(x&&Array.isArray(x)&&x.length===4)o.uTroikaClipRect.value.fromArray(x);else{const C=(this.fontSize||.1)*100;o.uTroikaClipRect.value.set(s[0]-C,s[1]-C,s[2]+C,s[3]+C)}this.geometry.applyClipRect(o.uTroikaClipRect.value)}o.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const i=n?this.outlineColor||0:this.color;if(i==null)delete e.color;else{const l=e.hasOwnProperty("color")?e.color:e.color=new ir;(i!==l._input||typeof i=="object")&&l.set(l._input=i)}let a=this.orientation||ele;if(a!==e._orientation){let l=o.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let s=a!==ele&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(s){let[,c,u,d,f]=s;HO.set(0,0,0)[u]=c==="-"?1:-1,Zae.set(0,0,0)[f]=d==="-"?-1:1,Pbe.lookAt(kbt,HO.cross(Zae),Zae),l.setFromMatrix4(Pbe)}else l.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let n=e.match(/^(-?[\d.]+)%$/),o=n?parseFloat(n[1]):NaN;e=(isNaN(o)?0:o/100)*this.fontSize}return e}localPositionToTextCoords(e,n=new _t){n.copy(e);const o=this.curveRadius;return o&&(n.x=Math.atan2(e.x,Math.abs(o)-Math.abs(e.z))*Math.abs(o)),n}worldPositionToTextCoords(e,n=new _t){return HO.copy(e),this.localPositionToTextCoords(this.worldToLocal(HO),n)}raycast(e,n){const{textRenderInfo:o,curveRadius:r}=this;if(o){const i=o.blockBounds,a=r?TVe():SVe(),l=a.geometry,{position:s,uv:c}=l.attributes;for(let u=0;u{this[o]=e[o]}),this}clone(){return new this.constructor().copy(this)}};PVe.forEach(t=>{const e="_private_"+t;Object.defineProperty(CVe.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});const Nbt=g.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:o,fontSize:r=1,children:i,characters:a,onSync:l,...s},c)=>{const u=ti(({invalidate:m})=>m),[d]=g.useState(()=>new CVe),[f,p]=g.useMemo(()=>{const m=[];let y="";return g.Children.forEach(i,w=>{typeof w=="string"||typeof w=="number"?y+=w:m.push(w)}),[m,y]},[i]);return j_e(()=>new Promise(m=>xbt({font:o,characters:a},m)),["troika-text",o,a]),g.useLayoutEffect(()=>void d.sync(()=>{u(),l&&l(d)})),g.useEffect(()=>()=>d.dispose(),[d]),g.createElement("primitive",H3({object:d,ref:c,font:o,text:p,anchorX:e,anchorY:n,fontSize:r,sdfGlyphSize:t},s),f)}),Rbe=t=>t===Object(t)&&!Array.isArray(t)&&typeof t!="function";function Up(t,e){const n=ti(r=>r.gl),o=B5(Qg,Rbe(t)?Object.values(t):t);if(g.useLayoutEffect(()=>{e==null||e(o)},[e]),g.useEffect(()=>{"initTexture"in n&&(Array.isArray(o)?o:[o]).forEach(n.initTexture)},[n,o]),Rbe(t)){const r=Object.keys(t),i={};return r.forEach(a=>Object.assign(i,{[a]:o[r.indexOf(a)]})),i}else return o}Up.preload=t=>B5.preload(Qg,t);Up.clear=t=>B5.clear(Qg,t);function RVe(t,e,n){const o=ti(f=>f.size),r=ti(f=>f.viewport),i=typeof t=="number"?t:o.width*r.dpr,a=o.height*r.dpr,l=(typeof t=="number"?n:t)||{},{samples:s=0,depth:c,...u}=l,d=g.useMemo(()=>{const f=new ku(i,a,{minFilter:cs,magFilter:cs,type:G8,...u});return c&&(f.depthTexture=new Eq(i,a,vy)),f.samples=s,f},[]);return g.useLayoutEffect(()=>{d.setSize(i,a),s&&(d.samples=s)},[s,d,i,a]),g.useEffect(()=>()=>d.dispose(),[]),d}const Ubt=t=>typeof t=="function",jbt=g.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,children:o,makeDefault:r,...i},a)=>{const l=ti(({set:w})=>w),s=ti(({camera:w})=>w),c=ti(({size:w})=>w),u=g.useRef(null),d=g.useRef(null),f=RVe(e);g.useLayoutEffect(()=>{i.manual||u.current.updateProjectionMatrix()},[c,i]),g.useLayoutEffect(()=>{u.current.updateProjectionMatrix()}),g.useLayoutEffect(()=>{if(r){const w=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:w}))}},[u,r,l]);let p=0,m=null;const y=Ubt(o);return Gp(w=>{y&&(n===1/0||ptypeof t=="function",Ybt=g.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,makeDefault:o,children:r,...i},a)=>{const l=ti(({set:w})=>w),s=ti(({camera:w})=>w),c=ti(({size:w})=>w),u=g.useRef(null),d=g.useRef(null),f=RVe(e);g.useLayoutEffect(()=>{i.manual||(u.current.aspect=c.width/c.height)},[c,i]),g.useLayoutEffect(()=>{u.current.updateProjectionMatrix()});let p=0,m=null;const y=Bbt(r);return Gp(w=>{y&&(n===1/0||p{if(o){const w=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:w}))}},[u,o,l]),g.createElement(g.Fragment,null,g.createElement("perspectiveCamera",H3({ref:U2e([u,a])},i),!y&&r),g.createElement("group",{ref:d},y&&r(f.texture)))});function f4(t,e){const n=t+"Geometry";return g.forwardRef(({args:o,children:r,...i},a)=>{const l=g.useRef(null);return g.useImperativeHandle(a,()=>l.current),g.useLayoutEffect(()=>void(e==null?void 0:e(l.current))),g.createElement("mesh",H3({ref:l},i),g.createElement(n,{attach:"geometry",args:o}),r)})}const di=f4("box"),fH=f4("circle"),Rf=f4("cone"),wa=f4("cylinder"),Ys=f4("sphere"),yi=f4("plane"),O2e=f4("torus"),FX=f4("ring"),Q8=f4("extrude"),E9=1e-5;function Obt(t,e,n){const o=new jl,r=n-E9;return o.absarc(E9,E9,E9,-Math.PI/2,-Math.PI,!0),o.absarc(E9,e-r*2,E9,Math.PI,Math.PI/2,!0),o.absarc(t-r*2,e-r*2,E9,Math.PI/2,0,!0),o.absarc(t-r*2,E9,E9,0,-Math.PI/2,!0),o}const _bt=g.forwardRef(function({args:[e=1,n=1,o=1]=[],radius:r=.05,steps:i=1,smoothness:a=4,bevelSegments:l=4,creaseAngle:s=.4,children:c,...u},d){const f=g.useMemo(()=>Obt(e,n,r),[e,n,r]),p=g.useMemo(()=>({depth:o-r*2,bevelEnabled:!0,bevelSegments:l*2,steps:i,bevelSize:r-E9,bevelThickness:r,curveSegments:a}),[o,r,a]),m=g.useRef(null);return g.useLayoutEffect(()=>{m.current&&(m.current.center(),Bvt(m.current,s))},[f,p]),g.createElement("mesh",H3({ref:d},u),g.createElement("extrudeGeometry",{ref:m,args:[f,p]}),c)});var HVe={exports:{}},Vbt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Gbt=Vbt,Xbt=Gbt;function MVe(){}function IVe(){}IVe.resetWarningCache=MVe;var Jbt=function(){function t(o,r,i,a,l,s){if(s!==Xbt){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:IVe,resetWarningCache:MVe};return n.PropTypes=n,n};HVe.exports=Jbt();var rQ=HVe.exports;const Ao=ji(rQ),jn=pq()((t,e)=>({setEnableOrbitController:n=>{H.getState().viewState.navigationView||t(o=>{var r;return(r=o.orbitControlsRef)!=null&&r.current&&(o.orbitControlsRef.current.enabled=n),o})},selectNone:()=>{t({humanRef:null,treeRef:null,foundationRef:null})},contentRef:null,compassRef:null,orbitControlsRef:null,humanRef:null,treeRef:null,flowerRef:null,foundationRef:null,cuboidRef:null,listenToAutoDeletionByCutRef:null,listenToAutoDeletionByDeleteRef:null,setListenToAutoDeletionByCut:n=>{const o=e().listenToAutoDeletionByCutRef;o&&(o.current=n)},setListenToAutoDeletionByDelete:n=>{const o=e().listenToAutoDeletionByDeleteRef;o&&(o.current=n)},canvas:null,pointer:new _t,solarPanelCountRef:null}));var Ti=(t=>(t.Default="Default",t.Arched="Arched",t.Circular="Circular",t.Polygonal="Polygonal",t))(Ti||{});const zVe="/aladdin/assets/jaah-XpG2K-Xo.png",DVe="/aladdin/assets/jack-DVed1dhl.png",EVe="/aladdin/assets/jacob-D-6uVZRV.png",kVe="/aladdin/assets/jacqueline-DZtJs4FX.png",FVe="/aladdin/assets/jade-Cxa-afE4.png",LVe="/aladdin/assets/jamelia-Bmq4EsGl.png",WVe="/aladdin/assets/james-QtBSrtsa.png",NVe="/aladdin/assets/jane-ZqCTWK8F.png",UVe="/aladdin/assets/jaya-DD0RNxX8.png",jVe="/aladdin/assets/jaye-DPA2kSta.png",BVe="/aladdin/assets/jeanette-D3EEzZKV.png",YVe="/aladdin/assets/jedi-CUm23-QH.png",OVe="/aladdin/assets/jeff-931UF5LC.png",_Ve="/aladdin/assets/jena-qnIKFCdf.png",VVe="/aladdin/assets/jennifer-Cvadr5-Q.png",GVe="/aladdin/assets/jess-DyGUx_b1.png",XVe="/aladdin/assets/jett-B01M7z86.png",JVe="/aladdin/assets/jill-CxIC2A4v.png",KVe="/aladdin/assets/jiya-CF0SpO2m.png",$Ve="/aladdin/assets/joan-DWpjHIrM.png",qVe="/aladdin/assets/jocelyn-DGLHmbKA.png",QVe="/aladdin/assets/joel-DhW3d8dZ.png",ZVe="/aladdin/assets/joey-Dmd3kcA2.png",eGe="/aladdin/assets/john-QF2zQU-p.png",tGe="/aladdin/assets/jonathon-TM1sY2jf.png",nGe="/aladdin/assets/jose-CtYKGQoQ.png",oGe="/aladdin/assets/joseph-C7wga7kl.png",rGe="/aladdin/assets/joshua-CqTzsm-K.png",iGe="/aladdin/assets/judd-C8GabaWl.png",aGe="/aladdin/assets/judy-Cv4UEjOl.png",lGe="/aladdin/assets/julia-Ckjw2r2H.png",sGe="/aladdin/assets/julio-CPCcOGMU.png",cGe="/aladdin/assets/jumapili-TjSAWyhv.png",uGe="/aladdin/assets/june-Bkxc2WDe.png",dGe="/aladdin/assets/juro-BAi3R6Hw.png",fGe="/aladdin/assets/justin-DLG1o6Q7.png";class hh{static fetchGender(e){switch(e){case Vt.Jaah:return Fa.Male;case Vt.Jacqueline:return Fa.Female;case Vt.Jade:return Fa.Female;case Vt.Jamelia:return Fa.Female;case Vt.James:return Fa.Male;case Vt.Jane:return Fa.Female;case Vt.Jaya:return Fa.Female;case Vt.Jaye:return Fa.Male;case Vt.Jeanette:return Fa.Female;case Vt.Jedi:return Fa.Male;case Vt.Jeff:return Fa.Male;case Vt.Jena:return Fa.Female;case Vt.Jennifer:return Fa.Female;case Vt.Jess:return Fa.Female;case Vt.Jett:return Fa.Male;case Vt.Jill:return Fa.Female;case Vt.Jiya:return Fa.Female;case Vt.Joan:return Fa.Female;case Vt.Jocelyn:return Fa.Female;case Vt.Joel:return Fa.Male;case Vt.Joey:return Fa.Female;case Vt.John:return Fa.Male;case Vt.Jonathon:return Fa.Male;case Vt.Jose:return Fa.Male;case Vt.Joseph:return Fa.Male;case Vt.Joshua:return Fa.Male;case Vt.Judd:return Fa.Male;case Vt.Judy:return Fa.Female;case Vt.Julia:return Fa.Female;case Vt.Julio:return Fa.Male;case Vt.Jumapili:return Fa.Female;case Vt.June:return Fa.Female;case Vt.Juro:return Fa.Male;case Vt.Justin:return Fa.Male;default:return Fa.Male}}static fetchLabel(e,n){switch(e){case Vt.Jaah:return B.t("people.Jaah",n);case Vt.Jacob:return B.t("people.Jacob",n);case Vt.Jacqueline:return B.t("people.Jacqueline",n);case Vt.Jade:return B.t("people.Jade",n);case Vt.Jamelia:return B.t("people.Jamelia",n);case Vt.James:return B.t("people.James",n);case Vt.Jane:return B.t("people.Jane",n);case Vt.Jaya:return B.t("people.Jaya",n);case Vt.Jaye:return B.t("people.Jaye",n);case Vt.Jeanette:return B.t("people.Jeanette",n);case Vt.Jedi:return B.t("people.Jedi",n);case Vt.Jeff:return B.t("people.Jeff",n);case Vt.Jena:return B.t("people.Jena",n);case Vt.Jennifer:return B.t("people.Jennifer",n);case Vt.Jess:return B.t("people.Jess",n);case Vt.Jett:return B.t("people.Jett",n);case Vt.Jill:return B.t("people.Jill",n);case Vt.Jiya:return B.t("people.Jiya",n);case Vt.Joan:return B.t("people.Joan",n);case Vt.Jocelyn:return B.t("people.Jocelyn",n);case Vt.Joel:return B.t("people.Joel",n);case Vt.Joey:return B.t("people.Joey",n);case Vt.John:return B.t("people.John",n);case Vt.Jonathon:return B.t("people.Jonathon",n);case Vt.Jose:return B.t("people.Jose",n);case Vt.Joseph:return B.t("people.Joseph",n);case Vt.Joshua:return B.t("people.Joshua",n);case Vt.Judd:return B.t("people.Judd",n);case Vt.Judy:return B.t("people.Judy",n);case Vt.Julia:return B.t("people.Julia",n);case Vt.Julio:return B.t("people.Julio",n);case Vt.Jumapili:return B.t("people.Jumapili",n);case Vt.June:return B.t("people.June",n);case Vt.Juro:return B.t("people.Juro",n);case Vt.Justin:return B.t("people.Justin",n);default:return B.t("people.Jack",n)}}static fetchHatOffsetY(e){switch(e){case Vt.Jonathon:return-.22}return 0}static fetchHatOffsetX(e){switch(e){case Vt.Jaah:return-.05;case Vt.Jack:return-.05;case Vt.Jacob:return .09;case Vt.Jade:return-.04;case Vt.Jaya:return .04;case Vt.Jaye:return 0;case Vt.Jamelia:return .05;case Vt.Jane:return .02;case Vt.Jeanette:return .08;case Vt.Jedi:return-.02;case Vt.Jeff:return-.05;case Vt.Jena:return .05;case Vt.Jennifer:return .02;case Vt.Jess:return .01;case Vt.Jett:return-.04;case Vt.Jill:return-.03;case Vt.Jiya:return-.03;case Vt.Joan:return-.45;case Vt.Jocelyn:return-.01;case Vt.Joel:return-.48;case Vt.Joey:return .01;case Vt.John:return .01;case Vt.Jonathon:return .02;case Vt.Jose:return .05;case Vt.Joseph:return .05;case Vt.Joshua:return-.01;case Vt.Judy:return .02;case Vt.Julia:return-.02;case Vt.Jumapili:return-.04;case Vt.June:return-.1;case Vt.Juro:return-.08;case Vt.Justin:return-.06;default:return 0}}static fetchHeight(e){switch(e){case Vt.Jaah:return 1.78;case Vt.Jack:return 1.8;case Vt.Jacob:return 1.82;case Vt.Jacqueline:return 1.78;case Vt.Jade:return 1.6;case Vt.James:return 1.75;case Vt.Jane:return 1.67;case Vt.Jaya:return 1.55;case Vt.Jaye:return 1.65;case Vt.Jamelia:return 1.8;case Vt.Jeanette:return 1.62;case Vt.Jedi:return 1.75;case Vt.Jeff:return 1.65;case Vt.Jena:return 1.6;case Vt.Jennifer:return 1.7;case Vt.Jess:return 1.5;case Vt.Jett:return 1.85;case Vt.Jill:return 1.71;case Vt.Jiya:return 1.74;case Vt.Joan:return 1.68;case Vt.Jocelyn:return 1.72;case Vt.Joel:return 1.75;case Vt.Joey:return 1.72;case Vt.John:return 1.85;case Vt.Jonathon:return 1.9;case Vt.Jose:return 1.6;case Vt.Joseph:return 1.88;case Vt.Joshua:return 1.79;case Vt.Judd:return 1.68;case Vt.Judy:return 1.75;case Vt.Julia:return 1.71;case Vt.Julio:return 1.76;case Vt.Jumapili:return 1.65;case Vt.June:return 1.85;case Vt.Juro:return 1.72;case Vt.Justin:return 1.755;default:return 1.8}}static fetchWidth(e){switch(e){case Vt.Jaah:return .74;case Vt.Jack:return .42;case Vt.Jacqueline:return .43;case Vt.Jacob:return .8;case Vt.Jade:return .48;case Vt.James:return .472;case Vt.Jane:return .4;case Vt.Jaya:return .6;case Vt.Jaye:return .55;case Vt.Jamelia:return .65;case Vt.Jeanette:return .4;case Vt.Jedi:return .56;case Vt.Jena:return .695;case Vt.Jennifer:return .45;case Vt.Jess:return .43;case Vt.Jill:return .42;case Vt.Joan:return 1.7;case Vt.Jocelyn:return .4;case Vt.Joel:return 1.8;case Vt.Joey:return .462;case Vt.John:return .6;case Vt.Jonathon:return .6;case Vt.Jose:return 2;case Vt.Joseph:return .6;case Vt.Joshua:return .5;case Vt.Judd:return .544;case Vt.Judy:return .41;case Vt.Julia:return .43;case Vt.Julio:return .5;case Vt.Jumapili:return .75;case Vt.June:return .65;case Vt.Juro:return .494;case Vt.Justin:return .6;default:return .6}}static fetchTextureImage(e){let n;switch(e){case Vt.Jaah:n=zVe;break;case Vt.Jacob:n=EVe;break;case Vt.Jacqueline:n=kVe;break;case Vt.Jade:n=FVe;break;case Vt.Jamelia:n=LVe;break;case Vt.James:n=WVe;break;case Vt.Jane:n=NVe;break;case Vt.Jaya:n=UVe;break;case Vt.Jaye:n=jVe;break;case Vt.Jeanette:n=BVe;break;case Vt.Jedi:n=YVe;break;case Vt.Jeff:n=OVe;break;case Vt.Jena:n=_Ve;break;case Vt.Jennifer:n=VVe;break;case Vt.Jess:n=GVe;break;case Vt.Jett:n=XVe;break;case Vt.Jill:n=JVe;break;case Vt.Jiya:n=KVe;break;case Vt.Joan:n=$Ve;break;case Vt.Jocelyn:n=qVe;break;case Vt.Joel:n=QVe;break;case Vt.Joey:n=ZVe;break;case Vt.John:n=eGe;break;case Vt.Jonathon:n=tGe;break;case Vt.Jose:n=nGe;break;case Vt.Joseph:n=oGe;break;case Vt.Joshua:n=rGe;break;case Vt.Judd:n=iGe;break;case Vt.Judy:n=aGe;break;case Vt.Julia:n=lGe;break;case Vt.Julio:n=sGe;break;case Vt.Jumapili:n=cGe;break;case Vt.June:n=uGe;break;case Vt.Juro:n=dGe;break;case Vt.Justin:n=fGe;break;default:n=DVe}return n}}const Kbt="/aladdin/assets/no_leaf_flower-CjefG9cq.png",$bt="/aladdin/assets/no_leaf_shrub-DDlKdxg_.png",hGe="/aladdin/assets/bellflower-C5sA-Fge.png",jde="/aladdin/assets/boxwood-cAqkPwU6.png",Bde="/aladdin/assets/cactus_combo_1-DgrI_pBB.png",Yde="/aladdin/assets/cactus_combo_2-CnD7zsEV.png",Ode="/aladdin/assets/cactus_combo_3-CTLr6iHA.png",_de="/aladdin/assets/cactus_combo_4-Bv3aYeWB.png",pGe="/aladdin/assets/hibiscus-DqTQjw28.png",gGe="/aladdin/assets/hydrangea-D6uimbNa.png",mGe="/aladdin/assets/hosta-Ds5QIDtm.png",yGe="/aladdin/assets/peony-pnxufFxy.png",AGe="/aladdin/assets/red_rose-BhP67K90.png",wGe="/aladdin/assets/spirea-aOcGALMo.png",xGe="/aladdin/assets/sunflower-l75w306z.png",Vde="/aladdin/assets/tall_bush-g5bJ_GuV.png",vGe="/aladdin/assets/tulip-BqSv3XYD.png",bGe="/aladdin/assets/white_flower-BUfV78a-.png",SGe="/aladdin/assets/yellow_flower-BQ5dOM0H.png";class i3{static fetchSpread(e){switch(e){case uo.Bellflower:return .45;case uo.Boxwood:return 1.6;case uo.CactusCombo1:return 1;case uo.CactusCombo2:return 1;case uo.CactusCombo3:return 1;case uo.CactusCombo4:return 1;case uo.Hosta:return 1;case uo.Hibiscus:return 2;case uo.Hydrangea:return 2;case uo.Peony:return 1.5;case uo.RedRose:return .5;case uo.Spirea:return 1.8;case uo.Sunflower:return 1;case uo.TallBush:return 1;case uo.Tulip:return .4;case uo.YellowFlower:return 2;default:return .8}}static fetchHeight(e){switch(e){case uo.Bellflower:return .4;case uo.Boxwood:return 1.44;case uo.CactusCombo1:return 1.18;case uo.CactusCombo2:return 1.35;case uo.CactusCombo3:return 1.24;case uo.CactusCombo4:return 1.35;case uo.Hosta:return .7;case uo.Hibiscus:return 1.7;case uo.Hydrangea:return 1.5;case uo.Peony:return 1;case uo.RedRose:return .8;case uo.Spirea:return 1.6;case uo.Sunflower:return 2;case uo.TallBush:return 2;case uo.Tulip:return .7;case uo.YellowFlower:return 1.4;default:return .5}}static fetchLabel(e,n){switch(e){case uo.Bellflower:return B.t("flower.Bellflower",n);case uo.Boxwood:return B.t("flower.Boxwood",n);case uo.CactusCombo1:return B.t("flower.CactusCombo1",n);case uo.CactusCombo2:return B.t("flower.CactusCombo2",n);case uo.CactusCombo3:return B.t("flower.CactusCombo3",n);case uo.CactusCombo4:return B.t("flower.CactusCombo4",n);case uo.Hibiscus:return B.t("flower.Hibiscus",n);case uo.Hydrangea:return B.t("flower.Hydrangea",n);case uo.Hosta:return B.t("flower.Hosta",n);case uo.Peony:return B.t("flower.Peony",n);case uo.RedRose:return B.t("flower.RedRose",n);case uo.Spirea:return B.t("flower.Spirea",n);case uo.Sunflower:return B.t("flower.Sunflower",n);case uo.TallBush:return B.t("flower.TallBush",n);case uo.Tulip:return B.t("flower.Tulip",n);case uo.YellowFlower:return B.t("flower.YellowFlower",n);default:return B.t("flower.WhiteFlower",n)}}static fetchTextureImage(e,n){if(n)return e===uo.Hibiscus||e===uo.Hydrangea||e===uo.YellowFlower||e===uo.Spirea?$bt:e===uo.Boxwood?jde:e===uo.TallBush?Vde:e===uo.CactusCombo1?Bde:e===uo.CactusCombo2?Yde:e===uo.CactusCombo3?Ode:e===uo.CactusCombo4?_de:Kbt;let o;switch(e){case uo.Bellflower:o=hGe;break;case uo.Boxwood:o=jde;break;case uo.CactusCombo1:o=Bde;break;case uo.CactusCombo2:o=Yde;break;case uo.CactusCombo3:o=Ode;break;case uo.CactusCombo4:o=_de;break;case uo.Hibiscus:o=pGe;break;case uo.Hydrangea:o=gGe;break;case uo.Hosta:o=mGe;break;case uo.Peony:o=yGe;break;case uo.RedRose:o=AGe;break;case uo.Spirea:o=wGe;break;case uo.Sunflower:o=xGe;break;case uo.TallBush:o=Vde;break;case uo.Tulip:o=vGe;break;case uo.YellowFlower:o=SGe;break;default:o=bGe}return o}}class Qa{static makeHuman(e,n,o,r,i){return{type:z.Human,name:e??Vt.Jack,cx:o,cy:r,cz:i,lx:hh.fetchWidth(e??Vt.Jack),lz:hh.fetchHeight(e??Vt.Jack),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Oi.generate()}}static makeTree(e,n,o,r,i,a,l){return{type:z.Tree,name:e??yr.Dogwood,cx:i,cy:a,cz:l,lx:n??3,lz:o??4,normal:[0,1,0],rotation:[0,0,0],parentId:r,id:Oi.generate()}}static makeSolarPanel(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y,w){let x;switch(e.type){case z.Foundation:x=e.id,w=z.Foundation;break;case z.Cuboid:x=e.id,w=z.Cuboid;break;case z.Wall:case z.Roof:x=e.parentId;break}return{type:z.SolarPanel,pvModelName:n.name,trackerType:Bl.NO_TRACKER,relativeAzimuth:u??0,tiltAngle:c??0,orientation:a??br.landscape,drawSunBeam:!1,poleHeight:l??1,poleRadius:.05,poleSpacing:s??3,cx:o,cy:r,cz:i,lx:m??(a===br.landscape?n.length:n.width),ly:y??(a===br.landscape?n.width:n.length),lz:n.thickness,showLabel:!1,normal:d?d.toArray():[0,0,1],rotation:f||[0,0,0],color:"#fff",frameColor:p??"white",parentType:w??e.type,parentId:e.id,foundationId:x,id:Oi.generate(),version:1}}static makeSolarWaterHeater(e,n,o,r,i,a){const l=H.getState().actionState;return{type:z.SolarWaterHeater,cx:n,cy:o,cz:r,lx:2.092,ly:1.558+l.solarWaterHeaterTankRadius,lz:l.solarWaterHeaterHeight,waterTankRadius:l.solarWaterHeaterTankRadius,relativeAzimuth:l.solarWaterHeaterRelativeAzimuth,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],color:l.solarWaterHeaterColor,parentType:e.type,parentId:e.id,foundationId:e.parentId,id:Oi.generate()}}static makeBatteryStorage(e,n,o,r){return{type:z.BatteryStorage,id:Oi.generate(),parentId:e.id,foundationId:e.id,cx:n,cy:o,cz:r,lx:1.5,ly:2,lz:1.5,normal:[0,0,0],rotation:[0,0,0],color:"#C7BABE"}}static makeFlower(e,n,o,r,i){return{type:z.Flower,name:e??uo.YellowFlower,cx:o,cy:r,cz:i,lx:i3.fetchSpread(e??uo.YellowFlower),lz:i3.fetchHeight(e??uo.YellowFlower),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Oi.generate()}}static makeCuboid(e,n,o,r,i){return{type:z.Cuboid,cx:e,cy:n,cz:o?o/2:2,lx:.1,ly:.1,lz:o??4,color:"#808080",faceColors:r??["#808080","#808080","#808080","#808080","#808080","#808080"],textureTypes:i??[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture],stackable:H.getState().actionState.cuboidStackable,transparency:H.getState().actionState.cuboidTransparency,normal:[0,0,1],rotation:[0,0,0],parentId:rr,selected:!1,id:Oi.generate()}}static makeFoundation(e,n,o,r,i){return{type:z.Foundation,cx:e,cy:n,cz:o?o/2:.05,lx:0,ly:0,lz:o??.1,normal:[0,0,1],rotation:[0,0,0],parentId:rr,selected:!1,color:r??"#808080",textureType:i??Xi.NoTexture,solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{...fVe},id:Oi.generate()}}static makeParabolicTrough(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y){let w;switch(e.type){case z.Foundation:w=e.id;break}return{type:z.ParabolicTrough,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:s??3,latusRectum:a??2,relativeAzimuth:0,tiltAngle:0,absorberTubeRadius:.05,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.05,cx:c,cy:u,cz:d,lx:m??2,ly:y??9,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:w,id:Oi.generate()}}static makeParabolicDish(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y){let w;switch(e.type){case z.Foundation:w=e.id;break}return{type:z.ParabolicDish,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:3,latusRectum:a??8,relativeAzimuth:0,tiltAngle:0,structureType:s??pf.CentralPole,receiverRadius:.25,receiverPoleRadius:.1,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.2,cx:c,cy:u,cz:d,lx:m??4,ly:y??4,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:w,id:Oi.generate()}}static makeFresnelReflector(e,n,o,r,i,a,l,s,c,u,d,f){let p;switch(e.type){case z.Foundation:p=e.id;break}return{type:z.FresnelReflector,receiverId:n??"None",reflectance:o??.9,moduleLength:i??3,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.05,cx:a,cy:l,cz:s,lx:d??2,ly:f??9,lz:.1,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:p,id:Oi.generate()}}static makeWindTurbine(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y,w,x,C,P){let A;switch(e.type){case z.Foundation:A=e.id;break}return{type:z.WindTurbine,birdSafe:n,bladeColor:o,stripeColor:r,numberOfBlades:i,initialRotorAngle:a,relativeYawAngle:l,pitchAngle:s,bladeRadius:c,bladeTipWidth:.2,bladeRootRadius:u,maximumChordRadius:f,maximumChordLength:d,towerRadius:p,towerHeight:m,hubRadius:y,hubLength:w,cx:x,cy:C,cz:P,lx:p*4,ly:p*4,lz:m+c,normal:[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:A,id:Oi.generate()}}static makeHeliostat(e,n,o,r,i,a,l,s,c,u,d){let f;switch(e.type){case z.Foundation:f=e.id;break}return{type:z.Heliostat,towerId:n??"None",reflectance:o??.9,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.1,cx:i,cy:a,cz:l,lx:u??2,ly:d??4,lz:.1,showLabel:!1,normal:s?s.toArray():[0,0,1],rotation:c||[0,0,0],parentId:e.id,foundationId:f,id:Oi.generate()}}static makePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=.2,u=.2,d=.2;let f=n,p=o;return e.type===z.Cuboid&&i?ye.isUnitVectorX(i)?f=r:ye.isUnitVectorY(i)&&(p=r):e.type===z.Wall&&(p=r),{type:z.Polygon,cx:f,cy:p,cz:0,lx:2*c,ly:2*u,lz:2*d,color:"#ffffff",normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],vertices:[{x:Math.max(-.5,f-c),y:Math.max(-.5,p-u)},{x:Math.max(-.5,f-c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.max(-.5,p-u)}],parentId:e.id,parentType:l,foundationId:s,selected:!1,filled:!0,selectedIndex:-1,id:Oi.generate()}}static makeWall(e,n,o,r,i){const a=H.getState().actionState;return{type:z.Wall,cx:n,cy:o,cz:r,lx:0,ly:a.wallThickness??.3,lz:a.wallHeight??5,parapet:a.wallParapet,eavesLength:a.wallEavesLength??.3,rValue:a.wallRValue??3,fill:Ul.Full,leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:a.wallHeight-.5,rightTopPartialHeight:a.wallHeight-.5,relativeAngle:0,leftPoint:[],rightPoint:[],leftJoints:[],rightJoints:[],textureType:a.wallTexture??Jo.Default,color:a.wallColor??"#ffffff",volumetricHeatCapacity:a.wallVolumetricHeatCapacity??.5,wallStructure:a.wallStructure??Tc.Default,studSpacing:a.wallStructureSpacing??2,studWidth:a.wallStructureWidth??.1,studColor:a.wallStructureColor??"#ffffff",opacity:a.wallOpacity!==void 0?a.wallOpacity:.5,selected:!1,lineWidth:.2,lineColor:"#000000",windows:[],showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:e.id,id:Oi.generate()}}static makeSensor(e,n,o,r,i,a){let l;switch(e.type){case z.Foundation:case z.Cuboid:l=e.id;break;case z.Wall:case z.Roof:l=e.parentId;break}return{type:z.Sensor,cx:n,cy:o,cz:r,lx:.1,ly:.1,lz:.01,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],parentId:e.id,foundationId:l,parentType:e.type,id:Oi.generate()}}static makeLight(e,n,o,r,i,a,l,s,c,u){let d;switch(e.type){case z.Foundation:case z.Cuboid:d=e.id;break;case z.Wall:case z.Roof:d=e.parentId;break}return{type:z.Light,decay:n??2,distance:o??5,intensity:r??3,color:i??"#ffff99",cx:a,cy:l,cz:s,lx:.16,ly:.16,lz:.08,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:d,parentType:e.type,id:Oi.generate()}}static makeWindow(e,n,o,r,i,a,l=0,s=0){let c,u=0;switch(e.type){case z.Cuboid:c=e.id;break;case z.Wall:c=e.parentId,u=e.ly;break;case z.Roof:c=e.parentId,u=e.thickness;break}const d=H.getState().actionState;return{type:z.Window,cx:n,cy:o,cz:r,lx:l,ly:u,lz:s,leftShutter:d.windowShutterLeft,rightShutter:d.windowShutterRight,shutterColor:d.windowShutterColor,shutterWidth:d.windowShutterWidth,horizontalMullion:d.windowHorizontalMullion,verticalMullion:d.windowVerticalMullion,mullionWidth:d.windowMullionWidth,horizontalMullionSpacing:d.windowHorizontalMullionSpacing,verticalMullionSpacing:d.windowVerticalMullionSpacing,mullionColor:d.windowMullionColor,frame:d.windowFrame,frameWidth:d.windowFrameWidth,sillWidth:Rn.isTypeRoof(i)?0:d.windowSillWidth,windowType:d.windowType,empty:d.windowEmpty,interior:d.windowInterior,archHeight:d.windowArchHeight,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,color:d.windowColor??"#ffffff",tint:d.windowTint??"#73D8FF",opacity:d.windowOpacity!==void 0?d.windowOpacity:.5,uValue:d.windowUValue??.5,normal:[0,-1,0],rotation:a?[...a]:[0,0,0],parentId:e.id,parentType:i,foundationId:c,id:Oi.generate()}}static makeDoor(e){let n;switch(e.type){case z.Cuboid:n=e.id;break;case z.Wall:n=e.parentId;break}const o=H.getState().actionState;return{type:z.Door,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,doorType:o.doorType,filled:o.doorFilled,interior:o.doorInterior,archHeight:o.doorArchHeight,textureType:o.doorTexture??dr.Default,color:o.doorColor??"#ffffff",uValue:o.doorUValue??.5,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:e.id,foundationId:n,id:Oi.generate()}}static makePyramidRoof(e,n){const o=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Yr.Default,roofType:Zo.Pyramid,roofStructure:Hc.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate()}}static makeGableRoof(e,n){const o=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Yr.Default,roofType:Zo.Gable,roofStructure:Hc.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate(),ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1]}}static makeHipRoof(e,n,o){const r=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Yr.Default,roofType:Zo.Hip,roofStructure:Hc.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate(),leftRidgeLength:(o??2)/2,rightRidgeLength:(o??2)/2}}static makeGambrelRoof(e,n){const r=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Yr.Default,roofType:Zo.Gambrel,roofStructure:Hc.Default,wallsId:[...e],topRidgePoint:[0,1],frontRidgePoint:[.35,.5],backRidgePoint:[.35,.5],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate()}}static makeMansardRoof(e,n){const o=H.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Yr.Default,roofType:Zo.Mansard,roofStructure:Hc.Default,wallsId:[...e],ridgeWidth:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Oi.generate()}}}const qbt=t=>t.solarPanelArrayLayoutParams.pvModelName,Qbt=t=>t.solarPanelArrayLayoutParams.rowAxis,Zbt=t=>t.solarPanelArrayLayoutParams.rowsPerRack,eSt=t=>t.solarPanelArrayLayoutParams.interRowSpacing,tSt=t=>t.solarPanelArrayLayoutParams.margin,nSt=t=>t.solarPanelArrayLayoutParams.poleHeight,oSt=t=>t.solarPanelArrayLayoutParams.poleSpacing,rSt=t=>t.solarPanelArrayLayoutParams.tiltAngle,iSt=t=>t.solarPanelArrayLayoutParams.orientation,iQ=t=>t.viewState.navigationView,xs=t=>t.viewState.shadowEnabled,aQ=t=>t.viewState.shadowCameraFar,_2e=t=>t.viewState.solarPanelShininess,TGe=t=>t.viewState.windowShininess,Y5=t=>t.viewState.heatFluxScaleFactor,J3=t=>t.viewState.heatFluxColor,K3=t=>t.viewState.heatFluxWidth,Df=t=>t.viewState.solarRadiationHeatMapMaxValue,V2e=t=>t.viewState.solarRadiationHeatMapReflectionOnly,G2e=t=>t.viewState.axes,PGe=t=>t.viewState.ambientLightIntensity,CGe=t=>t.viewState.directLightIntensity,RGe=t=>t.viewState.theme,HGe=t=>t.viewState.showAzimuthAngle,MGe=t=>t.viewState.showElevationAngle,IGe=t=>t.viewState.showZenithAngle,zGe=t=>t.viewState.autoRotate,DGe=t=>t.viewState.hideAddress,h4=t=>t.viewState.groundImage,aSt=t=>t.viewState.groundImageType,EGe=t=>t.viewState.groundColor,kGe=t=>t.viewState.waterSurface,M0=t=>t.viewState.orthographic,lSt=t=>t.viewState.enableRotate,sSt=t=>t.viewState.cameraPosition,cSt=t=>t.viewState.cameraZoom,FGe=t=>t.viewState.heliodon,LGe=t=>t.viewState.showSunAngles,X2e=t=>t.viewState.mapZoom,uSt=t=>t.viewState.mapTilt,WGe=t=>t.viewState.mapType,J2e=t=>t.viewState.showSiteInfoPanel,lQ=t=>t.viewState.showDesignInfoPanel,NGe=t=>t.viewState.showInstructionPanel,UGe=t=>t.viewState.showHeliodonPanel,dSt=t=>t.viewState.heliodonPanelX,fSt=t=>t.viewState.heliodonPanelY,sQ=t=>t.viewState.showModelTree,hSt=t=>t.viewState.showMapPanel,pSt=t=>t.viewState.mapPanelX,gSt=t=>t.viewState.mapPanelY,mSt=t=>t.viewState.showWeatherPanel,ySt=t=>t.viewState.weatherPanelRect,ASt=t=>t.viewState.showDiurnalTemperaturePanel,wSt=t=>t.viewState.diurnalTemperaturePanelRect,jGe=t=>t.viewState.showStickyNotePanel,xSt=t=>t.viewState.stickyNotePanelRect,vSt=t=>t.viewState.showDailyBuildingEnergyPanel,bSt=t=>t.viewState.dailyBuildingEnergyPanelRect,SSt=t=>t.viewState.showYearlyBuildingEnergyPanel,TSt=t=>t.viewState.yearlyBuildingEnergyPanelRect,BGe=t=>t.viewState.showDailyLightSensorPanel,PSt=t=>t.viewState.dailyLightSensorPanelRect,CSt=t=>t.viewState.showYearlyLightSensorPanel,RSt=t=>t.viewState.yearlyLightSensorPanelRect,HSt=t=>t.viewState.yearlyLightSensorPanelShowDaylight,MSt=t=>t.viewState.yearlyLightSensorPanelShowClearness,YGe=t=>t.viewState.showDailyPvYieldPanel,ISt=t=>t.viewState.dailyPvYieldPanelRect,zSt=t=>t.viewState.showYearlyPvYieldPanel,DSt=t=>t.viewState.yearlyPvYieldPanelRect,ESt=t=>t.viewState.showSolarPanelVisibilityResultsPanel,kSt=t=>t.viewState.visibilityResultsPanelRect,OGe=t=>t.viewState.showDailyParabolicTroughYieldPanel,FSt=t=>t.viewState.dailyParabolicTroughYieldPanelRect,LSt=t=>t.viewState.showYearlyParabolicTroughYieldPanel,WSt=t=>t.viewState.yearlyParabolicTroughYieldPanelRect,_Ge=t=>t.viewState.showDailyParabolicDishYieldPanel,NSt=t=>t.viewState.dailyParabolicDishYieldPanelRect,USt=t=>t.viewState.showYearlyParabolicDishYieldPanel,jSt=t=>t.viewState.yearlyParabolicDishYieldPanelRect,VGe=t=>t.viewState.showDailyFresnelReflectorYieldPanel,BSt=t=>t.viewState.dailyFresnelReflectorYieldPanelRect,YSt=t=>t.viewState.showYearlyFresnelReflectorYieldPanel,OSt=t=>t.viewState.yearlyFresnelReflectorYieldPanelRect,GGe=t=>t.viewState.showDailyHeliostatYieldPanel,_St=t=>t.viewState.dailyHeliostatYieldPanelRect,VSt=t=>t.viewState.showYearlyHeliostatYieldPanel,GSt=t=>t.viewState.yearlyHeliostatYieldPanelRect,XGe=t=>t.viewState.showDailyUpdraftTowerYieldPanel,XSt=t=>t.viewState.dailyUpdraftTowerYieldPanelRect,JSt=t=>t.viewState.showYearlyUpdraftTowerYieldPanel,KSt=t=>t.viewState.yearlyUpdraftTowerYieldPanelRect,$St=t=>t.viewState.showEvolutionPanel,qSt=t=>t.viewState.evolutionPanelRect,tu=t=>t.world.latitude,TS=t=>t.world.longitude,ml=t=>t.world.date,K2e=t=>t.world.leafDayOfYear1,$2e=t=>t.world.leafDayOfYear2,QSt=t=>t.world.ground,cQ=t=>t.world.address,ZSt=t=>t.world.countryCode,eTt=t=>t.world.airAttenuationCoefficient,tTt=t=>t.world.airConvectiveCoefficient,JGe=t=>t.world.timesPerHour,UM=t=>t.world.daysPerYear,nTt=t=>t.world.discretization,KGe=t=>t.world.diurnalTemperatureModel,WN=t=>t.world.highestTemperatureTimeInMinutes,oTt=t=>t.world.solarRadiationHeatmapGridCellSize,rTt=t=>t.world.pvGridCellSize,iTt=t=>t.world.solarPanelVisibilityGridCellSize,aTt=t=>t.world.cspTimesPerHour,NN=t=>t.world.cspDaysPerYear,lTt=t=>t.world.cspGridCellSize,sTt=t=>t.world.sutTimesPerHour,$Ge=t=>t.world.sutDaysPerYear,cTt=t=>t.world.sutGridCellSize,q2e=t=>t.world.noAnimationForHeatmapSimulation,uTt=t=>t.world.noAnimationForThermalSimulation,Q2e=t=>t.world.noAnimationForSensorDataCollection,Z2e=t=>t.world.noAnimationForSolarPanelSimulation,qGe=t=>t.world.noAnimationForSolarUpdraftTowerSimulation,pn=t=>t.set,Xp=t=>t.user,dTt=t=>t.userCount,fTt=t=>t.modelTreeExpandedKeys,hTt=t=>t.showSolarPanelCustomizationPanel,pTt=t=>t.showEconomicsPanel,gTt=t=>t.showNavigationPanel,mTt=t=>t.showShadowSettings,yTt=t=>t.minimumNavigationMoveSpeed,ATt=t=>t.minimumNavigationTurnSpeed,wTt=t=>t.navigationMoveSpeed,xTt=t=>t.navigationTurnSpeed,O1=t=>t.getHeatmap,e5e=t=>t.setHeatmap,QGe=t=>t.clearHeatmaps,t5e=t=>t.flagOfDailySimulation,PS=t=>t.hourlyHeatExchangeArrayMap,vTt=t=>t.setHourlyHeatExchangeArray,bTt=t=>t.hourlySolarHeatGainArrayMap,STt=t=>t.setHourlySolarHeatGainArray,TTt=t=>t.hourlySolarPanelOutputArrayMap,PTt=t=>t.setHourlySolarPanelOutputArray,n5e=t=>t.getRoofSegmentVertices,UN=t=>t.getRoofSegmentVerticesWithoutOverhang,CTt=t=>t.latestVersion,o5e=t=>t.changed,RTt=t=>t.setChanged,HTt=t=>t.setSkipChange,no=t=>t.applyCount,qn=t=>t.setApplyCount,Ji=t=>t.revertApply,Qn=t=>t.elements,MTt=t=>t.notes,jM=t=>t.supportedPvModules,BM=t=>t.customPvModules,ITt=t=>t.loadSupportedPvModules,zTt=t=>t.addCustomPvModule,O5=t=>t.getPvModule,I0=t=>t.floatingWindowOpacity,kc=t=>t.selectedFloatingWindow,Au=t=>t.language,DTt=t=>t.locale,Qi=t=>t.loggable,ETt=t=>t.actionInfo,YM=t=>t.logAction,kTt=t=>t.currentUndoable,uQ=t=>t.openModelsMap,FTt=t=>t.modelsMapLatitude,LTt=t=>t.modelsMapLongitude,WTt=t=>t.modelsMapZoom,NTt=t=>t.modelsMapTilt,r5e=t=>t.modelsMapType,ZGe=t=>t.modelsMapWeatherStations,UTt=t=>t.showCloudFileTitleDialog,eXe=t=>t.showCloudFileTitleDialogFlag,CS=t=>t.cloudFile,jTt=t=>t.latestModelSite,tXe=t=>t.modelSites,BTt=t=>t.allModelSites,nXe=t=>t.peopleModels,YTt=t=>t.allPeopleModels,OTt=t=>t.saveAccountSettingsFlag,_Tt=t=>t.saveCloudFileFlag,VTt=t=>t.createProjectFlag,GTt=t=>t.saveProjectAsFlag,XTt=t=>t.curateDesignToProjectFlag,JTt=t=>t.showProjectsFlag,KTt=t=>t.updateProjectsFlag,$Tt=t=>t.confirmOpeningDesign,qTt=t=>t.modelsMapFlag,oXe=t=>t.showModelsAllTime,rXe=t=>t.showModelsFromDate,iXe=t=>t.showModelsToDate,QTt=t=>t.leaderboardFlag,ZTt=t=>t.showLeaderboard,ePt=t=>t.publishOnModelsMapFlag,tPt=t=>t.listCloudFilesFlag,nPt=t=>t.refreshCloudFilesFlag,oPt=t=>t.localContentToImportAfterCloudFileUpdate,rPt=t=>t.localFileName,iPt=t=>t.createNewFileFlag,aPt=t=>t.openLocalFileFlag,aXe=t=>t.saveLocalFileDialogVisible,OM=t=>t.fileChanged,i5e=t=>t.undoManager,Fn=t=>t.addUndoable,a5e=t=>t.importContent,lXe=t=>t.exportContent,lPt=t=>t.clearContent,sXe=t=>t.createEmptyFile,sPt=t=>t.aabb,cXe=t=>t.animateSun,cPt=t=>t.animate24Hours,jN=t=>t.runDailyThermalSimulation,uPt=t=>t.pauseDailyThermalSimulation,dQ=t=>t.runYearlyThermalSimulation,dPt=t=>t.pauseYearlyThermalSimulation,fPt=t=>t.clearDailySimulationResultsFlag,hPt=t=>t.clearYearlySimulationResultsFlag,BN=t=>t.runDynamicSimulation,l5e=t=>t.runStaticSimulation,pPt=t=>t.pauseSimulation,_5=t=>t.runEvolution,fQ=t=>t.pauseEvolution,hQ=t=>t.objectiveEvaluationIndex,_M=t=>t.evolutionMethod,gPt=t=>t.updateSceneRadiusFlag,uXe=t=>t.updateSceneRadius,Ky=t=>t.sceneRadius,mPt=t=>t.cameraDirection,s5e=t=>t.getCameraDirection,Jn=t=>t.getElementById,p4=t=>t.getFoundation,$r=t=>t.getParent,RS=t=>t.getChildren,$3=t=>t.getChildrenOfType,q3=t=>t.selectedElement,yPt=t=>t.selectedElementIdSet,HS=t=>t.getSelectedElement,c5e=t=>t.overlapWithSibling,dXe=t=>t.selectedSideIndex,Q3=t=>t.setElementPosition,u5e=t=>t.setElementSize,APt=t=>t.setElementNormal,wPt=t=>t.updateElementLockById,xPt=t=>t.updateElementReferenceById,vPt=t=>t.updateElementLabelById,bPt=t=>t.updateElementShowLabelById,fXe=t=>t.updateElementCxById,hXe=t=>t.updateElementCyById,SPt=t=>t.updateElementCzById,TPt=t=>t.updateElementCzForAll,Z3=t=>t.updateElementLxById,pQ=t=>t.updateElementLxAboveFoundation,YN=t=>t.updateElementLxForAll,H7=t=>t.updateElementLyById,gQ=t=>t.updateElementLyAboveFoundation,ON=t=>t.updateElementLyForAll,d5e=t=>t.updateElementLzById,PPt=t=>t.updateElementLzForAll,f5e=t=>t.updateElementColorById,CPt=t=>t.updateElementColorOnSurface,RPt=t=>t.updateElementColorAboveFoundation,h5e=t=>t.updateElementColorForAll,HPt=t=>t.updateElementLineColorById,MPt=t=>t.updateElementLineColorOnSurface,IPt=t=>t.updateElementLineColorAboveFoundation,zPt=t=>t.updateElementLineColorForAll,DPt=t=>t.updateElementLineWidthById,EPt=t=>t.updateElementLineWidthOnSurface,kPt=t=>t.updateElementLineWidthAboveFoundation,FPt=t=>t.updateElementLineWidthForAll,mQ=t=>t.updateElementRotationById,LPt=t=>t.updateElementRotationForAll,ac=t=>t.foundationActionScope,WPt=t=>t.setFoundationActionScope,VM=t=>t.polygonActionScope,GM=t=>t.setPolygonActionScope,pXe=t=>t.updatePolygonVertexPositionById,M7=t=>t.updatePolygonVerticesById,MS=t=>t.cuboidActionScope,IS=t=>t.setCuboidActionScope,_N=t=>t.batteryStorageActionScope,VN=t=>t.setBatteryStorageActionScope,Wh=t=>t.solarPanelActionScope,Nh=t=>t.setSolarPanelActionScope,p5e=t=>t.solarWaterHeaterActionScope,g5e=t=>t.setSolarWaterHeaterActionScope,GN=t=>t.updateSolarCollectorDailyYieldById,XN=t=>t.updateSolarCollectorYearlyYieldById,NPt=t=>t.updateSolarPanelTiltAngleById,gXe=t=>t.updateSolarCollectorDrawSunBeamById,mXe=t=>t.updateSolarCollectorDrawSunBeamAboveFoundation,yXe=t=>t.updateSolarCollectorDrawSunBeamForAll,yQ=t=>t.updateSolarCollectorRelativeAzimuthById,AXe=t=>t.updateSolarCollectorRelativeAzimuthOnSurface,wXe=t=>t.updateSolarCollectorRelativeAzimuthAboveFoundation,xXe=t=>t.updateSolarCollectorRelativeAzimuthForAll,UPt=t=>t.updateSolarCollectorXById,jPt=t=>t.updateSolarCollectorXAboveFoundation,BPt=t=>t.updateSolarCollectorXForAll,YPt=t=>t.updateSolarCollectorYById,OPt=t=>t.updateSolarCollectorYAboveFoundation,_Pt=t=>t.updateSolarCollectorYForAll,JN=t=>t.updateSolarCollectorPoleHeightById,VPt=t=>t.updateSolarCollectorPoleHeightOnSurface,KN=t=>t.updateSolarCollectorPoleHeightAboveFoundation,$N=t=>t.updateSolarCollectorPoleHeightForAll,vXe=t=>t.updateSolarCollectorPoleRadiusById,bXe=t=>t.updateSolarCollectorPoleRadiusAboveFoundation,SXe=t=>t.updateSolarCollectorPoleRadiusForAll,AQ=t=>t.updateCspReflectanceById,wQ=t=>t.updateCspReflectanceAboveFoundation,xQ=t=>t.updateCspReflectanceForAll,TXe=t=>t.updateParabolicCollectorAbsorptanceById,PXe=t=>t.updateParabolicCollectorAbsorptanceAboveFoundation,CXe=t=>t.updateParabolicCollectorAbsorptanceForAll,RXe=t=>t.updateParabolicCollectorOpticalEfficiencyById,HXe=t=>t.updateParabolicCollectorOpticalEfficiencyAboveFoundation,MXe=t=>t.updateParabolicCollectorOpticalEfficiencyForAll,IXe=t=>t.updateParabolicCollectorThermalEfficiencyById,zXe=t=>t.updateParabolicCollectorThermalEfficiencyAboveFoundation,DXe=t=>t.updateParabolicCollectorThermalEfficiencyForAll,g4=t=>t.parabolicTroughActionScope,m4=t=>t.setParabolicTroughActionScope,zS=t=>t.fresnelReflectorActionScope,DS=t=>t.setFresnelReflectorActionScope,ES=t=>t.heliostatActionScope,kS=t=>t.setHeliostatActionScope,EXe=t=>t.updateSolarReceiverById,kXe=t=>t.updateSolarReceiverAboveFoundation,FXe=t=>t.updateSolarReceiverForAll,y4=t=>t.parabolicDishActionScope,A4=t=>t.setParabolicDishActionScope,LXe=t=>t.updateParabolaLatusRectumById,WXe=t=>t.updateParabolaLatusRectumAboveFoundation,NXe=t=>t.updateParabolaLatusRectumForAll,UXe=t=>t.updateModuleLengthById,jXe=t=>t.updateModuleLengthAboveFoundation,BXe=t=>t.updateModuleLengthForAll,e6=t=>t.windTurbineActionScope,t6=t=>t.setWindTurbineActionScope,YXe=t=>t.copyElementById,Jp=t=>t.removeElementById,GPt=t=>t.clearDeletedElements,XPt=t=>t.countElementsByReferenceId,m5e=t=>t.removeElementsByReferenceId,OXe=t=>t.pasteElementsToPoint,JPt=t=>t.pasteElementsByKey,_Xe=t=>t.elementsToPaste,z0=t=>t.selectMe,qN=t=>t.selectNone,vQ=t=>t.selectElement,y5e=t=>t.addElement,bQ=t=>t.objectTypeToAdd,KPt=t=>t.actionModeLock,Pm=t=>t.countElementsByType,VXe=t=>t.countSolarStructuresByType,$Pt=t=>t.countObservers,qPt=t=>t.countSolarPanelsOnRack,QPt=t=>t.selectedElementAngle,ZPt=t=>t.waiting,Ef=t=>t.simulationInProgress,A5e=t=>t.simulationPaused,GXe=t=>t.evolutionInProgress,XXe=t=>t.evolutionPaused,eCt=t=>t.contextMenuObjectType,tCt=t=>t.enableFineGrid,nCt=t=>t.setEnableFineGrid,oCt=t=>t.showCloudFilePanel,w5e=t=>t.projectState.title,JXe=t=>t.projectState.owner,rCt=t=>t.projectState.description,iCt=t=>t.projectState.designs,aCt=t=>t.projectState.type,KXe=t=>t.projectState.selectedProperty,lCt=t=>t.projectState.dataColoring,sCt=t=>t.projectState.thumbnailWidth,cCt=t=>t.projectState.xAxisNameScatterPlot,uCt=t=>t.projectState.yAxisNameScatterPlot,dCt=t=>t.projectState.dotSizeScatterPlot,fCt=t=>t.projectState.sortDescending,hCt=t=>t.projectState.filters,pCt=t=>t.projectState.ranges,gCt=t=>t.projectState.hiddenParameters,QN=t=>t.projectView,mCt=t=>t.canvasPercentWidth,$Xe=t=>t.cloudFileBelongToProject,qXe=t=>t.closeProject,yCt=t=>t.showProjectListPanel,ACt=t=>t.showModelsGallery,wCt=t=>t.showAccountSettingsPanel,xCt=t=>t.showLikesPanel,vCt=t=>t.showPublishedModelsPanel,bCt=t=>t.weatherModel,QXe=t=>t.setWeatherModel,x5e=t=>t.weatherData,SCt=t=>t.loadWeatherData,TCt=t=>t.loadHorizontalSolarRadiationData,PCt=t=>t.getHorizontalSolarRadiation,CCt=t=>t.loadVerticalSolarRadiationData,RCt=t=>t.getVerticalSolarRadiation,ZXe=t=>t.getClosestCity,I7=t=>t.sunlightDirection,HCt=t=>t.setSunlightDirection,vs=t=>t.showSolarRadiationHeatmap,MCt=t=>t.selectButtonClicked,n6=t=>t.showHeatFluxes,ICt=t=>t.runSolarPanelVisibilityAnalysis,zCt=t=>t.solarPanelVisibilityResults,eJe=t=>t.runDailySimulationForSolarPanels,DCt=t=>t.runDailySimulationForSolarPanelsLastStep,tJe=t=>t.runYearlySimulationForSolarPanels,ECt=t=>t.runYearlySimulationForSolarPanelsLastStep,kCt=t=>t.pauseDailySimulationForSolarPanels,FCt=t=>t.pauseYearlySimulationForSolarPanels,LCt=t=>t.dailyPvYield,nJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyPvIndividualOutputs},WCt=t=>t.setDailyPvYield,NCt=t=>t.yearlyPvYield,oJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyPvIndividualOutputs},UCt=t=>t.setYearlyPvYield,rJe=t=>t.solarPanelLabels,jCt=t=>t.setSolarPanelLabels,iJe=t=>t.setTotalBuildingHeater,aJe=t=>t.setTotalBuildingAc,lJe=t=>t.setTotalBuildingSolarPanel,BCt=t=>t.runDailySimulationForParabolicTroughs,YCt=t=>t.runYearlySimulationForParabolicTroughs,OCt=t=>t.pauseDailySimulationForParabolicTroughs,_Ct=t=>t.pauseYearlySimulationForParabolicTroughs,VCt=t=>t.dailyParabolicTroughYield,sJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicTroughIndividualOutputs},GCt=t=>t.setDailyParabolicTroughYield,XCt=t=>t.yearlyParabolicTroughYield,cJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicTroughIndividualOutputs},JCt=t=>t.setYearlyParabolicTroughYield,uJe=t=>t.parabolicTroughLabels,KCt=t=>t.setParabolicTroughLabels,$Ct=t=>t.runDailySimulationForFresnelReflectors,qCt=t=>t.runYearlySimulationForFresnelReflectors,QCt=t=>t.pauseDailySimulationForFresnelReflectors,ZCt=t=>t.pauseYearlySimulationForFresnelReflectors,eRt=t=>t.dailyFresnelReflectorYield,dJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyFresnelReflectorIndividualOutputs},tRt=t=>t.setDailyFresnelReflectorYield,nRt=t=>t.yearlyFresnelReflectorYield,fJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyFresnelReflectorIndividualOutputs},oRt=t=>t.setYearlyFresnelReflectorYield,hJe=t=>t.fresnelReflectorLabels,rRt=t=>t.setFresnelReflectorLabels,iRt=t=>t.runDailySimulationForHeliostats,aRt=t=>t.runYearlySimulationForHeliostats,lRt=t=>t.pauseDailySimulationForHeliostats,sRt=t=>t.pauseYearlySimulationForHeliostats,cRt=t=>t.dailyHeliostatYield,pJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyHeliostatIndividualOutputs},uRt=t=>t.setDailyHeliostatYield,dRt=t=>t.yearlyHeliostatYield,gJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyHeliostatIndividualOutputs},fRt=t=>t.setYearlyHeliostatYield,mJe=t=>t.heliostatLabels,hRt=t=>t.setHeliostatLabels,yJe=t=>t.runDailySimulationForUpdraftTower,AJe=t=>t.runYearlySimulationForUpdraftTower,pRt=t=>t.pauseDailySimulationForUpdraftTower,gRt=t=>t.pauseYearlySimulationForUpdraftTower,mRt=t=>t.dailyUpdraftTowerResults,yRt=t=>t.dailyUpdraftTowerYield,ARt=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyUpdraftTowerIndividualOutputs},wRt=t=>t.setDailyUpdraftTowerResults,xRt=t=>t.setDailyUpdraftTowerYield,vRt=t=>t.yearlyUpdraftTowerYield,bRt=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyUpdraftTowerIndividualOutputs},SRt=t=>t.setYearlyUpdraftTowerYield,wJe=t=>t.updraftTowerLabels,TRt=t=>t.setUpdraftTowerLabels,PRt=t=>t.runDailySimulationForParabolicDishes,CRt=t=>t.runYearlySimulationForParabolicDishes,RRt=t=>t.pauseDailySimulationForParabolicDishes,HRt=t=>t.pauseYearlySimulationForParabolicDishes,MRt=t=>t.dailyParabolicDishYield,xJe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicDishIndividualOutputs},IRt=t=>t.setDailyParabolicDishYield,zRt=t=>t.yearlyParabolicDishYield,vJe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicDishIndividualOutputs},DRt=t=>t.setYearlyParabolicDishYield,bJe=t=>t.parabolicDishLabels,ERt=t=>t.setParabolicDishLabels,SJe=t=>t.runDailyLightSensor,kRt=t=>t.pauseDailyLightSensor,TJe=t=>t.runYearlyLightSensor,FRt=t=>t.pauseYearlyLightSensor,LRt=t=>t.dailyLightSensorData,WRt=t=>t.setDailyLightSensorData,NRt=t=>t.yearlyLightSensorData,URt=t=>t.setYearlyLightSensorData,PJe=t=>t.sensorLabels,jRt=t=>t.setSensorLabels,$y=t=>t.hoveredHandle,FS=t=>t.moveHandleType,Cm=t=>t.resizeHandleType,v5e=t=>t.getResizeHandlePosition,SQ=t=>t.rotateHandleType,BRt=t=>t.resizeAnchor,b5e=t=>t.isAddingElement,TQ=t=>t.addedFoundationId,YRt=t=>t.deletedFoundationId,PQ=t=>t.addedCuboidId,ORt=t=>t.deletedCuboidId,CJe=t=>t.addedWallId,_Rt=t=>t.deletedWallId,VRt=t=>t.deletedRoofId,S5e=t=>t.deletedRoofIdSet,RJe=t=>t.autoDeletedRoofIdSet,GRt=t=>t.autoDeletedRoofs,HJe=t=>t.autoDeletedChild,MJe=t=>t.groupActionMode,XRt=t=>t.groupActionUpdateFlag,JRt=t=>t.addedWindowId,KRt=t=>t.addedDoorId,$Rt=t=>t.updateWallMapOnFoundationFlag,o6=t=>t.wallActionScope,qy=t=>t.roofActionScope,ZN=t=>t.windowActionScope,z7=t=>t.doorActionScope,IJe=t=>t.setRoofActionScope,T5e=t=>t.updateWallLeftJointsById,P5e=t=>t.updateWallRightJointsById,qRt=t=>t.updateWallLeftPointById,CQ=t=>t.economicsParams,QRt=t=>t.fittestIndividualResults,RQ=t=>t.setFittestIndividualResults,eU=t=>t.variableLabels,HQ=t=>t.setVariableLabels,w4=t=>t.evolutionaryAlgorithmState,MQ=t=>t.solarPanelArrayLayoutConstraints,ZRt=t=>t.geneticAlgorithmWizardSelectedTab,eHt=t=>t.particleSwarmOptimizationWizardSelectedTab,tHt=t=>t.countHeatmapCells,kf=t=>t.setPrimitiveStore,C5e=xe.memo(({hx:t,hy:e,hz:n,position:o,rotation:r})=>{const i=H(tCt),a=H(h4),l=a?"#888888":"#444444",s=Math.max(t,e),[c,u]=g.useState(Math.floor(s/50)+1),[d,f]=g.useState(.5);g.useEffect(()=>{i?(u((Math.floor(s/25)+1)*r3),f(a?.05:.1)):(u((Math.floor(s/25)+1)*yA),f((a?.05:.1)*W9))},[i,s,a]);const p=g.useMemo(()=>{const y=[0];for(let w=c;w<=t;w+=c)y.push(w),y.push(-w);return y},[c,t]),m=g.useMemo(()=>{const y=[0];for(let w=c;w<=e;w+=c)y.push(w),y.push(-w);return y},[c,e]);return h.jsxs("group",{position:o??[0,0,n+.01],rotation:r,children:[p.map(y=>h.jsx(On,{points:[[y,-e,0],[y,e,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},y)),m.map(y=>h.jsx(On,{points:[[-t,y,0],[t,y,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},y))]})}),tle=.2,nHt=({x:t,z:e,handleType:n,scale:o=[1,1,1]})=>{const r=H(pn),i=H(Cm),a=g.useRef(null),[l,s]=g.useState("white"),[c,u,d]=o;return g.useEffect(()=>{s(i===n?"red":"white")},[i]),h.jsx(di,{ref:a,name:n,args:[tle*c,tle*u,tle*d],position:[t,0,e],onPointerEnter:()=>{s("red"),r(f=>{f.hoveredHandle=n})},onPointerLeave:()=>{i===null&&s("white"),r(f=>{f.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:l})})},xv=xe.memo(nHt),oHt=({handleType:t})=>{const e=H(FS),n=g.useRef(null),[o,r]=g.useState("white");return g.useEffect(()=>{e===Ho.Mid?r("red"):r("white")},[e]),h.jsx(Ys,{ref:n,name:t,args:[.1,6,6],onPointerEnter:()=>{r("red")},onPointerLeave:()=>{e===null&&r("white")},children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},rHt=xe.memo(oHt);class nle{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y,this.array[this.top++]=e.z}}class iHt{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y}}let HP=class nG{constructor(e){this.plane=null,this.front=null,this.back=null,this.polygons=[],e&&this.build(e)}clone(){const e=new nG;return e.plane=this.plane&&this.plane.clone(),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e.polygons=this.polygons.map(n=>n.clone()),e}invert(){for(let n=0;nNv.EPSILON?1:0;u|=m,d.push(m)}switch(u){case 0:(this.normal.dot(e.plane.normal)>0?n:o).push(e);break;case 1:r.push(e);break;case 2:i.push(e);break;case 3:{const f=[],p=[];for(let m=0;m=3&&r.push(new LX(f,e.shared)),p.length>=3&&i.push(new LX(p,e.shared));break}}}static fromPoints(e,n,o){const r=new c5().copy(n).sub(e).cross(new c5().copy(o).sub(e)).normalize();return new Nv(r.clone(),r.dot(e))}}Nv.EPSILON=1e-5;let LX=class zJe{constructor(e,n){this.vertices=e,this.shared=n,this.plane=Nv.fromPoints(e[0].pos,e[1].pos,e[2].pos)}clone(){return new zJe(this.vertices.map(e=>e.clone()),this.shared)}flip(){this.vertices.reverse().map(e=>e.flip()),this.plane.flip()}};class WX{constructor(e,n,o,r){this.pos=new c5().copy(e),this.normal=new c5().copy(n),this.uv=new c5().copy(o),this.uv.z=0,r&&(this.color=new c5().copy(r))}clone(){return new WX(this.pos,this.normal,this.uv,this.color)}flip(){this.normal.negate()}interpolate(e,n){return new WX(this.pos.clone().lerp(e.pos,n),this.normal.clone().lerp(e.normal,n),this.uv.clone().lerp(e.uv,n),this.color&&e.color&&this.color.clone().lerp(e.color,n))}}class Ac{constructor(){this.polygons=[]}static fromPolygons(e){const n=new Ac;return n.polygons=e,n}static fromGeometry(e,n){let o=[];const r=e.attributes.position,i=e.attributes.normal,a=e.attributes.uv,l=e.attributes.color,s=e.groups;let c;if(e.index)c=e.index.array;else{c=new Array(r.array.length/r.itemSize|0);for(let d=0;d0)for(const y of s)d>=y.start&&d!Number.isNaN(d.plane.normal.x)))}static toGeometry(e,n){let o=0;const r=e.polygons;for(const p of r)o+=p.vertices.length-2;const i=new Ni,a=new nle(o*3*3),l=new nle(o*3*3),s=new iHt(o*2*3);let c;const u=[],d=[];for(const p of r){const m=p.vertices,y=m.length;p.shared!==void 0&&(u[p.shared]||(u[p.shared]=[])),y&&m[0].color!==void 0&&(c||(c=new nle(o*3*3)));for(let w=3;w<=y;w++)(p.shared===void 0?d:u[p.shared]).push(a.top/3,a.top/3+1,a.top/3+2),a.write(m[0].pos),a.write(m[w-2].pos),a.write(m[w-1].pos),l.write(m[0].normal),l.write(m[w-2].normal),l.write(m[w-1].normal),s&&(s.write(m[0].uv),s.write(m[w-2].uv),s.write(m[w-1].uv)),c&&(c.write(m[0].color),c.write(m[w-2].color),c.write(m[w-1].color))}i.setAttribute("position",new _a(a.array,3)),i.setAttribute("normal",new _a(l.array,3)),s&&i.setAttribute("uv",new _a(s.array,2)),c&&i.setAttribute("color",new _a(c.array,3));for(let p=0;pn.clone()).filter(n=>Number.isFinite(n.plane.w)),e}toPolygons(){return this.polygons}union(e){const n=new HP(this.clone().polygons),o=new HP(e.clone().polygons);return n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),Ac.fromPolygons(n.allPolygons())}subtract(e){const n=new HP(this.clone().polygons),o=new HP(e.clone().polygons);return n.invert(),n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),n.invert(),Ac.fromPolygons(n.allPolygons())}intersect(e){const n=new HP(this.clone().polygons),o=new HP(e.clone().polygons);return n.invert(),o.clipTo(n),o.invert(),n.clipTo(o),o.clipTo(n),n.build(o.allPolygons()),n.invert(),Ac.fromPolygons(n.allPolygons())}inverse(){const e=this.clone();for(const n of e.polygons)n.flip();return e}toMesh(e,n){return Ac.toMesh(this,e,n)}toGeometry(e){return Ac.toGeometry(this,e)}}const dt=pq()((t,e)=>{const n=o=>t(Dv(o));return{set:o=>{try{n(o)}catch(r){console.log(r)}},setPrimitiveStore(o,r){n(i=>{i[o]!==void 0?i[o]=r:console.error(`key ${o} is not defined in PrimitiveStoreState`)})},latestVersion:void 0,changed:!1,setChanged(o){n(r=>{r.changed=o})},skipChange:!0,setSkipChange(o){n(r=>{r.skipChange=o})},muteUndoMessage:!1,localFileName:"aladdin.ala",createNewFileFlag:!1,setCreateNewFileFlag(o){n(r=>{r.createNewFileFlag=o})},openLocalFileFlag:!1,setOpenLocalFileFlag(o){n(r=>{r.openLocalFileFlag=o})},waiting:!1,contextMenuFlag:!1,updateContextMenu(){n(o=>{o.contextMenuFlag=!o.contextMenuFlag})},modelTreeExpandedKeys:[],showSolarPanelCustomizationPanel:!1,showEconomicsPanel:!1,showNavigationPanel:!1,showShadowSettings:!1,saveAccountSettingsFlag:!1,saveCloudFileFlag:!1,setSaveCloudFileFlag(o){n(r=>{r.saveCloudFileFlag=o})},listCloudFilesFlag:!1,refreshCloudFilesFlag:!1,saveLocalFileDialogVisible:!1,modelsMapFlag:!1,modelsMapSelectedSite:void 0,leaderboardFlag:!1,showLeaderboard:!1,publishOnModelsMapFlag:!1,modelsMapWeatherStations:!1,createProjectFlag:!1,saveProjectAsFlag:!1,curateDesignToProjectFlag:!1,showProjectsFlag:!1,updateProjectsFlag:!1,showProjectListPanel:!1,projectImagesUpdateFlag:!1,confirmOpeningDesign:!0,projectType:Pi.SOLAR_PANEL_ARRAY,projectTitle:null,projectDescription:null,userCount:0,showCloudFilePanel:!1,openModelsMap:!1,showModelsGallery:!1,showAccountSettingsPanel:!1,showLikesPanel:!1,showPublishedModelsPanel:!1,animateSun:!1,simulationInProgress:!1,simulationPaused:!1,evolutionInProgress:!1,evolutionPaused:!1,runEvolution:!1,pauseEvolution:!1,objectiveEvaluationIndex:0,runDailyThermalSimulation:!1,pauseDailyThermalSimulation:!1,runYearlyThermalSimulation:!1,pauseYearlyThermalSimulation:!1,clearDailySimulationResultsFlag:!1,clearYearlySimulationResultsFlag:!1,runDynamicSimulation:!1,runStaticSimulation:!1,pauseSimulation:!1,runDailySimulationForParabolicDishes:!1,runYearlySimulationForParabolicDishes:!1,pauseDailySimulationForParabolicDishes:!1,pauseYearlySimulationForParabolicDishes:!1,runDailySimulationForParabolicTroughs:!1,runYearlySimulationForParabolicTroughs:!1,pauseDailySimulationForParabolicTroughs:!1,pauseYearlySimulationForParabolicTroughs:!1,runDailySimulationForFresnelReflectors:!1,runYearlySimulationForFresnelReflectors:!1,pauseDailySimulationForFresnelReflectors:!1,pauseYearlySimulationForFresnelReflectors:!1,runDailySimulationForHeliostats:!1,runYearlySimulationForHeliostats:!1,pauseDailySimulationForHeliostats:!1,pauseYearlySimulationForHeliostats:!1,runSolarPanelVisibilityAnalysis:!1,runDailySimulationForSolarPanels:!1,pauseDailySimulationForSolarPanels:!1,runYearlySimulationForSolarPanels:!1,pauseYearlySimulationForSolarPanels:!1,runDailySimulationForSolarPanelsLastStep:!1,runYearlySimulationForSolarPanelsLastStep:!1,runDailyLightSensor:!1,pauseDailyLightSensor:!1,runYearlyLightSensor:!1,pauseYearlyLightSensor:!1,runDailySimulationForUpdraftTower:!1,runYearlySimulationForUpdraftTower:!1,pauseDailySimulationForUpdraftTower:!1,pauseYearlySimulationForUpdraftTower:!1,flagOfDailySimulation:!1,showSolarRadiationHeatmap:!1,showHeatFluxes:!1,duringCameraInteraction:!1,navigationMoveSpeed:3,navigationTurnSpeed:3,elementBeingCanceledId:null,showWallIntersectionPlaneId:null,oldParentId:null,oldFoundationId:null,selectedElementId:null,foundationMovedFlag:!1,updateFoundationMovedFlag(){n(o=>{o.foundationMovedFlag=!o.foundationMovedFlag})},isCameraUnderGround:!1,selectButtonClicked:!1,setSelectButtonClicked(o){n(r=>{r.selectButtonClicked=o})}}}),In=pq()((t,e)=>({roofSegmentVerticesMap:new Map,setRoofSegmentVertices(n,o){t(r=>(r.roofSegmentVerticesMap.set(n,[...o]),r))},getRoofSegmentVertices(n){return e().roofSegmentVerticesMap.get(n)},deleteRoofSegmentVertices(n){t(o=>(o.roofSegmentVerticesMap.delete(n),o))},roofSegmentVerticesWithoutOverhangMap:new Map,setRoofSegmentVerticesWithoutOverhang(n,o){t(r=>(r.roofSegmentVerticesWithoutOverhangMap.set(n,o),r))},getRoofSegmentVerticesWithoutOverhang(n){return e().roofSegmentVerticesWithoutOverhangMap.get(n)},deleteRoofSegmentVerticesWithoutOverhang(n){t(o=>(o.roofSegmentVerticesWithoutOverhangMap.delete(n),o))},dailyLightSensorData:[],setDailyLightSensorData(n){t({dailyLightSensorData:[...n]})},yearlyLightSensorData:[],setYearlyLightSensorData(n){t({yearlyLightSensorData:[...n]})},sensorLabels:[],setSensorLabels(n){t({sensorLabels:[...n]})},dailyPvYield:[],setDailyPvYield(n){t({dailyPvYield:[...n]}),dt.getState().set(o=>{o.runEvolution&&o.objectiveEvaluationIndex++})},sumDailyPvYield(){let n=0;for(const o of this.dailyPvYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},getDailyPvProfit(){const n=this.sumDailyPvYield(),o=ye.countAllSolarPanels();return n*H.getState().economicsParams.electricitySellingPrice-o*H.getState().economicsParams.operationalCostPerUnit},yearlyPvYield:[],setYearlyPvYield(n){t({yearlyPvYield:[...n]}),dt.getState().set(o=>(o.runEvolution&&o.objectiveEvaluationIndex++,o))},sumYearlyPvYield(){var r;let n=0;for(const i of this.yearlyPvYield)for(const a in i)Object.hasOwn(i,a)&&a!=="Month"&&(n+=i[a]);const o=12/(((r=H.getState().world)==null?void 0:r.daysPerYear)??6);return n*o},getYearlyPvProfit(){const n=ye.countAllSolarPanels();return this.sumYearlyPvYield()*H.getState().economicsParams.electricitySellingPrice-n*H.getState().economicsParams.operationalCostPerUnit*365},solarPanelLabels:[],setSolarPanelLabels(n){t({solarPanelLabels:[...n]})},solarPanelVisibilityResults:new Map,setSolarPanelVisibilityResult(n,o){t(r=>(r.solarPanelVisibilityResults.set(n,o),r))},clearSolarPanelVisibilityResults(){t({solarPanelVisibilityResults:new Map})},dailyParabolicDishYield:[],setDailyParabolicDishYield(n){t({dailyParabolicDishYield:[...n]})},sumDailyParabolicDishYield(){let n=0;for(const o of this.dailyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicDishYield:[],setYearlyParabolicDishYield(n){t({yearlyParabolicDishYield:[...n]})},sumYearlyParabolicDishYield(){let n=0;for(const o of this.yearlyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicDishLabels:[],setParabolicDishLabels(n){t({parabolicDishLabels:[...n]})},dailyParabolicTroughYield:[],setDailyParabolicTroughYield(n){t({dailyParabolicTroughYield:[...n]})},sumDailyParabolicTroughYield(){let n=0;for(const o of this.dailyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicTroughYield:[],setYearlyParabolicTroughYield(n){t({yearlyParabolicTroughYield:[...n]})},sumYearlyParabolicTroughYield(){let n=0;for(const o of this.yearlyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicTroughLabels:[],setParabolicTroughLabels(n){t({parabolicTroughLabels:[...n]})},dailyFresnelReflectorYield:[],setDailyFresnelReflectorYield(n){t({dailyFresnelReflectorYield:[...n]})},sumDailyFresnelReflectorYield(){let n=0;for(const o of this.dailyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyFresnelReflectorYield:[],setYearlyFresnelReflectorYield(n){t({yearlyFresnelReflectorYield:[...n]})},sumYearlyFresnelReflectorYield(){let n=0;for(const o of this.yearlyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},fresnelReflectorLabels:[],setFresnelReflectorLabels(n){t({fresnelReflectorLabels:[...n]})},dailyHeliostatYield:[],setDailyHeliostatYield(n){t({dailyHeliostatYield:[...n]})},sumDailyHeliostatYield(){let n=0;for(const o of this.dailyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyHeliostatYield:[],setYearlyHeliostatYield(n){t({yearlyHeliostatYield:[...n]})},sumYearlyHeliostatYield(){let n=0;for(const o of this.yearlyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},heliostatLabels:[],setHeliostatLabels(n){t({heliostatLabels:[...n]})},dailyUpdraftTowerResults:[],dailyUpdraftTowerYield:[],setDailyUpdraftTowerResults(n){t({dailyUpdraftTowerResults:[...n]})},setDailyUpdraftTowerYield(n){t({dailyUpdraftTowerYield:[...n]})},sumDailyUpdraftTowerYield(){let n=0;for(const o of this.dailyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyUpdraftTowerYield:[],setYearlyUpdraftTowerYield(n){t({yearlyUpdraftTowerYield:[...n]})},sumYearlyUpdraftTowerYield(){let n=0;for(const o of this.yearlyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},updraftTowerLabels:[],setUpdraftTowerLabels(n){t({updraftTowerLabels:[...n]})},heatmaps:new Map,setHeatmap(n,o){t(r=>(r.heatmaps.set(n,o),r))},getHeatmap(n){return e().heatmaps.get(n)},hourlyHeatExchangeArrayMap:new Map,setHourlyHeatExchangeArray(n,o){t(r=>(r.hourlyHeatExchangeArrayMap.set(n,o),r))},hourlySolarHeatGainArrayMap:new Map,setHourlySolarHeatGainArray(n,o){t(r=>(r.hourlySolarHeatGainArrayMap.set(n,o),r))},hourlySolarPanelOutputArrayMap:new Map,setHourlySolarPanelOutputArray(n,o){t(r=>(r.hourlySolarPanelOutputArrayMap.set(n,o),r))},totalBuildingHeater:0,setTotalBuildingHeater:n=>{t({totalBuildingHeater:n})},totalBuildingAc:0,setTotalBuildingAc:n=>{t({totalBuildingAc:n})},totalBuildingSolarPanel:0,setTotalBuildingSolarPanel:n=>{t({totalBuildingSolarPanel:n})},clearHeatmaps(){t(n=>(n.heatmaps.clear(),n))},clearDataStore(){t({heatmaps:new Map,hourlyHeatExchangeArrayMap:new Map,hourlySolarHeatGainArrayMap:new Map,hourlySolarPanelOutputArrayMap:new Map,solarPanelVisibilityResults:new Map,dailyLightSensorData:[],yearlyLightSensorData:[],sensorLabels:[],dailyPvYield:[],yearlyPvYield:[],solarPanelLabels:[],dailyParabolicDishYield:[],yearlyParabolicDishYield:[],parabolicDishLabels:[],dailyParabolicTroughYield:[],yearlyParabolicTroughYield:[],parabolicTroughLabels:[],dailyFresnelReflectorYield:[],yearlyFresnelReflectorYield:[],fresnelReflectorLabels:[],dailyHeliostatYield:[],yearlyHeliostatYield:[],heliostatLabels:[],dailyUpdraftTowerYield:[],dailyUpdraftTowerResults:[],yearlyUpdraftTowerYield:[],updraftTowerLabels:[]})},clearRoofVerticesMap(){t(n=>(n.roofSegmentVerticesMap.clear(),n.roofSegmentVerticesWithoutOverhangMap.clear(),n))}})),aHt="/aladdin/assets/roof_edge-DBy_1Q5D.png",Gg="/aladdin/assets/tiny_white_square-B_qAXRfa.png",lHt="/aladdin/assets/roof_01-BwuyLpwq.png",sHt="/aladdin/assets/roof_02-DAbYjnV7.png",cHt="/aladdin/assets/roof_03-haZGIixv.png",uHt="/aladdin/assets/roof_04-DDuwUcDr.png",dHt="/aladdin/assets/roof_05-CtBb5xIW.png",fHt="/aladdin/assets/roof_06-DuyyebV8.png",hHt="/aladdin/assets/roof_07-DXWGQN8a.png",pHt=new vf({color:"white",side:$i}),gHt=xe.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=Math.min(a,i,o/2),{width:s,horizontalMullionSpacing:c,verticalMullionSpacing:u,color:d}=e,f=3,p=1,m=s/2,y=g.useMemo(()=>Math.atan2(o/2,l),[o,l]),w=g.useMemo(()=>{if(l===0||o===0)return 0;const T=l/2+o**2/(8*l),R=T-l,M=Math.PI-y,D=R**2,k=T**2,N=D+k-2*D*Math.sin(M)**2-2*R*Math.sqrt((k-D*Math.sin(M)**2)*Math.cos(M)**2);return Math.sqrt(N)},[o,l,y]),x=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:d}),[d]),C=T=>new jl().moveTo(0,T).quadraticCurveTo(T,T,T,0).quadraticCurveTo(T,-T,0,-T).quadraticCurveTo(-T,-T,-T,0).quadraticCurveTo(-T,T,0,T),P=(T,R)=>{const M=T*R/(o/2),D=M/2+(R*2)**2/(8*M),k=Math.acos(Math.min(1,R/D)),N=Math.PI-k,U=new x5(0,M-D,D,D,k,N,!1,0).getPoints(24).map(W=>new ue(W.x,W.y));return new Uq(U)},A=g.useMemo(()=>{const T=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const M=o/(R+1);let D=M/2;R%2!==0&&(T.push(0),D=M);for(let k=0;k{const T=[];if(s===0)return T;const R=i/2-l,M=i-l,D=Math.ceil(M/c);let k=R;for(let N=0;N{const T=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const M=o/(R+1);let D=M/2;R%2!==0&&(D=M);for(let N=0;Nlh.jsx("group",{position:[0,0,i/2-l],rotation:[0,R,0],children:h.jsx(wa,{position:[0,0,T/2],args:[m,m,T,f,p],rotation:[$t,$t,0],receiveShadow:n,castShadow:n,children:x})});return h.jsxs("group",{name:"Window Mullion Group",position:[0,-.001,0],children:[e.horizontalMullion&&S.map((T,R)=>h.jsx(wa,{position:[0,0,T],args:[m,m,o,f,p],rotation:[0,0,$t],receiveShadow:n,castShadow:n,children:x},R)),e.verticalMullion&&(A==null?void 0:A.map((T,R)=>h.jsx(wa,{position:[T,0,-l/2],args:[m,m,i-l,f,p],rotation:[$t,$t,0],receiveShadow:n,castShadow:n,children:x},R))),l>0&&(v==null?void 0:v.map((T,R)=>{if(T===null)return null;const{shape:M,path:D}=T;return h.jsx(Q8,{position:[0,m/2,i/2-l],rotation:[$t,0,0],args:[M,{extrudePath:D,steps:12,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:x},R)})),w>0&&h.jsxs(h.Fragment,{children:[b(l,0),b(w,y),b(w,-y)]})]})}),mHt=xe.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=o/2,s=Math.min(a,i,l),{color:c,width:u,sillWidth:d}=e,f=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),p=u/2,m=p/2,y=o+u*3,w=u,x=g.useMemo(()=>{const[C,P]=[l+u,l],A=s+u,S=A/2+(C*2)**2/(8*A),v=Math.acos(Math.min(1,C/S)),b=Math.PI-v,T=A-S,R=s,M=R/2+(P*2)**2/(8*R),D=Math.acos(Math.min(1,P/M)),k=Math.PI-D,N=R-M,U=new x5(0,T,S,S,v,b,!1,0).getPoints(36),W=new x5(0,N,M,M,k,D,!0,0).getPoints(36);return new jl([...U,...W])},[a,i,o,u]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-m/2,0],children:[s>.1?h.jsx(Q8,{position:[0,m/2,i/2-s],rotation:[$t,0,0],args:[x,{depth:m,steps:1,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:f}):h.jsx(di,{position:[0,0,i/2],args:[o+2*u,m,u],castShadow:n,receiveShadow:n,children:f}),h.jsx(di,{position:[-o/2-p,0,-s/2],args:[u,m,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(di,{position:[o/2+p,0,-s/2],args:[u,m,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(di,{position:[0,0,-i/2-(d===0?0:w/2)],args:d===0?[o+2*u,m,u]:[y,d??u,w],castShadow:n,receiveShadow:n,children:f})]})}),Xde=xe.memo(({cy:t,dimension:e,wireframeData:n,drawBottom:o})=>{const[r,i,a,l]=e,{lineWidth:s,lineColor:c,selected:u,locked:d,opacity:f}=n,p=s/20,m=s/5,y=r/2,w=a/2,x=Math.min(l,a,y),C=6,P=1,A=(R,M)=>{const D=R/2+(M*2)**2/(8*R),k=Math.acos(Math.min(1,M/D)),N=Math.PI-k,U=new x5(0,R-D,D,D,k,N,!1,0).getPoints(24).map(W=>new ue(W.x,W.y));return new Uq(U)},S=R=>new jl().moveTo(0,R).quadraticCurveTo(R,R,R,0).quadraticCurveTo(R,-R,0,-R).quadraticCurveTo(-R,-R,-R,0).quadraticCurveTo(-R,R,0,R),v=g.useMemo(()=>new vf({color:c}),[c]),b=g.useMemo(()=>new vf({color:i0}),[]),T=(R,M)=>h.jsxs(h.Fragment,{children:[x>.1?h.jsx(Q8,{position:[0,0,a/2-x],rotation:[$t,0,0],args:[S(R),{extrudePath:A(x,y),steps:24,bevelEnabled:!1}],material:M}):h.jsx(wa,{args:[R,R,r,C,P],rotation:[0,0,$t],position:[0,0,w-R/2],material:M}),o&&h.jsx(wa,{args:[R,R,r,C,P],rotation:[0,0,$t],position:[0,0,-w],material:M}),h.jsx(wa,{args:[R,R,a-x,C,P],rotation:[$t,$t,0],position:[y,0,-x/2],material:M}),h.jsx(wa,{args:[R,R,a-x,C,P],rotation:[$t,$t,0],position:[-y,0,-x/2],material:M})]});return h.jsxs("group",{name:"Window Wireframe Group",children:[f>0&&h.jsx("group",{position:[0,t,0],children:T(p,v)}),d&&u&&T(m,b)]})}),yHt=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:m,foundation:y})=>{const w=H.getState().world,x=H(Y5),C=H(J3),P=H(K3),A=H(xs),S=In(PS),v=g.useRef(0),b=g.useRef(),[T,R,M,D]=e,[k,N,U]=n,W=(G,Q)=>{if(D>0){const oe=.5*T,ee=.5*M,$=Math.min(D,M,oe),ae=.5*($+oe*oe/$);if(Math.abs(G)-ee)return!0;const Z=Q-(M-ae-ee);return G*G+Z*Z{if(!d||m||y&&y.notBuilding)return;const G=S.get(t);if(!G)return;const Q=G.reduce((q,le)=>q+le,0);if(f===0)return;const oe=X3*(w.solarRadiationHeatmapGridCellSize??.5),ee=Math.max(2,Math.round(T/oe)),$=Math.max(2,Math.round(M/oe)),ae=T/ee,Z=M/$,ne=Q/f*(x??Ny);v.current=ne<0?1:0,b.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(ne)*$t);const te=[];if(ne<0)for(let q=0;qc*T,[T,c]),L=g.useMemo(()=>M-Math.min(D,M,T/2),[T,M,D]),j=g.useMemo(()=>(E+r.width+T)/2*1.025,[T,E,r.width]),Y=g.useMemo(()=>-Math.min(D,M,T/2)/2,[M,L]),O=g.useMemo(()=>NX(T,M,D),[T,M,D]),_=(G,Q,oe)=>h.jsx(yi,{name:"Window Seal Plane",args:G,position:Q,rotation:oe,material:pHt,receiveShadow:A,castShadow:A});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Arched Window Plane Group",position:[0,N,0],children:[h.jsxs("mesh",{name:"Window Glass mesh",rotation:[$t,0,0],children:[h.jsx("shapeGeometry",{args:[O]}),u]}),(o.horizontalMullion||o.verticalMullion)&&D!==void 0&&h.jsx(gHt,{dimension:e,mullionData:o,shadowEnabled:A})]}),r.showFrame&&h.jsx(mHt,{dimension:e,frameData:r,shadowEnabled:A}),h.jsx(Xde,{cy:N,dimension:e,wireframeData:i,drawBottom:!0}),h.jsx(J3e,{cx:j,cz:Y,lx:E,lz:L,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),_([R,M],[-T/2,R/2,0],[$t,$t,0]),_([R,M],[T/2,R/2,0],[$t,-$t,0]),_([T,R],[0,R/2,-M/2]),F&&F.map((G,Q)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:G,name:"Heat Flux "+Q,lineWidth:P??Uy,color:C??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:G[v.current].clone().add(new ue(0,v.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:b.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??Fu})})]},Q))]})},NX=(t,e,n,o=0,r=0)=>{const i=new jl,a=t/2,l=e/2,s=Math.min(n,e,a);if(i.moveTo(o-a,r-l),i.lineTo(o+a,r-l),i.lineTo(o+a,r+l-s),s>.01){const c=s/2+t**2/(8*s),[u,d]=[o,r+l-c],f=Math.acos(Math.min(1,a/c)),p=Math.PI-f;i.absarc(u,d,c,f,p,!1)}else i.lineTo(o-a,r+l);return i.closePath(),i},AHt=xe.memo(yHt),wHt=1,xHt=3,vHt=new vf({color:"white",side:zr}),bHt=new cn(0,0,-$t),SHt=xe.memo(({dimension:t,polygonTop:e,frameData:n,shadowEnabled:o})=>{const[r,i,a]=t,[l,s]=e,{color:c,width:u,sillWidth:d}=n,f=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),[p,m]=[r/2,a/2],w=u/2/2,x=r+u*3,C=u,P=g.useMemo(()=>{const v=new ue(p,-m),b=new ue(p,m),T=new ue(-p,m),R=new ue(-p,-m),M=new ue(l*r,s+m);return[v,b,M,T,R]},[p,m,l,s]),A=g.useMemo(()=>{const v=[];for(let R=1;R{const v=new jl;for(let b=0;b=0;b--){const T=P[b];v.lineTo(T.x,T.y)}return v.closePath(),v},[P,A]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-w/2,0],children:[h.jsx(Q8,{position:[0,w/2,0],rotation:[$t,0,0],args:[S,{steps:1,depth:w,bevelEnabled:!1}],children:f}),h.jsx(di,{position:[0,0,-a/2-(d===0?0:C/2)],args:d===0?[r+2*u,w,u]:[x,d??u,C],castShadow:o,receiveShadow:o,children:f})]})}),THt=({id:t,dimension:e,polygonTop:n,position:o,glassMaterial:r,empty:i,interior:a,wireframeData:l,frameData:s,leftShutter:c,rightShutter:u,shutterColor:d,shutterWidth:f,area:p,showHeatFluxes:m,foundation:y})=>{const w=H.getState().world,x=H(Y5),C=H(J3),P=H(K3),A=In(PS),S=g.useRef(0),v=g.useRef(),[b,T,R]=o,[M,D,k]=e,[N,U,W]=e.map(pe=>pe/2),[F,E]=n,{lineWidth:L,lineColor:j,selected:Y,locked:O,opacity:_}=l,G=F*M,Q=Math.hypot(E,N-G),oe=Math.asin(E/Q),ee=Math.hypot(E,N+G),$=-Math.asin(E/ee),ae=H(xs),Z=(pe,Ie)=>{const ve=.5*M,ze=.5*(k+n[1]),Ae=n[1],se=[{x:-ve,y:-ze},{x:ve,y:-ze},{x:ve,y:ze-Ae},{x:M*n[0],y:ze},{x:-ve,y:ze-Ae}];return ye.isPointInside(pe,Ie,se)},ne=g.useMemo(()=>{if(!m||a||y&&y.notBuilding)return;const pe=A.get(t);if(!pe)return;const Ie=pe.reduce((Te,Re)=>Te+Re,0);if(p===0)return;const ve=X3*(w.solarRadiationHeatmapGridCellSize??.5),ze=k+n[1],Ae=Math.max(2,Math.round(M/ve)),se=Math.max(2,Math.round(ze/ve)),ge=M/Ae,we=ze/se,Se=Ie/p*(x??Ny);S.current=Se<0?1:0,v.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(Se)*$t);const Me=[],Ce=n[1]/2;if(Se<0)for(let Te=0;Tef*M,[M,f]),q=g.useMemo(()=>(te+s.width+M)/2*1.025,[M,te,s.width]),le=g.useMemo(()=>{const[pe,Ie]=[M/2,k/2],ve=F*M;return UX(pe,Ie,ve,E)},[M,k,F,E]),de=g.useMemo(()=>Y&&O?new vf({color:i0}):new vf({color:j}),[j,Y,O]),he=g.useMemo(()=>O&&Y?L/5:L/20,[L,Y,O]),me=g.useMemo(()=>O&&Y?-D/2:-T,[T,D,Y,O]),ce=(pe,Ie=0)=>h.jsx(wa,{args:[he,he,pe,xHt,wHt],position:[Ie,me,0],rotation:[0,0,$t],material:de}),Pe=(pe,Ie=0)=>h.jsx(yi,{args:[pe,D],position:[Ie,0,0],material:vHt,receiveShadow:ae,castShadow:ae});return h.jsxs(h.Fragment,{children:[!i&&h.jsxs("mesh",{name:"Triangle Glass Plane",position:[0,T,0],rotation:[$t,0,0],children:[h.jsx("shapeGeometry",{args:[le]}),r]}),s.showFrame&&h.jsx(SHt,{dimension:e,polygonTop:n,frameData:s,shadowEnabled:ae}),h.jsx(J3e,{cx:q,lx:te,lz:k,color:d,showLeft:c,showRight:u,spacing:s.showFrame?s.width/2:0}),h.jsxs("group",{position:[0,U,-W+.001],children:[Pe(M),ce(M)]}),h.jsxs("group",{position:[-N+.001,U,0],rotation:[0,$t,0],children:[Pe(k),ce(k)]}),h.jsxs("group",{position:[N-.001,U,0],rotation:[0,-$t,0],children:[Pe(k),ce(k)]}),h.jsxs("group",{position:[-N+.001,U,W-.01],rotation:[0,$,0],children:[Pe(ee,ee/2),ce(ee,ee/2)]}),h.jsxs("group",{position:[N-.001,U,W-.01],rotation:[0,oe,0],children:[Pe(Q,-Q/2),ce(Q,-Q/2)]}),ne&&ne.map((pe,Ie)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:pe,name:"Heat Flux "+Ie,lineWidth:P??Uy,color:C??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:pe[S.current].clone().add(new ue(0,S.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:v.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??Fu})})]},Ie))]})},UX=(t,e,n,o,r=0,i=0)=>{const a=new jl;return a.moveTo(r-t,i-e),a.lineTo(r+t,i-e),a.lineTo(r+t,i+e),a.lineTo(r+n,i+e+o),a.lineTo(r-t,i+e),a.closePath(),a},PHt=xe.memo(THt),CHt=({id:t,index:e,foundationModel:n,roofType:o,segment:r,centroid:i,thickness:a,color:l,sideColor:s,texture:c,heatmap:u,windows:d})=>{const f=H($3),p=dt(n6),m=H(Y5),y=H(J3),w=H(K3),x=In(UN),{transparent:C,opacity:P}=pI(),A=g.useRef(0),S=g.useRef(),v=g.useRef(),b=H.getState().world,T=In.getState().hourlyHeatExchangeArrayMap,{points:R}=r,M=g.useMemo(()=>{if(!p)return;const k=x(t);if(!k)return;const N=[],U=new ue(0,0,a+.1);switch(o){case Zo.Hip:case Zo.Pyramid:for(const W of k){const F=[];F.push(W[0].clone().sub(i).add(U)),F.push(W[1].clone().sub(i).add(U)),N.push(F)}break;case Zo.Mansard:for(const[W,F]of k.entries()){if(W===k.length-1)continue;const E=[];E.push(F[0].clone().sub(i).add(U)),E.push(F[1].clone().sub(i).add(U)),N.push(E)}break;case Zo.Gambrel:for(const[W,F]of k.entries()){if(W===0||W===3){const L=[];L.push(F[0].clone().sub(i).add(U)),L.push(F[1].clone().sub(i).add(U)),N.push(L)}let E=[];E.push(F[0].clone().sub(i).add(U)),E.push(F[3].clone().sub(i).add(U)),N.push(E),E=[],E.push(F[1].clone().sub(i).add(U)),E.push(F[2].clone().sub(i).add(U)),N.push(E)}break}return N},[p]),D=g.useMemo(()=>{if(!p||n&&n.notBuilding)return;const k=T.get(t+"-"+e);if(!k)return;const N=k.reduce((ge,we)=>ge+we,0),U=x(t);if(!U||!U[e])return;const[W,F,E,L,j]=R,Y=j.z-W.z,O=U[e].map(ge=>ge.clone().sub(i).add(new ue(0,0,Y)));if(!O)return;const _=[];for(const ge of O)_.push({x:ge.x,y:ge.y});const G=X3*(b.solarRadiationHeatmapGridCellSize??.5),Q=O[0].clone(),oe=O[1].clone(),ee=O[2].clone(),$=new ue().subVectors(oe,Q),ae=new ue().subVectors(ee,Q),Z=new ue().subVectors(ee,oe),ne=$.length(),te=new ue().crossVectors(ae,Z).length()/ne,q=Math.max(2,Math.floor(ne/G)),le=Math.max(2,Math.floor(te/G));$.normalize(),ae.normalize(),Z.normalize();const de=new ue().crossVectors(ae,Z).normalize(),he=$.multiplyScalar(.5*ne/q),me=new ue().crossVectors(de,$).normalize().multiplyScalar(.5*te/le),ce=Q.clone().add(he).add(me);he.multiplyScalar(2),me.multiplyScalar(2),S.current=de.clone().multiplyScalar(.1);const Pe=[],pe=new ue;let Ie=O.length===4?ye.getTriangleArea(O[0],O[1],O[2])+ye.getTriangleArea(O[2],O[3],O[0]):ye.getTriangleArea(O[0],O[1],O[2]);if(Ie===0)return;let ve=f(z.Window,t);const ze=x(t);if(ze&&ze[e]&&(ve=ve.filter(ge=>{const we=ge,Se=we.cy+(we.windowType===Ti.Polygonal&&we.polygonTop?we.polygonTop[1]/2:0);return Rn.onSegment(ze[e],ge.cx,Se)})),ve&&ve.length>0)for(const ge of ve)Ie-=ye.getWindowArea(ge);const Ae=N/Ie*(m??Ny);A.current=Ae<0?1:0,v.current=ye.getEuler(Oo,de,"YXZ",-Math.sign(Ae)*$t);let se;for(let ge=0;ge0){const Me=pe.x+i.x,Ce=pe.y+i.y;for(const Te of ve){const Re=Rn.getRelativeWindowVerticesOnRoof(Te),Ne=ye.getPoints(Re);if(ye.isPointInside(Me,Ce,Ne)){se=!1;break}}}if(se&&ye.isPointInside(pe.x,pe.y,_)){const Me=[];Ae<0?(Me.push(pe.clone()),Me.push(pe.clone().add(de.clone().multiplyScalar(-Ae)))):(Me.push(pe.clone()),Me.push(pe.clone().add(de.clone().multiplyScalar(Ae)))),Pe.push(Me)}}}return Pe},[p,m]);return h.jsxs(h.Fragment,{children:[h.jsx(DJe,{id:t,index:e,segment:r,color:l,sideColor:s,texture:c,heatmap:u,transparent:C,opacity:P,windows:d,centroid:i}),M&&M.map((k,N)=>h.jsx(On,{points:k,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+N},N)),D&&D.map((k,N)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:k,name:"Heat Flux "+N,lineWidth:w??Uy,color:y??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:S.current?k[A.current].clone().add(S.current):k[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head "+N,rotation:v.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:y??Fu})})]},N))]})},DJe=xe.memo(({id:t,index:e,segment:n,color:o,sideColor:r,texture:i,heatmap:a,transparent:l,opacity:s,windows:c,centroid:u})=>{const d=dt(vs),f=g.useRef(null),{points:p}=n,m=d?a:i,y=p.length===6,w=p.length===8,x=g.useMemo(()=>c.map(R=>{const M=new ue(R.lx,R.lz,R.ly*2),D=new ue(R.cx,R.cy,R.cz).sub(u),k=new cn().fromArray([R.rotation[0],R.rotation[1],R.rotation[2],"ZXY"]);if(R.windowType===Ti.Polygonal){const[N,U]=R.polygonTop??P1,[W,F,E]=[M.x/2,M.y/2,N*M.x],L=UX(W,F,E,U),j=new os(new C3([L],{steps:1,depth:M.z,bevelEnabled:!1})),Y=new ue(0,0,-M.z).applyEuler(k);return j.position.copy(D.clone().add(Y)),j.rotation.copy(k),j.updateMatrix(),j}else if(R.windowType===Ti.Arched){const N=NX(M.x,M.y,R.archHeight),U=new os(new C3([N],{steps:1,depth:M.z,bevelEnabled:!1})),W=new ue(0,0,-M.z).applyEuler(k);return U.position.copy(D.clone().add(W)),U.rotation.copy(k),U.updateMatrix(),U}else{const N=new os(new V3(M.x,M.y,M.z));return N.position.copy(D),N.rotation.copy(k),N.updateMatrix(),N}}),[c,u]),C=A()??6,P=g.useMemo(()=>Array(C).fill(0),[C]);if(g.useEffect(()=>{A()},[]),!y&&!w)return null;function A(){if(!f.current||!y&&!w)return;const R=f.current.geometry;R.index=null,R.clearGroups();const M=[],D=[];let k=0,N=0;if(y){const j=p.slice(p.length/2);U(j),d?F():W(j),E(3);const Y=p.slice(0,p.length/2).reverse();U(Y),D.push(0,0,1,0,0,1),E(3),L([[0,1,4,3],[1,2,5,4],[2,0,3,5]])}else if(w){const j=p.slice(p.length/2),[Y,O]=S(j);U(Y),U(O);const[_,G,Q,oe]=j,ee=Y[2].equals(oe);if(d)F(ee);else{const ne=new ue().subVectors(G,_),te=new ue().subVectors(Q,_),q=new ue().subVectors(oe,_),de=new _t(G.x-_.x,G.y-_.y).length(),he=de,me=0,ce=ne.dot(te)/de,Pe=ne.clone().cross(te).length()/de,pe=ne.dot(q)/de,Ie=ne.clone().cross(q).length()/de;ee?(D.push(0,0,he,me,pe,Ie),D.push(he,me,ce,Pe,pe,Ie)):(D.push(0,0,he,me,ce,Pe),D.push(0,0,ce,Pe,pe,Ie))}E(6);const $=p.slice(0,p.length/2),[ae,Z]=S($);U(ae.reverse()),U(Z.reverse()),D.push(0,0,1,0,0,1),D.push(0,1,1,0,1,1),E(6),L([[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7]])}else throw new Error("segment is neither quad nor tri");if(R.setAttribute("position",new Ar(M,3)),R.setAttribute("uv",new Ar(D,2)),R.computeVertexNormals(),R.computeBoundingSphere(),c.length>0){const j=[];for(let O=0;O$.concat(p[ae].x,p[ae].y,p[ae].z),[]),ee=[Q,_,G].reduce(($,ae)=>$.concat(p[ae].x,p[ae].y,p[ae].z),[]);M.push(...oe),M.push(...ee),D.push(0,0,1,0,0,1),D.push(0,1,1,0,1,1),E(6)}}}function S(R){const[M,D,k,N]=R,U=ye.distanceFromPointToLine2D(N,M,D),W=ye.distanceFromPointToLine2D(k,M,D),F=[],E=[];return Math.abs(U-W)<.01?M.z>D.z?(F.push(M,D,k),E.push(M,k,N)):(F.push(M,D,N),E.push(D,k,N)):U<=W?(F.push(M,D,N),E.push(D,k,N)):(F.push(M,D,k),E.push(M,k,N)),[F,E]}const v=({i:R})=>h.jsx("meshBasicMaterial",{attach:`material-${R}`,map:m,transparent:l,opacity:s}),b=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:o,map:m,transparent:l,opacity:s}),T=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:r,transparent:l,opacity:s});return h.jsx("mesh",{ref:f,name:`Buffer Roof Segment ${e}`,uuid:t+"-"+e,userData:{simulation:!0},receiveShadow:!d,castShadow:!0,frustumCulled:!1,children:P.map((R,M)=>M!==0?h.jsx(T,{i:M},"side"+M):d?h.jsx(v,{i:M},"heatmap"+M):h.jsx(b,{i:M},"texture"+M))})}),IQ=xe.memo(CHt),RHt=({cz:t,points:e})=>{const n=new jl;n.moveTo(e[0].x,e[0].y);for(const{x:o,y:r}of e)n.lineTo(o,r);return n.closePath(),h.jsx(Q8,{scale:.99,position:[0,0,t],args:[n,{steps:1,depth:.1,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{side:zr,color:"white"})})},tU=xe.memo(RHt);function Qy(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;o3&&arguments[3]!==void 0?arguments[3]:!1;return e.length&&o&&n===void 0&&!a3(t,e.slice(0,-1))?t:GKe(t,e,n,o)}function Gzt(t){return Vr(t)==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function aSe(t){return Array.isArray(t)?[]:{}}var Xzt=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function XE(){for(var t=arguments.length,e=new Array(t),n=0;n1e4){var o=Date.now();this.lastAccessBeat.forEach(function(r,i){o-r>qzt&&(n.map.delete(i),n.lastAccessBeat.delete(i))}),this.accessBeat=0}}}]),t}(),uSe=new Qzt;function Zzt(t,e){return xe.useMemo(function(){var n=uSe.get(e);if(n)return n;var o=t();return uSe.set(e,o),o},e)}var eDt=function(){return{}};function tDt(t){var e=t.useCSP,n=e===void 0?eDt:e,o=t.useToken,r=t.usePrefix,i=t.getResetStyles,a=t.getCommonStyle,l=t.getCompUnitless;function s(f,p,m,y){var w=Array.isArray(f)?f[0]:f;function x(T){return"".concat(String(w)).concat(T.slice(0,1).toUpperCase()).concat(T.slice(1))}var C=(y==null?void 0:y.unitless)||{},P=typeof l=="function"?l(f):{},A=h1(h1({},P),{},l5({},x("zIndexPopup"),!0));Object.keys(C).forEach(function(T){A[x(T)]=C[T]});var S=h1(h1({},y),{},{unitless:A,prefixToken:x}),v=u(f,p,m,S),b=c(w,m,S);return function(T){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:T,M=v(T,R),D=fG(M,2),k=D[1],N=b(R),U=fG(N,2),W=U[0],F=U[1];return[W,k,F]}}function c(f,p,m){var y=m.unitless,w=m.injectStyle,x=w===void 0?!0:w,C=m.prefixToken,P=m.ignore,A=function(b){var T=b.rootCls,R=b.cssVar,M=R===void 0?{}:R,D=o(),k=D.realToken;return WIt({path:[f],prefix:M.prefix,key:M.key,unitless:y,ignore:P,token:k,scope:T},function(){var N=cSe(f,k,p),U=lSe(f,k,N,{deprecatedTokens:m==null?void 0:m.deprecatedTokens});return Object.keys(N).forEach(function(W){U[C(W)]=U[W],delete U[W]}),U}),null},S=function(b){var T=o(),R=T.cssVar;return[function(M){return x&&R?xe.createElement(xe.Fragment,null,xe.createElement(A,{rootCls:b,cssVar:R,component:f}),M):M},R==null?void 0:R.key]};return S}function u(f,p,m){var y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},w=Array.isArray(f)?f:[f,f],x=fG(w,1),C=x[0],P=w.join("-"),A=t.layer||{name:"antd"};return function(S){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:S,b=o(),T=b.theme,R=b.realToken,M=b.hashId,D=b.token,k=b.cssVar,N=r(),U=N.rootPrefixCls,W=N.iconPrefixCls,F=n(),E=k?"css":"js",L=Zzt(function(){var Q=new Set;return k&&Object.keys(y.unitless||{}).forEach(function(oe){Q.add(rG(oe,k.prefix)),Q.add(rG(oe,iSe(C,k.prefix)))}),Ozt(E,Q)},[E,C,k==null?void 0:k.prefix]),j=$zt(E),Y=j.max,O=j.min,_={theme:T,token:D,hashId:M,nonce:function(){return F.nonce},clientOnly:y.clientOnly,layer:A,order:y.order||-999};typeof i=="function"&&dfe(h1(h1({},_),{},{clientOnly:!1,path:["Shared",U]}),function(){return i(D,{prefix:{rootPrefixCls:U,iconPrefixCls:W},csp:F})});var G=dfe(h1(h1({},_),{},{path:[P,S,W]}),function(){if(y.injectStyle===!1)return[];var Q=Kzt(D),oe=Q.token,ee=Q.flush,q=cSe(C,R,m),ae=".".concat(S),Z=lSe(C,R,q,{deprecatedTokens:y.deprecatedTokens});k&&q&&z5(q)==="object"&&Object.keys(q).forEach(function(le){q[le]="var(".concat(rG(le,iSe(C,k.prefix)),")")});var ne=Ui(oe,{componentCls:ae,prefixCls:S,iconCls:".".concat(W),antCls:".".concat(U),calc:L,max:Y,min:O},k?q:Z),te=p(ne,{hashId:M,prefixCls:S,rootPrefixCls:U,iconPrefixCls:W});ee(C,Z);var $=typeof a=="function"?a(ne,S,v,y.resetFont):null;return[y.resetStyle===!1?null:$,te]});return[G,M]}}function d(f,p,m){var y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},w=u(f,p,m,h1({resetStyle:!1,order:-998},y)),x=function(P){var A=P.prefixCls,S=P.rootCls,v=S===void 0?A:S;return w(A,v),null};return x}return{genStyleHooks:s,genSubStyleComponent:d,genComponentStyleHook:u}}const Gb=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"],nDt="5.23.4";function hle(t){return t>=0&&t<=255}function zO(t,e){const{r:n,g:o,b:r,a:i}=new Di(t).toRgb();if(i<1)return t;const{r:a,g:l,b:s}=new Di(e).toRgb();for(let c=.01;c<=1;c+=.01){const u=Math.round((n-a*(1-c))/c),d=Math.round((o-l*(1-c))/c),f=Math.round((r-s*(1-c))/c);if(hle(u)&&hle(d)&&hle(f))return new Di({r:u,g:d,b:f,a:Math.round(c*100)/100}).toRgbString()}return new Di({r:n,g:o,b:r,a:1}).toRgbString()}var oDt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{delete o[f]});const r=Object.assign(Object.assign({},n),o),i=480,a=576,l=768,s=992,c=1200,u=1600;if(r.motion===!1){const f="0s";r.motionDurationFast=f,r.motionDurationMid=f,r.motionDurationSlow=f}return Object.assign(Object.assign(Object.assign({},r),{colorFillContent:r.colorFillSecondary,colorFillContentHover:r.colorFill,colorFillAlter:r.colorFillQuaternary,colorBgContainerDisabled:r.colorFillTertiary,colorBorderBg:r.colorBgContainer,colorSplit:zO(r.colorBorderSecondary,r.colorBgContainer),colorTextPlaceholder:r.colorTextQuaternary,colorTextDisabled:r.colorTextQuaternary,colorTextHeading:r.colorText,colorTextLabel:r.colorTextSecondary,colorTextDescription:r.colorTextTertiary,colorTextLightSolid:r.colorWhite,colorHighlight:r.colorError,colorBgTextHover:r.colorFillSecondary,colorBgTextActive:r.colorFill,colorIcon:r.colorTextTertiary,colorIconHover:r.colorText,colorErrorOutline:zO(r.colorErrorBg,r.colorBgContainer),colorWarningOutline:zO(r.colorWarningBg,r.colorBgContainer),fontSizeIcon:r.fontSizeSM,lineWidthFocus:r.lineWidth*3,lineWidth:r.lineWidth,controlOutlineWidth:r.lineWidth*2,controlInteractiveSize:r.controlHeight/2,controlItemBgHover:r.colorFillTertiary,controlItemBgActive:r.colorPrimaryBg,controlItemBgActiveHover:r.colorPrimaryBgHover,controlItemBgActiveDisabled:r.colorFill,controlTmpOutline:r.colorFillQuaternary,controlOutline:zO(r.colorPrimaryBg,r.colorBgContainer),lineType:r.lineType,borderRadius:r.borderRadius,borderRadiusXS:r.borderRadiusXS,borderRadiusSM:r.borderRadiusSM,borderRadiusLG:r.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:r.sizeXXS,paddingXS:r.sizeXS,paddingSM:r.sizeSM,padding:r.size,paddingMD:r.sizeMD,paddingLG:r.sizeLG,paddingXL:r.sizeXL,paddingContentHorizontalLG:r.sizeLG,paddingContentVerticalLG:r.sizeMS,paddingContentHorizontal:r.sizeMS,paddingContentVertical:r.sizeSM,paddingContentHorizontalSM:r.size,paddingContentVerticalSM:r.sizeXS,marginXXS:r.sizeXXS,marginXS:r.sizeXS,marginSM:r.sizeSM,margin:r.size,marginMD:r.sizeMD,marginLG:r.sizeLG,marginXL:r.sizeXL,marginXXL:r.sizeXXL,boxShadow:` + */var _5e=Symbol.for("react.element"),V5e=Symbol.for("react.portal"),QQ=Symbol.for("react.fragment"),ZQ=Symbol.for("react.strict_mode"),eZ=Symbol.for("react.profiler"),tZ=Symbol.for("react.provider"),nZ=Symbol.for("react.context"),_zt=Symbol.for("react.server_context"),oZ=Symbol.for("react.forward_ref"),rZ=Symbol.for("react.suspense"),iZ=Symbol.for("react.suspense_list"),aZ=Symbol.for("react.memo"),lZ=Symbol.for("react.lazy"),Vzt=Symbol.for("react.offscreen"),OKe;OKe=Symbol.for("react.module.reference");function t2(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case _5e:switch(t=t.type,t){case QQ:case eZ:case ZQ:case rZ:case iZ:return t;default:switch(t=t&&t.$$typeof,t){case _zt:case nZ:case oZ:case lZ:case aZ:case tZ:return t;default:return e}}case V5e:return e}}}Ss.ContextConsumer=nZ;Ss.ContextProvider=tZ;Ss.Element=_5e;Ss.ForwardRef=oZ;Ss.Fragment=QQ;Ss.Lazy=lZ;Ss.Memo=aZ;Ss.Portal=V5e;Ss.Profiler=eZ;Ss.StrictMode=ZQ;Ss.Suspense=rZ;Ss.SuspenseList=iZ;Ss.isAsyncMode=function(){return!1};Ss.isConcurrentMode=function(){return!1};Ss.isContextConsumer=function(t){return t2(t)===nZ};Ss.isContextProvider=function(t){return t2(t)===tZ};Ss.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===_5e};Ss.isForwardRef=function(t){return t2(t)===oZ};Ss.isFragment=function(t){return t2(t)===QQ};Ss.isLazy=function(t){return t2(t)===lZ};Ss.isMemo=function(t){return t2(t)===aZ};Ss.isPortal=function(t){return t2(t)===V5e};Ss.isProfiler=function(t){return t2(t)===eZ};Ss.isStrictMode=function(t){return t2(t)===ZQ};Ss.isSuspense=function(t){return t2(t)===rZ};Ss.isSuspenseList=function(t){return t2(t)===iZ};Ss.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===QQ||t===eZ||t===ZQ||t===rZ||t===iZ||t===Vzt||typeof t=="object"&&t!==null&&(t.$$typeof===lZ||t.$$typeof===aZ||t.$$typeof===tZ||t.$$typeof===nZ||t.$$typeof===oZ||t.$$typeof===OKe||t.getModuleId!==void 0)};Ss.typeOf=t2;YKe.exports=Ss;var _Ke=YKe.exports;function G5e(t,e){typeof t=="function"?t(e):Vr(t)==="object"&&t&&"current"in t&&(t.current=e)}function oU(){for(var t=arguments.length,e=new Array(t),n=0;n3&&arguments[3]!==void 0?arguments[3]:!1;return e.length&&o&&n===void 0&&!a3(t,e.slice(0,-1))?t:GKe(t,e,n,o)}function Gzt(t){return Vr(t)==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function aSe(t){return Array.isArray(t)?[]:{}}var Xzt=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function XE(){for(var t=arguments.length,e=new Array(t),n=0;n1e4){var o=Date.now();this.lastAccessBeat.forEach(function(r,i){o-r>qzt&&(n.map.delete(i),n.lastAccessBeat.delete(i))}),this.accessBeat=0}}}]),t}(),uSe=new Qzt;function Zzt(t,e){return xe.useMemo(function(){var n=uSe.get(e);if(n)return n;var o=t();return uSe.set(e,o),o},e)}var eDt=function(){return{}};function tDt(t){var e=t.useCSP,n=e===void 0?eDt:e,o=t.useToken,r=t.usePrefix,i=t.getResetStyles,a=t.getCommonStyle,l=t.getCompUnitless;function s(f,p,m,y){var w=Array.isArray(f)?f[0]:f;function x(T){return"".concat(String(w)).concat(T.slice(0,1).toUpperCase()).concat(T.slice(1))}var C=(y==null?void 0:y.unitless)||{},P=typeof l=="function"?l(f):{},A=h1(h1({},P),{},l5({},x("zIndexPopup"),!0));Object.keys(C).forEach(function(T){A[x(T)]=C[T]});var S=h1(h1({},y),{},{unitless:A,prefixToken:x}),v=u(f,p,m,S),b=c(w,m,S);return function(T){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:T,M=v(T,R),D=fG(M,2),k=D[1],N=b(R),U=fG(N,2),W=U[0],F=U[1];return[W,k,F]}}function c(f,p,m){var y=m.unitless,w=m.injectStyle,x=w===void 0?!0:w,C=m.prefixToken,P=m.ignore,A=function(b){var T=b.rootCls,R=b.cssVar,M=R===void 0?{}:R,D=o(),k=D.realToken;return WIt({path:[f],prefix:M.prefix,key:M.key,unitless:y,ignore:P,token:k,scope:T},function(){var N=cSe(f,k,p),U=lSe(f,k,N,{deprecatedTokens:m==null?void 0:m.deprecatedTokens});return Object.keys(N).forEach(function(W){U[C(W)]=U[W],delete U[W]}),U}),null},S=function(b){var T=o(),R=T.cssVar;return[function(M){return x&&R?xe.createElement(xe.Fragment,null,xe.createElement(A,{rootCls:b,cssVar:R,component:f}),M):M},R==null?void 0:R.key]};return S}function u(f,p,m){var y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},w=Array.isArray(f)?f:[f,f],x=fG(w,1),C=x[0],P=w.join("-"),A=t.layer||{name:"antd"};return function(S){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:S,b=o(),T=b.theme,R=b.realToken,M=b.hashId,D=b.token,k=b.cssVar,N=r(),U=N.rootPrefixCls,W=N.iconPrefixCls,F=n(),E=k?"css":"js",L=Zzt(function(){var Q=new Set;return k&&Object.keys(y.unitless||{}).forEach(function(oe){Q.add(rG(oe,k.prefix)),Q.add(rG(oe,iSe(C,k.prefix)))}),Ozt(E,Q)},[E,C,k==null?void 0:k.prefix]),j=$zt(E),Y=j.max,O=j.min,_={theme:T,token:D,hashId:M,nonce:function(){return F.nonce},clientOnly:y.clientOnly,layer:A,order:y.order||-999};typeof i=="function"&&dfe(h1(h1({},_),{},{clientOnly:!1,path:["Shared",U]}),function(){return i(D,{prefix:{rootPrefixCls:U,iconPrefixCls:W},csp:F})});var G=dfe(h1(h1({},_),{},{path:[P,S,W]}),function(){if(y.injectStyle===!1)return[];var Q=Kzt(D),oe=Q.token,ee=Q.flush,$=cSe(C,R,m),ae=".".concat(S),Z=lSe(C,R,$,{deprecatedTokens:y.deprecatedTokens});k&&$&&z5($)==="object"&&Object.keys($).forEach(function(le){$[le]="var(".concat(rG(le,iSe(C,k.prefix)),")")});var ne=Ui(oe,{componentCls:ae,prefixCls:S,iconCls:".".concat(W),antCls:".".concat(U),calc:L,max:Y,min:O},k?$:Z),te=p(ne,{hashId:M,prefixCls:S,rootPrefixCls:U,iconPrefixCls:W});ee(C,Z);var q=typeof a=="function"?a(ne,S,v,y.resetFont):null;return[y.resetStyle===!1?null:q,te]});return[G,M]}}function d(f,p,m){var y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},w=u(f,p,m,h1({resetStyle:!1,order:-998},y)),x=function(P){var A=P.prefixCls,S=P.rootCls,v=S===void 0?A:S;return w(A,v),null};return x}return{genStyleHooks:s,genSubStyleComponent:d,genComponentStyleHook:u}}const Gb=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"],nDt="5.23.4";function hle(t){return t>=0&&t<=255}function zO(t,e){const{r:n,g:o,b:r,a:i}=new Di(t).toRgb();if(i<1)return t;const{r:a,g:l,b:s}=new Di(e).toRgb();for(let c=.01;c<=1;c+=.01){const u=Math.round((n-a*(1-c))/c),d=Math.round((o-l*(1-c))/c),f=Math.round((r-s*(1-c))/c);if(hle(u)&&hle(d)&&hle(f))return new Di({r:u,g:d,b:f,a:Math.round(c*100)/100}).toRgbString()}return new Di({r:n,g:o,b:r,a:1}).toRgbString()}var oDt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{delete o[f]});const r=Object.assign(Object.assign({},n),o),i=480,a=576,l=768,s=992,c=1200,u=1600;if(r.motion===!1){const f="0s";r.motionDurationFast=f,r.motionDurationMid=f,r.motionDurationSlow=f}return Object.assign(Object.assign(Object.assign({},r),{colorFillContent:r.colorFillSecondary,colorFillContentHover:r.colorFill,colorFillAlter:r.colorFillQuaternary,colorBgContainerDisabled:r.colorFillTertiary,colorBorderBg:r.colorBgContainer,colorSplit:zO(r.colorBorderSecondary,r.colorBgContainer),colorTextPlaceholder:r.colorTextQuaternary,colorTextDisabled:r.colorTextQuaternary,colorTextHeading:r.colorText,colorTextLabel:r.colorTextSecondary,colorTextDescription:r.colorTextTertiary,colorTextLightSolid:r.colorWhite,colorHighlight:r.colorError,colorBgTextHover:r.colorFillSecondary,colorBgTextActive:r.colorFill,colorIcon:r.colorTextTertiary,colorIconHover:r.colorText,colorErrorOutline:zO(r.colorErrorBg,r.colorBgContainer),colorWarningOutline:zO(r.colorWarningBg,r.colorBgContainer),fontSizeIcon:r.fontSizeSM,lineWidthFocus:r.lineWidth*3,lineWidth:r.lineWidth,controlOutlineWidth:r.lineWidth*2,controlInteractiveSize:r.controlHeight/2,controlItemBgHover:r.colorFillTertiary,controlItemBgActive:r.colorPrimaryBg,controlItemBgActiveHover:r.colorPrimaryBgHover,controlItemBgActiveDisabled:r.colorFill,controlTmpOutline:r.colorFillQuaternary,controlOutline:zO(r.colorPrimaryBg,r.colorBgContainer),lineType:r.lineType,borderRadius:r.borderRadius,borderRadiusXS:r.borderRadiusXS,borderRadiusSM:r.borderRadiusSM,borderRadiusLG:r.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:r.sizeXXS,paddingXS:r.sizeXS,paddingSM:r.sizeSM,padding:r.size,paddingMD:r.sizeMD,paddingLG:r.sizeLG,paddingXL:r.sizeXL,paddingContentHorizontalLG:r.sizeLG,paddingContentVerticalLG:r.sizeMS,paddingContentHorizontal:r.sizeMS,paddingContentVertical:r.sizeSM,paddingContentHorizontalSM:r.size,paddingContentVerticalSM:r.sizeXS,marginXXS:r.sizeXXS,marginXS:r.sizeXS,marginSM:r.sizeSM,margin:r.size,marginMD:r.sizeMD,marginLG:r.sizeLG,marginXL:r.sizeXL,marginXXL:r.sizeXXL,boxShadow:` 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05) @@ -4378,7 +4378,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o=[],r=0;r=0)&&(n[r]=t[r]);return n}function zfe(t,e){if(t==null)return{};var n=vDt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var bDt=["children"],e$e=g.createContext({});function SDt(t){var e=t.children,n=zfe(t,bDt);return g.createElement(e$e.Provider,{value:n},e)}function t$e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gSe(t,e){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Efe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PDt(t,e){if(e&&($A(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Efe(t)}function r$e(t){var e=TDt();return function(){var o=$X(t),r;if(e){var i=$X(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return PDt(this,r)}}var CDt=function(t){o$e(n,t);var e=r$e(n);function n(){return t$e(this,n),e.apply(this,arguments)}return n$e(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function kd(t){var e=g.useRef();e.current=t;var n=g.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a1&&arguments[1]!==void 0?arguments[1]:2;e();var i=Hf(function(){r<=1?o({isCanceled:function(){return i!==t.current}}):n(o,r-1)});t.current=i}return g.useEffect(function(){return function(){e()}},[]),[n,e]};var kDt=[e5,ZC,eR,J5e],FDt=[e5,i$e],f$e=!1,LDt=!0;function h$e(t){return t===eR||t===J5e}const WDt=function(t,e,n){var o=wH(ASe),r=$w(o,2),i=r[0],a=r[1],l=EDt(),s=$w(l,2),c=s[0],u=s[1];function d(){a(e5,!0)}var f=e?FDt:kDt;return d$e(function(){if(i!==ASe&&i!==J5e){var p=f.indexOf(i),m=f[p+1],y=n(i);y===f$e?a(m,!0):m&&c(function(w){function x(){w.isCanceled()||a(m,!0)}y===!0?x():Promise.resolve(y).then(x)})}},[t,i]),g.useEffect(function(){return function(){u()}},[]),[d,i]};function NDt(t,e,n,o){var r=o.motionEnter,i=r===void 0?!0:r,a=o.motionAppear,l=a===void 0?!0:a,s=o.motionLeave,c=s===void 0?!0:s,u=o.motionDeadline,d=o.motionLeaveImmediately,f=o.onAppearPrepare,p=o.onEnterPrepare,m=o.onLeavePrepare,y=o.onAppearStart,w=o.onEnterStart,x=o.onLeaveStart,C=o.onAppearActive,P=o.onEnterActive,A=o.onLeaveActive,S=o.onAppearEnd,v=o.onEnterEnd,b=o.onLeaveEnd,T=o.onVisibleChanged,R=wH(),M=$w(R,2),D=M[0],k=M[1],N=HDt(Mw),U=$w(N,2),W=U[0],F=U[1],E=wH(null),L=$w(E,2),j=L[0],Y=L[1],O=W(),_=g.useRef(!1),G=g.useRef(null);function Q(){return n()}var oe=g.useRef(!1);function ee(){F(Mw),Y(null,!0)}var q=kd(function(ve){var ze=W();if(ze!==Mw){var Ae=Q();if(!(ve&&!ve.deadline&&ve.target!==Ae)){var se=oe.current,ge;ze===DO&&se?ge=S==null?void 0:S(Ae,ve):ze===EO&&se?ge=v==null?void 0:v(Ae,ve):ze===kO&&se&&(ge=b==null?void 0:b(Ae,ve)),se&&ge!==!1&&ee()}}}),ae=DDt(q),Z=$w(ae,1),ne=Z[0],te=function(ze){switch(ze){case DO:return vp(vp(vp({},e5,f),ZC,y),eR,C);case EO:return vp(vp(vp({},e5,p),ZC,w),eR,P);case kO:return vp(vp(vp({},e5,m),ZC,x),eR,A);default:return{}}},$=g.useMemo(function(){return te(O)},[O]),le=WDt(O,!t,function(ve){if(ve===e5){var ze=$[e5];return ze?ze(Q()):f$e}if(me in $){var Ae;Y(((Ae=$[me])===null||Ae===void 0?void 0:Ae.call($,Q(),null))||null)}return me===eR&&O!==Mw&&(ne(Q()),u>0&&(clearTimeout(G.current),G.current=setTimeout(function(){q({deadline:!0})},u))),me===i$e&&ee(),LDt}),de=$w(le,2),he=de[0],me=de[1],ce=h$e(me);oe.current=ce;var Pe=g.useRef(null);d$e(function(){if(!(_.current&&Pe.current===e)){k(e);var ve=_.current;_.current=!0;var ze;!ve&&e&&l&&(ze=DO),ve&&e&&i&&(ze=EO),(ve&&!e&&c||!ve&&d&&!e&&c)&&(ze=kO);var Ae=te(ze);ze&&(t||Ae[e5])?(F(ze),he()):F(Mw),Pe.current=e}},[e]),g.useEffect(function(){(O===DO&&!l||O===EO&&!i||O===kO&&!c)&&F(Mw)},[l,i,c]),g.useEffect(function(){return function(){_.current=!1,clearTimeout(G.current)}},[]);var pe=g.useRef(!1);g.useEffect(function(){D&&(pe.current=!0),D!==void 0&&O===Mw&&((pe.current||D)&&(T==null||T(D)),pe.current=!0)},[D,O]);var Ie=j;return $[e5]&&me===ZC&&(Ie=Gc({transition:"none"},Ie)),[O,me,Ie,D??e]}function UDt(t){var e=t;$A(t)==="object"&&(e=t.transitionSupport);function n(r,i){return!!(r.motionName&&e&&i!==!1)}var o=g.forwardRef(function(r,i){var a=r.visible,l=a===void 0?!0:a,s=r.removeOnLeave,c=s===void 0?!0:s,u=r.forceRender,d=r.children,f=r.motionName,p=r.leavedClassName,m=r.eventProps,y=g.useContext(e$e),w=y.motion,x=n(r,w),C=g.useRef(),P=g.useRef();function A(){try{return C.current instanceof HTMLElement?C.current:oG(P.current)}catch{return null}}var S=NDt(x,l,A,r),v=$w(S,4),b=v[0],T=v[1],R=v[2],M=v[3],D=g.useRef(M);M&&(D.current=!0);var k=g.useCallback(function(L){C.current=L,UJe(i,L)},[i]),N,U=Gc(Gc({},m),{},{visible:l});if(!d)N=null;else if(b===Mw)M?N=d(Gc({},U),k):!c&&D.current&&p?N=d(Gc(Gc({},U),{},{className:p}),k):u||!c&&!p?N=d(Gc(Gc({},U),{},{style:{display:"none"}}),k):N=null;else{var W;T===e5?W="prepare":h$e(T)?W="active":T===ZC&&(W="start");var F=bSe(f,"".concat(b,"-").concat(W));N=d(Gc(Gc({},U),{},{className:xDt(bSe(f,b),vp(vp({},F,F&&W),f,typeof f=="string")),style:R}),k)}if(g.isValidElement(N)&&YQ(N)){var E=OQ(N);E||(N=g.cloneElement(N,{ref:k}))}return g.createElement(CDt,{ref:P},N)});return o.displayName="CSSMotion",o}const cZ=UDt(u$e);function kfe(){return kfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:[];return t.map(jDt)}function BDt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],o=0,r=e.length,i=Nfe(t),a=Nfe(e);i.forEach(function(c){for(var u=!1,d=o;d1});return s.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==Wfe}),n.forEach(function(u){u.key===c&&(u.status=Lfe)})}),n}var YDt=["component","children","onVisibleChanged","onAllRemoved"],ODt=["status"],_Dt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function VDt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:cZ,n=function(o){o$e(i,o);var r=r$e(i);function i(){var a;t$e(this,i);for(var l=arguments.length,s=new Array(l),c=0;cnull;var JDt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re.endsWith("Color"))}const QDt=t=>{const{prefixCls:e,iconPrefixCls:n,theme:o,holderRender:r}=t;e!==void 0&&(qX=e),n!==void 0&&(p$e=n),"holderRender"in t&&(m$e=r),o&&(qDt(o)?Mzt(hG(),o):g$e=o)},y$e=()=>({getPrefixCls:(t,e)=>e||(t?`${hG()}-${t}`:hG()),getIconPrefixCls:$Dt,getRootPrefixCls:()=>qX||hG(),getTheme:()=>g$e,holderRender:m$e}),ZDt=t=>{const{children:e,csp:n,autoInsertSpaceInButton:o,alert:r,anchor:i,form:a,locale:l,componentSize:s,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:y,legacyLocale:w,parentContext:x,iconPrefixCls:C,theme:P,componentDisabled:A,segmented:S,statistic:v,spin:b,calendar:T,carousel:R,cascader:M,collapse:D,typography:k,checkbox:N,descriptions:U,divider:W,drawer:F,skeleton:E,steps:L,image:j,layout:Y,list:O,mentions:_,modal:G,progress:Q,result:oe,slider:ee,breadcrumb:q,menu:ae,pagination:Z,input:ne,textArea:te,empty:$,badge:le,radio:de,rate:he,switch:me,transfer:ce,avatar:Pe,message:pe,tag:Ie,table:ve,card:ze,tabs:Ae,timeline:se,timePicker:ge,upload:we,notification:Se,tree:Me,colorPicker:Ce,datePicker:Te,rangePicker:Re,flex:Ne,wave:_e,dropdown:Ue,warning:qe,tour:Fe,tooltip:He,popover:Le,popconfirm:Ye,floatButtonGroup:lt,variant:Oe,inputNumber:ut,treeSelect:ht}=t,Qe=g.useCallback((zt,Rt)=>{const{prefixCls:Ct}=t;if(Rt)return Rt;const yt=Ct||x.getPrefixCls("");return zt?`${yt}-${zt}`:yt},[x.getPrefixCls,t.prefixCls]),nt=C||x.iconPrefixCls||KQ,mt=n||x.csp;cDt(nt,mt);const tt=hDt(P,x.theme,{prefixCls:Qe("")}),gt={csp:mt,autoInsertSpaceInButton:o,alert:r,anchor:i,locale:l||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:y,getPrefixCls:Qe,iconPrefixCls:nt,theme:tt,segmented:S,statistic:v,spin:b,calendar:T,carousel:R,cascader:M,collapse:D,typography:k,checkbox:N,descriptions:U,divider:W,drawer:F,skeleton:E,steps:L,image:j,input:ne,textArea:te,layout:Y,list:O,mentions:_,modal:G,progress:Q,result:oe,slider:ee,breadcrumb:q,menu:ae,pagination:Z,empty:$,badge:le,radio:de,rate:he,switch:me,transfer:ce,avatar:Pe,message:pe,tag:Ie,table:ve,card:ze,tabs:Ae,timeline:se,timePicker:ge,upload:we,notification:Se,tree:Me,colorPicker:Ce,datePicker:Te,rangePicker:Re,flex:Ne,wave:_e,dropdown:Ue,warning:qe,tour:Fe,tooltip:He,popover:Le,popconfirm:Ye,floatButtonGroup:lt,variant:Oe,inputNumber:ut,treeSelect:ht},Ve=Object.assign({},x);Object.keys(gt).forEach(zt=>{gt[zt]!==void 0&&(Ve[zt]=gt[zt])}),KDt.forEach(zt=>{const Rt=t[zt];Rt&&(Ve[zt]=Rt)}),typeof o<"u"&&(Ve.button=Object.assign({autoInsertSpace:o},Ve.button));const je=M5e(()=>Ve,Ve,(zt,Rt)=>{const Ct=Object.keys(zt),yt=Object.keys(Rt);return Ct.length!==yt.length||Ct.some(at=>zt[at]!==Rt[at])}),{layer:et}=g.useContext(nU),bt=g.useMemo(()=>({prefixCls:nt,csp:mt,layer:et?"antd":void 0}),[nt,mt,et]);let St=g.createElement(g.Fragment,null,g.createElement(XDt,{dropdownMatchSelectWidth:p}),e);const Pt=g.useMemo(()=>{var zt,Rt,Ct,yt;return XIt(((zt=I3.Form)===null||zt===void 0?void 0:zt.defaultValidateMessages)||{},((Ct=(Rt=je.locale)===null||Rt===void 0?void 0:Rt.Form)===null||Ct===void 0?void 0:Ct.defaultValidateMessages)||{},((yt=je.form)===null||yt===void 0?void 0:yt.validateMessages)||{},(a==null?void 0:a.validateMessages)||{})},[je,a==null?void 0:a.validateMessages]);Object.keys(Pt).length>0&&(St=g.createElement($It.Provider,{value:Pt},St)),l&&(St=g.createElement(nzt,{locale:l,_ANT_MARK__:tzt},St)),St=g.createElement(U5e.Provider,{value:bt},St),s&&(St=g.createElement(Izt,{size:s},St)),St=g.createElement(GDt,null,St);const Yt=g.useMemo(()=>{const zt=tt||{},{algorithm:Rt,token:Ct,components:yt,cssVar:at}=zt,Et=JDt(zt,["algorithm","token","components","cssVar"]),Lt=Rt&&(!Array.isArray(Rt)||Rt.length>0)?afe(Rt):DKe,Je={};Object.entries(yt||{}).forEach(It=>{let[ot,it]=It;const Be=Object.assign({},it);"algorithm"in Be&&(Be.algorithm===!0?Be.theme=Lt:(Array.isArray(Be.algorithm)||typeof Be.algorithm=="function")&&(Be.theme=afe(Be.algorithm)),delete Be.algorithm),Je[ot]=Be});const st=Object.assign(Object.assign({},AL),Ct);return Object.assign(Object.assign({},Et),{theme:Lt,token:st,components:Je,override:Object.assign({override:st},Je),cssVar:at})},[tt]);return P&&(St=g.createElement(EKe.Provider,{value:Yt},St)),je.warning&&(St=g.createElement(KIt.Provider,{value:je.warning},St)),A!==void 0&&(St=g.createElement(LKe,{disabled:A},St)),g.createElement(gr.Provider,{value:je},St)},n2=t=>{const e=g.useContext(gr),n=g.useContext(B5e);return g.createElement(ZDt,Object.assign({parentContext:e,legacyLocale:n},t))};n2.ConfigContext=gr;n2.SizeContext=AH;n2.config=QDt;n2.useConfig=zzt;Object.defineProperty(n2,"SizeContext",{get:()=>AH});function Sr(){return Sr=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=Array(e);n=0)&&(n[r]=t[r]);return n}function zfe(t,e){if(t==null)return{};var n=vDt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var bDt=["children"],e$e=g.createContext({});function SDt(t){var e=t.children,n=zfe(t,bDt);return g.createElement(e$e.Provider,{value:n},e)}function t$e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gSe(t,e){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Efe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PDt(t,e){if(e&&($A(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Efe(t)}function r$e(t){var e=TDt();return function(){var o=$X(t),r;if(e){var i=$X(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return PDt(this,r)}}var CDt=function(t){o$e(n,t);var e=r$e(n);function n(){return t$e(this,n),e.apply(this,arguments)}return n$e(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function kd(t){var e=g.useRef();e.current=t;var n=g.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a1&&arguments[1]!==void 0?arguments[1]:2;e();var i=Hf(function(){r<=1?o({isCanceled:function(){return i!==t.current}}):n(o,r-1)});t.current=i}return g.useEffect(function(){return function(){e()}},[]),[n,e]};var kDt=[e5,ZC,eR,J5e],FDt=[e5,i$e],f$e=!1,LDt=!0;function h$e(t){return t===eR||t===J5e}const WDt=function(t,e,n){var o=wH(ASe),r=$w(o,2),i=r[0],a=r[1],l=EDt(),s=$w(l,2),c=s[0],u=s[1];function d(){a(e5,!0)}var f=e?FDt:kDt;return d$e(function(){if(i!==ASe&&i!==J5e){var p=f.indexOf(i),m=f[p+1],y=n(i);y===f$e?a(m,!0):m&&c(function(w){function x(){w.isCanceled()||a(m,!0)}y===!0?x():Promise.resolve(y).then(x)})}},[t,i]),g.useEffect(function(){return function(){u()}},[]),[d,i]};function NDt(t,e,n,o){var r=o.motionEnter,i=r===void 0?!0:r,a=o.motionAppear,l=a===void 0?!0:a,s=o.motionLeave,c=s===void 0?!0:s,u=o.motionDeadline,d=o.motionLeaveImmediately,f=o.onAppearPrepare,p=o.onEnterPrepare,m=o.onLeavePrepare,y=o.onAppearStart,w=o.onEnterStart,x=o.onLeaveStart,C=o.onAppearActive,P=o.onEnterActive,A=o.onLeaveActive,S=o.onAppearEnd,v=o.onEnterEnd,b=o.onLeaveEnd,T=o.onVisibleChanged,R=wH(),M=$w(R,2),D=M[0],k=M[1],N=HDt(Mw),U=$w(N,2),W=U[0],F=U[1],E=wH(null),L=$w(E,2),j=L[0],Y=L[1],O=W(),_=g.useRef(!1),G=g.useRef(null);function Q(){return n()}var oe=g.useRef(!1);function ee(){F(Mw),Y(null,!0)}var $=kd(function(ve){var ze=W();if(ze!==Mw){var Ae=Q();if(!(ve&&!ve.deadline&&ve.target!==Ae)){var se=oe.current,ge;ze===DO&&se?ge=S==null?void 0:S(Ae,ve):ze===EO&&se?ge=v==null?void 0:v(Ae,ve):ze===kO&&se&&(ge=b==null?void 0:b(Ae,ve)),se&&ge!==!1&&ee()}}}),ae=DDt($),Z=$w(ae,1),ne=Z[0],te=function(ze){switch(ze){case DO:return vp(vp(vp({},e5,f),ZC,y),eR,C);case EO:return vp(vp(vp({},e5,p),ZC,w),eR,P);case kO:return vp(vp(vp({},e5,m),ZC,x),eR,A);default:return{}}},q=g.useMemo(function(){return te(O)},[O]),le=WDt(O,!t,function(ve){if(ve===e5){var ze=q[e5];return ze?ze(Q()):f$e}if(me in q){var Ae;Y(((Ae=q[me])===null||Ae===void 0?void 0:Ae.call(q,Q(),null))||null)}return me===eR&&O!==Mw&&(ne(Q()),u>0&&(clearTimeout(G.current),G.current=setTimeout(function(){$({deadline:!0})},u))),me===i$e&&ee(),LDt}),de=$w(le,2),he=de[0],me=de[1],ce=h$e(me);oe.current=ce;var Pe=g.useRef(null);d$e(function(){if(!(_.current&&Pe.current===e)){k(e);var ve=_.current;_.current=!0;var ze;!ve&&e&&l&&(ze=DO),ve&&e&&i&&(ze=EO),(ve&&!e&&c||!ve&&d&&!e&&c)&&(ze=kO);var Ae=te(ze);ze&&(t||Ae[e5])?(F(ze),he()):F(Mw),Pe.current=e}},[e]),g.useEffect(function(){(O===DO&&!l||O===EO&&!i||O===kO&&!c)&&F(Mw)},[l,i,c]),g.useEffect(function(){return function(){_.current=!1,clearTimeout(G.current)}},[]);var pe=g.useRef(!1);g.useEffect(function(){D&&(pe.current=!0),D!==void 0&&O===Mw&&((pe.current||D)&&(T==null||T(D)),pe.current=!0)},[D,O]);var Ie=j;return q[e5]&&me===ZC&&(Ie=Gc({transition:"none"},Ie)),[O,me,Ie,D??e]}function UDt(t){var e=t;$A(t)==="object"&&(e=t.transitionSupport);function n(r,i){return!!(r.motionName&&e&&i!==!1)}var o=g.forwardRef(function(r,i){var a=r.visible,l=a===void 0?!0:a,s=r.removeOnLeave,c=s===void 0?!0:s,u=r.forceRender,d=r.children,f=r.motionName,p=r.leavedClassName,m=r.eventProps,y=g.useContext(e$e),w=y.motion,x=n(r,w),C=g.useRef(),P=g.useRef();function A(){try{return C.current instanceof HTMLElement?C.current:oG(P.current)}catch{return null}}var S=NDt(x,l,A,r),v=$w(S,4),b=v[0],T=v[1],R=v[2],M=v[3],D=g.useRef(M);M&&(D.current=!0);var k=g.useCallback(function(L){C.current=L,UJe(i,L)},[i]),N,U=Gc(Gc({},m),{},{visible:l});if(!d)N=null;else if(b===Mw)M?N=d(Gc({},U),k):!c&&D.current&&p?N=d(Gc(Gc({},U),{},{className:p}),k):u||!c&&!p?N=d(Gc(Gc({},U),{},{style:{display:"none"}}),k):N=null;else{var W;T===e5?W="prepare":h$e(T)?W="active":T===ZC&&(W="start");var F=bSe(f,"".concat(b,"-").concat(W));N=d(Gc(Gc({},U),{},{className:xDt(bSe(f,b),vp(vp({},F,F&&W),f,typeof f=="string")),style:R}),k)}if(g.isValidElement(N)&&YQ(N)){var E=OQ(N);E||(N=g.cloneElement(N,{ref:k}))}return g.createElement(CDt,{ref:P},N)});return o.displayName="CSSMotion",o}const cZ=UDt(u$e);function kfe(){return kfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:[];return t.map(jDt)}function BDt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],o=0,r=e.length,i=Nfe(t),a=Nfe(e);i.forEach(function(c){for(var u=!1,d=o;d1});return s.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==Wfe}),n.forEach(function(u){u.key===c&&(u.status=Lfe)})}),n}var YDt=["component","children","onVisibleChanged","onAllRemoved"],ODt=["status"],_Dt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function VDt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:cZ,n=function(o){o$e(i,o);var r=r$e(i);function i(){var a;t$e(this,i);for(var l=arguments.length,s=new Array(l),c=0;cnull;var JDt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re.endsWith("Color"))}const QDt=t=>{const{prefixCls:e,iconPrefixCls:n,theme:o,holderRender:r}=t;e!==void 0&&(qX=e),n!==void 0&&(p$e=n),"holderRender"in t&&(m$e=r),o&&(qDt(o)?Mzt(hG(),o):g$e=o)},y$e=()=>({getPrefixCls:(t,e)=>e||(t?`${hG()}-${t}`:hG()),getIconPrefixCls:$Dt,getRootPrefixCls:()=>qX||hG(),getTheme:()=>g$e,holderRender:m$e}),ZDt=t=>{const{children:e,csp:n,autoInsertSpaceInButton:o,alert:r,anchor:i,form:a,locale:l,componentSize:s,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:y,legacyLocale:w,parentContext:x,iconPrefixCls:C,theme:P,componentDisabled:A,segmented:S,statistic:v,spin:b,calendar:T,carousel:R,cascader:M,collapse:D,typography:k,checkbox:N,descriptions:U,divider:W,drawer:F,skeleton:E,steps:L,image:j,layout:Y,list:O,mentions:_,modal:G,progress:Q,result:oe,slider:ee,breadcrumb:$,menu:ae,pagination:Z,input:ne,textArea:te,empty:q,badge:le,radio:de,rate:he,switch:me,transfer:ce,avatar:Pe,message:pe,tag:Ie,table:ve,card:ze,tabs:Ae,timeline:se,timePicker:ge,upload:we,notification:Se,tree:Me,colorPicker:Ce,datePicker:Te,rangePicker:Re,flex:Ne,wave:_e,dropdown:Ue,warning:qe,tour:Fe,tooltip:He,popover:Le,popconfirm:Ye,floatButtonGroup:lt,variant:Oe,inputNumber:ut,treeSelect:ht}=t,Qe=g.useCallback((zt,Rt)=>{const{prefixCls:Ct}=t;if(Rt)return Rt;const yt=Ct||x.getPrefixCls("");return zt?`${yt}-${zt}`:yt},[x.getPrefixCls,t.prefixCls]),nt=C||x.iconPrefixCls||KQ,mt=n||x.csp;cDt(nt,mt);const tt=hDt(P,x.theme,{prefixCls:Qe("")}),gt={csp:mt,autoInsertSpaceInButton:o,alert:r,anchor:i,locale:l||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:y,getPrefixCls:Qe,iconPrefixCls:nt,theme:tt,segmented:S,statistic:v,spin:b,calendar:T,carousel:R,cascader:M,collapse:D,typography:k,checkbox:N,descriptions:U,divider:W,drawer:F,skeleton:E,steps:L,image:j,input:ne,textArea:te,layout:Y,list:O,mentions:_,modal:G,progress:Q,result:oe,slider:ee,breadcrumb:$,menu:ae,pagination:Z,empty:q,badge:le,radio:de,rate:he,switch:me,transfer:ce,avatar:Pe,message:pe,tag:Ie,table:ve,card:ze,tabs:Ae,timeline:se,timePicker:ge,upload:we,notification:Se,tree:Me,colorPicker:Ce,datePicker:Te,rangePicker:Re,flex:Ne,wave:_e,dropdown:Ue,warning:qe,tour:Fe,tooltip:He,popover:Le,popconfirm:Ye,floatButtonGroup:lt,variant:Oe,inputNumber:ut,treeSelect:ht},Ve=Object.assign({},x);Object.keys(gt).forEach(zt=>{gt[zt]!==void 0&&(Ve[zt]=gt[zt])}),KDt.forEach(zt=>{const Rt=t[zt];Rt&&(Ve[zt]=Rt)}),typeof o<"u"&&(Ve.button=Object.assign({autoInsertSpace:o},Ve.button));const je=M5e(()=>Ve,Ve,(zt,Rt)=>{const Ct=Object.keys(zt),yt=Object.keys(Rt);return Ct.length!==yt.length||Ct.some(at=>zt[at]!==Rt[at])}),{layer:et}=g.useContext(nU),bt=g.useMemo(()=>({prefixCls:nt,csp:mt,layer:et?"antd":void 0}),[nt,mt,et]);let St=g.createElement(g.Fragment,null,g.createElement(XDt,{dropdownMatchSelectWidth:p}),e);const Pt=g.useMemo(()=>{var zt,Rt,Ct,yt;return XIt(((zt=I3.Form)===null||zt===void 0?void 0:zt.defaultValidateMessages)||{},((Ct=(Rt=je.locale)===null||Rt===void 0?void 0:Rt.Form)===null||Ct===void 0?void 0:Ct.defaultValidateMessages)||{},((yt=je.form)===null||yt===void 0?void 0:yt.validateMessages)||{},(a==null?void 0:a.validateMessages)||{})},[je,a==null?void 0:a.validateMessages]);Object.keys(Pt).length>0&&(St=g.createElement($It.Provider,{value:Pt},St)),l&&(St=g.createElement(nzt,{locale:l,_ANT_MARK__:tzt},St)),St=g.createElement(U5e.Provider,{value:bt},St),s&&(St=g.createElement(Izt,{size:s},St)),St=g.createElement(GDt,null,St);const Yt=g.useMemo(()=>{const zt=tt||{},{algorithm:Rt,token:Ct,components:yt,cssVar:at}=zt,Et=JDt(zt,["algorithm","token","components","cssVar"]),Lt=Rt&&(!Array.isArray(Rt)||Rt.length>0)?afe(Rt):DKe,Je={};Object.entries(yt||{}).forEach(It=>{let[ot,it]=It;const Be=Object.assign({},it);"algorithm"in Be&&(Be.algorithm===!0?Be.theme=Lt:(Array.isArray(Be.algorithm)||typeof Be.algorithm=="function")&&(Be.theme=afe(Be.algorithm)),delete Be.algorithm),Je[ot]=Be});const st=Object.assign(Object.assign({},AL),Ct);return Object.assign(Object.assign({},Et),{theme:Lt,token:st,components:Je,override:Object.assign({override:st},Je),cssVar:at})},[tt]);return P&&(St=g.createElement(EKe.Provider,{value:Yt},St)),je.warning&&(St=g.createElement(KIt.Provider,{value:je.warning},St)),A!==void 0&&(St=g.createElement(LKe,{disabled:A},St)),g.createElement(gr.Provider,{value:je},St)},n2=t=>{const e=g.useContext(gr),n=g.useContext(B5e);return g.createElement(ZDt,Object.assign({parentContext:e,legacyLocale:n},t))};n2.ConfigContext=gr;n2.SizeContext=AH;n2.config=QDt;n2.useConfig=zzt;Object.defineProperty(n2,"SizeContext",{get:()=>AH});function Sr(){return Sr=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=Array(e);n1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=yH({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||kSe(r,JEt))||n.data&&kSe(r,KEt)||n.attr&&XEt.includes(r))&&(o[r]=t[r])}),o}function M$e(t){return t&&xe.isValidElement(t)&&t.type===xe.Fragment}const I$e=(t,e,n)=>xe.isValidElement(t)?xe.cloneElement(t,typeof n=="function"?n(t.props||{}):n):e;function P0(t,e){return I$e(t,t,e)}function $Et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function SL(t){"@babel/helpers - typeof";return SL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SL(t)}function qEt(t,e){if(SL(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(SL(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function QEt(t){var e=qEt(t,"string");return SL(e)=="symbol"?e:e+""}function ZEt(t,e){for(var n=0;n{var e,n;if(typeof window>"u")return 0;let o=0;return Yfe(t)?o=t.pageYOffset:t instanceof Document?o=t.documentElement.scrollTop:(t instanceof HTMLElement||t)&&(o=t.scrollTop),t&&!Yfe(t)&&typeof o!="number"&&(o=(n=((e=t.ownerDocument)!==null&&e!==void 0?e:t).documentElement)===null||n===void 0?void 0:n.scrollTop),o};function nkt(t,e,n,o){const r=n-e;return t/=o/2,t<1?r/2*t*t*t+e:r/2*((t-=2)*t*t+2)+e}function okt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{getContainer:n=()=>window,callback:o,duration:r=450}=e,i=n(),a=tkt(i),l=Date.now(),s=()=>{const u=Date.now()-l,d=nkt(u>r?r:u,a,t,r);Yfe(i)?i.scrollTo(window.pageXOffset,d):i instanceof Document||i.constructor.name==="HTMLDocument"?i.documentElement.scrollTop=d:i.scrollTop=d,u{const[,,,,e]=Ff();return e?`${t}-css-var`:""};function ZX(t){return t instanceof HTMLElement||t instanceof SVGElement}function jk(t){return ZX(t)?t:t instanceof xe.Component?XA.findDOMNode(t):null}var rkt=g.createContext({}),ikt=function(t){XM(n,t);var e=JM(n);function n(){return Uh(this,n),e.apply(this,arguments)}return jh(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component),uv="none",UO="appear",jO="enter",BO="leave",FSe="none",t5="prepare",tR="start",nR="active",q5e="end",z$e="prepared";function LSe(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit".concat(t)]="webkit".concat(e),n["Moz".concat(t)]="moz".concat(e),n["ms".concat(t)]="MS".concat(e),n["O".concat(t)]="o".concat(e.toLowerCase()),n}function akt(t,e){var n={animationend:LSe("Animation","AnimationEnd"),transitionend:LSe("Transition","TransitionEnd")};return t&&("AnimationEvent"in e||delete n.animationend.animation,"TransitionEvent"in e||delete n.transitionend.transition),n}var lkt=akt(mm(),typeof window<"u"?window:{}),D$e={};if(mm()){var skt=document.createElement("div");D$e=skt.style}var YO={};function E$e(t){if(YO[t])return YO[t];var e=lkt[t];if(e)for(var n=Object.keys(e),o=n.length,r=0;r1&&arguments[1]!==void 0?arguments[1]:1;jSe+=1;var o=jSe;function r(i){if(i===0)j$e(o),e();else{var a=N$e(function(){r(i-1)});Q5e.set(o,a)}}return r(n),o};Ic.cancel=function(t){var e=Q5e.get(t);return j$e(t),U$e(e)};const ukt=function(){var t=g.useRef(null);function e(){Ic.cancel(t.current)}function n(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;e();var i=Ic(function(){r<=1?o({isCanceled:function(){return i!==t.current}}):n(o,r-1)});t.current=i}return g.useEffect(function(){return function(){e()}},[]),[n,e]};var dkt=[t5,tR,nR,q5e],fkt=[t5,z$e],B$e=!1,hkt=!0;function Y$e(t){return t===nR||t===q5e}const pkt=function(t,e,n){var o=zR(FSe),r=Sn(o,2),i=r[0],a=r[1],l=ukt(),s=Sn(l,2),c=s[0],u=s[1];function d(){a(t5,!0)}var f=e?fkt:dkt;return W$e(function(){if(i!==FSe&&i!==q5e){var p=f.indexOf(i),m=f[p+1],y=n(i);y===B$e?a(m,!0):m&&c(function(w){function x(){w.isCanceled()||a(m,!0)}y===!0?x():Promise.resolve(y).then(x)})}},[t,i]),g.useEffect(function(){return function(){u()}},[]),[d,i]};function gkt(t,e,n,o){var r=o.motionEnter,i=r===void 0?!0:r,a=o.motionAppear,l=a===void 0?!0:a,s=o.motionLeave,c=s===void 0?!0:s,u=o.motionDeadline,d=o.motionLeaveImmediately,f=o.onAppearPrepare,p=o.onEnterPrepare,m=o.onLeavePrepare,y=o.onAppearStart,w=o.onEnterStart,x=o.onLeaveStart,C=o.onAppearActive,P=o.onEnterActive,A=o.onLeaveActive,S=o.onAppearEnd,v=o.onEnterEnd,b=o.onLeaveEnd,T=o.onVisibleChanged,R=zR(),M=Sn(R,2),D=M[0],k=M[1],N=zR(uv),U=Sn(N,2),W=U[0],F=U[1],E=zR(null),L=Sn(E,2),j=L[0],Y=L[1],O=g.useRef(!1),_=g.useRef(null);function G(){return n()}var Q=g.useRef(!1);function oe(){F(uv,!0),Y(null,!0)}function ee(pe){var Ie=G();if(!(pe&&!pe.deadline&&pe.target!==Ie)){var ve=Q.current,ze;W===UO&&ve?ze=S==null?void 0:S(Ie,pe):W===jO&&ve?ze=v==null?void 0:v(Ie,pe):W===BO&&ve&&(ze=b==null?void 0:b(Ie,pe)),W!==uv&&ve&&ze!==!1&&oe()}}var q=ckt(ee),ae=Sn(q,1),Z=ae[0],ne=function(Ie){var ve,ze,Ae;switch(Ie){case UO:return ve={},Ut(ve,t5,f),Ut(ve,tR,y),Ut(ve,nR,C),ve;case jO:return ze={},Ut(ze,t5,p),Ut(ze,tR,w),Ut(ze,nR,P),ze;case BO:return Ae={},Ut(Ae,t5,m),Ut(Ae,tR,x),Ut(Ae,nR,A),Ae;default:return{}}},te=g.useMemo(function(){return ne(W)},[W]),$=pkt(W,!t,function(pe){if(pe===t5){var Ie=te[t5];return Ie?Ie(G()):B$e}if(he in te){var ve;Y(((ve=te[he])===null||ve===void 0?void 0:ve.call(te,G(),null))||null)}return he===nR&&(Z(G()),u>0&&(clearTimeout(_.current),_.current=setTimeout(function(){ee({deadline:!0})},u))),he===z$e&&oe(),hkt}),le=Sn($,2),de=le[0],he=le[1],me=Y$e(he);Q.current=me,W$e(function(){k(e);var pe=O.current;O.current=!0;var Ie;!pe&&e&&l&&(Ie=UO),pe&&e&&i&&(Ie=jO),(pe&&!e&&c||!pe&&d&&!e&&c)&&(Ie=BO);var ve=ne(Ie);Ie&&(t||ve[t5])?(F(Ie),de()):F(uv)},[e]),g.useEffect(function(){(W===UO&&!l||W===jO&&!i||W===BO&&!c)&&F(uv)},[l,i,c]),g.useEffect(function(){return function(){O.current=!1,clearTimeout(_.current)}},[]);var ce=g.useRef(!1);g.useEffect(function(){D&&(ce.current=!0),D!==void 0&&W===uv&&((ce.current||D)&&(T==null||T(D)),ce.current=!0)},[D,W]);var Pe=j;return te[t5]&&he===tR&&(Pe=nn({transition:"none"},Pe)),[W,he,Pe,D??e]}function mkt(t){var e=t;Vr(t)==="object"&&(e=t.transitionSupport);function n(r,i){return!!(r.motionName&&e&&i!==!1)}var o=g.forwardRef(function(r,i){var a=r.visible,l=a===void 0?!0:a,s=r.removeOnLeave,c=s===void 0?!0:s,u=r.forceRender,d=r.children,f=r.motionName,p=r.leavedClassName,m=r.eventProps,y=g.useContext(rkt),w=y.motion,x=n(r,w),C=g.useRef(),P=g.useRef();function A(){try{return C.current instanceof HTMLElement?C.current:jk(P.current)}catch{return null}}var S=gkt(x,l,A,r),v=Sn(S,4),b=v[0],T=v[1],R=v[2],M=v[3],D=g.useRef(M);M&&(D.current=!0);var k=g.useCallback(function(Y){C.current=Y,G5e(i,Y)},[i]),N,U=nn(nn({},m),{},{visible:l});if(!d)N=null;else if(b===uv)M?N=d(nn({},U),k):!c&&D.current&&p?N=d(nn(nn({},U),{},{className:p}),k):u||!c&&!p?N=d(nn(nn({},U),{},{style:{display:"none"}}),k):N=null;else{var W,F;T===t5?F="prepare":Y$e(T)?F="active":T===tR&&(F="start");var E=USe(f,"".concat(b,"-").concat(F));N=d(nn(nn({},U),{},{className:Bn(USe(f,b),(W={},Ut(W,E,E&&F),Ut(W,f,typeof f=="string"),W)),style:R}),k)}if(g.isValidElement(N)&&Z8(N)){var L=N,j=L.ref;j||(N=g.cloneElement(N,{ref:k}))}return g.createElement(ikt,{ref:P},N)});return o.displayName="CSSMotion",o}const Oy=mkt(L$e);var Ofe="add",_fe="keep",Vfe="remove",ble="removed";function ykt(t){var e;return t&&Vr(t)==="object"&&"key"in t?e=t:e={key:t},nn(nn({},e),{},{key:String(e.key)})}function Gfe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return t.map(ykt)}function Akt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],o=0,r=e.length,i=Gfe(t),a=Gfe(e);i.forEach(function(c){for(var u=!1,d=o;d1});return s.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==Vfe}),n.forEach(function(u){u.key===c&&(u.status=_fe)})}),n}var wkt=["component","children","onVisibleChanged","onAllRemoved"],xkt=["status"],vkt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function bkt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oy,n=function(o){XM(i,o);var r=JM(i);function i(){var a;Uh(this,i);for(var l=arguments.length,s=new Array(l),c=0;c1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=yH({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||kSe(r,JEt))||n.data&&kSe(r,KEt)||n.attr&&XEt.includes(r))&&(o[r]=t[r])}),o}function M$e(t){return t&&xe.isValidElement(t)&&t.type===xe.Fragment}const I$e=(t,e,n)=>xe.isValidElement(t)?xe.cloneElement(t,typeof n=="function"?n(t.props||{}):n):e;function P0(t,e){return I$e(t,t,e)}function $Et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function SL(t){"@babel/helpers - typeof";return SL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},SL(t)}function qEt(t,e){if(SL(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(SL(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function QEt(t){var e=qEt(t,"string");return SL(e)=="symbol"?e:e+""}function ZEt(t,e){for(var n=0;n{var e,n;if(typeof window>"u")return 0;let o=0;return Yfe(t)?o=t.pageYOffset:t instanceof Document?o=t.documentElement.scrollTop:(t instanceof HTMLElement||t)&&(o=t.scrollTop),t&&!Yfe(t)&&typeof o!="number"&&(o=(n=((e=t.ownerDocument)!==null&&e!==void 0?e:t).documentElement)===null||n===void 0?void 0:n.scrollTop),o};function nkt(t,e,n,o){const r=n-e;return t/=o/2,t<1?r/2*t*t*t+e:r/2*((t-=2)*t*t+2)+e}function okt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{getContainer:n=()=>window,callback:o,duration:r=450}=e,i=n(),a=tkt(i),l=Date.now(),s=()=>{const u=Date.now()-l,d=nkt(u>r?r:u,a,t,r);Yfe(i)?i.scrollTo(window.pageXOffset,d):i instanceof Document||i.constructor.name==="HTMLDocument"?i.documentElement.scrollTop=d:i.scrollTop=d,u{const[,,,,e]=Ff();return e?`${t}-css-var`:""};function ZX(t){return t instanceof HTMLElement||t instanceof SVGElement}function jk(t){return ZX(t)?t:t instanceof xe.Component?XA.findDOMNode(t):null}var rkt=g.createContext({}),ikt=function(t){XM(n,t);var e=JM(n);function n(){return Uh(this,n),e.apply(this,arguments)}return jh(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component),uv="none",UO="appear",jO="enter",BO="leave",FSe="none",t5="prepare",tR="start",nR="active",q5e="end",z$e="prepared";function LSe(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit".concat(t)]="webkit".concat(e),n["Moz".concat(t)]="moz".concat(e),n["ms".concat(t)]="MS".concat(e),n["O".concat(t)]="o".concat(e.toLowerCase()),n}function akt(t,e){var n={animationend:LSe("Animation","AnimationEnd"),transitionend:LSe("Transition","TransitionEnd")};return t&&("AnimationEvent"in e||delete n.animationend.animation,"TransitionEvent"in e||delete n.transitionend.transition),n}var lkt=akt(mm(),typeof window<"u"?window:{}),D$e={};if(mm()){var skt=document.createElement("div");D$e=skt.style}var YO={};function E$e(t){if(YO[t])return YO[t];var e=lkt[t];if(e)for(var n=Object.keys(e),o=n.length,r=0;r1&&arguments[1]!==void 0?arguments[1]:1;jSe+=1;var o=jSe;function r(i){if(i===0)j$e(o),e();else{var a=N$e(function(){r(i-1)});Q5e.set(o,a)}}return r(n),o};Ic.cancel=function(t){var e=Q5e.get(t);return j$e(t),U$e(e)};const ukt=function(){var t=g.useRef(null);function e(){Ic.cancel(t.current)}function n(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;e();var i=Ic(function(){r<=1?o({isCanceled:function(){return i!==t.current}}):n(o,r-1)});t.current=i}return g.useEffect(function(){return function(){e()}},[]),[n,e]};var dkt=[t5,tR,nR,q5e],fkt=[t5,z$e],B$e=!1,hkt=!0;function Y$e(t){return t===nR||t===q5e}const pkt=function(t,e,n){var o=zR(FSe),r=Sn(o,2),i=r[0],a=r[1],l=ukt(),s=Sn(l,2),c=s[0],u=s[1];function d(){a(t5,!0)}var f=e?fkt:dkt;return W$e(function(){if(i!==FSe&&i!==q5e){var p=f.indexOf(i),m=f[p+1],y=n(i);y===B$e?a(m,!0):m&&c(function(w){function x(){w.isCanceled()||a(m,!0)}y===!0?x():Promise.resolve(y).then(x)})}},[t,i]),g.useEffect(function(){return function(){u()}},[]),[d,i]};function gkt(t,e,n,o){var r=o.motionEnter,i=r===void 0?!0:r,a=o.motionAppear,l=a===void 0?!0:a,s=o.motionLeave,c=s===void 0?!0:s,u=o.motionDeadline,d=o.motionLeaveImmediately,f=o.onAppearPrepare,p=o.onEnterPrepare,m=o.onLeavePrepare,y=o.onAppearStart,w=o.onEnterStart,x=o.onLeaveStart,C=o.onAppearActive,P=o.onEnterActive,A=o.onLeaveActive,S=o.onAppearEnd,v=o.onEnterEnd,b=o.onLeaveEnd,T=o.onVisibleChanged,R=zR(),M=Sn(R,2),D=M[0],k=M[1],N=zR(uv),U=Sn(N,2),W=U[0],F=U[1],E=zR(null),L=Sn(E,2),j=L[0],Y=L[1],O=g.useRef(!1),_=g.useRef(null);function G(){return n()}var Q=g.useRef(!1);function oe(){F(uv,!0),Y(null,!0)}function ee(pe){var Ie=G();if(!(pe&&!pe.deadline&&pe.target!==Ie)){var ve=Q.current,ze;W===UO&&ve?ze=S==null?void 0:S(Ie,pe):W===jO&&ve?ze=v==null?void 0:v(Ie,pe):W===BO&&ve&&(ze=b==null?void 0:b(Ie,pe)),W!==uv&&ve&&ze!==!1&&oe()}}var $=ckt(ee),ae=Sn($,1),Z=ae[0],ne=function(Ie){var ve,ze,Ae;switch(Ie){case UO:return ve={},Ut(ve,t5,f),Ut(ve,tR,y),Ut(ve,nR,C),ve;case jO:return ze={},Ut(ze,t5,p),Ut(ze,tR,w),Ut(ze,nR,P),ze;case BO:return Ae={},Ut(Ae,t5,m),Ut(Ae,tR,x),Ut(Ae,nR,A),Ae;default:return{}}},te=g.useMemo(function(){return ne(W)},[W]),q=pkt(W,!t,function(pe){if(pe===t5){var Ie=te[t5];return Ie?Ie(G()):B$e}if(he in te){var ve;Y(((ve=te[he])===null||ve===void 0?void 0:ve.call(te,G(),null))||null)}return he===nR&&(Z(G()),u>0&&(clearTimeout(_.current),_.current=setTimeout(function(){ee({deadline:!0})},u))),he===z$e&&oe(),hkt}),le=Sn(q,2),de=le[0],he=le[1],me=Y$e(he);Q.current=me,W$e(function(){k(e);var pe=O.current;O.current=!0;var Ie;!pe&&e&&l&&(Ie=UO),pe&&e&&i&&(Ie=jO),(pe&&!e&&c||!pe&&d&&!e&&c)&&(Ie=BO);var ve=ne(Ie);Ie&&(t||ve[t5])?(F(Ie),de()):F(uv)},[e]),g.useEffect(function(){(W===UO&&!l||W===jO&&!i||W===BO&&!c)&&F(uv)},[l,i,c]),g.useEffect(function(){return function(){O.current=!1,clearTimeout(_.current)}},[]);var ce=g.useRef(!1);g.useEffect(function(){D&&(ce.current=!0),D!==void 0&&W===uv&&((ce.current||D)&&(T==null||T(D)),ce.current=!0)},[D,W]);var Pe=j;return te[t5]&&he===tR&&(Pe=nn({transition:"none"},Pe)),[W,he,Pe,D??e]}function mkt(t){var e=t;Vr(t)==="object"&&(e=t.transitionSupport);function n(r,i){return!!(r.motionName&&e&&i!==!1)}var o=g.forwardRef(function(r,i){var a=r.visible,l=a===void 0?!0:a,s=r.removeOnLeave,c=s===void 0?!0:s,u=r.forceRender,d=r.children,f=r.motionName,p=r.leavedClassName,m=r.eventProps,y=g.useContext(rkt),w=y.motion,x=n(r,w),C=g.useRef(),P=g.useRef();function A(){try{return C.current instanceof HTMLElement?C.current:jk(P.current)}catch{return null}}var S=gkt(x,l,A,r),v=Sn(S,4),b=v[0],T=v[1],R=v[2],M=v[3],D=g.useRef(M);M&&(D.current=!0);var k=g.useCallback(function(Y){C.current=Y,G5e(i,Y)},[i]),N,U=nn(nn({},m),{},{visible:l});if(!d)N=null;else if(b===uv)M?N=d(nn({},U),k):!c&&D.current&&p?N=d(nn(nn({},U),{},{className:p}),k):u||!c&&!p?N=d(nn(nn({},U),{},{style:{display:"none"}}),k):N=null;else{var W,F;T===t5?F="prepare":Y$e(T)?F="active":T===tR&&(F="start");var E=USe(f,"".concat(b,"-").concat(F));N=d(nn(nn({},U),{},{className:Bn(USe(f,b),(W={},Ut(W,E,E&&F),Ut(W,f,typeof f=="string"),W)),style:R}),k)}if(g.isValidElement(N)&&Z8(N)){var L=N,j=L.ref;j||(N=g.cloneElement(N,{ref:k}))}return g.createElement(ikt,{ref:P},N)});return o.displayName="CSSMotion",o}const Oy=mkt(L$e);var Ofe="add",_fe="keep",Vfe="remove",ble="removed";function ykt(t){var e;return t&&Vr(t)==="object"&&"key"in t?e=t:e={key:t},nn(nn({},e),{},{key:String(e.key)})}function Gfe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return t.map(ykt)}function Akt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],o=0,r=e.length,i=Gfe(t),a=Gfe(e);i.forEach(function(c){for(var u=!1,d=o;d1});return s.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==Vfe}),n.forEach(function(u){u.key===c&&(u.status=_fe)})}),n}var wkt=["component","children","onVisibleChanged","onAllRemoved"],xkt=["status"],vkt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function bkt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oy,n=function(o){XM(i,o);var r=JM(i);function i(){var a;Uh(this,i);for(var l=arguments.length,s=new Array(l),c=0;c1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=nn({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||BSe(r,Rkt))||n.data&&BSe(r,Hkt)||n.attr&&Ckt.includes(r))&&(o[r]=t[r])}),o}var O$e=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.className,i=t.duration,a=i===void 0?4.5:i,l=t.showProgress,s=t.pauseOnHover,c=s===void 0?!0:s,u=t.eventKey,d=t.content,f=t.closable,p=t.closeIcon,m=p===void 0?"x":p,y=t.props,w=t.onClick,x=t.onNoticeClose,C=t.times,P=t.hovering,A=g.useState(!1),S=Sn(A,2),v=S[0],b=S[1],T=g.useState(0),R=Sn(T,2),M=R[0],D=R[1],k=g.useState(0),N=Sn(k,2),U=N[0],W=N[1],F=P||v,E=a>0&&l,L=function(){x(u)},j=function(oe){(oe.key==="Enter"||oe.code==="Enter"||oe.keyCode===Lo.ENTER)&&L()};g.useEffect(function(){if(!F&&a>0){var Q=Date.now()-U,oe=setTimeout(function(){L()},a*1e3-U);return function(){c&&clearTimeout(oe),W(Date.now()-Q)}}},[a,F,C]),g.useEffect(function(){if(!F&&E&&(c||U===0)){var Q=performance.now(),oe,ee=function q(){cancelAnimationFrame(oe),oe=requestAnimationFrame(function(ae){var Z=ae+U-Q,ne=Math.min(Z/(a*1e3),1);D(ne*100),ne<1&&q()})};return ee(),function(){c&&cancelAnimationFrame(oe)}}},[a,U,F,E,C]);var Y=g.useMemo(function(){return Vr(f)==="object"&&f!==null?f:f?{closeIcon:m}:{}},[f,m]),O=F1(Y,!0),_=100-(!M||M<0?0:M>100?100:M),G="".concat(n,"-notice");return g.createElement("div",Uo({},y,{ref:e,className:Bn(G,r,Ut({},"".concat(G,"-closable"),f)),style:o,onMouseEnter:function(oe){var ee;b(!0),y==null||(ee=y.onMouseEnter)===null||ee===void 0||ee.call(y,oe)},onMouseLeave:function(oe){var ee;b(!1),y==null||(ee=y.onMouseLeave)===null||ee===void 0||ee.call(y,oe)},onClick:w}),g.createElement("div",{className:"".concat(G,"-content")},d),f&&g.createElement("a",Uo({tabIndex:0,className:"".concat(G,"-close"),onKeyDown:j,"aria-label":"Close"},O,{onClick:function(oe){oe.preventDefault(),oe.stopPropagation(),L()}}),Y.closeIcon),E&&g.createElement("progress",{className:"".concat(G,"-progress"),max:"100",value:_},_+"%"))}),_$e=xe.createContext({}),Mkt=function(e){var n=e.children,o=e.classNames;return xe.createElement(_$e.Provider,{value:{classNames:o}},n)},YSe=8,OSe=3,_Se=16,Ikt=function(e){var n={offset:YSe,threshold:OSe,gap:_Se};if(e&&Vr(e)==="object"){var o,r,i;n.offset=(o=e.offset)!==null&&o!==void 0?o:YSe,n.threshold=(r=e.threshold)!==null&&r!==void 0?r:OSe,n.gap=(i=e.gap)!==null&&i!==void 0?i:_Se}return[!!e,n]},zkt=["className","style","classNames","styles"],Dkt=function(e){var n=e.configList,o=e.placement,r=e.prefixCls,i=e.className,a=e.style,l=e.motion,s=e.onAllNoticeRemoved,c=e.onNoticeClose,u=e.stack,d=g.useContext(_$e),f=d.classNames,p=g.useRef({}),m=g.useState(null),y=Sn(m,2),w=y[0],x=y[1],C=g.useState([]),P=Sn(C,2),A=P[0],S=P[1],v=n.map(function(F){return{config:F,key:String(F.key)}}),b=Ikt(u),T=Sn(b,2),R=T[0],M=T[1],D=M.offset,k=M.threshold,N=M.gap,U=R&&(A.length>0||v.length<=k),W=typeof l=="function"?l(o):l;return g.useEffect(function(){R&&A.length>1&&S(function(F){return F.filter(function(E){return v.some(function(L){var j=L.key;return E===j})})})},[A,v,R]),g.useEffect(function(){var F;if(R&&p.current[(F=v[v.length-1])===null||F===void 0?void 0:F.key]){var E;x(p.current[(E=v[v.length-1])===null||E===void 0?void 0:E.key])}},[v,R]),xe.createElement(Skt,Uo({key:o,className:Bn(r,"".concat(r,"-").concat(o),f==null?void 0:f.list,i,Ut(Ut({},"".concat(r,"-stack"),!!R),"".concat(r,"-stack-expanded"),U)),style:a,keys:v,motionAppear:!0},W,{onAllRemoved:function(){s(o)}}),function(F,E){var L=F.config,j=F.className,Y=F.style,O=F.index,_=L,G=_.key,Q=_.times,oe=String(G),ee=L,q=ee.className,ae=ee.style,Z=ee.classNames,ne=ee.styles,te=Ai(ee,zkt),$=v.findIndex(function(se){return se.key===oe}),le={};if(R){var de=v.length-1-($>-1?$:O-1),he=o==="top"||o==="bottom"?"-50%":"0";if(de>0){var me,ce,Pe;le.height=U?(me=p.current[oe])===null||me===void 0?void 0:me.offsetHeight:w==null?void 0:w.offsetHeight;for(var pe=0,Ie=0;Ie-1?p.current[oe]=ge:delete p.current[oe]},prefixCls:r,classNames:Z,styles:ne,className:Bn(q,f==null?void 0:f.notice),style:ae,times:Q,key:G,eventKey:G,onNoticeClose:c,hovering:R&&A.length>0})))})},Ekt=g.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-notification":n,r=t.container,i=t.motion,a=t.maxCount,l=t.className,s=t.style,c=t.onAllRemoved,u=t.stack,d=t.renderNotifications,f=g.useState([]),p=Sn(f,2),m=p[0],y=p[1],w=function(R){var M,D=m.find(function(k){return k.key===R});D==null||(M=D.onClose)===null||M===void 0||M.call(D),y(function(k){return k.filter(function(N){return N.key!==R})})};g.useImperativeHandle(e,function(){return{open:function(R){y(function(M){var D=$o(M),k=D.findIndex(function(W){return W.key===R.key}),N=nn({},R);if(k>=0){var U;N.times=(((U=M[k])===null||U===void 0?void 0:U.times)||0)+1,D[k]=N}else N.times=0,D.push(N);return a>0&&D.length>a&&(D=D.slice(-a)),D})},close:function(R){w(R)},destroy:function(){y([])}}});var x=g.useState({}),C=Sn(x,2),P=C[0],A=C[1];g.useEffect(function(){var T={};m.forEach(function(R){var M=R.placement,D=M===void 0?"topRight":M;D&&(T[D]=T[D]||[],T[D].push(R))}),Object.keys(P).forEach(function(R){T[R]=T[R]||[]}),A(T)},[m]);var S=function(R){A(function(M){var D=nn({},M),k=D[R]||[];return k.length||delete D[R],D})},v=g.useRef(!1);if(g.useEffect(function(){Object.keys(P).length>0?v.current=!0:v.current&&(c==null||c(),v.current=!1)},[P]),!r)return null;var b=Object.keys(P);return r0.createPortal(g.createElement(g.Fragment,null,b.map(function(T){var R=P[T],M=g.createElement(Dkt,{key:T,configList:R,placement:T,prefixCls:o,className:l==null?void 0:l(T),style:s==null?void 0:s(T),motion:i,onNoticeClose:w,onAllNoticeRemoved:S,stack:u});return d?d(M,{prefixCls:o,key:T}):M})),r)}),kkt=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],Fkt=function(){return document.body},VSe=0;function Lkt(){for(var t={},e=arguments.length,n=new Array(e),o=0;o0&&arguments[0]!==void 0?arguments[0]:{},e=t.getContainer,n=e===void 0?Fkt:e,o=t.motion,r=t.prefixCls,i=t.maxCount,a=t.className,l=t.style,s=t.onAllRemoved,c=t.stack,u=t.renderNotifications,d=Ai(t,kkt),f=g.useState(),p=Sn(f,2),m=p[0],y=p[1],w=g.useRef(),x=g.createElement(Ekt,{container:m,ref:w,prefixCls:r,motion:o,maxCount:i,className:a,style:l,onAllRemoved:s,stack:c,renderNotifications:u}),C=g.useState([]),P=Sn(C,2),A=P[0],S=P[1],v=g.useMemo(function(){return{open:function(T){var R=Lkt(d,T);(R.key===null||R.key===void 0)&&(R.key="rc-notification-".concat(VSe),VSe+=1),S(function(M){return[].concat($o(M),[{type:"open",config:R}])})},close:function(T){S(function(R){return[].concat($o(R),[{type:"close",key:T}])})},destroy:function(){S(function(T){return[].concat($o(T),[{type:"destroy"}])})}}},[]);return g.useEffect(function(){y(n())}),g.useEffect(function(){w.current&&A.length&&(A.forEach(function(b){switch(b.type){case"open":w.current.open(b.config);break;case"close":w.current.close(b.key);break;case"destroy":w.current.destroy();break}}),S(function(b){return b.filter(function(T){return!A.includes(T)})}))},[A]),[v,x]}var Nkt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},Ukt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Nkt}))},qM=g.forwardRef(Ukt);const iU=xe.createContext(void 0),Iw=100,jkt=10,V$e=Iw*jkt,G$e={Modal:Iw,Drawer:Iw,Popover:Iw,Popconfirm:Iw,Tooltip:Iw,Tour:Iw,FloatButton:Iw},Bkt={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function Ykt(t){return t in G$e}const a6=(t,e)=>{const[,n]=Ff(),o=xe.useContext(iU),r=Ykt(t);let i;if(e!==void 0)i=[e,e];else{let a=o??0;r?a+=(o?0:n.zIndexPopupBase)+G$e[t]:a+=Bkt[t],i=[o===void 0?e:a,a]}return i},Okt=t=>{const{componentCls:e,iconCls:n,boxShadow:o,colorText:r,colorSuccess:i,colorError:a,colorWarning:l,colorInfo:s,fontSizeLG:c,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:f,paddingXS:p,borderRadiusLG:m,zIndexPopup:y,contentPadding:w,contentBg:x}=t,C=`${e}-notice`,P=new xa("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:p,transform:"translateY(0)",opacity:1}}),A=new xa("MessageMoveOut",{"0%":{maxHeight:t.height,padding:p,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}}),S={padding:p,textAlign:"center",[`${e}-custom-content`]:{display:"flex",alignItems:"center"},[`${e}-custom-content > ${n}`]:{marginInlineEnd:f,fontSize:c},[`${C}-content`]:{display:"inline-block",padding:w,background:x,borderRadius:m,boxShadow:o,pointerEvents:"all"},[`${e}-success > ${n}`]:{color:i},[`${e}-error > ${n}`]:{color:a},[`${e}-warning > ${n}`]:{color:l},[`${e}-info > ${n}, + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,Ckt="".concat(Tkt," ").concat(Pkt).split(/[\s\n]+/),Rkt="aria-",Hkt="data-";function BSe(t,e){return t.indexOf(e)===0}function F1(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=nn({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||BSe(r,Rkt))||n.data&&BSe(r,Hkt)||n.attr&&Ckt.includes(r))&&(o[r]=t[r])}),o}var O$e=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.className,i=t.duration,a=i===void 0?4.5:i,l=t.showProgress,s=t.pauseOnHover,c=s===void 0?!0:s,u=t.eventKey,d=t.content,f=t.closable,p=t.closeIcon,m=p===void 0?"x":p,y=t.props,w=t.onClick,x=t.onNoticeClose,C=t.times,P=t.hovering,A=g.useState(!1),S=Sn(A,2),v=S[0],b=S[1],T=g.useState(0),R=Sn(T,2),M=R[0],D=R[1],k=g.useState(0),N=Sn(k,2),U=N[0],W=N[1],F=P||v,E=a>0&&l,L=function(){x(u)},j=function(oe){(oe.key==="Enter"||oe.code==="Enter"||oe.keyCode===Lo.ENTER)&&L()};g.useEffect(function(){if(!F&&a>0){var Q=Date.now()-U,oe=setTimeout(function(){L()},a*1e3-U);return function(){c&&clearTimeout(oe),W(Date.now()-Q)}}},[a,F,C]),g.useEffect(function(){if(!F&&E&&(c||U===0)){var Q=performance.now(),oe,ee=function $(){cancelAnimationFrame(oe),oe=requestAnimationFrame(function(ae){var Z=ae+U-Q,ne=Math.min(Z/(a*1e3),1);D(ne*100),ne<1&&$()})};return ee(),function(){c&&cancelAnimationFrame(oe)}}},[a,U,F,E,C]);var Y=g.useMemo(function(){return Vr(f)==="object"&&f!==null?f:f?{closeIcon:m}:{}},[f,m]),O=F1(Y,!0),_=100-(!M||M<0?0:M>100?100:M),G="".concat(n,"-notice");return g.createElement("div",Uo({},y,{ref:e,className:Bn(G,r,Ut({},"".concat(G,"-closable"),f)),style:o,onMouseEnter:function(oe){var ee;b(!0),y==null||(ee=y.onMouseEnter)===null||ee===void 0||ee.call(y,oe)},onMouseLeave:function(oe){var ee;b(!1),y==null||(ee=y.onMouseLeave)===null||ee===void 0||ee.call(y,oe)},onClick:w}),g.createElement("div",{className:"".concat(G,"-content")},d),f&&g.createElement("a",Uo({tabIndex:0,className:"".concat(G,"-close"),onKeyDown:j,"aria-label":"Close"},O,{onClick:function(oe){oe.preventDefault(),oe.stopPropagation(),L()}}),Y.closeIcon),E&&g.createElement("progress",{className:"".concat(G,"-progress"),max:"100",value:_},_+"%"))}),_$e=xe.createContext({}),Mkt=function(e){var n=e.children,o=e.classNames;return xe.createElement(_$e.Provider,{value:{classNames:o}},n)},YSe=8,OSe=3,_Se=16,Ikt=function(e){var n={offset:YSe,threshold:OSe,gap:_Se};if(e&&Vr(e)==="object"){var o,r,i;n.offset=(o=e.offset)!==null&&o!==void 0?o:YSe,n.threshold=(r=e.threshold)!==null&&r!==void 0?r:OSe,n.gap=(i=e.gap)!==null&&i!==void 0?i:_Se}return[!!e,n]},zkt=["className","style","classNames","styles"],Dkt=function(e){var n=e.configList,o=e.placement,r=e.prefixCls,i=e.className,a=e.style,l=e.motion,s=e.onAllNoticeRemoved,c=e.onNoticeClose,u=e.stack,d=g.useContext(_$e),f=d.classNames,p=g.useRef({}),m=g.useState(null),y=Sn(m,2),w=y[0],x=y[1],C=g.useState([]),P=Sn(C,2),A=P[0],S=P[1],v=n.map(function(F){return{config:F,key:String(F.key)}}),b=Ikt(u),T=Sn(b,2),R=T[0],M=T[1],D=M.offset,k=M.threshold,N=M.gap,U=R&&(A.length>0||v.length<=k),W=typeof l=="function"?l(o):l;return g.useEffect(function(){R&&A.length>1&&S(function(F){return F.filter(function(E){return v.some(function(L){var j=L.key;return E===j})})})},[A,v,R]),g.useEffect(function(){var F;if(R&&p.current[(F=v[v.length-1])===null||F===void 0?void 0:F.key]){var E;x(p.current[(E=v[v.length-1])===null||E===void 0?void 0:E.key])}},[v,R]),xe.createElement(Skt,Uo({key:o,className:Bn(r,"".concat(r,"-").concat(o),f==null?void 0:f.list,i,Ut(Ut({},"".concat(r,"-stack"),!!R),"".concat(r,"-stack-expanded"),U)),style:a,keys:v,motionAppear:!0},W,{onAllRemoved:function(){s(o)}}),function(F,E){var L=F.config,j=F.className,Y=F.style,O=F.index,_=L,G=_.key,Q=_.times,oe=String(G),ee=L,$=ee.className,ae=ee.style,Z=ee.classNames,ne=ee.styles,te=Ai(ee,zkt),q=v.findIndex(function(se){return se.key===oe}),le={};if(R){var de=v.length-1-(q>-1?q:O-1),he=o==="top"||o==="bottom"?"-50%":"0";if(de>0){var me,ce,Pe;le.height=U?(me=p.current[oe])===null||me===void 0?void 0:me.offsetHeight:w==null?void 0:w.offsetHeight;for(var pe=0,Ie=0;Ie-1?p.current[oe]=ge:delete p.current[oe]},prefixCls:r,classNames:Z,styles:ne,className:Bn($,f==null?void 0:f.notice),style:ae,times:Q,key:G,eventKey:G,onNoticeClose:c,hovering:R&&A.length>0})))})},Ekt=g.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-notification":n,r=t.container,i=t.motion,a=t.maxCount,l=t.className,s=t.style,c=t.onAllRemoved,u=t.stack,d=t.renderNotifications,f=g.useState([]),p=Sn(f,2),m=p[0],y=p[1],w=function(R){var M,D=m.find(function(k){return k.key===R});D==null||(M=D.onClose)===null||M===void 0||M.call(D),y(function(k){return k.filter(function(N){return N.key!==R})})};g.useImperativeHandle(e,function(){return{open:function(R){y(function(M){var D=$o(M),k=D.findIndex(function(W){return W.key===R.key}),N=nn({},R);if(k>=0){var U;N.times=(((U=M[k])===null||U===void 0?void 0:U.times)||0)+1,D[k]=N}else N.times=0,D.push(N);return a>0&&D.length>a&&(D=D.slice(-a)),D})},close:function(R){w(R)},destroy:function(){y([])}}});var x=g.useState({}),C=Sn(x,2),P=C[0],A=C[1];g.useEffect(function(){var T={};m.forEach(function(R){var M=R.placement,D=M===void 0?"topRight":M;D&&(T[D]=T[D]||[],T[D].push(R))}),Object.keys(P).forEach(function(R){T[R]=T[R]||[]}),A(T)},[m]);var S=function(R){A(function(M){var D=nn({},M),k=D[R]||[];return k.length||delete D[R],D})},v=g.useRef(!1);if(g.useEffect(function(){Object.keys(P).length>0?v.current=!0:v.current&&(c==null||c(),v.current=!1)},[P]),!r)return null;var b=Object.keys(P);return r0.createPortal(g.createElement(g.Fragment,null,b.map(function(T){var R=P[T],M=g.createElement(Dkt,{key:T,configList:R,placement:T,prefixCls:o,className:l==null?void 0:l(T),style:s==null?void 0:s(T),motion:i,onNoticeClose:w,onAllNoticeRemoved:S,stack:u});return d?d(M,{prefixCls:o,key:T}):M})),r)}),kkt=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],Fkt=function(){return document.body},VSe=0;function Lkt(){for(var t={},e=arguments.length,n=new Array(e),o=0;o0&&arguments[0]!==void 0?arguments[0]:{},e=t.getContainer,n=e===void 0?Fkt:e,o=t.motion,r=t.prefixCls,i=t.maxCount,a=t.className,l=t.style,s=t.onAllRemoved,c=t.stack,u=t.renderNotifications,d=Ai(t,kkt),f=g.useState(),p=Sn(f,2),m=p[0],y=p[1],w=g.useRef(),x=g.createElement(Ekt,{container:m,ref:w,prefixCls:r,motion:o,maxCount:i,className:a,style:l,onAllRemoved:s,stack:c,renderNotifications:u}),C=g.useState([]),P=Sn(C,2),A=P[0],S=P[1],v=g.useMemo(function(){return{open:function(T){var R=Lkt(d,T);(R.key===null||R.key===void 0)&&(R.key="rc-notification-".concat(VSe),VSe+=1),S(function(M){return[].concat($o(M),[{type:"open",config:R}])})},close:function(T){S(function(R){return[].concat($o(R),[{type:"close",key:T}])})},destroy:function(){S(function(T){return[].concat($o(T),[{type:"destroy"}])})}}},[]);return g.useEffect(function(){y(n())}),g.useEffect(function(){w.current&&A.length&&(A.forEach(function(b){switch(b.type){case"open":w.current.open(b.config);break;case"close":w.current.close(b.key);break;case"destroy":w.current.destroy();break}}),S(function(b){return b.filter(function(T){return!A.includes(T)})}))},[A]),[v,x]}var Nkt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},Ukt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Nkt}))},qM=g.forwardRef(Ukt);const iU=xe.createContext(void 0),Iw=100,jkt=10,V$e=Iw*jkt,G$e={Modal:Iw,Drawer:Iw,Popover:Iw,Popconfirm:Iw,Tooltip:Iw,Tour:Iw,FloatButton:Iw},Bkt={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function Ykt(t){return t in G$e}const a6=(t,e)=>{const[,n]=Ff(),o=xe.useContext(iU),r=Ykt(t);let i;if(e!==void 0)i=[e,e];else{let a=o??0;r?a+=(o?0:n.zIndexPopupBase)+G$e[t]:a+=Bkt[t],i=[o===void 0?e:a,a]}return i},Okt=t=>{const{componentCls:e,iconCls:n,boxShadow:o,colorText:r,colorSuccess:i,colorError:a,colorWarning:l,colorInfo:s,fontSizeLG:c,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:f,paddingXS:p,borderRadiusLG:m,zIndexPopup:y,contentPadding:w,contentBg:x}=t,C=`${e}-notice`,P=new xa("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:p,transform:"translateY(0)",opacity:1}}),A=new xa("MessageMoveOut",{"0%":{maxHeight:t.height,padding:p,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}}),S={padding:p,textAlign:"center",[`${e}-custom-content`]:{display:"flex",alignItems:"center"},[`${e}-custom-content > ${n}`]:{marginInlineEnd:f,fontSize:c},[`${C}-content`]:{display:"inline-block",padding:w,background:x,borderRadius:m,boxShadow:o,pointerEvents:"all"},[`${e}-success > ${n}`]:{color:i},[`${e}-error > ${n}`]:{color:a},[`${e}-warning > ${n}`]:{color:l},[`${e}-info > ${n}, ${e}-loading > ${n}`]:{color:s}};return[{[e]:Object.assign(Object.assign({},Ua(t)),{color:r,position:"fixed",top:f,width:"100%",pointerEvents:"none",zIndex:y,[`${e}-move-up`]:{animationFillMode:"forwards"},[` ${e}-move-up-appear, ${e}-move-up-enter `]:{animationName:P,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[` ${e}-move-up-appear${e}-move-up-appear-active, ${e}-move-up-enter${e}-move-up-enter-active - `]:{animationPlayState:"running"},[`${e}-move-up-leave`]:{animationName:A,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[`${e}-move-up-leave${e}-move-up-leave-active`]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[e]:{[`${C}-wrapper`]:Object.assign({},S)}},{[`${e}-notice-pure-panel`]:Object.assign(Object.assign({},S),{padding:0,textAlign:"start"})}]},_kt=t=>({zIndexPopup:t.zIndexPopupBase+V$e+10,contentBg:t.colorBgElevated,contentPadding:`${(t.controlHeightLG-t.fontSize*t.lineHeight)/2}px ${t.paddingSM}px`}),X$e=el("Message",t=>{const e=Ui(t,{height:150});return[Okt(e)]},_kt);var Vkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{prefixCls:e,type:n,icon:o,children:r}=t;return g.createElement("div",{className:Mn(`${e}-custom-content`,`${e}-${n}`)},o||Gkt[n],g.createElement("span",null,r))},Xkt=t=>{const{prefixCls:e,className:n,type:o,icon:r,content:i}=t,a=Vkt(t,["prefixCls","className","type","icon","content"]),{getPrefixCls:l}=g.useContext(gr),s=e||l("message"),c=nu(s),[u,d,f]=X$e(s,c);return u(g.createElement(O$e,Object.assign({},a,{prefixCls:s,className:Mn(n,d,`${s}-notice-pure-panel`,f,c),eventKey:"pure",duration:null,content:g.createElement(J$e,{prefixCls:s,type:o,icon:r},i)})))};function Jkt(t,e){return{motionName:e??`${t}-move-up`}}function Z5e(t){let e;const n=new Promise(r=>{e=t(()=>{r(!0)})}),o=()=>{e==null||e()};return o.then=(r,i)=>n.then(r,i),o.promise=n,o}var Kkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{children:e,prefixCls:n}=t;const o=nu(n),[r,i,a]=X$e(n,o);return r(g.createElement(Mkt,{classNames:{list:Mn(i,a,o)}},e))},Zkt=(t,e)=>{let{prefixCls:n,key:o}=e;return g.createElement(Qkt,{prefixCls:n,key:o},t)},eFt=g.forwardRef((t,e)=>{const{top:n,prefixCls:o,getContainer:r,maxCount:i,duration:a=qkt,rtl:l,transitionName:s,onAllRemoved:c}=t,{getPrefixCls:u,getPopupContainer:d,message:f,direction:p}=g.useContext(gr),m=o||u("message"),y=()=>({left:"50%",transform:"translateX(-50%)",top:n??$kt}),w=()=>Mn({[`${m}-rtl`]:l??p==="rtl"}),x=()=>Jkt(m,s),C=g.createElement("span",{className:`${m}-close-x`},g.createElement(i6,{className:`${m}-close-icon`})),[P,A]=Wkt({prefixCls:m,style:y,className:w,motion:x,closable:!1,closeIcon:C,duration:a,getContainer:()=>(r==null?void 0:r())||(d==null?void 0:d())||document.body,maxCount:i,onAllRemoved:c,renderNotifications:Zkt});return g.useImperativeHandle(e,()=>Object.assign(Object.assign({},P),{prefixCls:m,message:f})),A});let GSe=0;function K$e(t){const e=g.useRef(null);return LS(),[g.useMemo(()=>{const o=s=>{var c;(c=e.current)===null||c===void 0||c.close(s)},r=s=>{if(!e.current){const v=()=>{};return v.then=()=>{},v}const{open:c,prefixCls:u,message:d}=e.current,f=`${u}-notice`,{content:p,icon:m,type:y,key:w,className:x,style:C,onClose:P}=s,A=Kkt(s,["content","icon","type","key","className","style","onClose"]);let S=w;return S==null&&(GSe+=1,S=`antd-message-${GSe}`),Z5e(v=>(c(Object.assign(Object.assign({},A),{key:S,content:g.createElement(J$e,{prefixCls:u,type:y,icon:m},p),placement:"top",className:Mn(y&&`${f}-${y}`,x,d==null?void 0:d.className),style:Object.assign(Object.assign({},d==null?void 0:d.style),C),onClose:()=>{P==null||P(),v()}})),()=>{o(S)}))},a={open:r,destroy:s=>{var c;s!==void 0?o(s):(c=e.current)===null||c===void 0||c.destroy()}};return["info","success","warning","error","loading"].forEach(s=>{const c=(u,d,f)=>{let p;u&&typeof u=="object"&&"content"in u?p=u:p={content:u};let m,y;typeof d=="function"?y=d:(m=d,y=f);const w=Object.assign(Object.assign({onClose:y,duration:m},p),{type:s});return r(w)};a[s]=c}),a},[]),g.createElement(eFt,Object.assign({key:"message-holder"},t,{ref:e}))]}function tFt(t){return K$e(t)}function nFt(){const[t,e]=g.useState([]),n=g.useCallback(o=>(e(r=>[].concat(Pa(r),[o])),()=>{e(r=>r.filter(i=>i!==o))}),[]);return[t,n]}function TL(){TL=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(F,E,L){F[E]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(F,E,L){return Object.defineProperty(F,E,{value:L,enumerable:!0,configurable:!0,writable:!0}),F[E]}try{c({},"")}catch{c=function(L,j,Y){return L[j]=Y}}function u(F,E,L,j){var Y=E&&E.prototype instanceof x?E:x,O=Object.create(Y.prototype),_=new U(j||[]);return r(O,"_invoke",{value:M(F,L,_)}),O}function d(F,E,L){try{return{type:"normal",arg:F.call(E,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",y="completed",w={};function x(){}function C(){}function P(){}var A={};c(A,a,function(){return this});var S=Object.getPrototypeOf,v=S&&S(S(W([])));v&&v!==n&&o.call(v,a)&&(A=v);var b=P.prototype=x.prototype=Object.create(A);function T(F){["next","throw","return"].forEach(function(E){c(F,E,function(L){return this._invoke(E,L)})})}function R(F,E){function L(Y,O,_,G){var Q=d(F[Y],F,O);if(Q.type!=="throw"){var oe=Q.arg,ee=oe.value;return ee&&jp(ee)=="object"&&o.call(ee,"__await")?E.resolve(ee.__await).then(function(q){L("next",q,_,G)},function(q){L("throw",q,_,G)}):E.resolve(ee).then(function(q){oe.value=q,_(oe)},function(q){return L("throw",q,_,G)})}G(Q.arg)}var j;r(this,"_invoke",{value:function(O,_){function G(){return new E(function(Q,oe){L(O,_,Q,oe)})}return j=j?j.then(G,G):G()}})}function M(F,E,L){var j=f;return function(Y,O){if(j===m)throw new Error("Generator is already running");if(j===y){if(Y==="throw")throw O;return{value:t,done:!0}}for(L.method=Y,L.arg=O;;){var _=L.delegate;if(_){var G=D(_,L);if(G){if(G===w)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=y,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=m;var Q=d(F,E,L);if(Q.type==="normal"){if(j=L.done?y:p,Q.arg===w)continue;return{value:Q.arg,done:L.done}}Q.type==="throw"&&(j=y,L.method="throw",L.arg=Q.arg)}}}function D(F,E){var L=E.method,j=F.iterator[L];if(j===t)return E.delegate=null,L==="throw"&&F.iterator.return&&(E.method="return",E.arg=t,D(F,E),E.method==="throw")||L!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+L+"' method")),w;var Y=d(j,F.iterator,E.arg);if(Y.type==="throw")return E.method="throw",E.arg=Y.arg,E.delegate=null,w;var O=Y.arg;return O?O.done?(E[F.resultName]=O.value,E.next=F.nextLoc,E.method!=="return"&&(E.method="next",E.arg=t),E.delegate=null,w):O:(E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,w)}function k(F){var E={tryLoc:F[0]};1 in F&&(E.catchLoc=F[1]),2 in F&&(E.finallyLoc=F[2],E.afterLoc=F[3]),this.tryEntries.push(E)}function N(F){var E=F.completion||{};E.type="normal",delete E.arg,F.completion=E}function U(F){this.tryEntries=[{tryLoc:"root"}],F.forEach(k,this),this.reset(!0)}function W(F){if(F||F===""){var E=F[a];if(E)return E.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var L=-1,j=function Y(){for(;++L=0;--Y){var O=this.tryEntries[Y],_=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),Q=o.call(O,"finallyLoc");if(G&&Q){if(this.prev=0;--j){var Y=this.tryEntries[j];if(Y.tryLoc<=this.prev&&o.call(Y,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===E)return this.complete(j.completion,j.afterLoc),N(j),w}},catch:function(E){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===E){var Y=j.completion;if(Y.type==="throw"){var O=Y.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(E,L,j){return this.delegate={iterator:W(E),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),w}},e}function XSe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function $$e(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){XSe(i,o,r,a,l,"next",s)}function l(s){XSe(i,o,r,a,l,"throw",s)}a(void 0)})}}var aU=yH({},zyt),oFt=aU.version,Sle=aU.render,rFt=aU.unmountComponentAtNode,dZ;try{var iFt=Number((oFt||"").split(".")[0]);iFt>=18&&(dZ=aU.createRoot)}catch{}function JSe(t){var e=aU.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e&&jp(e)==="object"&&(e.usingClientEntryPoint=t)}var eJ="__rc_react_root__";function aFt(t,e){JSe(!0);var n=e[eJ]||dZ(e);JSe(!1),n.render(t),e[eJ]=n}function lFt(t,e){Sle==null||Sle(t,e)}function sFt(t,e){if(dZ){aFt(t,e);return}lFt(t,e)}function cFt(t){return Xfe.apply(this,arguments)}function Xfe(){return Xfe=$$e(TL().mark(function t(e){return TL().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",Promise.resolve().then(function(){var r;(r=e[eJ])===null||r===void 0||r.unmount(),delete e[eJ]}));case 1:case"end":return o.stop()}},t)})),Xfe.apply(this,arguments)}function uFt(t){rFt(t)}function dFt(t){return Jfe.apply(this,arguments)}function Jfe(){return Jfe=$$e(TL().mark(function t(e){return TL().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(dZ===void 0){o.next=2;break}return o.abrupt("return",cFt(e));case 2:uFt(e);case 3:case"end":return o.stop()}},t)})),Jfe.apply(this,arguments)}const fFt=(t,e)=>(sFt(t,e),()=>dFt(e));let hFt=fFt;function e9e(){return hFt}const Tle=()=>({height:0,opacity:0}),KSe=t=>{const{scrollHeight:e}=t;return{height:e,opacity:1}},pFt=t=>({height:t?t.offsetHeight:0}),Ple=(t,e)=>(e==null?void 0:e.deadline)===!0||e.propertyName==="height",t9e=function(){return{motionName:`${arguments.length>0&&arguments[0]!==void 0?arguments[0]:xL}-motion-collapse`,onAppearStart:Tle,onEnterStart:Tle,onAppearActive:KSe,onEnterActive:KSe,onLeaveStart:pFt,onLeaveActive:Tle,onAppearEnd:Ple,onEnterEnd:Ple,onLeaveEnd:Ple,motionDeadline:500}},L1=(t,e,n)=>n!==void 0?n:`${t}-${e}`;function Mf(t,e){var n=Object.assign({},t);return Array.isArray(e)&&e.forEach(function(o){delete n[o]}),n}const gFt=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1},mFt=t=>{const{componentCls:e,colorPrimary:n}=t;return{[e]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${t.motionEaseOutCirc}`,`opacity 2s ${t.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${t.motionDurationSlow} ${t.motionEaseInOut}`,`opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`].join(",")}}}}},yFt=sDt("Wave",t=>[mFt(t)]),fZ=`${xL}-wave-target`;function Cle(t){return t&&t!=="#fff"&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&t!=="rgba(255, 255, 255, 1)"&&!/rgba\((?:\d*, ){3}0\)/.test(t)&&t!=="transparent"}function AFt(t){const{borderTopColor:e,borderColor:n,backgroundColor:o}=getComputedStyle(t);return Cle(e)?e:Cle(n)?n:Cle(o)?o:null}function Rle(t){return Number.isNaN(t)?0:t}const wFt=t=>{const{className:e,target:n,component:o,registerUnmount:r}=t,i=g.useRef(null),a=g.useRef(null);g.useEffect(()=>{a.current=r()},[]);const[l,s]=g.useState(null),[c,u]=g.useState([]),[d,f]=g.useState(0),[p,m]=g.useState(0),[y,w]=g.useState(0),[x,C]=g.useState(0),[P,A]=g.useState(!1),S={left:d,top:p,width:y,height:x,borderRadius:c.map(T=>`${T}px`).join(" ")};l&&(S["--wave-color"]=l);function v(){const T=getComputedStyle(n);s(AFt(n));const R=T.position==="static",{borderLeftWidth:M,borderTopWidth:D}=T;f(R?n.offsetLeft:Rle(-parseFloat(M))),m(R?n.offsetTop:Rle(-parseFloat(D))),w(n.offsetWidth),C(n.offsetHeight);const{borderTopLeftRadius:k,borderTopRightRadius:N,borderBottomLeftRadius:U,borderBottomRightRadius:W}=T;u([k,N,W,U].map(F=>Rle(parseFloat(F))))}if(g.useEffect(()=>{if(n){const T=Hf(()=>{v(),A(!0)});let R;return typeof ResizeObserver<"u"&&(R=new ResizeObserver(v),R.observe(n)),()=>{Hf.cancel(T),R==null||R.disconnect()}}},[]),!P)return null;const b=(o==="Checkbox"||o==="Radio")&&(n==null?void 0:n.classList.contains(fZ));return g.createElement(cZ,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(T,R)=>{var M,D;if(R.deadline||R.propertyName==="opacity"){const k=(M=i.current)===null||M===void 0?void 0:M.parentElement;(D=a.current)===null||D===void 0||D.call(a).then(()=>{k==null||k.remove()})}return!1}},(T,R)=>{let{className:M}=T;return g.createElement("div",{ref:e2(i,R),className:Mn(e,M,{"wave-quick":b}),style:S})})},xFt=(t,e)=>{var n;const{component:o}=e;if(o==="Checkbox"&&!(!((n=t.querySelector("input"))===null||n===void 0)&&n.checked))return;const r=document.createElement("div");r.style.position="absolute",r.style.left="0px",r.style.top="0px",t==null||t.insertBefore(r,t==null?void 0:t.firstChild);const i=e9e();let a=null;function l(){return a}a=i(g.createElement(wFt,Object.assign({},e,{target:t,registerUnmount:l})),r)},vFt=(t,e,n)=>{const{wave:o}=g.useContext(gr),[,r,i]=Ff(),a=kd(c=>{const u=t.current;if(o!=null&&o.disabled||!u)return;const d=u.querySelector(`.${fZ}`)||u,{showEffect:f}=o||{};(f||xFt)(d,{className:e,token:r,component:n,event:c,hashId:i})}),l=g.useRef(null);return c=>{Hf.cancel(l.current),l.current=Hf(()=>{a(c)})}},lU=t=>{const{children:e,disabled:n,component:o}=t,{getPrefixCls:r}=g.useContext(gr),i=g.useRef(null),a=r("wave"),[,l]=yFt(a),s=vFt(i,Mn(a,l),o);if(xe.useEffect(()=>{const u=i.current;if(!u||u.nodeType!==1||n)return;const d=f=>{!gFt(f.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")||u.className.includes("-leave")||s(f)};return u.addEventListener("click",d,!0),()=>{u.removeEventListener("click",d,!0)}},[n]),!xe.isValidElement(e))return e??null;const c=YQ(e)?e2(OQ(e),i):i;return P0(e,{ref:c})},jd=t=>{const e=xe.useContext(AH);return xe.useMemo(()=>t?typeof t=="string"?t??e:t instanceof Function?t(e):e:e,[t,e])},bFt=t=>{const{componentCls:e}=t;return{[e]:{"&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},SFt=t=>{const{componentCls:e,antCls:n}=t;return{[e]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${e}-item:empty`]:{display:"none"},[`${e}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},TFt=t=>{const{componentCls:e}=t;return{[e]:{"&-gap-row-small":{rowGap:t.spaceGapSmallSize},"&-gap-row-middle":{rowGap:t.spaceGapMiddleSize},"&-gap-row-large":{rowGap:t.spaceGapLargeSize},"&-gap-col-small":{columnGap:t.spaceGapSmallSize},"&-gap-col-middle":{columnGap:t.spaceGapMiddleSize},"&-gap-col-large":{columnGap:t.spaceGapLargeSize}}}},q$e=el("Space",t=>{const e=Ui(t,{spaceGapSmallSize:t.paddingXS,spaceGapMiddleSize:t.padding,spaceGapLargeSize:t.paddingLG});return[SFt(e),TFt(e),bFt(e)]},()=>({}),{resetStyle:!1});var Q$e=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const n=g.useContext(hZ),o=g.useMemo(()=>{if(!n)return"";const{compactDirection:r,isFirstItem:i,isLastItem:a}=n,l=r==="vertical"?"-vertical-":"-";return Mn(`${t}-compact${l}item`,{[`${t}-compact${l}first-item`]:i,[`${t}-compact${l}last-item`]:a,[`${t}-compact${l}item-rtl`]:e==="rtl"})},[t,e,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:o}},PFt=t=>{const{children:e}=t;return g.createElement(hZ.Provider,{value:null},e)},CFt=t=>{const{children:e}=t,n=Q$e(t,["children"]);return g.createElement(hZ.Provider,{value:g.useMemo(()=>n,[n])},e)},RFt=t=>{const{getPrefixCls:e,direction:n}=g.useContext(gr),{size:o,direction:r,block:i,prefixCls:a,className:l,rootClassName:s,children:c}=t,u=Q$e(t,["size","direction","block","prefixCls","className","rootClassName","children"]),d=jd(P=>o??P),f=e("space-compact",a),[p,m]=q$e(f),y=Mn(f,m,{[`${f}-rtl`]:n==="rtl",[`${f}-block`]:i,[`${f}-vertical`]:r==="vertical"},l,s),w=g.useContext(hZ),x=jy(c),C=g.useMemo(()=>x.map((P,A)=>{const S=(P==null?void 0:P.key)||`${f}-item-${A}`;return g.createElement(CFt,{key:S,compactSize:d,compactDirection:r,isFirstItem:A===0&&(!w||(w==null?void 0:w.isFirstItem)),isLastItem:A===x.length-1&&(!w||(w==null?void 0:w.isLastItem))},P)}),[o,x,w]);return x.length===0?null:p(g.createElement("div",Object.assign({className:y},u),C))};var HFt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n}=g.useContext(gr),{prefixCls:o,size:r,className:i}=t,a=HFt(t,["prefixCls","size","className"]),l=e("btn-group",o),[,,s]=Ff(),c=g.useMemo(()=>{switch(r){case"large":return"lg";case"small":return"sm";default:return""}},[r]),u=Mn(l,{[`${l}-${c}`]:c,[`${l}-rtl`]:n==="rtl"},i,s);return g.createElement(Z$e.Provider,{value:r},g.createElement("div",Object.assign({},a,{className:u})))},$Se=/^[\u4E00-\u9FA5]{2}$/,Kfe=$Se.test.bind($Se);function eqe(t){return t==="danger"?{danger:!0}:{type:t}}function qSe(t){return typeof t=="string"}function Hle(t){return t==="text"||t==="link"}function IFt(t,e){if(t==null)return;const n=e?" ":"";return typeof t!="string"&&typeof t!="number"&&qSe(t.type)&&Kfe(t.props.children)?P0(t,{children:t.props.children.split("").join(n)}):qSe(t)?Kfe(t)?xe.createElement("span",null,t.split("").join(n)):xe.createElement("span",null,t):M$e(t)?xe.createElement("span",null,t):t}function zFt(t,e){let n=!1;const o=[];return xe.Children.forEach(t,r=>{const i=typeof r,a=i==="string"||i==="number";if(n&&a){const l=o.length-1,s=o[l];o[l]=`${s}${r}`}else o.push(r);n=a}),xe.Children.map(o,r=>IFt(r,e))}["default","primary","danger"].concat(Pa(Gb));const $fe=g.forwardRef((t,e)=>{const{className:n,style:o,children:r,prefixCls:i}=t,a=Mn(`${i}-icon`,n);return xe.createElement("span",{ref:e,className:a,style:o},r)}),QSe=g.forwardRef((t,e)=>{const{prefixCls:n,className:o,style:r,iconClassName:i}=t,a=Mn(`${n}-loading-icon`,o);return xe.createElement($fe,{prefixCls:n,className:a,style:r,ref:e},xe.createElement(qM,{className:i}))}),Mle=()=>({width:0,opacity:0,transform:"scale(0)"}),Ile=t=>({width:t.scrollWidth,opacity:1,transform:"scale(1)"}),DFt=t=>{const{prefixCls:e,loading:n,existIcon:o,className:r,style:i,mount:a}=t,l=!!n;return o?xe.createElement(QSe,{prefixCls:e,className:r,style:i}):xe.createElement(cZ,{visible:l,motionName:`${e}-loading-icon-motion`,motionAppear:!a,motionEnter:!a,motionLeave:!a,removeOnLeave:!0,onAppearStart:Mle,onAppearActive:Ile,onEnterStart:Mle,onEnterActive:Ile,onLeaveStart:Ile,onLeaveActive:Mle},(s,c)=>{let{className:u,style:d}=s;const f=Object.assign(Object.assign({},i),d);return xe.createElement(QSe,{prefixCls:e,className:Mn(r,u),style:f,ref:c})})},ZSe=(t,e)=>({[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineEndColor:e}}},"&:not(:first-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineStartColor:e}}}}}),EFt=t=>{const{componentCls:e,fontSize:n,lineWidth:o,groupBorderColor:r,colorErrorHover:i}=t;return{[`${e}-group`]:[{position:"relative",display:"inline-flex",[`> span, > ${e}`]:{"&:not(:last-child)":{[`&, & > ${e}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:t.calc(o).mul(-1).equal(),[`&, & > ${e}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[e]:{position:"relative",zIndex:1,"&:hover, &:focus, &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${e}-icon-only`]:{fontSize:n}},ZSe(`${e}-primary`,r),ZSe(`${e}-danger`,i)]}};function Jb(t){"@babel/helpers - typeof";return Jb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jb(t)}function kFt(t,e){if(Jb(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(Jb(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tqe(t){var e=kFt(t,"string");return Jb(e)=="symbol"?e:e+""}function FFt(t,e,n){return e=tqe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eTe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function tJ(t){for(var e=1;e=0)continue;n[o]=t[o]}return n}function oqe(t,e){if(t==null)return{};var n=OFt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var _Ft=["b"],VFt=["v"],zle=function(e){return Math.round(Number(e||0))},GFt=function(e){if(e instanceof Di)return e;if(e&&Jb(e)==="object"&&"h"in e&&"b"in e){var n=e,o=n.b,r=oqe(n,_Ft);return tJ(tJ({},r),{},{v:o})}return typeof e=="string"&&/hsb/.test(e)?e.replace(/hsb/,"hsv"):e},PL=function(t){UFt(n,t);var e=YFt(n);function n(o){return LFt(this,n),e.call(this,GFt(o))}return NFt(n,[{key:"toHsbString",value:function(){var r=this.toHsb(),i=zle(r.s*100),a=zle(r.b*100),l=zle(r.h),s=r.a,c="hsb(".concat(l,", ").concat(i,"%, ").concat(a,"%)"),u="hsba(".concat(l,", ").concat(i,"%, ").concat(a,"%, ").concat(s.toFixed(s===0?0:2),")");return s===1?c:u}},{key:"toHsb",value:function(){var r=this.toHsv(),i=r.v,a=oqe(r,VFt);return tJ(tJ({},a),{},{b:i,a:this.a})}}]),n}(Di),XFt=function(e){return e instanceof PL?e:new PL(e)};XFt("#1677ff");const JFt=(t,e)=>(t==null?void 0:t.replace(/[^\w/]/g,"").slice(0,e?8:6))||"",KFt=(t,e)=>t?JFt(t,e):"";let $Ft=function(){function t(e){$Et(this,t);var n;if(this.cleared=!1,e instanceof t){this.metaColor=e.metaColor.clone(),this.colors=(n=e.colors)===null||n===void 0?void 0:n.map(r=>({color:new t(r.color),percent:r.percent})),this.cleared=e.cleared;return}const o=Array.isArray(e);o&&e.length?(this.colors=e.map(r=>{let{color:i,percent:a}=r;return{color:new t(i),percent:a}}),this.metaColor=new PL(this.colors[0].color.metaColor)):this.metaColor=new PL(o?"":e),(!e||o&&!this.colors)&&(this.metaColor=this.metaColor.setA(0),this.cleared=!0)}return ekt(t,[{key:"toHsb",value:function(){return this.metaColor.toHsb()}},{key:"toHsbString",value:function(){return this.metaColor.toHsbString()}},{key:"toHex",value:function(){return KFt(this.toHexString(),this.metaColor.a<1)}},{key:"toHexString",value:function(){return this.metaColor.toHexString()}},{key:"toRgb",value:function(){return this.metaColor.toRgb()}},{key:"toRgbString",value:function(){return this.metaColor.toRgbString()}},{key:"isGradient",value:function(){return!!this.colors&&!this.cleared}},{key:"getColors",value:function(){return this.colors||[{color:this,percent:0}]}},{key:"toCssString",value:function(){const{colors:n}=this;return n?`linear-gradient(90deg, ${n.map(r=>`${r.color.toRgbString()} ${r.percent}%`).join(", ")})`:this.metaColor.toRgbString()}},{key:"equals",value:function(n){return!n||this.isGradient()!==n.isGradient()?!1:this.isGradient()?this.colors.length===n.colors.length&&this.colors.every((o,r)=>{const i=n.colors[r];return o.percent===i.percent&&o.color.equals(i.color)}):this.toHexString()===n.toHexString()}}])}();var qFt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},QFt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:qFt}))},xH=g.forwardRef(QFt);function t7(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return xe.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(t7(o)):_Ke.isFragment(o)&&o.props?n=n.concat(t7(o.props.children,e)):n.push(o))}),n}var rqe=xe.forwardRef(function(t,e){var n=t.prefixCls,o=t.forceRender,r=t.className,i=t.style,a=t.children,l=t.isActive,s=t.role,c=t.classNames,u=t.styles,d=xe.useState(l||o),f=Sn(d,2),p=f[0],m=f[1];return xe.useEffect(function(){(o||l)&&m(!0)},[o,l]),p?xe.createElement("div",{ref:e,className:Bn("".concat(n,"-content"),Ut(Ut({},"".concat(n,"-content-active"),l),"".concat(n,"-content-inactive"),!l),r),style:i,role:s},xe.createElement("div",{className:Bn("".concat(n,"-content-box"),c==null?void 0:c.body),style:u==null?void 0:u.body},a)):null});rqe.displayName="PanelContent";var ZFt=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],iqe=xe.forwardRef(function(t,e){var n=t.showArrow,o=n===void 0?!0:n,r=t.headerClass,i=t.isActive,a=t.onItemClick,l=t.forceRender,s=t.className,c=t.classNames,u=c===void 0?{}:c,d=t.styles,f=d===void 0?{}:d,p=t.prefixCls,m=t.collapsible,y=t.accordion,w=t.panelKey,x=t.extra,C=t.header,P=t.expandIcon,A=t.openMotion,S=t.destroyInactivePanel,v=t.children,b=Ai(t,ZFt),T=m==="disabled",R=x!=null&&typeof x!="boolean",M=Ut(Ut(Ut({onClick:function(){a==null||a(w)},onKeyDown:function(E){(E.key==="Enter"||E.keyCode===Lo.ENTER||E.which===Lo.ENTER)&&(a==null||a(w))},role:y?"tab":"button"},"aria-expanded",i),"aria-disabled",T),"tabIndex",T?-1:0),D=typeof P=="function"?P(t):xe.createElement("i",{className:"arrow"}),k=D&&xe.createElement("div",Uo({className:"".concat(p,"-expand-icon")},["header","icon"].includes(m)?M:{}),D),N=Bn("".concat(p,"-item"),Ut(Ut({},"".concat(p,"-item-active"),i),"".concat(p,"-item-disabled"),T),s),U=Bn(r,"".concat(p,"-header"),Ut({},"".concat(p,"-collapsible-").concat(m),!!m),u.header),W=nn({className:U,style:f.header},["header","icon"].includes(m)?{}:M);return xe.createElement("div",Uo({},b,{ref:e,className:N}),xe.createElement("div",W,o&&k,xe.createElement("span",Uo({className:"".concat(p,"-header-text")},m==="header"?M:{}),C),R&&xe.createElement("div",{className:"".concat(p,"-extra")},x)),xe.createElement(Oy,Uo({visible:i,leavedClassName:"".concat(p,"-content-hidden")},A,{forceRender:l,removeOnLeave:S}),function(F,E){var L=F.className,j=F.style;return xe.createElement(rqe,{ref:E,prefixCls:p,className:L,classNames:u,style:j,styles:f,isActive:i,forceRender:l,role:y?"tabpanel":void 0},v)}))}),eLt=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],tLt=function(e,n){var o=n.prefixCls,r=n.accordion,i=n.collapsible,a=n.destroyInactivePanel,l=n.onItemClick,s=n.activeKey,c=n.openMotion,u=n.expandIcon;return e.map(function(d,f){var p=d.children,m=d.label,y=d.key,w=d.collapsible,x=d.onItemClick,C=d.destroyInactivePanel,P=Ai(d,eLt),A=String(y??f),S=w??i,v=C??a,b=function(M){S!=="disabled"&&(l(M),x==null||x(M))},T=!1;return r?T=s[0]===A:T=s.indexOf(A)>-1,xe.createElement(iqe,Uo({},P,{prefixCls:o,key:A,panelKey:A,isActive:T,accordion:r,openMotion:c,expandIcon:u,header:m,collapsible:S,onItemClick:b,destroyInactivePanel:v}),p)})},nLt=function(e,n,o){if(!e)return null;var r=o.prefixCls,i=o.accordion,a=o.collapsible,l=o.destroyInactivePanel,s=o.onItemClick,c=o.activeKey,u=o.openMotion,d=o.expandIcon,f=e.key||String(n),p=e.props,m=p.header,y=p.headerClass,w=p.destroyInactivePanel,x=p.collapsible,C=p.onItemClick,P=!1;i?P=c[0]===f:P=c.indexOf(f)>-1;var A=x??a,S=function(T){A!=="disabled"&&(s(T),C==null||C(T))},v={key:f,panelKey:f,header:m,headerClass:y,isActive:P,prefixCls:r,destroyInactivePanel:w??l,openMotion:u,accordion:i,children:e.props.children,onItemClick:S,expandIcon:d,collapsible:A};return typeof e.type=="string"?e:(Object.keys(v).forEach(function(b){typeof v[b]>"u"&&delete v[b]}),xe.cloneElement(e,v))};function oLt(t,e,n){return Array.isArray(t)?tLt(t,n):t7(e).map(function(o,r){return nLt(o,r,n)})}function rLt(t){var e=t;if(!Array.isArray(e)){var n=Vr(e);e=n==="number"||n==="string"?[e]:[]}return e.map(function(o){return String(o)})}var iLt=xe.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-collapse":n,r=t.destroyInactivePanel,i=r===void 0?!1:r,a=t.style,l=t.accordion,s=t.className,c=t.children,u=t.collapsible,d=t.openMotion,f=t.expandIcon,p=t.activeKey,m=t.defaultActiveKey,y=t.onChange,w=t.items,x=Bn(o,s),C=o0([],{value:p,onChange:function(R){return y==null?void 0:y(R)},defaultValue:m,postState:rLt}),P=Sn(C,2),A=P[0],S=P[1],v=function(R){return S(function(){if(l)return A[0]===R?[]:[R];var M=A.indexOf(R),D=M>-1;return D?A.filter(function(k){return k!==R}):[].concat($o(A),[R])})};Ds(!c,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var b=oLt(w,c,{prefixCls:o,accordion:l,openMotion:d,expandIcon:f,collapsible:u,destroyInactivePanel:i,onItemClick:v,activeKey:A});return xe.createElement("div",Uo({ref:e,className:x,style:a,role:l?"tablist":void 0},F1(t,{aria:!0,data:!0})),b)});const n9e=Object.assign(iLt,{Panel:iqe});n9e.Panel;const aLt=g.forwardRef((t,e)=>{const{getPrefixCls:n}=g.useContext(gr),{prefixCls:o,className:r,showArrow:i=!0}=t,a=n("collapse",o),l=Mn({[`${a}-no-arrow`]:!i},r);return g.createElement(n9e.Panel,Object.assign({ref:e},t,{prefixCls:a,className:l}))}),o9e=t=>({[t.componentCls]:{[`${t.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${t.motionDurationMid} ${t.motionEaseInOut}, + `]:{animationPlayState:"running"},[`${e}-move-up-leave`]:{animationName:A,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[`${e}-move-up-leave${e}-move-up-leave-active`]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[e]:{[`${C}-wrapper`]:Object.assign({},S)}},{[`${e}-notice-pure-panel`]:Object.assign(Object.assign({},S),{padding:0,textAlign:"start"})}]},_kt=t=>({zIndexPopup:t.zIndexPopupBase+V$e+10,contentBg:t.colorBgElevated,contentPadding:`${(t.controlHeightLG-t.fontSize*t.lineHeight)/2}px ${t.paddingSM}px`}),X$e=el("Message",t=>{const e=Ui(t,{height:150});return[Okt(e)]},_kt);var Vkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{prefixCls:e,type:n,icon:o,children:r}=t;return g.createElement("div",{className:Mn(`${e}-custom-content`,`${e}-${n}`)},o||Gkt[n],g.createElement("span",null,r))},Xkt=t=>{const{prefixCls:e,className:n,type:o,icon:r,content:i}=t,a=Vkt(t,["prefixCls","className","type","icon","content"]),{getPrefixCls:l}=g.useContext(gr),s=e||l("message"),c=nu(s),[u,d,f]=X$e(s,c);return u(g.createElement(O$e,Object.assign({},a,{prefixCls:s,className:Mn(n,d,`${s}-notice-pure-panel`,f,c),eventKey:"pure",duration:null,content:g.createElement(J$e,{prefixCls:s,type:o,icon:r},i)})))};function Jkt(t,e){return{motionName:e??`${t}-move-up`}}function Z5e(t){let e;const n=new Promise(r=>{e=t(()=>{r(!0)})}),o=()=>{e==null||e()};return o.then=(r,i)=>n.then(r,i),o.promise=n,o}var Kkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{children:e,prefixCls:n}=t;const o=nu(n),[r,i,a]=X$e(n,o);return r(g.createElement(Mkt,{classNames:{list:Mn(i,a,o)}},e))},Zkt=(t,e)=>{let{prefixCls:n,key:o}=e;return g.createElement(Qkt,{prefixCls:n,key:o},t)},eFt=g.forwardRef((t,e)=>{const{top:n,prefixCls:o,getContainer:r,maxCount:i,duration:a=qkt,rtl:l,transitionName:s,onAllRemoved:c}=t,{getPrefixCls:u,getPopupContainer:d,message:f,direction:p}=g.useContext(gr),m=o||u("message"),y=()=>({left:"50%",transform:"translateX(-50%)",top:n??$kt}),w=()=>Mn({[`${m}-rtl`]:l??p==="rtl"}),x=()=>Jkt(m,s),C=g.createElement("span",{className:`${m}-close-x`},g.createElement(i6,{className:`${m}-close-icon`})),[P,A]=Wkt({prefixCls:m,style:y,className:w,motion:x,closable:!1,closeIcon:C,duration:a,getContainer:()=>(r==null?void 0:r())||(d==null?void 0:d())||document.body,maxCount:i,onAllRemoved:c,renderNotifications:Zkt});return g.useImperativeHandle(e,()=>Object.assign(Object.assign({},P),{prefixCls:m,message:f})),A});let GSe=0;function K$e(t){const e=g.useRef(null);return LS(),[g.useMemo(()=>{const o=s=>{var c;(c=e.current)===null||c===void 0||c.close(s)},r=s=>{if(!e.current){const v=()=>{};return v.then=()=>{},v}const{open:c,prefixCls:u,message:d}=e.current,f=`${u}-notice`,{content:p,icon:m,type:y,key:w,className:x,style:C,onClose:P}=s,A=Kkt(s,["content","icon","type","key","className","style","onClose"]);let S=w;return S==null&&(GSe+=1,S=`antd-message-${GSe}`),Z5e(v=>(c(Object.assign(Object.assign({},A),{key:S,content:g.createElement(J$e,{prefixCls:u,type:y,icon:m},p),placement:"top",className:Mn(y&&`${f}-${y}`,x,d==null?void 0:d.className),style:Object.assign(Object.assign({},d==null?void 0:d.style),C),onClose:()=>{P==null||P(),v()}})),()=>{o(S)}))},a={open:r,destroy:s=>{var c;s!==void 0?o(s):(c=e.current)===null||c===void 0||c.destroy()}};return["info","success","warning","error","loading"].forEach(s=>{const c=(u,d,f)=>{let p;u&&typeof u=="object"&&"content"in u?p=u:p={content:u};let m,y;typeof d=="function"?y=d:(m=d,y=f);const w=Object.assign(Object.assign({onClose:y,duration:m},p),{type:s});return r(w)};a[s]=c}),a},[]),g.createElement(eFt,Object.assign({key:"message-holder"},t,{ref:e}))]}function tFt(t){return K$e(t)}function nFt(){const[t,e]=g.useState([]),n=g.useCallback(o=>(e(r=>[].concat(Pa(r),[o])),()=>{e(r=>r.filter(i=>i!==o))}),[]);return[t,n]}function TL(){TL=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(F,E,L){F[E]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(F,E,L){return Object.defineProperty(F,E,{value:L,enumerable:!0,configurable:!0,writable:!0}),F[E]}try{c({},"")}catch{c=function(L,j,Y){return L[j]=Y}}function u(F,E,L,j){var Y=E&&E.prototype instanceof x?E:x,O=Object.create(Y.prototype),_=new U(j||[]);return r(O,"_invoke",{value:M(F,L,_)}),O}function d(F,E,L){try{return{type:"normal",arg:F.call(E,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",y="completed",w={};function x(){}function C(){}function P(){}var A={};c(A,a,function(){return this});var S=Object.getPrototypeOf,v=S&&S(S(W([])));v&&v!==n&&o.call(v,a)&&(A=v);var b=P.prototype=x.prototype=Object.create(A);function T(F){["next","throw","return"].forEach(function(E){c(F,E,function(L){return this._invoke(E,L)})})}function R(F,E){function L(Y,O,_,G){var Q=d(F[Y],F,O);if(Q.type!=="throw"){var oe=Q.arg,ee=oe.value;return ee&&jp(ee)=="object"&&o.call(ee,"__await")?E.resolve(ee.__await).then(function($){L("next",$,_,G)},function($){L("throw",$,_,G)}):E.resolve(ee).then(function($){oe.value=$,_(oe)},function($){return L("throw",$,_,G)})}G(Q.arg)}var j;r(this,"_invoke",{value:function(O,_){function G(){return new E(function(Q,oe){L(O,_,Q,oe)})}return j=j?j.then(G,G):G()}})}function M(F,E,L){var j=f;return function(Y,O){if(j===m)throw new Error("Generator is already running");if(j===y){if(Y==="throw")throw O;return{value:t,done:!0}}for(L.method=Y,L.arg=O;;){var _=L.delegate;if(_){var G=D(_,L);if(G){if(G===w)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=y,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=m;var Q=d(F,E,L);if(Q.type==="normal"){if(j=L.done?y:p,Q.arg===w)continue;return{value:Q.arg,done:L.done}}Q.type==="throw"&&(j=y,L.method="throw",L.arg=Q.arg)}}}function D(F,E){var L=E.method,j=F.iterator[L];if(j===t)return E.delegate=null,L==="throw"&&F.iterator.return&&(E.method="return",E.arg=t,D(F,E),E.method==="throw")||L!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+L+"' method")),w;var Y=d(j,F.iterator,E.arg);if(Y.type==="throw")return E.method="throw",E.arg=Y.arg,E.delegate=null,w;var O=Y.arg;return O?O.done?(E[F.resultName]=O.value,E.next=F.nextLoc,E.method!=="return"&&(E.method="next",E.arg=t),E.delegate=null,w):O:(E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,w)}function k(F){var E={tryLoc:F[0]};1 in F&&(E.catchLoc=F[1]),2 in F&&(E.finallyLoc=F[2],E.afterLoc=F[3]),this.tryEntries.push(E)}function N(F){var E=F.completion||{};E.type="normal",delete E.arg,F.completion=E}function U(F){this.tryEntries=[{tryLoc:"root"}],F.forEach(k,this),this.reset(!0)}function W(F){if(F||F===""){var E=F[a];if(E)return E.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var L=-1,j=function Y(){for(;++L=0;--Y){var O=this.tryEntries[Y],_=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),Q=o.call(O,"finallyLoc");if(G&&Q){if(this.prev=0;--j){var Y=this.tryEntries[j];if(Y.tryLoc<=this.prev&&o.call(Y,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===E)return this.complete(j.completion,j.afterLoc),N(j),w}},catch:function(E){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===E){var Y=j.completion;if(Y.type==="throw"){var O=Y.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(E,L,j){return this.delegate={iterator:W(E),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),w}},e}function XSe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function $$e(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){XSe(i,o,r,a,l,"next",s)}function l(s){XSe(i,o,r,a,l,"throw",s)}a(void 0)})}}var aU=yH({},zyt),oFt=aU.version,Sle=aU.render,rFt=aU.unmountComponentAtNode,dZ;try{var iFt=Number((oFt||"").split(".")[0]);iFt>=18&&(dZ=aU.createRoot)}catch{}function JSe(t){var e=aU.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e&&jp(e)==="object"&&(e.usingClientEntryPoint=t)}var eJ="__rc_react_root__";function aFt(t,e){JSe(!0);var n=e[eJ]||dZ(e);JSe(!1),n.render(t),e[eJ]=n}function lFt(t,e){Sle==null||Sle(t,e)}function sFt(t,e){if(dZ){aFt(t,e);return}lFt(t,e)}function cFt(t){return Xfe.apply(this,arguments)}function Xfe(){return Xfe=$$e(TL().mark(function t(e){return TL().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",Promise.resolve().then(function(){var r;(r=e[eJ])===null||r===void 0||r.unmount(),delete e[eJ]}));case 1:case"end":return o.stop()}},t)})),Xfe.apply(this,arguments)}function uFt(t){rFt(t)}function dFt(t){return Jfe.apply(this,arguments)}function Jfe(){return Jfe=$$e(TL().mark(function t(e){return TL().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(dZ===void 0){o.next=2;break}return o.abrupt("return",cFt(e));case 2:uFt(e);case 3:case"end":return o.stop()}},t)})),Jfe.apply(this,arguments)}const fFt=(t,e)=>(sFt(t,e),()=>dFt(e));let hFt=fFt;function e9e(){return hFt}const Tle=()=>({height:0,opacity:0}),KSe=t=>{const{scrollHeight:e}=t;return{height:e,opacity:1}},pFt=t=>({height:t?t.offsetHeight:0}),Ple=(t,e)=>(e==null?void 0:e.deadline)===!0||e.propertyName==="height",t9e=function(){return{motionName:`${arguments.length>0&&arguments[0]!==void 0?arguments[0]:xL}-motion-collapse`,onAppearStart:Tle,onEnterStart:Tle,onAppearActive:KSe,onEnterActive:KSe,onLeaveStart:pFt,onLeaveActive:Tle,onAppearEnd:Ple,onEnterEnd:Ple,onLeaveEnd:Ple,motionDeadline:500}},L1=(t,e,n)=>n!==void 0?n:`${t}-${e}`;function Mf(t,e){var n=Object.assign({},t);return Array.isArray(e)&&e.forEach(function(o){delete n[o]}),n}const gFt=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1},mFt=t=>{const{componentCls:e,colorPrimary:n}=t;return{[e]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${t.motionEaseOutCirc}`,`opacity 2s ${t.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${t.motionDurationSlow} ${t.motionEaseInOut}`,`opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`].join(",")}}}}},yFt=sDt("Wave",t=>[mFt(t)]),fZ=`${xL}-wave-target`;function Cle(t){return t&&t!=="#fff"&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&t!=="rgba(255, 255, 255, 1)"&&!/rgba\((?:\d*, ){3}0\)/.test(t)&&t!=="transparent"}function AFt(t){const{borderTopColor:e,borderColor:n,backgroundColor:o}=getComputedStyle(t);return Cle(e)?e:Cle(n)?n:Cle(o)?o:null}function Rle(t){return Number.isNaN(t)?0:t}const wFt=t=>{const{className:e,target:n,component:o,registerUnmount:r}=t,i=g.useRef(null),a=g.useRef(null);g.useEffect(()=>{a.current=r()},[]);const[l,s]=g.useState(null),[c,u]=g.useState([]),[d,f]=g.useState(0),[p,m]=g.useState(0),[y,w]=g.useState(0),[x,C]=g.useState(0),[P,A]=g.useState(!1),S={left:d,top:p,width:y,height:x,borderRadius:c.map(T=>`${T}px`).join(" ")};l&&(S["--wave-color"]=l);function v(){const T=getComputedStyle(n);s(AFt(n));const R=T.position==="static",{borderLeftWidth:M,borderTopWidth:D}=T;f(R?n.offsetLeft:Rle(-parseFloat(M))),m(R?n.offsetTop:Rle(-parseFloat(D))),w(n.offsetWidth),C(n.offsetHeight);const{borderTopLeftRadius:k,borderTopRightRadius:N,borderBottomLeftRadius:U,borderBottomRightRadius:W}=T;u([k,N,W,U].map(F=>Rle(parseFloat(F))))}if(g.useEffect(()=>{if(n){const T=Hf(()=>{v(),A(!0)});let R;return typeof ResizeObserver<"u"&&(R=new ResizeObserver(v),R.observe(n)),()=>{Hf.cancel(T),R==null||R.disconnect()}}},[]),!P)return null;const b=(o==="Checkbox"||o==="Radio")&&(n==null?void 0:n.classList.contains(fZ));return g.createElement(cZ,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(T,R)=>{var M,D;if(R.deadline||R.propertyName==="opacity"){const k=(M=i.current)===null||M===void 0?void 0:M.parentElement;(D=a.current)===null||D===void 0||D.call(a).then(()=>{k==null||k.remove()})}return!1}},(T,R)=>{let{className:M}=T;return g.createElement("div",{ref:e2(i,R),className:Mn(e,M,{"wave-quick":b}),style:S})})},xFt=(t,e)=>{var n;const{component:o}=e;if(o==="Checkbox"&&!(!((n=t.querySelector("input"))===null||n===void 0)&&n.checked))return;const r=document.createElement("div");r.style.position="absolute",r.style.left="0px",r.style.top="0px",t==null||t.insertBefore(r,t==null?void 0:t.firstChild);const i=e9e();let a=null;function l(){return a}a=i(g.createElement(wFt,Object.assign({},e,{target:t,registerUnmount:l})),r)},vFt=(t,e,n)=>{const{wave:o}=g.useContext(gr),[,r,i]=Ff(),a=kd(c=>{const u=t.current;if(o!=null&&o.disabled||!u)return;const d=u.querySelector(`.${fZ}`)||u,{showEffect:f}=o||{};(f||xFt)(d,{className:e,token:r,component:n,event:c,hashId:i})}),l=g.useRef(null);return c=>{Hf.cancel(l.current),l.current=Hf(()=>{a(c)})}},lU=t=>{const{children:e,disabled:n,component:o}=t,{getPrefixCls:r}=g.useContext(gr),i=g.useRef(null),a=r("wave"),[,l]=yFt(a),s=vFt(i,Mn(a,l),o);if(xe.useEffect(()=>{const u=i.current;if(!u||u.nodeType!==1||n)return;const d=f=>{!gFt(f.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")||u.className.includes("-leave")||s(f)};return u.addEventListener("click",d,!0),()=>{u.removeEventListener("click",d,!0)}},[n]),!xe.isValidElement(e))return e??null;const c=YQ(e)?e2(OQ(e),i):i;return P0(e,{ref:c})},jd=t=>{const e=xe.useContext(AH);return xe.useMemo(()=>t?typeof t=="string"?t??e:t instanceof Function?t(e):e:e,[t,e])},bFt=t=>{const{componentCls:e}=t;return{[e]:{"&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},SFt=t=>{const{componentCls:e,antCls:n}=t;return{[e]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${e}-item:empty`]:{display:"none"},[`${e}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},TFt=t=>{const{componentCls:e}=t;return{[e]:{"&-gap-row-small":{rowGap:t.spaceGapSmallSize},"&-gap-row-middle":{rowGap:t.spaceGapMiddleSize},"&-gap-row-large":{rowGap:t.spaceGapLargeSize},"&-gap-col-small":{columnGap:t.spaceGapSmallSize},"&-gap-col-middle":{columnGap:t.spaceGapMiddleSize},"&-gap-col-large":{columnGap:t.spaceGapLargeSize}}}},q$e=el("Space",t=>{const e=Ui(t,{spaceGapSmallSize:t.paddingXS,spaceGapMiddleSize:t.padding,spaceGapLargeSize:t.paddingLG});return[SFt(e),TFt(e),bFt(e)]},()=>({}),{resetStyle:!1});var Q$e=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const n=g.useContext(hZ),o=g.useMemo(()=>{if(!n)return"";const{compactDirection:r,isFirstItem:i,isLastItem:a}=n,l=r==="vertical"?"-vertical-":"-";return Mn(`${t}-compact${l}item`,{[`${t}-compact${l}first-item`]:i,[`${t}-compact${l}last-item`]:a,[`${t}-compact${l}item-rtl`]:e==="rtl"})},[t,e,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:o}},PFt=t=>{const{children:e}=t;return g.createElement(hZ.Provider,{value:null},e)},CFt=t=>{const{children:e}=t,n=Q$e(t,["children"]);return g.createElement(hZ.Provider,{value:g.useMemo(()=>n,[n])},e)},RFt=t=>{const{getPrefixCls:e,direction:n}=g.useContext(gr),{size:o,direction:r,block:i,prefixCls:a,className:l,rootClassName:s,children:c}=t,u=Q$e(t,["size","direction","block","prefixCls","className","rootClassName","children"]),d=jd(P=>o??P),f=e("space-compact",a),[p,m]=q$e(f),y=Mn(f,m,{[`${f}-rtl`]:n==="rtl",[`${f}-block`]:i,[`${f}-vertical`]:r==="vertical"},l,s),w=g.useContext(hZ),x=jy(c),C=g.useMemo(()=>x.map((P,A)=>{const S=(P==null?void 0:P.key)||`${f}-item-${A}`;return g.createElement(CFt,{key:S,compactSize:d,compactDirection:r,isFirstItem:A===0&&(!w||(w==null?void 0:w.isFirstItem)),isLastItem:A===x.length-1&&(!w||(w==null?void 0:w.isLastItem))},P)}),[o,x,w]);return x.length===0?null:p(g.createElement("div",Object.assign({className:y},u),C))};var HFt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n}=g.useContext(gr),{prefixCls:o,size:r,className:i}=t,a=HFt(t,["prefixCls","size","className"]),l=e("btn-group",o),[,,s]=Ff(),c=g.useMemo(()=>{switch(r){case"large":return"lg";case"small":return"sm";default:return""}},[r]),u=Mn(l,{[`${l}-${c}`]:c,[`${l}-rtl`]:n==="rtl"},i,s);return g.createElement(Z$e.Provider,{value:r},g.createElement("div",Object.assign({},a,{className:u})))},$Se=/^[\u4E00-\u9FA5]{2}$/,Kfe=$Se.test.bind($Se);function eqe(t){return t==="danger"?{danger:!0}:{type:t}}function qSe(t){return typeof t=="string"}function Hle(t){return t==="text"||t==="link"}function IFt(t,e){if(t==null)return;const n=e?" ":"";return typeof t!="string"&&typeof t!="number"&&qSe(t.type)&&Kfe(t.props.children)?P0(t,{children:t.props.children.split("").join(n)}):qSe(t)?Kfe(t)?xe.createElement("span",null,t.split("").join(n)):xe.createElement("span",null,t):M$e(t)?xe.createElement("span",null,t):t}function zFt(t,e){let n=!1;const o=[];return xe.Children.forEach(t,r=>{const i=typeof r,a=i==="string"||i==="number";if(n&&a){const l=o.length-1,s=o[l];o[l]=`${s}${r}`}else o.push(r);n=a}),xe.Children.map(o,r=>IFt(r,e))}["default","primary","danger"].concat(Pa(Gb));const $fe=g.forwardRef((t,e)=>{const{className:n,style:o,children:r,prefixCls:i}=t,a=Mn(`${i}-icon`,n);return xe.createElement("span",{ref:e,className:a,style:o},r)}),QSe=g.forwardRef((t,e)=>{const{prefixCls:n,className:o,style:r,iconClassName:i}=t,a=Mn(`${n}-loading-icon`,o);return xe.createElement($fe,{prefixCls:n,className:a,style:r,ref:e},xe.createElement(qM,{className:i}))}),Mle=()=>({width:0,opacity:0,transform:"scale(0)"}),Ile=t=>({width:t.scrollWidth,opacity:1,transform:"scale(1)"}),DFt=t=>{const{prefixCls:e,loading:n,existIcon:o,className:r,style:i,mount:a}=t,l=!!n;return o?xe.createElement(QSe,{prefixCls:e,className:r,style:i}):xe.createElement(cZ,{visible:l,motionName:`${e}-loading-icon-motion`,motionAppear:!a,motionEnter:!a,motionLeave:!a,removeOnLeave:!0,onAppearStart:Mle,onAppearActive:Ile,onEnterStart:Mle,onEnterActive:Ile,onLeaveStart:Ile,onLeaveActive:Mle},(s,c)=>{let{className:u,style:d}=s;const f=Object.assign(Object.assign({},i),d);return xe.createElement(QSe,{prefixCls:e,className:Mn(r,u),style:f,ref:c})})},ZSe=(t,e)=>({[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineEndColor:e}}},"&:not(:first-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineStartColor:e}}}}}),EFt=t=>{const{componentCls:e,fontSize:n,lineWidth:o,groupBorderColor:r,colorErrorHover:i}=t;return{[`${e}-group`]:[{position:"relative",display:"inline-flex",[`> span, > ${e}`]:{"&:not(:last-child)":{[`&, & > ${e}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:t.calc(o).mul(-1).equal(),[`&, & > ${e}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[e]:{position:"relative",zIndex:1,"&:hover, &:focus, &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${e}-icon-only`]:{fontSize:n}},ZSe(`${e}-primary`,r),ZSe(`${e}-danger`,i)]}};function Jb(t){"@babel/helpers - typeof";return Jb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jb(t)}function kFt(t,e){if(Jb(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(Jb(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tqe(t){var e=kFt(t,"string");return Jb(e)=="symbol"?e:e+""}function FFt(t,e,n){return e=tqe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eTe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function tJ(t){for(var e=1;e=0)continue;n[o]=t[o]}return n}function oqe(t,e){if(t==null)return{};var n=OFt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var _Ft=["b"],VFt=["v"],zle=function(e){return Math.round(Number(e||0))},GFt=function(e){if(e instanceof Di)return e;if(e&&Jb(e)==="object"&&"h"in e&&"b"in e){var n=e,o=n.b,r=oqe(n,_Ft);return tJ(tJ({},r),{},{v:o})}return typeof e=="string"&&/hsb/.test(e)?e.replace(/hsb/,"hsv"):e},PL=function(t){UFt(n,t);var e=YFt(n);function n(o){return LFt(this,n),e.call(this,GFt(o))}return NFt(n,[{key:"toHsbString",value:function(){var r=this.toHsb(),i=zle(r.s*100),a=zle(r.b*100),l=zle(r.h),s=r.a,c="hsb(".concat(l,", ").concat(i,"%, ").concat(a,"%)"),u="hsba(".concat(l,", ").concat(i,"%, ").concat(a,"%, ").concat(s.toFixed(s===0?0:2),")");return s===1?c:u}},{key:"toHsb",value:function(){var r=this.toHsv(),i=r.v,a=oqe(r,VFt);return tJ(tJ({},a),{},{b:i,a:this.a})}}]),n}(Di),XFt=function(e){return e instanceof PL?e:new PL(e)};XFt("#1677ff");const JFt=(t,e)=>(t==null?void 0:t.replace(/[^\w/]/g,"").slice(0,e?8:6))||"",KFt=(t,e)=>t?JFt(t,e):"";let $Ft=function(){function t(e){$Et(this,t);var n;if(this.cleared=!1,e instanceof t){this.metaColor=e.metaColor.clone(),this.colors=(n=e.colors)===null||n===void 0?void 0:n.map(r=>({color:new t(r.color),percent:r.percent})),this.cleared=e.cleared;return}const o=Array.isArray(e);o&&e.length?(this.colors=e.map(r=>{let{color:i,percent:a}=r;return{color:new t(i),percent:a}}),this.metaColor=new PL(this.colors[0].color.metaColor)):this.metaColor=new PL(o?"":e),(!e||o&&!this.colors)&&(this.metaColor=this.metaColor.setA(0),this.cleared=!0)}return ekt(t,[{key:"toHsb",value:function(){return this.metaColor.toHsb()}},{key:"toHsbString",value:function(){return this.metaColor.toHsbString()}},{key:"toHex",value:function(){return KFt(this.toHexString(),this.metaColor.a<1)}},{key:"toHexString",value:function(){return this.metaColor.toHexString()}},{key:"toRgb",value:function(){return this.metaColor.toRgb()}},{key:"toRgbString",value:function(){return this.metaColor.toRgbString()}},{key:"isGradient",value:function(){return!!this.colors&&!this.cleared}},{key:"getColors",value:function(){return this.colors||[{color:this,percent:0}]}},{key:"toCssString",value:function(){const{colors:n}=this;return n?`linear-gradient(90deg, ${n.map(r=>`${r.color.toRgbString()} ${r.percent}%`).join(", ")})`:this.metaColor.toRgbString()}},{key:"equals",value:function(n){return!n||this.isGradient()!==n.isGradient()?!1:this.isGradient()?this.colors.length===n.colors.length&&this.colors.every((o,r)=>{const i=n.colors[r];return o.percent===i.percent&&o.color.equals(i.color)}):this.toHexString()===n.toHexString()}}])}();var qFt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},QFt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:qFt}))},xH=g.forwardRef(QFt);function t7(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return xe.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(t7(o)):_Ke.isFragment(o)&&o.props?n=n.concat(t7(o.props.children,e)):n.push(o))}),n}var rqe=xe.forwardRef(function(t,e){var n=t.prefixCls,o=t.forceRender,r=t.className,i=t.style,a=t.children,l=t.isActive,s=t.role,c=t.classNames,u=t.styles,d=xe.useState(l||o),f=Sn(d,2),p=f[0],m=f[1];return xe.useEffect(function(){(o||l)&&m(!0)},[o,l]),p?xe.createElement("div",{ref:e,className:Bn("".concat(n,"-content"),Ut(Ut({},"".concat(n,"-content-active"),l),"".concat(n,"-content-inactive"),!l),r),style:i,role:s},xe.createElement("div",{className:Bn("".concat(n,"-content-box"),c==null?void 0:c.body),style:u==null?void 0:u.body},a)):null});rqe.displayName="PanelContent";var ZFt=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],iqe=xe.forwardRef(function(t,e){var n=t.showArrow,o=n===void 0?!0:n,r=t.headerClass,i=t.isActive,a=t.onItemClick,l=t.forceRender,s=t.className,c=t.classNames,u=c===void 0?{}:c,d=t.styles,f=d===void 0?{}:d,p=t.prefixCls,m=t.collapsible,y=t.accordion,w=t.panelKey,x=t.extra,C=t.header,P=t.expandIcon,A=t.openMotion,S=t.destroyInactivePanel,v=t.children,b=Ai(t,ZFt),T=m==="disabled",R=x!=null&&typeof x!="boolean",M=Ut(Ut(Ut({onClick:function(){a==null||a(w)},onKeyDown:function(E){(E.key==="Enter"||E.keyCode===Lo.ENTER||E.which===Lo.ENTER)&&(a==null||a(w))},role:y?"tab":"button"},"aria-expanded",i),"aria-disabled",T),"tabIndex",T?-1:0),D=typeof P=="function"?P(t):xe.createElement("i",{className:"arrow"}),k=D&&xe.createElement("div",Uo({className:"".concat(p,"-expand-icon")},["header","icon"].includes(m)?M:{}),D),N=Bn("".concat(p,"-item"),Ut(Ut({},"".concat(p,"-item-active"),i),"".concat(p,"-item-disabled"),T),s),U=Bn(r,"".concat(p,"-header"),Ut({},"".concat(p,"-collapsible-").concat(m),!!m),u.header),W=nn({className:U,style:f.header},["header","icon"].includes(m)?{}:M);return xe.createElement("div",Uo({},b,{ref:e,className:N}),xe.createElement("div",W,o&&k,xe.createElement("span",Uo({className:"".concat(p,"-header-text")},m==="header"?M:{}),C),R&&xe.createElement("div",{className:"".concat(p,"-extra")},x)),xe.createElement(Oy,Uo({visible:i,leavedClassName:"".concat(p,"-content-hidden")},A,{forceRender:l,removeOnLeave:S}),function(F,E){var L=F.className,j=F.style;return xe.createElement(rqe,{ref:E,prefixCls:p,className:L,classNames:u,style:j,styles:f,isActive:i,forceRender:l,role:y?"tabpanel":void 0},v)}))}),eLt=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],tLt=function(e,n){var o=n.prefixCls,r=n.accordion,i=n.collapsible,a=n.destroyInactivePanel,l=n.onItemClick,s=n.activeKey,c=n.openMotion,u=n.expandIcon;return e.map(function(d,f){var p=d.children,m=d.label,y=d.key,w=d.collapsible,x=d.onItemClick,C=d.destroyInactivePanel,P=Ai(d,eLt),A=String(y??f),S=w??i,v=C??a,b=function(M){S!=="disabled"&&(l(M),x==null||x(M))},T=!1;return r?T=s[0]===A:T=s.indexOf(A)>-1,xe.createElement(iqe,Uo({},P,{prefixCls:o,key:A,panelKey:A,isActive:T,accordion:r,openMotion:c,expandIcon:u,header:m,collapsible:S,onItemClick:b,destroyInactivePanel:v}),p)})},nLt=function(e,n,o){if(!e)return null;var r=o.prefixCls,i=o.accordion,a=o.collapsible,l=o.destroyInactivePanel,s=o.onItemClick,c=o.activeKey,u=o.openMotion,d=o.expandIcon,f=e.key||String(n),p=e.props,m=p.header,y=p.headerClass,w=p.destroyInactivePanel,x=p.collapsible,C=p.onItemClick,P=!1;i?P=c[0]===f:P=c.indexOf(f)>-1;var A=x??a,S=function(T){A!=="disabled"&&(s(T),C==null||C(T))},v={key:f,panelKey:f,header:m,headerClass:y,isActive:P,prefixCls:r,destroyInactivePanel:w??l,openMotion:u,accordion:i,children:e.props.children,onItemClick:S,expandIcon:d,collapsible:A};return typeof e.type=="string"?e:(Object.keys(v).forEach(function(b){typeof v[b]>"u"&&delete v[b]}),xe.cloneElement(e,v))};function oLt(t,e,n){return Array.isArray(t)?tLt(t,n):t7(e).map(function(o,r){return nLt(o,r,n)})}function rLt(t){var e=t;if(!Array.isArray(e)){var n=Vr(e);e=n==="number"||n==="string"?[e]:[]}return e.map(function(o){return String(o)})}var iLt=xe.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-collapse":n,r=t.destroyInactivePanel,i=r===void 0?!1:r,a=t.style,l=t.accordion,s=t.className,c=t.children,u=t.collapsible,d=t.openMotion,f=t.expandIcon,p=t.activeKey,m=t.defaultActiveKey,y=t.onChange,w=t.items,x=Bn(o,s),C=o0([],{value:p,onChange:function(R){return y==null?void 0:y(R)},defaultValue:m,postState:rLt}),P=Sn(C,2),A=P[0],S=P[1],v=function(R){return S(function(){if(l)return A[0]===R?[]:[R];var M=A.indexOf(R),D=M>-1;return D?A.filter(function(k){return k!==R}):[].concat($o(A),[R])})};Ds(!c,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var b=oLt(w,c,{prefixCls:o,accordion:l,openMotion:d,expandIcon:f,collapsible:u,destroyInactivePanel:i,onItemClick:v,activeKey:A});return xe.createElement("div",Uo({ref:e,className:x,style:a,role:l?"tablist":void 0},F1(t,{aria:!0,data:!0})),b)});const n9e=Object.assign(iLt,{Panel:iqe});n9e.Panel;const aLt=g.forwardRef((t,e)=>{const{getPrefixCls:n}=g.useContext(gr),{prefixCls:o,className:r,showArrow:i=!0}=t,a=n("collapse",o),l=Mn({[`${a}-no-arrow`]:!i},r);return g.createElement(n9e.Panel,Object.assign({ref:e},t,{prefixCls:a,className:l}))}),o9e=t=>({[t.componentCls]:{[`${t.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${t.motionDurationMid} ${t.motionEaseInOut}, opacity ${t.motionDurationMid} ${t.motionEaseInOut} !important`}},[`${t.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${t.motionDurationMid} ${t.motionEaseInOut}, opacity ${t.motionDurationMid} ${t.motionEaseInOut} !important`}}}),lLt=t=>({animationDuration:t,animationFillMode:"both"}),sLt=t=>({animationDuration:t,animationFillMode:"both"}),pZ=function(t,e,n,o){const i=(arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1)?"&":"";return{[` ${i}${t}-enter, @@ -4508,12 +4508,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho & > ${e}-header`]:{borderRadius:`0 0 ${jt(s)} ${jt(s)}`}},[`> ${e}-header`]:Object.assign(Object.assign({position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:i,color:p,lineHeight:w,cursor:"pointer",transition:`all ${v}, visibility 0s`},Yy(t)),{[`> ${e}-header-text`]:{flex:"auto"},[`${e}-expand-icon`]:{height:R,display:"flex",alignItems:"center",paddingInlineEnd:C},[`${e}-arrow`]:Object.assign(Object.assign({},WS()),{fontSize:b,transition:`transform ${v}`,svg:{transition:`transform ${v}`}}),[`${e}-header-text`]:{marginInlineEnd:"auto"}}),[`${e}-collapsible-header`]:{cursor:"default",[`${e}-header-text`]:{flex:"none",cursor:"pointer"}},[`${e}-collapsible-icon`]:{cursor:"unset",[`${e}-expand-icon`]:{cursor:"pointer"}}},[`${e}-content`]:{color:f,backgroundColor:n,borderTop:D,[`& > ${e}-content-box`]:{padding:T},"&-hidden":{display:"none"}},"&-small":{[`> ${e}-item`]:{[`> ${e}-header`]:{padding:a,paddingInlineStart:S,[`> ${e}-expand-icon`]:{marginInlineStart:t.calc(P).sub(S).equal()}},[`> ${e}-content > ${e}-content-box`]:{padding:P}}},"&-large":{[`> ${e}-item`]:{fontSize:y,lineHeight:x,[`> ${e}-header`]:{padding:l,paddingInlineStart:o,[`> ${e}-expand-icon`]:{height:M,marginInlineStart:t.calc(A).sub(o).equal()}},[`> ${e}-content > ${e}-content-box`]:{padding:A}}},[`${e}-item:last-child`]:{borderBottom:0,[`> ${e}-content`]:{borderRadius:`0 0 ${jt(s)} ${jt(s)}`}},[`& ${e}-item-disabled > ${e}-header`]:{"\n &,\n & > .arrow\n ":{color:m,cursor:"not-allowed"}},[`&${e}-icon-position-end`]:{[`& > ${e}-item`]:{[`> ${e}-header`]:{[`${e}-expand-icon`]:{order:1,paddingInlineEnd:0,paddingInlineStart:C}}}}})}},WLt=t=>{const{componentCls:e}=t,n=`> ${e}-item > ${e}-header ${e}-arrow`;return{[`${e}-rtl`]:{[n]:{transform:"rotate(180deg)"}}}},NLt=t=>{const{componentCls:e,headerBg:n,paddingXXS:o,colorBorder:r}=t;return{[`${e}-borderless`]:{backgroundColor:n,border:0,[`> ${e}-item`]:{borderBottom:`1px solid ${r}`},[` > ${e}-item:last-child, > ${e}-item:last-child ${e}-header - `]:{borderRadius:0},[`> ${e}-item:last-child`]:{borderBottom:0},[`> ${e}-item > ${e}-content`]:{backgroundColor:"transparent",borderTop:0},[`> ${e}-item > ${e}-content > ${e}-content-box`]:{paddingTop:o}}}},ULt=t=>{const{componentCls:e,paddingSM:n}=t;return{[`${e}-ghost`]:{backgroundColor:"transparent",border:0,[`> ${e}-item`]:{borderBottom:0,[`> ${e}-content`]:{backgroundColor:"transparent",border:0,[`> ${e}-content-box`]:{paddingBlock:n}}}}}},jLt=t=>({headerPadding:`${t.paddingSM}px ${t.padding}px`,headerBg:t.colorFillAlter,contentPadding:`${t.padding}px 16px`,contentBg:t.colorBgContainer}),BLt=el("Collapse",t=>{const e=Ui(t,{collapseHeaderPaddingSM:`${jt(t.paddingXS)} ${jt(t.paddingSM)}`,collapseHeaderPaddingLG:`${jt(t.padding)} ${jt(t.paddingLG)}`,collapsePanelBorderRadius:t.borderRadiusLG});return[LLt(e),NLt(e),ULt(e),WLt(e),o9e(e)]},jLt),YLt=g.forwardRef((t,e)=>{const{getPrefixCls:n,direction:o,collapse:r}=g.useContext(gr),{prefixCls:i,className:a,rootClassName:l,style:s,bordered:c=!0,ghost:u,size:d,expandIconPosition:f="start",children:p,expandIcon:m}=t,y=jd(D=>{var k;return(k=d??D)!==null&&k!==void 0?k:"middle"}),w=n("collapse",i),x=n(),[C,P,A]=BLt(w),S=g.useMemo(()=>f==="left"?"start":f==="right"?"end":f,[f]),v=m??(r==null?void 0:r.expandIcon),b=g.useCallback(function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const k=typeof v=="function"?v(D):g.createElement(xH,{rotate:D.isActive?o==="rtl"?-90:90:void 0,"aria-label":D.isActive?"expanded":"collapsed"});return P0(k,()=>{var N;return{className:Mn((N=k==null?void 0:k.props)===null||N===void 0?void 0:N.className,`${w}-arrow`)}})},[v,w]),T=Mn(`${w}-icon-position-${S}`,{[`${w}-borderless`]:!c,[`${w}-rtl`]:o==="rtl",[`${w}-ghost`]:!!u,[`${w}-${y}`]:y!=="middle"},r==null?void 0:r.className,a,l,P,A),R=Object.assign(Object.assign({},t9e(x)),{motionAppear:!1,leavedClassName:`${w}-content-hidden`}),M=g.useMemo(()=>p?jy(p).map((D,k)=>{var N,U;const W=D.props;if(W!=null&&W.disabled){const F=(N=D.key)!==null&&N!==void 0?N:String(k),E=Object.assign(Object.assign({},Mf(D.props,["disabled"])),{key:F,collapsible:(U=W.collapsible)!==null&&U!==void 0?U:"disabled"});return P0(D,E)}return D}):null,[p]);return C(g.createElement(n9e,Object.assign({ref:e,openMotion:R},Mf(t,["rootClassName"]),{expandIcon:b,prefixCls:w,className:T,style:Object.assign(Object.assign({},r==null?void 0:r.style),s)}),M))}),r9e=Object.assign(YLt,{Panel:aLt}),OLt=(t,e)=>{const{r:n,g:o,b:r,a:i}=t.toRgb(),a=new PL(t.toRgbString()).onBackground(e).toHsv();return i<=.5?a.v>.5:n*.299+o*.587+r*.114>192},lqe=t=>{const{paddingInline:e,onlyIconSize:n}=t;return Ui(t,{buttonPaddingHorizontal:e,buttonPaddingVertical:0,buttonIconOnlyFontSize:n})},sqe=t=>{var e,n,o,r,i,a;const l=(e=t.contentFontSize)!==null&&e!==void 0?e:t.fontSize,s=(n=t.contentFontSizeSM)!==null&&n!==void 0?n:t.fontSize,c=(o=t.contentFontSizeLG)!==null&&o!==void 0?o:t.fontSizeLG,u=(r=t.contentLineHeight)!==null&&r!==void 0?r:dG(l),d=(i=t.contentLineHeightSM)!==null&&i!==void 0?i:dG(s),f=(a=t.contentLineHeightLG)!==null&&a!==void 0?a:dG(c),p=OLt(new $Ft(t.colorBgSolid),"#fff")?"#000":"#fff";return{fontWeight:400,defaultShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlTmpOutline}`,primaryShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlOutline}`,dangerShadow:`0 ${t.controlOutlineWidth}px 0 ${t.colorErrorOutline}`,primaryColor:t.colorTextLightSolid,dangerColor:t.colorTextLightSolid,borderColorDisabled:t.colorBorder,defaultGhostColor:t.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:t.colorBgContainer,paddingInline:t.paddingContentHorizontal-t.lineWidth,paddingInlineLG:t.paddingContentHorizontal-t.lineWidth,paddingInlineSM:8-t.lineWidth,onlyIconSize:"inherit",onlyIconSizeSM:"inherit",onlyIconSizeLG:"inherit",groupBorderColor:t.colorPrimaryHover,linkHoverBg:"transparent",textTextColor:t.colorText,textTextHoverColor:t.colorText,textTextActiveColor:t.colorText,textHoverBg:t.colorFillTertiary,defaultColor:t.colorText,defaultBg:t.colorBgContainer,defaultBorderColor:t.colorBorder,defaultBorderColorDisabled:t.colorBorder,defaultHoverBg:t.colorBgContainer,defaultHoverColor:t.colorPrimaryHover,defaultHoverBorderColor:t.colorPrimaryHover,defaultActiveBg:t.colorBgContainer,defaultActiveColor:t.colorPrimaryActive,defaultActiveBorderColor:t.colorPrimaryActive,solidTextColor:p,contentFontSize:l,contentFontSizeSM:s,contentFontSizeLG:c,contentLineHeight:u,contentLineHeightSM:d,contentLineHeightLG:f,paddingBlock:Math.max((t.controlHeight-l*u)/2-t.lineWidth,0),paddingBlockSM:Math.max((t.controlHeightSM-s*d)/2-t.lineWidth,0),paddingBlockLG:Math.max((t.controlHeightLG-c*f)/2-t.lineWidth,0)}},_Lt=t=>{const{componentCls:e,iconCls:n,fontWeight:o,opacityLoading:r,motionDurationSlow:i,motionEaseInOut:a,marginXS:l,calc:s}=t;return{[e]:{outline:"none",position:"relative",display:"inline-flex",gap:t.marginXS,alignItems:"center",justifyContent:"center",fontWeight:o,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,cursor:"pointer",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,userSelect:"none",touchAction:"manipulation",color:t.colorText,"&:disabled > *":{pointerEvents:"none"},[`${e}-icon > svg`]:WS(),"> a":{color:"currentColor"},"&:not(:disabled)":Yy(t),[`&${e}-two-chinese-chars::first-letter`]:{letterSpacing:"0.34em"},[`&${e}-two-chinese-chars > *:not(${n})`]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},[`&${e}-icon-only`]:{paddingInline:0,[`&${e}-compact-item`]:{flex:"none"},[`&${e}-round`]:{width:"auto"}},[`&${e}-loading`]:{opacity:r,cursor:"default"},[`${e}-loading-icon`]:{transition:["width","opacity","margin"].map(c=>`${c} ${i} ${a}`).join(",")},[`&:not(${e}-icon-end)`]:{[`${e}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineEnd:s(l).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineEnd:0},"&-leave-start":{marginInlineEnd:0},"&-leave-active":{marginInlineEnd:s(l).mul(-1).equal()}}},"&-icon-end":{flexDirection:"row-reverse",[`${e}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineStart:s(l).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineStart:0},"&-leave-start":{marginInlineStart:0},"&-leave-active":{marginInlineStart:s(l).mul(-1).equal()}}}}}},cqe=(t,e,n)=>({[`&:not(:disabled):not(${t}-disabled)`]:{"&:hover":e,"&:active":n}}),VLt=t=>({minWidth:t.controlHeight,paddingInlineStart:0,paddingInlineEnd:0,borderRadius:"50%"}),GLt=t=>({borderRadius:t.controlHeight,paddingInlineStart:t.calc(t.controlHeight).div(2).equal(),paddingInlineEnd:t.calc(t.controlHeight).div(2).equal()}),XLt=t=>({cursor:"not-allowed",borderColor:t.borderColorDisabled,color:t.colorTextDisabled,background:t.colorBgContainerDisabled,boxShadow:"none"}),i9e=(t,e,n,o,r,i,a,l)=>({[`&${t}-background-ghost`]:Object.assign(Object.assign({color:n||void 0,background:e,borderColor:o||void 0,boxShadow:"none"},cqe(t,Object.assign({background:e},a),Object.assign({background:e},l))),{"&:disabled":{cursor:"not-allowed",color:r||void 0,borderColor:i||void 0}})}),JLt=t=>({[`&:disabled, &${t.componentCls}-disabled`]:Object.assign({},XLt(t))}),KLt=t=>({[`&:disabled, &${t.componentCls}-disabled`]:{cursor:"not-allowed",color:t.colorTextDisabled}}),wZ=(t,e,n,o)=>{const i=o&&["link","text"].includes(o)?KLt:JLt;return Object.assign(Object.assign({},i(t)),cqe(t.componentCls,e,n))},xZ=(t,e,n,o,r)=>({[`&${t.componentCls}-variant-solid`]:Object.assign({color:e,background:n},wZ(t,o,r))}),vZ=(t,e,n,o,r)=>({[`&${t.componentCls}-variant-outlined, &${t.componentCls}-variant-dashed`]:Object.assign({borderColor:e,background:n},wZ(t,o,r))}),bZ=t=>({[`&${t.componentCls}-variant-dashed`]:{borderStyle:"dashed"}}),SZ=(t,e,n,o)=>({[`&${t.componentCls}-variant-filled`]:Object.assign({boxShadow:"none",background:e},wZ(t,n,o))}),n7=(t,e,n,o,r)=>({[`&${t.componentCls}-variant-${n}`]:Object.assign({color:e,boxShadow:"none"},wZ(t,o,r,n))}),$Lt=t=>{const{componentCls:e}=t;return Gb.reduce((n,o)=>{const r=t[`${o}6`],i=t[`${o}1`],a=t[`${o}5`],l=t[`${o}2`],s=t[`${o}3`],c=t[`${o}7`],u=`0 ${jt(t.controlOutlineWidth)} 0 ${t[`${o}1`]}`;return Object.assign(Object.assign({},n),{[`&${e}-color-${o}`]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:r,boxShadow:u},xZ(t,t.colorTextLightSolid,r,{background:a},{background:c})),vZ(t,r,t.colorBgContainer,{color:a,borderColor:a,background:t.colorBgContainer},{color:c,borderColor:c,background:t.colorBgContainer})),bZ(t)),SZ(t,i,{background:l},{background:s})),n7(t,r,"link",{color:a},{color:c})),n7(t,r,"text",{color:a,background:i},{color:c,background:s}))})},{})},qLt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.defaultColor,boxShadow:t.defaultShadow},xZ(t,t.solidTextColor,t.colorBgSolid,{color:t.solidTextColor,background:t.colorBgSolidHover},{color:t.solidTextColor,background:t.colorBgSolidActive})),bZ(t)),SZ(t,t.colorFillTertiary,{background:t.colorFillSecondary},{background:t.colorFill})),n7(t,t.textTextColor,"link",{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),i9e(t.componentCls,t.ghostBg,t.defaultGhostColor,t.defaultGhostBorderColor,t.colorTextDisabled,t.colorBorder)),QLt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.colorPrimary,boxShadow:t.primaryShadow},vZ(t,t.colorPrimary,t.colorBgContainer,{color:t.colorPrimaryTextHover,borderColor:t.colorPrimaryHover,background:t.colorBgContainer},{color:t.colorPrimaryTextActive,borderColor:t.colorPrimaryActive,background:t.colorBgContainer})),bZ(t)),SZ(t,t.colorPrimaryBg,{background:t.colorPrimaryBgHover},{background:t.colorPrimaryBorder})),n7(t,t.colorLink,"text",{color:t.colorPrimaryTextHover,background:t.colorPrimaryBg},{color:t.colorPrimaryTextActive,background:t.colorPrimaryBorder})),i9e(t.componentCls,t.ghostBg,t.colorPrimary,t.colorPrimary,t.colorTextDisabled,t.colorBorder,{color:t.colorPrimaryHover,borderColor:t.colorPrimaryHover},{color:t.colorPrimaryActive,borderColor:t.colorPrimaryActive})),ZLt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.colorError,boxShadow:t.dangerShadow},xZ(t,t.dangerColor,t.colorError,{background:t.colorErrorHover},{background:t.colorErrorActive})),vZ(t,t.colorError,t.colorBgContainer,{color:t.colorErrorHover,borderColor:t.colorErrorBorderHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),bZ(t)),SZ(t,t.colorErrorBg,{background:t.colorErrorBgFilledHover},{background:t.colorErrorBgActive})),n7(t,t.colorError,"text",{color:t.colorErrorHover,background:t.colorErrorBg},{color:t.colorErrorHover,background:t.colorErrorBgActive})),n7(t,t.colorError,"link",{color:t.colorErrorHover},{color:t.colorErrorActive})),i9e(t.componentCls,t.ghostBg,t.colorError,t.colorError,t.colorTextDisabled,t.colorBorder,{color:t.colorErrorHover,borderColor:t.colorErrorHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),eWt=t=>{const{componentCls:e}=t;return Object.assign({[`${e}-color-default`]:qLt(t),[`${e}-color-primary`]:QLt(t),[`${e}-color-dangerous`]:ZLt(t)},$Lt(t))},tWt=t=>Object.assign(Object.assign(Object.assign(Object.assign({},vZ(t,t.defaultBorderColor,t.defaultBg,{color:t.defaultHoverColor,borderColor:t.defaultHoverBorderColor,background:t.defaultHoverBg},{color:t.defaultActiveColor,borderColor:t.defaultActiveBorderColor,background:t.defaultActiveBg})),n7(t,t.textTextColor,"text",{color:t.textTextHoverColor,background:t.textHoverBg},{color:t.textTextActiveColor,background:t.colorBgTextActive})),xZ(t,t.primaryColor,t.colorPrimary,{background:t.colorPrimaryHover,color:t.primaryColor},{background:t.colorPrimaryActive,color:t.primaryColor})),n7(t,t.colorLink,"link",{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),a9e=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const{componentCls:n,controlHeight:o,fontSize:r,borderRadius:i,buttonPaddingHorizontal:a,iconCls:l,buttonPaddingVertical:s,buttonIconOnlyFontSize:c}=t;return[{[e]:{fontSize:r,height:o,padding:`${jt(s)} ${jt(a)}`,borderRadius:i,[`&${n}-icon-only`]:{width:o,[l]:{fontSize:c}}}},{[`${n}${n}-circle${e}`]:VLt(t)},{[`${n}${n}-round${e}`]:GLt(t)}]},nWt=t=>{const e=Ui(t,{fontSize:t.contentFontSize});return a9e(e,t.componentCls)},oWt=t=>{const e=Ui(t,{controlHeight:t.controlHeightSM,fontSize:t.contentFontSizeSM,padding:t.paddingXS,buttonPaddingHorizontal:t.paddingInlineSM,buttonPaddingVertical:0,borderRadius:t.borderRadiusSM,buttonIconOnlyFontSize:t.onlyIconSizeSM});return a9e(e,`${t.componentCls}-sm`)},rWt=t=>{const e=Ui(t,{controlHeight:t.controlHeightLG,fontSize:t.contentFontSizeLG,buttonPaddingHorizontal:t.paddingInlineLG,buttonPaddingVertical:0,borderRadius:t.borderRadiusLG,buttonIconOnlyFontSize:t.onlyIconSizeLG});return a9e(e,`${t.componentCls}-lg`)},iWt=t=>{const{componentCls:e}=t;return{[e]:{[`&${e}-block`]:{width:"100%"}}}},aWt=el("Button",t=>{const e=lqe(t);return[_Lt(e),nWt(e),oWt(e),rWt(e),iWt(e),eWt(e),tWt(e),EFt(e)]},sqe,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}});function lWt(t,e,n){const{focusElCls:o,focus:r,borderElCls:i}=n,a=i?"> *":"",l=["hover",r?"focus":null,"active"].filter(Boolean).map(s=>`&:${s} ${a}`).join(",");return{[`&-item:not(${e}-last-item)`]:{marginInlineEnd:t.calc(t.lineWidth).mul(-1).equal()},"&-item":Object.assign(Object.assign({[l]:{zIndex:2}},o?{[`&${o}`]:{zIndex:2}}:{}),{[`&[disabled] ${a}`]:{zIndex:0}})}}function sWt(t,e,n){const{borderElCls:o}=n,r=o?`> ${o}`:"";return{[`&-item:not(${e}-first-item):not(${e}-last-item) ${r}`]:{borderRadius:0},[`&-item:not(${e}-last-item)${e}-first-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${e}-first-item)${e}-last-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function sU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{focus:!0};const{componentCls:n}=t,o=`${n}-compact`;return{[o]:Object.assign(Object.assign({},lWt(t,o,e)),sWt(n,o,e))}}function cWt(t,e){return{[`&-item:not(${e}-last-item)`]:{marginBottom:t.calc(t.lineWidth).mul(-1).equal()},"&-item":{"&:hover,&:focus,&:active":{zIndex:2},"&[disabled]":{zIndex:0}}}}function uWt(t,e){return{[`&-item:not(${e}-first-item):not(${e}-last-item)`]:{borderRadius:0},[`&-item${e}-first-item:not(${e}-last-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${e}-last-item:not(${e}-first-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function dWt(t){const e=`${t.componentCls}-compact-vertical`;return{[e]:Object.assign(Object.assign({},cWt(t,e)),uWt(t.componentCls,e))}}const fWt=t=>{const{componentCls:e,colorPrimaryHover:n,lineWidth:o,calc:r}=t,i=r(o).mul(-1).equal(),a=l=>{const s=`${e}-compact${l?"-vertical":""}-item${e}-primary:not([disabled])`;return{[`${s} + ${s}::before`]:{position:"absolute",top:l?i:0,insetInlineStart:l?0:i,backgroundColor:n,content:'""',width:l?"100%":o,height:l?o:"100%"}}};return Object.assign(Object.assign({},a()),a(!0))},hWt=rU(["Button","compact"],t=>{const e=lqe(t);return[sU(e),dWt(e),fWt(e)]},sqe);var pWt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i;const{loading:a=!1,prefixCls:l,color:s,variant:c,type:u,danger:d=!1,shape:f="default",size:p,styles:m,disabled:y,className:w,rootClassName:x,children:C,icon:P,iconPosition:A="start",ghost:S=!1,block:v=!1,htmlType:b="button",classNames:T,style:R={},autoInsertSpace:M,autoFocus:D}=t,k=pWt(t,["loading","prefixCls","color","variant","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","iconPosition","ghost","block","htmlType","classNames","style","autoInsertSpace","autoFocus"]),N=u||"default",[U,W]=g.useMemo(()=>{if(s&&c)return[s,c];const _e=mWt[N]||[];return d?["danger",_e[1]]:_e},[u,s,c,d]),E=U==="danger"?"dangerous":U,{getPrefixCls:L,direction:j,button:Y}=g.useContext(gr),O=(n=M??(Y==null?void 0:Y.autoInsertSpace))!==null&&n!==void 0?n:!0,_=L("btn",l),[G,Q,oe]=aWt(_),ee=g.useContext(Bp),q=y??ee,ae=g.useContext(Z$e),Z=g.useMemo(()=>gWt(a),[a]),[ne,te]=g.useState(Z.loading),[$,le]=g.useState(!1),de=g.useRef(null),he=I5e(e,de),me=g.Children.count(C)===1&&!P&&!Hle(W),ce=g.useRef(!0);xe.useEffect(()=>(ce.current=!1,()=>{ce.current=!0}),[]),g.useEffect(()=>{let _e=null;Z.delay>0?_e=setTimeout(()=>{_e=null,te(!0)},Z.delay):te(Z.loading);function Ue(){_e&&(clearTimeout(_e),_e=null)}return Ue},[Z]),g.useEffect(()=>{if(!de.current||!O)return;const _e=de.current.textContent||"";me&&Kfe(_e)?$||le(!0):$&&le(!1)}),g.useEffect(()=>{D&&de.current&&de.current.focus()},[]);const Pe=xe.useCallback(_e=>{var Ue;if(ne||q){_e.preventDefault();return}(Ue=t.onClick)===null||Ue===void 0||Ue.call(t,_e)},[t.onClick,ne,q]),{compactSize:pe,compactItemClassnames:Ie}=x4(_,j),ve={large:"lg",small:"sm",middle:void 0},ze=jd(_e=>{var Ue,qe;return(qe=(Ue=p??pe)!==null&&Ue!==void 0?Ue:ae)!==null&&qe!==void 0?qe:_e}),Ae=ze&&(o=ve[ze])!==null&&o!==void 0?o:"",se=ne?"loading":P,ge=Mf(k,["navigate"]),we=Mn(_,Q,oe,{[`${_}-${f}`]:f!=="default"&&f,[`${_}-${N}`]:N,[`${_}-dangerous`]:d,[`${_}-color-${E}`]:E,[`${_}-variant-${W}`]:W,[`${_}-${Ae}`]:Ae,[`${_}-icon-only`]:!C&&C!==0&&!!se,[`${_}-background-ghost`]:S&&!Hle(W),[`${_}-loading`]:ne,[`${_}-two-chinese-chars`]:$&&O&&!ne,[`${_}-block`]:v,[`${_}-rtl`]:j==="rtl",[`${_}-icon-end`]:A==="end"},Ie,w,x,Y==null?void 0:Y.className),Se=Object.assign(Object.assign({},Y==null?void 0:Y.style),R),Me=Mn(T==null?void 0:T.icon,(r=Y==null?void 0:Y.classNames)===null||r===void 0?void 0:r.icon),Ce=Object.assign(Object.assign({},(m==null?void 0:m.icon)||{}),((i=Y==null?void 0:Y.styles)===null||i===void 0?void 0:i.icon)||{}),Te=P&&!ne?xe.createElement($fe,{prefixCls:_,className:Me,style:Ce},P):a&&typeof a=="object"&&a.icon?xe.createElement($fe,{prefixCls:_,className:Me,style:Ce},a.icon):xe.createElement(DFt,{existIcon:!!P,prefixCls:_,loading:ne,mount:ce.current}),Re=C||C===0?zFt(C,me&&O):null;if(ge.href!==void 0)return G(xe.createElement("a",Object.assign({},ge,{className:Mn(we,{[`${_}-disabled`]:q}),href:q?void 0:ge.href,style:Se,onClick:Pe,ref:he,tabIndex:q?-1:0}),Te,Re));let Ne=xe.createElement("button",Object.assign({},k,{type:b,className:we,style:Se,onClick:Pe,disabled:q,ref:he}),Te,Re,Ie&&xe.createElement(hWt,{prefixCls:_}));return Hle(W)||(Ne=xe.createElement(lU,{component:"Button",disabled:ne},Ne)),G(Ne)}),oo=yWt;oo.Group=MFt;oo.__ANT_BUTTON=!0;function Dle(t){return!!(t!=null&&t.then)}const uqe=t=>{const{type:e,children:n,prefixCls:o,buttonProps:r,close:i,autoFocus:a,emitEvent:l,isSilent:s,quitOnNullishReturnValue:c,actionFn:u}=t,d=g.useRef(!1),f=g.useRef(null),[p,m]=wH(!1),y=function(){i==null||i.apply(void 0,arguments)};g.useEffect(()=>{let C=null;return a&&(C=setTimeout(()=>{var P;(P=f.current)===null||P===void 0||P.focus({preventScroll:!0})})),()=>{C&&clearTimeout(C)}},[]);const w=C=>{Dle(C)&&(m(!0),C.then(function(){m(!1,!0),y.apply(void 0,arguments),d.current=!1},P=>{if(m(!1,!0),d.current=!1,!(s!=null&&s()))return Promise.reject(P)}))},x=C=>{if(d.current)return;if(d.current=!0,!u){y();return}let P;if(l){if(P=u(C),c&&!Dle(P)){d.current=!1,y(C);return}}else if(u.length)P=u(i),d.current=!1;else if(P=u(),!Dle(P)){y();return}w(P)};return g.createElement(oo,Object.assign({},eqe(e),{onClick:x,loading:p,prefixCls:o},r,{ref:f}),n)},cU=xe.createContext({}),{Provider:dqe}=cU,oTe=()=>{const{autoFocusButton:t,cancelButtonProps:e,cancelTextLocale:n,isSilent:o,mergedOkCancel:r,rootPrefixCls:i,close:a,onCancel:l,onConfirm:s}=g.useContext(cU);return r?xe.createElement(uqe,{isSilent:o,actionFn:l,close:function(){a==null||a.apply(void 0,arguments),s==null||s(!1)},autoFocus:t==="cancel",buttonProps:e,prefixCls:`${i}-btn`},n):null},rTe=()=>{const{autoFocusButton:t,close:e,isSilent:n,okButtonProps:o,rootPrefixCls:r,okTextLocale:i,okType:a,onConfirm:l,onOk:s}=g.useContext(cU);return xe.createElement(uqe,{isSilent:n,type:a||"primary",actionFn:s,close:function(){e==null||e.apply(void 0,arguments),l==null||l(!0)},autoFocus:t==="ok",buttonProps:o,prefixCls:`${r}-btn`},i)};var fqe=g.createContext(null),iTe=[];function AWt(t,e){var n=g.useState(function(){if(!mm())return null;var m=document.createElement("div");return m}),o=Sn(n,1),r=o[0],i=g.useRef(!1),a=g.useContext(fqe),l=g.useState(iTe),s=Sn(l,2),c=s[0],u=s[1],d=a||(i.current?void 0:function(m){u(function(y){var w=[m].concat($o(y));return w})});function f(){r.parentElement||document.body.appendChild(r),i.current=!0}function p(){var m;(m=r.parentElement)===null||m===void 0||m.removeChild(r),i.current=!1}return Ml(function(){return t?a?a(f):f():p(),p},[t]),Ml(function(){c.length&&(c.forEach(function(m){return m()}),u(iTe))},[c]),[r,d]}var Ele;function wWt(t){if(typeof document>"u")return 0;if(Ele===void 0){var e=document.createElement("div");e.style.width="100%",e.style.height="200px";var n=document.createElement("div"),o=n.style;o.position="absolute",o.top="0",o.left="0",o.pointerEvents="none",o.visibility="hidden",o.width="200px",o.height="150px",o.overflow="hidden",n.appendChild(e),document.body.appendChild(n);var r=e.offsetWidth;n.style.overflow="scroll";var i=e.offsetWidth;r===i&&(i=n.clientWidth),document.body.removeChild(n),Ele=r-i}return Ele}function aTe(t){var e=t.match(/^(.*)px$/),n=Number(e==null?void 0:e[1]);return Number.isNaN(n)?wWt():n}function xWt(t){if(typeof document>"u"||!t||!(t instanceof Element))return{width:0,height:0};var e=getComputedStyle(t,"::-webkit-scrollbar"),n=e.width,o=e.height;return{width:aTe(n),height:aTe(o)}}function vWt(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var bWt="rc-util-locker-".concat(Date.now()),lTe=0;function SWt(t){var e=!!t,n=g.useState(function(){return lTe+=1,"".concat(bWt,"_").concat(lTe)}),o=Sn(n,1),r=o[0];Ml(function(){if(e){var i=xWt(document.body).width,a=vWt();pb(` + `]:{borderRadius:0},[`> ${e}-item:last-child`]:{borderBottom:0},[`> ${e}-item > ${e}-content`]:{backgroundColor:"transparent",borderTop:0},[`> ${e}-item > ${e}-content > ${e}-content-box`]:{paddingTop:o}}}},ULt=t=>{const{componentCls:e,paddingSM:n}=t;return{[`${e}-ghost`]:{backgroundColor:"transparent",border:0,[`> ${e}-item`]:{borderBottom:0,[`> ${e}-content`]:{backgroundColor:"transparent",border:0,[`> ${e}-content-box`]:{paddingBlock:n}}}}}},jLt=t=>({headerPadding:`${t.paddingSM}px ${t.padding}px`,headerBg:t.colorFillAlter,contentPadding:`${t.padding}px 16px`,contentBg:t.colorBgContainer}),BLt=el("Collapse",t=>{const e=Ui(t,{collapseHeaderPaddingSM:`${jt(t.paddingXS)} ${jt(t.paddingSM)}`,collapseHeaderPaddingLG:`${jt(t.padding)} ${jt(t.paddingLG)}`,collapsePanelBorderRadius:t.borderRadiusLG});return[LLt(e),NLt(e),ULt(e),WLt(e),o9e(e)]},jLt),YLt=g.forwardRef((t,e)=>{const{getPrefixCls:n,direction:o,collapse:r}=g.useContext(gr),{prefixCls:i,className:a,rootClassName:l,style:s,bordered:c=!0,ghost:u,size:d,expandIconPosition:f="start",children:p,expandIcon:m}=t,y=jd(D=>{var k;return(k=d??D)!==null&&k!==void 0?k:"middle"}),w=n("collapse",i),x=n(),[C,P,A]=BLt(w),S=g.useMemo(()=>f==="left"?"start":f==="right"?"end":f,[f]),v=m??(r==null?void 0:r.expandIcon),b=g.useCallback(function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const k=typeof v=="function"?v(D):g.createElement(xH,{rotate:D.isActive?o==="rtl"?-90:90:void 0,"aria-label":D.isActive?"expanded":"collapsed"});return P0(k,()=>{var N;return{className:Mn((N=k==null?void 0:k.props)===null||N===void 0?void 0:N.className,`${w}-arrow`)}})},[v,w]),T=Mn(`${w}-icon-position-${S}`,{[`${w}-borderless`]:!c,[`${w}-rtl`]:o==="rtl",[`${w}-ghost`]:!!u,[`${w}-${y}`]:y!=="middle"},r==null?void 0:r.className,a,l,P,A),R=Object.assign(Object.assign({},t9e(x)),{motionAppear:!1,leavedClassName:`${w}-content-hidden`}),M=g.useMemo(()=>p?jy(p).map((D,k)=>{var N,U;const W=D.props;if(W!=null&&W.disabled){const F=(N=D.key)!==null&&N!==void 0?N:String(k),E=Object.assign(Object.assign({},Mf(D.props,["disabled"])),{key:F,collapsible:(U=W.collapsible)!==null&&U!==void 0?U:"disabled"});return P0(D,E)}return D}):null,[p]);return C(g.createElement(n9e,Object.assign({ref:e,openMotion:R},Mf(t,["rootClassName"]),{expandIcon:b,prefixCls:w,className:T,style:Object.assign(Object.assign({},r==null?void 0:r.style),s)}),M))}),r9e=Object.assign(YLt,{Panel:aLt}),OLt=(t,e)=>{const{r:n,g:o,b:r,a:i}=t.toRgb(),a=new PL(t.toRgbString()).onBackground(e).toHsv();return i<=.5?a.v>.5:n*.299+o*.587+r*.114>192},lqe=t=>{const{paddingInline:e,onlyIconSize:n}=t;return Ui(t,{buttonPaddingHorizontal:e,buttonPaddingVertical:0,buttonIconOnlyFontSize:n})},sqe=t=>{var e,n,o,r,i,a;const l=(e=t.contentFontSize)!==null&&e!==void 0?e:t.fontSize,s=(n=t.contentFontSizeSM)!==null&&n!==void 0?n:t.fontSize,c=(o=t.contentFontSizeLG)!==null&&o!==void 0?o:t.fontSizeLG,u=(r=t.contentLineHeight)!==null&&r!==void 0?r:dG(l),d=(i=t.contentLineHeightSM)!==null&&i!==void 0?i:dG(s),f=(a=t.contentLineHeightLG)!==null&&a!==void 0?a:dG(c),p=OLt(new $Ft(t.colorBgSolid),"#fff")?"#000":"#fff";return{fontWeight:400,defaultShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlTmpOutline}`,primaryShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlOutline}`,dangerShadow:`0 ${t.controlOutlineWidth}px 0 ${t.colorErrorOutline}`,primaryColor:t.colorTextLightSolid,dangerColor:t.colorTextLightSolid,borderColorDisabled:t.colorBorder,defaultGhostColor:t.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:t.colorBgContainer,paddingInline:t.paddingContentHorizontal-t.lineWidth,paddingInlineLG:t.paddingContentHorizontal-t.lineWidth,paddingInlineSM:8-t.lineWidth,onlyIconSize:"inherit",onlyIconSizeSM:"inherit",onlyIconSizeLG:"inherit",groupBorderColor:t.colorPrimaryHover,linkHoverBg:"transparent",textTextColor:t.colorText,textTextHoverColor:t.colorText,textTextActiveColor:t.colorText,textHoverBg:t.colorFillTertiary,defaultColor:t.colorText,defaultBg:t.colorBgContainer,defaultBorderColor:t.colorBorder,defaultBorderColorDisabled:t.colorBorder,defaultHoverBg:t.colorBgContainer,defaultHoverColor:t.colorPrimaryHover,defaultHoverBorderColor:t.colorPrimaryHover,defaultActiveBg:t.colorBgContainer,defaultActiveColor:t.colorPrimaryActive,defaultActiveBorderColor:t.colorPrimaryActive,solidTextColor:p,contentFontSize:l,contentFontSizeSM:s,contentFontSizeLG:c,contentLineHeight:u,contentLineHeightSM:d,contentLineHeightLG:f,paddingBlock:Math.max((t.controlHeight-l*u)/2-t.lineWidth,0),paddingBlockSM:Math.max((t.controlHeightSM-s*d)/2-t.lineWidth,0),paddingBlockLG:Math.max((t.controlHeightLG-c*f)/2-t.lineWidth,0)}},_Lt=t=>{const{componentCls:e,iconCls:n,fontWeight:o,opacityLoading:r,motionDurationSlow:i,motionEaseInOut:a,marginXS:l,calc:s}=t;return{[e]:{outline:"none",position:"relative",display:"inline-flex",gap:t.marginXS,alignItems:"center",justifyContent:"center",fontWeight:o,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,cursor:"pointer",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,userSelect:"none",touchAction:"manipulation",color:t.colorText,"&:disabled > *":{pointerEvents:"none"},[`${e}-icon > svg`]:WS(),"> a":{color:"currentColor"},"&:not(:disabled)":Yy(t),[`&${e}-two-chinese-chars::first-letter`]:{letterSpacing:"0.34em"},[`&${e}-two-chinese-chars > *:not(${n})`]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},[`&${e}-icon-only`]:{paddingInline:0,[`&${e}-compact-item`]:{flex:"none"},[`&${e}-round`]:{width:"auto"}},[`&${e}-loading`]:{opacity:r,cursor:"default"},[`${e}-loading-icon`]:{transition:["width","opacity","margin"].map(c=>`${c} ${i} ${a}`).join(",")},[`&:not(${e}-icon-end)`]:{[`${e}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineEnd:s(l).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineEnd:0},"&-leave-start":{marginInlineEnd:0},"&-leave-active":{marginInlineEnd:s(l).mul(-1).equal()}}},"&-icon-end":{flexDirection:"row-reverse",[`${e}-loading-icon-motion`]:{"&-appear-start, &-enter-start":{marginInlineStart:s(l).mul(-1).equal()},"&-appear-active, &-enter-active":{marginInlineStart:0},"&-leave-start":{marginInlineStart:0},"&-leave-active":{marginInlineStart:s(l).mul(-1).equal()}}}}}},cqe=(t,e,n)=>({[`&:not(:disabled):not(${t}-disabled)`]:{"&:hover":e,"&:active":n}}),VLt=t=>({minWidth:t.controlHeight,paddingInlineStart:0,paddingInlineEnd:0,borderRadius:"50%"}),GLt=t=>({borderRadius:t.controlHeight,paddingInlineStart:t.calc(t.controlHeight).div(2).equal(),paddingInlineEnd:t.calc(t.controlHeight).div(2).equal()}),XLt=t=>({cursor:"not-allowed",borderColor:t.borderColorDisabled,color:t.colorTextDisabled,background:t.colorBgContainerDisabled,boxShadow:"none"}),i9e=(t,e,n,o,r,i,a,l)=>({[`&${t}-background-ghost`]:Object.assign(Object.assign({color:n||void 0,background:e,borderColor:o||void 0,boxShadow:"none"},cqe(t,Object.assign({background:e},a),Object.assign({background:e},l))),{"&:disabled":{cursor:"not-allowed",color:r||void 0,borderColor:i||void 0}})}),JLt=t=>({[`&:disabled, &${t.componentCls}-disabled`]:Object.assign({},XLt(t))}),KLt=t=>({[`&:disabled, &${t.componentCls}-disabled`]:{cursor:"not-allowed",color:t.colorTextDisabled}}),wZ=(t,e,n,o)=>{const i=o&&["link","text"].includes(o)?KLt:JLt;return Object.assign(Object.assign({},i(t)),cqe(t.componentCls,e,n))},xZ=(t,e,n,o,r)=>({[`&${t.componentCls}-variant-solid`]:Object.assign({color:e,background:n},wZ(t,o,r))}),vZ=(t,e,n,o,r)=>({[`&${t.componentCls}-variant-outlined, &${t.componentCls}-variant-dashed`]:Object.assign({borderColor:e,background:n},wZ(t,o,r))}),bZ=t=>({[`&${t.componentCls}-variant-dashed`]:{borderStyle:"dashed"}}),SZ=(t,e,n,o)=>({[`&${t.componentCls}-variant-filled`]:Object.assign({boxShadow:"none",background:e},wZ(t,n,o))}),n7=(t,e,n,o,r)=>({[`&${t.componentCls}-variant-${n}`]:Object.assign({color:e,boxShadow:"none"},wZ(t,o,r,n))}),$Lt=t=>{const{componentCls:e}=t;return Gb.reduce((n,o)=>{const r=t[`${o}6`],i=t[`${o}1`],a=t[`${o}5`],l=t[`${o}2`],s=t[`${o}3`],c=t[`${o}7`],u=`0 ${jt(t.controlOutlineWidth)} 0 ${t[`${o}1`]}`;return Object.assign(Object.assign({},n),{[`&${e}-color-${o}`]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:r,boxShadow:u},xZ(t,t.colorTextLightSolid,r,{background:a},{background:c})),vZ(t,r,t.colorBgContainer,{color:a,borderColor:a,background:t.colorBgContainer},{color:c,borderColor:c,background:t.colorBgContainer})),bZ(t)),SZ(t,i,{background:l},{background:s})),n7(t,r,"link",{color:a},{color:c})),n7(t,r,"text",{color:a,background:i},{color:c,background:s}))})},{})},qLt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.defaultColor,boxShadow:t.defaultShadow},xZ(t,t.solidTextColor,t.colorBgSolid,{color:t.solidTextColor,background:t.colorBgSolidHover},{color:t.solidTextColor,background:t.colorBgSolidActive})),bZ(t)),SZ(t,t.colorFillTertiary,{background:t.colorFillSecondary},{background:t.colorFill})),n7(t,t.textTextColor,"link",{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),i9e(t.componentCls,t.ghostBg,t.defaultGhostColor,t.defaultGhostBorderColor,t.colorTextDisabled,t.colorBorder)),QLt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.colorPrimary,boxShadow:t.primaryShadow},vZ(t,t.colorPrimary,t.colorBgContainer,{color:t.colorPrimaryTextHover,borderColor:t.colorPrimaryHover,background:t.colorBgContainer},{color:t.colorPrimaryTextActive,borderColor:t.colorPrimaryActive,background:t.colorBgContainer})),bZ(t)),SZ(t,t.colorPrimaryBg,{background:t.colorPrimaryBgHover},{background:t.colorPrimaryBorder})),n7(t,t.colorLink,"text",{color:t.colorPrimaryTextHover,background:t.colorPrimaryBg},{color:t.colorPrimaryTextActive,background:t.colorPrimaryBorder})),i9e(t.componentCls,t.ghostBg,t.colorPrimary,t.colorPrimary,t.colorTextDisabled,t.colorBorder,{color:t.colorPrimaryHover,borderColor:t.colorPrimaryHover},{color:t.colorPrimaryActive,borderColor:t.colorPrimaryActive})),ZLt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:t.colorError,boxShadow:t.dangerShadow},xZ(t,t.dangerColor,t.colorError,{background:t.colorErrorHover},{background:t.colorErrorActive})),vZ(t,t.colorError,t.colorBgContainer,{color:t.colorErrorHover,borderColor:t.colorErrorBorderHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),bZ(t)),SZ(t,t.colorErrorBg,{background:t.colorErrorBgFilledHover},{background:t.colorErrorBgActive})),n7(t,t.colorError,"text",{color:t.colorErrorHover,background:t.colorErrorBg},{color:t.colorErrorHover,background:t.colorErrorBgActive})),n7(t,t.colorError,"link",{color:t.colorErrorHover},{color:t.colorErrorActive})),i9e(t.componentCls,t.ghostBg,t.colorError,t.colorError,t.colorTextDisabled,t.colorBorder,{color:t.colorErrorHover,borderColor:t.colorErrorHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),eWt=t=>{const{componentCls:e}=t;return Object.assign({[`${e}-color-default`]:qLt(t),[`${e}-color-primary`]:QLt(t),[`${e}-color-dangerous`]:ZLt(t)},$Lt(t))},tWt=t=>Object.assign(Object.assign(Object.assign(Object.assign({},vZ(t,t.defaultBorderColor,t.defaultBg,{color:t.defaultHoverColor,borderColor:t.defaultHoverBorderColor,background:t.defaultHoverBg},{color:t.defaultActiveColor,borderColor:t.defaultActiveBorderColor,background:t.defaultActiveBg})),n7(t,t.textTextColor,"text",{color:t.textTextHoverColor,background:t.textHoverBg},{color:t.textTextActiveColor,background:t.colorBgTextActive})),xZ(t,t.primaryColor,t.colorPrimary,{background:t.colorPrimaryHover,color:t.primaryColor},{background:t.colorPrimaryActive,color:t.primaryColor})),n7(t,t.colorLink,"link",{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),a9e=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const{componentCls:n,controlHeight:o,fontSize:r,borderRadius:i,buttonPaddingHorizontal:a,iconCls:l,buttonPaddingVertical:s,buttonIconOnlyFontSize:c}=t;return[{[e]:{fontSize:r,height:o,padding:`${jt(s)} ${jt(a)}`,borderRadius:i,[`&${n}-icon-only`]:{width:o,[l]:{fontSize:c}}}},{[`${n}${n}-circle${e}`]:VLt(t)},{[`${n}${n}-round${e}`]:GLt(t)}]},nWt=t=>{const e=Ui(t,{fontSize:t.contentFontSize});return a9e(e,t.componentCls)},oWt=t=>{const e=Ui(t,{controlHeight:t.controlHeightSM,fontSize:t.contentFontSizeSM,padding:t.paddingXS,buttonPaddingHorizontal:t.paddingInlineSM,buttonPaddingVertical:0,borderRadius:t.borderRadiusSM,buttonIconOnlyFontSize:t.onlyIconSizeSM});return a9e(e,`${t.componentCls}-sm`)},rWt=t=>{const e=Ui(t,{controlHeight:t.controlHeightLG,fontSize:t.contentFontSizeLG,buttonPaddingHorizontal:t.paddingInlineLG,buttonPaddingVertical:0,borderRadius:t.borderRadiusLG,buttonIconOnlyFontSize:t.onlyIconSizeLG});return a9e(e,`${t.componentCls}-lg`)},iWt=t=>{const{componentCls:e}=t;return{[e]:{[`&${e}-block`]:{width:"100%"}}}},aWt=el("Button",t=>{const e=lqe(t);return[_Lt(e),nWt(e),oWt(e),rWt(e),iWt(e),eWt(e),tWt(e),EFt(e)]},sqe,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}});function lWt(t,e,n){const{focusElCls:o,focus:r,borderElCls:i}=n,a=i?"> *":"",l=["hover",r?"focus":null,"active"].filter(Boolean).map(s=>`&:${s} ${a}`).join(",");return{[`&-item:not(${e}-last-item)`]:{marginInlineEnd:t.calc(t.lineWidth).mul(-1).equal()},"&-item":Object.assign(Object.assign({[l]:{zIndex:2}},o?{[`&${o}`]:{zIndex:2}}:{}),{[`&[disabled] ${a}`]:{zIndex:0}})}}function sWt(t,e,n){const{borderElCls:o}=n,r=o?`> ${o}`:"";return{[`&-item:not(${e}-first-item):not(${e}-last-item) ${r}`]:{borderRadius:0},[`&-item:not(${e}-last-item)${e}-first-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${e}-first-item)${e}-last-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function sU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{focus:!0};const{componentCls:n}=t,o=`${n}-compact`;return{[o]:Object.assign(Object.assign({},lWt(t,o,e)),sWt(n,o,e))}}function cWt(t,e){return{[`&-item:not(${e}-last-item)`]:{marginBottom:t.calc(t.lineWidth).mul(-1).equal()},"&-item":{"&:hover,&:focus,&:active":{zIndex:2},"&[disabled]":{zIndex:0}}}}function uWt(t,e){return{[`&-item:not(${e}-first-item):not(${e}-last-item)`]:{borderRadius:0},[`&-item${e}-first-item:not(${e}-last-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${e}-last-item:not(${e}-first-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function dWt(t){const e=`${t.componentCls}-compact-vertical`;return{[e]:Object.assign(Object.assign({},cWt(t,e)),uWt(t.componentCls,e))}}const fWt=t=>{const{componentCls:e,colorPrimaryHover:n,lineWidth:o,calc:r}=t,i=r(o).mul(-1).equal(),a=l=>{const s=`${e}-compact${l?"-vertical":""}-item${e}-primary:not([disabled])`;return{[`${s} + ${s}::before`]:{position:"absolute",top:l?i:0,insetInlineStart:l?0:i,backgroundColor:n,content:'""',width:l?"100%":o,height:l?o:"100%"}}};return Object.assign(Object.assign({},a()),a(!0))},hWt=rU(["Button","compact"],t=>{const e=lqe(t);return[sU(e),dWt(e),fWt(e)]},sqe);var pWt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i;const{loading:a=!1,prefixCls:l,color:s,variant:c,type:u,danger:d=!1,shape:f="default",size:p,styles:m,disabled:y,className:w,rootClassName:x,children:C,icon:P,iconPosition:A="start",ghost:S=!1,block:v=!1,htmlType:b="button",classNames:T,style:R={},autoInsertSpace:M,autoFocus:D}=t,k=pWt(t,["loading","prefixCls","color","variant","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","iconPosition","ghost","block","htmlType","classNames","style","autoInsertSpace","autoFocus"]),N=u||"default",[U,W]=g.useMemo(()=>{if(s&&c)return[s,c];const _e=mWt[N]||[];return d?["danger",_e[1]]:_e},[u,s,c,d]),E=U==="danger"?"dangerous":U,{getPrefixCls:L,direction:j,button:Y}=g.useContext(gr),O=(n=M??(Y==null?void 0:Y.autoInsertSpace))!==null&&n!==void 0?n:!0,_=L("btn",l),[G,Q,oe]=aWt(_),ee=g.useContext(Bp),$=y??ee,ae=g.useContext(Z$e),Z=g.useMemo(()=>gWt(a),[a]),[ne,te]=g.useState(Z.loading),[q,le]=g.useState(!1),de=g.useRef(null),he=I5e(e,de),me=g.Children.count(C)===1&&!P&&!Hle(W),ce=g.useRef(!0);xe.useEffect(()=>(ce.current=!1,()=>{ce.current=!0}),[]),g.useEffect(()=>{let _e=null;Z.delay>0?_e=setTimeout(()=>{_e=null,te(!0)},Z.delay):te(Z.loading);function Ue(){_e&&(clearTimeout(_e),_e=null)}return Ue},[Z]),g.useEffect(()=>{if(!de.current||!O)return;const _e=de.current.textContent||"";me&&Kfe(_e)?q||le(!0):q&&le(!1)}),g.useEffect(()=>{D&&de.current&&de.current.focus()},[]);const Pe=xe.useCallback(_e=>{var Ue;if(ne||$){_e.preventDefault();return}(Ue=t.onClick)===null||Ue===void 0||Ue.call(t,_e)},[t.onClick,ne,$]),{compactSize:pe,compactItemClassnames:Ie}=x4(_,j),ve={large:"lg",small:"sm",middle:void 0},ze=jd(_e=>{var Ue,qe;return(qe=(Ue=p??pe)!==null&&Ue!==void 0?Ue:ae)!==null&&qe!==void 0?qe:_e}),Ae=ze&&(o=ve[ze])!==null&&o!==void 0?o:"",se=ne?"loading":P,ge=Mf(k,["navigate"]),we=Mn(_,Q,oe,{[`${_}-${f}`]:f!=="default"&&f,[`${_}-${N}`]:N,[`${_}-dangerous`]:d,[`${_}-color-${E}`]:E,[`${_}-variant-${W}`]:W,[`${_}-${Ae}`]:Ae,[`${_}-icon-only`]:!C&&C!==0&&!!se,[`${_}-background-ghost`]:S&&!Hle(W),[`${_}-loading`]:ne,[`${_}-two-chinese-chars`]:q&&O&&!ne,[`${_}-block`]:v,[`${_}-rtl`]:j==="rtl",[`${_}-icon-end`]:A==="end"},Ie,w,x,Y==null?void 0:Y.className),Se=Object.assign(Object.assign({},Y==null?void 0:Y.style),R),Me=Mn(T==null?void 0:T.icon,(r=Y==null?void 0:Y.classNames)===null||r===void 0?void 0:r.icon),Ce=Object.assign(Object.assign({},(m==null?void 0:m.icon)||{}),((i=Y==null?void 0:Y.styles)===null||i===void 0?void 0:i.icon)||{}),Te=P&&!ne?xe.createElement($fe,{prefixCls:_,className:Me,style:Ce},P):a&&typeof a=="object"&&a.icon?xe.createElement($fe,{prefixCls:_,className:Me,style:Ce},a.icon):xe.createElement(DFt,{existIcon:!!P,prefixCls:_,loading:ne,mount:ce.current}),Re=C||C===0?zFt(C,me&&O):null;if(ge.href!==void 0)return G(xe.createElement("a",Object.assign({},ge,{className:Mn(we,{[`${_}-disabled`]:$}),href:$?void 0:ge.href,style:Se,onClick:Pe,ref:he,tabIndex:$?-1:0}),Te,Re));let Ne=xe.createElement("button",Object.assign({},k,{type:b,className:we,style:Se,onClick:Pe,disabled:$,ref:he}),Te,Re,Ie&&xe.createElement(hWt,{prefixCls:_}));return Hle(W)||(Ne=xe.createElement(lU,{component:"Button",disabled:ne},Ne)),G(Ne)}),oo=yWt;oo.Group=MFt;oo.__ANT_BUTTON=!0;function Dle(t){return!!(t!=null&&t.then)}const uqe=t=>{const{type:e,children:n,prefixCls:o,buttonProps:r,close:i,autoFocus:a,emitEvent:l,isSilent:s,quitOnNullishReturnValue:c,actionFn:u}=t,d=g.useRef(!1),f=g.useRef(null),[p,m]=wH(!1),y=function(){i==null||i.apply(void 0,arguments)};g.useEffect(()=>{let C=null;return a&&(C=setTimeout(()=>{var P;(P=f.current)===null||P===void 0||P.focus({preventScroll:!0})})),()=>{C&&clearTimeout(C)}},[]);const w=C=>{Dle(C)&&(m(!0),C.then(function(){m(!1,!0),y.apply(void 0,arguments),d.current=!1},P=>{if(m(!1,!0),d.current=!1,!(s!=null&&s()))return Promise.reject(P)}))},x=C=>{if(d.current)return;if(d.current=!0,!u){y();return}let P;if(l){if(P=u(C),c&&!Dle(P)){d.current=!1,y(C);return}}else if(u.length)P=u(i),d.current=!1;else if(P=u(),!Dle(P)){y();return}w(P)};return g.createElement(oo,Object.assign({},eqe(e),{onClick:x,loading:p,prefixCls:o},r,{ref:f}),n)},cU=xe.createContext({}),{Provider:dqe}=cU,oTe=()=>{const{autoFocusButton:t,cancelButtonProps:e,cancelTextLocale:n,isSilent:o,mergedOkCancel:r,rootPrefixCls:i,close:a,onCancel:l,onConfirm:s}=g.useContext(cU);return r?xe.createElement(uqe,{isSilent:o,actionFn:l,close:function(){a==null||a.apply(void 0,arguments),s==null||s(!1)},autoFocus:t==="cancel",buttonProps:e,prefixCls:`${i}-btn`},n):null},rTe=()=>{const{autoFocusButton:t,close:e,isSilent:n,okButtonProps:o,rootPrefixCls:r,okTextLocale:i,okType:a,onConfirm:l,onOk:s}=g.useContext(cU);return xe.createElement(uqe,{isSilent:n,type:a||"primary",actionFn:s,close:function(){e==null||e.apply(void 0,arguments),l==null||l(!0)},autoFocus:t==="ok",buttonProps:o,prefixCls:`${r}-btn`},i)};var fqe=g.createContext(null),iTe=[];function AWt(t,e){var n=g.useState(function(){if(!mm())return null;var m=document.createElement("div");return m}),o=Sn(n,1),r=o[0],i=g.useRef(!1),a=g.useContext(fqe),l=g.useState(iTe),s=Sn(l,2),c=s[0],u=s[1],d=a||(i.current?void 0:function(m){u(function(y){var w=[m].concat($o(y));return w})});function f(){r.parentElement||document.body.appendChild(r),i.current=!0}function p(){var m;(m=r.parentElement)===null||m===void 0||m.removeChild(r),i.current=!1}return Ml(function(){return t?a?a(f):f():p(),p},[t]),Ml(function(){c.length&&(c.forEach(function(m){return m()}),u(iTe))},[c]),[r,d]}var Ele;function wWt(t){if(typeof document>"u")return 0;if(Ele===void 0){var e=document.createElement("div");e.style.width="100%",e.style.height="200px";var n=document.createElement("div"),o=n.style;o.position="absolute",o.top="0",o.left="0",o.pointerEvents="none",o.visibility="hidden",o.width="200px",o.height="150px",o.overflow="hidden",n.appendChild(e),document.body.appendChild(n);var r=e.offsetWidth;n.style.overflow="scroll";var i=e.offsetWidth;r===i&&(i=n.clientWidth),document.body.removeChild(n),Ele=r-i}return Ele}function aTe(t){var e=t.match(/^(.*)px$/),n=Number(e==null?void 0:e[1]);return Number.isNaN(n)?wWt():n}function xWt(t){if(typeof document>"u"||!t||!(t instanceof Element))return{width:0,height:0};var e=getComputedStyle(t,"::-webkit-scrollbar"),n=e.width,o=e.height;return{width:aTe(n),height:aTe(o)}}function vWt(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var bWt="rc-util-locker-".concat(Date.now()),lTe=0;function SWt(t){var e=!!t,n=g.useState(function(){return lTe+=1,"".concat(bWt,"_").concat(lTe)}),o=Sn(n,1),r=o[0];Ml(function(){if(e){var i=xWt(document.body).width,a=vWt();pb(` html body { overflow-y: hidden; `.concat(a?"width: calc(100% - ".concat(i,"px);"):"",` -}`),r)}else OX(r);return function(){OX(r)}},[e,r])}var TWt=!1;function PWt(t){return TWt}var sTe=function(e){return e===!1?!1:!mm()||!e?null:typeof e=="string"?document.querySelector(e):typeof e=="function"?e():e},uU=g.forwardRef(function(t,e){var n=t.open,o=t.autoLock,r=t.getContainer;t.debug;var i=t.autoDestroy,a=i===void 0?!0:i,l=t.children,s=g.useState(n),c=Sn(s,2),u=c[0],d=c[1],f=u||n;g.useEffect(function(){(a||n)&&d(n)},[n,a]);var p=g.useState(function(){return sTe(r)}),m=Sn(p,2),y=m[0],w=m[1];g.useEffect(function(){var D=sTe(r);w(D??null)});var x=AWt(f&&!y),C=Sn(x,2),P=C[0],A=C[1],S=y??P;SWt(o&&n&&mm()&&(S===P||S===document.body));var v=null;if(l&&Z8(l)&&e){var b=l;v=b.ref}var T=E7(v,e);if(!f||!mm()||y===void 0)return null;var R=S===!1||PWt(),M=l;return e&&(M=g.cloneElement(l,{ref:T})),g.createElement(fqe.Provider,{value:A},R?M:r0.createPortal(M,S))}),hqe=g.createContext({});function CWt(){var t=nn({},xN);return t.useId}var cTe=0,uTe=CWt();const pqe=uTe?function(e){var n=uTe();return e||n}:function(e){var n=g.useState("ssr-id"),o=Sn(n,2),r=o[0],i=o[1];return g.useEffect(function(){var a=cTe;cTe+=1,i("rc_unique_".concat(a))},[]),e||r};function dTe(t,e,n){var o=e;return!o&&n&&(o="".concat(t,"-").concat(n)),o}function fTe(t,e){var n=t["page".concat(e?"Y":"X","Offset")],o="scroll".concat(e?"Top":"Left");if(typeof n!="number"){var r=t.document;n=r.documentElement[o],typeof n!="number"&&(n=r.body[o])}return n}function RWt(t){var e=t.getBoundingClientRect(),n={left:e.left,top:e.top},o=t.ownerDocument,r=o.defaultView||o.parentWindow;return n.left+=fTe(r),n.top+=fTe(r,!0),n}const HWt=g.memo(function(t){var e=t.children;return e},function(t,e){var n=e.shouldUpdate;return!n});var MWt={width:0,height:0,overflow:"hidden",outline:"none"},IWt={outline:"none"},gqe=xe.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.title,a=t.ariaId,l=t.footer,s=t.closable,c=t.closeIcon,u=t.onClose,d=t.children,f=t.bodyStyle,p=t.bodyProps,m=t.modalRender,y=t.onMouseDown,w=t.onMouseUp,x=t.holderRef,C=t.visible,P=t.forceRender,A=t.width,S=t.height,v=t.classNames,b=t.styles,T=xe.useContext(hqe),R=T.panel,M=E7(x,R),D=g.useRef(),k=g.useRef();xe.useImperativeHandle(e,function(){return{focus:function(){var _;(_=D.current)===null||_===void 0||_.focus({preventScroll:!0})},changeActive:function(_){var G=document,Q=G.activeElement;_&&Q===k.current?D.current.focus({preventScroll:!0}):!_&&Q===D.current&&k.current.focus({preventScroll:!0})}}});var N={};A!==void 0&&(N.width=A),S!==void 0&&(N.height=S);var U=l?xe.createElement("div",{className:Bn("".concat(n,"-footer"),v==null?void 0:v.footer),style:nn({},b==null?void 0:b.footer)},l):null,W=i?xe.createElement("div",{className:Bn("".concat(n,"-header"),v==null?void 0:v.header),style:nn({},b==null?void 0:b.header)},xe.createElement("div",{className:"".concat(n,"-title"),id:a},i)):null,F=g.useMemo(function(){return Vr(s)==="object"&&s!==null?s:s?{closeIcon:c??xe.createElement("span",{className:"".concat(n,"-close-x")})}:{}},[s,c,n]),E=F1(F,!0),L=Vr(s)==="object"&&s.disabled,j=s?xe.createElement("button",Uo({type:"button",onClick:u,"aria-label":"Close"},E,{className:"".concat(n,"-close"),disabled:L}),F.closeIcon):null,Y=xe.createElement("div",{className:Bn("".concat(n,"-content"),v==null?void 0:v.content),style:b==null?void 0:b.content},j,W,xe.createElement("div",Uo({className:Bn("".concat(n,"-body"),v==null?void 0:v.body),style:nn(nn({},f),b==null?void 0:b.body)},p),d),U);return xe.createElement("div",{key:"dialog-element",role:"dialog","aria-labelledby":i?a:null,"aria-modal":"true",ref:M,style:nn(nn({},r),N),className:Bn(n,o),onMouseDown:y,onMouseUp:w},xe.createElement("div",{ref:D,tabIndex:0,style:IWt},xe.createElement(HWt,{shouldUpdate:C||P},m?m(Y):Y)),xe.createElement("div",{tabIndex:0,ref:k,style:MWt}))}),mqe=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.title,r=t.style,i=t.className,a=t.visible,l=t.forceRender,s=t.destroyOnClose,c=t.motionName,u=t.ariaId,d=t.onVisibleChanged,f=t.mousePosition,p=g.useRef(),m=g.useState(),y=Sn(m,2),w=y[0],x=y[1],C={};w&&(C.transformOrigin=w);function P(){var A=RWt(p.current);x(f&&(f.x||f.y)?"".concat(f.x-A.left,"px ").concat(f.y-A.top,"px"):"")}return g.createElement(Oy,{visible:a,onVisibleChanged:d,onAppearPrepare:P,onEnterPrepare:P,forceRender:l,motionName:c,removeOnLeave:s,ref:p},function(A,S){var v=A.className,b=A.style;return g.createElement(gqe,Uo({},t,{ref:e,title:o,ariaId:u,prefixCls:n,holderRef:S,style:nn(nn(nn({},b),r),C),className:Bn(i,v)}))})});mqe.displayName="Content";var zWt=function(e){var n=e.prefixCls,o=e.style,r=e.visible,i=e.maskProps,a=e.motionName,l=e.className;return g.createElement(Oy,{key:"mask",visible:r,motionName:a,leavedClassName:"".concat(n,"-mask-hidden")},function(s,c){var u=s.className,d=s.style;return g.createElement("div",Uo({ref:c,style:nn(nn({},d),o),className:Bn("".concat(n,"-mask"),u,l)},i))})},DWt=function(e){var n=e.prefixCls,o=n===void 0?"rc-dialog":n,r=e.zIndex,i=e.visible,a=i===void 0?!1:i,l=e.keyboard,s=l===void 0?!0:l,c=e.focusTriggerAfterClose,u=c===void 0?!0:c,d=e.wrapStyle,f=e.wrapClassName,p=e.wrapProps,m=e.onClose,y=e.afterOpenChange,w=e.afterClose,x=e.transitionName,C=e.animation,P=e.closable,A=P===void 0?!0:P,S=e.mask,v=S===void 0?!0:S,b=e.maskTransitionName,T=e.maskAnimation,R=e.maskClosable,M=R===void 0?!0:R,D=e.maskStyle,k=e.maskProps,N=e.rootClassName,U=e.classNames,W=e.styles,F=g.useRef(),E=g.useRef(),L=g.useRef(),j=g.useState(a),Y=Sn(j,2),O=Y[0],_=Y[1],G=pqe();function Q(){tfe(E.current,document.activeElement)||(F.current=document.activeElement)}function oe(){if(!tfe(E.current,document.activeElement)){var he;(he=L.current)===null||he===void 0||he.focus()}}function ee(he){if(he)oe();else{if(_(!1),v&&F.current&&u){try{F.current.focus({preventScroll:!0})}catch{}F.current=null}O&&(w==null||w())}y==null||y(he)}function q(he){m==null||m(he)}var ae=g.useRef(!1),Z=g.useRef(),ne=function(){clearTimeout(Z.current),ae.current=!0},te=function(){Z.current=setTimeout(function(){ae.current=!1})},$=null;M&&($=function(me){ae.current?ae.current=!1:E.current===me.target&&q(me)});function le(he){if(s&&he.keyCode===Lo.ESC){he.stopPropagation(),q(he);return}a&&he.keyCode===Lo.TAB&&L.current.changeActive(!he.shiftKey)}g.useEffect(function(){a&&(_(!0),Q())},[a]),g.useEffect(function(){return function(){clearTimeout(Z.current)}},[]);var de=nn(nn(nn({zIndex:r},d),W==null?void 0:W.wrapper),{},{display:O?null:"none"});return g.createElement("div",Uo({className:Bn("".concat(o,"-root"),N)},F1(e,{data:!0})),g.createElement(zWt,{prefixCls:o,visible:v&&a,motionName:dTe(o,b,T),style:nn(nn({zIndex:r},D),W==null?void 0:W.mask),maskProps:k,className:U==null?void 0:U.mask}),g.createElement("div",Uo({tabIndex:-1,onKeyDown:le,className:Bn("".concat(o,"-wrap"),f,U==null?void 0:U.wrapper),ref:E,onClick:$,style:de},p),g.createElement(mqe,Uo({},e,{onMouseDown:ne,onMouseUp:te,ref:L,closable:A,ariaId:G,prefixCls:o,visible:a&&O,onClose:q,onVisibleChanged:ee,motionName:dTe(o,x,C)}))))},l9e=function(e){var n=e.visible,o=e.getContainer,r=e.forceRender,i=e.destroyOnClose,a=i===void 0?!1:i,l=e.afterClose,s=e.panelRef,c=g.useState(n),u=Sn(c,2),d=u[0],f=u[1],p=g.useMemo(function(){return{panel:s}},[s]);return g.useEffect(function(){n&&f(!0)},[n]),!r&&a&&!d?null:g.createElement(hqe.Provider,{value:p},g.createElement(uU,{open:n||r||d,autoDestroy:!1,getContainer:o,autoLock:n||d},g.createElement(DWt,Uo({},e,{destroyOnClose:a,afterClose:function(){l==null||l(),f(!1)}}))))};l9e.displayName="Dialog";function D5(){D5=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(F,E,L){F[E]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(F,E,L){return Object.defineProperty(F,E,{value:L,enumerable:!0,configurable:!0,writable:!0}),F[E]}try{c({},"")}catch{c=function(L,j,Y){return L[j]=Y}}function u(F,E,L,j){var Y=E&&E.prototype instanceof x?E:x,O=Object.create(Y.prototype),_=new U(j||[]);return r(O,"_invoke",{value:M(F,L,_)}),O}function d(F,E,L){try{return{type:"normal",arg:F.call(E,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",y="completed",w={};function x(){}function C(){}function P(){}var A={};c(A,a,function(){return this});var S=Object.getPrototypeOf,v=S&&S(S(W([])));v&&v!==n&&o.call(v,a)&&(A=v);var b=P.prototype=x.prototype=Object.create(A);function T(F){["next","throw","return"].forEach(function(E){c(F,E,function(L){return this._invoke(E,L)})})}function R(F,E){function L(Y,O,_,G){var Q=d(F[Y],F,O);if(Q.type!=="throw"){var oe=Q.arg,ee=oe.value;return ee&&Vr(ee)=="object"&&o.call(ee,"__await")?E.resolve(ee.__await).then(function(q){L("next",q,_,G)},function(q){L("throw",q,_,G)}):E.resolve(ee).then(function(q){oe.value=q,_(oe)},function(q){return L("throw",q,_,G)})}G(Q.arg)}var j;r(this,"_invoke",{value:function(O,_){function G(){return new E(function(Q,oe){L(O,_,Q,oe)})}return j=j?j.then(G,G):G()}})}function M(F,E,L){var j=f;return function(Y,O){if(j===m)throw new Error("Generator is already running");if(j===y){if(Y==="throw")throw O;return{value:t,done:!0}}for(L.method=Y,L.arg=O;;){var _=L.delegate;if(_){var G=D(_,L);if(G){if(G===w)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=y,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=m;var Q=d(F,E,L);if(Q.type==="normal"){if(j=L.done?y:p,Q.arg===w)continue;return{value:Q.arg,done:L.done}}Q.type==="throw"&&(j=y,L.method="throw",L.arg=Q.arg)}}}function D(F,E){var L=E.method,j=F.iterator[L];if(j===t)return E.delegate=null,L==="throw"&&F.iterator.return&&(E.method="return",E.arg=t,D(F,E),E.method==="throw")||L!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+L+"' method")),w;var Y=d(j,F.iterator,E.arg);if(Y.type==="throw")return E.method="throw",E.arg=Y.arg,E.delegate=null,w;var O=Y.arg;return O?O.done?(E[F.resultName]=O.value,E.next=F.nextLoc,E.method!=="return"&&(E.method="next",E.arg=t),E.delegate=null,w):O:(E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,w)}function k(F){var E={tryLoc:F[0]};1 in F&&(E.catchLoc=F[1]),2 in F&&(E.finallyLoc=F[2],E.afterLoc=F[3]),this.tryEntries.push(E)}function N(F){var E=F.completion||{};E.type="normal",delete E.arg,F.completion=E}function U(F){this.tryEntries=[{tryLoc:"root"}],F.forEach(k,this),this.reset(!0)}function W(F){if(F||F===""){var E=F[a];if(E)return E.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var L=-1,j=function Y(){for(;++L=0;--Y){var O=this.tryEntries[Y],_=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),Q=o.call(O,"finallyLoc");if(G&&Q){if(this.prev=0;--j){var Y=this.tryEntries[j];if(Y.tryLoc<=this.prev&&o.call(Y,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===E)return this.complete(j.completion,j.afterLoc),N(j),w}},catch:function(E){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===E){var Y=j.completion;if(Y.type==="throw"){var O=Y.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(E,L,j){return this.delegate={iterator:W(E),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),w}},e}function hTe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function dU(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){hTe(i,o,r,a,l,"next",s)}function l(s){hTe(i,o,r,a,l,"throw",s)}a(void 0)})}}var Uv="RC_FORM_INTERNAL_HOOKS",Hs=function(){Ds(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},bH=g.createContext({getFieldValue:Hs,getFieldsValue:Hs,getFieldError:Hs,getFieldWarning:Hs,getFieldsError:Hs,isFieldsTouched:Hs,isFieldTouched:Hs,isFieldValidating:Hs,isFieldsValidating:Hs,resetFields:Hs,setFields:Hs,setFieldValue:Hs,setFieldsValue:Hs,validateFields:Hs,submit:Hs,getInternalHooks:function(){return Hs(),{dispatch:Hs,initEntityValue:Hs,registerField:Hs,useSubscribe:Hs,setInitialValues:Hs,destroyForm:Hs,setCallbacks:Hs,registerWatch:Hs,getFields:Hs,setValidateMessages:Hs,setPreserve:Hs,getInitialValue:Hs}}}),oJ=g.createContext(null);function Qfe(t){return t==null?[]:Array.isArray(t)?t:[t]}function EWt(t){return t&&!!t._init}function zp(t){"@babel/helpers - typeof";return zp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zp(t)}function kWt(t,e){if(zp(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(zp(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yqe(t){var e=kWt(t,"string");return zp(e)=="symbol"?e:e+""}function QA(t,e,n){return e=yqe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pTe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function jw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n1?e-1:0),o=1;o=i)return l;switch(l){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}break;default:return l}});return a}return t}function XWt(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function C0(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||XWt(e)&&typeof t=="string"&&!t)}function JWt(t,e,n){var o=[],r=0,i=t.length;function a(l){o.push.apply(o,oR(l||[])),r++,r===i&&n(o)}t.forEach(function(l){e(l,a)})}function gTe(t,e,n){var o=0,r=t.length;function i(a){if(a&&a.length){n(a);return}var l=o;o=o+1,le.max?r.push(om(i.messages[d].max,e.fullField,e.max)):l&&s&&(ue.max)&&r.push(om(i.messages[d].range,e.fullField,e.min,e.max))},xqe=function(e,n,o,r,i,a){e.required&&(!o.hasOwnProperty(e.field)||C0(n,a||e.type))&&r.push(om(i.messages.required,e.fullField))},OO;const nNt=function(){if(OO)return OO;var t="[a-fA-F\\d:]",e=function(v){return v&&v.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",o="[a-fA-F\\d]{1,4}",r=["(?:".concat(o,":){7}(?:").concat(o,"|:)"),"(?:".concat(o,":){6}(?:").concat(n,"|:").concat(o,"|:)"),"(?:".concat(o,":){5}(?::").concat(n,"|(?::").concat(o,"){1,2}|:)"),"(?:".concat(o,":){4}(?:(?::").concat(o,"){0,1}:").concat(n,"|(?::").concat(o,"){1,3}|:)"),"(?:".concat(o,":){3}(?:(?::").concat(o,"){0,2}:").concat(n,"|(?::").concat(o,"){1,4}|:)"),"(?:".concat(o,":){2}(?:(?::").concat(o,"){0,3}:").concat(n,"|(?::").concat(o,"){1,5}|:)"),"(?:".concat(o,":){1}(?:(?::").concat(o,"){0,4}:").concat(n,"|(?::").concat(o,"){1,6}|:)"),"(?::(?:(?::".concat(o,"){0,5}:").concat(n,"|(?::").concat(o,"){1,7}|:))")],i="(?:%[0-9a-zA-Z]{1,})?",a="(?:".concat(r.join("|"),")").concat(i),l=new RegExp("(?:^".concat(n,"$)|(?:^").concat(a,"$)")),s=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(a,"$")),u=function(v){return v&&v.exact?l:new RegExp("(?:".concat(e(v)).concat(n).concat(e(v),")|(?:").concat(e(v)).concat(a).concat(e(v),")"),"g")};u.v4=function(S){return S&&S.exact?s:new RegExp("".concat(e(S)).concat(n).concat(e(S)),"g")},u.v6=function(S){return S&&S.exact?c:new RegExp("".concat(e(S)).concat(a).concat(e(S)),"g")};var d="(?:(?:[a-z]+:)?//)",f="(?:\\S+(?::\\S*)?@)?",p=u.v4().source,m=u.v6().source,y="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",w="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",x="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",C="(?::\\d{2,5})?",P='(?:[/?#][^\\s"]*)?',A="(?:".concat(d,"|www\\.)").concat(f,"(?:localhost|").concat(p,"|").concat(m,"|").concat(y).concat(w).concat(x,")").concat(C).concat(P);return OO=new RegExp("(?:^".concat(A,"$)"),"i"),OO};var wTe={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},JE={integer:function(e){return JE.number(e)&&parseInt(e,10)===e},float:function(e){return JE.number(e)&&!JE.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return zp(e)==="object"&&!JE.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(wTe.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(nNt())},hex:function(e){return typeof e=="string"&&!!e.match(wTe.hex)}},oNt=function(e,n,o,r,i){if(e.required&&n===void 0){xqe(e,n,o,r,i);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],l=e.type;a.indexOf(l)>-1?JE[l](n)||r.push(om(i.messages.types[l],e.fullField,e.type)):l&&zp(n)!==e.type&&r.push(om(i.messages.types[l],e.fullField,e.type))},rNt=function(e,n,o,r,i){(/^\s+$/.test(n)||n==="")&&r.push(om(i.messages.whitespace,e.fullField))};const cl={required:xqe,whitespace:rNt,type:oNt,range:tNt,enum:ZWt,pattern:eNt};var iNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i)}o(a)},aNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(n==null&&!e.required)return o();cl.required(e,n,r,a,i,"array"),n!=null&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},lNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl.type(e,n,r,a,i)}o(a)},sNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n,"date")&&!e.required)return o();if(cl.required(e,n,r,a,i),!C0(n,"date")){var s;n instanceof Date?s=n:s=new Date(n),cl.type(e,s,r,a,i),s&&cl.range(e,s.getTime(),r,a,i)}}o(a)},cNt="enum",uNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl[cNt](e,n,r,a,i)}o(a)},dNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},fNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},hNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl.type(e,n,r,a,i)}o(a)},pNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(n===""&&(n=void 0),C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},gNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl.type(e,n,r,a,i)}o(a)},mNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n,"string")&&!e.required)return o();cl.required(e,n,r,a,i),C0(n,"string")||cl.pattern(e,n,r,a,i)}o(a)},yNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),C0(n)||cl.type(e,n,r,a,i)}o(a)},ANt=function(e,n,o,r,i){var a=[],l=Array.isArray(n)?"array":zp(n);cl.required(e,n,r,a,i,l),o(a)},wNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n,"string")&&!e.required)return o();cl.required(e,n,r,a,i,"string"),C0(n,"string")||(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i),cl.pattern(e,n,r,a,i),e.whitespace===!0&&cl.whitespace(e,n,r,a,i))}o(a)},kle=function(e,n,o,r,i){var a=e.type,l=[],s=e.required||!e.required&&r.hasOwnProperty(e.field);if(s){if(C0(n,a)&&!e.required)return o();cl.required(e,n,r,l,i,a),C0(n,a)||cl.type(e,n,r,l,i)}o(l)};const Bk={string:wNt,method:hNt,number:pNt,boolean:lNt,regexp:yNt,integer:fNt,float:dNt,array:aNt,object:gNt,enum:uNt,pattern:mNt,date:sNt,url:kle,hex:kle,email:kle,required:ANt,any:iNt};var fU=function(){function t(e){Aqe(this,t),QA(this,"rules",null),QA(this,"_messages",the),this.define(e)}return wqe(t,[{key:"define",value:function(n){var o=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(zp(n)!=="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(r){var i=n[r];o.rules[r]=Array.isArray(i)?i:[i]})}},{key:"messages",value:function(n){return n&&(this._messages=ATe(ehe(),n)),this._messages}},{key:"validate",value:function(n){var o=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},a=n,l=r,s=i;if(typeof l=="function"&&(s=l,l={}),!this.rules||Object.keys(this.rules).length===0)return s&&s(null,a),Promise.resolve(a);function c(m){var y=[],w={};function x(P){if(Array.isArray(P)){var A;y=(A=y).concat.apply(A,oR(P))}else y.push(P)}for(var C=0;C0&&arguments[0]!==void 0?arguments[0]:[],T=Array.isArray(b)?b:[b];!l.suppressWarning&&T.length&&t.warning("async-validator:",T),T.length&&w.message!==void 0&&(T=[].concat(w.message));var R=T.map(yTe(w,a));if(l.first&&R.length)return p[w.field]=1,y(R);if(!x)y(R);else{if(w.required&&!m.value)return w.message!==void 0?R=[].concat(w.message).map(yTe(w,a)):l.error&&(R=[l.error(w,om(l.messages.required,w.field))]),y(R);var M={};w.defaultField&&Object.keys(m.value).map(function(N){M[N]=w.defaultField}),M=jw(jw({},M),m.rule.fields);var D={};Object.keys(M).forEach(function(N){var U=M[N],W=Array.isArray(U)?U:[U];D[N]=W.map(C.bind(null,N))});var k=new t(D);k.messages(l.messages),m.rule.options&&(m.rule.options.messages=l.messages,m.rule.options.error=l.error),k.validate(m.value,m.rule.options||l,function(N){var U=[];R&&R.length&&U.push.apply(U,oR(R)),N&&N.length&&U.push.apply(U,oR(N)),y(U.length?U:null)})}}var A;if(w.asyncValidator)A=w.asyncValidator(w,m.value,P,m.source,l);else if(w.validator){try{A=w.validator(w,m.value,P,m.source,l)}catch(b){var S,v;(S=(v=console).error)===null||S===void 0||S.call(v,b),l.suppressValidatorError||setTimeout(function(){throw b},0),P(b.message)}A===!0?P():A===!1?P(typeof w.message=="function"?w.message(w.fullField||w.field):w.message||"".concat(w.fullField||w.field," fails")):A instanceof Array?P(A):A instanceof Error&&P(A.message)}A&&A.then&&A.then(function(){return P()},function(b){return P(b)})},function(m){c(m)},a)}},{key:"getType",value:function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!Bk.hasOwnProperty(n.type))throw new Error(om("Unknown rule type %s",n.type));return n.type||"string"}},{key:"getValidationMethod",value:function(n){if(typeof n.validator=="function")return n.validator;var o=Object.keys(n),r=o.indexOf("message");return r!==-1&&o.splice(r,1),o.length===1&&o[0]==="required"?Bk.required:Bk[this.getType(n)]||void 0}}]),t}();QA(fU,"register",function(e,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");Bk[e]=n});QA(fU,"warning",GWt);QA(fU,"messages",the);QA(fU,"validators",Bk);var Tg="'${name}' is not a valid ${type}",vqe={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:Tg,method:Tg,array:Tg,object:Tg,number:Tg,date:Tg,boolean:Tg,integer:Tg,float:Tg,regexp:Tg,email:Tg,url:Tg,hex:Tg},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}},xTe=fU;function xNt(t,e){return t.replace(/\\?\$\{\w+\}/g,function(n){if(n.startsWith("\\"))return n.slice(1);var o=n.slice(2,-1);return e[o]})}var vTe="CODE_LOGIC_ERROR";function ihe(t,e,n,o,r){return ahe.apply(this,arguments)}function ahe(){return ahe=dU(D5().mark(function t(e,n,o,r,i){var a,l,s,c,u,d,f,p,m;return D5().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return a=nn({},o),delete a.ruleIndex,xTe.warning=function(){},a.validator&&(l=a.validator,a.validator=function(){try{return l.apply(void 0,arguments)}catch(x){return console.error(x),Promise.reject(vTe)}}),s=null,a&&a.type==="array"&&a.defaultField&&(s=a.defaultField,delete a.defaultField),c=new xTe(Ut({},e,[a])),u=XE(vqe,r.validateMessages),c.messages(u),d=[],w.prev=10,w.next=13,Promise.resolve(c.validate(Ut({},e,n),nn({},r)));case 13:w.next=18;break;case 15:w.prev=15,w.t0=w.catch(10),w.t0.errors&&(d=w.t0.errors.map(function(x,C){var P=x.message,A=P===vTe?u.default:P;return g.isValidElement(A)?g.cloneElement(A,{key:"error_".concat(C)}):A}));case 18:if(!(!d.length&&s)){w.next=23;break}return w.next=21,Promise.all(n.map(function(x,C){return ihe("".concat(e,".").concat(C),x,s,r,i)}));case 21:return f=w.sent,w.abrupt("return",f.reduce(function(x,C){return[].concat($o(x),$o(C))},[]));case 23:return p=nn(nn({},o),{},{name:e,enum:(o.enum||[]).join(", ")},i),m=d.map(function(x){return typeof x=="string"?xNt(x,p):x}),w.abrupt("return",m);case 26:case"end":return w.stop()}},t,null,[[10,15]])})),ahe.apply(this,arguments)}function vNt(t,e,n,o,r,i){var a=t.join("."),l=n.map(function(u,d){var f=u.validator,p=nn(nn({},u),{},{ruleIndex:d});return f&&(p.validator=function(m,y,w){var x=!1,C=function(){for(var S=arguments.length,v=new Array(S),b=0;b2&&arguments[2]!==void 0?arguments[2]:!1;return t&&t.some(function(o){return bqe(e,o,n)})}function bqe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!t||!e||!n&&t.length!==e.length?!1:e.every(function(o,r){return t[r]===o})}function TNt(t,e){if(t===e)return!0;if(!t&&e||t&&!e||!t||!e||Vr(t)!=="object"||Vr(e)!=="object")return!1;var n=Object.keys(t),o=Object.keys(e),r=new Set([].concat(n,o));return $o(r).every(function(i){var a=t[i],l=e[i];return typeof a=="function"&&typeof l=="function"?!0:a===l})}function PNt(t){var e=arguments.length<=1?void 0:arguments[1];return e&&e.target&&Vr(e.target)==="object"&&t in e.target?e.target[t]:e}function STe(t,e,n){var o=t.length;if(e<0||e>=o||n<0||n>=o)return t;var r=t[e],i=e-n;return i>0?[].concat($o(t.slice(0,n)),[r],$o(t.slice(n,e)),$o(t.slice(e+1,o))):i<0?[].concat($o(t.slice(0,e)),$o(t.slice(e+1,n+1)),[r],$o(t.slice(n+1,o))):t}var CNt=["name"],Zm=[];function Fle(t,e,n,o,r,i){return typeof t=="function"?t(e,n,"source"in i?{source:i.source}:{}):o!==r}var c9e=function(t){XM(n,t);var e=JM(n);function n(o){var r;if(Uh(this,n),r=e.call(this,o),Ut(kr(r),"state",{resetCount:0}),Ut(kr(r),"cancelRegisterFunc",null),Ut(kr(r),"mounted",!1),Ut(kr(r),"touched",!1),Ut(kr(r),"dirty",!1),Ut(kr(r),"validatePromise",void 0),Ut(kr(r),"prevValidating",void 0),Ut(kr(r),"errors",Zm),Ut(kr(r),"warnings",Zm),Ut(kr(r),"cancelRegister",function(){var s=r.props,c=s.preserve,u=s.isListField,d=s.name;r.cancelRegisterFunc&&r.cancelRegisterFunc(u,c,$u(d)),r.cancelRegisterFunc=null}),Ut(kr(r),"getNamePath",function(){var s=r.props,c=s.name,u=s.fieldContext,d=u.prefixName,f=d===void 0?[]:d;return c!==void 0?[].concat($o(f),$o(c)):[]}),Ut(kr(r),"getRules",function(){var s=r.props,c=s.rules,u=c===void 0?[]:c,d=s.fieldContext;return u.map(function(f){return typeof f=="function"?f(d):f})}),Ut(kr(r),"refresh",function(){r.mounted&&r.setState(function(s){var c=s.resetCount;return{resetCount:c+1}})}),Ut(kr(r),"metaCache",null),Ut(kr(r),"triggerMetaEvent",function(s){var c=r.props.onMetaChange;if(c){var u=nn(nn({},r.getMeta()),{},{destroy:s});Vb(r.metaCache,u)||c(u),r.metaCache=u}else r.metaCache=null}),Ut(kr(r),"onStoreChange",function(s,c,u){var d=r.props,f=d.shouldUpdate,p=d.dependencies,m=p===void 0?[]:p,y=d.onReset,w=u.store,x=r.getNamePath(),C=r.getValue(s),P=r.getValue(w),A=c&&DR(c,x);switch(u.type==="valueUpdate"&&u.source==="external"&&!Vb(C,P)&&(r.touched=!0,r.dirty=!0,r.validatePromise=null,r.errors=Zm,r.warnings=Zm,r.triggerMetaEvent()),u.type){case"reset":if(!c||A){r.touched=!1,r.dirty=!1,r.validatePromise=void 0,r.errors=Zm,r.warnings=Zm,r.triggerMetaEvent(),y==null||y(),r.refresh();return}break;case"remove":{if(f&&Fle(f,s,w,C,P,u)){r.reRender();return}break}case"setField":{var S=u.data;if(A){"touched"in S&&(r.touched=S.touched),"validating"in S&&!("originRCField"in S)&&(r.validatePromise=S.validating?Promise.resolve([]):null),"errors"in S&&(r.errors=S.errors||Zm),"warnings"in S&&(r.warnings=S.warnings||Zm),r.dirty=!0,r.triggerMetaEvent(),r.reRender();return}else if("value"in S&&DR(c,x,!0)){r.reRender();return}if(f&&!x.length&&Fle(f,s,w,C,P,u)){r.reRender();return}break}case"dependenciesUpdate":{var v=m.map($u);if(v.some(function(b){return DR(u.relatedFields,b)})){r.reRender();return}break}default:if(A||(!m.length||x.length||f)&&Fle(f,s,w,C,P,u)){r.reRender();return}break}f===!0&&r.reRender()}),Ut(kr(r),"validateRules",function(s){var c=r.getNamePath(),u=r.getValue(),d=s||{},f=d.triggerName,p=d.validateOnly,m=p===void 0?!1:p,y=Promise.resolve().then(dU(D5().mark(function w(){var x,C,P,A,S,v,b;return D5().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(r.mounted){R.next=2;break}return R.abrupt("return",[]);case 2:if(x=r.props,C=x.validateFirst,P=C===void 0?!1:C,A=x.messageVariables,S=x.validateDebounce,v=r.getRules(),f&&(v=v.filter(function(M){return M}).filter(function(M){var D=M.validateTrigger;if(!D)return!0;var k=Qfe(D);return k.includes(f)})),!(S&&f)){R.next=10;break}return R.next=8,new Promise(function(M){setTimeout(M,S)});case 8:if(r.validatePromise===y){R.next=10;break}return R.abrupt("return",[]);case 10:return b=vNt(c,u,v,s,P,A),b.catch(function(M){return M}).then(function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zm;if(r.validatePromise===y){var D;r.validatePromise=null;var k=[],N=[];(D=M.forEach)===null||D===void 0||D.call(M,function(U){var W=U.rule.warningOnly,F=U.errors,E=F===void 0?Zm:F;W?N.push.apply(N,$o(E)):k.push.apply(k,$o(E))}),r.errors=k,r.warnings=N,r.triggerMetaEvent(),r.reRender()}}),R.abrupt("return",b);case 13:case"end":return R.stop()}},w)})));return m||(r.validatePromise=y,r.dirty=!0,r.errors=Zm,r.warnings=Zm,r.triggerMetaEvent(),r.reRender()),y}),Ut(kr(r),"isFieldValidating",function(){return!!r.validatePromise}),Ut(kr(r),"isFieldTouched",function(){return r.touched}),Ut(kr(r),"isFieldDirty",function(){if(r.dirty||r.props.initialValue!==void 0)return!0;var s=r.props.fieldContext,c=s.getInternalHooks(Uv),u=c.getInitialValue;return u(r.getNamePath())!==void 0}),Ut(kr(r),"getErrors",function(){return r.errors}),Ut(kr(r),"getWarnings",function(){return r.warnings}),Ut(kr(r),"isListField",function(){return r.props.isListField}),Ut(kr(r),"isList",function(){return r.props.isList}),Ut(kr(r),"isPreserve",function(){return r.props.preserve}),Ut(kr(r),"getMeta",function(){r.prevValidating=r.isFieldValidating();var s={touched:r.isFieldTouched(),validating:r.prevValidating,errors:r.errors,warnings:r.warnings,name:r.getNamePath(),validated:r.validatePromise===null};return s}),Ut(kr(r),"getOnlyChild",function(s){if(typeof s=="function"){var c=r.getMeta();return nn(nn({},r.getOnlyChild(s(r.getControlled(),c,r.props.fieldContext))),{},{isFunction:!0})}var u=t7(s);return u.length!==1||!g.isValidElement(u[0])?{child:u,isFunction:!1}:{child:u[0],isFunction:!1}}),Ut(kr(r),"getValue",function(s){var c=r.props.fieldContext.getFieldsValue,u=r.getNamePath();return a3(s||c(!0),u)}),Ut(kr(r),"getControlled",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},c=r.props,u=c.name,d=c.trigger,f=c.validateTrigger,p=c.getValueFromEvent,m=c.normalize,y=c.valuePropName,w=c.getValueProps,x=c.fieldContext,C=f!==void 0?f:x.validateTrigger,P=r.getNamePath(),A=x.getInternalHooks,S=x.getFieldsValue,v=A(Uv),b=v.dispatch,T=r.getValue(),R=w||function(U){return Ut({},y,U)},M=s[d],D=u!==void 0?R(T):{},k=nn(nn({},s),D);k[d]=function(){r.touched=!0,r.dirty=!0,r.triggerMetaEvent();for(var U,W=arguments.length,F=new Array(W),E=0;E=0&&M<=D.length?(u.keys=[].concat($o(u.keys.slice(0,M)),[u.id],$o(u.keys.slice(M))),P([].concat($o(D.slice(0,M)),[R],$o(D.slice(M))))):(u.keys=[].concat($o(u.keys),[u.id]),P([].concat($o(D),[R]))),u.id+=1},remove:function(R){var M=S(),D=new Set(Array.isArray(R)?R:[R]);D.size<=0||(u.keys=u.keys.filter(function(k,N){return!D.has(N)}),P(M.filter(function(k,N){return!D.has(N)})))},move:function(R,M){if(R!==M){var D=S();R<0||R>=D.length||M<0||M>=D.length||(u.keys=STe(u.keys,R,M),P(STe(D,R,M)))}}},b=C||[];return Array.isArray(b)||(b=[]),o(b.map(function(T,R){var M=u.keys[R];return M===void 0&&(u.keys[R]=u.id,M=u.keys[R],u.id+=1),{name:R,key:M,isListField:!0}}),v,w)})))}function HNt(t){var e=!1,n=t.length,o=[];return t.length?new Promise(function(r,i){t.forEach(function(a,l){a.catch(function(s){return e=!0,s}).then(function(s){n-=1,o[l]=s,!(n>0)&&(e&&i(o),r(o))})})}):Promise.resolve([])}var Tqe="__@field_split__";function Lle(t){return t.map(function(e){return"".concat(Vr(e),":").concat(e)}).join(Tqe)}var zP=function(){function t(){Uh(this,t),Ut(this,"kvs",new Map)}return jh(t,[{key:"set",value:function(n,o){this.kvs.set(Lle(n),o)}},{key:"get",value:function(n){return this.kvs.get(Lle(n))}},{key:"update",value:function(n,o){var r=this.get(n),i=o(r);i?this.set(n,i):this.delete(n)}},{key:"delete",value:function(n){this.kvs.delete(Lle(n))}},{key:"map",value:function(n){return $o(this.kvs.entries()).map(function(o){var r=Sn(o,2),i=r[0],a=r[1],l=i.split(Tqe);return n({key:l.map(function(s){var c=s.match(/^([^:]*):(.*)$/),u=Sn(c,3),d=u[1],f=u[2];return d==="number"?Number(f):f}),value:a})})}},{key:"toJSON",value:function(){var n={};return this.map(function(o){var r=o.key,i=o.value;return n[r.join(".")]=i,null}),n}}]),t}(),MNt=["name"],INt=jh(function t(e){var n=this;Uh(this,t),Ut(this,"formHooked",!1),Ut(this,"forceRootUpdate",void 0),Ut(this,"subscribable",!0),Ut(this,"store",{}),Ut(this,"fieldEntities",[]),Ut(this,"initialValues",{}),Ut(this,"callbacks",{}),Ut(this,"validateMessages",null),Ut(this,"preserve",null),Ut(this,"lastValidatePromise",null),Ut(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),Ut(this,"getInternalHooks",function(o){return o===Uv?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):(Ds(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),Ut(this,"useSubscribe",function(o){n.subscribable=o}),Ut(this,"prevWithoutPreserves",null),Ut(this,"setInitialValues",function(o,r){if(n.initialValues=o||{},r){var i,a=XE(o,n.store);(i=n.prevWithoutPreserves)===null||i===void 0||i.map(function(l){var s=l.key;a=Z2(a,s,a3(o,s))}),n.prevWithoutPreserves=null,n.updateStore(a)}}),Ut(this,"destroyForm",function(o){if(o)n.updateStore({});else{var r=new zP;n.getFieldEntities(!0).forEach(function(i){n.isMergedPreserve(i.isPreserve())||r.set(i.getNamePath(),!0)}),n.prevWithoutPreserves=r}}),Ut(this,"getInitialValue",function(o){var r=a3(n.initialValues,o);return o.length?XE(r):r}),Ut(this,"setCallbacks",function(o){n.callbacks=o}),Ut(this,"setValidateMessages",function(o){n.validateMessages=o}),Ut(this,"setPreserve",function(o){n.preserve=o}),Ut(this,"watchList",[]),Ut(this,"registerWatch",function(o){return n.watchList.push(o),function(){n.watchList=n.watchList.filter(function(r){return r!==o})}}),Ut(this,"notifyWatch",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(n.watchList.length){var r=n.getFieldsValue(),i=n.getFieldsValue(!0);n.watchList.forEach(function(a){a(r,i,o)})}}),Ut(this,"timeoutId",null),Ut(this,"warningUnhooked",function(){}),Ut(this,"updateStore",function(o){n.store=o}),Ut(this,"getFieldEntities",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return o?n.fieldEntities.filter(function(r){return r.getNamePath().length}):n.fieldEntities}),Ut(this,"getFieldsMap",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=new zP;return n.getFieldEntities(o).forEach(function(i){var a=i.getNamePath();r.set(a,i)}),r}),Ut(this,"getFieldEntitiesForNamePathList",function(o){if(!o)return n.getFieldEntities(!0);var r=n.getFieldsMap(!0);return o.map(function(i){var a=$u(i);return r.get(a)||{INVALIDATE_NAME_PATH:$u(i)}})}),Ut(this,"getFieldsValue",function(o,r){n.warningUnhooked();var i,a,l;if(o===!0||Array.isArray(o)?(i=o,a=r):o&&Vr(o)==="object"&&(l=o.strict,a=o.filter),i===!0&&!a)return n.store;var s=n.getFieldEntitiesForNamePathList(Array.isArray(i)?i:null),c=[];return s.forEach(function(u){var d,f,p="INVALIDATE_NAME_PATH"in u?u.INVALIDATE_NAME_PATH:u.getNamePath();if(l){var m,y;if((m=(y=u).isList)!==null&&m!==void 0&&m.call(y))return}else if(!i&&(d=(f=u).isListField)!==null&&d!==void 0&&d.call(f))return;if(!a)c.push(p);else{var w="getMeta"in u?u.getMeta():null;a(w)&&c.push(p)}}),bTe(n.store,c.map($u))}),Ut(this,"getFieldValue",function(o){n.warningUnhooked();var r=$u(o);return a3(n.store,r)}),Ut(this,"getFieldsError",function(o){n.warningUnhooked();var r=n.getFieldEntitiesForNamePathList(o);return r.map(function(i,a){return i&&!("INVALIDATE_NAME_PATH"in i)?{name:i.getNamePath(),errors:i.getErrors(),warnings:i.getWarnings()}:{name:$u(o[a]),errors:[],warnings:[]}})}),Ut(this,"getFieldError",function(o){n.warningUnhooked();var r=$u(o),i=n.getFieldsError([r])[0];return i.errors}),Ut(this,"getFieldWarning",function(o){n.warningUnhooked();var r=$u(o),i=n.getFieldsError([r])[0];return i.warnings}),Ut(this,"isFieldsTouched",function(){n.warningUnhooked();for(var o=arguments.length,r=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:{},r=new zP,i=n.getFieldEntities(!0);i.forEach(function(s){var c=s.props.initialValue,u=s.getNamePath();if(c!==void 0){var d=r.get(u)||new Set;d.add({entity:s,value:c}),r.set(u,d)}});var a=function(c){c.forEach(function(u){var d=u.props.initialValue;if(d!==void 0){var f=u.getNamePath(),p=n.getInitialValue(f);if(p!==void 0)Ds(!1,"Form already set 'initialValues' with path '".concat(f.join("."),"'. Field can not overwrite it."));else{var m=r.get(f);if(m&&m.size>1)Ds(!1,"Multiple Field with path '".concat(f.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(m){var y=n.getFieldValue(f),w=u.isListField();!w&&(!o.skipExist||y===void 0)&&n.updateStore(Z2(n.store,f,$o(m)[0].value))}}}})},l;o.entities?l=o.entities:o.namePathList?(l=[],o.namePathList.forEach(function(s){var c=r.get(s);if(c){var u;(u=l).push.apply(u,$o($o(c).map(function(d){return d.entity})))}})):l=i,a(l)}),Ut(this,"resetFields",function(o){n.warningUnhooked();var r=n.store;if(!o){n.updateStore(XE(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(r,null,{type:"reset"}),n.notifyWatch();return}var i=o.map($u);i.forEach(function(a){var l=n.getInitialValue(a);n.updateStore(Z2(n.store,a,l))}),n.resetWithFieldInitialValue({namePathList:i}),n.notifyObservers(r,i,{type:"reset"}),n.notifyWatch(i)}),Ut(this,"setFields",function(o){n.warningUnhooked();var r=n.store,i=[];o.forEach(function(a){var l=a.name,s=Ai(a,MNt),c=$u(l);i.push(c),"value"in s&&n.updateStore(Z2(n.store,c,s.value)),n.notifyObservers(r,[c],{type:"setField",data:a})}),n.notifyWatch(i)}),Ut(this,"getFields",function(){var o=n.getFieldEntities(!0),r=o.map(function(i){var a=i.getNamePath(),l=i.getMeta(),s=nn(nn({},l),{},{name:a,value:n.getFieldValue(a)});return Object.defineProperty(s,"originRCField",{value:!0}),s});return r}),Ut(this,"initEntityValue",function(o){var r=o.props.initialValue;if(r!==void 0){var i=o.getNamePath(),a=a3(n.store,i);a===void 0&&n.updateStore(Z2(n.store,i,r))}}),Ut(this,"isMergedPreserve",function(o){var r=o!==void 0?o:n.preserve;return r??!0}),Ut(this,"registerField",function(o){n.fieldEntities.push(o);var r=o.getNamePath();if(n.notifyWatch([r]),o.props.initialValue!==void 0){var i=n.store;n.resetWithFieldInitialValue({entities:[o],skipExist:!0}),n.notifyObservers(i,[o.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(a,l){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(d){return d!==o}),!n.isMergedPreserve(l)&&(!a||s.length>1)){var c=a?void 0:n.getInitialValue(r);if(r.length&&n.getFieldValue(r)!==c&&n.fieldEntities.every(function(d){return!bqe(d.getNamePath(),r)})){var u=n.store;n.updateStore(Z2(u,r,c,!0)),n.notifyObservers(u,[r],{type:"remove"}),n.triggerDependenciesUpdate(u,r)}}n.notifyWatch([r])}}),Ut(this,"dispatch",function(o){switch(o.type){case"updateValue":{var r=o.namePath,i=o.value;n.updateValue(r,i);break}case"validateField":{var a=o.namePath,l=o.triggerName;n.validateFields([a],{triggerName:l});break}}}),Ut(this,"notifyObservers",function(o,r,i){if(n.subscribable){var a=nn(nn({},i),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(l){var s=l.onStoreChange;s(o,r,a)})}else n.forceRootUpdate()}),Ut(this,"triggerDependenciesUpdate",function(o,r){var i=n.getDependencyChildrenFields(r);return i.length&&n.validateFields(i),n.notifyObservers(o,i,{type:"dependenciesUpdate",relatedFields:[r].concat($o(i))}),i}),Ut(this,"updateValue",function(o,r){var i=$u(o),a=n.store;n.updateStore(Z2(n.store,i,r)),n.notifyObservers(a,[i],{type:"valueUpdate",source:"internal"}),n.notifyWatch([i]);var l=n.triggerDependenciesUpdate(a,i),s=n.callbacks.onValuesChange;if(s){var c=bTe(n.store,[i]);s(c,n.getFieldsValue())}n.triggerOnFieldsChange([i].concat($o(l)))}),Ut(this,"setFieldsValue",function(o){n.warningUnhooked();var r=n.store;if(o){var i=XE(n.store,o);n.updateStore(i)}n.notifyObservers(r,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),Ut(this,"setFieldValue",function(o,r){n.setFields([{name:o,value:r,errors:[],warnings:[]}])}),Ut(this,"getDependencyChildrenFields",function(o){var r=new Set,i=[],a=new zP;n.getFieldEntities().forEach(function(s){var c=s.props.dependencies;(c||[]).forEach(function(u){var d=$u(u);a.update(d,function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return f.add(s),f})})});var l=function s(c){var u=a.get(c)||new Set;u.forEach(function(d){if(!r.has(d)){r.add(d);var f=d.getNamePath();d.isFieldDirty()&&f.length&&(i.push(f),s(f))}})};return l(o),i}),Ut(this,"triggerOnFieldsChange",function(o,r){var i=n.callbacks.onFieldsChange;if(i){var a=n.getFields();if(r){var l=new zP;r.forEach(function(c){var u=c.name,d=c.errors;l.set(u,d)}),a.forEach(function(c){c.errors=l.get(c.name)||c.errors})}var s=a.filter(function(c){var u=c.name;return DR(o,u)});s.length&&i(s,a)}}),Ut(this,"validateFields",function(o,r){n.warningUnhooked();var i,a;Array.isArray(o)||typeof o=="string"||typeof r=="string"?(i=o,a=r):a=o;var l=!!i,s=l?i.map($u):[],c=[],u=String(Date.now()),d=new Set,f=a||{},p=f.recursive,m=f.dirty;n.getFieldEntities(!0).forEach(function(C){if(l||s.push(C.getNamePath()),!(!C.props.rules||!C.props.rules.length)&&!(m&&!C.isFieldDirty())){var P=C.getNamePath();if(d.add(P.join(u)),!l||DR(s,P,p)){var A=C.validateRules(nn({validateMessages:nn(nn({},vqe),n.validateMessages)},a));c.push(A.then(function(){return{name:P,errors:[],warnings:[]}}).catch(function(S){var v,b=[],T=[];return(v=S.forEach)===null||v===void 0||v.call(S,function(R){var M=R.rule.warningOnly,D=R.errors;M?T.push.apply(T,$o(D)):b.push.apply(b,$o(D))}),b.length?Promise.reject({name:P,errors:b,warnings:T}):{name:P,errors:b,warnings:T}}))}}});var y=HNt(c);n.lastValidatePromise=y,y.catch(function(C){return C}).then(function(C){var P=C.map(function(A){var S=A.name;return S});n.notifyObservers(n.store,P,{type:"validateFinish"}),n.triggerOnFieldsChange(P,C)});var w=y.then(function(){return n.lastValidatePromise===y?Promise.resolve(n.getFieldsValue(s)):Promise.reject([])}).catch(function(C){var P=C.filter(function(A){return A&&A.errors.length});return Promise.reject({values:n.getFieldsValue(s),errorFields:P,outOfDate:n.lastValidatePromise!==y})});w.catch(function(C){return C});var x=s.filter(function(C){return d.has(C.join(u))});return n.triggerOnFieldsChange(x),w}),Ut(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(o){var r=n.callbacks.onFinish;if(r)try{r(o)}catch(i){console.error(i)}}).catch(function(o){var r=n.callbacks.onFinishFailed;r&&r(o)})}),this.forceRootUpdate=e});function Pqe(t){var e=g.useRef(),n=g.useState({}),o=Sn(n,2),r=o[1];if(!e.current)if(t)e.current=t;else{var i=function(){r({})},a=new INt(i);e.current=a.getForm()}return[e.current]}var che=g.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),zNt=function(e){var n=e.validateMessages,o=e.onFormChange,r=e.onFormFinish,i=e.children,a=g.useContext(che),l=g.useRef({});return g.createElement(che.Provider,{value:nn(nn({},a),{},{validateMessages:nn(nn({},a.validateMessages),n),triggerFormChange:function(c,u){o&&o(c,{changedFields:u,forms:l.current}),a.triggerFormChange(c,u)},triggerFormFinish:function(c,u){r&&r(c,{values:u,forms:l.current}),a.triggerFormFinish(c,u)},registerForm:function(c,u){c&&(l.current=nn(nn({},l.current),{},Ut({},c,u))),a.registerForm(c,u)},unregisterForm:function(c){var u=nn({},l.current);delete u[c],l.current=u,a.unregisterForm(c)}})},i)},DNt=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"],ENt=function(e,n){var o=e.name,r=e.initialValues,i=e.fields,a=e.form,l=e.preserve,s=e.children,c=e.component,u=c===void 0?"form":c,d=e.validateMessages,f=e.validateTrigger,p=f===void 0?"onChange":f,m=e.onValuesChange,y=e.onFieldsChange,w=e.onFinish,x=e.onFinishFailed,C=e.clearOnDestroy,P=Ai(e,DNt),A=g.useRef(null),S=g.useContext(che),v=Pqe(a),b=Sn(v,1),T=b[0],R=T.getInternalHooks(Uv),M=R.useSubscribe,D=R.setInitialValues,k=R.setCallbacks,N=R.setValidateMessages,U=R.setPreserve,W=R.destroyForm;g.useImperativeHandle(n,function(){return nn(nn({},T),{},{nativeElement:A.current})}),g.useEffect(function(){return S.registerForm(o,T),function(){S.unregisterForm(o)}},[S,T,o]),N(nn(nn({},S.validateMessages),d)),k({onValuesChange:m,onFieldsChange:function(Q){if(S.triggerFormChange(o,Q),y){for(var oe=arguments.length,ee=new Array(oe>1?oe-1:0),q=1;q{let{children:e,status:n,override:o}=t;const r=g.useContext(W1),i=g.useMemo(()=>{const a=Object.assign({},r);return o&&delete a.isFormItemInput,n&&(delete a.status,delete a.hasFeedback,delete a.feedbackIcon),a},[n,o,r]);return g.createElement(W1.Provider,{value:i},e)},WNt=g.createContext(void 0),E3=t=>{const{space:e,form:n,children:o}=t;if(o==null)return null;let r=o;return n&&(r=xe.createElement(LNt,{override:!0,status:!0},r)),e&&(r=xe.createElement(PFt,null,r)),r};function SH(t){if(t)return{closable:t.closable,closeIcon:t.closeIcon}}function PTe(t){const{closable:e,closeIcon:n}=t||{};return xe.useMemo(()=>{if(!e&&(e===!1||n===!1||n===null))return!1;if(e===void 0&&n===void 0)return null;let o={closeIcon:typeof n!="boolean"&&n!==null?n:void 0};return e&&typeof e=="object"&&(o=Object.assign(Object.assign({},o),e)),o},[e,n])}function CTe(){const t={};for(var e=arguments.length,n=new Array(e),o=0;o{r&&Object.keys(r).forEach(i=>{r[i]!==void 0&&(t[i]=r[i])})}),t}const NNt={};function u9e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NNt;const o=PTe(t),r=PTe(e),i=typeof o!="boolean"?!!(o!=null&&o.disabled):!1,a=xe.useMemo(()=>Object.assign({closeIcon:xe.createElement(i6,null)},n),[n]),l=xe.useMemo(()=>o===!1?!1:o?CTe(a,r,o):r===!1?!1:r?CTe(a,r):a.closable?a:!1,[o,r,a]);return xe.useMemo(()=>{if(l===!1)return[!1,null,i];const{closeIconRender:s}=a,{closeIcon:c}=l;let u=c;if(u!=null){s&&(u=s(c));const d=$5e(l,!0);Object.keys(d).length&&(u=xe.isValidElement(u)?xe.cloneElement(u,d):xe.createElement("span",Object.assign({},d),u))}return[!0,u,i]},[l,a])}var UNt=function(e){if(D7()&&window.document.documentElement){var n=Array.isArray(e)?e:[e],o=window.document.documentElement;return n.some(function(r){return r in o.style})}return!1};function RTe(t,e){return UNt(t)}const jNt=()=>D7()&&window.document.documentElement,TZ=t=>{const{prefixCls:e,className:n,style:o,size:r,shape:i}=t,a=Mn({[`${e}-lg`]:r==="large",[`${e}-sm`]:r==="small"}),l=Mn({[`${e}-circle`]:i==="circle",[`${e}-square`]:i==="square",[`${e}-round`]:i==="round"}),s=g.useMemo(()=>typeof r=="number"?{width:r,height:r,lineHeight:`${r}px`}:{},[r]);return g.createElement("span",{className:Mn(e,a,l,n),style:Object.assign(Object.assign({},s),o)})},BNt=new xa("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),PZ=t=>({height:t,lineHeight:jt(t)}),ER=t=>Object.assign({width:t},PZ(t)),YNt=t=>({background:t.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:BNt,animationDuration:t.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),Wle=(t,e)=>Object.assign({width:e(t).mul(5).equal(),minWidth:e(t).mul(5).equal()},PZ(t)),ONt=t=>{const{skeletonAvatarCls:e,gradientFromColor:n,controlHeight:o,controlHeightLG:r,controlHeightSM:i}=t;return{[e]:Object.assign({display:"inline-block",verticalAlign:"top",background:n},ER(o)),[`${e}${e}-circle`]:{borderRadius:"50%"},[`${e}${e}-lg`]:Object.assign({},ER(r)),[`${e}${e}-sm`]:Object.assign({},ER(i))}},_Nt=t=>{const{controlHeight:e,borderRadiusSM:n,skeletonInputCls:o,controlHeightLG:r,controlHeightSM:i,gradientFromColor:a,calc:l}=t;return{[o]:Object.assign({display:"inline-block",verticalAlign:"top",background:a,borderRadius:n},Wle(e,l)),[`${o}-lg`]:Object.assign({},Wle(r,l)),[`${o}-sm`]:Object.assign({},Wle(i,l))}},HTe=t=>Object.assign({width:t},PZ(t)),VNt=t=>{const{skeletonImageCls:e,imageSizeBase:n,gradientFromColor:o,borderRadiusSM:r,calc:i}=t;return{[e]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:o,borderRadius:r},HTe(i(n).mul(2).equal())),{[`${e}-path`]:{fill:"#bfbfbf"},[`${e}-svg`]:Object.assign(Object.assign({},HTe(n)),{maxWidth:i(n).mul(4).equal(),maxHeight:i(n).mul(4).equal()}),[`${e}-svg${e}-svg-circle`]:{borderRadius:"50%"}}),[`${e}${e}-circle`]:{borderRadius:"50%"}}},Nle=(t,e,n)=>{const{skeletonButtonCls:o}=t;return{[`${n}${o}-circle`]:{width:e,minWidth:e,borderRadius:"50%"},[`${n}${o}-round`]:{borderRadius:e}}},Ule=(t,e)=>Object.assign({width:e(t).mul(2).equal(),minWidth:e(t).mul(2).equal()},PZ(t)),GNt=t=>{const{borderRadiusSM:e,skeletonButtonCls:n,controlHeight:o,controlHeightLG:r,controlHeightSM:i,gradientFromColor:a,calc:l}=t;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:a,borderRadius:e,width:l(o).mul(2).equal(),minWidth:l(o).mul(2).equal()},Ule(o,l))},Nle(t,o,n)),{[`${n}-lg`]:Object.assign({},Ule(r,l))}),Nle(t,r,`${n}-lg`)),{[`${n}-sm`]:Object.assign({},Ule(i,l))}),Nle(t,i,`${n}-sm`))},XNt=t=>{const{componentCls:e,skeletonAvatarCls:n,skeletonTitleCls:o,skeletonParagraphCls:r,skeletonButtonCls:i,skeletonInputCls:a,skeletonImageCls:l,controlHeight:s,controlHeightLG:c,controlHeightSM:u,gradientFromColor:d,padding:f,marginSM:p,borderRadius:m,titleHeight:y,blockRadius:w,paragraphLiHeight:x,controlHeightXS:C,paragraphMarginTop:P}=t;return{[e]:{display:"table",width:"100%",[`${e}-header`]:{display:"table-cell",paddingInlineEnd:f,verticalAlign:"top",[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:d},ER(s)),[`${n}-circle`]:{borderRadius:"50%"},[`${n}-lg`]:Object.assign({},ER(c)),[`${n}-sm`]:Object.assign({},ER(u))},[`${e}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[o]:{width:"100%",height:y,background:d,borderRadius:w,[`+ ${r}`]:{marginBlockStart:u}},[r]:{padding:0,"> li":{width:"100%",height:x,listStyle:"none",background:d,borderRadius:w,"+ li":{marginBlockStart:C}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${e}-content`]:{[`${o}, ${r} > li`]:{borderRadius:m}}},[`${e}-with-avatar ${e}-content`]:{[o]:{marginBlockStart:p,[`+ ${r}`]:{marginBlockStart:P}}},[`${e}${e}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},GNt(t)),ONt(t)),_Nt(t)),VNt(t)),[`${e}${e}-block`]:{width:"100%",[i]:{width:"100%"},[a]:{width:"100%"}},[`${e}${e}-active`]:{[` +}`),r)}else OX(r);return function(){OX(r)}},[e,r])}var TWt=!1;function PWt(t){return TWt}var sTe=function(e){return e===!1?!1:!mm()||!e?null:typeof e=="string"?document.querySelector(e):typeof e=="function"?e():e},uU=g.forwardRef(function(t,e){var n=t.open,o=t.autoLock,r=t.getContainer;t.debug;var i=t.autoDestroy,a=i===void 0?!0:i,l=t.children,s=g.useState(n),c=Sn(s,2),u=c[0],d=c[1],f=u||n;g.useEffect(function(){(a||n)&&d(n)},[n,a]);var p=g.useState(function(){return sTe(r)}),m=Sn(p,2),y=m[0],w=m[1];g.useEffect(function(){var D=sTe(r);w(D??null)});var x=AWt(f&&!y),C=Sn(x,2),P=C[0],A=C[1],S=y??P;SWt(o&&n&&mm()&&(S===P||S===document.body));var v=null;if(l&&Z8(l)&&e){var b=l;v=b.ref}var T=E7(v,e);if(!f||!mm()||y===void 0)return null;var R=S===!1||PWt(),M=l;return e&&(M=g.cloneElement(l,{ref:T})),g.createElement(fqe.Provider,{value:A},R?M:r0.createPortal(M,S))}),hqe=g.createContext({});function CWt(){var t=nn({},xN);return t.useId}var cTe=0,uTe=CWt();const pqe=uTe?function(e){var n=uTe();return e||n}:function(e){var n=g.useState("ssr-id"),o=Sn(n,2),r=o[0],i=o[1];return g.useEffect(function(){var a=cTe;cTe+=1,i("rc_unique_".concat(a))},[]),e||r};function dTe(t,e,n){var o=e;return!o&&n&&(o="".concat(t,"-").concat(n)),o}function fTe(t,e){var n=t["page".concat(e?"Y":"X","Offset")],o="scroll".concat(e?"Top":"Left");if(typeof n!="number"){var r=t.document;n=r.documentElement[o],typeof n!="number"&&(n=r.body[o])}return n}function RWt(t){var e=t.getBoundingClientRect(),n={left:e.left,top:e.top},o=t.ownerDocument,r=o.defaultView||o.parentWindow;return n.left+=fTe(r),n.top+=fTe(r,!0),n}const HWt=g.memo(function(t){var e=t.children;return e},function(t,e){var n=e.shouldUpdate;return!n});var MWt={width:0,height:0,overflow:"hidden",outline:"none"},IWt={outline:"none"},gqe=xe.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.title,a=t.ariaId,l=t.footer,s=t.closable,c=t.closeIcon,u=t.onClose,d=t.children,f=t.bodyStyle,p=t.bodyProps,m=t.modalRender,y=t.onMouseDown,w=t.onMouseUp,x=t.holderRef,C=t.visible,P=t.forceRender,A=t.width,S=t.height,v=t.classNames,b=t.styles,T=xe.useContext(hqe),R=T.panel,M=E7(x,R),D=g.useRef(),k=g.useRef();xe.useImperativeHandle(e,function(){return{focus:function(){var _;(_=D.current)===null||_===void 0||_.focus({preventScroll:!0})},changeActive:function(_){var G=document,Q=G.activeElement;_&&Q===k.current?D.current.focus({preventScroll:!0}):!_&&Q===D.current&&k.current.focus({preventScroll:!0})}}});var N={};A!==void 0&&(N.width=A),S!==void 0&&(N.height=S);var U=l?xe.createElement("div",{className:Bn("".concat(n,"-footer"),v==null?void 0:v.footer),style:nn({},b==null?void 0:b.footer)},l):null,W=i?xe.createElement("div",{className:Bn("".concat(n,"-header"),v==null?void 0:v.header),style:nn({},b==null?void 0:b.header)},xe.createElement("div",{className:"".concat(n,"-title"),id:a},i)):null,F=g.useMemo(function(){return Vr(s)==="object"&&s!==null?s:s?{closeIcon:c??xe.createElement("span",{className:"".concat(n,"-close-x")})}:{}},[s,c,n]),E=F1(F,!0),L=Vr(s)==="object"&&s.disabled,j=s?xe.createElement("button",Uo({type:"button",onClick:u,"aria-label":"Close"},E,{className:"".concat(n,"-close"),disabled:L}),F.closeIcon):null,Y=xe.createElement("div",{className:Bn("".concat(n,"-content"),v==null?void 0:v.content),style:b==null?void 0:b.content},j,W,xe.createElement("div",Uo({className:Bn("".concat(n,"-body"),v==null?void 0:v.body),style:nn(nn({},f),b==null?void 0:b.body)},p),d),U);return xe.createElement("div",{key:"dialog-element",role:"dialog","aria-labelledby":i?a:null,"aria-modal":"true",ref:M,style:nn(nn({},r),N),className:Bn(n,o),onMouseDown:y,onMouseUp:w},xe.createElement("div",{ref:D,tabIndex:0,style:IWt},xe.createElement(HWt,{shouldUpdate:C||P},m?m(Y):Y)),xe.createElement("div",{tabIndex:0,ref:k,style:MWt}))}),mqe=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.title,r=t.style,i=t.className,a=t.visible,l=t.forceRender,s=t.destroyOnClose,c=t.motionName,u=t.ariaId,d=t.onVisibleChanged,f=t.mousePosition,p=g.useRef(),m=g.useState(),y=Sn(m,2),w=y[0],x=y[1],C={};w&&(C.transformOrigin=w);function P(){var A=RWt(p.current);x(f&&(f.x||f.y)?"".concat(f.x-A.left,"px ").concat(f.y-A.top,"px"):"")}return g.createElement(Oy,{visible:a,onVisibleChanged:d,onAppearPrepare:P,onEnterPrepare:P,forceRender:l,motionName:c,removeOnLeave:s,ref:p},function(A,S){var v=A.className,b=A.style;return g.createElement(gqe,Uo({},t,{ref:e,title:o,ariaId:u,prefixCls:n,holderRef:S,style:nn(nn(nn({},b),r),C),className:Bn(i,v)}))})});mqe.displayName="Content";var zWt=function(e){var n=e.prefixCls,o=e.style,r=e.visible,i=e.maskProps,a=e.motionName,l=e.className;return g.createElement(Oy,{key:"mask",visible:r,motionName:a,leavedClassName:"".concat(n,"-mask-hidden")},function(s,c){var u=s.className,d=s.style;return g.createElement("div",Uo({ref:c,style:nn(nn({},d),o),className:Bn("".concat(n,"-mask"),u,l)},i))})},DWt=function(e){var n=e.prefixCls,o=n===void 0?"rc-dialog":n,r=e.zIndex,i=e.visible,a=i===void 0?!1:i,l=e.keyboard,s=l===void 0?!0:l,c=e.focusTriggerAfterClose,u=c===void 0?!0:c,d=e.wrapStyle,f=e.wrapClassName,p=e.wrapProps,m=e.onClose,y=e.afterOpenChange,w=e.afterClose,x=e.transitionName,C=e.animation,P=e.closable,A=P===void 0?!0:P,S=e.mask,v=S===void 0?!0:S,b=e.maskTransitionName,T=e.maskAnimation,R=e.maskClosable,M=R===void 0?!0:R,D=e.maskStyle,k=e.maskProps,N=e.rootClassName,U=e.classNames,W=e.styles,F=g.useRef(),E=g.useRef(),L=g.useRef(),j=g.useState(a),Y=Sn(j,2),O=Y[0],_=Y[1],G=pqe();function Q(){tfe(E.current,document.activeElement)||(F.current=document.activeElement)}function oe(){if(!tfe(E.current,document.activeElement)){var he;(he=L.current)===null||he===void 0||he.focus()}}function ee(he){if(he)oe();else{if(_(!1),v&&F.current&&u){try{F.current.focus({preventScroll:!0})}catch{}F.current=null}O&&(w==null||w())}y==null||y(he)}function $(he){m==null||m(he)}var ae=g.useRef(!1),Z=g.useRef(),ne=function(){clearTimeout(Z.current),ae.current=!0},te=function(){Z.current=setTimeout(function(){ae.current=!1})},q=null;M&&(q=function(me){ae.current?ae.current=!1:E.current===me.target&&$(me)});function le(he){if(s&&he.keyCode===Lo.ESC){he.stopPropagation(),$(he);return}a&&he.keyCode===Lo.TAB&&L.current.changeActive(!he.shiftKey)}g.useEffect(function(){a&&(_(!0),Q())},[a]),g.useEffect(function(){return function(){clearTimeout(Z.current)}},[]);var de=nn(nn(nn({zIndex:r},d),W==null?void 0:W.wrapper),{},{display:O?null:"none"});return g.createElement("div",Uo({className:Bn("".concat(o,"-root"),N)},F1(e,{data:!0})),g.createElement(zWt,{prefixCls:o,visible:v&&a,motionName:dTe(o,b,T),style:nn(nn({zIndex:r},D),W==null?void 0:W.mask),maskProps:k,className:U==null?void 0:U.mask}),g.createElement("div",Uo({tabIndex:-1,onKeyDown:le,className:Bn("".concat(o,"-wrap"),f,U==null?void 0:U.wrapper),ref:E,onClick:q,style:de},p),g.createElement(mqe,Uo({},e,{onMouseDown:ne,onMouseUp:te,ref:L,closable:A,ariaId:G,prefixCls:o,visible:a&&O,onClose:$,onVisibleChanged:ee,motionName:dTe(o,x,C)}))))},l9e=function(e){var n=e.visible,o=e.getContainer,r=e.forceRender,i=e.destroyOnClose,a=i===void 0?!1:i,l=e.afterClose,s=e.panelRef,c=g.useState(n),u=Sn(c,2),d=u[0],f=u[1],p=g.useMemo(function(){return{panel:s}},[s]);return g.useEffect(function(){n&&f(!0)},[n]),!r&&a&&!d?null:g.createElement(hqe.Provider,{value:p},g.createElement(uU,{open:n||r||d,autoDestroy:!1,getContainer:o,autoLock:n||d},g.createElement(DWt,Uo({},e,{destroyOnClose:a,afterClose:function(){l==null||l(),f(!1)}}))))};l9e.displayName="Dialog";function D5(){D5=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(F,E,L){F[E]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(F,E,L){return Object.defineProperty(F,E,{value:L,enumerable:!0,configurable:!0,writable:!0}),F[E]}try{c({},"")}catch{c=function(L,j,Y){return L[j]=Y}}function u(F,E,L,j){var Y=E&&E.prototype instanceof x?E:x,O=Object.create(Y.prototype),_=new U(j||[]);return r(O,"_invoke",{value:M(F,L,_)}),O}function d(F,E,L){try{return{type:"normal",arg:F.call(E,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",m="executing",y="completed",w={};function x(){}function C(){}function P(){}var A={};c(A,a,function(){return this});var S=Object.getPrototypeOf,v=S&&S(S(W([])));v&&v!==n&&o.call(v,a)&&(A=v);var b=P.prototype=x.prototype=Object.create(A);function T(F){["next","throw","return"].forEach(function(E){c(F,E,function(L){return this._invoke(E,L)})})}function R(F,E){function L(Y,O,_,G){var Q=d(F[Y],F,O);if(Q.type!=="throw"){var oe=Q.arg,ee=oe.value;return ee&&Vr(ee)=="object"&&o.call(ee,"__await")?E.resolve(ee.__await).then(function($){L("next",$,_,G)},function($){L("throw",$,_,G)}):E.resolve(ee).then(function($){oe.value=$,_(oe)},function($){return L("throw",$,_,G)})}G(Q.arg)}var j;r(this,"_invoke",{value:function(O,_){function G(){return new E(function(Q,oe){L(O,_,Q,oe)})}return j=j?j.then(G,G):G()}})}function M(F,E,L){var j=f;return function(Y,O){if(j===m)throw new Error("Generator is already running");if(j===y){if(Y==="throw")throw O;return{value:t,done:!0}}for(L.method=Y,L.arg=O;;){var _=L.delegate;if(_){var G=D(_,L);if(G){if(G===w)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=y,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=m;var Q=d(F,E,L);if(Q.type==="normal"){if(j=L.done?y:p,Q.arg===w)continue;return{value:Q.arg,done:L.done}}Q.type==="throw"&&(j=y,L.method="throw",L.arg=Q.arg)}}}function D(F,E){var L=E.method,j=F.iterator[L];if(j===t)return E.delegate=null,L==="throw"&&F.iterator.return&&(E.method="return",E.arg=t,D(F,E),E.method==="throw")||L!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+L+"' method")),w;var Y=d(j,F.iterator,E.arg);if(Y.type==="throw")return E.method="throw",E.arg=Y.arg,E.delegate=null,w;var O=Y.arg;return O?O.done?(E[F.resultName]=O.value,E.next=F.nextLoc,E.method!=="return"&&(E.method="next",E.arg=t),E.delegate=null,w):O:(E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,w)}function k(F){var E={tryLoc:F[0]};1 in F&&(E.catchLoc=F[1]),2 in F&&(E.finallyLoc=F[2],E.afterLoc=F[3]),this.tryEntries.push(E)}function N(F){var E=F.completion||{};E.type="normal",delete E.arg,F.completion=E}function U(F){this.tryEntries=[{tryLoc:"root"}],F.forEach(k,this),this.reset(!0)}function W(F){if(F||F===""){var E=F[a];if(E)return E.call(F);if(typeof F.next=="function")return F;if(!isNaN(F.length)){var L=-1,j=function Y(){for(;++L=0;--Y){var O=this.tryEntries[Y],_=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),Q=o.call(O,"finallyLoc");if(G&&Q){if(this.prev=0;--j){var Y=this.tryEntries[j];if(Y.tryLoc<=this.prev&&o.call(Y,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===E)return this.complete(j.completion,j.afterLoc),N(j),w}},catch:function(E){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===E){var Y=j.completion;if(Y.type==="throw"){var O=Y.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(E,L,j){return this.delegate={iterator:W(E),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),w}},e}function hTe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function dU(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){hTe(i,o,r,a,l,"next",s)}function l(s){hTe(i,o,r,a,l,"throw",s)}a(void 0)})}}var Uv="RC_FORM_INTERNAL_HOOKS",Hs=function(){Ds(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},bH=g.createContext({getFieldValue:Hs,getFieldsValue:Hs,getFieldError:Hs,getFieldWarning:Hs,getFieldsError:Hs,isFieldsTouched:Hs,isFieldTouched:Hs,isFieldValidating:Hs,isFieldsValidating:Hs,resetFields:Hs,setFields:Hs,setFieldValue:Hs,setFieldsValue:Hs,validateFields:Hs,submit:Hs,getInternalHooks:function(){return Hs(),{dispatch:Hs,initEntityValue:Hs,registerField:Hs,useSubscribe:Hs,setInitialValues:Hs,destroyForm:Hs,setCallbacks:Hs,registerWatch:Hs,getFields:Hs,setValidateMessages:Hs,setPreserve:Hs,getInitialValue:Hs}}}),oJ=g.createContext(null);function Qfe(t){return t==null?[]:Array.isArray(t)?t:[t]}function EWt(t){return t&&!!t._init}function zp(t){"@babel/helpers - typeof";return zp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zp(t)}function kWt(t,e){if(zp(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(zp(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yqe(t){var e=kWt(t,"string");return zp(e)=="symbol"?e:e+""}function QA(t,e,n){return e=yqe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pTe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function jw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n1?e-1:0),o=1;o=i)return l;switch(l){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}break;default:return l}});return a}return t}function XWt(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function C0(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||XWt(e)&&typeof t=="string"&&!t)}function JWt(t,e,n){var o=[],r=0,i=t.length;function a(l){o.push.apply(o,oR(l||[])),r++,r===i&&n(o)}t.forEach(function(l){e(l,a)})}function gTe(t,e,n){var o=0,r=t.length;function i(a){if(a&&a.length){n(a);return}var l=o;o=o+1,le.max?r.push(om(i.messages[d].max,e.fullField,e.max)):l&&s&&(ue.max)&&r.push(om(i.messages[d].range,e.fullField,e.min,e.max))},xqe=function(e,n,o,r,i,a){e.required&&(!o.hasOwnProperty(e.field)||C0(n,a||e.type))&&r.push(om(i.messages.required,e.fullField))},OO;const nNt=function(){if(OO)return OO;var t="[a-fA-F\\d:]",e=function(v){return v&&v.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",o="[a-fA-F\\d]{1,4}",r=["(?:".concat(o,":){7}(?:").concat(o,"|:)"),"(?:".concat(o,":){6}(?:").concat(n,"|:").concat(o,"|:)"),"(?:".concat(o,":){5}(?::").concat(n,"|(?::").concat(o,"){1,2}|:)"),"(?:".concat(o,":){4}(?:(?::").concat(o,"){0,1}:").concat(n,"|(?::").concat(o,"){1,3}|:)"),"(?:".concat(o,":){3}(?:(?::").concat(o,"){0,2}:").concat(n,"|(?::").concat(o,"){1,4}|:)"),"(?:".concat(o,":){2}(?:(?::").concat(o,"){0,3}:").concat(n,"|(?::").concat(o,"){1,5}|:)"),"(?:".concat(o,":){1}(?:(?::").concat(o,"){0,4}:").concat(n,"|(?::").concat(o,"){1,6}|:)"),"(?::(?:(?::".concat(o,"){0,5}:").concat(n,"|(?::").concat(o,"){1,7}|:))")],i="(?:%[0-9a-zA-Z]{1,})?",a="(?:".concat(r.join("|"),")").concat(i),l=new RegExp("(?:^".concat(n,"$)|(?:^").concat(a,"$)")),s=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(a,"$")),u=function(v){return v&&v.exact?l:new RegExp("(?:".concat(e(v)).concat(n).concat(e(v),")|(?:").concat(e(v)).concat(a).concat(e(v),")"),"g")};u.v4=function(S){return S&&S.exact?s:new RegExp("".concat(e(S)).concat(n).concat(e(S)),"g")},u.v6=function(S){return S&&S.exact?c:new RegExp("".concat(e(S)).concat(a).concat(e(S)),"g")};var d="(?:(?:[a-z]+:)?//)",f="(?:\\S+(?::\\S*)?@)?",p=u.v4().source,m=u.v6().source,y="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",w="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",x="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",C="(?::\\d{2,5})?",P='(?:[/?#][^\\s"]*)?',A="(?:".concat(d,"|www\\.)").concat(f,"(?:localhost|").concat(p,"|").concat(m,"|").concat(y).concat(w).concat(x,")").concat(C).concat(P);return OO=new RegExp("(?:^".concat(A,"$)"),"i"),OO};var wTe={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},JE={integer:function(e){return JE.number(e)&&parseInt(e,10)===e},float:function(e){return JE.number(e)&&!JE.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return zp(e)==="object"&&!JE.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(wTe.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(nNt())},hex:function(e){return typeof e=="string"&&!!e.match(wTe.hex)}},oNt=function(e,n,o,r,i){if(e.required&&n===void 0){xqe(e,n,o,r,i);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],l=e.type;a.indexOf(l)>-1?JE[l](n)||r.push(om(i.messages.types[l],e.fullField,e.type)):l&&zp(n)!==e.type&&r.push(om(i.messages.types[l],e.fullField,e.type))},rNt=function(e,n,o,r,i){(/^\s+$/.test(n)||n==="")&&r.push(om(i.messages.whitespace,e.fullField))};const cl={required:xqe,whitespace:rNt,type:oNt,range:tNt,enum:ZWt,pattern:eNt};var iNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i)}o(a)},aNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(n==null&&!e.required)return o();cl.required(e,n,r,a,i,"array"),n!=null&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},lNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl.type(e,n,r,a,i)}o(a)},sNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n,"date")&&!e.required)return o();if(cl.required(e,n,r,a,i),!C0(n,"date")){var s;n instanceof Date?s=n:s=new Date(n),cl.type(e,s,r,a,i),s&&cl.range(e,s.getTime(),r,a,i)}}o(a)},cNt="enum",uNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl[cNt](e,n,r,a,i)}o(a)},dNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},fNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},hNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl.type(e,n,r,a,i)}o(a)},pNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(n===""&&(n=void 0),C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i))}o(a)},gNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),n!==void 0&&cl.type(e,n,r,a,i)}o(a)},mNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n,"string")&&!e.required)return o();cl.required(e,n,r,a,i),C0(n,"string")||cl.pattern(e,n,r,a,i)}o(a)},yNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n)&&!e.required)return o();cl.required(e,n,r,a,i),C0(n)||cl.type(e,n,r,a,i)}o(a)},ANt=function(e,n,o,r,i){var a=[],l=Array.isArray(n)?"array":zp(n);cl.required(e,n,r,a,i,l),o(a)},wNt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(C0(n,"string")&&!e.required)return o();cl.required(e,n,r,a,i,"string"),C0(n,"string")||(cl.type(e,n,r,a,i),cl.range(e,n,r,a,i),cl.pattern(e,n,r,a,i),e.whitespace===!0&&cl.whitespace(e,n,r,a,i))}o(a)},kle=function(e,n,o,r,i){var a=e.type,l=[],s=e.required||!e.required&&r.hasOwnProperty(e.field);if(s){if(C0(n,a)&&!e.required)return o();cl.required(e,n,r,l,i,a),C0(n,a)||cl.type(e,n,r,l,i)}o(l)};const Bk={string:wNt,method:hNt,number:pNt,boolean:lNt,regexp:yNt,integer:fNt,float:dNt,array:aNt,object:gNt,enum:uNt,pattern:mNt,date:sNt,url:kle,hex:kle,email:kle,required:ANt,any:iNt};var fU=function(){function t(e){Aqe(this,t),QA(this,"rules",null),QA(this,"_messages",the),this.define(e)}return wqe(t,[{key:"define",value:function(n){var o=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(zp(n)!=="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(r){var i=n[r];o.rules[r]=Array.isArray(i)?i:[i]})}},{key:"messages",value:function(n){return n&&(this._messages=ATe(ehe(),n)),this._messages}},{key:"validate",value:function(n){var o=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},a=n,l=r,s=i;if(typeof l=="function"&&(s=l,l={}),!this.rules||Object.keys(this.rules).length===0)return s&&s(null,a),Promise.resolve(a);function c(m){var y=[],w={};function x(P){if(Array.isArray(P)){var A;y=(A=y).concat.apply(A,oR(P))}else y.push(P)}for(var C=0;C0&&arguments[0]!==void 0?arguments[0]:[],T=Array.isArray(b)?b:[b];!l.suppressWarning&&T.length&&t.warning("async-validator:",T),T.length&&w.message!==void 0&&(T=[].concat(w.message));var R=T.map(yTe(w,a));if(l.first&&R.length)return p[w.field]=1,y(R);if(!x)y(R);else{if(w.required&&!m.value)return w.message!==void 0?R=[].concat(w.message).map(yTe(w,a)):l.error&&(R=[l.error(w,om(l.messages.required,w.field))]),y(R);var M={};w.defaultField&&Object.keys(m.value).map(function(N){M[N]=w.defaultField}),M=jw(jw({},M),m.rule.fields);var D={};Object.keys(M).forEach(function(N){var U=M[N],W=Array.isArray(U)?U:[U];D[N]=W.map(C.bind(null,N))});var k=new t(D);k.messages(l.messages),m.rule.options&&(m.rule.options.messages=l.messages,m.rule.options.error=l.error),k.validate(m.value,m.rule.options||l,function(N){var U=[];R&&R.length&&U.push.apply(U,oR(R)),N&&N.length&&U.push.apply(U,oR(N)),y(U.length?U:null)})}}var A;if(w.asyncValidator)A=w.asyncValidator(w,m.value,P,m.source,l);else if(w.validator){try{A=w.validator(w,m.value,P,m.source,l)}catch(b){var S,v;(S=(v=console).error)===null||S===void 0||S.call(v,b),l.suppressValidatorError||setTimeout(function(){throw b},0),P(b.message)}A===!0?P():A===!1?P(typeof w.message=="function"?w.message(w.fullField||w.field):w.message||"".concat(w.fullField||w.field," fails")):A instanceof Array?P(A):A instanceof Error&&P(A.message)}A&&A.then&&A.then(function(){return P()},function(b){return P(b)})},function(m){c(m)},a)}},{key:"getType",value:function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!Bk.hasOwnProperty(n.type))throw new Error(om("Unknown rule type %s",n.type));return n.type||"string"}},{key:"getValidationMethod",value:function(n){if(typeof n.validator=="function")return n.validator;var o=Object.keys(n),r=o.indexOf("message");return r!==-1&&o.splice(r,1),o.length===1&&o[0]==="required"?Bk.required:Bk[this.getType(n)]||void 0}}]),t}();QA(fU,"register",function(e,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");Bk[e]=n});QA(fU,"warning",GWt);QA(fU,"messages",the);QA(fU,"validators",Bk);var Tg="'${name}' is not a valid ${type}",vqe={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:Tg,method:Tg,array:Tg,object:Tg,number:Tg,date:Tg,boolean:Tg,integer:Tg,float:Tg,regexp:Tg,email:Tg,url:Tg,hex:Tg},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}},xTe=fU;function xNt(t,e){return t.replace(/\\?\$\{\w+\}/g,function(n){if(n.startsWith("\\"))return n.slice(1);var o=n.slice(2,-1);return e[o]})}var vTe="CODE_LOGIC_ERROR";function ihe(t,e,n,o,r){return ahe.apply(this,arguments)}function ahe(){return ahe=dU(D5().mark(function t(e,n,o,r,i){var a,l,s,c,u,d,f,p,m;return D5().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return a=nn({},o),delete a.ruleIndex,xTe.warning=function(){},a.validator&&(l=a.validator,a.validator=function(){try{return l.apply(void 0,arguments)}catch(x){return console.error(x),Promise.reject(vTe)}}),s=null,a&&a.type==="array"&&a.defaultField&&(s=a.defaultField,delete a.defaultField),c=new xTe(Ut({},e,[a])),u=XE(vqe,r.validateMessages),c.messages(u),d=[],w.prev=10,w.next=13,Promise.resolve(c.validate(Ut({},e,n),nn({},r)));case 13:w.next=18;break;case 15:w.prev=15,w.t0=w.catch(10),w.t0.errors&&(d=w.t0.errors.map(function(x,C){var P=x.message,A=P===vTe?u.default:P;return g.isValidElement(A)?g.cloneElement(A,{key:"error_".concat(C)}):A}));case 18:if(!(!d.length&&s)){w.next=23;break}return w.next=21,Promise.all(n.map(function(x,C){return ihe("".concat(e,".").concat(C),x,s,r,i)}));case 21:return f=w.sent,w.abrupt("return",f.reduce(function(x,C){return[].concat($o(x),$o(C))},[]));case 23:return p=nn(nn({},o),{},{name:e,enum:(o.enum||[]).join(", ")},i),m=d.map(function(x){return typeof x=="string"?xNt(x,p):x}),w.abrupt("return",m);case 26:case"end":return w.stop()}},t,null,[[10,15]])})),ahe.apply(this,arguments)}function vNt(t,e,n,o,r,i){var a=t.join("."),l=n.map(function(u,d){var f=u.validator,p=nn(nn({},u),{},{ruleIndex:d});return f&&(p.validator=function(m,y,w){var x=!1,C=function(){for(var S=arguments.length,v=new Array(S),b=0;b2&&arguments[2]!==void 0?arguments[2]:!1;return t&&t.some(function(o){return bqe(e,o,n)})}function bqe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!t||!e||!n&&t.length!==e.length?!1:e.every(function(o,r){return t[r]===o})}function TNt(t,e){if(t===e)return!0;if(!t&&e||t&&!e||!t||!e||Vr(t)!=="object"||Vr(e)!=="object")return!1;var n=Object.keys(t),o=Object.keys(e),r=new Set([].concat(n,o));return $o(r).every(function(i){var a=t[i],l=e[i];return typeof a=="function"&&typeof l=="function"?!0:a===l})}function PNt(t){var e=arguments.length<=1?void 0:arguments[1];return e&&e.target&&Vr(e.target)==="object"&&t in e.target?e.target[t]:e}function STe(t,e,n){var o=t.length;if(e<0||e>=o||n<0||n>=o)return t;var r=t[e],i=e-n;return i>0?[].concat($o(t.slice(0,n)),[r],$o(t.slice(n,e)),$o(t.slice(e+1,o))):i<0?[].concat($o(t.slice(0,e)),$o(t.slice(e+1,n+1)),[r],$o(t.slice(n+1,o))):t}var CNt=["name"],Zm=[];function Fle(t,e,n,o,r,i){return typeof t=="function"?t(e,n,"source"in i?{source:i.source}:{}):o!==r}var c9e=function(t){XM(n,t);var e=JM(n);function n(o){var r;if(Uh(this,n),r=e.call(this,o),Ut(kr(r),"state",{resetCount:0}),Ut(kr(r),"cancelRegisterFunc",null),Ut(kr(r),"mounted",!1),Ut(kr(r),"touched",!1),Ut(kr(r),"dirty",!1),Ut(kr(r),"validatePromise",void 0),Ut(kr(r),"prevValidating",void 0),Ut(kr(r),"errors",Zm),Ut(kr(r),"warnings",Zm),Ut(kr(r),"cancelRegister",function(){var s=r.props,c=s.preserve,u=s.isListField,d=s.name;r.cancelRegisterFunc&&r.cancelRegisterFunc(u,c,$u(d)),r.cancelRegisterFunc=null}),Ut(kr(r),"getNamePath",function(){var s=r.props,c=s.name,u=s.fieldContext,d=u.prefixName,f=d===void 0?[]:d;return c!==void 0?[].concat($o(f),$o(c)):[]}),Ut(kr(r),"getRules",function(){var s=r.props,c=s.rules,u=c===void 0?[]:c,d=s.fieldContext;return u.map(function(f){return typeof f=="function"?f(d):f})}),Ut(kr(r),"refresh",function(){r.mounted&&r.setState(function(s){var c=s.resetCount;return{resetCount:c+1}})}),Ut(kr(r),"metaCache",null),Ut(kr(r),"triggerMetaEvent",function(s){var c=r.props.onMetaChange;if(c){var u=nn(nn({},r.getMeta()),{},{destroy:s});Vb(r.metaCache,u)||c(u),r.metaCache=u}else r.metaCache=null}),Ut(kr(r),"onStoreChange",function(s,c,u){var d=r.props,f=d.shouldUpdate,p=d.dependencies,m=p===void 0?[]:p,y=d.onReset,w=u.store,x=r.getNamePath(),C=r.getValue(s),P=r.getValue(w),A=c&&DR(c,x);switch(u.type==="valueUpdate"&&u.source==="external"&&!Vb(C,P)&&(r.touched=!0,r.dirty=!0,r.validatePromise=null,r.errors=Zm,r.warnings=Zm,r.triggerMetaEvent()),u.type){case"reset":if(!c||A){r.touched=!1,r.dirty=!1,r.validatePromise=void 0,r.errors=Zm,r.warnings=Zm,r.triggerMetaEvent(),y==null||y(),r.refresh();return}break;case"remove":{if(f&&Fle(f,s,w,C,P,u)){r.reRender();return}break}case"setField":{var S=u.data;if(A){"touched"in S&&(r.touched=S.touched),"validating"in S&&!("originRCField"in S)&&(r.validatePromise=S.validating?Promise.resolve([]):null),"errors"in S&&(r.errors=S.errors||Zm),"warnings"in S&&(r.warnings=S.warnings||Zm),r.dirty=!0,r.triggerMetaEvent(),r.reRender();return}else if("value"in S&&DR(c,x,!0)){r.reRender();return}if(f&&!x.length&&Fle(f,s,w,C,P,u)){r.reRender();return}break}case"dependenciesUpdate":{var v=m.map($u);if(v.some(function(b){return DR(u.relatedFields,b)})){r.reRender();return}break}default:if(A||(!m.length||x.length||f)&&Fle(f,s,w,C,P,u)){r.reRender();return}break}f===!0&&r.reRender()}),Ut(kr(r),"validateRules",function(s){var c=r.getNamePath(),u=r.getValue(),d=s||{},f=d.triggerName,p=d.validateOnly,m=p===void 0?!1:p,y=Promise.resolve().then(dU(D5().mark(function w(){var x,C,P,A,S,v,b;return D5().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(r.mounted){R.next=2;break}return R.abrupt("return",[]);case 2:if(x=r.props,C=x.validateFirst,P=C===void 0?!1:C,A=x.messageVariables,S=x.validateDebounce,v=r.getRules(),f&&(v=v.filter(function(M){return M}).filter(function(M){var D=M.validateTrigger;if(!D)return!0;var k=Qfe(D);return k.includes(f)})),!(S&&f)){R.next=10;break}return R.next=8,new Promise(function(M){setTimeout(M,S)});case 8:if(r.validatePromise===y){R.next=10;break}return R.abrupt("return",[]);case 10:return b=vNt(c,u,v,s,P,A),b.catch(function(M){return M}).then(function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zm;if(r.validatePromise===y){var D;r.validatePromise=null;var k=[],N=[];(D=M.forEach)===null||D===void 0||D.call(M,function(U){var W=U.rule.warningOnly,F=U.errors,E=F===void 0?Zm:F;W?N.push.apply(N,$o(E)):k.push.apply(k,$o(E))}),r.errors=k,r.warnings=N,r.triggerMetaEvent(),r.reRender()}}),R.abrupt("return",b);case 13:case"end":return R.stop()}},w)})));return m||(r.validatePromise=y,r.dirty=!0,r.errors=Zm,r.warnings=Zm,r.triggerMetaEvent(),r.reRender()),y}),Ut(kr(r),"isFieldValidating",function(){return!!r.validatePromise}),Ut(kr(r),"isFieldTouched",function(){return r.touched}),Ut(kr(r),"isFieldDirty",function(){if(r.dirty||r.props.initialValue!==void 0)return!0;var s=r.props.fieldContext,c=s.getInternalHooks(Uv),u=c.getInitialValue;return u(r.getNamePath())!==void 0}),Ut(kr(r),"getErrors",function(){return r.errors}),Ut(kr(r),"getWarnings",function(){return r.warnings}),Ut(kr(r),"isListField",function(){return r.props.isListField}),Ut(kr(r),"isList",function(){return r.props.isList}),Ut(kr(r),"isPreserve",function(){return r.props.preserve}),Ut(kr(r),"getMeta",function(){r.prevValidating=r.isFieldValidating();var s={touched:r.isFieldTouched(),validating:r.prevValidating,errors:r.errors,warnings:r.warnings,name:r.getNamePath(),validated:r.validatePromise===null};return s}),Ut(kr(r),"getOnlyChild",function(s){if(typeof s=="function"){var c=r.getMeta();return nn(nn({},r.getOnlyChild(s(r.getControlled(),c,r.props.fieldContext))),{},{isFunction:!0})}var u=t7(s);return u.length!==1||!g.isValidElement(u[0])?{child:u,isFunction:!1}:{child:u[0],isFunction:!1}}),Ut(kr(r),"getValue",function(s){var c=r.props.fieldContext.getFieldsValue,u=r.getNamePath();return a3(s||c(!0),u)}),Ut(kr(r),"getControlled",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},c=r.props,u=c.name,d=c.trigger,f=c.validateTrigger,p=c.getValueFromEvent,m=c.normalize,y=c.valuePropName,w=c.getValueProps,x=c.fieldContext,C=f!==void 0?f:x.validateTrigger,P=r.getNamePath(),A=x.getInternalHooks,S=x.getFieldsValue,v=A(Uv),b=v.dispatch,T=r.getValue(),R=w||function(U){return Ut({},y,U)},M=s[d],D=u!==void 0?R(T):{},k=nn(nn({},s),D);k[d]=function(){r.touched=!0,r.dirty=!0,r.triggerMetaEvent();for(var U,W=arguments.length,F=new Array(W),E=0;E=0&&M<=D.length?(u.keys=[].concat($o(u.keys.slice(0,M)),[u.id],$o(u.keys.slice(M))),P([].concat($o(D.slice(0,M)),[R],$o(D.slice(M))))):(u.keys=[].concat($o(u.keys),[u.id]),P([].concat($o(D),[R]))),u.id+=1},remove:function(R){var M=S(),D=new Set(Array.isArray(R)?R:[R]);D.size<=0||(u.keys=u.keys.filter(function(k,N){return!D.has(N)}),P(M.filter(function(k,N){return!D.has(N)})))},move:function(R,M){if(R!==M){var D=S();R<0||R>=D.length||M<0||M>=D.length||(u.keys=STe(u.keys,R,M),P(STe(D,R,M)))}}},b=C||[];return Array.isArray(b)||(b=[]),o(b.map(function(T,R){var M=u.keys[R];return M===void 0&&(u.keys[R]=u.id,M=u.keys[R],u.id+=1),{name:R,key:M,isListField:!0}}),v,w)})))}function HNt(t){var e=!1,n=t.length,o=[];return t.length?new Promise(function(r,i){t.forEach(function(a,l){a.catch(function(s){return e=!0,s}).then(function(s){n-=1,o[l]=s,!(n>0)&&(e&&i(o),r(o))})})}):Promise.resolve([])}var Tqe="__@field_split__";function Lle(t){return t.map(function(e){return"".concat(Vr(e),":").concat(e)}).join(Tqe)}var zP=function(){function t(){Uh(this,t),Ut(this,"kvs",new Map)}return jh(t,[{key:"set",value:function(n,o){this.kvs.set(Lle(n),o)}},{key:"get",value:function(n){return this.kvs.get(Lle(n))}},{key:"update",value:function(n,o){var r=this.get(n),i=o(r);i?this.set(n,i):this.delete(n)}},{key:"delete",value:function(n){this.kvs.delete(Lle(n))}},{key:"map",value:function(n){return $o(this.kvs.entries()).map(function(o){var r=Sn(o,2),i=r[0],a=r[1],l=i.split(Tqe);return n({key:l.map(function(s){var c=s.match(/^([^:]*):(.*)$/),u=Sn(c,3),d=u[1],f=u[2];return d==="number"?Number(f):f}),value:a})})}},{key:"toJSON",value:function(){var n={};return this.map(function(o){var r=o.key,i=o.value;return n[r.join(".")]=i,null}),n}}]),t}(),MNt=["name"],INt=jh(function t(e){var n=this;Uh(this,t),Ut(this,"formHooked",!1),Ut(this,"forceRootUpdate",void 0),Ut(this,"subscribable",!0),Ut(this,"store",{}),Ut(this,"fieldEntities",[]),Ut(this,"initialValues",{}),Ut(this,"callbacks",{}),Ut(this,"validateMessages",null),Ut(this,"preserve",null),Ut(this,"lastValidatePromise",null),Ut(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),Ut(this,"getInternalHooks",function(o){return o===Uv?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):(Ds(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),Ut(this,"useSubscribe",function(o){n.subscribable=o}),Ut(this,"prevWithoutPreserves",null),Ut(this,"setInitialValues",function(o,r){if(n.initialValues=o||{},r){var i,a=XE(o,n.store);(i=n.prevWithoutPreserves)===null||i===void 0||i.map(function(l){var s=l.key;a=Z2(a,s,a3(o,s))}),n.prevWithoutPreserves=null,n.updateStore(a)}}),Ut(this,"destroyForm",function(o){if(o)n.updateStore({});else{var r=new zP;n.getFieldEntities(!0).forEach(function(i){n.isMergedPreserve(i.isPreserve())||r.set(i.getNamePath(),!0)}),n.prevWithoutPreserves=r}}),Ut(this,"getInitialValue",function(o){var r=a3(n.initialValues,o);return o.length?XE(r):r}),Ut(this,"setCallbacks",function(o){n.callbacks=o}),Ut(this,"setValidateMessages",function(o){n.validateMessages=o}),Ut(this,"setPreserve",function(o){n.preserve=o}),Ut(this,"watchList",[]),Ut(this,"registerWatch",function(o){return n.watchList.push(o),function(){n.watchList=n.watchList.filter(function(r){return r!==o})}}),Ut(this,"notifyWatch",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(n.watchList.length){var r=n.getFieldsValue(),i=n.getFieldsValue(!0);n.watchList.forEach(function(a){a(r,i,o)})}}),Ut(this,"timeoutId",null),Ut(this,"warningUnhooked",function(){}),Ut(this,"updateStore",function(o){n.store=o}),Ut(this,"getFieldEntities",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return o?n.fieldEntities.filter(function(r){return r.getNamePath().length}):n.fieldEntities}),Ut(this,"getFieldsMap",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=new zP;return n.getFieldEntities(o).forEach(function(i){var a=i.getNamePath();r.set(a,i)}),r}),Ut(this,"getFieldEntitiesForNamePathList",function(o){if(!o)return n.getFieldEntities(!0);var r=n.getFieldsMap(!0);return o.map(function(i){var a=$u(i);return r.get(a)||{INVALIDATE_NAME_PATH:$u(i)}})}),Ut(this,"getFieldsValue",function(o,r){n.warningUnhooked();var i,a,l;if(o===!0||Array.isArray(o)?(i=o,a=r):o&&Vr(o)==="object"&&(l=o.strict,a=o.filter),i===!0&&!a)return n.store;var s=n.getFieldEntitiesForNamePathList(Array.isArray(i)?i:null),c=[];return s.forEach(function(u){var d,f,p="INVALIDATE_NAME_PATH"in u?u.INVALIDATE_NAME_PATH:u.getNamePath();if(l){var m,y;if((m=(y=u).isList)!==null&&m!==void 0&&m.call(y))return}else if(!i&&(d=(f=u).isListField)!==null&&d!==void 0&&d.call(f))return;if(!a)c.push(p);else{var w="getMeta"in u?u.getMeta():null;a(w)&&c.push(p)}}),bTe(n.store,c.map($u))}),Ut(this,"getFieldValue",function(o){n.warningUnhooked();var r=$u(o);return a3(n.store,r)}),Ut(this,"getFieldsError",function(o){n.warningUnhooked();var r=n.getFieldEntitiesForNamePathList(o);return r.map(function(i,a){return i&&!("INVALIDATE_NAME_PATH"in i)?{name:i.getNamePath(),errors:i.getErrors(),warnings:i.getWarnings()}:{name:$u(o[a]),errors:[],warnings:[]}})}),Ut(this,"getFieldError",function(o){n.warningUnhooked();var r=$u(o),i=n.getFieldsError([r])[0];return i.errors}),Ut(this,"getFieldWarning",function(o){n.warningUnhooked();var r=$u(o),i=n.getFieldsError([r])[0];return i.warnings}),Ut(this,"isFieldsTouched",function(){n.warningUnhooked();for(var o=arguments.length,r=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:{},r=new zP,i=n.getFieldEntities(!0);i.forEach(function(s){var c=s.props.initialValue,u=s.getNamePath();if(c!==void 0){var d=r.get(u)||new Set;d.add({entity:s,value:c}),r.set(u,d)}});var a=function(c){c.forEach(function(u){var d=u.props.initialValue;if(d!==void 0){var f=u.getNamePath(),p=n.getInitialValue(f);if(p!==void 0)Ds(!1,"Form already set 'initialValues' with path '".concat(f.join("."),"'. Field can not overwrite it."));else{var m=r.get(f);if(m&&m.size>1)Ds(!1,"Multiple Field with path '".concat(f.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(m){var y=n.getFieldValue(f),w=u.isListField();!w&&(!o.skipExist||y===void 0)&&n.updateStore(Z2(n.store,f,$o(m)[0].value))}}}})},l;o.entities?l=o.entities:o.namePathList?(l=[],o.namePathList.forEach(function(s){var c=r.get(s);if(c){var u;(u=l).push.apply(u,$o($o(c).map(function(d){return d.entity})))}})):l=i,a(l)}),Ut(this,"resetFields",function(o){n.warningUnhooked();var r=n.store;if(!o){n.updateStore(XE(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(r,null,{type:"reset"}),n.notifyWatch();return}var i=o.map($u);i.forEach(function(a){var l=n.getInitialValue(a);n.updateStore(Z2(n.store,a,l))}),n.resetWithFieldInitialValue({namePathList:i}),n.notifyObservers(r,i,{type:"reset"}),n.notifyWatch(i)}),Ut(this,"setFields",function(o){n.warningUnhooked();var r=n.store,i=[];o.forEach(function(a){var l=a.name,s=Ai(a,MNt),c=$u(l);i.push(c),"value"in s&&n.updateStore(Z2(n.store,c,s.value)),n.notifyObservers(r,[c],{type:"setField",data:a})}),n.notifyWatch(i)}),Ut(this,"getFields",function(){var o=n.getFieldEntities(!0),r=o.map(function(i){var a=i.getNamePath(),l=i.getMeta(),s=nn(nn({},l),{},{name:a,value:n.getFieldValue(a)});return Object.defineProperty(s,"originRCField",{value:!0}),s});return r}),Ut(this,"initEntityValue",function(o){var r=o.props.initialValue;if(r!==void 0){var i=o.getNamePath(),a=a3(n.store,i);a===void 0&&n.updateStore(Z2(n.store,i,r))}}),Ut(this,"isMergedPreserve",function(o){var r=o!==void 0?o:n.preserve;return r??!0}),Ut(this,"registerField",function(o){n.fieldEntities.push(o);var r=o.getNamePath();if(n.notifyWatch([r]),o.props.initialValue!==void 0){var i=n.store;n.resetWithFieldInitialValue({entities:[o],skipExist:!0}),n.notifyObservers(i,[o.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(a,l){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(d){return d!==o}),!n.isMergedPreserve(l)&&(!a||s.length>1)){var c=a?void 0:n.getInitialValue(r);if(r.length&&n.getFieldValue(r)!==c&&n.fieldEntities.every(function(d){return!bqe(d.getNamePath(),r)})){var u=n.store;n.updateStore(Z2(u,r,c,!0)),n.notifyObservers(u,[r],{type:"remove"}),n.triggerDependenciesUpdate(u,r)}}n.notifyWatch([r])}}),Ut(this,"dispatch",function(o){switch(o.type){case"updateValue":{var r=o.namePath,i=o.value;n.updateValue(r,i);break}case"validateField":{var a=o.namePath,l=o.triggerName;n.validateFields([a],{triggerName:l});break}}}),Ut(this,"notifyObservers",function(o,r,i){if(n.subscribable){var a=nn(nn({},i),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(l){var s=l.onStoreChange;s(o,r,a)})}else n.forceRootUpdate()}),Ut(this,"triggerDependenciesUpdate",function(o,r){var i=n.getDependencyChildrenFields(r);return i.length&&n.validateFields(i),n.notifyObservers(o,i,{type:"dependenciesUpdate",relatedFields:[r].concat($o(i))}),i}),Ut(this,"updateValue",function(o,r){var i=$u(o),a=n.store;n.updateStore(Z2(n.store,i,r)),n.notifyObservers(a,[i],{type:"valueUpdate",source:"internal"}),n.notifyWatch([i]);var l=n.triggerDependenciesUpdate(a,i),s=n.callbacks.onValuesChange;if(s){var c=bTe(n.store,[i]);s(c,n.getFieldsValue())}n.triggerOnFieldsChange([i].concat($o(l)))}),Ut(this,"setFieldsValue",function(o){n.warningUnhooked();var r=n.store;if(o){var i=XE(n.store,o);n.updateStore(i)}n.notifyObservers(r,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),Ut(this,"setFieldValue",function(o,r){n.setFields([{name:o,value:r,errors:[],warnings:[]}])}),Ut(this,"getDependencyChildrenFields",function(o){var r=new Set,i=[],a=new zP;n.getFieldEntities().forEach(function(s){var c=s.props.dependencies;(c||[]).forEach(function(u){var d=$u(u);a.update(d,function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return f.add(s),f})})});var l=function s(c){var u=a.get(c)||new Set;u.forEach(function(d){if(!r.has(d)){r.add(d);var f=d.getNamePath();d.isFieldDirty()&&f.length&&(i.push(f),s(f))}})};return l(o),i}),Ut(this,"triggerOnFieldsChange",function(o,r){var i=n.callbacks.onFieldsChange;if(i){var a=n.getFields();if(r){var l=new zP;r.forEach(function(c){var u=c.name,d=c.errors;l.set(u,d)}),a.forEach(function(c){c.errors=l.get(c.name)||c.errors})}var s=a.filter(function(c){var u=c.name;return DR(o,u)});s.length&&i(s,a)}}),Ut(this,"validateFields",function(o,r){n.warningUnhooked();var i,a;Array.isArray(o)||typeof o=="string"||typeof r=="string"?(i=o,a=r):a=o;var l=!!i,s=l?i.map($u):[],c=[],u=String(Date.now()),d=new Set,f=a||{},p=f.recursive,m=f.dirty;n.getFieldEntities(!0).forEach(function(C){if(l||s.push(C.getNamePath()),!(!C.props.rules||!C.props.rules.length)&&!(m&&!C.isFieldDirty())){var P=C.getNamePath();if(d.add(P.join(u)),!l||DR(s,P,p)){var A=C.validateRules(nn({validateMessages:nn(nn({},vqe),n.validateMessages)},a));c.push(A.then(function(){return{name:P,errors:[],warnings:[]}}).catch(function(S){var v,b=[],T=[];return(v=S.forEach)===null||v===void 0||v.call(S,function(R){var M=R.rule.warningOnly,D=R.errors;M?T.push.apply(T,$o(D)):b.push.apply(b,$o(D))}),b.length?Promise.reject({name:P,errors:b,warnings:T}):{name:P,errors:b,warnings:T}}))}}});var y=HNt(c);n.lastValidatePromise=y,y.catch(function(C){return C}).then(function(C){var P=C.map(function(A){var S=A.name;return S});n.notifyObservers(n.store,P,{type:"validateFinish"}),n.triggerOnFieldsChange(P,C)});var w=y.then(function(){return n.lastValidatePromise===y?Promise.resolve(n.getFieldsValue(s)):Promise.reject([])}).catch(function(C){var P=C.filter(function(A){return A&&A.errors.length});return Promise.reject({values:n.getFieldsValue(s),errorFields:P,outOfDate:n.lastValidatePromise!==y})});w.catch(function(C){return C});var x=s.filter(function(C){return d.has(C.join(u))});return n.triggerOnFieldsChange(x),w}),Ut(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(o){var r=n.callbacks.onFinish;if(r)try{r(o)}catch(i){console.error(i)}}).catch(function(o){var r=n.callbacks.onFinishFailed;r&&r(o)})}),this.forceRootUpdate=e});function Pqe(t){var e=g.useRef(),n=g.useState({}),o=Sn(n,2),r=o[1];if(!e.current)if(t)e.current=t;else{var i=function(){r({})},a=new INt(i);e.current=a.getForm()}return[e.current]}var che=g.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),zNt=function(e){var n=e.validateMessages,o=e.onFormChange,r=e.onFormFinish,i=e.children,a=g.useContext(che),l=g.useRef({});return g.createElement(che.Provider,{value:nn(nn({},a),{},{validateMessages:nn(nn({},a.validateMessages),n),triggerFormChange:function(c,u){o&&o(c,{changedFields:u,forms:l.current}),a.triggerFormChange(c,u)},triggerFormFinish:function(c,u){r&&r(c,{values:u,forms:l.current}),a.triggerFormFinish(c,u)},registerForm:function(c,u){c&&(l.current=nn(nn({},l.current),{},Ut({},c,u))),a.registerForm(c,u)},unregisterForm:function(c){var u=nn({},l.current);delete u[c],l.current=u,a.unregisterForm(c)}})},i)},DNt=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed","clearOnDestroy"],ENt=function(e,n){var o=e.name,r=e.initialValues,i=e.fields,a=e.form,l=e.preserve,s=e.children,c=e.component,u=c===void 0?"form":c,d=e.validateMessages,f=e.validateTrigger,p=f===void 0?"onChange":f,m=e.onValuesChange,y=e.onFieldsChange,w=e.onFinish,x=e.onFinishFailed,C=e.clearOnDestroy,P=Ai(e,DNt),A=g.useRef(null),S=g.useContext(che),v=Pqe(a),b=Sn(v,1),T=b[0],R=T.getInternalHooks(Uv),M=R.useSubscribe,D=R.setInitialValues,k=R.setCallbacks,N=R.setValidateMessages,U=R.setPreserve,W=R.destroyForm;g.useImperativeHandle(n,function(){return nn(nn({},T),{},{nativeElement:A.current})}),g.useEffect(function(){return S.registerForm(o,T),function(){S.unregisterForm(o)}},[S,T,o]),N(nn(nn({},S.validateMessages),d)),k({onValuesChange:m,onFieldsChange:function(Q){if(S.triggerFormChange(o,Q),y){for(var oe=arguments.length,ee=new Array(oe>1?oe-1:0),$=1;${let{children:e,status:n,override:o}=t;const r=g.useContext(W1),i=g.useMemo(()=>{const a=Object.assign({},r);return o&&delete a.isFormItemInput,n&&(delete a.status,delete a.hasFeedback,delete a.feedbackIcon),a},[n,o,r]);return g.createElement(W1.Provider,{value:i},e)},WNt=g.createContext(void 0),E3=t=>{const{space:e,form:n,children:o}=t;if(o==null)return null;let r=o;return n&&(r=xe.createElement(LNt,{override:!0,status:!0},r)),e&&(r=xe.createElement(PFt,null,r)),r};function SH(t){if(t)return{closable:t.closable,closeIcon:t.closeIcon}}function PTe(t){const{closable:e,closeIcon:n}=t||{};return xe.useMemo(()=>{if(!e&&(e===!1||n===!1||n===null))return!1;if(e===void 0&&n===void 0)return null;let o={closeIcon:typeof n!="boolean"&&n!==null?n:void 0};return e&&typeof e=="object"&&(o=Object.assign(Object.assign({},o),e)),o},[e,n])}function CTe(){const t={};for(var e=arguments.length,n=new Array(e),o=0;o{r&&Object.keys(r).forEach(i=>{r[i]!==void 0&&(t[i]=r[i])})}),t}const NNt={};function u9e(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NNt;const o=PTe(t),r=PTe(e),i=typeof o!="boolean"?!!(o!=null&&o.disabled):!1,a=xe.useMemo(()=>Object.assign({closeIcon:xe.createElement(i6,null)},n),[n]),l=xe.useMemo(()=>o===!1?!1:o?CTe(a,r,o):r===!1?!1:r?CTe(a,r):a.closable?a:!1,[o,r,a]);return xe.useMemo(()=>{if(l===!1)return[!1,null,i];const{closeIconRender:s}=a,{closeIcon:c}=l;let u=c;if(u!=null){s&&(u=s(c));const d=$5e(l,!0);Object.keys(d).length&&(u=xe.isValidElement(u)?xe.cloneElement(u,d):xe.createElement("span",Object.assign({},d),u))}return[!0,u,i]},[l,a])}var UNt=function(e){if(D7()&&window.document.documentElement){var n=Array.isArray(e)?e:[e],o=window.document.documentElement;return n.some(function(r){return r in o.style})}return!1};function RTe(t,e){return UNt(t)}const jNt=()=>D7()&&window.document.documentElement,TZ=t=>{const{prefixCls:e,className:n,style:o,size:r,shape:i}=t,a=Mn({[`${e}-lg`]:r==="large",[`${e}-sm`]:r==="small"}),l=Mn({[`${e}-circle`]:i==="circle",[`${e}-square`]:i==="square",[`${e}-round`]:i==="round"}),s=g.useMemo(()=>typeof r=="number"?{width:r,height:r,lineHeight:`${r}px`}:{},[r]);return g.createElement("span",{className:Mn(e,a,l,n),style:Object.assign(Object.assign({},s),o)})},BNt=new xa("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),PZ=t=>({height:t,lineHeight:jt(t)}),ER=t=>Object.assign({width:t},PZ(t)),YNt=t=>({background:t.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:BNt,animationDuration:t.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),Wle=(t,e)=>Object.assign({width:e(t).mul(5).equal(),minWidth:e(t).mul(5).equal()},PZ(t)),ONt=t=>{const{skeletonAvatarCls:e,gradientFromColor:n,controlHeight:o,controlHeightLG:r,controlHeightSM:i}=t;return{[e]:Object.assign({display:"inline-block",verticalAlign:"top",background:n},ER(o)),[`${e}${e}-circle`]:{borderRadius:"50%"},[`${e}${e}-lg`]:Object.assign({},ER(r)),[`${e}${e}-sm`]:Object.assign({},ER(i))}},_Nt=t=>{const{controlHeight:e,borderRadiusSM:n,skeletonInputCls:o,controlHeightLG:r,controlHeightSM:i,gradientFromColor:a,calc:l}=t;return{[o]:Object.assign({display:"inline-block",verticalAlign:"top",background:a,borderRadius:n},Wle(e,l)),[`${o}-lg`]:Object.assign({},Wle(r,l)),[`${o}-sm`]:Object.assign({},Wle(i,l))}},HTe=t=>Object.assign({width:t},PZ(t)),VNt=t=>{const{skeletonImageCls:e,imageSizeBase:n,gradientFromColor:o,borderRadiusSM:r,calc:i}=t;return{[e]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:o,borderRadius:r},HTe(i(n).mul(2).equal())),{[`${e}-path`]:{fill:"#bfbfbf"},[`${e}-svg`]:Object.assign(Object.assign({},HTe(n)),{maxWidth:i(n).mul(4).equal(),maxHeight:i(n).mul(4).equal()}),[`${e}-svg${e}-svg-circle`]:{borderRadius:"50%"}}),[`${e}${e}-circle`]:{borderRadius:"50%"}}},Nle=(t,e,n)=>{const{skeletonButtonCls:o}=t;return{[`${n}${o}-circle`]:{width:e,minWidth:e,borderRadius:"50%"},[`${n}${o}-round`]:{borderRadius:e}}},Ule=(t,e)=>Object.assign({width:e(t).mul(2).equal(),minWidth:e(t).mul(2).equal()},PZ(t)),GNt=t=>{const{borderRadiusSM:e,skeletonButtonCls:n,controlHeight:o,controlHeightLG:r,controlHeightSM:i,gradientFromColor:a,calc:l}=t;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:a,borderRadius:e,width:l(o).mul(2).equal(),minWidth:l(o).mul(2).equal()},Ule(o,l))},Nle(t,o,n)),{[`${n}-lg`]:Object.assign({},Ule(r,l))}),Nle(t,r,`${n}-lg`)),{[`${n}-sm`]:Object.assign({},Ule(i,l))}),Nle(t,i,`${n}-sm`))},XNt=t=>{const{componentCls:e,skeletonAvatarCls:n,skeletonTitleCls:o,skeletonParagraphCls:r,skeletonButtonCls:i,skeletonInputCls:a,skeletonImageCls:l,controlHeight:s,controlHeightLG:c,controlHeightSM:u,gradientFromColor:d,padding:f,marginSM:p,borderRadius:m,titleHeight:y,blockRadius:w,paragraphLiHeight:x,controlHeightXS:C,paragraphMarginTop:P}=t;return{[e]:{display:"table",width:"100%",[`${e}-header`]:{display:"table-cell",paddingInlineEnd:f,verticalAlign:"top",[n]:Object.assign({display:"inline-block",verticalAlign:"top",background:d},ER(s)),[`${n}-circle`]:{borderRadius:"50%"},[`${n}-lg`]:Object.assign({},ER(c)),[`${n}-sm`]:Object.assign({},ER(u))},[`${e}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[o]:{width:"100%",height:y,background:d,borderRadius:w,[`+ ${r}`]:{marginBlockStart:u}},[r]:{padding:0,"> li":{width:"100%",height:x,listStyle:"none",background:d,borderRadius:w,"+ li":{marginBlockStart:C}}},[`${r}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${e}-content`]:{[`${o}, ${r} > li`]:{borderRadius:m}}},[`${e}-with-avatar ${e}-content`]:{[o]:{marginBlockStart:p,[`+ ${r}`]:{marginBlockStart:P}}},[`${e}${e}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},GNt(t)),ONt(t)),_Nt(t)),VNt(t)),[`${e}${e}-block`]:{width:"100%",[i]:{width:"100%"},[a]:{width:"100%"}},[`${e}${e}-active`]:{[` ${o}, ${r} > li, ${n}, @@ -4522,12 +4522,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${l} `]:Object.assign({},YNt(t))}}},JNt=t=>{const{colorFillContent:e,colorFill:n}=t,o=e,r=n;return{color:o,colorGradientEnd:r,gradientFromColor:o,gradientToColor:r,titleHeight:t.controlHeight/2,blockRadius:t.borderRadiusSM,paragraphMarginTop:t.marginLG+t.marginXXS,paragraphLiHeight:t.controlHeight/2}},ZM=el("Skeleton",t=>{const{componentCls:e,calc:n}=t,o=Ui(t,{skeletonAvatarCls:`${e}-avatar`,skeletonTitleCls:`${e}-title`,skeletonParagraphCls:`${e}-paragraph`,skeletonButtonCls:`${e}-button`,skeletonInputCls:`${e}-input`,skeletonImageCls:`${e}-image`,imageSizeBase:n(t.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${t.gradientFromColor} 25%, ${t.gradientToColor} 37%, ${t.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"});return[XNt(o)]},JNt,{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),KNt=t=>{const{prefixCls:e,className:n,rootClassName:o,active:r,shape:i="circle",size:a="default"}=t,{getPrefixCls:l}=g.useContext(gr),s=l("skeleton",e),[c,u,d]=ZM(s),f=Mf(t,["prefixCls","className"]),p=Mn(s,`${s}-element`,{[`${s}-active`]:r},n,o,u,d);return c(g.createElement("div",{className:p},g.createElement(TZ,Object.assign({prefixCls:`${s}-avatar`,shape:i,size:a},f))))},$Nt=t=>{const{prefixCls:e,className:n,rootClassName:o,active:r,block:i=!1,size:a="default"}=t,{getPrefixCls:l}=g.useContext(gr),s=l("skeleton",e),[c,u,d]=ZM(s),f=Mf(t,["prefixCls"]),p=Mn(s,`${s}-element`,{[`${s}-active`]:r,[`${s}-block`]:i},n,o,u,d);return c(g.createElement("div",{className:p},g.createElement(TZ,Object.assign({prefixCls:`${s}-button`,size:a},f))))},qNt="M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",QNt=t=>{const{prefixCls:e,className:n,rootClassName:o,style:r,active:i}=t,{getPrefixCls:a}=g.useContext(gr),l=a("skeleton",e),[s,c,u]=ZM(l),d=Mn(l,`${l}-element`,{[`${l}-active`]:i},n,o,c,u);return s(g.createElement("div",{className:d},g.createElement("div",{className:Mn(`${l}-image`,n),style:r},g.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${l}-image-svg`},g.createElement("title",null,"Image placeholder"),g.createElement("path",{d:qNt,className:`${l}-image-path`})))))},ZNt=t=>{const{prefixCls:e,className:n,rootClassName:o,active:r,block:i,size:a="default"}=t,{getPrefixCls:l}=g.useContext(gr),s=l("skeleton",e),[c,u,d]=ZM(s),f=Mf(t,["prefixCls"]),p=Mn(s,`${s}-element`,{[`${s}-active`]:r,[`${s}-block`]:i},n,o,u,d);return c(g.createElement("div",{className:p},g.createElement(TZ,Object.assign({prefixCls:`${s}-input`,size:a},f))))},eUt=t=>{const{prefixCls:e,className:n,rootClassName:o,style:r,active:i,children:a}=t,{getPrefixCls:l}=g.useContext(gr),s=l("skeleton",e),[c,u,d]=ZM(s),f=Mn(s,`${s}-element`,{[`${s}-active`]:i},u,n,o,d);return c(g.createElement("div",{className:f},g.createElement("div",{className:Mn(`${s}-image`,n),style:r},a)))},tUt=(t,e)=>{const{width:n,rows:o=2}=e;if(Array.isArray(n))return n[t];if(o-1===t)return n},nUt=t=>{const{prefixCls:e,className:n,style:o,rows:r}=t,i=Pa(new Array(r)).map((a,l)=>g.createElement("li",{key:l,style:{width:tUt(l,t)}}));return g.createElement("ul",{className:Mn(e,n),style:o},i)},oUt=t=>{let{prefixCls:e,className:n,width:o,style:r}=t;return g.createElement("h3",{className:Mn(e,n),style:Object.assign({width:o},r)})};function jle(t){return t&&typeof t=="object"?t:{}}function rUt(t,e){return t&&!e?{size:"large",shape:"square"}:{size:"large",shape:"circle"}}function iUt(t,e){return!t&&e?{width:"38%"}:t&&e?{width:"50%"}:{}}function aUt(t,e){const n={};return(!t||!e)&&(n.width="61%"),!t&&e?n.rows=3:n.rows=2,n}const NS=t=>{const{prefixCls:e,loading:n,className:o,rootClassName:r,style:i,children:a,avatar:l=!1,title:s=!0,paragraph:c=!0,active:u,round:d}=t,{getPrefixCls:f,direction:p,skeleton:m}=g.useContext(gr),y=f("skeleton",e),[w,x,C]=ZM(y);if(n||!("loading"in t)){const P=!!l,A=!!s,S=!!c;let v;if(P){const R=Object.assign(Object.assign({prefixCls:`${y}-avatar`},rUt(A,S)),jle(l));v=g.createElement("div",{className:`${y}-header`},g.createElement(TZ,Object.assign({},R)))}let b;if(A||S){let R;if(A){const D=Object.assign(Object.assign({prefixCls:`${y}-title`},iUt(P,S)),jle(s));R=g.createElement(oUt,Object.assign({},D))}let M;if(S){const D=Object.assign(Object.assign({prefixCls:`${y}-paragraph`},aUt(P,A)),jle(c));M=g.createElement(nUt,Object.assign({},D))}b=g.createElement("div",{className:`${y}-content`},R,M)}const T=Mn(y,{[`${y}-with-avatar`]:P,[`${y}-active`]:u,[`${y}-rtl`]:p==="rtl",[`${y}-round`]:d},m==null?void 0:m.className,o,r,x,C);return w(g.createElement("div",{className:T,style:Object.assign(Object.assign({},m==null?void 0:m.style),i)},v,b))}return a??null};NS.Button=$Nt;NS.Avatar=KNt;NS.Input=ZNt;NS.Image=QNt;NS.Node=eUt;function MTe(){}const lUt=g.createContext({add:MTe,remove:MTe});function Cqe(t){const e=g.useContext(lUt),n=g.useRef(null);return kd(r=>{if(r){const i=t?r.querySelector(t):r;e.add(i),n.current=i}else e.remove(n.current)})}const ITe=()=>{const{cancelButtonProps:t,cancelTextLocale:e,onCancel:n}=g.useContext(cU);return xe.createElement(oo,Object.assign({onClick:n},t),e)},zTe=()=>{const{confirmLoading:t,okButtonProps:e,okType:n,okTextLocale:o,onOk:r}=g.useContext(cU);return xe.createElement(oo,Object.assign({},eqe(n),{loading:t,onClick:r},e),o)};function Rqe(t,e){return xe.createElement("span",{className:`${t}-close-x`},e||xe.createElement(i6,{className:`${t}-close-icon`}))}const Hqe=t=>{const{okText:e,okType:n="primary",cancelText:o,confirmLoading:r,onOk:i,onCancel:a,okButtonProps:l,cancelButtonProps:s,footer:c}=t,[u]=r6("Modal",HKe()),d=e||(u==null?void 0:u.okText),f=o||(u==null?void 0:u.cancelText),p={confirmLoading:r,okButtonProps:l,cancelButtonProps:s,okTextLocale:d,cancelTextLocale:f,okType:n,onOk:i,onCancel:a},m=xe.useMemo(()=>p,Pa(Object.values(p)));let y;return typeof c=="function"||typeof c>"u"?(y=xe.createElement(xe.Fragment,null,xe.createElement(ITe,null),xe.createElement(zTe,null)),typeof c=="function"&&(y=c(y,{OkBtn:zTe,CancelBtn:ITe})),y=xe.createElement(dqe,{value:m},y)):y=c,xe.createElement(LKe,{disabled:!1},y)},sUt=t=>{const{componentCls:e}=t;return{[e]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"flex-end"},"&-space-between":{justifyContent:"space-between"},"&-space-around":{justifyContent:"space-around"},"&-space-evenly":{justifyContent:"space-evenly"},"&-top":{alignItems:"flex-start"},"&-middle":{alignItems:"center"},"&-bottom":{alignItems:"flex-end"}}}},cUt=t=>{const{componentCls:e}=t;return{[e]:{position:"relative",maxWidth:"100%",minHeight:1}}},uUt=(t,e)=>{const{prefixCls:n,componentCls:o,gridColumns:r}=t,i={};for(let a=r;a>=0;a--)a===0?(i[`${o}${e}-${a}`]={display:"none"},i[`${o}-push-${a}`]={insetInlineStart:"auto"},i[`${o}-pull-${a}`]={insetInlineEnd:"auto"},i[`${o}${e}-push-${a}`]={insetInlineStart:"auto"},i[`${o}${e}-pull-${a}`]={insetInlineEnd:"auto"},i[`${o}${e}-offset-${a}`]={marginInlineStart:0},i[`${o}${e}-order-${a}`]={order:0}):(i[`${o}${e}-${a}`]=[{"--ant-display":"block",display:"block"},{display:"var(--ant-display)",flex:`0 0 ${a/r*100}%`,maxWidth:`${a/r*100}%`}],i[`${o}${e}-push-${a}`]={insetInlineStart:`${a/r*100}%`},i[`${o}${e}-pull-${a}`]={insetInlineEnd:`${a/r*100}%`},i[`${o}${e}-offset-${a}`]={marginInlineStart:`${a/r*100}%`},i[`${o}${e}-order-${a}`]={order:a});return i[`${o}${e}-flex`]={flex:`var(--${n}${e}-flex)`},i},uhe=(t,e)=>uUt(t,e),dUt=(t,e,n)=>({[`@media (min-width: ${jt(e)})`]:Object.assign({},uhe(t,n))}),fUt=()=>({}),hUt=()=>({}),pUt=el("Grid",sUt,fUt),Mqe=t=>({xs:t.screenXSMin,sm:t.screenSMMin,md:t.screenMDMin,lg:t.screenLGMin,xl:t.screenXLMin,xxl:t.screenXXLMin}),gUt=el("Grid",t=>{const e=Ui(t,{gridColumns:24}),n=Mqe(e);return delete n.xs,[cUt(e),uhe(e,""),uhe(e,"-xs"),Object.keys(n).map(o=>dUt(e,n[o],`-${o}`)).reduce((o,r)=>Object.assign(Object.assign({},o),r),{})]},hUt);function DTe(t){return{position:t,inset:0}}const Iqe=t=>{const{componentCls:e,antCls:n}=t;return[{[`${e}-root`]:{[`${e}${n}-zoom-enter, ${e}${n}-zoom-appear`]:{transform:"none",opacity:0,animationDuration:t.motionDurationSlow,userSelect:"none"},[`${e}${n}-zoom-leave ${e}-content`]:{pointerEvents:"none"},[`${e}-mask`]:Object.assign(Object.assign({},DTe("fixed")),{zIndex:t.zIndexPopupBase,height:"100%",backgroundColor:t.colorBgMask,pointerEvents:"none",[`${e}-hidden`]:{display:"none"}}),[`${e}-wrap`]:Object.assign(Object.assign({},DTe("fixed")),{zIndex:t.zIndexPopupBase,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"})}},{[`${e}-root`]:aqe(t)}]},mUt=t=>{const{componentCls:e}=t;return[{[`${e}-root`]:{[`${e}-wrap-rtl`]:{direction:"rtl"},[`${e}-centered`]:{textAlign:"center","&::before":{display:"inline-block",width:0,height:"100%",verticalAlign:"middle",content:'""'},[e]:{top:0,display:"inline-block",paddingBottom:0,textAlign:"start",verticalAlign:"middle"}},[`@media (max-width: ${t.screenSMMax}px)`]:{[e]:{maxWidth:"calc(100vw - 16px)",margin:`${jt(t.marginXS)} auto`},[`${e}-centered`]:{[e]:{flex:1}}}}},{[e]:Object.assign(Object.assign({},Ua(t)),{pointerEvents:"none",position:"relative",top:100,width:"auto",maxWidth:`calc(100vw - ${jt(t.calc(t.margin).mul(2).equal())})`,margin:"0 auto",paddingBottom:t.paddingLG,[`${e}-title`]:{margin:0,color:t.titleColor,fontWeight:t.fontWeightStrong,fontSize:t.titleFontSize,lineHeight:t.titleLineHeight,wordWrap:"break-word"},[`${e}-content`]:{position:"relative",backgroundColor:t.contentBg,backgroundClip:"padding-box",border:0,borderRadius:t.borderRadiusLG,boxShadow:t.boxShadow,pointerEvents:"auto",padding:t.contentPadding},[`${e}-close`]:Object.assign({position:"absolute",top:t.calc(t.modalHeaderHeight).sub(t.modalCloseBtnSize).div(2).equal(),insetInlineEnd:t.calc(t.modalHeaderHeight).sub(t.modalCloseBtnSize).div(2).equal(),zIndex:t.calc(t.zIndexPopupBase).add(10).equal(),padding:0,color:t.modalCloseIconColor,fontWeight:t.fontWeightStrong,lineHeight:1,textDecoration:"none",background:"transparent",borderRadius:t.borderRadiusSM,width:t.modalCloseBtnSize,height:t.modalCloseBtnSize,border:0,outline:0,cursor:"pointer",transition:`color ${t.motionDurationMid}, background-color ${t.motionDurationMid}`,"&-x":{display:"flex",fontSize:t.fontSizeLG,fontStyle:"normal",lineHeight:jt(t.modalCloseBtnSize),justifyContent:"center",textTransform:"none",textRendering:"auto"},"&:disabled":{pointerEvents:"none"},"&:hover":{color:t.modalCloseIconHoverColor,backgroundColor:t.colorBgTextHover,textDecoration:"none"},"&:active":{backgroundColor:t.colorBgTextActive}},Yy(t)),[`${e}-header`]:{color:t.colorText,background:t.headerBg,borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`,marginBottom:t.headerMarginBottom,padding:t.headerPadding,borderBottom:t.headerBorderBottom},[`${e}-body`]:{fontSize:t.fontSize,lineHeight:t.lineHeight,wordWrap:"break-word",padding:t.bodyPadding,[`${e}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",margin:`${jt(t.margin)} auto`}},[`${e}-footer`]:{textAlign:"end",background:t.footerBg,marginTop:t.footerMarginTop,padding:t.footerPadding,borderTop:t.footerBorderTop,borderRadius:t.footerBorderRadius,[`> ${t.antCls}-btn + ${t.antCls}-btn`]:{marginInlineStart:t.marginXS}},[`${e}-open`]:{overflow:"hidden"}})},{[`${e}-pure-panel`]:{top:"auto",padding:0,display:"flex",flexDirection:"column",[`${e}-content, ${e}-body, - ${e}-confirm-body-wrapper`]:{display:"flex",flexDirection:"column",flex:"auto"},[`${e}-confirm-body`]:{marginBottom:"auto"}}}]},yUt=t=>{const{componentCls:e}=t;return{[`${e}-root`]:{[`${e}-wrap-rtl`]:{direction:"rtl",[`${e}-confirm-body`]:{direction:"rtl"}}}}},AUt=t=>{const{componentCls:e}=t,n=Mqe(t);delete n.xs;const o=Object.keys(n).map(r=>({[`@media (min-width: ${jt(n[r])})`]:{width:`var(--${e.replace(".","")}-${r}-width)`}}));return{[`${e}-root`]:{[e]:[{width:`var(--${e.replace(".","")}-xs-width)`}].concat(Pa(o))}}},zqe=t=>{const e=t.padding,n=t.fontSizeHeading5,o=t.lineHeightHeading5;return Ui(t,{modalHeaderHeight:t.calc(t.calc(o).mul(n).equal()).add(t.calc(e).mul(2).equal()).equal(),modalFooterBorderColorSplit:t.colorSplit,modalFooterBorderStyle:t.lineType,modalFooterBorderWidth:t.lineWidth,modalCloseIconColor:t.colorIcon,modalCloseIconHoverColor:t.colorIconHover,modalCloseBtnSize:t.controlHeight,modalConfirmIconSize:t.fontHeight,modalTitleHeight:t.calc(t.titleFontSize).mul(t.titleLineHeight).equal()})},Dqe=t=>({footerBg:"transparent",headerBg:t.colorBgElevated,titleLineHeight:t.lineHeightHeading5,titleFontSize:t.fontSizeHeading5,contentBg:t.colorBgElevated,titleColor:t.colorTextHeading,contentPadding:t.wireframe?0:`${jt(t.paddingMD)} ${jt(t.paddingContentHorizontalLG)}`,headerPadding:t.wireframe?`${jt(t.padding)} ${jt(t.paddingLG)}`:0,headerBorderBottom:t.wireframe?`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",headerMarginBottom:t.wireframe?0:t.marginXS,bodyPadding:t.wireframe?t.paddingLG:0,footerPadding:t.wireframe?`${jt(t.paddingXS)} ${jt(t.padding)}`:0,footerBorderTop:t.wireframe?`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",footerBorderRadius:t.wireframe?`0 0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)}`:0,footerMarginTop:t.wireframe?0:t.marginSM,confirmBodyPadding:t.wireframe?`${jt(t.padding*2)} ${jt(t.padding*2)} ${jt(t.paddingLG)}`:0,confirmIconMarginInlineEnd:t.wireframe?t.margin:t.marginSM,confirmBtnsMarginTop:t.wireframe?t.marginLG:t.marginSM}),Eqe=el("Modal",t=>{const e=zqe(t);return[mUt(e),yUt(e),Iqe(e),QM(e,"zoom"),AUt(e)]},Dqe,{unitless:{titleLineHeight:!0}});var wUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{dhe={x:t.pageX,y:t.pageY},setTimeout(()=>{dhe=null},100)};jNt()&&document.documentElement.addEventListener("click",xUt,!0);const kqe=t=>{var e;const{getPopupContainer:n,getPrefixCls:o,direction:r,modal:i}=g.useContext(gr),a=ee=>{const{onCancel:q}=t;q==null||q(ee)},l=ee=>{const{onOk:q}=t;q==null||q(ee)},{prefixCls:s,className:c,rootClassName:u,open:d,wrapClassName:f,centered:p,getContainer:m,focusTriggerAfterClose:y=!0,style:w,visible:x,width:C=520,footer:P,classNames:A,styles:S,children:v,loading:b}=t,T=wUt(t,["prefixCls","className","rootClassName","open","wrapClassName","centered","getContainer","focusTriggerAfterClose","style","visible","width","footer","classNames","styles","children","loading"]),R=o("modal",s),M=o(),D=nu(R),[k,N,U]=Eqe(R,D),W=Mn(f,{[`${R}-centered`]:!!p,[`${R}-wrap-rtl`]:r==="rtl"}),F=P!==null&&!b?g.createElement(Hqe,Object.assign({},t,{onOk:l,onCancel:a})):null,[E,L,j]=u9e(SH(t),SH(i),{closable:!0,closeIcon:g.createElement(i6,{className:`${R}-close-icon`}),closeIconRender:ee=>Rqe(R,ee)}),Y=Cqe(`.${R}-content`),[O,_]=a6("Modal",T.zIndex),[G,Q]=g.useMemo(()=>C&&typeof C=="object"?[void 0,C]:[C,void 0],[C]),oe=g.useMemo(()=>{const ee={};return Q&&Object.keys(Q).forEach(q=>{const ae=Q[q];ae!==void 0&&(ee[`--${R}-${q}-width`]=typeof ae=="number"?`${ae}px`:ae)}),ee},[Q]);return k(g.createElement(E3,{form:!0,space:!0},g.createElement(iU.Provider,{value:_},g.createElement(l9e,Object.assign({width:G},T,{zIndex:O,getContainer:m===void 0?n:m,prefixCls:R,rootClassName:Mn(N,u,U,D),footer:F,visible:d??x,mousePosition:(e=T.mousePosition)!==null&&e!==void 0?e:dhe,onClose:a,closable:E&&{disabled:j,closeIcon:L},closeIcon:L,focusTriggerAfterClose:y,transitionName:L1(M,"zoom",t.transitionName),maskTransitionName:L1(M,"fade",t.maskTransitionName),className:Mn(N,c,i==null?void 0:i.className),style:Object.assign(Object.assign(Object.assign({},i==null?void 0:i.style),w),oe),classNames:Object.assign(Object.assign(Object.assign({},i==null?void 0:i.classNames),A),{wrapper:Mn(W,A==null?void 0:A.wrapper)}),styles:Object.assign(Object.assign({},i==null?void 0:i.styles),S),panelRef:Y}),b?g.createElement(NS,{active:!0,title:!1,paragraph:{rows:4},className:`${R}-body-skeleton`}):v))))},vUt=t=>{const{componentCls:e,titleFontSize:n,titleLineHeight:o,modalConfirmIconSize:r,fontSize:i,lineHeight:a,modalTitleHeight:l,fontHeight:s,confirmBodyPadding:c}=t,u=`${e}-confirm`;return{[u]:{"&-rtl":{direction:"rtl"},[`${t.antCls}-modal-header`]:{display:"none"},[`${u}-body-wrapper`]:Object.assign({},vL()),[`&${e} ${e}-body`]:{padding:c},[`${u}-body`]:{display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t.iconCls}`]:{flex:"none",fontSize:r,marginInlineEnd:t.confirmIconMarginInlineEnd,marginTop:t.calc(t.calc(s).sub(r).equal()).div(2).equal()},[`&-has-title > ${t.iconCls}`]:{marginTop:t.calc(t.calc(l).sub(r).equal()).div(2).equal()}},[`${u}-paragraph`]:{display:"flex",flexDirection:"column",flex:"auto",rowGap:t.marginXS,maxWidth:`calc(100% - ${jt(t.marginSM)})`},[`${t.iconCls} + ${u}-paragraph`]:{maxWidth:`calc(100% - ${jt(t.calc(t.modalConfirmIconSize).add(t.marginSM).equal())})`},[`${u}-title`]:{color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:n,lineHeight:o},[`${u}-content`]:{color:t.colorText,fontSize:i,lineHeight:a},[`${u}-btns`]:{textAlign:"end",marginTop:t.confirmBtnsMarginTop,[`${t.antCls}-btn + ${t.antCls}-btn`]:{marginBottom:0,marginInlineStart:t.marginXS}}},[`${u}-error ${u}-body > ${t.iconCls}`]:{color:t.colorError},[`${u}-warning ${u}-body > ${t.iconCls}, - ${u}-confirm ${u}-body > ${t.iconCls}`]:{color:t.colorWarning},[`${u}-info ${u}-body > ${t.iconCls}`]:{color:t.colorInfo},[`${u}-success ${u}-body > ${t.iconCls}`]:{color:t.colorSuccess}}},bUt=rU(["Modal","confirm"],t=>{const e=zqe(t);return[vUt(e)]},Dqe,{order:-1e3});var SUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rC,Pa(Object.values(C))),A=g.createElement(g.Fragment,null,g.createElement(oTe,null),g.createElement(rTe,null)),S=t.title!==void 0&&t.title!==null,v=`${i}-body`;return g.createElement("div",{className:`${i}-body-wrapper`},g.createElement("div",{className:Mn(v,{[`${v}-has-title`]:S})},d,g.createElement("div",{className:`${i}-paragraph`},S&&g.createElement("span",{className:`${i}-title`},t.title),g.createElement("div",{className:`${i}-content`},t.content))),s===void 0||typeof s=="function"?g.createElement(dqe,{value:P},g.createElement("div",{className:`${i}-btns`},typeof s=="function"?s(A,{OkBtn:rTe,CancelBtn:oTe}):A)):s,g.createElement(bUt,{prefixCls:e}))}const TUt=t=>{const{close:e,zIndex:n,maskStyle:o,direction:r,prefixCls:i,wrapClassName:a,rootPrefixCls:l,bodyStyle:s,closable:c=!1,onConfirm:u,styles:d}=t,f=`${i}-confirm`,p=t.width||416,m=t.style||{},y=t.mask===void 0?!0:t.mask,w=t.maskClosable===void 0?!1:t.maskClosable,x=Mn(f,`${f}-${t.type}`,{[`${f}-rtl`]:r==="rtl"},t.className),[,C]=Ff(),P=g.useMemo(()=>n!==void 0?n:C.zIndexPopupBase+V$e,[n,C]);return g.createElement(kqe,Object.assign({},t,{className:x,wrapClassName:Mn({[`${f}-centered`]:!!t.centered},a),onCancel:()=>{e==null||e({triggerCancel:!0}),u==null||u(!1)},title:"",footer:null,transitionName:L1(l||"","zoom",t.transitionName),maskTransitionName:L1(l||"","fade",t.maskTransitionName),mask:y,maskClosable:w,style:m,styles:Object.assign({body:s,mask:o},d),width:p,zIndex:P,closable:c}),g.createElement(Fqe,Object.assign({},t,{confirmPrefixCls:f})))},Lqe=t=>{const{rootPrefixCls:e,iconPrefixCls:n,direction:o,theme:r}=t;return g.createElement(n2,{prefixCls:e,iconPrefixCls:n,direction:o,theme:r},g.createElement(TUt,Object.assign({},t)))},jv=[];let Wqe="";function Nqe(){return Wqe}const PUt=t=>{var e,n;const{prefixCls:o,getContainer:r,direction:i}=t,a=HKe(),l=g.useContext(gr),s=Nqe()||l.getPrefixCls(),c=o||`${s}-modal`;let u=r;return u===!1&&(u=void 0),xe.createElement(Lqe,Object.assign({},t,{rootPrefixCls:s,prefixCls:c,iconPrefixCls:l.iconPrefixCls,theme:l.theme,direction:i??l.direction,locale:(n=(e=l.locale)===null||e===void 0?void 0:e.Modal)!==null&&n!==void 0?n:a,getContainer:u}))};function pU(t){const e=y$e(),n=document.createDocumentFragment();let o=Object.assign(Object.assign({},t),{close:s,open:!0}),r,i;function a(){for(var u,d=arguments.length,f=new Array(d),p=0;pw==null?void 0:w.triggerCancel)){var y;(u=t.onCancel)===null||u===void 0||(y=u).call.apply(y,[t,()=>{}].concat(Pa(f.slice(1))))}for(let w=0;w{const d=e.getPrefixCls(void 0,Nqe()),f=e.getIconPrefixCls(),p=e.getTheme(),m=xe.createElement(PUt,Object.assign({},u));i=e9e()(xe.createElement(n2,{prefixCls:d,iconPrefixCls:f,theme:p},e.holderRender?e.holderRender(m):m),n)})}function s(){for(var u=arguments.length,d=new Array(u),f=0;f{typeof t.afterClose=="function"&&t.afterClose(),a.apply(this,d)}}),o.visible&&delete o.visible,l(o)}function c(u){typeof u=="function"?o=u(o):o=Object.assign(Object.assign({},o),u),l(o)}return l(o),jv.push(s),{destroy:s,update:c}}function Uqe(t){return Object.assign(Object.assign({},t),{type:"warning"})}function jqe(t){return Object.assign(Object.assign({},t),{type:"info"})}function Bqe(t){return Object.assign(Object.assign({},t),{type:"success"})}function Yqe(t){return Object.assign(Object.assign({},t),{type:"error"})}function Oqe(t){return Object.assign(Object.assign({},t),{type:"confirm"})}function CUt(t){let{rootPrefixCls:e}=t;Wqe=e}var RUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,{afterClose:o,config:r}=t,i=RUt(t,["afterClose","config"]);const[a,l]=g.useState(!0),[s,c]=g.useState(r),{direction:u,getPrefixCls:d}=g.useContext(gr),f=d("modal"),p=d(),m=()=>{var C;o(),(C=s.afterClose)===null||C===void 0||C.call(s)},y=function(){var C;l(!1);for(var P=arguments.length,A=new Array(P),S=0;ST==null?void 0:T.triggerCancel)){var b;(C=s.onCancel)===null||C===void 0||(b=C).call.apply(b,[s,()=>{}].concat(Pa(A.slice(1))))}};g.useImperativeHandle(e,()=>({destroy:y,update:C=>{c(P=>Object.assign(Object.assign({},P),C))}}));const w=(n=s.okCancel)!==null&&n!==void 0?n:s.type==="confirm",[x]=r6("Modal",I3.Modal);return g.createElement(Lqe,Object.assign({prefixCls:f,rootPrefixCls:p},s,{close:y,open:a,afterClose:m,okText:s.okText||(w?x==null?void 0:x.okText:x==null?void 0:x.justOkText),direction:s.direction||u,cancelText:s.cancelText||(x==null?void 0:x.cancelText)},i))},MUt=g.forwardRef(HUt);let ETe=0;const IUt=g.memo(g.forwardRef((t,e)=>{const[n,o]=nFt();return g.useImperativeHandle(e,()=>({patchElement:o}),[]),g.createElement(g.Fragment,null,n)}));function zUt(){const t=g.useRef(null),[e,n]=g.useState([]);g.useEffect(()=>{e.length&&(Pa(e).forEach(a=>{a()}),n([]))},[e]);const o=g.useCallback(i=>function(l){var s;ETe+=1;const c=g.createRef();let u;const d=new Promise(w=>{u=w});let f=!1,p;const m=g.createElement(MUt,{key:`modal-${ETe}`,config:i(l),ref:c,afterClose:()=>{p==null||p()},isSilent:()=>f,onConfirm:w=>{u(w)}});return p=(s=t.current)===null||s===void 0?void 0:s.patchElement(m),p&&jv.push(p),{destroy:()=>{function w(){var x;(x=c.current)===null||x===void 0||x.destroy()}c.current?w():n(x=>[].concat(Pa(x),[w]))},update:w=>{function x(){var C;(C=c.current)===null||C===void 0||C.update(w)}c.current?x():n(C=>[].concat(Pa(C),[x]))},then:w=>(f=!0,d.then(w))}},[]);return[g.useMemo(()=>({info:o(jqe),success:o(Bqe),error:o(Yqe),warning:o(Uqe),confirm:o(Oqe)}),[]),g.createElement(IUt,{key:"modal-holder",ref:t})]}const DUt=xe.createContext({});function _qe(t){return e=>g.createElement(n2,{theme:{token:{motion:!1,zIndexPopupBase:0}}},g.createElement(t,Object.assign({},e)))}const gU=(t,e,n,o,r)=>_qe(a=>{const{prefixCls:l,style:s}=a,c=g.useRef(null),[u,d]=g.useState(0),[f,p]=g.useState(0),[m,y]=qA(!1,{value:a.open}),{getPrefixCls:w}=g.useContext(gr),x=w(o||"select",l);g.useEffect(()=>{if(y(!0),typeof ResizeObserver<"u"){const A=new ResizeObserver(v=>{const b=v[0].target;d(b.offsetHeight+8),p(b.offsetWidth)}),S=setInterval(()=>{var v;const b=r?`.${r(x)}`:`.${x}-dropdown`,T=(v=c.current)===null||v===void 0?void 0:v.querySelector(b);T&&(clearInterval(S),A.observe(T))},10);return()=>{clearInterval(S),A.disconnect()}}},[]);let C=Object.assign(Object.assign({},a),{style:Object.assign(Object.assign({},s),{margin:0}),open:m,visible:m,getPopupContainer:()=>c.current});e&&Object.assign(C,{[e]:{overflow:{adjustX:!1,adjustY:!1}}});const P={paddingBottom:u,position:"relative",minWidth:f};return g.createElement("div",{ref:c,style:P},g.createElement(t,Object.assign({},C)))}),d9e=function(){if(typeof navigator>"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var CZ=function(e){var n=e.className,o=e.customizeIcon,r=e.customizeIconProps,i=e.children,a=e.onMouseDown,l=e.onClick,s=typeof o=="function"?o(r):o;return g.createElement("span",{className:n,onMouseDown:function(u){u.preventDefault(),a==null||a(u)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:l,"aria-hidden":!0},s!==void 0?s:g.createElement("span",{className:Bn(n.split(/\s+/).map(function(c){return"".concat(c,"-icon")}))},i))},EUt=function(e,n,o,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,l=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,c=xe.useMemo(function(){if(Vr(r)==="object")return r.clearIcon;if(i)return i},[r,i]),u=xe.useMemo(function(){return!!(!a&&r&&(o.length||l)&&!(s==="combobox"&&l===""))},[r,a,o.length,l,s]);return{allowClear:u,clearIcon:xe.createElement(CZ,{className:"".concat(e,"-clear"),onMouseDown:n,customizeIcon:c},"×")}},Vqe=g.createContext(null);function kUt(){return g.useContext(Vqe)}function FUt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,e=g.useState(!1),n=Sn(e,2),o=n[0],r=n[1],i=g.useRef(null),a=function(){window.clearTimeout(i.current)};g.useEffect(function(){return a},[]);var l=function(c,u){a(),i.current=window.setTimeout(function(){r(c),u&&u()},t)};return[o,l,a]}function Gqe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,e=g.useRef(null),n=g.useRef(null);g.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]);function o(r){(r||e.current===null)&&(e.current=r),window.clearTimeout(n.current),n.current=window.setTimeout(function(){e.current=null},t)}return[function(){return e.current},o]}function LUt(t,e,n,o){var r=g.useRef(null);r.current={open:e,triggerOpen:n,customizedTrigger:o},g.useEffect(function(){function i(a){var l;if(!((l=r.current)!==null&&l!==void 0&&l.customizedTrigger)){var s=a.target;s.shadowRoot&&a.composed&&(s=a.composedPath()[0]||s),r.current.open&&t().filter(function(c){return c}).every(function(c){return!c.contains(s)&&c!==s})&&r.current.triggerOpen(!1)}}return window.addEventListener("mousedown",i),function(){return window.removeEventListener("mousedown",i)}},[])}function WUt(t){return t&&![Lo.ESC,Lo.SHIFT,Lo.BACKSPACE,Lo.TAB,Lo.WIN_KEY,Lo.ALT,Lo.META,Lo.WIN_KEY_RIGHT,Lo.CTRL,Lo.SEMICOLON,Lo.EQUALS,Lo.CAPS_LOCK,Lo.CONTEXT_MENU,Lo.F1,Lo.F2,Lo.F3,Lo.F4,Lo.F5,Lo.F6,Lo.F7,Lo.F8,Lo.F9,Lo.F10,Lo.F11,Lo.F12].includes(t)}var fhe=g.createContext(null);function NUt(t){var e=t.children,n=t.onBatchResize,o=g.useRef(0),r=g.useRef([]),i=g.useContext(fhe),a=g.useCallback(function(l,s,c){o.current+=1;var u=o.current;r.current.push({size:l,element:s,data:c}),Promise.resolve().then(function(){u===o.current&&(n==null||n(r.current),r.current=[])}),i==null||i(l,s,c)},[n,i]);return g.createElement(fhe.Provider,{value:a},e)}var f8=new Map;function UUt(t){t.forEach(function(e){var n,o=e.target;(n=f8.get(o))===null||n===void 0||n.forEach(function(r){return r(o)})})}var Xqe=new VJe(UUt);function jUt(t,e){f8.has(t)||(f8.set(t,new Set),Xqe.observe(t)),f8.get(t).add(e)}function BUt(t,e){f8.has(t)&&(f8.get(t).delete(e),f8.get(t).size||(Xqe.unobserve(t),f8.delete(t)))}var YUt=function(t){XM(n,t);var e=JM(n);function n(){return Uh(this,n),e.apply(this,arguments)}return jh(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function OUt(t,e){var n=t.children,o=t.disabled,r=g.useRef(null),i=g.useRef(null),a=g.useContext(fhe),l=typeof n=="function",s=l?n(r):n,c=g.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),u=!l&&g.isValidElement(s)&&Z8(s),d=u?s.ref:null,f=E7(d,r),p=function(){var x;return jk(r.current)||(r.current&&Vr(r.current)==="object"?jk((x=r.current)===null||x===void 0?void 0:x.nativeElement):null)||jk(i.current)};g.useImperativeHandle(e,function(){return p()});var m=g.useRef(t);m.current=t;var y=g.useCallback(function(w){var x=m.current,C=x.onResize,P=x.data,A=w.getBoundingClientRect(),S=A.width,v=A.height,b=w.offsetWidth,T=w.offsetHeight,R=Math.floor(S),M=Math.floor(v);if(c.current.width!==R||c.current.height!==M||c.current.offsetWidth!==b||c.current.offsetHeight!==T){var D={width:R,height:M,offsetWidth:b,offsetHeight:T};c.current=D;var k=b===Math.round(S)?S:b,N=T===Math.round(v)?v:T,U=nn(nn({},D),{},{offsetWidth:k,offsetHeight:N});a==null||a(U,w,P),C&&Promise.resolve().then(function(){C(U,w)})}},[]);return g.useEffect(function(){var w=p();return w&&!o&&jUt(w,y),function(){return BUt(w,y)}},[r.current,o]),g.createElement(YUt,{ref:i},u?g.cloneElement(s,{ref:f}):s)}var _Ut=g.forwardRef(OUt),VUt="rc-observer-key";function GUt(t,e){var n=t.children,o=typeof n=="function"?[n]:t7(n);return o.map(function(r,i){var a=(r==null?void 0:r.key)||"".concat(VUt,"-").concat(i);return g.createElement(_Ut,Uo({},t,{key:a,ref:i===0?e:void 0}),r)})}var Ld=g.forwardRef(GUt);Ld.Collection=NUt;var XUt=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],DP=void 0;function JUt(t,e){var n=t.prefixCls,o=t.invalidate,r=t.item,i=t.renderItem,a=t.responsive,l=t.responsiveDisabled,s=t.registerSize,c=t.itemKey,u=t.className,d=t.style,f=t.children,p=t.display,m=t.order,y=t.component,w=y===void 0?"div":y,x=Ai(t,XUt),C=a&&!p;function P(T){s(c,T)}g.useEffect(function(){return function(){P(null)}},[]);var A=i&&r!==DP?i(r):f,S;o||(S={opacity:C?0:1,height:C?0:DP,overflowY:C?"hidden":DP,order:a?m:DP,pointerEvents:C?"none":DP,position:C?"absolute":DP});var v={};C&&(v["aria-hidden"]=!0);var b=g.createElement(w,Uo({className:Bn(!o&&n,u),style:nn(nn({},S),d)},v,x,{ref:e}),A);return a&&(b=g.createElement(Ld,{onResize:function(R){var M=R.offsetWidth;P(M)},disabled:l},b)),b}var Yk=g.forwardRef(JUt);Yk.displayName="Item";function KUt(t){if(typeof MessageChannel>"u")Ic(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}function $Ut(){var t=g.useRef(null),e=function(o){t.current||(t.current=[],KUt(function(){r0.unstable_batchedUpdates(function(){t.current.forEach(function(r){r()}),t.current=null})})),t.current.push(o)};return e}function KD(t,e){var n=g.useState(e),o=Sn(n,2),r=o[0],i=o[1],a=Dd(function(l){t(function(){i(l)})});return[r,a]}var rJ=xe.createContext(null),qUt=["component"],QUt=["className"],ZUt=["className"],ejt=function(e,n){var o=g.useContext(rJ);if(!o){var r=e.component,i=r===void 0?"div":r,a=Ai(e,qUt);return g.createElement(i,Uo({},a,{ref:n}))}var l=o.className,s=Ai(o,QUt),c=e.className,u=Ai(e,ZUt);return g.createElement(rJ.Provider,{value:null},g.createElement(Yk,Uo({ref:n,className:Bn(l,c)},s,u)))},Jqe=g.forwardRef(ejt);Jqe.displayName="RawItem";var tjt=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Kqe="responsive",$qe="invalidate";function njt(t){return"+ ".concat(t.length," ...")}function ojt(t,e){var n=t.prefixCls,o=n===void 0?"rc-overflow":n,r=t.data,i=r===void 0?[]:r,a=t.renderItem,l=t.renderRawItem,s=t.itemKey,c=t.itemWidth,u=c===void 0?10:c,d=t.ssr,f=t.style,p=t.className,m=t.maxCount,y=t.renderRest,w=t.renderRawRest,x=t.suffix,C=t.component,P=C===void 0?"div":C,A=t.itemComponent,S=t.onVisibleChange,v=Ai(t,tjt),b=d==="full",T=$Ut(),R=KD(T,null),M=Sn(R,2),D=M[0],k=M[1],N=D||0,U=KD(T,new Map),W=Sn(U,2),F=W[0],E=W[1],L=KD(T,0),j=Sn(L,2),Y=j[0],O=j[1],_=KD(T,0),G=Sn(_,2),Q=G[0],oe=G[1],ee=KD(T,0),q=Sn(ee,2),ae=q[0],Z=q[1],ne=g.useState(null),te=Sn(ne,2),$=te[0],le=te[1],de=g.useState(null),he=Sn(de,2),me=he[0],ce=he[1],Pe=g.useMemo(function(){return me===null&&b?Number.MAX_SAFE_INTEGER:me||0},[me,D]),pe=g.useState(!1),Ie=Sn(pe,2),ve=Ie[0],ze=Ie[1],Ae="".concat(o,"-item"),se=Math.max(Y,Q),ge=m===Kqe,we=i.length&&ge,Se=m===$qe,Me=we||typeof m=="number"&&i.length>m,Ce=g.useMemo(function(){var tt=i;return we?D===null&&b?tt=i:tt=i.slice(0,Math.min(i.length,N/u)):typeof m=="number"&&(tt=i.slice(0,m)),tt},[i,u,D,m,we]),Te=g.useMemo(function(){return we?i.slice(Pe+1):i.slice(Ce.length)},[i,Ce,we,Pe]),Re=g.useCallback(function(tt,gt){var Ve;return typeof s=="function"?s(tt):(Ve=s&&(tt==null?void 0:tt[s]))!==null&&Ve!==void 0?Ve:gt},[s]),Ne=g.useCallback(a||function(tt){return tt},[a]);function _e(tt,gt,Ve){me===tt&&(gt===void 0||gt===$)||(ce(tt),Ve||(ze(ttN){_e(je-1,tt-et-ae+Q);break}}x&&Le(0)+ae>N&&le(null)}},[N,F,Q,ae,Re,Ce]);var Ye=ve&&!!Te.length,lt={};$!==null&&we&&(lt={position:"absolute",left:$,top:0});var Oe={prefixCls:Ae,responsive:we,component:A,invalidate:Se},ut=l?function(tt,gt){var Ve=Re(tt,gt);return g.createElement(rJ.Provider,{key:Ve,value:nn(nn({},Oe),{},{order:gt,item:tt,itemKey:Ve,registerSize:qe,display:gt<=Pe})},l(tt,gt))}:function(tt,gt){var Ve=Re(tt,gt);return g.createElement(Yk,Uo({},Oe,{order:gt,key:Ve,item:tt,renderItem:Ne,itemKey:Ve,registerSize:qe,display:gt<=Pe}))},ht,Qe={order:Ye?Pe:Number.MAX_SAFE_INTEGER,className:"".concat(Ae,"-rest"),registerSize:Fe,display:Ye};if(w)w&&(ht=g.createElement(rJ.Provider,{value:nn(nn({},Oe),Qe)},w(Te)));else{var nt=y||njt;ht=g.createElement(Yk,Uo({},Oe,Qe),typeof nt=="function"?nt(Te):nt)}var mt=g.createElement(P,Uo({className:Bn(!Se&&o,p),style:f,ref:e},v),Ce.map(ut),Me?ht:null,x&&g.createElement(Yk,Uo({},Oe,{responsive:ge,responsiveDisabled:!we,order:Pe,className:"".concat(Ae,"-suffix"),registerSize:He,display:!0,style:lt}),x));return ge&&(mt=g.createElement(Ld,{onResize:Ue,disabled:!we},mt)),mt}var S5=g.forwardRef(ojt);S5.displayName="Overflow";S5.Item=Jqe;S5.RESPONSIVE=Kqe;S5.INVALIDATE=$qe;var rjt=function(e,n){var o,r=e.prefixCls,i=e.id,a=e.inputElement,l=e.disabled,s=e.tabIndex,c=e.autoFocus,u=e.autoComplete,d=e.editable,f=e.activeDescendantId,p=e.value,m=e.maxLength,y=e.onKeyDown,w=e.onMouseDown,x=e.onChange,C=e.onPaste,P=e.onCompositionStart,A=e.onCompositionEnd,S=e.onBlur,v=e.open,b=e.attrs,T=a||g.createElement("input",null),R=T,M=R.ref,D=R.props,k=D.onKeyDown,N=D.onChange,U=D.onMouseDown,W=D.onCompositionStart,F=D.onCompositionEnd,E=D.onBlur,L=D.style;return"maxLength"in T.props,T=g.cloneElement(T,nn(nn(nn({type:"search"},D),{},{id:i,ref:oU(n,M),disabled:l,tabIndex:s,autoComplete:u||"off",autoFocus:c,className:Bn("".concat(r,"-selection-search-input"),(o=T)===null||o===void 0||(o=o.props)===null||o===void 0?void 0:o.className),role:"combobox","aria-expanded":v||!1,"aria-haspopup":"listbox","aria-owns":"".concat(i,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(i,"_list"),"aria-activedescendant":v?f:void 0},b),{},{value:d?p:"",maxLength:m,readOnly:!d,unselectable:d?null:"on",style:nn(nn({},L),{},{opacity:d?null:0}),onKeyDown:function(Y){y(Y),k&&k(Y)},onMouseDown:function(Y){w(Y),U&&U(Y)},onChange:function(Y){x(Y),N&&N(Y)},onCompositionStart:function(Y){P(Y),W&&W(Y)},onCompositionEnd:function(Y){A(Y),F&&F(Y)},onPaste:C,onBlur:function(Y){S(Y),E&&E(Y)}})),T},qqe=g.forwardRef(rjt);function Qqe(t){return Array.isArray(t)?t:t!==void 0?[t]:[]}var ijt=typeof window<"u"&&window.document&&window.document.documentElement,ajt=ijt;function ljt(t){return t!=null}function sjt(t){return!t&&t!==0}function kTe(t){return["string","number"].includes(Vr(t))}function Zqe(t){var e=void 0;return t&&(kTe(t.title)?e=t.title.toString():kTe(t.label)&&(e=t.label.toString())),e}function cjt(t,e){ajt?g.useLayoutEffect(t,e):g.useEffect(t,e)}function ujt(t){var e;return(e=t.key)!==null&&e!==void 0?e:t.value}var FTe=function(e){e.preventDefault(),e.stopPropagation()},djt=function(e){var n=e.id,o=e.prefixCls,r=e.values,i=e.open,a=e.searchValue,l=e.autoClearSearchValue,s=e.inputRef,c=e.placeholder,u=e.disabled,d=e.mode,f=e.showSearch,p=e.autoFocus,m=e.autoComplete,y=e.activeDescendantId,w=e.tabIndex,x=e.removeIcon,C=e.maxTagCount,P=e.maxTagTextLength,A=e.maxTagPlaceholder,S=A===void 0?function(de){return"+ ".concat(de.length," ...")}:A,v=e.tagRender,b=e.onToggleOpen,T=e.onRemove,R=e.onInputChange,M=e.onInputPaste,D=e.onInputKeyDown,k=e.onInputMouseDown,N=e.onInputCompositionStart,U=e.onInputCompositionEnd,W=e.onInputBlur,F=g.useRef(null),E=g.useState(0),L=Sn(E,2),j=L[0],Y=L[1],O=g.useState(!1),_=Sn(O,2),G=_[0],Q=_[1],oe="".concat(o,"-selection"),ee=i||d==="multiple"&&l===!1||d==="tags"?a:"",q=d==="tags"||d==="multiple"&&l===!1||f&&(i||G);cjt(function(){Y(F.current.scrollWidth)},[ee]);var ae=function(he,me,ce,Pe,pe){return g.createElement("span",{title:Zqe(he),className:Bn("".concat(oe,"-item"),Ut({},"".concat(oe,"-item-disabled"),ce))},g.createElement("span",{className:"".concat(oe,"-item-content")},me),Pe&&g.createElement(CZ,{className:"".concat(oe,"-item-remove"),onMouseDown:FTe,onClick:pe,customizeIcon:x},"×"))},Z=function(he,me,ce,Pe,pe,Ie){var ve=function(Ae){FTe(Ae),b(!i)};return g.createElement("span",{onMouseDown:ve},v({label:me,value:he,disabled:ce,closable:Pe,onClose:pe,isMaxTag:!!Ie}))},ne=function(he){var me=he.disabled,ce=he.label,Pe=he.value,pe=!u&&!me,Ie=ce;if(typeof P=="number"&&(typeof ce=="string"||typeof ce=="number")){var ve=String(Ie);ve.length>P&&(Ie="".concat(ve.slice(0,P),"..."))}var ze=function(se){se&&se.stopPropagation(),T(he)};return typeof v=="function"?Z(Pe,Ie,me,pe,ze):ae(he,Ie,me,pe,ze)},te=function(he){if(!r.length)return null;var me=typeof S=="function"?S(he):S;return typeof v=="function"?Z(void 0,me,!1,!1,void 0,!0):ae({title:me},me,!1)},$=g.createElement("div",{className:"".concat(oe,"-search"),style:{width:j},onFocus:function(){Q(!0)},onBlur:function(){Q(!1)}},g.createElement(qqe,{ref:s,open:i,prefixCls:o,id:n,inputElement:null,disabled:u,autoFocus:p,autoComplete:m,editable:q,activeDescendantId:y,value:ee,onKeyDown:D,onMouseDown:k,onChange:R,onPaste:M,onCompositionStart:N,onCompositionEnd:U,onBlur:W,tabIndex:w,attrs:F1(e,!0)}),g.createElement("span",{ref:F,className:"".concat(oe,"-search-mirror"),"aria-hidden":!0},ee," ")),le=g.createElement(S5,{prefixCls:"".concat(oe,"-overflow"),data:r,renderItem:ne,renderRest:te,suffix:$,itemKey:ujt,maxCount:C});return g.createElement("span",{className:"".concat(oe,"-wrap")},le,!r.length&&!ee&&g.createElement("span",{className:"".concat(oe,"-placeholder")},c))},fjt=function(e){var n=e.inputElement,o=e.prefixCls,r=e.id,i=e.inputRef,a=e.disabled,l=e.autoFocus,s=e.autoComplete,c=e.activeDescendantId,u=e.mode,d=e.open,f=e.values,p=e.placeholder,m=e.tabIndex,y=e.showSearch,w=e.searchValue,x=e.activeValue,C=e.maxLength,P=e.onInputKeyDown,A=e.onInputMouseDown,S=e.onInputChange,v=e.onInputPaste,b=e.onInputCompositionStart,T=e.onInputCompositionEnd,R=e.onInputBlur,M=e.title,D=g.useState(!1),k=Sn(D,2),N=k[0],U=k[1],W=u==="combobox",F=W||y,E=f[0],L=w||"";W&&x&&!N&&(L=x),g.useEffect(function(){W&&U(!1)},[W,x]);var j=u!=="combobox"&&!d&&!y?!1:!!L,Y=M===void 0?Zqe(E):M,O=g.useMemo(function(){return E?null:g.createElement("span",{className:"".concat(o,"-selection-placeholder"),style:j?{visibility:"hidden"}:void 0},p)},[E,j,p,o]);return g.createElement("span",{className:"".concat(o,"-selection-wrap")},g.createElement("span",{className:"".concat(o,"-selection-search")},g.createElement(qqe,{ref:i,prefixCls:o,id:r,open:d,inputElement:n,disabled:a,autoFocus:l,autoComplete:s,editable:F,activeDescendantId:c,value:L,onKeyDown:P,onMouseDown:A,onChange:function(G){U(!0),S(G)},onPaste:v,onCompositionStart:b,onCompositionEnd:T,onBlur:R,tabIndex:m,attrs:F1(e,!0),maxLength:W?C:void 0})),!W&&E?g.createElement("span",{className:"".concat(o,"-selection-item"),title:Y,style:j?{visibility:"hidden"}:void 0},E.label):null,O)},hjt=function(e,n){var o=g.useRef(null),r=g.useRef(!1),i=e.prefixCls,a=e.open,l=e.mode,s=e.showSearch,c=e.tokenWithEnter,u=e.disabled,d=e.prefix,f=e.autoClearSearchValue,p=e.onSearch,m=e.onSearchSubmit,y=e.onToggleOpen,w=e.onInputKeyDown,x=e.onInputBlur,C=e.domRef;g.useImperativeHandle(n,function(){return{focus:function(Y){o.current.focus(Y)},blur:function(){o.current.blur()}}});var P=Gqe(0),A=Sn(P,2),S=A[0],v=A[1],b=function(Y){var O=Y.which,_=o.current instanceof HTMLTextAreaElement;!_&&a&&(O===Lo.UP||O===Lo.DOWN)&&Y.preventDefault(),w&&w(Y),O===Lo.ENTER&&l==="tags"&&!r.current&&!a&&(m==null||m(Y.target.value)),!(_&&!a&&~[Lo.UP,Lo.DOWN,Lo.LEFT,Lo.RIGHT].indexOf(O))&&WUt(O)&&y(!0)},T=function(){v(!0)},R=g.useRef(null),M=function(Y){p(Y,!0,r.current)!==!1&&y(!0)},D=function(){r.current=!0},k=function(Y){r.current=!1,l!=="combobox"&&M(Y.target.value)},N=function(Y){var O=Y.target.value;if(c&&R.current&&/[\r\n]/.test(R.current)){var _=R.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");O=O.replace(_,R.current)}R.current=null,M(O)},U=function(Y){var O=Y.clipboardData,_=O==null?void 0:O.getData("text");R.current=_||""},W=function(Y){var O=Y.target;if(O!==o.current){var _=document.body.style.msTouchAction!==void 0;_?setTimeout(function(){o.current.focus()}):o.current.focus()}},F=function(Y){var O=S();Y.target!==o.current&&!O&&!(l==="combobox"&&u)&&Y.preventDefault(),(l!=="combobox"&&(!s||!O)||!a)&&(a&&f!==!1&&p("",!0,!1),y())},E={inputRef:o,onInputKeyDown:b,onInputMouseDown:T,onInputChange:N,onInputPaste:U,onInputCompositionStart:D,onInputCompositionEnd:k,onInputBlur:x},L=l==="multiple"||l==="tags"?g.createElement(djt,Uo({},e,E)):g.createElement(fjt,Uo({},e,E));return g.createElement("div",{ref:C,className:"".concat(i,"-selector"),onClick:W,onMouseDown:F},d&&g.createElement("div",{className:"".concat(i,"-prefix")},d),L)},pjt=g.forwardRef(hjt);function HL(t){"@babel/helpers - typeof";return HL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},HL(t)}function gjt(t,e){if(HL(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(HL(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mjt(t){var e=gjt(t,"string");return HL(e)==="symbol"?e:String(e)}function yjt(t,e,n){return e=mjt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function LTe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Hp(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function bjt(t,e){if(t==null)return{};var n=vjt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function iJ(){return iJ=Object.assign?Object.assign.bind():function(t){for(var e=1;e0,G=g.useState(!P||!_),Q=df(G,2),oe=Q[0],ee=Q[1];if(Ml(function(){!oe&&_&&a&&ee(!0)},[oe,_,a]),!oe)return null;var q="auto",ae={left:"-1000vw",top:"-1000vh",right:q,bottom:q};if(M||!s){var Z,ne=y.points,te=y.dynamicInset||((Z=y._experimental)===null||Z===void 0?void 0:Z.dynamicInset),$=te&&ne[0][1]==="r",le=te&&ne[0][0]==="b";$?(ae.right=N,ae.left=q):(ae.left=D,ae.right=q),le?(ae.bottom=U,ae.top=q):(ae.top=k,ae.bottom=q)}var de={};return E&&(E.includes("height")&&j?de.height=j:E.includes("minHeight")&&j&&(de.minHeight=j),E.includes("width")&&L?de.width=L:E.includes("minWidth")&&L&&(de.minWidth=L)),s||(de.pointerEvents="none"),g.createElement(S,{open:C||O,getContainer:P&&function(){return P(a)},autoDestroy:A},g.createElement(Tjt,{prefixCls:r,open:s,zIndex:v,mask:f,motion:x}),g.createElement(Ld,{onResize:W,disabled:!s},function(he){return g.createElement(Oy,iJ({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:C,leavedClassName:"".concat(r,"-hidden")},w,{onAppearPrepare:F,onEnterPrepare:F,visible:s,onVisibleChanged:function(ce){var Pe;w==null||(Pe=w.onVisibleChanged)===null||Pe===void 0||Pe.call(w,ce),l(ce)}}),function(me,ce){var Pe=me.className,pe=me.style,Ie=Bn(r,Pe,o);return g.createElement("div",{ref:oU(he,e,ce),className:Ie,style:Hp(Hp(Hp(Hp({"--arrow-x":"".concat(m.x||0,"px"),"--arrow-y":"".concat(m.y||0,"px")},ae),de),pe),{},{boxSizing:"border-box",zIndex:v},i),onMouseEnter:b,onMouseLeave:T,onPointerEnter:R,onClick:d},p&&g.createElement(Sjt,{prefixCls:r,arrow:p,arrowPos:m,align:y}),g.createElement(Pjt,{cache:!s&&!u},Y))})}))}),Rjt=g.forwardRef(function(t,e){var n=t.children,o=t.getTriggerDOMNode,r=Z8(n),i=g.useCallback(function(l){G5e(e,o?o(l):l)},[o]),a=E7(i,n.ref);return r?g.cloneElement(n,{ref:a}):n}),WTe=g.createContext(null);function NTe(t){return t?Array.isArray(t)?t:[t]:[]}function Hjt(t,e,n,o){return g.useMemo(function(){var r=NTe(n??e),i=NTe(o??e),a=new Set(r),l=new Set(i);return t&&(a.has("hover")&&(a.delete("hover"),a.add("click")),l.has("hover")&&(l.delete("hover"),l.add("click"))),[a,l]},[t,e,n,o])}const tQe=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1};function Mjt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function Ijt(t,e,n,o){for(var r=n.points,i=Object.keys(t),a=0;a1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?e:t}function $D(t){return ML(parseFloat(t),0)}function jTe(t,e){var n=Hp({},t);return(e||[]).forEach(function(o){if(!(o instanceof HTMLBodyElement||o instanceof HTMLHtmlElement)){var r=mU(o).getComputedStyle(o),i=r.overflow,a=r.overflowClipMargin,l=r.borderTopWidth,s=r.borderBottomWidth,c=r.borderLeftWidth,u=r.borderRightWidth,d=o.getBoundingClientRect(),f=o.offsetHeight,p=o.clientHeight,m=o.offsetWidth,y=o.clientWidth,w=$D(l),x=$D(s),C=$D(c),P=$D(u),A=ML(Math.round(d.width/m*1e3)/1e3),S=ML(Math.round(d.height/f*1e3)/1e3),v=(m-y-C-P)*A,b=(f-p-w-x)*S,T=w*S,R=x*S,M=C*A,D=P*A,k=0,N=0;if(i==="clip"){var U=$D(a);k=U*A,N=U*S}var W=d.x+M-k,F=d.y+T-N,E=W+d.width+2*k-M-D-v,L=F+d.height+2*N-T-R-b;n.left=Math.max(n.left,W),n.top=Math.max(n.top,F),n.right=Math.min(n.right,E),n.bottom=Math.min(n.bottom,L)}}),n}function BTe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(e),o=n.match(/^(.*)\%$/);return o?t*(parseFloat(o[1])/100):parseFloat(n)}function YTe(t,e){var n=e||[],o=df(n,2),r=o[0],i=o[1];return[BTe(t.width,r),BTe(t.height,i)]}function OTe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function EP(t,e){var n=e[0],o=e[1],r,i;return n==="t"?i=t.y:n==="b"?i=t.y+t.height:i=t.y+t.height/2,o==="l"?r=t.x:o==="r"?r=t.x+t.width:r=t.x+t.width/2,{x:r,y:i}}function pw(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map(function(o,r){return r===e?n[o]||"c":o}).join("")}function zjt(t,e,n,o,r,i,a){var l=g.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:r[o]||{}}),s=df(l,2),c=s[0],u=s[1],d=g.useRef(0),f=g.useMemo(function(){return e?phe(e):[]},[e]),p=g.useRef({}),m=function(){p.current={}};t||m();var y=Dd(function(){if(e&&n&&t){let No=function(vo,bo){var Bo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie,Pr=Y.x+vo,so=Y.y+bo,zo=Pr+Z,Ci=so+ae,ea=Math.max(Pr,Bo.left),rs=Math.max(so,Bo.top),Da=Math.min(zo,Bo.right),or=Math.min(Ci,Bo.bottom);return Math.max(0,(Da-ea)*(or-rs))},ho=function(){Ct=Y.y+nt,yt=Ct+ae,at=Y.x+Qe,Et=at+Z};var To=No,Go=ho,C,P,A=e,S=A.ownerDocument,v=mU(A),b=v.getComputedStyle(A),T=b.width,R=b.height,M=b.position,D=A.style.left,k=A.style.top,N=A.style.right,U=A.style.bottom,W=A.style.overflow,F=Hp(Hp({},r[o]),i),E=S.createElement("div");(C=A.parentElement)===null||C===void 0||C.appendChild(E),E.style.left="".concat(A.offsetLeft,"px"),E.style.top="".concat(A.offsetTop,"px"),E.style.position=M,E.style.height="".concat(A.offsetHeight,"px"),E.style.width="".concat(A.offsetWidth,"px"),A.style.left="0",A.style.top="0",A.style.right="auto",A.style.bottom="auto",A.style.overflow="hidden";var L;if(Array.isArray(n))L={x:n[0],y:n[1],width:0,height:0};else{var j=n.getBoundingClientRect();L={x:j.x,y:j.y,width:j.width,height:j.height}}var Y=A.getBoundingClientRect(),O=S.documentElement,_=O.clientWidth,G=O.clientHeight,Q=O.scrollWidth,oe=O.scrollHeight,ee=O.scrollTop,q=O.scrollLeft,ae=Y.height,Z=Y.width,ne=L.height,te=L.width,$={left:0,top:0,right:_,bottom:G},le={left:-q,top:-ee,right:Q-q,bottom:oe-ee},de=F.htmlRegion,he="visible",me="visibleFirst";de!=="scroll"&&de!==me&&(de=he);var ce=de===me,Pe=jTe(le,f),pe=jTe($,f),Ie=de===he?pe:Pe,ve=ce?pe:Ie;A.style.left="auto",A.style.top="auto",A.style.right="0",A.style.bottom="0";var ze=A.getBoundingClientRect();A.style.left=D,A.style.top=k,A.style.right=N,A.style.bottom=U,A.style.overflow=W,(P=A.parentElement)===null||P===void 0||P.removeChild(E);var Ae=ML(Math.round(Z/parseFloat(T)*1e3)/1e3),se=ML(Math.round(ae/parseFloat(R)*1e3)/1e3);if(Ae===0||se===0||ZX(n)&&!tQe(n))return;var ge=F.offset,we=F.targetOffset,Se=YTe(Y,ge),Me=df(Se,2),Ce=Me[0],Te=Me[1],Re=YTe(L,we),Ne=df(Re,2),_e=Ne[0],Ue=Ne[1];L.x-=_e,L.y-=Ue;var qe=F.points||[],Fe=df(qe,2),He=Fe[0],Le=Fe[1],Ye=OTe(Le),lt=OTe(He),Oe=EP(L,Ye),ut=EP(Y,lt),ht=Hp({},F),Qe=Oe.x-ut.x+Ce,nt=Oe.y-ut.y+Te,mt=No(Qe,nt),tt=No(Qe,nt,pe),gt=EP(L,["t","l"]),Ve=EP(Y,["t","l"]),je=EP(L,["b","r"]),et=EP(Y,["b","r"]),bt=F.overflow||{},St=bt.adjustX,Pt=bt.adjustY,Yt=bt.shiftX,zt=bt.shiftY,Rt=function(bo){return typeof bo=="boolean"?bo:bo>=0},Ct,yt,at,Et;ho();var Lt=Rt(Pt),Je=lt[0]===Ye[0];if(Lt&<[0]==="t"&&(yt>ve.bottom||p.current.bt)){var st=nt;Je?st-=ae-ne:st=gt.y-et.y-Te;var It=No(Qe,st),ot=No(Qe,st,pe);It>mt||It===mt&&(!ce||ot>=tt)?(p.current.bt=!0,nt=st,Te=-Te,ht.points=[pw(lt,0),pw(Ye,0)]):p.current.bt=!1}if(Lt&<[0]==="b"&&(Ctmt||Be===mt&&(!ce||pt>=tt)?(p.current.tb=!0,nt=it,Te=-Te,ht.points=[pw(lt,0),pw(Ye,0)]):p.current.tb=!1}var ct=Rt(St),Xe=lt[1]===Ye[1];if(ct&<[1]==="l"&&(Et>ve.right||p.current.rl)){var ft=Qe;Xe?ft-=Z-te:ft=gt.x-et.x-Ce;var wt=No(ft,nt),kt=No(ft,nt,pe);wt>mt||wt===mt&&(!ce||kt>=tt)?(p.current.rl=!0,Qe=ft,Ce=-Ce,ht.points=[pw(lt,1),pw(Ye,1)]):p.current.rl=!1}if(ct&<[1]==="r"&&(atmt||Ot===mt&&(!ce||on>=tt)?(p.current.lr=!0,Qe=Zt,Ce=-Ce,ht.points=[pw(lt,1),pw(Ye,1)]):p.current.lr=!1}ho();var qt=Yt===!0?0:Yt;typeof qt=="number"&&(atpe.right&&(Qe-=Et-pe.right-Ce,L.x>pe.right-qt&&(Qe+=L.x-pe.right+qt)));var rn=zt===!0?0:zt;typeof rn=="number"&&(Ctpe.bottom&&(nt-=yt-pe.bottom-Te,L.y>pe.bottom-rn&&(nt+=L.y-pe.bottom+rn)));var Pn=Y.x+Qe,fo=Pn+Z,to=Y.y+nt,Dt=to+ae,fn=L.x,kn=fn+te,yo=L.y,ur=yo+ne,lr=Math.max(Pn,fn),xo=Math.min(fo,kn),wo=(lr+xo)/2,Rr=wo-Pn,Eo=Math.max(to,yo),An=Math.min(Dt,ur),Dn=(Eo+An)/2,sr=Dn-to;a==null||a(e,ht);var Vo=ze.right-Y.x-(Qe+Y.width),Wo=ze.bottom-Y.y-(nt+Y.height);u({ready:!0,offsetX:Qe/Ae,offsetY:nt/se,offsetR:Vo/Ae,offsetB:Wo/se,arrowX:Rr/Ae,arrowY:sr/se,scaleX:Ae,scaleY:se,align:ht})}}),w=function(){d.current+=1;var P=d.current;Promise.resolve().then(function(){d.current===P&&y()})},x=function(){u(function(P){return Hp(Hp({},P),{},{ready:!1})})};return Ml(x,[o]),Ml(function(){t||x()},[t]),[c.ready,c.offsetX,c.offsetY,c.offsetR,c.offsetB,c.arrowX,c.arrowY,c.scaleX,c.scaleY,c.align,w]}function Djt(t){if(Array.isArray(t))return hhe(t)}function Ejt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kjt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Te(t){return Djt(t)||Ejt(t)||eQe(t)||kjt()}function Fjt(t,e,n,o,r){Ml(function(){if(t&&e&&n){let f=function(){o(),r()};var d=f,i=e,a=n,l=phe(i),s=phe(a),c=mU(a),u=new Set([c].concat(_Te(l),_Te(s)));return u.forEach(function(p){p.addEventListener("scroll",f,{passive:!0})}),c.addEventListener("resize",f,{passive:!0}),o(),function(){u.forEach(function(p){p.removeEventListener("scroll",f),c.removeEventListener("resize",f)})}}},[t,e,n])}function Ljt(t,e,n,o,r,i,a,l){var s=g.useRef(t);s.current=t,g.useEffect(function(){if(e&&o&&(!r||i)){var c=function(p){var m=p.target;s.current&&!a(m)&&l(!1)},u=mU(o);u.addEventListener("mousedown",c,!0),u.addEventListener("contextmenu",c,!0);var d=QX(n);return d&&(d.addEventListener("mousedown",c,!0),d.addEventListener("contextmenu",c,!0)),function(){u.removeEventListener("mousedown",c,!0),u.removeEventListener("contextmenu",c,!0),d&&(d.removeEventListener("mousedown",c,!0),d.removeEventListener("contextmenu",c,!0))}}},[e,n,o,r,i])}var Wjt=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function Njt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:uU,e=g.forwardRef(function(n,o){var r=n.prefixCls,i=r===void 0?"rc-trigger-popup":r,a=n.children,l=n.action,s=l===void 0?"hover":l,c=n.showAction,u=n.hideAction,d=n.popupVisible,f=n.defaultPopupVisible,p=n.onPopupVisibleChange,m=n.afterPopupVisibleChange,y=n.mouseEnterDelay,w=n.mouseLeaveDelay,x=w===void 0?.1:w,C=n.focusDelay,P=n.blurDelay,A=n.mask,S=n.maskClosable,v=S===void 0?!0:S,b=n.getPopupContainer,T=n.forceRender,R=n.autoDestroy,M=n.destroyPopupOnHide,D=n.popup,k=n.popupClassName,N=n.popupStyle,U=n.popupPlacement,W=n.builtinPlacements,F=W===void 0?{}:W,E=n.popupAlign,L=n.zIndex,j=n.stretch,Y=n.getPopupClassNameFromAlign,O=n.fresh,_=n.alignPoint,G=n.onPopupClick,Q=n.onPopupAlign,oe=n.arrow,ee=n.popupMotion,q=n.maskMotion,ae=n.popupTransitionName,Z=n.popupAnimation,ne=n.maskTransitionName,te=n.maskAnimation,$=n.className,le=n.getTriggerDOMNode,de=bjt(n,Wjt),he=R||M||!1,me=g.useState(!1),ce=df(me,2),Pe=ce[0],pe=ce[1];Ml(function(){pe(d9e())},[]);var Ie=g.useRef({}),ve=g.useContext(WTe),ze=g.useMemo(function(){return{registerSubPopup:function(cr,ii){Ie.current[cr]=ii,ve==null||ve.registerSubPopup(cr,ii)}}},[ve]),Ae=pqe(),se=g.useState(null),ge=df(se,2),we=ge[0],Se=ge[1],Me=g.useRef(null),Ce=Dd(function(or){Me.current=or,ZX(or)&&we!==or&&Se(or),ve==null||ve.registerSubPopup(Ae,or)}),Te=g.useState(null),Re=df(Te,2),Ne=Re[0],_e=Re[1],Ue=g.useRef(null),qe=Dd(function(or){ZX(or)&&Ne!==or&&(_e(or),Ue.current=or)}),Fe=g.Children.only(a),He=(Fe==null?void 0:Fe.props)||{},Le={},Ye=Dd(function(or){var cr,ii,Ga=Ne;return(Ga==null?void 0:Ga.contains(or))||((cr=QX(Ga))===null||cr===void 0?void 0:cr.host)===or||or===Ga||(we==null?void 0:we.contains(or))||((ii=QX(we))===null||ii===void 0?void 0:ii.host)===or||or===we||Object.values(Ie.current).some(function(xi){return(xi==null?void 0:xi.contains(or))||or===xi})}),lt=UTe(i,ee,Z,ae),Oe=UTe(i,q,te,ne),ut=g.useState(f||!1),ht=df(ut,2),Qe=ht[0],nt=ht[1],mt=d??Qe,tt=Dd(function(or){d===void 0&&nt(or)});Ml(function(){nt(d||!1)},[d]);var gt=g.useRef(mt);gt.current=mt;var Ve=g.useRef([]);Ve.current=[];var je=Dd(function(or){var cr;tt(or),((cr=Ve.current[Ve.current.length-1])!==null&&cr!==void 0?cr:mt)!==or&&(Ve.current.push(or),p==null||p(or))}),et=g.useRef(),bt=function(){clearTimeout(et.current)},St=function(cr){var ii=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;bt(),ii===0?je(cr):et.current=setTimeout(function(){je(cr)},ii*1e3)};g.useEffect(function(){return bt},[]);var Pt=g.useState(!1),Yt=df(Pt,2),zt=Yt[0],Rt=Yt[1];Ml(function(or){(!or||mt)&&Rt(!0)},[mt]);var Ct=g.useState(null),yt=df(Ct,2),at=yt[0],Et=yt[1],Lt=g.useState([0,0]),Je=df(Lt,2),st=Je[0],It=Je[1],ot=function(cr){It([cr.clientX,cr.clientY])},it=zjt(mt,we,_?st:Ne,U,F,E,Q),Be=df(it,11),pt=Be[0],ct=Be[1],Xe=Be[2],ft=Be[3],wt=Be[4],kt=Be[5],Zt=Be[6],Ot=Be[7],on=Be[8],qt=Be[9],rn=Be[10],Pn=Hjt(Pe,s,c,u),fo=df(Pn,2),to=fo[0],Dt=fo[1],fn=to.has("click"),kn=Dt.has("click")||Dt.has("contextMenu"),yo=Dd(function(){zt||rn()}),ur=function(){gt.current&&_&&kn&&St(!1)};Fjt(mt,Ne,we,yo,ur),Ml(function(){yo()},[st,U]),Ml(function(){mt&&!(F!=null&&F[U])&&yo()},[JSON.stringify(E)]);var lr=g.useMemo(function(){var or=Ijt(F,i,qt,_);return Bn(or,Y==null?void 0:Y(qt))},[qt,Y,F,i,_]);g.useImperativeHandle(o,function(){return{nativeElement:Ue.current,popupElement:Me.current,forceAlign:yo}});var xo=g.useState(0),wo=df(xo,2),Rr=wo[0],Eo=wo[1],An=g.useState(0),Dn=df(An,2),sr=Dn[0],Vo=Dn[1],Wo=function(){if(j&&Ne){var cr=Ne.getBoundingClientRect();Eo(cr.width),Vo(cr.height)}},To=function(){Wo(),yo()},Go=function(cr){Rt(!1),rn(),m==null||m(cr)},No=function(){return new Promise(function(cr){Wo(),Et(function(){return cr})})};Ml(function(){at&&(rn(),at(),Et(null))},[at]);function ho(or,cr,ii,Ga){Le[or]=function(xi){var Uu;Ga==null||Ga(xi),St(cr,ii);for(var _s=arguments.length,sc=new Array(_s>1?_s-1:0),ta=1;ta<_s;ta++)sc[ta-1]=arguments[ta];(Uu=He[or])===null||Uu===void 0||Uu.call.apply(Uu,[He,xi].concat(sc))}}(fn||kn)&&(Le.onClick=function(or){var cr;gt.current&&kn?St(!1):!gt.current&&fn&&(ot(or),St(!0));for(var ii=arguments.length,Ga=new Array(ii>1?ii-1:0),xi=1;xi1?ii-1:0),xi=1;xi1&&arguments[1]!==void 0?arguments[1]:{},n=e.fieldNames,o=e.childrenAsData,r=[],i=nQe(n,!1),a=i.label,l=i.value,s=i.options,c=i.groupLabel;function u(d,f){Array.isArray(d)&&d.forEach(function(p){if(f||!(s in p)){var m=p[l];r.push({key:VTe(p,r.length),groupOption:f,data:p,label:p[a],value:m})}else{var y=p[c];y===void 0&&o&&(y=p.label),r.push({key:VTe(p,r.length),group:!0,data:p,label:y}),u(p[s],!0)}})}return u(t,!1),r}function mhe(t){var e=nn({},t);return"props"in e||Object.defineProperty(e,"props",{get:function(){return Ds(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),e}}),e}var _jt=function(e,n,o){if(!n||!n.length)return null;var r=!1,i=function l(s,c){var u=VKe(c),d=u[0],f=u.slice(1);if(!d)return[s];var p=s.split(d);return r=r||p.length>1,p.reduce(function(m,y){return[].concat($o(m),$o(l(y,f)))},[]).filter(Boolean)},a=i(e,n);return r?typeof o<"u"?a.slice(0,o):a:null},f9e=g.createContext(null);function Vjt(t){var e=t.visible,n=t.values;if(!e)return null;var o=50;return g.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(n.slice(0,o).map(function(r){var i=r.label,a=r.value;return["number","string"].includes(Vr(i))?i:a}).join(", ")),n.length>o?", ...":null)}var Gjt=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],Xjt=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],yhe=function(e){return e==="tags"||e==="multiple"},Jjt=g.forwardRef(function(t,e){var n,o=t.id,r=t.prefixCls,i=t.className,a=t.showSearch,l=t.tagRender,s=t.direction,c=t.omitDomProps,u=t.displayValues,d=t.onDisplayValuesChange,f=t.emptyOptions,p=t.notFoundContent,m=p===void 0?"Not Found":p,y=t.onClear,w=t.mode,x=t.disabled,C=t.loading,P=t.getInputElement,A=t.getRawInputElement,S=t.open,v=t.defaultOpen,b=t.onDropdownVisibleChange,T=t.activeValue,R=t.onActiveValueChange,M=t.activeDescendantId,D=t.searchValue,k=t.autoClearSearchValue,N=t.onSearch,U=t.onSearchSplit,W=t.tokenSeparators,F=t.allowClear,E=t.prefix,L=t.suffixIcon,j=t.clearIcon,Y=t.OptionList,O=t.animation,_=t.transitionName,G=t.dropdownStyle,Q=t.dropdownClassName,oe=t.dropdownMatchSelectWidth,ee=t.dropdownRender,q=t.dropdownAlign,ae=t.placement,Z=t.builtinPlacements,ne=t.getPopupContainer,te=t.showAction,$=te===void 0?[]:te,le=t.onFocus,de=t.onBlur,he=t.onKeyUp,me=t.onKeyDown,ce=t.onMouseDown,Pe=Ai(t,Gjt),pe=yhe(w),Ie=(a!==void 0?a:pe)||w==="combobox",ve=nn({},Pe);Xjt.forEach(function(xo){delete ve[xo]}),c==null||c.forEach(function(xo){delete ve[xo]});var ze=g.useState(!1),Ae=Sn(ze,2),se=Ae[0],ge=Ae[1];g.useEffect(function(){ge(d9e())},[]);var we=g.useRef(null),Se=g.useRef(null),Me=g.useRef(null),Ce=g.useRef(null),Te=g.useRef(null),Re=g.useRef(!1),Ne=FUt(),_e=Sn(Ne,3),Ue=_e[0],qe=_e[1],Fe=_e[2];g.useImperativeHandle(e,function(){var xo,wo;return{focus:(xo=Ce.current)===null||xo===void 0?void 0:xo.focus,blur:(wo=Ce.current)===null||wo===void 0?void 0:wo.blur,scrollTo:function(Eo){var An;return(An=Te.current)===null||An===void 0?void 0:An.scrollTo(Eo)},nativeElement:we.current||Se.current}});var He=g.useMemo(function(){var xo;if(w!=="combobox")return D;var wo=(xo=u[0])===null||xo===void 0?void 0:xo.value;return typeof wo=="string"||typeof wo=="number"?String(wo):""},[D,w,u]),Le=w==="combobox"&&typeof P=="function"&&P()||null,Ye=typeof A=="function"&&A(),lt=E7(Se,Ye==null||(n=Ye.props)===null||n===void 0?void 0:n.ref),Oe=g.useState(!1),ut=Sn(Oe,2),ht=ut[0],Qe=ut[1];Ml(function(){Qe(!0)},[]);var nt=o0(!1,{defaultValue:v,value:S}),mt=Sn(nt,2),tt=mt[0],gt=mt[1],Ve=ht?tt:!1,je=!m&&f;(x||je&&Ve&&w==="combobox")&&(Ve=!1);var et=je?!1:Ve,bt=g.useCallback(function(xo){var wo=xo!==void 0?xo:!Ve;x||(gt(wo),Ve!==wo&&(b==null||b(wo)))},[x,Ve,gt,b]),St=g.useMemo(function(){return(W||[]).some(function(xo){return[` + ${e}-confirm-body-wrapper`]:{display:"flex",flexDirection:"column",flex:"auto"},[`${e}-confirm-body`]:{marginBottom:"auto"}}}]},yUt=t=>{const{componentCls:e}=t;return{[`${e}-root`]:{[`${e}-wrap-rtl`]:{direction:"rtl",[`${e}-confirm-body`]:{direction:"rtl"}}}}},AUt=t=>{const{componentCls:e}=t,n=Mqe(t);delete n.xs;const o=Object.keys(n).map(r=>({[`@media (min-width: ${jt(n[r])})`]:{width:`var(--${e.replace(".","")}-${r}-width)`}}));return{[`${e}-root`]:{[e]:[{width:`var(--${e.replace(".","")}-xs-width)`}].concat(Pa(o))}}},zqe=t=>{const e=t.padding,n=t.fontSizeHeading5,o=t.lineHeightHeading5;return Ui(t,{modalHeaderHeight:t.calc(t.calc(o).mul(n).equal()).add(t.calc(e).mul(2).equal()).equal(),modalFooterBorderColorSplit:t.colorSplit,modalFooterBorderStyle:t.lineType,modalFooterBorderWidth:t.lineWidth,modalCloseIconColor:t.colorIcon,modalCloseIconHoverColor:t.colorIconHover,modalCloseBtnSize:t.controlHeight,modalConfirmIconSize:t.fontHeight,modalTitleHeight:t.calc(t.titleFontSize).mul(t.titleLineHeight).equal()})},Dqe=t=>({footerBg:"transparent",headerBg:t.colorBgElevated,titleLineHeight:t.lineHeightHeading5,titleFontSize:t.fontSizeHeading5,contentBg:t.colorBgElevated,titleColor:t.colorTextHeading,contentPadding:t.wireframe?0:`${jt(t.paddingMD)} ${jt(t.paddingContentHorizontalLG)}`,headerPadding:t.wireframe?`${jt(t.padding)} ${jt(t.paddingLG)}`:0,headerBorderBottom:t.wireframe?`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",headerMarginBottom:t.wireframe?0:t.marginXS,bodyPadding:t.wireframe?t.paddingLG:0,footerPadding:t.wireframe?`${jt(t.paddingXS)} ${jt(t.padding)}`:0,footerBorderTop:t.wireframe?`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",footerBorderRadius:t.wireframe?`0 0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)}`:0,footerMarginTop:t.wireframe?0:t.marginSM,confirmBodyPadding:t.wireframe?`${jt(t.padding*2)} ${jt(t.padding*2)} ${jt(t.paddingLG)}`:0,confirmIconMarginInlineEnd:t.wireframe?t.margin:t.marginSM,confirmBtnsMarginTop:t.wireframe?t.marginLG:t.marginSM}),Eqe=el("Modal",t=>{const e=zqe(t);return[mUt(e),yUt(e),Iqe(e),QM(e,"zoom"),AUt(e)]},Dqe,{unitless:{titleLineHeight:!0}});var wUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{dhe={x:t.pageX,y:t.pageY},setTimeout(()=>{dhe=null},100)};jNt()&&document.documentElement.addEventListener("click",xUt,!0);const kqe=t=>{var e;const{getPopupContainer:n,getPrefixCls:o,direction:r,modal:i}=g.useContext(gr),a=ee=>{const{onCancel:$}=t;$==null||$(ee)},l=ee=>{const{onOk:$}=t;$==null||$(ee)},{prefixCls:s,className:c,rootClassName:u,open:d,wrapClassName:f,centered:p,getContainer:m,focusTriggerAfterClose:y=!0,style:w,visible:x,width:C=520,footer:P,classNames:A,styles:S,children:v,loading:b}=t,T=wUt(t,["prefixCls","className","rootClassName","open","wrapClassName","centered","getContainer","focusTriggerAfterClose","style","visible","width","footer","classNames","styles","children","loading"]),R=o("modal",s),M=o(),D=nu(R),[k,N,U]=Eqe(R,D),W=Mn(f,{[`${R}-centered`]:!!p,[`${R}-wrap-rtl`]:r==="rtl"}),F=P!==null&&!b?g.createElement(Hqe,Object.assign({},t,{onOk:l,onCancel:a})):null,[E,L,j]=u9e(SH(t),SH(i),{closable:!0,closeIcon:g.createElement(i6,{className:`${R}-close-icon`}),closeIconRender:ee=>Rqe(R,ee)}),Y=Cqe(`.${R}-content`),[O,_]=a6("Modal",T.zIndex),[G,Q]=g.useMemo(()=>C&&typeof C=="object"?[void 0,C]:[C,void 0],[C]),oe=g.useMemo(()=>{const ee={};return Q&&Object.keys(Q).forEach($=>{const ae=Q[$];ae!==void 0&&(ee[`--${R}-${$}-width`]=typeof ae=="number"?`${ae}px`:ae)}),ee},[Q]);return k(g.createElement(E3,{form:!0,space:!0},g.createElement(iU.Provider,{value:_},g.createElement(l9e,Object.assign({width:G},T,{zIndex:O,getContainer:m===void 0?n:m,prefixCls:R,rootClassName:Mn(N,u,U,D),footer:F,visible:d??x,mousePosition:(e=T.mousePosition)!==null&&e!==void 0?e:dhe,onClose:a,closable:E&&{disabled:j,closeIcon:L},closeIcon:L,focusTriggerAfterClose:y,transitionName:L1(M,"zoom",t.transitionName),maskTransitionName:L1(M,"fade",t.maskTransitionName),className:Mn(N,c,i==null?void 0:i.className),style:Object.assign(Object.assign(Object.assign({},i==null?void 0:i.style),w),oe),classNames:Object.assign(Object.assign(Object.assign({},i==null?void 0:i.classNames),A),{wrapper:Mn(W,A==null?void 0:A.wrapper)}),styles:Object.assign(Object.assign({},i==null?void 0:i.styles),S),panelRef:Y}),b?g.createElement(NS,{active:!0,title:!1,paragraph:{rows:4},className:`${R}-body-skeleton`}):v))))},vUt=t=>{const{componentCls:e,titleFontSize:n,titleLineHeight:o,modalConfirmIconSize:r,fontSize:i,lineHeight:a,modalTitleHeight:l,fontHeight:s,confirmBodyPadding:c}=t,u=`${e}-confirm`;return{[u]:{"&-rtl":{direction:"rtl"},[`${t.antCls}-modal-header`]:{display:"none"},[`${u}-body-wrapper`]:Object.assign({},vL()),[`&${e} ${e}-body`]:{padding:c},[`${u}-body`]:{display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t.iconCls}`]:{flex:"none",fontSize:r,marginInlineEnd:t.confirmIconMarginInlineEnd,marginTop:t.calc(t.calc(s).sub(r).equal()).div(2).equal()},[`&-has-title > ${t.iconCls}`]:{marginTop:t.calc(t.calc(l).sub(r).equal()).div(2).equal()}},[`${u}-paragraph`]:{display:"flex",flexDirection:"column",flex:"auto",rowGap:t.marginXS,maxWidth:`calc(100% - ${jt(t.marginSM)})`},[`${t.iconCls} + ${u}-paragraph`]:{maxWidth:`calc(100% - ${jt(t.calc(t.modalConfirmIconSize).add(t.marginSM).equal())})`},[`${u}-title`]:{color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:n,lineHeight:o},[`${u}-content`]:{color:t.colorText,fontSize:i,lineHeight:a},[`${u}-btns`]:{textAlign:"end",marginTop:t.confirmBtnsMarginTop,[`${t.antCls}-btn + ${t.antCls}-btn`]:{marginBottom:0,marginInlineStart:t.marginXS}}},[`${u}-error ${u}-body > ${t.iconCls}`]:{color:t.colorError},[`${u}-warning ${u}-body > ${t.iconCls}, + ${u}-confirm ${u}-body > ${t.iconCls}`]:{color:t.colorWarning},[`${u}-info ${u}-body > ${t.iconCls}`]:{color:t.colorInfo},[`${u}-success ${u}-body > ${t.iconCls}`]:{color:t.colorSuccess}}},bUt=rU(["Modal","confirm"],t=>{const e=zqe(t);return[vUt(e)]},Dqe,{order:-1e3});var SUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rC,Pa(Object.values(C))),A=g.createElement(g.Fragment,null,g.createElement(oTe,null),g.createElement(rTe,null)),S=t.title!==void 0&&t.title!==null,v=`${i}-body`;return g.createElement("div",{className:`${i}-body-wrapper`},g.createElement("div",{className:Mn(v,{[`${v}-has-title`]:S})},d,g.createElement("div",{className:`${i}-paragraph`},S&&g.createElement("span",{className:`${i}-title`},t.title),g.createElement("div",{className:`${i}-content`},t.content))),s===void 0||typeof s=="function"?g.createElement(dqe,{value:P},g.createElement("div",{className:`${i}-btns`},typeof s=="function"?s(A,{OkBtn:rTe,CancelBtn:oTe}):A)):s,g.createElement(bUt,{prefixCls:e}))}const TUt=t=>{const{close:e,zIndex:n,maskStyle:o,direction:r,prefixCls:i,wrapClassName:a,rootPrefixCls:l,bodyStyle:s,closable:c=!1,onConfirm:u,styles:d}=t,f=`${i}-confirm`,p=t.width||416,m=t.style||{},y=t.mask===void 0?!0:t.mask,w=t.maskClosable===void 0?!1:t.maskClosable,x=Mn(f,`${f}-${t.type}`,{[`${f}-rtl`]:r==="rtl"},t.className),[,C]=Ff(),P=g.useMemo(()=>n!==void 0?n:C.zIndexPopupBase+V$e,[n,C]);return g.createElement(kqe,Object.assign({},t,{className:x,wrapClassName:Mn({[`${f}-centered`]:!!t.centered},a),onCancel:()=>{e==null||e({triggerCancel:!0}),u==null||u(!1)},title:"",footer:null,transitionName:L1(l||"","zoom",t.transitionName),maskTransitionName:L1(l||"","fade",t.maskTransitionName),mask:y,maskClosable:w,style:m,styles:Object.assign({body:s,mask:o},d),width:p,zIndex:P,closable:c}),g.createElement(Fqe,Object.assign({},t,{confirmPrefixCls:f})))},Lqe=t=>{const{rootPrefixCls:e,iconPrefixCls:n,direction:o,theme:r}=t;return g.createElement(n2,{prefixCls:e,iconPrefixCls:n,direction:o,theme:r},g.createElement(TUt,Object.assign({},t)))},jv=[];let Wqe="";function Nqe(){return Wqe}const PUt=t=>{var e,n;const{prefixCls:o,getContainer:r,direction:i}=t,a=HKe(),l=g.useContext(gr),s=Nqe()||l.getPrefixCls(),c=o||`${s}-modal`;let u=r;return u===!1&&(u=void 0),xe.createElement(Lqe,Object.assign({},t,{rootPrefixCls:s,prefixCls:c,iconPrefixCls:l.iconPrefixCls,theme:l.theme,direction:i??l.direction,locale:(n=(e=l.locale)===null||e===void 0?void 0:e.Modal)!==null&&n!==void 0?n:a,getContainer:u}))};function pU(t){const e=y$e(),n=document.createDocumentFragment();let o=Object.assign(Object.assign({},t),{close:s,open:!0}),r,i;function a(){for(var u,d=arguments.length,f=new Array(d),p=0;pw==null?void 0:w.triggerCancel)){var y;(u=t.onCancel)===null||u===void 0||(y=u).call.apply(y,[t,()=>{}].concat(Pa(f.slice(1))))}for(let w=0;w{const d=e.getPrefixCls(void 0,Nqe()),f=e.getIconPrefixCls(),p=e.getTheme(),m=xe.createElement(PUt,Object.assign({},u));i=e9e()(xe.createElement(n2,{prefixCls:d,iconPrefixCls:f,theme:p},e.holderRender?e.holderRender(m):m),n)})}function s(){for(var u=arguments.length,d=new Array(u),f=0;f{typeof t.afterClose=="function"&&t.afterClose(),a.apply(this,d)}}),o.visible&&delete o.visible,l(o)}function c(u){typeof u=="function"?o=u(o):o=Object.assign(Object.assign({},o),u),l(o)}return l(o),jv.push(s),{destroy:s,update:c}}function Uqe(t){return Object.assign(Object.assign({},t),{type:"warning"})}function jqe(t){return Object.assign(Object.assign({},t),{type:"info"})}function Bqe(t){return Object.assign(Object.assign({},t),{type:"success"})}function Yqe(t){return Object.assign(Object.assign({},t),{type:"error"})}function Oqe(t){return Object.assign(Object.assign({},t),{type:"confirm"})}function CUt(t){let{rootPrefixCls:e}=t;Wqe=e}var RUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,{afterClose:o,config:r}=t,i=RUt(t,["afterClose","config"]);const[a,l]=g.useState(!0),[s,c]=g.useState(r),{direction:u,getPrefixCls:d}=g.useContext(gr),f=d("modal"),p=d(),m=()=>{var C;o(),(C=s.afterClose)===null||C===void 0||C.call(s)},y=function(){var C;l(!1);for(var P=arguments.length,A=new Array(P),S=0;ST==null?void 0:T.triggerCancel)){var b;(C=s.onCancel)===null||C===void 0||(b=C).call.apply(b,[s,()=>{}].concat(Pa(A.slice(1))))}};g.useImperativeHandle(e,()=>({destroy:y,update:C=>{c(P=>Object.assign(Object.assign({},P),C))}}));const w=(n=s.okCancel)!==null&&n!==void 0?n:s.type==="confirm",[x]=r6("Modal",I3.Modal);return g.createElement(Lqe,Object.assign({prefixCls:f,rootPrefixCls:p},s,{close:y,open:a,afterClose:m,okText:s.okText||(w?x==null?void 0:x.okText:x==null?void 0:x.justOkText),direction:s.direction||u,cancelText:s.cancelText||(x==null?void 0:x.cancelText)},i))},MUt=g.forwardRef(HUt);let ETe=0;const IUt=g.memo(g.forwardRef((t,e)=>{const[n,o]=nFt();return g.useImperativeHandle(e,()=>({patchElement:o}),[]),g.createElement(g.Fragment,null,n)}));function zUt(){const t=g.useRef(null),[e,n]=g.useState([]);g.useEffect(()=>{e.length&&(Pa(e).forEach(a=>{a()}),n([]))},[e]);const o=g.useCallback(i=>function(l){var s;ETe+=1;const c=g.createRef();let u;const d=new Promise(w=>{u=w});let f=!1,p;const m=g.createElement(MUt,{key:`modal-${ETe}`,config:i(l),ref:c,afterClose:()=>{p==null||p()},isSilent:()=>f,onConfirm:w=>{u(w)}});return p=(s=t.current)===null||s===void 0?void 0:s.patchElement(m),p&&jv.push(p),{destroy:()=>{function w(){var x;(x=c.current)===null||x===void 0||x.destroy()}c.current?w():n(x=>[].concat(Pa(x),[w]))},update:w=>{function x(){var C;(C=c.current)===null||C===void 0||C.update(w)}c.current?x():n(C=>[].concat(Pa(C),[x]))},then:w=>(f=!0,d.then(w))}},[]);return[g.useMemo(()=>({info:o(jqe),success:o(Bqe),error:o(Yqe),warning:o(Uqe),confirm:o(Oqe)}),[]),g.createElement(IUt,{key:"modal-holder",ref:t})]}const DUt=xe.createContext({});function _qe(t){return e=>g.createElement(n2,{theme:{token:{motion:!1,zIndexPopupBase:0}}},g.createElement(t,Object.assign({},e)))}const gU=(t,e,n,o,r)=>_qe(a=>{const{prefixCls:l,style:s}=a,c=g.useRef(null),[u,d]=g.useState(0),[f,p]=g.useState(0),[m,y]=qA(!1,{value:a.open}),{getPrefixCls:w}=g.useContext(gr),x=w(o||"select",l);g.useEffect(()=>{if(y(!0),typeof ResizeObserver<"u"){const A=new ResizeObserver(v=>{const b=v[0].target;d(b.offsetHeight+8),p(b.offsetWidth)}),S=setInterval(()=>{var v;const b=r?`.${r(x)}`:`.${x}-dropdown`,T=(v=c.current)===null||v===void 0?void 0:v.querySelector(b);T&&(clearInterval(S),A.observe(T))},10);return()=>{clearInterval(S),A.disconnect()}}},[]);let C=Object.assign(Object.assign({},a),{style:Object.assign(Object.assign({},s),{margin:0}),open:m,visible:m,getPopupContainer:()=>c.current});e&&Object.assign(C,{[e]:{overflow:{adjustX:!1,adjustY:!1}}});const P={paddingBottom:u,position:"relative",minWidth:f};return g.createElement("div",{ref:c,style:P},g.createElement(t,Object.assign({},C)))}),d9e=function(){if(typeof navigator>"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var CZ=function(e){var n=e.className,o=e.customizeIcon,r=e.customizeIconProps,i=e.children,a=e.onMouseDown,l=e.onClick,s=typeof o=="function"?o(r):o;return g.createElement("span",{className:n,onMouseDown:function(u){u.preventDefault(),a==null||a(u)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:l,"aria-hidden":!0},s!==void 0?s:g.createElement("span",{className:Bn(n.split(/\s+/).map(function(c){return"".concat(c,"-icon")}))},i))},EUt=function(e,n,o,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,l=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,c=xe.useMemo(function(){if(Vr(r)==="object")return r.clearIcon;if(i)return i},[r,i]),u=xe.useMemo(function(){return!!(!a&&r&&(o.length||l)&&!(s==="combobox"&&l===""))},[r,a,o.length,l,s]);return{allowClear:u,clearIcon:xe.createElement(CZ,{className:"".concat(e,"-clear"),onMouseDown:n,customizeIcon:c},"×")}},Vqe=g.createContext(null);function kUt(){return g.useContext(Vqe)}function FUt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,e=g.useState(!1),n=Sn(e,2),o=n[0],r=n[1],i=g.useRef(null),a=function(){window.clearTimeout(i.current)};g.useEffect(function(){return a},[]);var l=function(c,u){a(),i.current=window.setTimeout(function(){r(c),u&&u()},t)};return[o,l,a]}function Gqe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,e=g.useRef(null),n=g.useRef(null);g.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]);function o(r){(r||e.current===null)&&(e.current=r),window.clearTimeout(n.current),n.current=window.setTimeout(function(){e.current=null},t)}return[function(){return e.current},o]}function LUt(t,e,n,o){var r=g.useRef(null);r.current={open:e,triggerOpen:n,customizedTrigger:o},g.useEffect(function(){function i(a){var l;if(!((l=r.current)!==null&&l!==void 0&&l.customizedTrigger)){var s=a.target;s.shadowRoot&&a.composed&&(s=a.composedPath()[0]||s),r.current.open&&t().filter(function(c){return c}).every(function(c){return!c.contains(s)&&c!==s})&&r.current.triggerOpen(!1)}}return window.addEventListener("mousedown",i),function(){return window.removeEventListener("mousedown",i)}},[])}function WUt(t){return t&&![Lo.ESC,Lo.SHIFT,Lo.BACKSPACE,Lo.TAB,Lo.WIN_KEY,Lo.ALT,Lo.META,Lo.WIN_KEY_RIGHT,Lo.CTRL,Lo.SEMICOLON,Lo.EQUALS,Lo.CAPS_LOCK,Lo.CONTEXT_MENU,Lo.F1,Lo.F2,Lo.F3,Lo.F4,Lo.F5,Lo.F6,Lo.F7,Lo.F8,Lo.F9,Lo.F10,Lo.F11,Lo.F12].includes(t)}var fhe=g.createContext(null);function NUt(t){var e=t.children,n=t.onBatchResize,o=g.useRef(0),r=g.useRef([]),i=g.useContext(fhe),a=g.useCallback(function(l,s,c){o.current+=1;var u=o.current;r.current.push({size:l,element:s,data:c}),Promise.resolve().then(function(){u===o.current&&(n==null||n(r.current),r.current=[])}),i==null||i(l,s,c)},[n,i]);return g.createElement(fhe.Provider,{value:a},e)}var f8=new Map;function UUt(t){t.forEach(function(e){var n,o=e.target;(n=f8.get(o))===null||n===void 0||n.forEach(function(r){return r(o)})})}var Xqe=new VJe(UUt);function jUt(t,e){f8.has(t)||(f8.set(t,new Set),Xqe.observe(t)),f8.get(t).add(e)}function BUt(t,e){f8.has(t)&&(f8.get(t).delete(e),f8.get(t).size||(Xqe.unobserve(t),f8.delete(t)))}var YUt=function(t){XM(n,t);var e=JM(n);function n(){return Uh(this,n),e.apply(this,arguments)}return jh(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function OUt(t,e){var n=t.children,o=t.disabled,r=g.useRef(null),i=g.useRef(null),a=g.useContext(fhe),l=typeof n=="function",s=l?n(r):n,c=g.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),u=!l&&g.isValidElement(s)&&Z8(s),d=u?s.ref:null,f=E7(d,r),p=function(){var x;return jk(r.current)||(r.current&&Vr(r.current)==="object"?jk((x=r.current)===null||x===void 0?void 0:x.nativeElement):null)||jk(i.current)};g.useImperativeHandle(e,function(){return p()});var m=g.useRef(t);m.current=t;var y=g.useCallback(function(w){var x=m.current,C=x.onResize,P=x.data,A=w.getBoundingClientRect(),S=A.width,v=A.height,b=w.offsetWidth,T=w.offsetHeight,R=Math.floor(S),M=Math.floor(v);if(c.current.width!==R||c.current.height!==M||c.current.offsetWidth!==b||c.current.offsetHeight!==T){var D={width:R,height:M,offsetWidth:b,offsetHeight:T};c.current=D;var k=b===Math.round(S)?S:b,N=T===Math.round(v)?v:T,U=nn(nn({},D),{},{offsetWidth:k,offsetHeight:N});a==null||a(U,w,P),C&&Promise.resolve().then(function(){C(U,w)})}},[]);return g.useEffect(function(){var w=p();return w&&!o&&jUt(w,y),function(){return BUt(w,y)}},[r.current,o]),g.createElement(YUt,{ref:i},u?g.cloneElement(s,{ref:f}):s)}var _Ut=g.forwardRef(OUt),VUt="rc-observer-key";function GUt(t,e){var n=t.children,o=typeof n=="function"?[n]:t7(n);return o.map(function(r,i){var a=(r==null?void 0:r.key)||"".concat(VUt,"-").concat(i);return g.createElement(_Ut,Uo({},t,{key:a,ref:i===0?e:void 0}),r)})}var Ld=g.forwardRef(GUt);Ld.Collection=NUt;var XUt=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],DP=void 0;function JUt(t,e){var n=t.prefixCls,o=t.invalidate,r=t.item,i=t.renderItem,a=t.responsive,l=t.responsiveDisabled,s=t.registerSize,c=t.itemKey,u=t.className,d=t.style,f=t.children,p=t.display,m=t.order,y=t.component,w=y===void 0?"div":y,x=Ai(t,XUt),C=a&&!p;function P(T){s(c,T)}g.useEffect(function(){return function(){P(null)}},[]);var A=i&&r!==DP?i(r):f,S;o||(S={opacity:C?0:1,height:C?0:DP,overflowY:C?"hidden":DP,order:a?m:DP,pointerEvents:C?"none":DP,position:C?"absolute":DP});var v={};C&&(v["aria-hidden"]=!0);var b=g.createElement(w,Uo({className:Bn(!o&&n,u),style:nn(nn({},S),d)},v,x,{ref:e}),A);return a&&(b=g.createElement(Ld,{onResize:function(R){var M=R.offsetWidth;P(M)},disabled:l},b)),b}var Yk=g.forwardRef(JUt);Yk.displayName="Item";function KUt(t){if(typeof MessageChannel>"u")Ic(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}function $Ut(){var t=g.useRef(null),e=function(o){t.current||(t.current=[],KUt(function(){r0.unstable_batchedUpdates(function(){t.current.forEach(function(r){r()}),t.current=null})})),t.current.push(o)};return e}function KD(t,e){var n=g.useState(e),o=Sn(n,2),r=o[0],i=o[1],a=Dd(function(l){t(function(){i(l)})});return[r,a]}var rJ=xe.createContext(null),qUt=["component"],QUt=["className"],ZUt=["className"],ejt=function(e,n){var o=g.useContext(rJ);if(!o){var r=e.component,i=r===void 0?"div":r,a=Ai(e,qUt);return g.createElement(i,Uo({},a,{ref:n}))}var l=o.className,s=Ai(o,QUt),c=e.className,u=Ai(e,ZUt);return g.createElement(rJ.Provider,{value:null},g.createElement(Yk,Uo({ref:n,className:Bn(l,c)},s,u)))},Jqe=g.forwardRef(ejt);Jqe.displayName="RawItem";var tjt=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Kqe="responsive",$qe="invalidate";function njt(t){return"+ ".concat(t.length," ...")}function ojt(t,e){var n=t.prefixCls,o=n===void 0?"rc-overflow":n,r=t.data,i=r===void 0?[]:r,a=t.renderItem,l=t.renderRawItem,s=t.itemKey,c=t.itemWidth,u=c===void 0?10:c,d=t.ssr,f=t.style,p=t.className,m=t.maxCount,y=t.renderRest,w=t.renderRawRest,x=t.suffix,C=t.component,P=C===void 0?"div":C,A=t.itemComponent,S=t.onVisibleChange,v=Ai(t,tjt),b=d==="full",T=$Ut(),R=KD(T,null),M=Sn(R,2),D=M[0],k=M[1],N=D||0,U=KD(T,new Map),W=Sn(U,2),F=W[0],E=W[1],L=KD(T,0),j=Sn(L,2),Y=j[0],O=j[1],_=KD(T,0),G=Sn(_,2),Q=G[0],oe=G[1],ee=KD(T,0),$=Sn(ee,2),ae=$[0],Z=$[1],ne=g.useState(null),te=Sn(ne,2),q=te[0],le=te[1],de=g.useState(null),he=Sn(de,2),me=he[0],ce=he[1],Pe=g.useMemo(function(){return me===null&&b?Number.MAX_SAFE_INTEGER:me||0},[me,D]),pe=g.useState(!1),Ie=Sn(pe,2),ve=Ie[0],ze=Ie[1],Ae="".concat(o,"-item"),se=Math.max(Y,Q),ge=m===Kqe,we=i.length&&ge,Se=m===$qe,Me=we||typeof m=="number"&&i.length>m,Ce=g.useMemo(function(){var tt=i;return we?D===null&&b?tt=i:tt=i.slice(0,Math.min(i.length,N/u)):typeof m=="number"&&(tt=i.slice(0,m)),tt},[i,u,D,m,we]),Te=g.useMemo(function(){return we?i.slice(Pe+1):i.slice(Ce.length)},[i,Ce,we,Pe]),Re=g.useCallback(function(tt,gt){var Ve;return typeof s=="function"?s(tt):(Ve=s&&(tt==null?void 0:tt[s]))!==null&&Ve!==void 0?Ve:gt},[s]),Ne=g.useCallback(a||function(tt){return tt},[a]);function _e(tt,gt,Ve){me===tt&&(gt===void 0||gt===q)||(ce(tt),Ve||(ze(ttN){_e(je-1,tt-et-ae+Q);break}}x&&Le(0)+ae>N&&le(null)}},[N,F,Q,ae,Re,Ce]);var Ye=ve&&!!Te.length,lt={};q!==null&&we&&(lt={position:"absolute",left:q,top:0});var Oe={prefixCls:Ae,responsive:we,component:A,invalidate:Se},ut=l?function(tt,gt){var Ve=Re(tt,gt);return g.createElement(rJ.Provider,{key:Ve,value:nn(nn({},Oe),{},{order:gt,item:tt,itemKey:Ve,registerSize:qe,display:gt<=Pe})},l(tt,gt))}:function(tt,gt){var Ve=Re(tt,gt);return g.createElement(Yk,Uo({},Oe,{order:gt,key:Ve,item:tt,renderItem:Ne,itemKey:Ve,registerSize:qe,display:gt<=Pe}))},ht,Qe={order:Ye?Pe:Number.MAX_SAFE_INTEGER,className:"".concat(Ae,"-rest"),registerSize:Fe,display:Ye};if(w)w&&(ht=g.createElement(rJ.Provider,{value:nn(nn({},Oe),Qe)},w(Te)));else{var nt=y||njt;ht=g.createElement(Yk,Uo({},Oe,Qe),typeof nt=="function"?nt(Te):nt)}var mt=g.createElement(P,Uo({className:Bn(!Se&&o,p),style:f,ref:e},v),Ce.map(ut),Me?ht:null,x&&g.createElement(Yk,Uo({},Oe,{responsive:ge,responsiveDisabled:!we,order:Pe,className:"".concat(Ae,"-suffix"),registerSize:He,display:!0,style:lt}),x));return ge&&(mt=g.createElement(Ld,{onResize:Ue,disabled:!we},mt)),mt}var S5=g.forwardRef(ojt);S5.displayName="Overflow";S5.Item=Jqe;S5.RESPONSIVE=Kqe;S5.INVALIDATE=$qe;var rjt=function(e,n){var o,r=e.prefixCls,i=e.id,a=e.inputElement,l=e.disabled,s=e.tabIndex,c=e.autoFocus,u=e.autoComplete,d=e.editable,f=e.activeDescendantId,p=e.value,m=e.maxLength,y=e.onKeyDown,w=e.onMouseDown,x=e.onChange,C=e.onPaste,P=e.onCompositionStart,A=e.onCompositionEnd,S=e.onBlur,v=e.open,b=e.attrs,T=a||g.createElement("input",null),R=T,M=R.ref,D=R.props,k=D.onKeyDown,N=D.onChange,U=D.onMouseDown,W=D.onCompositionStart,F=D.onCompositionEnd,E=D.onBlur,L=D.style;return"maxLength"in T.props,T=g.cloneElement(T,nn(nn(nn({type:"search"},D),{},{id:i,ref:oU(n,M),disabled:l,tabIndex:s,autoComplete:u||"off",autoFocus:c,className:Bn("".concat(r,"-selection-search-input"),(o=T)===null||o===void 0||(o=o.props)===null||o===void 0?void 0:o.className),role:"combobox","aria-expanded":v||!1,"aria-haspopup":"listbox","aria-owns":"".concat(i,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(i,"_list"),"aria-activedescendant":v?f:void 0},b),{},{value:d?p:"",maxLength:m,readOnly:!d,unselectable:d?null:"on",style:nn(nn({},L),{},{opacity:d?null:0}),onKeyDown:function(Y){y(Y),k&&k(Y)},onMouseDown:function(Y){w(Y),U&&U(Y)},onChange:function(Y){x(Y),N&&N(Y)},onCompositionStart:function(Y){P(Y),W&&W(Y)},onCompositionEnd:function(Y){A(Y),F&&F(Y)},onPaste:C,onBlur:function(Y){S(Y),E&&E(Y)}})),T},qqe=g.forwardRef(rjt);function Qqe(t){return Array.isArray(t)?t:t!==void 0?[t]:[]}var ijt=typeof window<"u"&&window.document&&window.document.documentElement,ajt=ijt;function ljt(t){return t!=null}function sjt(t){return!t&&t!==0}function kTe(t){return["string","number"].includes(Vr(t))}function Zqe(t){var e=void 0;return t&&(kTe(t.title)?e=t.title.toString():kTe(t.label)&&(e=t.label.toString())),e}function cjt(t,e){ajt?g.useLayoutEffect(t,e):g.useEffect(t,e)}function ujt(t){var e;return(e=t.key)!==null&&e!==void 0?e:t.value}var FTe=function(e){e.preventDefault(),e.stopPropagation()},djt=function(e){var n=e.id,o=e.prefixCls,r=e.values,i=e.open,a=e.searchValue,l=e.autoClearSearchValue,s=e.inputRef,c=e.placeholder,u=e.disabled,d=e.mode,f=e.showSearch,p=e.autoFocus,m=e.autoComplete,y=e.activeDescendantId,w=e.tabIndex,x=e.removeIcon,C=e.maxTagCount,P=e.maxTagTextLength,A=e.maxTagPlaceholder,S=A===void 0?function(de){return"+ ".concat(de.length," ...")}:A,v=e.tagRender,b=e.onToggleOpen,T=e.onRemove,R=e.onInputChange,M=e.onInputPaste,D=e.onInputKeyDown,k=e.onInputMouseDown,N=e.onInputCompositionStart,U=e.onInputCompositionEnd,W=e.onInputBlur,F=g.useRef(null),E=g.useState(0),L=Sn(E,2),j=L[0],Y=L[1],O=g.useState(!1),_=Sn(O,2),G=_[0],Q=_[1],oe="".concat(o,"-selection"),ee=i||d==="multiple"&&l===!1||d==="tags"?a:"",$=d==="tags"||d==="multiple"&&l===!1||f&&(i||G);cjt(function(){Y(F.current.scrollWidth)},[ee]);var ae=function(he,me,ce,Pe,pe){return g.createElement("span",{title:Zqe(he),className:Bn("".concat(oe,"-item"),Ut({},"".concat(oe,"-item-disabled"),ce))},g.createElement("span",{className:"".concat(oe,"-item-content")},me),Pe&&g.createElement(CZ,{className:"".concat(oe,"-item-remove"),onMouseDown:FTe,onClick:pe,customizeIcon:x},"×"))},Z=function(he,me,ce,Pe,pe,Ie){var ve=function(Ae){FTe(Ae),b(!i)};return g.createElement("span",{onMouseDown:ve},v({label:me,value:he,disabled:ce,closable:Pe,onClose:pe,isMaxTag:!!Ie}))},ne=function(he){var me=he.disabled,ce=he.label,Pe=he.value,pe=!u&&!me,Ie=ce;if(typeof P=="number"&&(typeof ce=="string"||typeof ce=="number")){var ve=String(Ie);ve.length>P&&(Ie="".concat(ve.slice(0,P),"..."))}var ze=function(se){se&&se.stopPropagation(),T(he)};return typeof v=="function"?Z(Pe,Ie,me,pe,ze):ae(he,Ie,me,pe,ze)},te=function(he){if(!r.length)return null;var me=typeof S=="function"?S(he):S;return typeof v=="function"?Z(void 0,me,!1,!1,void 0,!0):ae({title:me},me,!1)},q=g.createElement("div",{className:"".concat(oe,"-search"),style:{width:j},onFocus:function(){Q(!0)},onBlur:function(){Q(!1)}},g.createElement(qqe,{ref:s,open:i,prefixCls:o,id:n,inputElement:null,disabled:u,autoFocus:p,autoComplete:m,editable:$,activeDescendantId:y,value:ee,onKeyDown:D,onMouseDown:k,onChange:R,onPaste:M,onCompositionStart:N,onCompositionEnd:U,onBlur:W,tabIndex:w,attrs:F1(e,!0)}),g.createElement("span",{ref:F,className:"".concat(oe,"-search-mirror"),"aria-hidden":!0},ee," ")),le=g.createElement(S5,{prefixCls:"".concat(oe,"-overflow"),data:r,renderItem:ne,renderRest:te,suffix:q,itemKey:ujt,maxCount:C});return g.createElement("span",{className:"".concat(oe,"-wrap")},le,!r.length&&!ee&&g.createElement("span",{className:"".concat(oe,"-placeholder")},c))},fjt=function(e){var n=e.inputElement,o=e.prefixCls,r=e.id,i=e.inputRef,a=e.disabled,l=e.autoFocus,s=e.autoComplete,c=e.activeDescendantId,u=e.mode,d=e.open,f=e.values,p=e.placeholder,m=e.tabIndex,y=e.showSearch,w=e.searchValue,x=e.activeValue,C=e.maxLength,P=e.onInputKeyDown,A=e.onInputMouseDown,S=e.onInputChange,v=e.onInputPaste,b=e.onInputCompositionStart,T=e.onInputCompositionEnd,R=e.onInputBlur,M=e.title,D=g.useState(!1),k=Sn(D,2),N=k[0],U=k[1],W=u==="combobox",F=W||y,E=f[0],L=w||"";W&&x&&!N&&(L=x),g.useEffect(function(){W&&U(!1)},[W,x]);var j=u!=="combobox"&&!d&&!y?!1:!!L,Y=M===void 0?Zqe(E):M,O=g.useMemo(function(){return E?null:g.createElement("span",{className:"".concat(o,"-selection-placeholder"),style:j?{visibility:"hidden"}:void 0},p)},[E,j,p,o]);return g.createElement("span",{className:"".concat(o,"-selection-wrap")},g.createElement("span",{className:"".concat(o,"-selection-search")},g.createElement(qqe,{ref:i,prefixCls:o,id:r,open:d,inputElement:n,disabled:a,autoFocus:l,autoComplete:s,editable:F,activeDescendantId:c,value:L,onKeyDown:P,onMouseDown:A,onChange:function(G){U(!0),S(G)},onPaste:v,onCompositionStart:b,onCompositionEnd:T,onBlur:R,tabIndex:m,attrs:F1(e,!0),maxLength:W?C:void 0})),!W&&E?g.createElement("span",{className:"".concat(o,"-selection-item"),title:Y,style:j?{visibility:"hidden"}:void 0},E.label):null,O)},hjt=function(e,n){var o=g.useRef(null),r=g.useRef(!1),i=e.prefixCls,a=e.open,l=e.mode,s=e.showSearch,c=e.tokenWithEnter,u=e.disabled,d=e.prefix,f=e.autoClearSearchValue,p=e.onSearch,m=e.onSearchSubmit,y=e.onToggleOpen,w=e.onInputKeyDown,x=e.onInputBlur,C=e.domRef;g.useImperativeHandle(n,function(){return{focus:function(Y){o.current.focus(Y)},blur:function(){o.current.blur()}}});var P=Gqe(0),A=Sn(P,2),S=A[0],v=A[1],b=function(Y){var O=Y.which,_=o.current instanceof HTMLTextAreaElement;!_&&a&&(O===Lo.UP||O===Lo.DOWN)&&Y.preventDefault(),w&&w(Y),O===Lo.ENTER&&l==="tags"&&!r.current&&!a&&(m==null||m(Y.target.value)),!(_&&!a&&~[Lo.UP,Lo.DOWN,Lo.LEFT,Lo.RIGHT].indexOf(O))&&WUt(O)&&y(!0)},T=function(){v(!0)},R=g.useRef(null),M=function(Y){p(Y,!0,r.current)!==!1&&y(!0)},D=function(){r.current=!0},k=function(Y){r.current=!1,l!=="combobox"&&M(Y.target.value)},N=function(Y){var O=Y.target.value;if(c&&R.current&&/[\r\n]/.test(R.current)){var _=R.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");O=O.replace(_,R.current)}R.current=null,M(O)},U=function(Y){var O=Y.clipboardData,_=O==null?void 0:O.getData("text");R.current=_||""},W=function(Y){var O=Y.target;if(O!==o.current){var _=document.body.style.msTouchAction!==void 0;_?setTimeout(function(){o.current.focus()}):o.current.focus()}},F=function(Y){var O=S();Y.target!==o.current&&!O&&!(l==="combobox"&&u)&&Y.preventDefault(),(l!=="combobox"&&(!s||!O)||!a)&&(a&&f!==!1&&p("",!0,!1),y())},E={inputRef:o,onInputKeyDown:b,onInputMouseDown:T,onInputChange:N,onInputPaste:U,onInputCompositionStart:D,onInputCompositionEnd:k,onInputBlur:x},L=l==="multiple"||l==="tags"?g.createElement(djt,Uo({},e,E)):g.createElement(fjt,Uo({},e,E));return g.createElement("div",{ref:C,className:"".concat(i,"-selector"),onClick:W,onMouseDown:F},d&&g.createElement("div",{className:"".concat(i,"-prefix")},d),L)},pjt=g.forwardRef(hjt);function HL(t){"@babel/helpers - typeof";return HL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},HL(t)}function gjt(t,e){if(HL(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(HL(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mjt(t){var e=gjt(t,"string");return HL(e)==="symbol"?e:String(e)}function yjt(t,e,n){return e=mjt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function LTe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Hp(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function bjt(t,e){if(t==null)return{};var n=vjt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function iJ(){return iJ=Object.assign?Object.assign.bind():function(t){for(var e=1;e0,G=g.useState(!P||!_),Q=df(G,2),oe=Q[0],ee=Q[1];if(Ml(function(){!oe&&_&&a&&ee(!0)},[oe,_,a]),!oe)return null;var $="auto",ae={left:"-1000vw",top:"-1000vh",right:$,bottom:$};if(M||!s){var Z,ne=y.points,te=y.dynamicInset||((Z=y._experimental)===null||Z===void 0?void 0:Z.dynamicInset),q=te&&ne[0][1]==="r",le=te&&ne[0][0]==="b";q?(ae.right=N,ae.left=$):(ae.left=D,ae.right=$),le?(ae.bottom=U,ae.top=$):(ae.top=k,ae.bottom=$)}var de={};return E&&(E.includes("height")&&j?de.height=j:E.includes("minHeight")&&j&&(de.minHeight=j),E.includes("width")&&L?de.width=L:E.includes("minWidth")&&L&&(de.minWidth=L)),s||(de.pointerEvents="none"),g.createElement(S,{open:C||O,getContainer:P&&function(){return P(a)},autoDestroy:A},g.createElement(Tjt,{prefixCls:r,open:s,zIndex:v,mask:f,motion:x}),g.createElement(Ld,{onResize:W,disabled:!s},function(he){return g.createElement(Oy,iJ({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:C,leavedClassName:"".concat(r,"-hidden")},w,{onAppearPrepare:F,onEnterPrepare:F,visible:s,onVisibleChanged:function(ce){var Pe;w==null||(Pe=w.onVisibleChanged)===null||Pe===void 0||Pe.call(w,ce),l(ce)}}),function(me,ce){var Pe=me.className,pe=me.style,Ie=Bn(r,Pe,o);return g.createElement("div",{ref:oU(he,e,ce),className:Ie,style:Hp(Hp(Hp(Hp({"--arrow-x":"".concat(m.x||0,"px"),"--arrow-y":"".concat(m.y||0,"px")},ae),de),pe),{},{boxSizing:"border-box",zIndex:v},i),onMouseEnter:b,onMouseLeave:T,onPointerEnter:R,onClick:d},p&&g.createElement(Sjt,{prefixCls:r,arrow:p,arrowPos:m,align:y}),g.createElement(Pjt,{cache:!s&&!u},Y))})}))}),Rjt=g.forwardRef(function(t,e){var n=t.children,o=t.getTriggerDOMNode,r=Z8(n),i=g.useCallback(function(l){G5e(e,o?o(l):l)},[o]),a=E7(i,n.ref);return r?g.cloneElement(n,{ref:a}):n}),WTe=g.createContext(null);function NTe(t){return t?Array.isArray(t)?t:[t]:[]}function Hjt(t,e,n,o){return g.useMemo(function(){var r=NTe(n??e),i=NTe(o??e),a=new Set(r),l=new Set(i);return t&&(a.has("hover")&&(a.delete("hover"),a.add("click")),l.has("hover")&&(l.delete("hover"),l.add("click"))),[a,l]},[t,e,n,o])}const tQe=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1};function Mjt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function Ijt(t,e,n,o){for(var r=n.points,i=Object.keys(t),a=0;a1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?e:t}function $D(t){return ML(parseFloat(t),0)}function jTe(t,e){var n=Hp({},t);return(e||[]).forEach(function(o){if(!(o instanceof HTMLBodyElement||o instanceof HTMLHtmlElement)){var r=mU(o).getComputedStyle(o),i=r.overflow,a=r.overflowClipMargin,l=r.borderTopWidth,s=r.borderBottomWidth,c=r.borderLeftWidth,u=r.borderRightWidth,d=o.getBoundingClientRect(),f=o.offsetHeight,p=o.clientHeight,m=o.offsetWidth,y=o.clientWidth,w=$D(l),x=$D(s),C=$D(c),P=$D(u),A=ML(Math.round(d.width/m*1e3)/1e3),S=ML(Math.round(d.height/f*1e3)/1e3),v=(m-y-C-P)*A,b=(f-p-w-x)*S,T=w*S,R=x*S,M=C*A,D=P*A,k=0,N=0;if(i==="clip"){var U=$D(a);k=U*A,N=U*S}var W=d.x+M-k,F=d.y+T-N,E=W+d.width+2*k-M-D-v,L=F+d.height+2*N-T-R-b;n.left=Math.max(n.left,W),n.top=Math.max(n.top,F),n.right=Math.min(n.right,E),n.bottom=Math.min(n.bottom,L)}}),n}function BTe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(e),o=n.match(/^(.*)\%$/);return o?t*(parseFloat(o[1])/100):parseFloat(n)}function YTe(t,e){var n=e||[],o=df(n,2),r=o[0],i=o[1];return[BTe(t.width,r),BTe(t.height,i)]}function OTe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function EP(t,e){var n=e[0],o=e[1],r,i;return n==="t"?i=t.y:n==="b"?i=t.y+t.height:i=t.y+t.height/2,o==="l"?r=t.x:o==="r"?r=t.x+t.width:r=t.x+t.width/2,{x:r,y:i}}function pw(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map(function(o,r){return r===e?n[o]||"c":o}).join("")}function zjt(t,e,n,o,r,i,a){var l=g.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:r[o]||{}}),s=df(l,2),c=s[0],u=s[1],d=g.useRef(0),f=g.useMemo(function(){return e?phe(e):[]},[e]),p=g.useRef({}),m=function(){p.current={}};t||m();var y=Dd(function(){if(e&&n&&t){let No=function(vo,bo){var Bo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie,Pr=Y.x+vo,so=Y.y+bo,zo=Pr+Z,Ci=so+ae,ea=Math.max(Pr,Bo.left),rs=Math.max(so,Bo.top),Da=Math.min(zo,Bo.right),or=Math.min(Ci,Bo.bottom);return Math.max(0,(Da-ea)*(or-rs))},ho=function(){Ct=Y.y+nt,yt=Ct+ae,at=Y.x+Qe,Et=at+Z};var To=No,Go=ho,C,P,A=e,S=A.ownerDocument,v=mU(A),b=v.getComputedStyle(A),T=b.width,R=b.height,M=b.position,D=A.style.left,k=A.style.top,N=A.style.right,U=A.style.bottom,W=A.style.overflow,F=Hp(Hp({},r[o]),i),E=S.createElement("div");(C=A.parentElement)===null||C===void 0||C.appendChild(E),E.style.left="".concat(A.offsetLeft,"px"),E.style.top="".concat(A.offsetTop,"px"),E.style.position=M,E.style.height="".concat(A.offsetHeight,"px"),E.style.width="".concat(A.offsetWidth,"px"),A.style.left="0",A.style.top="0",A.style.right="auto",A.style.bottom="auto",A.style.overflow="hidden";var L;if(Array.isArray(n))L={x:n[0],y:n[1],width:0,height:0};else{var j=n.getBoundingClientRect();L={x:j.x,y:j.y,width:j.width,height:j.height}}var Y=A.getBoundingClientRect(),O=S.documentElement,_=O.clientWidth,G=O.clientHeight,Q=O.scrollWidth,oe=O.scrollHeight,ee=O.scrollTop,$=O.scrollLeft,ae=Y.height,Z=Y.width,ne=L.height,te=L.width,q={left:0,top:0,right:_,bottom:G},le={left:-$,top:-ee,right:Q-$,bottom:oe-ee},de=F.htmlRegion,he="visible",me="visibleFirst";de!=="scroll"&&de!==me&&(de=he);var ce=de===me,Pe=jTe(le,f),pe=jTe(q,f),Ie=de===he?pe:Pe,ve=ce?pe:Ie;A.style.left="auto",A.style.top="auto",A.style.right="0",A.style.bottom="0";var ze=A.getBoundingClientRect();A.style.left=D,A.style.top=k,A.style.right=N,A.style.bottom=U,A.style.overflow=W,(P=A.parentElement)===null||P===void 0||P.removeChild(E);var Ae=ML(Math.round(Z/parseFloat(T)*1e3)/1e3),se=ML(Math.round(ae/parseFloat(R)*1e3)/1e3);if(Ae===0||se===0||ZX(n)&&!tQe(n))return;var ge=F.offset,we=F.targetOffset,Se=YTe(Y,ge),Me=df(Se,2),Ce=Me[0],Te=Me[1],Re=YTe(L,we),Ne=df(Re,2),_e=Ne[0],Ue=Ne[1];L.x-=_e,L.y-=Ue;var qe=F.points||[],Fe=df(qe,2),He=Fe[0],Le=Fe[1],Ye=OTe(Le),lt=OTe(He),Oe=EP(L,Ye),ut=EP(Y,lt),ht=Hp({},F),Qe=Oe.x-ut.x+Ce,nt=Oe.y-ut.y+Te,mt=No(Qe,nt),tt=No(Qe,nt,pe),gt=EP(L,["t","l"]),Ve=EP(Y,["t","l"]),je=EP(L,["b","r"]),et=EP(Y,["b","r"]),bt=F.overflow||{},St=bt.adjustX,Pt=bt.adjustY,Yt=bt.shiftX,zt=bt.shiftY,Rt=function(bo){return typeof bo=="boolean"?bo:bo>=0},Ct,yt,at,Et;ho();var Lt=Rt(Pt),Je=lt[0]===Ye[0];if(Lt&<[0]==="t"&&(yt>ve.bottom||p.current.bt)){var st=nt;Je?st-=ae-ne:st=gt.y-et.y-Te;var It=No(Qe,st),ot=No(Qe,st,pe);It>mt||It===mt&&(!ce||ot>=tt)?(p.current.bt=!0,nt=st,Te=-Te,ht.points=[pw(lt,0),pw(Ye,0)]):p.current.bt=!1}if(Lt&<[0]==="b"&&(Ctmt||Be===mt&&(!ce||pt>=tt)?(p.current.tb=!0,nt=it,Te=-Te,ht.points=[pw(lt,0),pw(Ye,0)]):p.current.tb=!1}var ct=Rt(St),Xe=lt[1]===Ye[1];if(ct&<[1]==="l"&&(Et>ve.right||p.current.rl)){var ft=Qe;Xe?ft-=Z-te:ft=gt.x-et.x-Ce;var wt=No(ft,nt),kt=No(ft,nt,pe);wt>mt||wt===mt&&(!ce||kt>=tt)?(p.current.rl=!0,Qe=ft,Ce=-Ce,ht.points=[pw(lt,1),pw(Ye,1)]):p.current.rl=!1}if(ct&<[1]==="r"&&(atmt||Ot===mt&&(!ce||on>=tt)?(p.current.lr=!0,Qe=Zt,Ce=-Ce,ht.points=[pw(lt,1),pw(Ye,1)]):p.current.lr=!1}ho();var qt=Yt===!0?0:Yt;typeof qt=="number"&&(atpe.right&&(Qe-=Et-pe.right-Ce,L.x>pe.right-qt&&(Qe+=L.x-pe.right+qt)));var rn=zt===!0?0:zt;typeof rn=="number"&&(Ctpe.bottom&&(nt-=yt-pe.bottom-Te,L.y>pe.bottom-rn&&(nt+=L.y-pe.bottom+rn)));var Pn=Y.x+Qe,fo=Pn+Z,to=Y.y+nt,Dt=to+ae,fn=L.x,kn=fn+te,yo=L.y,ur=yo+ne,lr=Math.max(Pn,fn),xo=Math.min(fo,kn),wo=(lr+xo)/2,Rr=wo-Pn,Eo=Math.max(to,yo),An=Math.min(Dt,ur),Dn=(Eo+An)/2,sr=Dn-to;a==null||a(e,ht);var Vo=ze.right-Y.x-(Qe+Y.width),Wo=ze.bottom-Y.y-(nt+Y.height);u({ready:!0,offsetX:Qe/Ae,offsetY:nt/se,offsetR:Vo/Ae,offsetB:Wo/se,arrowX:Rr/Ae,arrowY:sr/se,scaleX:Ae,scaleY:se,align:ht})}}),w=function(){d.current+=1;var P=d.current;Promise.resolve().then(function(){d.current===P&&y()})},x=function(){u(function(P){return Hp(Hp({},P),{},{ready:!1})})};return Ml(x,[o]),Ml(function(){t||x()},[t]),[c.ready,c.offsetX,c.offsetY,c.offsetR,c.offsetB,c.arrowX,c.arrowY,c.scaleX,c.scaleY,c.align,w]}function Djt(t){if(Array.isArray(t))return hhe(t)}function Ejt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kjt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Te(t){return Djt(t)||Ejt(t)||eQe(t)||kjt()}function Fjt(t,e,n,o,r){Ml(function(){if(t&&e&&n){let f=function(){o(),r()};var d=f,i=e,a=n,l=phe(i),s=phe(a),c=mU(a),u=new Set([c].concat(_Te(l),_Te(s)));return u.forEach(function(p){p.addEventListener("scroll",f,{passive:!0})}),c.addEventListener("resize",f,{passive:!0}),o(),function(){u.forEach(function(p){p.removeEventListener("scroll",f),c.removeEventListener("resize",f)})}}},[t,e,n])}function Ljt(t,e,n,o,r,i,a,l){var s=g.useRef(t);s.current=t,g.useEffect(function(){if(e&&o&&(!r||i)){var c=function(p){var m=p.target;s.current&&!a(m)&&l(!1)},u=mU(o);u.addEventListener("mousedown",c,!0),u.addEventListener("contextmenu",c,!0);var d=QX(n);return d&&(d.addEventListener("mousedown",c,!0),d.addEventListener("contextmenu",c,!0)),function(){u.removeEventListener("mousedown",c,!0),u.removeEventListener("contextmenu",c,!0),d&&(d.removeEventListener("mousedown",c,!0),d.removeEventListener("contextmenu",c,!0))}}},[e,n,o,r,i])}var Wjt=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function Njt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:uU,e=g.forwardRef(function(n,o){var r=n.prefixCls,i=r===void 0?"rc-trigger-popup":r,a=n.children,l=n.action,s=l===void 0?"hover":l,c=n.showAction,u=n.hideAction,d=n.popupVisible,f=n.defaultPopupVisible,p=n.onPopupVisibleChange,m=n.afterPopupVisibleChange,y=n.mouseEnterDelay,w=n.mouseLeaveDelay,x=w===void 0?.1:w,C=n.focusDelay,P=n.blurDelay,A=n.mask,S=n.maskClosable,v=S===void 0?!0:S,b=n.getPopupContainer,T=n.forceRender,R=n.autoDestroy,M=n.destroyPopupOnHide,D=n.popup,k=n.popupClassName,N=n.popupStyle,U=n.popupPlacement,W=n.builtinPlacements,F=W===void 0?{}:W,E=n.popupAlign,L=n.zIndex,j=n.stretch,Y=n.getPopupClassNameFromAlign,O=n.fresh,_=n.alignPoint,G=n.onPopupClick,Q=n.onPopupAlign,oe=n.arrow,ee=n.popupMotion,$=n.maskMotion,ae=n.popupTransitionName,Z=n.popupAnimation,ne=n.maskTransitionName,te=n.maskAnimation,q=n.className,le=n.getTriggerDOMNode,de=bjt(n,Wjt),he=R||M||!1,me=g.useState(!1),ce=df(me,2),Pe=ce[0],pe=ce[1];Ml(function(){pe(d9e())},[]);var Ie=g.useRef({}),ve=g.useContext(WTe),ze=g.useMemo(function(){return{registerSubPopup:function(cr,ii){Ie.current[cr]=ii,ve==null||ve.registerSubPopup(cr,ii)}}},[ve]),Ae=pqe(),se=g.useState(null),ge=df(se,2),we=ge[0],Se=ge[1],Me=g.useRef(null),Ce=Dd(function(or){Me.current=or,ZX(or)&&we!==or&&Se(or),ve==null||ve.registerSubPopup(Ae,or)}),Te=g.useState(null),Re=df(Te,2),Ne=Re[0],_e=Re[1],Ue=g.useRef(null),qe=Dd(function(or){ZX(or)&&Ne!==or&&(_e(or),Ue.current=or)}),Fe=g.Children.only(a),He=(Fe==null?void 0:Fe.props)||{},Le={},Ye=Dd(function(or){var cr,ii,Ga=Ne;return(Ga==null?void 0:Ga.contains(or))||((cr=QX(Ga))===null||cr===void 0?void 0:cr.host)===or||or===Ga||(we==null?void 0:we.contains(or))||((ii=QX(we))===null||ii===void 0?void 0:ii.host)===or||or===we||Object.values(Ie.current).some(function(xi){return(xi==null?void 0:xi.contains(or))||or===xi})}),lt=UTe(i,ee,Z,ae),Oe=UTe(i,$,te,ne),ut=g.useState(f||!1),ht=df(ut,2),Qe=ht[0],nt=ht[1],mt=d??Qe,tt=Dd(function(or){d===void 0&&nt(or)});Ml(function(){nt(d||!1)},[d]);var gt=g.useRef(mt);gt.current=mt;var Ve=g.useRef([]);Ve.current=[];var je=Dd(function(or){var cr;tt(or),((cr=Ve.current[Ve.current.length-1])!==null&&cr!==void 0?cr:mt)!==or&&(Ve.current.push(or),p==null||p(or))}),et=g.useRef(),bt=function(){clearTimeout(et.current)},St=function(cr){var ii=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;bt(),ii===0?je(cr):et.current=setTimeout(function(){je(cr)},ii*1e3)};g.useEffect(function(){return bt},[]);var Pt=g.useState(!1),Yt=df(Pt,2),zt=Yt[0],Rt=Yt[1];Ml(function(or){(!or||mt)&&Rt(!0)},[mt]);var Ct=g.useState(null),yt=df(Ct,2),at=yt[0],Et=yt[1],Lt=g.useState([0,0]),Je=df(Lt,2),st=Je[0],It=Je[1],ot=function(cr){It([cr.clientX,cr.clientY])},it=zjt(mt,we,_?st:Ne,U,F,E,Q),Be=df(it,11),pt=Be[0],ct=Be[1],Xe=Be[2],ft=Be[3],wt=Be[4],kt=Be[5],Zt=Be[6],Ot=Be[7],on=Be[8],qt=Be[9],rn=Be[10],Pn=Hjt(Pe,s,c,u),fo=df(Pn,2),to=fo[0],Dt=fo[1],fn=to.has("click"),kn=Dt.has("click")||Dt.has("contextMenu"),yo=Dd(function(){zt||rn()}),ur=function(){gt.current&&_&&kn&&St(!1)};Fjt(mt,Ne,we,yo,ur),Ml(function(){yo()},[st,U]),Ml(function(){mt&&!(F!=null&&F[U])&&yo()},[JSON.stringify(E)]);var lr=g.useMemo(function(){var or=Ijt(F,i,qt,_);return Bn(or,Y==null?void 0:Y(qt))},[qt,Y,F,i,_]);g.useImperativeHandle(o,function(){return{nativeElement:Ue.current,popupElement:Me.current,forceAlign:yo}});var xo=g.useState(0),wo=df(xo,2),Rr=wo[0],Eo=wo[1],An=g.useState(0),Dn=df(An,2),sr=Dn[0],Vo=Dn[1],Wo=function(){if(j&&Ne){var cr=Ne.getBoundingClientRect();Eo(cr.width),Vo(cr.height)}},To=function(){Wo(),yo()},Go=function(cr){Rt(!1),rn(),m==null||m(cr)},No=function(){return new Promise(function(cr){Wo(),Et(function(){return cr})})};Ml(function(){at&&(rn(),at(),Et(null))},[at]);function ho(or,cr,ii,Ga){Le[or]=function(xi){var Uu;Ga==null||Ga(xi),St(cr,ii);for(var _s=arguments.length,sc=new Array(_s>1?_s-1:0),ta=1;ta<_s;ta++)sc[ta-1]=arguments[ta];(Uu=He[or])===null||Uu===void 0||Uu.call.apply(Uu,[He,xi].concat(sc))}}(fn||kn)&&(Le.onClick=function(or){var cr;gt.current&&kn?St(!1):!gt.current&&fn&&(ot(or),St(!0));for(var ii=arguments.length,Ga=new Array(ii>1?ii-1:0),xi=1;xi1?ii-1:0),xi=1;xi1&&arguments[1]!==void 0?arguments[1]:{},n=e.fieldNames,o=e.childrenAsData,r=[],i=nQe(n,!1),a=i.label,l=i.value,s=i.options,c=i.groupLabel;function u(d,f){Array.isArray(d)&&d.forEach(function(p){if(f||!(s in p)){var m=p[l];r.push({key:VTe(p,r.length),groupOption:f,data:p,label:p[a],value:m})}else{var y=p[c];y===void 0&&o&&(y=p.label),r.push({key:VTe(p,r.length),group:!0,data:p,label:y}),u(p[s],!0)}})}return u(t,!1),r}function mhe(t){var e=nn({},t);return"props"in e||Object.defineProperty(e,"props",{get:function(){return Ds(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),e}}),e}var _jt=function(e,n,o){if(!n||!n.length)return null;var r=!1,i=function l(s,c){var u=VKe(c),d=u[0],f=u.slice(1);if(!d)return[s];var p=s.split(d);return r=r||p.length>1,p.reduce(function(m,y){return[].concat($o(m),$o(l(y,f)))},[]).filter(Boolean)},a=i(e,n);return r?typeof o<"u"?a.slice(0,o):a:null},f9e=g.createContext(null);function Vjt(t){var e=t.visible,n=t.values;if(!e)return null;var o=50;return g.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(n.slice(0,o).map(function(r){var i=r.label,a=r.value;return["number","string"].includes(Vr(i))?i:a}).join(", ")),n.length>o?", ...":null)}var Gjt=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],Xjt=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],yhe=function(e){return e==="tags"||e==="multiple"},Jjt=g.forwardRef(function(t,e){var n,o=t.id,r=t.prefixCls,i=t.className,a=t.showSearch,l=t.tagRender,s=t.direction,c=t.omitDomProps,u=t.displayValues,d=t.onDisplayValuesChange,f=t.emptyOptions,p=t.notFoundContent,m=p===void 0?"Not Found":p,y=t.onClear,w=t.mode,x=t.disabled,C=t.loading,P=t.getInputElement,A=t.getRawInputElement,S=t.open,v=t.defaultOpen,b=t.onDropdownVisibleChange,T=t.activeValue,R=t.onActiveValueChange,M=t.activeDescendantId,D=t.searchValue,k=t.autoClearSearchValue,N=t.onSearch,U=t.onSearchSplit,W=t.tokenSeparators,F=t.allowClear,E=t.prefix,L=t.suffixIcon,j=t.clearIcon,Y=t.OptionList,O=t.animation,_=t.transitionName,G=t.dropdownStyle,Q=t.dropdownClassName,oe=t.dropdownMatchSelectWidth,ee=t.dropdownRender,$=t.dropdownAlign,ae=t.placement,Z=t.builtinPlacements,ne=t.getPopupContainer,te=t.showAction,q=te===void 0?[]:te,le=t.onFocus,de=t.onBlur,he=t.onKeyUp,me=t.onKeyDown,ce=t.onMouseDown,Pe=Ai(t,Gjt),pe=yhe(w),Ie=(a!==void 0?a:pe)||w==="combobox",ve=nn({},Pe);Xjt.forEach(function(xo){delete ve[xo]}),c==null||c.forEach(function(xo){delete ve[xo]});var ze=g.useState(!1),Ae=Sn(ze,2),se=Ae[0],ge=Ae[1];g.useEffect(function(){ge(d9e())},[]);var we=g.useRef(null),Se=g.useRef(null),Me=g.useRef(null),Ce=g.useRef(null),Te=g.useRef(null),Re=g.useRef(!1),Ne=FUt(),_e=Sn(Ne,3),Ue=_e[0],qe=_e[1],Fe=_e[2];g.useImperativeHandle(e,function(){var xo,wo;return{focus:(xo=Ce.current)===null||xo===void 0?void 0:xo.focus,blur:(wo=Ce.current)===null||wo===void 0?void 0:wo.blur,scrollTo:function(Eo){var An;return(An=Te.current)===null||An===void 0?void 0:An.scrollTo(Eo)},nativeElement:we.current||Se.current}});var He=g.useMemo(function(){var xo;if(w!=="combobox")return D;var wo=(xo=u[0])===null||xo===void 0?void 0:xo.value;return typeof wo=="string"||typeof wo=="number"?String(wo):""},[D,w,u]),Le=w==="combobox"&&typeof P=="function"&&P()||null,Ye=typeof A=="function"&&A(),lt=E7(Se,Ye==null||(n=Ye.props)===null||n===void 0?void 0:n.ref),Oe=g.useState(!1),ut=Sn(Oe,2),ht=ut[0],Qe=ut[1];Ml(function(){Qe(!0)},[]);var nt=o0(!1,{defaultValue:v,value:S}),mt=Sn(nt,2),tt=mt[0],gt=mt[1],Ve=ht?tt:!1,je=!m&&f;(x||je&&Ve&&w==="combobox")&&(Ve=!1);var et=je?!1:Ve,bt=g.useCallback(function(xo){var wo=xo!==void 0?xo:!Ve;x||(gt(wo),Ve!==wo&&(b==null||b(wo)))},[x,Ve,gt,b]),St=g.useMemo(function(){return(W||[]).some(function(xo){return[` `,`\r -`].includes(xo)})},[W]),Pt=g.useContext(f9e)||{},Yt=Pt.maxCount,zt=Pt.rawValues,Rt=function(wo,Rr,Eo){if(!(pe&&ghe(Yt)&&(zt==null?void 0:zt.size)>=Yt)){var An=!0,Dn=wo;R==null||R(null);var sr=_jt(wo,W,ghe(Yt)?Yt-zt.size:void 0),Vo=Eo?null:sr;return w!=="combobox"&&Vo&&(Dn="",U==null||U(Vo),bt(!1),An=!1),N&&He!==Dn&&N(Dn,{source:Rr?"typing":"effect"}),An}},Ct=function(wo){!wo||!wo.trim()||N(wo,{source:"submit"})};g.useEffect(function(){!Ve&&!pe&&w!=="combobox"&&Rt("",!1,!1)},[Ve]),g.useEffect(function(){tt&&x&>(!1),x&&!Re.current&&qe(!1)},[x]);var yt=Gqe(),at=Sn(yt,2),Et=at[0],Lt=at[1],Je=g.useRef(!1),st=function(wo){var Rr=Et(),Eo=wo.key,An=Eo==="Enter";if(An&&(w!=="combobox"&&wo.preventDefault(),Ve||bt(!0)),Lt(!!He),Eo==="Backspace"&&!Rr&&pe&&!He&&u.length){for(var Dn=$o(u),sr=null,Vo=Dn.length-1;Vo>=0;Vo-=1){var Wo=Dn[Vo];if(!Wo.disabled){Dn.splice(Vo,1),sr=Wo;break}}sr&&d(Dn,{type:"remove",values:[sr]})}for(var To=arguments.length,Go=new Array(To>1?To-1:0),No=1;No1?Rr-1:0),An=1;An1?sr-1:0),Wo=1;Wo0,G=g.useMemo(function(){if(i===0||Y===0)return 0;var $=i/Y;return $*O},[i,Y,O]),Q=function(le){le.stopPropagation(),le.preventDefault()},oe=g.useRef({top:G,dragging:x,pageY:S,startTop:R});oe.current={top:G,dragging:x,pageY:S,startTop:R};var ee=function(le){C(!0),v(GTe(le,u)),M(oe.current.top),l(),le.stopPropagation(),le.preventDefault()};g.useEffect(function(){var $=function(me){me.preventDefault()},le=k.current,de=N.current;return le.addEventListener("touchstart",$),de.addEventListener("touchstart",ee),function(){le.removeEventListener("touchstart",$),de.removeEventListener("touchstart",ee)}},[]);var q=g.useRef();q.current=Y;var ae=g.useRef();ae.current=O,g.useEffect(function(){if(x){var $,le=function(me){var ce=oe.current,Pe=ce.dragging,pe=ce.pageY,Ie=ce.startTop;if(Ic.cancel($),Pe){var ve=GTe(me,u)-pe,ze=Ie;!D&&u?ze-=ve:ze+=ve;var Ae=q.current,se=ae.current,ge=se?ze/se:0,we=Math.ceil(ge*Ae);we=Math.max(we,0),we=Math.min(we,Ae),$=Ic(function(){c(we,u)})}},de=function(){C(!1),s()};return window.addEventListener("mousemove",le),window.addEventListener("touchmove",le),window.addEventListener("mouseup",de),window.addEventListener("touchend",de),function(){window.removeEventListener("mousemove",le),window.removeEventListener("touchmove",le),window.removeEventListener("mouseup",de),window.removeEventListener("touchend",de),Ic.cancel($)}}},[x]),g.useEffect(function(){j()},[i]),g.useImperativeHandle(e,function(){return{delayHidden:j}});var Z="".concat(o,"-scrollbar"),ne={position:"absolute",visibility:F&&_?null:"hidden"},te={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(ne.height=8,ne.left=0,ne.right=0,ne.bottom=0,te.height="100%",te.width=d,D?te.left=G:te.right=G):(ne.width=8,ne.top=0,ne.bottom=0,D?ne.right=0:ne.left=0,te.width="100%",te.height=d,te.top=G),g.createElement("div",{ref:k,className:Bn(Z,(n={},Ut(n,"".concat(Z,"-horizontal"),u),Ut(n,"".concat(Z,"-vertical"),!u),Ut(n,"".concat(Z,"-visible"),F),n)),style:nn(nn({},ne),p),onMouseDown:Q,onMouseMove:j},g.createElement("div",{ref:N,className:Bn("".concat(Z,"-thumb"),Ut({},"".concat(Z,"-thumb-moving"),x)),style:nn(nn({},te),m),onMouseDown:ee}))});function Kjt(t){var e=t.children,n=t.setRef,o=g.useCallback(function(r){n(r)},[]);return g.cloneElement(e,{ref:o})}function $jt(t,e,n,o,r,i,a){var l=a.getKey;return t.slice(e,n+1).map(function(s,c){var u=e+c,d=i(s,u,{style:{width:o}}),f=l(s);return g.createElement(Kjt,{key:f,setRef:function(m){return r(s,m)}},d)})}var qjt=function(){function t(){Uh(this,t),this.maps=void 0,this.id=0,this.maps=Object.create(null)}return jh(t,[{key:"set",value:function(n,o){this.maps[n]=o,this.id+=1}},{key:"get",value:function(n){return this.maps[n]}}]),t}();function Qjt(t,e,n){var o=g.useState(0),r=Sn(o,2),i=r[0],a=r[1],l=g.useRef(new Map),s=g.useRef(new qjt),c=g.useRef();function u(){Ic.cancel(c.current)}function d(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;u();var m=function(){l.current.forEach(function(w,x){if(w&&w.offsetParent){var C=jk(w),P=C.offsetHeight;s.current.get(x)!==P&&s.current.set(x,C.offsetHeight)}}),a(function(w){return w+1})};p?m():c.current=Ic(m)}function f(p,m){var y=t(p);l.current.get(y),m?(l.current.set(y,m),d()):l.current.delete(y)}return g.useEffect(function(){return u},[]),[f,d,s.current,i]}var Zjt=10;function eBt(t,e,n,o,r,i,a,l){var s=g.useRef(),c=g.useState(null),u=Sn(c,2),d=u[0],f=u[1];return Ml(function(){if(d&&d.times=0;U-=1){var W=r(e[U]),F=n.get(W);if(F===void 0){C=!0;break}if(N-=F,N<=0)break}switch(S){case"top":A=b-w;break;case"bottom":A=T-x+w;break;default:{var E=t.current.scrollTop,L=E+x;bL&&(P="bottom")}}A!==null&&a(A),A!==d.lastTop&&(C=!0)}C&&f(nn(nn({},d),{},{times:d.times+1,targetAlign:P,lastTop:A}))}},[d,t.current]),function(p){if(p==null){l();return}if(Ic.cancel(s.current),typeof p=="number")a(p);else if(p&&Vr(p)==="object"){var m,y=p.align;"index"in p?m=p.index:m=e.findIndex(function(C){return r(C)===p.key});var w=p.offset,x=w===void 0?0:w;f({times:0,index:m,offset:x,originAlign:y})}}}function tBt(t,e,n){var o=t.length,r=e.length,i,a;if(o===0&&r===0)return null;o"u"?"undefined":Vr(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const rQe=function(t,e){var n=g.useRef(!1),o=g.useRef(null);function r(){clearTimeout(o.current),n.current=!0,o.current=setTimeout(function(){n.current=!1},50)}var i=g.useRef({top:t,bottom:e});return i.current.top=t,i.current.bottom=e,function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=a<0&&i.current.top||a>0&&i.current.bottom;return l&&s?(clearTimeout(o.current),n.current=!1):(!s||n.current)&&r(),!n.current&&s}};function oBt(t,e,n,o,r){var i=g.useRef(0),a=g.useRef(null),l=g.useRef(null),s=g.useRef(!1),c=rQe(e,n);function u(w,x){Ic.cancel(a.current),i.current+=x,l.current=x,!c(x)&&(JTe||w.preventDefault(),a.current=Ic(function(){var C=s.current?10:1;r(i.current*C),i.current=0}))}function d(w,x){r(x,!0),JTe||w.preventDefault()}var f=g.useRef(null),p=g.useRef(null);function m(w){if(t){Ic.cancel(p.current),p.current=Ic(function(){f.current=null},2);var x=w.deltaX,C=w.deltaY,P=w.shiftKey,A=x,S=C;(f.current==="sx"||!f.current&&P&&C&&!x)&&(A=C,S=0,f.current="sx");var v=Math.abs(A),b=Math.abs(S);f.current===null&&(f.current=o&&v>b?"x":"y"),f.current==="y"?u(w,S):d(w,A)}}function y(w){t&&(s.current=w.detail===l.current)}return[m,y]}var rBt=14/15;function iBt(t,e,n){var o=g.useRef(!1),r=g.useRef(0),i=g.useRef(null),a=g.useRef(null),l,s=function(f){if(o.current){var p=Math.ceil(f.touches[0].pageY),m=r.current-p;r.current=p,n(m)&&f.preventDefault(),clearInterval(a.current),a.current=setInterval(function(){m*=rBt,(!n(m,!0)||Math.abs(m)<=.1)&&clearInterval(a.current)},16)}},c=function(){o.current=!1,l()},u=function(f){l(),f.touches.length===1&&!o.current&&(o.current=!0,r.current=Math.ceil(f.touches[0].pageY),i.current=f.target,i.current.addEventListener("touchmove",s),i.current.addEventListener("touchend",c))};l=function(){i.current&&(i.current.removeEventListener("touchmove",s),i.current.removeEventListener("touchend",c))},Ml(function(){return t&&e.current.addEventListener("touchstart",u),function(){var d;(d=e.current)===null||d===void 0||d.removeEventListener("touchstart",u),l(),clearInterval(a.current)}},[t])}var aBt=20;function KTe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*100;return isNaN(n)&&(n=0),n=Math.max(n,aBt),n=Math.min(n,t/2),Math.floor(n)}function lBt(t,e,n,o){var r=g.useMemo(function(){return[new Map,[]]},[t,n.id,o]),i=Sn(r,2),a=i[0],l=i[1],s=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var m=t.length,y=l.length;yi||!!y),D=m==="rtl",k=Bn(o,Ut({},"".concat(o,"-rtl"),D),r),N=u||cBt,U=g.useRef(),W=g.useRef(),F=g.useState(0),E=Sn(F,2),L=E[0],j=E[1],Y=g.useState(0),O=Sn(Y,2),_=O[0],G=O[1],Q=g.useState(!1),oe=Sn(Q,2),ee=oe[0],q=oe[1],ae=function(){q(!0)},Z=function(){q(!1)},ne=g.useCallback(function(Lt){return typeof f=="function"?f(Lt):Lt==null?void 0:Lt[f]},[f]),te={getKey:ne};function $(Lt){j(function(Je){var st;typeof Lt=="function"?st=Lt(Je):st=Lt;var It=lt(st);return U.current.scrollTop=It,It})}var le=g.useRef({start:0,end:N.length}),de=g.useRef(),he=nBt(N,ne),me=Sn(he,1),ce=me[0];de.current=ce;var Pe=Qjt(ne),pe=Sn(Pe,4),Ie=pe[0],ve=pe[1],ze=pe[2],Ae=pe[3],se=g.useMemo(function(){if(!R)return{scrollHeight:void 0,start:0,end:N.length-1,offset:void 0};if(!M){var Lt;return{scrollHeight:((Lt=W.current)===null||Lt===void 0?void 0:Lt.offsetHeight)||0,start:0,end:N.length-1,offset:void 0}}for(var Je=0,st,It,ot,it=N.length,Be=0;Be=L&&st===void 0&&(st=Be,It=Je),ft>L+i&&ot===void 0&&(ot=Be),Je=ft}return st===void 0&&(st=0,It=0,ot=Math.ceil(i/a)),ot===void 0&&(ot=N.length-1),ot=Math.min(ot+1,N.length-1),{scrollHeight:Je,start:st,end:ot,offset:It}},[M,R,L,N,Ae,i]),ge=se.scrollHeight,we=se.start,Se=se.end,Me=se.offset;le.current.start=we,le.current.end=Se;var Ce=g.useState({width:0,height:i}),Te=Sn(Ce,2),Re=Te[0],Ne=Te[1],_e=function(Je){Ne({width:Je.width||Je.offsetWidth,height:Je.height||Je.offsetHeight})},Ue=g.useRef(),qe=g.useRef(),Fe=g.useMemo(function(){return KTe(Re.width,y)},[Re.width,y]),He=g.useMemo(function(){return KTe(Re.height,ge)},[Re.height,ge]),Le=ge-i,Ye=g.useRef(Le);Ye.current=Le;function lt(Lt){var Je=Lt;return Number.isNaN(Ye.current)||(Je=Math.min(Je,Ye.current)),Je=Math.max(Je,0),Je}var Oe=L<=0,ut=L>=Le,ht=rQe(Oe,ut),Qe=function(){return{x:D?-_:_,y:L}},nt=g.useRef(Qe()),mt=Dd(function(){if(P){var Lt=Qe();(nt.current.x!==Lt.x||nt.current.y!==Lt.y)&&(P(Lt),nt.current=Lt)}});function tt(Lt,Je){var st=Lt;Je?(r0.flushSync(function(){G(st)}),mt()):$(st)}function gt(Lt){var Je=Lt.currentTarget.scrollTop;Je!==L&&$(Je),C==null||C(Lt),mt()}var Ve=function(Je){var st=Je,It=y-Re.width;return st=Math.max(st,0),st=Math.min(st,It),st},je=Dd(function(Lt,Je){Je?(r0.flushSync(function(){G(function(st){var It=st+(D?-Lt:Lt);return Ve(It)})}),mt()):$(function(st){var It=st+Lt;return It})}),et=oBt(R,Oe,ut,!!y,je),bt=Sn(et,2),St=bt[0],Pt=bt[1];iBt(R,U,function(Lt,Je){return ht(Lt,Je)?!1:(St({preventDefault:function(){},deltaY:Lt}),!0)}),Ml(function(){function Lt(st){R&&st.preventDefault()}var Je=U.current;return Je.addEventListener("wheel",St),Je.addEventListener("DOMMouseScroll",Pt),Je.addEventListener("MozMousePixelScroll",Lt),function(){Je.removeEventListener("wheel",St),Je.removeEventListener("DOMMouseScroll",Pt),Je.removeEventListener("MozMousePixelScroll",Lt)}},[R]),Ml(function(){y&&G(function(Lt){return Ve(Lt)})},[Re.width,y]);var Yt=function(){var Je,st;(Je=Ue.current)===null||Je===void 0||Je.delayHidden(),(st=qe.current)===null||st===void 0||st.delayHidden()},zt=eBt(U,N,ze,a,ne,function(){return ve(!0)},$,Yt);g.useImperativeHandle(e,function(){return{getScrollInfo:Qe,scrollTo:function(Je){function st(It){return It&&Vr(It)==="object"&&("left"in It||"top"in It)}st(Je)?(Je.left!==void 0&&G(Ve(Je.left)),zt(Je.top)):zt(Je)}}}),Ml(function(){if(A){var Lt=N.slice(we,Se+1);A(Lt,N)}},[we,Se,N]);var Rt=lBt(N,ne,ze,a),Ct=v==null?void 0:v({start:we,end:Se,virtual:M,offsetX:_,offsetY:Me,rtl:D,getSize:Rt}),yt=$jt(N,we,Se,y,Ie,d,te),at=null;i&&(at=nn(Ut({},s?"height":"maxHeight",i),uBt),R&&(at.overflowY="hidden",y&&(at.overflowX="hidden"),ee&&(at.pointerEvents="none")));var Et={};return D&&(Et.dir="rtl"),g.createElement("div",Uo({style:nn(nn({},c),{},{position:"relative"}),className:k},Et,T),g.createElement(Ld,{onResize:_e},g.createElement(x,{className:"".concat(o,"-holder"),style:at,ref:U,onScroll:gt,onMouseEnter:Yt},g.createElement(oQe,{prefixCls:o,height:ge,offsetX:_,offsetY:Me,scrollWidth:y,onInnerResize:ve,ref:W,innerProps:S,rtl:D,extra:Ct},yt))),M&&ge>i&&g.createElement(XTe,{ref:Ue,prefixCls:o,scrollOffset:L,scrollRange:ge,rtl:D,onScroll:tt,onStartMove:ae,onStopMove:Z,spinSize:He,containerSize:Re.height,style:b==null?void 0:b.verticalScrollBar,thumbStyle:b==null?void 0:b.verticalScrollBarThumb}),M&&y&&g.createElement(XTe,{ref:qe,prefixCls:o,scrollOffset:_,scrollRange:y,rtl:D,onScroll:tt,onStartMove:ae,onStopMove:Z,spinSize:Fe,containerSize:Re.width,horizontal:!0,style:b==null?void 0:b.horizontalScrollBar,thumbStyle:b==null?void 0:b.horizontalScrollBarThumb}))}var g9e=g.forwardRef(dBt);g9e.displayName="List";function fBt(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var hBt=["disabled","title","children","style","className"];function $Te(t){return typeof t=="string"||typeof t=="number"}var pBt=function(e,n){var o=kUt(),r=o.prefixCls,i=o.id,a=o.open,l=o.multiple,s=o.mode,c=o.searchValue,u=o.toggleOpen,d=o.notFoundContent,f=o.onPopupScroll,p=g.useContext(f9e),m=p.maxCount,y=p.flattenOptions,w=p.onActiveValue,x=p.defaultActiveFirstOption,C=p.onSelect,P=p.menuItemSelectedIcon,A=p.rawValues,S=p.fieldNames,v=p.virtual,b=p.direction,T=p.listHeight,R=p.listItemHeight,M=p.optionRender,D="".concat(r,"-item"),k=k5e(function(){return y},[a,y],function(te,$){return $[0]&&te[1]!==$[1]}),N=g.useRef(null),U=g.useMemo(function(){return l&&ghe(m)&&(A==null?void 0:A.size)>=m},[l,m,A==null?void 0:A.size]),W=function($){$.preventDefault()},F=function($){var le;(le=N.current)===null||le===void 0||le.scrollTo(typeof $=="number"?{index:$}:$)},E=g.useCallback(function(te){return s==="combobox"?!1:A.has(te)},[s,$o(A).toString(),A.size]),L=function($){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=k.length,he=0;he1&&arguments[1]!==void 0?arguments[1]:!1;_($);var de={source:le?"keyboard":"mouse"},he=k[$];if(!he){w(null,-1,de);return}w(he.value,$,de)};g.useEffect(function(){G(x!==!1?L(0):-1)},[k.length,c]);var Q=g.useCallback(function(te){return s==="combobox"?String(te).toLowerCase()===c.toLowerCase():A.has(te)},[s,c,$o(A).toString(),A.size]);g.useEffect(function(){var te=setTimeout(function(){if(!l&&a&&A.size===1){var le=Array.from(A)[0],de=k.findIndex(function(he){var me=he.data;return me.value===le});de!==-1&&(G(de),F(de))}});if(a){var $;($=N.current)===null||$===void 0||$.scrollTo(void 0)}return function(){return clearTimeout(te)}},[a,c]);var oe=function($){$!==void 0&&C($,{selected:!A.has($)}),l||u(!1)};if(g.useImperativeHandle(n,function(){return{onKeyDown:function($){var le=$.which,de=$.ctrlKey;switch(le){case Lo.N:case Lo.P:case Lo.UP:case Lo.DOWN:{var he=0;if(le===Lo.UP?he=-1:le===Lo.DOWN?he=1:fBt()&&de&&(le===Lo.N?he=1:le===Lo.P&&(he=-1)),he!==0){var me=L(O+he,he);F(me),G(me,!0)}break}case Lo.TAB:case Lo.ENTER:{var ce,Pe=k[O];Pe&&!(Pe!=null&&(ce=Pe.data)!==null&&ce!==void 0&&ce.disabled)&&!U?oe(Pe.value):oe(void 0),a&&$.preventDefault();break}case Lo.ESC:u(!1),a&&$.stopPropagation()}},onKeyUp:function(){},scrollTo:function($){F($)}}}),k.length===0)return g.createElement("div",{role:"listbox",id:"".concat(i,"_list"),className:"".concat(D,"-empty"),onMouseDown:W},d);var ee=Object.keys(S).map(function(te){return S[te]}),q=function($){return $.label};function ae(te,$){var le=te.group;return{role:le?"presentation":"option",id:"".concat(i,"_list_").concat($)}}var Z=function($){var le=k[$];if(!le)return null;var de=le.data||{},he=de.value,me=le.group,ce=F1(de,!0),Pe=q(le);return le?g.createElement("div",Uo({"aria-label":typeof Pe=="string"&&!me?Pe:null},ce,{key:$},ae(le,$),{"aria-selected":Q(he)}),he):null},ne={role:"listbox",id:"".concat(i,"_list")};return g.createElement(g.Fragment,null,v&&g.createElement("div",Uo({},ne,{style:{height:0,width:0,overflow:"hidden"}}),Z(O-1),Z(O),Z(O+1)),g.createElement(g9e,{itemKey:"key",ref:N,data:k,height:T,itemHeight:R,fullHeight:!1,onMouseDown:W,onScroll:f,virtual:v,direction:b,innerProps:v?null:ne},function(te,$){var le=te.group,de=te.groupOption,he=te.data,me=te.label,ce=te.value,Pe=he.key;if(le){var pe,Ie=(pe=he.title)!==null&&pe!==void 0?pe:$Te(me)?me.toString():void 0;return g.createElement("div",{className:Bn(D,"".concat(D,"-group"),he.className),title:Ie},me!==void 0?me:Pe)}var ve=he.disabled,ze=he.title;he.children;var Ae=he.style,se=he.className,ge=Ai(he,hBt),we=tI(ge,ee),Se=E(ce),Me=ve||!Se&&U,Ce="".concat(D,"-option"),Te=Bn(D,Ce,se,Ut(Ut(Ut(Ut({},"".concat(Ce,"-grouped"),de),"".concat(Ce,"-active"),O===$&&!Me),"".concat(Ce,"-disabled"),Me),"".concat(Ce,"-selected"),Se)),Re=q(te),Ne=!P||typeof P=="function"||Se,_e=typeof Re=="number"?Re:Re||ce,Ue=$Te(_e)?_e.toString():void 0;return ze!==void 0&&(Ue=ze),g.createElement("div",Uo({},F1(we),v?{}:ae(te,$),{"aria-selected":Q(ce),className:Te,title:Ue,onMouseMove:function(){O===$||Me||G($)},onClick:function(){Me||oe(ce)},style:Ae}),g.createElement("div",{className:"".concat(Ce,"-content")},typeof M=="function"?M(te,{index:$}):_e),g.isValidElement(P)||Se,Ne&&g.createElement(CZ,{className:"".concat(D,"-option-state"),customizeIcon:P,customizeIconProps:{value:ce,disabled:Me,isSelected:Se}},Se?"✓":null))}))},gBt=g.forwardRef(pBt);const mBt=function(t,e){var n=g.useRef({values:new Map,options:new Map}),o=g.useMemo(function(){var i=n.current,a=i.values,l=i.options,s=t.map(function(d){if(d.label===void 0){var f;return nn(nn({},d),{},{label:(f=a.get(d.value))===null||f===void 0?void 0:f.label})}return d}),c=new Map,u=new Map;return s.forEach(function(d){c.set(d.value,d),u.set(d.value,e.get(d.value)||l.get(d.value))}),n.current.values=c,n.current.options=u,s},[t,e]),r=g.useCallback(function(i){return e.get(i)||n.current.options.get(i)},[e]);return[o,r]};function Ble(t,e){return Qqe(t).join("").toUpperCase().includes(e)}const yBt=function(t,e,n,o,r){return g.useMemo(function(){if(!n||o===!1)return t;var i=e.options,a=e.label,l=e.value,s=[],c=typeof o=="function",u=n.toUpperCase(),d=c?o:function(p,m){return r?Ble(m[r],u):m[i]?Ble(m[a!=="children"?a:"label"],u):Ble(m[l],u)},f=c?function(p){return mhe(p)}:function(p){return p};return t.forEach(function(p){if(p[i]){var m=d(n,f(p));if(m)s.push(p);else{var y=p[i].filter(function(w){return d(n,f(w))});y.length&&s.push(nn(nn({},p),{},Ut({},i,y)))}return}d(n,f(p))&&s.push(p)}),s},[t,o,r,n,e])};var qTe=0,ABt=mm();function wBt(){var t;return ABt?(t=qTe,qTe+=1):t="TEST_OR_SSR",t}function xBt(t){var e=g.useState(),n=Sn(e,2),o=n[0],r=n[1];return g.useEffect(function(){r("rc_select_".concat(wBt()))},[]),t||o}var vBt=["children","value"],bBt=["children"];function SBt(t){var e=t,n=e.key,o=e.props,r=o.children,i=o.value,a=Ai(o,vBt);return nn({key:n,value:i!==void 0?i:n,children:r},a)}function iQe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return t7(t).map(function(n,o){if(!g.isValidElement(n)||!n.type)return null;var r=n,i=r.type.isSelectOptGroup,a=r.key,l=r.props,s=l.children,c=Ai(l,bBt);return e||!i?SBt(n):nn(nn({key:"__RC_SELECT_GRP__".concat(a===null?o:a,"__"),label:a},c),{},{options:iQe(s)})}).filter(function(n){return n})}var TBt=function(e,n,o,r,i){return g.useMemo(function(){var a=e,l=!e;l&&(a=iQe(n));var s=new Map,c=new Map,u=function(p,m,y){y&&typeof y=="string"&&p.set(m[y],m)},d=function f(p){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,y=0;y0?bt(Yt.options):Yt.options}):Yt})},_e=g.useMemo(function(){return C?Ne(Re):Re},[Re,C,ne]),Ue=g.useMemo(function(){return Ojt(_e,{fieldNames:q,childrenAsData:oe})},[_e,q,oe]),qe=function(St){var Pt=me(St);if(Ie(Pt),Y&&(Pt.length!==se.length||Pt.some(function(Rt,Ct){var yt;return((yt=se[Ct])===null||yt===void 0?void 0:yt.value)!==(Rt==null?void 0:Rt.value)}))){var Yt=j?Pt:Pt.map(function(Rt){return Rt.value}),zt=Pt.map(function(Rt){return mhe(ge(Rt.value))});Y(Q?Yt:Yt[0],Q?zt:zt[0])}},Fe=g.useState(null),He=Sn(Fe,2),Le=He[0],Ye=He[1],lt=g.useState(0),Oe=Sn(lt,2),ut=Oe[0],ht=Oe[1],Qe=T!==void 0?T:o!=="combobox",nt=g.useCallback(function(bt,St){var Pt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Yt=Pt.source,zt=Yt===void 0?"keyboard":Yt;ht(St),a&&o==="combobox"&&bt!==null&&zt==="keyboard"&&Ye(String(bt))},[a,o]),mt=function(St,Pt,Yt){var zt=function(){var ot,it=ge(St);return[j?{label:it==null?void 0:it[q.label],value:St,key:(ot=it==null?void 0:it.key)!==null&&ot!==void 0?ot:St}:St,mhe(it)]};if(Pt&&p){var Rt=zt(),Ct=Sn(Rt,2),yt=Ct[0],at=Ct[1];p(yt,at)}else if(!Pt&&m&&Yt!=="clear"){var Et=zt(),Lt=Sn(Et,2),Je=Lt[0],st=Lt[1];m(Je,st)}},tt=QTe(function(bt,St){var Pt,Yt=Q?St.selected:!0;Yt?Pt=Q?[].concat($o(se),[bt]):[bt]:Pt=se.filter(function(zt){return zt.value!==bt}),qe(Pt),mt(bt,Yt),o==="combobox"?Ye(""):(!yhe||f)&&(te(""),Ye(""))}),gt=function(St,Pt){qe(St);var Yt=Pt.type,zt=Pt.values;(Yt==="remove"||Yt==="clear")&&zt.forEach(function(Rt){mt(Rt.value,!1,Yt)})},Ve=function(St,Pt){if(te(St),Ye(null),Pt.source==="submit"){var Yt=(St||"").trim();if(Yt){var zt=Array.from(new Set([].concat($o(Se),[Yt])));qe(zt),mt(Yt,!0),te("")}return}Pt.source!=="blur"&&(o==="combobox"&&qe(St),u==null||u(St))},je=function(St){var Pt=St;o!=="tags"&&(Pt=St.map(function(zt){var Rt=de.get(zt);return Rt==null?void 0:Rt.value}).filter(function(zt){return zt!==void 0}));var Yt=Array.from(new Set([].concat($o(Se),$o(Pt))));qe(Yt),Yt.forEach(function(zt){mt(zt,!0)})},et=g.useMemo(function(){var bt=M!==!1&&w!==!1;return nn(nn({},$),{},{flattenOptions:Ue,onActiveValue:nt,defaultActiveFirstOption:Qe,onSelect:tt,menuItemSelectedIcon:R,rawValues:Se,fieldNames:q,virtual:bt,direction:D,listHeight:N,listItemHeight:W,childrenAsData:oe,maxCount:O,optionRender:v})},[O,$,Ue,nt,Qe,tt,R,Se,q,M,w,D,N,W,oe,v]);return g.createElement(f9e.Provider,{value:et},g.createElement(Jjt,Uo({},_,{id:G,prefixCls:i,ref:e,omitDomProps:CBt,mode:o,displayValues:we,onDisplayValuesChange:gt,direction:D,searchValue:ne,onSearch:Ve,autoClearSearchValue:f,onSearchSplit:je,dropdownMatchSelectWidth:w,OptionList:gBt,emptyOptions:!Ue.length,activeValue:Le,activeDescendantId:"".concat(G,"_list_").concat(ut)})))}),m9e=HBt;m9e.Option=p9e;m9e.OptGroup=h9e;function o7(t,e,n){return Mn({[`${t}-status-success`]:e==="success",[`${t}-status-warning`]:e==="warning",[`${t}-status-error`]:e==="error",[`${t}-status-validating`]:e==="validating",[`${t}-has-feedback`]:n})}const US=(t,e)=>e||t,MBt=()=>{const[,t]=Ff(),[e]=r6("Empty"),o=new Di(t.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return g.createElement("svg",{style:o,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},g.createElement("title",null,(e==null?void 0:e.description)||"Empty"),g.createElement("g",{fill:"none",fillRule:"evenodd"},g.createElement("g",{transform:"translate(24 31.67)"},g.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),g.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),g.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),g.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),g.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),g.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),g.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},g.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),g.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},IBt=()=>{const[,t]=Ff(),[e]=r6("Empty"),{colorFill:n,colorFillTertiary:o,colorFillQuaternary:r,colorBgContainer:i}=t,{borderColor:a,shadowColor:l,contentColor:s}=g.useMemo(()=>({borderColor:new Di(n).onBackground(i).toHexString(),shadowColor:new Di(o).onBackground(i).toHexString(),contentColor:new Di(r).onBackground(i).toHexString()}),[n,o,r,i]);return g.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},g.createElement("title",null,(e==null?void 0:e.description)||"Empty"),g.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},g.createElement("ellipse",{fill:l,cx:"32",cy:"33",rx:"32",ry:"7"}),g.createElement("g",{fillRule:"nonzero",stroke:a},g.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),g.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:s}))))},zBt=t=>{const{componentCls:e,margin:n,marginXS:o,marginXL:r,fontSize:i,lineHeight:a}=t;return{[e]:{marginInline:o,fontSize:i,lineHeight:a,textAlign:"center",[`${e}-image`]:{height:t.emptyImgHeight,marginBottom:o,opacity:t.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},[`${e}-description`]:{color:t.colorTextDescription},[`${e}-footer`]:{marginTop:n},"&-normal":{marginBlock:r,color:t.colorTextDescription,[`${e}-description`]:{color:t.colorTextDescription},[`${e}-image`]:{height:t.emptyImgHeightMD}},"&-small":{marginBlock:o,color:t.colorTextDescription,[`${e}-image`]:{height:t.emptyImgHeightSM}}}}},DBt=el("Empty",t=>{const{componentCls:e,controlHeightLG:n,calc:o}=t,r=Ui(t,{emptyImgCls:`${e}-img`,emptyImgHeight:o(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:o(n).mul(.875).equal()});return[zBt(r)]});var EBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e,n,o,r,i,a,l,s;const{className:c,rootClassName:u,prefixCls:d,image:f=aQe,description:p,children:m,imageStyle:y,style:w,classNames:x,styles:C}=t,P=EBt(t,["className","rootClassName","prefixCls","image","description","children","imageStyle","style","classNames","styles"]),{getPrefixCls:A,direction:S,empty:v}=g.useContext(gr),b=A("empty",d),[T,R,M]=DBt(b),[D]=r6("Empty"),k=typeof p<"u"?p:D==null?void 0:D.description,N=typeof k=="string"?k:"empty";let U=null;return typeof f=="string"?U=g.createElement("img",{alt:N,src:f}):U=f,T(g.createElement("div",Object.assign({className:Mn(R,M,b,v==null?void 0:v.className,{[`${b}-normal`]:f===lQe,[`${b}-rtl`]:S==="rtl"},c,u,(e=v==null?void 0:v.classNames)===null||e===void 0?void 0:e.root,x==null?void 0:x.root),style:Object.assign(Object.assign(Object.assign(Object.assign({},(n=v==null?void 0:v.styles)===null||n===void 0?void 0:n.root),v==null?void 0:v.style),C==null?void 0:C.root),w)},P),g.createElement("div",{className:Mn(`${b}-image`,(o=v==null?void 0:v.classNames)===null||o===void 0?void 0:o.image,x==null?void 0:x.image),style:Object.assign(Object.assign(Object.assign({},y),(r=v==null?void 0:v.styles)===null||r===void 0?void 0:r.image),C==null?void 0:C.image)},U),k&&g.createElement("div",{className:Mn(`${b}-description`,(i=v==null?void 0:v.classNames)===null||i===void 0?void 0:i.description,x==null?void 0:x.description),style:Object.assign(Object.assign({},(a=v==null?void 0:v.styles)===null||a===void 0?void 0:a.description),C==null?void 0:C.description)},k),m&&g.createElement("div",{className:Mn(`${b}-footer`,(l=v==null?void 0:v.classNames)===null||l===void 0?void 0:l.footer,x==null?void 0:x.footer),style:Object.assign(Object.assign({},(s=v==null?void 0:v.styles)===null||s===void 0?void 0:s.footer),C==null?void 0:C.footer)},m)))};w1.PRESENTED_IMAGE_DEFAULT=aQe;w1.PRESENTED_IMAGE_SIMPLE=lQe;const y9e=t=>{const{componentName:e}=t,{getPrefixCls:n}=g.useContext(gr),o=n("empty");switch(e){case"Table":case"List":return xe.createElement(w1,{image:w1.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return xe.createElement(w1,{image:w1.PRESENTED_IMAGE_SIMPLE,className:`${o}-small`});case"Table.filter":return null;default:return xe.createElement(w1,null)}},jS=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;var o,r;const{variant:i,[t]:a}=g.useContext(gr),l=g.useContext(WNt),s=a==null?void 0:a.variant;let c;typeof e<"u"?c=e:n===!1?c="borderless":c=(r=(o=l??s)!==null&&o!==void 0?o:i)!==null&&r!==void 0?r:"outlined";const u=wzt.includes(c);return[c,u]},kBt=t=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:t==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function FBt(t,e){return t||kBt(e)}const ZTe=t=>{const{optionHeight:e,optionFontSize:n,optionLineHeight:o,optionPadding:r}=t;return{position:"relative",display:"block",minHeight:e,padding:r,color:t.colorText,fontWeight:"normal",fontSize:n,lineHeight:o,boxSizing:"border-box"}},LBt=t=>{const{antCls:e,componentCls:n}=t,o=`${n}-item`,r=`&${e}-slide-up-enter${e}-slide-up-enter-active`,i=`&${e}-slide-up-appear${e}-slide-up-appear-active`,a=`&${e}-slide-up-leave${e}-slide-up-leave-active`,l=`${n}-dropdown-placement-`,s=`${o}-option-selected`;return[{[`${n}-dropdown`]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:-9999,zIndex:t.zIndexPopup,boxSizing:"border-box",padding:t.paddingXXS,overflow:"hidden",fontSize:t.fontSize,fontVariant:"initial",backgroundColor:t.colorBgElevated,borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,[` +`].includes(xo)})},[W]),Pt=g.useContext(f9e)||{},Yt=Pt.maxCount,zt=Pt.rawValues,Rt=function(wo,Rr,Eo){if(!(pe&&ghe(Yt)&&(zt==null?void 0:zt.size)>=Yt)){var An=!0,Dn=wo;R==null||R(null);var sr=_jt(wo,W,ghe(Yt)?Yt-zt.size:void 0),Vo=Eo?null:sr;return w!=="combobox"&&Vo&&(Dn="",U==null||U(Vo),bt(!1),An=!1),N&&He!==Dn&&N(Dn,{source:Rr?"typing":"effect"}),An}},Ct=function(wo){!wo||!wo.trim()||N(wo,{source:"submit"})};g.useEffect(function(){!Ve&&!pe&&w!=="combobox"&&Rt("",!1,!1)},[Ve]),g.useEffect(function(){tt&&x&>(!1),x&&!Re.current&&qe(!1)},[x]);var yt=Gqe(),at=Sn(yt,2),Et=at[0],Lt=at[1],Je=g.useRef(!1),st=function(wo){var Rr=Et(),Eo=wo.key,An=Eo==="Enter";if(An&&(w!=="combobox"&&wo.preventDefault(),Ve||bt(!0)),Lt(!!He),Eo==="Backspace"&&!Rr&&pe&&!He&&u.length){for(var Dn=$o(u),sr=null,Vo=Dn.length-1;Vo>=0;Vo-=1){var Wo=Dn[Vo];if(!Wo.disabled){Dn.splice(Vo,1),sr=Wo;break}}sr&&d(Dn,{type:"remove",values:[sr]})}for(var To=arguments.length,Go=new Array(To>1?To-1:0),No=1;No1?Rr-1:0),An=1;An1?sr-1:0),Wo=1;Wo0,G=g.useMemo(function(){if(i===0||Y===0)return 0;var q=i/Y;return q*O},[i,Y,O]),Q=function(le){le.stopPropagation(),le.preventDefault()},oe=g.useRef({top:G,dragging:x,pageY:S,startTop:R});oe.current={top:G,dragging:x,pageY:S,startTop:R};var ee=function(le){C(!0),v(GTe(le,u)),M(oe.current.top),l(),le.stopPropagation(),le.preventDefault()};g.useEffect(function(){var q=function(me){me.preventDefault()},le=k.current,de=N.current;return le.addEventListener("touchstart",q),de.addEventListener("touchstart",ee),function(){le.removeEventListener("touchstart",q),de.removeEventListener("touchstart",ee)}},[]);var $=g.useRef();$.current=Y;var ae=g.useRef();ae.current=O,g.useEffect(function(){if(x){var q,le=function(me){var ce=oe.current,Pe=ce.dragging,pe=ce.pageY,Ie=ce.startTop;if(Ic.cancel(q),Pe){var ve=GTe(me,u)-pe,ze=Ie;!D&&u?ze-=ve:ze+=ve;var Ae=$.current,se=ae.current,ge=se?ze/se:0,we=Math.ceil(ge*Ae);we=Math.max(we,0),we=Math.min(we,Ae),q=Ic(function(){c(we,u)})}},de=function(){C(!1),s()};return window.addEventListener("mousemove",le),window.addEventListener("touchmove",le),window.addEventListener("mouseup",de),window.addEventListener("touchend",de),function(){window.removeEventListener("mousemove",le),window.removeEventListener("touchmove",le),window.removeEventListener("mouseup",de),window.removeEventListener("touchend",de),Ic.cancel(q)}}},[x]),g.useEffect(function(){j()},[i]),g.useImperativeHandle(e,function(){return{delayHidden:j}});var Z="".concat(o,"-scrollbar"),ne={position:"absolute",visibility:F&&_?null:"hidden"},te={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(ne.height=8,ne.left=0,ne.right=0,ne.bottom=0,te.height="100%",te.width=d,D?te.left=G:te.right=G):(ne.width=8,ne.top=0,ne.bottom=0,D?ne.right=0:ne.left=0,te.width="100%",te.height=d,te.top=G),g.createElement("div",{ref:k,className:Bn(Z,(n={},Ut(n,"".concat(Z,"-horizontal"),u),Ut(n,"".concat(Z,"-vertical"),!u),Ut(n,"".concat(Z,"-visible"),F),n)),style:nn(nn({},ne),p),onMouseDown:Q,onMouseMove:j},g.createElement("div",{ref:N,className:Bn("".concat(Z,"-thumb"),Ut({},"".concat(Z,"-thumb-moving"),x)),style:nn(nn({},te),m),onMouseDown:ee}))});function Kjt(t){var e=t.children,n=t.setRef,o=g.useCallback(function(r){n(r)},[]);return g.cloneElement(e,{ref:o})}function $jt(t,e,n,o,r,i,a){var l=a.getKey;return t.slice(e,n+1).map(function(s,c){var u=e+c,d=i(s,u,{style:{width:o}}),f=l(s);return g.createElement(Kjt,{key:f,setRef:function(m){return r(s,m)}},d)})}var qjt=function(){function t(){Uh(this,t),this.maps=void 0,this.id=0,this.maps=Object.create(null)}return jh(t,[{key:"set",value:function(n,o){this.maps[n]=o,this.id+=1}},{key:"get",value:function(n){return this.maps[n]}}]),t}();function Qjt(t,e,n){var o=g.useState(0),r=Sn(o,2),i=r[0],a=r[1],l=g.useRef(new Map),s=g.useRef(new qjt),c=g.useRef();function u(){Ic.cancel(c.current)}function d(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;u();var m=function(){l.current.forEach(function(w,x){if(w&&w.offsetParent){var C=jk(w),P=C.offsetHeight;s.current.get(x)!==P&&s.current.set(x,C.offsetHeight)}}),a(function(w){return w+1})};p?m():c.current=Ic(m)}function f(p,m){var y=t(p);l.current.get(y),m?(l.current.set(y,m),d()):l.current.delete(y)}return g.useEffect(function(){return u},[]),[f,d,s.current,i]}var Zjt=10;function eBt(t,e,n,o,r,i,a,l){var s=g.useRef(),c=g.useState(null),u=Sn(c,2),d=u[0],f=u[1];return Ml(function(){if(d&&d.times=0;U-=1){var W=r(e[U]),F=n.get(W);if(F===void 0){C=!0;break}if(N-=F,N<=0)break}switch(S){case"top":A=b-w;break;case"bottom":A=T-x+w;break;default:{var E=t.current.scrollTop,L=E+x;bL&&(P="bottom")}}A!==null&&a(A),A!==d.lastTop&&(C=!0)}C&&f(nn(nn({},d),{},{times:d.times+1,targetAlign:P,lastTop:A}))}},[d,t.current]),function(p){if(p==null){l();return}if(Ic.cancel(s.current),typeof p=="number")a(p);else if(p&&Vr(p)==="object"){var m,y=p.align;"index"in p?m=p.index:m=e.findIndex(function(C){return r(C)===p.key});var w=p.offset,x=w===void 0?0:w;f({times:0,index:m,offset:x,originAlign:y})}}}function tBt(t,e,n){var o=t.length,r=e.length,i,a;if(o===0&&r===0)return null;o"u"?"undefined":Vr(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const rQe=function(t,e){var n=g.useRef(!1),o=g.useRef(null);function r(){clearTimeout(o.current),n.current=!0,o.current=setTimeout(function(){n.current=!1},50)}var i=g.useRef({top:t,bottom:e});return i.current.top=t,i.current.bottom=e,function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=a<0&&i.current.top||a>0&&i.current.bottom;return l&&s?(clearTimeout(o.current),n.current=!1):(!s||n.current)&&r(),!n.current&&s}};function oBt(t,e,n,o,r){var i=g.useRef(0),a=g.useRef(null),l=g.useRef(null),s=g.useRef(!1),c=rQe(e,n);function u(w,x){Ic.cancel(a.current),i.current+=x,l.current=x,!c(x)&&(JTe||w.preventDefault(),a.current=Ic(function(){var C=s.current?10:1;r(i.current*C),i.current=0}))}function d(w,x){r(x,!0),JTe||w.preventDefault()}var f=g.useRef(null),p=g.useRef(null);function m(w){if(t){Ic.cancel(p.current),p.current=Ic(function(){f.current=null},2);var x=w.deltaX,C=w.deltaY,P=w.shiftKey,A=x,S=C;(f.current==="sx"||!f.current&&P&&C&&!x)&&(A=C,S=0,f.current="sx");var v=Math.abs(A),b=Math.abs(S);f.current===null&&(f.current=o&&v>b?"x":"y"),f.current==="y"?u(w,S):d(w,A)}}function y(w){t&&(s.current=w.detail===l.current)}return[m,y]}var rBt=14/15;function iBt(t,e,n){var o=g.useRef(!1),r=g.useRef(0),i=g.useRef(null),a=g.useRef(null),l,s=function(f){if(o.current){var p=Math.ceil(f.touches[0].pageY),m=r.current-p;r.current=p,n(m)&&f.preventDefault(),clearInterval(a.current),a.current=setInterval(function(){m*=rBt,(!n(m,!0)||Math.abs(m)<=.1)&&clearInterval(a.current)},16)}},c=function(){o.current=!1,l()},u=function(f){l(),f.touches.length===1&&!o.current&&(o.current=!0,r.current=Math.ceil(f.touches[0].pageY),i.current=f.target,i.current.addEventListener("touchmove",s),i.current.addEventListener("touchend",c))};l=function(){i.current&&(i.current.removeEventListener("touchmove",s),i.current.removeEventListener("touchend",c))},Ml(function(){return t&&e.current.addEventListener("touchstart",u),function(){var d;(d=e.current)===null||d===void 0||d.removeEventListener("touchstart",u),l(),clearInterval(a.current)}},[t])}var aBt=20;function KTe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*100;return isNaN(n)&&(n=0),n=Math.max(n,aBt),n=Math.min(n,t/2),Math.floor(n)}function lBt(t,e,n,o){var r=g.useMemo(function(){return[new Map,[]]},[t,n.id,o]),i=Sn(r,2),a=i[0],l=i[1],s=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var m=t.length,y=l.length;yi||!!y),D=m==="rtl",k=Bn(o,Ut({},"".concat(o,"-rtl"),D),r),N=u||cBt,U=g.useRef(),W=g.useRef(),F=g.useState(0),E=Sn(F,2),L=E[0],j=E[1],Y=g.useState(0),O=Sn(Y,2),_=O[0],G=O[1],Q=g.useState(!1),oe=Sn(Q,2),ee=oe[0],$=oe[1],ae=function(){$(!0)},Z=function(){$(!1)},ne=g.useCallback(function(Lt){return typeof f=="function"?f(Lt):Lt==null?void 0:Lt[f]},[f]),te={getKey:ne};function q(Lt){j(function(Je){var st;typeof Lt=="function"?st=Lt(Je):st=Lt;var It=lt(st);return U.current.scrollTop=It,It})}var le=g.useRef({start:0,end:N.length}),de=g.useRef(),he=nBt(N,ne),me=Sn(he,1),ce=me[0];de.current=ce;var Pe=Qjt(ne),pe=Sn(Pe,4),Ie=pe[0],ve=pe[1],ze=pe[2],Ae=pe[3],se=g.useMemo(function(){if(!R)return{scrollHeight:void 0,start:0,end:N.length-1,offset:void 0};if(!M){var Lt;return{scrollHeight:((Lt=W.current)===null||Lt===void 0?void 0:Lt.offsetHeight)||0,start:0,end:N.length-1,offset:void 0}}for(var Je=0,st,It,ot,it=N.length,Be=0;Be=L&&st===void 0&&(st=Be,It=Je),ft>L+i&&ot===void 0&&(ot=Be),Je=ft}return st===void 0&&(st=0,It=0,ot=Math.ceil(i/a)),ot===void 0&&(ot=N.length-1),ot=Math.min(ot+1,N.length-1),{scrollHeight:Je,start:st,end:ot,offset:It}},[M,R,L,N,Ae,i]),ge=se.scrollHeight,we=se.start,Se=se.end,Me=se.offset;le.current.start=we,le.current.end=Se;var Ce=g.useState({width:0,height:i}),Te=Sn(Ce,2),Re=Te[0],Ne=Te[1],_e=function(Je){Ne({width:Je.width||Je.offsetWidth,height:Je.height||Je.offsetHeight})},Ue=g.useRef(),qe=g.useRef(),Fe=g.useMemo(function(){return KTe(Re.width,y)},[Re.width,y]),He=g.useMemo(function(){return KTe(Re.height,ge)},[Re.height,ge]),Le=ge-i,Ye=g.useRef(Le);Ye.current=Le;function lt(Lt){var Je=Lt;return Number.isNaN(Ye.current)||(Je=Math.min(Je,Ye.current)),Je=Math.max(Je,0),Je}var Oe=L<=0,ut=L>=Le,ht=rQe(Oe,ut),Qe=function(){return{x:D?-_:_,y:L}},nt=g.useRef(Qe()),mt=Dd(function(){if(P){var Lt=Qe();(nt.current.x!==Lt.x||nt.current.y!==Lt.y)&&(P(Lt),nt.current=Lt)}});function tt(Lt,Je){var st=Lt;Je?(r0.flushSync(function(){G(st)}),mt()):q(st)}function gt(Lt){var Je=Lt.currentTarget.scrollTop;Je!==L&&q(Je),C==null||C(Lt),mt()}var Ve=function(Je){var st=Je,It=y-Re.width;return st=Math.max(st,0),st=Math.min(st,It),st},je=Dd(function(Lt,Je){Je?(r0.flushSync(function(){G(function(st){var It=st+(D?-Lt:Lt);return Ve(It)})}),mt()):q(function(st){var It=st+Lt;return It})}),et=oBt(R,Oe,ut,!!y,je),bt=Sn(et,2),St=bt[0],Pt=bt[1];iBt(R,U,function(Lt,Je){return ht(Lt,Je)?!1:(St({preventDefault:function(){},deltaY:Lt}),!0)}),Ml(function(){function Lt(st){R&&st.preventDefault()}var Je=U.current;return Je.addEventListener("wheel",St),Je.addEventListener("DOMMouseScroll",Pt),Je.addEventListener("MozMousePixelScroll",Lt),function(){Je.removeEventListener("wheel",St),Je.removeEventListener("DOMMouseScroll",Pt),Je.removeEventListener("MozMousePixelScroll",Lt)}},[R]),Ml(function(){y&&G(function(Lt){return Ve(Lt)})},[Re.width,y]);var Yt=function(){var Je,st;(Je=Ue.current)===null||Je===void 0||Je.delayHidden(),(st=qe.current)===null||st===void 0||st.delayHidden()},zt=eBt(U,N,ze,a,ne,function(){return ve(!0)},q,Yt);g.useImperativeHandle(e,function(){return{getScrollInfo:Qe,scrollTo:function(Je){function st(It){return It&&Vr(It)==="object"&&("left"in It||"top"in It)}st(Je)?(Je.left!==void 0&&G(Ve(Je.left)),zt(Je.top)):zt(Je)}}}),Ml(function(){if(A){var Lt=N.slice(we,Se+1);A(Lt,N)}},[we,Se,N]);var Rt=lBt(N,ne,ze,a),Ct=v==null?void 0:v({start:we,end:Se,virtual:M,offsetX:_,offsetY:Me,rtl:D,getSize:Rt}),yt=$jt(N,we,Se,y,Ie,d,te),at=null;i&&(at=nn(Ut({},s?"height":"maxHeight",i),uBt),R&&(at.overflowY="hidden",y&&(at.overflowX="hidden"),ee&&(at.pointerEvents="none")));var Et={};return D&&(Et.dir="rtl"),g.createElement("div",Uo({style:nn(nn({},c),{},{position:"relative"}),className:k},Et,T),g.createElement(Ld,{onResize:_e},g.createElement(x,{className:"".concat(o,"-holder"),style:at,ref:U,onScroll:gt,onMouseEnter:Yt},g.createElement(oQe,{prefixCls:o,height:ge,offsetX:_,offsetY:Me,scrollWidth:y,onInnerResize:ve,ref:W,innerProps:S,rtl:D,extra:Ct},yt))),M&&ge>i&&g.createElement(XTe,{ref:Ue,prefixCls:o,scrollOffset:L,scrollRange:ge,rtl:D,onScroll:tt,onStartMove:ae,onStopMove:Z,spinSize:He,containerSize:Re.height,style:b==null?void 0:b.verticalScrollBar,thumbStyle:b==null?void 0:b.verticalScrollBarThumb}),M&&y&&g.createElement(XTe,{ref:qe,prefixCls:o,scrollOffset:_,scrollRange:y,rtl:D,onScroll:tt,onStartMove:ae,onStopMove:Z,spinSize:Fe,containerSize:Re.width,horizontal:!0,style:b==null?void 0:b.horizontalScrollBar,thumbStyle:b==null?void 0:b.horizontalScrollBarThumb}))}var g9e=g.forwardRef(dBt);g9e.displayName="List";function fBt(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var hBt=["disabled","title","children","style","className"];function $Te(t){return typeof t=="string"||typeof t=="number"}var pBt=function(e,n){var o=kUt(),r=o.prefixCls,i=o.id,a=o.open,l=o.multiple,s=o.mode,c=o.searchValue,u=o.toggleOpen,d=o.notFoundContent,f=o.onPopupScroll,p=g.useContext(f9e),m=p.maxCount,y=p.flattenOptions,w=p.onActiveValue,x=p.defaultActiveFirstOption,C=p.onSelect,P=p.menuItemSelectedIcon,A=p.rawValues,S=p.fieldNames,v=p.virtual,b=p.direction,T=p.listHeight,R=p.listItemHeight,M=p.optionRender,D="".concat(r,"-item"),k=k5e(function(){return y},[a,y],function(te,q){return q[0]&&te[1]!==q[1]}),N=g.useRef(null),U=g.useMemo(function(){return l&&ghe(m)&&(A==null?void 0:A.size)>=m},[l,m,A==null?void 0:A.size]),W=function(q){q.preventDefault()},F=function(q){var le;(le=N.current)===null||le===void 0||le.scrollTo(typeof q=="number"?{index:q}:q)},E=g.useCallback(function(te){return s==="combobox"?!1:A.has(te)},[s,$o(A).toString(),A.size]),L=function(q){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=k.length,he=0;he1&&arguments[1]!==void 0?arguments[1]:!1;_(q);var de={source:le?"keyboard":"mouse"},he=k[q];if(!he){w(null,-1,de);return}w(he.value,q,de)};g.useEffect(function(){G(x!==!1?L(0):-1)},[k.length,c]);var Q=g.useCallback(function(te){return s==="combobox"?String(te).toLowerCase()===c.toLowerCase():A.has(te)},[s,c,$o(A).toString(),A.size]);g.useEffect(function(){var te=setTimeout(function(){if(!l&&a&&A.size===1){var le=Array.from(A)[0],de=k.findIndex(function(he){var me=he.data;return me.value===le});de!==-1&&(G(de),F(de))}});if(a){var q;(q=N.current)===null||q===void 0||q.scrollTo(void 0)}return function(){return clearTimeout(te)}},[a,c]);var oe=function(q){q!==void 0&&C(q,{selected:!A.has(q)}),l||u(!1)};if(g.useImperativeHandle(n,function(){return{onKeyDown:function(q){var le=q.which,de=q.ctrlKey;switch(le){case Lo.N:case Lo.P:case Lo.UP:case Lo.DOWN:{var he=0;if(le===Lo.UP?he=-1:le===Lo.DOWN?he=1:fBt()&&de&&(le===Lo.N?he=1:le===Lo.P&&(he=-1)),he!==0){var me=L(O+he,he);F(me),G(me,!0)}break}case Lo.TAB:case Lo.ENTER:{var ce,Pe=k[O];Pe&&!(Pe!=null&&(ce=Pe.data)!==null&&ce!==void 0&&ce.disabled)&&!U?oe(Pe.value):oe(void 0),a&&q.preventDefault();break}case Lo.ESC:u(!1),a&&q.stopPropagation()}},onKeyUp:function(){},scrollTo:function(q){F(q)}}}),k.length===0)return g.createElement("div",{role:"listbox",id:"".concat(i,"_list"),className:"".concat(D,"-empty"),onMouseDown:W},d);var ee=Object.keys(S).map(function(te){return S[te]}),$=function(q){return q.label};function ae(te,q){var le=te.group;return{role:le?"presentation":"option",id:"".concat(i,"_list_").concat(q)}}var Z=function(q){var le=k[q];if(!le)return null;var de=le.data||{},he=de.value,me=le.group,ce=F1(de,!0),Pe=$(le);return le?g.createElement("div",Uo({"aria-label":typeof Pe=="string"&&!me?Pe:null},ce,{key:q},ae(le,q),{"aria-selected":Q(he)}),he):null},ne={role:"listbox",id:"".concat(i,"_list")};return g.createElement(g.Fragment,null,v&&g.createElement("div",Uo({},ne,{style:{height:0,width:0,overflow:"hidden"}}),Z(O-1),Z(O),Z(O+1)),g.createElement(g9e,{itemKey:"key",ref:N,data:k,height:T,itemHeight:R,fullHeight:!1,onMouseDown:W,onScroll:f,virtual:v,direction:b,innerProps:v?null:ne},function(te,q){var le=te.group,de=te.groupOption,he=te.data,me=te.label,ce=te.value,Pe=he.key;if(le){var pe,Ie=(pe=he.title)!==null&&pe!==void 0?pe:$Te(me)?me.toString():void 0;return g.createElement("div",{className:Bn(D,"".concat(D,"-group"),he.className),title:Ie},me!==void 0?me:Pe)}var ve=he.disabled,ze=he.title;he.children;var Ae=he.style,se=he.className,ge=Ai(he,hBt),we=tI(ge,ee),Se=E(ce),Me=ve||!Se&&U,Ce="".concat(D,"-option"),Te=Bn(D,Ce,se,Ut(Ut(Ut(Ut({},"".concat(Ce,"-grouped"),de),"".concat(Ce,"-active"),O===q&&!Me),"".concat(Ce,"-disabled"),Me),"".concat(Ce,"-selected"),Se)),Re=$(te),Ne=!P||typeof P=="function"||Se,_e=typeof Re=="number"?Re:Re||ce,Ue=$Te(_e)?_e.toString():void 0;return ze!==void 0&&(Ue=ze),g.createElement("div",Uo({},F1(we),v?{}:ae(te,q),{"aria-selected":Q(ce),className:Te,title:Ue,onMouseMove:function(){O===q||Me||G(q)},onClick:function(){Me||oe(ce)},style:Ae}),g.createElement("div",{className:"".concat(Ce,"-content")},typeof M=="function"?M(te,{index:q}):_e),g.isValidElement(P)||Se,Ne&&g.createElement(CZ,{className:"".concat(D,"-option-state"),customizeIcon:P,customizeIconProps:{value:ce,disabled:Me,isSelected:Se}},Se?"✓":null))}))},gBt=g.forwardRef(pBt);const mBt=function(t,e){var n=g.useRef({values:new Map,options:new Map}),o=g.useMemo(function(){var i=n.current,a=i.values,l=i.options,s=t.map(function(d){if(d.label===void 0){var f;return nn(nn({},d),{},{label:(f=a.get(d.value))===null||f===void 0?void 0:f.label})}return d}),c=new Map,u=new Map;return s.forEach(function(d){c.set(d.value,d),u.set(d.value,e.get(d.value)||l.get(d.value))}),n.current.values=c,n.current.options=u,s},[t,e]),r=g.useCallback(function(i){return e.get(i)||n.current.options.get(i)},[e]);return[o,r]};function Ble(t,e){return Qqe(t).join("").toUpperCase().includes(e)}const yBt=function(t,e,n,o,r){return g.useMemo(function(){if(!n||o===!1)return t;var i=e.options,a=e.label,l=e.value,s=[],c=typeof o=="function",u=n.toUpperCase(),d=c?o:function(p,m){return r?Ble(m[r],u):m[i]?Ble(m[a!=="children"?a:"label"],u):Ble(m[l],u)},f=c?function(p){return mhe(p)}:function(p){return p};return t.forEach(function(p){if(p[i]){var m=d(n,f(p));if(m)s.push(p);else{var y=p[i].filter(function(w){return d(n,f(w))});y.length&&s.push(nn(nn({},p),{},Ut({},i,y)))}return}d(n,f(p))&&s.push(p)}),s},[t,o,r,n,e])};var qTe=0,ABt=mm();function wBt(){var t;return ABt?(t=qTe,qTe+=1):t="TEST_OR_SSR",t}function xBt(t){var e=g.useState(),n=Sn(e,2),o=n[0],r=n[1];return g.useEffect(function(){r("rc_select_".concat(wBt()))},[]),t||o}var vBt=["children","value"],bBt=["children"];function SBt(t){var e=t,n=e.key,o=e.props,r=o.children,i=o.value,a=Ai(o,vBt);return nn({key:n,value:i!==void 0?i:n,children:r},a)}function iQe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return t7(t).map(function(n,o){if(!g.isValidElement(n)||!n.type)return null;var r=n,i=r.type.isSelectOptGroup,a=r.key,l=r.props,s=l.children,c=Ai(l,bBt);return e||!i?SBt(n):nn(nn({key:"__RC_SELECT_GRP__".concat(a===null?o:a,"__"),label:a},c),{},{options:iQe(s)})}).filter(function(n){return n})}var TBt=function(e,n,o,r,i){return g.useMemo(function(){var a=e,l=!e;l&&(a=iQe(n));var s=new Map,c=new Map,u=function(p,m,y){y&&typeof y=="string"&&p.set(m[y],m)},d=function f(p){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,y=0;y0?bt(Yt.options):Yt.options}):Yt})},_e=g.useMemo(function(){return C?Ne(Re):Re},[Re,C,ne]),Ue=g.useMemo(function(){return Ojt(_e,{fieldNames:$,childrenAsData:oe})},[_e,$,oe]),qe=function(St){var Pt=me(St);if(Ie(Pt),Y&&(Pt.length!==se.length||Pt.some(function(Rt,Ct){var yt;return((yt=se[Ct])===null||yt===void 0?void 0:yt.value)!==(Rt==null?void 0:Rt.value)}))){var Yt=j?Pt:Pt.map(function(Rt){return Rt.value}),zt=Pt.map(function(Rt){return mhe(ge(Rt.value))});Y(Q?Yt:Yt[0],Q?zt:zt[0])}},Fe=g.useState(null),He=Sn(Fe,2),Le=He[0],Ye=He[1],lt=g.useState(0),Oe=Sn(lt,2),ut=Oe[0],ht=Oe[1],Qe=T!==void 0?T:o!=="combobox",nt=g.useCallback(function(bt,St){var Pt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Yt=Pt.source,zt=Yt===void 0?"keyboard":Yt;ht(St),a&&o==="combobox"&&bt!==null&&zt==="keyboard"&&Ye(String(bt))},[a,o]),mt=function(St,Pt,Yt){var zt=function(){var ot,it=ge(St);return[j?{label:it==null?void 0:it[$.label],value:St,key:(ot=it==null?void 0:it.key)!==null&&ot!==void 0?ot:St}:St,mhe(it)]};if(Pt&&p){var Rt=zt(),Ct=Sn(Rt,2),yt=Ct[0],at=Ct[1];p(yt,at)}else if(!Pt&&m&&Yt!=="clear"){var Et=zt(),Lt=Sn(Et,2),Je=Lt[0],st=Lt[1];m(Je,st)}},tt=QTe(function(bt,St){var Pt,Yt=Q?St.selected:!0;Yt?Pt=Q?[].concat($o(se),[bt]):[bt]:Pt=se.filter(function(zt){return zt.value!==bt}),qe(Pt),mt(bt,Yt),o==="combobox"?Ye(""):(!yhe||f)&&(te(""),Ye(""))}),gt=function(St,Pt){qe(St);var Yt=Pt.type,zt=Pt.values;(Yt==="remove"||Yt==="clear")&&zt.forEach(function(Rt){mt(Rt.value,!1,Yt)})},Ve=function(St,Pt){if(te(St),Ye(null),Pt.source==="submit"){var Yt=(St||"").trim();if(Yt){var zt=Array.from(new Set([].concat($o(Se),[Yt])));qe(zt),mt(Yt,!0),te("")}return}Pt.source!=="blur"&&(o==="combobox"&&qe(St),u==null||u(St))},je=function(St){var Pt=St;o!=="tags"&&(Pt=St.map(function(zt){var Rt=de.get(zt);return Rt==null?void 0:Rt.value}).filter(function(zt){return zt!==void 0}));var Yt=Array.from(new Set([].concat($o(Se),$o(Pt))));qe(Yt),Yt.forEach(function(zt){mt(zt,!0)})},et=g.useMemo(function(){var bt=M!==!1&&w!==!1;return nn(nn({},q),{},{flattenOptions:Ue,onActiveValue:nt,defaultActiveFirstOption:Qe,onSelect:tt,menuItemSelectedIcon:R,rawValues:Se,fieldNames:$,virtual:bt,direction:D,listHeight:N,listItemHeight:W,childrenAsData:oe,maxCount:O,optionRender:v})},[O,q,Ue,nt,Qe,tt,R,Se,$,M,w,D,N,W,oe,v]);return g.createElement(f9e.Provider,{value:et},g.createElement(Jjt,Uo({},_,{id:G,prefixCls:i,ref:e,omitDomProps:CBt,mode:o,displayValues:we,onDisplayValuesChange:gt,direction:D,searchValue:ne,onSearch:Ve,autoClearSearchValue:f,onSearchSplit:je,dropdownMatchSelectWidth:w,OptionList:gBt,emptyOptions:!Ue.length,activeValue:Le,activeDescendantId:"".concat(G,"_list_").concat(ut)})))}),m9e=HBt;m9e.Option=p9e;m9e.OptGroup=h9e;function o7(t,e,n){return Mn({[`${t}-status-success`]:e==="success",[`${t}-status-warning`]:e==="warning",[`${t}-status-error`]:e==="error",[`${t}-status-validating`]:e==="validating",[`${t}-has-feedback`]:n})}const US=(t,e)=>e||t,MBt=()=>{const[,t]=Ff(),[e]=r6("Empty"),o=new Di(t.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return g.createElement("svg",{style:o,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},g.createElement("title",null,(e==null?void 0:e.description)||"Empty"),g.createElement("g",{fill:"none",fillRule:"evenodd"},g.createElement("g",{transform:"translate(24 31.67)"},g.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),g.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),g.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),g.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),g.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),g.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),g.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},g.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),g.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},IBt=()=>{const[,t]=Ff(),[e]=r6("Empty"),{colorFill:n,colorFillTertiary:o,colorFillQuaternary:r,colorBgContainer:i}=t,{borderColor:a,shadowColor:l,contentColor:s}=g.useMemo(()=>({borderColor:new Di(n).onBackground(i).toHexString(),shadowColor:new Di(o).onBackground(i).toHexString(),contentColor:new Di(r).onBackground(i).toHexString()}),[n,o,r,i]);return g.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},g.createElement("title",null,(e==null?void 0:e.description)||"Empty"),g.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},g.createElement("ellipse",{fill:l,cx:"32",cy:"33",rx:"32",ry:"7"}),g.createElement("g",{fillRule:"nonzero",stroke:a},g.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),g.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:s}))))},zBt=t=>{const{componentCls:e,margin:n,marginXS:o,marginXL:r,fontSize:i,lineHeight:a}=t;return{[e]:{marginInline:o,fontSize:i,lineHeight:a,textAlign:"center",[`${e}-image`]:{height:t.emptyImgHeight,marginBottom:o,opacity:t.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},[`${e}-description`]:{color:t.colorTextDescription},[`${e}-footer`]:{marginTop:n},"&-normal":{marginBlock:r,color:t.colorTextDescription,[`${e}-description`]:{color:t.colorTextDescription},[`${e}-image`]:{height:t.emptyImgHeightMD}},"&-small":{marginBlock:o,color:t.colorTextDescription,[`${e}-image`]:{height:t.emptyImgHeightSM}}}}},DBt=el("Empty",t=>{const{componentCls:e,controlHeightLG:n,calc:o}=t,r=Ui(t,{emptyImgCls:`${e}-img`,emptyImgHeight:o(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:o(n).mul(.875).equal()});return[zBt(r)]});var EBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e,n,o,r,i,a,l,s;const{className:c,rootClassName:u,prefixCls:d,image:f=aQe,description:p,children:m,imageStyle:y,style:w,classNames:x,styles:C}=t,P=EBt(t,["className","rootClassName","prefixCls","image","description","children","imageStyle","style","classNames","styles"]),{getPrefixCls:A,direction:S,empty:v}=g.useContext(gr),b=A("empty",d),[T,R,M]=DBt(b),[D]=r6("Empty"),k=typeof p<"u"?p:D==null?void 0:D.description,N=typeof k=="string"?k:"empty";let U=null;return typeof f=="string"?U=g.createElement("img",{alt:N,src:f}):U=f,T(g.createElement("div",Object.assign({className:Mn(R,M,b,v==null?void 0:v.className,{[`${b}-normal`]:f===lQe,[`${b}-rtl`]:S==="rtl"},c,u,(e=v==null?void 0:v.classNames)===null||e===void 0?void 0:e.root,x==null?void 0:x.root),style:Object.assign(Object.assign(Object.assign(Object.assign({},(n=v==null?void 0:v.styles)===null||n===void 0?void 0:n.root),v==null?void 0:v.style),C==null?void 0:C.root),w)},P),g.createElement("div",{className:Mn(`${b}-image`,(o=v==null?void 0:v.classNames)===null||o===void 0?void 0:o.image,x==null?void 0:x.image),style:Object.assign(Object.assign(Object.assign({},y),(r=v==null?void 0:v.styles)===null||r===void 0?void 0:r.image),C==null?void 0:C.image)},U),k&&g.createElement("div",{className:Mn(`${b}-description`,(i=v==null?void 0:v.classNames)===null||i===void 0?void 0:i.description,x==null?void 0:x.description),style:Object.assign(Object.assign({},(a=v==null?void 0:v.styles)===null||a===void 0?void 0:a.description),C==null?void 0:C.description)},k),m&&g.createElement("div",{className:Mn(`${b}-footer`,(l=v==null?void 0:v.classNames)===null||l===void 0?void 0:l.footer,x==null?void 0:x.footer),style:Object.assign(Object.assign({},(s=v==null?void 0:v.styles)===null||s===void 0?void 0:s.footer),C==null?void 0:C.footer)},m)))};w1.PRESENTED_IMAGE_DEFAULT=aQe;w1.PRESENTED_IMAGE_SIMPLE=lQe;const y9e=t=>{const{componentName:e}=t,{getPrefixCls:n}=g.useContext(gr),o=n("empty");switch(e){case"Table":case"List":return xe.createElement(w1,{image:w1.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return xe.createElement(w1,{image:w1.PRESENTED_IMAGE_SIMPLE,className:`${o}-small`});case"Table.filter":return null;default:return xe.createElement(w1,null)}},jS=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;var o,r;const{variant:i,[t]:a}=g.useContext(gr),l=g.useContext(WNt),s=a==null?void 0:a.variant;let c;typeof e<"u"?c=e:n===!1?c="borderless":c=(r=(o=l??s)!==null&&o!==void 0?o:i)!==null&&r!==void 0?r:"outlined";const u=wzt.includes(c);return[c,u]},kBt=t=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:t==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function FBt(t,e){return t||kBt(e)}const ZTe=t=>{const{optionHeight:e,optionFontSize:n,optionLineHeight:o,optionPadding:r}=t;return{position:"relative",display:"block",minHeight:e,padding:r,color:t.colorText,fontWeight:"normal",fontSize:n,lineHeight:o,boxSizing:"border-box"}},LBt=t=>{const{antCls:e,componentCls:n}=t,o=`${n}-item`,r=`&${e}-slide-up-enter${e}-slide-up-enter-active`,i=`&${e}-slide-up-appear${e}-slide-up-appear-active`,a=`&${e}-slide-up-leave${e}-slide-up-leave-active`,l=`${n}-dropdown-placement-`,s=`${o}-option-selected`;return[{[`${n}-dropdown`]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:-9999,zIndex:t.zIndexPopup,boxSizing:"border-box",padding:t.paddingXXS,overflow:"hidden",fontSize:t.fontSize,fontVariant:"initial",backgroundColor:t.colorBgElevated,borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,[` ${r}${l}bottomLeft, ${i}${l}bottomLeft `]:{animationName:gZ},[` @@ -4553,7 +4553,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `]:{paddingInlineEnd:t.showArrowPaddingInlineEnd},[`&${n}-open ${n}-selection-item`]:{color:t.colorTextPlaceholder},[`&:not(${n}-customize-input)`]:{[`${n}-selector`]:{width:"100%",height:"100%",alignItems:"center",padding:`0 ${jt(o)}`,[`${n}-selection-search-input`]:{height:i},"&:after":{lineHeight:jt(i)}}},[`&${n}-customize-input`]:{[`${n}-selector`]:{"&:after":{display:"none"},[`${n}-selection-search`]:{position:"static",width:"100%"},[`${n}-selection-placeholder`]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:`0 ${jt(o)}`,"&:after":{display:"none"}}}}}}}function jBt(t){const{componentCls:e}=t,n=t.calc(t.controlPaddingHorizontalSM).sub(t.lineWidth).equal();return[Ole(t),Ole(Ui(t,{controlHeight:t.controlHeightSM,borderRadius:t.borderRadiusSM}),"sm"),{[`${e}-single${e}-sm`]:{[`&:not(${e}-customize-input)`]:{[`${e}-selector`]:{padding:`0 ${jt(n)}`},[`&${e}-show-arrow ${e}-selection-search`]:{insetInlineEnd:t.calc(n).add(t.calc(t.fontSize).mul(1.5)).equal()},[` &${e}-show-arrow ${e}-selection-item, &${e}-show-arrow ${e}-selection-placeholder - `]:{paddingInlineEnd:t.calc(t.fontSize).mul(1.5).equal()}}}},Ole(Ui(t,{controlHeight:t.singleItemHeightLG,fontSize:t.fontSizeLG,borderRadius:t.borderRadiusLG}),"lg")]}const BBt=t=>{const{fontSize:e,lineHeight:n,lineWidth:o,controlHeight:r,controlHeightSM:i,controlHeightLG:a,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:m,colorFillSecondary:y,colorBgContainerDisabled:w,colorTextDisabled:x,colorPrimaryHover:C,colorPrimary:P,controlOutline:A}=t,S=l*2,v=o*2,b=Math.min(r-S,r-v),T=Math.min(i-S,i-v),R=Math.min(a-S,a-v);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(r-e*n)/2}px ${s}px`,optionFontSize:e,optionLineHeight:n,optionHeight:r,selectorBg:m,clearBg:m,singleItemHeightLG:a,multipleItemBg:y,multipleItemBorderColor:"transparent",multipleItemHeight:b,multipleItemHeightSM:T,multipleItemHeightLG:R,multipleSelectorBgDisabled:w,multipleItemColorDisabled:x,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(t.fontSize*1.25),hoverBorderColor:C,activeBorderColor:P,activeOutlineColor:A,selectAffixPadding:l}},uQe=(t,e)=>{const{componentCls:n,antCls:o,controlOutlineWidth:r}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{border:`${jt(t.lineWidth)} ${t.lineType} ${e.borderColor}`,background:t.selectorBg},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:e.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:e.activeBorderColor,boxShadow:`0 0 0 ${jt(r)} ${e.activeOutlineColor}`,outline:0},[`${n}-prefix`]:{color:e.color}}}},ePe=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},uQe(t,e))}),YBt=t=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},uQe(t,{borderColor:t.colorBorder,hoverBorderHover:t.hoverBorderColor,activeBorderColor:t.activeBorderColor,activeOutlineColor:t.activeOutlineColor,color:t.colorText})),ePe(t,{status:"error",borderColor:t.colorError,hoverBorderHover:t.colorErrorHover,activeBorderColor:t.colorError,activeOutlineColor:t.colorErrorOutline,color:t.colorError})),ePe(t,{status:"warning",borderColor:t.colorWarning,hoverBorderHover:t.colorWarningHover,activeBorderColor:t.colorWarning,activeOutlineColor:t.colorWarningOutline,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}})}),dQe=(t,e)=>{const{componentCls:n,antCls:o}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{background:e.bg,border:`${jt(t.lineWidth)} ${t.lineType} transparent`,color:e.color},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{background:e.hoverBg},[`${n}-focused& ${n}-selector`]:{background:t.selectorBg,borderColor:e.activeBorderColor,outline:0}}}},tPe=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},dQe(t,e))}),OBt=t=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},dQe(t,{bg:t.colorFillTertiary,hoverBg:t.colorFillSecondary,activeBorderColor:t.activeBorderColor,color:t.colorText})),tPe(t,{status:"error",bg:t.colorErrorBg,hoverBg:t.colorErrorBgHover,activeBorderColor:t.colorError,color:t.colorError})),tPe(t,{status:"warning",bg:t.colorWarningBg,hoverBg:t.colorWarningBgHover,activeBorderColor:t.colorWarning,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{borderColor:t.colorBorder,background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`}})}),_Bt=t=>({"&-borderless":{[`${t.componentCls}-selector`]:{background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`},[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`},[`&${t.componentCls}-status-error`]:{[`${t.componentCls}-prefix, ${t.componentCls}-selection-item`]:{color:t.colorError}},[`&${t.componentCls}-status-warning`]:{[`${t.componentCls}-prefix, ${t.componentCls}-selection-item`]:{color:t.colorWarning}}}}),VBt=t=>({[t.componentCls]:Object.assign(Object.assign(Object.assign({},YBt(t)),OBt(t)),_Bt(t))}),GBt=t=>{const{componentCls:e}=t;return{position:"relative",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,input:{cursor:"pointer"},[`${e}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},[`${e}-disabled&`]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},XBt=t=>{const{componentCls:e}=t;return{[`${e}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},JBt=t=>{const{antCls:e,componentCls:n,inputPaddingHorizontalBase:o,iconCls:r}=t;return{[n]:Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-flex",cursor:"pointer",[`&:not(${n}-customize-input) ${n}-selector`]:Object.assign(Object.assign({},GBt(t)),XBt(t)),[`${n}-selection-item`]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},e7),{[`> ${e}-typography`]:{display:"inline"}}),[`${n}-selection-placeholder`]:Object.assign(Object.assign({},e7),{flex:1,color:t.colorTextPlaceholder,pointerEvents:"none"}),[`${n}-arrow`]:Object.assign(Object.assign({},WS()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:`opacity ${t.motionDurationSlow} ease`,[r]:{verticalAlign:"top",transition:`transform ${t.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${n}-suffix)`]:{pointerEvents:"auto"}},[`${n}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${n}-selection-wrap`]:{display:"flex",width:"100%",position:"relative",minWidth:0,"&:after":{content:'"\\a0"',width:0,overflow:"hidden"}},[`${n}-prefix`]:{flex:"none",marginInlineEnd:t.selectAffixPadding},[`${n}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,zIndex:1,display:"inline-block",width:t.fontSizeIcon,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:`color ${t.motionDurationMid} ease, opacity ${t.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:t.colorTextTertiary}},[`&:hover ${n}-clear`]:{opacity:1,background:t.colorBgBase,borderRadius:"50%"}}),[`${n}-status`]:{"&-error, &-warning, &-success, &-validating":{[`&${n}-has-feedback`]:{[`${n}-clear`]:{insetInlineEnd:t.calc(o).add(t.fontSize).add(t.paddingXS).equal()}}}}}},KBt=t=>{const{componentCls:e}=t;return[{[e]:{[`&${e}-in-form-item`]:{width:"100%"}}},JBt(t),jBt(t),UBt(t),LBt(t),{[`${e}-rtl`]:{direction:"rtl"}},sU(t,{borderElCls:`${e}-selector`,focusElCls:`${e}-focused`})]},$Bt=el("Select",(t,e)=>{let{rootPrefixCls:n}=e;const o=Ui(t,{rootPrefixCls:n,inputPaddingHorizontalBase:t.calc(t.paddingSM).sub(1).equal(),multipleSelectItemHeight:t.multipleItemHeight,selectHeight:t.controlHeight});return[KBt(o),VBt(o)]},BBt,{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});var qBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},QBt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:qBt}))},fQe=g.forwardRef(QBt),ZBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},eYt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ZBt}))},RZ=g.forwardRef(eYt),tYt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},nYt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:tYt}))},HZ=g.forwardRef(nYt);function hQe(t){let{suffixIcon:e,clearIcon:n,menuItemSelectedIcon:o,removeIcon:r,loading:i,multiple:a,hasFeedback:l,prefixCls:s,showSuffixIcon:c,feedbackIcon:u,showArrow:d,componentName:f}=t;const p=n??g.createElement(uZ,null),m=C=>e===null&&!l&&!d?null:g.createElement(g.Fragment,null,c!==!1&&C,l&&u);let y=null;if(e!==void 0)y=m(e);else if(i)y=m(g.createElement(qM,{spin:!0}));else{const C=`${s}-suffix`;y=P=>{let{open:A,showSearch:S}=P;return m(A&&S?g.createElement(HZ,{className:C}):g.createElement(RZ,{className:C}))}}let w=null;o!==void 0?w=o:a?w=g.createElement(fQe,null):w=null;let x=null;return r!==void 0?x=r:x=g.createElement(i6,null),{clearIcon:p,suffixIcon:y,itemIcon:w,removeIcon:x}}function oYt(t,e){return e!==void 0?e:t!==null}var rYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r,className:i,rootClassName:a,getPopupContainer:l,popupClassName:s,dropdownClassName:c,listHeight:u=256,placement:d,listItemHeight:f,size:p,disabled:m,notFoundContent:y,status:w,builtinPlacements:x,dropdownMatchSelectWidth:C,popupMatchSelectWidth:P,direction:A,style:S,allowClear:v,variant:b,dropdownStyle:T,transitionName:R,tagRender:M,maxCount:D,prefix:k}=t,N=rYt(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix"]),{getPopupContainer:U,getPrefixCls:W,renderEmpty:F,direction:E,virtual:L,popupMatchSelectWidth:j,popupOverflow:Y,select:O}=g.useContext(gr),[,_]=Ff(),G=f??(_==null?void 0:_.controlHeight),Q=W("select",o),oe=W(),ee=A??E,{compactSize:q,compactItemClassnames:ae}=x4(Q,ee),[Z,ne]=jS("select",b,r),te=nu(Q),[$,le,de]=$Bt(Q,te),he=g.useMemo(()=>{const{mode:Le}=t;if(Le!=="combobox")return Le===pQe?"combobox":Le},[t.mode]),me=he==="multiple"||he==="tags",ce=oYt(t.suffixIcon,t.showArrow),Pe=(n=P??C)!==null&&n!==void 0?n:j,{status:pe,hasFeedback:Ie,isFormItemInput:ve,feedbackIcon:ze}=g.useContext(W1),Ae=US(pe,w);let se;y!==void 0?se=y:he==="combobox"?se=null:se=(F==null?void 0:F("Select"))||g.createElement(y9e,{componentName:"Select"});const{suffixIcon:ge,itemIcon:we,removeIcon:Se,clearIcon:Me}=hQe(Object.assign(Object.assign({},N),{multiple:me,hasFeedback:Ie,feedbackIcon:ze,showSuffixIcon:ce,prefixCls:Q,componentName:"Select"})),Ce=v===!0?{clearIcon:Me}:v,Te=Mf(N,["suffixIcon","itemIcon"]),Re=Mn(s||c,{[`${Q}-dropdown-${ee}`]:ee==="rtl"},a,de,te,le),Ne=jd(Le=>{var Ye;return(Ye=p??q)!==null&&Ye!==void 0?Ye:Le}),_e=g.useContext(Bp),Ue=m??_e,qe=Mn({[`${Q}-lg`]:Ne==="large",[`${Q}-sm`]:Ne==="small",[`${Q}-rtl`]:ee==="rtl",[`${Q}-${Z}`]:ne,[`${Q}-in-form-item`]:ve},o7(Q,Ae,Ie),ae,O==null?void 0:O.className,i,a,de,te,le),Fe=g.useMemo(()=>d!==void 0?d:ee==="rtl"?"bottomRight":"bottomLeft",[d,ee]),[He]=a6("SelectLike",T==null?void 0:T.zIndex);return $(g.createElement(m9e,Object.assign({ref:e,virtual:L,showSearch:O==null?void 0:O.showSearch},Te,{style:Object.assign(Object.assign({},O==null?void 0:O.style),S),dropdownMatchSelectWidth:Pe,transitionName:L1(oe,"slide-up",R),builtinPlacements:FBt(x,Y),listHeight:u,listItemHeight:G,mode:he,prefixCls:Q,placement:Fe,direction:ee,prefix:k,suffixIcon:ge,menuItemSelectedIcon:we,removeIcon:Se,allowClear:Ce,notFoundContent:se,className:qe,getPopupContainer:l||U,dropdownClassName:Re,disabled:Ue,dropdownStyle:Object.assign(Object.assign({},T),{zIndex:He}),maxCount:me?D:void 0,tagRender:me?M:void 0})))},Ko=g.forwardRef(iYt),aYt=gU(Ko,"dropdownAlign");Ko.SECRET_COMBOBOX_MODE_DO_NOT_USE=pQe;Ko.Option=p9e;Ko.OptGroup=h9e;Ko._InternalPanelDoNotUseOrYouWillBeFired=aYt;const r7=["xxl","xl","lg","md","sm","xs"],lYt=t=>({xs:`(max-width: ${t.screenXSMax}px)`,sm:`(min-width: ${t.screenSM}px)`,md:`(min-width: ${t.screenMD}px)`,lg:`(min-width: ${t.screenLG}px)`,xl:`(min-width: ${t.screenXL}px)`,xxl:`(min-width: ${t.screenXXL}px)`}),sYt=t=>{const e=t,n=[].concat(r7).reverse();return n.forEach((o,r)=>{const i=o.toUpperCase(),a=`screen${i}Min`,l=`screen${i}`;if(!(e[a]<=e[l]))throw new Error(`${a}<=${l} fails : !(${e[a]}<=${e[l]})`);if(r{const n=new Map;let o=-1,r={};return{matchHandlers:{},dispatch(i){return r=i,n.forEach(a=>a(r)),n.size>=1},subscribe(i){return n.size||this.register(),o+=1,n.set(o,i),i(r),o},unsubscribe(i){n.delete(i),n.size||this.unregister()},unregister(){Object.keys(e).forEach(i=>{const a=e[i],l=this.matchHandlers[a];l==null||l.mql.removeListener(l==null?void 0:l.listener)}),n.clear()},register(){Object.keys(e).forEach(i=>{const a=e[i],l=c=>{let{matches:u}=c;this.dispatch(Object.assign(Object.assign({},r),{[i]:u}))},s=window.matchMedia(a);s.addListener(l),this.matchHandlers[a]={mql:s,listener:l},l(s)})},responsiveMap:e}},[t])}function mQe(){const[,t]=g.useReducer(e=>e+1,0);return t}function MZ(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;const e=g.useRef({}),n=mQe(),o=gQe();return MA(()=>{const r=o.subscribe(i=>{e.current=i,t&&n()});return()=>o.unsubscribe(r)},[]),e.current}const Ahe=g.createContext({}),cYt=t=>{const{antCls:e,componentCls:n,iconCls:o,avatarBg:r,avatarColor:i,containerSize:a,containerSizeLG:l,containerSizeSM:s,textFontSize:c,textFontSizeLG:u,textFontSizeSM:d,borderRadius:f,borderRadiusLG:p,borderRadiusSM:m,lineWidth:y,lineType:w}=t,x=(C,P,A)=>({width:C,height:C,borderRadius:"50%",[`&${n}-square`]:{borderRadius:A},[`&${n}-icon`]:{fontSize:P,[`> ${o}`]:{margin:0}}});return{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",overflow:"hidden",color:i,whiteSpace:"nowrap",textAlign:"center",verticalAlign:"middle",background:r,border:`${jt(y)} ${w} transparent`,"&-image":{background:"transparent"},[`${e}-image-img`]:{display:"block"}}),x(a,c,f)),{"&-lg":Object.assign({},x(l,u,p)),"&-sm":Object.assign({},x(s,d,m)),"> img":{display:"block",width:"100%",height:"100%",objectFit:"cover"}})}},uYt=t=>{const{componentCls:e,groupBorderColor:n,groupOverlapping:o,groupSpace:r}=t;return{[`${e}-group`]:{display:"inline-flex",[e]:{borderColor:n},"> *:not(:first-child)":{marginInlineStart:o}},[`${e}-group-popover`]:{[`${e} + ${e}`]:{marginInlineStart:r}}}},dYt=t=>{const{controlHeight:e,controlHeightLG:n,controlHeightSM:o,fontSize:r,fontSizeLG:i,fontSizeXL:a,fontSizeHeading3:l,marginXS:s,marginXXS:c,colorBorderBg:u}=t;return{containerSize:e,containerSizeLG:n,containerSizeSM:o,textFontSize:Math.round((i+a)/2),textFontSizeLG:l,textFontSizeSM:r,groupSpace:c,groupOverlapping:-s,groupBorderColor:u}},yQe=el("Avatar",t=>{const{colorTextLightSolid:e,colorTextPlaceholder:n}=t,o=Ui(t,{avatarBg:n,avatarColor:e});return[cYt(o),uYt(o)]},dYt);var fYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const[n,o]=g.useState(1),[r,i]=g.useState(!1),[a,l]=g.useState(!0),s=g.useRef(null),c=g.useRef(null),u=e2(e,s),{getPrefixCls:d,avatar:f}=g.useContext(gr),p=g.useContext(Ahe),m=()=>{if(!c.current||!s.current)return;const ae=c.current.offsetWidth,Z=s.current.offsetWidth;if(ae!==0&&Z!==0){const{gap:ne=4}=t;ne*2{i(!0)},[]),g.useEffect(()=>{l(!0),o(1)},[t.src]),g.useEffect(m,[t.gap]);const y=()=>{const{onError:ae}=t;(ae==null?void 0:ae())!==!1&&l(!1)},{prefixCls:w,shape:x,size:C,src:P,srcSet:A,icon:S,className:v,rootClassName:b,alt:T,draggable:R,children:M,crossOrigin:D}=t,k=fYt(t,["prefixCls","shape","size","src","srcSet","icon","className","rootClassName","alt","draggable","children","crossOrigin"]),N=jd(ae=>{var Z,ne;return(ne=(Z=C??(p==null?void 0:p.size))!==null&&Z!==void 0?Z:ae)!==null&&ne!==void 0?ne:"default"}),U=Object.keys(typeof N=="object"?N||{}:{}).some(ae=>["xs","sm","md","lg","xl","xxl"].includes(ae)),W=MZ(U),F=g.useMemo(()=>{if(typeof N!="object")return{};const ae=r7.find(ne=>W[ne]),Z=N[ae];return Z?{width:Z,height:Z,fontSize:Z&&(S||M)?Z/2:18}:{}},[W,N]),E=d("avatar",w),L=nu(E),[j,Y,O]=yQe(E,L),_=Mn({[`${E}-lg`]:N==="large",[`${E}-sm`]:N==="small"}),G=g.isValidElement(P),Q=x||(p==null?void 0:p.shape)||"circle",oe=Mn(E,_,f==null?void 0:f.className,`${E}-${Q}`,{[`${E}-image`]:G||P&&a,[`${E}-icon`]:!!S},O,L,v,b,Y),ee=typeof N=="number"?{width:N,height:N,fontSize:S?N/2:18}:{};let q;if(typeof P=="string"&&a)q=g.createElement("img",{src:P,draggable:R,srcSet:A,onError:y,alt:T,crossOrigin:D});else if(G)q=P;else if(S)q=S;else if(r||n!==1){const ae=`scale(${n})`,Z={msTransform:ae,WebkitTransform:ae,transform:ae};q=g.createElement(VQ,{onResize:m},g.createElement("span",{className:`${E}-string`,ref:c,style:Object.assign({},Z)},M))}else q=g.createElement("span",{className:`${E}-string`,style:{opacity:0},ref:c},M);return delete k.onError,delete k.gap,j(g.createElement("span",Object.assign({},k,{style:Object.assign(Object.assign(Object.assign(Object.assign({},ee),F),f==null?void 0:f.style),k.style),className:oe,ref:u}),q))},AQe=g.forwardRef(hYt);var IL={ENTER:13,ESC:27};const aJ=t=>t?typeof t=="function"?t():t:null;function A9e(t){var e=t.children,n=t.prefixCls,o=t.id,r=t.overlayInnerStyle,i=t.bodyClassName,a=t.className,l=t.style;return g.createElement("div",{className:Bn("".concat(n,"-content"),a),style:l},g.createElement("div",{className:Bn("".concat(n,"-inner"),i),id:o,role:"tooltip",style:r},typeof e=="function"?e():e))}function whe(){return whe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}function AYt(t,e){if(t==null)return{};var n=yYt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var kP={shiftX:64,adjustY:1},FP={adjustX:1,shiftY:!0},ey=[0,0],wYt={left:{points:["cr","cl"],overflow:FP,offset:[-4,0],targetOffset:ey},right:{points:["cl","cr"],overflow:FP,offset:[4,0],targetOffset:ey},top:{points:["bc","tc"],overflow:kP,offset:[0,-4],targetOffset:ey},bottom:{points:["tc","bc"],overflow:kP,offset:[0,4],targetOffset:ey},topLeft:{points:["bl","tl"],overflow:kP,offset:[0,-4],targetOffset:ey},leftTop:{points:["tr","tl"],overflow:FP,offset:[-4,0],targetOffset:ey},topRight:{points:["br","tr"],overflow:kP,offset:[0,-4],targetOffset:ey},rightTop:{points:["tl","tr"],overflow:FP,offset:[4,0],targetOffset:ey},bottomRight:{points:["tr","br"],overflow:kP,offset:[0,4],targetOffset:ey},rightBottom:{points:["bl","br"],overflow:FP,offset:[4,0],targetOffset:ey},bottomLeft:{points:["tl","bl"],overflow:kP,offset:[0,4],targetOffset:ey},leftBottom:{points:["br","bl"],overflow:FP,offset:[-4,0],targetOffset:ey}},xYt=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],vYt=function(e,n){var o=e.overlayClassName,r=e.trigger,i=r===void 0?["hover"]:r,a=e.mouseEnterDelay,l=a===void 0?0:a,s=e.mouseLeaveDelay,c=s===void 0?.1:s,u=e.overlayStyle,d=e.prefixCls,f=d===void 0?"rc-tooltip":d,p=e.children,m=e.onVisibleChange,y=e.afterVisibleChange,w=e.transitionName,x=e.animation,C=e.motion,P=e.placement,A=P===void 0?"right":P,S=e.align,v=S===void 0?{}:S,b=e.destroyTooltipOnHide,T=b===void 0?!1:b,R=e.defaultVisible,M=e.getTooltipContainer,D=e.overlayInnerStyle;e.arrowContent;var k=e.overlay,N=e.id,U=e.showArrow,W=U===void 0?!0:U,F=e.classNames,E=e.styles,L=AYt(e,xYt),j=g.useRef(null);g.useImperativeHandle(n,function(){return j.current});var Y=qD({},L);"visible"in e&&(Y.popupVisible=e.visible);var O=function(){return g.createElement(A9e,{key:"content",prefixCls:f,id:N,bodyClassName:F==null?void 0:F.body,overlayInnerStyle:qD(qD({},D),E==null?void 0:E.body)},k)};return g.createElement(eI,whe({popupClassName:Bn(o,F==null?void 0:F.root),prefixCls:f,popup:O,action:i,builtinPlacements:wYt,popupPlacement:A,ref:j,popupAlign:v,getPopupContainer:M,onPopupVisibleChange:m,afterPopupVisibleChange:y,popupTransitionName:w,popupAnimation:x,popupMotion:C,defaultPopupVisible:R,autoDestroy:T,mouseLeaveDelay:c,popupStyle:qD(qD({},u),E==null?void 0:E.root),mouseEnterDelay:l,arrow:W},Y),p)};const bYt=g.forwardRef(vYt);function IZ(t){const{sizePopupArrow:e,borderRadiusXS:n,borderRadiusOuter:o}=t,r=e/2,i=0,a=r,l=o*1/Math.sqrt(2),s=r-o*(1-1/Math.sqrt(2)),c=r-n*(1/Math.sqrt(2)),u=o*(Math.sqrt(2)-1)+n*(1/Math.sqrt(2)),d=2*r-c,f=u,p=2*r-l,m=s,y=2*r-i,w=a,x=r*Math.sqrt(2)+o*(Math.sqrt(2)-2),C=o*(Math.sqrt(2)-1),P=`polygon(${C}px 100%, 50% ${C}px, ${2*r-C}px 100%, ${C}px 100%)`,A=`path('M ${i} ${a} A ${o} ${o} 0 0 0 ${l} ${s} L ${c} ${u} A ${n} ${n} 0 0 1 ${d} ${f} L ${p} ${m} A ${o} ${o} 0 0 0 ${y} ${w} Z')`;return{arrowShadowWidth:x,arrowPath:A,arrowPolygon:P}}const wQe=(t,e,n)=>{const{sizePopupArrow:o,arrowPolygon:r,arrowPath:i,arrowShadowWidth:a,borderRadiusXS:l,calc:s}=t;return{pointerEvents:"none",width:o,height:o,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:o,height:s(o).div(2).equal(),background:e,clipPath:{_multi_value_:!0,value:[r,i]},content:'""'},"&::after":{content:'""',position:"absolute",width:a,height:a,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${jt(l)} 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}},xQe=8;function zZ(t){const{contentRadius:e,limitVerticalRadius:n}=t,o=e>12?e+2:12;return{arrowOffsetHorizontal:o,arrowOffsetVertical:n?xQe:o}}function _O(t,e){return t?e:{}}function w9e(t,e,n){const{componentCls:o,boxShadowPopoverArrow:r,arrowOffsetVertical:i,arrowOffsetHorizontal:a}=t,{arrowDistance:l=0,arrowPlacement:s={left:!0,right:!0,top:!0,bottom:!0}}=n||{};return{[o]:Object.assign(Object.assign(Object.assign(Object.assign({[`${o}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},wQe(t,e,r)),{"&:before":{background:e}})]},_O(!!s.top,{[[`&-placement-top > ${o}-arrow`,`&-placement-topLeft > ${o}-arrow`,`&-placement-topRight > ${o}-arrow`].join(",")]:{bottom:l,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},"&-placement-topLeft":{"--arrow-offset-horizontal":a,[`> ${o}-arrow`]:{left:{_skip_check_:!0,value:a}}},"&-placement-topRight":{"--arrow-offset-horizontal":`calc(100% - ${jt(a)})`,[`> ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}}})),_O(!!s.bottom,{[[`&-placement-bottom > ${o}-arrow`,`&-placement-bottomLeft > ${o}-arrow`,`&-placement-bottomRight > ${o}-arrow`].join(",")]:{top:l,transform:"translateY(-100%)"},[`&-placement-bottom > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},"&-placement-bottomLeft":{"--arrow-offset-horizontal":a,[`> ${o}-arrow`]:{left:{_skip_check_:!0,value:a}}},"&-placement-bottomRight":{"--arrow-offset-horizontal":`calc(100% - ${jt(a)})`,[`> ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}}})),_O(!!s.left,{[[`&-placement-left > ${o}-arrow`,`&-placement-leftTop > ${o}-arrow`,`&-placement-leftBottom > ${o}-arrow`].join(",")]:{right:{_skip_check_:!0,value:l},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop > ${o}-arrow`]:{top:i},[`&-placement-leftBottom > ${o}-arrow`]:{bottom:i}})),_O(!!s.right,{[[`&-placement-right > ${o}-arrow`,`&-placement-rightTop > ${o}-arrow`,`&-placement-rightBottom > ${o}-arrow`].join(",")]:{left:{_skip_check_:!0,value:l},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop > ${o}-arrow`]:{top:i},[`&-placement-rightBottom > ${o}-arrow`]:{bottom:i}}))}}function SYt(t,e,n,o){if(o===!1)return{adjustX:!1,adjustY:!1};const r=o&&typeof o=="object"?o:{},i={};switch(t){case"top":case"bottom":i.shiftX=e.arrowOffsetHorizontal*2+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=e.arrowOffsetVertical*2+n,i.shiftX=!0,i.adjustX=!0;break}const a=Object.assign(Object.assign({},i),r);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}const oPe={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},TYt={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},PYt=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function vQe(t){const{arrowWidth:e,autoAdjustOverflow:n,arrowPointAtCenter:o,offset:r,borderRadius:i,visibleFirst:a}=t,l=e/2,s={};return Object.keys(oPe).forEach(c=>{const u=o&&TYt[c]||oPe[c],d=Object.assign(Object.assign({},u),{offset:[0,0],dynamicInset:!0});switch(s[c]=d,PYt.has(c)&&(d.autoArrow=!1),c){case"top":case"topLeft":case"topRight":d.offset[1]=-l-r;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=l+r;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-l-r;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=l+r;break}const f=zZ({contentRadius:i,limitVerticalRadius:!0});if(o)switch(c){case"topLeft":case"bottomLeft":d.offset[0]=-f.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":d.offset[0]=f.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":d.offset[1]=-f.arrowOffsetHorizontal*2+l;break;case"leftBottom":case"rightBottom":d.offset[1]=f.arrowOffsetHorizontal*2-l;break}d.overflow=SYt(c,f,e,n),a&&(d.htmlRegion="visibleFirst")}),s}const CYt=t=>{const{calc:e,componentCls:n,tooltipMaxWidth:o,tooltipColor:r,tooltipBg:i,tooltipBorderRadius:a,zIndexPopup:l,controlHeight:s,boxShadowSecondary:c,paddingSM:u,paddingXS:d,arrowOffsetHorizontal:f,sizePopupArrow:p}=t,m=e(a).add(p).add(f).equal(),y=e(a).mul(2).add(p).equal();return[{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"absolute",zIndex:l,display:"block",width:"max-content",maxWidth:o,visibility:"visible","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:["var(--valid-offset-x, 50%)","var(--arrow-y, 50%)"].join(" "),"&-hidden":{display:"none"},"--antd-arrow-background-color":i,[`${n}-inner`]:{minWidth:y,minHeight:s,padding:`${jt(t.calc(u).div(2).equal())} ${jt(d)}`,color:r,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:i,borderRadius:a,boxShadow:c,boxSizing:"border-box"},[["&-placement-topLeft","&-placement-topRight","&-placement-bottomLeft","&-placement-bottomRight"].join(",")]:{minWidth:m},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${n}-inner`]:{borderRadius:t.min(a,xQe)}},[`${n}-content`]:{position:"relative"}}),sZ(t,(w,x)=>{let{darkColor:C}=x;return{[`&${n}-${w}`]:{[`${n}-inner`]:{backgroundColor:C},[`${n}-arrow`]:{"--antd-arrow-background-color":C}}}})),{"&-rtl":{direction:"rtl"}})},w9e(t,"var(--antd-arrow-background-color)"),{[`${n}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow}}]},RYt=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+70},zZ({contentRadius:t.borderRadius,limitVerticalRadius:!0})),IZ(Ui(t,{borderRadiusOuter:Math.min(t.borderRadiusOuter,4)}))),bQe=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return el("Tooltip",o=>{const{borderRadius:r,colorTextLightSolid:i,colorBgSpotlight:a}=o,l=Ui(o,{tooltipMaxWidth:250,tooltipColor:i,tooltipBorderRadius:r,tooltipBg:a});return[CYt(l),QM(o,"zoom-big-fast")]},RYt,{resetStyle:!1,injectStyle:e})(t)},HYt=Gb.map(t=>`${t}-inverse`),MYt=["success","processing","error","default","warning"];function DZ(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat(Pa(HYt),Pa(Gb)).includes(t):Gb.includes(t)}function IYt(t){return MYt.includes(t)}function SQe(t,e){const n=DZ(e),o=Mn({[`${t}-${e}`]:e&&n}),r={},i={};return e&&!n&&(r.background=e,i["--antd-arrow-background-color"]=e),{className:o,overlayStyle:r,arrowStyle:i}}const zYt=t=>{const{prefixCls:e,className:n,placement:o="top",title:r,color:i,overlayInnerStyle:a}=t,{getPrefixCls:l}=g.useContext(gr),s=l("tooltip",e),[c,u,d]=bQe(s),f=SQe(s,i),p=f.arrowStyle,m=Object.assign(Object.assign({},a),f.overlayStyle),y=Mn(u,d,s,`${s}-pure`,`${s}-placement-${o}`,n,f.className);return c(g.createElement("div",{className:y,style:p},g.createElement("div",{className:`${s}-arrow`}),g.createElement(A9e,Object.assign({},t,{className:u,prefixCls:s,overlayInnerStyle:m}),r)))};var DYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a,l;const{prefixCls:s,openClassName:c,getTooltipContainer:u,color:d,overlayInnerStyle:f,children:p,afterOpenChange:m,afterVisibleChange:y,destroyTooltipOnHide:w,arrow:x=!0,title:C,overlay:P,builtinPlacements:A,arrowPointAtCenter:S=!1,autoAdjustOverflow:v=!0,motion:b,getPopupContainer:T,placement:R="top",mouseEnterDelay:M=.1,mouseLeaveDelay:D=.1,overlayStyle:k,rootClassName:N,overlayClassName:U,styles:W,classNames:F}=t,E=DYt(t,["prefixCls","openClassName","getTooltipContainer","color","overlayInnerStyle","children","afterOpenChange","afterVisibleChange","destroyTooltipOnHide","arrow","title","overlay","builtinPlacements","arrowPointAtCenter","autoAdjustOverflow","motion","getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName","overlayClassName","styles","classNames"]),L=!!x,[,j]=Ff(),{getPopupContainer:Y,getPrefixCls:O,direction:_,tooltip:G}=g.useContext(gr),Q=LS(),oe=g.useRef(null),ee=()=>{var Re;(Re=oe.current)===null||Re===void 0||Re.forceAlign()};g.useImperativeHandle(e,()=>{var Re;return{forceAlign:ee,forcePopupAlign:()=>{Q.deprecated(!1,"forcePopupAlign","forceAlign"),ee()},nativeElement:(Re=oe.current)===null||Re===void 0?void 0:Re.nativeElement}});const[q,ae]=qA(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(o=t.defaultOpen)!==null&&o!==void 0?o:t.defaultVisible}),Z=!C&&!P&&C!==0,ne=Re=>{var Ne,_e;ae(Z?!1:Re),Z||((Ne=t.onOpenChange)===null||Ne===void 0||Ne.call(t,Re),(_e=t.onVisibleChange)===null||_e===void 0||_e.call(t,Re))},te=g.useMemo(()=>{var Re,Ne;let _e=S;return typeof x=="object"&&(_e=(Ne=(Re=x.pointAtCenter)!==null&&Re!==void 0?Re:x.arrowPointAtCenter)!==null&&Ne!==void 0?Ne:S),A||vQe({arrowPointAtCenter:_e,autoAdjustOverflow:v,arrowWidth:L?j.sizePopupArrow:0,borderRadius:j.borderRadius,offset:j.marginXXS,visibleFirst:!0})},[S,x,A,j]),$=g.useMemo(()=>C===0?C:P||C||"",[P,C]),le=g.createElement(E3,{space:!0},typeof $=="function"?$():$),de=O("tooltip",s),he=O(),me=t["data-popover-inject"];let ce=q;!("open"in t)&&!("visible"in t)&&Z&&(ce=!1);const Pe=g.isValidElement(p)&&!M$e(p)?p:g.createElement("span",null,p),pe=Pe.props,Ie=!pe.className||typeof pe.className=="string"?Mn(pe.className,c||`${de}-open`):pe.className,[ve,ze,Ae]=bQe(de,!me),se=SQe(de,d),ge=se.arrowStyle,we=Mn(U,{[`${de}-rtl`]:_==="rtl"},se.className,N,ze,Ae,G==null?void 0:G.className,(r=G==null?void 0:G.classNames)===null||r===void 0?void 0:r.root,F==null?void 0:F.root),Se=Mn((i=G==null?void 0:G.classNames)===null||i===void 0?void 0:i.body,F==null?void 0:F.body),[Me,Ce]=a6("Tooltip",E.zIndex),Te=g.createElement(bYt,Object.assign({},E,{zIndex:Me,showArrow:L,placement:R,mouseEnterDelay:M,mouseLeaveDelay:D,prefixCls:de,classNames:{root:we,body:Se},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ge),(a=G==null?void 0:G.styles)===null||a===void 0?void 0:a.root),G==null?void 0:G.style),k),W==null?void 0:W.root),body:Object.assign(Object.assign(Object.assign(Object.assign({},(l=G==null?void 0:G.styles)===null||l===void 0?void 0:l.body),f),W==null?void 0:W.body),se.overlayStyle)},getTooltipContainer:T||u||Y,ref:oe,builtinPlacements:te,overlay:le,visible:ce,onVisibleChange:ne,afterVisibleChange:m??y,arrowContent:g.createElement("span",{className:`${de}-arrow-content`}),motion:{motionName:L1(he,"zoom-big-fast",t.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!w}),ce?P0(Pe,{className:Ie}):Pe);return ve(g.createElement(iU.Provider,{value:Ce},Te))}),k3=EYt;k3._InternalPanelDoNotUseOrYouWillBeFired=zYt;const kYt=t=>{const{componentCls:e,popoverColor:n,titleMinWidth:o,fontWeightStrong:r,innerPadding:i,boxShadowSecondary:a,colorTextHeading:l,borderRadiusLG:s,zIndexPopup:c,titleMarginBottom:u,colorBgElevated:d,popoverBg:f,titleBorderBottom:p,innerContentPadding:m,titlePadding:y}=t;return[{[e]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:["var(--valid-offset-x, 50%)","var(--arrow-y, 50%)"].join(" "),"--antd-arrow-background-color":d,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${e}-content`]:{position:"relative"},[`${e}-inner`]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:s,boxShadow:a,padding:i},[`${e}-title`]:{minWidth:o,marginBottom:u,color:l,fontWeight:r,borderBottom:p,padding:y},[`${e}-inner-content`]:{color:n,padding:m}})},w9e(t,"var(--antd-arrow-background-color)"),{[`${e}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow,display:"inline-block",[`${e}-content`]:{display:"inline-block"}}}]},FYt=t=>{const{componentCls:e}=t;return{[e]:Gb.map(n=>{const o=t[`${n}6`];return{[`&${e}-${n}`]:{"--antd-arrow-background-color":o,[`${e}-inner`]:{backgroundColor:o},[`${e}-arrow`]:{background:"transparent"}}}})}},LYt=t=>{const{lineWidth:e,controlHeight:n,fontHeight:o,padding:r,wireframe:i,zIndexPopupBase:a,borderRadiusLG:l,marginXS:s,lineType:c,colorSplit:u,paddingSM:d}=t,f=n-o,p=f/2,m=f/2-e,y=r;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:a+30},IZ(t)),zZ({contentRadius:l,limitVerticalRadius:!0})),{innerPadding:i?0:12,titleMarginBottom:i?0:s,titlePadding:i?`${p}px ${y}px ${m}px`:0,titleBorderBottom:i?`${e}px ${c} ${u}`:"none",innerContentPadding:i?`${d}px ${y}px`:0})},TQe=el("Popover",t=>{const{colorBgElevated:e,colorText:n}=t,o=Ui(t,{popoverBg:e,popoverColor:n});return[kYt(o),FYt(o),QM(o,"zoom-big")]},LYt,{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var WYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{title:e,content:n,prefixCls:o}=t;return!e&&!n?null:g.createElement(g.Fragment,null,e&&g.createElement("div",{className:`${o}-title`},e),n&&g.createElement("div",{className:`${o}-inner-content`},n))},NYt=t=>{const{hashId:e,prefixCls:n,className:o,style:r,placement:i="top",title:a,content:l,children:s}=t,c=aJ(a),u=aJ(l),d=Mn(e,n,`${n}-pure`,`${n}-placement-${i}`,o);return g.createElement("div",{className:d,style:r},g.createElement("div",{className:`${n}-arrow`}),g.createElement(A9e,Object.assign({},t,{className:e,prefixCls:n}),s||g.createElement(PQe,{prefixCls:n,title:c,content:u})))},UYt=t=>{const{prefixCls:e,className:n}=t,o=WYt(t,["prefixCls","className"]),{getPrefixCls:r}=g.useContext(gr),i=r("popover",e),[a,l,s]=TQe(i);return a(g.createElement(NYt,Object.assign({},o,{prefixCls:i,hashId:l,className:Mn(n,s)})))};var jYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a,l;const{prefixCls:s,title:c,content:u,overlayClassName:d,placement:f="top",trigger:p="hover",children:m,mouseEnterDelay:y=.1,mouseLeaveDelay:w=.1,onOpenChange:x,overlayStyle:C={},styles:P,classNames:A}=t,S=jYt(t,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{popover:v,getPrefixCls:b}=g.useContext(gr),T=b("popover",s),[R,M,D]=TQe(T),k=b(),N=Mn(d,M,D,(n=v==null?void 0:v.classNames)===null||n===void 0?void 0:n.root,A==null?void 0:A.root),U=Mn((o=v==null?void 0:v.classNames)===null||o===void 0?void 0:o.body,A==null?void 0:A.body),[W,F]=qA(!1,{value:(r=t.open)!==null&&r!==void 0?r:t.visible,defaultValue:(i=t.defaultOpen)!==null&&i!==void 0?i:t.defaultVisible}),E=(_,G)=>{F(_,!0),x==null||x(_,G)},L=_=>{_.keyCode===IL.ESC&&E(!1,_)},j=_=>{E(_)},Y=aJ(c),O=aJ(u);return R(g.createElement(k3,Object.assign({placement:f,trigger:p,mouseEnterDelay:y,mouseLeaveDelay:w},S,{prefixCls:T,classNames:{root:N,body:U},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},(a=v==null?void 0:v.styles)===null||a===void 0?void 0:a.root),v==null?void 0:v.style),C),P==null?void 0:P.root),body:Object.assign(Object.assign({},(l=v==null?void 0:v.styles)===null||l===void 0?void 0:l.body),P==null?void 0:P.body)},ref:e,open:W,onOpenChange:j,overlay:Y||O?g.createElement(PQe,{prefixCls:T,title:Y,content:O}):null,transitionName:L1(k,"zoom-big",S.transitionName),"data-popover-inject":!0}),P0(m,{onKeyDown:_=>{var G,Q;g.isValidElement(m)&&((Q=m==null?void 0:(G=m.props).onKeyDown)===null||Q===void 0||Q.call(G,_)),L(_)}})))}),zl=BYt;zl._InternalPanelDoNotUseOrYouWillBeFired=UYt;const rPe=t=>{const{size:e,shape:n}=g.useContext(Ahe),o=g.useMemo(()=>({size:t.size||e,shape:t.shape||n}),[t.size,t.shape,e,n]);return g.createElement(Ahe.Provider,{value:o},t.children)},YYt=t=>{var e,n,o,r;const{getPrefixCls:i,direction:a}=g.useContext(gr),{prefixCls:l,className:s,rootClassName:c,style:u,maxCount:d,maxStyle:f,size:p,shape:m,maxPopoverPlacement:y,maxPopoverTrigger:w,children:x,max:C}=t,P=i("avatar",l),A=`${P}-group`,S=nu(P),[v,b,T]=yQe(P,S),R=Mn(A,{[`${A}-rtl`]:a==="rtl"},T,S,s,c,b),M=jy(x).map((N,U)=>P0(N,{key:`avatar-key-${U}`})),D=(C==null?void 0:C.count)||d,k=M.length;if(D&&D{const{componentCls:e,iconCls:n,antCls:o,badgeShadowSize:r,textFontSize:i,textFontSizeSM:a,statusSize:l,dotSize:s,textFontWeight:c,indicatorHeight:u,indicatorHeightSM:d,marginXS:f,calc:p}=t,m=`${o}-scroll-number`,y=sZ(t,(w,x)=>{let{darkColor:C}=x;return{[`&${e} ${e}-color-${w}`]:{background:C,[`&:not(${e}-count)`]:{color:C},"a:hover &":{background:C}}}});return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${e}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:u,height:u,color:t.badgeTextColor,fontWeight:c,fontSize:i,lineHeight:jt(u),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:p(u).div(2).equal(),boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`,transition:`background ${t.motionDurationMid}`,a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},[`${e}-count-sm`]:{minWidth:d,height:d,fontSize:a,lineHeight:jt(d),borderRadius:p(d).div(2).equal()},[`${e}-multiple-words`]:{padding:`0 ${jt(t.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${e}-dot`]:{zIndex:t.indicatorZIndex,width:s,minWidth:s,height:s,background:t.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`},[`${e}-count, ${e}-dot, ${m}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${n}-spin`]:{animationName:qYt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${e}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${e}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:l,height:l,verticalAlign:"middle",borderRadius:"50%"},[`${e}-status-success`]:{backgroundColor:t.colorSuccess},[`${e}-status-processing`]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:r,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:GYt,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${e}-status-default`]:{backgroundColor:t.colorTextPlaceholder},[`${e}-status-error`]:{backgroundColor:t.colorError},[`${e}-status-warning`]:{backgroundColor:t.colorWarning},[`${e}-status-text`]:{marginInlineStart:f,color:t.colorText,fontSize:t.fontSize}}}),y),{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:XYt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`${e}-zoom-leave`]:{animationName:JYt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`&${e}-not-a-wrapper`]:{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:KYt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`${e}-zoom-leave`]:{animationName:$Yt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`&:not(${e}-status)`]:{verticalAlign:"middle"},[`${m}-custom-component, ${e}-count`]:{transform:"none"},[`${m}-custom-component, ${m}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[m]:{overflow:"hidden",transition:`all ${t.motionDurationMid} ${t.motionEaseOutBack}`,[`${m}-only`]:{position:"relative",display:"inline-block",height:u,transition:`all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${m}-only-unit`]:{height:u,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${m}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${e}-count, ${e}-dot, ${m}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},RQe=t=>{const{fontHeight:e,lineWidth:n,marginXS:o,colorBorderBg:r}=t,i=e,a=n,l=t.colorTextLightSolid,s=t.colorError,c=t.colorErrorHover;return Ui(t,{badgeFontHeight:i,badgeShadowSize:a,badgeTextColor:l,badgeColor:s,badgeColorHover:c,badgeShadowColor:r,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},HQe=t=>{const{fontSize:e,lineHeight:n,fontSizeSM:o,lineWidth:r}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*n)-2*r,indicatorHeightSM:e,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}},ZYt=el("Badge",t=>{const e=RQe(t);return QYt(e)},HQe),eOt=t=>{const{antCls:e,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:r,calc:i}=t,a=`${e}-ribbon`,l=`${e}-ribbon-wrapper`,s=sZ(t,(c,u)=>{let{darkColor:d}=u;return{[`&${a}-color-${c}`]:{background:d,color:d}}});return{[l]:{position:"relative"},[a]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:o,padding:`0 ${jt(t.paddingXS)}`,color:t.colorPrimary,lineHeight:jt(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,[`${a}-text`]:{color:t.badgeTextColor},[`${a}-corner`]:{position:"absolute",top:"100%",width:r,height:r,color:"currentcolor",border:`${jt(i(r).div(2).equal())} solid`,transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),s),{[`&${a}-placement-end`]:{insetInlineEnd:i(r).mul(-1).equal(),borderEndEndRadius:0,[`${a}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${a}-placement-start`]:{insetInlineStart:i(r).mul(-1).equal(),borderEndStartRadius:0,[`${a}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},tOt=el(["Badge","Ribbon"],t=>{const e=RQe(t);return eOt(e)},HQe),nOt=t=>{const{className:e,prefixCls:n,style:o,color:r,children:i,text:a,placement:l="end",rootClassName:s}=t,{getPrefixCls:c,direction:u}=g.useContext(gr),d=c("ribbon",n),f=`${d}-wrapper`,[p,m,y]=tOt(d,f),w=DZ(r,!1),x=Mn(d,`${d}-placement-${l}`,{[`${d}-rtl`]:u==="rtl",[`${d}-color-${r}`]:w},e),C={},P={};return r&&!w&&(C.background=r,P.color=r),p(g.createElement("div",{className:Mn(f,s,m,y)},i,g.createElement("div",{className:Mn(x,m),style:Object.assign(Object.assign({},C),o)},g.createElement("span",{className:`${d}-text`},a),g.createElement("div",{className:`${d}-corner`,style:P}))))},iPe=t=>{const{prefixCls:e,value:n,current:o,offset:r=0}=t;let i;return r&&(i={position:"absolute",top:`${r}00%`,left:0}),g.createElement("span",{style:i,className:Mn(`${e}-only-unit`,{current:o})},n)};function oOt(t,e,n){let o=t,r=0;for(;(o+10)%10!==e;)o+=n,r+=n;return r}const rOt=t=>{const{prefixCls:e,count:n,value:o}=t,r=Number(o),i=Math.abs(n),[a,l]=g.useState(r),[s,c]=g.useState(i),u=()=>{l(r),c(i)};g.useEffect(()=>{const p=setTimeout(u,1e3);return()=>clearTimeout(p)},[r]);let d,f;if(a===r||Number.isNaN(r)||Number.isNaN(a))d=[g.createElement(iPe,Object.assign({},t,{key:r,current:!0}))],f={transition:"none"};else{d=[];const p=r+10,m=[];for(let C=r;C<=p;C+=1)m.push(C);const y=sC%10===a);d=(y<0?m.slice(0,w+1):m.slice(w)).map((C,P)=>{const A=C%10;return g.createElement(iPe,Object.assign({},t,{key:C,value:A,offset:y<0?P-w:P,current:P===w}))}),f={transform:`translateY(${-oOt(a,r,y)}00%)`}}return g.createElement("span",{className:`${e}-only`,style:f,onTransitionEnd:u},d)};var iOt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,count:o,className:r,motionClassName:i,style:a,title:l,show:s,component:c="sup",children:u}=t,d=iOt(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=g.useContext(gr),p=f("scroll-number",n),m=Object.assign(Object.assign({},d),{"data-show":s,style:a,className:Mn(p,r,i),title:l});let y=o;if(o&&Number(o)%1===0){const w=String(o).split("");y=g.createElement("bdi",null,w.map((x,C)=>g.createElement(rOt,{prefixCls:p,count:Number(o),value:x,key:w.length-C})))}return a!=null&&a.borderColor&&(m.style=Object.assign(Object.assign({},a),{boxShadow:`0 0 0 1px ${a.borderColor} inset`})),u?P0(u,w=>({className:Mn(`${p}-custom-component`,w==null?void 0:w.className,i)})):g.createElement(c,Object.assign({},m,{ref:e}),y)});var lOt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a;const{prefixCls:l,scrollNumberPrefixCls:s,children:c,status:u,text:d,color:f,count:p=null,overflowCount:m=99,dot:y=!1,size:w="default",title:x,offset:C,style:P,className:A,rootClassName:S,classNames:v,styles:b,showZero:T=!1}=t,R=lOt(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:M,direction:D,badge:k}=g.useContext(gr),N=M("badge",l),[U,W,F]=ZYt(N),E=p>m?`${m}+`:p,L=E==="0"||E===0,j=p===null||L&&!T,Y=(u!=null||f!=null)&&j,O=y&&!L,_=O?"":E,G=g.useMemo(()=>(_==null||_===""||L&&!T)&&!O,[_,L,T,O]),Q=g.useRef(p);G||(Q.current=p);const oe=Q.current,ee=g.useRef(_);G||(ee.current=_);const q=ee.current,ae=g.useRef(O);G||(ae.current=O);const Z=g.useMemo(()=>{if(!C)return Object.assign(Object.assign({},k==null?void 0:k.style),P);const ce={marginTop:C[1]};return D==="rtl"?ce.left=parseInt(C[0],10):ce.right=-parseInt(C[0],10),Object.assign(Object.assign(Object.assign({},ce),k==null?void 0:k.style),P)},[D,C,P,k==null?void 0:k.style]),ne=x??(typeof oe=="string"||typeof oe=="number"?oe:void 0),te=G||!d?null:g.createElement("span",{className:`${N}-status-text`},d),$=!oe||typeof oe!="object"?void 0:P0(oe,ce=>({style:Object.assign(Object.assign({},Z),ce.style)})),le=DZ(f,!1),de=Mn(v==null?void 0:v.indicator,(n=k==null?void 0:k.classNames)===null||n===void 0?void 0:n.indicator,{[`${N}-status-dot`]:Y,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:le}),he={};f&&!le&&(he.color=f,he.background=f);const me=Mn(N,{[`${N}-status`]:Y,[`${N}-not-a-wrapper`]:!c,[`${N}-rtl`]:D==="rtl"},A,S,k==null?void 0:k.className,(o=k==null?void 0:k.classNames)===null||o===void 0?void 0:o.root,v==null?void 0:v.root,W,F);if(!c&&Y){const ce=Z.color;return U(g.createElement("span",Object.assign({},R,{className:me,style:Object.assign(Object.assign(Object.assign({},b==null?void 0:b.root),(r=k==null?void 0:k.styles)===null||r===void 0?void 0:r.root),Z)}),g.createElement("span",{className:de,style:Object.assign(Object.assign(Object.assign({},b==null?void 0:b.indicator),(i=k==null?void 0:k.styles)===null||i===void 0?void 0:i.indicator),he)}),d&&g.createElement("span",{style:{color:ce},className:`${N}-status-text`},d)))}return U(g.createElement("span",Object.assign({ref:e},R,{className:me,style:Object.assign(Object.assign({},(a=k==null?void 0:k.styles)===null||a===void 0?void 0:a.root),b==null?void 0:b.root)}),c,g.createElement(cZ,{visible:!G,motionName:`${N}-zoom`,motionAppear:!1,motionDeadline:1e3},ce=>{let{className:Pe}=ce;var pe,Ie;const ve=M("scroll-number",s),ze=ae.current,Ae=Mn(v==null?void 0:v.indicator,(pe=k==null?void 0:k.classNames)===null||pe===void 0?void 0:pe.indicator,{[`${N}-dot`]:ze,[`${N}-count`]:!ze,[`${N}-count-sm`]:w==="small",[`${N}-multiple-words`]:!ze&&q&&q.toString().length>1,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:le});let se=Object.assign(Object.assign(Object.assign({},b==null?void 0:b.indicator),(Ie=k==null?void 0:k.styles)===null||Ie===void 0?void 0:Ie.indicator),Z);return f&&!le&&(se=se||{},se.background=f),g.createElement(aOt,{prefixCls:ve,show:!G,motionClassName:Pe,className:Ae,count:q,title:ne,style:se,key:"scrollNumber"},$)}),te))}),MQe=sOt;MQe.Ribbon=nOt;var IQe={exports:{}},Ts={};/** + `]:{paddingInlineEnd:t.calc(t.fontSize).mul(1.5).equal()}}}},Ole(Ui(t,{controlHeight:t.singleItemHeightLG,fontSize:t.fontSizeLG,borderRadius:t.borderRadiusLG}),"lg")]}const BBt=t=>{const{fontSize:e,lineHeight:n,lineWidth:o,controlHeight:r,controlHeightSM:i,controlHeightLG:a,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:m,colorFillSecondary:y,colorBgContainerDisabled:w,colorTextDisabled:x,colorPrimaryHover:C,colorPrimary:P,controlOutline:A}=t,S=l*2,v=o*2,b=Math.min(r-S,r-v),T=Math.min(i-S,i-v),R=Math.min(a-S,a-v);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(r-e*n)/2}px ${s}px`,optionFontSize:e,optionLineHeight:n,optionHeight:r,selectorBg:m,clearBg:m,singleItemHeightLG:a,multipleItemBg:y,multipleItemBorderColor:"transparent",multipleItemHeight:b,multipleItemHeightSM:T,multipleItemHeightLG:R,multipleSelectorBgDisabled:w,multipleItemColorDisabled:x,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(t.fontSize*1.25),hoverBorderColor:C,activeBorderColor:P,activeOutlineColor:A,selectAffixPadding:l}},uQe=(t,e)=>{const{componentCls:n,antCls:o,controlOutlineWidth:r}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{border:`${jt(t.lineWidth)} ${t.lineType} ${e.borderColor}`,background:t.selectorBg},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:e.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:e.activeBorderColor,boxShadow:`0 0 0 ${jt(r)} ${e.activeOutlineColor}`,outline:0},[`${n}-prefix`]:{color:e.color}}}},ePe=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},uQe(t,e))}),YBt=t=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},uQe(t,{borderColor:t.colorBorder,hoverBorderHover:t.hoverBorderColor,activeBorderColor:t.activeBorderColor,activeOutlineColor:t.activeOutlineColor,color:t.colorText})),ePe(t,{status:"error",borderColor:t.colorError,hoverBorderHover:t.colorErrorHover,activeBorderColor:t.colorError,activeOutlineColor:t.colorErrorOutline,color:t.colorError})),ePe(t,{status:"warning",borderColor:t.colorWarning,hoverBorderHover:t.colorWarningHover,activeBorderColor:t.colorWarning,activeOutlineColor:t.colorWarningOutline,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}})}),dQe=(t,e)=>{const{componentCls:n,antCls:o}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{background:e.bg,border:`${jt(t.lineWidth)} ${t.lineType} transparent`,color:e.color},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{background:e.hoverBg},[`${n}-focused& ${n}-selector`]:{background:t.selectorBg,borderColor:e.activeBorderColor,outline:0}}}},tPe=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},dQe(t,e))}),OBt=t=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},dQe(t,{bg:t.colorFillTertiary,hoverBg:t.colorFillSecondary,activeBorderColor:t.activeBorderColor,color:t.colorText})),tPe(t,{status:"error",bg:t.colorErrorBg,hoverBg:t.colorErrorBgHover,activeBorderColor:t.colorError,color:t.colorError})),tPe(t,{status:"warning",bg:t.colorWarningBg,hoverBg:t.colorWarningBgHover,activeBorderColor:t.colorWarning,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{borderColor:t.colorBorder,background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`}})}),_Bt=t=>({"&-borderless":{[`${t.componentCls}-selector`]:{background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`},[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`},[`&${t.componentCls}-status-error`]:{[`${t.componentCls}-prefix, ${t.componentCls}-selection-item`]:{color:t.colorError}},[`&${t.componentCls}-status-warning`]:{[`${t.componentCls}-prefix, ${t.componentCls}-selection-item`]:{color:t.colorWarning}}}}),VBt=t=>({[t.componentCls]:Object.assign(Object.assign(Object.assign({},YBt(t)),OBt(t)),_Bt(t))}),GBt=t=>{const{componentCls:e}=t;return{position:"relative",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,input:{cursor:"pointer"},[`${e}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},[`${e}-disabled&`]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},XBt=t=>{const{componentCls:e}=t;return{[`${e}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},JBt=t=>{const{antCls:e,componentCls:n,inputPaddingHorizontalBase:o,iconCls:r}=t;return{[n]:Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-flex",cursor:"pointer",[`&:not(${n}-customize-input) ${n}-selector`]:Object.assign(Object.assign({},GBt(t)),XBt(t)),[`${n}-selection-item`]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},e7),{[`> ${e}-typography`]:{display:"inline"}}),[`${n}-selection-placeholder`]:Object.assign(Object.assign({},e7),{flex:1,color:t.colorTextPlaceholder,pointerEvents:"none"}),[`${n}-arrow`]:Object.assign(Object.assign({},WS()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:`opacity ${t.motionDurationSlow} ease`,[r]:{verticalAlign:"top",transition:`transform ${t.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${n}-suffix)`]:{pointerEvents:"auto"}},[`${n}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${n}-selection-wrap`]:{display:"flex",width:"100%",position:"relative",minWidth:0,"&:after":{content:'"\\a0"',width:0,overflow:"hidden"}},[`${n}-prefix`]:{flex:"none",marginInlineEnd:t.selectAffixPadding},[`${n}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,zIndex:1,display:"inline-block",width:t.fontSizeIcon,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:`color ${t.motionDurationMid} ease, opacity ${t.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:t.colorTextTertiary}},[`&:hover ${n}-clear`]:{opacity:1,background:t.colorBgBase,borderRadius:"50%"}}),[`${n}-status`]:{"&-error, &-warning, &-success, &-validating":{[`&${n}-has-feedback`]:{[`${n}-clear`]:{insetInlineEnd:t.calc(o).add(t.fontSize).add(t.paddingXS).equal()}}}}}},KBt=t=>{const{componentCls:e}=t;return[{[e]:{[`&${e}-in-form-item`]:{width:"100%"}}},JBt(t),jBt(t),UBt(t),LBt(t),{[`${e}-rtl`]:{direction:"rtl"}},sU(t,{borderElCls:`${e}-selector`,focusElCls:`${e}-focused`})]},$Bt=el("Select",(t,e)=>{let{rootPrefixCls:n}=e;const o=Ui(t,{rootPrefixCls:n,inputPaddingHorizontalBase:t.calc(t.paddingSM).sub(1).equal(),multipleSelectItemHeight:t.multipleItemHeight,selectHeight:t.controlHeight});return[KBt(o),VBt(o)]},BBt,{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});var qBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},QBt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:qBt}))},fQe=g.forwardRef(QBt),ZBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},eYt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ZBt}))},RZ=g.forwardRef(eYt),tYt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},nYt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:tYt}))},HZ=g.forwardRef(nYt);function hQe(t){let{suffixIcon:e,clearIcon:n,menuItemSelectedIcon:o,removeIcon:r,loading:i,multiple:a,hasFeedback:l,prefixCls:s,showSuffixIcon:c,feedbackIcon:u,showArrow:d,componentName:f}=t;const p=n??g.createElement(uZ,null),m=C=>e===null&&!l&&!d?null:g.createElement(g.Fragment,null,c!==!1&&C,l&&u);let y=null;if(e!==void 0)y=m(e);else if(i)y=m(g.createElement(qM,{spin:!0}));else{const C=`${s}-suffix`;y=P=>{let{open:A,showSearch:S}=P;return m(A&&S?g.createElement(HZ,{className:C}):g.createElement(RZ,{className:C}))}}let w=null;o!==void 0?w=o:a?w=g.createElement(fQe,null):w=null;let x=null;return r!==void 0?x=r:x=g.createElement(i6,null),{clearIcon:p,suffixIcon:y,itemIcon:w,removeIcon:x}}function oYt(t,e){return e!==void 0?e:t!==null}var rYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r,className:i,rootClassName:a,getPopupContainer:l,popupClassName:s,dropdownClassName:c,listHeight:u=256,placement:d,listItemHeight:f,size:p,disabled:m,notFoundContent:y,status:w,builtinPlacements:x,dropdownMatchSelectWidth:C,popupMatchSelectWidth:P,direction:A,style:S,allowClear:v,variant:b,dropdownStyle:T,transitionName:R,tagRender:M,maxCount:D,prefix:k}=t,N=rYt(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount","prefix"]),{getPopupContainer:U,getPrefixCls:W,renderEmpty:F,direction:E,virtual:L,popupMatchSelectWidth:j,popupOverflow:Y,select:O}=g.useContext(gr),[,_]=Ff(),G=f??(_==null?void 0:_.controlHeight),Q=W("select",o),oe=W(),ee=A??E,{compactSize:$,compactItemClassnames:ae}=x4(Q,ee),[Z,ne]=jS("select",b,r),te=nu(Q),[q,le,de]=$Bt(Q,te),he=g.useMemo(()=>{const{mode:Le}=t;if(Le!=="combobox")return Le===pQe?"combobox":Le},[t.mode]),me=he==="multiple"||he==="tags",ce=oYt(t.suffixIcon,t.showArrow),Pe=(n=P??C)!==null&&n!==void 0?n:j,{status:pe,hasFeedback:Ie,isFormItemInput:ve,feedbackIcon:ze}=g.useContext(W1),Ae=US(pe,w);let se;y!==void 0?se=y:he==="combobox"?se=null:se=(F==null?void 0:F("Select"))||g.createElement(y9e,{componentName:"Select"});const{suffixIcon:ge,itemIcon:we,removeIcon:Se,clearIcon:Me}=hQe(Object.assign(Object.assign({},N),{multiple:me,hasFeedback:Ie,feedbackIcon:ze,showSuffixIcon:ce,prefixCls:Q,componentName:"Select"})),Ce=v===!0?{clearIcon:Me}:v,Te=Mf(N,["suffixIcon","itemIcon"]),Re=Mn(s||c,{[`${Q}-dropdown-${ee}`]:ee==="rtl"},a,de,te,le),Ne=jd(Le=>{var Ye;return(Ye=p??$)!==null&&Ye!==void 0?Ye:Le}),_e=g.useContext(Bp),Ue=m??_e,qe=Mn({[`${Q}-lg`]:Ne==="large",[`${Q}-sm`]:Ne==="small",[`${Q}-rtl`]:ee==="rtl",[`${Q}-${Z}`]:ne,[`${Q}-in-form-item`]:ve},o7(Q,Ae,Ie),ae,O==null?void 0:O.className,i,a,de,te,le),Fe=g.useMemo(()=>d!==void 0?d:ee==="rtl"?"bottomRight":"bottomLeft",[d,ee]),[He]=a6("SelectLike",T==null?void 0:T.zIndex);return q(g.createElement(m9e,Object.assign({ref:e,virtual:L,showSearch:O==null?void 0:O.showSearch},Te,{style:Object.assign(Object.assign({},O==null?void 0:O.style),S),dropdownMatchSelectWidth:Pe,transitionName:L1(oe,"slide-up",R),builtinPlacements:FBt(x,Y),listHeight:u,listItemHeight:G,mode:he,prefixCls:Q,placement:Fe,direction:ee,prefix:k,suffixIcon:ge,menuItemSelectedIcon:we,removeIcon:Se,allowClear:Ce,notFoundContent:se,className:qe,getPopupContainer:l||U,dropdownClassName:Re,disabled:Ue,dropdownStyle:Object.assign(Object.assign({},T),{zIndex:He}),maxCount:me?D:void 0,tagRender:me?M:void 0})))},Ko=g.forwardRef(iYt),aYt=gU(Ko,"dropdownAlign");Ko.SECRET_COMBOBOX_MODE_DO_NOT_USE=pQe;Ko.Option=p9e;Ko.OptGroup=h9e;Ko._InternalPanelDoNotUseOrYouWillBeFired=aYt;const r7=["xxl","xl","lg","md","sm","xs"],lYt=t=>({xs:`(max-width: ${t.screenXSMax}px)`,sm:`(min-width: ${t.screenSM}px)`,md:`(min-width: ${t.screenMD}px)`,lg:`(min-width: ${t.screenLG}px)`,xl:`(min-width: ${t.screenXL}px)`,xxl:`(min-width: ${t.screenXXL}px)`}),sYt=t=>{const e=t,n=[].concat(r7).reverse();return n.forEach((o,r)=>{const i=o.toUpperCase(),a=`screen${i}Min`,l=`screen${i}`;if(!(e[a]<=e[l]))throw new Error(`${a}<=${l} fails : !(${e[a]}<=${e[l]})`);if(r{const n=new Map;let o=-1,r={};return{matchHandlers:{},dispatch(i){return r=i,n.forEach(a=>a(r)),n.size>=1},subscribe(i){return n.size||this.register(),o+=1,n.set(o,i),i(r),o},unsubscribe(i){n.delete(i),n.size||this.unregister()},unregister(){Object.keys(e).forEach(i=>{const a=e[i],l=this.matchHandlers[a];l==null||l.mql.removeListener(l==null?void 0:l.listener)}),n.clear()},register(){Object.keys(e).forEach(i=>{const a=e[i],l=c=>{let{matches:u}=c;this.dispatch(Object.assign(Object.assign({},r),{[i]:u}))},s=window.matchMedia(a);s.addListener(l),this.matchHandlers[a]={mql:s,listener:l},l(s)})},responsiveMap:e}},[t])}function mQe(){const[,t]=g.useReducer(e=>e+1,0);return t}function MZ(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;const e=g.useRef({}),n=mQe(),o=gQe();return MA(()=>{const r=o.subscribe(i=>{e.current=i,t&&n()});return()=>o.unsubscribe(r)},[]),e.current}const Ahe=g.createContext({}),cYt=t=>{const{antCls:e,componentCls:n,iconCls:o,avatarBg:r,avatarColor:i,containerSize:a,containerSizeLG:l,containerSizeSM:s,textFontSize:c,textFontSizeLG:u,textFontSizeSM:d,borderRadius:f,borderRadiusLG:p,borderRadiusSM:m,lineWidth:y,lineType:w}=t,x=(C,P,A)=>({width:C,height:C,borderRadius:"50%",[`&${n}-square`]:{borderRadius:A},[`&${n}-icon`]:{fontSize:P,[`> ${o}`]:{margin:0}}});return{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",overflow:"hidden",color:i,whiteSpace:"nowrap",textAlign:"center",verticalAlign:"middle",background:r,border:`${jt(y)} ${w} transparent`,"&-image":{background:"transparent"},[`${e}-image-img`]:{display:"block"}}),x(a,c,f)),{"&-lg":Object.assign({},x(l,u,p)),"&-sm":Object.assign({},x(s,d,m)),"> img":{display:"block",width:"100%",height:"100%",objectFit:"cover"}})}},uYt=t=>{const{componentCls:e,groupBorderColor:n,groupOverlapping:o,groupSpace:r}=t;return{[`${e}-group`]:{display:"inline-flex",[e]:{borderColor:n},"> *:not(:first-child)":{marginInlineStart:o}},[`${e}-group-popover`]:{[`${e} + ${e}`]:{marginInlineStart:r}}}},dYt=t=>{const{controlHeight:e,controlHeightLG:n,controlHeightSM:o,fontSize:r,fontSizeLG:i,fontSizeXL:a,fontSizeHeading3:l,marginXS:s,marginXXS:c,colorBorderBg:u}=t;return{containerSize:e,containerSizeLG:n,containerSizeSM:o,textFontSize:Math.round((i+a)/2),textFontSizeLG:l,textFontSizeSM:r,groupSpace:c,groupOverlapping:-s,groupBorderColor:u}},yQe=el("Avatar",t=>{const{colorTextLightSolid:e,colorTextPlaceholder:n}=t,o=Ui(t,{avatarBg:n,avatarColor:e});return[cYt(o),uYt(o)]},dYt);var fYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const[n,o]=g.useState(1),[r,i]=g.useState(!1),[a,l]=g.useState(!0),s=g.useRef(null),c=g.useRef(null),u=e2(e,s),{getPrefixCls:d,avatar:f}=g.useContext(gr),p=g.useContext(Ahe),m=()=>{if(!c.current||!s.current)return;const ae=c.current.offsetWidth,Z=s.current.offsetWidth;if(ae!==0&&Z!==0){const{gap:ne=4}=t;ne*2{i(!0)},[]),g.useEffect(()=>{l(!0),o(1)},[t.src]),g.useEffect(m,[t.gap]);const y=()=>{const{onError:ae}=t;(ae==null?void 0:ae())!==!1&&l(!1)},{prefixCls:w,shape:x,size:C,src:P,srcSet:A,icon:S,className:v,rootClassName:b,alt:T,draggable:R,children:M,crossOrigin:D}=t,k=fYt(t,["prefixCls","shape","size","src","srcSet","icon","className","rootClassName","alt","draggable","children","crossOrigin"]),N=jd(ae=>{var Z,ne;return(ne=(Z=C??(p==null?void 0:p.size))!==null&&Z!==void 0?Z:ae)!==null&&ne!==void 0?ne:"default"}),U=Object.keys(typeof N=="object"?N||{}:{}).some(ae=>["xs","sm","md","lg","xl","xxl"].includes(ae)),W=MZ(U),F=g.useMemo(()=>{if(typeof N!="object")return{};const ae=r7.find(ne=>W[ne]),Z=N[ae];return Z?{width:Z,height:Z,fontSize:Z&&(S||M)?Z/2:18}:{}},[W,N]),E=d("avatar",w),L=nu(E),[j,Y,O]=yQe(E,L),_=Mn({[`${E}-lg`]:N==="large",[`${E}-sm`]:N==="small"}),G=g.isValidElement(P),Q=x||(p==null?void 0:p.shape)||"circle",oe=Mn(E,_,f==null?void 0:f.className,`${E}-${Q}`,{[`${E}-image`]:G||P&&a,[`${E}-icon`]:!!S},O,L,v,b,Y),ee=typeof N=="number"?{width:N,height:N,fontSize:S?N/2:18}:{};let $;if(typeof P=="string"&&a)$=g.createElement("img",{src:P,draggable:R,srcSet:A,onError:y,alt:T,crossOrigin:D});else if(G)$=P;else if(S)$=S;else if(r||n!==1){const ae=`scale(${n})`,Z={msTransform:ae,WebkitTransform:ae,transform:ae};$=g.createElement(VQ,{onResize:m},g.createElement("span",{className:`${E}-string`,ref:c,style:Object.assign({},Z)},M))}else $=g.createElement("span",{className:`${E}-string`,style:{opacity:0},ref:c},M);return delete k.onError,delete k.gap,j(g.createElement("span",Object.assign({},k,{style:Object.assign(Object.assign(Object.assign(Object.assign({},ee),F),f==null?void 0:f.style),k.style),className:oe,ref:u}),$))},AQe=g.forwardRef(hYt);var IL={ENTER:13,ESC:27};const aJ=t=>t?typeof t=="function"?t():t:null;function A9e(t){var e=t.children,n=t.prefixCls,o=t.id,r=t.overlayInnerStyle,i=t.bodyClassName,a=t.className,l=t.style;return g.createElement("div",{className:Bn("".concat(n,"-content"),a),style:l},g.createElement("div",{className:Bn("".concat(n,"-inner"),i),id:o,role:"tooltip",style:r},typeof e=="function"?e():e))}function whe(){return whe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}function AYt(t,e){if(t==null)return{};var n=yYt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var kP={shiftX:64,adjustY:1},FP={adjustX:1,shiftY:!0},ey=[0,0],wYt={left:{points:["cr","cl"],overflow:FP,offset:[-4,0],targetOffset:ey},right:{points:["cl","cr"],overflow:FP,offset:[4,0],targetOffset:ey},top:{points:["bc","tc"],overflow:kP,offset:[0,-4],targetOffset:ey},bottom:{points:["tc","bc"],overflow:kP,offset:[0,4],targetOffset:ey},topLeft:{points:["bl","tl"],overflow:kP,offset:[0,-4],targetOffset:ey},leftTop:{points:["tr","tl"],overflow:FP,offset:[-4,0],targetOffset:ey},topRight:{points:["br","tr"],overflow:kP,offset:[0,-4],targetOffset:ey},rightTop:{points:["tl","tr"],overflow:FP,offset:[4,0],targetOffset:ey},bottomRight:{points:["tr","br"],overflow:kP,offset:[0,4],targetOffset:ey},rightBottom:{points:["bl","br"],overflow:FP,offset:[4,0],targetOffset:ey},bottomLeft:{points:["tl","bl"],overflow:kP,offset:[0,4],targetOffset:ey},leftBottom:{points:["br","bl"],overflow:FP,offset:[-4,0],targetOffset:ey}},xYt=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],vYt=function(e,n){var o=e.overlayClassName,r=e.trigger,i=r===void 0?["hover"]:r,a=e.mouseEnterDelay,l=a===void 0?0:a,s=e.mouseLeaveDelay,c=s===void 0?.1:s,u=e.overlayStyle,d=e.prefixCls,f=d===void 0?"rc-tooltip":d,p=e.children,m=e.onVisibleChange,y=e.afterVisibleChange,w=e.transitionName,x=e.animation,C=e.motion,P=e.placement,A=P===void 0?"right":P,S=e.align,v=S===void 0?{}:S,b=e.destroyTooltipOnHide,T=b===void 0?!1:b,R=e.defaultVisible,M=e.getTooltipContainer,D=e.overlayInnerStyle;e.arrowContent;var k=e.overlay,N=e.id,U=e.showArrow,W=U===void 0?!0:U,F=e.classNames,E=e.styles,L=AYt(e,xYt),j=g.useRef(null);g.useImperativeHandle(n,function(){return j.current});var Y=qD({},L);"visible"in e&&(Y.popupVisible=e.visible);var O=function(){return g.createElement(A9e,{key:"content",prefixCls:f,id:N,bodyClassName:F==null?void 0:F.body,overlayInnerStyle:qD(qD({},D),E==null?void 0:E.body)},k)};return g.createElement(eI,whe({popupClassName:Bn(o,F==null?void 0:F.root),prefixCls:f,popup:O,action:i,builtinPlacements:wYt,popupPlacement:A,ref:j,popupAlign:v,getPopupContainer:M,onPopupVisibleChange:m,afterPopupVisibleChange:y,popupTransitionName:w,popupAnimation:x,popupMotion:C,defaultPopupVisible:R,autoDestroy:T,mouseLeaveDelay:c,popupStyle:qD(qD({},u),E==null?void 0:E.root),mouseEnterDelay:l,arrow:W},Y),p)};const bYt=g.forwardRef(vYt);function IZ(t){const{sizePopupArrow:e,borderRadiusXS:n,borderRadiusOuter:o}=t,r=e/2,i=0,a=r,l=o*1/Math.sqrt(2),s=r-o*(1-1/Math.sqrt(2)),c=r-n*(1/Math.sqrt(2)),u=o*(Math.sqrt(2)-1)+n*(1/Math.sqrt(2)),d=2*r-c,f=u,p=2*r-l,m=s,y=2*r-i,w=a,x=r*Math.sqrt(2)+o*(Math.sqrt(2)-2),C=o*(Math.sqrt(2)-1),P=`polygon(${C}px 100%, 50% ${C}px, ${2*r-C}px 100%, ${C}px 100%)`,A=`path('M ${i} ${a} A ${o} ${o} 0 0 0 ${l} ${s} L ${c} ${u} A ${n} ${n} 0 0 1 ${d} ${f} L ${p} ${m} A ${o} ${o} 0 0 0 ${y} ${w} Z')`;return{arrowShadowWidth:x,arrowPath:A,arrowPolygon:P}}const wQe=(t,e,n)=>{const{sizePopupArrow:o,arrowPolygon:r,arrowPath:i,arrowShadowWidth:a,borderRadiusXS:l,calc:s}=t;return{pointerEvents:"none",width:o,height:o,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:o,height:s(o).div(2).equal(),background:e,clipPath:{_multi_value_:!0,value:[r,i]},content:'""'},"&::after":{content:'""',position:"absolute",width:a,height:a,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${jt(l)} 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}},xQe=8;function zZ(t){const{contentRadius:e,limitVerticalRadius:n}=t,o=e>12?e+2:12;return{arrowOffsetHorizontal:o,arrowOffsetVertical:n?xQe:o}}function _O(t,e){return t?e:{}}function w9e(t,e,n){const{componentCls:o,boxShadowPopoverArrow:r,arrowOffsetVertical:i,arrowOffsetHorizontal:a}=t,{arrowDistance:l=0,arrowPlacement:s={left:!0,right:!0,top:!0,bottom:!0}}=n||{};return{[o]:Object.assign(Object.assign(Object.assign(Object.assign({[`${o}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},wQe(t,e,r)),{"&:before":{background:e}})]},_O(!!s.top,{[[`&-placement-top > ${o}-arrow`,`&-placement-topLeft > ${o}-arrow`,`&-placement-topRight > ${o}-arrow`].join(",")]:{bottom:l,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},"&-placement-topLeft":{"--arrow-offset-horizontal":a,[`> ${o}-arrow`]:{left:{_skip_check_:!0,value:a}}},"&-placement-topRight":{"--arrow-offset-horizontal":`calc(100% - ${jt(a)})`,[`> ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}}})),_O(!!s.bottom,{[[`&-placement-bottom > ${o}-arrow`,`&-placement-bottomLeft > ${o}-arrow`,`&-placement-bottomRight > ${o}-arrow`].join(",")]:{top:l,transform:"translateY(-100%)"},[`&-placement-bottom > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},"&-placement-bottomLeft":{"--arrow-offset-horizontal":a,[`> ${o}-arrow`]:{left:{_skip_check_:!0,value:a}}},"&-placement-bottomRight":{"--arrow-offset-horizontal":`calc(100% - ${jt(a)})`,[`> ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}}})),_O(!!s.left,{[[`&-placement-left > ${o}-arrow`,`&-placement-leftTop > ${o}-arrow`,`&-placement-leftBottom > ${o}-arrow`].join(",")]:{right:{_skip_check_:!0,value:l},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop > ${o}-arrow`]:{top:i},[`&-placement-leftBottom > ${o}-arrow`]:{bottom:i}})),_O(!!s.right,{[[`&-placement-right > ${o}-arrow`,`&-placement-rightTop > ${o}-arrow`,`&-placement-rightBottom > ${o}-arrow`].join(",")]:{left:{_skip_check_:!0,value:l},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop > ${o}-arrow`]:{top:i},[`&-placement-rightBottom > ${o}-arrow`]:{bottom:i}}))}}function SYt(t,e,n,o){if(o===!1)return{adjustX:!1,adjustY:!1};const r=o&&typeof o=="object"?o:{},i={};switch(t){case"top":case"bottom":i.shiftX=e.arrowOffsetHorizontal*2+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=e.arrowOffsetVertical*2+n,i.shiftX=!0,i.adjustX=!0;break}const a=Object.assign(Object.assign({},i),r);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}const oPe={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},TYt={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},PYt=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function vQe(t){const{arrowWidth:e,autoAdjustOverflow:n,arrowPointAtCenter:o,offset:r,borderRadius:i,visibleFirst:a}=t,l=e/2,s={};return Object.keys(oPe).forEach(c=>{const u=o&&TYt[c]||oPe[c],d=Object.assign(Object.assign({},u),{offset:[0,0],dynamicInset:!0});switch(s[c]=d,PYt.has(c)&&(d.autoArrow=!1),c){case"top":case"topLeft":case"topRight":d.offset[1]=-l-r;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=l+r;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-l-r;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=l+r;break}const f=zZ({contentRadius:i,limitVerticalRadius:!0});if(o)switch(c){case"topLeft":case"bottomLeft":d.offset[0]=-f.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":d.offset[0]=f.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":d.offset[1]=-f.arrowOffsetHorizontal*2+l;break;case"leftBottom":case"rightBottom":d.offset[1]=f.arrowOffsetHorizontal*2-l;break}d.overflow=SYt(c,f,e,n),a&&(d.htmlRegion="visibleFirst")}),s}const CYt=t=>{const{calc:e,componentCls:n,tooltipMaxWidth:o,tooltipColor:r,tooltipBg:i,tooltipBorderRadius:a,zIndexPopup:l,controlHeight:s,boxShadowSecondary:c,paddingSM:u,paddingXS:d,arrowOffsetHorizontal:f,sizePopupArrow:p}=t,m=e(a).add(p).add(f).equal(),y=e(a).mul(2).add(p).equal();return[{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"absolute",zIndex:l,display:"block",width:"max-content",maxWidth:o,visibility:"visible","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:["var(--valid-offset-x, 50%)","var(--arrow-y, 50%)"].join(" "),"&-hidden":{display:"none"},"--antd-arrow-background-color":i,[`${n}-inner`]:{minWidth:y,minHeight:s,padding:`${jt(t.calc(u).div(2).equal())} ${jt(d)}`,color:r,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:i,borderRadius:a,boxShadow:c,boxSizing:"border-box"},[["&-placement-topLeft","&-placement-topRight","&-placement-bottomLeft","&-placement-bottomRight"].join(",")]:{minWidth:m},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${n}-inner`]:{borderRadius:t.min(a,xQe)}},[`${n}-content`]:{position:"relative"}}),sZ(t,(w,x)=>{let{darkColor:C}=x;return{[`&${n}-${w}`]:{[`${n}-inner`]:{backgroundColor:C},[`${n}-arrow`]:{"--antd-arrow-background-color":C}}}})),{"&-rtl":{direction:"rtl"}})},w9e(t,"var(--antd-arrow-background-color)"),{[`${n}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow}}]},RYt=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+70},zZ({contentRadius:t.borderRadius,limitVerticalRadius:!0})),IZ(Ui(t,{borderRadiusOuter:Math.min(t.borderRadiusOuter,4)}))),bQe=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return el("Tooltip",o=>{const{borderRadius:r,colorTextLightSolid:i,colorBgSpotlight:a}=o,l=Ui(o,{tooltipMaxWidth:250,tooltipColor:i,tooltipBorderRadius:r,tooltipBg:a});return[CYt(l),QM(o,"zoom-big-fast")]},RYt,{resetStyle:!1,injectStyle:e})(t)},HYt=Gb.map(t=>`${t}-inverse`),MYt=["success","processing","error","default","warning"];function DZ(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat(Pa(HYt),Pa(Gb)).includes(t):Gb.includes(t)}function IYt(t){return MYt.includes(t)}function SQe(t,e){const n=DZ(e),o=Mn({[`${t}-${e}`]:e&&n}),r={},i={};return e&&!n&&(r.background=e,i["--antd-arrow-background-color"]=e),{className:o,overlayStyle:r,arrowStyle:i}}const zYt=t=>{const{prefixCls:e,className:n,placement:o="top",title:r,color:i,overlayInnerStyle:a}=t,{getPrefixCls:l}=g.useContext(gr),s=l("tooltip",e),[c,u,d]=bQe(s),f=SQe(s,i),p=f.arrowStyle,m=Object.assign(Object.assign({},a),f.overlayStyle),y=Mn(u,d,s,`${s}-pure`,`${s}-placement-${o}`,n,f.className);return c(g.createElement("div",{className:y,style:p},g.createElement("div",{className:`${s}-arrow`}),g.createElement(A9e,Object.assign({},t,{className:u,prefixCls:s,overlayInnerStyle:m}),r)))};var DYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a,l;const{prefixCls:s,openClassName:c,getTooltipContainer:u,color:d,overlayInnerStyle:f,children:p,afterOpenChange:m,afterVisibleChange:y,destroyTooltipOnHide:w,arrow:x=!0,title:C,overlay:P,builtinPlacements:A,arrowPointAtCenter:S=!1,autoAdjustOverflow:v=!0,motion:b,getPopupContainer:T,placement:R="top",mouseEnterDelay:M=.1,mouseLeaveDelay:D=.1,overlayStyle:k,rootClassName:N,overlayClassName:U,styles:W,classNames:F}=t,E=DYt(t,["prefixCls","openClassName","getTooltipContainer","color","overlayInnerStyle","children","afterOpenChange","afterVisibleChange","destroyTooltipOnHide","arrow","title","overlay","builtinPlacements","arrowPointAtCenter","autoAdjustOverflow","motion","getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName","overlayClassName","styles","classNames"]),L=!!x,[,j]=Ff(),{getPopupContainer:Y,getPrefixCls:O,direction:_,tooltip:G}=g.useContext(gr),Q=LS(),oe=g.useRef(null),ee=()=>{var Re;(Re=oe.current)===null||Re===void 0||Re.forceAlign()};g.useImperativeHandle(e,()=>{var Re;return{forceAlign:ee,forcePopupAlign:()=>{Q.deprecated(!1,"forcePopupAlign","forceAlign"),ee()},nativeElement:(Re=oe.current)===null||Re===void 0?void 0:Re.nativeElement}});const[$,ae]=qA(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(o=t.defaultOpen)!==null&&o!==void 0?o:t.defaultVisible}),Z=!C&&!P&&C!==0,ne=Re=>{var Ne,_e;ae(Z?!1:Re),Z||((Ne=t.onOpenChange)===null||Ne===void 0||Ne.call(t,Re),(_e=t.onVisibleChange)===null||_e===void 0||_e.call(t,Re))},te=g.useMemo(()=>{var Re,Ne;let _e=S;return typeof x=="object"&&(_e=(Ne=(Re=x.pointAtCenter)!==null&&Re!==void 0?Re:x.arrowPointAtCenter)!==null&&Ne!==void 0?Ne:S),A||vQe({arrowPointAtCenter:_e,autoAdjustOverflow:v,arrowWidth:L?j.sizePopupArrow:0,borderRadius:j.borderRadius,offset:j.marginXXS,visibleFirst:!0})},[S,x,A,j]),q=g.useMemo(()=>C===0?C:P||C||"",[P,C]),le=g.createElement(E3,{space:!0},typeof q=="function"?q():q),de=O("tooltip",s),he=O(),me=t["data-popover-inject"];let ce=$;!("open"in t)&&!("visible"in t)&&Z&&(ce=!1);const Pe=g.isValidElement(p)&&!M$e(p)?p:g.createElement("span",null,p),pe=Pe.props,Ie=!pe.className||typeof pe.className=="string"?Mn(pe.className,c||`${de}-open`):pe.className,[ve,ze,Ae]=bQe(de,!me),se=SQe(de,d),ge=se.arrowStyle,we=Mn(U,{[`${de}-rtl`]:_==="rtl"},se.className,N,ze,Ae,G==null?void 0:G.className,(r=G==null?void 0:G.classNames)===null||r===void 0?void 0:r.root,F==null?void 0:F.root),Se=Mn((i=G==null?void 0:G.classNames)===null||i===void 0?void 0:i.body,F==null?void 0:F.body),[Me,Ce]=a6("Tooltip",E.zIndex),Te=g.createElement(bYt,Object.assign({},E,{zIndex:Me,showArrow:L,placement:R,mouseEnterDelay:M,mouseLeaveDelay:D,prefixCls:de,classNames:{root:we,body:Se},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ge),(a=G==null?void 0:G.styles)===null||a===void 0?void 0:a.root),G==null?void 0:G.style),k),W==null?void 0:W.root),body:Object.assign(Object.assign(Object.assign(Object.assign({},(l=G==null?void 0:G.styles)===null||l===void 0?void 0:l.body),f),W==null?void 0:W.body),se.overlayStyle)},getTooltipContainer:T||u||Y,ref:oe,builtinPlacements:te,overlay:le,visible:ce,onVisibleChange:ne,afterVisibleChange:m??y,arrowContent:g.createElement("span",{className:`${de}-arrow-content`}),motion:{motionName:L1(he,"zoom-big-fast",t.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!w}),ce?P0(Pe,{className:Ie}):Pe);return ve(g.createElement(iU.Provider,{value:Ce},Te))}),k3=EYt;k3._InternalPanelDoNotUseOrYouWillBeFired=zYt;const kYt=t=>{const{componentCls:e,popoverColor:n,titleMinWidth:o,fontWeightStrong:r,innerPadding:i,boxShadowSecondary:a,colorTextHeading:l,borderRadiusLG:s,zIndexPopup:c,titleMarginBottom:u,colorBgElevated:d,popoverBg:f,titleBorderBottom:p,innerContentPadding:m,titlePadding:y}=t;return[{[e]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:["var(--valid-offset-x, 50%)","var(--arrow-y, 50%)"].join(" "),"--antd-arrow-background-color":d,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${e}-content`]:{position:"relative"},[`${e}-inner`]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:s,boxShadow:a,padding:i},[`${e}-title`]:{minWidth:o,marginBottom:u,color:l,fontWeight:r,borderBottom:p,padding:y},[`${e}-inner-content`]:{color:n,padding:m}})},w9e(t,"var(--antd-arrow-background-color)"),{[`${e}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow,display:"inline-block",[`${e}-content`]:{display:"inline-block"}}}]},FYt=t=>{const{componentCls:e}=t;return{[e]:Gb.map(n=>{const o=t[`${n}6`];return{[`&${e}-${n}`]:{"--antd-arrow-background-color":o,[`${e}-inner`]:{backgroundColor:o},[`${e}-arrow`]:{background:"transparent"}}}})}},LYt=t=>{const{lineWidth:e,controlHeight:n,fontHeight:o,padding:r,wireframe:i,zIndexPopupBase:a,borderRadiusLG:l,marginXS:s,lineType:c,colorSplit:u,paddingSM:d}=t,f=n-o,p=f/2,m=f/2-e,y=r;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:a+30},IZ(t)),zZ({contentRadius:l,limitVerticalRadius:!0})),{innerPadding:i?0:12,titleMarginBottom:i?0:s,titlePadding:i?`${p}px ${y}px ${m}px`:0,titleBorderBottom:i?`${e}px ${c} ${u}`:"none",innerContentPadding:i?`${d}px ${y}px`:0})},TQe=el("Popover",t=>{const{colorBgElevated:e,colorText:n}=t,o=Ui(t,{popoverBg:e,popoverColor:n});return[kYt(o),FYt(o),QM(o,"zoom-big")]},LYt,{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var WYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{title:e,content:n,prefixCls:o}=t;return!e&&!n?null:g.createElement(g.Fragment,null,e&&g.createElement("div",{className:`${o}-title`},e),n&&g.createElement("div",{className:`${o}-inner-content`},n))},NYt=t=>{const{hashId:e,prefixCls:n,className:o,style:r,placement:i="top",title:a,content:l,children:s}=t,c=aJ(a),u=aJ(l),d=Mn(e,n,`${n}-pure`,`${n}-placement-${i}`,o);return g.createElement("div",{className:d,style:r},g.createElement("div",{className:`${n}-arrow`}),g.createElement(A9e,Object.assign({},t,{className:e,prefixCls:n}),s||g.createElement(PQe,{prefixCls:n,title:c,content:u})))},UYt=t=>{const{prefixCls:e,className:n}=t,o=WYt(t,["prefixCls","className"]),{getPrefixCls:r}=g.useContext(gr),i=r("popover",e),[a,l,s]=TQe(i);return a(g.createElement(NYt,Object.assign({},o,{prefixCls:i,hashId:l,className:Mn(n,s)})))};var jYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a,l;const{prefixCls:s,title:c,content:u,overlayClassName:d,placement:f="top",trigger:p="hover",children:m,mouseEnterDelay:y=.1,mouseLeaveDelay:w=.1,onOpenChange:x,overlayStyle:C={},styles:P,classNames:A}=t,S=jYt(t,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{popover:v,getPrefixCls:b}=g.useContext(gr),T=b("popover",s),[R,M,D]=TQe(T),k=b(),N=Mn(d,M,D,(n=v==null?void 0:v.classNames)===null||n===void 0?void 0:n.root,A==null?void 0:A.root),U=Mn((o=v==null?void 0:v.classNames)===null||o===void 0?void 0:o.body,A==null?void 0:A.body),[W,F]=qA(!1,{value:(r=t.open)!==null&&r!==void 0?r:t.visible,defaultValue:(i=t.defaultOpen)!==null&&i!==void 0?i:t.defaultVisible}),E=(_,G)=>{F(_,!0),x==null||x(_,G)},L=_=>{_.keyCode===IL.ESC&&E(!1,_)},j=_=>{E(_)},Y=aJ(c),O=aJ(u);return R(g.createElement(k3,Object.assign({placement:f,trigger:p,mouseEnterDelay:y,mouseLeaveDelay:w},S,{prefixCls:T,classNames:{root:N,body:U},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},(a=v==null?void 0:v.styles)===null||a===void 0?void 0:a.root),v==null?void 0:v.style),C),P==null?void 0:P.root),body:Object.assign(Object.assign({},(l=v==null?void 0:v.styles)===null||l===void 0?void 0:l.body),P==null?void 0:P.body)},ref:e,open:W,onOpenChange:j,overlay:Y||O?g.createElement(PQe,{prefixCls:T,title:Y,content:O}):null,transitionName:L1(k,"zoom-big",S.transitionName),"data-popover-inject":!0}),P0(m,{onKeyDown:_=>{var G,Q;g.isValidElement(m)&&((Q=m==null?void 0:(G=m.props).onKeyDown)===null||Q===void 0||Q.call(G,_)),L(_)}})))}),zl=BYt;zl._InternalPanelDoNotUseOrYouWillBeFired=UYt;const rPe=t=>{const{size:e,shape:n}=g.useContext(Ahe),o=g.useMemo(()=>({size:t.size||e,shape:t.shape||n}),[t.size,t.shape,e,n]);return g.createElement(Ahe.Provider,{value:o},t.children)},YYt=t=>{var e,n,o,r;const{getPrefixCls:i,direction:a}=g.useContext(gr),{prefixCls:l,className:s,rootClassName:c,style:u,maxCount:d,maxStyle:f,size:p,shape:m,maxPopoverPlacement:y,maxPopoverTrigger:w,children:x,max:C}=t,P=i("avatar",l),A=`${P}-group`,S=nu(P),[v,b,T]=yQe(P,S),R=Mn(A,{[`${A}-rtl`]:a==="rtl"},T,S,s,c,b),M=jy(x).map((N,U)=>P0(N,{key:`avatar-key-${U}`})),D=(C==null?void 0:C.count)||d,k=M.length;if(D&&D{const{componentCls:e,iconCls:n,antCls:o,badgeShadowSize:r,textFontSize:i,textFontSizeSM:a,statusSize:l,dotSize:s,textFontWeight:c,indicatorHeight:u,indicatorHeightSM:d,marginXS:f,calc:p}=t,m=`${o}-scroll-number`,y=sZ(t,(w,x)=>{let{darkColor:C}=x;return{[`&${e} ${e}-color-${w}`]:{background:C,[`&:not(${e}-count)`]:{color:C},"a:hover &":{background:C}}}});return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${e}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:u,height:u,color:t.badgeTextColor,fontWeight:c,fontSize:i,lineHeight:jt(u),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:p(u).div(2).equal(),boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`,transition:`background ${t.motionDurationMid}`,a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},[`${e}-count-sm`]:{minWidth:d,height:d,fontSize:a,lineHeight:jt(d),borderRadius:p(d).div(2).equal()},[`${e}-multiple-words`]:{padding:`0 ${jt(t.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${e}-dot`]:{zIndex:t.indicatorZIndex,width:s,minWidth:s,height:s,background:t.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`},[`${e}-count, ${e}-dot, ${m}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${n}-spin`]:{animationName:qYt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${e}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${e}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:l,height:l,verticalAlign:"middle",borderRadius:"50%"},[`${e}-status-success`]:{backgroundColor:t.colorSuccess},[`${e}-status-processing`]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:r,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:GYt,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${e}-status-default`]:{backgroundColor:t.colorTextPlaceholder},[`${e}-status-error`]:{backgroundColor:t.colorError},[`${e}-status-warning`]:{backgroundColor:t.colorWarning},[`${e}-status-text`]:{marginInlineStart:f,color:t.colorText,fontSize:t.fontSize}}}),y),{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:XYt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`${e}-zoom-leave`]:{animationName:JYt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`&${e}-not-a-wrapper`]:{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:KYt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`${e}-zoom-leave`]:{animationName:$Yt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`&:not(${e}-status)`]:{verticalAlign:"middle"},[`${m}-custom-component, ${e}-count`]:{transform:"none"},[`${m}-custom-component, ${m}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[m]:{overflow:"hidden",transition:`all ${t.motionDurationMid} ${t.motionEaseOutBack}`,[`${m}-only`]:{position:"relative",display:"inline-block",height:u,transition:`all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${m}-only-unit`]:{height:u,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${m}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${e}-count, ${e}-dot, ${m}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},RQe=t=>{const{fontHeight:e,lineWidth:n,marginXS:o,colorBorderBg:r}=t,i=e,a=n,l=t.colorTextLightSolid,s=t.colorError,c=t.colorErrorHover;return Ui(t,{badgeFontHeight:i,badgeShadowSize:a,badgeTextColor:l,badgeColor:s,badgeColorHover:c,badgeShadowColor:r,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},HQe=t=>{const{fontSize:e,lineHeight:n,fontSizeSM:o,lineWidth:r}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*n)-2*r,indicatorHeightSM:e,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}},ZYt=el("Badge",t=>{const e=RQe(t);return QYt(e)},HQe),eOt=t=>{const{antCls:e,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:r,calc:i}=t,a=`${e}-ribbon`,l=`${e}-ribbon-wrapper`,s=sZ(t,(c,u)=>{let{darkColor:d}=u;return{[`&${a}-color-${c}`]:{background:d,color:d}}});return{[l]:{position:"relative"},[a]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:o,padding:`0 ${jt(t.paddingXS)}`,color:t.colorPrimary,lineHeight:jt(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,[`${a}-text`]:{color:t.badgeTextColor},[`${a}-corner`]:{position:"absolute",top:"100%",width:r,height:r,color:"currentcolor",border:`${jt(i(r).div(2).equal())} solid`,transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),s),{[`&${a}-placement-end`]:{insetInlineEnd:i(r).mul(-1).equal(),borderEndEndRadius:0,[`${a}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${a}-placement-start`]:{insetInlineStart:i(r).mul(-1).equal(),borderEndStartRadius:0,[`${a}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},tOt=el(["Badge","Ribbon"],t=>{const e=RQe(t);return eOt(e)},HQe),nOt=t=>{const{className:e,prefixCls:n,style:o,color:r,children:i,text:a,placement:l="end",rootClassName:s}=t,{getPrefixCls:c,direction:u}=g.useContext(gr),d=c("ribbon",n),f=`${d}-wrapper`,[p,m,y]=tOt(d,f),w=DZ(r,!1),x=Mn(d,`${d}-placement-${l}`,{[`${d}-rtl`]:u==="rtl",[`${d}-color-${r}`]:w},e),C={},P={};return r&&!w&&(C.background=r,P.color=r),p(g.createElement("div",{className:Mn(f,s,m,y)},i,g.createElement("div",{className:Mn(x,m),style:Object.assign(Object.assign({},C),o)},g.createElement("span",{className:`${d}-text`},a),g.createElement("div",{className:`${d}-corner`,style:P}))))},iPe=t=>{const{prefixCls:e,value:n,current:o,offset:r=0}=t;let i;return r&&(i={position:"absolute",top:`${r}00%`,left:0}),g.createElement("span",{style:i,className:Mn(`${e}-only-unit`,{current:o})},n)};function oOt(t,e,n){let o=t,r=0;for(;(o+10)%10!==e;)o+=n,r+=n;return r}const rOt=t=>{const{prefixCls:e,count:n,value:o}=t,r=Number(o),i=Math.abs(n),[a,l]=g.useState(r),[s,c]=g.useState(i),u=()=>{l(r),c(i)};g.useEffect(()=>{const p=setTimeout(u,1e3);return()=>clearTimeout(p)},[r]);let d,f;if(a===r||Number.isNaN(r)||Number.isNaN(a))d=[g.createElement(iPe,Object.assign({},t,{key:r,current:!0}))],f={transition:"none"};else{d=[];const p=r+10,m=[];for(let C=r;C<=p;C+=1)m.push(C);const y=sC%10===a);d=(y<0?m.slice(0,w+1):m.slice(w)).map((C,P)=>{const A=C%10;return g.createElement(iPe,Object.assign({},t,{key:C,value:A,offset:y<0?P-w:P,current:P===w}))}),f={transform:`translateY(${-oOt(a,r,y)}00%)`}}return g.createElement("span",{className:`${e}-only`,style:f,onTransitionEnd:u},d)};var iOt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,count:o,className:r,motionClassName:i,style:a,title:l,show:s,component:c="sup",children:u}=t,d=iOt(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=g.useContext(gr),p=f("scroll-number",n),m=Object.assign(Object.assign({},d),{"data-show":s,style:a,className:Mn(p,r,i),title:l});let y=o;if(o&&Number(o)%1===0){const w=String(o).split("");y=g.createElement("bdi",null,w.map((x,C)=>g.createElement(rOt,{prefixCls:p,count:Number(o),value:x,key:w.length-C})))}return a!=null&&a.borderColor&&(m.style=Object.assign(Object.assign({},a),{boxShadow:`0 0 0 1px ${a.borderColor} inset`})),u?P0(u,w=>({className:Mn(`${p}-custom-component`,w==null?void 0:w.className,i)})):g.createElement(c,Object.assign({},m,{ref:e}),y)});var lOt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a;const{prefixCls:l,scrollNumberPrefixCls:s,children:c,status:u,text:d,color:f,count:p=null,overflowCount:m=99,dot:y=!1,size:w="default",title:x,offset:C,style:P,className:A,rootClassName:S,classNames:v,styles:b,showZero:T=!1}=t,R=lOt(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:M,direction:D,badge:k}=g.useContext(gr),N=M("badge",l),[U,W,F]=ZYt(N),E=p>m?`${m}+`:p,L=E==="0"||E===0,j=p===null||L&&!T,Y=(u!=null||f!=null)&&j,O=y&&!L,_=O?"":E,G=g.useMemo(()=>(_==null||_===""||L&&!T)&&!O,[_,L,T,O]),Q=g.useRef(p);G||(Q.current=p);const oe=Q.current,ee=g.useRef(_);G||(ee.current=_);const $=ee.current,ae=g.useRef(O);G||(ae.current=O);const Z=g.useMemo(()=>{if(!C)return Object.assign(Object.assign({},k==null?void 0:k.style),P);const ce={marginTop:C[1]};return D==="rtl"?ce.left=parseInt(C[0],10):ce.right=-parseInt(C[0],10),Object.assign(Object.assign(Object.assign({},ce),k==null?void 0:k.style),P)},[D,C,P,k==null?void 0:k.style]),ne=x??(typeof oe=="string"||typeof oe=="number"?oe:void 0),te=G||!d?null:g.createElement("span",{className:`${N}-status-text`},d),q=!oe||typeof oe!="object"?void 0:P0(oe,ce=>({style:Object.assign(Object.assign({},Z),ce.style)})),le=DZ(f,!1),de=Mn(v==null?void 0:v.indicator,(n=k==null?void 0:k.classNames)===null||n===void 0?void 0:n.indicator,{[`${N}-status-dot`]:Y,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:le}),he={};f&&!le&&(he.color=f,he.background=f);const me=Mn(N,{[`${N}-status`]:Y,[`${N}-not-a-wrapper`]:!c,[`${N}-rtl`]:D==="rtl"},A,S,k==null?void 0:k.className,(o=k==null?void 0:k.classNames)===null||o===void 0?void 0:o.root,v==null?void 0:v.root,W,F);if(!c&&Y){const ce=Z.color;return U(g.createElement("span",Object.assign({},R,{className:me,style:Object.assign(Object.assign(Object.assign({},b==null?void 0:b.root),(r=k==null?void 0:k.styles)===null||r===void 0?void 0:r.root),Z)}),g.createElement("span",{className:de,style:Object.assign(Object.assign(Object.assign({},b==null?void 0:b.indicator),(i=k==null?void 0:k.styles)===null||i===void 0?void 0:i.indicator),he)}),d&&g.createElement("span",{style:{color:ce},className:`${N}-status-text`},d)))}return U(g.createElement("span",Object.assign({ref:e},R,{className:me,style:Object.assign(Object.assign({},(a=k==null?void 0:k.styles)===null||a===void 0?void 0:a.root),b==null?void 0:b.root)}),c,g.createElement(cZ,{visible:!G,motionName:`${N}-zoom`,motionAppear:!1,motionDeadline:1e3},ce=>{let{className:Pe}=ce;var pe,Ie;const ve=M("scroll-number",s),ze=ae.current,Ae=Mn(v==null?void 0:v.indicator,(pe=k==null?void 0:k.classNames)===null||pe===void 0?void 0:pe.indicator,{[`${N}-dot`]:ze,[`${N}-count`]:!ze,[`${N}-count-sm`]:w==="small",[`${N}-multiple-words`]:!ze&&$&&$.toString().length>1,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:le});let se=Object.assign(Object.assign(Object.assign({},b==null?void 0:b.indicator),(Ie=k==null?void 0:k.styles)===null||Ie===void 0?void 0:Ie.indicator),Z);return f&&!le&&(se=se||{},se.background=f),g.createElement(aOt,{prefixCls:ve,show:!G,motionClassName:Pe,className:Ae,count:$,title:ne,style:se,key:"scrollNumber"},q)}),te))}),MQe=sOt;MQe.Ribbon=nOt;var IQe={exports:{}},Ts={};/** * @license React * react-is.production.min.js * @@ -4561,7 +4561,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var x9e=Symbol.for("react.element"),v9e=Symbol.for("react.portal"),EZ=Symbol.for("react.fragment"),kZ=Symbol.for("react.strict_mode"),FZ=Symbol.for("react.profiler"),LZ=Symbol.for("react.provider"),WZ=Symbol.for("react.context"),cOt=Symbol.for("react.server_context"),NZ=Symbol.for("react.forward_ref"),UZ=Symbol.for("react.suspense"),jZ=Symbol.for("react.suspense_list"),BZ=Symbol.for("react.memo"),YZ=Symbol.for("react.lazy"),uOt=Symbol.for("react.offscreen"),zQe;zQe=Symbol.for("react.module.reference");function o2(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case x9e:switch(t=t.type,t){case EZ:case FZ:case kZ:case UZ:case jZ:return t;default:switch(t=t&&t.$$typeof,t){case cOt:case WZ:case NZ:case YZ:case BZ:case LZ:return t;default:return e}}case v9e:return e}}}Ts.ContextConsumer=WZ;Ts.ContextProvider=LZ;Ts.Element=x9e;Ts.ForwardRef=NZ;Ts.Fragment=EZ;Ts.Lazy=YZ;Ts.Memo=BZ;Ts.Portal=v9e;Ts.Profiler=FZ;Ts.StrictMode=kZ;Ts.Suspense=UZ;Ts.SuspenseList=jZ;Ts.isAsyncMode=function(){return!1};Ts.isConcurrentMode=function(){return!1};Ts.isContextConsumer=function(t){return o2(t)===WZ};Ts.isContextProvider=function(t){return o2(t)===LZ};Ts.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===x9e};Ts.isForwardRef=function(t){return o2(t)===NZ};Ts.isFragment=function(t){return o2(t)===EZ};Ts.isLazy=function(t){return o2(t)===YZ};Ts.isMemo=function(t){return o2(t)===BZ};Ts.isPortal=function(t){return o2(t)===v9e};Ts.isProfiler=function(t){return o2(t)===FZ};Ts.isStrictMode=function(t){return o2(t)===kZ};Ts.isSuspense=function(t){return o2(t)===UZ};Ts.isSuspenseList=function(t){return o2(t)===jZ};Ts.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===EZ||t===FZ||t===kZ||t===UZ||t===jZ||t===uOt||typeof t=="object"&&t!==null&&(t.$$typeof===YZ||t.$$typeof===BZ||t.$$typeof===LZ||t.$$typeof===WZ||t.$$typeof===NZ||t.$$typeof===zQe||t.getModuleId!==void 0)};Ts.typeOf=o2;IQe.exports=Ts;var _le=IQe.exports,dOt=Symbol.for("react.element"),fOt=Symbol.for("react.transitional.element"),hOt=Symbol.for("react.fragment");function pOt(t){return t&&Vr(t)==="object"&&(t.$$typeof===dOt||t.$$typeof===fOt)&&t.type===hOt}var gOt=function(e,n){typeof e=="function"?e(n):Vr(e)==="object"&&e&&"current"in e&&(e.current=n)},DQe=function(){for(var e=arguments.length,n=new Array(e),o=0;o1&&arguments[1]!==void 0?arguments[1]:1;aPe+=1;var o=aPe;function r(i){if(i===0)UQe(o),e();else{var a=WQe(function(){r(i-1)});b9e.set(o,a)}}return r(n),o};jQe.cancel=function(t){var e=b9e.get(t);return UQe(t),NQe(e)};var mOt=LQe.ESC,yOt=LQe.TAB;function AOt(t){var e=t.visible,n=t.triggerRef,o=t.onVisibleChange,r=t.autoFocus,i=t.overlayRef,a=g.useRef(!1),l=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),o==null||o(!1)}},s=function(){var d;return(d=i.current)!==null&&d!==void 0&&d.focus?(i.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case mOt:l();break;case yOt:{var f=!1;a.current||(f=s()),f?d.preventDefault():l();break}}};g.useEffect(function(){return e?(window.addEventListener("keydown",c),r&&jQe(s,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var wOt=g.forwardRef(function(t,e){var n=t.overlay,o=t.arrow,r=t.prefixCls,i=g.useMemo(function(){var l;return typeof n=="function"?l=n():l=n,l},[n]),a=DQe(e,FQe(i));return xe.createElement(xe.Fragment,null,o&&xe.createElement("div",{className:"".concat(r,"-arrow")}),xe.cloneElement(i,{ref:EQe(i)?a:void 0}))}),LP={adjustX:1,adjustY:1},WP=[0,0],xOt={topLeft:{points:["bl","tl"],overflow:LP,offset:[0,-4],targetOffset:WP},top:{points:["bc","tc"],overflow:LP,offset:[0,-4],targetOffset:WP},topRight:{points:["br","tr"],overflow:LP,offset:[0,-4],targetOffset:WP},bottomLeft:{points:["tl","bl"],overflow:LP,offset:[0,4],targetOffset:WP},bottom:{points:["tc","bc"],overflow:LP,offset:[0,4],targetOffset:WP},bottomRight:{points:["tr","br"],overflow:LP,offset:[0,4],targetOffset:WP}},vOt=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function bOt(t,e){var n,o=t.arrow,r=o===void 0?!1:o,i=t.prefixCls,a=i===void 0?"rc-dropdown":i,l=t.transitionName,s=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?xOt:f,m=t.getPopupContainer,y=t.showAction,w=t.hideAction,x=t.overlayClassName,C=t.overlayStyle,P=t.visible,A=t.trigger,S=A===void 0?["hover"]:A,v=t.autoFocus,b=t.overlay,T=t.children,R=t.onVisibleChange,M=Ai(t,vOt),D=xe.useState(),k=Sn(D,2),N=k[0],U=k[1],W="visible"in t?P:N,F=xe.useRef(null),E=xe.useRef(null),L=xe.useRef(null);xe.useImperativeHandle(e,function(){return F.current});var j=function(ae){U(ae),R==null||R(ae)};AOt({visible:W,triggerRef:L,onVisibleChange:j,autoFocus:v,overlayRef:E});var Y=function(ae){var Z=t.onOverlayClick;U(!1),Z&&Z(ae)},O=function(){return xe.createElement(wOt,{ref:E,overlay:b,prefixCls:a,arrow:r})},_=function(){return typeof b=="function"?O:O()},G=function(){var ae=t.minOverlayWidthMatchTrigger,Z=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?ae:!Z},Q=function(){var ae=t.openClassName;return ae!==void 0?ae:"".concat(a,"-open")},oe=xe.cloneElement(T,{className:Bn((n=T.props)===null||n===void 0?void 0:n.className,W&&Q()),ref:EQe(T)?DQe(L,FQe(T)):void 0}),ee=w;return!ee&&S.indexOf("contextMenu")!==-1&&(ee=["click"]),xe.createElement(eI,Uo({builtinPlacements:p},M,{prefixCls:a,ref:F,popupClassName:Bn(x,Ut({},"".concat(a,"-show-arrow"),r)),popupStyle:C,action:S,showAction:y,hideAction:ee,popupPlacement:d,popupAlign:c,popupTransitionName:l,popupAnimation:s,popupVisible:W,stretch:G()?"minWidth":"",popup:_(),onPopupVisibleChange:j,onPopupClick:Y,getPopupContainer:m}),oe)}const SOt=xe.forwardRef(bOt),TOt=t=>typeof t!="object"&&typeof t!="function"||t===null;var BQe=g.createContext(null);function YQe(t,e){return t===void 0?null:"".concat(t,"-").concat(e)}function OQe(t){var e=g.useContext(BQe);return YQe(e,t)}var POt=["children","locked"],E5=g.createContext(null);function COt(t,e){var n=nn({},t);return Object.keys(e).forEach(function(o){var r=e[o];r!==void 0&&(n[o]=r)}),n}function DL(t){var e=t.children,n=t.locked,o=Ai(t,POt),r=g.useContext(E5),i=k5e(function(){return COt(r,o)},[r,o],function(a,l){return!n&&(a[0]!==l[0]||!Vb(a[1],l[1],!0))});return g.createElement(E5.Provider,{value:i},e)}var ROt=[],_Qe=g.createContext(null);function OZ(){return g.useContext(_Qe)}var VQe=g.createContext(ROt);function nI(t){var e=g.useContext(VQe);return g.useMemo(function(){return t!==void 0?[].concat($o(e),[t]):e},[e,t])}var GQe=g.createContext(null),S9e=g.createContext({});function lPe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(tQe(t)){var n=t.nodeName.toLowerCase(),o=["input","select","textarea","button"].includes(n)||t.isContentEditable||n==="a"&&!!t.getAttribute("href"),r=t.getAttribute("tabindex"),i=Number(r),a=null;return r&&!Number.isNaN(i)?a=i:o&&a===null&&(a=0),o&&t.disabled&&(a=null),a!==null&&(a>=0||e&&a<0)}return!1}function HOt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=$o(t.querySelectorAll("*")).filter(function(o){return lPe(o,e)});return lPe(t,e)&&n.unshift(t),n}var xhe=Lo.LEFT,vhe=Lo.RIGHT,bhe=Lo.UP,gG=Lo.DOWN,mG=Lo.ENTER,XQe=Lo.ESC,QD=Lo.HOME,ZD=Lo.END,sPe=[bhe,gG,xhe,vhe];function MOt(t,e,n,o){var r,i="prev",a="next",l="children",s="parent";if(t==="inline"&&o===mG)return{inlineTrigger:!0};var c=Ut(Ut({},bhe,i),gG,a),u=Ut(Ut(Ut(Ut({},xhe,n?a:i),vhe,n?i:a),gG,l),mG,l),d=Ut(Ut(Ut(Ut(Ut(Ut({},bhe,i),gG,a),mG,l),XQe,s),xhe,n?l:s),vhe,n?s:l),f={inline:c,horizontal:u,vertical:d,inlineSub:c,horizontalSub:d,verticalSub:d},p=(r=f["".concat(t).concat(e?"":"Sub")])===null||r===void 0?void 0:r[o];switch(p){case i:return{offset:-1,sibling:!0};case a:return{offset:1,sibling:!0};case s:return{offset:-1,sibling:!1};case l:return{offset:1,sibling:!1};default:return null}}function IOt(t){for(var e=t;e;){if(e.getAttribute("data-menu-list"))return e;e=e.parentElement}return null}function zOt(t,e){for(var n=t||document.activeElement;n;){if(e.has(n))return n;n=n.parentElement}return null}function T9e(t,e){var n=HOt(t,!0);return n.filter(function(o){return e.has(o)})}function cPe(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!t)return null;var r=T9e(t,e),i=r.length,a=r.findIndex(function(l){return n===l});return o<0?a===-1?a=i-1:a-=1:o>0&&(a+=1),a=(a+i)%i,r[a]}var She=function(e,n){var o=new Set,r=new Map,i=new Map;return e.forEach(function(a){var l=document.querySelector("[data-menu-id='".concat(YQe(n,a),"']"));l&&(o.add(l),i.set(l,a),r.set(a,l))}),{elements:o,key2element:r,element2key:i}};function DOt(t,e,n,o,r,i,a,l,s,c){var u=g.useRef(),d=g.useRef();d.current=e;var f=function(){Ic.cancel(u.current)};return g.useEffect(function(){return function(){f()}},[]),function(p){var m=p.which;if([].concat(sPe,[mG,XQe,QD,ZD]).includes(m)){var y=i(),w=She(y,o),x=w,C=x.elements,P=x.key2element,A=x.element2key,S=P.get(e),v=zOt(S,C),b=A.get(v),T=MOt(t,a(b,!0).length===1,n,m);if(!T&&m!==QD&&m!==ZD)return;(sPe.includes(m)||[QD,ZD].includes(m))&&p.preventDefault();var R=function(E){if(E){var L=E,j=E.querySelector("a");j!=null&&j.getAttribute("href")&&(L=j);var Y=A.get(E);l(Y),f(),u.current=Ic(function(){d.current===Y&&L.focus()})}};if([QD,ZD].includes(m)||T.sibling||!v){var M;!v||t==="inline"?M=r.current:M=IOt(v);var D,k=T9e(M,C);m===QD?D=k[0]:m===ZD?D=k[k.length-1]:D=cPe(M,C,v,T.offset),R(D)}else if(T.inlineTrigger)s(b);else if(T.offset>0)s(b,!0),f(),u.current=Ic(function(){w=She(y,o);var F=v.getAttribute("aria-controls"),E=document.getElementById(F),L=cPe(E,w.elements);R(L)},5);else if(T.offset<0){var N=a(b,!0),U=N[N.length-2],W=P.get(U);s(U,!1),R(W)}}c==null||c(p)}}function EOt(t){Promise.resolve().then(t)}var P9e="__RC_UTIL_PATH_SPLIT__",uPe=function(e){return e.join(P9e)},kOt=function(e){return e.split(P9e)},The="rc-menu-more";function FOt(){var t=g.useState({}),e=Sn(t,2),n=e[1],o=g.useRef(new Map),r=g.useRef(new Map),i=g.useState([]),a=Sn(i,2),l=a[0],s=a[1],c=g.useRef(0),u=g.useRef(!1),d=function(){u.current||n({})},f=g.useCallback(function(P,A){var S=uPe(A);r.current.set(S,P),o.current.set(P,S),c.current+=1;var v=c.current;EOt(function(){v===c.current&&d()})},[]),p=g.useCallback(function(P,A){var S=uPe(A);r.current.delete(S),o.current.delete(P)},[]),m=g.useCallback(function(P){s(P)},[]),y=g.useCallback(function(P,A){var S=o.current.get(P)||"",v=kOt(S);return A&&l.includes(v[0])&&v.unshift(The),v},[l]),w=g.useCallback(function(P,A){return P.filter(function(S){return S!==void 0}).some(function(S){var v=y(S,!0);return v.includes(A)})},[y]),x=function(){var A=$o(o.current.keys());return l.length&&A.push(The),A},C=g.useCallback(function(P){var A="".concat(o.current.get(P)).concat(P9e),S=new Set;return $o(r.current.keys()).forEach(function(v){v.startsWith(A)&&S.add(r.current.get(v))}),S},[]);return g.useEffect(function(){return function(){u.current=!0}},[]),{registerPath:f,unregisterPath:p,refreshOverflowKeys:m,isSubPathKey:w,getKeyPath:y,getKeys:x,getSubPathKeys:C}}function KE(t){var e=g.useRef(t);e.current=t;var n=g.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a1&&(C.motionAppear=!1);var P=C.onVisibleChanged;return C.onVisibleChanged=function(A){return!f.current&&!A&&w(!0),P==null?void 0:P(A)},y?null:g.createElement(DL,{mode:i,locked:!f.current},g.createElement(Oy,Uo({visible:x},C,{forceRender:s,removeOnLeave:!1,leavedClassName:"".concat(l,"-hidden")}),function(A){var S=A.className,v=A.style;return g.createElement(C9e,{id:e,className:S,style:v},r)}))}var QOt=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],ZOt=["active"],e_t=g.forwardRef(function(t,e){var n=t.style,o=t.className,r=t.title,i=t.eventKey;t.warnKey;var a=t.disabled,l=t.internalPopupClose,s=t.children,c=t.itemIcon,u=t.expandIcon,d=t.popupClassName,f=t.popupOffset,p=t.popupStyle,m=t.onClick,y=t.onMouseEnter,w=t.onMouseLeave,x=t.onTitleClick,C=t.onTitleMouseEnter,P=t.onTitleMouseLeave,A=Ai(t,QOt),S=OQe(i),v=g.useContext(E5),b=v.prefixCls,T=v.mode,R=v.openKeys,M=v.disabled,D=v.overflowDisabled,k=v.activeKey,N=v.selectedKeys,U=v.itemIcon,W=v.expandIcon,F=v.onItemClick,E=v.onOpenChange,L=v.onActive,j=g.useContext(S9e),Y=j._internalRenderSubMenuItem,O=g.useContext(GQe),_=O.isSubPathKey,G=nI(),Q="".concat(b,"-submenu"),oe=M||a,ee=g.useRef(),q=g.useRef(),ae=c??U,Z=u??W,ne=R.includes(i),te=!D&&ne,$=_(N,i),le=JQe(i,oe,C,P),de=le.active,he=Ai(le,ZOt),me=g.useState(!1),ce=Sn(me,2),Pe=ce[0],pe=ce[1],Ie=function(qe){oe||pe(qe)},ve=function(qe){Ie(!0),y==null||y({key:i,domEvent:qe})},ze=function(qe){Ie(!1),w==null||w({key:i,domEvent:qe})},Ae=g.useMemo(function(){return de||(T!=="inline"?Pe||_([k],i):!1)},[T,de,k,Pe,i,_]),se=KQe(G.length),ge=function(qe){oe||(x==null||x({key:i,domEvent:qe}),T==="inline"&&E(i,!ne))},we=KE(function(Ue){m==null||m(lJ(Ue)),F(Ue)}),Se=function(qe){T!=="inline"&&E(i,qe)},Me=function(){L(i)},Ce=S&&"".concat(S,"-popup"),Te=g.createElement("div",Uo({role:"menuitem",style:se,className:"".concat(Q,"-title"),tabIndex:oe?null:-1,ref:ee,title:typeof r=="string"?r:null,"data-menu-id":D&&S?null:S,"aria-expanded":te,"aria-haspopup":!0,"aria-controls":Ce,"aria-disabled":oe,onClick:ge,onFocus:Me},he),r,g.createElement($Qe,{icon:T!=="horizontal"?Z:void 0,props:nn(nn({},t),{},{isOpen:te,isSubMenu:!0})},g.createElement("i",{className:"".concat(Q,"-arrow")}))),Re=g.useRef(T);if(T!=="inline"&&G.length>1?Re.current="vertical":Re.current=T,!D){var Ne=Re.current;Te=g.createElement($Ot,{mode:Ne,prefixCls:Q,visible:!l&&te&&T!=="inline",popupClassName:d,popupOffset:f,popupStyle:p,popup:g.createElement(DL,{mode:Ne==="horizontal"?"vertical":Ne},g.createElement(C9e,{id:Ce,ref:q},s)),disabled:oe,onVisibleChange:Se},Te)}var _e=g.createElement(S5.Item,Uo({ref:e,role:"none"},A,{component:"li",style:n,className:Bn(Q,"".concat(Q,"-").concat(T),o,Ut(Ut(Ut(Ut({},"".concat(Q,"-open"),te),"".concat(Q,"-active"),Ae),"".concat(Q,"-selected"),$),"".concat(Q,"-disabled"),oe)),onMouseEnter:ve,onMouseLeave:ze}),Te,!D&&g.createElement(qOt,{id:Ce,open:te,keyPath:G},s));return Y&&(_e=Y(_e,t,{selected:$,active:Ae,open:te,disabled:oe})),g.createElement(DL,{onItemClick:we,mode:T==="horizontal"?"vertical":T,itemIcon:ae,expandIcon:Z},_e)}),_Z=g.forwardRef(function(t,e){var n=t.eventKey,o=t.children,r=nI(n),i=R9e(o,r),a=OZ();g.useEffect(function(){if(a)return a.registerPath(n,r),function(){a.unregisterPath(n,r)}},[r]);var l;return a?l=i:l=g.createElement(e_t,Uo({ref:e},t),i),g.createElement(VQe.Provider,{value:r},l)});function H9e(t){var e=t.className,n=t.style,o=g.useContext(E5),r=o.prefixCls,i=OZ();return i?null:g.createElement("li",{role:"separator",className:Bn("".concat(r,"-item-divider"),e),style:n})}var t_t=["className","title","eventKey","children"],n_t=g.forwardRef(function(t,e){var n=t.className,o=t.title;t.eventKey;var r=t.children,i=Ai(t,t_t),a=g.useContext(E5),l=a.prefixCls,s="".concat(l,"-item-group");return g.createElement("li",Uo({ref:e,role:"presentation"},i,{onClick:function(u){return u.stopPropagation()},className:Bn(s,n)}),g.createElement("div",{role:"presentation",className:"".concat(s,"-title"),title:typeof o=="string"?o:void 0},o),g.createElement("ul",{role:"group",className:"".concat(s,"-list")},r))}),M9e=g.forwardRef(function(t,e){var n=t.eventKey,o=t.children,r=nI(n),i=R9e(o,r),a=OZ();return a?i:g.createElement(n_t,Uo({ref:e},tI(t,["warnKey"])),i)}),o_t=["label","children","key","type","extra"];function Phe(t,e,n){var o=e.item,r=e.group,i=e.submenu,a=e.divider;return(t||[]).map(function(l,s){if(l&&Vr(l)==="object"){var c=l,u=c.label,d=c.children,f=c.key,p=c.type,m=c.extra,y=Ai(c,o_t),w=f??"tmp-".concat(s);return d||p==="group"?p==="group"?g.createElement(r,Uo({key:w},y,{title:u}),Phe(d,e,n)):g.createElement(i,Uo({key:w},y,{title:u}),Phe(d,e,n)):p==="divider"?g.createElement(a,Uo({key:w},y)):g.createElement(o,Uo({key:w},y,{extra:m}),u,(!!m||m===0)&&g.createElement("span",{className:"".concat(n,"-item-extra")},m))}return null}).filter(function(l){return l})}function fPe(t,e,n,o,r){var i=t,a=nn({divider:H9e,item:yU,group:M9e,submenu:_Z},o);return e&&(i=Phe(e,a,r)),R9e(i,n)}var r_t=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],_x=[],i_t=g.forwardRef(function(t,e){var n,o=t,r=o.prefixCls,i=r===void 0?"rc-menu":r,a=o.rootClassName,l=o.style,s=o.className,c=o.tabIndex,u=c===void 0?0:c,d=o.items,f=o.children,p=o.direction,m=o.id,y=o.mode,w=y===void 0?"vertical":y,x=o.inlineCollapsed,C=o.disabled,P=o.disabledOverflow,A=o.subMenuOpenDelay,S=A===void 0?.1:A,v=o.subMenuCloseDelay,b=v===void 0?.1:v,T=o.forceSubMenuRender,R=o.defaultOpenKeys,M=o.openKeys,D=o.activeKey,k=o.defaultActiveFirst,N=o.selectable,U=N===void 0?!0:N,W=o.multiple,F=W===void 0?!1:W,E=o.defaultSelectedKeys,L=o.selectedKeys,j=o.onSelect,Y=o.onDeselect,O=o.inlineIndent,_=O===void 0?24:O,G=o.motion,Q=o.defaultMotions,oe=o.triggerSubMenuAction,ee=oe===void 0?"hover":oe,q=o.builtinPlacements,ae=o.itemIcon,Z=o.expandIcon,ne=o.overflowedIndicator,te=ne===void 0?"...":ne,$=o.overflowedIndicatorPopupClassName,le=o.getPopupContainer,de=o.onClick,he=o.onOpenChange,me=o.onKeyDown;o.openAnimation,o.openTransitionName;var ce=o._internalRenderMenuItem,Pe=o._internalRenderSubMenuItem,pe=o._internalComponents,Ie=Ai(o,r_t),ve=g.useMemo(function(){return[fPe(f,d,_x,pe,i),fPe(f,d,_x,{},i)]},[f,d,pe]),ze=Sn(ve,2),Ae=ze[0],se=ze[1],ge=g.useState(!1),we=Sn(ge,2),Se=we[0],Me=we[1],Ce=g.useRef(),Te=WOt(m),Re=p==="rtl",Ne=o0(R,{value:M,postState:function(xo){return xo||_x}}),_e=Sn(Ne,2),Ue=_e[0],qe=_e[1],Fe=function(xo){var wo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Rr(){qe(xo),he==null||he(xo)}wo?r0.flushSync(Rr):Rr()},He=g.useState(Ue),Le=Sn(He,2),Ye=Le[0],lt=Le[1],Oe=g.useRef(!1),ut=g.useMemo(function(){return(w==="inline"||w==="vertical")&&x?["vertical",x]:[w,!1]},[w,x]),ht=Sn(ut,2),Qe=ht[0],nt=ht[1],mt=Qe==="inline",tt=g.useState(Qe),gt=Sn(tt,2),Ve=gt[0],je=gt[1],et=g.useState(nt),bt=Sn(et,2),St=bt[0],Pt=bt[1];g.useEffect(function(){je(Qe),Pt(nt),Oe.current&&(mt?qe(Ye):Fe(_x))},[Qe,nt]);var Yt=g.useState(0),zt=Sn(Yt,2),Rt=zt[0],Ct=zt[1],yt=Rt>=Ae.length-1||Ve!=="horizontal"||P;g.useEffect(function(){mt&<(Ue)},[Ue]),g.useEffect(function(){return Oe.current=!0,function(){Oe.current=!1}},[]);var at=FOt(),Et=at.registerPath,Lt=at.unregisterPath,Je=at.refreshOverflowKeys,st=at.isSubPathKey,It=at.getKeyPath,ot=at.getKeys,it=at.getSubPathKeys,Be=g.useMemo(function(){return{registerPath:Et,unregisterPath:Lt}},[Et,Lt]),pt=g.useMemo(function(){return{isSubPathKey:st}},[st]);g.useEffect(function(){Je(yt?_x:Ae.slice(Rt+1).map(function(lr){return lr.key}))},[Rt,yt]);var ct=o0(D||k&&((n=Ae[0])===null||n===void 0?void 0:n.key),{value:D}),Xe=Sn(ct,2),ft=Xe[0],wt=Xe[1],kt=KE(function(lr){wt(lr)}),Zt=KE(function(){wt(void 0)});g.useImperativeHandle(e,function(){return{list:Ce.current,focus:function(xo){var wo,Rr=ot(),Eo=She(Rr,Te),An=Eo.elements,Dn=Eo.key2element,sr=Eo.element2key,Vo=T9e(Ce.current,An),Wo=ft??(Vo[0]?sr.get(Vo[0]):(wo=Ae.find(function(No){return!No.props.disabled}))===null||wo===void 0?void 0:wo.key),To=Dn.get(Wo);if(Wo&&To){var Go;To==null||(Go=To.focus)===null||Go===void 0||Go.call(To,xo)}}}});var Ot=o0(E||[],{value:L,postState:function(xo){return Array.isArray(xo)?xo:xo==null?_x:[xo]}}),on=Sn(Ot,2),qt=on[0],rn=on[1],Pn=function(xo){if(U){var wo=xo.key,Rr=qt.includes(wo),Eo;F?Rr?Eo=qt.filter(function(Dn){return Dn!==wo}):Eo=[].concat($o(qt),[wo]):Eo=[wo],rn(Eo);var An=nn(nn({},xo),{},{selectedKeys:Eo});Rr?Y==null||Y(An):j==null||j(An)}!F&&Ue.length&&Ve!=="inline"&&Fe(_x)},fo=KE(function(lr){de==null||de(lJ(lr)),Pn(lr)}),to=KE(function(lr,xo){var wo=Ue.filter(function(Eo){return Eo!==lr});if(xo)wo.push(lr);else if(Ve!=="inline"){var Rr=it(lr);wo=wo.filter(function(Eo){return!Rr.has(Eo)})}Vb(Ue,wo,!0)||Fe(wo,!0)}),Dt=function(xo,wo){var Rr=wo??!Ue.includes(xo);to(xo,Rr)},fn=DOt(Ve,ft,Re,Te,Ce,ot,It,wt,Dt,me);g.useEffect(function(){Me(!0)},[]);var kn=g.useMemo(function(){return{_internalRenderMenuItem:ce,_internalRenderSubMenuItem:Pe}},[ce,Pe]),yo=Ve!=="horizontal"||P?Ae:Ae.map(function(lr,xo){return g.createElement(DL,{key:lr.key,overflowDisabled:xo>Rt},lr)}),ur=g.createElement(S5,Uo({id:m,ref:Ce,prefixCls:"".concat(i,"-overflow"),component:"ul",itemComponent:yU,className:Bn(i,"".concat(i,"-root"),"".concat(i,"-").concat(Ve),s,Ut(Ut({},"".concat(i,"-inline-collapsed"),St),"".concat(i,"-rtl"),Re),a),dir:p,style:l,role:"menu",tabIndex:u,data:yo,renderRawItem:function(xo){return xo},renderRawRest:function(xo){var wo=xo.length,Rr=wo?Ae.slice(-wo):null;return g.createElement(_Z,{eventKey:The,title:te,disabled:yt,internalPopupClose:wo===0,popupClassName:$},Rr)},maxCount:Ve!=="horizontal"||P?S5.INVALIDATE:S5.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(xo){Ct(xo)},onKeyDown:fn},Ie));return g.createElement(S9e.Provider,{value:kn},g.createElement(BQe.Provider,{value:Te},g.createElement(DL,{prefixCls:i,rootClassName:a,mode:Ve,openKeys:Ue,rtl:Re,disabled:C,motion:Se?G:null,defaultMotions:Se?Q:null,activeKey:ft,onActive:kt,onInactive:Zt,selectedKeys:qt,inlineIndent:_,subMenuOpenDelay:S,subMenuCloseDelay:b,forceSubMenuRender:T,builtinPlacements:q,triggerSubMenuAction:ee,getPopupContainer:le,itemIcon:ae,expandIcon:Z,onItemClick:fo,onOpenChange:to},g.createElement(GQe.Provider,{value:pt},ur),g.createElement("div",{style:{display:"none"},"aria-hidden":!0},g.createElement(_Qe.Provider,{value:Be},se)))))}),oI=i_t;oI.Item=yU;oI.SubMenu=_Z;oI.ItemGroup=M9e;oI.Divider=H9e;var a_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},l_t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:a_t}))},I9e=g.forwardRef(l_t),s_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},c_t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:s_t}))},sJ=g.forwardRef(c_t);const QQe=g.createContext({});var u_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},d_t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:u_t}))},z9e=g.forwardRef(d_t);const cJ=g.createContext({prefixCls:"",firstLevel:!0,inlineCollapsed:!1});var f_t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,className:n,dashed:o}=t,r=f_t(t,["prefixCls","className","dashed"]),{getPrefixCls:i}=g.useContext(gr),a=i("menu",e),l=Mn({[`${a}-item-divider-dashed`]:!!o},n);return g.createElement(H9e,Object.assign({className:l},r))},eZe=t=>{var e;const{className:n,children:o,icon:r,title:i,danger:a,extra:l}=t,{prefixCls:s,firstLevel:c,direction:u,disableMenuItemTitleTooltip:d,inlineCollapsed:f}=g.useContext(cJ),p=P=>{const A=o==null?void 0:o[0],S=g.createElement("span",{className:Mn(`${s}-title-content`,{[`${s}-title-content-with-extra`]:!!l||l===0})},o);return(!r||g.isValidElement(o)&&o.type==="span")&&o&&P&&c&&typeof A=="string"?g.createElement("div",{className:`${s}-inline-collapsed-noicon`},A.charAt(0)):S},{siderCollapsed:m}=g.useContext(QQe);let y=i;typeof i>"u"?y=c?o:"":i===!1&&(y="");const w={title:y};!m&&!f&&(w.title=null,w.open=!1);const x=jy(o).length;let C=g.createElement(yU,Object.assign({},Mf(t,["title","icon","danger"]),{className:Mn({[`${s}-item-danger`]:a,[`${s}-item-only-child`]:(r?x+1:x)===1},n),title:typeof i=="string"?i:void 0}),P0(r,{className:Mn(g.isValidElement(r)?(e=r.props)===null||e===void 0?void 0:e.className:"",`${s}-item-icon`)}),p(f));return d||(C=g.createElement(k3,Object.assign({},w,{placement:u==="rtl"?"left":"right",classNames:{root:`${s}-inline-collapsed-tooltip`}}),C)),C};var h_t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{children:n}=t,o=h_t(t,["children"]),r=g.useContext(uJ),i=g.useMemo(()=>Object.assign(Object.assign({},r),o),[r,o.prefixCls,o.mode,o.selectable,o.rootClassName]),a=YHt(n),l=I5e(e,a?OQ(n):null);return g.createElement(uJ.Provider,{value:i},g.createElement(E3,{space:!0},a?g.cloneElement(n,{ref:l}):n))}),p_t=t=>{const{componentCls:e,motionDurationSlow:n,horizontalLineHeight:o,colorSplit:r,lineWidth:i,lineType:a,itemPaddingInline:l}=t;return{[`${e}-horizontal`]:{lineHeight:o,border:0,borderBottom:`${jt(i)} ${a} ${r}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${e}-item, ${e}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:l},[`> ${e}-item:hover, + */var x9e=Symbol.for("react.element"),v9e=Symbol.for("react.portal"),EZ=Symbol.for("react.fragment"),kZ=Symbol.for("react.strict_mode"),FZ=Symbol.for("react.profiler"),LZ=Symbol.for("react.provider"),WZ=Symbol.for("react.context"),cOt=Symbol.for("react.server_context"),NZ=Symbol.for("react.forward_ref"),UZ=Symbol.for("react.suspense"),jZ=Symbol.for("react.suspense_list"),BZ=Symbol.for("react.memo"),YZ=Symbol.for("react.lazy"),uOt=Symbol.for("react.offscreen"),zQe;zQe=Symbol.for("react.module.reference");function o2(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case x9e:switch(t=t.type,t){case EZ:case FZ:case kZ:case UZ:case jZ:return t;default:switch(t=t&&t.$$typeof,t){case cOt:case WZ:case NZ:case YZ:case BZ:case LZ:return t;default:return e}}case v9e:return e}}}Ts.ContextConsumer=WZ;Ts.ContextProvider=LZ;Ts.Element=x9e;Ts.ForwardRef=NZ;Ts.Fragment=EZ;Ts.Lazy=YZ;Ts.Memo=BZ;Ts.Portal=v9e;Ts.Profiler=FZ;Ts.StrictMode=kZ;Ts.Suspense=UZ;Ts.SuspenseList=jZ;Ts.isAsyncMode=function(){return!1};Ts.isConcurrentMode=function(){return!1};Ts.isContextConsumer=function(t){return o2(t)===WZ};Ts.isContextProvider=function(t){return o2(t)===LZ};Ts.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===x9e};Ts.isForwardRef=function(t){return o2(t)===NZ};Ts.isFragment=function(t){return o2(t)===EZ};Ts.isLazy=function(t){return o2(t)===YZ};Ts.isMemo=function(t){return o2(t)===BZ};Ts.isPortal=function(t){return o2(t)===v9e};Ts.isProfiler=function(t){return o2(t)===FZ};Ts.isStrictMode=function(t){return o2(t)===kZ};Ts.isSuspense=function(t){return o2(t)===UZ};Ts.isSuspenseList=function(t){return o2(t)===jZ};Ts.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===EZ||t===FZ||t===kZ||t===UZ||t===jZ||t===uOt||typeof t=="object"&&t!==null&&(t.$$typeof===YZ||t.$$typeof===BZ||t.$$typeof===LZ||t.$$typeof===WZ||t.$$typeof===NZ||t.$$typeof===zQe||t.getModuleId!==void 0)};Ts.typeOf=o2;IQe.exports=Ts;var _le=IQe.exports,dOt=Symbol.for("react.element"),fOt=Symbol.for("react.transitional.element"),hOt=Symbol.for("react.fragment");function pOt(t){return t&&Vr(t)==="object"&&(t.$$typeof===dOt||t.$$typeof===fOt)&&t.type===hOt}var gOt=function(e,n){typeof e=="function"?e(n):Vr(e)==="object"&&e&&"current"in e&&(e.current=n)},DQe=function(){for(var e=arguments.length,n=new Array(e),o=0;o1&&arguments[1]!==void 0?arguments[1]:1;aPe+=1;var o=aPe;function r(i){if(i===0)UQe(o),e();else{var a=WQe(function(){r(i-1)});b9e.set(o,a)}}return r(n),o};jQe.cancel=function(t){var e=b9e.get(t);return UQe(t),NQe(e)};var mOt=LQe.ESC,yOt=LQe.TAB;function AOt(t){var e=t.visible,n=t.triggerRef,o=t.onVisibleChange,r=t.autoFocus,i=t.overlayRef,a=g.useRef(!1),l=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),o==null||o(!1)}},s=function(){var d;return(d=i.current)!==null&&d!==void 0&&d.focus?(i.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case mOt:l();break;case yOt:{var f=!1;a.current||(f=s()),f?d.preventDefault():l();break}}};g.useEffect(function(){return e?(window.addEventListener("keydown",c),r&&jQe(s,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var wOt=g.forwardRef(function(t,e){var n=t.overlay,o=t.arrow,r=t.prefixCls,i=g.useMemo(function(){var l;return typeof n=="function"?l=n():l=n,l},[n]),a=DQe(e,FQe(i));return xe.createElement(xe.Fragment,null,o&&xe.createElement("div",{className:"".concat(r,"-arrow")}),xe.cloneElement(i,{ref:EQe(i)?a:void 0}))}),LP={adjustX:1,adjustY:1},WP=[0,0],xOt={topLeft:{points:["bl","tl"],overflow:LP,offset:[0,-4],targetOffset:WP},top:{points:["bc","tc"],overflow:LP,offset:[0,-4],targetOffset:WP},topRight:{points:["br","tr"],overflow:LP,offset:[0,-4],targetOffset:WP},bottomLeft:{points:["tl","bl"],overflow:LP,offset:[0,4],targetOffset:WP},bottom:{points:["tc","bc"],overflow:LP,offset:[0,4],targetOffset:WP},bottomRight:{points:["tr","br"],overflow:LP,offset:[0,4],targetOffset:WP}},vOt=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function bOt(t,e){var n,o=t.arrow,r=o===void 0?!1:o,i=t.prefixCls,a=i===void 0?"rc-dropdown":i,l=t.transitionName,s=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?xOt:f,m=t.getPopupContainer,y=t.showAction,w=t.hideAction,x=t.overlayClassName,C=t.overlayStyle,P=t.visible,A=t.trigger,S=A===void 0?["hover"]:A,v=t.autoFocus,b=t.overlay,T=t.children,R=t.onVisibleChange,M=Ai(t,vOt),D=xe.useState(),k=Sn(D,2),N=k[0],U=k[1],W="visible"in t?P:N,F=xe.useRef(null),E=xe.useRef(null),L=xe.useRef(null);xe.useImperativeHandle(e,function(){return F.current});var j=function(ae){U(ae),R==null||R(ae)};AOt({visible:W,triggerRef:L,onVisibleChange:j,autoFocus:v,overlayRef:E});var Y=function(ae){var Z=t.onOverlayClick;U(!1),Z&&Z(ae)},O=function(){return xe.createElement(wOt,{ref:E,overlay:b,prefixCls:a,arrow:r})},_=function(){return typeof b=="function"?O:O()},G=function(){var ae=t.minOverlayWidthMatchTrigger,Z=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?ae:!Z},Q=function(){var ae=t.openClassName;return ae!==void 0?ae:"".concat(a,"-open")},oe=xe.cloneElement(T,{className:Bn((n=T.props)===null||n===void 0?void 0:n.className,W&&Q()),ref:EQe(T)?DQe(L,FQe(T)):void 0}),ee=w;return!ee&&S.indexOf("contextMenu")!==-1&&(ee=["click"]),xe.createElement(eI,Uo({builtinPlacements:p},M,{prefixCls:a,ref:F,popupClassName:Bn(x,Ut({},"".concat(a,"-show-arrow"),r)),popupStyle:C,action:S,showAction:y,hideAction:ee,popupPlacement:d,popupAlign:c,popupTransitionName:l,popupAnimation:s,popupVisible:W,stretch:G()?"minWidth":"",popup:_(),onPopupVisibleChange:j,onPopupClick:Y,getPopupContainer:m}),oe)}const SOt=xe.forwardRef(bOt),TOt=t=>typeof t!="object"&&typeof t!="function"||t===null;var BQe=g.createContext(null);function YQe(t,e){return t===void 0?null:"".concat(t,"-").concat(e)}function OQe(t){var e=g.useContext(BQe);return YQe(e,t)}var POt=["children","locked"],E5=g.createContext(null);function COt(t,e){var n=nn({},t);return Object.keys(e).forEach(function(o){var r=e[o];r!==void 0&&(n[o]=r)}),n}function DL(t){var e=t.children,n=t.locked,o=Ai(t,POt),r=g.useContext(E5),i=k5e(function(){return COt(r,o)},[r,o],function(a,l){return!n&&(a[0]!==l[0]||!Vb(a[1],l[1],!0))});return g.createElement(E5.Provider,{value:i},e)}var ROt=[],_Qe=g.createContext(null);function OZ(){return g.useContext(_Qe)}var VQe=g.createContext(ROt);function nI(t){var e=g.useContext(VQe);return g.useMemo(function(){return t!==void 0?[].concat($o(e),[t]):e},[e,t])}var GQe=g.createContext(null),S9e=g.createContext({});function lPe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(tQe(t)){var n=t.nodeName.toLowerCase(),o=["input","select","textarea","button"].includes(n)||t.isContentEditable||n==="a"&&!!t.getAttribute("href"),r=t.getAttribute("tabindex"),i=Number(r),a=null;return r&&!Number.isNaN(i)?a=i:o&&a===null&&(a=0),o&&t.disabled&&(a=null),a!==null&&(a>=0||e&&a<0)}return!1}function HOt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=$o(t.querySelectorAll("*")).filter(function(o){return lPe(o,e)});return lPe(t,e)&&n.unshift(t),n}var xhe=Lo.LEFT,vhe=Lo.RIGHT,bhe=Lo.UP,gG=Lo.DOWN,mG=Lo.ENTER,XQe=Lo.ESC,QD=Lo.HOME,ZD=Lo.END,sPe=[bhe,gG,xhe,vhe];function MOt(t,e,n,o){var r,i="prev",a="next",l="children",s="parent";if(t==="inline"&&o===mG)return{inlineTrigger:!0};var c=Ut(Ut({},bhe,i),gG,a),u=Ut(Ut(Ut(Ut({},xhe,n?a:i),vhe,n?i:a),gG,l),mG,l),d=Ut(Ut(Ut(Ut(Ut(Ut({},bhe,i),gG,a),mG,l),XQe,s),xhe,n?l:s),vhe,n?s:l),f={inline:c,horizontal:u,vertical:d,inlineSub:c,horizontalSub:d,verticalSub:d},p=(r=f["".concat(t).concat(e?"":"Sub")])===null||r===void 0?void 0:r[o];switch(p){case i:return{offset:-1,sibling:!0};case a:return{offset:1,sibling:!0};case s:return{offset:-1,sibling:!1};case l:return{offset:1,sibling:!1};default:return null}}function IOt(t){for(var e=t;e;){if(e.getAttribute("data-menu-list"))return e;e=e.parentElement}return null}function zOt(t,e){for(var n=t||document.activeElement;n;){if(e.has(n))return n;n=n.parentElement}return null}function T9e(t,e){var n=HOt(t,!0);return n.filter(function(o){return e.has(o)})}function cPe(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!t)return null;var r=T9e(t,e),i=r.length,a=r.findIndex(function(l){return n===l});return o<0?a===-1?a=i-1:a-=1:o>0&&(a+=1),a=(a+i)%i,r[a]}var She=function(e,n){var o=new Set,r=new Map,i=new Map;return e.forEach(function(a){var l=document.querySelector("[data-menu-id='".concat(YQe(n,a),"']"));l&&(o.add(l),i.set(l,a),r.set(a,l))}),{elements:o,key2element:r,element2key:i}};function DOt(t,e,n,o,r,i,a,l,s,c){var u=g.useRef(),d=g.useRef();d.current=e;var f=function(){Ic.cancel(u.current)};return g.useEffect(function(){return function(){f()}},[]),function(p){var m=p.which;if([].concat(sPe,[mG,XQe,QD,ZD]).includes(m)){var y=i(),w=She(y,o),x=w,C=x.elements,P=x.key2element,A=x.element2key,S=P.get(e),v=zOt(S,C),b=A.get(v),T=MOt(t,a(b,!0).length===1,n,m);if(!T&&m!==QD&&m!==ZD)return;(sPe.includes(m)||[QD,ZD].includes(m))&&p.preventDefault();var R=function(E){if(E){var L=E,j=E.querySelector("a");j!=null&&j.getAttribute("href")&&(L=j);var Y=A.get(E);l(Y),f(),u.current=Ic(function(){d.current===Y&&L.focus()})}};if([QD,ZD].includes(m)||T.sibling||!v){var M;!v||t==="inline"?M=r.current:M=IOt(v);var D,k=T9e(M,C);m===QD?D=k[0]:m===ZD?D=k[k.length-1]:D=cPe(M,C,v,T.offset),R(D)}else if(T.inlineTrigger)s(b);else if(T.offset>0)s(b,!0),f(),u.current=Ic(function(){w=She(y,o);var F=v.getAttribute("aria-controls"),E=document.getElementById(F),L=cPe(E,w.elements);R(L)},5);else if(T.offset<0){var N=a(b,!0),U=N[N.length-2],W=P.get(U);s(U,!1),R(W)}}c==null||c(p)}}function EOt(t){Promise.resolve().then(t)}var P9e="__RC_UTIL_PATH_SPLIT__",uPe=function(e){return e.join(P9e)},kOt=function(e){return e.split(P9e)},The="rc-menu-more";function FOt(){var t=g.useState({}),e=Sn(t,2),n=e[1],o=g.useRef(new Map),r=g.useRef(new Map),i=g.useState([]),a=Sn(i,2),l=a[0],s=a[1],c=g.useRef(0),u=g.useRef(!1),d=function(){u.current||n({})},f=g.useCallback(function(P,A){var S=uPe(A);r.current.set(S,P),o.current.set(P,S),c.current+=1;var v=c.current;EOt(function(){v===c.current&&d()})},[]),p=g.useCallback(function(P,A){var S=uPe(A);r.current.delete(S),o.current.delete(P)},[]),m=g.useCallback(function(P){s(P)},[]),y=g.useCallback(function(P,A){var S=o.current.get(P)||"",v=kOt(S);return A&&l.includes(v[0])&&v.unshift(The),v},[l]),w=g.useCallback(function(P,A){return P.filter(function(S){return S!==void 0}).some(function(S){var v=y(S,!0);return v.includes(A)})},[y]),x=function(){var A=$o(o.current.keys());return l.length&&A.push(The),A},C=g.useCallback(function(P){var A="".concat(o.current.get(P)).concat(P9e),S=new Set;return $o(r.current.keys()).forEach(function(v){v.startsWith(A)&&S.add(r.current.get(v))}),S},[]);return g.useEffect(function(){return function(){u.current=!0}},[]),{registerPath:f,unregisterPath:p,refreshOverflowKeys:m,isSubPathKey:w,getKeyPath:y,getKeys:x,getSubPathKeys:C}}function KE(t){var e=g.useRef(t);e.current=t;var n=g.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a1&&(C.motionAppear=!1);var P=C.onVisibleChanged;return C.onVisibleChanged=function(A){return!f.current&&!A&&w(!0),P==null?void 0:P(A)},y?null:g.createElement(DL,{mode:i,locked:!f.current},g.createElement(Oy,Uo({visible:x},C,{forceRender:s,removeOnLeave:!1,leavedClassName:"".concat(l,"-hidden")}),function(A){var S=A.className,v=A.style;return g.createElement(C9e,{id:e,className:S,style:v},r)}))}var QOt=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],ZOt=["active"],e_t=g.forwardRef(function(t,e){var n=t.style,o=t.className,r=t.title,i=t.eventKey;t.warnKey;var a=t.disabled,l=t.internalPopupClose,s=t.children,c=t.itemIcon,u=t.expandIcon,d=t.popupClassName,f=t.popupOffset,p=t.popupStyle,m=t.onClick,y=t.onMouseEnter,w=t.onMouseLeave,x=t.onTitleClick,C=t.onTitleMouseEnter,P=t.onTitleMouseLeave,A=Ai(t,QOt),S=OQe(i),v=g.useContext(E5),b=v.prefixCls,T=v.mode,R=v.openKeys,M=v.disabled,D=v.overflowDisabled,k=v.activeKey,N=v.selectedKeys,U=v.itemIcon,W=v.expandIcon,F=v.onItemClick,E=v.onOpenChange,L=v.onActive,j=g.useContext(S9e),Y=j._internalRenderSubMenuItem,O=g.useContext(GQe),_=O.isSubPathKey,G=nI(),Q="".concat(b,"-submenu"),oe=M||a,ee=g.useRef(),$=g.useRef(),ae=c??U,Z=u??W,ne=R.includes(i),te=!D&&ne,q=_(N,i),le=JQe(i,oe,C,P),de=le.active,he=Ai(le,ZOt),me=g.useState(!1),ce=Sn(me,2),Pe=ce[0],pe=ce[1],Ie=function(qe){oe||pe(qe)},ve=function(qe){Ie(!0),y==null||y({key:i,domEvent:qe})},ze=function(qe){Ie(!1),w==null||w({key:i,domEvent:qe})},Ae=g.useMemo(function(){return de||(T!=="inline"?Pe||_([k],i):!1)},[T,de,k,Pe,i,_]),se=KQe(G.length),ge=function(qe){oe||(x==null||x({key:i,domEvent:qe}),T==="inline"&&E(i,!ne))},we=KE(function(Ue){m==null||m(lJ(Ue)),F(Ue)}),Se=function(qe){T!=="inline"&&E(i,qe)},Me=function(){L(i)},Ce=S&&"".concat(S,"-popup"),Te=g.createElement("div",Uo({role:"menuitem",style:se,className:"".concat(Q,"-title"),tabIndex:oe?null:-1,ref:ee,title:typeof r=="string"?r:null,"data-menu-id":D&&S?null:S,"aria-expanded":te,"aria-haspopup":!0,"aria-controls":Ce,"aria-disabled":oe,onClick:ge,onFocus:Me},he),r,g.createElement($Qe,{icon:T!=="horizontal"?Z:void 0,props:nn(nn({},t),{},{isOpen:te,isSubMenu:!0})},g.createElement("i",{className:"".concat(Q,"-arrow")}))),Re=g.useRef(T);if(T!=="inline"&&G.length>1?Re.current="vertical":Re.current=T,!D){var Ne=Re.current;Te=g.createElement($Ot,{mode:Ne,prefixCls:Q,visible:!l&&te&&T!=="inline",popupClassName:d,popupOffset:f,popupStyle:p,popup:g.createElement(DL,{mode:Ne==="horizontal"?"vertical":Ne},g.createElement(C9e,{id:Ce,ref:$},s)),disabled:oe,onVisibleChange:Se},Te)}var _e=g.createElement(S5.Item,Uo({ref:e,role:"none"},A,{component:"li",style:n,className:Bn(Q,"".concat(Q,"-").concat(T),o,Ut(Ut(Ut(Ut({},"".concat(Q,"-open"),te),"".concat(Q,"-active"),Ae),"".concat(Q,"-selected"),q),"".concat(Q,"-disabled"),oe)),onMouseEnter:ve,onMouseLeave:ze}),Te,!D&&g.createElement(qOt,{id:Ce,open:te,keyPath:G},s));return Y&&(_e=Y(_e,t,{selected:q,active:Ae,open:te,disabled:oe})),g.createElement(DL,{onItemClick:we,mode:T==="horizontal"?"vertical":T,itemIcon:ae,expandIcon:Z},_e)}),_Z=g.forwardRef(function(t,e){var n=t.eventKey,o=t.children,r=nI(n),i=R9e(o,r),a=OZ();g.useEffect(function(){if(a)return a.registerPath(n,r),function(){a.unregisterPath(n,r)}},[r]);var l;return a?l=i:l=g.createElement(e_t,Uo({ref:e},t),i),g.createElement(VQe.Provider,{value:r},l)});function H9e(t){var e=t.className,n=t.style,o=g.useContext(E5),r=o.prefixCls,i=OZ();return i?null:g.createElement("li",{role:"separator",className:Bn("".concat(r,"-item-divider"),e),style:n})}var t_t=["className","title","eventKey","children"],n_t=g.forwardRef(function(t,e){var n=t.className,o=t.title;t.eventKey;var r=t.children,i=Ai(t,t_t),a=g.useContext(E5),l=a.prefixCls,s="".concat(l,"-item-group");return g.createElement("li",Uo({ref:e,role:"presentation"},i,{onClick:function(u){return u.stopPropagation()},className:Bn(s,n)}),g.createElement("div",{role:"presentation",className:"".concat(s,"-title"),title:typeof o=="string"?o:void 0},o),g.createElement("ul",{role:"group",className:"".concat(s,"-list")},r))}),M9e=g.forwardRef(function(t,e){var n=t.eventKey,o=t.children,r=nI(n),i=R9e(o,r),a=OZ();return a?i:g.createElement(n_t,Uo({ref:e},tI(t,["warnKey"])),i)}),o_t=["label","children","key","type","extra"];function Phe(t,e,n){var o=e.item,r=e.group,i=e.submenu,a=e.divider;return(t||[]).map(function(l,s){if(l&&Vr(l)==="object"){var c=l,u=c.label,d=c.children,f=c.key,p=c.type,m=c.extra,y=Ai(c,o_t),w=f??"tmp-".concat(s);return d||p==="group"?p==="group"?g.createElement(r,Uo({key:w},y,{title:u}),Phe(d,e,n)):g.createElement(i,Uo({key:w},y,{title:u}),Phe(d,e,n)):p==="divider"?g.createElement(a,Uo({key:w},y)):g.createElement(o,Uo({key:w},y,{extra:m}),u,(!!m||m===0)&&g.createElement("span",{className:"".concat(n,"-item-extra")},m))}return null}).filter(function(l){return l})}function fPe(t,e,n,o,r){var i=t,a=nn({divider:H9e,item:yU,group:M9e,submenu:_Z},o);return e&&(i=Phe(e,a,r)),R9e(i,n)}var r_t=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],_x=[],i_t=g.forwardRef(function(t,e){var n,o=t,r=o.prefixCls,i=r===void 0?"rc-menu":r,a=o.rootClassName,l=o.style,s=o.className,c=o.tabIndex,u=c===void 0?0:c,d=o.items,f=o.children,p=o.direction,m=o.id,y=o.mode,w=y===void 0?"vertical":y,x=o.inlineCollapsed,C=o.disabled,P=o.disabledOverflow,A=o.subMenuOpenDelay,S=A===void 0?.1:A,v=o.subMenuCloseDelay,b=v===void 0?.1:v,T=o.forceSubMenuRender,R=o.defaultOpenKeys,M=o.openKeys,D=o.activeKey,k=o.defaultActiveFirst,N=o.selectable,U=N===void 0?!0:N,W=o.multiple,F=W===void 0?!1:W,E=o.defaultSelectedKeys,L=o.selectedKeys,j=o.onSelect,Y=o.onDeselect,O=o.inlineIndent,_=O===void 0?24:O,G=o.motion,Q=o.defaultMotions,oe=o.triggerSubMenuAction,ee=oe===void 0?"hover":oe,$=o.builtinPlacements,ae=o.itemIcon,Z=o.expandIcon,ne=o.overflowedIndicator,te=ne===void 0?"...":ne,q=o.overflowedIndicatorPopupClassName,le=o.getPopupContainer,de=o.onClick,he=o.onOpenChange,me=o.onKeyDown;o.openAnimation,o.openTransitionName;var ce=o._internalRenderMenuItem,Pe=o._internalRenderSubMenuItem,pe=o._internalComponents,Ie=Ai(o,r_t),ve=g.useMemo(function(){return[fPe(f,d,_x,pe,i),fPe(f,d,_x,{},i)]},[f,d,pe]),ze=Sn(ve,2),Ae=ze[0],se=ze[1],ge=g.useState(!1),we=Sn(ge,2),Se=we[0],Me=we[1],Ce=g.useRef(),Te=WOt(m),Re=p==="rtl",Ne=o0(R,{value:M,postState:function(xo){return xo||_x}}),_e=Sn(Ne,2),Ue=_e[0],qe=_e[1],Fe=function(xo){var wo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Rr(){qe(xo),he==null||he(xo)}wo?r0.flushSync(Rr):Rr()},He=g.useState(Ue),Le=Sn(He,2),Ye=Le[0],lt=Le[1],Oe=g.useRef(!1),ut=g.useMemo(function(){return(w==="inline"||w==="vertical")&&x?["vertical",x]:[w,!1]},[w,x]),ht=Sn(ut,2),Qe=ht[0],nt=ht[1],mt=Qe==="inline",tt=g.useState(Qe),gt=Sn(tt,2),Ve=gt[0],je=gt[1],et=g.useState(nt),bt=Sn(et,2),St=bt[0],Pt=bt[1];g.useEffect(function(){je(Qe),Pt(nt),Oe.current&&(mt?qe(Ye):Fe(_x))},[Qe,nt]);var Yt=g.useState(0),zt=Sn(Yt,2),Rt=zt[0],Ct=zt[1],yt=Rt>=Ae.length-1||Ve!=="horizontal"||P;g.useEffect(function(){mt&<(Ue)},[Ue]),g.useEffect(function(){return Oe.current=!0,function(){Oe.current=!1}},[]);var at=FOt(),Et=at.registerPath,Lt=at.unregisterPath,Je=at.refreshOverflowKeys,st=at.isSubPathKey,It=at.getKeyPath,ot=at.getKeys,it=at.getSubPathKeys,Be=g.useMemo(function(){return{registerPath:Et,unregisterPath:Lt}},[Et,Lt]),pt=g.useMemo(function(){return{isSubPathKey:st}},[st]);g.useEffect(function(){Je(yt?_x:Ae.slice(Rt+1).map(function(lr){return lr.key}))},[Rt,yt]);var ct=o0(D||k&&((n=Ae[0])===null||n===void 0?void 0:n.key),{value:D}),Xe=Sn(ct,2),ft=Xe[0],wt=Xe[1],kt=KE(function(lr){wt(lr)}),Zt=KE(function(){wt(void 0)});g.useImperativeHandle(e,function(){return{list:Ce.current,focus:function(xo){var wo,Rr=ot(),Eo=She(Rr,Te),An=Eo.elements,Dn=Eo.key2element,sr=Eo.element2key,Vo=T9e(Ce.current,An),Wo=ft??(Vo[0]?sr.get(Vo[0]):(wo=Ae.find(function(No){return!No.props.disabled}))===null||wo===void 0?void 0:wo.key),To=Dn.get(Wo);if(Wo&&To){var Go;To==null||(Go=To.focus)===null||Go===void 0||Go.call(To,xo)}}}});var Ot=o0(E||[],{value:L,postState:function(xo){return Array.isArray(xo)?xo:xo==null?_x:[xo]}}),on=Sn(Ot,2),qt=on[0],rn=on[1],Pn=function(xo){if(U){var wo=xo.key,Rr=qt.includes(wo),Eo;F?Rr?Eo=qt.filter(function(Dn){return Dn!==wo}):Eo=[].concat($o(qt),[wo]):Eo=[wo],rn(Eo);var An=nn(nn({},xo),{},{selectedKeys:Eo});Rr?Y==null||Y(An):j==null||j(An)}!F&&Ue.length&&Ve!=="inline"&&Fe(_x)},fo=KE(function(lr){de==null||de(lJ(lr)),Pn(lr)}),to=KE(function(lr,xo){var wo=Ue.filter(function(Eo){return Eo!==lr});if(xo)wo.push(lr);else if(Ve!=="inline"){var Rr=it(lr);wo=wo.filter(function(Eo){return!Rr.has(Eo)})}Vb(Ue,wo,!0)||Fe(wo,!0)}),Dt=function(xo,wo){var Rr=wo??!Ue.includes(xo);to(xo,Rr)},fn=DOt(Ve,ft,Re,Te,Ce,ot,It,wt,Dt,me);g.useEffect(function(){Me(!0)},[]);var kn=g.useMemo(function(){return{_internalRenderMenuItem:ce,_internalRenderSubMenuItem:Pe}},[ce,Pe]),yo=Ve!=="horizontal"||P?Ae:Ae.map(function(lr,xo){return g.createElement(DL,{key:lr.key,overflowDisabled:xo>Rt},lr)}),ur=g.createElement(S5,Uo({id:m,ref:Ce,prefixCls:"".concat(i,"-overflow"),component:"ul",itemComponent:yU,className:Bn(i,"".concat(i,"-root"),"".concat(i,"-").concat(Ve),s,Ut(Ut({},"".concat(i,"-inline-collapsed"),St),"".concat(i,"-rtl"),Re),a),dir:p,style:l,role:"menu",tabIndex:u,data:yo,renderRawItem:function(xo){return xo},renderRawRest:function(xo){var wo=xo.length,Rr=wo?Ae.slice(-wo):null;return g.createElement(_Z,{eventKey:The,title:te,disabled:yt,internalPopupClose:wo===0,popupClassName:q},Rr)},maxCount:Ve!=="horizontal"||P?S5.INVALIDATE:S5.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(xo){Ct(xo)},onKeyDown:fn},Ie));return g.createElement(S9e.Provider,{value:kn},g.createElement(BQe.Provider,{value:Te},g.createElement(DL,{prefixCls:i,rootClassName:a,mode:Ve,openKeys:Ue,rtl:Re,disabled:C,motion:Se?G:null,defaultMotions:Se?Q:null,activeKey:ft,onActive:kt,onInactive:Zt,selectedKeys:qt,inlineIndent:_,subMenuOpenDelay:S,subMenuCloseDelay:b,forceSubMenuRender:T,builtinPlacements:$,triggerSubMenuAction:ee,getPopupContainer:le,itemIcon:ae,expandIcon:Z,onItemClick:fo,onOpenChange:to},g.createElement(GQe.Provider,{value:pt},ur),g.createElement("div",{style:{display:"none"},"aria-hidden":!0},g.createElement(_Qe.Provider,{value:Be},se)))))}),oI=i_t;oI.Item=yU;oI.SubMenu=_Z;oI.ItemGroup=M9e;oI.Divider=H9e;var a_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},l_t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:a_t}))},I9e=g.forwardRef(l_t),s_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},c_t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:s_t}))},sJ=g.forwardRef(c_t);const QQe=g.createContext({});var u_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},d_t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:u_t}))},z9e=g.forwardRef(d_t);const cJ=g.createContext({prefixCls:"",firstLevel:!0,inlineCollapsed:!1});var f_t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,className:n,dashed:o}=t,r=f_t(t,["prefixCls","className","dashed"]),{getPrefixCls:i}=g.useContext(gr),a=i("menu",e),l=Mn({[`${a}-item-divider-dashed`]:!!o},n);return g.createElement(H9e,Object.assign({className:l},r))},eZe=t=>{var e;const{className:n,children:o,icon:r,title:i,danger:a,extra:l}=t,{prefixCls:s,firstLevel:c,direction:u,disableMenuItemTitleTooltip:d,inlineCollapsed:f}=g.useContext(cJ),p=P=>{const A=o==null?void 0:o[0],S=g.createElement("span",{className:Mn(`${s}-title-content`,{[`${s}-title-content-with-extra`]:!!l||l===0})},o);return(!r||g.isValidElement(o)&&o.type==="span")&&o&&P&&c&&typeof A=="string"?g.createElement("div",{className:`${s}-inline-collapsed-noicon`},A.charAt(0)):S},{siderCollapsed:m}=g.useContext(QQe);let y=i;typeof i>"u"?y=c?o:"":i===!1&&(y="");const w={title:y};!m&&!f&&(w.title=null,w.open=!1);const x=jy(o).length;let C=g.createElement(yU,Object.assign({},Mf(t,["title","icon","danger"]),{className:Mn({[`${s}-item-danger`]:a,[`${s}-item-only-child`]:(r?x+1:x)===1},n),title:typeof i=="string"?i:void 0}),P0(r,{className:Mn(g.isValidElement(r)?(e=r.props)===null||e===void 0?void 0:e.className:"",`${s}-item-icon`)}),p(f));return d||(C=g.createElement(k3,Object.assign({},w,{placement:u==="rtl"?"left":"right",classNames:{root:`${s}-inline-collapsed-tooltip`}}),C)),C};var h_t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{children:n}=t,o=h_t(t,["children"]),r=g.useContext(uJ),i=g.useMemo(()=>Object.assign(Object.assign({},r),o),[r,o.prefixCls,o.mode,o.selectable,o.rootClassName]),a=YHt(n),l=I5e(e,a?OQ(n):null);return g.createElement(uJ.Provider,{value:i},g.createElement(E3,{space:!0},a?g.cloneElement(n,{ref:l}):n))}),p_t=t=>{const{componentCls:e,motionDurationSlow:n,horizontalLineHeight:o,colorSplit:r,lineWidth:i,lineType:a,itemPaddingInline:l}=t;return{[`${e}-horizontal`]:{lineHeight:o,border:0,borderBottom:`${jt(i)} ${a} ${r}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${e}-item, ${e}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:l},[`> ${e}-item:hover, > ${e}-item-active, > ${e}-submenu ${e}-submenu-title:hover`]:{backgroundColor:"transparent"},[`${e}-item, ${e}-submenu-title`]:{transition:[`border-color ${n}`,`background ${n}`].join(",")},[`${e}-submenu-arrow`]:{display:"none"}}}},g_t=t=>{let{componentCls:e,menuArrowOffset:n,calc:o}=t;return{[`${e}-rtl`]:{direction:"rtl"},[`${e}-submenu-rtl`]:{transformOrigin:"100% 0"},[`${e}-rtl${e}-vertical, ${e}-submenu-rtl ${e}-vertical`]:{[`${e}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateY(${jt(o(n).mul(-1).equal())})`},"&::after":{transform:`rotate(45deg) translateY(${jt(n)})`}}}}},hPe=t=>Object.assign({},z3(t)),pPe=(t,e)=>{const{componentCls:n,itemColor:o,itemSelectedColor:r,subMenuItemSelectedColor:i,groupTitleColor:a,itemBg:l,subMenuItemBg:s,itemSelectedBg:c,activeBarHeight:u,activeBarWidth:d,activeBarBorderWidth:f,motionDurationSlow:p,motionEaseInOut:m,motionEaseOut:y,itemPaddingInline:w,motionDurationMid:x,itemHoverColor:C,lineType:P,colorSplit:A,itemDisabledColor:S,dangerItemColor:v,dangerItemHoverColor:b,dangerItemSelectedColor:T,dangerItemActiveBg:R,dangerItemSelectedBg:M,popupBg:D,itemHoverBg:k,itemActiveBg:N,menuSubMenuBg:U,horizontalItemSelectedColor:W,horizontalItemSelectedBg:F,horizontalItemBorderRadius:E,horizontalItemHoverBg:L}=t;return{[`${n}-${e}, ${n}-${e} > ${n}`]:{color:o,background:l,[`&${n}-root:focus-visible`]:Object.assign({},hPe(t)),[`${n}-item`]:{"&-group-title, &-extra":{color:a}},[`${n}-submenu-selected > ${n}-submenu-title`]:{color:i},[`${n}-item, ${n}-submenu-title`]:{color:o,[`&:not(${n}-item-disabled):focus-visible`]:Object.assign({},hPe(t))},[`${n}-item-disabled, ${n}-submenu-disabled`]:{color:`${S} !important`},[`${n}-item:not(${n}-item-selected):not(${n}-submenu-selected)`]:{[`&:hover, > ${n}-submenu-title:hover`]:{color:C}},[`&:not(${n}-horizontal)`]:{[`${n}-item:not(${n}-item-selected)`]:{"&:hover":{backgroundColor:k},"&:active":{backgroundColor:N}},[`${n}-submenu-title`]:{"&:hover":{backgroundColor:k},"&:active":{backgroundColor:N}}},[`${n}-item-danger`]:{color:v,[`&${n}-item:hover`]:{[`&:not(${n}-item-selected):not(${n}-submenu-selected)`]:{color:b}},[`&${n}-item:active`]:{background:R}},[`${n}-item a`]:{"&, &:hover":{color:"inherit"}},[`${n}-item-selected`]:{color:r,[`&${n}-item-danger`]:{color:T},"a, a:hover":{color:"inherit"}},[`& ${n}-item-selected`]:{backgroundColor:c,[`&${n}-item-danger`]:{backgroundColor:M}},[`&${n}-submenu > ${n}`]:{backgroundColor:U},[`&${n}-popup > ${n}`]:{backgroundColor:D},[`&${n}-submenu-popup > ${n}`]:{backgroundColor:D},[`&${n}-horizontal`]:Object.assign(Object.assign({},e==="dark"?{borderBottom:0}:{}),{[`> ${n}-item, > ${n}-submenu`]:{top:f,marginTop:t.calc(f).mul(-1).equal(),marginBottom:0,borderRadius:E,"&::after":{position:"absolute",insetInline:w,bottom:0,borderBottom:`${jt(u)} solid transparent`,transition:`border-color ${p} ${m}`,content:'""'},"&:hover, &-active, &-open":{background:L,"&::after":{borderBottomWidth:u,borderBottomColor:W}},"&-selected":{color:W,backgroundColor:F,"&:hover":{backgroundColor:F},"&::after":{borderBottomWidth:u,borderBottomColor:W}}}}),[`&${n}-root`]:{[`&${n}-inline, &${n}-vertical`]:{borderInlineEnd:`${jt(f)} ${P} ${A}`}},[`&${n}-inline`]:{[`${n}-sub${n}-inline`]:{background:s},[`${n}-item`]:{position:"relative","&::after":{position:"absolute",insetBlock:0,insetInlineEnd:0,borderInlineEnd:`${jt(d)} solid ${r}`,transform:"scaleY(0.0001)",opacity:0,transition:[`transform ${x} ${y}`,`opacity ${x} ${y}`].join(","),content:'""'},[`&${n}-item-danger`]:{"&::after":{borderInlineEndColor:T}}},[`${n}-selected, ${n}-item-selected`]:{"&::after":{transform:"scaleY(1)",opacity:1,transition:[`transform ${x} ${m}`,`opacity ${x} ${m}`].join(",")}}}}}},gPe=t=>{const{componentCls:e,itemHeight:n,itemMarginInline:o,padding:r,menuArrowSize:i,marginXS:a,itemMarginBlock:l,itemWidth:s,itemPaddingInline:c}=t,u=t.calc(i).add(r).add(a).equal();return{[`${e}-item`]:{position:"relative",overflow:"hidden"},[`${e}-item, ${e}-submenu-title`]:{height:n,lineHeight:jt(n),paddingInline:c,overflow:"hidden",textOverflow:"ellipsis",marginInline:o,marginBlock:l,width:s},[`> ${e}-item, @@ -4587,7 +4587,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho &${a}-slide-down-leave${a}-slide-down-leave-active${e}-placement-bottom, &${a}-slide-down-leave${a}-slide-down-leave-active${e}-placement-bottomRight`]:{animationName:mZ},[`&${a}-slide-up-leave${a}-slide-up-leave-active${e}-placement-topLeft, &${a}-slide-up-leave${a}-slide-up-leave-active${e}-placement-top, - &${a}-slide-up-leave${a}-slide-up-leave-active${e}-placement-topRight`]:{animationName:AZ}}},w9e(t,y,{arrowPlacement:{top:!0,bottom:!0}}),{[`${e} ${n}`]:{position:"relative",margin:0},[`${n}-submenu-popup`]:{position:"absolute",zIndex:o,background:"transparent",boxShadow:"none",transformOrigin:"0 0","ul, li":{listStyle:"none",margin:0}},[`${e}, ${e}-menu-submenu`]:Object.assign(Object.assign({},Ua(t)),{[n]:Object.assign(Object.assign({padding:d,listStyleType:"none",backgroundColor:y,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary},Yy(t)),{"&:empty":{padding:0,boxShadow:"none"},[`${n}-item-group-title`]:{padding:`${jt(c)} ${jt(m)}`,color:t.colorTextDescription,transition:`all ${s}`},[`${n}-item`]:{position:"relative",display:"flex",alignItems:"center"},[`${n}-item-icon`]:{minWidth:u,marginInlineEnd:t.marginXS,fontSize:t.fontSizeSM},[`${n}-title-content`]:{flex:"auto","&-with-extra":{display:"inline-flex",alignItems:"center",width:"100%"},"> a":{color:"inherit",transition:`all ${s}`,"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}},[`${n}-item-extra`]:{paddingInlineStart:t.padding,marginInlineStart:"auto",fontSize:t.fontSizeSM,color:t.colorTextDescription}},[`${n}-item, ${n}-submenu-title`]:Object.assign(Object.assign({display:"flex",margin:0,padding:`${jt(c)} ${jt(m)}`,color:t.colorText,fontWeight:"normal",fontSize:u,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${s}`,borderRadius:t.borderRadiusSM,"&:hover, &-active":{backgroundColor:t.controlItemBgHover}},Yy(t)),{"&-selected":{color:t.colorPrimary,backgroundColor:t.controlItemBgActive,"&:hover, &-active":{backgroundColor:t.controlItemBgActiveHover}},"&-disabled":{color:f,cursor:"not-allowed","&:hover":{color:f,backgroundColor:y,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:`${jt(t.marginXXS)} 0`,overflow:"hidden",lineHeight:0,backgroundColor:t.colorSplit},[`${e}-menu-submenu-expand-icon`]:{position:"absolute",insetInlineEnd:t.paddingXS,[`${e}-menu-submenu-arrow-icon`]:{marginInlineEnd:"0 !important",color:t.colorTextDescription,fontSize:p,fontStyle:"normal"}}}),[`${n}-item-group-list`]:{margin:`0 ${jt(t.marginXS)}`,padding:0,listStyle:"none"},[`${n}-submenu-title`]:{paddingInlineEnd:t.calc(m).add(t.fontSizeSM).equal()},[`${n}-submenu-vertical`]:{position:"relative"},[`${n}-submenu${n}-submenu-disabled ${e}-menu-submenu-title`]:{[`&, ${e}-menu-submenu-arrow-icon`]:{color:f,backgroundColor:y,cursor:"not-allowed"}},[`${n}-submenu-selected ${e}-menu-submenu-title`]:{color:t.colorPrimary}})})},[D3(t,"slide-up"),D3(t,"slide-down"),vH(t,"move-up"),vH(t,"move-down"),QM(t,"zoom-big")]]},P_t=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+50,paddingBlock:(t.controlHeight-t.fontSize*t.lineHeight)/2},zZ({contentRadius:t.borderRadiusLG,limitVerticalRadius:!0})),IZ(t)),C_t=el("Dropdown",t=>{const{marginXXS:e,sizePopupArrow:n,paddingXXS:o,componentCls:r}=t,i=Ui(t,{menuCls:`${r}-menu`,dropdownArrowDistance:t.calc(n).div(2).add(e).equal(),dropdownEdgeChildPadding:o});return[T_t(i),S_t(i)]},P_t,{resetStyle:!1}),VZ=t=>{var e;const{menu:n,arrow:o,prefixCls:r,children:i,trigger:a,disabled:l,dropdownRender:s,getPopupContainer:c,overlayClassName:u,rootClassName:d,overlayStyle:f,open:p,onOpenChange:m,visible:y,onVisibleChange:w,mouseEnterDelay:x=.15,mouseLeaveDelay:C=.1,autoAdjustOverflow:P=!0,placement:A="",overlay:S,transitionName:v}=t,{getPopupContainer:b,getPrefixCls:T,direction:R,dropdown:M}=g.useContext(gr);LS();const D=g.useMemo(()=>{const le=T();return v!==void 0?v:A.includes("top")?`${le}-slide-down`:`${le}-slide-up`},[T,A,v]),k=g.useMemo(()=>A?A.includes("Center")?A.slice(0,A.indexOf("Center")):A:R==="rtl"?"bottomRight":"bottomLeft",[A,R]),N=T("dropdown",r),U=nu(N),[W,F,E]=C_t(N,U),[,L]=Ff(),j=g.Children.only(TOt(i)?g.createElement("span",null,i):i),Y=P0(j,{className:Mn(`${N}-trigger`,{[`${N}-rtl`]:R==="rtl"},j.props.className),disabled:(e=j.props.disabled)!==null&&e!==void 0?e:l}),O=l?[]:a,_=!!(O!=null&&O.includes("contextMenu")),[G,Q]=qA(!1,{value:p??y}),oe=kd(le=>{m==null||m(le,{source:"trigger"}),w==null||w(le),Q(le)}),ee=Mn(u,d,F,E,U,M==null?void 0:M.className,{[`${N}-rtl`]:R==="rtl"}),q=vQe({arrowPointAtCenter:typeof o=="object"&&o.pointAtCenter,autoAdjustOverflow:P,offset:L.marginXXS,arrowWidth:o?L.sizePopupArrow:0,borderRadius:L.borderRadius}),ae=g.useCallback(()=>{n!=null&&n.selectable&&(n!=null&&n.multiple)||(m==null||m(!1,{source:"menu"}),Q(!1))},[n==null?void 0:n.selectable,n==null?void 0:n.multiple]),Z=()=>{let le;return n!=null&&n.items?le=g.createElement(rI,Object.assign({},n)):typeof S=="function"?le=S():le=S,s&&(le=s(le)),le=g.Children.only(typeof le=="string"?g.createElement("span",null,le):le),g.createElement(tZe,{prefixCls:`${N}-menu`,rootClassName:Mn(E,U),expandIcon:g.createElement("span",{className:`${N}-menu-submenu-arrow`},g.createElement(xH,{className:`${N}-menu-submenu-arrow-icon`})),mode:"vertical",selectable:!1,onClick:ae,validator:de=>{let{mode:he}=de}},le)},[ne,te]=a6("Dropdown",f==null?void 0:f.zIndex);let $=g.createElement(SOt,Object.assign({alignPoint:_},Mf(t,["rootClassName"]),{mouseEnterDelay:x,mouseLeaveDelay:C,visible:G,builtinPlacements:q,arrow:!!o,overlayClassName:ee,prefixCls:N,getPopupContainer:c||b,transitionName:D,trigger:O,overlay:Z,placement:k,onVisibleChange:oe,overlayStyle:Object.assign(Object.assign(Object.assign({},M==null?void 0:M.style),f),{zIndex:ne})}),Y);return ne&&($=g.createElement(iU.Provider,{value:te},$)),W($)},R_t=gU(VZ,"align",void 0,"dropdown",t=>t),H_t=t=>g.createElement(R_t,Object.assign({},t),g.createElement("span",null));VZ._InternalPanelDoNotUseOrYouWillBeFired=H_t;var oZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){return function(n,o){o.prototype.weekday=function(r){var i=this.$locale().weekStart||0,a=this.$W,l=(a25){var u=a(this).startOf(o).add(1,o).date(c),d=a(this).endOf(n);if(u.isBefore(d))return 1}var f=a(this).startOf(o).date(c).startOf(n).subtract(1,"millisecond"),p=this.diff(f,n,!0);return p<0?a(this).startOf("week").week():Math.ceil(p)},l.weeks=function(s){return s===void 0&&(s=null),this.week(s)}}})})(iZe);var E_t=iZe.exports;const k_t=ji(E_t);var aZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){return function(n,o){o.prototype.weekYear=function(){var r=this.month(),i=this.week(),a=this.year();return i===1&&r===11?a+1:r===0&&i>=52?a-1:a}}})})(aZe);var F_t=aZe.exports;const L_t=ji(F_t);var lZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){return function(n,o){var r=o.prototype,i=r.format;r.format=function(a){var l=this,s=this.$locale();if(!this.isValid())return i.bind(this)(a);var c=this.$utils(),u=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(d){switch(d){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return s.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return s.ordinal(l.week(),"W");case"w":case"ww":return c.s(l.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(l.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(l.$H===0?24:l.$H),d==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return d}});return i.bind(this)(u)}}})})(lZe);var W_t=lZe.exports;const N_t=ji(W_t);var sZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},o=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},s=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(w){this[y]=+w}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(w){if(!w||w==="Z")return 0;var x=w.match(/([+-]|\d\d)/g),C=60*x[1]+(+x[2]||0);return C===0?0:x[0]==="+"?-C:C}(y)}],d=function(y){var w=l[y];return w&&(w.indexOf?w:w.s.concat(w.f))},f=function(y,w){var x,C=l.meridiem;if(C){for(var P=1;P<=24;P+=1)if(y.indexOf(C(P,0,w))>-1){x=P>12;break}}else x=y===(w?"pm":"PM");return x},p={A:[a,function(y){this.afternoon=f(y,!1)}],a:[a,function(y){this.afternoon=f(y,!0)}],S:[/\d/,function(y){this.milliseconds=100*+y}],SS:[r,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[r,c("day")],Do:[a,function(y){var w=l.ordinal,x=y.match(/\d+/);if(this.day=x[0],w)for(var C=1;C<=31;C+=1)w(C).replace(/\[|\]/g,"")===y&&(this.day=C)}],M:[i,c("month")],MM:[r,c("month")],MMM:[a,function(y){var w=d("months"),x=(d("monthsShort")||w.map(function(C){return C.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[a,function(y){var w=d("months").indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,c("year")],YY:[r,function(y){this.year=s(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function m(y){var w,x;w=y,x=l&&l.formats;for(var C=(y=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(R,M,D){var k=D&&D.toUpperCase();return M||x[D]||n[D]||x[k].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,U,W){return U||W.slice(1)})})).match(o),P=C.length,A=0;A-1)return new Date((E==="X"?1e3:1)*F);var j=m(E)(F),Y=j.year,O=j.month,_=j.day,G=j.hours,Q=j.minutes,oe=j.seconds,ee=j.milliseconds,q=j.zone,ae=new Date,Z=_||(Y||O?1:ae.getDate()),ne=Y||ae.getFullYear(),te=0;Y&&!O||(te=O>0?O-1:ae.getMonth());var $=G||0,le=Q||0,de=oe||0,he=ee||0;return q?new Date(Date.UTC(ne,te,Z,$,le,de,he+60*q.offset*1e3)):L?new Date(Date.UTC(ne,te,Z,$,le,de,he)):new Date(ne,te,Z,$,le,de,he)}catch{return new Date("")}}(S,T,v),this.init(),k&&k!==!0&&(this.$L=this.locale(k).$L),D&&S!=this.format(T)&&(this.$d=new Date("")),l={}}else if(T instanceof Array)for(var N=T.length,U=1;U<=N;U+=1){b[1]=T[U-1];var W=x.apply(this,b);if(W.isValid()){this.$d=W.$d,this.$L=W.$L,this.init();break}U===N&&(this.$d=new Date(""))}else P.call(this,A)}}})})(sZe);var U_t=sZe.exports;const j_t=ji(U_t);il.extend(j_t);il.extend(N_t);il.extend(I_t);il.extend(D_t);il.extend(k_t);il.extend(L_t);il.extend(function(t,e){var n=e.prototype,o=n.format;n.format=function(i){var a=(i||"").replace("Wo","wo");return o.bind(this)(a)}});var B_t={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},Vx=function(e){var n=B_t[e];return n||e.split("_")[0]},Y_t={getNow:function(){var e=il();return typeof e.tz=="function"?e.tz():e},getFixedDate:function(e){return il(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var n=e.locale("en");return n.weekday()+n.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},getMillisecond:function(e){return e.millisecond()},addYear:function(e,n){return e.add(n,"year")},addMonth:function(e,n){return e.add(n,"month")},addDate:function(e,n){return e.add(n,"day")},setYear:function(e,n){return e.year(n)},setMonth:function(e,n){return e.month(n)},setDate:function(e,n){return e.date(n)},setHour:function(e,n){return e.hour(n)},setMinute:function(e,n){return e.minute(n)},setSecond:function(e,n){return e.second(n)},setMillisecond:function(e,n){return e.millisecond(n)},isAfter:function(e,n){return e.isAfter(n)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return il().locale(Vx(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,n){return n.locale(Vx(e)).weekday(0)},getWeek:function(e,n){return n.locale(Vx(e)).week()},getShortWeekDays:function(e){return il().locale(Vx(e)).localeData().weekdaysMin()},getShortMonths:function(e){return il().locale(Vx(e)).localeData().monthsShort()},format:function(e,n,o){return n.locale(Vx(e)).format(o)},parse:function(e,n,o){for(var r=Vx(e),i=0;it.length)&&(e=t.length);for(var n=0,o=Array(e);n a":{color:"inherit",transition:`all ${s}`,"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}},[`${n}-item-extra`]:{paddingInlineStart:t.padding,marginInlineStart:"auto",fontSize:t.fontSizeSM,color:t.colorTextDescription}},[`${n}-item, ${n}-submenu-title`]:Object.assign(Object.assign({display:"flex",margin:0,padding:`${jt(c)} ${jt(m)}`,color:t.colorText,fontWeight:"normal",fontSize:u,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${s}`,borderRadius:t.borderRadiusSM,"&:hover, &-active":{backgroundColor:t.controlItemBgHover}},Yy(t)),{"&-selected":{color:t.colorPrimary,backgroundColor:t.controlItemBgActive,"&:hover, &-active":{backgroundColor:t.controlItemBgActiveHover}},"&-disabled":{color:f,cursor:"not-allowed","&:hover":{color:f,backgroundColor:y,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:`${jt(t.marginXXS)} 0`,overflow:"hidden",lineHeight:0,backgroundColor:t.colorSplit},[`${e}-menu-submenu-expand-icon`]:{position:"absolute",insetInlineEnd:t.paddingXS,[`${e}-menu-submenu-arrow-icon`]:{marginInlineEnd:"0 !important",color:t.colorTextDescription,fontSize:p,fontStyle:"normal"}}}),[`${n}-item-group-list`]:{margin:`0 ${jt(t.marginXS)}`,padding:0,listStyle:"none"},[`${n}-submenu-title`]:{paddingInlineEnd:t.calc(m).add(t.fontSizeSM).equal()},[`${n}-submenu-vertical`]:{position:"relative"},[`${n}-submenu${n}-submenu-disabled ${e}-menu-submenu-title`]:{[`&, ${e}-menu-submenu-arrow-icon`]:{color:f,backgroundColor:y,cursor:"not-allowed"}},[`${n}-submenu-selected ${e}-menu-submenu-title`]:{color:t.colorPrimary}})})},[D3(t,"slide-up"),D3(t,"slide-down"),vH(t,"move-up"),vH(t,"move-down"),QM(t,"zoom-big")]]},P_t=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+50,paddingBlock:(t.controlHeight-t.fontSize*t.lineHeight)/2},zZ({contentRadius:t.borderRadiusLG,limitVerticalRadius:!0})),IZ(t)),C_t=el("Dropdown",t=>{const{marginXXS:e,sizePopupArrow:n,paddingXXS:o,componentCls:r}=t,i=Ui(t,{menuCls:`${r}-menu`,dropdownArrowDistance:t.calc(n).div(2).add(e).equal(),dropdownEdgeChildPadding:o});return[T_t(i),S_t(i)]},P_t,{resetStyle:!1}),VZ=t=>{var e;const{menu:n,arrow:o,prefixCls:r,children:i,trigger:a,disabled:l,dropdownRender:s,getPopupContainer:c,overlayClassName:u,rootClassName:d,overlayStyle:f,open:p,onOpenChange:m,visible:y,onVisibleChange:w,mouseEnterDelay:x=.15,mouseLeaveDelay:C=.1,autoAdjustOverflow:P=!0,placement:A="",overlay:S,transitionName:v}=t,{getPopupContainer:b,getPrefixCls:T,direction:R,dropdown:M}=g.useContext(gr);LS();const D=g.useMemo(()=>{const le=T();return v!==void 0?v:A.includes("top")?`${le}-slide-down`:`${le}-slide-up`},[T,A,v]),k=g.useMemo(()=>A?A.includes("Center")?A.slice(0,A.indexOf("Center")):A:R==="rtl"?"bottomRight":"bottomLeft",[A,R]),N=T("dropdown",r),U=nu(N),[W,F,E]=C_t(N,U),[,L]=Ff(),j=g.Children.only(TOt(i)?g.createElement("span",null,i):i),Y=P0(j,{className:Mn(`${N}-trigger`,{[`${N}-rtl`]:R==="rtl"},j.props.className),disabled:(e=j.props.disabled)!==null&&e!==void 0?e:l}),O=l?[]:a,_=!!(O!=null&&O.includes("contextMenu")),[G,Q]=qA(!1,{value:p??y}),oe=kd(le=>{m==null||m(le,{source:"trigger"}),w==null||w(le),Q(le)}),ee=Mn(u,d,F,E,U,M==null?void 0:M.className,{[`${N}-rtl`]:R==="rtl"}),$=vQe({arrowPointAtCenter:typeof o=="object"&&o.pointAtCenter,autoAdjustOverflow:P,offset:L.marginXXS,arrowWidth:o?L.sizePopupArrow:0,borderRadius:L.borderRadius}),ae=g.useCallback(()=>{n!=null&&n.selectable&&(n!=null&&n.multiple)||(m==null||m(!1,{source:"menu"}),Q(!1))},[n==null?void 0:n.selectable,n==null?void 0:n.multiple]),Z=()=>{let le;return n!=null&&n.items?le=g.createElement(rI,Object.assign({},n)):typeof S=="function"?le=S():le=S,s&&(le=s(le)),le=g.Children.only(typeof le=="string"?g.createElement("span",null,le):le),g.createElement(tZe,{prefixCls:`${N}-menu`,rootClassName:Mn(E,U),expandIcon:g.createElement("span",{className:`${N}-menu-submenu-arrow`},g.createElement(xH,{className:`${N}-menu-submenu-arrow-icon`})),mode:"vertical",selectable:!1,onClick:ae,validator:de=>{let{mode:he}=de}},le)},[ne,te]=a6("Dropdown",f==null?void 0:f.zIndex);let q=g.createElement(SOt,Object.assign({alignPoint:_},Mf(t,["rootClassName"]),{mouseEnterDelay:x,mouseLeaveDelay:C,visible:G,builtinPlacements:$,arrow:!!o,overlayClassName:ee,prefixCls:N,getPopupContainer:c||b,transitionName:D,trigger:O,overlay:Z,placement:k,onVisibleChange:oe,overlayStyle:Object.assign(Object.assign(Object.assign({},M==null?void 0:M.style),f),{zIndex:ne})}),Y);return ne&&(q=g.createElement(iU.Provider,{value:te},q)),W(q)},R_t=gU(VZ,"align",void 0,"dropdown",t=>t),H_t=t=>g.createElement(R_t,Object.assign({},t),g.createElement("span",null));VZ._InternalPanelDoNotUseOrYouWillBeFired=H_t;var oZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){return function(n,o){o.prototype.weekday=function(r){var i=this.$locale().weekStart||0,a=this.$W,l=(a25){var u=a(this).startOf(o).add(1,o).date(c),d=a(this).endOf(n);if(u.isBefore(d))return 1}var f=a(this).startOf(o).date(c).startOf(n).subtract(1,"millisecond"),p=this.diff(f,n,!0);return p<0?a(this).startOf("week").week():Math.ceil(p)},l.weeks=function(s){return s===void 0&&(s=null),this.week(s)}}})})(iZe);var E_t=iZe.exports;const k_t=ji(E_t);var aZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){return function(n,o){o.prototype.weekYear=function(){var r=this.month(),i=this.week(),a=this.year();return i===1&&r===11?a+1:r===0&&i>=52?a-1:a}}})})(aZe);var F_t=aZe.exports;const L_t=ji(F_t);var lZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){return function(n,o){var r=o.prototype,i=r.format;r.format=function(a){var l=this,s=this.$locale();if(!this.isValid())return i.bind(this)(a);var c=this.$utils(),u=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(d){switch(d){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return s.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return s.ordinal(l.week(),"W");case"w":case"ww":return c.s(l.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(l.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(l.$H===0?24:l.$H),d==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return d}});return i.bind(this)(u)}}})})(lZe);var W_t=lZe.exports;const N_t=ji(W_t);var sZe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(Rc,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},o=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},s=function(y){return(y=+y)+(y>68?1900:2e3)},c=function(y){return function(w){this[y]=+w}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(y){(this.zone||(this.zone={})).offset=function(w){if(!w||w==="Z")return 0;var x=w.match(/([+-]|\d\d)/g),C=60*x[1]+(+x[2]||0);return C===0?0:x[0]==="+"?-C:C}(y)}],d=function(y){var w=l[y];return w&&(w.indexOf?w:w.s.concat(w.f))},f=function(y,w){var x,C=l.meridiem;if(C){for(var P=1;P<=24;P+=1)if(y.indexOf(C(P,0,w))>-1){x=P>12;break}}else x=y===(w?"pm":"PM");return x},p={A:[a,function(y){this.afternoon=f(y,!1)}],a:[a,function(y){this.afternoon=f(y,!0)}],S:[/\d/,function(y){this.milliseconds=100*+y}],SS:[r,function(y){this.milliseconds=10*+y}],SSS:[/\d{3}/,function(y){this.milliseconds=+y}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[r,c("day")],Do:[a,function(y){var w=l.ordinal,x=y.match(/\d+/);if(this.day=x[0],w)for(var C=1;C<=31;C+=1)w(C).replace(/\[|\]/g,"")===y&&(this.day=C)}],M:[i,c("month")],MM:[r,c("month")],MMM:[a,function(y){var w=d("months"),x=(d("monthsShort")||w.map(function(C){return C.slice(0,3)})).indexOf(y)+1;if(x<1)throw new Error;this.month=x%12||x}],MMMM:[a,function(y){var w=d("months").indexOf(y)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,c("year")],YY:[r,function(y){this.year=s(y)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function m(y){var w,x;w=y,x=l&&l.formats;for(var C=(y=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(R,M,D){var k=D&&D.toUpperCase();return M||x[D]||n[D]||x[k].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,U,W){return U||W.slice(1)})})).match(o),P=C.length,A=0;A-1)return new Date((E==="X"?1e3:1)*F);var j=m(E)(F),Y=j.year,O=j.month,_=j.day,G=j.hours,Q=j.minutes,oe=j.seconds,ee=j.milliseconds,$=j.zone,ae=new Date,Z=_||(Y||O?1:ae.getDate()),ne=Y||ae.getFullYear(),te=0;Y&&!O||(te=O>0?O-1:ae.getMonth());var q=G||0,le=Q||0,de=oe||0,he=ee||0;return $?new Date(Date.UTC(ne,te,Z,q,le,de,he+60*$.offset*1e3)):L?new Date(Date.UTC(ne,te,Z,q,le,de,he)):new Date(ne,te,Z,q,le,de,he)}catch{return new Date("")}}(S,T,v),this.init(),k&&k!==!0&&(this.$L=this.locale(k).$L),D&&S!=this.format(T)&&(this.$d=new Date("")),l={}}else if(T instanceof Array)for(var N=T.length,U=1;U<=N;U+=1){b[1]=T[U-1];var W=x.apply(this,b);if(W.isValid()){this.$d=W.$d,this.$L=W.$L,this.init();break}U===N&&(this.$d=new Date(""))}else P.call(this,A)}}})})(sZe);var U_t=sZe.exports;const j_t=ji(U_t);il.extend(j_t);il.extend(N_t);il.extend(I_t);il.extend(D_t);il.extend(k_t);il.extend(L_t);il.extend(function(t,e){var n=e.prototype,o=n.format;n.format=function(i){var a=(i||"").replace("Wo","wo");return o.bind(this)(a)}});var B_t={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},Vx=function(e){var n=B_t[e];return n||e.split("_")[0]},Y_t={getNow:function(){var e=il();return typeof e.tz=="function"?e.tz():e},getFixedDate:function(e){return il(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var n=e.locale("en");return n.weekday()+n.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},getMillisecond:function(e){return e.millisecond()},addYear:function(e,n){return e.add(n,"year")},addMonth:function(e,n){return e.add(n,"month")},addDate:function(e,n){return e.add(n,"day")},setYear:function(e,n){return e.year(n)},setMonth:function(e,n){return e.month(n)},setDate:function(e,n){return e.date(n)},setHour:function(e,n){return e.hour(n)},setMinute:function(e,n){return e.minute(n)},setSecond:function(e,n){return e.second(n)},setMillisecond:function(e,n){return e.millisecond(n)},isAfter:function(e,n){return e.isAfter(n)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return il().locale(Vx(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,n){return n.locale(Vx(e)).weekday(0)},getWeek:function(e,n){return n.locale(Vx(e)).week()},getShortWeekDays:function(e){return il().locale(Vx(e)).localeData().weekdaysMin()},getShortMonths:function(e){return il().locale(Vx(e)).localeData().monthsShort()},format:function(e,n,o){return n.locale(Vx(e)).format(o)},parse:function(e,n,o){for(var r=Vx(e),i=0;it.length)&&(e=t.length);for(var n=0,o=Array(e);nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=iVt({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||bPe(r,pVt))||n.data&&bPe(r,gVt)||n.attr&&hVt.includes(r))&&(o[r]=t[r])}),o}const mVt=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1};var hZe=function(e){return+setTimeout(e,16)},pZe=function(e){return clearTimeout(e)};typeof window<"u"&&"requestAnimationFrame"in window&&(hZe=function(e){return window.requestAnimationFrame(e)},pZe=function(e){return window.cancelAnimationFrame(e)});var SPe=0,F9e=new Map;function gZe(t){F9e.delete(t)}var m3=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;SPe+=1;var o=SPe;function r(i){if(i===0)gZe(o),e();else{var a=hZe(function(){r(i-1)});F9e.set(o,a)}}return r(n),o};m3.cancel=function(t){var e=F9e.get(t);return gZe(t),pZe(e)};function oee(t,e){return t!==void 0?t:e?"bottomRight":"bottomLeft"}function mZe(t,e){var n=oee(t,e),o=n==null?void 0:n.toLowerCase().endsWith("right"),r=o?"insetInlineEnd":"insetInlineStart";return e&&(r=["insetInlineStart","insetInlineEnd"].find(function(i){return i!==r})),r}var V5=g.createContext(null),yVt={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}};function yZe(t){var e=t.popupElement,n=t.popupStyle,o=t.popupClassName,r=t.popupAlign,i=t.transitionName,a=t.getPopupContainer,l=t.children,s=t.range,c=t.placement,u=t.builtinPlacements,d=u===void 0?yVt:u,f=t.direction,p=t.visible,m=t.onClose,y=g.useContext(V5),w=y.prefixCls,x="".concat(w,"-dropdown"),C=oee(c,f==="rtl");return g.createElement(eI,{showAction:[],hideAction:["click"],popupPlacement:C,builtinPlacements:d,prefixCls:x,popupTransitionName:i,popup:e,popupAlign:r,popupVisible:p,popupClassName:Bn(o,Na(Na({},"".concat(x,"-range"),s),"".concat(x,"-rtl"),f==="rtl")),popupStyle:n,stretch:"minWidth",getPopupContainer:a,onPopupVisibleChange:function(A){A||m()}},l)}function L9e(t,e){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0",o=String(t);o.length2&&arguments[2]!==void 0?arguments[2]:[],o=g.useState([!1,!1]),r=mr(o,2),i=r[0],a=r[1],l=function(u,d){a(function(f){return Ok(f,d,u)})},s=g.useMemo(function(){return i.map(function(c,u){if(c)return!0;var d=t[u];return d?!!(!n[u]&&!d||d&&e(d,{activeIndex:u})):!1})},[t,i,e,n]);return[s,l]}function bZe(t,e,n,o,r){var i="",a=[];return t&&a.push(r?"hh":"HH"),e&&a.push("mm"),n&&a.push("ss"),i=a.join(":"),o&&(i+=".SSS"),r&&(i+=" A"),i}function AVt(t,e,n,o,r,i){var a=t.fieldDateTimeFormat,l=t.fieldDateFormat,s=t.fieldTimeFormat,c=t.fieldMonthFormat,u=t.fieldYearFormat,d=t.fieldWeekFormat,f=t.fieldQuarterFormat,p=t.yearFormat,m=t.cellYearFormat,y=t.cellQuarterFormat,w=t.dayFormat,x=t.cellDateFormat,C=bZe(e,n,o,r,i);return Wi(Wi({},t),{},{fieldDateTimeFormat:a||"YYYY-MM-DD ".concat(C),fieldDateFormat:l||"YYYY-MM-DD",fieldTimeFormat:s||C,fieldMonthFormat:c||"YYYY-MM",fieldYearFormat:u||"YYYY",fieldWeekFormat:d||"gggg-wo",fieldQuarterFormat:f||"YYYY-[Q]Q",yearFormat:p||"YYYY",cellYearFormat:m||"YYYY",cellQuarterFormat:y||"[Q]Q",cellDateFormat:x||w||"D"})}function SZe(t,e){var n=e.showHour,o=e.showMinute,r=e.showSecond,i=e.showMillisecond,a=e.use12Hours;return xe.useMemo(function(){return AVt(t,n,o,r,i,a)},[t,n,o,r,i,a])}function eE(t,e,n){return n??e.some(function(o){return t.includes(o)})}var wVt=["showNow","showHour","showMinute","showSecond","showMillisecond","use12Hours","hourStep","minuteStep","secondStep","millisecondStep","hideDisabledOptions","defaultValue","disabledHours","disabledMinutes","disabledSeconds","disabledMilliseconds","disabledTime","changeOnScroll","defaultOpenValue"];function xVt(t){var e=ree(t,wVt),n=t.format,o=t.picker,r=null;return n&&(r=n,Array.isArray(r)&&(r=r[0]),r=M3(r)==="object"?r.format:r),o==="time"&&(e.format=r),[e,r]}function vVt(t){return t&&typeof t=="string"}function TZe(t,e,n,o){return[t,e,n,o].some(function(r){return r!==void 0})}function PZe(t,e,n,o,r){var i=e,a=n,l=o;if(!t&&!i&&!a&&!l&&!r)i=!0,a=!0,l=!0;else if(t){var s,c,u,d=[i,a,l].some(function(m){return m===!1}),f=[i,a,l].some(function(m){return m===!0}),p=d?!0:!f;i=(s=i)!==null&&s!==void 0?s:p,a=(c=a)!==null&&c!==void 0?c:p,l=(u=l)!==null&&u!==void 0?u:p}return[i,a,l,r]}function CZe(t){var e=t.showTime,n=xVt(t),o=mr(n,2),r=o[0],i=o[1],a=e&&M3(e)==="object"?e:{},l=Wi(Wi({defaultOpenValue:a.defaultOpenValue||a.defaultValue},r),a),s=l.showMillisecond,c=l.showHour,u=l.showMinute,d=l.showSecond,f=TZe(c,u,d,s),p=PZe(f,c,u,d,s),m=mr(p,3);return c=m[0],u=m[1],d=m[2],[l,Wi(Wi({},l),{},{showHour:c,showMinute:u,showSecond:d,showMillisecond:s}),l.format,i]}function RZe(t,e,n,o,r){var i=t==="time";if(t==="datetime"||i){for(var a=o,l=AZe(t,r,null),s=l,c=[e,n],u=0;u1&&(a=e.addDate(a,-7)),a}function G0(t,e){var n=e.generateConfig,o=e.locale,r=e.format;return t?typeof r=="function"?r(t):n.locale.format(o.locale,t,r):""}function dJ(t,e,n){var o=e,r=["getHour","getMinute","getSecond","getMillisecond"],i=["setHour","setMinute","setSecond","setMillisecond"];return i.forEach(function(a,l){n?o=t[a](o,t[r[l]](n)):o=t[a](o,0)}),o}function PVt(t,e,n,o,r){var i=$0(function(a,l){return!!(n&&n(a,l)||o&&t.isAfter(o,a)&&!Rh(t,e,o,a,l.type)||r&&t.isAfter(a,r)&&!Rh(t,e,r,a,l.type))});return i}function CVt(t,e,n){return g.useMemo(function(){var o=AZe(t,e,n),r=BS(o),i=r[0],a=M3(i)==="object"&&i.type==="mask"?i.format:null;return[r.map(function(l){return typeof l=="string"||typeof l=="function"?l:l.format}),a]},[t,e,n])}function RVt(t,e,n){return typeof t[0]=="function"||n?!0:e}function HVt(t,e,n,o){var r=$0(function(i,a){var l=Wi({type:e},a);if(delete l.activeIndex,!t.isValidate(i)||n&&n(i,l))return!0;if((e==="date"||e==="time")&&o){var s,c=a&&a.activeIndex===1?"end":"start",u=((s=o.disabledTime)===null||s===void 0?void 0:s.call(o,i,c,{from:l.from}))||{},d=u.disabledHours,f=u.disabledMinutes,p=u.disabledSeconds,m=u.disabledMilliseconds,y=o.disabledHours,w=o.disabledMinutes,x=o.disabledSeconds,C=d||y,P=f||w,A=p||x,S=t.getHour(i),v=t.getMinute(i),b=t.getSecond(i),T=t.getMillisecond(i);if(C&&C().includes(S)||P&&P(S).includes(v)||A&&A(S,v).includes(b)||m&&m(S,v,b).includes(T))return!0}return!1});return r}function GO(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=g.useMemo(function(){var o=t&&BS(t);return e&&o&&(o[1]=o[1]||o[0]),o},[t,e]);return n}function IZe(t,e){var n=t.generateConfig,o=t.locale,r=t.picker,i=r===void 0?"date":r,a=t.prefixCls,l=a===void 0?"rc-picker":a,s=t.styles,c=s===void 0?{}:s,u=t.classNames,d=u===void 0?{}:u,f=t.order,p=f===void 0?!0:f,m=t.components,y=m===void 0?{}:m,w=t.inputRender,x=t.allowClear,C=t.clearIcon,P=t.needConfirm,A=t.multiple,S=t.format,v=t.inputReadOnly,b=t.disabledDate,T=t.minDate,R=t.maxDate,M=t.showTime,D=t.value,k=t.defaultValue,N=t.pickerValue,U=t.defaultPickerValue,W=GO(D),F=GO(k),E=GO(N),L=GO(U),j=i==="date"&&M?"datetime":i,Y=j==="time"||j==="datetime",O=Y||A,_=P??Y,G=CZe(t),Q=mr(G,4),oe=Q[0],ee=Q[1],q=Q[2],ae=Q[3],Z=SZe(o,ee),ne=g.useMemo(function(){return RZe(j,q,ae,oe,Z)},[j,q,ae,oe,Z]),te=g.useMemo(function(){return Wi(Wi({},t),{},{prefixCls:l,locale:Z,picker:i,styles:c,classNames:d,order:p,components:Wi({input:w},y),clearIcon:bVt(l,x,C),showTime:ne,value:W,defaultValue:F,pickerValue:E,defaultPickerValue:L},e==null?void 0:e())},[t]),$=CVt(j,Z,S),le=mr($,2),de=le[0],he=le[1],me=RVt(de,v,A),ce=PVt(n,o,b,T,R),Pe=HVt(n,i,ce,ne),pe=g.useMemo(function(){return Wi(Wi({},te),{},{needConfirm:_,inputReadOnly:me,disabledDate:ce})},[te,_,me,ce]);return[pe,j,O,de,he,Pe]}function MVt(t,e,n){var o=IA(e,{value:t}),r=mr(o,2),i=r[0],a=r[1],l=xe.useRef(t),s=xe.useRef(),c=function(){m3.cancel(s.current)},u=$0(function(){a(l.current),n&&i!==l.current&&n(l.current)}),d=$0(function(f,p){c(),l.current=f,f||p?u():s.current=m3(u)});return xe.useEffect(function(){return c},[]),[i,d]}function zZe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0,r=n.every(function(u){return u})?!1:t,i=MVt(r,e||!1,o),a=mr(i,2),l=a[0],s=a[1];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!d.inherit||l)&&s(u,d.force)}return[l,c]}function DZe(t){var e=g.useRef();return g.useImperativeHandle(t,function(){var n;return{nativeElement:(n=e.current)===null||n===void 0?void 0:n.nativeElement,focus:function(r){var i;(i=e.current)===null||i===void 0||i.focus(r)},blur:function(){var r;(r=e.current)===null||r===void 0||r.blur()}}}),e}function EZe(t,e){return g.useMemo(function(){return t||(e?(nee(!1,"`ranges` is deprecated. Please use `presets` instead."),Object.entries(e).map(function(n){var o=mr(n,2),r=o[0],i=o[1];return{label:r,value:i}})):[])},[t,e])}function j9e(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,o=g.useRef(e);o.current=e,Hhe(function(){if(t)o.current(t);else{var r=m3(function(){o.current(t)},n);return function(){m3.cancel(r)}}},[t])}function kZe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=g.useState(0),r=mr(o,2),i=r[0],a=r[1],l=g.useState(!1),s=mr(l,2),c=s[0],u=s[1],d=g.useRef([]),f=g.useRef(null),p=g.useRef(null),m=function(A){f.current=A},y=function(A){return f.current===A},w=function(A){u(A)},x=function(A){return A&&(p.current=A),p.current},C=function(A){var S=d.current,v=new Set(S.filter(function(T){return A[T]||e[T]})),b=S[S.length-1]===0?1:0;return v.size>=2||t[b]?null:b};return j9e(c||n,function(){c||(d.current=[],m(null))}),g.useEffect(function(){c&&d.current.push(i)},[c,i]),[c,w,x,i,a,C,d.current,m,y]}function IVt(t,e,n,o,r,i){var a=n[n.length-1],l=function(c,u){var d=mr(t,2),f=d[0],p=d[1],m=Wi(Wi({},u),{},{from:wZe(t,n)});return a===1&&e[0]&&f&&!Rh(o,r,f,c,m.type)&&o.isAfter(f,c)||a===0&&e[1]&&p&&!Rh(o,r,p,c,m.type)&&o.isAfter(c,p)?!0:i==null?void 0:i(c,m)};return l}function qE(t,e,n,o){switch(e){case"date":case"week":return t.addMonth(n,o);case"month":case"quarter":return t.addYear(n,o);case"year":return t.addYear(n,o*10);case"decade":return t.addYear(n,o*100);default:return n}}var Jle=[];function FZe(t,e,n,o,r,i,a,l){var s=arguments.length>8&&arguments[8]!==void 0?arguments[8]:Jle,c=arguments.length>9&&arguments[9]!==void 0?arguments[9]:Jle,u=arguments.length>10&&arguments[10]!==void 0?arguments[10]:Jle,d=arguments.length>11?arguments[11]:void 0,f=arguments.length>12?arguments[12]:void 0,p=arguments.length>13?arguments[13]:void 0,m=a==="time",y=i||0,w=function(E){var L=t.getNow();return m&&(L=dJ(t,L)),s[E]||n[E]||L},x=mr(c,2),C=x[0],P=x[1],A=IA(function(){return w(0)},{value:C}),S=mr(A,2),v=S[0],b=S[1],T=IA(function(){return w(1)},{value:P}),R=mr(T,2),M=R[0],D=R[1],k=g.useMemo(function(){var F=[v,M][y];return m?F:dJ(t,F,u[y])},[m,v,M,y,t,u]),N=function(E){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"panel",j=[b,D][y];j(E);var Y=[v,M];Y[y]=E,d&&(!Rh(t,e,v,Y[0],a)||!Rh(t,e,M,Y[1],a))&&d(Y,{source:L,range:y===1?"end":"start",mode:o})},U=function(E,L){if(l){var j={date:"month",week:"month",month:"year",quarter:"year"},Y=j[a];if(Y&&!Rh(t,e,E,L,Y))return qE(t,a,L,-1);if(a==="year"&&E){var O=Math.floor(t.getYear(E)/10),_=Math.floor(t.getYear(L)/10);if(O!==_)return qE(t,a,L,-1)}}return L},W=g.useRef(null);return ZA(function(){if(r&&!s[y]){var F=m?null:t.getNow();if(W.current!==null&&W.current!==y?F=[v,M][y^1]:n[y]?F=y===0?n[0]:U(n[0],n[1]):n[y^1]&&(F=n[y^1]),F){f&&t.isAfter(f,F)&&(F=f);var E=l?qE(t,a,F,1):F;p&&t.isAfter(E,p)&&(F=l?qE(t,a,p,-1):p),N(F,"reset")}}},[r,y,n[y]]),g.useEffect(function(){r?W.current=y:W.current=null},[r,y]),ZA(function(){r&&s&&s[y]&&N(s[y],"reset")},[r,y]),[k,N]}function LZe(t,e){var n=g.useRef(t),o=g.useState({}),r=mr(o,2),i=r[1],a=function(c){return c&&e!==void 0?e:n.current},l=function(c){n.current=c,i({})};return[a,l,a(!0)]}var zVt=[];function WZe(t,e,n){var o=function(a){return a.map(function(l){return G0(l,{generateConfig:t,locale:e,format:n[0]})})},r=function(a,l){for(var s=Math.max(a.length,l.length),c=-1,u=0;u2&&arguments[2]!==void 0?arguments[2]:1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:2,a=[],l=n>=1?n|0:1,s=t;s<=e;s+=l){var c=r.includes(s);(!c||!o)&&a.push({label:L9e(s,i),value:s,disabled:c})}return a}function B9e(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,o=e||{},r=o.use12Hours,i=o.hourStep,a=i===void 0?1:i,l=o.minuteStep,s=l===void 0?1:l,c=o.secondStep,u=c===void 0?1:c,d=o.millisecondStep,f=d===void 0?100:d,p=o.hideDisabledOptions,m=o.disabledTime,y=o.disabledHours,w=o.disabledMinutes,x=o.disabledSeconds,C=g.useMemo(function(){return n||t.getNow()},[n,t]),P=g.useCallback(function(L){var j=(m==null?void 0:m(L))||{};return[j.disabledHours||y||XO,j.disabledMinutes||w||XO,j.disabledSeconds||x||XO,j.disabledMilliseconds||XO]},[m,y,w,x]),A=g.useMemo(function(){return P(C)},[C,P]),S=mr(A,4),v=S[0],b=S[1],T=S[2],R=S[3],M=g.useCallback(function(L,j,Y,O){var _=JO(0,23,a,p,L()),G=r?_.map(function(q){return Wi(Wi({},q),{},{label:L9e(q.value%12||12,2)})}):_,Q=function(ae){return JO(0,59,s,p,j(ae))},oe=function(ae,Z){return JO(0,59,u,p,Y(ae,Z))},ee=function(ae,Z,ne){return JO(0,999,f,p,O(ae,Z,ne),3)};return[G,Q,oe,ee]},[p,a,r,f,s,u]),D=g.useMemo(function(){return M(v,b,T,R)},[M,v,b,T,R]),k=mr(D,4),N=k[0],U=k[1],W=k[2],F=k[3],E=function(j,Y){var O=function(){return N},_=U,G=W,Q=F;if(Y){var oe=P(Y),ee=mr(oe,4),q=ee[0],ae=ee[1],Z=ee[2],ne=ee[3],te=M(q,ae,Z,ne),$=mr(te,4),le=$[0],de=$[1],he=$[2],me=$[3];O=function(){return le},_=de,G=he,Q=me}var ce=EVt(j,O,_,G,Q,t);return ce};return[E,N,U,W,F]}function kVt(t){var e=t.mode,n=t.internalMode,o=t.renderExtraFooter,r=t.showNow,i=t.showTime,a=t.onSubmit,l=t.onNow,s=t.invalid,c=t.needConfirm,u=t.generateConfig,d=t.disabledDate,f=g.useContext(V5),p=f.prefixCls,m=f.locale,y=f.button,w=y===void 0?"button":y,x=u.getNow(),C=B9e(u,i,x),P=mr(C,1),A=P[0],S=o==null?void 0:o(e),v=d(x,{type:e}),b=function(){if(!v){var U=A(x);l(U)}},T="".concat(p,"-now"),R="".concat(T,"-btn"),M=r&&g.createElement("li",{className:T},g.createElement("a",{className:Bn(R,v&&"".concat(R,"-disabled")),"aria-disabled":v,onClick:b},n==="date"?m.today:m.now)),D=c&&g.createElement("li",{className:"".concat(p,"-ok")},g.createElement(w,{disabled:s,onClick:a},m.ok)),k=(M||D)&&g.createElement("ul",{className:"".concat(p,"-ranges")},M,D);return!S&&!k?null:g.createElement("div",{className:"".concat(p,"-footer")},S&&g.createElement("div",{className:"".concat(p,"-footer-extra")},S),k)}function YZe(t,e,n){function o(r,i){var a=r.findIndex(function(s){return Rh(t,e,s,i,n)});if(a===-1)return[].concat(N1(r),[i]);var l=N1(r);return l.splice(a,1),l}return o}var YS=g.createContext(null);function aee(){return g.useContext(YS)}function iI(t,e){var n=t.prefixCls,o=t.generateConfig,r=t.locale,i=t.disabledDate,a=t.minDate,l=t.maxDate,s=t.cellRender,c=t.hoverValue,u=t.hoverRangeValue,d=t.onHover,f=t.values,p=t.pickerValue,m=t.onSelect,y=t.prevIcon,w=t.nextIcon,x=t.superPrevIcon,C=t.superNextIcon,P=o.getNow(),A={now:P,values:f,pickerValue:p,prefixCls:n,disabledDate:i,minDate:a,maxDate:l,cellRender:s,hoverValue:c,hoverRangeValue:u,onHover:d,locale:r,generateConfig:o,onSelect:m,panelType:e,prevIcon:y,nextIcon:w,superPrevIcon:x,superNextIcon:C};return[A,P]}var E8=g.createContext({});function AU(t){for(var e=t.rowNum,n=t.colNum,o=t.baseDate,r=t.getCellDate,i=t.prefixColumn,a=t.rowClassName,l=t.titleFormat,s=t.getCellText,c=t.getCellClassName,u=t.headerCells,d=t.cellSelection,f=d===void 0?!0:d,p=t.disabledDate,m=aee(),y=m.prefixCls,w=m.panelType,x=m.now,C=m.disabledDate,P=m.cellRender,A=m.onHover,S=m.hoverValue,v=m.hoverRangeValue,b=m.generateConfig,T=m.values,R=m.locale,M=m.onSelect,D=p||C,k="".concat(y,"-cell"),N=g.useContext(E8),U=N.onCellDblClick,W=function(G){return T.some(function(Q){return Q&&Rh(b,R,G,Q,w)})},F=[],E=0;E1&&arguments[1]!==void 0?arguments[1]:!1;ze(qe),w==null||w(qe),Fe&&Ae(qe)},ge=function(qe,Fe){Z(qe),Fe&&se(Fe),Ae(Fe,qe)},we=function(qe){if(Pe(qe),se(qe),ae!==A){var Fe=["decade","year"],He=[].concat(Fe,["month"]),Le={quarter:[].concat(Fe,["quarter"]),week:[].concat(N1(He),["week"]),date:[].concat(N1(He),["date"])},Ye=Le[A]||He,lt=Ye.indexOf(ae),Oe=Ye[lt+1];Oe&&ge(Oe,qe)}},Se=g.useMemo(function(){var Ue,qe;if(Array.isArray(b)){var Fe=mr(b,2);Ue=Fe[0],qe=Fe[1]}else Ue=b;return!Ue&&!qe?null:(Ue=Ue||qe,qe=qe||Ue,r.isAfter(Ue,qe)?[qe,Ue]:[Ue,qe])},[b,r]),Me=W9e(T,R,M),Ce=k[ne]||GVt[ne]||lee,Te=g.useContext(E8),Re=g.useMemo(function(){return Wi(Wi({},Te),{},{hideHeader:N})},[Te,N]),Ne="".concat(U,"-panel"),_e=ree(t,["showWeek","prevIcon","nextIcon","superPrevIcon","superNextIcon","disabledDate","minDate","maxDate","onHover"]);return g.createElement(E8.Provider,{value:Re},g.createElement("div",{ref:W,tabIndex:s,className:Bn(Ne,Na({},"".concat(Ne,"-rtl"),i==="rtl"))},g.createElement(Ce,Yl({},_e,{showTime:Q,prefixCls:U,locale:_,generateConfig:r,onModeChange:ge,pickerValue:ve,onPickerValueChange:function(qe){se(qe,!0)},value:me[0],onSelect:we,values:me,cellRender:Me,hoverRangeValue:Se,hoverValue:v}))))}var Kle=g.memo(g.forwardRef(XVt));function JVt(t){var e=t.picker,n=t.multiplePanel,o=t.pickerValue,r=t.onPickerValueChange,i=t.needConfirm,a=t.onSubmit,l=t.range,s=t.hoverValue,c=g.useContext(V5),u=c.prefixCls,d=c.generateConfig,f=g.useCallback(function(C,P){return qE(d,e,C,P)},[d,e]),p=g.useMemo(function(){return f(o,1)},[o,f]),m=function(P){r(f(P,-1))},y={onCellDblClick:function(){i&&a()}},w=e==="time",x=Wi(Wi({},t),{},{hoverValue:null,hoverRangeValue:null,hideHeader:w});return l?x.hoverRangeValue=s:x.hoverValue=s,n?g.createElement("div",{className:"".concat(u,"-panels")},g.createElement(E8.Provider,{value:Wi(Wi({},y),{},{hideNext:!0})},g.createElement(Kle,x)),g.createElement(E8.Provider,{value:Wi(Wi({},y),{},{hidePrev:!0})},g.createElement(Kle,Yl({},x,{pickerValue:p,onPickerValueChange:m})))):g.createElement(E8.Provider,{value:Wi({},y)},g.createElement(Kle,x))}function PPe(t){return typeof t=="function"?t():t}function KVt(t){var e=t.prefixCls,n=t.presets,o=t.onClick,r=t.onHover;return n.length?g.createElement("div",{className:"".concat(e,"-presets")},g.createElement("ul",null,n.map(function(i,a){var l=i.label,s=i.value;return g.createElement("li",{key:a,onClick:function(){o(PPe(s))},onMouseEnter:function(){r(PPe(s))},onMouseLeave:function(){r(null)}},l)}))):null}function _Ze(t){var e=t.panelRender,n=t.internalMode,o=t.picker,r=t.showNow,i=t.range,a=t.multiple,l=t.activeOffset,s=l===void 0?0:l,c=t.placement,u=t.presets,d=t.onPresetHover,f=t.onPresetSubmit,p=t.onFocus,m=t.onBlur,y=t.onPanelMouseDown,w=t.direction,x=t.value,C=t.onSelect,P=t.isInvalid,A=t.defaultOpenValue,S=t.onOk,v=t.onSubmit,b=g.useContext(V5),T=b.prefixCls,R="".concat(T,"-panel"),M=w==="rtl",D=g.useRef(null),k=g.useRef(null),N=g.useState(0),U=mr(N,2),W=U[0],F=U[1],E=g.useState(0),L=mr(E,2),j=L[0],Y=L[1],O=function(ce){ce.offsetWidth&&F(ce.offsetWidth)};g.useEffect(function(){if(i){var me,ce=((me=D.current)===null||me===void 0?void 0:me.offsetWidth)||0,Pe=W-ce;s<=Pe?Y(0):Y(s+ce-W)}},[W,s,i]);function _(me){return me.filter(function(ce){return ce})}var G=g.useMemo(function(){return _(BS(x))},[x]),Q=o==="time"&&!G.length,oe=g.useMemo(function(){return Q?_([A]):G},[Q,G,A]),ee=Q?A:G,q=g.useMemo(function(){return oe.length?oe.some(function(me){return P(me)}):!0},[oe,P]),ae=function(){Q&&C(A),S(),v()},Z=g.createElement("div",{className:"".concat(T,"-panel-layout")},g.createElement(KVt,{prefixCls:T,presets:u,onClick:f,onHover:d}),g.createElement("div",null,g.createElement(JVt,Yl({},t,{value:ee})),g.createElement(kVt,Yl({},t,{showNow:a?!1:r,invalid:q,onSubmit:ae}))));e&&(Z=e(Z));var ne="".concat(R,"-container"),te="marginLeft",$="marginRight",le=g.createElement("div",{onMouseDown:y,tabIndex:-1,className:Bn(ne,"".concat(T,"-").concat(n,"-panel-container")),style:Na(Na({},M?$:te,j),M?te:$,"auto"),onFocus:p,onBlur:m},Z);if(i){var de=oee(c,M),he=mZe(de,M);le=g.createElement("div",{onMouseDown:y,ref:k,className:Bn("".concat(T,"-range-wrapper"),"".concat(T,"-").concat(o,"-range-wrapper"))},g.createElement("div",{ref:D,className:"".concat(T,"-range-arrow"),style:Na({},he,s)}),g.createElement(Ld,{onResize:O},le))}return le}function $Vt(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.indexOf(o)!==-1)continue;n[o]=t[o]}return n}function mb(t,e){if(t==null)return{};var n,o,r=$Vt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o=l&&n<=s)return i;var c=Math.min(Math.abs(n-l),Math.abs(n-s));c0?tt:gt));var bt=et+Qe,St=gt-tt+1;return String(tt+(St+bt-tt)%St)};switch(qe){case"Backspace":case"Delete":Fe="",He=Ye;break;case"ArrowLeft":Fe="",lt(-1);break;case"ArrowRight":Fe="",lt(1);break;case"ArrowUp":Fe="",He=Oe(1);break;case"ArrowDown":Fe="",He=Oe(-1);break;default:isNaN(Number(qe))||(Fe=O+qe,He=Fe);break}if(Fe!==null&&(_(Fe),Fe.length>=Le&&(lt(1),_(""))),He!==null){var ut=te.slice(0,ce)+L9e(He,Le)+te.slice(Pe);Ie(ut.slice(0,a.length))}ne({})},Re=g.useRef();ZA(function(){if(!(!N||!a||Ae.current)){if(!de.match(te)){Ie(a);return}return le.current.setSelectionRange(ce,Pe),Re.current=m3(function(){le.current.setSelectionRange(ce,Pe)}),function(){m3.cancel(Re.current)}}},[de,a,N,te,oe,ce,Pe,Z,Ie]);var Ne=a?{onFocus:we,onBlur:Me,onKeyDown:Te,onMouseDown:se,onMouseUp:ge,onPaste:ze}:{};return g.createElement("div",{ref:$,className:Bn(M,Na(Na({},"".concat(M,"-active"),n&&r),"".concat(M,"-placeholder"),c))},g.createElement(R,Yl({ref:le,"aria-invalid":y,autoComplete:"off"},x,{onKeyDown:Ce,onBlur:Se},Ne,{value:te,onChange:ve})),g.createElement(see,{type:"suffix",icon:i}),w)}),aGt=["id","prefix","clearIcon","suffixIcon","separator","activeIndex","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","value","onChange","onSubmit","onInputChange","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onActiveOffset","placement","onMouseDown","required","aria-required","autoFocus","tabIndex"],lGt=["index"],sGt=["insetInlineStart","insetInlineEnd"];function cGt(t,e){var n=t.id,o=t.prefix,r=t.clearIcon,i=t.suffixIcon,a=t.separator,l=a===void 0?"~":a,s=t.activeIndex;t.activeHelp,t.allHelp;var c=t.focused;t.onFocus,t.onBlur,t.onKeyDown,t.locale,t.generateConfig;var u=t.placeholder,d=t.className,f=t.style,p=t.onClick,m=t.onClear,y=t.value;t.onChange,t.onSubmit,t.onInputChange,t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var w=t.disabled,x=t.invalid;t.inputReadOnly;var C=t.direction;t.onOpenChange;var P=t.onActiveOffset,A=t.placement,S=t.onMouseDown;t.required,t["aria-required"];var v=t.autoFocus,b=t.tabIndex,T=mb(t,aGt),R=C==="rtl",M=g.useContext(V5),D=M.prefixCls,k=g.useMemo(function(){if(typeof n=="string")return[n];var le=n||{};return[le.start,le.end]},[n]),N=g.useRef(),U=g.useRef(),W=g.useRef(),F=function(de){var he;return(he=[U,W][de])===null||he===void 0?void 0:he.current};g.useImperativeHandle(e,function(){return{nativeElement:N.current,focus:function(de){if(M3(de)==="object"){var he,me=de||{},ce=me.index,Pe=ce===void 0?0:ce,pe=mb(me,lGt);(he=F(Pe))===null||he===void 0||he.focus(pe)}else{var Ie;(Ie=F(de??0))===null||Ie===void 0||Ie.focus()}},blur:function(){var de,he;(de=F(0))===null||de===void 0||de.blur(),(he=F(1))===null||he===void 0||he.blur()}}});var E=GZe(T),L=g.useMemo(function(){return Array.isArray(u)?u:[u,u]},[u]),j=VZe(Wi(Wi({},t),{},{id:k,placeholder:L})),Y=mr(j,1),O=Y[0],_=oee(A,R),G=mZe(_,R),Q=_==null?void 0:_.toLowerCase().endsWith("right"),oe=g.useState({position:"absolute",width:0}),ee=mr(oe,2),q=ee[0],ae=ee[1],Z=$0(function(){var le=F(s);if(le){var de=le.nativeElement,he=de.offsetWidth,me=de.offsetLeft,ce=de.offsetParent,Pe=(ce==null?void 0:ce.offsetWidth)||0,pe=Q?Pe-he-me:me;ae(function(Ie){Ie.insetInlineStart,Ie.insetInlineEnd;var ve=mb(Ie,sGt);return Wi(Wi({},ve),{},Na({width:he},G,pe))}),P(pe)}});g.useEffect(function(){Z()},[s]);var ne=r&&(y[0]&&!w[0]||y[1]&&!w[1]),te=v&&!w[0],$=v&&!te&&!w[1];return g.createElement(Ld,{onResize:Z},g.createElement("div",Yl({},E,{className:Bn(D,"".concat(D,"-range"),Na(Na(Na(Na({},"".concat(D,"-focused"),c),"".concat(D,"-disabled"),w.every(function(le){return le})),"".concat(D,"-invalid"),x.some(function(le){return le})),"".concat(D,"-rtl"),R),d),style:f,ref:N,onClick:p,onMouseDown:function(de){var he=de.target;he!==U.current.inputElement&&he!==W.current.inputElement&&de.preventDefault(),S==null||S(de)}}),o&&g.createElement("div",{className:"".concat(D,"-prefix")},o),g.createElement(Dhe,Yl({ref:U},O(0),{autoFocus:te,tabIndex:b,"date-range":"start"})),g.createElement("div",{className:"".concat(D,"-range-separator")},l),g.createElement(Dhe,Yl({ref:W},O(1),{autoFocus:$,tabIndex:b,"date-range":"end"})),g.createElement("div",{className:"".concat(D,"-active-bar"),style:q}),g.createElement(see,{type:"suffix",icon:i}),ne&&g.createElement(zhe,{icon:r,onClear:m})))}var uGt=g.forwardRef(cGt);function RPe(t,e){var n=t??e;return Array.isArray(n)?n:[n,n]}function $O(t){return t===1?"end":"start"}function dGt(t,e){var n=IZe(t,function(){var ho=t.disabled,vo=t.allowEmpty,bo=RPe(ho,!1),Bo=RPe(vo,!1);return{disabled:bo,allowEmpty:Bo}}),o=mr(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r.prefixCls,d=r.styles,f=r.classNames,p=r.placement,m=r.defaultValue,y=r.value,w=r.needConfirm,x=r.onKeyDown,C=r.disabled,P=r.allowEmpty,A=r.disabledDate,S=r.minDate,v=r.maxDate,b=r.defaultOpen,T=r.open,R=r.onOpenChange,M=r.locale,D=r.generateConfig,k=r.picker,N=r.showNow,U=r.showToday,W=r.showTime,F=r.mode,E=r.onPanelChange,L=r.onCalendarChange,j=r.onOk,Y=r.defaultPickerValue,O=r.pickerValue,_=r.onPickerValueChange,G=r.inputReadOnly,Q=r.suffixIcon,oe=r.onFocus,ee=r.onBlur,q=r.presets,ae=r.ranges,Z=r.components,ne=r.cellRender,te=r.dateRender,$=r.monthCellRender,le=r.onClick,de=DZe(e),he=zZe(T,b,C,R),me=mr(he,2),ce=me[0],Pe=me[1],pe=function(vo,bo){(C.some(function(Bo){return!Bo})||!vo)&&Pe(vo,bo)},Ie=UZe(D,M,l,!0,!1,m,y,L,j),ve=mr(Ie,5),ze=ve[0],Ae=ve[1],se=ve[2],ge=ve[3],we=ve[4],Se=se(),Me=kZe(C,P,ce),Ce=mr(Me,9),Te=Ce[0],Re=Ce[1],Ne=Ce[2],_e=Ce[3],Ue=Ce[4],qe=Ce[5],Fe=Ce[6],He=Ce[7],Le=Ce[8],Ye=function(vo,bo){Re(!0),oe==null||oe(vo,{range:$O(bo??_e)})},lt=function(vo,bo){Re(!1),ee==null||ee(vo,{range:$O(bo??_e)})},Oe=g.useMemo(function(){if(!W)return null;var ho=W.disabledTime,vo=ho?function(bo){var Bo=$O(_e),Pr=wZe(Se,Fe,_e);return ho(bo,Bo,{from:Pr})}:void 0;return Wi(Wi({},W),{},{disabledTime:vo})},[W,_e,Se,Fe]),ut=IA([k,k],{value:F}),ht=mr(ut,2),Qe=ht[0],nt=ht[1],mt=Qe[_e]||k,tt=mt==="date"&&Oe?"datetime":mt,gt=tt===k&&tt!=="time",Ve=BZe(k,mt,N,U,!0),je=jZe(r,ze,Ae,se,ge,C,l,Te,ce,c),et=mr(je,2),bt=et[0],St=et[1],Pt=IVt(Se,C,Fe,D,M,A),Yt=vZe(Se,c,P),zt=mr(Yt,2),Rt=zt[0],Ct=zt[1],yt=FZe(D,M,Se,Qe,ce,_e,i,gt,Y,O,Oe==null?void 0:Oe.defaultOpenValue,_,S,v),at=mr(yt,2),Et=at[0],Lt=at[1],Je=$0(function(ho,vo,bo){var Bo=Ok(Qe,_e,vo);if((Bo[0]!==Qe[0]||Bo[1]!==Qe[1])&&nt(Bo),E&&bo!==!1){var Pr=N1(Se);ho&&(Pr[_e]=ho),E(Pr,Bo)}}),st=function(vo,bo){return Ok(Se,bo,vo)},It=function(vo,bo){var Bo=Se;vo&&(Bo=st(vo,_e)),He(_e);var Pr=qe(Bo);ge(Bo),bt(_e,Pr===null),Pr===null?pe(!1,{force:!0}):bo||de.current.focus({index:Pr})},ot=function(vo){var bo,Bo=vo.target.getRootNode();if(!de.current.nativeElement.contains((bo=Bo.activeElement)!==null&&bo!==void 0?bo:document.activeElement)){var Pr=C.findIndex(function(so){return!so});Pr>=0&&de.current.focus({index:Pr})}pe(!0),le==null||le(vo)},it=function(){St(null),pe(!1,{force:!0})},Be=g.useState(null),pt=mr(Be,2),ct=pt[0],Xe=pt[1],ft=g.useState(null),wt=mr(ft,2),kt=wt[0],Zt=wt[1],Ot=g.useMemo(function(){return kt||Se},[Se,kt]);g.useEffect(function(){ce||Zt(null)},[ce]);var on=g.useState(0),qt=mr(on,2),rn=qt[0],Pn=qt[1],fo=EZe(q,ae),to=function(vo){Zt(vo),Xe("preset")},Dt=function(vo){var bo=St(vo);bo&&pe(!1,{force:!0})},fn=function(vo){It(vo)},kn=function(vo){Zt(vo?st(vo,_e):null),Xe("cell")},yo=function(vo){pe(!0),Ye(vo)},ur=function(){Ne("panel")},lr=function(vo){var bo=Ok(Se,_e,vo);ge(bo),!w&&!a&&i===tt&&It(vo)},xo=function(){pe(!1)},wo=W9e(ne,te,$,$O(_e)),Rr=Se[_e]||null,Eo=$0(function(ho){return c(ho,{activeIndex:_e})}),An=g.useMemo(function(){var ho=k9e(r,!1),vo=fZe(r,[].concat(N1(Object.keys(ho)),["onChange","onCalendarChange","style","className","onPanelChange","disabledTime"]));return vo},[r]),Dn=g.createElement(_Ze,Yl({},An,{showNow:Ve,showTime:Oe,range:!0,multiplePanel:gt,activeOffset:rn,placement:p,disabledDate:Pt,onFocus:yo,onBlur:lt,onPanelMouseDown:ur,picker:k,mode:mt,internalMode:tt,onPanelChange:Je,format:s,value:Rr,isInvalid:Eo,onChange:null,onSelect:lr,pickerValue:Et,defaultOpenValue:BS(W==null?void 0:W.defaultOpenValue)[_e],onPickerValueChange:Lt,hoverValue:Ot,onHover:kn,needConfirm:w,onSubmit:It,onOk:we,presets:fo,onPresetHover:to,onPresetSubmit:Dt,onNow:fn,cellRender:wo})),sr=function(vo,bo){var Bo=st(vo,bo);ge(Bo)},Vo=function(){Ne("input")},Wo=function(vo,bo){var Bo=Fe.length,Pr=Fe[Bo-1];if(Bo&&Pr!==bo&&w&&!P[Pr]&&!Le(Pr)&&Se[Pr]){de.current.focus({index:Pr});return}Ne("input"),pe(!0,{inherit:!0}),_e!==bo&&ce&&!w&&a&&It(null,!0),Ue(bo),Ye(vo,bo)},To=function(vo,bo){if(pe(!1),!w&&Ne()==="input"){var Bo=qe(Se);bt(_e,Bo===null)}lt(vo,bo)},Go=function(vo,bo){vo.key==="Tab"&&It(null,!0),x==null||x(vo,bo)},No=g.useMemo(function(){return{prefixCls:u,locale:M,generateConfig:D,button:Z.button,input:Z.input}},[u,M,D,Z.button,Z.input]);return ZA(function(){ce&&_e!==void 0&&Je(null,k,!1)},[ce,_e,k]),ZA(function(){var ho=Ne();!ce&&ho==="input"&&(pe(!1),It(null,!0)),!ce&&a&&!w&&ho==="panel"&&(pe(!0),It())},[ce]),g.createElement(V5.Provider,{value:No},g.createElement(yZe,Yl({},xZe(r),{popupElement:Dn,popupStyle:d.popup,popupClassName:f.popup,visible:ce,onClose:xo,range:!0}),g.createElement(uGt,Yl({},r,{ref:de,suffixIcon:Q,activeIndex:Te||ce?_e:null,activeHelp:!!kt,allHelp:!!kt&&ct==="preset",focused:Te,onFocus:Wo,onBlur:To,onKeyDown:Go,onSubmit:It,value:Ot,maskFormat:s,onChange:sr,onInputChange:Vo,format:l,inputReadOnly:G,disabled:C,open:ce,onOpenChange:pe,onClick:ot,onClear:it,invalid:Rt,onInvalid:Ct,onActiveOffset:Pn}))))}var fGt=g.forwardRef(dGt);function hGt(t){var e=t.prefixCls,n=t.value,o=t.onRemove,r=t.removeIcon,i=r===void 0?"×":r,a=t.formatDate,l=t.disabled,s=t.maxTagCount,c=t.placeholder,u="".concat(e,"-selector"),d="".concat(e,"-selection"),f="".concat(d,"-overflow");function p(w,x){return g.createElement("span",{className:Bn("".concat(d,"-item")),title:typeof w=="string"?w:null},g.createElement("span",{className:"".concat(d,"-item-content")},w),!l&&x&&g.createElement("span",{onMouseDown:function(P){P.preventDefault()},onClick:x,className:"".concat(d,"-item-remove")},i))}function m(w){var x=a(w),C=function(A){A&&A.stopPropagation(),o(w)};return p(x,C)}function y(w){var x="+ ".concat(w.length," ...");return p(x)}return g.createElement("div",{className:u},g.createElement(S5,{prefixCls:f,data:n,renderItem:m,renderRest:y,itemKey:function(x){return a(x)},maxCount:s}),!n.length&&g.createElement("span",{className:"".concat(e,"-selection-placeholder")},c))}var pGt=["id","open","prefix","clearIcon","suffixIcon","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","internalPicker","value","onChange","onSubmit","onInputChange","multiple","maxTagCount","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onMouseDown","required","aria-required","autoFocus","tabIndex","removeIcon"];function gGt(t,e){t.id;var n=t.open,o=t.prefix,r=t.clearIcon,i=t.suffixIcon;t.activeHelp,t.allHelp;var a=t.focused;t.onFocus,t.onBlur,t.onKeyDown;var l=t.locale,s=t.generateConfig,c=t.placeholder,u=t.className,d=t.style,f=t.onClick,p=t.onClear,m=t.internalPicker,y=t.value,w=t.onChange,x=t.onSubmit;t.onInputChange;var C=t.multiple,P=t.maxTagCount;t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var A=t.disabled,S=t.invalid;t.inputReadOnly;var v=t.direction;t.onOpenChange;var b=t.onMouseDown;t.required,t["aria-required"];var T=t.autoFocus,R=t.tabIndex,M=t.removeIcon,D=mb(t,pGt),k=v==="rtl",N=g.useContext(V5),U=N.prefixCls,W=g.useRef(),F=g.useRef();g.useImperativeHandle(e,function(){return{nativeElement:W.current,focus:function(q){var ae;(ae=F.current)===null||ae===void 0||ae.focus(q)},blur:function(){var q;(q=F.current)===null||q===void 0||q.blur()}}});var E=GZe(D),L=function(q){w([q])},j=function(q){var ae=y.filter(function(Z){return Z&&!Rh(s,l,Z,q,m)});w(ae),n||x()},Y=VZe(Wi(Wi({},t),{},{onChange:L}),function(ee){var q=ee.valueTexts;return{value:q[0]||"",active:a}}),O=mr(Y,2),_=O[0],G=O[1],Q=!!(r&&y.length&&!A),oe=C?g.createElement(g.Fragment,null,g.createElement(hGt,{prefixCls:U,value:y,onRemove:j,formatDate:G,maxTagCount:P,disabled:A,removeIcon:M,placeholder:c}),g.createElement("input",{className:"".concat(U,"-multiple-input"),value:y.map(G).join(","),ref:F,readOnly:!0,autoFocus:T,tabIndex:R}),g.createElement(see,{type:"suffix",icon:i}),Q&&g.createElement(zhe,{icon:r,onClear:p})):g.createElement(Dhe,Yl({ref:F},_(),{autoFocus:T,tabIndex:R,suffixIcon:i,clearIcon:Q&&g.createElement(zhe,{icon:r,onClear:p}),showActiveCls:!1}));return g.createElement("div",Yl({},E,{className:Bn(U,Na(Na(Na(Na(Na({},"".concat(U,"-multiple"),C),"".concat(U,"-focused"),a),"".concat(U,"-disabled"),A),"".concat(U,"-invalid"),S),"".concat(U,"-rtl"),k),u),style:d,ref:W,onClick:f,onMouseDown:function(q){var ae,Z=q.target;Z!==((ae=F.current)===null||ae===void 0?void 0:ae.inputElement)&&q.preventDefault(),b==null||b(q)}}),o&&g.createElement("div",{className:"".concat(U,"-prefix")},o),oe)}var mGt=g.forwardRef(gGt);function yGt(t,e){var n=IZe(t),o=mr(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r,d=u.prefixCls,f=u.styles,p=u.classNames,m=u.order,y=u.defaultValue,w=u.value,x=u.needConfirm,C=u.onChange,P=u.onKeyDown,A=u.disabled,S=u.disabledDate,v=u.minDate,b=u.maxDate,T=u.defaultOpen,R=u.open,M=u.onOpenChange,D=u.locale,k=u.generateConfig,N=u.picker,U=u.showNow,W=u.showToday,F=u.showTime,E=u.mode,L=u.onPanelChange,j=u.onCalendarChange,Y=u.onOk,O=u.multiple,_=u.defaultPickerValue,G=u.pickerValue,Q=u.onPickerValueChange,oe=u.inputReadOnly,ee=u.suffixIcon,q=u.removeIcon,ae=u.onFocus,Z=u.onBlur,ne=u.presets,te=u.components,$=u.cellRender,le=u.dateRender,de=u.monthCellRender,he=u.onClick,me=DZe(e);function ce(Eo){return Eo===null?null:O?Eo:Eo[0]}var Pe=YZe(k,D,i),pe=zZe(R,T,[A],M),Ie=mr(pe,2),ve=Ie[0],ze=Ie[1],Ae=function(An,Dn,sr){if(j){var Vo=Wi({},sr);delete Vo.range,j(ce(An),ce(Dn),Vo)}},se=function(An){Y==null||Y(ce(An))},ge=UZe(k,D,l,!1,m,y,w,Ae,se),we=mr(ge,5),Se=we[0],Me=we[1],Ce=we[2],Te=we[3],Re=we[4],Ne=Ce(),_e=kZe([A]),Ue=mr(_e,4),qe=Ue[0],Fe=Ue[1],He=Ue[2],Le=Ue[3],Ye=function(An){Fe(!0),ae==null||ae(An,{})},lt=function(An){Fe(!1),Z==null||Z(An,{})},Oe=IA(N,{value:E}),ut=mr(Oe,2),ht=ut[0],Qe=ut[1],nt=ht==="date"&&F?"datetime":ht,mt=BZe(N,ht,U,W),tt=C&&function(Eo,An){C(ce(Eo),ce(An))},gt=jZe(Wi(Wi({},r),{},{onChange:tt}),Se,Me,Ce,Te,[],l,qe,ve,c),Ve=mr(gt,2),je=Ve[1],et=vZe(Ne,c),bt=mr(et,2),St=bt[0],Pt=bt[1],Yt=g.useMemo(function(){return St.some(function(Eo){return Eo})},[St]),zt=function(An,Dn){if(Q){var sr=Wi(Wi({},Dn),{},{mode:Dn.mode[0]});delete sr.range,Q(An[0],sr)}},Rt=FZe(k,D,Ne,[ht],ve,Le,i,!1,_,G,BS(F==null?void 0:F.defaultOpenValue),zt,v,b),Ct=mr(Rt,2),yt=Ct[0],at=Ct[1],Et=$0(function(Eo,An,Dn){if(Qe(An),L&&Dn!==!1){var sr=Eo||Ne[Ne.length-1];L(sr,An)}}),Lt=function(){je(Ce()),ze(!1,{force:!0})},Je=function(An){!A&&!me.current.nativeElement.contains(document.activeElement)&&me.current.focus(),ze(!0),he==null||he(An)},st=function(){je(null),ze(!1,{force:!0})},It=g.useState(null),ot=mr(It,2),it=ot[0],Be=ot[1],pt=g.useState(null),ct=mr(pt,2),Xe=ct[0],ft=ct[1],wt=g.useMemo(function(){var Eo=[Xe].concat(N1(Ne)).filter(function(An){return An});return O?Eo:Eo.slice(0,1)},[Ne,Xe,O]),kt=g.useMemo(function(){return!O&&Xe?[Xe]:Ne.filter(function(Eo){return Eo})},[Ne,Xe,O]);g.useEffect(function(){ve||ft(null)},[ve]);var Zt=EZe(ne),Ot=function(An){ft(An),Be("preset")},on=function(An){var Dn=O?Pe(Ce(),An):[An],sr=je(Dn);sr&&!O&&ze(!1,{force:!0})},qt=function(An){on(An)},rn=function(An){ft(An),Be("cell")},Pn=function(An){ze(!0),Ye(An)},fo=function(An){if(He("panel"),!(O&&nt!==N)){var Dn=O?Pe(Ce(),An):[An];Te(Dn),!x&&!a&&i===nt&&Lt()}},to=function(){ze(!1)},Dt=W9e($,le,de),fn=g.useMemo(function(){var Eo=k9e(r,!1),An=fZe(r,[].concat(N1(Object.keys(Eo)),["onChange","onCalendarChange","style","className","onPanelChange"]));return Wi(Wi({},An),{},{multiple:r.multiple})},[r]),kn=g.createElement(_Ze,Yl({},fn,{showNow:mt,showTime:F,disabledDate:S,onFocus:Pn,onBlur:lt,picker:N,mode:ht,internalMode:nt,onPanelChange:Et,format:s,value:Ne,isInvalid:c,onChange:null,onSelect:fo,pickerValue:yt,defaultOpenValue:F==null?void 0:F.defaultOpenValue,onPickerValueChange:at,hoverValue:wt,onHover:rn,needConfirm:x,onSubmit:Lt,onOk:Re,presets:Zt,onPresetHover:Ot,onPresetSubmit:on,onNow:qt,cellRender:Dt})),yo=function(An){Te(An)},ur=function(){He("input")},lr=function(An){He("input"),ze(!0,{inherit:!0}),Ye(An)},xo=function(An){ze(!1),lt(An)},wo=function(An,Dn){An.key==="Tab"&&Lt(),P==null||P(An,Dn)},Rr=g.useMemo(function(){return{prefixCls:d,locale:D,generateConfig:k,button:te.button,input:te.input}},[d,D,k,te.button,te.input]);return ZA(function(){ve&&Le!==void 0&&Et(null,N,!1)},[ve,Le,N]),ZA(function(){var Eo=He();!ve&&Eo==="input"&&(ze(!1),Lt()),!ve&&a&&!x&&Eo==="panel"&&(ze(!0),Lt())},[ve]),g.createElement(V5.Provider,{value:Rr},g.createElement(yZe,Yl({},xZe(r),{popupElement:kn,popupStyle:f.popup,popupClassName:p.popup,visible:ve,onClose:to}),g.createElement(mGt,Yl({},r,{ref:me,suffixIcon:ee,removeIcon:q,activeHelp:!!Xe,allHelp:!!Xe&&it==="preset",focused:qe,onFocus:lr,onBlur:xo,onKeyDown:wo,onSubmit:Lt,value:kt,maskFormat:s,onChange:yo,onInputChange:ur,internalPicker:i,format:l,inputReadOnly:oe,disabled:A,open:ve,onOpenChange:ze,onClick:Je,onClear:st,invalid:Yt,onInvalid:function(An){Pt(An,0)}}))))}var AGt=g.forwardRef(yGt);const XZe=g.createContext(null),wGt=XZe.Provider,JZe=g.createContext(null),xGt=JZe.Provider;var vGt=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],KZe=g.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-checkbox":n,r=t.className,i=t.style,a=t.checked,l=t.disabled,s=t.defaultChecked,c=s===void 0?!1:s,u=t.type,d=u===void 0?"checkbox":u,f=t.title,p=t.onChange,m=Ai(t,vGt),y=g.useRef(null),w=g.useRef(null),x=o0(c,{value:a}),C=Sn(x,2),P=C[0],A=C[1];g.useImperativeHandle(e,function(){return{focus:function(T){var R;(R=y.current)===null||R===void 0||R.focus(T)},blur:function(){var T;(T=y.current)===null||T===void 0||T.blur()},input:y.current,nativeElement:w.current}});var S=Bn(o,r,Ut(Ut({},"".concat(o,"-checked"),P),"".concat(o,"-disabled"),l)),v=function(T){l||("checked"in t||A(T.target.checked),p==null||p({target:nn(nn({},t),{},{type:d,checked:T.target.checked}),stopPropagation:function(){T.stopPropagation()},preventDefault:function(){T.preventDefault()},nativeEvent:T.nativeEvent}))};return g.createElement("span",{className:S,title:f,style:i,ref:w},g.createElement("input",Uo({},m,{className:"".concat(o,"-input"),ref:y,onChange:v,disabled:l,checked:!!P,type:d})),g.createElement("span",{className:"".concat(o,"-inner")}))});function $Ze(t){const e=xe.useRef(null),n=()=>{Hf.cancel(e.current),e.current=null};return[()=>{n(),e.current=Hf(()=>{e.current=null})},i=>{e.current&&(i.stopPropagation(),n()),t==null||t(i)}]}const bGt=t=>{const{componentCls:e,antCls:n}=t,o=`${e}-group`;return{[o]:Object.assign(Object.assign({},Ua(t)),{display:"inline-block",fontSize:0,[`&${o}-rtl`]:{direction:"rtl"},[`&${o}-block`]:{display:"flex"},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:"none"}})}},SGt=t=>{const{componentCls:e,wrapperMarginInlineEnd:n,colorPrimary:o,radioSize:r,motionDurationSlow:i,motionDurationMid:a,motionEaseInOutCirc:l,colorBgContainer:s,colorBorder:c,lineWidth:u,colorBgContainerDisabled:d,colorTextDisabled:f,paddingXS:p,dotColorDisabled:m,lineType:y,radioColor:w,radioBgColor:x,calc:C}=t,P=`${e}-inner`,S=C(r).sub(C(4).mul(2)),v=C(1).mul(r).equal({unit:!0});return{[`${e}-wrapper`]:Object.assign(Object.assign({},Ua(t)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer","&:last-child":{marginInlineEnd:0},[`&${e}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:t.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},"&-block":{flex:1,justifyContent:"center"},[`${e}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${jt(u)} ${y} ${o}`,borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),[`${e}-wrapper:hover &, + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,hVt="".concat(dVt," ").concat(fVt).split(/[\s\n]+/),pVt="aria-",gVt="data-";function bPe(t,e){return t.indexOf(e)===0}function k9e(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=iVt({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||bPe(r,pVt))||n.data&&bPe(r,gVt)||n.attr&&hVt.includes(r))&&(o[r]=t[r])}),o}const mVt=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1};var hZe=function(e){return+setTimeout(e,16)},pZe=function(e){return clearTimeout(e)};typeof window<"u"&&"requestAnimationFrame"in window&&(hZe=function(e){return window.requestAnimationFrame(e)},pZe=function(e){return window.cancelAnimationFrame(e)});var SPe=0,F9e=new Map;function gZe(t){F9e.delete(t)}var m3=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;SPe+=1;var o=SPe;function r(i){if(i===0)gZe(o),e();else{var a=hZe(function(){r(i-1)});F9e.set(o,a)}}return r(n),o};m3.cancel=function(t){var e=F9e.get(t);return gZe(t),pZe(e)};function oee(t,e){return t!==void 0?t:e?"bottomRight":"bottomLeft"}function mZe(t,e){var n=oee(t,e),o=n==null?void 0:n.toLowerCase().endsWith("right"),r=o?"insetInlineEnd":"insetInlineStart";return e&&(r=["insetInlineStart","insetInlineEnd"].find(function(i){return i!==r})),r}var V5=g.createContext(null),yVt={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}};function yZe(t){var e=t.popupElement,n=t.popupStyle,o=t.popupClassName,r=t.popupAlign,i=t.transitionName,a=t.getPopupContainer,l=t.children,s=t.range,c=t.placement,u=t.builtinPlacements,d=u===void 0?yVt:u,f=t.direction,p=t.visible,m=t.onClose,y=g.useContext(V5),w=y.prefixCls,x="".concat(w,"-dropdown"),C=oee(c,f==="rtl");return g.createElement(eI,{showAction:[],hideAction:["click"],popupPlacement:C,builtinPlacements:d,prefixCls:x,popupTransitionName:i,popup:e,popupAlign:r,popupVisible:p,popupClassName:Bn(o,Na(Na({},"".concat(x,"-range"),s),"".concat(x,"-rtl"),f==="rtl")),popupStyle:n,stretch:"minWidth",getPopupContainer:a,onPopupVisibleChange:function(A){A||m()}},l)}function L9e(t,e){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0",o=String(t);o.length2&&arguments[2]!==void 0?arguments[2]:[],o=g.useState([!1,!1]),r=mr(o,2),i=r[0],a=r[1],l=function(u,d){a(function(f){return Ok(f,d,u)})},s=g.useMemo(function(){return i.map(function(c,u){if(c)return!0;var d=t[u];return d?!!(!n[u]&&!d||d&&e(d,{activeIndex:u})):!1})},[t,i,e,n]);return[s,l]}function bZe(t,e,n,o,r){var i="",a=[];return t&&a.push(r?"hh":"HH"),e&&a.push("mm"),n&&a.push("ss"),i=a.join(":"),o&&(i+=".SSS"),r&&(i+=" A"),i}function AVt(t,e,n,o,r,i){var a=t.fieldDateTimeFormat,l=t.fieldDateFormat,s=t.fieldTimeFormat,c=t.fieldMonthFormat,u=t.fieldYearFormat,d=t.fieldWeekFormat,f=t.fieldQuarterFormat,p=t.yearFormat,m=t.cellYearFormat,y=t.cellQuarterFormat,w=t.dayFormat,x=t.cellDateFormat,C=bZe(e,n,o,r,i);return Wi(Wi({},t),{},{fieldDateTimeFormat:a||"YYYY-MM-DD ".concat(C),fieldDateFormat:l||"YYYY-MM-DD",fieldTimeFormat:s||C,fieldMonthFormat:c||"YYYY-MM",fieldYearFormat:u||"YYYY",fieldWeekFormat:d||"gggg-wo",fieldQuarterFormat:f||"YYYY-[Q]Q",yearFormat:p||"YYYY",cellYearFormat:m||"YYYY",cellQuarterFormat:y||"[Q]Q",cellDateFormat:x||w||"D"})}function SZe(t,e){var n=e.showHour,o=e.showMinute,r=e.showSecond,i=e.showMillisecond,a=e.use12Hours;return xe.useMemo(function(){return AVt(t,n,o,r,i,a)},[t,n,o,r,i,a])}function eE(t,e,n){return n??e.some(function(o){return t.includes(o)})}var wVt=["showNow","showHour","showMinute","showSecond","showMillisecond","use12Hours","hourStep","minuteStep","secondStep","millisecondStep","hideDisabledOptions","defaultValue","disabledHours","disabledMinutes","disabledSeconds","disabledMilliseconds","disabledTime","changeOnScroll","defaultOpenValue"];function xVt(t){var e=ree(t,wVt),n=t.format,o=t.picker,r=null;return n&&(r=n,Array.isArray(r)&&(r=r[0]),r=M3(r)==="object"?r.format:r),o==="time"&&(e.format=r),[e,r]}function vVt(t){return t&&typeof t=="string"}function TZe(t,e,n,o){return[t,e,n,o].some(function(r){return r!==void 0})}function PZe(t,e,n,o,r){var i=e,a=n,l=o;if(!t&&!i&&!a&&!l&&!r)i=!0,a=!0,l=!0;else if(t){var s,c,u,d=[i,a,l].some(function(m){return m===!1}),f=[i,a,l].some(function(m){return m===!0}),p=d?!0:!f;i=(s=i)!==null&&s!==void 0?s:p,a=(c=a)!==null&&c!==void 0?c:p,l=(u=l)!==null&&u!==void 0?u:p}return[i,a,l,r]}function CZe(t){var e=t.showTime,n=xVt(t),o=mr(n,2),r=o[0],i=o[1],a=e&&M3(e)==="object"?e:{},l=Wi(Wi({defaultOpenValue:a.defaultOpenValue||a.defaultValue},r),a),s=l.showMillisecond,c=l.showHour,u=l.showMinute,d=l.showSecond,f=TZe(c,u,d,s),p=PZe(f,c,u,d,s),m=mr(p,3);return c=m[0],u=m[1],d=m[2],[l,Wi(Wi({},l),{},{showHour:c,showMinute:u,showSecond:d,showMillisecond:s}),l.format,i]}function RZe(t,e,n,o,r){var i=t==="time";if(t==="datetime"||i){for(var a=o,l=AZe(t,r,null),s=l,c=[e,n],u=0;u1&&(a=e.addDate(a,-7)),a}function G0(t,e){var n=e.generateConfig,o=e.locale,r=e.format;return t?typeof r=="function"?r(t):n.locale.format(o.locale,t,r):""}function dJ(t,e,n){var o=e,r=["getHour","getMinute","getSecond","getMillisecond"],i=["setHour","setMinute","setSecond","setMillisecond"];return i.forEach(function(a,l){n?o=t[a](o,t[r[l]](n)):o=t[a](o,0)}),o}function PVt(t,e,n,o,r){var i=$0(function(a,l){return!!(n&&n(a,l)||o&&t.isAfter(o,a)&&!Rh(t,e,o,a,l.type)||r&&t.isAfter(a,r)&&!Rh(t,e,r,a,l.type))});return i}function CVt(t,e,n){return g.useMemo(function(){var o=AZe(t,e,n),r=BS(o),i=r[0],a=M3(i)==="object"&&i.type==="mask"?i.format:null;return[r.map(function(l){return typeof l=="string"||typeof l=="function"?l:l.format}),a]},[t,e,n])}function RVt(t,e,n){return typeof t[0]=="function"||n?!0:e}function HVt(t,e,n,o){var r=$0(function(i,a){var l=Wi({type:e},a);if(delete l.activeIndex,!t.isValidate(i)||n&&n(i,l))return!0;if((e==="date"||e==="time")&&o){var s,c=a&&a.activeIndex===1?"end":"start",u=((s=o.disabledTime)===null||s===void 0?void 0:s.call(o,i,c,{from:l.from}))||{},d=u.disabledHours,f=u.disabledMinutes,p=u.disabledSeconds,m=u.disabledMilliseconds,y=o.disabledHours,w=o.disabledMinutes,x=o.disabledSeconds,C=d||y,P=f||w,A=p||x,S=t.getHour(i),v=t.getMinute(i),b=t.getSecond(i),T=t.getMillisecond(i);if(C&&C().includes(S)||P&&P(S).includes(v)||A&&A(S,v).includes(b)||m&&m(S,v,b).includes(T))return!0}return!1});return r}function GO(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=g.useMemo(function(){var o=t&&BS(t);return e&&o&&(o[1]=o[1]||o[0]),o},[t,e]);return n}function IZe(t,e){var n=t.generateConfig,o=t.locale,r=t.picker,i=r===void 0?"date":r,a=t.prefixCls,l=a===void 0?"rc-picker":a,s=t.styles,c=s===void 0?{}:s,u=t.classNames,d=u===void 0?{}:u,f=t.order,p=f===void 0?!0:f,m=t.components,y=m===void 0?{}:m,w=t.inputRender,x=t.allowClear,C=t.clearIcon,P=t.needConfirm,A=t.multiple,S=t.format,v=t.inputReadOnly,b=t.disabledDate,T=t.minDate,R=t.maxDate,M=t.showTime,D=t.value,k=t.defaultValue,N=t.pickerValue,U=t.defaultPickerValue,W=GO(D),F=GO(k),E=GO(N),L=GO(U),j=i==="date"&&M?"datetime":i,Y=j==="time"||j==="datetime",O=Y||A,_=P??Y,G=CZe(t),Q=mr(G,4),oe=Q[0],ee=Q[1],$=Q[2],ae=Q[3],Z=SZe(o,ee),ne=g.useMemo(function(){return RZe(j,$,ae,oe,Z)},[j,$,ae,oe,Z]),te=g.useMemo(function(){return Wi(Wi({},t),{},{prefixCls:l,locale:Z,picker:i,styles:c,classNames:d,order:p,components:Wi({input:w},y),clearIcon:bVt(l,x,C),showTime:ne,value:W,defaultValue:F,pickerValue:E,defaultPickerValue:L},e==null?void 0:e())},[t]),q=CVt(j,Z,S),le=mr(q,2),de=le[0],he=le[1],me=RVt(de,v,A),ce=PVt(n,o,b,T,R),Pe=HVt(n,i,ce,ne),pe=g.useMemo(function(){return Wi(Wi({},te),{},{needConfirm:_,inputReadOnly:me,disabledDate:ce})},[te,_,me,ce]);return[pe,j,O,de,he,Pe]}function MVt(t,e,n){var o=IA(e,{value:t}),r=mr(o,2),i=r[0],a=r[1],l=xe.useRef(t),s=xe.useRef(),c=function(){m3.cancel(s.current)},u=$0(function(){a(l.current),n&&i!==l.current&&n(l.current)}),d=$0(function(f,p){c(),l.current=f,f||p?u():s.current=m3(u)});return xe.useEffect(function(){return c},[]),[i,d]}function zZe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0,r=n.every(function(u){return u})?!1:t,i=MVt(r,e||!1,o),a=mr(i,2),l=a[0],s=a[1];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!d.inherit||l)&&s(u,d.force)}return[l,c]}function DZe(t){var e=g.useRef();return g.useImperativeHandle(t,function(){var n;return{nativeElement:(n=e.current)===null||n===void 0?void 0:n.nativeElement,focus:function(r){var i;(i=e.current)===null||i===void 0||i.focus(r)},blur:function(){var r;(r=e.current)===null||r===void 0||r.blur()}}}),e}function EZe(t,e){return g.useMemo(function(){return t||(e?(nee(!1,"`ranges` is deprecated. Please use `presets` instead."),Object.entries(e).map(function(n){var o=mr(n,2),r=o[0],i=o[1];return{label:r,value:i}})):[])},[t,e])}function j9e(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,o=g.useRef(e);o.current=e,Hhe(function(){if(t)o.current(t);else{var r=m3(function(){o.current(t)},n);return function(){m3.cancel(r)}}},[t])}function kZe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=g.useState(0),r=mr(o,2),i=r[0],a=r[1],l=g.useState(!1),s=mr(l,2),c=s[0],u=s[1],d=g.useRef([]),f=g.useRef(null),p=g.useRef(null),m=function(A){f.current=A},y=function(A){return f.current===A},w=function(A){u(A)},x=function(A){return A&&(p.current=A),p.current},C=function(A){var S=d.current,v=new Set(S.filter(function(T){return A[T]||e[T]})),b=S[S.length-1]===0?1:0;return v.size>=2||t[b]?null:b};return j9e(c||n,function(){c||(d.current=[],m(null))}),g.useEffect(function(){c&&d.current.push(i)},[c,i]),[c,w,x,i,a,C,d.current,m,y]}function IVt(t,e,n,o,r,i){var a=n[n.length-1],l=function(c,u){var d=mr(t,2),f=d[0],p=d[1],m=Wi(Wi({},u),{},{from:wZe(t,n)});return a===1&&e[0]&&f&&!Rh(o,r,f,c,m.type)&&o.isAfter(f,c)||a===0&&e[1]&&p&&!Rh(o,r,p,c,m.type)&&o.isAfter(c,p)?!0:i==null?void 0:i(c,m)};return l}function qE(t,e,n,o){switch(e){case"date":case"week":return t.addMonth(n,o);case"month":case"quarter":return t.addYear(n,o);case"year":return t.addYear(n,o*10);case"decade":return t.addYear(n,o*100);default:return n}}var Jle=[];function FZe(t,e,n,o,r,i,a,l){var s=arguments.length>8&&arguments[8]!==void 0?arguments[8]:Jle,c=arguments.length>9&&arguments[9]!==void 0?arguments[9]:Jle,u=arguments.length>10&&arguments[10]!==void 0?arguments[10]:Jle,d=arguments.length>11?arguments[11]:void 0,f=arguments.length>12?arguments[12]:void 0,p=arguments.length>13?arguments[13]:void 0,m=a==="time",y=i||0,w=function(E){var L=t.getNow();return m&&(L=dJ(t,L)),s[E]||n[E]||L},x=mr(c,2),C=x[0],P=x[1],A=IA(function(){return w(0)},{value:C}),S=mr(A,2),v=S[0],b=S[1],T=IA(function(){return w(1)},{value:P}),R=mr(T,2),M=R[0],D=R[1],k=g.useMemo(function(){var F=[v,M][y];return m?F:dJ(t,F,u[y])},[m,v,M,y,t,u]),N=function(E){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"panel",j=[b,D][y];j(E);var Y=[v,M];Y[y]=E,d&&(!Rh(t,e,v,Y[0],a)||!Rh(t,e,M,Y[1],a))&&d(Y,{source:L,range:y===1?"end":"start",mode:o})},U=function(E,L){if(l){var j={date:"month",week:"month",month:"year",quarter:"year"},Y=j[a];if(Y&&!Rh(t,e,E,L,Y))return qE(t,a,L,-1);if(a==="year"&&E){var O=Math.floor(t.getYear(E)/10),_=Math.floor(t.getYear(L)/10);if(O!==_)return qE(t,a,L,-1)}}return L},W=g.useRef(null);return ZA(function(){if(r&&!s[y]){var F=m?null:t.getNow();if(W.current!==null&&W.current!==y?F=[v,M][y^1]:n[y]?F=y===0?n[0]:U(n[0],n[1]):n[y^1]&&(F=n[y^1]),F){f&&t.isAfter(f,F)&&(F=f);var E=l?qE(t,a,F,1):F;p&&t.isAfter(E,p)&&(F=l?qE(t,a,p,-1):p),N(F,"reset")}}},[r,y,n[y]]),g.useEffect(function(){r?W.current=y:W.current=null},[r,y]),ZA(function(){r&&s&&s[y]&&N(s[y],"reset")},[r,y]),[k,N]}function LZe(t,e){var n=g.useRef(t),o=g.useState({}),r=mr(o,2),i=r[1],a=function(c){return c&&e!==void 0?e:n.current},l=function(c){n.current=c,i({})};return[a,l,a(!0)]}var zVt=[];function WZe(t,e,n){var o=function(a){return a.map(function(l){return G0(l,{generateConfig:t,locale:e,format:n[0]})})},r=function(a,l){for(var s=Math.max(a.length,l.length),c=-1,u=0;u2&&arguments[2]!==void 0?arguments[2]:1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:2,a=[],l=n>=1?n|0:1,s=t;s<=e;s+=l){var c=r.includes(s);(!c||!o)&&a.push({label:L9e(s,i),value:s,disabled:c})}return a}function B9e(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,o=e||{},r=o.use12Hours,i=o.hourStep,a=i===void 0?1:i,l=o.minuteStep,s=l===void 0?1:l,c=o.secondStep,u=c===void 0?1:c,d=o.millisecondStep,f=d===void 0?100:d,p=o.hideDisabledOptions,m=o.disabledTime,y=o.disabledHours,w=o.disabledMinutes,x=o.disabledSeconds,C=g.useMemo(function(){return n||t.getNow()},[n,t]),P=g.useCallback(function(L){var j=(m==null?void 0:m(L))||{};return[j.disabledHours||y||XO,j.disabledMinutes||w||XO,j.disabledSeconds||x||XO,j.disabledMilliseconds||XO]},[m,y,w,x]),A=g.useMemo(function(){return P(C)},[C,P]),S=mr(A,4),v=S[0],b=S[1],T=S[2],R=S[3],M=g.useCallback(function(L,j,Y,O){var _=JO(0,23,a,p,L()),G=r?_.map(function($){return Wi(Wi({},$),{},{label:L9e($.value%12||12,2)})}):_,Q=function(ae){return JO(0,59,s,p,j(ae))},oe=function(ae,Z){return JO(0,59,u,p,Y(ae,Z))},ee=function(ae,Z,ne){return JO(0,999,f,p,O(ae,Z,ne),3)};return[G,Q,oe,ee]},[p,a,r,f,s,u]),D=g.useMemo(function(){return M(v,b,T,R)},[M,v,b,T,R]),k=mr(D,4),N=k[0],U=k[1],W=k[2],F=k[3],E=function(j,Y){var O=function(){return N},_=U,G=W,Q=F;if(Y){var oe=P(Y),ee=mr(oe,4),$=ee[0],ae=ee[1],Z=ee[2],ne=ee[3],te=M($,ae,Z,ne),q=mr(te,4),le=q[0],de=q[1],he=q[2],me=q[3];O=function(){return le},_=de,G=he,Q=me}var ce=EVt(j,O,_,G,Q,t);return ce};return[E,N,U,W,F]}function kVt(t){var e=t.mode,n=t.internalMode,o=t.renderExtraFooter,r=t.showNow,i=t.showTime,a=t.onSubmit,l=t.onNow,s=t.invalid,c=t.needConfirm,u=t.generateConfig,d=t.disabledDate,f=g.useContext(V5),p=f.prefixCls,m=f.locale,y=f.button,w=y===void 0?"button":y,x=u.getNow(),C=B9e(u,i,x),P=mr(C,1),A=P[0],S=o==null?void 0:o(e),v=d(x,{type:e}),b=function(){if(!v){var U=A(x);l(U)}},T="".concat(p,"-now"),R="".concat(T,"-btn"),M=r&&g.createElement("li",{className:T},g.createElement("a",{className:Bn(R,v&&"".concat(R,"-disabled")),"aria-disabled":v,onClick:b},n==="date"?m.today:m.now)),D=c&&g.createElement("li",{className:"".concat(p,"-ok")},g.createElement(w,{disabled:s,onClick:a},m.ok)),k=(M||D)&&g.createElement("ul",{className:"".concat(p,"-ranges")},M,D);return!S&&!k?null:g.createElement("div",{className:"".concat(p,"-footer")},S&&g.createElement("div",{className:"".concat(p,"-footer-extra")},S),k)}function YZe(t,e,n){function o(r,i){var a=r.findIndex(function(s){return Rh(t,e,s,i,n)});if(a===-1)return[].concat(N1(r),[i]);var l=N1(r);return l.splice(a,1),l}return o}var YS=g.createContext(null);function aee(){return g.useContext(YS)}function iI(t,e){var n=t.prefixCls,o=t.generateConfig,r=t.locale,i=t.disabledDate,a=t.minDate,l=t.maxDate,s=t.cellRender,c=t.hoverValue,u=t.hoverRangeValue,d=t.onHover,f=t.values,p=t.pickerValue,m=t.onSelect,y=t.prevIcon,w=t.nextIcon,x=t.superPrevIcon,C=t.superNextIcon,P=o.getNow(),A={now:P,values:f,pickerValue:p,prefixCls:n,disabledDate:i,minDate:a,maxDate:l,cellRender:s,hoverValue:c,hoverRangeValue:u,onHover:d,locale:r,generateConfig:o,onSelect:m,panelType:e,prevIcon:y,nextIcon:w,superPrevIcon:x,superNextIcon:C};return[A,P]}var E8=g.createContext({});function AU(t){for(var e=t.rowNum,n=t.colNum,o=t.baseDate,r=t.getCellDate,i=t.prefixColumn,a=t.rowClassName,l=t.titleFormat,s=t.getCellText,c=t.getCellClassName,u=t.headerCells,d=t.cellSelection,f=d===void 0?!0:d,p=t.disabledDate,m=aee(),y=m.prefixCls,w=m.panelType,x=m.now,C=m.disabledDate,P=m.cellRender,A=m.onHover,S=m.hoverValue,v=m.hoverRangeValue,b=m.generateConfig,T=m.values,R=m.locale,M=m.onSelect,D=p||C,k="".concat(y,"-cell"),N=g.useContext(E8),U=N.onCellDblClick,W=function(G){return T.some(function(Q){return Q&&Rh(b,R,G,Q,w)})},F=[],E=0;E1&&arguments[1]!==void 0?arguments[1]:!1;ze(qe),w==null||w(qe),Fe&&Ae(qe)},ge=function(qe,Fe){Z(qe),Fe&&se(Fe),Ae(Fe,qe)},we=function(qe){if(Pe(qe),se(qe),ae!==A){var Fe=["decade","year"],He=[].concat(Fe,["month"]),Le={quarter:[].concat(Fe,["quarter"]),week:[].concat(N1(He),["week"]),date:[].concat(N1(He),["date"])},Ye=Le[A]||He,lt=Ye.indexOf(ae),Oe=Ye[lt+1];Oe&&ge(Oe,qe)}},Se=g.useMemo(function(){var Ue,qe;if(Array.isArray(b)){var Fe=mr(b,2);Ue=Fe[0],qe=Fe[1]}else Ue=b;return!Ue&&!qe?null:(Ue=Ue||qe,qe=qe||Ue,r.isAfter(Ue,qe)?[qe,Ue]:[Ue,qe])},[b,r]),Me=W9e(T,R,M),Ce=k[ne]||GVt[ne]||lee,Te=g.useContext(E8),Re=g.useMemo(function(){return Wi(Wi({},Te),{},{hideHeader:N})},[Te,N]),Ne="".concat(U,"-panel"),_e=ree(t,["showWeek","prevIcon","nextIcon","superPrevIcon","superNextIcon","disabledDate","minDate","maxDate","onHover"]);return g.createElement(E8.Provider,{value:Re},g.createElement("div",{ref:W,tabIndex:s,className:Bn(Ne,Na({},"".concat(Ne,"-rtl"),i==="rtl"))},g.createElement(Ce,Yl({},_e,{showTime:Q,prefixCls:U,locale:_,generateConfig:r,onModeChange:ge,pickerValue:ve,onPickerValueChange:function(qe){se(qe,!0)},value:me[0],onSelect:we,values:me,cellRender:Me,hoverRangeValue:Se,hoverValue:v}))))}var Kle=g.memo(g.forwardRef(XVt));function JVt(t){var e=t.picker,n=t.multiplePanel,o=t.pickerValue,r=t.onPickerValueChange,i=t.needConfirm,a=t.onSubmit,l=t.range,s=t.hoverValue,c=g.useContext(V5),u=c.prefixCls,d=c.generateConfig,f=g.useCallback(function(C,P){return qE(d,e,C,P)},[d,e]),p=g.useMemo(function(){return f(o,1)},[o,f]),m=function(P){r(f(P,-1))},y={onCellDblClick:function(){i&&a()}},w=e==="time",x=Wi(Wi({},t),{},{hoverValue:null,hoverRangeValue:null,hideHeader:w});return l?x.hoverRangeValue=s:x.hoverValue=s,n?g.createElement("div",{className:"".concat(u,"-panels")},g.createElement(E8.Provider,{value:Wi(Wi({},y),{},{hideNext:!0})},g.createElement(Kle,x)),g.createElement(E8.Provider,{value:Wi(Wi({},y),{},{hidePrev:!0})},g.createElement(Kle,Yl({},x,{pickerValue:p,onPickerValueChange:m})))):g.createElement(E8.Provider,{value:Wi({},y)},g.createElement(Kle,x))}function PPe(t){return typeof t=="function"?t():t}function KVt(t){var e=t.prefixCls,n=t.presets,o=t.onClick,r=t.onHover;return n.length?g.createElement("div",{className:"".concat(e,"-presets")},g.createElement("ul",null,n.map(function(i,a){var l=i.label,s=i.value;return g.createElement("li",{key:a,onClick:function(){o(PPe(s))},onMouseEnter:function(){r(PPe(s))},onMouseLeave:function(){r(null)}},l)}))):null}function _Ze(t){var e=t.panelRender,n=t.internalMode,o=t.picker,r=t.showNow,i=t.range,a=t.multiple,l=t.activeOffset,s=l===void 0?0:l,c=t.placement,u=t.presets,d=t.onPresetHover,f=t.onPresetSubmit,p=t.onFocus,m=t.onBlur,y=t.onPanelMouseDown,w=t.direction,x=t.value,C=t.onSelect,P=t.isInvalid,A=t.defaultOpenValue,S=t.onOk,v=t.onSubmit,b=g.useContext(V5),T=b.prefixCls,R="".concat(T,"-panel"),M=w==="rtl",D=g.useRef(null),k=g.useRef(null),N=g.useState(0),U=mr(N,2),W=U[0],F=U[1],E=g.useState(0),L=mr(E,2),j=L[0],Y=L[1],O=function(ce){ce.offsetWidth&&F(ce.offsetWidth)};g.useEffect(function(){if(i){var me,ce=((me=D.current)===null||me===void 0?void 0:me.offsetWidth)||0,Pe=W-ce;s<=Pe?Y(0):Y(s+ce-W)}},[W,s,i]);function _(me){return me.filter(function(ce){return ce})}var G=g.useMemo(function(){return _(BS(x))},[x]),Q=o==="time"&&!G.length,oe=g.useMemo(function(){return Q?_([A]):G},[Q,G,A]),ee=Q?A:G,$=g.useMemo(function(){return oe.length?oe.some(function(me){return P(me)}):!0},[oe,P]),ae=function(){Q&&C(A),S(),v()},Z=g.createElement("div",{className:"".concat(T,"-panel-layout")},g.createElement(KVt,{prefixCls:T,presets:u,onClick:f,onHover:d}),g.createElement("div",null,g.createElement(JVt,Yl({},t,{value:ee})),g.createElement(kVt,Yl({},t,{showNow:a?!1:r,invalid:$,onSubmit:ae}))));e&&(Z=e(Z));var ne="".concat(R,"-container"),te="marginLeft",q="marginRight",le=g.createElement("div",{onMouseDown:y,tabIndex:-1,className:Bn(ne,"".concat(T,"-").concat(n,"-panel-container")),style:Na(Na({},M?q:te,j),M?te:q,"auto"),onFocus:p,onBlur:m},Z);if(i){var de=oee(c,M),he=mZe(de,M);le=g.createElement("div",{onMouseDown:y,ref:k,className:Bn("".concat(T,"-range-wrapper"),"".concat(T,"-").concat(o,"-range-wrapper"))},g.createElement("div",{ref:D,className:"".concat(T,"-range-arrow"),style:Na({},he,s)}),g.createElement(Ld,{onResize:O},le))}return le}function $Vt(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.indexOf(o)!==-1)continue;n[o]=t[o]}return n}function mb(t,e){if(t==null)return{};var n,o,r=$Vt(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o=l&&n<=s)return i;var c=Math.min(Math.abs(n-l),Math.abs(n-s));c0?tt:gt));var bt=et+Qe,St=gt-tt+1;return String(tt+(St+bt-tt)%St)};switch(qe){case"Backspace":case"Delete":Fe="",He=Ye;break;case"ArrowLeft":Fe="",lt(-1);break;case"ArrowRight":Fe="",lt(1);break;case"ArrowUp":Fe="",He=Oe(1);break;case"ArrowDown":Fe="",He=Oe(-1);break;default:isNaN(Number(qe))||(Fe=O+qe,He=Fe);break}if(Fe!==null&&(_(Fe),Fe.length>=Le&&(lt(1),_(""))),He!==null){var ut=te.slice(0,ce)+L9e(He,Le)+te.slice(Pe);Ie(ut.slice(0,a.length))}ne({})},Re=g.useRef();ZA(function(){if(!(!N||!a||Ae.current)){if(!de.match(te)){Ie(a);return}return le.current.setSelectionRange(ce,Pe),Re.current=m3(function(){le.current.setSelectionRange(ce,Pe)}),function(){m3.cancel(Re.current)}}},[de,a,N,te,oe,ce,Pe,Z,Ie]);var Ne=a?{onFocus:we,onBlur:Me,onKeyDown:Te,onMouseDown:se,onMouseUp:ge,onPaste:ze}:{};return g.createElement("div",{ref:q,className:Bn(M,Na(Na({},"".concat(M,"-active"),n&&r),"".concat(M,"-placeholder"),c))},g.createElement(R,Yl({ref:le,"aria-invalid":y,autoComplete:"off"},x,{onKeyDown:Ce,onBlur:Se},Ne,{value:te,onChange:ve})),g.createElement(see,{type:"suffix",icon:i}),w)}),aGt=["id","prefix","clearIcon","suffixIcon","separator","activeIndex","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","value","onChange","onSubmit","onInputChange","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onActiveOffset","placement","onMouseDown","required","aria-required","autoFocus","tabIndex"],lGt=["index"],sGt=["insetInlineStart","insetInlineEnd"];function cGt(t,e){var n=t.id,o=t.prefix,r=t.clearIcon,i=t.suffixIcon,a=t.separator,l=a===void 0?"~":a,s=t.activeIndex;t.activeHelp,t.allHelp;var c=t.focused;t.onFocus,t.onBlur,t.onKeyDown,t.locale,t.generateConfig;var u=t.placeholder,d=t.className,f=t.style,p=t.onClick,m=t.onClear,y=t.value;t.onChange,t.onSubmit,t.onInputChange,t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var w=t.disabled,x=t.invalid;t.inputReadOnly;var C=t.direction;t.onOpenChange;var P=t.onActiveOffset,A=t.placement,S=t.onMouseDown;t.required,t["aria-required"];var v=t.autoFocus,b=t.tabIndex,T=mb(t,aGt),R=C==="rtl",M=g.useContext(V5),D=M.prefixCls,k=g.useMemo(function(){if(typeof n=="string")return[n];var le=n||{};return[le.start,le.end]},[n]),N=g.useRef(),U=g.useRef(),W=g.useRef(),F=function(de){var he;return(he=[U,W][de])===null||he===void 0?void 0:he.current};g.useImperativeHandle(e,function(){return{nativeElement:N.current,focus:function(de){if(M3(de)==="object"){var he,me=de||{},ce=me.index,Pe=ce===void 0?0:ce,pe=mb(me,lGt);(he=F(Pe))===null||he===void 0||he.focus(pe)}else{var Ie;(Ie=F(de??0))===null||Ie===void 0||Ie.focus()}},blur:function(){var de,he;(de=F(0))===null||de===void 0||de.blur(),(he=F(1))===null||he===void 0||he.blur()}}});var E=GZe(T),L=g.useMemo(function(){return Array.isArray(u)?u:[u,u]},[u]),j=VZe(Wi(Wi({},t),{},{id:k,placeholder:L})),Y=mr(j,1),O=Y[0],_=oee(A,R),G=mZe(_,R),Q=_==null?void 0:_.toLowerCase().endsWith("right"),oe=g.useState({position:"absolute",width:0}),ee=mr(oe,2),$=ee[0],ae=ee[1],Z=$0(function(){var le=F(s);if(le){var de=le.nativeElement,he=de.offsetWidth,me=de.offsetLeft,ce=de.offsetParent,Pe=(ce==null?void 0:ce.offsetWidth)||0,pe=Q?Pe-he-me:me;ae(function(Ie){Ie.insetInlineStart,Ie.insetInlineEnd;var ve=mb(Ie,sGt);return Wi(Wi({},ve),{},Na({width:he},G,pe))}),P(pe)}});g.useEffect(function(){Z()},[s]);var ne=r&&(y[0]&&!w[0]||y[1]&&!w[1]),te=v&&!w[0],q=v&&!te&&!w[1];return g.createElement(Ld,{onResize:Z},g.createElement("div",Yl({},E,{className:Bn(D,"".concat(D,"-range"),Na(Na(Na(Na({},"".concat(D,"-focused"),c),"".concat(D,"-disabled"),w.every(function(le){return le})),"".concat(D,"-invalid"),x.some(function(le){return le})),"".concat(D,"-rtl"),R),d),style:f,ref:N,onClick:p,onMouseDown:function(de){var he=de.target;he!==U.current.inputElement&&he!==W.current.inputElement&&de.preventDefault(),S==null||S(de)}}),o&&g.createElement("div",{className:"".concat(D,"-prefix")},o),g.createElement(Dhe,Yl({ref:U},O(0),{autoFocus:te,tabIndex:b,"date-range":"start"})),g.createElement("div",{className:"".concat(D,"-range-separator")},l),g.createElement(Dhe,Yl({ref:W},O(1),{autoFocus:q,tabIndex:b,"date-range":"end"})),g.createElement("div",{className:"".concat(D,"-active-bar"),style:$}),g.createElement(see,{type:"suffix",icon:i}),ne&&g.createElement(zhe,{icon:r,onClear:m})))}var uGt=g.forwardRef(cGt);function RPe(t,e){var n=t??e;return Array.isArray(n)?n:[n,n]}function $O(t){return t===1?"end":"start"}function dGt(t,e){var n=IZe(t,function(){var ho=t.disabled,vo=t.allowEmpty,bo=RPe(ho,!1),Bo=RPe(vo,!1);return{disabled:bo,allowEmpty:Bo}}),o=mr(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r.prefixCls,d=r.styles,f=r.classNames,p=r.placement,m=r.defaultValue,y=r.value,w=r.needConfirm,x=r.onKeyDown,C=r.disabled,P=r.allowEmpty,A=r.disabledDate,S=r.minDate,v=r.maxDate,b=r.defaultOpen,T=r.open,R=r.onOpenChange,M=r.locale,D=r.generateConfig,k=r.picker,N=r.showNow,U=r.showToday,W=r.showTime,F=r.mode,E=r.onPanelChange,L=r.onCalendarChange,j=r.onOk,Y=r.defaultPickerValue,O=r.pickerValue,_=r.onPickerValueChange,G=r.inputReadOnly,Q=r.suffixIcon,oe=r.onFocus,ee=r.onBlur,$=r.presets,ae=r.ranges,Z=r.components,ne=r.cellRender,te=r.dateRender,q=r.monthCellRender,le=r.onClick,de=DZe(e),he=zZe(T,b,C,R),me=mr(he,2),ce=me[0],Pe=me[1],pe=function(vo,bo){(C.some(function(Bo){return!Bo})||!vo)&&Pe(vo,bo)},Ie=UZe(D,M,l,!0,!1,m,y,L,j),ve=mr(Ie,5),ze=ve[0],Ae=ve[1],se=ve[2],ge=ve[3],we=ve[4],Se=se(),Me=kZe(C,P,ce),Ce=mr(Me,9),Te=Ce[0],Re=Ce[1],Ne=Ce[2],_e=Ce[3],Ue=Ce[4],qe=Ce[5],Fe=Ce[6],He=Ce[7],Le=Ce[8],Ye=function(vo,bo){Re(!0),oe==null||oe(vo,{range:$O(bo??_e)})},lt=function(vo,bo){Re(!1),ee==null||ee(vo,{range:$O(bo??_e)})},Oe=g.useMemo(function(){if(!W)return null;var ho=W.disabledTime,vo=ho?function(bo){var Bo=$O(_e),Pr=wZe(Se,Fe,_e);return ho(bo,Bo,{from:Pr})}:void 0;return Wi(Wi({},W),{},{disabledTime:vo})},[W,_e,Se,Fe]),ut=IA([k,k],{value:F}),ht=mr(ut,2),Qe=ht[0],nt=ht[1],mt=Qe[_e]||k,tt=mt==="date"&&Oe?"datetime":mt,gt=tt===k&&tt!=="time",Ve=BZe(k,mt,N,U,!0),je=jZe(r,ze,Ae,se,ge,C,l,Te,ce,c),et=mr(je,2),bt=et[0],St=et[1],Pt=IVt(Se,C,Fe,D,M,A),Yt=vZe(Se,c,P),zt=mr(Yt,2),Rt=zt[0],Ct=zt[1],yt=FZe(D,M,Se,Qe,ce,_e,i,gt,Y,O,Oe==null?void 0:Oe.defaultOpenValue,_,S,v),at=mr(yt,2),Et=at[0],Lt=at[1],Je=$0(function(ho,vo,bo){var Bo=Ok(Qe,_e,vo);if((Bo[0]!==Qe[0]||Bo[1]!==Qe[1])&&nt(Bo),E&&bo!==!1){var Pr=N1(Se);ho&&(Pr[_e]=ho),E(Pr,Bo)}}),st=function(vo,bo){return Ok(Se,bo,vo)},It=function(vo,bo){var Bo=Se;vo&&(Bo=st(vo,_e)),He(_e);var Pr=qe(Bo);ge(Bo),bt(_e,Pr===null),Pr===null?pe(!1,{force:!0}):bo||de.current.focus({index:Pr})},ot=function(vo){var bo,Bo=vo.target.getRootNode();if(!de.current.nativeElement.contains((bo=Bo.activeElement)!==null&&bo!==void 0?bo:document.activeElement)){var Pr=C.findIndex(function(so){return!so});Pr>=0&&de.current.focus({index:Pr})}pe(!0),le==null||le(vo)},it=function(){St(null),pe(!1,{force:!0})},Be=g.useState(null),pt=mr(Be,2),ct=pt[0],Xe=pt[1],ft=g.useState(null),wt=mr(ft,2),kt=wt[0],Zt=wt[1],Ot=g.useMemo(function(){return kt||Se},[Se,kt]);g.useEffect(function(){ce||Zt(null)},[ce]);var on=g.useState(0),qt=mr(on,2),rn=qt[0],Pn=qt[1],fo=EZe($,ae),to=function(vo){Zt(vo),Xe("preset")},Dt=function(vo){var bo=St(vo);bo&&pe(!1,{force:!0})},fn=function(vo){It(vo)},kn=function(vo){Zt(vo?st(vo,_e):null),Xe("cell")},yo=function(vo){pe(!0),Ye(vo)},ur=function(){Ne("panel")},lr=function(vo){var bo=Ok(Se,_e,vo);ge(bo),!w&&!a&&i===tt&&It(vo)},xo=function(){pe(!1)},wo=W9e(ne,te,q,$O(_e)),Rr=Se[_e]||null,Eo=$0(function(ho){return c(ho,{activeIndex:_e})}),An=g.useMemo(function(){var ho=k9e(r,!1),vo=fZe(r,[].concat(N1(Object.keys(ho)),["onChange","onCalendarChange","style","className","onPanelChange","disabledTime"]));return vo},[r]),Dn=g.createElement(_Ze,Yl({},An,{showNow:Ve,showTime:Oe,range:!0,multiplePanel:gt,activeOffset:rn,placement:p,disabledDate:Pt,onFocus:yo,onBlur:lt,onPanelMouseDown:ur,picker:k,mode:mt,internalMode:tt,onPanelChange:Je,format:s,value:Rr,isInvalid:Eo,onChange:null,onSelect:lr,pickerValue:Et,defaultOpenValue:BS(W==null?void 0:W.defaultOpenValue)[_e],onPickerValueChange:Lt,hoverValue:Ot,onHover:kn,needConfirm:w,onSubmit:It,onOk:we,presets:fo,onPresetHover:to,onPresetSubmit:Dt,onNow:fn,cellRender:wo})),sr=function(vo,bo){var Bo=st(vo,bo);ge(Bo)},Vo=function(){Ne("input")},Wo=function(vo,bo){var Bo=Fe.length,Pr=Fe[Bo-1];if(Bo&&Pr!==bo&&w&&!P[Pr]&&!Le(Pr)&&Se[Pr]){de.current.focus({index:Pr});return}Ne("input"),pe(!0,{inherit:!0}),_e!==bo&&ce&&!w&&a&&It(null,!0),Ue(bo),Ye(vo,bo)},To=function(vo,bo){if(pe(!1),!w&&Ne()==="input"){var Bo=qe(Se);bt(_e,Bo===null)}lt(vo,bo)},Go=function(vo,bo){vo.key==="Tab"&&It(null,!0),x==null||x(vo,bo)},No=g.useMemo(function(){return{prefixCls:u,locale:M,generateConfig:D,button:Z.button,input:Z.input}},[u,M,D,Z.button,Z.input]);return ZA(function(){ce&&_e!==void 0&&Je(null,k,!1)},[ce,_e,k]),ZA(function(){var ho=Ne();!ce&&ho==="input"&&(pe(!1),It(null,!0)),!ce&&a&&!w&&ho==="panel"&&(pe(!0),It())},[ce]),g.createElement(V5.Provider,{value:No},g.createElement(yZe,Yl({},xZe(r),{popupElement:Dn,popupStyle:d.popup,popupClassName:f.popup,visible:ce,onClose:xo,range:!0}),g.createElement(uGt,Yl({},r,{ref:de,suffixIcon:Q,activeIndex:Te||ce?_e:null,activeHelp:!!kt,allHelp:!!kt&&ct==="preset",focused:Te,onFocus:Wo,onBlur:To,onKeyDown:Go,onSubmit:It,value:Ot,maskFormat:s,onChange:sr,onInputChange:Vo,format:l,inputReadOnly:G,disabled:C,open:ce,onOpenChange:pe,onClick:ot,onClear:it,invalid:Rt,onInvalid:Ct,onActiveOffset:Pn}))))}var fGt=g.forwardRef(dGt);function hGt(t){var e=t.prefixCls,n=t.value,o=t.onRemove,r=t.removeIcon,i=r===void 0?"×":r,a=t.formatDate,l=t.disabled,s=t.maxTagCount,c=t.placeholder,u="".concat(e,"-selector"),d="".concat(e,"-selection"),f="".concat(d,"-overflow");function p(w,x){return g.createElement("span",{className:Bn("".concat(d,"-item")),title:typeof w=="string"?w:null},g.createElement("span",{className:"".concat(d,"-item-content")},w),!l&&x&&g.createElement("span",{onMouseDown:function(P){P.preventDefault()},onClick:x,className:"".concat(d,"-item-remove")},i))}function m(w){var x=a(w),C=function(A){A&&A.stopPropagation(),o(w)};return p(x,C)}function y(w){var x="+ ".concat(w.length," ...");return p(x)}return g.createElement("div",{className:u},g.createElement(S5,{prefixCls:f,data:n,renderItem:m,renderRest:y,itemKey:function(x){return a(x)},maxCount:s}),!n.length&&g.createElement("span",{className:"".concat(e,"-selection-placeholder")},c))}var pGt=["id","open","prefix","clearIcon","suffixIcon","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","internalPicker","value","onChange","onSubmit","onInputChange","multiple","maxTagCount","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onMouseDown","required","aria-required","autoFocus","tabIndex","removeIcon"];function gGt(t,e){t.id;var n=t.open,o=t.prefix,r=t.clearIcon,i=t.suffixIcon;t.activeHelp,t.allHelp;var a=t.focused;t.onFocus,t.onBlur,t.onKeyDown;var l=t.locale,s=t.generateConfig,c=t.placeholder,u=t.className,d=t.style,f=t.onClick,p=t.onClear,m=t.internalPicker,y=t.value,w=t.onChange,x=t.onSubmit;t.onInputChange;var C=t.multiple,P=t.maxTagCount;t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var A=t.disabled,S=t.invalid;t.inputReadOnly;var v=t.direction;t.onOpenChange;var b=t.onMouseDown;t.required,t["aria-required"];var T=t.autoFocus,R=t.tabIndex,M=t.removeIcon,D=mb(t,pGt),k=v==="rtl",N=g.useContext(V5),U=N.prefixCls,W=g.useRef(),F=g.useRef();g.useImperativeHandle(e,function(){return{nativeElement:W.current,focus:function($){var ae;(ae=F.current)===null||ae===void 0||ae.focus($)},blur:function(){var $;($=F.current)===null||$===void 0||$.blur()}}});var E=GZe(D),L=function($){w([$])},j=function($){var ae=y.filter(function(Z){return Z&&!Rh(s,l,Z,$,m)});w(ae),n||x()},Y=VZe(Wi(Wi({},t),{},{onChange:L}),function(ee){var $=ee.valueTexts;return{value:$[0]||"",active:a}}),O=mr(Y,2),_=O[0],G=O[1],Q=!!(r&&y.length&&!A),oe=C?g.createElement(g.Fragment,null,g.createElement(hGt,{prefixCls:U,value:y,onRemove:j,formatDate:G,maxTagCount:P,disabled:A,removeIcon:M,placeholder:c}),g.createElement("input",{className:"".concat(U,"-multiple-input"),value:y.map(G).join(","),ref:F,readOnly:!0,autoFocus:T,tabIndex:R}),g.createElement(see,{type:"suffix",icon:i}),Q&&g.createElement(zhe,{icon:r,onClear:p})):g.createElement(Dhe,Yl({ref:F},_(),{autoFocus:T,tabIndex:R,suffixIcon:i,clearIcon:Q&&g.createElement(zhe,{icon:r,onClear:p}),showActiveCls:!1}));return g.createElement("div",Yl({},E,{className:Bn(U,Na(Na(Na(Na(Na({},"".concat(U,"-multiple"),C),"".concat(U,"-focused"),a),"".concat(U,"-disabled"),A),"".concat(U,"-invalid"),S),"".concat(U,"-rtl"),k),u),style:d,ref:W,onClick:f,onMouseDown:function($){var ae,Z=$.target;Z!==((ae=F.current)===null||ae===void 0?void 0:ae.inputElement)&&$.preventDefault(),b==null||b($)}}),o&&g.createElement("div",{className:"".concat(U,"-prefix")},o),oe)}var mGt=g.forwardRef(gGt);function yGt(t,e){var n=IZe(t),o=mr(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r,d=u.prefixCls,f=u.styles,p=u.classNames,m=u.order,y=u.defaultValue,w=u.value,x=u.needConfirm,C=u.onChange,P=u.onKeyDown,A=u.disabled,S=u.disabledDate,v=u.minDate,b=u.maxDate,T=u.defaultOpen,R=u.open,M=u.onOpenChange,D=u.locale,k=u.generateConfig,N=u.picker,U=u.showNow,W=u.showToday,F=u.showTime,E=u.mode,L=u.onPanelChange,j=u.onCalendarChange,Y=u.onOk,O=u.multiple,_=u.defaultPickerValue,G=u.pickerValue,Q=u.onPickerValueChange,oe=u.inputReadOnly,ee=u.suffixIcon,$=u.removeIcon,ae=u.onFocus,Z=u.onBlur,ne=u.presets,te=u.components,q=u.cellRender,le=u.dateRender,de=u.monthCellRender,he=u.onClick,me=DZe(e);function ce(Eo){return Eo===null?null:O?Eo:Eo[0]}var Pe=YZe(k,D,i),pe=zZe(R,T,[A],M),Ie=mr(pe,2),ve=Ie[0],ze=Ie[1],Ae=function(An,Dn,sr){if(j){var Vo=Wi({},sr);delete Vo.range,j(ce(An),ce(Dn),Vo)}},se=function(An){Y==null||Y(ce(An))},ge=UZe(k,D,l,!1,m,y,w,Ae,se),we=mr(ge,5),Se=we[0],Me=we[1],Ce=we[2],Te=we[3],Re=we[4],Ne=Ce(),_e=kZe([A]),Ue=mr(_e,4),qe=Ue[0],Fe=Ue[1],He=Ue[2],Le=Ue[3],Ye=function(An){Fe(!0),ae==null||ae(An,{})},lt=function(An){Fe(!1),Z==null||Z(An,{})},Oe=IA(N,{value:E}),ut=mr(Oe,2),ht=ut[0],Qe=ut[1],nt=ht==="date"&&F?"datetime":ht,mt=BZe(N,ht,U,W),tt=C&&function(Eo,An){C(ce(Eo),ce(An))},gt=jZe(Wi(Wi({},r),{},{onChange:tt}),Se,Me,Ce,Te,[],l,qe,ve,c),Ve=mr(gt,2),je=Ve[1],et=vZe(Ne,c),bt=mr(et,2),St=bt[0],Pt=bt[1],Yt=g.useMemo(function(){return St.some(function(Eo){return Eo})},[St]),zt=function(An,Dn){if(Q){var sr=Wi(Wi({},Dn),{},{mode:Dn.mode[0]});delete sr.range,Q(An[0],sr)}},Rt=FZe(k,D,Ne,[ht],ve,Le,i,!1,_,G,BS(F==null?void 0:F.defaultOpenValue),zt,v,b),Ct=mr(Rt,2),yt=Ct[0],at=Ct[1],Et=$0(function(Eo,An,Dn){if(Qe(An),L&&Dn!==!1){var sr=Eo||Ne[Ne.length-1];L(sr,An)}}),Lt=function(){je(Ce()),ze(!1,{force:!0})},Je=function(An){!A&&!me.current.nativeElement.contains(document.activeElement)&&me.current.focus(),ze(!0),he==null||he(An)},st=function(){je(null),ze(!1,{force:!0})},It=g.useState(null),ot=mr(It,2),it=ot[0],Be=ot[1],pt=g.useState(null),ct=mr(pt,2),Xe=ct[0],ft=ct[1],wt=g.useMemo(function(){var Eo=[Xe].concat(N1(Ne)).filter(function(An){return An});return O?Eo:Eo.slice(0,1)},[Ne,Xe,O]),kt=g.useMemo(function(){return!O&&Xe?[Xe]:Ne.filter(function(Eo){return Eo})},[Ne,Xe,O]);g.useEffect(function(){ve||ft(null)},[ve]);var Zt=EZe(ne),Ot=function(An){ft(An),Be("preset")},on=function(An){var Dn=O?Pe(Ce(),An):[An],sr=je(Dn);sr&&!O&&ze(!1,{force:!0})},qt=function(An){on(An)},rn=function(An){ft(An),Be("cell")},Pn=function(An){ze(!0),Ye(An)},fo=function(An){if(He("panel"),!(O&&nt!==N)){var Dn=O?Pe(Ce(),An):[An];Te(Dn),!x&&!a&&i===nt&&Lt()}},to=function(){ze(!1)},Dt=W9e(q,le,de),fn=g.useMemo(function(){var Eo=k9e(r,!1),An=fZe(r,[].concat(N1(Object.keys(Eo)),["onChange","onCalendarChange","style","className","onPanelChange"]));return Wi(Wi({},An),{},{multiple:r.multiple})},[r]),kn=g.createElement(_Ze,Yl({},fn,{showNow:mt,showTime:F,disabledDate:S,onFocus:Pn,onBlur:lt,picker:N,mode:ht,internalMode:nt,onPanelChange:Et,format:s,value:Ne,isInvalid:c,onChange:null,onSelect:fo,pickerValue:yt,defaultOpenValue:F==null?void 0:F.defaultOpenValue,onPickerValueChange:at,hoverValue:wt,onHover:rn,needConfirm:x,onSubmit:Lt,onOk:Re,presets:Zt,onPresetHover:Ot,onPresetSubmit:on,onNow:qt,cellRender:Dt})),yo=function(An){Te(An)},ur=function(){He("input")},lr=function(An){He("input"),ze(!0,{inherit:!0}),Ye(An)},xo=function(An){ze(!1),lt(An)},wo=function(An,Dn){An.key==="Tab"&&Lt(),P==null||P(An,Dn)},Rr=g.useMemo(function(){return{prefixCls:d,locale:D,generateConfig:k,button:te.button,input:te.input}},[d,D,k,te.button,te.input]);return ZA(function(){ve&&Le!==void 0&&Et(null,N,!1)},[ve,Le,N]),ZA(function(){var Eo=He();!ve&&Eo==="input"&&(ze(!1),Lt()),!ve&&a&&!x&&Eo==="panel"&&(ze(!0),Lt())},[ve]),g.createElement(V5.Provider,{value:Rr},g.createElement(yZe,Yl({},xZe(r),{popupElement:kn,popupStyle:f.popup,popupClassName:p.popup,visible:ve,onClose:to}),g.createElement(mGt,Yl({},r,{ref:me,suffixIcon:ee,removeIcon:$,activeHelp:!!Xe,allHelp:!!Xe&&it==="preset",focused:qe,onFocus:lr,onBlur:xo,onKeyDown:wo,onSubmit:Lt,value:kt,maskFormat:s,onChange:yo,onInputChange:ur,internalPicker:i,format:l,inputReadOnly:oe,disabled:A,open:ve,onOpenChange:ze,onClick:Je,onClear:st,invalid:Yt,onInvalid:function(An){Pt(An,0)}}))))}var AGt=g.forwardRef(yGt);const XZe=g.createContext(null),wGt=XZe.Provider,JZe=g.createContext(null),xGt=JZe.Provider;var vGt=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],KZe=g.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-checkbox":n,r=t.className,i=t.style,a=t.checked,l=t.disabled,s=t.defaultChecked,c=s===void 0?!1:s,u=t.type,d=u===void 0?"checkbox":u,f=t.title,p=t.onChange,m=Ai(t,vGt),y=g.useRef(null),w=g.useRef(null),x=o0(c,{value:a}),C=Sn(x,2),P=C[0],A=C[1];g.useImperativeHandle(e,function(){return{focus:function(T){var R;(R=y.current)===null||R===void 0||R.focus(T)},blur:function(){var T;(T=y.current)===null||T===void 0||T.blur()},input:y.current,nativeElement:w.current}});var S=Bn(o,r,Ut(Ut({},"".concat(o,"-checked"),P),"".concat(o,"-disabled"),l)),v=function(T){l||("checked"in t||A(T.target.checked),p==null||p({target:nn(nn({},t),{},{type:d,checked:T.target.checked}),stopPropagation:function(){T.stopPropagation()},preventDefault:function(){T.preventDefault()},nativeEvent:T.nativeEvent}))};return g.createElement("span",{className:S,title:f,style:i,ref:w},g.createElement("input",Uo({},m,{className:"".concat(o,"-input"),ref:y,onChange:v,disabled:l,checked:!!P,type:d})),g.createElement("span",{className:"".concat(o,"-inner")}))});function $Ze(t){const e=xe.useRef(null),n=()=>{Hf.cancel(e.current),e.current=null};return[()=>{n(),e.current=Hf(()=>{e.current=null})},i=>{e.current&&(i.stopPropagation(),n()),t==null||t(i)}]}const bGt=t=>{const{componentCls:e,antCls:n}=t,o=`${e}-group`;return{[o]:Object.assign(Object.assign({},Ua(t)),{display:"inline-block",fontSize:0,[`&${o}-rtl`]:{direction:"rtl"},[`&${o}-block`]:{display:"flex"},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:"none"}})}},SGt=t=>{const{componentCls:e,wrapperMarginInlineEnd:n,colorPrimary:o,radioSize:r,motionDurationSlow:i,motionDurationMid:a,motionEaseInOutCirc:l,colorBgContainer:s,colorBorder:c,lineWidth:u,colorBgContainerDisabled:d,colorTextDisabled:f,paddingXS:p,dotColorDisabled:m,lineType:y,radioColor:w,radioBgColor:x,calc:C}=t,P=`${e}-inner`,S=C(r).sub(C(4).mul(2)),v=C(1).mul(r).equal({unit:!0});return{[`${e}-wrapper`]:Object.assign(Object.assign({},Ua(t)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer","&:last-child":{marginInlineEnd:0},[`&${e}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:t.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},"&-block":{flex:1,justifyContent:"center"},[`${e}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${jt(u)} ${y} ${o}`,borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),[`${e}-wrapper:hover &, &:hover ${P}`]:{borderColor:o},[`${e}-input:focus-visible + ${P}`]:Object.assign({},z3(t)),[`${e}:hover::after, ${e}-wrapper:hover &::after`]:{visibility:"visible"},[`${e}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:v,height:v,marginBlockStart:C(1).mul(r).div(-2).equal({unit:!0}),marginInlineStart:C(1).mul(r).div(-2).equal({unit:!0}),backgroundColor:w,borderBlockStart:0,borderInlineStart:0,borderRadius:v,transform:"scale(0)",opacity:0,transition:`all ${i} ${l}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:v,height:v,backgroundColor:s,borderColor:c,borderStyle:"solid",borderWidth:u,borderRadius:"50%",transition:`all ${a}`},[`${e}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},[`${e}-checked`]:{[P]:{borderColor:o,backgroundColor:x,"&::after":{transform:`scale(${t.calc(t.dotSize).div(r).equal()})`,opacity:1,transition:`all ${i} ${l}`}}},[`${e}-disabled`]:{cursor:"not-allowed",[P]:{backgroundColor:d,borderColor:c,cursor:"not-allowed","&::after":{backgroundColor:m}},[`${e}-input`]:{cursor:"not-allowed"},[`${e}-disabled + span`]:{color:f,cursor:"not-allowed"},[`&${e}-checked`]:{[P]:{"&::after":{transform:`scale(${C(S).div(r).equal()})`}}}},[`span${e} + *`]:{paddingInlineStart:p,paddingInlineEnd:p}})}},TGt=t=>{const{buttonColor:e,controlHeight:n,componentCls:o,lineWidth:r,lineType:i,colorBorder:a,motionDurationSlow:l,motionDurationMid:s,buttonPaddingInline:c,fontSize:u,buttonBg:d,fontSizeLG:f,controlHeightLG:p,controlHeightSM:m,paddingXS:y,borderRadius:w,borderRadiusSM:x,borderRadiusLG:C,buttonCheckedBg:P,buttonSolidCheckedColor:A,colorTextDisabled:S,colorBgContainerDisabled:v,buttonCheckedBgDisabled:b,buttonCheckedColorDisabled:T,colorPrimary:R,colorPrimaryHover:M,colorPrimaryActive:D,buttonSolidCheckedBg:k,buttonSolidCheckedHoverBg:N,buttonSolidCheckedActiveBg:U,calc:W}=t;return{[`${o}-button-wrapper`]:{position:"relative",display:"inline-block",height:n,margin:0,paddingInline:c,paddingBlock:0,color:e,fontSize:u,lineHeight:jt(W(n).sub(W(r).mul(2)).equal()),background:d,border:`${jt(r)} ${i} ${a}`,borderBlockStartWidth:W(r).add(.02).equal(),borderInlineStartWidth:0,borderInlineEndWidth:r,cursor:"pointer",transition:[`color ${s}`,`background ${s}`,`box-shadow ${s}`].join(","),a:{color:e},[`> ${o}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:first-child)":{"&::before":{position:"absolute",insetBlockStart:W(r).mul(-1).equal(),insetInlineStart:W(r).mul(-1).equal(),display:"block",boxSizing:"content-box",width:1,height:"100%",paddingBlock:r,paddingInline:0,backgroundColor:a,transition:`background-color ${l}`,content:'""'}},"&:first-child":{borderInlineStart:`${jt(r)} ${i} ${a}`,borderStartStartRadius:w,borderEndStartRadius:w},"&:last-child":{borderStartEndRadius:w,borderEndEndRadius:w},"&:first-child:last-child":{borderRadius:w},[`${o}-group-large &`]:{height:p,fontSize:f,lineHeight:jt(W(p).sub(W(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:C,borderEndStartRadius:C},"&:last-child":{borderStartEndRadius:C,borderEndEndRadius:C}},[`${o}-group-small &`]:{height:m,paddingInline:W(y).sub(r).equal(),paddingBlock:0,lineHeight:jt(W(m).sub(W(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:x,borderEndStartRadius:x},"&:last-child":{borderStartEndRadius:x,borderEndEndRadius:x}},"&:hover":{position:"relative",color:R},"&:has(:focus-visible)":Object.assign({},z3(t)),[`${o}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${o}-button-wrapper-disabled)`]:{zIndex:1,color:R,background:P,borderColor:R,"&::before":{backgroundColor:R},"&:first-child":{borderColor:R},"&:hover":{color:M,borderColor:M,"&::before":{backgroundColor:M}},"&:active":{color:D,borderColor:D,"&::before":{backgroundColor:D}}},[`${o}-group-solid &-checked:not(${o}-button-wrapper-disabled)`]:{color:A,background:k,borderColor:k,"&:hover":{color:A,background:N,borderColor:N},"&:active":{color:A,background:U,borderColor:U}},"&-disabled":{color:S,backgroundColor:v,borderColor:a,cursor:"not-allowed","&:first-child, &:hover":{color:S,backgroundColor:v,borderColor:a}},[`&-disabled${o}-button-wrapper-checked`]:{color:T,backgroundColor:b,borderColor:a,boxShadow:"none"},"&-block":{flex:1,textAlign:"center"}}}},PGt=t=>{const{wireframe:e,padding:n,marginXS:o,lineWidth:r,fontSizeLG:i,colorText:a,colorBgContainer:l,colorTextDisabled:s,controlItemBgActiveDisabled:c,colorTextLightSolid:u,colorPrimary:d,colorPrimaryHover:f,colorPrimaryActive:p,colorWhite:m}=t,y=4,w=i,x=e?w-y*2:w-(y+r)*2;return{radioSize:w,dotSize:x,dotColorDisabled:s,buttonSolidCheckedColor:u,buttonSolidCheckedBg:d,buttonSolidCheckedHoverBg:f,buttonSolidCheckedActiveBg:p,buttonBg:l,buttonCheckedBg:l,buttonColor:a,buttonCheckedBgDisabled:c,buttonCheckedColorDisabled:s,buttonPaddingInline:n-r,wrapperMarginInlineEnd:o,radioColor:e?d:m,radioBgColor:e?l:d}},qZe=el("Radio",t=>{const{controlOutline:e,controlOutlineWidth:n}=t,o=`0 0 0 ${jt(n)} ${e}`,i=Ui(t,{radioFocusShadow:o,radioButtonFocusShadow:o});return[bGt(i),SGt(i),TGt(i)]},PGt,{unitless:{radioSize:!0,dotSize:!0}});var CGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const r=g.useContext(XZe),i=g.useContext(JZe),{getPrefixCls:a,direction:l,radio:s}=g.useContext(gr),c=g.useRef(null),u=e2(e,c),{isFormItemInput:d}=g.useContext(W1),f=F=>{var E,L;(E=t.onChange)===null||E===void 0||E.call(t,F),(L=r==null?void 0:r.onChange)===null||L===void 0||L.call(r,F)},{prefixCls:p,className:m,rootClassName:y,children:w,style:x,title:C}=t,P=CGt(t,["prefixCls","className","rootClassName","children","style","title"]),A=a("radio",p),S=((r==null?void 0:r.optionType)||i)==="button",v=S?`${A}-button`:A,b=nu(A),[T,R,M]=qZe(A,b),D=Object.assign({},P),k=g.useContext(Bp);r&&(D.name=r.name,D.onChange=f,D.checked=t.value===r.value,D.disabled=(n=D.disabled)!==null&&n!==void 0?n:r.disabled),D.disabled=(o=D.disabled)!==null&&o!==void 0?o:k;const N=Mn(`${v}-wrapper`,{[`${v}-wrapper-checked`]:D.checked,[`${v}-wrapper-disabled`]:D.disabled,[`${v}-wrapper-rtl`]:l==="rtl",[`${v}-wrapper-in-form-item`]:d,[`${v}-wrapper-block`]:!!(r!=null&&r.block)},s==null?void 0:s.className,m,y,R,M,b),[U,W]=$Ze(D.onClick);return T(g.createElement(lU,{component:"Radio",disabled:D.disabled},g.createElement("label",{className:N,style:Object.assign(Object.assign({},s==null?void 0:s.style),x),onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,title:C,onClick:U},g.createElement(KZe,Object.assign({},D,{className:Mn(D.className,{[fZ]:!S}),type:"radio",prefixCls:v,ref:u,onClick:W})),w!==void 0?g.createElement("span",null,w):null)))},fJ=g.forwardRef(RGt);function HGt(){var t=yH({},xN);return t.useId}var HPe=0,MPe=HGt();const MGt=MPe?function(e){var n=MPe();return e||n}:function(e){var n=g.useState("ssr-id"),o=bL(n,2),r=o[0],i=o[1];return g.useEffect(function(){var a=HPe;HPe+=1,i("rc_unique_".concat(a))},[]),e||r},IGt=g.forwardRef((t,e)=>{const{getPrefixCls:n,direction:o}=g.useContext(gr),r=MGt(),{prefixCls:i,className:a,rootClassName:l,options:s,buttonStyle:c="outline",disabled:u,children:d,size:f,style:p,id:m,optionType:y,name:w=r,defaultValue:x,value:C,block:P=!1,onChange:A,onMouseEnter:S,onMouseLeave:v,onFocus:b,onBlur:T}=t,[R,M]=qA(x,{value:C}),D=g.useCallback(_=>{const G=R,Q=_.target.value;"value"in t||M(Q),Q!==G&&(A==null||A(_))},[R,M,A]),k=n("radio",i),N=`${k}-group`,U=nu(k),[W,F,E]=qZe(k,U);let L=d;s&&s.length>0&&(L=s.map(_=>typeof _=="string"||typeof _=="number"?g.createElement(fJ,{key:_.toString(),prefixCls:k,disabled:u,value:_,checked:R===_},_):g.createElement(fJ,{key:`radio-group-value-options-${_.value}`,prefixCls:k,disabled:_.disabled||u,value:_.value,checked:R===_.value,title:_.title,style:_.style,id:_.id,required:_.required},_.label)));const j=jd(f),Y=Mn(N,`${N}-${c}`,{[`${N}-${j}`]:j,[`${N}-rtl`]:o==="rtl",[`${N}-block`]:P},a,l,F,E,U),O=g.useMemo(()=>({onChange:D,value:R,disabled:u,name:w,optionType:y,block:P}),[D,R,u,w,y,P]);return W(g.createElement("div",Object.assign({},$5e(t,{aria:!0,data:!0}),{className:Y,style:p,onMouseEnter:S,onMouseLeave:v,onFocus:b,onBlur:T,id:m,ref:e}),g.createElement(wGt,{value:O},L)))}),zGt=g.memo(IGt);var DGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n}=g.useContext(gr),{prefixCls:o}=t,r=DGt(t,["prefixCls"]),i=n("radio",o);return g.createElement(xGt,{value:"button"},g.createElement(fJ,Object.assign({prefixCls:i},r,{type:"radio",ref:e})))},kGt=g.forwardRef(EGt),We=fJ;We.Button=kGt;We.Group=zGt;We.__ANT_RADIO=!0;function wU(t){return Ui(t,{inputAffixPadding:t.paddingXXS})}const xU=t=>{const{controlHeight:e,fontSize:n,lineHeight:o,lineWidth:r,controlHeightSM:i,controlHeightLG:a,fontSizeLG:l,lineHeightLG:s,paddingSM:c,controlPaddingHorizontalSM:u,controlPaddingHorizontal:d,colorFillAlter:f,colorPrimaryHover:p,colorPrimary:m,controlOutlineWidth:y,controlOutline:w,colorErrorOutline:x,colorWarningOutline:C,colorBgContainer:P}=t;return{paddingBlock:Math.max(Math.round((e-n*o)/2*10)/10-r,0),paddingBlockSM:Math.max(Math.round((i-n*o)/2*10)/10-r,0),paddingBlockLG:Math.ceil((a-l*s)/2*10)/10-r,paddingInline:c-r,paddingInlineSM:u-r,paddingInlineLG:d-r,addonBg:f,activeBorderColor:m,hoverBorderColor:p,activeShadow:`0 0 0 ${y}px ${w}`,errorActiveShadow:`0 0 0 ${y}px ${x}`,warningActiveShadow:`0 0 0 ${y}px ${C}`,hoverBg:P,activeBg:P,inputFontSize:n,inputFontSizeLG:l,inputFontSizeSM:n}},FGt=t=>({borderColor:t.hoverBorderColor,backgroundColor:t.hoverBg}),cee=t=>({color:t.colorTextDisabled,backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"input[disabled], textarea[disabled]":{cursor:"not-allowed"},"&:hover:not([disabled])":Object.assign({},FGt(Ui(t,{hoverBorderColor:t.colorBorder,hoverBg:t.colorBgContainerDisabled})))}),Y9e=(t,e)=>({background:t.colorBgContainer,borderWidth:t.lineWidth,borderStyle:t.lineType,borderColor:e.borderColor,"&:hover":{borderColor:e.hoverBorderColor,backgroundColor:t.hoverBg},"&:focus, &:focus-within":{borderColor:e.activeBorderColor,boxShadow:e.activeShadow,outline:0,backgroundColor:t.activeBg}}),IPe=(t,e)=>({[`&${t.componentCls}-status-${e.status}:not(${t.componentCls}-disabled)`]:Object.assign(Object.assign({},Y9e(t,e)),{[`${t.componentCls}-prefix, ${t.componentCls}-suffix`]:{color:e.affixColor}}),[`&${t.componentCls}-status-${e.status}${t.componentCls}-disabled`]:{borderColor:e.borderColor}}),O9e=(t,e)=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Y9e(t,{borderColor:t.colorBorder,hoverBorderColor:t.hoverBorderColor,activeBorderColor:t.activeBorderColor,activeShadow:t.activeShadow})),{[`&${t.componentCls}-disabled, &[disabled]`]:Object.assign({},cee(t))}),IPe(t,{status:"error",borderColor:t.colorError,hoverBorderColor:t.colorErrorBorderHover,activeBorderColor:t.colorError,activeShadow:t.errorActiveShadow,affixColor:t.colorError})),IPe(t,{status:"warning",borderColor:t.colorWarning,hoverBorderColor:t.colorWarningBorderHover,activeBorderColor:t.colorWarning,activeShadow:t.warningActiveShadow,affixColor:t.colorWarning})),e)}),zPe=(t,e)=>({[`&${t.componentCls}-group-wrapper-status-${e.status}`]:{[`${t.componentCls}-group-addon`]:{borderColor:e.addonBorderColor,color:e.addonColor}}}),QZe=t=>({"&-outlined":Object.assign(Object.assign(Object.assign({[`${t.componentCls}-group`]:{"&-addon":{background:t.addonBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}}},zPe(t,{status:"error",addonBorderColor:t.colorError,addonColor:t.colorErrorText})),zPe(t,{status:"warning",addonBorderColor:t.colorWarning,addonColor:t.colorWarningText})),{[`&${t.componentCls}-group-wrapper-disabled`]:{[`${t.componentCls}-group-addon`]:Object.assign({},cee(t))}})}),_9e=(t,e)=>{const{componentCls:n}=t;return{"&-borderless":Object.assign({background:"transparent",border:"none","&:focus, &:focus-within":{outline:"none"},[`&${n}-disabled, &[disabled]`]:{color:t.colorTextDisabled,cursor:"not-allowed"},[`&${n}-status-error`]:{"&, & input, & textarea":{color:t.colorError}},[`&${n}-status-warning`]:{"&, & input, & textarea":{color:t.colorWarning}}},e)}},ZZe=(t,e)=>({background:e.bg,borderWidth:t.lineWidth,borderStyle:t.lineType,borderColor:"transparent","input&, & input, textarea&, & textarea":{color:e==null?void 0:e.inputColor},"&:hover":{background:e.hoverBg},"&:focus, &:focus-within":{outline:0,borderColor:e.activeBorderColor,backgroundColor:t.activeBg}}),DPe=(t,e)=>({[`&${t.componentCls}-status-${e.status}:not(${t.componentCls}-disabled)`]:Object.assign(Object.assign({},ZZe(t,e)),{[`${t.componentCls}-prefix, ${t.componentCls}-suffix`]:{color:e.affixColor}})}),V9e=(t,e)=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ZZe(t,{bg:t.colorFillTertiary,hoverBg:t.colorFillSecondary,activeBorderColor:t.activeBorderColor})),{[`&${t.componentCls}-disabled, &[disabled]`]:Object.assign({},cee(t))}),DPe(t,{status:"error",bg:t.colorErrorBg,hoverBg:t.colorErrorBgHover,activeBorderColor:t.colorError,inputColor:t.colorErrorText,affixColor:t.colorError})),DPe(t,{status:"warning",bg:t.colorWarningBg,hoverBg:t.colorWarningBgHover,activeBorderColor:t.colorWarning,inputColor:t.colorWarningText,affixColor:t.colorWarning})),e)}),EPe=(t,e)=>({[`&${t.componentCls}-group-wrapper-status-${e.status}`]:{[`${t.componentCls}-group-addon`]:{background:e.addonBg,color:e.addonColor}}}),eet=t=>({"&-filled":Object.assign(Object.assign(Object.assign({[`${t.componentCls}-group`]:{"&-addon":{background:t.colorFillTertiary},[`${t.componentCls}-filled:not(:focus):not(:focus-within)`]:{"&:not(:first-child)":{borderInlineStart:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},"&:not(:last-child)":{borderInlineEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`}}}},EPe(t,{status:"error",addonBg:t.colorErrorBg,addonColor:t.colorErrorText})),EPe(t,{status:"warning",addonBg:t.colorWarningBg,addonColor:t.colorWarningText})),{[`&${t.componentCls}-group-wrapper-disabled`]:{[`${t.componentCls}-group`]:{"&-addon":{background:t.colorFillTertiary,color:t.colorTextDisabled},"&-addon:first-child":{borderInlineStart:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},"&-addon:last-child":{borderInlineEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`}}}})}),G9e=t=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:t,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),tet=t=>{const{paddingBlockLG:e,lineHeightLG:n,borderRadiusLG:o,paddingInlineLG:r}=t;return{padding:`${jt(e)} ${jt(r)}`,fontSize:t.inputFontSizeLG,lineHeight:n,borderRadius:o}},X9e=t=>({padding:`${jt(t.paddingBlockSM)} ${jt(t.paddingInlineSM)}`,fontSize:t.inputFontSizeSM,borderRadius:t.borderRadiusSM}),vU=t=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:`${jt(t.paddingBlock)} ${jt(t.paddingInline)}`,color:t.colorText,fontSize:t.inputFontSize,lineHeight:t.lineHeight,borderRadius:t.borderRadius,transition:`all ${t.motionDurationMid}`},G9e(t.colorTextPlaceholder)),{"textarea&":{maxWidth:"100%",height:"auto",minHeight:t.controlHeight,lineHeight:t.lineHeight,verticalAlign:"bottom",transition:`all ${t.motionDurationSlow}, height 0s`,resize:"vertical"},"&-lg":Object.assign({},tet(t)),"&-sm":Object.assign({},X9e(t)),"&-rtl, &-textarea-rtl":{direction:"rtl"}}),net=t=>{const{componentCls:e,antCls:n}=t;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:t.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${e}, &-lg > ${e}-group-addon`]:Object.assign({},tet(t)),[`&-sm ${e}, &-sm > ${e}-group-addon`]:Object.assign({},X9e(t)),[`&-lg ${n}-select-single ${n}-select-selector`]:{height:t.controlHeightLG},[`&-sm ${n}-select-single ${n}-select-selector`]:{height:t.controlHeightSM},[`> ${e}`]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},[`${e}-group`]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:`0 ${jt(t.paddingInline)}`,color:t.colorText,fontWeight:"normal",fontSize:t.inputFontSize,textAlign:"center",borderRadius:t.borderRadius,transition:`all ${t.motionDurationSlow}`,lineHeight:1,[`${n}-select`]:{margin:`${jt(t.calc(t.paddingBlock).add(1).mul(-1).equal())} ${jt(t.calc(t.paddingInline).mul(-1).equal())}`,[`&${n}-select-single:not(${n}-select-customize-input):not(${n}-pagination-size-changer)`]:{[`${n}-select-selector`]:{backgroundColor:"inherit",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,boxShadow:"none"}}},[`${n}-cascader-picker`]:{margin:`-9px ${jt(t.calc(t.paddingInline).mul(-1).equal())}`,backgroundColor:"transparent",[`${n}-cascader-input`]:{textAlign:"start",border:0,boxShadow:"none"}}}},[e]:{width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,[`${e}-search-with-button &`]:{zIndex:0}}},[`> ${e}:first-child, ${e}-group-addon:first-child`]:{borderStartEndRadius:0,borderEndEndRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${e}-affix-wrapper`]:{[`&:not(:first-child) ${e}`]:{borderStartStartRadius:0,borderEndStartRadius:0},[`&:not(:last-child) ${e}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${e}:last-child, ${e}-group-addon:last-child`]:{borderStartStartRadius:0,borderEndStartRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`${e}-affix-wrapper`]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,[`${e}-search &`]:{borderStartStartRadius:t.borderRadius,borderEndStartRadius:t.borderRadius}},[`&:not(:first-child), ${e}-search &:not(:first-child)`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&${e}-group-compact`]:Object.assign(Object.assign({display:"block"},vL()),{[`${e}-group-addon, ${e}-group-wrap, > ${e}`]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:t.lineWidth,"&:hover, &:focus":{zIndex:1}}},"& > *":{display:"inline-flex",float:"none",verticalAlign:"top",borderRadius:0},[` & > ${e}-affix-wrapper, & > ${e}-number-affix-wrapper, @@ -4658,15 +4658,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho &${n}-slide-up-leave${n}-slide-up-leave-active${e}-dropdown-placement-bottomRight`]:{animationName:mZ},[`${e}-panel > ${e}-time-panel`]:{paddingTop:b},[`${e}-range-wrapper`]:{display:"flex",position:"relative"},[`${e}-range-arrow`]:Object.assign(Object.assign({position:"absolute",zIndex:1,display:"none",paddingInline:t.calc(r).mul(1.5).equal(),boxSizing:"content-box",transition:`all ${S} ease-out`},wQe(t,R,E)),{"&:before":{insetInlineStart:t.calc(r).mul(1.5).equal()}}),[`${e}-panel-container`]:{overflow:"hidden",verticalAlign:"top",background:R,borderRadius:M,boxShadow:D,transition:`margin ${S}`,display:"inline-block",pointerEvents:"auto",[`${e}-panel-layout`]:{display:"flex",flexWrap:"nowrap",alignItems:"stretch"},[`${e}-presets`]:{display:"flex",flexDirection:"column",minWidth:W,maxWidth:F,ul:{height:0,flex:"auto",listStyle:"none",overflow:"auto",margin:0,padding:w,borderInlineEnd:`${jt(i)} ${a} ${N}`,li:Object.assign(Object.assign({},e7),{borderRadius:k,paddingInline:w,paddingBlock:t.calc(m).sub(L).div(2).equal(),cursor:"pointer",transition:`all ${S}`,"+ li":{marginTop:x},"&:hover":{background:U}})}},[`${e}-panels`]:{display:"inline-flex",flexWrap:"nowrap","&:last-child":{[`${e}-panel`]:{borderWidth:0}}},[`${e}-panel`]:{verticalAlign:"top",background:"transparent",borderRadius:0,borderWidth:0,[`${e}-content, table`]:{textAlign:"center"},"&-focused":{borderColor:l}}}}),"&-dropdown-range":{padding:`${jt(t.calc(T).mul(2).div(3).equal())} 0`,"&-hidden":{display:"none"}},"&-rtl":{direction:"rtl",[`${e}-separator`]:{transform:"rotate(180deg)"},[`${e}-footer`]:{"&-extra":{direction:"rtl"}}}})},D3(t,"slide-up"),D3(t,"slide-down"),vH(t,"move-up"),vH(t,"move-down")]},oet=el("DatePicker",t=>{const e=Ui(wU(t),XGt(t),{inputPaddingHorizontalBase:t.calc(t.paddingSM).sub(1).equal(),multipleSelectItemHeight:t.multipleItemHeight,selectHeight:t.controlHeight});return[GGt(e),QGt(e),$Gt(e),qGt(e),OGt(e),sU(t,{focusElCls:`${t.componentCls}-focused`})]},KGt);var ZGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},eXt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ZGt}))},tXt=g.forwardRef(eXt);function y3(){return y3=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function hJ(t,e){if(t==null)return{};var n=lXt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}const uee=g.createContext(null);function sXt(t){if(Array.isArray(t))return Ehe(t)}function cXt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function uXt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FPe(t){return sXt(t)||cXt(t)||ret(t)||uXt()}var dXt=function(e){var n=e.activeTabOffset,o=e.horizontal,r=e.rtl,i=e.indicator,a=i===void 0?{}:i,l=a.size,s=a.align,c=s===void 0?"center":s,u=g.useState(),d=Qs(u,2),f=d[0],p=d[1],m=g.useRef(),y=xe.useCallback(function(x){return typeof l=="function"?l(x):typeof l=="number"?l:x},[l]);function w(){Ic.cancel(m.current)}return g.useEffect(function(){var x={};if(n)if(o){x.width=y(n.width);var C=r?"right":"left";c==="start"&&(x[C]=n[C]),c==="center"&&(x[C]=n[C]+n.width/2,x.transform=r?"translateX(50%)":"translateX(-50%)"),c==="end"&&(x[C]=n[C]+n.width,x.transform="translateX(-100%)")}else x.height=y(n.height),c==="start"&&(x.top=n.top),c==="center"&&(x.top=n.top+n.height/2,x.transform="translateY(-50%)"),c==="end"&&(x.top=n.top+n.height,x.transform="translateY(-100%)");return w(),m.current=Ic(function(){p(x)}),w},[n,o,r,c,y]),{style:f}},LPe={width:0,height:0,left:0,top:0};function fXt(t,e,n){return g.useMemo(function(){for(var o,r=new Map,i=e.get((o=t[0])===null||o===void 0?void 0:o.key)||LPe,a=i.left+i.width,l=0;lU?(k=M,v.current="x"):(k=D,v.current="y"),e(-k,-k)&&R.preventDefault()}var T=g.useRef(null);T.current={onTouchStart:P,onTouchMove:A,onTouchEnd:S,onWheel:b},g.useEffect(function(){function R(N){T.current.onTouchStart(N)}function M(N){T.current.onTouchMove(N)}function D(N){T.current.onTouchEnd(N)}function k(N){T.current.onWheel(N)}return document.addEventListener("touchmove",M,{passive:!1}),document.addEventListener("touchend",D,{passive:!0}),t.current.addEventListener("touchstart",R,{passive:!0}),t.current.addEventListener("wheel",k,{passive:!1}),function(){document.removeEventListener("touchmove",M),document.removeEventListener("touchend",D)}},[])}function iet(t){var e=g.useState(0),n=Qs(e,2),o=n[0],r=n[1],i=g.useRef(0),a=g.useRef();return a.current=t,sfe(function(){var l;(l=a.current)===null||l===void 0||l.call(a)},[o]),function(){i.current===o&&(i.current+=1,r(i.current))}}function gXt(t){var e=g.useRef([]),n=g.useState({}),o=Qs(n,2),r=o[1],i=g.useRef(typeof t=="function"?t():t),a=iet(function(){var s=i.current;e.current.forEach(function(c){s=c(s)}),e.current=[],i.current=s,r({})});function l(s){e.current.push(s),a()}return[i.current,l]}var jPe={width:0,height:0,left:0,top:0,right:0};function mXt(t,e,n,o,r,i,a){var l=a.tabs,s=a.tabPosition,c=a.rtl,u,d,f;return["top","bottom"].includes(s)?(u="width",d=c?"right":"left",f=Math.abs(n)):(u="height",d="top",f=-n),g.useMemo(function(){if(!l.length)return[0,0];for(var p=l.length,m=p,y=0;yMath.floor(f+e)){m=y-1;break}}for(var x=0,C=p-1;C>=0;C-=1){var P=t.get(l[C].key)||jPe;if(P[d]=m?[0,0]:[x,m]},[t,e,o,r,i,f,s,l.map(function(p){return p.key}).join("_"),c])}function BPe(t){var e;return t instanceof Map?(e={},t.forEach(function(n,o){e[o]=n})):e=t,JSON.stringify(e)}var yXt="TABS_DQ";function aet(t){return String(t).replace(/"/g,yXt)}function K9e(t,e,n,o){return!(!n||o||t===!1||t===void 0&&(e===!1||e===null))}var set=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.editable,r=t.locale,i=t.style;return!o||o.showAdd===!1?null:g.createElement("button",{ref:e,type:"button",className:"".concat(n,"-nav-add"),style:i,"aria-label":(r==null?void 0:r.addAriaLabel)||"Add tab",onClick:function(l){o.onEdit("add",{event:l})}},o.addIcon||"+")}),YPe=g.forwardRef(function(t,e){var n=t.position,o=t.prefixCls,r=t.extra;if(!r)return null;var i,a={};return i7(r)==="object"&&!g.isValidElement(r)?a=r:a.right=r,n==="right"&&(i=a.right),n==="left"&&(i=a.left),i?g.createElement("div",{className:"".concat(o,"-extra-content"),ref:e},i):null});function khe(){return khe=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function RXt(t,e){if(t==null)return{};var n=CXt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var HXt=Lo.ESC,MXt=Lo.TAB;function IXt(t){var e=t.visible,n=t.triggerRef,o=t.onVisibleChange,r=t.autoFocus,i=t.overlayRef,a=g.useRef(!1),l=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),o==null||o(!1)}},s=function(){var d;return(d=i.current)!==null&&d!==void 0&&d.focus?(i.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case HXt:l();break;case MXt:{var f=!1;a.current||(f=s()),f?d.preventDefault():l();break}}};g.useEffect(function(){return e?(window.addEventListener("keydown",c),r&&Ic(s,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var zXt=g.forwardRef(function(t,e){var n=t.overlay,o=t.arrow,r=t.prefixCls,i=g.useMemo(function(){var l;return typeof n=="function"?l=n():l=n,l},[n]),a=oU(e,i==null?void 0:i.ref);return xe.createElement(xe.Fragment,null,o&&xe.createElement("div",{className:"".concat(r,"-arrow")}),xe.cloneElement(i,{ref:Z8(i)?a:void 0}))}),NP={adjustX:1,adjustY:1},UP=[0,0],DXt={topLeft:{points:["bl","tl"],overflow:NP,offset:[0,-4],targetOffset:UP},top:{points:["bc","tc"],overflow:NP,offset:[0,-4],targetOffset:UP},topRight:{points:["br","tr"],overflow:NP,offset:[0,-4],targetOffset:UP},bottomLeft:{points:["tl","bl"],overflow:NP,offset:[0,4],targetOffset:UP},bottom:{points:["tc","bc"],overflow:NP,offset:[0,4],targetOffset:UP},bottomRight:{points:["tr","br"],overflow:NP,offset:[0,4],targetOffset:UP}},EXt=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function kXt(t,e){var n,o=t.arrow,r=o===void 0?!1:o,i=t.prefixCls,a=i===void 0?"rc-dropdown":i,l=t.transitionName,s=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?DXt:f,m=t.getPopupContainer,y=t.showAction,w=t.hideAction,x=t.overlayClassName,C=t.overlayStyle,P=t.visible,A=t.trigger,S=A===void 0?["hover"]:A,v=t.autoFocus,b=t.overlay,T=t.children,R=t.onVisibleChange,M=RXt(t,EXt),D=xe.useState(),k=PXt(D,2),N=k[0],U=k[1],W="visible"in t?P:N,F=xe.useRef(null),E=xe.useRef(null),L=xe.useRef(null);xe.useImperativeHandle(e,function(){return F.current});var j=function(ae){U(ae),R==null||R(ae)};IXt({visible:W,triggerRef:L,onVisibleChange:j,autoFocus:v,overlayRef:E});var Y=function(ae){var Z=t.onOverlayClick;U(!1),Z&&Z(ae)},O=function(){return xe.createElement(zXt,{ref:E,overlay:b,prefixCls:a,arrow:r})},_=function(){return typeof b=="function"?O:O()},G=function(){var ae=t.minOverlayWidthMatchTrigger,Z=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?ae:!Z},Q=function(){var ae=t.openClassName;return ae!==void 0?ae:"".concat(a,"-open")},oe=xe.cloneElement(T,{className:Bn((n=T.props)===null||n===void 0?void 0:n.className,W&&Q()),ref:Z8(T)?oU(L,T.ref):void 0}),ee=w;return!ee&&S.indexOf("contextMenu")!==-1&&(ee=["click"]),xe.createElement(eI,khe({builtinPlacements:p},M,{prefixCls:a,ref:F,popupClassName:Bn(x,xXt({},"".concat(a,"-show-arrow"),r)),popupStyle:C,action:S,showAction:y,hideAction:ee,popupPlacement:d,popupAlign:c,popupTransitionName:l,popupAnimation:s,popupVisible:W,stretch:G()?"minWidth":"",popup:_(),onPopupVisibleChange:j,onPopupClick:Y,getPopupContainer:m}),oe)}const FXt=xe.forwardRef(kXt);var LXt=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.id,r=t.tabs,i=t.locale,a=t.mobile,l=t.more,s=l===void 0?{}:l,c=t.style,u=t.className,d=t.editable,f=t.tabBarGutter,p=t.rtl,m=t.removeAriaLabel,y=t.onTabClick,w=t.getPopupContainer,x=t.popupClassName,C=g.useState(!1),P=Qs(C,2),A=P[0],S=P[1],v=g.useState(null),b=Qs(v,2),T=b[0],R=b[1],M=s.icon,D=M===void 0?"More":M,k="".concat(o,"-more-popup"),N="".concat(n,"-dropdown"),U=T!==null?"".concat(k,"-").concat(T):null,W=i==null?void 0:i.dropdownAriaLabel;function F(G,Q){G.preventDefault(),G.stopPropagation(),d.onEdit("remove",{key:Q,event:G})}var E=g.createElement(oI,{onClick:function(Q){var oe=Q.key,ee=Q.domEvent;y(oe,ee),S(!1)},prefixCls:"".concat(N,"-menu"),id:k,tabIndex:-1,role:"listbox","aria-activedescendant":U,selectedKeys:[T],"aria-label":W!==void 0?W:"expanded dropdown"},r.map(function(G){var Q=G.closable,oe=G.disabled,ee=G.closeIcon,q=G.key,ae=G.label,Z=K9e(Q,ee,d,oe);return g.createElement(yU,{key:q,id:"".concat(k,"-").concat(q),role:"option","aria-controls":o&&"".concat(o,"-panel-").concat(q),disabled:oe},g.createElement("span",null,ae),Z&&g.createElement("button",{type:"button","aria-label":m||"remove",tabIndex:0,className:"".concat(N,"-menu-item-remove"),onClick:function(te){te.stopPropagation(),F(te,q)}},ee||d.removeIcon||"×"))}));function L(G){for(var Q=r.filter(function(Z){return!Z.disabled}),oe=Q.findIndex(function(Z){return Z.key===T})||0,ee=Q.length,q=0;qXe?"left":"right"})}),N=Qs(k,2),U=N[0],W=N[1],F=WPe(0,function(ct,Xe){!D&&y&&y({direction:ct>Xe?"top":"bottom"})}),E=Qs(F,2),L=E[0],j=E[1],Y=g.useState([0,0]),O=Qs(Y,2),_=O[0],G=O[1],Q=g.useState([0,0]),oe=Qs(Q,2),ee=oe[0],q=oe[1],ae=g.useState([0,0]),Z=Qs(ae,2),ne=Z[0],te=Z[1],$=g.useState([0,0]),le=Qs($,2),de=le[0],he=le[1],me=gXt(new Map),ce=Qs(me,2),Pe=ce[0],pe=ce[1],Ie=fXt(P,Pe,ee[0]),ve=qO(_,D),ze=qO(ee,D),Ae=qO(ne,D),se=qO(de,D),ge=Math.floor(ve)Ce?Ce:ct}var Re=g.useRef(null),Ne=g.useState(),_e=Qs(Ne,2),Ue=_e[0],qe=_e[1];function Fe(){qe(Date.now())}function He(){Re.current&&clearTimeout(Re.current)}pXt(b,function(ct,Xe){function ft(wt,kt){wt(function(Zt){var Ot=Te(Zt+kt);return Ot})}return ge?(D?ft(W,ct):ft(j,Xe),He(),Fe(),!0):!1}),g.useEffect(function(){return He(),Ue&&(Re.current=setTimeout(function(){qe(0)},100)),He},[Ue]);var Le=mXt(Ie,we,D?U:L,ze,Ae,se,Sy(Sy({},t),{},{tabs:P})),Ye=Qs(Le,2),lt=Ye[0],Oe=Ye[1],ut=Dd(function(){var ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:a,Xe=Ie.get(ct)||{width:0,height:0,left:0,right:0,top:0};if(D){var ft=U;l?Xe.rightU+we&&(ft=Xe.right+Xe.width-we):Xe.left<-U?ft=-Xe.left:Xe.left+Xe.width>-U+we&&(ft=-(Xe.left+Xe.width-we)),j(0),W(Te(ft))}else{var wt=L;Xe.top<-L?wt=-Xe.top:Xe.top+Xe.height>-L+we&&(wt=-(Xe.top+Xe.height-we)),W(0),j(Te(wt))}}),ht=g.useState(),Qe=Qs(ht,2),nt=Qe[0],mt=Qe[1],tt=g.useState(!1),gt=Qs(tt,2),Ve=gt[0],je=gt[1],et=P.filter(function(ct){return!ct.disabled}).map(function(ct){return ct.key}),bt=function(Xe){var ft=et.indexOf(nt||a),wt=et.length,kt=(ft+Xe+wt)%wt,Zt=et[kt];mt(Zt)},St=function(Xe){var ft=Xe.code,wt=l&&D,kt=et[0],Zt=et[et.length-1];switch(ft){case"ArrowLeft":{D&&bt(wt?1:-1);break}case"ArrowRight":{D&&bt(wt?-1:1);break}case"ArrowUp":{Xe.preventDefault(),D||bt(-1);break}case"ArrowDown":{Xe.preventDefault(),D||bt(1);break}case"Home":{Xe.preventDefault(),mt(kt);break}case"End":{Xe.preventDefault(),mt(Zt);break}case"Enter":case"Space":{Xe.preventDefault(),m(nt,Xe);break}case"Backspace":case"Delete":{var Ot=et.indexOf(nt),on=P.find(function(rn){return rn.key===nt}),qt=K9e(on==null?void 0:on.closable,on==null?void 0:on.closeIcon,c,on==null?void 0:on.disabled);qt&&(Xe.preventDefault(),Xe.stopPropagation(),c.onEdit("remove",{key:nt,event:Xe}),Ot===et.length-1?bt(-1):bt(1));break}}},Pt={};D?Pt[l?"marginRight":"marginLeft"]=f:Pt.marginTop=f;var Yt=P.map(function(ct,Xe){var ft=ct.key;return g.createElement(NXt,{id:r,prefixCls:C,key:ft,tab:ct,style:Xe===0?void 0:Pt,closable:ct.closable,editable:c,active:ft===a,focus:ft===nt,renderWrapper:p,removeAriaLabel:u==null?void 0:u.removeAriaLabel,tabCount:et.length,currentPosition:Xe+1,onClick:function(kt){m(ft,kt)},onKeyDown:St,onFocus:function(){Ve||mt(ft),ut(ft),Fe(),b.current&&(l||(b.current.scrollLeft=0),b.current.scrollTop=0)},onBlur:function(){mt(void 0)},onMouseDown:function(){je(!0)},onMouseUp:function(){je(!1)}})}),zt=function(){return pe(function(){var Xe,ft=new Map,wt=(Xe=T.current)===null||Xe===void 0?void 0:Xe.getBoundingClientRect();return P.forEach(function(kt){var Zt,Ot=kt.key,on=(Zt=T.current)===null||Zt===void 0?void 0:Zt.querySelector('[data-node-key="'.concat(aet(Ot),'"]'));if(on){var qt=UXt(on,wt),rn=Qs(qt,4),Pn=rn[0],fo=rn[1],to=rn[2],Dt=rn[3];ft.set(Ot,{width:Pn,height:fo,left:to,top:Dt})}}),ft})};g.useEffect(function(){zt()},[P.map(function(ct){return ct.key}).join("_")]);var Rt=iet(function(){var ct=jP(A),Xe=jP(S),ft=jP(v);G([ct[0]-Xe[0]-ft[0],ct[1]-Xe[1]-ft[1]]);var wt=jP(M);te(wt);var kt=jP(R);he(kt);var Zt=jP(T);q([Zt[0]-wt[0],Zt[1]-wt[1]]),zt()}),Ct=P.slice(0,lt),yt=P.slice(Oe+1),at=[].concat(FPe(Ct),FPe(yt)),Et=Ie.get(a),Lt=dXt({activeTabOffset:Et,horizontal:D,indicator:w,rtl:l}),Je=Lt.style;g.useEffect(function(){ut()},[a,Me,Ce,BPe(Et),BPe(Ie),D]),g.useEffect(function(){Rt()},[l]);var st=!!at.length,It="".concat(C,"-nav-wrap"),ot,it,Be,pt;return D?l?(it=U>0,ot=U!==Ce):(ot=U<0,it=U!==Me):(Be=L<0,pt=L!==Me),g.createElement(Ld,{onResize:Rt},g.createElement("div",{ref:E7(e,A),role:"tablist","aria-orientation":D?"horizontal":"vertical",className:Bn("".concat(C,"-nav"),n),style:o,onKeyDown:function(){Fe()}},g.createElement(YPe,{ref:S,position:"left",extra:s,prefixCls:C}),g.createElement(Ld,{onResize:Rt},g.createElement("div",{className:Bn(It,Ch(Ch(Ch(Ch({},"".concat(It,"-ping-left"),ot),"".concat(It,"-ping-right"),it),"".concat(It,"-ping-top"),Be),"".concat(It,"-ping-bottom"),pt)),ref:b},g.createElement(Ld,{onResize:Rt},g.createElement("div",{ref:T,className:"".concat(C,"-nav-list"),style:{transform:"translate(".concat(U,"px, ").concat(L,"px)"),transition:Ue?"none":void 0}},Yt,g.createElement(set,{ref:M,prefixCls:C,locale:u,editable:c,style:Sy(Sy({},Yt.length===0?void 0:Pt),{},{visibility:st?"hidden":null})}),g.createElement("div",{className:Bn("".concat(C,"-ink-bar"),Ch({},"".concat(C,"-ink-bar-animated"),i.inkBar)),style:Je}))))),g.createElement(WXt,y3({},t,{removeAriaLabel:u==null?void 0:u.removeAriaLabel,ref:R,prefixCls:C,tabs:at,className:!st&&Se,tabMoving:!!Ue})),g.createElement(YPe,{ref:v,position:"right",extra:s,prefixCls:C})))}),cet=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.id,a=t.active,l=t.tabKey,s=t.children;return g.createElement("div",{id:i&&"".concat(i,"-panel-").concat(l),role:"tabpanel",tabIndex:a?0:-1,"aria-labelledby":i&&"".concat(i,"-tab-").concat(l),"aria-hidden":!a,style:r,className:Bn(n,a&&"".concat(n,"-active"),o),ref:e},s)}),jXt=["renderTabBar"],BXt=["label","key"],YXt=function(e){var n=e.renderTabBar,o=hJ(e,jXt),r=g.useContext(uee),i=r.tabs;if(n){var a=Sy(Sy({},o),{},{panes:i.map(function(l){var s=l.label,c=l.key,u=hJ(l,BXt);return g.createElement(cet,y3({tab:s,key:c,tabKey:c},u))})});return n(a,_Pe)}return g.createElement(_Pe,o)},OXt=["key","forceRender","style","className","destroyInactiveTabPane"],_Xt=function(e){var n=e.id,o=e.activeKey,r=e.animated,i=e.tabPosition,a=e.destroyInactiveTabPane,l=g.useContext(uee),s=l.prefixCls,c=l.tabs,u=r.tabPane,d="".concat(s,"-tabpane");return g.createElement("div",{className:Bn("".concat(s,"-content-holder"))},g.createElement("div",{className:Bn("".concat(s,"-content"),"".concat(s,"-content-").concat(i),Ch({},"".concat(s,"-content-animated"),u))},c.map(function(f){var p=f.key,m=f.forceRender,y=f.style,w=f.className,x=f.destroyInactiveTabPane,C=hJ(f,OXt),P=p===o;return g.createElement(Oy,y3({key:p,visible:P,forceRender:m,removeOnLeave:!!(a||x),leavedClassName:"".concat(d,"-hidden")},r.tabPaneMotion),function(A,S){var v=A.style,b=A.className;return g.createElement(cet,y3({},C,{prefixCls:d,id:n,tabKey:p,animated:u,active:P,style:Sy(Sy({},y),v),className:Bn(w,b),ref:S}))})})))};function VXt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},e;return t===!1?e={inkBar:!1,tabPane:!1}:t===!0?e={inkBar:!0,tabPane:!1}:e=Sy({inkBar:!0},i7(t)==="object"?t:{}),e.tabPaneMotion&&e.tabPane===void 0&&(e.tabPane=!0),!e.tabPaneMotion&&e.tabPane&&(e.tabPane=!1),e}var GXt=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],VPe=0,XXt=g.forwardRef(function(t,e){var n=t.id,o=t.prefixCls,r=o===void 0?"rc-tabs":o,i=t.className,a=t.items,l=t.direction,s=t.activeKey,c=t.defaultActiveKey,u=t.editable,d=t.animated,f=t.tabPosition,p=f===void 0?"top":f,m=t.tabBarGutter,y=t.tabBarStyle,w=t.tabBarExtraContent,x=t.locale,C=t.more,P=t.destroyInactiveTabPane,A=t.renderTabBar,S=t.onChange,v=t.onTabClick,b=t.onTabScroll,T=t.getPopupContainer,R=t.popupClassName,M=t.indicator,D=hJ(t,GXt),k=g.useMemo(function(){return(a||[]).filter(function(de){return de&&i7(de)==="object"&&"key"in de})},[a]),N=l==="rtl",U=VXt(d),W=g.useState(!1),F=Qs(W,2),E=F[0],L=F[1];g.useEffect(function(){L(d9e())},[]);var j=o0(function(){var de;return(de=k[0])===null||de===void 0?void 0:de.key},{value:s,defaultValue:c}),Y=Qs(j,2),O=Y[0],_=Y[1],G=g.useState(function(){return k.findIndex(function(de){return de.key===O})}),Q=Qs(G,2),oe=Q[0],ee=Q[1];g.useEffect(function(){var de=k.findIndex(function(me){return me.key===O});if(de===-1){var he;de=Math.max(0,Math.min(oe,k.length-1)),_((he=k[de])===null||he===void 0?void 0:he.key)}ee(de)},[k.map(function(de){return de.key}).join("_"),O,oe]);var q=o0(null,{value:n}),ae=Qs(q,2),Z=ae[0],ne=ae[1];g.useEffect(function(){n||(ne("rc-tabs-".concat(VPe)),VPe+=1)},[]);function te(de,he){v==null||v(de,he);var me=de!==O;_(de),me&&(S==null||S(de))}var $={id:Z,activeKey:O,animated:U,tabPosition:p,rtl:N,mobile:E},le=Sy(Sy({},$),{},{editable:u,locale:x,more:C,tabBarGutter:m,onTabClick:te,onTabScroll:b,extra:w,style:y,panes:null,getPopupContainer:T,popupClassName:R,indicator:M});return g.createElement(uee.Provider,{value:{tabs:k,prefixCls:r}},g.createElement("div",y3({ref:e,id:n,className:Bn(r,"".concat(r,"-").concat(p),Ch(Ch(Ch({},"".concat(r,"-mobile"),E),"".concat(r,"-editable"),u),"".concat(r,"-rtl"),N),i)},D),g.createElement(YXt,y3({},le,{renderTabBar:A})),g.createElement(_Xt,y3({destroyInactiveTabPane:P},$,{animated:U}))))});const JXt={motionAppear:!1,motionEnter:!0,motionLeave:!0};function KXt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{inkBar:!0,tabPane:!1},n;return e===!1?n={inkBar:!1,tabPane:!1}:e===!0?n={inkBar:!0,tabPane:!0}:n=Object.assign({inkBar:!0},typeof e=="object"?e:{}),n.tabPane&&(n.tabPaneMotion=Object.assign(Object.assign({},JXt),{motionName:L1(t,"switch")})),n}var $Xt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re)}function QXt(t,e){if(t)return t;const n=jy(e).map(o=>{if(g.isValidElement(o)){const{key:r,props:i}=o,a=i||{},{tab:l}=a,s=$Xt(a,["tab"]);return Object.assign(Object.assign({key:String(r)},s),{label:l})}return null});return qXt(n)}const ZXt=t=>{const{componentCls:e,motionDurationSlow:n}=t;return[{[e]:{[`${e}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${n}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${n}`}}}}},[D3(t,"slide-up"),D3(t,"slide-down")]]},eJt=t=>{const{componentCls:e,tabsCardPadding:n,cardBg:o,cardGutter:r,colorBorderSecondary:i,itemSelectedColor:a}=t;return{[`${e}-card`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{margin:0,padding:n,background:o,border:`${jt(t.lineWidth)} ${t.lineType} ${i}`,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`},[`${e}-tab-active`]:{color:a,background:t.colorBgContainer},[`${e}-tab-focus`]:Object.assign({},z3(t,-3)),[`${e}-ink-bar`]:{visibility:"hidden"},[`& ${e}-tab${e}-tab-focus ${e}-tab-btn`]:{outline:"none"}},[`&${e}-top, &${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginLeft:{_skip_check_:!0,value:jt(r)}}}},[`&${e}-top`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`},[`${e}-tab-active`]:{borderBottomColor:t.colorBgContainer}}},[`&${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)}`},[`${e}-tab-active`]:{borderTopColor:t.colorBgContainer}}},[`&${e}-left, &${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginTop:jt(r)}}},[`&${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadiusLG)} 0 0 ${jt(t.borderRadiusLG)}`}},[`${e}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:t.colorBgContainer}}}},[`&${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0`}},[`${e}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:t.colorBgContainer}}}}}}},tJt=t=>{const{componentCls:e,itemHoverColor:n,dropdownEdgeChildVerticalPadding:o}=t;return{[`${e}-dropdown`]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:t.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${e}-dropdown-menu`]:{maxHeight:t.tabsDropdownHeight,margin:0,padding:`${jt(o)} 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:t.colorBgContainer,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,"&-item":Object.assign(Object.assign({},e7),{display:"flex",alignItems:"center",minWidth:t.tabsDropdownWidth,margin:0,padding:`${jt(t.paddingXXS)} ${jt(t.paddingSM)}`,color:t.colorText,fontWeight:"normal",fontSize:t.fontSize,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:t.marginSM},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:n}},"&:hover":{background:t.controlItemBgHover},"&-disabled":{"&, &:hover":{color:t.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},nJt=t=>{const{componentCls:e,margin:n,colorBorderSecondary:o,horizontalMargin:r,verticalItemPadding:i,verticalItemMargin:a,calc:l}=t;return{[`${e}-top, ${e}-bottom`]:{flexDirection:"column",[`> ${e}-nav, > div > ${e}-nav`]:{margin:r,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${o}`,content:"''"},[`${e}-ink-bar`]:{height:t.lineWidthBold,"&-animated":{transition:`width ${t.motionDurationSlow}, left ${t.motionDurationSlow}, +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PXt(t,e){return vXt(t)||bXt(t,e)||SXt(t,e)||TXt()}function CXt(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function RXt(t,e){if(t==null)return{};var n=CXt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var HXt=Lo.ESC,MXt=Lo.TAB;function IXt(t){var e=t.visible,n=t.triggerRef,o=t.onVisibleChange,r=t.autoFocus,i=t.overlayRef,a=g.useRef(!1),l=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),o==null||o(!1)}},s=function(){var d;return(d=i.current)!==null&&d!==void 0&&d.focus?(i.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case HXt:l();break;case MXt:{var f=!1;a.current||(f=s()),f?d.preventDefault():l();break}}};g.useEffect(function(){return e?(window.addEventListener("keydown",c),r&&Ic(s,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var zXt=g.forwardRef(function(t,e){var n=t.overlay,o=t.arrow,r=t.prefixCls,i=g.useMemo(function(){var l;return typeof n=="function"?l=n():l=n,l},[n]),a=oU(e,i==null?void 0:i.ref);return xe.createElement(xe.Fragment,null,o&&xe.createElement("div",{className:"".concat(r,"-arrow")}),xe.cloneElement(i,{ref:Z8(i)?a:void 0}))}),NP={adjustX:1,adjustY:1},UP=[0,0],DXt={topLeft:{points:["bl","tl"],overflow:NP,offset:[0,-4],targetOffset:UP},top:{points:["bc","tc"],overflow:NP,offset:[0,-4],targetOffset:UP},topRight:{points:["br","tr"],overflow:NP,offset:[0,-4],targetOffset:UP},bottomLeft:{points:["tl","bl"],overflow:NP,offset:[0,4],targetOffset:UP},bottom:{points:["tc","bc"],overflow:NP,offset:[0,4],targetOffset:UP},bottomRight:{points:["tr","br"],overflow:NP,offset:[0,4],targetOffset:UP}},EXt=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function kXt(t,e){var n,o=t.arrow,r=o===void 0?!1:o,i=t.prefixCls,a=i===void 0?"rc-dropdown":i,l=t.transitionName,s=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?DXt:f,m=t.getPopupContainer,y=t.showAction,w=t.hideAction,x=t.overlayClassName,C=t.overlayStyle,P=t.visible,A=t.trigger,S=A===void 0?["hover"]:A,v=t.autoFocus,b=t.overlay,T=t.children,R=t.onVisibleChange,M=RXt(t,EXt),D=xe.useState(),k=PXt(D,2),N=k[0],U=k[1],W="visible"in t?P:N,F=xe.useRef(null),E=xe.useRef(null),L=xe.useRef(null);xe.useImperativeHandle(e,function(){return F.current});var j=function(ae){U(ae),R==null||R(ae)};IXt({visible:W,triggerRef:L,onVisibleChange:j,autoFocus:v,overlayRef:E});var Y=function(ae){var Z=t.onOverlayClick;U(!1),Z&&Z(ae)},O=function(){return xe.createElement(zXt,{ref:E,overlay:b,prefixCls:a,arrow:r})},_=function(){return typeof b=="function"?O:O()},G=function(){var ae=t.minOverlayWidthMatchTrigger,Z=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?ae:!Z},Q=function(){var ae=t.openClassName;return ae!==void 0?ae:"".concat(a,"-open")},oe=xe.cloneElement(T,{className:Bn((n=T.props)===null||n===void 0?void 0:n.className,W&&Q()),ref:Z8(T)?oU(L,T.ref):void 0}),ee=w;return!ee&&S.indexOf("contextMenu")!==-1&&(ee=["click"]),xe.createElement(eI,khe({builtinPlacements:p},M,{prefixCls:a,ref:F,popupClassName:Bn(x,xXt({},"".concat(a,"-show-arrow"),r)),popupStyle:C,action:S,showAction:y,hideAction:ee,popupPlacement:d,popupAlign:c,popupTransitionName:l,popupAnimation:s,popupVisible:W,stretch:G()?"minWidth":"",popup:_(),onPopupVisibleChange:j,onPopupClick:Y,getPopupContainer:m}),oe)}const FXt=xe.forwardRef(kXt);var LXt=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.id,r=t.tabs,i=t.locale,a=t.mobile,l=t.more,s=l===void 0?{}:l,c=t.style,u=t.className,d=t.editable,f=t.tabBarGutter,p=t.rtl,m=t.removeAriaLabel,y=t.onTabClick,w=t.getPopupContainer,x=t.popupClassName,C=g.useState(!1),P=Qs(C,2),A=P[0],S=P[1],v=g.useState(null),b=Qs(v,2),T=b[0],R=b[1],M=s.icon,D=M===void 0?"More":M,k="".concat(o,"-more-popup"),N="".concat(n,"-dropdown"),U=T!==null?"".concat(k,"-").concat(T):null,W=i==null?void 0:i.dropdownAriaLabel;function F(G,Q){G.preventDefault(),G.stopPropagation(),d.onEdit("remove",{key:Q,event:G})}var E=g.createElement(oI,{onClick:function(Q){var oe=Q.key,ee=Q.domEvent;y(oe,ee),S(!1)},prefixCls:"".concat(N,"-menu"),id:k,tabIndex:-1,role:"listbox","aria-activedescendant":U,selectedKeys:[T],"aria-label":W!==void 0?W:"expanded dropdown"},r.map(function(G){var Q=G.closable,oe=G.disabled,ee=G.closeIcon,$=G.key,ae=G.label,Z=K9e(Q,ee,d,oe);return g.createElement(yU,{key:$,id:"".concat(k,"-").concat($),role:"option","aria-controls":o&&"".concat(o,"-panel-").concat($),disabled:oe},g.createElement("span",null,ae),Z&&g.createElement("button",{type:"button","aria-label":m||"remove",tabIndex:0,className:"".concat(N,"-menu-item-remove"),onClick:function(te){te.stopPropagation(),F(te,$)}},ee||d.removeIcon||"×"))}));function L(G){for(var Q=r.filter(function(Z){return!Z.disabled}),oe=Q.findIndex(function(Z){return Z.key===T})||0,ee=Q.length,$=0;$Xe?"left":"right"})}),N=Qs(k,2),U=N[0],W=N[1],F=WPe(0,function(ct,Xe){!D&&y&&y({direction:ct>Xe?"top":"bottom"})}),E=Qs(F,2),L=E[0],j=E[1],Y=g.useState([0,0]),O=Qs(Y,2),_=O[0],G=O[1],Q=g.useState([0,0]),oe=Qs(Q,2),ee=oe[0],$=oe[1],ae=g.useState([0,0]),Z=Qs(ae,2),ne=Z[0],te=Z[1],q=g.useState([0,0]),le=Qs(q,2),de=le[0],he=le[1],me=gXt(new Map),ce=Qs(me,2),Pe=ce[0],pe=ce[1],Ie=fXt(P,Pe,ee[0]),ve=qO(_,D),ze=qO(ee,D),Ae=qO(ne,D),se=qO(de,D),ge=Math.floor(ve)Ce?Ce:ct}var Re=g.useRef(null),Ne=g.useState(),_e=Qs(Ne,2),Ue=_e[0],qe=_e[1];function Fe(){qe(Date.now())}function He(){Re.current&&clearTimeout(Re.current)}pXt(b,function(ct,Xe){function ft(wt,kt){wt(function(Zt){var Ot=Te(Zt+kt);return Ot})}return ge?(D?ft(W,ct):ft(j,Xe),He(),Fe(),!0):!1}),g.useEffect(function(){return He(),Ue&&(Re.current=setTimeout(function(){qe(0)},100)),He},[Ue]);var Le=mXt(Ie,we,D?U:L,ze,Ae,se,Sy(Sy({},t),{},{tabs:P})),Ye=Qs(Le,2),lt=Ye[0],Oe=Ye[1],ut=Dd(function(){var ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:a,Xe=Ie.get(ct)||{width:0,height:0,left:0,right:0,top:0};if(D){var ft=U;l?Xe.rightU+we&&(ft=Xe.right+Xe.width-we):Xe.left<-U?ft=-Xe.left:Xe.left+Xe.width>-U+we&&(ft=-(Xe.left+Xe.width-we)),j(0),W(Te(ft))}else{var wt=L;Xe.top<-L?wt=-Xe.top:Xe.top+Xe.height>-L+we&&(wt=-(Xe.top+Xe.height-we)),W(0),j(Te(wt))}}),ht=g.useState(),Qe=Qs(ht,2),nt=Qe[0],mt=Qe[1],tt=g.useState(!1),gt=Qs(tt,2),Ve=gt[0],je=gt[1],et=P.filter(function(ct){return!ct.disabled}).map(function(ct){return ct.key}),bt=function(Xe){var ft=et.indexOf(nt||a),wt=et.length,kt=(ft+Xe+wt)%wt,Zt=et[kt];mt(Zt)},St=function(Xe){var ft=Xe.code,wt=l&&D,kt=et[0],Zt=et[et.length-1];switch(ft){case"ArrowLeft":{D&&bt(wt?1:-1);break}case"ArrowRight":{D&&bt(wt?-1:1);break}case"ArrowUp":{Xe.preventDefault(),D||bt(-1);break}case"ArrowDown":{Xe.preventDefault(),D||bt(1);break}case"Home":{Xe.preventDefault(),mt(kt);break}case"End":{Xe.preventDefault(),mt(Zt);break}case"Enter":case"Space":{Xe.preventDefault(),m(nt,Xe);break}case"Backspace":case"Delete":{var Ot=et.indexOf(nt),on=P.find(function(rn){return rn.key===nt}),qt=K9e(on==null?void 0:on.closable,on==null?void 0:on.closeIcon,c,on==null?void 0:on.disabled);qt&&(Xe.preventDefault(),Xe.stopPropagation(),c.onEdit("remove",{key:nt,event:Xe}),Ot===et.length-1?bt(-1):bt(1));break}}},Pt={};D?Pt[l?"marginRight":"marginLeft"]=f:Pt.marginTop=f;var Yt=P.map(function(ct,Xe){var ft=ct.key;return g.createElement(NXt,{id:r,prefixCls:C,key:ft,tab:ct,style:Xe===0?void 0:Pt,closable:ct.closable,editable:c,active:ft===a,focus:ft===nt,renderWrapper:p,removeAriaLabel:u==null?void 0:u.removeAriaLabel,tabCount:et.length,currentPosition:Xe+1,onClick:function(kt){m(ft,kt)},onKeyDown:St,onFocus:function(){Ve||mt(ft),ut(ft),Fe(),b.current&&(l||(b.current.scrollLeft=0),b.current.scrollTop=0)},onBlur:function(){mt(void 0)},onMouseDown:function(){je(!0)},onMouseUp:function(){je(!1)}})}),zt=function(){return pe(function(){var Xe,ft=new Map,wt=(Xe=T.current)===null||Xe===void 0?void 0:Xe.getBoundingClientRect();return P.forEach(function(kt){var Zt,Ot=kt.key,on=(Zt=T.current)===null||Zt===void 0?void 0:Zt.querySelector('[data-node-key="'.concat(aet(Ot),'"]'));if(on){var qt=UXt(on,wt),rn=Qs(qt,4),Pn=rn[0],fo=rn[1],to=rn[2],Dt=rn[3];ft.set(Ot,{width:Pn,height:fo,left:to,top:Dt})}}),ft})};g.useEffect(function(){zt()},[P.map(function(ct){return ct.key}).join("_")]);var Rt=iet(function(){var ct=jP(A),Xe=jP(S),ft=jP(v);G([ct[0]-Xe[0]-ft[0],ct[1]-Xe[1]-ft[1]]);var wt=jP(M);te(wt);var kt=jP(R);he(kt);var Zt=jP(T);$([Zt[0]-wt[0],Zt[1]-wt[1]]),zt()}),Ct=P.slice(0,lt),yt=P.slice(Oe+1),at=[].concat(FPe(Ct),FPe(yt)),Et=Ie.get(a),Lt=dXt({activeTabOffset:Et,horizontal:D,indicator:w,rtl:l}),Je=Lt.style;g.useEffect(function(){ut()},[a,Me,Ce,BPe(Et),BPe(Ie),D]),g.useEffect(function(){Rt()},[l]);var st=!!at.length,It="".concat(C,"-nav-wrap"),ot,it,Be,pt;return D?l?(it=U>0,ot=U!==Ce):(ot=U<0,it=U!==Me):(Be=L<0,pt=L!==Me),g.createElement(Ld,{onResize:Rt},g.createElement("div",{ref:E7(e,A),role:"tablist","aria-orientation":D?"horizontal":"vertical",className:Bn("".concat(C,"-nav"),n),style:o,onKeyDown:function(){Fe()}},g.createElement(YPe,{ref:S,position:"left",extra:s,prefixCls:C}),g.createElement(Ld,{onResize:Rt},g.createElement("div",{className:Bn(It,Ch(Ch(Ch(Ch({},"".concat(It,"-ping-left"),ot),"".concat(It,"-ping-right"),it),"".concat(It,"-ping-top"),Be),"".concat(It,"-ping-bottom"),pt)),ref:b},g.createElement(Ld,{onResize:Rt},g.createElement("div",{ref:T,className:"".concat(C,"-nav-list"),style:{transform:"translate(".concat(U,"px, ").concat(L,"px)"),transition:Ue?"none":void 0}},Yt,g.createElement(set,{ref:M,prefixCls:C,locale:u,editable:c,style:Sy(Sy({},Yt.length===0?void 0:Pt),{},{visibility:st?"hidden":null})}),g.createElement("div",{className:Bn("".concat(C,"-ink-bar"),Ch({},"".concat(C,"-ink-bar-animated"),i.inkBar)),style:Je}))))),g.createElement(WXt,y3({},t,{removeAriaLabel:u==null?void 0:u.removeAriaLabel,ref:R,prefixCls:C,tabs:at,className:!st&&Se,tabMoving:!!Ue})),g.createElement(YPe,{ref:v,position:"right",extra:s,prefixCls:C})))}),cet=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.id,a=t.active,l=t.tabKey,s=t.children;return g.createElement("div",{id:i&&"".concat(i,"-panel-").concat(l),role:"tabpanel",tabIndex:a?0:-1,"aria-labelledby":i&&"".concat(i,"-tab-").concat(l),"aria-hidden":!a,style:r,className:Bn(n,a&&"".concat(n,"-active"),o),ref:e},s)}),jXt=["renderTabBar"],BXt=["label","key"],YXt=function(e){var n=e.renderTabBar,o=hJ(e,jXt),r=g.useContext(uee),i=r.tabs;if(n){var a=Sy(Sy({},o),{},{panes:i.map(function(l){var s=l.label,c=l.key,u=hJ(l,BXt);return g.createElement(cet,y3({tab:s,key:c,tabKey:c},u))})});return n(a,_Pe)}return g.createElement(_Pe,o)},OXt=["key","forceRender","style","className","destroyInactiveTabPane"],_Xt=function(e){var n=e.id,o=e.activeKey,r=e.animated,i=e.tabPosition,a=e.destroyInactiveTabPane,l=g.useContext(uee),s=l.prefixCls,c=l.tabs,u=r.tabPane,d="".concat(s,"-tabpane");return g.createElement("div",{className:Bn("".concat(s,"-content-holder"))},g.createElement("div",{className:Bn("".concat(s,"-content"),"".concat(s,"-content-").concat(i),Ch({},"".concat(s,"-content-animated"),u))},c.map(function(f){var p=f.key,m=f.forceRender,y=f.style,w=f.className,x=f.destroyInactiveTabPane,C=hJ(f,OXt),P=p===o;return g.createElement(Oy,y3({key:p,visible:P,forceRender:m,removeOnLeave:!!(a||x),leavedClassName:"".concat(d,"-hidden")},r.tabPaneMotion),function(A,S){var v=A.style,b=A.className;return g.createElement(cet,y3({},C,{prefixCls:d,id:n,tabKey:p,animated:u,active:P,style:Sy(Sy({},y),v),className:Bn(w,b),ref:S}))})})))};function VXt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},e;return t===!1?e={inkBar:!1,tabPane:!1}:t===!0?e={inkBar:!0,tabPane:!1}:e=Sy({inkBar:!0},i7(t)==="object"?t:{}),e.tabPaneMotion&&e.tabPane===void 0&&(e.tabPane=!0),!e.tabPaneMotion&&e.tabPane&&(e.tabPane=!1),e}var GXt=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],VPe=0,XXt=g.forwardRef(function(t,e){var n=t.id,o=t.prefixCls,r=o===void 0?"rc-tabs":o,i=t.className,a=t.items,l=t.direction,s=t.activeKey,c=t.defaultActiveKey,u=t.editable,d=t.animated,f=t.tabPosition,p=f===void 0?"top":f,m=t.tabBarGutter,y=t.tabBarStyle,w=t.tabBarExtraContent,x=t.locale,C=t.more,P=t.destroyInactiveTabPane,A=t.renderTabBar,S=t.onChange,v=t.onTabClick,b=t.onTabScroll,T=t.getPopupContainer,R=t.popupClassName,M=t.indicator,D=hJ(t,GXt),k=g.useMemo(function(){return(a||[]).filter(function(de){return de&&i7(de)==="object"&&"key"in de})},[a]),N=l==="rtl",U=VXt(d),W=g.useState(!1),F=Qs(W,2),E=F[0],L=F[1];g.useEffect(function(){L(d9e())},[]);var j=o0(function(){var de;return(de=k[0])===null||de===void 0?void 0:de.key},{value:s,defaultValue:c}),Y=Qs(j,2),O=Y[0],_=Y[1],G=g.useState(function(){return k.findIndex(function(de){return de.key===O})}),Q=Qs(G,2),oe=Q[0],ee=Q[1];g.useEffect(function(){var de=k.findIndex(function(me){return me.key===O});if(de===-1){var he;de=Math.max(0,Math.min(oe,k.length-1)),_((he=k[de])===null||he===void 0?void 0:he.key)}ee(de)},[k.map(function(de){return de.key}).join("_"),O,oe]);var $=o0(null,{value:n}),ae=Qs($,2),Z=ae[0],ne=ae[1];g.useEffect(function(){n||(ne("rc-tabs-".concat(VPe)),VPe+=1)},[]);function te(de,he){v==null||v(de,he);var me=de!==O;_(de),me&&(S==null||S(de))}var q={id:Z,activeKey:O,animated:U,tabPosition:p,rtl:N,mobile:E},le=Sy(Sy({},q),{},{editable:u,locale:x,more:C,tabBarGutter:m,onTabClick:te,onTabScroll:b,extra:w,style:y,panes:null,getPopupContainer:T,popupClassName:R,indicator:M});return g.createElement(uee.Provider,{value:{tabs:k,prefixCls:r}},g.createElement("div",y3({ref:e,id:n,className:Bn(r,"".concat(r,"-").concat(p),Ch(Ch(Ch({},"".concat(r,"-mobile"),E),"".concat(r,"-editable"),u),"".concat(r,"-rtl"),N),i)},D),g.createElement(YXt,y3({},le,{renderTabBar:A})),g.createElement(_Xt,y3({destroyInactiveTabPane:P},q,{animated:U}))))});const JXt={motionAppear:!1,motionEnter:!0,motionLeave:!0};function KXt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{inkBar:!0,tabPane:!1},n;return e===!1?n={inkBar:!1,tabPane:!1}:e===!0?n={inkBar:!0,tabPane:!0}:n=Object.assign({inkBar:!0},typeof e=="object"?e:{}),n.tabPane&&(n.tabPaneMotion=Object.assign(Object.assign({},JXt),{motionName:L1(t,"switch")})),n}var $Xt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re)}function QXt(t,e){if(t)return t;const n=jy(e).map(o=>{if(g.isValidElement(o)){const{key:r,props:i}=o,a=i||{},{tab:l}=a,s=$Xt(a,["tab"]);return Object.assign(Object.assign({key:String(r)},s),{label:l})}return null});return qXt(n)}const ZXt=t=>{const{componentCls:e,motionDurationSlow:n}=t;return[{[e]:{[`${e}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${n}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${n}`}}}}},[D3(t,"slide-up"),D3(t,"slide-down")]]},eJt=t=>{const{componentCls:e,tabsCardPadding:n,cardBg:o,cardGutter:r,colorBorderSecondary:i,itemSelectedColor:a}=t;return{[`${e}-card`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{margin:0,padding:n,background:o,border:`${jt(t.lineWidth)} ${t.lineType} ${i}`,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`},[`${e}-tab-active`]:{color:a,background:t.colorBgContainer},[`${e}-tab-focus`]:Object.assign({},z3(t,-3)),[`${e}-ink-bar`]:{visibility:"hidden"},[`& ${e}-tab${e}-tab-focus ${e}-tab-btn`]:{outline:"none"}},[`&${e}-top, &${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginLeft:{_skip_check_:!0,value:jt(r)}}}},[`&${e}-top`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`},[`${e}-tab-active`]:{borderBottomColor:t.colorBgContainer}}},[`&${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)}`},[`${e}-tab-active`]:{borderTopColor:t.colorBgContainer}}},[`&${e}-left, &${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginTop:jt(r)}}},[`&${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadiusLG)} 0 0 ${jt(t.borderRadiusLG)}`}},[`${e}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:t.colorBgContainer}}}},[`&${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0`}},[`${e}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:t.colorBgContainer}}}}}}},tJt=t=>{const{componentCls:e,itemHoverColor:n,dropdownEdgeChildVerticalPadding:o}=t;return{[`${e}-dropdown`]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:t.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${e}-dropdown-menu`]:{maxHeight:t.tabsDropdownHeight,margin:0,padding:`${jt(o)} 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:t.colorBgContainer,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,"&-item":Object.assign(Object.assign({},e7),{display:"flex",alignItems:"center",minWidth:t.tabsDropdownWidth,margin:0,padding:`${jt(t.paddingXXS)} ${jt(t.paddingSM)}`,color:t.colorText,fontWeight:"normal",fontSize:t.fontSize,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:t.marginSM},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:n}},"&:hover":{background:t.controlItemBgHover},"&-disabled":{"&, &:hover":{color:t.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},nJt=t=>{const{componentCls:e,margin:n,colorBorderSecondary:o,horizontalMargin:r,verticalItemPadding:i,verticalItemMargin:a,calc:l}=t;return{[`${e}-top, ${e}-bottom`]:{flexDirection:"column",[`> ${e}-nav, > div > ${e}-nav`]:{margin:r,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${o}`,content:"''"},[`${e}-ink-bar`]:{height:t.lineWidthBold,"&-animated":{transition:`width ${t.motionDurationSlow}, left ${t.motionDurationSlow}, right ${t.motionDurationSlow}`}},[`${e}-nav-wrap`]:{"&::before, &::after":{top:0,bottom:0,width:t.controlHeight},"&::before":{left:{_skip_check_:!0,value:0},boxShadow:t.boxShadowTabsOverflowLeft},"&::after":{right:{_skip_check_:!0,value:0},boxShadow:t.boxShadowTabsOverflowRight},[`&${e}-nav-wrap-ping-left::before`]:{opacity:1},[`&${e}-nav-wrap-ping-right::after`]:{opacity:1}}}},[`${e}-top`]:{[`> ${e}-nav, - > div > ${e}-nav`]:{"&::before":{bottom:0},[`${e}-ink-bar`]:{bottom:0}}},[`${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,marginTop:n,marginBottom:0,"&::before":{top:0},[`${e}-ink-bar`]:{top:0}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0}},[`${e}-left, ${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{flexDirection:"column",minWidth:l(t.controlHeight).mul(1.25).equal(),[`${e}-tab`]:{padding:i,textAlign:"center"},[`${e}-tab + ${e}-tab`]:{margin:a},[`${e}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:t.controlHeight},"&::before":{top:0,boxShadow:t.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:t.boxShadowTabsOverflowBottom},[`&${e}-nav-wrap-ping-top::before`]:{opacity:1},[`&${e}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${e}-ink-bar`]:{width:t.lineWidthBold,"&-animated":{transition:`height ${t.motionDurationSlow}, top ${t.motionDurationSlow}`}},[`${e}-nav-list, ${e}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{marginLeft:{_skip_check_:!0,value:jt(l(t.lineWidth).mul(-1).equal())},borderLeft:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:t.paddingLG}}}},[`${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,[`${e}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:l(t.lineWidth).mul(-1).equal()},borderRight:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingRight:{_skip_check_:!0,value:t.paddingLG}}}}}},oJt=t=>{const{componentCls:e,cardPaddingSM:n,cardPaddingLG:o,horizontalItemPaddingSM:r,horizontalItemPaddingLG:i}=t;return{[e]:{"&-small":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:r,fontSize:t.titleFontSizeSM}}},"&-large":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:i,fontSize:t.titleFontSizeLG}}}},[`${e}-card`]:{[`&${e}-small`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:n}},[`&${e}-bottom`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadius)} ${jt(t.borderRadius)}`}},[`&${e}-top`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`${jt(t.borderRadius)} ${jt(t.borderRadius)} 0 0`}},[`&${e}-right`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadius)} ${jt(t.borderRadius)} 0`}}},[`&${e}-left`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadius)} 0 0 ${jt(t.borderRadius)}`}}}},[`&${e}-large`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:o}}}}}},rJt=t=>{const{componentCls:e,itemActiveColor:n,itemHoverColor:o,iconCls:r,tabsHorizontalItemMargin:i,horizontalItemPadding:a,itemSelectedColor:l,itemColor:s}=t,c=`${e}-tab`;return{[c]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:a,fontSize:t.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:s,"&-btn, &-remove":{"&:focus:not(:focus-visible), &:active":{color:n}},"&-btn":{outline:"none",transition:`all ${t.motionDurationSlow}`,[`${c}-icon:not(:last-child)`]:{marginInlineEnd:t.marginSM}},"&-remove":Object.assign({flex:"none",marginRight:{_skip_check_:!0,value:t.calc(t.marginXXS).mul(-1).equal()},marginLeft:{_skip_check_:!0,value:t.marginXS},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"&:hover":{color:t.colorTextHeading}},Yy(t)),"&:hover":{color:o},[`&${c}-active ${c}-btn`]:{color:l,textShadow:t.tabsActiveTextShadow},[`&${c}-focus ${c}-btn`]:Object.assign({},z3(t)),[`&${c}-disabled`]:{color:t.colorTextDisabled,cursor:"not-allowed"},[`&${c}-disabled ${c}-btn, &${c}-disabled ${e}-remove`]:{"&:focus, &:active":{color:t.colorTextDisabled}},[`& ${c}-remove ${r}`]:{margin:0},[`${r}:not(:last-child)`]:{marginRight:{_skip_check_:!0,value:t.marginSM}}},[`${c} + ${c}`]:{margin:{_skip_check_:!0,value:i}}}},iJt=t=>{const{componentCls:e,tabsHorizontalItemMarginRTL:n,iconCls:o,cardGutter:r,calc:i}=t;return{[`${e}-rtl`]:{direction:"rtl",[`${e}-nav`]:{[`${e}-tab`]:{margin:{_skip_check_:!0,value:n},[`${e}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[o]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:jt(t.marginSM)}},[`${e}-tab-remove`]:{marginRight:{_skip_check_:!0,value:jt(t.marginXS)},marginLeft:{_skip_check_:!0,value:jt(i(t.marginXXS).mul(-1).equal())},[o]:{margin:0}}}},[`&${e}-left`]:{[`> ${e}-nav`]:{order:1},[`> ${e}-content-holder`]:{order:0}},[`&${e}-right`]:{[`> ${e}-nav`]:{order:0},[`> ${e}-content-holder`]:{order:1}},[`&${e}-card${e}-top, &${e}-card${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginRight:{_skip_check_:!0,value:r},marginLeft:{_skip_check_:!0,value:0}}}}},[`${e}-dropdown-rtl`]:{direction:"rtl"},[`${e}-menu-item`]:{[`${e}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},aJt=t=>{const{componentCls:e,tabsCardPadding:n,cardHeight:o,cardGutter:r,itemHoverColor:i,itemActiveColor:a,colorBorderSecondary:l}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{display:"flex",[`> ${e}-nav, > div > ${e}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${e}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${t.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${e}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${t.motionDurationSlow}`},[`${e}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${e}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${e}-nav-more`]:{position:"relative",padding:n,background:"transparent",border:0,color:t.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:t.calc(t.controlHeightLG).div(8).equal(),transform:"translateY(100%)",content:"''"}},[`${e}-nav-add`]:Object.assign({minWidth:o,marginLeft:{_skip_check_:!0,value:r},padding:jt(t.paddingXS),background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} ${l}`,borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`,outline:"none",cursor:"pointer",color:t.colorText,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`,"&:hover":{color:i},"&:active, &:focus:not(:focus-visible)":{color:a}},Yy(t,-3))},[`${e}-extra-content`]:{flex:"none"},[`${e}-ink-bar`]:{position:"absolute",background:t.inkBarColor,pointerEvents:"none"}}),rJt(t)),{[`${e}-content`]:{position:"relative",width:"100%"},[`${e}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${e}-tabpane`]:Object.assign(Object.assign({},Yy(t)),{"&-hidden":{display:"none"}})}),[`${e}-centered`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-nav-wrap`]:{[`&:not([class*='${e}-nav-wrap-ping']) > ${e}-nav-list`]:{margin:"auto"}}}}}},lJt=t=>{const e=t.controlHeightLG;return{zIndexPopup:t.zIndexPopupBase+50,cardBg:t.colorFillAlter,cardHeight:e,cardPadding:`${(e-Math.round(t.fontSize*t.lineHeight))/2-t.lineWidth}px ${t.padding}px`,cardPaddingSM:`${t.paddingXXS*1.5}px ${t.padding}px`,cardPaddingLG:`${t.paddingXS}px ${t.padding}px ${t.paddingXXS*1.5}px`,titleFontSize:t.fontSize,titleFontSizeLG:t.fontSizeLG,titleFontSizeSM:t.fontSize,inkBarColor:t.colorPrimary,horizontalMargin:`0 0 ${t.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${t.paddingSM}px 0`,horizontalItemPaddingSM:`${t.paddingXS}px 0`,horizontalItemPaddingLG:`${t.padding}px 0`,verticalItemPadding:`${t.paddingXS}px ${t.paddingLG}px`,verticalItemMargin:`${t.margin}px 0 0 0`,itemColor:t.colorText,itemSelectedColor:t.colorPrimary,itemHoverColor:t.colorPrimaryHover,itemActiveColor:t.colorPrimaryActive,cardGutter:t.marginXXS/2}},sJt=el("Tabs",t=>{const e=Ui(t,{tabsCardPadding:t.cardPadding,dropdownEdgeChildVerticalPadding:t.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${jt(t.horizontalItemGutter)}`,tabsHorizontalItemMarginRTL:`0 0 0 ${jt(t.horizontalItemGutter)}`});return[oJt(e),iJt(e),nJt(e),tJt(e),eJt(e),aJt(e),ZXt(e)]},lJt),cJt=()=>null;var uJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e,n,o,r,i,a,l,s,c,u,d;const{type:f,className:p,rootClassName:m,size:y,onEdit:w,hideAdd:x,centered:C,addIcon:P,removeIcon:A,moreIcon:S,more:v,popupClassName:b,children:T,items:R,animated:M,style:D,indicatorSize:k,indicator:N}=t,U=uJt(t,["type","className","rootClassName","size","onEdit","hideAdd","centered","addIcon","removeIcon","moreIcon","more","popupClassName","children","items","animated","style","indicatorSize","indicator"]),{prefixCls:W}=U,{direction:F,tabs:E,getPrefixCls:L,getPopupContainer:j}=g.useContext(gr),Y=L("tabs",W),O=nu(Y),[_,G,Q]=sJt(Y,O);let oe;f==="editable-card"&&(oe={onEdit:($,le)=>{let{key:de,event:he}=le;w==null||w($==="add"?he:de,$)},removeIcon:(e=A??(E==null?void 0:E.removeIcon))!==null&&e!==void 0?e:g.createElement(i6,null),addIcon:(P??(E==null?void 0:E.addIcon))||g.createElement(tXt,null),showAdd:x!==!0});const ee=L(),q=jd(y),ae=QXt(R,T),Z=KXt(Y,M),ne=Object.assign(Object.assign({},E==null?void 0:E.style),D),te={align:(n=N==null?void 0:N.align)!==null&&n!==void 0?n:(o=E==null?void 0:E.indicator)===null||o===void 0?void 0:o.align,size:(l=(i=(r=N==null?void 0:N.size)!==null&&r!==void 0?r:k)!==null&&i!==void 0?i:(a=E==null?void 0:E.indicator)===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:E==null?void 0:E.indicatorSize};return _(g.createElement(XXt,Object.assign({direction:F,getPopupContainer:j},U,{items:ae,className:Mn({[`${Y}-${q}`]:q,[`${Y}-card`]:["card","editable-card"].includes(f),[`${Y}-editable-card`]:f==="editable-card",[`${Y}-centered`]:C},E==null?void 0:E.className,p,m,G,Q,O),popupClassName:Mn(b,G,Q,O),style:ne,editable:oe,more:Object.assign({icon:(d=(u=(c=(s=E==null?void 0:E.more)===null||s===void 0?void 0:s.icon)!==null&&c!==void 0?c:E==null?void 0:E.moreIcon)!==null&&u!==void 0?u:S)!==null&&d!==void 0?d:g.createElement(z9e,null),transitionName:`${ee}-slide-up`},v),prefixCls:Y,animated:Z,indicator:te})))};dee.TabPane=cJt;function m1(t,e){return t[e]}var dJt=["children"];function uet(t,e){return"".concat(t,"-").concat(e)}function fJt(t){return t&&t.type&&t.type.isTreeNode}function bU(t,e){return t??e}function TH(t){var e=t||{},n=e.title,o=e._title,r=e.key,i=e.children,a=n||"title";return{title:a,_title:o||[a],key:r||"key",children:i||"children"}}function det(t){function e(n){var o=t7(n);return o.map(function(r){if(!fJt(r))return Ds(!r,"Tree/TreeNode can only accept TreeNode as children."),null;var i=r.key,a=r.props,l=a.children,s=Ai(a,dJt),c=nn({key:i},s),u=e(l);return u.length&&(c.children=u),c}).filter(function(r){return r})}return e(t)}function Zle(t,e,n){var o=TH(n),r=o._title,i=o.key,a=o.children,l=new Set(e===!0?[]:e),s=[];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return u.map(function(f,p){for(var m=uet(d?d.pos:"0",p),y=bU(f[i],m),w,x=0;x1&&arguments[1]!==void 0?arguments[1]:{},n=e.initWrapper,o=e.processEntity,r=e.onProcessFinished,i=e.externalGetKey,a=e.childrenPropName,l=e.fieldNames,s=arguments.length>2?arguments[2]:void 0,c=i||s,u={},d={},f={posEntities:u,keyEntities:d};return n&&(f=n(f)||f),hJt(t,function(p){var m=p.node,y=p.index,w=p.pos,x=p.key,C=p.parentPos,P=p.level,A=p.nodes,S={node:m,nodes:A,index:y,key:x,pos:w,level:P},v=bU(x,w);u[w]=S,d[v]=S,S.parent=u[C],S.parent&&(S.parent.children=S.parent.children||[],S.parent.children.push(S)),o&&o(S,f)},{externalGetKey:c,childrenPropName:a,fieldNames:l}),r&&r(f),f}function _k(t,e){var n=e.expandedKeys,o=e.selectedKeys,r=e.loadedKeys,i=e.loadingKeys,a=e.checkedKeys,l=e.halfCheckedKeys,s=e.dragOverNodeKey,c=e.dropPosition,u=e.keyEntities,d=m1(u,t),f={eventKey:t,expanded:n.indexOf(t)!==-1,selected:o.indexOf(t)!==-1,loaded:r.indexOf(t)!==-1,loading:i.indexOf(t)!==-1,checked:a.indexOf(t)!==-1,halfChecked:l.indexOf(t)!==-1,pos:String(d?d.pos:""),dragOver:s===t&&c===0,dragOverGapTop:s===t&&c===-1,dragOverGapBottom:s===t&&c===1};return f}function g0(t){var e=t.data,n=t.expanded,o=t.selected,r=t.checked,i=t.loaded,a=t.loading,l=t.halfChecked,s=t.dragOver,c=t.dragOverGapTop,u=t.dragOverGapBottom,d=t.pos,f=t.active,p=t.eventKey,m=nn(nn({},e),{},{expanded:n,selected:o,checked:r,loaded:i,loading:a,halfChecked:l,dragOver:s,dragOverGapTop:c,dragOverGapBottom:u,pos:d,active:f,key:p});return"props"in m||Object.defineProperty(m,"props",{get:function(){return Ds(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),t}}),m}function fet(t,e){var n=new Set;return t.forEach(function(o){e.has(o)||n.add(o)}),n}function pJt(t){var e=t||{},n=e.disabled,o=e.disableCheckbox,r=e.checkable;return!!(n||o)||r===!1}function gJt(t,e,n,o){for(var r=new Set(t),i=new Set,a=0;a<=n;a+=1){var l=e.get(a)||new Set;l.forEach(function(d){var f=d.key,p=d.node,m=d.children,y=m===void 0?[]:m;r.has(f)&&!o(p)&&y.filter(function(w){return!o(w.node)}).forEach(function(w){r.add(w.key)})})}for(var s=new Set,c=n;c>=0;c-=1){var u=e.get(c)||new Set;u.forEach(function(d){var f=d.parent,p=d.node;if(!(o(p)||!d.parent||s.has(d.parent.key))){if(o(d.parent.node)){s.add(f.key);return}var m=!0,y=!1;(f.children||[]).filter(function(w){return!o(w.node)}).forEach(function(w){var x=w.key,C=r.has(x);m&&!C&&(m=!1),!y&&(C||i.has(x))&&(y=!0)}),m&&r.add(f.key),y&&i.add(f.key),s.add(f.key)}})}return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(fet(i,r))}}function mJt(t,e,n,o,r){for(var i=new Set(t),a=new Set(e),l=0;l<=o;l+=1){var s=n.get(l)||new Set;s.forEach(function(f){var p=f.key,m=f.node,y=f.children,w=y===void 0?[]:y;!i.has(p)&&!a.has(p)&&!r(m)&&w.filter(function(x){return!r(x.node)}).forEach(function(x){i.delete(x.key)})})}a=new Set;for(var c=new Set,u=o;u>=0;u-=1){var d=n.get(u)||new Set;d.forEach(function(f){var p=f.parent,m=f.node;if(!(r(m)||!f.parent||c.has(f.parent.key))){if(r(f.parent.node)){c.add(p.key);return}var y=!0,w=!1;(p.children||[]).filter(function(x){return!r(x.node)}).forEach(function(x){var C=x.key,P=i.has(C);y&&!P&&(y=!1),!w&&(P||a.has(C))&&(w=!0)}),y||i.delete(p.key),w&&a.add(p.key),c.add(p.key)}})}return{checkedKeys:Array.from(i),halfCheckedKeys:Array.from(fet(a,i))}}function kR(t,e,n,o){var r=[],i;o?i=o:i=pJt;var a=new Set(t.filter(function(u){var d=!!m1(n,u);return d||r.push(u),d})),l=new Map,s=0;Object.keys(n).forEach(function(u){var d=n[u],f=d.level,p=l.get(f);p||(p=new Set,l.set(f,p)),p.add(d),s=Math.max(s,f)}),Ds(!r.length,"Tree missing follow keys: ".concat(r.slice(0,100).map(function(u){return"'".concat(u,"'")}).join(", ")));var c;return e===!0?c=gJt(a,l,s,i):c=mJt(a,e.halfCheckedKeys,l,s,i),c}const yJt=t=>{const{checkboxCls:e}=t,n=`${e}-wrapper`;return[{[`${e}-group`]:Object.assign(Object.assign({},Ua(t)),{display:"inline-flex",flexWrap:"wrap",columnGap:t.marginXS,[`> ${t.antCls}-row`]:{flex:1}}),[n]:Object.assign(Object.assign({},Ua(t)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${n}`]:{marginInlineStart:0},[`&${n}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:t.borderRadiusSM,alignSelf:"center",[`${e}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${e}-inner`]:Object.assign({},z3(t))},[`${e}-inner`]:{boxSizing:"border-box",display:"block",width:t.checkboxSize,height:t.checkboxSize,direction:"ltr",backgroundColor:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,borderCollapse:"separate",transition:`all ${t.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:t.calc(t.checkboxSize).div(14).mul(5).equal(),height:t.calc(t.checkboxSize).div(14).mul(8).equal(),border:`${jt(t.lineWidthBold)} solid ${t.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${t.motionDurationFast} ${t.motionEaseInBack}, opacity ${t.motionDurationFast}`}},"& + span":{paddingInlineStart:t.paddingXS,paddingInlineEnd:t.paddingXS}})},{[` + > div > ${e}-nav`]:{"&::before":{bottom:0},[`${e}-ink-bar`]:{bottom:0}}},[`${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,marginTop:n,marginBottom:0,"&::before":{top:0},[`${e}-ink-bar`]:{top:0}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0}},[`${e}-left, ${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{flexDirection:"column",minWidth:l(t.controlHeight).mul(1.25).equal(),[`${e}-tab`]:{padding:i,textAlign:"center"},[`${e}-tab + ${e}-tab`]:{margin:a},[`${e}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:t.controlHeight},"&::before":{top:0,boxShadow:t.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:t.boxShadowTabsOverflowBottom},[`&${e}-nav-wrap-ping-top::before`]:{opacity:1},[`&${e}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${e}-ink-bar`]:{width:t.lineWidthBold,"&-animated":{transition:`height ${t.motionDurationSlow}, top ${t.motionDurationSlow}`}},[`${e}-nav-list, ${e}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{marginLeft:{_skip_check_:!0,value:jt(l(t.lineWidth).mul(-1).equal())},borderLeft:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:t.paddingLG}}}},[`${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,[`${e}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:l(t.lineWidth).mul(-1).equal()},borderRight:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingRight:{_skip_check_:!0,value:t.paddingLG}}}}}},oJt=t=>{const{componentCls:e,cardPaddingSM:n,cardPaddingLG:o,horizontalItemPaddingSM:r,horizontalItemPaddingLG:i}=t;return{[e]:{"&-small":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:r,fontSize:t.titleFontSizeSM}}},"&-large":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:i,fontSize:t.titleFontSizeLG}}}},[`${e}-card`]:{[`&${e}-small`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:n}},[`&${e}-bottom`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadius)} ${jt(t.borderRadius)}`}},[`&${e}-top`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`${jt(t.borderRadius)} ${jt(t.borderRadius)} 0 0`}},[`&${e}-right`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadius)} ${jt(t.borderRadius)} 0`}}},[`&${e}-left`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadius)} 0 0 ${jt(t.borderRadius)}`}}}},[`&${e}-large`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:o}}}}}},rJt=t=>{const{componentCls:e,itemActiveColor:n,itemHoverColor:o,iconCls:r,tabsHorizontalItemMargin:i,horizontalItemPadding:a,itemSelectedColor:l,itemColor:s}=t,c=`${e}-tab`;return{[c]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:a,fontSize:t.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:s,"&-btn, &-remove":{"&:focus:not(:focus-visible), &:active":{color:n}},"&-btn":{outline:"none",transition:`all ${t.motionDurationSlow}`,[`${c}-icon:not(:last-child)`]:{marginInlineEnd:t.marginSM}},"&-remove":Object.assign({flex:"none",marginRight:{_skip_check_:!0,value:t.calc(t.marginXXS).mul(-1).equal()},marginLeft:{_skip_check_:!0,value:t.marginXS},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"&:hover":{color:t.colorTextHeading}},Yy(t)),"&:hover":{color:o},[`&${c}-active ${c}-btn`]:{color:l,textShadow:t.tabsActiveTextShadow},[`&${c}-focus ${c}-btn`]:Object.assign({},z3(t)),[`&${c}-disabled`]:{color:t.colorTextDisabled,cursor:"not-allowed"},[`&${c}-disabled ${c}-btn, &${c}-disabled ${e}-remove`]:{"&:focus, &:active":{color:t.colorTextDisabled}},[`& ${c}-remove ${r}`]:{margin:0},[`${r}:not(:last-child)`]:{marginRight:{_skip_check_:!0,value:t.marginSM}}},[`${c} + ${c}`]:{margin:{_skip_check_:!0,value:i}}}},iJt=t=>{const{componentCls:e,tabsHorizontalItemMarginRTL:n,iconCls:o,cardGutter:r,calc:i}=t;return{[`${e}-rtl`]:{direction:"rtl",[`${e}-nav`]:{[`${e}-tab`]:{margin:{_skip_check_:!0,value:n},[`${e}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[o]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:jt(t.marginSM)}},[`${e}-tab-remove`]:{marginRight:{_skip_check_:!0,value:jt(t.marginXS)},marginLeft:{_skip_check_:!0,value:jt(i(t.marginXXS).mul(-1).equal())},[o]:{margin:0}}}},[`&${e}-left`]:{[`> ${e}-nav`]:{order:1},[`> ${e}-content-holder`]:{order:0}},[`&${e}-right`]:{[`> ${e}-nav`]:{order:0},[`> ${e}-content-holder`]:{order:1}},[`&${e}-card${e}-top, &${e}-card${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginRight:{_skip_check_:!0,value:r},marginLeft:{_skip_check_:!0,value:0}}}}},[`${e}-dropdown-rtl`]:{direction:"rtl"},[`${e}-menu-item`]:{[`${e}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},aJt=t=>{const{componentCls:e,tabsCardPadding:n,cardHeight:o,cardGutter:r,itemHoverColor:i,itemActiveColor:a,colorBorderSecondary:l}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{display:"flex",[`> ${e}-nav, > div > ${e}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${e}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${t.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${e}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${t.motionDurationSlow}`},[`${e}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${e}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${e}-nav-more`]:{position:"relative",padding:n,background:"transparent",border:0,color:t.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:t.calc(t.controlHeightLG).div(8).equal(),transform:"translateY(100%)",content:"''"}},[`${e}-nav-add`]:Object.assign({minWidth:o,marginLeft:{_skip_check_:!0,value:r},padding:jt(t.paddingXS),background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} ${l}`,borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`,outline:"none",cursor:"pointer",color:t.colorText,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`,"&:hover":{color:i},"&:active, &:focus:not(:focus-visible)":{color:a}},Yy(t,-3))},[`${e}-extra-content`]:{flex:"none"},[`${e}-ink-bar`]:{position:"absolute",background:t.inkBarColor,pointerEvents:"none"}}),rJt(t)),{[`${e}-content`]:{position:"relative",width:"100%"},[`${e}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${e}-tabpane`]:Object.assign(Object.assign({},Yy(t)),{"&-hidden":{display:"none"}})}),[`${e}-centered`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-nav-wrap`]:{[`&:not([class*='${e}-nav-wrap-ping']) > ${e}-nav-list`]:{margin:"auto"}}}}}},lJt=t=>{const e=t.controlHeightLG;return{zIndexPopup:t.zIndexPopupBase+50,cardBg:t.colorFillAlter,cardHeight:e,cardPadding:`${(e-Math.round(t.fontSize*t.lineHeight))/2-t.lineWidth}px ${t.padding}px`,cardPaddingSM:`${t.paddingXXS*1.5}px ${t.padding}px`,cardPaddingLG:`${t.paddingXS}px ${t.padding}px ${t.paddingXXS*1.5}px`,titleFontSize:t.fontSize,titleFontSizeLG:t.fontSizeLG,titleFontSizeSM:t.fontSize,inkBarColor:t.colorPrimary,horizontalMargin:`0 0 ${t.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${t.paddingSM}px 0`,horizontalItemPaddingSM:`${t.paddingXS}px 0`,horizontalItemPaddingLG:`${t.padding}px 0`,verticalItemPadding:`${t.paddingXS}px ${t.paddingLG}px`,verticalItemMargin:`${t.margin}px 0 0 0`,itemColor:t.colorText,itemSelectedColor:t.colorPrimary,itemHoverColor:t.colorPrimaryHover,itemActiveColor:t.colorPrimaryActive,cardGutter:t.marginXXS/2}},sJt=el("Tabs",t=>{const e=Ui(t,{tabsCardPadding:t.cardPadding,dropdownEdgeChildVerticalPadding:t.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${jt(t.horizontalItemGutter)}`,tabsHorizontalItemMarginRTL:`0 0 0 ${jt(t.horizontalItemGutter)}`});return[oJt(e),iJt(e),nJt(e),tJt(e),eJt(e),aJt(e),ZXt(e)]},lJt),cJt=()=>null;var uJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e,n,o,r,i,a,l,s,c,u,d;const{type:f,className:p,rootClassName:m,size:y,onEdit:w,hideAdd:x,centered:C,addIcon:P,removeIcon:A,moreIcon:S,more:v,popupClassName:b,children:T,items:R,animated:M,style:D,indicatorSize:k,indicator:N}=t,U=uJt(t,["type","className","rootClassName","size","onEdit","hideAdd","centered","addIcon","removeIcon","moreIcon","more","popupClassName","children","items","animated","style","indicatorSize","indicator"]),{prefixCls:W}=U,{direction:F,tabs:E,getPrefixCls:L,getPopupContainer:j}=g.useContext(gr),Y=L("tabs",W),O=nu(Y),[_,G,Q]=sJt(Y,O);let oe;f==="editable-card"&&(oe={onEdit:(q,le)=>{let{key:de,event:he}=le;w==null||w(q==="add"?he:de,q)},removeIcon:(e=A??(E==null?void 0:E.removeIcon))!==null&&e!==void 0?e:g.createElement(i6,null),addIcon:(P??(E==null?void 0:E.addIcon))||g.createElement(tXt,null),showAdd:x!==!0});const ee=L(),$=jd(y),ae=QXt(R,T),Z=KXt(Y,M),ne=Object.assign(Object.assign({},E==null?void 0:E.style),D),te={align:(n=N==null?void 0:N.align)!==null&&n!==void 0?n:(o=E==null?void 0:E.indicator)===null||o===void 0?void 0:o.align,size:(l=(i=(r=N==null?void 0:N.size)!==null&&r!==void 0?r:k)!==null&&i!==void 0?i:(a=E==null?void 0:E.indicator)===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:E==null?void 0:E.indicatorSize};return _(g.createElement(XXt,Object.assign({direction:F,getPopupContainer:j},U,{items:ae,className:Mn({[`${Y}-${$}`]:$,[`${Y}-card`]:["card","editable-card"].includes(f),[`${Y}-editable-card`]:f==="editable-card",[`${Y}-centered`]:C},E==null?void 0:E.className,p,m,G,Q,O),popupClassName:Mn(b,G,Q,O),style:ne,editable:oe,more:Object.assign({icon:(d=(u=(c=(s=E==null?void 0:E.more)===null||s===void 0?void 0:s.icon)!==null&&c!==void 0?c:E==null?void 0:E.moreIcon)!==null&&u!==void 0?u:S)!==null&&d!==void 0?d:g.createElement(z9e,null),transitionName:`${ee}-slide-up`},v),prefixCls:Y,animated:Z,indicator:te})))};dee.TabPane=cJt;function m1(t,e){return t[e]}var dJt=["children"];function uet(t,e){return"".concat(t,"-").concat(e)}function fJt(t){return t&&t.type&&t.type.isTreeNode}function bU(t,e){return t??e}function TH(t){var e=t||{},n=e.title,o=e._title,r=e.key,i=e.children,a=n||"title";return{title:a,_title:o||[a],key:r||"key",children:i||"children"}}function det(t){function e(n){var o=t7(n);return o.map(function(r){if(!fJt(r))return Ds(!r,"Tree/TreeNode can only accept TreeNode as children."),null;var i=r.key,a=r.props,l=a.children,s=Ai(a,dJt),c=nn({key:i},s),u=e(l);return u.length&&(c.children=u),c}).filter(function(r){return r})}return e(t)}function Zle(t,e,n){var o=TH(n),r=o._title,i=o.key,a=o.children,l=new Set(e===!0?[]:e),s=[];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return u.map(function(f,p){for(var m=uet(d?d.pos:"0",p),y=bU(f[i],m),w,x=0;x1&&arguments[1]!==void 0?arguments[1]:{},n=e.initWrapper,o=e.processEntity,r=e.onProcessFinished,i=e.externalGetKey,a=e.childrenPropName,l=e.fieldNames,s=arguments.length>2?arguments[2]:void 0,c=i||s,u={},d={},f={posEntities:u,keyEntities:d};return n&&(f=n(f)||f),hJt(t,function(p){var m=p.node,y=p.index,w=p.pos,x=p.key,C=p.parentPos,P=p.level,A=p.nodes,S={node:m,nodes:A,index:y,key:x,pos:w,level:P},v=bU(x,w);u[w]=S,d[v]=S,S.parent=u[C],S.parent&&(S.parent.children=S.parent.children||[],S.parent.children.push(S)),o&&o(S,f)},{externalGetKey:c,childrenPropName:a,fieldNames:l}),r&&r(f),f}function _k(t,e){var n=e.expandedKeys,o=e.selectedKeys,r=e.loadedKeys,i=e.loadingKeys,a=e.checkedKeys,l=e.halfCheckedKeys,s=e.dragOverNodeKey,c=e.dropPosition,u=e.keyEntities,d=m1(u,t),f={eventKey:t,expanded:n.indexOf(t)!==-1,selected:o.indexOf(t)!==-1,loaded:r.indexOf(t)!==-1,loading:i.indexOf(t)!==-1,checked:a.indexOf(t)!==-1,halfChecked:l.indexOf(t)!==-1,pos:String(d?d.pos:""),dragOver:s===t&&c===0,dragOverGapTop:s===t&&c===-1,dragOverGapBottom:s===t&&c===1};return f}function g0(t){var e=t.data,n=t.expanded,o=t.selected,r=t.checked,i=t.loaded,a=t.loading,l=t.halfChecked,s=t.dragOver,c=t.dragOverGapTop,u=t.dragOverGapBottom,d=t.pos,f=t.active,p=t.eventKey,m=nn(nn({},e),{},{expanded:n,selected:o,checked:r,loaded:i,loading:a,halfChecked:l,dragOver:s,dragOverGapTop:c,dragOverGapBottom:u,pos:d,active:f,key:p});return"props"in m||Object.defineProperty(m,"props",{get:function(){return Ds(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),t}}),m}function fet(t,e){var n=new Set;return t.forEach(function(o){e.has(o)||n.add(o)}),n}function pJt(t){var e=t||{},n=e.disabled,o=e.disableCheckbox,r=e.checkable;return!!(n||o)||r===!1}function gJt(t,e,n,o){for(var r=new Set(t),i=new Set,a=0;a<=n;a+=1){var l=e.get(a)||new Set;l.forEach(function(d){var f=d.key,p=d.node,m=d.children,y=m===void 0?[]:m;r.has(f)&&!o(p)&&y.filter(function(w){return!o(w.node)}).forEach(function(w){r.add(w.key)})})}for(var s=new Set,c=n;c>=0;c-=1){var u=e.get(c)||new Set;u.forEach(function(d){var f=d.parent,p=d.node;if(!(o(p)||!d.parent||s.has(d.parent.key))){if(o(d.parent.node)){s.add(f.key);return}var m=!0,y=!1;(f.children||[]).filter(function(w){return!o(w.node)}).forEach(function(w){var x=w.key,C=r.has(x);m&&!C&&(m=!1),!y&&(C||i.has(x))&&(y=!0)}),m&&r.add(f.key),y&&i.add(f.key),s.add(f.key)}})}return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(fet(i,r))}}function mJt(t,e,n,o,r){for(var i=new Set(t),a=new Set(e),l=0;l<=o;l+=1){var s=n.get(l)||new Set;s.forEach(function(f){var p=f.key,m=f.node,y=f.children,w=y===void 0?[]:y;!i.has(p)&&!a.has(p)&&!r(m)&&w.filter(function(x){return!r(x.node)}).forEach(function(x){i.delete(x.key)})})}a=new Set;for(var c=new Set,u=o;u>=0;u-=1){var d=n.get(u)||new Set;d.forEach(function(f){var p=f.parent,m=f.node;if(!(r(m)||!f.parent||c.has(f.parent.key))){if(r(f.parent.node)){c.add(p.key);return}var y=!0,w=!1;(p.children||[]).filter(function(x){return!r(x.node)}).forEach(function(x){var C=x.key,P=i.has(C);y&&!P&&(y=!1),!w&&(P||a.has(C))&&(w=!0)}),y||i.delete(p.key),w&&a.add(p.key),c.add(p.key)}})}return{checkedKeys:Array.from(i),halfCheckedKeys:Array.from(fet(a,i))}}function kR(t,e,n,o){var r=[],i;o?i=o:i=pJt;var a=new Set(t.filter(function(u){var d=!!m1(n,u);return d||r.push(u),d})),l=new Map,s=0;Object.keys(n).forEach(function(u){var d=n[u],f=d.level,p=l.get(f);p||(p=new Set,l.set(f,p)),p.add(d),s=Math.max(s,f)}),Ds(!r.length,"Tree missing follow keys: ".concat(r.slice(0,100).map(function(u){return"'".concat(u,"'")}).join(", ")));var c;return e===!0?c=gJt(a,l,s,i):c=mJt(a,e.halfCheckedKeys,l,s,i),c}const yJt=t=>{const{checkboxCls:e}=t,n=`${e}-wrapper`;return[{[`${e}-group`]:Object.assign(Object.assign({},Ua(t)),{display:"inline-flex",flexWrap:"wrap",columnGap:t.marginXS,[`> ${t.antCls}-row`]:{flex:1}}),[n]:Object.assign(Object.assign({},Ua(t)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${n}`]:{marginInlineStart:0},[`&${n}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:t.borderRadiusSM,alignSelf:"center",[`${e}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${e}-inner`]:Object.assign({},z3(t))},[`${e}-inner`]:{boxSizing:"border-box",display:"block",width:t.checkboxSize,height:t.checkboxSize,direction:"ltr",backgroundColor:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,borderCollapse:"separate",transition:`all ${t.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:t.calc(t.checkboxSize).div(14).mul(5).equal(),height:t.calc(t.checkboxSize).div(14).mul(8).equal(),border:`${jt(t.lineWidthBold)} solid ${t.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${t.motionDurationFast} ${t.motionEaseInBack}, opacity ${t.motionDurationFast}`}},"& + span":{paddingInlineStart:t.paddingXS,paddingInlineEnd:t.paddingXS}})},{[` ${n}:not(${n}-disabled), ${e}:not(${e}-disabled) `]:{[`&:hover ${e}-inner`]:{borderColor:t.colorPrimary}},[`${n}:not(${n}-disabled)`]:{[`&:hover ${e}-checked:not(${e}-disabled) ${e}-inner`]:{backgroundColor:t.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${e}-checked:not(${e}-disabled):after`]:{borderColor:t.colorPrimaryHover}}},{[`${e}-checked`]:{[`${e}-inner`]:{backgroundColor:t.colorPrimary,borderColor:t.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${t.motionDurationMid} ${t.motionEaseOutBack} ${t.motionDurationFast}`}}},[` ${n}-checked:not(${n}-disabled), ${e}-checked:not(${e}-disabled) - `]:{[`&:hover ${e}-inner`]:{backgroundColor:t.colorPrimaryHover,borderColor:"transparent"}}},{[e]:{"&-indeterminate":{[`${e}-inner`]:{backgroundColor:`${t.colorBgContainer} !important`,borderColor:`${t.colorBorder} !important`,"&:after":{top:"50%",insetInlineStart:"50%",width:t.calc(t.fontSizeLG).div(2).equal(),height:t.calc(t.fontSizeLG).div(2).equal(),backgroundColor:t.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${e}-inner`]:{backgroundColor:`${t.colorBgContainer} !important`,borderColor:`${t.colorPrimary} !important`}}}},{[`${n}-disabled`]:{cursor:"not-allowed"},[`${e}-disabled`]:{[`&, ${e}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${e}-inner`]:{background:t.colorBgContainerDisabled,borderColor:t.colorBorder,"&:after":{borderColor:t.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:t.colorTextDisabled},[`&${e}-indeterminate ${e}-inner::after`]:{background:t.colorTextDisabled}}}]};function het(t,e){const n=Ui(e,{checkboxCls:`.${t}`,checkboxSize:e.controlInteractiveSize});return[yJt(n)]}const pet=el("Checkbox",(t,e)=>{let{prefixCls:n}=e;return[het(n,t)]}),get=xe.createContext(null);var AJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,className:r,rootClassName:i,children:a,indeterminate:l=!1,style:s,onMouseEnter:c,onMouseLeave:u,skipGroup:d=!1,disabled:f}=t,p=AJt(t,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:m,direction:y,checkbox:w}=g.useContext(gr),x=g.useContext(get),{isFormItemInput:C}=g.useContext(W1),P=g.useContext(Bp),A=(n=(x==null?void 0:x.disabled)||f)!==null&&n!==void 0?n:P,S=g.useRef(p.value),v=g.useRef(null),b=e2(e,v);g.useEffect(()=>{x==null||x.registerValue(p.value)},[]),g.useEffect(()=>{if(!d)return p.value!==S.current&&(x==null||x.cancelValue(S.current),x==null||x.registerValue(p.value),S.current=p.value),()=>x==null?void 0:x.cancelValue(p.value)},[p.value]),g.useEffect(()=>{var L;!((L=v.current)===null||L===void 0)&&L.input&&(v.current.input.indeterminate=l)},[l]);const T=m("checkbox",o),R=nu(T),[M,D,k]=pet(T,R),N=Object.assign({},p);x&&!d&&(N.onChange=function(){p.onChange&&p.onChange.apply(p,arguments),x.toggleOption&&x.toggleOption({label:a,value:p.value})},N.name=x.name,N.checked=x.value.includes(p.value));const U=Mn(`${T}-wrapper`,{[`${T}-rtl`]:y==="rtl",[`${T}-wrapper-checked`]:N.checked,[`${T}-wrapper-disabled`]:A,[`${T}-wrapper-in-form-item`]:C},w==null?void 0:w.className,r,i,k,R,D),W=Mn({[`${T}-indeterminate`]:l},fZ,D),[F,E]=$Ze(N.onClick);return M(g.createElement(lU,{component:"Checkbox",disabled:A},g.createElement("label",{className:U,style:Object.assign(Object.assign({},w==null?void 0:w.style),s),onMouseEnter:c,onMouseLeave:u,onClick:F},g.createElement(KZe,Object.assign({},N,{onClick:E,prefixCls:T,className:W,disabled:A,ref:b})),a!==void 0&&g.createElement("span",null,a))))},met=g.forwardRef(wJt);var xJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{defaultValue:n,children:o,options:r=[],prefixCls:i,className:a,rootClassName:l,style:s,onChange:c}=t,u=xJt(t,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:d,direction:f}=g.useContext(gr),[p,m]=g.useState(u.value||n||[]),[y,w]=g.useState([]);g.useEffect(()=>{"value"in u&&m(u.value||[])},[u.value]);const x=g.useMemo(()=>r.map(W=>typeof W=="string"||typeof W=="number"?{label:W,value:W}:W),[r]),C=W=>{w(F=>F.filter(E=>E!==W))},P=W=>{w(F=>[].concat(Pa(F),[W]))},A=W=>{const F=p.indexOf(W.value),E=Pa(p);F===-1?E.push(W.value):E.splice(F,1),"value"in u||m(E),c==null||c(E.filter(L=>y.includes(L)).sort((L,j)=>{const Y=x.findIndex(_=>_.value===L),O=x.findIndex(_=>_.value===j);return Y-O}))},S=d("checkbox",i),v=`${S}-group`,b=nu(S),[T,R,M]=pet(S,b),D=Mf(u,["value","disabled"]),k=r.length?x.map(W=>g.createElement(met,{prefixCls:S,key:W.value.toString(),disabled:"disabled"in W?W.disabled:u.disabled,value:W.value,checked:p.includes(W.value),onChange:W.onChange,className:`${v}-item`,style:W.style,title:W.title,id:W.id,required:W.required},W.label)):o,N={toggleOption:A,value:p,disabled:u.disabled,name:u.name,registerValue:P,cancelValue:C},U=Mn(v,{[`${v}-rtl`]:f==="rtl"},a,l,M,b,R);return T(g.createElement("div",Object.assign({className:U,style:s},D,{ref:e}),g.createElement(get.Provider,{value:N},k)))}),Li=met;Li.Group=vJt;Li.__ANT_CHECKBOX=!0;const yet=g.createContext({});var bJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n,direction:o}=g.useContext(gr),{gutter:r,wrap:i}=g.useContext(yet),{prefixCls:a,span:l,order:s,offset:c,push:u,pull:d,className:f,children:p,flex:m,style:y}=t,w=bJt(t,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),x=n("col",a),[C,P,A]=gUt(x),S={};let v={};SJt.forEach(R=>{let M={};const D=t[R];typeof D=="number"?M.span=D:typeof D=="object"&&(M=D||{}),delete w[R],v=Object.assign(Object.assign({},v),{[`${x}-${R}-${M.span}`]:M.span!==void 0,[`${x}-${R}-order-${M.order}`]:M.order||M.order===0,[`${x}-${R}-offset-${M.offset}`]:M.offset||M.offset===0,[`${x}-${R}-push-${M.push}`]:M.push||M.push===0,[`${x}-${R}-pull-${M.pull}`]:M.pull||M.pull===0,[`${x}-rtl`]:o==="rtl"}),M.flex&&(v[`${x}-${R}-flex`]=!0,S[`--${x}-${R}-flex`]=GPe(M.flex))});const b=Mn(x,{[`${x}-${l}`]:l!==void 0,[`${x}-order-${s}`]:s,[`${x}-offset-${c}`]:c,[`${x}-push-${u}`]:u,[`${x}-pull-${d}`]:d},f,v,P,A),T={};if(r&&r[0]>0){const R=r[0]/2;T.paddingLeft=R,T.paddingRight=R}return m&&(T.flex=GPe(m),i===!1&&!T.minWidth&&(T.minWidth=0)),C(g.createElement("div",Object.assign({},w,{style:Object.assign(Object.assign(Object.assign({},T),y),S),className:b,ref:e}),p))});var TJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{if(typeof t=="string"&&o(t),typeof t=="object")for(let i=0;i{r()},[JSON.stringify(t),e]),n}const Qt=g.forwardRef((t,e)=>{const{prefixCls:n,justify:o,align:r,className:i,style:a,children:l,gutter:s=0,wrap:c}=t,u=TJt(t,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:d,direction:f}=g.useContext(gr),[p,m]=g.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[y,w]=g.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),x=XPe(r,y),C=XPe(o,y),P=g.useRef(s),A=gQe();g.useEffect(()=>{const E=A.subscribe(L=>{w(L);const j=P.current||0;(!Array.isArray(j)&&typeof j=="object"||Array.isArray(j)&&(typeof j[0]=="object"||typeof j[1]=="object"))&&m(L)});return()=>A.unsubscribe(E)},[]);const S=()=>{const E=[void 0,void 0];return(Array.isArray(s)?s:[s,void 0]).forEach((j,Y)=>{if(typeof j=="object")for(let O=0;O0?M[0]/-2:void 0;N&&(k.marginLeft=N,k.marginRight=N);const[U,W]=M;k.rowGap=W;const F=g.useMemo(()=>({gutter:[U,W],wrap:c}),[U,W,c]);return b(g.createElement(yet.Provider,{value:F},g.createElement("div",Object.assign({},u,{className:D,style:Object.assign(Object.assign({},k),a),ref:e}),l)))}),PJt=t=>{const{componentCls:e,sizePaddingEdgeHorizontal:n,colorSplit:o,lineWidth:r,textPaddingInline:i,orientationMargin:a,verticalMarginInline:l}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{borderBlockStart:`${jt(r)} solid ${o}`,"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:l,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:`${jt(r)} solid ${o}`},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:`${jt(t.dividerHorizontalGutterMargin)} 0`},[`&-horizontal${e}-with-text`]:{display:"flex",alignItems:"center",margin:`${jt(t.dividerHorizontalWithTextGutterMargin)} 0`,color:t.colorTextHeading,fontWeight:500,fontSize:t.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:`0 ${o}`,"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:`${jt(r)} solid transparent`,borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},[`&-horizontal${e}-with-text-left`]:{"&::before":{width:`calc(${a} * 100%)`},"&::after":{width:`calc(100% - ${a} * 100%)`}},[`&-horizontal${e}-with-text-right`]:{"&::before":{width:`calc(100% - ${a} * 100%)`},"&::after":{width:`calc(${a} * 100%)`}},[`${e}-inner-text`]:{display:"inline-block",paddingBlock:0,paddingInline:i},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:`${jt(r)} 0 0`},[`&-horizontal${e}-with-text${e}-dashed`]:{"&::before, &::after":{borderStyle:"dashed none none"}},[`&-vertical${e}-dashed`]:{borderInlineStartWidth:r,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:o,borderStyle:"dotted",borderWidth:`${jt(r)} 0 0`},[`&-horizontal${e}-with-text${e}-dotted`]:{"&::before, &::after":{borderStyle:"dotted none none"}},[`&-vertical${e}-dotted`]:{borderInlineStartWidth:r,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},[`&-plain${e}-with-text`]:{color:t.colorText,fontWeight:"normal",fontSize:t.fontSize},[`&-horizontal${e}-with-text-left${e}-no-default-orientation-margin-left`]:{"&::before":{width:0},"&::after":{width:"100%"},[`${e}-inner-text`]:{paddingInlineStart:n}},[`&-horizontal${e}-with-text-right${e}-no-default-orientation-margin-right`]:{"&::before":{width:"100%"},"&::after":{width:0},[`${e}-inner-text`]:{paddingInlineEnd:n}}})}},CJt=t=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:t.marginXS}),RJt=el("Divider",t=>{const e=Ui(t,{dividerHorizontalWithTextGutterMargin:t.margin,dividerHorizontalGutterMargin:t.marginLG,sizePaddingEdgeHorizontal:0});return[PJt(e)]},CJt,{unitless:{orientationMargin:!0}});var HJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n,divider:o}=g.useContext(gr),{prefixCls:r,type:i="horizontal",orientation:a="center",orientationMargin:l,className:s,rootClassName:c,children:u,dashed:d,variant:f="solid",plain:p,style:m}=t,y=HJt(t,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","variant","plain","style"]),w=e("divider",r),[x,C,P]=RJt(w),A=!!u,S=a==="left"&&l!=null,v=a==="right"&&l!=null,b=Mn(w,o==null?void 0:o.className,C,P,`${w}-${i}`,{[`${w}-with-text`]:A,[`${w}-with-text-${a}`]:A,[`${w}-dashed`]:!!d,[`${w}-${f}`]:f!=="solid",[`${w}-plain`]:!!p,[`${w}-rtl`]:n==="rtl",[`${w}-no-default-orientation-margin-left`]:S,[`${w}-no-default-orientation-margin-right`]:v},s,c),T=g.useMemo(()=>typeof l=="number"?l:/^\d+$/.test(l)?Number(l):l,[l]),R=Object.assign(Object.assign({},S&&{marginLeft:T}),v&&{marginRight:T});return x(g.createElement("div",Object.assign({className:b,style:Object.assign(Object.assign({},o==null?void 0:o.style),m)},y,{role:"separator"}),u&&i!=="vertical"&&g.createElement("span",{className:`${w}-inner-text`,style:R},u)))};var MJt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},IJt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:MJt}))},Aet=g.forwardRef(IJt);function Fhe(){return typeof BigInt=="function"}function wet(t){return!t&&t!==0&&!Number.isNaN(t)||!String(t).trim()}function yb(t){var e=t.trim(),n=e.startsWith("-");n&&(e=e.slice(1)),e=e.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),e.startsWith(".")&&(e="0".concat(e));var o=e||"0",r=o.split("."),i=r[0]||"0",a=r[1]||"0";i==="0"&&a==="0"&&(n=!1);var l=n?"-":"";return{negative:n,negativeStr:l,trimStr:o,integerStr:i,decimalStr:a,fullStr:"".concat(l).concat(o)}}function q9e(t){var e=String(t);return!Number.isNaN(Number(e))&&e.includes("e")}function Bv(t){var e=String(t);if(q9e(t)){var n=Number(e.slice(e.indexOf("e-")+2)),o=e.match(/\.(\d+)/);return o!=null&&o[1]&&(n+=o[1].length),n}return e.includes(".")&&Q9e(e)?e.length-e.indexOf(".")-1:0}function fee(t){var e=String(t);if(q9e(t)){if(t>Number.MAX_SAFE_INTEGER)return String(Fhe()?BigInt(t).toString():Number.MAX_SAFE_INTEGER);if(t0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":yb("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),t}(),DJt=function(){function t(e){if(Uh(this,t),Ut(this,"origin",""),Ut(this,"number",void 0),Ut(this,"empty",void 0),wet(e)){this.empty=!0;return}this.origin=String(e),this.number=Number(e)}return jh(t,[{key:"negate",value:function(){return new t(-this.toNumber())}},{key:"add",value:function(n){if(this.isInvalidate())return new t(n);var o=Number(n);if(Number.isNaN(o))return this;var r=this.number+o;if(r>Number.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(rNumber.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(r0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":fee(this.number):this.origin}}]),t}();function X2(t){return Fhe()?new zJt(t):new DJt(t)}function AG(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t==="")return"";var r=yb(t),i=r.negativeStr,a=r.integerStr,l=r.decimalStr,s="".concat(e).concat(l),c="".concat(i).concat(a);if(n>=0){var u=Number(l[n]);if(u>=5&&!o){var d=X2(t).add("".concat(i,"0.").concat("0".repeat(n)).concat(10-u));return AG(d.toString(),e,n,o)}return n===0?c:"".concat(c).concat(e).concat(l.padEnd(n,"0").slice(0,n))}return s===".0"?c:"".concat(c).concat(s)}function EJt(t){return!!(t.addonBefore||t.addonAfter)}function kJt(t){return!!(t.prefix||t.suffix||t.allowClear)}function JPe(t,e,n){var o=e.cloneNode(!0),r=Object.create(t,{target:{value:o},currentTarget:{value:o}});return o.value=n,typeof e.selectionStart=="number"&&typeof e.selectionEnd=="number"&&(o.selectionStart=e.selectionStart,o.selectionEnd=e.selectionEnd),o.setSelectionRange=function(){e.setSelectionRange.apply(e,arguments)},r}function gJ(t,e,n,o){if(n){var r=e;if(e.type==="click"){r=JPe(e,t,""),n(r);return}if(t.type!=="file"&&o!==void 0){r=JPe(e,t,o),n(r);return}n(r)}}function Z9e(t,e){if(t){t.focus(e);var n=e||{},o=n.cursor;if(o){var r=t.value.length;switch(o){case"start":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(r,r);break;default:t.setSelectionRange(0,r)}}}}var e3e=xe.forwardRef(function(t,e){var n,o,r,i=t.inputElement,a=t.children,l=t.prefixCls,s=t.prefix,c=t.suffix,u=t.addonBefore,d=t.addonAfter,f=t.className,p=t.style,m=t.disabled,y=t.readOnly,w=t.focused,x=t.triggerFocus,C=t.allowClear,P=t.value,A=t.handleReset,S=t.hidden,v=t.classes,b=t.classNames,T=t.dataAttrs,R=t.styles,M=t.components,D=t.onClear,k=a??i,N=(M==null?void 0:M.affixWrapper)||"span",U=(M==null?void 0:M.groupWrapper)||"span",W=(M==null?void 0:M.wrapper)||"span",F=(M==null?void 0:M.groupAddon)||"span",E=g.useRef(null),L=function(he){var me;(me=E.current)!==null&&me!==void 0&&me.contains(he.target)&&(x==null||x())},j=kJt(t),Y=g.cloneElement(k,{value:P,className:Bn((n=k.props)===null||n===void 0?void 0:n.className,!j&&(b==null?void 0:b.variant))||null}),O=g.useRef(null);if(xe.useImperativeHandle(e,function(){return{nativeElement:O.current||E.current}}),j){var _=null;if(C){var G=!m&&!y&&P,Q="".concat(l,"-clear-icon"),oe=Vr(C)==="object"&&C!==null&&C!==void 0&&C.clearIcon?C.clearIcon:"✖";_=xe.createElement("button",{type:"button",onClick:function(he){A==null||A(he),D==null||D()},onMouseDown:function(he){return he.preventDefault()},className:Bn(Q,Ut(Ut({},"".concat(Q,"-hidden"),!G),"".concat(Q,"-has-suffix"),!!c))},oe)}var ee="".concat(l,"-affix-wrapper"),q=Bn(ee,Ut(Ut(Ut(Ut(Ut({},"".concat(l,"-disabled"),m),"".concat(ee,"-disabled"),m),"".concat(ee,"-focused"),w),"".concat(ee,"-readonly"),y),"".concat(ee,"-input-with-clear-btn"),c&&C&&P),v==null?void 0:v.affixWrapper,b==null?void 0:b.affixWrapper,b==null?void 0:b.variant),ae=(c||C)&&xe.createElement("span",{className:Bn("".concat(l,"-suffix"),b==null?void 0:b.suffix),style:R==null?void 0:R.suffix},_,c);Y=xe.createElement(N,Uo({className:q,style:R==null?void 0:R.affixWrapper,onClick:L},T==null?void 0:T.affixWrapper,{ref:E}),s&&xe.createElement("span",{className:Bn("".concat(l,"-prefix"),b==null?void 0:b.prefix),style:R==null?void 0:R.prefix},s),Y,ae)}if(EJt(t)){var Z="".concat(l,"-group"),ne="".concat(Z,"-addon"),te="".concat(Z,"-wrapper"),$=Bn("".concat(l,"-wrapper"),Z,v==null?void 0:v.wrapper,b==null?void 0:b.wrapper),le=Bn(te,Ut({},"".concat(te,"-disabled"),m),v==null?void 0:v.group,b==null?void 0:b.groupWrapper);Y=xe.createElement(U,{className:le,ref:O},xe.createElement(W,{className:$},u&&xe.createElement(F,{className:ne},u),Y,d&&xe.createElement(F,{className:ne},d)))}return xe.cloneElement(Y,{className:Bn((o=Y.props)===null||o===void 0?void 0:o.className,f)||null,style:nn(nn({},(r=Y.props)===null||r===void 0?void 0:r.style),p),hidden:S})}),FJt=["show"];function xet(t,e){return g.useMemo(function(){var n={};e&&(n.show=Vr(e)==="object"&&e.formatter?e.formatter:!!e),n=nn(nn({},n),t);var o=n,r=o.show,i=Ai(o,FJt);return nn(nn({},i),{},{show:!!r,showFormatter:typeof r=="function"?r:void 0,strategy:i.strategy||function(a){return a.length}})},[t,e])}var LJt=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],WJt=g.forwardRef(function(t,e){var n=t.autoComplete,o=t.onChange,r=t.onFocus,i=t.onBlur,a=t.onPressEnter,l=t.onKeyDown,s=t.onKeyUp,c=t.prefixCls,u=c===void 0?"rc-input":c,d=t.disabled,f=t.htmlSize,p=t.className,m=t.maxLength,y=t.suffix,w=t.showCount,x=t.count,C=t.type,P=C===void 0?"text":C,A=t.classes,S=t.classNames,v=t.styles,b=t.onCompositionStart,T=t.onCompositionEnd,R=Ai(t,LJt),M=g.useState(!1),D=Sn(M,2),k=D[0],N=D[1],U=g.useRef(!1),W=g.useRef(!1),F=g.useRef(null),E=g.useRef(null),L=function(se){F.current&&Z9e(F.current,se)},j=o0(t.defaultValue,{value:t.value}),Y=Sn(j,2),O=Y[0],_=Y[1],G=O==null?"":String(O),Q=g.useState(null),oe=Sn(Q,2),ee=oe[0],q=oe[1],ae=xet(x,w),Z=ae.max||m,ne=ae.strategy(G),te=!!Z&&ne>Z;g.useImperativeHandle(e,function(){var Ae;return{focus:L,blur:function(){var ge;(ge=F.current)===null||ge===void 0||ge.blur()},setSelectionRange:function(ge,we,Se){var Me;(Me=F.current)===null||Me===void 0||Me.setSelectionRange(ge,we,Se)},select:function(){var ge;(ge=F.current)===null||ge===void 0||ge.select()},input:F.current,nativeElement:((Ae=E.current)===null||Ae===void 0?void 0:Ae.nativeElement)||F.current}}),g.useEffect(function(){W.current&&(W.current=!1),N(function(Ae){return Ae&&d?!1:Ae})},[d]);var $=function(se,ge,we){var Se=ge;if(!U.current&&ae.exceedFormatter&&ae.max&&ae.strategy(ge)>ae.max){if(Se=ae.exceedFormatter(ge,{max:ae.max}),ge!==Se){var Me,Ce;q([((Me=F.current)===null||Me===void 0?void 0:Me.selectionStart)||0,((Ce=F.current)===null||Ce===void 0?void 0:Ce.selectionEnd)||0])}}else if(we.source==="compositionEnd")return;_(Se),F.current&&gJ(F.current,se,o,Se)};g.useEffect(function(){if(ee){var Ae;(Ae=F.current)===null||Ae===void 0||Ae.setSelectionRange.apply(Ae,$o(ee))}},[ee]);var le=function(se){$(se,se.target.value,{source:"change"})},de=function(se){U.current=!1,$(se,se.currentTarget.value,{source:"compositionEnd"}),T==null||T(se)},he=function(se){a&&se.key==="Enter"&&!W.current&&(W.current=!0,a(se)),l==null||l(se)},me=function(se){se.key==="Enter"&&(W.current=!1),s==null||s(se)},ce=function(se){N(!0),r==null||r(se)},Pe=function(se){W.current&&(W.current=!1),N(!1),i==null||i(se)},pe=function(se){_(""),L(),F.current&&gJ(F.current,se,o)},Ie=te&&"".concat(u,"-out-of-range"),ve=function(){var se=tI(t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return xe.createElement("input",Uo({autoComplete:n},se,{onChange:le,onFocus:ce,onBlur:Pe,onKeyDown:he,onKeyUp:me,className:Bn(u,Ut({},"".concat(u,"-disabled"),d),S==null?void 0:S.input),style:v==null?void 0:v.input,ref:F,size:f,type:P,onCompositionStart:function(we){U.current=!0,b==null||b(we)},onCompositionEnd:de}))},ze=function(){var se=Number(Z)>0;if(y||ae.show){var ge=ae.showFormatter?ae.showFormatter({value:G,count:ne,maxLength:Z}):"".concat(ne).concat(se?" / ".concat(Z):"");return xe.createElement(xe.Fragment,null,ae.show&&xe.createElement("span",{className:Bn("".concat(u,"-show-count-suffix"),Ut({},"".concat(u,"-show-count-has-suffix"),!!y),S==null?void 0:S.count),style:nn({},v==null?void 0:v.count)},ge),y)}return null};return xe.createElement(e3e,Uo({},R,{prefixCls:u,className:Bn(p,Ie),handleReset:pe,value:G,focused:k,triggerFocus:L,suffix:ze(),disabled:d,classes:A,classNames:S,styles:v}),ve())});function NJt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var KPe=NJt()?g.useLayoutEffect:g.useEffect,vet=function(e,n){var o=g.useRef(!0);KPe(function(){return e(o.current)},n),KPe(function(){return o.current=!1,function(){o.current=!0}},[])},ese=function(e,n){vet(function(o){if(!o)return e()},n)};function UJt(t,e){return typeof Proxy<"u"&&t?new Proxy(t,{get:function(o,r){if(e[r])return e[r];var i=o[r];return typeof i=="function"?i.bind(o):i}}):t}var ks={};/** + `]:{[`&:hover ${e}-inner`]:{backgroundColor:t.colorPrimaryHover,borderColor:"transparent"}}},{[e]:{"&-indeterminate":{[`${e}-inner`]:{backgroundColor:`${t.colorBgContainer} !important`,borderColor:`${t.colorBorder} !important`,"&:after":{top:"50%",insetInlineStart:"50%",width:t.calc(t.fontSizeLG).div(2).equal(),height:t.calc(t.fontSizeLG).div(2).equal(),backgroundColor:t.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${e}-inner`]:{backgroundColor:`${t.colorBgContainer} !important`,borderColor:`${t.colorPrimary} !important`}}}},{[`${n}-disabled`]:{cursor:"not-allowed"},[`${e}-disabled`]:{[`&, ${e}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${e}-inner`]:{background:t.colorBgContainerDisabled,borderColor:t.colorBorder,"&:after":{borderColor:t.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:t.colorTextDisabled},[`&${e}-indeterminate ${e}-inner::after`]:{background:t.colorTextDisabled}}}]};function het(t,e){const n=Ui(e,{checkboxCls:`.${t}`,checkboxSize:e.controlInteractiveSize});return[yJt(n)]}const pet=el("Checkbox",(t,e)=>{let{prefixCls:n}=e;return[het(n,t)]}),get=xe.createContext(null);var AJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,className:r,rootClassName:i,children:a,indeterminate:l=!1,style:s,onMouseEnter:c,onMouseLeave:u,skipGroup:d=!1,disabled:f}=t,p=AJt(t,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:m,direction:y,checkbox:w}=g.useContext(gr),x=g.useContext(get),{isFormItemInput:C}=g.useContext(W1),P=g.useContext(Bp),A=(n=(x==null?void 0:x.disabled)||f)!==null&&n!==void 0?n:P,S=g.useRef(p.value),v=g.useRef(null),b=e2(e,v);g.useEffect(()=>{x==null||x.registerValue(p.value)},[]),g.useEffect(()=>{if(!d)return p.value!==S.current&&(x==null||x.cancelValue(S.current),x==null||x.registerValue(p.value),S.current=p.value),()=>x==null?void 0:x.cancelValue(p.value)},[p.value]),g.useEffect(()=>{var L;!((L=v.current)===null||L===void 0)&&L.input&&(v.current.input.indeterminate=l)},[l]);const T=m("checkbox",o),R=nu(T),[M,D,k]=pet(T,R),N=Object.assign({},p);x&&!d&&(N.onChange=function(){p.onChange&&p.onChange.apply(p,arguments),x.toggleOption&&x.toggleOption({label:a,value:p.value})},N.name=x.name,N.checked=x.value.includes(p.value));const U=Mn(`${T}-wrapper`,{[`${T}-rtl`]:y==="rtl",[`${T}-wrapper-checked`]:N.checked,[`${T}-wrapper-disabled`]:A,[`${T}-wrapper-in-form-item`]:C},w==null?void 0:w.className,r,i,k,R,D),W=Mn({[`${T}-indeterminate`]:l},fZ,D),[F,E]=$Ze(N.onClick);return M(g.createElement(lU,{component:"Checkbox",disabled:A},g.createElement("label",{className:U,style:Object.assign(Object.assign({},w==null?void 0:w.style),s),onMouseEnter:c,onMouseLeave:u,onClick:F},g.createElement(KZe,Object.assign({},N,{onClick:E,prefixCls:T,className:W,disabled:A,ref:b})),a!==void 0&&g.createElement("span",null,a))))},met=g.forwardRef(wJt);var xJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{defaultValue:n,children:o,options:r=[],prefixCls:i,className:a,rootClassName:l,style:s,onChange:c}=t,u=xJt(t,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:d,direction:f}=g.useContext(gr),[p,m]=g.useState(u.value||n||[]),[y,w]=g.useState([]);g.useEffect(()=>{"value"in u&&m(u.value||[])},[u.value]);const x=g.useMemo(()=>r.map(W=>typeof W=="string"||typeof W=="number"?{label:W,value:W}:W),[r]),C=W=>{w(F=>F.filter(E=>E!==W))},P=W=>{w(F=>[].concat(Pa(F),[W]))},A=W=>{const F=p.indexOf(W.value),E=Pa(p);F===-1?E.push(W.value):E.splice(F,1),"value"in u||m(E),c==null||c(E.filter(L=>y.includes(L)).sort((L,j)=>{const Y=x.findIndex(_=>_.value===L),O=x.findIndex(_=>_.value===j);return Y-O}))},S=d("checkbox",i),v=`${S}-group`,b=nu(S),[T,R,M]=pet(S,b),D=Mf(u,["value","disabled"]),k=r.length?x.map(W=>g.createElement(met,{prefixCls:S,key:W.value.toString(),disabled:"disabled"in W?W.disabled:u.disabled,value:W.value,checked:p.includes(W.value),onChange:W.onChange,className:`${v}-item`,style:W.style,title:W.title,id:W.id,required:W.required},W.label)):o,N={toggleOption:A,value:p,disabled:u.disabled,name:u.name,registerValue:P,cancelValue:C},U=Mn(v,{[`${v}-rtl`]:f==="rtl"},a,l,M,b,R);return T(g.createElement("div",Object.assign({className:U,style:s},D,{ref:e}),g.createElement(get.Provider,{value:N},k)))}),Li=met;Li.Group=vJt;Li.__ANT_CHECKBOX=!0;const yet=g.createContext({});var bJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n,direction:o}=g.useContext(gr),{gutter:r,wrap:i}=g.useContext(yet),{prefixCls:a,span:l,order:s,offset:c,push:u,pull:d,className:f,children:p,flex:m,style:y}=t,w=bJt(t,["prefixCls","span","order","offset","push","pull","className","children","flex","style"]),x=n("col",a),[C,P,A]=gUt(x),S={};let v={};SJt.forEach(R=>{let M={};const D=t[R];typeof D=="number"?M.span=D:typeof D=="object"&&(M=D||{}),delete w[R],v=Object.assign(Object.assign({},v),{[`${x}-${R}-${M.span}`]:M.span!==void 0,[`${x}-${R}-order-${M.order}`]:M.order||M.order===0,[`${x}-${R}-offset-${M.offset}`]:M.offset||M.offset===0,[`${x}-${R}-push-${M.push}`]:M.push||M.push===0,[`${x}-${R}-pull-${M.pull}`]:M.pull||M.pull===0,[`${x}-rtl`]:o==="rtl"}),M.flex&&(v[`${x}-${R}-flex`]=!0,S[`--${x}-${R}-flex`]=GPe(M.flex))});const b=Mn(x,{[`${x}-${l}`]:l!==void 0,[`${x}-order-${s}`]:s,[`${x}-offset-${c}`]:c,[`${x}-push-${u}`]:u,[`${x}-pull-${d}`]:d},f,v,P,A),T={};if(r&&r[0]>0){const R=r[0]/2;T.paddingLeft=R,T.paddingRight=R}return m&&(T.flex=GPe(m),i===!1&&!T.minWidth&&(T.minWidth=0)),C(g.createElement("div",Object.assign({},w,{style:Object.assign(Object.assign(Object.assign({},T),y),S),className:b,ref:e}),p))});var TJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{if(typeof t=="string"&&o(t),typeof t=="object")for(let i=0;i{r()},[JSON.stringify(t),e]),n}const Qt=g.forwardRef((t,e)=>{const{prefixCls:n,justify:o,align:r,className:i,style:a,children:l,gutter:s=0,wrap:c}=t,u=TJt(t,["prefixCls","justify","align","className","style","children","gutter","wrap"]),{getPrefixCls:d,direction:f}=g.useContext(gr),[p,m]=g.useState({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),[y,w]=g.useState({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),x=XPe(r,y),C=XPe(o,y),P=g.useRef(s),A=gQe();g.useEffect(()=>{const E=A.subscribe(L=>{w(L);const j=P.current||0;(!Array.isArray(j)&&typeof j=="object"||Array.isArray(j)&&(typeof j[0]=="object"||typeof j[1]=="object"))&&m(L)});return()=>A.unsubscribe(E)},[]);const S=()=>{const E=[void 0,void 0];return(Array.isArray(s)?s:[s,void 0]).forEach((j,Y)=>{if(typeof j=="object")for(let O=0;O0?M[0]/-2:void 0;N&&(k.marginLeft=N,k.marginRight=N);const[U,W]=M;k.rowGap=W;const F=g.useMemo(()=>({gutter:[U,W],wrap:c}),[U,W,c]);return b(g.createElement(yet.Provider,{value:F},g.createElement("div",Object.assign({},u,{className:D,style:Object.assign(Object.assign({},k),a),ref:e}),l)))}),PJt=t=>{const{componentCls:e,sizePaddingEdgeHorizontal:n,colorSplit:o,lineWidth:r,textPaddingInline:i,orientationMargin:a,verticalMarginInline:l}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{borderBlockStart:`${jt(r)} solid ${o}`,"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:l,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:`${jt(r)} solid ${o}`},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:`${jt(t.dividerHorizontalGutterMargin)} 0`},[`&-horizontal${e}-with-text`]:{display:"flex",alignItems:"center",margin:`${jt(t.dividerHorizontalWithTextGutterMargin)} 0`,color:t.colorTextHeading,fontWeight:500,fontSize:t.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:`0 ${o}`,"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:`${jt(r)} solid transparent`,borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},[`&-horizontal${e}-with-text-left`]:{"&::before":{width:`calc(${a} * 100%)`},"&::after":{width:`calc(100% - ${a} * 100%)`}},[`&-horizontal${e}-with-text-right`]:{"&::before":{width:`calc(100% - ${a} * 100%)`},"&::after":{width:`calc(${a} * 100%)`}},[`${e}-inner-text`]:{display:"inline-block",paddingBlock:0,paddingInline:i},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:`${jt(r)} 0 0`},[`&-horizontal${e}-with-text${e}-dashed`]:{"&::before, &::after":{borderStyle:"dashed none none"}},[`&-vertical${e}-dashed`]:{borderInlineStartWidth:r,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:o,borderStyle:"dotted",borderWidth:`${jt(r)} 0 0`},[`&-horizontal${e}-with-text${e}-dotted`]:{"&::before, &::after":{borderStyle:"dotted none none"}},[`&-vertical${e}-dotted`]:{borderInlineStartWidth:r,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},[`&-plain${e}-with-text`]:{color:t.colorText,fontWeight:"normal",fontSize:t.fontSize},[`&-horizontal${e}-with-text-left${e}-no-default-orientation-margin-left`]:{"&::before":{width:0},"&::after":{width:"100%"},[`${e}-inner-text`]:{paddingInlineStart:n}},[`&-horizontal${e}-with-text-right${e}-no-default-orientation-margin-right`]:{"&::before":{width:"100%"},"&::after":{width:0},[`${e}-inner-text`]:{paddingInlineEnd:n}}})}},CJt=t=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:t.marginXS}),RJt=el("Divider",t=>{const e=Ui(t,{dividerHorizontalWithTextGutterMargin:t.margin,dividerHorizontalGutterMargin:t.marginLG,sizePaddingEdgeHorizontal:0});return[PJt(e)]},CJt,{unitless:{orientationMargin:!0}});var HJt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n,divider:o}=g.useContext(gr),{prefixCls:r,type:i="horizontal",orientation:a="center",orientationMargin:l,className:s,rootClassName:c,children:u,dashed:d,variant:f="solid",plain:p,style:m}=t,y=HJt(t,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","variant","plain","style"]),w=e("divider",r),[x,C,P]=RJt(w),A=!!u,S=a==="left"&&l!=null,v=a==="right"&&l!=null,b=Mn(w,o==null?void 0:o.className,C,P,`${w}-${i}`,{[`${w}-with-text`]:A,[`${w}-with-text-${a}`]:A,[`${w}-dashed`]:!!d,[`${w}-${f}`]:f!=="solid",[`${w}-plain`]:!!p,[`${w}-rtl`]:n==="rtl",[`${w}-no-default-orientation-margin-left`]:S,[`${w}-no-default-orientation-margin-right`]:v},s,c),T=g.useMemo(()=>typeof l=="number"?l:/^\d+$/.test(l)?Number(l):l,[l]),R=Object.assign(Object.assign({},S&&{marginLeft:T}),v&&{marginRight:T});return x(g.createElement("div",Object.assign({className:b,style:Object.assign(Object.assign({},o==null?void 0:o.style),m)},y,{role:"separator"}),u&&i!=="vertical"&&g.createElement("span",{className:`${w}-inner-text`,style:R},u)))};var MJt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},IJt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:MJt}))},Aet=g.forwardRef(IJt);function Fhe(){return typeof BigInt=="function"}function wet(t){return!t&&t!==0&&!Number.isNaN(t)||!String(t).trim()}function yb(t){var e=t.trim(),n=e.startsWith("-");n&&(e=e.slice(1)),e=e.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),e.startsWith(".")&&(e="0".concat(e));var o=e||"0",r=o.split("."),i=r[0]||"0",a=r[1]||"0";i==="0"&&a==="0"&&(n=!1);var l=n?"-":"";return{negative:n,negativeStr:l,trimStr:o,integerStr:i,decimalStr:a,fullStr:"".concat(l).concat(o)}}function q9e(t){var e=String(t);return!Number.isNaN(Number(e))&&e.includes("e")}function Bv(t){var e=String(t);if(q9e(t)){var n=Number(e.slice(e.indexOf("e-")+2)),o=e.match(/\.(\d+)/);return o!=null&&o[1]&&(n+=o[1].length),n}return e.includes(".")&&Q9e(e)?e.length-e.indexOf(".")-1:0}function fee(t){var e=String(t);if(q9e(t)){if(t>Number.MAX_SAFE_INTEGER)return String(Fhe()?BigInt(t).toString():Number.MAX_SAFE_INTEGER);if(t0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":yb("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),t}(),DJt=function(){function t(e){if(Uh(this,t),Ut(this,"origin",""),Ut(this,"number",void 0),Ut(this,"empty",void 0),wet(e)){this.empty=!0;return}this.origin=String(e),this.number=Number(e)}return jh(t,[{key:"negate",value:function(){return new t(-this.toNumber())}},{key:"add",value:function(n){if(this.isInvalidate())return new t(n);var o=Number(n);if(Number.isNaN(o))return this;var r=this.number+o;if(r>Number.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(rNumber.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(r0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":fee(this.number):this.origin}}]),t}();function X2(t){return Fhe()?new zJt(t):new DJt(t)}function AG(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t==="")return"";var r=yb(t),i=r.negativeStr,a=r.integerStr,l=r.decimalStr,s="".concat(e).concat(l),c="".concat(i).concat(a);if(n>=0){var u=Number(l[n]);if(u>=5&&!o){var d=X2(t).add("".concat(i,"0.").concat("0".repeat(n)).concat(10-u));return AG(d.toString(),e,n,o)}return n===0?c:"".concat(c).concat(e).concat(l.padEnd(n,"0").slice(0,n))}return s===".0"?c:"".concat(c).concat(s)}function EJt(t){return!!(t.addonBefore||t.addonAfter)}function kJt(t){return!!(t.prefix||t.suffix||t.allowClear)}function JPe(t,e,n){var o=e.cloneNode(!0),r=Object.create(t,{target:{value:o},currentTarget:{value:o}});return o.value=n,typeof e.selectionStart=="number"&&typeof e.selectionEnd=="number"&&(o.selectionStart=e.selectionStart,o.selectionEnd=e.selectionEnd),o.setSelectionRange=function(){e.setSelectionRange.apply(e,arguments)},r}function gJ(t,e,n,o){if(n){var r=e;if(e.type==="click"){r=JPe(e,t,""),n(r);return}if(t.type!=="file"&&o!==void 0){r=JPe(e,t,o),n(r);return}n(r)}}function Z9e(t,e){if(t){t.focus(e);var n=e||{},o=n.cursor;if(o){var r=t.value.length;switch(o){case"start":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(r,r);break;default:t.setSelectionRange(0,r)}}}}var e3e=xe.forwardRef(function(t,e){var n,o,r,i=t.inputElement,a=t.children,l=t.prefixCls,s=t.prefix,c=t.suffix,u=t.addonBefore,d=t.addonAfter,f=t.className,p=t.style,m=t.disabled,y=t.readOnly,w=t.focused,x=t.triggerFocus,C=t.allowClear,P=t.value,A=t.handleReset,S=t.hidden,v=t.classes,b=t.classNames,T=t.dataAttrs,R=t.styles,M=t.components,D=t.onClear,k=a??i,N=(M==null?void 0:M.affixWrapper)||"span",U=(M==null?void 0:M.groupWrapper)||"span",W=(M==null?void 0:M.wrapper)||"span",F=(M==null?void 0:M.groupAddon)||"span",E=g.useRef(null),L=function(he){var me;(me=E.current)!==null&&me!==void 0&&me.contains(he.target)&&(x==null||x())},j=kJt(t),Y=g.cloneElement(k,{value:P,className:Bn((n=k.props)===null||n===void 0?void 0:n.className,!j&&(b==null?void 0:b.variant))||null}),O=g.useRef(null);if(xe.useImperativeHandle(e,function(){return{nativeElement:O.current||E.current}}),j){var _=null;if(C){var G=!m&&!y&&P,Q="".concat(l,"-clear-icon"),oe=Vr(C)==="object"&&C!==null&&C!==void 0&&C.clearIcon?C.clearIcon:"✖";_=xe.createElement("button",{type:"button",onClick:function(he){A==null||A(he),D==null||D()},onMouseDown:function(he){return he.preventDefault()},className:Bn(Q,Ut(Ut({},"".concat(Q,"-hidden"),!G),"".concat(Q,"-has-suffix"),!!c))},oe)}var ee="".concat(l,"-affix-wrapper"),$=Bn(ee,Ut(Ut(Ut(Ut(Ut({},"".concat(l,"-disabled"),m),"".concat(ee,"-disabled"),m),"".concat(ee,"-focused"),w),"".concat(ee,"-readonly"),y),"".concat(ee,"-input-with-clear-btn"),c&&C&&P),v==null?void 0:v.affixWrapper,b==null?void 0:b.affixWrapper,b==null?void 0:b.variant),ae=(c||C)&&xe.createElement("span",{className:Bn("".concat(l,"-suffix"),b==null?void 0:b.suffix),style:R==null?void 0:R.suffix},_,c);Y=xe.createElement(N,Uo({className:$,style:R==null?void 0:R.affixWrapper,onClick:L},T==null?void 0:T.affixWrapper,{ref:E}),s&&xe.createElement("span",{className:Bn("".concat(l,"-prefix"),b==null?void 0:b.prefix),style:R==null?void 0:R.prefix},s),Y,ae)}if(EJt(t)){var Z="".concat(l,"-group"),ne="".concat(Z,"-addon"),te="".concat(Z,"-wrapper"),q=Bn("".concat(l,"-wrapper"),Z,v==null?void 0:v.wrapper,b==null?void 0:b.wrapper),le=Bn(te,Ut({},"".concat(te,"-disabled"),m),v==null?void 0:v.group,b==null?void 0:b.groupWrapper);Y=xe.createElement(U,{className:le,ref:O},xe.createElement(W,{className:q},u&&xe.createElement(F,{className:ne},u),Y,d&&xe.createElement(F,{className:ne},d)))}return xe.cloneElement(Y,{className:Bn((o=Y.props)===null||o===void 0?void 0:o.className,f)||null,style:nn(nn({},(r=Y.props)===null||r===void 0?void 0:r.style),p),hidden:S})}),FJt=["show"];function xet(t,e){return g.useMemo(function(){var n={};e&&(n.show=Vr(e)==="object"&&e.formatter?e.formatter:!!e),n=nn(nn({},n),t);var o=n,r=o.show,i=Ai(o,FJt);return nn(nn({},i),{},{show:!!r,showFormatter:typeof r=="function"?r:void 0,strategy:i.strategy||function(a){return a.length}})},[t,e])}var LJt=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],WJt=g.forwardRef(function(t,e){var n=t.autoComplete,o=t.onChange,r=t.onFocus,i=t.onBlur,a=t.onPressEnter,l=t.onKeyDown,s=t.onKeyUp,c=t.prefixCls,u=c===void 0?"rc-input":c,d=t.disabled,f=t.htmlSize,p=t.className,m=t.maxLength,y=t.suffix,w=t.showCount,x=t.count,C=t.type,P=C===void 0?"text":C,A=t.classes,S=t.classNames,v=t.styles,b=t.onCompositionStart,T=t.onCompositionEnd,R=Ai(t,LJt),M=g.useState(!1),D=Sn(M,2),k=D[0],N=D[1],U=g.useRef(!1),W=g.useRef(!1),F=g.useRef(null),E=g.useRef(null),L=function(se){F.current&&Z9e(F.current,se)},j=o0(t.defaultValue,{value:t.value}),Y=Sn(j,2),O=Y[0],_=Y[1],G=O==null?"":String(O),Q=g.useState(null),oe=Sn(Q,2),ee=oe[0],$=oe[1],ae=xet(x,w),Z=ae.max||m,ne=ae.strategy(G),te=!!Z&&ne>Z;g.useImperativeHandle(e,function(){var Ae;return{focus:L,blur:function(){var ge;(ge=F.current)===null||ge===void 0||ge.blur()},setSelectionRange:function(ge,we,Se){var Me;(Me=F.current)===null||Me===void 0||Me.setSelectionRange(ge,we,Se)},select:function(){var ge;(ge=F.current)===null||ge===void 0||ge.select()},input:F.current,nativeElement:((Ae=E.current)===null||Ae===void 0?void 0:Ae.nativeElement)||F.current}}),g.useEffect(function(){W.current&&(W.current=!1),N(function(Ae){return Ae&&d?!1:Ae})},[d]);var q=function(se,ge,we){var Se=ge;if(!U.current&&ae.exceedFormatter&&ae.max&&ae.strategy(ge)>ae.max){if(Se=ae.exceedFormatter(ge,{max:ae.max}),ge!==Se){var Me,Ce;$([((Me=F.current)===null||Me===void 0?void 0:Me.selectionStart)||0,((Ce=F.current)===null||Ce===void 0?void 0:Ce.selectionEnd)||0])}}else if(we.source==="compositionEnd")return;_(Se),F.current&&gJ(F.current,se,o,Se)};g.useEffect(function(){if(ee){var Ae;(Ae=F.current)===null||Ae===void 0||Ae.setSelectionRange.apply(Ae,$o(ee))}},[ee]);var le=function(se){q(se,se.target.value,{source:"change"})},de=function(se){U.current=!1,q(se,se.currentTarget.value,{source:"compositionEnd"}),T==null||T(se)},he=function(se){a&&se.key==="Enter"&&!W.current&&(W.current=!0,a(se)),l==null||l(se)},me=function(se){se.key==="Enter"&&(W.current=!1),s==null||s(se)},ce=function(se){N(!0),r==null||r(se)},Pe=function(se){W.current&&(W.current=!1),N(!1),i==null||i(se)},pe=function(se){_(""),L(),F.current&&gJ(F.current,se,o)},Ie=te&&"".concat(u,"-out-of-range"),ve=function(){var se=tI(t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return xe.createElement("input",Uo({autoComplete:n},se,{onChange:le,onFocus:ce,onBlur:Pe,onKeyDown:he,onKeyUp:me,className:Bn(u,Ut({},"".concat(u,"-disabled"),d),S==null?void 0:S.input),style:v==null?void 0:v.input,ref:F,size:f,type:P,onCompositionStart:function(we){U.current=!0,b==null||b(we)},onCompositionEnd:de}))},ze=function(){var se=Number(Z)>0;if(y||ae.show){var ge=ae.showFormatter?ae.showFormatter({value:G,count:ne,maxLength:Z}):"".concat(ne).concat(se?" / ".concat(Z):"");return xe.createElement(xe.Fragment,null,ae.show&&xe.createElement("span",{className:Bn("".concat(u,"-show-count-suffix"),Ut({},"".concat(u,"-show-count-has-suffix"),!!y),S==null?void 0:S.count),style:nn({},v==null?void 0:v.count)},ge),y)}return null};return xe.createElement(e3e,Uo({},R,{prefixCls:u,className:Bn(p,Ie),handleReset:pe,value:G,focused:k,triggerFocus:L,suffix:ze(),disabled:d,classes:A,classNames:S,styles:v}),ve())});function NJt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var KPe=NJt()?g.useLayoutEffect:g.useEffect,vet=function(e,n){var o=g.useRef(!0);KPe(function(){return e(o.current)},n),KPe(function(){return o.current=!1,function(){o.current=!0}},[])},ese=function(e,n){vet(function(o){if(!o)return e()},n)};function UJt(t,e){return typeof Proxy<"u"&&t?new Proxy(t,{get:function(o,r){if(e[r])return e[r];var i=o[r];return typeof i=="function"?i.bind(o):i}}):t}var ks={};/** * @license React * react-is.production.min.js * @@ -4674,7 +4674,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var t3e=Symbol.for("react.element"),n3e=Symbol.for("react.portal"),hee=Symbol.for("react.fragment"),pee=Symbol.for("react.strict_mode"),gee=Symbol.for("react.profiler"),mee=Symbol.for("react.provider"),yee=Symbol.for("react.context"),jJt=Symbol.for("react.server_context"),Aee=Symbol.for("react.forward_ref"),wee=Symbol.for("react.suspense"),xee=Symbol.for("react.suspense_list"),vee=Symbol.for("react.memo"),bee=Symbol.for("react.lazy"),BJt=Symbol.for("react.offscreen"),bet;bet=Symbol.for("react.module.reference");function i2(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case t3e:switch(t=t.type,t){case hee:case gee:case pee:case wee:case xee:return t;default:switch(t=t&&t.$$typeof,t){case jJt:case yee:case Aee:case bee:case vee:case mee:return t;default:return e}}case n3e:return e}}}ks.ContextConsumer=yee;ks.ContextProvider=mee;ks.Element=t3e;ks.ForwardRef=Aee;ks.Fragment=hee;ks.Lazy=bee;ks.Memo=vee;ks.Portal=n3e;ks.Profiler=gee;ks.StrictMode=pee;ks.Suspense=wee;ks.SuspenseList=xee;ks.isAsyncMode=function(){return!1};ks.isConcurrentMode=function(){return!1};ks.isContextConsumer=function(t){return i2(t)===yee};ks.isContextProvider=function(t){return i2(t)===mee};ks.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===t3e};ks.isForwardRef=function(t){return i2(t)===Aee};ks.isFragment=function(t){return i2(t)===hee};ks.isLazy=function(t){return i2(t)===bee};ks.isMemo=function(t){return i2(t)===vee};ks.isPortal=function(t){return i2(t)===n3e};ks.isProfiler=function(t){return i2(t)===gee};ks.isStrictMode=function(t){return i2(t)===pee};ks.isSuspense=function(t){return i2(t)===wee};ks.isSuspenseList=function(t){return i2(t)===xee};ks.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===hee||t===gee||t===pee||t===wee||t===xee||t===BJt||typeof t=="object"&&t!==null&&(t.$$typeof===bee||t.$$typeof===vee||t.$$typeof===mee||t.$$typeof===yee||t.$$typeof===Aee||t.$$typeof===bet||t.getModuleId!==void 0)};ks.typeOf=i2;var YJt=function(e,n){typeof e=="function"?e(n):Vr(e)==="object"&&e&&"current"in e&&(e.current=n)},OJt=function(){for(var e=arguments.length,n=new Array(e),o=0;o"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var qJt=function(){var e=g.useState(!1),n=Sn(e,2),o=n[0],r=n[1];return vet(function(){r($Jt())},[]),o},Pet=function(e){return+setTimeout(e,16)},Cet=function(e){return clearTimeout(e)};typeof window<"u"&&"requestAnimationFrame"in window&&(Pet=function(e){return window.requestAnimationFrame(e)},Cet=function(e){return window.cancelAnimationFrame(e)});var $Pe=0,o3e=new Map;function Ret(t){o3e.delete(t)}var FL=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;$Pe+=1;var o=$Pe;function r(i){if(i===0)Ret(o),e();else{var a=Pet(function(){r(i-1)});o3e.set(o,a)}}return r(n),o};FL.cancel=function(t){var e=o3e.get(t);return Ret(t),Cet(e)};var QJt=200,ZJt=600;function eKt(t){var e=t.prefixCls,n=t.upNode,o=t.downNode,r=t.upDisabled,i=t.downDisabled,a=t.onStep,l=g.useRef(),s=g.useRef([]),c=g.useRef();c.current=a;var u=function(){clearTimeout(l.current)},d=function(P,A){P.preventDefault(),u(),c.current(A);function S(){c.current(A),l.current=setTimeout(S,QJt)}l.current=setTimeout(S,ZJt)};g.useEffect(function(){return function(){u(),s.current.forEach(function(C){return FL.cancel(C)})}},[]);var f=qJt();if(f)return null;var p="".concat(e,"-handler"),m=Bn(p,"".concat(p,"-up"),Ut({},"".concat(p,"-up-disabled"),r)),y=Bn(p,"".concat(p,"-down"),Ut({},"".concat(p,"-down-disabled"),i)),w=function(){return s.current.push(FL(u))},x={unselectable:"on",role:"button",onMouseUp:w,onMouseLeave:w};return g.createElement("div",{className:"".concat(p,"-wrap")},g.createElement("span",Uo({},x,{onMouseDown:function(P){d(P,!0)},"aria-label":"Increase Value","aria-disabled":r,className:m}),n||g.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-up-inner")})),g.createElement("span",Uo({},x,{onMouseDown:function(P){d(P,!1)},"aria-label":"Decrease Value","aria-disabled":i,className:y}),o||g.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-down-inner")})))}function qPe(t){var e=typeof t=="number"?fee(t):yb(t).fullStr,n=e.includes(".");return n?yb(e.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:t+"0"}const tKt=function(){var t=g.useRef(0),e=function(){FL.cancel(t.current)};return g.useEffect(function(){return e},[]),function(n){e(),t.current=FL(function(){n()})}};var nKt=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],oKt=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],QPe=function(e,n){return e||n.isEmpty()?n.toString():n.toNumber()},ZPe=function(e){var n=X2(e);return n.isInvalidate()?null:n},rKt=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.min,a=t.max,l=t.step,s=l===void 0?1:l,c=t.defaultValue,u=t.value,d=t.disabled,f=t.readOnly,p=t.upHandler,m=t.downHandler,y=t.keyboard,w=t.changeOnWheel,x=w===void 0?!1:w,C=t.controls,P=C===void 0?!0:C;t.classNames;var A=t.stringMode,S=t.parser,v=t.formatter,b=t.precision,T=t.decimalSeparator,R=t.onChange,M=t.onInput,D=t.onPressEnter,k=t.onStep,N=t.changeOnBlur,U=N===void 0?!0:N,W=t.domRef,F=Ai(t,nKt),E="".concat(n,"-input"),L=g.useRef(null),j=g.useState(!1),Y=Sn(j,2),O=Y[0],_=Y[1],G=g.useRef(!1),Q=g.useRef(!1),oe=g.useRef(!1),ee=g.useState(function(){return X2(u??c)}),q=Sn(ee,2),ae=q[0],Z=q[1];function ne(ut){u===void 0&&Z(ut)}var te=g.useCallback(function(ut,ht){if(!ht)return b>=0?b:Math.max(Bv(ut),Bv(s))},[b,s]),$=g.useCallback(function(ut){var ht=String(ut);if(S)return S(ht);var Qe=ht;return T&&(Qe=Qe.replace(T,".")),Qe.replace(/[^\w.-]+/g,"")},[S,T]),le=g.useRef(""),de=g.useCallback(function(ut,ht){if(v)return v(ut,{userTyping:ht,input:String(le.current)});var Qe=typeof ut=="number"?fee(ut):ut;if(!ht){var nt=te(Qe,ht);if(Q9e(Qe)&&(T||nt>=0)){var mt=T||".";Qe=AG(Qe,mt,nt)}}return Qe},[v,te,T]),he=g.useState(function(){var ut=c??u;return ae.isInvalidate()&&["string","number"].includes(Vr(ut))?Number.isNaN(ut)?"":ut:de(ae.toString(),!1)}),me=Sn(he,2),ce=me[0],Pe=me[1];le.current=ce;function pe(ut,ht){Pe(de(ut.isInvalidate()?ut.toString(!1):ut.toString(!ht),ht))}var Ie=g.useMemo(function(){return ZPe(a)},[a,b]),ve=g.useMemo(function(){return ZPe(i)},[i,b]),ze=g.useMemo(function(){return!Ie||!ae||ae.isInvalidate()?!1:Ie.lessEquals(ae)},[Ie,ae]),Ae=g.useMemo(function(){return!ve||!ae||ae.isInvalidate()?!1:ae.lessEquals(ve)},[ve,ae]),se=KJt(L.current,O),ge=Sn(se,2),we=ge[0],Se=ge[1],Me=function(ht){return Ie&&!ht.lessEquals(Ie)?Ie:ve&&!ve.lessEquals(ht)?ve:null},Ce=function(ht){return!Me(ht)},Te=function(ht,Qe){var nt=ht,mt=Ce(nt)||nt.isEmpty();if(!nt.isEmpty()&&!Qe&&(nt=Me(nt)||nt,mt=!0),!f&&!d&&mt){var tt=nt.toString(),gt=te(tt,Qe);return gt>=0&&(nt=X2(AG(tt,".",gt)),Ce(nt)||(nt=X2(AG(tt,".",gt,!0)))),nt.equals(ae)||(ne(nt),R==null||R(nt.isEmpty()?null:QPe(A,nt)),u===void 0&&pe(nt,Qe)),nt}return ae},Re=tKt(),Ne=function ut(ht){if(we(),le.current=ht,Pe(ht),!Q.current){var Qe=$(ht),nt=X2(Qe);nt.isNaN()||Te(nt,!0)}M==null||M(ht),Re(function(){var mt=ht;S||(mt=ht.replace(/。/g,".")),mt!==ht&&ut(mt)})},_e=function(){Q.current=!0},Ue=function(){Q.current=!1,Ne(L.current.value)},qe=function(ht){Ne(ht.target.value)},Fe=function(ht){var Qe;if(!(ht&&ze||!ht&&Ae)){G.current=!1;var nt=X2(oe.current?qPe(s):s);ht||(nt=nt.negate());var mt=(ae||X2(0)).add(nt.toString()),tt=Te(mt,!1);k==null||k(QPe(A,tt),{offset:oe.current?qPe(s):s,type:ht?"up":"down"}),(Qe=L.current)===null||Qe===void 0||Qe.focus()}},He=function(ht){var Qe=X2($(ce)),nt;Qe.isNaN()?nt=Te(ae,ht):nt=Te(Qe,ht),u!==void 0?pe(ae,!1):nt.isNaN()||pe(nt,!1)},Le=function(){G.current=!0},Ye=function(ht){var Qe=ht.key,nt=ht.shiftKey;G.current=!0,oe.current=nt,Qe==="Enter"&&(Q.current||(G.current=!1),He(!1),D==null||D(ht)),y!==!1&&!Q.current&&["Up","ArrowUp","Down","ArrowDown"].includes(Qe)&&(Fe(Qe==="Up"||Qe==="ArrowUp"),ht.preventDefault())},lt=function(){G.current=!1,oe.current=!1};g.useEffect(function(){if(x&&O){var ut=function(nt){Fe(nt.deltaY<0),nt.preventDefault()},ht=L.current;if(ht)return ht.addEventListener("wheel",ut,{passive:!1}),function(){return ht.removeEventListener("wheel",ut)}}});var Oe=function(){U&&He(!1),_(!1),G.current=!1};return ese(function(){ae.isInvalidate()||pe(ae,!1)},[b,v]),ese(function(){var ut=X2(u);Z(ut);var ht=X2($(ce));(!ut.equals(ht)||!G.current||v)&&pe(ut,G.current)},[u]),ese(function(){v&&Se()},[ce]),g.createElement("div",{ref:W,className:Bn(n,o,Ut(Ut(Ut(Ut(Ut({},"".concat(n,"-focused"),O),"".concat(n,"-disabled"),d),"".concat(n,"-readonly"),f),"".concat(n,"-not-a-number"),ae.isNaN()),"".concat(n,"-out-of-range"),!ae.isInvalidate()&&!Ce(ae))),style:r,onFocus:function(){_(!0)},onBlur:Oe,onKeyDown:Ye,onKeyUp:lt,onCompositionStart:_e,onCompositionEnd:Ue,onBeforeInput:Le},P&&g.createElement(eKt,{prefixCls:n,upNode:p,downNode:m,upDisabled:ze,downDisabled:Ae,onStep:Fe}),g.createElement("div",{className:"".concat(E,"-wrap")},g.createElement("input",Uo({autoComplete:"off",role:"spinbutton","aria-valuemin":i,"aria-valuemax":a,"aria-valuenow":ae.isInvalidate()?null:ae.toString(),step:s},F,{ref:OJt(L,e),className:E,value:ce,onChange:qe,disabled:d,readOnly:f}))))}),iKt=g.forwardRef(function(t,e){var n=t.disabled,o=t.style,r=t.prefixCls,i=r===void 0?"rc-input-number":r,a=t.value,l=t.prefix,s=t.suffix,c=t.addonBefore,u=t.addonAfter,d=t.className,f=t.classNames,p=Ai(t,oKt),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=function(P){w.current&&Z9e(w.current,P)};return g.useImperativeHandle(e,function(){return UJt(w.current,{focus:x,nativeElement:m.current.nativeElement||y.current})}),g.createElement(e3e,{className:d,triggerFocus:x,prefixCls:i,value:a,disabled:n,style:o,prefix:l,suffix:s,addonAfter:u,addonBefore:c,classNames:f,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:m},g.createElement(rKt,Uo({prefixCls:i,disabled:n,ref:w,domRef:y,className:f==null?void 0:f.input},p)))});const aKt=t=>{var e;const n=(e=t.handleVisible)!==null&&e!==void 0?e:"auto",o=t.controlHeightSM-t.lineWidth*2;return Object.assign(Object.assign({},xU(t)),{controlWidth:90,handleWidth:o,handleFontSize:t.fontSize/2,handleVisible:n,handleActiveBg:t.colorFillAlter,handleBg:t.colorBgContainer,filledHandleBg:new Di(t.colorFillSecondary).onBackground(t.colorBgContainer).toHexString(),handleHoverColor:t.colorPrimary,handleBorderColor:t.colorBorder,handleOpacity:n===!0?1:0,handleVisibleWidth:n===!0?o:0})},eCe=(t,e)=>{let{componentCls:n,borderRadiusSM:o,borderRadiusLG:r}=t;const i=e==="lg"?r:o;return{[`&-${e}`]:{[`${n}-handler-wrap`]:{borderStartEndRadius:i,borderEndEndRadius:i},[`${n}-handler-up`]:{borderStartEndRadius:i},[`${n}-handler-down`]:{borderEndEndRadius:i}}}},lKt=t=>{const{componentCls:e,lineWidth:n,lineType:o,borderRadius:r,inputFontSizeSM:i,inputFontSizeLG:a,controlHeightLG:l,controlHeightSM:s,colorError:c,paddingInlineSM:u,paddingBlockSM:d,paddingBlockLG:f,paddingInlineLG:p,colorTextDescription:m,motionDurationMid:y,handleHoverColor:w,handleOpacity:x,paddingInline:C,paddingBlock:P,handleBg:A,handleActiveBg:S,colorTextDisabled:v,borderRadiusSM:b,borderRadiusLG:T,controlWidth:R,handleBorderColor:M,filledHandleBg:D,lineHeightLG:k,calc:N}=t;return[{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),vU(t)),{display:"inline-block",width:R,margin:0,padding:0,borderRadius:r}),O9e(t,{[`${e}-handler-wrap`]:{background:A,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${M}`}}})),V9e(t,{[`${e}-handler-wrap`]:{background:D,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${M}`}},"&:focus-within":{[`${e}-handler-wrap`]:{background:A}}})),_9e(t)),{"&-rtl":{direction:"rtl",[`${e}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:a,lineHeight:k,borderRadius:T,[`input${e}-input`]:{height:N(l).sub(N(n).mul(2)).equal(),padding:`${jt(f)} ${jt(p)}`}},"&-sm":{padding:0,fontSize:i,borderRadius:b,[`input${e}-input`]:{height:N(s).sub(N(n).mul(2)).equal(),padding:`${jt(d)} ${jt(u)}`}},"&-out-of-range":{[`${e}-input-wrap`]:{input:{color:c}}},"&-group":Object.assign(Object.assign(Object.assign({},Ua(t)),net(t)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",[`${e}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${e}-group-addon`]:{borderRadius:T,fontSize:t.fontSizeLG}},"&-sm":{[`${e}-group-addon`]:{borderRadius:b}}},QZe(t)),eet(t)),{[`&:not(${e}-compact-first-item):not(${e}-compact-last-item)${e}-compact-item`]:{[`${e}, ${e}-group-addon`]:{borderRadius:0}},[`&:not(${e}-compact-last-item)${e}-compact-first-item`]:{[`${e}, ${e}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${e}-compact-first-item)${e}-compact-last-item`]:{[`${e}, ${e}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),[`&-disabled ${e}-input`]:{cursor:"not-allowed"},[e]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{width:"100%",padding:`${jt(P)} ${jt(C)}`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:r,outline:0,transition:`all ${y} linear`,appearance:"textfield",fontSize:"inherit"}),G9e(t.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,webkitAppearance:"none",appearance:"none"}})},[`&:hover ${e}-handler-wrap, &-focused ${e}-handler-wrap`]:{width:t.handleWidth,opacity:1}})},{[e]:Object.assign(Object.assign(Object.assign({[`${e}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:t.handleVisibleWidth,opacity:x,height:"100%",borderStartStartRadius:0,borderStartEndRadius:r,borderEndEndRadius:r,borderEndStartRadius:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`all ${y}`,overflow:"hidden",[`${e}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[` + */var t3e=Symbol.for("react.element"),n3e=Symbol.for("react.portal"),hee=Symbol.for("react.fragment"),pee=Symbol.for("react.strict_mode"),gee=Symbol.for("react.profiler"),mee=Symbol.for("react.provider"),yee=Symbol.for("react.context"),jJt=Symbol.for("react.server_context"),Aee=Symbol.for("react.forward_ref"),wee=Symbol.for("react.suspense"),xee=Symbol.for("react.suspense_list"),vee=Symbol.for("react.memo"),bee=Symbol.for("react.lazy"),BJt=Symbol.for("react.offscreen"),bet;bet=Symbol.for("react.module.reference");function i2(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case t3e:switch(t=t.type,t){case hee:case gee:case pee:case wee:case xee:return t;default:switch(t=t&&t.$$typeof,t){case jJt:case yee:case Aee:case bee:case vee:case mee:return t;default:return e}}case n3e:return e}}}ks.ContextConsumer=yee;ks.ContextProvider=mee;ks.Element=t3e;ks.ForwardRef=Aee;ks.Fragment=hee;ks.Lazy=bee;ks.Memo=vee;ks.Portal=n3e;ks.Profiler=gee;ks.StrictMode=pee;ks.Suspense=wee;ks.SuspenseList=xee;ks.isAsyncMode=function(){return!1};ks.isConcurrentMode=function(){return!1};ks.isContextConsumer=function(t){return i2(t)===yee};ks.isContextProvider=function(t){return i2(t)===mee};ks.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===t3e};ks.isForwardRef=function(t){return i2(t)===Aee};ks.isFragment=function(t){return i2(t)===hee};ks.isLazy=function(t){return i2(t)===bee};ks.isMemo=function(t){return i2(t)===vee};ks.isPortal=function(t){return i2(t)===n3e};ks.isProfiler=function(t){return i2(t)===gee};ks.isStrictMode=function(t){return i2(t)===pee};ks.isSuspense=function(t){return i2(t)===wee};ks.isSuspenseList=function(t){return i2(t)===xee};ks.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===hee||t===gee||t===pee||t===wee||t===xee||t===BJt||typeof t=="object"&&t!==null&&(t.$$typeof===bee||t.$$typeof===vee||t.$$typeof===mee||t.$$typeof===yee||t.$$typeof===Aee||t.$$typeof===bet||t.getModuleId!==void 0)};ks.typeOf=i2;var YJt=function(e,n){typeof e=="function"?e(n):Vr(e)==="object"&&e&&"current"in e&&(e.current=n)},OJt=function(){for(var e=arguments.length,n=new Array(e),o=0;o"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var qJt=function(){var e=g.useState(!1),n=Sn(e,2),o=n[0],r=n[1];return vet(function(){r($Jt())},[]),o},Pet=function(e){return+setTimeout(e,16)},Cet=function(e){return clearTimeout(e)};typeof window<"u"&&"requestAnimationFrame"in window&&(Pet=function(e){return window.requestAnimationFrame(e)},Cet=function(e){return window.cancelAnimationFrame(e)});var $Pe=0,o3e=new Map;function Ret(t){o3e.delete(t)}var FL=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;$Pe+=1;var o=$Pe;function r(i){if(i===0)Ret(o),e();else{var a=Pet(function(){r(i-1)});o3e.set(o,a)}}return r(n),o};FL.cancel=function(t){var e=o3e.get(t);return Ret(t),Cet(e)};var QJt=200,ZJt=600;function eKt(t){var e=t.prefixCls,n=t.upNode,o=t.downNode,r=t.upDisabled,i=t.downDisabled,a=t.onStep,l=g.useRef(),s=g.useRef([]),c=g.useRef();c.current=a;var u=function(){clearTimeout(l.current)},d=function(P,A){P.preventDefault(),u(),c.current(A);function S(){c.current(A),l.current=setTimeout(S,QJt)}l.current=setTimeout(S,ZJt)};g.useEffect(function(){return function(){u(),s.current.forEach(function(C){return FL.cancel(C)})}},[]);var f=qJt();if(f)return null;var p="".concat(e,"-handler"),m=Bn(p,"".concat(p,"-up"),Ut({},"".concat(p,"-up-disabled"),r)),y=Bn(p,"".concat(p,"-down"),Ut({},"".concat(p,"-down-disabled"),i)),w=function(){return s.current.push(FL(u))},x={unselectable:"on",role:"button",onMouseUp:w,onMouseLeave:w};return g.createElement("div",{className:"".concat(p,"-wrap")},g.createElement("span",Uo({},x,{onMouseDown:function(P){d(P,!0)},"aria-label":"Increase Value","aria-disabled":r,className:m}),n||g.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-up-inner")})),g.createElement("span",Uo({},x,{onMouseDown:function(P){d(P,!1)},"aria-label":"Decrease Value","aria-disabled":i,className:y}),o||g.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-down-inner")})))}function qPe(t){var e=typeof t=="number"?fee(t):yb(t).fullStr,n=e.includes(".");return n?yb(e.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:t+"0"}const tKt=function(){var t=g.useRef(0),e=function(){FL.cancel(t.current)};return g.useEffect(function(){return e},[]),function(n){e(),t.current=FL(function(){n()})}};var nKt=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],oKt=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],QPe=function(e,n){return e||n.isEmpty()?n.toString():n.toNumber()},ZPe=function(e){var n=X2(e);return n.isInvalidate()?null:n},rKt=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.min,a=t.max,l=t.step,s=l===void 0?1:l,c=t.defaultValue,u=t.value,d=t.disabled,f=t.readOnly,p=t.upHandler,m=t.downHandler,y=t.keyboard,w=t.changeOnWheel,x=w===void 0?!1:w,C=t.controls,P=C===void 0?!0:C;t.classNames;var A=t.stringMode,S=t.parser,v=t.formatter,b=t.precision,T=t.decimalSeparator,R=t.onChange,M=t.onInput,D=t.onPressEnter,k=t.onStep,N=t.changeOnBlur,U=N===void 0?!0:N,W=t.domRef,F=Ai(t,nKt),E="".concat(n,"-input"),L=g.useRef(null),j=g.useState(!1),Y=Sn(j,2),O=Y[0],_=Y[1],G=g.useRef(!1),Q=g.useRef(!1),oe=g.useRef(!1),ee=g.useState(function(){return X2(u??c)}),$=Sn(ee,2),ae=$[0],Z=$[1];function ne(ut){u===void 0&&Z(ut)}var te=g.useCallback(function(ut,ht){if(!ht)return b>=0?b:Math.max(Bv(ut),Bv(s))},[b,s]),q=g.useCallback(function(ut){var ht=String(ut);if(S)return S(ht);var Qe=ht;return T&&(Qe=Qe.replace(T,".")),Qe.replace(/[^\w.-]+/g,"")},[S,T]),le=g.useRef(""),de=g.useCallback(function(ut,ht){if(v)return v(ut,{userTyping:ht,input:String(le.current)});var Qe=typeof ut=="number"?fee(ut):ut;if(!ht){var nt=te(Qe,ht);if(Q9e(Qe)&&(T||nt>=0)){var mt=T||".";Qe=AG(Qe,mt,nt)}}return Qe},[v,te,T]),he=g.useState(function(){var ut=c??u;return ae.isInvalidate()&&["string","number"].includes(Vr(ut))?Number.isNaN(ut)?"":ut:de(ae.toString(),!1)}),me=Sn(he,2),ce=me[0],Pe=me[1];le.current=ce;function pe(ut,ht){Pe(de(ut.isInvalidate()?ut.toString(!1):ut.toString(!ht),ht))}var Ie=g.useMemo(function(){return ZPe(a)},[a,b]),ve=g.useMemo(function(){return ZPe(i)},[i,b]),ze=g.useMemo(function(){return!Ie||!ae||ae.isInvalidate()?!1:Ie.lessEquals(ae)},[Ie,ae]),Ae=g.useMemo(function(){return!ve||!ae||ae.isInvalidate()?!1:ae.lessEquals(ve)},[ve,ae]),se=KJt(L.current,O),ge=Sn(se,2),we=ge[0],Se=ge[1],Me=function(ht){return Ie&&!ht.lessEquals(Ie)?Ie:ve&&!ve.lessEquals(ht)?ve:null},Ce=function(ht){return!Me(ht)},Te=function(ht,Qe){var nt=ht,mt=Ce(nt)||nt.isEmpty();if(!nt.isEmpty()&&!Qe&&(nt=Me(nt)||nt,mt=!0),!f&&!d&&mt){var tt=nt.toString(),gt=te(tt,Qe);return gt>=0&&(nt=X2(AG(tt,".",gt)),Ce(nt)||(nt=X2(AG(tt,".",gt,!0)))),nt.equals(ae)||(ne(nt),R==null||R(nt.isEmpty()?null:QPe(A,nt)),u===void 0&&pe(nt,Qe)),nt}return ae},Re=tKt(),Ne=function ut(ht){if(we(),le.current=ht,Pe(ht),!Q.current){var Qe=q(ht),nt=X2(Qe);nt.isNaN()||Te(nt,!0)}M==null||M(ht),Re(function(){var mt=ht;S||(mt=ht.replace(/。/g,".")),mt!==ht&&ut(mt)})},_e=function(){Q.current=!0},Ue=function(){Q.current=!1,Ne(L.current.value)},qe=function(ht){Ne(ht.target.value)},Fe=function(ht){var Qe;if(!(ht&&ze||!ht&&Ae)){G.current=!1;var nt=X2(oe.current?qPe(s):s);ht||(nt=nt.negate());var mt=(ae||X2(0)).add(nt.toString()),tt=Te(mt,!1);k==null||k(QPe(A,tt),{offset:oe.current?qPe(s):s,type:ht?"up":"down"}),(Qe=L.current)===null||Qe===void 0||Qe.focus()}},He=function(ht){var Qe=X2(q(ce)),nt;Qe.isNaN()?nt=Te(ae,ht):nt=Te(Qe,ht),u!==void 0?pe(ae,!1):nt.isNaN()||pe(nt,!1)},Le=function(){G.current=!0},Ye=function(ht){var Qe=ht.key,nt=ht.shiftKey;G.current=!0,oe.current=nt,Qe==="Enter"&&(Q.current||(G.current=!1),He(!1),D==null||D(ht)),y!==!1&&!Q.current&&["Up","ArrowUp","Down","ArrowDown"].includes(Qe)&&(Fe(Qe==="Up"||Qe==="ArrowUp"),ht.preventDefault())},lt=function(){G.current=!1,oe.current=!1};g.useEffect(function(){if(x&&O){var ut=function(nt){Fe(nt.deltaY<0),nt.preventDefault()},ht=L.current;if(ht)return ht.addEventListener("wheel",ut,{passive:!1}),function(){return ht.removeEventListener("wheel",ut)}}});var Oe=function(){U&&He(!1),_(!1),G.current=!1};return ese(function(){ae.isInvalidate()||pe(ae,!1)},[b,v]),ese(function(){var ut=X2(u);Z(ut);var ht=X2(q(ce));(!ut.equals(ht)||!G.current||v)&&pe(ut,G.current)},[u]),ese(function(){v&&Se()},[ce]),g.createElement("div",{ref:W,className:Bn(n,o,Ut(Ut(Ut(Ut(Ut({},"".concat(n,"-focused"),O),"".concat(n,"-disabled"),d),"".concat(n,"-readonly"),f),"".concat(n,"-not-a-number"),ae.isNaN()),"".concat(n,"-out-of-range"),!ae.isInvalidate()&&!Ce(ae))),style:r,onFocus:function(){_(!0)},onBlur:Oe,onKeyDown:Ye,onKeyUp:lt,onCompositionStart:_e,onCompositionEnd:Ue,onBeforeInput:Le},P&&g.createElement(eKt,{prefixCls:n,upNode:p,downNode:m,upDisabled:ze,downDisabled:Ae,onStep:Fe}),g.createElement("div",{className:"".concat(E,"-wrap")},g.createElement("input",Uo({autoComplete:"off",role:"spinbutton","aria-valuemin":i,"aria-valuemax":a,"aria-valuenow":ae.isInvalidate()?null:ae.toString(),step:s},F,{ref:OJt(L,e),className:E,value:ce,onChange:qe,disabled:d,readOnly:f}))))}),iKt=g.forwardRef(function(t,e){var n=t.disabled,o=t.style,r=t.prefixCls,i=r===void 0?"rc-input-number":r,a=t.value,l=t.prefix,s=t.suffix,c=t.addonBefore,u=t.addonAfter,d=t.className,f=t.classNames,p=Ai(t,oKt),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=function(P){w.current&&Z9e(w.current,P)};return g.useImperativeHandle(e,function(){return UJt(w.current,{focus:x,nativeElement:m.current.nativeElement||y.current})}),g.createElement(e3e,{className:d,triggerFocus:x,prefixCls:i,value:a,disabled:n,style:o,prefix:l,suffix:s,addonAfter:u,addonBefore:c,classNames:f,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:m},g.createElement(rKt,Uo({prefixCls:i,disabled:n,ref:w,domRef:y,className:f==null?void 0:f.input},p)))});const aKt=t=>{var e;const n=(e=t.handleVisible)!==null&&e!==void 0?e:"auto",o=t.controlHeightSM-t.lineWidth*2;return Object.assign(Object.assign({},xU(t)),{controlWidth:90,handleWidth:o,handleFontSize:t.fontSize/2,handleVisible:n,handleActiveBg:t.colorFillAlter,handleBg:t.colorBgContainer,filledHandleBg:new Di(t.colorFillSecondary).onBackground(t.colorBgContainer).toHexString(),handleHoverColor:t.colorPrimary,handleBorderColor:t.colorBorder,handleOpacity:n===!0?1:0,handleVisibleWidth:n===!0?o:0})},eCe=(t,e)=>{let{componentCls:n,borderRadiusSM:o,borderRadiusLG:r}=t;const i=e==="lg"?r:o;return{[`&-${e}`]:{[`${n}-handler-wrap`]:{borderStartEndRadius:i,borderEndEndRadius:i},[`${n}-handler-up`]:{borderStartEndRadius:i},[`${n}-handler-down`]:{borderEndEndRadius:i}}}},lKt=t=>{const{componentCls:e,lineWidth:n,lineType:o,borderRadius:r,inputFontSizeSM:i,inputFontSizeLG:a,controlHeightLG:l,controlHeightSM:s,colorError:c,paddingInlineSM:u,paddingBlockSM:d,paddingBlockLG:f,paddingInlineLG:p,colorTextDescription:m,motionDurationMid:y,handleHoverColor:w,handleOpacity:x,paddingInline:C,paddingBlock:P,handleBg:A,handleActiveBg:S,colorTextDisabled:v,borderRadiusSM:b,borderRadiusLG:T,controlWidth:R,handleBorderColor:M,filledHandleBg:D,lineHeightLG:k,calc:N}=t;return[{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),vU(t)),{display:"inline-block",width:R,margin:0,padding:0,borderRadius:r}),O9e(t,{[`${e}-handler-wrap`]:{background:A,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${M}`}}})),V9e(t,{[`${e}-handler-wrap`]:{background:D,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${M}`}},"&:focus-within":{[`${e}-handler-wrap`]:{background:A}}})),_9e(t)),{"&-rtl":{direction:"rtl",[`${e}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:a,lineHeight:k,borderRadius:T,[`input${e}-input`]:{height:N(l).sub(N(n).mul(2)).equal(),padding:`${jt(f)} ${jt(p)}`}},"&-sm":{padding:0,fontSize:i,borderRadius:b,[`input${e}-input`]:{height:N(s).sub(N(n).mul(2)).equal(),padding:`${jt(d)} ${jt(u)}`}},"&-out-of-range":{[`${e}-input-wrap`]:{input:{color:c}}},"&-group":Object.assign(Object.assign(Object.assign({},Ua(t)),net(t)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",[`${e}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${e}-group-addon`]:{borderRadius:T,fontSize:t.fontSizeLG}},"&-sm":{[`${e}-group-addon`]:{borderRadius:b}}},QZe(t)),eet(t)),{[`&:not(${e}-compact-first-item):not(${e}-compact-last-item)${e}-compact-item`]:{[`${e}, ${e}-group-addon`]:{borderRadius:0}},[`&:not(${e}-compact-last-item)${e}-compact-first-item`]:{[`${e}, ${e}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${e}-compact-first-item)${e}-compact-last-item`]:{[`${e}, ${e}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),[`&-disabled ${e}-input`]:{cursor:"not-allowed"},[e]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{width:"100%",padding:`${jt(P)} ${jt(C)}`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:r,outline:0,transition:`all ${y} linear`,appearance:"textfield",fontSize:"inherit"}),G9e(t.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,webkitAppearance:"none",appearance:"none"}})},[`&:hover ${e}-handler-wrap, &-focused ${e}-handler-wrap`]:{width:t.handleWidth,opacity:1}})},{[e]:Object.assign(Object.assign(Object.assign({[`${e}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:t.handleVisibleWidth,opacity:x,height:"100%",borderStartStartRadius:0,borderStartEndRadius:r,borderEndEndRadius:r,borderEndStartRadius:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`all ${y}`,overflow:"hidden",[`${e}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[` ${e}-handler-up-inner, ${e}-handler-down-inner `]:{marginInlineEnd:0,fontSize:t.handleFontSize}}},[`${e}-handler`]:{height:"50%",overflow:"hidden",color:m,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:`${jt(n)} ${o} ${M}`,transition:`all ${y} linear`,"&:active":{background:S},"&:hover":{height:"60%",[` @@ -4686,7 +4686,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `]:{cursor:"not-allowed"},[` ${e}-handler-up-disabled:hover &-handler-up-inner, ${e}-handler-down-disabled:hover &-handler-down-inner - `]:{color:v}})}]},sKt=t=>{const{componentCls:e,paddingBlock:n,paddingInline:o,inputAffixPadding:r,controlWidth:i,borderRadiusLG:a,borderRadiusSM:l,paddingInlineLG:s,paddingInlineSM:c,paddingBlockLG:u,paddingBlockSM:d,motionDurationMid:f}=t;return{[`${e}-affix-wrapper`]:Object.assign(Object.assign({[`input${e}-input`]:{padding:`${jt(n)} 0`}},vU(t)),{position:"relative",display:"inline-flex",alignItems:"center",width:i,padding:0,paddingInlineStart:o,"&-lg":{borderRadius:a,paddingInlineStart:s,[`input${e}-input`]:{padding:`${jt(u)} 0`}},"&-sm":{borderRadius:l,paddingInlineStart:c,[`input${e}-input`]:{padding:`${jt(d)} 0`}},[`&:not(${e}-disabled):hover`]:{zIndex:1},"&-focused, &:focus":{zIndex:1},[`&-disabled > ${e}-disabled`]:{background:"transparent"},[`> div${e}`]:{width:"100%",border:"none",outline:"none",[`&${e}-focused`]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${e}-handler-wrap`]:{zIndex:2},[e]:{position:"static",color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:r},"&-suffix":{insetBlockStart:0,insetInlineEnd:0,height:"100%",marginInlineEnd:o,marginInlineStart:r,transition:`margin ${f}`}},[`&:hover ${e}-handler-wrap, &-focused ${e}-handler-wrap`]:{width:t.handleWidth,opacity:1},[`&:not(${e}-affix-wrapper-without-controls):hover ${e}-suffix`]:{marginInlineEnd:t.calc(t.handleWidth).add(o).equal()}})}},cKt=el("InputNumber",t=>{const e=Ui(t,wU(t));return[lKt(e),sKt(e),sU(e)]},aKt,{unitless:{handleOpacity:!0}});var uKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n,direction:o}=g.useContext(gr),r=g.useRef(null);g.useImperativeHandle(e,()=>r.current);const{className:i,rootClassName:a,size:l,disabled:s,prefixCls:c,addonBefore:u,addonAfter:d,prefix:f,suffix:p,bordered:m,readOnly:y,status:w,controls:x,variant:C}=t,P=uKt(t,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","suffix","bordered","readOnly","status","controls","variant"]),A=n("input-number",c),S=nu(A),[v,b,T]=cKt(A,S),{compactSize:R,compactItemClassnames:M}=x4(A,o);let D=g.createElement(Aet,{className:`${A}-handler-up-inner`}),k=g.createElement(RZ,{className:`${A}-handler-down-inner`});const N=typeof x=="boolean"?x:void 0;typeof x=="object"&&(D=typeof x.upIcon>"u"?D:g.createElement("span",{className:`${A}-handler-up-inner`},x.upIcon),k=typeof x.downIcon>"u"?k:g.createElement("span",{className:`${A}-handler-down-inner`},x.downIcon));const{hasFeedback:U,status:W,isFormItemInput:F,feedbackIcon:E}=g.useContext(W1),L=US(W,w),j=jd(ae=>{var Z;return(Z=l??R)!==null&&Z!==void 0?Z:ae}),Y=g.useContext(Bp),O=s??Y,[_,G]=jS("inputNumber",C,m),Q=U&&g.createElement(g.Fragment,null,E),oe=Mn({[`${A}-lg`]:j==="large",[`${A}-sm`]:j==="small",[`${A}-rtl`]:o==="rtl",[`${A}-in-form-item`]:F},b),ee=`${A}-group`,q=g.createElement(iKt,Object.assign({ref:r,disabled:O,className:Mn(T,S,i,a,M),upHandler:D,downHandler:k,prefixCls:A,readOnly:y,controls:N,prefix:f,suffix:Q||p,addonBefore:u&&g.createElement(E3,{form:!0,space:!0},u),addonAfter:d&&g.createElement(E3,{form:!0,space:!0},d),classNames:{input:oe,variant:Mn({[`${A}-${_}`]:G},o7(A,L,U)),affixWrapper:Mn({[`${A}-affix-wrapper-sm`]:j==="small",[`${A}-affix-wrapper-lg`]:j==="large",[`${A}-affix-wrapper-rtl`]:o==="rtl",[`${A}-affix-wrapper-without-controls`]:x===!1},b),wrapper:Mn({[`${ee}-rtl`]:o==="rtl"},b),groupWrapper:Mn({[`${A}-group-wrapper-sm`]:j==="small",[`${A}-group-wrapper-lg`]:j==="large",[`${A}-group-wrapper-rtl`]:o==="rtl",[`${A}-group-wrapper-${_}`]:G},o7(`${A}-group-wrapper`,L,U),b)}},P));return v(q)}),mn=Het,dKt=t=>g.createElement(n2,{theme:{components:{InputNumber:{handleVisible:!0}}}},g.createElement(Het,Object.assign({},t)));mn._InternalPanelDoNotUseOrYouWillBeFired=dKt;const fKt=t=>{const{getPrefixCls:e,direction:n}=g.useContext(gr),{prefixCls:o,className:r}=t,i=e("input-group",o),a=e("input"),[l,s]=J9e(a),c=Mn(i,{[`${i}-lg`]:t.size==="large",[`${i}-sm`]:t.size==="small",[`${i}-compact`]:t.compact,[`${i}-rtl`]:n==="rtl"},s,r),u=g.useContext(W1),d=g.useMemo(()=>Object.assign(Object.assign({},u),{isFormItemInput:!1}),[u]);return l(g.createElement("span",{className:c,style:t.style,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onFocus:t.onFocus,onBlur:t.onBlur},g.createElement(W1.Provider,{value:d},t.children)))},Met=t=>{let e;return typeof t=="object"&&(t!=null&&t.clearIcon)?e=t:t&&(e={clearIcon:xe.createElement(uZ,null)}),e};function Iet(t,e){const n=g.useRef([]),o=()=>{n.current.push(setTimeout(()=>{var r,i,a,l;!((r=t.current)===null||r===void 0)&&r.input&&((i=t.current)===null||i===void 0?void 0:i.input.getAttribute("type"))==="password"&&(!((a=t.current)===null||a===void 0)&&a.input.hasAttribute("value"))&&((l=t.current)===null||l===void 0||l.input.removeAttribute("value"))}))};return g.useEffect(()=>(e&&o(),()=>n.current.forEach(r=>{r&&clearTimeout(r)})),[]),o}function hKt(t){return!!(t.prefix||t.suffix||t.allowClear||t.showCount)}var pKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r=!0,status:i,size:a,disabled:l,onBlur:s,onFocus:c,suffix:u,allowClear:d,addonAfter:f,addonBefore:p,className:m,style:y,styles:w,rootClassName:x,onChange:C,classNames:P,variant:A}=t,S=pKt(t,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames","variant"]),{getPrefixCls:v,direction:b,input:T}=xe.useContext(gr),R=v("input",o),M=g.useRef(null),D=nu(R),[k,N,U]=J9e(R,D),{compactSize:W,compactItemClassnames:F}=x4(R,b),E=jd(le=>{var de;return(de=a??W)!==null&&de!==void 0?de:le}),L=xe.useContext(Bp),j=l??L,{status:Y,hasFeedback:O,feedbackIcon:_}=g.useContext(W1),G=US(Y,i),Q=hKt(t)||!!O;g.useRef(Q);const oe=Iet(M,!0),ee=le=>{oe(),s==null||s(le)},q=le=>{oe(),c==null||c(le)},ae=le=>{oe(),C==null||C(le)},Z=(O||u)&&xe.createElement(xe.Fragment,null,u,O&&_),ne=Met(d??(T==null?void 0:T.allowClear)),[te,$]=jS("input",A,r);return k(xe.createElement(WJt,Object.assign({ref:e2(e,M),prefixCls:R,autoComplete:T==null?void 0:T.autoComplete},S,{disabled:j,onBlur:ee,onFocus:q,style:Object.assign(Object.assign({},T==null?void 0:T.style),y),styles:Object.assign(Object.assign({},T==null?void 0:T.styles),w),suffix:Z,allowClear:ne,className:Mn(m,x,U,D,F,T==null?void 0:T.className),onChange:ae,addonBefore:p&&xe.createElement(E3,{form:!0,space:!0},p),addonAfter:f&&xe.createElement(E3,{form:!0,space:!0},f),classNames:Object.assign(Object.assign(Object.assign({},P),T==null?void 0:T.classNames),{input:Mn({[`${R}-sm`]:E==="small",[`${R}-lg`]:E==="large",[`${R}-rtl`]:b==="rtl"},P==null?void 0:P.input,(n=T==null?void 0:T.classNames)===null||n===void 0?void 0:n.input,N),variant:Mn({[`${R}-${te}`]:$},o7(R,G)),affixWrapper:Mn({[`${R}-affix-wrapper-sm`]:E==="small",[`${R}-affix-wrapper-lg`]:E==="large",[`${R}-affix-wrapper-rtl`]:b==="rtl"},N),wrapper:Mn({[`${R}-group-rtl`]:b==="rtl"},N),groupWrapper:Mn({[`${R}-group-wrapper-sm`]:E==="small",[`${R}-group-wrapper-lg`]:E==="large",[`${R}-group-wrapper-rtl`]:b==="rtl",[`${R}-group-wrapper-${te}`]:$},o7(`${R}-group-wrapper`,G,O),N)})})))}),gKt=t=>{const{componentCls:e,paddingXS:n}=t;return{[e]:{display:"inline-flex",alignItems:"center",flexWrap:"nowrap",columnGap:n,"&-rtl":{direction:"rtl"},[`${e}-input`]:{textAlign:"center",paddingInline:t.paddingXXS},[`&${e}-sm ${e}-input`]:{paddingInline:t.calc(t.paddingXXS).div(2).equal()},[`&${e}-lg ${e}-input`]:{paddingInline:t.paddingXS}}}},mKt=el(["Input","OTP"],t=>{const e=Ui(t,wU(t));return[gKt(e)]},xU);var yKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{value:n,onChange:o,onActiveChange:r,index:i,mask:a}=t,l=yKt(t,["value","onChange","onActiveChange","index","mask"]),s=n&&typeof a=="string"?a:n,c=m=>{o(i,m.target.value)},u=g.useRef(null);g.useImperativeHandle(e,()=>u.current);const d=()=>{Hf(()=>{var m;const y=(m=u.current)===null||m===void 0?void 0:m.input;document.activeElement===y&&y&&y.select()})},f=m=>{const{key:y,ctrlKey:w,metaKey:x}=m;y==="ArrowLeft"?r(i-1):y==="ArrowRight"?r(i+1):y==="z"&&(w||x)&&m.preventDefault(),d()},p=m=>{m.key==="Backspace"&&!n&&r(i-1),d()};return g.createElement(Tee,Object.assign({type:a===!0?"password":"text"},l,{ref:u,value:s,onInput:c,onFocus:d,onKeyDown:f,onKeyUp:p,onMouseDown:d,onMouseUp:d}))});var wKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,length:o=6,size:r,defaultValue:i,value:a,onChange:l,formatter:s,variant:c,disabled:u,status:d,autoFocus:f,mask:p,type:m,onInput:y,inputMode:w}=t,x=wKt(t,["prefixCls","length","size","defaultValue","value","onChange","formatter","variant","disabled","status","autoFocus","mask","type","onInput","inputMode"]),{getPrefixCls:C,direction:P}=g.useContext(gr),A=C("otp",n),S=$5e(x,{aria:!0,data:!0,attr:!0}),v=nu(A),[b,T,R]=mKt(A,v),M=jd(Q=>r??Q),D=g.useContext(W1),k=US(D.status,d),N=g.useMemo(()=>Object.assign(Object.assign({},D),{status:k,hasFeedback:!1,feedbackIcon:null}),[D,k]),U=g.useRef(null),W=g.useRef({});g.useImperativeHandle(e,()=>({focus:()=>{var Q;(Q=W.current[0])===null||Q===void 0||Q.focus()},blur:()=>{var Q;for(let oe=0;oes?s(Q):Q,[E,L]=g.useState(QO(F(i||"")));g.useEffect(()=>{a!==void 0&&L(QO(a))},[a]);const j=kd(Q=>{L(Q),y&&y(Q),l&&Q.length===o&&Q.every(oe=>oe)&&Q.some((oe,ee)=>E[ee]!==oe)&&l(Q.join(""))}),Y=kd((Q,oe)=>{let ee=Pa(E);for(let ae=0;ae=0&&!ee[ae];ae-=1)ee.pop();const q=F(ee.map(ae=>ae||" ").join(""));return ee=QO(q).map((ae,Z)=>ae===" "&&!ee[Z]?ee[Z]:ae),ee}),O=(Q,oe)=>{var ee;const q=Y(Q,oe),ae=Math.min(Q+oe.length,o-1);ae!==Q&&q[Q]!==void 0&&((ee=W.current[ae])===null||ee===void 0||ee.focus()),j(q)},_=Q=>{var oe;(oe=W.current[Q])===null||oe===void 0||oe.focus()},G={variant:c,disabled:u,status:k,mask:p,type:m,inputMode:w};return b(g.createElement("div",Object.assign({},S,{ref:U,className:Mn(A,{[`${A}-sm`]:M==="small",[`${A}-lg`]:M==="large",[`${A}-rtl`]:P==="rtl"},R,T)}),g.createElement(W1.Provider,{value:N},Array.from({length:o}).map((Q,oe)=>{const ee=`otp-${oe}`,q=E[oe]||"";return g.createElement(AKt,Object.assign({ref:ae=>{W.current[oe]=ae},key:ee,index:oe,size:M,htmlSize:1,className:`${A}-input`,onChange:O,value:q,onActiveChange:_,autoFocus:oe===0&&f},G))}))))});var vKt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},bKt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:vKt}))},SKt=g.forwardRef(bKt),TKt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},PKt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:TKt}))},zet=g.forwardRef(PKt),CKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rt?g.createElement(zet,null):g.createElement(SKt,null),HKt={click:"onClick",hover:"onMouseOver"},MKt=g.forwardRef((t,e)=>{const{disabled:n,action:o="click",visibilityToggle:r=!0,iconRender:i=RKt}=t,a=g.useContext(Bp),l=n??a,s=typeof r=="object"&&r.visible!==void 0,[c,u]=g.useState(()=>s?r.visible:!1),d=g.useRef(null);g.useEffect(()=>{s&&u(r.visible)},[s,r]);const f=Iet(d),p=()=>{var M;if(l)return;c&&f();const D=!c;u(D),typeof r=="object"&&((M=r.onVisibleChange)===null||M===void 0||M.call(r,D))},m=M=>{const D=HKt[o]||"",k=i(c),N={[D]:p,className:`${M}-icon`,key:"passwordIcon",onMouseDown:U=>{U.preventDefault()},onMouseUp:U=>{U.preventDefault()}};return g.cloneElement(g.isValidElement(k)?k:g.createElement("span",null,k),N)},{className:y,prefixCls:w,inputPrefixCls:x,size:C}=t,P=CKt(t,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:A}=g.useContext(gr),S=A("input",x),v=A("input-password",w),b=r&&m(v),T=Mn(v,y,{[`${v}-${C}`]:!!C}),R=Object.assign(Object.assign({},Mf(P,["suffix","iconRender","visibilityToggle"])),{type:c?"text":"password",className:T,prefixCls:S,suffix:b});return C&&(R.size=C),g.createElement(Tee,Object.assign({ref:e2(e,d)},R))});var IKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,inputPrefixCls:o,className:r,size:i,suffix:a,enterButton:l=!1,addonAfter:s,loading:c,disabled:u,onSearch:d,onChange:f,onCompositionStart:p,onCompositionEnd:m}=t,y=IKt(t,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd"]),{getPrefixCls:w,direction:x}=g.useContext(gr),C=g.useRef(!1),P=w("input-search",n),A=w("input",o),{compactSize:S}=x4(P,x),v=jd(O=>{var _;return(_=i??S)!==null&&_!==void 0?_:O}),b=g.useRef(null),T=O=>{O!=null&&O.target&&O.type==="click"&&d&&d(O.target.value,O,{source:"clear"}),f==null||f(O)},R=O=>{var _;document.activeElement===((_=b.current)===null||_===void 0?void 0:_.input)&&O.preventDefault()},M=O=>{var _,G;d&&d((G=(_=b.current)===null||_===void 0?void 0:_.input)===null||G===void 0?void 0:G.value,O,{source:"input"})},D=O=>{C.current||c||M(O)},k=typeof l=="boolean"?g.createElement(HZ,null):null,N=`${P}-button`;let U;const W=l||{},F=W.type&&W.type.__ANT_BUTTON===!0;F||W.type==="button"?U=P0(W,Object.assign({onMouseDown:R,onClick:O=>{var _,G;(G=(_=W==null?void 0:W.props)===null||_===void 0?void 0:_.onClick)===null||G===void 0||G.call(_,O),M(O)},key:"enterButton"},F?{className:N,size:v}:{})):U=g.createElement(oo,{className:N,type:l?"primary":void 0,size:v,disabled:u,key:"enterButton",onMouseDown:R,onClick:M,loading:c,icon:k},l),s&&(U=[U,P0(s,{key:"addonAfter"})]);const E=Mn(P,{[`${P}-rtl`]:x==="rtl",[`${P}-${v}`]:!!v,[`${P}-with-button`]:!!l},r),L=Object.assign(Object.assign({},y),{className:E,prefixCls:A,type:"search"}),j=O=>{C.current=!0,p==null||p(O)},Y=O=>{C.current=!1,m==null||m(O)};return g.createElement(Tee,Object.assign({ref:e2(b,e),onPressEnter:D},L,{size:v,onCompositionStart:j,onCompositionEnd:Y,addonAfter:U,suffix:a,onChange:T,disabled:u}))});var DKt=` + `]:{color:v}})}]},sKt=t=>{const{componentCls:e,paddingBlock:n,paddingInline:o,inputAffixPadding:r,controlWidth:i,borderRadiusLG:a,borderRadiusSM:l,paddingInlineLG:s,paddingInlineSM:c,paddingBlockLG:u,paddingBlockSM:d,motionDurationMid:f}=t;return{[`${e}-affix-wrapper`]:Object.assign(Object.assign({[`input${e}-input`]:{padding:`${jt(n)} 0`}},vU(t)),{position:"relative",display:"inline-flex",alignItems:"center",width:i,padding:0,paddingInlineStart:o,"&-lg":{borderRadius:a,paddingInlineStart:s,[`input${e}-input`]:{padding:`${jt(u)} 0`}},"&-sm":{borderRadius:l,paddingInlineStart:c,[`input${e}-input`]:{padding:`${jt(d)} 0`}},[`&:not(${e}-disabled):hover`]:{zIndex:1},"&-focused, &:focus":{zIndex:1},[`&-disabled > ${e}-disabled`]:{background:"transparent"},[`> div${e}`]:{width:"100%",border:"none",outline:"none",[`&${e}-focused`]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${e}-handler-wrap`]:{zIndex:2},[e]:{position:"static",color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:r},"&-suffix":{insetBlockStart:0,insetInlineEnd:0,height:"100%",marginInlineEnd:o,marginInlineStart:r,transition:`margin ${f}`}},[`&:hover ${e}-handler-wrap, &-focused ${e}-handler-wrap`]:{width:t.handleWidth,opacity:1},[`&:not(${e}-affix-wrapper-without-controls):hover ${e}-suffix`]:{marginInlineEnd:t.calc(t.handleWidth).add(o).equal()}})}},cKt=el("InputNumber",t=>{const e=Ui(t,wU(t));return[lKt(e),sKt(e),sU(e)]},aKt,{unitless:{handleOpacity:!0}});var uKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n,direction:o}=g.useContext(gr),r=g.useRef(null);g.useImperativeHandle(e,()=>r.current);const{className:i,rootClassName:a,size:l,disabled:s,prefixCls:c,addonBefore:u,addonAfter:d,prefix:f,suffix:p,bordered:m,readOnly:y,status:w,controls:x,variant:C}=t,P=uKt(t,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","suffix","bordered","readOnly","status","controls","variant"]),A=n("input-number",c),S=nu(A),[v,b,T]=cKt(A,S),{compactSize:R,compactItemClassnames:M}=x4(A,o);let D=g.createElement(Aet,{className:`${A}-handler-up-inner`}),k=g.createElement(RZ,{className:`${A}-handler-down-inner`});const N=typeof x=="boolean"?x:void 0;typeof x=="object"&&(D=typeof x.upIcon>"u"?D:g.createElement("span",{className:`${A}-handler-up-inner`},x.upIcon),k=typeof x.downIcon>"u"?k:g.createElement("span",{className:`${A}-handler-down-inner`},x.downIcon));const{hasFeedback:U,status:W,isFormItemInput:F,feedbackIcon:E}=g.useContext(W1),L=US(W,w),j=jd(ae=>{var Z;return(Z=l??R)!==null&&Z!==void 0?Z:ae}),Y=g.useContext(Bp),O=s??Y,[_,G]=jS("inputNumber",C,m),Q=U&&g.createElement(g.Fragment,null,E),oe=Mn({[`${A}-lg`]:j==="large",[`${A}-sm`]:j==="small",[`${A}-rtl`]:o==="rtl",[`${A}-in-form-item`]:F},b),ee=`${A}-group`,$=g.createElement(iKt,Object.assign({ref:r,disabled:O,className:Mn(T,S,i,a,M),upHandler:D,downHandler:k,prefixCls:A,readOnly:y,controls:N,prefix:f,suffix:Q||p,addonBefore:u&&g.createElement(E3,{form:!0,space:!0},u),addonAfter:d&&g.createElement(E3,{form:!0,space:!0},d),classNames:{input:oe,variant:Mn({[`${A}-${_}`]:G},o7(A,L,U)),affixWrapper:Mn({[`${A}-affix-wrapper-sm`]:j==="small",[`${A}-affix-wrapper-lg`]:j==="large",[`${A}-affix-wrapper-rtl`]:o==="rtl",[`${A}-affix-wrapper-without-controls`]:x===!1},b),wrapper:Mn({[`${ee}-rtl`]:o==="rtl"},b),groupWrapper:Mn({[`${A}-group-wrapper-sm`]:j==="small",[`${A}-group-wrapper-lg`]:j==="large",[`${A}-group-wrapper-rtl`]:o==="rtl",[`${A}-group-wrapper-${_}`]:G},o7(`${A}-group-wrapper`,L,U),b)}},P));return v($)}),mn=Het,dKt=t=>g.createElement(n2,{theme:{components:{InputNumber:{handleVisible:!0}}}},g.createElement(Het,Object.assign({},t)));mn._InternalPanelDoNotUseOrYouWillBeFired=dKt;const fKt=t=>{const{getPrefixCls:e,direction:n}=g.useContext(gr),{prefixCls:o,className:r}=t,i=e("input-group",o),a=e("input"),[l,s]=J9e(a),c=Mn(i,{[`${i}-lg`]:t.size==="large",[`${i}-sm`]:t.size==="small",[`${i}-compact`]:t.compact,[`${i}-rtl`]:n==="rtl"},s,r),u=g.useContext(W1),d=g.useMemo(()=>Object.assign(Object.assign({},u),{isFormItemInput:!1}),[u]);return l(g.createElement("span",{className:c,style:t.style,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onFocus:t.onFocus,onBlur:t.onBlur},g.createElement(W1.Provider,{value:d},t.children)))},Met=t=>{let e;return typeof t=="object"&&(t!=null&&t.clearIcon)?e=t:t&&(e={clearIcon:xe.createElement(uZ,null)}),e};function Iet(t,e){const n=g.useRef([]),o=()=>{n.current.push(setTimeout(()=>{var r,i,a,l;!((r=t.current)===null||r===void 0)&&r.input&&((i=t.current)===null||i===void 0?void 0:i.input.getAttribute("type"))==="password"&&(!((a=t.current)===null||a===void 0)&&a.input.hasAttribute("value"))&&((l=t.current)===null||l===void 0||l.input.removeAttribute("value"))}))};return g.useEffect(()=>(e&&o(),()=>n.current.forEach(r=>{r&&clearTimeout(r)})),[]),o}function hKt(t){return!!(t.prefix||t.suffix||t.allowClear||t.showCount)}var pKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r=!0,status:i,size:a,disabled:l,onBlur:s,onFocus:c,suffix:u,allowClear:d,addonAfter:f,addonBefore:p,className:m,style:y,styles:w,rootClassName:x,onChange:C,classNames:P,variant:A}=t,S=pKt(t,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames","variant"]),{getPrefixCls:v,direction:b,input:T}=xe.useContext(gr),R=v("input",o),M=g.useRef(null),D=nu(R),[k,N,U]=J9e(R,D),{compactSize:W,compactItemClassnames:F}=x4(R,b),E=jd(le=>{var de;return(de=a??W)!==null&&de!==void 0?de:le}),L=xe.useContext(Bp),j=l??L,{status:Y,hasFeedback:O,feedbackIcon:_}=g.useContext(W1),G=US(Y,i),Q=hKt(t)||!!O;g.useRef(Q);const oe=Iet(M,!0),ee=le=>{oe(),s==null||s(le)},$=le=>{oe(),c==null||c(le)},ae=le=>{oe(),C==null||C(le)},Z=(O||u)&&xe.createElement(xe.Fragment,null,u,O&&_),ne=Met(d??(T==null?void 0:T.allowClear)),[te,q]=jS("input",A,r);return k(xe.createElement(WJt,Object.assign({ref:e2(e,M),prefixCls:R,autoComplete:T==null?void 0:T.autoComplete},S,{disabled:j,onBlur:ee,onFocus:$,style:Object.assign(Object.assign({},T==null?void 0:T.style),y),styles:Object.assign(Object.assign({},T==null?void 0:T.styles),w),suffix:Z,allowClear:ne,className:Mn(m,x,U,D,F,T==null?void 0:T.className),onChange:ae,addonBefore:p&&xe.createElement(E3,{form:!0,space:!0},p),addonAfter:f&&xe.createElement(E3,{form:!0,space:!0},f),classNames:Object.assign(Object.assign(Object.assign({},P),T==null?void 0:T.classNames),{input:Mn({[`${R}-sm`]:E==="small",[`${R}-lg`]:E==="large",[`${R}-rtl`]:b==="rtl"},P==null?void 0:P.input,(n=T==null?void 0:T.classNames)===null||n===void 0?void 0:n.input,N),variant:Mn({[`${R}-${te}`]:q},o7(R,G)),affixWrapper:Mn({[`${R}-affix-wrapper-sm`]:E==="small",[`${R}-affix-wrapper-lg`]:E==="large",[`${R}-affix-wrapper-rtl`]:b==="rtl"},N),wrapper:Mn({[`${R}-group-rtl`]:b==="rtl"},N),groupWrapper:Mn({[`${R}-group-wrapper-sm`]:E==="small",[`${R}-group-wrapper-lg`]:E==="large",[`${R}-group-wrapper-rtl`]:b==="rtl",[`${R}-group-wrapper-${te}`]:q},o7(`${R}-group-wrapper`,G,O),N)})})))}),gKt=t=>{const{componentCls:e,paddingXS:n}=t;return{[e]:{display:"inline-flex",alignItems:"center",flexWrap:"nowrap",columnGap:n,"&-rtl":{direction:"rtl"},[`${e}-input`]:{textAlign:"center",paddingInline:t.paddingXXS},[`&${e}-sm ${e}-input`]:{paddingInline:t.calc(t.paddingXXS).div(2).equal()},[`&${e}-lg ${e}-input`]:{paddingInline:t.paddingXS}}}},mKt=el(["Input","OTP"],t=>{const e=Ui(t,wU(t));return[gKt(e)]},xU);var yKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{value:n,onChange:o,onActiveChange:r,index:i,mask:a}=t,l=yKt(t,["value","onChange","onActiveChange","index","mask"]),s=n&&typeof a=="string"?a:n,c=m=>{o(i,m.target.value)},u=g.useRef(null);g.useImperativeHandle(e,()=>u.current);const d=()=>{Hf(()=>{var m;const y=(m=u.current)===null||m===void 0?void 0:m.input;document.activeElement===y&&y&&y.select()})},f=m=>{const{key:y,ctrlKey:w,metaKey:x}=m;y==="ArrowLeft"?r(i-1):y==="ArrowRight"?r(i+1):y==="z"&&(w||x)&&m.preventDefault(),d()},p=m=>{m.key==="Backspace"&&!n&&r(i-1),d()};return g.createElement(Tee,Object.assign({type:a===!0?"password":"text"},l,{ref:u,value:s,onInput:c,onFocus:d,onKeyDown:f,onKeyUp:p,onMouseDown:d,onMouseUp:d}))});var wKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,length:o=6,size:r,defaultValue:i,value:a,onChange:l,formatter:s,variant:c,disabled:u,status:d,autoFocus:f,mask:p,type:m,onInput:y,inputMode:w}=t,x=wKt(t,["prefixCls","length","size","defaultValue","value","onChange","formatter","variant","disabled","status","autoFocus","mask","type","onInput","inputMode"]),{getPrefixCls:C,direction:P}=g.useContext(gr),A=C("otp",n),S=$5e(x,{aria:!0,data:!0,attr:!0}),v=nu(A),[b,T,R]=mKt(A,v),M=jd(Q=>r??Q),D=g.useContext(W1),k=US(D.status,d),N=g.useMemo(()=>Object.assign(Object.assign({},D),{status:k,hasFeedback:!1,feedbackIcon:null}),[D,k]),U=g.useRef(null),W=g.useRef({});g.useImperativeHandle(e,()=>({focus:()=>{var Q;(Q=W.current[0])===null||Q===void 0||Q.focus()},blur:()=>{var Q;for(let oe=0;oes?s(Q):Q,[E,L]=g.useState(QO(F(i||"")));g.useEffect(()=>{a!==void 0&&L(QO(a))},[a]);const j=kd(Q=>{L(Q),y&&y(Q),l&&Q.length===o&&Q.every(oe=>oe)&&Q.some((oe,ee)=>E[ee]!==oe)&&l(Q.join(""))}),Y=kd((Q,oe)=>{let ee=Pa(E);for(let ae=0;ae=0&&!ee[ae];ae-=1)ee.pop();const $=F(ee.map(ae=>ae||" ").join(""));return ee=QO($).map((ae,Z)=>ae===" "&&!ee[Z]?ee[Z]:ae),ee}),O=(Q,oe)=>{var ee;const $=Y(Q,oe),ae=Math.min(Q+oe.length,o-1);ae!==Q&&$[Q]!==void 0&&((ee=W.current[ae])===null||ee===void 0||ee.focus()),j($)},_=Q=>{var oe;(oe=W.current[Q])===null||oe===void 0||oe.focus()},G={variant:c,disabled:u,status:k,mask:p,type:m,inputMode:w};return b(g.createElement("div",Object.assign({},S,{ref:U,className:Mn(A,{[`${A}-sm`]:M==="small",[`${A}-lg`]:M==="large",[`${A}-rtl`]:P==="rtl"},R,T)}),g.createElement(W1.Provider,{value:N},Array.from({length:o}).map((Q,oe)=>{const ee=`otp-${oe}`,$=E[oe]||"";return g.createElement(AKt,Object.assign({ref:ae=>{W.current[oe]=ae},key:ee,index:oe,size:M,htmlSize:1,className:`${A}-input`,onChange:O,value:$,onActiveChange:_,autoFocus:oe===0&&f},G))}))))});var vKt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},bKt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:vKt}))},SKt=g.forwardRef(bKt),TKt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},PKt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:TKt}))},zet=g.forwardRef(PKt),CKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rt?g.createElement(zet,null):g.createElement(SKt,null),HKt={click:"onClick",hover:"onMouseOver"},MKt=g.forwardRef((t,e)=>{const{disabled:n,action:o="click",visibilityToggle:r=!0,iconRender:i=RKt}=t,a=g.useContext(Bp),l=n??a,s=typeof r=="object"&&r.visible!==void 0,[c,u]=g.useState(()=>s?r.visible:!1),d=g.useRef(null);g.useEffect(()=>{s&&u(r.visible)},[s,r]);const f=Iet(d),p=()=>{var M;if(l)return;c&&f();const D=!c;u(D),typeof r=="object"&&((M=r.onVisibleChange)===null||M===void 0||M.call(r,D))},m=M=>{const D=HKt[o]||"",k=i(c),N={[D]:p,className:`${M}-icon`,key:"passwordIcon",onMouseDown:U=>{U.preventDefault()},onMouseUp:U=>{U.preventDefault()}};return g.cloneElement(g.isValidElement(k)?k:g.createElement("span",null,k),N)},{className:y,prefixCls:w,inputPrefixCls:x,size:C}=t,P=CKt(t,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:A}=g.useContext(gr),S=A("input",x),v=A("input-password",w),b=r&&m(v),T=Mn(v,y,{[`${v}-${C}`]:!!C}),R=Object.assign(Object.assign({},Mf(P,["suffix","iconRender","visibilityToggle"])),{type:c?"text":"password",className:T,prefixCls:S,suffix:b});return C&&(R.size=C),g.createElement(Tee,Object.assign({ref:e2(e,d)},R))});var IKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,inputPrefixCls:o,className:r,size:i,suffix:a,enterButton:l=!1,addonAfter:s,loading:c,disabled:u,onSearch:d,onChange:f,onCompositionStart:p,onCompositionEnd:m}=t,y=IKt(t,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd"]),{getPrefixCls:w,direction:x}=g.useContext(gr),C=g.useRef(!1),P=w("input-search",n),A=w("input",o),{compactSize:S}=x4(P,x),v=jd(O=>{var _;return(_=i??S)!==null&&_!==void 0?_:O}),b=g.useRef(null),T=O=>{O!=null&&O.target&&O.type==="click"&&d&&d(O.target.value,O,{source:"clear"}),f==null||f(O)},R=O=>{var _;document.activeElement===((_=b.current)===null||_===void 0?void 0:_.input)&&O.preventDefault()},M=O=>{var _,G;d&&d((G=(_=b.current)===null||_===void 0?void 0:_.input)===null||G===void 0?void 0:G.value,O,{source:"input"})},D=O=>{C.current||c||M(O)},k=typeof l=="boolean"?g.createElement(HZ,null):null,N=`${P}-button`;let U;const W=l||{},F=W.type&&W.type.__ANT_BUTTON===!0;F||W.type==="button"?U=P0(W,Object.assign({onMouseDown:R,onClick:O=>{var _,G;(G=(_=W==null?void 0:W.props)===null||_===void 0?void 0:_.onClick)===null||G===void 0||G.call(_,O),M(O)},key:"enterButton"},F?{className:N,size:v}:{})):U=g.createElement(oo,{className:N,type:l?"primary":void 0,size:v,disabled:u,key:"enterButton",onMouseDown:R,onClick:M,loading:c,icon:k},l),s&&(U=[U,P0(s,{key:"addonAfter"})]);const E=Mn(P,{[`${P}-rtl`]:x==="rtl",[`${P}-${v}`]:!!v,[`${P}-with-button`]:!!l},r),L=Object.assign(Object.assign({},y),{className:E,prefixCls:A,type:"search"}),j=O=>{C.current=!0,p==null||p(O)},Y=O=>{C.current=!1,m==null||m(O)};return g.createElement(Tee,Object.assign({ref:e2(b,e),onPressEnter:D},L,{size:v,onCompositionStart:j,onCompositionEnd:Y,addonAfter:U,suffix:a,onChange:T,disabled:u}))});var DKt=` min-height:0 !important; max-height:none !important; height:0 !important; @@ -4697,7 +4697,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho top:0 !important; right:0 !important; pointer-events: none !important; -`,EKt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],tse={},Pg;function kKt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=t.getAttribute("id")||t.getAttribute("data-reactid")||t.getAttribute("name");if(e&&tse[n])return tse[n];var o=window.getComputedStyle(t),r=o.getPropertyValue("box-sizing")||o.getPropertyValue("-moz-box-sizing")||o.getPropertyValue("-webkit-box-sizing"),i=parseFloat(o.getPropertyValue("padding-bottom"))+parseFloat(o.getPropertyValue("padding-top")),a=parseFloat(o.getPropertyValue("border-bottom-width"))+parseFloat(o.getPropertyValue("border-top-width")),l=EKt.map(function(c){return"".concat(c,":").concat(o.getPropertyValue(c))}).join(";"),s={sizingStyle:l,paddingSize:i,borderSize:a,boxSizing:r};return e&&n&&(tse[n]=s),s}function FKt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;Pg||(Pg=document.createElement("textarea"),Pg.setAttribute("tab-index","-1"),Pg.setAttribute("aria-hidden","true"),Pg.setAttribute("name","hiddenTextarea"),document.body.appendChild(Pg)),t.getAttribute("wrap")?Pg.setAttribute("wrap",t.getAttribute("wrap")):Pg.removeAttribute("wrap");var r=kKt(t,e),i=r.paddingSize,a=r.borderSize,l=r.boxSizing,s=r.sizingStyle;Pg.setAttribute("style","".concat(s,";").concat(DKt)),Pg.value=t.value||t.placeholder||"";var c=void 0,u=void 0,d,f=Pg.scrollHeight;if(l==="border-box"?f+=a:l==="content-box"&&(f-=i),n!==null||o!==null){Pg.value=" ";var p=Pg.scrollHeight-i;n!==null&&(c=p*n,l==="border-box"&&(c=c+i+a),f=Math.max(c,f)),o!==null&&(u=p*o,l==="border-box"&&(u=u+i+a),d=f>u?"":"hidden",f=Math.min(u,f))}var m={height:f,overflowY:d,resize:"none"};return c&&(m.minHeight=c),u&&(m.maxHeight=u),m}var LKt=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],nse=0,ose=1,rse=2,WKt=g.forwardRef(function(t,e){var n=t,o=n.prefixCls,r=n.defaultValue,i=n.value,a=n.autoSize,l=n.onResize,s=n.className,c=n.style,u=n.disabled,d=n.onChange;n.onInternalAutoSize;var f=Ai(n,LKt),p=o0(r,{value:i,postState:function(Q){return Q??""}}),m=Sn(p,2),y=m[0],w=m[1],x=function(Q){w(Q.target.value),d==null||d(Q)},C=g.useRef();g.useImperativeHandle(e,function(){return{textArea:C.current}});var P=g.useMemo(function(){return a&&Vr(a)==="object"?[a.minRows,a.maxRows]:[]},[a]),A=Sn(P,2),S=A[0],v=A[1],b=!!a,T=function(){try{if(document.activeElement===C.current){var Q=C.current,oe=Q.selectionStart,ee=Q.selectionEnd,q=Q.scrollTop;C.current.setSelectionRange(oe,ee),C.current.scrollTop=q}}catch{}},R=g.useState(rse),M=Sn(R,2),D=M[0],k=M[1],N=g.useState(),U=Sn(N,2),W=U[0],F=U[1],E=function(){k(nse)};Ml(function(){b&&E()},[i,S,v,b]),Ml(function(){if(D===nse)k(ose);else if(D===ose){var G=FKt(C.current,!1,S,v);k(rse),F(G)}else T()},[D]);var L=g.useRef(),j=function(){Ic.cancel(L.current)},Y=function(Q){D===rse&&(l==null||l(Q),a&&(j(),L.current=Ic(function(){E()})))};g.useEffect(function(){return j},[]);var O=b?W:null,_=nn(nn({},c),O);return(D===nse||D===ose)&&(_.overflowY="hidden",_.overflowX="hidden"),g.createElement(Ld,{onResize:Y,disabled:!(a||l)},g.createElement("textarea",Uo({},f,{ref:C,style:_,className:Bn(o,s,Ut({},"".concat(o,"-disabled"),u)),disabled:u,value:y,onChange:x})))}),NKt=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],UKt=xe.forwardRef(function(t,e){var n,o=t.defaultValue,r=t.value,i=t.onFocus,a=t.onBlur,l=t.onChange,s=t.allowClear,c=t.maxLength,u=t.onCompositionStart,d=t.onCompositionEnd,f=t.suffix,p=t.prefixCls,m=p===void 0?"rc-textarea":p,y=t.showCount,w=t.count,x=t.className,C=t.style,P=t.disabled,A=t.hidden,S=t.classNames,v=t.styles,b=t.onResize,T=t.onClear,R=t.onPressEnter,M=t.readOnly,D=t.autoSize,k=t.onKeyDown,N=Ai(t,NKt),U=o0(o,{value:r,defaultValue:o}),W=Sn(U,2),F=W[0],E=W[1],L=F==null?"":String(F),j=xe.useState(!1),Y=Sn(j,2),O=Y[0],_=Y[1],G=xe.useRef(!1),Q=xe.useState(null),oe=Sn(Q,2),ee=oe[0],q=oe[1],ae=g.useRef(null),Z=g.useRef(null),ne=function(){var Ue;return(Ue=Z.current)===null||Ue===void 0?void 0:Ue.textArea},te=function(){ne().focus()};g.useImperativeHandle(e,function(){var _e;return{resizableTextArea:Z.current,focus:te,blur:function(){ne().blur()},nativeElement:((_e=ae.current)===null||_e===void 0?void 0:_e.nativeElement)||ne()}}),g.useEffect(function(){_(function(_e){return!P&&_e})},[P]);var $=xe.useState(null),le=Sn($,2),de=le[0],he=le[1];xe.useEffect(function(){if(de){var _e;(_e=ne()).setSelectionRange.apply(_e,$o(de))}},[de]);var me=xet(w,y),ce=(n=me.max)!==null&&n!==void 0?n:c,Pe=Number(ce)>0,pe=me.strategy(L),Ie=!!ce&&pe>ce,ve=function(Ue,qe){var Fe=qe;!G.current&&me.exceedFormatter&&me.max&&me.strategy(qe)>me.max&&(Fe=me.exceedFormatter(qe,{max:me.max}),qe!==Fe&&he([ne().selectionStart||0,ne().selectionEnd||0])),E(Fe),gJ(Ue.currentTarget,Ue,l,Fe)},ze=function(Ue){G.current=!0,u==null||u(Ue)},Ae=function(Ue){G.current=!1,ve(Ue,Ue.currentTarget.value),d==null||d(Ue)},se=function(Ue){ve(Ue,Ue.target.value)},ge=function(Ue){Ue.key==="Enter"&&R&&R(Ue),k==null||k(Ue)},we=function(Ue){_(!0),i==null||i(Ue)},Se=function(Ue){_(!1),a==null||a(Ue)},Me=function(Ue){E(""),te(),gJ(ne(),Ue,l)},Ce=f,Te;me.show&&(me.showFormatter?Te=me.showFormatter({value:L,count:pe,maxLength:ce}):Te="".concat(pe).concat(Pe?" / ".concat(ce):""),Ce=xe.createElement(xe.Fragment,null,Ce,xe.createElement("span",{className:Bn("".concat(m,"-data-count"),S==null?void 0:S.count),style:v==null?void 0:v.count},Te)));var Re=function(Ue){var qe;b==null||b(Ue),(qe=ne())!==null&&qe!==void 0&&qe.style.height&&q(!0)},Ne=!D&&!y&&!s;return xe.createElement(e3e,{ref:ae,value:L,allowClear:s,handleReset:Me,suffix:Ce,prefixCls:m,classNames:nn(nn({},S),{},{affixWrapper:Bn(S==null?void 0:S.affixWrapper,Ut(Ut({},"".concat(m,"-show-count"),y),"".concat(m,"-textarea-allow-clear"),s))}),disabled:P,focused:O,className:Bn(x,Ie&&"".concat(m,"-out-of-range")),style:nn(nn({},C),ee&&!Ne?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof Te=="string"?Te:void 0}},hidden:A,readOnly:M,onClear:T},xe.createElement(WKt,Uo({},N,{autoSize:D,maxLength:c,onKeyDown:ge,onChange:se,onFocus:we,onBlur:Se,onCompositionStart:ze,onCompositionEnd:Ae,className:Bn(S==null?void 0:S.textarea),style:nn(nn({},v==null?void 0:v.textarea),{},{resize:C==null?void 0:C.resize}),disabled:P,prefixCls:m,onResize:Re,ref:Z,readOnly:M})))}),jKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const{prefixCls:r,bordered:i=!0,size:a,disabled:l,status:s,allowClear:c,classNames:u,rootClassName:d,className:f,style:p,styles:m,variant:y}=t,w=jKt(t,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant"]),{getPrefixCls:x,direction:C,textArea:P}=g.useContext(gr),A=g.useContext(Bp),S=l??A,{status:v,hasFeedback:b,feedbackIcon:T}=g.useContext(W1),R=US(v,s),M=g.useRef(null);g.useImperativeHandle(e,()=>{var _;return{resizableTextArea:(_=M.current)===null||_===void 0?void 0:_.resizableTextArea,focus:G=>{var Q,oe;Z9e((oe=(Q=M.current)===null||Q===void 0?void 0:Q.resizableTextArea)===null||oe===void 0?void 0:oe.textArea,G)},blur:()=>{var G;return(G=M.current)===null||G===void 0?void 0:G.blur()}}});const D=x("input",r),k=nu(D),[N,U,W]=J9e(D,k),{compactSize:F,compactItemClassnames:E}=x4(D,C),L=jd(_=>{var G;return(G=a??F)!==null&&G!==void 0?G:_}),[j,Y]=jS("textArea",y,i),O=Met(c??(P==null?void 0:P.allowClear));return N(g.createElement(UKt,Object.assign({autoComplete:P==null?void 0:P.autoComplete},w,{style:Object.assign(Object.assign({},P==null?void 0:P.style),p),styles:Object.assign(Object.assign({},P==null?void 0:P.styles),m),disabled:S,allowClear:O,className:Mn(W,k,f,d,E,P==null?void 0:P.className),classNames:Object.assign(Object.assign(Object.assign({},u),P==null?void 0:P.classNames),{textarea:Mn({[`${D}-sm`]:L==="small",[`${D}-lg`]:L==="large"},U,u==null?void 0:u.textarea,(n=P==null?void 0:P.classNames)===null||n===void 0?void 0:n.textarea),variant:Mn({[`${D}-${j}`]:Y},o7(D,R)),affixWrapper:Mn(`${D}-textarea-affix-wrapper`,{[`${D}-affix-wrapper-rtl`]:C==="rtl",[`${D}-affix-wrapper-sm`]:L==="small",[`${D}-affix-wrapper-lg`]:L==="large",[`${D}-textarea-show-count`]:t.showCount||((o=t.count)===null||o===void 0?void 0:o.show)},U)}),prefixCls:D,suffix:b&&g.createElement("span",{className:`${D}-textarea-suffix`},T),ref:M})))}),Vl=Tee;Vl.Group=fKt;Vl.Search=zKt;Vl.TextArea=Det;Vl.Password=MKt;Vl.OTP=xKt;function Whe(t,e,n){return(t-e)/(n-e)}function r3e(t,e,n,o){var r=Whe(e,n,o),i={};switch(t){case"rtl":i.right="".concat(r*100,"%"),i.transform="translateX(50%)";break;case"btt":i.bottom="".concat(r*100,"%"),i.transform="translateY(50%)";break;case"ttb":i.top="".concat(r*100,"%"),i.transform="translateY(-50%)";break;default:i.left="".concat(r*100,"%"),i.transform="translateX(-50%)";break}return i}function bv(t,e){return Array.isArray(t)?t[e]:t}var OS=g.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),BKt=g.createContext({}),YKt=["prefixCls","value","valueIndex","onStartMove","onDelete","style","render","dragging","draggingDelete","onOffsetChange","onChangeComplete","onFocus","onMouseEnter"],tCe=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.value,r=t.valueIndex,i=t.onStartMove,a=t.onDelete,l=t.style,s=t.render,c=t.dragging,u=t.draggingDelete,d=t.onOffsetChange,f=t.onChangeComplete,p=t.onFocus,m=t.onMouseEnter,y=Ai(t,YKt),w=g.useContext(OS),x=w.min,C=w.max,P=w.direction,A=w.disabled,S=w.keyboard,v=w.range,b=w.tabIndex,T=w.ariaLabelForHandle,R=w.ariaLabelledByForHandle,M=w.ariaRequired,D=w.ariaValueTextFormatterForHandle,k=w.styles,N=w.classNames,U="".concat(n,"-handle"),W=function(oe){A||i(oe,r)},F=function(oe){p==null||p(oe,r)},E=function(oe){m(oe,r)},L=function(oe){if(!A&&S){var ee=null;switch(oe.which||oe.keyCode){case Lo.LEFT:ee=P==="ltr"||P==="btt"?-1:1;break;case Lo.RIGHT:ee=P==="ltr"||P==="btt"?1:-1;break;case Lo.UP:ee=P!=="ttb"?1:-1;break;case Lo.DOWN:ee=P!=="ttb"?-1:1;break;case Lo.HOME:ee="min";break;case Lo.END:ee="max";break;case Lo.PAGE_UP:ee=2;break;case Lo.PAGE_DOWN:ee=-2;break;case Lo.BACKSPACE:case Lo.DELETE:a(r);break}ee!==null&&(oe.preventDefault(),d(ee,r))}},j=function(oe){switch(oe.which||oe.keyCode){case Lo.LEFT:case Lo.RIGHT:case Lo.UP:case Lo.DOWN:case Lo.HOME:case Lo.END:case Lo.PAGE_UP:case Lo.PAGE_DOWN:f==null||f();break}},Y=r3e(P,o,x,C),O={};if(r!==null){var _;O={tabIndex:A?null:bv(b,r),role:"slider","aria-valuemin":x,"aria-valuemax":C,"aria-valuenow":o,"aria-disabled":A,"aria-label":bv(T,r),"aria-labelledby":bv(R,r),"aria-required":bv(M,r),"aria-valuetext":(_=bv(D,r))===null||_===void 0?void 0:_(o),"aria-orientation":P==="ltr"||P==="rtl"?"horizontal":"vertical",onMouseDown:W,onTouchStart:W,onFocus:F,onMouseEnter:E,onKeyDown:L,onKeyUp:j}}var G=g.createElement("div",Uo({ref:e,className:Bn(U,Ut(Ut(Ut({},"".concat(U,"-").concat(r+1),r!==null&&v),"".concat(U,"-dragging"),c),"".concat(U,"-dragging-delete"),u),N.handle),style:nn(nn(nn({},Y),l),k.handle)},O,y));return s&&(G=s(G,{index:r,prefixCls:n,value:o,dragging:c,draggingDelete:u})),G}),OKt=["prefixCls","style","onStartMove","onOffsetChange","values","handleRender","activeHandleRender","draggingIndex","draggingDelete","onFocus"],_Kt=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.onStartMove,i=t.onOffsetChange,a=t.values,l=t.handleRender,s=t.activeHandleRender,c=t.draggingIndex,u=t.draggingDelete,d=t.onFocus,f=Ai(t,OKt),p=g.useRef({}),m=g.useState(!1),y=Sn(m,2),w=y[0],x=y[1],C=g.useState(-1),P=Sn(C,2),A=P[0],S=P[1],v=function(D){S(D),x(!0)},b=function(D,k){v(k),d==null||d(D)},T=function(D,k){v(k)};g.useImperativeHandle(e,function(){return{focus:function(D){var k;(k=p.current[D])===null||k===void 0||k.focus()},hideHelp:function(){r0.flushSync(function(){x(!1)})}}});var R=nn({prefixCls:n,onStartMove:r,onOffsetChange:i,render:l,onFocus:b,onMouseEnter:T},f);return g.createElement(g.Fragment,null,a.map(function(M,D){var k=c===D;return g.createElement(tCe,Uo({ref:function(U){U?p.current[D]=U:delete p.current[D]},dragging:k,draggingDelete:k&&u,style:bv(o,D),key:D,value:M,valueIndex:D},R))}),s&&w&&g.createElement(tCe,Uo({key:"a11y"},R,{value:a[A],valueIndex:null,dragging:c!==-1,draggingDelete:u,render:s,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))}),VKt=function(e){var n=e.prefixCls,o=e.style,r=e.children,i=e.value,a=e.onClick,l=g.useContext(OS),s=l.min,c=l.max,u=l.direction,d=l.includedStart,f=l.includedEnd,p=l.included,m="".concat(n,"-text"),y=r3e(u,i,s,c);return g.createElement("span",{className:Bn(m,Ut({},"".concat(m,"-active"),p&&d<=i&&i<=f)),style:nn(nn({},y),o),onMouseDown:function(x){x.stopPropagation()},onClick:function(){a(i)}},r)},GKt=function(e){var n=e.prefixCls,o=e.marks,r=e.onClick,i="".concat(n,"-mark");return o.length?g.createElement("div",{className:i},o.map(function(a){var l=a.value,s=a.style,c=a.label;return g.createElement(VKt,{key:l,prefixCls:i,style:s,value:l,onClick:r},c)})):null},XKt=function(e){var n=e.prefixCls,o=e.value,r=e.style,i=e.activeStyle,a=g.useContext(OS),l=a.min,s=a.max,c=a.direction,u=a.included,d=a.includedStart,f=a.includedEnd,p="".concat(n,"-dot"),m=u&&d<=o&&o<=f,y=nn(nn({},r3e(c,o,l,s)),typeof r=="function"?r(o):r);return m&&(y=nn(nn({},y),typeof i=="function"?i(o):i)),g.createElement("span",{className:Bn(p,Ut({},"".concat(p,"-active"),m)),style:y})},JKt=function(e){var n=e.prefixCls,o=e.marks,r=e.dots,i=e.style,a=e.activeStyle,l=g.useContext(OS),s=l.min,c=l.max,u=l.step,d=g.useMemo(function(){var f=new Set;if(o.forEach(function(m){f.add(m.value)}),r&&u!==null)for(var p=s;p<=c;)f.add(p),p+=u;return Array.from(f)},[s,c,u,r,o]);return g.createElement("div",{className:"".concat(n,"-step")},d.map(function(f){return g.createElement(XKt,{prefixCls:n,key:f,value:f,style:i,activeStyle:a})}))},nCe=function(e){var n=e.prefixCls,o=e.style,r=e.start,i=e.end,a=e.index,l=e.onStartMove,s=e.replaceCls,c=g.useContext(OS),u=c.direction,d=c.min,f=c.max,p=c.disabled,m=c.range,y=c.classNames,w="".concat(n,"-track"),x=Whe(r,d,f),C=Whe(i,d,f),P=function(b){!p&&l&&l(b,-1)},A={};switch(u){case"rtl":A.right="".concat(x*100,"%"),A.width="".concat(C*100-x*100,"%");break;case"btt":A.bottom="".concat(x*100,"%"),A.height="".concat(C*100-x*100,"%");break;case"ttb":A.top="".concat(x*100,"%"),A.height="".concat(C*100-x*100,"%");break;default:A.left="".concat(x*100,"%"),A.width="".concat(C*100-x*100,"%")}var S=s||Bn(w,Ut(Ut({},"".concat(w,"-").concat(a+1),a!==null&&m),"".concat(n,"-track-draggable"),l),y.track);return g.createElement("div",{className:S,style:nn(nn({},A),o),onMouseDown:P,onTouchStart:P})},KKt=function(e){var n=e.prefixCls,o=e.style,r=e.values,i=e.startPoint,a=e.onStartMove,l=g.useContext(OS),s=l.included,c=l.range,u=l.min,d=l.styles,f=l.classNames,p=g.useMemo(function(){if(!c){if(r.length===0)return[];var y=i??u,w=r[0];return[{start:Math.min(y,w),end:Math.max(y,w)}]}for(var x=[],C=0;C$Kt&&u3&&arguments[3]!==void 0?arguments[3]:"unit";if(typeof y=="number"){var C,P=m[w],A=P+y,S=[];o.forEach(function(M){S.push(M.value)}),S.push(t,e),S.push(l(P));var v=y>0?1:-1;x==="unit"?S.push(l(P+v*n)):S.push(l(A)),S=S.filter(function(M){return M!==null}).filter(function(M){return y<0?M<=P:M>=P}),x==="unit"&&(S=S.filter(function(M){return M!==P}));var b=x==="unit"?P:A;C=S[0];var T=Math.abs(C-b);if(S.forEach(function(M){var D=Math.abs(M-b);D1){var R=$o(m);return R[w]=C,p(R,y-v,w,x)}return C}else{if(y==="min")return t;if(y==="max")return e}},u=function(m,y,w){var x=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unit",C=m[w],P=c(m,y,w,x);return{value:P,changed:P!==C}},d=function(m){return i===null&&m===0||typeof i=="number"&&m3&&arguments[3]!==void 0?arguments[3]:"unit",C=m.map(s),P=C[w],A=c(C,y,w,x);if(C[w]=A,r===!1){var S=i||0;w>0&&C[w-1]!==P&&(C[w]=Math.max(C[w],C[w-1]+S)),w0;R-=1)for(var M=!0;d(C[R]-C[R-1])&&M;){var D=u(C,-1,R-1);C[R-1]=D.value,M=D.changed}for(var k=C.length-1;k>0;k-=1)for(var N=!0;d(C[k]-C[k-1])&&N;){var U=u(C,-1,k-1);C[k-1]=U.value,N=U.changed}for(var W=0;W=0?E:!1},[E,Re]),_e=g.useMemo(function(){return Object.keys(ae||{}).map(function(ct){var Xe=ae[ct],ft={value:Number(ct)};return Xe&&Vr(Xe)==="object"&&!g.isValidElement(Xe)&&("label"in Xe||"style"in Xe)?(ft.style=Xe.style,ft.label=Xe.label):ft.label=Xe,ft}).filter(function(ct){var Xe=ct.label;return Xe||typeof Xe=="number"}).sort(function(ct,Xe){return ct.value-Xe.value})},[ae]),Ue=QKt(Ce,Te,Re,_e,W,Ne),qe=Sn(Ue,2),Fe=qe[0],He=qe[1],Le=o0(b,{value:v}),Ye=Sn(Le,2),lt=Ye[0],Oe=Ye[1],ut=g.useMemo(function(){var ct=lt==null?[]:Array.isArray(lt)?lt:[lt],Xe=Sn(ct,1),ft=Xe[0],wt=ft===void 0?Ce:ft,kt=lt===null?[]:[wt];if(se){if(kt=$o(ct),R||lt===void 0){var Zt=R>=0?R+1:2;for(kt=kt.slice(0,Zt);kt.length=0&&pe.current.focus(ct)}yt(null)},[Ct]);var Et=g.useMemo(function(){return we&&Re===null?!1:we},[we,Re]),Lt=Dd(function(ct,Xe){St(ct,Xe),D==null||D(ht(ut))}),Je=Ve!==-1;g.useEffect(function(){if(!Je){var ct=ut.lastIndexOf(je);pe.current.focus(ct)}},[Je]);var st=g.useMemo(function(){return $o(bt).sort(function(ct,Xe){return ct-Xe})},[bt]),It=g.useMemo(function(){return se?[st[0],st[st.length-1]]:[Ce,st[0]]},[st,se,Ce]),ot=Sn(It,2),it=ot[0],Be=ot[1];g.useImperativeHandle(e,function(){return{focus:function(){pe.current.focus(0)},blur:function(){var Xe,ft=document,wt=ft.activeElement;(Xe=Ie.current)!==null&&Xe!==void 0&&Xe.contains(wt)&&(wt==null||wt.blur())}}}),g.useEffect(function(){p&&pe.current.focus(0)},[]);var pt=g.useMemo(function(){return{min:Ce,max:Te,direction:ve,disabled:u,keyboard:f,step:Re,included:O,includedStart:it,includedEnd:Be,range:se,tabIndex:de,ariaLabelForHandle:he,ariaLabelledByForHandle:me,ariaRequired:ce,ariaValueTextFormatterForHandle:Pe,styles:l||{},classNames:a||{}}},[Ce,Te,ve,u,f,Re,O,it,Be,se,de,he,me,ce,Pe,l,a]);return g.createElement(OS.Provider,{value:pt},g.createElement("div",{ref:Ie,className:Bn(o,r,Ut(Ut(Ut(Ut({},"".concat(o,"-disabled"),u),"".concat(o,"-vertical"),j),"".concat(o,"-horizontal"),!j),"".concat(o,"-with-marks"),_e.length)),style:i,onMouseDown:Yt,id:s},g.createElement("div",{className:Bn("".concat(o,"-rail"),a==null?void 0:a.rail),style:nn(nn({},oe),l==null?void 0:l.rail)}),$!==!1&&g.createElement(KKt,{prefixCls:o,style:G,values:ut,startPoint:_,onStartMove:Et?Lt:void 0}),g.createElement(JKt,{prefixCls:o,marks:_e,dots:Z,style:ee,activeStyle:q}),g.createElement(_Kt,{ref:pe,prefixCls:o,style:Q,values:bt,draggingIndex:Ve,draggingDelete:et,onStartMove:Lt,onOffsetChange:at,onFocus:m,onBlur:y,handleRender:ne,activeHandleRender:te,onChangeComplete:nt,onDelete:ge?mt:void 0}),g.createElement(GKt,{prefixCls:o,marks:_e,onClick:Pt})))});const t$t=g.createContext({}),rCe=g.forwardRef((t,e)=>{const{open:n,draggingDelete:o}=t,r=g.useRef(null),i=n&&!o,a=g.useRef(null);function l(){Hf.cancel(a.current),a.current=null}function s(){a.current=Hf(()=>{var c;(c=r.current)===null||c===void 0||c.forceAlign(),a.current=null})}return g.useEffect(()=>(i?s():l(),l),[i,t.title]),g.createElement(k3,Object.assign({ref:e2(r,e)},t,{open:i}))}),n$t=t=>{const{componentCls:e,antCls:n,controlSize:o,dotSize:r,marginFull:i,marginPart:a,colorFillContentHover:l,handleColorDisabled:s,calc:c,handleSize:u,handleSizeHover:d,handleActiveColor:f,handleActiveOutlineColor:p,handleLineWidth:m,handleLineWidthHover:y,motionDurationMid:w}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative",height:o,margin:`${jt(a)} ${jt(i)}`,padding:0,cursor:"pointer",touchAction:"none","&-vertical":{margin:`${jt(i)} ${jt(a)}`},[`${e}-rail`]:{position:"absolute",backgroundColor:t.railBg,borderRadius:t.borderRadiusXS,transition:`background-color ${w}`},[`${e}-track,${e}-tracks`]:{position:"absolute",transition:`background-color ${w}`},[`${e}-track`]:{backgroundColor:t.trackBg,borderRadius:t.borderRadiusXS},[`${e}-track-draggable`]:{boxSizing:"content-box",backgroundClip:"content-box",border:"solid rgba(0,0,0,0)"},"&:hover":{[`${e}-rail`]:{backgroundColor:t.railHoverBg},[`${e}-track`]:{backgroundColor:t.trackHoverBg},[`${e}-dot`]:{borderColor:l},[`${e}-handle::after`]:{boxShadow:`0 0 0 ${jt(m)} ${t.colorPrimaryBorderHover}`},[`${e}-dot-active`]:{borderColor:t.dotActiveBorderColor}},[`${e}-handle`]:{position:"absolute",width:u,height:u,outline:"none",userSelect:"none","&-dragging-delete":{opacity:0},"&::before":{content:'""',position:"absolute",insetInlineStart:c(m).mul(-1).equal(),insetBlockStart:c(m).mul(-1).equal(),width:c(u).add(c(m).mul(2)).equal(),height:c(u).add(c(m).mul(2)).equal(),backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:u,height:u,backgroundColor:t.colorBgElevated,boxShadow:`0 0 0 ${jt(m)} ${t.handleColor}`,outline:"0px solid transparent",borderRadius:"50%",cursor:"pointer",transition:` +`,EKt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],tse={},Pg;function kKt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=t.getAttribute("id")||t.getAttribute("data-reactid")||t.getAttribute("name");if(e&&tse[n])return tse[n];var o=window.getComputedStyle(t),r=o.getPropertyValue("box-sizing")||o.getPropertyValue("-moz-box-sizing")||o.getPropertyValue("-webkit-box-sizing"),i=parseFloat(o.getPropertyValue("padding-bottom"))+parseFloat(o.getPropertyValue("padding-top")),a=parseFloat(o.getPropertyValue("border-bottom-width"))+parseFloat(o.getPropertyValue("border-top-width")),l=EKt.map(function(c){return"".concat(c,":").concat(o.getPropertyValue(c))}).join(";"),s={sizingStyle:l,paddingSize:i,borderSize:a,boxSizing:r};return e&&n&&(tse[n]=s),s}function FKt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;Pg||(Pg=document.createElement("textarea"),Pg.setAttribute("tab-index","-1"),Pg.setAttribute("aria-hidden","true"),Pg.setAttribute("name","hiddenTextarea"),document.body.appendChild(Pg)),t.getAttribute("wrap")?Pg.setAttribute("wrap",t.getAttribute("wrap")):Pg.removeAttribute("wrap");var r=kKt(t,e),i=r.paddingSize,a=r.borderSize,l=r.boxSizing,s=r.sizingStyle;Pg.setAttribute("style","".concat(s,";").concat(DKt)),Pg.value=t.value||t.placeholder||"";var c=void 0,u=void 0,d,f=Pg.scrollHeight;if(l==="border-box"?f+=a:l==="content-box"&&(f-=i),n!==null||o!==null){Pg.value=" ";var p=Pg.scrollHeight-i;n!==null&&(c=p*n,l==="border-box"&&(c=c+i+a),f=Math.max(c,f)),o!==null&&(u=p*o,l==="border-box"&&(u=u+i+a),d=f>u?"":"hidden",f=Math.min(u,f))}var m={height:f,overflowY:d,resize:"none"};return c&&(m.minHeight=c),u&&(m.maxHeight=u),m}var LKt=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],nse=0,ose=1,rse=2,WKt=g.forwardRef(function(t,e){var n=t,o=n.prefixCls,r=n.defaultValue,i=n.value,a=n.autoSize,l=n.onResize,s=n.className,c=n.style,u=n.disabled,d=n.onChange;n.onInternalAutoSize;var f=Ai(n,LKt),p=o0(r,{value:i,postState:function(Q){return Q??""}}),m=Sn(p,2),y=m[0],w=m[1],x=function(Q){w(Q.target.value),d==null||d(Q)},C=g.useRef();g.useImperativeHandle(e,function(){return{textArea:C.current}});var P=g.useMemo(function(){return a&&Vr(a)==="object"?[a.minRows,a.maxRows]:[]},[a]),A=Sn(P,2),S=A[0],v=A[1],b=!!a,T=function(){try{if(document.activeElement===C.current){var Q=C.current,oe=Q.selectionStart,ee=Q.selectionEnd,$=Q.scrollTop;C.current.setSelectionRange(oe,ee),C.current.scrollTop=$}}catch{}},R=g.useState(rse),M=Sn(R,2),D=M[0],k=M[1],N=g.useState(),U=Sn(N,2),W=U[0],F=U[1],E=function(){k(nse)};Ml(function(){b&&E()},[i,S,v,b]),Ml(function(){if(D===nse)k(ose);else if(D===ose){var G=FKt(C.current,!1,S,v);k(rse),F(G)}else T()},[D]);var L=g.useRef(),j=function(){Ic.cancel(L.current)},Y=function(Q){D===rse&&(l==null||l(Q),a&&(j(),L.current=Ic(function(){E()})))};g.useEffect(function(){return j},[]);var O=b?W:null,_=nn(nn({},c),O);return(D===nse||D===ose)&&(_.overflowY="hidden",_.overflowX="hidden"),g.createElement(Ld,{onResize:Y,disabled:!(a||l)},g.createElement("textarea",Uo({},f,{ref:C,style:_,className:Bn(o,s,Ut({},"".concat(o,"-disabled"),u)),disabled:u,value:y,onChange:x})))}),NKt=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],UKt=xe.forwardRef(function(t,e){var n,o=t.defaultValue,r=t.value,i=t.onFocus,a=t.onBlur,l=t.onChange,s=t.allowClear,c=t.maxLength,u=t.onCompositionStart,d=t.onCompositionEnd,f=t.suffix,p=t.prefixCls,m=p===void 0?"rc-textarea":p,y=t.showCount,w=t.count,x=t.className,C=t.style,P=t.disabled,A=t.hidden,S=t.classNames,v=t.styles,b=t.onResize,T=t.onClear,R=t.onPressEnter,M=t.readOnly,D=t.autoSize,k=t.onKeyDown,N=Ai(t,NKt),U=o0(o,{value:r,defaultValue:o}),W=Sn(U,2),F=W[0],E=W[1],L=F==null?"":String(F),j=xe.useState(!1),Y=Sn(j,2),O=Y[0],_=Y[1],G=xe.useRef(!1),Q=xe.useState(null),oe=Sn(Q,2),ee=oe[0],$=oe[1],ae=g.useRef(null),Z=g.useRef(null),ne=function(){var Ue;return(Ue=Z.current)===null||Ue===void 0?void 0:Ue.textArea},te=function(){ne().focus()};g.useImperativeHandle(e,function(){var _e;return{resizableTextArea:Z.current,focus:te,blur:function(){ne().blur()},nativeElement:((_e=ae.current)===null||_e===void 0?void 0:_e.nativeElement)||ne()}}),g.useEffect(function(){_(function(_e){return!P&&_e})},[P]);var q=xe.useState(null),le=Sn(q,2),de=le[0],he=le[1];xe.useEffect(function(){if(de){var _e;(_e=ne()).setSelectionRange.apply(_e,$o(de))}},[de]);var me=xet(w,y),ce=(n=me.max)!==null&&n!==void 0?n:c,Pe=Number(ce)>0,pe=me.strategy(L),Ie=!!ce&&pe>ce,ve=function(Ue,qe){var Fe=qe;!G.current&&me.exceedFormatter&&me.max&&me.strategy(qe)>me.max&&(Fe=me.exceedFormatter(qe,{max:me.max}),qe!==Fe&&he([ne().selectionStart||0,ne().selectionEnd||0])),E(Fe),gJ(Ue.currentTarget,Ue,l,Fe)},ze=function(Ue){G.current=!0,u==null||u(Ue)},Ae=function(Ue){G.current=!1,ve(Ue,Ue.currentTarget.value),d==null||d(Ue)},se=function(Ue){ve(Ue,Ue.target.value)},ge=function(Ue){Ue.key==="Enter"&&R&&R(Ue),k==null||k(Ue)},we=function(Ue){_(!0),i==null||i(Ue)},Se=function(Ue){_(!1),a==null||a(Ue)},Me=function(Ue){E(""),te(),gJ(ne(),Ue,l)},Ce=f,Te;me.show&&(me.showFormatter?Te=me.showFormatter({value:L,count:pe,maxLength:ce}):Te="".concat(pe).concat(Pe?" / ".concat(ce):""),Ce=xe.createElement(xe.Fragment,null,Ce,xe.createElement("span",{className:Bn("".concat(m,"-data-count"),S==null?void 0:S.count),style:v==null?void 0:v.count},Te)));var Re=function(Ue){var qe;b==null||b(Ue),(qe=ne())!==null&&qe!==void 0&&qe.style.height&&$(!0)},Ne=!D&&!y&&!s;return xe.createElement(e3e,{ref:ae,value:L,allowClear:s,handleReset:Me,suffix:Ce,prefixCls:m,classNames:nn(nn({},S),{},{affixWrapper:Bn(S==null?void 0:S.affixWrapper,Ut(Ut({},"".concat(m,"-show-count"),y),"".concat(m,"-textarea-allow-clear"),s))}),disabled:P,focused:O,className:Bn(x,Ie&&"".concat(m,"-out-of-range")),style:nn(nn({},C),ee&&!Ne?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof Te=="string"?Te:void 0}},hidden:A,readOnly:M,onClear:T},xe.createElement(WKt,Uo({},N,{autoSize:D,maxLength:c,onKeyDown:ge,onChange:se,onFocus:we,onBlur:Se,onCompositionStart:ze,onCompositionEnd:Ae,className:Bn(S==null?void 0:S.textarea),style:nn(nn({},v==null?void 0:v.textarea),{},{resize:C==null?void 0:C.resize}),disabled:P,prefixCls:m,onResize:Re,ref:Z,readOnly:M})))}),jKt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const{prefixCls:r,bordered:i=!0,size:a,disabled:l,status:s,allowClear:c,classNames:u,rootClassName:d,className:f,style:p,styles:m,variant:y}=t,w=jKt(t,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant"]),{getPrefixCls:x,direction:C,textArea:P}=g.useContext(gr),A=g.useContext(Bp),S=l??A,{status:v,hasFeedback:b,feedbackIcon:T}=g.useContext(W1),R=US(v,s),M=g.useRef(null);g.useImperativeHandle(e,()=>{var _;return{resizableTextArea:(_=M.current)===null||_===void 0?void 0:_.resizableTextArea,focus:G=>{var Q,oe;Z9e((oe=(Q=M.current)===null||Q===void 0?void 0:Q.resizableTextArea)===null||oe===void 0?void 0:oe.textArea,G)},blur:()=>{var G;return(G=M.current)===null||G===void 0?void 0:G.blur()}}});const D=x("input",r),k=nu(D),[N,U,W]=J9e(D,k),{compactSize:F,compactItemClassnames:E}=x4(D,C),L=jd(_=>{var G;return(G=a??F)!==null&&G!==void 0?G:_}),[j,Y]=jS("textArea",y,i),O=Met(c??(P==null?void 0:P.allowClear));return N(g.createElement(UKt,Object.assign({autoComplete:P==null?void 0:P.autoComplete},w,{style:Object.assign(Object.assign({},P==null?void 0:P.style),p),styles:Object.assign(Object.assign({},P==null?void 0:P.styles),m),disabled:S,allowClear:O,className:Mn(W,k,f,d,E,P==null?void 0:P.className),classNames:Object.assign(Object.assign(Object.assign({},u),P==null?void 0:P.classNames),{textarea:Mn({[`${D}-sm`]:L==="small",[`${D}-lg`]:L==="large"},U,u==null?void 0:u.textarea,(n=P==null?void 0:P.classNames)===null||n===void 0?void 0:n.textarea),variant:Mn({[`${D}-${j}`]:Y},o7(D,R)),affixWrapper:Mn(`${D}-textarea-affix-wrapper`,{[`${D}-affix-wrapper-rtl`]:C==="rtl",[`${D}-affix-wrapper-sm`]:L==="small",[`${D}-affix-wrapper-lg`]:L==="large",[`${D}-textarea-show-count`]:t.showCount||((o=t.count)===null||o===void 0?void 0:o.show)},U)}),prefixCls:D,suffix:b&&g.createElement("span",{className:`${D}-textarea-suffix`},T),ref:M})))}),Vl=Tee;Vl.Group=fKt;Vl.Search=zKt;Vl.TextArea=Det;Vl.Password=MKt;Vl.OTP=xKt;function Whe(t,e,n){return(t-e)/(n-e)}function r3e(t,e,n,o){var r=Whe(e,n,o),i={};switch(t){case"rtl":i.right="".concat(r*100,"%"),i.transform="translateX(50%)";break;case"btt":i.bottom="".concat(r*100,"%"),i.transform="translateY(50%)";break;case"ttb":i.top="".concat(r*100,"%"),i.transform="translateY(-50%)";break;default:i.left="".concat(r*100,"%"),i.transform="translateX(-50%)";break}return i}function bv(t,e){return Array.isArray(t)?t[e]:t}var OS=g.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),BKt=g.createContext({}),YKt=["prefixCls","value","valueIndex","onStartMove","onDelete","style","render","dragging","draggingDelete","onOffsetChange","onChangeComplete","onFocus","onMouseEnter"],tCe=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.value,r=t.valueIndex,i=t.onStartMove,a=t.onDelete,l=t.style,s=t.render,c=t.dragging,u=t.draggingDelete,d=t.onOffsetChange,f=t.onChangeComplete,p=t.onFocus,m=t.onMouseEnter,y=Ai(t,YKt),w=g.useContext(OS),x=w.min,C=w.max,P=w.direction,A=w.disabled,S=w.keyboard,v=w.range,b=w.tabIndex,T=w.ariaLabelForHandle,R=w.ariaLabelledByForHandle,M=w.ariaRequired,D=w.ariaValueTextFormatterForHandle,k=w.styles,N=w.classNames,U="".concat(n,"-handle"),W=function(oe){A||i(oe,r)},F=function(oe){p==null||p(oe,r)},E=function(oe){m(oe,r)},L=function(oe){if(!A&&S){var ee=null;switch(oe.which||oe.keyCode){case Lo.LEFT:ee=P==="ltr"||P==="btt"?-1:1;break;case Lo.RIGHT:ee=P==="ltr"||P==="btt"?1:-1;break;case Lo.UP:ee=P!=="ttb"?1:-1;break;case Lo.DOWN:ee=P!=="ttb"?-1:1;break;case Lo.HOME:ee="min";break;case Lo.END:ee="max";break;case Lo.PAGE_UP:ee=2;break;case Lo.PAGE_DOWN:ee=-2;break;case Lo.BACKSPACE:case Lo.DELETE:a(r);break}ee!==null&&(oe.preventDefault(),d(ee,r))}},j=function(oe){switch(oe.which||oe.keyCode){case Lo.LEFT:case Lo.RIGHT:case Lo.UP:case Lo.DOWN:case Lo.HOME:case Lo.END:case Lo.PAGE_UP:case Lo.PAGE_DOWN:f==null||f();break}},Y=r3e(P,o,x,C),O={};if(r!==null){var _;O={tabIndex:A?null:bv(b,r),role:"slider","aria-valuemin":x,"aria-valuemax":C,"aria-valuenow":o,"aria-disabled":A,"aria-label":bv(T,r),"aria-labelledby":bv(R,r),"aria-required":bv(M,r),"aria-valuetext":(_=bv(D,r))===null||_===void 0?void 0:_(o),"aria-orientation":P==="ltr"||P==="rtl"?"horizontal":"vertical",onMouseDown:W,onTouchStart:W,onFocus:F,onMouseEnter:E,onKeyDown:L,onKeyUp:j}}var G=g.createElement("div",Uo({ref:e,className:Bn(U,Ut(Ut(Ut({},"".concat(U,"-").concat(r+1),r!==null&&v),"".concat(U,"-dragging"),c),"".concat(U,"-dragging-delete"),u),N.handle),style:nn(nn(nn({},Y),l),k.handle)},O,y));return s&&(G=s(G,{index:r,prefixCls:n,value:o,dragging:c,draggingDelete:u})),G}),OKt=["prefixCls","style","onStartMove","onOffsetChange","values","handleRender","activeHandleRender","draggingIndex","draggingDelete","onFocus"],_Kt=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.onStartMove,i=t.onOffsetChange,a=t.values,l=t.handleRender,s=t.activeHandleRender,c=t.draggingIndex,u=t.draggingDelete,d=t.onFocus,f=Ai(t,OKt),p=g.useRef({}),m=g.useState(!1),y=Sn(m,2),w=y[0],x=y[1],C=g.useState(-1),P=Sn(C,2),A=P[0],S=P[1],v=function(D){S(D),x(!0)},b=function(D,k){v(k),d==null||d(D)},T=function(D,k){v(k)};g.useImperativeHandle(e,function(){return{focus:function(D){var k;(k=p.current[D])===null||k===void 0||k.focus()},hideHelp:function(){r0.flushSync(function(){x(!1)})}}});var R=nn({prefixCls:n,onStartMove:r,onOffsetChange:i,render:l,onFocus:b,onMouseEnter:T},f);return g.createElement(g.Fragment,null,a.map(function(M,D){var k=c===D;return g.createElement(tCe,Uo({ref:function(U){U?p.current[D]=U:delete p.current[D]},dragging:k,draggingDelete:k&&u,style:bv(o,D),key:D,value:M,valueIndex:D},R))}),s&&w&&g.createElement(tCe,Uo({key:"a11y"},R,{value:a[A],valueIndex:null,dragging:c!==-1,draggingDelete:u,render:s,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))}),VKt=function(e){var n=e.prefixCls,o=e.style,r=e.children,i=e.value,a=e.onClick,l=g.useContext(OS),s=l.min,c=l.max,u=l.direction,d=l.includedStart,f=l.includedEnd,p=l.included,m="".concat(n,"-text"),y=r3e(u,i,s,c);return g.createElement("span",{className:Bn(m,Ut({},"".concat(m,"-active"),p&&d<=i&&i<=f)),style:nn(nn({},y),o),onMouseDown:function(x){x.stopPropagation()},onClick:function(){a(i)}},r)},GKt=function(e){var n=e.prefixCls,o=e.marks,r=e.onClick,i="".concat(n,"-mark");return o.length?g.createElement("div",{className:i},o.map(function(a){var l=a.value,s=a.style,c=a.label;return g.createElement(VKt,{key:l,prefixCls:i,style:s,value:l,onClick:r},c)})):null},XKt=function(e){var n=e.prefixCls,o=e.value,r=e.style,i=e.activeStyle,a=g.useContext(OS),l=a.min,s=a.max,c=a.direction,u=a.included,d=a.includedStart,f=a.includedEnd,p="".concat(n,"-dot"),m=u&&d<=o&&o<=f,y=nn(nn({},r3e(c,o,l,s)),typeof r=="function"?r(o):r);return m&&(y=nn(nn({},y),typeof i=="function"?i(o):i)),g.createElement("span",{className:Bn(p,Ut({},"".concat(p,"-active"),m)),style:y})},JKt=function(e){var n=e.prefixCls,o=e.marks,r=e.dots,i=e.style,a=e.activeStyle,l=g.useContext(OS),s=l.min,c=l.max,u=l.step,d=g.useMemo(function(){var f=new Set;if(o.forEach(function(m){f.add(m.value)}),r&&u!==null)for(var p=s;p<=c;)f.add(p),p+=u;return Array.from(f)},[s,c,u,r,o]);return g.createElement("div",{className:"".concat(n,"-step")},d.map(function(f){return g.createElement(XKt,{prefixCls:n,key:f,value:f,style:i,activeStyle:a})}))},nCe=function(e){var n=e.prefixCls,o=e.style,r=e.start,i=e.end,a=e.index,l=e.onStartMove,s=e.replaceCls,c=g.useContext(OS),u=c.direction,d=c.min,f=c.max,p=c.disabled,m=c.range,y=c.classNames,w="".concat(n,"-track"),x=Whe(r,d,f),C=Whe(i,d,f),P=function(b){!p&&l&&l(b,-1)},A={};switch(u){case"rtl":A.right="".concat(x*100,"%"),A.width="".concat(C*100-x*100,"%");break;case"btt":A.bottom="".concat(x*100,"%"),A.height="".concat(C*100-x*100,"%");break;case"ttb":A.top="".concat(x*100,"%"),A.height="".concat(C*100-x*100,"%");break;default:A.left="".concat(x*100,"%"),A.width="".concat(C*100-x*100,"%")}var S=s||Bn(w,Ut(Ut({},"".concat(w,"-").concat(a+1),a!==null&&m),"".concat(n,"-track-draggable"),l),y.track);return g.createElement("div",{className:S,style:nn(nn({},A),o),onMouseDown:P,onTouchStart:P})},KKt=function(e){var n=e.prefixCls,o=e.style,r=e.values,i=e.startPoint,a=e.onStartMove,l=g.useContext(OS),s=l.included,c=l.range,u=l.min,d=l.styles,f=l.classNames,p=g.useMemo(function(){if(!c){if(r.length===0)return[];var y=i??u,w=r[0];return[{start:Math.min(y,w),end:Math.max(y,w)}]}for(var x=[],C=0;C$Kt&&u3&&arguments[3]!==void 0?arguments[3]:"unit";if(typeof y=="number"){var C,P=m[w],A=P+y,S=[];o.forEach(function(M){S.push(M.value)}),S.push(t,e),S.push(l(P));var v=y>0?1:-1;x==="unit"?S.push(l(P+v*n)):S.push(l(A)),S=S.filter(function(M){return M!==null}).filter(function(M){return y<0?M<=P:M>=P}),x==="unit"&&(S=S.filter(function(M){return M!==P}));var b=x==="unit"?P:A;C=S[0];var T=Math.abs(C-b);if(S.forEach(function(M){var D=Math.abs(M-b);D1){var R=$o(m);return R[w]=C,p(R,y-v,w,x)}return C}else{if(y==="min")return t;if(y==="max")return e}},u=function(m,y,w){var x=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unit",C=m[w],P=c(m,y,w,x);return{value:P,changed:P!==C}},d=function(m){return i===null&&m===0||typeof i=="number"&&m3&&arguments[3]!==void 0?arguments[3]:"unit",C=m.map(s),P=C[w],A=c(C,y,w,x);if(C[w]=A,r===!1){var S=i||0;w>0&&C[w-1]!==P&&(C[w]=Math.max(C[w],C[w-1]+S)),w0;R-=1)for(var M=!0;d(C[R]-C[R-1])&&M;){var D=u(C,-1,R-1);C[R-1]=D.value,M=D.changed}for(var k=C.length-1;k>0;k-=1)for(var N=!0;d(C[k]-C[k-1])&&N;){var U=u(C,-1,k-1);C[k-1]=U.value,N=U.changed}for(var W=0;W=0?E:!1},[E,Re]),_e=g.useMemo(function(){return Object.keys(ae||{}).map(function(ct){var Xe=ae[ct],ft={value:Number(ct)};return Xe&&Vr(Xe)==="object"&&!g.isValidElement(Xe)&&("label"in Xe||"style"in Xe)?(ft.style=Xe.style,ft.label=Xe.label):ft.label=Xe,ft}).filter(function(ct){var Xe=ct.label;return Xe||typeof Xe=="number"}).sort(function(ct,Xe){return ct.value-Xe.value})},[ae]),Ue=QKt(Ce,Te,Re,_e,W,Ne),qe=Sn(Ue,2),Fe=qe[0],He=qe[1],Le=o0(b,{value:v}),Ye=Sn(Le,2),lt=Ye[0],Oe=Ye[1],ut=g.useMemo(function(){var ct=lt==null?[]:Array.isArray(lt)?lt:[lt],Xe=Sn(ct,1),ft=Xe[0],wt=ft===void 0?Ce:ft,kt=lt===null?[]:[wt];if(se){if(kt=$o(ct),R||lt===void 0){var Zt=R>=0?R+1:2;for(kt=kt.slice(0,Zt);kt.length=0&&pe.current.focus(ct)}yt(null)},[Ct]);var Et=g.useMemo(function(){return we&&Re===null?!1:we},[we,Re]),Lt=Dd(function(ct,Xe){St(ct,Xe),D==null||D(ht(ut))}),Je=Ve!==-1;g.useEffect(function(){if(!Je){var ct=ut.lastIndexOf(je);pe.current.focus(ct)}},[Je]);var st=g.useMemo(function(){return $o(bt).sort(function(ct,Xe){return ct-Xe})},[bt]),It=g.useMemo(function(){return se?[st[0],st[st.length-1]]:[Ce,st[0]]},[st,se,Ce]),ot=Sn(It,2),it=ot[0],Be=ot[1];g.useImperativeHandle(e,function(){return{focus:function(){pe.current.focus(0)},blur:function(){var Xe,ft=document,wt=ft.activeElement;(Xe=Ie.current)!==null&&Xe!==void 0&&Xe.contains(wt)&&(wt==null||wt.blur())}}}),g.useEffect(function(){p&&pe.current.focus(0)},[]);var pt=g.useMemo(function(){return{min:Ce,max:Te,direction:ve,disabled:u,keyboard:f,step:Re,included:O,includedStart:it,includedEnd:Be,range:se,tabIndex:de,ariaLabelForHandle:he,ariaLabelledByForHandle:me,ariaRequired:ce,ariaValueTextFormatterForHandle:Pe,styles:l||{},classNames:a||{}}},[Ce,Te,ve,u,f,Re,O,it,Be,se,de,he,me,ce,Pe,l,a]);return g.createElement(OS.Provider,{value:pt},g.createElement("div",{ref:Ie,className:Bn(o,r,Ut(Ut(Ut(Ut({},"".concat(o,"-disabled"),u),"".concat(o,"-vertical"),j),"".concat(o,"-horizontal"),!j),"".concat(o,"-with-marks"),_e.length)),style:i,onMouseDown:Yt,id:s},g.createElement("div",{className:Bn("".concat(o,"-rail"),a==null?void 0:a.rail),style:nn(nn({},oe),l==null?void 0:l.rail)}),q!==!1&&g.createElement(KKt,{prefixCls:o,style:G,values:ut,startPoint:_,onStartMove:Et?Lt:void 0}),g.createElement(JKt,{prefixCls:o,marks:_e,dots:Z,style:ee,activeStyle:$}),g.createElement(_Kt,{ref:pe,prefixCls:o,style:Q,values:bt,draggingIndex:Ve,draggingDelete:et,onStartMove:Lt,onOffsetChange:at,onFocus:m,onBlur:y,handleRender:ne,activeHandleRender:te,onChangeComplete:nt,onDelete:ge?mt:void 0}),g.createElement(GKt,{prefixCls:o,marks:_e,onClick:Pt})))});const t$t=g.createContext({}),rCe=g.forwardRef((t,e)=>{const{open:n,draggingDelete:o}=t,r=g.useRef(null),i=n&&!o,a=g.useRef(null);function l(){Hf.cancel(a.current),a.current=null}function s(){a.current=Hf(()=>{var c;(c=r.current)===null||c===void 0||c.forceAlign(),a.current=null})}return g.useEffect(()=>(i?s():l(),l),[i,t.title]),g.createElement(k3,Object.assign({ref:e2(r,e)},t,{open:i}))}),n$t=t=>{const{componentCls:e,antCls:n,controlSize:o,dotSize:r,marginFull:i,marginPart:a,colorFillContentHover:l,handleColorDisabled:s,calc:c,handleSize:u,handleSizeHover:d,handleActiveColor:f,handleActiveOutlineColor:p,handleLineWidth:m,handleLineWidthHover:y,motionDurationMid:w}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative",height:o,margin:`${jt(a)} ${jt(i)}`,padding:0,cursor:"pointer",touchAction:"none","&-vertical":{margin:`${jt(i)} ${jt(a)}`},[`${e}-rail`]:{position:"absolute",backgroundColor:t.railBg,borderRadius:t.borderRadiusXS,transition:`background-color ${w}`},[`${e}-track,${e}-tracks`]:{position:"absolute",transition:`background-color ${w}`},[`${e}-track`]:{backgroundColor:t.trackBg,borderRadius:t.borderRadiusXS},[`${e}-track-draggable`]:{boxSizing:"content-box",backgroundClip:"content-box",border:"solid rgba(0,0,0,0)"},"&:hover":{[`${e}-rail`]:{backgroundColor:t.railHoverBg},[`${e}-track`]:{backgroundColor:t.trackHoverBg},[`${e}-dot`]:{borderColor:l},[`${e}-handle::after`]:{boxShadow:`0 0 0 ${jt(m)} ${t.colorPrimaryBorderHover}`},[`${e}-dot-active`]:{borderColor:t.dotActiveBorderColor}},[`${e}-handle`]:{position:"absolute",width:u,height:u,outline:"none",userSelect:"none","&-dragging-delete":{opacity:0},"&::before":{content:'""',position:"absolute",insetInlineStart:c(m).mul(-1).equal(),insetBlockStart:c(m).mul(-1).equal(),width:c(u).add(c(m).mul(2)).equal(),height:c(u).add(c(m).mul(2)).equal(),backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:u,height:u,backgroundColor:t.colorBgElevated,boxShadow:`0 0 0 ${jt(m)} ${t.handleColor}`,outline:"0px solid transparent",borderRadius:"50%",cursor:"pointer",transition:` inset-inline-start ${w}, inset-block-start ${w}, width ${w}, @@ -4709,10 +4709,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `]:{backgroundColor:t.colorBgElevated,borderColor:t.trackBgDisabled,boxShadow:"none",cursor:"not-allowed"},[`${e}-handle::after`]:{backgroundColor:t.colorBgElevated,cursor:"not-allowed",width:u,height:u,boxShadow:`0 0 0 ${jt(m)} ${s}`,insetInlineStart:0,insetBlockStart:0},[` ${e}-mark-text, ${e}-dot - `]:{cursor:"not-allowed !important"}},[`&-tooltip ${n}-tooltip-inner`]:{minWidth:"unset"}})}},Eet=(t,e)=>{const{componentCls:n,railSize:o,handleSize:r,dotSize:i,marginFull:a,calc:l}=t,s=e?"paddingBlock":"paddingInline",c=e?"width":"height",u=e?"height":"width",d=e?"insetBlockStart":"insetInlineStart",f=e?"top":"insetInlineStart",p=l(o).mul(3).sub(r).div(2).equal(),m=l(r).sub(o).div(2).equal(),y=e?{borderWidth:`${jt(m)} 0`,transform:`translateY(${jt(l(m).mul(-1).equal())})`}:{borderWidth:`0 ${jt(m)}`,transform:`translateX(${jt(t.calc(m).mul(-1).equal())})`};return{[s]:o,[u]:l(o).mul(3).equal(),[`${n}-rail`]:{[c]:"100%",[u]:o},[`${n}-track,${n}-tracks`]:{[u]:o},[`${n}-track-draggable`]:Object.assign({},y),[`${n}-handle`]:{[d]:p},[`${n}-mark`]:{insetInlineStart:0,top:0,[f]:l(o).mul(3).add(e?0:a).equal(),[c]:"100%"},[`${n}-step`]:{insetInlineStart:0,top:0,[f]:o,[c]:"100%",[u]:o},[`${n}-dot`]:{position:"absolute",[d]:l(o).sub(i).div(2).equal()}}},o$t=t=>{const{componentCls:e,marginPartWithMark:n}=t;return{[`${e}-horizontal`]:Object.assign(Object.assign({},Eet(t,!0)),{[`&${e}-with-marks`]:{marginBottom:n}})}},r$t=t=>{const{componentCls:e}=t;return{[`${e}-vertical`]:Object.assign(Object.assign({},Eet(t,!1)),{height:"100%"})}},i$t=t=>{const n=t.controlHeightLG/4,o=t.controlHeightSM/2,r=t.lineWidth+1,i=t.lineWidth+1*1.5,a=t.colorPrimary,l=new Di(a).setA(.2).toRgbString();return{controlSize:n,railSize:4,handleSize:n,handleSizeHover:o,dotSize:8,handleLineWidth:r,handleLineWidthHover:i,railBg:t.colorFillTertiary,railHoverBg:t.colorFillSecondary,trackBg:t.colorPrimaryBorder,trackHoverBg:t.colorPrimaryBorderHover,handleColor:t.colorPrimaryBorder,handleActiveColor:a,handleActiveOutlineColor:l,handleColorDisabled:new Di(t.colorTextDisabled).onBackground(t.colorBgContainer).toHexString(),dotBorderColor:t.colorBorderSecondary,dotActiveBorderColor:t.colorPrimaryBorder,trackBgDisabled:t.colorBgContainerDisabled}},a$t=el("Slider",t=>{const e=Ui(t,{marginPart:t.calc(t.controlHeight).sub(t.controlSize).div(2).equal(),marginFull:t.calc(t.controlSize).div(2).equal(),marginPartWithMark:t.calc(t.controlHeightLG).sub(t.controlSize).equal()});return[n$t(e),o$t(e),r$t(e)]},i$t);function ise(){const[t,e]=g.useState(!1),n=g.useRef(null),o=()=>{Hf.cancel(n.current)},r=i=>{o(),i?e(i):n.current=Hf(()=>{e(i)})};return g.useEffect(()=>o,[]),[t,r]}var l$t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rtypeof n=="number"?n.toString():""}const B0=xe.forwardRef((t,e)=>{var n,o,r,i,a,l,s,c,u,d;const{prefixCls:f,range:p,className:m,rootClassName:y,style:w,disabled:x,tooltipPrefixCls:C,tipFormatter:P,tooltipVisible:A,getTooltipPopupContainer:S,tooltipPlacement:v,tooltip:b={},onChangeComplete:T,classNames:R,styles:M}=t,D=l$t(t,["prefixCls","range","className","rootClassName","style","disabled","tooltipPrefixCls","tipFormatter","tooltipVisible","getTooltipPopupContainer","tooltipPlacement","tooltip","onChangeComplete","classNames","styles"]),{vertical:k}=t,{direction:N,slider:U,getPrefixCls:W,getPopupContainer:F}=xe.useContext(gr),E=xe.useContext(Bp),L=x??E,{handleRender:j,direction:Y}=xe.useContext(t$t),_=(Y||N)==="rtl",[G,Q]=ise(),[oe,ee]=ise(),q=Object.assign({},b),{open:ae,placement:Z,getPopupContainer:ne,prefixCls:te,formatter:$}=q,le=ae??A,de=(G||oe)&&le!==!1,he=s$t($,P),[me,ce]=ise(),Pe=Re=>{T==null||T(Re),ce(!1)},pe=(Re,Ne)=>Re||(Ne?_?"left":"right":"top"),Ie=W("slider",f),[ve,ze,Ae]=a$t(Ie),se=Mn(m,U==null?void 0:U.className,(n=U==null?void 0:U.classNames)===null||n===void 0?void 0:n.root,R==null?void 0:R.root,y,{[`${Ie}-rtl`]:_,[`${Ie}-lock`]:me},ze,Ae);_&&!D.vertical&&(D.reverse=!D.reverse),xe.useEffect(()=>{const Re=()=>{Hf(()=>{ee(!1)},1)};return document.addEventListener("mouseup",Re),()=>{document.removeEventListener("mouseup",Re)}},[]);const ge=p&&!le,we=j||((Re,Ne)=>{const{index:_e}=Ne,Ue=Re.props;function qe(Ye,lt,Oe){var ut,ht,Qe,nt;Oe&&((ht=(ut=D)[Ye])===null||ht===void 0||ht.call(ut,lt)),(nt=(Qe=Ue)[Ye])===null||nt===void 0||nt.call(Qe,lt)}const Fe=Object.assign(Object.assign({},Ue),{onMouseEnter:Ye=>{Q(!0),qe("onMouseEnter",Ye)},onMouseLeave:Ye=>{Q(!1),qe("onMouseLeave",Ye)},onMouseDown:Ye=>{ee(!0),ce(!0),qe("onMouseDown",Ye)},onFocus:Ye=>{var lt;ee(!0),(lt=D.onFocus)===null||lt===void 0||lt.call(D,Ye),qe("onFocus",Ye,!0)},onBlur:Ye=>{var lt;ee(!1),(lt=D.onBlur)===null||lt===void 0||lt.call(D,Ye),qe("onBlur",Ye,!0)}}),He=xe.cloneElement(Re,Fe),Le=(!!le||de)&&he!==null;return ge?He:xe.createElement(rCe,Object.assign({},q,{prefixCls:W("tooltip",te??C),title:he?he(Ne.value):"",open:Le,placement:pe(Z??v,k),key:_e,classNames:{root:`${Ie}-tooltip`},getPopupContainer:ne||S||F}),He)}),Se=ge?(Re,Ne)=>{const _e=xe.cloneElement(Re,{style:Object.assign(Object.assign({},Re.props.style),{visibility:"hidden"})});return xe.createElement(rCe,Object.assign({},q,{prefixCls:W("tooltip",te??C),title:he?he(Ne.value):"",open:he!==null&&de,placement:pe(Z??v,k),key:"tooltip",classNames:{root:`${Ie}-tooltip`},getPopupContainer:ne||S||F,draggingDelete:Ne.draggingDelete}),_e)}:void 0,Me=Object.assign(Object.assign(Object.assign(Object.assign({},(o=U==null?void 0:U.styles)===null||o===void 0?void 0:o.root),U==null?void 0:U.style),M==null?void 0:M.root),w),Ce=Object.assign(Object.assign({},(r=U==null?void 0:U.styles)===null||r===void 0?void 0:r.tracks),M==null?void 0:M.tracks),Te=Mn((i=U==null?void 0:U.classNames)===null||i===void 0?void 0:i.tracks,R==null?void 0:R.tracks);return ve(xe.createElement(e$t,Object.assign({},D,{classNames:Object.assign({handle:Mn((a=U==null?void 0:U.classNames)===null||a===void 0?void 0:a.handle,R==null?void 0:R.handle),rail:Mn((l=U==null?void 0:U.classNames)===null||l===void 0?void 0:l.rail,R==null?void 0:R.rail),track:Mn((s=U==null?void 0:U.classNames)===null||s===void 0?void 0:s.track,R==null?void 0:R.track)},Te?{tracks:Te}:{}),styles:Object.assign({handle:Object.assign(Object.assign({},(c=U==null?void 0:U.styles)===null||c===void 0?void 0:c.handle),M==null?void 0:M.handle),rail:Object.assign(Object.assign({},(u=U==null?void 0:U.styles)===null||u===void 0?void 0:u.rail),M==null?void 0:M.rail),track:Object.assign(Object.assign({},(d=U==null?void 0:U.styles)===null||d===void 0?void 0:d.track),M==null?void 0:M.track)},Object.keys(Ce).length?{tracks:Ce}:{}),step:D.step,range:p,className:se,style:Me,disabled:L,ref:e,prefixCls:Ie,handleRender:we,activeHandleRender:Se,onChangeComplete:Pe})))});var c$t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"},u$t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:c$t}))},ket=g.forwardRef(u$t),d$t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},f$t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:d$t}))},Fet=g.forwardRef(f$t),h$t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z"}}]},name:"swap-right",theme:"outlined"},p$t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:h$t}))},g$t=g.forwardRef(p$t);function m$t(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.yearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.quarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.monthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.weekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.placeholder:t.lang.placeholder}function y$t(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.rangeYearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.rangeQuarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.rangeMonthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.rangeWeekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.rangePlaceholder:t.lang.rangePlaceholder}function Let(t,e){const{allowClear:n=!0}=t,{clearIcon:o,removeIcon:r}=hQe(Object.assign(Object.assign({},t),{prefixCls:e,componentName:"DatePicker"}));return[g.useMemo(()=>n===!1?!1:Object.assign({clearIcon:o},n===!0?{}:n),[n,o]),r]}const[A$t,w$t]=["week","WeekPicker"],[x$t,v$t]=["month","MonthPicker"],[b$t,S$t]=["year","YearPicker"],[T$t,P$t]=["quarter","QuarterPicker"],[Wet,iCe]=["time","TimePicker"],C$t=t=>g.createElement(oo,Object.assign({size:"small",type:"primary"},t));function Net(t){return g.useMemo(()=>Object.assign({button:C$t},t),[t])}var R$t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rg.forwardRef((n,o)=>{var r;const{prefixCls:i,getPopupContainer:a,components:l,className:s,style:c,placement:u,size:d,disabled:f,bordered:p=!0,placeholder:m,popupClassName:y,dropdownClassName:w,status:x,rootClassName:C,variant:P,picker:A}=n,S=R$t(n,["prefixCls","getPopupContainer","components","className","style","placement","size","disabled","bordered","placeholder","popupClassName","dropdownClassName","status","rootClassName","variant","picker"]),v=g.useRef(null),{getPrefixCls:b,direction:T,getPopupContainer:R,rangePicker:M}=g.useContext(gr),D=b("picker",i),{compactSize:k,compactItemClassnames:N}=x4(D,T),U=b(),[W,F]=jS("rangePicker",P,p),E=nu(D),[L,j,Y]=oet(D,E),[O]=Let(n,D),_=Net(l),G=jd(de=>{var he;return(he=d??k)!==null&&he!==void 0?he:de}),Q=g.useContext(Bp),oe=f??Q,ee=g.useContext(W1),{hasFeedback:q,status:ae,feedbackIcon:Z}=ee,ne=g.createElement(g.Fragment,null,A===Wet?g.createElement(Fet,null):g.createElement(ket,null),q&&Z);g.useImperativeHandle(o,()=>v.current);const[te]=r6("Calendar",GX),$=Object.assign(Object.assign({},te),n.locale),[le]=a6("DatePicker",(r=n.popupStyle)===null||r===void 0?void 0:r.zIndex);return L(g.createElement(E3,{space:!0},g.createElement(fGt,Object.assign({separator:g.createElement("span",{"aria-label":"to",className:`${D}-separator`},g.createElement(g$t,null)),disabled:oe,ref:v,placement:u,placeholder:y$t($,A,m),suffixIcon:ne,prevIcon:g.createElement("span",{className:`${D}-prev-icon`}),nextIcon:g.createElement("span",{className:`${D}-next-icon`}),superPrevIcon:g.createElement("span",{className:`${D}-super-prev-icon`}),superNextIcon:g.createElement("span",{className:`${D}-super-next-icon`}),transitionName:`${U}-slide-up`,picker:A},S,{className:Mn({[`${D}-${G}`]:G,[`${D}-${W}`]:F},o7(D,US(ae,x),q),j,N,s,M==null?void 0:M.className,Y,E,C),style:Object.assign(Object.assign({},M==null?void 0:M.style),c),locale:$.lang,prefixCls:D,getPopupContainer:a||R,generateConfig:t,components:_,direction:T,classNames:{popup:Mn(j,y||w,Y,E,C)},styles:{popup:Object.assign(Object.assign({},n.popupStyle),{zIndex:le})},allowClear:O}))))});var M$t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const e=(s,c)=>{const u=c===iCe?"timePicker":"datePicker";return g.forwardRef((f,p)=>{var m;const{prefixCls:y,getPopupContainer:w,components:x,style:C,className:P,rootClassName:A,size:S,bordered:v,placement:b,placeholder:T,popupClassName:R,dropdownClassName:M,disabled:D,status:k,variant:N,onCalendarChange:U}=f,W=M$t(f,["prefixCls","getPopupContainer","components","style","className","rootClassName","size","bordered","placement","placeholder","popupClassName","dropdownClassName","disabled","status","variant","onCalendarChange"]),{getPrefixCls:F,direction:E,getPopupContainer:L,[u]:j}=g.useContext(gr),Y=F("picker",y),{compactSize:O,compactItemClassnames:_}=x4(Y,E),G=g.useRef(null),[Q,oe]=jS("datePicker",N,v),ee=nu(Y),[q,ae,Z]=oet(Y,ee);g.useImperativeHandle(p,()=>G.current);const ne={showToday:!0},te=s||f.picker,$=F(),{onSelect:le,multiple:de}=W,he=le&&s==="time"&&!de,me=(Re,Ne,_e)=>{U==null||U(Re,Ne,_e),he&&le(Re)},[ce,Pe]=Let(f,Y),pe=Net(x),Ie=jd(Re=>{var Ne;return(Ne=S??O)!==null&&Ne!==void 0?Ne:Re}),ve=g.useContext(Bp),ze=D??ve,Ae=g.useContext(W1),{hasFeedback:se,status:ge,feedbackIcon:we}=Ae,Se=g.createElement(g.Fragment,null,te==="time"?g.createElement(Fet,null):g.createElement(ket,null),se&&we),[Me]=r6("DatePicker",GX),Ce=Object.assign(Object.assign({},Me),f.locale),[Te]=a6("DatePicker",(m=f.popupStyle)===null||m===void 0?void 0:m.zIndex);return q(g.createElement(E3,{space:!0},g.createElement(AGt,Object.assign({ref:G,placeholder:m$t(Ce,te,T),suffixIcon:Se,placement:b,prevIcon:g.createElement("span",{className:`${Y}-prev-icon`}),nextIcon:g.createElement("span",{className:`${Y}-next-icon`}),superPrevIcon:g.createElement("span",{className:`${Y}-super-prev-icon`}),superNextIcon:g.createElement("span",{className:`${Y}-super-next-icon`}),transitionName:`${$}-slide-up`,picker:s,onCalendarChange:me},ne,W,{locale:Ce.lang,className:Mn({[`${Y}-${Ie}`]:Ie,[`${Y}-${Q}`]:oe},o7(Y,US(ge,k),se),ae,_,j==null?void 0:j.className,P,Z,ee,A),style:Object.assign(Object.assign({},j==null?void 0:j.style),C),prefixCls:Y,getPopupContainer:w||L,generateConfig:t,components:pe,direction:E,disabled:ze,classNames:{popup:Mn(ae,Z,ee,A,R||M)},styles:{popup:Object.assign(Object.assign({},f.popupStyle),{zIndex:Te})},allowClear:ce,removeIcon:Pe}))))})},n=e(),o=e(A$t,w$t),r=e(x$t,v$t),i=e(b$t,S$t),a=e(T$t,P$t),l=e(Wet,iCe);return{DatePicker:n,WeekPicker:o,MonthPicker:r,YearPicker:i,TimePicker:l,QuarterPicker:a}},Uet=t=>{const{DatePicker:e,WeekPicker:n,MonthPicker:o,YearPicker:r,TimePicker:i,QuarterPicker:a}=I$t(t),l=H$t(t),s=e;return s.WeekPicker=n,s.MonthPicker=o,s.YearPicker=r,s.RangePicker=l,s.TimePicker=i,s.QuarterPicker=a,s},F7=Uet(Y_t),z$t=gU(F7,"popupAlign",void 0,"picker");F7._InternalPanelDoNotUseOrYouWillBeFired=z$t;const D$t=gU(F7.RangePicker,"popupAlign",void 0,"picker");F7._InternalRangePanelDoNotUseOrYouWillBeFired=D$t;F7.generatePicker=Uet;function LL(t){"@babel/helpers - typeof";return LL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},LL(t)}function E$t(t,e){if(LL(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(LL(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function k$t(t){var e=E$t(t,"string");return LL(e)=="symbol"?e:e+""}function Nhe(t,e,n){return e=k$t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function J2(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)continue;n[o]=t[o]}return n}function j$t(t,e){if(t==null)return{};var n=U$t(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var B$t=["prefixCls","className","containerRef"],Y$t=function(e){var n=e.prefixCls,o=e.className,r=e.containerRef,i=j$t(e,B$t),a=g.useContext(jet),l=a.panel,s=E7(l,r);return g.createElement("div",Yv({className:Bn("".concat(n,"-content"),o),role:"dialog",ref:s},F1(e,{aria:!0}),{"aria-modal":"true"},i))};function cCe(t){return typeof t=="string"&&String(Number(t))===t?(Ds(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(t)):t}var uCe={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function O$t(t,e){var n,o,r,i=t.prefixCls,a=t.open,l=t.placement,s=t.inline,c=t.push,u=t.forceRender,d=t.autoFocus,f=t.keyboard,p=t.classNames,m=t.rootClassName,y=t.rootStyle,w=t.zIndex,x=t.className,C=t.id,P=t.style,A=t.motion,S=t.width,v=t.height,b=t.children,T=t.mask,R=t.maskClosable,M=t.maskMotion,D=t.maskClassName,k=t.maskStyle,N=t.afterOpenChange,U=t.onClose,W=t.onMouseEnter,F=t.onMouseOver,E=t.onMouseLeave,L=t.onClick,j=t.onKeyDown,Y=t.onKeyUp,O=t.styles,_=t.drawerRender,G=g.useRef(),Q=g.useRef(),oe=g.useRef();g.useImperativeHandle(e,function(){return G.current});var ee=function(ze){var Ae=ze.keyCode,se=ze.shiftKey;switch(Ae){case Lo.TAB:{if(Ae===Lo.TAB){if(!se&&document.activeElement===oe.current){var ge;(ge=Q.current)===null||ge===void 0||ge.focus({preventScroll:!0})}else if(se&&document.activeElement===Q.current){var we;(we=oe.current)===null||we===void 0||we.focus({preventScroll:!0})}}break}case Lo.ESC:{U&&f&&(ze.stopPropagation(),U(ze));break}}};g.useEffect(function(){if(a&&d){var ve;(ve=G.current)===null||ve===void 0||ve.focus({preventScroll:!0})}},[a]);var q=g.useState(!1),ae=Uhe(q,2),Z=ae[0],ne=ae[1],te=g.useContext(sCe),$;typeof c=="boolean"?$=c?{}:{distance:0}:$=c||{};var le=(n=(o=(r=$)===null||r===void 0?void 0:r.distance)!==null&&o!==void 0?o:te==null?void 0:te.pushDistance)!==null&&n!==void 0?n:180,de=g.useMemo(function(){return{pushDistance:le,push:function(){ne(!0)},pull:function(){ne(!1)}}},[le]);g.useEffect(function(){if(a){var ve;te==null||(ve=te.push)===null||ve===void 0||ve.call(te)}else{var ze;te==null||(ze=te.pull)===null||ze===void 0||ze.call(te)}},[a]),g.useEffect(function(){return function(){var ve;te==null||(ve=te.pull)===null||ve===void 0||ve.call(te)}},[]);var he=T&&g.createElement(Oy,Yv({key:"mask"},M,{visible:a}),function(ve,ze){var Ae=ve.className,se=ve.style;return g.createElement("div",{className:Bn("".concat(i,"-mask"),Ae,p==null?void 0:p.mask,D),style:J2(J2(J2({},se),k),O==null?void 0:O.mask),onClick:R&&a?U:void 0,ref:ze})}),me=typeof A=="function"?A(l):A,ce={};if(Z&&le)switch(l){case"top":ce.transform="translateY(".concat(le,"px)");break;case"bottom":ce.transform="translateY(".concat(-le,"px)");break;case"left":ce.transform="translateX(".concat(le,"px)");break;default:ce.transform="translateX(".concat(-le,"px)");break}l==="left"||l==="right"?ce.width=cCe(S):ce.height=cCe(v);var Pe={onMouseEnter:W,onMouseOver:F,onMouseLeave:E,onClick:L,onKeyDown:j,onKeyUp:Y},pe=g.createElement(Oy,Yv({key:"panel"},me,{visible:a,forceRender:u,onVisibleChanged:function(ze){N==null||N(ze)},removeOnLeave:!1,leavedClassName:"".concat(i,"-content-wrapper-hidden")}),function(ve,ze){var Ae=ve.className,se=ve.style,ge=g.createElement(Y$t,Yv({id:C,containerRef:ze,prefixCls:i,className:Bn(x,p==null?void 0:p.content),style:J2(J2({},P),O==null?void 0:O.content)},F1(t,{aria:!0}),Pe),b);return g.createElement("div",Yv({className:Bn("".concat(i,"-content-wrapper"),p==null?void 0:p.wrapper,Ae),style:J2(J2(J2({},ce),se),O==null?void 0:O.wrapper)},F1(t,{data:!0})),_?_(ge):ge)}),Ie=J2({},y);return w&&(Ie.zIndex=w),g.createElement(sCe.Provider,{value:de},g.createElement("div",{className:Bn(i,"".concat(i,"-").concat(l),m,Nhe(Nhe({},"".concat(i,"-open"),a),"".concat(i,"-inline"),s)),style:Ie,tabIndex:-1,ref:G,onKeyDown:ee},he,g.createElement("div",{tabIndex:0,ref:Q,style:uCe,"aria-hidden":"true","data-sentinel":"start"}),pe,g.createElement("div",{tabIndex:0,ref:oe,style:uCe,"aria-hidden":"true","data-sentinel":"end"})))}var _$t=g.forwardRef(O$t),V$t=function(e){var n=e.open,o=n===void 0?!1:n,r=e.prefixCls,i=r===void 0?"rc-drawer":r,a=e.placement,l=a===void 0?"right":a,s=e.autoFocus,c=s===void 0?!0:s,u=e.keyboard,d=u===void 0?!0:u,f=e.width,p=f===void 0?378:f,m=e.mask,y=m===void 0?!0:m,w=e.maskClosable,x=w===void 0?!0:w,C=e.getContainer,P=e.forceRender,A=e.afterOpenChange,S=e.destroyOnClose,v=e.onMouseEnter,b=e.onMouseOver,T=e.onMouseLeave,R=e.onClick,M=e.onKeyDown,D=e.onKeyUp,k=e.panelRef,N=g.useState(!1),U=Uhe(N,2),W=U[0],F=U[1],E=g.useState(!1),L=Uhe(E,2),j=L[0],Y=L[1];Ml(function(){Y(!0)},[]);var O=j?o:!1,_=g.useRef(),G=g.useRef();Ml(function(){O&&(G.current=document.activeElement)},[O]);var Q=function(Z){var ne;if(F(Z),A==null||A(Z),!Z&&G.current&&!((ne=_.current)!==null&&ne!==void 0&&ne.contains(G.current))){var te;(te=G.current)===null||te===void 0||te.focus({preventScroll:!0})}},oe=g.useMemo(function(){return{panel:k}},[k]);if(!P&&!W&&!O&&S)return null;var ee={onMouseEnter:v,onMouseOver:b,onMouseLeave:T,onClick:R,onKeyDown:M,onKeyUp:D},q=J2(J2({},e),{},{open:O,prefixCls:i,placement:l,autoFocus:c,keyboard:d,width:p,mask:y,maskClosable:x,inline:C===!1,afterOpenChange:Q,ref:_},ee);return g.createElement(jet.Provider,{value:oe},g.createElement(uU,{open:O||P||W,autoDestroy:!1,getContainer:C,autoLock:y&&(O||W)},g.createElement(_$t,q)))};const Bet=t=>{var e,n;const{prefixCls:o,title:r,footer:i,extra:a,loading:l,onClose:s,headerStyle:c,bodyStyle:u,footerStyle:d,children:f,classNames:p,styles:m}=t,{drawer:y}=g.useContext(gr),w=g.useCallback(S=>g.createElement("button",{type:"button",onClick:s,"aria-label":"Close",className:`${o}-close`},S),[s]),[x,C]=u9e(SH(t),SH(y),{closable:!0,closeIconRender:w}),P=g.useMemo(()=>{var S,v;return!r&&!x?null:g.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(S=y==null?void 0:y.styles)===null||S===void 0?void 0:S.header),c),m==null?void 0:m.header),className:Mn(`${o}-header`,{[`${o}-header-close-only`]:x&&!r&&!a},(v=y==null?void 0:y.classNames)===null||v===void 0?void 0:v.header,p==null?void 0:p.header)},g.createElement("div",{className:`${o}-header-title`},C,r&&g.createElement("div",{className:`${o}-title`},r)),a&&g.createElement("div",{className:`${o}-extra`},a))},[x,C,a,c,o,r]),A=g.useMemo(()=>{var S,v;if(!i)return null;const b=`${o}-footer`;return g.createElement("div",{className:Mn(b,(S=y==null?void 0:y.classNames)===null||S===void 0?void 0:S.footer,p==null?void 0:p.footer),style:Object.assign(Object.assign(Object.assign({},(v=y==null?void 0:y.styles)===null||v===void 0?void 0:v.footer),d),m==null?void 0:m.footer)},i)},[i,d,o]);return g.createElement(g.Fragment,null,P,g.createElement("div",{className:Mn(`${o}-body`,p==null?void 0:p.body,(e=y==null?void 0:y.classNames)===null||e===void 0?void 0:e.body),style:Object.assign(Object.assign(Object.assign({},(n=y==null?void 0:y.styles)===null||n===void 0?void 0:n.body),u),m==null?void 0:m.body)},l?g.createElement(NS,{active:!0,title:!1,paragraph:{rows:5},className:`${o}-body-skeleton`}):f),A)},G$t=t=>{const e="100%";return{left:`translateX(-${e})`,right:`translateX(${e})`,top:`translateY(-${e})`,bottom:`translateY(${e})`}[t]},Yet=(t,e)=>({"&-enter, &-appear":Object.assign(Object.assign({},t),{"&-active":e}),"&-leave":Object.assign(Object.assign({},e),{"&-active":t})}),Oet=(t,e)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${e}`}}},Yet({opacity:t},{opacity:1})),X$t=(t,e)=>[Oet(.7,e),Yet({transform:G$t(t)},{transform:"none"})],J$t=t=>{const{componentCls:e,motionDurationSlow:n}=t;return{[e]:{[`${e}-mask-motion`]:Oet(0,n),[`${e}-panel-motion`]:["left","right","top","bottom"].reduce((o,r)=>Object.assign(Object.assign({},o),{[`&-${r}`]:X$t(r,n)}),{})}}},K$t=t=>{const{borderRadiusSM:e,componentCls:n,zIndexPopup:o,colorBgMask:r,colorBgElevated:i,motionDurationSlow:a,motionDurationMid:l,paddingXS:s,padding:c,paddingLG:u,fontSizeLG:d,lineHeightLG:f,lineWidth:p,lineType:m,colorSplit:y,marginXS:w,colorIcon:x,colorIconHover:C,colorBgTextHover:P,colorBgTextActive:A,colorText:S,fontWeightStrong:v,footerPaddingBlock:b,footerPaddingInline:T,calc:R}=t,M=`${n}-content-wrapper`;return{[n]:{position:"fixed",inset:0,zIndex:o,pointerEvents:"none",color:S,"&-pure":{position:"relative",background:i,display:"flex",flexDirection:"column",[`&${n}-left`]:{boxShadow:t.boxShadowDrawerLeft},[`&${n}-right`]:{boxShadow:t.boxShadowDrawerRight},[`&${n}-top`]:{boxShadow:t.boxShadowDrawerUp},[`&${n}-bottom`]:{boxShadow:t.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${n}-mask`]:{position:"absolute",inset:0,zIndex:o,background:r,pointerEvents:"auto"},[M]:{position:"absolute",zIndex:o,maxWidth:"100vw",transition:`all ${a}`,"&-hidden":{display:"none"}},[`&-left > ${M}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:t.boxShadowDrawerLeft},[`&-right > ${M}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:t.boxShadowDrawerRight},[`&-top > ${M}`]:{top:0,insetInline:0,boxShadow:t.boxShadowDrawerUp},[`&-bottom > ${M}`]:{bottom:0,insetInline:0,boxShadow:t.boxShadowDrawerDown},[`${n}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:i,pointerEvents:"auto"},[`${n}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${jt(c)} ${jt(u)}`,fontSize:d,lineHeight:f,borderBottom:`${jt(p)} ${m} ${y}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${n}-extra`]:{flex:"none"},[`${n}-close`]:Object.assign({display:"inline-flex",width:R(d).add(s).equal(),height:R(d).add(s).equal(),borderRadius:e,justifyContent:"center",alignItems:"center",marginInlineEnd:w,color:x,fontWeight:v,fontSize:d,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${l}`,textRendering:"auto","&:hover":{color:C,backgroundColor:P,textDecoration:"none"},"&:active":{backgroundColor:A}},Yy(t)),[`${n}-title`]:{flex:1,margin:0,fontWeight:t.fontWeightStrong,fontSize:d,lineHeight:f},[`${n}-body`]:{flex:1,minWidth:0,minHeight:0,padding:u,overflow:"auto",[`${n}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},[`${n}-footer`]:{flexShrink:0,padding:`${jt(b)} ${jt(T)}`,borderTop:`${jt(p)} ${m} ${y}`},"&-rtl":{direction:"rtl"}}}},$$t=t=>({zIndexPopup:t.zIndexPopupBase,footerPaddingBlock:t.paddingXS,footerPaddingInline:t.padding}),_et=el("Drawer",t=>{const e=Ui(t,{});return[K$t(e),J$t(e)]},$$t);var Vet=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{rootClassName:e,width:n,height:o,size:r="default",mask:i=!0,push:a=q$t,open:l,afterOpenChange:s,onClose:c,prefixCls:u,getContainer:d,style:f,className:p,visible:m,afterVisibleChange:y,maskStyle:w,drawerStyle:x,contentWrapperStyle:C}=t,P=Vet(t,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","style","className","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle"]),{getPopupContainer:A,getPrefixCls:S,direction:v,drawer:b}=g.useContext(gr),T=S("drawer",u),[R,M,D]=_et(T),k=d===void 0&&A?()=>A(document.body):d,N=Mn({"no-mask":!i,[`${T}-rtl`]:v==="rtl"},e,M,D),U=g.useMemo(()=>n??(r==="large"?736:378),[n,r]),W=g.useMemo(()=>o??(r==="large"?736:378),[o,r]),F={motionName:L1(T,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},E=oe=>({motionName:L1(T,`panel-motion-${oe}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),L=Cqe(),[j,Y]=a6("Drawer",P.zIndex),{classNames:O={},styles:_={}}=P,{classNames:G={},styles:Q={}}=b||{};return R(g.createElement(E3,{form:!0,space:!0},g.createElement(iU.Provider,{value:Y},g.createElement(V$t,Object.assign({prefixCls:T,onClose:c,maskMotion:F,motion:E},P,{classNames:{mask:Mn(O.mask,G.mask),content:Mn(O.content,G.content),wrapper:Mn(O.wrapper,G.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},_.mask),w),Q.mask),content:Object.assign(Object.assign(Object.assign({},_.content),x),Q.content),wrapper:Object.assign(Object.assign(Object.assign({},_.wrapper),C),Q.wrapper)},open:l??m,mask:i,push:a,width:U,height:W,style:Object.assign(Object.assign({},b==null?void 0:b.style),f),className:Mn(b==null?void 0:b.className,p),rootClassName:N,getContainer:k,afterOpenChange:s??y,panelRef:L,zIndex:j}),g.createElement(Bet,Object.assign({prefixCls:T},P,{onClose:c}))))))},Q$t=t=>{const{prefixCls:e,style:n,className:o,placement:r="right"}=t,i=Vet(t,["prefixCls","style","className","placement"]),{getPrefixCls:a}=g.useContext(gr),l=a("drawer",e),[s,c,u]=_et(l),d=Mn(l,`${l}-pure`,`${l}-${r}`,c,u,o);return s(g.createElement("div",{className:d,style:n},g.createElement(Bet,Object.assign({prefixCls:l},i))))};jhe._InternalPanelDoNotUseOrYouWillBeFired=Q$t;function dCe(t){return["small","middle","large"].includes(t)}function fCe(t){return t?typeof t=="number"&&!Number.isNaN(t):!1}const Get=xe.createContext({latestIndex:0}),Z$t=Get.Provider,eqt=t=>{let{className:e,index:n,children:o,split:r,style:i}=t;const{latestIndex:a}=g.useContext(Get);return o==null?null:g.createElement(g.Fragment,null,g.createElement("div",{className:e,style:i},o),n{var n,o,r;const{getPrefixCls:i,space:a,direction:l}=g.useContext(gr),{size:s=(n=a==null?void 0:a.size)!==null&&n!==void 0?n:"small",align:c,className:u,rootClassName:d,children:f,direction:p="horizontal",prefixCls:m,split:y,style:w,wrap:x=!1,classNames:C,styles:P}=t,A=tqt(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[S,v]=Array.isArray(s)?s:[s,s],b=dCe(v),T=dCe(S),R=fCe(v),M=fCe(S),D=jy(f,{keepEmpty:!0}),k=c===void 0&&p==="horizontal"?"center":c,N=i("space",m),[U,W,F]=q$e(N),E=Mn(N,a==null?void 0:a.className,W,`${N}-${p}`,{[`${N}-rtl`]:l==="rtl",[`${N}-align-${k}`]:k,[`${N}-gap-row-${v}`]:b,[`${N}-gap-col-${S}`]:T},u,d,F),L=Mn(`${N}-item`,(o=C==null?void 0:C.item)!==null&&o!==void 0?o:(r=a==null?void 0:a.classNames)===null||r===void 0?void 0:r.item);let j=0;const Y=D.map((G,Q)=>{var oe,ee;G!=null&&(j=Q);const q=(G==null?void 0:G.key)||`${L}-${Q}`;return g.createElement(eqt,{className:L,key:q,index:Q,split:y,style:(oe=P==null?void 0:P.item)!==null&&oe!==void 0?oe:(ee=a==null?void 0:a.styles)===null||ee===void 0?void 0:ee.item},G)}),O=g.useMemo(()=>({latestIndex:j}),[j]);if(D.length===0)return null;const _={};return x&&(_.flexWrap="wrap"),!T&&M&&(_.columnGap=S),!b&&R&&(_.rowGap=v),U(g.createElement("div",Object.assign({ref:e,className:E,style:Object.assign(Object.assign(Object.assign({},_),a==null?void 0:a.style),w)},A),g.createElement(Z$t,{value:O},Y)))}),Jt=nqt;Jt.Compact=RFt;var oqt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPopupContainer:e,getPrefixCls:n,direction:o}=g.useContext(gr),{prefixCls:r,type:i="default",danger:a,disabled:l,loading:s,onClick:c,htmlType:u,children:d,className:f,menu:p,arrow:m,autoFocus:y,overlay:w,trigger:x,align:C,open:P,onOpenChange:A,placement:S,getPopupContainer:v,href:b,icon:T=g.createElement(z9e,null),title:R,buttonsRender:M=ae=>ae,mouseEnterDelay:D,mouseLeaveDelay:k,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:F}=t,E=oqt(t,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","dropdownRender"]),L=n("dropdown",r),j=`${L}-button`,Y={menu:p,arrow:m,autoFocus:y,align:C,disabled:l,trigger:l?[]:x,onOpenChange:A,getPopupContainer:v||e,mouseEnterDelay:D,mouseLeaveDelay:k,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:F},{compactSize:O,compactItemClassnames:_}=x4(L,o),G=Mn(j,_,f);"overlay"in t&&(Y.overlay=w),"open"in t&&(Y.open=P),"placement"in t?Y.placement=S:Y.placement=o==="rtl"?"bottomLeft":"bottomRight";const Q=g.createElement(oo,{type:i,danger:a,disabled:l,loading:s,onClick:c,htmlType:u,href:b,title:R},d),oe=g.createElement(oo,{type:i,danger:a,icon:T}),[ee,q]=M([Q,oe]);return g.createElement(Jt.Compact,Object.assign({className:G,size:O,block:!0},E),ee,g.createElement(VZ,Object.assign({},Y),q))};Xet.__ANT_BUTTON=!0;const e4=VZ;e4.Button=Xet;var rqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},iqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:rqt}))},t4=g.forwardRef(iqt);function zA(){return zA=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function PH(t,e){if(t==null)return{};var n=dqt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function Ket(){var t=document.documentElement.clientWidth,e=window.innerHeight||document.documentElement.clientHeight;return{width:t,height:e}}function fqt(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:e.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}function rR(t,e,n,o){var r=XA.unstable_batchedUpdates?function(a){XA.unstable_batchedUpdates(n,a)}:n;return t!=null&&t.addEventListener&&t.addEventListener(e,r,o),{remove:function(){t!=null&&t.removeEventListener&&t.removeEventListener(e,r,o)}}}var SU=g.createContext(null),hqt=function(e){var n=e.visible,o=e.maskTransitionName,r=e.getContainer,i=e.prefixCls,a=e.rootClassName,l=e.icons,s=e.countRender,c=e.showSwitch,u=e.showProgress,d=e.current,f=e.transform,p=e.count,m=e.scale,y=e.minScale,w=e.maxScale,x=e.closeIcon,C=e.onActive,P=e.onClose,A=e.onZoomIn,S=e.onZoomOut,v=e.onRotateRight,b=e.onRotateLeft,T=e.onFlipX,R=e.onFlipY,M=e.onReset,D=e.toolbarRender,k=e.zIndex,N=e.image,U=g.useContext(SU),W=l.rotateLeft,F=l.rotateRight,E=l.zoomIn,L=l.zoomOut,j=l.close,Y=l.left,O=l.right,_=l.flipX,G=l.flipY,Q="".concat(i,"-operations-operation");g.useEffect(function(){var me=function(Pe){Pe.keyCode===Lo.ESC&&P()};return n&&window.addEventListener("keydown",me),function(){window.removeEventListener("keydown",me)}},[n]);var oe=function(ce,Pe){ce.preventDefault(),ce.stopPropagation(),C(Pe)},ee=g.useCallback(function(me){var ce=me.type,Pe=me.disabled,pe=me.onClick,Ie=me.icon;return g.createElement("div",{key:ce,className:Bn(Q,"".concat(i,"-operations-operation-").concat(ce),T5({},"".concat(i,"-operations-operation-disabled"),!!Pe)),onClick:pe},Ie)},[Q,i]),q=c?ee({icon:Y,onClick:function(ce){return oe(ce,-1)},type:"prev",disabled:d===0}):void 0,ae=c?ee({icon:O,onClick:function(ce){return oe(ce,1)},type:"next",disabled:d===p-1}):void 0,Z=ee({icon:G,onClick:R,type:"flipY"}),ne=ee({icon:_,onClick:T,type:"flipX"}),te=ee({icon:W,onClick:b,type:"rotateLeft"}),$=ee({icon:F,onClick:v,type:"rotateRight"}),le=ee({icon:L,onClick:S,type:"zoomOut",disabled:m<=y}),de=ee({icon:E,onClick:A,type:"zoomIn",disabled:m===w}),he=g.createElement("div",{className:"".concat(i,"-operations")},Z,ne,te,$,le,de);return g.createElement(Oy,{visible:n,motionName:o},function(me){var ce=me.className,Pe=me.style;return g.createElement(uU,{open:!0,getContainer:r??document.body},g.createElement("div",{className:Bn("".concat(i,"-operations-wrapper"),ce,a),style:hu(hu({},Pe),{},{zIndex:k})},x===null?null:g.createElement("button",{className:"".concat(i,"-close"),onClick:P},x||j),c&&g.createElement(g.Fragment,null,g.createElement("div",{className:Bn("".concat(i,"-switch-left"),T5({},"".concat(i,"-switch-left-disabled"),d===0)),onClick:function(Ie){return oe(Ie,-1)}},Y),g.createElement("div",{className:Bn("".concat(i,"-switch-right"),T5({},"".concat(i,"-switch-right-disabled"),d===p-1)),onClick:function(Ie){return oe(Ie,1)}},O)),g.createElement("div",{className:"".concat(i,"-footer")},u&&g.createElement("div",{className:"".concat(i,"-progress")},s?s(d+1,p):"".concat(d+1," / ").concat(p)),D?D(he,hu(hu({icons:{prevIcon:q,nextIcon:ae,flipYIcon:Z,flipXIcon:ne,rotateLeftIcon:te,rotateRightIcon:$,zoomOutIcon:le,zoomInIcon:de},actions:{onActive:C,onFlipY:R,onFlipX:T,onRotateLeft:b,onRotateRight:v,onZoomOut:S,onZoomIn:A,onReset:M,onClose:P},transform:f},U?{current:d,total:p}:{}),{},{image:N})):he)))})},ZO={x:0,y:0,rotate:0,scale:1,flipX:!1,flipY:!1};function pqt(t,e,n,o){var r=g.useRef(null),i=g.useRef([]),a=g.useState(ZO),l=gf(a,2),s=l[0],c=l[1],u=function(m){c(ZO),Vb(ZO,s)||o==null||o({transform:ZO,action:m})},d=function(m,y){r.current===null&&(i.current=[],r.current=Ic(function(){c(function(w){var x=w;return i.current.forEach(function(C){x=hu(hu({},x),C)}),r.current=null,o==null||o({transform:x,action:y}),x})})),i.current.push(hu(hu({},s),m))},f=function(m,y,w,x,C){var P=t.current,A=P.width,S=P.height,v=P.offsetWidth,b=P.offsetHeight,T=P.offsetLeft,R=P.offsetTop,M=m,D=s.scale*m;D>n?(D=n,M=n/s.scale):Do){if(e>0)return T5({},t,i);if(e<0&&ro)return T5({},t,e<0?i:-i);return{}}function $et(t,e,n,o){var r=Ket(),i=r.width,a=r.height,l=null;return t<=i&&e<=a?l={x:0,y:0}:(t>i||e>a)&&(l=hu(hu({},pCe("x",n,t,i)),pCe("y",o,e,a))),l}var iR=1,gqt=1;function mqt(t,e,n,o,r,i,a){var l=r.rotate,s=r.scale,c=r.x,u=r.y,d=g.useState(!1),f=gf(d,2),p=f[0],m=f[1],y=g.useRef({diffX:0,diffY:0,transformX:0,transformY:0}),w=function(S){!e||S.button!==0||(S.preventDefault(),S.stopPropagation(),y.current={diffX:S.pageX-c,diffY:S.pageY-u,transformX:c,transformY:u},m(!0))},x=function(S){n&&p&&i({x:S.pageX-y.current.diffX,y:S.pageY-y.current.diffY},"move")},C=function(){if(n&&p){m(!1);var S=y.current,v=S.transformX,b=S.transformY,T=c!==v&&u!==b;if(!T)return;var R=t.current.offsetWidth*s,M=t.current.offsetHeight*s,D=t.current.getBoundingClientRect(),k=D.left,N=D.top,U=l%180!==0,W=$et(U?M:R,U?R:M,k,N);W&&i(hu({},W),"dragRebound")}},P=function(S){if(!(!n||S.deltaY==0)){var v=Math.abs(S.deltaY/100),b=Math.min(v,gqt),T=iR+b*o;S.deltaY>0&&(T=iR/T),a(T,"wheel",S.clientX,S.clientY)}};return g.useEffect(function(){var A,S,v,b;if(e){v=rR(window,"mouseup",C,!1),b=rR(window,"mousemove",x,!1);try{window.top!==window.self&&(A=rR(window.top,"mouseup",C,!1),S=rR(window.top,"mousemove",x,!1))}catch{}}return function(){var T,R,M,D;(T=v)===null||T===void 0||T.remove(),(R=b)===null||R===void 0||R.remove(),(M=A)===null||M===void 0||M.remove(),(D=S)===null||D===void 0||D.remove()}},[n,p,c,u,l,e]),{isMoving:p,onMouseDown:w,onMouseMove:x,onMouseUp:C,onWheel:P}}function yqt(t){return new Promise(function(e){var n=document.createElement("img");n.onerror=function(){return e(!1)},n.onload=function(){return e(!0)},n.src=t})}function qet(t){var e=t.src,n=t.isCustomPlaceholder,o=t.fallback,r=g.useState(n?"loading":"normal"),i=gf(r,2),a=i[0],l=i[1],s=g.useRef(!1),c=a==="error";g.useEffect(function(){var p=!0;return yqt(e).then(function(m){!m&&p&&l("error")}),function(){p=!1}},[e]),g.useEffect(function(){n&&!s.current?l("loading"):c&&l("normal")},[e]);var u=function(){l("normal")},d=function(m){s.current=!1,a==="loading"&&m!==null&&m!==void 0&&m.complete&&(m.naturalWidth||m.naturalHeight)&&(s.current=!0,u())},f=c&&o?{src:o}:{onLoad:u,src:e};return[d,f,a]}function mJ(t,e){var n=t.x-e.x,o=t.y-e.y;return Math.hypot(n,o)}function Aqt(t,e,n,o){var r=mJ(t,n),i=mJ(e,o);if(r===0&&i===0)return[t.x,t.y];var a=r/(r+i),l=t.x+a*(e.x-t.x),s=t.y+a*(e.y-t.y);return[l,s]}function wqt(t,e,n,o,r,i,a){var l=r.rotate,s=r.scale,c=r.x,u=r.y,d=g.useState(!1),f=gf(d,2),p=f[0],m=f[1],y=g.useRef({point1:{x:0,y:0},point2:{x:0,y:0},eventType:"none"}),w=function(S){y.current=hu(hu({},y.current),S)},x=function(S){if(e){S.stopPropagation(),m(!0);var v=S.touches,b=v===void 0?[]:v;b.length>1?w({point1:{x:b[0].clientX,y:b[0].clientY},point2:{x:b[1].clientX,y:b[1].clientY},eventType:"touchZoom"}):w({point1:{x:b[0].clientX-c,y:b[0].clientY-u},eventType:"move"})}},C=function(S){var v=S.touches,b=v===void 0?[]:v,T=y.current,R=T.point1,M=T.point2,D=T.eventType;if(b.length>1&&D==="touchZoom"){var k={x:b[0].clientX,y:b[0].clientY},N={x:b[1].clientX,y:b[1].clientY},U=Aqt(R,M,k,N),W=gf(U,2),F=W[0],E=W[1],L=mJ(k,N)/mJ(R,M);a(L,"touchZoom",F,E,!0),w({point1:k,point2:N,eventType:"touchZoom"})}else D==="move"&&(i({x:b[0].clientX-R.x,y:b[0].clientY-R.y},"move"),w({eventType:"move"}))},P=function(){if(n){if(p&&m(!1),w({eventType:"none"}),o>s)return i({x:0,y:0,scale:o},"touchZoom");var S=t.current.offsetWidth*s,v=t.current.offsetHeight*s,b=t.current.getBoundingClientRect(),T=b.left,R=b.top,M=l%180!==0,D=$et(M?v:S,M?S:v,T,R);D&&i(hu({},D),"dragRebound")}};return g.useEffect(function(){var A;return n&&e&&(A=rR(window,"touchmove",function(S){return S.preventDefault()},{passive:!1})),function(){var S;(S=A)===null||S===void 0||S.remove()}},[n,e]),{isTouching:p,onTouchStart:x,onTouchMove:C,onTouchEnd:P}}var xqt=["fallback","src","imgRef"],vqt=["prefixCls","src","alt","imageInfo","fallback","movable","onClose","visible","icons","rootClassName","closeIcon","getContainer","current","count","countRender","scaleStep","minScale","maxScale","transitionName","maskTransitionName","imageRender","imgCommonProps","toolbarRender","onTransform","onChange"],bqt=function(e){var n=e.fallback,o=e.src,r=e.imgRef,i=PH(e,xqt),a=qet({src:o,fallback:n}),l=gf(a,2),s=l[0],c=l[1];return xe.createElement("img",zA({ref:function(d){r.current=d,s(d)}},i,c))},Qet=function(e){var n=e.prefixCls,o=e.src,r=e.alt,i=e.imageInfo,a=e.fallback,l=e.movable,s=l===void 0?!0:l,c=e.onClose,u=e.visible,d=e.icons,f=d===void 0?{}:d,p=e.rootClassName,m=e.closeIcon,y=e.getContainer,w=e.current,x=w===void 0?0:w,C=e.count,P=C===void 0?1:C,A=e.countRender,S=e.scaleStep,v=S===void 0?.5:S,b=e.minScale,T=b===void 0?1:b,R=e.maxScale,M=R===void 0?50:R,D=e.transitionName,k=D===void 0?"zoom":D,N=e.maskTransitionName,U=N===void 0?"fade":N,W=e.imageRender,F=e.imgCommonProps,E=e.toolbarRender,L=e.onTransform,j=e.onChange,Y=PH(e,vqt),O=g.useRef(),_=g.useContext(SU),G=_&&P>1,Q=_&&P>=1,oe=g.useState(!0),ee=gf(oe,2),q=ee[0],ae=ee[1],Z=pqt(O,T,M,L),ne=Z.transform,te=Z.resetTransform,$=Z.updateTransform,le=Z.dispatchZoomChange,de=mqt(O,s,u,v,ne,$,le),he=de.isMoving,me=de.onMouseDown,ce=de.onWheel,Pe=wqt(O,s,u,T,ne,$,le),pe=Pe.isTouching,Ie=Pe.onTouchStart,ve=Pe.onTouchMove,ze=Pe.onTouchEnd,Ae=ne.rotate,se=ne.scale,ge=Bn(T5({},"".concat(n,"-moving"),he));g.useEffect(function(){q||ae(!0)},[q]);var we=function(){te("close")},Se=function(){le(iR+v,"zoomIn")},Me=function(){le(iR/(iR+v),"zoomOut")},Ce=function(){$({rotate:Ae+90},"rotateRight")},Te=function(){$({rotate:Ae-90},"rotateLeft")},Re=function(){$({flipX:!ne.flipX},"flipX")},Ne=function(){$({flipY:!ne.flipY},"flipY")},_e=function(){te("reset")},Ue=function(lt){var Oe=x+lt;!Number.isInteger(Oe)||Oe<0||Oe>P-1||(ae(!1),te(lt<0?"prev":"next"),j==null||j(Oe,x))},qe=function(lt){!u||!G||(lt.keyCode===Lo.LEFT?Ue(-1):lt.keyCode===Lo.RIGHT&&Ue(1))},Fe=function(lt){u&&(se!==1?$({x:0,y:0,scale:1},"doubleClick"):le(iR+v,"doubleClick",lt.clientX,lt.clientY))};g.useEffect(function(){var Ye=rR(window,"keydown",qe,!1);return function(){Ye.remove()}},[u,G,x]);var He=xe.createElement(bqt,zA({},F,{width:e.width,height:e.height,imgRef:O,className:"".concat(n,"-img"),alt:r,style:{transform:"translate3d(".concat(ne.x,"px, ").concat(ne.y,"px, 0) scale3d(").concat(ne.flipX?"-":"").concat(se,", ").concat(ne.flipY?"-":"").concat(se,", 1) rotate(").concat(Ae,"deg)"),transitionDuration:(!q||pe)&&"0s"},fallback:a,src:o,onWheel:ce,onMouseDown:me,onDoubleClick:Fe,onTouchStart:Ie,onTouchMove:ve,onTouchEnd:ze,onTouchCancel:ze})),Le=hu({url:o,alt:r},i);return xe.createElement(xe.Fragment,null,xe.createElement(l9e,zA({transitionName:k,maskTransitionName:U,closable:!1,keyboard:!0,prefixCls:n,onClose:c,visible:u,classNames:{wrapper:ge},rootClassName:p,getContainer:y},Y,{afterClose:we}),xe.createElement("div",{className:"".concat(n,"-img-wrapper")},W?W(He,hu({transform:ne,image:Le},_?{current:x}:{})):He)),xe.createElement(hqt,{visible:u,transform:ne,maskTransitionName:U,closeIcon:m,getContainer:y,prefixCls:n,rootClassName:p,icons:f,countRender:A,showSwitch:G,showProgress:Q,current:x,count:P,scale:se,minScale:T,maxScale:M,toolbarRender:E,onActive:Ue,onZoomIn:Se,onZoomOut:Me,onRotateRight:Ce,onRotateLeft:Te,onFlipX:Re,onFlipY:Ne,onClose:c,onReset:_e,zIndex:Y.zIndex!==void 0?Y.zIndex+1:void 0,image:Le}))};function Sqt(t){if(Array.isArray(t))return Bhe(t)}function Tqt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Pqt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cqt(t){return Sqt(t)||Tqt(t)||Jet(t)||Pqt()}var Yhe=["crossOrigin","decoding","draggable","loading","referrerPolicy","sizes","srcSet","useMap","alt"];function Rqt(t){var e=g.useState({}),n=gf(e,2),o=n[0],r=n[1],i=g.useCallback(function(l,s){return r(function(c){return hu(hu({},c),{},T5({},l,s))}),function(){r(function(c){var u=hu({},c);return delete u[l],u})}},[]),a=g.useMemo(function(){return t?t.map(function(l){if(typeof l=="string")return{data:{src:l}};var s={};return Object.keys(l).forEach(function(c){["src"].concat(Cqt(Yhe)).includes(c)&&(s[c]=l[c])}),{data:s}}):Object.keys(o).reduce(function(l,s){var c=o[s],u=c.canPreview,d=c.data;return u&&l.push({data:d,id:s}),l},[])},[t,o]);return[a,i,!!t]}var Hqt=["visible","onVisibleChange","getContainer","current","movable","minScale","maxScale","countRender","closeIcon","onChange","onTransform","toolbarRender","imageRender"],Mqt=["src"],Iqt=function(e){var n,o=e.previewPrefixCls,r=o===void 0?"rc-image-preview":o,i=e.children,a=e.icons,l=a===void 0?{}:a,s=e.items,c=e.preview,u=e.fallback,d=$b(c)==="object"?c:{},f=d.visible,p=d.onVisibleChange,m=d.getContainer,y=d.current,w=d.movable,x=d.minScale,C=d.maxScale,P=d.countRender,A=d.closeIcon,S=d.onChange,v=d.onTransform,b=d.toolbarRender,T=d.imageRender,R=PH(d,Hqt),M=Rqt(s),D=gf(M,3),k=D[0],N=D[1],U=D[2],W=o0(0,{value:y}),F=gf(W,2),E=F[0],L=F[1],j=g.useState(!1),Y=gf(j,2),O=Y[0],_=Y[1],G=((n=k[E])===null||n===void 0?void 0:n.data)||{},Q=G.src,oe=PH(G,Mqt),ee=o0(!!f,{value:f,onChange:function(pe,Ie){p==null||p(pe,Ie,E)}}),q=gf(ee,2),ae=q[0],Z=q[1],ne=g.useState(null),te=gf(ne,2),$=te[0],le=te[1],de=g.useCallback(function(Pe,pe,Ie,ve){var ze=U?k.findIndex(function(Ae){return Ae.data.src===pe}):k.findIndex(function(Ae){return Ae.id===Pe});L(ze<0?0:ze),Z(!0),le({x:Ie,y:ve}),_(!0)},[k,U]);g.useEffect(function(){ae?O||L(0):_(!1)},[ae]);var he=function(pe,Ie){L(pe),S==null||S(pe,Ie)},me=function(){Z(!1),le(null)},ce=g.useMemo(function(){return{register:N,onPreview:de}},[N,de]);return g.createElement(SU.Provider,{value:ce},i,g.createElement(Qet,zA({"aria-hidden":!ae,movable:w,visible:ae,prefixCls:r,closeIcon:A,onClose:me,mousePosition:$,imgCommonProps:oe,src:Q,fallback:u,icons:l,minScale:x,maxScale:C,getContainer:m,current:E,count:k.length,countRender:P,onTransform:v,toolbarRender:b,imageRender:T,onChange:he},R)))},gCe=0;function zqt(t,e){var n=g.useState(function(){return gCe+=1,String(gCe)}),o=gf(n,1),r=o[0],i=g.useContext(SU),a={data:e,canPreview:t};return g.useEffect(function(){if(i)return i.register(r,a)},[]),g.useEffect(function(){i&&i.register(r,a)},[t,e]),r}var Dqt=["src","alt","onPreviewClose","prefixCls","previewPrefixCls","placeholder","fallback","width","height","style","preview","className","onClick","onError","wrapperClassName","wrapperStyle","rootClassName"],Eqt=["src","visible","onVisibleChange","getContainer","mask","maskClassName","movable","icons","scaleStep","minScale","maxScale","imageRender","toolbarRender"],i3e=function(e){var n=e.src,o=e.alt,r=e.onPreviewClose,i=e.prefixCls,a=i===void 0?"rc-image":i,l=e.previewPrefixCls,s=l===void 0?"".concat(a,"-preview"):l,c=e.placeholder,u=e.fallback,d=e.width,f=e.height,p=e.style,m=e.preview,y=m===void 0?!0:m,w=e.className,x=e.onClick,C=e.onError,P=e.wrapperClassName,A=e.wrapperStyle,S=e.rootClassName,v=PH(e,Dqt),b=c&&c!==!0,T=$b(y)==="object"?y:{},R=T.src,M=T.visible,D=M===void 0?void 0:M,k=T.onVisibleChange,N=k===void 0?r:k,U=T.getContainer,W=U===void 0?void 0:U,F=T.mask,E=T.maskClassName,L=T.movable,j=T.icons,Y=T.scaleStep,O=T.minScale,_=T.maxScale,G=T.imageRender,Q=T.toolbarRender,oe=PH(T,Eqt),ee=R??n,q=o0(!!D,{value:D,onChange:N}),ae=gf(q,2),Z=ae[0],ne=ae[1],te=qet({src:n,isCustomPlaceholder:b,fallback:u}),$=gf(te,3),le=$[0],de=$[1],he=$[2],me=g.useState(null),ce=gf(me,2),Pe=ce[0],pe=ce[1],Ie=g.useContext(SU),ve=!!y,ze=function(){ne(!1),pe(null)},Ae=Bn(a,P,S,T5({},"".concat(a,"-error"),he==="error")),se=g.useMemo(function(){var Me={};return Yhe.forEach(function(Ce){e[Ce]!==void 0&&(Me[Ce]=e[Ce])}),Me},Yhe.map(function(Me){return e[Me]})),ge=g.useMemo(function(){return hu(hu({},se),{},{src:ee})},[ee,se]),we=zqt(ve,ge),Se=function(Ce){var Te=fqt(Ce.target),Re=Te.left,Ne=Te.top;Ie?Ie.onPreview(we,ee,Re,Ne):(pe({x:Re,y:Ne}),ne(!0)),x==null||x(Ce)};return g.createElement(g.Fragment,null,g.createElement("div",zA({},v,{className:Ae,onClick:ve?Se:x,style:hu({width:d,height:f},A)}),g.createElement("img",zA({},se,{className:Bn("".concat(a,"-img"),T5({},"".concat(a,"-img-placeholder"),c===!0),w),style:hu({height:f},p),ref:le},de,{width:d,height:f,onError:C})),he==="loading"&&g.createElement("div",{"aria-hidden":"true",className:"".concat(a,"-placeholder")},c),F&&ve&&g.createElement("div",{className:Bn("".concat(a,"-mask"),E),style:{display:(p==null?void 0:p.display)==="none"?"none":void 0}},F)),!Ie&&ve&&g.createElement(Qet,zA({"aria-hidden":!Z,visible:Z,prefixCls:s,onClose:ze,mousePosition:Pe,src:ee,alt:o,imageInfo:{width:d,height:f},fallback:u,getContainer:W,icons:j,movable:L,scaleStep:Y,minScale:O,maxScale:_,rootClassName:S,imageRender:G,imgCommonProps:se,toolbarRender:Q},oe)))};i3e.PreviewGroup=Iqt;var kqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z"}},{tag:"path",attrs:{d:"M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z"}}]},name:"rotate-left",theme:"outlined"},Fqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:kqt}))},Lqt=g.forwardRef(Fqt),Wqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z"}},{tag:"path",attrs:{d:"M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z"}}]},name:"rotate-right",theme:"outlined"},Nqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Wqt}))},Uqt=g.forwardRef(Nqt),jqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"swap",theme:"outlined"},Bqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:jqt}))},mCe=g.forwardRef(Bqt),Yqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-in",theme:"outlined"},Oqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Yqt}))},_qt=g.forwardRef(Oqt),Vqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-out",theme:"outlined"},Gqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Vqt}))},Xqt=g.forwardRef(Gqt);const Ohe=t=>({position:t||"absolute",inset:0}),Jqt=t=>{const{iconCls:e,motionDurationSlow:n,paddingXXS:o,marginXXS:r,prefixCls:i,colorTextLightSolid:a}=t;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:a,background:new Di("#000").setA(.5).toRgbString(),cursor:"pointer",opacity:0,transition:`opacity ${n}`,[`.${i}-mask-info`]:Object.assign(Object.assign({},e7),{padding:`0 ${jt(o)}`,[e]:{marginInlineEnd:r,svg:{verticalAlign:"baseline"}}})}},Kqt=t=>{const{previewCls:e,modalMaskBg:n,paddingSM:o,marginXL:r,margin:i,paddingLG:a,previewOperationColorDisabled:l,previewOperationHoverColor:s,motionDurationSlow:c,iconCls:u,colorTextLightSolid:d}=t,f=new Di(n).setA(.1),p=f.clone().setA(.2);return{[`${e}-footer`]:{position:"fixed",bottom:r,left:{_skip_check_:!0,value:"50%"},display:"flex",flexDirection:"column",alignItems:"center",color:t.previewOperationColor,transform:"translateX(-50%)"},[`${e}-progress`]:{marginBottom:i},[`${e}-close`]:{position:"fixed",top:r,right:{_skip_check_:!0,value:r},display:"flex",color:d,backgroundColor:f.toRgbString(),borderRadius:"50%",padding:o,outline:0,border:0,cursor:"pointer",transition:`all ${c}`,"&:hover":{backgroundColor:p.toRgbString()},[`& > ${u}`]:{fontSize:t.previewOperationSize}},[`${e}-operations`]:{display:"flex",alignItems:"center",padding:`0 ${jt(a)}`,backgroundColor:f.toRgbString(),borderRadius:100,"&-operation":{marginInlineStart:o,padding:o,cursor:"pointer",transition:`all ${c}`,userSelect:"none",[`&:not(${e}-operations-operation-disabled):hover > ${u}`]:{color:s},"&-disabled":{color:l,cursor:"not-allowed"},"&:first-of-type":{marginInlineStart:0},[`& > ${u}`]:{fontSize:t.previewOperationSize}}}}},$qt=t=>{const{modalMaskBg:e,iconCls:n,previewOperationColorDisabled:o,previewCls:r,zIndexPopup:i,motionDurationSlow:a}=t,l=new Di(e).setA(.1),s=l.clone().setA(.2);return{[`${r}-switch-left, ${r}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:t.calc(i).add(1).equal(),display:"flex",alignItems:"center",justifyContent:"center",width:t.imagePreviewSwitchSize,height:t.imagePreviewSwitchSize,marginTop:t.calc(t.imagePreviewSwitchSize).mul(-1).div(2).equal(),color:t.previewOperationColor,background:l.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${a}`,userSelect:"none","&:hover":{background:s.toRgbString()},"&-disabled":{"&, &:hover":{color:o,background:"transparent",cursor:"not-allowed",[`> ${n}`]:{cursor:"not-allowed"}}},[`> ${n}`]:{fontSize:t.previewOperationSize}},[`${r}-switch-left`]:{insetInlineStart:t.marginSM},[`${r}-switch-right`]:{insetInlineEnd:t.marginSM}}},qqt=t=>{const{motionEaseOut:e,previewCls:n,motionDurationSlow:o,componentCls:r}=t;return[{[`${r}-preview-root`]:{[n]:{height:"100%",textAlign:"center",pointerEvents:"none"},[`${n}-body`]:Object.assign(Object.assign({},Ohe()),{overflow:"hidden"}),[`${n}-img`]:{maxWidth:"100%",maxHeight:"70%",verticalAlign:"middle",transform:"scale3d(1, 1, 1)",cursor:"grab",transition:`transform ${o} ${e} 0s`,userSelect:"none","&-wrapper":Object.assign(Object.assign({},Ohe()),{transition:`transform ${o} ${e} 0s`,display:"flex",justifyContent:"center",alignItems:"center","& > *":{pointerEvents:"auto"},"&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}})},[`${n}-moving`]:{[`${n}-preview-img`]:{cursor:"grabbing","&-wrapper":{transitionDuration:"0s"}}}}},{[`${r}-preview-root`]:{[`${n}-wrap`]:{zIndex:t.zIndexPopup}}},{[`${r}-preview-operations-wrapper`]:{position:"fixed",zIndex:t.calc(t.zIndexPopup).add(1).equal()},"&":[Kqt(t),$qt(t)]}]},Qqt=t=>{const{componentCls:e}=t;return{[e]:{position:"relative",display:"inline-block",[`${e}-img`]:{width:"100%",height:"auto",verticalAlign:"middle"},[`${e}-img-placeholder`]:{backgroundColor:t.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},[`${e}-mask`]:Object.assign({},Jqt(t)),[`${e}-mask:hover`]:{opacity:1},[`${e}-placeholder`]:Object.assign({},Ohe())}}},Zqt=t=>{const{previewCls:e}=t;return{[`${e}-root`]:QM(t,"zoom"),"&":aqe(t,!0)}},eQt=t=>({zIndexPopup:t.zIndexPopupBase+80,previewOperationColor:new Di(t.colorTextLightSolid).setA(.65).toRgbString(),previewOperationHoverColor:new Di(t.colorTextLightSolid).setA(.85).toRgbString(),previewOperationColorDisabled:new Di(t.colorTextLightSolid).setA(.25).toRgbString(),previewOperationSize:t.fontSizeIcon*1.5}),Zet=el("Image",t=>{const e=`${t.componentCls}-preview`,n=Ui(t,{previewCls:e,modalMaskBg:new Di("#000").setA(.45).toRgbString(),imagePreviewSwitchSize:t.controlHeightLG});return[Qqt(n),qqt(n),Iqe(Ui(n,{componentCls:e})),Zqt(n)]},eQt);var tQt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{previewPrefixCls:e,preview:n}=t,o=tQt(t,["previewPrefixCls","preview"]);const{getPrefixCls:r}=g.useContext(gr),i=r("image",e),a=`${i}-preview`,l=r(),s=nu(i),[c,u,d]=Zet(i,s),[f]=a6("ImagePreview",typeof n=="object"?n.zIndex:void 0),p=g.useMemo(()=>{var m;if(n===!1)return n;const y=typeof n=="object"?n:{},w=Mn(u,d,s,(m=y.rootClassName)!==null&&m!==void 0?m:"");return Object.assign(Object.assign({},y),{transitionName:L1(l,"zoom",y.transitionName),maskTransitionName:L1(l,"fade",y.maskTransitionName),rootClassName:w,zIndex:f})},[n]);return c(g.createElement(i3e.PreviewGroup,Object.assign({preview:p,previewPrefixCls:a,icons:ett},o)))};var yCe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e;const{prefixCls:n,preview:o,className:r,rootClassName:i,style:a}=t,l=yCe(t,["prefixCls","preview","className","rootClassName","style"]),{getPrefixCls:s,locale:c=I3,getPopupContainer:u,image:d}=g.useContext(gr),f=s("image",n),p=s(),m=c.Image||I3.Image,y=nu(f),[w,x,C]=Zet(f,y),P=Mn(i,x,C,y),A=Mn(r,x,d==null?void 0:d.className),[S]=a6("ImagePreview",typeof o=="object"?o.zIndex:void 0),v=g.useMemo(()=>{var T;if(o===!1)return o;const R=typeof o=="object"?o:{},{getContainer:M,closeIcon:D,rootClassName:k}=R,N=yCe(R,["getContainer","closeIcon","rootClassName"]);return Object.assign(Object.assign({mask:g.createElement("div",{className:`${f}-mask-info`},g.createElement(zet,null),m==null?void 0:m.preview),icons:ett},N),{rootClassName:Mn(P,k),getContainer:M??u,transitionName:L1(p,"zoom",R.transitionName),maskTransitionName:L1(p,"fade",R.maskTransitionName),zIndex:S,closeIcon:D??((T=d==null?void 0:d.preview)===null||T===void 0?void 0:T.closeIcon)})},[o,m,(e=d==null?void 0:d.preview)===null||e===void 0?void 0:e.closeIcon]),b=Object.assign(Object.assign({},d==null?void 0:d.style),a);return w(g.createElement(i3e,Object.assign({prefixCls:f,preview:v,rootClassName:P,className:A,style:b},l)))};dv.PreviewGroup=nQt;const a3e=function(){const t=Object.assign({},arguments.length<=0?void 0:arguments[0]);for(let e=1;e{const r=n[o];r!==void 0&&(t[o]=r)})}return t};var oQt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"},rQt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:oQt}))},ACe=g.forwardRef(rQt),iQt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"}}]},name:"double-right",theme:"outlined"},aQt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:iQt}))},wCe=g.forwardRef(aQt),lQt={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},sQt=[10,20,50,100],cQt=function(e){var n=e.pageSizeOptions,o=n===void 0?sQt:n,r=e.locale,i=e.changeSize,a=e.pageSize,l=e.goButton,s=e.quickGo,c=e.rootPrefixCls,u=e.disabled,d=e.buildOptionText,f=e.showSizeChanger,p=e.sizeChangerRender,m=xe.useState(""),y=Sn(m,2),w=y[0],x=y[1],C=function(){return!w||Number.isNaN(w)?void 0:Number(w)},P=typeof d=="function"?d:function(k){return"".concat(k," ").concat(r.items_per_page)},A=function(N){x(N.target.value)},S=function(N){l||w===""||(x(""),!(N.relatedTarget&&(N.relatedTarget.className.indexOf("".concat(c,"-item-link"))>=0||N.relatedTarget.className.indexOf("".concat(c,"-item"))>=0))&&(s==null||s(C())))},v=function(N){w!==""&&(N.keyCode===Lo.ENTER||N.type==="click")&&(x(""),s==null||s(C()))},b=function(){return o.some(function(N){return N.toString()===a.toString()})?o:o.concat([a]).sort(function(N,U){var W=Number.isNaN(Number(N))?0:Number(N),F=Number.isNaN(Number(U))?0:Number(U);return W-F})},T="".concat(c,"-options");if(!f&&!s)return null;var R=null,M=null,D=null;return f&&p&&(R=p({disabled:u,size:a,onSizeChange:function(N){i==null||i(Number(N))},"aria-label":r.page_size,className:"".concat(T,"-size-changer"),options:b().map(function(k){return{label:P(k),value:k}})})),s&&(l&&(D=typeof l=="boolean"?xe.createElement("button",{type:"button",onClick:v,onKeyUp:v,disabled:u,className:"".concat(T,"-quick-jumper-button")},r.jump_to_confirm):xe.createElement("span",{onClick:v,onKeyUp:v},l)),M=xe.createElement("div",{className:"".concat(T,"-quick-jumper")},r.jump_to,xe.createElement("input",{disabled:u,type:"text",value:w,onChange:A,onKeyUp:v,onBlur:S,"aria-label":r.page}),r.page,D)),xe.createElement("li",{className:T},R,M)},nE=function(e){var n=e.rootPrefixCls,o=e.page,r=e.active,i=e.className,a=e.showTitle,l=e.onClick,s=e.onKeyPress,c=e.itemRender,u="".concat(n,"-item"),d=Bn(u,"".concat(u,"-").concat(o),Ut(Ut({},"".concat(u,"-active"),r),"".concat(u,"-disabled"),!o),i),f=function(){l(o)},p=function(w){s(w,l,o)},m=c(o,"page",xe.createElement("a",{rel:"nofollow"},o));return m?xe.createElement("li",{title:a?String(o):null,className:d,onClick:f,onKeyDown:p,tabIndex:0},m):null},uQt=function(e,n,o){return o};function xCe(){}function vCe(t){var e=Number(t);return typeof e=="number"&&!Number.isNaN(e)&&isFinite(e)&&Math.floor(e)===e}function Gx(t,e,n){var o=typeof t>"u"?e:t;return Math.floor((n-1)/o)+1}var dQt=function(e){var n=e.prefixCls,o=n===void 0?"rc-pagination":n,r=e.selectPrefixCls,i=r===void 0?"rc-select":r,a=e.className,l=e.current,s=e.defaultCurrent,c=s===void 0?1:s,u=e.total,d=u===void 0?0:u,f=e.pageSize,p=e.defaultPageSize,m=p===void 0?10:p,y=e.onChange,w=y===void 0?xCe:y,x=e.hideOnSinglePage,C=e.align,P=e.showPrevNextJumpers,A=P===void 0?!0:P,S=e.showQuickJumper,v=e.showLessItems,b=e.showTitle,T=b===void 0?!0:b,R=e.onShowSizeChange,M=R===void 0?xCe:R,D=e.locale,k=D===void 0?lQt:D,N=e.style,U=e.totalBoundaryShowSizeChanger,W=U===void 0?50:U,F=e.disabled,E=e.simple,L=e.showTotal,j=e.showSizeChanger,Y=j===void 0?d>W:j,O=e.sizeChangerRender,_=e.pageSizeOptions,G=e.itemRender,Q=G===void 0?uQt:G,oe=e.jumpPrevIcon,ee=e.jumpNextIcon,q=e.prevIcon,ae=e.nextIcon,Z=xe.useRef(null),ne=o0(10,{value:f,defaultValue:m}),te=Sn(ne,2),$=te[0],le=te[1],de=o0(1,{value:l,defaultValue:c,postState:function(on){return Math.max(1,Math.min(on,Gx(void 0,$,d)))}}),he=Sn(de,2),me=he[0],ce=he[1],Pe=xe.useState(me),pe=Sn(Pe,2),Ie=pe[0],ve=pe[1];g.useEffect(function(){ve(me)},[me]);var ze=Math.max(1,me-(v?3:5)),Ae=Math.min(Gx(void 0,$,d),me+(v?3:5));function se(Ot,on){var qt=Ot||xe.createElement("button",{type:"button","aria-label":on,className:"".concat(o,"-item-link")});return typeof Ot=="function"&&(qt=xe.createElement(Ot,nn({},e))),qt}function ge(Ot){var on=Ot.target.value,qt=Gx(void 0,$,d),rn;return on===""?rn=on:Number.isNaN(Number(on))?rn=Ie:on>=qt?rn=qt:rn=Number(on),rn}function we(Ot){return vCe(Ot)&&Ot!==me&&vCe(d)&&d>0}var Se=d>$?S:!1;function Me(Ot){(Ot.keyCode===Lo.UP||Ot.keyCode===Lo.DOWN)&&Ot.preventDefault()}function Ce(Ot){var on=ge(Ot);switch(on!==Ie&&ve(on),Ot.keyCode){case Lo.ENTER:Ne(on);break;case Lo.UP:Ne(on-1);break;case Lo.DOWN:Ne(on+1);break}}function Te(Ot){Ne(ge(Ot))}function Re(Ot){var on=Gx(Ot,$,d),qt=me>on&&on!==0?on:me;le(Ot),ve(qt),M==null||M(me,Ot),ce(qt),w==null||w(qt,Ot)}function Ne(Ot){if(we(Ot)&&!F){var on=Gx(void 0,$,d),qt=Ot;return Ot>on?qt=on:Ot<1&&(qt=1),qt!==Ie&&ve(qt),ce(qt),w==null||w(qt,$),qt}return me}var _e=me>1,Ue=me2?qt-2:0),Pn=2;Pnd?d:me*$])),je=null,et=Gx(void 0,$,d);if(x&&d<=$)return null;var bt=[],St={rootPrefixCls:o,onClick:Ne,onKeyPress:Ye,showTitle:T,itemRender:Q,page:-1},Pt=me-1>0?me-1:0,Yt=me+1=at*2&&me!==3&&(bt[0]=xe.cloneElement(bt[0],{className:Bn("".concat(o,"-item-after-jump-prev"),bt[0].props.className)}),bt.unshift(tt)),et-me>=at*2&&me!==et-2){var pt=bt[bt.length-1];bt[bt.length-1]=xe.cloneElement(pt,{className:Bn("".concat(o,"-item-before-jump-next"),pt.props.className)}),bt.push(je)}ot!==1&&bt.unshift(xe.createElement(nE,Uo({},St,{key:1,page:1}))),it!==et&&bt.push(xe.createElement(nE,Uo({},St,{key:et,page:et})))}var ct=Qe(Pt);if(ct){var Xe=!_e||!et;ct=xe.createElement("li",{title:T?k.prev_page:null,onClick:qe,tabIndex:Xe?null:0,onKeyDown:lt,className:Bn("".concat(o,"-prev"),Ut({},"".concat(o,"-disabled"),Xe)),"aria-disabled":Xe},ct)}var ft=nt(Yt);if(ft){var wt,kt;E?(wt=!Ue,kt=_e?0:null):(wt=!Ue||!et,kt=wt?null:0),ft=xe.createElement("li",{title:T?k.next_page:null,onClick:Fe,tabIndex:kt,onKeyDown:Oe,className:Bn("".concat(o,"-next"),Ut({},"".concat(o,"-disabled"),wt)),"aria-disabled":wt},ft)}var Zt=Bn(o,a,Ut(Ut(Ut(Ut(Ut({},"".concat(o,"-start"),C==="start"),"".concat(o,"-center"),C==="center"),"".concat(o,"-end"),C==="end"),"".concat(o,"-simple"),E),"".concat(o,"-disabled"),F));return xe.createElement("ul",Uo({className:Zt,style:N,ref:Z},gt),Ve,ct,E?yt:bt,ft,xe.createElement(cQt,{locale:k,rootPrefixCls:o,disabled:F,selectPrefixCls:i,changeSize:Re,pageSize:$,pageSizeOptions:_,quickGo:Se?Ne:null,goButton:Ct,showSizeChanger:Y,sizeChangerRender:O}))};const fQt=t=>{const{componentCls:e}=t;return{[`${e}-disabled`]:{"&, &:hover":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}},[`&${e}-disabled`]:{cursor:"not-allowed",[`${e}-item`]:{cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},a:{color:t.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:t.colorBorder,backgroundColor:t.itemActiveBgDisabled,"&:hover, &:active":{backgroundColor:t.itemActiveBgDisabled},a:{color:t.itemActiveColorDisabled}}},[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},[`${e}-simple&`]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},[`${e}-simple-pager`]:{color:t.colorTextDisabled},[`${e}-jump-prev, ${e}-jump-next`]:{[`${e}-item-link-icon`]:{opacity:0},[`${e}-item-ellipsis`]:{opacity:1}}},[`&${e}-simple`]:{[`${e}-prev, ${e}-next`]:{[`&${e}-disabled ${e}-item-link`]:{"&:hover, &:active":{backgroundColor:"transparent"}}}}}},hQt=t=>{const{componentCls:e}=t;return{[`&${e}-mini ${e}-total-text, &${e}-mini ${e}-simple-pager`]:{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini ${e}-item`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.calc(t.itemSizeSM).sub(2).equal())},[`&${e}-mini:not(${e}-disabled) ${e}-item:not(${e}-item-active)`]:{backgroundColor:"transparent",borderColor:"transparent","&:hover":{backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},[`&${e}-mini ${e}-prev, &${e}-mini ${e}-next`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini:not(${e}-disabled)`]:{[`${e}-prev, ${e}-next`]:{[`&:hover ${e}-item-link`]:{backgroundColor:t.colorBgTextHover},[`&:active ${e}-item-link`]:{backgroundColor:t.colorBgTextActive},[`&${e}-disabled:hover ${e}-item-link`]:{backgroundColor:"transparent"}}},[` + `]:{cursor:"not-allowed !important"}},[`&-tooltip ${n}-tooltip-inner`]:{minWidth:"unset"}})}},Eet=(t,e)=>{const{componentCls:n,railSize:o,handleSize:r,dotSize:i,marginFull:a,calc:l}=t,s=e?"paddingBlock":"paddingInline",c=e?"width":"height",u=e?"height":"width",d=e?"insetBlockStart":"insetInlineStart",f=e?"top":"insetInlineStart",p=l(o).mul(3).sub(r).div(2).equal(),m=l(r).sub(o).div(2).equal(),y=e?{borderWidth:`${jt(m)} 0`,transform:`translateY(${jt(l(m).mul(-1).equal())})`}:{borderWidth:`0 ${jt(m)}`,transform:`translateX(${jt(t.calc(m).mul(-1).equal())})`};return{[s]:o,[u]:l(o).mul(3).equal(),[`${n}-rail`]:{[c]:"100%",[u]:o},[`${n}-track,${n}-tracks`]:{[u]:o},[`${n}-track-draggable`]:Object.assign({},y),[`${n}-handle`]:{[d]:p},[`${n}-mark`]:{insetInlineStart:0,top:0,[f]:l(o).mul(3).add(e?0:a).equal(),[c]:"100%"},[`${n}-step`]:{insetInlineStart:0,top:0,[f]:o,[c]:"100%",[u]:o},[`${n}-dot`]:{position:"absolute",[d]:l(o).sub(i).div(2).equal()}}},o$t=t=>{const{componentCls:e,marginPartWithMark:n}=t;return{[`${e}-horizontal`]:Object.assign(Object.assign({},Eet(t,!0)),{[`&${e}-with-marks`]:{marginBottom:n}})}},r$t=t=>{const{componentCls:e}=t;return{[`${e}-vertical`]:Object.assign(Object.assign({},Eet(t,!1)),{height:"100%"})}},i$t=t=>{const n=t.controlHeightLG/4,o=t.controlHeightSM/2,r=t.lineWidth+1,i=t.lineWidth+1*1.5,a=t.colorPrimary,l=new Di(a).setA(.2).toRgbString();return{controlSize:n,railSize:4,handleSize:n,handleSizeHover:o,dotSize:8,handleLineWidth:r,handleLineWidthHover:i,railBg:t.colorFillTertiary,railHoverBg:t.colorFillSecondary,trackBg:t.colorPrimaryBorder,trackHoverBg:t.colorPrimaryBorderHover,handleColor:t.colorPrimaryBorder,handleActiveColor:a,handleActiveOutlineColor:l,handleColorDisabled:new Di(t.colorTextDisabled).onBackground(t.colorBgContainer).toHexString(),dotBorderColor:t.colorBorderSecondary,dotActiveBorderColor:t.colorPrimaryBorder,trackBgDisabled:t.colorBgContainerDisabled}},a$t=el("Slider",t=>{const e=Ui(t,{marginPart:t.calc(t.controlHeight).sub(t.controlSize).div(2).equal(),marginFull:t.calc(t.controlSize).div(2).equal(),marginPartWithMark:t.calc(t.controlHeightLG).sub(t.controlSize).equal()});return[n$t(e),o$t(e),r$t(e)]},i$t);function ise(){const[t,e]=g.useState(!1),n=g.useRef(null),o=()=>{Hf.cancel(n.current)},r=i=>{o(),i?e(i):n.current=Hf(()=>{e(i)})};return g.useEffect(()=>o,[]),[t,r]}var l$t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rtypeof n=="number"?n.toString():""}const B0=xe.forwardRef((t,e)=>{var n,o,r,i,a,l,s,c,u,d;const{prefixCls:f,range:p,className:m,rootClassName:y,style:w,disabled:x,tooltipPrefixCls:C,tipFormatter:P,tooltipVisible:A,getTooltipPopupContainer:S,tooltipPlacement:v,tooltip:b={},onChangeComplete:T,classNames:R,styles:M}=t,D=l$t(t,["prefixCls","range","className","rootClassName","style","disabled","tooltipPrefixCls","tipFormatter","tooltipVisible","getTooltipPopupContainer","tooltipPlacement","tooltip","onChangeComplete","classNames","styles"]),{vertical:k}=t,{direction:N,slider:U,getPrefixCls:W,getPopupContainer:F}=xe.useContext(gr),E=xe.useContext(Bp),L=x??E,{handleRender:j,direction:Y}=xe.useContext(t$t),_=(Y||N)==="rtl",[G,Q]=ise(),[oe,ee]=ise(),$=Object.assign({},b),{open:ae,placement:Z,getPopupContainer:ne,prefixCls:te,formatter:q}=$,le=ae??A,de=(G||oe)&&le!==!1,he=s$t(q,P),[me,ce]=ise(),Pe=Re=>{T==null||T(Re),ce(!1)},pe=(Re,Ne)=>Re||(Ne?_?"left":"right":"top"),Ie=W("slider",f),[ve,ze,Ae]=a$t(Ie),se=Mn(m,U==null?void 0:U.className,(n=U==null?void 0:U.classNames)===null||n===void 0?void 0:n.root,R==null?void 0:R.root,y,{[`${Ie}-rtl`]:_,[`${Ie}-lock`]:me},ze,Ae);_&&!D.vertical&&(D.reverse=!D.reverse),xe.useEffect(()=>{const Re=()=>{Hf(()=>{ee(!1)},1)};return document.addEventListener("mouseup",Re),()=>{document.removeEventListener("mouseup",Re)}},[]);const ge=p&&!le,we=j||((Re,Ne)=>{const{index:_e}=Ne,Ue=Re.props;function qe(Ye,lt,Oe){var ut,ht,Qe,nt;Oe&&((ht=(ut=D)[Ye])===null||ht===void 0||ht.call(ut,lt)),(nt=(Qe=Ue)[Ye])===null||nt===void 0||nt.call(Qe,lt)}const Fe=Object.assign(Object.assign({},Ue),{onMouseEnter:Ye=>{Q(!0),qe("onMouseEnter",Ye)},onMouseLeave:Ye=>{Q(!1),qe("onMouseLeave",Ye)},onMouseDown:Ye=>{ee(!0),ce(!0),qe("onMouseDown",Ye)},onFocus:Ye=>{var lt;ee(!0),(lt=D.onFocus)===null||lt===void 0||lt.call(D,Ye),qe("onFocus",Ye,!0)},onBlur:Ye=>{var lt;ee(!1),(lt=D.onBlur)===null||lt===void 0||lt.call(D,Ye),qe("onBlur",Ye,!0)}}),He=xe.cloneElement(Re,Fe),Le=(!!le||de)&&he!==null;return ge?He:xe.createElement(rCe,Object.assign({},$,{prefixCls:W("tooltip",te??C),title:he?he(Ne.value):"",open:Le,placement:pe(Z??v,k),key:_e,classNames:{root:`${Ie}-tooltip`},getPopupContainer:ne||S||F}),He)}),Se=ge?(Re,Ne)=>{const _e=xe.cloneElement(Re,{style:Object.assign(Object.assign({},Re.props.style),{visibility:"hidden"})});return xe.createElement(rCe,Object.assign({},$,{prefixCls:W("tooltip",te??C),title:he?he(Ne.value):"",open:he!==null&&de,placement:pe(Z??v,k),key:"tooltip",classNames:{root:`${Ie}-tooltip`},getPopupContainer:ne||S||F,draggingDelete:Ne.draggingDelete}),_e)}:void 0,Me=Object.assign(Object.assign(Object.assign(Object.assign({},(o=U==null?void 0:U.styles)===null||o===void 0?void 0:o.root),U==null?void 0:U.style),M==null?void 0:M.root),w),Ce=Object.assign(Object.assign({},(r=U==null?void 0:U.styles)===null||r===void 0?void 0:r.tracks),M==null?void 0:M.tracks),Te=Mn((i=U==null?void 0:U.classNames)===null||i===void 0?void 0:i.tracks,R==null?void 0:R.tracks);return ve(xe.createElement(e$t,Object.assign({},D,{classNames:Object.assign({handle:Mn((a=U==null?void 0:U.classNames)===null||a===void 0?void 0:a.handle,R==null?void 0:R.handle),rail:Mn((l=U==null?void 0:U.classNames)===null||l===void 0?void 0:l.rail,R==null?void 0:R.rail),track:Mn((s=U==null?void 0:U.classNames)===null||s===void 0?void 0:s.track,R==null?void 0:R.track)},Te?{tracks:Te}:{}),styles:Object.assign({handle:Object.assign(Object.assign({},(c=U==null?void 0:U.styles)===null||c===void 0?void 0:c.handle),M==null?void 0:M.handle),rail:Object.assign(Object.assign({},(u=U==null?void 0:U.styles)===null||u===void 0?void 0:u.rail),M==null?void 0:M.rail),track:Object.assign(Object.assign({},(d=U==null?void 0:U.styles)===null||d===void 0?void 0:d.track),M==null?void 0:M.track)},Object.keys(Ce).length?{tracks:Ce}:{}),step:D.step,range:p,className:se,style:Me,disabled:L,ref:e,prefixCls:Ie,handleRender:we,activeHandleRender:Se,onChangeComplete:Pe})))});var c$t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"},u$t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:c$t}))},ket=g.forwardRef(u$t),d$t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},f$t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:d$t}))},Fet=g.forwardRef(f$t),h$t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z"}}]},name:"swap-right",theme:"outlined"},p$t=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:h$t}))},g$t=g.forwardRef(p$t);function m$t(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.yearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.quarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.monthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.weekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.placeholder:t.lang.placeholder}function y$t(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.rangeYearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.rangeQuarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.rangeMonthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.rangeWeekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.rangePlaceholder:t.lang.rangePlaceholder}function Let(t,e){const{allowClear:n=!0}=t,{clearIcon:o,removeIcon:r}=hQe(Object.assign(Object.assign({},t),{prefixCls:e,componentName:"DatePicker"}));return[g.useMemo(()=>n===!1?!1:Object.assign({clearIcon:o},n===!0?{}:n),[n,o]),r]}const[A$t,w$t]=["week","WeekPicker"],[x$t,v$t]=["month","MonthPicker"],[b$t,S$t]=["year","YearPicker"],[T$t,P$t]=["quarter","QuarterPicker"],[Wet,iCe]=["time","TimePicker"],C$t=t=>g.createElement(oo,Object.assign({size:"small",type:"primary"},t));function Net(t){return g.useMemo(()=>Object.assign({button:C$t},t),[t])}var R$t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rg.forwardRef((n,o)=>{var r;const{prefixCls:i,getPopupContainer:a,components:l,className:s,style:c,placement:u,size:d,disabled:f,bordered:p=!0,placeholder:m,popupClassName:y,dropdownClassName:w,status:x,rootClassName:C,variant:P,picker:A}=n,S=R$t(n,["prefixCls","getPopupContainer","components","className","style","placement","size","disabled","bordered","placeholder","popupClassName","dropdownClassName","status","rootClassName","variant","picker"]),v=g.useRef(null),{getPrefixCls:b,direction:T,getPopupContainer:R,rangePicker:M}=g.useContext(gr),D=b("picker",i),{compactSize:k,compactItemClassnames:N}=x4(D,T),U=b(),[W,F]=jS("rangePicker",P,p),E=nu(D),[L,j,Y]=oet(D,E),[O]=Let(n,D),_=Net(l),G=jd(de=>{var he;return(he=d??k)!==null&&he!==void 0?he:de}),Q=g.useContext(Bp),oe=f??Q,ee=g.useContext(W1),{hasFeedback:$,status:ae,feedbackIcon:Z}=ee,ne=g.createElement(g.Fragment,null,A===Wet?g.createElement(Fet,null):g.createElement(ket,null),$&&Z);g.useImperativeHandle(o,()=>v.current);const[te]=r6("Calendar",GX),q=Object.assign(Object.assign({},te),n.locale),[le]=a6("DatePicker",(r=n.popupStyle)===null||r===void 0?void 0:r.zIndex);return L(g.createElement(E3,{space:!0},g.createElement(fGt,Object.assign({separator:g.createElement("span",{"aria-label":"to",className:`${D}-separator`},g.createElement(g$t,null)),disabled:oe,ref:v,placement:u,placeholder:y$t(q,A,m),suffixIcon:ne,prevIcon:g.createElement("span",{className:`${D}-prev-icon`}),nextIcon:g.createElement("span",{className:`${D}-next-icon`}),superPrevIcon:g.createElement("span",{className:`${D}-super-prev-icon`}),superNextIcon:g.createElement("span",{className:`${D}-super-next-icon`}),transitionName:`${U}-slide-up`,picker:A},S,{className:Mn({[`${D}-${G}`]:G,[`${D}-${W}`]:F},o7(D,US(ae,x),$),j,N,s,M==null?void 0:M.className,Y,E,C),style:Object.assign(Object.assign({},M==null?void 0:M.style),c),locale:q.lang,prefixCls:D,getPopupContainer:a||R,generateConfig:t,components:_,direction:T,classNames:{popup:Mn(j,y||w,Y,E,C)},styles:{popup:Object.assign(Object.assign({},n.popupStyle),{zIndex:le})},allowClear:O}))))});var M$t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const e=(s,c)=>{const u=c===iCe?"timePicker":"datePicker";return g.forwardRef((f,p)=>{var m;const{prefixCls:y,getPopupContainer:w,components:x,style:C,className:P,rootClassName:A,size:S,bordered:v,placement:b,placeholder:T,popupClassName:R,dropdownClassName:M,disabled:D,status:k,variant:N,onCalendarChange:U}=f,W=M$t(f,["prefixCls","getPopupContainer","components","style","className","rootClassName","size","bordered","placement","placeholder","popupClassName","dropdownClassName","disabled","status","variant","onCalendarChange"]),{getPrefixCls:F,direction:E,getPopupContainer:L,[u]:j}=g.useContext(gr),Y=F("picker",y),{compactSize:O,compactItemClassnames:_}=x4(Y,E),G=g.useRef(null),[Q,oe]=jS("datePicker",N,v),ee=nu(Y),[$,ae,Z]=oet(Y,ee);g.useImperativeHandle(p,()=>G.current);const ne={showToday:!0},te=s||f.picker,q=F(),{onSelect:le,multiple:de}=W,he=le&&s==="time"&&!de,me=(Re,Ne,_e)=>{U==null||U(Re,Ne,_e),he&&le(Re)},[ce,Pe]=Let(f,Y),pe=Net(x),Ie=jd(Re=>{var Ne;return(Ne=S??O)!==null&&Ne!==void 0?Ne:Re}),ve=g.useContext(Bp),ze=D??ve,Ae=g.useContext(W1),{hasFeedback:se,status:ge,feedbackIcon:we}=Ae,Se=g.createElement(g.Fragment,null,te==="time"?g.createElement(Fet,null):g.createElement(ket,null),se&&we),[Me]=r6("DatePicker",GX),Ce=Object.assign(Object.assign({},Me),f.locale),[Te]=a6("DatePicker",(m=f.popupStyle)===null||m===void 0?void 0:m.zIndex);return $(g.createElement(E3,{space:!0},g.createElement(AGt,Object.assign({ref:G,placeholder:m$t(Ce,te,T),suffixIcon:Se,placement:b,prevIcon:g.createElement("span",{className:`${Y}-prev-icon`}),nextIcon:g.createElement("span",{className:`${Y}-next-icon`}),superPrevIcon:g.createElement("span",{className:`${Y}-super-prev-icon`}),superNextIcon:g.createElement("span",{className:`${Y}-super-next-icon`}),transitionName:`${q}-slide-up`,picker:s,onCalendarChange:me},ne,W,{locale:Ce.lang,className:Mn({[`${Y}-${Ie}`]:Ie,[`${Y}-${Q}`]:oe},o7(Y,US(ge,k),se),ae,_,j==null?void 0:j.className,P,Z,ee,A),style:Object.assign(Object.assign({},j==null?void 0:j.style),C),prefixCls:Y,getPopupContainer:w||L,generateConfig:t,components:pe,direction:E,disabled:ze,classNames:{popup:Mn(ae,Z,ee,A,R||M)},styles:{popup:Object.assign(Object.assign({},f.popupStyle),{zIndex:Te})},allowClear:ce,removeIcon:Pe}))))})},n=e(),o=e(A$t,w$t),r=e(x$t,v$t),i=e(b$t,S$t),a=e(T$t,P$t),l=e(Wet,iCe);return{DatePicker:n,WeekPicker:o,MonthPicker:r,YearPicker:i,TimePicker:l,QuarterPicker:a}},Uet=t=>{const{DatePicker:e,WeekPicker:n,MonthPicker:o,YearPicker:r,TimePicker:i,QuarterPicker:a}=I$t(t),l=H$t(t),s=e;return s.WeekPicker=n,s.MonthPicker=o,s.YearPicker=r,s.RangePicker=l,s.TimePicker=i,s.QuarterPicker=a,s},F7=Uet(Y_t),z$t=gU(F7,"popupAlign",void 0,"picker");F7._InternalPanelDoNotUseOrYouWillBeFired=z$t;const D$t=gU(F7.RangePicker,"popupAlign",void 0,"picker");F7._InternalRangePanelDoNotUseOrYouWillBeFired=D$t;F7.generatePicker=Uet;function LL(t){"@babel/helpers - typeof";return LL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},LL(t)}function E$t(t,e){if(LL(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(LL(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function k$t(t){var e=E$t(t,"string");return LL(e)=="symbol"?e:e+""}function Nhe(t,e,n){return e=k$t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aCe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function J2(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)continue;n[o]=t[o]}return n}function j$t(t,e){if(t==null)return{};var n=U$t(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var B$t=["prefixCls","className","containerRef"],Y$t=function(e){var n=e.prefixCls,o=e.className,r=e.containerRef,i=j$t(e,B$t),a=g.useContext(jet),l=a.panel,s=E7(l,r);return g.createElement("div",Yv({className:Bn("".concat(n,"-content"),o),role:"dialog",ref:s},F1(e,{aria:!0}),{"aria-modal":"true"},i))};function cCe(t){return typeof t=="string"&&String(Number(t))===t?(Ds(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(t)):t}var uCe={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function O$t(t,e){var n,o,r,i=t.prefixCls,a=t.open,l=t.placement,s=t.inline,c=t.push,u=t.forceRender,d=t.autoFocus,f=t.keyboard,p=t.classNames,m=t.rootClassName,y=t.rootStyle,w=t.zIndex,x=t.className,C=t.id,P=t.style,A=t.motion,S=t.width,v=t.height,b=t.children,T=t.mask,R=t.maskClosable,M=t.maskMotion,D=t.maskClassName,k=t.maskStyle,N=t.afterOpenChange,U=t.onClose,W=t.onMouseEnter,F=t.onMouseOver,E=t.onMouseLeave,L=t.onClick,j=t.onKeyDown,Y=t.onKeyUp,O=t.styles,_=t.drawerRender,G=g.useRef(),Q=g.useRef(),oe=g.useRef();g.useImperativeHandle(e,function(){return G.current});var ee=function(ze){var Ae=ze.keyCode,se=ze.shiftKey;switch(Ae){case Lo.TAB:{if(Ae===Lo.TAB){if(!se&&document.activeElement===oe.current){var ge;(ge=Q.current)===null||ge===void 0||ge.focus({preventScroll:!0})}else if(se&&document.activeElement===Q.current){var we;(we=oe.current)===null||we===void 0||we.focus({preventScroll:!0})}}break}case Lo.ESC:{U&&f&&(ze.stopPropagation(),U(ze));break}}};g.useEffect(function(){if(a&&d){var ve;(ve=G.current)===null||ve===void 0||ve.focus({preventScroll:!0})}},[a]);var $=g.useState(!1),ae=Uhe($,2),Z=ae[0],ne=ae[1],te=g.useContext(sCe),q;typeof c=="boolean"?q=c?{}:{distance:0}:q=c||{};var le=(n=(o=(r=q)===null||r===void 0?void 0:r.distance)!==null&&o!==void 0?o:te==null?void 0:te.pushDistance)!==null&&n!==void 0?n:180,de=g.useMemo(function(){return{pushDistance:le,push:function(){ne(!0)},pull:function(){ne(!1)}}},[le]);g.useEffect(function(){if(a){var ve;te==null||(ve=te.push)===null||ve===void 0||ve.call(te)}else{var ze;te==null||(ze=te.pull)===null||ze===void 0||ze.call(te)}},[a]),g.useEffect(function(){return function(){var ve;te==null||(ve=te.pull)===null||ve===void 0||ve.call(te)}},[]);var he=T&&g.createElement(Oy,Yv({key:"mask"},M,{visible:a}),function(ve,ze){var Ae=ve.className,se=ve.style;return g.createElement("div",{className:Bn("".concat(i,"-mask"),Ae,p==null?void 0:p.mask,D),style:J2(J2(J2({},se),k),O==null?void 0:O.mask),onClick:R&&a?U:void 0,ref:ze})}),me=typeof A=="function"?A(l):A,ce={};if(Z&&le)switch(l){case"top":ce.transform="translateY(".concat(le,"px)");break;case"bottom":ce.transform="translateY(".concat(-le,"px)");break;case"left":ce.transform="translateX(".concat(le,"px)");break;default:ce.transform="translateX(".concat(-le,"px)");break}l==="left"||l==="right"?ce.width=cCe(S):ce.height=cCe(v);var Pe={onMouseEnter:W,onMouseOver:F,onMouseLeave:E,onClick:L,onKeyDown:j,onKeyUp:Y},pe=g.createElement(Oy,Yv({key:"panel"},me,{visible:a,forceRender:u,onVisibleChanged:function(ze){N==null||N(ze)},removeOnLeave:!1,leavedClassName:"".concat(i,"-content-wrapper-hidden")}),function(ve,ze){var Ae=ve.className,se=ve.style,ge=g.createElement(Y$t,Yv({id:C,containerRef:ze,prefixCls:i,className:Bn(x,p==null?void 0:p.content),style:J2(J2({},P),O==null?void 0:O.content)},F1(t,{aria:!0}),Pe),b);return g.createElement("div",Yv({className:Bn("".concat(i,"-content-wrapper"),p==null?void 0:p.wrapper,Ae),style:J2(J2(J2({},ce),se),O==null?void 0:O.wrapper)},F1(t,{data:!0})),_?_(ge):ge)}),Ie=J2({},y);return w&&(Ie.zIndex=w),g.createElement(sCe.Provider,{value:de},g.createElement("div",{className:Bn(i,"".concat(i,"-").concat(l),m,Nhe(Nhe({},"".concat(i,"-open"),a),"".concat(i,"-inline"),s)),style:Ie,tabIndex:-1,ref:G,onKeyDown:ee},he,g.createElement("div",{tabIndex:0,ref:Q,style:uCe,"aria-hidden":"true","data-sentinel":"start"}),pe,g.createElement("div",{tabIndex:0,ref:oe,style:uCe,"aria-hidden":"true","data-sentinel":"end"})))}var _$t=g.forwardRef(O$t),V$t=function(e){var n=e.open,o=n===void 0?!1:n,r=e.prefixCls,i=r===void 0?"rc-drawer":r,a=e.placement,l=a===void 0?"right":a,s=e.autoFocus,c=s===void 0?!0:s,u=e.keyboard,d=u===void 0?!0:u,f=e.width,p=f===void 0?378:f,m=e.mask,y=m===void 0?!0:m,w=e.maskClosable,x=w===void 0?!0:w,C=e.getContainer,P=e.forceRender,A=e.afterOpenChange,S=e.destroyOnClose,v=e.onMouseEnter,b=e.onMouseOver,T=e.onMouseLeave,R=e.onClick,M=e.onKeyDown,D=e.onKeyUp,k=e.panelRef,N=g.useState(!1),U=Uhe(N,2),W=U[0],F=U[1],E=g.useState(!1),L=Uhe(E,2),j=L[0],Y=L[1];Ml(function(){Y(!0)},[]);var O=j?o:!1,_=g.useRef(),G=g.useRef();Ml(function(){O&&(G.current=document.activeElement)},[O]);var Q=function(Z){var ne;if(F(Z),A==null||A(Z),!Z&&G.current&&!((ne=_.current)!==null&&ne!==void 0&&ne.contains(G.current))){var te;(te=G.current)===null||te===void 0||te.focus({preventScroll:!0})}},oe=g.useMemo(function(){return{panel:k}},[k]);if(!P&&!W&&!O&&S)return null;var ee={onMouseEnter:v,onMouseOver:b,onMouseLeave:T,onClick:R,onKeyDown:M,onKeyUp:D},$=J2(J2({},e),{},{open:O,prefixCls:i,placement:l,autoFocus:c,keyboard:d,width:p,mask:y,maskClosable:x,inline:C===!1,afterOpenChange:Q,ref:_},ee);return g.createElement(jet.Provider,{value:oe},g.createElement(uU,{open:O||P||W,autoDestroy:!1,getContainer:C,autoLock:y&&(O||W)},g.createElement(_$t,$)))};const Bet=t=>{var e,n;const{prefixCls:o,title:r,footer:i,extra:a,loading:l,onClose:s,headerStyle:c,bodyStyle:u,footerStyle:d,children:f,classNames:p,styles:m}=t,{drawer:y}=g.useContext(gr),w=g.useCallback(S=>g.createElement("button",{type:"button",onClick:s,"aria-label":"Close",className:`${o}-close`},S),[s]),[x,C]=u9e(SH(t),SH(y),{closable:!0,closeIconRender:w}),P=g.useMemo(()=>{var S,v;return!r&&!x?null:g.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(S=y==null?void 0:y.styles)===null||S===void 0?void 0:S.header),c),m==null?void 0:m.header),className:Mn(`${o}-header`,{[`${o}-header-close-only`]:x&&!r&&!a},(v=y==null?void 0:y.classNames)===null||v===void 0?void 0:v.header,p==null?void 0:p.header)},g.createElement("div",{className:`${o}-header-title`},C,r&&g.createElement("div",{className:`${o}-title`},r)),a&&g.createElement("div",{className:`${o}-extra`},a))},[x,C,a,c,o,r]),A=g.useMemo(()=>{var S,v;if(!i)return null;const b=`${o}-footer`;return g.createElement("div",{className:Mn(b,(S=y==null?void 0:y.classNames)===null||S===void 0?void 0:S.footer,p==null?void 0:p.footer),style:Object.assign(Object.assign(Object.assign({},(v=y==null?void 0:y.styles)===null||v===void 0?void 0:v.footer),d),m==null?void 0:m.footer)},i)},[i,d,o]);return g.createElement(g.Fragment,null,P,g.createElement("div",{className:Mn(`${o}-body`,p==null?void 0:p.body,(e=y==null?void 0:y.classNames)===null||e===void 0?void 0:e.body),style:Object.assign(Object.assign(Object.assign({},(n=y==null?void 0:y.styles)===null||n===void 0?void 0:n.body),u),m==null?void 0:m.body)},l?g.createElement(NS,{active:!0,title:!1,paragraph:{rows:5},className:`${o}-body-skeleton`}):f),A)},G$t=t=>{const e="100%";return{left:`translateX(-${e})`,right:`translateX(${e})`,top:`translateY(-${e})`,bottom:`translateY(${e})`}[t]},Yet=(t,e)=>({"&-enter, &-appear":Object.assign(Object.assign({},t),{"&-active":e}),"&-leave":Object.assign(Object.assign({},e),{"&-active":t})}),Oet=(t,e)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${e}`}}},Yet({opacity:t},{opacity:1})),X$t=(t,e)=>[Oet(.7,e),Yet({transform:G$t(t)},{transform:"none"})],J$t=t=>{const{componentCls:e,motionDurationSlow:n}=t;return{[e]:{[`${e}-mask-motion`]:Oet(0,n),[`${e}-panel-motion`]:["left","right","top","bottom"].reduce((o,r)=>Object.assign(Object.assign({},o),{[`&-${r}`]:X$t(r,n)}),{})}}},K$t=t=>{const{borderRadiusSM:e,componentCls:n,zIndexPopup:o,colorBgMask:r,colorBgElevated:i,motionDurationSlow:a,motionDurationMid:l,paddingXS:s,padding:c,paddingLG:u,fontSizeLG:d,lineHeightLG:f,lineWidth:p,lineType:m,colorSplit:y,marginXS:w,colorIcon:x,colorIconHover:C,colorBgTextHover:P,colorBgTextActive:A,colorText:S,fontWeightStrong:v,footerPaddingBlock:b,footerPaddingInline:T,calc:R}=t,M=`${n}-content-wrapper`;return{[n]:{position:"fixed",inset:0,zIndex:o,pointerEvents:"none",color:S,"&-pure":{position:"relative",background:i,display:"flex",flexDirection:"column",[`&${n}-left`]:{boxShadow:t.boxShadowDrawerLeft},[`&${n}-right`]:{boxShadow:t.boxShadowDrawerRight},[`&${n}-top`]:{boxShadow:t.boxShadowDrawerUp},[`&${n}-bottom`]:{boxShadow:t.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${n}-mask`]:{position:"absolute",inset:0,zIndex:o,background:r,pointerEvents:"auto"},[M]:{position:"absolute",zIndex:o,maxWidth:"100vw",transition:`all ${a}`,"&-hidden":{display:"none"}},[`&-left > ${M}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:t.boxShadowDrawerLeft},[`&-right > ${M}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:t.boxShadowDrawerRight},[`&-top > ${M}`]:{top:0,insetInline:0,boxShadow:t.boxShadowDrawerUp},[`&-bottom > ${M}`]:{bottom:0,insetInline:0,boxShadow:t.boxShadowDrawerDown},[`${n}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:i,pointerEvents:"auto"},[`${n}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${jt(c)} ${jt(u)}`,fontSize:d,lineHeight:f,borderBottom:`${jt(p)} ${m} ${y}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${n}-extra`]:{flex:"none"},[`${n}-close`]:Object.assign({display:"inline-flex",width:R(d).add(s).equal(),height:R(d).add(s).equal(),borderRadius:e,justifyContent:"center",alignItems:"center",marginInlineEnd:w,color:x,fontWeight:v,fontSize:d,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${l}`,textRendering:"auto","&:hover":{color:C,backgroundColor:P,textDecoration:"none"},"&:active":{backgroundColor:A}},Yy(t)),[`${n}-title`]:{flex:1,margin:0,fontWeight:t.fontWeightStrong,fontSize:d,lineHeight:f},[`${n}-body`]:{flex:1,minWidth:0,minHeight:0,padding:u,overflow:"auto",[`${n}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},[`${n}-footer`]:{flexShrink:0,padding:`${jt(b)} ${jt(T)}`,borderTop:`${jt(p)} ${m} ${y}`},"&-rtl":{direction:"rtl"}}}},$$t=t=>({zIndexPopup:t.zIndexPopupBase,footerPaddingBlock:t.paddingXS,footerPaddingInline:t.padding}),_et=el("Drawer",t=>{const e=Ui(t,{});return[K$t(e),J$t(e)]},$$t);var Vet=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{rootClassName:e,width:n,height:o,size:r="default",mask:i=!0,push:a=q$t,open:l,afterOpenChange:s,onClose:c,prefixCls:u,getContainer:d,style:f,className:p,visible:m,afterVisibleChange:y,maskStyle:w,drawerStyle:x,contentWrapperStyle:C}=t,P=Vet(t,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","style","className","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle"]),{getPopupContainer:A,getPrefixCls:S,direction:v,drawer:b}=g.useContext(gr),T=S("drawer",u),[R,M,D]=_et(T),k=d===void 0&&A?()=>A(document.body):d,N=Mn({"no-mask":!i,[`${T}-rtl`]:v==="rtl"},e,M,D),U=g.useMemo(()=>n??(r==="large"?736:378),[n,r]),W=g.useMemo(()=>o??(r==="large"?736:378),[o,r]),F={motionName:L1(T,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},E=oe=>({motionName:L1(T,`panel-motion-${oe}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),L=Cqe(),[j,Y]=a6("Drawer",P.zIndex),{classNames:O={},styles:_={}}=P,{classNames:G={},styles:Q={}}=b||{};return R(g.createElement(E3,{form:!0,space:!0},g.createElement(iU.Provider,{value:Y},g.createElement(V$t,Object.assign({prefixCls:T,onClose:c,maskMotion:F,motion:E},P,{classNames:{mask:Mn(O.mask,G.mask),content:Mn(O.content,G.content),wrapper:Mn(O.wrapper,G.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},_.mask),w),Q.mask),content:Object.assign(Object.assign(Object.assign({},_.content),x),Q.content),wrapper:Object.assign(Object.assign(Object.assign({},_.wrapper),C),Q.wrapper)},open:l??m,mask:i,push:a,width:U,height:W,style:Object.assign(Object.assign({},b==null?void 0:b.style),f),className:Mn(b==null?void 0:b.className,p),rootClassName:N,getContainer:k,afterOpenChange:s??y,panelRef:L,zIndex:j}),g.createElement(Bet,Object.assign({prefixCls:T},P,{onClose:c}))))))},Q$t=t=>{const{prefixCls:e,style:n,className:o,placement:r="right"}=t,i=Vet(t,["prefixCls","style","className","placement"]),{getPrefixCls:a}=g.useContext(gr),l=a("drawer",e),[s,c,u]=_et(l),d=Mn(l,`${l}-pure`,`${l}-${r}`,c,u,o);return s(g.createElement("div",{className:d,style:n},g.createElement(Bet,Object.assign({prefixCls:l},i))))};jhe._InternalPanelDoNotUseOrYouWillBeFired=Q$t;function dCe(t){return["small","middle","large"].includes(t)}function fCe(t){return t?typeof t=="number"&&!Number.isNaN(t):!1}const Get=xe.createContext({latestIndex:0}),Z$t=Get.Provider,eqt=t=>{let{className:e,index:n,children:o,split:r,style:i}=t;const{latestIndex:a}=g.useContext(Get);return o==null?null:g.createElement(g.Fragment,null,g.createElement("div",{className:e,style:i},o),n{var n,o,r;const{getPrefixCls:i,space:a,direction:l}=g.useContext(gr),{size:s=(n=a==null?void 0:a.size)!==null&&n!==void 0?n:"small",align:c,className:u,rootClassName:d,children:f,direction:p="horizontal",prefixCls:m,split:y,style:w,wrap:x=!1,classNames:C,styles:P}=t,A=tqt(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[S,v]=Array.isArray(s)?s:[s,s],b=dCe(v),T=dCe(S),R=fCe(v),M=fCe(S),D=jy(f,{keepEmpty:!0}),k=c===void 0&&p==="horizontal"?"center":c,N=i("space",m),[U,W,F]=q$e(N),E=Mn(N,a==null?void 0:a.className,W,`${N}-${p}`,{[`${N}-rtl`]:l==="rtl",[`${N}-align-${k}`]:k,[`${N}-gap-row-${v}`]:b,[`${N}-gap-col-${S}`]:T},u,d,F),L=Mn(`${N}-item`,(o=C==null?void 0:C.item)!==null&&o!==void 0?o:(r=a==null?void 0:a.classNames)===null||r===void 0?void 0:r.item);let j=0;const Y=D.map((G,Q)=>{var oe,ee;G!=null&&(j=Q);const $=(G==null?void 0:G.key)||`${L}-${Q}`;return g.createElement(eqt,{className:L,key:$,index:Q,split:y,style:(oe=P==null?void 0:P.item)!==null&&oe!==void 0?oe:(ee=a==null?void 0:a.styles)===null||ee===void 0?void 0:ee.item},G)}),O=g.useMemo(()=>({latestIndex:j}),[j]);if(D.length===0)return null;const _={};return x&&(_.flexWrap="wrap"),!T&&M&&(_.columnGap=S),!b&&R&&(_.rowGap=v),U(g.createElement("div",Object.assign({ref:e,className:E,style:Object.assign(Object.assign(Object.assign({},_),a==null?void 0:a.style),w)},A),g.createElement(Z$t,{value:O},Y)))}),Jt=nqt;Jt.Compact=RFt;var oqt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPopupContainer:e,getPrefixCls:n,direction:o}=g.useContext(gr),{prefixCls:r,type:i="default",danger:a,disabled:l,loading:s,onClick:c,htmlType:u,children:d,className:f,menu:p,arrow:m,autoFocus:y,overlay:w,trigger:x,align:C,open:P,onOpenChange:A,placement:S,getPopupContainer:v,href:b,icon:T=g.createElement(z9e,null),title:R,buttonsRender:M=ae=>ae,mouseEnterDelay:D,mouseLeaveDelay:k,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:F}=t,E=oqt(t,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","dropdownRender"]),L=n("dropdown",r),j=`${L}-button`,Y={menu:p,arrow:m,autoFocus:y,align:C,disabled:l,trigger:l?[]:x,onOpenChange:A,getPopupContainer:v||e,mouseEnterDelay:D,mouseLeaveDelay:k,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:F},{compactSize:O,compactItemClassnames:_}=x4(L,o),G=Mn(j,_,f);"overlay"in t&&(Y.overlay=w),"open"in t&&(Y.open=P),"placement"in t?Y.placement=S:Y.placement=o==="rtl"?"bottomLeft":"bottomRight";const Q=g.createElement(oo,{type:i,danger:a,disabled:l,loading:s,onClick:c,htmlType:u,href:b,title:R},d),oe=g.createElement(oo,{type:i,danger:a,icon:T}),[ee,$]=M([Q,oe]);return g.createElement(Jt.Compact,Object.assign({className:G,size:O,block:!0},E),ee,g.createElement(VZ,Object.assign({},Y),$))};Xet.__ANT_BUTTON=!0;const e4=VZ;e4.Button=Xet;var rqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},iqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:rqt}))},t4=g.forwardRef(iqt);function zA(){return zA=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function PH(t,e){if(t==null)return{};var n=dqt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function Ket(){var t=document.documentElement.clientWidth,e=window.innerHeight||document.documentElement.clientHeight;return{width:t,height:e}}function fqt(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:e.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}function rR(t,e,n,o){var r=XA.unstable_batchedUpdates?function(a){XA.unstable_batchedUpdates(n,a)}:n;return t!=null&&t.addEventListener&&t.addEventListener(e,r,o),{remove:function(){t!=null&&t.removeEventListener&&t.removeEventListener(e,r,o)}}}var SU=g.createContext(null),hqt=function(e){var n=e.visible,o=e.maskTransitionName,r=e.getContainer,i=e.prefixCls,a=e.rootClassName,l=e.icons,s=e.countRender,c=e.showSwitch,u=e.showProgress,d=e.current,f=e.transform,p=e.count,m=e.scale,y=e.minScale,w=e.maxScale,x=e.closeIcon,C=e.onActive,P=e.onClose,A=e.onZoomIn,S=e.onZoomOut,v=e.onRotateRight,b=e.onRotateLeft,T=e.onFlipX,R=e.onFlipY,M=e.onReset,D=e.toolbarRender,k=e.zIndex,N=e.image,U=g.useContext(SU),W=l.rotateLeft,F=l.rotateRight,E=l.zoomIn,L=l.zoomOut,j=l.close,Y=l.left,O=l.right,_=l.flipX,G=l.flipY,Q="".concat(i,"-operations-operation");g.useEffect(function(){var me=function(Pe){Pe.keyCode===Lo.ESC&&P()};return n&&window.addEventListener("keydown",me),function(){window.removeEventListener("keydown",me)}},[n]);var oe=function(ce,Pe){ce.preventDefault(),ce.stopPropagation(),C(Pe)},ee=g.useCallback(function(me){var ce=me.type,Pe=me.disabled,pe=me.onClick,Ie=me.icon;return g.createElement("div",{key:ce,className:Bn(Q,"".concat(i,"-operations-operation-").concat(ce),T5({},"".concat(i,"-operations-operation-disabled"),!!Pe)),onClick:pe},Ie)},[Q,i]),$=c?ee({icon:Y,onClick:function(ce){return oe(ce,-1)},type:"prev",disabled:d===0}):void 0,ae=c?ee({icon:O,onClick:function(ce){return oe(ce,1)},type:"next",disabled:d===p-1}):void 0,Z=ee({icon:G,onClick:R,type:"flipY"}),ne=ee({icon:_,onClick:T,type:"flipX"}),te=ee({icon:W,onClick:b,type:"rotateLeft"}),q=ee({icon:F,onClick:v,type:"rotateRight"}),le=ee({icon:L,onClick:S,type:"zoomOut",disabled:m<=y}),de=ee({icon:E,onClick:A,type:"zoomIn",disabled:m===w}),he=g.createElement("div",{className:"".concat(i,"-operations")},Z,ne,te,q,le,de);return g.createElement(Oy,{visible:n,motionName:o},function(me){var ce=me.className,Pe=me.style;return g.createElement(uU,{open:!0,getContainer:r??document.body},g.createElement("div",{className:Bn("".concat(i,"-operations-wrapper"),ce,a),style:hu(hu({},Pe),{},{zIndex:k})},x===null?null:g.createElement("button",{className:"".concat(i,"-close"),onClick:P},x||j),c&&g.createElement(g.Fragment,null,g.createElement("div",{className:Bn("".concat(i,"-switch-left"),T5({},"".concat(i,"-switch-left-disabled"),d===0)),onClick:function(Ie){return oe(Ie,-1)}},Y),g.createElement("div",{className:Bn("".concat(i,"-switch-right"),T5({},"".concat(i,"-switch-right-disabled"),d===p-1)),onClick:function(Ie){return oe(Ie,1)}},O)),g.createElement("div",{className:"".concat(i,"-footer")},u&&g.createElement("div",{className:"".concat(i,"-progress")},s?s(d+1,p):"".concat(d+1," / ").concat(p)),D?D(he,hu(hu({icons:{prevIcon:$,nextIcon:ae,flipYIcon:Z,flipXIcon:ne,rotateLeftIcon:te,rotateRightIcon:q,zoomOutIcon:le,zoomInIcon:de},actions:{onActive:C,onFlipY:R,onFlipX:T,onRotateLeft:b,onRotateRight:v,onZoomOut:S,onZoomIn:A,onReset:M,onClose:P},transform:f},U?{current:d,total:p}:{}),{},{image:N})):he)))})},ZO={x:0,y:0,rotate:0,scale:1,flipX:!1,flipY:!1};function pqt(t,e,n,o){var r=g.useRef(null),i=g.useRef([]),a=g.useState(ZO),l=gf(a,2),s=l[0],c=l[1],u=function(m){c(ZO),Vb(ZO,s)||o==null||o({transform:ZO,action:m})},d=function(m,y){r.current===null&&(i.current=[],r.current=Ic(function(){c(function(w){var x=w;return i.current.forEach(function(C){x=hu(hu({},x),C)}),r.current=null,o==null||o({transform:x,action:y}),x})})),i.current.push(hu(hu({},s),m))},f=function(m,y,w,x,C){var P=t.current,A=P.width,S=P.height,v=P.offsetWidth,b=P.offsetHeight,T=P.offsetLeft,R=P.offsetTop,M=m,D=s.scale*m;D>n?(D=n,M=n/s.scale):Do){if(e>0)return T5({},t,i);if(e<0&&ro)return T5({},t,e<0?i:-i);return{}}function $et(t,e,n,o){var r=Ket(),i=r.width,a=r.height,l=null;return t<=i&&e<=a?l={x:0,y:0}:(t>i||e>a)&&(l=hu(hu({},pCe("x",n,t,i)),pCe("y",o,e,a))),l}var iR=1,gqt=1;function mqt(t,e,n,o,r,i,a){var l=r.rotate,s=r.scale,c=r.x,u=r.y,d=g.useState(!1),f=gf(d,2),p=f[0],m=f[1],y=g.useRef({diffX:0,diffY:0,transformX:0,transformY:0}),w=function(S){!e||S.button!==0||(S.preventDefault(),S.stopPropagation(),y.current={diffX:S.pageX-c,diffY:S.pageY-u,transformX:c,transformY:u},m(!0))},x=function(S){n&&p&&i({x:S.pageX-y.current.diffX,y:S.pageY-y.current.diffY},"move")},C=function(){if(n&&p){m(!1);var S=y.current,v=S.transformX,b=S.transformY,T=c!==v&&u!==b;if(!T)return;var R=t.current.offsetWidth*s,M=t.current.offsetHeight*s,D=t.current.getBoundingClientRect(),k=D.left,N=D.top,U=l%180!==0,W=$et(U?M:R,U?R:M,k,N);W&&i(hu({},W),"dragRebound")}},P=function(S){if(!(!n||S.deltaY==0)){var v=Math.abs(S.deltaY/100),b=Math.min(v,gqt),T=iR+b*o;S.deltaY>0&&(T=iR/T),a(T,"wheel",S.clientX,S.clientY)}};return g.useEffect(function(){var A,S,v,b;if(e){v=rR(window,"mouseup",C,!1),b=rR(window,"mousemove",x,!1);try{window.top!==window.self&&(A=rR(window.top,"mouseup",C,!1),S=rR(window.top,"mousemove",x,!1))}catch{}}return function(){var T,R,M,D;(T=v)===null||T===void 0||T.remove(),(R=b)===null||R===void 0||R.remove(),(M=A)===null||M===void 0||M.remove(),(D=S)===null||D===void 0||D.remove()}},[n,p,c,u,l,e]),{isMoving:p,onMouseDown:w,onMouseMove:x,onMouseUp:C,onWheel:P}}function yqt(t){return new Promise(function(e){var n=document.createElement("img");n.onerror=function(){return e(!1)},n.onload=function(){return e(!0)},n.src=t})}function qet(t){var e=t.src,n=t.isCustomPlaceholder,o=t.fallback,r=g.useState(n?"loading":"normal"),i=gf(r,2),a=i[0],l=i[1],s=g.useRef(!1),c=a==="error";g.useEffect(function(){var p=!0;return yqt(e).then(function(m){!m&&p&&l("error")}),function(){p=!1}},[e]),g.useEffect(function(){n&&!s.current?l("loading"):c&&l("normal")},[e]);var u=function(){l("normal")},d=function(m){s.current=!1,a==="loading"&&m!==null&&m!==void 0&&m.complete&&(m.naturalWidth||m.naturalHeight)&&(s.current=!0,u())},f=c&&o?{src:o}:{onLoad:u,src:e};return[d,f,a]}function mJ(t,e){var n=t.x-e.x,o=t.y-e.y;return Math.hypot(n,o)}function Aqt(t,e,n,o){var r=mJ(t,n),i=mJ(e,o);if(r===0&&i===0)return[t.x,t.y];var a=r/(r+i),l=t.x+a*(e.x-t.x),s=t.y+a*(e.y-t.y);return[l,s]}function wqt(t,e,n,o,r,i,a){var l=r.rotate,s=r.scale,c=r.x,u=r.y,d=g.useState(!1),f=gf(d,2),p=f[0],m=f[1],y=g.useRef({point1:{x:0,y:0},point2:{x:0,y:0},eventType:"none"}),w=function(S){y.current=hu(hu({},y.current),S)},x=function(S){if(e){S.stopPropagation(),m(!0);var v=S.touches,b=v===void 0?[]:v;b.length>1?w({point1:{x:b[0].clientX,y:b[0].clientY},point2:{x:b[1].clientX,y:b[1].clientY},eventType:"touchZoom"}):w({point1:{x:b[0].clientX-c,y:b[0].clientY-u},eventType:"move"})}},C=function(S){var v=S.touches,b=v===void 0?[]:v,T=y.current,R=T.point1,M=T.point2,D=T.eventType;if(b.length>1&&D==="touchZoom"){var k={x:b[0].clientX,y:b[0].clientY},N={x:b[1].clientX,y:b[1].clientY},U=Aqt(R,M,k,N),W=gf(U,2),F=W[0],E=W[1],L=mJ(k,N)/mJ(R,M);a(L,"touchZoom",F,E,!0),w({point1:k,point2:N,eventType:"touchZoom"})}else D==="move"&&(i({x:b[0].clientX-R.x,y:b[0].clientY-R.y},"move"),w({eventType:"move"}))},P=function(){if(n){if(p&&m(!1),w({eventType:"none"}),o>s)return i({x:0,y:0,scale:o},"touchZoom");var S=t.current.offsetWidth*s,v=t.current.offsetHeight*s,b=t.current.getBoundingClientRect(),T=b.left,R=b.top,M=l%180!==0,D=$et(M?v:S,M?S:v,T,R);D&&i(hu({},D),"dragRebound")}};return g.useEffect(function(){var A;return n&&e&&(A=rR(window,"touchmove",function(S){return S.preventDefault()},{passive:!1})),function(){var S;(S=A)===null||S===void 0||S.remove()}},[n,e]),{isTouching:p,onTouchStart:x,onTouchMove:C,onTouchEnd:P}}var xqt=["fallback","src","imgRef"],vqt=["prefixCls","src","alt","imageInfo","fallback","movable","onClose","visible","icons","rootClassName","closeIcon","getContainer","current","count","countRender","scaleStep","minScale","maxScale","transitionName","maskTransitionName","imageRender","imgCommonProps","toolbarRender","onTransform","onChange"],bqt=function(e){var n=e.fallback,o=e.src,r=e.imgRef,i=PH(e,xqt),a=qet({src:o,fallback:n}),l=gf(a,2),s=l[0],c=l[1];return xe.createElement("img",zA({ref:function(d){r.current=d,s(d)}},i,c))},Qet=function(e){var n=e.prefixCls,o=e.src,r=e.alt,i=e.imageInfo,a=e.fallback,l=e.movable,s=l===void 0?!0:l,c=e.onClose,u=e.visible,d=e.icons,f=d===void 0?{}:d,p=e.rootClassName,m=e.closeIcon,y=e.getContainer,w=e.current,x=w===void 0?0:w,C=e.count,P=C===void 0?1:C,A=e.countRender,S=e.scaleStep,v=S===void 0?.5:S,b=e.minScale,T=b===void 0?1:b,R=e.maxScale,M=R===void 0?50:R,D=e.transitionName,k=D===void 0?"zoom":D,N=e.maskTransitionName,U=N===void 0?"fade":N,W=e.imageRender,F=e.imgCommonProps,E=e.toolbarRender,L=e.onTransform,j=e.onChange,Y=PH(e,vqt),O=g.useRef(),_=g.useContext(SU),G=_&&P>1,Q=_&&P>=1,oe=g.useState(!0),ee=gf(oe,2),$=ee[0],ae=ee[1],Z=pqt(O,T,M,L),ne=Z.transform,te=Z.resetTransform,q=Z.updateTransform,le=Z.dispatchZoomChange,de=mqt(O,s,u,v,ne,q,le),he=de.isMoving,me=de.onMouseDown,ce=de.onWheel,Pe=wqt(O,s,u,T,ne,q,le),pe=Pe.isTouching,Ie=Pe.onTouchStart,ve=Pe.onTouchMove,ze=Pe.onTouchEnd,Ae=ne.rotate,se=ne.scale,ge=Bn(T5({},"".concat(n,"-moving"),he));g.useEffect(function(){$||ae(!0)},[$]);var we=function(){te("close")},Se=function(){le(iR+v,"zoomIn")},Me=function(){le(iR/(iR+v),"zoomOut")},Ce=function(){q({rotate:Ae+90},"rotateRight")},Te=function(){q({rotate:Ae-90},"rotateLeft")},Re=function(){q({flipX:!ne.flipX},"flipX")},Ne=function(){q({flipY:!ne.flipY},"flipY")},_e=function(){te("reset")},Ue=function(lt){var Oe=x+lt;!Number.isInteger(Oe)||Oe<0||Oe>P-1||(ae(!1),te(lt<0?"prev":"next"),j==null||j(Oe,x))},qe=function(lt){!u||!G||(lt.keyCode===Lo.LEFT?Ue(-1):lt.keyCode===Lo.RIGHT&&Ue(1))},Fe=function(lt){u&&(se!==1?q({x:0,y:0,scale:1},"doubleClick"):le(iR+v,"doubleClick",lt.clientX,lt.clientY))};g.useEffect(function(){var Ye=rR(window,"keydown",qe,!1);return function(){Ye.remove()}},[u,G,x]);var He=xe.createElement(bqt,zA({},F,{width:e.width,height:e.height,imgRef:O,className:"".concat(n,"-img"),alt:r,style:{transform:"translate3d(".concat(ne.x,"px, ").concat(ne.y,"px, 0) scale3d(").concat(ne.flipX?"-":"").concat(se,", ").concat(ne.flipY?"-":"").concat(se,", 1) rotate(").concat(Ae,"deg)"),transitionDuration:(!$||pe)&&"0s"},fallback:a,src:o,onWheel:ce,onMouseDown:me,onDoubleClick:Fe,onTouchStart:Ie,onTouchMove:ve,onTouchEnd:ze,onTouchCancel:ze})),Le=hu({url:o,alt:r},i);return xe.createElement(xe.Fragment,null,xe.createElement(l9e,zA({transitionName:k,maskTransitionName:U,closable:!1,keyboard:!0,prefixCls:n,onClose:c,visible:u,classNames:{wrapper:ge},rootClassName:p,getContainer:y},Y,{afterClose:we}),xe.createElement("div",{className:"".concat(n,"-img-wrapper")},W?W(He,hu({transform:ne,image:Le},_?{current:x}:{})):He)),xe.createElement(hqt,{visible:u,transform:ne,maskTransitionName:U,closeIcon:m,getContainer:y,prefixCls:n,rootClassName:p,icons:f,countRender:A,showSwitch:G,showProgress:Q,current:x,count:P,scale:se,minScale:T,maxScale:M,toolbarRender:E,onActive:Ue,onZoomIn:Se,onZoomOut:Me,onRotateRight:Ce,onRotateLeft:Te,onFlipX:Re,onFlipY:Ne,onClose:c,onReset:_e,zIndex:Y.zIndex!==void 0?Y.zIndex+1:void 0,image:Le}))};function Sqt(t){if(Array.isArray(t))return Bhe(t)}function Tqt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Pqt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cqt(t){return Sqt(t)||Tqt(t)||Jet(t)||Pqt()}var Yhe=["crossOrigin","decoding","draggable","loading","referrerPolicy","sizes","srcSet","useMap","alt"];function Rqt(t){var e=g.useState({}),n=gf(e,2),o=n[0],r=n[1],i=g.useCallback(function(l,s){return r(function(c){return hu(hu({},c),{},T5({},l,s))}),function(){r(function(c){var u=hu({},c);return delete u[l],u})}},[]),a=g.useMemo(function(){return t?t.map(function(l){if(typeof l=="string")return{data:{src:l}};var s={};return Object.keys(l).forEach(function(c){["src"].concat(Cqt(Yhe)).includes(c)&&(s[c]=l[c])}),{data:s}}):Object.keys(o).reduce(function(l,s){var c=o[s],u=c.canPreview,d=c.data;return u&&l.push({data:d,id:s}),l},[])},[t,o]);return[a,i,!!t]}var Hqt=["visible","onVisibleChange","getContainer","current","movable","minScale","maxScale","countRender","closeIcon","onChange","onTransform","toolbarRender","imageRender"],Mqt=["src"],Iqt=function(e){var n,o=e.previewPrefixCls,r=o===void 0?"rc-image-preview":o,i=e.children,a=e.icons,l=a===void 0?{}:a,s=e.items,c=e.preview,u=e.fallback,d=$b(c)==="object"?c:{},f=d.visible,p=d.onVisibleChange,m=d.getContainer,y=d.current,w=d.movable,x=d.minScale,C=d.maxScale,P=d.countRender,A=d.closeIcon,S=d.onChange,v=d.onTransform,b=d.toolbarRender,T=d.imageRender,R=PH(d,Hqt),M=Rqt(s),D=gf(M,3),k=D[0],N=D[1],U=D[2],W=o0(0,{value:y}),F=gf(W,2),E=F[0],L=F[1],j=g.useState(!1),Y=gf(j,2),O=Y[0],_=Y[1],G=((n=k[E])===null||n===void 0?void 0:n.data)||{},Q=G.src,oe=PH(G,Mqt),ee=o0(!!f,{value:f,onChange:function(pe,Ie){p==null||p(pe,Ie,E)}}),$=gf(ee,2),ae=$[0],Z=$[1],ne=g.useState(null),te=gf(ne,2),q=te[0],le=te[1],de=g.useCallback(function(Pe,pe,Ie,ve){var ze=U?k.findIndex(function(Ae){return Ae.data.src===pe}):k.findIndex(function(Ae){return Ae.id===Pe});L(ze<0?0:ze),Z(!0),le({x:Ie,y:ve}),_(!0)},[k,U]);g.useEffect(function(){ae?O||L(0):_(!1)},[ae]);var he=function(pe,Ie){L(pe),S==null||S(pe,Ie)},me=function(){Z(!1),le(null)},ce=g.useMemo(function(){return{register:N,onPreview:de}},[N,de]);return g.createElement(SU.Provider,{value:ce},i,g.createElement(Qet,zA({"aria-hidden":!ae,movable:w,visible:ae,prefixCls:r,closeIcon:A,onClose:me,mousePosition:q,imgCommonProps:oe,src:Q,fallback:u,icons:l,minScale:x,maxScale:C,getContainer:m,current:E,count:k.length,countRender:P,onTransform:v,toolbarRender:b,imageRender:T,onChange:he},R)))},gCe=0;function zqt(t,e){var n=g.useState(function(){return gCe+=1,String(gCe)}),o=gf(n,1),r=o[0],i=g.useContext(SU),a={data:e,canPreview:t};return g.useEffect(function(){if(i)return i.register(r,a)},[]),g.useEffect(function(){i&&i.register(r,a)},[t,e]),r}var Dqt=["src","alt","onPreviewClose","prefixCls","previewPrefixCls","placeholder","fallback","width","height","style","preview","className","onClick","onError","wrapperClassName","wrapperStyle","rootClassName"],Eqt=["src","visible","onVisibleChange","getContainer","mask","maskClassName","movable","icons","scaleStep","minScale","maxScale","imageRender","toolbarRender"],i3e=function(e){var n=e.src,o=e.alt,r=e.onPreviewClose,i=e.prefixCls,a=i===void 0?"rc-image":i,l=e.previewPrefixCls,s=l===void 0?"".concat(a,"-preview"):l,c=e.placeholder,u=e.fallback,d=e.width,f=e.height,p=e.style,m=e.preview,y=m===void 0?!0:m,w=e.className,x=e.onClick,C=e.onError,P=e.wrapperClassName,A=e.wrapperStyle,S=e.rootClassName,v=PH(e,Dqt),b=c&&c!==!0,T=$b(y)==="object"?y:{},R=T.src,M=T.visible,D=M===void 0?void 0:M,k=T.onVisibleChange,N=k===void 0?r:k,U=T.getContainer,W=U===void 0?void 0:U,F=T.mask,E=T.maskClassName,L=T.movable,j=T.icons,Y=T.scaleStep,O=T.minScale,_=T.maxScale,G=T.imageRender,Q=T.toolbarRender,oe=PH(T,Eqt),ee=R??n,$=o0(!!D,{value:D,onChange:N}),ae=gf($,2),Z=ae[0],ne=ae[1],te=qet({src:n,isCustomPlaceholder:b,fallback:u}),q=gf(te,3),le=q[0],de=q[1],he=q[2],me=g.useState(null),ce=gf(me,2),Pe=ce[0],pe=ce[1],Ie=g.useContext(SU),ve=!!y,ze=function(){ne(!1),pe(null)},Ae=Bn(a,P,S,T5({},"".concat(a,"-error"),he==="error")),se=g.useMemo(function(){var Me={};return Yhe.forEach(function(Ce){e[Ce]!==void 0&&(Me[Ce]=e[Ce])}),Me},Yhe.map(function(Me){return e[Me]})),ge=g.useMemo(function(){return hu(hu({},se),{},{src:ee})},[ee,se]),we=zqt(ve,ge),Se=function(Ce){var Te=fqt(Ce.target),Re=Te.left,Ne=Te.top;Ie?Ie.onPreview(we,ee,Re,Ne):(pe({x:Re,y:Ne}),ne(!0)),x==null||x(Ce)};return g.createElement(g.Fragment,null,g.createElement("div",zA({},v,{className:Ae,onClick:ve?Se:x,style:hu({width:d,height:f},A)}),g.createElement("img",zA({},se,{className:Bn("".concat(a,"-img"),T5({},"".concat(a,"-img-placeholder"),c===!0),w),style:hu({height:f},p),ref:le},de,{width:d,height:f,onError:C})),he==="loading"&&g.createElement("div",{"aria-hidden":"true",className:"".concat(a,"-placeholder")},c),F&&ve&&g.createElement("div",{className:Bn("".concat(a,"-mask"),E),style:{display:(p==null?void 0:p.display)==="none"?"none":void 0}},F)),!Ie&&ve&&g.createElement(Qet,zA({"aria-hidden":!Z,visible:Z,prefixCls:s,onClose:ze,mousePosition:Pe,src:ee,alt:o,imageInfo:{width:d,height:f},fallback:u,getContainer:W,icons:j,movable:L,scaleStep:Y,minScale:O,maxScale:_,rootClassName:S,imageRender:G,imgCommonProps:se,toolbarRender:Q},oe)))};i3e.PreviewGroup=Iqt;var kqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z"}},{tag:"path",attrs:{d:"M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z"}}]},name:"rotate-left",theme:"outlined"},Fqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:kqt}))},Lqt=g.forwardRef(Fqt),Wqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z"}},{tag:"path",attrs:{d:"M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z"}}]},name:"rotate-right",theme:"outlined"},Nqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Wqt}))},Uqt=g.forwardRef(Nqt),jqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"swap",theme:"outlined"},Bqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:jqt}))},mCe=g.forwardRef(Bqt),Yqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-in",theme:"outlined"},Oqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Yqt}))},_qt=g.forwardRef(Oqt),Vqt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-out",theme:"outlined"},Gqt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Vqt}))},Xqt=g.forwardRef(Gqt);const Ohe=t=>({position:t||"absolute",inset:0}),Jqt=t=>{const{iconCls:e,motionDurationSlow:n,paddingXXS:o,marginXXS:r,prefixCls:i,colorTextLightSolid:a}=t;return{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:a,background:new Di("#000").setA(.5).toRgbString(),cursor:"pointer",opacity:0,transition:`opacity ${n}`,[`.${i}-mask-info`]:Object.assign(Object.assign({},e7),{padding:`0 ${jt(o)}`,[e]:{marginInlineEnd:r,svg:{verticalAlign:"baseline"}}})}},Kqt=t=>{const{previewCls:e,modalMaskBg:n,paddingSM:o,marginXL:r,margin:i,paddingLG:a,previewOperationColorDisabled:l,previewOperationHoverColor:s,motionDurationSlow:c,iconCls:u,colorTextLightSolid:d}=t,f=new Di(n).setA(.1),p=f.clone().setA(.2);return{[`${e}-footer`]:{position:"fixed",bottom:r,left:{_skip_check_:!0,value:"50%"},display:"flex",flexDirection:"column",alignItems:"center",color:t.previewOperationColor,transform:"translateX(-50%)"},[`${e}-progress`]:{marginBottom:i},[`${e}-close`]:{position:"fixed",top:r,right:{_skip_check_:!0,value:r},display:"flex",color:d,backgroundColor:f.toRgbString(),borderRadius:"50%",padding:o,outline:0,border:0,cursor:"pointer",transition:`all ${c}`,"&:hover":{backgroundColor:p.toRgbString()},[`& > ${u}`]:{fontSize:t.previewOperationSize}},[`${e}-operations`]:{display:"flex",alignItems:"center",padding:`0 ${jt(a)}`,backgroundColor:f.toRgbString(),borderRadius:100,"&-operation":{marginInlineStart:o,padding:o,cursor:"pointer",transition:`all ${c}`,userSelect:"none",[`&:not(${e}-operations-operation-disabled):hover > ${u}`]:{color:s},"&-disabled":{color:l,cursor:"not-allowed"},"&:first-of-type":{marginInlineStart:0},[`& > ${u}`]:{fontSize:t.previewOperationSize}}}}},$qt=t=>{const{modalMaskBg:e,iconCls:n,previewOperationColorDisabled:o,previewCls:r,zIndexPopup:i,motionDurationSlow:a}=t,l=new Di(e).setA(.1),s=l.clone().setA(.2);return{[`${r}-switch-left, ${r}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:t.calc(i).add(1).equal(),display:"flex",alignItems:"center",justifyContent:"center",width:t.imagePreviewSwitchSize,height:t.imagePreviewSwitchSize,marginTop:t.calc(t.imagePreviewSwitchSize).mul(-1).div(2).equal(),color:t.previewOperationColor,background:l.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${a}`,userSelect:"none","&:hover":{background:s.toRgbString()},"&-disabled":{"&, &:hover":{color:o,background:"transparent",cursor:"not-allowed",[`> ${n}`]:{cursor:"not-allowed"}}},[`> ${n}`]:{fontSize:t.previewOperationSize}},[`${r}-switch-left`]:{insetInlineStart:t.marginSM},[`${r}-switch-right`]:{insetInlineEnd:t.marginSM}}},qqt=t=>{const{motionEaseOut:e,previewCls:n,motionDurationSlow:o,componentCls:r}=t;return[{[`${r}-preview-root`]:{[n]:{height:"100%",textAlign:"center",pointerEvents:"none"},[`${n}-body`]:Object.assign(Object.assign({},Ohe()),{overflow:"hidden"}),[`${n}-img`]:{maxWidth:"100%",maxHeight:"70%",verticalAlign:"middle",transform:"scale3d(1, 1, 1)",cursor:"grab",transition:`transform ${o} ${e} 0s`,userSelect:"none","&-wrapper":Object.assign(Object.assign({},Ohe()),{transition:`transform ${o} ${e} 0s`,display:"flex",justifyContent:"center",alignItems:"center","& > *":{pointerEvents:"auto"},"&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}})},[`${n}-moving`]:{[`${n}-preview-img`]:{cursor:"grabbing","&-wrapper":{transitionDuration:"0s"}}}}},{[`${r}-preview-root`]:{[`${n}-wrap`]:{zIndex:t.zIndexPopup}}},{[`${r}-preview-operations-wrapper`]:{position:"fixed",zIndex:t.calc(t.zIndexPopup).add(1).equal()},"&":[Kqt(t),$qt(t)]}]},Qqt=t=>{const{componentCls:e}=t;return{[e]:{position:"relative",display:"inline-block",[`${e}-img`]:{width:"100%",height:"auto",verticalAlign:"middle"},[`${e}-img-placeholder`]:{backgroundColor:t.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},[`${e}-mask`]:Object.assign({},Jqt(t)),[`${e}-mask:hover`]:{opacity:1},[`${e}-placeholder`]:Object.assign({},Ohe())}}},Zqt=t=>{const{previewCls:e}=t;return{[`${e}-root`]:QM(t,"zoom"),"&":aqe(t,!0)}},eQt=t=>({zIndexPopup:t.zIndexPopupBase+80,previewOperationColor:new Di(t.colorTextLightSolid).setA(.65).toRgbString(),previewOperationHoverColor:new Di(t.colorTextLightSolid).setA(.85).toRgbString(),previewOperationColorDisabled:new Di(t.colorTextLightSolid).setA(.25).toRgbString(),previewOperationSize:t.fontSizeIcon*1.5}),Zet=el("Image",t=>{const e=`${t.componentCls}-preview`,n=Ui(t,{previewCls:e,modalMaskBg:new Di("#000").setA(.45).toRgbString(),imagePreviewSwitchSize:t.controlHeightLG});return[Qqt(n),qqt(n),Iqe(Ui(n,{componentCls:e})),Zqt(n)]},eQt);var tQt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{previewPrefixCls:e,preview:n}=t,o=tQt(t,["previewPrefixCls","preview"]);const{getPrefixCls:r}=g.useContext(gr),i=r("image",e),a=`${i}-preview`,l=r(),s=nu(i),[c,u,d]=Zet(i,s),[f]=a6("ImagePreview",typeof n=="object"?n.zIndex:void 0),p=g.useMemo(()=>{var m;if(n===!1)return n;const y=typeof n=="object"?n:{},w=Mn(u,d,s,(m=y.rootClassName)!==null&&m!==void 0?m:"");return Object.assign(Object.assign({},y),{transitionName:L1(l,"zoom",y.transitionName),maskTransitionName:L1(l,"fade",y.maskTransitionName),rootClassName:w,zIndex:f})},[n]);return c(g.createElement(i3e.PreviewGroup,Object.assign({preview:p,previewPrefixCls:a,icons:ett},o)))};var yCe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e;const{prefixCls:n,preview:o,className:r,rootClassName:i,style:a}=t,l=yCe(t,["prefixCls","preview","className","rootClassName","style"]),{getPrefixCls:s,locale:c=I3,getPopupContainer:u,image:d}=g.useContext(gr),f=s("image",n),p=s(),m=c.Image||I3.Image,y=nu(f),[w,x,C]=Zet(f,y),P=Mn(i,x,C,y),A=Mn(r,x,d==null?void 0:d.className),[S]=a6("ImagePreview",typeof o=="object"?o.zIndex:void 0),v=g.useMemo(()=>{var T;if(o===!1)return o;const R=typeof o=="object"?o:{},{getContainer:M,closeIcon:D,rootClassName:k}=R,N=yCe(R,["getContainer","closeIcon","rootClassName"]);return Object.assign(Object.assign({mask:g.createElement("div",{className:`${f}-mask-info`},g.createElement(zet,null),m==null?void 0:m.preview),icons:ett},N),{rootClassName:Mn(P,k),getContainer:M??u,transitionName:L1(p,"zoom",R.transitionName),maskTransitionName:L1(p,"fade",R.maskTransitionName),zIndex:S,closeIcon:D??((T=d==null?void 0:d.preview)===null||T===void 0?void 0:T.closeIcon)})},[o,m,(e=d==null?void 0:d.preview)===null||e===void 0?void 0:e.closeIcon]),b=Object.assign(Object.assign({},d==null?void 0:d.style),a);return w(g.createElement(i3e,Object.assign({prefixCls:f,preview:v,rootClassName:P,className:A,style:b},l)))};dv.PreviewGroup=nQt;const a3e=function(){const t=Object.assign({},arguments.length<=0?void 0:arguments[0]);for(let e=1;e{const r=n[o];r!==void 0&&(t[o]=r)})}return t};var oQt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"},rQt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:oQt}))},ACe=g.forwardRef(rQt),iQt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"}}]},name:"double-right",theme:"outlined"},aQt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:iQt}))},wCe=g.forwardRef(aQt),lQt={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},sQt=[10,20,50,100],cQt=function(e){var n=e.pageSizeOptions,o=n===void 0?sQt:n,r=e.locale,i=e.changeSize,a=e.pageSize,l=e.goButton,s=e.quickGo,c=e.rootPrefixCls,u=e.disabled,d=e.buildOptionText,f=e.showSizeChanger,p=e.sizeChangerRender,m=xe.useState(""),y=Sn(m,2),w=y[0],x=y[1],C=function(){return!w||Number.isNaN(w)?void 0:Number(w)},P=typeof d=="function"?d:function(k){return"".concat(k," ").concat(r.items_per_page)},A=function(N){x(N.target.value)},S=function(N){l||w===""||(x(""),!(N.relatedTarget&&(N.relatedTarget.className.indexOf("".concat(c,"-item-link"))>=0||N.relatedTarget.className.indexOf("".concat(c,"-item"))>=0))&&(s==null||s(C())))},v=function(N){w!==""&&(N.keyCode===Lo.ENTER||N.type==="click")&&(x(""),s==null||s(C()))},b=function(){return o.some(function(N){return N.toString()===a.toString()})?o:o.concat([a]).sort(function(N,U){var W=Number.isNaN(Number(N))?0:Number(N),F=Number.isNaN(Number(U))?0:Number(U);return W-F})},T="".concat(c,"-options");if(!f&&!s)return null;var R=null,M=null,D=null;return f&&p&&(R=p({disabled:u,size:a,onSizeChange:function(N){i==null||i(Number(N))},"aria-label":r.page_size,className:"".concat(T,"-size-changer"),options:b().map(function(k){return{label:P(k),value:k}})})),s&&(l&&(D=typeof l=="boolean"?xe.createElement("button",{type:"button",onClick:v,onKeyUp:v,disabled:u,className:"".concat(T,"-quick-jumper-button")},r.jump_to_confirm):xe.createElement("span",{onClick:v,onKeyUp:v},l)),M=xe.createElement("div",{className:"".concat(T,"-quick-jumper")},r.jump_to,xe.createElement("input",{disabled:u,type:"text",value:w,onChange:A,onKeyUp:v,onBlur:S,"aria-label":r.page}),r.page,D)),xe.createElement("li",{className:T},R,M)},nE=function(e){var n=e.rootPrefixCls,o=e.page,r=e.active,i=e.className,a=e.showTitle,l=e.onClick,s=e.onKeyPress,c=e.itemRender,u="".concat(n,"-item"),d=Bn(u,"".concat(u,"-").concat(o),Ut(Ut({},"".concat(u,"-active"),r),"".concat(u,"-disabled"),!o),i),f=function(){l(o)},p=function(w){s(w,l,o)},m=c(o,"page",xe.createElement("a",{rel:"nofollow"},o));return m?xe.createElement("li",{title:a?String(o):null,className:d,onClick:f,onKeyDown:p,tabIndex:0},m):null},uQt=function(e,n,o){return o};function xCe(){}function vCe(t){var e=Number(t);return typeof e=="number"&&!Number.isNaN(e)&&isFinite(e)&&Math.floor(e)===e}function Gx(t,e,n){var o=typeof t>"u"?e:t;return Math.floor((n-1)/o)+1}var dQt=function(e){var n=e.prefixCls,o=n===void 0?"rc-pagination":n,r=e.selectPrefixCls,i=r===void 0?"rc-select":r,a=e.className,l=e.current,s=e.defaultCurrent,c=s===void 0?1:s,u=e.total,d=u===void 0?0:u,f=e.pageSize,p=e.defaultPageSize,m=p===void 0?10:p,y=e.onChange,w=y===void 0?xCe:y,x=e.hideOnSinglePage,C=e.align,P=e.showPrevNextJumpers,A=P===void 0?!0:P,S=e.showQuickJumper,v=e.showLessItems,b=e.showTitle,T=b===void 0?!0:b,R=e.onShowSizeChange,M=R===void 0?xCe:R,D=e.locale,k=D===void 0?lQt:D,N=e.style,U=e.totalBoundaryShowSizeChanger,W=U===void 0?50:U,F=e.disabled,E=e.simple,L=e.showTotal,j=e.showSizeChanger,Y=j===void 0?d>W:j,O=e.sizeChangerRender,_=e.pageSizeOptions,G=e.itemRender,Q=G===void 0?uQt:G,oe=e.jumpPrevIcon,ee=e.jumpNextIcon,$=e.prevIcon,ae=e.nextIcon,Z=xe.useRef(null),ne=o0(10,{value:f,defaultValue:m}),te=Sn(ne,2),q=te[0],le=te[1],de=o0(1,{value:l,defaultValue:c,postState:function(on){return Math.max(1,Math.min(on,Gx(void 0,q,d)))}}),he=Sn(de,2),me=he[0],ce=he[1],Pe=xe.useState(me),pe=Sn(Pe,2),Ie=pe[0],ve=pe[1];g.useEffect(function(){ve(me)},[me]);var ze=Math.max(1,me-(v?3:5)),Ae=Math.min(Gx(void 0,q,d),me+(v?3:5));function se(Ot,on){var qt=Ot||xe.createElement("button",{type:"button","aria-label":on,className:"".concat(o,"-item-link")});return typeof Ot=="function"&&(qt=xe.createElement(Ot,nn({},e))),qt}function ge(Ot){var on=Ot.target.value,qt=Gx(void 0,q,d),rn;return on===""?rn=on:Number.isNaN(Number(on))?rn=Ie:on>=qt?rn=qt:rn=Number(on),rn}function we(Ot){return vCe(Ot)&&Ot!==me&&vCe(d)&&d>0}var Se=d>q?S:!1;function Me(Ot){(Ot.keyCode===Lo.UP||Ot.keyCode===Lo.DOWN)&&Ot.preventDefault()}function Ce(Ot){var on=ge(Ot);switch(on!==Ie&&ve(on),Ot.keyCode){case Lo.ENTER:Ne(on);break;case Lo.UP:Ne(on-1);break;case Lo.DOWN:Ne(on+1);break}}function Te(Ot){Ne(ge(Ot))}function Re(Ot){var on=Gx(Ot,q,d),qt=me>on&&on!==0?on:me;le(Ot),ve(qt),M==null||M(me,Ot),ce(qt),w==null||w(qt,Ot)}function Ne(Ot){if(we(Ot)&&!F){var on=Gx(void 0,q,d),qt=Ot;return Ot>on?qt=on:Ot<1&&(qt=1),qt!==Ie&&ve(qt),ce(qt),w==null||w(qt,q),qt}return me}var _e=me>1,Ue=me2?qt-2:0),Pn=2;Pnd?d:me*q])),je=null,et=Gx(void 0,q,d);if(x&&d<=q)return null;var bt=[],St={rootPrefixCls:o,onClick:Ne,onKeyPress:Ye,showTitle:T,itemRender:Q,page:-1},Pt=me-1>0?me-1:0,Yt=me+1=at*2&&me!==3&&(bt[0]=xe.cloneElement(bt[0],{className:Bn("".concat(o,"-item-after-jump-prev"),bt[0].props.className)}),bt.unshift(tt)),et-me>=at*2&&me!==et-2){var pt=bt[bt.length-1];bt[bt.length-1]=xe.cloneElement(pt,{className:Bn("".concat(o,"-item-before-jump-next"),pt.props.className)}),bt.push(je)}ot!==1&&bt.unshift(xe.createElement(nE,Uo({},St,{key:1,page:1}))),it!==et&&bt.push(xe.createElement(nE,Uo({},St,{key:et,page:et})))}var ct=Qe(Pt);if(ct){var Xe=!_e||!et;ct=xe.createElement("li",{title:T?k.prev_page:null,onClick:qe,tabIndex:Xe?null:0,onKeyDown:lt,className:Bn("".concat(o,"-prev"),Ut({},"".concat(o,"-disabled"),Xe)),"aria-disabled":Xe},ct)}var ft=nt(Yt);if(ft){var wt,kt;E?(wt=!Ue,kt=_e?0:null):(wt=!Ue||!et,kt=wt?null:0),ft=xe.createElement("li",{title:T?k.next_page:null,onClick:Fe,tabIndex:kt,onKeyDown:Oe,className:Bn("".concat(o,"-next"),Ut({},"".concat(o,"-disabled"),wt)),"aria-disabled":wt},ft)}var Zt=Bn(o,a,Ut(Ut(Ut(Ut(Ut({},"".concat(o,"-start"),C==="start"),"".concat(o,"-center"),C==="center"),"".concat(o,"-end"),C==="end"),"".concat(o,"-simple"),E),"".concat(o,"-disabled"),F));return xe.createElement("ul",Uo({className:Zt,style:N,ref:Z},gt),Ve,ct,E?yt:bt,ft,xe.createElement(cQt,{locale:k,rootPrefixCls:o,disabled:F,selectPrefixCls:i,changeSize:Re,pageSize:q,pageSizeOptions:_,quickGo:Se?Ne:null,goButton:Ct,showSizeChanger:Y,sizeChangerRender:O}))};const fQt=t=>{const{componentCls:e}=t;return{[`${e}-disabled`]:{"&, &:hover":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}},[`&${e}-disabled`]:{cursor:"not-allowed",[`${e}-item`]:{cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},a:{color:t.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:t.colorBorder,backgroundColor:t.itemActiveBgDisabled,"&:hover, &:active":{backgroundColor:t.itemActiveBgDisabled},a:{color:t.itemActiveColorDisabled}}},[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},[`${e}-simple&`]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},[`${e}-simple-pager`]:{color:t.colorTextDisabled},[`${e}-jump-prev, ${e}-jump-next`]:{[`${e}-item-link-icon`]:{opacity:0},[`${e}-item-ellipsis`]:{opacity:1}}},[`&${e}-simple`]:{[`${e}-prev, ${e}-next`]:{[`&${e}-disabled ${e}-item-link`]:{"&:hover, &:active":{backgroundColor:"transparent"}}}}}},hQt=t=>{const{componentCls:e}=t;return{[`&${e}-mini ${e}-total-text, &${e}-mini ${e}-simple-pager`]:{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini ${e}-item`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.calc(t.itemSizeSM).sub(2).equal())},[`&${e}-mini:not(${e}-disabled) ${e}-item:not(${e}-item-active)`]:{backgroundColor:"transparent",borderColor:"transparent","&:hover":{backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},[`&${e}-mini ${e}-prev, &${e}-mini ${e}-next`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini:not(${e}-disabled)`]:{[`${e}-prev, ${e}-next`]:{[`&:hover ${e}-item-link`]:{backgroundColor:t.colorBgTextHover},[`&:active ${e}-item-link`]:{backgroundColor:t.colorBgTextActive},[`&${e}-disabled:hover ${e}-item-link`]:{backgroundColor:"transparent"}}},[` &${e}-mini ${e}-prev ${e}-item-link, &${e}-mini ${e}-next ${e}-item-link `]:{backgroundColor:"transparent",borderColor:"transparent","&::after":{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM)}},[`&${e}-mini ${e}-jump-prev, &${e}-mini ${e}-jump-next`]:{height:t.itemSizeSM,marginInlineEnd:0,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini ${e}-options`]:{marginInlineStart:t.paginationMiniOptionsMarginInlineStart,"&-size-changer":{top:t.miniOptionsSizeChangerTop},"&-quick-jumper":{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM),input:Object.assign(Object.assign({},X9e(t)),{width:t.paginationMiniQuickJumperInputWidth,height:t.controlHeightSM})}}}},pQt=t=>{const{componentCls:e}=t;return{[` @@ -4727,7 +4727,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${e}-next, ${e}-jump-prev, ${e}-jump-next - `]:{display:"inline-block",minWidth:t.itemSize,height:t.itemSize,color:t.colorText,fontFamily:t.fontFamily,lineHeight:jt(t.itemSize),textAlign:"center",verticalAlign:"middle",listStyle:"none",borderRadius:t.borderRadius,cursor:"pointer",transition:`all ${t.motionDurationMid}`},[`${e}-prev, ${e}-next`]:{outline:0,button:{color:t.colorText,cursor:"pointer",userSelect:"none"},[`${e}-item-link`]:{display:"block",width:"100%",height:"100%",padding:0,fontSize:t.fontSizeSM,textAlign:"center",backgroundColor:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,borderRadius:t.borderRadius,outline:"none",transition:`all ${t.motionDurationMid}`},[`&:hover ${e}-item-link`]:{backgroundColor:t.colorBgTextHover},[`&:active ${e}-item-link`]:{backgroundColor:t.colorBgTextActive},[`&${e}-disabled:hover`]:{[`${e}-item-link`]:{backgroundColor:"transparent"}}},[`${e}-slash`]:{marginInlineEnd:t.paginationSlashMarginInlineEnd,marginInlineStart:t.paginationSlashMarginInlineStart},[`${e}-options`]:{display:"inline-block",marginInlineStart:t.margin,verticalAlign:"middle","&-size-changer":{display:"inline-block",width:"auto"},"&-quick-jumper":{display:"inline-block",height:t.controlHeight,marginInlineStart:t.marginXS,lineHeight:jt(t.controlHeight),verticalAlign:"top",input:Object.assign(Object.assign(Object.assign({},vU(t)),Y9e(t,{borderColor:t.colorBorder,hoverBorderColor:t.colorPrimaryHover,activeBorderColor:t.colorPrimary,activeShadow:t.activeShadow})),{"&[disabled]":Object.assign({},cee(t)),width:t.calc(t.controlHeightLG).mul(1.25).equal(),height:t.controlHeight,boxSizing:"border-box",margin:0,marginInlineStart:t.marginXS,marginInlineEnd:t.marginXS})}}}},mQt=t=>{const{componentCls:e}=t;return{[`${e}-item`]:{display:"inline-block",minWidth:t.itemSize,height:t.itemSize,marginInlineEnd:t.marginXS,fontFamily:t.fontFamily,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:t.itemBg,border:`${jt(t.lineWidth)} ${t.lineType} transparent`,borderRadius:t.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:`0 ${jt(t.paginationItemPaddingInline)}`,color:t.colorText,"&:hover":{textDecoration:"none"}},[`&:not(${e}-item-active)`]:{"&:hover":{transition:`all ${t.motionDurationMid}`,backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},"&-active":{fontWeight:t.fontWeightStrong,backgroundColor:t.itemActiveBg,borderColor:t.colorPrimary,a:{color:t.colorPrimary},"&:hover":{borderColor:t.colorPrimaryHover},"&:hover a":{color:t.colorPrimaryHover}}}}},yQt=t=>{const{componentCls:e}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{display:"flex","&-start":{justifyContent:"start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"end"},"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},[`${e}-total-text`]:{display:"inline-block",height:t.itemSize,marginInlineEnd:t.marginXS,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),verticalAlign:"middle"}}),mQt(t)),gQt(t)),pQt(t)),hQt(t)),fQt(t)),{[`@media only screen and (max-width: ${t.screenLG}px)`]:{[`${e}-item`]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},[`@media only screen and (max-width: ${t.screenSM}px)`]:{[`${e}-options`]:{display:"none"}}}),[`&${t.componentCls}-rtl`]:{direction:"rtl"}}},AQt=t=>{const{componentCls:e}=t;return{[`${e}:not(${e}-disabled)`]:{[`${e}-item`]:Object.assign({},Yy(t)),[`${e}-jump-prev, ${e}-jump-next`]:{"&:focus-visible":Object.assign({[`${e}-item-link-icon`]:{opacity:1},[`${e}-item-ellipsis`]:{opacity:0}},z3(t))},[`${e}-prev, ${e}-next`]:{[`&:focus-visible ${e}-item-link`]:Object.assign({},z3(t))}}}},ttt=t=>Object.assign({itemBg:t.colorBgContainer,itemSize:t.controlHeight,itemSizeSM:t.controlHeightSM,itemActiveBg:t.colorBgContainer,itemLinkBg:t.colorBgContainer,itemActiveColorDisabled:t.colorTextDisabled,itemActiveBgDisabled:t.controlItemBgActiveDisabled,itemInputBg:t.colorBgContainer,miniOptionsSizeChangerTop:0},xU(t)),ntt=t=>Ui(t,{inputOutlineOffset:0,paginationMiniOptionsMarginInlineStart:t.calc(t.marginXXS).div(2).equal(),paginationMiniQuickJumperInputWidth:t.calc(t.controlHeightLG).mul(1.1).equal(),paginationItemPaddingInline:t.calc(t.marginXXS).mul(1.5).equal(),paginationEllipsisLetterSpacing:t.calc(t.marginXXS).div(2).equal(),paginationSlashMarginInlineStart:t.marginSM,paginationSlashMarginInlineEnd:t.marginSM,paginationEllipsisTextIndent:"0.13em"},wU(t)),wQt=el("Pagination",t=>{const e=ntt(t);return[yQt(e),AQt(e)]},ttt),xQt=t=>{const{componentCls:e}=t;return{[`${e}${e}-bordered${e}-disabled:not(${e}-mini)`]:{"&, &:hover":{[`${e}-item-link`]:{borderColor:t.colorBorder}},"&:focus-visible":{[`${e}-item-link`]:{borderColor:t.colorBorder}},[`${e}-item, ${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,[`&:hover:not(${e}-item-active)`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,a:{color:t.colorTextDisabled}},[`&${e}-item-active`]:{backgroundColor:t.itemActiveBgDisabled}},[`${e}-prev, ${e}-next`]:{"&:hover button":{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,color:t.colorTextDisabled},[`${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder}}},[`${e}${e}-bordered:not(${e}-mini)`]:{[`${e}-prev, ${e}-next`]:{"&:hover button":{borderColor:t.colorPrimaryHover,backgroundColor:t.itemBg},[`${e}-item-link`]:{backgroundColor:t.itemLinkBg,borderColor:t.colorBorder},[`&:hover ${e}-item-link`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,color:t.colorPrimary},[`&${e}-disabled`]:{[`${e}-item-link`]:{borderColor:t.colorBorder,color:t.colorTextDisabled}}},[`${e}-item`]:{backgroundColor:t.itemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,[`&:hover:not(${e}-item-active)`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,a:{color:t.colorPrimary}},"&-active":{borderColor:t.colorPrimary}}}}},vQt=rU(["Pagination","bordered"],t=>{const e=ntt(t);return[xQt(e)]},ttt);function bCe(t){return g.useMemo(()=>typeof t=="boolean"?[t,{}]:t&&typeof t=="object"?[!0,t]:[void 0,void 0],[t])}var bQt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{align:e,prefixCls:n,selectPrefixCls:o,className:r,rootClassName:i,style:a,size:l,locale:s,responsive:c,showSizeChanger:u,selectComponentClass:d,pageSizeOptions:f}=t,p=bQt(t,["align","prefixCls","selectPrefixCls","className","rootClassName","style","size","locale","responsive","showSizeChanger","selectComponentClass","pageSizeOptions"]),{xs:m}=MZ(c),[,y]=Ff(),{getPrefixCls:w,direction:x,pagination:C={}}=g.useContext(gr),P=w("pagination",n),[A,S,v]=wQt(P),b=jd(l),T=b==="small"||!!(m&&!b&&c),[R]=r6("Pagination",PKe),M=Object.assign(Object.assign({},R),s),[D,k]=bCe(u),[N,U]=bCe(C.showSizeChanger),W=D??N,F=k??U,E=d||Ko,L=g.useMemo(()=>f?f.map(Q=>Number(Q)):void 0,[f]),j=Q=>{var oe;const{disabled:ee,size:q,onSizeChange:ae,"aria-label":Z,className:ne,options:te}=Q,{className:$,onChange:le}=F||{},de=(oe=te.find(he=>String(he.value)===String(q)))===null||oe===void 0?void 0:oe.value;return g.createElement(E,Object.assign({disabled:ee,showSearch:!0,popupMatchSelectWidth:!1,getPopupContainer:he=>he.parentNode,"aria-label":Z,options:te},F,{value:de,onChange:(he,me)=>{ae==null||ae(he),le==null||le(he,me)},size:T?"small":"middle",className:Mn(ne,$)}))},Y=g.useMemo(()=>{const Q=g.createElement("span",{className:`${P}-item-ellipsis`},"•••"),oe=g.createElement("button",{className:`${P}-item-link`,type:"button",tabIndex:-1},x==="rtl"?g.createElement(xH,null):g.createElement(sJ,null)),ee=g.createElement("button",{className:`${P}-item-link`,type:"button",tabIndex:-1},x==="rtl"?g.createElement(sJ,null):g.createElement(xH,null)),q=g.createElement("a",{className:`${P}-item-link`},g.createElement("div",{className:`${P}-item-container`},x==="rtl"?g.createElement(wCe,{className:`${P}-item-link-icon`}):g.createElement(ACe,{className:`${P}-item-link-icon`}),Q)),ae=g.createElement("a",{className:`${P}-item-link`},g.createElement("div",{className:`${P}-item-container`},x==="rtl"?g.createElement(ACe,{className:`${P}-item-link-icon`}):g.createElement(wCe,{className:`${P}-item-link-icon`}),Q));return{prevIcon:oe,nextIcon:ee,jumpPrevIcon:q,jumpNextIcon:ae}},[x,P]),O=w("select",o),_=Mn({[`${P}-${e}`]:!!e,[`${P}-mini`]:T,[`${P}-rtl`]:x==="rtl",[`${P}-bordered`]:y.wireframe},C==null?void 0:C.className,r,i,S,v),G=Object.assign(Object.assign({},C==null?void 0:C.style),a);return A(g.createElement(g.Fragment,null,y.wireframe&&g.createElement(vQt,{prefixCls:P}),g.createElement(dQt,Object.assign({},Y,p,{style:G,prefixCls:P,selectPrefixCls:O,className:_,locale:M,pageSizeOptions:L,showSizeChanger:W,sizeChangerRender:j}))))};function SQt(t,e,n){var o=n||{},r=o.noTrailing,i=r===void 0?!1:r,a=o.noLeading,l=a===void 0?!1:a,s=o.debounceMode,c=s===void 0?void 0:s,u,d=!1,f=0;function p(){u&&clearTimeout(u)}function m(w){var x=w||{},C=x.upcomingOnly,P=C===void 0?!1:C;p(),d=!P}function y(){for(var w=arguments.length,x=new Array(w),C=0;Ct?l?(f=Date.now(),i||(u=setTimeout(c?v:S,t))):S():i!==!0&&(u=setTimeout(c?v:S,c===void 0?t-A:t))}return y.cancel=m,y}function TQt(t,e,n){var o={},r=o.atBegin,i=r===void 0?!1:r;return SQt(t,e,{debounceMode:i!==!1})}const yJ=100,rtt=yJ/5,itt=yJ/2-rtt/2,ase=itt*2*Math.PI,SCe=50,TCe=t=>{const{dotClassName:e,style:n,hasCircleCls:o}=t;return g.createElement("circle",{className:Mn(`${e}-circle`,{[`${e}-circle-bg`]:o}),r:itt,cx:SCe,cy:SCe,strokeWidth:rtt,style:n})},PQt=t=>{let{percent:e,prefixCls:n}=t;const o=`${n}-dot`,r=`${o}-holder`,i=`${r}-hidden`,[a,l]=g.useState(!1);MA(()=>{e!==0&&l(!0)},[e!==0]);const s=Math.max(Math.min(e,100),0);if(!a)return null;const c={strokeDashoffset:`${ase/4}`,strokeDasharray:`${ase*s/100} ${ase*(100-s)/100}`};return g.createElement("span",{className:Mn(r,`${o}-progress`,s<=0&&i)},g.createElement("svg",{viewBox:`0 0 ${yJ} ${yJ}`,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s},g.createElement(TCe,{dotClassName:o,hasCircleCls:!0}),g.createElement(TCe,{dotClassName:o,style:c})))};function CQt(t){const{prefixCls:e,percent:n=0}=t,o=`${e}-dot`,r=`${o}-holder`,i=`${r}-hidden`;return g.createElement(g.Fragment,null,g.createElement("span",{className:Mn(r,n>0&&i)},g.createElement("span",{className:Mn(o,`${e}-dot-spin`)},[1,2,3,4].map(a=>g.createElement("i",{className:`${e}-dot-item`,key:a})))),g.createElement(PQt,{prefixCls:e,percent:n}))}function RQt(t){const{prefixCls:e,indicator:n,percent:o}=t,r=`${e}-dot`;return n&&g.isValidElement(n)?P0(n,{className:Mn(n.props.className,r),percent:o}):g.createElement(CQt,{prefixCls:e,percent:o})}const HQt=new xa("antSpinMove",{to:{opacity:1}}),MQt=new xa("antRotate",{to:{transform:"rotate(405deg)"}}),IQt=t=>{const{componentCls:e,calc:n}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",display:"none",color:t.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${t.motionDurationSlow} ${t.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${e}-text`]:{fontSize:t.fontSize,paddingTop:n(n(t.dotSize).sub(t.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:t.colorBgMask,zIndex:t.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${t.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[e]:{[`${e}-dot-holder`]:{color:t.colorWhite},[`${e}-text`]:{color:t.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${e}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:t.contentHeight,[`${e}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:n(t.dotSize).mul(-1).div(2).equal()},[`${e}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${t.colorBgContainer}`},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${e}-dot`]:{margin:n(t.dotSizeSM).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeSM).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${e}-dot`]:{margin:n(t.dotSizeLG).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeLG).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${e}-container`]:{position:"relative",transition:`opacity ${t.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:t.colorBgContainer,opacity:0,transition:`all ${t.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${e}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:t.spinDotDefault},[`${e}-dot-holder`]:{width:"1em",height:"1em",fontSize:t.dotSize,display:"inline-block",transition:`transform ${t.motionDurationSlow} ease, opacity ${t.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:t.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${e}-dot-progress`]:{position:"absolute",inset:0},[`${e}-dot`]:{position:"relative",display:"inline-block",fontSize:t.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),height:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:HQt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:MQt,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(o=>`${o} ${t.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:t.colorFillSecondary}},[`&-sm ${e}-dot`]:{"&, &-holder":{fontSize:t.dotSizeSM}},[`&-sm ${e}-dot-holder`]:{i:{width:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal(),height:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal()}},[`&-lg ${e}-dot`]:{"&, &-holder":{fontSize:t.dotSizeLG}},[`&-lg ${e}-dot-holder`]:{i:{width:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal(),height:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal()}},[`&${e}-show-text ${e}-text`]:{display:"block"}})}},zQt=t=>{const{controlHeightLG:e,controlHeight:n}=t;return{contentHeight:400,dotSize:e/2,dotSizeSM:e*.35,dotSizeLG:n}},DQt=el("Spin",t=>{const e=Ui(t,{spinDotDefault:t.colorTextDescription});return[IQt(e)]},zQt),EQt=200,PCe=[[30,.05],[70,.03],[96,.01]];function kQt(t,e){const[n,o]=g.useState(0),r=g.useRef(null),i=e==="auto";return g.useEffect(()=>(i&&t&&(o(0),r.current=setInterval(()=>{o(a=>{const l=100-a;for(let s=0;s{clearInterval(r.current)}),[i,t]),i?n:e}var FQt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e;const{prefixCls:n,spinning:o=!0,delay:r=0,className:i,rootClassName:a,size:l="default",tip:s,wrapperClassName:c,style:u,children:d,fullscreen:f=!1,indicator:p,percent:m}=t,y=FQt(t,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:w,direction:x,spin:C}=g.useContext(gr),P=w("spin",n),[A,S,v]=DQt(P),[b,T]=g.useState(()=>o&&!LQt(o,r)),R=kQt(b,m);g.useEffect(()=>{if(o){const F=TQt(r,()=>{T(!0)});return F(),()=>{var E;(E=F==null?void 0:F.cancel)===null||E===void 0||E.call(F)}}T(!1)},[r,o]);const M=g.useMemo(()=>typeof d<"u"&&!f,[d,f]),D=Mn(P,C==null?void 0:C.className,{[`${P}-sm`]:l==="small",[`${P}-lg`]:l==="large",[`${P}-spinning`]:b,[`${P}-show-text`]:!!s,[`${P}-rtl`]:x==="rtl"},i,!f&&a,S,v),k=Mn(`${P}-container`,{[`${P}-blur`]:b}),N=(e=p??(C==null?void 0:C.indicator))!==null&&e!==void 0?e:att,U=Object.assign(Object.assign({},C==null?void 0:C.style),u),W=g.createElement("div",Object.assign({},y,{style:U,className:D,"aria-live":"polite","aria-busy":b}),g.createElement(RQt,{prefixCls:P,indicator:N,percent:R}),s&&(M||f)?g.createElement("div",{className:`${P}-text`},s):null);return A(M?g.createElement("div",Object.assign({},y,{className:Mn(`${P}-nested-loading`,c,S,v)}),b&&g.createElement("div",{key:"loading"},W),g.createElement("div",{className:k,key:"container"},d)):f?g.createElement("div",{className:Mn(`${P}-fullscreen`,{[`${P}-fullscreen-show`]:b},a,S,v)},W):W)};Pee.setDefaultIndicator=t=>{att=t};const l3e=xe.createContext({});l3e.Consumer;var ltt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{prefixCls:e,className:n,avatar:o,title:r,description:i}=t,a=ltt(t,["prefixCls","className","avatar","title","description"]);const{getPrefixCls:l}=g.useContext(gr),s=l("list",e),c=Mn(`${s}-item-meta`,n),u=xe.createElement("div",{className:`${s}-item-meta-content`},r&&xe.createElement("h4",{className:`${s}-item-meta-title`},r),i&&xe.createElement("div",{className:`${s}-item-meta-description`},i));return xe.createElement("div",Object.assign({},a,{className:c}),o&&xe.createElement("div",{className:`${s}-item-meta-avatar`},o),(r||i)&&u)},NQt=xe.forwardRef((t,e)=>{const{prefixCls:n,children:o,actions:r,extra:i,styles:a,className:l,classNames:s,colStyle:c}=t,u=ltt(t,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:d,itemLayout:f}=g.useContext(l3e),{getPrefixCls:p,list:m}=g.useContext(gr),y=b=>{var T,R;return Mn((R=(T=m==null?void 0:m.item)===null||T===void 0?void 0:T.classNames)===null||R===void 0?void 0:R[b],s==null?void 0:s[b])},w=b=>{var T,R;return Object.assign(Object.assign({},(R=(T=m==null?void 0:m.item)===null||T===void 0?void 0:T.styles)===null||R===void 0?void 0:R[b]),a==null?void 0:a[b])},x=()=>{let b=!1;return g.Children.forEach(o,T=>{typeof T=="string"&&(b=!0)}),b&&g.Children.count(o)>1},C=()=>f==="vertical"?!!i:!x(),P=p("list",n),A=r&&r.length>0&&xe.createElement("ul",{className:Mn(`${P}-item-action`,y("actions")),key:"actions",style:w("actions")},r.map((b,T)=>xe.createElement("li",{key:`${P}-item-action-${T}`},b,T!==r.length-1&&xe.createElement("em",{className:`${P}-item-action-split`})))),S=d?"div":"li",v=xe.createElement(S,Object.assign({},u,d?{}:{ref:e},{className:Mn(`${P}-item`,{[`${P}-item-no-flex`]:!C()},l)}),f==="vertical"&&i?[xe.createElement("div",{className:`${P}-item-main`,key:"content"},o,A),xe.createElement("div",{className:Mn(`${P}-item-extra`,y("extra")),key:"extra",style:w("extra")},i)]:[o,A,P0(i,{key:"extra"})]);return d?xe.createElement(Ge,{ref:e,flex:1,style:c},v):v}),stt=NQt;stt.Meta=WQt;const UQt=t=>{const{listBorderedCls:e,componentCls:n,paddingLG:o,margin:r,itemPaddingSM:i,itemPaddingLG:a,marginLG:l,borderRadiusLG:s}=t;return{[e]:{border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:s,[`${n}-header,${n}-footer,${n}-item`]:{paddingInline:o},[`${n}-pagination`]:{margin:`${jt(r)} ${jt(l)}`}},[`${e}${n}-sm`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:i}},[`${e}${n}-lg`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:a}}}},jQt=t=>{const{componentCls:e,screenSM:n,screenMD:o,marginLG:r,marginSM:i,margin:a}=t;return{[`@media screen and (max-width:${o}px)`]:{[e]:{[`${e}-item`]:{[`${e}-item-action`]:{marginInlineStart:r}}},[`${e}-vertical`]:{[`${e}-item`]:{[`${e}-item-extra`]:{marginInlineStart:r}}}},[`@media screen and (max-width: ${n}px)`]:{[e]:{[`${e}-item`]:{flexWrap:"wrap",[`${e}-action`]:{marginInlineStart:i}}},[`${e}-vertical`]:{[`${e}-item`]:{flexWrap:"wrap-reverse",[`${e}-item-main`]:{minWidth:t.contentWidth},[`${e}-item-extra`]:{margin:`auto auto ${jt(a)}`}}}}}},BQt=t=>{const{componentCls:e,antCls:n,controlHeight:o,minHeight:r,paddingSM:i,marginLG:a,padding:l,itemPadding:s,colorPrimary:c,itemPaddingSM:u,itemPaddingLG:d,paddingXS:f,margin:p,colorText:m,colorTextDescription:y,motionDurationSlow:w,lineWidth:x,headerBg:C,footerBg:P,emptyTextPadding:A,metaMarginBottom:S,avatarMarginRight:v,titleMarginBottom:b,descriptionFontSize:T}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative","*":{outline:"none"},[`${e}-header`]:{background:C},[`${e}-footer`]:{background:P},[`${e}-header, ${e}-footer`]:{paddingBlock:i},[`${e}-pagination`]:{marginBlockStart:a,[`${n}-pagination-options`]:{textAlign:"start"}},[`${e}-spin`]:{minHeight:r,textAlign:"center"},[`${e}-items`]:{margin:0,padding:0,listStyle:"none"},[`${e}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:s,color:m,[`${e}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${e}-item-meta-avatar`]:{marginInlineEnd:v},[`${e}-item-meta-content`]:{flex:"1 0",width:0,color:m},[`${e}-item-meta-title`]:{margin:`0 0 ${jt(t.marginXXS)} 0`,color:m,fontSize:t.fontSize,lineHeight:t.lineHeight,"> a":{color:m,transition:`all ${w}`,"&:hover":{color:c}}},[`${e}-item-meta-description`]:{color:y,fontSize:T,lineHeight:t.lineHeight}},[`${e}-item-action`]:{flex:"0 0 auto",marginInlineStart:t.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${jt(f)}`,color:y,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${e}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:x,height:t.calc(t.fontHeight).sub(t.calc(t.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:t.colorSplit}}},[`${e}-empty`]:{padding:`${jt(l)} 0`,color:y,fontSize:t.fontSizeSM,textAlign:"center"},[`${e}-empty-text`]:{padding:A,color:t.colorTextDisabled,fontSize:t.fontSize,textAlign:"center"},[`${e}-item-no-flex`]:{display:"block"}}),[`${e}-grid ${n}-col > ${e}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},[`${e}-vertical ${e}-item`]:{alignItems:"initial",[`${e}-item-main`]:{display:"block",flex:1},[`${e}-item-extra`]:{marginInlineStart:a},[`${e}-item-meta`]:{marginBlockEnd:S,[`${e}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:b,color:m,fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}},[`${e}-item-action`]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:`0 ${jt(l)}`,"&:first-child":{paddingInlineStart:0}}}},[`${e}-split ${e}-item`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${e}-split ${e}-header`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-split${e}-empty ${e}-footer`]:{borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-loading ${e}-spin-nested-loading`]:{minHeight:o},[`${e}-split${e}-something-after-last-item ${n}-spin-container > ${e}-items > ${e}-item:last-child`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-lg ${e}-item`]:{padding:d},[`${e}-sm ${e}-item`]:{padding:u},[`${e}:not(${e}-vertical)`]:{[`${e}-item-no-flex`]:{[`${e}-item-action`]:{float:"right"}}}}},YQt=t=>({contentWidth:220,itemPadding:`${jt(t.paddingContentVertical)} 0`,itemPaddingSM:`${jt(t.paddingContentVerticalSM)} ${jt(t.paddingContentHorizontal)}`,itemPaddingLG:`${jt(t.paddingContentVerticalLG)} ${jt(t.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:t.padding,metaMarginBottom:t.padding,avatarMarginRight:t.padding,titleMarginBottom:t.paddingSM,descriptionFontSize:t.fontSize}),OQt=el("List",t=>{const e=Ui(t,{listBorderedCls:`${t.componentCls}-bordered`,minHeight:t.controlHeightLG});return[BQt(e),UQt(e),jQt(e)]},YQt);var _Qt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r(ze,Ae)=>{var se;T(ze),M(Ae),n&&((se=n==null?void 0:n[ve])===null||se===void 0||se.call(n,ze,Ae))},E=F("onChange"),L=F("onShowSizeChange"),j=(ve,ze)=>{if(!P)return null;let Ae;return typeof C=="function"?Ae=C(ve):C?Ae=ve[C]:Ae=ve.key,Ae||(Ae=`list-item-${ze}`),g.createElement(g.Fragment,{key:Ae},P(ve,ze))},Y=()=>!!(d||n||w),O=D("list",o),[_,G,Q]=OQt(O);let oe=x;typeof oe=="boolean"&&(oe={spinning:oe});const ee=!!(oe!=null&&oe.spinning),q=jd(m);let ae="";switch(q){case"large":ae="lg";break;case"small":ae="sm";break}const Z=Mn(O,{[`${O}-vertical`]:u==="vertical",[`${O}-${ae}`]:ae,[`${O}-split`]:i,[`${O}-bordered`]:r,[`${O}-loading`]:ee,[`${O}-grid`]:!!f,[`${O}-something-after-last-item`]:Y(),[`${O}-rtl`]:N==="rtl"},U==null?void 0:U.className,a,l,G,Q),ne=a3e(W,{total:p.length,current:b,pageSize:R},n||{}),te=Math.ceil(ne.total/ne.pageSize);ne.current>te&&(ne.current=te);const $=n&&g.createElement("div",{className:Mn(`${O}-pagination`)},g.createElement(ott,Object.assign({align:"end"},ne,{onChange:E,onShowSizeChange:L})));let le=Pa(p);n&&p.length>(ne.current-1)*ne.pageSize&&(le=Pa(p).splice((ne.current-1)*ne.pageSize,ne.pageSize));const de=Object.keys(f||{}).some(ve=>["xs","sm","md","lg","xl","xxl"].includes(ve)),he=MZ(de),me=g.useMemo(()=>{for(let ve=0;ve{if(!f)return;const ve=me&&f[me]?f[me]:f.column;if(ve)return{width:`${100/ve}%`,maxWidth:`${100/ve}%`}},[JSON.stringify(f),me]);let Pe=ee&&g.createElement("div",{style:{minHeight:53}});if(le.length>0){const ve=le.map((ze,Ae)=>j(ze,Ae));Pe=f?g.createElement(Qt,{gutter:f.gutter},g.Children.map(ve,ze=>g.createElement("div",{key:ze==null?void 0:ze.key,style:ce},ze))):g.createElement("ul",{className:`${O}-items`},ve)}else!c&&!ee&&(Pe=g.createElement("div",{className:`${O}-empty-text`},(A==null?void 0:A.emptyText)||(k==null?void 0:k("List"))||g.createElement(y9e,{componentName:"List"})));const pe=ne.position||"bottom",Ie=g.useMemo(()=>({grid:f,itemLayout:u}),[JSON.stringify(f),u]);return _(g.createElement(l3e.Provider,{value:Ie},g.createElement("div",Object.assign({ref:e,style:Object.assign(Object.assign({},U==null?void 0:U.style),s),className:Z},S),(pe==="top"||pe==="both")&&$,y&&g.createElement("div",{className:`${O}-header`},y),g.createElement(Pee,Object.assign({},oe),Pe,c),w&&g.createElement("div",{className:`${O}-footer`},w),d||(pe==="bottom"||pe==="both")&&$)))}const GQt=g.forwardRef(VQt),WL=GQt;WL.Item=stt;function XQt(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)&&t==null?[]:Array.isArray(t)?t:[t]}let cy=null,Ov=t=>t(),NL=[],UL={};function CCe(){const{getContainer:t,duration:e,rtl:n,maxCount:o,top:r}=UL,i=(t==null?void 0:t())||document.body;return{getContainer:()=>i,duration:e,rtl:n,maxCount:o,top:r}}const JQt=xe.forwardRef((t,e)=>{const{messageConfig:n,sync:o}=t,{getPrefixCls:r}=g.useContext(gr),i=UL.prefixCls||r("message"),a=g.useContext(DUt),[l,s]=K$e(Object.assign(Object.assign(Object.assign({},n),{prefixCls:i}),a.message));return xe.useImperativeHandle(e,()=>{const c=Object.assign({},l);return Object.keys(c).forEach(u=>{c[u]=function(){return o(),l[u].apply(l,arguments)}}),{instance:c,sync:o}}),s}),KQt=xe.forwardRef((t,e)=>{const[n,o]=xe.useState(CCe),r=()=>{o(CCe)};xe.useEffect(r,[]);const i=y$e(),a=i.getRootPrefixCls(),l=i.getIconPrefixCls(),s=i.getTheme(),c=xe.createElement(JQt,{ref:e,sync:r,messageConfig:n});return xe.createElement(n2,{prefixCls:a,iconPrefixCls:l,theme:s},i.holderRender?i.holderRender(c):c)});function Cee(){if(!cy){const t=document.createDocumentFragment(),e={fragment:t};cy=e,Ov(()=>{e9e()(xe.createElement(KQt,{ref:o=>{const{instance:r,sync:i}=o||{};Promise.resolve().then(()=>{!e.instance&&r&&(e.instance=r,e.sync=i,Cee())})}}),t)});return}cy.instance&&(NL.forEach(t=>{const{type:e,skipped:n}=t;if(!n)switch(e){case"open":{Ov(()=>{const o=cy.instance.open(Object.assign(Object.assign({},UL),t.config));o==null||o.then(t.resolve),t.setCloseFn(o)});break}case"destroy":Ov(()=>{cy==null||cy.instance.destroy(t.key)});break;default:Ov(()=>{var o;const r=(o=cy.instance)[e].apply(o,Pa(t.args));r==null||r.then(t.resolve),t.setCloseFn(r)})}}),NL=[])}function $Qt(t){UL=Object.assign(Object.assign({},UL),t),Ov(()=>{var e;(e=cy==null?void 0:cy.sync)===null||e===void 0||e.call(cy)})}function qQt(t){const e=Z5e(n=>{let o;const r={type:"open",config:t,resolve:n,setCloseFn:i=>{o=i}};return NL.push(r),()=>{o?Ov(()=>{o()}):r.skipped=!0}});return Cee(),e}function QQt(t,e){const n=Z5e(o=>{let r;const i={type:t,args:e,resolve:o,setCloseFn:a=>{r=a}};return NL.push(i),()=>{r?Ov(()=>{r()}):i.skipped=!0}});return Cee(),n}const ZQt=t=>{NL.push({type:"destroy",key:t}),Cee()},eZt=["success","info","warning","error","loading"],tZt={open:qQt,destroy:ZQt,config:$Qt,useMessage:tFt,_InternalPanelDoNotUseOrYouWillBeFired:Xkt},Dp=tZt;eZt.forEach(t=>{Dp[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o{const{prefixCls:e,className:n,closeIcon:o,closable:r,type:i,title:a,children:l,footer:s}=t,c=nZt(t,["prefixCls","className","closeIcon","closable","type","title","children","footer"]),{getPrefixCls:u}=g.useContext(gr),d=u(),f=e||u("modal"),p=nu(d),[m,y,w]=Eqe(f,p),x=`${f}-confirm`;let C={};return i?C={closable:r??!1,title:"",footer:"",children:g.createElement(Fqe,Object.assign({},t,{prefixCls:f,confirmPrefixCls:x,rootPrefixCls:d,content:l}))}:C={closable:r??!0,title:a,footer:s!==null&&g.createElement(Hqe,Object.assign({},t)),children:l},m(g.createElement(gqe,Object.assign({prefixCls:f,className:Mn(y,`${f}-pure-panel`,i&&x,i&&`${x}-${i}`,n,w,p)},c,{closeIcon:Rqe(f,o),closable:r},C)))},rZt=_qe(oZt);function ctt(t){return pU(Uqe(t))}const li=kqe;li.useModal=zUt;li.info=function(e){return pU(jqe(e))};li.success=function(e){return pU(Bqe(e))};li.error=function(e){return pU(Yqe(e))};li.warning=ctt;li.warn=ctt;li.confirm=function(e){return pU(Oqe(e))};li.destroyAll=function(){for(;jv.length;){const e=jv.pop();e&&e()}};li.config=CUt;li._InternalPanelDoNotUseOrYouWillBeFired=rZt;var iZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 244c176.18 0 319 142.82 319 319v233a32 32 0 01-32 32H225a32 32 0 01-32-32V563c0-176.18 142.82-319 319-319zM484 68h56a8 8 0 018 8v96a8 8 0 01-8 8h-56a8 8 0 01-8-8V76a8 8 0 018-8zM177.25 191.66a8 8 0 0111.32 0l67.88 67.88a8 8 0 010 11.31l-39.6 39.6a8 8 0 01-11.31 0l-67.88-67.88a8 8 0 010-11.31l39.6-39.6zm669.6 0l39.6 39.6a8 8 0 010 11.3l-67.88 67.9a8 8 0 01-11.32 0l-39.6-39.6a8 8 0 010-11.32l67.89-67.88a8 8 0 0111.31 0zM192 892h640a32 32 0 0132 32v24a8 8 0 01-8 8H168a8 8 0 01-8-8v-24a32 32 0 0132-32zm148-317v253h64V575h-64z"}}]},name:"alert",theme:"filled"},aZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:iZt}))},lZt=g.forwardRef(aZt),sZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"},cZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:sZt}))},uZt=g.forwardRef(cZt),dZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"},fZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:dZt}))},hZt=g.forwardRef(fZt),pZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"}}]},name:"bg-colors",theme:"outlined"},gZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:pZt}))},mZt=g.forwardRef(gZt),yZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 248H728l-32.4-90.8a32.07 32.07 0 00-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z"}}]},name:"camera",theme:"outlined"},AZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:yZt}))},nd=g.forwardRef(AZt),wZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"filled"},xZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:wZt}))},vZt=g.forwardRef(xZt),bZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"},SZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:bZt}))},utt=g.forwardRef(SZt),TZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"},PZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:TZt}))},Bh=g.forwardRef(PZt),CZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"}}]},name:"caret-up",theme:"outlined"},RZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:CZt}))},HZt=g.forwardRef(RZt),MZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584zM688 420h-55.2c-5.1 0-10 2.5-13 6.6L468.9 634.4l-64.7-89c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0026 0l212.6-292.7c3.8-5.4 0-12.8-6.5-12.8z"}}]},name:"carry-out",theme:"outlined"},IZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:MZt}))},zZt=g.forwardRef(IZt),DZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},EZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:DZt}))},kZt=g.forwardRef(EZt),FZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.3 459a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-upload",theme:"outlined"},LZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:FZt}))},WZt=g.forwardRef(LZt),NZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"}}]},name:"copy",theme:"outlined"},UZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:NZt}))},dtt=g.forwardRef(UZt),jZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},BZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:jZt}))},ftt=g.forwardRef(BZt),YZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM288 604a64 64 0 10128 0 64 64 0 10-128 0zm118-224a48 48 0 1096 0 48 48 0 10-96 0zm158 228a96 96 0 10192 0 96 96 0 10-192 0zm148-314a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"dot-chart",theme:"outlined"},OZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:YZt}))},_Zt=g.forwardRef(OZt),VZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M690 405h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 563.6 406.8 418.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"down-circle",theme:"outlined"},GZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:VZt}))},XZt=g.forwardRef(GZt),JZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32zm-622.3-84c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9z"}}]},name:"edit",theme:"filled"},KZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:JZt}))},$Zt=g.forwardRef(KZt),qZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"},QZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:qZt}))},htt=g.forwardRef(QZt),ZZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"},een=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ZZt}))},ten=g.forwardRef(een),nen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},oen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:nen}))},_y=g.forwardRef(oen),ren={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},ien=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ren}))},aen=g.forwardRef(ien),len={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"},sen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:len}))},ptt=g.forwardRef(sen),cen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"},uen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:cen}))},den=g.forwardRef(uen),fen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},hen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:fen}))},gtt=g.forwardRef(hen),pen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},gen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:pen}))},men=g.forwardRef(gen),yen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},Aen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:yen}))},wen=g.forwardRef(Aen),xen={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},ven=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:xen}))},ben=g.forwardRef(ven),Sen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M603.3 327.5l-246 178a7.95 7.95 0 000 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"left-circle",theme:"outlined"},Ten=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Sen}))},Pen=g.forwardRef(Ten),Cen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"},Ren=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Cen}))},Hen=g.forwardRef(Ren),Men={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"minus-square",theme:"outlined"},Ien=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Men}))},zen=g.forwardRef(Ien),Den={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"more",theme:"outlined"},Een=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Den}))},ken=g.forwardRef(Een),Fen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"},Len=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Fen}))},Wen=g.forwardRef(Len),Nen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3-15.4 12.3-16.6 35.4-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8z"}}]},name:"pushpin",theme:"filled"},Uen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Nen}))},jen=g.forwardRef(Uen),Ben={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z"}}]},name:"pushpin",theme:"outlined"},Yen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Ben}))},RCe=g.forwardRef(Yen),Oen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},_en=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Oen}))},Lf=g.forwardRef(_en),Ven={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"right-circle",theme:"outlined"},Gen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Ven}))},mtt=g.forwardRef(Gen),Xen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},Jen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Xen}))},Wf=g.forwardRef(Jen),Ken={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},$en=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Ken}))},qen=g.forwardRef($en),Qen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z"}}]},name:"sort-ascending",theme:"outlined"},Zen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Qen}))},etn=g.forwardRef(Zen),ttn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM310.3 167.1a8 8 0 00-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z"}}]},name:"sort-descending",theme:"outlined"},ntn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ttn}))},otn=g.forwardRef(ntn),rtn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"unordered-list",theme:"outlined"},itn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:rtn}))},R0=g.forwardRef(itn),atn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.5 360.3a7.95 7.95 0 00-12.9 0l-178 246c-3.8 5.3 0 12.7 6.5 12.7H381c10.2 0 19.9-4.9 25.9-13.2L512 460.4l105.2 145.4c6 8.3 15.6 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.5-12.7l-178-246z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"up-circle",theme:"outlined"},ltn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:atn}))},stn=g.forwardRef(ltn),ctn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},utn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ctn}))},dtn=g.forwardRef(utn),ftn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M859.9 780H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM505.7 669a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V176c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8z"}}]},name:"vertical-align-bottom",theme:"outlined"},htn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ftn}))},ptn=g.forwardRef(htn),gtn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},mtn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:gtn}))},a7=g.forwardRef(mtn),ytn=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],ytt=g.forwardRef(function(t,e){var n,o=t.prefixCls,r=o===void 0?"rc-switch":o,i=t.className,a=t.checked,l=t.defaultChecked,s=t.disabled,c=t.loadingIcon,u=t.checkedChildren,d=t.unCheckedChildren,f=t.onClick,p=t.onChange,m=t.onKeyDown,y=Ai(t,ytn),w=o0(!1,{value:a,defaultValue:l}),x=Sn(w,2),C=x[0],P=x[1];function A(T,R){var M=C;return s||(M=T,P(M),p==null||p(M,R)),M}function S(T){T.which===Lo.LEFT?A(!1,T):T.which===Lo.RIGHT&&A(!0,T),m==null||m(T)}function v(T){var R=A(!C,T);f==null||f(R,T)}var b=Bn(r,i,(n={},Ut(n,"".concat(r,"-checked"),C),Ut(n,"".concat(r,"-disabled"),s),n));return g.createElement("button",Uo({},y,{type:"button",role:"switch","aria-checked":C,disabled:s,className:b,ref:e,onKeyDown:S,onClick:v}),c,g.createElement("span",{className:"".concat(r,"-inner")},g.createElement("span",{className:"".concat(r,"-inner-checked")},u),g.createElement("span",{className:"".concat(r,"-inner-unchecked")},d)))});ytt.displayName="Switch";const Atn=t=>{const{componentCls:e,trackHeightSM:n,trackPadding:o,trackMinWidthSM:r,innerMinMarginSM:i,innerMaxMarginSM:a,handleSizeSM:l,calc:s}=t,c=`${e}-inner`,u=jt(s(l).add(s(o).mul(2)).equal()),d=jt(s(a).mul(2).equal());return{[e]:{[`&${e}-small`]:{minWidth:r,height:n,lineHeight:jt(n),[`${e}-inner`]:{paddingInlineStart:a,paddingInlineEnd:i,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${u} - ${d})`,marginInlineEnd:`calc(100% - ${u} + ${d})`},[`${c}-unchecked`]:{marginTop:s(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${e}-handle`]:{width:l,height:l},[`${e}-loading-icon`]:{top:s(s(l).sub(t.switchLoadingIconSize)).div(2).equal(),fontSize:t.switchLoadingIconSize},[`&${e}-checked`]:{[`${e}-inner`]:{paddingInlineStart:i,paddingInlineEnd:a,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${u} + ${d})`,marginInlineEnd:`calc(-100% + ${u} - ${d})`}},[`${e}-handle`]:{insetInlineStart:`calc(100% - ${jt(s(l).add(o).equal())})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:s(t.marginXXS).div(2).equal(),marginInlineEnd:s(t.marginXXS).mul(-1).div(2).equal()}},[`&${e}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:s(t.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:s(t.marginXXS).div(2).equal()}}}}}}},wtn=t=>{const{componentCls:e,handleSize:n,calc:o}=t;return{[e]:{[`${e}-loading-icon${t.iconCls}`]:{position:"relative",top:o(o(n).sub(t.fontSize)).div(2).equal(),color:t.switchLoadingIconColor,verticalAlign:"top"},[`&${e}-checked ${e}-loading-icon`]:{color:t.switchColor}}}},xtn=t=>{const{componentCls:e,trackPadding:n,handleBg:o,handleShadow:r,handleSize:i,calc:a}=t,l=`${e}-handle`;return{[e]:{[l]:{position:"absolute",top:n,insetInlineStart:n,width:i,height:i,transition:`all ${t.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:o,borderRadius:a(i).div(2).equal(),boxShadow:r,transition:`all ${t.switchDuration} ease-in-out`,content:'""'}},[`&${e}-checked ${l}`]:{insetInlineStart:`calc(100% - ${jt(a(i).add(n).equal())})`},[`&:not(${e}-disabled):active`]:{[`${l}::before`]:{insetInlineEnd:t.switchHandleActiveInset,insetInlineStart:0},[`&${e}-checked ${l}::before`]:{insetInlineEnd:0,insetInlineStart:t.switchHandleActiveInset}}}}},vtn=t=>{const{componentCls:e,trackHeight:n,trackPadding:o,innerMinMargin:r,innerMaxMargin:i,handleSize:a,calc:l}=t,s=`${e}-inner`,c=jt(l(a).add(l(o).mul(2)).equal()),u=jt(l(i).mul(2).equal());return{[e]:{[s]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:i,paddingInlineEnd:r,transition:`padding-inline-start ${t.switchDuration} ease-in-out, padding-inline-end ${t.switchDuration} ease-in-out`,[`${s}-checked, ${s}-unchecked`]:{display:"block",color:t.colorTextLightSolid,fontSize:t.fontSizeSM,transition:`margin-inline-start ${t.switchDuration} ease-in-out, margin-inline-end ${t.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:n},[`${s}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${u})`,marginInlineEnd:`calc(100% - ${c} + ${u})`},[`${s}-unchecked`]:{marginTop:l(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${e}-checked ${s}`]:{paddingInlineStart:r,paddingInlineEnd:i,[`${s}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${s}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${u})`,marginInlineEnd:`calc(-100% + ${c} - ${u})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${s}`]:{[`${s}-unchecked`]:{marginInlineStart:l(o).mul(2).equal(),marginInlineEnd:l(o).mul(-1).mul(2).equal()}},[`&${e}-checked ${s}`]:{[`${s}-checked`]:{marginInlineStart:l(o).mul(-1).mul(2).equal(),marginInlineEnd:l(o).mul(2).equal()}}}}}},btn=t=>{const{componentCls:e,trackHeight:n,trackMinWidth:o}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:o,height:n,lineHeight:jt(n),verticalAlign:"middle",background:t.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${t.motionDurationMid}`,userSelect:"none",[`&:hover:not(${e}-disabled)`]:{background:t.colorTextTertiary}}),Yy(t)),{[`&${e}-checked`]:{background:t.switchColor,[`&:hover:not(${e}-disabled)`]:{background:t.colorPrimaryHover}},[`&${e}-loading, &${e}-disabled`]:{cursor:"not-allowed",opacity:t.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${e}-rtl`]:{direction:"rtl"}})}},Stn=t=>{const{fontSize:e,lineHeight:n,controlHeight:o,colorWhite:r}=t,i=e*n,a=o/2,l=2,s=i-l*2,c=a-l*2;return{trackHeight:i,trackHeightSM:a,trackMinWidth:s*2+l*4,trackMinWidthSM:c*2+l*2,trackPadding:l,handleBg:r,handleSize:s,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new Di("#00230b").setA(.2).toRgbString()}`,innerMinMargin:s/2,innerMaxMargin:s+l+l*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+l+l*2}},Ttn=el("Switch",t=>{const e=Ui(t,{switchDuration:t.motionDurationMid,switchColor:t.colorPrimary,switchDisabledOpacity:t.opacityLoading,switchLoadingIconSize:t.calc(t.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${t.opacityLoading})`,switchHandleActiveInset:"-30%"});return[btn(e),vtn(e),xtn(e),wtn(e),Atn(e)]},Stn);var Ptn=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,size:o,disabled:r,loading:i,className:a,rootClassName:l,style:s,checked:c,value:u,defaultChecked:d,defaultValue:f,onChange:p}=t,m=Ptn(t,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[y,w]=qA(!1,{value:c??u,defaultValue:d??f}),{getPrefixCls:x,direction:C,switch:P}=g.useContext(gr),A=g.useContext(Bp),S=(r??A)||i,v=x("switch",n),b=g.createElement("div",{className:`${v}-handle`},i&&g.createElement(qM,{className:`${v}-loading-icon`})),[T,R,M]=Ttn(v),D=jd(o),k=Mn(P==null?void 0:P.className,{[`${v}-small`]:D==="small",[`${v}-loading`]:i,[`${v}-rtl`]:C==="rtl"},a,l,R,M),N=Object.assign(Object.assign({},P==null?void 0:P.style),s),U=function(){w(arguments.length<=0?void 0:arguments[0]),p==null||p.apply(void 0,arguments)};return T(g.createElement(lU,{component:"Switch"},g.createElement(ytt,Object.assign({},m,{checked:y,onChange:U,prefixCls:v,className:k,style:N,disabled:S,ref:e,loadingIcon:b}))))}),zc=Ctn;zc.__ANT_SWITCH=!0;var aA={},TU="rc-table-internal-hook";function s3e(t){var e=g.createContext(void 0),n=function(r){var i=r.value,a=r.children,l=g.useRef(i);l.current=i;var s=g.useState(function(){return{getValue:function(){return l.current},listeners:new Set}}),c=Sn(s,1),u=c[0];return Ml(function(){r0.unstable_batchedUpdates(function(){u.listeners.forEach(function(d){d(i)})})},[i]),g.createElement(e.Provider,{value:u},a)};return{Context:e,Provider:n,defaultValue:t}}function If(t,e){var n=Dd(typeof e=="function"?e:function(d){if(e===void 0)return d;if(!Array.isArray(e))return d[e];var f={};return e.forEach(function(p){f[p]=d[p]}),f}),o=g.useContext(t==null?void 0:t.Context),r=o||{},i=r.listeners,a=r.getValue,l=g.useRef();l.current=n(o?a():t==null?void 0:t.defaultValue);var s=g.useState({}),c=Sn(s,2),u=c[1];return Ml(function(){if(!o)return;function d(f){var p=n(f);Vb(l.current,p,!0)||u({})}return i.add(d),function(){i.delete(d)}},[o]),l.current}function Rtn(){var t=g.createContext(null);function e(){return g.useContext(t)}function n(r,i){var a=Z8(r),l=function(c,u){var d=a?{ref:u}:{},f=g.useRef(0),p=g.useRef(c),m=e();return m!==null?g.createElement(r,Uo({},c,d)):((!i||i(p.current,c))&&(f.current+=1),p.current=c,g.createElement(t.Provider,{value:f.current},g.createElement(r,Uo({},c,d))))};return a?g.forwardRef(l):l}function o(r,i){var a=Z8(r),l=function(c,u){var d=a?{ref:u}:{};return e(),g.createElement(r,Uo({},c,d))};return a?g.memo(g.forwardRef(l),i):g.memo(l,i)}return{makeImmutable:n,responseImmutable:o,useImmutableMark:e}}var c3e=Rtn(),Att=c3e.makeImmutable,lI=c3e.responseImmutable,Htn=c3e.useImmutableMark,Kp=s3e();function wtt(t,e,n){var o=g.useRef({});return(!("value"in o.current)||n(o.current.condition,e))&&(o.current.value=t(),o.current.condition=e),o.current.value}var _he={},Mtn=function(e){};function Itn(t,e){}function ztn(t,e){}function Dtn(){_he={}}function xtt(t,e,n){!e&&!_he[n]&&(t(!1,n),_he[n]=!0)}function Ree(t,e){xtt(Itn,t,e)}function Etn(t,e){xtt(ztn,t,e)}Ree.preMessage=Mtn;Ree.resetWarned=Dtn;Ree.noteOnce=Etn;function vtt(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=new Set;function r(i,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=o.has(i);if(Ree(!s,"Warning: There may be circular references"),s)return!1;if(i===a)return!0;if(n&&l>1)return!1;o.add(i);var c=l+1;if(Array.isArray(i)){if(!Array.isArray(a)||i.length!==a.length)return!1;for(var u=0;u=n}function jtn(t,e){return If(Kp,function(n){var o=Utn(t,e||1,n.hoverStartRow,n.hoverEndRow);return[o,n.onHover]})}function qb(t){var e=g.useRef();e.current=t;var n=g.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a{const{componentCls:e}=t;return{[`${e}-item`]:{display:"inline-block",minWidth:t.itemSize,height:t.itemSize,marginInlineEnd:t.marginXS,fontFamily:t.fontFamily,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:t.itemBg,border:`${jt(t.lineWidth)} ${t.lineType} transparent`,borderRadius:t.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:`0 ${jt(t.paginationItemPaddingInline)}`,color:t.colorText,"&:hover":{textDecoration:"none"}},[`&:not(${e}-item-active)`]:{"&:hover":{transition:`all ${t.motionDurationMid}`,backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},"&-active":{fontWeight:t.fontWeightStrong,backgroundColor:t.itemActiveBg,borderColor:t.colorPrimary,a:{color:t.colorPrimary},"&:hover":{borderColor:t.colorPrimaryHover},"&:hover a":{color:t.colorPrimaryHover}}}}},yQt=t=>{const{componentCls:e}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{display:"flex","&-start":{justifyContent:"start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:"end"},"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},[`${e}-total-text`]:{display:"inline-block",height:t.itemSize,marginInlineEnd:t.marginXS,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),verticalAlign:"middle"}}),mQt(t)),gQt(t)),pQt(t)),hQt(t)),fQt(t)),{[`@media only screen and (max-width: ${t.screenLG}px)`]:{[`${e}-item`]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},[`@media only screen and (max-width: ${t.screenSM}px)`]:{[`${e}-options`]:{display:"none"}}}),[`&${t.componentCls}-rtl`]:{direction:"rtl"}}},AQt=t=>{const{componentCls:e}=t;return{[`${e}:not(${e}-disabled)`]:{[`${e}-item`]:Object.assign({},Yy(t)),[`${e}-jump-prev, ${e}-jump-next`]:{"&:focus-visible":Object.assign({[`${e}-item-link-icon`]:{opacity:1},[`${e}-item-ellipsis`]:{opacity:0}},z3(t))},[`${e}-prev, ${e}-next`]:{[`&:focus-visible ${e}-item-link`]:Object.assign({},z3(t))}}}},ttt=t=>Object.assign({itemBg:t.colorBgContainer,itemSize:t.controlHeight,itemSizeSM:t.controlHeightSM,itemActiveBg:t.colorBgContainer,itemLinkBg:t.colorBgContainer,itemActiveColorDisabled:t.colorTextDisabled,itemActiveBgDisabled:t.controlItemBgActiveDisabled,itemInputBg:t.colorBgContainer,miniOptionsSizeChangerTop:0},xU(t)),ntt=t=>Ui(t,{inputOutlineOffset:0,paginationMiniOptionsMarginInlineStart:t.calc(t.marginXXS).div(2).equal(),paginationMiniQuickJumperInputWidth:t.calc(t.controlHeightLG).mul(1.1).equal(),paginationItemPaddingInline:t.calc(t.marginXXS).mul(1.5).equal(),paginationEllipsisLetterSpacing:t.calc(t.marginXXS).div(2).equal(),paginationSlashMarginInlineStart:t.marginSM,paginationSlashMarginInlineEnd:t.marginSM,paginationEllipsisTextIndent:"0.13em"},wU(t)),wQt=el("Pagination",t=>{const e=ntt(t);return[yQt(e),AQt(e)]},ttt),xQt=t=>{const{componentCls:e}=t;return{[`${e}${e}-bordered${e}-disabled:not(${e}-mini)`]:{"&, &:hover":{[`${e}-item-link`]:{borderColor:t.colorBorder}},"&:focus-visible":{[`${e}-item-link`]:{borderColor:t.colorBorder}},[`${e}-item, ${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,[`&:hover:not(${e}-item-active)`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,a:{color:t.colorTextDisabled}},[`&${e}-item-active`]:{backgroundColor:t.itemActiveBgDisabled}},[`${e}-prev, ${e}-next`]:{"&:hover button":{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,color:t.colorTextDisabled},[`${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder}}},[`${e}${e}-bordered:not(${e}-mini)`]:{[`${e}-prev, ${e}-next`]:{"&:hover button":{borderColor:t.colorPrimaryHover,backgroundColor:t.itemBg},[`${e}-item-link`]:{backgroundColor:t.itemLinkBg,borderColor:t.colorBorder},[`&:hover ${e}-item-link`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,color:t.colorPrimary},[`&${e}-disabled`]:{[`${e}-item-link`]:{borderColor:t.colorBorder,color:t.colorTextDisabled}}},[`${e}-item`]:{backgroundColor:t.itemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,[`&:hover:not(${e}-item-active)`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,a:{color:t.colorPrimary}},"&-active":{borderColor:t.colorPrimary}}}}},vQt=rU(["Pagination","bordered"],t=>{const e=ntt(t);return[xQt(e)]},ttt);function bCe(t){return g.useMemo(()=>typeof t=="boolean"?[t,{}]:t&&typeof t=="object"?[!0,t]:[void 0,void 0],[t])}var bQt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{align:e,prefixCls:n,selectPrefixCls:o,className:r,rootClassName:i,style:a,size:l,locale:s,responsive:c,showSizeChanger:u,selectComponentClass:d,pageSizeOptions:f}=t,p=bQt(t,["align","prefixCls","selectPrefixCls","className","rootClassName","style","size","locale","responsive","showSizeChanger","selectComponentClass","pageSizeOptions"]),{xs:m}=MZ(c),[,y]=Ff(),{getPrefixCls:w,direction:x,pagination:C={}}=g.useContext(gr),P=w("pagination",n),[A,S,v]=wQt(P),b=jd(l),T=b==="small"||!!(m&&!b&&c),[R]=r6("Pagination",PKe),M=Object.assign(Object.assign({},R),s),[D,k]=bCe(u),[N,U]=bCe(C.showSizeChanger),W=D??N,F=k??U,E=d||Ko,L=g.useMemo(()=>f?f.map(Q=>Number(Q)):void 0,[f]),j=Q=>{var oe;const{disabled:ee,size:$,onSizeChange:ae,"aria-label":Z,className:ne,options:te}=Q,{className:q,onChange:le}=F||{},de=(oe=te.find(he=>String(he.value)===String($)))===null||oe===void 0?void 0:oe.value;return g.createElement(E,Object.assign({disabled:ee,showSearch:!0,popupMatchSelectWidth:!1,getPopupContainer:he=>he.parentNode,"aria-label":Z,options:te},F,{value:de,onChange:(he,me)=>{ae==null||ae(he),le==null||le(he,me)},size:T?"small":"middle",className:Mn(ne,q)}))},Y=g.useMemo(()=>{const Q=g.createElement("span",{className:`${P}-item-ellipsis`},"•••"),oe=g.createElement("button",{className:`${P}-item-link`,type:"button",tabIndex:-1},x==="rtl"?g.createElement(xH,null):g.createElement(sJ,null)),ee=g.createElement("button",{className:`${P}-item-link`,type:"button",tabIndex:-1},x==="rtl"?g.createElement(sJ,null):g.createElement(xH,null)),$=g.createElement("a",{className:`${P}-item-link`},g.createElement("div",{className:`${P}-item-container`},x==="rtl"?g.createElement(wCe,{className:`${P}-item-link-icon`}):g.createElement(ACe,{className:`${P}-item-link-icon`}),Q)),ae=g.createElement("a",{className:`${P}-item-link`},g.createElement("div",{className:`${P}-item-container`},x==="rtl"?g.createElement(ACe,{className:`${P}-item-link-icon`}):g.createElement(wCe,{className:`${P}-item-link-icon`}),Q));return{prevIcon:oe,nextIcon:ee,jumpPrevIcon:$,jumpNextIcon:ae}},[x,P]),O=w("select",o),_=Mn({[`${P}-${e}`]:!!e,[`${P}-mini`]:T,[`${P}-rtl`]:x==="rtl",[`${P}-bordered`]:y.wireframe},C==null?void 0:C.className,r,i,S,v),G=Object.assign(Object.assign({},C==null?void 0:C.style),a);return A(g.createElement(g.Fragment,null,y.wireframe&&g.createElement(vQt,{prefixCls:P}),g.createElement(dQt,Object.assign({},Y,p,{style:G,prefixCls:P,selectPrefixCls:O,className:_,locale:M,pageSizeOptions:L,showSizeChanger:W,sizeChangerRender:j}))))};function SQt(t,e,n){var o=n||{},r=o.noTrailing,i=r===void 0?!1:r,a=o.noLeading,l=a===void 0?!1:a,s=o.debounceMode,c=s===void 0?void 0:s,u,d=!1,f=0;function p(){u&&clearTimeout(u)}function m(w){var x=w||{},C=x.upcomingOnly,P=C===void 0?!1:C;p(),d=!P}function y(){for(var w=arguments.length,x=new Array(w),C=0;Ct?l?(f=Date.now(),i||(u=setTimeout(c?v:S,t))):S():i!==!0&&(u=setTimeout(c?v:S,c===void 0?t-A:t))}return y.cancel=m,y}function TQt(t,e,n){var o={},r=o.atBegin,i=r===void 0?!1:r;return SQt(t,e,{debounceMode:i!==!1})}const yJ=100,rtt=yJ/5,itt=yJ/2-rtt/2,ase=itt*2*Math.PI,SCe=50,TCe=t=>{const{dotClassName:e,style:n,hasCircleCls:o}=t;return g.createElement("circle",{className:Mn(`${e}-circle`,{[`${e}-circle-bg`]:o}),r:itt,cx:SCe,cy:SCe,strokeWidth:rtt,style:n})},PQt=t=>{let{percent:e,prefixCls:n}=t;const o=`${n}-dot`,r=`${o}-holder`,i=`${r}-hidden`,[a,l]=g.useState(!1);MA(()=>{e!==0&&l(!0)},[e!==0]);const s=Math.max(Math.min(e,100),0);if(!a)return null;const c={strokeDashoffset:`${ase/4}`,strokeDasharray:`${ase*s/100} ${ase*(100-s)/100}`};return g.createElement("span",{className:Mn(r,`${o}-progress`,s<=0&&i)},g.createElement("svg",{viewBox:`0 0 ${yJ} ${yJ}`,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s},g.createElement(TCe,{dotClassName:o,hasCircleCls:!0}),g.createElement(TCe,{dotClassName:o,style:c})))};function CQt(t){const{prefixCls:e,percent:n=0}=t,o=`${e}-dot`,r=`${o}-holder`,i=`${r}-hidden`;return g.createElement(g.Fragment,null,g.createElement("span",{className:Mn(r,n>0&&i)},g.createElement("span",{className:Mn(o,`${e}-dot-spin`)},[1,2,3,4].map(a=>g.createElement("i",{className:`${e}-dot-item`,key:a})))),g.createElement(PQt,{prefixCls:e,percent:n}))}function RQt(t){const{prefixCls:e,indicator:n,percent:o}=t,r=`${e}-dot`;return n&&g.isValidElement(n)?P0(n,{className:Mn(n.props.className,r),percent:o}):g.createElement(CQt,{prefixCls:e,percent:o})}const HQt=new xa("antSpinMove",{to:{opacity:1}}),MQt=new xa("antRotate",{to:{transform:"rotate(405deg)"}}),IQt=t=>{const{componentCls:e,calc:n}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{position:"absolute",display:"none",color:t.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${t.motionDurationSlow} ${t.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${e}-text`]:{fontSize:t.fontSize,paddingTop:n(n(t.dotSize).sub(t.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:t.colorBgMask,zIndex:t.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${t.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[e]:{[`${e}-dot-holder`]:{color:t.colorWhite},[`${e}-text`]:{color:t.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${e}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:t.contentHeight,[`${e}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:n(t.dotSize).mul(-1).div(2).equal()},[`${e}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${t.colorBgContainer}`},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${e}-dot`]:{margin:n(t.dotSizeSM).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeSM).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${e}-dot`]:{margin:n(t.dotSizeLG).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeLG).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${e}-container`]:{position:"relative",transition:`opacity ${t.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:t.colorBgContainer,opacity:0,transition:`all ${t.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${e}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:t.spinDotDefault},[`${e}-dot-holder`]:{width:"1em",height:"1em",fontSize:t.dotSize,display:"inline-block",transition:`transform ${t.motionDurationSlow} ease, opacity ${t.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:t.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${e}-dot-progress`]:{position:"absolute",inset:0},[`${e}-dot`]:{position:"relative",display:"inline-block",fontSize:t.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),height:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:HQt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:MQt,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(o=>`${o} ${t.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:t.colorFillSecondary}},[`&-sm ${e}-dot`]:{"&, &-holder":{fontSize:t.dotSizeSM}},[`&-sm ${e}-dot-holder`]:{i:{width:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal(),height:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal()}},[`&-lg ${e}-dot`]:{"&, &-holder":{fontSize:t.dotSizeLG}},[`&-lg ${e}-dot-holder`]:{i:{width:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal(),height:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal()}},[`&${e}-show-text ${e}-text`]:{display:"block"}})}},zQt=t=>{const{controlHeightLG:e,controlHeight:n}=t;return{contentHeight:400,dotSize:e/2,dotSizeSM:e*.35,dotSizeLG:n}},DQt=el("Spin",t=>{const e=Ui(t,{spinDotDefault:t.colorTextDescription});return[IQt(e)]},zQt),EQt=200,PCe=[[30,.05],[70,.03],[96,.01]];function kQt(t,e){const[n,o]=g.useState(0),r=g.useRef(null),i=e==="auto";return g.useEffect(()=>(i&&t&&(o(0),r.current=setInterval(()=>{o(a=>{const l=100-a;for(let s=0;s{clearInterval(r.current)}),[i,t]),i?n:e}var FQt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e;const{prefixCls:n,spinning:o=!0,delay:r=0,className:i,rootClassName:a,size:l="default",tip:s,wrapperClassName:c,style:u,children:d,fullscreen:f=!1,indicator:p,percent:m}=t,y=FQt(t,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:w,direction:x,spin:C}=g.useContext(gr),P=w("spin",n),[A,S,v]=DQt(P),[b,T]=g.useState(()=>o&&!LQt(o,r)),R=kQt(b,m);g.useEffect(()=>{if(o){const F=TQt(r,()=>{T(!0)});return F(),()=>{var E;(E=F==null?void 0:F.cancel)===null||E===void 0||E.call(F)}}T(!1)},[r,o]);const M=g.useMemo(()=>typeof d<"u"&&!f,[d,f]),D=Mn(P,C==null?void 0:C.className,{[`${P}-sm`]:l==="small",[`${P}-lg`]:l==="large",[`${P}-spinning`]:b,[`${P}-show-text`]:!!s,[`${P}-rtl`]:x==="rtl"},i,!f&&a,S,v),k=Mn(`${P}-container`,{[`${P}-blur`]:b}),N=(e=p??(C==null?void 0:C.indicator))!==null&&e!==void 0?e:att,U=Object.assign(Object.assign({},C==null?void 0:C.style),u),W=g.createElement("div",Object.assign({},y,{style:U,className:D,"aria-live":"polite","aria-busy":b}),g.createElement(RQt,{prefixCls:P,indicator:N,percent:R}),s&&(M||f)?g.createElement("div",{className:`${P}-text`},s):null);return A(M?g.createElement("div",Object.assign({},y,{className:Mn(`${P}-nested-loading`,c,S,v)}),b&&g.createElement("div",{key:"loading"},W),g.createElement("div",{className:k,key:"container"},d)):f?g.createElement("div",{className:Mn(`${P}-fullscreen`,{[`${P}-fullscreen-show`]:b},a,S,v)},W):W)};Pee.setDefaultIndicator=t=>{att=t};const l3e=xe.createContext({});l3e.Consumer;var ltt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{prefixCls:e,className:n,avatar:o,title:r,description:i}=t,a=ltt(t,["prefixCls","className","avatar","title","description"]);const{getPrefixCls:l}=g.useContext(gr),s=l("list",e),c=Mn(`${s}-item-meta`,n),u=xe.createElement("div",{className:`${s}-item-meta-content`},r&&xe.createElement("h4",{className:`${s}-item-meta-title`},r),i&&xe.createElement("div",{className:`${s}-item-meta-description`},i));return xe.createElement("div",Object.assign({},a,{className:c}),o&&xe.createElement("div",{className:`${s}-item-meta-avatar`},o),(r||i)&&u)},NQt=xe.forwardRef((t,e)=>{const{prefixCls:n,children:o,actions:r,extra:i,styles:a,className:l,classNames:s,colStyle:c}=t,u=ltt(t,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:d,itemLayout:f}=g.useContext(l3e),{getPrefixCls:p,list:m}=g.useContext(gr),y=b=>{var T,R;return Mn((R=(T=m==null?void 0:m.item)===null||T===void 0?void 0:T.classNames)===null||R===void 0?void 0:R[b],s==null?void 0:s[b])},w=b=>{var T,R;return Object.assign(Object.assign({},(R=(T=m==null?void 0:m.item)===null||T===void 0?void 0:T.styles)===null||R===void 0?void 0:R[b]),a==null?void 0:a[b])},x=()=>{let b=!1;return g.Children.forEach(o,T=>{typeof T=="string"&&(b=!0)}),b&&g.Children.count(o)>1},C=()=>f==="vertical"?!!i:!x(),P=p("list",n),A=r&&r.length>0&&xe.createElement("ul",{className:Mn(`${P}-item-action`,y("actions")),key:"actions",style:w("actions")},r.map((b,T)=>xe.createElement("li",{key:`${P}-item-action-${T}`},b,T!==r.length-1&&xe.createElement("em",{className:`${P}-item-action-split`})))),S=d?"div":"li",v=xe.createElement(S,Object.assign({},u,d?{}:{ref:e},{className:Mn(`${P}-item`,{[`${P}-item-no-flex`]:!C()},l)}),f==="vertical"&&i?[xe.createElement("div",{className:`${P}-item-main`,key:"content"},o,A),xe.createElement("div",{className:Mn(`${P}-item-extra`,y("extra")),key:"extra",style:w("extra")},i)]:[o,A,P0(i,{key:"extra"})]);return d?xe.createElement(Ge,{ref:e,flex:1,style:c},v):v}),stt=NQt;stt.Meta=WQt;const UQt=t=>{const{listBorderedCls:e,componentCls:n,paddingLG:o,margin:r,itemPaddingSM:i,itemPaddingLG:a,marginLG:l,borderRadiusLG:s}=t;return{[e]:{border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:s,[`${n}-header,${n}-footer,${n}-item`]:{paddingInline:o},[`${n}-pagination`]:{margin:`${jt(r)} ${jt(l)}`}},[`${e}${n}-sm`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:i}},[`${e}${n}-lg`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:a}}}},jQt=t=>{const{componentCls:e,screenSM:n,screenMD:o,marginLG:r,marginSM:i,margin:a}=t;return{[`@media screen and (max-width:${o}px)`]:{[e]:{[`${e}-item`]:{[`${e}-item-action`]:{marginInlineStart:r}}},[`${e}-vertical`]:{[`${e}-item`]:{[`${e}-item-extra`]:{marginInlineStart:r}}}},[`@media screen and (max-width: ${n}px)`]:{[e]:{[`${e}-item`]:{flexWrap:"wrap",[`${e}-action`]:{marginInlineStart:i}}},[`${e}-vertical`]:{[`${e}-item`]:{flexWrap:"wrap-reverse",[`${e}-item-main`]:{minWidth:t.contentWidth},[`${e}-item-extra`]:{margin:`auto auto ${jt(a)}`}}}}}},BQt=t=>{const{componentCls:e,antCls:n,controlHeight:o,minHeight:r,paddingSM:i,marginLG:a,padding:l,itemPadding:s,colorPrimary:c,itemPaddingSM:u,itemPaddingLG:d,paddingXS:f,margin:p,colorText:m,colorTextDescription:y,motionDurationSlow:w,lineWidth:x,headerBg:C,footerBg:P,emptyTextPadding:A,metaMarginBottom:S,avatarMarginRight:v,titleMarginBottom:b,descriptionFontSize:T}=t;return{[e]:Object.assign(Object.assign({},Ua(t)),{position:"relative","*":{outline:"none"},[`${e}-header`]:{background:C},[`${e}-footer`]:{background:P},[`${e}-header, ${e}-footer`]:{paddingBlock:i},[`${e}-pagination`]:{marginBlockStart:a,[`${n}-pagination-options`]:{textAlign:"start"}},[`${e}-spin`]:{minHeight:r,textAlign:"center"},[`${e}-items`]:{margin:0,padding:0,listStyle:"none"},[`${e}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:s,color:m,[`${e}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${e}-item-meta-avatar`]:{marginInlineEnd:v},[`${e}-item-meta-content`]:{flex:"1 0",width:0,color:m},[`${e}-item-meta-title`]:{margin:`0 0 ${jt(t.marginXXS)} 0`,color:m,fontSize:t.fontSize,lineHeight:t.lineHeight,"> a":{color:m,transition:`all ${w}`,"&:hover":{color:c}}},[`${e}-item-meta-description`]:{color:y,fontSize:T,lineHeight:t.lineHeight}},[`${e}-item-action`]:{flex:"0 0 auto",marginInlineStart:t.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${jt(f)}`,color:y,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${e}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:x,height:t.calc(t.fontHeight).sub(t.calc(t.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:t.colorSplit}}},[`${e}-empty`]:{padding:`${jt(l)} 0`,color:y,fontSize:t.fontSizeSM,textAlign:"center"},[`${e}-empty-text`]:{padding:A,color:t.colorTextDisabled,fontSize:t.fontSize,textAlign:"center"},[`${e}-item-no-flex`]:{display:"block"}}),[`${e}-grid ${n}-col > ${e}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},[`${e}-vertical ${e}-item`]:{alignItems:"initial",[`${e}-item-main`]:{display:"block",flex:1},[`${e}-item-extra`]:{marginInlineStart:a},[`${e}-item-meta`]:{marginBlockEnd:S,[`${e}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:b,color:m,fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}},[`${e}-item-action`]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:`0 ${jt(l)}`,"&:first-child":{paddingInlineStart:0}}}},[`${e}-split ${e}-item`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${e}-split ${e}-header`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-split${e}-empty ${e}-footer`]:{borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-loading ${e}-spin-nested-loading`]:{minHeight:o},[`${e}-split${e}-something-after-last-item ${n}-spin-container > ${e}-items > ${e}-item:last-child`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-lg ${e}-item`]:{padding:d},[`${e}-sm ${e}-item`]:{padding:u},[`${e}:not(${e}-vertical)`]:{[`${e}-item-no-flex`]:{[`${e}-item-action`]:{float:"right"}}}}},YQt=t=>({contentWidth:220,itemPadding:`${jt(t.paddingContentVertical)} 0`,itemPaddingSM:`${jt(t.paddingContentVerticalSM)} ${jt(t.paddingContentHorizontal)}`,itemPaddingLG:`${jt(t.paddingContentVerticalLG)} ${jt(t.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:t.padding,metaMarginBottom:t.padding,avatarMarginRight:t.padding,titleMarginBottom:t.paddingSM,descriptionFontSize:t.fontSize}),OQt=el("List",t=>{const e=Ui(t,{listBorderedCls:`${t.componentCls}-bordered`,minHeight:t.controlHeightLG});return[BQt(e),UQt(e),jQt(e)]},YQt);var _Qt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r(ze,Ae)=>{var se;T(ze),M(Ae),n&&((se=n==null?void 0:n[ve])===null||se===void 0||se.call(n,ze,Ae))},E=F("onChange"),L=F("onShowSizeChange"),j=(ve,ze)=>{if(!P)return null;let Ae;return typeof C=="function"?Ae=C(ve):C?Ae=ve[C]:Ae=ve.key,Ae||(Ae=`list-item-${ze}`),g.createElement(g.Fragment,{key:Ae},P(ve,ze))},Y=()=>!!(d||n||w),O=D("list",o),[_,G,Q]=OQt(O);let oe=x;typeof oe=="boolean"&&(oe={spinning:oe});const ee=!!(oe!=null&&oe.spinning),$=jd(m);let ae="";switch($){case"large":ae="lg";break;case"small":ae="sm";break}const Z=Mn(O,{[`${O}-vertical`]:u==="vertical",[`${O}-${ae}`]:ae,[`${O}-split`]:i,[`${O}-bordered`]:r,[`${O}-loading`]:ee,[`${O}-grid`]:!!f,[`${O}-something-after-last-item`]:Y(),[`${O}-rtl`]:N==="rtl"},U==null?void 0:U.className,a,l,G,Q),ne=a3e(W,{total:p.length,current:b,pageSize:R},n||{}),te=Math.ceil(ne.total/ne.pageSize);ne.current>te&&(ne.current=te);const q=n&&g.createElement("div",{className:Mn(`${O}-pagination`)},g.createElement(ott,Object.assign({align:"end"},ne,{onChange:E,onShowSizeChange:L})));let le=Pa(p);n&&p.length>(ne.current-1)*ne.pageSize&&(le=Pa(p).splice((ne.current-1)*ne.pageSize,ne.pageSize));const de=Object.keys(f||{}).some(ve=>["xs","sm","md","lg","xl","xxl"].includes(ve)),he=MZ(de),me=g.useMemo(()=>{for(let ve=0;ve{if(!f)return;const ve=me&&f[me]?f[me]:f.column;if(ve)return{width:`${100/ve}%`,maxWidth:`${100/ve}%`}},[JSON.stringify(f),me]);let Pe=ee&&g.createElement("div",{style:{minHeight:53}});if(le.length>0){const ve=le.map((ze,Ae)=>j(ze,Ae));Pe=f?g.createElement(Qt,{gutter:f.gutter},g.Children.map(ve,ze=>g.createElement("div",{key:ze==null?void 0:ze.key,style:ce},ze))):g.createElement("ul",{className:`${O}-items`},ve)}else!c&&!ee&&(Pe=g.createElement("div",{className:`${O}-empty-text`},(A==null?void 0:A.emptyText)||(k==null?void 0:k("List"))||g.createElement(y9e,{componentName:"List"})));const pe=ne.position||"bottom",Ie=g.useMemo(()=>({grid:f,itemLayout:u}),[JSON.stringify(f),u]);return _(g.createElement(l3e.Provider,{value:Ie},g.createElement("div",Object.assign({ref:e,style:Object.assign(Object.assign({},U==null?void 0:U.style),s),className:Z},S),(pe==="top"||pe==="both")&&q,y&&g.createElement("div",{className:`${O}-header`},y),g.createElement(Pee,Object.assign({},oe),Pe,c),w&&g.createElement("div",{className:`${O}-footer`},w),d||(pe==="bottom"||pe==="both")&&q)))}const GQt=g.forwardRef(VQt),WL=GQt;WL.Item=stt;function XQt(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)&&t==null?[]:Array.isArray(t)?t:[t]}let cy=null,Ov=t=>t(),NL=[],UL={};function CCe(){const{getContainer:t,duration:e,rtl:n,maxCount:o,top:r}=UL,i=(t==null?void 0:t())||document.body;return{getContainer:()=>i,duration:e,rtl:n,maxCount:o,top:r}}const JQt=xe.forwardRef((t,e)=>{const{messageConfig:n,sync:o}=t,{getPrefixCls:r}=g.useContext(gr),i=UL.prefixCls||r("message"),a=g.useContext(DUt),[l,s]=K$e(Object.assign(Object.assign(Object.assign({},n),{prefixCls:i}),a.message));return xe.useImperativeHandle(e,()=>{const c=Object.assign({},l);return Object.keys(c).forEach(u=>{c[u]=function(){return o(),l[u].apply(l,arguments)}}),{instance:c,sync:o}}),s}),KQt=xe.forwardRef((t,e)=>{const[n,o]=xe.useState(CCe),r=()=>{o(CCe)};xe.useEffect(r,[]);const i=y$e(),a=i.getRootPrefixCls(),l=i.getIconPrefixCls(),s=i.getTheme(),c=xe.createElement(JQt,{ref:e,sync:r,messageConfig:n});return xe.createElement(n2,{prefixCls:a,iconPrefixCls:l,theme:s},i.holderRender?i.holderRender(c):c)});function Cee(){if(!cy){const t=document.createDocumentFragment(),e={fragment:t};cy=e,Ov(()=>{e9e()(xe.createElement(KQt,{ref:o=>{const{instance:r,sync:i}=o||{};Promise.resolve().then(()=>{!e.instance&&r&&(e.instance=r,e.sync=i,Cee())})}}),t)});return}cy.instance&&(NL.forEach(t=>{const{type:e,skipped:n}=t;if(!n)switch(e){case"open":{Ov(()=>{const o=cy.instance.open(Object.assign(Object.assign({},UL),t.config));o==null||o.then(t.resolve),t.setCloseFn(o)});break}case"destroy":Ov(()=>{cy==null||cy.instance.destroy(t.key)});break;default:Ov(()=>{var o;const r=(o=cy.instance)[e].apply(o,Pa(t.args));r==null||r.then(t.resolve),t.setCloseFn(r)})}}),NL=[])}function $Qt(t){UL=Object.assign(Object.assign({},UL),t),Ov(()=>{var e;(e=cy==null?void 0:cy.sync)===null||e===void 0||e.call(cy)})}function qQt(t){const e=Z5e(n=>{let o;const r={type:"open",config:t,resolve:n,setCloseFn:i=>{o=i}};return NL.push(r),()=>{o?Ov(()=>{o()}):r.skipped=!0}});return Cee(),e}function QQt(t,e){const n=Z5e(o=>{let r;const i={type:t,args:e,resolve:o,setCloseFn:a=>{r=a}};return NL.push(i),()=>{r?Ov(()=>{r()}):i.skipped=!0}});return Cee(),n}const ZQt=t=>{NL.push({type:"destroy",key:t}),Cee()},eZt=["success","info","warning","error","loading"],tZt={open:qQt,destroy:ZQt,config:$Qt,useMessage:tFt,_InternalPanelDoNotUseOrYouWillBeFired:Xkt},Dp=tZt;eZt.forEach(t=>{Dp[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o{const{prefixCls:e,className:n,closeIcon:o,closable:r,type:i,title:a,children:l,footer:s}=t,c=nZt(t,["prefixCls","className","closeIcon","closable","type","title","children","footer"]),{getPrefixCls:u}=g.useContext(gr),d=u(),f=e||u("modal"),p=nu(d),[m,y,w]=Eqe(f,p),x=`${f}-confirm`;let C={};return i?C={closable:r??!1,title:"",footer:"",children:g.createElement(Fqe,Object.assign({},t,{prefixCls:f,confirmPrefixCls:x,rootPrefixCls:d,content:l}))}:C={closable:r??!0,title:a,footer:s!==null&&g.createElement(Hqe,Object.assign({},t)),children:l},m(g.createElement(gqe,Object.assign({prefixCls:f,className:Mn(y,`${f}-pure-panel`,i&&x,i&&`${x}-${i}`,n,w,p)},c,{closeIcon:Rqe(f,o),closable:r},C)))},rZt=_qe(oZt);function ctt(t){return pU(Uqe(t))}const li=kqe;li.useModal=zUt;li.info=function(e){return pU(jqe(e))};li.success=function(e){return pU(Bqe(e))};li.error=function(e){return pU(Yqe(e))};li.warning=ctt;li.warn=ctt;li.confirm=function(e){return pU(Oqe(e))};li.destroyAll=function(){for(;jv.length;){const e=jv.pop();e&&e()}};li.config=CUt;li._InternalPanelDoNotUseOrYouWillBeFired=rZt;var iZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 244c176.18 0 319 142.82 319 319v233a32 32 0 01-32 32H225a32 32 0 01-32-32V563c0-176.18 142.82-319 319-319zM484 68h56a8 8 0 018 8v96a8 8 0 01-8 8h-56a8 8 0 01-8-8V76a8 8 0 018-8zM177.25 191.66a8 8 0 0111.32 0l67.88 67.88a8 8 0 010 11.31l-39.6 39.6a8 8 0 01-11.31 0l-67.88-67.88a8 8 0 010-11.31l39.6-39.6zm669.6 0l39.6 39.6a8 8 0 010 11.3l-67.88 67.9a8 8 0 01-11.32 0l-39.6-39.6a8 8 0 010-11.32l67.89-67.88a8 8 0 0111.31 0zM192 892h640a32 32 0 0132 32v24a8 8 0 01-8 8H168a8 8 0 01-8-8v-24a32 32 0 0132-32zm148-317v253h64V575h-64z"}}]},name:"alert",theme:"filled"},aZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:iZt}))},lZt=g.forwardRef(aZt),sZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"},cZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:sZt}))},uZt=g.forwardRef(cZt),dZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"},fZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:dZt}))},hZt=g.forwardRef(fZt),pZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"}}]},name:"bg-colors",theme:"outlined"},gZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:pZt}))},mZt=g.forwardRef(gZt),yZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 248H728l-32.4-90.8a32.07 32.07 0 00-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z"}}]},name:"camera",theme:"outlined"},AZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:yZt}))},nd=g.forwardRef(AZt),wZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"filled"},xZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:wZt}))},vZt=g.forwardRef(xZt),bZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"},SZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:bZt}))},utt=g.forwardRef(SZt),TZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"},PZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:TZt}))},Bh=g.forwardRef(PZt),CZt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"}}]},name:"caret-up",theme:"outlined"},RZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:CZt}))},HZt=g.forwardRef(RZt),MZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584zM688 420h-55.2c-5.1 0-10 2.5-13 6.6L468.9 634.4l-64.7-89c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0026 0l212.6-292.7c3.8-5.4 0-12.8-6.5-12.8z"}}]},name:"carry-out",theme:"outlined"},IZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:MZt}))},zZt=g.forwardRef(IZt),DZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},EZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:DZt}))},kZt=g.forwardRef(EZt),FZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.3 459a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-upload",theme:"outlined"},LZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:FZt}))},WZt=g.forwardRef(LZt),NZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"}}]},name:"copy",theme:"outlined"},UZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:NZt}))},dtt=g.forwardRef(UZt),jZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},BZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:jZt}))},ftt=g.forwardRef(BZt),YZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM288 604a64 64 0 10128 0 64 64 0 10-128 0zm118-224a48 48 0 1096 0 48 48 0 10-96 0zm158 228a96 96 0 10192 0 96 96 0 10-192 0zm148-314a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"dot-chart",theme:"outlined"},OZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:YZt}))},_Zt=g.forwardRef(OZt),VZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M690 405h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 563.6 406.8 418.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"down-circle",theme:"outlined"},GZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:VZt}))},XZt=g.forwardRef(GZt),JZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32zm-622.3-84c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9z"}}]},name:"edit",theme:"filled"},KZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:JZt}))},$Zt=g.forwardRef(KZt),qZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"},QZt=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:qZt}))},htt=g.forwardRef(QZt),ZZt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"},een=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ZZt}))},ten=g.forwardRef(een),nen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},oen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:nen}))},_y=g.forwardRef(oen),ren={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},ien=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ren}))},aen=g.forwardRef(ien),len={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"},sen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:len}))},ptt=g.forwardRef(sen),cen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"},uen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:cen}))},den=g.forwardRef(uen),fen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},hen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:fen}))},gtt=g.forwardRef(hen),pen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},gen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:pen}))},men=g.forwardRef(gen),yen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},Aen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:yen}))},wen=g.forwardRef(Aen),xen={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},ven=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:xen}))},ben=g.forwardRef(ven),Sen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M603.3 327.5l-246 178a7.95 7.95 0 000 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"left-circle",theme:"outlined"},Ten=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Sen}))},Pen=g.forwardRef(Ten),Cen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"},Ren=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Cen}))},Hen=g.forwardRef(Ren),Men={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"minus-square",theme:"outlined"},Ien=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Men}))},zen=g.forwardRef(Ien),Den={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"more",theme:"outlined"},Een=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Den}))},ken=g.forwardRef(Een),Fen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"},Len=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Fen}))},Wen=g.forwardRef(Len),Nen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3-15.4 12.3-16.6 35.4-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8z"}}]},name:"pushpin",theme:"filled"},Uen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Nen}))},jen=g.forwardRef(Uen),Ben={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z"}}]},name:"pushpin",theme:"outlined"},Yen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Ben}))},RCe=g.forwardRef(Yen),Oen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},_en=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Oen}))},Lf=g.forwardRef(_en),Ven={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"right-circle",theme:"outlined"},Gen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Ven}))},mtt=g.forwardRef(Gen),Xen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},Jen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Xen}))},Wf=g.forwardRef(Jen),Ken={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},$en=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Ken}))},qen=g.forwardRef($en),Qen={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z"}}]},name:"sort-ascending",theme:"outlined"},Zen=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:Qen}))},etn=g.forwardRef(Zen),ttn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM310.3 167.1a8 8 0 00-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z"}}]},name:"sort-descending",theme:"outlined"},ntn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ttn}))},otn=g.forwardRef(ntn),rtn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"unordered-list",theme:"outlined"},itn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:rtn}))},R0=g.forwardRef(itn),atn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.5 360.3a7.95 7.95 0 00-12.9 0l-178 246c-3.8 5.3 0 12.7 6.5 12.7H381c10.2 0 19.9-4.9 25.9-13.2L512 460.4l105.2 145.4c6 8.3 15.6 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.5-12.7l-178-246z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"up-circle",theme:"outlined"},ltn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:atn}))},stn=g.forwardRef(ltn),ctn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},utn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ctn}))},dtn=g.forwardRef(utn),ftn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M859.9 780H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM505.7 669a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V176c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8z"}}]},name:"vertical-align-bottom",theme:"outlined"},htn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:ftn}))},ptn=g.forwardRef(htn),gtn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},mtn=function(e,n){return g.createElement(Tr,Sr({},e,{ref:n,icon:gtn}))},a7=g.forwardRef(mtn),ytn=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],ytt=g.forwardRef(function(t,e){var n,o=t.prefixCls,r=o===void 0?"rc-switch":o,i=t.className,a=t.checked,l=t.defaultChecked,s=t.disabled,c=t.loadingIcon,u=t.checkedChildren,d=t.unCheckedChildren,f=t.onClick,p=t.onChange,m=t.onKeyDown,y=Ai(t,ytn),w=o0(!1,{value:a,defaultValue:l}),x=Sn(w,2),C=x[0],P=x[1];function A(T,R){var M=C;return s||(M=T,P(M),p==null||p(M,R)),M}function S(T){T.which===Lo.LEFT?A(!1,T):T.which===Lo.RIGHT&&A(!0,T),m==null||m(T)}function v(T){var R=A(!C,T);f==null||f(R,T)}var b=Bn(r,i,(n={},Ut(n,"".concat(r,"-checked"),C),Ut(n,"".concat(r,"-disabled"),s),n));return g.createElement("button",Uo({},y,{type:"button",role:"switch","aria-checked":C,disabled:s,className:b,ref:e,onKeyDown:S,onClick:v}),c,g.createElement("span",{className:"".concat(r,"-inner")},g.createElement("span",{className:"".concat(r,"-inner-checked")},u),g.createElement("span",{className:"".concat(r,"-inner-unchecked")},d)))});ytt.displayName="Switch";const Atn=t=>{const{componentCls:e,trackHeightSM:n,trackPadding:o,trackMinWidthSM:r,innerMinMarginSM:i,innerMaxMarginSM:a,handleSizeSM:l,calc:s}=t,c=`${e}-inner`,u=jt(s(l).add(s(o).mul(2)).equal()),d=jt(s(a).mul(2).equal());return{[e]:{[`&${e}-small`]:{minWidth:r,height:n,lineHeight:jt(n),[`${e}-inner`]:{paddingInlineStart:a,paddingInlineEnd:i,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${u} - ${d})`,marginInlineEnd:`calc(100% - ${u} + ${d})`},[`${c}-unchecked`]:{marginTop:s(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${e}-handle`]:{width:l,height:l},[`${e}-loading-icon`]:{top:s(s(l).sub(t.switchLoadingIconSize)).div(2).equal(),fontSize:t.switchLoadingIconSize},[`&${e}-checked`]:{[`${e}-inner`]:{paddingInlineStart:i,paddingInlineEnd:a,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${u} + ${d})`,marginInlineEnd:`calc(-100% + ${u} - ${d})`}},[`${e}-handle`]:{insetInlineStart:`calc(100% - ${jt(s(l).add(o).equal())})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:s(t.marginXXS).div(2).equal(),marginInlineEnd:s(t.marginXXS).mul(-1).div(2).equal()}},[`&${e}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:s(t.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:s(t.marginXXS).div(2).equal()}}}}}}},wtn=t=>{const{componentCls:e,handleSize:n,calc:o}=t;return{[e]:{[`${e}-loading-icon${t.iconCls}`]:{position:"relative",top:o(o(n).sub(t.fontSize)).div(2).equal(),color:t.switchLoadingIconColor,verticalAlign:"top"},[`&${e}-checked ${e}-loading-icon`]:{color:t.switchColor}}}},xtn=t=>{const{componentCls:e,trackPadding:n,handleBg:o,handleShadow:r,handleSize:i,calc:a}=t,l=`${e}-handle`;return{[e]:{[l]:{position:"absolute",top:n,insetInlineStart:n,width:i,height:i,transition:`all ${t.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:o,borderRadius:a(i).div(2).equal(),boxShadow:r,transition:`all ${t.switchDuration} ease-in-out`,content:'""'}},[`&${e}-checked ${l}`]:{insetInlineStart:`calc(100% - ${jt(a(i).add(n).equal())})`},[`&:not(${e}-disabled):active`]:{[`${l}::before`]:{insetInlineEnd:t.switchHandleActiveInset,insetInlineStart:0},[`&${e}-checked ${l}::before`]:{insetInlineEnd:0,insetInlineStart:t.switchHandleActiveInset}}}}},vtn=t=>{const{componentCls:e,trackHeight:n,trackPadding:o,innerMinMargin:r,innerMaxMargin:i,handleSize:a,calc:l}=t,s=`${e}-inner`,c=jt(l(a).add(l(o).mul(2)).equal()),u=jt(l(i).mul(2).equal());return{[e]:{[s]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:i,paddingInlineEnd:r,transition:`padding-inline-start ${t.switchDuration} ease-in-out, padding-inline-end ${t.switchDuration} ease-in-out`,[`${s}-checked, ${s}-unchecked`]:{display:"block",color:t.colorTextLightSolid,fontSize:t.fontSizeSM,transition:`margin-inline-start ${t.switchDuration} ease-in-out, margin-inline-end ${t.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:n},[`${s}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${u})`,marginInlineEnd:`calc(100% - ${c} + ${u})`},[`${s}-unchecked`]:{marginTop:l(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${e}-checked ${s}`]:{paddingInlineStart:r,paddingInlineEnd:i,[`${s}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${s}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${u})`,marginInlineEnd:`calc(-100% + ${c} - ${u})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${s}`]:{[`${s}-unchecked`]:{marginInlineStart:l(o).mul(2).equal(),marginInlineEnd:l(o).mul(-1).mul(2).equal()}},[`&${e}-checked ${s}`]:{[`${s}-checked`]:{marginInlineStart:l(o).mul(-1).mul(2).equal(),marginInlineEnd:l(o).mul(2).equal()}}}}}},btn=t=>{const{componentCls:e,trackHeight:n,trackMinWidth:o}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Ua(t)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:o,height:n,lineHeight:jt(n),verticalAlign:"middle",background:t.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${t.motionDurationMid}`,userSelect:"none",[`&:hover:not(${e}-disabled)`]:{background:t.colorTextTertiary}}),Yy(t)),{[`&${e}-checked`]:{background:t.switchColor,[`&:hover:not(${e}-disabled)`]:{background:t.colorPrimaryHover}},[`&${e}-loading, &${e}-disabled`]:{cursor:"not-allowed",opacity:t.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${e}-rtl`]:{direction:"rtl"}})}},Stn=t=>{const{fontSize:e,lineHeight:n,controlHeight:o,colorWhite:r}=t,i=e*n,a=o/2,l=2,s=i-l*2,c=a-l*2;return{trackHeight:i,trackHeightSM:a,trackMinWidth:s*2+l*4,trackMinWidthSM:c*2+l*2,trackPadding:l,handleBg:r,handleSize:s,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new Di("#00230b").setA(.2).toRgbString()}`,innerMinMargin:s/2,innerMaxMargin:s+l+l*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+l+l*2}},Ttn=el("Switch",t=>{const e=Ui(t,{switchDuration:t.motionDurationMid,switchColor:t.colorPrimary,switchDisabledOpacity:t.opacityLoading,switchLoadingIconSize:t.calc(t.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${t.opacityLoading})`,switchHandleActiveInset:"-30%"});return[btn(e),vtn(e),xtn(e),wtn(e),Atn(e)]},Stn);var Ptn=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,size:o,disabled:r,loading:i,className:a,rootClassName:l,style:s,checked:c,value:u,defaultChecked:d,defaultValue:f,onChange:p}=t,m=Ptn(t,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[y,w]=qA(!1,{value:c??u,defaultValue:d??f}),{getPrefixCls:x,direction:C,switch:P}=g.useContext(gr),A=g.useContext(Bp),S=(r??A)||i,v=x("switch",n),b=g.createElement("div",{className:`${v}-handle`},i&&g.createElement(qM,{className:`${v}-loading-icon`})),[T,R,M]=Ttn(v),D=jd(o),k=Mn(P==null?void 0:P.className,{[`${v}-small`]:D==="small",[`${v}-loading`]:i,[`${v}-rtl`]:C==="rtl"},a,l,R,M),N=Object.assign(Object.assign({},P==null?void 0:P.style),s),U=function(){w(arguments.length<=0?void 0:arguments[0]),p==null||p.apply(void 0,arguments)};return T(g.createElement(lU,{component:"Switch"},g.createElement(ytt,Object.assign({},m,{checked:y,onChange:U,prefixCls:v,className:k,style:N,disabled:S,ref:e,loadingIcon:b}))))}),zc=Ctn;zc.__ANT_SWITCH=!0;var aA={},TU="rc-table-internal-hook";function s3e(t){var e=g.createContext(void 0),n=function(r){var i=r.value,a=r.children,l=g.useRef(i);l.current=i;var s=g.useState(function(){return{getValue:function(){return l.current},listeners:new Set}}),c=Sn(s,1),u=c[0];return Ml(function(){r0.unstable_batchedUpdates(function(){u.listeners.forEach(function(d){d(i)})})},[i]),g.createElement(e.Provider,{value:u},a)};return{Context:e,Provider:n,defaultValue:t}}function If(t,e){var n=Dd(typeof e=="function"?e:function(d){if(e===void 0)return d;if(!Array.isArray(e))return d[e];var f={};return e.forEach(function(p){f[p]=d[p]}),f}),o=g.useContext(t==null?void 0:t.Context),r=o||{},i=r.listeners,a=r.getValue,l=g.useRef();l.current=n(o?a():t==null?void 0:t.defaultValue);var s=g.useState({}),c=Sn(s,2),u=c[1];return Ml(function(){if(!o)return;function d(f){var p=n(f);Vb(l.current,p,!0)||u({})}return i.add(d),function(){i.delete(d)}},[o]),l.current}function Rtn(){var t=g.createContext(null);function e(){return g.useContext(t)}function n(r,i){var a=Z8(r),l=function(c,u){var d=a?{ref:u}:{},f=g.useRef(0),p=g.useRef(c),m=e();return m!==null?g.createElement(r,Uo({},c,d)):((!i||i(p.current,c))&&(f.current+=1),p.current=c,g.createElement(t.Provider,{value:f.current},g.createElement(r,Uo({},c,d))))};return a?g.forwardRef(l):l}function o(r,i){var a=Z8(r),l=function(c,u){var d=a?{ref:u}:{};return e(),g.createElement(r,Uo({},c,d))};return a?g.memo(g.forwardRef(l),i):g.memo(l,i)}return{makeImmutable:n,responseImmutable:o,useImmutableMark:e}}var c3e=Rtn(),Att=c3e.makeImmutable,lI=c3e.responseImmutable,Htn=c3e.useImmutableMark,Kp=s3e();function wtt(t,e,n){var o=g.useRef({});return(!("value"in o.current)||n(o.current.condition,e))&&(o.current.value=t(),o.current.condition=e),o.current.value}var _he={},Mtn=function(e){};function Itn(t,e){}function ztn(t,e){}function Dtn(){_he={}}function xtt(t,e,n){!e&&!_he[n]&&(t(!1,n),_he[n]=!0)}function Ree(t,e){xtt(Itn,t,e)}function Etn(t,e){xtt(ztn,t,e)}Ree.preMessage=Mtn;Ree.resetWarned=Dtn;Ree.noteOnce=Etn;function vtt(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=new Set;function r(i,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=o.has(i);if(Ree(!s,"Warning: There may be circular references"),s)return!1;if(i===a)return!0;if(n&&l>1)return!1;o.add(i);var c=l+1;if(Array.isArray(i)){if(!Array.isArray(a)||i.length!==a.length)return!1;for(var u=0;u=n}function jtn(t,e){return If(Kp,function(n){var o=Utn(t,e||1,n.hoverStartRow,n.hoverEndRow);return[o,n.onHover]})}function qb(t){var e=g.useRef();e.current=t;var n=g.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a0&&arguments[0]!==void 0?arguments[0]:{},e=t.mark;return e?e.startsWith("data-")?e:"data-".concat(e):inn}function jee(t){if(t.attachTo)return t.attachTo;var e=document.querySelector("head");return e||document.body}function ann(t){return t==="queue"?"prependQueue":t?"prepend":"append"}function g3e(t){return Array.from((Ghe.get(t)||t).children).filter(function(e){return e.tagName==="STYLE"})}function Htt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!d3e())return null;var n=e.csp,o=e.prepend,r=e.priority,i=r===void 0?0:r,a=ann(o),l=a==="prependQueue",s=document.createElement("style");s.setAttribute(MCe,a),l&&i&&s.setAttribute(ICe,"".concat(i)),n!=null&&n.nonce&&(s.nonce=n==null?void 0:n.nonce),s.innerHTML=t;var c=jee(e),u=c.firstChild;if(o){if(l){var d=(e.styles||g3e(c)).filter(function(f){if(!["prepend","prependQueue"].includes(f.getAttribute(MCe)))return!1;var p=Number(f.getAttribute(ICe)||0);return i>=p});if(d.length)return c.insertBefore(s,d[d.length-1].nextSibling),s}c.insertBefore(s,u)}else c.appendChild(s);return s}function Mtt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=jee(e);return(e.styles||g3e(n)).find(function(o){return o.getAttribute(Rtt(e))===t})}function lnn(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Mtt(t,e);if(n){var o=jee(e);o.removeChild(n)}}function snn(t,e){var n=Ghe.get(t);if(!n||!rnn(document,n)){var o=Htt("",e),r=o.parentNode;Ghe.set(t,r),t.removeChild(o)}}function cnn(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=jee(n),r=g3e(o),i=nn(nn({},n),{},{styles:r});snn(o,i);var a=Mtt(e,i);if(a){var l,s;if((l=i.csp)!==null&&l!==void 0&&l.nonce&&a.nonce!==((s=i.csp)===null||s===void 0?void 0:s.nonce)){var c;a.nonce=(c=i.csp)===null||c===void 0?void 0:c.nonce}return a.innerHTML!==t&&(a.innerHTML=t),a}var u=Htt(t,i);return u.setAttribute(Rtt(i),e),u}var lse;function Itt(t){var e="rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7)),n=document.createElement("div");n.id=e;var o=n.style;o.position="absolute",o.left="0",o.top="0",o.width="100px",o.height="100px",o.overflow="scroll";var r,i;if(t){var a=getComputedStyle(t);o.scrollbarColor=a.scrollbarColor,o.scrollbarWidth=a.scrollbarWidth;var l=getComputedStyle(t,"::-webkit-scrollbar"),s=parseInt(l.width,10),c=parseInt(l.height,10);try{var u=s?"width: ".concat(l.width,";"):"",d=c?"height: ".concat(l.height,";"):"";cnn(` + */var f3e=Symbol.for("react.element"),h3e=Symbol.for("react.portal"),Mee=Symbol.for("react.fragment"),Iee=Symbol.for("react.strict_mode"),zee=Symbol.for("react.profiler"),Dee=Symbol.for("react.provider"),Eee=Symbol.for("react.context"),Btn=Symbol.for("react.server_context"),kee=Symbol.for("react.forward_ref"),Fee=Symbol.for("react.suspense"),Lee=Symbol.for("react.suspense_list"),Wee=Symbol.for("react.memo"),Nee=Symbol.for("react.lazy"),Ytn=Symbol.for("react.offscreen"),Stt;Stt=Symbol.for("react.module.reference");function a2(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case f3e:switch(t=t.type,t){case Mee:case zee:case Iee:case Fee:case Lee:return t;default:switch(t=t&&t.$$typeof,t){case Btn:case Eee:case kee:case Nee:case Wee:case Dee:return t;default:return e}}case h3e:return e}}}Fs.ContextConsumer=Eee;Fs.ContextProvider=Dee;Fs.Element=f3e;Fs.ForwardRef=kee;Fs.Fragment=Mee;Fs.Lazy=Nee;Fs.Memo=Wee;Fs.Portal=h3e;Fs.Profiler=zee;Fs.StrictMode=Iee;Fs.Suspense=Fee;Fs.SuspenseList=Lee;Fs.isAsyncMode=function(){return!1};Fs.isConcurrentMode=function(){return!1};Fs.isContextConsumer=function(t){return a2(t)===Eee};Fs.isContextProvider=function(t){return a2(t)===Dee};Fs.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===f3e};Fs.isForwardRef=function(t){return a2(t)===kee};Fs.isFragment=function(t){return a2(t)===Mee};Fs.isLazy=function(t){return a2(t)===Nee};Fs.isMemo=function(t){return a2(t)===Wee};Fs.isPortal=function(t){return a2(t)===h3e};Fs.isProfiler=function(t){return a2(t)===zee};Fs.isStrictMode=function(t){return a2(t)===Iee};Fs.isSuspense=function(t){return a2(t)===Fee};Fs.isSuspenseList=function(t){return a2(t)===Lee};Fs.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===Mee||t===zee||t===Iee||t===Fee||t===Lee||t===Ytn||typeof t=="object"&&t!==null&&(t.$$typeof===Nee||t.$$typeof===Wee||t.$$typeof===Dee||t.$$typeof===Eee||t.$$typeof===kee||t.$$typeof===Stt||t.getModuleId!==void 0)};Fs.typeOf=a2;var Otn=Symbol.for("react.element"),_tn=Symbol.for("react.transitional.element"),Vtn=Symbol.for("react.fragment");function Gtn(t){return t&&Vr(t)==="object"&&(t.$$typeof===Otn||t.$$typeof===_tn)&&t.type===Vtn}var HCe=function(e,n){typeof e=="function"?e(n):Vr(e)==="object"&&e&&"current"in e&&(e.current=n)},Xtn=function(e){var n=e.ellipsis,o=e.rowType,r=e.children,i,a=n===!0?{showTitle:!0}:n;return a&&(a.showTitle||o==="header")&&(typeof r=="string"||typeof r=="number"?i=r.toString():g.isValidElement(r)&&typeof r.props.children=="string"&&(i=r.props.children)),i};function Jtn(t){var e,n,o,r,i,a,l,s,c=t.component,u=t.children,d=t.ellipsis,f=t.scope,p=t.prefixCls,m=t.className,y=t.align,w=t.record,x=t.render,C=t.dataIndex,P=t.renderIndex,A=t.shouldCellUpdate,S=t.index,v=t.rowType,b=t.colSpan,T=t.rowSpan,R=t.fixLeft,M=t.fixRight,D=t.firstFixLeft,k=t.lastFixLeft,N=t.firstFixRight,U=t.lastFixRight,W=t.appendNode,F=t.additionalProps,E=F===void 0?{}:F,L=t.isSticky,j="".concat(p,"-cell"),Y=If(Kp,["supportSticky","allColumnsFixedLeft","rowHoverable"]),O=Y.supportSticky,_=Y.allColumnsFixedLeft,G=Y.rowHoverable,Q=Ntn(w,C,P,u,x,A),oe=Sn(Q,2),ee=oe[0],$=oe[1],ae={},Z=typeof R=="number"&&O,ne=typeof M=="number"&&O;Z&&(ae.position="sticky",ae.left=R),ne&&(ae.position="sticky",ae.right=M);var te=(e=(n=(o=$==null?void 0:$.colSpan)!==null&&o!==void 0?o:E.colSpan)!==null&&n!==void 0?n:b)!==null&&e!==void 0?e:1,q=(r=(i=(a=$==null?void 0:$.rowSpan)!==null&&a!==void 0?a:E.rowSpan)!==null&&i!==void 0?i:T)!==null&&r!==void 0?r:1,le=jtn(S,q),de=Sn(le,2),he=de[0],me=de[1],ce=qb(function(se){var ge;w&&me(S,S+q-1),E==null||(ge=E.onMouseEnter)===null||ge===void 0||ge.call(E,se)}),Pe=qb(function(se){var ge;w&&me(-1,-1),E==null||(ge=E.onMouseLeave)===null||ge===void 0||ge.call(E,se)});if(te===0||q===0)return null;var pe=(l=E.title)!==null&&l!==void 0?l:Xtn({rowType:v,ellipsis:d,children:ee}),Ie=Bn(j,m,(s={},Ut(Ut(Ut(Ut(Ut(Ut(Ut(Ut(Ut(Ut(s,"".concat(j,"-fix-left"),Z&&O),"".concat(j,"-fix-left-first"),D&&O),"".concat(j,"-fix-left-last"),k&&O),"".concat(j,"-fix-left-all"),k&&_&&O),"".concat(j,"-fix-right"),ne&&O),"".concat(j,"-fix-right-first"),N&&O),"".concat(j,"-fix-right-last"),U&&O),"".concat(j,"-ellipsis"),d),"".concat(j,"-with-append"),W),"".concat(j,"-fix-sticky"),(Z||ne)&&L&&O),Ut(s,"".concat(j,"-row-hover"),!$&&he)),E.className,$==null?void 0:$.className),ve={};y&&(ve.textAlign=y);var ze=nn(nn(nn(nn({},$==null?void 0:$.style),ae),ve),E.style),Ae=ee;return Vr(Ae)==="object"&&!Array.isArray(Ae)&&!g.isValidElement(Ae)&&(Ae=null),d&&(k||N)&&(Ae=g.createElement("span",{className:"".concat(j,"-content")},Ae)),g.createElement(c,Uo({},$,E,{className:Ie,style:ze,title:pe,scope:f,onMouseEnter:G?ce:void 0,onMouseLeave:G?Pe:void 0,colSpan:te!==1?te:null,rowSpan:q!==1?q:null}),W,Ae)}const sI=g.memo(Jtn);function p3e(t,e,n,o,r){var i=n[t]||{},a=n[e]||{},l,s;i.fixed==="left"?l=o.left[r==="rtl"?e:t]:a.fixed==="right"&&(s=o.right[r==="rtl"?t:e]);var c=!1,u=!1,d=!1,f=!1,p=n[e+1],m=n[t-1],y=p&&!p.fixed||m&&!m.fixed||n.every(function(A){return A.fixed==="left"});if(r==="rtl"){if(l!==void 0){var w=m&&m.fixed==="left";f=!w&&y}else if(s!==void 0){var x=p&&p.fixed==="right";d=!x&&y}}else if(l!==void 0){var C=p&&p.fixed==="left";c=!C&&y}else if(s!==void 0){var P=m&&m.fixed==="right";u=!P&&y}return{fixLeft:l,fixRight:s,lastFixLeft:c,firstFixRight:u,lastFixRight:d,firstFixLeft:f,isSticky:o.isSticky}}var Ttt=g.createContext({});function Ktn(t){var e=t.className,n=t.index,o=t.children,r=t.colSpan,i=r===void 0?1:r,a=t.rowSpan,l=t.align,s=If(Kp,["prefixCls","direction"]),c=s.prefixCls,u=s.direction,d=g.useContext(Ttt),f=d.scrollColumnIndex,p=d.stickyOffsets,m=d.flattenColumns,y=n+i-1,w=y+1===f?i+1:i,x=p3e(n,n+w-1,m,p,u);return g.createElement(sI,Uo({className:e,index:n,component:"td",prefixCls:c,record:null,dataIndex:null,align:l,colSpan:w,rowSpan:a,render:function(){return o}},x))}var $tn=["children"];function qtn(t){var e=t.children,n=Ai(t,$tn);return g.createElement("tr",n,e)}function Uee(t){var e=t.children;return e}Uee.Row=qtn;Uee.Cell=Ktn;function Qtn(t){var e=t.children,n=t.stickyOffsets,o=t.flattenColumns,r=If(Kp,"prefixCls"),i=o.length-1,a=o[i],l=g.useMemo(function(){return{stickyOffsets:n,flattenColumns:o,scrollColumnIndex:a!=null&&a.scrollbar?i:null}},[a,o,i,n]);return g.createElement(Ttt.Provider,{value:l},g.createElement("tfoot",{className:"".concat(r,"-summary")},e))}const e_=lI(Qtn);var Ptt=Uee;function Ztn(t){return null}function enn(t){return null}const tnn=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1};var Ctt=function(e){if(d3e()&&window.document.documentElement){var n=Array.isArray(e)?e:[e],o=window.document.documentElement;return n.some(function(r){return r in o.style})}return!1},nnn=function(e,n){if(!Ctt(e))return!1;var o=document.createElement("div"),r=o.style[e];return o.style[e]=n,o.style[e]!==r};function onn(t,e){return!Array.isArray(t)&&e!==void 0?nnn(t,e):Ctt(t)}function rnn(t,e){if(!t)return!1;if(t.contains)return t.contains(e);for(var n=e;n;){if(n===t)return!0;n=n.parentNode}return!1}var MCe="data-rc-order",ICe="data-rc-priority",inn="rc-util-key",Ghe=new Map;function Rtt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.mark;return e?e.startsWith("data-")?e:"data-".concat(e):inn}function jee(t){if(t.attachTo)return t.attachTo;var e=document.querySelector("head");return e||document.body}function ann(t){return t==="queue"?"prependQueue":t?"prepend":"append"}function g3e(t){return Array.from((Ghe.get(t)||t).children).filter(function(e){return e.tagName==="STYLE"})}function Htt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!d3e())return null;var n=e.csp,o=e.prepend,r=e.priority,i=r===void 0?0:r,a=ann(o),l=a==="prependQueue",s=document.createElement("style");s.setAttribute(MCe,a),l&&i&&s.setAttribute(ICe,"".concat(i)),n!=null&&n.nonce&&(s.nonce=n==null?void 0:n.nonce),s.innerHTML=t;var c=jee(e),u=c.firstChild;if(o){if(l){var d=(e.styles||g3e(c)).filter(function(f){if(!["prepend","prependQueue"].includes(f.getAttribute(MCe)))return!1;var p=Number(f.getAttribute(ICe)||0);return i>=p});if(d.length)return c.insertBefore(s,d[d.length-1].nextSibling),s}c.insertBefore(s,u)}else c.appendChild(s);return s}function Mtt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=jee(e);return(e.styles||g3e(n)).find(function(o){return o.getAttribute(Rtt(e))===t})}function lnn(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Mtt(t,e);if(n){var o=jee(e);o.removeChild(n)}}function snn(t,e){var n=Ghe.get(t);if(!n||!rnn(document,n)){var o=Htt("",e),r=o.parentNode;Ghe.set(t,r),t.removeChild(o)}}function cnn(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=jee(n),r=g3e(o),i=nn(nn({},n),{},{styles:r});snn(o,i);var a=Mtt(e,i);if(a){var l,s;if((l=i.csp)!==null&&l!==void 0&&l.nonce&&a.nonce!==((s=i.csp)===null||s===void 0?void 0:s.nonce)){var c;a.nonce=(c=i.csp)===null||c===void 0?void 0:c.nonce}return a.innerHTML!==t&&(a.innerHTML=t),a}var u=Htt(t,i);return u.setAttribute(Rtt(i),e),u}var lse;function Itt(t){var e="rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7)),n=document.createElement("div");n.id=e;var o=n.style;o.position="absolute",o.left="0",o.top="0",o.width="100px",o.height="100px",o.overflow="scroll";var r,i;if(t){var a=getComputedStyle(t);o.scrollbarColor=a.scrollbarColor,o.scrollbarWidth=a.scrollbarWidth;var l=getComputedStyle(t,"::-webkit-scrollbar"),s=parseInt(l.width,10),c=parseInt(l.height,10);try{var u=s?"width: ".concat(l.width,";"):"",d=c?"height: ".concat(l.height,";"):"";cnn(` #`.concat(e,`::-webkit-scrollbar { `).concat(u,` `).concat(d,` @@ -4756,7 +4756,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata - onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,fnn="".concat(unn," ").concat(dnn).split(/[\s\n]+/),hnn="aria-",pnn="data-";function ECe(t,e){return t.indexOf(e)===0}function kCe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=nn({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||ECe(r,hnn))||n.data&&ECe(r,pnn)||n.attr&&fnn.includes(r))&&(o[r]=t[r])}),o}function ztt(t,e,n,o,r,i,a){t.push({record:e,indent:n,index:a});var l=i(e),s=r==null?void 0:r.has(l);if(e&&Array.isArray(e[o])&&s)for(var c=0;c1?D-1:0),N=1;N=1)),style:nn(nn({},n),x==null?void 0:x.style)}),m.map(function(R,M){var D=R.render,k=R.dataIndex,N=R.className,U=Ltt(f,R,M,s,r),W=U.key,F=U.fixedInfo,E=U.appendCellNode,L=U.additionalCellProps;return g.createElement(sI,Uo({className:N,ellipsis:R.ellipsis,align:R.align,scope:R.rowScope,component:R.rowScope?d:u,prefixCls:p,key:W,record:o,index:r,renderIndex:i,dataIndex:k,render:D,shouldCellUpdate:R.shouldCellUpdate},F,{appendNode:E,additionalProps:L}))})),b;if(P&&(A.current||C)){var T=w(o,r,s+1,C);b=g.createElement(ktt,{expanded:C,className:Bn("".concat(p,"-expanded-row"),"".concat(p,"-expanded-row-level-").concat(s+1),S),prefixCls:p,component:c,cellComponent:u,colSpan:m.length,isEmpty:!1},T)}return g.createElement(g.Fragment,null,v,b)}const Ann=lI(ynn);function wnn(t){var e=t.columnKey,n=t.onColumnResize,o=g.useRef();return g.useEffect(function(){o.current&&n(e,o.current.offsetWidth)},[]),g.createElement(Ld,{data:e},g.createElement("td",{ref:o,style:{padding:0,border:0,height:0}},g.createElement("div",{style:{height:0,overflow:"hidden"}}," ")))}function xnn(t){var e=t.prefixCls,n=t.columnsKey,o=t.onColumnResize;return g.createElement("tr",{"aria-hidden":"true",className:"".concat(e,"-measure-row"),style:{height:0,fontSize:0}},g.createElement(Ld.Collection,{onBatchResize:function(i){i.forEach(function(a){var l=a.data,s=a.size;o(l,s.offsetWidth)})}},n.map(function(r){return g.createElement(wnn,{key:r,columnKey:r,onColumnResize:o})})))}function vnn(t){var e=t.data,n=t.measureColumnWidth,o=If(Kp,["prefixCls","getComponent","onColumnResize","flattenColumns","getRowKey","expandedKeys","childrenColumnName","emptyNode"]),r=o.prefixCls,i=o.getComponent,a=o.onColumnResize,l=o.flattenColumns,s=o.getRowKey,c=o.expandedKeys,u=o.childrenColumnName,d=o.emptyNode,f=Dtt(e,u,c,s),p=g.useRef({renderWithProps:!1}),m=i(["body","wrapper"],"tbody"),y=i(["body","row"],"tr"),w=i(["body","cell"],"td"),x=i(["body","cell"],"th"),C;e.length?C=f.map(function(A,S){var v=A.record,b=A.indent,T=A.index,R=s(v,S);return g.createElement(Ann,{key:R,rowKey:R,record:v,index:S,renderIndex:T,rowComponent:y,cellComponent:w,scopeCellComponent:x,indent:b})}):C=g.createElement(ktt,{expanded:!0,className:"".concat(r,"-placeholder"),prefixCls:r,component:y,cellComponent:w,colSpan:l.length,isEmpty:!0},d);var P=Hee(l);return g.createElement(btt.Provider,{value:p.current},g.createElement(m,{className:"".concat(r,"-tbody")},n&&g.createElement(xnn,{prefixCls:r,columnsKey:P,onColumnResize:a}),C))}const bnn=lI(vnn);var Snn=["expandable"],Vk="RC_TABLE_INTERNAL_COL_DEFINE";function Tnn(t){var e=t.expandable,n=Ai(t,Snn),o;return"expandable"in t?o=nn(nn({},n),e):o=n,o.showExpandColumn===!1&&(o.expandIconColumnIndex=-1),o}var Pnn=["columnType"];function Wtt(t){for(var e=t.colWidths,n=t.columns,o=t.columCount,r=If(Kp,["tableLayout"]),i=r.tableLayout,a=[],l=o||n.length,s=!1,c=l-1;c>=0;c-=1){var u=e[c],d=n&&n[c],f=void 0,p=void 0;if(d&&(f=d[Vk],i==="auto"&&(p=d.minWidth)),u||p||f||s){var m=f||{};m.columnType;var y=Ai(m,Pnn);a.unshift(g.createElement("col",Uo({key:c,style:{width:u,minWidth:p}},y))),s=!0}}return g.createElement("colgroup",null,a)}var Cnn=["className","noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","stickyTopOffset","stickyBottomOffset","stickyClassName","onScroll","maxContentScroll","children"];function Rnn(t,e){return g.useMemo(function(){for(var n=[],o=0;o1?"colgroup":"col":null,ellipsis:w.ellipsis,align:w.align,component:a,prefixCls:u,key:p[y]},x,{additionalProps:C,rowType:"header"}))}))};function Inn(t){var e=[];function n(a,l){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;e[s]=e[s]||[];var c=l,u=a.filter(Boolean).map(function(d){var f={key:d.key,className:d.className||"",children:d.title,column:d,colStart:c},p=1,m=d.children;return m&&m.length>0&&(p=n(m,c,s+1).reduce(function(y,w){return y+w},0),f.hasSubColumns=!0),"colSpan"in d&&(p=d.colSpan),"rowSpan"in d&&(f.rowSpan=d.rowSpan),f.colSpan=p,f.colEnd=f.colStart+p-1,e[s].push(f),c+=p,p});return u}n(t,0);for(var o=e.length,r=function(l){e[l].forEach(function(s){!("rowSpan"in s)&&!s.hasSubColumns&&(s.rowSpan=o-l)})},i=0;i1&&arguments[1]!==void 0?arguments[1]:{},n=[];return xe.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(Xhe(o)):Gtn(o)&&o.props?n=n.concat(Xhe(o.props.children,e)):n.push(o))}),n}function WCe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return typeof e=="number"?e:e.endsWith("%")?t*parseFloat(e)/100:null}function Dnn(t,e,n){return g.useMemo(function(){if(e&&e>0){var o=0,r=0;t.forEach(function(f){var p=WCe(e,f.width);p?o+=p:r+=1});var i=Math.max(e,n),a=Math.max(i-o,r),l=r,s=a/r,c=0,u=t.map(function(f){var p=nn({},f),m=WCe(e,p.width);if(m)p.width=m;else{var y=Math.floor(s);p.width=l===1?a:y,a-=y,l-=1}return c+=p.width,p});if(c0?nn(nn({},e),{},{children:Ntt(n)}):e})}function Jhe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key";return t.filter(function(n){return n&&Vr(n)==="object"}).reduce(function(n,o,r){var i=o.fixed,a=i===!0?"left":i,l="".concat(e,"-").concat(r),s=o.children;return s&&s.length>0?[].concat($o(n),$o(Jhe(s,l).map(function(c){return nn({fixed:a},c)}))):[].concat($o(n),[nn(nn({key:l},o),{},{fixed:a})])},[])}function Fnn(t){return t.map(function(e){var n=e.fixed,o=Ai(e,knn),r=n;return n==="left"?r="right":n==="right"&&(r="left"),nn({fixed:r},o)})}function Lnn(t,e){var n=t.prefixCls,o=t.columns,r=t.children,i=t.expandable,a=t.expandedKeys,l=t.columnTitle,s=t.getRowKey,c=t.onTriggerExpand,u=t.expandIcon,d=t.rowExpandable,f=t.expandIconColumnIndex,p=t.direction,m=t.expandRowByClick,y=t.columnWidth,w=t.fixed,x=t.scrollWidth,C=t.clientWidth,P=g.useMemo(function(){var k=o||m3e(r)||[];return Ntt(k.slice())},[o,r]),A=g.useMemo(function(){if(i){var k=P.slice();if(!k.includes(aA)){var N=f||0;N>=0&&(N||w==="left"||!w)&&k.splice(N,0,aA),w==="right"&&k.splice(P.length,0,aA)}var U=k.indexOf(aA);k=k.filter(function(L,j){return L!==aA||j===U});var W=P[U],F;w?F=w:F=W?W.fixed:null;var E=Ut(Ut(Ut(Ut(Ut(Ut({},Vk,{className:"".concat(n,"-expand-icon-col"),columnType:"EXPAND_COLUMN"}),"title",l),"fixed",F),"className","".concat(n,"-row-expand-icon-cell")),"width",y),"render",function(j,Y,O){var _=s(Y,O),G=a.has(_),Q=d?d(Y):!0,oe=u({prefixCls:n,expanded:G,expandable:Q,record:Y,onExpand:c});return m?g.createElement("span",{onClick:function(q){return q.stopPropagation()}},oe):oe});return k.map(function(L){return L===aA?E:L})}return P.filter(function(L){return L!==aA})},[i,P,s,a,u,p]),S=g.useMemo(function(){var k=A;return e&&(k=e(k)),k.length||(k=[{render:function(){return null}}]),k},[e,A,p]),v=g.useMemo(function(){return p==="rtl"?Fnn(Jhe(S)):Jhe(S)},[S,p,x]),b=g.useMemo(function(){for(var k=-1,N=v.length-1;N>=0;N-=1){var U=v[N].fixed;if(U==="left"||U===!0){k=N;break}}if(k>=0)for(var W=0;W<=k;W+=1){var F=v[W].fixed;if(F!=="left"&&F!==!0)return!0}var E=v.findIndex(function(Y){var O=Y.fixed;return O==="right"});if(E>=0)for(var L=E;L1&&arguments[1]!==void 0?arguments[1]:1;jCe+=1;var o=jCe;function r(i){if(i===0)Ytt(o),e();else{var a=jtt(function(){r(i-1)});y3e.set(o,a)}}return r(n),o};Khe.cancel=function(t){var e=y3e.get(t);return Ytt(t),Btt(e)};function BCe(t){return t instanceof HTMLElement||t instanceof SVGElement}function Ott(t){return t&&Vr(t)==="object"&&BCe(t.nativeElement)?t.nativeElement:BCe(t)?t:null}function YCe(t){var e=Ott(t),n=e.getBoundingClientRect(),o=document.documentElement;return{left:n.left+(window.pageXOffset||o.scrollLeft)-(o.clientLeft||document.body.clientLeft||0),top:n.top+(window.pageYOffset||o.scrollTop)-(o.clientTop||document.body.clientTop||0)}}var Onn=function(e,n){var o,r,i=e.scrollBodyRef,a=e.onScroll,l=e.offsetScroll,s=e.container,c=e.direction,u=If(Kp,"prefixCls"),d=((o=i.current)===null||o===void 0?void 0:o.scrollWidth)||0,f=((r=i.current)===null||r===void 0?void 0:r.clientWidth)||0,p=d&&f*(f/d),m=g.useRef(),y=Utt({scrollLeft:0,isHiddenScrollBar:!0}),w=Sn(y,2),x=w[0],C=w[1],P=g.useRef({delta:0,x:0}),A=g.useState(!1),S=Sn(A,2),v=S[0],b=S[1],T=g.useRef(null);g.useEffect(function(){return function(){Khe.cancel(T.current)}},[]);var R=function(){b(!1)},M=function(W){W.persist(),P.current.delta=W.pageX-x.scrollLeft,P.current.x=0,b(!0),W.preventDefault()},D=function(W){var F,E=W||((F=window)===null||F===void 0?void 0:F.event),L=E.buttons;if(!v||L===0){v&&b(!1);return}var j=P.current.x+W.pageX-P.current.x-P.current.delta,Y=c==="rtl";j=Math.max(Y?p-f:0,Math.min(Y?0:f-p,j));var O=!Y||Math.abs(j)+Math.abs(p)=E-l?C(function(L){return nn(nn({},L),{},{isHiddenScrollBar:!0})}):C(function(L){return nn(nn({},L),{},{isHiddenScrollBar:!1})})}})},N=function(W){C(function(F){return nn(nn({},F),{},{scrollLeft:W/d*f||0})})};return g.useImperativeHandle(n,function(){return{setScrollLeft:N,checkScrollBarVisible:k}}),g.useEffect(function(){var U=t_(document.body,"mouseup",R,!1),W=t_(document.body,"mousemove",D,!1);return k(),function(){U.remove(),W.remove()}},[p,v]),g.useEffect(function(){var U=t_(s,"scroll",k,!1),W=t_(window,"resize",k,!1);return function(){U.remove(),W.remove()}},[s]),g.useEffect(function(){x.isHiddenScrollBar||C(function(U){var W=i.current;return W?nn(nn({},U),{},{scrollLeft:W.scrollLeft/W.scrollWidth*W.clientWidth}):U})},[x.isHiddenScrollBar]),d<=f||!p||x.isHiddenScrollBar?null:g.createElement("div",{style:{height:zCe(),width:f,bottom:l},className:"".concat(u,"-sticky-scroll")},g.createElement("div",{onMouseDown:M,ref:m,className:Bn("".concat(u,"-sticky-scroll-bar"),Ut({},"".concat(u,"-sticky-scroll-bar-active"),v)),style:{width:"".concat(p,"px"),transform:"translate3d(".concat(x.scrollLeft,"px, 0, 0)")}}))};const _nn=g.forwardRef(Onn);var _tt="rc-table",Vnn=[],Gnn={};function Xnn(){return"No Data"}function Jnn(t,e){var n=nn({rowKey:"key",prefixCls:_tt,emptyText:Xnn},t),o=n.prefixCls,r=n.className,i=n.rowClassName,a=n.style,l=n.data,s=n.rowKey,c=n.scroll,u=n.tableLayout,d=n.direction,f=n.title,p=n.footer,m=n.summary,y=n.caption,w=n.id,x=n.showHeader,C=n.components,P=n.emptyText,A=n.onRow,S=n.onHeaderRow,v=n.onScroll,b=n.internalHooks,T=n.transformColumns,R=n.internalRefs,M=n.tailor,D=n.getContainerWidth,k=n.sticky,N=n.rowHoverable,U=N===void 0?!0:N,W=l||Vnn,F=!!W.length,E=b===TU,L=g.useCallback(function(No,ho){return u3e(C,No)||ho},[C]),j=g.useMemo(function(){return typeof s=="function"?s:function(No){var ho=No&&No[s];return ho}},[s]),Y=L(["body"]),O=jnn(),_=Sn(O,3),G=_[0],Q=_[1],oe=_[2],ee=Wnn(n,W,j),q=Sn(ee,6),ae=q[0],Z=q[1],ne=q[2],te=q[3],$=q[4],le=q[5],de=c==null?void 0:c.x,he=g.useState(0),me=Sn(he,2),ce=me[0],Pe=me[1],pe=Lnn(nn(nn(nn({},n),ae),{},{expandable:!!ae.expandedRowRender,columnTitle:ae.columnTitle,expandedKeys:ne,getRowKey:j,onTriggerExpand:le,expandIcon:te,expandIconColumnIndex:ae.expandIconColumnIndex,direction:d,scrollWidth:E&&M&&typeof de=="number"?de:null,clientWidth:ce}),E?T:null),Ie=Sn(pe,4),ve=Ie[0],ze=Ie[1],Ae=Ie[2],se=Ie[3],ge=Ae??de,we=g.useMemo(function(){return{columns:ve,flattenColumns:ze}},[ve,ze]),Se=g.useRef(),Me=g.useRef(),Ce=g.useRef(),Te=g.useRef();g.useImperativeHandle(e,function(){return{nativeElement:Se.current,scrollTo:function(ho){var vo;if(Ce.current instanceof HTMLElement){var bo=ho.index,Bo=ho.top,Pr=ho.key;if(Ltn(Bo)){var so;(so=Ce.current)===null||so===void 0||so.scrollTo({top:Bo})}else{var zo,Ci=Pr??j(W[bo]);(zo=Ce.current.querySelector('[data-row-key="'.concat(Ci,'"]')))===null||zo===void 0||zo.scrollIntoView()}}else(vo=Ce.current)!==null&&vo!==void 0&&vo.scrollTo&&Ce.current.scrollTo(ho)}}});var Re=g.useRef(),Ne=g.useState(!1),_e=Sn(Ne,2),Ue=_e[0],qe=_e[1],Fe=g.useState(!1),He=Sn(Fe,2),Le=He[0],Ye=He[1],lt=Utt(new Map),Oe=Sn(lt,2),ut=Oe[0],ht=Oe[1],Qe=Hee(ze),nt=Qe.map(function(No){return ut.get(No)}),mt=g.useMemo(function(){return nt},[nt.join("_")]),tt=Ynn(mt,ze,d),gt=c&&Vhe(c.y),Ve=c&&Vhe(ge)||!!ae.fixed,je=Ve&&ze.some(function(No){var ho=No.fixed;return ho}),et=g.useRef(),bt=Bnn(k,o),St=bt.isSticky,Pt=bt.offsetHeader,Yt=bt.offsetSummary,zt=bt.offsetScroll,Rt=bt.stickyClassName,Ct=bt.container,yt=g.useMemo(function(){return m==null?void 0:m(W)},[m,W]),at=(gt||St)&&g.isValidElement(yt)&&yt.type===Uee&&yt.props.fixed,Et,Lt,Je;gt&&(Lt={overflowY:F?"scroll":"auto",maxHeight:c.y}),Ve&&(Et={overflowX:"auto"},gt||(Lt={overflowY:"hidden"}),Je={width:ge===!0?"auto":ge,minWidth:"100%"});var st=g.useCallback(function(No,ho){tnn(Se.current)&&ht(function(vo){if(vo.get(No)!==ho){var bo=new Map(vo);return bo.set(No,ho),bo}return vo})},[]),It=Unn(),ot=Sn(It,2),it=ot[0],Be=ot[1];function pt(No,ho){ho&&(typeof ho=="function"?ho(No):ho.scrollLeft!==No&&(ho.scrollLeft=No,ho.scrollLeft!==No&&setTimeout(function(){ho.scrollLeft=No},0)))}var ct=qb(function(No){var ho=No.currentTarget,vo=No.scrollLeft,bo=d==="rtl",Bo=typeof vo=="number"?vo:ho.scrollLeft,Pr=ho||Gnn;if(!Be()||Be()===Pr){var so;it(Pr),pt(Bo,Me.current),pt(Bo,Ce.current),pt(Bo,Re.current),pt(Bo,(so=et.current)===null||so===void 0?void 0:so.setScrollLeft)}var zo=ho||Me.current;if(zo){var Ci=E&&M&&typeof ge=="number"?ge:zo.scrollWidth,ea=zo.clientWidth;if(Ci===ea){qe(!1),Ye(!1);return}bo?(qe(-Bo0)):(qe(Bo>0),Ye(Bo1&&arguments[1]!==void 0?arguments[1]:1;VCe+=1;var o=VCe;function r(i){if(i===0)Ktt(o),e();else{var a=Xtt(function(){r(i-1)});A3e.set(o,a)}}return r(n),o};u5.cancel=function(t){var e=A3e.get(t);return Ktt(t),Jtt(e)};var GCe=(typeof navigator>"u"?"undefined":Vr(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const $tt=function(t,e,n,o){var r=g.useRef(!1),i=g.useRef(null);function a(){clearTimeout(i.current),r.current=!0,i.current=setTimeout(function(){r.current=!1},50)}var l=g.useRef({top:t,bottom:e,left:n,right:o});return l.current.top=t,l.current.bottom=e,l.current.left=n,l.current.right=o,function(s,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,d=s?c<0&&l.current.left||c>0&&l.current.right:c<0&&l.current.top||c>0&&l.current.bottom;return u&&d?(clearTimeout(i.current),r.current=!1):(!d||r.current)&&a(),!r.current&&d}};function ton(t,e,n,o,r,i,a){var l=g.useRef(0),s=g.useRef(null),c=g.useRef(null),u=g.useRef(!1),d=$tt(e,n,o,r);function f(C,P){if(u5.cancel(s.current),!d(!1,P)){var A=C;if(!A._virtualHandled)A._virtualHandled=!0;else return;l.current+=P,c.current=P,GCe||A.preventDefault(),s.current=u5(function(){var S=u.current?10:1;a(l.current*S,!1),l.current=0})}}function p(C,P){a(P,!0),GCe||C.preventDefault()}var m=g.useRef(null),y=g.useRef(null);function w(C){if(t){u5.cancel(y.current),y.current=u5(function(){m.current=null},2);var P=C.deltaX,A=C.deltaY,S=C.shiftKey,v=P,b=A;(m.current==="sx"||!m.current&&S&&A&&!P)&&(v=A,b=0,m.current="sx");var T=Math.abs(v),R=Math.abs(b);m.current===null&&(m.current=i&&T>R?"x":"y"),m.current==="y"?f(C,b):p(C,v)}}function x(C){t&&(u.current=C.detail===c.current)}return[w,x]}function non(t,e,n,o){var r=g.useMemo(function(){return[new Map,[]]},[t,n.id,o]),i=Sn(r,2),a=i[0],l=i[1],s=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var m=t.length,y=l.length;y0&&arguments[0]!==void 0?arguments[0]:!1;u();var m=function(){var x=!1;l.current.forEach(function(C,P){if(C&&C.offsetParent){var A=ron(C),S=A.offsetHeight,v=getComputedStyle(A),b=v.marginTop,T=v.marginBottom,R=XCe(b),M=XCe(T),D=S+R+M;s.current.get(P)!==D&&(s.current.set(P,D),x=!0)}}),x&&a(function(C){return C+1})};if(p)m();else{c.current+=1;var y=c.current;Promise.resolve().then(function(){y===c.current&&m()})}}function f(p,m){var y=t(p);l.current.get(y),m?(l.current.set(y,m),d()):l.current.delete(y)}return g.useEffect(function(){return u},[]),[f,d,s.current,i]}var JCe=14/15;function lon(t,e,n){var o=g.useRef(!1),r=g.useRef(0),i=g.useRef(0),a=g.useRef(null),l=g.useRef(null),s,c=function(p){if(o.current){var m=Math.ceil(p.touches[0].pageX),y=Math.ceil(p.touches[0].pageY),w=r.current-m,x=i.current-y,C=Math.abs(w)>Math.abs(x);C?r.current=m:i.current=y;var P=n(C,C?w:x,!1,p);P&&p.preventDefault(),clearInterval(l.current),P&&(l.current=setInterval(function(){C?w*=JCe:x*=JCe;var A=Math.floor(C?w:x);(!n(C,A,!0)||Math.abs(A)<=.1)&&clearInterval(l.current)},16))}},u=function(){o.current=!1,s()},d=function(p){s(),p.touches.length===1&&!o.current&&(o.current=!0,r.current=Math.ceil(p.touches[0].pageX),i.current=Math.ceil(p.touches[0].pageY),a.current=p.target,a.current.addEventListener("touchmove",c,{passive:!1}),a.current.addEventListener("touchend",u,{passive:!0}))};s=function(){a.current&&(a.current.removeEventListener("touchmove",c),a.current.removeEventListener("touchend",u))},Gk(function(){return t&&e.current.addEventListener("touchstart",d,{passive:!0}),function(){var f;(f=e.current)===null||f===void 0||f.removeEventListener("touchstart",d),s(),clearInterval(l.current)}},[t])}function KCe(t){return Math.floor(Math.pow(t,.5))}function $he(t,e){var n="touches"in t?t.touches[0]:t;return n[e?"pageX":"pageY"]-window[e?"scrollX":"scrollY"]}function son(t,e,n){g.useEffect(function(){var o=e.current;if(t&&o){var r=!1,i,a,l=function(){u5.cancel(i)},s=function f(){l(),i=u5(function(){n(a),f()})},c=function(p){var m=p;m._virtualHandled||(m._virtualHandled=!0,r=!0)},u=function(){r=!1,l()},d=function(p){if(r){var m=$he(p,!1),y=o.getBoundingClientRect(),w=y.top,x=y.bottom;if(m<=w){var C=w-m;a=-KCe(C),s()}else if(m>=x){var P=m-x;a=KCe(P),s()}else l()}};return o.addEventListener("mousedown",c),o.ownerDocument.addEventListener("mouseup",u),o.ownerDocument.addEventListener("mousemove",d),function(){o.removeEventListener("mousedown",c),o.ownerDocument.removeEventListener("mouseup",u),o.ownerDocument.removeEventListener("mousemove",d),l()}}},[t])}var con=10;function uon(t,e,n,o,r,i,a,l){var s=g.useRef(),c=g.useState(null),u=Sn(c,2),d=u[0],f=u[1];return Gk(function(){if(d&&d.times=0;U-=1){var W=r(e[U]),F=n.get(W);if(F===void 0){C=!0;break}if(N-=F,N<=0)break}switch(S){case"top":A=b-w;break;case"bottom":A=T-x+w;break;default:{var E=t.current.scrollTop,L=E+x;bL&&(P="bottom")}}A!==null&&a(A),A!==d.lastTop&&(C=!0)}C&&f(nn(nn({},d),{},{times:d.times+1,targetAlign:P,lastTop:A}))}},[d,t.current]),function(p){if(p==null){l();return}if(u5.cancel(s.current),typeof p=="number")a(p);else if(p&&Vr(p)==="object"){var m,y=p.align;"index"in p?m=p.index:m=e.findIndex(function(C){return r(C)===p.key});var w=p.offset,x=w===void 0?0:w;f({times:0,index:m,offset:x,originAlign:y})}}}var $Ce=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.rtl,r=t.scrollOffset,i=t.scrollRange,a=t.onStartMove,l=t.onStopMove,s=t.onScroll,c=t.horizontal,u=t.spinSize,d=t.containerSize,f=t.style,p=t.thumbStyle,m=t.showScrollBar,y=g.useState(!1),w=Sn(y,2),x=w[0],C=w[1],P=g.useState(null),A=Sn(P,2),S=A[0],v=A[1],b=g.useState(null),T=Sn(b,2),R=T[0],M=T[1],D=!o,k=g.useRef(),N=g.useRef(),U=g.useState(m),W=Sn(U,2),F=W[0],E=W[1],L=g.useRef(),j=function(){m===!0||m===!1||(clearTimeout(L.current),E(!0),L.current=setTimeout(function(){E(!1)},3e3))},Y=i-d||0,O=d-u||0,_=g.useMemo(function(){if(r===0||Y===0)return 0;var te=r/Y;return te*O},[r,Y,O]),G=function($){$.stopPropagation(),$.preventDefault()},Q=g.useRef({top:_,dragging:x,pageY:S,startTop:R});Q.current={top:_,dragging:x,pageY:S,startTop:R};var oe=function($){C(!0),v($he($,c)),M(Q.current.top),a(),$.stopPropagation(),$.preventDefault()};g.useEffect(function(){var te=function(he){he.preventDefault()},$=k.current,le=N.current;return $.addEventListener("touchstart",te,{passive:!1}),le.addEventListener("touchstart",oe,{passive:!1}),function(){$.removeEventListener("touchstart",te),le.removeEventListener("touchstart",oe)}},[]);var ee=g.useRef();ee.current=Y;var q=g.useRef();q.current=O,g.useEffect(function(){if(x){var te,$=function(he){var me=Q.current,ce=me.dragging,Pe=me.pageY,pe=me.startTop;u5.cancel(te);var Ie=k.current.getBoundingClientRect(),ve=d/(c?Ie.width:Ie.height);if(ce){var ze=($he(he,c)-Pe)*ve,Ae=pe;!D&&c?Ae-=ze:Ae+=ze;var se=ee.current,ge=q.current,we=ge?Ae/ge:0,Se=Math.ceil(we*se);Se=Math.max(Se,0),Se=Math.min(Se,se),te=u5(function(){s(Se,c)})}},le=function(){C(!1),l()};return window.addEventListener("mousemove",$,{passive:!0}),window.addEventListener("touchmove",$,{passive:!0}),window.addEventListener("mouseup",le,{passive:!0}),window.addEventListener("touchend",le,{passive:!0}),function(){window.removeEventListener("mousemove",$),window.removeEventListener("touchmove",$),window.removeEventListener("mouseup",le),window.removeEventListener("touchend",le),u5.cancel(te)}}},[x]),g.useEffect(function(){return j(),function(){clearTimeout(L.current)}},[r]),g.useImperativeHandle(e,function(){return{delayHidden:j}});var ae="".concat(n,"-scrollbar"),Z={position:"absolute",visibility:F?null:"hidden"},ne={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return c?(Z.height=8,Z.left=0,Z.right=0,Z.bottom=0,ne.height="100%",ne.width=u,D?ne.left=_:ne.right=_):(Z.width=8,Z.top=0,Z.bottom=0,D?Z.right=0:Z.left=0,ne.width="100%",ne.height=u,ne.top=_),g.createElement("div",{ref:k,className:Bn(ae,Ut(Ut(Ut({},"".concat(ae,"-horizontal"),c),"".concat(ae,"-vertical"),!c),"".concat(ae,"-visible"),F)),style:nn(nn({},Z),f),onMouseDown:G,onMouseMove:j},g.createElement("div",{ref:N,className:Bn("".concat(ae,"-thumb"),Ut({},"".concat(ae,"-thumb-moving"),x)),style:nn(nn({},ne),p),onMouseDown:oe}))}),don=20;function qCe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*t;return isNaN(n)&&(n=0),n=Math.max(n,don),Math.floor(n)}var fon=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],hon=[],pon={overflowY:"auto",overflowAnchor:"none"};function gon(t,e){var n=t.prefixCls,o=n===void 0?"rc-virtual-list":n,r=t.className,i=t.height,a=t.itemHeight,l=t.fullHeight,s=l===void 0?!0:l,c=t.style,u=t.data,d=t.children,f=t.itemKey,p=t.virtual,m=t.direction,y=t.scrollWidth,w=t.component,x=w===void 0?"div":w,C=t.onScroll,P=t.onVirtualScroll,A=t.onVisibleChange,S=t.innerProps,v=t.extraRender,b=t.styles,T=t.showScrollBar,R=T===void 0?"optional":T,M=Ai(t,fon),D=g.useCallback(function(Be){return typeof f=="function"?f(Be):Be==null?void 0:Be[f]},[f]),k=aon(D),N=Sn(k,4),U=N[0],W=N[1],F=N[2],E=N[3],L=!!(p!==!1&&i&&a),j=g.useMemo(function(){return Object.values(F.maps).reduce(function(Be,pt){return Be+pt},0)},[F.id,F.maps]),Y=L&&u&&(Math.max(a*u.length,j)>i||!!y),O=m==="rtl",_=Bn(o,Ut({},"".concat(o,"-rtl"),O),r),G=u||hon,Q=g.useRef(),oe=g.useRef(),ee=g.useRef(),q=g.useState(0),ae=Sn(q,2),Z=ae[0],ne=ae[1],te=g.useState(0),$=Sn(te,2),le=$[0],de=$[1],he=g.useState(!1),me=Sn(he,2),ce=me[0],Pe=me[1],pe=function(){Pe(!0)},Ie=function(){Pe(!1)},ve={getKey:D};function ze(Be){ne(function(pt){var ct;typeof Be=="function"?ct=Be(pt):ct=Be;var Xe=Qe(ct);return Q.current.scrollTop=Xe,Xe})}var Ae=g.useRef({start:0,end:G.length}),se=g.useRef(),ge=eon(G,D),we=Sn(ge,1),Se=we[0];se.current=Se;var Me=g.useMemo(function(){if(!L)return{scrollHeight:void 0,start:0,end:G.length-1,offset:void 0};if(!Y){var Be;return{scrollHeight:((Be=oe.current)===null||Be===void 0?void 0:Be.offsetHeight)||0,start:0,end:G.length-1,offset:void 0}}for(var pt=0,ct,Xe,ft,wt=G.length,kt=0;kt=Z&&ct===void 0&&(ct=kt,Xe=pt),qt>Z+i&&ft===void 0&&(ft=kt),pt=qt}return ct===void 0&&(ct=0,Xe=0,ft=Math.ceil(i/a)),ft===void 0&&(ft=G.length-1),ft=Math.min(ft+1,G.length-1),{scrollHeight:pt,start:ct,end:ft,offset:Xe}},[Y,L,Z,G,E,i]),Ce=Me.scrollHeight,Te=Me.start,Re=Me.end,Ne=Me.offset;Ae.current.start=Te,Ae.current.end=Re,g.useLayoutEffect(function(){var Be=F.getRecord();if(Be.size===1){var pt=Array.from(Be)[0],ct=D(G[Te]);if(ct===pt){var Xe=F.get(pt),ft=Xe-a;ze(function(wt){return wt+ft})}}F.resetRecord()},[Ce]);var _e=g.useState({width:0,height:i}),Ue=Sn(_e,2),qe=Ue[0],Fe=Ue[1],He=function(pt){Fe({width:pt.offsetWidth,height:pt.offsetHeight})},Le=g.useRef(),Ye=g.useRef(),lt=g.useMemo(function(){return qCe(qe.width,y)},[qe.width,y]),Oe=g.useMemo(function(){return qCe(qe.height,Ce)},[qe.height,Ce]),ut=Ce-i,ht=g.useRef(ut);ht.current=ut;function Qe(Be){var pt=Be;return Number.isNaN(ht.current)||(pt=Math.min(pt,ht.current)),pt=Math.max(pt,0),pt}var nt=Z<=0,mt=Z>=ut,tt=le<=0,gt=le>=y,Ve=$tt(nt,mt,tt,gt),je=function(){return{x:O?-le:le,y:Z}},et=g.useRef(je()),bt=OCe(function(Be){if(P){var pt=nn(nn({},je()),Be);(et.current.x!==pt.x||et.current.y!==pt.y)&&(P(pt),et.current=pt)}});function St(Be,pt){var ct=Be;pt?(r0.flushSync(function(){de(ct)}),bt()):ze(ct)}function Pt(Be){var pt=Be.currentTarget.scrollTop;pt!==Z&&ze(pt),C==null||C(Be),bt()}var Yt=function(pt){var ct=pt,Xe=y?y-qe.width:0;return ct=Math.max(ct,0),ct=Math.min(ct,Xe),ct},zt=OCe(function(Be,pt){pt?(r0.flushSync(function(){de(function(ct){var Xe=ct+(O?-Be:Be);return Yt(Xe)})}),bt()):ze(function(ct){var Xe=ct+Be;return Xe})}),Rt=ton(L,nt,mt,tt,gt,!!y,zt),Ct=Sn(Rt,2),yt=Ct[0],at=Ct[1];lon(L,Q,function(Be,pt,ct,Xe){var ft=Xe;return Ve(Be,pt,ct)?!1:!ft||!ft._virtualHandled?(ft&&(ft._virtualHandled=!0),yt({preventDefault:function(){},deltaX:Be?pt:0,deltaY:Be?0:pt}),!0):!1}),son(Y,Q,function(Be){ze(function(pt){return pt+Be})}),Gk(function(){function Be(ct){var Xe=nt&&ct.detail<0,ft=mt&&ct.detail>0;L&&!Xe&&!ft&&ct.preventDefault()}var pt=Q.current;return pt.addEventListener("wheel",yt,{passive:!1}),pt.addEventListener("DOMMouseScroll",at,{passive:!0}),pt.addEventListener("MozMousePixelScroll",Be,{passive:!1}),function(){pt.removeEventListener("wheel",yt),pt.removeEventListener("DOMMouseScroll",at),pt.removeEventListener("MozMousePixelScroll",Be)}},[L,nt,mt]),Gk(function(){if(y){var Be=Yt(le);de(Be),bt({x:Be})}},[qe.width,y]);var Et=function(){var pt,ct;(pt=Le.current)===null||pt===void 0||pt.delayHidden(),(ct=Ye.current)===null||ct===void 0||ct.delayHidden()},Lt=uon(Q,G,F,a,D,function(){return W(!0)},ze,Et);g.useImperativeHandle(e,function(){return{nativeElement:ee.current,getScrollInfo:je,scrollTo:function(pt){function ct(Xe){return Xe&&Vr(Xe)==="object"&&("left"in Xe||"top"in Xe)}ct(pt)?(pt.left!==void 0&&de(Yt(pt.left)),Lt(pt.top)):Lt(pt)}}}),Gk(function(){if(A){var Be=G.slice(Te,Re+1);A(Be,G)}},[Te,Re,G]);var Je=non(G,D,F,a),st=v==null?void 0:v({start:Te,end:Re,virtual:Y,offsetX:le,offsetY:Ne,rtl:O,getSize:Je}),It=Qnn(G,Te,Re,y,le,U,d,ve),ot=null;i&&(ot=nn(Ut({},s?"height":"maxHeight",i),pon),L&&(ot.overflowY="hidden",y&&(ot.overflowX="hidden"),ce&&(ot.pointerEvents="none")));var it={};return O&&(it.dir="rtl"),g.createElement("div",Uo({ref:ee,style:nn(nn({},c),{},{position:"relative"}),className:_},it,M),g.createElement(Ld,{onResize:He},g.createElement(x,{className:"".concat(o,"-holder"),style:ot,ref:Q,onScroll:Pt,onMouseEnter:Et},g.createElement(Gtt,{prefixCls:o,height:Ce,offsetX:le,offsetY:Ne,scrollWidth:y,onInnerResize:W,ref:oe,innerProps:S,rtl:O,extra:st},It))),Y&&Ce>i&&g.createElement($Ce,{ref:Le,prefixCls:o,scrollOffset:Z,scrollRange:Ce,rtl:O,onScroll:St,onStartMove:pe,onStopMove:Ie,spinSize:Oe,containerSize:qe.height,style:b==null?void 0:b.verticalScrollBar,thumbStyle:b==null?void 0:b.verticalScrollBarThumb,showScrollBar:R}),Y&&y>qe.width&&g.createElement($Ce,{ref:Ye,prefixCls:o,scrollOffset:le,scrollRange:y,rtl:O,onScroll:St,onStartMove:pe,onStopMove:Ie,spinSize:lt,containerSize:qe.width,horizontal:!0,style:b==null?void 0:b.horizontalScrollBar,thumbStyle:b==null?void 0:b.horizontalScrollBarThumb,showScrollBar:R}))}var qtt=g.forwardRef(gon);qtt.displayName="List";var w3e=s3e(null),Qtt=s3e(null);function mon(t,e,n){var o=e||1;return n[t+o]-(n[t]||0)}function yon(t){var e=t.rowInfo,n=t.column,o=t.colIndex,r=t.indent,i=t.index,a=t.component,l=t.renderIndex,s=t.record,c=t.style,u=t.className,d=t.inverse,f=t.getHeight,p=n.render,m=n.dataIndex,y=n.className,w=n.width,x=If(Qtt,["columnsOffset"]),C=x.columnsOffset,P=Ltt(e,n,o,r,i),A=P.key,S=P.fixedInfo,v=P.appendCellNode,b=P.additionalCellProps,T=b.style,R=b.colSpan,M=R===void 0?1:R,D=b.rowSpan,k=D===void 0?1:D,N=o-1,U=mon(N,M,C),W=M>1?w-U:0,F=nn(nn(nn({},T),c),{},{flex:"0 0 ".concat(U,"px"),width:"".concat(U,"px"),marginRight:W,pointerEvents:"auto"}),E=g.useMemo(function(){return d?k<=1:M===0||k===0||k>1},[k,M,d]);E?F.visibility="hidden":d&&(F.height=f==null?void 0:f(k));var L=E?function(){return null}:p,j={};return(k===0||M===0)&&(j.rowSpan=1,j.colSpan=1),g.createElement(sI,Uo({className:Bn(y,u),ellipsis:n.ellipsis,align:n.align,scope:n.rowScope,component:a,prefixCls:e.prefixCls,key:A,record:s,index:i,renderIndex:l,dataIndex:m,render:L,shouldCellUpdate:n.shouldCellUpdate},S,{appendNode:v,additionalProps:nn(nn({},b),{},{style:F},j)}))}var Aon=["data","index","className","rowKey","style","extra","getHeight"],won=g.forwardRef(function(t,e){var n=t.data,o=t.index,r=t.className,i=t.rowKey,a=t.style,l=t.extra,s=t.getHeight,c=Ai(t,Aon),u=n.record,d=n.indent,f=n.index,p=If(Kp,["prefixCls","flattenColumns","fixColumn","componentWidth","scrollX"]),m=p.scrollX,y=p.flattenColumns,w=p.prefixCls,x=p.fixColumn,C=p.componentWidth,P=If(w3e,["getComponent"]),A=P.getComponent,S=Ett(u,i,o,d),v=A(["body","row"],"div"),b=A(["body","cell"],"div"),T=S.rowSupportExpand,R=S.expanded,M=S.rowProps,D=S.expandedRowRender,k=S.expandedRowClassName,N;if(T&&R){var U=D(u,o,d+1,R),W=Ftt(k,u,o,d),F={};x&&(F={style:Ut({},"--virtual-width","".concat(C,"px"))});var E="".concat(w,"-expanded-row-cell");N=g.createElement(v,{className:Bn("".concat(w,"-expanded-row"),"".concat(w,"-expanded-row-level-").concat(d+1),W)},g.createElement(sI,{component:b,prefixCls:w,className:Bn(E,Ut({},"".concat(E,"-fixed"),x)),additionalProps:F},U))}var L=nn(nn({},a),{},{width:m});l&&(L.position="absolute",L.pointerEvents="none");var j=g.createElement(v,Uo({},M,c,{"data-row-key":i,ref:T?null:e,className:Bn(r,"".concat(w,"-row"),M==null?void 0:M.className,Ut({},"".concat(w,"-row-extra"),l)),style:nn(nn({},L),M==null?void 0:M.style)}),y.map(function(Y,O){return g.createElement(yon,{key:O,component:b,rowInfo:S,column:Y,colIndex:O,indent:d,index:o,renderIndex:f,record:u,inverse:l,getHeight:s})}));return T?g.createElement("div",{ref:e},j,N):j}),QCe=lI(won),xon=g.forwardRef(function(t,e){var n=t.data,o=t.onScroll,r=If(Kp,["flattenColumns","onColumnResize","getRowKey","prefixCls","expandedKeys","childrenColumnName","scrollX","direction"]),i=r.flattenColumns,a=r.onColumnResize,l=r.getRowKey,s=r.expandedKeys,c=r.prefixCls,u=r.childrenColumnName,d=r.scrollX,f=r.direction,p=If(w3e),m=p.sticky,y=p.scrollY,w=p.listItemHeight,x=p.getComponent,C=p.onScroll,P=g.useRef(),A=Dtt(n,u,s,l),S=g.useMemo(function(){var N=0;return i.map(function(U){var W=U.width,F=U.key;return N+=W,[F,W,N]})},[i]),v=g.useMemo(function(){return S.map(function(N){return N[2]})},[S]);g.useEffect(function(){S.forEach(function(N){var U=Sn(N,2),W=U[0],F=U[1];a(W,F)})},[S]),g.useImperativeHandle(e,function(){var N,U={scrollTo:function(F){var E;(E=P.current)===null||E===void 0||E.scrollTo(F)},nativeElement:(N=P.current)===null||N===void 0?void 0:N.nativeElement};return Object.defineProperty(U,"scrollLeft",{get:function(){var F;return((F=P.current)===null||F===void 0?void 0:F.getScrollInfo().x)||0},set:function(F){var E;(E=P.current)===null||E===void 0||E.scrollTo({left:F})}}),U});var b=function(U,W){var F,E=(F=A[W])===null||F===void 0?void 0:F.record,L=U.onCell;if(L){var j,Y=L(E,W);return(j=Y==null?void 0:Y.rowSpan)!==null&&j!==void 0?j:1}return 1},T=function(U){var W=U.start,F=U.end,E=U.getSize,L=U.offsetY;if(F<0)return null;for(var j=i.filter(function(te){return b(te,W)===0}),Y=W,O=function($){if(j=j.filter(function(le){return b(le,$)===0}),!j.length)return Y=$,1},_=W;_>=0&&!O(_);_-=1);for(var G=i.filter(function(te){return b(te,F)!==1}),Q=F,oe=function($){if(G=G.filter(function(le){return b(le,$)!==1}),!G.length)return Q=Math.max($-1,F),1},ee=F;ee1})&&q.push($)},Z=Y;Z<=Q;Z+=1)ae(Z);var ne=q.map(function(te){var $=A[te],le=l($.record,te),de=function(ce){var Pe=te+ce-1,pe=l(A[Pe].record,Pe),Ie=E(le,pe);return Ie.bottom-Ie.top},he=E(le);return g.createElement(QCe,{key:te,data:$,rowKey:le,index:te,style:{top:-L+he.top},extra:!0,getHeight:de})});return ne},R=g.useMemo(function(){return{columnsOffset:v}},[v]),M="".concat(c,"-tbody"),D=x(["body","wrapper"]),k={};return m&&(k.position="sticky",k.bottom=0,Vr(m)==="object"&&m.offsetScroll&&(k.bottom=m.offsetScroll)),g.createElement(Qtt.Provider,{value:R},g.createElement(qtt,{fullHeight:!1,ref:P,prefixCls:"".concat(M,"-virtual"),styles:{horizontalScrollBar:k},className:M,height:y,itemHeight:w||24,data:A,itemKey:function(U){return l(U.record)},component:D,scrollWidth:d,direction:f,onVirtualScroll:function(U){var W,F=U.x;o({currentTarget:(W=P.current)===null||W===void 0?void 0:W.nativeElement,scrollLeft:F})},onScroll:C,extraRender:T},function(N,U,W){var F=l(N.record,U);return g.createElement(QCe,{data:N,rowKey:F,index:U,style:W.style})}))}),von=lI(xon),bon=function(e,n){var o=n.ref,r=n.onScroll;return g.createElement(von,{ref:o,data:e,onScroll:r})};function Son(t,e){var n=t.data,o=t.columns,r=t.scroll,i=t.sticky,a=t.prefixCls,l=a===void 0?_tt:a,s=t.className,c=t.listItemHeight,u=t.components,d=t.onScroll,f=r||{},p=f.x,m=f.y;typeof p!="number"&&(p=1),typeof m!="number"&&(m=500);var y=qb(function(C,P){return u3e(u,C)||P}),w=qb(d),x=g.useMemo(function(){return{sticky:i,scrollY:m,listItemHeight:c,getComponent:y,onScroll:w}},[i,m,c,y,w]);return g.createElement(w3e.Provider,{value:x},g.createElement(cI,Uo({},t,{className:Bn(s,"".concat(l,"-virtual")),scroll:nn(nn({},r),{},{x:p}),components:nn(nn({},u),{},{body:n!=null&&n.length?bon:void 0}),columns:o,internalHooks:TU,tailor:!0,ref:e})))}var Ton=g.forwardRef(Son);function Ztt(t){return Att(Ton,t)}Ztt();const Pon=t=>null,Con=t=>null;var x3e=g.createContext(null),Ron=g.createContext({}),Hon=function(e){for(var n=e.prefixCls,o=e.level,r=e.isStart,i=e.isEnd,a="".concat(n,"-indent-unit"),l=[],s=0;s=0&&n.splice(o,1),n}function rA(t,e){var n=(t||[]).slice();return n.indexOf(e)===-1&&n.push(e),n}function v3e(t){return t.split("-")}function Don(t,e){var n=[],o=m1(e,t);function r(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(a){var l=a.key,s=a.children;n.push(l),r(s)})}return r(o.children),n}function Eon(t){if(t.parent){var e=v3e(t.pos);return Number(e[e.length-1])===t.parent.children.length-1}return!1}function kon(t){var e=v3e(t.pos);return Number(e[e.length-1])===0}function tRe(t,e,n,o,r,i,a,l,s,c){var u,d=t.clientX,f=t.clientY,p=t.target.getBoundingClientRect(),m=p.top,y=p.height,w=(c==="rtl"?-1:1)*(((r==null?void 0:r.x)||0)-d),x=(w-12)/o,C=s.filter(function(F){var E;return(E=l[F])===null||E===void 0||(E=E.children)===null||E===void 0?void 0:E.length}),P=m1(l,n.eventKey);if(f-1.5?i({dragNode:N,dropNode:U,dropPosition:1})?M=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:0})?M=0:i({dragNode:N,dropNode:U,dropPosition:1})?M=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:1})?M=1:W=!1,{dropPosition:M,dropLevelOffset:D,dropTargetKey:P.key,dropTargetPos:P.pos,dragOverNodeKey:R,dropContainerKey:M===0?null:((u=P.parent)===null||u===void 0?void 0:u.key)||null,dropAllowed:W}}function nRe(t,e){if(t){var n=e.multiple;return n?t.slice():t.length?[t[0]]:t}}function sse(t){if(!t)return null;var e;if(Array.isArray(t))e={checkedKeys:t,halfCheckedKeys:void 0};else if(Vr(t)==="object")e={checkedKeys:t.checked||void 0,halfCheckedKeys:t.halfChecked||void 0};else return Ds(!1,"`checkedKeys` is not an array or an object"),null;return e}function qhe(t,e){var n=new Set;function o(r){if(!n.has(r)){var i=m1(e,r);if(i){n.add(r);var a=i.parent,l=i.node;l.disabled||a&&o(a.key)}}}return(t||[]).forEach(function(r){o(r)}),$o(n)}function Fon(t){const[e,n]=g.useState(null);return[g.useCallback((i,a,l)=>{const s=e??i,c=Math.min(s||0,i),u=Math.max(s||0,i),d=a.slice(c,u+1).map(m=>t(m)),f=d.some(m=>!l.has(m)),p=[];return d.forEach(m=>{f?(l.has(m)||p.push(m),l.add(m)):(l.delete(m),p.push(m))}),n(f?u:null),p},[e]),i=>{n(i)}]}const zw={},Qhe="SELECT_ALL",Zhe="SELECT_INVERT",epe="SELECT_NONE",oRe=[],ent=(t,e)=>{let n=[];return(e||[]).forEach(o=>{n.push(o),o&&typeof o=="object"&&t in o&&(n=[].concat(Pa(n),Pa(ent(t,o[t]))))}),n},Lon=(t,e)=>{const{preserveSelectedRowKeys:n,selectedRowKeys:o,defaultSelectedRowKeys:r,getCheckboxProps:i,onChange:a,onSelect:l,onSelectAll:s,onSelectInvert:c,onSelectNone:u,onSelectMultiple:d,columnWidth:f,type:p,selections:m,fixed:y,renderCell:w,hideSelectAll:x,checkStrictly:C=!0}=e||{},{prefixCls:P,data:A,pageData:S,getRecordByKey:v,getRowKey:b,expandType:T,childrenColumnName:R,locale:M,getPopupContainer:D}=t,k=LS(),[N,U]=Fon(te=>te),[W,F]=qA(o||r||oRe,{value:o}),E=g.useRef(new Map),L=g.useCallback(te=>{if(n){const $=new Map;te.forEach(le=>{let de=v(le);!de&&E.current.has(le)&&(de=E.current.get(le)),$.set(le,de)}),E.current=$}},[v,n]);g.useEffect(()=>{L(W)},[W]);const j=g.useMemo(()=>ent(R,S),[R,S]),{keyEntities:Y}=g.useMemo(()=>{if(C)return{keyEntities:null};let te=A;if(n){const $=new Set(j.map((de,he)=>b(de,he))),le=Array.from(E.current).reduce((de,he)=>{let[me,ce]=he;return $.has(me)?de:de.concat(ce)},[]);te=[].concat(Pa(te),Pa(le))}return $9e(te,{externalGetKey:b,childrenPropName:R})},[A,b,C,R,n,j]),O=g.useMemo(()=>{const te=new Map;return j.forEach(($,le)=>{const de=b($,le),he=(i?i($):null)||{};te.set(de,he)}),te},[j,b,i]),_=g.useCallback(te=>{const $=b(te);let le;return O.has($)?le=O.get(b(te)):le=i?i(te):void 0,!!(le!=null&&le.disabled)},[O,b]),[G,Q]=g.useMemo(()=>{if(C)return[W||[],[]];const{checkedKeys:te,halfCheckedKeys:$}=kR(W,!0,Y,_);return[te||[],$]},[W,C,Y,_]),oe=g.useMemo(()=>{const te=p==="radio"?G.slice(0,1):G;return new Set(te)},[G,p]),ee=g.useMemo(()=>p==="radio"?new Set:new Set(Q),[Q,p]);g.useEffect(()=>{e||F(oRe)},[!!e]);const q=g.useCallback((te,$)=>{let le,de;L(te),n?(le=te,de=te.map(he=>E.current.get(he))):(le=[],de=[],te.forEach(he=>{const me=v(he);me!==void 0&&(le.push(he),de.push(me))})),F(le),a==null||a(le,de,{type:$})},[F,v,a,n]),ae=g.useCallback((te,$,le,de)=>{if(l){const he=le.map(me=>v(me));l(v(te),$,he,de)}q(le,"single")},[l,v,q]),Z=g.useMemo(()=>!m||x?null:(m===!0?[Qhe,Zhe,epe]:m).map($=>$===Qhe?{key:"all",text:M.selectionAll,onSelect(){q(A.map((le,de)=>b(le,de)).filter(le=>{const de=O.get(le);return!(de!=null&&de.disabled)||oe.has(le)}),"all")}}:$===Zhe?{key:"invert",text:M.selectInvert,onSelect(){const le=new Set(oe);S.forEach((he,me)=>{const ce=b(he,me),Pe=O.get(ce);Pe!=null&&Pe.disabled||(le.has(ce)?le.delete(ce):le.add(ce))});const de=Array.from(le);c&&(k.deprecated(!1,"onSelectInvert","onChange"),c(de)),q(de,"invert")}}:$===epe?{key:"none",text:M.selectNone,onSelect(){u==null||u(),q(Array.from(oe).filter(le=>{const de=O.get(le);return de==null?void 0:de.disabled}),"none")}}:$).map($=>Object.assign(Object.assign({},$),{onSelect:function(){for(var le,de,he=arguments.length,me=new Array(he),ce=0;ce{var $;if(!e)return te.filter(Te=>Te!==zw);let le=Pa(te);const de=new Set(oe),he=j.map(b).filter(Te=>!O.get(Te).disabled),me=he.every(Te=>de.has(Te)),ce=he.some(Te=>de.has(Te)),Pe=()=>{const Te=[];me?he.forEach(Ne=>{de.delete(Ne),Te.push(Ne)}):he.forEach(Ne=>{de.has(Ne)||(de.add(Ne),Te.push(Ne))});const Re=Array.from(de);s==null||s(!me,Re.map(Ne=>v(Ne)),Te.map(Ne=>v(Ne))),q(Re,"all"),U(null)};let pe,Ie;if(p!=="radio"){let Te;if(Z){const qe={getPopupContainer:D,items:Z.map((Fe,He)=>{const{key:Le,text:Ye,onSelect:lt}=Fe;return{key:Le??He,onClick:()=>{lt==null||lt(he)},label:Ye}})};Te=g.createElement("div",{className:`${P}-selection-extra`},g.createElement(e4,{menu:qe,getPopupContainer:D},g.createElement("span",null,g.createElement(RZ,null))))}const Re=j.map((qe,Fe)=>{const He=b(qe,Fe),Le=O.get(He)||{};return Object.assign({checked:de.has(He)},Le)}).filter(qe=>{let{disabled:Fe}=qe;return Fe}),Ne=!!Re.length&&Re.length===j.length,_e=Ne&&Re.every(qe=>{let{checked:Fe}=qe;return Fe}),Ue=Ne&&Re.some(qe=>{let{checked:Fe}=qe;return Fe});Ie=g.createElement(Li,{checked:Ne?_e:!!j.length&&me,indeterminate:Ne?!_e&&Ue:!me&&ce,onChange:Pe,disabled:j.length===0||Ne,"aria-label":Te?"Custom selection":"Select all",skipGroup:!0}),pe=!x&&g.createElement("div",{className:`${P}-selection`},Ie,Te)}let ve;p==="radio"?ve=(Te,Re,Ne)=>{const _e=b(Re,Ne),Ue=de.has(_e),qe=O.get(_e);return{node:g.createElement(We,Object.assign({},qe,{checked:Ue,onClick:Fe=>{var He;Fe.stopPropagation(),(He=qe==null?void 0:qe.onClick)===null||He===void 0||He.call(qe,Fe)},onChange:Fe=>{var He;de.has(_e)||ae(_e,!0,[_e],Fe.nativeEvent),(He=qe==null?void 0:qe.onChange)===null||He===void 0||He.call(qe,Fe)}})),checked:Ue}}:ve=(Te,Re,Ne)=>{var _e;const Ue=b(Re,Ne),qe=de.has(Ue),Fe=ee.has(Ue),He=O.get(Ue);let Le;return T==="nest"?Le=Fe:Le=(_e=He==null?void 0:He.indeterminate)!==null&&_e!==void 0?_e:Fe,{node:g.createElement(Li,Object.assign({},He,{indeterminate:Le,checked:qe,skipGroup:!0,onClick:Ye=>{var lt;Ye.stopPropagation(),(lt=He==null?void 0:He.onClick)===null||lt===void 0||lt.call(He,Ye)},onChange:Ye=>{var lt;const{nativeEvent:Oe}=Ye,{shiftKey:ut}=Oe,ht=he.findIndex(nt=>nt===Ue),Qe=G.some(nt=>he.includes(nt));if(ut&&C&&Qe){const nt=N(ht,he,de),mt=Array.from(de);d==null||d(!qe,mt.map(tt=>v(tt)),nt.map(tt=>v(tt))),q(mt,"multiple")}else{const nt=G;if(C){const mt=qe?k9(nt,Ue):rA(nt,Ue);ae(Ue,!qe,mt,Oe)}else{const mt=kR([].concat(Pa(nt),[Ue]),!0,Y,_),{checkedKeys:tt,halfCheckedKeys:gt}=mt;let Ve=tt;if(qe){const je=new Set(tt);je.delete(Ue),Ve=kR(Array.from(je),{halfCheckedKeys:gt},Y,_).checkedKeys}ae(Ue,!qe,Ve,Oe)}}U(qe?null:ht),(lt=He==null?void 0:He.onChange)===null||lt===void 0||lt.call(He,Ye)}})),checked:qe}};const ze=(Te,Re,Ne)=>{const{node:_e,checked:Ue}=ve(Te,Re,Ne);return w?w(Ue,Re,Ne,_e):_e};if(!le.includes(zw))if(le.findIndex(Te=>{var Re;return((Re=Te[Vk])===null||Re===void 0?void 0:Re.columnType)==="EXPAND_COLUMN"})===0){const[Te,...Re]=le;le=[Te,zw].concat(Pa(Re))}else le=[zw].concat(Pa(le));const Ae=le.indexOf(zw);le=le.filter((Te,Re)=>Te!==zw||Re===Ae);const se=le[Ae-1],ge=le[Ae+1];let we=y;we===void 0&&((ge==null?void 0:ge.fixed)!==void 0?we=ge.fixed:(se==null?void 0:se.fixed)!==void 0&&(we=se.fixed)),we&&se&&(($=se[Vk])===null||$===void 0?void 0:$.columnType)==="EXPAND_COLUMN"&&se.fixed===void 0&&(se.fixed=we);const Se=Mn(`${P}-selection-col`,{[`${P}-selection-col-with-dropdown`]:m&&p==="checkbox"}),Me=()=>e!=null&&e.columnTitle?typeof e.columnTitle=="function"?e.columnTitle(Ie):e.columnTitle:pe,Ce={fixed:we,width:f,className:`${P}-selection-column`,title:Me(),render:ze,onCell:e.onCell,[Vk]:{className:Se}};return le.map(Te=>Te===zw?Ce:Te)},[b,j,e,G,oe,ee,f,Z,T,O,d,ae,_]),oe]};function Won(t,e){return t._antProxy=t._antProxy||{},Object.keys(e).forEach(n=>{if(!(n in t._antProxy)){const o=t[n];t._antProxy[n]=o,t[n]=e[n]}}),t}function Non(t,e){return g.useImperativeHandle(t,()=>{const n=e(),{nativeElement:o}=n;return typeof Proxy<"u"?new Proxy(o,{get(r,i){return n[i]?n[i]:Reflect.get(r,i)}}):Won(o,n)})}function Uon(t){return e=>{const{prefixCls:n,onExpand:o,record:r,expanded:i,expandable:a}=e,l=`${n}-row-expand-icon`;return g.createElement("button",{type:"button",onClick:s=>{o(r,s),s.stopPropagation()},className:Mn(l,{[`${l}-spaced`]:!a,[`${l}-expanded`]:a&&i,[`${l}-collapsed`]:a&&!i}),"aria-label":i?t.collapse:t.expand,"aria-expanded":i})}}function jon(t){return(n,o)=>{const r=n.querySelector(`.${t}-container`);let i=o;if(r){const a=getComputedStyle(r),l=parseInt(a.borderLeftWidth,10),s=parseInt(a.borderRightWidth,10);i=o-l-s}return i}}const l7=(t,e)=>"key"in t&&t.key!==void 0&&t.key!==null?t.key:t.dataIndex?Array.isArray(t.dataIndex)?t.dataIndex.join("."):t.dataIndex:e;function uI(t,e){return e?`${e}-${t}`:`${t}`}const Bee=(t,e)=>typeof t=="function"?t(e):t,Bon=(t,e)=>{const n=Bee(t,e);return Object.prototype.toString.call(n)==="[object Object]"?"":n};function Yon(t){const e=g.useRef(t),n=mQe();return[()=>e.current,o=>{e.current=o,n()}]}var Oon=function(e){var n=e.dropPosition,o=e.dropLevelOffset,r=e.indent,i={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(n){case-1:i.top=0,i.left=-o*r;break;case 1:i.bottom=0,i.left=-o*r;break;case 0:i.bottom=0,i.left=r;break}return xe.createElement("div",{style:i})};function tnt(t){if(t==null)throw new TypeError("Cannot destructure "+t)}function _on(t,e){var n=g.useState(!1),o=Sn(n,2),r=o[0],i=o[1];Ml(function(){if(r)return t(),function(){e()}},[r]),Ml(function(){return i(!0),function(){i(!1)}},[])}var Von=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],Gon=g.forwardRef(function(t,e){var n=t.className,o=t.style,r=t.motion,i=t.motionNodes,a=t.motionType,l=t.onMotionStart,s=t.onMotionEnd,c=t.active,u=t.treeNodeRequiredProps,d=Ai(t,Von),f=g.useState(!0),p=Sn(f,2),m=p[0],y=p[1],w=g.useContext(x3e),x=w.prefixCls,C=i&&a!=="hide";Ml(function(){i&&C!==m&&y(C)},[i]);var P=function(){i&&l()},A=g.useRef(!1),S=function(){i&&!A.current&&(A.current=!0,s())};_on(P,S);var v=function(T){C===T&&S()};return i?g.createElement(Oy,Uo({ref:e,visible:m},r,{motionAppear:a==="show",onVisibleChanged:v}),function(b,T){var R=b.className,M=b.style;return g.createElement("div",{ref:T,className:Bn("".concat(x,"-treenode-motion"),R),style:M},i.map(function(D){var k=Object.assign({},(tnt(D.data),D.data)),N=D.title,U=D.key,W=D.isStart,F=D.isEnd;delete k.children;var E=_k(U,u);return g.createElement(jL,Uo({},k,E,{title:N,active:c,data:D.data,key:U,isStart:W,isEnd:F}))}))}):g.createElement(jL,Uo({domRef:e,className:n,style:o},d,{active:c}))});function Xon(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=t.length,o=e.length;if(Math.abs(n-o)!==1)return{add:!1,key:null};function r(i,a){var l=new Map;i.forEach(function(c){l.set(c,!0)});var s=a.filter(function(c){return!l.has(c)});return s.length===1?s[0]:null}return n ").concat(e);return e}var qon=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.data;t.selectable,t.checkable;var r=t.expandedKeys,i=t.selectedKeys,a=t.checkedKeys,l=t.loadedKeys,s=t.loadingKeys,c=t.halfCheckedKeys,u=t.keyEntities,d=t.disabled,f=t.dragging,p=t.dragOverNodeKey,m=t.dropPosition,y=t.motion,w=t.height,x=t.itemHeight,C=t.virtual,P=t.scrollWidth,A=t.focusable,S=t.activeItem,v=t.focused,b=t.tabIndex,T=t.onKeyDown,R=t.onFocus,M=t.onBlur,D=t.onActiveChange,k=t.onListChangeStart,N=t.onListChangeEnd,U=Ai(t,Jon),W=g.useRef(null),F=g.useRef(null);g.useImperativeHandle(e,function(){return{scrollTo:function(ze){W.current.scrollTo(ze)},getIndentWidth:function(){return F.current.offsetWidth}}});var E=g.useState(r),L=Sn(E,2),j=L[0],Y=L[1],O=g.useState(o),_=Sn(O,2),G=_[0],Q=_[1],oe=g.useState(o),ee=Sn(oe,2),q=ee[0],ae=ee[1],Z=g.useState([]),ne=Sn(Z,2),te=ne[0],$=ne[1],le=g.useState(null),de=Sn(le,2),he=de[0],me=de[1],ce=g.useRef(o);ce.current=o;function Pe(){var ve=ce.current;Q(ve),ae(ve),$([]),me(null),N()}Ml(function(){Y(r);var ve=Xon(j,r);if(ve.key!==null)if(ve.add){var ze=G.findIndex(function(Me){var Ce=Me.key;return Ce===ve.key}),Ae=lRe(rRe(G,o,ve.key),C,w,x),se=G.slice();se.splice(ze+1,0,aRe),ae(se),$(Ae),me("show")}else{var ge=o.findIndex(function(Me){var Ce=Me.key;return Ce===ve.key}),we=lRe(rRe(o,G,ve.key),C,w,x),Se=o.slice();Se.splice(ge+1,0,aRe),ae(Se),$(we),me("hide")}else G!==o&&(Q(o),ae(o))},[r,o]),g.useEffect(function(){f||Pe()},[f]);var pe=y?q:o,Ie={expandedKeys:r,selectedKeys:i,loadedKeys:l,loadingKeys:s,checkedKeys:a,halfCheckedKeys:c,dragOverNodeKey:p,dropPosition:m,keyEntities:u};return g.createElement(g.Fragment,null,v&&S&&g.createElement("span",{style:iRe,"aria-live":"assertive"},$on(S)),g.createElement("div",null,g.createElement("input",{style:iRe,disabled:A===!1||d,tabIndex:A!==!1?b:null,onKeyDown:T,onFocus:R,onBlur:M,value:"",onChange:Kon,"aria-label":"for screen reader"})),g.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},g.createElement("div",{className:"".concat(n,"-indent")},g.createElement("div",{ref:F,className:"".concat(n,"-indent-unit")}))),g.createElement(g9e,Uo({},U,{data:pe,itemKey:sRe,height:w,fullHeight:!1,virtual:C,itemHeight:x,scrollWidth:P,prefixCls:"".concat(n,"-list"),ref:W,role:"tree",onVisibleChange:function(ze){ze.every(function(Ae){return sRe(Ae)!==Qb})&&Pe()}}),function(ve){var ze=ve.pos,Ae=Object.assign({},(tnt(ve.data),ve.data)),se=ve.title,ge=ve.key,we=ve.isStart,Se=ve.isEnd,Me=bU(ge,ze);delete Ae.key,delete Ae.children;var Ce=_k(Me,Ie);return g.createElement(Gon,Uo({},Ae,Ce,{title:se,active:!!S&&ge===S.key,pos:ze,data:ve.data,isStart:we,isEnd:Se,motion:y,motionNodes:ge===Qb?te:null,motionType:he,onMotionStart:k,onMotionEnd:Pe,treeNodeRequiredProps:Ie,onMouseMove:function(){D(null)}}))}))}),Qon=10,b3e=function(t){XM(n,t);var e=JM(n);function n(){var o;Uh(this,n);for(var r=arguments.length,i=new Array(r),a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,d=o.state,f=d.dragChildrenKeys,p=d.dropPosition,m=d.dropTargetKey,y=d.dropTargetPos,w=d.dropAllowed;if(w){var x=o.props.onDrop;if(o.setState({dragOverNodeKey:null}),o.cleanDragState(),m!==null){var C=nn(nn({},_k(m,o.getTreeNodeRequiredProps())),{},{active:((c=o.getActiveItem())===null||c===void 0?void 0:c.key)===m,data:m1(o.state.keyEntities,m).node}),P=f.includes(m);Ds(!P,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var A=v3e(y),S={event:l,node:g0(C),dragNode:o.dragNodeProps?g0(o.dragNodeProps):null,dragNodesKeys:[o.dragNodeProps.eventKey].concat(f),dropToGap:p!==0,dropPosition:p+Number(A[A.length-1])};u||x==null||x(S),o.dragNodeProps=null}}}),Ut(kr(o),"cleanDragState",function(){var l=o.state.draggingNodeKey;l!==null&&o.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),o.dragStartMousePosition=null,o.currentMouseOverDroppableNodeKey=null}),Ut(kr(o),"triggerExpandActionExpand",function(l,s){var c=o.state,u=c.expandedKeys,d=c.flattenNodes,f=s.expanded,p=s.key,m=s.isLeaf;if(!(m||l.shiftKey||l.metaKey||l.ctrlKey)){var y=d.filter(function(x){return x.key===p})[0],w=g0(nn(nn({},_k(p,o.getTreeNodeRequiredProps())),{},{data:y.data}));o.setExpandedKeys(f?k9(u,p):rA(u,p)),o.onNodeExpand(l,w)}}),Ut(kr(o),"onNodeClick",function(l,s){var c=o.props,u=c.onClick,d=c.expandAction;d==="click"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Ut(kr(o),"onNodeDoubleClick",function(l,s){var c=o.props,u=c.onDoubleClick,d=c.expandAction;d==="doubleClick"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Ut(kr(o),"onNodeSelect",function(l,s){var c=o.state.selectedKeys,u=o.state,d=u.keyEntities,f=u.fieldNames,p=o.props,m=p.onSelect,y=p.multiple,w=s.selected,x=s[f.key],C=!w;C?y?c=rA(c,x):c=[x]:c=k9(c,x);var P=c.map(function(A){var S=m1(d,A);return S?S.node:null}).filter(Boolean);o.setUncontrolledState({selectedKeys:c}),m==null||m(c,{event:"select",selected:C,node:s,selectedNodes:P,nativeEvent:l.nativeEvent})}),Ut(kr(o),"onNodeCheck",function(l,s,c){var u=o.state,d=u.keyEntities,f=u.checkedKeys,p=u.halfCheckedKeys,m=o.props,y=m.checkStrictly,w=m.onCheck,x=s.key,C,P={event:"check",node:s,checked:c,nativeEvent:l.nativeEvent};if(y){var A=c?rA(f,x):k9(f,x),S=k9(p,x);C={checked:A,halfChecked:S},P.checkedNodes=A.map(function(D){return m1(d,D)}).filter(Boolean).map(function(D){return D.node}),o.setUncontrolledState({checkedKeys:A})}else{var v=kR([].concat($o(f),[x]),!0,d),b=v.checkedKeys,T=v.halfCheckedKeys;if(!c){var R=new Set(b);R.delete(x);var M=kR(Array.from(R),{halfCheckedKeys:T},d);b=M.checkedKeys,T=M.halfCheckedKeys}C=b,P.checkedNodes=[],P.checkedNodesPositions=[],P.halfCheckedKeys=T,b.forEach(function(D){var k=m1(d,D);if(k){var N=k.node,U=k.pos;P.checkedNodes.push(N),P.checkedNodesPositions.push({node:N,pos:U})}}),o.setUncontrolledState({checkedKeys:b},!1,{halfCheckedKeys:T})}w==null||w(C,P)}),Ut(kr(o),"onNodeLoad",function(l){var s,c=l.key,u=o.state.keyEntities,d=m1(u,c);if(!(d!=null&&(s=d.children)!==null&&s!==void 0&&s.length)){var f=new Promise(function(p,m){o.setState(function(y){var w=y.loadedKeys,x=w===void 0?[]:w,C=y.loadingKeys,P=C===void 0?[]:C,A=o.props,S=A.loadData,v=A.onLoad;if(!S||x.includes(c)||P.includes(c))return null;var b=S(l);return b.then(function(){var T=o.state.loadedKeys,R=rA(T,c);v==null||v(R,{event:"load",node:l}),o.setUncontrolledState({loadedKeys:R}),o.setState(function(M){return{loadingKeys:k9(M.loadingKeys,c)}}),p()}).catch(function(T){if(o.setState(function(M){return{loadingKeys:k9(M.loadingKeys,c)}}),o.loadingRetryTimes[c]=(o.loadingRetryTimes[c]||0)+1,o.loadingRetryTimes[c]>=Qon){var R=o.state.loadedKeys;Ds(!1,"Retry for `loadData` many times but still failed. No more retry."),o.setUncontrolledState({loadedKeys:rA(R,c)}),p()}m(T)}),{loadingKeys:rA(P,c)}})});return f.catch(function(){}),f}}),Ut(kr(o),"onNodeMouseEnter",function(l,s){var c=o.props.onMouseEnter;c==null||c({event:l,node:s})}),Ut(kr(o),"onNodeMouseLeave",function(l,s){var c=o.props.onMouseLeave;c==null||c({event:l,node:s})}),Ut(kr(o),"onNodeContextMenu",function(l,s){var c=o.props.onRightClick;c&&(l.preventDefault(),c({event:l,node:s}))}),Ut(kr(o),"onFocus",function(){var l=o.props.onFocus;o.setState({focused:!0});for(var s=arguments.length,c=new Array(s),u=0;u1&&arguments[1]!==void 0?arguments[1]:!1,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!o.destroyed){var u=!1,d=!0,f={};Object.keys(l).forEach(function(p){if(o.props.hasOwnProperty(p)){d=!1;return}u=!0,f[p]=l[p]}),u&&(!s||d)&&o.setState(nn(nn({},f),c))}}),Ut(kr(o),"scrollTo",function(l){o.listRef.current.scrollTo(l)}),o}return jh(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var r=this.props,i=r.activeKey,a=r.itemScrollOffset,l=a===void 0?0:a;i!==void 0&&i!==this.state.activeKey&&(this.setState({activeKey:i}),i!==null&&this.scrollTo({key:i,offset:l}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var r=this.state,i=r.focused,a=r.flattenNodes,l=r.keyEntities,s=r.draggingNodeKey,c=r.activeKey,u=r.dropLevelOffset,d=r.dropContainerKey,f=r.dropTargetKey,p=r.dropPosition,m=r.dragOverNodeKey,y=r.indent,w=this.props,x=w.prefixCls,C=w.className,P=w.style,A=w.showLine,S=w.focusable,v=w.tabIndex,b=v===void 0?0:v,T=w.selectable,R=w.showIcon,M=w.icon,D=w.switcherIcon,k=w.draggable,N=w.checkable,U=w.checkStrictly,W=w.disabled,F=w.motion,E=w.loadData,L=w.filterTreeNode,j=w.height,Y=w.itemHeight,O=w.scrollWidth,_=w.virtual,G=w.titleRender,Q=w.dropIndicatorRender,oe=w.onContextMenu,ee=w.onScroll,q=w.direction,ae=w.rootClassName,Z=w.rootStyle,ne=F1(this.props,{aria:!0,data:!0}),te;k&&(Vr(k)==="object"?te=k:typeof k=="function"?te={nodeDraggable:k}:te={});var $={prefixCls:x,selectable:T,showIcon:R,icon:M,switcherIcon:D,draggable:te,draggingNodeKey:s,checkable:N,checkStrictly:U,disabled:W,keyEntities:l,dropLevelOffset:u,dropContainerKey:d,dropTargetKey:f,dropPosition:p,dragOverNodeKey:m,indent:y,direction:q,dropIndicatorRender:Q,loadData:E,filterTreeNode:L,titleRender:G,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return g.createElement(x3e.Provider,{value:$},g.createElement("div",{className:Bn(x,C,ae,Ut(Ut(Ut({},"".concat(x,"-show-line"),A),"".concat(x,"-focused"),i),"".concat(x,"-active-focused"),c!==null)),style:Z},g.createElement(qon,Uo({ref:this.listRef,prefixCls:x,style:P,data:a,disabled:W,selectable:T,checkable:!!N,motion:F,dragging:s!==null,height:j,itemHeight:Y,virtual:_,focusable:S,focused:i,tabIndex:b,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:oe,onScroll:ee,scrollWidth:O},this.getTreeNodeRequiredProps(),ne))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){var a=i.prevProps,l={prevProps:r};function s(b){return!a&&r.hasOwnProperty(b)||a&&a[b]!==r[b]}var c,u=i.fieldNames;if(s("fieldNames")&&(u=TH(r.fieldNames),l.fieldNames=u),s("treeData")?c=r.treeData:s("children")&&(Ds(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),c=det(r.children)),c){l.treeData=c;var d=$9e(c,{fieldNames:u});l.keyEntities=nn(Ut({},Qb,nnt),d.keyEntities)}var f=l.keyEntities||i.keyEntities;if(s("expandedKeys")||a&&s("autoExpandParent"))l.expandedKeys=r.autoExpandParent||!a&&r.defaultExpandParent?qhe(r.expandedKeys,f):r.expandedKeys;else if(!a&&r.defaultExpandAll){var p=nn({},f);delete p[Qb];var m=[];Object.keys(p).forEach(function(b){var T=p[b];T.children&&T.children.length&&m.push(T.key)}),l.expandedKeys=m}else!a&&r.defaultExpandedKeys&&(l.expandedKeys=r.autoExpandParent||r.defaultExpandParent?qhe(r.defaultExpandedKeys,f):r.defaultExpandedKeys);if(l.expandedKeys||delete l.expandedKeys,c||l.expandedKeys){var y=Zle(c||i.treeData,l.expandedKeys||i.expandedKeys,u);l.flattenNodes=y}if(r.selectable&&(s("selectedKeys")?l.selectedKeys=nRe(r.selectedKeys,r):!a&&r.defaultSelectedKeys&&(l.selectedKeys=nRe(r.defaultSelectedKeys,r))),r.checkable){var w;if(s("checkedKeys")?w=sse(r.checkedKeys)||{}:!a&&r.defaultCheckedKeys?w=sse(r.defaultCheckedKeys)||{}:c&&(w=sse(r.checkedKeys)||{checkedKeys:i.checkedKeys,halfCheckedKeys:i.halfCheckedKeys}),w){var x=w,C=x.checkedKeys,P=C===void 0?[]:C,A=x.halfCheckedKeys,S=A===void 0?[]:A;if(!r.checkStrictly){var v=kR(P,!0,f);P=v.checkedKeys,S=v.halfCheckedKeys}l.checkedKeys=P,l.halfCheckedKeys=S}}return s("loadedKeys")&&(l.loadedKeys=r.loadedKeys),l}}]),n}(g.Component);Ut(b3e,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:Oon,allowDrop:function(){return!0},expandAction:!1});Ut(b3e,"TreeNode",jL);const Zon=t=>{let{treeCls:e,treeNodeCls:n,directoryNodeSelectedBg:o,directoryNodeSelectedColor:r,motionDurationMid:i,borderRadius:a,controlItemBgHover:l}=t;return{[`${e}${e}-directory ${n}`]:{[`${e}-node-content-wrapper`]:{position:"static",[`> *:not(${e}-drop-indicator)`]:{position:"relative"},"&:hover":{background:"transparent"},"&:before":{position:"absolute",inset:0,transition:`background-color ${i}`,content:'""',borderRadius:a},"&:hover:before":{background:l}},[`${e}-switcher, ${e}-checkbox, ${e}-draggable-icon`]:{zIndex:1},"&-selected":{[`${e}-switcher, ${e}-draggable-icon`]:{color:r},[`${e}-node-content-wrapper`]:{color:r,background:"transparent","&:before, &:hover:before":{background:o}}}}}},ern=new xa("ant-tree-node-fx-do-not-use",{"0%":{opacity:0},"100%":{opacity:1}}),trn=(t,e)=>({[`.${t}-switcher-icon`]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:`transform ${e.motionDurationSlow}`}}}),nrn=(t,e)=>({[`.${t}-drop-indicator`]:{position:"absolute",zIndex:1,height:2,backgroundColor:e.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:`${jt(e.lineWidthBold)} solid ${e.colorPrimary}`,borderRadius:"50%",content:'""'}}}),orn=(t,e)=>{const{treeCls:n,treeNodeCls:o,treeNodePadding:r,titleHeight:i,indentSize:a,nodeSelectedBg:l,nodeHoverBg:s,colorTextQuaternary:c,controlItemBgActiveDisabled:u}=e;return{[n]:Object.assign(Object.assign({},Ua(e)),{background:e.colorBgContainer,borderRadius:e.borderRadius,transition:`background-color ${e.motionDurationSlow}`,"&-rtl":{direction:"rtl"},[`&${n}-rtl ${n}-switcher_close ${n}-switcher-icon svg`]:{transform:"rotate(90deg)"},[`&-focused:not(:hover):not(${n}-active-focused)`]:Object.assign({},z3(e)),[`${n}-list-holder-inner`]:{alignItems:"flex-start"},[`&${n}-block-node`]:{[`${n}-list-holder-inner`]:{alignItems:"stretch",[`${n}-node-content-wrapper`]:{flex:"auto"},[`${o}.dragging:after`]:{position:"absolute",inset:0,border:`1px solid ${e.colorPrimary}`,opacity:0,animationName:ern,animationDuration:e.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none",borderRadius:e.borderRadius}}},[o]:{display:"flex",alignItems:"flex-start",marginBottom:r,lineHeight:jt(i),position:"relative","&:before":{content:'""',position:"absolute",zIndex:1,insetInlineStart:0,width:"100%",top:"100%",height:r},[`&-disabled ${n}-node-content-wrapper`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}},[`${n}-checkbox-disabled + ${n}-node-selected,&${o}-disabled${o}-selected ${n}-node-content-wrapper`]:{backgroundColor:u},[`${n}-checkbox-disabled`]:{pointerEvents:"unset"},[`&:not(${o}-disabled)`]:{[`${n}-node-content-wrapper`]:{"&:hover":{color:e.nodeHoverColor}}},[`&-active ${n}-node-content-wrapper`]:{background:e.controlItemBgHover},[`&:not(${o}-disabled).filter-node ${n}-title`]:{color:e.colorPrimary,fontWeight:500},"&-draggable":{cursor:"grab",[`${n}-draggable-icon`]:{flexShrink:0,width:i,textAlign:"center",visibility:"visible",color:c},[`&${o}-disabled ${n}-draggable-icon`]:{visibility:"hidden"}}},[`${n}-indent`]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:a}},[`${n}-draggable-icon`]:{visibility:"hidden"},[`${n}-switcher, ${n}-checkbox`]:{marginInlineEnd:e.calc(e.calc(i).sub(e.controlInteractiveSize)).div(2).equal()},[`${n}-switcher`]:Object.assign(Object.assign({},trn(t,e)),{position:"relative",flex:"none",alignSelf:"stretch",width:i,textAlign:"center",cursor:"pointer",userSelect:"none",transition:`all ${e.motionDurationSlow}`,"&-noop":{cursor:"unset"},"&:before":{pointerEvents:"none",content:'""',width:i,height:i,position:"absolute",left:{_skip_check_:!0,value:0},top:0,borderRadius:e.borderRadius,transition:`all ${e.motionDurationSlow}`},[`&:not(${n}-switcher-noop):hover:before`]:{backgroundColor:e.colorBgTextHover},[`&_close ${n}-switcher-icon svg`]:{transform:"rotate(-90deg)"},"&-loading-icon":{color:e.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),marginInlineStart:-1,borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&:after":{position:"absolute",width:e.calc(e.calc(i).div(2).equal()).mul(.8).equal(),height:e.calc(i).div(2).equal(),borderBottom:`1px solid ${e.colorBorder}`,content:'""'}}}),[`${n}-node-content-wrapper`]:Object.assign(Object.assign({position:"relative",minHeight:i,paddingBlock:0,paddingInline:e.paddingXS,background:"transparent",borderRadius:e.borderRadius,cursor:"pointer",transition:`all ${e.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`},nrn(t,e)),{"&:hover":{backgroundColor:s},[`&${n}-node-selected`]:{color:e.nodeSelectedColor,backgroundColor:l},[`${n}-iconEle`]:{display:"inline-block",width:i,height:i,textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}}),[`${n}-unselectable ${n}-node-content-wrapper:hover`]:{backgroundColor:"transparent"},[`${o}.drop-container > [draggable]`]:{boxShadow:`0 0 0 2px ${e.colorPrimary}`},"&-show-line":{[`${n}-indent-unit`]:{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&-end:before":{display:"none"}},[`${n}-switcher`]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},[`${o}-leaf-last ${n}-switcher-leaf-line:before`]:{top:"auto !important",bottom:"auto !important",height:`${jt(e.calc(i).div(2).equal())} !important`}})}},rrn=(t,e)=>{const n=`.${t}`,o=`${n}-treenode`,r=e.calc(e.paddingXS).div(2).equal(),i=Ui(e,{treeCls:n,treeNodeCls:o,treeNodePadding:r});return[orn(t,i),Zon(i)]},irn=t=>{const{controlHeightSM:e,controlItemBgHover:n,controlItemBgActive:o}=t,r=e;return{titleHeight:r,indentSize:r,nodeHoverBg:n,nodeHoverColor:t.colorText,nodeSelectedBg:o,nodeSelectedColor:t.colorText}},arn=t=>{const{colorTextLightSolid:e,colorPrimary:n}=t;return Object.assign(Object.assign({},irn(t)),{directoryNodeSelectedColor:e,directoryNodeSelectedBg:n})},lrn=el("Tree",(t,e)=>{let{prefixCls:n}=e;return[{[t.componentCls]:het(`${n}-checkbox`,t)},rrn(n,t),o9e(t)]},arn),cRe=4;function srn(t){const{dropPosition:e,dropLevelOffset:n,prefixCls:o,indent:r,direction:i="ltr"}=t,a=i==="ltr"?"left":"right",l=i==="ltr"?"right":"left",s={[a]:-n*r+cRe,[l]:0};switch(e){case-1:s.top=-3;break;case 1:s.bottom=-3;break;default:s.bottom=-3,s[a]=r+cRe;break}return xe.createElement("div",{style:s,className:`${o}-drop-indicator`})}const crn=t=>{const{prefixCls:e,switcherIcon:n,treeNodeProps:o,showLine:r,switcherLoadingIcon:i}=t,{isLeaf:a,expanded:l,loading:s}=o;if(s)return g.isValidElement(i)?i:g.createElement(qM,{className:`${e}-switcher-loading-icon`});let c;if(r&&typeof r=="object"&&(c=r.showLeafIcon),a){if(!r)return null;if(typeof c!="boolean"&&c){const f=typeof c=="function"?c(o):c,p=`${e}-switcher-line-custom-icon`;return g.isValidElement(f)?P0(f,{className:Mn(f.props.className||"",p)}):f}return c?g.createElement(ptt,{className:`${e}-switcher-line-icon`}):g.createElement("span",{className:`${e}-switcher-leaf-line`})}const u=`${e}-switcher-icon`,d=typeof n=="function"?n(o):n;return g.isValidElement(d)?P0(d,{className:Mn(d.props.className||"",u)}):d!==void 0?d:r?l?g.createElement(zen,{className:`${e}-switcher-line-icon`}):g.createElement(Wen,{className:`${e}-switcher-line-icon`}):g.createElement(vZt,{className:u})},ont=xe.forwardRef((t,e)=>{var n;const{getPrefixCls:o,direction:r,virtual:i,tree:a}=xe.useContext(gr),{prefixCls:l,className:s,showIcon:c=!1,showLine:u,switcherIcon:d,switcherLoadingIcon:f,blockNode:p=!1,children:m,checkable:y=!1,selectable:w=!0,draggable:x,motion:C,style:P}=t,A=o("tree",l),S=o(),v=C??Object.assign(Object.assign({},t9e(S)),{motionAppear:!1}),b=Object.assign(Object.assign({},t),{checkable:y,selectable:w,showIcon:c,motion:v,blockNode:p,showLine:!!u,dropIndicatorRender:srn}),[T,R,M]=lrn(A),[,D]=Ff(),k=D.paddingXS/2+(((n=D.Tree)===null||n===void 0?void 0:n.titleHeight)||D.controlHeightSM),N=xe.useMemo(()=>{if(!x)return!1;let W={};switch(typeof x){case"function":W.nodeDraggable=x;break;case"object":W=Object.assign({},x);break}return W.icon!==!1&&(W.icon=W.icon||xe.createElement(wen,null)),W},[x]),U=W=>xe.createElement(crn,{prefixCls:A,switcherIcon:d,switcherLoadingIcon:f,treeNodeProps:W,showLine:u});return T(xe.createElement(b3e,Object.assign({itemHeight:k,ref:e,virtual:i},b,{style:Object.assign(Object.assign({},a==null?void 0:a.style),P),prefixCls:A,className:Mn({[`${A}-icon-hide`]:!c,[`${A}-block-node`]:p,[`${A}-unselectable`]:!w,[`${A}-rtl`]:r==="rtl"},a==null?void 0:a.className,s,R,M),direction:r,checkable:y&&xe.createElement("span",{className:`${A}-checkbox-inner`}),selectable:w,switcherIcon:U,draggable:N}),m))}),uRe=0,cse=1,dRe=2;function S3e(t,e,n){const{key:o,children:r}=n;function i(a){const l=a[o],s=a[r];e(l,a)!==!1&&S3e(s||[],e,n)}t.forEach(i)}function urn(t){let{treeData:e,expandedKeys:n,startKey:o,endKey:r,fieldNames:i}=t;const a=[];let l=uRe;if(o&&o===r)return[o];if(!o||!r)return[];function s(c){return c===o||c===r}return S3e(e,c=>{if(l===dRe)return!1;if(s(c)){if(a.push(c),l===uRe)l=cse;else if(l===cse)return l=dRe,!1}else l===cse&&a.push(c);return n.includes(c)},TH(i)),a}function use(t,e,n){const o=Pa(e),r=[];return S3e(t,(i,a)=>{const l=o.indexOf(i);return l!==-1&&(r.push(a),o.splice(l,1)),!!o.length},TH(n)),r}var fRe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{defaultExpandAll:n,defaultExpandParent:o,defaultExpandedKeys:r}=t,i=fRe(t,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);const a=g.useRef(null),l=g.useRef(null),s=()=>{const{keyEntities:T}=$9e(hRe(i));let R;return n?R=Object.keys(T):o?R=qhe(i.expandedKeys||r||[],T):R=i.expandedKeys||r||[],R},[c,u]=g.useState(i.selectedKeys||i.defaultSelectedKeys||[]),[d,f]=g.useState(()=>s());g.useEffect(()=>{"selectedKeys"in i&&u(i.selectedKeys)},[i.selectedKeys]),g.useEffect(()=>{"expandedKeys"in i&&f(i.expandedKeys)},[i.expandedKeys]);const p=(T,R)=>{var M;return"expandedKeys"in i||f(T),(M=i.onExpand)===null||M===void 0?void 0:M.call(i,T,R)},m=(T,R)=>{var M;const{multiple:D,fieldNames:k}=i,{node:N,nativeEvent:U}=R,{key:W=""}=N,F=hRe(i),E=Object.assign(Object.assign({},R),{selected:!0}),L=(U==null?void 0:U.ctrlKey)||(U==null?void 0:U.metaKey),j=U==null?void 0:U.shiftKey;let Y;D&&L?(Y=T,a.current=W,l.current=Y,E.selectedNodes=use(F,Y,k)):D&&j?(Y=Array.from(new Set([].concat(Pa(l.current||[]),Pa(urn({treeData:F,expandedKeys:d,startKey:W,endKey:a.current,fieldNames:k}))))),E.selectedNodes=use(F,Y,k)):(Y=[W],a.current=W,l.current=Y,E.selectedNodes=use(F,Y,k)),(M=i.onSelect)===null||M===void 0||M.call(i,Y,E),"selectedKeys"in i||u(Y)},{getPrefixCls:y,direction:w}=g.useContext(gr),{prefixCls:x,className:C,showIcon:P=!0,expandAction:A="click"}=i,S=fRe(i,["prefixCls","className","showIcon","expandAction"]),v=y("tree",x),b=Mn(`${v}-directory`,{[`${v}-directory-rtl`]:w==="rtl"},C);return g.createElement(ont,Object.assign({icon:drn,ref:e,blockNode:!0},S,{showIcon:P,expandAction:A,prefixCls:v,className:b,expandedKeys:d,selectedKeys:c,onSelect:m,onExpand:p}))},hrn=g.forwardRef(frn),Yee=ont;Yee.DirectoryTree=hrn;Yee.TreeNode=jL;const pRe=t=>{const{value:e,filterSearch:n,tablePrefixCls:o,locale:r,onChange:i}=t;return n?g.createElement("div",{className:`${o}-filter-dropdown-search`},g.createElement(Vl,{prefix:g.createElement(HZ,null),placeholder:r.filterSearchPlaceholder,onChange:i,value:e,htmlSize:1,className:`${o}-filter-dropdown-search-input`})):null},prn=t=>{const{keyCode:e}=t;e===IL.ENTER&&t.stopPropagation()},grn=g.forwardRef((t,e)=>g.createElement("div",{className:t.className,onClick:n=>n.stopPropagation(),onKeyDown:prn,ref:e},t.children));function FR(t){let e=[];return(t||[]).forEach(n=>{let{value:o,children:r}=n;e.push(o),r&&(e=[].concat(Pa(e),Pa(FR(r))))}),e}function mrn(t){return t.some(e=>{let{children:n}=e;return n})}function rnt(t,e){return typeof e=="string"||typeof e=="number"?e==null?void 0:e.toString().toLowerCase().includes(t.trim().toLowerCase()):!1}function int(t){let{filters:e,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a}=t;return e.map((l,s)=>{const c=String(l.value);if(l.children)return{key:c||s,label:l.text,popupClassName:`${n}-dropdown-submenu`,children:int({filters:l.children,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a})};const u=r?Li:We,d={key:l.value!==void 0?c:s,label:g.createElement(g.Fragment,null,g.createElement(u,{checked:o.includes(c)}),g.createElement("span",null,l.text))};return i.trim()?typeof a=="function"?a(i,l)?d:null:rnt(i,l.text)?d:null:d})}function dse(t){return t||[]}const yrn=t=>{var e,n,o,r;const{tablePrefixCls:i,prefixCls:a,column:l,dropdownPrefixCls:s,columnKey:c,filterOnClose:u,filterMultiple:d,filterMode:f="menu",filterSearch:p=!1,filterState:m,triggerFilter:y,locale:w,children:x,getPopupContainer:C,rootClassName:P}=t,{filterResetToDefaultFilteredValue:A,defaultFilteredValue:S,filterDropdownProps:v={},filterDropdownOpen:b,filterDropdownVisible:T,onFilterDropdownVisibleChange:R,onFilterDropdownOpenChange:M}=l,[D,k]=g.useState(!1),N=!!(m&&(!((e=m.filteredKeys)===null||e===void 0)&&e.length||m.forceFiltered)),U=ve=>{var ze;k(ve),(ze=v.onOpenChange)===null||ze===void 0||ze.call(v,ve),M==null||M(ve),R==null||R(ve)},W=(r=(o=(n=v.open)!==null&&n!==void 0?n:b)!==null&&o!==void 0?o:T)!==null&&r!==void 0?r:D,F=m==null?void 0:m.filteredKeys,[E,L]=Yon(dse(F)),j=ve=>{let{selectedKeys:ze}=ve;L(ze)},Y=(ve,ze)=>{let{node:Ae,checked:se}=ze;j(d?{selectedKeys:ve}:{selectedKeys:se&&Ae.key?[Ae.key]:[]})};g.useEffect(()=>{D&&j({selectedKeys:dse(F)})},[F]);const[O,_]=g.useState([]),G=ve=>{_(ve)},[Q,oe]=g.useState(""),ee=ve=>{const{value:ze}=ve.target;oe(ze)};g.useEffect(()=>{D||oe("")},[D]);const q=ve=>{const ze=ve!=null&&ve.length?ve:null;if(ze===null&&(!m||!m.filteredKeys)||Hfe(ze,m==null?void 0:m.filteredKeys,!0))return null;y({column:l,key:c,filteredKeys:ze})},ae=()=>{U(!1),q(E())},Z=function(){let{confirm:ve,closeDropdown:ze}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{confirm:!1,closeDropdown:!1};ve&&q([]),ze&&U(!1),oe(""),L(A?(S||[]).map(Ae=>String(Ae)):[])},ne=function(){let{closeDropdown:ve}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{closeDropdown:!0};ve&&U(!1),q(E())},te=(ve,ze)=>{ze.source==="trigger"&&(ve&&F!==void 0&&L(dse(F)),U(ve),!ve&&!l.filterDropdown&&u&&ae())},$=Mn({[`${s}-menu-without-submenu`]:!mrn(l.filters||[])}),le=ve=>{if(ve.target.checked){const ze=FR(l==null?void 0:l.filters).map(Ae=>String(Ae));L(ze)}else L([])},de=ve=>{let{filters:ze}=ve;return(ze||[]).map((Ae,se)=>{const ge=String(Ae.value),we={title:Ae.text,key:Ae.value!==void 0?ge:String(se)};return Ae.children&&(we.children=de({filters:Ae.children})),we})},he=ve=>{var ze;return Object.assign(Object.assign({},ve),{text:ve.title,value:ve.key,children:((ze=ve.children)===null||ze===void 0?void 0:ze.map(Ae=>he(Ae)))||[]})};let me;const{direction:ce,renderEmpty:Pe}=g.useContext(gr);if(typeof l.filterDropdown=="function")me=l.filterDropdown({prefixCls:`${s}-custom`,setSelectedKeys:ve=>j({selectedKeys:ve}),selectedKeys:E(),confirm:ne,clearFilters:Z,filters:l.filters,visible:W,close:()=>{U(!1)}});else if(l.filterDropdown)me=l.filterDropdown;else{const ve=E()||[],ze=()=>{var se;const ge=(se=Pe==null?void 0:Pe("Table.filter"))!==null&&se!==void 0?se:g.createElement(w1,{image:w1.PRESENTED_IMAGE_SIMPLE,description:w.filterEmptyText,styles:{image:{height:24}},style:{margin:0,padding:"16px 0"}});if((l.filters||[]).length===0)return ge;if(f==="tree")return g.createElement(g.Fragment,null,g.createElement(pRe,{filterSearch:p,value:Q,onChange:ee,tablePrefixCls:i,locale:w}),g.createElement("div",{className:`${i}-filter-dropdown-tree`},d?g.createElement(Li,{checked:ve.length===FR(l.filters).length,indeterminate:ve.length>0&&ve.lengthtypeof p=="function"?p(Q,he(Me)):rnt(Q,Me.title):void 0})));const we=int({filters:l.filters||[],filterSearch:p,prefixCls:a,filteredKeys:E(),filterMultiple:d,searchValue:Q}),Se=we.every(Me=>Me===null);return g.createElement(g.Fragment,null,g.createElement(pRe,{filterSearch:p,value:Q,onChange:ee,tablePrefixCls:i,locale:w}),Se?ge:g.createElement(rI,{selectable:!0,multiple:d,prefixCls:`${s}-menu`,className:$,onSelect:j,onDeselect:j,selectedKeys:ve,getPopupContainer:C,openKeys:O,onOpenChange:G,items:we}))},Ae=()=>A?Hfe((S||[]).map(se=>String(se)),ve,!0):ve.length===0;me=g.createElement(g.Fragment,null,ze(),g.createElement("div",{className:`${a}-dropdown-btns`},g.createElement(oo,{type:"link",size:"small",disabled:Ae(),onClick:()=>Z()},w.filterReset),g.createElement(oo,{type:"primary",size:"small",onClick:ae},w.filterConfirm)))}l.filterDropdown&&(me=g.createElement(tZe,{selectable:void 0},me)),me=g.createElement(grn,{className:`${a}-dropdown`},me);const Ie=a3e({trigger:["click"],placement:ce==="rtl"?"bottomLeft":"bottomRight",children:(()=>{let ve;return typeof l.filterIcon=="function"?ve=l.filterIcon(N):l.filterIcon?ve=l.filterIcon:ve=g.createElement(den,null),g.createElement("span",{role:"button",tabIndex:-1,className:Mn(`${a}-trigger`,{active:N}),onClick:ze=>{ze.stopPropagation()}},ve)})(),getPopupContainer:C},Object.assign(Object.assign({},v),{rootClassName:Mn(P,v.rootClassName),open:W,onOpenChange:te,dropdownRender:()=>typeof(v==null?void 0:v.dropdownRender)=="function"?v.dropdownRender(me):me}));return g.createElement("div",{className:`${a}-column`},g.createElement("span",{className:`${i}-column-title`},x),g.createElement(e4,Object.assign({},Ie)))},npe=(t,e,n)=>{let o=[];return(t||[]).forEach((r,i)=>{var a;const l=uI(i,n);if(r.filters||"filterDropdown"in r||"onFilter"in r)if("filteredValue"in r){let s=r.filteredValue;"filterDropdown"in r||(s=(a=s==null?void 0:s.map(String))!==null&&a!==void 0?a:s),o.push({column:r,key:l7(r,l),filteredKeys:s,forceFiltered:r.filtered})}else o.push({column:r,key:l7(r,l),filteredKeys:e&&r.defaultFilteredValue?r.defaultFilteredValue:void 0,forceFiltered:r.filtered});"children"in r&&(o=[].concat(Pa(o),Pa(npe(r.children,e,l))))}),o};function ant(t,e,n,o,r,i,a,l,s){return n.map((c,u)=>{const d=uI(u,l),{filterOnClose:f=!0,filterMultiple:p=!0,filterMode:m,filterSearch:y}=c;let w=c;if(w.filters||w.filterDropdown){const x=l7(w,d),C=o.find(P=>{let{key:A}=P;return x===A});w=Object.assign(Object.assign({},w),{title:P=>g.createElement(yrn,{tablePrefixCls:t,prefixCls:`${t}-filter`,dropdownPrefixCls:e,column:w,columnKey:x,filterState:C,filterOnClose:f,filterMultiple:p,filterMode:m,filterSearch:y,triggerFilter:i,locale:r,getPopupContainer:a,rootClassName:s},Bee(c.title,P))})}return"children"in w&&(w=Object.assign(Object.assign({},w),{children:ant(t,e,w.children,o,r,i,a,d,s)})),w})}const gRe=t=>{const e={};return t.forEach(n=>{let{key:o,filteredKeys:r,column:i}=n;const a=o,{filters:l,filterDropdown:s}=i;if(s)e[a]=r||null;else if(Array.isArray(r)){const c=FR(l);e[a]=c.filter(u=>r.includes(String(u)))}else e[a]=null}),e},ope=(t,e,n)=>e.reduce((r,i)=>{const{column:{onFilter:a,filters:l},filteredKeys:s}=i;return a&&s&&s.length?r.map(c=>Object.assign({},c)).filter(c=>s.some(u=>{const d=FR(l),f=d.findIndex(m=>String(m)===String(u)),p=f!==-1?d[f]:u;return c[n]&&(c[n]=ope(c[n],e,n)),a(p,c)})):r},t),lnt=t=>t.flatMap(e=>"children"in e?[e].concat(Pa(lnt(e.children||[]))):[e]),Arn=t=>{const{prefixCls:e,dropdownPrefixCls:n,mergedColumns:o,onFilterChange:r,getPopupContainer:i,locale:a,rootClassName:l}=t;LS();const s=g.useMemo(()=>lnt(o||[]),[o]),[c,u]=g.useState(()=>npe(s,!0)),d=g.useMemo(()=>{const y=npe(s,!1);if(y.length===0)return y;let w=!0;if(y.forEach(x=>{let{filteredKeys:C}=x;C!==void 0&&(w=!1)}),w){const x=(s||[]).map((C,P)=>l7(C,uI(P)));return c.filter(C=>{let{key:P}=C;return x.includes(P)}).map(C=>{const P=s[x.findIndex(A=>A===C.key)];return Object.assign(Object.assign({},C),{column:Object.assign(Object.assign({},C.column),P),forceFiltered:P.filtered})})}return y},[s,c]),f=g.useMemo(()=>gRe(d),[d]),p=y=>{const w=d.filter(x=>{let{key:C}=x;return C!==y.key});w.push(y),u(w),r(gRe(w),w)};return[y=>ant(e,n,y,d,a,p,i,void 0,l),d,f]},wrn=(t,e,n)=>{const o=g.useRef({});function r(i){var a;if(!o.current||o.current.data!==t||o.current.childrenColumnName!==e||o.current.getRowKey!==n){let c=function(u){u.forEach((d,f)=>{const p=n(d,f);s.set(p,d),d&&typeof d=="object"&&e in d&&c(d[e]||[])})};var l=c;const s=new Map;c(t),o.current={data:t,childrenColumnName:e,kvMap:s,getRowKey:n}}return(a=o.current.kvMap)===null||a===void 0?void 0:a.get(i)}return[r]};var xrn=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const i=t[r];typeof i!="function"&&(n[r]=i)}),n}function brn(t,e,n){const o=n&&typeof n=="object"?n:{},{total:r=0}=o,i=xrn(o,["total"]),[a,l]=g.useState(()=>({current:"defaultCurrent"in i?i.defaultCurrent:1,pageSize:"defaultPageSize"in i?i.defaultPageSize:snt})),s=a3e(a,i,{total:r>0?r:t}),c=Math.ceil((r||t)/s.pageSize);s.current>c&&(s.current=c||1);const u=(f,p)=>{l({current:f??1,pageSize:p||s.pageSize})},d=(f,p)=>{var m;n&&((m=n.onChange)===null||m===void 0||m.call(n,f,p)),u(f,p),e(f,p||(s==null?void 0:s.pageSize))};return n===!1?[{},()=>{}]:[Object.assign(Object.assign({},s),{onChange:d}),u]}const wG="ascend",fse="descend",AJ=t=>typeof t.sorter=="object"&&typeof t.sorter.multiple=="number"?t.sorter.multiple:!1,mRe=t=>typeof t=="function"?t:t&&typeof t=="object"&&t.compare?t.compare:!1,Srn=(t,e)=>e?t[t.indexOf(e)+1]:t[0],rpe=(t,e,n)=>{let o=[];const r=(i,a)=>{o.push({column:i,key:l7(i,a),multiplePriority:AJ(i),sortOrder:i.sortOrder})};return(t||[]).forEach((i,a)=>{const l=uI(a,n);i.children?("sortOrder"in i&&r(i,l),o=[].concat(Pa(o),Pa(rpe(i.children,e,l)))):i.sorter&&("sortOrder"in i?r(i,l):e&&i.defaultSortOrder&&o.push({column:i,key:l7(i,l),multiplePriority:AJ(i),sortOrder:i.defaultSortOrder}))}),o},cnt=(t,e,n,o,r,i,a,l)=>(e||[]).map((c,u)=>{const d=uI(u,l);let f=c;if(f.sorter){const p=f.sortDirections||r,m=f.showSorterTooltip===void 0?a:f.showSorterTooltip,y=l7(f,d),w=n.find(R=>{let{key:M}=R;return M===y}),x=w?w.sortOrder:null,C=Srn(p,x);let P;if(c.sortIcon)P=c.sortIcon({sortOrder:x});else{const R=p.includes(wG)&&g.createElement(HZt,{className:Mn(`${t}-column-sorter-up`,{active:x===wG})}),M=p.includes(fse)&&g.createElement(utt,{className:Mn(`${t}-column-sorter-down`,{active:x===fse})});P=g.createElement("span",{className:Mn(`${t}-column-sorter`,{[`${t}-column-sorter-full`]:!!(R&&M)})},g.createElement("span",{className:`${t}-column-sorter-inner`,"aria-hidden":"true"},R,M))}const{cancelSort:A,triggerAsc:S,triggerDesc:v}=i||{};let b=A;C===fse?b=v:C===wG&&(b=S);const T=typeof m=="object"?Object.assign({title:b},m):{title:b};f=Object.assign(Object.assign({},f),{className:Mn(f.className,{[`${t}-column-sort`]:x}),title:R=>{const M=`${t}-column-sorters`,D=g.createElement("span",{className:`${t}-column-title`},Bee(c.title,R)),k=g.createElement("div",{className:M},D,P);return m?typeof m!="boolean"&&(m==null?void 0:m.target)==="sorter-icon"?g.createElement("div",{className:`${M} ${t}-column-sorters-tooltip-target-sorter`},D,g.createElement(k3,Object.assign({},T),P)):g.createElement(k3,Object.assign({},T),k):k},onHeaderCell:R=>{var M;const D=((M=c.onHeaderCell)===null||M===void 0?void 0:M.call(c,R))||{},k=D.onClick,N=D.onKeyDown;D.onClick=F=>{o({column:c,key:y,sortOrder:C,multiplePriority:AJ(c)}),k==null||k(F)},D.onKeyDown=F=>{F.keyCode===IL.ENTER&&(o({column:c,key:y,sortOrder:C,multiplePriority:AJ(c)}),N==null||N(F))};const U=Bon(c.title,{}),W=U==null?void 0:U.toString();return x?D["aria-sort"]=x==="ascend"?"ascending":"descending":D["aria-label"]=W||"",D.className=Mn(D.className,`${t}-column-has-sorters`),D.tabIndex=0,c.ellipsis&&(D.title=(U??"").toString()),D}})}return"children"in f&&(f=Object.assign(Object.assign({},f),{children:cnt(t,f.children,n,o,r,i,a,d)})),f}),yRe=t=>{const{column:e,sortOrder:n}=t;return{column:e,order:n,field:e.dataIndex,columnKey:e.key}},ARe=t=>{const e=t.filter(n=>{let{sortOrder:o}=n;return o}).map(yRe);if(e.length===0&&t.length){const n=t.length-1;return Object.assign(Object.assign({},yRe(t[n])),{column:void 0,order:void 0,field:void 0,columnKey:void 0})}return e.length<=1?e[0]||{}:e},ipe=(t,e,n)=>{const o=e.slice().sort((a,l)=>l.multiplePriority-a.multiplePriority),r=t.slice(),i=o.filter(a=>{let{column:{sorter:l},sortOrder:s}=a;return mRe(l)&&s});return i.length?r.sort((a,l)=>{for(let s=0;s{const l=a[n];return l?Object.assign(Object.assign({},a),{[n]:ipe(l,e,n)}):a}):r},Trn=t=>{const{prefixCls:e,mergedColumns:n,sortDirections:o,tableLocale:r,showSorterTooltip:i,onSorterChange:a}=t,[l,s]=g.useState(rpe(n,!0)),c=(y,w)=>{const x=[];return y.forEach((C,P)=>{const A=uI(P,w);if(x.push(l7(C,A)),Array.isArray(C.children)){const S=c(C.children,A);x.push.apply(x,Pa(S))}}),x},u=g.useMemo(()=>{let y=!0;const w=rpe(n,!1);if(!w.length){const A=c(n);return l.filter(S=>{let{key:v}=S;return A.includes(v)})}const x=[];function C(A){y?x.push(A):x.push(Object.assign(Object.assign({},A),{sortOrder:null}))}let P=null;return w.forEach(A=>{P===null?(C(A),A.sortOrder&&(A.multiplePriority===!1?y=!1:P=!0)):(P&&A.multiplePriority!==!1||(y=!1),C(A))}),x},[n,l]),d=g.useMemo(()=>{var y,w;const x=u.map(C=>{let{column:P,sortOrder:A}=C;return{column:P,order:A}});return{sortColumns:x,sortColumn:(y=x[0])===null||y===void 0?void 0:y.column,sortOrder:(w=x[0])===null||w===void 0?void 0:w.order}},[u]),f=y=>{let w;y.multiplePriority===!1||!u.length||u[0].multiplePriority===!1?w=[y]:w=[].concat(Pa(u.filter(x=>{let{key:C}=x;return C!==y.key})),[y]),s(w),a(ARe(w),w)};return[y=>cnt(e,y,u,f,o,r,i),u,d,()=>ARe(u)]},unt=(t,e)=>t.map(o=>{const r=Object.assign({},o);return r.title=Bee(o.title,e),"children"in r&&(r.children=unt(r.children,e)),r}),Prn=t=>[g.useCallback(n=>unt(n,t),[t])],Crn=Vtt((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),Rrn=Ztt((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),Hrn=t=>{const{componentCls:e,lineWidth:n,lineType:o,tableBorderColor:r,tableHeaderBg:i,tablePaddingVertical:a,tablePaddingHorizontal:l,calc:s}=t,c=`${jt(n)} ${o} ${r}`,u=(d,f,p)=>({[`&${e}-${d}`]:{[`> ${e}-container`]:{[`> ${e}-content, > ${e}-body`]:{"\n > table > tbody > tr > th,\n > table > tbody > tr > td\n ":{[`> ${e}-expanded-row-fixed`]:{margin:`${jt(s(f).mul(-1).equal())} + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,fnn="".concat(unn," ").concat(dnn).split(/[\s\n]+/),hnn="aria-",pnn="data-";function ECe(t,e){return t.indexOf(e)===0}function kCe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=nn({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||ECe(r,hnn))||n.data&&ECe(r,pnn)||n.attr&&fnn.includes(r))&&(o[r]=t[r])}),o}function ztt(t,e,n,o,r,i,a){t.push({record:e,indent:n,index:a});var l=i(e),s=r==null?void 0:r.has(l);if(e&&Array.isArray(e[o])&&s)for(var c=0;c1?D-1:0),N=1;N=1)),style:nn(nn({},n),x==null?void 0:x.style)}),m.map(function(R,M){var D=R.render,k=R.dataIndex,N=R.className,U=Ltt(f,R,M,s,r),W=U.key,F=U.fixedInfo,E=U.appendCellNode,L=U.additionalCellProps;return g.createElement(sI,Uo({className:N,ellipsis:R.ellipsis,align:R.align,scope:R.rowScope,component:R.rowScope?d:u,prefixCls:p,key:W,record:o,index:r,renderIndex:i,dataIndex:k,render:D,shouldCellUpdate:R.shouldCellUpdate},F,{appendNode:E,additionalProps:L}))})),b;if(P&&(A.current||C)){var T=w(o,r,s+1,C);b=g.createElement(ktt,{expanded:C,className:Bn("".concat(p,"-expanded-row"),"".concat(p,"-expanded-row-level-").concat(s+1),S),prefixCls:p,component:c,cellComponent:u,colSpan:m.length,isEmpty:!1},T)}return g.createElement(g.Fragment,null,v,b)}const Ann=lI(ynn);function wnn(t){var e=t.columnKey,n=t.onColumnResize,o=g.useRef();return g.useEffect(function(){o.current&&n(e,o.current.offsetWidth)},[]),g.createElement(Ld,{data:e},g.createElement("td",{ref:o,style:{padding:0,border:0,height:0}},g.createElement("div",{style:{height:0,overflow:"hidden"}}," ")))}function xnn(t){var e=t.prefixCls,n=t.columnsKey,o=t.onColumnResize;return g.createElement("tr",{"aria-hidden":"true",className:"".concat(e,"-measure-row"),style:{height:0,fontSize:0}},g.createElement(Ld.Collection,{onBatchResize:function(i){i.forEach(function(a){var l=a.data,s=a.size;o(l,s.offsetWidth)})}},n.map(function(r){return g.createElement(wnn,{key:r,columnKey:r,onColumnResize:o})})))}function vnn(t){var e=t.data,n=t.measureColumnWidth,o=If(Kp,["prefixCls","getComponent","onColumnResize","flattenColumns","getRowKey","expandedKeys","childrenColumnName","emptyNode"]),r=o.prefixCls,i=o.getComponent,a=o.onColumnResize,l=o.flattenColumns,s=o.getRowKey,c=o.expandedKeys,u=o.childrenColumnName,d=o.emptyNode,f=Dtt(e,u,c,s),p=g.useRef({renderWithProps:!1}),m=i(["body","wrapper"],"tbody"),y=i(["body","row"],"tr"),w=i(["body","cell"],"td"),x=i(["body","cell"],"th"),C;e.length?C=f.map(function(A,S){var v=A.record,b=A.indent,T=A.index,R=s(v,S);return g.createElement(Ann,{key:R,rowKey:R,record:v,index:S,renderIndex:T,rowComponent:y,cellComponent:w,scopeCellComponent:x,indent:b})}):C=g.createElement(ktt,{expanded:!0,className:"".concat(r,"-placeholder"),prefixCls:r,component:y,cellComponent:w,colSpan:l.length,isEmpty:!0},d);var P=Hee(l);return g.createElement(btt.Provider,{value:p.current},g.createElement(m,{className:"".concat(r,"-tbody")},n&&g.createElement(xnn,{prefixCls:r,columnsKey:P,onColumnResize:a}),C))}const bnn=lI(vnn);var Snn=["expandable"],Vk="RC_TABLE_INTERNAL_COL_DEFINE";function Tnn(t){var e=t.expandable,n=Ai(t,Snn),o;return"expandable"in t?o=nn(nn({},n),e):o=n,o.showExpandColumn===!1&&(o.expandIconColumnIndex=-1),o}var Pnn=["columnType"];function Wtt(t){for(var e=t.colWidths,n=t.columns,o=t.columCount,r=If(Kp,["tableLayout"]),i=r.tableLayout,a=[],l=o||n.length,s=!1,c=l-1;c>=0;c-=1){var u=e[c],d=n&&n[c],f=void 0,p=void 0;if(d&&(f=d[Vk],i==="auto"&&(p=d.minWidth)),u||p||f||s){var m=f||{};m.columnType;var y=Ai(m,Pnn);a.unshift(g.createElement("col",Uo({key:c,style:{width:u,minWidth:p}},y))),s=!0}}return g.createElement("colgroup",null,a)}var Cnn=["className","noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","stickyTopOffset","stickyBottomOffset","stickyClassName","onScroll","maxContentScroll","children"];function Rnn(t,e){return g.useMemo(function(){for(var n=[],o=0;o1?"colgroup":"col":null,ellipsis:w.ellipsis,align:w.align,component:a,prefixCls:u,key:p[y]},x,{additionalProps:C,rowType:"header"}))}))};function Inn(t){var e=[];function n(a,l){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;e[s]=e[s]||[];var c=l,u=a.filter(Boolean).map(function(d){var f={key:d.key,className:d.className||"",children:d.title,column:d,colStart:c},p=1,m=d.children;return m&&m.length>0&&(p=n(m,c,s+1).reduce(function(y,w){return y+w},0),f.hasSubColumns=!0),"colSpan"in d&&(p=d.colSpan),"rowSpan"in d&&(f.rowSpan=d.rowSpan),f.colSpan=p,f.colEnd=f.colStart+p-1,e[s].push(f),c+=p,p});return u}n(t,0);for(var o=e.length,r=function(l){e[l].forEach(function(s){!("rowSpan"in s)&&!s.hasSubColumns&&(s.rowSpan=o-l)})},i=0;i1&&arguments[1]!==void 0?arguments[1]:{},n=[];return xe.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(Xhe(o)):Gtn(o)&&o.props?n=n.concat(Xhe(o.props.children,e)):n.push(o))}),n}function WCe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return typeof e=="number"?e:e.endsWith("%")?t*parseFloat(e)/100:null}function Dnn(t,e,n){return g.useMemo(function(){if(e&&e>0){var o=0,r=0;t.forEach(function(f){var p=WCe(e,f.width);p?o+=p:r+=1});var i=Math.max(e,n),a=Math.max(i-o,r),l=r,s=a/r,c=0,u=t.map(function(f){var p=nn({},f),m=WCe(e,p.width);if(m)p.width=m;else{var y=Math.floor(s);p.width=l===1?a:y,a-=y,l-=1}return c+=p.width,p});if(c0?nn(nn({},e),{},{children:Ntt(n)}):e})}function Jhe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key";return t.filter(function(n){return n&&Vr(n)==="object"}).reduce(function(n,o,r){var i=o.fixed,a=i===!0?"left":i,l="".concat(e,"-").concat(r),s=o.children;return s&&s.length>0?[].concat($o(n),$o(Jhe(s,l).map(function(c){return nn({fixed:a},c)}))):[].concat($o(n),[nn(nn({key:l},o),{},{fixed:a})])},[])}function Fnn(t){return t.map(function(e){var n=e.fixed,o=Ai(e,knn),r=n;return n==="left"?r="right":n==="right"&&(r="left"),nn({fixed:r},o)})}function Lnn(t,e){var n=t.prefixCls,o=t.columns,r=t.children,i=t.expandable,a=t.expandedKeys,l=t.columnTitle,s=t.getRowKey,c=t.onTriggerExpand,u=t.expandIcon,d=t.rowExpandable,f=t.expandIconColumnIndex,p=t.direction,m=t.expandRowByClick,y=t.columnWidth,w=t.fixed,x=t.scrollWidth,C=t.clientWidth,P=g.useMemo(function(){var k=o||m3e(r)||[];return Ntt(k.slice())},[o,r]),A=g.useMemo(function(){if(i){var k=P.slice();if(!k.includes(aA)){var N=f||0;N>=0&&(N||w==="left"||!w)&&k.splice(N,0,aA),w==="right"&&k.splice(P.length,0,aA)}var U=k.indexOf(aA);k=k.filter(function(L,j){return L!==aA||j===U});var W=P[U],F;w?F=w:F=W?W.fixed:null;var E=Ut(Ut(Ut(Ut(Ut(Ut({},Vk,{className:"".concat(n,"-expand-icon-col"),columnType:"EXPAND_COLUMN"}),"title",l),"fixed",F),"className","".concat(n,"-row-expand-icon-cell")),"width",y),"render",function(j,Y,O){var _=s(Y,O),G=a.has(_),Q=d?d(Y):!0,oe=u({prefixCls:n,expanded:G,expandable:Q,record:Y,onExpand:c});return m?g.createElement("span",{onClick:function($){return $.stopPropagation()}},oe):oe});return k.map(function(L){return L===aA?E:L})}return P.filter(function(L){return L!==aA})},[i,P,s,a,u,p]),S=g.useMemo(function(){var k=A;return e&&(k=e(k)),k.length||(k=[{render:function(){return null}}]),k},[e,A,p]),v=g.useMemo(function(){return p==="rtl"?Fnn(Jhe(S)):Jhe(S)},[S,p,x]),b=g.useMemo(function(){for(var k=-1,N=v.length-1;N>=0;N-=1){var U=v[N].fixed;if(U==="left"||U===!0){k=N;break}}if(k>=0)for(var W=0;W<=k;W+=1){var F=v[W].fixed;if(F!=="left"&&F!==!0)return!0}var E=v.findIndex(function(Y){var O=Y.fixed;return O==="right"});if(E>=0)for(var L=E;L1&&arguments[1]!==void 0?arguments[1]:1;jCe+=1;var o=jCe;function r(i){if(i===0)Ytt(o),e();else{var a=jtt(function(){r(i-1)});y3e.set(o,a)}}return r(n),o};Khe.cancel=function(t){var e=y3e.get(t);return Ytt(t),Btt(e)};function BCe(t){return t instanceof HTMLElement||t instanceof SVGElement}function Ott(t){return t&&Vr(t)==="object"&&BCe(t.nativeElement)?t.nativeElement:BCe(t)?t:null}function YCe(t){var e=Ott(t),n=e.getBoundingClientRect(),o=document.documentElement;return{left:n.left+(window.pageXOffset||o.scrollLeft)-(o.clientLeft||document.body.clientLeft||0),top:n.top+(window.pageYOffset||o.scrollTop)-(o.clientTop||document.body.clientTop||0)}}var Onn=function(e,n){var o,r,i=e.scrollBodyRef,a=e.onScroll,l=e.offsetScroll,s=e.container,c=e.direction,u=If(Kp,"prefixCls"),d=((o=i.current)===null||o===void 0?void 0:o.scrollWidth)||0,f=((r=i.current)===null||r===void 0?void 0:r.clientWidth)||0,p=d&&f*(f/d),m=g.useRef(),y=Utt({scrollLeft:0,isHiddenScrollBar:!0}),w=Sn(y,2),x=w[0],C=w[1],P=g.useRef({delta:0,x:0}),A=g.useState(!1),S=Sn(A,2),v=S[0],b=S[1],T=g.useRef(null);g.useEffect(function(){return function(){Khe.cancel(T.current)}},[]);var R=function(){b(!1)},M=function(W){W.persist(),P.current.delta=W.pageX-x.scrollLeft,P.current.x=0,b(!0),W.preventDefault()},D=function(W){var F,E=W||((F=window)===null||F===void 0?void 0:F.event),L=E.buttons;if(!v||L===0){v&&b(!1);return}var j=P.current.x+W.pageX-P.current.x-P.current.delta,Y=c==="rtl";j=Math.max(Y?p-f:0,Math.min(Y?0:f-p,j));var O=!Y||Math.abs(j)+Math.abs(p)=E-l?C(function(L){return nn(nn({},L),{},{isHiddenScrollBar:!0})}):C(function(L){return nn(nn({},L),{},{isHiddenScrollBar:!1})})}})},N=function(W){C(function(F){return nn(nn({},F),{},{scrollLeft:W/d*f||0})})};return g.useImperativeHandle(n,function(){return{setScrollLeft:N,checkScrollBarVisible:k}}),g.useEffect(function(){var U=t_(document.body,"mouseup",R,!1),W=t_(document.body,"mousemove",D,!1);return k(),function(){U.remove(),W.remove()}},[p,v]),g.useEffect(function(){var U=t_(s,"scroll",k,!1),W=t_(window,"resize",k,!1);return function(){U.remove(),W.remove()}},[s]),g.useEffect(function(){x.isHiddenScrollBar||C(function(U){var W=i.current;return W?nn(nn({},U),{},{scrollLeft:W.scrollLeft/W.scrollWidth*W.clientWidth}):U})},[x.isHiddenScrollBar]),d<=f||!p||x.isHiddenScrollBar?null:g.createElement("div",{style:{height:zCe(),width:f,bottom:l},className:"".concat(u,"-sticky-scroll")},g.createElement("div",{onMouseDown:M,ref:m,className:Bn("".concat(u,"-sticky-scroll-bar"),Ut({},"".concat(u,"-sticky-scroll-bar-active"),v)),style:{width:"".concat(p,"px"),transform:"translate3d(".concat(x.scrollLeft,"px, 0, 0)")}}))};const _nn=g.forwardRef(Onn);var _tt="rc-table",Vnn=[],Gnn={};function Xnn(){return"No Data"}function Jnn(t,e){var n=nn({rowKey:"key",prefixCls:_tt,emptyText:Xnn},t),o=n.prefixCls,r=n.className,i=n.rowClassName,a=n.style,l=n.data,s=n.rowKey,c=n.scroll,u=n.tableLayout,d=n.direction,f=n.title,p=n.footer,m=n.summary,y=n.caption,w=n.id,x=n.showHeader,C=n.components,P=n.emptyText,A=n.onRow,S=n.onHeaderRow,v=n.onScroll,b=n.internalHooks,T=n.transformColumns,R=n.internalRefs,M=n.tailor,D=n.getContainerWidth,k=n.sticky,N=n.rowHoverable,U=N===void 0?!0:N,W=l||Vnn,F=!!W.length,E=b===TU,L=g.useCallback(function(No,ho){return u3e(C,No)||ho},[C]),j=g.useMemo(function(){return typeof s=="function"?s:function(No){var ho=No&&No[s];return ho}},[s]),Y=L(["body"]),O=jnn(),_=Sn(O,3),G=_[0],Q=_[1],oe=_[2],ee=Wnn(n,W,j),$=Sn(ee,6),ae=$[0],Z=$[1],ne=$[2],te=$[3],q=$[4],le=$[5],de=c==null?void 0:c.x,he=g.useState(0),me=Sn(he,2),ce=me[0],Pe=me[1],pe=Lnn(nn(nn(nn({},n),ae),{},{expandable:!!ae.expandedRowRender,columnTitle:ae.columnTitle,expandedKeys:ne,getRowKey:j,onTriggerExpand:le,expandIcon:te,expandIconColumnIndex:ae.expandIconColumnIndex,direction:d,scrollWidth:E&&M&&typeof de=="number"?de:null,clientWidth:ce}),E?T:null),Ie=Sn(pe,4),ve=Ie[0],ze=Ie[1],Ae=Ie[2],se=Ie[3],ge=Ae??de,we=g.useMemo(function(){return{columns:ve,flattenColumns:ze}},[ve,ze]),Se=g.useRef(),Me=g.useRef(),Ce=g.useRef(),Te=g.useRef();g.useImperativeHandle(e,function(){return{nativeElement:Se.current,scrollTo:function(ho){var vo;if(Ce.current instanceof HTMLElement){var bo=ho.index,Bo=ho.top,Pr=ho.key;if(Ltn(Bo)){var so;(so=Ce.current)===null||so===void 0||so.scrollTo({top:Bo})}else{var zo,Ci=Pr??j(W[bo]);(zo=Ce.current.querySelector('[data-row-key="'.concat(Ci,'"]')))===null||zo===void 0||zo.scrollIntoView()}}else(vo=Ce.current)!==null&&vo!==void 0&&vo.scrollTo&&Ce.current.scrollTo(ho)}}});var Re=g.useRef(),Ne=g.useState(!1),_e=Sn(Ne,2),Ue=_e[0],qe=_e[1],Fe=g.useState(!1),He=Sn(Fe,2),Le=He[0],Ye=He[1],lt=Utt(new Map),Oe=Sn(lt,2),ut=Oe[0],ht=Oe[1],Qe=Hee(ze),nt=Qe.map(function(No){return ut.get(No)}),mt=g.useMemo(function(){return nt},[nt.join("_")]),tt=Ynn(mt,ze,d),gt=c&&Vhe(c.y),Ve=c&&Vhe(ge)||!!ae.fixed,je=Ve&&ze.some(function(No){var ho=No.fixed;return ho}),et=g.useRef(),bt=Bnn(k,o),St=bt.isSticky,Pt=bt.offsetHeader,Yt=bt.offsetSummary,zt=bt.offsetScroll,Rt=bt.stickyClassName,Ct=bt.container,yt=g.useMemo(function(){return m==null?void 0:m(W)},[m,W]),at=(gt||St)&&g.isValidElement(yt)&&yt.type===Uee&&yt.props.fixed,Et,Lt,Je;gt&&(Lt={overflowY:F?"scroll":"auto",maxHeight:c.y}),Ve&&(Et={overflowX:"auto"},gt||(Lt={overflowY:"hidden"}),Je={width:ge===!0?"auto":ge,minWidth:"100%"});var st=g.useCallback(function(No,ho){tnn(Se.current)&&ht(function(vo){if(vo.get(No)!==ho){var bo=new Map(vo);return bo.set(No,ho),bo}return vo})},[]),It=Unn(),ot=Sn(It,2),it=ot[0],Be=ot[1];function pt(No,ho){ho&&(typeof ho=="function"?ho(No):ho.scrollLeft!==No&&(ho.scrollLeft=No,ho.scrollLeft!==No&&setTimeout(function(){ho.scrollLeft=No},0)))}var ct=qb(function(No){var ho=No.currentTarget,vo=No.scrollLeft,bo=d==="rtl",Bo=typeof vo=="number"?vo:ho.scrollLeft,Pr=ho||Gnn;if(!Be()||Be()===Pr){var so;it(Pr),pt(Bo,Me.current),pt(Bo,Ce.current),pt(Bo,Re.current),pt(Bo,(so=et.current)===null||so===void 0?void 0:so.setScrollLeft)}var zo=ho||Me.current;if(zo){var Ci=E&&M&&typeof ge=="number"?ge:zo.scrollWidth,ea=zo.clientWidth;if(Ci===ea){qe(!1),Ye(!1);return}bo?(qe(-Bo0)):(qe(Bo>0),Ye(Bo1&&arguments[1]!==void 0?arguments[1]:1;VCe+=1;var o=VCe;function r(i){if(i===0)Ktt(o),e();else{var a=Xtt(function(){r(i-1)});A3e.set(o,a)}}return r(n),o};u5.cancel=function(t){var e=A3e.get(t);return Ktt(t),Jtt(e)};var GCe=(typeof navigator>"u"?"undefined":Vr(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const $tt=function(t,e,n,o){var r=g.useRef(!1),i=g.useRef(null);function a(){clearTimeout(i.current),r.current=!0,i.current=setTimeout(function(){r.current=!1},50)}var l=g.useRef({top:t,bottom:e,left:n,right:o});return l.current.top=t,l.current.bottom=e,l.current.left=n,l.current.right=o,function(s,c){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,d=s?c<0&&l.current.left||c>0&&l.current.right:c<0&&l.current.top||c>0&&l.current.bottom;return u&&d?(clearTimeout(i.current),r.current=!1):(!d||r.current)&&a(),!r.current&&d}};function ton(t,e,n,o,r,i,a){var l=g.useRef(0),s=g.useRef(null),c=g.useRef(null),u=g.useRef(!1),d=$tt(e,n,o,r);function f(C,P){if(u5.cancel(s.current),!d(!1,P)){var A=C;if(!A._virtualHandled)A._virtualHandled=!0;else return;l.current+=P,c.current=P,GCe||A.preventDefault(),s.current=u5(function(){var S=u.current?10:1;a(l.current*S,!1),l.current=0})}}function p(C,P){a(P,!0),GCe||C.preventDefault()}var m=g.useRef(null),y=g.useRef(null);function w(C){if(t){u5.cancel(y.current),y.current=u5(function(){m.current=null},2);var P=C.deltaX,A=C.deltaY,S=C.shiftKey,v=P,b=A;(m.current==="sx"||!m.current&&S&&A&&!P)&&(v=A,b=0,m.current="sx");var T=Math.abs(v),R=Math.abs(b);m.current===null&&(m.current=i&&T>R?"x":"y"),m.current==="y"?f(C,b):p(C,v)}}function x(C){t&&(u.current=C.detail===c.current)}return[w,x]}function non(t,e,n,o){var r=g.useMemo(function(){return[new Map,[]]},[t,n.id,o]),i=Sn(r,2),a=i[0],l=i[1],s=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var m=t.length,y=l.length;y0&&arguments[0]!==void 0?arguments[0]:!1;u();var m=function(){var x=!1;l.current.forEach(function(C,P){if(C&&C.offsetParent){var A=ron(C),S=A.offsetHeight,v=getComputedStyle(A),b=v.marginTop,T=v.marginBottom,R=XCe(b),M=XCe(T),D=S+R+M;s.current.get(P)!==D&&(s.current.set(P,D),x=!0)}}),x&&a(function(C){return C+1})};if(p)m();else{c.current+=1;var y=c.current;Promise.resolve().then(function(){y===c.current&&m()})}}function f(p,m){var y=t(p);l.current.get(y),m?(l.current.set(y,m),d()):l.current.delete(y)}return g.useEffect(function(){return u},[]),[f,d,s.current,i]}var JCe=14/15;function lon(t,e,n){var o=g.useRef(!1),r=g.useRef(0),i=g.useRef(0),a=g.useRef(null),l=g.useRef(null),s,c=function(p){if(o.current){var m=Math.ceil(p.touches[0].pageX),y=Math.ceil(p.touches[0].pageY),w=r.current-m,x=i.current-y,C=Math.abs(w)>Math.abs(x);C?r.current=m:i.current=y;var P=n(C,C?w:x,!1,p);P&&p.preventDefault(),clearInterval(l.current),P&&(l.current=setInterval(function(){C?w*=JCe:x*=JCe;var A=Math.floor(C?w:x);(!n(C,A,!0)||Math.abs(A)<=.1)&&clearInterval(l.current)},16))}},u=function(){o.current=!1,s()},d=function(p){s(),p.touches.length===1&&!o.current&&(o.current=!0,r.current=Math.ceil(p.touches[0].pageX),i.current=Math.ceil(p.touches[0].pageY),a.current=p.target,a.current.addEventListener("touchmove",c,{passive:!1}),a.current.addEventListener("touchend",u,{passive:!0}))};s=function(){a.current&&(a.current.removeEventListener("touchmove",c),a.current.removeEventListener("touchend",u))},Gk(function(){return t&&e.current.addEventListener("touchstart",d,{passive:!0}),function(){var f;(f=e.current)===null||f===void 0||f.removeEventListener("touchstart",d),s(),clearInterval(l.current)}},[t])}function KCe(t){return Math.floor(Math.pow(t,.5))}function $he(t,e){var n="touches"in t?t.touches[0]:t;return n[e?"pageX":"pageY"]-window[e?"scrollX":"scrollY"]}function son(t,e,n){g.useEffect(function(){var o=e.current;if(t&&o){var r=!1,i,a,l=function(){u5.cancel(i)},s=function f(){l(),i=u5(function(){n(a),f()})},c=function(p){var m=p;m._virtualHandled||(m._virtualHandled=!0,r=!0)},u=function(){r=!1,l()},d=function(p){if(r){var m=$he(p,!1),y=o.getBoundingClientRect(),w=y.top,x=y.bottom;if(m<=w){var C=w-m;a=-KCe(C),s()}else if(m>=x){var P=m-x;a=KCe(P),s()}else l()}};return o.addEventListener("mousedown",c),o.ownerDocument.addEventListener("mouseup",u),o.ownerDocument.addEventListener("mousemove",d),function(){o.removeEventListener("mousedown",c),o.ownerDocument.removeEventListener("mouseup",u),o.ownerDocument.removeEventListener("mousemove",d),l()}}},[t])}var con=10;function uon(t,e,n,o,r,i,a,l){var s=g.useRef(),c=g.useState(null),u=Sn(c,2),d=u[0],f=u[1];return Gk(function(){if(d&&d.times=0;U-=1){var W=r(e[U]),F=n.get(W);if(F===void 0){C=!0;break}if(N-=F,N<=0)break}switch(S){case"top":A=b-w;break;case"bottom":A=T-x+w;break;default:{var E=t.current.scrollTop,L=E+x;bL&&(P="bottom")}}A!==null&&a(A),A!==d.lastTop&&(C=!0)}C&&f(nn(nn({},d),{},{times:d.times+1,targetAlign:P,lastTop:A}))}},[d,t.current]),function(p){if(p==null){l();return}if(u5.cancel(s.current),typeof p=="number")a(p);else if(p&&Vr(p)==="object"){var m,y=p.align;"index"in p?m=p.index:m=e.findIndex(function(C){return r(C)===p.key});var w=p.offset,x=w===void 0?0:w;f({times:0,index:m,offset:x,originAlign:y})}}}var $Ce=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.rtl,r=t.scrollOffset,i=t.scrollRange,a=t.onStartMove,l=t.onStopMove,s=t.onScroll,c=t.horizontal,u=t.spinSize,d=t.containerSize,f=t.style,p=t.thumbStyle,m=t.showScrollBar,y=g.useState(!1),w=Sn(y,2),x=w[0],C=w[1],P=g.useState(null),A=Sn(P,2),S=A[0],v=A[1],b=g.useState(null),T=Sn(b,2),R=T[0],M=T[1],D=!o,k=g.useRef(),N=g.useRef(),U=g.useState(m),W=Sn(U,2),F=W[0],E=W[1],L=g.useRef(),j=function(){m===!0||m===!1||(clearTimeout(L.current),E(!0),L.current=setTimeout(function(){E(!1)},3e3))},Y=i-d||0,O=d-u||0,_=g.useMemo(function(){if(r===0||Y===0)return 0;var te=r/Y;return te*O},[r,Y,O]),G=function(q){q.stopPropagation(),q.preventDefault()},Q=g.useRef({top:_,dragging:x,pageY:S,startTop:R});Q.current={top:_,dragging:x,pageY:S,startTop:R};var oe=function(q){C(!0),v($he(q,c)),M(Q.current.top),a(),q.stopPropagation(),q.preventDefault()};g.useEffect(function(){var te=function(he){he.preventDefault()},q=k.current,le=N.current;return q.addEventListener("touchstart",te,{passive:!1}),le.addEventListener("touchstart",oe,{passive:!1}),function(){q.removeEventListener("touchstart",te),le.removeEventListener("touchstart",oe)}},[]);var ee=g.useRef();ee.current=Y;var $=g.useRef();$.current=O,g.useEffect(function(){if(x){var te,q=function(he){var me=Q.current,ce=me.dragging,Pe=me.pageY,pe=me.startTop;u5.cancel(te);var Ie=k.current.getBoundingClientRect(),ve=d/(c?Ie.width:Ie.height);if(ce){var ze=($he(he,c)-Pe)*ve,Ae=pe;!D&&c?Ae-=ze:Ae+=ze;var se=ee.current,ge=$.current,we=ge?Ae/ge:0,Se=Math.ceil(we*se);Se=Math.max(Se,0),Se=Math.min(Se,se),te=u5(function(){s(Se,c)})}},le=function(){C(!1),l()};return window.addEventListener("mousemove",q,{passive:!0}),window.addEventListener("touchmove",q,{passive:!0}),window.addEventListener("mouseup",le,{passive:!0}),window.addEventListener("touchend",le,{passive:!0}),function(){window.removeEventListener("mousemove",q),window.removeEventListener("touchmove",q),window.removeEventListener("mouseup",le),window.removeEventListener("touchend",le),u5.cancel(te)}}},[x]),g.useEffect(function(){return j(),function(){clearTimeout(L.current)}},[r]),g.useImperativeHandle(e,function(){return{delayHidden:j}});var ae="".concat(n,"-scrollbar"),Z={position:"absolute",visibility:F?null:"hidden"},ne={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return c?(Z.height=8,Z.left=0,Z.right=0,Z.bottom=0,ne.height="100%",ne.width=u,D?ne.left=_:ne.right=_):(Z.width=8,Z.top=0,Z.bottom=0,D?Z.right=0:Z.left=0,ne.width="100%",ne.height=u,ne.top=_),g.createElement("div",{ref:k,className:Bn(ae,Ut(Ut(Ut({},"".concat(ae,"-horizontal"),c),"".concat(ae,"-vertical"),!c),"".concat(ae,"-visible"),F)),style:nn(nn({},Z),f),onMouseDown:G,onMouseMove:j},g.createElement("div",{ref:N,className:Bn("".concat(ae,"-thumb"),Ut({},"".concat(ae,"-thumb-moving"),x)),style:nn(nn({},ne),p),onMouseDown:oe}))}),don=20;function qCe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*t;return isNaN(n)&&(n=0),n=Math.max(n,don),Math.floor(n)}var fon=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],hon=[],pon={overflowY:"auto",overflowAnchor:"none"};function gon(t,e){var n=t.prefixCls,o=n===void 0?"rc-virtual-list":n,r=t.className,i=t.height,a=t.itemHeight,l=t.fullHeight,s=l===void 0?!0:l,c=t.style,u=t.data,d=t.children,f=t.itemKey,p=t.virtual,m=t.direction,y=t.scrollWidth,w=t.component,x=w===void 0?"div":w,C=t.onScroll,P=t.onVirtualScroll,A=t.onVisibleChange,S=t.innerProps,v=t.extraRender,b=t.styles,T=t.showScrollBar,R=T===void 0?"optional":T,M=Ai(t,fon),D=g.useCallback(function(Be){return typeof f=="function"?f(Be):Be==null?void 0:Be[f]},[f]),k=aon(D),N=Sn(k,4),U=N[0],W=N[1],F=N[2],E=N[3],L=!!(p!==!1&&i&&a),j=g.useMemo(function(){return Object.values(F.maps).reduce(function(Be,pt){return Be+pt},0)},[F.id,F.maps]),Y=L&&u&&(Math.max(a*u.length,j)>i||!!y),O=m==="rtl",_=Bn(o,Ut({},"".concat(o,"-rtl"),O),r),G=u||hon,Q=g.useRef(),oe=g.useRef(),ee=g.useRef(),$=g.useState(0),ae=Sn($,2),Z=ae[0],ne=ae[1],te=g.useState(0),q=Sn(te,2),le=q[0],de=q[1],he=g.useState(!1),me=Sn(he,2),ce=me[0],Pe=me[1],pe=function(){Pe(!0)},Ie=function(){Pe(!1)},ve={getKey:D};function ze(Be){ne(function(pt){var ct;typeof Be=="function"?ct=Be(pt):ct=Be;var Xe=Qe(ct);return Q.current.scrollTop=Xe,Xe})}var Ae=g.useRef({start:0,end:G.length}),se=g.useRef(),ge=eon(G,D),we=Sn(ge,1),Se=we[0];se.current=Se;var Me=g.useMemo(function(){if(!L)return{scrollHeight:void 0,start:0,end:G.length-1,offset:void 0};if(!Y){var Be;return{scrollHeight:((Be=oe.current)===null||Be===void 0?void 0:Be.offsetHeight)||0,start:0,end:G.length-1,offset:void 0}}for(var pt=0,ct,Xe,ft,wt=G.length,kt=0;kt=Z&&ct===void 0&&(ct=kt,Xe=pt),qt>Z+i&&ft===void 0&&(ft=kt),pt=qt}return ct===void 0&&(ct=0,Xe=0,ft=Math.ceil(i/a)),ft===void 0&&(ft=G.length-1),ft=Math.min(ft+1,G.length-1),{scrollHeight:pt,start:ct,end:ft,offset:Xe}},[Y,L,Z,G,E,i]),Ce=Me.scrollHeight,Te=Me.start,Re=Me.end,Ne=Me.offset;Ae.current.start=Te,Ae.current.end=Re,g.useLayoutEffect(function(){var Be=F.getRecord();if(Be.size===1){var pt=Array.from(Be)[0],ct=D(G[Te]);if(ct===pt){var Xe=F.get(pt),ft=Xe-a;ze(function(wt){return wt+ft})}}F.resetRecord()},[Ce]);var _e=g.useState({width:0,height:i}),Ue=Sn(_e,2),qe=Ue[0],Fe=Ue[1],He=function(pt){Fe({width:pt.offsetWidth,height:pt.offsetHeight})},Le=g.useRef(),Ye=g.useRef(),lt=g.useMemo(function(){return qCe(qe.width,y)},[qe.width,y]),Oe=g.useMemo(function(){return qCe(qe.height,Ce)},[qe.height,Ce]),ut=Ce-i,ht=g.useRef(ut);ht.current=ut;function Qe(Be){var pt=Be;return Number.isNaN(ht.current)||(pt=Math.min(pt,ht.current)),pt=Math.max(pt,0),pt}var nt=Z<=0,mt=Z>=ut,tt=le<=0,gt=le>=y,Ve=$tt(nt,mt,tt,gt),je=function(){return{x:O?-le:le,y:Z}},et=g.useRef(je()),bt=OCe(function(Be){if(P){var pt=nn(nn({},je()),Be);(et.current.x!==pt.x||et.current.y!==pt.y)&&(P(pt),et.current=pt)}});function St(Be,pt){var ct=Be;pt?(r0.flushSync(function(){de(ct)}),bt()):ze(ct)}function Pt(Be){var pt=Be.currentTarget.scrollTop;pt!==Z&&ze(pt),C==null||C(Be),bt()}var Yt=function(pt){var ct=pt,Xe=y?y-qe.width:0;return ct=Math.max(ct,0),ct=Math.min(ct,Xe),ct},zt=OCe(function(Be,pt){pt?(r0.flushSync(function(){de(function(ct){var Xe=ct+(O?-Be:Be);return Yt(Xe)})}),bt()):ze(function(ct){var Xe=ct+Be;return Xe})}),Rt=ton(L,nt,mt,tt,gt,!!y,zt),Ct=Sn(Rt,2),yt=Ct[0],at=Ct[1];lon(L,Q,function(Be,pt,ct,Xe){var ft=Xe;return Ve(Be,pt,ct)?!1:!ft||!ft._virtualHandled?(ft&&(ft._virtualHandled=!0),yt({preventDefault:function(){},deltaX:Be?pt:0,deltaY:Be?0:pt}),!0):!1}),son(Y,Q,function(Be){ze(function(pt){return pt+Be})}),Gk(function(){function Be(ct){var Xe=nt&&ct.detail<0,ft=mt&&ct.detail>0;L&&!Xe&&!ft&&ct.preventDefault()}var pt=Q.current;return pt.addEventListener("wheel",yt,{passive:!1}),pt.addEventListener("DOMMouseScroll",at,{passive:!0}),pt.addEventListener("MozMousePixelScroll",Be,{passive:!1}),function(){pt.removeEventListener("wheel",yt),pt.removeEventListener("DOMMouseScroll",at),pt.removeEventListener("MozMousePixelScroll",Be)}},[L,nt,mt]),Gk(function(){if(y){var Be=Yt(le);de(Be),bt({x:Be})}},[qe.width,y]);var Et=function(){var pt,ct;(pt=Le.current)===null||pt===void 0||pt.delayHidden(),(ct=Ye.current)===null||ct===void 0||ct.delayHidden()},Lt=uon(Q,G,F,a,D,function(){return W(!0)},ze,Et);g.useImperativeHandle(e,function(){return{nativeElement:ee.current,getScrollInfo:je,scrollTo:function(pt){function ct(Xe){return Xe&&Vr(Xe)==="object"&&("left"in Xe||"top"in Xe)}ct(pt)?(pt.left!==void 0&&de(Yt(pt.left)),Lt(pt.top)):Lt(pt)}}}),Gk(function(){if(A){var Be=G.slice(Te,Re+1);A(Be,G)}},[Te,Re,G]);var Je=non(G,D,F,a),st=v==null?void 0:v({start:Te,end:Re,virtual:Y,offsetX:le,offsetY:Ne,rtl:O,getSize:Je}),It=Qnn(G,Te,Re,y,le,U,d,ve),ot=null;i&&(ot=nn(Ut({},s?"height":"maxHeight",i),pon),L&&(ot.overflowY="hidden",y&&(ot.overflowX="hidden"),ce&&(ot.pointerEvents="none")));var it={};return O&&(it.dir="rtl"),g.createElement("div",Uo({ref:ee,style:nn(nn({},c),{},{position:"relative"}),className:_},it,M),g.createElement(Ld,{onResize:He},g.createElement(x,{className:"".concat(o,"-holder"),style:ot,ref:Q,onScroll:Pt,onMouseEnter:Et},g.createElement(Gtt,{prefixCls:o,height:Ce,offsetX:le,offsetY:Ne,scrollWidth:y,onInnerResize:W,ref:oe,innerProps:S,rtl:O,extra:st},It))),Y&&Ce>i&&g.createElement($Ce,{ref:Le,prefixCls:o,scrollOffset:Z,scrollRange:Ce,rtl:O,onScroll:St,onStartMove:pe,onStopMove:Ie,spinSize:Oe,containerSize:qe.height,style:b==null?void 0:b.verticalScrollBar,thumbStyle:b==null?void 0:b.verticalScrollBarThumb,showScrollBar:R}),Y&&y>qe.width&&g.createElement($Ce,{ref:Ye,prefixCls:o,scrollOffset:le,scrollRange:y,rtl:O,onScroll:St,onStartMove:pe,onStopMove:Ie,spinSize:lt,containerSize:qe.width,horizontal:!0,style:b==null?void 0:b.horizontalScrollBar,thumbStyle:b==null?void 0:b.horizontalScrollBarThumb,showScrollBar:R}))}var qtt=g.forwardRef(gon);qtt.displayName="List";var w3e=s3e(null),Qtt=s3e(null);function mon(t,e,n){var o=e||1;return n[t+o]-(n[t]||0)}function yon(t){var e=t.rowInfo,n=t.column,o=t.colIndex,r=t.indent,i=t.index,a=t.component,l=t.renderIndex,s=t.record,c=t.style,u=t.className,d=t.inverse,f=t.getHeight,p=n.render,m=n.dataIndex,y=n.className,w=n.width,x=If(Qtt,["columnsOffset"]),C=x.columnsOffset,P=Ltt(e,n,o,r,i),A=P.key,S=P.fixedInfo,v=P.appendCellNode,b=P.additionalCellProps,T=b.style,R=b.colSpan,M=R===void 0?1:R,D=b.rowSpan,k=D===void 0?1:D,N=o-1,U=mon(N,M,C),W=M>1?w-U:0,F=nn(nn(nn({},T),c),{},{flex:"0 0 ".concat(U,"px"),width:"".concat(U,"px"),marginRight:W,pointerEvents:"auto"}),E=g.useMemo(function(){return d?k<=1:M===0||k===0||k>1},[k,M,d]);E?F.visibility="hidden":d&&(F.height=f==null?void 0:f(k));var L=E?function(){return null}:p,j={};return(k===0||M===0)&&(j.rowSpan=1,j.colSpan=1),g.createElement(sI,Uo({className:Bn(y,u),ellipsis:n.ellipsis,align:n.align,scope:n.rowScope,component:a,prefixCls:e.prefixCls,key:A,record:s,index:i,renderIndex:l,dataIndex:m,render:L,shouldCellUpdate:n.shouldCellUpdate},S,{appendNode:v,additionalProps:nn(nn({},b),{},{style:F},j)}))}var Aon=["data","index","className","rowKey","style","extra","getHeight"],won=g.forwardRef(function(t,e){var n=t.data,o=t.index,r=t.className,i=t.rowKey,a=t.style,l=t.extra,s=t.getHeight,c=Ai(t,Aon),u=n.record,d=n.indent,f=n.index,p=If(Kp,["prefixCls","flattenColumns","fixColumn","componentWidth","scrollX"]),m=p.scrollX,y=p.flattenColumns,w=p.prefixCls,x=p.fixColumn,C=p.componentWidth,P=If(w3e,["getComponent"]),A=P.getComponent,S=Ett(u,i,o,d),v=A(["body","row"],"div"),b=A(["body","cell"],"div"),T=S.rowSupportExpand,R=S.expanded,M=S.rowProps,D=S.expandedRowRender,k=S.expandedRowClassName,N;if(T&&R){var U=D(u,o,d+1,R),W=Ftt(k,u,o,d),F={};x&&(F={style:Ut({},"--virtual-width","".concat(C,"px"))});var E="".concat(w,"-expanded-row-cell");N=g.createElement(v,{className:Bn("".concat(w,"-expanded-row"),"".concat(w,"-expanded-row-level-").concat(d+1),W)},g.createElement(sI,{component:b,prefixCls:w,className:Bn(E,Ut({},"".concat(E,"-fixed"),x)),additionalProps:F},U))}var L=nn(nn({},a),{},{width:m});l&&(L.position="absolute",L.pointerEvents="none");var j=g.createElement(v,Uo({},M,c,{"data-row-key":i,ref:T?null:e,className:Bn(r,"".concat(w,"-row"),M==null?void 0:M.className,Ut({},"".concat(w,"-row-extra"),l)),style:nn(nn({},L),M==null?void 0:M.style)}),y.map(function(Y,O){return g.createElement(yon,{key:O,component:b,rowInfo:S,column:Y,colIndex:O,indent:d,index:o,renderIndex:f,record:u,inverse:l,getHeight:s})}));return T?g.createElement("div",{ref:e},j,N):j}),QCe=lI(won),xon=g.forwardRef(function(t,e){var n=t.data,o=t.onScroll,r=If(Kp,["flattenColumns","onColumnResize","getRowKey","prefixCls","expandedKeys","childrenColumnName","scrollX","direction"]),i=r.flattenColumns,a=r.onColumnResize,l=r.getRowKey,s=r.expandedKeys,c=r.prefixCls,u=r.childrenColumnName,d=r.scrollX,f=r.direction,p=If(w3e),m=p.sticky,y=p.scrollY,w=p.listItemHeight,x=p.getComponent,C=p.onScroll,P=g.useRef(),A=Dtt(n,u,s,l),S=g.useMemo(function(){var N=0;return i.map(function(U){var W=U.width,F=U.key;return N+=W,[F,W,N]})},[i]),v=g.useMemo(function(){return S.map(function(N){return N[2]})},[S]);g.useEffect(function(){S.forEach(function(N){var U=Sn(N,2),W=U[0],F=U[1];a(W,F)})},[S]),g.useImperativeHandle(e,function(){var N,U={scrollTo:function(F){var E;(E=P.current)===null||E===void 0||E.scrollTo(F)},nativeElement:(N=P.current)===null||N===void 0?void 0:N.nativeElement};return Object.defineProperty(U,"scrollLeft",{get:function(){var F;return((F=P.current)===null||F===void 0?void 0:F.getScrollInfo().x)||0},set:function(F){var E;(E=P.current)===null||E===void 0||E.scrollTo({left:F})}}),U});var b=function(U,W){var F,E=(F=A[W])===null||F===void 0?void 0:F.record,L=U.onCell;if(L){var j,Y=L(E,W);return(j=Y==null?void 0:Y.rowSpan)!==null&&j!==void 0?j:1}return 1},T=function(U){var W=U.start,F=U.end,E=U.getSize,L=U.offsetY;if(F<0)return null;for(var j=i.filter(function(te){return b(te,W)===0}),Y=W,O=function(q){if(j=j.filter(function(le){return b(le,q)===0}),!j.length)return Y=q,1},_=W;_>=0&&!O(_);_-=1);for(var G=i.filter(function(te){return b(te,F)!==1}),Q=F,oe=function(q){if(G=G.filter(function(le){return b(le,q)!==1}),!G.length)return Q=Math.max(q-1,F),1},ee=F;ee1})&&$.push(q)},Z=Y;Z<=Q;Z+=1)ae(Z);var ne=$.map(function(te){var q=A[te],le=l(q.record,te),de=function(ce){var Pe=te+ce-1,pe=l(A[Pe].record,Pe),Ie=E(le,pe);return Ie.bottom-Ie.top},he=E(le);return g.createElement(QCe,{key:te,data:q,rowKey:le,index:te,style:{top:-L+he.top},extra:!0,getHeight:de})});return ne},R=g.useMemo(function(){return{columnsOffset:v}},[v]),M="".concat(c,"-tbody"),D=x(["body","wrapper"]),k={};return m&&(k.position="sticky",k.bottom=0,Vr(m)==="object"&&m.offsetScroll&&(k.bottom=m.offsetScroll)),g.createElement(Qtt.Provider,{value:R},g.createElement(qtt,{fullHeight:!1,ref:P,prefixCls:"".concat(M,"-virtual"),styles:{horizontalScrollBar:k},className:M,height:y,itemHeight:w||24,data:A,itemKey:function(U){return l(U.record)},component:D,scrollWidth:d,direction:f,onVirtualScroll:function(U){var W,F=U.x;o({currentTarget:(W=P.current)===null||W===void 0?void 0:W.nativeElement,scrollLeft:F})},onScroll:C,extraRender:T},function(N,U,W){var F=l(N.record,U);return g.createElement(QCe,{data:N,rowKey:F,index:U,style:W.style})}))}),von=lI(xon),bon=function(e,n){var o=n.ref,r=n.onScroll;return g.createElement(von,{ref:o,data:e,onScroll:r})};function Son(t,e){var n=t.data,o=t.columns,r=t.scroll,i=t.sticky,a=t.prefixCls,l=a===void 0?_tt:a,s=t.className,c=t.listItemHeight,u=t.components,d=t.onScroll,f=r||{},p=f.x,m=f.y;typeof p!="number"&&(p=1),typeof m!="number"&&(m=500);var y=qb(function(C,P){return u3e(u,C)||P}),w=qb(d),x=g.useMemo(function(){return{sticky:i,scrollY:m,listItemHeight:c,getComponent:y,onScroll:w}},[i,m,c,y,w]);return g.createElement(w3e.Provider,{value:x},g.createElement(cI,Uo({},t,{className:Bn(s,"".concat(l,"-virtual")),scroll:nn(nn({},r),{},{x:p}),components:nn(nn({},u),{},{body:n!=null&&n.length?bon:void 0}),columns:o,internalHooks:TU,tailor:!0,ref:e})))}var Ton=g.forwardRef(Son);function Ztt(t){return Att(Ton,t)}Ztt();const Pon=t=>null,Con=t=>null;var x3e=g.createContext(null),Ron=g.createContext({}),Hon=function(e){for(var n=e.prefixCls,o=e.level,r=e.isStart,i=e.isEnd,a="".concat(n,"-indent-unit"),l=[],s=0;s=0&&n.splice(o,1),n}function rA(t,e){var n=(t||[]).slice();return n.indexOf(e)===-1&&n.push(e),n}function v3e(t){return t.split("-")}function Don(t,e){var n=[],o=m1(e,t);function r(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(a){var l=a.key,s=a.children;n.push(l),r(s)})}return r(o.children),n}function Eon(t){if(t.parent){var e=v3e(t.pos);return Number(e[e.length-1])===t.parent.children.length-1}return!1}function kon(t){var e=v3e(t.pos);return Number(e[e.length-1])===0}function tRe(t,e,n,o,r,i,a,l,s,c){var u,d=t.clientX,f=t.clientY,p=t.target.getBoundingClientRect(),m=p.top,y=p.height,w=(c==="rtl"?-1:1)*(((r==null?void 0:r.x)||0)-d),x=(w-12)/o,C=s.filter(function(F){var E;return(E=l[F])===null||E===void 0||(E=E.children)===null||E===void 0?void 0:E.length}),P=m1(l,n.eventKey);if(f-1.5?i({dragNode:N,dropNode:U,dropPosition:1})?M=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:0})?M=0:i({dragNode:N,dropNode:U,dropPosition:1})?M=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:1})?M=1:W=!1,{dropPosition:M,dropLevelOffset:D,dropTargetKey:P.key,dropTargetPos:P.pos,dragOverNodeKey:R,dropContainerKey:M===0?null:((u=P.parent)===null||u===void 0?void 0:u.key)||null,dropAllowed:W}}function nRe(t,e){if(t){var n=e.multiple;return n?t.slice():t.length?[t[0]]:t}}function sse(t){if(!t)return null;var e;if(Array.isArray(t))e={checkedKeys:t,halfCheckedKeys:void 0};else if(Vr(t)==="object")e={checkedKeys:t.checked||void 0,halfCheckedKeys:t.halfChecked||void 0};else return Ds(!1,"`checkedKeys` is not an array or an object"),null;return e}function qhe(t,e){var n=new Set;function o(r){if(!n.has(r)){var i=m1(e,r);if(i){n.add(r);var a=i.parent,l=i.node;l.disabled||a&&o(a.key)}}}return(t||[]).forEach(function(r){o(r)}),$o(n)}function Fon(t){const[e,n]=g.useState(null);return[g.useCallback((i,a,l)=>{const s=e??i,c=Math.min(s||0,i),u=Math.max(s||0,i),d=a.slice(c,u+1).map(m=>t(m)),f=d.some(m=>!l.has(m)),p=[];return d.forEach(m=>{f?(l.has(m)||p.push(m),l.add(m)):(l.delete(m),p.push(m))}),n(f?u:null),p},[e]),i=>{n(i)}]}const zw={},Qhe="SELECT_ALL",Zhe="SELECT_INVERT",epe="SELECT_NONE",oRe=[],ent=(t,e)=>{let n=[];return(e||[]).forEach(o=>{n.push(o),o&&typeof o=="object"&&t in o&&(n=[].concat(Pa(n),Pa(ent(t,o[t]))))}),n},Lon=(t,e)=>{const{preserveSelectedRowKeys:n,selectedRowKeys:o,defaultSelectedRowKeys:r,getCheckboxProps:i,onChange:a,onSelect:l,onSelectAll:s,onSelectInvert:c,onSelectNone:u,onSelectMultiple:d,columnWidth:f,type:p,selections:m,fixed:y,renderCell:w,hideSelectAll:x,checkStrictly:C=!0}=e||{},{prefixCls:P,data:A,pageData:S,getRecordByKey:v,getRowKey:b,expandType:T,childrenColumnName:R,locale:M,getPopupContainer:D}=t,k=LS(),[N,U]=Fon(te=>te),[W,F]=qA(o||r||oRe,{value:o}),E=g.useRef(new Map),L=g.useCallback(te=>{if(n){const q=new Map;te.forEach(le=>{let de=v(le);!de&&E.current.has(le)&&(de=E.current.get(le)),q.set(le,de)}),E.current=q}},[v,n]);g.useEffect(()=>{L(W)},[W]);const j=g.useMemo(()=>ent(R,S),[R,S]),{keyEntities:Y}=g.useMemo(()=>{if(C)return{keyEntities:null};let te=A;if(n){const q=new Set(j.map((de,he)=>b(de,he))),le=Array.from(E.current).reduce((de,he)=>{let[me,ce]=he;return q.has(me)?de:de.concat(ce)},[]);te=[].concat(Pa(te),Pa(le))}return $9e(te,{externalGetKey:b,childrenPropName:R})},[A,b,C,R,n,j]),O=g.useMemo(()=>{const te=new Map;return j.forEach((q,le)=>{const de=b(q,le),he=(i?i(q):null)||{};te.set(de,he)}),te},[j,b,i]),_=g.useCallback(te=>{const q=b(te);let le;return O.has(q)?le=O.get(b(te)):le=i?i(te):void 0,!!(le!=null&&le.disabled)},[O,b]),[G,Q]=g.useMemo(()=>{if(C)return[W||[],[]];const{checkedKeys:te,halfCheckedKeys:q}=kR(W,!0,Y,_);return[te||[],q]},[W,C,Y,_]),oe=g.useMemo(()=>{const te=p==="radio"?G.slice(0,1):G;return new Set(te)},[G,p]),ee=g.useMemo(()=>p==="radio"?new Set:new Set(Q),[Q,p]);g.useEffect(()=>{e||F(oRe)},[!!e]);const $=g.useCallback((te,q)=>{let le,de;L(te),n?(le=te,de=te.map(he=>E.current.get(he))):(le=[],de=[],te.forEach(he=>{const me=v(he);me!==void 0&&(le.push(he),de.push(me))})),F(le),a==null||a(le,de,{type:q})},[F,v,a,n]),ae=g.useCallback((te,q,le,de)=>{if(l){const he=le.map(me=>v(me));l(v(te),q,he,de)}$(le,"single")},[l,v,$]),Z=g.useMemo(()=>!m||x?null:(m===!0?[Qhe,Zhe,epe]:m).map(q=>q===Qhe?{key:"all",text:M.selectionAll,onSelect(){$(A.map((le,de)=>b(le,de)).filter(le=>{const de=O.get(le);return!(de!=null&&de.disabled)||oe.has(le)}),"all")}}:q===Zhe?{key:"invert",text:M.selectInvert,onSelect(){const le=new Set(oe);S.forEach((he,me)=>{const ce=b(he,me),Pe=O.get(ce);Pe!=null&&Pe.disabled||(le.has(ce)?le.delete(ce):le.add(ce))});const de=Array.from(le);c&&(k.deprecated(!1,"onSelectInvert","onChange"),c(de)),$(de,"invert")}}:q===epe?{key:"none",text:M.selectNone,onSelect(){u==null||u(),$(Array.from(oe).filter(le=>{const de=O.get(le);return de==null?void 0:de.disabled}),"none")}}:q).map(q=>Object.assign(Object.assign({},q),{onSelect:function(){for(var le,de,he=arguments.length,me=new Array(he),ce=0;ce{var q;if(!e)return te.filter(Te=>Te!==zw);let le=Pa(te);const de=new Set(oe),he=j.map(b).filter(Te=>!O.get(Te).disabled),me=he.every(Te=>de.has(Te)),ce=he.some(Te=>de.has(Te)),Pe=()=>{const Te=[];me?he.forEach(Ne=>{de.delete(Ne),Te.push(Ne)}):he.forEach(Ne=>{de.has(Ne)||(de.add(Ne),Te.push(Ne))});const Re=Array.from(de);s==null||s(!me,Re.map(Ne=>v(Ne)),Te.map(Ne=>v(Ne))),$(Re,"all"),U(null)};let pe,Ie;if(p!=="radio"){let Te;if(Z){const qe={getPopupContainer:D,items:Z.map((Fe,He)=>{const{key:Le,text:Ye,onSelect:lt}=Fe;return{key:Le??He,onClick:()=>{lt==null||lt(he)},label:Ye}})};Te=g.createElement("div",{className:`${P}-selection-extra`},g.createElement(e4,{menu:qe,getPopupContainer:D},g.createElement("span",null,g.createElement(RZ,null))))}const Re=j.map((qe,Fe)=>{const He=b(qe,Fe),Le=O.get(He)||{};return Object.assign({checked:de.has(He)},Le)}).filter(qe=>{let{disabled:Fe}=qe;return Fe}),Ne=!!Re.length&&Re.length===j.length,_e=Ne&&Re.every(qe=>{let{checked:Fe}=qe;return Fe}),Ue=Ne&&Re.some(qe=>{let{checked:Fe}=qe;return Fe});Ie=g.createElement(Li,{checked:Ne?_e:!!j.length&&me,indeterminate:Ne?!_e&&Ue:!me&&ce,onChange:Pe,disabled:j.length===0||Ne,"aria-label":Te?"Custom selection":"Select all",skipGroup:!0}),pe=!x&&g.createElement("div",{className:`${P}-selection`},Ie,Te)}let ve;p==="radio"?ve=(Te,Re,Ne)=>{const _e=b(Re,Ne),Ue=de.has(_e),qe=O.get(_e);return{node:g.createElement(We,Object.assign({},qe,{checked:Ue,onClick:Fe=>{var He;Fe.stopPropagation(),(He=qe==null?void 0:qe.onClick)===null||He===void 0||He.call(qe,Fe)},onChange:Fe=>{var He;de.has(_e)||ae(_e,!0,[_e],Fe.nativeEvent),(He=qe==null?void 0:qe.onChange)===null||He===void 0||He.call(qe,Fe)}})),checked:Ue}}:ve=(Te,Re,Ne)=>{var _e;const Ue=b(Re,Ne),qe=de.has(Ue),Fe=ee.has(Ue),He=O.get(Ue);let Le;return T==="nest"?Le=Fe:Le=(_e=He==null?void 0:He.indeterminate)!==null&&_e!==void 0?_e:Fe,{node:g.createElement(Li,Object.assign({},He,{indeterminate:Le,checked:qe,skipGroup:!0,onClick:Ye=>{var lt;Ye.stopPropagation(),(lt=He==null?void 0:He.onClick)===null||lt===void 0||lt.call(He,Ye)},onChange:Ye=>{var lt;const{nativeEvent:Oe}=Ye,{shiftKey:ut}=Oe,ht=he.findIndex(nt=>nt===Ue),Qe=G.some(nt=>he.includes(nt));if(ut&&C&&Qe){const nt=N(ht,he,de),mt=Array.from(de);d==null||d(!qe,mt.map(tt=>v(tt)),nt.map(tt=>v(tt))),$(mt,"multiple")}else{const nt=G;if(C){const mt=qe?k9(nt,Ue):rA(nt,Ue);ae(Ue,!qe,mt,Oe)}else{const mt=kR([].concat(Pa(nt),[Ue]),!0,Y,_),{checkedKeys:tt,halfCheckedKeys:gt}=mt;let Ve=tt;if(qe){const je=new Set(tt);je.delete(Ue),Ve=kR(Array.from(je),{halfCheckedKeys:gt},Y,_).checkedKeys}ae(Ue,!qe,Ve,Oe)}}U(qe?null:ht),(lt=He==null?void 0:He.onChange)===null||lt===void 0||lt.call(He,Ye)}})),checked:qe}};const ze=(Te,Re,Ne)=>{const{node:_e,checked:Ue}=ve(Te,Re,Ne);return w?w(Ue,Re,Ne,_e):_e};if(!le.includes(zw))if(le.findIndex(Te=>{var Re;return((Re=Te[Vk])===null||Re===void 0?void 0:Re.columnType)==="EXPAND_COLUMN"})===0){const[Te,...Re]=le;le=[Te,zw].concat(Pa(Re))}else le=[zw].concat(Pa(le));const Ae=le.indexOf(zw);le=le.filter((Te,Re)=>Te!==zw||Re===Ae);const se=le[Ae-1],ge=le[Ae+1];let we=y;we===void 0&&((ge==null?void 0:ge.fixed)!==void 0?we=ge.fixed:(se==null?void 0:se.fixed)!==void 0&&(we=se.fixed)),we&&se&&((q=se[Vk])===null||q===void 0?void 0:q.columnType)==="EXPAND_COLUMN"&&se.fixed===void 0&&(se.fixed=we);const Se=Mn(`${P}-selection-col`,{[`${P}-selection-col-with-dropdown`]:m&&p==="checkbox"}),Me=()=>e!=null&&e.columnTitle?typeof e.columnTitle=="function"?e.columnTitle(Ie):e.columnTitle:pe,Ce={fixed:we,width:f,className:`${P}-selection-column`,title:Me(),render:ze,onCell:e.onCell,[Vk]:{className:Se}};return le.map(Te=>Te===zw?Ce:Te)},[b,j,e,G,oe,ee,f,Z,T,O,d,ae,_]),oe]};function Won(t,e){return t._antProxy=t._antProxy||{},Object.keys(e).forEach(n=>{if(!(n in t._antProxy)){const o=t[n];t._antProxy[n]=o,t[n]=e[n]}}),t}function Non(t,e){return g.useImperativeHandle(t,()=>{const n=e(),{nativeElement:o}=n;return typeof Proxy<"u"?new Proxy(o,{get(r,i){return n[i]?n[i]:Reflect.get(r,i)}}):Won(o,n)})}function Uon(t){return e=>{const{prefixCls:n,onExpand:o,record:r,expanded:i,expandable:a}=e,l=`${n}-row-expand-icon`;return g.createElement("button",{type:"button",onClick:s=>{o(r,s),s.stopPropagation()},className:Mn(l,{[`${l}-spaced`]:!a,[`${l}-expanded`]:a&&i,[`${l}-collapsed`]:a&&!i}),"aria-label":i?t.collapse:t.expand,"aria-expanded":i})}}function jon(t){return(n,o)=>{const r=n.querySelector(`.${t}-container`);let i=o;if(r){const a=getComputedStyle(r),l=parseInt(a.borderLeftWidth,10),s=parseInt(a.borderRightWidth,10);i=o-l-s}return i}}const l7=(t,e)=>"key"in t&&t.key!==void 0&&t.key!==null?t.key:t.dataIndex?Array.isArray(t.dataIndex)?t.dataIndex.join("."):t.dataIndex:e;function uI(t,e){return e?`${e}-${t}`:`${t}`}const Bee=(t,e)=>typeof t=="function"?t(e):t,Bon=(t,e)=>{const n=Bee(t,e);return Object.prototype.toString.call(n)==="[object Object]"?"":n};function Yon(t){const e=g.useRef(t),n=mQe();return[()=>e.current,o=>{e.current=o,n()}]}var Oon=function(e){var n=e.dropPosition,o=e.dropLevelOffset,r=e.indent,i={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(n){case-1:i.top=0,i.left=-o*r;break;case 1:i.bottom=0,i.left=-o*r;break;case 0:i.bottom=0,i.left=r;break}return xe.createElement("div",{style:i})};function tnt(t){if(t==null)throw new TypeError("Cannot destructure "+t)}function _on(t,e){var n=g.useState(!1),o=Sn(n,2),r=o[0],i=o[1];Ml(function(){if(r)return t(),function(){e()}},[r]),Ml(function(){return i(!0),function(){i(!1)}},[])}var Von=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],Gon=g.forwardRef(function(t,e){var n=t.className,o=t.style,r=t.motion,i=t.motionNodes,a=t.motionType,l=t.onMotionStart,s=t.onMotionEnd,c=t.active,u=t.treeNodeRequiredProps,d=Ai(t,Von),f=g.useState(!0),p=Sn(f,2),m=p[0],y=p[1],w=g.useContext(x3e),x=w.prefixCls,C=i&&a!=="hide";Ml(function(){i&&C!==m&&y(C)},[i]);var P=function(){i&&l()},A=g.useRef(!1),S=function(){i&&!A.current&&(A.current=!0,s())};_on(P,S);var v=function(T){C===T&&S()};return i?g.createElement(Oy,Uo({ref:e,visible:m},r,{motionAppear:a==="show",onVisibleChanged:v}),function(b,T){var R=b.className,M=b.style;return g.createElement("div",{ref:T,className:Bn("".concat(x,"-treenode-motion"),R),style:M},i.map(function(D){var k=Object.assign({},(tnt(D.data),D.data)),N=D.title,U=D.key,W=D.isStart,F=D.isEnd;delete k.children;var E=_k(U,u);return g.createElement(jL,Uo({},k,E,{title:N,active:c,data:D.data,key:U,isStart:W,isEnd:F}))}))}):g.createElement(jL,Uo({domRef:e,className:n,style:o},d,{active:c}))});function Xon(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=t.length,o=e.length;if(Math.abs(n-o)!==1)return{add:!1,key:null};function r(i,a){var l=new Map;i.forEach(function(c){l.set(c,!0)});var s=a.filter(function(c){return!l.has(c)});return s.length===1?s[0]:null}return n ").concat(e);return e}var qon=g.forwardRef(function(t,e){var n=t.prefixCls,o=t.data;t.selectable,t.checkable;var r=t.expandedKeys,i=t.selectedKeys,a=t.checkedKeys,l=t.loadedKeys,s=t.loadingKeys,c=t.halfCheckedKeys,u=t.keyEntities,d=t.disabled,f=t.dragging,p=t.dragOverNodeKey,m=t.dropPosition,y=t.motion,w=t.height,x=t.itemHeight,C=t.virtual,P=t.scrollWidth,A=t.focusable,S=t.activeItem,v=t.focused,b=t.tabIndex,T=t.onKeyDown,R=t.onFocus,M=t.onBlur,D=t.onActiveChange,k=t.onListChangeStart,N=t.onListChangeEnd,U=Ai(t,Jon),W=g.useRef(null),F=g.useRef(null);g.useImperativeHandle(e,function(){return{scrollTo:function(ze){W.current.scrollTo(ze)},getIndentWidth:function(){return F.current.offsetWidth}}});var E=g.useState(r),L=Sn(E,2),j=L[0],Y=L[1],O=g.useState(o),_=Sn(O,2),G=_[0],Q=_[1],oe=g.useState(o),ee=Sn(oe,2),$=ee[0],ae=ee[1],Z=g.useState([]),ne=Sn(Z,2),te=ne[0],q=ne[1],le=g.useState(null),de=Sn(le,2),he=de[0],me=de[1],ce=g.useRef(o);ce.current=o;function Pe(){var ve=ce.current;Q(ve),ae(ve),q([]),me(null),N()}Ml(function(){Y(r);var ve=Xon(j,r);if(ve.key!==null)if(ve.add){var ze=G.findIndex(function(Me){var Ce=Me.key;return Ce===ve.key}),Ae=lRe(rRe(G,o,ve.key),C,w,x),se=G.slice();se.splice(ze+1,0,aRe),ae(se),q(Ae),me("show")}else{var ge=o.findIndex(function(Me){var Ce=Me.key;return Ce===ve.key}),we=lRe(rRe(o,G,ve.key),C,w,x),Se=o.slice();Se.splice(ge+1,0,aRe),ae(Se),q(we),me("hide")}else G!==o&&(Q(o),ae(o))},[r,o]),g.useEffect(function(){f||Pe()},[f]);var pe=y?$:o,Ie={expandedKeys:r,selectedKeys:i,loadedKeys:l,loadingKeys:s,checkedKeys:a,halfCheckedKeys:c,dragOverNodeKey:p,dropPosition:m,keyEntities:u};return g.createElement(g.Fragment,null,v&&S&&g.createElement("span",{style:iRe,"aria-live":"assertive"},$on(S)),g.createElement("div",null,g.createElement("input",{style:iRe,disabled:A===!1||d,tabIndex:A!==!1?b:null,onKeyDown:T,onFocus:R,onBlur:M,value:"",onChange:Kon,"aria-label":"for screen reader"})),g.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},g.createElement("div",{className:"".concat(n,"-indent")},g.createElement("div",{ref:F,className:"".concat(n,"-indent-unit")}))),g.createElement(g9e,Uo({},U,{data:pe,itemKey:sRe,height:w,fullHeight:!1,virtual:C,itemHeight:x,scrollWidth:P,prefixCls:"".concat(n,"-list"),ref:W,role:"tree",onVisibleChange:function(ze){ze.every(function(Ae){return sRe(Ae)!==Qb})&&Pe()}}),function(ve){var ze=ve.pos,Ae=Object.assign({},(tnt(ve.data),ve.data)),se=ve.title,ge=ve.key,we=ve.isStart,Se=ve.isEnd,Me=bU(ge,ze);delete Ae.key,delete Ae.children;var Ce=_k(Me,Ie);return g.createElement(Gon,Uo({},Ae,Ce,{title:se,active:!!S&&ge===S.key,pos:ze,data:ve.data,isStart:we,isEnd:Se,motion:y,motionNodes:ge===Qb?te:null,motionType:he,onMotionStart:k,onMotionEnd:Pe,treeNodeRequiredProps:Ie,onMouseMove:function(){D(null)}}))}))}),Qon=10,b3e=function(t){XM(n,t);var e=JM(n);function n(){var o;Uh(this,n);for(var r=arguments.length,i=new Array(r),a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,d=o.state,f=d.dragChildrenKeys,p=d.dropPosition,m=d.dropTargetKey,y=d.dropTargetPos,w=d.dropAllowed;if(w){var x=o.props.onDrop;if(o.setState({dragOverNodeKey:null}),o.cleanDragState(),m!==null){var C=nn(nn({},_k(m,o.getTreeNodeRequiredProps())),{},{active:((c=o.getActiveItem())===null||c===void 0?void 0:c.key)===m,data:m1(o.state.keyEntities,m).node}),P=f.includes(m);Ds(!P,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var A=v3e(y),S={event:l,node:g0(C),dragNode:o.dragNodeProps?g0(o.dragNodeProps):null,dragNodesKeys:[o.dragNodeProps.eventKey].concat(f),dropToGap:p!==0,dropPosition:p+Number(A[A.length-1])};u||x==null||x(S),o.dragNodeProps=null}}}),Ut(kr(o),"cleanDragState",function(){var l=o.state.draggingNodeKey;l!==null&&o.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),o.dragStartMousePosition=null,o.currentMouseOverDroppableNodeKey=null}),Ut(kr(o),"triggerExpandActionExpand",function(l,s){var c=o.state,u=c.expandedKeys,d=c.flattenNodes,f=s.expanded,p=s.key,m=s.isLeaf;if(!(m||l.shiftKey||l.metaKey||l.ctrlKey)){var y=d.filter(function(x){return x.key===p})[0],w=g0(nn(nn({},_k(p,o.getTreeNodeRequiredProps())),{},{data:y.data}));o.setExpandedKeys(f?k9(u,p):rA(u,p)),o.onNodeExpand(l,w)}}),Ut(kr(o),"onNodeClick",function(l,s){var c=o.props,u=c.onClick,d=c.expandAction;d==="click"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Ut(kr(o),"onNodeDoubleClick",function(l,s){var c=o.props,u=c.onDoubleClick,d=c.expandAction;d==="doubleClick"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Ut(kr(o),"onNodeSelect",function(l,s){var c=o.state.selectedKeys,u=o.state,d=u.keyEntities,f=u.fieldNames,p=o.props,m=p.onSelect,y=p.multiple,w=s.selected,x=s[f.key],C=!w;C?y?c=rA(c,x):c=[x]:c=k9(c,x);var P=c.map(function(A){var S=m1(d,A);return S?S.node:null}).filter(Boolean);o.setUncontrolledState({selectedKeys:c}),m==null||m(c,{event:"select",selected:C,node:s,selectedNodes:P,nativeEvent:l.nativeEvent})}),Ut(kr(o),"onNodeCheck",function(l,s,c){var u=o.state,d=u.keyEntities,f=u.checkedKeys,p=u.halfCheckedKeys,m=o.props,y=m.checkStrictly,w=m.onCheck,x=s.key,C,P={event:"check",node:s,checked:c,nativeEvent:l.nativeEvent};if(y){var A=c?rA(f,x):k9(f,x),S=k9(p,x);C={checked:A,halfChecked:S},P.checkedNodes=A.map(function(D){return m1(d,D)}).filter(Boolean).map(function(D){return D.node}),o.setUncontrolledState({checkedKeys:A})}else{var v=kR([].concat($o(f),[x]),!0,d),b=v.checkedKeys,T=v.halfCheckedKeys;if(!c){var R=new Set(b);R.delete(x);var M=kR(Array.from(R),{halfCheckedKeys:T},d);b=M.checkedKeys,T=M.halfCheckedKeys}C=b,P.checkedNodes=[],P.checkedNodesPositions=[],P.halfCheckedKeys=T,b.forEach(function(D){var k=m1(d,D);if(k){var N=k.node,U=k.pos;P.checkedNodes.push(N),P.checkedNodesPositions.push({node:N,pos:U})}}),o.setUncontrolledState({checkedKeys:b},!1,{halfCheckedKeys:T})}w==null||w(C,P)}),Ut(kr(o),"onNodeLoad",function(l){var s,c=l.key,u=o.state.keyEntities,d=m1(u,c);if(!(d!=null&&(s=d.children)!==null&&s!==void 0&&s.length)){var f=new Promise(function(p,m){o.setState(function(y){var w=y.loadedKeys,x=w===void 0?[]:w,C=y.loadingKeys,P=C===void 0?[]:C,A=o.props,S=A.loadData,v=A.onLoad;if(!S||x.includes(c)||P.includes(c))return null;var b=S(l);return b.then(function(){var T=o.state.loadedKeys,R=rA(T,c);v==null||v(R,{event:"load",node:l}),o.setUncontrolledState({loadedKeys:R}),o.setState(function(M){return{loadingKeys:k9(M.loadingKeys,c)}}),p()}).catch(function(T){if(o.setState(function(M){return{loadingKeys:k9(M.loadingKeys,c)}}),o.loadingRetryTimes[c]=(o.loadingRetryTimes[c]||0)+1,o.loadingRetryTimes[c]>=Qon){var R=o.state.loadedKeys;Ds(!1,"Retry for `loadData` many times but still failed. No more retry."),o.setUncontrolledState({loadedKeys:rA(R,c)}),p()}m(T)}),{loadingKeys:rA(P,c)}})});return f.catch(function(){}),f}}),Ut(kr(o),"onNodeMouseEnter",function(l,s){var c=o.props.onMouseEnter;c==null||c({event:l,node:s})}),Ut(kr(o),"onNodeMouseLeave",function(l,s){var c=o.props.onMouseLeave;c==null||c({event:l,node:s})}),Ut(kr(o),"onNodeContextMenu",function(l,s){var c=o.props.onRightClick;c&&(l.preventDefault(),c({event:l,node:s}))}),Ut(kr(o),"onFocus",function(){var l=o.props.onFocus;o.setState({focused:!0});for(var s=arguments.length,c=new Array(s),u=0;u1&&arguments[1]!==void 0?arguments[1]:!1,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!o.destroyed){var u=!1,d=!0,f={};Object.keys(l).forEach(function(p){if(o.props.hasOwnProperty(p)){d=!1;return}u=!0,f[p]=l[p]}),u&&(!s||d)&&o.setState(nn(nn({},f),c))}}),Ut(kr(o),"scrollTo",function(l){o.listRef.current.scrollTo(l)}),o}return jh(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var r=this.props,i=r.activeKey,a=r.itemScrollOffset,l=a===void 0?0:a;i!==void 0&&i!==this.state.activeKey&&(this.setState({activeKey:i}),i!==null&&this.scrollTo({key:i,offset:l}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var r=this.state,i=r.focused,a=r.flattenNodes,l=r.keyEntities,s=r.draggingNodeKey,c=r.activeKey,u=r.dropLevelOffset,d=r.dropContainerKey,f=r.dropTargetKey,p=r.dropPosition,m=r.dragOverNodeKey,y=r.indent,w=this.props,x=w.prefixCls,C=w.className,P=w.style,A=w.showLine,S=w.focusable,v=w.tabIndex,b=v===void 0?0:v,T=w.selectable,R=w.showIcon,M=w.icon,D=w.switcherIcon,k=w.draggable,N=w.checkable,U=w.checkStrictly,W=w.disabled,F=w.motion,E=w.loadData,L=w.filterTreeNode,j=w.height,Y=w.itemHeight,O=w.scrollWidth,_=w.virtual,G=w.titleRender,Q=w.dropIndicatorRender,oe=w.onContextMenu,ee=w.onScroll,$=w.direction,ae=w.rootClassName,Z=w.rootStyle,ne=F1(this.props,{aria:!0,data:!0}),te;k&&(Vr(k)==="object"?te=k:typeof k=="function"?te={nodeDraggable:k}:te={});var q={prefixCls:x,selectable:T,showIcon:R,icon:M,switcherIcon:D,draggable:te,draggingNodeKey:s,checkable:N,checkStrictly:U,disabled:W,keyEntities:l,dropLevelOffset:u,dropContainerKey:d,dropTargetKey:f,dropPosition:p,dragOverNodeKey:m,indent:y,direction:$,dropIndicatorRender:Q,loadData:E,filterTreeNode:L,titleRender:G,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return g.createElement(x3e.Provider,{value:q},g.createElement("div",{className:Bn(x,C,ae,Ut(Ut(Ut({},"".concat(x,"-show-line"),A),"".concat(x,"-focused"),i),"".concat(x,"-active-focused"),c!==null)),style:Z},g.createElement(qon,Uo({ref:this.listRef,prefixCls:x,style:P,data:a,disabled:W,selectable:T,checkable:!!N,motion:F,dragging:s!==null,height:j,itemHeight:Y,virtual:_,focusable:S,focused:i,tabIndex:b,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:oe,onScroll:ee,scrollWidth:O},this.getTreeNodeRequiredProps(),ne))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){var a=i.prevProps,l={prevProps:r};function s(b){return!a&&r.hasOwnProperty(b)||a&&a[b]!==r[b]}var c,u=i.fieldNames;if(s("fieldNames")&&(u=TH(r.fieldNames),l.fieldNames=u),s("treeData")?c=r.treeData:s("children")&&(Ds(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),c=det(r.children)),c){l.treeData=c;var d=$9e(c,{fieldNames:u});l.keyEntities=nn(Ut({},Qb,nnt),d.keyEntities)}var f=l.keyEntities||i.keyEntities;if(s("expandedKeys")||a&&s("autoExpandParent"))l.expandedKeys=r.autoExpandParent||!a&&r.defaultExpandParent?qhe(r.expandedKeys,f):r.expandedKeys;else if(!a&&r.defaultExpandAll){var p=nn({},f);delete p[Qb];var m=[];Object.keys(p).forEach(function(b){var T=p[b];T.children&&T.children.length&&m.push(T.key)}),l.expandedKeys=m}else!a&&r.defaultExpandedKeys&&(l.expandedKeys=r.autoExpandParent||r.defaultExpandParent?qhe(r.defaultExpandedKeys,f):r.defaultExpandedKeys);if(l.expandedKeys||delete l.expandedKeys,c||l.expandedKeys){var y=Zle(c||i.treeData,l.expandedKeys||i.expandedKeys,u);l.flattenNodes=y}if(r.selectable&&(s("selectedKeys")?l.selectedKeys=nRe(r.selectedKeys,r):!a&&r.defaultSelectedKeys&&(l.selectedKeys=nRe(r.defaultSelectedKeys,r))),r.checkable){var w;if(s("checkedKeys")?w=sse(r.checkedKeys)||{}:!a&&r.defaultCheckedKeys?w=sse(r.defaultCheckedKeys)||{}:c&&(w=sse(r.checkedKeys)||{checkedKeys:i.checkedKeys,halfCheckedKeys:i.halfCheckedKeys}),w){var x=w,C=x.checkedKeys,P=C===void 0?[]:C,A=x.halfCheckedKeys,S=A===void 0?[]:A;if(!r.checkStrictly){var v=kR(P,!0,f);P=v.checkedKeys,S=v.halfCheckedKeys}l.checkedKeys=P,l.halfCheckedKeys=S}}return s("loadedKeys")&&(l.loadedKeys=r.loadedKeys),l}}]),n}(g.Component);Ut(b3e,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:Oon,allowDrop:function(){return!0},expandAction:!1});Ut(b3e,"TreeNode",jL);const Zon=t=>{let{treeCls:e,treeNodeCls:n,directoryNodeSelectedBg:o,directoryNodeSelectedColor:r,motionDurationMid:i,borderRadius:a,controlItemBgHover:l}=t;return{[`${e}${e}-directory ${n}`]:{[`${e}-node-content-wrapper`]:{position:"static",[`> *:not(${e}-drop-indicator)`]:{position:"relative"},"&:hover":{background:"transparent"},"&:before":{position:"absolute",inset:0,transition:`background-color ${i}`,content:'""',borderRadius:a},"&:hover:before":{background:l}},[`${e}-switcher, ${e}-checkbox, ${e}-draggable-icon`]:{zIndex:1},"&-selected":{[`${e}-switcher, ${e}-draggable-icon`]:{color:r},[`${e}-node-content-wrapper`]:{color:r,background:"transparent","&:before, &:hover:before":{background:o}}}}}},ern=new xa("ant-tree-node-fx-do-not-use",{"0%":{opacity:0},"100%":{opacity:1}}),trn=(t,e)=>({[`.${t}-switcher-icon`]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:`transform ${e.motionDurationSlow}`}}}),nrn=(t,e)=>({[`.${t}-drop-indicator`]:{position:"absolute",zIndex:1,height:2,backgroundColor:e.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:`${jt(e.lineWidthBold)} solid ${e.colorPrimary}`,borderRadius:"50%",content:'""'}}}),orn=(t,e)=>{const{treeCls:n,treeNodeCls:o,treeNodePadding:r,titleHeight:i,indentSize:a,nodeSelectedBg:l,nodeHoverBg:s,colorTextQuaternary:c,controlItemBgActiveDisabled:u}=e;return{[n]:Object.assign(Object.assign({},Ua(e)),{background:e.colorBgContainer,borderRadius:e.borderRadius,transition:`background-color ${e.motionDurationSlow}`,"&-rtl":{direction:"rtl"},[`&${n}-rtl ${n}-switcher_close ${n}-switcher-icon svg`]:{transform:"rotate(90deg)"},[`&-focused:not(:hover):not(${n}-active-focused)`]:Object.assign({},z3(e)),[`${n}-list-holder-inner`]:{alignItems:"flex-start"},[`&${n}-block-node`]:{[`${n}-list-holder-inner`]:{alignItems:"stretch",[`${n}-node-content-wrapper`]:{flex:"auto"},[`${o}.dragging:after`]:{position:"absolute",inset:0,border:`1px solid ${e.colorPrimary}`,opacity:0,animationName:ern,animationDuration:e.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none",borderRadius:e.borderRadius}}},[o]:{display:"flex",alignItems:"flex-start",marginBottom:r,lineHeight:jt(i),position:"relative","&:before":{content:'""',position:"absolute",zIndex:1,insetInlineStart:0,width:"100%",top:"100%",height:r},[`&-disabled ${n}-node-content-wrapper`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}},[`${n}-checkbox-disabled + ${n}-node-selected,&${o}-disabled${o}-selected ${n}-node-content-wrapper`]:{backgroundColor:u},[`${n}-checkbox-disabled`]:{pointerEvents:"unset"},[`&:not(${o}-disabled)`]:{[`${n}-node-content-wrapper`]:{"&:hover":{color:e.nodeHoverColor}}},[`&-active ${n}-node-content-wrapper`]:{background:e.controlItemBgHover},[`&:not(${o}-disabled).filter-node ${n}-title`]:{color:e.colorPrimary,fontWeight:500},"&-draggable":{cursor:"grab",[`${n}-draggable-icon`]:{flexShrink:0,width:i,textAlign:"center",visibility:"visible",color:c},[`&${o}-disabled ${n}-draggable-icon`]:{visibility:"hidden"}}},[`${n}-indent`]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:a}},[`${n}-draggable-icon`]:{visibility:"hidden"},[`${n}-switcher, ${n}-checkbox`]:{marginInlineEnd:e.calc(e.calc(i).sub(e.controlInteractiveSize)).div(2).equal()},[`${n}-switcher`]:Object.assign(Object.assign({},trn(t,e)),{position:"relative",flex:"none",alignSelf:"stretch",width:i,textAlign:"center",cursor:"pointer",userSelect:"none",transition:`all ${e.motionDurationSlow}`,"&-noop":{cursor:"unset"},"&:before":{pointerEvents:"none",content:'""',width:i,height:i,position:"absolute",left:{_skip_check_:!0,value:0},top:0,borderRadius:e.borderRadius,transition:`all ${e.motionDurationSlow}`},[`&:not(${n}-switcher-noop):hover:before`]:{backgroundColor:e.colorBgTextHover},[`&_close ${n}-switcher-icon svg`]:{transform:"rotate(-90deg)"},"&-loading-icon":{color:e.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),marginInlineStart:-1,borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&:after":{position:"absolute",width:e.calc(e.calc(i).div(2).equal()).mul(.8).equal(),height:e.calc(i).div(2).equal(),borderBottom:`1px solid ${e.colorBorder}`,content:'""'}}}),[`${n}-node-content-wrapper`]:Object.assign(Object.assign({position:"relative",minHeight:i,paddingBlock:0,paddingInline:e.paddingXS,background:"transparent",borderRadius:e.borderRadius,cursor:"pointer",transition:`all ${e.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`},nrn(t,e)),{"&:hover":{backgroundColor:s},[`&${n}-node-selected`]:{color:e.nodeSelectedColor,backgroundColor:l},[`${n}-iconEle`]:{display:"inline-block",width:i,height:i,textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}}),[`${n}-unselectable ${n}-node-content-wrapper:hover`]:{backgroundColor:"transparent"},[`${o}.drop-container > [draggable]`]:{boxShadow:`0 0 0 2px ${e.colorPrimary}`},"&-show-line":{[`${n}-indent-unit`]:{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&-end:before":{display:"none"}},[`${n}-switcher`]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},[`${o}-leaf-last ${n}-switcher-leaf-line:before`]:{top:"auto !important",bottom:"auto !important",height:`${jt(e.calc(i).div(2).equal())} !important`}})}},rrn=(t,e)=>{const n=`.${t}`,o=`${n}-treenode`,r=e.calc(e.paddingXS).div(2).equal(),i=Ui(e,{treeCls:n,treeNodeCls:o,treeNodePadding:r});return[orn(t,i),Zon(i)]},irn=t=>{const{controlHeightSM:e,controlItemBgHover:n,controlItemBgActive:o}=t,r=e;return{titleHeight:r,indentSize:r,nodeHoverBg:n,nodeHoverColor:t.colorText,nodeSelectedBg:o,nodeSelectedColor:t.colorText}},arn=t=>{const{colorTextLightSolid:e,colorPrimary:n}=t;return Object.assign(Object.assign({},irn(t)),{directoryNodeSelectedColor:e,directoryNodeSelectedBg:n})},lrn=el("Tree",(t,e)=>{let{prefixCls:n}=e;return[{[t.componentCls]:het(`${n}-checkbox`,t)},rrn(n,t),o9e(t)]},arn),cRe=4;function srn(t){const{dropPosition:e,dropLevelOffset:n,prefixCls:o,indent:r,direction:i="ltr"}=t,a=i==="ltr"?"left":"right",l=i==="ltr"?"right":"left",s={[a]:-n*r+cRe,[l]:0};switch(e){case-1:s.top=-3;break;case 1:s.bottom=-3;break;default:s.bottom=-3,s[a]=r+cRe;break}return xe.createElement("div",{style:s,className:`${o}-drop-indicator`})}const crn=t=>{const{prefixCls:e,switcherIcon:n,treeNodeProps:o,showLine:r,switcherLoadingIcon:i}=t,{isLeaf:a,expanded:l,loading:s}=o;if(s)return g.isValidElement(i)?i:g.createElement(qM,{className:`${e}-switcher-loading-icon`});let c;if(r&&typeof r=="object"&&(c=r.showLeafIcon),a){if(!r)return null;if(typeof c!="boolean"&&c){const f=typeof c=="function"?c(o):c,p=`${e}-switcher-line-custom-icon`;return g.isValidElement(f)?P0(f,{className:Mn(f.props.className||"",p)}):f}return c?g.createElement(ptt,{className:`${e}-switcher-line-icon`}):g.createElement("span",{className:`${e}-switcher-leaf-line`})}const u=`${e}-switcher-icon`,d=typeof n=="function"?n(o):n;return g.isValidElement(d)?P0(d,{className:Mn(d.props.className||"",u)}):d!==void 0?d:r?l?g.createElement(zen,{className:`${e}-switcher-line-icon`}):g.createElement(Wen,{className:`${e}-switcher-line-icon`}):g.createElement(vZt,{className:u})},ont=xe.forwardRef((t,e)=>{var n;const{getPrefixCls:o,direction:r,virtual:i,tree:a}=xe.useContext(gr),{prefixCls:l,className:s,showIcon:c=!1,showLine:u,switcherIcon:d,switcherLoadingIcon:f,blockNode:p=!1,children:m,checkable:y=!1,selectable:w=!0,draggable:x,motion:C,style:P}=t,A=o("tree",l),S=o(),v=C??Object.assign(Object.assign({},t9e(S)),{motionAppear:!1}),b=Object.assign(Object.assign({},t),{checkable:y,selectable:w,showIcon:c,motion:v,blockNode:p,showLine:!!u,dropIndicatorRender:srn}),[T,R,M]=lrn(A),[,D]=Ff(),k=D.paddingXS/2+(((n=D.Tree)===null||n===void 0?void 0:n.titleHeight)||D.controlHeightSM),N=xe.useMemo(()=>{if(!x)return!1;let W={};switch(typeof x){case"function":W.nodeDraggable=x;break;case"object":W=Object.assign({},x);break}return W.icon!==!1&&(W.icon=W.icon||xe.createElement(wen,null)),W},[x]),U=W=>xe.createElement(crn,{prefixCls:A,switcherIcon:d,switcherLoadingIcon:f,treeNodeProps:W,showLine:u});return T(xe.createElement(b3e,Object.assign({itemHeight:k,ref:e,virtual:i},b,{style:Object.assign(Object.assign({},a==null?void 0:a.style),P),prefixCls:A,className:Mn({[`${A}-icon-hide`]:!c,[`${A}-block-node`]:p,[`${A}-unselectable`]:!w,[`${A}-rtl`]:r==="rtl"},a==null?void 0:a.className,s,R,M),direction:r,checkable:y&&xe.createElement("span",{className:`${A}-checkbox-inner`}),selectable:w,switcherIcon:U,draggable:N}),m))}),uRe=0,cse=1,dRe=2;function S3e(t,e,n){const{key:o,children:r}=n;function i(a){const l=a[o],s=a[r];e(l,a)!==!1&&S3e(s||[],e,n)}t.forEach(i)}function urn(t){let{treeData:e,expandedKeys:n,startKey:o,endKey:r,fieldNames:i}=t;const a=[];let l=uRe;if(o&&o===r)return[o];if(!o||!r)return[];function s(c){return c===o||c===r}return S3e(e,c=>{if(l===dRe)return!1;if(s(c)){if(a.push(c),l===uRe)l=cse;else if(l===cse)return l=dRe,!1}else l===cse&&a.push(c);return n.includes(c)},TH(i)),a}function use(t,e,n){const o=Pa(e),r=[];return S3e(t,(i,a)=>{const l=o.indexOf(i);return l!==-1&&(r.push(a),o.splice(l,1)),!!o.length},TH(n)),r}var fRe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{defaultExpandAll:n,defaultExpandParent:o,defaultExpandedKeys:r}=t,i=fRe(t,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);const a=g.useRef(null),l=g.useRef(null),s=()=>{const{keyEntities:T}=$9e(hRe(i));let R;return n?R=Object.keys(T):o?R=qhe(i.expandedKeys||r||[],T):R=i.expandedKeys||r||[],R},[c,u]=g.useState(i.selectedKeys||i.defaultSelectedKeys||[]),[d,f]=g.useState(()=>s());g.useEffect(()=>{"selectedKeys"in i&&u(i.selectedKeys)},[i.selectedKeys]),g.useEffect(()=>{"expandedKeys"in i&&f(i.expandedKeys)},[i.expandedKeys]);const p=(T,R)=>{var M;return"expandedKeys"in i||f(T),(M=i.onExpand)===null||M===void 0?void 0:M.call(i,T,R)},m=(T,R)=>{var M;const{multiple:D,fieldNames:k}=i,{node:N,nativeEvent:U}=R,{key:W=""}=N,F=hRe(i),E=Object.assign(Object.assign({},R),{selected:!0}),L=(U==null?void 0:U.ctrlKey)||(U==null?void 0:U.metaKey),j=U==null?void 0:U.shiftKey;let Y;D&&L?(Y=T,a.current=W,l.current=Y,E.selectedNodes=use(F,Y,k)):D&&j?(Y=Array.from(new Set([].concat(Pa(l.current||[]),Pa(urn({treeData:F,expandedKeys:d,startKey:W,endKey:a.current,fieldNames:k}))))),E.selectedNodes=use(F,Y,k)):(Y=[W],a.current=W,l.current=Y,E.selectedNodes=use(F,Y,k)),(M=i.onSelect)===null||M===void 0||M.call(i,Y,E),"selectedKeys"in i||u(Y)},{getPrefixCls:y,direction:w}=g.useContext(gr),{prefixCls:x,className:C,showIcon:P=!0,expandAction:A="click"}=i,S=fRe(i,["prefixCls","className","showIcon","expandAction"]),v=y("tree",x),b=Mn(`${v}-directory`,{[`${v}-directory-rtl`]:w==="rtl"},C);return g.createElement(ont,Object.assign({icon:drn,ref:e,blockNode:!0},S,{showIcon:P,expandAction:A,prefixCls:v,className:b,expandedKeys:d,selectedKeys:c,onSelect:m,onExpand:p}))},hrn=g.forwardRef(frn),Yee=ont;Yee.DirectoryTree=hrn;Yee.TreeNode=jL;const pRe=t=>{const{value:e,filterSearch:n,tablePrefixCls:o,locale:r,onChange:i}=t;return n?g.createElement("div",{className:`${o}-filter-dropdown-search`},g.createElement(Vl,{prefix:g.createElement(HZ,null),placeholder:r.filterSearchPlaceholder,onChange:i,value:e,htmlSize:1,className:`${o}-filter-dropdown-search-input`})):null},prn=t=>{const{keyCode:e}=t;e===IL.ENTER&&t.stopPropagation()},grn=g.forwardRef((t,e)=>g.createElement("div",{className:t.className,onClick:n=>n.stopPropagation(),onKeyDown:prn,ref:e},t.children));function FR(t){let e=[];return(t||[]).forEach(n=>{let{value:o,children:r}=n;e.push(o),r&&(e=[].concat(Pa(e),Pa(FR(r))))}),e}function mrn(t){return t.some(e=>{let{children:n}=e;return n})}function rnt(t,e){return typeof e=="string"||typeof e=="number"?e==null?void 0:e.toString().toLowerCase().includes(t.trim().toLowerCase()):!1}function int(t){let{filters:e,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a}=t;return e.map((l,s)=>{const c=String(l.value);if(l.children)return{key:c||s,label:l.text,popupClassName:`${n}-dropdown-submenu`,children:int({filters:l.children,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a})};const u=r?Li:We,d={key:l.value!==void 0?c:s,label:g.createElement(g.Fragment,null,g.createElement(u,{checked:o.includes(c)}),g.createElement("span",null,l.text))};return i.trim()?typeof a=="function"?a(i,l)?d:null:rnt(i,l.text)?d:null:d})}function dse(t){return t||[]}const yrn=t=>{var e,n,o,r;const{tablePrefixCls:i,prefixCls:a,column:l,dropdownPrefixCls:s,columnKey:c,filterOnClose:u,filterMultiple:d,filterMode:f="menu",filterSearch:p=!1,filterState:m,triggerFilter:y,locale:w,children:x,getPopupContainer:C,rootClassName:P}=t,{filterResetToDefaultFilteredValue:A,defaultFilteredValue:S,filterDropdownProps:v={},filterDropdownOpen:b,filterDropdownVisible:T,onFilterDropdownVisibleChange:R,onFilterDropdownOpenChange:M}=l,[D,k]=g.useState(!1),N=!!(m&&(!((e=m.filteredKeys)===null||e===void 0)&&e.length||m.forceFiltered)),U=ve=>{var ze;k(ve),(ze=v.onOpenChange)===null||ze===void 0||ze.call(v,ve),M==null||M(ve),R==null||R(ve)},W=(r=(o=(n=v.open)!==null&&n!==void 0?n:b)!==null&&o!==void 0?o:T)!==null&&r!==void 0?r:D,F=m==null?void 0:m.filteredKeys,[E,L]=Yon(dse(F)),j=ve=>{let{selectedKeys:ze}=ve;L(ze)},Y=(ve,ze)=>{let{node:Ae,checked:se}=ze;j(d?{selectedKeys:ve}:{selectedKeys:se&&Ae.key?[Ae.key]:[]})};g.useEffect(()=>{D&&j({selectedKeys:dse(F)})},[F]);const[O,_]=g.useState([]),G=ve=>{_(ve)},[Q,oe]=g.useState(""),ee=ve=>{const{value:ze}=ve.target;oe(ze)};g.useEffect(()=>{D||oe("")},[D]);const $=ve=>{const ze=ve!=null&&ve.length?ve:null;if(ze===null&&(!m||!m.filteredKeys)||Hfe(ze,m==null?void 0:m.filteredKeys,!0))return null;y({column:l,key:c,filteredKeys:ze})},ae=()=>{U(!1),$(E())},Z=function(){let{confirm:ve,closeDropdown:ze}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{confirm:!1,closeDropdown:!1};ve&&$([]),ze&&U(!1),oe(""),L(A?(S||[]).map(Ae=>String(Ae)):[])},ne=function(){let{closeDropdown:ve}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{closeDropdown:!0};ve&&U(!1),$(E())},te=(ve,ze)=>{ze.source==="trigger"&&(ve&&F!==void 0&&L(dse(F)),U(ve),!ve&&!l.filterDropdown&&u&&ae())},q=Mn({[`${s}-menu-without-submenu`]:!mrn(l.filters||[])}),le=ve=>{if(ve.target.checked){const ze=FR(l==null?void 0:l.filters).map(Ae=>String(Ae));L(ze)}else L([])},de=ve=>{let{filters:ze}=ve;return(ze||[]).map((Ae,se)=>{const ge=String(Ae.value),we={title:Ae.text,key:Ae.value!==void 0?ge:String(se)};return Ae.children&&(we.children=de({filters:Ae.children})),we})},he=ve=>{var ze;return Object.assign(Object.assign({},ve),{text:ve.title,value:ve.key,children:((ze=ve.children)===null||ze===void 0?void 0:ze.map(Ae=>he(Ae)))||[]})};let me;const{direction:ce,renderEmpty:Pe}=g.useContext(gr);if(typeof l.filterDropdown=="function")me=l.filterDropdown({prefixCls:`${s}-custom`,setSelectedKeys:ve=>j({selectedKeys:ve}),selectedKeys:E(),confirm:ne,clearFilters:Z,filters:l.filters,visible:W,close:()=>{U(!1)}});else if(l.filterDropdown)me=l.filterDropdown;else{const ve=E()||[],ze=()=>{var se;const ge=(se=Pe==null?void 0:Pe("Table.filter"))!==null&&se!==void 0?se:g.createElement(w1,{image:w1.PRESENTED_IMAGE_SIMPLE,description:w.filterEmptyText,styles:{image:{height:24}},style:{margin:0,padding:"16px 0"}});if((l.filters||[]).length===0)return ge;if(f==="tree")return g.createElement(g.Fragment,null,g.createElement(pRe,{filterSearch:p,value:Q,onChange:ee,tablePrefixCls:i,locale:w}),g.createElement("div",{className:`${i}-filter-dropdown-tree`},d?g.createElement(Li,{checked:ve.length===FR(l.filters).length,indeterminate:ve.length>0&&ve.lengthtypeof p=="function"?p(Q,he(Me)):rnt(Q,Me.title):void 0})));const we=int({filters:l.filters||[],filterSearch:p,prefixCls:a,filteredKeys:E(),filterMultiple:d,searchValue:Q}),Se=we.every(Me=>Me===null);return g.createElement(g.Fragment,null,g.createElement(pRe,{filterSearch:p,value:Q,onChange:ee,tablePrefixCls:i,locale:w}),Se?ge:g.createElement(rI,{selectable:!0,multiple:d,prefixCls:`${s}-menu`,className:q,onSelect:j,onDeselect:j,selectedKeys:ve,getPopupContainer:C,openKeys:O,onOpenChange:G,items:we}))},Ae=()=>A?Hfe((S||[]).map(se=>String(se)),ve,!0):ve.length===0;me=g.createElement(g.Fragment,null,ze(),g.createElement("div",{className:`${a}-dropdown-btns`},g.createElement(oo,{type:"link",size:"small",disabled:Ae(),onClick:()=>Z()},w.filterReset),g.createElement(oo,{type:"primary",size:"small",onClick:ae},w.filterConfirm)))}l.filterDropdown&&(me=g.createElement(tZe,{selectable:void 0},me)),me=g.createElement(grn,{className:`${a}-dropdown`},me);const Ie=a3e({trigger:["click"],placement:ce==="rtl"?"bottomLeft":"bottomRight",children:(()=>{let ve;return typeof l.filterIcon=="function"?ve=l.filterIcon(N):l.filterIcon?ve=l.filterIcon:ve=g.createElement(den,null),g.createElement("span",{role:"button",tabIndex:-1,className:Mn(`${a}-trigger`,{active:N}),onClick:ze=>{ze.stopPropagation()}},ve)})(),getPopupContainer:C},Object.assign(Object.assign({},v),{rootClassName:Mn(P,v.rootClassName),open:W,onOpenChange:te,dropdownRender:()=>typeof(v==null?void 0:v.dropdownRender)=="function"?v.dropdownRender(me):me}));return g.createElement("div",{className:`${a}-column`},g.createElement("span",{className:`${i}-column-title`},x),g.createElement(e4,Object.assign({},Ie)))},npe=(t,e,n)=>{let o=[];return(t||[]).forEach((r,i)=>{var a;const l=uI(i,n);if(r.filters||"filterDropdown"in r||"onFilter"in r)if("filteredValue"in r){let s=r.filteredValue;"filterDropdown"in r||(s=(a=s==null?void 0:s.map(String))!==null&&a!==void 0?a:s),o.push({column:r,key:l7(r,l),filteredKeys:s,forceFiltered:r.filtered})}else o.push({column:r,key:l7(r,l),filteredKeys:e&&r.defaultFilteredValue?r.defaultFilteredValue:void 0,forceFiltered:r.filtered});"children"in r&&(o=[].concat(Pa(o),Pa(npe(r.children,e,l))))}),o};function ant(t,e,n,o,r,i,a,l,s){return n.map((c,u)=>{const d=uI(u,l),{filterOnClose:f=!0,filterMultiple:p=!0,filterMode:m,filterSearch:y}=c;let w=c;if(w.filters||w.filterDropdown){const x=l7(w,d),C=o.find(P=>{let{key:A}=P;return x===A});w=Object.assign(Object.assign({},w),{title:P=>g.createElement(yrn,{tablePrefixCls:t,prefixCls:`${t}-filter`,dropdownPrefixCls:e,column:w,columnKey:x,filterState:C,filterOnClose:f,filterMultiple:p,filterMode:m,filterSearch:y,triggerFilter:i,locale:r,getPopupContainer:a,rootClassName:s},Bee(c.title,P))})}return"children"in w&&(w=Object.assign(Object.assign({},w),{children:ant(t,e,w.children,o,r,i,a,d,s)})),w})}const gRe=t=>{const e={};return t.forEach(n=>{let{key:o,filteredKeys:r,column:i}=n;const a=o,{filters:l,filterDropdown:s}=i;if(s)e[a]=r||null;else if(Array.isArray(r)){const c=FR(l);e[a]=c.filter(u=>r.includes(String(u)))}else e[a]=null}),e},ope=(t,e,n)=>e.reduce((r,i)=>{const{column:{onFilter:a,filters:l},filteredKeys:s}=i;return a&&s&&s.length?r.map(c=>Object.assign({},c)).filter(c=>s.some(u=>{const d=FR(l),f=d.findIndex(m=>String(m)===String(u)),p=f!==-1?d[f]:u;return c[n]&&(c[n]=ope(c[n],e,n)),a(p,c)})):r},t),lnt=t=>t.flatMap(e=>"children"in e?[e].concat(Pa(lnt(e.children||[]))):[e]),Arn=t=>{const{prefixCls:e,dropdownPrefixCls:n,mergedColumns:o,onFilterChange:r,getPopupContainer:i,locale:a,rootClassName:l}=t;LS();const s=g.useMemo(()=>lnt(o||[]),[o]),[c,u]=g.useState(()=>npe(s,!0)),d=g.useMemo(()=>{const y=npe(s,!1);if(y.length===0)return y;let w=!0;if(y.forEach(x=>{let{filteredKeys:C}=x;C!==void 0&&(w=!1)}),w){const x=(s||[]).map((C,P)=>l7(C,uI(P)));return c.filter(C=>{let{key:P}=C;return x.includes(P)}).map(C=>{const P=s[x.findIndex(A=>A===C.key)];return Object.assign(Object.assign({},C),{column:Object.assign(Object.assign({},C.column),P),forceFiltered:P.filtered})})}return y},[s,c]),f=g.useMemo(()=>gRe(d),[d]),p=y=>{const w=d.filter(x=>{let{key:C}=x;return C!==y.key});w.push(y),u(w),r(gRe(w),w)};return[y=>ant(e,n,y,d,a,p,i,void 0,l),d,f]},wrn=(t,e,n)=>{const o=g.useRef({});function r(i){var a;if(!o.current||o.current.data!==t||o.current.childrenColumnName!==e||o.current.getRowKey!==n){let c=function(u){u.forEach((d,f)=>{const p=n(d,f);s.set(p,d),d&&typeof d=="object"&&e in d&&c(d[e]||[])})};var l=c;const s=new Map;c(t),o.current={data:t,childrenColumnName:e,kvMap:s,getRowKey:n}}return(a=o.current.kvMap)===null||a===void 0?void 0:a.get(i)}return[r]};var xrn=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const i=t[r];typeof i!="function"&&(n[r]=i)}),n}function brn(t,e,n){const o=n&&typeof n=="object"?n:{},{total:r=0}=o,i=xrn(o,["total"]),[a,l]=g.useState(()=>({current:"defaultCurrent"in i?i.defaultCurrent:1,pageSize:"defaultPageSize"in i?i.defaultPageSize:snt})),s=a3e(a,i,{total:r>0?r:t}),c=Math.ceil((r||t)/s.pageSize);s.current>c&&(s.current=c||1);const u=(f,p)=>{l({current:f??1,pageSize:p||s.pageSize})},d=(f,p)=>{var m;n&&((m=n.onChange)===null||m===void 0||m.call(n,f,p)),u(f,p),e(f,p||(s==null?void 0:s.pageSize))};return n===!1?[{},()=>{}]:[Object.assign(Object.assign({},s),{onChange:d}),u]}const wG="ascend",fse="descend",AJ=t=>typeof t.sorter=="object"&&typeof t.sorter.multiple=="number"?t.sorter.multiple:!1,mRe=t=>typeof t=="function"?t:t&&typeof t=="object"&&t.compare?t.compare:!1,Srn=(t,e)=>e?t[t.indexOf(e)+1]:t[0],rpe=(t,e,n)=>{let o=[];const r=(i,a)=>{o.push({column:i,key:l7(i,a),multiplePriority:AJ(i),sortOrder:i.sortOrder})};return(t||[]).forEach((i,a)=>{const l=uI(a,n);i.children?("sortOrder"in i&&r(i,l),o=[].concat(Pa(o),Pa(rpe(i.children,e,l)))):i.sorter&&("sortOrder"in i?r(i,l):e&&i.defaultSortOrder&&o.push({column:i,key:l7(i,l),multiplePriority:AJ(i),sortOrder:i.defaultSortOrder}))}),o},cnt=(t,e,n,o,r,i,a,l)=>(e||[]).map((c,u)=>{const d=uI(u,l);let f=c;if(f.sorter){const p=f.sortDirections||r,m=f.showSorterTooltip===void 0?a:f.showSorterTooltip,y=l7(f,d),w=n.find(R=>{let{key:M}=R;return M===y}),x=w?w.sortOrder:null,C=Srn(p,x);let P;if(c.sortIcon)P=c.sortIcon({sortOrder:x});else{const R=p.includes(wG)&&g.createElement(HZt,{className:Mn(`${t}-column-sorter-up`,{active:x===wG})}),M=p.includes(fse)&&g.createElement(utt,{className:Mn(`${t}-column-sorter-down`,{active:x===fse})});P=g.createElement("span",{className:Mn(`${t}-column-sorter`,{[`${t}-column-sorter-full`]:!!(R&&M)})},g.createElement("span",{className:`${t}-column-sorter-inner`,"aria-hidden":"true"},R,M))}const{cancelSort:A,triggerAsc:S,triggerDesc:v}=i||{};let b=A;C===fse?b=v:C===wG&&(b=S);const T=typeof m=="object"?Object.assign({title:b},m):{title:b};f=Object.assign(Object.assign({},f),{className:Mn(f.className,{[`${t}-column-sort`]:x}),title:R=>{const M=`${t}-column-sorters`,D=g.createElement("span",{className:`${t}-column-title`},Bee(c.title,R)),k=g.createElement("div",{className:M},D,P);return m?typeof m!="boolean"&&(m==null?void 0:m.target)==="sorter-icon"?g.createElement("div",{className:`${M} ${t}-column-sorters-tooltip-target-sorter`},D,g.createElement(k3,Object.assign({},T),P)):g.createElement(k3,Object.assign({},T),k):k},onHeaderCell:R=>{var M;const D=((M=c.onHeaderCell)===null||M===void 0?void 0:M.call(c,R))||{},k=D.onClick,N=D.onKeyDown;D.onClick=F=>{o({column:c,key:y,sortOrder:C,multiplePriority:AJ(c)}),k==null||k(F)},D.onKeyDown=F=>{F.keyCode===IL.ENTER&&(o({column:c,key:y,sortOrder:C,multiplePriority:AJ(c)}),N==null||N(F))};const U=Bon(c.title,{}),W=U==null?void 0:U.toString();return x?D["aria-sort"]=x==="ascend"?"ascending":"descending":D["aria-label"]=W||"",D.className=Mn(D.className,`${t}-column-has-sorters`),D.tabIndex=0,c.ellipsis&&(D.title=(U??"").toString()),D}})}return"children"in f&&(f=Object.assign(Object.assign({},f),{children:cnt(t,f.children,n,o,r,i,a,d)})),f}),yRe=t=>{const{column:e,sortOrder:n}=t;return{column:e,order:n,field:e.dataIndex,columnKey:e.key}},ARe=t=>{const e=t.filter(n=>{let{sortOrder:o}=n;return o}).map(yRe);if(e.length===0&&t.length){const n=t.length-1;return Object.assign(Object.assign({},yRe(t[n])),{column:void 0,order:void 0,field:void 0,columnKey:void 0})}return e.length<=1?e[0]||{}:e},ipe=(t,e,n)=>{const o=e.slice().sort((a,l)=>l.multiplePriority-a.multiplePriority),r=t.slice(),i=o.filter(a=>{let{column:{sorter:l},sortOrder:s}=a;return mRe(l)&&s});return i.length?r.sort((a,l)=>{for(let s=0;s{const l=a[n];return l?Object.assign(Object.assign({},a),{[n]:ipe(l,e,n)}):a}):r},Trn=t=>{const{prefixCls:e,mergedColumns:n,sortDirections:o,tableLocale:r,showSorterTooltip:i,onSorterChange:a}=t,[l,s]=g.useState(rpe(n,!0)),c=(y,w)=>{const x=[];return y.forEach((C,P)=>{const A=uI(P,w);if(x.push(l7(C,A)),Array.isArray(C.children)){const S=c(C.children,A);x.push.apply(x,Pa(S))}}),x},u=g.useMemo(()=>{let y=!0;const w=rpe(n,!1);if(!w.length){const A=c(n);return l.filter(S=>{let{key:v}=S;return A.includes(v)})}const x=[];function C(A){y?x.push(A):x.push(Object.assign(Object.assign({},A),{sortOrder:null}))}let P=null;return w.forEach(A=>{P===null?(C(A),A.sortOrder&&(A.multiplePriority===!1?y=!1:P=!0)):(P&&A.multiplePriority!==!1||(y=!1),C(A))}),x},[n,l]),d=g.useMemo(()=>{var y,w;const x=u.map(C=>{let{column:P,sortOrder:A}=C;return{column:P,order:A}});return{sortColumns:x,sortColumn:(y=x[0])===null||y===void 0?void 0:y.column,sortOrder:(w=x[0])===null||w===void 0?void 0:w.order}},[u]),f=y=>{let w;y.multiplePriority===!1||!u.length||u[0].multiplePriority===!1?w=[y]:w=[].concat(Pa(u.filter(x=>{let{key:C}=x;return C!==y.key})),[y]),s(w),a(ARe(w),w)};return[y=>cnt(e,y,u,f,o,r,i),u,d,()=>ARe(u)]},unt=(t,e)=>t.map(o=>{const r=Object.assign({},o);return r.title=Bee(o.title,e),"children"in r&&(r.children=unt(r.children,e)),r}),Prn=t=>[g.useCallback(n=>unt(n,t),[t])],Crn=Vtt((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),Rrn=Ztt((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),Hrn=t=>{const{componentCls:e,lineWidth:n,lineType:o,tableBorderColor:r,tableHeaderBg:i,tablePaddingVertical:a,tablePaddingHorizontal:l,calc:s}=t,c=`${jt(n)} ${o} ${r}`,u=(d,f,p)=>({[`&${e}-${d}`]:{[`> ${e}-container`]:{[`> ${e}-content, > ${e}-body`]:{"\n > table > tbody > tr > th,\n > table > tbody > tr > td\n ":{[`> ${e}-expanded-row-fixed`]:{margin:`${jt(s(f).mul(-1).equal())} ${jt(s(s(p).add(n)).mul(-1).equal())}`}}}}}});return{[`${e}-wrapper`]:{[`${e}${e}-bordered`]:Object.assign(Object.assign(Object.assign({[`> ${e}-title`]:{border:c,borderBottom:0},[`> ${e}-container`]:{borderInlineStart:c,borderTop:c,[` > ${e}-content, > ${e}-header, @@ -4818,7 +4818,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho > ${e}-wrapper:only-child, > ${e}-expanded-row-fixed > ${e}-wrapper:only-child `]:{[e]:{marginBlock:jt(C(o).mul(-1).equal()),marginInline:`${jt(C(i).sub(r).equal())} - ${jt(C(r).mul(-1).equal())}`,[`${e}-tbody > tr:last-child > td`]:{borderBottomWidth:0,"&:first-child, &:last-child":{borderRadius:0}}}}},"> th":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:P,transition:`background ${p} ease`}}},[`${e}-footer`]:{padding:`${jt(o)} ${jt(r)}`,color:w,background:x}})}},Orn=t=>{const{colorFillAlter:e,colorBgContainer:n,colorTextHeading:o,colorFillSecondary:r,colorFillContent:i,controlItemBgActive:a,controlItemBgActiveHover:l,padding:s,paddingSM:c,paddingXS:u,colorBorderSecondary:d,borderRadiusLG:f,controlHeight:p,colorTextPlaceholder:m,fontSize:y,fontSizeSM:w,lineHeight:x,lineWidth:C,colorIcon:P,colorIconHover:A,opacityLoading:S,controlInteractiveSize:v}=t,b=new Di(r).onBackground(n).toHexString(),T=new Di(i).onBackground(n).toHexString(),R=new Di(e).onBackground(n).toHexString(),M=new Di(P),D=new Di(A),k=v/2-C,N=k*2+C*3;return{headerBg:R,headerColor:o,headerSortActiveBg:b,headerSortHoverBg:T,bodySortBg:R,rowHoverBg:R,rowSelectedBg:a,rowSelectedHoverBg:l,rowExpandedBg:e,cellPaddingBlock:s,cellPaddingInline:s,cellPaddingBlockMD:c,cellPaddingInlineMD:u,cellPaddingBlockSM:u,cellPaddingInlineSM:u,borderColor:d,headerBorderRadius:f,footerBg:R,footerColor:o,cellFontSize:y,cellFontSizeMD:y,cellFontSizeSM:y,headerSplitColor:d,fixedHeaderSortActiveBg:b,headerFilterHoverBg:i,filterDropdownMenuBg:n,filterDropdownBg:n,expandIconBg:n,selectionColumnWidth:p,stickyScrollBarBg:m,stickyScrollBarBorderRadius:100,expandIconMarginTop:(y*x-C*3)/2-Math.ceil((w*1.4-C*3)/2),headerIconColor:M.clone().setA(M.a*S).toRgbString(),headerIconHoverColor:D.clone().setA(D.a*S).toRgbString(),expandIconHalfInner:k,expandIconSize:N,expandIconScale:v/N}},xRe=2,_rn=el("Table",t=>{const{colorTextHeading:e,colorSplit:n,colorBgContainer:o,controlInteractiveSize:r,headerBg:i,headerColor:a,headerSortActiveBg:l,headerSortHoverBg:s,bodySortBg:c,rowHoverBg:u,rowSelectedBg:d,rowSelectedHoverBg:f,rowExpandedBg:p,cellPaddingBlock:m,cellPaddingInline:y,cellPaddingBlockMD:w,cellPaddingInlineMD:x,cellPaddingBlockSM:C,cellPaddingInlineSM:P,borderColor:A,footerBg:S,footerColor:v,headerBorderRadius:b,cellFontSize:T,cellFontSizeMD:R,cellFontSizeSM:M,headerSplitColor:D,fixedHeaderSortActiveBg:k,headerFilterHoverBg:N,filterDropdownBg:U,expandIconBg:W,selectionColumnWidth:F,stickyScrollBarBg:E,calc:L}=t,j=Ui(t,{tableFontSize:T,tableBg:o,tableRadius:b,tablePaddingVertical:m,tablePaddingHorizontal:y,tablePaddingVerticalMiddle:w,tablePaddingHorizontalMiddle:x,tablePaddingVerticalSmall:C,tablePaddingHorizontalSmall:P,tableBorderColor:A,tableHeaderTextColor:a,tableHeaderBg:i,tableFooterTextColor:v,tableFooterBg:S,tableHeaderCellSplitColor:D,tableHeaderSortBg:l,tableHeaderSortHoverBg:s,tableBodySortBg:c,tableFixedHeaderSortActiveBg:k,tableHeaderFilterActiveBg:N,tableFilterDropdownBg:U,tableRowHoverBg:u,tableSelectedRowBg:d,tableSelectedRowHoverBg:f,zIndexTableFixed:xRe,zIndexTableSticky:L(xRe).add(1).equal({unit:!1}),tableFontSizeMiddle:R,tableFontSizeSmall:M,tableSelectionColumnWidth:F,tableExpandIconBg:W,tableExpandColumnWidth:L(r).add(L(t.padding).mul(2)).equal(),tableExpandedRowBg:p,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:E,tableScrollThumbBgHover:e,tableScrollBg:n});return[Yrn(j),krn(j),wRe(j),Urn(j),Drn(j),Hrn(j),Frn(j),zrn(j),wRe(j),Irn(j),Wrn(j),Ern(j),jrn(j),Mrn(j),Nrn(j),Lrn(j),Brn(j)]},Orn,{unitless:{expandIconScale:!0}}),Vrn=[],Grn=(t,e)=>{var n,o;const{prefixCls:r,className:i,rootClassName:a,style:l,size:s,bordered:c,dropdownPrefixCls:u,dataSource:d,pagination:f,rowSelection:p,rowKey:m="key",rowClassName:y,columns:w,children:x,childrenColumnName:C,onChange:P,getPopupContainer:A,loading:S,expandIcon:v,expandable:b,expandedRowRender:T,expandIconColumnIndex:R,indentSize:M,scroll:D,sortDirections:k,locale:N,showSorterTooltip:U={target:"full-header"},virtual:W}=t;LS();const F=g.useMemo(()=>w||m3e(x),[w,x]),E=g.useMemo(()=>F.some(Ct=>Ct.responsive),[F]),L=MZ(E),j=g.useMemo(()=>{const Ct=new Set(Object.keys(L).filter(yt=>L[yt]));return F.filter(yt=>!yt.responsive||yt.responsive.some(at=>Ct.has(at)))},[F,L]),Y=Mf(t,["className","style","columns"]),{locale:O=I3,direction:_,table:G,renderEmpty:Q,getPrefixCls:oe,getPopupContainer:ee}=g.useContext(gr),q=jd(s),ae=Object.assign(Object.assign({},O.Table),N),Z=d||Vrn,ne=oe("table",r),te=oe("dropdown",u),[,$]=Ff(),le=nu(ne),[de,he,me]=_rn(ne,le),ce=Object.assign(Object.assign({childrenColumnName:C,expandIconColumnIndex:R},b),{expandIcon:(n=b==null?void 0:b.expandIcon)!==null&&n!==void 0?n:(o=G==null?void 0:G.expandable)===null||o===void 0?void 0:o.expandIcon}),{childrenColumnName:Pe="children"}=ce,pe=g.useMemo(()=>Z.some(Ct=>Ct==null?void 0:Ct[Pe])?"nest":T||b!=null&&b.expandedRowRender?"row":null,[Z]),Ie={body:g.useRef(null)},ve=jon(ne),ze=g.useRef(null),Ae=g.useRef(null);Non(e,()=>Object.assign(Object.assign({},Ae.current),{nativeElement:ze.current}));const se=g.useMemo(()=>typeof m=="function"?m:Ct=>Ct==null?void 0:Ct[m],[m]),[ge]=wrn(Z,Pe,se),we={},Se=function(Ct,yt){let at=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;var Et,Lt,Je,st;const It=Object.assign(Object.assign({},we),Ct);at&&((Et=we.resetPagination)===null||Et===void 0||Et.call(we),!((Lt=It.pagination)===null||Lt===void 0)&&Lt.current&&(It.pagination.current=1),f&&((Je=f.onChange)===null||Je===void 0||Je.call(f,1,(st=It.pagination)===null||st===void 0?void 0:st.pageSize))),D&&D.scrollToFirstRowOnChange!==!1&&Ie.body.current&&okt(0,{getContainer:()=>Ie.body.current}),P==null||P(It.pagination,It.filters,It.sorter,{currentDataSource:ope(ipe(Z,It.sorterStates,Pe),It.filterStates,Pe),action:yt})},Me=(Ct,yt)=>{Se({sorter:Ct,sorterStates:yt},"sort",!1)},[Ce,Te,Re,Ne]=Trn({prefixCls:ne,mergedColumns:j,onSorterChange:Me,sortDirections:k||["ascend","descend"],tableLocale:ae,showSorterTooltip:U}),_e=g.useMemo(()=>ipe(Z,Te,Pe),[Z,Te]);we.sorter=Ne(),we.sorterStates=Te;const Ue=(Ct,yt)=>{Se({filters:Ct,filterStates:yt},"filter",!0)},[qe,Fe,He]=Arn({prefixCls:ne,locale:ae,dropdownPrefixCls:te,mergedColumns:j,onFilterChange:Ue,getPopupContainer:A||ee,rootClassName:Mn(a,le)}),Le=ope(_e,Fe,Pe);we.filters=He,we.filterStates=Fe;const Ye=g.useMemo(()=>{const Ct={};return Object.keys(He).forEach(yt=>{He[yt]!==null&&(Ct[yt]=He[yt])}),Object.assign(Object.assign({},Re),{filters:Ct})},[Re,He]),[lt]=Prn(Ye),Oe=(Ct,yt)=>{Se({pagination:Object.assign(Object.assign({},we.pagination),{current:Ct,pageSize:yt})},"paginate")},[ut,ht]=brn(Le.length,Oe,f);we.pagination=f===!1?{}:vrn(ut,f),we.resetPagination=ht;const Qe=g.useMemo(()=>{if(f===!1||!ut.pageSize)return Le;const{current:Ct=1,total:yt,pageSize:at=snt}=ut;return Le.lengthat?Le.slice((Ct-1)*at,Ct*at):Le:Le.slice((Ct-1)*at,Ct*at)},[!!f,Le,ut==null?void 0:ut.current,ut==null?void 0:ut.pageSize,ut==null?void 0:ut.total]),[nt,mt]=Lon({prefixCls:ne,data:Le,pageData:Qe,getRowKey:se,getRecordByKey:ge,expandType:pe,childrenColumnName:Pe,locale:ae,getPopupContainer:A||ee},p),tt=(Ct,yt,at)=>{let Et;return typeof y=="function"?Et=Mn(y(Ct,yt,at)):Et=Mn(y),Mn({[`${ne}-row-selected`]:mt.has(se(Ct,yt))},Et)};ce.__PARENT_RENDER_ICON__=ce.expandIcon,ce.expandIcon=ce.expandIcon||v||Uon(ae),pe==="nest"&&ce.expandIconColumnIndex===void 0?ce.expandIconColumnIndex=p?1:0:ce.expandIconColumnIndex>0&&p&&(ce.expandIconColumnIndex-=1),typeof ce.indentSize!="number"&&(ce.indentSize=typeof M=="number"?M:15);const gt=g.useCallback(Ct=>lt(nt(qe(Ce(Ct)))),[Ce,qe,nt]);let Ve,je;if(f!==!1&&(ut!=null&&ut.total)){let Ct;ut.size?Ct=ut.size:Ct=q==="small"||q==="middle"?"small":void 0;const yt=Lt=>g.createElement(ott,Object.assign({},ut,{className:Mn(`${ne}-pagination ${ne}-pagination-${Lt}`,ut.className),size:Ct})),at=_==="rtl"?"left":"right",{position:Et}=ut;if(Et!==null&&Array.isArray(Et)){const Lt=Et.find(It=>It.includes("top")),Je=Et.find(It=>It.includes("bottom")),st=Et.every(It=>`${It}`=="none");!Lt&&!Je&&!st&&(je=yt(at)),Lt&&(Ve=yt(Lt.toLowerCase().replace("top",""))),Je&&(je=yt(Je.toLowerCase().replace("bottom","")))}else je=yt(at)}let et;typeof S=="boolean"?et={spinning:S}:typeof S=="object"&&(et=Object.assign({spinning:!0},S));const bt=Mn(me,le,`${ne}-wrapper`,G==null?void 0:G.className,{[`${ne}-wrapper-rtl`]:_==="rtl"},i,a,he),St=Object.assign(Object.assign({},G==null?void 0:G.style),l),Pt=typeof(N==null?void 0:N.emptyText)<"u"?N.emptyText:(Q==null?void 0:Q("Table"))||g.createElement(y9e,{componentName:"Table"}),Yt=W?Rrn:Crn,zt={},Rt=g.useMemo(()=>{const{fontSize:Ct,lineHeight:yt,lineWidth:at,padding:Et,paddingXS:Lt,paddingSM:Je}=$,st=Math.floor(Ct*yt);switch(q){case"middle":return Je*2+st+at;case"small":return Lt*2+st+at;default:return Et*2+st+at}},[$,q]);return W&&(zt.listItemHeight=Rt),de(g.createElement("div",{ref:ze,className:bt,style:St},g.createElement(Pee,Object.assign({spinning:!1},et),Ve,g.createElement(Yt,Object.assign({},zt,Y,{ref:Ae,columns:j,direction:_,expandable:ce,prefixCls:ne,className:Mn({[`${ne}-middle`]:q==="middle",[`${ne}-small`]:q==="small",[`${ne}-bordered`]:c,[`${ne}-empty`]:Z.length===0},me,le,he),data:Qe,rowKey:se,rowClassName:tt,emptyText:Pt,internalHooks:TU,internalRefs:Ie,transformColumns:gt,getContainerWidth:ve})),je)))},Xrn=g.forwardRef(Grn),Jrn=(t,e)=>{const n=g.useRef(0);return n.current+=1,g.createElement(Xrn,Object.assign({},t,{ref:e,_renderTimes:n.current}))},Bd=g.forwardRef(Jrn);Bd.SELECTION_COLUMN=zw;Bd.EXPAND_COLUMN=aA;Bd.SELECTION_ALL=Qhe;Bd.SELECTION_INVERT=Zhe;Bd.SELECTION_NONE=epe;Bd.Column=Pon;Bd.ColumnGroup=Con;Bd.Summary=Ptt;const Krn=t=>{const{paddingXXS:e,lineWidth:n,tagPaddingHorizontal:o,componentCls:r,calc:i}=t,a=i(o).sub(n).equal(),l=i(e).sub(n).equal();return{[r]:Object.assign(Object.assign({},Ua(t)),{display:"inline-block",height:"auto",marginInlineEnd:t.marginXS,paddingInline:a,fontSize:t.tagFontSize,lineHeight:t.tagLineHeight,whiteSpace:"nowrap",background:t.defaultBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,opacity:1,transition:`all ${t.motionDurationMid}`,textAlign:"start",position:"relative",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:t.defaultColor},[`${r}-close-icon`]:{marginInlineStart:l,fontSize:t.tagIconSize,color:t.colorTextDescription,cursor:"pointer",transition:`all ${t.motionDurationMid}`,"&:hover":{color:t.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${t.iconCls}-close, ${t.iconCls}-close:hover`]:{color:t.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:t.colorPrimary,backgroundColor:t.colorFillSecondary},"&:active, &-checked":{color:t.colorTextLightSolid},"&-checked":{backgroundColor:t.colorPrimary,"&:hover":{backgroundColor:t.colorPrimaryHover}},"&:active":{backgroundColor:t.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${t.iconCls} + span, > span + ${t.iconCls}`]:{marginInlineStart:a}}),[`${r}-borderless`]:{borderColor:"transparent",background:t.tagBorderlessBg}}},T3e=t=>{const{lineWidth:e,fontSizeIcon:n,calc:o}=t,r=t.fontSizeSM;return Ui(t,{tagFontSize:r,tagLineHeight:jt(o(t.lineHeightSM).mul(r).equal()),tagIconSize:o(n).sub(o(e).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:t.defaultBg})},P3e=t=>({defaultBg:new Di(t.colorFillQuaternary).onBackground(t.colorBgContainer).toHexString(),defaultColor:t.colorText}),dnt=el("Tag",t=>{const e=T3e(t);return Krn(e)},P3e);var $rn=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,style:o,className:r,checked:i,onChange:a,onClick:l}=t,s=$rn(t,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:c,tag:u}=g.useContext(gr),d=x=>{a==null||a(!i),l==null||l(x)},f=c("tag",n),[p,m,y]=dnt(f),w=Mn(f,`${f}-checkable`,{[`${f}-checkable-checked`]:i},u==null?void 0:u.className,r,m,y);return p(g.createElement("span",Object.assign({},s,{ref:e,style:Object.assign(Object.assign({},o),u==null?void 0:u.style),className:w,onClick:d})))}),Qrn=t=>sZ(t,(e,n)=>{let{textColor:o,lightBorderColor:r,lightColor:i,darkColor:a}=n;return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:o,background:i,borderColor:r,"&-inverse":{color:t.colorTextLightSolid,background:a,borderColor:a},[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}}),Zrn=rU(["Tag","preset"],t=>{const e=T3e(t);return Qrn(e)},P3e);function ein(t){return typeof t!="string"?t:t.charAt(0).toUpperCase()+t.slice(1)}const n_=(t,e,n)=>{const o=ein(n);return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:t[`color${n}`],background:t[`color${o}Bg`],borderColor:t[`color${o}Border`],[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}},tin=rU(["Tag","status"],t=>{const e=T3e(t);return[n_(e,"success","Success"),n_(e,"processing","Info"),n_(e,"error","Error"),n_(e,"warning","Warning")]},P3e);var nin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,className:o,rootClassName:r,style:i,children:a,icon:l,color:s,onClose:c,bordered:u=!0,visible:d}=t,f=nin(t,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:p,direction:m,tag:y}=g.useContext(gr),[w,x]=g.useState(!0),C=Mf(f,["closeIcon","closable"]);g.useEffect(()=>{d!==void 0&&x(d)},[d]);const P=DZ(s),A=IYt(s),S=P||A,v=Object.assign(Object.assign({backgroundColor:s&&!S?s:void 0},y==null?void 0:y.style),i),b=p("tag",n),[T,R,M]=dnt(b),D=Mn(b,y==null?void 0:y.className,{[`${b}-${s}`]:S,[`${b}-has-color`]:s&&!S,[`${b}-hidden`]:!w,[`${b}-rtl`]:m==="rtl",[`${b}-borderless`]:!u},o,r,R,M),k=L=>{L.stopPropagation(),c==null||c(L),!L.defaultPrevented&&x(!1)},[,N]=u9e(SH(t),SH(y),{closable:!1,closeIconRender:L=>{const j=g.createElement("span",{className:`${b}-close-icon`,onClick:k},L);return I$e(L,j,Y=>({onClick:O=>{var _;(_=Y==null?void 0:Y.onClick)===null||_===void 0||_.call(Y,O),k(O)},className:Mn(Y==null?void 0:Y.className,`${b}-close-icon`)}))}}),U=typeof f.onClick=="function"||a&&a.type==="a",W=l||null,F=W?g.createElement(g.Fragment,null,W,a&&g.createElement("span",null,a)):a,E=g.createElement("span",Object.assign({},C,{ref:e,className:D,style:v}),F,N,P&&g.createElement(Zrn,{key:"preset",prefixCls:b}),A&&g.createElement(tin,{key:"status",prefixCls:b}));return T(U?g.createElement(lU,{component:"Tag"},E):E)}),fnt=oin;fnt.CheckableTag=qrn;var rin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rg.createElement(ain,Object.assign({},t,{picker:"time",mode:void 0,ref:e}))),AA=g.forwardRef((t,e)=>{var{addon:n,renderExtraFooter:o,variant:r,bordered:i}=t,a=rin(t,["addon","renderExtraFooter","variant","bordered"]);const[l]=jS("timePicker",r,i),s=g.useMemo(()=>{if(o)return o;if(n)return n},[n,o]);return g.createElement(iin,Object.assign({},a,{mode:void 0,ref:e,renderExtraFooter:s,variant:l}))}),hnt=gU(AA,"popupAlign",void 0,"picker");AA._InternalPanelDoNotUseOrYouWillBeFired=hnt;AA.RangePicker=lin;AA._InternalPanelDoNotUseOrYouWillBeFired=hnt;const sin=(t,e,n,o)=>{const{titleMarginBottom:r,fontWeightStrong:i}=o;return{marginBottom:r,color:n,fontWeight:i,fontSize:t,lineHeight:e}},cin=t=>{const e=[1,2,3,4,5],n={};return e.forEach(o=>{n[` + ${jt(C(r).mul(-1).equal())}`,[`${e}-tbody > tr:last-child > td`]:{borderBottomWidth:0,"&:first-child, &:last-child":{borderRadius:0}}}}},"> th":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:m,borderBottom:P,transition:`background ${p} ease`}}},[`${e}-footer`]:{padding:`${jt(o)} ${jt(r)}`,color:w,background:x}})}},Orn=t=>{const{colorFillAlter:e,colorBgContainer:n,colorTextHeading:o,colorFillSecondary:r,colorFillContent:i,controlItemBgActive:a,controlItemBgActiveHover:l,padding:s,paddingSM:c,paddingXS:u,colorBorderSecondary:d,borderRadiusLG:f,controlHeight:p,colorTextPlaceholder:m,fontSize:y,fontSizeSM:w,lineHeight:x,lineWidth:C,colorIcon:P,colorIconHover:A,opacityLoading:S,controlInteractiveSize:v}=t,b=new Di(r).onBackground(n).toHexString(),T=new Di(i).onBackground(n).toHexString(),R=new Di(e).onBackground(n).toHexString(),M=new Di(P),D=new Di(A),k=v/2-C,N=k*2+C*3;return{headerBg:R,headerColor:o,headerSortActiveBg:b,headerSortHoverBg:T,bodySortBg:R,rowHoverBg:R,rowSelectedBg:a,rowSelectedHoverBg:l,rowExpandedBg:e,cellPaddingBlock:s,cellPaddingInline:s,cellPaddingBlockMD:c,cellPaddingInlineMD:u,cellPaddingBlockSM:u,cellPaddingInlineSM:u,borderColor:d,headerBorderRadius:f,footerBg:R,footerColor:o,cellFontSize:y,cellFontSizeMD:y,cellFontSizeSM:y,headerSplitColor:d,fixedHeaderSortActiveBg:b,headerFilterHoverBg:i,filterDropdownMenuBg:n,filterDropdownBg:n,expandIconBg:n,selectionColumnWidth:p,stickyScrollBarBg:m,stickyScrollBarBorderRadius:100,expandIconMarginTop:(y*x-C*3)/2-Math.ceil((w*1.4-C*3)/2),headerIconColor:M.clone().setA(M.a*S).toRgbString(),headerIconHoverColor:D.clone().setA(D.a*S).toRgbString(),expandIconHalfInner:k,expandIconSize:N,expandIconScale:v/N}},xRe=2,_rn=el("Table",t=>{const{colorTextHeading:e,colorSplit:n,colorBgContainer:o,controlInteractiveSize:r,headerBg:i,headerColor:a,headerSortActiveBg:l,headerSortHoverBg:s,bodySortBg:c,rowHoverBg:u,rowSelectedBg:d,rowSelectedHoverBg:f,rowExpandedBg:p,cellPaddingBlock:m,cellPaddingInline:y,cellPaddingBlockMD:w,cellPaddingInlineMD:x,cellPaddingBlockSM:C,cellPaddingInlineSM:P,borderColor:A,footerBg:S,footerColor:v,headerBorderRadius:b,cellFontSize:T,cellFontSizeMD:R,cellFontSizeSM:M,headerSplitColor:D,fixedHeaderSortActiveBg:k,headerFilterHoverBg:N,filterDropdownBg:U,expandIconBg:W,selectionColumnWidth:F,stickyScrollBarBg:E,calc:L}=t,j=Ui(t,{tableFontSize:T,tableBg:o,tableRadius:b,tablePaddingVertical:m,tablePaddingHorizontal:y,tablePaddingVerticalMiddle:w,tablePaddingHorizontalMiddle:x,tablePaddingVerticalSmall:C,tablePaddingHorizontalSmall:P,tableBorderColor:A,tableHeaderTextColor:a,tableHeaderBg:i,tableFooterTextColor:v,tableFooterBg:S,tableHeaderCellSplitColor:D,tableHeaderSortBg:l,tableHeaderSortHoverBg:s,tableBodySortBg:c,tableFixedHeaderSortActiveBg:k,tableHeaderFilterActiveBg:N,tableFilterDropdownBg:U,tableRowHoverBg:u,tableSelectedRowBg:d,tableSelectedRowHoverBg:f,zIndexTableFixed:xRe,zIndexTableSticky:L(xRe).add(1).equal({unit:!1}),tableFontSizeMiddle:R,tableFontSizeSmall:M,tableSelectionColumnWidth:F,tableExpandIconBg:W,tableExpandColumnWidth:L(r).add(L(t.padding).mul(2)).equal(),tableExpandedRowBg:p,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:E,tableScrollThumbBgHover:e,tableScrollBg:n});return[Yrn(j),krn(j),wRe(j),Urn(j),Drn(j),Hrn(j),Frn(j),zrn(j),wRe(j),Irn(j),Wrn(j),Ern(j),jrn(j),Mrn(j),Nrn(j),Lrn(j),Brn(j)]},Orn,{unitless:{expandIconScale:!0}}),Vrn=[],Grn=(t,e)=>{var n,o;const{prefixCls:r,className:i,rootClassName:a,style:l,size:s,bordered:c,dropdownPrefixCls:u,dataSource:d,pagination:f,rowSelection:p,rowKey:m="key",rowClassName:y,columns:w,children:x,childrenColumnName:C,onChange:P,getPopupContainer:A,loading:S,expandIcon:v,expandable:b,expandedRowRender:T,expandIconColumnIndex:R,indentSize:M,scroll:D,sortDirections:k,locale:N,showSorterTooltip:U={target:"full-header"},virtual:W}=t;LS();const F=g.useMemo(()=>w||m3e(x),[w,x]),E=g.useMemo(()=>F.some(Ct=>Ct.responsive),[F]),L=MZ(E),j=g.useMemo(()=>{const Ct=new Set(Object.keys(L).filter(yt=>L[yt]));return F.filter(yt=>!yt.responsive||yt.responsive.some(at=>Ct.has(at)))},[F,L]),Y=Mf(t,["className","style","columns"]),{locale:O=I3,direction:_,table:G,renderEmpty:Q,getPrefixCls:oe,getPopupContainer:ee}=g.useContext(gr),$=jd(s),ae=Object.assign(Object.assign({},O.Table),N),Z=d||Vrn,ne=oe("table",r),te=oe("dropdown",u),[,q]=Ff(),le=nu(ne),[de,he,me]=_rn(ne,le),ce=Object.assign(Object.assign({childrenColumnName:C,expandIconColumnIndex:R},b),{expandIcon:(n=b==null?void 0:b.expandIcon)!==null&&n!==void 0?n:(o=G==null?void 0:G.expandable)===null||o===void 0?void 0:o.expandIcon}),{childrenColumnName:Pe="children"}=ce,pe=g.useMemo(()=>Z.some(Ct=>Ct==null?void 0:Ct[Pe])?"nest":T||b!=null&&b.expandedRowRender?"row":null,[Z]),Ie={body:g.useRef(null)},ve=jon(ne),ze=g.useRef(null),Ae=g.useRef(null);Non(e,()=>Object.assign(Object.assign({},Ae.current),{nativeElement:ze.current}));const se=g.useMemo(()=>typeof m=="function"?m:Ct=>Ct==null?void 0:Ct[m],[m]),[ge]=wrn(Z,Pe,se),we={},Se=function(Ct,yt){let at=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;var Et,Lt,Je,st;const It=Object.assign(Object.assign({},we),Ct);at&&((Et=we.resetPagination)===null||Et===void 0||Et.call(we),!((Lt=It.pagination)===null||Lt===void 0)&&Lt.current&&(It.pagination.current=1),f&&((Je=f.onChange)===null||Je===void 0||Je.call(f,1,(st=It.pagination)===null||st===void 0?void 0:st.pageSize))),D&&D.scrollToFirstRowOnChange!==!1&&Ie.body.current&&okt(0,{getContainer:()=>Ie.body.current}),P==null||P(It.pagination,It.filters,It.sorter,{currentDataSource:ope(ipe(Z,It.sorterStates,Pe),It.filterStates,Pe),action:yt})},Me=(Ct,yt)=>{Se({sorter:Ct,sorterStates:yt},"sort",!1)},[Ce,Te,Re,Ne]=Trn({prefixCls:ne,mergedColumns:j,onSorterChange:Me,sortDirections:k||["ascend","descend"],tableLocale:ae,showSorterTooltip:U}),_e=g.useMemo(()=>ipe(Z,Te,Pe),[Z,Te]);we.sorter=Ne(),we.sorterStates=Te;const Ue=(Ct,yt)=>{Se({filters:Ct,filterStates:yt},"filter",!0)},[qe,Fe,He]=Arn({prefixCls:ne,locale:ae,dropdownPrefixCls:te,mergedColumns:j,onFilterChange:Ue,getPopupContainer:A||ee,rootClassName:Mn(a,le)}),Le=ope(_e,Fe,Pe);we.filters=He,we.filterStates=Fe;const Ye=g.useMemo(()=>{const Ct={};return Object.keys(He).forEach(yt=>{He[yt]!==null&&(Ct[yt]=He[yt])}),Object.assign(Object.assign({},Re),{filters:Ct})},[Re,He]),[lt]=Prn(Ye),Oe=(Ct,yt)=>{Se({pagination:Object.assign(Object.assign({},we.pagination),{current:Ct,pageSize:yt})},"paginate")},[ut,ht]=brn(Le.length,Oe,f);we.pagination=f===!1?{}:vrn(ut,f),we.resetPagination=ht;const Qe=g.useMemo(()=>{if(f===!1||!ut.pageSize)return Le;const{current:Ct=1,total:yt,pageSize:at=snt}=ut;return Le.lengthat?Le.slice((Ct-1)*at,Ct*at):Le:Le.slice((Ct-1)*at,Ct*at)},[!!f,Le,ut==null?void 0:ut.current,ut==null?void 0:ut.pageSize,ut==null?void 0:ut.total]),[nt,mt]=Lon({prefixCls:ne,data:Le,pageData:Qe,getRowKey:se,getRecordByKey:ge,expandType:pe,childrenColumnName:Pe,locale:ae,getPopupContainer:A||ee},p),tt=(Ct,yt,at)=>{let Et;return typeof y=="function"?Et=Mn(y(Ct,yt,at)):Et=Mn(y),Mn({[`${ne}-row-selected`]:mt.has(se(Ct,yt))},Et)};ce.__PARENT_RENDER_ICON__=ce.expandIcon,ce.expandIcon=ce.expandIcon||v||Uon(ae),pe==="nest"&&ce.expandIconColumnIndex===void 0?ce.expandIconColumnIndex=p?1:0:ce.expandIconColumnIndex>0&&p&&(ce.expandIconColumnIndex-=1),typeof ce.indentSize!="number"&&(ce.indentSize=typeof M=="number"?M:15);const gt=g.useCallback(Ct=>lt(nt(qe(Ce(Ct)))),[Ce,qe,nt]);let Ve,je;if(f!==!1&&(ut!=null&&ut.total)){let Ct;ut.size?Ct=ut.size:Ct=$==="small"||$==="middle"?"small":void 0;const yt=Lt=>g.createElement(ott,Object.assign({},ut,{className:Mn(`${ne}-pagination ${ne}-pagination-${Lt}`,ut.className),size:Ct})),at=_==="rtl"?"left":"right",{position:Et}=ut;if(Et!==null&&Array.isArray(Et)){const Lt=Et.find(It=>It.includes("top")),Je=Et.find(It=>It.includes("bottom")),st=Et.every(It=>`${It}`=="none");!Lt&&!Je&&!st&&(je=yt(at)),Lt&&(Ve=yt(Lt.toLowerCase().replace("top",""))),Je&&(je=yt(Je.toLowerCase().replace("bottom","")))}else je=yt(at)}let et;typeof S=="boolean"?et={spinning:S}:typeof S=="object"&&(et=Object.assign({spinning:!0},S));const bt=Mn(me,le,`${ne}-wrapper`,G==null?void 0:G.className,{[`${ne}-wrapper-rtl`]:_==="rtl"},i,a,he),St=Object.assign(Object.assign({},G==null?void 0:G.style),l),Pt=typeof(N==null?void 0:N.emptyText)<"u"?N.emptyText:(Q==null?void 0:Q("Table"))||g.createElement(y9e,{componentName:"Table"}),Yt=W?Rrn:Crn,zt={},Rt=g.useMemo(()=>{const{fontSize:Ct,lineHeight:yt,lineWidth:at,padding:Et,paddingXS:Lt,paddingSM:Je}=q,st=Math.floor(Ct*yt);switch($){case"middle":return Je*2+st+at;case"small":return Lt*2+st+at;default:return Et*2+st+at}},[q,$]);return W&&(zt.listItemHeight=Rt),de(g.createElement("div",{ref:ze,className:bt,style:St},g.createElement(Pee,Object.assign({spinning:!1},et),Ve,g.createElement(Yt,Object.assign({},zt,Y,{ref:Ae,columns:j,direction:_,expandable:ce,prefixCls:ne,className:Mn({[`${ne}-middle`]:$==="middle",[`${ne}-small`]:$==="small",[`${ne}-bordered`]:c,[`${ne}-empty`]:Z.length===0},me,le,he),data:Qe,rowKey:se,rowClassName:tt,emptyText:Pt,internalHooks:TU,internalRefs:Ie,transformColumns:gt,getContainerWidth:ve})),je)))},Xrn=g.forwardRef(Grn),Jrn=(t,e)=>{const n=g.useRef(0);return n.current+=1,g.createElement(Xrn,Object.assign({},t,{ref:e,_renderTimes:n.current}))},Bd=g.forwardRef(Jrn);Bd.SELECTION_COLUMN=zw;Bd.EXPAND_COLUMN=aA;Bd.SELECTION_ALL=Qhe;Bd.SELECTION_INVERT=Zhe;Bd.SELECTION_NONE=epe;Bd.Column=Pon;Bd.ColumnGroup=Con;Bd.Summary=Ptt;const Krn=t=>{const{paddingXXS:e,lineWidth:n,tagPaddingHorizontal:o,componentCls:r,calc:i}=t,a=i(o).sub(n).equal(),l=i(e).sub(n).equal();return{[r]:Object.assign(Object.assign({},Ua(t)),{display:"inline-block",height:"auto",marginInlineEnd:t.marginXS,paddingInline:a,fontSize:t.tagFontSize,lineHeight:t.tagLineHeight,whiteSpace:"nowrap",background:t.defaultBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,opacity:1,transition:`all ${t.motionDurationMid}`,textAlign:"start",position:"relative",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:t.defaultColor},[`${r}-close-icon`]:{marginInlineStart:l,fontSize:t.tagIconSize,color:t.colorTextDescription,cursor:"pointer",transition:`all ${t.motionDurationMid}`,"&:hover":{color:t.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${t.iconCls}-close, ${t.iconCls}-close:hover`]:{color:t.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:t.colorPrimary,backgroundColor:t.colorFillSecondary},"&:active, &-checked":{color:t.colorTextLightSolid},"&-checked":{backgroundColor:t.colorPrimary,"&:hover":{backgroundColor:t.colorPrimaryHover}},"&:active":{backgroundColor:t.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${t.iconCls} + span, > span + ${t.iconCls}`]:{marginInlineStart:a}}),[`${r}-borderless`]:{borderColor:"transparent",background:t.tagBorderlessBg}}},T3e=t=>{const{lineWidth:e,fontSizeIcon:n,calc:o}=t,r=t.fontSizeSM;return Ui(t,{tagFontSize:r,tagLineHeight:jt(o(t.lineHeightSM).mul(r).equal()),tagIconSize:o(n).sub(o(e).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:t.defaultBg})},P3e=t=>({defaultBg:new Di(t.colorFillQuaternary).onBackground(t.colorBgContainer).toHexString(),defaultColor:t.colorText}),dnt=el("Tag",t=>{const e=T3e(t);return Krn(e)},P3e);var $rn=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,style:o,className:r,checked:i,onChange:a,onClick:l}=t,s=$rn(t,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:c,tag:u}=g.useContext(gr),d=x=>{a==null||a(!i),l==null||l(x)},f=c("tag",n),[p,m,y]=dnt(f),w=Mn(f,`${f}-checkable`,{[`${f}-checkable-checked`]:i},u==null?void 0:u.className,r,m,y);return p(g.createElement("span",Object.assign({},s,{ref:e,style:Object.assign(Object.assign({},o),u==null?void 0:u.style),className:w,onClick:d})))}),Qrn=t=>sZ(t,(e,n)=>{let{textColor:o,lightBorderColor:r,lightColor:i,darkColor:a}=n;return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:o,background:i,borderColor:r,"&-inverse":{color:t.colorTextLightSolid,background:a,borderColor:a},[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}}),Zrn=rU(["Tag","preset"],t=>{const e=T3e(t);return Qrn(e)},P3e);function ein(t){return typeof t!="string"?t:t.charAt(0).toUpperCase()+t.slice(1)}const n_=(t,e,n)=>{const o=ein(n);return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:t[`color${n}`],background:t[`color${o}Bg`],borderColor:t[`color${o}Border`],[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}},tin=rU(["Tag","status"],t=>{const e=T3e(t);return[n_(e,"success","Success"),n_(e,"processing","Info"),n_(e,"error","Error"),n_(e,"warning","Warning")]},P3e);var nin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,className:o,rootClassName:r,style:i,children:a,icon:l,color:s,onClose:c,bordered:u=!0,visible:d}=t,f=nin(t,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:p,direction:m,tag:y}=g.useContext(gr),[w,x]=g.useState(!0),C=Mf(f,["closeIcon","closable"]);g.useEffect(()=>{d!==void 0&&x(d)},[d]);const P=DZ(s),A=IYt(s),S=P||A,v=Object.assign(Object.assign({backgroundColor:s&&!S?s:void 0},y==null?void 0:y.style),i),b=p("tag",n),[T,R,M]=dnt(b),D=Mn(b,y==null?void 0:y.className,{[`${b}-${s}`]:S,[`${b}-has-color`]:s&&!S,[`${b}-hidden`]:!w,[`${b}-rtl`]:m==="rtl",[`${b}-borderless`]:!u},o,r,R,M),k=L=>{L.stopPropagation(),c==null||c(L),!L.defaultPrevented&&x(!1)},[,N]=u9e(SH(t),SH(y),{closable:!1,closeIconRender:L=>{const j=g.createElement("span",{className:`${b}-close-icon`,onClick:k},L);return I$e(L,j,Y=>({onClick:O=>{var _;(_=Y==null?void 0:Y.onClick)===null||_===void 0||_.call(Y,O),k(O)},className:Mn(Y==null?void 0:Y.className,`${b}-close-icon`)}))}}),U=typeof f.onClick=="function"||a&&a.type==="a",W=l||null,F=W?g.createElement(g.Fragment,null,W,a&&g.createElement("span",null,a)):a,E=g.createElement("span",Object.assign({},C,{ref:e,className:D,style:v}),F,N,P&&g.createElement(Zrn,{key:"preset",prefixCls:b}),A&&g.createElement(tin,{key:"status",prefixCls:b}));return T(U?g.createElement(lU,{component:"Tag"},E):E)}),fnt=oin;fnt.CheckableTag=qrn;var rin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rg.createElement(ain,Object.assign({},t,{picker:"time",mode:void 0,ref:e}))),AA=g.forwardRef((t,e)=>{var{addon:n,renderExtraFooter:o,variant:r,bordered:i}=t,a=rin(t,["addon","renderExtraFooter","variant","bordered"]);const[l]=jS("timePicker",r,i),s=g.useMemo(()=>{if(o)return o;if(n)return n},[n,o]);return g.createElement(iin,Object.assign({},a,{mode:void 0,ref:e,renderExtraFooter:s,variant:l}))}),hnt=gU(AA,"popupAlign",void 0,"picker");AA._InternalPanelDoNotUseOrYouWillBeFired=hnt;AA.RangePicker=lin;AA._InternalPanelDoNotUseOrYouWillBeFired=hnt;const sin=(t,e,n,o)=>{const{titleMarginBottom:r,fontWeightStrong:i}=o;return{marginBottom:r,color:n,fontWeight:i,fontSize:t,lineHeight:e}},cin=t=>{const e=[1,2,3,4,5],n={};return e.forEach(o=>{n[` h${o}&, div&-h${o}, div&-h${o} > textarea, @@ -4834,7 +4834,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${e}-collapse, ${e}-edit, ${e}-copy - `]:Object.assign(Object.assign({},X5e(t)),{marginInlineStart:t.marginXXS})}),fin(t)),hin(t)),pin()),{"&-rtl":{direction:"rtl"}})}},min=()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"}),pnt=el("Typography",t=>[gin(t)],min),yin=t=>{const{prefixCls:e,"aria-label":n,className:o,style:r,direction:i,maxLength:a,autoSize:l=!0,value:s,onSave:c,onCancel:u,onEnd:d,component:f,enterIcon:p=g.createElement(ten,null)}=t,m=g.useRef(null),y=g.useRef(!1),w=g.useRef(null),[x,C]=g.useState(s);g.useEffect(()=>{C(s)},[s]),g.useEffect(()=>{var U;if(!((U=m.current)===null||U===void 0)&&U.resizableTextArea){const{textArea:W}=m.current.resizableTextArea;W.focus();const{length:F}=W.value;W.setSelectionRange(F,F)}},[]);const P=U=>{let{target:W}=U;C(W.value.replace(/[\n\r]/g,""))},A=()=>{y.current=!0},S=()=>{y.current=!1},v=U=>{let{keyCode:W}=U;y.current||(w.current=W)},b=()=>{c(x.trim())},T=U=>{let{keyCode:W,ctrlKey:F,altKey:E,metaKey:L,shiftKey:j}=U;w.current!==W||y.current||F||E||L||j||(W===IL.ENTER?(b(),d==null||d()):W===IL.ESC&&u())},R=()=>{b()},[M,D,k]=pnt(e),N=Mn(e,`${e}-edit-content`,{[`${e}-rtl`]:i==="rtl",[`${e}-${f}`]:!!f},o,D,k);return M(g.createElement("div",{className:N,style:r},g.createElement(Det,{ref:m,maxLength:a,value:x,onChange:P,onKeyDown:v,onKeyUp:T,onCompositionStart:A,onCompositionEnd:S,onBlur:R,"aria-label":n,rows:1,autoSize:l}),p!==null?P0(p,{className:`${e}-edit-content-confirm`}):null))};var Ain=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],o=0;o"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=vRe[e.format]||vRe.default;window.clipboardData.setData(d,t)}else u.clipboardData.clearData(),u.clipboardData.setData(e.format,t);e.onCopy&&(u.preventDefault(),e.onCopy(u.clipboardData))}),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i);var c=document.execCommand("copy");if(!c)throw new Error("copy command was unsuccessful");s=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),s=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),o=vin("message"in e?e.message:xin),window.prompt(o,t)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),r()}return s}var Sin=bin;const Tin=ji(Sin);var Pin=function(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,e||[])).next())})};const Cin=t=>{let{copyConfig:e,children:n}=t;const[o,r]=g.useState(!1),[i,a]=g.useState(!1),l=g.useRef(null),s=()=>{l.current&&clearTimeout(l.current)},c={};e.format&&(c.format=e.format),g.useEffect(()=>s,[]);const u=kd(d=>Pin(void 0,void 0,void 0,function*(){var f;d==null||d.preventDefault(),d==null||d.stopPropagation(),a(!0);try{const p=typeof e.text=="function"?yield e.text():e.text;Tin(p||XQt(n,!0).join("")||"",c),a(!1),r(!0),s(),l.current=setTimeout(()=>{r(!1)},3e3),(f=e.onCopy)===null||f===void 0||f.call(e,d)}catch(p){throw a(!1),p}}));return{copied:o,copyLoading:i,onClick:u}};function hse(t,e){return g.useMemo(()=>{const n=!!t;return[n,Object.assign(Object.assign({},e),n&&typeof t=="object"?t:null)]},[t])}const Rin=t=>{const e=g.useRef(void 0);return g.useEffect(()=>{e.current=t}),e.current},Hin=(t,e,n)=>g.useMemo(()=>t===!0?{title:e??n}:g.isValidElement(t)?{title:t}:typeof t=="object"?Object.assign({title:e??n},t):{title:t},[t,e,n]);var Min=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,component:o="article",className:r,rootClassName:i,setContentRef:a,children:l,direction:s,style:c}=t,u=Min(t,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:d,direction:f,typography:p}=g.useContext(gr),m=s??f,y=a?e2(e,a):e,w=d("typography",n),[x,C,P]=pnt(w),A=Mn(w,p==null?void 0:p.className,{[`${w}-rtl`]:m==="rtl"},r,i,C,P),S=Object.assign(Object.assign({},p==null?void 0:p.style),c);return x(g.createElement(o,Object.assign({className:A,style:S,ref:y},u),l))});function bRe(t){return t===!1?[!1,!1]:Array.isArray(t)?t:[t]}function pse(t,e,n){return t===!0||t===void 0?e:t||n&&e}function Iin(t){const e=document.createElement("em");t.appendChild(e);const n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return t.removeChild(e),n.left>o.left||o.right>n.right||n.top>o.top||o.bottom>n.bottom}const C3e=t=>["string","number"].includes(typeof t),zin=t=>{let{prefixCls:e,copied:n,locale:o,iconOnly:r,tooltips:i,icon:a,tabIndex:l,onCopy:s,loading:c}=t;const u=bRe(i),d=bRe(a),{copied:f,copy:p}=o??{},m=n?f:p,y=pse(u[n?1:0],m),w=typeof y=="string"?y:m;return g.createElement(k3,{title:y},g.createElement("button",{type:"button",className:Mn(`${e}-copy`,{[`${e}-copy-success`]:n,[`${e}-copy-icon-only`]:r}),onClick:s,"aria-label":w,tabIndex:l},n?pse(d[1],g.createElement(fQe,null),!0):pse(d[0],c?g.createElement(qM,null):g.createElement(dtt,null),!0)))},o_=g.forwardRef((t,e)=>{let{style:n,children:o}=t;const r=g.useRef(null);return g.useImperativeHandle(e,()=>({isExceed:()=>{const i=r.current;return i.scrollHeight>i.clientHeight},getHeight:()=>r.current.clientHeight})),g.createElement("span",{"aria-hidden":!0,ref:r,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},n)},o)}),Din=t=>t.reduce((e,n)=>e+(C3e(n)?String(n).length:1),0);function SRe(t,e){let n=0;const o=[];for(let r=0;re){const c=e-n;return o.push(String(i).slice(0,c)),o}o.push(i),n=s}return t}const gse=0,mse=1,yse=2,Ase=3,TRe=4,r_={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function Ein(t){const{enableMeasure:e,width:n,text:o,children:r,rows:i,expanded:a,miscDeps:l,onEllipsis:s}=t,c=g.useMemo(()=>jy(o),[o]),u=g.useMemo(()=>Din(c),[o]),d=g.useMemo(()=>r(c,!1),[o]),[f,p]=g.useState(null),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),[P,A]=g.useState(!1),[S,v]=g.useState(gse),[b,T]=g.useState(0),[R,M]=g.useState(null);MA(()=>{v(e&&n&&u?mse:gse)},[n,o,i,e,c]),MA(()=>{var U,W,F,E;if(S===mse){v(yse);const L=y.current&&getComputedStyle(y.current).whiteSpace;M(L)}else if(S===yse){const L=!!(!((U=w.current)===null||U===void 0)&&U.isExceed());v(L?Ase:TRe),p(L?[0,u]:null),A(L);const j=((W=w.current)===null||W===void 0?void 0:W.getHeight())||0,Y=i===1?0:((F=x.current)===null||F===void 0?void 0:F.getHeight())||0,O=((E=C.current)===null||E===void 0?void 0:E.getHeight())||0,_=Math.max(j,Y+O);T(_+1),s(L)}},[S]);const D=f?Math.ceil((f[0]+f[1])/2):0;MA(()=>{var U;const[W,F]=f||[0,0];if(W!==F){const L=(((U=m.current)===null||U===void 0?void 0:U.getHeight())||0)>b;let j=D;F-W===1&&(j=L?W:F),p(L?[W,j]:[j,F])}},[f,D]);const k=g.useMemo(()=>{if(!e)return r(c,!1);if(S!==Ase||!f||f[0]!==f[1]){const U=r(c,!1);return[TRe,gse].includes(S)?U:g.createElement("span",{style:Object.assign(Object.assign({},r_),{WebkitLineClamp:i})},U)}return r(a?c:SRe(c,f[0]),P)},[a,S,f,c].concat(Pa(l))),N={width:n,margin:0,padding:0,whiteSpace:R==="nowrap"?"normal":"inherit"};return g.createElement(g.Fragment,null,k,S===yse&&g.createElement(g.Fragment,null,g.createElement(o_,{style:Object.assign(Object.assign(Object.assign({},N),r_),{WebkitLineClamp:i}),ref:w},d),g.createElement(o_,{style:Object.assign(Object.assign(Object.assign({},N),r_),{WebkitLineClamp:i-1}),ref:x},d),g.createElement(o_,{style:Object.assign(Object.assign(Object.assign({},N),r_),{WebkitLineClamp:1}),ref:C},r([],!0))),S===Ase&&f&&f[0]!==f[1]&&g.createElement(o_,{style:Object.assign(Object.assign({},N),{top:400}),ref:m},r(SRe(c,D),!0)),S===mse&&g.createElement("span",{style:{whiteSpace:"inherit"},ref:y}))}const kin=t=>{let{enableEllipsis:e,isEllipsis:n,children:o,tooltipProps:r}=t;return!(r!=null&&r.title)||!e?o:g.createElement(k3,Object.assign({open:n?void 0:!1},r),o)};var Fin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,className:r,style:i,type:a,disabled:l,children:s,ellipsis:c,editable:u,copyable:d,component:f,title:p}=t,m=Fin(t,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:y,direction:w}=g.useContext(gr),[x]=r6("Text"),C=g.useRef(null),P=g.useRef(null),A=y("typography",o),S=Mf(m,["mark","code","delete","underline","strong","keyboard","italic"]),[v,b]=hse(u),[T,R]=qA(!1,{value:b.editing}),{triggerType:M=["icon"]}=b,D=Fe=>{var He;Fe&&((He=b.onStart)===null||He===void 0||He.call(b)),R(Fe)},k=Rin(T);MA(()=>{var Fe;!T&&k&&((Fe=P.current)===null||Fe===void 0||Fe.focus())},[T]);const N=Fe=>{Fe==null||Fe.preventDefault(),D(!0)},U=Fe=>{var He;(He=b.onChange)===null||He===void 0||He.call(b,Fe),D(!1)},W=()=>{var Fe;(Fe=b.onCancel)===null||Fe===void 0||Fe.call(b),D(!1)},[F,E]=hse(d),{copied:L,copyLoading:j,onClick:Y}=Cin({copyConfig:E,children:s}),[O,_]=g.useState(!1),[G,Q]=g.useState(!1),[oe,ee]=g.useState(!1),[q,ae]=g.useState(!1),[Z,ne]=g.useState(!0),[te,$]=hse(c,{expandable:!1,symbol:Fe=>Fe?x==null?void 0:x.collapse:x==null?void 0:x.expand}),[le,de]=qA($.defaultExpanded||!1,{value:$.expanded}),he=te&&(!le||$.expandable==="collapsible"),{rows:me=1}=$,ce=g.useMemo(()=>he&&($.suffix!==void 0||$.onEllipsis||$.expandable||v||F),[he,$,v,F]);MA(()=>{te&&!ce&&(_(RTe("webkitLineClamp")),Q(RTe("textOverflow")))},[ce,te]);const[Pe,pe]=g.useState(he),Ie=g.useMemo(()=>ce?!1:me===1?G:O,[ce,G,O]);MA(()=>{pe(Ie&&he)},[Ie,he]);const ve=he&&(Pe?q:oe),ze=he&&me===1&&Pe,Ae=he&&me>1&&Pe,se=(Fe,He)=>{var Le;de(He.expanded),(Le=$.onExpand)===null||Le===void 0||Le.call($,Fe,He)},[ge,we]=g.useState(0),Se=Fe=>{let{offsetWidth:He}=Fe;we(He)},Me=Fe=>{var He;ee(Fe),oe!==Fe&&((He=$.onEllipsis)===null||He===void 0||He.call($,Fe))};g.useEffect(()=>{const Fe=C.current;if(te&&Pe&&Fe){const He=Iin(Fe);q!==He&&ae(He)}},[te,Pe,s,Ae,Z,ge]),g.useEffect(()=>{const Fe=C.current;if(typeof IntersectionObserver>"u"||!Fe||!Pe||!he)return;const He=new IntersectionObserver(()=>{ne(!!Fe.offsetParent)});return He.observe(Fe),()=>{He.disconnect()}},[Pe,he]);const Ce=Hin($.tooltip,b.text,s),Te=g.useMemo(()=>{if(!(!te||Pe))return[b.text,s,p,Ce.title].find(C3e)},[te,Pe,p,Ce.title,ve]);if(T)return g.createElement(yin,{value:(n=b.text)!==null&&n!==void 0?n:typeof s=="string"?s:"",onSave:U,onCancel:W,onEnd:b.onEnd,prefixCls:A,className:r,style:i,direction:w,component:f,maxLength:b.maxLength,autoSize:b.autoSize,enterIcon:b.enterIcon});const Re=()=>{const{expandable:Fe,symbol:He}=$;return Fe?g.createElement("button",{type:"button",key:"expand",className:`${A}-${le?"collapse":"expand"}`,onClick:Le=>se(Le,{expanded:!le}),"aria-label":le?x.collapse:x==null?void 0:x.expand},typeof He=="function"?He(le):He):null},Ne=()=>{if(!v)return;const{icon:Fe,tooltip:He,tabIndex:Le}=b,Ye=jy(He)[0]||(x==null?void 0:x.edit),lt=typeof Ye=="string"?Ye:"";return M.includes("icon")?g.createElement(k3,{key:"edit",title:He===!1?"":Ye},g.createElement("button",{type:"button",ref:P,className:`${A}-edit`,onClick:N,"aria-label":lt,tabIndex:Le},Fe||g.createElement(htt,{role:"button"}))):null},_e=()=>F?g.createElement(zin,Object.assign({key:"copy"},E,{prefixCls:A,copied:L,locale:x,onCopy:Y,loading:j,iconOnly:s==null})):null,Ue=Fe=>[Fe&&Re(),Ne(),_e()],qe=Fe=>[Fe&&!le&&g.createElement("span",{"aria-hidden":!0,key:"ellipsis"},Win),$.suffix,Ue(Fe)];return g.createElement(VQ,{onResize:Se,disabled:!he},Fe=>g.createElement(kin,{tooltipProps:Ce,enableEllipsis:he,isEllipsis:ve},g.createElement(gnt,Object.assign({className:Mn({[`${A}-${a}`]:a,[`${A}-disabled`]:l,[`${A}-ellipsis`]:te,[`${A}-ellipsis-single-line`]:ze,[`${A}-ellipsis-multiple-line`]:Ae},r),prefixCls:o,style:Object.assign(Object.assign({},i),{WebkitLineClamp:Ae?me:void 0}),component:f,ref:e2(Fe,C,e),direction:w,onClick:M.includes("text")?N:void 0,"aria-label":Te==null?void 0:Te.toString(),title:p},S),g.createElement(Ein,{enableMeasure:he&&!Pe,text:s,rows:me,width:ge,onEllipsis:Me,expanded:le,miscDeps:[L,le,j,v,F,x]},(He,Le)=>Lin(t,g.createElement(g.Fragment,null,He.length>0&&Le&&!le&&Te?g.createElement("span",{key:"show-content","aria-hidden":!0},He):He,qe(Le)))))))});var Nin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n,rel:o}=t,r=Nin(t,["ellipsis","rel"]);const i=Object.assign(Object.assign({},r),{rel:o===void 0&&r.target==="_blank"?"noopener noreferrer":o});return delete i.navigate,g.createElement(Oee,Object.assign({},i,{ref:e,ellipsis:!!n,component:"a"}))}),jin=g.forwardRef((t,e)=>g.createElement(Oee,Object.assign({ref:e},t,{component:"div"})));var Bin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n}=t,o=Bin(t,["ellipsis"]);const r=g.useMemo(()=>n&&typeof n=="object"?Mf(n,["expandable","rows"]):n,[n]);return g.createElement(Oee,Object.assign({ref:e},o,{ellipsis:r,component:"span"}))},Oin=g.forwardRef(Yin);var _in=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{level:n=1}=t,o=_in(t,["level"]),r=Vin.includes(n)?`h${n}`:"h1";return g.createElement(Oee,Object.assign({ref:e},o,{component:r}))}),DA=gnt;DA.Text=Oin;DA.Link=Uin;DA.Title=Gin;DA.Paragraph=jin;const Xin=g.forwardRef((t,e)=>{const{prefixCls:n,className:o,children:r,size:i,style:a={}}=t,l=Mn(`${n}-panel`,{[`${n}-panel-hidden`]:i===0},o),s=i!==void 0;return xe.createElement("div",{ref:e,className:l,style:Object.assign(Object.assign({},a),{flexBasis:s?i:"auto",flexGrow:s?0:1})},r)}),Jin=()=>null;var Kin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rjy(t).filter(g.isValidElement).map(n=>{const{props:o}=n,{collapsible:r}=o,i=Kin(o,["collapsible"]);return Object.assign(Object.assign({},i),{collapsible:$in(r)})}),[t])}function Qin(t,e,n){return g.useMemo(()=>{const o=[];for(let r=0;r0||m.start&&s===0&&l>0,x=m.start&&s>0||d.end&&l===0&&s>0;o[r]={resizable:y,startCollapsible:!!(n?x:w),endCollapsible:!!(n?w:x)}}return o},[e,t])}function xG(t){return Number(t.slice(0,-1))/100}function wse(t){return typeof t=="string"&&t.endsWith("%")}function Zin(t,e){const n=t.map(m=>m.size),o=t.length,r=e||0,i=m=>m*r,[a,l]=xe.useState(()=>t.map(m=>m.defaultSize)),s=xe.useMemo(()=>{var m;const y=[];for(let w=0;w{let m=[],y=0;for(let x=0;xx+(C||0),0);if(w>1||!y){const x=1/w;m=m.map(C=>C===void 0?0:C*x)}else{const x=(1-w)/y;m=m.map(C=>C===void 0?x:C)}return m},[s,r]),u=xe.useMemo(()=>c.map(i),[c,r]),d=xe.useMemo(()=>t.map(m=>wse(m.min)?xG(m.min):(m.min||0)/r),[t,r]),f=xe.useMemo(()=>t.map(m=>wse(m.max)?xG(m.max):(m.max||r)/r),[t,r]);return[xe.useMemo(()=>e?u:s,[u,e]),u,c,d,f,l]}function ean(t,e,n,o,r,i){const a=t.map(A=>[A.min,A.max]),l=o||0,s=A=>A*l;function c(A,S){return typeof A=="string"?s(xG(A)):A??S}const[u,d]=g.useState([]),f=g.useRef([]),[p,m]=g.useState(null),y=()=>n.map(s);return[A=>{d(y()),m({index:A,confirmed:!1})},(A,S)=>{var v;let b=null;if((!p||!p.confirmed)&&S!==0){if(S>0)b=A,m({index:A,confirmed:!0});else for(let F=A;F>=0;F-=1)if(u[F]>0&&e[F].resizable){b=F,m({index:F,confirmed:!0});break}}const T=(v=b??(p==null?void 0:p.index))!==null&&v!==void 0?v:A,R=Pa(u),M=T+1,D=c(a[T][0],0),k=c(a[M][0],0),N=c(a[T][1],l),U=c(a[M][1],l);let W=S;return R[T]+WN&&(W=N-R[T]),R[M]-W>U&&(W=R[M]-U),R[T]+=W,R[M]-=W,r(R),R},()=>{m(null)},(A,S)=>{const v=y(),b=i?S==="start"?"end":"start":S,T=b==="start"?A:A+1,R=b==="start"?A+1:A,M=v[T],D=v[R];if(M!==0&&D!==0)v[T]=0,v[R]+=M,f.current[A]=M;else{const k=M+D,N=c(a[T][0],0),U=c(a[T][1],l),W=c(a[R][0],0),F=c(a[R][1],l),E=Math.max(N,k-F),j=(Math.min(U,k-W)-E)/2,Y=f.current[A],O=k-Y;Y&&Y<=F&&Y>=W&&O<=U&&O>=N?(v[R]=Y,v[T]=O):(v[T]-=j,v[R]+=j)}return r(v),v},p==null?void 0:p.index]}function xse(t){return typeof t=="number"&&!Number.isNaN(t)?Math.round(t):0}const tan=t=>{const{prefixCls:e,vertical:n,index:o,active:r,ariaNow:i,ariaMin:a,ariaMax:l,resizable:s,startCollapsible:c,endCollapsible:u,onOffsetStart:d,onOffsetUpdate:f,onOffsetEnd:p,onCollapse:m,lazy:y,containerSize:w}=t,x=`${e}-bar`,[C,P]=g.useState(null),[A,S]=g.useState(0),v=n?0:A,b=n?A:0,T=F=>{s&&F.currentTarget&&(P([F.pageX,F.pageY]),d(o))},R=F=>{if(s&&F.touches.length===1){const E=F.touches[0];P([E.pageX,E.pageY]),d(o)}},M=F=>{const E=w*i/100,L=E+F,j=Math.max(0,w*a/100),Y=Math.min(w,w*l/100);return Math.max(j,Math.min(Y,L))-E},D=kd((F,E)=>{const L=M(n?E:F);S(L)}),k=kd(()=>{f(o,v,b),S(0)});xe.useEffect(()=>{if(C){const F=Y=>{const{pageX:O,pageY:_}=Y,G=O-C[0],Q=_-C[1];y?D(G,Q):f(o,G,Q)},E=()=>{y&&k(),P(null),p()},L=Y=>{if(Y.touches.length===1){const O=Y.touches[0],_=O.pageX-C[0],G=O.pageY-C[1];y?D(_,G):f(o,_,G)}},j=()=>{y&&k(),P(null),p()};return window.addEventListener("touchmove",L),window.addEventListener("touchend",j),window.addEventListener("mousemove",F),window.addEventListener("mouseup",E),()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",E),window.removeEventListener("touchmove",L),window.removeEventListener("touchend",j)}}},[C,y,n,o,w,i,a,l]);const N={[`--${x}-preview-offset`]:`${A}px`},U=n?Aet:sJ,W=n?RZ:xH;return xe.createElement("div",{className:x,role:"separator","aria-valuenow":xse(i),"aria-valuemin":xse(a),"aria-valuemax":xse(l)},y&&xe.createElement("div",{className:Mn(`${x}-preview`,{[`${x}-preview-active`]:!!A}),style:N}),xe.createElement("div",{className:Mn(`${x}-dragger`,{[`${x}-dragger-disabled`]:!s,[`${x}-dragger-active`]:r}),onMouseDown:T,onTouchStart:R}),c&&xe.createElement("div",{className:Mn(`${x}-collapse-bar`,`${x}-collapse-bar-start`),onClick:()=>m(o,"start")},xe.createElement(U,{className:Mn(`${x}-collapse-icon`,`${x}-collapse-start`)})),u&&xe.createElement("div",{className:Mn(`${x}-collapse-bar`,`${x}-collapse-bar-end`),onClick:()=>m(o,"end")},xe.createElement(W,{className:Mn(`${x}-collapse-icon`,`${x}-collapse-end`)})))},nan=t=>{const{componentCls:e}=t;return{[`&-rtl${e}-horizontal`]:{[`> ${e}-bar`]:{[`${e}-bar-collapse-previous`]:{insetInlineEnd:0,insetInlineStart:"unset"},[`${e}-bar-collapse-next`]:{insetInlineEnd:"unset",insetInlineStart:0}}},[`&-rtl${e}-vertical`]:{[`> ${e}-bar`]:{[`${e}-bar-collapse-previous`]:{insetInlineEnd:"50%",insetInlineStart:"unset"},[`${e}-bar-collapse-next`]:{insetInlineEnd:"50%",insetInlineStart:"unset"}}}}},i_={position:"absolute",top:"50%",left:{_skip_check_:!0,value:"50%"},transform:"translate(-50%, -50%)"},oan=t=>{const{componentCls:e,colorFill:n,splitBarDraggableSize:o,splitBarSize:r,splitTriggerSize:i,controlItemBgHover:a,controlItemBgActive:l,controlItemBgActiveHover:s,prefixCls:c}=t,u=`${e}-bar`,d=`${e}-mask`,f=`${e}-panel`,p=t.calc(i).div(2).equal(),m=`${c}-bar-preview-offset`,y={position:"absolute",background:t.colorPrimary,opacity:.2,pointerEvents:"none",transition:"none",zIndex:1,display:"none"};return{[e]:Object.assign(Object.assign(Object.assign({},Ua(t)),{display:"flex",width:"100%",height:"100%",alignItems:"stretch",[`> ${u}`]:{flex:"none",position:"relative",userSelect:"none",[`${u}-dragger`]:Object.assign(Object.assign({},i_),{zIndex:1,"&::before":Object.assign({content:'""',background:a},i_),"&::after":Object.assign({content:'""',background:n},i_),[`&:hover:not(${u}-dragger-active)`]:{"&::before":{background:l}},"&-active":{zIndex:2,"&::before":{background:s}},[`&-disabled${u}-dragger`]:{zIndex:0,"&, &:hover, &-active":{cursor:"default","&::before":{background:a}},"&::after":{display:"none"}}}),[`${u}-collapse-bar`]:Object.assign(Object.assign({},i_),{zIndex:t.zIndexPopupBase,background:a,fontSize:t.fontSizeSM,borderRadius:t.borderRadiusXS,color:t.colorText,cursor:"pointer",opacity:0,display:"flex",alignItems:"center",justifyContent:"center","&:hover":{background:l},"&:active":{background:s}}),"&:hover, &:active":{[`${u}-collapse-bar`]:{opacity:1}}},[d]:{position:"fixed",zIndex:t.zIndexPopupBase,inset:0,"&-horizontal":{cursor:"col-resize"},"&-vertical":{cursor:"row-resize"}},"&-horizontal":{flexDirection:"row",[`> ${u}`]:{width:0,[`${u}-preview`]:Object.assign(Object.assign({height:"100%",width:r},y),{[`&${u}-preview-active`]:{display:"block",transform:`translateX(var(--${m}))`}}),[`${u}-dragger`]:{cursor:"col-resize",height:"100%",width:i,"&::before":{height:"100%",width:r},"&::after":{height:o,width:r}},[`${u}-collapse-bar`]:{width:t.fontSizeSM,height:t.controlHeightSM,"&-start":{left:{_skip_check_:!0,value:"auto"},right:{_skip_check_:!0,value:p},transform:"translateY(-50%)"},"&-end":{left:{_skip_check_:!0,value:p},right:{_skip_check_:!0,value:"auto"},transform:"translateY(-50%)"}}}},"&-vertical":{flexDirection:"column",[`> ${u}`]:{height:0,[`${u}-preview`]:Object.assign(Object.assign({height:r,width:"100%"},y),{[`&${u}-preview-active`]:{display:"block",transform:`translateY(var(--${m}))`}}),[`${u}-dragger`]:{cursor:"row-resize",width:"100%",height:i,"&::before":{width:"100%",height:r},"&::after":{width:o,height:r}},[`${u}-collapse-bar`]:{height:t.fontSizeSM,width:t.controlHeightSM,"&-start":{top:"auto",bottom:p,transform:"translateX(-50%)"},"&-end":{top:p,bottom:"auto",transform:"translateX(-50%)"}}}},[f]:{overflow:"auto",padding:"0 1px",scrollbarWidth:"thin",boxSizing:"border-box","&-hidden":{padding:0,overflow:"hidden"},[`&:has(${e}:only-child)`]:{overflow:"hidden"}}}),nan(t))}},ran=t=>{var e;const n=t.splitBarSize||2,o=t.splitTriggerSize||6,r=t.resizeSpinnerSize||20,i=(e=t.splitBarDraggableSize)!==null&&e!==void 0?e:r;return{splitBarSize:n,splitTriggerSize:o,splitBarDraggableSize:i,resizeSpinnerSize:r}},ian=el("Splitter",t=>[oan(t)],ran),aan=t=>{const{prefixCls:e,className:n,style:o,layout:r="horizontal",children:i,rootClassName:a,onResizeStart:l,onResize:s,onResizeEnd:c,lazy:u}=t,{getPrefixCls:d,direction:f,splitter:p}=xe.useContext(gr),m=d("splitter",e),y=nu(m),[w,x,C]=ian(m,y),P=r==="vertical",A=f==="rtl",S=!P&&A,v=qin(i),[b,T]=g.useState(),R=ne=>{const{offsetWidth:te,offsetHeight:$}=ne,le=P?$:te;le!==0&&T(le)},[M,D,k,N,U,W]=Zin(v,b),F=Qin(v,D,A),[E,L,j,Y,O]=ean(v,F,k,b,W,A),_=kd(ne=>{E(ne),l==null||l(D)}),G=kd((ne,te)=>{const $=L(ne,te);s==null||s($)}),Q=kd(()=>{j(),c==null||c(D)}),oe=kd((ne,te)=>{const $=Y(ne,te);s==null||s($),c==null||c($)}),ee=Mn(m,n,`${m}-${r}`,{[`${m}-rtl`]:A},a,p==null?void 0:p.className,C,y,x),q=`${m}-mask`,ae=xe.useMemo(()=>{const ne=[];let te=0;for(let $=0;${const $=xe.createElement(Xin,Object.assign({},ne,{prefixCls:m,size:M[te]}));let le=null;const de=F[te];if(de){const he=(ae[te-1]||0)+N[te],me=(ae[te+1]||100)-U[te+1],ce=(ae[te-1]||0)+U[te],Pe=(ae[te+1]||100)-N[te+1];le=xe.createElement(tan,{lazy:u,index:te,active:O===te,prefixCls:m,vertical:P,resizable:de.resizable,ariaNow:ae[te]*100,ariaMin:Math.max(he,me)*100,ariaMax:Math.min(ce,Pe)*100,startCollapsible:de.startCollapsible,endCollapsible:de.endCollapsible,onOffsetStart:_,onOffsetUpdate:(pe,Ie,ve)=>{let ze=P?ve:Ie;S&&(ze=-ze),G(pe,ze)},onOffsetEnd:Q,onCollapse:oe,containerSize:b||0})}return xe.createElement(xe.Fragment,{key:`split-panel-${te}`},$,le)}),typeof O=="number"&&xe.createElement("div",{"aria-hidden":!0,className:Mn(q,`${q}-${r}`)}))))},fv=aan;fv.Panel=Jin;const PRe="/aladdin/assets/apple_spring-Ctq5fKrS.png",ape="/aladdin/assets/apple_summer-Dr8H3cny.png",CRe="/aladdin/assets/apple_fall-Cp6pAzIj.png",RRe="/aladdin/assets/apple_winter-D03fshM0.png",HRe="/aladdin/assets/birch_spring-sKFxYorO.png",lpe="/aladdin/assets/birch_summer-FaJ43Xt4.png",MRe="/aladdin/assets/birch_fall-PIQyyY4L.png",IRe="/aladdin/assets/birch_winter-C5h1hTVJ.png",mnt="/aladdin/assets/coconut-rkhxogn3.png",zRe="/aladdin/assets/dogwood_spring-9vLsm3g2.png",spe="/aladdin/assets/dogwood_summer-DgdkRZ2O.png",DRe="/aladdin/assets/dogwood_fall-Wu983FGV.png",ERe="/aladdin/assets/dogwood_winter-4w2TO6RG.png",kRe="/aladdin/assets/elm_spring-DJcRoCq2.png",cpe="/aladdin/assets/elm_summer-VNy_g1qe.png",FRe="/aladdin/assets/elm_fall-ChdMN8fe.png",LRe="/aladdin/assets/elm_winter-Qng-eWYe.png",ynt="/aladdin/assets/fan_palm-DbCJ1Nso.png",WRe="/aladdin/assets/linden_spring-C_zkyu46.png",upe="/aladdin/assets/linden_summer-zap94GfP.png",NRe="/aladdin/assets/linden_fall-CK-BpZ7U.png",URe="/aladdin/assets/linden_winter-Dt7sgspu.png",jRe="/aladdin/assets/magnolia_spring-CNor1Lb8.png",dpe="/aladdin/assets/magnolia_summer-C7-8T4uo.png",BRe="/aladdin/assets/magnolia_fall-D3wi6n7Y.png",YRe="/aladdin/assets/magnolia_winter-116tEre9.png",ORe="/aladdin/assets/maple_spring-26OHjb4f.png",fpe="/aladdin/assets/maple_summer-BbcBLKSJ.png",_Re="/aladdin/assets/maple_fall-Bp5Vy2Jl.png",VRe="/aladdin/assets/maple_winter-BnFW631O.png",GRe="/aladdin/assets/oak_spring-CsUg07TC.png",hpe="/aladdin/assets/oak_summer-CPK7amde.png",XRe="/aladdin/assets/oak_fall-rgRz_M_t.png",JRe="/aladdin/assets/oak_winter-CD4uumS6.png",Ant="/aladdin/assets/pine-CI5zZHth.png",wnt="/aladdin/assets/spruce-CEhjo5-Q.png";class Sv{static isEvergreen(e){return e===yr.Spruce||e===yr.Pine||e===yr.FanPalm||e===yr.Coconut}static isConic(e){return e===yr.Spruce}static fetchLabel(e,n){switch(e){case yr.Apple:return B.t("tree.Apple",n);case yr.Birch:return B.t("tree.Birch",n);case yr.Coconut:return B.t("tree.Coconut",n);case yr.Dogwood:return B.t("tree.Dogwood",n);case yr.Elm:return B.t("tree.Elm",n);case yr.FanPalm:return B.t("tree.FanPalm",n);case yr.Linden:return B.t("tree.Linden",n);case yr.Magnolia:return B.t("tree.Magnolia",n);case yr.Maple:return B.t("tree.Maple",n);case yr.Oak:return B.t("tree.Oak",n);case yr.Spruce:return B.t("tree.Spruce",n);default:return B.t("tree.Pine",n)}}static fetchTheta(e){switch(e){case yr.Apple:return .65*Math.PI;case yr.Birch:return .72*Math.PI;case yr.Coconut:return .5*Math.PI;case yr.Dogwood:return .65*Math.PI;case yr.Elm:return .78*Math.PI;case yr.FanPalm:return .52*Math.PI;case yr.Linden:return .75*Math.PI;case yr.Magnolia:return .68*Math.PI;case yr.Maple:return .65*Math.PI;case yr.Oak:return .75*Math.PI;case yr.Spruce:return Math.PI;default:return Math.PI*.5}}static fetchTextureImage(e,n,o,r,i){let a;const l=r+30,s=i-30,c=o>0;switch(e){case yr.Apple:n>=i||n<=r?a=c?RRe:ape:n>r&&n<=l?a=c?PRe:CRe:n>l&&n<=s?a=c?ape:RRe:a=c?CRe:PRe;break;case yr.Birch:n>=i||n<=r?a=c?IRe:lpe:n>r&&n<=l?a=c?HRe:MRe:n>l&&n<=s?a=c?lpe:IRe:a=c?MRe:HRe;break;case yr.Coconut:a=mnt;break;case yr.Dogwood:n>=i||n<=r?a=c?ERe:spe:n>r&&n<=l?a=c?zRe:DRe:n>l&&n<=s?a=c?spe:ERe:a=c?DRe:zRe;break;case yr.Elm:n>=i||n<=r?a=c?LRe:cpe:n>r&&n<=l?a=c?kRe:FRe:n>l&&n<=s?a=c?cpe:LRe:a=c?FRe:kRe;break;case yr.FanPalm:a=ynt;break;case yr.Linden:n>=i||n<=r?a=c?URe:upe:n>r&&n<=l?a=c?WRe:NRe:n>l&&n<=s?a=c?upe:URe:a=c?NRe:WRe;break;case yr.Magnolia:n>=i||n<=r?a=c?YRe:dpe:n>r&&n<=l?a=c?jRe:BRe:n>l&&n<=s?a=c?dpe:YRe:a=c?BRe:jRe;break;case yr.Maple:n>=i||n<=r?a=c?VRe:fpe:n>r&&n<=l?a=c?ORe:_Re:n>l&&n<=s?a=c?fpe:VRe:a=c?_Re:ORe;break;case yr.Oak:n>=i||n<=r?a=c?JRe:hpe:n>r&&n<=l?a=c?GRe:XRe:n>l&&n<=s?a=c?hpe:JRe:a=c?XRe:GRe;break;case yr.Spruce:a=wnt;break;default:a=Ant}return a}}const Fc=t=>H(e=>e.selectedElementIdSet.has(t)&&!e.groupActionMode),Kt=()=>{const t=H(Au);return g.useMemo(()=>({lng:t}),[t])},_1=t=>H.getState().getWeather(t??"Boston MA, USA"),lan=()=>{const t=H(Qn),e=H(RS),n=Kt(),{t:o}=Jl(),r=s=>[{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"x : "}),h.jsx(mn,{value:s.cx,precision:2})]}),key:s.id+" x"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"y : "}),h.jsx(mn,{value:s.cy,precision:2})]}),key:s.id+" y"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"z : "}),h.jsx(mn,{value:s.cz,precision:2})]}),key:s.id+" z"}],i=s=>[{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"Lx : "}),h.jsx(mn,{value:s.lx,precision:2})]}),key:s.id+" lx"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"Ly : "}),h.jsx(mn,{value:s.ly,precision:2})]}),key:s.id+" ly"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"Lz : "}),h.jsx(mn,{value:s.lz,precision:2})]}),key:s.id+" lz"}],a=(s,c)=>h.jsx(k3,{placement:"right",title:"ID: "+s,color:"white",styles:{body:{color:"gray",fontSize:"12px"}},children:h.jsx("span",{children:c})}),l=s=>{switch(s.type){case z.Human:return o("modelTree.Human",n);case z.Flower:return o("modelTree.Flower",n);case z.Tree:return o("modelTree.Tree",n);case z.Foundation:return o("modelTree.Foundation",n);case z.Wall:return o("modelTree.Wall",n);case z.Roof:return o("modelTree.Roof",n);case z.Window:return o("modelTree.Window",n);case z.Door:return o("modelTree.Door",n);case z.SolarWaterHeater:return o("modelTree.SolarWaterHeater",n);case z.Sensor:return o("modelTree.Sensor",n);case z.Light:return o("modelTree.Light",n);case z.SolarPanel:return o("modelTree.GroundMountedSolarPanels",n)}return"Unknown"};return g.useMemo(()=>{const s=[];for(const c of t)if(c.type===z.Foundation){const u=e(c.id),d=[];for(const p of u){const m=[];if(m.push(...r(p)),p.type===z.Tree){const y=p,w=y.name;m.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",w," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:Sv.fetchTextureImage(w,180,42,90,300)})]}),key:p.id+" Type"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("treeMenu.Spread",n)," : "]}),h.jsx(mn,{value:y.lx,precision:2})]}),key:p.id+" Spread"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Height",n)," : "]}),h.jsx(mn,{value:y.lz,precision:2})]}),key:p.id+" Height"})}else if(p.type===z.Flower){const y=p.name;m.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",y," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:i3.fetchTextureImage(y,!1)})]}),key:p.id+" Type"})}else if(p.type===z.Human){const y=p.name;m.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Name",n)," : ",y," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:hh.fetchTextureImage(y)})]}),key:p.id+" Name"})}else if(p.type===z.SolarPanel)m.push(...i(p)),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("pvModelPanel.Model",n)," : "]}),h.jsx("span",{children:p.pvModelName})]}),key:p.id+" Model"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("solarPanelMenu.Orientation",n)," : "]}),h.jsx("span",{children:p.orientation})]}),key:p.id+" Orientation"});else if(p.type===z.Wall){m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.RValue",n)," : "]}),h.jsx(mn,{value:p.rValue??U9,precision:2})]}),key:p.id+" R-value"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.VolumetricHeatCapacity",n)," : "]}),h.jsx(mn,{value:p.volumetricHeatCapacity??.5,precision:2})]}),key:p.id+" Heat Capacity"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Thickness",n)," : "]}),h.jsx(mn,{value:p.ly,precision:2})]}),key:p.id+" Thickness"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Height",n)," : "]}),h.jsx(mn,{value:p.lz,precision:2})]}),key:p.id+" Height"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("wallMenu.EavesLength",n)," : "]}),h.jsx(mn,{value:p.eavesLength,precision:2})]}),key:p.id+" Overhang"});const y=e(p.id);for(const w of y)switch(w.type){case z.Window:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.UValue",n)," : "]}),h.jsx(mn,{value:w.uValue??X9,precision:2})]}),key:w.id+" U-value"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"SHGC : "}),h.jsx(mn,{value:1-w.opacity,precision:2})]}),key:w.id+" shgc"}),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.Door:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.UValue",n)," : "]}),h.jsx(mn,{value:w.uValue??fA,precision:2})]}),key:w.id+" U-value"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.VolumetricHeatCapacity",n)," : "]}),h.jsx(mn,{value:w.volumetricHeatCapacity??.5,precision:2})]}),key:w.id+" Heat Capacity"}),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.SolarPanel:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("pvModelPanel.Model",n)," : "]}),h.jsx("span",{children:w.pvModelName})]}),key:w.id+" Model"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("solarPanelMenu.Orientation",n)," : "]}),h.jsx("span",{children:w.orientation})]}),key:w.id+" Orientation"}),m.push({checkable:!0,title:a(w.id,o("modelTree.WallMountedSolarPanels",n)+(w.label?" ("+w.label+")":"")),key:w.id,children:x});break}case z.Sensor:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.Light:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}}}else if(p.type===z.Roof){m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.RValue",n)," : "]}),h.jsx(mn,{value:p.rValue??pA,precision:2})]}),key:p.id+" R-value"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.VolumetricHeatCapacity",n)," : "]}),h.jsx(mn,{value:p.volumetricHeatCapacity??.5,precision:2})]}),key:p.id+" Heat Capacity"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Thickness",n)," : "]}),h.jsx(mn,{value:p.thickness,precision:2})]}),key:p.id+" Thickness"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("roofMenu.Rise",n)," : "]}),h.jsx(mn,{value:p.rise,precision:2})]}),key:p.id+" Rise"});const y=e(p.id);for(const w of y)switch(w.type){case z.Window:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.UValue",n)," : "]}),h.jsx(mn,{value:w.uValue??X9,precision:2})]}),key:w.id+" U-value"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"SHGC : "}),h.jsx(mn,{value:1-w.opacity,precision:2})]}),key:w.id+" shgc"}),m.push({checkable:!0,title:a(w.id,o("modelTree.SkylightWindow",n)),key:w.id,children:x});break}case z.SolarPanel:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("pvModelPanel.Model",n)," : "]}),h.jsx("span",{children:w.pvModelName})]}),key:w.id+" Model"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("solarPanelMenu.Orientation",n)," : "]}),h.jsx("span",{children:w.orientation})]}),key:w.id+" Orientation"}),m.push({checkable:!0,title:a(w.id,o("modelTree.RooftopSolarPanels",n)+(w.label?" ("+w.label+")":"")),key:w.id,children:x});break}case z.SolarWaterHeater:{const x=[];x.push(...r(w)),x.push(...i(w)),m.push({checkable:!0,title:a(w.id,l(w)+(w.label?" ("+w.label+")":"")),key:w.id,children:x});break}case z.Sensor:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.Light:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}}}d.push({title:a(p.id,l(p)+(p.label?" ("+p.label+")":"")),key:p.id,children:m})}const f=c;d.push(...r(f)),d.push(...i(f)),s.push({title:a(f.id,(f.notBuilding?l(f):o("word.Building",n))+(f.label?" ("+f.label+")":"")),key:f.id,children:d})}else if(c.parentId===rr){const u=[];switch(c.type){case z.Tree:{const d=c,f=d.name;u.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",f," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:Sv.fetchTextureImage(f,180,42,90,300)})]}),key:c.id+" Type"}),u.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("treeMenu.Spread",n)," : "]}),h.jsx(mn,{value:d.lx,precision:2})]}),key:c.id+" Spread"}),u.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Height",n)," : "]}),h.jsx(mn,{value:d.lz,precision:2})]}),key:c.id+" Height"});break}case z.Flower:{const d=c.name;u.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",d," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:i3.fetchTextureImage(d,!1)})]}),key:c.id+" Type"});break}case z.Human:{const d=c.name;u.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Name",n)," : ",d," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:hh.fetchTextureImage(d)})]}),key:c.id+" Name"});break}}u.push(...r(c)),s.push({title:a(c.id,l(c)+(c.label?" ("+c.label+")":"")),key:c.id,children:u})}return s},[t,n])},KRe=new ue,$Re=new cn,a_=new ue,san=new ue(0,0,1),can=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e);for(let l=0;l{const[c,u,d]=l.points,f=Math.abs(c.z)<.015,p=[c.clone().sub(i),c];return f||p.push(d),h.jsx(On,{points:p,lineWidth:n,color:o},s)})]})]})}),uan=({roofModel:t,foundationModel:e})=>{let{cx:n,cy:o,lz:r,id:i,wallsId:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineWidth:f=.2,lineColor:p="black",roofType:m,foundationId:y,rise:w=r,ceiling:x=!1}=t;const C=hI(l),P=Fc(i);[p,f]=Rn.getWireframeStyle(p,f,P,d);const A=H(pn),S=H(Jp),{camera:v,gl:b}=ti(),T=g.useMemo(()=>new yu,[]),R=g.useMemo(()=>new _t,[]),[M,D]=g.useState(!1),k=g.useRef(null),N=g.useRef(!1),U=g.useRef(w),W=new Set(a),F=Ce=>{R.x=Ce.offsetX/b.domElement.clientWidth*2-1,R.y=-(Ce.offsetY/b.domElement.clientHeight)*2+1,T.setFromCamera(R,v)},E=Ce=>{const Te=[],Re=Ce.length;for(const Ne of Ce)Ne.leftPoint[0]!==void 0&&Ne.leftPoint[1]!==void 0&&Te.push({x:Ne.leftPoint[0],y:Ne.leftPoint[1]});return O.current||(Ce[Re-1].rightPoint[0]||Ce[Re-1].rightPoint[0]===0)&&(Ce[Re-1].rightPoint[1]||Ce[Re-1].rightPoint[1]===0)&&Te.push({x:Ce[Re-1].rightPoint[0],y:Ce[Re-1].rightPoint[1]}),Te},L=(Ce,Te)=>{if(Ce.length!==Te.size)return!0;for(const Re of Ce)if(!Te.has(Re.id))return!0;return!1},j=()=>{let Ce=1/0;for(let Te=0;Te{if(Y.length<2)return{x:0,y:0};const Ce=E(Y);if(Ce.length<3)return{x:0,y:0};const Te=ye.calculatePolygonCentroid(Ce);return Number.isNaN(Te.x)||Number.isNaN(Te.y)?{x:0,y:0}:Te},[Y,G]),oe=g.useMemo(()=>new ue(Q.x,Q.y,G),[Q,G]),ee=g.useMemo(()=>{const Ce=Y.map(Te=>Rn.getWallNormal(Te).multiplyScalar(Te.eavesLength??0));if(!O.current&&Ce.length!==0){const Te=new ue().subVectors(new ue(Y[Y.length-1].rightPoint[0],Y[Y.length-1].rightPoint[1]),new ue(Y[0].leftPoint[0],Y[0].leftPoint[1])).applyEuler(kX).normalize().multiplyScalar(.3);Ce.push(Te)}return Ce},[Y]),q=g.useMemo(()=>{const Ce=Y.map((Te,Re)=>({leftPoint:new ue(Te.leftPoint[0],Te.leftPoint[1]).add(ee[Re]),rightPoint:new ue(Te.rightPoint[0],Te.rightPoint[1]).add(ee[Re])}));return!O.current&&Ce.length!==0&&Ce.push({leftPoint:new ue(Y[Y.length-1].rightPoint[0],Y[Y.length-1].rightPoint[1]).add(ee[ee.length-1]),rightPoint:new ue(Y[0].leftPoint[0],Y[0].leftPoint[1]).add(ee[ee.length-1])}),Ce},[Y,ee]),ae=g.useMemo(()=>san.clone().multiplyScalar(u),[u]),Z=g.useMemo(()=>{const Ce=[];if(Y.length<2)return Ce;const Te=j();for(let Re=0;Re0&&Ne.rightPoint.length>0&&(Ne.leftPoint[0]!==Ne.rightPoint[0]||Ne.leftPoint[1]!==Ne.rightPoint[1])){const _e=[];let{lh:Ue,rh:qe}=Rn.getWallHeight(Y,Re);O.current||(Re===0&&(Ue=Y[0].lz),Re===Y.length-1&&(qe=Y[Y.length-1].lz));const Fe=Rn.getIntersectionPoint(q[(Re+q.length-1)%q.length].leftPoint,q[(Re+q.length-1)%q.length].rightPoint,q[Re].leftPoint,q[Re].rightPoint).setZ(Ue-Te).sub(oe),He=Rn.getIntersectionPoint(q[Re].leftPoint,q[Re].rightPoint,q[(Re+1)%q.length].leftPoint,q[(Re+1)%q.length].rightPoint).setZ(qe-Te).sub(oe),Le=new ue(Ne.cx,Ne.cy).sub(oe.clone().setZ(0)).length();_e.push(Fe,He,a_),_e.push(Fe.clone().add(ae),He.clone().add(ae),a_.clone().add(ae)),Ce.push({points:_e,angle:-Ne.relativeAngle,length:Le})}}if(!O.current){const Re=q.length-1,Ne=Rn.getIntersectionPoint(q[Re-1].leftPoint,q[Re-1].rightPoint,q[Re].leftPoint,q[Re].rightPoint).setZ(Y[Y.length-1].lz-Te).sub(oe),_e=Rn.getIntersectionPoint(q[Re].leftPoint,q[Re].rightPoint,q[0].leftPoint,q[0].rightPoint).setZ(Y[0].lz-Te).sub(oe);let Ue=Math.atan2(_e.y-Ne.y,_e.x-Ne.x);Ue=Ue>=0?Ue:(fa+Ue)%fa;const qe=new ue().addVectors(Ne,_e).setZ(0).divideScalar(2).length(),Fe=[];Fe.push(Ne,_e,a_),Fe.push(Ne.clone().add(ae),_e.clone().add(ae),a_.clone().add(ae)),Ce.push({points:Fe,angle:-Ue,length:qe})}return Ce},[Y,Q,u]),ne=g.useMemo(()=>{const Ce=[];if(Y.length===0)return Ce;Ce.push(new ue().fromArray(Y[0].leftPoint));for(const Te of Y)Ce.push(new ue().fromArray(Te.rightPoint));return Ce},[Y]);let te=0;if(e){n=e.cx,o=e.cy,te=e.rotation[2];const Ce=-Math.atan2(v.position.x-n,v.position.y-o)-te;KRe.set(Q.x,Q.y,G),$Re.set(-$t,0,Ce,"ZXY")}const $=tte();g.useEffect(()=>{if($)return;if(H.getState().addedRoofIdSet.has(i)&&Y.length>=2&&L(Y,W)){const Te=Y.map(Ne=>Ne.id),Re=new Set(Te);A(Ne=>{for(const _e of Ne.elements)if(_e.type===z.Roof)_e.id===i&&(_e.wallsId=Te);else if(_e.type===z.Wall&&W.has(_e.id)&&!Re.has(_e.id)){const Ue=_e;Ue.roofId=null,Ue.leftRoofHeight=void 0,Ue.rightRoofHeight=void 0}}),H.getState().deleteAddedRoofId(i)}},[W]),g.useEffect(()=>{if(Y.length>1){if(H.getState().addedRoofIdSet.has(i)){for(let Te=0;Te{for(const Ne of Re.elements)if(Ne.id===Y[Te].id&&Ne.type===z.Wall){const _e=Ne;_e.roofId=i,_e.leftRoofHeight=void 0,_e.rightRoofHeight=void 0;break}});H.getState().deleteAddedRoofId(i)}}else S(i,!1,!1,!0)},[Y]),N3e(e,i,Z,oe,G,u);const le=()=>{if(Y.length<2)return!1;const Ce=Y[0].lz;for(const Te of Y)if(Math.abs(Te.lz-Ce)>.01)return!1;for(const Te of Z){const[Re,Ne]=Te.points;if(Math.abs(Re.z)>.01||Math.abs(Ne.z)>.01)return!1}return!0},[de,he]=g.useState(le);g.useEffect(()=>{he(le())},[Y,G]);const me=dt(vs),ce=H(Df),Pe=In(O1),[pe,Ie]=g.useState([]),[ve,ze]=g.useState(null),Ae=H(z0),se=zU(i,oe,Z,de,Zo.Pyramid);g.useEffect(()=>{if(me)if(de){const Ce=Pe(i);if(Ce){const Te=ye.fetchHeatmapTexture(Ce,ce??5);if(Te){const Re=se();if(Re&&Re.length>0&&e){const Ne=new cn(0,0,e.rotation[2],"ZYX");let _e=Number.MAX_VALUE,Ue=Number.MAX_VALUE,qe=-Number.MAX_VALUE,Fe=-Number.MAX_VALUE;for(const ut of Re)for(const ht of ut){const Qe=ht.clone().applyEuler(Ne);Qe.x>qe&&(qe=Qe.x),Qe.x<_e&&(_e=Qe.x),Qe.y>Fe&&(Fe=Qe.y),Qe.y0){const Te=[];if(se()){for(let Ne=0;Ne{const Ce=[];for(let Te=0;Te0&&Re.rightPoint.length>0&&(Re.leftPoint[0]!==Re.rightPoint[0]||Re.leftPoint[1]!==Re.rightPoint[1])){let{lh:Ne,rh:_e}=Rn.getWallHeight(Y,Te);O.current||(Te===0&&(Ne=Y[0].lz),Te===Y.length-1&&(_e=Y[Y.length-1].lz));const Ue=new ue(Re.leftPoint[0],Re.leftPoint[1],Ne),qe=new ue(Re.rightPoint[0],Re.rightPoint[1],_e);Ce.push([Ue,qe,oe.clone()])}}if(!O.current){const Te=Y[0],Re=Y[Y.length-1],Ne=new ue(Re.rightPoint[0],Re.rightPoint[1],Re.lz),_e=new ue(Te.leftPoint[0],Te.leftPoint[1],Te.lz);Ce.push([Ne,_e,oe.clone()])}if(de){const Te=[];for(const Re of Ce)Te.push(Re[0].clone());In.getState().setRoofSegmentVerticesWithoutOverhang(i,[Te])}else In.getState().setRoofSegmentVerticesWithoutOverhang(i,Ce)});const we=H(Ce=>Ce.elements.filter(Te=>Te.parentId===i&&Te.type===z.Window),Qy),Se=kU(i,e,oe,Z),Me=l===Yr.Default||l===Yr.NoTexture?s:"white";return h.jsxs("group",{name:`Pyramid Roof Group ${i}`,children:[h.jsx("group",{name:`Pyramid Roof Segments Group ${i}`,userData:Se,position:[Q.x,Q.y,G],onPointerDown:Ce=>{HU(Ce,e.id,i,Z,oe)},onPointerMove:Ce=>{IU(Ce,i)},onPointerUp:Ce=>{MU(Ce,t)},onContextMenu:Ce=>{HH(Ce,i)},children:de?h.jsx(nte,{id:i,foundationModel:e,roofType:m,roofSegments:Z,center:oe,thickness:u,lineWidth:f,lineColor:p,sideColor:c,color:Me,textureType:l,heatmap:ve}):h.jsxs(h.Fragment,{children:[Z.map((Ce,Te)=>{const{points:Re}=Ce;if(Re.length>0){const[Ne,_e]=Re;if(Ne.distanceTo(_e)>.1)return h.jsx("group",{name:`Roof segment ${Te}`,children:h.jsx(IQ,{id:i,index:Te,foundationModel:e,roofType:m,segment:Ce,centroid:oe,thickness:u,color:Me,sideColor:c,texture:C,heatmap:pe&&Te0&&h.jsx(tU,{points:ne,cz:Y[0].lz}),P&&!d&&h.jsx(mh,{position:[Q.x,Q.y,G+u+.15],onPointerDown:Ce=>{Ae(t.id,Ce,er.Select),D(!0),jn.getState().setEnableOrbitController(!1),N.current=!0,U.current=w,A(Te=>{Te.resizeHandleType=xt.Top,Te.selectedElementHeight=G+t.thickness})},onPointerUp:()=>{D(!1),jn.getState().setEnableOrbitController(!0)},onPointerOver:()=>{A(Ce=>{Ce.hoveredHandle=Ur.Top,Ce.selectedElementHeight=G+t.thickness,Ce.selectedElementX=Q.x,Ce.selectedElementY=Q.y})}}),M&&h.jsx(yi,{name:"Roof Intersection Plane",ref:k,args:[1e3,100],visible:!1,rotation:$Re,position:KRe,onPointerMove:Ce=>{if(k.current&&N.current&&e){F(Ce);const Te=T.intersectObjects([k.current]);if(Te[0]){const Re=Te[0].point;if(Re.z<.001)return;const Ne=Math.max(0,Re.z-e.lz-.3-_);H.getState().updateRoofRiseById(i,Ne,G+t.thickness)}}},onPointerUp:Ce=>{RU(i,U.current,w),D(!1),jn.getState().setEnableOrbitController(!0),N.current=!1}})]})},dan=xe.memo(uan,fI),fan=(t,e,n)=>{const{left:o,right:r,center:i,centerLeft:a,centerRight:l}=n,[s,c]=[t/2,e/2],u=[{x:-s,y:o-c},{x:-s,y:-c},{x:s,y:-c},{x:s,y:r-c}];if(l){const[d,f]=l;u.push({x:d*t,y:f-c})}if(i){const[d,f]=i;u.push({x:d*t,y:f-c})}if(a){const[d,f]=a;u.push({x:d*t,y:f-c})}return u},O9=(t,e)=>{for(const n of H.getState().elements)if(n.type===z.Wall&&n.foundationId===e&&t.has(n.id)){const o=t.get(n.id);if(o){const r=n,i=fan(r.lx,r.lz,o);for(const a of H.getState().elements)if(a.parentId===r.id){let{cx:l,cz:s,lx:c,ly:u,lz:d}=a;if(l*=r.lx,s*=r.lz,a.type!==z.SolarPanel?(c*=r.lx,d*=r.lz):d=u,a.type===z.Window&&a.windowType===Ti.Polygonal){const[f,p]=a.polygonTop??P1,m=l+f*c,y=s+d/2+p;if(!ye.isPointInside(m,y,i))return!1}if(!ye.isElementInsideWall(new ue(l,0,s),c,d,i,a.type===z.Door))return!1}}}return!0},han=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e),a=t[0].points,l=t[1].points,s=t[2].points,c=t[3].points;r.push(l[3],l[0],a[0],a[1],a[2],l[2],s[0],c[0],c[1],s[1],l[3]);const u=Math.abs(a[0].z)<.15,d=h.jsx(On,{points:r,lineWidth:n,color:o}),f=h.jsxs(h.Fragment,{children:[h.jsx(On,{points:[l[0],l[1]],lineWidth:n,color:o}),h.jsx(On,{points:[l[2],l[3]],lineWidth:n,color:o}),h.jsx(On,{points:[s[2],s[3]],lineWidth:n,color:o})]});return h.jsxs(h.Fragment,{children:[d,!u&&f,h.jsxs("group",{position:[0,0,e],children:[d,!u&&f]}),h.jsx(On,{points:[a[0],a[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[a[1],a[1].clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[c[0],c[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[c[1],c[1].clone().add(i)],lineWidth:n,color:o})]})}),vse=new ue,bse=new cn,qRe=new _t,pan=new ue(0,0,1),gan=({roofModel:t,foundationModel:e})=>{let{id:n,cx:o,cy:r,lz:i,wallsId:a,parentId:l,topRidgeLeftPoint:s,frontRidgeLeftPoint:c,backRidgeLeftPoint:u,topRidgePoint:d,frontRidgePoint:f,backRidgePoint:p,textureType:m,color:y="white",sideColor:w="white",thickness:x=.2,locked:C,lineColor:P="black",lineWidth:A=.2,roofType:S,rise:v=i,ceiling:b=!1}=t;d===void 0&&(d=s?[...s]:[0,1]),f===void 0&&(f=c?[...c]:[.35,.5]),p===void 0&&(p=u?[...u]:[.35,.5]);const T=Fc(n);[P,A]=Rn.getWireframeStyle(P,A,T,C);const R=H(pn),M=H(Jp),D=hI(m),[k,N]=g.useState(Ur.Null),[U,W]=g.useState(!1),F=g.useRef(null),{gl:E,camera:L}=ti(),j=g.useMemo(()=>new yu,[]),Y=g.useMemo(()=>new _t,[]),O=g.useRef([0,0]),_=g.useRef(v),G=g.useRef(!1),Q=v<.01,oe=(Ve,je,et)=>{R(bt=>{for(const St of bt.elements)if(St.id===Ve&&St.type===z.Roof&&St.roofType===Zo.Gambrel){const Pt=St;switch(je){case Ur.FrontLeft:case Ur.FrontRight:Pt.frontRidgePoint=[...et];break;case Ur.TopLeft:case Ur.TopRight:Pt.topRidgePoint=[...et];break;case Ur.BackLeft:case Ur.BackRight:Pt.backRidgePoint=[...et];break}break}})},ee=(Ve,je,et,bt)=>{const St={name:"Resize Gambrel Roof Ridge",timestamp:Date.now(),resizedElementId:Ve,resizedElementType:z.Roof,oldVal:[...et],newVal:[...bt],type:je,undo:()=>{oe(St.resizedElementId,St.type,St.oldVal)},redo:()=>{oe(St.resizedElementId,St.type,St.newVal)}};H.getState().addUndoable(St)},q=Ve=>{Y.x=Ve.offsetX/E.domElement.clientWidth*2-1,Y.y=-(Ve.offsetY/E.domElement.clientHeight)*2+1,j.setFromCamera(Y,L)},ae=(Ve,je)=>{W(!0),jn.getState().setEnableOrbitController(!1),vse.set(Ve.x,Ve.y,Ve.z).add(Ae),e&&je&&bse.set($t,0,je.relativeAngle,"ZXY")},Z=(Ve,je,et)=>{const bt=new _t(Ve.cx,Ve.cy),St=Rn.getComposedWallCenter(je),Pt=Rn.getComposedWallLength(je),Yt=new _t(St.x,St.y).rotateAround(qRe,Ve.rotation[2]).add(bt),zt=Ve.rotation[2]+je.relativeAngle,Ct=new _t(et.x,et.y).sub(Yt).rotateAround(qRe,-zt).x/Pt;return Math.min(Math.abs(Ct),.5)*(Ct>=0?1:-1)},ne=(Ve,je,et,bt)=>{if(!Ve)return new ue;const St=Rn.getComposedWallLength(Ve),Pt=new cn(0,0,Ve.relativeAngle),Yt=new ue(je*St,0,0);let zt=ze;bt&&(zt=et*(ze-bt.lz)+bt.lz);const Rt=Rn.getComposedWallCenter(Ve);return new ue(Rt.x,Rt.y,zt).add(Yt.applyEuler(Pt))},te=(Ve,je)=>{const et=Ve[je];let bt,St;return je===0||je===2?(bt=et.lz,St=et.lz):je===1?(bt=Ve[0].lz,St=Ve[2].lz):(bt=Ve[2].lz,St=Ve[0].lz),{lh:bt,rh:St}},$=Ve=>Ve.id===n&&Ve.type===z.Roof&&Ve.roofType===Zo.Gambrel,le=(Ve,je)=>{const et=je.x-Ve.x,St=(je.y-Ve.y)/et,Pt=Ve.y-St*Ve.x;return{start:Ve.x,end:je.x,k:St,b:Pt}},de=(Ve,je,et,bt,St,Pt,Yt,zt)=>{const Rt=Ve[je],{lh:Ct,rh:yt}=te(Ve,je),at=new ue().subVectors(Rt.leftPoint,Rt.rightPoint).length(),Et=at/2,Lt=ot=>ot*at+Et,Je=(ot,it)=>ot*(et-it)+it,st=[new _t(Lt(-Pt[0]),Je(Pt[1],bt)),new _t(Lt(Yt[0]),et),new _t(Lt(zt[0]),Je(zt[1],St)),new _t(at,yt)];return st.map((ot,it)=>{const Be=it===0?new _t(0,Ct):st[it-1];return le(Be,ot)})},he=(Ve,je)=>{for(const et of Ve){const{start:bt,end:St,k:Pt,b:Yt}=et;if(je>=bt&&je<=St)return Pt*je+Yt}return null},me=Ve=>{const je=new Set;for(const et of Ve)et.wallsId.forEach(bt=>je.add(bt));R(et=>{for(const bt of et.elements)if(bt.type===z.Wall&&bt.foundationId===l&&je.has(bt.id)){const St=bt;St.leftRoofHeight=ze,St.rightRoofHeight=ze,St.centerLeftRoofHeight=void 0,St.centerRightRoofHeight=void 0,St.centerRoofHeight=void 0}})},ce=(Ve,je,et,bt,St,Pt,Yt)=>{if(et!==1&&et!==3)return;const zt=et===3,{lh:Rt,rh:Ct}=te(je,et),yt=zt?Yt:St,at=zt?St:Yt,Et=zt?Pt:[-Pt[0],Pt[1]],Lt=de(je,et,bt,Rt,Ct,yt,Et,at),Je=Lt.slice(1).map(ot=>ot.start),st=je[et],It=st.wallsId.reduce((ot,it)=>{const Be=H.getState().elements.find(pt=>pt.id===it);return Be?[...ot,Be.lx+ot[ot.length-1]]:ot},[0]);for(let ot=0;ot=Be&&Ot<=pt){const on=(Ot-wt)/ft,qt=he(Lt,Ot);qt!==null&&(Zt===0?kt.centerLeft=[on,qt]:Zt===1?kt.center=[on,qt]:Zt===2&&(kt.centerRight=[on,qt]))}}Ve.set(it,kt)}}return Ve},Pe=(Ve,je,et,bt,St)=>{const Pt=new Map;return ce(Pt,Ve,1,je,et,bt,St),ce(Pt,Ve,3,je,et,bt,St),Pt},pe=(Ve,je,et,bt,St)=>{const Pt=new Set(Ve[0].wallsId),Yt=new Set(Ve[2].wallsId),zt=Pe(Ve,je,et,bt,St);R(Rt=>{for(const Ct of Rt.elements)if(Ct.type===z.Wall&&Ct.foundationId===l){if(Pt.has(Ct.id)){const yt=Ct,{lh:at,rh:Et}=te(Ve,0);yt.roofId=n,yt.leftRoofHeight=at,yt.rightRoofHeight=Et}else if(Yt.has(Ct.id)){const yt=Ct,{lh:at,rh:Et}=te(Ve,2);yt.roofId=n,yt.leftRoofHeight=at,yt.rightRoofHeight=Et}else if(zt.has(Ct.id)){const yt=zt.get(Ct.id);if(yt){const at=Ct,{left:Et,right:Lt,center:Je,centerLeft:st,centerRight:It}=yt;if(at.roofId=n,at.leftRoofHeight=Et,at.rightRoofHeight=Lt,st){const[ot,it]=st;at.centerLeftRoofHeight?(at.centerLeftRoofHeight[0]=ot,at.centerLeftRoofHeight[1]=it):at.centerLeftRoofHeight=[ot,it]}else at.centerLeftRoofHeight=void 0;if(Je){const[ot,it]=Je;at.centerRoofHeight?(at.centerRoofHeight[0]=ot,at.centerRoofHeight[1]=it):at.centerRoofHeight=[ot,it]}else at.centerRoofHeight=void 0;if(It){const[ot,it]=It;at.centerRightRoofHeight?(at.centerRightRoofHeight[0]=ot,at.centerRightRoofHeight[1]=it):at.centerRightRoofHeight=[ot,it]}else at.centerRightRoofHeight=void 0}}}})},Ie=F3e(a[0],l),{highestWallHeight:ve,topZ:ze}=L3e(Ie,v,!0);EU(t,ve);const Ae=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie.map(et=>({x:et.leftPoint.x,y:et.leftPoint.y})),je=ye.calculatePolygonCentroid(Ve);return new ue(je.x,je.y,ze)},[Ie,ze]),se=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[3],[je,et]=d;return ne(Ve,je,et).sub(Ae)},[Ie,Ae,d]),ge=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[1],[je,et]=d;return ne(Ve,-je,et).sub(Ae)},[Ie,Ae,d]),we=g.useMemo(()=>new ue().addVectors(se,ge).divideScalar(2),[se,ge]),Se=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[3],[je,et]=f;return ne(Ve,je,et,Ie[0]).sub(Ae)},[Ie,Ae,f]),Me=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[1],[je,et]=f;return ne(Ve,-je,et,Ie[0]).sub(Ae)},[Ie,Ae,f]),Ce=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[1],[je,et]=p;return ne(Ve,je,et,Ie[2]).sub(Ae)},[Ie,Ae,p]),Te=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[3],[je,et]=p;return ne(Ve,-je,et,Ie[2]).sub(Ae)},[Ie,Ae,p]),Re=g.useMemo(()=>!Ie||Ie.length!==4?[]:Ie.map(Ve=>Rn.getComposedWallNormal(Ve).multiplyScalar(Ve.eavesLength)),[Ie]),Ne=g.useMemo(()=>pan.clone().multiplyScalar(x),[x]),_e=g.useMemo(()=>{const Ve=[];if(!Ie||Ie.length!==4)return Ve;const[je,et,bt,St]=Ie,[Pt,Yt,zt,Rt]=Re,Ct=je.leftPoint,yt=je.rightPoint,at=bt.leftPoint,Et=bt.rightPoint,Lt=Ct.clone().add(Pt),Je=yt.clone().add(Pt),st=Et.clone().add(Rt),It=Ct.clone().add(Rt),ot=yt.clone().add(Yt),it=at.clone().add(Yt),Be=at.clone().add(zt),pt=Et.clone().add(zt),ct=[],{lh:Xe,rh:ft}=te(Ie,0),wt=Rn.getDistance(Ct,yt,Se.clone().add(Ae)),kt=Math.min((je.eavesLength??0)/wt*(Se.clone().add(Ae).z-Xe),Xe),Zt=Rn.getDistance(Ct,yt,Me.clone().add(Ae)),Ot=Math.min((je.eavesLength??0)/Zt*(Me.clone().add(Ae).z-ft),ft),on=Rn.getIntersectionPoint(st,It,Lt,Je).setZ(Xe-kt).sub(Ae),qt=Rn.getIntersectionPoint(Lt,Je,ot,it).setZ(ft-Ot).sub(Ae),rn=Rn.getIntersectionPoint(Se,Me,st.clone().sub(Ae),It.clone().sub(Ae)).setZ(Se.z),Pn=Rn.getIntersectionPoint(Me,Se,ot.clone().sub(Ae),it.clone().sub(Ae)).setZ(Me.z);ct.push(on,qt,Pn,rn),ct.push(on.clone().add(Ne),qt.clone().add(Ne),Pn.clone().add(Ne),rn.clone().add(Ne));const fo=Rn.getComposedWallCenter(je),to=-je.relativeAngle,Dt=new ue(fo.x,fo.y).sub(we.clone().setZ(0)).length();Ve.push({points:ct,angle:to,length:Dt});const fn=[],kn=Rn.getIntersectionPoint(se,ge,st.clone().sub(Ae),It.clone().sub(Ae)).setZ(se.z),yo=Rn.getIntersectionPoint(se,ge,ot.clone().sub(Ae),it.clone().sub(Ae)).setZ(ge.z);fn.push(rn,Pn,yo,kn),fn.push(rn.clone().add(Ne),Pn.clone().add(Ne),yo.clone().add(Ne),kn.clone().add(Ne)),Ve.push({points:fn,angle:to,length:Dt});const ur=-bt.relativeAngle,{lh:lr,rh:xo}=te(Ie,2),wo=Rn.getDistance(at,Et,Ce.clone().add(Ae)),Rr=Math.min((bt.eavesLength??0)/wo*(Ce.clone().add(Ae).z-lr),lr),Eo=Rn.getDistance(at,Et,Te.clone().add(Ae)),An=Math.min((bt.eavesLength??0)/Eo*(Te.clone().add(Ae).z-xo),xo),Dn=Rn.getIntersectionPoint(ot,it,Be,pt).setZ(lr-Rr).sub(Ae),sr=Rn.getIntersectionPoint(Be,pt,st,It).setZ(xo-An).sub(Ae),Vo=Rn.getIntersectionPoint(Ce,Te,ot.clone().sub(Ae),it.clone().sub(Ae)).setZ(Te.z),Wo=Rn.getIntersectionPoint(Te,Ce,st.clone().sub(Ae),It.clone().sub(Ae)).setZ(Te.z),To=Rn.getComposedWallCenter(bt),Go=new ue(To.x,To.y).sub(we.clone().setZ(0)).length(),No=[];No.push(Vo,Wo,kn,yo),No.push(Vo.clone().add(Ne),Wo.clone().add(Ne),kn.clone().add(Ne),yo.clone().add(Ne)),Ve.push({points:No,angle:ur,length:Go});const ho=[];return ho.push(Dn,sr,Wo,Vo),ho.push(Dn.clone().add(Ne),sr.clone().add(Ne),Wo.clone().add(Ne),Vo.clone().add(Ne)),Ve.push({points:ho,angle:ur,length:Go}),Ve},[Ie,ze,x,d,f,p]),Ue=g.useMemo(()=>!Ie||Ie.length!==4?null:Ie.map(Ve=>Ve.leftPoint),[Ie]);g.useEffect(()=>{(!Ie||Ie.length!==4)&&M(n,!1,!1,!0)},[Ie]);const qe=tte();g.useEffect(()=>{if((Ie==null?void 0:Ie.length)!==4)return;(H.getState().addedRoofIdSet.has(n)||!qe)&&(Q?me(Ie):pe(Ie,ze,f,d,p),ete(e,n,_e,Ae,ze,x,Q),H.getState().deleteAddedRoofId(n))},[_e]),W3e(e,n,_e,Ae,ze,x,Q);const Fe=()=>{const Ve=[];if(!Ie||Ie.length!==4)return Ve;const je=Ie.map((Rt,Ct,yt)=>new ue(Rt.leftPoint.x,Rt.leftPoint.y,te(yt,Ct).lh)),et=Se.clone().add(Ae),bt=Me.clone().add(Ae),St=Ce.clone().add(Ae),Pt=Te.clone().add(Ae),Yt=se.clone().add(Ae),zt=ge.clone().add(Ae);Ve.push([je[0],je[1],bt,et]),Ve.push([et,bt,zt,Yt]),Ve.push([Yt,zt,St,Pt]),Ve.push([je[2],je[3],Pt,St]),Q?In.getState().setRoofSegmentVerticesWithoutOverhang(n,[je]):In.getState().setRoofSegmentVerticesWithoutOverhang(n,Ve)},He=zU(n,Ae,_e,Q,Zo.Gambrel);DU(Fe);const Le=H(Ve=>Ve.elements.filter(je=>je.parentId===n&&je.type===z.Window),Qy),Ye=H(z0),lt=dt(vs),Oe=H(Df),ut=In(O1),[ht,Qe]=g.useState(null),[nt,mt]=g.useState([]);g.useEffect(()=>{if(lt)if(Q){const Ve=ut(n);if(Ve){const je=ye.fetchHeatmapTexture(Ve,Oe??5);if(je){const et=He();if(et&&et.length>0&&e){const bt=new cn(0,0,e.rotation[2],"ZYX");let St=Number.MAX_VALUE,Pt=Number.MAX_VALUE,Yt=-Number.MAX_VALUE,zt=-Number.MAX_VALUE;for(const Lt of et)for(const Je of Lt){const st=Je.clone().applyEuler(bt);st.x>Yt&&(Yt=st.x),st.xzt&&(zt=st.y),st.y0){const je=[];for(let et=0;et{HU(Ve,e.id,n,_e,Ae)},onPointerMove:Ve=>{IU(Ve,n)},onPointerUp:Ve=>{MU(Ve,t)},onContextMenu:Ve=>{HH(Ve,n)},children:Q?h.jsx(nte,{id:n,foundationModel:e,roofType:S,roofSegments:_e,center:new ue(Ae.x,Ae.y,ze),thickness:x,lineWidth:A,lineColor:P,sideColor:w,color:gt,textureType:m,heatmap:ht}):h.jsxs(h.Fragment,{children:[_e.map((Ve,je,et)=>h.jsx(IQ,{id:n,index:je,foundationModel:e,roofType:S,segment:Ve,centroid:Ae,thickness:x,color:gt,sideColor:w,texture:D,heatmap:nt&&je0&&Ie[0].lz===Ie[2].lz&&Ue&&h.jsx(tU,{cz:Ie[0].lz,points:Ue}),T&&!C&&h.jsxs("group",{position:[Ae.x,Ae.y,Ae.z+x],children:[h.jsx(mh,{position:[we.x,we.y,we.z],onPointerDown:Ve=>{if(Ye(t.id,Ve,er.Select),G.current=!0,_.current=v,W(!0),vse.set(we.x,we.y,ze).add(Ae),e){const je=-Math.atan2(L.position.x-o,L.position.y-r)-e.rotation[2];bse.set(-$t,0,je,"ZXY")}N(Ur.TopMid),jn.getState().setEnableOrbitController(!1),R(je=>{je.resizeHandleType=xt.Top,je.selectedElementHeight=ze+t.thickness})},onPointerOver:()=>{R(Ve=>{Ve.hoveredHandle=Ur.TopMid,Ve.selectedElementHeight=ze+t.thickness,Ve.selectedElementX=we.x,Ve.selectedElementY=we.y})}}),!Q&&h.jsxs(h.Fragment,{children:[h.jsx(mh,{position:[se.x,se.y,se.z],onPointerDown:()=>{G.current=!0,O.current=[...d],ae(se,Ie[3]),N(Ur.TopLeft)}}),h.jsx(mh,{position:[ge.x,ge.y,ge.z],onPointerDown:()=>{G.current=!0,O.current=[...d],ae(ge,Ie[1]),N(Ur.TopRight)}}),h.jsx(mh,{position:[Se.x,Se.y,Se.z],onPointerDown:()=>{G.current=!0,O.current=[...f],ae(Se,Ie[3]),N(Ur.FrontLeft)}}),h.jsx(mh,{position:[Me.x,Me.y,Me.z],onPointerDown:()=>{G.current=!0,O.current=[...f],ae(Me,Ie[1]),N(Ur.FrontRight)}}),h.jsx(mh,{position:[Ce.x,Ce.y,Ce.z],onPointerDown:()=>{G.current=!0,O.current=[...p],ae(Ce,Ie[1]),N(Ur.BackLeft)}}),h.jsx(mh,{position:[Te.x,Te.y,Te.z],onPointerDown:()=>{G.current=!0,O.current=[...p],ae(Te,Ie[3]),N(Ur.BackRight)}})]})]}),U&&h.jsx(yi,{name:"Roof Intersection Plane",ref:F,args:[1e3,100],visible:!1,position:vse,rotation:bse,onPointerMove:Ve=>{if(F.current&&G.current&&Ie&&Ie.length===4){q(Ve);const je=j.intersectObjects([F.current]);if(je[0]&&e){const et=je[0].point;if(et.z<.001)return;switch(k){case Ur.TopMid:{const bt=Math.max(0,et.z-e.lz-.3-ve),St=ve+bt,Pt=Pe(Ie,St,f,d,p);O9(Pt,l)&&H.getState().updateRoofRiseById(n,bt,St+t.thickness);break}case Ur.FrontLeft:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[3],et),d[0]+.05,.45),St=ze-Ie[0].lz,Pt=ye.clamp((et.z-e.lz-Ie[0].lz)/St,0,1),Yt=[bt,Pt],zt=Pe(Ie,ze,Yt,d,p);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>$(yt));Ct&&(Ct.frontRidgePoint[0]=Yt[0],Ct.frontRidgePoint[1]=Yt[1])})}break}case Ur.FrontRight:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[1],et),-.45,-d[0]-.05),St=ze-Ie[0].lz,Pt=ye.clamp((et.z-e.lz-Ie[0].lz)/St,0,1),Yt=[-bt,Pt],zt=Pe(Ie,ze,Yt,d,p);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>$(yt));Ct&&(Ct.frontRidgePoint=[...Yt])})}break}case Ur.TopLeft:{if(e&&Ie&&Ie.length===4){const St=[ye.clamp(Z(e,Ie[3],et),-p[0]+.05,f[0]-.05),d[1]],Pt=Pe(Ie,ze,f,St,p);O9(Pt,l)&&R(Yt=>{const zt=Yt.elements.find(Rt=>$(Rt));zt&&(zt.topRidgePoint=[...St])})}break}case Ur.TopRight:{if(e&&Ie&&Ie.length===4){const St=[-ye.clamp(Z(e,Ie[1],et),-f[0]+.05,p[0]-.05),d[1]],Pt=Pe(Ie,ze,f,St,p);O9(Pt,l)&&R(Yt=>{const zt=Yt.elements.find(Rt=>$(Rt));zt&&(zt.topRidgePoint=[...St])})}break}case Ur.BackLeft:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[1],et),-d[0]+.05,.45),St=ze-Ie[2].lz,Pt=ye.clamp((et.z-e.lz-Ie[2].lz)/St,0,1),Yt=[bt,Pt],zt=Pe(Ie,ze,f,d,Yt);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>$(yt));Ct&&(Ct.backRidgePoint=[...Yt])})}break}case Ur.BackRight:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[3],et),-.45,d[0]-.05),St=ze-Ie[2].lz,Pt=ye.clamp((et.z-e.lz-Ie[2].lz)/St,0,1),Yt=[-bt,Pt],zt=Pe(Ie,ze,f,d,Yt);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>$(yt));Ct&&(Ct.backRidgePoint=[...Yt])})}break}}}}},onPointerUp:()=>{switch(k){case Ur.TopMid:{RU(n,_.current,v);break}case Ur.TopLeft:case Ur.TopRight:{ee(n,k,O.current,d);break}case Ur.FrontLeft:case Ur.FrontRight:{ee(n,k,O.current,f);break}case Ur.BackLeft:case Ur.BackRight:{ee(n,k,O.current,p);break}}G.current=!1,W(!1),N(Ur.Null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})})]})},man=xe.memo(gan,fI),l_=new ue,s_=new cn,QRe=new _t,yan=new ue(0,0,1),oE=xe.memo(({start:t,end:e,width:n,height:o,offset:r,color:i})=>{const a=g.useMemo(()=>new _t(t.x,t.y),[t]),l=g.useMemo(()=>new _t(e.x,e.y),[e]),s=g.useMemo(()=>new _t().subVectors(l,a).angle(),[a,l]),c=g.useMemo(()=>{const u=new jl,d=a.distanceTo(l),f=t.z-e.z;return u.moveTo(0,0),u.lineTo(d,-f),u.lineTo(d,-f+o),u.lineTo(0,o),u.closePath(),u},[t,e,a,l,o]);return h.jsx("group",{position:r,children:h.jsx(Q8,{args:[c,{steps:1,depth:n,bevelEnabled:!1}],position:t,rotation:[$t,0,s,"ZXY"],castShadow:!0,receiveShadow:!0,children:h.jsx("meshStandardMaterial",{color:i})})})}),Aan=({ridgeLeftPoint:t,ridgeRightPoint:e,wallArray:n,height:o,isShed:r,width:i,spacing:a,color:l})=>{const[s,c,u,d]=n,f=g.useMemo(()=>new ue().subVectors(e,t).normalize(),[]),p=g.useMemo(()=>t.clone().add(f.clone().multiplyScalar(-(d.eavesLength??0)/2)),[t,d.eavesLength]),m=g.useMemo(()=>e.clone().add(f.clone().multiplyScalar((c.eavesLength??0)/2)),[t,c.eavesLength]),y=s.leftPoint.clone().setZ(s.lz),w=u.rightPoint.clone().setZ(u.lz),x=g.useMemo(()=>{if(n.length<4)return[];const S=new ue().subVectors(new ue(s.rightPoint.x,s.rightPoint.y,s.lz),y).normalize(),v=new ue().subVectors(new ue(u.leftPoint.x,u.leftPoint.y,u.lz),w).normalize(),b=t.distanceTo(e),T=new ue().subVectors(s.leftPoint,s.rightPoint).length(),R=new ue().subVectors(u.leftPoint,u.rightPoint).length(),M=i,D=Math.floor((Math.min(b,T,R)-i)/a)+2;return new Array(D).fill(0).map((k,N)=>{let U;N===D-1?U=b:U=N*a+M;const W=t.clone().add(f.clone().multiplyScalar(U)),F=y.clone().add(S.clone().multiplyScalar(U)),E=w.clone().add(v.clone().multiplyScalar(U)),L=new ue().subVectors(F,W).normalize().multiplyScalar(s.eavesLength??0),j=new ue().subVectors(E,W).normalize().multiplyScalar(u.eavesLength??0);return F.add(L),E.add(j),{ridge:W,front:F,back:E}})},[a,t]),C=t.distanceTo(y)>t.distanceTo(w),P=new ue(-i,0,0),A=new ue(0,i/2,0);return h.jsxs(h.Fragment,{children:[x.map((S,v)=>h.jsx(xe.Fragment,{children:r?C?h.jsx(oE,{start:S.ridge,end:S.front,width:i,height:o,color:l}):h.jsx(oE,{start:S.ridge,end:S.back,width:i,height:o,color:l}):h.jsxs(h.Fragment,{children:[h.jsx(oE,{start:S.ridge,end:S.front,width:i,height:o,color:l}),h.jsx(oE,{start:S.ridge,end:S.back,width:i,height:o,color:l,offset:P})]})},v)),h.jsx(oE,{start:p,end:m,width:i,height:o,color:l,offset:A})]})},wan=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e),a=t.length===1;for(const f of t){const[p,m,y,w]=f.points;r.push(w,p,m,y),a&&r.push(w)}const l=Math.abs(t[0].points[0].z)<.015,s=t[0].points[3],c=t[0].points[2],u=h.jsx(On,{points:r,lineWidth:n,color:o}),d=h.jsx(On,{points:[s,c],lineWidth:n,color:o});return h.jsxs(h.Fragment,{children:[u,!l&&!a&&d,h.jsxs("group",{position:[0,0,e],children:[u,!l&&!a&&d]}),t.map((f,p)=>{const[m,y,w,x]=f.points;return h.jsxs("group",{children:[h.jsx(On,{points:[m,m.clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[y,y.clone().add(i)],lineWidth:n,color:o}),a&&h.jsxs(h.Fragment,{children:[h.jsx(On,{points:[w,w.clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[x,x.clone().add(i)],lineWidth:n,color:o})]})]},p)})]})}),xan=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,wallsId:r,lz:i,rise:a=i,thickness:l=.2,ridgeLeftPoint:s,ridgeRightPoint:c,textureType:u,color:d="white",sideColor:f="white",locked:p,lineColor:m="black",lineWidth:y=.2,roofStructure:w,rafterSpacing:x=2,rafterWidth:C=.1,rafterColor:P="white",glassTint:A="#73D8FF",opacity:S=.5,ceiling:v=!1}=t;const b=H(pn),T=H(Jp),R=Fc(n);[m,y]=Rn.getWireframeStyle(m,y,R,p);const{gl:M,camera:D}=ti(),k=g.useMemo(()=>new yu,[]),N=g.useMemo(()=>new _t,[]),[U,W]=g.useState(!1),[F,E]=g.useState(Ur.Null),L=Math.abs(s[0])>.45,j=g.useRef(null),Y=g.useRef(s[0]),O=g.useRef(c[0]),_=g.useRef(a),G=g.useRef(!1),Q=(He,Le,Ye)=>{b(lt=>{for(const Oe of lt.elements)if(Oe.id===He&&Oe.type===z.Roof&&Oe.roofType===Zo.Gable){Oe.ridgeLeftPoint[0]=Le,Oe.ridgeRightPoint[0]=Ye;break}})},oe=(He,Le,Ye,lt,Oe)=>{const ut={name:"Resize Gable Roof Ridge",timestamp:Date.now(),resizedElementId:He,resizedElementType:z.Roof,oldLeft:Le,oldRight:Ye,newLeft:lt,newRight:Oe,undo:()=>{Q(ut.resizedElementId,Le,Ye)},redo:()=>{Q(ut.resizedElementId,lt,Oe)}};H.getState().addUndoable(ut)},ee=He=>{N.x=He.offsetX/M.domElement.clientWidth*2-1,N.y=-(He.offsetY/M.domElement.clientHeight)*2+1,k.setFromCamera(N,D)},q=(He,Le,Ye)=>{const lt=new _t(He.cx,He.cy),Oe=new ue().addVectors(Le.leftPoint,Le.rightPoint).divideScalar(2),ut=new ue().subVectors(Le.leftPoint,Le.rightPoint).length(),ht=new _t(Oe.x,Oe.y).rotateAround(QRe,He.rotation[2]).add(lt),Qe=He.rotation[2]+Le.relativeAngle,mt=new _t(Ye.x,Ye.y).sub(ht).rotateAround(QRe,-Qe).x/ut;return Math.min(Math.abs(mt),.5)*(mt>=0?1:-1)},ae=(He,Le,Ye)=>{if(!He)return new ue;const lt=new ue().subVectors(He.leftPoint,He.rightPoint).length(),Oe=new ue().addVectors(He.leftPoint,He.rightPoint).divideScalar(2),ut=new cn(0,0,He.relativeAngle),ht=new ue(Le*lt,0,0),Qe=Ye*a+ce;return new ue(Oe.x,Oe.y,Qe).add(ht.applyEuler(ut))},Z=(He,Le)=>{const Ye=He[Le];let lt,Oe;return Le===0||Le===2?(lt=Ye.lz,Oe=Ye.lz):Le===1?(lt=He[0].lz,Oe=He[2].lz):(lt=He[2].lz,Oe=He[0].lz),{lh:lt,rh:Oe}},ne=(He,Le)=>{const Ye=He.slice().reverse();return te(Ye,0,Le-1),te(Ye,Le,Ye.length-1),Ye},te=(He,Le,Ye)=>{for(;LeHe*Ye+Le,le=(He,Le,Ye,lt,Oe)=>{const ut=Le[Ye],ht=new ue().subVectors(ut.leftPoint,ut.rightPoint).length(),Qe=(Oe[0]+.5)*ht,{lh:nt,rh:mt}=Z(Le,Ye),tt=Oe[1]*(lt-nt)/Qe,gt=nt,Ve=-(Oe[1]*(lt-mt))/(ht-Qe),je=mt-Ve*ht,et=ut.wallsId.reduce((bt,St)=>{const Pt=H.getState().elements.find(Yt=>Yt.id===St);return Pt?[...bt,Pt.lx+bt[bt.length-1]]:bt},[0]);for(let bt=0;btQe&&(Rt.center=[(Qe-Pt)/zt-.5,lt]),He.set(St,Rt)}return He},de=(He,Le,Ye,lt)=>{const Oe=new Map;return le(Oe,He,1,Le,lt),le(Oe,He,3,Le,Ye),Oe},he=(He,Le,Ye,lt)=>{const[Oe,ut,ht,Qe]=He,nt=new Set(Oe.wallsId),mt=new Set(ht.wallsId),tt=de(He,Le,Ye,lt);b(gt=>{for(const Ve of gt.elements)if(Ve.type===z.Wall&&Ve.foundationId===o){if(nt.has(Ve.id)){const je=Ve;if(je.roofId=n,Ye[0]===.5)je.leftRoofHeight=Le,je.rightRoofHeight=Le,je.centerRoofHeight=void 0;else{const{lh:et,rh:bt}=Z(He,0);je.leftRoofHeight=et,je.rightRoofHeight=bt}}else if(mt.has(Ve.id)){const je=Ve;if(je.roofId=n,Ye[0]===-.5)je.leftRoofHeight=Le,je.rightRoofHeight=Le,je.centerRoofHeight=void 0;else{const{lh:et,rh:bt}=Z(He,2);je.leftRoofHeight=et,je.rightRoofHeight=bt}}else if(tt.has(Ve.id)){const je=tt.get(Ve.id);if(je){const et=Ve,{left:bt,right:St,center:Pt}=je;if(et.roofId=n,et.leftRoofHeight=bt,et.rightRoofHeight=St,Pt){const[Yt,zt]=Pt;et.centerRoofHeight?(et.centerRoofHeight[0]=Yt,et.centerRoofHeight[1]=zt):et.centerRoofHeight=[Yt,zt]}else et.centerRoofHeight=void 0}}}})},me=F3e(r[0],o),{highestWallHeight:ce,topZ:Pe}=L3e(me,a,!0);EU(t,ce);const pe=g.useMemo(()=>{if(me===null||me.length!==4)return new ue;const He=me.map(Ye=>({x:Ye.leftPoint.x,y:Ye.leftPoint.y})),Le=ye.calculatePolygonCentroid(He);return new ue(Le.x,Le.y,Pe)},[me,Pe]),Ie=g.useMemo(()=>{if(me===null)return new ue;const He=me[3],[Le,Ye]=s;return ae(He,Le,Ye)},[me,Pe,s]),ve=g.useMemo(()=>{if(me===null)return new ue;const He=me[1],[Le,Ye]=c;return ae(He,Le,Ye)},[me,Pe,c]),ze=g.useMemo(()=>new ue((Ie.x+ve.x)/2,(Ie.y+ve.y)/2,Pe),[Ie,ve]),Ae=g.useMemo(()=>!me||me.length!==4?null:me.map(He=>Rn.getComposedWallNormal(He).multiplyScalar(He.eavesLength)),[me]),se=g.useMemo(()=>yan.clone().multiplyScalar(l),[l]),ge=g.useMemo(()=>{const He=[];if(!me||me.length!==4||!Ae)return He;if(L){const Le=[],Ye=s[0]<0?0:2,lt=ne(me,Ye),Oe=ne(Ae,Ye),[ut,ht,Qe,nt]=lt,[mt,tt,gt,Ve]=Oe,je=ut.leftPoint,et=ut.rightPoint,bt=Qe.leftPoint,St=Qe.rightPoint,Pt=je.clone().add(mt),Yt=et.clone().add(mt),zt=St.clone().add(Ve),Rt=je.clone().add(Ve),Ct=et.clone().add(tt),yt=bt.clone().add(tt),at=bt.clone().add(gt),Et=St.clone().add(gt),{lh:Lt,rh:Je}=Z(lt,0),{lh:st,rh:It}=Z(lt,2),ot=Rn.getDistance(je,et,St),it=Math.min((ut.eavesLength??0)/ot*(Pe-Lt),Lt),Be=Rn.getDistance(je,et,bt),pt=Math.min((ut.eavesLength??0)/Be*(Pe-Je),Je),ct=Rn.getDistance(bt,St,et),Xe=Math.min((Qe.eavesLength??0)/ct*(Pe-Je),st),ft=Rn.getDistance(bt,St,je),wt=Math.min((Qe.eavesLength??0)/ft*(Pe-Lt),It),kt=Rn.getIntersectionPoint(zt,Rt,Pt,Yt).setZ(Lt-it).sub(pe),Zt=Rn.getIntersectionPoint(Pt,Yt,Ct,yt).setZ(Je-pt).sub(pe),Ot=Rn.getIntersectionPoint(Ct,yt,at,Et).setZ(Pe+Xe).sub(pe),on=Rn.getIntersectionPoint(at,Et,zt,Rt).setZ(Pe+wt).sub(pe);Le.push(kt,Zt,Ot,on),Le.push(kt.clone().add(se),Zt.clone().add(se),Ot.clone().add(se),on.clone().add(se));const rn=new ue().addVectors(ut.leftPoint,ut.rightPoint).divideScalar(2).clone().sub(ze.clone().setZ(0)).length();He.push({points:Le,angle:-ut.relativeAngle,length:rn})}else{const[Le,Ye,lt,Oe]=me,[ut,ht,Qe,nt]=Ae,mt=Le.leftPoint.clone().add(ut),tt=Le.rightPoint.clone().add(ut),gt=lt.rightPoint.clone().add(nt),Ve=Le.leftPoint.clone().add(nt),je=Le.rightPoint.clone().add(ht),et=lt.leftPoint.clone().add(ht),bt=lt.leftPoint.clone().add(Qe),St=lt.rightPoint.clone().add(Qe),Pt=Rn.getIntersectionPoint(Ie,ve,gt.clone(),Ve.clone()).setZ(Ie.z).sub(pe),Yt=Rn.getIntersectionPoint(Ie,ve,je.clone(),et.clone()).setZ(ve.z).sub(pe),zt=[],{lh:Rt,rh:Ct}=Z(me,0),yt=Rn.getDistance(Le.leftPoint,Le.rightPoint,Ie),at=Math.min((Le.eavesLength??0)/yt*(Ie.z-Rt),Rt),Et=Rn.getDistance(Le.leftPoint,Le.rightPoint,ve),Lt=Math.min((Le.eavesLength??0)/Et*(ve.z-Ct),Ct),Je=Rn.getIntersectionPoint(gt,Ve,mt,tt).setZ(Rt-at).sub(pe),st=Rn.getIntersectionPoint(mt,tt,je,et).setZ(Ct-Lt).sub(pe);zt.push(Je,st,Yt,Pt),zt.push(Je.clone().add(se),st.clone().add(se),Yt.clone().add(se),Pt.clone().add(se));const ot=new ue().addVectors(Le.leftPoint,Le.rightPoint).divideScalar(2).clone().sub(pe.clone().setZ(0)).length();He.push({points:zt,angle:-Le.relativeAngle,length:ot});const it=[],{lh:Be,rh:pt}=Z(me,2),ct=Rn.getDistance(lt.leftPoint,lt.rightPoint,ve),Xe=Math.min((lt.eavesLength??0)/ct*(ve.z-Be),Be),ft=Rn.getDistance(lt.leftPoint,lt.rightPoint,Ie),wt=Math.min((lt.eavesLength??0)/ft*(Ie.z-pt),pt),kt=Rn.getIntersectionPoint(je,et,bt,St).setZ(Be-Xe).sub(pe),Zt=Rn.getIntersectionPoint(bt,St,gt,Ve).setZ(pt-wt).sub(pe);it.push(kt,Zt,Pt,Yt),it.push(kt.clone().add(se),Zt.clone().add(se),Pt.clone().add(se),Yt.clone().add(se));const on=new ue().addVectors(lt.leftPoint,lt.rightPoint).divideScalar(2).clone().sub(pe.clone().setZ(0)).length();He.push({points:it,angle:-lt.relativeAngle,length:on})}return He},[me,Ie,ve,Pe,l]),we=g.useMemo(()=>!me||me.length!==4?null:me.map(He=>He.leftPoint),[me]);g.useEffect(()=>{(!me||me.length!==4)&&T(n,!1,!1,!0)},[me]);const Se=tte();g.useEffect(()=>{if((me==null?void 0:me.length)!==4)return;(H.getState().addedRoofIdSet.has(n)||!Se)&&(he(me,Pe,s,c),ete(e,n,ge,pe,Pe,l),H.getState().deleteAddedRoofId(n))},[ge]),W3e(e,n,ge,pe,Pe,l);const Me=()=>{if(!me||me.length!==4)return;const He=[];if(L){const Le=s[0]<0?0:2,lt=ne(me,Le).map((Oe,ut,ht)=>new ue(Oe.leftPoint.x,Oe.leftPoint.y,Z(ht,ut).lh));He.push(lt)}else{const Le=me.map((Ye,lt,Oe)=>new ue(Ye.leftPoint.x,Ye.leftPoint.y,Z(Oe,lt).lh));He.push([Le[0],Le[1],ve.clone(),Ie.clone()]),He.push([Le[2],Le[3],Ie.clone(),ve.clone()])}In.getState().setRoofSegmentVerticesWithoutOverhang(n,He)};zU(n,pe,ge,!1,Zo.Gable),DU(Me);const Ce=H(He=>He.elements.filter(Le=>Le.parentId===n&&Le.type===z.Window),Qy),Te=H(z0),Re=dt(vs),Ne=H(Df),_e=In(O1),[Ue,qe]=g.useState([]);g.useEffect(()=>{if(Re){const He=ge.length;if(He>0){const Le=[];for(let Ye=0;Ye{HU(He,e.id,n,ge,pe)},onPointerMove:He=>{IU(He,n)},onPointerUp:He=>{MU(He,t)},onContextMenu:He=>{HH(He,n)},children:[ge.map((He,Le,Ye)=>{const{points:lt,angle:Oe,length:ut}=He,ht=Math.abs(lt[0].z)<.1;return me?h.jsx(van,{index:Le,id:n,points:lt,centroid:pe,angle:ht?Ye[0].angle:Oe,length:ht?1:ut,textureType:u,heatmaps:Ue,color:d,sideColor:f,roofStructure:w,glassTint:A,opacity:S,relativeAngle:Le===0?me[0].relativeAngle:me[2].relativeAngle,foundation:e,windows:Ce},Le):null}),S>0&&h.jsx(wan,{roofSegments:ge,thickness:l,lineColor:m,lineWidth:w===Hc.Rafter?.1:y})]}),v&&a>0&&me[0].lz===me[2].lz&&we&&h.jsx(tU,{cz:me[0].lz,points:we}),w===Hc.Rafter&&me&&me.length===4&&h.jsx("group",{onContextMenu:He=>{HH(He,n)},onPointerDown:He=>{Rot(He,n,o)},children:h.jsx(Aan,{ridgeLeftPoint:Ie,ridgeRightPoint:ve,wallArray:me,overhang:0,isShed:L,height:l,spacing:x,color:P,width:C})}),R&&!p&&h.jsxs("group",{position:[0,0,l],children:[h.jsx(mh,{position:[ze.x,ze.y,ze.z+.15],onPointerDown:He=>{if(Te(t.id,He,er.Select),G.current=!0,_.current=a,W(!0),l_.set(ze.x,ze.y,Pe),e){const Le=-Math.atan2(D.position.x-e.cx,D.position.y-e.cy)-e.rotation[2];s_.set(-$t,0,Le,"ZXY")}E(Ur.Mid),jn.getState().setEnableOrbitController(!1),b(Le=>{Le.resizeHandleType=xt.Top,Le.selectedElementHeight=Pe+t.thickness})},onPointerOver:()=>{b(He=>{He.hoveredHandle=Ur.Mid,He.selectedElementHeight=Pe+t.thickness,He.selectedElementX=ze.x,He.selectedElementY=ze.y})}}),h.jsx(mh,{position:[Ie.x,Ie.y,Ie.z+.15],onPointerDown:()=>{if(G.current=!0,Y.current=s[0],O.current=c[0],W(!0),l_.set(Ie.x,Ie.y,Pe),e&&me&&me[3]){const He=new ue().subVectors(Ie,D.position).normalize(),Le=Math.atan2(He.z,Math.hypot(He.x,He.y)),Ye=me[3].relativeAngle;s_.set(-$t+Le,0,Ye,"ZXY")}E(Ur.Left),jn.getState().setEnableOrbitController(!1)}}),h.jsx(mh,{position:[ve.x,ve.y,ve.z+.15],onPointerDown:()=>{if(G.current=!0,Y.current=s[0],O.current=c[0],W(!0),l_.set(ve.x,ve.y,Pe),e&&me&&me[1]){const He=new ue().subVectors(ve,D.position).normalize(),Le=Math.atan2(He.z,Math.hypot(He.x,He.y)),Ye=me[1].relativeAngle;s_.set(-$t+Le,0,Ye,"ZXY")}E(Ur.Right),jn.getState().setEnableOrbitController(!1)}})]}),U&&h.jsx(yi,{name:"Roof Intersection Plane",ref:j,args:[1e3,100],visible:!1,position:l_,rotation:s_,onPointerMove:He=>{if(j.current&&G.current&&e&&me&&me.length===4){ee(He);const Le=k.intersectObjects([j.current]);if(Le[0]){const Ye=Le[0].point;if(Ye.z<.001)return;switch(F){case Ur.Left:{const lt=me[3];if(lt){let Oe=q(e,lt,Ye);Math.abs(Oe)>=.45&&Math.abs(Oe)<.5&&(Oe=.45*Math.sign(Oe));const ut=[Oe,s[1]],ht=[-Oe,c[1]],Qe=de(me,Pe,ut,ht);O9(Qe,o)&&Q(n,Oe,-Oe)}break}case Ur.Right:{const lt=me[1];if(lt){let Oe=q(e,lt,Ye);Math.abs(Oe)>=.45&&Math.abs(Oe)<.5&&(Oe=.45*Math.sign(Oe));const ut=[-Oe,s[1]],ht=[Oe,c[1]],Qe=de(me,Pe,ut,ht);O9(Qe,o)&&Q(n,-Oe,Oe)}break}case Ur.Mid:{let lt;L?lt=Math.max(0,Ye.z-e.lz-.3-ce):lt=Math.max(-ce+.01,Ye.z-e.lz-.3-ce);const Oe=ce+lt,ut=de(me,Oe,s,c);O9(ut,o)&&H.getState().updateRoofRiseById(n,lt,Pe+t.thickness);break}}}}},onPointerUp:()=>{switch(F){case Ur.Mid:{RU(n,_.current,a);break}case Ur.Left:case Ur.Right:oe(n,Y.current,O.current,s[0],c[0])}G.current=!1,W(!1),E(Ur.Null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})})]})},van=({index:t,id:e,points:n,centroid:o,angle:r,length:i,textureType:a,heatmaps:l,color:s="white",sideColor:c,relativeAngle:u,foundation:d,roofStructure:f,glassTint:p,opacity:m=.5,windows:y})=>{const w=H.getState().world;H(Jn);const x=H($3),C=dt(vs),P=dt(n6),A=H(Y5),S=H(J3),v=H(K3),b=In(UN),T=In.getState().hourlyHeatExchangeArrayMap,R=hI(f===Hc.Rafter?Yr.NoTexture:a),{transparent:M,opacity:D}=pI(f===Hc.Rafter,m),{invalidate:k}=ti(),N=g.useRef(null),U=g.useRef(null),W=g.useRef(null),F=g.useRef(null),E=g.useRef(0),L=g.useRef(),j=g.useRef(),[Y,O]=g.useState(0),[_,G]=g.useState(0),[Q,oe]=g.useState(!0),ee=($,le)=>$.clone().setZ(0).distanceTo(le.clone().setZ(0))>2,q=$=>Math.abs($){if(!P)return;const $=b(e);if(!$)return;const le=[],[de,he,me,ce,Pe]=n,pe=Pe.z-de.z,Ie=new ue(0,0,pe+.1);for(const ve of $.values()){let ze=[];ze.push(ve[0].clone().sub(o).add(Ie)),ze.push(ve[1].clone().sub(o).add(Ie)),le.push(ze),ze=[],ze.push(ve[0].clone().sub(o).add(Ie)),ze.push(ve[3].clone().sub(o).add(Ie)),le.push(ze),ze=[],ze.push(ve[1].clone().sub(o).add(Ie)),ze.push(ve[2].clone().sub(o).add(Ie)),le.push(ze)}return le},[P]),Z=g.useMemo(()=>{if(!P||d&&d.notBuilding)return;const $=T.get(e+"-"+t);if(!$)return;const le=$.reduce((Qe,nt)=>Qe+nt,0),de=b(e);if(!de||!de[t])return;const[he,me,ce,Pe,pe]=n,Ie=pe.z-he.z,ve=de[t].map(Qe=>Qe.clone().sub(o).add(new ue(0,0,Ie)));if(!ve)return;let ze=ye.getTriangleArea(ve[0],ve[1],ve[2])+ye.getTriangleArea(ve[2],ve[3],ve[0]);if(ze===0)return;let Ae=x(z.Window,e);const se=b(e);if(se&&se[t]&&(Ae=Ae.filter(Qe=>{const nt=Qe,mt=nt.cy+(nt.windowType===Ti.Polygonal&&nt.polygonTop?nt.polygonTop[1]/2:0);return Rn.onSegment(se[t],Qe.cx,mt)})),Ae&&Ae.length>0)for(const Qe of Ae)ze-=ye.getWindowArea(Qe);const ge=X3*(w.solarRadiationHeatmapGridCellSize??.5),we=ve[0].clone(),Se=ve[1].clone(),Me=ve[2].clone(),Ce=new ue().subVectors(Se,we),Te=new ue().subVectors(Me,we),Re=new ue().subVectors(Me,Se),Ne=Ce.length(),_e=new ue().crossVectors(Te,Re).length()/Ne,Ue=Math.max(2,Math.round(Ne/ge)),qe=Math.max(2,Math.round(_e/ge));Ce.normalize(),Te.normalize(),Re.normalize();const Fe=new ue().crossVectors(Te,Re).normalize(),He=Ce.multiplyScalar(.5*Ne/Ue),Le=new ue().crossVectors(Fe,Ce).normalize().multiplyScalar(.5*_e/qe),Ye=we.clone().add(He).add(Le);He.multiplyScalar(2),Le.multiplyScalar(2);const lt=le/ze*(A??Ny);E.current=lt<0?1:0,L.current=Fe.clone().multiplyScalar(.1),j.current=ye.getEuler(Oo,Fe,"YXZ",-Math.sign(lt)*$t);const Oe=[],ut=new ue;let ht;for(let Qe=0;Qe0){const tt=ut.x+o.x,gt=ut.y+o.y;for(const Ve of Ae){const je=Rn.getRelativeWindowVerticesOnRoof(Ve),et=ye.getPoints(je);if(ye.isPointInside(tt,gt,et)){ht=!1;break}}}if(ht){const tt=[];lt<0?(tt.push(ut.clone()),tt.push(ut.clone().add(Fe.clone().multiplyScalar(-lt)))):(tt.push(ut.clone()),tt.push(ut.clone().add(Fe.clone().multiplyScalar(lt)))),Oe.push(tt)}}}return Oe},[P,A,o,n]);g.useEffect(()=>{const[$,le,de,he,me]=n,ce=me.z-$.z;if(N.current){const Pe=N.current.geometry;if(Pe){const pe=new Float32Array(18),Ie=ce+.01;pe[0]=n[0].x,pe[1]=n[0].y,pe[2]=n[0].z+Ie,pe[3]=n[1].x,pe[4]=n[1].y,pe[5]=n[1].z+Ie,pe[6]=n[2].x,pe[7]=n[2].y,pe[8]=n[2].z+Ie,pe[9]=n[2].x,pe[10]=n[2].y,pe[11]=n[2].z+Ie,pe[12]=n[3].x,pe[13]=n[3].y,pe[14]=n[3].z+Ie,pe[15]=n[0].x,pe[16]=n[0].y,pe[17]=n[0].z+Ie,Pe.setAttribute("position",new Ar(pe,3)),Pe.computeVertexNormals();const ve=[];ve.push(0,0),ve.push(1,0),ve.push(1,1),ve.push(1,1),ve.push(0,1),ve.push(0,0),Pe.setAttribute("uv",new Ar(ve,2))}}if(U.current){U.current.geometry=new Dde(n,r,i);const Pe=ee($,he)&&ee(le,de);if(oe(Pe),f===Hc.Glass&&Pe){const pe=ye.calculatePolygonCentroid(n.map(ye.mapVector3ToPoint2)),Ie=new ue(pe.x,pe.y,0),ve=.25,ze=new ue().addVectors($,Ie.clone().sub($).setZ(0).normalize().multiplyScalar(ve)),Ae=new ue().addVectors(le,Ie.clone().sub(le).setZ(0).normalize().multiplyScalar(ve)),se=new ue().addVectors(de,Ie.clone().sub(de).normalize().multiplyScalar(ve)),ge=new ue().addVectors(he,Ie.clone().sub(he).normalize().multiplyScalar(ve)),we=[];we.push(ze),we.push(Ae),we.push(se.setZ(Ae.z)),we.push(ge.setZ(ze.z)),we.push(ze.clone().setZ(1)),we.push(Ae.clone().setZ(1)),we.push(se.clone().setZ(1)),we.push(ge.clone().setZ(1));const Se=new os(new Dde(we)),Me=Ac.subtract(U.current,Se);if(U.current.geometry=Me.geometry,q(u)){const Te=ze.distanceTo(Ae),Re=$.distanceTo(he);O(Te),G(Re);const Ne=new ue().subVectors($,he).angleTo(new ue(0,-1,0));W.current&&(W.current.scale.set(Te,Re,1),W.current.rotation.set(Ne,0,0)),F.current&&F.current.rotation.set(Ne-$t,0,0)}else{const Te=$.distanceTo(he),Re=ze.distanceTo(Ae);O(Te),G(Re);const Ne=new ue().subVectors($,he).angleTo(new ue(1,0,0));W.current&&(W.current.scale.set(Te,Re,1),W.current.rotation.set(0,Ne,0)),F.current&&F.current.rotation.set($t,Ne,0,"YXZ")}const Ce=($.z+he.z)/2+ce*.75;W.current&&W.current.position.set(pe.x,pe.y,Ce),F.current&&F.current.position.set(pe.x,pe.y,Ce)}}k()},[n,r,i,u,Q,C,f]);const ne={points:n,angle:r,length:i},te=a===Yr.Default||a===Yr.NoTexture?s:"white";return h.jsxs(h.Fragment,{children:[(D>0&&f===Hc.Rafter||f!==Hc.Rafter)&&h.jsx(h.Fragment,{children:h.jsx(DJe,{id:e,index:t,segment:ne,color:te,sideColor:c??"white",texture:R,heatmap:l[t],transparent:M,opacity:D,windows:y,centroid:o})}),ae&&ae.map(($,le)=>h.jsx(On,{points:$,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+le},le)),Z&&Z.map(($,le)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:$,name:"Heat Flux "+le,lineWidth:v??Uy,color:S??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:L.current?$[E.current].clone().add(L.current):$[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:j.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:S??Fu})})]},le))]})},ban=xe.memo(xan,fI),San=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e);for(let u=0;u{const[f,p,m,y]=u.points,w=[f.clone().sub(i),f];return h.jsx(On,{points:w,lineWidth:n,color:o},d)})]})]})}),mw=new ue,yw=new cn,Tan=new ue(0,0,1),Pan=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,cx:r,cy:i,lz:a,wallsId:l,leftRidgeLength:s,rightRidgeLength:c,textureType:u,color:d="white",sideColor:f="white",thickness:p=.2,locked:m,lineColor:y="black",lineWidth:w=.2,roofType:x,rise:C=a,ceiling:P=!1}=t;const A=H(Jn),S=H(pn),v=H(Jp),b=F3e(l[0],o),T=hI(u),R=Fc(n),[M,D]=g.useState(!1),[k,N]=g.useState(Ur.Null),[U,W]=g.useState(s),[F,E]=g.useState(c),{highestWallHeight:L,topZ:j}=L3e(b,C);EU(t,L);const Y=g.useRef(null),{gl:O,camera:_}=ti(),G=g.useMemo(()=>new yu,[]),Q=g.useMemo(()=>new _t,[]),oe=g.useRef(!1),ee=g.useRef(C),q=C<.01;[y,w]=Rn.getWireframeStyle(y,w,R,m),g.useEffect(()=>{W(s)},[s]),g.useEffect(()=>{E(c)},[c]);const ae=(Fe,He,Le,Ye=!1)=>{S(lt=>{for(const Oe of lt.elements)if(Oe.id===Fe&&Oe.type===z.Roof&&Oe.roofType===Zo.Hip){Oe.leftRidgeLength=He,Oe.rightRidgeLength=Le,Ye&&(lt.updateElementOnRoofFlag=!0);break}})},Z=(Fe,He,Le,Ye,lt)=>{const Oe={name:"Resize Hip Roof Ridge",timestamp:Date.now(),resizedElementId:Fe,resizedElementType:z.Roof,oldLeftRidgeLength:He,oldRightRidgeLength:Le,newLeftRidgeLength:Ye,newRightRidgeLength:lt,undo:()=>{ae(Oe.resizedElementId,Oe.oldLeftRidgeLength,Oe.oldRightRidgeLength,!0)},redo:()=>{ae(Oe.resizedElementId,Oe.newLeftRidgeLength,Oe.newRightRidgeLength,!0)}};H.getState().addUndoable(Oe)},ne=Fe=>{const He=[];for(const Le of Fe)He.push({x:Le.leftPoint.x,y:Le.leftPoint.y});return He},te=Fe=>{Q.x=Fe.offsetX/O.domElement.clientWidth*2-1,Q.y=-(Fe.offsetY/O.domElement.clientHeight)*2+1,G.setFromCamera(Q,_)},$=(Fe,He,Le,Ye,lt)=>{Fe.push(He,Le,Ye),lt&&Fe.push(lt),Fe.push(He.clone().add(pe),Le.clone().add(pe),Ye.clone().add(pe)),lt&&Fe.push(lt.clone().add(pe))},le=()=>{if(b===null||b.length!==4)return 0;const Fe=b.map(Ye=>Ye.leftPoint),He=[he,me,me,he];let Le=1/0;for(let Ye=0;Ye<4;Ye++){const lt=b[Ye],Oe=Rn.getDistance(Fe[Ye],Fe[(Ye+1)%4],He[Ye]),ut=Math.min((lt.eavesLength??0)/Oe*(He[Ye].z-lt.lz),lt.lz),ht=Rn.getDistance(Fe[Ye],Fe[(Ye+1)%4],He[(Ye+1)%4]),Qe=Math.min((lt.eavesLength??0)/ht*(He[(Ye+1)%4].z-lt.lz),lt.lz);Le=Math.min(Math.min(ut,Qe),Le)}return Number.isNaN(Le)?0:Le},de=g.useMemo(()=>{if(b===null||b.length!==4)return new _t;const Fe=ne(b),He=ye.calculatePolygonCentroid(Fe);return new _t(He.x,He.y)},[b]),he=g.useMemo(()=>{const Fe=new ue,He=new ue(de.x,de.y,j),Le=A(l[0]);return Le&&Fe.setX(-U).applyEuler(new cn(0,0,Le.relativeAngle)).add(He),Fe},[de,j,U]),me=g.useMemo(()=>{const Fe=new ue,He=new ue(de.x,de.y,j),Le=A(l[0]);return Le&&Fe.setX(F).applyEuler(new cn(0,0,Le.relativeAngle)).add(He),Fe},[de,j,F]),ce=g.useMemo(()=>new ue(de.x,de.y,j),[de,j]),Pe=g.useMemo(()=>b===null||b.length!==4?[]:b.map(Fe=>Rn.getComposedWallNormal(Fe).multiplyScalar(Fe.eavesLength)),[b]),pe=g.useMemo(()=>Tan.clone().multiplyScalar(p),[p]),Ie=g.useMemo(()=>b===null||b.length!==4?null:b.map((Fe,He)=>({leftPoint:Fe.leftPoint.clone().add(Pe[He]),rightPoint:Fe.rightPoint.clone().add(Pe[He])})),[b,Pe]),ve=g.useMemo(()=>{const Fe=[];if(b===null||b.length!==4||Ie===null)return Fe;const He=le();for(let Le=0;Le<4;Le++){const Ye=[],lt=b[Le],{lh:Oe,rh:ut}=Rn.getComposedWallHeight(b,Le),ht=Rn.getIntersectionPoint(Ie[(Le+3)%4].leftPoint,Ie[(Le+3)%4].rightPoint,Ie[Le].leftPoint,Ie[Le].rightPoint).setZ(Oe-He).sub(ce),Qe=Rn.getIntersectionPoint(Ie[Le].leftPoint,Ie[Le].rightPoint,Ie[(Le+1)%4].leftPoint,Ie[(Le+1)%4].rightPoint).setZ(ut-He).sub(ce),nt=new ue().addVectors(lt.leftPoint,lt.rightPoint).divideScalar(2),mt=he.clone().sub(ce),tt=me.clone().sub(ce);let gt=0;switch(Le){case 0:gt=nt.clone().sub(ce.clone().setZ(0)).length(),$(Ye,ht,Qe,tt,mt);break;case 1:gt=nt.clone().sub(me.clone().setZ(0)).length(),$(Ye,ht,Qe,tt);break;case 2:gt=nt.clone().sub(ce.clone().setZ(0)).length(),$(Ye,ht,Qe,mt,tt);break;case 3:gt=nt.clone().sub(he.clone().setZ(0)).length(),$(Ye,ht,Qe,mt);break}Fe.push({points:Ye,angle:-lt.relativeAngle,length:gt})}return Fe},[b,he,me,j,p]),ze=g.useMemo(()=>!b||b.length!==4?null:b.map(Fe=>Fe.leftPoint),[b]);g.useEffect(()=>{if(b===null||b.length!==4)v(n,!1,!1,!0);else if(H.getState().addedRoofIdSet.has(n)){for(let He=0;He{for(const lt of Ye.elements)if(lt.type===z.Wall&&Le.has(lt.id)){const Oe=lt;Oe.roofId=n,Oe.leftRoofHeight=void 0,Oe.rightRoofHeight=void 0}})}H.getState().deleteAddedRoofId(n)}},[b]),N3e(e,n,ve,ce,j,p);const Ae=()=>{if(!b)return;const Fe=[];for(let He=0;He<4;He++){const Le=b[He],{lh:Ye,rh:lt}=Rn.getComposedWallHeight(b,He),Oe=Le.leftPoint.clone().setZ(Ye),ut=Le.rightPoint.clone().setZ(lt),ht=he.clone(),Qe=me.clone();switch(He){case 0:Fe.push([Oe,ut,Qe,ht]);break;case 1:Fe.push([Oe,ut,Qe]);break;case 2:Fe.push([Oe,ut,ht,Qe]);break;case 3:Fe.push([Oe,ut,ht]);break}}if(q){const He=[];for(const Le of Fe)He.push(Le[0].clone());In.getState().setRoofSegmentVerticesWithoutOverhang(n,[He])}else In.getState().setRoofSegmentVerticesWithoutOverhang(n,Fe)},se=zU(n,new ue(de.x,de.y,j),ve,q,Zo.Hip);DU(Ae);const ge=H(Fe=>Fe.elements.filter(He=>He.parentId===n&&He.type===z.Window),Qy),we=H(z0),Se=dt(vs),Me=H(Df),Ce=In(O1),[Te,Re]=g.useState(null),[Ne,_e]=g.useState([]);g.useEffect(()=>{if(Se)if(C>0){const Fe=ve.length;if(Fe>0){const He=[];for(let Le=0;Le0&&e){const Ye=new cn(0,0,e.rotation[2],"ZYX");let lt=Number.MAX_VALUE,Oe=Number.MAX_VALUE,ut=-Number.MAX_VALUE,ht=-Number.MAX_VALUE;for(const Ve of Le)for(const je of Ve){const et=je.clone().applyEuler(Ye);et.x>ut&&(ut=et.x),et.xht&&(ht=et.y),et.y{HU(Fe,e.id,n,ve,ce)},onPointerMove:Fe=>{IU(Fe,n)},onPointerUp:Fe=>{MU(Fe,t)},onContextMenu:Fe=>{HH(Fe,n)},children:q?h.jsx(nte,{id:n,foundationModel:e,roofType:x,roofSegments:ve,center:new ue(de.x,de.y,j),thickness:p,lineWidth:w,lineColor:y,sideColor:f,color:qe,textureType:u,heatmap:Te}):h.jsxs(h.Fragment,{children:[ve.map((Fe,He,Le)=>h.jsx(IQ,{id:n,index:He,foundationModel:e,roofType:x,segment:Fe,centroid:ce,thickness:p,color:qe,sideColor:f,texture:T,heatmap:Ne&&He0&&ze&&h.jsx(tU,{cz:b[0].lz,points:ze}),R&&!m&&h.jsxs("group",{position:[0,0,p+.15],children:[h.jsx(mh,{position:[he.x,he.y,he.z],onPointerDown:()=>{if(oe.current=!0,D(!0),mw.set(he.x,he.y,j),e&&b[0]){const Fe=H.getState().cameraDirection,He=Math.atan2(Fe.z,Fe.y),Le=b[0].relativeAngle;yw.set(-$t-He,0,Le,"ZXY")}N(Ur.Left),jn.getState().setEnableOrbitController(!1)}}),h.jsx(mh,{position:[ce.x,ce.y,ce.z],onPointerDown:Fe=>{if(we(t.id,Fe,er.Select),oe.current=!0,ee.current=C,D(!0),mw.set(ce.x,ce.y,j),e){const He=-Math.atan2(_.position.x-r,_.position.y-i)-e.rotation[2];yw.set(-$t,0,He,"ZXY")}N(Ur.Mid),jn.getState().setEnableOrbitController(!1),S(He=>{He.resizeHandleType=xt.Top,He.selectedElementHeight=j+t.thickness})},onPointerOver:()=>{S(Fe=>{Fe.hoveredHandle=Ur.Mid,Fe.selectedElementHeight=j+t.thickness,Fe.selectedElementX=de.x,Fe.selectedElementY=de.y})}}),h.jsx(mh,{position:[me.x,me.y,me.z],onPointerDown:()=>{if(oe.current=!0,D(!0),mw.set(me.x,me.y,j),e&&b[0]){const Fe=H.getState().cameraDirection,He=Math.atan2(Fe.z,Fe.y),Le=b[0].relativeAngle;yw.set(-$t-He,0,Le,"ZXY")}N(Ur.Right),jn.getState().setEnableOrbitController(!1)}})]}),M&&h.jsx(yi,{name:"Roof Intersection Plane",ref:Y,args:[1e3,100],visible:!1,position:mw,rotation:yw,onPointerMove:Fe=>{if(Y.current&&oe.current){te(Fe);const He=G.intersectObjects([Y.current]);if(He[0]&&e){const Le=He[0].point;if(Le.z<.001)return;const Ye=b[0],lt=new ue().subVectors(Ye.rightPoint,Ye.leftPoint).length();switch(k){case Ur.Left:{const Oe=ce.clone().sub(mw).applyEuler(new cn(0,0,-yw.z)),ut=Le.clone().sub(new ue(e.cx,e.cy,e.cz)).applyEuler(new cn(0,0,-e.rotation[2])).sub(mw).applyEuler(new cn(0,0,-yw.z)),ht=new ue().subVectors(ut,Oe).x;W(ye.clamp(-ht,-F+.1,lt/2-.01));break}case Ur.Right:{const Oe=ce.clone().sub(mw).applyEuler(new cn(0,0,-yw.z)),ut=Le.clone().sub(new ue(e.cx,e.cy,e.cz)).applyEuler(new cn(0,0,-e.rotation[2])).sub(mw).applyEuler(new cn(0,0,-yw.z)),ht=new ue().subVectors(ut,Oe).x;E(ye.clamp(ht,-U+.1,lt/2-.01));break}case Ur.Mid:{const Oe=Math.max(0,Le.z-e.lz-.3-L);H.getState().updateRoofRiseById(n,Oe,j+t.thickness);break}}}}},onPointerUp:()=>{switch(k){case Ur.Mid:{RU(n,ee.current,C);break}case Ur.Left:case Ur.Right:ae(n,U,F),Z(n,s,c,U,F)}oe.current=!1,D(!1),N(Ur.Null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})})]})},Can=xe.memo(Pan,fI),Sse=new ue,Tse=new cn,Ran=new ue(0,0,1),Han=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{const r=g.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[1]),[t[0].points[0]]),[t]),i=g.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[6].clone()),[t[0].points[7].clone()]),[t]),a=g.useMemo(()=>h.jsx(On,{points:r,lineWidth:n,color:o}),[r,n,o]);if(t.length<2)return null;const l=Math.abs(t[0].points[0].z-t[0].points[3].z)<.1;return h.jsxs(h.Fragment,{children:[!l&&h.jsx(On,{points:i,lineWidth:n,color:o}),a,h.jsx("group",{position:[0,0,e],children:a}),t.map((s,c)=>h.jsxs(xe.Fragment,{children:[!l&&h.jsx(On,{points:[s.points[7],s.points[4]],lineWidth:n,color:o}),h.jsx(On,{points:[s.points[4],s.points[0]],lineWidth:n,color:o})]},c))]})}),Man=({roofModel:t,foundationModel:e})=>{let{id:n,wallsId:o,cx:r,cy:i,lz:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineColor:f="black",lineWidth:p=.2,roofType:m,foundationId:y,ridgeWidth:w=1,rise:x=a,ceiling:C=!1,frontRidge:P,backRidge:A}=t;const S=hI(l),v=Fc(n);[f,p]=Rn.getWireframeStyle(f,p,v,d);const b=H(pn),T=H(Jp),R=H(xs),M=H(yt=>yt.ray),D=H(yt=>yt.mouse),[k,N]=g.useState(w),[U,W]=g.useState(null),[F,E]=g.useState(!1),[L,j]=g.useState(Ur.Null),[Y,O]=g.useState(null),_=g.useRef(k),G=g.useRef(x),Q=g.useRef(null),oe=g.useRef(!1),{gl:ee,camera:q}=ti(),ae=x<.01,Z=yt=>{const at=[],Et=yt.length;for(const Lt of yt)Lt.leftPoint[0]!==void 0&&Lt.leftPoint[1]!==void 0&&at.push({x:Lt.leftPoint[0],y:Lt.leftPoint[1]});return me.current||(yt[Et-1].rightPoint[0]||yt[Et-1].rightPoint[0]===0)&&(yt[Et-1].rightPoint[1]||yt[Et-1].rightPoint[1]===0)&&at.push({x:yt[Et-1].rightPoint[0],y:yt[Et-1].rightPoint[1]}),at},ne=yt=>{if(yt{D.x=yt.offsetX/ee.domElement.clientWidth*2-1,D.y=-(yt.offsetY/ee.domElement.clientHeight)*2+1,M.setFromCamera(D,q)},$=(yt,at)=>{b(Et=>{for(const Lt of Et.elements)if(Lt.id===yt&&Lt.type===z.Roof&&Lt.roofType===Zo.Mansard){Lt.ridgeWidth=at;break}})},le=()=>{let yt=1/0;for(let at=0;at{const Je={name:"Resize Mansard Roof Ridge",timestamp:Date.now(),resizedElementId:yt,resizedElementType:z.Roof,oldVal:Et,newVal:Lt,type:at,undo:()=>{$(Je.resizedElementId,Je.oldVal)},redo:()=>{$(Je.resizedElementId,Je.newVal)}};H.getState().addUndoable(Je)},{currentWallArray:he,isLoopRef:me}=Iot(y,n,o),{highestWallHeight:ce,topZ:Pe}=zot(he,x);EU(t,ce);const pe=g.useMemo(()=>{if(he.length<2)return new ue;const yt=Z(he),at=ye.calculatePolygonCentroid(yt);return Number.isNaN(at.x)||Number.isNaN(at.y)?new ue:new ue(at.x,at.y,Pe)},[he,Pe]),Ie=g.useMemo(()=>{const yt=he.map(at=>Rn.getWallNormal(at).multiplyScalar(at.eavesLength??0));if(!me.current&&yt.length!==0){const at=new ue().subVectors(new ue(he[he.length-1].rightPoint[0],he[he.length-1].rightPoint[1]),new ue(he[0].leftPoint[0],he[0].leftPoint[1])).applyEuler(kX).normalize().multiplyScalar(.3);yt.push(at)}return yt},[he]),ve=g.useMemo(()=>{const yt=he.map((at,Et)=>({leftPoint:new ue(at.leftPoint[0],at.leftPoint[1]).add(Ie[Et]),rightPoint:new ue(at.rightPoint[0],at.rightPoint[1]).add(Ie[Et])}));return!me.current&&yt.length!==0&&yt.push({leftPoint:new ue(he[he.length-1].rightPoint[0],he[he.length-1].rightPoint[1]).add(Ie[Ie.length-1]),rightPoint:new ue(he[0].leftPoint[0],he[0].leftPoint[1]).add(Ie[Ie.length-1])}),yt},[he,Ie]),ze=g.useMemo(()=>{const yt=he.map((at,Et)=>{const Lt=new ue(at.leftPoint[0],at.leftPoint[1]),Je=new ue(at.rightPoint[0],at.rightPoint[1]),st=new ue().subVectors(pe,Lt).setZ(0).normalize().multiplyScalar(k),It=new ue().subVectors(pe,Je).setZ(0).normalize().multiplyScalar(k);return Lt.add(st).setZ(Pe),Je.add(It).setZ(Pe),{leftPoint:Lt,rightPoint:Je}});return!me.current&&yt.length!==0&&yt.push({leftPoint:yt[yt.length-1].rightPoint,rightPoint:yt[0].leftPoint}),yt},[he,pe,k]),Ae=g.useMemo(()=>Ran.clone().multiplyScalar(u),[u]),se=g.useMemo(()=>{const yt=[];if(he.length<2)return yt;const at=le();for(let Et=0;Et0&&Lt.rightPoint.length>0&&(Lt.leftPoint[0]!==Lt.rightPoint[0]||Lt.leftPoint[1]!==Lt.rightPoint[1])){const Je=[];let{lh:st,rh:It}=Rn.getWallHeight(he,Et);me.current||(Et===0&&(st=he[0].lz),Et===he.length-1&&(It=he[he.length-1].lz));const ot=Rn.getIntersectionPoint(ve[(Et+ve.length-1)%ve.length].leftPoint,ve[(Et+ve.length-1)%ve.length].rightPoint,ve[Et].leftPoint,ve[Et].rightPoint).setZ(st-at).sub(pe),it=Rn.getIntersectionPoint(ve[Et].leftPoint,ve[Et].rightPoint,ve[(Et+1)%ve.length].leftPoint,ve[(Et+1)%ve.length].rightPoint).setZ(It-at).sub(pe),Be=ze[Et].leftPoint.clone().sub(pe),pt=ze[Et].rightPoint.clone().sub(pe),ct=new ue(Lt.cx,Lt.cy).sub(pe.clone().setZ(0)).length();Je.push(ot,it,pt,Be),Je.push(ot.clone().add(Ae),it.clone().add(Ae),pt.clone().add(Ae),Be.clone().add(Ae)),yt.push({points:Je,angle:-Lt.relativeAngle,length:ct})}}if(!me.current){const Et=ve.length-1,Lt=Rn.getIntersectionPoint(ve[Et-1].leftPoint,ve[Et-1].rightPoint,ve[Et].leftPoint,ve[Et].rightPoint).setZ(he[he.length-1].lz-at).sub(pe),Je=Rn.getIntersectionPoint(ve[Et].leftPoint,ve[Et].rightPoint,ve[0].leftPoint,ve[0].rightPoint).setZ(he[0].lz-at).sub(pe),st=ze[Et].leftPoint.clone().sub(pe),It=ze[Et].rightPoint.clone().sub(pe);let ot=Math.atan2(Je.y-Lt.y,Je.x-Lt.x);ot=ot>=0?ot:(fa+ot)%fa;const it=new ue().addVectors(Lt,Je).setZ(0).divideScalar(2).length(),Be=[];Be.push(Lt,Je,It,st),Be.push(Lt.clone().add(Ae),Je.clone().add(Ae),It.clone().add(Ae),st.clone().add(Ae)),yt.push({points:Be,angle:-ot,length:it})}return yt},[he,Pe,k,u]),ge=g.useMemo(()=>{const yt=new jl;if(ze.length>0){const at=ze[0].leftPoint.clone().sub(pe);yt.moveTo(at.x,at.y);for(const Et of ze){const Lt=Et.rightPoint.clone().sub(pe);yt.lineTo(Lt.x,Lt.y)}yt.closePath()}return yt},[he,ze]),we=g.useMemo(()=>{const yt=[];if(he.length===0)return yt;yt.push(new ue().fromArray(he[0].leftPoint));for(const at of he)yt.push(new ue().fromArray(at.rightPoint));return yt},[he]);g.useEffect(()=>{w!==k&&N(w)},[w]),g.useEffect(()=>{if(he.length>1){if(H.getState().addedRoofIdSet.has(n)){for(let yt=0;yt{for(const Et of at.elements)if(Et.id===he[yt].id&&Et.type===z.Wall){const Lt=Et;Lt.roofId=n,Lt.leftRoofHeight=void 0,Lt.rightRoofHeight=void 0;break}});H.getState().deleteAddedRoofId(n)}}else T(n,!1,!1,!0)},[he]),N3e(e,n,se,pe,Pe,u),g.useEffect(()=>{(P!==void 0||A!==void 0)&&b(yt=>{for(const at of yt.elements)if(at.type===z.Wall){const Et=at;Et.roofId===n&&(Et.centerLeftRoofHeight=void 0,Et.centerRightRoofHeight=void 0)}else at.type===z.Roof&&at.roofType===Zo.Mansard&&at.id===n&&(at.frontRidge=void 0,at.backRidge=void 0)})},[]);const Se=()=>{const yt=[];for(let Et=0;Et0&&Lt.rightPoint.length>0&&(Lt.leftPoint[0]!==Lt.rightPoint[0]||Lt.leftPoint[1]!==Lt.rightPoint[1])){let{lh:Je,rh:st}=Rn.getWallHeight(he,Et);me.current||(Et===0&&(Je=he[0].lz),Et===he.length-1&&(st=he[he.length-1].lz));const It=new ue(Lt.leftPoint[0],Lt.leftPoint[1],Je),ot=new ue(Lt.rightPoint[0],Lt.rightPoint[1],st),it=ze[Et].leftPoint.clone(),Be=ze[Et].rightPoint.clone();yt.push([It,ot,Be,it])}}if(!me.current){const Et=he.length-1,Lt=he[0],Je=he[Et],st=new ue(Je.rightPoint[0],Je.rightPoint[1],Je.lz),It=new ue(Lt.leftPoint[0],Lt.leftPoint[1],Lt.lz),ot=ze[Et].leftPoint.clone(),it=ze[Et].rightPoint.clone();yt.push([st,It,it,ot])}const at=ze.map(Et=>Et.leftPoint.clone());if(yt.push(at),ae){const Et=[];for(const Lt of yt.slice(0,-1))Et.push(Lt[0].clone());In.getState().setRoofSegmentVerticesWithoutOverhang(n,[Et])}else In.getState().setRoofSegmentVerticesWithoutOverhang(n,yt)},Me=zU(n,pe,se,ae,Zo.Mansard,ze.map(yt=>yt.leftPoint.clone().add(Ae)));DU(Se);const Ce=H.getState().world,Te=H(z0),Re=dt(vs),Ne=H(Df),_e=In(O1),[Ue,qe]=g.useState([]),[Fe,He]=g.useState(null),[Le,Ye]=g.useState(!1),lt=dt(n6),Oe=H(Y5),ut=H(J3),ht=H(K3),Qe=In(UN),nt=In.getState().hourlyHeatExchangeArrayMap,mt=g.useRef(null),tt=g.useRef(0),gt=g.useRef(),Ve=g.useRef(),{transparent:je,opacity:et}=pI();g.useEffect(()=>{if(Re)if(ae){const yt=_e(n);if(yt){const at=ye.fetchHeatmapTexture(yt,Ne??5);if(at){const Et=Me();if(Et&&Et.length>0&&e){const Lt=new cn(0,0,e.rotation[2],"ZYX");let Je=Number.MAX_VALUE,st=Number.MAX_VALUE,It=-Number.MAX_VALUE,ot=-Number.MAX_VALUE;for(const ft of Et)for(const wt of ft){const kt=wt.clone().applyEuler(Lt);kt.x>It&&(It=kt.x),kt.xot&&(ot=kt.y),kt.y{if(mt.current){const yt=ge.extractPoints(1).shape,at=.01,Et=mt.current.geometry,Lt=yt.length-1;if(Lt===4){const Je=new Float32Array(18);Je[0]=yt[3].x,Je[1]=yt[3].y,Je[2]=at,Je[3]=yt[0].x,Je[4]=yt[0].y,Je[5]=at,Je[6]=yt[2].x,Je[7]=yt[2].y,Je[8]=at,Je[9]=yt[2].x,Je[10]=yt[2].y,Je[11]=at,Je[12]=yt[0].x,Je[13]=yt[0].y,Je[14]=at,Je[15]=yt[1].x,Je[16]=yt[1].y,Je[17]=at,Et.setAttribute("position",new Ar(Je,3)),Et.computeVertexNormals();const st=Re?1:6,It=[];It.push(0,0),It.push(st,0),It.push(0,st),It.push(0,st),It.push(st,0),It.push(st,st),Et.setAttribute("uv",new Ar(It,2))}else{const Je=mt.current.geometry,st=new Float32Array(Lt*9),It=Re?1:6,ot=[];let it=Number.MAX_VALUE,Be=Number.MAX_VALUE,pt=-Number.MAX_VALUE,ct=-Number.MAX_VALUE;for(const wt of yt)wt.x>pt?pt=wt.x:wt.xct?ct=wt.y:wt.y{if(!lt||e&&e.notBuilding)return;const yt=nt.get(n+"-"+se.length);if(!yt)return;const at=yt.reduce((Dt,fn)=>Dt+fn,0),Et=Qe(n);if(!Et||!Et[se.length])return;const Lt=Et[se.length].map(Dt=>Dt.clone().sub(pe).add(new ue(0,0,pe.z+u)));if(!Lt)return;const Je=X3*(Ce.solarRadiationHeatmapGridCellSize??.5),st=Lt[0].clone(),It=Lt[1].clone(),ot=Lt[2].clone(),it=new ue().subVectors(It,st),Be=new ue().subVectors(ot,st),pt=new ue().subVectors(ot,It),ct=it.length(),Xe=new ue().crossVectors(Be,pt).length()/ct,ft=Math.max(2,Math.floor(ct/Je)),wt=Math.max(2,Math.floor(Xe/Je));it.normalize(),Be.normalize(),pt.normalize();const kt=new ue().crossVectors(Be,pt).normalize(),Zt=it.multiplyScalar(.5*ct/ft),Ot=new ue().crossVectors(kt,it).normalize().multiplyScalar(.5*Xe/wt),on=st.clone().add(Zt).add(Ot).add(new ue(0,0,u));Zt.multiplyScalar(2),Ot.multiplyScalar(2),gt.current=kt.clone().multiplyScalar(.1);const qt=[],rn=new ue,Pn=new Array;for(const Dt of Lt)Pn.push({x:Dt.x,y:Dt.y});const fo=ye.getPolygonArea(Pn);if(fo===0)return;const to=at/fo*(Oe??Ny);tt.current=to<0?1:0,Ve.current=new cn(-Math.sign(to)*$t,0,0);for(let Dt=0;Dtyt.elements.filter(at=>at.parentId===n&&at.type===z.Window),Qy),zt=g.useMemo(()=>Yt.map(yt=>{const at=new ue(yt.lx,yt.lz,yt.ly*2),Et=new ue(yt.cx,yt.cy,yt.cz).sub(pe),Lt=new cn().fromArray([yt.rotation[0],yt.rotation[1],yt.rotation[2],"ZXY"]),Je=new os(new V3(at.x,at.y,at.z));return Je.position.copy(Et),Je.rotation.copy(Lt),Je.updateMatrix(),Je}),[Yt,pe]),Rt=l===Yr.NoTexture&&s&&s===c,Ct=R&&!je;return h.jsxs("group",{name:`Mansard Roof Group ${n}`,children:[h.jsx("group",{name:`Mansard Roof Segments Group ${n}`,position:[pe.x,pe.y,pe.z],userData:St,onPointerDown:yt=>{HU(yt,e.id,n,se,pe)},onPointerMove:yt=>{IU(yt,n)},onPointerUp:yt=>{MU(yt,t)},onContextMenu:yt=>{HH(yt,n)},children:ae?h.jsx(nte,{id:n,foundationModel:e,roofType:m,roofSegments:se,center:new ue(pe.x,pe.y,Pe),thickness:u,lineWidth:p,lineColor:f,sideColor:c,color:Pt,textureType:l,heatmap:Fe}):h.jsxs(h.Fragment,{children:[se.map((yt,at,Et)=>h.jsx(IQ,{id:n,index:at,foundationModel:e,roofType:m,segment:yt,centroid:pe,thickness:u,color:Pt,sideColor:c,texture:S,heatmap:Ue&&at0&&h.jsx(Han,{roofSegments:se,thickness:u,lineColor:f,lineWidth:p})]})}),C&&x>0&&h.jsx(tU,{points:we,cz:he[0].lz}),v&&!d&&h.jsxs("group",{position:[pe.x,pe.y,pe.z+u],children:[h.jsx(mh,{position:[0,0,.3],onPointerDown:yt=>{if(Te(t.id,yt,er.Select),oe.current=!0,G.current=x,E(!0),Sse.set(pe.x,pe.y,Pe),e){const at=-Math.atan2(q.position.x-r,q.position.y-i)-e.rotation[2];Tse.set(-$t,0,at,"ZXY")}j(Ur.Top),jn.getState().setEnableOrbitController(!1),b(at=>{at.resizeHandleType=xt.Top,at.selectedElementHeight=Pe+t.thickness})},onPointerOver:()=>{b(yt=>{yt.hoveredHandle=Ur.Top,yt.selectedElementHeight=Pe+t.thickness,yt.selectedElementX=pe.x,yt.selectedElementY=pe.y})}}),ze.map((yt,at)=>{const Et=yt.leftPoint.clone().sub(pe);return h.jsx(mh,{position:[Et.x,Et.y,0],onPointerDown:()=>{oe.current=!0,E(!0),Sse.set(Et.x,Et.y,Pe+.15),Tse.set(0,0,0),j(Ur.Ridge),O(at),W(he.reduce((Lt,Je)=>Math.min(Lt,new ue(Je.leftPoint[0],Je.leftPoint[1],Pe).distanceTo(pe)-1),1/0)),jn.getState().setEnableOrbitController(!1),_.current=k}},at)})]}),F&&h.jsx(yi,{name:"Roof Intersection Plane",ref:Q,args:[1e3,100],visible:!1,position:Sse,rotation:Tse,onPointerMove:yt=>{if(Q.current&&oe.current){te(yt);const at=M.intersectObjects([Q.current]);if(at[0]&&e){const Et=at[0].point;if(Et.z<.001)return;switch(L){case Ur.Top:{const Lt=Math.max(0,Et.z-e.lz-.6-ce);H.getState().updateRoofRiseById(n,Lt,Pe+t.thickness);break}case Ur.Ridge:{if(e&&Y!==null){const Lt=Et.clone().applyEuler(new cn(0,0,e.rotation[2])).sub(new ue(e.cx,e.cy)).setZ(0),Je=ne(Y),st=Lt.distanceTo(Je),It=new ue().subVectors(pe.clone().setZ(0),Je);Lt.clone().sub(Je).angleTo(It)<$t?N(ye.clamp(st,.5,U??It.length()-1)):N(.5)}break}}}}},onPointerUp:()=>{switch(L){case Ur.Top:{RU(n,G.current,x);break}case Ur.Ridge:{de(n,L,_.current,k);break}}b(yt=>{for(const at of yt.elements)if(at.id===n&&at.type===z.Roof&&at.roofType===Zo.Mansard){at.ridgeWidth=k;break}}),oe.current=!1,E(!1),j(Ur.Null),O(null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})}),bt&&bt.map((yt,at)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:yt,name:"Heat Flux "+at,lineWidth:ht??Uy,color:ut??Fu}),";",h.jsx(Rf,{userData:{unintersectable:!0},position:gt.current?yt[tt.current].clone().add(gt.current):yt[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:Ve.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:ut??Fu})})]},at))]})},Ian=xe.memo(Man,fI);/*! + `]:Object.assign(Object.assign({},X5e(t)),{marginInlineStart:t.marginXXS})}),fin(t)),hin(t)),pin()),{"&-rtl":{direction:"rtl"}})}},min=()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"}),pnt=el("Typography",t=>[gin(t)],min),yin=t=>{const{prefixCls:e,"aria-label":n,className:o,style:r,direction:i,maxLength:a,autoSize:l=!0,value:s,onSave:c,onCancel:u,onEnd:d,component:f,enterIcon:p=g.createElement(ten,null)}=t,m=g.useRef(null),y=g.useRef(!1),w=g.useRef(null),[x,C]=g.useState(s);g.useEffect(()=>{C(s)},[s]),g.useEffect(()=>{var U;if(!((U=m.current)===null||U===void 0)&&U.resizableTextArea){const{textArea:W}=m.current.resizableTextArea;W.focus();const{length:F}=W.value;W.setSelectionRange(F,F)}},[]);const P=U=>{let{target:W}=U;C(W.value.replace(/[\n\r]/g,""))},A=()=>{y.current=!0},S=()=>{y.current=!1},v=U=>{let{keyCode:W}=U;y.current||(w.current=W)},b=()=>{c(x.trim())},T=U=>{let{keyCode:W,ctrlKey:F,altKey:E,metaKey:L,shiftKey:j}=U;w.current!==W||y.current||F||E||L||j||(W===IL.ENTER?(b(),d==null||d()):W===IL.ESC&&u())},R=()=>{b()},[M,D,k]=pnt(e),N=Mn(e,`${e}-edit-content`,{[`${e}-rtl`]:i==="rtl",[`${e}-${f}`]:!!f},o,D,k);return M(g.createElement("div",{className:N,style:r},g.createElement(Det,{ref:m,maxLength:a,value:x,onChange:P,onKeyDown:v,onKeyUp:T,onCompositionStart:A,onCompositionEnd:S,onBlur:R,"aria-label":n,rows:1,autoSize:l}),p!==null?P0(p,{className:`${e}-edit-content-confirm`}):null))};var Ain=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],o=0;o"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=vRe[e.format]||vRe.default;window.clipboardData.setData(d,t)}else u.clipboardData.clearData(),u.clipboardData.setData(e.format,t);e.onCopy&&(u.preventDefault(),e.onCopy(u.clipboardData))}),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i);var c=document.execCommand("copy");if(!c)throw new Error("copy command was unsuccessful");s=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),s=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),o=vin("message"in e?e.message:xin),window.prompt(o,t)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),r()}return s}var Sin=bin;const Tin=ji(Sin);var Pin=function(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,e||[])).next())})};const Cin=t=>{let{copyConfig:e,children:n}=t;const[o,r]=g.useState(!1),[i,a]=g.useState(!1),l=g.useRef(null),s=()=>{l.current&&clearTimeout(l.current)},c={};e.format&&(c.format=e.format),g.useEffect(()=>s,[]);const u=kd(d=>Pin(void 0,void 0,void 0,function*(){var f;d==null||d.preventDefault(),d==null||d.stopPropagation(),a(!0);try{const p=typeof e.text=="function"?yield e.text():e.text;Tin(p||XQt(n,!0).join("")||"",c),a(!1),r(!0),s(),l.current=setTimeout(()=>{r(!1)},3e3),(f=e.onCopy)===null||f===void 0||f.call(e,d)}catch(p){throw a(!1),p}}));return{copied:o,copyLoading:i,onClick:u}};function hse(t,e){return g.useMemo(()=>{const n=!!t;return[n,Object.assign(Object.assign({},e),n&&typeof t=="object"?t:null)]},[t])}const Rin=t=>{const e=g.useRef(void 0);return g.useEffect(()=>{e.current=t}),e.current},Hin=(t,e,n)=>g.useMemo(()=>t===!0?{title:e??n}:g.isValidElement(t)?{title:t}:typeof t=="object"?Object.assign({title:e??n},t):{title:t},[t,e,n]);var Min=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,component:o="article",className:r,rootClassName:i,setContentRef:a,children:l,direction:s,style:c}=t,u=Min(t,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:d,direction:f,typography:p}=g.useContext(gr),m=s??f,y=a?e2(e,a):e,w=d("typography",n),[x,C,P]=pnt(w),A=Mn(w,p==null?void 0:p.className,{[`${w}-rtl`]:m==="rtl"},r,i,C,P),S=Object.assign(Object.assign({},p==null?void 0:p.style),c);return x(g.createElement(o,Object.assign({className:A,style:S,ref:y},u),l))});function bRe(t){return t===!1?[!1,!1]:Array.isArray(t)?t:[t]}function pse(t,e,n){return t===!0||t===void 0?e:t||n&&e}function Iin(t){const e=document.createElement("em");t.appendChild(e);const n=t.getBoundingClientRect(),o=e.getBoundingClientRect();return t.removeChild(e),n.left>o.left||o.right>n.right||n.top>o.top||o.bottom>n.bottom}const C3e=t=>["string","number"].includes(typeof t),zin=t=>{let{prefixCls:e,copied:n,locale:o,iconOnly:r,tooltips:i,icon:a,tabIndex:l,onCopy:s,loading:c}=t;const u=bRe(i),d=bRe(a),{copied:f,copy:p}=o??{},m=n?f:p,y=pse(u[n?1:0],m),w=typeof y=="string"?y:m;return g.createElement(k3,{title:y},g.createElement("button",{type:"button",className:Mn(`${e}-copy`,{[`${e}-copy-success`]:n,[`${e}-copy-icon-only`]:r}),onClick:s,"aria-label":w,tabIndex:l},n?pse(d[1],g.createElement(fQe,null),!0):pse(d[0],c?g.createElement(qM,null):g.createElement(dtt,null),!0)))},o_=g.forwardRef((t,e)=>{let{style:n,children:o}=t;const r=g.useRef(null);return g.useImperativeHandle(e,()=>({isExceed:()=>{const i=r.current;return i.scrollHeight>i.clientHeight},getHeight:()=>r.current.clientHeight})),g.createElement("span",{"aria-hidden":!0,ref:r,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},n)},o)}),Din=t=>t.reduce((e,n)=>e+(C3e(n)?String(n).length:1),0);function SRe(t,e){let n=0;const o=[];for(let r=0;re){const c=e-n;return o.push(String(i).slice(0,c)),o}o.push(i),n=s}return t}const gse=0,mse=1,yse=2,Ase=3,TRe=4,r_={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function Ein(t){const{enableMeasure:e,width:n,text:o,children:r,rows:i,expanded:a,miscDeps:l,onEllipsis:s}=t,c=g.useMemo(()=>jy(o),[o]),u=g.useMemo(()=>Din(c),[o]),d=g.useMemo(()=>r(c,!1),[o]),[f,p]=g.useState(null),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),[P,A]=g.useState(!1),[S,v]=g.useState(gse),[b,T]=g.useState(0),[R,M]=g.useState(null);MA(()=>{v(e&&n&&u?mse:gse)},[n,o,i,e,c]),MA(()=>{var U,W,F,E;if(S===mse){v(yse);const L=y.current&&getComputedStyle(y.current).whiteSpace;M(L)}else if(S===yse){const L=!!(!((U=w.current)===null||U===void 0)&&U.isExceed());v(L?Ase:TRe),p(L?[0,u]:null),A(L);const j=((W=w.current)===null||W===void 0?void 0:W.getHeight())||0,Y=i===1?0:((F=x.current)===null||F===void 0?void 0:F.getHeight())||0,O=((E=C.current)===null||E===void 0?void 0:E.getHeight())||0,_=Math.max(j,Y+O);T(_+1),s(L)}},[S]);const D=f?Math.ceil((f[0]+f[1])/2):0;MA(()=>{var U;const[W,F]=f||[0,0];if(W!==F){const L=(((U=m.current)===null||U===void 0?void 0:U.getHeight())||0)>b;let j=D;F-W===1&&(j=L?W:F),p(L?[W,j]:[j,F])}},[f,D]);const k=g.useMemo(()=>{if(!e)return r(c,!1);if(S!==Ase||!f||f[0]!==f[1]){const U=r(c,!1);return[TRe,gse].includes(S)?U:g.createElement("span",{style:Object.assign(Object.assign({},r_),{WebkitLineClamp:i})},U)}return r(a?c:SRe(c,f[0]),P)},[a,S,f,c].concat(Pa(l))),N={width:n,margin:0,padding:0,whiteSpace:R==="nowrap"?"normal":"inherit"};return g.createElement(g.Fragment,null,k,S===yse&&g.createElement(g.Fragment,null,g.createElement(o_,{style:Object.assign(Object.assign(Object.assign({},N),r_),{WebkitLineClamp:i}),ref:w},d),g.createElement(o_,{style:Object.assign(Object.assign(Object.assign({},N),r_),{WebkitLineClamp:i-1}),ref:x},d),g.createElement(o_,{style:Object.assign(Object.assign(Object.assign({},N),r_),{WebkitLineClamp:1}),ref:C},r([],!0))),S===Ase&&f&&f[0]!==f[1]&&g.createElement(o_,{style:Object.assign(Object.assign({},N),{top:400}),ref:m},r(SRe(c,D),!0)),S===mse&&g.createElement("span",{style:{whiteSpace:"inherit"},ref:y}))}const kin=t=>{let{enableEllipsis:e,isEllipsis:n,children:o,tooltipProps:r}=t;return!(r!=null&&r.title)||!e?o:g.createElement(k3,Object.assign({open:n?void 0:!1},r),o)};var Fin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,className:r,style:i,type:a,disabled:l,children:s,ellipsis:c,editable:u,copyable:d,component:f,title:p}=t,m=Fin(t,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:y,direction:w}=g.useContext(gr),[x]=r6("Text"),C=g.useRef(null),P=g.useRef(null),A=y("typography",o),S=Mf(m,["mark","code","delete","underline","strong","keyboard","italic"]),[v,b]=hse(u),[T,R]=qA(!1,{value:b.editing}),{triggerType:M=["icon"]}=b,D=Fe=>{var He;Fe&&((He=b.onStart)===null||He===void 0||He.call(b)),R(Fe)},k=Rin(T);MA(()=>{var Fe;!T&&k&&((Fe=P.current)===null||Fe===void 0||Fe.focus())},[T]);const N=Fe=>{Fe==null||Fe.preventDefault(),D(!0)},U=Fe=>{var He;(He=b.onChange)===null||He===void 0||He.call(b,Fe),D(!1)},W=()=>{var Fe;(Fe=b.onCancel)===null||Fe===void 0||Fe.call(b),D(!1)},[F,E]=hse(d),{copied:L,copyLoading:j,onClick:Y}=Cin({copyConfig:E,children:s}),[O,_]=g.useState(!1),[G,Q]=g.useState(!1),[oe,ee]=g.useState(!1),[$,ae]=g.useState(!1),[Z,ne]=g.useState(!0),[te,q]=hse(c,{expandable:!1,symbol:Fe=>Fe?x==null?void 0:x.collapse:x==null?void 0:x.expand}),[le,de]=qA(q.defaultExpanded||!1,{value:q.expanded}),he=te&&(!le||q.expandable==="collapsible"),{rows:me=1}=q,ce=g.useMemo(()=>he&&(q.suffix!==void 0||q.onEllipsis||q.expandable||v||F),[he,q,v,F]);MA(()=>{te&&!ce&&(_(RTe("webkitLineClamp")),Q(RTe("textOverflow")))},[ce,te]);const[Pe,pe]=g.useState(he),Ie=g.useMemo(()=>ce?!1:me===1?G:O,[ce,G,O]);MA(()=>{pe(Ie&&he)},[Ie,he]);const ve=he&&(Pe?$:oe),ze=he&&me===1&&Pe,Ae=he&&me>1&&Pe,se=(Fe,He)=>{var Le;de(He.expanded),(Le=q.onExpand)===null||Le===void 0||Le.call(q,Fe,He)},[ge,we]=g.useState(0),Se=Fe=>{let{offsetWidth:He}=Fe;we(He)},Me=Fe=>{var He;ee(Fe),oe!==Fe&&((He=q.onEllipsis)===null||He===void 0||He.call(q,Fe))};g.useEffect(()=>{const Fe=C.current;if(te&&Pe&&Fe){const He=Iin(Fe);$!==He&&ae(He)}},[te,Pe,s,Ae,Z,ge]),g.useEffect(()=>{const Fe=C.current;if(typeof IntersectionObserver>"u"||!Fe||!Pe||!he)return;const He=new IntersectionObserver(()=>{ne(!!Fe.offsetParent)});return He.observe(Fe),()=>{He.disconnect()}},[Pe,he]);const Ce=Hin(q.tooltip,b.text,s),Te=g.useMemo(()=>{if(!(!te||Pe))return[b.text,s,p,Ce.title].find(C3e)},[te,Pe,p,Ce.title,ve]);if(T)return g.createElement(yin,{value:(n=b.text)!==null&&n!==void 0?n:typeof s=="string"?s:"",onSave:U,onCancel:W,onEnd:b.onEnd,prefixCls:A,className:r,style:i,direction:w,component:f,maxLength:b.maxLength,autoSize:b.autoSize,enterIcon:b.enterIcon});const Re=()=>{const{expandable:Fe,symbol:He}=q;return Fe?g.createElement("button",{type:"button",key:"expand",className:`${A}-${le?"collapse":"expand"}`,onClick:Le=>se(Le,{expanded:!le}),"aria-label":le?x.collapse:x==null?void 0:x.expand},typeof He=="function"?He(le):He):null},Ne=()=>{if(!v)return;const{icon:Fe,tooltip:He,tabIndex:Le}=b,Ye=jy(He)[0]||(x==null?void 0:x.edit),lt=typeof Ye=="string"?Ye:"";return M.includes("icon")?g.createElement(k3,{key:"edit",title:He===!1?"":Ye},g.createElement("button",{type:"button",ref:P,className:`${A}-edit`,onClick:N,"aria-label":lt,tabIndex:Le},Fe||g.createElement(htt,{role:"button"}))):null},_e=()=>F?g.createElement(zin,Object.assign({key:"copy"},E,{prefixCls:A,copied:L,locale:x,onCopy:Y,loading:j,iconOnly:s==null})):null,Ue=Fe=>[Fe&&Re(),Ne(),_e()],qe=Fe=>[Fe&&!le&&g.createElement("span",{"aria-hidden":!0,key:"ellipsis"},Win),q.suffix,Ue(Fe)];return g.createElement(VQ,{onResize:Se,disabled:!he},Fe=>g.createElement(kin,{tooltipProps:Ce,enableEllipsis:he,isEllipsis:ve},g.createElement(gnt,Object.assign({className:Mn({[`${A}-${a}`]:a,[`${A}-disabled`]:l,[`${A}-ellipsis`]:te,[`${A}-ellipsis-single-line`]:ze,[`${A}-ellipsis-multiple-line`]:Ae},r),prefixCls:o,style:Object.assign(Object.assign({},i),{WebkitLineClamp:Ae?me:void 0}),component:f,ref:e2(Fe,C,e),direction:w,onClick:M.includes("text")?N:void 0,"aria-label":Te==null?void 0:Te.toString(),title:p},S),g.createElement(Ein,{enableMeasure:he&&!Pe,text:s,rows:me,width:ge,onEllipsis:Me,expanded:le,miscDeps:[L,le,j,v,F,x]},(He,Le)=>Lin(t,g.createElement(g.Fragment,null,He.length>0&&Le&&!le&&Te?g.createElement("span",{key:"show-content","aria-hidden":!0},He):He,qe(Le)))))))});var Nin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n,rel:o}=t,r=Nin(t,["ellipsis","rel"]);const i=Object.assign(Object.assign({},r),{rel:o===void 0&&r.target==="_blank"?"noopener noreferrer":o});return delete i.navigate,g.createElement(Oee,Object.assign({},i,{ref:e,ellipsis:!!n,component:"a"}))}),jin=g.forwardRef((t,e)=>g.createElement(Oee,Object.assign({ref:e},t,{component:"div"})));var Bin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n}=t,o=Bin(t,["ellipsis"]);const r=g.useMemo(()=>n&&typeof n=="object"?Mf(n,["expandable","rows"]):n,[n]);return g.createElement(Oee,Object.assign({ref:e},o,{ellipsis:r,component:"span"}))},Oin=g.forwardRef(Yin);var _in=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{level:n=1}=t,o=_in(t,["level"]),r=Vin.includes(n)?`h${n}`:"h1";return g.createElement(Oee,Object.assign({ref:e},o,{component:r}))}),DA=gnt;DA.Text=Oin;DA.Link=Uin;DA.Title=Gin;DA.Paragraph=jin;const Xin=g.forwardRef((t,e)=>{const{prefixCls:n,className:o,children:r,size:i,style:a={}}=t,l=Mn(`${n}-panel`,{[`${n}-panel-hidden`]:i===0},o),s=i!==void 0;return xe.createElement("div",{ref:e,className:l,style:Object.assign(Object.assign({},a),{flexBasis:s?i:"auto",flexGrow:s?0:1})},r)}),Jin=()=>null;var Kin=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rjy(t).filter(g.isValidElement).map(n=>{const{props:o}=n,{collapsible:r}=o,i=Kin(o,["collapsible"]);return Object.assign(Object.assign({},i),{collapsible:$in(r)})}),[t])}function Qin(t,e,n){return g.useMemo(()=>{const o=[];for(let r=0;r0||m.start&&s===0&&l>0,x=m.start&&s>0||d.end&&l===0&&s>0;o[r]={resizable:y,startCollapsible:!!(n?x:w),endCollapsible:!!(n?w:x)}}return o},[e,t])}function xG(t){return Number(t.slice(0,-1))/100}function wse(t){return typeof t=="string"&&t.endsWith("%")}function Zin(t,e){const n=t.map(m=>m.size),o=t.length,r=e||0,i=m=>m*r,[a,l]=xe.useState(()=>t.map(m=>m.defaultSize)),s=xe.useMemo(()=>{var m;const y=[];for(let w=0;w{let m=[],y=0;for(let x=0;xx+(C||0),0);if(w>1||!y){const x=1/w;m=m.map(C=>C===void 0?0:C*x)}else{const x=(1-w)/y;m=m.map(C=>C===void 0?x:C)}return m},[s,r]),u=xe.useMemo(()=>c.map(i),[c,r]),d=xe.useMemo(()=>t.map(m=>wse(m.min)?xG(m.min):(m.min||0)/r),[t,r]),f=xe.useMemo(()=>t.map(m=>wse(m.max)?xG(m.max):(m.max||r)/r),[t,r]);return[xe.useMemo(()=>e?u:s,[u,e]),u,c,d,f,l]}function ean(t,e,n,o,r,i){const a=t.map(A=>[A.min,A.max]),l=o||0,s=A=>A*l;function c(A,S){return typeof A=="string"?s(xG(A)):A??S}const[u,d]=g.useState([]),f=g.useRef([]),[p,m]=g.useState(null),y=()=>n.map(s);return[A=>{d(y()),m({index:A,confirmed:!1})},(A,S)=>{var v;let b=null;if((!p||!p.confirmed)&&S!==0){if(S>0)b=A,m({index:A,confirmed:!0});else for(let F=A;F>=0;F-=1)if(u[F]>0&&e[F].resizable){b=F,m({index:F,confirmed:!0});break}}const T=(v=b??(p==null?void 0:p.index))!==null&&v!==void 0?v:A,R=Pa(u),M=T+1,D=c(a[T][0],0),k=c(a[M][0],0),N=c(a[T][1],l),U=c(a[M][1],l);let W=S;return R[T]+WN&&(W=N-R[T]),R[M]-W>U&&(W=R[M]-U),R[T]+=W,R[M]-=W,r(R),R},()=>{m(null)},(A,S)=>{const v=y(),b=i?S==="start"?"end":"start":S,T=b==="start"?A:A+1,R=b==="start"?A+1:A,M=v[T],D=v[R];if(M!==0&&D!==0)v[T]=0,v[R]+=M,f.current[A]=M;else{const k=M+D,N=c(a[T][0],0),U=c(a[T][1],l),W=c(a[R][0],0),F=c(a[R][1],l),E=Math.max(N,k-F),j=(Math.min(U,k-W)-E)/2,Y=f.current[A],O=k-Y;Y&&Y<=F&&Y>=W&&O<=U&&O>=N?(v[R]=Y,v[T]=O):(v[T]-=j,v[R]+=j)}return r(v),v},p==null?void 0:p.index]}function xse(t){return typeof t=="number"&&!Number.isNaN(t)?Math.round(t):0}const tan=t=>{const{prefixCls:e,vertical:n,index:o,active:r,ariaNow:i,ariaMin:a,ariaMax:l,resizable:s,startCollapsible:c,endCollapsible:u,onOffsetStart:d,onOffsetUpdate:f,onOffsetEnd:p,onCollapse:m,lazy:y,containerSize:w}=t,x=`${e}-bar`,[C,P]=g.useState(null),[A,S]=g.useState(0),v=n?0:A,b=n?A:0,T=F=>{s&&F.currentTarget&&(P([F.pageX,F.pageY]),d(o))},R=F=>{if(s&&F.touches.length===1){const E=F.touches[0];P([E.pageX,E.pageY]),d(o)}},M=F=>{const E=w*i/100,L=E+F,j=Math.max(0,w*a/100),Y=Math.min(w,w*l/100);return Math.max(j,Math.min(Y,L))-E},D=kd((F,E)=>{const L=M(n?E:F);S(L)}),k=kd(()=>{f(o,v,b),S(0)});xe.useEffect(()=>{if(C){const F=Y=>{const{pageX:O,pageY:_}=Y,G=O-C[0],Q=_-C[1];y?D(G,Q):f(o,G,Q)},E=()=>{y&&k(),P(null),p()},L=Y=>{if(Y.touches.length===1){const O=Y.touches[0],_=O.pageX-C[0],G=O.pageY-C[1];y?D(_,G):f(o,_,G)}},j=()=>{y&&k(),P(null),p()};return window.addEventListener("touchmove",L),window.addEventListener("touchend",j),window.addEventListener("mousemove",F),window.addEventListener("mouseup",E),()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",E),window.removeEventListener("touchmove",L),window.removeEventListener("touchend",j)}}},[C,y,n,o,w,i,a,l]);const N={[`--${x}-preview-offset`]:`${A}px`},U=n?Aet:sJ,W=n?RZ:xH;return xe.createElement("div",{className:x,role:"separator","aria-valuenow":xse(i),"aria-valuemin":xse(a),"aria-valuemax":xse(l)},y&&xe.createElement("div",{className:Mn(`${x}-preview`,{[`${x}-preview-active`]:!!A}),style:N}),xe.createElement("div",{className:Mn(`${x}-dragger`,{[`${x}-dragger-disabled`]:!s,[`${x}-dragger-active`]:r}),onMouseDown:T,onTouchStart:R}),c&&xe.createElement("div",{className:Mn(`${x}-collapse-bar`,`${x}-collapse-bar-start`),onClick:()=>m(o,"start")},xe.createElement(U,{className:Mn(`${x}-collapse-icon`,`${x}-collapse-start`)})),u&&xe.createElement("div",{className:Mn(`${x}-collapse-bar`,`${x}-collapse-bar-end`),onClick:()=>m(o,"end")},xe.createElement(W,{className:Mn(`${x}-collapse-icon`,`${x}-collapse-end`)})))},nan=t=>{const{componentCls:e}=t;return{[`&-rtl${e}-horizontal`]:{[`> ${e}-bar`]:{[`${e}-bar-collapse-previous`]:{insetInlineEnd:0,insetInlineStart:"unset"},[`${e}-bar-collapse-next`]:{insetInlineEnd:"unset",insetInlineStart:0}}},[`&-rtl${e}-vertical`]:{[`> ${e}-bar`]:{[`${e}-bar-collapse-previous`]:{insetInlineEnd:"50%",insetInlineStart:"unset"},[`${e}-bar-collapse-next`]:{insetInlineEnd:"50%",insetInlineStart:"unset"}}}}},i_={position:"absolute",top:"50%",left:{_skip_check_:!0,value:"50%"},transform:"translate(-50%, -50%)"},oan=t=>{const{componentCls:e,colorFill:n,splitBarDraggableSize:o,splitBarSize:r,splitTriggerSize:i,controlItemBgHover:a,controlItemBgActive:l,controlItemBgActiveHover:s,prefixCls:c}=t,u=`${e}-bar`,d=`${e}-mask`,f=`${e}-panel`,p=t.calc(i).div(2).equal(),m=`${c}-bar-preview-offset`,y={position:"absolute",background:t.colorPrimary,opacity:.2,pointerEvents:"none",transition:"none",zIndex:1,display:"none"};return{[e]:Object.assign(Object.assign(Object.assign({},Ua(t)),{display:"flex",width:"100%",height:"100%",alignItems:"stretch",[`> ${u}`]:{flex:"none",position:"relative",userSelect:"none",[`${u}-dragger`]:Object.assign(Object.assign({},i_),{zIndex:1,"&::before":Object.assign({content:'""',background:a},i_),"&::after":Object.assign({content:'""',background:n},i_),[`&:hover:not(${u}-dragger-active)`]:{"&::before":{background:l}},"&-active":{zIndex:2,"&::before":{background:s}},[`&-disabled${u}-dragger`]:{zIndex:0,"&, &:hover, &-active":{cursor:"default","&::before":{background:a}},"&::after":{display:"none"}}}),[`${u}-collapse-bar`]:Object.assign(Object.assign({},i_),{zIndex:t.zIndexPopupBase,background:a,fontSize:t.fontSizeSM,borderRadius:t.borderRadiusXS,color:t.colorText,cursor:"pointer",opacity:0,display:"flex",alignItems:"center",justifyContent:"center","&:hover":{background:l},"&:active":{background:s}}),"&:hover, &:active":{[`${u}-collapse-bar`]:{opacity:1}}},[d]:{position:"fixed",zIndex:t.zIndexPopupBase,inset:0,"&-horizontal":{cursor:"col-resize"},"&-vertical":{cursor:"row-resize"}},"&-horizontal":{flexDirection:"row",[`> ${u}`]:{width:0,[`${u}-preview`]:Object.assign(Object.assign({height:"100%",width:r},y),{[`&${u}-preview-active`]:{display:"block",transform:`translateX(var(--${m}))`}}),[`${u}-dragger`]:{cursor:"col-resize",height:"100%",width:i,"&::before":{height:"100%",width:r},"&::after":{height:o,width:r}},[`${u}-collapse-bar`]:{width:t.fontSizeSM,height:t.controlHeightSM,"&-start":{left:{_skip_check_:!0,value:"auto"},right:{_skip_check_:!0,value:p},transform:"translateY(-50%)"},"&-end":{left:{_skip_check_:!0,value:p},right:{_skip_check_:!0,value:"auto"},transform:"translateY(-50%)"}}}},"&-vertical":{flexDirection:"column",[`> ${u}`]:{height:0,[`${u}-preview`]:Object.assign(Object.assign({height:r,width:"100%"},y),{[`&${u}-preview-active`]:{display:"block",transform:`translateY(var(--${m}))`}}),[`${u}-dragger`]:{cursor:"row-resize",width:"100%",height:i,"&::before":{width:"100%",height:r},"&::after":{width:o,height:r}},[`${u}-collapse-bar`]:{height:t.fontSizeSM,width:t.controlHeightSM,"&-start":{top:"auto",bottom:p,transform:"translateX(-50%)"},"&-end":{top:p,bottom:"auto",transform:"translateX(-50%)"}}}},[f]:{overflow:"auto",padding:"0 1px",scrollbarWidth:"thin",boxSizing:"border-box","&-hidden":{padding:0,overflow:"hidden"},[`&:has(${e}:only-child)`]:{overflow:"hidden"}}}),nan(t))}},ran=t=>{var e;const n=t.splitBarSize||2,o=t.splitTriggerSize||6,r=t.resizeSpinnerSize||20,i=(e=t.splitBarDraggableSize)!==null&&e!==void 0?e:r;return{splitBarSize:n,splitTriggerSize:o,splitBarDraggableSize:i,resizeSpinnerSize:r}},ian=el("Splitter",t=>[oan(t)],ran),aan=t=>{const{prefixCls:e,className:n,style:o,layout:r="horizontal",children:i,rootClassName:a,onResizeStart:l,onResize:s,onResizeEnd:c,lazy:u}=t,{getPrefixCls:d,direction:f,splitter:p}=xe.useContext(gr),m=d("splitter",e),y=nu(m),[w,x,C]=ian(m,y),P=r==="vertical",A=f==="rtl",S=!P&&A,v=qin(i),[b,T]=g.useState(),R=ne=>{const{offsetWidth:te,offsetHeight:q}=ne,le=P?q:te;le!==0&&T(le)},[M,D,k,N,U,W]=Zin(v,b),F=Qin(v,D,A),[E,L,j,Y,O]=ean(v,F,k,b,W,A),_=kd(ne=>{E(ne),l==null||l(D)}),G=kd((ne,te)=>{const q=L(ne,te);s==null||s(q)}),Q=kd(()=>{j(),c==null||c(D)}),oe=kd((ne,te)=>{const q=Y(ne,te);s==null||s(q),c==null||c(q)}),ee=Mn(m,n,`${m}-${r}`,{[`${m}-rtl`]:A},a,p==null?void 0:p.className,C,y,x),$=`${m}-mask`,ae=xe.useMemo(()=>{const ne=[];let te=0;for(let q=0;q{const q=xe.createElement(Xin,Object.assign({},ne,{prefixCls:m,size:M[te]}));let le=null;const de=F[te];if(de){const he=(ae[te-1]||0)+N[te],me=(ae[te+1]||100)-U[te+1],ce=(ae[te-1]||0)+U[te],Pe=(ae[te+1]||100)-N[te+1];le=xe.createElement(tan,{lazy:u,index:te,active:O===te,prefixCls:m,vertical:P,resizable:de.resizable,ariaNow:ae[te]*100,ariaMin:Math.max(he,me)*100,ariaMax:Math.min(ce,Pe)*100,startCollapsible:de.startCollapsible,endCollapsible:de.endCollapsible,onOffsetStart:_,onOffsetUpdate:(pe,Ie,ve)=>{let ze=P?ve:Ie;S&&(ze=-ze),G(pe,ze)},onOffsetEnd:Q,onCollapse:oe,containerSize:b||0})}return xe.createElement(xe.Fragment,{key:`split-panel-${te}`},q,le)}),typeof O=="number"&&xe.createElement("div",{"aria-hidden":!0,className:Mn($,`${$}-${r}`)}))))},fv=aan;fv.Panel=Jin;const PRe="/aladdin/assets/apple_spring-Ctq5fKrS.png",ape="/aladdin/assets/apple_summer-Dr8H3cny.png",CRe="/aladdin/assets/apple_fall-Cp6pAzIj.png",RRe="/aladdin/assets/apple_winter-D03fshM0.png",HRe="/aladdin/assets/birch_spring-sKFxYorO.png",lpe="/aladdin/assets/birch_summer-FaJ43Xt4.png",MRe="/aladdin/assets/birch_fall-PIQyyY4L.png",IRe="/aladdin/assets/birch_winter-C5h1hTVJ.png",mnt="/aladdin/assets/coconut-rkhxogn3.png",zRe="/aladdin/assets/dogwood_spring-9vLsm3g2.png",spe="/aladdin/assets/dogwood_summer-DgdkRZ2O.png",DRe="/aladdin/assets/dogwood_fall-Wu983FGV.png",ERe="/aladdin/assets/dogwood_winter-4w2TO6RG.png",kRe="/aladdin/assets/elm_spring-DJcRoCq2.png",cpe="/aladdin/assets/elm_summer-VNy_g1qe.png",FRe="/aladdin/assets/elm_fall-ChdMN8fe.png",LRe="/aladdin/assets/elm_winter-Qng-eWYe.png",ynt="/aladdin/assets/fan_palm-DbCJ1Nso.png",WRe="/aladdin/assets/linden_spring-C_zkyu46.png",upe="/aladdin/assets/linden_summer-zap94GfP.png",NRe="/aladdin/assets/linden_fall-CK-BpZ7U.png",URe="/aladdin/assets/linden_winter-Dt7sgspu.png",jRe="/aladdin/assets/magnolia_spring-CNor1Lb8.png",dpe="/aladdin/assets/magnolia_summer-C7-8T4uo.png",BRe="/aladdin/assets/magnolia_fall-D3wi6n7Y.png",YRe="/aladdin/assets/magnolia_winter-116tEre9.png",ORe="/aladdin/assets/maple_spring-26OHjb4f.png",fpe="/aladdin/assets/maple_summer-BbcBLKSJ.png",_Re="/aladdin/assets/maple_fall-Bp5Vy2Jl.png",VRe="/aladdin/assets/maple_winter-BnFW631O.png",GRe="/aladdin/assets/oak_spring-CsUg07TC.png",hpe="/aladdin/assets/oak_summer-CPK7amde.png",XRe="/aladdin/assets/oak_fall-rgRz_M_t.png",JRe="/aladdin/assets/oak_winter-CD4uumS6.png",Ant="/aladdin/assets/pine-CI5zZHth.png",wnt="/aladdin/assets/spruce-CEhjo5-Q.png";class Sv{static isEvergreen(e){return e===yr.Spruce||e===yr.Pine||e===yr.FanPalm||e===yr.Coconut}static isConic(e){return e===yr.Spruce}static fetchLabel(e,n){switch(e){case yr.Apple:return B.t("tree.Apple",n);case yr.Birch:return B.t("tree.Birch",n);case yr.Coconut:return B.t("tree.Coconut",n);case yr.Dogwood:return B.t("tree.Dogwood",n);case yr.Elm:return B.t("tree.Elm",n);case yr.FanPalm:return B.t("tree.FanPalm",n);case yr.Linden:return B.t("tree.Linden",n);case yr.Magnolia:return B.t("tree.Magnolia",n);case yr.Maple:return B.t("tree.Maple",n);case yr.Oak:return B.t("tree.Oak",n);case yr.Spruce:return B.t("tree.Spruce",n);default:return B.t("tree.Pine",n)}}static fetchTheta(e){switch(e){case yr.Apple:return .65*Math.PI;case yr.Birch:return .72*Math.PI;case yr.Coconut:return .5*Math.PI;case yr.Dogwood:return .65*Math.PI;case yr.Elm:return .78*Math.PI;case yr.FanPalm:return .52*Math.PI;case yr.Linden:return .75*Math.PI;case yr.Magnolia:return .68*Math.PI;case yr.Maple:return .65*Math.PI;case yr.Oak:return .75*Math.PI;case yr.Spruce:return Math.PI;default:return Math.PI*.5}}static fetchTextureImage(e,n,o,r,i){let a;const l=r+30,s=i-30,c=o>0;switch(e){case yr.Apple:n>=i||n<=r?a=c?RRe:ape:n>r&&n<=l?a=c?PRe:CRe:n>l&&n<=s?a=c?ape:RRe:a=c?CRe:PRe;break;case yr.Birch:n>=i||n<=r?a=c?IRe:lpe:n>r&&n<=l?a=c?HRe:MRe:n>l&&n<=s?a=c?lpe:IRe:a=c?MRe:HRe;break;case yr.Coconut:a=mnt;break;case yr.Dogwood:n>=i||n<=r?a=c?ERe:spe:n>r&&n<=l?a=c?zRe:DRe:n>l&&n<=s?a=c?spe:ERe:a=c?DRe:zRe;break;case yr.Elm:n>=i||n<=r?a=c?LRe:cpe:n>r&&n<=l?a=c?kRe:FRe:n>l&&n<=s?a=c?cpe:LRe:a=c?FRe:kRe;break;case yr.FanPalm:a=ynt;break;case yr.Linden:n>=i||n<=r?a=c?URe:upe:n>r&&n<=l?a=c?WRe:NRe:n>l&&n<=s?a=c?upe:URe:a=c?NRe:WRe;break;case yr.Magnolia:n>=i||n<=r?a=c?YRe:dpe:n>r&&n<=l?a=c?jRe:BRe:n>l&&n<=s?a=c?dpe:YRe:a=c?BRe:jRe;break;case yr.Maple:n>=i||n<=r?a=c?VRe:fpe:n>r&&n<=l?a=c?ORe:_Re:n>l&&n<=s?a=c?fpe:VRe:a=c?_Re:ORe;break;case yr.Oak:n>=i||n<=r?a=c?JRe:hpe:n>r&&n<=l?a=c?GRe:XRe:n>l&&n<=s?a=c?hpe:JRe:a=c?XRe:GRe;break;case yr.Spruce:a=wnt;break;default:a=Ant}return a}}const Fc=t=>H(e=>e.selectedElementIdSet.has(t)&&!e.groupActionMode),Kt=()=>{const t=H(Au);return g.useMemo(()=>({lng:t}),[t])},_1=t=>H.getState().getWeather(t??"Boston MA, USA"),lan=()=>{const t=H(Qn),e=H(RS),n=Kt(),{t:o}=Jl(),r=s=>[{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"x : "}),h.jsx(mn,{value:s.cx,precision:2})]}),key:s.id+" x"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"y : "}),h.jsx(mn,{value:s.cy,precision:2})]}),key:s.id+" y"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"z : "}),h.jsx(mn,{value:s.cz,precision:2})]}),key:s.id+" z"}],i=s=>[{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"Lx : "}),h.jsx(mn,{value:s.lx,precision:2})]}),key:s.id+" lx"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"Ly : "}),h.jsx(mn,{value:s.ly,precision:2})]}),key:s.id+" ly"},{checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"Lz : "}),h.jsx(mn,{value:s.lz,precision:2})]}),key:s.id+" lz"}],a=(s,c)=>h.jsx(k3,{placement:"right",title:"ID: "+s,color:"white",styles:{body:{color:"gray",fontSize:"12px"}},children:h.jsx("span",{children:c})}),l=s=>{switch(s.type){case z.Human:return o("modelTree.Human",n);case z.Flower:return o("modelTree.Flower",n);case z.Tree:return o("modelTree.Tree",n);case z.Foundation:return o("modelTree.Foundation",n);case z.Wall:return o("modelTree.Wall",n);case z.Roof:return o("modelTree.Roof",n);case z.Window:return o("modelTree.Window",n);case z.Door:return o("modelTree.Door",n);case z.SolarWaterHeater:return o("modelTree.SolarWaterHeater",n);case z.Sensor:return o("modelTree.Sensor",n);case z.Light:return o("modelTree.Light",n);case z.SolarPanel:return o("modelTree.GroundMountedSolarPanels",n)}return"Unknown"};return g.useMemo(()=>{const s=[];for(const c of t)if(c.type===z.Foundation){const u=e(c.id),d=[];for(const p of u){const m=[];if(m.push(...r(p)),p.type===z.Tree){const y=p,w=y.name;m.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",w," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:Sv.fetchTextureImage(w,180,42,90,300)})]}),key:p.id+" Type"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("treeMenu.Spread",n)," : "]}),h.jsx(mn,{value:y.lx,precision:2})]}),key:p.id+" Spread"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Height",n)," : "]}),h.jsx(mn,{value:y.lz,precision:2})]}),key:p.id+" Height"})}else if(p.type===z.Flower){const y=p.name;m.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",y," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:i3.fetchTextureImage(y,!1)})]}),key:p.id+" Type"})}else if(p.type===z.Human){const y=p.name;m.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Name",n)," : ",y," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:hh.fetchTextureImage(y)})]}),key:p.id+" Name"})}else if(p.type===z.SolarPanel)m.push(...i(p)),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("pvModelPanel.Model",n)," : "]}),h.jsx("span",{children:p.pvModelName})]}),key:p.id+" Model"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("solarPanelMenu.Orientation",n)," : "]}),h.jsx("span",{children:p.orientation})]}),key:p.id+" Orientation"});else if(p.type===z.Wall){m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.RValue",n)," : "]}),h.jsx(mn,{value:p.rValue??U9,precision:2})]}),key:p.id+" R-value"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.VolumetricHeatCapacity",n)," : "]}),h.jsx(mn,{value:p.volumetricHeatCapacity??.5,precision:2})]}),key:p.id+" Heat Capacity"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Thickness",n)," : "]}),h.jsx(mn,{value:p.ly,precision:2})]}),key:p.id+" Thickness"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Height",n)," : "]}),h.jsx(mn,{value:p.lz,precision:2})]}),key:p.id+" Height"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("wallMenu.EavesLength",n)," : "]}),h.jsx(mn,{value:p.eavesLength,precision:2})]}),key:p.id+" Overhang"});const y=e(p.id);for(const w of y)switch(w.type){case z.Window:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.UValue",n)," : "]}),h.jsx(mn,{value:w.uValue??X9,precision:2})]}),key:w.id+" U-value"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"SHGC : "}),h.jsx(mn,{value:1-w.opacity,precision:2})]}),key:w.id+" shgc"}),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.Door:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.UValue",n)," : "]}),h.jsx(mn,{value:w.uValue??fA,precision:2})]}),key:w.id+" U-value"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.VolumetricHeatCapacity",n)," : "]}),h.jsx(mn,{value:w.volumetricHeatCapacity??.5,precision:2})]}),key:w.id+" Heat Capacity"}),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.SolarPanel:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("pvModelPanel.Model",n)," : "]}),h.jsx("span",{children:w.pvModelName})]}),key:w.id+" Model"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("solarPanelMenu.Orientation",n)," : "]}),h.jsx("span",{children:w.orientation})]}),key:w.id+" Orientation"}),m.push({checkable:!0,title:a(w.id,o("modelTree.WallMountedSolarPanels",n)+(w.label?" ("+w.label+")":"")),key:w.id,children:x});break}case z.Sensor:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.Light:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}}}else if(p.type===z.Roof){m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.RValue",n)," : "]}),h.jsx(mn,{value:p.rValue??pA,precision:2})]}),key:p.id+" R-value"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.VolumetricHeatCapacity",n)," : "]}),h.jsx(mn,{value:p.volumetricHeatCapacity??.5,precision:2})]}),key:p.id+" Heat Capacity"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Thickness",n)," : "]}),h.jsx(mn,{value:p.thickness,precision:2})]}),key:p.id+" Thickness"}),m.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("roofMenu.Rise",n)," : "]}),h.jsx(mn,{value:p.rise,precision:2})]}),key:p.id+" Rise"});const y=e(p.id);for(const w of y)switch(w.type){case z.Window:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.UValue",n)," : "]}),h.jsx(mn,{value:w.uValue??X9,precision:2})]}),key:w.id+" U-value"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsx("span",{children:"SHGC : "}),h.jsx(mn,{value:1-w.opacity,precision:2})]}),key:w.id+" shgc"}),m.push({checkable:!0,title:a(w.id,o("modelTree.SkylightWindow",n)),key:w.id,children:x});break}case z.SolarPanel:{const x=[];x.push(...r(w)),x.push(...i(w)),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("pvModelPanel.Model",n)," : "]}),h.jsx("span",{children:w.pvModelName})]}),key:w.id+" Model"}),x.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("solarPanelMenu.Orientation",n)," : "]}),h.jsx("span",{children:w.orientation})]}),key:w.id+" Orientation"}),m.push({checkable:!0,title:a(w.id,o("modelTree.RooftopSolarPanels",n)+(w.label?" ("+w.label+")":"")),key:w.id,children:x});break}case z.SolarWaterHeater:{const x=[];x.push(...r(w)),x.push(...i(w)),m.push({checkable:!0,title:a(w.id,l(w)+(w.label?" ("+w.label+")":"")),key:w.id,children:x});break}case z.Sensor:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}case z.Light:{const x=[];x.push(...r(w)),m.push({checkable:!0,title:a(w.id,l(w)),key:w.id,children:x});break}}}d.push({title:a(p.id,l(p)+(p.label?" ("+p.label+")":"")),key:p.id,children:m})}const f=c;d.push(...r(f)),d.push(...i(f)),s.push({title:a(f.id,(f.notBuilding?l(f):o("word.Building",n))+(f.label?" ("+f.label+")":"")),key:f.id,children:d})}else if(c.parentId===rr){const u=[];switch(c.type){case z.Tree:{const d=c,f=d.name;u.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",f," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:Sv.fetchTextureImage(f,180,42,90,300)})]}),key:c.id+" Type"}),u.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("treeMenu.Spread",n)," : "]}),h.jsx(mn,{value:d.lx,precision:2})]}),key:c.id+" Spread"}),u.push({checkable:!1,title:h.jsxs(Jt,{children:[h.jsxs("span",{children:[o("word.Height",n)," : "]}),h.jsx(mn,{value:d.lz,precision:2})]}),key:c.id+" Height"});break}case z.Flower:{const d=c.name;u.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Type",n)," : ",d," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:i3.fetchTextureImage(d,!1)})]}),key:c.id+" Type"});break}case z.Human:{const d=c.name;u.push({checkable:!1,title:h.jsxs("span",{children:[o("word.Name",n)," : ",d," ",h.jsx(dv,{style:{paddingLeft:"6px"},height:"16px",src:hh.fetchTextureImage(d)})]}),key:c.id+" Name"});break}}u.push(...r(c)),s.push({title:a(c.id,l(c)+(c.label?" ("+c.label+")":"")),key:c.id,children:u})}return s},[t,n])},KRe=new ue,$Re=new cn,a_=new ue,san=new ue(0,0,1),can=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e);for(let l=0;l{const[c,u,d]=l.points,f=Math.abs(c.z)<.015,p=[c.clone().sub(i),c];return f||p.push(d),h.jsx(On,{points:p,lineWidth:n,color:o},s)})]})]})}),uan=({roofModel:t,foundationModel:e})=>{let{cx:n,cy:o,lz:r,id:i,wallsId:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineWidth:f=.2,lineColor:p="black",roofType:m,foundationId:y,rise:w=r,ceiling:x=!1}=t;const C=hI(l),P=Fc(i);[p,f]=Rn.getWireframeStyle(p,f,P,d);const A=H(pn),S=H(Jp),{camera:v,gl:b}=ti(),T=g.useMemo(()=>new yu,[]),R=g.useMemo(()=>new _t,[]),[M,D]=g.useState(!1),k=g.useRef(null),N=g.useRef(!1),U=g.useRef(w),W=new Set(a),F=Ce=>{R.x=Ce.offsetX/b.domElement.clientWidth*2-1,R.y=-(Ce.offsetY/b.domElement.clientHeight)*2+1,T.setFromCamera(R,v)},E=Ce=>{const Te=[],Re=Ce.length;for(const Ne of Ce)Ne.leftPoint[0]!==void 0&&Ne.leftPoint[1]!==void 0&&Te.push({x:Ne.leftPoint[0],y:Ne.leftPoint[1]});return O.current||(Ce[Re-1].rightPoint[0]||Ce[Re-1].rightPoint[0]===0)&&(Ce[Re-1].rightPoint[1]||Ce[Re-1].rightPoint[1]===0)&&Te.push({x:Ce[Re-1].rightPoint[0],y:Ce[Re-1].rightPoint[1]}),Te},L=(Ce,Te)=>{if(Ce.length!==Te.size)return!0;for(const Re of Ce)if(!Te.has(Re.id))return!0;return!1},j=()=>{let Ce=1/0;for(let Te=0;Te{if(Y.length<2)return{x:0,y:0};const Ce=E(Y);if(Ce.length<3)return{x:0,y:0};const Te=ye.calculatePolygonCentroid(Ce);return Number.isNaN(Te.x)||Number.isNaN(Te.y)?{x:0,y:0}:Te},[Y,G]),oe=g.useMemo(()=>new ue(Q.x,Q.y,G),[Q,G]),ee=g.useMemo(()=>{const Ce=Y.map(Te=>Rn.getWallNormal(Te).multiplyScalar(Te.eavesLength??0));if(!O.current&&Ce.length!==0){const Te=new ue().subVectors(new ue(Y[Y.length-1].rightPoint[0],Y[Y.length-1].rightPoint[1]),new ue(Y[0].leftPoint[0],Y[0].leftPoint[1])).applyEuler(kX).normalize().multiplyScalar(.3);Ce.push(Te)}return Ce},[Y]),$=g.useMemo(()=>{const Ce=Y.map((Te,Re)=>({leftPoint:new ue(Te.leftPoint[0],Te.leftPoint[1]).add(ee[Re]),rightPoint:new ue(Te.rightPoint[0],Te.rightPoint[1]).add(ee[Re])}));return!O.current&&Ce.length!==0&&Ce.push({leftPoint:new ue(Y[Y.length-1].rightPoint[0],Y[Y.length-1].rightPoint[1]).add(ee[ee.length-1]),rightPoint:new ue(Y[0].leftPoint[0],Y[0].leftPoint[1]).add(ee[ee.length-1])}),Ce},[Y,ee]),ae=g.useMemo(()=>san.clone().multiplyScalar(u),[u]),Z=g.useMemo(()=>{const Ce=[];if(Y.length<2)return Ce;const Te=j();for(let Re=0;Re0&&Ne.rightPoint.length>0&&(Ne.leftPoint[0]!==Ne.rightPoint[0]||Ne.leftPoint[1]!==Ne.rightPoint[1])){const _e=[];let{lh:Ue,rh:qe}=Rn.getWallHeight(Y,Re);O.current||(Re===0&&(Ue=Y[0].lz),Re===Y.length-1&&(qe=Y[Y.length-1].lz));const Fe=Rn.getIntersectionPoint($[(Re+$.length-1)%$.length].leftPoint,$[(Re+$.length-1)%$.length].rightPoint,$[Re].leftPoint,$[Re].rightPoint).setZ(Ue-Te).sub(oe),He=Rn.getIntersectionPoint($[Re].leftPoint,$[Re].rightPoint,$[(Re+1)%$.length].leftPoint,$[(Re+1)%$.length].rightPoint).setZ(qe-Te).sub(oe),Le=new ue(Ne.cx,Ne.cy).sub(oe.clone().setZ(0)).length();_e.push(Fe,He,a_),_e.push(Fe.clone().add(ae),He.clone().add(ae),a_.clone().add(ae)),Ce.push({points:_e,angle:-Ne.relativeAngle,length:Le})}}if(!O.current){const Re=$.length-1,Ne=Rn.getIntersectionPoint($[Re-1].leftPoint,$[Re-1].rightPoint,$[Re].leftPoint,$[Re].rightPoint).setZ(Y[Y.length-1].lz-Te).sub(oe),_e=Rn.getIntersectionPoint($[Re].leftPoint,$[Re].rightPoint,$[0].leftPoint,$[0].rightPoint).setZ(Y[0].lz-Te).sub(oe);let Ue=Math.atan2(_e.y-Ne.y,_e.x-Ne.x);Ue=Ue>=0?Ue:(fa+Ue)%fa;const qe=new ue().addVectors(Ne,_e).setZ(0).divideScalar(2).length(),Fe=[];Fe.push(Ne,_e,a_),Fe.push(Ne.clone().add(ae),_e.clone().add(ae),a_.clone().add(ae)),Ce.push({points:Fe,angle:-Ue,length:qe})}return Ce},[Y,Q,u]),ne=g.useMemo(()=>{const Ce=[];if(Y.length===0)return Ce;Ce.push(new ue().fromArray(Y[0].leftPoint));for(const Te of Y)Ce.push(new ue().fromArray(Te.rightPoint));return Ce},[Y]);let te=0;if(e){n=e.cx,o=e.cy,te=e.rotation[2];const Ce=-Math.atan2(v.position.x-n,v.position.y-o)-te;KRe.set(Q.x,Q.y,G),$Re.set(-$t,0,Ce,"ZXY")}const q=tte();g.useEffect(()=>{if(q)return;if(H.getState().addedRoofIdSet.has(i)&&Y.length>=2&&L(Y,W)){const Te=Y.map(Ne=>Ne.id),Re=new Set(Te);A(Ne=>{for(const _e of Ne.elements)if(_e.type===z.Roof)_e.id===i&&(_e.wallsId=Te);else if(_e.type===z.Wall&&W.has(_e.id)&&!Re.has(_e.id)){const Ue=_e;Ue.roofId=null,Ue.leftRoofHeight=void 0,Ue.rightRoofHeight=void 0}}),H.getState().deleteAddedRoofId(i)}},[W]),g.useEffect(()=>{if(Y.length>1){if(H.getState().addedRoofIdSet.has(i)){for(let Te=0;Te{for(const Ne of Re.elements)if(Ne.id===Y[Te].id&&Ne.type===z.Wall){const _e=Ne;_e.roofId=i,_e.leftRoofHeight=void 0,_e.rightRoofHeight=void 0;break}});H.getState().deleteAddedRoofId(i)}}else S(i,!1,!1,!0)},[Y]),N3e(e,i,Z,oe,G,u);const le=()=>{if(Y.length<2)return!1;const Ce=Y[0].lz;for(const Te of Y)if(Math.abs(Te.lz-Ce)>.01)return!1;for(const Te of Z){const[Re,Ne]=Te.points;if(Math.abs(Re.z)>.01||Math.abs(Ne.z)>.01)return!1}return!0},[de,he]=g.useState(le);g.useEffect(()=>{he(le())},[Y,G]);const me=dt(vs),ce=H(Df),Pe=In(O1),[pe,Ie]=g.useState([]),[ve,ze]=g.useState(null),Ae=H(z0),se=zU(i,oe,Z,de,Zo.Pyramid);g.useEffect(()=>{if(me)if(de){const Ce=Pe(i);if(Ce){const Te=ye.fetchHeatmapTexture(Ce,ce??5);if(Te){const Re=se();if(Re&&Re.length>0&&e){const Ne=new cn(0,0,e.rotation[2],"ZYX");let _e=Number.MAX_VALUE,Ue=Number.MAX_VALUE,qe=-Number.MAX_VALUE,Fe=-Number.MAX_VALUE;for(const ut of Re)for(const ht of ut){const Qe=ht.clone().applyEuler(Ne);Qe.x>qe&&(qe=Qe.x),Qe.x<_e&&(_e=Qe.x),Qe.y>Fe&&(Fe=Qe.y),Qe.y0){const Te=[];if(se()){for(let Ne=0;Ne{const Ce=[];for(let Te=0;Te0&&Re.rightPoint.length>0&&(Re.leftPoint[0]!==Re.rightPoint[0]||Re.leftPoint[1]!==Re.rightPoint[1])){let{lh:Ne,rh:_e}=Rn.getWallHeight(Y,Te);O.current||(Te===0&&(Ne=Y[0].lz),Te===Y.length-1&&(_e=Y[Y.length-1].lz));const Ue=new ue(Re.leftPoint[0],Re.leftPoint[1],Ne),qe=new ue(Re.rightPoint[0],Re.rightPoint[1],_e);Ce.push([Ue,qe,oe.clone()])}}if(!O.current){const Te=Y[0],Re=Y[Y.length-1],Ne=new ue(Re.rightPoint[0],Re.rightPoint[1],Re.lz),_e=new ue(Te.leftPoint[0],Te.leftPoint[1],Te.lz);Ce.push([Ne,_e,oe.clone()])}if(de){const Te=[];for(const Re of Ce)Te.push(Re[0].clone());In.getState().setRoofSegmentVerticesWithoutOverhang(i,[Te])}else In.getState().setRoofSegmentVerticesWithoutOverhang(i,Ce)});const we=H(Ce=>Ce.elements.filter(Te=>Te.parentId===i&&Te.type===z.Window),Qy),Se=kU(i,e,oe,Z),Me=l===Yr.Default||l===Yr.NoTexture?s:"white";return h.jsxs("group",{name:`Pyramid Roof Group ${i}`,children:[h.jsx("group",{name:`Pyramid Roof Segments Group ${i}`,userData:Se,position:[Q.x,Q.y,G],onPointerDown:Ce=>{HU(Ce,e.id,i,Z,oe)},onPointerMove:Ce=>{IU(Ce,i)},onPointerUp:Ce=>{MU(Ce,t)},onContextMenu:Ce=>{HH(Ce,i)},children:de?h.jsx(nte,{id:i,foundationModel:e,roofType:m,roofSegments:Z,center:oe,thickness:u,lineWidth:f,lineColor:p,sideColor:c,color:Me,textureType:l,heatmap:ve}):h.jsxs(h.Fragment,{children:[Z.map((Ce,Te)=>{const{points:Re}=Ce;if(Re.length>0){const[Ne,_e]=Re;if(Ne.distanceTo(_e)>.1)return h.jsx("group",{name:`Roof segment ${Te}`,children:h.jsx(IQ,{id:i,index:Te,foundationModel:e,roofType:m,segment:Ce,centroid:oe,thickness:u,color:Me,sideColor:c,texture:C,heatmap:pe&&Te0&&h.jsx(tU,{points:ne,cz:Y[0].lz}),P&&!d&&h.jsx(mh,{position:[Q.x,Q.y,G+u+.15],onPointerDown:Ce=>{Ae(t.id,Ce,er.Select),D(!0),jn.getState().setEnableOrbitController(!1),N.current=!0,U.current=w,A(Te=>{Te.resizeHandleType=xt.Top,Te.selectedElementHeight=G+t.thickness})},onPointerUp:()=>{D(!1),jn.getState().setEnableOrbitController(!0)},onPointerOver:()=>{A(Ce=>{Ce.hoveredHandle=Ur.Top,Ce.selectedElementHeight=G+t.thickness,Ce.selectedElementX=Q.x,Ce.selectedElementY=Q.y})}}),M&&h.jsx(yi,{name:"Roof Intersection Plane",ref:k,args:[1e3,100],visible:!1,rotation:$Re,position:KRe,onPointerMove:Ce=>{if(k.current&&N.current&&e){F(Ce);const Te=T.intersectObjects([k.current]);if(Te[0]){const Re=Te[0].point;if(Re.z<.001)return;const Ne=Math.max(0,Re.z-e.lz-.3-_);H.getState().updateRoofRiseById(i,Ne,G+t.thickness)}}},onPointerUp:Ce=>{RU(i,U.current,w),D(!1),jn.getState().setEnableOrbitController(!0),N.current=!1}})]})},dan=xe.memo(uan,fI),fan=(t,e,n)=>{const{left:o,right:r,center:i,centerLeft:a,centerRight:l}=n,[s,c]=[t/2,e/2],u=[{x:-s,y:o-c},{x:-s,y:-c},{x:s,y:-c},{x:s,y:r-c}];if(l){const[d,f]=l;u.push({x:d*t,y:f-c})}if(i){const[d,f]=i;u.push({x:d*t,y:f-c})}if(a){const[d,f]=a;u.push({x:d*t,y:f-c})}return u},O9=(t,e)=>{for(const n of H.getState().elements)if(n.type===z.Wall&&n.foundationId===e&&t.has(n.id)){const o=t.get(n.id);if(o){const r=n,i=fan(r.lx,r.lz,o);for(const a of H.getState().elements)if(a.parentId===r.id){let{cx:l,cz:s,lx:c,ly:u,lz:d}=a;if(l*=r.lx,s*=r.lz,a.type!==z.SolarPanel?(c*=r.lx,d*=r.lz):d=u,a.type===z.Window&&a.windowType===Ti.Polygonal){const[f,p]=a.polygonTop??P1,m=l+f*c,y=s+d/2+p;if(!ye.isPointInside(m,y,i))return!1}if(!ye.isElementInsideWall(new ue(l,0,s),c,d,i,a.type===z.Door))return!1}}}return!0},han=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e),a=t[0].points,l=t[1].points,s=t[2].points,c=t[3].points;r.push(l[3],l[0],a[0],a[1],a[2],l[2],s[0],c[0],c[1],s[1],l[3]);const u=Math.abs(a[0].z)<.15,d=h.jsx(On,{points:r,lineWidth:n,color:o}),f=h.jsxs(h.Fragment,{children:[h.jsx(On,{points:[l[0],l[1]],lineWidth:n,color:o}),h.jsx(On,{points:[l[2],l[3]],lineWidth:n,color:o}),h.jsx(On,{points:[s[2],s[3]],lineWidth:n,color:o})]});return h.jsxs(h.Fragment,{children:[d,!u&&f,h.jsxs("group",{position:[0,0,e],children:[d,!u&&f]}),h.jsx(On,{points:[a[0],a[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[a[1],a[1].clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[c[0],c[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[c[1],c[1].clone().add(i)],lineWidth:n,color:o})]})}),vse=new ue,bse=new cn,qRe=new _t,pan=new ue(0,0,1),gan=({roofModel:t,foundationModel:e})=>{let{id:n,cx:o,cy:r,lz:i,wallsId:a,parentId:l,topRidgeLeftPoint:s,frontRidgeLeftPoint:c,backRidgeLeftPoint:u,topRidgePoint:d,frontRidgePoint:f,backRidgePoint:p,textureType:m,color:y="white",sideColor:w="white",thickness:x=.2,locked:C,lineColor:P="black",lineWidth:A=.2,roofType:S,rise:v=i,ceiling:b=!1}=t;d===void 0&&(d=s?[...s]:[0,1]),f===void 0&&(f=c?[...c]:[.35,.5]),p===void 0&&(p=u?[...u]:[.35,.5]);const T=Fc(n);[P,A]=Rn.getWireframeStyle(P,A,T,C);const R=H(pn),M=H(Jp),D=hI(m),[k,N]=g.useState(Ur.Null),[U,W]=g.useState(!1),F=g.useRef(null),{gl:E,camera:L}=ti(),j=g.useMemo(()=>new yu,[]),Y=g.useMemo(()=>new _t,[]),O=g.useRef([0,0]),_=g.useRef(v),G=g.useRef(!1),Q=v<.01,oe=(Ve,je,et)=>{R(bt=>{for(const St of bt.elements)if(St.id===Ve&&St.type===z.Roof&&St.roofType===Zo.Gambrel){const Pt=St;switch(je){case Ur.FrontLeft:case Ur.FrontRight:Pt.frontRidgePoint=[...et];break;case Ur.TopLeft:case Ur.TopRight:Pt.topRidgePoint=[...et];break;case Ur.BackLeft:case Ur.BackRight:Pt.backRidgePoint=[...et];break}break}})},ee=(Ve,je,et,bt)=>{const St={name:"Resize Gambrel Roof Ridge",timestamp:Date.now(),resizedElementId:Ve,resizedElementType:z.Roof,oldVal:[...et],newVal:[...bt],type:je,undo:()=>{oe(St.resizedElementId,St.type,St.oldVal)},redo:()=>{oe(St.resizedElementId,St.type,St.newVal)}};H.getState().addUndoable(St)},$=Ve=>{Y.x=Ve.offsetX/E.domElement.clientWidth*2-1,Y.y=-(Ve.offsetY/E.domElement.clientHeight)*2+1,j.setFromCamera(Y,L)},ae=(Ve,je)=>{W(!0),jn.getState().setEnableOrbitController(!1),vse.set(Ve.x,Ve.y,Ve.z).add(Ae),e&&je&&bse.set($t,0,je.relativeAngle,"ZXY")},Z=(Ve,je,et)=>{const bt=new _t(Ve.cx,Ve.cy),St=Rn.getComposedWallCenter(je),Pt=Rn.getComposedWallLength(je),Yt=new _t(St.x,St.y).rotateAround(qRe,Ve.rotation[2]).add(bt),zt=Ve.rotation[2]+je.relativeAngle,Ct=new _t(et.x,et.y).sub(Yt).rotateAround(qRe,-zt).x/Pt;return Math.min(Math.abs(Ct),.5)*(Ct>=0?1:-1)},ne=(Ve,je,et,bt)=>{if(!Ve)return new ue;const St=Rn.getComposedWallLength(Ve),Pt=new cn(0,0,Ve.relativeAngle),Yt=new ue(je*St,0,0);let zt=ze;bt&&(zt=et*(ze-bt.lz)+bt.lz);const Rt=Rn.getComposedWallCenter(Ve);return new ue(Rt.x,Rt.y,zt).add(Yt.applyEuler(Pt))},te=(Ve,je)=>{const et=Ve[je];let bt,St;return je===0||je===2?(bt=et.lz,St=et.lz):je===1?(bt=Ve[0].lz,St=Ve[2].lz):(bt=Ve[2].lz,St=Ve[0].lz),{lh:bt,rh:St}},q=Ve=>Ve.id===n&&Ve.type===z.Roof&&Ve.roofType===Zo.Gambrel,le=(Ve,je)=>{const et=je.x-Ve.x,St=(je.y-Ve.y)/et,Pt=Ve.y-St*Ve.x;return{start:Ve.x,end:je.x,k:St,b:Pt}},de=(Ve,je,et,bt,St,Pt,Yt,zt)=>{const Rt=Ve[je],{lh:Ct,rh:yt}=te(Ve,je),at=new ue().subVectors(Rt.leftPoint,Rt.rightPoint).length(),Et=at/2,Lt=ot=>ot*at+Et,Je=(ot,it)=>ot*(et-it)+it,st=[new _t(Lt(-Pt[0]),Je(Pt[1],bt)),new _t(Lt(Yt[0]),et),new _t(Lt(zt[0]),Je(zt[1],St)),new _t(at,yt)];return st.map((ot,it)=>{const Be=it===0?new _t(0,Ct):st[it-1];return le(Be,ot)})},he=(Ve,je)=>{for(const et of Ve){const{start:bt,end:St,k:Pt,b:Yt}=et;if(je>=bt&&je<=St)return Pt*je+Yt}return null},me=Ve=>{const je=new Set;for(const et of Ve)et.wallsId.forEach(bt=>je.add(bt));R(et=>{for(const bt of et.elements)if(bt.type===z.Wall&&bt.foundationId===l&&je.has(bt.id)){const St=bt;St.leftRoofHeight=ze,St.rightRoofHeight=ze,St.centerLeftRoofHeight=void 0,St.centerRightRoofHeight=void 0,St.centerRoofHeight=void 0}})},ce=(Ve,je,et,bt,St,Pt,Yt)=>{if(et!==1&&et!==3)return;const zt=et===3,{lh:Rt,rh:Ct}=te(je,et),yt=zt?Yt:St,at=zt?St:Yt,Et=zt?Pt:[-Pt[0],Pt[1]],Lt=de(je,et,bt,Rt,Ct,yt,Et,at),Je=Lt.slice(1).map(ot=>ot.start),st=je[et],It=st.wallsId.reduce((ot,it)=>{const Be=H.getState().elements.find(pt=>pt.id===it);return Be?[...ot,Be.lx+ot[ot.length-1]]:ot},[0]);for(let ot=0;ot=Be&&Ot<=pt){const on=(Ot-wt)/ft,qt=he(Lt,Ot);qt!==null&&(Zt===0?kt.centerLeft=[on,qt]:Zt===1?kt.center=[on,qt]:Zt===2&&(kt.centerRight=[on,qt]))}}Ve.set(it,kt)}}return Ve},Pe=(Ve,je,et,bt,St)=>{const Pt=new Map;return ce(Pt,Ve,1,je,et,bt,St),ce(Pt,Ve,3,je,et,bt,St),Pt},pe=(Ve,je,et,bt,St)=>{const Pt=new Set(Ve[0].wallsId),Yt=new Set(Ve[2].wallsId),zt=Pe(Ve,je,et,bt,St);R(Rt=>{for(const Ct of Rt.elements)if(Ct.type===z.Wall&&Ct.foundationId===l){if(Pt.has(Ct.id)){const yt=Ct,{lh:at,rh:Et}=te(Ve,0);yt.roofId=n,yt.leftRoofHeight=at,yt.rightRoofHeight=Et}else if(Yt.has(Ct.id)){const yt=Ct,{lh:at,rh:Et}=te(Ve,2);yt.roofId=n,yt.leftRoofHeight=at,yt.rightRoofHeight=Et}else if(zt.has(Ct.id)){const yt=zt.get(Ct.id);if(yt){const at=Ct,{left:Et,right:Lt,center:Je,centerLeft:st,centerRight:It}=yt;if(at.roofId=n,at.leftRoofHeight=Et,at.rightRoofHeight=Lt,st){const[ot,it]=st;at.centerLeftRoofHeight?(at.centerLeftRoofHeight[0]=ot,at.centerLeftRoofHeight[1]=it):at.centerLeftRoofHeight=[ot,it]}else at.centerLeftRoofHeight=void 0;if(Je){const[ot,it]=Je;at.centerRoofHeight?(at.centerRoofHeight[0]=ot,at.centerRoofHeight[1]=it):at.centerRoofHeight=[ot,it]}else at.centerRoofHeight=void 0;if(It){const[ot,it]=It;at.centerRightRoofHeight?(at.centerRightRoofHeight[0]=ot,at.centerRightRoofHeight[1]=it):at.centerRightRoofHeight=[ot,it]}else at.centerRightRoofHeight=void 0}}}})},Ie=F3e(a[0],l),{highestWallHeight:ve,topZ:ze}=L3e(Ie,v,!0);EU(t,ve);const Ae=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie.map(et=>({x:et.leftPoint.x,y:et.leftPoint.y})),je=ye.calculatePolygonCentroid(Ve);return new ue(je.x,je.y,ze)},[Ie,ze]),se=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[3],[je,et]=d;return ne(Ve,je,et).sub(Ae)},[Ie,Ae,d]),ge=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[1],[je,et]=d;return ne(Ve,-je,et).sub(Ae)},[Ie,Ae,d]),we=g.useMemo(()=>new ue().addVectors(se,ge).divideScalar(2),[se,ge]),Se=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[3],[je,et]=f;return ne(Ve,je,et,Ie[0]).sub(Ae)},[Ie,Ae,f]),Me=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[1],[je,et]=f;return ne(Ve,-je,et,Ie[0]).sub(Ae)},[Ie,Ae,f]),Ce=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[1],[je,et]=p;return ne(Ve,je,et,Ie[2]).sub(Ae)},[Ie,Ae,p]),Te=g.useMemo(()=>{if(!Ie||Ie.length!==4)return new ue;const Ve=Ie[3],[je,et]=p;return ne(Ve,-je,et,Ie[2]).sub(Ae)},[Ie,Ae,p]),Re=g.useMemo(()=>!Ie||Ie.length!==4?[]:Ie.map(Ve=>Rn.getComposedWallNormal(Ve).multiplyScalar(Ve.eavesLength)),[Ie]),Ne=g.useMemo(()=>pan.clone().multiplyScalar(x),[x]),_e=g.useMemo(()=>{const Ve=[];if(!Ie||Ie.length!==4)return Ve;const[je,et,bt,St]=Ie,[Pt,Yt,zt,Rt]=Re,Ct=je.leftPoint,yt=je.rightPoint,at=bt.leftPoint,Et=bt.rightPoint,Lt=Ct.clone().add(Pt),Je=yt.clone().add(Pt),st=Et.clone().add(Rt),It=Ct.clone().add(Rt),ot=yt.clone().add(Yt),it=at.clone().add(Yt),Be=at.clone().add(zt),pt=Et.clone().add(zt),ct=[],{lh:Xe,rh:ft}=te(Ie,0),wt=Rn.getDistance(Ct,yt,Se.clone().add(Ae)),kt=Math.min((je.eavesLength??0)/wt*(Se.clone().add(Ae).z-Xe),Xe),Zt=Rn.getDistance(Ct,yt,Me.clone().add(Ae)),Ot=Math.min((je.eavesLength??0)/Zt*(Me.clone().add(Ae).z-ft),ft),on=Rn.getIntersectionPoint(st,It,Lt,Je).setZ(Xe-kt).sub(Ae),qt=Rn.getIntersectionPoint(Lt,Je,ot,it).setZ(ft-Ot).sub(Ae),rn=Rn.getIntersectionPoint(Se,Me,st.clone().sub(Ae),It.clone().sub(Ae)).setZ(Se.z),Pn=Rn.getIntersectionPoint(Me,Se,ot.clone().sub(Ae),it.clone().sub(Ae)).setZ(Me.z);ct.push(on,qt,Pn,rn),ct.push(on.clone().add(Ne),qt.clone().add(Ne),Pn.clone().add(Ne),rn.clone().add(Ne));const fo=Rn.getComposedWallCenter(je),to=-je.relativeAngle,Dt=new ue(fo.x,fo.y).sub(we.clone().setZ(0)).length();Ve.push({points:ct,angle:to,length:Dt});const fn=[],kn=Rn.getIntersectionPoint(se,ge,st.clone().sub(Ae),It.clone().sub(Ae)).setZ(se.z),yo=Rn.getIntersectionPoint(se,ge,ot.clone().sub(Ae),it.clone().sub(Ae)).setZ(ge.z);fn.push(rn,Pn,yo,kn),fn.push(rn.clone().add(Ne),Pn.clone().add(Ne),yo.clone().add(Ne),kn.clone().add(Ne)),Ve.push({points:fn,angle:to,length:Dt});const ur=-bt.relativeAngle,{lh:lr,rh:xo}=te(Ie,2),wo=Rn.getDistance(at,Et,Ce.clone().add(Ae)),Rr=Math.min((bt.eavesLength??0)/wo*(Ce.clone().add(Ae).z-lr),lr),Eo=Rn.getDistance(at,Et,Te.clone().add(Ae)),An=Math.min((bt.eavesLength??0)/Eo*(Te.clone().add(Ae).z-xo),xo),Dn=Rn.getIntersectionPoint(ot,it,Be,pt).setZ(lr-Rr).sub(Ae),sr=Rn.getIntersectionPoint(Be,pt,st,It).setZ(xo-An).sub(Ae),Vo=Rn.getIntersectionPoint(Ce,Te,ot.clone().sub(Ae),it.clone().sub(Ae)).setZ(Te.z),Wo=Rn.getIntersectionPoint(Te,Ce,st.clone().sub(Ae),It.clone().sub(Ae)).setZ(Te.z),To=Rn.getComposedWallCenter(bt),Go=new ue(To.x,To.y).sub(we.clone().setZ(0)).length(),No=[];No.push(Vo,Wo,kn,yo),No.push(Vo.clone().add(Ne),Wo.clone().add(Ne),kn.clone().add(Ne),yo.clone().add(Ne)),Ve.push({points:No,angle:ur,length:Go});const ho=[];return ho.push(Dn,sr,Wo,Vo),ho.push(Dn.clone().add(Ne),sr.clone().add(Ne),Wo.clone().add(Ne),Vo.clone().add(Ne)),Ve.push({points:ho,angle:ur,length:Go}),Ve},[Ie,ze,x,d,f,p]),Ue=g.useMemo(()=>!Ie||Ie.length!==4?null:Ie.map(Ve=>Ve.leftPoint),[Ie]);g.useEffect(()=>{(!Ie||Ie.length!==4)&&M(n,!1,!1,!0)},[Ie]);const qe=tte();g.useEffect(()=>{if((Ie==null?void 0:Ie.length)!==4)return;(H.getState().addedRoofIdSet.has(n)||!qe)&&(Q?me(Ie):pe(Ie,ze,f,d,p),ete(e,n,_e,Ae,ze,x,Q),H.getState().deleteAddedRoofId(n))},[_e]),W3e(e,n,_e,Ae,ze,x,Q);const Fe=()=>{const Ve=[];if(!Ie||Ie.length!==4)return Ve;const je=Ie.map((Rt,Ct,yt)=>new ue(Rt.leftPoint.x,Rt.leftPoint.y,te(yt,Ct).lh)),et=Se.clone().add(Ae),bt=Me.clone().add(Ae),St=Ce.clone().add(Ae),Pt=Te.clone().add(Ae),Yt=se.clone().add(Ae),zt=ge.clone().add(Ae);Ve.push([je[0],je[1],bt,et]),Ve.push([et,bt,zt,Yt]),Ve.push([Yt,zt,St,Pt]),Ve.push([je[2],je[3],Pt,St]),Q?In.getState().setRoofSegmentVerticesWithoutOverhang(n,[je]):In.getState().setRoofSegmentVerticesWithoutOverhang(n,Ve)},He=zU(n,Ae,_e,Q,Zo.Gambrel);DU(Fe);const Le=H(Ve=>Ve.elements.filter(je=>je.parentId===n&&je.type===z.Window),Qy),Ye=H(z0),lt=dt(vs),Oe=H(Df),ut=In(O1),[ht,Qe]=g.useState(null),[nt,mt]=g.useState([]);g.useEffect(()=>{if(lt)if(Q){const Ve=ut(n);if(Ve){const je=ye.fetchHeatmapTexture(Ve,Oe??5);if(je){const et=He();if(et&&et.length>0&&e){const bt=new cn(0,0,e.rotation[2],"ZYX");let St=Number.MAX_VALUE,Pt=Number.MAX_VALUE,Yt=-Number.MAX_VALUE,zt=-Number.MAX_VALUE;for(const Lt of et)for(const Je of Lt){const st=Je.clone().applyEuler(bt);st.x>Yt&&(Yt=st.x),st.xzt&&(zt=st.y),st.y0){const je=[];for(let et=0;et{HU(Ve,e.id,n,_e,Ae)},onPointerMove:Ve=>{IU(Ve,n)},onPointerUp:Ve=>{MU(Ve,t)},onContextMenu:Ve=>{HH(Ve,n)},children:Q?h.jsx(nte,{id:n,foundationModel:e,roofType:S,roofSegments:_e,center:new ue(Ae.x,Ae.y,ze),thickness:x,lineWidth:A,lineColor:P,sideColor:w,color:gt,textureType:m,heatmap:ht}):h.jsxs(h.Fragment,{children:[_e.map((Ve,je,et)=>h.jsx(IQ,{id:n,index:je,foundationModel:e,roofType:S,segment:Ve,centroid:Ae,thickness:x,color:gt,sideColor:w,texture:D,heatmap:nt&&je0&&Ie[0].lz===Ie[2].lz&&Ue&&h.jsx(tU,{cz:Ie[0].lz,points:Ue}),T&&!C&&h.jsxs("group",{position:[Ae.x,Ae.y,Ae.z+x],children:[h.jsx(mh,{position:[we.x,we.y,we.z],onPointerDown:Ve=>{if(Ye(t.id,Ve,er.Select),G.current=!0,_.current=v,W(!0),vse.set(we.x,we.y,ze).add(Ae),e){const je=-Math.atan2(L.position.x-o,L.position.y-r)-e.rotation[2];bse.set(-$t,0,je,"ZXY")}N(Ur.TopMid),jn.getState().setEnableOrbitController(!1),R(je=>{je.resizeHandleType=xt.Top,je.selectedElementHeight=ze+t.thickness})},onPointerOver:()=>{R(Ve=>{Ve.hoveredHandle=Ur.TopMid,Ve.selectedElementHeight=ze+t.thickness,Ve.selectedElementX=we.x,Ve.selectedElementY=we.y})}}),!Q&&h.jsxs(h.Fragment,{children:[h.jsx(mh,{position:[se.x,se.y,se.z],onPointerDown:()=>{G.current=!0,O.current=[...d],ae(se,Ie[3]),N(Ur.TopLeft)}}),h.jsx(mh,{position:[ge.x,ge.y,ge.z],onPointerDown:()=>{G.current=!0,O.current=[...d],ae(ge,Ie[1]),N(Ur.TopRight)}}),h.jsx(mh,{position:[Se.x,Se.y,Se.z],onPointerDown:()=>{G.current=!0,O.current=[...f],ae(Se,Ie[3]),N(Ur.FrontLeft)}}),h.jsx(mh,{position:[Me.x,Me.y,Me.z],onPointerDown:()=>{G.current=!0,O.current=[...f],ae(Me,Ie[1]),N(Ur.FrontRight)}}),h.jsx(mh,{position:[Ce.x,Ce.y,Ce.z],onPointerDown:()=>{G.current=!0,O.current=[...p],ae(Ce,Ie[1]),N(Ur.BackLeft)}}),h.jsx(mh,{position:[Te.x,Te.y,Te.z],onPointerDown:()=>{G.current=!0,O.current=[...p],ae(Te,Ie[3]),N(Ur.BackRight)}})]})]}),U&&h.jsx(yi,{name:"Roof Intersection Plane",ref:F,args:[1e3,100],visible:!1,position:vse,rotation:bse,onPointerMove:Ve=>{if(F.current&&G.current&&Ie&&Ie.length===4){$(Ve);const je=j.intersectObjects([F.current]);if(je[0]&&e){const et=je[0].point;if(et.z<.001)return;switch(k){case Ur.TopMid:{const bt=Math.max(0,et.z-e.lz-.3-ve),St=ve+bt,Pt=Pe(Ie,St,f,d,p);O9(Pt,l)&&H.getState().updateRoofRiseById(n,bt,St+t.thickness);break}case Ur.FrontLeft:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[3],et),d[0]+.05,.45),St=ze-Ie[0].lz,Pt=ye.clamp((et.z-e.lz-Ie[0].lz)/St,0,1),Yt=[bt,Pt],zt=Pe(Ie,ze,Yt,d,p);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>q(yt));Ct&&(Ct.frontRidgePoint[0]=Yt[0],Ct.frontRidgePoint[1]=Yt[1])})}break}case Ur.FrontRight:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[1],et),-.45,-d[0]-.05),St=ze-Ie[0].lz,Pt=ye.clamp((et.z-e.lz-Ie[0].lz)/St,0,1),Yt=[-bt,Pt],zt=Pe(Ie,ze,Yt,d,p);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>q(yt));Ct&&(Ct.frontRidgePoint=[...Yt])})}break}case Ur.TopLeft:{if(e&&Ie&&Ie.length===4){const St=[ye.clamp(Z(e,Ie[3],et),-p[0]+.05,f[0]-.05),d[1]],Pt=Pe(Ie,ze,f,St,p);O9(Pt,l)&&R(Yt=>{const zt=Yt.elements.find(Rt=>q(Rt));zt&&(zt.topRidgePoint=[...St])})}break}case Ur.TopRight:{if(e&&Ie&&Ie.length===4){const St=[-ye.clamp(Z(e,Ie[1],et),-f[0]+.05,p[0]-.05),d[1]],Pt=Pe(Ie,ze,f,St,p);O9(Pt,l)&&R(Yt=>{const zt=Yt.elements.find(Rt=>q(Rt));zt&&(zt.topRidgePoint=[...St])})}break}case Ur.BackLeft:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[1],et),-d[0]+.05,.45),St=ze-Ie[2].lz,Pt=ye.clamp((et.z-e.lz-Ie[2].lz)/St,0,1),Yt=[bt,Pt],zt=Pe(Ie,ze,f,d,Yt);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>q(yt));Ct&&(Ct.backRidgePoint=[...Yt])})}break}case Ur.BackRight:{if(e&&Ie&&Ie.length===4){const bt=ye.clamp(Z(e,Ie[3],et),-.45,d[0]-.05),St=ze-Ie[2].lz,Pt=ye.clamp((et.z-e.lz-Ie[2].lz)/St,0,1),Yt=[-bt,Pt],zt=Pe(Ie,ze,f,d,Yt);O9(zt,l)&&R(Rt=>{const Ct=Rt.elements.find(yt=>q(yt));Ct&&(Ct.backRidgePoint=[...Yt])})}break}}}}},onPointerUp:()=>{switch(k){case Ur.TopMid:{RU(n,_.current,v);break}case Ur.TopLeft:case Ur.TopRight:{ee(n,k,O.current,d);break}case Ur.FrontLeft:case Ur.FrontRight:{ee(n,k,O.current,f);break}case Ur.BackLeft:case Ur.BackRight:{ee(n,k,O.current,p);break}}G.current=!1,W(!1),N(Ur.Null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})})]})},man=xe.memo(gan,fI),l_=new ue,s_=new cn,QRe=new _t,yan=new ue(0,0,1),oE=xe.memo(({start:t,end:e,width:n,height:o,offset:r,color:i})=>{const a=g.useMemo(()=>new _t(t.x,t.y),[t]),l=g.useMemo(()=>new _t(e.x,e.y),[e]),s=g.useMemo(()=>new _t().subVectors(l,a).angle(),[a,l]),c=g.useMemo(()=>{const u=new jl,d=a.distanceTo(l),f=t.z-e.z;return u.moveTo(0,0),u.lineTo(d,-f),u.lineTo(d,-f+o),u.lineTo(0,o),u.closePath(),u},[t,e,a,l,o]);return h.jsx("group",{position:r,children:h.jsx(Q8,{args:[c,{steps:1,depth:n,bevelEnabled:!1}],position:t,rotation:[$t,0,s,"ZXY"],castShadow:!0,receiveShadow:!0,children:h.jsx("meshStandardMaterial",{color:i})})})}),Aan=({ridgeLeftPoint:t,ridgeRightPoint:e,wallArray:n,height:o,isShed:r,width:i,spacing:a,color:l})=>{const[s,c,u,d]=n,f=g.useMemo(()=>new ue().subVectors(e,t).normalize(),[]),p=g.useMemo(()=>t.clone().add(f.clone().multiplyScalar(-(d.eavesLength??0)/2)),[t,d.eavesLength]),m=g.useMemo(()=>e.clone().add(f.clone().multiplyScalar((c.eavesLength??0)/2)),[t,c.eavesLength]),y=s.leftPoint.clone().setZ(s.lz),w=u.rightPoint.clone().setZ(u.lz),x=g.useMemo(()=>{if(n.length<4)return[];const S=new ue().subVectors(new ue(s.rightPoint.x,s.rightPoint.y,s.lz),y).normalize(),v=new ue().subVectors(new ue(u.leftPoint.x,u.leftPoint.y,u.lz),w).normalize(),b=t.distanceTo(e),T=new ue().subVectors(s.leftPoint,s.rightPoint).length(),R=new ue().subVectors(u.leftPoint,u.rightPoint).length(),M=i,D=Math.floor((Math.min(b,T,R)-i)/a)+2;return new Array(D).fill(0).map((k,N)=>{let U;N===D-1?U=b:U=N*a+M;const W=t.clone().add(f.clone().multiplyScalar(U)),F=y.clone().add(S.clone().multiplyScalar(U)),E=w.clone().add(v.clone().multiplyScalar(U)),L=new ue().subVectors(F,W).normalize().multiplyScalar(s.eavesLength??0),j=new ue().subVectors(E,W).normalize().multiplyScalar(u.eavesLength??0);return F.add(L),E.add(j),{ridge:W,front:F,back:E}})},[a,t]),C=t.distanceTo(y)>t.distanceTo(w),P=new ue(-i,0,0),A=new ue(0,i/2,0);return h.jsxs(h.Fragment,{children:[x.map((S,v)=>h.jsx(xe.Fragment,{children:r?C?h.jsx(oE,{start:S.ridge,end:S.front,width:i,height:o,color:l}):h.jsx(oE,{start:S.ridge,end:S.back,width:i,height:o,color:l}):h.jsxs(h.Fragment,{children:[h.jsx(oE,{start:S.ridge,end:S.front,width:i,height:o,color:l}),h.jsx(oE,{start:S.ridge,end:S.back,width:i,height:o,color:l,offset:P})]})},v)),h.jsx(oE,{start:p,end:m,width:i,height:o,color:l,offset:A})]})},wan=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e),a=t.length===1;for(const f of t){const[p,m,y,w]=f.points;r.push(w,p,m,y),a&&r.push(w)}const l=Math.abs(t[0].points[0].z)<.015,s=t[0].points[3],c=t[0].points[2],u=h.jsx(On,{points:r,lineWidth:n,color:o}),d=h.jsx(On,{points:[s,c],lineWidth:n,color:o});return h.jsxs(h.Fragment,{children:[u,!l&&!a&&d,h.jsxs("group",{position:[0,0,e],children:[u,!l&&!a&&d]}),t.map((f,p)=>{const[m,y,w,x]=f.points;return h.jsxs("group",{children:[h.jsx(On,{points:[m,m.clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[y,y.clone().add(i)],lineWidth:n,color:o}),a&&h.jsxs(h.Fragment,{children:[h.jsx(On,{points:[w,w.clone().add(i)],lineWidth:n,color:o}),h.jsx(On,{points:[x,x.clone().add(i)],lineWidth:n,color:o})]})]},p)})]})}),xan=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,wallsId:r,lz:i,rise:a=i,thickness:l=.2,ridgeLeftPoint:s,ridgeRightPoint:c,textureType:u,color:d="white",sideColor:f="white",locked:p,lineColor:m="black",lineWidth:y=.2,roofStructure:w,rafterSpacing:x=2,rafterWidth:C=.1,rafterColor:P="white",glassTint:A="#73D8FF",opacity:S=.5,ceiling:v=!1}=t;const b=H(pn),T=H(Jp),R=Fc(n);[m,y]=Rn.getWireframeStyle(m,y,R,p);const{gl:M,camera:D}=ti(),k=g.useMemo(()=>new yu,[]),N=g.useMemo(()=>new _t,[]),[U,W]=g.useState(!1),[F,E]=g.useState(Ur.Null),L=Math.abs(s[0])>.45,j=g.useRef(null),Y=g.useRef(s[0]),O=g.useRef(c[0]),_=g.useRef(a),G=g.useRef(!1),Q=(He,Le,Ye)=>{b(lt=>{for(const Oe of lt.elements)if(Oe.id===He&&Oe.type===z.Roof&&Oe.roofType===Zo.Gable){Oe.ridgeLeftPoint[0]=Le,Oe.ridgeRightPoint[0]=Ye;break}})},oe=(He,Le,Ye,lt,Oe)=>{const ut={name:"Resize Gable Roof Ridge",timestamp:Date.now(),resizedElementId:He,resizedElementType:z.Roof,oldLeft:Le,oldRight:Ye,newLeft:lt,newRight:Oe,undo:()=>{Q(ut.resizedElementId,Le,Ye)},redo:()=>{Q(ut.resizedElementId,lt,Oe)}};H.getState().addUndoable(ut)},ee=He=>{N.x=He.offsetX/M.domElement.clientWidth*2-1,N.y=-(He.offsetY/M.domElement.clientHeight)*2+1,k.setFromCamera(N,D)},$=(He,Le,Ye)=>{const lt=new _t(He.cx,He.cy),Oe=new ue().addVectors(Le.leftPoint,Le.rightPoint).divideScalar(2),ut=new ue().subVectors(Le.leftPoint,Le.rightPoint).length(),ht=new _t(Oe.x,Oe.y).rotateAround(QRe,He.rotation[2]).add(lt),Qe=He.rotation[2]+Le.relativeAngle,mt=new _t(Ye.x,Ye.y).sub(ht).rotateAround(QRe,-Qe).x/ut;return Math.min(Math.abs(mt),.5)*(mt>=0?1:-1)},ae=(He,Le,Ye)=>{if(!He)return new ue;const lt=new ue().subVectors(He.leftPoint,He.rightPoint).length(),Oe=new ue().addVectors(He.leftPoint,He.rightPoint).divideScalar(2),ut=new cn(0,0,He.relativeAngle),ht=new ue(Le*lt,0,0),Qe=Ye*a+ce;return new ue(Oe.x,Oe.y,Qe).add(ht.applyEuler(ut))},Z=(He,Le)=>{const Ye=He[Le];let lt,Oe;return Le===0||Le===2?(lt=Ye.lz,Oe=Ye.lz):Le===1?(lt=He[0].lz,Oe=He[2].lz):(lt=He[2].lz,Oe=He[0].lz),{lh:lt,rh:Oe}},ne=(He,Le)=>{const Ye=He.slice().reverse();return te(Ye,0,Le-1),te(Ye,Le,Ye.length-1),Ye},te=(He,Le,Ye)=>{for(;LeHe*Ye+Le,le=(He,Le,Ye,lt,Oe)=>{const ut=Le[Ye],ht=new ue().subVectors(ut.leftPoint,ut.rightPoint).length(),Qe=(Oe[0]+.5)*ht,{lh:nt,rh:mt}=Z(Le,Ye),tt=Oe[1]*(lt-nt)/Qe,gt=nt,Ve=-(Oe[1]*(lt-mt))/(ht-Qe),je=mt-Ve*ht,et=ut.wallsId.reduce((bt,St)=>{const Pt=H.getState().elements.find(Yt=>Yt.id===St);return Pt?[...bt,Pt.lx+bt[bt.length-1]]:bt},[0]);for(let bt=0;btQe&&(Rt.center=[(Qe-Pt)/zt-.5,lt]),He.set(St,Rt)}return He},de=(He,Le,Ye,lt)=>{const Oe=new Map;return le(Oe,He,1,Le,lt),le(Oe,He,3,Le,Ye),Oe},he=(He,Le,Ye,lt)=>{const[Oe,ut,ht,Qe]=He,nt=new Set(Oe.wallsId),mt=new Set(ht.wallsId),tt=de(He,Le,Ye,lt);b(gt=>{for(const Ve of gt.elements)if(Ve.type===z.Wall&&Ve.foundationId===o){if(nt.has(Ve.id)){const je=Ve;if(je.roofId=n,Ye[0]===.5)je.leftRoofHeight=Le,je.rightRoofHeight=Le,je.centerRoofHeight=void 0;else{const{lh:et,rh:bt}=Z(He,0);je.leftRoofHeight=et,je.rightRoofHeight=bt}}else if(mt.has(Ve.id)){const je=Ve;if(je.roofId=n,Ye[0]===-.5)je.leftRoofHeight=Le,je.rightRoofHeight=Le,je.centerRoofHeight=void 0;else{const{lh:et,rh:bt}=Z(He,2);je.leftRoofHeight=et,je.rightRoofHeight=bt}}else if(tt.has(Ve.id)){const je=tt.get(Ve.id);if(je){const et=Ve,{left:bt,right:St,center:Pt}=je;if(et.roofId=n,et.leftRoofHeight=bt,et.rightRoofHeight=St,Pt){const[Yt,zt]=Pt;et.centerRoofHeight?(et.centerRoofHeight[0]=Yt,et.centerRoofHeight[1]=zt):et.centerRoofHeight=[Yt,zt]}else et.centerRoofHeight=void 0}}}})},me=F3e(r[0],o),{highestWallHeight:ce,topZ:Pe}=L3e(me,a,!0);EU(t,ce);const pe=g.useMemo(()=>{if(me===null||me.length!==4)return new ue;const He=me.map(Ye=>({x:Ye.leftPoint.x,y:Ye.leftPoint.y})),Le=ye.calculatePolygonCentroid(He);return new ue(Le.x,Le.y,Pe)},[me,Pe]),Ie=g.useMemo(()=>{if(me===null)return new ue;const He=me[3],[Le,Ye]=s;return ae(He,Le,Ye)},[me,Pe,s]),ve=g.useMemo(()=>{if(me===null)return new ue;const He=me[1],[Le,Ye]=c;return ae(He,Le,Ye)},[me,Pe,c]),ze=g.useMemo(()=>new ue((Ie.x+ve.x)/2,(Ie.y+ve.y)/2,Pe),[Ie,ve]),Ae=g.useMemo(()=>!me||me.length!==4?null:me.map(He=>Rn.getComposedWallNormal(He).multiplyScalar(He.eavesLength)),[me]),se=g.useMemo(()=>yan.clone().multiplyScalar(l),[l]),ge=g.useMemo(()=>{const He=[];if(!me||me.length!==4||!Ae)return He;if(L){const Le=[],Ye=s[0]<0?0:2,lt=ne(me,Ye),Oe=ne(Ae,Ye),[ut,ht,Qe,nt]=lt,[mt,tt,gt,Ve]=Oe,je=ut.leftPoint,et=ut.rightPoint,bt=Qe.leftPoint,St=Qe.rightPoint,Pt=je.clone().add(mt),Yt=et.clone().add(mt),zt=St.clone().add(Ve),Rt=je.clone().add(Ve),Ct=et.clone().add(tt),yt=bt.clone().add(tt),at=bt.clone().add(gt),Et=St.clone().add(gt),{lh:Lt,rh:Je}=Z(lt,0),{lh:st,rh:It}=Z(lt,2),ot=Rn.getDistance(je,et,St),it=Math.min((ut.eavesLength??0)/ot*(Pe-Lt),Lt),Be=Rn.getDistance(je,et,bt),pt=Math.min((ut.eavesLength??0)/Be*(Pe-Je),Je),ct=Rn.getDistance(bt,St,et),Xe=Math.min((Qe.eavesLength??0)/ct*(Pe-Je),st),ft=Rn.getDistance(bt,St,je),wt=Math.min((Qe.eavesLength??0)/ft*(Pe-Lt),It),kt=Rn.getIntersectionPoint(zt,Rt,Pt,Yt).setZ(Lt-it).sub(pe),Zt=Rn.getIntersectionPoint(Pt,Yt,Ct,yt).setZ(Je-pt).sub(pe),Ot=Rn.getIntersectionPoint(Ct,yt,at,Et).setZ(Pe+Xe).sub(pe),on=Rn.getIntersectionPoint(at,Et,zt,Rt).setZ(Pe+wt).sub(pe);Le.push(kt,Zt,Ot,on),Le.push(kt.clone().add(se),Zt.clone().add(se),Ot.clone().add(se),on.clone().add(se));const rn=new ue().addVectors(ut.leftPoint,ut.rightPoint).divideScalar(2).clone().sub(ze.clone().setZ(0)).length();He.push({points:Le,angle:-ut.relativeAngle,length:rn})}else{const[Le,Ye,lt,Oe]=me,[ut,ht,Qe,nt]=Ae,mt=Le.leftPoint.clone().add(ut),tt=Le.rightPoint.clone().add(ut),gt=lt.rightPoint.clone().add(nt),Ve=Le.leftPoint.clone().add(nt),je=Le.rightPoint.clone().add(ht),et=lt.leftPoint.clone().add(ht),bt=lt.leftPoint.clone().add(Qe),St=lt.rightPoint.clone().add(Qe),Pt=Rn.getIntersectionPoint(Ie,ve,gt.clone(),Ve.clone()).setZ(Ie.z).sub(pe),Yt=Rn.getIntersectionPoint(Ie,ve,je.clone(),et.clone()).setZ(ve.z).sub(pe),zt=[],{lh:Rt,rh:Ct}=Z(me,0),yt=Rn.getDistance(Le.leftPoint,Le.rightPoint,Ie),at=Math.min((Le.eavesLength??0)/yt*(Ie.z-Rt),Rt),Et=Rn.getDistance(Le.leftPoint,Le.rightPoint,ve),Lt=Math.min((Le.eavesLength??0)/Et*(ve.z-Ct),Ct),Je=Rn.getIntersectionPoint(gt,Ve,mt,tt).setZ(Rt-at).sub(pe),st=Rn.getIntersectionPoint(mt,tt,je,et).setZ(Ct-Lt).sub(pe);zt.push(Je,st,Yt,Pt),zt.push(Je.clone().add(se),st.clone().add(se),Yt.clone().add(se),Pt.clone().add(se));const ot=new ue().addVectors(Le.leftPoint,Le.rightPoint).divideScalar(2).clone().sub(pe.clone().setZ(0)).length();He.push({points:zt,angle:-Le.relativeAngle,length:ot});const it=[],{lh:Be,rh:pt}=Z(me,2),ct=Rn.getDistance(lt.leftPoint,lt.rightPoint,ve),Xe=Math.min((lt.eavesLength??0)/ct*(ve.z-Be),Be),ft=Rn.getDistance(lt.leftPoint,lt.rightPoint,Ie),wt=Math.min((lt.eavesLength??0)/ft*(Ie.z-pt),pt),kt=Rn.getIntersectionPoint(je,et,bt,St).setZ(Be-Xe).sub(pe),Zt=Rn.getIntersectionPoint(bt,St,gt,Ve).setZ(pt-wt).sub(pe);it.push(kt,Zt,Pt,Yt),it.push(kt.clone().add(se),Zt.clone().add(se),Pt.clone().add(se),Yt.clone().add(se));const on=new ue().addVectors(lt.leftPoint,lt.rightPoint).divideScalar(2).clone().sub(pe.clone().setZ(0)).length();He.push({points:it,angle:-lt.relativeAngle,length:on})}return He},[me,Ie,ve,Pe,l]),we=g.useMemo(()=>!me||me.length!==4?null:me.map(He=>He.leftPoint),[me]);g.useEffect(()=>{(!me||me.length!==4)&&T(n,!1,!1,!0)},[me]);const Se=tte();g.useEffect(()=>{if((me==null?void 0:me.length)!==4)return;(H.getState().addedRoofIdSet.has(n)||!Se)&&(he(me,Pe,s,c),ete(e,n,ge,pe,Pe,l),H.getState().deleteAddedRoofId(n))},[ge]),W3e(e,n,ge,pe,Pe,l);const Me=()=>{if(!me||me.length!==4)return;const He=[];if(L){const Le=s[0]<0?0:2,lt=ne(me,Le).map((Oe,ut,ht)=>new ue(Oe.leftPoint.x,Oe.leftPoint.y,Z(ht,ut).lh));He.push(lt)}else{const Le=me.map((Ye,lt,Oe)=>new ue(Ye.leftPoint.x,Ye.leftPoint.y,Z(Oe,lt).lh));He.push([Le[0],Le[1],ve.clone(),Ie.clone()]),He.push([Le[2],Le[3],Ie.clone(),ve.clone()])}In.getState().setRoofSegmentVerticesWithoutOverhang(n,He)};zU(n,pe,ge,!1,Zo.Gable),DU(Me);const Ce=H(He=>He.elements.filter(Le=>Le.parentId===n&&Le.type===z.Window),Qy),Te=H(z0),Re=dt(vs),Ne=H(Df),_e=In(O1),[Ue,qe]=g.useState([]);g.useEffect(()=>{if(Re){const He=ge.length;if(He>0){const Le=[];for(let Ye=0;Ye{HU(He,e.id,n,ge,pe)},onPointerMove:He=>{IU(He,n)},onPointerUp:He=>{MU(He,t)},onContextMenu:He=>{HH(He,n)},children:[ge.map((He,Le,Ye)=>{const{points:lt,angle:Oe,length:ut}=He,ht=Math.abs(lt[0].z)<.1;return me?h.jsx(van,{index:Le,id:n,points:lt,centroid:pe,angle:ht?Ye[0].angle:Oe,length:ht?1:ut,textureType:u,heatmaps:Ue,color:d,sideColor:f,roofStructure:w,glassTint:A,opacity:S,relativeAngle:Le===0?me[0].relativeAngle:me[2].relativeAngle,foundation:e,windows:Ce},Le):null}),S>0&&h.jsx(wan,{roofSegments:ge,thickness:l,lineColor:m,lineWidth:w===Hc.Rafter?.1:y})]}),v&&a>0&&me[0].lz===me[2].lz&&we&&h.jsx(tU,{cz:me[0].lz,points:we}),w===Hc.Rafter&&me&&me.length===4&&h.jsx("group",{onContextMenu:He=>{HH(He,n)},onPointerDown:He=>{Rot(He,n,o)},children:h.jsx(Aan,{ridgeLeftPoint:Ie,ridgeRightPoint:ve,wallArray:me,overhang:0,isShed:L,height:l,spacing:x,color:P,width:C})}),R&&!p&&h.jsxs("group",{position:[0,0,l],children:[h.jsx(mh,{position:[ze.x,ze.y,ze.z+.15],onPointerDown:He=>{if(Te(t.id,He,er.Select),G.current=!0,_.current=a,W(!0),l_.set(ze.x,ze.y,Pe),e){const Le=-Math.atan2(D.position.x-e.cx,D.position.y-e.cy)-e.rotation[2];s_.set(-$t,0,Le,"ZXY")}E(Ur.Mid),jn.getState().setEnableOrbitController(!1),b(Le=>{Le.resizeHandleType=xt.Top,Le.selectedElementHeight=Pe+t.thickness})},onPointerOver:()=>{b(He=>{He.hoveredHandle=Ur.Mid,He.selectedElementHeight=Pe+t.thickness,He.selectedElementX=ze.x,He.selectedElementY=ze.y})}}),h.jsx(mh,{position:[Ie.x,Ie.y,Ie.z+.15],onPointerDown:()=>{if(G.current=!0,Y.current=s[0],O.current=c[0],W(!0),l_.set(Ie.x,Ie.y,Pe),e&&me&&me[3]){const He=new ue().subVectors(Ie,D.position).normalize(),Le=Math.atan2(He.z,Math.hypot(He.x,He.y)),Ye=me[3].relativeAngle;s_.set(-$t+Le,0,Ye,"ZXY")}E(Ur.Left),jn.getState().setEnableOrbitController(!1)}}),h.jsx(mh,{position:[ve.x,ve.y,ve.z+.15],onPointerDown:()=>{if(G.current=!0,Y.current=s[0],O.current=c[0],W(!0),l_.set(ve.x,ve.y,Pe),e&&me&&me[1]){const He=new ue().subVectors(ve,D.position).normalize(),Le=Math.atan2(He.z,Math.hypot(He.x,He.y)),Ye=me[1].relativeAngle;s_.set(-$t+Le,0,Ye,"ZXY")}E(Ur.Right),jn.getState().setEnableOrbitController(!1)}})]}),U&&h.jsx(yi,{name:"Roof Intersection Plane",ref:j,args:[1e3,100],visible:!1,position:l_,rotation:s_,onPointerMove:He=>{if(j.current&&G.current&&e&&me&&me.length===4){ee(He);const Le=k.intersectObjects([j.current]);if(Le[0]){const Ye=Le[0].point;if(Ye.z<.001)return;switch(F){case Ur.Left:{const lt=me[3];if(lt){let Oe=$(e,lt,Ye);Math.abs(Oe)>=.45&&Math.abs(Oe)<.5&&(Oe=.45*Math.sign(Oe));const ut=[Oe,s[1]],ht=[-Oe,c[1]],Qe=de(me,Pe,ut,ht);O9(Qe,o)&&Q(n,Oe,-Oe)}break}case Ur.Right:{const lt=me[1];if(lt){let Oe=$(e,lt,Ye);Math.abs(Oe)>=.45&&Math.abs(Oe)<.5&&(Oe=.45*Math.sign(Oe));const ut=[-Oe,s[1]],ht=[Oe,c[1]],Qe=de(me,Pe,ut,ht);O9(Qe,o)&&Q(n,-Oe,Oe)}break}case Ur.Mid:{let lt;L?lt=Math.max(0,Ye.z-e.lz-.3-ce):lt=Math.max(-ce+.01,Ye.z-e.lz-.3-ce);const Oe=ce+lt,ut=de(me,Oe,s,c);O9(ut,o)&&H.getState().updateRoofRiseById(n,lt,Pe+t.thickness);break}}}}},onPointerUp:()=>{switch(F){case Ur.Mid:{RU(n,_.current,a);break}case Ur.Left:case Ur.Right:oe(n,Y.current,O.current,s[0],c[0])}G.current=!1,W(!1),E(Ur.Null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})})]})},van=({index:t,id:e,points:n,centroid:o,angle:r,length:i,textureType:a,heatmaps:l,color:s="white",sideColor:c,relativeAngle:u,foundation:d,roofStructure:f,glassTint:p,opacity:m=.5,windows:y})=>{const w=H.getState().world;H(Jn);const x=H($3),C=dt(vs),P=dt(n6),A=H(Y5),S=H(J3),v=H(K3),b=In(UN),T=In.getState().hourlyHeatExchangeArrayMap,R=hI(f===Hc.Rafter?Yr.NoTexture:a),{transparent:M,opacity:D}=pI(f===Hc.Rafter,m),{invalidate:k}=ti(),N=g.useRef(null),U=g.useRef(null),W=g.useRef(null),F=g.useRef(null),E=g.useRef(0),L=g.useRef(),j=g.useRef(),[Y,O]=g.useState(0),[_,G]=g.useState(0),[Q,oe]=g.useState(!0),ee=(q,le)=>q.clone().setZ(0).distanceTo(le.clone().setZ(0))>2,$=q=>Math.abs(q){if(!P)return;const q=b(e);if(!q)return;const le=[],[de,he,me,ce,Pe]=n,pe=Pe.z-de.z,Ie=new ue(0,0,pe+.1);for(const ve of q.values()){let ze=[];ze.push(ve[0].clone().sub(o).add(Ie)),ze.push(ve[1].clone().sub(o).add(Ie)),le.push(ze),ze=[],ze.push(ve[0].clone().sub(o).add(Ie)),ze.push(ve[3].clone().sub(o).add(Ie)),le.push(ze),ze=[],ze.push(ve[1].clone().sub(o).add(Ie)),ze.push(ve[2].clone().sub(o).add(Ie)),le.push(ze)}return le},[P]),Z=g.useMemo(()=>{if(!P||d&&d.notBuilding)return;const q=T.get(e+"-"+t);if(!q)return;const le=q.reduce((Qe,nt)=>Qe+nt,0),de=b(e);if(!de||!de[t])return;const[he,me,ce,Pe,pe]=n,Ie=pe.z-he.z,ve=de[t].map(Qe=>Qe.clone().sub(o).add(new ue(0,0,Ie)));if(!ve)return;let ze=ye.getTriangleArea(ve[0],ve[1],ve[2])+ye.getTriangleArea(ve[2],ve[3],ve[0]);if(ze===0)return;let Ae=x(z.Window,e);const se=b(e);if(se&&se[t]&&(Ae=Ae.filter(Qe=>{const nt=Qe,mt=nt.cy+(nt.windowType===Ti.Polygonal&&nt.polygonTop?nt.polygonTop[1]/2:0);return Rn.onSegment(se[t],Qe.cx,mt)})),Ae&&Ae.length>0)for(const Qe of Ae)ze-=ye.getWindowArea(Qe);const ge=X3*(w.solarRadiationHeatmapGridCellSize??.5),we=ve[0].clone(),Se=ve[1].clone(),Me=ve[2].clone(),Ce=new ue().subVectors(Se,we),Te=new ue().subVectors(Me,we),Re=new ue().subVectors(Me,Se),Ne=Ce.length(),_e=new ue().crossVectors(Te,Re).length()/Ne,Ue=Math.max(2,Math.round(Ne/ge)),qe=Math.max(2,Math.round(_e/ge));Ce.normalize(),Te.normalize(),Re.normalize();const Fe=new ue().crossVectors(Te,Re).normalize(),He=Ce.multiplyScalar(.5*Ne/Ue),Le=new ue().crossVectors(Fe,Ce).normalize().multiplyScalar(.5*_e/qe),Ye=we.clone().add(He).add(Le);He.multiplyScalar(2),Le.multiplyScalar(2);const lt=le/ze*(A??Ny);E.current=lt<0?1:0,L.current=Fe.clone().multiplyScalar(.1),j.current=ye.getEuler(Oo,Fe,"YXZ",-Math.sign(lt)*$t);const Oe=[],ut=new ue;let ht;for(let Qe=0;Qe0){const tt=ut.x+o.x,gt=ut.y+o.y;for(const Ve of Ae){const je=Rn.getRelativeWindowVerticesOnRoof(Ve),et=ye.getPoints(je);if(ye.isPointInside(tt,gt,et)){ht=!1;break}}}if(ht){const tt=[];lt<0?(tt.push(ut.clone()),tt.push(ut.clone().add(Fe.clone().multiplyScalar(-lt)))):(tt.push(ut.clone()),tt.push(ut.clone().add(Fe.clone().multiplyScalar(lt)))),Oe.push(tt)}}}return Oe},[P,A,o,n]);g.useEffect(()=>{const[q,le,de,he,me]=n,ce=me.z-q.z;if(N.current){const Pe=N.current.geometry;if(Pe){const pe=new Float32Array(18),Ie=ce+.01;pe[0]=n[0].x,pe[1]=n[0].y,pe[2]=n[0].z+Ie,pe[3]=n[1].x,pe[4]=n[1].y,pe[5]=n[1].z+Ie,pe[6]=n[2].x,pe[7]=n[2].y,pe[8]=n[2].z+Ie,pe[9]=n[2].x,pe[10]=n[2].y,pe[11]=n[2].z+Ie,pe[12]=n[3].x,pe[13]=n[3].y,pe[14]=n[3].z+Ie,pe[15]=n[0].x,pe[16]=n[0].y,pe[17]=n[0].z+Ie,Pe.setAttribute("position",new Ar(pe,3)),Pe.computeVertexNormals();const ve=[];ve.push(0,0),ve.push(1,0),ve.push(1,1),ve.push(1,1),ve.push(0,1),ve.push(0,0),Pe.setAttribute("uv",new Ar(ve,2))}}if(U.current){U.current.geometry=new Dde(n,r,i);const Pe=ee(q,he)&&ee(le,de);if(oe(Pe),f===Hc.Glass&&Pe){const pe=ye.calculatePolygonCentroid(n.map(ye.mapVector3ToPoint2)),Ie=new ue(pe.x,pe.y,0),ve=.25,ze=new ue().addVectors(q,Ie.clone().sub(q).setZ(0).normalize().multiplyScalar(ve)),Ae=new ue().addVectors(le,Ie.clone().sub(le).setZ(0).normalize().multiplyScalar(ve)),se=new ue().addVectors(de,Ie.clone().sub(de).normalize().multiplyScalar(ve)),ge=new ue().addVectors(he,Ie.clone().sub(he).normalize().multiplyScalar(ve)),we=[];we.push(ze),we.push(Ae),we.push(se.setZ(Ae.z)),we.push(ge.setZ(ze.z)),we.push(ze.clone().setZ(1)),we.push(Ae.clone().setZ(1)),we.push(se.clone().setZ(1)),we.push(ge.clone().setZ(1));const Se=new os(new Dde(we)),Me=Ac.subtract(U.current,Se);if(U.current.geometry=Me.geometry,$(u)){const Te=ze.distanceTo(Ae),Re=q.distanceTo(he);O(Te),G(Re);const Ne=new ue().subVectors(q,he).angleTo(new ue(0,-1,0));W.current&&(W.current.scale.set(Te,Re,1),W.current.rotation.set(Ne,0,0)),F.current&&F.current.rotation.set(Ne-$t,0,0)}else{const Te=q.distanceTo(he),Re=ze.distanceTo(Ae);O(Te),G(Re);const Ne=new ue().subVectors(q,he).angleTo(new ue(1,0,0));W.current&&(W.current.scale.set(Te,Re,1),W.current.rotation.set(0,Ne,0)),F.current&&F.current.rotation.set($t,Ne,0,"YXZ")}const Ce=(q.z+he.z)/2+ce*.75;W.current&&W.current.position.set(pe.x,pe.y,Ce),F.current&&F.current.position.set(pe.x,pe.y,Ce)}}k()},[n,r,i,u,Q,C,f]);const ne={points:n,angle:r,length:i},te=a===Yr.Default||a===Yr.NoTexture?s:"white";return h.jsxs(h.Fragment,{children:[(D>0&&f===Hc.Rafter||f!==Hc.Rafter)&&h.jsx(h.Fragment,{children:h.jsx(DJe,{id:e,index:t,segment:ne,color:te,sideColor:c??"white",texture:R,heatmap:l[t],transparent:M,opacity:D,windows:y,centroid:o})}),ae&&ae.map((q,le)=>h.jsx(On,{points:q,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+le},le)),Z&&Z.map((q,le)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:q,name:"Heat Flux "+le,lineWidth:v??Uy,color:S??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:L.current?q[E.current].clone().add(L.current):q[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:j.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:S??Fu})})]},le))]})},ban=xe.memo(xan,fI),San=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ue(0,0,e);for(let u=0;u{const[f,p,m,y]=u.points,w=[f.clone().sub(i),f];return h.jsx(On,{points:w,lineWidth:n,color:o},d)})]})]})}),mw=new ue,yw=new cn,Tan=new ue(0,0,1),Pan=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,cx:r,cy:i,lz:a,wallsId:l,leftRidgeLength:s,rightRidgeLength:c,textureType:u,color:d="white",sideColor:f="white",thickness:p=.2,locked:m,lineColor:y="black",lineWidth:w=.2,roofType:x,rise:C=a,ceiling:P=!1}=t;const A=H(Jn),S=H(pn),v=H(Jp),b=F3e(l[0],o),T=hI(u),R=Fc(n),[M,D]=g.useState(!1),[k,N]=g.useState(Ur.Null),[U,W]=g.useState(s),[F,E]=g.useState(c),{highestWallHeight:L,topZ:j}=L3e(b,C);EU(t,L);const Y=g.useRef(null),{gl:O,camera:_}=ti(),G=g.useMemo(()=>new yu,[]),Q=g.useMemo(()=>new _t,[]),oe=g.useRef(!1),ee=g.useRef(C),$=C<.01;[y,w]=Rn.getWireframeStyle(y,w,R,m),g.useEffect(()=>{W(s)},[s]),g.useEffect(()=>{E(c)},[c]);const ae=(Fe,He,Le,Ye=!1)=>{S(lt=>{for(const Oe of lt.elements)if(Oe.id===Fe&&Oe.type===z.Roof&&Oe.roofType===Zo.Hip){Oe.leftRidgeLength=He,Oe.rightRidgeLength=Le,Ye&&(lt.updateElementOnRoofFlag=!0);break}})},Z=(Fe,He,Le,Ye,lt)=>{const Oe={name:"Resize Hip Roof Ridge",timestamp:Date.now(),resizedElementId:Fe,resizedElementType:z.Roof,oldLeftRidgeLength:He,oldRightRidgeLength:Le,newLeftRidgeLength:Ye,newRightRidgeLength:lt,undo:()=>{ae(Oe.resizedElementId,Oe.oldLeftRidgeLength,Oe.oldRightRidgeLength,!0)},redo:()=>{ae(Oe.resizedElementId,Oe.newLeftRidgeLength,Oe.newRightRidgeLength,!0)}};H.getState().addUndoable(Oe)},ne=Fe=>{const He=[];for(const Le of Fe)He.push({x:Le.leftPoint.x,y:Le.leftPoint.y});return He},te=Fe=>{Q.x=Fe.offsetX/O.domElement.clientWidth*2-1,Q.y=-(Fe.offsetY/O.domElement.clientHeight)*2+1,G.setFromCamera(Q,_)},q=(Fe,He,Le,Ye,lt)=>{Fe.push(He,Le,Ye),lt&&Fe.push(lt),Fe.push(He.clone().add(pe),Le.clone().add(pe),Ye.clone().add(pe)),lt&&Fe.push(lt.clone().add(pe))},le=()=>{if(b===null||b.length!==4)return 0;const Fe=b.map(Ye=>Ye.leftPoint),He=[he,me,me,he];let Le=1/0;for(let Ye=0;Ye<4;Ye++){const lt=b[Ye],Oe=Rn.getDistance(Fe[Ye],Fe[(Ye+1)%4],He[Ye]),ut=Math.min((lt.eavesLength??0)/Oe*(He[Ye].z-lt.lz),lt.lz),ht=Rn.getDistance(Fe[Ye],Fe[(Ye+1)%4],He[(Ye+1)%4]),Qe=Math.min((lt.eavesLength??0)/ht*(He[(Ye+1)%4].z-lt.lz),lt.lz);Le=Math.min(Math.min(ut,Qe),Le)}return Number.isNaN(Le)?0:Le},de=g.useMemo(()=>{if(b===null||b.length!==4)return new _t;const Fe=ne(b),He=ye.calculatePolygonCentroid(Fe);return new _t(He.x,He.y)},[b]),he=g.useMemo(()=>{const Fe=new ue,He=new ue(de.x,de.y,j),Le=A(l[0]);return Le&&Fe.setX(-U).applyEuler(new cn(0,0,Le.relativeAngle)).add(He),Fe},[de,j,U]),me=g.useMemo(()=>{const Fe=new ue,He=new ue(de.x,de.y,j),Le=A(l[0]);return Le&&Fe.setX(F).applyEuler(new cn(0,0,Le.relativeAngle)).add(He),Fe},[de,j,F]),ce=g.useMemo(()=>new ue(de.x,de.y,j),[de,j]),Pe=g.useMemo(()=>b===null||b.length!==4?[]:b.map(Fe=>Rn.getComposedWallNormal(Fe).multiplyScalar(Fe.eavesLength)),[b]),pe=g.useMemo(()=>Tan.clone().multiplyScalar(p),[p]),Ie=g.useMemo(()=>b===null||b.length!==4?null:b.map((Fe,He)=>({leftPoint:Fe.leftPoint.clone().add(Pe[He]),rightPoint:Fe.rightPoint.clone().add(Pe[He])})),[b,Pe]),ve=g.useMemo(()=>{const Fe=[];if(b===null||b.length!==4||Ie===null)return Fe;const He=le();for(let Le=0;Le<4;Le++){const Ye=[],lt=b[Le],{lh:Oe,rh:ut}=Rn.getComposedWallHeight(b,Le),ht=Rn.getIntersectionPoint(Ie[(Le+3)%4].leftPoint,Ie[(Le+3)%4].rightPoint,Ie[Le].leftPoint,Ie[Le].rightPoint).setZ(Oe-He).sub(ce),Qe=Rn.getIntersectionPoint(Ie[Le].leftPoint,Ie[Le].rightPoint,Ie[(Le+1)%4].leftPoint,Ie[(Le+1)%4].rightPoint).setZ(ut-He).sub(ce),nt=new ue().addVectors(lt.leftPoint,lt.rightPoint).divideScalar(2),mt=he.clone().sub(ce),tt=me.clone().sub(ce);let gt=0;switch(Le){case 0:gt=nt.clone().sub(ce.clone().setZ(0)).length(),q(Ye,ht,Qe,tt,mt);break;case 1:gt=nt.clone().sub(me.clone().setZ(0)).length(),q(Ye,ht,Qe,tt);break;case 2:gt=nt.clone().sub(ce.clone().setZ(0)).length(),q(Ye,ht,Qe,mt,tt);break;case 3:gt=nt.clone().sub(he.clone().setZ(0)).length(),q(Ye,ht,Qe,mt);break}Fe.push({points:Ye,angle:-lt.relativeAngle,length:gt})}return Fe},[b,he,me,j,p]),ze=g.useMemo(()=>!b||b.length!==4?null:b.map(Fe=>Fe.leftPoint),[b]);g.useEffect(()=>{if(b===null||b.length!==4)v(n,!1,!1,!0);else if(H.getState().addedRoofIdSet.has(n)){for(let He=0;He{for(const lt of Ye.elements)if(lt.type===z.Wall&&Le.has(lt.id)){const Oe=lt;Oe.roofId=n,Oe.leftRoofHeight=void 0,Oe.rightRoofHeight=void 0}})}H.getState().deleteAddedRoofId(n)}},[b]),N3e(e,n,ve,ce,j,p);const Ae=()=>{if(!b)return;const Fe=[];for(let He=0;He<4;He++){const Le=b[He],{lh:Ye,rh:lt}=Rn.getComposedWallHeight(b,He),Oe=Le.leftPoint.clone().setZ(Ye),ut=Le.rightPoint.clone().setZ(lt),ht=he.clone(),Qe=me.clone();switch(He){case 0:Fe.push([Oe,ut,Qe,ht]);break;case 1:Fe.push([Oe,ut,Qe]);break;case 2:Fe.push([Oe,ut,ht,Qe]);break;case 3:Fe.push([Oe,ut,ht]);break}}if($){const He=[];for(const Le of Fe)He.push(Le[0].clone());In.getState().setRoofSegmentVerticesWithoutOverhang(n,[He])}else In.getState().setRoofSegmentVerticesWithoutOverhang(n,Fe)},se=zU(n,new ue(de.x,de.y,j),ve,$,Zo.Hip);DU(Ae);const ge=H(Fe=>Fe.elements.filter(He=>He.parentId===n&&He.type===z.Window),Qy),we=H(z0),Se=dt(vs),Me=H(Df),Ce=In(O1),[Te,Re]=g.useState(null),[Ne,_e]=g.useState([]);g.useEffect(()=>{if(Se)if(C>0){const Fe=ve.length;if(Fe>0){const He=[];for(let Le=0;Le0&&e){const Ye=new cn(0,0,e.rotation[2],"ZYX");let lt=Number.MAX_VALUE,Oe=Number.MAX_VALUE,ut=-Number.MAX_VALUE,ht=-Number.MAX_VALUE;for(const Ve of Le)for(const je of Ve){const et=je.clone().applyEuler(Ye);et.x>ut&&(ut=et.x),et.xht&&(ht=et.y),et.y{HU(Fe,e.id,n,ve,ce)},onPointerMove:Fe=>{IU(Fe,n)},onPointerUp:Fe=>{MU(Fe,t)},onContextMenu:Fe=>{HH(Fe,n)},children:$?h.jsx(nte,{id:n,foundationModel:e,roofType:x,roofSegments:ve,center:new ue(de.x,de.y,j),thickness:p,lineWidth:w,lineColor:y,sideColor:f,color:qe,textureType:u,heatmap:Te}):h.jsxs(h.Fragment,{children:[ve.map((Fe,He,Le)=>h.jsx(IQ,{id:n,index:He,foundationModel:e,roofType:x,segment:Fe,centroid:ce,thickness:p,color:qe,sideColor:f,texture:T,heatmap:Ne&&He0&&ze&&h.jsx(tU,{cz:b[0].lz,points:ze}),R&&!m&&h.jsxs("group",{position:[0,0,p+.15],children:[h.jsx(mh,{position:[he.x,he.y,he.z],onPointerDown:()=>{if(oe.current=!0,D(!0),mw.set(he.x,he.y,j),e&&b[0]){const Fe=H.getState().cameraDirection,He=Math.atan2(Fe.z,Fe.y),Le=b[0].relativeAngle;yw.set(-$t-He,0,Le,"ZXY")}N(Ur.Left),jn.getState().setEnableOrbitController(!1)}}),h.jsx(mh,{position:[ce.x,ce.y,ce.z],onPointerDown:Fe=>{if(we(t.id,Fe,er.Select),oe.current=!0,ee.current=C,D(!0),mw.set(ce.x,ce.y,j),e){const He=-Math.atan2(_.position.x-r,_.position.y-i)-e.rotation[2];yw.set(-$t,0,He,"ZXY")}N(Ur.Mid),jn.getState().setEnableOrbitController(!1),S(He=>{He.resizeHandleType=xt.Top,He.selectedElementHeight=j+t.thickness})},onPointerOver:()=>{S(Fe=>{Fe.hoveredHandle=Ur.Mid,Fe.selectedElementHeight=j+t.thickness,Fe.selectedElementX=de.x,Fe.selectedElementY=de.y})}}),h.jsx(mh,{position:[me.x,me.y,me.z],onPointerDown:()=>{if(oe.current=!0,D(!0),mw.set(me.x,me.y,j),e&&b[0]){const Fe=H.getState().cameraDirection,He=Math.atan2(Fe.z,Fe.y),Le=b[0].relativeAngle;yw.set(-$t-He,0,Le,"ZXY")}N(Ur.Right),jn.getState().setEnableOrbitController(!1)}})]}),M&&h.jsx(yi,{name:"Roof Intersection Plane",ref:Y,args:[1e3,100],visible:!1,position:mw,rotation:yw,onPointerMove:Fe=>{if(Y.current&&oe.current){te(Fe);const He=G.intersectObjects([Y.current]);if(He[0]&&e){const Le=He[0].point;if(Le.z<.001)return;const Ye=b[0],lt=new ue().subVectors(Ye.rightPoint,Ye.leftPoint).length();switch(k){case Ur.Left:{const Oe=ce.clone().sub(mw).applyEuler(new cn(0,0,-yw.z)),ut=Le.clone().sub(new ue(e.cx,e.cy,e.cz)).applyEuler(new cn(0,0,-e.rotation[2])).sub(mw).applyEuler(new cn(0,0,-yw.z)),ht=new ue().subVectors(ut,Oe).x;W(ye.clamp(-ht,-F+.1,lt/2-.01));break}case Ur.Right:{const Oe=ce.clone().sub(mw).applyEuler(new cn(0,0,-yw.z)),ut=Le.clone().sub(new ue(e.cx,e.cy,e.cz)).applyEuler(new cn(0,0,-e.rotation[2])).sub(mw).applyEuler(new cn(0,0,-yw.z)),ht=new ue().subVectors(ut,Oe).x;E(ye.clamp(ht,-U+.1,lt/2-.01));break}case Ur.Mid:{const Oe=Math.max(0,Le.z-e.lz-.3-L);H.getState().updateRoofRiseById(n,Oe,j+t.thickness);break}}}}},onPointerUp:()=>{switch(k){case Ur.Mid:{RU(n,ee.current,C);break}case Ur.Left:case Ur.Right:ae(n,U,F),Z(n,s,c,U,F)}oe.current=!1,D(!1),N(Ur.Null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})})]})},Can=xe.memo(Pan,fI),Sse=new ue,Tse=new cn,Ran=new ue(0,0,1),Han=xe.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{const r=g.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[1]),[t[0].points[0]]),[t]),i=g.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[6].clone()),[t[0].points[7].clone()]),[t]),a=g.useMemo(()=>h.jsx(On,{points:r,lineWidth:n,color:o}),[r,n,o]);if(t.length<2)return null;const l=Math.abs(t[0].points[0].z-t[0].points[3].z)<.1;return h.jsxs(h.Fragment,{children:[!l&&h.jsx(On,{points:i,lineWidth:n,color:o}),a,h.jsx("group",{position:[0,0,e],children:a}),t.map((s,c)=>h.jsxs(xe.Fragment,{children:[!l&&h.jsx(On,{points:[s.points[7],s.points[4]],lineWidth:n,color:o}),h.jsx(On,{points:[s.points[4],s.points[0]],lineWidth:n,color:o})]},c))]})}),Man=({roofModel:t,foundationModel:e})=>{let{id:n,wallsId:o,cx:r,cy:i,lz:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineColor:f="black",lineWidth:p=.2,roofType:m,foundationId:y,ridgeWidth:w=1,rise:x=a,ceiling:C=!1,frontRidge:P,backRidge:A}=t;const S=hI(l),v=Fc(n);[f,p]=Rn.getWireframeStyle(f,p,v,d);const b=H(pn),T=H(Jp),R=H(xs),M=H(yt=>yt.ray),D=H(yt=>yt.mouse),[k,N]=g.useState(w),[U,W]=g.useState(null),[F,E]=g.useState(!1),[L,j]=g.useState(Ur.Null),[Y,O]=g.useState(null),_=g.useRef(k),G=g.useRef(x),Q=g.useRef(null),oe=g.useRef(!1),{gl:ee,camera:$}=ti(),ae=x<.01,Z=yt=>{const at=[],Et=yt.length;for(const Lt of yt)Lt.leftPoint[0]!==void 0&&Lt.leftPoint[1]!==void 0&&at.push({x:Lt.leftPoint[0],y:Lt.leftPoint[1]});return me.current||(yt[Et-1].rightPoint[0]||yt[Et-1].rightPoint[0]===0)&&(yt[Et-1].rightPoint[1]||yt[Et-1].rightPoint[1]===0)&&at.push({x:yt[Et-1].rightPoint[0],y:yt[Et-1].rightPoint[1]}),at},ne=yt=>{if(yt{D.x=yt.offsetX/ee.domElement.clientWidth*2-1,D.y=-(yt.offsetY/ee.domElement.clientHeight)*2+1,M.setFromCamera(D,$)},q=(yt,at)=>{b(Et=>{for(const Lt of Et.elements)if(Lt.id===yt&&Lt.type===z.Roof&&Lt.roofType===Zo.Mansard){Lt.ridgeWidth=at;break}})},le=()=>{let yt=1/0;for(let at=0;at{const Je={name:"Resize Mansard Roof Ridge",timestamp:Date.now(),resizedElementId:yt,resizedElementType:z.Roof,oldVal:Et,newVal:Lt,type:at,undo:()=>{q(Je.resizedElementId,Je.oldVal)},redo:()=>{q(Je.resizedElementId,Je.newVal)}};H.getState().addUndoable(Je)},{currentWallArray:he,isLoopRef:me}=Iot(y,n,o),{highestWallHeight:ce,topZ:Pe}=zot(he,x);EU(t,ce);const pe=g.useMemo(()=>{if(he.length<2)return new ue;const yt=Z(he),at=ye.calculatePolygonCentroid(yt);return Number.isNaN(at.x)||Number.isNaN(at.y)?new ue:new ue(at.x,at.y,Pe)},[he,Pe]),Ie=g.useMemo(()=>{const yt=he.map(at=>Rn.getWallNormal(at).multiplyScalar(at.eavesLength??0));if(!me.current&&yt.length!==0){const at=new ue().subVectors(new ue(he[he.length-1].rightPoint[0],he[he.length-1].rightPoint[1]),new ue(he[0].leftPoint[0],he[0].leftPoint[1])).applyEuler(kX).normalize().multiplyScalar(.3);yt.push(at)}return yt},[he]),ve=g.useMemo(()=>{const yt=he.map((at,Et)=>({leftPoint:new ue(at.leftPoint[0],at.leftPoint[1]).add(Ie[Et]),rightPoint:new ue(at.rightPoint[0],at.rightPoint[1]).add(Ie[Et])}));return!me.current&&yt.length!==0&&yt.push({leftPoint:new ue(he[he.length-1].rightPoint[0],he[he.length-1].rightPoint[1]).add(Ie[Ie.length-1]),rightPoint:new ue(he[0].leftPoint[0],he[0].leftPoint[1]).add(Ie[Ie.length-1])}),yt},[he,Ie]),ze=g.useMemo(()=>{const yt=he.map((at,Et)=>{const Lt=new ue(at.leftPoint[0],at.leftPoint[1]),Je=new ue(at.rightPoint[0],at.rightPoint[1]),st=new ue().subVectors(pe,Lt).setZ(0).normalize().multiplyScalar(k),It=new ue().subVectors(pe,Je).setZ(0).normalize().multiplyScalar(k);return Lt.add(st).setZ(Pe),Je.add(It).setZ(Pe),{leftPoint:Lt,rightPoint:Je}});return!me.current&&yt.length!==0&&yt.push({leftPoint:yt[yt.length-1].rightPoint,rightPoint:yt[0].leftPoint}),yt},[he,pe,k]),Ae=g.useMemo(()=>Ran.clone().multiplyScalar(u),[u]),se=g.useMemo(()=>{const yt=[];if(he.length<2)return yt;const at=le();for(let Et=0;Et0&&Lt.rightPoint.length>0&&(Lt.leftPoint[0]!==Lt.rightPoint[0]||Lt.leftPoint[1]!==Lt.rightPoint[1])){const Je=[];let{lh:st,rh:It}=Rn.getWallHeight(he,Et);me.current||(Et===0&&(st=he[0].lz),Et===he.length-1&&(It=he[he.length-1].lz));const ot=Rn.getIntersectionPoint(ve[(Et+ve.length-1)%ve.length].leftPoint,ve[(Et+ve.length-1)%ve.length].rightPoint,ve[Et].leftPoint,ve[Et].rightPoint).setZ(st-at).sub(pe),it=Rn.getIntersectionPoint(ve[Et].leftPoint,ve[Et].rightPoint,ve[(Et+1)%ve.length].leftPoint,ve[(Et+1)%ve.length].rightPoint).setZ(It-at).sub(pe),Be=ze[Et].leftPoint.clone().sub(pe),pt=ze[Et].rightPoint.clone().sub(pe),ct=new ue(Lt.cx,Lt.cy).sub(pe.clone().setZ(0)).length();Je.push(ot,it,pt,Be),Je.push(ot.clone().add(Ae),it.clone().add(Ae),pt.clone().add(Ae),Be.clone().add(Ae)),yt.push({points:Je,angle:-Lt.relativeAngle,length:ct})}}if(!me.current){const Et=ve.length-1,Lt=Rn.getIntersectionPoint(ve[Et-1].leftPoint,ve[Et-1].rightPoint,ve[Et].leftPoint,ve[Et].rightPoint).setZ(he[he.length-1].lz-at).sub(pe),Je=Rn.getIntersectionPoint(ve[Et].leftPoint,ve[Et].rightPoint,ve[0].leftPoint,ve[0].rightPoint).setZ(he[0].lz-at).sub(pe),st=ze[Et].leftPoint.clone().sub(pe),It=ze[Et].rightPoint.clone().sub(pe);let ot=Math.atan2(Je.y-Lt.y,Je.x-Lt.x);ot=ot>=0?ot:(fa+ot)%fa;const it=new ue().addVectors(Lt,Je).setZ(0).divideScalar(2).length(),Be=[];Be.push(Lt,Je,It,st),Be.push(Lt.clone().add(Ae),Je.clone().add(Ae),It.clone().add(Ae),st.clone().add(Ae)),yt.push({points:Be,angle:-ot,length:it})}return yt},[he,Pe,k,u]),ge=g.useMemo(()=>{const yt=new jl;if(ze.length>0){const at=ze[0].leftPoint.clone().sub(pe);yt.moveTo(at.x,at.y);for(const Et of ze){const Lt=Et.rightPoint.clone().sub(pe);yt.lineTo(Lt.x,Lt.y)}yt.closePath()}return yt},[he,ze]),we=g.useMemo(()=>{const yt=[];if(he.length===0)return yt;yt.push(new ue().fromArray(he[0].leftPoint));for(const at of he)yt.push(new ue().fromArray(at.rightPoint));return yt},[he]);g.useEffect(()=>{w!==k&&N(w)},[w]),g.useEffect(()=>{if(he.length>1){if(H.getState().addedRoofIdSet.has(n)){for(let yt=0;yt{for(const Et of at.elements)if(Et.id===he[yt].id&&Et.type===z.Wall){const Lt=Et;Lt.roofId=n,Lt.leftRoofHeight=void 0,Lt.rightRoofHeight=void 0;break}});H.getState().deleteAddedRoofId(n)}}else T(n,!1,!1,!0)},[he]),N3e(e,n,se,pe,Pe,u),g.useEffect(()=>{(P!==void 0||A!==void 0)&&b(yt=>{for(const at of yt.elements)if(at.type===z.Wall){const Et=at;Et.roofId===n&&(Et.centerLeftRoofHeight=void 0,Et.centerRightRoofHeight=void 0)}else at.type===z.Roof&&at.roofType===Zo.Mansard&&at.id===n&&(at.frontRidge=void 0,at.backRidge=void 0)})},[]);const Se=()=>{const yt=[];for(let Et=0;Et0&&Lt.rightPoint.length>0&&(Lt.leftPoint[0]!==Lt.rightPoint[0]||Lt.leftPoint[1]!==Lt.rightPoint[1])){let{lh:Je,rh:st}=Rn.getWallHeight(he,Et);me.current||(Et===0&&(Je=he[0].lz),Et===he.length-1&&(st=he[he.length-1].lz));const It=new ue(Lt.leftPoint[0],Lt.leftPoint[1],Je),ot=new ue(Lt.rightPoint[0],Lt.rightPoint[1],st),it=ze[Et].leftPoint.clone(),Be=ze[Et].rightPoint.clone();yt.push([It,ot,Be,it])}}if(!me.current){const Et=he.length-1,Lt=he[0],Je=he[Et],st=new ue(Je.rightPoint[0],Je.rightPoint[1],Je.lz),It=new ue(Lt.leftPoint[0],Lt.leftPoint[1],Lt.lz),ot=ze[Et].leftPoint.clone(),it=ze[Et].rightPoint.clone();yt.push([st,It,it,ot])}const at=ze.map(Et=>Et.leftPoint.clone());if(yt.push(at),ae){const Et=[];for(const Lt of yt.slice(0,-1))Et.push(Lt[0].clone());In.getState().setRoofSegmentVerticesWithoutOverhang(n,[Et])}else In.getState().setRoofSegmentVerticesWithoutOverhang(n,yt)},Me=zU(n,pe,se,ae,Zo.Mansard,ze.map(yt=>yt.leftPoint.clone().add(Ae)));DU(Se);const Ce=H.getState().world,Te=H(z0),Re=dt(vs),Ne=H(Df),_e=In(O1),[Ue,qe]=g.useState([]),[Fe,He]=g.useState(null),[Le,Ye]=g.useState(!1),lt=dt(n6),Oe=H(Y5),ut=H(J3),ht=H(K3),Qe=In(UN),nt=In.getState().hourlyHeatExchangeArrayMap,mt=g.useRef(null),tt=g.useRef(0),gt=g.useRef(),Ve=g.useRef(),{transparent:je,opacity:et}=pI();g.useEffect(()=>{if(Re)if(ae){const yt=_e(n);if(yt){const at=ye.fetchHeatmapTexture(yt,Ne??5);if(at){const Et=Me();if(Et&&Et.length>0&&e){const Lt=new cn(0,0,e.rotation[2],"ZYX");let Je=Number.MAX_VALUE,st=Number.MAX_VALUE,It=-Number.MAX_VALUE,ot=-Number.MAX_VALUE;for(const ft of Et)for(const wt of ft){const kt=wt.clone().applyEuler(Lt);kt.x>It&&(It=kt.x),kt.xot&&(ot=kt.y),kt.y{if(mt.current){const yt=ge.extractPoints(1).shape,at=.01,Et=mt.current.geometry,Lt=yt.length-1;if(Lt===4){const Je=new Float32Array(18);Je[0]=yt[3].x,Je[1]=yt[3].y,Je[2]=at,Je[3]=yt[0].x,Je[4]=yt[0].y,Je[5]=at,Je[6]=yt[2].x,Je[7]=yt[2].y,Je[8]=at,Je[9]=yt[2].x,Je[10]=yt[2].y,Je[11]=at,Je[12]=yt[0].x,Je[13]=yt[0].y,Je[14]=at,Je[15]=yt[1].x,Je[16]=yt[1].y,Je[17]=at,Et.setAttribute("position",new Ar(Je,3)),Et.computeVertexNormals();const st=Re?1:6,It=[];It.push(0,0),It.push(st,0),It.push(0,st),It.push(0,st),It.push(st,0),It.push(st,st),Et.setAttribute("uv",new Ar(It,2))}else{const Je=mt.current.geometry,st=new Float32Array(Lt*9),It=Re?1:6,ot=[];let it=Number.MAX_VALUE,Be=Number.MAX_VALUE,pt=-Number.MAX_VALUE,ct=-Number.MAX_VALUE;for(const wt of yt)wt.x>pt?pt=wt.x:wt.xct?ct=wt.y:wt.y{if(!lt||e&&e.notBuilding)return;const yt=nt.get(n+"-"+se.length);if(!yt)return;const at=yt.reduce((Dt,fn)=>Dt+fn,0),Et=Qe(n);if(!Et||!Et[se.length])return;const Lt=Et[se.length].map(Dt=>Dt.clone().sub(pe).add(new ue(0,0,pe.z+u)));if(!Lt)return;const Je=X3*(Ce.solarRadiationHeatmapGridCellSize??.5),st=Lt[0].clone(),It=Lt[1].clone(),ot=Lt[2].clone(),it=new ue().subVectors(It,st),Be=new ue().subVectors(ot,st),pt=new ue().subVectors(ot,It),ct=it.length(),Xe=new ue().crossVectors(Be,pt).length()/ct,ft=Math.max(2,Math.floor(ct/Je)),wt=Math.max(2,Math.floor(Xe/Je));it.normalize(),Be.normalize(),pt.normalize();const kt=new ue().crossVectors(Be,pt).normalize(),Zt=it.multiplyScalar(.5*ct/ft),Ot=new ue().crossVectors(kt,it).normalize().multiplyScalar(.5*Xe/wt),on=st.clone().add(Zt).add(Ot).add(new ue(0,0,u));Zt.multiplyScalar(2),Ot.multiplyScalar(2),gt.current=kt.clone().multiplyScalar(.1);const qt=[],rn=new ue,Pn=new Array;for(const Dt of Lt)Pn.push({x:Dt.x,y:Dt.y});const fo=ye.getPolygonArea(Pn);if(fo===0)return;const to=at/fo*(Oe??Ny);tt.current=to<0?1:0,Ve.current=new cn(-Math.sign(to)*$t,0,0);for(let Dt=0;Dtyt.elements.filter(at=>at.parentId===n&&at.type===z.Window),Qy),zt=g.useMemo(()=>Yt.map(yt=>{const at=new ue(yt.lx,yt.lz,yt.ly*2),Et=new ue(yt.cx,yt.cy,yt.cz).sub(pe),Lt=new cn().fromArray([yt.rotation[0],yt.rotation[1],yt.rotation[2],"ZXY"]),Je=new os(new V3(at.x,at.y,at.z));return Je.position.copy(Et),Je.rotation.copy(Lt),Je.updateMatrix(),Je}),[Yt,pe]),Rt=l===Yr.NoTexture&&s&&s===c,Ct=R&&!je;return h.jsxs("group",{name:`Mansard Roof Group ${n}`,children:[h.jsx("group",{name:`Mansard Roof Segments Group ${n}`,position:[pe.x,pe.y,pe.z],userData:St,onPointerDown:yt=>{HU(yt,e.id,n,se,pe)},onPointerMove:yt=>{IU(yt,n)},onPointerUp:yt=>{MU(yt,t)},onContextMenu:yt=>{HH(yt,n)},children:ae?h.jsx(nte,{id:n,foundationModel:e,roofType:m,roofSegments:se,center:new ue(pe.x,pe.y,Pe),thickness:u,lineWidth:p,lineColor:f,sideColor:c,color:Pt,textureType:l,heatmap:Fe}):h.jsxs(h.Fragment,{children:[se.map((yt,at,Et)=>h.jsx(IQ,{id:n,index:at,foundationModel:e,roofType:m,segment:yt,centroid:pe,thickness:u,color:Pt,sideColor:c,texture:S,heatmap:Ue&&at0&&h.jsx(Han,{roofSegments:se,thickness:u,lineColor:f,lineWidth:p})]})}),C&&x>0&&h.jsx(tU,{points:we,cz:he[0].lz}),v&&!d&&h.jsxs("group",{position:[pe.x,pe.y,pe.z+u],children:[h.jsx(mh,{position:[0,0,.3],onPointerDown:yt=>{if(Te(t.id,yt,er.Select),oe.current=!0,G.current=x,E(!0),Sse.set(pe.x,pe.y,Pe),e){const at=-Math.atan2($.position.x-r,$.position.y-i)-e.rotation[2];Tse.set(-$t,0,at,"ZXY")}j(Ur.Top),jn.getState().setEnableOrbitController(!1),b(at=>{at.resizeHandleType=xt.Top,at.selectedElementHeight=Pe+t.thickness})},onPointerOver:()=>{b(yt=>{yt.hoveredHandle=Ur.Top,yt.selectedElementHeight=Pe+t.thickness,yt.selectedElementX=pe.x,yt.selectedElementY=pe.y})}}),ze.map((yt,at)=>{const Et=yt.leftPoint.clone().sub(pe);return h.jsx(mh,{position:[Et.x,Et.y,0],onPointerDown:()=>{oe.current=!0,E(!0),Sse.set(Et.x,Et.y,Pe+.15),Tse.set(0,0,0),j(Ur.Ridge),O(at),W(he.reduce((Lt,Je)=>Math.min(Lt,new ue(Je.leftPoint[0],Je.leftPoint[1],Pe).distanceTo(pe)-1),1/0)),jn.getState().setEnableOrbitController(!1),_.current=k}},at)})]}),F&&h.jsx(yi,{name:"Roof Intersection Plane",ref:Q,args:[1e3,100],visible:!1,position:Sse,rotation:Tse,onPointerMove:yt=>{if(Q.current&&oe.current){te(yt);const at=M.intersectObjects([Q.current]);if(at[0]&&e){const Et=at[0].point;if(Et.z<.001)return;switch(L){case Ur.Top:{const Lt=Math.max(0,Et.z-e.lz-.6-ce);H.getState().updateRoofRiseById(n,Lt,Pe+t.thickness);break}case Ur.Ridge:{if(e&&Y!==null){const Lt=Et.clone().applyEuler(new cn(0,0,e.rotation[2])).sub(new ue(e.cx,e.cy)).setZ(0),Je=ne(Y),st=Lt.distanceTo(Je),It=new ue().subVectors(pe.clone().setZ(0),Je);Lt.clone().sub(Je).angleTo(It)<$t?N(ye.clamp(st,.5,U??It.length()-1)):N(.5)}break}}}}},onPointerUp:()=>{switch(L){case Ur.Top:{RU(n,G.current,x);break}case Ur.Ridge:{de(n,L,_.current,k);break}}b(yt=>{for(const at of yt.elements)if(at.id===n&&at.type===z.Roof&&at.roofType===Zo.Mansard){at.ridgeWidth=k;break}}),oe.current=!1,E(!1),j(Ur.Null),O(null),jn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:zr,transparent:!0,opacity:.5})}),bt&&bt.map((yt,at)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:yt,name:"Heat Flux "+at,lineWidth:ht??Uy,color:ut??Fu}),";",h.jsx(Rf,{userData:{unintersectable:!0},position:gt.current?yt[tt.current].clone().add(gt.current):yt[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:Ve.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:ut??Fu})})]},at))]})},Ian=xe.memo(Man,fI);/*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License @@ -4855,18 +4855,18 @@ PERFORMANCE OF THIS SOFTWARE. content: "" !important; display: none !important; }`,m0n=function(t){y0n(t,"."+kpe+p0n+JHe+` - .`+Fpe+g0n+JHe)},y0n=function(t,e){var n=t.ownerDocument;if(n){var o=n.createElement("style");o.textContent=e,t.appendChild(o)}},mot=function(){function t(){}return t.getOrigin=function(e){var n=t._link;return n?(n.href=e,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),A0n=function(){function t(e,n){this.context=e,this._options=n,this._cache={}}return t.prototype.addImage=function(e){var n=Promise.resolve();return this.has(e)||(_se(e)||b0n(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),n},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return wp(this,void 0,void 0,function(){var n,o,r,i,a=this;return ch(this,function(l){switch(l.label){case 0:return n=mot.isSameOrigin(e),o=!Ose(e)&&this._options.useCORS===!0&&ff.SUPPORT_CORS_IMAGES&&!n,r=!Ose(e)&&!n&&!_se(e)&&typeof this._options.proxy=="string"&&ff.SUPPORT_CORS_XHR&&!o,!n&&this._options.allowTaint===!1&&!Ose(e)&&!_se(e)&&!r&&!o?[2]:(i=e,r?[4,this.proxy(i)]:[3,2]);case 1:i=l.sent(),l.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(s,c){var u=new Image;u.onload=function(){return s(u)},u.onerror=c,(S0n(i)||o)&&(u.crossOrigin="anonymous"),u.src=i,u.complete===!0&&setTimeout(function(){return s(u)},500),a._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+a._options.imageTimeout+"ms) loading image")},a._options.imageTimeout)})];case 3:return[2,l.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var n=this,o=this._options.proxy;if(!o)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(i,a){var l=ff.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;s.onload=function(){if(s.status===200)if(l==="text")i(s.response);else{var d=new FileReader;d.addEventListener("load",function(){return i(d.result)},!1),d.addEventListener("error",function(f){return a(f)},!1),d.readAsDataURL(s.response)}else a("Failed to proxy resource "+r+" with status code "+s.status)},s.onerror=a;var c=o.indexOf("?")>-1?"&":"?";if(s.open("GET",""+o+c+"url="+encodeURIComponent(e)+"&responseType="+l),l!=="text"&&s instanceof XMLHttpRequest&&(s.responseType=l),n._options.imageTimeout){var u=n._options.imageTimeout;s.timeout=u,s.ontimeout=function(){return a("Timed out ("+u+"ms) proxying "+r)}}s.send()})},t}(),w0n=/^data:image\/svg\+xml/i,x0n=/^data:image\/.*;base64,/i,v0n=/^data:image\/.*/i,b0n=function(t){return ff.SUPPORT_SVG_DRAWING||!T0n(t)},Ose=function(t){return v0n.test(t)},S0n=function(t){return x0n.test(t)},_se=function(t){return t.substr(0,4)==="blob"},T0n=function(t){return t.substr(-3).toLowerCase()==="svg"||w0n.test(t)},Dr=function(){function t(e,n){this.type=0,this.x=e,this.y=n}return t.prototype.add=function(e,n){return new t(this.x+e,this.y+n)},t}(),VP=function(t,e,n){return new Dr(t.x+(e.x-t.x)*n,t.y+(e.y-t.y)*n)},H_=function(){function t(e,n,o,r){this.type=1,this.start=e,this.startControl=n,this.endControl=o,this.end=r}return t.prototype.subdivide=function(e,n){var o=VP(this.start,this.startControl,e),r=VP(this.startControl,this.endControl,e),i=VP(this.endControl,this.end,e),a=VP(o,r,e),l=VP(r,i,e),s=VP(a,l,e);return n?new t(this.start,o,a,s):new t(s,l,i,this.end)},t.prototype.add=function(e,n){return new t(this.start.add(e,n),this.startControl.add(e,n),this.endControl.add(e,n),this.end.add(e,n))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),hy=function(t){return t.type===1},P0n=function(){function t(e){var n=e.styles,o=e.bounds,r=nk(n.borderTopLeftRadius,o.width,o.height),i=r[0],a=r[1],l=nk(n.borderTopRightRadius,o.width,o.height),s=l[0],c=l[1],u=nk(n.borderBottomRightRadius,o.width,o.height),d=u[0],f=u[1],p=nk(n.borderBottomLeftRadius,o.width,o.height),m=p[0],y=p[1],w=[];w.push((i+s)/o.width),w.push((m+d)/o.width),w.push((a+y)/o.height),w.push((c+f)/o.height);var x=Math.max.apply(Math,w);x>1&&(i/=x,a/=x,s/=x,c/=x,d/=x,f/=x,m/=x,y/=x);var C=o.width-s,P=o.height-f,A=o.width-d,S=o.height-y,v=n.borderTopWidth,b=n.borderRightWidth,T=n.borderBottomWidth,R=n.borderLeftWidth,M=tc(n.paddingTop,e.bounds.width),D=tc(n.paddingRight,e.bounds.width),k=tc(n.paddingBottom,e.bounds.width),N=tc(n.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||a>0?Oc(o.left+R/3,o.top+v/3,i-R/3,a-v/3,as.TOP_LEFT):new Dr(o.left+R/3,o.top+v/3),this.topRightBorderDoubleOuterBox=i>0||a>0?Oc(o.left+C,o.top+v/3,s-b/3,c-v/3,as.TOP_RIGHT):new Dr(o.left+o.width-b/3,o.top+v/3),this.bottomRightBorderDoubleOuterBox=d>0||f>0?Oc(o.left+A,o.top+P,d-b/3,f-T/3,as.BOTTOM_RIGHT):new Dr(o.left+o.width-b/3,o.top+o.height-T/3),this.bottomLeftBorderDoubleOuterBox=m>0||y>0?Oc(o.left+R/3,o.top+S,m-R/3,y-T/3,as.BOTTOM_LEFT):new Dr(o.left+R/3,o.top+o.height-T/3),this.topLeftBorderDoubleInnerBox=i>0||a>0?Oc(o.left+R*2/3,o.top+v*2/3,i-R*2/3,a-v*2/3,as.TOP_LEFT):new Dr(o.left+R*2/3,o.top+v*2/3),this.topRightBorderDoubleInnerBox=i>0||a>0?Oc(o.left+C,o.top+v*2/3,s-b*2/3,c-v*2/3,as.TOP_RIGHT):new Dr(o.left+o.width-b*2/3,o.top+v*2/3),this.bottomRightBorderDoubleInnerBox=d>0||f>0?Oc(o.left+A,o.top+P,d-b*2/3,f-T*2/3,as.BOTTOM_RIGHT):new Dr(o.left+o.width-b*2/3,o.top+o.height-T*2/3),this.bottomLeftBorderDoubleInnerBox=m>0||y>0?Oc(o.left+R*2/3,o.top+S,m-R*2/3,y-T*2/3,as.BOTTOM_LEFT):new Dr(o.left+R*2/3,o.top+o.height-T*2/3),this.topLeftBorderStroke=i>0||a>0?Oc(o.left+R/2,o.top+v/2,i-R/2,a-v/2,as.TOP_LEFT):new Dr(o.left+R/2,o.top+v/2),this.topRightBorderStroke=i>0||a>0?Oc(o.left+C,o.top+v/2,s-b/2,c-v/2,as.TOP_RIGHT):new Dr(o.left+o.width-b/2,o.top+v/2),this.bottomRightBorderStroke=d>0||f>0?Oc(o.left+A,o.top+P,d-b/2,f-T/2,as.BOTTOM_RIGHT):new Dr(o.left+o.width-b/2,o.top+o.height-T/2),this.bottomLeftBorderStroke=m>0||y>0?Oc(o.left+R/2,o.top+S,m-R/2,y-T/2,as.BOTTOM_LEFT):new Dr(o.left+R/2,o.top+o.height-T/2),this.topLeftBorderBox=i>0||a>0?Oc(o.left,o.top,i,a,as.TOP_LEFT):new Dr(o.left,o.top),this.topRightBorderBox=s>0||c>0?Oc(o.left+C,o.top,s,c,as.TOP_RIGHT):new Dr(o.left+o.width,o.top),this.bottomRightBorderBox=d>0||f>0?Oc(o.left+A,o.top+P,d,f,as.BOTTOM_RIGHT):new Dr(o.left+o.width,o.top+o.height),this.bottomLeftBorderBox=m>0||y>0?Oc(o.left,o.top+S,m,y,as.BOTTOM_LEFT):new Dr(o.left,o.top+o.height),this.topLeftPaddingBox=i>0||a>0?Oc(o.left+R,o.top+v,Math.max(0,i-R),Math.max(0,a-v),as.TOP_LEFT):new Dr(o.left+R,o.top+v),this.topRightPaddingBox=s>0||c>0?Oc(o.left+Math.min(C,o.width-b),o.top+v,C>o.width+b?0:Math.max(0,s-b),Math.max(0,c-v),as.TOP_RIGHT):new Dr(o.left+o.width-b,o.top+v),this.bottomRightPaddingBox=d>0||f>0?Oc(o.left+Math.min(A,o.width-R),o.top+Math.min(P,o.height-T),Math.max(0,d-b),Math.max(0,f-T),as.BOTTOM_RIGHT):new Dr(o.left+o.width-b,o.top+o.height-T),this.bottomLeftPaddingBox=m>0||y>0?Oc(o.left+R,o.top+Math.min(S,o.height-T),Math.max(0,m-R),Math.max(0,y-T),as.BOTTOM_LEFT):new Dr(o.left+R,o.top+o.height-T),this.topLeftContentBox=i>0||a>0?Oc(o.left+R+N,o.top+v+M,Math.max(0,i-(R+N)),Math.max(0,a-(v+M)),as.TOP_LEFT):new Dr(o.left+R+N,o.top+v+M),this.topRightContentBox=s>0||c>0?Oc(o.left+Math.min(C,o.width+R+N),o.top+v+M,C>o.width+R+N?0:s-R+N,c-(v+M),as.TOP_RIGHT):new Dr(o.left+o.width-(b+D),o.top+v+M),this.bottomRightContentBox=d>0||f>0?Oc(o.left+Math.min(A,o.width-(R+N)),o.top+Math.min(P,o.height+v+M),Math.max(0,d-(b+D)),f-(T+k),as.BOTTOM_RIGHT):new Dr(o.left+o.width-(b+D),o.top+o.height-(T+k)),this.bottomLeftContentBox=m>0||y>0?Oc(o.left+R+N,o.top+S,Math.max(0,m-(R+N)),y-(T+k),as.BOTTOM_LEFT):new Dr(o.left+R+N,o.top+o.height-(T+k))}return t}(),as;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(as||(as={}));var Oc=function(t,e,n,o,r){var i=4*((Math.sqrt(2)-1)/3),a=n*i,l=o*i,s=t+n,c=e+o;switch(r){case as.TOP_LEFT:return new H_(new Dr(t,c),new Dr(t,c-l),new Dr(s-a,e),new Dr(s,e));case as.TOP_RIGHT:return new H_(new Dr(t,e),new Dr(t+a,e),new Dr(s,c-l),new Dr(s,c));case as.BOTTOM_RIGHT:return new H_(new Dr(s,e),new Dr(s,e+l),new Dr(t+a,c),new Dr(t,c));case as.BOTTOM_LEFT:default:return new H_(new Dr(s,c),new Dr(s-a,c),new Dr(t,e+l),new Dr(t,e))}},CJ=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},C0n=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},RJ=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},R0n=function(){function t(e,n,o){this.offsetX=e,this.offsetY=n,this.matrix=o,this.type=0,this.target=6}return t}(),M_=function(){function t(e,n){this.path=e,this.target=n,this.type=1}return t}(),H0n=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),M0n=function(t){return t.type===0},yot=function(t){return t.type===1},I0n=function(t){return t.type===2},KHe=function(t,e){return t.length===e.length?t.some(function(n,o){return n===e[o]}):!1},z0n=function(t,e,n,o,r){return t.map(function(i,a){switch(a){case 0:return i.add(e,n);case 1:return i.add(e+o,n);case 2:return i.add(e+o,n+r);case 3:return i.add(e,n+r)}return i})},Aot=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),wot=function(){function t(e,n){if(this.container=e,this.parent=n,this.effects=[],this.curves=new P0n(this.container),this.container.styles.opacity<1&&this.effects.push(new H0n(this.container.styles.opacity)),this.container.styles.transform!==null){var o=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new R0n(o,r,i))}if(this.container.styles.overflowX!==0){var a=CJ(this.curves),l=RJ(this.curves);KHe(a,l)?this.effects.push(new M_(a,6)):(this.effects.push(new M_(a,2)),this.effects.push(new M_(l,4)))}}return t.prototype.getEffects=function(e){for(var n=[2,3].indexOf(this.container.styles.position)===-1,o=this.parent,r=this.effects.slice(0);o;){var i=o.effects.filter(function(s){return!yot(s)});if(n||o.container.styles.position!==0||!o.parent){if(r.unshift.apply(r,i),n=[2,3].indexOf(o.container.styles.position)===-1,o.container.styles.overflowX!==0){var a=CJ(o.curves),l=RJ(o.curves);KHe(a,l)||r.unshift(new M_(l,6))}}else r.unshift.apply(r,i);o=o.parent}return r.filter(function(s){return Y0(s.target,e)})},t}(),Lpe=function(t,e,n,o){t.container.elements.forEach(function(r){var i=Y0(r.flags,4),a=Y0(r.flags,2),l=new wot(r,t);Y0(r.styles.display,2048)&&o.push(l);var s=Y0(r.flags,8)?[]:o;if(i||a){var c=i||r.styles.isPositioned()?n:e,u=new Aot(l);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var d=r.styles.zIndex.order;if(d<0){var f=0;c.negativeZIndex.some(function(m,y){return d>m.element.container.styles.zIndex.order?(f=y,!1):f>0}),c.negativeZIndex.splice(f,0,u)}else if(d>0){var p=0;c.positiveZIndex.some(function(m,y){return d>=m.element.container.styles.zIndex.order?(p=y+1,!1):p>0}),c.positiveZIndex.splice(p,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Lpe(l,u,i?u:n,s)}else r.styles.isInlineLevel()?e.inlineLevel.push(l):e.nonInlineLevel.push(l),Lpe(l,e,n,s);Y0(r.flags,8)&&xot(r,s)})},xot=function(t,e){for(var n=t instanceof zpe?t.start:1,o=t instanceof zpe?t.reversed:!1,r=0;r"u"?t[0]:n},U0n=function(t,e,n,o,r){var i=e[0],a=e[1],l=n[0],s=n[1];switch(t){case 2:return[new Dr(Math.round(o.left),Math.round(o.top+a)),new Dr(Math.round(o.left+o.width),Math.round(o.top+a)),new Dr(Math.round(o.left+o.width),Math.round(s+o.top+a)),new Dr(Math.round(o.left),Math.round(s+o.top+a))];case 3:return[new Dr(Math.round(o.left+i),Math.round(o.top)),new Dr(Math.round(o.left+i+l),Math.round(o.top)),new Dr(Math.round(o.left+i+l),Math.round(o.height+o.top)),new Dr(Math.round(o.left+i),Math.round(o.height+o.top))];case 1:return[new Dr(Math.round(o.left+i),Math.round(o.top+a)),new Dr(Math.round(o.left+i+l),Math.round(o.top+a)),new Dr(Math.round(o.left+i+l),Math.round(o.top+a+s)),new Dr(Math.round(o.left+i),Math.round(o.top+a+s))];default:return[new Dr(Math.round(r.left),Math.round(r.top)),new Dr(Math.round(r.left+r.width),Math.round(r.top)),new Dr(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Dr(Math.round(r.left),Math.round(r.height+r.top))]}},j0n="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",qHe="Hidden Text",B0n=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,n){var o=this._document.createElement("div"),r=this._document.createElement("img"),i=this._document.createElement("span"),a=this._document.body;o.style.visibility="hidden",o.style.fontFamily=e,o.style.fontSize=n,o.style.margin="0",o.style.padding="0",o.style.whiteSpace="nowrap",a.appendChild(o),r.src=j0n,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",i.style.fontFamily=e,i.style.fontSize=n,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(qHe)),o.appendChild(i),o.appendChild(r);var l=r.offsetTop-i.offsetTop+2;o.removeChild(i),o.appendChild(this._document.createTextNode(qHe)),o.style.lineHeight="normal",r.style.verticalAlign="super";var s=r.offsetTop-o.offsetTop+2;return a.removeChild(o),{baseline:l,middle:s}},t.prototype.getMetrics=function(e,n){var o=e+" "+n;return typeof this._data[o]>"u"&&(this._data[o]=this.parseMetrics(e,n)),this._data[o]},t}(),bot=function(){function t(e,n){this.context=e,this.options=n}return t}(),Y0n=1e4,O0n=function(t){G5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r._activeEffects=[],r.canvas=o.canvas?o.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),o.canvas||(r.canvas.width=Math.floor(o.width*o.scale),r.canvas.height=Math.floor(o.height*o.scale),r.canvas.style.width=o.width+"px",r.canvas.style.height=o.height+"px"),r.fontMetrics=new B0n(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-o.x,-o.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+o.width+"x"+o.height+") with scale "+o.scale),r}return e.prototype.applyEffects=function(n){for(var o=this;this._activeEffects.length;)this.popEffect();n.forEach(function(r){return o.applyEffect(r)})},e.prototype.applyEffect=function(n){this.ctx.save(),I0n(n)&&(this.ctx.globalAlpha=n.opacity),M0n(n)&&(this.ctx.translate(n.offsetX,n.offsetY),this.ctx.transform(n.matrix[0],n.matrix[1],n.matrix[2],n.matrix[3],n.matrix[4],n.matrix[5]),this.ctx.translate(-n.offsetX,-n.offsetY)),yot(n)&&(this.path(n.path),this.ctx.clip()),this._activeEffects.push(n)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(n){return wp(this,void 0,void 0,function(){var o;return ch(this,function(r){switch(r.label){case 0:return o=n.element.container.styles,o.isVisible()?[4,this.renderStackContent(n)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(n){return wp(this,void 0,void 0,function(){return ch(this,function(o){switch(o.label){case 0:if(Y0(n.container.flags,16))debugger;return n.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(n)]:[3,3];case 1:return o.sent(),[4,this.renderNodeContent(n)];case 2:o.sent(),o.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(n,o,r){var i=this;if(o===0)this.ctx.fillText(n.text,n.bounds.left,n.bounds.top+r);else{var a=z3e(n.text);a.reduce(function(l,s){return i.ctx.fillText(s,l,n.bounds.top+r),l+i.ctx.measureText(s).width},n.bounds.left)}},e.prototype.createFontStyle=function(n){var o=n.fontVariant.filter(function(a){return a==="normal"||a==="small-caps"}).join(""),r=J0n(n.fontFamily).join(", "),i=CU(n.fontSize)?""+n.fontSize.number+n.fontSize.unit:n.fontSize.number+"px";return[[n.fontStyle,o,n.fontWeight,i,r].join(" "),r,i]},e.prototype.renderTextNode=function(n,o){return wp(this,void 0,void 0,function(){var r,i,a,l,s,c,u,d,f=this;return ch(this,function(p){return r=this.createFontStyle(o),i=r[0],a=r[1],l=r[2],this.ctx.font=i,this.ctx.direction=o.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",s=this.fontMetrics.getMetrics(a,l),c=s.baseline,u=s.middle,d=o.paintOrder,n.textBounds.forEach(function(m){d.forEach(function(y){switch(y){case 0:f.ctx.fillStyle=bd(o.color),f.renderTextWithLetterSpacing(m,o.letterSpacing,c);var w=o.textShadow;w.length&&m.text.trim().length&&(w.slice(0).reverse().forEach(function(x){f.ctx.shadowColor=bd(x.color),f.ctx.shadowOffsetX=x.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=x.offsetY.number*f.options.scale,f.ctx.shadowBlur=x.blur.number,f.renderTextWithLetterSpacing(m,o.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),o.textDecorationLine.length&&(f.ctx.fillStyle=bd(o.textDecorationColor||o.color),o.textDecorationLine.forEach(function(x){switch(x){case 1:f.ctx.fillRect(m.bounds.left,Math.round(m.bounds.top+c),m.bounds.width,1);break;case 2:f.ctx.fillRect(m.bounds.left,Math.round(m.bounds.top),m.bounds.width,1);break;case 3:f.ctx.fillRect(m.bounds.left,Math.ceil(m.bounds.top+u),m.bounds.width,1);break}}));break;case 1:o.webkitTextStrokeWidth&&m.text.trim().length&&(f.ctx.strokeStyle=bd(o.webkitTextStrokeColor),f.ctx.lineWidth=o.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(m.text,m.bounds.left,m.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(n,o,r){if(r&&n.intrinsicWidth>0&&n.intrinsicHeight>0){var i=HJ(n),a=RJ(o);this.path(a),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,n.intrinsicWidth,n.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(n){return wp(this,void 0,void 0,function(){var o,r,i,a,l,s,C,C,c,u,d,f,A,p,m,S,y,w,x,C,P,A,S;return ch(this,function(v){switch(v.label){case 0:this.applyEffects(n.getEffects(4)),o=n.container,r=n.curves,i=o.styles,a=0,l=o.textNodes,v.label=1;case 1:return a0&&U>0&&(T=i.ctx.createPattern(S,"repeat"),i.renderRepeat(M,T,F,E))):Isn(u)&&(R=Vse(n,o,[null,null,null]),M=R[0],D=R[1],k=R[2],N=R[3],U=R[4],W=u.position.length===0?[H3e]:u.position,F=tc(W[0],N),E=tc(W[W.length-1],U),L=Psn(u,F,E,N,U),j=L[0],Y=L[1],j>0&&Y>0&&(O=i.ctx.createRadialGradient(D+F,k+E,0,D+F,k+E,j),wHe(u.stops,j*2).forEach(function(q){return O.addColorStop(q.stop,bd(q.color))}),i.path(M),i.ctx.fillStyle=O,j!==Y?(_=n.bounds.left+.5*n.bounds.width,G=n.bounds.top+.5*n.bounds.height,Q=Y/j,oe=1/Q,i.ctx.save(),i.ctx.translate(_,G),i.ctx.transform(1,0,0,Q,0,0),i.ctx.translate(-_,-G),i.ctx.fillRect(D,oe*(k-G)+G,N,U*oe),i.ctx.restore()):i.ctx.fill())),ee.label=6;case 6:return o--,[2]}})},i=this,a=0,l=n.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return a0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,3)];case 6:return f.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,l,n.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,l,n.curves)];case 10:f.sent(),f.label=11;case 11:l++,f.label=12;case 12:return s++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(n,o,r,i,a){return wp(this,void 0,void 0,function(){var l,s,c,u,d,f,p,m,y,w,x,C,P,A,S,v,S,v;return ch(this,function(b){return this.ctx.save(),l=F0n(i,r),s=$He(i,r),a===2&&(this.path(s),this.ctx.clip()),hy(s[0])?(c=s[0].start.x,u=s[0].start.y):(c=s[0].x,u=s[0].y),hy(s[1])?(d=s[1].end.x,f=s[1].end.y):(d=s[1].x,f=s[1].y),r===0||r===2?p=Math.abs(c-d):p=Math.abs(u-f),this.ctx.beginPath(),a===3?this.formatPath(l):this.formatPath(s.slice(0,2)),m=o<3?o*3:o*2,y=o<3?o*2:o,a===3&&(m=o,y=o),w=!0,p<=m*2?w=!1:p<=m*2+y?(x=p/(2*m+y),m*=x,y*=x):(C=Math.floor((p+y)/(m+y)),P=(p-C*m)/(C-1),A=(p-(C+1)*m)/C,y=A<=0||Math.abs(y-P)"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function o(c,u,d){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){s(f.response,u,d)},f.onerror=function(){console.error("could not download file")},f.send()}function r(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function i(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof Rc=="object"&&Rc.global===Rc?Rc:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,u,d){var f=a.URL||a.webkitURL,p=document.createElement("a");u=u||c.name||"download",p.download=u,p.rel="noopener",typeof c=="string"?(p.href=c,p.origin===location.origin?i(p):r(p.href)?o(c,u,d):i(p,p.target="_blank")):(p.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){i(p)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(n(c,d),u);else if(r(c))o(c,u,d);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){i(f)})}}:function(c,u,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return o(c,u,d);var p=c.type==="application/octet-stream",m=/constructor/i.test(a.HTMLElement)||a.safari,y=/CriOS\/[\d]+/.test(navigator.userAgent);if((y||p&&m||l)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var P=w.result;P=y?P:P.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=P:location=P,f=null},w.readAsDataURL(c)}else{var x=a.URL||a.webkitURL,C=x.createObjectURL(c);f?f.location=C:location.href=C,f=null,setTimeout(function(){x.revokeObjectURL(C)},4e4)}});a.saveAs=s.saveAs=s,t.exports=s})})(Sot);var Tot=Sot.exports;const ndn=()=>{window.open("https://intofuture.org/aladdin.html","_blank")},odn=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=satellite¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",rdn=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=roadmap&style=feature:poi|element:labels|visibility:off¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",d5=(t,e)=>{Dp.success({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},yn=(t,e)=>{Dp.info({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},RH=(t,e)=>{Dp.warning({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},co=(t,e)=>{Dp.error({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},idn=(t,e)=>{const n={lng:H.getState().language};Dp.info({duration:3,content:h.jsxs(Jt,{direction:"horizontal",children:[h.jsx("span",{children:t}),h.jsx(oo,{type:"primary",title:B.t("menu.edit.Undo",n),onClick:()=>{H.getState().undoManager.undo()&&setTimeout(()=>{yn(B.t("menu.edit.Undone",n),Ob)},500),H.getState().loggable&&H.getState().logAction("Undo"),Dp.destroy()},children:B.t("menu.edit.Undo",n)}),h.jsx(oo,{type:"primary",title:B.t("message.DoNotShowAgain",n),onClick:()=>{dt.getState().set(o=>{o.muteUndoMessage=!0}),Dp.destroy()},children:B.t("word.Mute",n)})]}),style:{color:"black"},onClick:()=>{Dp.destroy()}})},adn=(t,e)=>{const n=document.createElement("a");n.download=t,n.href=e,n.click()},Yd=async(t,e,n)=>{const o=window.document.getElementById(t);if(o){const r=await Z0n(o,{...n,removeContainer:!0}),i=document.createElement("a");i.href=r.toDataURL("image/png",1),i.download=`${e}.png`,i.click()}else throw new Error(`Cannot find element with ID ${t}`)},Yh=(t,e)=>{let n="";for(const r of Object.keys(t[0]))n+=r+", ";n+=` + .`+Fpe+g0n+JHe)},y0n=function(t,e){var n=t.ownerDocument;if(n){var o=n.createElement("style");o.textContent=e,t.appendChild(o)}},mot=function(){function t(){}return t.getOrigin=function(e){var n=t._link;return n?(n.href=e,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),A0n=function(){function t(e,n){this.context=e,this._options=n,this._cache={}}return t.prototype.addImage=function(e){var n=Promise.resolve();return this.has(e)||(_se(e)||b0n(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),n},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return wp(this,void 0,void 0,function(){var n,o,r,i,a=this;return ch(this,function(l){switch(l.label){case 0:return n=mot.isSameOrigin(e),o=!Ose(e)&&this._options.useCORS===!0&&ff.SUPPORT_CORS_IMAGES&&!n,r=!Ose(e)&&!n&&!_se(e)&&typeof this._options.proxy=="string"&&ff.SUPPORT_CORS_XHR&&!o,!n&&this._options.allowTaint===!1&&!Ose(e)&&!_se(e)&&!r&&!o?[2]:(i=e,r?[4,this.proxy(i)]:[3,2]);case 1:i=l.sent(),l.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(s,c){var u=new Image;u.onload=function(){return s(u)},u.onerror=c,(S0n(i)||o)&&(u.crossOrigin="anonymous"),u.src=i,u.complete===!0&&setTimeout(function(){return s(u)},500),a._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+a._options.imageTimeout+"ms) loading image")},a._options.imageTimeout)})];case 3:return[2,l.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var n=this,o=this._options.proxy;if(!o)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(i,a){var l=ff.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;s.onload=function(){if(s.status===200)if(l==="text")i(s.response);else{var d=new FileReader;d.addEventListener("load",function(){return i(d.result)},!1),d.addEventListener("error",function(f){return a(f)},!1),d.readAsDataURL(s.response)}else a("Failed to proxy resource "+r+" with status code "+s.status)},s.onerror=a;var c=o.indexOf("?")>-1?"&":"?";if(s.open("GET",""+o+c+"url="+encodeURIComponent(e)+"&responseType="+l),l!=="text"&&s instanceof XMLHttpRequest&&(s.responseType=l),n._options.imageTimeout){var u=n._options.imageTimeout;s.timeout=u,s.ontimeout=function(){return a("Timed out ("+u+"ms) proxying "+r)}}s.send()})},t}(),w0n=/^data:image\/svg\+xml/i,x0n=/^data:image\/.*;base64,/i,v0n=/^data:image\/.*/i,b0n=function(t){return ff.SUPPORT_SVG_DRAWING||!T0n(t)},Ose=function(t){return v0n.test(t)},S0n=function(t){return x0n.test(t)},_se=function(t){return t.substr(0,4)==="blob"},T0n=function(t){return t.substr(-3).toLowerCase()==="svg"||w0n.test(t)},Dr=function(){function t(e,n){this.type=0,this.x=e,this.y=n}return t.prototype.add=function(e,n){return new t(this.x+e,this.y+n)},t}(),VP=function(t,e,n){return new Dr(t.x+(e.x-t.x)*n,t.y+(e.y-t.y)*n)},H_=function(){function t(e,n,o,r){this.type=1,this.start=e,this.startControl=n,this.endControl=o,this.end=r}return t.prototype.subdivide=function(e,n){var o=VP(this.start,this.startControl,e),r=VP(this.startControl,this.endControl,e),i=VP(this.endControl,this.end,e),a=VP(o,r,e),l=VP(r,i,e),s=VP(a,l,e);return n?new t(this.start,o,a,s):new t(s,l,i,this.end)},t.prototype.add=function(e,n){return new t(this.start.add(e,n),this.startControl.add(e,n),this.endControl.add(e,n),this.end.add(e,n))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),hy=function(t){return t.type===1},P0n=function(){function t(e){var n=e.styles,o=e.bounds,r=nk(n.borderTopLeftRadius,o.width,o.height),i=r[0],a=r[1],l=nk(n.borderTopRightRadius,o.width,o.height),s=l[0],c=l[1],u=nk(n.borderBottomRightRadius,o.width,o.height),d=u[0],f=u[1],p=nk(n.borderBottomLeftRadius,o.width,o.height),m=p[0],y=p[1],w=[];w.push((i+s)/o.width),w.push((m+d)/o.width),w.push((a+y)/o.height),w.push((c+f)/o.height);var x=Math.max.apply(Math,w);x>1&&(i/=x,a/=x,s/=x,c/=x,d/=x,f/=x,m/=x,y/=x);var C=o.width-s,P=o.height-f,A=o.width-d,S=o.height-y,v=n.borderTopWidth,b=n.borderRightWidth,T=n.borderBottomWidth,R=n.borderLeftWidth,M=tc(n.paddingTop,e.bounds.width),D=tc(n.paddingRight,e.bounds.width),k=tc(n.paddingBottom,e.bounds.width),N=tc(n.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||a>0?Oc(o.left+R/3,o.top+v/3,i-R/3,a-v/3,as.TOP_LEFT):new Dr(o.left+R/3,o.top+v/3),this.topRightBorderDoubleOuterBox=i>0||a>0?Oc(o.left+C,o.top+v/3,s-b/3,c-v/3,as.TOP_RIGHT):new Dr(o.left+o.width-b/3,o.top+v/3),this.bottomRightBorderDoubleOuterBox=d>0||f>0?Oc(o.left+A,o.top+P,d-b/3,f-T/3,as.BOTTOM_RIGHT):new Dr(o.left+o.width-b/3,o.top+o.height-T/3),this.bottomLeftBorderDoubleOuterBox=m>0||y>0?Oc(o.left+R/3,o.top+S,m-R/3,y-T/3,as.BOTTOM_LEFT):new Dr(o.left+R/3,o.top+o.height-T/3),this.topLeftBorderDoubleInnerBox=i>0||a>0?Oc(o.left+R*2/3,o.top+v*2/3,i-R*2/3,a-v*2/3,as.TOP_LEFT):new Dr(o.left+R*2/3,o.top+v*2/3),this.topRightBorderDoubleInnerBox=i>0||a>0?Oc(o.left+C,o.top+v*2/3,s-b*2/3,c-v*2/3,as.TOP_RIGHT):new Dr(o.left+o.width-b*2/3,o.top+v*2/3),this.bottomRightBorderDoubleInnerBox=d>0||f>0?Oc(o.left+A,o.top+P,d-b*2/3,f-T*2/3,as.BOTTOM_RIGHT):new Dr(o.left+o.width-b*2/3,o.top+o.height-T*2/3),this.bottomLeftBorderDoubleInnerBox=m>0||y>0?Oc(o.left+R*2/3,o.top+S,m-R*2/3,y-T*2/3,as.BOTTOM_LEFT):new Dr(o.left+R*2/3,o.top+o.height-T*2/3),this.topLeftBorderStroke=i>0||a>0?Oc(o.left+R/2,o.top+v/2,i-R/2,a-v/2,as.TOP_LEFT):new Dr(o.left+R/2,o.top+v/2),this.topRightBorderStroke=i>0||a>0?Oc(o.left+C,o.top+v/2,s-b/2,c-v/2,as.TOP_RIGHT):new Dr(o.left+o.width-b/2,o.top+v/2),this.bottomRightBorderStroke=d>0||f>0?Oc(o.left+A,o.top+P,d-b/2,f-T/2,as.BOTTOM_RIGHT):new Dr(o.left+o.width-b/2,o.top+o.height-T/2),this.bottomLeftBorderStroke=m>0||y>0?Oc(o.left+R/2,o.top+S,m-R/2,y-T/2,as.BOTTOM_LEFT):new Dr(o.left+R/2,o.top+o.height-T/2),this.topLeftBorderBox=i>0||a>0?Oc(o.left,o.top,i,a,as.TOP_LEFT):new Dr(o.left,o.top),this.topRightBorderBox=s>0||c>0?Oc(o.left+C,o.top,s,c,as.TOP_RIGHT):new Dr(o.left+o.width,o.top),this.bottomRightBorderBox=d>0||f>0?Oc(o.left+A,o.top+P,d,f,as.BOTTOM_RIGHT):new Dr(o.left+o.width,o.top+o.height),this.bottomLeftBorderBox=m>0||y>0?Oc(o.left,o.top+S,m,y,as.BOTTOM_LEFT):new Dr(o.left,o.top+o.height),this.topLeftPaddingBox=i>0||a>0?Oc(o.left+R,o.top+v,Math.max(0,i-R),Math.max(0,a-v),as.TOP_LEFT):new Dr(o.left+R,o.top+v),this.topRightPaddingBox=s>0||c>0?Oc(o.left+Math.min(C,o.width-b),o.top+v,C>o.width+b?0:Math.max(0,s-b),Math.max(0,c-v),as.TOP_RIGHT):new Dr(o.left+o.width-b,o.top+v),this.bottomRightPaddingBox=d>0||f>0?Oc(o.left+Math.min(A,o.width-R),o.top+Math.min(P,o.height-T),Math.max(0,d-b),Math.max(0,f-T),as.BOTTOM_RIGHT):new Dr(o.left+o.width-b,o.top+o.height-T),this.bottomLeftPaddingBox=m>0||y>0?Oc(o.left+R,o.top+Math.min(S,o.height-T),Math.max(0,m-R),Math.max(0,y-T),as.BOTTOM_LEFT):new Dr(o.left+R,o.top+o.height-T),this.topLeftContentBox=i>0||a>0?Oc(o.left+R+N,o.top+v+M,Math.max(0,i-(R+N)),Math.max(0,a-(v+M)),as.TOP_LEFT):new Dr(o.left+R+N,o.top+v+M),this.topRightContentBox=s>0||c>0?Oc(o.left+Math.min(C,o.width+R+N),o.top+v+M,C>o.width+R+N?0:s-R+N,c-(v+M),as.TOP_RIGHT):new Dr(o.left+o.width-(b+D),o.top+v+M),this.bottomRightContentBox=d>0||f>0?Oc(o.left+Math.min(A,o.width-(R+N)),o.top+Math.min(P,o.height+v+M),Math.max(0,d-(b+D)),f-(T+k),as.BOTTOM_RIGHT):new Dr(o.left+o.width-(b+D),o.top+o.height-(T+k)),this.bottomLeftContentBox=m>0||y>0?Oc(o.left+R+N,o.top+S,Math.max(0,m-(R+N)),y-(T+k),as.BOTTOM_LEFT):new Dr(o.left+R+N,o.top+o.height-(T+k))}return t}(),as;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(as||(as={}));var Oc=function(t,e,n,o,r){var i=4*((Math.sqrt(2)-1)/3),a=n*i,l=o*i,s=t+n,c=e+o;switch(r){case as.TOP_LEFT:return new H_(new Dr(t,c),new Dr(t,c-l),new Dr(s-a,e),new Dr(s,e));case as.TOP_RIGHT:return new H_(new Dr(t,e),new Dr(t+a,e),new Dr(s,c-l),new Dr(s,c));case as.BOTTOM_RIGHT:return new H_(new Dr(s,e),new Dr(s,e+l),new Dr(t+a,c),new Dr(t,c));case as.BOTTOM_LEFT:default:return new H_(new Dr(s,c),new Dr(s-a,c),new Dr(t,e+l),new Dr(t,e))}},CJ=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},C0n=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},RJ=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},R0n=function(){function t(e,n,o){this.offsetX=e,this.offsetY=n,this.matrix=o,this.type=0,this.target=6}return t}(),M_=function(){function t(e,n){this.path=e,this.target=n,this.type=1}return t}(),H0n=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),M0n=function(t){return t.type===0},yot=function(t){return t.type===1},I0n=function(t){return t.type===2},KHe=function(t,e){return t.length===e.length?t.some(function(n,o){return n===e[o]}):!1},z0n=function(t,e,n,o,r){return t.map(function(i,a){switch(a){case 0:return i.add(e,n);case 1:return i.add(e+o,n);case 2:return i.add(e+o,n+r);case 3:return i.add(e,n+r)}return i})},Aot=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),wot=function(){function t(e,n){if(this.container=e,this.parent=n,this.effects=[],this.curves=new P0n(this.container),this.container.styles.opacity<1&&this.effects.push(new H0n(this.container.styles.opacity)),this.container.styles.transform!==null){var o=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new R0n(o,r,i))}if(this.container.styles.overflowX!==0){var a=CJ(this.curves),l=RJ(this.curves);KHe(a,l)?this.effects.push(new M_(a,6)):(this.effects.push(new M_(a,2)),this.effects.push(new M_(l,4)))}}return t.prototype.getEffects=function(e){for(var n=[2,3].indexOf(this.container.styles.position)===-1,o=this.parent,r=this.effects.slice(0);o;){var i=o.effects.filter(function(s){return!yot(s)});if(n||o.container.styles.position!==0||!o.parent){if(r.unshift.apply(r,i),n=[2,3].indexOf(o.container.styles.position)===-1,o.container.styles.overflowX!==0){var a=CJ(o.curves),l=RJ(o.curves);KHe(a,l)||r.unshift(new M_(l,6))}}else r.unshift.apply(r,i);o=o.parent}return r.filter(function(s){return Y0(s.target,e)})},t}(),Lpe=function(t,e,n,o){t.container.elements.forEach(function(r){var i=Y0(r.flags,4),a=Y0(r.flags,2),l=new wot(r,t);Y0(r.styles.display,2048)&&o.push(l);var s=Y0(r.flags,8)?[]:o;if(i||a){var c=i||r.styles.isPositioned()?n:e,u=new Aot(l);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var d=r.styles.zIndex.order;if(d<0){var f=0;c.negativeZIndex.some(function(m,y){return d>m.element.container.styles.zIndex.order?(f=y,!1):f>0}),c.negativeZIndex.splice(f,0,u)}else if(d>0){var p=0;c.positiveZIndex.some(function(m,y){return d>=m.element.container.styles.zIndex.order?(p=y+1,!1):p>0}),c.positiveZIndex.splice(p,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Lpe(l,u,i?u:n,s)}else r.styles.isInlineLevel()?e.inlineLevel.push(l):e.nonInlineLevel.push(l),Lpe(l,e,n,s);Y0(r.flags,8)&&xot(r,s)})},xot=function(t,e){for(var n=t instanceof zpe?t.start:1,o=t instanceof zpe?t.reversed:!1,r=0;r"u"?t[0]:n},U0n=function(t,e,n,o,r){var i=e[0],a=e[1],l=n[0],s=n[1];switch(t){case 2:return[new Dr(Math.round(o.left),Math.round(o.top+a)),new Dr(Math.round(o.left+o.width),Math.round(o.top+a)),new Dr(Math.round(o.left+o.width),Math.round(s+o.top+a)),new Dr(Math.round(o.left),Math.round(s+o.top+a))];case 3:return[new Dr(Math.round(o.left+i),Math.round(o.top)),new Dr(Math.round(o.left+i+l),Math.round(o.top)),new Dr(Math.round(o.left+i+l),Math.round(o.height+o.top)),new Dr(Math.round(o.left+i),Math.round(o.height+o.top))];case 1:return[new Dr(Math.round(o.left+i),Math.round(o.top+a)),new Dr(Math.round(o.left+i+l),Math.round(o.top+a)),new Dr(Math.round(o.left+i+l),Math.round(o.top+a+s)),new Dr(Math.round(o.left+i),Math.round(o.top+a+s))];default:return[new Dr(Math.round(r.left),Math.round(r.top)),new Dr(Math.round(r.left+r.width),Math.round(r.top)),new Dr(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Dr(Math.round(r.left),Math.round(r.height+r.top))]}},j0n="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",qHe="Hidden Text",B0n=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,n){var o=this._document.createElement("div"),r=this._document.createElement("img"),i=this._document.createElement("span"),a=this._document.body;o.style.visibility="hidden",o.style.fontFamily=e,o.style.fontSize=n,o.style.margin="0",o.style.padding="0",o.style.whiteSpace="nowrap",a.appendChild(o),r.src=j0n,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",i.style.fontFamily=e,i.style.fontSize=n,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(qHe)),o.appendChild(i),o.appendChild(r);var l=r.offsetTop-i.offsetTop+2;o.removeChild(i),o.appendChild(this._document.createTextNode(qHe)),o.style.lineHeight="normal",r.style.verticalAlign="super";var s=r.offsetTop-o.offsetTop+2;return a.removeChild(o),{baseline:l,middle:s}},t.prototype.getMetrics=function(e,n){var o=e+" "+n;return typeof this._data[o]>"u"&&(this._data[o]=this.parseMetrics(e,n)),this._data[o]},t}(),bot=function(){function t(e,n){this.context=e,this.options=n}return t}(),Y0n=1e4,O0n=function(t){G5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r._activeEffects=[],r.canvas=o.canvas?o.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),o.canvas||(r.canvas.width=Math.floor(o.width*o.scale),r.canvas.height=Math.floor(o.height*o.scale),r.canvas.style.width=o.width+"px",r.canvas.style.height=o.height+"px"),r.fontMetrics=new B0n(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-o.x,-o.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+o.width+"x"+o.height+") with scale "+o.scale),r}return e.prototype.applyEffects=function(n){for(var o=this;this._activeEffects.length;)this.popEffect();n.forEach(function(r){return o.applyEffect(r)})},e.prototype.applyEffect=function(n){this.ctx.save(),I0n(n)&&(this.ctx.globalAlpha=n.opacity),M0n(n)&&(this.ctx.translate(n.offsetX,n.offsetY),this.ctx.transform(n.matrix[0],n.matrix[1],n.matrix[2],n.matrix[3],n.matrix[4],n.matrix[5]),this.ctx.translate(-n.offsetX,-n.offsetY)),yot(n)&&(this.path(n.path),this.ctx.clip()),this._activeEffects.push(n)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(n){return wp(this,void 0,void 0,function(){var o;return ch(this,function(r){switch(r.label){case 0:return o=n.element.container.styles,o.isVisible()?[4,this.renderStackContent(n)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(n){return wp(this,void 0,void 0,function(){return ch(this,function(o){switch(o.label){case 0:if(Y0(n.container.flags,16))debugger;return n.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(n)]:[3,3];case 1:return o.sent(),[4,this.renderNodeContent(n)];case 2:o.sent(),o.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(n,o,r){var i=this;if(o===0)this.ctx.fillText(n.text,n.bounds.left,n.bounds.top+r);else{var a=z3e(n.text);a.reduce(function(l,s){return i.ctx.fillText(s,l,n.bounds.top+r),l+i.ctx.measureText(s).width},n.bounds.left)}},e.prototype.createFontStyle=function(n){var o=n.fontVariant.filter(function(a){return a==="normal"||a==="small-caps"}).join(""),r=J0n(n.fontFamily).join(", "),i=CU(n.fontSize)?""+n.fontSize.number+n.fontSize.unit:n.fontSize.number+"px";return[[n.fontStyle,o,n.fontWeight,i,r].join(" "),r,i]},e.prototype.renderTextNode=function(n,o){return wp(this,void 0,void 0,function(){var r,i,a,l,s,c,u,d,f=this;return ch(this,function(p){return r=this.createFontStyle(o),i=r[0],a=r[1],l=r[2],this.ctx.font=i,this.ctx.direction=o.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",s=this.fontMetrics.getMetrics(a,l),c=s.baseline,u=s.middle,d=o.paintOrder,n.textBounds.forEach(function(m){d.forEach(function(y){switch(y){case 0:f.ctx.fillStyle=bd(o.color),f.renderTextWithLetterSpacing(m,o.letterSpacing,c);var w=o.textShadow;w.length&&m.text.trim().length&&(w.slice(0).reverse().forEach(function(x){f.ctx.shadowColor=bd(x.color),f.ctx.shadowOffsetX=x.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=x.offsetY.number*f.options.scale,f.ctx.shadowBlur=x.blur.number,f.renderTextWithLetterSpacing(m,o.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),o.textDecorationLine.length&&(f.ctx.fillStyle=bd(o.textDecorationColor||o.color),o.textDecorationLine.forEach(function(x){switch(x){case 1:f.ctx.fillRect(m.bounds.left,Math.round(m.bounds.top+c),m.bounds.width,1);break;case 2:f.ctx.fillRect(m.bounds.left,Math.round(m.bounds.top),m.bounds.width,1);break;case 3:f.ctx.fillRect(m.bounds.left,Math.ceil(m.bounds.top+u),m.bounds.width,1);break}}));break;case 1:o.webkitTextStrokeWidth&&m.text.trim().length&&(f.ctx.strokeStyle=bd(o.webkitTextStrokeColor),f.ctx.lineWidth=o.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(m.text,m.bounds.left,m.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(n,o,r){if(r&&n.intrinsicWidth>0&&n.intrinsicHeight>0){var i=HJ(n),a=RJ(o);this.path(a),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,n.intrinsicWidth,n.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(n){return wp(this,void 0,void 0,function(){var o,r,i,a,l,s,C,C,c,u,d,f,A,p,m,S,y,w,x,C,P,A,S;return ch(this,function(v){switch(v.label){case 0:this.applyEffects(n.getEffects(4)),o=n.container,r=n.curves,i=o.styles,a=0,l=o.textNodes,v.label=1;case 1:return a0&&U>0&&(T=i.ctx.createPattern(S,"repeat"),i.renderRepeat(M,T,F,E))):Isn(u)&&(R=Vse(n,o,[null,null,null]),M=R[0],D=R[1],k=R[2],N=R[3],U=R[4],W=u.position.length===0?[H3e]:u.position,F=tc(W[0],N),E=tc(W[W.length-1],U),L=Psn(u,F,E,N,U),j=L[0],Y=L[1],j>0&&Y>0&&(O=i.ctx.createRadialGradient(D+F,k+E,0,D+F,k+E,j),wHe(u.stops,j*2).forEach(function($){return O.addColorStop($.stop,bd($.color))}),i.path(M),i.ctx.fillStyle=O,j!==Y?(_=n.bounds.left+.5*n.bounds.width,G=n.bounds.top+.5*n.bounds.height,Q=Y/j,oe=1/Q,i.ctx.save(),i.ctx.translate(_,G),i.ctx.transform(1,0,0,Q,0,0),i.ctx.translate(-_,-G),i.ctx.fillRect(D,oe*(k-G)+G,N,U*oe),i.ctx.restore()):i.ctx.fill())),ee.label=6;case 6:return o--,[2]}})},i=this,a=0,l=n.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return a0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,3)];case 6:return f.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,l,n.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,l,n.curves)];case 10:f.sent(),f.label=11;case 11:l++,f.label=12;case 12:return s++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(n,o,r,i,a){return wp(this,void 0,void 0,function(){var l,s,c,u,d,f,p,m,y,w,x,C,P,A,S,v,S,v;return ch(this,function(b){return this.ctx.save(),l=F0n(i,r),s=$He(i,r),a===2&&(this.path(s),this.ctx.clip()),hy(s[0])?(c=s[0].start.x,u=s[0].start.y):(c=s[0].x,u=s[0].y),hy(s[1])?(d=s[1].end.x,f=s[1].end.y):(d=s[1].x,f=s[1].y),r===0||r===2?p=Math.abs(c-d):p=Math.abs(u-f),this.ctx.beginPath(),a===3?this.formatPath(l):this.formatPath(s.slice(0,2)),m=o<3?o*3:o*2,y=o<3?o*2:o,a===3&&(m=o,y=o),w=!0,p<=m*2?w=!1:p<=m*2+y?(x=p/(2*m+y),m*=x,y*=x):(C=Math.floor((p+y)/(m+y)),P=(p-C*m)/(C-1),A=(p-(C+1)*m)/C,y=A<=0||Math.abs(y-P)"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function o(c,u,d){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){s(f.response,u,d)},f.onerror=function(){console.error("could not download file")},f.send()}function r(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function i(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof Rc=="object"&&Rc.global===Rc?Rc:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,u,d){var f=a.URL||a.webkitURL,p=document.createElement("a");u=u||c.name||"download",p.download=u,p.rel="noopener",typeof c=="string"?(p.href=c,p.origin===location.origin?i(p):r(p.href)?o(c,u,d):i(p,p.target="_blank")):(p.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){i(p)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(n(c,d),u);else if(r(c))o(c,u,d);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){i(f)})}}:function(c,u,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return o(c,u,d);var p=c.type==="application/octet-stream",m=/constructor/i.test(a.HTMLElement)||a.safari,y=/CriOS\/[\d]+/.test(navigator.userAgent);if((y||p&&m||l)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var P=w.result;P=y?P:P.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=P:location=P,f=null},w.readAsDataURL(c)}else{var x=a.URL||a.webkitURL,C=x.createObjectURL(c);f?f.location=C:location.href=C,f=null,setTimeout(function(){x.revokeObjectURL(C)},4e4)}});a.saveAs=s.saveAs=s,t.exports=s})})(Sot);var Tot=Sot.exports;const ndn=()=>{window.open("https://intofuture.org/aladdin.html","_blank")},odn=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=satellite¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",rdn=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=roadmap&style=feature:poi|element:labels|visibility:off¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",d5=(t,e)=>{Dp.success({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},yn=(t,e)=>{Dp.info({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},RH=(t,e)=>{Dp.warning({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},co=(t,e)=>{Dp.error({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{Dp.destroy()}})},idn=(t,e)=>{const n={lng:H.getState().language};Dp.info({duration:3,content:h.jsxs(Jt,{direction:"horizontal",children:[h.jsx("span",{children:t}),h.jsx(oo,{type:"primary",title:B.t("menu.edit.Undo",n),onClick:()=>{H.getState().undoManager.undo()&&setTimeout(()=>{yn(B.t("menu.edit.Undone",n),Ob)},500),H.getState().loggable&&H.getState().logAction("Undo"),Dp.destroy()},children:B.t("menu.edit.Undo",n)}),h.jsx(oo,{type:"primary",title:B.t("message.DoNotShowAgain",n),onClick:()=>{dt.getState().set(o=>{o.muteUndoMessage=!0}),Dp.destroy()},children:B.t("word.Mute",n)})]}),style:{color:"black"},onClick:()=>{Dp.destroy()}})},adn=(t,e)=>{const n=document.createElement("a");n.download=t,n.href=e,n.click()},Yd=async(t,e,n)=>{const o=window.document.getElementById(t);if(o){const r=await Z0n(o,{...n,removeContainer:!0}),i=document.createElement("a");i.href=r.toDataURL("image/png",1),i.download=`${e}.png`,i.click()}else throw new Error(`Cannot find element with ID ${t}`)},Yh=(t,e)=>{let n="";for(const r of Object.keys(t[0]))n+=r+", ";n+=` `;for(const r of t){for(const i of Object.values(r))n+=i+", ";n+=` -`}const o=new Blob([n],{type:"text/csv;charset=utf-8"});Tot.saveAs(o,e)},ra=new ue,gh=new ue,MJ=new ue,_L=new ue,Xc=new cn,m0=new zs,k3e="/aladdin/assets/wall_edge-B4PmTeCj.png",ldn="/aladdin/assets/wall_01-B-g_tqAI.png",sdn="/aladdin/assets/wall_02-9M_qG3R_.png",cdn="/aladdin/assets/wall_03-ChpvVFgd.png",udn="/aladdin/assets/wall_04-BkmmH41c.png",ddn="/aladdin/assets/wall_05-DFi74_0h.png",fdn="/aladdin/assets/wall_06-CtX-9FCz.png",hdn="/aladdin/assets/wall_07-CJgSaJ5B.png",pdn="/aladdin/assets/wall_08-DwhD-VRH.png",gdn="/aladdin/assets/wall_09-D3ncCSYQ.png",mdn="/aladdin/assets/wall_10-RK6QVYt5.png",ydn=(t,e,n,o)=>{const r=c=>c.parentId===t||c.id===o,i=H(c=>{if(e){for(const u of c.elements)if(u.id===e)return u}return null}),a=H(c=>{if(n){for(const u of c.elements)if(u.id===n)return u}return null}),l=H(c=>JSON.stringify(c.elements.filter(r)));return{elementsOnWall:g.useMemo(()=>H.getState().elements.filter(c=>r(c)&&ye.isLegalOnWall(c.type)),[l]),leftWall:i,rightWall:a}},l2=(t=.3)=>{const e=H(i=>i.viewState.orthographic),n=H(i=>i.viewState.cameraPosition),o=H(i=>i.viewState.cameraZoom);let r;if(e)r=Math.max(t,15/o);else{const i=H.getState().viewState.panCenter,a=new ue(...i),s=new ue(...n).distanceTo(a);r=Math.max(t,s/100)}return r},Pot=(t,e)=>{const n=g.useMemo(()=>new Qg,[]);return g.useMemo(()=>{let o;switch(t){case Jo.Default:o=k3e;break;case Jo.NoTexture:o=Gg;break;case Jo.Texture01:o=ldn;break;case Jo.Texture02:o=sdn;break;case Jo.Texture03:o=cdn;break;case Jo.Texture04:o=udn;break;case Jo.Texture05:o=ddn;break;case Jo.Texture06:o=fdn;break;case Jo.Texture07:o=hdn;break;case Jo.Texture08:o=pdn;break;case Jo.Texture09:o=gdn;break;case Jo.Texture10:o=mdn;break;default:o=Gg}return e===Tc.Stud&&(o=Gg),n.load(o,r=>{r.wrapS=r.wrapT=es,r.offset.set(0,0);let i=.6,a=.6;switch(t){case Jo.Default:i=2,a=2;break;case Jo.Texture03:i=2,a=1;break;case Jo.Texture06:i=1,a=1;break}r.repeat.set(i,a),Ip()})},[t,e])},Cot=t=>{const e=g.useRef(!0);dt(o=>o.foundationMovedFlag);let n=t;if(!e.current){const o=H.getState().elements.find(r=>r.id===t.id&&r.type===z.Foundation);o&&(n=o)}return e.current=!1,n},K$=class K${static getIntersectionObjects(e){return e.intersections.filter(n=>n.eventObject.name.includes("Cuboid")||n.eventObject.name==="Foundation"||n.eventObject.name.includes("Roof")||n.eventObject.name.includes(K$.WALL_OUTSIDE_SURFACE_MESH_NAME))}static addUndoableMove(){const e=H.getState().selectedElement;if(!e)return;const n=H.getState().getElementById(e.id),o=dt.getState().oldParentId,r=dt.getState().oldFoundationId;if(!n||!o||!r)return;const i=e.type===z.SolarPanel,a=e.type===z.Polygon,l={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:i?e.parentType:void 0,newParentType:i?n.parentType:void 0,oldParentId:o,newParentId:n.parentId,oldFoundationId:r,newFoundationId:n.foundationId,oldNormal:new ue().fromArray(e.normal),newNormal:new ue().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){s(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.newParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal,a?e.vertices:void 0)},redo(){s(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.oldParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal,a?n.vertices:void 0)}};H.getState().addUndoable(l);const s=(c,u,d,f,p,m,y,w,x)=>{H.getState().set(C=>{const P=C.elements.find(A=>A.id===c);if(P){if(P.type===z.Polygon){if(x){const A=P;A.vertices=[...x]}}else[P.cx,P.cy,P.cz]=[...u];if(d&&f&&p&&(P.parentId=d,P.foundationId=p,m&&P.type===z.SolarPanel&&(P.parentType=m),y&&(P.rotation=[...y]),w&&(P.normal=[w.x,w.y,w.z]),P.type===z.Window)){const A=C.elements.find(T=>T.id===d),S=C.elements.find(T=>T.id===f);if(!A||!S)return;const v=P.lx*S.lx,b=P.lz*S.lz;P.lx=v/A.lx,P.lz=b/A.lz}}})}}static undoInvalidOperation(){H.getState().set(e=>{var n;if(e.selectedElement){for(let o=0;o{const e={name:`Add ${t.type} on Roof`,timestamp:Date.now(),addedElement:t,undo:()=>{H.getState().removeElementById(t.id,!1)},redo:()=>{H.getState().set(n=>{n.elements.push(e.addedElement),n.selectedElement=e.addedElement})}};H.getState().addUndoable(e)},Adn=t=>{for(const e of t.intersections)if(e.eventObject.name.includes("Roof Segments Group"))return e.object.name.includes("Flat roof")?e.point.clone().setZ(e.point.z-.01):e.point;return t.intersections[0].point},wdn=(t,e,n,o,r)=>{if(t.intersections.length===0)return;const i=H.getState().objectTypeToAdd;if(i===z.None)return;const a=H.getState().getElementById(n),l=H.getState().getElementById(e);if(!a||!l)return;const s=Adn(t),c=new ue().subVectors(s,new ue(l.cx,l.cy,l.lz/2)).applyEuler(new cn(0,0,-l.rotation[2])),u=c.clone().sub(r);let d=null;switch(i){case z.SolarPanel:{const{normal:f,rotation:p}=Rn.computeState(o,u),m=H.getState().actionState;let y=H.getState().getPvModule(H.getState().actionState.solarPanelModelName??g3);y||(y=H.getState().getPvModule(g3)),d=Qa.makeSolarPanel(a,y,c.x,c.y,c.z,m.solarPanelOrientation??br.landscape,m.solarPanelPoleHeight??1,m.solarPanelPoleSpacing??3,m.solarPanelTiltAngle??0,m.solarPanelRelativeAzimuth??0,f,p??[0,0,1],m.solarPanelFrameColor),sE(d);break}case z.SolarWaterHeater:{const{normal:f,rotation:p}=Rn.computeState(o,u);d=Qa.makeSolarWaterHeater(a,c.x,c.y,c.z,f,p??[0,0,1]),sE(d);break}case z.Window:{const{normal:f,rotation:p}=Rn.computeState(o,u);d=Qa.makeWindow(a,c.x,c.y,c.z,z.Roof,p,.5,.5),sE(d);break}case z.Sensor:{const{normal:f,rotation:p}=Rn.computeState(o,u);d=Qa.makeSensor(a,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),sE(d);break}case z.Light:{const{normal:f,rotation:p}=Rn.computeState(o,u),m=H.getState().actionState;d=Qa.makeLight(a,2,m.lightDistance,m.lightIntensity,m.lightColor,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),sE(d);break}}H.getState().set(f=>{d&&(f.elements.push(d),f.selectedElement=d,f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(d.id),f.actionModeLock||(f.objectTypeToAdd=z.None))})},Rot=(t,e,n)=>{H.getState().isAddingElement()||H.getState().objectTypeToAdd!==z.None||t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),H.getState().set(o=>{if(o.contextMenuObjectType=null,o.groupActionMode)o.multiSelectionsMode||o.selectedElementIdSet.clear(),o.selectedElementIdSet.has(n)?o.selectedElementIdSet.delete(n):o.selectedElementIdSet.add(n);else for(const r of o.elements)r.id===e?(r.selected=!0,o.selectedElement=r,o.multiSelectionsMode?o.selectedElementIdSet.has(e)?o.selectedElementIdSet.delete(e):o.selectedElementIdSet.add(e):(o.selectedElementIdSet.clear(),o.selectedElementIdSet.add(e)),o.viewState.showModelTree&&dt.getState().set(i=>{i.modelTreeExpandedKeys=[e]})):r.selected=!1}))},RU=(t,e,n)=>{const o={name:"Resize Roof Rise",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Roof,oldRise:e,newRise:n,undo:()=>{H.getState().updateRoofRiseById(o.resizedElementId,o.oldRise,0)},redo:()=>{H.getState().updateRoofRiseById(o.resizedElementId,o.newRise,0)}};H.getState().addUndoable(o)},Hot=(t,e)=>{const n={lng:H.getState().language};return Rn.rooftopElementBoundaryCheck(t,e)?!0:(H.getState().moveHandleType||H.getState().viewState.orthographic?co(B.t("message.MoveOutsideBoundaryCancelled",n)):H.getState().resizeHandleType?co(B.t("message.ResizingOutsideBoundaryCancelled",n)):H.getState().rotateHandleType&&co(B.t("message.RotationOutsideBoundaryCancelled",n)),!1)},Mot=(t,e,n)=>{const o={lng:H.getState().language};return Rn.rooftopElementCollisionCheck(t,e,n)?!0:(H.getState().moveHandleType||H.getState().viewState.orthographic?co(B.t("message.MoveCancelledBecauseOfOverlap",o)):H.getState().resizeHandleType?co(B.t("message.ResizingCancelledBecauseOfOverlap",o)):H.getState().rotateHandleType&&co(B.t("message.RotationCancelledBecauseOfOverlap",o)),!1)},ete=(t,e,n,o,r,i,a)=>{t!==null&&H.getState().set(l=>{if(t!==null){for(const s of l.elements)if(s.parentId===e&&s.foundationId){if(s.type===z.SolarPanel||s.type===z.SolarWaterHeater){const u=new ue(s.cx,s.cy,s.cz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=Rn.computeState(n,u,a);let m;d?m=Rn.getRooftopElementZ(d,u,r+i):m=r+i,f&&p&&m!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=m+t.lz/2)}else if(s.type===z.Window){const u=new ue(s.cx,s.cy,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=Rn.computeState(n,u,a);let m;d?m=Rn.getRooftopElementZ(d,u,r+i):m=r+i,f&&p&&m!==void 0&&(s.rotation=[...p],s.cz=m)}else if(s.type===z.Sensor||s.type===z.Light){const u=new ue(s.cx*t.lx,s.cy*t.ly,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=Rn.computeState(n,u,a);let m;d?m=Rn.getRooftopElementZ(d,u,r+i):m=r+i,f&&p&&m!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=m)}}}})},HU=(t,e,n,o,r)=>{t.button!==2&&(t.intersections[0].eventObject.name!==t.eventObject.name||(Rot(t,n,e),wdn(t,e,n,o,r)))},MU=(t,e)=>{const n=H.getState().selectedElement;if(!n||!Rn.isValidOnRoof(n))return;const o=H.getState().getElementById(n.id);if(o&&H.getState().moveHandleType&&O0.getIntersectionObjects(t)[0].eventObject.userData.roofId===e.id&&o.foundationId){const a=H.getState().getElementById(o.foundationId);if(a)switch(o.type){case z.SolarPanel:{const l=o,s=Rn.getRoofBoundaryVertices(e),c=Rn.getSolarPanelVerticesOnRoof(l,a);!Hot(c,s)||!Mot(l,a,c)?O0.undoInvalidOperation():O0.addUndoableMove();break}case z.Sensor:O0.addUndoableMove();break;case z.Light:O0.addUndoableMove();break}}H.getState().set(r=>{r.moveHandleType=null})},IU=(t,e)=>{const n=H.getState().getSelectedElement();if(!(!n||!Rn.isValidOnRoof(n)))switch(n.type){case z.Sensor:case z.Light:case z.SolarPanel:{if(n.type===z.SolarPanel&&n.parentType===void 0)return;if(H.getState().moveHandleType){const o=O0.getIntersectionObjects(t);o[0].eventObject.userData.roofId===e&&H.getState().set(i=>{for(const a of i.elements)if(a.id===n.id){const{roofId:l,foundation:s,centroid:c,roofSegments:u}=o[0].eventObject.userData;if(s&&c&&u&&l){const d=o[0].point,f=new ue().subVectors(d,new ue(s.cx,s.cy)).applyEuler(new cn(0,0,-s.rotation[2])),p=f.clone().sub(c),{normal:m,rotation:y}=Rn.computeState(u,p);a.cx=f.x/s.lx,a.cy=f.y/s.ly,a.cz=f.z-s.lz,a.rotation=[...y],a.normal=m.toArray(),a.parentId=l,a.foundationId=s.id,a.type===z.SolarPanel&&(a.parentType=z.Roof,a.color="#fff"),i.selectedElement&&(i.selectedElement.parentId=l,i.selectedElement.foundationId=s.id),dt.getState().setPrimitiveStore("showWallIntersectionPlaneId",null)}break}})}}}},HH=(t,e)=>{t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),H.getState().set(n=>{n.contextMenuObjectType=z.Roof,n.pastePoint.copy(t.intersections[0].point);for(const o of n.elements)if(o.id===e)if(o.selected=!0,n.selectedElement=o,n.selectedElementIdSet.has(e))for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id);else if(n.multiSelectionsMode){n.selectedElementIdSet.add(e);for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id)}else n.selectedElementIdSet.clear(),n.selectedElementIdSet.add(e);else o.selected=!1}))},mh=({position:t,onPointerDown:e,onPointerUp:n,onPointerOver:o})=>{const r=H(pn),i=l2(),{gl:a}=ti(),l=g.useRef(!1),s=g.useRef(!1),c=g.useRef(!1),u=g.useRef(null),[d,f]=g.useState("white"),p=y=>{y?(f(Aa),a.domElement.style.cursor="pointer"):(f("white"),a.domElement.style.cursor="default")};g.useEffect(()=>{const y=()=>{s.current&&(c.current=!0),!s.current&&l.current&&p(!1),l.current=!1};return window.addEventListener("pointerup",y),()=>{window.removeEventListener("pointerup",y)}},[]);const m=y=>{if(y.intersections.length>0){for(const{eventObject:w}of y.intersections)if(w.name==="Roof Handle")return w===u.current}return!1};return h.jsx(Ys,{name:"Roof Handle",ref:u,args:[i],position:t,onPointerMove:y=>{m(y)?(c.current=!1,s.current||(s.current=!0,p(!0))):f("white")},onPointerOut:y=>{c.current||(l.current||(y.intersections.length>0&&y.intersections[0].eventObject.name==="Roof Handle"?f("white"):p(!1)),s.current=!1,r(w=>{w.hoveredHandle=null}))},onPointerDown:y=>{m(y)&&(e&&e(y),l.current=!0)},onPointerUp:y=>{m(y)&&n&&n(y)},onPointerOver:y=>{m(y)&&o&&o(y)},onPointerLeave:y=>{m(y)&&r(w=>{w.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:d})})},xdn=({roofModel:t,foundationModel:e})=>{const n=H(Jp),{id:o,wallsId:r,roofType:i}=t;return g.useEffect(()=>{r.length===0&&n(o,!1)},[r]),(()=>{switch(i){case Zo.Pyramid:return h.jsx(dan,{roofModel:t,foundationModel:e});case Zo.Gable:return h.jsx(ban,{roofModel:t,foundationModel:e});case Zo.Hip:return h.jsx(Can,{roofModel:t,foundationModel:e});case Zo.Gambrel:return h.jsx(man,{roofModel:t,foundationModel:e});case Zo.Mansard:return h.jsx(Ian,{roofModel:t,foundationModel:e});default:return null}})()};function fI(t,e){return t.roofModel===e.roofModel&&t.foundationModel.lx===e.foundationModel.lx&&t.foundationModel.ly===e.foundationModel.ly&&t.foundationModel.lz===e.foundationModel.lz}const vdn=xe.memo(xdn,fI),hI=t=>{const e=g.useMemo(()=>{let i;switch(t){case Yr.NoTexture:i=Gg;break;case Yr.Texture01:i=lHt;break;case Yr.Texture02:i=sHt;break;case Yr.Texture03:i=cHt;break;case Yr.Texture04:i=uHt;break;case Yr.Texture05:i=dHt;break;case Yr.Texture06:i=fHt;break;case Yr.Texture07:i=hHt;break;default:i=aHt}return new Qg().load(i,a=>{switch(a.wrapS=a.wrapT=es,t){case Yr.NoTexture:case Yr.Default:a.repeat.set(5,3);break;case Yr.Texture01:a.repeat.set(.5,.25);break;case Yr.Texture03:a.repeat.set(.9,.9);break;case Yr.Texture04:case Yr.Texture05:case Yr.Texture06:a.repeat.set(.75,.75);break;default:a.repeat.set(.5,.5)}o(a),r()})},[t]),[n,o]=g.useState(e),{invalidate:r}=ti();return n},pI=(t,e)=>{const n=H(h4),o=H(M0);return{transparent:t||n&&o,opacity:Math.min(e!==void 0?e:1,n&&o||t?.25:1)}},Iot=(t,e,n)=>{const o=H(l=>l.elements.filter(s=>s.foundationId===t&&s.type===z.Wall),Qy),r=l=>o.find(s=>s.id===l),i=g.useRef(!1);return{currentWallArray:g.useMemo(()=>{for(const l of n){let s=r(l);if(!s)return[];const c=[],u=s;let d=0;for(;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.leftJoints[0]);)if(s.leftJoints[0]!==u.id)s=r(s.leftJoints[0]);else return c.reverse(),i.current=!0,c;for(c.reverse(),s=r(u.rightJoints[0]),d=0;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.rightJoints[0]&&s.rightJoints[0]!==u.id);)s=r(s.rightJoints[0]);if(i.current=!1,c.length>1)return c}return[]},[n,o]),isLoopRef:i}},F3e=(t,e)=>{const n=H(r=>r.elements.filter(i=>i.foundationId===e&&i.type===z.Wall),Qy);return g.useMemo(()=>{var f;const r=p=>n.find(m=>m.id===p),i=new Map,a=new Map,l=r(t);let s=l,c=0,u=!1;for(;s&&s.type===z.Wall&&c<100;){i.set(s.id,s);const p=s.relativeAngle.toFixed(1);if(a.has(p)?(f=a.get(p))==null||f.push(s):a.set(p,[s]),s.rightJoints.length!==0){if(s=r(s.rightJoints[0]),s&&s.id===l.id){u=!0;break}c++}else s=null}if(!u||a.size!==4)return null;const d=[];for(const[p,m]of a){let y=0;for(const A of m){const S=i.get(A.leftJoints[0]),v=i.get(A.rightJoints[0]);if(S&&S.relativeAngle.toFixed(1)!==p&&y++,v&&v.relativeAngle.toFixed(1)!==p&&y++,y>2)break}if(y!==2)return null;let w=null,x=null,C=0,P=-1;for(const A of m){const S=i.get(A.leftJoints[0]),v=i.get(A.rightJoints[0]);C=Math.max(C,A.lz),P=Math.max(P,A.eavesLength),S&&S.relativeAngle.toFixed(1)!==p&&(w=A),v&&v.relativeAngle.toFixed(1)!==p&&(x=A)}w&&x&&C>0&&P!==-1&&d.push({leftPoint:new ue().fromArray(w.leftPoint),rightPoint:new ue().fromArray(x.rightPoint),relativeAngle:w.relativeAngle,lz:C,eavesLength:P,wallsId:m.map(A=>A.id)})}return d.length!==4?null:d},[n])},L3e=(t,e,n)=>{const o=g.useMemo(()=>Rn.getHighestComposedWallHeight(t,n),[t]),r=g.useMemo(()=>o+e,[o,e]);return{highestWallHeight:o,topZ:r}},zot=(t,e,n)=>{const o=g.useMemo(()=>Rn.getHighestWallHeight(t,n),[t]),[r,i]=g.useState(e),a=o+r;return g.useEffect(()=>{e!==r&&i(e)},[e]),{highestWallHeight:o,topZ:a,riseInnerState:r,setRiseInnerState:i}},zU=(t,e,n,o,r,i)=>{const a=dt(BN),l=dt(l5e),s=dt(jN),c=()=>{const u=f=>f.clone().add(e),d=[];if(o)if(r===Zo.Gambrel)d.push(U3e(n).map(u));else{const f=[];for(const p of n)f.push(p.points[1].clone().add(e));d.push(f)}else{for(const f of n){const p=f.points;if(p.length===6)d.push(p.slice(3).map(u));else if(p.length===8)d.push(p.slice(4).map(u));else throw new Error("Invalid Roof segment data")}i&&d.push(i)}return In.getState().setRoofSegmentVertices(t,d),d};return(a||l||s)&&c(),g.useEffect(()=>{c()},[n]),c},DU=t=>{const e=dt(jN),n=dt(dQ);(e||n)&&t()},EU=(t,e)=>{const n=H(OM);g.useEffect(()=>{t.rise===void 0&&H.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Roof){const i=r;i.rise===void 0&&(i.rise=i.lz-e,i.lz=0);break}})},[n])},bdn=()=>{const[,t]=g.useState(!1);g.useEffect(()=>{t(e=>!e)},[])},tte=()=>{const t=g.useRef(!0);return t.current?(t.current=!1,!0):!1},W3e=(t,e,n,o,r,i,a)=>{const l=H(s=>s.updateElementOnRoofFlag);g.useEffect(()=>{l&&(ete(t,e,n,o,r,i,a),H.getState().setUpdateElementOnRoofFlag(!1))},[r,i,l])},Sdn=(t,e,n,o,r,i,a)=>{const l=tte();g.useEffect(()=>{l||ete(t,e,n,o,r,i,a)},[n])},N3e=(t,e,n,o,r,i,a)=>{Sdn(t,e,n,o,r,i,a),W3e(t,e,n,o,r,i,a)},kU=(t,e,n,o)=>{const r=Cot(e);return g.useMemo(()=>({roofId:t,foundation:r,centroid:n,roofSegments:o}),[t,n,o,r])},QHe=(t,e)=>{const[n,o,r,i]=e;t.moveTo(n.points[0].x,n.points[0].y),t.lineTo(n.points[1].x,n.points[1].y),t.lineTo(i.points[0].x,i.points[0].y),t.lineTo(i.points[1].x,i.points[1].y),t.closePath()},U3e=(t,e)=>{const n=[],[o,r,i,a]=t;return n.push(o.points[0].clone()),n.push(o.points[1].clone()),n.push(a.points[0].clone()),n.push(a.points[1].clone()),e?(e.push(...n),e):n},IJ=({uuid:t,shape:e,thickness:n,holeMeshes:o,simulation:r,castShadow:i,receiveShadow:a,children:l})=>{const s=g.useRef(null);if(s.current&&(s.current.geometry=new C3(e,{steps:1,depth:n,bevelEnabled:!1}),s.current.updateMatrix(),o.length>0)){const c=[];for(let d=0;d{const f=H.getState().world,p=H(xs),m=dt(vs),y=dt(n6),w=H(Y5),x=H(J3),C=H(K3),P=In(UN),A=In.getState().hourlyHeatExchangeArrayMap,S=g.useRef(0),v=g.useRef(),b=g.useRef(),{transparent:T,opacity:R}=pI(),M=H(_=>_.elements.filter(G=>G.type===z.Window&&G.parentId===t),Qy),D=g.useMemo(()=>{if(!y||e&&e.notBuilding)return;const _=A.get(t);if(!_)return;const G=_.reduce((we,Se)=>we+Se,0),Q=P(t);if(!Q||!Q[0])return;const oe=[],ee=Q[0].map(we=>we.clone().sub(r)),q=X3*(f.solarRadiationHeatmapGridCellSize??.5),ae=ee[0].clone(),Z=ee[1].clone(),ne=ee[2].clone(),te=new ue().subVectors(Z,ae),$=new ue().subVectors(ne,ae),le=new ue().subVectors(ne,Z),de=te.length(),he=new ue().crossVectors($,le).length()/de,me=Math.max(2,Math.floor(de/q)),ce=Math.max(2,Math.floor(he/q));te.normalize(),$.normalize(),le.normalize();const Pe=new ue().crossVectors($,le).normalize(),pe=te.multiplyScalar(.5*de/me),Ie=new ue().crossVectors(Pe,te).normalize().multiplyScalar(.5*he/ce),ve=ae.clone().add(pe).add(Ie).add(new ue(0,0,i));pe.multiplyScalar(2),Ie.multiplyScalar(2),v.current=Pe.clone().multiplyScalar(.1);const ze=new ue,Ae=new Array;for(const we of ee)Ae.push({x:we.x,y:we.y});const se=ye.getPolygonArea(Ae);if(se===0)return;const ge=G/se*(w??Ny);S.current=ge<0?1:0,b.current=new cn(-Math.sign(ge)*$t,0,0);for(let we=0;we{if(o.length===0)return[new ue];const _=[];if(n===Zo.Gambrel){U3e(o,_);const G=_.reduce((Q,oe)=>Math.max(Q,oe.z),0);_.forEach(Q=>Q.setZ(G))}else{_.push(o[0].points[0]);for(const G of o){const Q=G.points[1];_.push(Q)}}return _},[o,n]),N=g.useMemo(()=>new ue(0,0,i),[i]),U=h.jsx(On,{points:k,lineWidth:l,color:a}),W=hI(u),F=g.useMemo(()=>{const _=new jl;if(o.length===0)return _;if(n===Zo.Gambrel)QHe(_,o);else{const G=o[0].points[0];_.moveTo(G.x,G.y);for(const Q of o){const oe=Q.points[1];_.lineTo(oe.x,oe.y)}_.closePath()}return _},[o,r,n]),E=g.useMemo(()=>{const _=new jl;if(o.length===0)return _;if(n===Zo.Gambrel)QHe(_,o);else{const G=o[0].points[0];_.moveTo(G.x,G.y);for(const Q of o){const oe=Q.points[1];_.lineTo(oe.x,oe.y)}_.closePath()}if(M.length>0)for(const G of M){const Q=new ue(G.cx,G.cy,G.cz).sub(r);switch(G.windowType){case Ti.Polygonal:{const[oe,ee]=G.polygonTop??P1,[q,ae,Z]=[G.lx/2,G.lz/2,oe*G.lx],ne=UX(q,ae,Z,ee,Q.x,Q.y);_.holes.push(ne);break}case Ti.Arched:{const oe=NX(G.lx,G.lz,G.archHeight,Q.x,Q.y);_.holes.push(oe);break}default:{const oe=new jl,[ee,q]=[G.lx/2,G.lz/2];oe.moveTo(Q.x-ee,Q.y-q),oe.lineTo(Q.x+ee,Q.y-q),oe.lineTo(Q.x+ee,Q.y+q),oe.lineTo(Q.x-ee,Q.y+q),oe.closePath(),_.holes.push(oe)}}}return _},[o,r,M,n]),L=g.useMemo(()=>M.map(_=>{const[G,Q,oe]=_.rotation,ee=new ue(_.cx,_.cy,_.cz).sub(r),q=new cn().fromArray([_.rotation[0],_.rotation[1],_.rotation[2],"ZXY"]);switch(_.windowType){case Ti.Polygonal:{const[ae,Z]=_.polygonTop??P1,[ne,te,$]=[_.lx/2,_.lz/2,ae*_.lx],le=UX(ne,te,$,Z),de=new os(new C3([le],{steps:1,depth:_.ly,bevelEnabled:!1})),he=new ue(0,0,-_.ly).applyEuler(q);return de.position.copy(ee.clone().add(he)),de.rotation.copy(q),de.updateMatrix(),de}case Ti.Arched:{const ae=NX(_.lx,_.lz,_.archHeight),Z=new os(new C3([ae],{steps:1,depth:_.ly,bevelEnabled:!1})),ne=new ue(0,0,-_.ly).applyEuler(q);return Z.position.copy(ee.clone().add(ne)),Z.rotation.copy(q),Z.updateMatrix(),Z}default:{const ae=new os(new V3(_.lx,_.lz,_.ly*2));return ae.position.copy(ee),ae.rotation.set(G,Q,oe),ae.updateMatrix(),ae}}}),[M,i]),j=u===Yr.NoTexture&&c&&c===s,Y=p&&!T,O=m&&d;return h.jsxs(h.Fragment,{children:[j&&!O?h.jsx(IJ,{uuid:t,simulation:!0,shape:F,holeMeshes:L,thickness:i,castShadow:Y,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:c,transparent:T,opacity:R})}):h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{uuid:t,userData:{simulation:!0},name:"Flat roof top shape",position:[0,0,i+.001],receiveShadow:p,children:[h.jsx("shapeGeometry",{args:[E]}),O?h.jsx("meshBasicMaterial",{map:d,side:$i}):h.jsx("meshStandardMaterial",{map:W,color:c,transparent:T,opacity:R,side:$i})]}),h.jsx(IJ,{shape:F,holeMeshes:L,thickness:i,castShadow:Y,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:s??"white",transparent:T,opacity:R})})]}),U,h.jsxs("group",{position:[0,0,i],children:[U,k.map((_,G)=>{const Q=[_.clone().sub(N),_];return h.jsx(On,{points:Q,lineWidth:l,color:a},G)})]}),D&&D.map((_,G)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:_,name:"Heat Flux "+G,lineWidth:C??Uy,color:x??Fu}),";",h.jsx(Rf,{userData:{unintersectable:!0},position:v.current?_[S.current].clone().add(v.current):_[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:b.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:x??Fu})})]},G))]})},Dot="/aladdin/assets/foundation_01--kFbnI98.png",Eot="/aladdin/assets/foundation_02-wZzxF61c.png",kot="/aladdin/assets/foundation_03-CrR6CCyr.png",Fot="/aladdin/assets/foundation_04-k0ozbTjk.png",Lot="/aladdin/assets/foundation_05-Bwrj98Mu.png",Wot="/aladdin/assets/foundation_06-BOa0J0il.png",Not="/aladdin/assets/foundation_07-C9gRAfER.png",gI="/aladdin/assets/helvetiker_regular.typeface-B9JafPRX.fnt",j3e=xe.memo(({element:t,height:e})=>{const n=H(SQ),o=H($y),r=H(QPt),i=H($r),a=H(h4),[l,s]=g.useState(),[c,u]=g.useState(10),[d,f]=g.useState(0);g.useEffect(()=>{if(n||o){const{cx:P,cy:A,lx:S,ly:v,type:b}=t;switch(b){case z.SolarPanel:{const T=i(t);if(T){const R=P*T.lx,M=A*T.ly;s(new ue(R,M,e??T.lz))}break}case z.Foundation:{s(new ue(P,A,a?.1:0));break}case z.Cuboid:{const{pos:T}=ye.getWorldDataById(t.id),{rot:R}=ye.getWorldDataById(t.parentId);s(new ue(T.x,T.y,T.z-t.lz/2+.2)),f(R);break}default:{s(new ue(P,A,a?.2:0));break}}u(Math.max(5,Math.hypot(S,v)*.75))}},[t,n,o,a,e]);const p=B5(NM,gI),m=c*.05,y={font:p,height:0,size:m},w=new Array(25).fill(0),x=P=>P===0?-m*.3:P>0&&P<7?-m*.8:-m*1.2,C=a?"#222":"#ccc";return h.jsx(h.Fragment,{children:l&&h.jsxs("group",{position:l,rotation:[$t,d,0],name:"Polar Auxiliary",children:[h.jsx("polarGridHelper",{args:[c,24,6,120,C,C],userData:{unintersectable:!0}}),h.jsx(FX,{args:[c*.98,c,24,1,$t,r],userData:{unintersectable:!0},rotation:[-$t,0,0],children:h.jsx("meshBasicMaterial",{side:zr,color:"yellow"})}),h.jsx("group",{rotation:[0,r,0],children:h.jsx("mesh",{position:[-.5,0,-c*.9],rotation:[-$t,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-ye.toDegrees(r).toFixed(1)}°`,y]})})}),w.map((P,A)=>{let S=Math.ceil(A/2)*(A%2===0?1:-1);S===-12&&(S=12);const v=x(Math.abs(S));return h.jsx("group",{rotation:[0,S*Math.PI/12,0],children:h.jsxs("mesh",{position:[v,0,-c*1.05],rotation:[-$t,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*S}°`,y]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},A)})]})})}),MH=xe.memo(({id:t,position:e,ratio:n,handleType:o,hoverHandle:r,noHoverHandle:i})=>{const a=H(z0),l=H(SQ),c=H($y)===o||l===o?Aa:ll,u=h.jsx("meshBasicMaterial",{color:c});return h.jsxs("group",{position:e,rotation:[$t,0,0],scale:n,name:o,children:[h.jsxs("group",{children:[h.jsx(O2e,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[$t,0,$t],children:u}),h.jsx(Rf,{args:[.1,.1,6],rotation:[$t,0,0],position:[.15,0,.05],children:u}),h.jsx(fH,{args:[.05,6],rotation:[0,$t,0],position:[0,0,.15],children:u})]}),h.jsx(di,{name:o,args:[.45,.45,.15],position:[0,.05,0],rotation:[-$t,0,0],visible:!1,onPointerDown:d=>{a(t,d,er.Rotate)},onPointerOver:d=>{r(d,o)},onPointerOut:i})]})}),o4=xe.memo(({hx:t,hy:e,hz:n,lineColor:o="black",lineWidth:r=.2})=>h.jsx(On,{points:[[-t,-e,-n],[t,-e,-n],[t,-e,n],[t,-e,-n],[t,e,-n],[t,e,n],[t,e,-n],[-t,e,-n],[-t,e,n],[-t,e,-n],[-t,-e,-n],[-t,-e,n],[t,-e,n],[t,e,n],[-t,e,n],[-t,-e,n]],name:"Wireframe",userData:{unintersectable:!0},lineWidth:r,color:o}));var Qr=(t=>(t.left="Left",t.right="Right",t.loop="Loop",t.null="Null",t))(Qr||{});const B3e=xe.memo(({element:t,verticalLift:e})=>{const n=H(Au),o=H(M0),r=H(Cm),i=H($y),a=t.lx/2,l=t.ly/2,s=.2,c=1,u=.5,d=t.lineColor??"white",f="darkorchid",p=Math.max(1,(a+l)/32),m=g.useMemo(()=>({lng:n}),[n]),y=g.useMemo(()=>{switch(t.type){case z.Cuboid:return Math.max(.5,Math.max(a,l)*.1)}return .5},[t.type,a,l]),w=g.useMemo(()=>{switch(t.type){case z.Cuboid:return o?t.lz/2+.1:-t.lz/2+.1;case z.Foundation:return t.lz+.1}return .1},[o,t.type,t.lz]),x=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[-a-y,0,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a-y,-l,w],[-a-y,l,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a-y+s,-l+3*s,w],[-a-y,-l,w],[-a-y-s,-l+3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a-y+s,l-3*s,w],[-a-y,l,w],[-a-y-s,l-3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,-l,w],[-a-y*2,-l,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,l,w],[-a-y*2,l,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]),C=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[a+y,0,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[a+y,-l,w],[a+y,l,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a+y+s,-l+3*s,w],[a+y,-l,w],[a+y-s,-l+3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a+y+s,l-3*s,w],[a+y,l,w],[a+y-s,l-3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,-l,w],[a+y*2,-l,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,l,w],[a+y*2,l,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]),P=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,-l-y,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,-l-y,w],[a,-l-y,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a+3*s,-l-y-s,w],[-a,-l-y,w],[-a+3*s,-l-y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a-3*s,-l-y-s,w],[a,-l-y,w],[a-3*s,-l-y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,-l,w],[-a,-l-y*2,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,-l,w],[a,-l-y*2,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]),A=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,l+y,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,l+y,w],[a,l+y,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a+3*s,l+y-s,w],[-a,l+y,w],[-a+3*s,l+y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a-3*s,l+y-s,w],[a,l+y,w],[a-3*s,l+y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,l,w],[-a,l+y*2,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,l,w],[a,l+y*2,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]);if(r)if(t.type===z.Wall)switch(r){case xt.LowerLeft:return P;case xt.LowerRight:return P}else switch(r){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[x,P]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[x,A]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[C,A]})}if(i)if(t.type===z.Wall)switch(i){case xt.LowerLeft:return P;case xt.LowerRight:return P}else switch(i){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[x,P]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[x,A]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[C,A]})}return h.jsx(h.Fragment,{})}),Tdn=1.361,ZHe=9.8067,eMe=1012,D_=1.225,Aw=273.15,tMe=567e-10,Pdn=[.103,.104,.109,.12,.13,.137,.138,.134,.121,.111,.106,.103];var hi=(t=>(t[t.NONE=0]="NONE",t[t.KASTEN_YOUNG=1]="KASTEN_YOUNG",t[t.SPHERE_MODEL=2]="SPHERE_MODEL",t))(hi||{});const f5=1440,Wpe=Math.PI/720,Gse=Math.PI/182.5,nMe=30,Cdn=120;class oMe{constructor(e,n){this.sunrise=e,this.sunset=n}daylight(){return this.sunset-this.sunrise}}const tA=.5,Zu=.1,dC=23.45/180*Math.PI,Rdn=1e3*60*60*24,WR=720,FU=t=>{const e=Math.floor((t.getTime()-new Date(t.getFullYear(),0,0).getTime())/Rdn);return dC*Math.sin(fa*(284+e)/365.25)},pl=(t,e)=>{const n=Math.tan(ye.toRadians(e))*Math.tan(FU(t));if(Math.abs(n)>1)return new oMe(0,n>0?WR*2:0);const o=60*Math.acos(-n)/ye.toRadians(15);return new oMe(WR-o,WR+o)},Y3e=t=>(t.getHours()*60+t.getMinutes()-WR)/WR*Math.PI,E_=t=>(t/WR-1)*Math.PI,zi=(t,e)=>_9(1,Y3e(t),FU(t),ye.toRadians(e)).normalize(),_9=(t,e,n,o)=>{const r=Math.cos(n),i=Math.sin(n),a=Math.cos(o),l=Math.sin(o),s=Math.cos(e),c=Math.sin(e),u=Math.asin(i*l+r*s*a),d=c*r,f=a*i-s*r*l,p=Math.atan2(f,d),m=new ue(t,p,u);return ye.sphericalToCartesianZ(m),m.x=-m.x,m},Hdn=t=>{const e=fa*t/365,n=1.00011+.034221*Math.cos(e)+.00128*Math.sin(e)+719e-6*Math.cos(2*e)+77e-6*Math.sin(2*e);return Tdn*n},Mdn=(t,e,n)=>{let o;switch(t){case hi.NONE:return 1;case hi.KASTEN_YOUNG:return o=e.angleTo(Oo),1/(Math.cos(o)+.50572*Math.pow(96.07995-o/Math.PI*180,-1.6364));default:{o=e.angleTo(Oo);const r=Math.cos(o),i=708,a=n/9e3;return Math.sqrt((i+a)*(i+a)*r*r+(2*i+1+a)*(1-a))-(i+a)*r}}},Si=(t,e,n,o)=>Hdn(e)*Math.pow(.7,Math.pow(Mdn(o,t,n),.678)),ei=(t,e,n,o)=>{let r=0;const i=n.dot(Oo),a=.5*(1+i);a>0&&(r+=Pdn[e]*a*o);const l=.5*Math.abs(1-i);return ye.isZero(l)||(r+=t.albedo*l*o),r},Idn=xe.memo(({foundation:t})=>{const e=H(ml),n=H(tu),o=dt(cXe),r=dt(Ef),i=dt(A5e),a=dt(vs),l=H(Df),s=In(O1),[c,u]=g.useState(null),d=g.useRef(null),{lx:f,ly:p,lz:m,solarUpdraftTower:y}=t,w=((y==null?void 0:y.collectorRadius)??100)*.016,x=g.useMemo(()=>zi(new Date(e),n),[e,n]),C=g.useMemo(()=>{const A=[],S=(((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))+m)/2,v=(y==null?void 0:y.chimneyHeight)??Math.max(f,p),b=(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,T=(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),R=b*1.15,M=T*.5,D=T,k=T*2,N=T*4,U=6;for(let W=0;W{const A=[],S=((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))+m,v=(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,b=25,T=2*v/b;for(let R=0;R<=b;R++){const M=[],D=-v+R*T,k=Math.sqrt(v*v-D*D);M.push(new ue(-k,D,S)),M.push(new ue(k,D,S)),A.push({points:M})}for(let R=0;R<=b;R++){const M=[],D=-v+R*T,k=Math.sqrt(v*v-D*D);M.push(new ue(D,-k,S)),M.push(new ue(D,k,S)),A.push({points:M})}return A},[f,p,m,y==null?void 0:y.collectorRadius,y==null?void 0:y.collectorHeight]);return g.useEffect(()=>{if(t&&a){const A=s(t.id+"-sut");A&&u(ye.fetchHeatmapTexture(A,l??5))}},[a,l]),Gp((A,S)=>{(o||r&&!i)&&x.z>0&&d.current&&d.current.children.forEach(v=>{if(v.name==="Streamlines"){const b=v;b.material.uniforms.dashOffset.value-=S*w*10}})}),h.jsxs("group",{children:[h.jsx(wa,{userData:{unintersectable:!0,simulation:!0},name:"Chimney",castShadow:!0,receiveShadow:!1,args:[(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(y==null?void 0:y.chimneyHeight)??Math.max(f,p),16,2,!0],position:[0,0,((y==null?void 0:y.chimneyHeight)??Math.max(f,p))/2+m],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:zr})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Chimney Base",castShadow:!0,receiveShadow:!1,args:[(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),((y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)))*1.6,((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))*4,16,2,!0],position:[0,0,((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))*2+m],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:zr})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Greenhouse Wall",castShadow:!0,receiveShadow:!0,args:[(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,(y==null?void 0:y.collectorHeight)??Math.max(3,10*m),50,2,!0],position:[0,0,((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))/2+m],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:zr})}),h.jsx(fH,{uuid:t.id+"-sut",userData:{unintersectable:!0,simulation:!0},name:"Greenhouse Ceiling",castShadow:!1,receiveShadow:!1,args:[(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,50,0,fa],position:[0,0,m+((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))],children:a&&c?h.jsx("meshBasicMaterial",{attach:"material",side:$i,map:c}):h.jsx("meshPhongMaterial",{attach:"material",specular:new ir("white"),shininess:50,side:$i,color:"lightskyblue",transparent:!0,opacity:.75})}),h.jsx(fH,{userData:{unintersectable:!0},name:"Greenhouse Ground",castShadow:!1,receiveShadow:!0,args:[(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,50,0,fa],position:[0,0,.1],children:h.jsx("meshStandardMaterial",{attach:"material",color:"dimgray"})}),P&&P.map((A,S)=>h.jsx(On,{name:"Greenhouse Roof Grid Lines",userData:{unintersectable:!0},points:A.points,castShadow:!1,receiveShadow:!1,lineWidth:.2,color:"gray"},S)),x.z>0&&C&&h.jsx("group",{ref:d,children:C.map((A,S)=>{const v=A.points[0].x+A.points[1].x,b=A.points[0].y+A.points[1].y,T=new cn(0,0,fa*S/C.length+$t),R=w,M=w;return h.jsxs(xe.Fragment,{children:[h.jsx(On,{name:"Streamlines",userData:{unintersectable:!0},points:A.points,castShadow:!1,receiveShadow:!1,lineWidth:.5,dashed:!0,dashSize:R,gapSize:M,color:"white"}),h.jsx(Rf,{userData:{unintersectable:!0},args:[w,w*4,4,2],name:"Streamline Inlet Arrow Head",position:[v*.1,b*.1,A.points[0].z],rotation:T,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(Rf,{userData:{unintersectable:!0},args:[w,w*4,4,2],name:"Streamline Inlet Arrow Head",position:[v*.9,b*.9,A.points[0].z],rotation:T,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})})]},S)})})]})}),O3e="/aladdin/assets/glow-CV5NAijT.png",zdn=xe.memo(({foundation:t})=>{const e=H(ml),n=H(tu),o=g.useMemo(()=>zi(new Date(e),n),[e,n]),r=Up(O3e),{lz:i,solarPowerTower:a}=t,l=(a==null?void 0:a.towerRadius)??1,s=(a==null?void 0:a.towerHeight)??20,c=s/10,u=l*1.5;return h.jsxs("group",{children:[h.jsx(wa,{userData:{unintersectable:!0},name:"Focus Tower",castShadow:!0,receiveShadow:!1,args:[l,l,s,6,2],position:[0,0,s/2+i/2],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Center Receiver",castShadow:!0,receiveShadow:!1,args:[u,u,c,10,2],position:[0,0,s+i/2],rotation:[$t,0,0],children:o.z>0?h.jsx("meshBasicMaterial",{color:[1,1,1],toneMapped:!1}):h.jsx("meshStandardMaterial",{color:"white"})}),o.z>0&&h.jsx("sprite",{scale:[10,10,10],position:[0,0,s+i/2],children:h.jsx("spriteMaterial",{map:r,color:"white",blending:Th,depthWrite:!1})})]})}),Uot="/aladdin/assets/glow_cylinderic-BQLm1JqX.png",jot="/aladdin/assets/glow_corner-CuJ72sMM.png",Ddn=xe.memo(({foundation:t})=>{const{ly:e,lz:n,solarAbsorberPipe:o}=t,r=H(ml),i=H(tu),a=g.useMemo(()=>zi(new Date(r),i),[r,i]),l=Up(Uot),s=Up(jot),c=g.useRef(null),u=(o==null?void 0:o.absorberHeight)??10,d=(o==null?void 0:o.apertureWidth)??.6,f=(o==null?void 0:o.relativeLength)??.9,p=(o==null?void 0:o.poleNumber)??5,m=g.useMemo(()=>{const y=[],w=f*e/(p+1);for(let x=1;x<=p;x++)y.push(new ue(0,x*w-f*e/2,u/2+n/2));return y},[e,n,p,u,f]);return Gp(({camera:y})=>{if(!c.current)return;const w=c.current.localToWorld(new ue(0,0,0)),x=new ue().subVectors(y.position,w).applyEuler(new cn(0,0,-t.rotation[2])),C=Math.atan2(x.z,x.x);c.current.rotation.y=-Math.PI/2-C}),h.jsxs("group",{children:[h.jsx(wa,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 1",castShadow:!1,receiveShadow:!1,args:[d/4,d/4,u,6,2],position:[0,-f*e/2,u/2+n/2],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 2",castShadow:!1,receiveShadow:!1,args:[d/4,d/4,u,6,2],position:[0,f*e/2,u/2+n/2],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Receiver Horizontal Pipe",castShadow:!1,receiveShadow:!1,args:[d/2,d/2,f*e+d/2,6,2,!1,3*$t,Math.PI],position:[0,0,u+n/2-d/4],children:a.z>0?h.jsx("meshStandardMaterial",{color:[1,1,1],toneMapped:!1,side:zr}):h.jsx("meshStandardMaterial",{color:"white",side:zr})}),a.z>0&&h.jsxs("group",{ref:c,position:[0,0,u+n/2-d/4],children:[h.jsx(yi,{args:[2,f*e+d/2],children:h.jsx("meshBasicMaterial",{side:zr,map:l,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],rotation:[0,0,Math.PI],position:[.5,.5+(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],rotation:[0,0,-Math.PI/2],position:[-.5,.5+(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],rotation:[0,0,Math.PI/2],position:[.5,-.5-(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],position:[-.5,-.5-(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})})]}),m&&m.map((y,w)=>h.jsx(wa,{userData:{unintersectable:!0},name:"Solar Receiver Pole "+w,castShadow:!1,receiveShadow:!1,args:[d/8,d/8,u,4,2],position:y,rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})},w))]})});class xb{static selectMe(e,n,o,r){var i,a,l;if(o.intersections.length>0&&o.intersections.filter(c=>!c.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===o.eventObject){for(const c of e.elements)c.id===n?(c.selected=!0,e.selectedElement=c,e.selectedElementHeight=c.lz):c.selected=!1;if(!e.selectedElement)return;if(r===er.ContextMenu)if(e.selectedElementIdSet.has(n))for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id);else if(e.multiSelectionsMode){e.selectedElementIdSet.add(n);for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id)}else e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n);else e.multiSelectionsMode?e.selectedElementIdSet.has(n)?e.selectedElementIdSet.delete(n):e.selectedElementIdSet.add(n):(e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n));if(e.moveHandleType=null,e.resizeHandleType=null,e.rotateHandleType=null,r)switch(r){case er.Move:((i=e.selectedElement)==null?void 0:i.type)===z.Tree||((a=e.selectedElement)==null?void 0:a.type)===z.Human?e.moveHandleType=Ho.Default:e.moveHandleType=o.eventObject.name;break;case er.Resize:e.resizeHandleType=o.eventObject.name;break;case er.Rotate:e.rotateHandleType=o.eventObject.name;break;case er.Select:e.selectedElementAngle=((l=o.object.parent)==null?void 0:l.rotation.z)??0;break}}}static selectNone(e){e.selectedElementIdSet.clear();for(const n of e.elements)n.selected=!1;e.selectedElement=null,e.selectedElementIdSet.clear()}static clearThenAddSelectedElementIdSet(e,n){e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n)}}var zJ={exports:{}};/** +`}const o=new Blob([n],{type:"text/csv;charset=utf-8"});Tot.saveAs(o,e)},ra=new ue,gh=new ue,MJ=new ue,_L=new ue,Xc=new cn,m0=new zs,k3e="/aladdin/assets/wall_edge-B4PmTeCj.png",ldn="/aladdin/assets/wall_01-B-g_tqAI.png",sdn="/aladdin/assets/wall_02-9M_qG3R_.png",cdn="/aladdin/assets/wall_03-ChpvVFgd.png",udn="/aladdin/assets/wall_04-BkmmH41c.png",ddn="/aladdin/assets/wall_05-DFi74_0h.png",fdn="/aladdin/assets/wall_06-CtX-9FCz.png",hdn="/aladdin/assets/wall_07-CJgSaJ5B.png",pdn="/aladdin/assets/wall_08-DwhD-VRH.png",gdn="/aladdin/assets/wall_09-D3ncCSYQ.png",mdn="/aladdin/assets/wall_10-RK6QVYt5.png",ydn=(t,e,n,o)=>{const r=c=>c.parentId===t||c.id===o,i=H(c=>{if(e){for(const u of c.elements)if(u.id===e)return u}return null}),a=H(c=>{if(n){for(const u of c.elements)if(u.id===n)return u}return null}),l=H(c=>JSON.stringify(c.elements.filter(r)));return{elementsOnWall:g.useMemo(()=>H.getState().elements.filter(c=>r(c)&&ye.isLegalOnWall(c.type)),[l]),leftWall:i,rightWall:a}},l2=(t=.3)=>{const e=H(i=>i.viewState.orthographic),n=H(i=>i.viewState.cameraPosition),o=H(i=>i.viewState.cameraZoom);let r;if(e)r=Math.max(t,15/o);else{const i=H.getState().viewState.panCenter,a=new ue(...i),s=new ue(...n).distanceTo(a);r=Math.max(t,s/100)}return r},Pot=(t,e)=>{const n=g.useMemo(()=>new Qg,[]);return g.useMemo(()=>{let o;switch(t){case Jo.Default:o=k3e;break;case Jo.NoTexture:o=Gg;break;case Jo.Texture01:o=ldn;break;case Jo.Texture02:o=sdn;break;case Jo.Texture03:o=cdn;break;case Jo.Texture04:o=udn;break;case Jo.Texture05:o=ddn;break;case Jo.Texture06:o=fdn;break;case Jo.Texture07:o=hdn;break;case Jo.Texture08:o=pdn;break;case Jo.Texture09:o=gdn;break;case Jo.Texture10:o=mdn;break;default:o=Gg}return e===Tc.Stud&&(o=Gg),n.load(o,r=>{r.wrapS=r.wrapT=es,r.offset.set(0,0);let i=.6,a=.6;switch(t){case Jo.Default:i=2,a=2;break;case Jo.Texture03:i=2,a=1;break;case Jo.Texture06:i=1,a=1;break}r.repeat.set(i,a),Ip()})},[t,e])},Cot=t=>{const e=g.useRef(!0);dt(o=>o.foundationMovedFlag);let n=t;if(!e.current){const o=H.getState().elements.find(r=>r.id===t.id&&r.type===z.Foundation);o&&(n=o)}return e.current=!1,n},K$=class K${static getIntersectionObjects(e){return e.intersections.filter(n=>n.eventObject.name.includes("Cuboid")||n.eventObject.name==="Foundation"||n.eventObject.name.includes("Roof")||n.eventObject.name.includes(K$.WALL_OUTSIDE_SURFACE_MESH_NAME))}static addUndoableMove(){const e=H.getState().selectedElement;if(!e)return;const n=H.getState().getElementById(e.id),o=dt.getState().oldParentId,r=dt.getState().oldFoundationId;if(!n||!o||!r)return;const i=e.type===z.SolarPanel,a=e.type===z.Polygon,l={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:i?e.parentType:void 0,newParentType:i?n.parentType:void 0,oldParentId:o,newParentId:n.parentId,oldFoundationId:r,newFoundationId:n.foundationId,oldNormal:new ue().fromArray(e.normal),newNormal:new ue().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){s(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.newParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal,a?e.vertices:void 0)},redo(){s(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.oldParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal,a?n.vertices:void 0)}};H.getState().addUndoable(l);const s=(c,u,d,f,p,m,y,w,x)=>{H.getState().set(C=>{const P=C.elements.find(A=>A.id===c);if(P){if(P.type===z.Polygon){if(x){const A=P;A.vertices=[...x]}}else[P.cx,P.cy,P.cz]=[...u];if(d&&f&&p&&(P.parentId=d,P.foundationId=p,m&&P.type===z.SolarPanel&&(P.parentType=m),y&&(P.rotation=[...y]),w&&(P.normal=[w.x,w.y,w.z]),P.type===z.Window)){const A=C.elements.find(T=>T.id===d),S=C.elements.find(T=>T.id===f);if(!A||!S)return;const v=P.lx*S.lx,b=P.lz*S.lz;P.lx=v/A.lx,P.lz=b/A.lz}}})}}static undoInvalidOperation(){H.getState().set(e=>{var n;if(e.selectedElement){for(let o=0;o{const e={name:`Add ${t.type} on Roof`,timestamp:Date.now(),addedElement:t,undo:()=>{H.getState().removeElementById(t.id,!1)},redo:()=>{H.getState().set(n=>{n.elements.push(e.addedElement),n.selectedElement=e.addedElement})}};H.getState().addUndoable(e)},Adn=t=>{for(const e of t.intersections)if(e.eventObject.name.includes("Roof Segments Group"))return e.object.name.includes("Flat roof")?e.point.clone().setZ(e.point.z-.01):e.point;return t.intersections[0].point},wdn=(t,e,n,o,r)=>{if(t.intersections.length===0)return;const i=H.getState().objectTypeToAdd;if(i===z.None)return;const a=H.getState().getElementById(n),l=H.getState().getElementById(e);if(!a||!l)return;const s=Adn(t),c=new ue().subVectors(s,new ue(l.cx,l.cy,l.lz/2)).applyEuler(new cn(0,0,-l.rotation[2])),u=c.clone().sub(r);let d=null;switch(i){case z.SolarPanel:{const{normal:f,rotation:p}=Rn.computeState(o,u),m=H.getState().actionState;let y=H.getState().getPvModule(H.getState().actionState.solarPanelModelName??g3);y||(y=H.getState().getPvModule(g3)),d=Qa.makeSolarPanel(a,y,c.x,c.y,c.z,m.solarPanelOrientation??br.landscape,m.solarPanelPoleHeight??1,m.solarPanelPoleSpacing??3,m.solarPanelTiltAngle??0,m.solarPanelRelativeAzimuth??0,f,p??[0,0,1],m.solarPanelFrameColor),sE(d);break}case z.SolarWaterHeater:{const{normal:f,rotation:p}=Rn.computeState(o,u);d=Qa.makeSolarWaterHeater(a,c.x,c.y,c.z,f,p??[0,0,1]),sE(d);break}case z.Window:{const{normal:f,rotation:p}=Rn.computeState(o,u);d=Qa.makeWindow(a,c.x,c.y,c.z,z.Roof,p,.5,.5),sE(d);break}case z.Sensor:{const{normal:f,rotation:p}=Rn.computeState(o,u);d=Qa.makeSensor(a,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),sE(d);break}case z.Light:{const{normal:f,rotation:p}=Rn.computeState(o,u),m=H.getState().actionState;d=Qa.makeLight(a,2,m.lightDistance,m.lightIntensity,m.lightColor,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),sE(d);break}}H.getState().set(f=>{d&&(f.elements.push(d),f.selectedElement=d,f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(d.id),f.actionModeLock||(f.objectTypeToAdd=z.None))})},Rot=(t,e,n)=>{H.getState().isAddingElement()||H.getState().objectTypeToAdd!==z.None||t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),H.getState().set(o=>{if(o.contextMenuObjectType=null,o.groupActionMode)o.multiSelectionsMode||o.selectedElementIdSet.clear(),o.selectedElementIdSet.has(n)?o.selectedElementIdSet.delete(n):o.selectedElementIdSet.add(n);else for(const r of o.elements)r.id===e?(r.selected=!0,o.selectedElement=r,o.multiSelectionsMode?o.selectedElementIdSet.has(e)?o.selectedElementIdSet.delete(e):o.selectedElementIdSet.add(e):(o.selectedElementIdSet.clear(),o.selectedElementIdSet.add(e)),o.viewState.showModelTree&&dt.getState().set(i=>{i.modelTreeExpandedKeys=[e]})):r.selected=!1}))},RU=(t,e,n)=>{const o={name:"Resize Roof Rise",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Roof,oldRise:e,newRise:n,undo:()=>{H.getState().updateRoofRiseById(o.resizedElementId,o.oldRise,0)},redo:()=>{H.getState().updateRoofRiseById(o.resizedElementId,o.newRise,0)}};H.getState().addUndoable(o)},Hot=(t,e)=>{const n={lng:H.getState().language};return Rn.rooftopElementBoundaryCheck(t,e)?!0:(H.getState().moveHandleType||H.getState().viewState.orthographic?co(B.t("message.MoveOutsideBoundaryCancelled",n)):H.getState().resizeHandleType?co(B.t("message.ResizingOutsideBoundaryCancelled",n)):H.getState().rotateHandleType&&co(B.t("message.RotationOutsideBoundaryCancelled",n)),!1)},Mot=(t,e,n)=>{const o={lng:H.getState().language};return Rn.rooftopElementCollisionCheck(t,e,n)?!0:(H.getState().moveHandleType||H.getState().viewState.orthographic?co(B.t("message.MoveCancelledBecauseOfOverlap",o)):H.getState().resizeHandleType?co(B.t("message.ResizingCancelledBecauseOfOverlap",o)):H.getState().rotateHandleType&&co(B.t("message.RotationCancelledBecauseOfOverlap",o)),!1)},ete=(t,e,n,o,r,i,a)=>{t!==null&&H.getState().set(l=>{if(t!==null){for(const s of l.elements)if(s.parentId===e&&s.foundationId){if(s.type===z.SolarPanel||s.type===z.SolarWaterHeater){const u=new ue(s.cx,s.cy,s.cz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=Rn.computeState(n,u,a);let m;d?m=Rn.getRooftopElementZ(d,u,r+i):m=r+i,f&&p&&m!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=m+t.lz/2)}else if(s.type===z.Window){const u=new ue(s.cx,s.cy,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=Rn.computeState(n,u,a);let m;d?m=Rn.getRooftopElementZ(d,u,r+i):m=r+i,f&&p&&m!==void 0&&(s.rotation=[...p],s.cz=m)}else if(s.type===z.Sensor||s.type===z.Light){const u=new ue(s.cx*t.lx,s.cy*t.ly,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=Rn.computeState(n,u,a);let m;d?m=Rn.getRooftopElementZ(d,u,r+i):m=r+i,f&&p&&m!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=m)}}}})},HU=(t,e,n,o,r)=>{t.button!==2&&(t.intersections[0].eventObject.name!==t.eventObject.name||(Rot(t,n,e),wdn(t,e,n,o,r)))},MU=(t,e)=>{const n=H.getState().selectedElement;if(!n||!Rn.isValidOnRoof(n))return;const o=H.getState().getElementById(n.id);if(o&&H.getState().moveHandleType&&O0.getIntersectionObjects(t)[0].eventObject.userData.roofId===e.id&&o.foundationId){const a=H.getState().getElementById(o.foundationId);if(a)switch(o.type){case z.SolarPanel:{const l=o,s=Rn.getRoofBoundaryVertices(e),c=Rn.getSolarPanelVerticesOnRoof(l,a);!Hot(c,s)||!Mot(l,a,c)?O0.undoInvalidOperation():O0.addUndoableMove();break}case z.Sensor:O0.addUndoableMove();break;case z.Light:O0.addUndoableMove();break}}H.getState().set(r=>{r.moveHandleType=null})},IU=(t,e)=>{const n=H.getState().getSelectedElement();if(!(!n||!Rn.isValidOnRoof(n)))switch(n.type){case z.Sensor:case z.Light:case z.SolarPanel:{if(n.type===z.SolarPanel&&n.parentType===void 0)return;if(H.getState().moveHandleType){const o=O0.getIntersectionObjects(t);o[0].eventObject.userData.roofId===e&&H.getState().set(i=>{for(const a of i.elements)if(a.id===n.id){const{roofId:l,foundation:s,centroid:c,roofSegments:u}=o[0].eventObject.userData;if(s&&c&&u&&l){const d=o[0].point,f=new ue().subVectors(d,new ue(s.cx,s.cy)).applyEuler(new cn(0,0,-s.rotation[2])),p=f.clone().sub(c),{normal:m,rotation:y}=Rn.computeState(u,p);a.cx=f.x/s.lx,a.cy=f.y/s.ly,a.cz=f.z-s.lz,a.rotation=[...y],a.normal=m.toArray(),a.parentId=l,a.foundationId=s.id,a.type===z.SolarPanel&&(a.parentType=z.Roof,a.color="#fff"),i.selectedElement&&(i.selectedElement.parentId=l,i.selectedElement.foundationId=s.id),dt.getState().setPrimitiveStore("showWallIntersectionPlaneId",null)}break}})}}}},HH=(t,e)=>{t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),H.getState().set(n=>{n.contextMenuObjectType=z.Roof,n.pastePoint.copy(t.intersections[0].point);for(const o of n.elements)if(o.id===e)if(o.selected=!0,n.selectedElement=o,n.selectedElementIdSet.has(e))for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id);else if(n.multiSelectionsMode){n.selectedElementIdSet.add(e);for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id)}else n.selectedElementIdSet.clear(),n.selectedElementIdSet.add(e);else o.selected=!1}))},mh=({position:t,onPointerDown:e,onPointerUp:n,onPointerOver:o})=>{const r=H(pn),i=l2(),{gl:a}=ti(),l=g.useRef(!1),s=g.useRef(!1),c=g.useRef(!1),u=g.useRef(null),[d,f]=g.useState("white"),p=y=>{y?(f(Aa),a.domElement.style.cursor="pointer"):(f("white"),a.domElement.style.cursor="default")};g.useEffect(()=>{const y=()=>{s.current&&(c.current=!0),!s.current&&l.current&&p(!1),l.current=!1};return window.addEventListener("pointerup",y),()=>{window.removeEventListener("pointerup",y)}},[]);const m=y=>{if(y.intersections.length>0){for(const{eventObject:w}of y.intersections)if(w.name==="Roof Handle")return w===u.current}return!1};return h.jsx(Ys,{name:"Roof Handle",ref:u,args:[i],position:t,onPointerMove:y=>{m(y)?(c.current=!1,s.current||(s.current=!0,p(!0))):f("white")},onPointerOut:y=>{c.current||(l.current||(y.intersections.length>0&&y.intersections[0].eventObject.name==="Roof Handle"?f("white"):p(!1)),s.current=!1,r(w=>{w.hoveredHandle=null}))},onPointerDown:y=>{m(y)&&(e&&e(y),l.current=!0)},onPointerUp:y=>{m(y)&&n&&n(y)},onPointerOver:y=>{m(y)&&o&&o(y)},onPointerLeave:y=>{m(y)&&r(w=>{w.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:d})})},xdn=({roofModel:t,foundationModel:e})=>{const n=H(Jp),{id:o,wallsId:r,roofType:i}=t;return g.useEffect(()=>{r.length===0&&n(o,!1)},[r]),(()=>{switch(i){case Zo.Pyramid:return h.jsx(dan,{roofModel:t,foundationModel:e});case Zo.Gable:return h.jsx(ban,{roofModel:t,foundationModel:e});case Zo.Hip:return h.jsx(Can,{roofModel:t,foundationModel:e});case Zo.Gambrel:return h.jsx(man,{roofModel:t,foundationModel:e});case Zo.Mansard:return h.jsx(Ian,{roofModel:t,foundationModel:e});default:return null}})()};function fI(t,e){return t.roofModel===e.roofModel&&t.foundationModel.lx===e.foundationModel.lx&&t.foundationModel.ly===e.foundationModel.ly&&t.foundationModel.lz===e.foundationModel.lz}const vdn=xe.memo(xdn,fI),hI=t=>{const e=g.useMemo(()=>{let i;switch(t){case Yr.NoTexture:i=Gg;break;case Yr.Texture01:i=lHt;break;case Yr.Texture02:i=sHt;break;case Yr.Texture03:i=cHt;break;case Yr.Texture04:i=uHt;break;case Yr.Texture05:i=dHt;break;case Yr.Texture06:i=fHt;break;case Yr.Texture07:i=hHt;break;default:i=aHt}return new Qg().load(i,a=>{switch(a.wrapS=a.wrapT=es,t){case Yr.NoTexture:case Yr.Default:a.repeat.set(5,3);break;case Yr.Texture01:a.repeat.set(.5,.25);break;case Yr.Texture03:a.repeat.set(.9,.9);break;case Yr.Texture04:case Yr.Texture05:case Yr.Texture06:a.repeat.set(.75,.75);break;default:a.repeat.set(.5,.5)}o(a),r()})},[t]),[n,o]=g.useState(e),{invalidate:r}=ti();return n},pI=(t,e)=>{const n=H(h4),o=H(M0);return{transparent:t||n&&o,opacity:Math.min(e!==void 0?e:1,n&&o||t?.25:1)}},Iot=(t,e,n)=>{const o=H(l=>l.elements.filter(s=>s.foundationId===t&&s.type===z.Wall),Qy),r=l=>o.find(s=>s.id===l),i=g.useRef(!1);return{currentWallArray:g.useMemo(()=>{for(const l of n){let s=r(l);if(!s)return[];const c=[],u=s;let d=0;for(;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.leftJoints[0]);)if(s.leftJoints[0]!==u.id)s=r(s.leftJoints[0]);else return c.reverse(),i.current=!0,c;for(c.reverse(),s=r(u.rightJoints[0]),d=0;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.rightJoints[0]&&s.rightJoints[0]!==u.id);)s=r(s.rightJoints[0]);if(i.current=!1,c.length>1)return c}return[]},[n,o]),isLoopRef:i}},F3e=(t,e)=>{const n=H(r=>r.elements.filter(i=>i.foundationId===e&&i.type===z.Wall),Qy);return g.useMemo(()=>{var f;const r=p=>n.find(m=>m.id===p),i=new Map,a=new Map,l=r(t);let s=l,c=0,u=!1;for(;s&&s.type===z.Wall&&c<100;){i.set(s.id,s);const p=s.relativeAngle.toFixed(1);if(a.has(p)?(f=a.get(p))==null||f.push(s):a.set(p,[s]),s.rightJoints.length!==0){if(s=r(s.rightJoints[0]),s&&s.id===l.id){u=!0;break}c++}else s=null}if(!u||a.size!==4)return null;const d=[];for(const[p,m]of a){let y=0;for(const A of m){const S=i.get(A.leftJoints[0]),v=i.get(A.rightJoints[0]);if(S&&S.relativeAngle.toFixed(1)!==p&&y++,v&&v.relativeAngle.toFixed(1)!==p&&y++,y>2)break}if(y!==2)return null;let w=null,x=null,C=0,P=-1;for(const A of m){const S=i.get(A.leftJoints[0]),v=i.get(A.rightJoints[0]);C=Math.max(C,A.lz),P=Math.max(P,A.eavesLength),S&&S.relativeAngle.toFixed(1)!==p&&(w=A),v&&v.relativeAngle.toFixed(1)!==p&&(x=A)}w&&x&&C>0&&P!==-1&&d.push({leftPoint:new ue().fromArray(w.leftPoint),rightPoint:new ue().fromArray(x.rightPoint),relativeAngle:w.relativeAngle,lz:C,eavesLength:P,wallsId:m.map(A=>A.id)})}return d.length!==4?null:d},[n])},L3e=(t,e,n)=>{const o=g.useMemo(()=>Rn.getHighestComposedWallHeight(t,n),[t]),r=g.useMemo(()=>o+e,[o,e]);return{highestWallHeight:o,topZ:r}},zot=(t,e,n)=>{const o=g.useMemo(()=>Rn.getHighestWallHeight(t,n),[t]),[r,i]=g.useState(e),a=o+r;return g.useEffect(()=>{e!==r&&i(e)},[e]),{highestWallHeight:o,topZ:a,riseInnerState:r,setRiseInnerState:i}},zU=(t,e,n,o,r,i)=>{const a=dt(BN),l=dt(l5e),s=dt(jN),c=()=>{const u=f=>f.clone().add(e),d=[];if(o)if(r===Zo.Gambrel)d.push(U3e(n).map(u));else{const f=[];for(const p of n)f.push(p.points[1].clone().add(e));d.push(f)}else{for(const f of n){const p=f.points;if(p.length===6)d.push(p.slice(3).map(u));else if(p.length===8)d.push(p.slice(4).map(u));else throw new Error("Invalid Roof segment data")}i&&d.push(i)}return In.getState().setRoofSegmentVertices(t,d),d};return(a||l||s)&&c(),g.useEffect(()=>{c()},[n]),c},DU=t=>{const e=dt(jN),n=dt(dQ);(e||n)&&t()},EU=(t,e)=>{const n=H(OM);g.useEffect(()=>{t.rise===void 0&&H.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Roof){const i=r;i.rise===void 0&&(i.rise=i.lz-e,i.lz=0);break}})},[n])},bdn=()=>{const[,t]=g.useState(!1);g.useEffect(()=>{t(e=>!e)},[])},tte=()=>{const t=g.useRef(!0);return t.current?(t.current=!1,!0):!1},W3e=(t,e,n,o,r,i,a)=>{const l=H(s=>s.updateElementOnRoofFlag);g.useEffect(()=>{l&&(ete(t,e,n,o,r,i,a),H.getState().setUpdateElementOnRoofFlag(!1))},[r,i,l])},Sdn=(t,e,n,o,r,i,a)=>{const l=tte();g.useEffect(()=>{l||ete(t,e,n,o,r,i,a)},[n])},N3e=(t,e,n,o,r,i,a)=>{Sdn(t,e,n,o,r,i,a),W3e(t,e,n,o,r,i,a)},kU=(t,e,n,o)=>{const r=Cot(e);return g.useMemo(()=>({roofId:t,foundation:r,centroid:n,roofSegments:o}),[t,n,o,r])},QHe=(t,e)=>{const[n,o,r,i]=e;t.moveTo(n.points[0].x,n.points[0].y),t.lineTo(n.points[1].x,n.points[1].y),t.lineTo(i.points[0].x,i.points[0].y),t.lineTo(i.points[1].x,i.points[1].y),t.closePath()},U3e=(t,e)=>{const n=[],[o,r,i,a]=t;return n.push(o.points[0].clone()),n.push(o.points[1].clone()),n.push(a.points[0].clone()),n.push(a.points[1].clone()),e?(e.push(...n),e):n},IJ=({uuid:t,shape:e,thickness:n,holeMeshes:o,simulation:r,castShadow:i,receiveShadow:a,children:l})=>{const s=g.useRef(null);if(s.current&&(s.current.geometry=new C3(e,{steps:1,depth:n,bevelEnabled:!1}),s.current.updateMatrix(),o.length>0)){const c=[];for(let d=0;d{const f=H.getState().world,p=H(xs),m=dt(vs),y=dt(n6),w=H(Y5),x=H(J3),C=H(K3),P=In(UN),A=In.getState().hourlyHeatExchangeArrayMap,S=g.useRef(0),v=g.useRef(),b=g.useRef(),{transparent:T,opacity:R}=pI(),M=H(_=>_.elements.filter(G=>G.type===z.Window&&G.parentId===t),Qy),D=g.useMemo(()=>{if(!y||e&&e.notBuilding)return;const _=A.get(t);if(!_)return;const G=_.reduce((we,Se)=>we+Se,0),Q=P(t);if(!Q||!Q[0])return;const oe=[],ee=Q[0].map(we=>we.clone().sub(r)),$=X3*(f.solarRadiationHeatmapGridCellSize??.5),ae=ee[0].clone(),Z=ee[1].clone(),ne=ee[2].clone(),te=new ue().subVectors(Z,ae),q=new ue().subVectors(ne,ae),le=new ue().subVectors(ne,Z),de=te.length(),he=new ue().crossVectors(q,le).length()/de,me=Math.max(2,Math.floor(de/$)),ce=Math.max(2,Math.floor(he/$));te.normalize(),q.normalize(),le.normalize();const Pe=new ue().crossVectors(q,le).normalize(),pe=te.multiplyScalar(.5*de/me),Ie=new ue().crossVectors(Pe,te).normalize().multiplyScalar(.5*he/ce),ve=ae.clone().add(pe).add(Ie).add(new ue(0,0,i));pe.multiplyScalar(2),Ie.multiplyScalar(2),v.current=Pe.clone().multiplyScalar(.1);const ze=new ue,Ae=new Array;for(const we of ee)Ae.push({x:we.x,y:we.y});const se=ye.getPolygonArea(Ae);if(se===0)return;const ge=G/se*(w??Ny);S.current=ge<0?1:0,b.current=new cn(-Math.sign(ge)*$t,0,0);for(let we=0;we{if(o.length===0)return[new ue];const _=[];if(n===Zo.Gambrel){U3e(o,_);const G=_.reduce((Q,oe)=>Math.max(Q,oe.z),0);_.forEach(Q=>Q.setZ(G))}else{_.push(o[0].points[0]);for(const G of o){const Q=G.points[1];_.push(Q)}}return _},[o,n]),N=g.useMemo(()=>new ue(0,0,i),[i]),U=h.jsx(On,{points:k,lineWidth:l,color:a}),W=hI(u),F=g.useMemo(()=>{const _=new jl;if(o.length===0)return _;if(n===Zo.Gambrel)QHe(_,o);else{const G=o[0].points[0];_.moveTo(G.x,G.y);for(const Q of o){const oe=Q.points[1];_.lineTo(oe.x,oe.y)}_.closePath()}return _},[o,r,n]),E=g.useMemo(()=>{const _=new jl;if(o.length===0)return _;if(n===Zo.Gambrel)QHe(_,o);else{const G=o[0].points[0];_.moveTo(G.x,G.y);for(const Q of o){const oe=Q.points[1];_.lineTo(oe.x,oe.y)}_.closePath()}if(M.length>0)for(const G of M){const Q=new ue(G.cx,G.cy,G.cz).sub(r);switch(G.windowType){case Ti.Polygonal:{const[oe,ee]=G.polygonTop??P1,[$,ae,Z]=[G.lx/2,G.lz/2,oe*G.lx],ne=UX($,ae,Z,ee,Q.x,Q.y);_.holes.push(ne);break}case Ti.Arched:{const oe=NX(G.lx,G.lz,G.archHeight,Q.x,Q.y);_.holes.push(oe);break}default:{const oe=new jl,[ee,$]=[G.lx/2,G.lz/2];oe.moveTo(Q.x-ee,Q.y-$),oe.lineTo(Q.x+ee,Q.y-$),oe.lineTo(Q.x+ee,Q.y+$),oe.lineTo(Q.x-ee,Q.y+$),oe.closePath(),_.holes.push(oe)}}}return _},[o,r,M,n]),L=g.useMemo(()=>M.map(_=>{const[G,Q,oe]=_.rotation,ee=new ue(_.cx,_.cy,_.cz).sub(r),$=new cn().fromArray([_.rotation[0],_.rotation[1],_.rotation[2],"ZXY"]);switch(_.windowType){case Ti.Polygonal:{const[ae,Z]=_.polygonTop??P1,[ne,te,q]=[_.lx/2,_.lz/2,ae*_.lx],le=UX(ne,te,q,Z),de=new os(new C3([le],{steps:1,depth:_.ly,bevelEnabled:!1})),he=new ue(0,0,-_.ly).applyEuler($);return de.position.copy(ee.clone().add(he)),de.rotation.copy($),de.updateMatrix(),de}case Ti.Arched:{const ae=NX(_.lx,_.lz,_.archHeight),Z=new os(new C3([ae],{steps:1,depth:_.ly,bevelEnabled:!1})),ne=new ue(0,0,-_.ly).applyEuler($);return Z.position.copy(ee.clone().add(ne)),Z.rotation.copy($),Z.updateMatrix(),Z}default:{const ae=new os(new V3(_.lx,_.lz,_.ly*2));return ae.position.copy(ee),ae.rotation.set(G,Q,oe),ae.updateMatrix(),ae}}}),[M,i]),j=u===Yr.NoTexture&&c&&c===s,Y=p&&!T,O=m&&d;return h.jsxs(h.Fragment,{children:[j&&!O?h.jsx(IJ,{uuid:t,simulation:!0,shape:F,holeMeshes:L,thickness:i,castShadow:Y,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:c,transparent:T,opacity:R})}):h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{uuid:t,userData:{simulation:!0},name:"Flat roof top shape",position:[0,0,i+.001],receiveShadow:p,children:[h.jsx("shapeGeometry",{args:[E]}),O?h.jsx("meshBasicMaterial",{map:d,side:$i}):h.jsx("meshStandardMaterial",{map:W,color:c,transparent:T,opacity:R,side:$i})]}),h.jsx(IJ,{shape:F,holeMeshes:L,thickness:i,castShadow:Y,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:s??"white",transparent:T,opacity:R})})]}),U,h.jsxs("group",{position:[0,0,i],children:[U,k.map((_,G)=>{const Q=[_.clone().sub(N),_];return h.jsx(On,{points:Q,lineWidth:l,color:a},G)})]}),D&&D.map((_,G)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:_,name:"Heat Flux "+G,lineWidth:C??Uy,color:x??Fu}),";",h.jsx(Rf,{userData:{unintersectable:!0},position:v.current?_[S.current].clone().add(v.current):_[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:b.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:x??Fu})})]},G))]})},Dot="/aladdin/assets/foundation_01--kFbnI98.png",Eot="/aladdin/assets/foundation_02-wZzxF61c.png",kot="/aladdin/assets/foundation_03-CrR6CCyr.png",Fot="/aladdin/assets/foundation_04-k0ozbTjk.png",Lot="/aladdin/assets/foundation_05-Bwrj98Mu.png",Wot="/aladdin/assets/foundation_06-BOa0J0il.png",Not="/aladdin/assets/foundation_07-C9gRAfER.png",gI="/aladdin/assets/helvetiker_regular.typeface-B9JafPRX.fnt",j3e=xe.memo(({element:t,height:e})=>{const n=H(SQ),o=H($y),r=H(QPt),i=H($r),a=H(h4),[l,s]=g.useState(),[c,u]=g.useState(10),[d,f]=g.useState(0);g.useEffect(()=>{if(n||o){const{cx:P,cy:A,lx:S,ly:v,type:b}=t;switch(b){case z.SolarPanel:{const T=i(t);if(T){const R=P*T.lx,M=A*T.ly;s(new ue(R,M,e??T.lz))}break}case z.Foundation:{s(new ue(P,A,a?.1:0));break}case z.Cuboid:{const{pos:T}=ye.getWorldDataById(t.id),{rot:R}=ye.getWorldDataById(t.parentId);s(new ue(T.x,T.y,T.z-t.lz/2+.2)),f(R);break}default:{s(new ue(P,A,a?.2:0));break}}u(Math.max(5,Math.hypot(S,v)*.75))}},[t,n,o,a,e]);const p=B5(NM,gI),m=c*.05,y={font:p,height:0,size:m},w=new Array(25).fill(0),x=P=>P===0?-m*.3:P>0&&P<7?-m*.8:-m*1.2,C=a?"#222":"#ccc";return h.jsx(h.Fragment,{children:l&&h.jsxs("group",{position:l,rotation:[$t,d,0],name:"Polar Auxiliary",children:[h.jsx("polarGridHelper",{args:[c,24,6,120,C,C],userData:{unintersectable:!0}}),h.jsx(FX,{args:[c*.98,c,24,1,$t,r],userData:{unintersectable:!0},rotation:[-$t,0,0],children:h.jsx("meshBasicMaterial",{side:zr,color:"yellow"})}),h.jsx("group",{rotation:[0,r,0],children:h.jsx("mesh",{position:[-.5,0,-c*.9],rotation:[-$t,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-ye.toDegrees(r).toFixed(1)}°`,y]})})}),w.map((P,A)=>{let S=Math.ceil(A/2)*(A%2===0?1:-1);S===-12&&(S=12);const v=x(Math.abs(S));return h.jsx("group",{rotation:[0,S*Math.PI/12,0],children:h.jsxs("mesh",{position:[v,0,-c*1.05],rotation:[-$t,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*S}°`,y]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},A)})]})})}),MH=xe.memo(({id:t,position:e,ratio:n,handleType:o,hoverHandle:r,noHoverHandle:i})=>{const a=H(z0),l=H(SQ),c=H($y)===o||l===o?Aa:ll,u=h.jsx("meshBasicMaterial",{color:c});return h.jsxs("group",{position:e,rotation:[$t,0,0],scale:n,name:o,children:[h.jsxs("group",{children:[h.jsx(O2e,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[$t,0,$t],children:u}),h.jsx(Rf,{args:[.1,.1,6],rotation:[$t,0,0],position:[.15,0,.05],children:u}),h.jsx(fH,{args:[.05,6],rotation:[0,$t,0],position:[0,0,.15],children:u})]}),h.jsx(di,{name:o,args:[.45,.45,.15],position:[0,.05,0],rotation:[-$t,0,0],visible:!1,onPointerDown:d=>{a(t,d,er.Rotate)},onPointerOver:d=>{r(d,o)},onPointerOut:i})]})}),o4=xe.memo(({hx:t,hy:e,hz:n,lineColor:o="black",lineWidth:r=.2})=>h.jsx(On,{points:[[-t,-e,-n],[t,-e,-n],[t,-e,n],[t,-e,-n],[t,e,-n],[t,e,n],[t,e,-n],[-t,e,-n],[-t,e,n],[-t,e,-n],[-t,-e,-n],[-t,-e,n],[t,-e,n],[t,e,n],[-t,e,n],[-t,-e,n]],name:"Wireframe",userData:{unintersectable:!0},lineWidth:r,color:o}));var Qr=(t=>(t.left="Left",t.right="Right",t.loop="Loop",t.null="Null",t))(Qr||{});const B3e=xe.memo(({element:t,verticalLift:e})=>{const n=H(Au),o=H(M0),r=H(Cm),i=H($y),a=t.lx/2,l=t.ly/2,s=.2,c=1,u=.5,d=t.lineColor??"white",f="darkorchid",p=Math.max(1,(a+l)/32),m=g.useMemo(()=>({lng:n}),[n]),y=g.useMemo(()=>{switch(t.type){case z.Cuboid:return Math.max(.5,Math.max(a,l)*.1)}return .5},[t.type,a,l]),w=g.useMemo(()=>{switch(t.type){case z.Cuboid:return o?t.lz/2+.1:-t.lz/2+.1;case z.Foundation:return t.lz+.1}return .1},[o,t.type,t.lz]),x=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[-a-y,0,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a-y,-l,w],[-a-y,l,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a-y+s,-l+3*s,w],[-a-y,-l,w],[-a-y-s,-l+3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a-y+s,l-3*s,w],[-a-y,l,w],[-a-y-s,l-3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,-l,w],[-a-y*2,-l,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,l,w],[-a-y*2,l,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]),C=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[a+y,0,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[a+y,-l,w],[a+y,l,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a+y+s,-l+3*s,w],[a+y,-l,w],[a+y-s,-l+3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a+y+s,l-3*s,w],[a+y,l,w],[a+y-s,l-3*s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,-l,w],[a+y*2,-l,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,l,w],[a+y*2,l,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]),P=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,-l-y,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,-l-y,w],[a,-l-y,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a+3*s,-l-y-s,w],[-a,-l-y,w],[-a+3*s,-l-y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a-3*s,-l-y-s,w],[a,-l-y,w],[a-3*s,-l-y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,-l,w],[-a,-l-y*2,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,-l,w],[a,-l-y*2,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]),A=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",m),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,l+y,w+e]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,l+y,w],[a,l+y,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a+3*s,l+y-s,w],[-a,l+y,w],[-a+3*s,l+y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[a-3*s,l+y-s,w],[a,l+y,w],[a-3*s,l+y+s,w]],color:d,linewidth:c}),h.jsx(On,{userData:{unintersectable:!0},points:[[-a,l,w],[-a,l+y*2,w]],color:d,linewidth:u}),h.jsx(On,{userData:{unintersectable:!0},points:[[a,l,w],[a,l+y*2,w]],color:d,linewidth:u})]}),[a,l,w,m,d,e]);if(r)if(t.type===z.Wall)switch(r){case xt.LowerLeft:return P;case xt.LowerRight:return P}else switch(r){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[x,P]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[x,A]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[C,A]})}if(i)if(t.type===z.Wall)switch(i){case xt.LowerLeft:return P;case xt.LowerRight:return P}else switch(i){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[x,P]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[x,A]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[C,A]})}return h.jsx(h.Fragment,{})}),Tdn=1.361,ZHe=9.8067,eMe=1012,D_=1.225,Aw=273.15,tMe=567e-10,Pdn=[.103,.104,.109,.12,.13,.137,.138,.134,.121,.111,.106,.103];var hi=(t=>(t[t.NONE=0]="NONE",t[t.KASTEN_YOUNG=1]="KASTEN_YOUNG",t[t.SPHERE_MODEL=2]="SPHERE_MODEL",t))(hi||{});const f5=1440,Wpe=Math.PI/720,Gse=Math.PI/182.5,nMe=30,Cdn=120;class oMe{constructor(e,n){this.sunrise=e,this.sunset=n}daylight(){return this.sunset-this.sunrise}}const tA=.5,Zu=.1,dC=23.45/180*Math.PI,Rdn=1e3*60*60*24,WR=720,FU=t=>{const e=Math.floor((t.getTime()-new Date(t.getFullYear(),0,0).getTime())/Rdn);return dC*Math.sin(fa*(284+e)/365.25)},pl=(t,e)=>{const n=Math.tan(ye.toRadians(e))*Math.tan(FU(t));if(Math.abs(n)>1)return new oMe(0,n>0?WR*2:0);const o=60*Math.acos(-n)/ye.toRadians(15);return new oMe(WR-o,WR+o)},Y3e=t=>(t.getHours()*60+t.getMinutes()-WR)/WR*Math.PI,E_=t=>(t/WR-1)*Math.PI,zi=(t,e)=>_9(1,Y3e(t),FU(t),ye.toRadians(e)).normalize(),_9=(t,e,n,o)=>{const r=Math.cos(n),i=Math.sin(n),a=Math.cos(o),l=Math.sin(o),s=Math.cos(e),c=Math.sin(e),u=Math.asin(i*l+r*s*a),d=c*r,f=a*i-s*r*l,p=Math.atan2(f,d),m=new ue(t,p,u);return ye.sphericalToCartesianZ(m),m.x=-m.x,m},Hdn=t=>{const e=fa*t/365,n=1.00011+.034221*Math.cos(e)+.00128*Math.sin(e)+719e-6*Math.cos(2*e)+77e-6*Math.sin(2*e);return Tdn*n},Mdn=(t,e,n)=>{let o;switch(t){case hi.NONE:return 1;case hi.KASTEN_YOUNG:return o=e.angleTo(Oo),1/(Math.cos(o)+.50572*Math.pow(96.07995-o/Math.PI*180,-1.6364));default:{o=e.angleTo(Oo);const r=Math.cos(o),i=708,a=n/9e3;return Math.sqrt((i+a)*(i+a)*r*r+(2*i+1+a)*(1-a))-(i+a)*r}}},Si=(t,e,n,o)=>Hdn(e)*Math.pow(.7,Math.pow(Mdn(o,t,n),.678)),ei=(t,e,n,o)=>{let r=0;const i=n.dot(Oo),a=.5*(1+i);a>0&&(r+=Pdn[e]*a*o);const l=.5*Math.abs(1-i);return ye.isZero(l)||(r+=t.albedo*l*o),r},Idn=xe.memo(({foundation:t})=>{const e=H(ml),n=H(tu),o=dt(cXe),r=dt(Ef),i=dt(A5e),a=dt(vs),l=H(Df),s=In(O1),[c,u]=g.useState(null),d=g.useRef(null),{lx:f,ly:p,lz:m,solarUpdraftTower:y}=t,w=((y==null?void 0:y.collectorRadius)??100)*.016,x=g.useMemo(()=>zi(new Date(e),n),[e,n]),C=g.useMemo(()=>{const A=[],S=(((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))+m)/2,v=(y==null?void 0:y.chimneyHeight)??Math.max(f,p),b=(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,T=(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),R=b*1.15,M=T*.5,D=T,k=T*2,N=T*4,U=6;for(let W=0;W{const A=[],S=((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))+m,v=(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,b=25,T=2*v/b;for(let R=0;R<=b;R++){const M=[],D=-v+R*T,k=Math.sqrt(v*v-D*D);M.push(new ue(-k,D,S)),M.push(new ue(k,D,S)),A.push({points:M})}for(let R=0;R<=b;R++){const M=[],D=-v+R*T,k=Math.sqrt(v*v-D*D);M.push(new ue(D,-k,S)),M.push(new ue(D,k,S)),A.push({points:M})}return A},[f,p,m,y==null?void 0:y.collectorRadius,y==null?void 0:y.collectorHeight]);return g.useEffect(()=>{if(t&&a){const A=s(t.id+"-sut");A&&u(ye.fetchHeatmapTexture(A,l??5))}},[a,l]),Gp((A,S)=>{(o||r&&!i)&&x.z>0&&d.current&&d.current.children.forEach(v=>{if(v.name==="Streamlines"){const b=v;b.material.uniforms.dashOffset.value-=S*w*10}})}),h.jsxs("group",{children:[h.jsx(wa,{userData:{unintersectable:!0,simulation:!0},name:"Chimney",castShadow:!0,receiveShadow:!1,args:[(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(y==null?void 0:y.chimneyHeight)??Math.max(f,p),16,2,!0],position:[0,0,((y==null?void 0:y.chimneyHeight)??Math.max(f,p))/2+m],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:zr})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Chimney Base",castShadow:!0,receiveShadow:!1,args:[(y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),((y==null?void 0:y.chimneyRadius)??Math.max(1,.025*Math.min(f,p)))*1.6,((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))*4,16,2,!0],position:[0,0,((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))*2+m],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:zr})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Greenhouse Wall",castShadow:!0,receiveShadow:!0,args:[(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,(y==null?void 0:y.collectorHeight)??Math.max(3,10*m),50,2,!0],position:[0,0,((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))/2+m],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:zr})}),h.jsx(fH,{uuid:t.id+"-sut",userData:{unintersectable:!0,simulation:!0},name:"Greenhouse Ceiling",castShadow:!1,receiveShadow:!1,args:[(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,50,0,fa],position:[0,0,m+((y==null?void 0:y.collectorHeight)??Math.max(3,10*m))],children:a&&c?h.jsx("meshBasicMaterial",{attach:"material",side:$i,map:c}):h.jsx("meshPhongMaterial",{attach:"material",specular:new ir("white"),shininess:50,side:$i,color:"lightskyblue",transparent:!0,opacity:.75})}),h.jsx(fH,{userData:{unintersectable:!0},name:"Greenhouse Ground",castShadow:!1,receiveShadow:!0,args:[(y==null?void 0:y.collectorRadius)??Math.min(f,p)/2,50,0,fa],position:[0,0,.1],children:h.jsx("meshStandardMaterial",{attach:"material",color:"dimgray"})}),P&&P.map((A,S)=>h.jsx(On,{name:"Greenhouse Roof Grid Lines",userData:{unintersectable:!0},points:A.points,castShadow:!1,receiveShadow:!1,lineWidth:.2,color:"gray"},S)),x.z>0&&C&&h.jsx("group",{ref:d,children:C.map((A,S)=>{const v=A.points[0].x+A.points[1].x,b=A.points[0].y+A.points[1].y,T=new cn(0,0,fa*S/C.length+$t),R=w,M=w;return h.jsxs(xe.Fragment,{children:[h.jsx(On,{name:"Streamlines",userData:{unintersectable:!0},points:A.points,castShadow:!1,receiveShadow:!1,lineWidth:.5,dashed:!0,dashSize:R,gapSize:M,color:"white"}),h.jsx(Rf,{userData:{unintersectable:!0},args:[w,w*4,4,2],name:"Streamline Inlet Arrow Head",position:[v*.1,b*.1,A.points[0].z],rotation:T,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(Rf,{userData:{unintersectable:!0},args:[w,w*4,4,2],name:"Streamline Inlet Arrow Head",position:[v*.9,b*.9,A.points[0].z],rotation:T,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})})]},S)})})]})}),O3e="/aladdin/assets/glow-CV5NAijT.png",zdn=xe.memo(({foundation:t})=>{const e=H(ml),n=H(tu),o=g.useMemo(()=>zi(new Date(e),n),[e,n]),r=Up(O3e),{lz:i,solarPowerTower:a}=t,l=(a==null?void 0:a.towerRadius)??1,s=(a==null?void 0:a.towerHeight)??20,c=s/10,u=l*1.5;return h.jsxs("group",{children:[h.jsx(wa,{userData:{unintersectable:!0},name:"Focus Tower",castShadow:!0,receiveShadow:!1,args:[l,l,s,6,2],position:[0,0,s/2+i/2],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Center Receiver",castShadow:!0,receiveShadow:!1,args:[u,u,c,10,2],position:[0,0,s+i/2],rotation:[$t,0,0],children:o.z>0?h.jsx("meshBasicMaterial",{color:[1,1,1],toneMapped:!1}):h.jsx("meshStandardMaterial",{color:"white"})}),o.z>0&&h.jsx("sprite",{scale:[10,10,10],position:[0,0,s+i/2],children:h.jsx("spriteMaterial",{map:r,color:"white",blending:Th,depthWrite:!1})})]})}),Uot="/aladdin/assets/glow_cylinderic-BQLm1JqX.png",jot="/aladdin/assets/glow_corner-CuJ72sMM.png",Ddn=xe.memo(({foundation:t})=>{const{ly:e,lz:n,solarAbsorberPipe:o}=t,r=H(ml),i=H(tu),a=g.useMemo(()=>zi(new Date(r),i),[r,i]),l=Up(Uot),s=Up(jot),c=g.useRef(null),u=(o==null?void 0:o.absorberHeight)??10,d=(o==null?void 0:o.apertureWidth)??.6,f=(o==null?void 0:o.relativeLength)??.9,p=(o==null?void 0:o.poleNumber)??5,m=g.useMemo(()=>{const y=[],w=f*e/(p+1);for(let x=1;x<=p;x++)y.push(new ue(0,x*w-f*e/2,u/2+n/2));return y},[e,n,p,u,f]);return Gp(({camera:y})=>{if(!c.current)return;const w=c.current.localToWorld(new ue(0,0,0)),x=new ue().subVectors(y.position,w).applyEuler(new cn(0,0,-t.rotation[2])),C=Math.atan2(x.z,x.x);c.current.rotation.y=-Math.PI/2-C}),h.jsxs("group",{children:[h.jsx(wa,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 1",castShadow:!1,receiveShadow:!1,args:[d/4,d/4,u,6,2],position:[0,-f*e/2,u/2+n/2],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 2",castShadow:!1,receiveShadow:!1,args:[d/4,d/4,u,6,2],position:[0,f*e/2,u/2+n/2],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Receiver Horizontal Pipe",castShadow:!1,receiveShadow:!1,args:[d/2,d/2,f*e+d/2,6,2,!1,3*$t,Math.PI],position:[0,0,u+n/2-d/4],children:a.z>0?h.jsx("meshStandardMaterial",{color:[1,1,1],toneMapped:!1,side:zr}):h.jsx("meshStandardMaterial",{color:"white",side:zr})}),a.z>0&&h.jsxs("group",{ref:c,position:[0,0,u+n/2-d/4],children:[h.jsx(yi,{args:[2,f*e+d/2],children:h.jsx("meshBasicMaterial",{side:zr,map:l,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],rotation:[0,0,Math.PI],position:[.5,.5+(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],rotation:[0,0,-Math.PI/2],position:[-.5,.5+(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],rotation:[0,0,Math.PI/2],position:[.5,-.5-(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[1,1],position:[-.5,-.5-(f*e+d/2)/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:s,color:"white",blending:Th,transparent:!0})})]}),m&&m.map((y,w)=>h.jsx(wa,{userData:{unintersectable:!0},name:"Solar Receiver Pole "+w,castShadow:!1,receiveShadow:!1,args:[d/8,d/8,u,4,2],position:y,rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})},w))]})});class xb{static selectMe(e,n,o,r){var i,a,l;if(o.intersections.length>0&&o.intersections.filter(c=>!c.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===o.eventObject){for(const c of e.elements)c.id===n?(c.selected=!0,e.selectedElement=c,e.selectedElementHeight=c.lz):c.selected=!1;if(!e.selectedElement)return;if(r===er.ContextMenu)if(e.selectedElementIdSet.has(n))for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id);else if(e.multiSelectionsMode){e.selectedElementIdSet.add(n);for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id)}else e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n);else e.multiSelectionsMode?e.selectedElementIdSet.has(n)?e.selectedElementIdSet.delete(n):e.selectedElementIdSet.add(n):(e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n));if(e.moveHandleType=null,e.resizeHandleType=null,e.rotateHandleType=null,r)switch(r){case er.Move:((i=e.selectedElement)==null?void 0:i.type)===z.Tree||((a=e.selectedElement)==null?void 0:a.type)===z.Human?e.moveHandleType=Ho.Default:e.moveHandleType=o.eventObject.name;break;case er.Resize:e.resizeHandleType=o.eventObject.name;break;case er.Rotate:e.rotateHandleType=o.eventObject.name;break;case er.Select:e.selectedElementAngle=((l=o.object.parent)==null?void 0:l.rotation.z)??0;break}}}static selectNone(e){e.selectedElementIdSet.clear();for(const n of e.elements)n.selected=!1;e.selectedElement=null,e.selectedElementIdSet.clear()}static clearThenAddSelectedElementIdSet(e,n){e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n)}}var zJ={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */zJ.exports;(function(t,e){(function(){var n,o="4.17.21",r=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",l="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",c=500,u="__lodash_placeholder__",d=1,f=2,p=4,m=1,y=2,w=1,x=2,C=4,P=8,A=16,S=32,v=64,b=128,T=256,R=512,M=30,D="...",k=800,N=16,U=1,W=2,F=3,E=1/0,L=9007199254740991,j=17976931348623157e292,Y=NaN,O=4294967295,_=O-1,G=O>>>1,Q=[["ary",b],["bind",w],["bindKey",x],["curry",P],["curryRight",A],["flip",R],["partial",S],["partialRight",v],["rearg",T]],oe="[object Arguments]",ee="[object Array]",q="[object AsyncFunction]",ae="[object Boolean]",Z="[object Date]",ne="[object DOMException]",te="[object Error]",$="[object Function]",le="[object GeneratorFunction]",de="[object Map]",he="[object Number]",me="[object Null]",ce="[object Object]",Pe="[object Promise]",pe="[object Proxy]",Ie="[object RegExp]",ve="[object Set]",ze="[object String]",Ae="[object Symbol]",se="[object Undefined]",ge="[object WeakMap]",we="[object WeakSet]",Se="[object ArrayBuffer]",Me="[object DataView]",Ce="[object Float32Array]",Te="[object Float64Array]",Re="[object Int8Array]",Ne="[object Int16Array]",_e="[object Int32Array]",Ue="[object Uint8Array]",qe="[object Uint8ClampedArray]",Fe="[object Uint16Array]",He="[object Uint32Array]",Le=/\b__p \+= '';/g,Ye=/\b(__p \+=) '' \+/g,lt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Oe=/&(?:amp|lt|gt|quot|#39);/g,ut=/[&<>"']/g,ht=RegExp(Oe.source),Qe=RegExp(ut.source),nt=/<%-([\s\S]+?)%>/g,mt=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,gt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,je=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,bt=RegExp(et.source),St=/^\s+/,Pt=/\s/,Yt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zt=/\{\n\/\* \[wrapped with (.+)\] \*/,Rt=/,? & /,Ct=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,yt=/[()=,{}\[\]\/\s]/,at=/\\(\\)?/g,Et=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Lt=/\w*$/,Je=/^[-+]0x[0-9a-f]+$/i,st=/^0b[01]+$/i,It=/^\[object .+?Constructor\]$/,ot=/^0o[0-7]+$/i,it=/^(?:0|[1-9]\d*)$/,Be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,pt=/($^)/,ct=/['\n\r\u2028\u2029\\]/g,Xe="\\ud800-\\udfff",ft="\\u0300-\\u036f",wt="\\ufe20-\\ufe2f",kt="\\u20d0-\\u20ff",Zt=ft+wt+kt,Ot="\\u2700-\\u27bf",on="a-z\\xdf-\\xf6\\xf8-\\xff",qt="\\xac\\xb1\\xd7\\xf7",rn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pn="\\u2000-\\u206f",fo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",to="A-Z\\xc0-\\xd6\\xd8-\\xde",Dt="\\ufe0e\\ufe0f",fn=qt+rn+Pn+fo,kn="['’]",yo="["+Xe+"]",ur="["+fn+"]",lr="["+Zt+"]",xo="\\d+",wo="["+Ot+"]",Rr="["+on+"]",Eo="[^"+Xe+fn+xo+Ot+on+to+"]",An="\\ud83c[\\udffb-\\udfff]",Dn="(?:"+lr+"|"+An+")",sr="[^"+Xe+"]",Vo="(?:\\ud83c[\\udde6-\\uddff]){2}",Wo="[\\ud800-\\udbff][\\udc00-\\udfff]",To="["+to+"]",Go="\\u200d",No="(?:"+Rr+"|"+Eo+")",ho="(?:"+To+"|"+Eo+")",vo="(?:"+kn+"(?:d|ll|m|re|s|t|ve))?",bo="(?:"+kn+"(?:D|LL|M|RE|S|T|VE))?",Bo=Dn+"?",Pr="["+Dt+"]?",so="(?:"+Go+"(?:"+[sr,Vo,Wo].join("|")+")"+Pr+Bo+")*",zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ci="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ea=Pr+Bo+so,rs="(?:"+[wo,Vo,Wo].join("|")+")"+ea,Da="(?:"+[sr+lr+"?",lr,Vo,Wo,yo].join("|")+")",or=RegExp(kn,"g"),cr=RegExp(lr,"g"),ii=RegExp(An+"(?="+An+")|"+Da+ea,"g"),Ga=RegExp([To+"?"+Rr+"+"+vo+"(?="+[ur,To,"$"].join("|")+")",ho+"+"+bo+"(?="+[ur,To+No,"$"].join("|")+")",To+"?"+No+"+"+vo,To+"+"+bo,Ci,zo,xo,rs].join("|"),"g"),xi=RegExp("["+Go+Xe+Zt+Dt+"]"),Uu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_s=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],sc=-1,ta={};ta[Ce]=ta[Te]=ta[Re]=ta[Ne]=ta[_e]=ta[Ue]=ta[qe]=ta[Fe]=ta[He]=!0,ta[oe]=ta[ee]=ta[Se]=ta[ae]=ta[Me]=ta[Z]=ta[te]=ta[$]=ta[de]=ta[he]=ta[ce]=ta[Ie]=ta[ve]=ta[ze]=ta[ge]=!1;var Ea={};Ea[oe]=Ea[ee]=Ea[Se]=Ea[Me]=Ea[ae]=Ea[Z]=Ea[Ce]=Ea[Te]=Ea[Re]=Ea[Ne]=Ea[_e]=Ea[de]=Ea[he]=Ea[ce]=Ea[Ie]=Ea[ve]=Ea[ze]=Ea[Ae]=Ea[Ue]=Ea[qe]=Ea[Fe]=Ea[He]=!0,Ea[te]=Ea[$]=Ea[ge]=!1;var Cs={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},El={"&":"&","<":"<",">":">",'"':""","'":"'"},Vs={"&":"&","<":"<",">":">",""":'"',"'":"'"},Rs={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qp=parseFloat,gn=parseInt,tn=typeof Rc=="object"&&Rc&&Rc.Object===Object&&Rc,Gt=typeof self=="object"&&self&&self.Object===Object&&self,wn=tn||Gt||Function("return this")(),Cn=e&&!e.nodeType&&e,Wn=Cn&&!0&&t&&!t.nodeType&&t,Un=Wn&&Wn.exports===Cn,rt=Un&&tn.process,vt=function(){try{var vn=Wn&&Wn.require&&Wn.require("util").types;return vn||rt&&rt.binding&&rt.binding("util")}catch{}}(),Nt=vt&&vt.isArrayBuffer,Ft=vt&&vt.isDate,en=vt&&vt.isMap,sn=vt&&vt.isRegExp,dn=vt&&vt.isSet,En=vt&&vt.isTypedArray;function xn(vn,lo,Xn){switch(Xn.length){case 0:return vn.call(lo);case 1:return vn.call(lo,Xn[0]);case 2:return vn.call(lo,Xn[0],Xn[1]);case 3:return vn.call(lo,Xn[0],Xn[1],Xn[2])}return vn.apply(lo,Xn)}function Tn(vn,lo,Xn,Ir){for(var Ri=-1,Gi=vn==null?0:vn.length;++Ri-1}function Xr(vn,lo,Xn){for(var Ir=-1,Ri=vn==null?0:vn.length;++Ir-1;);return Xn}function iu(vn,lo){for(var Xn=vn.length;Xn--&&Wc(lo,vn[Xn],0)>-1;);return Xn}function dd(vn,lo){for(var Xn=vn.length,Ir=0;Xn--;)vn[Xn]===lo&&++Ir;return Ir}var t9=ou(Cs),n9=ou(El);function $7(vn){return"\\"+Rs[vn]}function I4(vn,lo){return vn==null?n:vn[lo]}function h2(vn){return xi.test(vn)}function p6(vn){return Uu.test(vn)}function o9(vn){for(var lo,Xn=[];!(lo=vn.next()).done;)Xn.push(lo.value);return Xn}function g6(vn){var lo=-1,Xn=Array(vn.size);return vn.forEach(function(Ir,Ri){Xn[++lo]=[Ri,Ir]}),Xn}function jf(vn,lo){return function(Xn){return vn(lo(Xn))}}function xu(vn,lo){for(var Xn=-1,Ir=vn.length,Ri=0,Gi=[];++Xn-1}function T6(X,re){var Ee=this.__data__,Ze=r1(Ee,X);return Ze<0?(++this.size,Ee.push([X,re])):Ee[Ze][1]=re,this}Zh.prototype.clear=vT,Zh.prototype.delete=F4,Zh.prototype.get=S6,Zh.prototype.has=ix,Zh.prototype.set=T6;function fd(X){var re=-1,Ee=X==null?0:X.length;for(this.clear();++re=re?X:re)),X}function hd(X,re,Ee,Ze,Mt,Xt){var hn,bn=re&d,Ln=re&f,Po=re&p;if(Ee&&(hn=Mt?Ee(X,Ze,Mt,Xt):Ee(X)),hn!==n)return hn;if(!Xa(X))return X;var Ro=Ki(X);if(Ro){if(hn=Qoe(X),!bn)return jc(X,hn)}else{var Yo=Ad(X),Hr=Yo==$||Yo==le;if(Xm(X))return yx(X,bn);if(Yo==ce||Yo==oe||Hr&&!Mt){if(hn=Ln||Hr?{}:Vj(X),!bn)return Ln?_4(X,ep(hn,X)):O4(X,R6(hn,X))}else{if(!Ea[Yo])return Mt?X:{};hn=Zoe(X,Yo,bn)}}Xt||(Xt=new Ns);var oi=Xt.get(X);if(oi)return oi;Xt.set(X,hn),tw(X)?X.forEach(function(Mi){hn.add(hd(Mi,re,Ee,Mi,X,Xt))}):_T(X)&&X.forEach(function(Mi,Ja){hn.set(Ja,hd(Mi,re,Ee,Ja,X,Xt))});var Hi=Po?Ln?ja:Bc:Ln?tf:Gu,Ia=Ro?n:Hi(X);return _n(Ia||X,function(Mi,Ja){Ia&&(Ja=Mi,Mi=X[Ja]),Of(hn,Ja,hd(Mi,re,Ee,Ja,X,Xt))}),hn}function j4(X){var re=Gu(X);return function(Ee){return A2(Ee,X,re)}}function A2(X,re,Ee){var Ze=Ee.length;if(X==null)return!Ze;for(X=vi(X);Ze--;){var Mt=Ee[Ze],Xt=re[Mt],hn=X[Mt];if(hn===n&&!(Mt in X)||!Xt(hn))return!1}return!0}function w2(X,re,Ee){if(typeof X!="function")throw new L0(a);return $4(function(){X.apply(n,Ee)},re)}function i1(X,re,Ee,Ze){var Mt=-1,Xt=qo,hn=!0,bn=X.length,Ln=[],Po=re.length;if(!bn)return Ln;Ee&&(re=qr(re,ru(Ee))),Ze?(Xt=Xr,hn=!1):re.length>=r&&(Xt=va,hn=!1,re=new cg(re));e:for(;++MtMt?0:Mt+Ee),Ze=Ze===n||Ze>Mt?Mt:ua(Ze),Ze<0&&(Ze+=Mt),Ze=Ee>Ze?0:YB(Ze);Ee0&&Ee(bn)?re>1?Nc(bn,re-1,Ee,Ze,Mt):na(Mt,bn):Ze||(Mt[Mt.length]=bn)}return Mt}var m9=V4(),op=V4(!0);function pd(X,re){return X&&m9(X,re,Gu)}function Tu(X,re){return X&&op(X,re,Gu)}function Xd(X,re){return go(re,function(Ee){return c1(X[Ee])})}function _f(X,re){re=ap(re,X);for(var Ee=0,Ze=re.length;X!=null&&Eere}function ux(X,re){return X!=null&&aa.call(X,re)}function Lm(X,re){return X!=null&&re in vi(X)}function TT(X,re,Ee){return X>=Su(re,Ee)&&X=120&&Ro.length>=120)?new cg(hn&&Ro):n}Ro=X[0];var Yo=-1,Hr=bn[0];e:for(;++Yo-1;)bn!==X&&Bf.call(bn,Ln,1),Bf.call(X,Ln,1);return X}function Ru(X,re){for(var Ee=X?re.length:0,Ze=Ee-1;Ee--;){var Mt=re[Ee];if(Ee==Ze||Mt!==Xt){var Xt=Mt;H2(Mt)?Bf.call(X,Mt,1):hx(X,Mt)}}return X}function yd(X,re){return X+x6(Yu()*(re-X+1))}function Kd(X,re,Ee,Ze){for(var Mt=-1,Xt=dc(y2((re-X)/(Ee||1)),0),hn=Xn(Xt);Xt--;)hn[Ze?Xt:++Mt]=X,X+=Ee;return hn}function Om(X,re){var Ee="";if(!X||re<1||re>L)return Ee;do re%2&&(Ee+=X),re=x6(re/2),re&&(X+=X);while(re);return Ee}function fi(X,re){return fz($j(X,re,nf),X+"")}function PT(X){return p9(ms(X))}function Y4(X,re){var Ee=ms(X);return MT(Ee,ug(re,0,Ee.length))}function dg(X,re,Ee,Ze){if(!Xa(X))return X;re=ap(re,X);for(var Mt=-1,Xt=re.length,hn=Xt-1,bn=X;bn!=null&&++MtMt?0:Mt+re),Ee=Ee>Mt?Mt:Ee,Ee<0&&(Ee+=Mt),Mt=re>Ee?0:Ee-re>>>0,re>>>=0;for(var Xt=Xn(Mt);++Ze>>1,hn=X[Xt];hn!==null&&!$f(hn)&&(Ee?hn<=re:hn=r){var Po=re?null:d0(X);if(Po)return r9(Po);hn=!1,Mt=va,Ln=new cg}else Ln=re?[]:bn;e:for(;++Ze=Ze?X:c0(X,re,Ee)}var k6=l9||function(X){return wn.clearTimeout(X)};function yx(X,re){if(re)return X.slice();var Ee=X.length,Ze=w6?w6(Ee):new X.constructor(Ee);return X.copy(Ze),Ze}function Kf(X){var re=new X.constructor(X.byteLength);return new kl(re).set(new kl(X)),re}function P2(X,re){var Ee=re?Kf(X.buffer):X.buffer;return new X.constructor(Ee,X.byteOffset,X.byteLength)}function u0(X){var re=new X.constructor(X.source,Lt.exec(X));return re.lastIndex=X.lastIndex,re}function b9(X){return lg?vi(lg.call(X)):{}}function CT(X,re){var Ee=re?Kf(X.buffer):X.buffer;return new X.constructor(Ee,X.byteOffset,X.length)}function lp(X,re){if(X!==re){var Ee=X!==n,Ze=X===null,Mt=X===X,Xt=$f(X),hn=re!==n,bn=re===null,Ln=re===re,Po=$f(re);if(!bn&&!Po&&!Xt&&X>re||Xt&&hn&&Ln&&!bn&&!Po||Ze&&hn&&Ln||!Ee&&Ln||!Mt)return 1;if(!Ze&&!Xt&&!Po&&X=bn)return Ln;var Po=Ee[Ze];return Ln*(Po=="desc"?-1:1)}}return X.index-re.index}function pg(X,re,Ee,Ze){for(var Mt=-1,Xt=X.length,hn=Ee.length,bn=-1,Ln=re.length,Po=dc(Xt-hn,0),Ro=Xn(Ln+Po),Yo=!Ze;++bn1?Ee[Mt-1]:n,hn=Mt>2?Ee[2]:n;for(Xt=X.length>3&&typeof Xt=="function"?(Mt--,Xt):n,hn&&Zd(Ee[0],Ee[1],hn)&&(Xt=Mt<3?n:Xt,Mt=1),re=vi(re);++Ze-1?Mt[Xt?re[hn]:hn]:n}}function $e(X){return la(function(re){var Ee=re.length,Ze=Ee,Mt=Ou.prototype.thru;for(X&&re.reverse();Ze--;){var Xt=re[Ze];if(typeof Xt!="function")throw new L0(a);if(Mt&&!hn&&X4(Xt)=="wrapper")var hn=new Ou([],!0)}for(Ze=hn?Ze:Ee;++Ze1&&dl.reverse(),Ro&&Lnbn))return!1;var Po=Xt.get(X),Ro=Xt.get(re);if(Po&&Ro)return Po==re&&Ro==X;var Yo=-1,Hr=!0,oi=Ee&y?new cg:n;for(Xt.set(X,re),Xt.set(re,X);++Yo1?"& ":"")+re[Ze],re=re.join(Ee>2?", ":" "),X.replace(Yt,`{ + */zJ.exports;(function(t,e){(function(){var n,o="4.17.21",r=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",l="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",c=500,u="__lodash_placeholder__",d=1,f=2,p=4,m=1,y=2,w=1,x=2,C=4,P=8,A=16,S=32,v=64,b=128,T=256,R=512,M=30,D="...",k=800,N=16,U=1,W=2,F=3,E=1/0,L=9007199254740991,j=17976931348623157e292,Y=NaN,O=4294967295,_=O-1,G=O>>>1,Q=[["ary",b],["bind",w],["bindKey",x],["curry",P],["curryRight",A],["flip",R],["partial",S],["partialRight",v],["rearg",T]],oe="[object Arguments]",ee="[object Array]",$="[object AsyncFunction]",ae="[object Boolean]",Z="[object Date]",ne="[object DOMException]",te="[object Error]",q="[object Function]",le="[object GeneratorFunction]",de="[object Map]",he="[object Number]",me="[object Null]",ce="[object Object]",Pe="[object Promise]",pe="[object Proxy]",Ie="[object RegExp]",ve="[object Set]",ze="[object String]",Ae="[object Symbol]",se="[object Undefined]",ge="[object WeakMap]",we="[object WeakSet]",Se="[object ArrayBuffer]",Me="[object DataView]",Ce="[object Float32Array]",Te="[object Float64Array]",Re="[object Int8Array]",Ne="[object Int16Array]",_e="[object Int32Array]",Ue="[object Uint8Array]",qe="[object Uint8ClampedArray]",Fe="[object Uint16Array]",He="[object Uint32Array]",Le=/\b__p \+= '';/g,Ye=/\b(__p \+=) '' \+/g,lt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Oe=/&(?:amp|lt|gt|quot|#39);/g,ut=/[&<>"']/g,ht=RegExp(Oe.source),Qe=RegExp(ut.source),nt=/<%-([\s\S]+?)%>/g,mt=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,gt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,je=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,bt=RegExp(et.source),St=/^\s+/,Pt=/\s/,Yt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zt=/\{\n\/\* \[wrapped with (.+)\] \*/,Rt=/,? & /,Ct=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,yt=/[()=,{}\[\]\/\s]/,at=/\\(\\)?/g,Et=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Lt=/\w*$/,Je=/^[-+]0x[0-9a-f]+$/i,st=/^0b[01]+$/i,It=/^\[object .+?Constructor\]$/,ot=/^0o[0-7]+$/i,it=/^(?:0|[1-9]\d*)$/,Be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,pt=/($^)/,ct=/['\n\r\u2028\u2029\\]/g,Xe="\\ud800-\\udfff",ft="\\u0300-\\u036f",wt="\\ufe20-\\ufe2f",kt="\\u20d0-\\u20ff",Zt=ft+wt+kt,Ot="\\u2700-\\u27bf",on="a-z\\xdf-\\xf6\\xf8-\\xff",qt="\\xac\\xb1\\xd7\\xf7",rn="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pn="\\u2000-\\u206f",fo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",to="A-Z\\xc0-\\xd6\\xd8-\\xde",Dt="\\ufe0e\\ufe0f",fn=qt+rn+Pn+fo,kn="['’]",yo="["+Xe+"]",ur="["+fn+"]",lr="["+Zt+"]",xo="\\d+",wo="["+Ot+"]",Rr="["+on+"]",Eo="[^"+Xe+fn+xo+Ot+on+to+"]",An="\\ud83c[\\udffb-\\udfff]",Dn="(?:"+lr+"|"+An+")",sr="[^"+Xe+"]",Vo="(?:\\ud83c[\\udde6-\\uddff]){2}",Wo="[\\ud800-\\udbff][\\udc00-\\udfff]",To="["+to+"]",Go="\\u200d",No="(?:"+Rr+"|"+Eo+")",ho="(?:"+To+"|"+Eo+")",vo="(?:"+kn+"(?:d|ll|m|re|s|t|ve))?",bo="(?:"+kn+"(?:D|LL|M|RE|S|T|VE))?",Bo=Dn+"?",Pr="["+Dt+"]?",so="(?:"+Go+"(?:"+[sr,Vo,Wo].join("|")+")"+Pr+Bo+")*",zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ci="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ea=Pr+Bo+so,rs="(?:"+[wo,Vo,Wo].join("|")+")"+ea,Da="(?:"+[sr+lr+"?",lr,Vo,Wo,yo].join("|")+")",or=RegExp(kn,"g"),cr=RegExp(lr,"g"),ii=RegExp(An+"(?="+An+")|"+Da+ea,"g"),Ga=RegExp([To+"?"+Rr+"+"+vo+"(?="+[ur,To,"$"].join("|")+")",ho+"+"+bo+"(?="+[ur,To+No,"$"].join("|")+")",To+"?"+No+"+"+vo,To+"+"+bo,Ci,zo,xo,rs].join("|"),"g"),xi=RegExp("["+Go+Xe+Zt+Dt+"]"),Uu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,_s=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],sc=-1,ta={};ta[Ce]=ta[Te]=ta[Re]=ta[Ne]=ta[_e]=ta[Ue]=ta[qe]=ta[Fe]=ta[He]=!0,ta[oe]=ta[ee]=ta[Se]=ta[ae]=ta[Me]=ta[Z]=ta[te]=ta[q]=ta[de]=ta[he]=ta[ce]=ta[Ie]=ta[ve]=ta[ze]=ta[ge]=!1;var Ea={};Ea[oe]=Ea[ee]=Ea[Se]=Ea[Me]=Ea[ae]=Ea[Z]=Ea[Ce]=Ea[Te]=Ea[Re]=Ea[Ne]=Ea[_e]=Ea[de]=Ea[he]=Ea[ce]=Ea[Ie]=Ea[ve]=Ea[ze]=Ea[Ae]=Ea[Ue]=Ea[qe]=Ea[Fe]=Ea[He]=!0,Ea[te]=Ea[q]=Ea[ge]=!1;var Cs={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},El={"&":"&","<":"<",">":">",'"':""","'":"'"},Vs={"&":"&","<":"<",">":">",""":'"',"'":"'"},Rs={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qp=parseFloat,gn=parseInt,tn=typeof Rc=="object"&&Rc&&Rc.Object===Object&&Rc,Gt=typeof self=="object"&&self&&self.Object===Object&&self,wn=tn||Gt||Function("return this")(),Cn=e&&!e.nodeType&&e,Wn=Cn&&!0&&t&&!t.nodeType&&t,Un=Wn&&Wn.exports===Cn,rt=Un&&tn.process,vt=function(){try{var vn=Wn&&Wn.require&&Wn.require("util").types;return vn||rt&&rt.binding&&rt.binding("util")}catch{}}(),Nt=vt&&vt.isArrayBuffer,Ft=vt&&vt.isDate,en=vt&&vt.isMap,sn=vt&&vt.isRegExp,dn=vt&&vt.isSet,En=vt&&vt.isTypedArray;function xn(vn,lo,Xn){switch(Xn.length){case 0:return vn.call(lo);case 1:return vn.call(lo,Xn[0]);case 2:return vn.call(lo,Xn[0],Xn[1]);case 3:return vn.call(lo,Xn[0],Xn[1],Xn[2])}return vn.apply(lo,Xn)}function Tn(vn,lo,Xn,Ir){for(var Ri=-1,Gi=vn==null?0:vn.length;++Ri-1}function Xr(vn,lo,Xn){for(var Ir=-1,Ri=vn==null?0:vn.length;++Ir-1;);return Xn}function iu(vn,lo){for(var Xn=vn.length;Xn--&&Wc(lo,vn[Xn],0)>-1;);return Xn}function dd(vn,lo){for(var Xn=vn.length,Ir=0;Xn--;)vn[Xn]===lo&&++Ir;return Ir}var t9=ou(Cs),n9=ou(El);function $7(vn){return"\\"+Rs[vn]}function I4(vn,lo){return vn==null?n:vn[lo]}function h2(vn){return xi.test(vn)}function p6(vn){return Uu.test(vn)}function o9(vn){for(var lo,Xn=[];!(lo=vn.next()).done;)Xn.push(lo.value);return Xn}function g6(vn){var lo=-1,Xn=Array(vn.size);return vn.forEach(function(Ir,Ri){Xn[++lo]=[Ri,Ir]}),Xn}function jf(vn,lo){return function(Xn){return vn(lo(Xn))}}function xu(vn,lo){for(var Xn=-1,Ir=vn.length,Ri=0,Gi=[];++Xn-1}function T6(X,re){var Ee=this.__data__,Ze=r1(Ee,X);return Ze<0?(++this.size,Ee.push([X,re])):Ee[Ze][1]=re,this}Zh.prototype.clear=vT,Zh.prototype.delete=F4,Zh.prototype.get=S6,Zh.prototype.has=ix,Zh.prototype.set=T6;function fd(X){var re=-1,Ee=X==null?0:X.length;for(this.clear();++re=re?X:re)),X}function hd(X,re,Ee,Ze,Mt,Xt){var hn,bn=re&d,Ln=re&f,Po=re&p;if(Ee&&(hn=Mt?Ee(X,Ze,Mt,Xt):Ee(X)),hn!==n)return hn;if(!Xa(X))return X;var Ro=Ki(X);if(Ro){if(hn=Qoe(X),!bn)return jc(X,hn)}else{var Yo=Ad(X),Hr=Yo==q||Yo==le;if(Xm(X))return yx(X,bn);if(Yo==ce||Yo==oe||Hr&&!Mt){if(hn=Ln||Hr?{}:Vj(X),!bn)return Ln?_4(X,ep(hn,X)):O4(X,R6(hn,X))}else{if(!Ea[Yo])return Mt?X:{};hn=Zoe(X,Yo,bn)}}Xt||(Xt=new Ns);var oi=Xt.get(X);if(oi)return oi;Xt.set(X,hn),tw(X)?X.forEach(function(Mi){hn.add(hd(Mi,re,Ee,Mi,X,Xt))}):_T(X)&&X.forEach(function(Mi,Ja){hn.set(Ja,hd(Mi,re,Ee,Ja,X,Xt))});var Hi=Po?Ln?ja:Bc:Ln?tf:Gu,Ia=Ro?n:Hi(X);return _n(Ia||X,function(Mi,Ja){Ia&&(Ja=Mi,Mi=X[Ja]),Of(hn,Ja,hd(Mi,re,Ee,Ja,X,Xt))}),hn}function j4(X){var re=Gu(X);return function(Ee){return A2(Ee,X,re)}}function A2(X,re,Ee){var Ze=Ee.length;if(X==null)return!Ze;for(X=vi(X);Ze--;){var Mt=Ee[Ze],Xt=re[Mt],hn=X[Mt];if(hn===n&&!(Mt in X)||!Xt(hn))return!1}return!0}function w2(X,re,Ee){if(typeof X!="function")throw new L0(a);return $4(function(){X.apply(n,Ee)},re)}function i1(X,re,Ee,Ze){var Mt=-1,Xt=qo,hn=!0,bn=X.length,Ln=[],Po=re.length;if(!bn)return Ln;Ee&&(re=qr(re,ru(Ee))),Ze?(Xt=Xr,hn=!1):re.length>=r&&(Xt=va,hn=!1,re=new cg(re));e:for(;++MtMt?0:Mt+Ee),Ze=Ze===n||Ze>Mt?Mt:ua(Ze),Ze<0&&(Ze+=Mt),Ze=Ee>Ze?0:YB(Ze);Ee0&&Ee(bn)?re>1?Nc(bn,re-1,Ee,Ze,Mt):na(Mt,bn):Ze||(Mt[Mt.length]=bn)}return Mt}var m9=V4(),op=V4(!0);function pd(X,re){return X&&m9(X,re,Gu)}function Tu(X,re){return X&&op(X,re,Gu)}function Xd(X,re){return go(re,function(Ee){return c1(X[Ee])})}function _f(X,re){re=ap(re,X);for(var Ee=0,Ze=re.length;X!=null&&Eere}function ux(X,re){return X!=null&&aa.call(X,re)}function Lm(X,re){return X!=null&&re in vi(X)}function TT(X,re,Ee){return X>=Su(re,Ee)&&X=120&&Ro.length>=120)?new cg(hn&&Ro):n}Ro=X[0];var Yo=-1,Hr=bn[0];e:for(;++Yo-1;)bn!==X&&Bf.call(bn,Ln,1),Bf.call(X,Ln,1);return X}function Ru(X,re){for(var Ee=X?re.length:0,Ze=Ee-1;Ee--;){var Mt=re[Ee];if(Ee==Ze||Mt!==Xt){var Xt=Mt;H2(Mt)?Bf.call(X,Mt,1):hx(X,Mt)}}return X}function yd(X,re){return X+x6(Yu()*(re-X+1))}function Kd(X,re,Ee,Ze){for(var Mt=-1,Xt=dc(y2((re-X)/(Ee||1)),0),hn=Xn(Xt);Xt--;)hn[Ze?Xt:++Mt]=X,X+=Ee;return hn}function Om(X,re){var Ee="";if(!X||re<1||re>L)return Ee;do re%2&&(Ee+=X),re=x6(re/2),re&&(X+=X);while(re);return Ee}function fi(X,re){return fz($j(X,re,nf),X+"")}function PT(X){return p9(ms(X))}function Y4(X,re){var Ee=ms(X);return MT(Ee,ug(re,0,Ee.length))}function dg(X,re,Ee,Ze){if(!Xa(X))return X;re=ap(re,X);for(var Mt=-1,Xt=re.length,hn=Xt-1,bn=X;bn!=null&&++MtMt?0:Mt+re),Ee=Ee>Mt?Mt:Ee,Ee<0&&(Ee+=Mt),Mt=re>Ee?0:Ee-re>>>0,re>>>=0;for(var Xt=Xn(Mt);++Ze>>1,hn=X[Xt];hn!==null&&!$f(hn)&&(Ee?hn<=re:hn=r){var Po=re?null:d0(X);if(Po)return r9(Po);hn=!1,Mt=va,Ln=new cg}else Ln=re?[]:bn;e:for(;++Ze=Ze?X:c0(X,re,Ee)}var k6=l9||function(X){return wn.clearTimeout(X)};function yx(X,re){if(re)return X.slice();var Ee=X.length,Ze=w6?w6(Ee):new X.constructor(Ee);return X.copy(Ze),Ze}function Kf(X){var re=new X.constructor(X.byteLength);return new kl(re).set(new kl(X)),re}function P2(X,re){var Ee=re?Kf(X.buffer):X.buffer;return new X.constructor(Ee,X.byteOffset,X.byteLength)}function u0(X){var re=new X.constructor(X.source,Lt.exec(X));return re.lastIndex=X.lastIndex,re}function b9(X){return lg?vi(lg.call(X)):{}}function CT(X,re){var Ee=re?Kf(X.buffer):X.buffer;return new X.constructor(Ee,X.byteOffset,X.length)}function lp(X,re){if(X!==re){var Ee=X!==n,Ze=X===null,Mt=X===X,Xt=$f(X),hn=re!==n,bn=re===null,Ln=re===re,Po=$f(re);if(!bn&&!Po&&!Xt&&X>re||Xt&&hn&&Ln&&!bn&&!Po||Ze&&hn&&Ln||!Ee&&Ln||!Mt)return 1;if(!Ze&&!Xt&&!Po&&X=bn)return Ln;var Po=Ee[Ze];return Ln*(Po=="desc"?-1:1)}}return X.index-re.index}function pg(X,re,Ee,Ze){for(var Mt=-1,Xt=X.length,hn=Ee.length,bn=-1,Ln=re.length,Po=dc(Xt-hn,0),Ro=Xn(Ln+Po),Yo=!Ze;++bn1?Ee[Mt-1]:n,hn=Mt>2?Ee[2]:n;for(Xt=X.length>3&&typeof Xt=="function"?(Mt--,Xt):n,hn&&Zd(Ee[0],Ee[1],hn)&&(Xt=Mt<3?n:Xt,Mt=1),re=vi(re);++Ze-1?Mt[Xt?re[hn]:hn]:n}}function $e(X){return la(function(re){var Ee=re.length,Ze=Ee,Mt=Ou.prototype.thru;for(X&&re.reverse();Ze--;){var Xt=re[Ze];if(typeof Xt!="function")throw new L0(a);if(Mt&&!hn&&X4(Xt)=="wrapper")var hn=new Ou([],!0)}for(Ze=hn?Ze:Ee;++Ze1&&dl.reverse(),Ro&&Lnbn))return!1;var Po=Xt.get(X),Ro=Xt.get(re);if(Po&&Ro)return Po==re&&Ro==X;var Yo=-1,Hr=!0,oi=Ee&y?new cg:n;for(Xt.set(X,re),Xt.set(re,X);++Yo1?"& ":"")+re[Ze],re=re.join(Ee>2?", ":" "),X.replace(Yt,`{ /* [wrapped with `+re+`] */ -`)}function tre(X){return Ki(X)||I2(X)||!!(m2&&X&&X[m2])}function H2(X,re){var Ee=typeof X;return re=re??L,!!re&&(Ee=="number"||Ee!="symbol"&&it.test(X))&&X>-1&&X%1==0&&X0){if(++re>=k)return arguments[0]}else re=0;return X.apply(n,arguments)}}function MT(X,re){var Ee=-1,Ze=X.length,Mt=Ze-1;for(re=re===n?Ze:re;++Ee1?X[re-1]:n;return Ee=typeof Ee=="function"?(X.pop(),Ee):n,N6(X,Ee)});function wB(X){var re=Bt(X);return re.__chain__=!0,re}function Hz(X,re){return re(X),X}function ET(X,re){return re(X)}var Mz=la(function(X){var re=X.length,Ee=re?X[0]:0,Ze=this.__wrapped__,Mt=function(Xt){return H6(Xt,X)};return re>1||this.__actions__.length||!(Ze instanceof gi)||!H2(Ee)?this.thru(Mt):(Ze=Ze.slice(Ee,+Ee+(re?1:0)),Ze.__actions__.push({func:ET,args:[Mt],thisArg:n}),new Ou(Ze,this.__chain__).thru(function(Xt){return re&&!Xt.length&&Xt.push(n),Xt}))});function Rre(){return wB(this)}function Hre(){return new Ou(this.value(),this.__chain__)}function Mre(){this.__values__===n&&(this.__values__=XT(this.value()));var X=this.__index__>=this.__values__.length,re=X?n:this.__values__[this.__index__++];return{done:X,value:re}}function kT(){return this}function FT(X){for(var re,Ee=this;Ee instanceof f9;){var Ze=tB(Ee);Ze.__index__=0,Ze.__values__=n,re?Mt.__wrapped__=Ze:re=Ze;var Mt=Ze;Ee=Ee.__wrapped__}return Mt.__wrapped__=X,re}function xB(){var X=this.__wrapped__;if(X instanceof gi){var re=X;return this.__actions__.length&&(re=new gi(this)),re=re.reverse(),re.__actions__.push({func:ET,args:[W6],thisArg:n}),new Ou(re,this.__chain__)}return this.thru(W6)}function Ire(){return Vm(this.__wrapped__,this.__actions__)}var vB=L6(function(X,re,Ee){aa.call(X,Ee)?++X[Ee]:tp(X,Ee,1)});function Iz(X,re,Ee){var Ze=Ki(X)?Gn:v2;return Ee&&Zd(X,re,Ee)&&(re=n),Ze(X,mi(re,3))}function bB(X,re){var Ee=Ki(X)?go:np;return Ee(X,mi(re,3))}var zz=ke(gz),Dz=ke(mz);function SB(X,re){return Nc(Px(X,re),1)}function TB(X,re){return Nc(Px(X,re),E)}function zre(X,re,Ee){return Ee=Ee===n?1:ua(Ee),Nc(Px(X,re),Ee)}function Ez(X,re){var Ee=Ki(X)?_n:s0;return Ee(X,mi(re,3))}function Tx(X,re){var Ee=Ki(X)?Vn:x2;return Ee(X,mi(re,3))}var Dre=L6(function(X,re,Ee){aa.call(X,Ee)?X[Ee].push(re):tp(X,Ee,[re])});function Ere(X,re,Ee,Ze){X=wd(X)?X:ms(X),Ee=Ee&&!Ze?ua(Ee):0;var Mt=X.length;return Ee<0&&(Ee=dc(Mt+Ee,0)),Hx(X)?Ee<=Mt&&X.indexOf(re,Ee)>-1:!!Mt&&Wc(X,re,Ee)>-1}var kre=fi(function(X,re,Ee){var Ze=-1,Mt=typeof re=="function",Xt=wd(X)?Xn(X.length):[];return s0(X,function(hn){Xt[++Ze]=Mt?xn(re,hn,Ee):Ma(hn,re,Ee)}),Xt}),PB=L6(function(X,re,Ee){tp(X,Ee,re)});function Px(X,re){var Ee=Ki(X)?qr:ip;return Ee(X,mi(re,3))}function kz(X,re,Ee,Ze){return X==null?[]:(Ki(re)||(re=re==null?[]:[re]),Ee=Ze?n:Ee,Ki(Ee)||(Ee=Ee==null?[]:[Ee]),w9(X,re,Ee))}var Fre=L6(function(X,re,Ee){X[Ee?0:1].push(re)},function(){return[[],[]]});function Lre(X,re,Ee){var Ze=Ki(X)?k0:Zp,Mt=arguments.length<3;return Ze(X,mi(re,4),Ee,Mt,s0)}function Fz(X,re,Ee){var Ze=Ki(X)?Gh:Zp,Mt=arguments.length<3;return Ze(X,mi(re,4),Ee,Mt,x2)}function Wre(X,re){var Ee=Ki(X)?go:np;return Ee(X,B6(mi(re,3)))}function Lz(X){var re=Ki(X)?p9:PT;return re(X)}function Nre(X,re,Ee){(Ee?Zd(X,re,Ee):re===n)?re=1:re=ua(re);var Ze=Ki(X)?g9:Y4;return Ze(X,re)}function LT(X){var re=Ki(X)?N4:$d;return re(X)}function CB(X){if(X==null)return 0;if(wd(X))return Hx(X)?Kh(X):X.length;var re=Ad(X);return re==de||re==ve?X.size:Cu(X).length}function RB(X,re,Ee){var Ze=Ki(X)?cc:v9;return Ee&&Zd(X,re,Ee)&&(re=n),Ze(X,mi(re,3))}var HB=fi(function(X,re){if(X==null)return[];var Ee=re.length;return Ee>1&&Zd(X,re[0],re[1])?re=[]:Ee>2&&Zd(re[0],re[1],re[2])&&(re=[re[0]]),w9(X,Nc(re,1),[])}),j6=Q7||function(){return wn.Date.now()};function Wz(X,re){if(typeof re!="function")throw new L0(a);return X=ua(X),function(){if(--X<1)return re.apply(this,arguments)}}function MB(X,re,Ee){return re=Ee?n:re,re=X&&re==null?X.length:re,Yn(X,b,n,n,n,n,re)}function IB(X,re){var Ee;if(typeof re!="function")throw new L0(a);return X=ua(X),function(){return--X>0&&(Ee=re.apply(this,arguments)),X<=1&&(re=n),Ee}}var WT=fi(function(X,re,Ee){var Ze=w;if(Ee.length){var Mt=xu(Ee,J4(WT));Ze|=S}return Yn(X,Ze,re,Ee,Mt)}),NT=fi(function(X,re,Ee){var Ze=w|x;if(Ee.length){var Mt=xu(Ee,J4(NT));Ze|=S}return Yn(re,Ze,X,Ee,Mt)});function Nz(X,re,Ee){re=Ee?n:re;var Ze=Yn(X,P,n,n,n,n,n,re);return Ze.placeholder=Nz.placeholder,Ze}function Uz(X,re,Ee){re=Ee?n:re;var Ze=Yn(X,A,n,n,n,n,n,re);return Ze.placeholder=Uz.placeholder,Ze}function UT(X,re,Ee){var Ze,Mt,Xt,hn,bn,Ln,Po=0,Ro=!1,Yo=!1,Hr=!0;if(typeof X!="function")throw new L0(a);re=ef(re)||0,Xa(Ee)&&(Ro=!!Ee.leading,Yo="maxWait"in Ee,Xt=Yo?dc(ef(Ee.maxWait)||0,re):Xt,Hr="trailing"in Ee?!!Ee.trailing:Hr);function oi(Xu){var D2=Ze,V6=Mt;return Ze=Mt=n,Po=Xu,hn=X.apply(V6,D2),hn}function Hi(Xu){return Po=Xu,bn=$4(Ja,re),Ro?oi(Xu):hn}function Ia(Xu){var D2=Xu-Ln,V6=Xu-Po,D8e=re-D2;return Yo?Su(D8e,Xt-V6):D8e}function Mi(Xu){var D2=Xu-Ln,V6=Xu-Po;return Ln===n||D2>=re||D2<0||Yo&&V6>=Xt}function Ja(){var Xu=j6();if(Mi(Xu))return dl(Xu);bn=$4(Ja,Ia(Xu))}function dl(Xu){return bn=n,Hr&&Ze?oi(Xu):(Ze=Mt=n,hn)}function Ag(){bn!==n&&k6(bn),Po=0,Ze=Ln=Mt=bn=n}function up(){return bn===n?hn:dl(j6())}function wg(){var Xu=j6(),D2=Mi(Xu);if(Ze=arguments,Mt=this,Ln=Xu,D2){if(bn===n)return Hi(Ln);if(Yo)return k6(bn),bn=$4(Ja,re),oi(Ln)}return bn===n&&(bn=$4(Ja,re)),hn}return wg.cancel=Ag,wg.flush=up,wg}var zB=fi(function(X,re){return w2(X,1,re)}),jz=fi(function(X,re,Ee){return w2(X,ef(re)||0,Ee)});function jT(X){return Yn(X,R)}function Cx(X,re){if(typeof X!="function"||re!=null&&typeof re!="function")throw new L0(a);var Ee=function(){var Ze=arguments,Mt=re?re.apply(this,Ze):Ze[0],Xt=Ee.cache;if(Xt.has(Mt))return Xt.get(Mt);var hn=X.apply(this,Ze);return Ee.cache=Xt.set(Mt,hn)||Xt,hn};return Ee.cache=new(Cx.Cache||fd),Ee}Cx.Cache=fd;function B6(X){if(typeof X!="function")throw new L0(a);return function(){var re=arguments;switch(re.length){case 0:return!X.call(this);case 1:return!X.call(this,re[0]);case 2:return!X.call(this,re[0],re[1]);case 3:return!X.call(this,re[0],re[1],re[2])}return!X.apply(this,re)}}function Ure(X){return IB(2,X)}var jre=mx(function(X,re){re=re.length==1&&Ki(re[0])?qr(re[0],ru(mi())):qr(Nc(re,1),ru(mi()));var Ee=re.length;return fi(function(Ze){for(var Mt=-1,Xt=Su(Ze.length,Ee);++Mt=re}),I2=oa(function(){return arguments}())?oa:function(X){return Js(X)&&aa.call(X,"callee")&&!eg.call(X,"callee")},Ki=Xn.isArray,ew=Nt?ru(Nt):Gs;function wd(X){return X!=null&&OT(X.length)&&!c1(X)}function au(X){return Js(X)&&wd(X)}function YT(X){return X===!0||X===!1||Js(X)&&Pu(X)==ae}var Xm=Z7||yg,Gre=Ft?ru(Ft):ql;function Vz(X){return Js(X)&&X.nodeType===1&&!Y6(X)}function Gz(X){if(X==null)return!0;if(wd(X)&&(Ki(X)||typeof X=="string"||typeof X.splice=="function"||Xm(X)||P9(X)||I2(X)))return!X.length;var re=Ad(X);if(re==de||re==ve)return!X.size;if(wx(X))return!Cu(X).length;for(var Ee in X)if(aa.call(X,Ee))return!1;return!0}function WB(X,re){return fc(X,re)}function NB(X,re,Ee){Ee=typeof Ee=="function"?Ee:n;var Ze=Ee?Ee(X,re):n;return Ze===n?fc(X,re,n,Ee):!!Ze}function Xz(X){if(!Js(X))return!1;var re=Pu(X);return re==te||re==ne||typeof X.message=="string"&&typeof X.name=="string"&&!Y6(X)}function Xre(X){return typeof X=="number"&&ex(X)}function c1(X){if(!Xa(X))return!1;var re=Pu(X);return re==$||re==le||re==q||re==pe}function UB(X){return typeof X=="number"&&X==ua(X)}function OT(X){return typeof X=="number"&&X>-1&&X%1==0&&X<=L}function Xa(X){var re=typeof X;return X!=null&&(re=="object"||re=="function")}function Js(X){return X!=null&&typeof X=="object"}var _T=en?ru(en):gd;function Jz(X,re){return X===re||Xs(X,re,RT(re))}function Rx(X,re,Ee){return Ee=typeof Ee=="function"?Ee:n,Xs(X,re,RT(re),Ee)}function Kz(X){return VT(X)&&X!=+X}function $z(X){if(rre(X))throw new Ri(i);return Wm(X)}function Jre(X){return X===null}function jB(X){return X==null}function VT(X){return typeof X=="number"||Js(X)&&Pu(X)==he}function Y6(X){if(!Js(X)||Pu(X)!=ce)return!1;var re=qh(X);if(re===null)return!0;var Ee=aa.call(re,"constructor")&&re.constructor;return typeof Ee=="function"&&Ee instanceof Ee&&l0.call(Ee)==Em}var qz=sn?ru(sn):Nm;function O6(X){return UB(X)&&X>=-9007199254740991&&X<=L}var tw=dn?ru(dn):md;function Hx(X){return typeof X=="string"||!Ki(X)&&Js(X)&&Pu(X)==ze}function $f(X){return typeof X=="symbol"||Js(X)&&Pu(X)==Ae}var P9=En?ru(En):B4;function Qz(X){return X===n}function Zz(X){return Js(X)&&Ad(X)==ge}function BB(X){return Js(X)&&Pu(X)==we}var C9=ni(S2),GT=ni(function(X,re){return X<=re});function XT(X){if(!X)return[];if(wd(X))return Hx(X)?$l(X):jc(X);if(tg&&X[tg])return o9(X[tg]());var re=Ad(X),Ee=re==de?g6:re==ve?r9:ms;return Ee(X)}function f0(X){if(!X)return X===0?X:0;if(X=ef(X),X===E||X===-1/0){var re=X<0?-1:1;return re*j}return X===X?X:0}function ua(X){var re=f0(X),Ee=re%1;return re===re?Ee?re-Ee:re:0}function YB(X){return X?ug(ua(X),0,O):0}function ef(X){if(typeof X=="number")return X;if($f(X))return Y;if(Xa(X)){var re=typeof X.valueOf=="function"?X.valueOf():X;X=Xa(re)?re+"":re}if(typeof X!="string")return X===0?X:+X;X=Im(X);var Ee=st.test(X);return Ee||ot.test(X)?gn(X.slice(2),Ee?2:8):Je.test(X)?Y:+X}function nw(X){return qd(X,tf(X))}function OB(X){return X?ug(ua(X),-9007199254740991,L):X===0?X:0}function bl(X){return X==null?"":Uc(X)}var _B=C2(function(X,re){if(wx(re)||wd(re)){qd(re,Gu(re),X);return}for(var Ee in re)aa.call(re,Ee)&&Of(X,Ee,re[Ee])}),eD=C2(function(X,re){qd(re,tf(re),X)}),Yc=C2(function(X,re,Ee,Ze){qd(re,tf(re),X,Ze)}),Kre=C2(function(X,re,Ee,Ze){qd(re,Gu(re),X,Ze)}),VB=la(H6);function $re(X,re){var Ee=sg(X);return re==null?Ee:R6(Ee,re)}var qre=fi(function(X,re){X=vi(X);var Ee=-1,Ze=re.length,Mt=Ze>2?re[2]:n;for(Mt&&Zd(re[0],re[1],Mt)&&(Ze=1);++Ee1),Xt}),qd(X,ja(X),Ee),Ze&&(Ee=hd(Ee,d|f|p,Cr));for(var Mt=re.length;Mt--;)hx(Ee,re[Mt]);return Ee});function $B(X,re){return _6(X,B6(mi(re)))}var rie=la(function(X,re){return X==null?{}:Bm(X,re)});function _6(X,re){if(X==null)return{};var Ee=qr(ja(X),function(Ze){return[Ze]});return re=mi(re),M6(X,Ee,function(Ze,Mt){return re(Ze,Mt[0])})}function iie(X,re,Ee){re=ap(re,X);var Ze=-1,Mt=re.length;for(Mt||(Mt=1,X=n);++Zere){var Ze=X;X=re,re=Ze}if(Ee||X%1||re%1){var Mt=Yu();return Su(X+Mt*(re-X+qp("1e-"+((Mt+"").length-1))),re)}return yd(X,re)}var qB=J(function(X,re,Ee){return re=re.toLowerCase(),X+(Ee?zx(re):re)});function zx(X){return yD(bl(X).toLowerCase())}function qT(X){return X=bl(X),X&&X.replace(Be,t9).replace(cr,"")}function sD(X,re,Ee){X=bl(X),re=Uc(re);var Ze=X.length;Ee=Ee===n?Ze:ug(ua(Ee),0,Ze);var Mt=Ee;return Ee-=re.length,Ee>=0&&X.slice(Ee,Mt)==re}function cD(X){return X=bl(X),X&&Qe.test(X)?X.replace(ut,n9):X}function uD(X){return X=bl(X),X&&bt.test(X)?X.replace(et,"\\$&"):X}var dD=J(function(X,re,Ee){return X+(Ee?"-":"")+re.toLowerCase()}),cie=J(function(X,re,Ee){return X+(Ee?" ":"")+re.toLowerCase()}),uie=G4("toLowerCase");function fD(X,re,Ee){X=bl(X),re=ua(re);var Ze=re?Kh(X):0;if(!re||Ze>=re)return X;var Mt=(re-Ze)/2;return Xo(x6(Mt),Ee)+X+Xo(y2(Mt),Ee)}function hD(X,re,Ee){X=bl(X),re=ua(re);var Ze=re?Kh(X):0;return re&&Ze>>0,Ee?(X=bl(X),X&&(typeof re=="string"||re!=null&&!qz(re))&&(re=Uc(re),!re&&h2(X))?Jf($l(X),0,Ee):X.split(re,Ee)):[]}var pD=J(function(X,re,Ee){return X+(Ee?" ":"")+yD(re)});function QT(X,re,Ee){return X=bl(X),Ee=Ee==null?0:ug(ua(Ee),0,X.length),re=Uc(re),X.slice(Ee,Ee+re.length)==re}function gD(X,re,Ee){var Ze=Bt.templateSettings;Ee&&Zd(X,re,Ee)&&(re=n),X=bl(X),re=Yc({},re,Ze,zn);var Mt=Yc({},re.imports,Ze.imports,zn),Xt=Gu(Mt),hn=Bu(Mt,Xt),bn,Ln,Po=0,Ro=re.interpolate||pt,Yo="__p += '",Hr=vu((re.escape||pt).source+"|"+Ro.source+"|"+(Ro===tt?Et:pt).source+"|"+(re.evaluate||pt).source+"|$","g"),oi="//# sourceURL="+(aa.call(re,"sourceURL")?(re.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++sc+"]")+` +`)}function tre(X){return Ki(X)||I2(X)||!!(m2&&X&&X[m2])}function H2(X,re){var Ee=typeof X;return re=re??L,!!re&&(Ee=="number"||Ee!="symbol"&&it.test(X))&&X>-1&&X%1==0&&X0){if(++re>=k)return arguments[0]}else re=0;return X.apply(n,arguments)}}function MT(X,re){var Ee=-1,Ze=X.length,Mt=Ze-1;for(re=re===n?Ze:re;++Ee1?X[re-1]:n;return Ee=typeof Ee=="function"?(X.pop(),Ee):n,N6(X,Ee)});function wB(X){var re=Bt(X);return re.__chain__=!0,re}function Hz(X,re){return re(X),X}function ET(X,re){return re(X)}var Mz=la(function(X){var re=X.length,Ee=re?X[0]:0,Ze=this.__wrapped__,Mt=function(Xt){return H6(Xt,X)};return re>1||this.__actions__.length||!(Ze instanceof gi)||!H2(Ee)?this.thru(Mt):(Ze=Ze.slice(Ee,+Ee+(re?1:0)),Ze.__actions__.push({func:ET,args:[Mt],thisArg:n}),new Ou(Ze,this.__chain__).thru(function(Xt){return re&&!Xt.length&&Xt.push(n),Xt}))});function Rre(){return wB(this)}function Hre(){return new Ou(this.value(),this.__chain__)}function Mre(){this.__values__===n&&(this.__values__=XT(this.value()));var X=this.__index__>=this.__values__.length,re=X?n:this.__values__[this.__index__++];return{done:X,value:re}}function kT(){return this}function FT(X){for(var re,Ee=this;Ee instanceof f9;){var Ze=tB(Ee);Ze.__index__=0,Ze.__values__=n,re?Mt.__wrapped__=Ze:re=Ze;var Mt=Ze;Ee=Ee.__wrapped__}return Mt.__wrapped__=X,re}function xB(){var X=this.__wrapped__;if(X instanceof gi){var re=X;return this.__actions__.length&&(re=new gi(this)),re=re.reverse(),re.__actions__.push({func:ET,args:[W6],thisArg:n}),new Ou(re,this.__chain__)}return this.thru(W6)}function Ire(){return Vm(this.__wrapped__,this.__actions__)}var vB=L6(function(X,re,Ee){aa.call(X,Ee)?++X[Ee]:tp(X,Ee,1)});function Iz(X,re,Ee){var Ze=Ki(X)?Gn:v2;return Ee&&Zd(X,re,Ee)&&(re=n),Ze(X,mi(re,3))}function bB(X,re){var Ee=Ki(X)?go:np;return Ee(X,mi(re,3))}var zz=ke(gz),Dz=ke(mz);function SB(X,re){return Nc(Px(X,re),1)}function TB(X,re){return Nc(Px(X,re),E)}function zre(X,re,Ee){return Ee=Ee===n?1:ua(Ee),Nc(Px(X,re),Ee)}function Ez(X,re){var Ee=Ki(X)?_n:s0;return Ee(X,mi(re,3))}function Tx(X,re){var Ee=Ki(X)?Vn:x2;return Ee(X,mi(re,3))}var Dre=L6(function(X,re,Ee){aa.call(X,Ee)?X[Ee].push(re):tp(X,Ee,[re])});function Ere(X,re,Ee,Ze){X=wd(X)?X:ms(X),Ee=Ee&&!Ze?ua(Ee):0;var Mt=X.length;return Ee<0&&(Ee=dc(Mt+Ee,0)),Hx(X)?Ee<=Mt&&X.indexOf(re,Ee)>-1:!!Mt&&Wc(X,re,Ee)>-1}var kre=fi(function(X,re,Ee){var Ze=-1,Mt=typeof re=="function",Xt=wd(X)?Xn(X.length):[];return s0(X,function(hn){Xt[++Ze]=Mt?xn(re,hn,Ee):Ma(hn,re,Ee)}),Xt}),PB=L6(function(X,re,Ee){tp(X,Ee,re)});function Px(X,re){var Ee=Ki(X)?qr:ip;return Ee(X,mi(re,3))}function kz(X,re,Ee,Ze){return X==null?[]:(Ki(re)||(re=re==null?[]:[re]),Ee=Ze?n:Ee,Ki(Ee)||(Ee=Ee==null?[]:[Ee]),w9(X,re,Ee))}var Fre=L6(function(X,re,Ee){X[Ee?0:1].push(re)},function(){return[[],[]]});function Lre(X,re,Ee){var Ze=Ki(X)?k0:Zp,Mt=arguments.length<3;return Ze(X,mi(re,4),Ee,Mt,s0)}function Fz(X,re,Ee){var Ze=Ki(X)?Gh:Zp,Mt=arguments.length<3;return Ze(X,mi(re,4),Ee,Mt,x2)}function Wre(X,re){var Ee=Ki(X)?go:np;return Ee(X,B6(mi(re,3)))}function Lz(X){var re=Ki(X)?p9:PT;return re(X)}function Nre(X,re,Ee){(Ee?Zd(X,re,Ee):re===n)?re=1:re=ua(re);var Ze=Ki(X)?g9:Y4;return Ze(X,re)}function LT(X){var re=Ki(X)?N4:$d;return re(X)}function CB(X){if(X==null)return 0;if(wd(X))return Hx(X)?Kh(X):X.length;var re=Ad(X);return re==de||re==ve?X.size:Cu(X).length}function RB(X,re,Ee){var Ze=Ki(X)?cc:v9;return Ee&&Zd(X,re,Ee)&&(re=n),Ze(X,mi(re,3))}var HB=fi(function(X,re){if(X==null)return[];var Ee=re.length;return Ee>1&&Zd(X,re[0],re[1])?re=[]:Ee>2&&Zd(re[0],re[1],re[2])&&(re=[re[0]]),w9(X,Nc(re,1),[])}),j6=Q7||function(){return wn.Date.now()};function Wz(X,re){if(typeof re!="function")throw new L0(a);return X=ua(X),function(){if(--X<1)return re.apply(this,arguments)}}function MB(X,re,Ee){return re=Ee?n:re,re=X&&re==null?X.length:re,Yn(X,b,n,n,n,n,re)}function IB(X,re){var Ee;if(typeof re!="function")throw new L0(a);return X=ua(X),function(){return--X>0&&(Ee=re.apply(this,arguments)),X<=1&&(re=n),Ee}}var WT=fi(function(X,re,Ee){var Ze=w;if(Ee.length){var Mt=xu(Ee,J4(WT));Ze|=S}return Yn(X,Ze,re,Ee,Mt)}),NT=fi(function(X,re,Ee){var Ze=w|x;if(Ee.length){var Mt=xu(Ee,J4(NT));Ze|=S}return Yn(re,Ze,X,Ee,Mt)});function Nz(X,re,Ee){re=Ee?n:re;var Ze=Yn(X,P,n,n,n,n,n,re);return Ze.placeholder=Nz.placeholder,Ze}function Uz(X,re,Ee){re=Ee?n:re;var Ze=Yn(X,A,n,n,n,n,n,re);return Ze.placeholder=Uz.placeholder,Ze}function UT(X,re,Ee){var Ze,Mt,Xt,hn,bn,Ln,Po=0,Ro=!1,Yo=!1,Hr=!0;if(typeof X!="function")throw new L0(a);re=ef(re)||0,Xa(Ee)&&(Ro=!!Ee.leading,Yo="maxWait"in Ee,Xt=Yo?dc(ef(Ee.maxWait)||0,re):Xt,Hr="trailing"in Ee?!!Ee.trailing:Hr);function oi(Xu){var D2=Ze,V6=Mt;return Ze=Mt=n,Po=Xu,hn=X.apply(V6,D2),hn}function Hi(Xu){return Po=Xu,bn=$4(Ja,re),Ro?oi(Xu):hn}function Ia(Xu){var D2=Xu-Ln,V6=Xu-Po,D8e=re-D2;return Yo?Su(D8e,Xt-V6):D8e}function Mi(Xu){var D2=Xu-Ln,V6=Xu-Po;return Ln===n||D2>=re||D2<0||Yo&&V6>=Xt}function Ja(){var Xu=j6();if(Mi(Xu))return dl(Xu);bn=$4(Ja,Ia(Xu))}function dl(Xu){return bn=n,Hr&&Ze?oi(Xu):(Ze=Mt=n,hn)}function Ag(){bn!==n&&k6(bn),Po=0,Ze=Ln=Mt=bn=n}function up(){return bn===n?hn:dl(j6())}function wg(){var Xu=j6(),D2=Mi(Xu);if(Ze=arguments,Mt=this,Ln=Xu,D2){if(bn===n)return Hi(Ln);if(Yo)return k6(bn),bn=$4(Ja,re),oi(Ln)}return bn===n&&(bn=$4(Ja,re)),hn}return wg.cancel=Ag,wg.flush=up,wg}var zB=fi(function(X,re){return w2(X,1,re)}),jz=fi(function(X,re,Ee){return w2(X,ef(re)||0,Ee)});function jT(X){return Yn(X,R)}function Cx(X,re){if(typeof X!="function"||re!=null&&typeof re!="function")throw new L0(a);var Ee=function(){var Ze=arguments,Mt=re?re.apply(this,Ze):Ze[0],Xt=Ee.cache;if(Xt.has(Mt))return Xt.get(Mt);var hn=X.apply(this,Ze);return Ee.cache=Xt.set(Mt,hn)||Xt,hn};return Ee.cache=new(Cx.Cache||fd),Ee}Cx.Cache=fd;function B6(X){if(typeof X!="function")throw new L0(a);return function(){var re=arguments;switch(re.length){case 0:return!X.call(this);case 1:return!X.call(this,re[0]);case 2:return!X.call(this,re[0],re[1]);case 3:return!X.call(this,re[0],re[1],re[2])}return!X.apply(this,re)}}function Ure(X){return IB(2,X)}var jre=mx(function(X,re){re=re.length==1&&Ki(re[0])?qr(re[0],ru(mi())):qr(Nc(re,1),ru(mi()));var Ee=re.length;return fi(function(Ze){for(var Mt=-1,Xt=Su(Ze.length,Ee);++Mt=re}),I2=oa(function(){return arguments}())?oa:function(X){return Js(X)&&aa.call(X,"callee")&&!eg.call(X,"callee")},Ki=Xn.isArray,ew=Nt?ru(Nt):Gs;function wd(X){return X!=null&&OT(X.length)&&!c1(X)}function au(X){return Js(X)&&wd(X)}function YT(X){return X===!0||X===!1||Js(X)&&Pu(X)==ae}var Xm=Z7||yg,Gre=Ft?ru(Ft):ql;function Vz(X){return Js(X)&&X.nodeType===1&&!Y6(X)}function Gz(X){if(X==null)return!0;if(wd(X)&&(Ki(X)||typeof X=="string"||typeof X.splice=="function"||Xm(X)||P9(X)||I2(X)))return!X.length;var re=Ad(X);if(re==de||re==ve)return!X.size;if(wx(X))return!Cu(X).length;for(var Ee in X)if(aa.call(X,Ee))return!1;return!0}function WB(X,re){return fc(X,re)}function NB(X,re,Ee){Ee=typeof Ee=="function"?Ee:n;var Ze=Ee?Ee(X,re):n;return Ze===n?fc(X,re,n,Ee):!!Ze}function Xz(X){if(!Js(X))return!1;var re=Pu(X);return re==te||re==ne||typeof X.message=="string"&&typeof X.name=="string"&&!Y6(X)}function Xre(X){return typeof X=="number"&&ex(X)}function c1(X){if(!Xa(X))return!1;var re=Pu(X);return re==q||re==le||re==$||re==pe}function UB(X){return typeof X=="number"&&X==ua(X)}function OT(X){return typeof X=="number"&&X>-1&&X%1==0&&X<=L}function Xa(X){var re=typeof X;return X!=null&&(re=="object"||re=="function")}function Js(X){return X!=null&&typeof X=="object"}var _T=en?ru(en):gd;function Jz(X,re){return X===re||Xs(X,re,RT(re))}function Rx(X,re,Ee){return Ee=typeof Ee=="function"?Ee:n,Xs(X,re,RT(re),Ee)}function Kz(X){return VT(X)&&X!=+X}function $z(X){if(rre(X))throw new Ri(i);return Wm(X)}function Jre(X){return X===null}function jB(X){return X==null}function VT(X){return typeof X=="number"||Js(X)&&Pu(X)==he}function Y6(X){if(!Js(X)||Pu(X)!=ce)return!1;var re=qh(X);if(re===null)return!0;var Ee=aa.call(re,"constructor")&&re.constructor;return typeof Ee=="function"&&Ee instanceof Ee&&l0.call(Ee)==Em}var qz=sn?ru(sn):Nm;function O6(X){return UB(X)&&X>=-9007199254740991&&X<=L}var tw=dn?ru(dn):md;function Hx(X){return typeof X=="string"||!Ki(X)&&Js(X)&&Pu(X)==ze}function $f(X){return typeof X=="symbol"||Js(X)&&Pu(X)==Ae}var P9=En?ru(En):B4;function Qz(X){return X===n}function Zz(X){return Js(X)&&Ad(X)==ge}function BB(X){return Js(X)&&Pu(X)==we}var C9=ni(S2),GT=ni(function(X,re){return X<=re});function XT(X){if(!X)return[];if(wd(X))return Hx(X)?$l(X):jc(X);if(tg&&X[tg])return o9(X[tg]());var re=Ad(X),Ee=re==de?g6:re==ve?r9:ms;return Ee(X)}function f0(X){if(!X)return X===0?X:0;if(X=ef(X),X===E||X===-1/0){var re=X<0?-1:1;return re*j}return X===X?X:0}function ua(X){var re=f0(X),Ee=re%1;return re===re?Ee?re-Ee:re:0}function YB(X){return X?ug(ua(X),0,O):0}function ef(X){if(typeof X=="number")return X;if($f(X))return Y;if(Xa(X)){var re=typeof X.valueOf=="function"?X.valueOf():X;X=Xa(re)?re+"":re}if(typeof X!="string")return X===0?X:+X;X=Im(X);var Ee=st.test(X);return Ee||ot.test(X)?gn(X.slice(2),Ee?2:8):Je.test(X)?Y:+X}function nw(X){return qd(X,tf(X))}function OB(X){return X?ug(ua(X),-9007199254740991,L):X===0?X:0}function bl(X){return X==null?"":Uc(X)}var _B=C2(function(X,re){if(wx(re)||wd(re)){qd(re,Gu(re),X);return}for(var Ee in re)aa.call(re,Ee)&&Of(X,Ee,re[Ee])}),eD=C2(function(X,re){qd(re,tf(re),X)}),Yc=C2(function(X,re,Ee,Ze){qd(re,tf(re),X,Ze)}),Kre=C2(function(X,re,Ee,Ze){qd(re,Gu(re),X,Ze)}),VB=la(H6);function $re(X,re){var Ee=sg(X);return re==null?Ee:R6(Ee,re)}var qre=fi(function(X,re){X=vi(X);var Ee=-1,Ze=re.length,Mt=Ze>2?re[2]:n;for(Mt&&Zd(re[0],re[1],Mt)&&(Ze=1);++Ee1),Xt}),qd(X,ja(X),Ee),Ze&&(Ee=hd(Ee,d|f|p,Cr));for(var Mt=re.length;Mt--;)hx(Ee,re[Mt]);return Ee});function $B(X,re){return _6(X,B6(mi(re)))}var rie=la(function(X,re){return X==null?{}:Bm(X,re)});function _6(X,re){if(X==null)return{};var Ee=qr(ja(X),function(Ze){return[Ze]});return re=mi(re),M6(X,Ee,function(Ze,Mt){return re(Ze,Mt[0])})}function iie(X,re,Ee){re=ap(re,X);var Ze=-1,Mt=re.length;for(Mt||(Mt=1,X=n);++Zere){var Ze=X;X=re,re=Ze}if(Ee||X%1||re%1){var Mt=Yu();return Su(X+Mt*(re-X+qp("1e-"+((Mt+"").length-1))),re)}return yd(X,re)}var qB=J(function(X,re,Ee){return re=re.toLowerCase(),X+(Ee?zx(re):re)});function zx(X){return yD(bl(X).toLowerCase())}function qT(X){return X=bl(X),X&&X.replace(Be,t9).replace(cr,"")}function sD(X,re,Ee){X=bl(X),re=Uc(re);var Ze=X.length;Ee=Ee===n?Ze:ug(ua(Ee),0,Ze);var Mt=Ee;return Ee-=re.length,Ee>=0&&X.slice(Ee,Mt)==re}function cD(X){return X=bl(X),X&&Qe.test(X)?X.replace(ut,n9):X}function uD(X){return X=bl(X),X&&bt.test(X)?X.replace(et,"\\$&"):X}var dD=J(function(X,re,Ee){return X+(Ee?"-":"")+re.toLowerCase()}),cie=J(function(X,re,Ee){return X+(Ee?" ":"")+re.toLowerCase()}),uie=G4("toLowerCase");function fD(X,re,Ee){X=bl(X),re=ua(re);var Ze=re?Kh(X):0;if(!re||Ze>=re)return X;var Mt=(re-Ze)/2;return Xo(x6(Mt),Ee)+X+Xo(y2(Mt),Ee)}function hD(X,re,Ee){X=bl(X),re=ua(re);var Ze=re?Kh(X):0;return re&&Ze>>0,Ee?(X=bl(X),X&&(typeof re=="string"||re!=null&&!qz(re))&&(re=Uc(re),!re&&h2(X))?Jf($l(X),0,Ee):X.split(re,Ee)):[]}var pD=J(function(X,re,Ee){return X+(Ee?" ":"")+yD(re)});function QT(X,re,Ee){return X=bl(X),Ee=Ee==null?0:ug(ua(Ee),0,X.length),re=Uc(re),X.slice(Ee,Ee+re.length)==re}function gD(X,re,Ee){var Ze=Bt.templateSettings;Ee&&Zd(X,re,Ee)&&(re=n),X=bl(X),re=Yc({},re,Ze,zn);var Mt=Yc({},re.imports,Ze.imports,zn),Xt=Gu(Mt),hn=Bu(Mt,Xt),bn,Ln,Po=0,Ro=re.interpolate||pt,Yo="__p += '",Hr=vu((re.escape||pt).source+"|"+Ro.source+"|"+(Ro===tt?Et:pt).source+"|"+(re.evaluate||pt).source+"|$","g"),oi="//# sourceURL="+(aa.call(re,"sourceURL")?(re.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++sc+"]")+` `;X.replace(Hr,function(Mi,Ja,dl,Ag,up,wg){return dl||(dl=Ag),Yo+=X.slice(Po,wg).replace(ct,$7),Ja&&(bn=!0,Yo+=`' + __e(`+Ja+`) + '`),up&&(Ln=!0,Yo+=`'; @@ -4883,21 +4883,21 @@ __p += '`),dl&&(Yo+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Yo+`return __p -}`;var Ia=z2(function(){return Gi(Xt,oi+"return "+Yo).apply(n,hn)});if(Ia.source=Yo,Xz(Ia))throw Ia;return Ia}function nY(X){return bl(X).toLowerCase()}function oY(X){return bl(X).toUpperCase()}function Br(X,re,Ee){if(X=bl(X),X&&(Ee||re===n))return Im(X);if(!X||!(re=Uc(re)))return X;var Ze=$l(X),Mt=$l(re),Xt=Ha(Ze,Mt),hn=iu(Ze,Mt)+1;return Jf(Ze,Xt,hn).join("")}function mD(X,re,Ee){if(X=bl(X),X&&(Ee||re===n))return X.slice(0,i9(X)+1);if(!X||!(re=Uc(re)))return X;var Ze=$l(X),Mt=iu(Ze,$l(re))+1;return Jf(Ze,0,Mt).join("")}function Hu(X,re,Ee){if(X=bl(X),X&&(Ee||re===n))return X.replace(St,"");if(!X||!(re=Uc(re)))return X;var Ze=$l(X),Mt=Ha(Ze,$l(re));return Jf(Ze,Mt).join("")}function iw(X,re){var Ee=M,Ze=D;if(Xa(re)){var Mt="separator"in re?re.separator:Mt;Ee="length"in re?ua(re.length):Ee,Ze="omission"in re?Uc(re.omission):Ze}X=bl(X);var Xt=X.length;if(h2(X)){var hn=$l(X);Xt=hn.length}if(Ee>=Xt)return X;var bn=Ee-Kh(Ze);if(bn<1)return Ze;var Ln=hn?Jf(hn,0,bn).join(""):X.slice(0,bn);if(Mt===n)return Ln+Ze;if(hn&&(bn+=Ln.length-bn),qz(Mt)){if(X.slice(bn).search(Mt)){var Po,Ro=Ln;for(Mt.global||(Mt=vu(Mt.source,bl(Lt.exec(Mt))+"g")),Mt.lastIndex=0;Po=Mt.exec(Ro);)var Yo=Po.index;Ln=Ln.slice(0,Yo===n?bn:Yo)}}else if(X.indexOf(Uc(Mt),bn)!=bn){var Hr=Ln.lastIndexOf(Mt);Hr>-1&&(Ln=Ln.slice(0,Hr))}return Ln+Ze}function Km(X){return X=bl(X),X&&ht.test(X)?X.replace(Oe,p2):X}var hie=J(function(X,re,Ee){return X+(Ee?" ":"")+re.toUpperCase()}),yD=G4("toUpperCase");function rY(X,re,Ee){return X=bl(X),re=Ee?n:re,re===n?p6(X)?g2(X):ud(X):X.match(re)||[]}var z2=fi(function(X,re){try{return xn(X,n,re)}catch(Ee){return Xz(Ee)?Ee:new Ri(Ee)}}),iY=la(function(X,re){return _n(re,function(Ee){Ee=gg(Ee),tp(X,Ee,WT(X[Ee],X))}),X});function aw(X){var re=X==null?0:X.length,Ee=mi();return X=re?qr(X,function(Ze){if(typeof Ze[1]!="function")throw new L0(a);return[Ee(Ze[0]),Ze[1]]}):[],fi(function(Ze){for(var Mt=-1;++MtL)return[];var Ee=O,Ze=Su(X,O);re=mi(re),X-=O;for(var Mt=$1(Ze,re);++Ee0||re<0)?new gi(Ee):(X<0?Ee=Ee.takeRight(-X):X&&(Ee=Ee.drop(X)),re!==n&&(re=ua(re),Ee=re<0?Ee.dropRight(-re):Ee.take(re-X)),Ee)},gi.prototype.takeRightWhile=function(X){return this.reverse().takeWhile(X).reverse()},gi.prototype.toArray=function(){return this.take(O)},pd(gi.prototype,function(X,re){var Ee=/^(?:filter|find|map|reject)|While$/.test(re),Ze=/^(?:head|last)$/.test(re),Mt=Bt[Ze?"take"+(re=="last"?"Right":""):re],Xt=Ze||/^find/.test(re);Mt&&(Bt.prototype[re]=function(){var hn=this.__wrapped__,bn=Ze?[1]:arguments,Ln=hn instanceof gi,Po=bn[0],Ro=Ln||Ki(hn),Yo=function(Ja){var dl=Mt.apply(Bt,na([Ja],bn));return Ze&&Hr?dl[0]:dl};Ro&&Ee&&typeof Po=="function"&&Po.length!=1&&(Ln=Ro=!1);var Hr=this.__chain__,oi=!!this.__actions__.length,Hi=Xt&&!Hr,Ia=Ln&&!oi;if(!Xt&&Ro){hn=Ia?hn:new gi(this);var Mi=X.apply(hn,bn);return Mi.__actions__.push({func:ET,args:[Yo],thisArg:n}),new Ou(Mi,Hr)}return Hi&&Ia?X.apply(this,bn):(Mi=this.thru(Yo),Hi?Ze?Mi.value()[0]:Mi.value():Mi)})}),_n(["pop","push","shift","sort","splice","unshift"],function(X){var re=$h[X],Ee=/^(?:push|sort|unshift)$/.test(X)?"tap":"thru",Ze=/^(?:pop|shift)$/.test(X);Bt.prototype[X]=function(){var Mt=arguments;if(Ze&&!this.__chain__){var Xt=this.value();return re.apply(Ki(Xt)?Xt:[],Mt)}return this[Ee](function(hn){return re.apply(Ki(hn)?hn:[],Mt)})}}),pd(gi.prototype,function(X,re){var Ee=Bt[re];if(Ee){var Ze=Ee.name+"";aa.call(ig,Ze)||(ig[Ze]=[]),ig[Ze].push({name:re,func:Ee})}}),ig[At(n,x).name]=[{name:"wrapper",func:n}],gi.prototype.clone=AT,gi.prototype.reverse=rz,gi.prototype.value=Gd,Bt.prototype.at=Mz,Bt.prototype.chain=Rre,Bt.prototype.commit=Hre,Bt.prototype.next=Mre,Bt.prototype.plant=FT,Bt.prototype.reverse=xB,Bt.prototype.toJSON=Bt.prototype.valueOf=Bt.prototype.value=Ire,Bt.prototype.first=Bt.prototype.head,tg&&(Bt.prototype[tg]=kT),Bt},Q1=mT();Wn?((Wn.exports=Q1)._=Q1,Cn._=Q1):wn._=Q1}).call(Rc)})(zJ,zJ.exports);var A3=zJ.exports;const Edn=t=>{const{lx:e,lz:n,parentId:o,id:r,roofId:i}=t,a=H(VRt),l=H(S5e);g.useEffect(()=>{i&&(a===i||l.has(i))&&H.getState().set(d=>{for(const f of d.elements)if(f.id===r&&f.type===z.Wall){const p=f;p.roofId=null,p.leftRoofHeight=void 0,p.rightRoofHeight=void 0,p.centerRoofHeight=void 0,p.centerLeftRoofHeight=void 0,p.centerRightRoofHeight=void 0;break}})},[i,a,l]);const s=d=>!(d.button===2||H.getState().moveHandleType||H.getState().resizeHandleType||H.getState().objectTypeToAdd!==z.None||H.getState().isAddingElement()),c=d=>{s(d)&&(H.getState().set(f=>{f.contextMenuObjectType=null}),H.getState().selectMe(r,d,er.Select))},u=d=>{H.getState().selectMe(r,d,er.ContextMenu),H.getState().set(f=>{d.intersections.length>0&&d.intersections[0].object===d.eventObject&&(f.contextMenuObjectType=z.Wall)})};return h.jsx(yi,{args:[e,n],rotation:[$t,0,0],visible:!1,onPointerDown:c,onContextMenu:u,children:h.jsx("meshBasicMaterial",{side:zr})})},kdn=xe.memo(Edn),rMe=({cy:t,size:e,type:n})=>{const[o,r]=g.useState(gL),i=()=>{r(Aa)},a=()=>{r(gL)};return h.jsx(Ys,{name:n,args:[e],position:[0,t,0],onPointerEnter:i,onPointerOut:a,children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},Fdn=({ply:t,phz:e})=>{const n=l2(),o=r=>{r.intersections.length>0&&r.intersections[0].eventObject.parent===r.eventObject&&(H.getState().set(i=>{i.moveHandleType=r.object.name}),jn.getState().setEnableOrbitController(!1))};return h.jsxs("group",{name:"Move Handle Group",position:[0,0,-e],onPointerDown:o,children:[h.jsx(rMe,{cy:-n,size:n,type:Ho.Lower}),h.jsx(rMe,{cy:t+n,size:n,type:Ho.Upper})]})},Ldn=xe.memo(Fdn),Wdn="#ADD8E6",ww=xe.memo(({x:t,z:e,handleType:n,highLight:o,handleSize:r,partial:i})=>{const a=H(pn),l=H(Cm),s=H(CJe),[c,u]=g.useState(!1),d=o||c||n===l||s&&(n===xt.LowerRight||n===xt.UpperRight)?Aa:i?Wdn:ll;let f=r,p=r,m=r;if(n===xt.LowerRight||n===xt.LowerLeft)f=r*1.7;else if(i){f*=.75,p=r/2,m=r*2.5;const y=m/4;n===xt.WallPartialResizeLeft||n===xt.WallPartialResizeRight?e-=y:(n===xt.WallPartialResizeLeftTop||n===xt.WallPartialResizeRightTop)&&(e+=y)}else p=r/2,m=r*1.7;return h.jsx(di,{name:n,args:[f,p,m],position:[t,0,e],onPointerOver:()=>{u(!0),a(y=>{y.hoveredHandle=n})},onPointerLeave:()=>{u(!1),a(y=>{y.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{color:d})})}),Ndn=xe.memo(({id:t,parentLz:e,roofId:n,x:o,z:r,absAngle:i,leftUnfilledHeight:a,rightUnfilledHeight:l,leftTopPartialResizeHandleHeight:s,rightTopPartialResizeHandleHeight:c,fill:u,wallLeftHeight:d,wallRightHeight:f,highLight:p,leftJoints:m,rightJoints:y})=>{const w=H(pn),x=H(M0),C=l2(),[P,A]=g.useState(!1),[S,v]=g.useState(new ue),[b,T]=g.useState(new cn),R=g.useRef(null),M=g.useRef(!1),D=g.useRef([r*2,a,l]),k=g.useRef(new Map),N=g.useRef(null),U=g.useRef(null),W=g.useRef([]),F=g.useMemo(()=>{if(!n)return null;const q=H.getState().elements.find(ae=>ae.id===n&&ae.type===z.Roof);return q?q.roofType:null},[n]);x&&(r=-r);const E=q=>{const ae=H.getState().cameraDirection,Z=Math.atan2(ae.x,ae.y);v(new ue(q,0,0)),T(new cn($t,0,-Z-i,"ZXY")),A(!0)},L=(q,ae,Z)=>{const[ne,te,$,le,de]=ae;w(he=>{for(const me of he.elements)if(me.id===q&&me.type===z.Wall){const ce=me;me.lz=ne,ce.leftUnfilledHeight=te,ce.rightUnfilledHeight=$,ce.leftTopPartialHeight=le,ce.rightTopPartialHeight=de}else if(me.type===z.Wall&&Z.has(me.id)){const ce=Z.get(me.id);ce!==void 0&&(me.lz=ce,me.cz=ce/2)}})},j=()=>{n&&(m.length>0||y.length>0)&&(F===Zo.Gable||F===Zo.Gambrel?H.getState().elements.forEach(q=>{q.id===m[0]&&(N.current=q.lz),q.id===y[0]&&(U.current=q.lz)}):(k.current.clear(),H.getState().elements.forEach(q=>{q.type===z.Wall&&q.roofId===n&&k.current.set(q.id,q.lz)})))},Y=()=>{W.current=H.getState().elements.filter(q=>q.parentId===t)},O=(q,ae,Z,ne,te)=>{const{lx:$,lz:le,roofId:de,leftRoofHeight:he,rightRoofHeight:me,centerLeftRoofHeight:ce,centerRightRoofHeight:Pe,centerRoofHeight:pe}=q,Ie=u===Ul.Partial,ve=Ie?Math.min(d,ne):d,ze=Ie?Math.min(f,te):f,Ae=Ie&&(!ye.isZero(d-ve)||!ye.isZero(f-ze)),[se,ge]=[$/2,le/2],we=[];return we.push({x:-se,y:-ge+ae},{x:se,y:-ge+Z}),Ae?we.push({x:se,y:-ge+ze},{x:-se,y:-ge+ve}):de?(me?we.push({x:se,y:-ge+me}):we.push({x:se,y:ge}),Pe&&we.push({x:Pe[0]*$,y:-ge+Pe[1]}),pe&&we.push({x:pe[0]*$,y:-ge+pe[1]}),ce&&we.push({x:ce[0]*$,y:-ge+ce[1]}),he?we.push({x:-se,y:-ge+he}):we.push({x:-se,y:ge})):we.push({x:se,y:ge},{x:-se,y:ge}),we},_=(q,ae,Z,ne,te)=>{const $=O(q,ae,Z,ne,te);if(W.current.length>0)for(const le of W.current){let{cx:de,cz:he,lx:me,ly:ce,lz:Pe}=le;if(de*=q.lx,he*=q.lz,le.type!==z.SolarPanel?(me*=q.lx,Pe*=q.lz):Pe=ce,le.type===z.Window&&le.windowType===Ti.Polygonal){const[pe,Ie]=le.polygonTop??P1,ve=de+pe*me,ze=he+Pe/2+Ie;if(!ye.isPointInside(ve,ze,$))return!1}if(!ye.isElementInsideWall(new ue(de,0,he),me,Pe,$,le.type===z.Door))return!1}return!0},G=()=>{N.current=null,U.current=null},Q=q=>{var Z;if(H.getState().addedWallId||q.object!==((Z=q.intersections[0])==null?void 0:Z.object))return;const ae=q.object;switch(ae.name){case xt.LowerLeft:{w(ne=>{ne.resizeAnchor.copy(ae.localToWorld(new ue(o*2,0,0)))});break}case xt.LowerRight:{w(ne=>{ne.resizeAnchor.copy(ae.localToWorld(new ue(-o*2,0,0)))});break}case xt.UpperLeft:case xt.WallPartialResizeLeft:case xt.WallPartialResizeLeftTop:{E(-o),j(),Y();break}case xt.UpperRight:case xt.WallPartialResizeRight:case xt.WallPartialResizeRightTop:{E(o),j(),Y();break}default:console.error("Wall resize handle unknown");return}w(ne=>{ne.resizeHandleType=ae.name}),jn.getState().setEnableOrbitController(!1),M.current=!0,D.current=[r*2,a,l,s,c]},oe=q=>{if(q.intersections.length===0||!M.current)return;const ae=q.intersections[0].point;switch(H.getState().resizeHandleType){case xt.UpperLeft:case xt.UpperRight:{w(Z=>{const ne=u===Ul.Partial?Math.max(a,l):0;let te=Math.max(ne+C,ae.z-e);if(F===null||F===Zo.Gable||F===Zo.Gambrel){if(N.current||U.current){const $=Math.abs(te-(N.current??1/0)),le=Math.abs(te-(U.current??1/0));${for(const ne of Z.elements)if(ne.id===t&&ne.type===z.Wall){const te=ne;let $=ye.clamp(ae.z-e,0,te.leftTopPartialHeight);if(te.leftJoints.length>0){const le=Z.elements.find(de=>de.id===te.leftJoints[0]&&de.type===z.Wall);if(le&&le.fill===Ul.Partial){const de=le.rightUnfilledHeight;Math.abs($-de)<.5&&($=de)}}_(te,$,Z.enableFineGrid?$:te.rightUnfilledHeight,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.leftUnfilledHeight=$,Z.enableFineGrid&&(te.rightUnfilledHeight=$));break}});break}case xt.WallPartialResizeRight:{w(Z=>{for(const ne of Z.elements)if(ne.id===t&&ne.type===z.Wall){const te=ne;let $=ye.clamp(ae.z-e,0,te.rightTopPartialHeight);if(te.rightJoints.length>0){const le=Z.elements.find(de=>de.id===te.rightJoints[0]&&de.type===z.Wall);if(le&&le.fill===Ul.Partial){const de=le.leftUnfilledHeight;Math.abs($-de)<.5&&($=de)}}_(te,Z.enableFineGrid?$:te.leftUnfilledHeight,$,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.rightUnfilledHeight=$,Z.enableFineGrid&&(te.leftUnfilledHeight=$));break}});break}case xt.WallPartialResizeLeftTop:{w(Z=>{const ne=Z.elements.find(te=>te.id===t&&te.type===z.Wall);if(ne){let te=ye.clamp(ae.z-e,ne.leftUnfilledHeight,ne.lz);if(ne.leftJoints.length>0){const $=Z.elements.find(le=>le.id===ne.leftJoints[0]&&le.type===z.Wall);if($&&$.fill===Ul.Partial){const le=$.rightTopPartialHeight;Math.abs(te-le)<.5&&(te=le)}}_(ne,ne.leftUnfilledHeight,ne.rightUnfilledHeight,te,Z.enableFineGrid?te:ne.rightTopPartialHeight)&&(ne.leftTopPartialHeight=te,Z.enableFineGrid&&(ne.rightTopPartialHeight=te))}});break}case xt.WallPartialResizeRightTop:{w(Z=>{const ne=Z.elements.find(te=>te.id===t&&te.type===z.Wall);if(ne){let te=ye.clamp(ae.z-e,ne.rightUnfilledHeight,ne.lz);if(ne.rightJoints.length>0){const $=Z.elements.find(le=>le.id===ne.rightJoints[0]&&le.type===z.Wall);if($&&$.fill===Ul.Partial){const le=$.leftTopPartialHeight;Math.abs(te-le)<.5&&(te=le)}}_(ne,ne.leftUnfilledHeight,ne.rightUnfilledHeight,Z.enableFineGrid?te:ne.leftTopPartialHeight,te)&&(ne.rightTopPartialHeight=te,Z.enableFineGrid&&(ne.leftTopPartialHeight=te))}});break}}},ee=()=>{jn.getState().setEnableOrbitController(!0),A(!1),G(),M.current=!1;const q=new Map;n&&F!==Zo.Gable&&F!==Zo.Gambrel&&H.getState().elements.forEach(Z=>{Z.type===z.Wall&&Z.roofId===n&&q.set(Z.id,Z.lz)});const ae={name:"Change Wall Height",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Wall,oldHeights:[...D.current],newHeights:[r*2,a,l,s,c],oldSameBuildingWallsHeightMap:new Map(k.current),newSameBuildingWallsHeightMap:q,undo(){L(this.resizedElementId,this.oldHeights,this.oldSameBuildingWallsHeightMap)},redo(){L(this.resizedElementId,this.newHeights,this.newSameBuildingWallsHeightMap)}};H.getState().addUndoable(ae),w(Z=>{Z.actionState.wallHeight=r*2,Z.resizeHandleType=null})};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Wall Resize Handle Group",onPointerDown:Q,children:[h.jsx(ww,{x:-o,z:-r,handleType:xt.LowerLeft,highLight:p,handleSize:C}),h.jsx(ww,{x:o,z:-r,handleType:xt.LowerRight,highLight:p,handleSize:C}),!x&&h.jsxs(h.Fragment,{children:[h.jsx(ww,{x:-o,z:r,handleType:xt.UpperLeft,highLight:p,handleSize:C}),h.jsx(ww,{x:o,z:r,handleType:xt.UpperRight,highLight:p,handleSize:C}),u===Ul.Partial&&h.jsxs(h.Fragment,{children:[h.jsx(ww,{x:-o,z:-r+a,handleType:xt.WallPartialResizeLeft,highLight:p,handleSize:C,partial:!0}),h.jsx(ww,{x:o,z:-r+l,handleType:xt.WallPartialResizeRight,highLight:p,handleSize:C,partial:!0}),h.jsx(ww,{x:-o,z:-r+s,handleType:xt.WallPartialResizeLeftTop,highLight:p,handleSize:C,partial:!0}),h.jsx(ww,{x:o,z:-r+c,handleType:xt.WallPartialResizeRightTop,highLight:p,handleSize:C,partial:!0})]})]})]}),P&&h.jsx(yi,{ref:R,position:S,rotation:b,args:[1e4,1e4],visible:!1,onPointerMove:oe,onPointerUp:ee,children:h.jsx("meshBasicMaterial",{side:zr})})]})});function Bot(t){return t.type===z.Cuboid}const Udn="/aladdin/assets/building_facade_01-PU9ju7d_.png",jdn="/aladdin/assets/building_facade_02-x--kz-oN.png",Bdn="/aladdin/assets/building_facade_03-BYNjzj26.png",Ydn="/aladdin/assets/building_facade_04-VGO1xPmk.png",Odn="/aladdin/assets/building_facade_05-D5uzq3D-.png",_dn="/aladdin/assets/building_facade_06-ClFD4NV8.png",Vdn="/aladdin/assets/building_facade_07-XvrQxWV-.png",Gdn="/aladdin/assets/building_facade_08-D0kjh0Oz.png",Xdn="/aladdin/assets/building_facade_09-y8kFBOu-.png",Jdn="/aladdin/assets/building_facade_10-B2-exMft.png",Q9=xe.memo(({handleType:t,position:e,size:n,onPointerDown:o,onPointerOver:r,onPointerOut:i})=>{const a=H(FS),l=H($y),s=g.useRef(null),[c,u,d]=e;let f=q8;c===0&&u===0?f=kvt:c===0?f=gL:u===0&&(f=q8);const p=l===t||a===t?Aa:f;return h.jsx(Ys,{ref:s,name:t,args:[n/2,6,6,0,Math.PI],position:[c,u,d],onPointerDown:o,onPointerOver:m=>{r(m,t)},onPointerOut:i,children:h.jsx("meshBasicMaterial",{color:p})})}),Vc=xe.memo(({handleType:t,position:e,size:n,onPointerOver:o,onPointerOut:r})=>{const i=H(Cm),a=H($y),l=g.useRef(null),[s,c,u]=e,d=a===t||i===t?Aa:ll,f=()=>{if(l.current){const p=l.current.localToWorld(new ue(-s*2,-c*2,0));H.getState().set(m=>{m.resizeAnchor.copy(p),m.resizeHandleType=t}),jn.getState().setEnableOrbitController(!1)}};return h.jsx(di,{ref:l,name:t,args:[n,n,n],position:[s,c,u],onPointerDown:f,onPointerMove:p=>{o(p,t)},onPointerOut:r,children:h.jsx("meshBasicMaterial",{color:d})})}),Kdn=({id:t,args:e})=>{const[n,o,r]=e,i=H(pn),a=H(Jn),l=H(M0),s=H(PQ),[c,u]=g.useState(null),{gl:d,raycaster:f}=ti(),p=l2(),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(null),v=g.useMemo(()=>[0,Math.min(-1.2*o,-o-.75)-p*2,$8/2-r],[o,r,p]),b=g.useMemo(()=>[0,Math.max(1.2*o,o+.75)+p*2,$8/2-r],[o,r,p]),T=c!==null,R=!l,M=!s,D=g.useCallback((q,ae)=>{dt.getState().duringCameraInteraction||q.intersections.length>0&&(q.intersections[0].object===q.eventObject||q.intersections.length>1&&q.intersections[1].object===q.eventObject)&&(i(ne=>{ne.hoveredHandle=ae;const te=a(t);te&&(ne.selectedElementAngle=te.rotation[2],ne.selectedElementHeight=te.lz)}),ye.isMoveHandle(ae)?d.domElement.style.cursor="move":ae===ai.Upper||ae===ai.Lower?d.domElement.style.cursor="grab":d.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"pointer")},[]),k=g.useCallback(()=>{i(q=>{q.hoveredHandle=null}),d.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),N=q=>{const ae=a(q);if(!ae)return 0;const Z=ae.rotation[2];return ae.parentId===rr?Z:Z+N(ae.parentId)},U=q=>{switch(q){case z.SolarPanel:case z.Human:case z.Flower:case z.Tree:return!0}return!1},W=q=>U(q)||q===z.Cuboid,F=q=>{i(ae=>{const Z=ae.elements.find(ve=>ve.id===t);if(!Z)return;const ne=q.clone().setZ(0),te=H.getState().resizeAnchor.clone().setZ(0),$=new ue().subVectors(ne,te).applyEuler(new cn(0,0,-(w.current??0))),le=new ue().addVectors(ne,te).multiplyScalar(.5),{pos:de,rot:he}=ye.getWorldDataById(Z.parentId),me=new ue().subVectors(le,de).applyEuler(new cn(0,0,-he));Z.cx=me.x,Z.cy=me.y;const ce=Math.abs($.x),Pe=Math.abs($.y);Z.lx=ce,Z.ly=Pe;const pe=new ue(me.x,me.y,Z.cz).applyEuler(new cn(0,0,he)).add(de),Ie=Z.rotation[2]+he;if(P.current.size>0)for(const ve of ae.elements){const ze=P.current.get(ve.id);if(ze){const Ae=ze.clone().sub(pe).applyEuler(new cn(0,0,-Ie));if(U(ve.type)){const se=A.current.get(ve.id);if(se){const[ge,we]=se;ge==="Top"?(ve.cx=Ae.x,ve.cy=Ae.y):ge==="NS"?(ve.cx=Ae.x,ve.cy=Math.sign(we)*(Pe/2)):ge==="EW"&&(ve.cx=Math.sign(we)*(ce/2),ve.cy=Ae.y)}}else ve.type===z.Cuboid?(ve.cx=Ae.x,ve.cy=Ae.y):(ve.cx=Ae.x/ce,ve.cy=Ae.y/Pe)}}})},E=q=>{i(ae=>{const Z=ae.elements.find(Ie=>Ie.id===t);if(!Z)return;const ne=q.clone().setZ(0),te=H.getState().resizeAnchor.clone().setZ(0),$=new ue().subVectors(ne,te).applyEuler(new cn(0,0,-(w.current??0))),le=new ue().addVectors(ne,te).multiplyScalar(.5),{pos:de,rot:he}=ye.getWorldDataById(Z.parentId),me=new ue().subVectors(le,de).applyEuler(new cn(0,0,-he));Z.cx=me.x;const ce=Math.abs($.x);Z.lx=ce;const Pe=new ue(me.x,me.y,Z.cz).applyEuler(new cn(0,0,he)).add(de),pe=Z.rotation[2]+he;if(P.current.size>0)for(const Ie of ae.elements){const ve=P.current.get(Ie.id);if(ve){const ze=ve.clone().sub(Pe).applyEuler(new cn(0,0,-pe));if(U(Ie.type)){const Ae=A.current.get(Ie.id);if(Ae){const[se,ge]=Ae;se==="Top"||se==="NS"?Ie.cx=ze.x:se==="EW"&&(Ie.cx=Math.sign(ge)*(ce/2))}}else Ie.type===z.Cuboid?Ie.cx=ze.x:Ie.cx=ze.x/ce}}})},L=q=>{i(ae=>{const Z=ae.elements.find(Ie=>Ie.id===t);if(!Z)return;const ne=q.clone().setZ(0),te=H.getState().resizeAnchor.clone().setZ(0),$=new ue().subVectors(ne,te).applyEuler(new cn(0,0,-(w.current??0))),le=new ue().addVectors(ne,te).multiplyScalar(.5),{pos:de,rot:he}=ye.getWorldDataById(Z.parentId),me=new ue().subVectors(le,de).applyEuler(new cn(0,0,-he));Z.cy=me.y;const ce=Math.abs($.y);Z.ly=ce;const Pe=new ue(me.x,me.y,Z.cz).applyEuler(new cn(0,0,he)).add(de),pe=Z.rotation[2]+he;if(P.current.size>0)for(const Ie of ae.elements){const ve=P.current.get(Ie.id);if(ve){const ze=ve.clone().sub(Pe).applyEuler(new cn(0,0,-pe));if(U(Ie.type)){const Ae=A.current.get(Ie.id);if(Ae){const[se,ge]=Ae;se==="Top"?Ie.cy=ze.y:se==="NS"?Ie.cy=Math.sign(ge)*(ce/2):se==="EW"&&(Ie.cy=ze.y)}}else Ie.type===z.Cuboid?Ie.cy=ze.y:Ie.cy=ze.y/ce}}})},j=q=>{if(m.current!==null){const ae=Math.max(1,q.z-m.current);i(Z=>{for(const ne of Z.elements)if(ne.id===t&&(ne.lz=ae,ne.cz=ae/2,Z.selectedElementHeight=ae),ne.parentId===t&&U(ne.type)){const te=A.current.get(ne.id);te&&te[0]==="Top"&&(ne.cz=ae/2)}})}},Y=q=>{if(y.current){const[ae,Z]=y.current;let ne=Math.atan2(ae-q.x,q.y-Z)+(H.getState().rotateHandleType===ai.Upper?0:Math.PI);const te=Math.abs(ne)>Math.PI?-Math.sign(ne)*fa:0;x.current&&(ne-=x.current),H.getState().updateElementRotationById(t,0,0,ne+te)}},O=q=>{if(q.intersections.length>0&&q.intersections[0].object.name===q.object.name||H.getState().addedCuboidId){const ae=a(t);if(ae&&ae.parentId!==rr){u({position:new ue(0,0,-r),rotation:new cn});const{pos:Z,rot:ne}=ye.getWorldDataById(ae.parentId);C.current=Z,x.current=ne,w.current=ne+ae.rotation[2];const te=new ue(ae.cx,ae.cy,ae.cz).applyEuler(new cn(0,0,ne)).add(Z),$=H.getState().elements.filter(le=>le.parentId===ae.id&&(W(le.type)||ye.isIdentical(le.normal,[0,0,1])));P.current.clear(),A.current.clear();for(const le of $){const de=new ue;U(le.type)?(de.set(le.cx,le.cy,le.cz),Math.abs(le.cz-r)<.01?A.current.set(le.id,["Top",1]):Math.abs(Math.abs(le.cx)-n)<.01?A.current.set(le.id,["EW",Math.sign(le.cx)]):A.current.set(le.id,["NS",Math.sign(le.cy)])):le.type===z.Cuboid?de.set(le.cx,le.cy,le.cz):de.set(le.cx*ae.lx,le.cy*ae.ly,0),de.applyEuler(new cn(0,0,w.current)).add(te),P.current.set(le.id,de)}}i(Z=>{Z.selectedElementIdSet.clear(),Z.selectedElementIdSet.add(t),Z.selectedElement=Z.elements.find(ne=>ne.id===t)??null})}},_=q=>{if(q.intersections.length>0&&q.intersections[0].object.name===q.object.name){const ae=q.intersections[0].object,Z=H.getState().cameraDirection,ne=Math.atan2(Z.x,Z.y)+N(t);u({position:ae.position.clone(),rotation:new cn(-$t,ne,0)});const te=ae.localToWorld(new ue);m.current=te.z-r*2;const $=H.getState().elements.filter(le=>le.parentId===t&&U(le.type));A.current.clear();for(const le of $)new ue().set(le.cx,le.cy,le.cz),Math.abs(le.cz-r)<.01&&A.current.set(le.id,["Top",1]);i(le=>{le.selectedElementIdSet.clear(),le.selectedElementIdSet.add(t),le.selectedElement=le.elements.find(de=>de.id===t)??null})}},G=q=>{if(q.intersections.length>0&&q.intersections[0].object.name===q.object.name){u({position:new ue(0,0,-r),rotation:new cn(0,0,0)});const ae=q.eventObject;y.current=ae.localToWorld(new ue).toArray();const Z=a(t);Z&&(x.current=N(Z.parentId))}},Q=q=>{if(q.intersections.length>0){const ae=q.intersections[0].eventObject.name;switch(ae){case Ho.Lower:case Ho.Upper:case Ho.Left:case Ho.Right:case Ho.Top:{H.getState().set(Z=>{const ne=Z.elements.find(te=>te.id===t)??null;if(ne){if(Z.selectedElement=ne,ne.parentId===rr)for(const te of Z.elements)Z.selectedElementIdSet.has(te.id)&&!ye.isElementAllowedMultipleMoveOnGround(te)&&Z.selectedElementIdSet.delete(te.id);else Z.selectedElementIdSet.clear(),Z.selectedElementIdSet.add(ne.id);Z.moveHandleType=ae}}),jn.getState().setEnableOrbitController(!1);break}}}},oe=q=>{if(S.current){const ae=f.intersectObject(S.current);if(ae.length){const Z=ae[0].point,ne=H.getState().resizeHandleType;ne?ye.isTopResizeHandle(ne)?j(Z):ye.isXResizeHandle(ne)?E(Z):ye.isYResizeHandle(ne)?L(Z):F(Z):H.getState().rotateHandleType&&Y(Z)}}},ee=()=>{u(null),m.current=null,y.current=null,w.current=null,x.current=null,C.current=null};return h.jsxs(h.Fragment,{children:[T&&h.jsx(yi,{name:"Cuboid Intersection Plane",ref:S,args:[1e4,1e4],position:c.position,rotation:c.rotation,visible:!1,onPointerMove:oe,onPointerUp:ee}),h.jsxs("group",{name:"Bottom Resize Handle Group",position:[0,0,-r+p/2],onPointerDown:O,children:[h.jsx(Vc,{handleType:xt.UpperLeft,position:[-n,o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRight,position:[n,o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerLeft,position:[-n,-o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRight,position:[n,-o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Left,position:[-n,0,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Right,position:[n,0,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Upper,position:[0,o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Lower,position:[0,-o,0],size:p,onPointerOver:D,onPointerOut:k})]}),R&&h.jsxs("group",{name:"Cuboid Top Resize Handle Group",onPointerDown:_,children:[h.jsx(Vc,{handleType:xt.LowerLeftTop,position:[-n,-o,r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperLeftTop,position:[-n,o,r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRightTop,position:[n,-o,r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRightTop,position:[n,o,r],size:p,onPointerOver:D,onPointerOut:k})]}),M&&h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Cuboid Move Handle Group",onPointerDown:Q,children:[h.jsx(Q9,{handleType:Ho.Lower,position:[0,-o-p*1.2,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Upper,position:[0,o+p*1.2,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Left,position:[-n-p*1.2,0,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Right,position:[n+p*1.2,0,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Top,position:[0,0,r],size:p,onPointerOver:D,onPointerOut:k})]}),h.jsxs("group",{name:"Cuboid Rotate Handle Group",onPointerDown:G,children:[h.jsx(MH,{id:t,handleType:ai.Lower,position:v,ratio:p*4,hoverHandle:D,noHoverHandle:k}),h.jsx(MH,{id:t,position:b,handleType:ai.Upper,ratio:p*4,hoverHandle:D,noHoverHandle:k})]})]})]})},$dn=xe.memo(Kdn);class Ii{static getSolarPanelUnitLength(e){const n=H.getState().getPvModule(e.pvModelName);return e.orientation===br.landscape?[n.length,n.width]:[n.width,n.length]}static getRotationFromNormal(e){const[n,o,r]=e;return r===1?new cn(0,0,0):n!==0?new cn($t,0,n*$t,"ZXY"):o!==0?new cn(-o*$t,0,0):new cn}static isNewPositionOk(e){const n=H.getState().elements.find(o=>o.id===e.parentId);if(!n)return!1;switch(n.type){case z.Foundation:{if(!ye.isSolarCollectorWithinHorizontalSurface(e,n))return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(H.getState().overlapWithSibling(e))return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}case z.Cuboid:{if(e.type===z.SolarWaterHeater)break;const o=ye.checkElementOnCuboidState(e,n);if(o===ya.OutsideBoundary)return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(o===ya.OverLap)return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}case z.Wall:{const o=ye.checkElementOnWallState(e,n);if(o===ya.OutsideBoundary)return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(o===ya.OverLap)return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}case z.Roof:{const o=ye.checkElementOnRoofState(e,n);if(o===ya.OutsideBoundary)return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(o===ya.OverLap)return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}}return!0}static getRackCount(e,n,o,r,i){if(e===br.portrait){const a=Math.max(1,Math.round(n/i)),l=Math.max(1,Math.round(o/r));return a*l}else{const a=Math.max(1,Math.round(n/r)),l=Math.max(1,Math.round(o/i));return a*l}}static getSurfaceType(e,n){return!n||!e||e===z.Foundation?qa.Horizontal:e===z.Wall?qa.Vertical:ye.isEqual(n.z,1)?qa.Horizontal:e===z.Cuboid?qa.Vertical:qa.Inclined}static findParentGroup(e,n){const o=e.parent;if(!o)return null;for(const r of n)if(o.name.includes(r))return o;return Ii.findParentGroup(o,n)}static getRoofId(e){if(!e)return null;const n=e.userData.roofId;return n||Ii.getRoofId(e.parent)}static getRoofSegmentData(e){if(!e)return null;const{roofId:n,foundation:o,centroid:r,roofSegments:i}=e.userData;return!n||!o||!r||!i?Ii.getRoofSegmentData(e.parent):{roofId:n,foundation:o,centroid:r,roofSegments:i}}static getRelativeAzimuth(e){return e>Math.PI?e-Math.PI*2:e<-Math.PI?e+Math.PI*2:e}static isTrackerEnabled(e,n){return e===qa.Horizontal&&n!==Bl.NO_TRACKER}static getUnitSize(e,n,o){return e===br.landscape?{length:n,width:o}:{length:o,width:n}}static getRotationOnCuboid(e){const{x:n,y:o,z:r}=e;return ye.isEqual(r,1)?[0,0,0]:ye.isEqual(n,0)&&ye.isEqual(o,1)?[$t,0,Math.PI]:ye.isEqual(n,0)&&ye.isEqual(o,-1)?[$t,0,0]:ye.isEqual(n,-1)&&ye.isEqual(o,0)?[$t,0,-$t]:ye.isEqual(n,1)&&ye.isEqual(o,0)?[$t,0,$t]:[0,0,0]}static getPVModel(e){let n=H.getState().supportedPvModules[e];return n||(n=H.getState().customPvModules[e],n)?n:(console.warn("pvModel undefined. Using default model: SPR-X21-335-BLK"),{name:"SPR-X21-335-BLK",brand:"SunPower",cellType:"Monocrystalline",efficiency:.21,length:1.558,nominalLength:1.56,width:1.046,nominalWidth:1.05,thickness:.046,m:12,n:8,pmax:335,vmpp:57.3,impp:5.85,voc:67.9,isc:6.23,pmaxTC:-.0029,noct:41.5,weight:18.6,color:"Black",shadeTolerance:"High",bifacialityFactor:0})}static addUndoable(e,n){if(e)switch(n){case Fr.Move:{Ii.addUndoableMove(e);break}case Fr.ResizeX:case Fr.ResizeY:{Ii.addUndoableResize(e);break}case Fr.RotateLower:case Fr.RotateUpper:{Ii.addUndoableRotate(e);break}case Fr.Tilt:{Ii.addUndoableTilt(e);break}}}static addUndoableMove(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new ue().fromArray(e.normal),newNormal:new ue().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};H.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{H.getState().set(f=>{const p=f.elements.find(m=>m.id===i);!p||p.type!==z.SolarPanel||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e){const n=H.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarPanel);if(!n)return;const o={name:"Resize Solar Panel",timestamp:Date.now(),id:n.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[n.cx,n.cy,n.cz],newDms:[n.lx,n.ly,n.lz],newRot:[...n.rotation],newNor:[...n.normal],undo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.oldPos],[i.lx,i.ly,i.lz]=[...o.oldDms],i.normal=[...o.oldNor],i.rotation=[...o.oldRot];break}})},redo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.newPos],[i.lx,i.ly,i.lz]=[...o.newDms],i.normal=[...o.newNor],i.rotation=[...o.newRot];break}})}};H.getState().addUndoable(o)}static addUndoableRotate(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Relative Azimuth",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};H.getState().addUndoable(o);const r=i=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.relativeAzimuth=i)})}}static addUndoableTilt(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Tilt",timestamp:Date.now(),changedElementId:n.id,oldValue:e.tiltAngle,newValue:n.tiltAngle,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};H.getState().addUndoable(o);const r=i=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.tiltAngle=i)})}}}const qdn=t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=1,color:l="silver",lineColor:s="black",lineWidth:c=.1,locked:u=!1,showLabel:d=!1,textureTypes:f=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture],stackable:p,transparency:m}=t,y=Fc(e),w=H(pn),x=H(Au),C=H(M0),P=H(Jn),A=H(HS),S=H(y5e),v=H(Jp),b=H(Z3),T=H(H7),R=H(Q3),M=H(u5e),D=H(APt),k=H(z0),N=H(yQ),U=H(O5),W=H(xs),F=H(Fn),E=H(b5e),L=H(M7),j=H(pXe),Y=H(c5e),O=dt(vs),_=H(Df),G=In(O1),Q=H(h4),{camera:oe,gl:{domElement:ee},raycaster:q,mouse:ae}=ti(),[Z,ne]=g.useState(null),[te,$]=g.useState(null),[le,de]=g.useState(null),[he,me]=g.useState(null),[ce,Pe]=g.useState(null),[pe,Ie]=g.useState(!1),[ve,ze]=g.useState(!1),Ae=g.useRef(null),se=g.useRef(null),ge=g.useRef(null),we=g.useRef(Oo),[Se,Me]=g.useState(new ue(0,0,0)),Ce=g.useRef(new cn(0,0,0)),Te=g.useRef(new ue(1,1,1)),Re=g.useRef(new ue),Ne=g.useRef(new ue),_e=g.useRef(new ue),Ue=g.useRef(new ue),qe=g.useRef(new ue(1,1,1)),Fe=g.useRef(new ue(1,1,1)),He=g.useRef(0),Le=g.useRef(0),Ye=g.useRef([]),lt=g.useRef([]),Oe=g.useRef(null),ut=g.useRef(new ue),ht=g.useRef(0),Qe=g.useMemo(()=>({lng:x}),[x]),nt=r/2,mt=i/2,tt=a/2,gt=g.useMemo(()=>new ue,[]),Ve=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.CuboidElement",Qe))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",Qe)+")":"")+(t!=null&&t.label?"":` -`+B.t("word.Coordinates",Qe)+": ("+n.toFixed(1)+", "+o.toFixed(1)+", "+(a/2).toFixed(1)+") "+B.t("word.MeterAbbreviation",Qe)),[t==null?void 0:t.label,t==null?void 0:t.locked,Qe,n,o,a]);g.useEffect(()=>{const An=()=>{ge.current=null,ze(!1),jn.getState().setEnableOrbitController(!0)};return window.addEventListener("pointerup",An),()=>{window.removeEventListener("pointerup",An)}},[]),g.useEffect(()=>{H.getState().tempHumanPlant.length>0&&w(An=>{An.elements.push(...An.tempHumanPlant),An.tempHumanPlant=[]})},[]),g.useEffect(()=>{if(t&&O){const An=_??5,Dn=G(t.id+"-top");Dn&&ne(ye.fetchHeatmapTexture(Dn,An));const sr=G(t.id+"-south");sr&&$(ye.fetchHeatmapTexture(sr,An));const Vo=G(t.id+"-north");Vo&&de(ye.fetchHeatmapTexture(Vo,An));const Wo=G(t.id+"-west");Wo&&me(ye.fetchHeatmapTexture(Wo,An));const To=G(t.id+"-east");To&&Pe(ye.fetchHeatmapTexture(To,An,!0))}},[O,_]);const je=An=>{switch(An){case Do.Facade01:return Udn;case Do.Facade02:return jdn;case Do.Facade03:return Bdn;case Do.Facade04:return Ydn;case Do.Facade05:return Odn;case Do.Facade06:return _dn;case Do.Facade07:return Vdn;case Do.Facade08:return Gdn;case Do.Facade09:return Xdn;case Do.Facade10:return Jdn;default:return Gg}},et=An=>{switch(An){case Do.Facade01:return{x:14,y:6.5};case Do.Facade02:return{x:14,y:6.5};case Do.Facade03:return{x:10,y:12};case Do.Facade04:return{x:20,y:11};case Do.Facade05:return{x:15,y:10};case Do.Facade06:return{x:11,y:3.5};case Do.Facade07:return{x:11,y:10};case Do.Facade08:return{x:16,y:9};case Do.Facade09:return{x:10,y:9};case Do.Facade10:return{x:12,y:9};default:return{x:1,y:1}}},bt=g.useMemo(()=>new Qg().load(f?je(f[0]):Gg,An=>{const Dn=et(f[0]);An.repeat.set(i/Dn.x,a/Dn.y),An.rotation=$t,An.center.x=1,An.center.y=0,An.wrapS=An.wrapT=es,Pt(An)}),[f[0],i,a]),[St,Pt]=g.useState(bt),Yt=g.useMemo(()=>new Qg().load(f?je(f[1]):Gg,An=>{const Dn=et(f[1]);An.repeat.set(i/Dn.x,a/Dn.y),An.rotation=-$t,An.wrapS=An.wrapT=es,Rt(An)}),[f[1],i,a]),[zt,Rt]=g.useState(Yt),Ct=g.useMemo(()=>new Qg().load(f?je(f[2]):Gg,An=>{const Dn=et(f[2]);An.repeat.set(r/Dn.x,a/Dn.y),An.rotation=Math.PI,An.center.x=0,An.center.y=1,An.wrapS=An.wrapT=es,at(An)}),[f[2],r,a]),[yt,at]=g.useState(Ct),Et=g.useMemo(()=>new Qg().load(f?je(f[3]):Gg,An=>{const Dn=et(f[3]);An.repeat.set(r/Dn.x,a/Dn.y),An.wrapS=An.wrapT=es,Je(An)}),[f[3],r,a]),[Lt,Je]=g.useState(Et),st=g.useMemo(()=>new Qg().load(f?je(f[4]):Gg,An=>{const Dn=et(f[4]);An.repeat.set(r/Dn.x,i/Dn.y),An.wrapS=An.wrapT=es,ot(An)}),[f[4],r,i]),[It,ot]=g.useState(st);g.useEffect(()=>{Ip()},[f]);const it=An=>{switch(An){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:return!0}return!1},Be=An=>{switch(An){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.Human:case z.Tree:case z.Flower:return!0}return!1},pt=An=>{we.current=An;const Dn=.01;ye.isSame(we.current,Oo)?(Me(new ue(0,0,tt+Dn)),Ce.current=new cn(0,0,0),Te.current.set(nt,mt,tt)):ye.isSame(we.current,b1)?(Me(new ue(nt+Dn,0,0)),Ce.current=new cn(0,$t,0),Te.current.set(tt,mt,nt)):ye.isSame(we.current,S1)?(Me(new ue(-nt-Dn,0,0)),Ce.current=new cn(0,-$t,0),Te.current.set(tt,mt,nt)):ye.isSame(we.current,T1)?(Me(new ue(0,-mt-Dn,0)),Ce.current=new cn($t,0,0),Te.current.set(nt,tt,mt)):ye.isSame(we.current,Zc)&&(Me(new ue(0,mt+Dn,0)),Ce.current=new cn(-$t,0,0),Te.current.set(nt,tt,mt))},ct=Math.max(1,Math.max(r,i)/8),Xe=Tm*ct,ft=An=>{var Vo,Wo;const Dn=An.intersections[0];if(H.getState().objectTypeToAdd===z.SolarPanel){const To=Dn.point,{pos:Go,rot:No}=ye.getWorldDataById(e),ho=new ue().subVectors(To,Go).applyEuler(new cn(0,0,-No)),vo=((Vo=Dn.face)==null?void 0:Vo.normal)??new ue(0,0,1);let bo=H.getState().getPvModule(H.getState().actionState.solarPanelModelName??g3);bo||(bo=H.getState().getPvModule(g3));const Bo=Qa.makeSolarPanel(t,bo,ho.x,ho.y,ho.z,H.getState().actionState.solarPanelOrientation??br.landscape,H.getState().actionState.solarPanelPoleHeight??1,H.getState().actionState.solarPanelPoleSpacing??3,H.getState().actionState.solarPanelTiltAngle??0,H.getState().actionState.solarPanelRelativeAzimuth??0,vo,Ii.getRotationOnCuboid(vo),H.getState().actionState.solarPanelFrameColor??"white");return w(Pr=>{Pr.elements.push(Bo)}),Bo}else return S(t,Dn.point,(Wo=Dn.face)==null?void 0:Wo.normal)},wt=An=>{if(An.button===2)return;E()||k(e,An,er.Select);const Dn=A();let sr=!1;if(An.intersections[0].object.name===z.Polygon&&H.getState().objectTypeToAdd!==z.None&&(sr=!0),(Dn==null?void 0:Dn.id)===e||sr)if(Be(H.getState().objectTypeToAdd)&&t){ze(!0);const Vo=ft(An);if(Vo){const Wo={name:"Add",timestamp:Date.now(),addedElement:Vo,undo:()=>{v(Wo.addedElement.id,!1)},redo:()=>{w(To=>{To.elements.push(Wo.addedElement),To.selectedElement=Wo.addedElement})}};F(Wo),w(To=>{To.selectedElementIdSet.clear(),To.selectedElementIdSet.add(Vo.id),To.selectedElement=Vo,To.objectTypeToAdd=z.None})}}else jn.getState().selectNone(),jn.setState({cuboidRef:Ae});else if(Dn&&Dn.parentId===e&&it(Dn.type)){ze(!0);const{rot:Vo,pos:Wo}=ye.getWorldDataById(e);ut.current.copy(Wo),ht.current=Vo,ge.current=Dn;let To;for(const Go of An.intersections)if(Go.object===se.current){To=Go.face;break}switch(To&&pt(To.normal),jn.getState().setEnableOrbitController(!1),Re.current.x=Dn.cx,Re.current.y=Dn.cy,Re.current.z=Dn.cz,_e.current.fromArray(Dn.normal),qe.current.x=Dn.lx,qe.current.y=Dn.ly,qe.current.z=Dn.lz,Dn.type){case z.SolarPanel:He.current=Dn.relativeAzimuth,dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e);break;case z.Polygon:Ye.current=Dn.vertices.map(Go=>({...Go}));break}}},kt=An=>{var No,ho;if(!se.current)return;const Dn=q.intersectObjects([se.current]);if(Dn.length===0)return;const sr=Dn[0].face;if(!sr)return;const Vo=O0.getIntersectionObjects(An);if(Vo.length===0||Vo[0].eventObject.userData.id!==e){Eo(!1),ge.current=null;return}const Wo=H.getState().selectedElement;if(!!(Wo&&!Wo.locked&&Wo.type===z.SolarPanel&&H.getState().moveHandleType)&&(ge.current=Wo),sr.normal.z===1&&((No=ge.current)==null?void 0:No.type)!==z.Polygon){const vo=!!(((ho=ge.current)==null?void 0:ho.type)===z.SolarPanel&&(H.getState().moveHandleType||H.getState().rotateHandleType||H.getState().resizeHandleType)&&!ge.current.locked);Eo(vo),vo&&(gt.set(0,0,ge.current.poleHeight+a/2),pt(new ue(0,0,1)),ze(!0));return}else if(Eo(!1),ge.current&&t&&!ge.current.locked){const vo=new _t(An.offsetX/ee.clientWidth*2-1,1-An.offsetY/ee.clientHeight*2);q.setFromCamera(vo,oe);let bo=Dn[0].point;if(H.getState().moveHandleType){const Bo=sr.normal;if(pt(Bo),bo=ye.relativeCoordinates(bo.x,bo.y,bo.z,t),ge.current.type===z.Polygon){const Pr=ge.current;if(H.getState().moveHandleType===Ho.Default){const so=ye.calculatePolygonCentroid(Ye.current),zo=new ue().fromArray(Pr.normal);let Ci,ea;ye.isSame(zo,b1)?(Ci=-(so.x+bo.z),ea=bo.y-so.y):ye.isSame(zo,S1)?(Ci=bo.z-so.x,ea=bo.y-so.y):ye.isSame(zo,Zc)?(Ci=bo.x-so.x,ea=-(so.y+bo.z)):ye.isSame(zo,T1)?(Ci=bo.x-so.x,ea=bo.z-so.y):(Ci=bo.x-so.x,ea=bo.y-so.y);const rs=Ye.current.map(Da=>({...Da}));rs.forEach(Da=>{Da.x+=Ci,Da.y+=ea}),L(Pr.id,rs)}}else R(ge.current.id,bo.x,bo.y,bo.z),D(ge.current.id,Bo.x,Bo.y,Bo.z),ge.current.parentId!==e&&H.getState().set(Pr=>{const so=Pr.elements.find(zo=>{var Ci;return zo.id===((Ci=ge.current)==null?void 0:Ci.id)&&zo.type===z.SolarPanel});so&&(so.parentId!==e||so.foundationId!==e)&&(so.parentId=e,so.foundationId=e,so.parentType=z.Cuboid,Pr.selectedElement&&(Pr.selectedElement.parentId=e,so.color=Pr.selectedElement.color))})}else if(H.getState().resizeHandleType)switch(ge.current.type){case z.SolarPanel:{const Bo=ge.current;if(Bo.normal[2]===1)break;const[Pr,so]=Ii.getSolarPanelUnitLength(Bo),zo=H.getState().resizeAnchor,Ci=H.getState().resizeHandleType;if(Ci===xt.Lower||Ci===xt.Upper){const rs=Math.max(1,Math.round(Math.abs(bo.z-zo.z)/so))*so,Da=new ue(0,0,bo.z-zo.z).normalize().multiplyScalar(rs),or=new ue().addVectors(zo,Da.clone().divideScalar(2));w(cr=>{const ii=cr.elements.find(Ga=>Ga.id===Bo.id);ii&&(ii.cz=(or.z-ut.current.z)/a,ii.ly=Math.abs(Da.z))})}else if(Ci===xt.Left||Ci===xt.Right){const ea=new ue().subVectors(bo,zo).setZ(0),Da=Math.max(1,Math.round(ea.length()/Pr))*Pr,or=ea.clone().normalize().multiplyScalar(Da),cr=new ue().addVectors(zo,or.clone().divideScalar(2)),ii=new ue().subVectors(cr,ut.current).applyEuler(new cn(0,0,-ht.current));w(Ga=>{const xi=Ga.elements.find(Uu=>Uu.id===Bo.id);xi&&(Math.abs(Math.abs(xi.normal[1])-1)<.01?xi.cx=ii.x/r:xi.cy=ii.y/i,xi.lx=or.length())})}break}case z.Polygon:{if(H.getState().resizeHandleType===xt.Default){let Bo=new ue(bo.x-ut.current.x,bo.y-ut.current.y,0).applyEuler(new cn(0,0,-ht.current,"ZXY"));const Pr=ge.current,so=new ue().fromArray(Pr.normal);let zo,Ci;ye.isSame(so,b1)?(zo=t.lz,Ci=t.ly,Bo.x=-bo.z+ut.current.z):ye.isSame(so,S1)?(zo=t.lz,Ci=t.ly,Bo.x=bo.z-ut.current.z):ye.isSame(so,Zc)?(zo=t.lx,Ci=t.lz,Bo.y=-bo.z+ut.current.z):ye.isSame(so,T1)?(zo=t.lx,Ci=t.lz,Bo.y=bo.z-ut.current.z):(zo=t.lx,Ci=t.ly),Bo=H.getState().enableFineGrid?ye.snapToFineGrid(Bo):ye.snapToNormalGrid(Bo),Bo.x/=zo,Bo.y/=Ci,j(Pr.id,Pr.selectedIndex,Bo.x,Bo.y)}break}}ze(!0)}},Zt=An=>{if(Oe.current&&ge.current&&t){if(ge.current.type!==z.SolarPanel)return;const Dn=ge.current;if(Dn.locked)return;q.setFromCamera(ae,oe);const sr=q.intersectObjects([Oe.current]);if(sr.length>0){let Vo=sr[0].point.clone();if(H.getState().moveHandleType)Vo=ye.relativeCoordinates(Vo.x,Vo.y,Vo.z-Dn.poleHeight,t),R(Dn.id,Vo.x,Vo.y,Vo.z),D(ge.current.id,0,0,1),ge.current.parentId!==e&&H.getState().set(Wo=>{const To=Wo.elements.find(Go=>{var No;return Go.id===((No=ge.current)==null?void 0:No.id)&&Go.type===z.SolarPanel});To&&(To.parentId!==e||To.foundationId!==e)&&(To.parentId=e,To.foundationId=e,To.parentType=z.Cuboid,Wo.selectedElement&&(Wo.selectedElement.parentId=e,To.color=Wo.selectedElement.color))});else if(H.getState().rotateHandleType&&H.getState().rotateHandleType!==ai.Tilt){const Wo=ht.current,To=new _t(ut.current.x,ut.current.y),Go=new _t(t.lx*Dn.cx,t.ly*Dn.cy).rotateAround(ui,Wo),No=new _t().addVectors(Go,To),ho=-Wo+Math.atan2(-Vo.x+No.x,Vo.y-No.y)+(H.getState().rotateHandleType===ai.Lower?0:Math.PI),vo=Math.abs(ho)>Math.PI?-Math.sign(ho)*fa:0,bo=ho+vo;N(Dn.id,bo),Le.current=bo}else if(H.getState().resizeHandleType){const Wo=H.getState().resizeAnchor,To=U(Dn.pvModelName),Go=new _t(Vo.x,Vo.y),No=new _t(Wo.x,Wo.y),ho=Go.distanceTo(No),vo=Dn.relativeAzimuth+ht.current,bo=new _t().subVectors(Go,No);switch(H.getState().resizeHandleType){case xt.Lower:case xt.Upper:{const Bo=H.getState().resizeHandleType===xt.Lower?1:-1,Pr=bo.angle()-vo+Bo*$t;let so=ho*Math.cos(Pr);Dn.orientation===br.portrait?so=Math.max(1,Math.ceil((so-To.length/2)/To.length))*To.length:so=Math.max(1,Math.ceil((so-To.width/2)/To.width))*To.width;const zo=Wo.x+Bo*(so*Math.sin(vo))/2,Ci=Wo.y-Bo*(so*Math.cos(vo))/2,ea=new _t(zo,Ci),rs=new _t(ut.current.x,ut.current.y),Da=new _t().subVectors(ea,rs).rotateAround(ui,-ht.current),or=Da.x/r,cr=Da.y/i;qt(Dn,or,cr,Dn.lx,so)&&(T(Dn.id,so),R(Dn.id,or,cr));break}case xt.Left:case xt.Right:{const Bo=H.getState().resizeHandleType===xt.Left?-1:1,Pr=bo.angle()-vo+(H.getState().resizeHandleType===xt.Left?Math.PI:0);let so=ho*Math.cos(Pr);Dn.orientation===br.portrait?so=Math.max(1,Math.ceil((so-To.width/2)/To.width))*To.width:so=Math.max(1,Math.ceil((so-To.length/2)/To.length))*To.length;const zo=Wo.x+Bo*(so*Math.cos(vo))/2,Ci=Wo.y+Bo*(so*Math.sin(vo))/2,ea=new _t(zo,Ci),rs=new _t(ut.current.x,ut.current.y),Da=new _t().subVectors(ea,rs).rotateAround(ui,-ht.current),or=Da.x/r,cr=Da.y/i;qt(Dn,or,cr,so,Dn.ly)&&(b(Dn.id,so),R(Dn.id,or,cr));break}}}}}},Ot=(An,Dn,sr)=>{const Vo=JSON.parse(JSON.stringify(An));return Vo.cx=Dn,Vo.cy=sr,Y(Vo)?(co(B.t("message.MoveCancelledBecauseOfOverlap",Qe)),!1):ye.isIdentical(An.normal,fs)&&!ye.isSolarCollectorWithinHorizontalSurface(Vo,t)?(co(B.t("message.MoveOutsideBoundaryCancelled",Qe)),!1):!0},on=(An,Dn)=>{const sr=JSON.parse(JSON.stringify(An));return sr.relativeAzimuth=Dn,Y(sr)?(co(B.t("message.RotationCancelledBecauseOfOverlap",Qe)),!1):ye.isSolarCollectorWithinHorizontalSurface(sr,t)?!0:(co(B.t("message.RotationOutsideBoundaryCancelled",Qe)),!1)},qt=(An,Dn,sr,Vo,Wo)=>{if(An.tiltAngle!==0&&.5*Wo*Math.abs(Math.sin(An.tiltAngle))>An.poleHeight)return!1;const To=JSON.parse(JSON.stringify(An));return To.cx=Dn,To.cy=sr,To.lx=Vo,To.ly=Wo,!!ye.isSolarCollectorWithinHorizontalSurface(To,t)},rn=()=>{if(!ge.current)return;const An=P(ge.current.id);if(An){if(An.type===z.Polygon){if(H.getState().moveHandleType||H.getState().resizeHandleType){lt.current=An.vertices.map(sr=>({...sr}));const Dn={name:H.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:Ye.current,newValue:lt.current,changedElementId:An.id,changedElementType:An.type,undo:()=>{L(Dn.changedElementId,Dn.oldValue)},redo:()=>{L(Dn.changedElementId,Dn.newValue)}};F(Dn)}}else if(H.getState().resizeHandleType){if(Ne.current.x=An.cx,Ne.current.y=An.cy,Ne.current.z=An.cz,Fe.current.x=An.lx,Fe.current.y=An.ly,Fe.current.z=An.lz,Ne.current.distanceToSquared(Re.current)>Ht&&Fe.current.distanceToSquared(qe.current)>Ht){const Dn={name:"Resize",timestamp:Date.now(),resizedElementId:ge.current.id,resizedElementType:ge.current.type,oldCx:Re.current.x,oldCy:Re.current.y,oldCz:Re.current.z,newCx:Ne.current.x,newCy:Ne.current.y,newCz:Ne.current.z,oldLx:qe.current.x,oldLy:qe.current.y,oldLz:qe.current.z,newLx:Fe.current.x,newLy:Fe.current.y,newLz:Fe.current.z,undo:()=>{R(Dn.resizedElementId,Dn.oldCx,Dn.oldCy,Dn.oldCz),M(Dn.resizedElementId,Dn.oldLx,Dn.oldLy,Dn.oldLz)},redo:()=>{R(Dn.resizedElementId,Dn.newCx,Dn.newCy,Dn.newCz),M(Dn.resizedElementId,Dn.newLx,Dn.newLy,Dn.newLz)}};F(Dn)}}else if(H.getState().rotateHandleType){if(ge.current.type===z.SolarPanel){const Dn=ge.current;if(Math.abs(Le.current-He.current)>Ht)if(on(Dn,Le.current)){w(Vo=>{Vo.selectedElementAngle=Le.current});const sr={name:"Rotate",timestamp:Date.now(),oldValue:He.current,newValue:Le.current,changedElementId:Dn.id,changedElementType:Dn.type,undo:()=>{N(sr.changedElementId,sr.oldValue)},redo:()=>{N(sr.changedElementId,sr.newValue)}};F(sr)}else N(Dn.id,He.current)}}else if(Ne.current.x=An.cx,Ne.current.y=An.cy,Ne.current.z=An.cz,Ue.current.fromArray(An.normal),Ne.current.distanceToSquared(Re.current)>Ht){let Dn=!0;An.type===z.SolarPanel&&(Dn=Ot(An,An.cx,An.cy)),Dn?O0.addUndoableMove():w(sr=>{const Vo=sr.elements.find(No=>No.id===An.id);if(!Vo||!sr.selectedElement)return;const Wo=sr.selectedElement;Vo.cx=Wo.cx,Vo.cy=Wo.cy,Vo.cz=Wo.cz,Vo.rotation=[...Wo.rotation],Vo.normal=[...Wo.normal];const To=dt.getState().oldParentId,Go=dt.getState().oldFoundationId;To&&(Vo.parentId=To),Go&&(Vo.foundationId=Go)})}ge.current=null}},Pn=An=>{An.intersections.length>0&&An.intersections[0].object===se.current&&Ie(!0)},fo=An=>{ge.current&&ye.isPlantOrHuman(ge.current)&&An.intersections[0].object===se.current&&ze(!0)},to=()=>{Ie(!1),ze(!1)},Dt=An=>{k(e,An,er.ContextMenu),w(Dn=>{Dn.pastePoint.copy(An.intersections[0].point);const sr=An.intersections[0].face;sr&&(Dn.pasteNormal=sr.normal.clone(),ye.isSame(sr.normal,b1)?Dn.selectedSideIndex=0:ye.isSame(sr.normal,S1)?Dn.selectedSideIndex=1:ye.isSame(sr.normal,Zc)?Dn.selectedSideIndex=2:ye.isSame(sr.normal,T1)?Dn.selectedSideIndex=3:ye.isSame(sr.normal,Oo)&&(Dn.selectedSideIndex=4)),Dn.clickObjectType=z.Cuboid,An.intersections.length>0&&An.intersections[0].object===se.current&&(Dn.contextMenuObjectType=z.Cuboid)})},{transparent:fn,opacity:kn}=pI(m!==void 0&&m>0,1-(m??0));g.useEffect(()=>{if(se.current)for(let An=0;An<6;An++)se.current.material[An].needsUpdate=!0},[fn]);const yo=[0,1,2,3,4,5],ur=[O&&ce?ce:St,O&&he?he:zt,O&&le?le:yt,O&&te?te:Lt,O&&Z?Z:It,null],lr=t&&t.faceColors?yo.map(An=>f&&f[An]!==Do.NoTexture?O?h.jsx("meshBasicMaterial",{side:$i,attach:`material-${An}`,color:"white",map:ur[An],transparent:fn,opacity:kn},An):h.jsx("meshStandardMaterial",{side:$i,attach:`material-${An}`,color:"white",map:ur[An],transparent:fn,opacity:kn},An):O?h.jsx("meshBasicMaterial",{side:$i,attach:`material-${An}`,color:"white",map:ur[An],transparent:fn,opacity:kn},An):h.jsx("meshStandardMaterial",{side:$i,attach:`material-${An}`,color:t.faceColors?t.faceColors[An]:l,map:ur[An],transparent:fn,opacity:kn},An)):h.jsx("meshStandardMaterial",{side:$i,color:l,transparent:fn,opacity:kn}),xo=g.useMemo(()=>[nt,mt,tt],[nt,mt,tt]),wo=y&&!u,[Rr,Eo]=g.useState(!1);return h.jsxs("group",{ref:Ae,name:"Cuboid Group "+e,children:[h.jsx(di,{castShadow:W,receiveShadow:W,userData:{simulation:!0,stand:!0,stackable:p,id:e,aabb:!0},uuid:e,ref:se,args:[r,i,a],name:"Cuboid "+e,onContextMenu:Dt,onPointerDown:wt,onPointerMove:kt,onPointerUp:rn,onPointerOver:Pn,onPointerOut:to,onPointerEnter:fo,children:lr}),Rr&&h.jsx(yi,{ref:Oe,name:"Intersection Plane",position:gt,args:[r,i],visible:!1,onPointerMove:Zt}),ve&&h.jsxs(h.Fragment,{children:[(H.getState().moveHandleType||H.getState().resizeHandleType)&&h.jsx(C5e,{hx:Te.current.x,hy:Te.current.y,hz:Te.current.z,position:Se,rotation:Ce.current}),H.getState().rotateHandleType&&ge.current&&ge.current.type===z.SolarPanel&&h.jsx(j3e,{element:ge.current,height:ge.current.poleHeight+tt})]}),y&&h.jsx(B3e,{element:t,verticalLift:Xe}),(m||!y||Q)&&h.jsx(o4,{hx:nt,hy:mt,hz:tt,lineColor:m||Q&&C?"white":s,lineWidth:m?c*15:Q&&C?c*5:c}),y&&u&&h.jsx(o4,{hx:nt,hy:mt,hz:tt,lineColor:i0,lineWidth:c*5}),wo&&h.jsx($dn,{id:e,args:xo}),(pe||d)&&!y&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:Ve,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,tt+((t==null?void 0:t.labelHeight)??.2)]})]})},Qdn=xe.memo(qdn),Yot=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="white",lineColor:d="black",lineWidth:f=.1,locked:p=!1,label:m,showLabel:y=!1,parentId:w,foundationId:x,light:C=!0,heatFlux:P=!1}=t,A=H(pn),S=H(xs),v=H(z0),b=Fc(e),{gl:{domElement:T}}=ti(),[R,M]=g.useState(!1),D=g.useRef(null),k=g.useRef(null),N=Kt(),U=H(_=>{for(const G of _.elements)if(G.id===w)return G}),W=H(_=>{for(const G of _.elements)if(G.id===x)return G});let F=n,E=o,L=r;if(w&&U)switch(U.type){case z.Foundation:{if(L=U.cz+U.lz/2,ye.isZero(s[2]))F=U.cx+n*U.lx,E=U.cy+o*U.ly;else{const _=new ue(n*U.lx,o*U.ly,0);_.applyAxisAngle(Oo,s[2]),F=U.cx+_.x,E=U.cy+_.y}break}case z.Wall:{if((W==null?void 0:W.type)===z.Foundation){const _=ye.absoluteCoordinates(n,o,r,U,W);F=_.x,E=_.y,L=_.z}break}case z.Roof:{if((W==null?void 0:W.type)===z.Foundation){const _=ye.absoluteCoordinates(n*W.lx,o*W.ly,r+W.cz,U,W);F=_.x,E=_.y,L=_.z+l/2}break}}const j=l/2,Y=g.useMemo(()=>{if((U==null?void 0:U.type)===z.Wall){const G=U,Q=W?W.rotation[2]+G.relativeAngle:G.relativeAngle;return new cn($t,0,Q,"ZXY")}if((U==null?void 0:U.type)===z.Roof)return new cn(s[0],s[1],W?W.rotation[2]+s[2]:s[2],"ZXY");if((U==null?void 0:U.type)===z.Cuboid)return Ii.getRotationFromNormal(c);const _=new ue().fromArray(c);return ye.isSame(_,b1)?new cn(0,$t,s[2],"ZXY"):ye.isSame(_,S1)?new cn(0,-$t,s[2],"ZXY"):ye.isSame(_,Zc)?new cn(-$t,0,s[2],"ZXY"):ye.isSame(_,T1)?new cn($t,0,s[2],"ZXY"):new cn(0,0,s[2])},[c,s,W==null?void 0:W.rotation]),O=g.useMemo(()=>(m||B.t("shared.SensorElement",N))+(p?" ("+B.t("shared.ElementLocked",N)+")":"")+` -`+B.t("word.Coordinates",N)+": ("+F.toFixed(1)+", "+E.toFixed(1)+", "+L.toFixed(1)+") "+B.t("word.MeterAbbreviation",N),[m,p,N,F,E,L]);return h.jsxs("group",{name:"Sensor Group "+e,rotation:Y,position:[F,E,L+j],children:[h.jsx(di,{receiveShadow:S,uuid:e,ref:D,args:[i,a,l],name:"Sensor",onPointerDown:_=>{_.button!==2&&(v(e,_,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=w,G.oldParentId=w,G.oldFoundationId=x}),A(G=>{G.moveHandleType=Ho.Default}))},onContextMenu:_=>{v(e,_,er.ContextMenu),A(G=>{_.intersections.length>0&&_.intersections[0].object===D.current&&(G.contextMenuObjectType=z.Sensor)})},onPointerOver:_=>{_.intersections.length>0&&_.intersections[0].object===D.current&&(M(!0),T.style.cursor="move")},onPointerOut:()=>{M(!1),T.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:t!=null&&t.lit?Aa:u})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Meter",castShadow:!1,receiveShadow:!1,args:[i*.3,a*.3,j,8,1],position:new ue(0,0,j),rotation:[$t,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:"black"})}),!b&&h.jsx(o4,{hx:i/2,hy:a/2,hz:l/2,lineColor:d,lineWidth:f}),b&&p&&h.jsx(o4,{hx:i/2,hy:a/2,hz:l/2,lineColor:i0,lineWidth:f*10}),b&&!p&&h.jsx(Ys,{ref:k,position:new ue(0,0,0),args:[Tm,6,6,0,Math.PI],name:Ho.Default,onPointerDown:_=>{_.button===2?(v(e,_,er.ContextMenu),A(G=>{_.intersections.length>0&&_.intersections[0].object===k.current&&(G.contextMenuObjectType=z.Sensor)})):v(e,_,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=w,G.oldParentId=w,G.oldFoundationId=x}),A(G=>{G.moveHandleType=Ho.Default})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(R||y)&&!b&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:O,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l+((t==null?void 0:t.labelHeight)??.2)]})]})}),Oot=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="#ffff99",lineWidth:d=.1,locked:f=!1,label:p,showLabel:m=!1,parentId:y,foundationId:w,decay:x=2,distance:C=5,intensity:P=3,inside:A=!1}=t,S=H(pn),v=H(xs),b=H(z0),R=H(I7).z<=0,M=Fc(e),{gl:{domElement:D}}=ti(),[k,N]=g.useState(!1),U=g.useRef(null),W=g.useRef(null),F=Kt(),E=H(ee=>{for(const q of ee.elements)if(q.id===y)return q}),L=H(ee=>{for(const q of ee.elements)if(q.id===w)return q});let j=.1,Y=n,O=o,_=r;if(y&&E)switch(E.type){case z.Foundation:if(_=E.cz+E.lz/2,ye.isZero(s[2]))Y=E.cx+n*E.lx,O=E.cy+o*E.ly;else{const ee=new ue(n*E.lx,o*E.ly,0);ee.applyAxisAngle(Oo,s[2]),Y=E.cx+ee.x,O=E.cy+ee.y}break;case z.Wall:if((L==null?void 0:L.type)===z.Foundation){const ee=ye.absoluteCoordinates(n,o,r,E,L);Y=ee.x,O=ee.y,_=ee.z}j=E.ly;break;case z.Roof:if((L==null?void 0:L.type)===z.Foundation){const ee=ye.absoluteCoordinates(n*L.lx,o*L.ly,r+L.cz,E,L);Y=ee.x,O=ee.y,_=ee.z+l/2}j=E.thickness;break}const G=l/2,Q=g.useMemo(()=>{if((E==null?void 0:E.type)===z.Wall){const q=E,ae=L?L.rotation[2]+q.relativeAngle:q.relativeAngle;return new cn($t,0,ae,"ZXY")}if((E==null?void 0:E.type)===z.Roof)return new cn(s[0],s[1],L?L.rotation[2]+s[2]:s[2],"ZXY");if((E==null?void 0:E.type)===z.Cuboid)return Ii.getRotationFromNormal(c);const ee=new ue().fromArray(c);return ye.isSame(ee,b1)?new cn(0,$t,s[2],"ZXY"):ye.isSame(ee,S1)?new cn(0,-$t,s[2],"ZXY"):ye.isSame(ee,Zc)?new cn(-$t,0,s[2],"ZXY"):ye.isSame(ee,T1)?new cn($t,0,s[2],"ZXY"):new cn(0,0,s[2])},[c,s,L,E]),oe=g.useMemo(()=>(p||B.t("shared.LightElement",F))+(f?" ("+B.t("shared.ElementLocked",F)+")":"")+` -`+B.t("word.Coordinates",F)+": ("+Y.toFixed(1)+", "+O.toFixed(1)+", "+_.toFixed(1)+") "+B.t("word.MeterAbbreviation",F),[p,f,F,Y,O,_]);return h.jsxs("group",{name:"Light Group "+e,rotation:Q,position:[Y,O,_],children:[R&&h.jsx("pointLight",{color:u,name:"Point Light "+e,position:[0,0,A?-j-G:G],decay:x*.2,distance:C,intensity:P,castShadow:!0}),h.jsx(wa,{receiveShadow:v,userData:{unintersectable:!0},uuid:e,ref:U,position:[0,0,A?-j:0],rotation:[$t,0,0],args:[i*.5,a*.5,G,16,1],name:"Light Base",onPointerDown:ee=>{ee.button!==2&&(b(e,ee,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(q=>{q.showWallIntersectionPlaneId=y,q.oldParentId=y,q.oldFoundationId=w}))},onContextMenu:ee=>{b(e,ee,er.ContextMenu),S(q=>{ee.intersections.length>0&&ee.intersections[0].object===U.current&&(q.contextMenuObjectType=z.Light)})},onPointerOver:ee=>{ee.intersections.length>0&&ee.intersections[0].object===U.current&&(N(!0),D.style.cursor="move")},onPointerOut:()=>{N(!1),D.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:"lightgray"})}),h.jsx(Ys,{userData:{unintersectable:!0},name:"Light Bulb",castShadow:!1,receiveShadow:v,args:[i*.3,8,8,0,fa,0,Math.PI],position:new ue(0,0,A?-j-G:G),rotation:[$t,0,0],children:R?h.jsx("meshBasicMaterial",{attach:"material",color:"white"}):h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),M&&f&&h.jsx(o4,{hx:i/2,hy:a/2,hz:l/2,lineColor:i0,lineWidth:d*10}),M&&!f&&h.jsx(Ys,{ref:W,position:new ue(0,0,A?-j-G:G),args:[Tm,6,6,A?Math.PI:0,Math.PI],name:Ho.Default,onPointerDown:ee=>{ee.button===2?(b(e,ee,er.ContextMenu),S(q=>{ee.intersections.length>0&&ee.intersections[0].object===W.current&&(q.contextMenuObjectType=z.Light)})):b(e,ee,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(q=>{q.showWallIntersectionPlaneId=y,q.oldParentId=y,q.oldFoundationId=w})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(k||m)&&!M&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:oe,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(A?-j:0)+l+((t==null?void 0:t.labelHeight)??.2)]})]})}),Vv="Cuboid Wrapper",_ot="Cuboid Stackable Child",Vot=({elements:t,cuboidModel:e})=>{const{id:n,cx:o,cy:r,lx:i,ly:a,lz:l,rotation:s}=e,c=l/2,u=d=>Bot(d)&&d.parentId===n;return h.jsxs("group",{name:Vv,position:[o,r,c],rotation:[0,0,s[2]],userData:{id:n,fId:n},children:[h.jsx(Qdn,{...e}),h.jsx(V3e,{parentId:n,foundationId:n,wrapperType:z.Cuboid,plx:i,ply:a,plz:l}),t.map(d=>{if(u(d))return h.jsx("group",{name:_ot,position:[0,0,c],children:h.jsx(Vot,{elements:t,cuboidModel:d})},d.id);if(d.parentId===n){const{lx:f,ly:p,lz:m}=e;switch(d.type){case z.Sensor:return h.jsx(Yot,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*m},d.id);case z.Light:return h.jsx(Oot,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*m},d.id);default:return null}}else return null})]})},lR=t=>{const[e,n]=g.useState(t);return g.useEffect(()=>{t!==e&&n(t)},[t]),[e,n]},ote=(t,e)=>{const{gl:n}=ti(),[o,r]=g.useState(t),i=g.useRef(!1),a=g.useRef(!1);return g.useEffect(()=>{const u=()=>{i.current&&(i.current=!1,a.current||(r(t),n.domElement.style.cursor="default"))};return window.addEventListener("pointerup",u),()=>window.removeEventListener("pointerup",u)},[]),{_color:o,_onPointerDown:()=>{i.current=!0,setTimeout(()=>{n.domElement.style.cursor=e},10)},_onPointerMove:u=>{u.intersections.length==0||u.intersections[0].object!==u.object?(a.current=!1,r(t),n.domElement.style.cursor="default"):(a.current=!0,r(Aa),n.domElement.style.cursor=e)},_onPointerLeave:()=>{a.current=!1,i.current||(r(t),n.domElement.style.cursor="default")}}},Got=(t,e)=>{const[n,o]=g.useState(t),[r,i]=g.useState(e);return g.useEffect(()=>{o(t),i(e)},[t,e]),{materialLx:n,materialLy:r,setMaterialSize:(l,s)=>{l===Fr.ResizeX?s!==n&&o(Math.abs(s)):s!==r&&i(Math.abs(s))}}},Xot=t=>{const e=dt(vs),n=H(Df),[o,r]=g.useState(null);return g.useEffect(()=>{if(e){const i=In.getState().getHeatmap(t);i&&r(ye.fetchHeatmapTexture(i,n??5))}},[e,n]),o},Zdn=(t,e,n,o,r,i)=>{const a=r??((n==null?void 0:n.color)==="Black"&&(n==null?void 0:n.cellType)==="Monocrystalline"?"silver":"white"),l=i??"gray",s=g.useMemo(()=>{if(!n)return null;const{cellType:d,length:f,width:p,m,n:y,color:w}=n;return o===br.portrait?iMe(d,p,f,y,m,w,a,l):iMe(d,f,p,m,y,w,a,l)},[n,o,a,l]),[c,u]=g.useState(s);return g.useEffect(()=>{if(s&&n){const{length:d,width:f}=n,p=Math.max(1,Math.round(t/(o===br.landscape?d:f))),m=Math.max(1,Math.round(e/(o===br.landscape?f:d)));s.repeat.set(p,m),s.wrapS=s.wrapT=es,u(s.clone())}},[s,t,e]),c},iMe=(t,e,n,o,r,i,a,l)=>{e*=lbe,n*=lbe;const s=document.createElement("canvas");[s.width,s.height]=[e,n];const c=s.getContext("2d");if(c){c.fillStyle=a,c.fillRect(0,0,e,n);const u=Math.max(e,n)*Fvt;if(c.fillStyle=l,c.fillRect(u,u,e-2*u,n-2*u),c.fillStyle=i==="Black"?Wvt:Nvt,t==="Thin Film"){const d=u*.6;c.fillRect(d,d,e-d*2,n-d*2)}else{const d=Math.max(e,n)*Lvt,f=u+d,p=(e-f*2-d*(o-1))/o,m=(n-f*2-d*(r-1))/r,y=p*.1,w=m*.1;if(t==="Monocrystalline")for(let x=0;x{const o=l2(),{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=ote(ll,"grab"),s=c=>{n(c),i()};return h.jsxs("group",{name:e,position:[0,t,0],rotation:[$t,0,0],scale:o*3,onPointerDown:s,onPointerMove:a,onPointerLeave:l,children:[h.jsx(O2e,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[$t,0,$t],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(Rf,{args:[.1,.1,6],rotation:[$t,0,0],position:[.15,0,.05],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(fH,{args:[.05,6],rotation:[0,$t,0],position:[0,0,.15],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(yi,{args:[.35,.35],position:[0,.05,0],rotation:[-$t,0,0],visible:!1})]})}),efn=xe.memo(g.forwardRef(({tiltAngle:t,positionZ:e,isOnVerticalSurface:n,onPointerDown:o,onPointerMove:r},i)=>{const a=l2()*3,l=Math.PI/12,s=g.useMemo(()=>n?$t:Math.PI,[n]),c=g.useMemo(()=>n?new Array(7).fill(0):new Array(13).fill(0),[n]),u=g.useMemo(()=>n?e:0,[n,e]),[d,f]=g.useState(!1),p=g.useRef(null),m=g.useRef(null),y=g.useRef(null),{_color:w,_onPointerDown:x,_onPointerMove:C,_onPointerLeave:P}=ote(ll,"grab");g.useImperativeHandle(i,()=>({setVisiable(b){p.current&&(p.current.visible=b)},update(b,T){m.current&&m.current.rotation.set(b,0,0),y.current&&(y.current.text=A(b)),p.current&&(p.current.position.z=T)}}),[]);const A=b=>{const T=n?-b:b;return`${Math.floor(T/Math.PI*180)}°`},S=b=>{f(!0),o(b),x()},v=b=>{r(b)};return g.useEffect(()=>{const b=()=>{f(!1)};return window.addEventListener("pointerup",b),()=>window.addEventListener("pointerup",b)},[]),h.jsxs("group",{name:"Tilt_Handle_Group",ref:p,position:[0,0,u],children:[h.jsx(FX,{name:ai.Tilt,args:[a,1.125*a,18,2,0,s],rotation:[$t,0,$t,"ZXY"],onPointerDown:S,onPointerMove:C,onPointerLeave:P,children:h.jsx("meshBasicMaterial",{side:zr,color:w})}),d&&h.jsxs(h.Fragment,{children:[h.jsx(FX,{name:"Tilt_Handle_Intersection_Plane",args:[a,2*a,18,2,0,s],rotation:[$t,0,$t,"ZXY"],onPointerMove:v,children:h.jsx("meshBasicMaterial",{transparent:!0,depthTest:!1,opacity:.5,side:zr})}),h.jsx("group",{rotation:[-$t,0,0],children:c.map((b,T)=>{const R=n?`${90-T*15}°`:`${T*15-90}°`;return h.jsxs("group",{rotation:[l*T,0,0,"ZXY"],children:[h.jsx(On,{points:[[0,0,1.8*a],[0,0,2*a]],color:"white",transparent:!0,opacity:.5}),h.jsx("textSprite",{userData:{unintersectable:!0},text:R,fontSize:20*a,fontFace:"Times Roman",textHeight:.15*a,position:[0,0,1.6*a]})]},T)})}),h.jsxs("group",{ref:m,rotation:[t,0,0],children:[h.jsx(On,{points:[[0,0,a],[0,0,1.75*a]]}),h.jsx("textSprite",{ref:y,userData:{unintersectable:!0},text:A(t),fontSize:20*a,fontFace:"Times Roman",textHeight:.2*a,position:[0,0,.75*a]})]})]})]})})),tfn=xe.memo(()=>h.jsxs("group",{name:"Normal Pointer Group",children:[h.jsx(On,{points:[[0,0,0],[0,0,1]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),h.jsx(Rf,{position:[0,0,1],rotation:[$t,0,0],userData:{unintersectable:!0},args:[.04,.2,4,2],children:h.jsx("meshBasicMaterial",{color:"white"})})]})),nfn=xe.memo(xe.forwardRef(({positionZ:t,rotationX:e,topTiltGroupRef:n},o)=>{const r=H(Ky),i=H(ml),a=H(tu),l=g.useMemo(()=>Math.max(100,10*r),[r]),s=g.useMemo(()=>zi(new Date(i),a),[i,a]),c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),[f,p]=g.useState(null),[m,y]=g.useState(null),[w,x]=g.useState(new ue),[C,P]=g.useState(!1),A=M=>{M?C||P(!0):C&&P(!1)},S=M=>!(s.z<0||M<0||M>90),v=()=>n.current?n.current.getWorldDirection(ra).angleTo(s)/Math.PI*180:-1,b=M=>M.toFixed(1)+"°",T=()=>{if(!n.current||!c.current)return null;const M=Xc.setFromQuaternion(c.current.getWorldQuaternion(m0)).z;Xc.set(0,0,-M);const D=c.current.getWorldPosition(MJ),k=n.current.localToWorld(ra.set(0,0,.5)).sub(D).applyEuler(Xc),N=u.current.localToWorld(gh.set(0,0,.5)).sub(D).applyEuler(Xc);return[k.clone(),N.clone()]},R=M=>{if(!f||f.length!==2||!M||M.length!==2)return!1;const[D,k]=M,[N,U]=f;return ye.isSame(D,N)&&ye.isSame(k,U)};return g.useImperativeHandle(o,()=>({setPositionZ(M){c.current&&(c.current.position.z=M)},setRotationX(M){c.current&&(c.current.rotation.x=M)}}),[]),g.useEffect(()=>{if(!n.current)return;const M=v();if(S(M))A(!0);else{A(!1);return}y(b(M));const k=T();if(p(k),k&&k.length===2){const[N,U]=k,W=new ue().addVectors(N,U).divideScalar(2).multiplyScalar(1.5);x(W)}},[]),Gp(()=>{if(!n.current)return;const M=v();if(S(M))A(!0);else{A(!1);return}u.current&&u.current.lookAt(u.current.getWorldPosition(ra).add(s));const k=T();if(R(k)||p(k),d.current&&(k==null?void 0:k.length)===2){const[N,U]=k;d.current.position.addVectors(N,U).divideScalar(2).multiplyScalar(1.5),d.current.text=b(M)}}),C?h.jsxs("group",{ref:c,position:[0,0,t],rotation:[e,0,0],children:[h.jsx(On,{name:"Sun Beam",ref:u,points:[[0,0,0],[0,0,l]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),f&&w&&m&&h.jsxs(h.Fragment,{children:[h.jsx(On,{name:"Angle Line",points:f,userData:{unintersectable:!0},lineWidth:1,color:"white"}),h.jsx("textSprite",{ref:d,position:w,text:m,userData:{unintersectable:!0},fontSize:20,fontFace:"Times Roman",textHeight:.1})]})]}):null})),ofn=xe.memo(g.forwardRef(({tiltAngle:t,trackerType:e,surfaceType:n,children:o},r)=>{const i=g.useRef(null),a=H(ml),l=H(tu),s=g.useRef(new ue),c=g.useMemo(()=>{const f=zi(new Date(a),l);return s.current.copy(f),f},[a,l]),u=()=>{i.current&&i.current.rotation.set(0,0,0)},d=(f,p)=>{if(i.current)switch(f){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{i.current.rotation.set(Math.atan2(Math.hypot(s.current.x,s.current.y),s.current.z),0,Math.atan2(s.current.y,s.current.x)+$t-p,"ZXY");break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{i.current.rotation.set(t,0,Math.atan2(s.current.y,s.current.x)+$t-p,"ZXY");break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const m=new ue().copy(s.current).applyEuler(Xc.set(0,0,-p));i.current.rotation.set(0,Math.atan2(m.x,m.z),0,"ZXY");break}}};return g.useImperativeHandle(r,()=>({reset(){u()},update(f,p){d(f,p)}}),[]),g.useEffect(()=>{if(!i.current)return;if(e===Bl.NO_TRACKER||n!==qa.Horizontal){u();return}const f=Ii.findParentGroup(i.current,[Mp,Vv]);f&&d(e,Xc.setFromQuaternion(f.getWorldQuaternion(m0)).z)},[c,e,n]),h.jsx("group",{ref:i,children:o})})),rfn=({solarPanel:t,lx:e,ly:n})=>{const{id:o,tiltAngle:r,pvModelName:i,orientation:a,color:l}=t,s=dt(vs),c=H(M0)??!1,u=H(_2e),d=H(jM),f=H(BM),m=g.useMemo(()=>({...f,...d}),[d,f])[i],y=Zdn(e,n,m,a,t.frameColor,t.backsheetColor),w=Xot(o),x=()=>s&&w?h.jsx("meshBasicMaterial",{attach:"material-4",map:w}):y?c||u===0?h.jsx("meshStandardMaterial",{attach:"material-4",map:y,color:l}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new ir((m==null?void 0:m.color)==="Blue"?ibe:EX),shininess:u??K8,side:$i,map:y,color:l}):null,C=()=>(m==null?void 0:m.bifacialityFactor)===0||c?h.jsx("meshStandardMaterial",{attach:"material-5",color:l}):y?h.jsx("meshPhongMaterial",{attach:"material-5",specular:new ir((m==null?void 0:m.color)==="Blue"?ibe:EX),shininess:u??K8,side:$i,map:y,color:l}):null;return h.jsxs(h.Fragment,{children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:l}),h.jsx("meshStandardMaterial",{attach:"material-1",color:l}),h.jsx("meshStandardMaterial",{attach:"material-2",color:l}),h.jsx("meshStandardMaterial",{attach:"material-3",color:l}),x(),C()]})},ifn=xe.memo(g.forwardRef(({lx:t,ly:e,poleRadius:n,poleHeight:o,poleSpacing:r,tiltAngle:i,color:a,visiable:l},s)=>{const c=H(A=>A.elements.length>100?2:4),[u,d]=lR(t),[f,p]=lR(e),[m,y]=lR(i),[w,x]=lR(l),C=g.useRef(null);g.useImperativeHandle(s,()=>({update({lx:A,ly:S,tilt:v}){A!==void 0&&d(A),S!==void 0&&p(S),v!==void 0&&y(v)},setVisiable(A){x(A)}}),[]);const P=g.useMemo(()=>{const A=[],S=Math.floor(.5*u/r),v=Math.floor(.5*f*Math.abs(Math.cos(m))/r),b=Math.tan(m);for(let T=-S;T<=S;T++)for(let R=-v;R<=v;R++){const M=T*r,D=R*r,k=b*D+o,N=(k-o)/2;A.push(new Ba(M,D,N,k))}return A},[u,f,m,r,o]);return w?h.jsx("group",{name:"Poles group",ref:C,position:[0,0,-o/2],children:P.map((A,S)=>A.w<0?null:h.jsx(wa,{userData:{unintersectable:!0},name:"Pole "+S,args:[n,n,A.w,c,1],position:[A.x,A.y,A.z],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{color:a})},S))}):null})),afn=xe.memo(({hlx:t,hly:e})=>h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-t,-e,0],[-t,e,0],[t,e,0],[t,-e,0],[-t,-e,0]],lineWidth:3,color:i0})),lfn=xe.memo(({solarPanel:t,boxRef:e})=>{const{ly:n,tiltAngle:o,label:r,locked:i,labelColor:a="white",labelFontSize:l=20,labelSize:s=.2,labelHeight:c}=t,u=n/2,d=Kt(),[f,p]=g.useState("");g.useEffect(()=>{if(!e.current)return;const{x:y,y:w,z:x}=e.current.getWorldPosition(ra);p((r||B.t("shared.SolarPanelElement",d))+(i?" ("+B.t("shared.ElementLocked",d)+")":"")+(r?"":` -`+B.t("word.Coordinates",d)+": ("+y.toFixed(1)+", "+w.toFixed(1)+", "+x.toFixed(1)+") "+B.t("word.MeterAbbreviation",d)))},[r,i,d]);const m=c??Math.max(u*Math.abs(Math.sin(o))+.1,.2);return h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:f,color:a,fontSize:l,textHeight:s,position:[0,0,m]})}),Jot=xe.memo(({onPointerDown:t})=>{const{_color:e,_onPointerDown:n,_onPointerMove:o,_onPointerLeave:r}=ote(q8,"move"),i=l2()*.75,{gl:a}=ti();return h.jsx(Ys,{name:"Move_Handle",args:[i],onPointerDown:l=>{t(l),n(),a.domElement.style.cursor="move"},onPointerMove:o,onPointerLeave:r,children:h.jsx("meshBasicMaterial",{color:e})})}),Gv=xe.memo(({cx:t,cy:e,size:n,type:o})=>{const{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=ote(ll,"pointer");return h.jsx(di,{name:o,position:[t,e,.1],args:[n,n,.1],onPointerDown:i,onPointerMove:a,onPointerLeave:l,children:h.jsx("meshBasicMaterial",{color:r})})}),sfn=xe.memo(g.forwardRef(({hlx:t,hly:e,onPointerDown:n},o)=>{const r=l2();return h.jsxs("group",{name:"Resize_Handles_Group",ref:o,onPointerDown:n,children:[h.jsx(Gv,{type:xt.Left,cx:-t,cy:0,size:r}),h.jsx(Gv,{type:xt.Right,cx:t,cy:0,size:r}),h.jsx(Gv,{type:xt.Lower,cx:0,cy:-e,size:r}),h.jsx(Gv,{type:xt.Upper,cx:0,cy:e,size:r})]})})),cfn=xe.memo(({children:t,onPointerOut:e,onPointerOver:n})=>{const o=H(xs);return h.jsx(di,{name:"Box_Mesh",receiveShadow:o,castShadow:o,onPointerOver:n,onPointerOut:e,children:t})}),ufn=({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>{const a=[],[l,s,c]=[t/2,e/2,n/2];let u,d;o===br.portrait?(u=Math.max(1,Math.round(t/i)),d=Math.max(1,Math.round(e/r))):(u=Math.max(1,Math.round(t/r)),d=Math.max(1,Math.round(e/i)));const f=t/u,p=e/d;for(let m=0;m<=u;m++)a.push({points:[new ue(-l+m*f,-s,c),new ue(-l+m*f,s,c)]});for(let m=0;m<=d;m++)a.push({points:[new ue(-l,-s+m*p,c),new ue(l,-s+m*p,c)]});return h.jsx("group",{name:"Solar Panel Heatmap Lines Group",position:[0,0,.005],children:a.map((m,y)=>h.jsx(On,{name:"Solar Panel Lines",userData:{unintersectable:!0},points:m.points,lineWidth:.2},y))})},dfn=xe.memo(({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>dt(vs)?h.jsx(ufn,{lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i}):null),_3e=xe.memo(g.forwardRef(({lx:t,ly:e,relativeAzimuth:n},o)=>{const r=Math.max(5,Math.hypot(t,e)*.75),i=g.useMemo(()=>new Array(25).fill(0),[]),a=B5(NM,gI),l=r*.05,s={font:a,height:0,size:l},c=f=>f===0?-l*.3:f>0&&f<7?-l*.8:-l*1.2,[u,d]=g.useState(n);return g.useImperativeHandle(o,()=>({setAzimuth:f=>{f<-Math.PI?d(f+Math.PI*2):f>Math.PI?d(f-Math.PI*2):d(f)}})),h.jsxs("group",{rotation:[$t,0,0],position:[0,0,.1],name:"Solar Panel Polar Grid Group",children:[h.jsx("polarGridHelper",{args:[r,24,6,120,"white","white"],userData:{unintersectable:!0}}),h.jsx(FX,{args:[r*.98,r,24,1,$t,u],userData:{unintersectable:!0},rotation:[-$t,0,0],children:h.jsx("meshBasicMaterial",{side:zr,color:"yellow"})}),h.jsx("group",{rotation:[0,u,0],children:h.jsx("mesh",{position:[-.5,0,-r*.9],rotation:[-$t,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-ye.toDegrees(u).toFixed(1)}°`,s]})})}),i.map((f,p)=>{let m=Math.ceil(p/2)*(p%2===0?1:-1);m===-12&&(m=12);const y=c(Math.abs(m));return h.jsx("group",{rotation:[0,m*Math.PI/12,0],children:h.jsxs("mesh",{position:[y,0,-r*1.05],rotation:[-$t,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*m}°`,s]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},p)})]})})),ffn=xe.memo(g.forwardRef(({lx:t,ly:e,tiltAngle:n,modelLength:o,visiable:r},i)=>{const a=H(xs),l=.75,s=(A,S)=>{const v=S*l,b=Math.cos(A),T=A/2,R=v*Math.sin(T)*2,M=T;return{cz:(v-S/2)*b+R*Math.sin(M),mountAngle:M,length:R}},{cz:c,mountAngle:u,length:d}=g.useMemo(()=>s(n,e),[n,e]),[f,p]=lR(t),[m,y]=lR(r),w=g.useMemo(()=>{const A=[];let v=Math.round(f/o)%2===0?o/2:0;for(;v({update(A,S){if(x.current&&C.current&&P.current){const{cz:v,mountAngle:b,length:T}=s(-A,S);x.current.position.y=-v,C.current.rotation.x=-b,P.current.position.z=T/2,P.current.scale.z=T-.025}},resizeX(A){p(A)},setVisiable(A){y(A)}}));const x=g.useRef(null),C=g.useRef(null),P=g.useRef(null);return m?h.jsx("group",{ref:x,position:[0,-c,0],castShadow:a,receiveShadow:a,children:h.jsx("group",{ref:C,rotation:[-u,0,0],children:h.jsx("group",{ref:P,position:[0,0,d/2],scale:[1,1,d-.025],children:w.map((A,S)=>h.jsx(di,{position:[A,0,0],args:[.05,.05,1],children:h.jsx("meshStandardMaterial",{color:"#BFBFBF"})},S))})})}):null})),hfn="Intersection Plane XY",k_=1,aMe=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,rotation:l,normal:s,relativeAzimuth:c,tiltAngle:u,parentType:d,drawSunBeam:f,trackerType:p=Bl.NO_TRACKER,pvModelName:m="SPR-X21-335-BLK",orientation:y=br.landscape,poleHeight:w,poleRadius:x,poleSpacing:C,color:P="white",locked:A}=t,S=g.useMemo(()=>Ii.getPVModel(m),[m]),v=Math.max(S.thickness,.02),[b,T,R]=[i/2,a/2,v/2],M=Fc(e),{materialLx:D,materialLy:k,setMaterialSize:N}=Got(i,a),{set:U,get:W,raycaster:F}=ti(),E=H(pn),L=H(vQ),[j,Y]=g.useState(!1),[O,_]=g.useState(!1),[G,Q]=g.useState(!1),oe=g.useRef(null),ee=g.useRef(null),q=g.useRef(null),ae=g.useRef(null),Z=g.useRef(null),ne=g.useRef(null),te=g.useRef(null),$=g.useRef(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(null),ce=g.useRef(null),Pe=g.useRef(null),pe=g.useRef(new ue),Ie=g.useRef(new ue),ve=g.useRef(null),ze=g.useRef(null),Ae=g.useRef(null),se=g.useRef(null),ge=g.useRef(null),we=g.useMemo(()=>Ii.getSurfaceType(d,new ue().fromArray(s)),[d,s]),Se=g.useMemo(()=>Ii.isTrackerEnabled(we,p),[we,p]),Me=g.useMemo(()=>-T*Math.sin(Math.min(0,u)),[u,T]),Ce=g.useMemo(()=>{switch(we){case qa.Horizontal:return R+w;case qa.Vertical:return R+Me;case qa.Inclined:return R}return R},[w,R,we,Me]),Te=g.useMemo(()=>M&&!A,[M,A]),Re=g.useMemo(()=>M&&we===qa.Horizontal&&!Se&&!A,[M,we,Se,A]),Ne=g.useMemo(()=>!M||Se||A?!1:we===qa.Vertical||we===qa.Horizontal&&w>0,[M,we,w,Se,A]),_e=g.useMemo(()=>w>0&&we===qa.Horizontal,[w,we]),Ue=g.useMemo(()=>we===qa.Vertical,[we]),qe=Ct=>{U({frameloop:Ct})},Fe=()=>{if(!Z.current)return;const[Ct,yt]=Z.current.scale.toArray().map(at=>at/2);if(ne.current)for(const at of ne.current.children)switch(at.name){case xt.Left:{at.position.x=-Ct;break}case xt.Right:{at.position.x=Ct;break}case xt.Upper:{at.position.y=yt;break}case xt.Lower:{at.position.y=-yt;break}}if(te.current)for(const at of te.current.children)switch(at.name){case ai.Lower:{at.position.y=-yt-k_;break}case ai.Upper:{at.position.y=yt+k_;break}}},He=Ct=>{if(!Ct)return;const[yt,at,Et]=Ii.getRotationOnCuboid(Ct);Le(yt,at,Et),ye.isEqual(Ct.z,1)?Pe.current!==null?q.current.rotation.z=Pe.current-Xc.z:q.current.rotation.z=c:q.current.rotation.set(0,0,0)},Le=(Ct,yt,at)=>{oe.current&&oe.current.rotation.set(Ct,yt,at,"ZXY"),le.current&&le.current.setRotationX(-Ct)},Ye=Ct=>{q.current&&(q.current.position.z=Ct),le.current&&le.current.setPositionZ(Ct)},lt=(Ct,yt)=>{ae.current&&(ae.current.rotation.x=Ct),$.current&&$.current.update(Ct,yt),de.current&&de.current.update({tilt:Ct}),ce.current&&ce.current.update(Ct,a)},Oe=(Ct,yt)=>{const at=jn.getState().solarPanelCountRef;at&&at.current&&(at.current.textContent=`${Ii.getRackCount(y,Ct,yt,S.length,S.width)}`)},ut=Ct=>{me.current&&me.current.setAzimuth(Ct)},ht=Ct=>{ce.current&&ce.current.resizeX(Math.abs(Ct))},Qe=Ct=>{ce.current&&ce.current.update(u,Math.abs(Ct))},nt=(Ct,yt,at)=>{switch(at){case Fr.Move:{const Et=Ct.intersectObjects(yt.children);for(const Lt of Et){if(Lt.object.name===VL){const Je=Lt.object.parent;return Je?{intersection:Lt,parentGroup:Je,parentType:z.Foundation}:null}if(Lt.object.name.includes(O0.WALL_OUTSIDE_SURFACE_MESH_NAME)){const Je=Lt.object.parent;return Je?{intersection:Lt,parentGroup:Je,parentType:z.Wall}:null}if(Lt.object.name.includes("Roof")){const Je=Ii.findParentGroup(Lt.object,[VL]);return Je?{intersection:Lt,parentGroup:Je,parentType:z.Roof}:null}if(Lt.object.name.includes("Cuboid")){const Je=Ii.findParentGroup(Lt.object,[Vv]);return Je?{intersection:Lt,parentGroup:Je,parentType:z.Cuboid}:null}}break}case Fr.ResizeX:case Fr.ResizeY:case Fr.RotateLower:case Fr.RotateUpper:{if(!O||!he.current||!ge.current)return null;const Et=Ct.intersectObjects([he.current]),Lt=Et[0];return!Lt||ye.isEqual(Lt.point.z,0)?null:{intersection:Et[0],parentGroup:ge.current,parentType:d}}}return null},mt=(Ct,yt)=>{const{length:at,width:Et}=Ii.getUnitSize(y,S.length,S.width);return Ct===Fr.ResizeX?(yt-at&&(yt=at),Math.round(yt/at)*at):Ct===Fr.ResizeY?(yt-Et&&(yt=Et),Math.round(yt/Et)*Et):yt},tt=(Ct,yt)=>{if(yt===Fr.ResizeX)return Ct;{const at=Math.abs(2*w/Math.sin(u));return ye.clamp(Ct,-at,at)}},gt=(Ct,yt,at,Et)=>{var Je;const Lt=yt.children.find(st=>st.name===Npe);if(Lt&&Ct&&Lt!==Ct){Ct.children=Ct.children.filter(It=>It!==oe.current),Lt.children.push(oe.current),oe.current.parent=Lt;const st=(Je=Lt.parent)==null?void 0:Je.userData;if(st&&st.id&&st.fId&&(ve.current=st.id,ze.current=st.fId),at===z.Roof){const It=Ii.getRoofId(Et);It&&(ve.current=It)}}Ae.current=at},Ve=Ct=>{Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object||(Ct.stopPropagation(),Ct.button===2?(H.getState().selectedElementIdSet.has(e)||L(e),E(yt=>{yt.contextMenuObjectType=z.SolarPanel})):L(e))},je=Ct=>{if(!M||!oe.current||!q.current||Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object)return;qe("always"),jn.getState().setEnableOrbitController(!1),se.current=Fr.Move;const yt=Ii.findParentGroup(oe.current,[Mp,Vv]);yt&&(Pe.current=Xc.setFromQuaternion(yt.getWorldQuaternion(m0.set(0,0,0,0))).z+c)},et=Ct=>{if(!(!M||!oe.current||!q.current)&&!(Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object)){switch(qe("always"),jn.getState().setEnableOrbitController(!1),Ct.object.name){case xt.Left:case xt.Right:{se.current=Fr.ResizeX;break}case xt.Upper:case xt.Lower:{se.current=Fr.ResizeY;break}}we===qa.Horizontal?(q.current.localToWorld(pe.current.set(-Ct.object.position.x,-Ct.object.position.y*Math.abs(Math.cos(u)),-R-w)),oe.current.getWorldPosition(Ie.current).sub(pe.current).normalize()):(q.current.localToWorld(pe.current.set(-Ct.object.position.x,-Ct.object.position.y,0)),q.current.getWorldPosition(Ie.current).sub(pe.current).normalize()),_(!0),ge.current=Ii.findParentGroup(oe.current,[Kot,Mp,Vv])}},bt=Ct=>{if(!(!q.current||!te.current)&&!(Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object)){switch(qe("always"),jn.getState().setEnableOrbitController(!1),Ct.eventObject.name){case ai.Upper:{se.current=Fr.RotateUpper;break}case ai.Lower:{se.current=Fr.RotateLower;break}}q.current.getWorldPosition(pe.current),pe.current.z=0,_(!0),Q(!0),ge.current=Ii.findParentGroup(oe.current,[Mp,Vv])}},St=Ct=>{Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object||(se.current=Fr.Tilt,qe("always"),jn.getState().setEnableOrbitController(!1),we===qa.Vertical?oe.current.getWorldPosition(pe.current):q.current.getWorldPosition(pe.current))},Pt=Ct=>{if(!q.current||!ae.current||!$.current)return;const yt=ra.subVectors(Ct.point,pe.current),at=q.current.localToWorld(gh.set(0,-1,0)).sub(pe.current),Et=yt.angleTo(at),Je=Math.sign($t-Et)*yt.angleTo(q.current.getWorldDirection(MJ));if(we===qa.Vertical){const st=Je>0?-Je:Je,It=R-T*Math.sin(st);Ye(It),lt(st,-It)}else{const st=w>=T?$t:Math.asin(w/T);lt(ye.clamp(Je,-st,st),0)}},Yt=g.useCallback(()=>{if(!se.current)return;const Ct=H.getState().elements.find(at=>at.id===e);switch(se.current){case Fr.Move:{E(at=>{if(!oe.current||!se.current)return;const Et=jn.getState().pointer;F.setFromCamera(Et,W().camera);const Lt=nt(F,W().scene,se.current),Je=at.elements.find(st=>st.id===e);if(Je)if(Je.parentId!==ve.current&&ve.current&&ze.current&&(Je.parentId=ve.current,Je.foundationId=ze.current),Ae.current&&Ae.current!==Je.parentType&&(Je.parentType=Ae.current),Je.parentType===z.Wall){const st=at.elements.find(It=>It.id===Je.parentId);st&&(Je.cx=oe.current.position.x/st.lx,Je.cy=0,Je.cz=oe.current.position.z/st.lz,Je.rotation=[$t,0,0],Je.normal=[0,-1,0])}else if(Je.cx=oe.current.position.x,Je.cy=oe.current.position.y,Je.cz=oe.current.position.z,Pe.current!==null&&(Lt!=null&&Lt.parentGroup)&&(Je.relativeAzimuth=Pe.current-Xc.setFromQuaternion(Lt.parentGroup.getWorldQuaternion(m0.set(0,0,0,0))).z),Lt!=null&&Lt.intersection)if(Ii.getSurfaceType(Lt.parentType,Lt.intersection.normal)===qa.Horizontal)Je.rotation=[0,0,0],Je.normal=[0,0,1];else{const{x:It,y:ot,z:it}=oe.current.rotation,Be=ra.set(0,0,1).applyEuler(oe.current.rotation);Je.rotation=[It,ot,it],Je.normal=[Be.x,Be.y,Be.z]}else{const{x:st,y:It,z:ot}=oe.current.rotation,it=ra.set(0,0,1).applyEuler(oe.current.rotation);Je.rotation=[st,It,ot],Je.normal=[it.x,it.y,it.z]}});break}case Fr.ResizeX:case Fr.ResizeY:{E(at=>{if(!Z.current||!oe.current)return;const Et=at.elements.find(Lt=>Lt.id===e);if(Et)if(Et.lx=Z.current.scale.x,Et.ly=Z.current.scale.y,Et.parentType===z.Wall){const Lt=at.elements.find(Je=>Je.id===Et.parentId);Lt&&(Et.cx=oe.current.position.x/Lt.lx,Et.cy=0,Et.cz=oe.current.position.z/Lt.lz)}else Et.parentType===z.Roof&&(at.updateElementOnRoofFlag=!at.updateElementOnRoofFlag),[Et.cx,Et.cy,Et.cz]=oe.current.position});break}case Fr.RotateLower:case Fr.RotateUpper:{E(at=>{if(!q.current)return;const Et=at.elements.find(Lt=>Lt.id===e);Et&&(Et.relativeAzimuth=Ii.getRelativeAzimuth(q.current.rotation.z))});break}case Fr.Tilt:{E(at=>{if(!ae.current)return;const Et=at.elements.find(Lt=>Lt.id===e);Et&&(Et.tiltAngle=ae.current.rotation.x)});break}}const yt=H.getState().elements.find(at=>at.id===e);Ct&&yt&&(Ii.isNewPositionOk(yt)?Ii.addUndoable(Ct,se.current):setTimeout(()=>{E(at=>{const Et=at.elements.findIndex(Lt=>Lt.id===e);Et!==-1&&(at.elements[Et]=Ct)})},10)),W().frameloop!=="demand"&&qe("demand"),jn.getState().setEnableOrbitController(!0),se.current=null,Pe.current=null,ve.current=null,ze.current=null,Ae.current=null,ge.current=null,_(!1),Q(!1)},[]);g.useEffect(()=>(window.addEventListener("pointerup",Yt),()=>window.removeEventListener("pointerup",Yt)),[Yt]),Gp(({camera:Ct,scene:yt,raycaster:at})=>{if(!oe.current||!q.current||!M||!se.current||se.current===Fr.Tilt)return;const Et=jn.getState().pointer;at.setFromCamera(Et,Ct);const Lt=nt(at,yt,se.current);if(!Lt)return;const{intersection:Je,parentGroup:st,parentType:It}=Lt,ot=Je.point;switch(se.current){case Fr.Move:{if(!It)break;switch(gt(oe.current.parent,st,It,Je.object),It){case z.Foundation:{oe.current.position.x=ot.x-st.position.x,oe.current.position.y=ot.y-st.position.y,oe.current.position.z=ot.z-st.position.z,oe.current.position.applyEuler(Xc.set(0,0,-st.rotation.z)),Le(0,0,0),Pe.current!==null?q.current.rotation.z=Pe.current-st.rotation.z:q.current.rotation.z=c;break}case z.Wall:{const Be=Ii.findParentGroup(st,[Mp]);Be&&(st.localToWorld(ra.set(0,0,0)),gh.set(0,0,0).subVectors(ot,ra).applyEuler(Xc.set(0,0,-Be.rotation.z-st.rotation.z)),oe.current.position.x=gh.x,oe.current.position.y=0,oe.current.position.z=gh.z,Le($t,0,0),q.current.rotation.set(0,0,0));break}case z.Roof:{const Be=Ii.getRoofSegmentData(Je.object);if(Be){const{roofId:pt,foundation:ct,centroid:Xe,roofSegments:ft}=Be;if(ct&&Xe&&ft&&pt){const wt=new ue().subVectors(ot,new ue(ct.cx,ct.cy,ct.cz)).applyEuler(new cn(0,0,-ct.rotation[2])),kt=wt.clone().sub(Xe),{normal:Zt,rotation:Ot}=Rn.computeState(ft,kt);oe.current.position.x=wt.x,oe.current.position.y=wt.y,oe.current.position.z=wt.z,ye.isEqual(Ot[0],0)?(Le(0,0,0),Pe.current!==null?q.current.rotation.set(0,0,Pe.current-st.rotation.z):q.current.rotation.set(0,0,c)):(Le(Ot[0],Ot[1],Ot[2]),q.current.rotation.set(0,0,0))}}break}case z.Cuboid:st.getWorldPosition(ra),st.getWorldQuaternion(m0),Xc.setFromQuaternion(m0),oe.current.position.subVectors(ot,ra).applyQuaternion(m0.invert()),He(Je.normal)}const it=Ii.getSurfaceType(It,Je.normal);switch(it===qa.Horizontal?(de.current&&de.current.setVisiable(!0),ce.current&&ce.current.setVisiable(!1),Ye(w+R)):(de.current&&de.current.setVisiable(!1),ce.current&&ce.current.setVisiable(!0),Ye(R)),it){case qa.Horizontal:{lt(u,0);break}case qa.Vertical:{const Be=Math.min(0,u),pt=R-T*Math.sin(Be);Ye(pt),lt(Be,-pt);break}case qa.Inclined:{lt(0,0);break}}Ii.isTrackerEnabled(it,p)?(q.current.rotation.set(0,0,0),ae.current.rotation.set(0,0,0),ee.current.update(p,Xc.setFromQuaternion(st.getWorldQuaternion(m0)).z)):ee.current.reset();break}case Fr.ResizeX:case Fr.ResizeY:{const it=pe.current,Be=ra.subVectors(ot,it),pt=Ie.current,ct=Be.angleTo(pt),Xe=Be.length()*Math.cos(ct),ft=mt(se.current,Xe);if(we===qa.Vertical){const wt=oe.current.getWorldPosition(ra).sub(q.current.getWorldPosition(gh)),kt=MJ.copy(pt).multiplyScalar(ft/2).add(it).add(wt).sub(st.getWorldPosition(_L)).applyQuaternion(st.getWorldQuaternion(m0).invert());oe.current.position.x=kt.x,oe.current.position.z=kt.z,It===z.Cuboid&&(oe.current.position.y=kt.y),se.current===Fr.ResizeX?(Z.current.scale.x=Math.abs(ft),ht(ft)):se.current===Fr.ResizeY&&(Z.current.scale.y=Math.abs(ft),Qe(ft),It===z.Wall&&Ye(Math.abs(ft/2*Math.sin(Math.min(0,u))))),N(se.current,ft)}else{const wt=tt(ft,se.current),kt=ra.copy(pt).multiplyScalar(wt/2).add(it).sub(st.getWorldPosition(_L)).applyQuaternion(st.getWorldQuaternion(m0).invert()),Zt=Math.abs(wt);se.current===Fr.ResizeX?(Z.current.scale.x=Zt,de.current&&de.current.update({lx:Zt})):se.current===Fr.ResizeY&&(Z.current.scale.y=Zt,de.current&&de.current.update({ly:Zt})),oe.current.position.x=kt.x,oe.current.position.y=kt.y,oe.current.position.z=kt.z,N(se.current,wt)}Fe(),Oe(Z.current.scale.x,Z.current.scale.y);break}case Fr.RotateUpper:{ra.subVectors(ot,pe.current).setZ(0);let it=ra.angleTo(gh.set(0,1,0));ra.x>0&&(it=-it),q.current.rotation.z=it-Xc.setFromQuaternion(st.getWorldQuaternion(m0)).z,ut(q.current.rotation.z);break}case Fr.RotateLower:{ra.subVectors(ot,pe.current).setZ(0);let it=ra.angleTo(gh.set(0,-1,0));ra.x<0&&(it=-it),q.current.rotation.z=it-Xc.setFromQuaternion(st.getWorldQuaternion(m0)).z,ut(q.current.rotation.z);break}}});const zt=g.useMemo(()=>we===qa.Horizontal&&!Se?new cn(0,0,c,"ZXY"):new cn(0,0,0,"ZXY"),[we,c,Se]),Rt=g.useMemo(()=>Se?new cn(0,0,0,"ZXY"):we===qa.Horizontal&&w>0?new cn(u,0,0,"ZXY"):we===qa.Vertical?new cn(Math.min(0,u),0,0,"ZXY"):new cn(0,0,0,"ZXY"),[w,we,u,Se]);return h.jsxs("group",{name:`Ref_Solar_Panel_Group ${e}`,ref:oe,position:[n,o,r],rotation:[l[0],l[1],l[2],"ZXY"],onPointerDown:Ve,children:[h.jsxs("group",{name:"Top_Azimuth_Group",ref:q,position:[0,0,Ce],rotation:zt,children:[h.jsx(ofn,{ref:ee,tiltAngle:u,trackerType:p,surfaceType:we,children:h.jsxs("group",{name:"Top_Tilt_Group",ref:ae,rotation:Rt,children:[h.jsxs("group",{ref:Z,scale:[i,a,v],children:[h.jsx(cfn,{onPointerOver:()=>Y(!0),onPointerOut:()=>Y(!1),children:h.jsx(rfn,{solarPanel:t,lx:D,ly:k})}),h.jsx(yi,{name:"Solar Panel Simulation Plane",uuid:e,userData:{simulation:!0},visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})})]}),M&&A&&h.jsx(afn,{hlx:b,hly:T}),h.jsx(dfn,{lx:D,ly:k,lz:v,orientation:y,modelLength:S.length,modelWidth:S.width}),Te&&h.jsxs(h.Fragment,{children:[h.jsx(Jot,{onPointerDown:je}),h.jsx(sfn,{ref:ne,hlx:b,hly:T,onPointerDown:et})]}),f&&h.jsx(tfn,{})]})}),O&&h.jsx(yi,{name:hfn,ref:he,args:[1e4,1e4],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),Re&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:te,children:[h.jsx(DJ,{name:ai.Upper,positionY:T+k_,onPointerDown:bt}),h.jsx(DJ,{name:ai.Lower,positionY:-T-k_,onPointerDown:bt})]}),Ne&&h.jsx(efn,{ref:$,tiltAngle:u,positionZ:-Me,isOnVerticalSurface:we===qa.Vertical,onPointerDown:St,onPointerMove:Pt}),h.jsx(ifn,{ref:de,lx:i,ly:a,tiltAngle:u,poleHeight:w,poleRadius:x,poleSpacing:C,color:P,visiable:_e}),(j||t.showLabel)&&!M&&h.jsx(lfn,{solarPanel:t,boxRef:Z})]}),f&&h.jsx(nfn,{ref:le,topTiltGroupRef:ae,positionZ:Ce,rotationX:-l[0]}),h.jsx(ffn,{ref:ce,tiltAngle:-u,lx:i,ly:a,modelLength:S.length,visiable:Ue}),G&&h.jsx(_3e,{ref:me,lx:i,ly:a,relativeAzimuth:c})]})}),Npe="Solar_Panels_Wrapper_Group",V3e=xe.memo(({parentId:t,foundationId:e,wrapperType:n,plx:o,ply:r,plz:i})=>{const a=g.useCallback(s=>{if(s.type!==z.SolarPanel)return!1;const c=s;switch(n){case z.Foundation:return c.foundationId===e&&(c.parentType===z.Foundation||c.parentType===z.Roof);case z.Cuboid:return c.foundationId===e&&c.parentType===z.Cuboid;case z.Wall:return s.parentId===t&&c.parentType===z.Wall}return!1},[t,e,n]),l=H(s=>s.elements.filter(a),Qy);switch(n){case z.Foundation:case z.Cuboid:return h.jsx("group",{name:Npe,children:l.map(s=>h.jsx(aMe,{...s},s.id))});case z.Wall:return h.jsx("group",{name:Npe,children:l.map(s=>h.jsx(aMe,{...s,cx:s.cx*o,cz:s.cz*i},s.id))});default:return null}}),Kot="Wall_Group",pfn=({wallModel:t,foundationModel:e})=>{const{id:n,roofId:o,cx:r,cy:i,lx:a,ly:l,lz:s,relativeAngle:c,fill:u,locked:d,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialHeight:m,rightTopPartialHeight:y,leftJoints:w,rightJoints:x,parentId:C}=t,P=Fc(n),[A,S]=[a/2,s/2],v=u===Ul.Partial,b=w.length>0?t.leftRoofHeight:s,T=x.length>0?t.rightRoofHeight:s,R=b??s,M=T??s,D=v?Math.min(R,m):R,k=v?Math.min(M,y):M,N=a===0,U=()=>u===Ul.Empty?h.jsx(kdn,{...t}):h.jsx(xhn,{wallModel:t,foundationModel:e});return h.jsxs("group",{name:`${Kot} ${n}`,position:[r,i,S],rotation:[0,0,c],userData:{aabb:!0,id:n,fId:C},children:[h.jsx(V3e,{parentId:n,foundationId:C,wrapperType:z.Wall,plx:a,ply:l,plz:s}),U(),P&&!d&&h.jsxs(h.Fragment,{children:[a>.5&&h.jsx(Ldn,{ply:l,phz:S}),h.jsx(Ndn,{id:n,parentLz:e.lz,roofId:o,absAngle:c+e.rotation[2],x:A,z:S,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialResizeHandleHeight:D,rightTopPartialResizeHandleHeight:k,fill:u,wallLeftHeight:R,wallRightHeight:M,highLight:N,leftJoints:w,rightJoints:x})]})]})},gfn=(t,e)=>t.wallModel===e.wallModel,mfn=xe.memo(pfn,gfn),$ot="Building Group",yfn=t=>{const{id:e,lx:n,ly:o,lz:r}=t,i=l=>l.foundationId!==e?!1:l.type===z.Wall||l.type===z.Roof||l.type===z.SolarPanel&&l.parentType===z.Roof||l.type===z.Window&&l.parentType===z.Roof,a=H(l=>l.elements.filter(i),Qy);return a.length===0?null:h.jsx("group",{name:$ot,position:[0,0,r/2],children:a.map(l=>{switch(l.type){case z.Wall:return h.jsx(mfn,{wallModel:l,foundationModel:t},l.id);case z.Roof:return h.jsx(vdn,{roofModel:l,foundationModel:t},l.id);case z.Window:return h.jsx(nrt,{...l,cz:l.cz},l.id);default:return null}})})},Afn=(t,e)=>t.lx===e.lx&&t.ly===e.ly&&t.lz===e.lz&&t.rotation===e.rotation,wfn=xe.memo(yfn,Afn),lMe=xe.memo(({hx:t,hy:e,position:n,direction:o,color:r})=>{if(n===null)return null;const[i,a]=n,l=[];if(o==="x")l.push([-t,a,0]),l.push([t,a,0]);else if(o==="y")l.push([i,-e,0]),l.push([i,e,0]);else return o==="xy"?h.jsxs(h.Fragment,{children:[h.jsx(On,{points:[[-t,a,0],[t,a,0]],color:r}),h.jsx(On,{points:[[i,-e,0],[i,e,0]],color:r})]}):null;return h.jsx(On,{points:l,color:r})});class Pv{static addUndoable(e,n){if(e)switch(n){case Fr.Move:{Pv.addUndoableMove(e);break}case Fr.ResizeX:{Pv.addUndoableResize(e,"X");break}case Fr.ResizeY:{Pv.addUndoableResize(e,"Y");break}case Fr.ResizeHeight:{Pv.addUndoableResizeHeight(e);break}case Fr.RotateLower:case Fr.RotateUpper:{Pv.addUndoableRotate(e);break}}}static addUndoableMove(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Move Water Heater",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new ue().fromArray(e.normal),newNormal:new ue().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};H.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{H.getState().set(f=>{const p=f.elements.find(m=>m.id===i);!p||p.type!==z.SolarWaterHeater||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e,n){const o=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!o)return;const r={name:`Resize Water Heater ${n}`,timestamp:Date.now(),id:o.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[o.cx,o.cy,o.cz],newDms:[o.lx,o.ly,o.lz],newRot:[...o.rotation],newNor:[...o.normal],undo(){H.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.oldPos],[a.lx,a.ly,a.lz]=[...r.oldDms],a.normal=[...r.oldNor],a.rotation=[...r.oldRot];break}})},redo(){H.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.newPos],[a.lx,a.ly,a.lz]=[...r.newDms],a.normal=[...r.newNor],a.rotation=[...r.newRot];break}})}};H.getState().addUndoable(r)}static addUndoableResizeHeight(e){const n=H.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarWaterHeater);if(!n)return;const o={name:"Resize Solar Water Heater Height",timestamp:Date.now(),changedElementId:n.id,oldValue:e.lz,newValue:n.lz,undo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.oldValue;break}})},redo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.newValue;break}})}};H.getState().addUndoable(o)}static addUndoableRotate(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Rotate Water Heater",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarWaterHeater,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};H.getState().addUndoable(o);const r=i=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarWaterHeater);l&&(l.relativeAzimuth=i)})}}}const xfn=xe.memo(({waterTankLength:t,waterTankRadius:e,panelWidth:n})=>{const o=t/2,r=n/2,i=r+e;return h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-o,-r,0],[-o,i,0],[o,i,0],[o,-r,0],[-o,-r,0]],lineWidth:3,color:i0})}),vfn=(t,e)=>{const[n,o]=g.useState(cE),r=g.useMemo(()=>Math.max(1,Math.round(t/.15)),[t]);return g.useEffect(()=>{cE&&(cE.repeat.set(r,1),cE.wrapS=es,o(cE.clone()))},[r]),n},bfn=()=>{const t=document.createElement("canvas");[t.width,t.height]=[100,100];const e=t.getContext("2d");if(e){e.fillStyle="#A3A3A3",e.fillRect(0,0,100,15);const n=e.createLinearGradient(0,15,0,35);n.addColorStop(0,"#C0C0C0"),n.addColorStop(1,"#E0E0E0"),e.fillStyle=n,e.fillRect(0,15,100,20);const o=e.createLinearGradient(0,35,0,100);o.addColorStop(0,"#949494"),o.addColorStop(.6,"#464646"),o.addColorStop(.85,"#616161"),o.addColorStop(1,"#4B4B4B"),e.fillStyle=o,e.fillRect(0,35,100,65)}return new o3(t)},Sfn=()=>{const t=document.createElement("canvas");[t.width,t.height]=[130,100];const e=t.getContext("2d");if(e){e.fillStyle="#768ca6",e.fillRect(10,0,15,100);const n=e.createLinearGradient(25,0,45,0);n.addColorStop(0,"#7ea4cf"),n.addColorStop(1,"#9ab7d9"),e.fillStyle=n,e.fillRect(25,0,20,100);const o=e.createLinearGradient(45,0,110,0);o.addColorStop(0,"#6F87A1"),o.addColorStop(.6,"#30455B"),o.addColorStop(.85,"#496279"),o.addColorStop(1,"#3E536B"),e.fillStyle=o,e.fillRect(45,0,65,100)}return new o3(t)},cE=Sfn(),Xse=bfn(),sMe=xe.memo(g.forwardRef(({id:t,lx:e,ly:n,side:o},r)=>{const{materialLx:i,setMaterialSize:a}=Got(e,n),l=dt(vs),s=H(M0)??!1,c=H(_2e),u=vfn(i),d=Xot(t),f=()=>l&&d?h.jsx("meshBasicMaterial",{map:d,side:o}):u?s||c===0?h.jsx("meshStandardMaterial",{map:u,side:o,transparent:!0}):h.jsx("meshPhongMaterial",{specular:new ir(EX),shininess:c??K8,side:o,map:u,transparent:!0}):null;return g.useImperativeHandle(r,()=>({update(p,m){p!==void 0&&a(Fr.ResizeX,p),m!==void 0&&a(Fr.ResizeY,m)}})),h.jsx(h.Fragment,{children:f()})})),Tfn=()=>{const t=H(M0)??!1,e=H(_2e),n=()=>Xse?t||e===0?h.jsx("meshStandardMaterial",{map:Xse}):h.jsx("meshPhongMaterial",{specular:new ir(EX),shininess:e??K8,map:Xse}):null;return h.jsx(h.Fragment,{children:n()})},Pfn=xe.memo(({solarWaterHeater:t,groupRef:e})=>{const{label:n,locked:o,labelColor:r="white",labelFontSize:i=20,labelSize:a=.2,labelHeight:l=2}=t,s=Kt(),[c,u]=g.useState("");return g.useEffect(()=>{if(!e.current)return;const{x:d,y:f,z:p}=e.current.getWorldPosition(ra);u((n||B.t("shared.SolarWaterHeaterElement",s))+(o?" ("+B.t("shared.ElementLocked",s)+")":"")+(n?"":` -`+B.t("word.Coordinates",s)+": ("+d.toFixed(1)+", "+f.toFixed(1)+", "+p.toFixed(1)+") "+B.t("word.MeterAbbreviation",s)))},[n,o,s]),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:c,color:r,fontSize:i,textHeight:a,position:[0,0,l]})}),cMe="Mount Left",uMe="Mount Right",qot=.3,Cfn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l,waterTankRadius:s=qot,rotation:c,normal:u,relativeAzimuth:d,parentType:f,locked:p,color:m="grey"}=t,y=Math.hypot(l-s,a),w=i+.25,x=l-s*2,C=Math.atan2(l-s,a),P=.5,A=g.useRef(null),S=g.useRef(null),v=g.useRef(null),b=g.useRef(null),T=g.useRef(new ue),R=g.useRef(new ue),M=g.useRef(null),D=g.useRef(null),k=g.useRef(null),N=g.useRef(null),U=g.useRef(null),W=g.useRef(null),F=g.useRef(null),E=g.useRef(null),L=g.useRef(null),j=g.useRef(null),Y=g.useRef(null),O=g.useRef(null),_=g.useRef(null),G=g.useRef(null),Q=g.useRef(null),oe=g.useRef(null),ee=g.useRef(null),q=g.useRef(null),ae=g.useRef(null),Z=g.useRef(null),ne=H(xs),te=dt(vs),$=H(vQ),[le,de]=g.useState(!1),[he,me]=g.useState(!1),[ce,Pe]=g.useState(null),[pe,Ie]=g.useState(!1),[ve,ze]=g.useState(!1),Ae=Fc(e),se=l2(),{set:ge,get:we,raycaster:Se}=ti(),Me=g.useMemo(()=>Ii.getSurfaceType(f,new ue().fromArray(u)),[f,u]),Ce=g.useMemo(()=>Me===qa.Horizontal?new cn(0,0,d,"ZXY"):new cn(0,0,0,"ZXY"),[Me,d]),Te=g.useMemo(()=>Ae&&Me===qa.Horizontal&&!p,[Ae,Me,p]),Re=H(pn),Ne=nt=>{ge({frameloop:nt})},_e=(nt,mt,tt)=>{switch(tt){case Fr.Move:{const gt=nt.intersectObjects(mt.children);for(const Ve of gt)if(Ve.object.name.includes("Roof")){const je=Ii.findParentGroup(Ve.object,[VL]);return je?{intersection:Ve,parentGroup:je,parentType:z.Roof}:null}break}case Fr.ResizeX:case Fr.ResizeY:case Fr.RotateLower:case Fr.RotateUpper:{if(!le||!_.current||!M.current)return null;const gt=nt.intersectObjects([_.current]),Ve=gt[0];return!Ve||ye.isEqual(Ve.point.z,0)?null:{intersection:gt[0],parentGroup:M.current,parentType:f}}case Fr.ResizeHeight:{if(!he||!G.current||!M.current)return null;const gt=nt.intersectObjects([G.current]),Ve=gt[0];return!Ve||ye.isEqual(Ve.point.z,0)?null:{intersection:gt[0],parentGroup:M.current,parentType:f}}}return null},Ue=(nt,mt,tt)=>{D.current&&D.current.rotation.set(nt,mt,tt,"ZXY")},qe=(nt,mt,tt,gt)=>{var je;const Ve=mt.children.find(et=>et.name===Qot);if(Ve&&nt&&Ve!==nt){nt.children=nt.children.filter(bt=>bt!==D.current),Ve.children.push(D.current),D.current.parent=Ve;const et=(je=Ve.parent)==null?void 0:je.userData;if(et&&et.id&&et.fId&&(v.current=et.id,b.current=et.fId),tt===z.Roof){const bt=Ii.getRoofId(gt);bt&&(v.current=bt)}}},Fe=(nt,mt)=>{if(j.current&&nt!==null){const tt=nt/2;for(const gt of j.current.children)switch(gt.name){case xt.Left:{gt.position.x=-tt;break}case xt.Right:{gt.position.x=tt;break}}}if(Y.current&&mt!==null&&(Y.current.position.y=-mt/2),O.current&&mt!==null)for(const tt of O.current.children)switch(tt.name){case ai.Lower:{tt.position.y=-mt/2-P;break}case ai.Upper:{tt.position.y=mt/2+s+P;break}}if(N.current&&mt!==null&&(N.current.position.y=mt/2),L.current&&nt!==null&&(L.current.scale.y=nt+.25),Q.current&&nt!==null)for(const tt of Q.current.children)switch(tt.name){case cMe:{tt.position.x=-nt*.4;break}case uMe:{tt.position.x=nt*.4;break}}},He=nt=>{oe.current&&oe.current.setAzimuth(nt)},Le=nt=>{nt.intersections.length==0||nt.intersections[0].object!==nt.object||(nt.stopPropagation(),nt.button===2?(H.getState().selectedElementIdSet.has(e)||$(e),Re(mt=>{mt.contextMenuObjectType=z.SolarWaterHeater})):$(e))},Ye=nt=>{if(!Ae||!D.current||nt.intersections.length==0||nt.intersections[0].object!==nt.object)return;Ne("always"),jn.getState().setEnableOrbitController(!1),A.current=Fr.Move;const mt=Ii.findParentGroup(D.current,[Mp]);mt&&(S.current=Xc.setFromQuaternion(mt.getWorldQuaternion(m0.set(0,0,0,0))).z+d)},lt=nt=>{if(!(!Ae||!D.current||!k.current)&&!(nt.intersections.length==0||nt.intersections[0].object!==nt.object)){switch(Ne("always"),jn.getState().setEnableOrbitController(!1),nt.object.name){case xt.Left:case xt.Right:{A.current=Fr.ResizeX;break}case xt.Upper:case xt.Lower:{A.current=Fr.ResizeY;break}}Me===qa.Horizontal?(k.current.localToWorld(T.current.set(-nt.object.position.x,-nt.object.position.y,0)),D.current.getWorldPosition(R.current).sub(T.current).normalize()):(k.current.localToWorld(T.current.set(-nt.object.position.x,-nt.object.position.y,0)),k.current.getWorldPosition(R.current).sub(T.current).normalize()),de(!0),Pe(x/2),M.current=Ii.findParentGroup(D.current,[Mp])}},Oe=nt=>{!Ae||!D.current||!N.current||nt.intersections.length==0||nt.intersections[0].object!==nt.object||(Ne("always"),jn.getState().setEnableOrbitController(!1),A.current=Fr.ResizeY,Me===qa.Horizontal?(N.current.localToWorld(T.current.set(0,0,0)),D.current.getWorldPosition(R.current).sub(T.current).normalize()):(k.current.localToWorld(T.current.set(0,0,0)),k.current.getWorldPosition(R.current).sub(T.current).normalize()),de(!0),Pe(0),M.current=Ii.findParentGroup(D.current,[Mp]))},ut=nt=>{!Ae||!D.current||!k.current||nt.intersections.length==0||nt.intersections[0].object!==nt.object||(Ne("always"),jn.getState().setEnableOrbitController(!1),A.current=Fr.ResizeHeight,M.current=Ii.findParentGroup(D.current,[Mp]),me(!0),setTimeout(()=>{if(G.current){const mt=we().camera.position;nt.intersections[0].object.localToWorld(ra.set(0,0,-l)),G.current.lookAt(mt.x,mt.y,ra.z),nt.intersections[0].object.localToWorld(T.current.set(0,0,-l)),setTimeout(()=>{G.current.userData.state=!0},10)}},0))},ht=nt=>{if(!(!k.current||!O.current)&&!(nt.intersections.length==0||nt.intersections[0].object!==nt.object)){switch(Ne("always"),jn.getState().setEnableOrbitController(!1),nt.eventObject.name){case ai.Upper:{A.current=Fr.RotateUpper;break}case ai.Lower:{A.current=Fr.RotateLower;break}}k.current.getWorldPosition(T.current),T.current.z=0,de(!0),Pe(x/2),ze(!0),M.current=Ii.findParentGroup(D.current,[Mp])}},Qe=g.useCallback(()=>{if(!A.current)return;const nt=H.getState().elements.find(tt=>tt.id===e);switch(A.current){case Fr.Move:{Re(tt=>{if(!D.current||!A.current)return;const gt=jn.getState().pointer;Se.setFromCamera(gt,we().camera);const Ve=_e(Se,we().scene,A.current),je=tt.elements.find(et=>et.id===e);if(je)if(je.parentId!==v.current&&v.current&&b.current&&(je.parentId=v.current,je.foundationId=b.current),je.cx=D.current.position.x,je.cy=D.current.position.y,je.cz=D.current.position.z,S.current!==null&&(Ve!=null&&Ve.parentGroup)&&(je.relativeAzimuth=S.current-Xc.setFromQuaternion(Ve.parentGroup.getWorldQuaternion(m0.set(0,0,0,0))).z),Ve!=null&&Ve.intersection)if(Ii.getSurfaceType(Ve.parentType,Ve.intersection.normal)===qa.Horizontal)je.rotation=[0,0,0],je.normal=[0,0,1];else{const{x:bt,y:St,z:Pt}=D.current.rotation,Yt=ra.set(0,0,1).applyEuler(D.current.rotation);je.rotation=[bt,St,Pt],je.normal=[Yt.x,Yt.y,Yt.z]}else{const{x:et,y:bt,z:St}=D.current.rotation,Pt=ra.set(0,0,1).applyEuler(D.current.rotation);je.rotation=[et,bt,St],je.normal=[Pt.x,Pt.y,Pt.z]}});break}case Fr.ResizeX:{Re(tt=>{if(!E.current||!D.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.lx=E.current.scale.x,gt.parentType===z.Roof&&(tt.updateElementOnRoofFlag=!tt.updateElementOnRoofFlag),[gt.cx,gt.cy,gt.cz]=D.current.position)});break}case Fr.ResizeY:{Re(tt=>{if(!E.current||!N.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.ly=N.current.position.y*2,gt.parentType===z.Roof&&(tt.updateElementOnRoofFlag=!tt.updateElementOnRoofFlag),[gt.cx,gt.cy,gt.cz]=D.current.position)});break}case Fr.ResizeHeight:{Re(tt=>{if(!U.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.lz=U.current.position.z+s)});break}case Fr.RotateLower:case Fr.RotateUpper:{Re(tt=>{if(!k.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.relativeAzimuth=Ii.getRelativeAzimuth(k.current.rotation.z))});break}}const mt=H.getState().elements.find(tt=>tt.id===e);nt&&mt&&(Ii.isNewPositionOk(mt)?Pv.addUndoable(nt,A.current):setTimeout(()=>{Re(tt=>{const gt=tt.elements.findIndex(Ve=>Ve.id===e);gt!==-1&&(tt.elements[gt]=nt)})},10)),we().frameloop!=="demand"&&Ne("demand"),jn.getState().setEnableOrbitController(!0),A.current=null,S.current=null,v.current=null,b.current=null,M.current=null,de(!1),Pe(null),me(!1),ze(!1)},[]);return g.useEffect(()=>(window.addEventListener("pointerup",Qe),()=>window.removeEventListener("pointerup",Qe)),[Qe]),Gp(({camera:nt,scene:mt,raycaster:tt})=>{if(!D.current||!k.current||!Ae||!A.current)return;const gt=jn.getState().pointer;tt.setFromCamera(gt,nt);const Ve=_e(tt,mt,A.current);if(!Ve)return;const{intersection:je,parentGroup:et,parentType:bt}=Ve,St=je.point;switch(A.current){case Fr.Move:{if(!bt)break;switch(qe(D.current.parent,et,bt,je.object),bt){case z.Roof:{const Pt=Ii.getRoofSegmentData(je.object);if(Pt){const{roofId:Yt,foundation:zt,centroid:Rt,roofSegments:Ct}=Pt;if(zt&&Rt&&Ct&&Yt){const yt=new ue().subVectors(St,new ue(zt.cx,zt.cy,zt.cz)).applyEuler(new cn(0,0,-zt.rotation[2])),at=yt.clone().sub(Rt),{normal:Et,rotation:Lt}=Rn.computeState(Ct,at);D.current.position.x=yt.x,D.current.position.y=yt.y,D.current.position.z=yt.z,ye.isEqual(Lt[0],0)?(Ue(0,0,0),S.current!==null?k.current.rotation.set(0,0,S.current-et.rotation.z):k.current.rotation.set(0,0,d)):(Ue(Lt[0],Lt[1],Lt[2]),k.current.rotation.set(0,0,0))}}break}}break}case Fr.ResizeX:{const Pt=T.current,Yt=ra.subVectors(St,Pt),zt=R.current,Rt=Yt.angleTo(zt),Ct=Yt.length()*Math.cos(Rt);if(Me!==qa.Vertical){const yt=ra.copy(zt).multiplyScalar(Ct/2).add(Pt).sub(et.getWorldPosition(_L)).applyQuaternion(et.getWorldQuaternion(m0).invert()),at=Math.abs(Ct);E.current.scale.x=at,D.current.position.x=yt.x,D.current.position.y=yt.y,D.current.position.z=yt.z,ae.current&&ae.current.update(E.current.scale.x),Fe(at,null)}break}case Fr.ResizeY:{const Pt=T.current,Yt=ra.subVectors(St,Pt),zt=R.current,Rt=Yt.angleTo(zt),Ct=Math.cos(Rt)>0?Yt.length()*Math.cos(Rt):.1;if(Me!==qa.Vertical){const yt=l-s,at=Math.hypot(Ct,yt),Et=Math.asin(yt/at),Lt=ra.copy(zt).multiplyScalar(Ct/2).add(Pt).sub(et.getWorldPosition(_L)).applyQuaternion(et.getWorldQuaternion(m0).invert());D.current.position.x=Lt.x,D.current.position.y=Lt.y,W.current.rotation.x=Et,F.current.position.y=-at/2,E.current.scale.y=at,Fe(null,Ct)}break}case Fr.RotateUpper:{ra.subVectors(St,T.current).setZ(0);let Pt=ra.angleTo(gh.set(0,1,0));ra.x>0&&(Pt=-Pt),k.current.rotation.z=Pt-Xc.setFromQuaternion(et.getWorldQuaternion(m0)).z,He(k.current.rotation.z);break}case Fr.RotateLower:{ra.subVectors(St,T.current).setZ(0);let Pt=ra.angleTo(gh.set(0,-1,0));ra.x<0&&(Pt=-Pt),k.current.rotation.z=Pt-Xc.setFromQuaternion(et.getWorldQuaternion(m0)).z,He(k.current.rotation.z);break}case Fr.ResizeHeight:{if(G.current.userData.state&&U.current){const Pt=Math.max(St.z-T.current.z,s*2),Yt=Pt-s,zt=Pt-s*2,Rt=Math.hypot(Yt,a);U.current.position.z=Yt,W.current&&Q.current&&(Q.current.scale.y=zt,Q.current.position.z=zt/2,W.current.rotation.x=Math.asin(Yt/Rt),F.current.position.y=-Rt/2,E.current.scale.y=Rt,O.current&&(O.current.position.z=zt/2))}break}}}),h.jsxs("group",{ref:D,position:[n,o,r],rotation:[c[0],c[1],c[2],"ZXY"],onPointerDown:Le,onPointerOver:()=>Ie(!0),onPointerOut:()=>Ie(!1),children:[h.jsxs("group",{ref:k,rotation:Ce,children:[h.jsxs("group",{ref:N,position:[0,a/2,0],children:[h.jsxs("group",{ref:U,position:[0,0,s+x],children:[h.jsxs("group",{ref:q,children:[h.jsx(wa,{ref:L,args:[s,s,1],castShadow:ne&&!te,receiveShadow:ne&&!te,rotation:[0,0,$t],scale:[1,w,1],children:h.jsx("meshStandardMaterial",{color:m,roughness:.2})}),Ae&&h.jsx(di,{ref:ee,args:[se,.1,se],position:[0,0,s],onPointerDown:ut,children:h.jsx("meshBasicMaterial",{color:"white"})})]}),h.jsx("group",{ref:W,rotation:[C,0,0],children:h.jsxs("group",{ref:F,position:[0,-y/2,0],children:[h.jsxs("group",{ref:E,scale:[i,y,1],children:[h.jsx(yi,{castShadow:!1,receiveShadow:ne,children:h.jsx(sMe,{ref:ae,id:e,lx:i,ly:a,side:$i})}),!te&&h.jsx(yi,{receiveShadow:ne,position:[0,-.475,.001],args:[1,.05],children:h.jsx(Tfn,{})}),ne&&h.jsx(yi,{castShadow:ne,receiveShadow:!1,position:[0,0,-.05],children:h.jsx(sMe,{ref:Z,id:e,lx:i,ly:a,side:js})}),h.jsx(yi,{name:"Water Heater Simulation Plane",uuid:e,userData:{simulation:!0},position:[0,0,.001],visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})})]}),Ae&&!p&&h.jsxs(h.Fragment,{children:[h.jsx(Jot,{onPointerDown:Ye}),h.jsxs("group",{name:"X_Resize_Handles_Group",ref:j,onPointerDown:lt,children:[h.jsx(Gv,{cx:i/2,cy:0,type:xt.Right,size:se}),h.jsx(Gv,{cx:-i/2,cy:0,type:xt.Left,size:se})]})]}),Ae&&p&&h.jsx(xfn,{waterTankLength:w,waterTankRadius:s,panelWidth:y})]})})]}),h.jsxs("group",{ref:Q,position:[0,0,x/2],rotation:[$t,0,0],scale:[1,x+.1,1],children:[h.jsx(wa,{name:cMe,args:[.05,.05,1],position:[-i*.4,0,0],castShadow:ne,children:h.jsx("meshStandardMaterial",{color:"grey"})}),h.jsx(wa,{name:uMe,args:[.05,.05,1],position:[i*.4,0,0],castShadow:ne,children:h.jsx("meshStandardMaterial",{color:"grey"})})]}),he&&h.jsx(yi,{ref:G,args:[1e4,1e4],rotation:[$t,0,0,"ZXY"],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})})]}),Ae&&!p&&h.jsx("group",{name:"Y_Resize_Handles_Group",ref:Y,position:[0,-a/2,0],onPointerDown:Oe,children:h.jsx(Gv,{cx:0,cy:0,type:xt.Lower,size:se})}),Te&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:O,position:[0,0,x/2],children:[h.jsx(DJ,{name:ai.Upper,positionY:a/2+s+P,onPointerDown:ht}),h.jsx(DJ,{name:ai.Lower,positionY:-a/2-P,onPointerDown:ht})]}),(pe||t.showLabel)&&!Ae&&h.jsx(Pfn,{solarWaterHeater:t,groupRef:D})]}),le&&ce!==null&&h.jsx(yi,{ref:_,args:[1e4,1e4],position:[0,0,ce],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),ve&&h.jsx(_3e,{ref:oe,lx:i,ly:a,relativeAzimuth:d})]})}),Qot="Water_Heater_Wrapper_Group",Rfn=xe.memo(({foundationId:t,wrapperType:e})=>{const n=g.useCallback(r=>{if(r.type!==z.SolarWaterHeater)return!1;const i=r;switch(e){case z.Foundation:return i.foundationId===t&&i.parentType===z.Roof;case z.Cuboid:case z.Wall:}return!1},[t,e]),o=H(r=>r.elements.filter(n),Qy);switch(e){case z.Foundation:return h.jsx("group",{name:Qot,children:o.map(r=>h.jsx(Cfn,{...r},r.id))});default:return null}}),Zot="Battery Storage Wrapper";var ol=(t=>(t.Move="Move",t.ResizeXY="ResizeXY",t.ResizeX="ResizeX",t.ResizeY="ResizeY",t.ResizeZ="ResizeZ",t.RotateUpper="RotateUpper",t.RotateLower="RotateLower",t.None="None",t))(ol||{});const Hfn=g.forwardRef((t,e)=>{const n="lightGray",o=B5(NM,gI),r={font:o,height:0,size:.2},i={font:o,height:0,size:.35},[a,l]=g.useState(t.lz),s=m(t.handle),c=y(),u=Math.ceil(a)+1,d=`${a.toFixed(1)} m`,f=a-.175,p=new Array(u+1).fill(0);g.useImperativeHandle(e,()=>({updateLz:w=>{l(w)}}));function m(w){const{hx:x,hy:C}=t;switch(w){case xt.LowerLeftTop:return new ue(-x,-C,0);case xt.LowerRightTop:return new ue(x,-C,0);case xt.UpperLeftTop:return new ue(-x,C,0);case xt.UpperRightTop:return new ue(x,C,0);default:return new ue}}function y(){const w=H.getState().cameraDirection,x=-Math.atan2(w.x,w.y)+Math.PI,C=H.getState().elements.reduce((P,A)=>((A.id===t.id||A.id===t.fId)&&(P+=A.rotation[2]),P),0);return new cn($t,0,x-C,"ZXY")}return h.jsxs("group",{position:s,rotation:c,name:"Vertical Ruler",children:[h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[0,u,0]],color:n}),h.jsxs("mesh",{position:[-1.5,f,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[d,i]}),h.jsx("meshBasicMaterial",{attach:"material",color:"white"})]}),p.map((w,x)=>{const C=.2+(x%5===0?.05:0),P=h.jsx("textGeometry",{args:[`${x}`,r]});return h.jsxs("group",{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[-C,x,0],[C,x,0]],lineWidth:.5,color:n}),h.jsxs("mesh",{position:[.4,x-.125,0],userData:{unintersectable:!0},children:[P,h.jsx("meshBasicMaterial",{color:n})]})]},x)})]})}),sR="Text Sprite",Mfn=g.forwardRef((t,e)=>{const n=Kt(),[o,r]=g.useState(t.hx),[i,a]=g.useState(t.hy),l=o*2,s=i*2,c=.1,u=.2,d=.2,f=1,p=.5,m="white",y="darkorchid",w=Math.max(.3,(o+i)/32),x=.5;g.useImperativeHandle(e,()=>({update(v,b){r(v),a(b)}}));const C=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:s.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[-o-x,0,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o-x,-i,c],[-o-x,i,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o-x+d,-i+3*d,c],[-o-x,-i,c],[-o-x-d,-i+3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o-x+d,i-3*d,c],[-o-x,i,c],[-o-x-d,i-3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,-i,c],[-o-x*2,-i,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,i,c],[-o-x*2,i,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]),P=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:s.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[o+x,0,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[o+x,-i,c],[o+x,i,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o+x+d,-i+3*d,c],[o+x,-i,c],[o+x-d,-i+3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o+x+d,i-3*d,c],[o+x,i,c],[o+x-d,i-3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,-i,c],[o+x*2,-i,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,i,c],[o+x*2,i,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]),A=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:l.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[0,-i-x,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,-i-x,c],[o,-i-x,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o+3*d,-i-x-d,c],[-o,-i-x,c],[-o+3*d,-i-x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o-3*d,-i-x-d,c],[o,-i-x,c],[o-3*d,-i-x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,-i,c],[-o,-i-x*2,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,-i,c],[o,-i-x*2,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]),S=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:l.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[0,i+x,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,i+x,c],[o,i+x,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o+3*d,i+x-d,c],[-o,i+x,c],[-o+3*d,i+x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o-3*d,i+x-d,c],[o,i+x,c],[o-3*d,i+x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,i,c],[-o,i+x*2,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,i,c],[o,i+x*2,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]);switch(t.handle){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[C,A]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[P,A]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[C,S]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[P,S]})}return h.jsx(h.Fragment,{})}),Ifn=g.forwardRef(({id:t,hx:e,hy:n,hz:o,fId:r,onMoveHandlePointerDown:i,onResizeHandlePointerDown:a,onRotateHandlePointerDown:l},s)=>{const c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(null),p=g.useRef(null),m=H(M0),{gl:y}=ti(),w=l2(.2),x=w*1.2,C=o*2,P=g.useMemo(()=>[0,Math.min(-1.2*n,-n-.75)-w*2,$8/2],[n,o,w]),A=g.useMemo(()=>[0,Math.max(1.2*n,n+.75)+w*2,$8/2],[n,o,w]),S=H(pn),[v,b]=g.useState(null),[T,R]=g.useState(null),M=T||v,D=g.useCallback((W,F)=>{dt.getState().duringCameraInteraction||W.intersections.length>0&&(W.intersections[0].object===W.eventObject||W.intersections.length>1&&W.intersections[1].object===W.eventObject)&&(S(L=>{L.hoveredHandle=F}),b(F),ye.isMoveHandle(F)?y.domElement.style.cursor="move":F===ai.Upper||F===ai.Lower?y.domElement.style.cursor="grab":y.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"pointer")},[]),k=g.useCallback(()=>{S(W=>{W.hoveredHandle=null}),b(null),y.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),N=W=>{W.intersections.length==0||W.intersections[0].object!==W.object&&W.intersections[0].object.name!==sR||(a(W),R(W.object.name))};g.useEffect(()=>{const W=()=>{R(null)};return window.addEventListener("pointerup",W),()=>window.removeEventListener("pointerup",W)},[]),g.useImperativeHandle(s,()=>({update(W,F,E){if(c.current)for(const L of c.current.children)switch(L.name){case Ho.Left:{L.position.x=-W-x;break}case Ho.Right:{L.position.x=W+x;break}case Ho.Lower:{L.position.y=-F-x;break}case Ho.Upper:{L.position.y=F+x;break}case Ho.Top:{L.position.z=E*2;break}}if(u.current)for(const L of u.current.children)switch(L.name){case xt.Left:{L.position.x=-W;break}case xt.Right:{L.position.x=W;break}case xt.Upper:{L.position.y=F;break}case xt.Lower:{L.position.y=-F;break}case xt.UpperLeft:{L.position.x=-W,L.position.y=F;break}case xt.UpperRight:{L.position.x=W,L.position.y=F;break}case xt.LowerLeft:{L.position.x=-W,L.position.y=-F;break}case xt.LowerRight:{L.position.x=W,L.position.y=-F;break}case xt.UpperLeftTop:{L.position.x=-W,L.position.y=F,L.position.z=E*2;break}case xt.UpperRightTop:{L.position.x=W,L.position.y=F,L.position.z=E*2;break}case xt.LowerLeftTop:{L.position.x=-W,L.position.y=-F,L.position.z=E*2;break}case xt.LowerRightTop:{L.position.x=W,L.position.y=-F,L.position.z=E*2;break}}if(d.current)for(const L of d.current.children)switch(L.name){case ai.Upper:{L.position.y=Math.max(1.2*F,F+.75)+w*2;break}case ai.Lower:{L.position.y=Math.min(-1.2*F,-F-.75)-w*2;break}}f.current&&f.current.updateLz(E*2),p.current&&p.current.update(W,F)}}));const U=W=>{if(!W)return null;switch(W){case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:return h.jsx(Mfn,{ref:p,hx:e,hy:n,handle:W});case xt.LowerLeftTop:case xt.UpperLeftTop:case xt.LowerRightTop:case xt.UpperRightTop:return h.jsx(Hfn,{ref:f,id:t,fId:r,hx:e,hy:n,lz:C,handle:W})}return null};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Move Handles Group",ref:c,onPointerDown:i,children:[h.jsx(Q9,{handleType:Ho.Lower,position:[0,-n-x,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Upper,position:[0,n+x,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Left,position:[-e-x,0,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Right,position:[e+x,0,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Top,position:[0,0,C],size:w,onPointerOver:D,onPointerOut:k})]}),h.jsxs("group",{name:"Resize Handles Group",ref:u,onPointerDown:N,children:[h.jsx(Vc,{handleType:xt.UpperLeft,position:[-e,n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRight,position:[e,n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerLeft,position:[-e,-n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRight,position:[e,-n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Left,position:[-e,0,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Right,position:[e,0,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Upper,position:[0,n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Lower,position:[0,-n,w/2],size:w,onPointerOver:D,onPointerOut:k}),!m&&h.jsxs(h.Fragment,{children:[h.jsx(Vc,{handleType:xt.LowerLeftTop,position:[-e,-n,C],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperLeftTop,position:[-e,n,C],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRightTop,position:[e,-n,C],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRightTop,position:[e,n,C],size:w,onPointerOver:D,onPointerOut:k})]})]}),h.jsxs("group",{name:"Rotate Handles Group",ref:d,onPointerDown:l,children:[h.jsx(MH,{id:t,handleType:ai.Lower,position:P,ratio:w*4,hoverHandle:D,noHoverHandle:k}),h.jsx(MH,{id:t,position:A,handleType:ai.Upper,ratio:w*4,hoverHandle:D,noHoverHandle:k})]}),U(M)]})});class Qk{static addUndoable(e,n){const o=H.getState().elements.find(r=>r.id===e.id);if(o)switch(n){case ol.Move:{Qk.addUndoableMove(e,o);break}case ol.ResizeX:case ol.ResizeY:case ol.ResizeZ:case ol.ResizeXY:{Qk.addUndoableResize(e,o);break}case ol.RotateUpper:case ol.RotateLower:{Qk.addUndoableRotate(e,o);break}}}static addUndoableMove(e,n){const o={name:"Move Battery Storage",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentId:e.parentId,newParentId:n.parentId,oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(o.movedElementId,[o.oldCx,o.oldCy,o.oldCz],o.oldParentId,o.oldRotation)},redo(){r(o.movedElementId,[o.newCx,o.newCy,o.newCz],o.newParentId,o.newRotation)}};H.getState().addUndoable(o);const r=(i,a,l,s)=>{H.getState().set(c=>{const u=c.elements.find(d=>d.id===i);!u||u.type!==z.BatteryStorage||([u.cx,u.cy,u.cz]=[...a],l&&(u.parentId=l,u.foundationId=l),s&&(u.rotation=[...s]))})}}static addUndoableResize(e,n){const o={name:"Resize Battery Storage",timestamp:Date.now(),id:n.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],newPos:[n.cx,n.cy,n.cz],newDms:[n.lx,n.ly,n.lz],undo(){r(o.id,o.oldPos,o.oldDms)},redo(){r(o.id,o.newPos,o.newDms)}};H.getState().addUndoable(o);const r=(i,a,l)=>{H.getState().set(s=>{const c=s.elements.find(u=>u.id===i);c&&([c.cx,c.cy,c.cz]=[...a],[c.lx,c.ly,c.lz]=[...l])})}}static addUndoableRotate(e,n){const o={name:"Rotate Battery Storage",timestamp:Date.now(),changedElementId:n.id,oldValue:e.rotation[2],newValue:n.rotation[2],changedElementType:e.type,undo:()=>{r(o.changedElementId,o.oldValue)},redo:()=>{r(o.changedElementId,o.newValue)}};H.getState().addUndoable(o);const r=(i,a)=>{H.getState().set(l=>{const s=l.elements.find(c=>c.id===i);s&&(s.rotation[2]=a)})}}}const zfn=xe.memo(({element:t,groupRef:e})=>{const{lz:n,label:o,locked:r,labelColor:i="white",labelFontSize:a=20,labelSize:l=.2,labelHeight:s=.2}=t,c=Kt(),[u,d]=g.useState("");return g.useEffect(()=>{if(!e.current)return;const{x:f,y:p,z:m}=e.current.getWorldPosition(ra.set(0,0,0));d((o||B.t("batteryStorageMenu.BatteryStorage",c))+(r?" ("+B.t("shared.ElementLocked",c)+")":"")+(o?"":` -`+B.t("word.Coordinates",c)+": ("+f.toFixed(1)+", "+p.toFixed(1)+", "+(m+n/2).toFixed(1)+") "+B.t("word.MeterAbbreviation",c)))},[o,r,c]),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:u,color:i,fontSize:a,textHeight:l,position:[0,0,s+n]})}),Dfn=()=>{const t=document.createElement("canvas");[t.width,t.height]=[100,150];const e=t.getContext("2d");return e&&(e.fillStyle="white",e.fillRect(0,0,100,150),e.lineWidth=1.5,e.strokeStyle="black",e.beginPath(),e.moveTo(0,25),e.lineTo(0,125),e.moveTo(100,25),e.lineTo(100,125),e.stroke(),e.lineWidth=3,e.beginPath(),e.moveTo(25,50),e.lineTo(75,50),e.moveTo(25,60),e.lineTo(75,60),e.moveTo(25,70),e.lineTo(75,70),e.moveTo(25,80),e.lineTo(75,80),e.moveTo(25,90),e.lineTo(75,90),e.moveTo(25,100),e.lineTo(75,100),e.stroke()),new o3(t)},Efn=(t,e)=>{const n=document.createElement("canvas");[n.width,n.height]=[300*t,300*e];const o=n.width/2,r=n.height/2,i=n.getContext("2d");return i&&(i.fillStyle="white",i.fillRect(0,0,300*t,300*e),i.lineWidth=8,i.strokeStyle="blue",i.beginPath(),i.arc(o,r,130,0,2*Math.PI),i.stroke(),i.beginPath(),i.moveTo(o+10,r-100),i.lineTo(o-40,r+15),i.lineTo(o-3,r+15),i.lineTo(o-10,r+100),i.lineTo(o+40,r-10),i.lineTo(o+3,r-10),i.closePath(),i.lineWidth=8,i.stroke()),new o3(n)},kfn=xe.memo(g.forwardRef(({lx:t,ly:e,lz:n,color:o},r)=>{const i=g.useMemo(()=>{const c=Dfn();return c.wrapS=es,c.repeat.set(Math.max(1,Math.round(t/1.5)),1),c},[]),a=(c,u)=>{const d=Efn(c,u);return d.wrapS=es,d.wrapT=es,d.repeat.set(1,1),d.rotation=$t,d},[l,s]=g.useState(a(e,n));return g.useImperativeHandle(r,()=>({update(c,u,d){i.repeat.setX(Math.max(1,Math.round(c/1.5))),s(a(u,d))}})),h.jsxs(h.Fragment,{children:[h.jsx("meshStandardMaterial",{side:$i,attach:"material-0",color:o,map:l}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-1",color:o,map:l}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-2",color:o,map:i}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-3",color:o,map:i}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-4",color:o}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-5",color:o})]})})),F_=.5,Ffn=t=>{const{id:e,parentId:n,cx:o,cy:r,lx:i,ly:a,lz:l,rotation:s,locked:c,color:u="white",showLabel:d,lineColor:f="black",lineWidth:p=.2}=t,m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),P=g.useRef(null),A=g.useRef(null),S=g.useRef(null),v=H(xs),b=H(pn),T=H(vQ),{set:R}=ti(),M=Fc(e),[D,k]=g.useState(!1),[N,U]=g.useState(!1),W=g.useRef(ol.None),F=g.useRef(null),E=g.useRef(new ue),L=g.useRef(new ue),j=g.useRef(new cn(0,0,0,"ZXY")),Y=g.useRef(new ue),O=g.useRef(null),_=g.useRef(null),[G,Q,oe]=[i/2,a/2,l/2],[ee,q,ae]=s,Z=M&&!c,ne=pe=>{R({frameloop:pe})},te=(pe,Ie,ve)=>{switch(ve){case ol.Move:{const ze=pe.intersectObjects(Ie.children);for(const Ae of ze)if(Ae.object.name===VL){const se=Ae.object.parent;return se?{intersection:Ae,parentGroup:se}:null}break}case ol.ResizeX:case ol.ResizeY:case ol.ResizeXY:case ol.ResizeZ:case ol.RotateLower:case ol.RotateUpper:{if(!D||!x.current||!O.current)return null;const ze=pe.intersectObjects([x.current]),Ae=ze[0];return!Ae||ye.isEqual(Ae.point.z,0)?null:{intersection:ze[0],parentGroup:O.current}}}return null},$=(pe,Ie)=>{var ze;const ve=Ie.children.find(Ae=>Ae.name===Zot);if(ve&&pe&&ve!==pe){pe.children=pe.children.filter(se=>se!==m.current),ve.children.push(m.current),m.current.parent=ve;const Ae=(ze=ve.parent)==null?void 0:ze.userData;Ae&&Ae.id&&Ae.fId&&(_.current=Ae.id)}},le=pe=>{A.current&&A.current.setAzimuth(pe)},de=pe=>{pe.intersections.length==0||pe.intersections[0].object!==pe.object||(T(e),pe.button===2&&b(Ie=>{Ie.contextMenuObjectType=z.BatteryStorage}))},he=pe=>{if(pe.intersections.length==0||pe.intersections[0].object!==pe.object)return;ne("always"),jn.getState().setEnableOrbitController(!1),W.current=ol.Move,E.current.set(-pe.object.position.x,-pe.object.position.y,0);const Ie=Ii.findParentGroup(m.current,[Mp]);Ie&&(F.current=Xc.setFromQuaternion(Ie.getWorldQuaternion(m0.set(0,0,0,0))).z+m.current.rotation.z)},me=pe=>{if(pe.intersections.length==0||pe.intersections[0].object!==pe.object&&pe.intersections[0].object.name!==sR)return;ne("always"),jn.getState().setEnableOrbitController(!1);const Ie=pe.object.name;if(Ie.includes("Top")){W.current=ol.ResizeZ;const ze=H.getState().elements.find(Ae=>Ae.id===n);if(ze){const Ae=H.getState().cameraDirection,se=Math.atan2(-Ae.y,-Ae.x)-m.current.rotation.z-ze.rotation[2];L.current.copy(pe.object.position),j.current.set($t,0,-$t+se,"ZXY")}}else Ie===xt.Left||Ie===xt.Right?(W.current=ol.ResizeX,m.current&&Y.current.subVectors(m.current.localToWorld(ra.set(1,0,0)),m.current.localToWorld(gh.set(0,0,0)))):Ie===xt.Upper||Ie===xt.Lower?(W.current=ol.ResizeY,m.current&&Y.current.subVectors(m.current.localToWorld(ra.set(0,1,0)),m.current.localToWorld(gh.set(0,0,0)))):(W.current=ol.ResizeXY,m.current&&Y.current.subVectors(m.current.localToWorld(ra.set(1,0,0)),m.current.localToWorld(gh.set(0,0,0)))),L.current.set(0,0,0),j.current.set(0,0,0);O.current=Ii.findParentGroup(m.current,[Mp]),k(!0)},ce=pe=>{pe.intersections.length==0||pe.intersections[0].object!==pe.object||(ne("always"),jn.getState().setEnableOrbitController(!1),pe.object.name===ai.Lower?W.current=ol.RotateLower:pe.object.name===ai.Upper?W.current=ol.RotateUpper:W.current=ol.None,k(!0),U(!0),L.current.set(0,0,0),j.current.set(0,0,0),O.current=Ii.findParentGroup(m.current,[Mp]))},Pe=g.useCallback(()=>{if(W.current===ol.None)return;const pe=H.getState().elements.find(Ie=>Ie.id===e);b(Ie=>{if(m.current&&y.current&&w.current){const ve=Ie.elements.find(ze=>ze.id===e&&ze.type===z.BatteryStorage);ve&&(ve.cx=m.current.position.x,ve.cy=m.current.position.y,ve.cz=y.current.position.z,ve.lx=w.current.scale.x,ve.ly=w.current.scale.y,ve.lz=w.current.scale.z,ve.rotation[2]=m.current.rotation.z,_.current&&_.current&&(ve.parentId=_.current,ve.foundationId=_.current))}}),pe&&Qk.addUndoable(pe,W.current),ne("demand"),jn.getState().setEnableOrbitController(!0),k(!1),W.current=ol.None,_.current=null,U(!1)},[]);return g.useEffect(()=>(window.addEventListener("pointerup",Pe),()=>window.removeEventListener("pointerup",Pe)),[Pe]),Gp(({camera:pe,scene:Ie,raycaster:ve})=>{if(!m.current&&W.current===ol.None)return;const ze=jn.getState().pointer;ve.setFromCamera(ze,pe);const Ae=te(ve,Ie,W.current);if(!Ae)return;const{intersection:se,parentGroup:ge}=Ae,we=se.point;switch(W.current){case ol.Move:{if(ge){$(m.current.parent,ge),F.current!==null?m.current.rotation.z=F.current-ge.rotation.z:m.current.rotation.z=ae;const Te=ra.copy(E.current).applyEuler(Xc.set(0,0,ge.rotation.z+m.current.rotation.z));m.current.position.x=we.x+Te.x-ge.position.x,m.current.position.y=we.y+Te.y-ge.position.y,m.current.position.applyEuler(Xc.set(0,0,-ge.rotation.z))}break}case ol.ResizeX:case ol.ResizeY:{const Te=H.getState().resizeAnchor,Re=ra.subVectors(we,Te),Ne=Re.angleTo(Y.current),_e=Re.length()*Math.cos(Ne),Ue=_e>0?Math.max(F_,_e):Math.min(-.5,_e),qe=ra.copy(Y.current).multiplyScalar(Ue/2).add(Te).sub(ge.getWorldPosition(_L)).applyQuaternion(ge.getWorldQuaternion(m0).invert()),Fe=Math.abs(Ue);W.current===ol.ResizeX?w.current.scale.x=Fe:W.current===ol.ResizeY&&(w.current.scale.y=Fe),S.current&&S.current.update(w.current.scale.x,w.current.scale.y,l),m.current.position.x=qe.x,m.current.position.y=qe.y;break}case ol.ResizeXY:{const Te=we.clone().setZ(0),Re=H.getState().resizeAnchor.clone().setZ(0),Ne=ra.subVectors(Te,Re).applyEuler(Xc.set(0,0,-m.current.rotation.z-ge.rotation.z)),_e=gh.addVectors(Te,Re).multiplyScalar(.5),Ue=MJ.subVectors(_e,ge.position).setZ(0).applyEuler(Xc.set(0,0,-ge.rotation.z)),qe=Math.abs(Ne.x),Fe=Math.abs(Ne.y);qe>F_&&Fe>F_&&(m.current.position.x=Ue.x,m.current.position.y=Ue.y,w.current.scale.x=qe,w.current.scale.y=Fe,S.current&&S.current.update(qe,Fe,l));break}case ol.ResizeZ:{if(y.current){const Te=Math.max(F_,we.z-ge.position.z*2);w.current.scale.z=Te,y.current.position.z=Te/2,S.current&&S.current.update(i,a,Te)}break}case ol.RotateLower:{const Te=ra.subVectors(we,m.current.localToWorld(gh.set(0,0,0))).setZ(0).normalize(),Re=Math.atan2(Te.y,Te.x);m.current.rotation.z=Re-ge.rotation.z+$t,le(m.current.rotation.z);break}case ol.RotateUpper:{const Te=ra.subVectors(we,m.current.localToWorld(gh.set(0,0,0))).setZ(0).normalize(),Re=Math.atan2(Te.y,Te.x);m.current.rotation.z=Re-ge.rotation.z-$t,le(m.current.rotation.z);break}}const[Se,Me,Ce]=w.current.scale.toArray().map(Te=>Te/2);C.current&&C.current.update(Se,Me,Ce)}),h.jsxs(h.Fragment,{children:[h.jsxs("group",{ref:m,position:[o,r,0],rotation:[0,0,ae],onPointerDown:de,children:[h.jsx("group",{ref:y,position:[0,0,oe],children:h.jsx(di,{ref:w,scale:[i,a,l],castShadow:v,receiveShadow:v,children:h.jsx(kfn,{ref:S,lx:i,ly:a,lz:l,color:u})})}),Z&&h.jsx(Ifn,{ref:C,id:e,hx:G,hy:Q,hz:oe,fId:n,onMoveHandlePointerDown:he,onResizeHandlePointerDown:me,onRotateHandlePointerDown:ce}),d&&!M&&h.jsx(zfn,{element:t,groupRef:m}),!M&&h.jsx("group",{position:[0,0,oe],children:h.jsx(o4,{hx:G,hy:Q,hz:oe,lineColor:f,lineWidth:p})}),D&&h.jsx(yi,{name:"Intersection Plane",ref:x,args:[1e4,1e4],position:L.current,rotation:j.current,visible:!1})]}),N&&h.jsx("group",{ref:P,position:[o,r,0],children:h.jsx(_3e,{ref:A,lx:i,ly:a,relativeAzimuth:s[2]})})]})},Lfn=({foundationId:t,hz:e})=>{const n=g.useCallback(r=>r.type===z.BatteryStorage&&r.foundationId===t,[]),o=H(r=>r.elements.filter(n),Qy);return h.jsx("group",{name:Zot,position:[0,0,e],children:o.map(r=>h.jsx(Ffn,{...r},r.id))})},Mp="Foundation_Group",VL="Foundation",Wfn=xe.memo(t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=.1,rotation:l=[0,0,0],color:s="gray",lineColor:c="black",lineWidth:u=.2,locked:d=!1,showLabel:f=!1,textureType:p=Xi.NoTexture,solarStructure:m}=t,y=Fc(e),w=H(Au),x=H(M0),C=H(Jn),P=H(HS),A=H(pn),S=H(Q3),v=H(u5e),b=H(Z3),T=H(H7),R=H(T5e),M=H(P5e),D=H(qRt),k=H(yQ),N=H(pXe),U=H(M7),W=H(OXe),F=H(_Xe),E=H(Jp),L=H(z0),j=H(y5e),Y=H(O5),O=H(_Rt),_=H($Rt),G=H(xs),Q=H(h4),oe=H(TQ),ee=H(Fn),q=H(b5e),ae=H(c5e),Z=H($y),ne=dt(vs),te=H(Df),$=H(V2e),le=In(O1),{camera:de,gl:{domElement:he}}=ti(),[me,ce]=g.useState(!1),[Pe,pe]=g.useState(null),[Ie,ve]=g.useState(!1),[ze,Ae]=g.useState({show:!1,direction:null,position:null}),[se,ge]=g.useState([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]),we=g.useRef(null),Se=g.useRef(!1),Me=g.useRef(!1),Ce=g.useRef(null),Te=g.useRef(Qr.null),Re=g.useRef(new Map),Ne=g.useRef(null),_e=g.useRef(null),Ue=g.useRef(null),qe=g.useRef(null),Fe=g.useRef(null),He=g.useRef(null),Le=g.useRef(null),Ye=g.useRef(null),lt=g.useRef(null),Oe=g.useRef(null),ut=g.useRef(null),ht=g.useRef(null),Qe=g.useRef(new ue),nt=g.useRef(new ue),mt=g.useRef(new ue(1,1,1)),tt=g.useRef(new ue(1,1,1)),gt=g.useRef(0),Ve=g.useRef(0),je=g.useRef([]),et=g.useRef([]),bt=g.useRef([]),St=g.useRef([]),Pt=g.useRef([]),Yt=g.useRef([]),zt=g.useMemo(()=>({lng:w}),[w]),Rt=g.useMemo(()=>new _t,[]),Ct=g.useMemo(()=>new yu,[]),yt=r/2,at=i/2,Et=a/2,Lt=g.useMemo(()=>new ue(-yt,-at,Et),[yt,at,Et]),Je=g.useMemo(()=>new ue(-yt,at,Et),[yt,at,Et]),st=g.useMemo(()=>new ue(yt,-at,Et),[yt,at,Et]),It=g.useMemo(()=>new ue(yt,at,Et),[yt,at,Et]),ot=l2(),it=ot,Be=ot,pt=ot*4,ct=at+pt,Xe=g.useRef(!1),ft=g.useRef(null),wt=H(GRt),kt=H(HJe),Zt=g.useMemo(()=>new ue,[]);if(Ue.current){let gn=-1;switch(Ue.current.type){case z.SolarPanel:{gn=Ue.current.poleHeight;break}case z.ParabolicTrough:{const tn=Ue.current;gn=tn.poleHeight+tn.lx/2;break}case z.ParabolicDish:{const tn=Ue.current;gn=tn.poleHeight+tn.lx/2+tn.lx*tn.lx/(4*tn.latusRectum);break}case z.FresnelReflector:{const tn=Ue.current;gn=tn.poleHeight+tn.lx/2;break}}gn>=0&&Zt.set(0,0,(t==null?void 0:t.lz)/2+gn)}g.useEffect(()=>{Re.current.clear();for(const gn of H.getState().elements)gn.type===z.Wall&&gn.parentId===e&&Re.current.set(gn.id,gn)},[e,_]),g.useEffect(()=>{O&&O===we.current&&(Re.current.delete(O),Se.current=!1,Me.current=!1,we.current=null,A(gn=>{gn.addedWallId===gn.deletedWallId&&(gn.addedWallId=null),gn.deletedWallId=null}),jn.getState().setEnableOrbitController(!0),Ae({show:!1,direction:null,position:null}),ge([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]))},[O]),g.useEffect(()=>{if(t&&ne){const gn=le(t.id);pe(gn?ye.fetchHeatmapTexture(gn,te??5):null)}},[ne,te,$]),g.useEffect(()=>{!Xe.current||!H.getState().getAutoDeletedElements()||Ot()},[wt,kt]);const Ot=A3.debounce(()=>{if(!ft.current)return;const gn=H.getState().getAutoDeletedElements();if(!gn)return;const{wall:tn,newAngle:Gt,newJoints:wn}=ft.current,Cn={name:"Move Wall",timestamp:Date.now(),id:tn.id,oldPoints:[[...Pt.current[0]],[...Pt.current[1]]],newPoints:[[...tn.leftPoint],[...tn.rightPoint]],oldJoints:[[...bt.current[0]],[...bt.current[1]]],newJoints:[[...wn[0]],[...wn[1]]],oldAngle:gt.current,newAngle:Gt,flippedWallSide:Te.current,autoDeletedElements:[...gn],undo(){switch(this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const Nt=C(this.newJoints[0][0]);Nt&&lr(Nt);break}case Qr.right:{const Nt=C(this.newJoints[1][0]);Nt&&xo(Nt);break}}const[Wn,Un]=this.oldJoints,[rt,vt]=this.newJoints;A(Nt=>{for(const Ft of Nt.elements)if(Ft.id===this.id){const[en,sn]=this.oldPoints;Ft.cx=(en[0]+sn[0])/2,Ft.cy=(en[1]+sn[1])/2,Ft.lx=Math.hypot(en[0]-sn[0],en[1]-sn[1]);const dn=Ft;dn.relativeAngle=this.oldAngle,dn.leftPoint=[...en],dn.rightPoint=[...sn],dn.leftJoints=[...Wn],dn.rightJoints=[...Un];break}Nt.resizeHandleType=null,Nt.elements.push(...this.autoDeletedElements),Nt.deletedRoofId=null,Nt.autoDeletedChild=null,Nt.autoDeletedRoofs=null,Nt.autoDeletedRoofIdSet.clear()}),Wn[0]!==rt[0]&&A(Nt=>{for(const Ft of Nt.elements)Ft.type===z.Wall&&(Ft.id===Wn[0]&&(Ft.rightJoints=[this.id]),Ft.id===rt[0]&&(this.flippedWallSide!==Qr.left?Ft.rightJoints=[]:Ft.leftJoints=[]))}),Un[0]!==vt[0]&&A(Nt=>{for(const Ft of Nt.elements)Ft.type===z.Wall&&(Ft.id===Un[0]&&(Ft.leftJoints=[this.id]),Ft.id===vt[0]&&(this.flippedWallSide!==Qr.right?Ft.leftJoints=[]:Ft.rightJoints=[]))}),Te.current=Qr.null},redo(){const[Wn,Un]=this.oldJoints,[rt,vt]=this.newJoints;switch(A(Ft=>{for(const en of Ft.elements)if(en.id===this.id&&en.type===z.Wall){const[sn,dn]=this.newPoints;en.cx=(sn[0]+dn[0])/2,en.cy=(sn[1]+dn[1])/2,en.lx=Math.hypot(sn[0]-dn[0],sn[1]-dn[1]);const En=en;En.relativeAngle=this.newAngle,En.leftPoint=[...sn],En.rightPoint=[...dn],En.leftJoints=[...rt],En.rightJoints=[...vt];break}}),Wn[0]!==rt[0]&&A(Ft=>{for(const en of Ft.elements)en.type===z.Wall&&(en.id===Wn[0]&&(en.rightJoints=[]),en.id===rt[0]&&(this.flippedWallSide===Qr.right?en.leftJoints=[this.id]:en.rightJoints=[this.id]))}),Un[0]!==vt[0]&&A(Ft=>{for(const en of Ft.elements)en.type===z.Wall&&(en.id===Un[0]&&(en.leftJoints=[]),en.id===vt[0]&&(this.flippedWallSide===Qr.right?en.rightJoints=[this.id]:en.leftJoints=[this.id]))}),this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const Ft=C(this.newJoints[0][0]);Ft&&xo(Ft);break}case Qr.right:{const Ft=C(this.newJoints[1][0]);Ft&&lr(Ft);break}}const Nt=new Set(this.autoDeletedElements.map(Ft=>Ft.id));A(Ft=>{Ft.resizeHandleType=null,Ft.elements=Ft.elements.filter(sn=>!Nt.has(sn.id));const en=this.autoDeletedElements.find(sn=>sn.type===z.Roof);en&&(Ft.deletedRoofId=en.id)}),Te.current=Qr.null}};ee(Cn),Xe.current=!1,A(Wn=>{Wn.autoDeletedRoofs=null,Wn.autoDeletedRoofIdSet.clear(),Wn.autoDeletedChild=null})},100),on=gn=>{Rt.x=gn.offsetX/he.clientWidth*2-1,Rt.y=-(gn.offsetY/he.clientHeight)*2+1,Ct.setFromCamera(Rt,de)},qt=gn=>{switch(gn){case Xi.Texture01:return{x:1,y:1};case Xi.Texture02:return{x:2,y:2};case Xi.Texture03:return{x:.4,y:.4};case Xi.Texture04:return{x:.25,y:.25};case Xi.Texture05:return{x:5,y:5};case Xi.Texture06:return{x:1,y:1};case Xi.Texture07:return{x:1,y:1};default:return{x:1,y:1}}},Pn=Up((gn=>{switch(gn){case Xi.Texture01:return Dot;case Xi.Texture02:return Eot;case Xi.Texture03:return kot;case Xi.Texture04:return Fot;case Xi.Texture05:return Lot;case Xi.Texture06:return Wot;case Xi.Texture07:return Not;default:return Gg}})(p)),fo=g.useMemo(()=>{const gn=Pn.clone();gn.wrapS=gn.wrapT=es;const tn=qt(p);return gn.repeat.set(r/tn.x,i/tn.y),gn.needsUpdate=!0,gn},[Pn,r,i]),to=g.useCallback((gn,tn)=>{dt.getState().duringCameraInteraction||gn.intersections.length>0&&(gn.intersections[0].object===gn.eventObject||gn.intersections.length>1&&gn.intersections[1].object===gn.eventObject)&&(A(wn=>{wn.hoveredHandle=tn}),ye.isMoveHandle(tn)?he.style.cursor="move":tn===ai.Lower||tn===ai.Upper?he.style.cursor="grab":he.style.cursor=H.getState().addedFoundationId?"crosshair":"pointer")},[]),Dt=g.useCallback(()=>{A(gn=>{gn.hoveredHandle=null}),he.style.cursor=H.getState().addedFoundationId?"crosshair":"default"},[]),fn=gn=>{switch(gn){case z.Human:case z.Tree:case z.Flower:case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Wall:case z.BatteryStorage:return!0;default:return!1}},kn=(gn,tn)=>{let Gt=tn,wn=null,Cn=null,Wn=null,Un;if(!H.getState().enableFineGrid)for(const[rt,vt]of Re.current){if(rt===we.current||Ue.current&&rt===Ue.current.id)continue;const Nt=new ue(vt.leftPoint[0],vt.leftPoint[1],0),Ft=new ue(vt.rightPoint[0],vt.rightPoint[1],0),en=(Nt==null?void 0:Nt.distanceTo(gn))??Number.MAX_VALUE,sn=(Ft==null?void 0:Ft.distanceTo(gn))??Number.MAX_VALUE,dn=en<=sn,En=dn?en:sn,xn=dn?Nt:Ft;En<=Gt+.01&&(Gt=En,wn=xn,Un=dn?vt.leftJoints[0]:vt.rightJoints[0],Cn=rt,Wn=dn?Eg.Left:Eg.Right)}return{id:Cn,point:wn,side:Wn,jointId:Un}},yo=(gn,tn)=>(H.getState().enableFineGrid?(gn=ye.snapToFineGrid(gn),tn=null):tn?gn=tn:gn=ye.snapToNormalGrid(gn),gn),ur=gn=>{Re.current.clear();for(const Gt of H.getState().elements)Gt.type===z.Wall&&Gt.parentId===e&&Re.current.set(Gt.id,Gt);let tn=Re.current.get(gn);for(;tn&&tn.leftJoints.length>0;){const Gt=Re.current.get(tn.id);if(!Gt||(A(wn=>{for(const Cn of wn.elements)if(Cn.id===Gt.id){const Wn=Cn;Wn.relativeAngle=(Gt.relativeAngle+Math.PI)%fa,Wn.leftPoint=[...Gt.rightPoint],Wn.rightPoint=[...Gt.leftPoint],Wn.leftJoints=[Gt.rightJoints[0]],Wn.rightJoints=[Gt.leftJoints[0]];break}}),tn=Re.current.get(tn.leftJoints[0]),tn&&tn.id===gn))break}A(Gt=>{Gt.updateWallMapOnFoundationFlag=!Gt.updateWallMapOnFoundationFlag,H.getState().resizeHandleType&&(Gt.resizeHandleType=H.getState().resizeHandleType===xt.LowerLeft?xt.LowerRight:xt.LowerLeft)}),Te.current=Te.current===Qr.null?Qr.loop:Qr.null},lr=(gn,tn)=>{Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);const Gt=gn;let wn=gn;for(;wn;){const Cn=Re.current.get(wn.id);if(!Cn)break;A(Un=>{for(const rt of Un.elements)if(Cn&&rt.id===Cn.id){const vt=rt;vt.relativeAngle=(Cn.relativeAngle+Math.PI)%fa,vt.leftPoint=[...Cn.rightPoint],vt.rightPoint=[...Cn.leftPoint],vt.leftJoints=Cn.rightJoints.length>0?[Cn.rightJoints[0]]:[],vt.rightJoints=Cn.leftJoints.length>0?[Cn.leftJoints[0]]:[];break}});let Wn;if(Cn.leftJoints.length>0&&(Wn=Re.current.get(Cn.leftJoints[0])),Wn&&Wn.id!==Gt.id)wn=Wn;else break}A(Cn=>{if(tn)for(const Wn of Cn.elements)Wn.type===z.Wall&&(Wn.id===Gt.id&&(Wn.leftJoints=[tn.id]),Wn.id===tn.id&&(Wn.rightJoints=[Gt.id]));Cn.updateWallMapOnFoundationFlag=!Cn.updateWallMapOnFoundationFlag,Cn.resizeHandleType=xt.LowerLeft}),Te.current=Te.current===Qr.null?Qr.right:Qr.null},xo=(gn,tn)=>{Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);const Gt=gn;let wn=gn;for(;wn;){const Cn=Re.current.get(wn.id);if(!Cn)break;A(Un=>{for(const rt of Un.elements)if(Cn&&rt.id===Cn.id){const vt=rt;vt.relativeAngle=(Cn.relativeAngle+Math.PI)%fa,vt.leftPoint=[...Cn.rightPoint],vt.rightPoint=[...Cn.leftPoint],vt.leftJoints=Cn.rightJoints.length>0?[Cn.rightJoints[0]]:[],vt.rightJoints=Cn.leftJoints.length>0?[Cn.leftJoints[0]]:[];break}});let Wn;if(Cn.rightJoints.length>0&&(Wn=Re.current.get(Cn.rightJoints[0])),Wn&&Wn.id!==Gt.id)wn=Wn;else break}A(Cn=>{if(tn)for(const Wn of Cn.elements)Wn.type===z.Wall&&(Wn.id===Gt.id&&(Wn.rightJoints=[tn.id]),Wn.id===tn.id&&(Wn.leftJoints=[Gt.id]));Cn.updateWallMapOnFoundationFlag=!Cn.updateWallMapOnFoundationFlag,Cn.resizeHandleType=xt.LowerRight}),Te.current=Te.current===Qr.null?Qr.left:Qr.null},wo=gn=>{let tn;Re.current.clear();for(const wn of H.getState().elements)wn.id===gn&&(tn=wn),wn.type===z.Wall&&wn.parentId===e&&Re.current.set(wn.id,wn);let Gt=!1;for(;tn&&tn.leftJoints.length>0;)if(tn=Re.current.get(tn.leftJoints[0]),(tn==null?void 0:tn.id)===gn){Gt=!0;break}if(Gt){let wn=0,Cn=0;for(;tn&&tn.leftJoints.length>0;){const Wn=Re.current.get(tn.leftJoints[0]),Un=(Math.PI*3-(tn.relativeAngle-Wn.relativeAngle))%fa;if(wn+=Un,Cn+=1,tn=Wn,tn.id===gn)break}wn>(Cn-2)*Math.PI+.1?ur(gn):Te.current!==Qr.null&&(Te.current=Qr.loop)}return Gt},Rr=gn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:gn,undo:()=>{E(tn.addedElement.id,!1)},redo:()=>{A(Gt=>{Gt.elements.push(tn.addedElement),Gt.selectedElement=tn.addedElement})}};ee(tn)},Eo=gn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:gn,flippedWallSide:Te.current,undo:()=>{const Gt=tn.addedElement;if(E(Gt.id,!1),(tn.flippedWallSide===Qr.right||tn.flippedWallSide===Qr.loop)&&Gt.rightJoints.length>0){const wn=C(Gt.rightJoints[0]);wn&&xo(wn)}else if(tn.flippedWallSide===Qr.left&&Gt.leftJoints.length>0){const wn=C(Gt.leftJoints[0]);wn&&lr(wn)}},redo:()=>{const Gt=tn.addedElement;if(tn.flippedWallSide===Qr.right||tn.flippedWallSide===Qr.loop&&Gt.rightJoints.length>0){const wn=C(Gt.rightJoints[0]);wn&&lr(wn)}else if(tn.flippedWallSide===Qr.left&&Gt.leftJoints.length>0){const wn=C(Gt.leftJoints[0]);wn&&xo(wn)}Gt.rightJoints.length>0&&R(Gt.rightJoints[0],[Gt.id]),Gt.leftJoints.length>0&&M(Gt.leftJoints[0],[Gt.id]),A(wn=>{wn.elements.push(Gt),wn.selectedElement=Gt,wn.updateWallMapOnFoundationFlag=!wn.updateWallMapOnFoundationFlag})}};ee(tn)},An=gn=>{const tn=H.getState().getAutoDeletedElements(),Gt={name:"Resize Wall",timestamp:Date.now(),resizedElementId:gn.id,resizedElementType:gn.type,oldPosition:Qe.current.clone(),newPosition:nt.current.clone(),oldDimension:mt.current.clone(),newDimension:tt.current.clone(),oldAngle:gt.current,newAngle:Ve.current,oldJoints:[[...bt.current[0]],[...bt.current[1]]],newJoints:[[...St.current[0]],[...St.current[1]]],oldPoint:[[...Pt.current[0]],[...Pt.current[1]]],newPoint:[[...Yt.current[0]],[...Yt.current[1]]],flippedWallSide:Te.current,autoDeletedElement:tn?[...tn]:[],undo:()=>{switch(Gt.flippedWallSide){case Qr.right:if(Gt.newJoints[1]){const wn=C(Gt.newJoints[1][0]);wn&&xo(wn)}break;case Qr.left:if(Gt.newJoints[0]){const wn=C(Gt.newJoints[0][0]);wn&&lr(wn)}break;case Qr.loop:if(Gt.newJoints[0]&&Gt.newJoints[1])ur(Gt.resizedElementId);else if(Gt.newJoints[1]){const wn=C(Gt.newJoints[1][0]);wn&&xo(wn)}else if(Gt.newJoints[0]){const wn=C(Gt.newJoints[0][0]);wn&&lr(wn)}break}A(wn=>{for(const Cn of wn.elements)if(Cn.id===Gt.resizedElementId){const Wn=Cn;switch(Wn.cx=Gt.oldPosition.x,Wn.cy=Gt.oldPosition.y,Wn.cz=Gt.oldPosition.z,Wn.lx=Gt.oldDimension.x,Wn.ly=Gt.oldDimension.y,Wn.lz=Gt.oldDimension.z,Wn.relativeAngle=Gt.oldAngle,Wn.leftJoints=[...Gt.oldJoints[0]],Wn.rightJoints=[...Gt.oldJoints[1]],Wn.leftPoint=[...Gt.oldPoint[0]],Wn.rightPoint=[...Gt.oldPoint[1]],Gt.flippedWallSide){case Qr.loop:{if(Gt.oldJoints[0]!==Gt.newJoints[1])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[1][0]&&(Un.rightJoints=[]),Un.id===Gt.oldJoints[0][0]&&(Un.rightJoints=[Gt.resizedElementId]));else if(Gt.oldJoints[1]!==Gt.newJoints[0])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[0][0]&&(Un.leftJoints=[]),Un.id===Gt.oldJoints[1][0]&&(Un.leftJoints=[Gt.resizedElementId]));break}case Qr.left:case Qr.right:{if(!Gt.oldJoints[0]&&Gt.newJoints[1]){for(const Un of wn.elements)if(Un.type===z.Wall&&Un.id===Gt.newJoints[1][0]){Un.leftJoints=[];break}}else if(!Gt.oldJoints[1]&&Gt.newJoints[0]){for(const Un of wn.elements)if(Un.type===z.Wall&&Un.id===Gt.newJoints[0][0]){Un.rightJoints=[];break}}else if(Gt.flippedWallSide===Qr.left&&Gt.oldJoints[0])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[1][0]&&(Un.leftJoints=[]),Un.id===Gt.oldJoints[0][0]&&(Un.rightJoints=[Wn.id]));else if(Gt.flippedWallSide===Qr.right&&Gt.oldJoints[1])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[0][0]&&(Un.rightJoints=[]),Un.id===Gt.oldJoints[1][0]&&(Un.leftJoints=[Wn.id]));break}case Qr.null:{if(Gt.oldJoints[0]!==Gt.newJoints[0])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[0][0]&&(Un.rightJoints=[]),Un.id===Gt.oldJoints[0][0]&&(Un.rightJoints=[Wn.id]));if(Gt.oldJoints[1]!==Gt.newJoints[1])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[1][0]&&(Un.leftJoints=[]),Un.id===Gt.oldJoints[1][0]&&(Un.leftJoints=[Wn.id]));wn.updateWallMapOnFoundationFlag=!wn.updateWallMapOnFoundationFlag;break}}break}wn.elements.push(...Gt.autoDeletedElement),wn.resizeHandleType=null,wn.deletedRoofId=null,wn.autoDeletedRoofs=null,wn.autoDeletedRoofIdSet.clear(),wn.autoDeletedChild=null}),Te.current=Qr.null},redo:()=>{Gt.autoDeletedElement.length>0&&E(Gt.autoDeletedElement[0].id,!1,!1,!0);const wn=new Set(Gt.autoDeletedElement.map(Cn=>Cn.id));switch(A(Cn=>{Cn.elements=Cn.elements.filter(Wn=>!wn.has(Wn.id));for(const Wn of Cn.elements)if(Wn.id===Gt.resizedElementId){const Un=Wn;switch(Un.cx=Gt.newPosition.x,Un.cy=Gt.newPosition.y,Un.cz=Gt.newPosition.z,Un.lx=Gt.newDimension.x,Un.ly=Gt.newDimension.y,Un.lz=Gt.newDimension.z,Gt.flippedWallSide){case Qr.left:Un.relativeAngle=(Gt.newAngle+Math.PI)%fa;for(const rt of Cn.elements)if(rt.type===z.Wall&&rt.id===Gt.oldJoints[0][0]){rt.rightJoints=[];break}break;case Qr.right:Un.relativeAngle=(Gt.newAngle+Math.PI)%fa;for(const rt of Cn.elements)if(rt.type===z.Wall&&rt.id===Gt.oldJoints[1][0]){rt.leftJoints=[];break}break;case Qr.loop:Un.relativeAngle=(Gt.newAngle+Math.PI)%fa,Un.leftJoints=[...Gt.newJoints[1]],Un.rightJoints=[...Gt.newJoints[0]],Un.leftPoint=[...Gt.newPoint[1]],Un.rightPoint=[...Gt.newPoint[0]];for(const rt of Cn.elements)rt.type===z.Wall&&(rt.id===Gt.newJoints[0][0]&&(rt.leftJoints=[Un.id]),rt.id===Gt.newJoints[1][0]&&(rt.rightJoints=[Un.id]));break;case Qr.null:if(Un.relativeAngle=Gt.newAngle,Un.leftJoints=[...Gt.newJoints[0]],Un.rightJoints=[...Gt.newJoints[1]],Un.leftPoint=[...Gt.newPoint[0]],Un.rightPoint=[...Gt.newPoint[1]],Gt.oldJoints[0][0]!==Gt.newJoints[0][0])for(const rt of Cn.elements)rt.type===z.Wall&&(rt.id===Gt.newJoints[0][0]&&(rt.rightJoints=[Un.id]),rt.id===Gt.oldJoints[0][0]&&(rt.rightJoints=[]));if(Gt.oldJoints[1][0]!==Gt.newJoints[1][0])for(const rt of Cn.elements)rt.type===z.Wall&&(rt.id===Gt.newJoints[1][0]&&(rt.leftJoints=[Un.id]),rt.id===Gt.oldJoints[1][0]&&(rt.leftJoints=[]));Cn.updateWallMapOnFoundationFlag=!Cn.updateWallMapOnFoundationFlag;break}break}Cn.resizeHandleType=null}),setTimeout(()=>{A(Cn=>{Cn.deletedRoofId=null,Cn.autoDeletedRoofs=null,Cn.autoDeletedRoofIdSet.clear()})}),Gt.flippedWallSide){case Qr.left:{const Cn=C(Gt.resizedElementId),Wn=C(Gt.newJoints[1][0]);xo(Cn,Wn);break}case Qr.right:{const Cn=C(Gt.resizedElementId),Wn=C(Gt.newJoints[0][0]);lr(Cn,Wn);break}case Qr.loop:Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);ur(Gt.resizedElementId);break}Te.current=Qr.null}};ee(Gt),A(wn=>{wn.actionState.wallHeight=gn.lz,wn.deletedRoofId=null,wn.autoDeletedRoofs=null,wn.autoDeletedRoofIdSet.clear(),wn.autoDeletedChild=[]})},Dn=(gn,tn,Gt)=>{if(gn.roofId)Xe.current=!0,ft.current={wall:gn,newAngle:tn,newJoints:[[...Gt[0]],[...Gt[1]]]};else{const wn={name:"Move Wall",timestamp:Date.now(),id:gn.id,oldPoints:[[...Pt.current[0]],[...Pt.current[1]]],newPoints:[[...gn.leftPoint],[...gn.rightPoint]],oldJoints:[[...bt.current[0]],[...bt.current[1]]],newJoints:[[...Gt[0]],[...Gt[1]]],oldAngle:gt.current,newAngle:tn,flippedWallSide:Te.current,undo(){switch(this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const vt=C(this.newJoints[0][0]);vt&&lr(vt);break}case Qr.right:{const vt=C(this.newJoints[1][0]);vt&&xo(vt);break}}const[Cn,Wn]=this.oldJoints,[Un,rt]=this.newJoints;A(vt=>{for(const Nt of vt.elements)if(Nt.id===this.id){const[Ft,en]=this.oldPoints;Nt.cx=(Ft[0]+en[0])/2,Nt.cy=(Ft[1]+en[1])/2,Nt.lx=Math.hypot(Ft[0]-en[0],Ft[1]-en[1]);const sn=Nt;sn.relativeAngle=this.oldAngle,sn.leftPoint=[...Ft],sn.rightPoint=[...en],sn.leftJoints=[...Cn],sn.rightJoints=[...Wn];break}vt.resizeHandleType=null}),Cn[0]!==Un[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Cn[0]&&(Nt.rightJoints=[this.id]),Nt.id===Un[0]&&(this.flippedWallSide!==Qr.left?Nt.rightJoints=[]:Nt.leftJoints=[]))}),Wn[0]!==rt[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Wn[0]&&(Nt.leftJoints=[this.id]),Nt.id===rt[0]&&(this.flippedWallSide!==Qr.right?Nt.leftJoints=[]:Nt.rightJoints=[]))}),Te.current=Qr.null},redo(){const[Cn,Wn]=this.oldJoints,[Un,rt]=this.newJoints;switch(A(vt=>{for(const Nt of vt.elements)if(Nt.id===this.id&&Nt.type===z.Wall){const[Ft,en]=this.newPoints;Nt.cx=(Ft[0]+en[0])/2,Nt.cy=(Ft[1]+en[1])/2,Nt.lx=Math.hypot(Ft[0]-en[0],Ft[1]-en[1]);const sn=Nt;sn.relativeAngle=this.newAngle,sn.leftPoint=[...Ft],sn.rightPoint=[...en],sn.leftJoints=[...Un],sn.rightJoints=[...rt];break}}),Cn[0]!==Un[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Cn[0]&&(Nt.rightJoints=[]),Nt.id===Un[0]&&(this.flippedWallSide===Qr.right?Nt.leftJoints=[this.id]:Nt.rightJoints=[this.id]))}),Wn[0]!==rt[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Wn[0]&&(Nt.leftJoints=[]),Nt.id===rt[0]&&(this.flippedWallSide===Qr.right?Nt.rightJoints=[this.id]:Nt.leftJoints=[this.id]))}),this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const vt=C(this.newJoints[0][0]);vt&&xo(vt);break}case Qr.right:{const vt=C(this.newJoints[1][0]);vt&&lr(vt);break}}A(vt=>{vt.resizeHandleType=null}),Te.current=Qr.null}};ee(wn)}},sr=gn=>{if(gn.button===2){gn.altKey&&L(e,gn,er.Select);return}A(wn=>{wn.contextMenuObjectType=null}),H.getState().objectTypeToAdd!==z.Window&&!q()&&L(e,gn,er.Select);const tn=P();let Gt=!1;if(gn.intersections[0].object.name===z.Polygon&&H.getState().objectTypeToAdd!==z.None&&(Gt=!0),(tn==null?void 0:tn.id)===e||Gt)if(fn(H.getState().objectTypeToAdd)){if(t){ve(!0);const wn=gn.intersections.filter(Wn=>!Wn.eventObject.name.startsWith("Wall Intersection Plane"))[0].point,Cn=j(t,wn);Cn&&Rr(Cn),A(Wn=>{Wn.actionModeLock||(Wn.objectTypeToAdd=z.None)})}}else jn.getState().selectNone(),jn.setState({foundationRef:Ne});else if(tn&&tn.parentId===e&&fn(tn.type))switch(Ue.current=tn,tn.type===z.Wall&&!Se.current&&(Ce.current=[...H.getState().elements]),ve(!0),Qe.current.set(tn.cx,tn.cy,tn.cz),mt.current.set(tn.lx,tn.ly,tn.lz),dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e),tn.type){case z.SolarPanel:case z.ParabolicTrough:case z.FresnelReflector:{gt.current=tn.relativeAzimuth;break}case z.Polygon:{je.current=tn.vertices.map(wn=>({...wn}));break}case z.Wall:{const wn=tn;gt.current=wn.relativeAngle,bt.current=[[...wn.leftJoints],[...wn.rightJoints]],Pt.current=[[...wn.leftPoint],[...wn.rightPoint]],Wo.current=wn.leftJoints[0],To.current=wn.rightJoints[0],Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);break}}if(Se.current&&we.current&&_e.current){const wn=Ct.intersectObjects([_e.current]);if(wn.length===0)return;let Cn=ye.wallRelativePosition(wn[0].point,t);se[0].position&&(Cn.setX(se[0].position[0]),Cn.setY(se[0].position[1]));const{id:Wn,point:Un,side:rt,jointId:vt}=kn(Cn,1.5);Cn=yo(Cn,Un);let Nt=xt.LowerRight;if(Wn){const Ft=C(Wn);rt===Eg.Right?A(en=>{for(const sn of en.elements)if(sn.type===z.Wall){if(sn.id===we.current){const dn=sn;dn.cx=Cn.x,dn.cy=Cn.y,Ft.rightJoints.length===0&&(dn.leftJoints=[Ft.id])}sn.id===Wn&&Ft.rightJoints.length===0&&(sn.rightJoints=we.current?[we.current]:[])}}):rt===Eg.Left&&!vt&&(A(en=>{for(const sn of en.elements)if(sn.type===z.Wall){if(sn.id===we.current){const dn=sn;dn.cx=Cn.x,dn.cy=Cn.y,Ft.leftJoints.length===0&&(dn.rightJoints=[Ft.id])}sn.id===Wn&&Ft.leftJoints.length===0&&(sn.leftJoints=we.current?[we.current]:[])}}),Nt=xt.LowerLeft)}else S(we.current,Cn.x,Cn.y);Se.current=!1,Me.current=!0,D(we.current,[Cn.x,Cn.y,Cn.z]),A(Ft=>{Ft.resizeHandleType=Nt,Ft.resizeAnchor=ye.wallAbsolutePosition(Cn,t)}),jn.getState().setEnableOrbitController(!1),Ue.current=tn}},Vo=gn=>{if(Cs&&Rs(!1),gn.altKey&&gn.button===2&&F&&F.length>0){A(wn=>{wn.pastePoint.copy(gn.intersections[0].point),wn.clickObjectType=z.Foundation,wn.pasteNormal=Oo});const Gt=W();if(Gt.length>0){const wn={name:"Paste to Point",timestamp:Date.now(),pastedElements:Gt.map(Cn=>({...Cn})),undo:()=>{for(const Cn of wn.pastedElements)E(Cn.id,!1)},redo:()=>{A(Cn=>{Cn.elements.push(...wn.pastedElements),Cn.selectedElement=wn.pastedElements[0]})}};ee(wn)}}if(!Ue.current||Ue.current.type===z.Tree||Ue.current.type===z.Flower||Ue.current.type===z.Human)return;const tn=C(Ue.current.id);if(tn){switch(tn.type){case z.Wall:{const Gt=tn;if(Se.current)A(wn=>{wn.elements.pop(),wn.addedWallId=null,wn.actionModeLock&&(wn.objectTypeToAdd=z.Wall,xb.selectNone(wn))}),we.current&&Re.current.delete(we.current),we.current=null,Se.current=!1,Me.current=!1;else if(Me.current&&we.current&&_e.current)jn.getState().setEnableOrbitController(!0),A(wn=>{wn.actionModeLock&&(wn.objectTypeToAdd=z.Wall,xb.selectNone(wn)),wn.addedWallId=null,Gt.lx===0&&Ce.current?(wn.elements=[...Ce.current],we.current&&Re.current.delete(we.current)):(Eo(Gt),Re.current.set(Gt.id,Gt))}),we.current=null,Me.current=!1;else if(H.getState().resizeHandleType)Gt.lx>.45?(Re.current.set(Gt.id,Gt),nt.current.set(Gt.cx,Gt.cy,Gt.cz),tt.current.set(Gt.lx,Gt.ly,Gt.lz),Ve.current=Gt.relativeAngle,St.current=[[...Gt.leftJoints],[...Gt.rightJoints]],Yt.current=[[...Gt.leftPoint],[...Gt.rightPoint]],An(Gt)):A(wn=>{Ce.current&&(wn.elements=[...Ce.current],Ce.current=null)});else if(H.getState().moveHandleType){let wn=Gt.relativeAngle,Cn=[],Wn=[];if(Wo.current)if(Gt.leftJoints.length>0&&(Wo.current!==Gt.leftJoints[0]||Wo.current===Gt.leftJoints[0]&&Go.current)&&M(Gt.leftJoints[0],[]),Go.current)R(Wo.current,[Gt.id]),Wn=[Wo.current];else if(Cn=[Wo.current],ho.current){R(Wo.current,[Gt.id]);const Un=C(Wo.current);Un&&xo(Un)}else M(Wo.current,[Gt.id]);else Gt.leftJoints.length>0&&Gt.leftJoints[0]!==To.current&&(Cn=[],M(Gt.leftJoints[0],[]));if(To.current)if(Gt.rightJoints.length>0&&(To.current!==Gt.rightJoints[0]||To.current===Gt.rightJoints[0]&&Go.current)&&Gt.rightJoints[0]!==Wo.current&&R(Gt.rightJoints[0],[]),Go.current)M(To.current,[Gt.id]),Cn=[To.current];else if(Wn=[To.current],No.current){M(To.current,[Gt.id]);const Un=C(To.current);Un&&lr(Un)}else R(To.current,[Gt.id]);else Gt.rightJoints.length>0&&Gt.rightJoints[0]!==Wo.current&&(Wn=[],R(Gt.rightJoints[0],[]));A(Un=>{for(const rt of Un.elements)if(rt.id===Gt.id&&rt.type===z.Wall){const vt=rt;if(Go.current&&(wn=(vt.relativeAngle+Math.PI)%fa,vt.relativeAngle=wn,[vt.leftPoint,vt.rightPoint]=[[...vt.rightPoint],[...vt.leftPoint]]),Cn.length===0&&Wn.length===0)vt.roofId=null;else if(Cn.length>0){const Nt=Un.elements.find(Ft=>Ft.id===Cn[0]);Nt&&(vt.roofId=Nt.roofId)}else if(Wn.length>0){const Nt=Un.elements.find(Ft=>Ft.id===Wn[0]);Nt&&(vt.roofId=Nt.roofId)}vt.leftJoints=[...Cn],vt.rightJoints=[...Wn];break}Un.updateWallMapOnFoundationFlag=!Un.updateWallMapOnFoundationFlag}),wo(Gt.id),Dn(Gt,wn,[[...Cn],[...Wn]]),Go.current=!1,ho.current=!1,No.current=!1,Wo.current=null,To.current=null}Te.current=Qr.null,A(wn=>{wn.updateWallMapOnFoundationFlag=!wn.updateWallMapOnFoundationFlag}),Ae({show:!1,direction:null,position:null}),ge([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]);break}case z.Polygon:{if(H.getState().moveHandleType||H.getState().resizeHandleType){et.current=tn.vertices.map(wn=>({...wn}));const Gt={name:H.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:je.current,newValue:et.current,changedElementId:tn.id,changedElementType:tn.type,undo:()=>{U(Gt.changedElementId,Gt.oldValue)},redo:()=>{U(Gt.changedElementId,Gt.newValue)}};ee(Gt)}break}default:if(H.getState().resizeHandleType){if(nt.current.set(tn.cx,tn.cy,tn.cz),tt.current.set(tn.lx,tn.ly,tn.lz),nt.current.distanceToSquared(Qe.current)>Ht||tt.current.distanceToSquared(mt.current)>Ht){const Gt={name:"Resize",timestamp:Date.now(),resizedElementId:Ue.current.id,resizedElementType:Ue.current.type,oldCx:Qe.current.x,oldCy:Qe.current.y,oldCz:Qe.current.z,newCx:nt.current.x,newCy:nt.current.y,newCz:nt.current.z,oldLx:mt.current.x,oldLy:mt.current.y,oldLz:mt.current.z,newLx:tt.current.x,newLy:tt.current.y,newLz:tt.current.z,undo:()=>{S(Gt.resizedElementId,Gt.oldCx,Gt.oldCy,Gt.oldCz),v(Gt.resizedElementId,Gt.oldLx,Gt.oldLy,Gt.oldLz)},redo:()=>{S(Gt.resizedElementId,Gt.newCx,Gt.newCy,Gt.newCz),v(Gt.resizedElementId,Gt.newLx,Gt.newLy,Gt.newLz)}};ee(Gt)}}else if(H.getState().rotateHandleType){if(ye.isSolarCollector(Ue.current)){const Gt=Ue.current;if(Math.abs(Ve.current-gt.current)>Ht)if(Uu(Gt,Ve.current)){A(Cn=>{Cn.selectedElementAngle=Ve.current});const wn={name:"Rotate",timestamp:Date.now(),oldValue:gt.current,newValue:Ve.current,changedElementId:Gt.id,changedElementType:Gt.type,undo:()=>{k(wn.changedElementId,wn.oldValue)},redo:()=>{k(wn.changedElementId,wn.newValue)}};ee(wn)}else k(Gt.id,gt.current)}}else if(nt.current.set(tn.cx,tn.cy,tn.cz),nt.current.distanceToSquared(Qe.current)>Ht){let Gt=!0;ye.isSolarCollector(tn)&&(Gt=xi(tn,tn.cx,tn.cy)),Gt?O0.addUndoableMove():A(wn=>{const Cn=wn.elements.find(vt=>vt.id===tn.id);if(!Cn||!wn.selectedElement)return;const Wn=wn.selectedElement;Cn.cx=Wn.cx,Cn.cy=Wn.cy,Cn.cz=Wn.cz,Cn.rotation=[...Wn.rotation],Cn.normal=[...Wn.normal];const Un=dt.getState().oldParentId,rt=dt.getState().oldFoundationId;Un&&(Cn.parentId=Un),rt&&(Cn.foundationId=rt)})}}ve(!1),Ue.current=null,A(Gt=>{Gt.resizeHandleType=null,Gt.moveHandleType=null})}},Wo=g.useRef(null),To=g.useRef(null),Go=g.useRef(!1),No=g.useRef(!1),ho=g.useRef(!1),vo=(gn,tn,Gt)=>{let wn=Math.atan2(tn.y-gn.y,tn.x-gn.x)-(Gt===xt.LowerLeft?Math.PI:0);return wn=wn>=0?wn:(fa+wn)%fa,wn},bo=(gn,tn)=>{let wn=null,Cn=null,Wn=1/0,Un=1/0;for(const[rt,vt]of Re.current)if(Ue.current!==null&&vt.id!==Ue.current.id&&vt.id!==tn){const Nt=Math.abs(gn.x-vt.leftPoint[0]),Ft=Math.abs(gn.x-vt.rightPoint[0]),en=Math.abs(gn.y-vt.leftPoint[1]),sn=Math.abs(gn.y-vt.rightPoint[1]);Nt<1&&Nt{const Wn=vo(gn,tn,Gt);let Un=null,rt=null;return Wn<.05||Wn>fa-.05||Math.abs(Wn-Math.PI)<.05||Math.abs(tn.y-gn.y)<1?rt=gn.y:(Math.abs(Wn-Math.PI/2)<.05||Math.abs(Wn-3*Math.PI/2)<.05||Math.abs(tn.x-gn.x)<1)&&(Un=gn.x),[Un,rt]},Pr=(gn,tn,Gt,wn)=>{const[Cn,Wn]=bo(tn),[Un,rt]=Bo(gn,tn,Gt),vt=so(tn.x,Cn,Un),Nt=so(tn.y,Wn,rt);return new ue(vt,Nt,tn.z)},so=(gn,tn,Gt)=>tn!==null&&Gt!==null?Math.abs(tn-gn){let[wn,Cn]=[1/0,1/0],Wn=null,Un=null;for(const[rt,vt]of Re.current)if(Ue.current!==null&&vt.id!==Ue.current.id&&vt.id!==Gt){const Nt=Math.abs(gn.x-vt.leftPoint[0]),Ft=Math.abs(gn.x-vt.rightPoint[0]);Nt<.01&&Nt{Wn!==null&&Un!==null?(rt[tn].direction="xy",rt[tn].position=[Wn,Un]):Wn!==null?(rt[tn].direction="y",rt[tn].position=[Wn,gn.y]):Un!==null?(rt[tn].direction="x",rt[tn].position=[gn.x,Un]):(rt[tn].direction=null,rt[tn].position=null)})),[Wn!==null,Un!==null]},Ci=(gn,tn)=>Math.abs(tn)<.01||Math.abs(tn-Math.PI)<.01?(Ae(Gt=>({...Gt,direction:"x",position:[gn.x,gn.y]})),[!0,!1]):Math.abs(tn-Math.PI/2)<.01||Math.abs(tn-3*Math.PI/2)<.01?(Ae(Gt=>({...Gt,direction:"y",position:[gn.x,gn.y]})),[!1,!0]):(Ae(Gt=>({...Gt,direction:null,position:null})),[!1,!1]),ea=(gn,tn)=>{ge(Dv(Gt=>{Gt[0].show=gn})),Ae(Gt=>({...Gt,show:tn}))},rs=(gn,tn)=>{const[Gt,wn]=zo(gn),[Cn,Wn]=Ci(gn,tn);Gt&&wn?ea(!0,!1):Gt?ea(!0,!Wn&&Cn):wn?ea(!0,!Cn&&Wn):ea(!1,Cn||Wn)},Da=gn=>{var Wn,Un;if(!t||(Vs(gn),Ue.current&&ye.isSolarCollector(Ue.current)))return;const tn=H.getState().objectTypeToAdd;if(!Ue.current&&!we.current&&tn!==z.Wall||((Wn=Ue.current)==null?void 0:Wn.parentId)!==e&&tn===z.None)return;const Gt=H.getState().moveHandleType,wn=H.getState().resizeHandleType,Cn=H.getState().resizeAnchor;if(on(gn),_e.current){const rt=Ct.intersectObjects([_e.current]);if(rt.length===0)return;let vt=rt[0].point;if(Ue.current&&Ue.current.type&&!Ue.current.locked&&rt.length>0)switch(ve(!0),Ue.current.type){case z.Sensor:case z.Light:case z.WindTurbine:{vt=ye.relativeCoordinates(vt.x,vt.y,vt.z,t),S(Ue.current.id,vt.x,vt.y);break}case z.Polygon:{const Nt=Ue.current;if(Gt===Ho.Default){vt=ye.relativeCoordinates(vt.x,vt.y,vt.z,t);const Ft=ye.calculatePolygonCentroid(Nt.vertices),en=vt.x-Ft.x,sn=vt.y-Ft.y,dn=Nt.vertices.map(En=>({...En}));dn.forEach(En=>{En.x+=en,En.y+=sn}),U(Nt.id,dn)}else wn===xt.Default&&(vt.x-=t.cx,vt.y-=t.cy,vt.applyEuler(new cn().fromArray(t.rotation.map(Ft=>-Ft))),vt=H.getState().enableFineGrid?ye.snapToFineGrid(vt):ye.snapToNormalGrid(vt),vt.x/=t.lx,vt.y/=t.ly,N(Nt.id,Nt.selectedIndex,vt.x,vt.y));break}case z.Wall:{if(((Un=H.getState().selectedElement)==null?void 0:Un.type)!==z.Wall)break;if(wn&&(wn===xt.LowerLeft||wn===xt.LowerRight)){const Nt=ye.wallRelativePosition(Cn,t);vt=ye.wallRelativePosition(vt,t);let Ft=null;H.getState().enableFineGrid?vt=ye.snapToFineGrid(vt):(Ft=kn(vt,1.5),Ft!=null&&Ft.point?vt=Ft.point:(vt=ye.snapToNormalGrid(vt),vt=Pr(Nt,vt,wn),Ft=kn(vt,1.5),Ft!=null&&Ft.point&&(vt=Ft.point)));const en=vo(Nt,vt,wn);rs(vt,en);const sn=vt.distanceTo(Nt),dn=new ue().addVectors(vt,Nt).divideScalar(2),En=wn===xt.LowerLeft?vt:Nt,xn=wn===xt.LowerLeft?Nt:vt;A(_n=>{for(const Vn of _n.elements)if(Vn.id===Ue.current.id&&Vn.type===z.Wall){const Gn=Vn;Gn.cx=dn.x,Gn.cy=dn.y,Gn.lx=sn,Gn.relativeAngle=en,Gn.leftPoint=[En.x,En.y,0],Gn.rightPoint=[xn.x,xn.y,0];break}});const Tn=C(Ue.current.id);if(Tn){if(Ft&&Ft.point){if(Ft.id&&Ft.side&&!Ft.jointId){const _n=C(Ft.id);if(_n){if(wn===xt.LowerLeft&&_n.leftJoints.length===0&&Ft.side===Eg.Left){if(Tn.leftJoints.length>0&&Tn.leftJoints[0]!==Ft.id){const Vn=Tn.leftJoints[0];A(Gn=>{for(const go of Gn.elements)if(go.id===Vn&&go.type===z.Wall){go.rightJoints=[];break}})}xo(Tn,_n)}else if(wn===xt.LowerRight&&_n.rightJoints.length===0&&Ft.side===Eg.Right){if(Tn.rightJoints.length>0&&Tn.rightJoints[0]!==Ft.id){const Vn=Tn.rightJoints[0];A(Gn=>{for(const go of Gn.elements)if(go.id===Vn&&go.type===z.Wall){go.leftJoints=[];break}})}lr(Tn,_n)}else wn===xt.LowerRight&&Ft.side===Eg.Left&&_n.leftJoints.length===0&&_n.rightJoints[0]!==Tn.id?A(Vn=>{let Gn=null;Tn.rightJoints.length>0&&Tn.rightJoints[0]!==(Ft==null?void 0:Ft.id)&&(Gn=Tn.rightJoints[0]);for(const go of Vn.elements)go.type===z.Wall&&(go.id===Tn.id&&(go.rightJoints=[_n.id]),go.id===_n.id&&(go.leftJoints=[Tn.id]),go.id===Gn&&(go.leftJoints=[]))}):wn===xt.LowerLeft&&Ft.side===Eg.Right&&_n.rightJoints.length===0&&_n.leftJoints[0]!==Tn.id&&A(Vn=>{let Gn=null;Tn.leftJoints.length>0&&Tn.leftJoints[0]!==(Ft==null?void 0:Ft.id)&&(Gn=Tn.leftJoints[0]);for(const go of Vn.elements)go.type===z.Wall&&(go.id===Tn.id&&(go.leftJoints=[_n.id]),go.id===_n.id&&(go.rightJoints=[Tn.id]),go.id===Gn&&(go.rightJoints=[]))});wo(Tn.id)}}}else if(wn===xt.LowerRight&&Tn.rightJoints.length>0){const _n=Tn.rightJoints[0];A(Vn=>{for(const Gn of Vn.elements)Gn.type===z.Wall&&(Gn.id===Tn.id&&(Gn.rightJoints=[]),Gn.id===_n&&(Gn.leftJoints=[]));Vn.updateWallMapOnFoundationFlag=!Vn.updateWallMapOnFoundationFlag})}else if(wn===xt.LowerLeft&&Tn.leftJoints.length>0){const _n=Tn.leftJoints[0];A(Vn=>{for(const Gn of Vn.elements)Gn.type===z.Wall&&(Gn.id===Tn.id&&(Gn.leftJoints=[]),Gn.id===_n&&(Gn.rightJoints=[]));Vn.updateWallMapOnFoundationFlag=!Vn.updateWallMapOnFoundationFlag})}}}else if(Gt){const Nt=C(Ue.current.id);if(Nt){vt=ye.wallRelativePosition(vt,t);const Ft=new ue,en=new cn(0,0,Nt.relativeAngle);Gt===Ho.Lower?Ft.setY(ot):Gt===Ho.Upper&&Ft.setY(-ot-Nt.ly),vt.add(Ft.applyEuler(en));const sn=new ue().addVectors(vt,new ue(-Nt.lx/2,0,0).applyEuler(en)),dn=new ue().addVectors(vt,new ue(Nt.lx/2,0,0).applyEuler(en));let En=null,xn=null,Tn=!1;Go.current=!1,ho.current=!1,No.current=!1,Wo.current=null,To.current=null;const _n=(Vn,Gn)=>{const go=Gn==="left"?sn:dn,qo=new ue().subVectors(Vn,go);vt.add(qo),sn.add(qo),dn.add(qo)};if(!H.getState().enableFineGrid){let Vn=kn(sn,1);Vn.point?(_n(Vn.point,"left"),Vn.id&&(!Vn.jointId||Vn.jointId===Nt.id)&&(Wo.current=Vn.id,En=Vn.side===Eg.Left)):Wo.current=null;let Gn=kn(dn,1);if(Gn.point?(Vn.id||_n(Gn.point,"right"),Gn.id&&(!Gn.jointId||Gn.jointId===Nt.id)&&(Vn.id!==Gn.id||Vn.side!==Gn.side)&&(To.current=Gn.id,xn=Gn.side===Eg.Right)):To.current=null,!Vn.point&&!Gn.point){const[na,k0]=bo(sn),[Gh,cc]=bo(dn);if(na!==null||Gh!==null){const wu=(na??1/0)-sn.x,ps=(Gh??1/0)-dn.x,ud=Math.min(wu,ps);sn.setX(sn.x+ud),dn.setX(dn.x+ud),vt.setX(vt.x+ud),Vn=kn(sn,1),Vn.point?(_n(Vn.point,"left"),Vn.id&&(!Vn.jointId||Vn.jointId===Nt.id)&&(Wo.current=Vn.id,En=Vn.side===Eg.Left)):Wo.current=null}if(k0!==null||cc!==null){const wu=(k0??1/0)-sn.y,ps=(cc??1/0)-dn.y,ud=Math.min(wu,ps);sn.setY(sn.y+ud),dn.setY(dn.y+ud),vt.setY(vt.y+ud),Gn=kn(dn,1),Gn.point?(Vn.id||_n(Gn.point,"right"),Gn.id&&(!Gn.jointId||Gn.jointId===Nt.id)&&(Vn.id!==Gn.id||Vn.side!==Gn.side)&&(To.current=Gn.id,xn=Gn.side===Eg.Right)):To.current=null}}const[go,qo]=zo(sn,0),[Xr,qr]=zo(dn,1);ge(Dv(na=>{na[0].show=go||qo,na[1].show=Xr||qr})),En&&xn===null||xn&&En===null||En&&xn?Go.current=!0:(En&&xn===!1||xn&&En===!1)&&(ho.current=En,No.current=xn),Vn.point&&Gn.point&&(Vn.id!==Gn.id||Vn.side!==Gn.side)&&(sn.copy(Vn.point),dn.copy(Gn.point),Tn=!0)}A(Vn=>{var Gn;for(const go of Vn.elements)if(go.id===((Gn=Ue.current)==null?void 0:Gn.id)&&go.type===z.Wall){const qo=go;if(Tn){qo.cx=(sn.x+dn.x)/2,qo.cy=(sn.y+dn.y)/2,qo.lx=sn.distanceTo(dn);let Xr=Math.atan2(dn.y-sn.y,dn.x-sn.x);Xr=Xr>=0?Xr:(fa+Xr)%fa,qo.relativeAngle=Xr}else qo.cx=vt.x,qo.cy=vt.y;qo.leftPoint=sn.toArray(),qo.rightPoint=dn.toArray();break}})}}break}}if(tn===z.Wall&&!Se.current){Ce.current=[...H.getState().elements];const Nt=j(t,vt);Ue.current=Nt,we.current=Nt.id,Se.current=!0,ve(!0),jn.getState().setEnableOrbitController(!1),A(Ft=>{Ft.addedWallId=Nt.id,Ft.objectTypeToAdd=z.None})}if(we.current&&Se.current){vt=ye.wallRelativePosition(rt[0].point,t);let Nt=null;if(H.getState().enableFineGrid)vt=ye.snapToFineGrid(vt);else if(Nt=kn(vt,1.5),Nt!=null&&Nt.point)vt=Nt.point;else{vt=ye.snapToNormalGrid(vt);const[sn,dn]=bo(vt);sn!==null&&vt.setX(sn),dn!==null&&vt.setY(dn),Nt=kn(vt,1.5),Nt!=null&&Nt.point&&(vt=Nt.point)}const[Ft,en]=zo(vt);ge(Dv(sn=>{sn[0].show=Ft||en})),S(we.current,vt.x,vt.y)}}},or=gn=>{gn.intersections.length>0&&gn.intersections[0].object===_e.current&&ce(!0)},cr=gn=>{A(tn=>{xb.selectMe(tn,e,gn,er.ContextMenu),tn.pastePoint.copy(gn.intersections[0].point),tn.clickObjectType=z.Foundation,tn.pasteNormal=Oo,gn.altKey?tn.contextMenuObjectType=null:gn.intersections.length>0&&gn.intersections[0].object===_e.current&&(tn.contextMenuObjectType=z.Foundation),tn.pasteNormal=Oo})},ii=()=>{Cs&&(Rs(!1),Ue.current=null),ce(!1),ve(!1),Ue.current&&Se.current&&(E(Ue.current.id,!1),Se.current=!1,A(gn=>{gn.addedWallId=null,gn.objectTypeToAdd=z.Wall}),Ue.current=null),Ae({show:!1,direction:null,position:null}),ge([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}])},Ga=gn=>{Ue.current&&ye.isPlantOrHuman(Ue.current)&&gn.intersections[0].object===_e.current&&ve(!0)},xi=(gn,tn,Gt)=>{const wn=JSON.parse(JSON.stringify(gn));return wn.cx=tn,wn.cy=Gt,ae(wn)?(co(B.t("message.MoveCancelledBecauseOfOverlap",zt)),!1):ye.isSolarCollectorWithinHorizontalSurface(wn,t)?!0:(co(B.t("message.MoveOutsideBoundaryCancelled",zt)),!1)},Uu=(gn,tn)=>{const Gt=JSON.parse(JSON.stringify(gn));return Gt.relativeAzimuth=tn,ae(Gt)?(co(B.t("message.RotationCancelledBecauseOfOverlap",zt)),!1):ye.isSolarCollectorWithinHorizontalSurface(Gt,t)?!0:(co(B.t("message.RotationOutsideBoundaryCancelled",zt)),!1)},_s=(gn,tn,Gt,wn,Cn)=>{if(gn.type===z.SolarPanel&&gn.tiltAngle!==0&&.5*Cn*Math.abs(Math.sin(gn.tiltAngle))>gn.poleHeight)return!1;const Wn=JSON.parse(JSON.stringify(gn));return Wn.cx=tn,Wn.cy=Gt,Wn.lx=wn,Wn.ly=Cn,ye.isSolarCollectorWithinHorizontalSurface(Wn,t)},sc=gn=>{if(qe.current&&t&&Ue.current&&t){if(!ye.isSolarCollector(Ue.current))return;const tn=Ue.current;on(gn);const Gt=Ct.intersectObjects([qe.current]);if(Gt.length>0){let wn=Gt[0].point;const Cn=H.getState().moveHandleType,Wn=H.getState().rotateHandleType,Un=H.getState().resizeHandleType;if(Cn&&t)wn=ye.relativeCoordinates(wn.x,wn.y,wn.z,t),S(tn.id,wn.x,wn.y),tn.parentId!==e&&H.getState().set(rt=>{const vt=rt.elements.find(Nt=>Nt.id===tn.id&&Nt.type===z.SolarPanel);vt&&(vt.parentId!==e||vt.foundationId!==e)&&(vt.parentId=e,vt.foundationId=e,vt.parentType=z.Foundation,rt.selectedElement&&(rt.selectedElement.parentId=e,vt.color=rt.selectedElement.color))});else if(Wn){if(Wn===ai.Upper||Wn===ai.Lower){const rt=t.rotation[2],vt=new _t(t.cx,t.cy),Nt=new _t(t.lx*tn.cx,t.ly*tn.cy).rotateAround(ui,rt),Ft=new _t().addVectors(Nt,vt),en=Math.atan2(-wn.x+Ft.x,wn.y-Ft.y)-rt+(Wn===ai.Lower?0:Math.PI),sn=Math.abs(en)>Math.PI?-Math.sign(en)*fa:0,dn=en+sn;k(tn.id,dn),Ve.current=dn}}else if(Un){const rt=H.getState().resizeAnchor,vt=new _t(wn.x,wn.y),Nt=new _t(rt.x,rt.y),Ft=vt.distanceTo(Nt),en=tn.relativeAzimuth+l[2],sn=new _t().subVectors(vt,Nt),dn=new _t(n,o);if(tn.type===z.SolarPanel){const En=tn,xn=Y(En.pvModelName);switch(Un){case xt.Lower:case xt.Upper:{const Tn=Un===xt.Lower?1:-1,_n=sn.angle()-en+Tn*$t;let Vn=Ft*Math.cos(_n);En.orientation===br.portrait?Vn=Math.max(1,Math.ceil((Vn-xn.length/2)/xn.length))*xn.length:Vn=Math.max(1,Math.ceil((Vn-xn.width/2)/xn.width))*xn.width;const Gn=rt.x+Tn*(Vn*Math.sin(en))/2,go=rt.y-Tn*(Vn*Math.cos(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,tn.lx,Vn)&&(T(tn.id,Vn),S(tn.id,qr,na))}break;case xt.Left:case xt.Right:{const Tn=Un===xt.Left?-1:1,_n=sn.angle()-en+(Un===xt.Left?Math.PI:0);let Vn=Ft*Math.cos(_n);En.orientation===br.portrait?Vn=Math.max(1,Math.ceil((Vn-xn.width/2)/xn.width))*xn.width:Vn=Math.max(1,Math.ceil((Vn-xn.length/2)/xn.length))*xn.length;const Gn=rt.x+Tn*(Vn*Math.cos(en))/2,go=rt.y+Tn*(Vn*Math.sin(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,Vn,tn.ly)&&(b(tn.id,Vn),S(tn.id,qr,na))}break}}else if(tn.type===z.ParabolicTrough){const En=tn;switch(Un){case xt.Lower:case xt.Upper:{const xn=Un===xt.Lower?1:-1,Tn=sn.angle()-en+xn*$t;let _n=Ft*Math.cos(Tn);_n=Math.max(1,Math.ceil((_n-En.moduleLength/2)/En.moduleLength))*En.moduleLength;const Gn=rt.x+xn*(_n*Math.sin(en))/2,go=rt.y-xn*(_n*Math.cos(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,tn.lx,_n)&&(T(tn.id,_n),S(tn.id,qr,na))}break;case xt.Left:case xt.Right:{const xn=Un===xt.Left?-1:1,Tn=sn.angle()-en+(Un===xt.Left?Math.PI:0),_n=Ft*Math.cos(Tn),Vn=rt.x+xn*(_n*Math.cos(en))/2,Gn=rt.y+xn*(_n*Math.sin(en))/2,go=new _t(Vn,Gn),qo=new _t().subVectors(go,dn).rotateAround(ui,-l[2]),Xr=qo.x/r,qr=qo.y/i;_s(tn,Xr,qr,_n,tn.ly)&&(b(tn.id,_n),S(tn.id,Xr,qr),A(na=>{na.actionState.parabolicTroughWidth=_n}))}break}}else if(tn.type===z.FresnelReflector){const En=tn;switch(Un){case xt.Lower:case xt.Upper:{const xn=Un===xt.Lower?1:-1,Tn=sn.angle()-en+xn*$t;let _n=Ft*Math.cos(Tn);_n=Math.max(1,Math.ceil((_n-En.moduleLength/2)/En.moduleLength))*En.moduleLength;const Gn=rt.x+xn*(_n*Math.sin(en))/2,go=rt.y-xn*(_n*Math.cos(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,tn.lx,_n)&&(T(tn.id,_n),S(tn.id,qr,na))}break;case xt.Left:case xt.Right:{const xn=Un===xt.Left?-1:1,Tn=sn.angle()-en+(Un===xt.Left?Math.PI:0),_n=Ft*Math.cos(Tn),Vn=rt.x+xn*(_n*Math.cos(en))/2,Gn=rt.y+xn*(_n*Math.sin(en))/2,go=new _t(Vn,Gn),qo=new _t().subVectors(go,dn).rotateAround(ui,-l[2]),Xr=qo.x/r,qr=qo.y/i;_s(tn,Xr,qr,_n,tn.ly)&&(b(tn.id,_n),S(tn.id,Xr,qr),A(na=>{na.actionState.fresnelReflectorWidth=_n}))}break}}else if(tn.type===z.ParabolicDish){const En=tn;switch(Un){case xt.Left:case xt.Right:case xt.Lower:case xt.Upper:{const xn=Math.min(10,Ft);_s(tn,En.cx,En.cy,tn.lx,xn)&&(b(tn.id,xn),T(tn.id,xn),A(Tn=>{Tn.actionState.parabolicDishRimDiameter=xn}));break}}}}}}},{transparent:ta,opacity:Ea}=pI();g.useEffect(()=>{_e.current&&(_e.current.material[4].needsUpdate=!0)},[ta]);const[Cs,El]=g.useState(!1),Vs=gn=>{const tn=O0.getIntersectionObjects(gn);if(tn.length==0||tn[0].eventObject.userData.id!==e){Cs&&(Rs(!1),Ue.current=null,ve(!1));return}const Gt=H.getState().selectedElement;!Cs&&Gt&&!Gt.locked&&Gt.type===z.SolarPanel&&H.getState().moveHandleType&&(Rs(!0,Gt.poleHeight),Ue.current=Gt,ve(!0))},Rs=(gn,tn)=>{gn&&tn!==void 0?(El(!0),Zt.setZ(tn)):(El(!1),Zt.setZ(0))},qp=()=>Cs?!0:Ue.current&&ye.isSolarCollector(Ue.current)&&!Ue.current.locked;return g.useEffect(()=>{const gn=()=>{Ue.current&&Se.current&&E(Ue.current.id,!1)};return window.addEventListener("beforeunload",gn),()=>{window.removeEventListener("beforeunload",gn)}},[]),h.jsx(h.Fragment,{children:h.jsxs("group",{ref:Ne,name:`${Mp} ${e}`,position:[n,o,Et],rotation:[0,0,l[2]],userData:{id:e,fId:e},children:[h.jsx(V3e,{parentId:e,foundationId:e,wrapperType:z.Foundation,plx:r,ply:i,plz:a}),h.jsx(Rfn,{foundationId:e,wrapperType:z.Foundation}),h.jsx(Lfn,{foundationId:e,hz:Et}),h.jsxs(di,{castShadow:G,receiveShadow:G,uuid:e,userData:{simulation:!0,stand:!0,id:e,aabb:!0},ref:_e,name:VL,args:[r,i,a],onContextMenu:cr,onPointerOver:or,onPointerDown:sr,onPointerUp:Vo,onPointerMove:A3.throttle(Da,hL,{trailing:!1}),onPointerOut:ii,onPointerEnter:Ga,children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:s}),h.jsx("meshStandardMaterial",{attach:"material-1",color:s}),h.jsx("meshStandardMaterial",{attach:"material-2",color:s}),h.jsx("meshStandardMaterial",{attach:"material-3",color:s}),ne&&Pe?h.jsx("meshBasicMaterial",{attach:"material-4",color:"white",map:Pe,transparent:ta,opacity:Ea}):h.jsx("meshStandardMaterial",{attach:"material-4",color:p===Xi.NoTexture?s:"white",map:fo,transparent:ta,opacity:Ea}),h.jsx("meshStandardMaterial",{attach:"material-5",color:s})]}),qp()&&h.jsx(yi,{ref:qe,name:"Foundation Intersection Plane",position:Zt,args:[r,i],visible:!1,onPointerMove:A3.throttle(sc,hL)}),Ie&&h.jsxs(h.Fragment,{children:[H.getState().rotateHandleType&&Ue.current&&ye.isSolarCollector(Ue.current)&&h.jsx(j3e,{element:Ue.current,height:Ue.current.poleHeight+Et}),(H.getState().moveHandleType||H.getState().resizeHandleType||we.current)&&h.jsx(C5e,{hx:yt,hy:at,hz:Et})]}),y&&h.jsx(B3e,{element:t,verticalLift:it}),(!y||Q)&&h.jsx(o4,{hx:yt,hy:at,hz:Et,lineColor:Q&&x?"white":c,lineWidth:Q&&x?u*3:u}),y&&d&&h.jsx(o4,{hx:yt,hy:at,hz:Et,lineColor:i0,lineWidth:u*5}),ze.show&&h.jsx("group",{position:[0,0,Et+.01],children:h.jsx(lMe,{hx:yt,hy:at,position:ze.position,direction:ze.direction,color:"black"})}),h.jsx("group",{position:[0,0,Et+.01],children:se.map((gn,tn)=>gn.show?h.jsx(lMe,{hx:yt,hy:at,position:gn.position,direction:gn.direction,color:"yellow"},tn):null)}),y&&!d&&h.jsxs(h.Fragment,{children:[h.jsx(di,{ref:Fe,position:[Lt.x,Lt.y,0],args:[Be,Be,a*1.2],name:xt.LowerLeft,onPointerDown:gn=>{L(e,gn,er.Resize),Fe.current&&A(tn=>{const Gt=Fe.current.localToWorld(new ue(r,i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.LowerLeft)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.LowerLeft||H.getState().resizeHandleType===xt.LowerLeft?Aa:ll})}),h.jsx(di,{ref:He,position:[Je.x,Je.y,0],args:[Be,Be,a*1.2],name:xt.UpperLeft,onPointerDown:gn=>{L(e,gn,er.Resize),He.current&&A(tn=>{const Gt=He.current.localToWorld(new ue(r,-i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.UpperLeft)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.UpperLeft||H.getState().resizeHandleType===xt.UpperLeft?Aa:ll})}),h.jsx(di,{ref:Le,position:[st.x,st.y,0],args:[Be,Be,a*1.2],name:xt.LowerRight,onPointerDown:gn=>{L(e,gn,er.Resize),Le.current&&A(tn=>{const Gt=Le.current.localToWorld(new ue(-r,i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.LowerRight)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.LowerRight||H.getState().resizeHandleType===xt.LowerRight?Aa:ll})}),h.jsx(di,{ref:Ye,position:[It.x,It.y,0],args:[Be,Be,a*1.2],name:xt.UpperRight,onPointerDown:gn=>{L(e,gn,er.Resize),Ye.current&&A(tn=>{const Gt=Ye.current.localToWorld(new ue(-r,-i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.UpperRight)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.UpperRight||H.getState().resizeHandleType===xt.UpperRight?Aa:ll})}),!oe&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:lt,args:[it,6,6,0,Math.PI],position:[0,-at-it,0],name:Ho.Lower,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Lower,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Lower)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Lower||H.getState().moveHandleType===Ho.Lower?Aa:gL})}),h.jsx(Ys,{ref:Oe,args:[it,6,6,0,Math.PI],position:[0,at+it,0],name:Ho.Upper,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Upper,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Upper)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Upper||H.getState().moveHandleType===Ho.Upper?Aa:gL})}),h.jsx(Ys,{ref:ut,args:[it,6,6,0,Math.PI],position:[-yt-it,0,0],name:Ho.Left,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Left,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Left)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Left||H.getState().moveHandleType===Ho.Left?Aa:q8})}),h.jsx(Ys,{ref:ht,args:[it,6,6,0,Math.PI],position:[yt+it,0,0],name:Ho.Right,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Right,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Right)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Right||H.getState().moveHandleType===Ho.Right?Aa:q8})}),h.jsx(MH,{id:e,position:[0,-ct,0],color:Z===ai.Lower||H.getState().rotateHandleType===ai.Lower?Aa:ll,ratio:pt,handleType:ai.Lower,hoverHandle:to,noHoverHandle:Dt}),h.jsx(MH,{id:e,position:[0,ct,0],color:Z===ai.Upper||H.getState().rotateHandleType===ai.Upper?Aa:ll,ratio:pt,handleType:ai.Upper,hoverHandle:to,noHoverHandle:Dt})]})]}),!oe&&h.jsxs(h.Fragment,{children:[(me||f)&&!y&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(t!=null&&t.label?t.label:B.t("shared.FoundationElement",zt))+(d?" ("+B.t("shared.ElementLocked",zt)+")":""),color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Et+.2]}),!d&&Z===xt.LowerLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LL",text:"LL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-yt,-at,Et+.2]}),!d&&Z===xt.UpperLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UL",text:"UL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-yt,at,Et+.2]}),!d&&Z===xt.LowerRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LR",text:"LR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[yt,-at,Et+.2]}),!d&&Z===xt.UpperRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UR",text:"UR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[yt,at,Et+.2]})]}),m===Nn.FocusPipe&&h.jsx(Ddn,{foundation:t}),m===Nn.FocusTower&&h.jsx(zdn,{foundation:t}),m===Nn.UpdraftTower&&h.jsx(Idn,{foundation:t}),h.jsx(wfn,{...t})]})})}),G3e="Handles Intersection Plane",uE=t=>{if(t.intersections.length>0){for(const e of t.intersections)if(e.eventObject.name===G3e)return e.point.z<0?null:e.point}return null},Jx=(t,e)=>new ue().subVectors(t,new ue(e.cx,e.cy,e.lz)).applyEuler(new cn(0,0,-e.rotation[2])),ert=(t,e,n,o,r)=>{const[i,a]=[e/2,n/2],[l,s,c]=o,u=new cn().fromArray([l-$t,s,c,"ZXY"]),d=r.map(f=>({x:f.x,y:f.y}));for(let f=-1;f<=1;f+=2)for(let p=-1;p<=1;p+=2){const m=new ue(i*f,0,a*p).applyEuler(u),y=new ue().addVectors(t,m);if(!ye.isPointInside(y.x,y.y,d))return!1}return!0},Nfn=(t,e,n,o,r,i,a)=>{const l=n/2,[s,c,u]=i,d=new cn().fromArray([s-$t,c,u,"ZXY"]),f=a.map(m=>({x:m.x,y:m.y})),p=new ue().addVectors(t,new ue(o*e,0,l+r).applyEuler(d));return!(!ye.isPointInside(p.x,p.y,f)||!ert(t,e,n,i,a))},Ufn=(t,e,n)=>{if(t.intersections.length>0)for(const o of t.intersections){const r=o.eventObject.name;if(r.includes("Window")&&r.includes(e)&&o.object.name!==G3e)return null;if(r.includes("Roof")&&r.includes(n)){const i=o.point.clone(),a=Number.parseInt(o.object.name.split(" ").pop()??"-1");return{pointer:i,segmentIdx:a}}}return null},dMe=t=>{switch(t){case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:return!0}return!1},jfn=(t,e,n)=>{const o=new ue().subVectors(e,t).applyEuler(new cn(0,0,-n)),r=Math.abs(o.x),i=Math.hypot(o.y,o.z),a=new ue().addVectors(t,e).divideScalar(2);return{newLx:r,newLz:i,newCenter:a}},Bfn=(t,e,n)=>n===Zo.Gambrel?U3e(t).map(o=>o.add(e)):t.map(o=>o.points[0].clone().add(e)),fMe=(t,e,n)=>{H.getState().set(o=>{const r=o.elements.find(i=>i.id===t&&i.type===z.Window);r&&([r.cx,r.cy,r.cz]=e,r.rotation=[...n])})},hMe=(t,e,n,o)=>{H.getState().set(r=>{const i=r.elements.find(a=>a.id===t&&a.type===z.Window);i&&([i.cx,i.cy,i.cz]=e,[i.lx,i.ly,i.lz]=n,o!=null&&(i.archHeight=o))})},pMe=(t,e)=>{H.getState().set(n=>{const o=n.elements.find(r=>r.id===t&&r.type===z.Window);o&&(o.polygonTop=[...e])})},Yfn=(t,e,n=.01)=>{if(t.type!==z.SolarPanel&&t.type!==z.Window)return null;const o=new cn().fromArray([t.rotation[0],t.rotation[1],t.rotation[2],"ZXY"]),r=new ue,i=t.lx/2+n;let a=n;t.type===z.SolarPanel?(a+=t.ly/2,r.set(t.cx*e.lx,t.cy*e.ly,0)):(a+=t.lz/2,r.set(t.cx,t.cy,0));const l=[];for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=new ue(s*i,s*c*a).applyEuler(o).add(r);l.push(u)}if(t.type===z.Window&&t.windowType===Ti.Polygonal){const[s,c]=t.polygonTop??P1,u=new ue(s*i,c+a).applyEuler(o).add(r);l.push(u)}return l},Jse=t=>{if(t.windowType===Ti.Polygonal)return t.polygonTop??P1},trt=({z:t})=>{const e=g.useRef(null),[n,o]=g.useState("white");return h.jsx(di,{ref:e,name:xt.Arch,args:[.2,.2,.2],position:[0,0,t],onPointerEnter:()=>{o("red")},onPointerLeave:()=>{o("white")},children:h.jsx("meshBasicMaterial",{color:n})})},Ofn=({id:t,parentId:e,foundationId:n,lx:o,lz:r,polygonTop:i,rotation:a,windowType:l,parentType:s})=>{const c=H(te=>te.addedWindowId),u=H(Fn),d=c===t,f=s===z.Roof,p=g.useRef(null),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),P=g.useRef(null),A=g.useRef(null),S=g.useRef([]),v=g.useRef(null),b=g.useRef(null),T=g.useRef(null),R=g.useRef(null),M=g.useRef(null),[D,k]=g.useState(!1),[N,U]=[o/2,r/2],[W,F]=i,E=g.useMemo(()=>o*W,[o,W]),L=H(pn),j=(te,$,le)=>{if(!n)return null;const de=H.getState().elements.find(ve=>ve.id===n&&ve.type===z.Foundation);if(!de)return null;const he=te.object.localToWorld(new ue),[me,ce,Pe]=a,pe=new cn().fromArray([me-$t,ce,Pe+de.rotation[2],"ZXY"]),Ie=new ue($,0,le).applyEuler(pe);return new ue().addVectors(he,Ie)},Y=te=>{let $,le,de;for(const ge of H.getState().elements)ge.id===t&&ge.type===z.Window?$=ge:ge.id===n&&ge.type===z.Foundation?le=ge:ge.id===e&&ge.type===z.Roof&&(de=ge);const he=jn.getState().contentRef;if(!$||!le||!de||!he||!he.current)return;const me=le.id,ce=he.current.children.find(ge=>ge.name===`${Mp} ${me}`);if(!ce)return;const Pe=ce.children.find(ge=>ge.name===$ot);if(!Pe)return;const pe=Pe.children.find(ge=>ge.name.includes("Roof")&&ge.name.includes(e));if(!pe)return;const Ie=pe.children[0];if(!Ie)return;for(const ge of H.getState().elements)if(ge.parentId===e&&ge.id!==t){const we=Yfn(ge,le);we&&S.current.push(we)}const{centroid:ve,roofSegments:ze}=Ie.userData,se=new ue($.cx,$.cy,$.cz+le.lz).clone().sub(ve);p.current=te,m.current=le,y.current=de,C.current=Rn.getSegmentIdx(ze,se),x.current=ve,w.current=ze,A.current=Bfn(w.current,x.current,de.roofType),v.current=[$.cx,$.cy,$.cz],T.current=[$.lx,$.ly,$.lz],b.current=[...$.rotation],R.current=$.archHeight,M.current=$.polygonTop??null},O=()=>{if(!v.current||!b.current)return;const te=H.getState().elements.find(le=>le.id===t&&le.type===z.Window);if(!te)return;const $={name:"Move skylight",timestamp:Date.now(),id:te.id,oldPosition:[...v.current],newPosition:[te.cx,te.cy,te.cz],oldRotation:[...b.current],newRotation:[...te.rotation],undo(){fMe($.id,$.oldPosition,$.oldRotation)},redo(){fMe($.id,$.newPosition,$.newRotation)}};u($)},_=()=>{if(!T.current||!v.current)return;const te=H.getState().elements.find(le=>le.id===t&&le.type===z.Window);if(!te)return;const $={name:"Resize skylight",timestamp:Date.now(),id:te.id,oldPosition:[...v.current],newPosition:[te.cx,te.cy,te.cz],oldDimension:[...T.current],newDimension:[te.lx,te.ly,te.lz],oldArchHeight:R.current,newArchHeight:te.archHeight,undo(){hMe(this.id,this.oldPosition,this.oldDimension,this.oldArchHeight)},redo(){hMe(this.id,this.newPosition,this.newDimension,this.newArchHeight)}};u($)},G=()=>{if(!M.current)return;const te=H.getState().elements.find(le=>le.id===t&&le.type===z.Window);if(!te)return;const $={name:"Resize skylight top vertex",timestamp:Date.now(),id:te.id,oldPolygonTop:[...M.current],newPolygonTop:te.polygonTop??P1,undo(){pMe(this.id,this.oldPolygonTop)},redo(){pMe(this.id,this.newPolygonTop)}};u($)},Q=te=>te.roofType===Zo.Gable?!1:Math.abs(te.rise)<.001,oe=te=>{if(y.current&&Q(y.current))return A.current;if(te!=null){const le=In.getState().getRoofSegmentVertices(e);if(!le)return;const de=te===-1?le.length-1:te;return le[de]}},ee=(te,$,le,de,he)=>{const[me,ce]=[$/2,le/2],Pe=new cn().fromArray([de[0],de[1],de[2],"ZXY"]),pe=[];for(let Ie=-1;Ie<=1;Ie+=2)for(let ve=-1;ve<=1;ve+=2){const ze=new ue(Ie*me,Ie*ve*ce).applyEuler(Pe).add(te);pe.push(ze)}if(he){const[Ie,ve]=he,ze=new ue(Ie*me*2,ve+ce).applyEuler(Pe).add(te);pe.push(ze)}for(const Ie of S.current){for(const ve of pe)if(ye.isPointInside(ve.x,ve.y,Ie))return!1;for(const ve of Ie)if(ye.isPointInside(ve.x,ve.y,pe))return!1}return!0},q=(te,$,le,de,he,me)=>{if(me){const[ce,Pe]=me;return Nfn($,le,de,ce,Pe,he,te)}else return ert($,le,de,he,te)},ae=te=>{if(!f||d)return;const $=te.object.name;switch($){case Ho.Mid:break;case xt.LowerLeft:{P.current=j(te,o,r);break}case xt.LowerRight:{P.current=j(te,-o,r);break}case xt.UpperLeft:{P.current=j(te,o,-r);break}case xt.UpperRight:{P.current=j(te,-o,-r);break}case xt.Arch:{P.current=j(te,0,-r);break}case xt.Upper:break;default:return}Y($),k(!0),jn.getState().setEnableOrbitController(!1)},Z=te=>{if(p.current===null||!m.current||!y.current||!w.current||!x.current||!A.current)return;const $=m.current;if(p.current===Ho.Mid){const le=y.current,de=Ufn(te,t,e),he=new ue;if(Q(le)){const me=uE(te);if(!me)return;he.copy(me);const ce=Jx(he,$);L(Pe=>{if(!A.current)return;const pe=Pe.elements.find(Se=>Se.id===t&&Se.type===z.Window);if(!pe)return;const{lx:Ie,lz:ve,rotation:ze}=pe,Ae=A.current,se=Jse(pe),ge=q(Ae,ce,Ie,ve,ze,se),we=ee(ce,Ie,ve,ze,se);ge&&we&&(pe.cx=ce.x,pe.cy=ce.y,pe.cz=ce.z)})}else{if(de&&de.segmentIdx!==C.current){const ve=de.pointer;he.copy(ve)}else{const ve=uE(te);if(!ve)return;he.copy(ve)}const me=Jx(he,$),ce=me.clone().sub(x.current),{rotation:Pe,segmentVertices:pe,segmentIdx:Ie}=Rn.computeState(w.current,ce);pe?me.setZ(Rn.getRooftopElementZ(pe,ce,x.current.z+le.thickness)):me.setZ(x.current.z+le.thickness),L(ve=>{const ze=In.getState().getRoofSegmentVertices(e);if(!ze)return;const Ae=Ie===-1?ze.length-1:Ie,se=ze[Ae];if(!se)return;const ge=ve.elements.find(Re=>Re.id===t&&Re.type===z.Window);if(!ge)return;const{lx:we,lz:Se}=ge,Me=Jse(ge),Ce=q(se,me,we,Se,Pe,Me),Te=ee(me,we,Se,Pe,Me);Ce&&Te&&(ge.cx=me.x,ge.cy=me.y,ge.cz=me.z,ge.rotation=[...Pe],de&&de.segmentIdx!==C.current&&(C.current=de.segmentIdx))})}}else if(dMe(p.current)){const le=oe(C.current),de=uE(te),he=P.current;if(!de||!he||!le)return;const me=Jx(de,$),ce=Jx(he,$),{newLx:Pe,newLz:pe,newCenter:Ie}=jfn(ce,me,a[2]);H.getState().set(ve=>{const ze=ve.elements.find(we=>we.id===t&&we.type===z.Window);if(!ze)return;const Ae=Jse(ze),se=q(le,Ie,Pe,pe,a,Ae),ge=ee(Ie,Pe,pe,a,Ae);se&&ge&&(ze.cx=Ie.x,ze.cy=Ie.y,ze.cz=Ie.z,ze.lx=Pe,ze.lz=Math.max(.001,pe))})}else if(p.current===xt.Upper){const le=oe(C.current),de=uE(te);if(!de||!le)return;const he=Jx(de,$);L(me=>{const ce=me.elements.find(He=>He.id===t);if(!ce)return;const[Pe,pe]=[ce.lx/2,ce.lz/2],Ie=new ue(ce.cx,ce.cy,ce.cz),ve=new cn().fromArray([ce.rotation[0],ce.rotation[1],ce.rotation[2],"ZXY"]),ze=new ue(-Pe,-pe,0).applyEuler(ve).add(Ie),Ae=new ue(Pe,-pe,0).applyEuler(ve).add(Ie),se=new ue().subVectors(he,ze),ge=new ue().subVectors(Ae,ze).normalize(),we=se.clone().projectOnVector(ge).applyEuler(new cn(0,0,-ce.rotation[2])),Se=ye.clamp((we.x-Pe)/ce.lx,-.5,.5),Me=Rn.getDistance(ze,Ae,he),Ce=Math.hypot(Me,he.z-ze.z),Te=Math.max(0,Ce-ce.lz),Re=[Se,Te],Ne=new ue(ce.cx,ce.cy,ce.cz),{lx:_e,lz:Ue}=ce,qe=q(le,Ne,_e,Ue,a,Re),Fe=ee(Ne,_e,Ue,a,Re);qe&&Fe&&(ce.polygonTop=[...Re])})}else if(p.current===xt.Arch){const le=uE(te),de=P.current,he=oe(C.current);if(!le||!de||!he)return;const me=Jx(le,$),ce=Jx(de,$);L(Pe=>{const pe=Pe.elements.find(Te=>Te.id===t&&Te.type===z.Window);if(!pe)return;const[Ie,ve]=[pe.lx/2,pe.lz/2],ze=new ue(pe.cx,pe.cy,pe.cz),Ae=new cn().fromArray([pe.rotation[0],pe.rotation[1],pe.rotation[2],"ZXY"]),se=new ue(-Ie,-ve,0).applyEuler(Ae).add(ze),ge=new ue(Ie,-ve,0).applyEuler(Ae).add(ze),we=Rn.getDistance(se,ge,me);let Se=Math.hypot(we,me.z-se.z);const Me=Math.min(pe.archHeight,pe.lz,pe.lx/2),Ce=pe.lz-Me;if(Se>Ce&&Se{p.current===Ho.Mid?O():dMe(p.current)?_():p.current===xt.Upper?G():p.current===xt.Arch&&_(),v.current=null,T.current=null,b.current=null,R.current=null,M.current=null,p.current=null,m.current=null,y.current=null,w.current=null,x.current=null,C.current=null,P.current=null,A.current=null,S.current=[],k(!1),jn.getState().setEnableOrbitController(!0)};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Handle Wrapper",onPointerDown:ae,children:[!d&&h.jsxs(h.Fragment,{children:[l===Ti.Polygonal&&h.jsx(xv,{x:E,z:U+F,handleType:xt.Upper,scale:[.5,1,1.5]}),h.jsx(xv,{x:-N,z:U,handleType:xt.UpperLeft}),h.jsx(xv,{x:N,z:U,handleType:xt.UpperRight}),h.jsx(xv,{x:-N,z:-U,handleType:xt.LowerLeft}),h.jsx(xv,{x:N,z:-U,handleType:xt.LowerRight}),l===Ti.Arched&&h.jsx(trt,{z:U})]}),h.jsx(rHt,{handleType:Ho.Mid})]}),f&&D&&h.jsx(yi,{name:G3e,args:[1e3,1e3],rotation:[$t,0,0],onPointerMove:Z,onPointerUp:ne,visible:!1,children:h.jsx("meshBasicMaterial",{color:"red",side:zr,transparent:!0,opacity:.5})})]})},_fn=xe.memo(Ofn),Vfn=new vf({color:"white",side:zr}),Gfn=xe.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i]=t,{width:a,horizontalMullionSpacing:l,verticalMullionSpacing:s,color:c}=e,u=3,d=1,f=a/2,p=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),m=g.useMemo(()=>{const w=[],x=Math.round(o/s)-1;if(x<=0||a===0)return w;const C=o/(x+1);let P=C/2;x%2!==0&&(w.push(0),P=C);for(let A=0;A{const w=[],x=Math.round(i/l)-1;if(x<=0||a===0)return w;const C=i/(x+1);let P=C/2;x%2!==0&&(w.push(0),P=C);for(let A=0;Ah.jsx(wa,{position:[w,25e-5,0],args:[f,f,i,u,d],rotation:[$t,$t,0],receiveShadow:n,castShadow:n,children:p},x)),e.horizontalMullion&&y.map((w,x)=>h.jsx(wa,{position:[0,5e-4,w],args:[f,f,o,u,d],rotation:[0,0,$t],receiveShadow:n,castShadow:n,children:p},x))]})}),Xfn=xe.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i]=t,{color:a,width:l,sillWidth:s}=e,c=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]),u=l/2,d=u/2,f=o+l*3,p=l;return h.jsxs("group",{name:"Window Frame Group",position:[0,-d/2,0],children:[h.jsx(di,{position:[0,0,i/2],args:[o+2*l,d,l],castShadow:n,receiveShadow:n,children:c}),h.jsx(di,{position:[-o/2-u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(di,{position:[o/2+u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(di,{position:[0,0,-i/2-(s===0?0:p/2)],args:s===0?[o+2*l,d,l]:[f,s??l,p],castShadow:n,receiveShadow:n,children:c})]})}),Jfn=xe.memo(({cy:t,dimension:e,wireframeData:n})=>{const[o,r,i]=e,{lineWidth:a,lineColor:l,selected:s,locked:c,opacity:u}=n,d=o/2,f=i/2,p=3,m=1,y=g.useMemo(()=>new vf({color:l}),[l]),w=g.useMemo(()=>new vf({color:i0}),[]),x=(C,P)=>{const A=C/2;return h.jsxs(h.Fragment,{children:[h.jsx(wa,{args:[C,C,o,p,m],rotation:[0,0,$t],position:[0,0,f-A],material:P}),h.jsx(wa,{args:[C,C,o,p,m],rotation:[0,0,$t],position:[0,0,-f+A],material:P}),h.jsx(wa,{args:[C,C,i,p,m],rotation:[$t,$t,0],position:[d-A,0,0],material:P}),h.jsx(wa,{args:[C,C,i,p,m],rotation:[$t,$t,0],position:[-d+A,0,0],material:P})]})};return h.jsxs("group",{name:"Window Wireframe Group",children:[u>0&&h.jsx("group",{position:[0,t,0],children:x(a/20,y)}),c&&s&&x(a/5,w)]})}),Kfn=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:m,foundation:y})=>{const w=H.getState().world,x=H(Y5),C=H(J3),P=H(K3),A=H(xs),S=In(PS),v=g.useRef(0),b=g.useRef(),[T,R,M]=e,[D,k,N]=n,U=g.useMemo(()=>{if(!d||m||y&&y.notBuilding)return;const L=S.get(t);if(!L)return;const j=L.reduce((q,ae)=>q+ae,0);if(f===0)return;const Y=X3*(w.solarRadiationHeatmapGridCellSize??.5),O=Math.max(2,Math.round(T/Y)),_=Math.max(2,Math.round(M/Y)),G=T/O,Q=M/_,oe=j/f*(x??Ny);v.current=oe<0?1:0,b.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(oe)*$t);const ee=[];if(oe<0)for(let q=0;qc*T,[T,c]),F=g.useMemo(()=>(W+r.width+T)/2*1.025,[T,W,r.width]),E=(L,j,Y)=>h.jsx(yi,{name:"Window Seal Plane",args:L,position:j,rotation:Y,material:Vfn,receiveShadow:A,castShadow:A});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Rectangle Window Plane Group",position:[0,k,0],children:[h.jsx(yi,{name:"Window Glass Plane",args:[T,M],rotation:[$t,0,0],children:u}),(o.horizontalMullion||o.verticalMullion)&&h.jsx(Gfn,{dimension:e,mullionData:o,shadowEnabled:A})]}),r.showFrame&&h.jsx(Xfn,{dimension:e,frameData:r,shadowEnabled:A}),h.jsx(J3e,{cx:F,lx:W,lz:M,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),h.jsx(Jfn,{cy:k,dimension:e,wireframeData:i}),E([R,M],[-T/2+.001,R/2,0],[$t,$t,0]),E([R,M],[T/2-1e-4,R/2,0],[$t,-$t,0]),E([T,R],[0,R/2,M/2-.001],[Math.PI,0,0]),E([T,R],[0,R/2,-M/2+.001]),U&&U.map((L,j)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:L,name:"Heat Flux "+j,lineWidth:P??Uy,color:C??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:L[v.current].clone().add(new ue(0,v.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:b.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??Fu})})]},j))]})},$fn=xe.memo(Kfn),X3e=({element:t})=>{const e=H(Au),n=H(Cm),o=H($y),r=t.lx/2,i=t.lz/2,a=.05,l=1,s=.5,c=t.lineColor??"white",u="darkorchid",d=Math.max(.25,(r+i)/32),f=.25,p=30,m=-.1,y=g.useMemo(()=>({lng:e}),[e]),w=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[-r-f,m,0]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r-f,0,-i],[-r-f,0,i]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r-f+a,0,-i+3*a],[-r-f,0,-i],[-r-f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r-f+a,0,i-3*a],[-r-f,0,i],[-r-f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r-f*2,0,-i]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,i],[-r-f*2,0,i]],color:c,linewidth:s})]}),[r,i,y]),x=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[r+f,m,0]}),h.jsx(On,{userData:{unintersectable:!0},points:[[r+f,0,-i],[r+f,0,i]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r+f+a,0,-i+3*a],[r+f,0,-i],[r+f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r+f+a,0,i-3*a],[r+f,0,i],[r+f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,-i],[r+f*2,0,-i]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,i],[r+f*2,0,i]],color:c,linewidth:s})]}),[r,i,y]),C=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,m,-i-f]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,-i-f],[r,0,-i-f]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r+3*a,0,-i-f-a],[-r,0,-i-f],[-r+3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r-3*a,0,-i-f-a],[r,0,-i-f],[r-3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r,0,-i-f*2]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,-i],[r,0,-i-f*2]],color:c,linewidth:s})]}),[r,i,y]),P=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,m,i+f]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,i+f],[r,0,i+f]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r+3*a,0,i+f-a],[-r,0,i+f],[-r+3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r-3*a,0,i+f-a],[r,0,i+f],[r-3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,i],[-r,0,i+f*2]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,i],[r,0,i+f*2]],color:c,linewidth:s})]}),[r,i,y]);if(n)switch(n){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[w,C]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[x,C]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[w,P]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[x,P]})}if(o)switch(o){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[w,C]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[x,C]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[w,P]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[x,P]})}return h.jsx(h.Fragment,{})};xe.memo(X3e);const J3e=({cx:t,cz:e=0,lx:n,lz:o,color:r,showLeft:i,showRight:a,spacing:l})=>{const s=H(xs),c=dt(vs),u=dt(n6);return c||u?null:h.jsxs("group",{name:"Shutter Group",children:[a&&h.jsx(di,{args:[n,.1,o],position:[t+l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})}),i&&h.jsx(di,{args:[n,.1,o],position:[-t-l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})})]})},Upe="Window Group",P1=[0,.5],qfn=t=>{const{id:e,parentId:n,foundationId:o,cx:r,cy:i,cz:a,lx:l,ly:s,lz:c,rotation:u,locked:d,lineWidth:f=.2,lineColor:p="black",horizontalMullion:m=!0,verticalMullion:y=!0,mullionWidth:w=.06,horizontalMullionSpacing:x=.5,verticalMullionSpacing:C=.5,tint:P="#73D8FF",opacity:A=.5,leftShutter:S=!1,rightShutter:v=!1,shutterColor:b="gray",shutterWidth:T=.5,mullionColor:R="white",frame:M=!1,color:D="white",frameWidth:k=.1,sillWidth:N=.1,windowType:U=Ti.Default,archHeight:W,parentType:F=z.Wall,polygonTop:E=P1}=t,L=`${Upe} ${e}`,j=H(pn),Y=H(p4),O=dt(kf),_=H(TGe),G=H(sQ),Q=Fc(e),oe=(ve=!1)=>{G&&dt.getState().set(ze=>{ze.modelTreeExpandedKeys=[e]}),j(ze=>{if(ze.contextMenuObjectType=null,ze.groupActionMode)ze.multiSelectionsMode||ze.selectedElementIdSet.clear(),t.foundationId&&(ze.selectedElementIdSet.has(n)?ze.selectedElementIdSet.delete(n):ze.selectedElementIdSet.add(t.foundationId));else for(const Ae of ze.elements)if(Ae.id===e)if(Ae.selected=!0,ze.selectedElement=Ae,ve)if(ze.selectedElementIdSet.has(e))for(const se of ze.elements)ze.selectedElementIdSet.has(se.id)&&se.type!==ze.selectedElement.type&&ze.selectedElementIdSet.delete(se.id);else if(ze.multiSelectionsMode){ze.selectedElementIdSet.add(e);for(const se of ze.elements)ze.selectedElementIdSet.has(se.id)&&se.type!==ze.selectedElement.type&&ze.selectedElementIdSet.delete(se.id)}else ze.selectedElementIdSet.clear(),ze.selectedElementIdSet.add(e);else ze.multiSelectionsMode?ze.selectedElementIdSet.has(e)?ze.selectedElementIdSet.delete(e):ze.selectedElementIdSet.add(e):(ze.selectedElementIdSet.clear(),ze.selectedElementIdSet.add(e));else Ae.selected=!1})},ee=ve=>ve.intersections.length>0&&ve.intersections[0].eventObject.name===L&&!H.getState().moveHandleType&&!H.getState().resizeHandleType&&!H.getState().isAddingElement()&&H.getState().objectTypeToAdd===z.None,q=ve=>{if(ve.eventObject.name===L&&ve.intersections.length>0)switch(ve.object.name){case Ho.Mid:case xt.UpperLeft:case xt.UpperRight:case xt.LowerLeft:case xt.LowerRight:case xt.Arch:case xt.Upper:return!0}return!1},ae=(ve,ze)=>{jn.getState().setEnableOrbitController(!1),O("showWallIntersectionPlaneId",n),j(Ae=>{Ae.resizeHandleType=ve,Ae.resizeAnchor.copy(new ue(r,0,a).add(ze))})},Z=ve=>{if(!(ve.button===2||H.getState().addedWallId)&&(ee(ve)&&oe(),q(ve))){const ze=ve.intersections[0].eventObject.name;switch(ze){case Ho.Mid:{jn.getState().setEnableOrbitController(!1),dt.getState().set(Ae=>{Ae.showWallIntersectionPlaneId=n,Ae.oldParentId=n,Ae.oldFoundationId=o}),j(Ae=>{Ae.moveHandleType=ze,Ae.selectedElement=Ae.elements.find(se=>{var ge;return se.id===((ge=Ae.selectedElement)==null?void 0:ge.id)})});break}case xt.UpperLeft:{ae(ze,new ue(l/2,0,-c/2));break}case xt.UpperRight:{ae(ze,new ue(-l/2,0,-c/2));break}case xt.LowerLeft:{ae(ze,new ue(l/2,0,c/2));break}case xt.LowerRight:{ae(ze,new ue(-l/2,0,c/2));break}case xt.Arch:{ae(ze,new ue(0,0,0));break}case xt.Upper:{ae(ze,new ue(0,0,c/2));break}}}},ne=ve=>{H.getState().addedWallId||ee(ve)&&(oe(!0),j(ze=>{ze.contextMenuObjectType=z.Window}))},te=g.useMemo(()=>{if(F===z.Roof){const[ve,ze,Ae]=u;return new cn().fromArray([ve-$t,ze,Ae,"ZXY"])}else return new cn},[F,u]),$=g.useMemo(()=>h.jsx("meshPhongMaterial",{specular:new ir("white"),shininess:_??DX,color:P,side:zr,opacity:A,transparent:!0}),[_,P,A]),le=g.useMemo(()=>W!==void 0?[l,s,c,W]:[l,s,c],[l,s,c,W]),de=g.useMemo(()=>F===z.Roof?[r,.05,a]:[r,i,a],[r,i,a,F]),he=g.useMemo(()=>({horizontalMullion:m,verticalMullion:y,width:w,horizontalMullionSpacing:x,verticalMullionSpacing:C,color:R}),[m,y,w,x,C,R]),me=g.useMemo(()=>({showFrame:M,width:k,color:D,sillWidth:N}),[M,k,D,N]),ce=g.useMemo(()=>({lineColor:p,lineWidth:f,selected:Q,locked:d,opacity:A}),[p,f,Q,d,A]),Pe=dt(n6),pe=()=>{switch(U){case Ti.Default:return h.jsx($fn,{id:t.id,dimension:le,position:de,mullionData:he,frameData:me,wireframeData:ce,leftShutter:S,rightShutter:v,shutterColor:b,shutterWidth:T,glassMaterial:$,showHeatFluxes:Pe,area:ye.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:Y(t)});case Ti.Arched:return h.jsx(AHt,{id:t.id,dimension:le,position:de,mullionData:he,frameData:me,wireframeData:ce,leftShutter:S,rightShutter:v,shutterColor:b,shutterWidth:T,glassMaterial:$,showHeatFluxes:Pe,area:ye.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:Y(t)});case Ti.Polygonal:return h.jsx(PHt,{id:t.id,dimension:le,polygonTop:E,position:de,glassMaterial:$,empty:!!t.empty,interior:!!t.interior,wireframeData:ce,frameData:me,leftShutter:S,rightShutter:v,shutterColor:b,shutterWidth:T,showHeatFluxes:Pe,area:ye.getWindowArea(t),foundation:Y(t)})}},Ie=F===z.Roof?i:0;return h.jsxs("group",{name:L,position:[r,Ie,a],rotation:te,onPointerDown:Z,onContextMenu:ne,onPointerMove:()=>{},children:[pe(),Q&&h.jsx(X3e,{element:t}),Q&&!d&&h.jsx(_fn,{id:e,parentId:n,foundationId:o,lx:l,lz:c,polygonTop:E,rotation:u,windowType:U,parentType:F})]},e)},nrt=xe.memo(qfn),Qfn=xe.memo(({lineColor:t="black",lineWidth:e=.2,hx:n,hz:o,fill:r,isTopPartial:i,leftUnfilledHeight:a,rightUnfilledHeight:l,showParapet:s=!1,leftHeight:c=2*o,rightHeight:u=2*o,center:d,centerLeft:f,centerRight:p})=>{const m=H(S=>S.viewState.orthographic),y=[-n,-o+.001+(r===Ul.Partial?a:0),.001],w=[n,-o+.001+(r===Ul.Partial?l:0),.001],x=[-n,c-o-.001,.001],C=[n,u-o-.001,.001],P=n*2,A=[];if(m)e=2,A.push(x,C);else if(s)A.push(x,y,w,C);else if(i)A.push(y,x,C,w,y);else{if(A.push(y,x),f){const S=[f[0]*P,f[1]-o,.001];A.push(S)}if(d){const S=[d[0]*P,d[1]-o,.001];A.push(S)}if(p){const S=[p[0]*P,p[1]-o,.001];A.push(S)}A.push(C,w)}return h.jsx(xe.Fragment,{children:h.jsx(On,{rotation:[$t,0,0],points:A,color:t,lineWidth:e})})});var Wd=(t=>(t.Default="Default",t.Arched="Arched",t))(Wd||{});const Zfn=xe.memo(({dimension:t,lineColor:e,lineWidth:n})=>{const[o,r,i]=t.map(u=>u/2),a=[-o,0,i+.05],l=[o,0,i+.05],s=[-o,0,-i],c=[o,0,-i];return h.jsx(On,{points:[s,a,l,c],lineWidth:n,color:e})}),ehn=xe.memo(({dimension:t,color:e})=>{const[n,o,r]=t,i=H(xs),a=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:e}),[e]),l=.1,s=l/2;return h.jsxs("group",{name:"Door frame group",children:[h.jsx(di,{position:[0,0,r/2],args:[n,l,l],castShadow:i,receiveShadow:i,children:a}),h.jsx(di,{position:[-n/2+s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a}),h.jsx(di,{position:[n/2-s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a})]})}),thn=xe.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,area:s,showHeatFluxes:c,foundation:u})=>{const d=H.getState().world,f=H(Y5),p=H(J3),m=H(K3),y=H(xs),w=In(PS),x=g.useRef(0),C=g.useRef(),[P,A,S]=e,v=g.useMemo(()=>{if(!c||u&&u.notBuilding)return;const T=w.get(t);if(!T)return;const R=T.reduce((E,L)=>E+L,0);if(s===0)return;const M=X3*(d.solarRadiationHeatmapGridCellSize??.5),D=Math.max(2,Math.round(P/M)),k=Math.max(2,Math.round(S/M)),N=P/D,U=S/k,W=R/s*(f??Ny);x.current=W<0?1:0,C.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(W)*$t);const F=[];if(W<0)for(let E=0;E{const T=new jl,[R,M]=[P/2,S/2],D=Math.max(R,M)*.2;return T.moveTo(-R,-M),T.lineTo(-R,M),T.lineTo(R,M),T.lineTo(R,-M),l||(T.lineTo(R-D,-M),T.lineTo(R-D,M-D),T.lineTo(-R+D,M-D),T.lineTo(-R+D,-M)),T.closePath(),T},[P,S,l]);return h.jsxs("group",{name:"Rectangle door group",position:[0,-.01,0],children:[h.jsx("mesh",{name:"Rectangular Door Mesh",rotation:[$t,0,0],material:a,castShadow:y&&l,receiveShadow:y&&l,children:h.jsx("shapeGeometry",{args:[b]})}),l&&h.jsxs("mesh",{name:"Rectangular Door Simulation Mesh",rotation:[$t,0,0],uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[b]}),h.jsx("meshBasicMaterial",{side:zr})]}),l&&h.jsx("mesh",{name:"Door plane inside",position:[0,.1,0],rotation:[-$t,0,Math.PI],material:a,castShadow:y&&l,receiveShadow:y&&l,children:h.jsx("shapeGeometry",{args:[b]})}),h.jsx(Zfn,{dimension:e,lineColor:r&&i?i0:"black",lineWidth:r&&i?2:.2}),h.jsx(ehn,{dimension:e,color:o}),v&&v.map((T,R)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:T,name:"Heat Flux "+R,lineWidth:m??Uy,color:p??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:T[x.current].clone().add(new ue(0,x.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:p??Fu})})]},R))]})}),nhn=xe.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,showHeatFluxes:s,area:c,foundation:u})=>{const d=H.getState().world,f=H(xs),p=H(Y5),m=H(J3),y=H(K3),w=In(PS),x=g.useRef(0),C=g.useRef(),[P,A,S,v]=e,b=(D,k)=>{if(v>0){const N=.5*P,U=.5*S,W=Math.min(v,S,N),F=.5*(W+N*N/W);if(Math.abs(D)-U)return!0;const E=k-(S-F-U);return D*D+E*E{if(!s||u&&u.notBuilding)return;const D=w.get(t);if(!D)return;const k=D.reduce((Y,O)=>Y+O,0);if(c===0)return;const N=X3*(d.solarRadiationHeatmapGridCellSize??.5),U=Math.max(2,Math.round(P/N)),W=Math.max(2,Math.round(S/N)),F=P/U,E=S/W,L=k/c*(p??Ny);x.current=L<0?1:0,C.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(L)*$t);const j=[];if(L<0)for(let Y=0;Y{const D=new jl,k=P/2,N=S/2,U=Math.min(v,S,k);if(D.moveTo(k,-N),D.lineTo(k,N-U),U>.1){const W=U/2+P**2/(8*U),[F,E]=[0,N-W],L=Math.acos(Math.min(k/W,1)),j=Math.PI-L;D.absarc(F,E,W,L,j,!1)}else D.lineTo(-k,N);if(D.lineTo(-k,-N),!l){const W=P*.4,F=S*.4,E=Math.min(v*.8,S*.8,k*.8);if(D.lineTo(-W,-N),E>.1){D.lineTo(-W,N-E);const L=E/2+(P*.8)**2/(8*E),[j,Y]=[0,F-L],O=Math.acos(Math.min(W/L,1)),_=Math.PI-O;D.absarc(j,Y,L,_,O,!0)}else D.lineTo(-W,F),D.lineTo(W,F);D.lineTo(W,-N)}return D.closePath(),D},[P,S,v,l]),M=g.useMemo(()=>({lineColor:"black",lineWidth:i&&r?.2:.1,opacity:1,selected:r,locked:i}),[r,i]);return h.jsxs("group",{name:"Arched door group",children:[h.jsx("mesh",{name:"Arched Door Mesh",rotation:[$t,0,0],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),l&&h.jsxs("mesh",{name:"Arched Door Simulation Mesh",rotation:[$t,0,0],material:a,uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[R]}),h.jsx("meshBasicMaterial",{side:zr})]}),l&&h.jsx("mesh",{name:"Door plane mesh inside",position:[0,.1,0],rotation:[-$t,0,Math.PI],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),h.jsx(Xde,{cy:0,dimension:e,wireframeData:M}),h.jsx(Xde,{cy:A,dimension:e,wireframeData:M}),T&&T.map((D,k)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:D,name:"Heat Flux "+k,lineWidth:y??Uy,color:m??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:D[x.current].clone().add(new ue(0,x.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:m??Fu})})]},k))]})}),ort="/aladdin/assets/door_edge-Dxz9LnYZ.png",rrt="/aladdin/assets/door_01-Bl1yYWKp.png",jpe="/aladdin/assets/door_02-eLAy3erM.png",irt="/aladdin/assets/door_03-CX-eEQtv.png",art="/aladdin/assets/door_04-Bk3Xe_KE.png",lrt="/aladdin/assets/door_05-15BnnbHK.png",srt="/aladdin/assets/door_06-B08sjms-.png",crt="/aladdin/assets/door_07-BVyEwygm.png",urt="/aladdin/assets/door_08-Cd1Vc7FQ.png",drt="/aladdin/assets/door_09-DQcA4jCn.png",frt="/aladdin/assets/door_10-DVLJsY3W.png",hrt="/aladdin/assets/door_11-dOCMnkGG.png",prt="/aladdin/assets/door_12-7f2iD2B7.png",grt="/aladdin/assets/door_13-IsPl-xmI.png",mrt="/aladdin/assets/door_14-CljRO-fX.png",yrt="/aladdin/assets/door_15-CoUc1lfF.png",Art="/aladdin/assets/door_16-Dlbc5tIF.png",wrt="/aladdin/assets/door_17-CHob_UgA.png",ohn=(t,e,n,o)=>{const r=g.useMemo(()=>{let s;switch(t){case dr.Default:s=ort;break;case dr.NoTexture:s=Gg;break;case dr.Texture01:s=rrt;break;case dr.Texture02:s=jpe;break;case dr.Texture03:s=irt;break;case dr.Texture04:s=art;break;case dr.Texture05:s=lrt;break;case dr.Texture06:s=srt;break;case dr.Texture07:s=crt;break;case dr.Texture08:s=urt;break;case dr.Texture09:s=drt;break;case dr.Texture10:s=frt;break;case dr.Texture11:s=hrt;break;case dr.Texture12:s=prt;break;case dr.Texture13:s=grt;break;case dr.Texture14:s=mrt;break;case dr.Texture15:s=yrt;break;case dr.Texture16:s=Art;break;case dr.Texture17:s=wrt;break;default:s=jpe}return new Qg().load(s,c=>{n!==void 0&&o!==void 0&&(c.offset.set(.5,.5),c.repeat.set(1/n,1/o)),a(c),l()})},[t,e,n,o]),[i,a]=g.useState(r),{invalidate:l}=ti();return i},rhn=new vf({color:"white",side:$i}),ihn=xe.memo(({dimension:t,doorType:e})=>{const[n,o,r]=t.map(a=>a/2);return n===0&&r===0?null:h.jsxs("group",{name:"Door handle wrapper",children:[h.jsx(xv,{x:-n,z:r,handleType:xt.UpperLeft}),h.jsx(xv,{x:n,z:r,handleType:xt.UpperRight}),e===Wd.Arched&&h.jsx(trt,{z:r})]})}),ahn=xe.memo(({dimension:t})=>{const e=H(xs),[n,o,r]=t,[i,a,l]=t.map(c=>c/2),s=(c,u,d)=>h.jsx(yi,{name:"Door seal plane",args:c,position:u,rotation:d,material:rhn,receiveShadow:e});return h.jsxs("group",{name:"Door seal planes group",children:[s([o,r],[-i,a,0],[$t,$t,0]),s([o,r],[i,a,0],[$t,-$t,0]),s([n,o],[0,a,l],[Math.PI,0,0])]})}),lhn=t=>{const{id:e,parentId:n,cx:o,cy:r,cz:i,lx:a,ly:l,lz:s,textureType:c,locked:u=!1,color:d="white",doorType:f=Wd.Default,archHeight:p=1,filled:m=!0,opacity:y=1,frameColor:w="white"}=t,x=`Door Group ${e}`,C=H(pn),P=dt(kf),A=H(TGe),S=H(sQ),v=Fc(e),b=g.useRef(!1);g.useEffect(()=>{const oe=()=>{b.current=!1};return window.addEventListener("pointerup",oe),()=>window.removeEventListener("pointerup",oe)},[]);const T=(oe=!1)=>{S&&dt.getState().set(ee=>{ee.modelTreeExpandedKeys=[e]}),C(ee=>{if(ee.groupActionMode)ee.multiSelectionsMode||ee.selectedElementIdSet.clear(),t.foundationId&&(ee.selectedElementIdSet.has(n)?ee.selectedElementIdSet.delete(n):ee.selectedElementIdSet.add(t.foundationId));else for(const q of ee.elements)if(q.id===e)if(q.selected=!0,ee.selectedElement=q,oe)if(ee.selectedElementIdSet.has(e))for(const ae of ee.elements)ee.selectedElementIdSet.has(ae.id)&&ae.type!==ee.selectedElement.type&&ee.selectedElementIdSet.delete(ae.id);else if(ee.multiSelectionsMode){ee.selectedElementIdSet.add(e);for(const ae of ee.elements)ee.selectedElementIdSet.has(ae.id)&&ae.type!==ee.selectedElement.type&&ee.selectedElementIdSet.delete(ae.id)}else ee.selectedElementIdSet.clear(),ee.selectedElementIdSet.add(e);else ee.multiSelectionsMode?ee.selectedElementIdSet.has(e)?ee.selectedElementIdSet.delete(e):ee.selectedElementIdSet.add(e):(ee.selectedElementIdSet.clear(),ee.selectedElementIdSet.add(e));else q.selected=!1})},R=oe=>oe.intersections.length>0&&oe.intersections[0].eventObject.name===x&&!H.getState().moveHandleType&&!H.getState().resizeHandleType&&!H.getState().isAddingElement()&&H.getState().objectTypeToAdd===z.None,M=oe=>{if(oe.eventObject.name===x&&oe.intersections.length>0)switch(oe.object.name){case xt.UpperLeft:case xt.UpperRight:case xt.Arch:return!0}return!1},D=(oe,ee)=>{jn.getState().setEnableOrbitController(!1),P("showWallIntersectionPlaneId",n),C(q=>{q.resizeHandleType=oe,q.resizeAnchor.copy(new ue(o,0,i).add(ee))})},k=oe=>{H.getState().addedWallId||R(oe)&&(T(!0),C(ee=>{ee.contextMenuObjectType=z.Door}))},N=oe=>{if(!(b.current||oe.button===2||H.getState().addedWallId)&&(b.current=!0,R(oe)&&T(),M(oe))){const ee=oe.intersections[0].eventObject.name;switch(ee){case xt.UpperLeft:{D(ee,new ue(a/2,0,-s/2));break}case xt.UpperRight:{D(ee,new ue(-a/2,0,-s/2));break}case xt.Arch:{D(ee,new ue(0,0,0));break}}}},U=H(p4),W=dt(vs),F=dt(n6),E=H(Df),L=In(O1),[j,Y]=g.useState(null),O=()=>{switch(f){case Wd.Default:return h.jsx(thn,{id:e,dimension:G,color:d,frameColor:w,selected:v,locked:u,material:Q,filled:m,showHeatFluxes:F,area:ye.getDoorArea(t),foundation:U(t)});case Wd.Arched:return h.jsx(nhn,{id:e,dimension:G,color:d,frameColor:w,selected:v,locked:u,material:Q,filled:m,showHeatFluxes:F,area:ye.getDoorArea(t),foundation:U(t)})}};g.useEffect(()=>{if(t&&W){const oe=L(t.id);if(oe){const ee=ye.fetchHeatmapTexture(oe,E??5);ee&&(ee.wrapS=es,ee.wrapT=es,ee.offset.set(-a/2,-s/2),ee.center.set(a/2,s/2),ee.repeat.set(1/a,1/s),Y(ee))}}},[W,E]);const _=ohn(c,f,a,s),G=g.useMemo(()=>[a,l,s,p],[a,l,s,p]),Q=g.useMemo(()=>W&&j&&t.filled?new _3({color:d,map:j,side:$i}):m?c===dr.Default||c===dr.NoTexture?y<1?new S2e({specular:"white",shininess:A??DX,color:d,side:$i,opacity:y,transparent:!0}):new vf({map:_,color:d,side:$i}):new vf({map:_,side:$i}):new vf({opacity:d===kde?.5:0,color:d,transparent:!0,side:zr}),[W,j,d,c,_,m,y]);return h.jsxs("group",{name:x,position:[o,0,i],onPointerDown:N,onContextMenu:k,children:[O(),v&&h.jsx(X3e,{element:t}),v&&!u&&h.jsx(ihn,{dimension:G,doorType:f}),h.jsx(ahn,{dimension:G})]})},shn=xe.memo(lhn),chn="/aladdin/assets/polygon_08-BBFzZjDj.png",uhn="/aladdin/assets/polygon_09-B_8KpAt3.png",dhn="/aladdin/assets/polygon_10-CKqrpQre.png",xrt=({id:t,lz:e=.1,filled:n=!1,rotation:o=[0,0,0],normal:r=[0,0,1],color:i="yellow",label:a,text:l,fontSize:s=1,fontColor:c="black",fontOutlineWidth:u=0,fontOutlineColor:d="white",fontStrokeWidth:f=0,fontStrokeColor:p="black",lineStyle:m=Ap.Solid,lineColor:y="black",lineWidth:w=1,locked:x=!1,showLabel:C=!1,parentId:P,foundationId:A,vertices:S,opacity:v=1,noOutline:b=!1,shininess:T=0,selectedIndex:R=-1,textureType:M=Zr.NoTexture})=>{const D=H(pn),k=H(z0),N=H(bQ),U=H(xs),W=Fc(t),{gl:{domElement:F}}=ti(),[E,L]=g.useState(!1),[j,Y]=g.useState(0),[O,_]=g.useState(0),[G,Q]=g.useState(null),oe=g.useRef(null),ee=g.useRef(null),q=H(Te=>{for(const Re of Te.elements)if(Re.id===P)return Re}),ae=new ue,Z=new cn;if((q==null?void 0:q.type)===z.Cuboid){const{pos:Te,rot:Re}=ye.getWorldDataById(q.id);ae.copy(Te),Z.set(0,0,Re)}const ne=q?Math.max(1,Math.max(q.lx,q.ly)/24):1,te=$8*ne,$=Tm*ne,le=Kt(),de=(Te,Re)=>{D(Ne=>{for(const _e of Ne.elements)if(_e.type===z.Polygon&&_e.id===Te){_e.selectedIndex=Re;break}})},he=g.useMemo(()=>{const Te=new Array;if(q){switch(q.type){case z.Foundation:{for(const Ne of S)Te.push({x:Ne.x*q.lx,y:Ne.y*q.ly});break}case z.Wall:{for(const Ne of S)Te.push({x:Ne.x*q.lx,y:Ne.y*q.lz});break}case z.Cuboid:{const Ne=new ue().fromArray(r);let _e,Ue;ye.isUnitVectorX(Ne)?(_e=q.lz,Ue=q.ly):ye.isUnitVectorY(Ne)?(_e=q.lx,Ue=q.lz):(_e=q.lx,Ue=q.ly);for(const qe of S)Te.push({x:qe.x*_e,y:qe.y*Ue});break}}const Re=ye.calculatePolygonCentroid(Te);Y(Re.x),_(Re.y)}return Te},[S,q,r]),ce=(()=>{if((q==null?void 0:q.type)===z.Cuboid){const Te=ye.isIdentical(r,fs);return ae.z+(q.lz+(Te?0:e))/2+.01}return(q==null?void 0:q.type)===z.Foundation?q.lz+.01:e/2+.01})(),pe=(()=>{if((q==null?void 0:q.type)===z.Wall)return new cn(-$t,0,Math.PI,"ZXY");const Te=new ue().fromArray(r);let Re=o[2];return(q==null?void 0:q.type)===z.Cuboid&&(Re=Z.z),ye.isSame(Te,b1)?new cn(0,$t,Re,"ZXY"):ye.isSame(Te,S1)?new cn(0,-$t,Re,"ZXY"):ye.isSame(Te,Zc)?new cn(-$t,0,Re,"ZXY"):ye.isSame(Te,T1)?new cn($t,0,Re,"ZXY"):new cn(0,0,Re,"ZXY")})(),ve=(()=>{if(q){if(q.type===z.Cuboid){const Te=new ue(ae.x,ae.y,ce),Re=new ue().fromArray(r);let Ne=!1;const _e=new ue;return ye.isSame(Re,b1)?(Ne=!0,_e.x=q.lx/2+.01):ye.isSame(Re,S1)?(Ne=!0,_e.x=-q.lx/2-.01):ye.isSame(Re,Zc)?(Ne=!0,_e.y=q.ly/2+.01):ye.isSame(Re,T1)&&(Ne=!0,_e.y=-q.ly/2-.01),Ne&&(_e.applyEuler(Z),Te.x=ae.x+_e.x,Te.y=ae.y+_e.y,Te.z=ae.z+_e.z),Te}else if(q.type===z.Wall)return new ue(0,-.01,0)}return new ue((q==null?void 0:q.cx)??0,(q==null?void 0:q.cy)??0,ce)})(),ze=g.useMemo(()=>{const Te=new Array;for(const Re of he)Te.push(new ue(Re.x,Re.y,0));return Te.push(new ue(he[0].x,he[0].y,0)),Te},[he]),Ae=g.useMemo(()=>{const Te=new jl;Te.moveTo(he[0].x,he[0].y);for(let Re=1;Re{Te.intersections.length>0&&Te.intersections[0].object===Te.eventObject&&(Q(Re),Re===Ho.Default?F.style.cursor="move":F.style.cursor="pointer")},[]),ge=g.useCallback(()=>{Q(null),F.style.cursor="default"},[]),we=Te=>{switch(Te){case Zr.Texture01:return{x:1,y:1};case Zr.Texture02:return{x:2,y:2};case Zr.Texture03:return{x:.4,y:.4};case Zr.Texture04:return{x:.25,y:.25};case Zr.Texture05:return{x:5,y:5};case Zr.Texture06:return{x:1,y:1};case Zr.Texture07:return{x:1,y:1};case Zr.Texture08:return{x:2,y:2};case Zr.Texture09:return{x:2,y:2};case Zr.Texture10:return{x:4,y:4};default:return{x:1,y:1}}},Se=g.useMemo(()=>{let Te;switch(M){case Zr.Texture01:Te=Dot;break;case Zr.Texture02:Te=Eot;break;case Zr.Texture03:Te=kot;break;case Zr.Texture04:Te=Fot;break;case Zr.Texture05:Te=Lot;break;case Zr.Texture06:Te=Wot;break;case Zr.Texture07:Te=Not;break;case Zr.Texture08:Te=chn;break;case Zr.Texture09:Te=uhn;break;case Zr.Texture10:Te=dhn;break;default:Te=Gg}return new Qg().load(Te,Re=>{const Ne=we(M);Re.wrapT=Re.wrapS=es,Re.repeat.set(1/Ne.x,1/Ne.y);const _e=new ue().fromArray(r);ye.isSame(_e,b1)?Re.rotation=$t:ye.isSame(_e,S1)?Re.rotation=-$t:ye.isSame(_e,T1)&&(Re.rotation=Math.PI),Ce(Re)})},[M,r]),[Me,Ce]=g.useState(Se);return h.jsxs("group",{name:"Polygon Group "+t,rotation:pe,position:ve,children:[n&&h.jsxs("mesh",{uuid:t,ref:oe,receiveShadow:U,castShadow:!1,name:z.Polygon,onPointerDown:Te=>{Te.button!==2&&N===z.None&&k(t,Te)},onContextMenu:Te=>{k(t,Te,er.ContextMenu),D(Re=>{Te.intersections.length>0&&Te.intersections[0].object===oe.current&&(Te.intersections.length>1&&Re.pastePoint.copy(Te.intersections[1].point),Re.contextMenuObjectType=z.Polygon)})},onPointerOver:Te=>{Te.intersections.length>0&&Te.intersections[0].object===oe.current&&L(!0)},onPointerOut:()=>{L(!1),F.style.cursor="default"},children:[h.jsx("shapeGeometry",{attach:"geometry",args:[Ae]}),T===void 0||T===0?h.jsx("meshStandardMaterial",{attach:"material",color:M===Zr.NoTexture?i:"white",map:Me,side:zr,transparent:v<1,opacity:v}):h.jsx("meshPhongMaterial",{attach:"material",color:M===Zr.NoTexture?i:"white",map:Me,side:$i,specular:new ir("white"),shininess:T,transparent:v<1,opacity:v})]}),l&&h.jsx(Nbt,{fontSize:s,scale:[1,1,1],color:c,position:[j,O,.01],rotation:[0,0,(q==null?void 0:q.type)===z.Wall?Math.PI:0],anchorX:"center",anchorY:"middle",outlineWidth:u,outlineColor:d,strokeWidth:f,strokeColor:p,children:l}),(!b||x&&W)&&h.jsx(On,{points:ze,color:x&&W?i0:y,lineWidth:w,dashed:m&&m!==Ap.Solid,dashSize:m===Ap.Dashed?.3:.1,gapSize:.1,uuid:t,receiveShadow:!1,castShadow:!1,name:"Polygon Wireframe",onPointerDown:Te=>{Te.button!==2&&k(t,Te)},onContextMenu:Te=>{N===z.None&&(k(t,Te,er.ContextMenu),D(Re=>{if(Te.intersections.length>0){const Ne=Te.intersections[0].object;Ne.name==="Polygon Wireframe"&&Ne.uuid===t&&(Re.contextMenuObjectType=z.Polygon)}}))}}),!n&&h.jsx(On,{position:[0,0,.1],points:ze,visible:!1,lineWidth:Math.min(w*10,10),receiveShadow:!1,castShadow:!1,uuid:t,name:"Polygon Enlarged Line",onPointerDown:Te=>{Te.button!==2&&k(t,Te)},onContextMenu:Te=>{N===z.None&&(k(t,Te,er.ContextMenu),D(Re=>{if(Te.intersections.length>0){const Ne=Te.intersections[0].object;Ne.name==="Polygon Enlarged Line"&&Ne.uuid===t&&(Re.contextMenuObjectType=z.Polygon)}}))}}),W&&!x&&h.jsx(Ys,{ref:ee,position:[j,O,0],args:[$,6,6],name:Ho.Default,onPointerDown:Te=>{Te.button!==2&&(k(t,Te,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(Re=>{Re.showWallIntersectionPlaneId=P,Re.oldParentId=P,Re.oldFoundationId=A}),D(Re=>{Re.moveHandleType=Ho.Default}))},onPointerOver:Te=>{se(Te,Ho.Default)},onPointerOut:ge,children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),W&&!x&&he.map((Te,Re)=>h.jsxs(xe.Fragment,{children:[h.jsx(di,{userData:{vertexIndex:Re},position:[Te.x,Te.y,0],name:xt.Default,args:[te,te,e/2+(n?0:.1)],onPointerDown:Ne=>{Ne.button!==2&&(k(t,Ne,er.Resize),de(t,Re),jn.getState().setEnableOrbitController(!1),dt.getState().set(_e=>{_e.showWallIntersectionPlaneId=P,_e.oldParentId=P,_e.oldFoundationId=A}),D(_e=>{_e.resizeHandleType=xt.Default}))},onPointerOver:Ne=>{se(Ne,xt.Default),de(t,Re)},onPointerOut:ge,onContextMenu:Ne=>{D(_e=>{if(Ne.intersections.length>0){const Ue=Ne.intersections[0].object.userData.vertexIndex;Ue!==void 0&&(_e.contextMenuObjectType=z.PolygonVertex,de(t,Ue))}})},children:h.jsx("meshBasicMaterial",{attach:"material",color:(G===xt.Default||H.getState().resizeHandleType===xt.Default)&&R===Re?Aa:ll})}),h.jsx("textSprite",{name:"Label "+Re,text:""+Re,fontSize:20*ne,fontFace:"Times Roman",textHeight:.2*ne,position:[Te.x,Te.y,.2*ne]})]},"resize-handle-"+Re)),(E||C)&&!W&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(a??B.t("shared.PolygonElement",le))+(x?" ("+B.t("shared.ElementLocked",le)+")":""),fontSize:20*ne,fontFace:"Times Roman",textHeight:.2*ne,position:[0,0,e+.2]})]})},K3e={display:!1,color:"white",textureType:Jo.NoTexture,parapetHeight:1,copingsWidth:.5,copingsHeight:.1},fhn=({args:t,wallData:e,parapetZ:n,currWallPointData:o,leftWallPointData:r,rightWallPointData:i})=>{const{display:a,color:l,textureType:s,parapetHeight:c,copingsWidth:u,copingsHeight:d}=t,{id:f,cx:p,cy:m,hx:y,hy:w,angle:x}=e,C=c-d,P=Pot(s),A=g.useMemo(()=>{const W=new ue(-y,w-u/2),F=new ue(y,w-u/2),E=new ue(y,w+u/2),L=new ue(-y,w+u/2),j=[W,F,E,L];if(i||r){const Y=gMe(o);if(i&&L_(o.rightPoint,i.leftPoint)){const O=M(Y,i);O&&(F.copy(O.outerIntersection),E.copy(O.innerIntersection))}if(r&&L_(o.leftPoint,r.rightPoint)){const O=M(Y,r);O&&(W.copy(O.outerIntersection),L.copy(O.innerIntersection))}}return j},[y,w,u,o,r,i]),S=g.useMemo(()=>{const W=new jl,F=new ue(-y,w*2),E=new ue(y,w*2);if(i||r){const L=EJ(o,o.ly);if(i&&L_(o.rightPoint,i.leftPoint)){const j=D(L,i);j&&E.copy(j)}if(r&&L_(o.leftPoint,r.rightPoint)){const j=D(L,r);j&&F.copy(j)}}return W.moveTo(-y,0),W.lineTo(y,0),W.lineTo(E.x,E.y),W.lineTo(F.x,F.y),W.closePath(),W},[y,w,o,r,i]),v=g.useMemo(()=>{const W=new jl;if(u===0)return W;const[F,E,L,j]=A;return W.moveTo(F.x,F.y),W.lineTo(E.x,E.y),W.lineTo(L.x,L.y),W.lineTo(j.x,j.y),W.closePath(),W},[u,A]),b=g.useMemo(()=>A.map(W=>W.toArray()),[A]),T=g.useMemo(()=>[new ue(-y,0,0),new ue(y,0,0)],[y]),R=g.useMemo(()=>[new ue,new ue(0,0,C)],[C]);function M(W,F){const E=gMe(F),L=Kse(W.outerPoints.leftPoint,W.outerPoints.rightPoint,E.outerPoints.leftPoint,E.outerPoints.rightPoint);if(!L)return null;const j=Kse(W.innerPoints.leftPoint,W.innerPoints.rightPoint,E.innerPoints.leftPoint,E.innerPoints.rightPoint);return j?{innerIntersection:new ue().subVectors(j,new ue(p,m)).applyEuler(new cn(0,0,-x)),outerIntersection:new ue().subVectors(L,new ue(p,m)).applyEuler(new cn(0,0,-x))}:null}function D(W,F){const E=EJ(F,F.ly),L=Kse(W.leftPoint,W.rightPoint,E.leftPoint,E.rightPoint);return L?new ue().subVectors(L,new ue(p,m)).applyEuler(new cn(0,0,-x)):null}function k(){return!(H.getState().moveHandleType||H.getState().resizeHandleType||H.getState().isAddingElement())}function N(W){W.button!==2&&W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&k()&&H.getState().selectMe(f,W,er.Select,!0)}function U(W){H.getState().selectMe(f,W,er.ContextMenu,!0),H.getState().set(F=>{W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&(F.contextMenuObjectType=z.Wall)})}return a?h.jsxs("group",{name:"Wall Parapet Group",position:[0,0,n],onContextMenu:U,onPointerDown:N,children:[h.jsx(Q8,{name:"Body Extrude Mesh",args:[S,{steps:1,depth:C,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l,map:P})}),h.jsx(On,{position:[y,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(On,{position:[-y,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(On,{position:[0,0,C],points:T,color:"black",lineWidth:.2}),h.jsx(Q8,{name:"Copings Extrude Mesh",position:[0,0,C],args:[v,{steps:1,depth:d,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l})}),h.jsx(On,{position:[0,0,C+d],points:b,color:"black",lineWidth:.2}),h.jsx(On,{position:[0,0,C],points:b,color:"black",lineWidth:.2})]}):null};function gMe(t){const e=(t.ly+t.copingsWidth)/2,n=(t.ly-t.copingsWidth)/2;return{innerPoints:EJ(t,e),outerPoints:EJ(t,n)}}function EJ(t,e){const{leftPoint:n,rightPoint:o}=t,r=new ue().fromArray(n),i=new ue().fromArray(o),l=new ue().subVectors(i,r).applyEuler(new cn(0,0,$t)).normalize().clone().multiplyScalar(e);return{leftPoint:r.clone().add(l),rightPoint:i.clone().add(l)}}function L_(t,e){return Math.abs(t[0]-e[0]){const{id:n,lx:o,lz:r}=t,i=H($3),a=H(Y5),l=H(J3),s=H(K3),c=In(PS),u=dt(n6),d=g.useRef(0),f=g.useRef(),p=g.useMemo(()=>{if(!u||e)return;const m=c.get(n);if(!m)return;const y=m.reduce((j,Y)=>j+Y,0),w=t.fill===Ul.Partial&&!ye.isPartialWallFull(t),x=ye.getWallVertices(t,0),C=w?ye.getPartialWallVertices(t,0):x,P=ye.getPolygonArea(x);let A=w?ye.getPolygonArea(C):P;if(A===0)return;const S=i(z.Window,n),v=i(z.Door,n);if(S&&S.length>0)for(const j of S)A-=ye.getWindowArea(j,t);if(v&&v.length>0)for(const j of v)A-=j.lx*j.lz*t.lx*t.lz;const b=H.getState().world,T=X3*(b.solarRadiationHeatmapGridCellSize??.5),R=ye.getHighestPointOfWall(t),M=Math.max(2,Math.round(o/T)),D=Math.max(2,Math.round(R/T)),k=o/M,N=R/D,U=(R-t.lz)/2,W=y/A*(a??Ny);d.current=W<0?1:0,f.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(W)*$t);const F=[],E=w?ye.getPartialWallVertices(t,0):ye.getWallVertices(t,0);let L;for(let j=0;j0)for(const Q of S){if(Q.type!==z.Window)continue;const oe=Q.cx*t.lx,ee=Q.cz*t.lz,q=Q.lx*t.lx/2,ae=Q.lz*t.lz/2;if(Q.windowType===Ti.Arched){if(_>=oe-q&&_=ee-ae&&G=oe-q&&_=ee-ae&&G0)for(const Q of v){const oe=Q.cx*o,ee=Q.cz*R,q=Q.lx*o/2,ae=Q.lz*R/2;if(_>=oe-q&&_=ee-ae&&Gh.jsxs(xe.Fragment,{children:[h.jsx(On,{points:m,name:"Heat Flux "+y,lineWidth:s??Uy,color:l??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:m[d.current].clone().add(new ue(0,d.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:f.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:l??Fu})})]},y))}):null},ghn=xe.memo(phn),$se="Wall Block Plane",mhn="Wall Intersection Plane",fC=.1,yhn=xe.memo(({transparent:t,color:e,opacity:n})=>{const r=H(I7).z<=0;return h.jsx("meshStandardMaterial",{color:t?e:"white",transparent:t,opacity:n,side:r?js:zr})}),Ahn=({wallModel:t,foundationModel:e})=>{var tn,Gt,wn,Cn,Wn,Un;const{id:n,cx:o,cy:r,lx:i=1,ly:a=.5,lz:l=5,relativeAngle:s,leftJoints:c,rightJoints:u,textureType:d,color:f="white",lineColor:p="black",lineWidth:m=.2,parentId:y,locked:w=!1,roofId:x,leftRoofHeight:C,rightRoofHeight:P,centerRoofHeight:A,centerLeftRoofHeight:S,centerRightRoofHeight:v,wallStructure:b=Tc.Default,structureSpacing:T=2,structureWidth:R=.1,structureColor:M="white",opacity:D=.5,fill:k=Ul.Full,leftUnfilledHeight:N=.5,rightUnfilledHeight:U=.5,leftTopPartialHeight:W=l,rightTopPartialHeight:F=l,parapet:E=K3e,leftPoint:L,rightPoint:j}=t,Y=c.length>0?C:l,O=u.length>0?P:l,_=Pot(d),G=Fc(n),Q=H(pn),oe=H(HS),ee=H(z0),q=H(Fn),ae=H(b5e),Z=In(O1),ne=H(M7),te=H(xs),$=H(S5e),le=H(RJe),de=H(Df),he=dt(kf),me=dt(vs),ce=dt(rt=>rt.elementBeingCanceledId),Pe=dt(rt=>rt.showWallIntersectionPlaneId),[pe,Ie]=g.useState(!1),[ve,ze]=g.useState(null),{camera:Ae,gl:se}=ti(),{elementsOnWall:ge,leftWall:we,rightWall:Se}=ydn(n,c[0],u[0]),Me=Cot(e),Ce=g.useRef(null),Te=g.useRef(null),Re=g.useRef(null),Ne=g.useRef(null),_e=g.useRef(null),Ue=g.useRef(null),qe=g.useRef(null),Fe=g.useRef(null),He=i/2,Le=a/2,Ye=l/2,lt=Me?Me.rotation[2]+s:s,Oe=ye.getInnerWallOffset(we,i,a,s,"left"),ut=ye.getInnerWallOffset(Se,i,a,s,"right"),ht=b===Tc.Stud||b===Tc.Pillar,Qe=Y??l,nt=O??l,mt=k===Ul.Partial,tt=mt?N:0,gt=mt?U:0,Ve=mt?Math.min(Qe,W):Qe,je=mt?Math.min(nt,F):nt,et=mt&&(!ye.isZero(Qe-Ve)||!ye.isZero(nt-je)),bt=te&&!ht,St=E.display,Pt=Math.max(Ve,je)-Ye,Yt=g.useMemo(()=>new _t,[]),zt=g.useMemo(()=>new yu,[]),Rt=g.useMemo(()=>new vf({color:"white",side:zr,transparent:ht,opacity:D}),[ht,D]),Ct=g.useMemo(()=>ye.getHighestPointOfWall(t),[t.lz,t.leftRoofHeight,t.rightRoofHeight,t.centerRoofHeight,t.centerLeftRoofHeight,t.centerRightRoofHeight]),yt=g.useMemo(()=>{const rt=new jl;return ct(rt,i,l,0,0,0,0),ge.forEach(vt=>{if(vt.type===z.Window&&vt.id!==qe.current&&vt.lx>0&&vt.lz>0){const Nt=vt,Ft=new jl,[en,sn,dn,En]=[vt.lx*i,vt.lz*l,vt.cx*i,vt.cz*l];if(Nt.windowType)switch(Nt.windowType){case Ti.Arched:fo(Ft,en,sn,dn,En,Nt.archHeight);break;case Ti.Polygonal:{const[xn,Tn]=Nt.polygonTop??P1;to(Ft,en,sn,dn,En,xn*en,Tn);break}case Ti.Default:default:Pn(Ft,en,sn,dn,En)}else Pn(Ft,en,sn,dn,En);rt.holes.push(Ft)}}),rt},[i,l,k,N,U,Ve,je,ge,Y,O,A,S,v]),at=g.useMemo(()=>{const rt=new jl,vt=l,Nt=l/2;if(mt)rt.moveTo(-He+Oe,-Nt+N),rt.lineTo(He-ut,-Nt+U);else{rt.moveTo(-He+Oe,-Nt);const Ft=ge.filter(en=>en.type===z.Door).sort((en,sn)=>en.cx-sn.cx);for(const en of Ft)if(en.id!==qe.current){const[sn,dn,En,xn]=[en.cx*i,en.cz*vt,en.lx*i,en.lz*vt];if(en.doorType===Wd.Default)rt.lineTo(sn-En/2,-Nt),rt.lineTo(sn-En/2,-Nt+xn),rt.lineTo(sn+En/2,-Nt+xn),rt.lineTo(sn+En/2,-Nt);else{const Tn=Math.min(en.archHeight,xn,En/2);if(rt.lineTo(sn-En/2,-Nt),Tn>.1){rt.lineTo(sn-En/2,-Nt+xn/2-Tn);const _n=Tn/2+En**2/(8*Tn),[Vn,Gn]=[sn,dn+xn/2-_n],go=Math.acos(Math.min(En/2/_n,1)),qo=Math.PI-go;rt.absarc(Vn,Gn,_n,qo,go,!0)}else rt.lineTo(sn-En/2,-Nt+xn),rt.lineTo(sn+En/2,-Nt+xn);rt.lineTo(sn+En/2,-Nt)}}rt.lineTo(He-ut,-Nt)}if(et){const Ft=je-Ve,en=(i-ut)*Ft/i,sn=Oe*Ft/i;rt.lineTo(He-ut,-Nt+Ve+en),rt.lineTo(-He+Oe,-Nt+Ve+sn)}else x?(O?rt.lineTo(He-ut,O-Nt):rt.lineTo(He-ut,Nt),v&&rt.lineTo(v[0]*i,v[1]-Nt),A&&rt.lineTo(A[0]*i,A[1]-Nt),S&&rt.lineTo(S[0]*i,S[1]-Nt),Y?rt.lineTo(-He+Oe,Y-Nt):rt.lineTo(-He+Oe,Nt)):(rt.lineTo(He-ut,Nt),rt.lineTo(-He+Oe,Nt));return rt.closePath(),ge.forEach(Ft=>{if(Ft.type===z.Window&&Ft.id!==qe.current&&Ft.lx>0&&Ft.lz>0){const en=Ft,sn=new jl,[dn,En,xn,Tn]=[Ft.lx*i,Ft.lz*l,Ft.cx*i,Ft.cz*l];if(en.windowType)switch(en.windowType){case Ti.Arched:fo(sn,dn,En,xn,Tn,en.archHeight);break;case Ti.Polygonal:{const[_n,Vn]=en.polygonTop??P1;to(sn,dn,En,xn,Tn,_n*dn,Vn);break}case Ti.Default:default:Pn(sn,dn,En,xn,Tn);break}else Pn(sn,dn,En,xn,Tn);rt.holes.push(sn)}}),rt},[i,l,k,N,U,Ve,je,Oe,ut,ge,x,Y,O,A,S,v]),Et=g.useMemo(()=>mt?(Ve+je)/2-Ye:Ye,[Ye,mt,Ve,je]),Lt=g.useMemo(()=>{const rt=je-Ve;return!mt||Math.abs(rt)<.01?0:Math.atan2(rt,i)},[i,mt,Ve,je]),Je=g.useMemo(()=>{const rt=new jl;if(!mt||Math.abs(Lt)<1e-4)return rn(rt,i,a,Oe,ut),rt;{const vt=i/2,Nt=a/2,Ft=Math.cos(Lt),en=vt/Ft,sn=(vt-Oe)/Ft,dn=(vt-ut)/Ft;return rt.moveTo(-en,-Nt),rt.lineTo(en,-Nt),rt.lineTo(dn,Nt),rt.lineTo(-sn,Nt),rt.closePath(),rt}},[i,a,Oe,ut,mt,Lt]),st=g.useMemo(()=>{const rt=[],vt=i/2,Nt=l/2;return mt?(rt.push({x:-vt+Oe,y:-Nt+tt}),rt.push({x:vt-ut,y:-Nt+gt})):(rt.push({x:-vt,y:-Nt}),rt.push({x:vt,y:-Nt})),et?(rt.push({x:vt-ut,y:-Nt+je}),rt.push({x:-vt+Oe,y:-Nt+Ve})):(O?rt.push({x:vt,y:O-Nt}):rt.push({x:vt,y:Nt}),v&&rt.push({x:v[0]*i,y:v[1]-Nt}),A&&rt.push({x:A[0]*i,y:A[1]-Nt}),S&&rt.push({x:S[0]*i,y:S[1]-Nt}),Y?rt.push({x:-vt,y:Y-Nt}):rt.push({x:-vt,y:Nt})),rt},[i,l,k,tt,gt,Ve,je,Y,O,A,S,v]),It=g.useMemo(()=>{const rt=[];let vt=0,Nt=0;if(k===Ul.Partial&&(vt=(U-N)/i,Nt=N+He*vt),b===Tc.Stud){let Ft=-He+R/2;for(;Ft<=He;)rt.push([Ft,vt*Ft+Nt]),Ft+=T;Ft=He-R/2,rt.push([Ft,vt*Ft+Nt])}else if(b===Tc.Pillar){let Ft=-He;for(;Ft<=He;)rt.push([Ft,vt*Ft+Nt]),Ft+=T;rt.push([He,vt*He+Nt])}return rt},[b,R,T,i,a,l,N,U]),ot=g.useMemo(()=>({id:n,parentId:y,cx:o,cy:r,hx:He,hy:Le,angle:s,selected:G}),[n,y,o,r,He,Le,s,G]),it=g.useMemo(()=>({leftPoint:L,rightPoint:j,ly:a,copingsWidth:E.copingsWidth}),[L,j,a,E.copingsWidth]),Be=g.useMemo(()=>!we||!we.parapet||!we.parapet.display?null:{leftPoint:we.leftPoint,rightPoint:we.rightPoint,ly:we.ly,copingsWidth:we.parapet.copingsWidth},[we==null?void 0:we.leftPoint,we==null?void 0:we.rightPoint,we==null?void 0:we.ly,(tn=we==null?void 0:we.parapet)==null?void 0:tn.copingsWidth,(Gt=we==null?void 0:we.parapet)==null?void 0:Gt.display]),pt=g.useMemo(()=>!Se||!Se.parapet||!Se.parapet.display?null:{leftPoint:Se.leftPoint,rightPoint:Se.rightPoint,ly:Se.ly,copingsWidth:Se.parapet.copingsWidth},[Se==null?void 0:Se.leftPoint,Se==null?void 0:Se.rightPoint,Se==null?void 0:Se.ly,(wn=Se==null?void 0:Se.parapet)==null?void 0:wn.copingsWidth,(Cn=Se==null?void 0:Se.parapet)==null?void 0:Cn.display]);g.useEffect(()=>{Fe.current&&Fe.current.id===ce&&(Fe.current=null,wo())},[ce]),g.useEffect(()=>{if(t&&me){const rt=Z(t.id);if(rt){const vt=ye.fetchHeatmapTexture(rt,de??5);if(vt){vt.wrapS=es,vt.wrapT=es;const Nt=l===Ct?0:(1-l/Ct)/2;vt.offset.set(-i/2,-Ct/2-Nt),vt.center.set(i/2,Ct/2),vt.repeat.set(1/i,1/Ct),ze(vt)}}}},[me,de]),g.useEffect(()=>{x&&($.has(x)||le.has(x))&&H.getState().set(rt=>{const vt=new Set;for(const Nt of rt.elements)if(Nt.id===n&&Nt.type===z.Wall){const Ft=Nt;if(Ft.roofId=null,Ft.leftRoofHeight=void 0,Ft.rightRoofHeight=void 0,Ft.centerRoofHeight=void 0,Ft.centerLeftRoofHeight=void 0,Ft.centerRightRoofHeight=void 0,ge.length>0){const en=Rn.getWallPoints2D(Ft);ge.forEach(sn=>{if(sn.type===z.Polygon)return;const dn=sn.type===z.Door,En=sn.type===z.SolarPanel,xn=En?sn.lx-.01:sn.lx*i,Tn=En?sn.ly-.01:sn.lz*l,_n=new ue(sn.cx*i,0,sn.cz*l);ye.isElementInsideWall(_n,xn,Tn,en,dn)||(vt.add(sn.id),rt.autoDeletedChild?rt.autoDeletedChild.push(sn):rt.autoDeletedChild=[sn])})}break}vt.size>0?rt.elements=rt.elements.filter(Nt=>!vt.has(Nt.id)):rt.autoDeletedChild===null&&(rt.autoDeletedChild=[])})},[x,$,le]);function ct(rt,vt,Nt,Ft=0,en=0,sn=0,dn=0,En=!0){const xn=vt/2,Tn=Nt/2;if(mt?rt.moveTo(Ft-xn+sn,en-Tn+N):rt.moveTo(Ft-xn+sn,en-Tn),En){const _n=ge.filter(Vn=>Vn.type===z.Door).sort((Vn,Gn)=>Vn.cx-Gn.cx);for(const Vn of _n)if(Vn.id!==qe.current){const[Gn,go,qo,Xr]=[Vn.cx*vt,Vn.cz*Nt,Vn.lx*vt,Vn.lz*l];if(Vn.doorType===Wd.Default)rt.lineTo(Ft+Gn-qo/2,en-Tn),rt.lineTo(Ft+Gn-qo/2,en-Tn+Xr),rt.lineTo(Ft+Gn+qo/2,en-Tn+Xr),rt.lineTo(Ft+Gn+qo/2,en-Tn);else{const qr=Math.min(Vn.archHeight,Xr,qo/2);if(rt.lineTo(Ft+Gn-qo/2,en-Tn),qr>.1){rt.lineTo(Ft+Gn-qo/2,en-Tn+Xr/2-qr);const na=qr/2+qo**2/(8*qr),[k0,Gh]=[Gn,en+go+Xr/2-na],cc=Math.acos(Math.min(qo/2/na,1)),wu=Math.PI-cc;rt.absarc(k0,Gh,na,wu,cc,!0)}else rt.lineTo(Ft+Gn-qo/2,en-Tn+Xr),rt.lineTo(Ft+Gn+qo/2,en-Tn+Xr);rt.lineTo(Ft+Gn+qo/2,en-Tn)}}}mt?rt.lineTo(Ft+xn-dn,en-Tn+U):rt.lineTo(Ft+xn-dn,en-Tn),et?(rt.lineTo(Ft+xn-dn,en-Tn+je),rt.lineTo(Ft-xn+sn,en-Tn+Ve)):x?(O?rt.lineTo(Ft+xn-dn,O-Tn):rt.lineTo(Ft+xn-dn,en+Tn),v&&rt.lineTo(v[0]*vt,v[1]-Tn),A&&rt.lineTo(A[0]*vt,A[1]-Tn),S&&rt.lineTo(S[0]*vt,S[1]-Tn),Y?rt.lineTo(Ft-xn+sn,Y-Tn):rt.lineTo(Ft-xn+sn,en+Tn)):(rt.lineTo(Ft+xn-dn,en+Tn),rt.lineTo(Ft-xn+sn,en+Tn)),rt.closePath()}function Xe(rt,vt){const{cx:Nt,cy:Ft,cz:en}=vt;if(Me&<!==void 0){const sn=ye.wallAbsolutePosition(new ue(Nt,Ft,en),Me).setZ(l/2+Me.lz);return new ue().subVectors(rt,sn).applyEuler(new cn(0,0,-lt))}return new ue}function ft(rt){const vt=[];for(let Nt=-1;Nt<=1;Nt+=2)for(let Ft=-1;Ft<=1;Ft+=2){const[en,sn]=[Nt,Nt*Ft];switch(rt.type){case z.Window:{const[dn,En]=[rt.cx*i,rt.cz*l],[xn,Tn]=[rt.lx*i/2,rt.lz*l/2],_n=dn+en*xn,Vn=En+sn*Tn;vt.push({x:_n,y:Vn});break}case z.Door:{const[dn,En]=[rt.cx*i,rt.cz*l],[xn,Tn]=[rt.lx*i/2,rt.lz*l/2],_n=dn+en*xn,Vn=En+sn*Tn;vt.push({x:_n,y:Vn});break}case z.SolarPanel:{const[dn,En]=[rt.cx*i,rt.cz*l],[xn,Tn]=[rt.lx/2,rt.ly/2],_n=dn+en*xn,Vn=En+sn*Tn;vt.push({x:_n,y:Vn})}}}if(rt.type===z.Window&&rt.windowType===Ti.Polygonal){const Nt=rt,[Ft,en]=Nt.polygonTop??[0,0];vt.push({x:rt.cx*i+Ft*rt.lx*i,y:rt.cz*l+rt.lz*l/2+en})}return vt}function wt(rt,vt=0){if(!mt)return ye.getWallVertices(rt,vt);const Nt=rt.lx/2,Ft=rt.lz/2,en={x:-Nt-vt,y:rt.leftUnfilledHeight-Ft-vt},sn={x:Nt+vt,y:rt.rightUnfilledHeight-Ft-vt},dn={x:-Nt-vt,y:rt.leftTopPartialHeight-Ft+vt},En={x:Nt+vt,y:rt.rightTopPartialHeight-Ft+vt},xn=[];return xn.push(dn,en,sn,En),et||(rt.centerRightRoofHeight&&xn.push({x:rt.centerRightRoofHeight[0]*rt.lx,y:rt.centerRightRoofHeight[1]-Ft+vt}),rt.centerRoofHeight&&xn.push({x:rt.centerRoofHeight[0]*rt.lx,y:rt.centerRoofHeight[1]-Ft+vt}),rt.centerLeftRoofHeight&&xn.push({x:rt.centerLeftRoofHeight[0]*rt.lx,y:rt.centerLeftRoofHeight[1]-Ft+vt})),xn}function kt(rt,vt,Nt,Ft,en){if(Nt<.1||Ft<.1||Nt>i||!x&&Ft>l)return qe.current=rt,!1;const sn=.1;Nt+=sn,Ft+=sn;for(const dn of ge){if(dn.id===rt||dn.type===z.Polygon)continue;const En=ft(dn),xn=[];for(let Tn=-1;Tn<=1;Tn+=2)for(let _n=-1;_n<=1;_n+=2){const Vn=vt.x+Tn*Nt/2,Gn=vt.z+Tn*_n*Ft/2;if(xn.push({x:Vn,y:Gn}),ye.isPointInside(Vn,Gn,En))return qe.current=rt,!1}if(en){const[Tn,_n]=en,Vn=vt.x+Tn*Nt,Gn=vt.z+Ft/2+_n;if(xn.push({x:Vn,y:Gn}),ye.isPointInside(Vn,Gn,En))return qe.current=rt,!1}for(const Tn of En)if(ye.isPointInside(Tn.x,Tn.y,xn))return qe.current=rt,!1}return qe.current=null,!0}function Zt(rt,vt,Nt,Ft,en){return ye.isElementInsideWall(vt,Nt,Ft,st,en)?!0:(qe.current=rt,!1)}function Ot(rt,vt,Nt,Ft){const[en,sn]=Ft,dn=rt.x+vt*en,En=rt.z+Nt/2+sn;return ye.isPointInside(dn,En,wt(t,0))}function on(rt){Yt.x=rt.offsetX/se.domElement.clientWidth*2-1,Yt.y=-(rt.offsetY/se.domElement.clientHeight)*2+1,zt.setFromCamera(Yt,Ae)}function qt(rt){return!(rt.button===2||H.getState().addedWallId||Ue.current||H.getState().moveHandleType||H.getState().resizeHandleType||H.getState().objectTypeToAdd!==z.None||G||ae())}function rn(rt,vt,Nt,Ft,en){const sn=vt/2,dn=Nt/2;rt.moveTo(-sn,-dn),rt.lineTo(sn,-dn),rt.lineTo(sn-en,dn),rt.lineTo(-sn+Ft,dn),rt.closePath()}function Pn(rt,vt,Nt,Ft=0,en=0){const sn=vt/2,dn=Nt/2;rt.moveTo(Ft-sn,en-dn),rt.lineTo(Ft+sn,en-dn),rt.lineTo(Ft+sn,en+dn),rt.lineTo(Ft-sn,en+dn),rt.closePath()}function fo(rt,vt,Nt,Ft,en,sn=0){const dn=vt/2,En=Nt/2,xn=Math.min(sn,Nt,dn);if(rt.moveTo(Ft-dn,en-En),rt.lineTo(Ft+dn,en-En),rt.lineTo(Ft+dn,en+En-xn),xn>0){const Tn=xn/2+vt**2/(8*xn),[_n,Vn]=[Ft,en+En-Tn],Gn=Math.acos(Math.min(1,dn/Tn)),go=Math.PI-Gn;rt.absarc(_n,Vn,Tn,Gn,go,!1)}else rt.lineTo(Ft-dn,en+En);rt.closePath()}function to(rt,vt,Nt,Ft,en,sn,dn){const[En,xn]=[vt/2,Nt/2];rt.moveTo(Ft-En,en-xn),rt.lineTo(Ft+En,en-xn),rt.lineTo(Ft+En,en+xn),rt.lineTo(Ft+sn,en+xn+dn),rt.lineTo(Ft-En,en+xn),rt.closePath()}function Dt(rt){const vt=parseFloat((Math.round(rt.x/yA)*yA).toFixed(1)),Nt=parseFloat((Math.round(rt.z/yA)*yA).toFixed(1));return new ue(vt,rt.y,Nt)}function fn(rt){const vt=parseFloat((Math.round(rt.x/r3)*r3).toFixed(1)),Nt=parseFloat((Math.round(rt.z/r3)*r3).toFixed(1));return new ue(vt,rt.y,Nt)}function kn(rt){return H.getState().enableFineGrid?rt=fn(rt):rt=Dt(rt),rt}function yo(rt,vt,Nt,Ft,en){H.getState().set(sn=>{for(const dn of sn.elements)if(dn.id===rt){if([dn.cx,dn.cy,dn.cz]=vt,[dn.lx,dn.ly,dn.lz]=Nt,Ft!==void 0&&(dn.type===z.Window||dn.type===z.Door)&&(dn.archHeight=Ft),en!==void 0&&dn.type===z.Window){const En=dn;En.windowType===Ti.Polygonal&&(En.polygonTop=[...en])}break}})}function ur(rt){return rt.type===z.Window&&rt.windowType===Ti.Polygonal&&rt.polygonTop}function lr(rt){const vt={name:"Add",timestamp:Date.now(),addedElement:rt,undo:()=>{H.getState().removeElementById(rt.id,!1)},redo:()=>{H.getState().set(Nt=>{Nt.elements.push(vt.addedElement),Nt.selectedElement=vt.addedElement,Nt.deletedRoofId=null})}};q(vt)}function xo(){const rt=H.getState().selectedElement;if(!rt)return;const vt=H.getState().getElementById(rt.id);if(vt)switch(vt.type){case z.Door:case z.Window:case z.SolarPanel:{const Nt={name:`Resize ${vt.type}`,timestamp:Date.now(),resizedElementId:vt.id,resizedElementType:vt.type,oldPosition:[rt.cx,rt.cy,rt.cz],oldDimension:[rt.lx,rt.ly,rt.lz],newPosition:[vt.cx,vt.cy,vt.cz],newDimension:[vt.lx,vt.ly,vt.lz],oldArchHeight:rt.type===z.Window||rt.type===z.Door?rt.archHeight:void 0,newArchHeight:vt.type===z.Window||vt.type===z.Door?vt.archHeight:void 0,oldPolygonTop:ur(rt)?[...rt.polygonTop]:void 0,newPolygonTop:ur(vt)?[...vt.polygonTop]:void 0,undo(){yo(this.resizedElementId,this.oldPosition,this.oldDimension,this.oldArchHeight,this.oldPolygonTop)},redo(){yo(this.resizedElementId,this.newPosition,this.newDimension,this.newArchHeight,this.newPolygonTop)}};q(Nt);break}case z.Polygon:{const Nt=rt,Ft=vt,en={name:"Edit Polygon",timestamp:Date.now(),oldValue:[...Nt.vertices],newValue:[...Ft.vertices],changedElementId:Ft.id,changedElementType:Ft.type,undo(){ne(this.changedElementId,this.oldValue)},redo(){ne(this.changedElementId,this.newValue)}};q(en);break}}}function wo(){H.getState().set(rt=>{rt.addedWindowId=null,rt.addedDoorId=null})}function Rr(rt){return rt===z.Window||rt===z.Door}function Eo(rt,vt){const Nt=O0.getIntersectionObjects(rt);return Nt.length>0&&Nt[0].object.name===`${O0.WALL_OUTSIDE_SURFACE_MESH_NAME} ${vt}`}function An(rt){return rt.intersections.length>0&&rt.intersections[0].object===rt.eventObject}function Dn(rt,vt,Nt){if(H.getState().moveHandleType&&vt&&sr(vt)&&vt.parentId!==rt){const Ft=Nt.intersections.filter(sn=>sn.eventObject.name.includes(O0.WALL_OUTSIDE_SURFACE_MESH_NAME)||sn.eventObject.name.includes(Upe)||sn.eventObject.name===$se);if(!(Ft.length>0&&(Ft[0].eventObject.name===$se||Ft[0].eventObject.name.includes(Upe))))return!0}return!1}function sr(rt){if(!rt)return!1;switch(rt.type){case z.Window:case z.Door:case z.SolarPanel:case z.Light:case z.Sensor:return!0}return!1}function Vo(rt){if(H.getState().resizeHandleType!==xt.Arch)return!1;if(rt.type===z.Window){const vt=rt;return vt.windowType===Ti.Arched&&vt.archHeight!==void 0}if(rt.type===z.Door){const vt=rt;return vt.doorType===Wd.Arched&&vt.archHeight!==void 0}}function Wo(rt,vt){const Nt=rt.getPoints().map(Ft=>({x:Ft.x,y:Ft.y}));return!ye.isPointInside(vt.x,vt.y,Nt)}function To(rt,vt,Nt,Ft,en,sn=!1){const dn=new ue().subVectors(vt,rt).normalize(),[En,xn]=sn?[vt.y,rt.y]:[rt.y,vt.y];let Tn;if(En(Tn.type===z.Wall&&Tn.parentId===y&&xn.set(Tn.id,Tn),xn),new Map);let Ft=!1,en=0;const sn={lng:H.getState().language},dn=t;let En=dn;for(;En&&En.rightJoints.length>0;){en++;const xn=Nt.get(En.rightJoints[0]);if(!xn)break;if(vt&&xn.lz!==dn.lz)return co(B.t("message.WallsAreNotAtSameHeight",sn)),!1;if(xn.id===dn.id){Ft=!0;break}if(En=xn,en>100)break}return Ft?!0:(co(B.t("message.WallsAreNotConnected",sn)),!1)}function vo(){return Fe.current&&Fe.current.status===0&&H.getState().moveHandleType===Ho.Mid}function bo(){return!(H.getState().moveHandleType||H.getState().resizeHandleType||ae())}function Bo(){return et||N!==U||W!==F?!1:x?Y!==O?!1:!(A!==void 0||S!==void 0||v!==void 0):!0}function Pr(rt,vt,Nt){var En;on(rt);const en=((En=(vt?zt.intersectObjects([vt]):rt.intersections)[0])==null?void 0:En.point)??rt.point,sn=Xe(en,t),dn=Nt?kn(sn.clone().add(Nt)).sub(Nt):kn(sn);return{relativePointer:sn,pointerOnGrid:dn}}function so(rt,vt){if(!Ce.current)return null;const{pointerOnGrid:Nt}=Pr(rt,Ce.current),Ft=Nt.x/t.lx,en=Nt.z/t.lz;return vt===z.Window?Qa.makeWindow(t,Ft,0,en,z.Wall):vt===z.Door?Qa.makeDoor(t):null}function zo(rt){rt&&(Fe.current={id:rt.id,type:rt.type,status:0}),Q(vt=>{rt&&(vt.elements.push(rt),vt.selectedElement=rt,vt.selectedElementIdSet.clear(),vt.selectedElementIdSet.add(rt.id),rt.type===z.Window?vt.addedWindowId=rt.id:rt.type===z.Door&&(vt.addedDoorId=rt.id)),vt.moveHandleType=Ho.Mid,vt.objectTypeToAdd=z.None})}function Ci(rt){if(!rt)return;const{id:vt,type:Nt}=rt;Q(Ft=>{Ft.elements=Ft.elements.filter(en=>en.id!==vt),Ft.selectedElement=null,Ft.moveHandleType=null,Ft.objectTypeToAdd=Nt,Ft.addedWindowId=null,Ft.addedDoorId=null}),Fe.current=null}function ea(rt){if(!rt)return[0,0];switch(rt.type){case z.Window:{const vt=dt.getState().oldParentId;if(rt.parentId!==vt){const Nt=H.getState().elements.find(Ft=>Ft.id===vt);return Nt?[rt.lx*Nt.lx/2,rt.lz*Nt.lz/2]:[0,0]}else return[rt.lx*i/2,rt.lz*l/2]}case z.Door:return[rt.lx*i/2,rt.lz*l/2];case z.SolarPanel:return[rt.lx/2,rt.ly/2]}return[fC,fC]}function rs(){const rt=[];if(A){const vt=A[0];if(vt===.5&&Y!==void 0)return rt.push(new ue(He,A[1]-Ye),new ue(-He,Y-Ye)),rt;if(vt===-.5&&O!==void 0)return rt.push(new ue(He,O-Ye),new ue(-He,A[1]-Ye)),rt}return O!==void 0?rt.push(new ue(He,O-Ye)):rt.push(new ue(He,Ye)),v!==void 0&&rt.push(new ue(v[0]*i,v[1]-Ye)),A!==void 0&&rt.push(new ue(A[0]*i,A[1]-Ye)),S!==void 0&&rt.push(new ue(S[0]*i,S[1]-Ye)),Y!==void 0?rt.push(new ue(-He,Y-Ye)):rt.push(new ue(-He,Ye)),rt}function Da(rt,vt){const Nt=vt==null?void 0:vt.ignorePadding,Ft=vt!=null&&vt.elementHalfSize?[...vt.elementHalfSize]:[0,0],en=Nt?0:fC,sn=Nt?0:fC+Oe,dn=Nt?0:fC+ut,[En,xn]=Ft,[Tn,_n,Vn,Gn]=[-He+En+sn,He-En-dn,-Ye+xn+en,Ye-xn-en],go=rt.clone();if(Bo()){const qo=mt?N:0,Xr=l-(mt?Ve:l);return go.setX(ye.clamp(rt.x,Tn,_n)),go.setZ(ye.clamp(rt.z,Vn+qo,Gn-Xr)),go}else{const qo=cr(En,xn,Tn,_n,en),Xr=new _t(rt.x,rt.z);let qr=1/0,na=-1/0;if(vt!=null&&vt.resizeAnchor){const cc=vt.resizeAnchor.x,wu=[];if(et)wu.push(new ue(-He,-Ye+Ve),new ue(He,-Ye+je));else{const Wc=rs().reverse();wu.push(...Wc)}for(let Wc=1;Wc=ju.x&&cc<=Qp.x){const K1=(Qp.y-ju.y)/(Qp.x-ju.x),a0=-K1*ju.x+ju.y;qr=K1*cc+a0;break}}const ps=new ue(-He,-Ye+tt),ud=new ue(He,-Ye+gt),Mm=(ud.y-ps.y)/(ud.x-ps.x),Xh=-Mm*ps.x+ps.y;na=Mm*cc+Xh}const k0=Xr.y>qr;if(Wo(qo,Xr)){const cc=Go(qo,Xr);go.setX(cc.x),go.setZ(ye.clamp(cc.y,na+en,qr-en))}else k0&&go.setZ(qr-en)}return go.setZ(Math.max(Vn,go.z)),go}function or(rt,vt){Q(Nt=>{const Ft=Nt.elements.find(en=>en.id===rt);if(Ft)switch(Ft.type){case z.Window:{Ft.cx=vt.x/i,Ft.cz=vt.z/l,Ft.cy=Ft.id===qe.current?-.01:.3,Ft.tint=Ft.id===qe.current?"red":Nt.selectedElement.tint;break}case z.Door:{const en=l/2;Ft.cx=vt.x/i,Ft.cz=(vt.z-en)/2/l,Ft.lz=(vt.z+en)/l;break}case z.SolarPanel:{Ft.cx=vt.x/i,Ft.cz=vt.z/l,Ft.color=Ft.id===qe.current?"red":"#fff";break}case z.Sensor:case z.Light:{Ft.cx=vt.x/i,Ft.cz=vt.z/l;break}case z.Polygon:{const en=Ft;if(en.vertices.length>0){const sn=ye.calculatePolygonCentroid(en.vertices),dn=-vt.x/i-sn.x,En=-vt.z/l-sn.y;Ft.vertices=en.vertices.map(xn=>({x:xn.x+dn,y:xn.y+En}))}break}}})}function cr(rt,vt,Nt,Ft,en){const sn=[],dn=new ue(-He,-Ye+tt),En=new ue(He,-Ye+gt);if(To(dn,En,rt,vt,en,!0),sn.push({start:new ue(Nt,Ye),end:new ue(Nt,dn.y)}),sn.push({start:dn.clone(),end:En.clone()}),sn.push({start:new ue(Ft,En.y),end:new ue(Ft,Ye)}),et){const Tn=new ue(He,-Ye+je),_n=new ue(-He,-Ye+Ve);To(Tn,_n,rt,vt,en),sn.push({start:Tn.clone(),end:_n.clone()})}else{const Tn=rs();for(let _n=1;_n{const en=Ft.elements.find(xn=>xn.id===(Nt==null?void 0:Nt.id));if(!en||en.type===z.SolarPanel&&en.parentType===void 0)return;if(en.type===z.Window){const xn=Ft.elements.find(Tn=>Tn.id===en.parentId);if(xn){const Tn=en.lx*xn.lx,_n=en.lz*xn.lz;en.lx=Tn/i,en.lz=_n/l}}const{pointerOnGrid:sn}=Pr(rt,Ce.current),dn=ea(en),En=Da(sn,{elementHalfSize:dn,ignorePadding:en.type===z.SolarPanel});kt(en.id,En,dn[0]*2,dn[1]*2),en.cx=En.x/i,en.cz=En.z/l,en.parentId=n,en.foundationId=y,Ft.selectedElement&&(Ft.selectedElement.parentId=n,Ft.selectedElement.foundationId=y),en.type===z.Window?(en.cy=en.id===qe.current?-.01:0,en.tint=en.id===qe.current?"red":Ft.selectedElement.tint):en.type===z.SolarPanel&&(en.color=en.id===qe.current?"red":"#fff",en.parentType=z.Wall)}),he("showWallIntersectionPlaneId",n))}else vo()&&Ci(Fe.current)}function xi(rt){if(rt.button!==2){if(vo()){jn.getState().setEnableOrbitController(!1),Ie(!0);const{pointerOnGrid:vt}=Pr(rt,Ce.current),Nt=Da(vt);Q(Ft=>{var en,sn;Ft.moveHandleType=null,((en=Fe.current)==null?void 0:en.type)===z.Window?(Ft.resizeHandleType=xt.LowerRight,Ft.resizeAnchor.copy(Nt)):((sn=Fe.current)==null?void 0:sn.type)===z.Door&&(Ft.resizeHandleType=xt.UpperRight,Ft.resizeAnchor.copy(Nt).setZ(-l/2))}),Fe.current.status=1}else if(An(rt))if(H.getState().objectTypeToAdd!==z.None){const Nt=rt.point;Ea(Nt,!0)}else H.getState().groupActionMode?(Q(Nt=>{for(const Ft of Nt.elements)Ft.selected=Ft.id===y;Nt.multiSelectionsMode||Nt.selectedElementIdSet.clear(),Nt.selectedElementIdSet.has(y)?Nt.selectedElementIdSet.delete(y):Nt.selectedElementIdSet.add(y)}),rt.stopPropagation()):bo()&&H.getState().selectMe(n,rt,er.Select)}}function Uu(){Fe.current&&Fe.current.status===0&&(Q(rt=>{rt.elements.pop(),rt.addedDoorId=null,rt.addedWindowId=null,rt.moveHandleType=null,rt.actionModeLock&&Fe.current&&(rt.objectTypeToAdd=Fe.current.type)}),Fe.current=null)}function _s(){vo()&&Ci(Fe.current),qe.current=null}function sc(rt){const vt=H.getState().selectedElement??oe();if((vt==null?void 0:vt.parentId)===t.id){if(H.getState().moveHandleType){const Nt=vt.type!==z.Polygon?new ue(-vt.lx/2*i,0,vt.lz/2*l):void 0,{pointerOnGrid:Ft}=Pr(rt,Ne.current,Nt),en=ea(vt),sn=Da(Ft,{elementHalfSize:en,ignorePadding:vt.type===z.SolarPanel}),[dn,En]=[en[0]*2,en[1]*2];if(vt.type!==z.SolarPanel&&Zt(vt.id,sn,dn,En),vt.type!==z.Polygon){let xn=!0,Tn;vt.type===z.Window&&vt.windowType===Ti.Polygonal&&(Tn=vt.polygonTop??P1,xn=Ot(sn,dn,En,Tn));const _n=kt(vt.id,sn,dn,En,Tn);xn&&_n?qe.current=null:qe.current=vt.id}or(vt.id,sn)}else if(H.getState().resizeHandleType){const{relativePointer:Nt,pointerOnGrid:Ft}=Pr(rt,Ne.current),en=H.getState().resizeHandleType,sn=H.getState().resizeAnchor;switch(vt.type){case z.Window:{const dn=vt,En=Da(Ft,{resizeAnchor:sn});if(Vo(dn)){const{newLz:xn,newCz:Tn,newArchHeight:_n}=ii(dn,En,sn),Vn=new ue(dn.cx*i,0,Tn);kt(dn.id,Vn,dn.lx*i,xn),Zt(dn.id,Vn,dn.lx*i,xn),Q(Gn=>{const go=Gn.elements.find(qo=>qo.id===dn.id);go&&(go.lz=xn/l,go.cz=Tn/l,go.archHeight=_n,go.cy=go.id===qe.current?-.01:.3,go.tint=go.id===qe.current?"red":dn.tint)})}else if(en===xt.Upper){const xn=new ue(dn.cx*i,0,dn.cz*l),[Tn,_n]=[dn.lx*i,dn.lz*l],Vn=ye.clamp((Ft.x-sn.x)/Tn,-.5,.5),Gn=Math.max(0,Ft.z-sn.z),go=[Vn,Gn];(!kt(dn.id,xn,Tn,_n,go)||!Ot(xn,Tn,_n,go))&&(qe.current=dn.id),Q(qo=>{const Xr=qo.elements.find(qr=>qr.id===dn.id);Xr&&(Xr.polygonTop=[...go],Xr.cy=Xr.id===qe.current?-.01:.3,Xr.tint=Xr.id===qe.current?"red":dn.tint)})}else{const{dimensionXZ:xn,positionXZ:Tn}=No(rt,En,sn),_n=new ue(Tn.x,0,Tn.z);let Vn=!0,Gn;dn.windowType===Ti.Polygonal&&(Gn=dn.polygonTop??P1,Vn=Ot(_n,xn.x,xn.z,Gn)),(!kt(dn.id,_n,xn.x,xn.z,Gn)||!Vn||!Zt(dn.id,_n,xn.x,xn.z))&&(qe.current=dn.id),Q(go=>{const qo=go.elements.find(Xr=>Xr.id===dn.id);qo&&(qo.lx=xn.x/i,qo.lz=xn.z/l,qo.cx=Tn.x/i,qo.cz=Tn.z/l,qo.cy=qo.id===qe.current?-.01:.3,qo.tint=qo.id===qe.current?"red":dn.tint)})}break}case z.Door:{const dn=vt,En=Da(Ft,{resizeAnchor:sn});if(Vo(dn)){const{newLz:xn,newCz:Tn,newArchHeight:_n}=ii(dn,En,sn),Vn=new ue(dn.cx*i,0,Tn);kt(dn.id,Vn,dn.lx*i,xn),Zt(dn.id,Vn,dn.lx*i,xn,!0),Q(Gn=>{const go=Gn.elements.find(qo=>qo.id===dn.id);go&&(go.lz=xn/l,go.cz=Tn/l,go.archHeight=_n,go.color=go.id===qe.current?kde:vt.color)})}else{const{dimensionXZ:xn,positionXZ:Tn}=No(rt,En,sn),_n=new ue(Tn.x,0,Tn.z);kt(dn.id,_n,xn.x,xn.z),Zt(dn.id,_n,xn.x,xn.z,!0),Q(Vn=>{const Gn=Vn.elements.find(go=>go.id===dn.id);Gn&&(Gn.cx=Tn.x/i,Gn.lx=xn.x/i,Gn.cz=(En.z-l/2)/2/l,Gn.lz=(En.z+l/2)/l,Gn.color=Gn.id===qe.current?kde:vt.color)})}break}case z.SolarPanel:{const dn=vt,[En,xn]=Ii.getSolarPanelUnitLength(dn);if(en===xt.Lower||en===xt.Upper){const _n=Math.max(1,Math.round(Math.abs(Nt.z-sn.z)/xn))*xn,Vn=new ue(0,0,Nt.z-sn.z).normalize().multiplyScalar(_n),Gn=new ue().addVectors(sn,Vn.clone().divideScalar(2));if(!ye.isElementInsideWall(Gn,dn.lx-.01,_n-.01,st))return;kt(dn.id,Gn,dn.lx,Math.abs(Vn.z)),Q(go=>{const qo=go.elements.find(Xr=>Xr.id===dn.id);qo&&(qo.cz=Gn.z/l,qo.ly=Math.abs(Vn.z),qo.color=qo.id===qe.current?"red":"#fff")})}else if(en===xt.Left||en===xt.Right){const _n=Math.max(1,Math.round(Math.abs(Nt.x-sn.x)/En))*En,Vn=new ue(Nt.x-sn.x,0,0).normalize().multiplyScalar(_n),Gn=new ue().addVectors(sn,Vn.clone().divideScalar(2));if(!ye.isElementInsideWall(Gn,_n-.01,dn.ly-.01,st))return;kt(dn.id,Gn,Math.abs(Vn.x),dn.ly),Q(go=>{const qo=go.elements.find(Xr=>Xr.id===dn.id);qo&&(qo.cx=Gn.x/i,qo.lx=Math.abs(Vn.x),qo.color=qo.id===qe.current?"red":"#fff")})}break}case z.Polygon:{Q(dn=>{const En=dn.elements.find(xn=>xn.id===vt.id);(En==null?void 0:En.selectedIndex)>=0&&(En.vertices[En.selectedIndex].x=-Ft.x/i,En.vertices[En.selectedIndex].y=-Ft.z/l)});break}}}}}function ta(){if(qe.current)Fe.current&&Fe.current.status===1?(Q(rt=>{rt.elements.pop(),rt.actionModeLock&&Fe.current&&(rt.objectTypeToAdd=Fe.current.type)}),Fe.current=null):(H.getState().moveHandleType||H.getState().resizeHandleType)&&O0.undoInvalidOperation();else if(Fe.current){if(Fe.current.status===0)Q(rt=>{rt.elements.pop(),rt.actionModeLock&&Fe.current&&(rt.objectTypeToAdd=Fe.current.type)}),Fe.current=null;else if(Fe.current.status===1){const rt=H.getState().elements,vt=rt[rt.length-1];vt.lx*i<.1||vt.lz*l<.1?Q(Nt=>{Nt.elements.pop(),Nt.actionModeLock&&Fe.current&&(Nt.objectTypeToAdd=Fe.current.type)}):(Q(Nt=>{Nt.actionModeLock&&Fe.current&&(Nt.objectTypeToAdd=Fe.current.type,xb.selectNone(Nt))}),lr(vt)),Fe.current=null}}else H.getState().moveHandleType?O0.addUndoableMove():H.getState().resizeHandleType&&xo();jn.getState().setEnableOrbitController(!0),Ie(!1),Q(rt=>{rt.moveHandleType=null,rt.resizeHandleType=null,rt.selectedElement=rt.elements.find(vt=>{var Nt;return vt.id===((Nt=rt.selectedElement)==null?void 0:Nt.id)})}),he("showWallIntersectionPlaneId",null),qe.current=null,wo()}function Ea(rt,vt){if(Me&&H.getState().objectTypeToAdd){let Nt=null;switch(H.getState().objectTypeToAdd){case z.PyramidRoof:{!x&&ho(!1,!0)&&(Nt=Qa.makePyramidRoof([t.id],Me));break}case z.GableRoof:{!x&&ho(!1,!1)&&(Nt=Qa.makeGableRoof([t.id],Me));break}case z.HipRoof:{!x&&ho(!1,!0)&&(Nt=Qa.makeHipRoof([t.id],Me,i/2));break}case z.GambrelRoof:{!x&&ho(!1,!1)&&(Nt=Qa.makeGambrelRoof([t.id],Me));break}case z.MansardRoof:{!x&&ho(!1,!0)&&(Nt=Qa.makeMansardRoof([t.id],Me));break}case z.SolarPanel:{if(rt&&vt){const Ft=Xe(rt,t),en=H.getState().actionState;let sn=H.getState().getPvModule(H.getState().actionState.solarPanelModelName??g3);sn||(sn=H.getState().getPvModule(g3)),Nt=Qa.makeSolarPanel(t,sn,Ft.x/i,0,Ft.z/l,en.solarPanelOrientation??br.landscape,en.solarPanelPoleHeight??1,en.solarPanelPoleSpacing??3,0,0,new ue(0,-1,0),[$t,0,0],en.solarPanelFrameColor)}break}case z.Sensor:{if(rt&&vt){const Ft=Xe(rt,t),en=t.relativeAngle-$t;Nt=Qa.makeSensor(t,(Ft.x-.05)/i,0,(Ft.z-.05)/l,new ue(Math.cos(en),Math.sin(en),0),[0,0,0])}break}case z.Light:{if(rt&&vt){const Ft=Xe(rt,t),en=t.relativeAngle-$t,sn=H.getState().actionState;Nt=Qa.makeLight(t,2,sn.lightDistance,sn.lightIntensity,sn.lightColor,(Ft.x-.05)/i,0,(Ft.z-.05)/l,new ue(Math.cos(en),Math.sin(en),0),[0,0,0])}break}}Nt&&(lr(Nt),Q(Ft=>{Nt&&(Ft.elements.push(Nt),Ft.selectedElementIdSet.clear(),Ft.selectedElementIdSet.add(Nt.id),Ft.selectedElement=Nt,Nt&&Nt.type===z.Roof&&Ft.addedRoofIdSet.add(Nt.id),Ft.actionModeLock||(Ft.objectTypeToAdd=z.None))}))}}function Cs(rt,vt,Nt){_e.current||(ee(n,rt,er.ContextMenu),Q(Ft=>{rt.intersections.length>0&&rt.intersections[0].object===vt&&(Ft.contextMenuObjectType=z.Wall,Nt&&Ft.pastePoint.copy(rt.intersections[0].point))}),rt.stopPropagation())}function El(rt){if(rt.button===2)return;const vt=H.getState().objectTypeToAdd;!vo()&&!ae()&&An(rt)&&vt===z.None?H.getState().groupActionMode?(Q(Nt=>{for(const Ft of Nt.elements)Ft.selected=Ft.id===y}),rt.stopPropagation()):bo()&&H.getState().selectMe(n,rt,er.Select):Rn.isTypeRoof(vt)&&xi(rt)}function Vs(rt){rt.button===2||rt.intersections.length===0||rt.intersections[0].object!==rt.eventObject||(H.getState().groupActionMode?Q(vt=>{for(const Nt of vt.elements)Nt.selected=Nt.id===y;vt.selectedElementIdSet.clear(),vt.selectedElementIdSet.add(y)}):(qt(rt)&&(Q(vt=>{vt.contextMenuObjectType=null}),ee(n,rt,er.Select)),Ea(),rt.stopPropagation()))}function Rs(rt){rt.intersections.length>0&&rt.intersections[0].object===rt.eventObject&&(ee(n,rt,er.ContextMenu),Q(vt=>{vt.contextMenuObjectType=z.Wall}),rt.stopPropagation())}function qp(){const[rt,vt]=A??[0,(Ve+je)/2],Nt=rt*i,Ft=Nt+He,en=Math.hypot(Ft,vt-Ve),sn=-Math.atan2(vt-Ve,Ft),dn=He-Nt,En=Math.hypot(dn,je-vt),xn=-Math.atan2(je-vt,dn);return h.jsxs("group",{name:`wall stud group ${n}`,children:[It.map(([Tn,_n],Vn)=>{let Gn;return Tn{let go;return _n0||b===Tc.Default)&&h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{name:"Wall Simulation Mesh",uuid:n,userData:{simulation:!0},rotation:[$t,0,0],castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[yt]}),h.jsx("meshBasicMaterial",{side:zr})]}),h.jsxs("mesh",{name:`${O0.WALL_OUTSIDE_SURFACE_MESH_NAME} ${n}`,ref:Ce,rotation:[$t,0,0],castShadow:bt,receiveShadow:te,onContextMenu:rt=>{Cs(rt,Ce.current,!0)},onPointerMove:Ga,onPointerDown:xi,onPointerUp:Uu,onPointerOut:_s,children:[h.jsx("shapeGeometry",{args:[yt]}),me&&ve?h.jsx("meshBasicMaterial",{attach:"material",map:ve,color:"white",opacity:D,transparent:ht}):h.jsx("meshStandardMaterial",{attach:"material",color:d===Jo.Default||d===Jo.NoTexture?f:"white",map:_,transparent:ht,opacity:D})]}),h.jsxs("mesh",{rotation:[$t,0,0],position:[0,.05,0],castShadow:bt,children:[h.jsx("shapeGeometry",{args:[at]}),h.jsx("meshStandardMaterial",{color:"white",side:js,transparent:ht,opacity:D})]}),h.jsxs("mesh",{name:"Inside Wall",ref:Te,position:[0,a,0],rotation:[$t,0,0],castShadow:bt,receiveShadow:te,onPointerDown:El,onContextMenu:rt=>{Cs(rt,Te.current)},children:[h.jsx("shapeGeometry",{args:[at]}),h.jsx(yhn,{transparent:ht,color:f,opacity:D})]}),h.jsxs("mesh",{rotation:[$t,0,0],position:[0,a-.01,0],receiveShadow:!0,children:[h.jsx("shapeGeometry",{args:[at]}),h.jsx("meshStandardMaterial",{color:"white",side:$i,transparent:ht,opacity:D})]}),(!x||et)&&!St&&h.jsx("mesh",{name:"Top Wall",ref:Re,material:Rt,position:[0,Le,Et],rotation:[0,-Lt,0],castShadow:bt,receiveShadow:te,onPointerDown:El,onContextMenu:rt=>{Cs(rt,Re.current)},children:h.jsx("shapeGeometry",{args:[Je]})}),Oe===0&&h.jsx(yi,{args:[Ve-tt,a],material:Rt,position:[-He+.01,Le,-Ye+tt+(Ve-tt)/2],rotation:[0,$t,0],castShadow:bt,receiveShadow:te,onPointerDown:El}),ut===0&&h.jsx(yi,{args:[je-gt,a],material:Rt,position:[He-.01,Le,-Ye+gt+(je-gt)/2],rotation:[0,$t,0],castShadow:bt,receiveShadow:te,onPointerDown:El}),(pe||Pe===n)&&((Wn=H.getState().selectedElement)==null?void 0:Wn.parentId)===n&&h.jsxs(h.Fragment,{children:[h.jsx(yi,{ref:Ne,name:mhn,args:[1e4,1e4],position:[0,a/3,0],rotation:[$t,0,0],onPointerMove:sc,onPointerUp:ta,visible:!1,children:h.jsx("meshBasicMaterial",{color:"blue",side:zr})}),h.jsx(yi,{name:$se,args:[i,l],rotation:[$t,0,0],position:[0,a,0],onPointerMove:()=>{},visible:!1})]}),ge.map(rt=>{switch(rt.type){case z.Window:return h.jsx(nrt,{...rt,cx:rt.cx*i,cy:rt.cy*a,cz:rt.cz*l,lx:rt.lx*i,ly:a,lz:rt.lz*l},rt.id);case z.Door:return k!==Ul.Full?null:h.jsx(shn,{...rt,cx:rt.cx*i,cy:0,cz:rt.cz*l,lx:rt.lx*i,ly:a,lz:rt.lz*l},rt.id);default:return null}})]}),ge.map(rt=>rt.type===z.Polygon&&k!==Ul.Empty?h.jsx(xrt,{...rt},rt.id):null),b===Tc.Stud&&qp(),b===Tc.Pillar&&gn(),St&&h.jsx(hhn,{args:E,wallData:ot,parapetZ:Pt,currWallPointData:it,leftWallPointData:Be,rightWallPointData:pt}),(b===Tc.Default||w&&G)&&h.jsx(Qfn,{lineColor:G&&w?i0:p,lineWidth:G&&w?2:m,hx:He,hz:Ye,fill:k,isTopPartial:et,leftUnfilledHeight:N,rightUnfilledHeight:U,showParapet:St,leftHeight:Ve,rightHeight:je,center:A,centerLeft:S,centerRight:v}),G&&h.jsx(B3e,{element:t,verticalLift:0}),(pe||Pe===n)&&((Un=H.getState().selectedElement)==null?void 0:Un.parentId)===n&&h.jsx("group",{position:[0,-.001,0],rotation:[$t,0,0],children:h.jsx(C5e,{hx:He,hy:Ye,hz:0})}),h.jsx(ghn,{wallModel:t,notBuilding:Me.notBuilding})]})},whn=(t,e)=>t.wallModel===e.wallModel,xhn=xe.memo(Ahn,whn);class Rn{static getWireframeStyle(e,n,o,r){return[o&&r?i0:e,o&&r?1:n]}static getComposedWallNormal(e){return new ue().subVectors(e.leftPoint,e.rightPoint).applyEuler(kX).normalize()}static getWallNormal(e){return new ue().subVectors(new ue(e.leftPoint[0],e.leftPoint[1]),new ue(e.rightPoint[0],e.rightPoint[1])).applyEuler(kX).normalize()}static isTypeRoof(e){return e===z.Roof||e===z.PyramidRoof||e===z.HipRoof||e===z.GableRoof||e===z.GambrelRoof||e===z.MansardRoof}static getIntersectionPoint(e,n,o,r){if(Math.abs(e.x-n.x)<.001&&Math.abs(o.x-r.x)<.001)return n.clone();const i=(n.y-e.y)/(n.x-e.x),a=(r.y-o.y)/(r.x-o.x);if(Math.abs(i-a)<.001)return n.clone();const l=[e.x,n.x,o.x,r.x],s=[e.y,n.y,o.y,r.y],c=((l[2]-l[3])*(l[1]*s[0]-l[0]*s[1])-(l[0]-l[1])*(l[3]*s[2]-l[2]*s[3]))/((l[2]-l[3])*(s[0]-s[1])-(l[0]-l[1])*(s[2]-s[3])),u=((s[2]-s[3])*(s[1]*l[0]-s[0]*l[1])-(s[0]-s[1])*(s[3]*l[2]-s[2]*l[3]))/((s[2]-s[3])*(l[0]-l[1])-(s[0]-s[1])*(l[2]-l[3]));return!Number.isFinite(c)||!Number.isFinite(u)?n.clone():new ue(c,u)}static getDistance(e,n,o){const r=n.y-e.y;if(r===0)return Math.abs(e.y-o.y);const i=e.x-n.x;if(i===0)return Math.abs(e.x-o.x);const a=n.x*e.y-e.x*n.y,l=Math.abs((r*o.x+i*o.y+a)/Math.sqrt(r*r+i*i));return l===0?1/0:l}static getWallPoints2D(e,n,o,r){const{lx:i,lz:a,rightRoofHeight:l,leftRoofHeight:s}=e,c=o??e.centerLeftRoofHeight,u=n??e.centerRoofHeight,d=r??e.centerRightRoofHeight,f=[],p=i/2,m=a/2;return f.push({x:-p,y:-m}),f.push({x:p,y:-m}),l?f.push({x:p,y:l-m}):f.push({x:p,y:m}),d&&f.push({x:d[0]*i,y:d[1]-m}),u&&f.push({x:u[0]*i,y:u[1]-m}),c&&f.push({x:c[0]*i,y:c[1]-m}),s?f.push({x:-p,y:s-m}):f.push({x:-p,y:m}),f}static isPointInside(e,n,o){let r=!1;for(let i=0,a=e.length-1;io!=u>o&&n<(c-l)*(o-s)/(u-s)+l&&(r=!r)}return r}static isRoofValid(e,n,o,r,i,a){for(const l of H.getState().elements)if(l.type===z.Wall&&l.roofId===e){const s=l;let c=[];if(s.id===n)c=Rn.getWallPoints2D(s,r,i,a);else if(s.id===o){let u,d,f;r&&(u=[-r[0],r[1]]),a&&(d=[-a[0],a[1]]),i&&(f=[-i[0],i[1]]),c=Rn.getWallPoints2D(s,u,d,f)}if(s.id===n||s.id===o){for(const u of H.getState().elements)if(u.parentId===s.id){let d=u.lx/2,f=u.lz/2,p=fC;u.type===z.SolarPanel&&(d=(d-.01)/s.lx,f=(u.ly/2-.01)/s.lz,p=0);const m=u.cx*s.lx-d*s.lx,y=u.cx*s.lx+d*s.lx,w=u.cz*s.lz+f*s.lz+p;if(!Rn.isPointInside(c,m,w)||!Rn.isPointInside(c,y,w))return!1}}}return!0}static getSegmentIdx(e,n){for(let o=0;oi.z){const u=[l,a,r];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}else{const u=[l,a,i];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else if(s<=c){const u=[l,a,i];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else{const u=[l,a,r];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}}static getSegmentNormal(e){const[n,o,r]=e;return new ue().crossVectors(new ue().subVectors(n,o),new ue().subVectors(n,r)).normalize()}static getRotationFromNormal(e){return ye.isSame(e.normalize(),Oo)?[0,0,0]:[Math.PI/2-Math.atan2(e.z,Math.hypot(e.x,e.y)),0,Math.atan2(e.y,e.x)+Math.PI/2]}static getRooftopElementZ(e,n,o){const[r,i,a]=e,l=(i.y-r.y)*(a.z-r.z)-(i.z-r.z)*(a.y-r.y),s=(i.z-r.z)*(a.x-r.x)-(i.x-r.x)*(a.z-r.z),c=(i.x-r.x)*(a.y-r.y)-(i.y-r.y)*(a.x-r.x);return-(-(l*r.x+s*r.y+c*r.z)+l*n.x+s*n.y)/c+o}static computeState(e,n,o){const r=Rn.getSegmentIdx(e,n);if(o)return{segmentIdx:-1,segmentVertices:null,normal:new ue(0,0,1),rotation:[0,0,0]};if(r!==-1){const i=Rn.getSegmentVertices(e,r,n),a=Rn.getSegmentNormal(i),l=Rn.getRotationFromNormal(a);return{segmentIdx:r,segmentVertices:i,normal:a,rotation:l}}else return{segmentIdx:-1,segmentVertices:null,normal:new ue(0,0,1),rotation:[0,0,0]}}static getOrderedWallArrayOfRoof(e){const n=new Map;for(const a of H.getState().elements)a.type===z.Wall&&a.roofId===e&&n.set(a.id,a);if(n.size===0)return{orderedWallArray:[],isLoop:!1};const o=n.entries().next().value[1],r=[o];let i=o.rightJoints[0];for(;i&&i!==o.id;){const a=n.get(i);if(a)r.push(a),i=a.rightJoints[0];else break}if(i===o.id)return{orderedWallArray:r,isLoop:!0};for(i=o.leftJoints[0];i;){const a=n.get(i);if(a)r.unshift(a),i=a.leftJoints[0];else break}return{orderedWallArray:r,isLoop:!1}}static getRoofBoundaryVertices(e){const n=In.getState().roofSegmentVerticesMap.get(e.id);if(!n)throw new Error;if(e.roofType!==Zo.Gable&&e.rise<.01)return n[0].map(o=>({x:o.x,y:o.y}));switch(e.roofType){case Zo.Gable:return n.length===1?n[0].map(o=>({x:o.x,y:o.y})):n.reduce((o,r)=>(o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Zo.Gambrel:return n.reduce((o,r,i)=>((i===0||i===3)&&o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Zo.Mansard:return n.reduce((o,r,i)=>(i!==n.length-1&&o.push({x:r[0].x,y:r[0].y}),o),[]);default:return n.reduce((o,r,i)=>(o.push({x:r[0].x,y:r[0].y}),o),[])}}static getAbsoluteWindowVerticesOnRoof(e,n){const o=[],r=new ue(e.cx,e.cy,e.cz),i=new ue(n.cx,n.cy,n.lz);if(e.windowType===Ti.Arched){const a=Math.min(e.archHeight,e.lx/2,e.lz);for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=s*c>0?new ue(e.lx/2*s,(e.lz/2-a)*c*s,0):new ue(e.lx/2*s,e.lz/2*c*s,0);u.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),u.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(u)}const l=new ue(0,e.lz/2,0);l.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),l.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(l)}else{for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new ue(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}if(e.windowType===Ti.Polygonal&&e.polygonTop){const a=new ue(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);a.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),a.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(a)}}return o}static getRelativeWindowVerticesOnRoof(e){const n=[],o=new ue(e.cx,e.cy,e.cz);if(e.windowType===Ti.Arched){const r=Math.min(e.archHeight,e.lx/2,e.lz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=a*l>0?new ue(e.lx/2*a,(e.lz/2-r)*l*a,0):new ue(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(s)}const i=new ue(0,e.lz/2,0);i.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(i)}else{for(let r=-1;r<=1;r+=2)for(let i=-1;i<=1;i+=2){const a=new ue(e.lx/2*r,e.lz/2*i*r,0);a.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(a)}if(e.windowType===Ti.Polygonal&&e.polygonTop){const r=new ue(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);r.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(r)}}return n}static getAbsoluteSolarPanelVerticesOnRoof(e,n){const o=[],r=new ue(e.cx,e.cy,e.cz),i=new ue(n.cx,n.cy,n.cz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new ue(e.lx/2*a,e.ly/2*l*a,0);e.rotation[0]===0?s.applyEuler(new cn(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):s.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}return o}static getElementVerticesOnRoof(e,n){return e.type===z.SolarPanel?Rn.getSolarPanelVerticesOnRoof(e,n):e.type===z.SolarWaterHeater?Rn.getSolarWaterHeaterVerticesOnRoof(e,n):[]}static getSolarPanelVerticesOnRoof(e,n){const o=[],r=new ue(e.cx,e.cy,e.cz+n.cz);for(let i=-1;i<=1;i+=2)for(let a=-1;a<=1;a+=2){const l=new ue(e.lx/2*i,e.ly/2*a*i,0);e.rotation[0]===0?l.applyEuler(new cn(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):l.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),o.push(l)}return o}static getSolarWaterHeaterVerticesOnRoof(e,n){const o=[],{lx:r,ly:i,lz:a,waterTankRadius:l,relativeAzimuth:s}=e,c=a-l*2,u=Math.asin(Math.min(1,(c+l)/i)),d=i*Math.cos(u),f=i/2+l,p=new ue(e.cx,e.cy,e.cz+n.cz),m=new cn(0,0,s,"ZXY");return o.push(new ue(-r/2,f).applyEuler(m).add(p)),o.push(new ue(-r/2,f-d).applyEuler(m).add(p)),o.push(new ue(r/2,f-d).applyEuler(m).add(p)),o.push(new ue(r/2,f).applyEuler(m).add(p)),o}static getWindowVerticesOnRoof(e,n=0){const o=[],r=new ue(e.cx,e.cy,e.cz),[i,a]=[e.lx/2+n,e.lz/2+n];for(let l=-1;l<=1;l+=2)for(let s=-1;s<=1;s+=2){const c=new ue(l*i,l*s*a);c.applyEuler(new cn().fromArray([e.rotation[0],e.rotation[1],e.rotation[2],"ZXY"])).add(r),o.push(c)}if(e.windowType===Ti.Polygonal){const[l,s]=e.polygonTop??P1,c=new ue(l*e.lx,e.lz+s).add(r);o.push(c)}return o}static rooftopElementBoundaryCheck(e,n){for(const o of e)if(!ye.isPointInside(o.x,o.y,n))return!1;return!0}static rooftopWindowCollisionCheck(e,n,o){const r=[];for(const i of H.getState().elements)if(i.parentId===o&&i.id!==e){const a=Rn.getWindowVerticesOnRoof(i);r.push(a)}for(const i of r){for(const a of n)if(ye.isPointInside(a.x,a.y,i))return!1;for(const a of i)if(ye.isPointInside(a.x,a.y,n))return!1}return!0}static rooftopElementCollisionCheck(e,n,o){for(const r of H.getState().elements)if((r.type===z.SolarPanel||r.type===z.SolarWaterHeater)&&r.parentId===e.parentId&&r.id!==e.id){const i=Rn.getElementVerticesOnRoof(r,n);for(const s of o)if(ye.isPointInside(s.x,s.y,i))return!1;for(const s of i)if(ye.isPointInside(s.x,s.y,o))return!1;const a=o.map(ye.mapVector3ToPoint2),l=i.map(ye.mapVector3ToPoint2);a.push(a[0]),l.push(l[0]);for(let s=0;s0){for(const i of r)if(!i.leftJoints||i.leftJoints.length===0||!i.rightJoints||i.rightJoints.length===0)return $c.WALL_DISJOINED}return $c.COMPLETE}static calculateBuildingArea(e){const n=jo.getWallPointsOfRoof(e);return jo.getPolygonArea(n)}static toUValueInUS(e){return e/5.67826}static toUValueInSI(e){return e*5.67826}static toRValueInUS(e){return e*5.67826}static toRValueInSI(e){return e/5.67826}static fetchWaterTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");if(r){const i=r.createRadialGradient(e/2,n/2,0,e/2,n/2,Math.max(e,n)/2);i.addColorStop(0,"#45AAEA"),i.addColorStop(.04,"#2B65EC"),i.addColorStop(.2,"#0000FF"),r.fillStyle=i,r.fillRect(0,0,e,n)}return new o3(o)}static fetchWhiteTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");return r&&(r.fillStyle="white",r.fillRect(0,0,e,n)),new o3(o)}static fetchIntersectables(e){const n=[];return e.traverse(o=>{o.userData.unintersectable||n.push(o)}),n}static fetchSimulationElements(e,n){if(e.userData.simulation&&n.push(e),e.children.length>0)for(const o of e.children)jo.fetchSimulationElements(o,n)}static getSimulationElements(e,n,o){if(e.userData.simulation&&e.uuid!==o&&n.push(e),e.children.length>0)for(const r of e.children)jo.getSimulationElements(r,n,o)}static hasMovingParts(e){for(const n of e)switch(n.type){case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:return!0;case z.SolarPanel:if(n.trackerType!==Bl.NO_TRACKER)return!0}return!1}static onBuildingEnvelope(e){return e.type===z.Foundation||e.type===z.Window||e.type===z.Door||e.type===z.Wall||e.type===z.Roof}static getWindowArea(e,n){if(n){if(e.windowType===Ti.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ti.Polygonal&&e.polygonTop){let o=e.lx*e.lz*n.lx*n.lz;return o+=e.lx*n.lx*e.polygonTop[1]/2,o}return e.lx*e.lz*n.lx*n.lz}else{if(e.windowType===Ti.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ti.Polygonal&&e.polygonTop){let o=e.lx*e.lz;return o+=e.lx*e.polygonTop[1]/2,o}return e.lx*e.lz}}static getDoorArea(e,n){if(n){if(e.doorType===Wd.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz*n.lx*n.lz}else{if(e.doorType===Wd.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz}}static hasHeliostatOrFresnelReflectors(e){for(const n of e)if(n.type===z.FresnelReflector||n.type===z.Heliostat)return!0;return!1}static lineIntersection(e,n,o,r){const i=n.x-e.x,a=n.y-e.y,l=i*(r.y-o.y)-(r.x-o.x)*a;if(l===0)return;const s=((r.y-o.y)*(r.x-e.x)+(o.x-r.x)*(r.y-e.y))/l,c=((e.y-n.y)*(r.x-e.x)+i*(r.y-e.y))/l;if(!(!(0<=s&&s<=1)||!(0<=c&&c<=1)))return{x:e.x+s*i,y:e.y+s*a}}static calculateSolarRadiationColor(e,n){const o=n/(OD.length-1);let r=Math.max(0,Math.floor(e/o));r>OD.length-2&&(r=OD.length-2);const i=Math.min(1,(e-o*r)/o);return new ir(OD[r]).lerp(OD[r+1],i)}static transpose(e){return e[0].map((n,o)=>e.map(r=>r[o]))}static clone2DArray(e){return e.map(n=>[...n])}static fetchHeatmapTexture(e,n,o){if(!e)return null;const r=document.createElement("canvas"),i=e.length,a=e[0].length;r.width=i,r.height=a;const l=r.getContext("2d");if(l){l.clearRect(0,0,i,a);const s=l.getImageData(0,0,i,a),c=s.data;for(let u=0;un!=u>n&&e<(c-l)*(n-s)/(u-s)+l&&(r=!r)}return r}static getPoints(e){const n=[];for(const o of e)n.push({x:o.x,y:o.y});return n}static polygonIntersections(e,n,o){const r=new Array;let i,a,l;for(let s=0;s0&&(n>l.x&&(n=l.x),r>l.y&&(r=l.y),ol||Math.abs(f)>s||(d=o+c*i+u*a,f=r+c*a-u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i-u*a,f=r-c*a+u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i+u*a,f=r-c*a-u*i,Math.abs(d)>l||Math.abs(f)>s))}static isWallWithin(e,n){const o=n.lx*.5,r=n.ly*.5,i=e.leftPoint[0],a=e.leftPoint[1];if(Math.abs(i)>=o||Math.abs(a)>=r)return!1;const l=e.rightPoint[0],s=e.rightPoint[1];return!(Math.abs(l)>=o||Math.abs(s)>=r)}static isSensorWithin(e,n){return Math.abs(e.cx)<.5-e.lx/n.lx&&Math.abs(e.cy)<.5-e.ly/n.ly}static isSolarCollectorWithinHorizontalSurface(e,n){const o=e.cx,r=e.cy,i=Math.cos(e.relativeAzimuth),a=Math.sin(e.relativeAzimuth),l=n.lx*.5,s=n.ly*.5,c=e.lx*.5,u=e.ly*.5*Math.cos(e.tiltAngle);let d=o+c*i-u*a,f=r+c*a+u*i;return!(Math.abs(d)>l||Math.abs(f)>s||(d=o+c*i+u*a,f=r+c*a-u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i-u*a,f=r-c*a+u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i+u*a,f=r-c*a-u*i,Math.abs(d)>l||Math.abs(f)>s))}static isWindTurbineWithinHorizontalSurface(e,n){return Math.abs(e.cx)<=.5&&Math.abs(e.cy)<=.5}static isUnitVectorX(e){return jo.isSame(e,b1)||jo.isSame(e,S1)}static isUnitVectorY(e){return jo.isSame(e,Zc)||jo.isSame(e,T1)}static isSame(e,n){return Math.abs(e.x-n.x)Ht)return!1;return!0}static isEqual(e,n){return Math.abs(e-n)-1&&e.splice(o,1)}static fixElements(e){const n=[];for(const o of e)o.type||n.push(o);if(n.length>0)for(const o of n)jo.deleteElement(e,o)}static fixViewStateLight(e){e.ambientLightIntensity&&(e.ambientLightIntensity*=2),e.directLightIntensity&&(e.directLightIntensity*=3.5)}static isResizingVertical(e){switch(e){case xt.LowerLeftTop:case xt.UpperLeftTop:case xt.LowerRightTop:case xt.UpperRightTop:return!0;default:return!1}}static isTopResizeHandle(e){return e===xt.LowerLeftTop||e===xt.LowerRightTop||e===xt.UpperLeftTop||e===xt.UpperRightTop||e===xt.Top}static isXResizeHandle(e){return e===xt.Left||e===xt.Right}static isYResizeHandle(e){return e===xt.Upper||e===xt.Lower}static isTopResizeHandleOfWall(e){return e===xt.UpperLeft||e===xt.UpperRight}static isRiseHandleOfRoof(e){return e===Ur.Top||e===Ur.Mid||e===Ur.TopMid}static isMoveHandle(e){return e===Ho.Default||e===Ho.Top||e===Ho.Upper||e===Ho.Lower||e===Ho.Left||e===Ho.Right}static snapToNormalGrid(e){const n=Math.round(e.x/yA)*yA,o=Math.round(e.y/yA)*yA;return new ue(n,o,e.z)}static snapToFineGrid(e){const n=Math.round(e.x/r3)*r3,o=Math.round(e.y/r3)*r3;return new ue(n,o,e.z)}static isPositionRelative(e){return e===z.BatteryStorage||e===z.SolarPanel||e===z.ParabolicTrough||e===z.ParabolicDish||e===z.FresnelReflector||e===z.Heliostat||e===z.WindTurbine||e===z.SolarWaterHeater||e===z.Sensor||e===z.Light||e===z.Polygon||e===z.Window||e===z.Door||e===z.Roof||e===z.Wall}static isPlantOrHuman(e){return e.type===z.Tree||e.type===z.Flower||e.type===z.Human}static isFoundationOrCuboid(e){return e.type===z.Foundation||e.type===z.Cuboid}static isSolarCollector(e){return jo.isSolarCollectorType(e.type)}static isSolarCollectorType(e){return e===z.SolarPanel||e===z.SolarWaterHeater||jo.isCspCollectorType(e)}static isCspCollector(e){return jo.isCspCollectorType(e.type)}static isCspCollectorType(e){return e===z.ParabolicDish||e===z.ParabolicTrough||e===z.FresnelReflector||e===z.Heliostat}static isParabolicCollector(e){return jo.isParabolaType(e.type)}static isParabolaType(e){return e===z.ParabolicDish||e===z.ParabolicTrough}static isParabolicTroughOrFresnelReflector(e){return e===z.FresnelReflector||e===z.ParabolicTrough}static isHeliostatOrFresnelReflector(e){return e===z.FresnelReflector||e===z.Heliostat}static isLegalOnWall(e){switch(e){case z.Window:case z.Door:case z.Sensor:case z.Light:case z.SolarPanel:case z.Polygon:return!0}return!1}static isDescendantOf(e,n){const o=e.parentId;if(!o||o===rr)return!1;const r=H.getState().getElementById(o);return r?r.id===n?!0:jo.isDescendantOf(r,n):!1}static isElementInsideWall(e,n,o,r,i){const a=n/2,l=o/2;for(let c=-1;c<=1;c+=2)for(let u=-1;u<=1;u+=2){if(i&&u===-1)continue;const d=e.x+a*c,f=e.z+l*u;if(!jo.isPointInside(d,f,r))return!1}const s=[{x:e.x-a,y:e.z-l},{x:e.x-a,y:e.z+l},{x:e.x+a,y:e.z+l},{x:e.x+a,y:e.z-l}];for(const c of r)if(jo.isPointInside(c.x,c.y,s))return!1;return!0}static isRectOutsideBoundary(e,n,o,r,i,a){return e+o>i||e-o<-i||n+r>a||n-r<-a}static getSolarPanelVerticesOnCuboidVerticalFace(e){const n=[],[o,r]=[e.lx/2,e.ly/2];return jo.isIdentical(e.normal,[-1,0,0])||jo.isIdentical(e.normal,[1,0,0])?(n.push({x:e.cy-o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz+r}),n.push({x:e.cy-o,y:e.cz+r})):(jo.isIdentical(e.normal,[0,1,0])||jo.isIdentical(e.normal,[0,-1,0]))&&(n.push({x:e.cx-o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz+r}),n.push({x:e.cx-o,y:e.cz+r})),n}static checkCollisionOnCuboidSameVerticalFace(e){for(const n of H.getState().elements)if(n.type===z.SolarPanel&&n.id!==e.id&&n.parentId===e.parentId&&jo.isIdentical(n.normal,e.normal)){const o=jo.getSolarPanelVerticesOnCuboidVerticalFace(n),r=jo.getSolarPanelVerticesOnCuboidVerticalFace(e);for(const i of o)if(jo.isPointInside(i.x,i.y,r))return!0;for(const i of r)if(jo.isPointInside(i.x,i.y,o))return!0}return!1}static checkElementOnCuboidState(e,n){if(jo.isIdentical(e.normal,[0,0,1])){if(!jo.isSolarCollectorWithinHorizontalSurface(e,n))return ya.OutsideBoundary;if(H.getState().overlapWithSibling(e))return ya.OverLap}else{const[o,r]=[e.lx/2,e.ly/2],[i,a,l]=[n.lx/2,n.ly/2,n.lz/2];if(jo.isIdentical(e.normal,[-1,0,0])||jo.isIdentical(e.normal,[1,0,0])){if(jo.isRectOutsideBoundary(e.cy,e.cz,o,r,a,l))return ya.OutsideBoundary}else if((jo.isIdentical(e.normal,[0,1,0])||jo.isIdentical(e.normal,[0,-1,0]))&&jo.isRectOutsideBoundary(e.cx,e.cz,o,r,i,l))return ya.OutsideBoundary;if(jo.checkCollisionOnCuboidSameVerticalFace(e))return ya.OverLap}return ya.Valid}static checkElementOnWallState(e,n){let r=e.lx/2+1e-5,i=e.lz/2+1e-5;n&&e.type===z.SolarPanel&&(r=r/n.lx+1e-5,i=e.ly/2/n.lz+1e-5);const a=e.cx-r,l=e.cx+r,s=e.cz-i,c=e.cz+i;if(n&&n.type===z.Wall&&!jo.isElementInsideWall(new ue(e.cx*n.lx,e.cy,e.cz*n.lz),n.lx*r*2,n.lz*i*2,jo.getWallInnerSideShapePoints(n),e.type===z.Door))return ya.OutsideBoundary;for(const u of H.getState().elements)if(jo.isLegalOnWall(u.type)&&u.type!==z.Polygon&&u.parentId===e.parentId&&u.id!==e.id){let d=u.lx/2,f=u.lz/2;n&&u.type===z.SolarPanel&&(d=d/n.lx,f=u.ly/2/n.lz);const p=u.cx-d,m=u.cx+d,y=u.cz-f,w=u.cz+f;if((a>=p&&a<=m||l>=p&&l<=m||p>=a&&p<=l||m>=a&&m<=l)&&(s>=y&&s<=w||c>=y&&c<=w||y>=s&&y<=c||w>=s&&w<=c))return ya.OverLap}return ya.Valid}static checkElementOnRoofState(e,n){if(e.foundationId){const o=H.getState().getElementById(e.foundationId);if(o){const r=Rn.getElementVerticesOnRoof(e,o),i=Rn.getRoofBoundaryVertices(n);return Rn.rooftopElementBoundaryCheck(r,i)?Rn.rooftopElementCollisionCheck(e,o,r)?ya.Valid:ya.OverLap:ya.OutsideBoundary}}return ya.Invalid}static relativeCoordinates(e,n,o,r,i){const a=new ue(e,n,o);if(r.type===z.Wall){const l=new ue(r.cx,r.cy),s=H.getState().getParent(r);if(s){const c=new ue(s.cx,s.cy);l.applyEuler(new cn(0,0,s.rotation[2])).add(c).setZ(s.lz+r.lz/2),a.sub(l).applyEuler(new cn(0,0,-r.relativeAngle-s.rotation[2]))}}else{const{pos:l,rot:s}=jo.getWorldDataById(r.id);a.set(e-l.x,n-l.y,o-l.z),a.applyEuler(new cn(0,0,-s))}return i||(a.x/=r.lx,a.y/=r.ly,a.z/=r.lz),a}static absoluteCoordinates(e,n,o,r,i,a,l){if(r.type===z.Wall&&i){const c=r,u=i?i.rotation[2]+c.relativeAngle:c.relativeAngle;if(u!==void 0){const d=jo.wallAbsolutePosition(new ue(c.cx,c.cy,c.cz),i).setZ(c.lz/2+i.lz),f=new ue(e*c.lx,n*c.ly,o*c.lz);if(f.applyAxisAngle(Oo,u),a){const p=a*Math.cos(u-$t),m=a*Math.sin(u-$t);return new ue(d.x+f.x+p,d.y+f.y+m,d.z+f.z)}return new ue(d.x+f.x,d.y+f.y,d.z+f.z)}}if(r.type===z.Roof&&i){const c=new ue(e,n,o+i.cz);return c.applyEuler(new cn().fromArray(i.rotation)),c.x+=i.cx,c.y+=i.cy,c}const s=new ue;return l?s.set(e,n,o):s.set(e*r.lx,n*r.ly,o*r.lz),s.applyEuler(new cn().fromArray(r.rotation)),s.x+=r.cx,s.y+=r.cy,s.z+=r.cz,s}static absoluteHumanOrTreeCoordinates(e,n,o,r){const i=new ue(e,n,o);return i.applyEuler(new cn().fromArray(r.rotation)),i.x+=r.cx,i.y+=r.cy,i.z+=r.cz,i}static relativePoint(e,n){const o=new ue(e.x-n.cx,e.y-n.cy,e.z-n.cz);return o.applyEuler(new cn().fromArray(n.rotation.map(r=>-r))),o}static wallAbsolutePosition(e,n){const o=new ue(n.cx,n.cy);return new ue().addVectors(o,new ue(e.x,e.y).applyAxisAngle(Oo,n.rotation[2]))}static wallRelativePosition(e,n){const o=new ue(n.cx,n.cy);return new ue().subVectors(new ue(e.x,e.y),o).applyAxisAngle(Oo,-n.rotation[2])}static getObjectChildById(e,n){if(e){for(const o of e.children)if(o.name===Vv){const r=jo.getStackCuboidObjectById(o,n);if(r)return r}else if(o.name.includes(n))return o}return null}static getStackCuboidObjectById(e,n){if(e)for(const o of e.children){if(o.name.includes(n))return o;if(o.name===_ot){const r=jo.getStackCuboidObjectById(o.children[0],n);if(r)return r}}return null}static toRadians(e){return e*(Math.PI/180)}static toDegrees(e){return e*(180/Math.PI)}static getArrayMax(e){return e.reduce((n,o)=>Math.max(n,o))}static getArrayMin(e){return e.reduce((n,o)=>Math.min(n,o))}static getArrayMax2D(e){return jo.getArrayMax(e.map(jo.getArrayMax))}static getArrayMin2D(e){return jo.getArrayMin(e.map(jo.getArrayMin))}static sphericalToCartesianZ(e){const n=e.x*Math.cos(e.z),o=n*Math.cos(e.y),r=n*Math.sin(e.y),i=e.x*Math.sin(e.z);return e.set(o,r,i),e}static getDistance(e,n,o,r){return e=jo.toRadians(e),n=jo.toRadians(n),o=jo.toRadians(o),r=jo.toRadians(r),Math.acos(Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos(Math.abs(e-o)))}static minutesIntoDay(e){return e.getHours()*60+e.getMinutes()}static dayOfYear(e){return(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())-Date.UTC(e.getFullYear(),0,0))/864e5}static daysInYear(e){const n=e.getFullYear();return n%4===0&&n%100>0||n%400===0?366:365}static daysOfMonth(e,n){return new Date(n,e+1,0).getDate()}static fahrenheitToCelsius(e){return(e-32)*5/9}static celsiusToFahrenheit(e){return e*(9/5)+32}static getOS(){var e;return(e=lVe.os)==null?void 0:e.family}static isMac(){const e=jo.getOS();return e?e.includes("Mac")||e.includes("OS X"):!1}static isChrome(){const e=jo.getOS();return e?e.includes("Chrome"):!1}static detectWebGLContext(){try{const e=document.createElement("canvas");return!!window.WebGLRenderingContext&&(!!e.getContext("webgl")||!!e.getContext("experimental-webgl"))}catch{return!1}}static clamp(e,n,o){return n>o?(n+o)/2:Math.min(Math.max(e,n),o)}static distanceFromPointToLine2D(e,n,o){const[r,i]=[e.x,e.y],[a,l]=[n.x,n.y],[s,c]=[o.x,o.y],u=r-a,d=i-l,f=s-a,p=c-l,m=u*f+d*p,y=f*f+p*p;let w=-1;y!==0&&(w=m/y);let x,C;w<0?(x=a,C=l):w>1?(x=s,C=c):(x=a+w*f,C=l+w*p);const P=r-x,A=i-C;return Math.sqrt(P*P+A*A)}static mapVector3ToPoint2(e){return{x:e.x,y:e.y}}static getWallVertices(e,n){const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:-r-n},a={x:o+n,y:-r-n},l={x:-o-n,y:(e.leftRoofHeight??e.lz)-r+n},s={x:o+n,y:(e.rightRoofHeight??e.lz)-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static isPartialWallFull(e){return jo.isZero((e.leftRoofHeight??e.lz)-e.leftTopPartialHeight)&&jo.isZero((e.rightRoofHeight??e.lz)-e.rightTopPartialHeight)&&jo.isZero(e.leftUnfilledHeight)&&jo.isZero(e.rightUnfilledHeight)}static getPartialWallVertices(e,n){if(jo.isPartialWallFull(e))return jo.getWallVertices(e,n);const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:e.leftUnfilledHeight-r-n},a={x:o+n,y:e.rightUnfilledHeight-r-n},l={x:-o-n,y:e.leftTopPartialHeight-r+n},s={x:o+n,y:e.rightTopPartialHeight-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static getHighestPointOfWall(e){let n=e.lz;return e.leftRoofHeight&&(n=Math.max(n,e.leftRoofHeight)),e.rightRoofHeight&&(n=Math.max(n,e.rightRoofHeight)),e.centerRightRoofHeight&&(n=Math.max(n,e.centerRightRoofHeight[1])),e.centerRoofHeight&&(n=Math.max(n,e.centerRoofHeight[1])),e.centerLeftRoofHeight&&(n=Math.max(n,e.centerLeftRoofHeight[1])),n}static getWallPointsOfRoof(e,n){let o=n??H.getState().getElementById(e.wallsId[0]);if(!o)return[];const r=o,i=[];for(;o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.leftJoints[0]);)if(o.leftJoints[0]!==r.id)o=H.getState().getElementById(o.leftJoints[0]);else return i.reverse(),i;for(i.reverse(),o=H.getState().getElementById(r==null?void 0:r.rightJoints[0]);o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.rightJoints[0]&&o.rightJoints[0]!==r.id);)o=H.getState().getElementById(o.rightJoints[0]);return i}static getWallInnerSideShapePoints(e){const{lx:n,ly:o,lz:r,relativeAngle:i,fill:a,leftUnfilledHeight:l,rightUnfilledHeight:s,leftRoofHeight:c,centerLeftRoofHeight:u,centerRoofHeight:d,centerRightRoofHeight:f,rightRoofHeight:p,leftJoints:m,rightJoints:y}=e,w=m.length>0?H.getState().getElementById(m[0]):null,x=y.length>0?H.getState().getElementById(y[0]):null,C=w&&w.type===z.Wall?jo.getInnerWallOffset(w,n,o,i,"left"):0,P=x&&x.type===z.Wall?jo.getInnerWallOffset(x,n,o,i,"right"):0,A=[],S=n/2,v=r/2;return a===Ul.Partial?(A.push({x:-S+C,y:-v+l}),A.push({x:S-P,y:-v+s})):(A.push({x:-S+C,y:-v}),A.push({x:S-P,y:-v})),p?A.push({x:S-P,y:p-v}):A.push({x:S-P,y:v}),f&&A.push({x:f[0]*n,y:f[1]-v}),d&&A.push({x:d[0]*n,y:d[1]-v}),u&&A.push({x:u[0]*n,y:u[1]-v}),c?A.push({x:-S+C,y:c-v}):A.push({x:-S+C,y:v}),A}static getInnerWallOffset(e,n,o,r,i){let a=0;if(e&&e.fill!==Ul.Empty){const l=i==="left"?-1:1,s=(Math.PI*3+l*(r-e.relativeAngle))%fa;s<=$t+.01&&s>0&&(a=Math.min(o/Math.tan(s)+e.ly,n))}return a}static isElementAllowedMultipleMoveOnGround(e){return e.type===z.Foundation||e.type===z.Cuboid&&e.parentId===rr}static areBasesOverlapped(e,n,o){const r=o.get(e),i=o.get(n);if(!r||!i)return!1;for(const a of r)if(jo.isPointInside(a.x,a.y,i))return!0;for(const a of i)if(jo.isPointInside(a.x,a.y,r))return!0;r.push(r[0]),i.push(i[0]);for(let a=0;aNumber(c)),[a,l,s]=n.split(".").map(c=>Number(c));return oa?!1:rl?!1:i{const n=H.getState().getElementById,o=[],r=e;for(;e&&(o.push(e),e.leftJoints[0]);)if(e.leftJoints[0]!==r.id){const a=n(e.leftJoints[0]);a&&a.type===z.Wall&&(e=a)}else return o;const i=n(r.rightJoints[0]);for(i&&i.type===z.Wall&&(e=i);e&&(o.push(e),e.rightJoints[0]&&e.rightJoints[0]!==r.id);){const a=n(e.rightJoints[0]);a&&(e=a)}return o},jo.getWorldDataById=e=>{const n=H.getState().getElementById(e);if(!n)return{pos:new ue,rot:0,topZ:0};const o=new ue(n.cx,n.cy,n.cz),r=n.rotation[2],i=n.lz;if(n.parentId===rr)return{pos:o,rot:r,topZ:i};const{pos:a,rot:l,topZ:s}=jo.getWorldDataById(n.parentId),c=new cn(0,0,l);return{pos:new ue().addVectors(o.applyEuler(c),a.clone().setZ(s)),rot:r+l,topZ:i+s}},jo.isChild=(e,n,o=!1)=>{const r=H.getState().getElementById(n);return!r||o&&r.locked?!1:r.parentId===e?!0:jo.isChild(e,r.parentId,o)},jo.getBaseId=e=>{const n=H.getState().getElementById(e);return n?n.parentId===rr?n.id:jo.getBaseId(n.parentId):null},jo.isElementTriggerAutoDeletion=e=>{if(e.type===z.Roof){const r=e;if(r.roofType===Zo.Gable||r.roofType===Zo.Gambrel)return!0}if(e.type!==z.Wall)return!1;const n=e;if(!n.roofId)return!1;const o=H.getState().getElementById(n.roofId);if(!o)return!1;switch(o.roofType){case Zo.Hip:case Zo.Gable:case Zo.Gambrel:return!0;case Zo.Pyramid:case Zo.Mansard:return o.wallsId.length===0?!1:o.wallsId[0]===n.id;default:return!1}};let ye=jo;var vrt;vrt=Ly;class mMe{constructor(){this[vrt]=!0,this.latitude=42.2844063,this.longitude=-71.3488548,this.address=zX,this.countryCode="US",this.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),this.name="default",this.ground={albedo:.3,thermalDiffusivity:.05,snowReflectionFactors:new Array(12).fill(0)},this.leafDayOfYear1=tQ,this.leafDayOfYear2=nQ,this.airAttenuationCoefficient=.01,this.airConvectiveCoefficient=5,this.timesPerHour=1,this.daysPerYear=12,this.monthlyIrradianceLosses=new Array(12).fill(.05),this.pvGridCellSize=.5,this.discretization=Ay.APPROXIMATE,this.diurnalTemperatureModel=a5.Sinusoidal,this.highestTemperatureTimeInMinutes=900,this.solarPanelVisibilityGridCellSize=.2,this.solarRadiationHeatmapGridCellSize=.5,this.cspTimesPerHour=1,this.cspDaysPerYear=4,this.cspGridCellSize=.5,this.sutTimesPerHour=1,this.sutDaysPerYear=4,this.sutGridCellSize=1,this.noAnimationForHeatmapSimulation=!1,this.noAnimationForThermalSimulation=!1,this.noAnimationForSensorDataCollection=!1,this.noAnimationForSolarPanelSimulation=!1,this.noAnimationForSolarUpdraftTowerSimulation=!1}static resetWorldModel(e){e.latitude=42.2844063,e.longitude=-71.3488548,e.address=zX,e.countryCode="US",e.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),e.name="default",e.ground.albedo=.3,e.ground.thermalDiffusivity=.05,e.ground.snowReflectionFactors.fill(0),e.airAttenuationCoefficient=.01,e.airConvectiveCoefficient=5,e.timesPerHour=1,e.daysPerYear=12,e.monthlyIrradianceLosses=new Array(12).fill(.05),e.pvGridCellSize=.5,e.discretization=Ay.APPROXIMATE,e.diurnalTemperatureModel=a5.Sinusoidal,e.highestTemperatureTimeInMinutes=900,e.solarPanelVisibilityGridCellSize=.2,e.solarRadiationHeatmapGridCellSize=.5,e.cspTimesPerHour=1,e.cspDaysPerYear=4,e.cspGridCellSize=.5,e.sutTimesPerHour=1,e.sutDaysPerYear=4,e.sutGridCellSize=1,e.noAnimationForHeatmapSimulation=!1,e.noAnimationForThermalSimulation=!1,e.noAnimationForSensorDataCollection=!1,e.noAnimationForSolarPanelSimulation=!1,e.noAnimationForSolarUpdraftTowerSimulation=!1}getElements(){const e=[],n={type:z.Foundation,cx:0,cy:0,cz:.05,lx:10,ly:10,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:rr,textureType:Xi.NoTexture,id:Oi.generate()};e.push(n);const o={type:z.Sensor,cx:-.1,cy:0,cz:.105,lx:.1,ly:.1,lz:.01,parentId:n.id,foundationId:n.id,normal:[0,0,1],rotation:[0,0,0],id:Oi.generate(),showLabel:!0,light:!0,heatFlux:!1};e.push(o);const r={type:z.Human,name:Vt.Judd,cx:1,cy:-1,cz:0,lx:hh.fetchWidth(Vt.Jiya),lz:hh.fetchHeight(Vt.Jiya),normal:[1,0,0],rotation:[0,0,0],parentId:rr,id:Oi.generate()};return e.push(r),e}}class Pl{static clone(e,n,o,r,i,a,l,s){let c=null;switch(n.type){case z.Polygon:e&&(c=Pl.clonePolygon(e,n,o,r,i,a,l));break;case z.Sensor:e&&(c=Pl.cloneSensor(e,n,o,r,i));break;case z.Light:e&&(c=Pl.cloneLight(e,n,o,r,i));break;case z.SolarPanel:e&&(c=Pl.cloneSolarPanel(e,n,o,r,i));break;case z.SolarWaterHeater:e&&(c=Pl.cloneSolarWaterHeater(e,n,o,r,i));break;case z.ParabolicTrough:e&&(c=Pl.cloneParabolicTrough(e,n,o,r,i));break;case z.ParabolicDish:e&&(c=Pl.cloneParabolicDish(e,n,o,r,i));break;case z.FresnelReflector:e&&(c=Pl.cloneFresnelReflector(e,n,o,r,i));break;case z.Heliostat:e&&(c=Pl.cloneHeliostat(e,n,o,r,i));break;case z.WindTurbine:e&&(c=Pl.cloneWindTurbine(e,n,o,r,i));break;case z.Wall:e&&(c=Pl.cloneWall(e,n,o,r,i));break;case z.Window:e&&(c=Pl.cloneWindow(e,n,o,r,i,s));break;case z.Door:e&&(c=Pl.cloneDoor(e,n,o,r,i));break;case z.Roof:e&&(c=Pl.cloneRoof(e,n,o,r,i));break;case z.Human:c=Pl.cloneHuman(n,o,r,i,e);break;case z.Tree:c=Pl.cloneTree(n,o,r,i,e);break;case z.Flower:c=Pl.cloneFlower(n,o,r,i,e);break;case z.Foundation:c=Pl.cloneFoundation(n,o,r);break;case z.Cuboid:{const u=e?e.id:rr;c=Pl.cloneCuboid(u,n,o,r);break}case z.BatteryStorage:e&&(c=Pl.cloneBatteryStorage(e.id,n,o,r))}return c}static cloneHuman(e,n,o,r,i){return{type:z.Human,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Oi.generate()}}static cloneTree(e,n,o,r,i){return{type:z.Tree,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Oi.generate()}}static cloneFlower(e,n,o,r,i){return{type:z.Flower,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Oi.generate()}}static clonePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=n.vertices.map(d=>({...d})),u={type:z.Polygon,cx:o,cy:r,cz:i,lx:n.lx,ly:n.ly,lz:n.lz,filled:n.filled,noOutline:n.noOutline,color:n.color,lineColor:n.lineColor,lineWidth:n.lineWidth,opacity:n.opacity,textureType:n.textureType,text:n.text,fontSize:n.fontSize,fontColor:n.fontColor,normal:[...n.normal],rotation:n.parentId?[...e.rotation]:[0,0,0],vertices:c,parentId:e.id,parentType:e.type,foundationId:s,id:Oi.generate()};if(!a){let d=o,f=r;if(e.type===z.Cuboid&&l){ye.isSame(l,S1)?d=i??0:ye.isSame(l,b1)?d=-(i??0):ye.isSame(l,T1)?f=i??0:ye.isSame(l,Zc)&&(f=-(i??0));const p=l.dot(new ue().fromArray(n.normal));if(Math.abs(p)0&&this.commands.length>this.limit&&this.commands.splice(0,this.commands.length-this.limit),this.index=this.commands.length-1)}undo(){const e=this.commands[this.index];if(e)return this.isExecuting=!0,e.undo(),this.isExecuting=!1,this.index--,e.name}redo(){const e=this.commands[this.index+1];if(e)return this.isExecuting=!0,e.redo(),this.isExecuting=!1,this.index++,e.name}clear(){this.commands=[],this.index=-1}hasUndo(){return this.index!==-1}hasRedo(){return this.index0||this.cuboidCount>0||this.wallCount>0||this.windowCount>0||this.doorCount>0||this.humanCount>0||this.treeCount>0||this.flowerCount>0||this.polygonCount>0||this.sensorCount>0||this.insideLightCount>0||this.outsideLightCount>0||this.solarPanelCount>0||this.parabolicTroughCount>0||this.parabolicDishCount>0||this.fresnelReflectorCount>0||this.heliostatCount>0||this.solarUpdraftTowerCount>0||this.windTurbineCount>0}}var Trt;Trt=Ly;class bhn{constructor(e){this[Trt]=!0,this.problem=e,this.objectiveFunctionType=Mo.DAILY_TOTAL_OUTPUT,this.selectionMethod=by.ROULETTE_WHEEL,this.searchMethod=As.GLOBAL_SEARCH_UNIFORM_SELECTION,this.populationSize=20,this.maximumGenerations=5,this.selectionRate=.5,this.crossoverRate=.5,this.mutationRate=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}var Prt;Prt=Ly;class Shn{constructor(e){this[Prt]=!0,this.problem=e,this.objectiveFunctionType=Mo.DAILY_TOTAL_OUTPUT,this.searchMethod=As.GLOBAL_SEARCH_UNIFORM_SELECTION,this.swarmSize=20,this.maximumSteps=5,this.vmax=.01,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}var Crt;Crt=Ly;class xMe{constructor(){this[Crt]=!0,this.geneticAlgorithmParams=new bhn(Pi.SOLAR_PANEL_TILT_ANGLE),this.particleSwarmOptimizationParams=new Shn(Pi.SOLAR_PANEL_TILT_ANGLE)}}var Rrt;Rrt=Ly;class kJ{constructor(){this[Rrt]=!0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-$t,this.maximumTiltAngle=$t,this.poleHeight=1,this.poleSpacing=5,this.orientation=br.landscape,this.pvModelName="CS6X-355P-FG",this.rowAxis=Nl.leftRight}}var Hrt;Hrt=Ly;class vMe{constructor(){this[Hrt]=!0,this.projectLifeSpan=25,this.electricitySellingPrice=.25,this.operationalCostPerUnit=.15}}var Mrt;Mrt=Ly;class bMe{constructor(){this[Mrt]=!0,this.humanName=Vt.Jack,this.flowerType=uo.YellowFlower,this.treeType=yr.Dogwood,this.treeSpread=3,this.treeHeight=4,this.foundationHeight=.1,this.foundationColor="#808080",this.foundationTexture=Xi.NoTexture,this.groundFloorRValue=Kw,this.cuboidHeight=4,this.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"],this.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture],this.cuboidStackable=!1,this.cuboidTransparency=0,this.wallHeight=5,this.wallThickness=.3,this.wallColor="#ffffff",this.wallTexture=Jo.Default,this.wallStructure=Tc.Default,this.wallStructureSpacing=2,this.wallStructureWidth=.1,this.wallStructureColor="#ffffff",this.wallOpacity=.5,this.wallRValue=U9,this.wallVolumetricHeatCapacity=.5,this.wallEavesLength=.3,this.wallParapet=K3e,this.roofColor="#454769",this.roofSideColor="#ffffff",this.roofTexture=Yr.Default,this.roofThickness=.2,this.roofStructure=Hc.Default,this.roofGlassOpacity=.5,this.roofGlassTint="#73D8FF",this.roofRafterWidth=.1,this.roofRafterSpacing=1,this.roofRafterColor="#ffffff",this.roofRValue=pA,this.roofVolumetricHeatCapacity=.5,this.roofRise=2,this.roofCeiling=!1,this.ceilingRValue=dA,this.doorColor="#ffffff",this.doorFrameColor="#ffffff",this.doorTexture=dr.Default,this.doorType=Wd.Default,this.doorArchHeight=1,this.doorFilled=!0,this.doorInterior=!1,this.doorUValue=fA,this.doorOpacity=1,this.doorVolumetricHeatCapacity=.5,this.windowWidth=1,this.windowHeight=1,this.windowColor="#ffffff",this.windowTint="#73D8FF",this.windowOpacity=.5,this.windowUValue=X9,this.windowHorizontalMullion=!0,this.windowVerticalMullion=!0,this.windowMullionWidth=.06,this.windowHorizontalMullionSpacing=.5,this.windowVerticalMullionSpacing=.5,this.windowMullionColor="#ffffff",this.windowFrame=!1,this.windowFrameWidth=.1,this.windowSillWidth=.1,this.windowType=Ti.Default,this.windowArchHeight=1,this.windowShutterLeft=!1,this.windowShutterRight=!1,this.windowShutterColor="gray",this.windowShutterWidth=.5,this.windowEmpty=!1,this.windowInterior=!1,this.windTurbineBirdSafeDesign=wc.None,this.windTurbineBladeColor=j9,this.windTurbineStripeColor=B9,this.windTurbineNumberOfBlades=3,this.windTurbinePitchAngle=Math.PI/18,this.windTurbineRelativeYawAngle=0,this.windTurbineInitialRotorAngle=0,this.windTurbineTowerHeight=20,this.windTurbineTowerRadius=.5,this.windTurbineBladeRadius=10,this.windTurbineBladeMaximumChordLength=1,this.windTurbineBladeMaximumChordRadius=3,this.windTurbineBladeRootRadius=.3,this.windTurbineHubRadius=.75,this.windTurbineHubLength=1.5,this.solarPanelModelName=g3,this.solarPanelOrientation=br.landscape,this.solarPanelPoleHeight=1,this.solarPanelPoleSpacing=3,this.solarPanelTiltAngle=0,this.solarPanelRelativeAzimuth=0,this.solarPanelFrameColor="#ffffff",this.solarPanelCx=0,this.solarPanelCy=0,this.solarWaterHeaterColor="grey",this.solarWaterHeaterRelativeAzimuth=0,this.solarWaterHeaterTankRadius=qot,this.solarWaterHeaterHeight=1,this.parabolicDishReflectance=.9,this.parabolicDishAbsorptance=.95,this.parabolicDishOpticalEfficiency=.7,this.parabolicDishThermalEfficiency=.3,this.parabolicDishRimDiameter=4,this.parabolicDishLatusRectum=8,this.parabolicDishPoleHeight=.2,this.parabolicDishPoleRadius=.1,this.parabolicDishReceiverStructure=pf.CentralPole,this.parabolicTroughReflectance=.9,this.parabolicTroughAbsorptance=.95,this.parabolicTroughOpticalEfficiency=.7,this.parabolicTroughThermalEfficiency=.3,this.parabolicTroughLatusRectum=2,this.parabolicTroughPoleHeight=.2,this.parabolicTroughWidth=2,this.parabolicTroughModuleLength=3,this.fresnelReflectorReceiver="None",this.fresnelReflectorReflectance=.9,this.fresnelReflectorPoleHeight=.2,this.fresnelReflectorWidth=2,this.fresnelReflectorModuleLength=3,this.heliostatTower="None",this.heliostatReflectance=.9,this.heliostatPoleHeight=.2,this.heliostatPoleRadius=.1,this.heliostatWidth=4,this.heliostatLength=2,this.lightColor="#ffff99",this.lightIntensity=3,this.lightDistance=5}}var Irt;Irt=Ly;class SMe{constructor(){this[Irt]=!0,this.dailyPvIndividualOutputs=!1,this.yearlyPvIndividualOutputs=!1,this.dailyParabolicDishIndividualOutputs=!1,this.yearlyParabolicDishIndividualOutputs=!1,this.dailyParabolicTroughIndividualOutputs=!1,this.yearlyParabolicTroughIndividualOutputs=!1,this.dailyFresnelReflectorIndividualOutputs=!1,this.yearlyFresnelReflectorIndividualOutputs=!1,this.dailyHeliostatIndividualOutputs=!1,this.yearlyHeliostatIndividualOutputs=!1,this.dailyUpdraftTowerIndividualOutputs=!1,this.yearlyUpdraftTowerIndividualOutputs=!1}}class Td{static getDefaultHiddenParameters(e){return e===Pi.SOLAR_PANEL_ARRAY?["latitude","orientation","poleHeight"]:[]}static getVariables(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("rowWidth"),n.includes("tiltAngle")||o.push("tiltAngle"),n.includes("interRowSpacing")||o.push("interRowSpacing"),n.includes("latitude")||o.push("latitude"),n.includes("orientation")||o.push("orientation"),n.includes("poleHeight")||o.push("poleHeight"),n.includes("unitCost")||o.push("unitCost"),n.includes("sellingPrice")||o.push("sellingPrice"),n.includes("totalYearlyCost")||o.push("totalYearlyCost"),n.includes("totalYearlyYield")||o.push("totalYearlyYield"),n.includes("meanYearlyYield")||o.push("meanYearlyYield"),n.includes("yearlyProfit")||o.push("yearlyProfit"),o}return[]}static getTitles(e,n,o){if(e===Pi.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(B.t("polygonMenu.SolarPanelArrayRowWidth",n)),o.includes("tiltAngle")||r.push(B.t("polygonMenu.SolarPanelArrayTiltAngle",n)),o.includes("interRowSpacing")||r.push(B.t("polygonMenu.SolarPanelArrayRowSpacing",n)),o.includes("latitude")||r.push(B.t("word.Latitude",n)),o.includes("orientation")||r.push(B.t("polygonMenu.SolarPanelArrayOrientation",n)),o.includes("poleHeight")||r.push(B.t("polygonMenu.SolarPanelArrayPoleHeight",n)),o.includes("unitCost")||r.push(B.t("economicsPanel.UnitCost",n)),o.includes("sellingPrice")||r.push(B.t("economicsPanel.SellingPrice",n)),o.includes("totalYearlyCost")||r.push(B.t("polygonMenu.SolarPanelArrayTotalYearlyCost",n)),o.includes("totalYearlyYield")||r.push(B.t("polygonMenu.SolarPanelArrayTotalYearlyYield",n)),o.includes("meanYearlyYield")||r.push(B.t("polygonMenu.SolarPanelArrayMeanYearlyYield",n)),o.includes("yearlyProfit")||r.push(B.t("polygonMenu.SolarPanelArrayYearlyProfit",n)),r}return[]}static getTypes(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("number"),n.includes("tiltAngle")||o.push("number"),n.includes("interRowSpacing")||o.push("number"),n.includes("latitude")||o.push("number"),n.includes("orientation")||o.push("boolean"),n.includes("poleHeight")||o.push("number"),n.includes("unitCost")||o.push("number"),n.includes("sellingPrice")||o.push("number"),n.includes("totalYearlyCost")||o.push("number"),n.includes("totalYearlyYield")||o.push("number"),n.includes("meanYearlyYield")||o.push("number"),n.includes("yearlyProfit")||o.push("number"),o}return[]}static getDigits(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(0),n.includes("tiltAngle")||o.push(1),n.includes("interRowSpacing")||o.push(1),n.includes("latitude")||o.push(1),n.includes("orientation")||o.push(0),n.includes("poleHeight")||o.push(1),n.includes("unitCost")||o.push(2),n.includes("sellingPrice")||o.push(2),n.includes("totalYearlyCost")||o.push(1),n.includes("totalYearlyYield")||o.push(1),n.includes("meanYearlyYield")||o.push(1),n.includes("yearlyProfit")||o.push(3),o}return[]}static getTickIntegers(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(!0),n.includes("tiltAngle")||o.push(!1),n.includes("interRowSpacing")||o.push(!1),n.includes("latitude")||o.push(!1),n.includes("orientation")||o.push(!0),n.includes("poleHeight")||o.push(!1),n.includes("unitCost")||o.push(!1),n.includes("sellingPrice")||o.push(!1),n.includes("totalYearlyCost")||o.push(!1),n.includes("totalYearlyYield")||o.push(!1),n.includes("meanYearlyYield")||o.push(!1),n.includes("yearlyProfit")||o.push(!1),o}return[]}static getUnits(e,n,o){if(e===Pi.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(" "+B.t("solarPanelMenu.Panels",n)),o.includes("tiltAngle")||r.push("°"),o.includes("interRowSpacing")||r.push(" "+B.t("word.MeterAbbreviation",n)),o.includes("latitude")||r.push("°"),o.includes("orientation")||r.push(""),o.includes("poleHeight")||r.push(" "+B.t("word.MeterAbbreviation",n)),o.includes("unitCost")||r.push(""),o.includes("sellingPrice")||r.push(""),o.includes("totalYearlyCost")||r.push("K"),o.includes("totalYearlyYield")||r.push(" MWh"),o.includes("meanYearlyYield")||r.push(" kWh"),o.includes("yearlyProfit")||r.push("K"),r}return[]}static getUnit(e,n){return e==="tiltAngle"||e==="latitude"?"°":e==="interRowSpacing"||e==="poleHeight"?B.t("word.MeterAbbreviation",n):e==="totalYearlyYield"?"MWh":e==="meanYearlyYield"?"kWh":e==="totalYearlyCost"||e==="yearlyProfit"?"K":""}static setScatterData(e,n,o,r){switch(e){case"rowWidth":o[n]=r.rowsPerRack;break;case"tiltAngle":o[n]=ye.toDegrees(r.tiltAngle);break;case"interRowSpacing":o[n]=r.interRowSpacing;break;case"latitude":o[n]=r.latitude;break;case"orientation":o[n]=r.orientation===br.landscape?0:1;break;case"poleHeight":o[n]=r.poleHeight;break;case"unitCost":o[n]=r.unitCost;break;case"sellingPrice":o[n]=r.sellingPrice;break;case"totalYearlyCost":o[n]=ye.calculateCost(r);break;case"totalYearlyYield":o[n]=r.yearlyYield*.001;break;case"meanYearlyYield":o[n]=r.yearlyYield/r.panelCount;break;case"yearlyProfit":o[n]=ye.calculateProfit(r);break}}}class Thn{static updateOldFileData(){H.getState().set(e=>{ye.compareVersion(e.version,Cvt)&&(e.viewState.ambientLightIntensity&&(e.viewState.ambientLightIntensity*=3),e.viewState.directLightIntensity&&(e.viewState.directLightIntensity*=3.5));const n=new Map;for(const o of e.elements)n.set(o.id,o);for(const o of e.elements)switch(o.type){case z.Foundation:{const r=o;o.parentId!==rr&&(console.error("Error: "+o.parentId+" is not ground!"),o.parentId=rr),r.hvacSystem||(r.hvacSystem={...fVe});break}case z.Wall:{const r=o;if(r.wallStructure===void 0&&(r.wallStructure=Tc.Default),r.structureSpacing===void 0&&(r.structureSpacing=2),r.structureWidth===void 0&&(r.structureWidth=.1),r.structureColor===void 0&&(r.structureColor="white"),r.opacity===void 0&&(r.opacity=.5),r.fill===void 0&&(r.fill=Ul.Full),r.unfilledHeight===void 0&&(r.unfilledHeight=.5),r.leftUnfilledHeight===void 0||r.rightUnfilledHeight===void 0){const i=r.unfilledHeight??.5;r.leftUnfilledHeight=i,r.rightUnfilledHeight=i}if((r.leftTopPartialHeight===void 0||r.rightTopPartialHeight===void 0)&&(r.leftTopPartialHeight=r.lz,r.rightTopPartialHeight=r.lz),r.eavesLength===void 0&&r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;r.eavesLength=a.overhang!==void 0?a.overhang:.3}else r.eavesLength=.3}if(r.parapet===void 0&&(r.parapet={...K3e}),r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;(a.roofType===Zo.Pyramid||a.roofType===Zo.Hip||a.roofType===Zo.Mansard)&&(r.leftRoofHeight=void 0,r.rightRoofHeight=void 0)}}break}case z.Window:{const r=o;r.horizontalMullion===void 0&&(r.horizontalMullion=r.mullion),r.verticalMullion===void 0&&(r.verticalMullion=r.mullion),r.mullionWidth===void 0&&(r.mullionWidth=.06),r.horizontalMullionSpacing===void 0&&(r.horizontalMullionSpacing=r.mullionSpacing??.5),r.verticalMullionSpacing===void 0&&(r.verticalMullionSpacing=r.mullionSpacing??.5),r.tint===void 0&&(r.tint="#73D8FF"),r.opacity===void 0&&(r.opacity=.5),r.shutter&&(r.leftShutter=r.shutter.showLeft,r.rightShutter=r.shutter.showRight,r.shutterColor=r.shutter.color,r.shutterWidth=r.shutter.width,r.shutter=void 0),r.shutterColor===void 0&&(r.shutterColor="gray"),r.shutterWidth===void 0&&(r.shutterWidth=.5),r.mullionColor===void 0&&(r.mullionColor="white"),r.frame===void 0&&(r.frame=!1),r.color===void 0&&(r.color="white"),r.frameWidth===void 0&&(r.frameWidth=.1),r.windowType===void 0&&(r.windowType=Ti.Default),r.archHeight===void 0&&(r.archHeight=1);break}case z.Door:{const r=o;r.doorType===void 0&&(r.doorType=Wd.Default),r.archHeight===void 0&&(r.archHeight=1),r.filled===void 0&&(r.filled=!0);break}case z.Roof:{const r=o;if(r.ceiling===void 0&&(r.ceiling=!1),r.roofType===Zo.Gambrel){const i=r;i.frontRidgePoint===void 0&&(i.frontRidgePoint=i.frontRidgeLeftPoint?[...i.frontRidgeLeftPoint]:[.35,.5],i.frontRidgeLeftPoint=void 0,i.frontRidgeRightPoint=void 0),i.backRidgePoint===void 0&&(i.backRidgePoint=i.backRidgeLeftPoint?[...i.backRidgeLeftPoint]:[-.35,.5],i.backRidgeLeftPoint=void 0,i.backRidgeRightPoint=void 0),i.topRidgePoint===void 0&&(i.topRidgePoint=i.topRidgeLeftPoint?[...i.topRidgeLeftPoint]:[0,1],i.topRidgeLeftPoint=void 0,i.topRidgeRightPoint=void 0)}break}case z.SolarPanel:{const r=o;if(r.version===void 0)switch(r.version=1,r.parentType){case void 0:case z.Foundation:{r.parentType=z.Foundation;const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz),r.rotation[2]!==0&&(r.rotation=[0,0,0]);break}case z.Cuboid:{const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz,r.rotation=Ii.getRotationOnCuboid(new ue().fromArray(r.normal)),ye.isEqual(0,r.rotation[0])&&r.rotation[2]!==0&&(r.rotation=[0,0,0]));break}case z.Wall:{r.normal=[0,-1,0],r.rotation=[$t,0,0];break}case z.Roof:{if(r.foundationId){const i=n.get(r.foundationId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz+i.lz/2)}break}}break}}})}}function Cd(t){return t.type===z.Foundation||t.type===z.Cuboid}y9t();const H=pq()(xvt(Tvt((t,e)=>{const n=ye.isOpenFromURL(),o=new mMe,r=n?[]:o.getElements(),i=a=>t(Dv(a));return{set:a=>{try{i(a)}catch(l){console.log(l)}},version:HR,world:o,elements:r,user:{},viewState:new yMe,actionState:new bMe,graphState:new SMe,solarPanelArrayLayoutParams:new AMe,solarPanelArrayLayoutConstraints:new kJ,evolutionaryAlgorithmState:new xMe,economicsParams:new vMe,geneticAlgorithmWizardSelectedTab:"1",particleSwarmOptimizationWizardSelectedTab:"1",modelType:ga.UNKNOWN,modelAuthor:null,modelLabel:null,modelDescription:null,projectView:!1,canvasPercentWidth:100,projectState:{owner:null,title:null,description:null,type:Pi.SOLAR_PANEL_ARRAY,designs:new Array,ranges:new Array,filters:new Array,hiddenParameters:Td.getDefaultHiddenParameters(Pi.SOLAR_PANEL_ARRAY),counter:0,dataColoring:$9.ALL,selectedProperty:null,sortDescending:!1,xAxisNameScatterPlot:null,yAxisNameScatterPlot:null,dotSizeScatterPlot:5,thumbnailWidth:200},projectImages:new Map,designProjectType:null,cloudFileBelongToProject(){const a=e().cloudFile;if(!a)return!1;const l=e().projectState.designs;if(l){for(const s of l)if(s.title===a)return!0}return!1},closeProject(){i(a=>{a.loggable&&(a.actionInfo={name:"Close Project",timestamp:new Date().getTime(),details:a.projectState.title}),a.canvasPercentWidth=100,a.projectView=!1,a.projectState.title=null,a.projectState.description=null,a.projectState.owner=null;const l=a.projectState.designs;if(l){for(const s of l)if(s.title===a.cloudFile){a.cloudFile=void 0;break}}a.projectImages.clear(),a.undoManager.clear()}),dt.getState().set(a=>{a.projectImagesUpdateFlag=!a.projectImagesUpdateFlag})},notes:[],language:"en",floatingWindowOpacity:Lu,selectedFloatingWindow:null,cloudFile:void 0,latestModelSite:void 0,modelSites:new Map,allModelSites:new Map,peopleModels:new Map,allPeopleModels:new Map,modelsMapLatitude:42.2844063,modelsMapLongitude:-71.3488548,modelsMapAddress:zX,modelsMapZoom:cVe,modelsMapType:"roadmap",modelsMapTilt:0,showModelsAllTime:!0,showModelsFromDate:"2021-01-01",showModelsToDate:"2025-12-31",minimumNavigationMoveSpeed:3,minimumNavigationTurnSpeed:3,tempHumanPlant:[],ray:new yu,mouse:new _t,fileChanged:!1,setNavigationView(a){i(l=>{l.viewState.navigationView=a,l.viewState.enableRotate=!a,a&&(l.viewState.orthographic=!1)})},set2DView(a){i(l=>{l.viewState.orthographic=a,l.viewState.enableRotate=!a,a&&(l.viewState.navigationView=!1)})},applyCount:0,setApplyCount(a){i(l=>{l.applyCount=a})},revertApply(){if(e().applyCount){for(let a=0;a{s.version=a.version,s.world=a.world,s.viewState=a.view,s.graphState=a.graphState??new SMe,s.elements=a.elements,s.notes=a.notes??[],s.animate24Hours=!!a.animate24Hours,s.canvasPercentWidth=a.canvasPercentWidth??(s.viewState.showModelTree?75:100),s.modelType=a.modelType??ga.UNKNOWN,s.modelAuthor=a.modelAuthor??null,s.modelLabel=a.modelLabel??null,s.modelDescription=a.modelDescription??null,s.designProjectType=a.designProjectType??null,s.cloudFile=l,s.currentUndoable=void 0,s.actionInfo=void 0,s.sceneRadius=a.sceneRadius??100,s.updateSceneRadiusFlag=!s.updateSceneRadiusFlag,s.localContentToImportAfterCloudFileUpdate=void 0,s.fileChanged=!s.fileChanged,s.evolutionMethod=a.evolutionMethod??ec.GENETIC_ALGORITHM,s.solarPanelArrayLayoutParams=a.solarPanelArrayLayoutParams??new AMe,s.solarPanelArrayLayoutConstraints=a.solarPanelArrayLayoutConstraints??new kJ,s.evolutionaryAlgorithmState=a.evolutionaryAlgorithmState??new xMe,s.economicsParams=a.economicsParams??new vMe,s.minimumNavigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.minimumNavigationTurnSpeed=a.minimumNavigationTurnSpeed??3,s.fittestIndividualResults.length=0,s.undoManager.clear(),s.deletedRoofId=null,s.autoDeletedRoofs=null,s.autoDeletedRoofIdSet.clear(),s.autoDeletedChild=null,s.deletedRoofIdSet.clear(),s.addedRoofIdSet.clear(),s.actionState=new bMe,s.multiSelectionsMode=!1,s.selectedElementIdSet.clear(),s.groupActionMode=!1,s.selectedFloatingWindow=null,s.customPvModules=a.customPvModules??{}}),Thn.updateOldFileData(),dt.getState().set(s=>{s.changed=!1,s.skipChange=!0,s.animateSun=!1,s.showSolarRadiationHeatmap=!1,s.showHeatFluxes=!1,s.simulationInProgress=!1,s.simulationPaused=!1,s.clearDailySimulationResultsFlag=!s.clearDailySimulationResultsFlag,s.clearYearlySimulationResultsFlag=!s.clearYearlySimulationResultsFlag,s.navigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.navigationTurnSpeed=a.minimumNavigationTurnSpeed??3}),In.getState().clearDataStore(),In.getState().clearRoofVerticesMap()},exportContent(){const a=e(),l=new Date,s=JSON.parse(JSON.stringify(a.elements));return ye.fixElements(s),{docid:Oi.generate(),time:il(l).format("MM/DD/YYYY hh:mm A"),timestamp:l.getTime(),userid:a.user.uid,owner:a.user.signFile?a.user.displayName:null,email:a.user.signFile?a.user.email:null,version:HR,world:JSON.parse(JSON.stringify(a.world)),elements:s,sceneRadius:a.sceneRadius,view:JSON.parse(JSON.stringify(a.viewState)),canvasPercentWidth:a.canvasPercentWidth,animate24Hours:a.animate24Hours,graphState:JSON.parse(JSON.stringify(a.graphState)),evolutionMethod:a.evolutionMethod,solarPanelArrayLayoutParams:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutParams)),solarPanelArrayLayoutConstraints:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutConstraints)),evolutionaryAlgorithmState:JSON.parse(JSON.stringify(a.evolutionaryAlgorithmState)),economicsParams:JSON.parse(JSON.stringify(a.economicsParams)),modelType:a.modelType,modelAuthor:a.modelAuthor,modelLabel:a.modelLabel,modelDescription:a.modelDescription,designProjectType:a.designProjectType,notes:a.notes,minimumNavigationMoveSpeed:a.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:a.minimumNavigationTurnSpeed,customPvModules:JSON.parse(JSON.stringify(a.customPvModules))}},clearContent(){i(a=>{a.elements=[],a.sceneRadius=100}),In.getState().clearDataStore(),In.getState().clearRoofVerticesMap()},createEmptyFile(){i(a=>{mMe.resetWorldModel(a.world),yMe.resetViewState(a.viewState),a.version=HR,a.elements=[],a.sceneRadius=100,a.cloudFile=void 0,a.localContentToImportAfterCloudFileUpdate=void 0,a.notes=[],a.fileChanged=!a.fileChanged,a.currentUndoable=void 0,a.actionInfo=void 0,a.undoManager.clear(),a.modelType=ga.UNKNOWN,a.modelLabel=null,a.modelDescription=null,a.designProjectType=null,a.minimumNavigationMoveSpeed=3,a.minimumNavigationTurnSpeed=3,a.multiSelectionsMode=!1,a.selectedElementIdSet.clear(),a.groupActionMode=!1,a.selectedFloatingWindow=null,a.deletedRoofId=null,a.autoDeletedRoofs=null,a.autoDeletedRoofIdSet.clear(),a.autoDeletedChild=null,a.deletedRoofIdSet.clear(),a.addedRoofIdSet.clear(),a.customPvModules={},a.actionState.solarPanelModelName=g3}),dt.getState().set(a=>{a.changed=!1,a.skipChange=!0,a.animateSun=!1,a.showSolarRadiationHeatmap=!1,a.showHeatFluxes=!1}),In.getState().clearDataStore(),In.getState().clearRoofVerticesMap()},undoManager:new vhn,addUndoable(a){dt.getState().muteUndoMessage||idn(a.name),i(l=>{l.loggable&&(l.currentUndoable=a),l.undoManager.add(a)})},fittestIndividualResults:[],setFittestIndividualResults(a){i(l=>{l.fittestIndividualResults=[...a]})},variableLabels:[],setVariableLabels(a){i(l=>{l.variableLabels=[...a]})},aabb:new Cf(new ue(-10,-10,-10),new ue(10,10,10)),animate24Hours:!1,evolutionMethod:ec.GENETIC_ALGORITHM,clickObjectType:null,contextMenuObjectType:null,hoveredHandle:null,moveHandleType:null,resizeHandleType:null,rotateHandleType:null,resizeAnchor:new ue,selectedElement:null,getSelectedElement(){if(e().selectedElementIdSet.size===0)return null;const a=e().selectedElement;return a?e().elements.find(l=>l.id===a.id)??null:null},selectedElementIdSet:new Set,multiSelectionsMode:!1,findNearestSibling(a){let l=null;const s=e().getElementById(a);if(s){let c=Number.MAX_VALUE;for(const u of e().elements)if(u.type===s.type&&u.parentId===s.parentId&&u.id!==a){const d=s.cx-u.cx,f=s.cy-u.cy,p=s.cz-u.cz,m=d*d+f*f+p*p;c>m&&(c=m,l=u.id)}}return l},overlapWithSibling(a,l){let s=!1;if(l===void 0){const c=e().getParent(a);if(c){for(const u of e().elements)if(u.type===a.type&&u.parentId===a.parentId&&u.id!==a.id){if(a.type===z.SolarPanel){if(ye.doSolarPanelsOverlap(a,u,c)){s=!0;break}}else if(Math.abs(a.cx-u.cx)*c.lx<.5*(a.lx+u.lx)&&Math.abs(a.cy-u.cy)*c.ly<.5*(a.ly+u.ly)&&Math.abs(a.cz-u.cz)*c.lz<.5*(a.lz+u.lz)){s=!0;break}}}}else{const c=l*l,u=e().getParent(a);for(const d of e().elements)if(d.type===a.type&&d.parentId===a.parentId&&d.id!==a.id){const f=(a.cx-d.cx)*(u?u.lx:1),p=(a.cy-d.cy)*(u?u.ly:1),m=(a.cz-d.cz)*(u?u.lz:1);if(f*f+p*p+m*mC.id===m);if(x){const C=new ue(x.cx,x.cy,x.lz),P=new cn(0,0,x.rotation[2]),A=new ue;switch(l){case xt.UpperLeft:{A.fromArray(w.leftPoint).setZ(0);break}case xt.UpperRight:{A.fromArray(w.rightPoint).setZ(0);break}}y.copy(A.applyEuler(P).add(C))}break}case z.Roof:{const w=e().elements.find(x=>x.id===m);if(w){const x=new ue(w.cx,w.cy,w.lz),C=new cn(0,0,w.rotation[2]),P=new ue(e().selectedElementX,e().selectedElementY).applyEuler(C).add(x);y.set(P.x,P.y,w.lz)}break}case z.Tree:{const w=e().elements.find(x=>x.id===m);if(w){const x=new ue(w.cx,w.cy,w.cz+w.lz/2),C=new cn(0,0,w.rotation[2]);y.copy(new ue(a.cx,a.cy,w.lz).applyEuler(C).add(x))}break}}return y},getElementById(a){const l=e().elements;for(const s of l)if(s.id===a)return s;return null},getParent(a){const l=e().elements;for(const s of l)if(s.id===a.parentId)return s;return null},getFoundation(a){const l=e().elements;for(const s of l)if(s.id===a.foundationId&&s.type===z.Foundation)return s;return null},selectNone(){i(a=>{a.selectedElementIdSet.clear();for(const l of a.elements)l.selected=!1;a.selectedElement=null,a.viewState.showModelTree&&dt.getState().set(l=>{l.modelTreeExpandedKeys=[]})}),jn.getState().selectNone()},selectElement(a,l){i(s=>{if(s.multiSelectionsMode)s.selectedElementIdSet.has(a)?s.selectedElementIdSet.delete(a):s.selectedElementIdSet.add(a);else{s.selectedElementIdSet.clear(),!l&&s.viewState.showModelTree&&dt.getState().set(c=>{c.modelTreeExpandedKeys=[]});for(const c of s.elements)c.id===a?(c.selected=!0,s.selectedElement=c,s.selectedElementIdSet.add(a),!l&&s.viewState.showModelTree&&dt.getState().set(u=>{u.modelTreeExpandedKeys=[a]})):c.selected=!1}})},selectMe(a,l,s,c){const u=jn.getState().setEnableOrbitController;l.intersections.length>0&&(l.intersections.filter(f=>!f.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===l.eventObject||c)&&i(f=>{var p,m,y,w;f.viewState.showModelTree&&dt.getState().set(x=>{x.modelTreeExpandedKeys=[]});for(const x of f.elements){if(x.id===a)if(x.selected=!0,f.selectedElement=x,f.selectedElementHeight=x.lz,f.groupActionMode){let C=x.foundationId??null;!C&&Cd(x)&&(C=ye.getBaseId(x.id)),C&&(f.multiSelectionsMode||f.selectedElementIdSet.clear(),f.selectedElementIdSet.has(C)?f.selectedElementIdSet.delete(C):f.selectedElementIdSet.add(C))}else if(s===er.ContextMenu)if(f.selectedElementIdSet.has(a))for(const C of f.elements)f.selectedElementIdSet.has(C.id)&&C.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(C.id);else if(f.multiSelectionsMode){f.selectedElementIdSet.add(a);for(const C of f.elements)f.selectedElementIdSet.has(C.id)&&C.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(C.id)}else f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a);else f.multiSelectionsMode?f.selectedElementIdSet.has(a)?f.selectedElementIdSet.delete(a):f.selectedElementIdSet.add(a):(f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a));else x.selected=!1;f.viewState.showModelTree&&dt.getState().set(C=>{C.modelTreeExpandedKeys=[a]})}if(f.moveHandleType=null,f.resizeHandleType=null,f.rotateHandleType=null,f.contextMenuObjectType=null,s)switch(s){case er.Move:{((p=f.selectedElement)==null?void 0:p.type)===z.Tree||((m=f.selectedElement)==null?void 0:m.type)===z.Human||((y=f.selectedElement)==null?void 0:y.type)===z.Flower?f.moveHandleType=Ho.Default:f.moveHandleType=l.eventObject.name,u(!1);break}case er.Resize:{f.resizeHandleType=l.eventObject.name,u(!1);break}case er.Rotate:{f.rotateHandleType=l.eventObject.name,u(!1);break}case er.Select:{f.selectedElementAngle=((w=l.object.parent)==null?void 0:w.rotation.z)??0,u(!0);break}default:u(!0)}})},countHeatmapCells(){let a=0;return i(l=>{const s=l.world.solarRadiationHeatmapGridCellSize??.5,c=s*s;for(const u of l.elements)(u.type===z.Foundation||u.type===z.Cuboid)&&(a+=u.lx*u.ly/c)}),Math.round(a)},updateAllElementLocks(a){i(l=>{for(const s of l.elements)s.locked=a})},updateElementLockByFoundationId(a,l){i(s=>{for(const c of s.elements)(c.foundationId===a||c.parentId===a||c.id===a)&&(c.locked=l)})},updateElementLockByParentId(a,l,s){i(c=>{for(const u of c.elements)u.parentId===a&&l===u.type&&(u.locked=s)})},updateElementLockById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.locked=l;break}})},updateElementReferenceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.referenceId=l;break}})},updateElementLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.label=l;break}})},updateElementShowLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.showLabel=l;break}})},updateElementColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.color=l;break}})},updateElementColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.color=c)})},updateElementColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.color=s)})},updateElementColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.color=l)})},updateElementLineColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lineColor=l;break}})},updateElementLineColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.lineColor=c)})},updateElementLineColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineColor=s)})},updateElementLineColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineColor=l)})},updateElementLineWidthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.lineWidth=l;break}})},updateElementLineWidthOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.lineWidth=c)})},updateElementLineWidthAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineWidth=s)})},updateElementLineWidthForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineWidth=l)})},updateElementCxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cx=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cy=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cz=l;break}})},updateElementCzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cz=l)})},updateElementLxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lx=l;break}})},updateElementLxAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lx=s)})},updateElementLxOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lx=c)}})},updateElementLxForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lx=l)})},updateElementLyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.ly=l;break}})},updateElementLyAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.ly=s)})},updateElementLyOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.ly=c)}})},updateElementLyForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.ly=l)})},updateElementLzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lz=l;break}})},updateElementLzAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lz=s)})},updateElementLzOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lz=c)}})},updateElementLzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lz=l)})},updateElementRotationById(a,l,s,c){i(u=>{for(const d of u.elements)(d.id===a&&!d.locked||d.parentId===a&&!Bot(d)&&d.type!==z.SolarPanel&&d.type!==z.BatteryStorage)&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);u.selectedElementAngle=c})},updateElementRotationForAll(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a)d.locked||(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);else{const f=u.getParent(d);f&&!f.locked&&f.type===a&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c)}})},updateSolarCollectorDrawSunBeamById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.drawSunBeam=l;break}})},updateSolarCollectorDrawSunBeamAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.drawSunBeam=s)})},updateSolarCollectorDrawSunBeamForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.locked||c.type===a&&(c.drawSunBeam=l)})},updateSolarCollectorRelativeAzimuthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.relativeAzimuth=l,s.selectedElementAngle=l;break}})},updateSolarCollectorRelativeAzimuthAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&u.parentType!==z.Wall&&(u.relativeAzimuth=s)})},updateSolarCollectorRelativeAzimuthOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.relativeAzimuth=c)}})},updateSolarCollectorRelativeAzimuthForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&c.parentType!==z.Wall&&(c.relativeAzimuth=l)})},updateSolarCollectorXById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.cx=l;break}})},updateSolarCollectorXAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cx=s)})},updateSolarCollectorXForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cx=l)})},updateSolarCollectorYById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.cy=l;break}})},updateSolarCollectorYAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cy=s)})},updateSolarCollectorYForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cy=l)})},updateSolarCollectorPoleHeightById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.poleHeight=l;break}})},updateSolarCollectorPoleHeightAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleHeight=s)})},updateSolarCollectorPoleHeightOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleHeight=c)}})},updateSolarCollectorPoleHeightForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleHeight=l)})},updateSolarCollectorPoleRadiusById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.poleRadius=l;break}})},updateSolarCollectorPoleRadiusAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleRadius=s)})},updateSolarCollectorPoleRadiusOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleRadius=c)}})},updateSolarCollectorPoleRadiusForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleRadius=l)})},clearAllSolarCollectorYields(){i(a=>{for(const l of a.elements)if(ye.isSolarCollector(l)){const s=l;s.dailyYield=0,s.yearlyYield=0}})},updateSolarCollectorDailyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isSolarCollector(c)){c.dailyYield=l;break}})},updateSolarCollectorYearlyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isSolarCollector(c)){c.yearlyYield=l;break}})},updateCspReflectanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isCspCollector(c)){c.reflectance=l;break}})},updateCspReflectanceAboveFoundation(a,l,s){ye.isCspCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.reflectance=s)})},updateCspReflectanceForAll(a,l){ye.isCspCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.reflectance=l)})},updateParabolicCollectorAbsorptanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.absorptance=l;break}})},updateParabolicCollectorAbsorptanceAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.absorptance=s)})},updateParabolicCollectorAbsorptanceForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.absorptance=l)})},updateParabolicCollectorOpticalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.opticalEfficiency=l;break}})},updateParabolicCollectorOpticalEfficiencyAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.opticalEfficiency=s)})},updateParabolicCollectorOpticalEfficiencyForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.opticalEfficiency=l)})},updateParabolicCollectorThermalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.thermalEfficiency=l;break}})},updateParabolicCollectorThermalEfficiencyAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.thermalEfficiency=s)})},updateParabolicCollectorThermalEfficiencyForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.thermalEfficiency=l)})},foundationActionScope:ie.OnlyThisObject,setFoundationActionScope(a){i(l=>{l.foundationActionScope=a})},cuboidActionScope:ie.OnlyThisObject,setCuboidActionScope(a){i(l=>{l.cuboidActionScope=a})},batteryStorageActionScope:ie.OnlyThisObject,setBatteryStorageActionScope(a){i(l=>{l.batteryStorageActionScope=a})},polygonActionScope:ie.OnlyThisObject,setPolygonActionScope(a){i(l=>{l.polygonActionScope=a})},updatePolygonVertexPositionById(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===z.Polygon&&d.id===a){const f=d;l>=0&&l{for(const c of s.elements)if(c.type===z.Polygon&&c.id===a){const u=c;u.vertices=l;break}})},solarWaterHeaterActionScope:ie.OnlyThisObject,setSolarWaterHeaterActionScope(a){i(l=>{l.solarWaterHeaterActionScope=a})},solarPanelActionScope:ie.OnlyThisObject,setSolarPanelActionScope(a){i(l=>{l.solarPanelActionScope=a})},updateSolarPanelTiltAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.SolarPanel&&c.id===a&&!c.locked){const u=c;u.tiltAngle=l;break}})},setSolarPanelOrientation(a,l,s){if(a.orientation=s,a.orientation===br.portrait){const c=Math.max(1,Math.round(a.lx/l.width)),u=Math.max(1,Math.round(a.ly/l.length));a.lx=c*l.width,a.ly=u*l.length}else{const c=Math.max(1,Math.round(a.lx/l.length)),u=Math.max(1,Math.round(a.ly/l.width));a.lx=c*l.length,a.ly=u*l.width}},parabolicTroughActionScope:ie.OnlyThisObject,setParabolicTroughActionScope(a){i(l=>{l.parabolicTroughActionScope=a})},fresnelReflectorActionScope:ie.OnlyThisObject,setFresnelReflectorActionScope(a){i(l=>{l.fresnelReflectorActionScope=a})},heliostatActionScope:ie.OnlyThisObject,setHeliostatActionScope(a){i(l=>{l.heliostatActionScope=a})},updateSolarReceiverById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.Heliostat){c.towerId=l;break}else if(c.type===z.FresnelReflector){c.receiverId=l;break}}})},updateSolarReceiverAboveFoundation(a,l,s){ye.isHeliostatOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.Heliostat?u.towerId=s:u.type===z.FresnelReflector&&(u.receiverId=s))})},updateSolarReceiverForAll(a,l){ye.isHeliostatOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.Heliostat?c.towerId=l:c.type===z.FresnelReflector&&(c.receiverId=l))})},parabolicDishActionScope:ie.OnlyThisObject,setParabolicDishActionScope(a){i(l=>{l.parabolicDishActionScope=a})},updateModuleLengthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.ParabolicTrough){c.moduleLength=l;break}else if(c.type===z.FresnelReflector){c.moduleLength=l;break}}})},updateModuleLengthAboveFoundation(a,l,s){ye.isParabolicTroughOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.FresnelReflector)&&(u.moduleLength=s)})},updateModuleLengthForAll(a,l){ye.isParabolicTroughOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.FresnelReflector)&&(c.moduleLength=l)})},updateParabolaLatusRectumById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l);break}})},updateParabolaLatusRectumAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.ParabolicDish)&&(u.latusRectum=s)})},updateParabolaLatusRectumForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l)})},windTurbineActionScope:ie.OnlyThisObject,setWindTurbineActionScope(a){i(l=>{l.windTurbineActionScope=a})},wallActionScope:ie.OnlyThisObject,setWallActionScope(a){i(l=>{l.wallActionScope=a})},roofActionScope:ie.OnlyThisObject,setRoofActionScope(a){i(l=>{l.roofActionScope=a})},windowActionScope:ie.OnlyThisObject,setWindowActionScope(a){i(l=>{l.windowActionScope=a})},doorActionScope:ie.OnlyThisObject,setDoorActionScope(a){i(l=>{l.doorActionScope=a})},updateWallRelativeAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.relativeAngle=l;break}})},updateWallLeftJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.leftJoints=l;break}})},updateWallRightJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.rightJoints=l;break}})},updateWallLeftPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.leftPoint=[...l];break}})},updateWallRightPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.rightPoint=[...l];break}})},updateRoofRiseById(a,l,s){i(c=>{for(const u of c.elements)if(u.id===a&&u.type===z.Roof){u.rise=l,c.actionState.roofRise=l,s!==void 0&&(c.selectedElementHeight=s);break}})},updateRoofStructureById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&c.type===z.Roof){const u=c;u.roofStructure=l;break}})},updateInsideLightById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Light&&c.id===a){c.inside=l;break}})},updateInsideLightsByParentId(a,l){i(s=>{for(const c of s.elements)c.parentId===a&&c.type===z.Light&&(c.inside=l)})},setElementPosition(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].cx=l,u.elements[d].cy=s,c!==void 0&&(u.elements[d].cz=c);break}})},setElementNormal(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a||f.parentId===a){const p=u.elements[d];p.normal[0]=l,p.normal[1]=s,p.normal[2]=c}})},setElementSize(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].lx=l,u.elements[d].ly=s,c&&(u.elements[d].lz=c,u.selectedElementHeight=c);break}})},actionModeLock:!1,objectTypeToAdd:z.None,addElement(a,l,s){let c=null;const u="id"in a?a.id:rr;return i(d=>{switch(d.objectTypeToAdd){case z.Human:{const f=new ue().copy(l);if(u!==rr){const{rot:m,pos:y}=ye.getWorldDataById(u);f.sub(new ue(y.x,y.y,y.z)).applyEuler(new cn(0,0,-m))}const p=Qa.makeHuman(d.actionState.humanName,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Tree:{const f=new ue().copy(l);if(u!==rr){const{rot:m,pos:y}=ye.getWorldDataById(u);f.sub(new ue(y.x,y.y,y.z)).applyEuler(new cn(0,0,-m))}const p=Qa.makeTree(d.actionState.treeType,d.actionState.treeSpread,d.actionState.treeHeight,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Flower:{const f=new ue().copy(l);if(u!==rr){const{rot:m,pos:y}=ye.getWorldDataById(u);f.sub(new ue(y.x,y.y,y.z)).applyEuler(new cn(0,0,-m))}const p=Qa.makeFlower(d.actionState.flowerType,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Polygon:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makePolygon(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,f.type);c=m,d.elements.push(m);break}case z.Sensor:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeSensor(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=m,d.elements.push(m);break}case z.Light:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeLight(f,2,d.actionState.lightDistance,d.actionState.lightIntensity,d.actionState.lightColor,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=m,d.elements.push(m);break}case z.SolarPanel:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f,!0);let m=d.getPvModule(d.actionState.solarPanelModelName??g3);m||(m=d.getPvModule(g3));const y=Qa.makeSolarPanel(f,m,p.x,p.y,p.z,d.actionState.solarPanelOrientation??br.landscape,d.actionState.solarPanelPoleHeight??1,d.actionState.solarPanelPoleSpacing??3,d.actionState.solarPanelTiltAngle??0,d.actionState.solarPanelRelativeAzimuth??0,s,[0,0,0],d.actionState.solarPanelFrameColor??"white");c=y,d.elements.push(y);break}case z.ParabolicTrough:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeParabolicTrough(f,d.actionState.parabolicTroughReflectance,d.actionState.parabolicTroughAbsorptance,d.actionState.parabolicTroughOpticalEfficiency,d.actionState.parabolicTroughThermalEfficiency,d.actionState.parabolicTroughLatusRectum,d.actionState.parabolicTroughPoleHeight,d.actionState.parabolicTroughModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicTroughWidth);c=m,d.elements.push(m);break}case z.ParabolicDish:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeParabolicDish(f,d.actionState.parabolicDishReflectance,d.actionState.parabolicDishAbsorptance,d.actionState.parabolicDishOpticalEfficiency,d.actionState.parabolicDishThermalEfficiency,d.actionState.parabolicDishLatusRectum,d.actionState.parabolicDishPoleHeight,d.actionState.parabolicDishReceiverStructure,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicDishRimDiameter,d.actionState.parabolicDishRimDiameter);c=m,d.elements.push(m);break}case z.FresnelReflector:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeFresnelReflector(f,d.actionState.fresnelReflectorReceiver,d.actionState.fresnelReflectorReflectance,d.actionState.fresnelReflectorPoleHeight,d.actionState.fresnelReflectorModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.fresnelReflectorWidth);c=m,d.elements.push(m);break}case z.Heliostat:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeHeliostat(f,d.actionState.heliostatTower,d.actionState.heliostatReflectance,d.actionState.heliostatPoleHeight,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.heliostatLength,d.actionState.heliostatWidth);c=m,d.elements.push(m);break}case z.WindTurbine:{const f=a,p=ye.relativeCoordinates(l.x,l.y,0,f),m=Qa.makeWindTurbine(f,d.actionState.windTurbineBirdSafeDesign??wc.None,d.actionState.windTurbineBladeColor??j9,d.actionState.windTurbineStripeColor??B9,d.actionState.windTurbineNumberOfBlades??3,d.actionState.windTurbineInitialRotorAngle??0,d.actionState.windTurbineRelativeYawAngle??0,d.actionState.windTurbinePitchAngle??Math.PI/18,d.actionState.windTurbineBladeRadius??10,d.actionState.windTurbineBladeRootRadius??.3,d.actionState.windTurbineBladeMaximumChordLength??1,d.actionState.windTurbineBladeMaximumChordRadius??3,d.actionState.windTurbineTowerRadius??.5,d.actionState.windTurbineTowerHeight??20,d.actionState.windTurbineHubRadius??.75,d.actionState.windTurbineHubLength??1.5,p.x,p.y,0);c=m,d.elements.push(m);break}case z.Foundation:{const f=Qa.makeFoundation(l.x,l.y,d.actionState.foundationHeight,d.actionState.foundationColor,d.actionState.foundationTexture);c=f,d.elements.push(f);break}case z.Cuboid:{const f=Qa.makeCuboid(l.x,l.y,d.actionState.cuboidHeight,d.actionState.cuboidFaceColors,d.actionState.cuboidFaceTextures);c=f,d.elements.push(f);break}case z.Wall:{const f=a,p=ye.wallRelativePosition(new ue(l.x,l.y),f),m=Qa.makeWall(f,p.x,p.y,p.z,s);d.elements.push(m),d.selectedElement=m,c=m;break}case z.BatteryStorage:{const f=a,{x:p,y:m,z:y}=ye.relativeCoordinates(l.x,l.y,l.z,f,!0),w=Qa.makeBatteryStorage(f,p,m,y);d.elements.push(w),d.selectedElement=w,c=w;break}}c&&(d.selectedElementIdSet.clear(),d.selectedElementIdSet.add(c.id),d.selectedElement=c)}),c},elementsToPaste:[],deletedElements:[],clearDeletedElements(){i(a=>{a.deletedElements=[]})},pastePoint:new ue,pasteNormal:void 0,copyElementById(a){i(l=>{l.elementsToPaste=[];for(const s of l.elements)if(s.id===a){if(s.type===z.Polygon){const c=ye.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y,l.elementsToPaste.push(s)}else l.elementsToPaste.push(s);break}for(const s of l.elements)if(ye.isChild(a,s.id)){if(s.type===z.Polygon){const c=ye.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y}l.elementsToPaste.push(s)}})},removeSelectedElements(){const a=e().selectedElementIdSet;if(a.size===0)return[];const l=Array.from(a),s=new Set,c=new Set;for(const u of e().elements)if(a.has(u.id))s.add(u),c.add(u.id);else for(const d of l)ye.isChild(d,u.id)&&(s.add(u),c.add(u.id));return i(u=>{u.autoDeletedRoofs=[],u.deletedElements=Array.from(s),u.elements=u.elements.filter(d=>{var f,p;if(c.has(d.id)){switch(d.type){case z.Wall:{const m=d;let y="",w="";m.leftJoints.length>0&&(y=((f=u.getElementById(m.leftJoints[0]))==null?void 0:f.id)??""),m.rightJoints.length>0&&(w=((p=u.getElementById(m.rightJoints[0]))==null?void 0:p.id)??"");for(const x of u.elements)x.id===y?x.rightJoints=[]:x.id===w&&(x.leftJoints=[]);u.updateWallMapOnFoundationFlag=!u.updateWallMapOnFoundationFlag;break}case z.Roof:{u.deletedRoofIdSet.add(d.id),In.getState().deleteRoofSegmentVertices(d.id),In.getState().deleteRoofSegmentVerticesWithoutOverhang(d.id);break}}return!1}else return!0})}),Array.from(s)},removeElementById(a,l,s=!0,c){const u=e().elements.filter(d=>d.id===a||ye.isChild(a,d.id));return i(d=>{var f,p;for(const m of d.elements)if(m.id===a){if(l)if(m.type===z.Polygon){const y=ye.calculatePolygonCentroid(m.vertices);m.cx=y.x,m.cy=y.y,d.elementsToPaste=[m]}else d.elementsToPaste=[m];else c||(d.deletedElements=[m]);switch(m.selected=!1,m.type){case z.Roof:{const y=m;d.deletedRoofId=m.id,d.deletedRoofIdSet.add(m.id),In.getState().deleteRoofSegmentVertices(a),In.getState().deleteRoofSegmentVerticesWithoutOverhang(a),c&&(d.autoDeletedRoofs?d.autoDeletedRoofs.push(y):d.autoDeletedRoofs=[y],d.autoDeletedRoofIdSet.add(y.id));break}case z.Wall:{const y=m;let w="",x="";y.leftJoints.length>0&&(w=((f=d.getElementById(y.leftJoints[0]))==null?void 0:f.id)??""),y.rightJoints.length>0&&(x=((p=d.getElementById(y.rightJoints[0]))==null?void 0:p.id)??"");for(const C of d.elements)C.id===w?C.rightJoints=[]:C.id===x&&(C.leftJoints=[]);d.elements=d.elements.filter(C=>!(C.type===z.Roof&&C.wallsId.length===0)),d.updateWallMapOnFoundationFlag=!d.updateWallMapOnFoundationFlag,d.deletedWallId=m.id;break}case z.Foundation:{d.deletedFoundationId=m.id;break}case z.Cuboid:{d.deletedCuboidId=m.id;break}}break}if(c)for(const m of d.elements)ye.isChild(a,m.id)&&(d.autoDeletedChild?d.autoDeletedChild.push(m):d.autoDeletedChild=[m]);else if(l)for(const m of d.elements)ye.isChild(a,m.id)&&d.elementsToPaste.push(m);else for(const m of d.elements)ye.isChild(a,m.id)&&d.deletedElements.push(m);d.elements=d.elements.filter(m=>m.id===a||m.parentId===a||m.foundationId===a||ye.isChild(a,m.id)?(m.type===z.Roof&&(In.getState().deleteRoofSegmentVertices(a),In.getState().deleteRoofSegmentVerticesWithoutOverhang(a)),!1):!0),d.selectedElementIdSet.delete(a),s&&(d.selectedElement=null,d.selectedElementIdSet.clear())}),u},removeElementsByType(a){i(l=>{a===z.Foundation?l.elements=l.elements.filter(s=>s.locked||s.type!==z.Foundation&&!s.foundationId?!0:(s.type===z.Roof&&(In.getState().deleteRoofSegmentVertices(s.id),In.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1)):l.elements=l.elements.filter(s=>s.locked||s.type!==a?!0:(s.type===z.Roof&&(In.getState().deleteRoofSegmentVertices(s.id),In.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1))})},countElementsByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===a&&!c.locked&&s++;else for(const c of e().elements)c.type===a&&s++;return s},countSolarStructuresByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===z.Foundation&&!c.locked&&c.solarStructure===a&&s++;else for(const c of e().elements)c.type===z.Foundation&&c.solarStructure===a&&s++;return s},countObservers(){let a=0;for(const l of e().elements)l.type===z.Human&&l.observer&&a++;return a},removeElementsByReferenceId(a,l){i(s=>{if(l){s.deletedElements=[];for(const c of s.elements)c.referenceId===a&&s.deletedElements.push(c)}s.elements=s.elements.filter(c=>c.referenceId!==a)})},countElementsByReferenceId(a){let l=0;for(const s of e().elements)s.referenceId===a&&l++;return l},getChildren(a){const l=[];for(const s of e().elements)s.parentId===a&&l.push(s);return l},getChildrenOfType(a,l){const s=[];for(const c of e().elements)c.type===a&&c.parentId===l&&s.push(c);return s},removeAllChildElementsByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.parentId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},removeAllElementsOnFoundationByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.foundationId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},countAllElements(a){let l=0;if(a)for(const s of e().elements)s.locked||l++;else l=e().elements.length;return l},countAllElementsByType(a){const l=new wMe;for(const s of e().elements)if(s.locked?l.lockedCount++:l.unlockedCount++,!(a&&s.locked))switch(s.type){case z.Foundation:{s.solarStructure===Nn.UpdraftTower&&l.solarUpdraftTowerCount++,l.foundationCount++;break}case z.Cuboid:{l.cuboidCount++;break}case z.Wall:{l.wallCount++;break}case z.Window:{l.windowCount++;break}case z.Door:{l.doorCount++;break}case z.Human:{l.humanCount++;break}case z.Tree:{l.treeCount++;break}case z.Flower:{l.flowerCount++;break}case z.Polygon:{l.polygonCount++;break}case z.Sensor:{l.sensorCount++;break}case z.Light:{s.inside?l.insideLightCount++:l.outsideLightCount++;break}case z.SolarPanel:{l.solarPanelCount++;const c=s,u=e().getPvModule(c.pvModelName);u&&(l.solarPanelModuleCount+=ye.countSolarPanelsOnRack(c,u));break}case z.ParabolicDish:{l.parabolicDishCount++;break}case z.ParabolicTrough:{l.parabolicTroughCount++;break}case z.FresnelReflector:{l.fresnelReflectorCount++;break}case z.Heliostat:{l.heliostatCount++;break}case z.WindTurbine:{l.windTurbineCount++;break}}return l},countAllOffspringsByTypeAtOnce(a,l){const s=new wMe;for(const c of e().elements){const u=c.parentId===a||c.foundationId===a;if(u&&(c.locked?s.lockedCount++:s.unlockedCount++),(l||!c.locked)&&u)switch(c.type){case z.Foundation:{c.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTowerCount++,s.foundationCount++;break}case z.Cuboid:{s.cuboidCount++;break}case z.Wall:{s.wallCount++;break}case z.Window:{s.windowCount++,c.locked&&s.lockedWindowCount++;break}case z.Door:{s.doorCount++,c.locked&&s.lockedDoorCount++;break}case z.Human:{s.humanCount++;break}case z.Tree:{s.treeCount++;break}case z.Flower:{s.flowerCount++;break}case z.Polygon:{s.polygonCount++,c.locked&&s.lockedPolygonCount++;break}case z.Sensor:{s.sensorCount++,c.locked&&s.lockedSensorCount++;break}case z.Light:{c.inside?s.insideLightCount++:s.outsideLightCount++,c.locked&&s.lockedLightCount++;break}case z.SolarPanel:{s.solarPanelCount++,c.locked&&s.lockedSolarPanelCount++;const d=c,f=e().getPvModule(d.pvModelName);f&&(s.solarPanelModuleCount+=ye.countSolarPanelsOnRack(d,f));break}case z.ParabolicDish:{s.parabolicDishCount++;break}case z.ParabolicTrough:{s.parabolicTroughCount++;break}case z.FresnelReflector:{s.fresnelReflectorCount++;break}case z.Heliostat:{s.heliostatCount++;break}case z.WindTurbine:{s.windTurbineCount++,c.locked&&s.lockedWindTurbineCount++;break}}}return s},countSolarPanelsOnRack(a){let l=0;for(const s of e().elements)if(s.id===a&&s.type===z.SolarPanel){const c=s,u=e().getPvModule(c.pvModelName);if(u){l=ye.countSolarPanelsOnRack(c,u);break}}return l},copyCutElements(){const a=[],l=new Map,s=new Map,c=new Map;for(let u=0;um.id===d.parentId);if(p){const m=l.get(p.id);m&&(e().getElementById(d.id)?(f=Pl.clone(m,d,d.cx,d.cy,d.cz,d.type===z.Polygon),((f==null?void 0:f.type)===z.SolarPanel||(f==null?void 0:f.type)===z.SolarWaterHeater)&&(f.rotation=[...d.rotation],f.normal=[...d.normal])):f=JSON.parse(JSON.stringify(d)))}}f&&(l.set(d.id,f),s.set(d.id,f.id),c.set(f.id,d.id),a.push(f))}for(const u of a){if(u.type===z.Roof){const d=c.get(u.id);if(d)for(const f of e().elementsToPaste)f.id===d&&(u.wallsId=f.wallsId.map(p=>s.get(p)))}if(u.type===z.Wall){const d=c.get(u.id);if(d){for(const f of e().elementsToPaste)if(f.id===d&&f.type===z.Wall){const p=f,m=s.get(p.leftJoints[0]);m&&(u.leftJoints=[m]);const y=s.get(p.rightJoints[0]);if(y&&(u.rightJoints=[y]),p.roofId){const w=s.get(p.roofId);w&&(u.roofId=w)}break}}}}return a},pasteElementsToPoint(){const a=[];return i(l=>{if(l.elementsToPaste.length===1){let s=l.pastePoint;const c=l.elementsToPaste[0];let u=l.selectedElement;const d=l.getParent(c);if(u){if(u.type===z.Polygon){const p=l.getParent(u);p&&(u=p,c.parentId=u.id,ye.isPositionRelative(c.type)&&(s=ye.relativeCoordinates(s.x,s.y,s.z,u)))}else if(u.type===z.Roof){if(u.parentId){const p=l.getElementById(u.parentId);p&&(c.type===z.SolarPanel||c.type===z.SolarWaterHeater?s.sub(new ue(p.cx,p.cy,p.cz)).applyEuler(new cn(0,0,-p.rotation[2])):(s.sub(new ue(p.cx,p.cy,p.lz)).applyEuler(new cn(0,0,-p.rotation[2])),c.type!==z.Window&&(s.setX(s.x/p.lx),s.setY(s.y/p.ly))))}}else if(u.type===z.Cuboid){if(c.type===z.Cuboid){const{pos:p}=ye.getWorldDataById(u.id);s.sub(p)}else ye.isPositionRelative(c.type)&&(c.type===z.SolarPanel?s=ye.relativeCoordinates(s.x,s.y,s.z,u,!0):s=ye.relativeCoordinates(s.x,s.y,s.z,u));c.parentId=u.id}else u.type===z.Wall?s=ye.relativeCoordinates(s.x,s.y,s.z,u):d&&d.type&&c.type!==z.Foundation&&(c.parentId=u.id,ye.isPositionRelative(c.type)&&(c.type===z.SolarPanel||c.type===z.BatteryStorage?s=ye.relativeCoordinates(s.x,s.y,s.z,u,!0):s=ye.relativeCoordinates(s.x,s.y,s.z,u)));c.type===z.Wall&&s.set(s.x*u.lx,s.y*u.ly,0)}const f=Pl.clone(u,c,s.x,s.y,s.z,!1,l.pasteNormal,d);if(f){l.pasteNormal&&(u==null?void 0:u.type)===z.Cuboid&&(f.normal=l.pasteNormal.toArray(),f.rotation=Rn.getRotationFromNormal(l.pasteNormal));const p={lng:l.language};let m=!1;switch(f.type){case z.Cuboid:{const y=C=>{const P=[];for(const A of e().elements)if(A.parentId===C.id)switch(P.push(A),A.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:P.push(...y(A))}return P},w=y(c),x=new Map;a.push(f),x.set(c.id,f);for(const C of w){const P=x.get(C.parentId);if(P){const A=Pl.clone(P,C,C.cx,C.cy,C.cz,C.type===z.Polygon);A&&(f.normal&&(A.normal=[...C.normal]),a.push(A),x.set(C.id,A))}}l.elements.push(...a),l.elementsToPaste=[f],m=!1;break}case z.Foundation:{const y=new Map,w=new Map;for(const x of l.elements)if(x.parentId===c.id){const C=Pl.clone(f,x,x.cx,x.cy,x.cz,x.type===z.Polygon);if(C&&(f.normal&&(C.normal=[...x.normal]),a.push(C),(C==null?void 0:C.type)===z.Wall||(C==null?void 0:C.type)===z.Roof)){y.set(C.id,x.id),w.set(x.id,C.id);for(const P of l.elements)if(P.parentId===x.id){const A=Pl.clone(C,P,P.cx,P.cy,P.cz);A&&(x.normal&&(A.normal=[...P.normal]),a.push(A))}}}l.elements.push(...a),m=!0;for(const x of l.elements){if(x.type===z.Roof){const C=y.get(x.id);if(C){const P=e().getElementById(C);P&&(x.wallsId=P.wallsId.map(A=>w.get(A)))}}if(x.type===z.Wall){const C=y.get(x.id);if(C){for(const P of l.elements)if(P.id===C&&P.type===z.Wall){const A=P,S=w.get(A.leftJoints[0]);S&&(x.leftJoints=[S]);const v=w.get(A.rightJoints[0]);if(v&&(x.rightJoints=[v]),A.roofId){const b=w.get(A.roofId);b&&(x.roofId=b)}break}}}}break}case z.SolarPanel:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(ye.checkElementOnWallState(f,u)){case ya.Valid:{const y=u.relativeAngle-$t;f.normal=[Math.cos(y),Math.sin(y),0],m=!0;break}case ya.OverLap:co(B.t("message.CannotPasteBecauseOfOverlap",p));break;case ya.OutsideBoundary:co(B.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const y=l.getElementById(f.foundationId);if(y){const w=Rn.getSolarPanelVerticesOnRoof(f,y),x=Rn.getRoofBoundaryVertices(u);if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopElementCollisionCheck(f,y,w)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(B.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&ye.isIdentical(f.normal,fs))&&ye.isSolarCollector(f)?(m=ye.isSolarCollectorWithinHorizontalSurface(f,u),m||co(B.t("message.CannotPasteOutsideBoundary",p))):m=!0;break}case z.SolarWaterHeater:{if(u&&u.type===z.Roof){if(f.foundationId){const y=l.getElementById(f.foundationId);if(y){const w=Rn.getSolarWaterHeaterVerticesOnRoof(f,y),x=Rn.getRoofBoundaryVertices(u);if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopElementCollisionCheck(f,y,w)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0,l.updateElementOnRoofFlag=!0}}break}break}case z.Sensor:case z.Light:case z.WindTurbine:case z.ParabolicDish:case z.Heliostat:case z.FresnelReflector:case z.ParabolicTrough:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(ye.checkElementOnWallState(f,u)){case ya.Valid:{const y=u.relativeAngle-$t;f.normal=[Math.cos(y),Math.sin(y),0],m=!0;break}case ya.OverLap:co(B.t("message.CannotPasteBecauseOfOverlap",p));break;case ya.OutsideBoundary:co(B.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const y=l.getElementById(f.foundationId);if(y){const w=Rn.getSolarPanelVerticesOnRoof(f,y),x=Rn.getRoofBoundaryVertices(u);if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopElementCollisionCheck(f,y,w)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(B.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&ye.isIdentical(f.normal,fs))&&ye.isSolarCollector(f)?(m=ye.isSolarCollectorWithinHorizontalSurface(f,u),m||co(B.t("message.CannotPasteOutsideBoundary",p))):m=!0;break}case z.Wall:{const y=new ue(f.cx,f.cy,0),w=new ue(f.lx/2,0,0),x=new ue(-f.lx/2,0,0),C=f,P=new cn(0,0,C.relativeAngle);C.leftPoint=y.clone().add(x.applyEuler(P)).toArray(),C.rightPoint=y.clone().add(w.applyEuler(P)).toArray(),C.roofId=void 0,C.leftRoofHeight=void 0,C.rightRoofHeight=void 0,C.centerLeftRoofHeight=void 0,C.centerRightRoofHeight=void 0,C.centerRoofHeight=void 0;for(const A of l.elements)if(A.parentId===c.id){const S=Pl.clone(f,A,A.cx,A.cy,A.cz,A.type===z.Polygon);S&&(f.normal&&(S.normal=[...A.normal]),a.push(S))}l.elements.push(...a),l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,m=!0;break}case z.Door:case z.Window:{if((u==null?void 0:u.type)===z.Wall)switch(ye.checkElementOnWallState(f,u)){case ya.Valid:m=!0;break;case ya.OverLap:co(B.t("message.CannotPasteBecauseOfOverlap",p));break;case ya.OutsideBoundary:co(B.t("message.CannotPasteOutsideBoundary",p));break}else if((u==null?void 0:u.type)===z.Roof){const y=Rn.getRotationOnRoof(u.id,s);y&&(f.rotation=[...y]);const w=Rn.getWindowVerticesOnRoof(f),x=Rn.getRoofSegmentBoundary(u.id,s);if(!x)break;if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopWindowCollisionCheck(f.id,w,u.id)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0}break}default:if(m=!0,ye.isPlantOrHuman(f))if(u){const y=l.getParent(f);if(y){const w=ye.relativePoint(l.pastePoint,y);f.cx=w.x,f.cy=w.y,f.cz=w.z}}else f.parentId=rr}m&&(l.elements.push(f),a.push(f))}}else if(l.elementsToPaste.length>1){let s=l.pastePoint;const c=l.copyCutElements();if(c.length>0){if(c[0].type===z.Cuboid){const u=l.selectedElement;if(u&&u.type===z.Cuboid){const{pos:d}=ye.getWorldDataById(u.id);s.sub(d),c[0].parentId=u.id}}else if(c[0].type===z.Wall){const u=l.selectedElement;u&&u.type===z.Foundation&&(s=ye.relativeCoordinates(s.x,s.y,s.z,u),s.set(s.x*u.lx,s.y*u.ly,0),c[0].parentId=u.id,c[0].foundationId=u.id)}c[0].cx=s.x,c[0].cy=s.y,c[0].cz=s.z,c[0].type===z.Foundation?c[0].cz+=c[0].lz/2:c[0].type===z.Cuboid&&(c[0].cz=c[0].lz/2),l.elements.push(...c),a.push(...c)}}a.length>0&&(l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(a[0].id),l.selectedElement=a[0])}),a},pasteElementsByKey(){const a=[];return i(l=>{if(l.elementsToPaste.length>0){const s=l.elementsToPaste[0],c=l.getParent(s),u=Pl.clone(c,s,s.cx,s.cy,s.cz);if(u){let d=!1;switch(u.type){case z.Door:case z.Window:{if(c){const f=u.lx/2;if(u.cx+=f*3,c.type===z.Wall)for(;u.cx+f<.5;)if(ye.checkElementOnWallState(u,c)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx+=f;else if(c.type===z.Roof){const p=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));p&&(u.rotation=[...p]);let m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy));const w=Rn.getRoofBoundaryVertices(c);for(;Rn.rooftopElementBoundaryCheck(m,w);)if(y&&Rn.rooftopElementBoundaryCheck(m,y)&&Rn.rooftopWindowCollisionCheck(u.id,m,c.id)){l.elements.push(u),d=!0;break}else{u.cx+=f/2;const x=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));x&&(u.rotation=[...x]),m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy))}}if(!d){u.cx=s.cx-f*3;const p=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));if(p&&(u.rotation=[...p]),c.type===z.Wall){for(;u.cx-f>-.5;)if(c.type===z.Wall)if(ye.checkElementOnWallState(u,c)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx-=f}else if(c.type===z.Roof){let m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy));const w=Rn.getRoofBoundaryVertices(c);for(;Rn.rooftopElementBoundaryCheck(m,w);)if(y&&Rn.rooftopElementBoundaryCheck(m,y)&&Rn.rooftopWindowCollisionCheck(u.id,m,c.id)){l.elements.push(u),d=!0;break}else{u.cx-=f;const x=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));x&&(u.rotation=[...x]),m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy))}}}if(!d){const p={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",p))}c.type===z.Roof&&d&&(l.updateElementOnRoofFlag=!0)}break}case z.Human:{u.cx+=1,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.Tree:case z.Flower:{u.cx+=u.lx,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.SolarPanel:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const y=u.lx/f.lx/2;for(u.cx+=y*3;u.cx+y<.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx+=y;if(!d)for(u.cx=s.cx-y*3;u.cx-y>-.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=y;if(!d){const w={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",w))}break}else if(f.type===z.Roof){if(s.foundationId){const y=l.getElementById(s.foundationId);if(y){const w=Rn.getRoofBoundaryVertices(f),x=u.lx*1.25;for(u.cx+=x;u.cx+u.lx/2-y.lx/2;){const C=Rn.getSolarPanelVerticesOnRoof(u,y);if(Rn.rooftopElementBoundaryCheck(C,w)&&Rn.rooftopElementCollisionCheck(u,y,C)){l.elements.push(u),d=!0;break}else u.cx-=x}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",C))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation]);const p=l.findNearestSibling(s.id);if(p){const y=l.getElementById(p);if(y){const w=u.cx,x=u.cy,C=u.cz,P=y.cx-s.cx,A=y.cy-s.cy,S=y.cz-s.cz;u.cx=y.cx+P,u.cy=y.cy+A,u.cz=y.cz+S,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-A,u.cz=s.cz-S,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*A,u.cz=s.cz-2*S,l.overlapWithSibling(u)&&(u.cx=w-P,u.cy=x-A,u.cz=C-S)))}else u.cx+=1.25*u.lx}else u.cx+=1.25*u.lx;const m={lng:l.language};l.overlapWithSibling(u)?co(B.t("message.CannotPasteBecauseOfOverlap",m)):f.type===z.Foundation||f.type===z.Cuboid&&ye.isIdentical(u.normal,fs)?ye.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(B.t("message.CannotPasteOutsideBoundary",m)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.SolarWaterHeater:{if(u.parentId){const f=l.getParent(u);if(f)if(f.type===z.Roof){if(s.foundationId){const p=l.getElementById(s.foundationId);if(p){const m=Rn.getRoofBoundaryVertices(f),y=u.lx*1.25;for(u.cx+=y;u.cx+u.lx/2-p.lx/2;){const w=Rn.getSolarWaterHeaterVerticesOnRoof(u,p);if(Rn.rooftopElementBoundaryCheck(w,m)&&Rn.rooftopElementCollisionCheck(u,p,w)){l.elements.push(u),d=!0;break}else u.cx-=y}if(d)l.updateElementOnRoofFlag=!0;else{const w={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",w))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation])}break}case z.FresnelReflector:case z.Heliostat:case z.ParabolicDish:case z.ParabolicTrough:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const y=u.lx/f.lx/2;for(u.cx+=y*3;u.cx+y<.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx+=y;if(!d)for(u.cx=s.cx-y*3;u.cx-y>-.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=y;if(!d){const w={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",w))}break}else if(f.type===z.Roof){if(s.foundationId){const y=l.getElementById(s.foundationId);if(y){const w=Rn.getRoofBoundaryVertices(f),x=u.lx/y.lx/2;for(u.cx+=x*1.25;u.cx+x<.5;){const C=Rn.getSolarPanelVerticesOnRoof(u,y);if(Rn.rooftopElementBoundaryCheck(C,w)&&Rn.rooftopElementCollisionCheck(u,y,C)){l.elements.push(u),d=!0;break}else u.cx+=x*1.25}if(!d)for(u.cx=s.cx-x*1.25;u.cx-x>-.5;){const C=Rn.getSolarPanelVerticesOnRoof(u,y);if(Rn.rooftopElementBoundaryCheck(C,w)&&Rn.rooftopElementCollisionCheck(u,y,C)){l.elements.push(u),d=!0;break}else u.cx-=x*1.25}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",C))}}}break}const p=l.findNearestSibling(s.id);if(p){const y=l.getElementById(p);if(y){const w=u.cx,x=u.cy,C=u.cz,P=y.cx-s.cx,A=y.cy-s.cy,S=y.cz-s.cz;u.cx=y.cx+P,u.cy=y.cy+A,u.cz=y.cz+S,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-A,u.cz=s.cz-S,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*A,u.cz=s.cz-2*S,l.overlapWithSibling(u)&&(u.cx=w-P,u.cy=x-A,u.cz=C-S)))}else u.cx+=(.01+u.lx)/f.lx}else u.cx+=(.01+u.lx)/f.lx;const m={lng:l.language};l.overlapWithSibling(u)?co(B.t("message.CannotPasteBecauseOfOverlap",m)):f.type===z.Foundation||f.type===z.Cuboid&&ye.isIdentical(u.normal,fs)?ye.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(B.t("message.CannotPasteOutsideBoundary",m)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.Sensor:case z.Light:case z.WindTurbine:{if(u.parentId){const f=l.getParent(u);f&&(u.cx+=u.lx/f.lx),u.cx<.5&&(l.elements.push(u),l.elementsToPaste=[u],d=!0)}break}case z.Polygon:{const f=u;for(const p of f.vertices)p.x+=.1;f.cx+=.1,l.elements.push(f),l.elementsToPaste=[f],d=!0;break}case z.Cuboid:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=y=>{const w=[];for(const x of e().elements)if(x.parentId===y.id)switch(w.push(x),x.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:w.push(...f(x))}return w},p=f(s),m=new Map;a.push(u),m.set(s.id,u);for(const y of p){const w=m.get(y.parentId);if(w){const x=Pl.clone(w,y,y.cx,y.cy,y.cz,y.type===z.Polygon);x&&(u.normal&&(x.normal=[...y.normal]),a.push(x),m.set(y.id,x))}}l.elements.push(...a),l.elementsToPaste=[u],l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),l.elementsToPaste=[...f],a.push(...f),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!1;break}case z.Foundation:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=new Map,p=new Map;for(const m of l.elements)if(m.parentId===s.id&&m.parentId!==m.id){const y=Pl.clone(u,m,m.cx,m.cy,m.cz,m.type===z.Polygon);if(y&&(u.normal&&(y.normal=[...m.normal]),a.push(y),(y==null?void 0:y.type)===z.Wall||(y==null?void 0:y.type)===z.Roof)){f.set(y.id,m.id),p.set(m.id,y.id);for(const w of l.elements)if(w.parentId===m.id){const x=Pl.clone(y,w,w.cx,w.cy,w.cz);x&&(m.normal&&(x.normal=[...w.normal]),a.push(x))}}}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u];for(const m of l.elements){if(m.type===z.Roof){const y=f.get(m.id);if(y){const w=e().getElementById(y);w&&(m.wallsId=w.wallsId.map(x=>p.get(x)))}}if(m.type===z.Wall){const y=f.get(m.id);if(y){for(const w of l.elements)if(w.id===y&&w.type===z.Wall){const x=w,C=p.get(x.leftJoints[0]);C&&(m.leftJoints=[C]);const P=p.get(x.rightJoints[0]);if(P&&(m.rightJoints=[P]),x.roofId){const A=p.get(x.roofId);A&&(m.roofId=A)}break}}}}}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),a.push(...f),l.elementsToPaste=f,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!0;break}case z.Wall:{const f=u,p=new ue(1,-1,0).applyEuler(new cn(0,0,f.relativeAngle));if(u.cx+=p.x,u.cy+=p.y,l.elementsToPaste.length===1){const m=new ue(u.cx,u.cy,0),y=new ue(u.lx/2,0,0),w=new ue(-u.lx/2,0,0),x=new cn(0,0,f.relativeAngle);f.leftPoint=m.clone().add(w.applyEuler(x)).toArray(),f.rightPoint=m.clone().add(y.applyEuler(x)).toArray(),f.roofId=void 0,f.leftRoofHeight=void 0,f.rightRoofHeight=void 0,f.centerLeftRoofHeight=void 0,f.centerRightRoofHeight=void 0,f.centerRoofHeight=void 0;for(const C of l.elements)if(C.parentId===s.id){const P=Pl.clone(u,C,C.cx,C.cy,C.cz,C.type===z.Polygon);P&&(u.normal&&(P.normal=[...C.normal]),a.push(P))}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u]}else if(l.elementsToPaste.length>1){const m=l.copyCutElements();m.length>0&&(m[0].cx+=p.x,m[0].cy-=p.y,l.elements.push(...m),a.push(...m),l.elementsToPaste=m,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(m[0].id),l.selectedElement=m[0])}l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,d=!0;break}case z.BatteryStorage:u.cx+=u.lx*1.25,l.elements.push(u),l.elementsToPaste=[u],d=!0}l.elementsToPaste.length===1&&d&&(a.push(u),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u)}}}),a},supportedPvModules:{},customPvModules:{},loadSupportedPvModules(){const a=[];CY.parse(u9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c={name:s[0].trim(),brand:s[1].trim(),cellType:s[2].trim(),efficiency:parseFloat(s[3].trim()),length:parseFloat(s[4].trim()),nominalLength:parseFloat(s[5].trim()),width:parseFloat(s[6].trim()),nominalWidth:parseFloat(s[7].trim()),thickness:parseFloat(s[8].trim()),m:parseFloat(s[9].trim()),n:parseFloat(s[10].trim()),pmax:parseFloat(s[11].trim()),vmpp:parseFloat(s[12].trim()),impp:parseFloat(s[13].trim()),voc:parseFloat(s[14].trim()),isc:parseFloat(s[15].trim()),pmaxTC:parseFloat(s[16].trim()),noct:parseFloat(s[17].trim()),weight:parseFloat(s[18].trim()),color:s[19].trim(),shadeTolerance:s[20].trim(),bifacialityFactor:parseFloat(s[21].trim())};a.push(c)}console.log(a.length+" PV models loaded"),i(s=>{for(const c of a)s.supportedPvModules[c.name]=c})}})},getPvModule(a){let l=e().supportedPvModules[a];return l||(l=e().customPvModules[a]),l},addCustomPvModule(a){i(l=>{l.customPvModules[a.name]=a})},weatherModel:void 0,setWeatherModel(a){i(l=>{l.weatherModel=l.weatherData[a]})},weatherData:{},loadWeatherData(){if(Object.keys(e().weatherData).length>0)return;const a=[];CY.parse(l9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[],u=[],d=[];for(let p=5;p<29;p++)(p-5)%2===0?c.push(parseFloat(s[p].trim())):u.push(parseFloat(s[p].trim()));for(let p=29;p<41;p++)d.push(parseFloat(s[p].trim()));const f={city:s[0].trim(),country:s[1].trim(),longitude:parseFloat(s[2].trim()),latitude:parseFloat(s[3].trim()),elevation:parseFloat(s[4].trim()),lowestTemperatures:c,highestTemperatures:u,sunshineHours:d};a.push(f)}i(s=>{for(const c of a)s.weatherData[c.city+", "+c.country]=c;s.weatherModel=s.weatherData["Boston MA, USA"]}),console.log(a.length+" weather datasets loaded")}})},getWeather(a){const l=e().weatherModel;return l||e().weatherData[a]},horizontalSolarRadiationData:{},loadHorizontalSolarRadiationData(){const a=[];CY.parse(s9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.horizontalSolarRadiationData[c.city+", "+c.country]=c})}})},getHorizontalSolarRadiation(a){return e().horizontalSolarRadiationData[a]},verticalSolarRadiationData:{},loadVerticalSolarRadiationData(){const a=[];CY.parse(c9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.verticalSolarRadiationData[c.city+", "+c.country]=c})}})},getVerticalSolarRadiation(a){return e().verticalSolarRadiationData[a]},getClosestCity(a,l){let s=Number.MAX_VALUE,c=null,u;const d=e().weatherData;for(const f in d)Object.hasOwn(d,f)&&(u=ye.getDistance(l,a,d[f].longitude,d[f].latitude),u{l.sunlightDirection=a.clone()})},cameraDirection:new ue,getCameraDirection(){return e().cameraDirection},updateSceneRadiusFlag:!1,updateSceneRadius(){i(a=>{a.updateSceneRadiusFlag=!a.updateSceneRadiusFlag})},sceneRadius:100,setSceneRadius(a){i(l=>{l.sceneRadius=a})},selectedElementAngle:0,selectedElementHeight:0,selectedElementX:0,selectedElementY:0,isAddingElement(){return!!(e().addedCuboidId||e().addedFoundationId||e().addedWallId||e().addedWindowId||e().addedDoorId)},addedFoundationId:null,deletedFoundationId:null,addedCuboidId:null,deletedCuboidId:null,addedWallId:null,deletedWallId:null,updateWallMapOnFoundationFlag:!1,updateWallMapOnFoundation(){i(a=>{a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},updateElementOnRoofFlag:!1,setUpdateElementOnRoofFlag(a){i(l=>{l.updateElementOnRoofFlag=a})},updateElementOnRoofFn(){i(a=>{a.updateElementOnRoofFlag=!0})},addedWindowId:null,addedDoorId:null,addedRoofIdSet:new Set,deletedRoofId:null,deletedRoofIdSet:new Set,autoDeletedRoofs:null,autoDeletedRoofIdSet:new Set,autoDeletedChild:null,getAutoDeletedElements(){const a=e().autoDeletedRoofs,l=e().autoDeletedChild;return!a||!l?null:[...a,...l]},deleteAddedRoofId(a){i(l=>{l.addedRoofIdSet.delete(a)})},groupActionMode:!1,setGroupActionMode(a){i(l=>{l.groupActionMode=a})},groupActionUpdateFlag:!1,locale:Yye,localFileDialogRequested:!1,loggable:!1,actionInfo:void 0,logAction(a){i(l=>{l.actionInfo={name:a,timestamp:new Date().getTime()}})},currentUndoable:void 0,showCloudFileTitleDialog:!1,showCloudFileTitleDialogFlag:!1,localContentToImportAfterCloudFileUpdate:void 0,enableFineGrid:!1,setEnableFineGrid(a){i(l=>{l.enableFineGrid=a})}}},{name:"aladdin-storage",storage:aVe(()=>new URLSearchParams(window.location.search).get("viewonly")==="true"?sessionStorage:localStorage),skipHydration:ye.isOpenFromURL(),partialize:t=>({language:t.language,animate24Hours:t.animate24Hours,floatingWindowOpacity:t.floatingWindowOpacity,selectedFloatingWindow:t.selectedFloatingWindow,locale:t.locale,cloudFile:t.cloudFile,latestModelSite:t.latestModelSite,modelSites:t.modelSites,allModelSites:t.allModelSites,modelsMapLatitude:t.modelsMapLatitude,modelsMapLongitude:t.modelsMapLongitude,modelsMapAddress:t.modelsMapAddress,modelsMapZoom:t.modelsMapZoom,modelsMapType:t.modelsMapType,modelsMapTilt:t.modelsMapTilt,showModelsAllTime:t.showModelsAllTime,showModelsFromDate:t.showModelsFromDate,showModelsToDate:t.showModelsToDate,world:t.world,elements:t.elements,viewState:t.viewState,graphState:t.graphState,actionState:t.actionState,modelType:t.modelType,modelAuthor:t.modelAuthor,modelLabel:t.modelLabel,modelDescription:t.modelDescription,canvasPercentWidth:t.canvasPercentWidth,projectView:t.projectView,projectState:t.projectState,designProjectType:t.designProjectType,notes:t.notes,user:t.user,sceneRadius:t.sceneRadius,weatherModel:t.weatherModel,solarPanelArrayLayoutParams:t.solarPanelArrayLayoutParams,solarPanelArrayLayoutConstraints:t.solarPanelArrayLayoutConstraints,economicsParams:t.economicsParams,evolutionMethod:t.evolutionMethod,evolutionaryAlgorithmState:t.evolutionaryAlgorithmState,geneticAlgorithmWizardSelectedTab:t.geneticAlgorithmWizardSelectedTab,particleSwarmOptimizationWizardSelectedTab:t.particleSwarmOptimizationWizardSelectedTab,minimumNavigationMoveSpeed:t.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:t.minimumNavigationTurnSpeed,customPvModules:t.customPvModules})})));class Phn extends xe.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,n){}clearCacheAndReload(){localStorage.clear(),window.location.reload()}render(){return this.state.hasError?h.jsxs("div",{style:{marginTop:10,marginLeft:20},children:[h.jsx("h1",{children:"Error"}),h.jsx("p",{children:"Something went wrong. Please click the following button to clear the cache and reload the page."}),h.jsx("p",{children:h.jsx("button",{onClick:this.clearCacheAndReload,children:"Refresh"})})]}):this.props.children}}const Chn=t=>{const e=typeof t=="function",n=g.useRef(t);g.useEffect(()=>{n.current=t}),g.useEffect(()=>{if(e){const o=r=>{const i=n.current(r);if(typeof i=="string")return r.preventDefault(),r.returnValue=i;if(r.defaultPrevented)return r.returnValue=""};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}}},[e])},Rhn=({children:t=null,onBeforeunload:e})=>(Chn(e),t),Hhn="/aladdin/assets/daysky-xGPh_lTa.jpg",Mhn="/aladdin/assets/desert-C1g8PGRA.jpg",Ihn="/aladdin/assets/dune-BTLjQ9Lc.jpg",zhn="/aladdin/assets/forest-4yWLHFWh.jpg",Dhn="/aladdin/assets/grassland-CDTfZBr_.jpg",TMe="/aladdin/assets/hill-spring-BepVmTLf.jpg",PMe="/aladdin/assets/hill-summer-RoU04vrD.jpg",CMe="/aladdin/assets/hill-fall-BPbpF4zI.jpg",RMe="/aladdin/assets/hill-winter-CQjb4ZNm.jpg",Ehn="/aladdin/assets/lake-Dj_bK41O.jpg",khn="/aladdin/assets/mountain-Du_Jo4ue.jpg",Fhn="/aladdin/assets/rural-BqG-D3I1.jpg",Lhn=xe.memo(({theme:t="Default"})=>{const e=H(pn),n=H(qN),o=H(HS),r=H(s5e),i=H(v5e),a=H(RS),l=H(Jn),s=H(Z3),c=H(d5e),u=H(Cm),d=H(tu),f=H(ml),p=H(Fn),m=H(Q3),y=H(uXe),{scene:w,camera:x,gl:{domElement:C}}=ti(),P=g.useRef(null),A=g.useRef(null),S=g.useRef(null),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new ue),R=g.useRef(new ue),M=g.useRef(new ue(1,1,1)),D=g.useRef(0),k=g.useRef(0),N=g.useRef(new Map),U=g.useRef(new Map),W=g.useRef(new Map),F=g.useRef(new Map),E=g.useRef(null),L=Kt(),j=g.useMemo(()=>new yu,[]),Y=g.useMemo(()=>new cn,[]),_=new Date(f).getMonth()+1,[G,Q]=g.useState(dh.Sky),oe=g.useMemo(()=>new ue,[]),ee=g.useMemo(()=>new cn,[]);if(A.current&&u){G!==dh.Vertical&&Q(dh.Vertical);const se=i(A.current,u),ge=r(),we=-Math.atan2(ge.x,ge.y);oe.set(se.x,se.y,0),ee.set(-$t,0,we,"ZXY")}const q=g.useMemo(()=>{switch(t){case qs.Desert:return .5;case qs.Dune:return .25;case qs.Forest:return .25;case qs.Grassland:return .15;case qs.Hill:return .3;case qs.Lake:return .1;case qs.Mountain:return .4;case qs.Rural:return .25;default:return .2}},[t]),ae=g.useMemo(()=>{switch(t){case qs.Desert:return Mhn;case qs.Dune:return Ihn;case qs.Forest:return zhn;case qs.Grassland:return Dhn;case qs.Hill:return d>0?_>=12||_<=3?RMe:_>3&&_<=5?TMe:_>5&&_<=9?PMe:CMe:_>=12||_<=3?PMe:_>3&&_<=5?CMe:_>5&&_<=9?RMe:TMe;case qs.Lake:return Ehn;case qs.Mountain:return khn;case qs.Rural:return Fhn;default:return Hhn}},[t,_,d]),Z=Up(ae),ne=se=>se===z.Foundation||se===z.Cuboid||se===z.Tree||se===z.Flower||se===z.Human,te=se=>{if(se.intersections.length>0)if(se.intersections[0].object===P.current)n(),e(we=>{we.clickObjectType=z.Sky});else{const we=o();we&&ne(we.type)&&(A.current=we,ye.isPlantOrHuman(A.current)&&(Q(dh.Vertical),ee.set(-$t,0,0,"ZXY")),we.type!==z.Foundation&&we.type!==z.Cuboid&&jn.getState().setEnableOrbitController(!1))}},$=se=>{if(!se)return"";const ge=se.name.split(" ");return ge[2]?ge[2]:$(se.parent)},le=(se,ge)=>{if(se==null)return null;for(const we of se.children)if(we.name.includes(`${ge}`))return we;return null},de=(se,ge)=>{var Ce,Te;const we=jn.getState().contentRef,Se=le(we==null?void 0:we.current,se.id);if(Se){for(const Re of Se.children)if(Re.name.includes(`${ge.id}`)){(Te=(Ce=jn.getState().contentRef)==null?void 0:Ce.current)==null||Te.add(Re);break}}ge.parentId=rr;const Me=new ue(ge.cx,ge.cy,ge.cz).applyEuler(new cn(0,0,se.rotation[2])).add(T.current);ge.cx=Me.x,ge.cy=Me.y,ge.cz=0,W.current.set(ge.id,new ue(Me.x,Me.y,0)),F.current.set(ge.id,rr)},he=(se,ge,we)=>{if(!se||!ge)return;const Se=jn.getState().contentRef;if(Se!=null&&Se.current){const Me=ye.getObjectChildById(Se.current,ge),Ce=ye.getObjectChildById(ge===rr?Se.current:Me,we);if(Ce){if(se===rr)Se.current.add(Ce);else{const Te=ye.getObjectChildById(Se.current,se);Te==null||Te.add(Ce)}Ip()}}},me=(se,ge)=>{se&&e(we=>{for(const Se of we.elements)if(Se.id===ge&&!ye.isFoundationOrCuboid(Se)){Se.parentId=se;break}})},ce=se=>{for(const ge of se)if(ge.object.userData.stand)return ge;return null},Pe=(se,ge)=>{if(se&&se.current){const we=ce(ge.intersections);if(we){const Se=we.object,Me=se.current.parent;if(Se.name==="Ground"){if(Me&&Me.name!=="Content"){const Ce=jn.getState().contentRef;Ce&&Ce.current&&(Ce.current.add(se.current),me(rr,$(se.current)))}se.current.position.copy(we.point),Ip()}else if(Se.userData.stand){const Ce=Se.parent;if(Ce){Me&&Me.uuid!==Ce.uuid&&(Ce.add(se.current),me($(Ce),$(se.current))),Y.set(0,0,-Ce.rotation.z);const Te=new ue().subVectors(we.point,Ce.position).applyEuler(Y);se.current.position.copy(Te),Ip()}}}}},pe=(se,ge,we)=>{e(Se=>{for(const Me of Se.elements)if(Me.id===se){ye.isFoundationOrCuboid(Me)||(Me.parentId=ge),Me.cx=we.x,Me.cy=we.y,Me.cz=we.z;break}})},Ie=()=>{if(H.getState().viewState.orthographic)return!1;if(P.current){const se=j.intersectObjects(ye.fetchIntersectables(w),!1);if(se.length>0){for(const ge of se)if(ge.object.userData.stand)return!1}}return j.intersectObjects([P.current]).length>0},ve=se=>{if(A.current&&A.current.type&&!A.current.locked){const ge=new _t;ge.x=se.offsetX/C.clientWidth*2-1,ge.y=-(se.offsetY/C.clientHeight)*2+1,j.setFromCamera(ge,x);let we;if(S.current&&G===dh.Vertical&&(we=j.intersectObjects([S.current]),we&&we.length>0)){const Se=we[0].point;switch(A.current.type){case z.Tree:{const Me=A.current;switch(u){case xt.Top:c(Me.id,Se.z),e(Ce=>{Ce.selectedElementHeight=Math.max(1,Se.z)});break;case xt.Left:case xt.Right:case xt.Upper:case xt.Lower:s(Me.id,2*Math.hypot(Se.x-Me.cx,Se.y-Me.cy));break}Pe(jn.getState().treeRef,se);break}case z.Human:{Pe(jn.getState().humanRef,se);break}case z.Cuboid:{if(ye.isTopResizeHandle(u)){e(Ce=>{var Te;for(const Re of Ce.elements)if(Re.id===((Te=A.current)==null?void 0:Te.id)){Re.cz=Math.max(.5,Se.z/2),Re.lz=Math.max(1,Se.z);break}Ce.selectedElementHeight=Math.max(1,Se.z)});const Me=jn.getState().cuboidRef;if(Me!=null&&Me.current){for(const Ce of Me.current.children)if(Ce.name.includes("Human")||Ce.name.includes("Tree")){const Te=v.current.get($(Ce));Te&&(Math.abs(k.current-Te.z)<.01?Ce.position.setZ(Math.max(Se.z/2,.5)):Ce.position.setZ(Te.z-Me.current.position.z))}}}break}}}}},ze=se=>{if(se.button===2)return;e(we=>{we.contextMenuObjectType=null}),te(se);const ge=A.current;if(ge)switch(k.current=ge.lz,T.current.set(ge.cx,ge.cy,ge.cz),ge.type){case z.Human:E.current=ge.parentId;break;case z.Tree:E.current=ge.parentId,D.current=ge.lx;break;case z.Cuboid:{T.current.set(ge.cx,ge.cy,ge.cz),M.current.set(ge.lx,ge.ly,ge.lz),v.current.clear();const we=new ue(ge.cx,ge.cy,ge.cz),Se=a(ge.id);if(Se.length>0){N.current.clear();const Me=ge.rotation[2];for(const Ce of Se)switch(Ce.type){case z.Tree:case z.Human:{const Te=new ue(Ce.cx,Ce.cy,Ce.cz).applyEuler(new cn(0,0,Me));Te.add(we),v.current.set(Ce.id,Te),N.current.set(Ce.id,new ue(Ce.cx,Ce.cy,Ce.cz));break}case z.SolarPanel:case z.Sensor:{if(ye.isIdentical(Ce.normal,fs)){const Te=new ue(Ce.cx*ge.lx,Ce.cy*ge.ly,Ce.cz*ge.lz).applyEuler(new cn(0,0,Me));Te.add(we),v.current.set(Ce.id,Te)}break}case z.Polygon:{if(ye.isIdentical(Ce.normal,fs)){const Te=Ce,Re=[];for(const Ne of Te.vertices){const _e=new _t(Ne.x*ge.lx,Ne.y*ge.ly).rotateAround(ui,Me);_e.add(new _t(we.x,we.y)),Re.push(_e)}b.current.set(Te.id,Re)}break}}}break}}},Ae=()=>{var se,ge;if(A.current){const we=l(A.current.id);if(we&&!we.locked){let Se=null,Me=E.current;switch(we.type){case z.Cuboid:switch(u){case xt.UpperLeftTop:case xt.UpperRightTop:case xt.LowerLeftTop:case xt.LowerRightTop:{U.current.clear(),e(Re=>{Re.actionState.cuboidHeight=we.lz;for(const Ne of Re.elements)if(ye.isPlantOrHuman(Ne)&&Ne.parentId===we.id)if(U.current.set(Ne.id,we.id),Math.abs(M.current.z/2-Ne.cz)<.01)Ne.cz=we.lz/2;else{const _e=Ne.cz+T.current.z-we.cz;Math.abs(_e)>we.lz/2?de(we,Ne):Ne.cz=_e}});const Ce=a(we.id);if(Ce.length>0)for(const Re of Ce)W.current.set(Re.id,new ue(Re.cx,Re.cy,Re.cz));const Te={name:"Change Cuboid Height",timestamp:Date.now(),changedElementId:we.id,changedElementType:we.type,oldValue:k.current,newValue:we.lz,oldChildrenPositionsMap:new Map(N.current),newChildrenPositionsMap:new Map(W.current),oldChildrenParentIdMap:new Map(U.current),newChildrenParentIdMap:new Map(F.current),undo:()=>{var Re,Ne;if(e(_e=>{for(const Ue of _e.elements)if(Ue.id===Te.changedElementId){Ue.lz=Te.oldValue,Ue.cz=Te.oldValue/2;break}}),Te.oldChildrenPositionsMap&&Te.oldChildrenPositionsMap.size>0)for(const[_e,Ue]of Te.oldChildrenPositionsMap.entries()){const qe=l(_e);if((qe==null?void 0:qe.type)!==z.Polygon){m(_e,Ue.x,Ue.y,Ue.z);const Fe=(Re=Te.oldChildrenParentIdMap)==null?void 0:Re.get(_e),He=(Ne=Te.newChildrenParentIdMap)==null?void 0:Ne.get(_e);Fe&&He&&Fe!==He&&(he(Fe,He,_e),me(Fe,_e))}}},redo:()=>{var Re,Ne;if(e(_e=>{for(const Ue of _e.elements)if(Ue.id===Te.changedElementId){Ue.lz=Te.newValue,Ue.cz=Te.newValue/2;break}}),Te.newChildrenPositionsMap&&Te.newChildrenPositionsMap.size>0)for(const[_e,Ue]of Te.newChildrenPositionsMap.entries()){m(_e,Ue.x,Ue.y,Ue.z);const qe=(Re=Te.oldChildrenParentIdMap)==null?void 0:Re.get(_e),Fe=(Ne=Te.newChildrenParentIdMap)==null?void 0:Ne.get(_e);qe&&Fe&&qe!==Fe&&(he(Fe,qe,_e),me(Fe,_e))}}};p(Te);break}}break;case z.Tree:switch(u){case xt.Top:{const Ce={name:"Change Tree Height",timestamp:Date.now(),changedElementId:we.id,changedElementType:we.type,oldValue:k.current,newValue:we.lz,undo:()=>{c(Ce.changedElementId,Ce.oldValue)},redo:()=>{c(Ce.changedElementId,Ce.newValue)}};p(Ce),e(Te=>{Te.actionState.treeHeight=we.lz});break}case xt.Left:case xt.Right:case xt.Lower:case xt.Upper:{const Ce={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:we.id,changedElementType:we.type,oldValue:D.current,newValue:we.lx,undo:()=>{s(Ce.changedElementId,Ce.oldValue)},redo:()=>{s(Ce.changedElementId,Ce.newValue)}};p(Ce),e(Te=>{Te.actionState.treeSpread=we.lx});break}}Se=(se=jn.getState().treeRef)==null?void 0:se.current;break;case z.Human:Se=(ge=jn.getState().humanRef)==null?void 0:ge.current;break}if(Se){const Ce=j.intersectObjects(ye.fetchIntersectables(w),!1),Te=ce(Ce);if(Te){const Re=Te.point;if(Te.object.name==="Ground")pe(we.id,rr,Re),R.current.set(Re.x,Re.y,Re.z),Me=rr;else if(Te.object.userData.stand){const Ne=$(Te.object),_e=Te.object.parent;if(_e){const Ue=new ue().subVectors(Re,_e.position).applyEuler(Y);pe(we.id,Ne,Ue),R.current.set(Ue.x,Ue.y,Ue.z),Me=Ne}}}}if(H.getState().moveHandleType&&ye.isPlantOrHuman(we)&&(R.current.distanceToSquared(T.current)>Ht||j.intersectObjects([P.current]).length>0)){let Ce=!0;if(!H.getState().viewState.orthographic&&(Ce=R.current.length().02}if(!Ce||Ie()){m(we.id,T.current.x,T.current.y,T.current.z),Se&&ye.isPlantOrHuman(we)&&Se.position.copy(T.current),ye.isPlantOrHuman(we)&&me(E.current,we.id);const Te=jn.getState().contentRef;if(Te!=null&&Te.current&&E.current&&Se){if(E.current===rr)Te.current.add(Se);else{const Re=ye.getObjectChildById(Te.current,E.current);Re==null||Re.add(Se)}Ip()}co(B.t("message.CannotMoveObjectTooFar",L))}else{const Te={name:"Move",timestamp:Date.now(),movedElementId:we.id,movedElementType:we.type,oldCx:T.current.x,oldCy:T.current.y,oldCz:T.current.z,newCx:R.current.x,newCy:R.current.y,newCz:R.current.z,oldParentId:E.current,newParentId:Me,undo:()=>{m(Te.movedElementId,Te.oldCx,Te.oldCy,Te.oldCz),me(Te.oldParentId,Te.movedElementId),he(Te.oldParentId,Te.newParentId,Te.movedElementId)},redo:()=>{m(Te.movedElementId,Te.newCx,Te.newCy,Te.newCz),me(Te.newParentId,Te.movedElementId),he(Te.newParentId,Te.oldParentId,Te.movedElementId)}};p(Te),y()}}}A.current=null,Q(dh.Sky),e(Se=>{Se.moveHandleType=null,Se.resizeHandleType=null,Se.rotateHandleType=null}),jn.setState({humanRef:null,treeRef:null}),jn.getState().setEnableOrbitController(!0)}};return h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{ref:P,name:"Sky",rotation:[$t,0,0],scale:[1,q,1],onContextMenu:se=>{se.intersections.length>0&&se.intersections[0].object===P.current&&(n(),e(we=>{we.clickObjectType=z.Sky,we.contextMenuObjectType=z.Sky}))},onPointerDown:ze,children:[h.jsx("sphereGeometry",{args:[zvt,16,8,0,fa,0,$t]}),h.jsx("meshToonMaterial",{map:Z,side:js,opacity:1,color:"skyblue"})]}),A.current&&G!==dh.Sky&&h.jsx(yi,{ref:S,visible:!1,name:"Sky Intersection Plane",rotation:ee,position:oe,args:[1e3,1e3],onPointerMove:A3.throttle(ve,hL),onPointerUp:Ae,children:h.jsx("meshStandardMaterial",{side:zr})})]})}),Whn=xe.memo(({lineWidth:t=1,endPoint:e=1e3,showTickMarks:n=!0,showTickLabels:o=!0})=>{const r=H(sPt),i=H(Ky),a=H(M0),[l,s]=g.useState(!1),c=50,u=g.useRef(1),d=g.useRef(u.current*10),f=g.useRef(new Array(c).fill(1)),p=.1,m=.3,y="FloralWhite",w=t/2,x=B5(NM,gI),C=Math.min(1,Math.max(.5,i*.01)),P={font:x,height:0,size:C},A=a?r.max.z+.01:0;g.useEffect(()=>{i<50?u.current=1:i<100?u.current=2:u.current=5,d.current=10*u.current,f.current=new Array(c).fill(1),s(!l)},[i]);const S=v=>v%(5*u.current)===0?m:p;return h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},name:"x axis line",points:[[-e,0,A],[e,0,A]],color:"red",lineWidth:t}),a&&n&&f.current.map((v,b)=>{const T=(b+1)*u.current,R=S(T);return h.jsxs(xe.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[T,-R,A],[T,R,A]],color:y,lineWidth:w}),h.jsx(On,{userData:{unintersectable:!0},points:[[-T,-R,A],[-T,R,A]],color:y,lineWidth:w})]},T)}),a&&o&&f.current.map((v,b)=>{const T=(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[T-C,-.3*2-C,A],children:[h.jsx("textGeometry",{args:[(T<10?" ":"")+T,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),a&&o&&f.current.map((v,b)=>{const T=-(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[T-C,-.3*2-C,A],children:[h.jsx("textGeometry",{args:[(T>-10?" ":"")+T,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),h.jsx(On,{name:"y axis line",userData:{unintersectable:!0},points:[[0,-e,A],[0,e,A]],color:"blue",lineWidth:t}),a&&n&&f.current.map((v,b)=>{const T=(b+1)*u.current,R=S(T);return h.jsxs(xe.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[-R,T,A],[R,T,A]],color:y,lineWidth:w*1.5}),h.jsx(On,{userData:{unintersectable:!0},points:[[-R,-T,A],[R,-T,A]],color:y,lineWidth:w*1.5})]},T)}),a&&o&&f.current.map((v,b)=>{const T=(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-.3*2-C*2,T-C/2,A],children:[h.jsx("textGeometry",{args:[T+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),a&&o&&f.current.map((v,b)=>{const T=-(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-.3*2-C*2,T-C/2,A],children:[h.jsx("textGeometry",{args:[T+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),!a&&h.jsx(On,{userData:{unintersectable:!0},name:"z axis line",points:[[0,0,0],[0,0,e]],color:"green",lineWidth:t})]})}),Nhn=xe.memo(t=>{var G;const{id:e,cx:n,cy:o,cz:r,name:i=Vt.Jack,locked:a=!1,flip:l=!1,observer:s=!1,parentId:c}=t;let u=!1;H(Q=>{if(c===rr)u=!0;else for(const oe of Q.elements)if(oe.id===c){u=!0;break}});const d=H(Jp);g.useEffect(()=>{u||d(e,!1)},[u,e]);const f=H(pn),p=H(M0)??!1,m=H(z0),y=H(FS),w=H($y),x=dt(vs),C=Fc(e),{gl:P}=ti(),[A,S]=g.useState(!1),v=jn(Q=>Q.contentRef),b=g.useRef(null),T=g.useRef(null),R=Kt(),M=g.useRef(!1),D=H(OM);D!==M.current&&(M.current=D,v!=null&&v.current&&b.current&&v.current.add(b.current)),g.useEffect(()=>{if(c!==rr){const Q=E();Q&&b.current&&Q.add(b.current)}},[D,c]);const k=Up(hh.fetchTextureImage(i)),N=g.useMemo(()=>{const Q=k.clone();return l?(Q.wrapS=es,Q.repeat.x=-1,Q.needsUpdate=!0):Q.repeat.x=1,Q},[k,l]),U=g.useMemo(()=>hh.fetchWidth(i),[i]),W=g.useMemo(()=>hh.fetchHeight(i),[i]),F=g.useMemo(()=>hh.fetchLabel(i,R)+(a?" ("+B.t("shared.ElementLocked",R)+")":"")+` -`+B.t("word.Coordinates",R)+": ("+n.toFixed(1)+", "+o.toFixed(1)+") "+B.t("word.MeterAbbreviation",R),[i,a,n,o,R]);g.useEffect(()=>{const Q=E();Q&&b.current&&Q.add(b.current)},[v]);const E=()=>c!==rr&&(v!=null&&v.current)?ye.getObjectChildById(v.current,c):null;Gp(({camera:Q})=>{if(b.current){const{rot:oe}=ye.getWorldDataById(c);if(p)b.current.rotation.set($t,Math.PI-oe,0);else{const{x:ee,y:q}=Q.position,{x:ae,y:Z}=b.current.localToWorld(new ue);b.current.rotation.set(0,0,-Math.atan2(ee-ae,q-Z)-oe)}}});const L=g.useCallback((Q,oe)=>{dt.getState().duringCameraInteraction||Q.intersections.length>0&&(Q.intersections[0].object===Q.eventObject||Q.intersections.length>1&&Q.intersections[1].object===Q.eventObject)&&(f(q=>{q.hoveredHandle=oe,q.selectedElementHeight=t.lz}),ye.isMoveHandle(oe)?P.domElement.style.cursor="move":P.domElement.style.cursor="pointer")},[t.lz]),j=g.useCallback(()=>{f(Q=>{Q.hoveredHandle=null}),P.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),Y=s?hh.fetchGender(t.name):Fa.Male,O=s?(t.flip?-1:1)*hh.fetchHatOffsetX(t.name):0,_=s?hh.fetchHatOffsetY(t.name):0;return u?h.jsx("group",{ref:b,name:"Human Group "+e,userData:{aabb:!0},position:[n,o,r??0],children:h.jsxs("group",{position:[0,.1,W/2],children:[h.jsx(MR,{rotation:[$t,0,0],uuid:e,name:i,follow:!1,children:h.jsx(yi,{ref:T,renderOrder:3,receiveShadow:!x,name:`Human ${i} plane`,args:[U,W],onContextMenu:Q=>{m(e,Q,er.ContextMenu),f(oe=>{Q.intersections.length>0&&Q.intersections[0].object===T.current&&(oe.contextMenuObjectType=z.Human)})},onPointerDown:Q=>{Q.button!==2&&Q.eventObject===Q.intersections[0].eventObject&&(m(e,Q,er.Move),jn.setState({humanRef:b}))},onPointerOver:Q=>{Q.intersections.length>0&&Q.intersections[0].object===T.current&&S(!0)},onPointerOut:()=>{S(!1)},children:h.jsx("meshToonMaterial",{map:N,alphaTest:.5,side:zr})})}),C&&a&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-U/2,0,-W/2],[-U/2,0,W/2],[-U/2,0,W/2],[U/2,0,W/2],[U/2,0,-W/2],[U/2,0,W/2],[U/2,0,-W/2],[-U/2,0,-W/2]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(G=T.current)==null?void 0:G.rotation,color:i0}),s&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{uuid:e,visible:!1,userData:{eyeball:!0},name:i+" eyeball",args:[U/5,4,4,0,fa,0,fa],position:[0,0,t.lz/2],children:h.jsx("meshBasicMaterial",{attach:"material",side:zr})}),h.jsx(wa,{name:"Observer hat 1",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.1,.1,.1,16,2],position:[O,0,t.lz/2-.05+_],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:Y===Fa.Male?"gray":"hotpink"})}),h.jsx(wa,{name:"Observer hat 2",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.2,.2,.01,16,2],position:[O,0,t.lz/2-.1+_],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:Y===Fa.Male?"gray":"hotpink"})})]}),C&&!a&&h.jsx(Ys,{position:[0,0,-W/2],args:[Tm*4,6,6,0,Math.PI],name:Ho.Default,onPointerDown:Q=>{Q.button!==2&&Q.eventObject===Q.intersections[0].eventObject&&(m(e,Q,er.Move),jn.setState({humanRef:b}))},onPointerEnter:Q=>{L(Q,Ho.Default)},onPointerLeave:j,children:h.jsx("meshBasicMaterial",{attach:"material",color:w===Ho.Default||y===Ho.Default?Aa:q8})}),A&&!C&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:F,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,W/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null}),Uhn=xe.memo(t=>{var ge;const{parentId:e,id:n,cx:o,cy:r,cz:i,lx:a,lz:l,name:s=yr.Pine,flip:c=!1,locked:u=!1,showModel:d=!1,showLabel:f=!1}=t;let p=!1;H(we=>{if(e===rr)p=!0;else for(const Se of we.elements)if(Se.id===e){p=!0;break}});const m=H(Jp);g.useEffect(()=>{p||m(n,!1)},[p]);const y=H(pn),w=H(M0)??!1,x=H(ml),C=H(tu),P=H(K2e)??tQ,A=H($2e)??nQ,S=H(xs),v=H(z0),b=H(FS),T=H(Cm),R=H($y),M=Fc(n),[D,k]=g.useState(!1),{gl:N}=ti(),U=jn(we=>we.contentRef),W=g.useRef(null),F=g.useRef(null),E=g.useRef(null),L=g.useRef(null),j=g.useRef(null),Y=g.useRef(null),O=g.useRef(null),_=g.useRef(null),G=g.useRef(null),Q=g.useRef(null),oe=Kt(),ee=g.useMemo(()=>ye.dayOfYear(new Date(x)),[x]),q=g.useMemo(()=>!Sv.isEvergreen(t?t.name:yr.Dogwood)&&(C>0?eeA:ee>=P&&ee<=A),[ee,P,A,C,t==null?void 0:t.name]),ae=g.useRef(!1),Z=H(OM);Z!==ae.current&&(ae.current=Z,U!=null&&U.current&&W.current&&U.current.add(W.current)),g.useEffect(()=>{if(e!==rr){const we=Ae();we&&W.current&&we.add(W.current)}},[Z]),g.useEffect(()=>{const we=Ae();we&&W.current&&we.add(W.current)},[U]);const ne=Up(Sv.fetchTextureImage(s,ee,C,P,A)),te=g.useMemo(()=>{const we=ne.clone();return c?(we.wrapS=es,we.repeat.x=-1,we.needsUpdate=!0):we.repeat.x=1,we},[ne,c]),$=g.useMemo(()=>(t!=null&&t.label?t.label:Sv.fetchLabel(s,oe))+(u?" ("+B.t("shared.ElementLocked",oe)+")":"")+(t!=null&&t.label?"":` -`+B.t("word.Coordinates",oe)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+B.t("word.MeterAbbreviation",oe)),[t==null?void 0:t.label,s,o,r,u,oe]),le=g.useMemo(()=>Sv.fetchTheta(s),[s]),de=a/2,he=l/2,me=g.useMemo(()=>new ue(0,0,he),[he]),ce=g.useMemo(()=>new ue(-de,0,0),[de]),Pe=g.useMemo(()=>new ue(de,0,0),[de]),pe=g.useMemo(()=>new ue(0,-de,0),[de]),Ie=g.useMemo(()=>new ue(0,de,0),[de]),ve=g.useCallback((we,Se)=>{dt.getState().duringCameraInteraction||we.intersections.length>0&&(we.intersections[0].object===we.eventObject||we.intersections.length>1&&we.intersections[1].object===we.eventObject)&&(y(Ce=>{Ce.hoveredHandle=Se,Ce.selectedElementHeight=t.lz}),ye.isMoveHandle(Se)?N.domElement.style.cursor="move":N.domElement.style.cursor="pointer")},[t==null?void 0:t.lz]),ze=g.useCallback(()=>{y(we=>{we.hoveredHandle=null}),N.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),Ae=()=>e!==rr&&(U!=null&&U.current)?ye.getObjectChildById(U.current,e):null;Gp(({camera:we})=>{if(F.current&&W.current&&E.current&&j.current){const{rot:Se}=ye.getWorldDataById(e),{x:Me,y:Ce}=we.position,{x:Te,y:Re}=W.current.position,{x:Ne,y:_e}=H.getState().sunlightDirection;if(Ae()){const qe=W.current.localToWorld(new ue),Fe=Math.atan2(Me-qe.x,Ce-qe.y)+Se;F.current.rotation.set($t,-Fe,0),j.current.rotation.set(-$t,Fe,0),E.current.rotation.set($t,-Math.atan2(Ne,_e)-Se,0)}else{const qe=Math.atan2(Me-Te,Ce-Re);F.current.rotation.set($t,-qe,0),j.current.rotation.set(-$t,qe,0),E.current.rotation.set($t,-Math.atan2(Ne,_e),0)}}});const se=Tm*3;return h.jsx(h.Fragment,{children:p?h.jsx("group",{ref:W,name:"Tree Group "+n,userData:{aabb:!0},position:[o,r,i??0],children:h.jsxs("group",{position:[0,0,l/2],children:[h.jsx(MR,{ref:F,uuid:n,name:s,follow:!1,children:h.jsx(yi,{args:[a,l],children:h.jsx("meshToonMaterial",{map:te,side:zr,alphaTest:.5})})}),h.jsx(MR,{ref:E,name:s+" Shadow Billboard",follow:!1,children:h.jsx(yi,{args:[a,l],castShadow:S,children:h.jsx("meshBasicMaterial",{map:te,side:zr,alphaTest:.5,opacity:0})})}),Sv.isConic(s)?h.jsx(Rf,{visible:d||w,name:s+" Model",userData:{simulation:!0},position:[0,0,s===yr.Spruce?0:l*.06],args:[a/2,l,8,8,!0],scale:[1,1,1],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:zr,transparent:!0,opacity:.75})}):h.jsx(Ys,{visible:d||w,userData:{simulation:!q},name:s+" Model",args:[a/2,8,8,0,fa,0,le],scale:[1,l/a,1],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:zr,transparent:!0,opacity:.75})}),h.jsx(MR,{ref:j,name:"Interaction Billboard",visible:!1,position:[0,0,-l/2+.5],children:h.jsx(yi,{ref:L,renderOrder:3,name:s+" plane",args:[a/2,l/3],rotation:[w?$t:0,0,0],onContextMenu:we=>{v(n,we,er.ContextMenu),y(Se=>{we.intersections.length>0&&we.intersections[0].object===L.current&&(Se.contextMenuObjectType=z.Tree)})},onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(v(n,we,er.Move),jn.setState({treeRef:W}))},onPointerOver:we=>{we.intersections.length>0&&we.intersections[0].object===L.current&&k(!0)},onPointerOut:()=>{k(!1)}})}),M&&u&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-a/2,-l/2,0],[-a/2,l/2,0],[-a/2,l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[-a/2,-l/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(ge=F.current)==null?void 0:ge.rotation,color:i0}),M&&!u&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{position:new ue(0,0,-l/2),args:[se,6,6,0,Math.PI],name:Ho.Default,renderOrder:2,onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(v(n,we,er.Move),jn.setState({treeRef:W}))},onPointerEnter:we=>{ve(we,Ho.Default)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Ho.Default||b===Ho.Default?Aa:q8})}),!w&&h.jsxs(h.Fragment,{children:[h.jsx(di,{ref:Y,name:xt.Top,args:[se,se,se],position:me,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Top)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Top||T===xt.Top?Aa:ll})}),h.jsx(di,{ref:O,name:xt.Left,args:[se,se,se],position:ce,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Left)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Left||T===xt.Left?Aa:ll})}),h.jsx(di,{ref:_,name:xt.Right,args:[se,se,se],position:Pe,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Right)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Right||T===xt.Right?Aa:ll})}),h.jsx(di,{ref:G,name:xt.Lower,args:[se,se,se],position:pe,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Lower)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Lower||T===xt.Lower?Aa:ll})}),h.jsx(di,{ref:Q,name:xt.Upper,args:[se,se,se],position:Ie,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Upper)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Upper||T===xt.Upper?Aa:ll})})]})]}),(D||f)&&!M&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:$,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});function zrt(t){const e=t+"Geometry";return g.forwardRef(({args:n,children:o,...r},i)=>h.jsxs("mesh",{ref:i,...r,children:[h.jsx(e,{attach:"geometry",args:n}),o]}))}const HMe=zrt("ParabolicCylinder"),MMe=zrt("Paraboloid"),jhn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,absorberTubeRadius:c=.05,latusRectum:u=2,tiltAngle:d,relativeAzimuth:f,moduleLength:p,poleHeight:m,poleRadius:y,drawSunBeam:w,rotation:x=[0,0,0],color:C="white",lineColor:P="black",lineWidth:A=.5,showLabel:S=!1,locked:v=!1,parentId:b}=t,T=H(pn),R=H(ml),M=H(tu),D=H(Qn),k=dt(vs),N=H(Df),U=In(O1),W=H(xs),F=H(Jn),E=H(z0),L=H(Ky),j=H(Cm),Y=H(I7),O=Up(Uot),_=Up(jot),G=Fc(e),{gl:{domElement:Q}}=ti(),[oe,ee]=g.useState(!1),[q,ae]=g.useState(null),[Z,ne]=g.useState(1),[te,$]=g.useState(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(null),ce=g.useRef(null),Pe=g.useRef(null),pe=g.useRef(null),Ie=g.useRef(!1),ve=g.useRef(null),ze=Math.max(100,10*L),Ae=16,se=Y.z<=0,ge=Kt();let we=n,Se=o,Me=r;const Ce=i/2,Te=a/2,Re=l/2,Ne=m+Ce,_e=H(at=>{for(const Et of at.elements)if(Et.id===b)return Et});if(b&&_e)switch(_e.type){case z.Foundation:if(Me=Ne+Re+_e.lz,ye.isZero(x[2]))we=_e.cx+n*_e.lx,Se=_e.cy+o*_e.ly;else{const at=new ue(n*_e.lx,o*_e.ly,0);at.applyAxisAngle(Oo,x[2]),we=_e.cx+at.x,Se=_e.cy+at.y}break}const Ue=Ce*Ce/u,qe=.25*u,Fe=new ue(-Ce,-Te,Re+Ue),He=new ue(-Ce,Te,Re+Ue),Le=new ue(Ce,-Te,Re+Ue),Ye=new ue(Ce,Te,Re+Ue);g.useEffect(()=>{if(t&&k){const at=U(t.id);at&&$(ye.fetchHeatmapTexture(at,N??5))}},[k,N]),g.useEffect(()=>{ne(Math.max(1,Math.round(a/p)))},[a,p]),g.useEffect(()=>{const at=()=>{jn.getState().setEnableOrbitController(!0),Ie.current=!1};return window.addEventListener("pointerup",at),()=>{window.removeEventListener("pointerup",at)}},[]);const lt=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.ParabolicTroughElement",ge))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",ge)+")":"")+(t!=null&&t.label?"":` -`+B.t("word.Coordinates",ge)+": ("+we.toFixed(1)+", "+Se.toFixed(1)+", "+Me.toFixed(1)+") "+B.t("word.MeterAbbreviation",ge)),[t==null?void 0:t.label,t==null?void 0:t.locked,we,Se,Me,ge]),Oe=g.useMemo(()=>new cn(0,0,x[2],"ZXY"),[x]),ut=(at,Et)=>{at.intersections.length>0&&at.intersections[0].object===at.eventObject&&(ae(Et),Et===Ho.Top?Q.style.cursor="move":Et===ai.Lower||Et===ai.Upper||Et===ai.Tilt?Q.style.cursor="grab":Q.style.cursor="pointer")},ht=()=>{ae(null),Q.style.cursor="default"},Qe=g.useMemo(()=>zi(new Date(R),M),[R,M]),nt=g.useMemo(()=>{var at;return(at=F(b))==null?void 0:at.rotation[2]},[b]),mt=nt?Qe.clone().applyAxisAngle(Oo,-nt):Qe,tt=g.useMemo(()=>Qe.z>0?new cn(0,Math.atan2(mt.x,mt.z),0,"ZXY"):new cn(d,0,f,"ZXY"),[Qe,d,f,mt.x,mt.z]),gt=g.useMemo(()=>{if(Qe.z>0){const at=nt?Math.cos(nt):1,Et=nt?Math.sin(nt):0;return-qe*(Qe.x*Et+Qe.y*at)/Math.hypot(Qe.x,Qe.z)}return 0},[Qe,nt,qe]),Ve=new ue(0,gt,qe).applyEuler(tt),je=Qe.clone().multiplyScalar(ze).applyEuler(new cn(-Oe.x,0,-Oe.z)),et=-(Ne+l)/2,bt=g.useMemo(()=>{const at=[],Et=Math.cos(f)*p,Lt=Math.sin(f)*p,Je=Z/2-.5;for(let st=0;st{const at=[],Et=a/Z,Lt=-i/u,Je=-2*Lt/Ae;for(let st=0;st<=Z;st++){const It=[];for(let ot=0;ot<=Ae;ot++){const it=Lt+ot*Je;It.push(new ue(u*it/2,-Te+st*Et,u*it*it/4))}at.push({points:It})}return at},[i,a,Z,u]),Pt=Math.max(1,(i+a)/16),Yt=$8*Pt*1.5,zt=Tm*Pt*2,Rt=D.length<50&&St.length<10,Ct=Rt?4:2,yt=c*6;return Gp(({camera:at})=>{if(!ve.current||!_e)return;const Et=ve.current.localToWorld(new ue(0,0,0)),Lt=new ue().subVectors(at.position,Et).applyEuler(new cn(0,0,-(_e==null?void 0:_e.rotation[2])-f)),Je=Math.atan2(Lt.z,Lt.x);ve.current.rotation.y=-Math.PI/2-Je}),h.jsxs("group",{name:"Parabolic Trough Group "+e,rotation:Oe,position:[we,Se,Me+Re],children:[h.jsxs("group",{rotation:tt,children:[h.jsx(HMe,{receiveShadow:W,castShadow:W,uuid:e,ref:le,args:[u/2,i,a,Ae,4],name:"Parabolic Trough Front Side",onPointerDown:at=>{at.button!==2&&E(e,at,er.Select)},onContextMenu:at=>{E(e,at,er.ContextMenu),T(Et=>{at.intersections.length>0&&at.intersections[0].object===le.current&&(Et.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:at=>{at.intersections.length>0&&at.intersections[0].object===le.current&&(ee(!0),Q.style.cursor="move")},onPointerOut:()=>{ee(!1),Q.style.cursor="default"},children:k&&te?h.jsx("meshBasicMaterial",{attach:"material",side:$i,map:te}):h.jsx("meshPhongMaterial",{attach:"material",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"})}),h.jsx(HMe,{receiveShadow:W,castShadow:W,uuid:e+" backside",ref:de,args:[u/2,i,a,Ae,4],name:"Parabolic Trough Back Side",position:[0,0,-Re/2],onPointerDown:at=>{at.button!==2&&E(e,at,er.Select)},onContextMenu:at=>{E(e,at,er.ContextMenu),T(Et=>{at.intersections.length>0&&at.intersections[0].object===de.current&&(Et.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:at=>{at.intersections.length>0&&at.intersections[0].object===de.current&&(ee(!0),Q.style.cursor="move")},onPointerOut:()=>{ee(!1),Q.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:js,color:"white"})}),St&&St.map((at,Et)=>h.jsxs(xe.Fragment,{children:[Rt&&h.jsx(On,{name:"Parabolic Trough Rim Lines",userData:{unintersectable:!0},points:at.points,castShadow:!1,receiveShadow:!1,lineWidth:A,color:P}),(Et===0||Et===St.length-1||Rt)&&h.jsx(On,{name:"Parabolic Trough Focal Lines",userData:{unintersectable:!0},points:[at.points[Ae/2].clone(),at.points[Ae/2].clone().add(new ue(0,0,qe))],castShadow:!1,receiveShadow:!1,lineWidth:A,color:se?"dimgray":"white"})]},Et)),Rt&&h.jsx(On,{name:"Parabolic Trough Outline 1",userData:{unintersectable:!0},points:[[-Ce,-Te,Ue],[-Ce,Te,Ue]],castShadow:!1,receiveShadow:!1,lineWidth:A,color:P}),Rt&&h.jsx(On,{name:"Parabolic Trough Outline 2",userData:{unintersectable:!0},points:[[Ce,-Te,Ue],[Ce,Te,Ue]],castShadow:!1,receiveShadow:!1,lineWidth:A,color:P}),h.jsx(wa,{name:"Parabolic Trough Absorber Tube",uuid:e,args:[c,c,a,Rt?6:2,1],position:[0,0,qe],receiveShadow:!1,castShadow:!0,children:se?h.jsx("meshStandardMaterial",{color:"white"}):h.jsx("meshBasicMaterial",{color:[1,1,1],toneMapped:!1})}),Qe.z>0&&h.jsxs("group",{ref:ve,position:[0,0,qe],children:[h.jsx(yi,{args:[yt,a],children:h.jsx("meshBasicMaterial",{side:zr,map:O,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],rotation:[0,0,Math.PI],position:[yt/4,yt/4+a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],rotation:[0,0,-Math.PI/2],position:[-yt/4,yt/4+a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],rotation:[0,0,Math.PI/2],position:[yt/4,-yt/4-a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],position:[-yt/4,-yt/4-a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})})]}),h.jsx(yi,{name:"Parabolic Trough Simulation Plane",uuid:e,args:[i,a],position:[0,0,Ue],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),G&&v&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-Ce,-Te,Ue],[-Ce,Te,Ue],[Ce,Te,Ue],[Ce,-Te,Ue],[-Ce,-Te,Ue]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),G&&!v&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:he,position:new ue(0,0,0),args:[zt,6,6],name:Ho.Default,onPointerOver:at=>{ut(at,Ho.Top)},onPointerOut:()=>{ht()},onPointerDown:at=>{at.button!==2&&E(e,at,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(di,{ref:me,position:[(Fe.x+Le.x)/2,Fe.y,Fe.z-Ue],args:[Yt,Yt,l*1.2],name:xt.Lower,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=me.current.localToWorld(new ue(0,a,-Fe.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Lower)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===xt.Lower||j===xt.Lower?Aa:ll})}),h.jsx(di,{ref:ce,position:[(He.x+Ye.x)/2,He.y,He.z-Ue],args:[Yt,Yt,l*1.2],name:xt.Upper,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=ce.current.localToWorld(new ue(0,-a,-He.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Upper)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===xt.Upper||j===xt.Upper?Aa:ll})}),h.jsx(di,{ref:Pe,position:[Fe.x,(Fe.y+He.y)/2,Fe.z],args:[Yt,Yt,l*1.2],name:xt.Left,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=Pe.current.localToWorld(new ue(i,0,-Fe.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Left)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===xt.Left||j===xt.Left?Aa:ll})}),h.jsx(di,{ref:pe,position:[Le.x,(Le.y+Ye.y)/2,Le.z],args:[Yt,Yt,l*1.2],name:xt.Right,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=pe.current.localToWorld(new ue(-i,0,-Le.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Right)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===xt.Right||j===xt.Right?Aa:ll})})]})]})]}),Ne>0&&bt.map((at,Et)=>Et%5!==0&&!Rt?h.jsx(xe.Fragment,{},Et):h.jsx(wa,{userData:{unintersectable:!0},name:"Pole "+Et,castShadow:!1,receiveShadow:!1,args:[y,y,Ne+(at.z-et)*2+l,Ct,1],position:at,rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:C})},Et)),w&&Qe.z>0&&h.jsx(On,{userData:{unintersectable:!0},points:[Ve,new ue(-.3*Ce,0,.09*Ue).applyEuler(tt),je,new ue(-.6*Ce,0,.36*Ue).applyEuler(tt),Ve,new ue(-.9*Ce,0,.81*Ue).applyEuler(tt),je,new ue(0,0,0),Ve,new ue(.3*Ce,0,.09*Ue).applyEuler(tt),je,new ue(.6*Ce,0,.36*Ue).applyEuler(tt),Ve,new ue(.9*Ce,0,.81*Ue).applyEuler(tt),je],name:"Sun Beams",lineWidth:.25,color:"white"}),(oe||S)&&!G&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:lt,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(Te*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),Bhn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,structureType:c=pf.CentralPole,receiverRadius:u=.25,receiverPoleRadius:d=.1,latusRectum:f=2,tiltAngle:p,relativeAzimuth:m,poleHeight:y,poleRadius:w=.2,drawSunBeam:x,rotation:C=[0,0,0],color:P="white",lineColor:A="black",lineWidth:S=.25,showLabel:v=!1,locked:b=!1,parentId:T}=t,R=H(pn),M=H(ml),D=H(tu),k=H(Qn),N=dt(vs),U=H(Df),W=In(O1),F=H(xs),E=H(Jn),L=H(z0),j=H(Ky),Y=H(Cm),O=H(I7),_=Fc(e),{gl:{domElement:G}}=ti(),[Q,oe]=g.useState(!1),[ee,q]=g.useState(null),[ae,Z]=g.useState(null),ne=g.useRef(null),te=g.useRef(null),$=g.useRef(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(null),ce=g.useRef(!1),Pe=Math.max(100,10*j),pe=32,Ie=8,ve=O.z<=0;let ze=n,Ae=o,se=r;const ge=i/2,we=a/2,Se=l/2,Me=y+ge,Ce=Kt(),Te=H(Rt=>{for(const Ct of Rt.elements)if(Ct.id===T)return Ct});if(T&&Te)switch(Te.type){case z.Foundation:if(se=Me+Se+Te.lz,ye.isZero(C[2]))ze=Te.cx+n*Te.lx,Ae=Te.cy+o*Te.ly;else{const Rt=new ue(n*Te.lx,o*Te.ly,0);Rt.applyAxisAngle(Oo,C[2]),ze=Te.cx+Rt.x,Ae=Te.cy+Rt.y}break}const Re=ge*ge/f,Ne=.25*f,_e=new ue(-ge,-we,Se+Re),Ue=new ue(-ge,we,Se+Re),qe=new ue(ge,-we,Se+Re),Fe=new ue(ge,we,Se+Re),He=Up(O3e),Le=u+1;g.useEffect(()=>{if(t&&N){const Rt=W(t.id);Rt&&Z(ye.fetchHeatmapTexture(Rt,U??5))}},[N,U]),g.useEffect(()=>{const Rt=()=>{jn.getState().setEnableOrbitController(!0),ce.current=!1};return window.addEventListener("pointerup",Rt),()=>{window.removeEventListener("pointerup",Rt)}},[]);const Ye=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.ParabolicDishElement",Ce))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",Ce)+")":"")+(t!=null&&t.label?"":` -`+B.t("word.Coordinates",Ce)+": ("+ze.toFixed(1)+", "+Ae.toFixed(1)+", "+se.toFixed(1)+") "+B.t("word.MeterAbbreviation",Ce)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ce,ze,Ae,se]),lt=g.useMemo(()=>new cn(0,0,C[2],"ZXY"),[C]),Oe=(Rt,Ct)=>{Rt.intersections.length>0&&Rt.intersections[0].object===Rt.eventObject&&(q(Ct),Ct===Ho.Top?G.style.cursor="move":Ct===ai.Lower||Ct===ai.Upper||Ct===ai.Tilt?G.style.cursor="grab":G.style.cursor="pointer")},ut=()=>{q(null),G.style.cursor="default"},ht=g.useMemo(()=>zi(new Date(M),D),[M,D]),Qe=g.useMemo(()=>{var Rt;return(Rt=E(T))==null?void 0:Rt.rotation[2]},[T]),nt=Qe?ht.clone().applyAxisAngle(Oo,-Qe):ht,mt=g.useMemo(()=>{if(ht.z>0){const Rt=Math.hypot(nt.x,nt.y);return new cn(Math.atan2(Rt,nt.z),0,Math.atan2(nt.y,nt.x)+$t,"ZXY")}return new cn(p,0,m,"ZXY")},[ht,p,m,nt.x,nt.y,nt.z]),tt=-(Me+l)/2,gt=k.length<50,Ve=g.useMemo(()=>{const Rt=[];if(gt){const Ct=[],yt=[];let at,Et,Lt;const Je=.25*Re;for(let st=0;st<=pe;st++)at=fa*st/pe,Et=Math.cos(at),Lt=Math.sin(at),Ct.push(new ue(ge*Et,ge*Lt,Re)),yt.push(new ue(ge*Et/2,ge*Lt/2,Je));Rt.push({points:Ct}),Rt.push({points:yt});for(let st=0;st<12;st++){at=fa*st/12,Et=Math.cos(at),Lt=Math.sin(at);const It=[];for(let ot=0;ot<=Ie;ot++){const it=ot===0?0:ot/Ie*ge;It.push(new ue(it*Et,it*Lt,it*it/f+.01))}Rt.push({points:It})}}return Rt},[ge,f,gt]),je=g.useMemo(()=>{if(c===pf.CentralPoleWithTripod){const Rt=[];let Ct;for(let yt=0;yt<3;yt++){Ct=fa*yt/3;const at=[];at.push(new ue(ge*Math.cos(Ct),ge*Math.sin(Ct),Re)),at.push(new ue(0,0,Ne)),Rt.push({points:at})}return Rt}},[ge,f,c]),et=g.useMemo(()=>{if(c===pf.Quadrupod){const Rt=[];let Ct;for(let yt=0;yt<4;yt++){Ct=fa*yt/4;const at=[];at.push(new ue(ge*Math.cos(Ct),ge*Math.sin(Ct),Re)),at.push(new ue(0,0,Ne)),Rt.push({points:at})}return Rt}},[ge,f,c]),bt=Math.max(1,(i+a)/16),St=$8*bt*1.5,Pt=Tm*bt*3,Yt=ht.clone().multiplyScalar(Pe),zt=new ue(0,0,Ne).applyEuler(mt);return h.jsxs("group",{name:"Parabolic Dish Group "+e,rotation:lt,position:[ze,Ae,se+Se],children:[h.jsxs("group",{rotation:mt,children:[h.jsx(MMe,{receiveShadow:F,castShadow:F,uuid:e,ref:ne,args:[f/2,ge,pe,Ie],name:"Parabolic Dish Front Side",onPointerDown:Rt=>{Rt.button!==2&&L(e,Rt,er.Select)},onContextMenu:Rt=>{L(e,Rt,er.ContextMenu),R(Ct=>{Rt.intersections.length>0&&Rt.intersections[0].object===ne.current&&(Ct.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:Rt=>{Rt.intersections.length>0&&Rt.intersections[0].object===ne.current&&(oe(!0),G.style.cursor="move")},onPointerOut:()=>{oe(!1),G.style.cursor="default"},children:N&&ae?h.jsx("meshBasicMaterial",{attach:"material",side:$i,map:ae}):h.jsx("meshPhongMaterial",{attach:"material",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"})}),h.jsx(MMe,{receiveShadow:F,castShadow:F,uuid:e+" backside",ref:te,args:[f/2,ge,pe,Ie],name:"Parabolic Dish Back Side",position:[0,0,-Se/4],onPointerDown:Rt=>{Rt.button!==2&&L(e,Rt,er.Select)},onContextMenu:Rt=>{L(e,Rt,er.ContextMenu),R(Ct=>{Rt.intersections.length>0&&Rt.intersections[0].object===te.current&&(Ct.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:Rt=>{Rt.intersections.length>0&&Rt.intersections[0].object===te.current&&(oe(!0),G.style.cursor="move")},onPointerOut:()=>{oe(!1),G.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:js,color:P})}),Ve&&Ve.length>0&&Ve.map((Rt,Ct)=>h.jsx(xe.Fragment,{children:h.jsx(On,{name:"Parabolic Dish Wireframe",userData:{unintersectable:!0},points:Rt.points,castShadow:!1,receiveShadow:!1,lineWidth:S,color:A})},Ct)),h.jsx(wa,{name:"Parabolic Dish Receiver",uuid:e,args:[u,u,.5,gt?12:4,1],rotation:[$t,0,0],position:[0,0,Ne-.1],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),ht.z>0&&h.jsx("mesh",{position:[0,0,Ne-.1],children:h.jsx("sprite",{scale:[Le,Le,Le],children:h.jsx("spriteMaterial",{map:He,transparent:!1,color:16777215,blending:Th,depthWrite:!1})})}),(c===pf.CentralPole||c===pf.CentralPoleWithTripod)&&h.jsx(wa,{name:"Parabolic Dish Receiver Pole",uuid:e,args:[d,d,Ne,gt?6:2,1],rotation:[$t,0,0],position:[0,0,Ne/2],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),c===pf.CentralPoleWithTripod&&je&&je.map((Rt,Ct)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{name:"Parabolic Dish Tripod Lines",userData:{unintersectable:!0},points:Rt.points,castShadow:!1,receiveShadow:!1,lineWidth:1,color:ve?"dimgray":P}),h.jsx(Ys,{position:new ue(Rt.points[0].x,Rt.points[0].y,Rt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Tripod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Ct)),c===pf.Quadrupod&&et&&et.map((Rt,Ct)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{name:"Parabolic Dish Quadrupod Lines",userData:{unintersectable:!0},points:Rt.points,castShadow:!1,receiveShadow:!1,lineWidth:2,color:ve?"dimgray":P}),h.jsx(Ys,{position:new ue(Rt.points[0].x,Rt.points[0].y,Rt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Quadrupod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Ct)),h.jsx(fH,{name:"Parabolic Dish Simulation Circle",uuid:e,args:[i/2,pe],position:[0,0,Re],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),_&&b&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ge,-we,Re],[-ge,we,Re],[ge,we,Re],[ge,-we,Re],[-ge,-we,Re]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),_&&!b&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:$,position:new ue(0,0,0),args:[Pt,6,6],name:Ho.Default,onPointerOver:Rt=>{Oe(Rt,Ho.Top)},onPointerOut:()=>{ut()},onPointerDown:Rt=>{Rt.button!==2&&L(e,Rt,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(di,{ref:le,position:[(_e.x+qe.x)/2,_e.y,_e.z],args:[St,St,l*1.2],name:xt.Lower,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=le.current.localToWorld(new ue(0,a,-_e.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Lower)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Lower||Y===xt.Lower?Aa:ll})}),h.jsx(di,{ref:de,position:[(Ue.x+Fe.x)/2,Ue.y,Ue.z],args:[St,St,l*1.2],name:xt.Upper,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=de.current.localToWorld(new ue(0,-a,-Ue.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Upper)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Upper||Y===xt.Upper?Aa:ll})}),h.jsx(di,{ref:he,position:[_e.x,(_e.y+Ue.y)/2,_e.z],args:[St,St,l*1.2],name:xt.Left,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=he.current.localToWorld(new ue(i,0,-_e.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Left)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Left||Y===xt.Left?Aa:ll})}),h.jsx(di,{ref:me,position:[qe.x,(qe.y+Fe.y)/2,qe.z],args:[St,St,l*1.2],name:xt.Right,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=me.current.localToWorld(new ue(-i,0,-qe.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Right)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Right||Y===xt.Right?Aa:ll})})]})]})]}),Me>0&&h.jsx(wa,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[w,w,Me+l,gt?4:2,1],position:[0,0,tt],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),x&&ht.z>0&&h.jsx(On,{rotation:[-lt.x,0,-lt.z],userData:{unintersectable:!0},points:[zt,new ue(-.3*ge,0,.09*Re).applyEuler(mt),Yt,new ue(-.6*ge,0,.36*Re).applyEuler(mt),zt,new ue(-.9*ge,0,.81*Re).applyEuler(mt),Yt,zt,new ue(.3*ge,0,.09*Re).applyEuler(mt),Yt,new ue(.6*ge,0,.36*Re).applyEuler(mt),zt,new ue(.9*ge,0,.81*Re).applyEuler(mt),Yt],name:"Sun Beams",lineWidth:.25,color:"white"}),(Q||v)&&!_&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Ye,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(we*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),Yhn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,moduleLength:d,poleHeight:f,poleRadius:p=.1,drawSunBeam:m,rotation:y=[0,0,0],color:w="white",lineColor:x="black",lineWidth:C=.5,showLabel:P=!1,locked:A=!1,parentId:S,receiverId:v}=t,b=H(pn),T=H(Au),R=H(ml),M=H(tu),D=H(Qn),k=dt(vs),N=H(Df),U=In(O1),W=H(xs),F=H(Jn),E=H(z0),L=H(Ky),j=H(Cm),Y=Fc(e),{gl:{domElement:O}}=ti(),[_,G]=g.useState(!1),[Q,oe]=g.useState(null),[ee,q]=g.useState(1),[ae,Z]=g.useState(null),ne=g.useRef(null),te=g.useRef(null),$=g.useRef(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(!1),ce=Math.max(100,10*L),Pe=g.useMemo(()=>({lng:T}),[T]);let pe=n,Ie=o,ve=r;const ze=i/2,Ae=a/2,se=l/2,ge=f+ze,we=H(tt=>{for(const gt of tt.elements)if(gt.id===S)return gt});if(we)switch(we.type){case z.Foundation:if(ve=ge+se+we.lz,ye.isZero(y[2]))pe=we.cx+n*we.lx,Ie=we.cy+o*we.ly;else{const tt=new ue(n*we.lx,o*we.ly,0);tt.applyAxisAngle(Oo,y[2]),pe=we.cx+tt.x,Ie=we.cy+tt.y}break}const Se=new ue(-ze,-Ae,se),Me=new ue(-ze,Ae,se),Ce=new ue(ze,-Ae,se),Te=new ue(ze,Ae,se);g.useEffect(()=>{if(t&&k){const tt=U(t.id);tt&&Z(ye.fetchHeatmapTexture(tt,N??5))}},[k,N]),g.useEffect(()=>{q(Math.max(1,Math.round(a/d)))},[a,d]),g.useEffect(()=>{const tt=()=>{jn.getState().setEnableOrbitController(!0),me.current=!1};return window.addEventListener("pointerup",tt),()=>{window.removeEventListener("pointerup",tt)}},[]);const Re=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.FresnelReflectorElement",Pe))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",Pe)+")":"")+(t!=null&&t.label?"":` -`+B.t("word.Coordinates",Pe)+": ("+pe.toFixed(1)+", "+Ie.toFixed(1)+", "+ve.toFixed(1)+") "+B.t("word.MeterAbbreviation",Pe)),[t==null?void 0:t.label,t==null?void 0:t.locked,Pe,pe,Ie,ve]),Ne=g.useMemo(()=>new cn(0,0,y[2],"ZXY"),[y]),_e=(tt,gt)=>{tt.intersections.length>0&&tt.intersections[0].object===tt.eventObject&&(oe(gt),gt===Ho.Top?O.style.cursor="move":gt===ai.Lower||gt===ai.Upper||gt===ai.Tilt?O.style.cursor="grab":O.style.cursor="pointer")},Ue=()=>{oe(null),O.style.cursor="default"},qe=g.useMemo(()=>zi(new Date(R),M),[R,M]),Fe=we==null?void 0:we.rotation[2],He=v&&v!==S?F(v):null,Le=g.useMemo(()=>{if(He){if(He.type===z.Foundation){const tt=He;if(tt.solarStructure===Nn.FocusPipe&&tt.solarAbsorberPipe)return new ue((tt.cx-pe)*(Fe?Math.cos(Fe):1),(tt.cy-Ie)*(Fe?Math.sin(Fe):0),tt.cz-ve+tt.lz/2+(tt.solarAbsorberPipe.absorberHeight??10))}}else if(we&&we.type===z.Foundation){const tt=we;if(tt.solarStructure===Nn.FocusPipe&&tt.solarAbsorberPipe)return new ue((tt.cx-pe)*(Fe?Math.cos(Fe):1),(tt.cy-Ie)*(Fe?Math.sin(Fe):0),tt.cz-ve+tt.lz/2+(tt.solarAbsorberPipe.absorberHeight??10))}return null},[He,we,pe,Ie,ve,Fe]),Ye=g.useRef(new ue),lt=g.useMemo(()=>{if(Le&&qe.z>0){const tt=Fe?new ue(Math.sin(Fe),Math.cos(Fe),0):new ue(0,1,0);Ye.current.set(Le.x,Le.y,Le.z);const gt=qe.z{const tt=[],gt=Math.cos(u)*d,Ve=Math.sin(u)*d,je=ee/2-.5;for(let et=0;et{const tt=[],gt=a/ee;for(let Ve=0;Ve<=ee;Ve++){const je=[];je.push(new ue(-ze,-Ae+Ve*gt,se)),je.push(new ue(ze,-Ae+Ve*gt,se)),tt.push({points:je})}return tt},[i,a,se,ee]),Qe=Math.max(1,Math.min(i*5,a*5,(i+a)/16)),nt=$8*Qe*1.5,mt=Tm*Qe*2;return h.jsxs("group",{name:"Fresnel Reflector Group "+e,rotation:Ne,position:[pe,Ie,ve+se],children:[h.jsxs("group",{rotation:lt,children:[h.jsxs(di,{receiveShadow:W,castShadow:W,uuid:e,ref:ne,args:[i,a,l],name:"Fresnel Reflector",onPointerDown:tt=>{tt.button!==2&&E(e,tt,er.Select)},onContextMenu:tt=>{E(e,tt,er.ContextMenu),b(gt=>{tt.intersections.length>0&&tt.intersections[0].object===ne.current&&(gt.contextMenuObjectType=z.FresnelReflector)})},onPointerOver:tt=>{tt.intersections.length>0&&tt.intersections[0].object===ne.current&&(G(!0),O.style.cursor="move")},onPointerOut:()=>{G(!1),O.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:w}),h.jsx("meshStandardMaterial",{attach:"material-1",color:w}),h.jsx("meshStandardMaterial",{attach:"material-2",color:w}),h.jsx("meshStandardMaterial",{attach:"material-3",color:w}),k&&ae?h.jsx("meshBasicMaterial",{attach:"material-4",side:$i,map:ae}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:w})]}),ht&&ht.map((tt,gt)=>h.jsx(On,{name:"Fresnel Reflector Module Line",userData:{unintersectable:!0},points:tt.points,castShadow:!1,receiveShadow:!1,lineWidth:C,color:x},gt)),h.jsx(On,{name:"Fresnel Reflector Outline 1",userData:{unintersectable:!0},points:[[-ze,-Ae,se],[-ze,Ae,se]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:x}),h.jsx(On,{name:"Fresnel Reflector Outline 2",userData:{unintersectable:!0},points:[[ze,-Ae,se],[ze,Ae,se]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:x}),h.jsx(yi,{name:"Fresnel Reflector Simulation Plane",uuid:e,args:[i,a],position:[0,0,se],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),Y&&A&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ze,-Ae,se],[-ze,Ae,se],[ze,Ae,se],[ze,-Ae,se],[-ze,-Ae,se]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),Y&&!A&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:te,position:new ue(0,0,0),args:[mt,6,6],name:Ho.Default,castShadow:!1,receiveShadow:!1,onPointerOver:tt=>{_e(tt,Ho.Top)},onPointerOut:()=>{Ue()},onPointerDown:tt=>{tt.button!==2&&E(e,tt,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(di,{ref:$,position:[(Se.x+Ce.x)/2,Se.y,Se.z-se],args:[nt,nt,l*1.2],name:xt.Lower,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=$.current.localToWorld(new ue(0,a,-Se.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Lower)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Lower||j===xt.Lower?Aa:ll})}),h.jsx(di,{ref:le,position:[(Me.x+Te.x)/2,Me.y,Me.z-se],args:[nt,nt,l*1.2],name:xt.Upper,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=le.current.localToWorld(new ue(0,-a,-Me.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Upper)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Upper||j===xt.Upper?Aa:ll})}),h.jsx(di,{ref:de,position:[Se.x,(Se.y+Me.y)/2,Se.z],args:[nt,nt,l*1.2],name:xt.Left,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=de.current.localToWorld(new ue(i,0,-Se.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Left)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Left||j===xt.Left?Aa:ll})}),h.jsx(di,{ref:he,position:[Ce.x,(Ce.y+Te.y)/2,Ce.z],args:[nt,nt,l*1.2],name:xt.Right,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=he.current.localToWorld(new ue(-i,0,-Ce.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Right)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Right||j===xt.Right?Aa:ll})})]})]})]}),ge>0&&ut.map((tt,gt)=>{const Ve=D.length<100?4:2;return h.jsx(wa,{userData:{unintersectable:!0},name:"Pole "+gt,castShadow:!1,receiveShadow:!1,args:[p,p,ge+(tt.z-Oe)*2+l,Ve,1],position:tt,rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})},gt)}),m&&qe.z>0&&h.jsx(On,{rotation:[-Ne.x,0,-Ne.z],userData:{unintersectable:!0},points:Le?[Ye.current,new ue(0,0,se),qe.clone().multiplyScalar(ce)]:[new ue(0,0,se),qe.clone().multiplyScalar(ce)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(_||P)&&!Y&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Re,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(Ae*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),Ohn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,poleHeight:d,poleRadius:f=Math.min(i,a)/20,drawSunBeam:p,rotation:m=[0,0,0],color:y="white",lineColor:w="black",lineWidth:x=.5,showLabel:C=!1,locked:P=!1,parentId:A,towerId:S}=t,v=H(pn),b=H(ml),T=H(tu),R=H(Qn),M=dt(vs),D=H(Df),k=In(O1),N=H(xs),U=H(Jn),W=H(z0),F=H(Ky),E=Fc(e),{gl:{domElement:L}}=ti(),[j,Y]=g.useState(!1),[O,_]=g.useState(null),G=g.useRef(null),Q=g.useRef(null),oe=g.useRef(!1),ee=Math.max(100,10*F),q=Kt();let ae=n,Z=o,ne=r;const te=i/2,$=a/2,le=l/2,de=d+Math.max(te,$),he=H(Me=>{for(const Ce of Me.elements)if(Ce.id===A)return Ce});if(he)switch(he.type){case z.Foundation:if(ne=de+le+he.lz,ye.isZero(m[2]))ae=he.cx+n*he.lx,Z=he.cy+o*he.ly;else{const Me=new ue(n*he.lx,o*he.ly,0);Me.applyAxisAngle(Oo,m[2]),ae=he.cx+Me.x,Z=he.cy+Me.y}break}g.useEffect(()=>{if(t&&M){const Me=k(t.id);Me&&_(ye.fetchHeatmapTexture(Me,D??5))}},[M,D]),g.useEffect(()=>{const Me=()=>{jn.getState().setEnableOrbitController(!0),oe.current=!1};return window.addEventListener("pointerup",Me),()=>{window.removeEventListener("pointerup",Me)}},[]);const me=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.HeliostatElement",q))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",q)+")":"")+(t!=null&&t.label?"":` -`+B.t("word.Coordinates",q)+": ("+ae.toFixed(1)+", "+Z.toFixed(1)+", "+ne.toFixed(1)+") "+B.t("word.MeterAbbreviation",q)),[t==null?void 0:t.label,t==null?void 0:t.locked,q,ae,Z,ne]),ce=g.useMemo(()=>new cn(0,0,m[2],"ZXY"),[m]),Pe=(Me,Ce)=>{Me.intersections.length>0&&Me.intersections[0].object===Me.eventObject&&(L.style.cursor=Ce===Ho.Default?"move":"pointer")},pe=()=>{L.style.cursor="default"},Ie=g.useMemo(()=>zi(new Date(b),T),[b,T]),ve=he==null?void 0:he.rotation[2],ze=S&&S!==A?U(S):null,Ae=g.useMemo(()=>{if(ze){if(ze.type===z.Foundation){const Me=ze;if(Me.solarStructure===Nn.FocusTower&&Me.solarPowerTower)return new ue(Me.cx-ae,Me.cy-Z,Me.cz-ne+Me.lz/2+(Me.solarPowerTower.towerHeight??20))}}else if(he&&he.type===z.Foundation){const Me=he;if(Me.solarStructure===Nn.FocusTower&&Me.solarPowerTower)return new ue(Me.cx-ae,Me.cy-Z,Me.cz-ne+Me.lz/2+(Me.solarPowerTower.towerHeight??20))}return null},[he,ae,Z,ne,ze]),se=g.useMemo(()=>{if(Ae&&Ie.z>0){let Ce=Ae.clone().normalize().add(Ie).normalize();ye.isSame(Ce,Oo)&&(Ce=new ue(-.001,0,1).normalize()),ve&&Ce.applyAxisAngle(Oo,-ve);const Te=Math.hypot(Ce.x,Ce.y);return new cn(Math.atan2(Te,Ce.z),0,Math.atan2(Ce.y,Ce.x)+$t,"ZXY")}return new cn(c,0,u,"ZXY")},[Ae,Ie,c,u,ve]),ge=-(de+l)/2,we=Math.max(1,(i+a)/8),Se=Tm*we*4;return h.jsxs("group",{name:"Heliostat Group "+e,rotation:ce,position:[ae,Z,ne+le],children:[h.jsxs("group",{rotation:se,children:[h.jsxs(di,{receiveShadow:N,castShadow:N,uuid:e,ref:G,args:[i,a,l],name:"Heliostat",onPointerDown:Me=>{Me.button!==2&&W(e,Me,er.Select)},onContextMenu:Me=>{W(e,Me,er.ContextMenu),v(Ce=>{Me.intersections.length>0&&Me.intersections[0].object===G.current&&(Ce.contextMenuObjectType=z.Heliostat)})},onPointerOver:Me=>{Me.intersections.length>0&&Me.intersections[0].object===G.current&&(Y(!0),L.style.cursor="move")},onPointerOut:()=>{Y(!1),L.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:y}),h.jsx("meshStandardMaterial",{attach:"material-1",color:y}),h.jsx("meshStandardMaterial",{attach:"material-2",color:y}),h.jsx("meshStandardMaterial",{attach:"material-3",color:y}),M&&O?h.jsx("meshBasicMaterial",{attach:"material-4",side:$i,map:O}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:y})]}),h.jsx(yi,{name:"Heliostat Simulation Plane",uuid:e,args:[i,a],position:[0,0,le],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),E&&P&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-te,-$,le],[-te,$,le],[te,$,le],[te,-$,le],[-te,-$,le]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),E&&!P&&h.jsx(Ys,{ref:Q,position:new ue(0,0,0),args:[Se,6,6],name:Ho.Default,castShadow:!1,receiveShadow:!1,onPointerOver:Me=>{Pe(Me,Ho.Default)},onPointerOut:()=>{pe()},onPointerDown:Me=>{Me.button!==2&&W(e,Me,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})})]}),de>0&&h.jsx(wa,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[f,f,de+l,R.length<100?4:2,1],position:new ue(0,0,ge),rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:y})}),p&&Ie.z>0&&h.jsx(On,{rotation:[-ce.x,0,-ce.z],userData:{unintersectable:!0},points:Ae?[Ae,new ue(0,0,le),Ie.clone().multiplyScalar(ee)]:[new ue(0,0,le),Ie.clone().multiplyScalar(ee)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(j||C)&&!E&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:me,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max($*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),_hn=xe.memo(t=>{var ae;const{parentId:e,id:n,cx:o,cy:r,cz:i,name:a=uo.WhiteFlower,flip:l=!1,locked:s=!1}=t;let c=!1;H(Z=>{if(e===rr)c=!0;else for(const ne of Z.elements)if(ne.id===e){c=!0;break}});const u=H(Jp);g.useEffect(()=>{c||u(n,!1)},[c]);const d=H(pn),f=H(Au),p=H(M0)??!1,m=H(ml),y=H(tu),w=H(K2e)??tQ,x=H($2e)??nQ,C=H(z0),P=H(FS),A=H($y),S=dt(vs),[v,b]=g.useState(!1),{gl:T}=ti(),R=Fc(n),M=jn(Z=>Z.contentRef),D=g.useRef(null),k=g.useRef(null),N=g.useRef(null),U=g.useRef(null),W=g.useMemo(()=>({lng:f}),[f]),F=g.useMemo(()=>{const Z=ye.dayOfYear(new Date(m));return y>0?Zx:Z>=w&&Z<=x},[m,w,x,y]),E=g.useRef(!1),L=H(OM);L!==E.current&&(E.current=L,M!=null&&M.current&&D.current&&M.current.add(D.current)),g.useEffect(()=>{if(e!==rr){const Z=Q();Z&&D.current&&Z.add(D.current)}},[L,e]),g.useEffect(()=>{const Z=Q();Z&&D.current&&Z.add(D.current)},[M]);const j=Up(i3.fetchTextureImage(a,F)),Y=g.useMemo(()=>{const Z=j.clone();return l?(Z.wrapS=es,Z.repeat.x=-1,Z.needsUpdate=!0):Z.repeat.x=1,Z},[j,l]),O=g.useMemo(()=>i3.fetchLabel(a,W)+(s?" ("+B.t("shared.ElementLocked",W)+")":"")+` -`+B.t("word.Coordinates",W)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+B.t("word.MeterAbbreviation",W),[a,o,r,s,W]),_=g.useCallback((Z,ne)=>{dt.getState().duringCameraInteraction||Z.intersections.length>0&&(Z.intersections[0].object===Z.eventObject||Z.intersections.length>1&&Z.intersections[1].object===Z.eventObject)&&(d($=>{$.hoveredHandle=ne,$.selectedElementHeight=t.lz}),ye.isMoveHandle(ne)?T.domElement.style.cursor="move":T.domElement.style.cursor="pointer")},[t.lz]),G=g.useCallback(()=>{d(Z=>{Z.hoveredHandle=null}),T.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),Q=()=>e!==rr&&(M!=null&&M.current)?ye.getObjectChildById(M.current,e):null,oe=g.useMemo(()=>i3.fetchSpread(a),[a]),ee=g.useMemo(()=>i3.fetchHeight(a),[a]);Gp(({camera:Z})=>{if(D.current){const{rot:ne}=ye.getWorldDataById(e);if(p)k.current&&U.current&&(k.current.rotation.set($t,0,0),U.current.rotation.set(0,0,0)),D.current.rotation.set(-$t,0,0);else{if(k.current&&U.current){const{x:te,y:$}=Z.position,{x:le,y:de}=D.current.position;if(Q()){const me=D.current.localToWorld(new ue),ce=Math.atan2(te-me.x,$-me.y)+ne;k.current.rotation.set($t,-ce,0),U.current.rotation.set(-$t,ce,0)}else{const me=Math.atan2(te-le,$-de);k.current.rotation.set($t,-me,0),U.current.rotation.set(-$t,me,0)}}D.current.rotation.set(0,0,0)}}});const q=Tm*3;return h.jsx(h.Fragment,{children:c?h.jsx("group",{ref:D,name:"Flower Group "+n,userData:{aabb:!0},position:[o,r,(i??0)+(p?.25:0)],children:h.jsxs("group",{position:[0,0,ee/2],children:[h.jsx(MR,{ref:k,uuid:n,name:a,follow:!1,rotation:[$t,0,0],children:h.jsx(yi,{args:[oe,ee],receiveShadow:!S,children:h.jsx("meshToonMaterial",{map:Y,side:zr,alphaTest:.5})})}),h.jsx(MR,{ref:U,name:"Interaction Billboard",visible:!1,position:[0,0,-ee/2],children:h.jsx(yi,{ref:N,renderOrder:3,name:a+" plane",args:[oe/2,ee*2],rotation:[p?$t:0,0,0],onContextMenu:Z=>{C(n,Z,er.ContextMenu),d(ne=>{Z.intersections.length>0&&Z.intersections[0].object===N.current&&(ne.contextMenuObjectType=z.Flower)})},onPointerDown:Z=>{Z.button!==2&&Z.eventObject===Z.intersections[0].eventObject&&(C(n,Z,er.Move),jn.setState({flowerRef:D}))},onPointerOver:Z=>{Z.intersections.length>0&&Z.intersections[0].object===N.current&&b(!0)},onPointerOut:()=>{b(!1)}})}),R&&s&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-oe/2,-ee/2,0],[-oe/2,ee/2,0],[-oe/2,ee/2,0],[oe/2,ee/2,0],[oe/2,-ee/2,0],[oe/2,ee/2,0],[oe/2,-ee/2,0],[-oe/2,-ee/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(ae=k.current)==null?void 0:ae.rotation,color:i0}),R&&!s&&h.jsx(h.Fragment,{children:h.jsx(Ys,{position:new ue(0,0,-ee/2),args:[q,6,6,0,Math.PI],name:Ho.Default,renderOrder:2,onPointerDown:Z=>{Z.button!==2&&Z.eventObject===Z.intersections[0].eventObject&&(C(n,Z,er.Move),jn.setState({flowerRef:D}))},onPointerEnter:Z=>{_(Z,Ho.Default)},onPointerLeave:G,children:h.jsx("meshBasicMaterial",{attach:"material",color:A===Ho.Default||P===Ho.Default?Aa:q8})})}),v&&!R&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:O,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,ee/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});var Bpe=function(t,e){return Bpe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},Bpe(t,e)};function Mr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Bpe(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var n0=function(){return n0=Object.assign||function(e){for(var n,o=1,r=arguments.length;o0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ep(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var o=n.call(t),r,i=[],a;try{for(;(e===void 0||e-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(l){a={error:l}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function xl(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o0?Id(mI,--Vy):0,zH--,v0===10&&(zH=1,ite--),v0}function P5(){return v0=Vy2||Ope(v0)>3?"":" "}function epn(t,e){for(;--e&&P5()&&!(v0<48||v0>102||v0>57&&v0<65||v0>70&&v0<97););return lte(t,CG()+(e<6&&vb()==32&&P5()==32))}function _pe(t){for(;P5();)switch(v0){case t:return Vy;case 34:case 39:t!==34&&t!==39&&_pe(v0);break;case 40:t===41&&_pe(t);break;case 92:P5();break}return Vy}function tpn(t,e){for(;P5()&&t+v0!==57;)if(t+v0===84&&vb()===47)break;return"/*"+lte(e,Vy-1)+"*"+q3e(t===47?t:P5())}function npn(t){for(;!Ope(vb());)P5();return lte(t,Vy)}function opn(t){return Qhn(RG("",null,null,null,[""],t=qhn(t),0,[0],t))}function RG(t,e,n,o,r,i,a,l,s){for(var c=0,u=0,d=a,f=0,p=0,m=0,y=1,w=1,x=1,C=0,P="",A=r,S=i,v=o,b=P;w;)switch(m=C,C=P5()){case 40:if(m!=108&&Id(b,d-1)==58){PG(b+=za(qse(C),"&","&\f"),"&\f",krt(c?l[c-1]:0))!=-1&&(x=-1);break}case 34:case 39:case 91:b+=qse(C);break;case 9:case 10:case 13:case 32:b+=Zhn(m);break;case 92:b+=epn(CG()-1,7);continue;case 47:switch(vb()){case 42:case 47:ik(rpn(tpn(P5(),CG()),e,n,s),s);break;default:b+="/"}break;case 123*y:l[c++]=J9(b)*x;case 125*y:case 59:case 0:switch(C){case 0:case 125:w=0;case 59+u:x==-1&&(b=za(b,/\f/g,"")),p>0&&J9(b)-d&&ik(p>32?DMe(b+";",o,n,d-1,s):DMe(za(b," ","")+";",o,n,d-2,s),s);break;case 59:b+=";";default:if(ik(v=zMe(b,e,n,c,u,r,l,P,A=[],S=[],d,i),i),C===123)if(u===0)RG(b,e,v,v,A,i,d,l,S);else switch(f===99&&Id(b,3)===110?100:f){case 100:case 108:case 109:case 115:RG(t,v,v,o&&ik(zMe(t,v,v,0,0,r,l,P,r,A=[],d,S),S),r,S,d,l,o?A:S);break;default:RG(b,v,v,v,[""],S,0,l,S)}}c=u=p=0,y=x=1,P=b="",d=a;break;case 58:d=1+J9(b),p=m;default:if(y<1){if(C==123)--y;else if(C==125&&y++==0&&$hn()==125)continue}switch(b+=q3e(C),C*y){case 38:x=u>0?1:(b+="\f",-1);break;case 44:l[c++]=(J9(b)-1)*x,x=1;break;case 64:vb()===45&&(b+=qse(P5())),f=vb(),u=d=J9(P=b+=npn(CG())),C++;break;case 45:m===45&&J9(b)==2&&(y=0)}}return i}function zMe(t,e,n,o,r,i,a,l,s,c,u,d){for(var f=r-1,p=r===0?i:[""],m=Lrt(p),y=0,w=0,x=0;y0?p[C]+" "+P:za(P,/&\f/g,p[C])))&&(s[x++]=A);return ate(t,e,n,r===0?rte:l,s,c,u,d)}function rpn(t,e,n,o){return ate(t,e,n,Drt,q3e(Khn()),IH(t,2,-2),0,o)}function DMe(t,e,n,o,r){return ate(t,e,n,$3e,IH(t,0,o),IH(t,o+1,-1),o,r)}function Nrt(t,e,n){switch(Xhn(t,e)){case 5103:return is+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return is+t+t;case 4789:return Zk+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return is+t+Zk+t+mc+t+t;case 5936:switch(Id(t,e+11)){case 114:return is+t+mc+za(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return is+t+mc+za(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return is+t+mc+za(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return is+t+mc+t+t;case 6165:return is+t+mc+"flex-"+t+t;case 5187:return is+t+za(t,/(\w+).+(:[^]+)/,is+"box-$1$2"+mc+"flex-$1$2")+t;case 5443:return is+t+mc+"flex-item-"+za(t,/flex-|-self/g,"")+(lA(t,/flex-|baseline/)?"":mc+"grid-row-"+za(t,/flex-|-self/g,""))+t;case 4675:return is+t+mc+"flex-line-pack"+za(t,/align-content|flex-|-self/g,"")+t;case 5548:return is+t+mc+za(t,"shrink","negative")+t;case 5292:return is+t+mc+za(t,"basis","preferred-size")+t;case 6060:return is+"box-"+za(t,"-grow","")+is+t+mc+za(t,"grow","positive")+t;case 4554:return is+za(t,/([^-])(transform)/g,"$1"+is+"$2")+t;case 6187:return za(za(za(t,/(zoom-|grab)/,is+"$1"),/(image-set)/,is+"$1"),t,"")+t;case 5495:case 3959:return za(t,/(image-set\([^]*)/,is+"$1$`$1");case 4968:return za(za(t,/(.+:)(flex-)?(.*)/,is+"box-pack:$3"+mc+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+is+t+t;case 4200:if(!lA(t,/flex-|baseline/))return mc+"grid-column-align"+IH(t,e)+t;break;case 2592:case 3360:return mc+za(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(o,r){return e=r,lA(o.props,/grid-\w+-end/)})?~PG(t+(n=n[e].value),"span",0)?t:mc+za(t,"-start","")+t+mc+"grid-row-span:"+(~PG(n,"span",0)?lA(n,/\d+/):+lA(n,/\d+/)-+lA(t,/\d+/))+";":mc+za(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(o){return lA(o.props,/grid-\w+-start/)})?t:mc+za(za(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return za(t,/(.+)-inline(.+)/,is+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(J9(t)-1-e>6)switch(Id(t,e+1)){case 109:if(Id(t,e+4)!==45)break;case 102:return za(t,/(.+:)(.+)-([^]+)/,"$1"+is+"$2-$3$1"+Zk+(Id(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~PG(t,"stretch",0)?Nrt(za(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return za(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,r,i,a,l,s,c){return mc+r+":"+i+c+(a?mc+r+"-span:"+(l?s:+s-+i)+c:"")+t});case 4949:if(Id(t,e+6)===121)return za(t,":",":"+is)+t;break;case 6444:switch(Id(t,Id(t,14)===45?18:11)){case 120:return za(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+is+(Id(t,14)===45?"inline-":"")+"box$3$1"+is+"$2$3$1"+mc+"$2box$3")+t;case 100:return za(t,":",":"+mc)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return za(t,"scroll-","scroll-snap-")+t}return t}function FJ(t,e){for(var n="",o=0;o-1&&!t.return)switch(t.type){case $3e:t.return=Nrt(t.value,t.length,n);return;case Ert:return FJ([kw(t,{value:za(t.value,"@","@"+is)})],o);case rte:if(t.length)return Jhn(n=t.props,function(r){switch(lA(r,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":XP(kw(t,{props:[za(r,/:(read-\w+)/,":"+Zk+"$1")]})),XP(kw(t,{props:[r]})),Ype(t,{props:IMe(n,o)});break;case"::placeholder":XP(kw(t,{props:[za(r,/:(plac\w+)/,":"+is+"input-$1")]})),XP(kw(t,{props:[za(r,/:(plac\w+)/,":"+Zk+"$1")]})),XP(kw(t,{props:[za(r,/:(plac\w+)/,mc+"input-$1")]})),XP(kw(t,{props:[r]})),Ype(t,{props:IMe(n,o)});break}return""})}}var cpn={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ug={},DH=typeof process<"u"&&Ug!==void 0&&(Ug.REACT_APP_SC_ATTR||Ug.SC_ATTR)||"data-styled",Urt="active",jrt="data-styled-version",ste="6.1.10",Q3e=`/*!sc*/ -`,Z3e=typeof window<"u"&&"HTMLElement"in window,upn=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Ug!==void 0&&Ug.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Ug.REACT_APP_SC_DISABLE_SPEEDY!==""?Ug.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Ug.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Ug!==void 0&&Ug.SC_DISABLE_SPEEDY!==void 0&&Ug.SC_DISABLE_SPEEDY!==""&&Ug.SC_DISABLE_SPEEDY!=="false"&&Ug.SC_DISABLE_SPEEDY),cte=Object.freeze([]),EH=Object.freeze({});function dpn(t,e,n){return n===void 0&&(n=EH),t.theme!==n.theme&&t.theme||e||n.theme}var Brt=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),fpn=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,hpn=/(^-|-$)/g;function EMe(t){return t.replace(fpn,"-").replace(hpn,"")}var ppn=/(a)(d)/gi,W_=52,kMe=function(t){return String.fromCharCode(t+(t>25?39:97))};function Vpe(t){var e,n="";for(e=Math.abs(t);e>W_;e=e/W_|0)n=kMe(e%W_)+n;return(kMe(e%W_)+n).replace(ppn,"$1-$2")}var Qse,Yrt=5381,cR=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},Ort=function(t){return cR(Yrt,t)};function gpn(t){return Vpe(Ort(t)>>>0)}function mpn(t){return t.displayName||t.name||"Component"}function Zse(t){return typeof t=="string"&&!0}var _rt=typeof Symbol=="function"&&Symbol.for,Vrt=_rt?Symbol.for("react.memo"):60115,ypn=_rt?Symbol.for("react.forward_ref"):60112,Apn={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},wpn={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Grt={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},xpn=((Qse={})[ypn]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Qse[Vrt]=Grt,Qse);function FMe(t){return("type"in(e=t)&&e.type.$$typeof)===Vrt?Grt:"$$typeof"in t?xpn[t.$$typeof]:Apn;var e}var vpn=Object.defineProperty,bpn=Object.getOwnPropertyNames,LMe=Object.getOwnPropertySymbols,Spn=Object.getOwnPropertyDescriptor,Tpn=Object.getPrototypeOf,WMe=Object.prototype;function Xrt(t,e,n){if(typeof e!="string"){if(WMe){var o=Tpn(e);o&&o!==WMe&&Xrt(t,o,n)}var r=bpn(e);LMe&&(r=r.concat(LMe(e)));for(var i=FMe(t),a=FMe(e),l=0;l0?" Args: ".concat(e.join(", ")):""))}var Ppn=function(){function t(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return t.prototype.indexOfGroup=function(e){for(var n=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,r=o.length,i=r;e>=i;)if((i<<=1)<0)throw LU(16,"".concat(e));this.groupSizes=new Uint32Array(i),this.groupSizes.set(o),this.length=i;for(var a=r;a=this.length||this.groupSizes[e]===0)return n;for(var o=this.groupSizes[e],r=this.indexOfGroup(e),i=r+o,a=r;a=0){var o=document.createTextNode(n);return this.element.insertBefore(o,this.nodes[e]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.prototype.getRule=function(e){return e0&&(w+="".concat(x,","))}),s+="".concat(m).concat(y,'{content:"').concat(w,'"}').concat(Q3e)},u=0;u0?".".concat(e):f},u=s.slice();u.push(function(f){f.type===rte&&f.value.includes("&")&&(f.props[0]=f.props[0].replace(Lpn,n).replace(o,c))}),a.prefix&&u.push(spn),u.push(ipn);var d=function(f,p,m,y){p===void 0&&(p=""),m===void 0&&(m=""),y===void 0&&(y="&"),e=y,n=p,o=new RegExp("\\".concat(n,"\\b"),"g");var w=f.replace(Wpn,""),x=opn(m||p?"".concat(m," ").concat(p," { ").concat(w," }"):w);a.namespace&&(x=$rt(x,a.namespace));var C=[];return FJ(x,apn(u.concat(lpn(function(P){return C.push(P)})))),C};return d.hash=s.length?s.reduce(function(f,p){return p.name||LU(15),cR(f,p.name)},Yrt).toString():"",d}var Upn=new Krt,Xpe=Npn(),qrt=xe.createContext({shouldForwardProp:void 0,styleSheet:Upn,stylis:Xpe});qrt.Consumer;xe.createContext(void 0);function jMe(){return g.useContext(qrt)}var jpn=function(){function t(e,n){var o=this;this.inject=function(r,i){i===void 0&&(i=Xpe);var a=o.name+i.hash;r.hasNameForId(o.id,a)||r.insertRules(o.id,a,i(o.rules,a,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=n,t6e(this,function(){throw LU(12,String(o.name))})}return t.prototype.getName=function(e){return e===void 0&&(e=Xpe),this.name+e.hash},t}(),Bpn=function(t){return t>="A"&&t<="Z"};function BMe(t){for(var e="",n=0;n>>0);if(!n.hasNameForId(this.componentId,a)){var l=o(i,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,l)}r=Xv(r,a),this.staticRulesId=a}else{for(var s=cR(this.baseHash,o.hash),c="",u=0;u>>0);n.hasNameForId(this.componentId,p)||n.insertRules(this.componentId,p,o(c,".".concat(p),void 0,this.componentId)),r=Xv(r,p)}}return r},t}(),eit=xe.createContext(void 0);eit.Consumer;var ece={};function Vpn(t,e,n){var o=e6e(t),r=t,i=!Zse(t),a=e.attrs,l=a===void 0?cte:a,s=e.componentId,c=s===void 0?function(A,S){var v=typeof A!="string"?"sc":EMe(A);ece[v]=(ece[v]||0)+1;var b="".concat(v,"-").concat(gpn(ste+v+ece[v]));return S?"".concat(S,"-").concat(b):b}(e.displayName,e.parentComponentId):s,u=e.displayName,d=u===void 0?function(A){return Zse(A)?"styled.".concat(A):"Styled(".concat(mpn(A),")")}(t):u,f=e.displayName&&e.componentId?"".concat(EMe(e.displayName),"-").concat(e.componentId):e.componentId||c,p=o&&r.attrs?r.attrs.concat(l).filter(Boolean):l,m=e.shouldForwardProp;if(o&&r.shouldForwardProp){var y=r.shouldForwardProp;if(e.shouldForwardProp){var w=e.shouldForwardProp;m=function(A,S){return y(A,S)&&w(A,S)}}else m=y}var x=new _pn(n,f,o?r.componentStyle:void 0);function C(A,S){return function(v,b,T){var R=v.attrs,M=v.componentStyle,D=v.defaultProps,k=v.foldedComponentIds,N=v.styledComponentId,U=v.target,W=xe.useContext(eit),F=jMe(),E=v.shouldForwardProp||F.shouldForwardProp,L=dpn(b,W,D)||EH,j=function(oe,ee,q){for(var ae,Z=n0(n0({},ee),{className:void 0,theme:q}),ne=0;ne=Xt)return X;var bn=Ee-Kh(Ze);if(bn<1)return Ze;var Ln=hn?Jf(hn,0,bn).join(""):X.slice(0,bn);if(Mt===n)return Ln+Ze;if(hn&&(bn+=Ln.length-bn),qz(Mt)){if(X.slice(bn).search(Mt)){var Po,Ro=Ln;for(Mt.global||(Mt=vu(Mt.source,bl(Lt.exec(Mt))+"g")),Mt.lastIndex=0;Po=Mt.exec(Ro);)var Yo=Po.index;Ln=Ln.slice(0,Yo===n?bn:Yo)}}else if(X.indexOf(Uc(Mt),bn)!=bn){var Hr=Ln.lastIndexOf(Mt);Hr>-1&&(Ln=Ln.slice(0,Hr))}return Ln+Ze}function Km(X){return X=bl(X),X&&ht.test(X)?X.replace(Oe,p2):X}var hie=J(function(X,re,Ee){return X+(Ee?" ":"")+re.toUpperCase()}),yD=G4("toUpperCase");function rY(X,re,Ee){return X=bl(X),re=Ee?n:re,re===n?p6(X)?g2(X):ud(X):X.match(re)||[]}var z2=fi(function(X,re){try{return xn(X,n,re)}catch(Ee){return Xz(Ee)?Ee:new Ri(Ee)}}),iY=la(function(X,re){return _n(re,function(Ee){Ee=gg(Ee),tp(X,Ee,WT(X[Ee],X))}),X});function aw(X){var re=X==null?0:X.length,Ee=mi();return X=re?qr(X,function(Ze){if(typeof Ze[1]!="function")throw new L0(a);return[Ee(Ze[0]),Ze[1]]}):[],fi(function(Ze){for(var Mt=-1;++MtL)return[];var Ee=O,Ze=Su(X,O);re=mi(re),X-=O;for(var Mt=$1(Ze,re);++Ee0||re<0)?new gi(Ee):(X<0?Ee=Ee.takeRight(-X):X&&(Ee=Ee.drop(X)),re!==n&&(re=ua(re),Ee=re<0?Ee.dropRight(-re):Ee.take(re-X)),Ee)},gi.prototype.takeRightWhile=function(X){return this.reverse().takeWhile(X).reverse()},gi.prototype.toArray=function(){return this.take(O)},pd(gi.prototype,function(X,re){var Ee=/^(?:filter|find|map|reject)|While$/.test(re),Ze=/^(?:head|last)$/.test(re),Mt=Bt[Ze?"take"+(re=="last"?"Right":""):re],Xt=Ze||/^find/.test(re);Mt&&(Bt.prototype[re]=function(){var hn=this.__wrapped__,bn=Ze?[1]:arguments,Ln=hn instanceof gi,Po=bn[0],Ro=Ln||Ki(hn),Yo=function(Ja){var dl=Mt.apply(Bt,na([Ja],bn));return Ze&&Hr?dl[0]:dl};Ro&&Ee&&typeof Po=="function"&&Po.length!=1&&(Ln=Ro=!1);var Hr=this.__chain__,oi=!!this.__actions__.length,Hi=Xt&&!Hr,Ia=Ln&&!oi;if(!Xt&&Ro){hn=Ia?hn:new gi(this);var Mi=X.apply(hn,bn);return Mi.__actions__.push({func:ET,args:[Yo],thisArg:n}),new Ou(Mi,Hr)}return Hi&&Ia?X.apply(this,bn):(Mi=this.thru(Yo),Hi?Ze?Mi.value()[0]:Mi.value():Mi)})}),_n(["pop","push","shift","sort","splice","unshift"],function(X){var re=$h[X],Ee=/^(?:push|sort|unshift)$/.test(X)?"tap":"thru",Ze=/^(?:pop|shift)$/.test(X);Bt.prototype[X]=function(){var Mt=arguments;if(Ze&&!this.__chain__){var Xt=this.value();return re.apply(Ki(Xt)?Xt:[],Mt)}return this[Ee](function(hn){return re.apply(Ki(hn)?hn:[],Mt)})}}),pd(gi.prototype,function(X,re){var Ee=Bt[re];if(Ee){var Ze=Ee.name+"";aa.call(ig,Ze)||(ig[Ze]=[]),ig[Ze].push({name:re,func:Ee})}}),ig[At(n,x).name]=[{name:"wrapper",func:n}],gi.prototype.clone=AT,gi.prototype.reverse=rz,gi.prototype.value=Gd,Bt.prototype.at=Mz,Bt.prototype.chain=Rre,Bt.prototype.commit=Hre,Bt.prototype.next=Mre,Bt.prototype.plant=FT,Bt.prototype.reverse=xB,Bt.prototype.toJSON=Bt.prototype.valueOf=Bt.prototype.value=Ire,Bt.prototype.first=Bt.prototype.head,tg&&(Bt.prototype[tg]=kT),Bt},Q1=mT();Wn?((Wn.exports=Q1)._=Q1,Cn._=Q1):wn._=Q1}).call(Rc)})(zJ,zJ.exports);var A3=zJ.exports;const Edn=t=>{const{lx:e,lz:n,parentId:o,id:r,roofId:i}=t,a=H(VRt),l=H(S5e);g.useEffect(()=>{i&&(a===i||l.has(i))&&H.getState().set(d=>{for(const f of d.elements)if(f.id===r&&f.type===z.Wall){const p=f;p.roofId=null,p.leftRoofHeight=void 0,p.rightRoofHeight=void 0,p.centerRoofHeight=void 0,p.centerLeftRoofHeight=void 0,p.centerRightRoofHeight=void 0;break}})},[i,a,l]);const s=d=>!(d.button===2||H.getState().moveHandleType||H.getState().resizeHandleType||H.getState().objectTypeToAdd!==z.None||H.getState().isAddingElement()),c=d=>{s(d)&&(H.getState().set(f=>{f.contextMenuObjectType=null}),H.getState().selectMe(r,d,er.Select))},u=d=>{H.getState().selectMe(r,d,er.ContextMenu),H.getState().set(f=>{d.intersections.length>0&&d.intersections[0].object===d.eventObject&&(f.contextMenuObjectType=z.Wall)})};return h.jsx(yi,{args:[e,n],rotation:[$t,0,0],visible:!1,onPointerDown:c,onContextMenu:u,children:h.jsx("meshBasicMaterial",{side:zr})})},kdn=xe.memo(Edn),rMe=({cy:t,size:e,type:n})=>{const[o,r]=g.useState(gL),i=()=>{r(Aa)},a=()=>{r(gL)};return h.jsx(Ys,{name:n,args:[e],position:[0,t,0],onPointerEnter:i,onPointerOut:a,children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},Fdn=({ply:t,phz:e})=>{const n=l2(),o=r=>{r.intersections.length>0&&r.intersections[0].eventObject.parent===r.eventObject&&(H.getState().set(i=>{i.moveHandleType=r.object.name}),jn.getState().setEnableOrbitController(!1))};return h.jsxs("group",{name:"Move Handle Group",position:[0,0,-e],onPointerDown:o,children:[h.jsx(rMe,{cy:-n,size:n,type:Ho.Lower}),h.jsx(rMe,{cy:t+n,size:n,type:Ho.Upper})]})},Ldn=xe.memo(Fdn),Wdn="#ADD8E6",ww=xe.memo(({x:t,z:e,handleType:n,highLight:o,handleSize:r,partial:i})=>{const a=H(pn),l=H(Cm),s=H(CJe),[c,u]=g.useState(!1),d=o||c||n===l||s&&(n===xt.LowerRight||n===xt.UpperRight)?Aa:i?Wdn:ll;let f=r,p=r,m=r;if(n===xt.LowerRight||n===xt.LowerLeft)f=r*1.7;else if(i){f*=.75,p=r/2,m=r*2.5;const y=m/4;n===xt.WallPartialResizeLeft||n===xt.WallPartialResizeRight?e-=y:(n===xt.WallPartialResizeLeftTop||n===xt.WallPartialResizeRightTop)&&(e+=y)}else p=r/2,m=r*1.7;return h.jsx(di,{name:n,args:[f,p,m],position:[t,0,e],onPointerOver:()=>{u(!0),a(y=>{y.hoveredHandle=n})},onPointerLeave:()=>{u(!1),a(y=>{y.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{color:d})})}),Ndn=xe.memo(({id:t,parentLz:e,roofId:n,x:o,z:r,absAngle:i,leftUnfilledHeight:a,rightUnfilledHeight:l,leftTopPartialResizeHandleHeight:s,rightTopPartialResizeHandleHeight:c,fill:u,wallLeftHeight:d,wallRightHeight:f,highLight:p,leftJoints:m,rightJoints:y})=>{const w=H(pn),x=H(M0),C=l2(),[P,A]=g.useState(!1),[S,v]=g.useState(new ue),[b,T]=g.useState(new cn),R=g.useRef(null),M=g.useRef(!1),D=g.useRef([r*2,a,l]),k=g.useRef(new Map),N=g.useRef(null),U=g.useRef(null),W=g.useRef([]),F=g.useMemo(()=>{if(!n)return null;const $=H.getState().elements.find(ae=>ae.id===n&&ae.type===z.Roof);return $?$.roofType:null},[n]);x&&(r=-r);const E=$=>{const ae=H.getState().cameraDirection,Z=Math.atan2(ae.x,ae.y);v(new ue($,0,0)),T(new cn($t,0,-Z-i,"ZXY")),A(!0)},L=($,ae,Z)=>{const[ne,te,q,le,de]=ae;w(he=>{for(const me of he.elements)if(me.id===$&&me.type===z.Wall){const ce=me;me.lz=ne,ce.leftUnfilledHeight=te,ce.rightUnfilledHeight=q,ce.leftTopPartialHeight=le,ce.rightTopPartialHeight=de}else if(me.type===z.Wall&&Z.has(me.id)){const ce=Z.get(me.id);ce!==void 0&&(me.lz=ce,me.cz=ce/2)}})},j=()=>{n&&(m.length>0||y.length>0)&&(F===Zo.Gable||F===Zo.Gambrel?H.getState().elements.forEach($=>{$.id===m[0]&&(N.current=$.lz),$.id===y[0]&&(U.current=$.lz)}):(k.current.clear(),H.getState().elements.forEach($=>{$.type===z.Wall&&$.roofId===n&&k.current.set($.id,$.lz)})))},Y=()=>{W.current=H.getState().elements.filter($=>$.parentId===t)},O=($,ae,Z,ne,te)=>{const{lx:q,lz:le,roofId:de,leftRoofHeight:he,rightRoofHeight:me,centerLeftRoofHeight:ce,centerRightRoofHeight:Pe,centerRoofHeight:pe}=$,Ie=u===Ul.Partial,ve=Ie?Math.min(d,ne):d,ze=Ie?Math.min(f,te):f,Ae=Ie&&(!ye.isZero(d-ve)||!ye.isZero(f-ze)),[se,ge]=[q/2,le/2],we=[];return we.push({x:-se,y:-ge+ae},{x:se,y:-ge+Z}),Ae?we.push({x:se,y:-ge+ze},{x:-se,y:-ge+ve}):de?(me?we.push({x:se,y:-ge+me}):we.push({x:se,y:ge}),Pe&&we.push({x:Pe[0]*q,y:-ge+Pe[1]}),pe&&we.push({x:pe[0]*q,y:-ge+pe[1]}),ce&&we.push({x:ce[0]*q,y:-ge+ce[1]}),he?we.push({x:-se,y:-ge+he}):we.push({x:-se,y:ge})):we.push({x:se,y:ge},{x:-se,y:ge}),we},_=($,ae,Z,ne,te)=>{const q=O($,ae,Z,ne,te);if(W.current.length>0)for(const le of W.current){let{cx:de,cz:he,lx:me,ly:ce,lz:Pe}=le;if(de*=$.lx,he*=$.lz,le.type!==z.SolarPanel?(me*=$.lx,Pe*=$.lz):Pe=ce,le.type===z.Window&&le.windowType===Ti.Polygonal){const[pe,Ie]=le.polygonTop??P1,ve=de+pe*me,ze=he+Pe/2+Ie;if(!ye.isPointInside(ve,ze,q))return!1}if(!ye.isElementInsideWall(new ue(de,0,he),me,Pe,q,le.type===z.Door))return!1}return!0},G=()=>{N.current=null,U.current=null},Q=$=>{var Z;if(H.getState().addedWallId||$.object!==((Z=$.intersections[0])==null?void 0:Z.object))return;const ae=$.object;switch(ae.name){case xt.LowerLeft:{w(ne=>{ne.resizeAnchor.copy(ae.localToWorld(new ue(o*2,0,0)))});break}case xt.LowerRight:{w(ne=>{ne.resizeAnchor.copy(ae.localToWorld(new ue(-o*2,0,0)))});break}case xt.UpperLeft:case xt.WallPartialResizeLeft:case xt.WallPartialResizeLeftTop:{E(-o),j(),Y();break}case xt.UpperRight:case xt.WallPartialResizeRight:case xt.WallPartialResizeRightTop:{E(o),j(),Y();break}default:console.error("Wall resize handle unknown");return}w(ne=>{ne.resizeHandleType=ae.name}),jn.getState().setEnableOrbitController(!1),M.current=!0,D.current=[r*2,a,l,s,c]},oe=$=>{if($.intersections.length===0||!M.current)return;const ae=$.intersections[0].point;switch(H.getState().resizeHandleType){case xt.UpperLeft:case xt.UpperRight:{w(Z=>{const ne=u===Ul.Partial?Math.max(a,l):0;let te=Math.max(ne+C,ae.z-e);if(F===null||F===Zo.Gable||F===Zo.Gambrel){if(N.current||U.current){const q=Math.abs(te-(N.current??1/0)),le=Math.abs(te-(U.current??1/0));q{for(const ne of Z.elements)if(ne.id===t&&ne.type===z.Wall){const te=ne;let q=ye.clamp(ae.z-e,0,te.leftTopPartialHeight);if(te.leftJoints.length>0){const le=Z.elements.find(de=>de.id===te.leftJoints[0]&&de.type===z.Wall);if(le&&le.fill===Ul.Partial){const de=le.rightUnfilledHeight;Math.abs(q-de)<.5&&(q=de)}}_(te,q,Z.enableFineGrid?q:te.rightUnfilledHeight,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.leftUnfilledHeight=q,Z.enableFineGrid&&(te.rightUnfilledHeight=q));break}});break}case xt.WallPartialResizeRight:{w(Z=>{for(const ne of Z.elements)if(ne.id===t&&ne.type===z.Wall){const te=ne;let q=ye.clamp(ae.z-e,0,te.rightTopPartialHeight);if(te.rightJoints.length>0){const le=Z.elements.find(de=>de.id===te.rightJoints[0]&&de.type===z.Wall);if(le&&le.fill===Ul.Partial){const de=le.leftUnfilledHeight;Math.abs(q-de)<.5&&(q=de)}}_(te,Z.enableFineGrid?q:te.leftUnfilledHeight,q,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.rightUnfilledHeight=q,Z.enableFineGrid&&(te.leftUnfilledHeight=q));break}});break}case xt.WallPartialResizeLeftTop:{w(Z=>{const ne=Z.elements.find(te=>te.id===t&&te.type===z.Wall);if(ne){let te=ye.clamp(ae.z-e,ne.leftUnfilledHeight,ne.lz);if(ne.leftJoints.length>0){const q=Z.elements.find(le=>le.id===ne.leftJoints[0]&&le.type===z.Wall);if(q&&q.fill===Ul.Partial){const le=q.rightTopPartialHeight;Math.abs(te-le)<.5&&(te=le)}}_(ne,ne.leftUnfilledHeight,ne.rightUnfilledHeight,te,Z.enableFineGrid?te:ne.rightTopPartialHeight)&&(ne.leftTopPartialHeight=te,Z.enableFineGrid&&(ne.rightTopPartialHeight=te))}});break}case xt.WallPartialResizeRightTop:{w(Z=>{const ne=Z.elements.find(te=>te.id===t&&te.type===z.Wall);if(ne){let te=ye.clamp(ae.z-e,ne.rightUnfilledHeight,ne.lz);if(ne.rightJoints.length>0){const q=Z.elements.find(le=>le.id===ne.rightJoints[0]&&le.type===z.Wall);if(q&&q.fill===Ul.Partial){const le=q.leftTopPartialHeight;Math.abs(te-le)<.5&&(te=le)}}_(ne,ne.leftUnfilledHeight,ne.rightUnfilledHeight,Z.enableFineGrid?te:ne.leftTopPartialHeight,te)&&(ne.rightTopPartialHeight=te,Z.enableFineGrid&&(ne.leftTopPartialHeight=te))}});break}}},ee=()=>{jn.getState().setEnableOrbitController(!0),A(!1),G(),M.current=!1;const $=new Map;n&&F!==Zo.Gable&&F!==Zo.Gambrel&&H.getState().elements.forEach(Z=>{Z.type===z.Wall&&Z.roofId===n&&$.set(Z.id,Z.lz)});const ae={name:"Change Wall Height",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Wall,oldHeights:[...D.current],newHeights:[r*2,a,l,s,c],oldSameBuildingWallsHeightMap:new Map(k.current),newSameBuildingWallsHeightMap:$,undo(){L(this.resizedElementId,this.oldHeights,this.oldSameBuildingWallsHeightMap)},redo(){L(this.resizedElementId,this.newHeights,this.newSameBuildingWallsHeightMap)}};H.getState().addUndoable(ae),w(Z=>{Z.actionState.wallHeight=r*2,Z.resizeHandleType=null})};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Wall Resize Handle Group",onPointerDown:Q,children:[h.jsx(ww,{x:-o,z:-r,handleType:xt.LowerLeft,highLight:p,handleSize:C}),h.jsx(ww,{x:o,z:-r,handleType:xt.LowerRight,highLight:p,handleSize:C}),!x&&h.jsxs(h.Fragment,{children:[h.jsx(ww,{x:-o,z:r,handleType:xt.UpperLeft,highLight:p,handleSize:C}),h.jsx(ww,{x:o,z:r,handleType:xt.UpperRight,highLight:p,handleSize:C}),u===Ul.Partial&&h.jsxs(h.Fragment,{children:[h.jsx(ww,{x:-o,z:-r+a,handleType:xt.WallPartialResizeLeft,highLight:p,handleSize:C,partial:!0}),h.jsx(ww,{x:o,z:-r+l,handleType:xt.WallPartialResizeRight,highLight:p,handleSize:C,partial:!0}),h.jsx(ww,{x:-o,z:-r+s,handleType:xt.WallPartialResizeLeftTop,highLight:p,handleSize:C,partial:!0}),h.jsx(ww,{x:o,z:-r+c,handleType:xt.WallPartialResizeRightTop,highLight:p,handleSize:C,partial:!0})]})]})]}),P&&h.jsx(yi,{ref:R,position:S,rotation:b,args:[1e4,1e4],visible:!1,onPointerMove:oe,onPointerUp:ee,children:h.jsx("meshBasicMaterial",{side:zr})})]})});function Bot(t){return t.type===z.Cuboid}const Udn="/aladdin/assets/building_facade_01-PU9ju7d_.png",jdn="/aladdin/assets/building_facade_02-x--kz-oN.png",Bdn="/aladdin/assets/building_facade_03-BYNjzj26.png",Ydn="/aladdin/assets/building_facade_04-VGO1xPmk.png",Odn="/aladdin/assets/building_facade_05-D5uzq3D-.png",_dn="/aladdin/assets/building_facade_06-ClFD4NV8.png",Vdn="/aladdin/assets/building_facade_07-XvrQxWV-.png",Gdn="/aladdin/assets/building_facade_08-D0kjh0Oz.png",Xdn="/aladdin/assets/building_facade_09-y8kFBOu-.png",Jdn="/aladdin/assets/building_facade_10-B2-exMft.png",Q9=xe.memo(({handleType:t,position:e,size:n,onPointerDown:o,onPointerOver:r,onPointerOut:i})=>{const a=H(FS),l=H($y),s=g.useRef(null),[c,u,d]=e;let f=q8;c===0&&u===0?f=kvt:c===0?f=gL:u===0&&(f=q8);const p=l===t||a===t?Aa:f;return h.jsx(Ys,{ref:s,name:t,args:[n/2,6,6,0,Math.PI],position:[c,u,d],onPointerDown:o,onPointerOver:m=>{r(m,t)},onPointerOut:i,children:h.jsx("meshBasicMaterial",{color:p})})}),Vc=xe.memo(({handleType:t,position:e,size:n,onPointerOver:o,onPointerOut:r})=>{const i=H(Cm),a=H($y),l=g.useRef(null),[s,c,u]=e,d=a===t||i===t?Aa:ll,f=()=>{if(l.current){const p=l.current.localToWorld(new ue(-s*2,-c*2,0));H.getState().set(m=>{m.resizeAnchor.copy(p),m.resizeHandleType=t}),jn.getState().setEnableOrbitController(!1)}};return h.jsx(di,{ref:l,name:t,args:[n,n,n],position:[s,c,u],onPointerDown:f,onPointerMove:p=>{o(p,t)},onPointerOut:r,children:h.jsx("meshBasicMaterial",{color:d})})}),Kdn=({id:t,args:e})=>{const[n,o,r]=e,i=H(pn),a=H(Jn),l=H(M0),s=H(PQ),[c,u]=g.useState(null),{gl:d,raycaster:f}=ti(),p=l2(),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(null),v=g.useMemo(()=>[0,Math.min(-1.2*o,-o-.75)-p*2,$8/2-r],[o,r,p]),b=g.useMemo(()=>[0,Math.max(1.2*o,o+.75)+p*2,$8/2-r],[o,r,p]),T=c!==null,R=!l,M=!s,D=g.useCallback(($,ae)=>{dt.getState().duringCameraInteraction||$.intersections.length>0&&($.intersections[0].object===$.eventObject||$.intersections.length>1&&$.intersections[1].object===$.eventObject)&&(i(ne=>{ne.hoveredHandle=ae;const te=a(t);te&&(ne.selectedElementAngle=te.rotation[2],ne.selectedElementHeight=te.lz)}),ye.isMoveHandle(ae)?d.domElement.style.cursor="move":ae===ai.Upper||ae===ai.Lower?d.domElement.style.cursor="grab":d.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"pointer")},[]),k=g.useCallback(()=>{i($=>{$.hoveredHandle=null}),d.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),N=$=>{const ae=a($);if(!ae)return 0;const Z=ae.rotation[2];return ae.parentId===rr?Z:Z+N(ae.parentId)},U=$=>{switch($){case z.SolarPanel:case z.Human:case z.Flower:case z.Tree:return!0}return!1},W=$=>U($)||$===z.Cuboid,F=$=>{i(ae=>{const Z=ae.elements.find(ve=>ve.id===t);if(!Z)return;const ne=$.clone().setZ(0),te=H.getState().resizeAnchor.clone().setZ(0),q=new ue().subVectors(ne,te).applyEuler(new cn(0,0,-(w.current??0))),le=new ue().addVectors(ne,te).multiplyScalar(.5),{pos:de,rot:he}=ye.getWorldDataById(Z.parentId),me=new ue().subVectors(le,de).applyEuler(new cn(0,0,-he));Z.cx=me.x,Z.cy=me.y;const ce=Math.abs(q.x),Pe=Math.abs(q.y);Z.lx=ce,Z.ly=Pe;const pe=new ue(me.x,me.y,Z.cz).applyEuler(new cn(0,0,he)).add(de),Ie=Z.rotation[2]+he;if(P.current.size>0)for(const ve of ae.elements){const ze=P.current.get(ve.id);if(ze){const Ae=ze.clone().sub(pe).applyEuler(new cn(0,0,-Ie));if(U(ve.type)){const se=A.current.get(ve.id);if(se){const[ge,we]=se;ge==="Top"?(ve.cx=Ae.x,ve.cy=Ae.y):ge==="NS"?(ve.cx=Ae.x,ve.cy=Math.sign(we)*(Pe/2)):ge==="EW"&&(ve.cx=Math.sign(we)*(ce/2),ve.cy=Ae.y)}}else ve.type===z.Cuboid?(ve.cx=Ae.x,ve.cy=Ae.y):(ve.cx=Ae.x/ce,ve.cy=Ae.y/Pe)}}})},E=$=>{i(ae=>{const Z=ae.elements.find(Ie=>Ie.id===t);if(!Z)return;const ne=$.clone().setZ(0),te=H.getState().resizeAnchor.clone().setZ(0),q=new ue().subVectors(ne,te).applyEuler(new cn(0,0,-(w.current??0))),le=new ue().addVectors(ne,te).multiplyScalar(.5),{pos:de,rot:he}=ye.getWorldDataById(Z.parentId),me=new ue().subVectors(le,de).applyEuler(new cn(0,0,-he));Z.cx=me.x;const ce=Math.abs(q.x);Z.lx=ce;const Pe=new ue(me.x,me.y,Z.cz).applyEuler(new cn(0,0,he)).add(de),pe=Z.rotation[2]+he;if(P.current.size>0)for(const Ie of ae.elements){const ve=P.current.get(Ie.id);if(ve){const ze=ve.clone().sub(Pe).applyEuler(new cn(0,0,-pe));if(U(Ie.type)){const Ae=A.current.get(Ie.id);if(Ae){const[se,ge]=Ae;se==="Top"||se==="NS"?Ie.cx=ze.x:se==="EW"&&(Ie.cx=Math.sign(ge)*(ce/2))}}else Ie.type===z.Cuboid?Ie.cx=ze.x:Ie.cx=ze.x/ce}}})},L=$=>{i(ae=>{const Z=ae.elements.find(Ie=>Ie.id===t);if(!Z)return;const ne=$.clone().setZ(0),te=H.getState().resizeAnchor.clone().setZ(0),q=new ue().subVectors(ne,te).applyEuler(new cn(0,0,-(w.current??0))),le=new ue().addVectors(ne,te).multiplyScalar(.5),{pos:de,rot:he}=ye.getWorldDataById(Z.parentId),me=new ue().subVectors(le,de).applyEuler(new cn(0,0,-he));Z.cy=me.y;const ce=Math.abs(q.y);Z.ly=ce;const Pe=new ue(me.x,me.y,Z.cz).applyEuler(new cn(0,0,he)).add(de),pe=Z.rotation[2]+he;if(P.current.size>0)for(const Ie of ae.elements){const ve=P.current.get(Ie.id);if(ve){const ze=ve.clone().sub(Pe).applyEuler(new cn(0,0,-pe));if(U(Ie.type)){const Ae=A.current.get(Ie.id);if(Ae){const[se,ge]=Ae;se==="Top"?Ie.cy=ze.y:se==="NS"?Ie.cy=Math.sign(ge)*(ce/2):se==="EW"&&(Ie.cy=ze.y)}}else Ie.type===z.Cuboid?Ie.cy=ze.y:Ie.cy=ze.y/ce}}})},j=$=>{if(m.current!==null){const ae=Math.max(1,$.z-m.current);i(Z=>{for(const ne of Z.elements)if(ne.id===t&&(ne.lz=ae,ne.cz=ae/2,Z.selectedElementHeight=ae),ne.parentId===t&&U(ne.type)){const te=A.current.get(ne.id);te&&te[0]==="Top"&&(ne.cz=ae/2)}})}},Y=$=>{if(y.current){const[ae,Z]=y.current;let ne=Math.atan2(ae-$.x,$.y-Z)+(H.getState().rotateHandleType===ai.Upper?0:Math.PI);const te=Math.abs(ne)>Math.PI?-Math.sign(ne)*fa:0;x.current&&(ne-=x.current),H.getState().updateElementRotationById(t,0,0,ne+te)}},O=$=>{if($.intersections.length>0&&$.intersections[0].object.name===$.object.name||H.getState().addedCuboidId){const ae=a(t);if(ae&&ae.parentId!==rr){u({position:new ue(0,0,-r),rotation:new cn});const{pos:Z,rot:ne}=ye.getWorldDataById(ae.parentId);C.current=Z,x.current=ne,w.current=ne+ae.rotation[2];const te=new ue(ae.cx,ae.cy,ae.cz).applyEuler(new cn(0,0,ne)).add(Z),q=H.getState().elements.filter(le=>le.parentId===ae.id&&(W(le.type)||ye.isIdentical(le.normal,[0,0,1])));P.current.clear(),A.current.clear();for(const le of q){const de=new ue;U(le.type)?(de.set(le.cx,le.cy,le.cz),Math.abs(le.cz-r)<.01?A.current.set(le.id,["Top",1]):Math.abs(Math.abs(le.cx)-n)<.01?A.current.set(le.id,["EW",Math.sign(le.cx)]):A.current.set(le.id,["NS",Math.sign(le.cy)])):le.type===z.Cuboid?de.set(le.cx,le.cy,le.cz):de.set(le.cx*ae.lx,le.cy*ae.ly,0),de.applyEuler(new cn(0,0,w.current)).add(te),P.current.set(le.id,de)}}i(Z=>{Z.selectedElementIdSet.clear(),Z.selectedElementIdSet.add(t),Z.selectedElement=Z.elements.find(ne=>ne.id===t)??null})}},_=$=>{if($.intersections.length>0&&$.intersections[0].object.name===$.object.name){const ae=$.intersections[0].object,Z=H.getState().cameraDirection,ne=Math.atan2(Z.x,Z.y)+N(t);u({position:ae.position.clone(),rotation:new cn(-$t,ne,0)});const te=ae.localToWorld(new ue);m.current=te.z-r*2;const q=H.getState().elements.filter(le=>le.parentId===t&&U(le.type));A.current.clear();for(const le of q)new ue().set(le.cx,le.cy,le.cz),Math.abs(le.cz-r)<.01&&A.current.set(le.id,["Top",1]);i(le=>{le.selectedElementIdSet.clear(),le.selectedElementIdSet.add(t),le.selectedElement=le.elements.find(de=>de.id===t)??null})}},G=$=>{if($.intersections.length>0&&$.intersections[0].object.name===$.object.name){u({position:new ue(0,0,-r),rotation:new cn(0,0,0)});const ae=$.eventObject;y.current=ae.localToWorld(new ue).toArray();const Z=a(t);Z&&(x.current=N(Z.parentId))}},Q=$=>{if($.intersections.length>0){const ae=$.intersections[0].eventObject.name;switch(ae){case Ho.Lower:case Ho.Upper:case Ho.Left:case Ho.Right:case Ho.Top:{H.getState().set(Z=>{const ne=Z.elements.find(te=>te.id===t)??null;if(ne){if(Z.selectedElement=ne,ne.parentId===rr)for(const te of Z.elements)Z.selectedElementIdSet.has(te.id)&&!ye.isElementAllowedMultipleMoveOnGround(te)&&Z.selectedElementIdSet.delete(te.id);else Z.selectedElementIdSet.clear(),Z.selectedElementIdSet.add(ne.id);Z.moveHandleType=ae}}),jn.getState().setEnableOrbitController(!1);break}}}},oe=$=>{if(S.current){const ae=f.intersectObject(S.current);if(ae.length){const Z=ae[0].point,ne=H.getState().resizeHandleType;ne?ye.isTopResizeHandle(ne)?j(Z):ye.isXResizeHandle(ne)?E(Z):ye.isYResizeHandle(ne)?L(Z):F(Z):H.getState().rotateHandleType&&Y(Z)}}},ee=()=>{u(null),m.current=null,y.current=null,w.current=null,x.current=null,C.current=null};return h.jsxs(h.Fragment,{children:[T&&h.jsx(yi,{name:"Cuboid Intersection Plane",ref:S,args:[1e4,1e4],position:c.position,rotation:c.rotation,visible:!1,onPointerMove:oe,onPointerUp:ee}),h.jsxs("group",{name:"Bottom Resize Handle Group",position:[0,0,-r+p/2],onPointerDown:O,children:[h.jsx(Vc,{handleType:xt.UpperLeft,position:[-n,o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRight,position:[n,o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerLeft,position:[-n,-o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRight,position:[n,-o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Left,position:[-n,0,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Right,position:[n,0,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Upper,position:[0,o,0],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Lower,position:[0,-o,0],size:p,onPointerOver:D,onPointerOut:k})]}),R&&h.jsxs("group",{name:"Cuboid Top Resize Handle Group",onPointerDown:_,children:[h.jsx(Vc,{handleType:xt.LowerLeftTop,position:[-n,-o,r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperLeftTop,position:[-n,o,r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRightTop,position:[n,-o,r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRightTop,position:[n,o,r],size:p,onPointerOver:D,onPointerOut:k})]}),M&&h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Cuboid Move Handle Group",onPointerDown:Q,children:[h.jsx(Q9,{handleType:Ho.Lower,position:[0,-o-p*1.2,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Upper,position:[0,o+p*1.2,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Left,position:[-n-p*1.2,0,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Right,position:[n+p*1.2,0,-r],size:p,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Top,position:[0,0,r],size:p,onPointerOver:D,onPointerOut:k})]}),h.jsxs("group",{name:"Cuboid Rotate Handle Group",onPointerDown:G,children:[h.jsx(MH,{id:t,handleType:ai.Lower,position:v,ratio:p*4,hoverHandle:D,noHoverHandle:k}),h.jsx(MH,{id:t,position:b,handleType:ai.Upper,ratio:p*4,hoverHandle:D,noHoverHandle:k})]})]})]})},$dn=xe.memo(Kdn);class Ii{static getSolarPanelUnitLength(e){const n=H.getState().getPvModule(e.pvModelName);return e.orientation===br.landscape?[n.length,n.width]:[n.width,n.length]}static getRotationFromNormal(e){const[n,o,r]=e;return r===1?new cn(0,0,0):n!==0?new cn($t,0,n*$t,"ZXY"):o!==0?new cn(-o*$t,0,0):new cn}static isNewPositionOk(e){const n=H.getState().elements.find(o=>o.id===e.parentId);if(!n)return!1;switch(n.type){case z.Foundation:{if(!ye.isSolarCollectorWithinHorizontalSurface(e,n))return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(H.getState().overlapWithSibling(e))return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}case z.Cuboid:{if(e.type===z.SolarWaterHeater)break;const o=ye.checkElementOnCuboidState(e,n);if(o===ya.OutsideBoundary)return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(o===ya.OverLap)return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}case z.Wall:{const o=ye.checkElementOnWallState(e,n);if(o===ya.OutsideBoundary)return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(o===ya.OverLap)return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}case z.Roof:{const o=ye.checkElementOnRoofState(e,n);if(o===ya.OutsideBoundary)return co(B.t("message.MoveOutsideBoundaryCancelled",{lng:H.getState().language})),!1;if(o===ya.OverLap)return co(B.t("message.MoveCancelledBecauseOfOverlap",{lng:H.getState().language})),!1;break}}return!0}static getRackCount(e,n,o,r,i){if(e===br.portrait){const a=Math.max(1,Math.round(n/i)),l=Math.max(1,Math.round(o/r));return a*l}else{const a=Math.max(1,Math.round(n/r)),l=Math.max(1,Math.round(o/i));return a*l}}static getSurfaceType(e,n){return!n||!e||e===z.Foundation?qa.Horizontal:e===z.Wall?qa.Vertical:ye.isEqual(n.z,1)?qa.Horizontal:e===z.Cuboid?qa.Vertical:qa.Inclined}static findParentGroup(e,n){const o=e.parent;if(!o)return null;for(const r of n)if(o.name.includes(r))return o;return Ii.findParentGroup(o,n)}static getRoofId(e){if(!e)return null;const n=e.userData.roofId;return n||Ii.getRoofId(e.parent)}static getRoofSegmentData(e){if(!e)return null;const{roofId:n,foundation:o,centroid:r,roofSegments:i}=e.userData;return!n||!o||!r||!i?Ii.getRoofSegmentData(e.parent):{roofId:n,foundation:o,centroid:r,roofSegments:i}}static getRelativeAzimuth(e){return e>Math.PI?e-Math.PI*2:e<-Math.PI?e+Math.PI*2:e}static isTrackerEnabled(e,n){return e===qa.Horizontal&&n!==Bl.NO_TRACKER}static getUnitSize(e,n,o){return e===br.landscape?{length:n,width:o}:{length:o,width:n}}static getRotationOnCuboid(e){const{x:n,y:o,z:r}=e;return ye.isEqual(r,1)?[0,0,0]:ye.isEqual(n,0)&&ye.isEqual(o,1)?[$t,0,Math.PI]:ye.isEqual(n,0)&&ye.isEqual(o,-1)?[$t,0,0]:ye.isEqual(n,-1)&&ye.isEqual(o,0)?[$t,0,-$t]:ye.isEqual(n,1)&&ye.isEqual(o,0)?[$t,0,$t]:[0,0,0]}static getPVModel(e){let n=H.getState().supportedPvModules[e];return n||(n=H.getState().customPvModules[e],n)?n:(console.warn("pvModel undefined. Using default model: SPR-X21-335-BLK"),{name:"SPR-X21-335-BLK",brand:"SunPower",cellType:"Monocrystalline",efficiency:.21,length:1.558,nominalLength:1.56,width:1.046,nominalWidth:1.05,thickness:.046,m:12,n:8,pmax:335,vmpp:57.3,impp:5.85,voc:67.9,isc:6.23,pmaxTC:-.0029,noct:41.5,weight:18.6,color:"Black",shadeTolerance:"High",bifacialityFactor:0})}static addUndoable(e,n){if(e)switch(n){case Fr.Move:{Ii.addUndoableMove(e);break}case Fr.ResizeX:case Fr.ResizeY:{Ii.addUndoableResize(e);break}case Fr.RotateLower:case Fr.RotateUpper:{Ii.addUndoableRotate(e);break}case Fr.Tilt:{Ii.addUndoableTilt(e);break}}}static addUndoableMove(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new ue().fromArray(e.normal),newNormal:new ue().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};H.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{H.getState().set(f=>{const p=f.elements.find(m=>m.id===i);!p||p.type!==z.SolarPanel||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e){const n=H.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarPanel);if(!n)return;const o={name:"Resize Solar Panel",timestamp:Date.now(),id:n.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[n.cx,n.cy,n.cz],newDms:[n.lx,n.ly,n.lz],newRot:[...n.rotation],newNor:[...n.normal],undo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.oldPos],[i.lx,i.ly,i.lz]=[...o.oldDms],i.normal=[...o.oldNor],i.rotation=[...o.oldRot];break}})},redo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.newPos],[i.lx,i.ly,i.lz]=[...o.newDms],i.normal=[...o.newNor],i.rotation=[...o.newRot];break}})}};H.getState().addUndoable(o)}static addUndoableRotate(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Relative Azimuth",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};H.getState().addUndoable(o);const r=i=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.relativeAzimuth=i)})}}static addUndoableTilt(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Tilt",timestamp:Date.now(),changedElementId:n.id,oldValue:e.tiltAngle,newValue:n.tiltAngle,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};H.getState().addUndoable(o);const r=i=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.tiltAngle=i)})}}}const qdn=t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=1,color:l="silver",lineColor:s="black",lineWidth:c=.1,locked:u=!1,showLabel:d=!1,textureTypes:f=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture],stackable:p,transparency:m}=t,y=Fc(e),w=H(pn),x=H(Au),C=H(M0),P=H(Jn),A=H(HS),S=H(y5e),v=H(Jp),b=H(Z3),T=H(H7),R=H(Q3),M=H(u5e),D=H(APt),k=H(z0),N=H(yQ),U=H(O5),W=H(xs),F=H(Fn),E=H(b5e),L=H(M7),j=H(pXe),Y=H(c5e),O=dt(vs),_=H(Df),G=In(O1),Q=H(h4),{camera:oe,gl:{domElement:ee},raycaster:$,mouse:ae}=ti(),[Z,ne]=g.useState(null),[te,q]=g.useState(null),[le,de]=g.useState(null),[he,me]=g.useState(null),[ce,Pe]=g.useState(null),[pe,Ie]=g.useState(!1),[ve,ze]=g.useState(!1),Ae=g.useRef(null),se=g.useRef(null),ge=g.useRef(null),we=g.useRef(Oo),[Se,Me]=g.useState(new ue(0,0,0)),Ce=g.useRef(new cn(0,0,0)),Te=g.useRef(new ue(1,1,1)),Re=g.useRef(new ue),Ne=g.useRef(new ue),_e=g.useRef(new ue),Ue=g.useRef(new ue),qe=g.useRef(new ue(1,1,1)),Fe=g.useRef(new ue(1,1,1)),He=g.useRef(0),Le=g.useRef(0),Ye=g.useRef([]),lt=g.useRef([]),Oe=g.useRef(null),ut=g.useRef(new ue),ht=g.useRef(0),Qe=g.useMemo(()=>({lng:x}),[x]),nt=r/2,mt=i/2,tt=a/2,gt=g.useMemo(()=>new ue,[]),Ve=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.CuboidElement",Qe))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",Qe)+")":"")+(t!=null&&t.label?"":` +`+B.t("word.Coordinates",Qe)+": ("+n.toFixed(1)+", "+o.toFixed(1)+", "+(a/2).toFixed(1)+") "+B.t("word.MeterAbbreviation",Qe)),[t==null?void 0:t.label,t==null?void 0:t.locked,Qe,n,o,a]);g.useEffect(()=>{const An=()=>{ge.current=null,ze(!1),jn.getState().setEnableOrbitController(!0)};return window.addEventListener("pointerup",An),()=>{window.removeEventListener("pointerup",An)}},[]),g.useEffect(()=>{H.getState().tempHumanPlant.length>0&&w(An=>{An.elements.push(...An.tempHumanPlant),An.tempHumanPlant=[]})},[]),g.useEffect(()=>{if(t&&O){const An=_??5,Dn=G(t.id+"-top");Dn&&ne(ye.fetchHeatmapTexture(Dn,An));const sr=G(t.id+"-south");sr&&q(ye.fetchHeatmapTexture(sr,An));const Vo=G(t.id+"-north");Vo&&de(ye.fetchHeatmapTexture(Vo,An));const Wo=G(t.id+"-west");Wo&&me(ye.fetchHeatmapTexture(Wo,An));const To=G(t.id+"-east");To&&Pe(ye.fetchHeatmapTexture(To,An,!0))}},[O,_]);const je=An=>{switch(An){case Do.Facade01:return Udn;case Do.Facade02:return jdn;case Do.Facade03:return Bdn;case Do.Facade04:return Ydn;case Do.Facade05:return Odn;case Do.Facade06:return _dn;case Do.Facade07:return Vdn;case Do.Facade08:return Gdn;case Do.Facade09:return Xdn;case Do.Facade10:return Jdn;default:return Gg}},et=An=>{switch(An){case Do.Facade01:return{x:14,y:6.5};case Do.Facade02:return{x:14,y:6.5};case Do.Facade03:return{x:10,y:12};case Do.Facade04:return{x:20,y:11};case Do.Facade05:return{x:15,y:10};case Do.Facade06:return{x:11,y:3.5};case Do.Facade07:return{x:11,y:10};case Do.Facade08:return{x:16,y:9};case Do.Facade09:return{x:10,y:9};case Do.Facade10:return{x:12,y:9};default:return{x:1,y:1}}},bt=g.useMemo(()=>new Qg().load(f?je(f[0]):Gg,An=>{const Dn=et(f[0]);An.repeat.set(i/Dn.x,a/Dn.y),An.rotation=$t,An.center.x=1,An.center.y=0,An.wrapS=An.wrapT=es,Pt(An)}),[f[0],i,a]),[St,Pt]=g.useState(bt),Yt=g.useMemo(()=>new Qg().load(f?je(f[1]):Gg,An=>{const Dn=et(f[1]);An.repeat.set(i/Dn.x,a/Dn.y),An.rotation=-$t,An.wrapS=An.wrapT=es,Rt(An)}),[f[1],i,a]),[zt,Rt]=g.useState(Yt),Ct=g.useMemo(()=>new Qg().load(f?je(f[2]):Gg,An=>{const Dn=et(f[2]);An.repeat.set(r/Dn.x,a/Dn.y),An.rotation=Math.PI,An.center.x=0,An.center.y=1,An.wrapS=An.wrapT=es,at(An)}),[f[2],r,a]),[yt,at]=g.useState(Ct),Et=g.useMemo(()=>new Qg().load(f?je(f[3]):Gg,An=>{const Dn=et(f[3]);An.repeat.set(r/Dn.x,a/Dn.y),An.wrapS=An.wrapT=es,Je(An)}),[f[3],r,a]),[Lt,Je]=g.useState(Et),st=g.useMemo(()=>new Qg().load(f?je(f[4]):Gg,An=>{const Dn=et(f[4]);An.repeat.set(r/Dn.x,i/Dn.y),An.wrapS=An.wrapT=es,ot(An)}),[f[4],r,i]),[It,ot]=g.useState(st);g.useEffect(()=>{Ip()},[f]);const it=An=>{switch(An){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:return!0}return!1},Be=An=>{switch(An){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.Human:case z.Tree:case z.Flower:return!0}return!1},pt=An=>{we.current=An;const Dn=.01;ye.isSame(we.current,Oo)?(Me(new ue(0,0,tt+Dn)),Ce.current=new cn(0,0,0),Te.current.set(nt,mt,tt)):ye.isSame(we.current,b1)?(Me(new ue(nt+Dn,0,0)),Ce.current=new cn(0,$t,0),Te.current.set(tt,mt,nt)):ye.isSame(we.current,S1)?(Me(new ue(-nt-Dn,0,0)),Ce.current=new cn(0,-$t,0),Te.current.set(tt,mt,nt)):ye.isSame(we.current,T1)?(Me(new ue(0,-mt-Dn,0)),Ce.current=new cn($t,0,0),Te.current.set(nt,tt,mt)):ye.isSame(we.current,Zc)&&(Me(new ue(0,mt+Dn,0)),Ce.current=new cn(-$t,0,0),Te.current.set(nt,tt,mt))},ct=Math.max(1,Math.max(r,i)/8),Xe=Tm*ct,ft=An=>{var Vo,Wo;const Dn=An.intersections[0];if(H.getState().objectTypeToAdd===z.SolarPanel){const To=Dn.point,{pos:Go,rot:No}=ye.getWorldDataById(e),ho=new ue().subVectors(To,Go).applyEuler(new cn(0,0,-No)),vo=((Vo=Dn.face)==null?void 0:Vo.normal)??new ue(0,0,1);let bo=H.getState().getPvModule(H.getState().actionState.solarPanelModelName??g3);bo||(bo=H.getState().getPvModule(g3));const Bo=Qa.makeSolarPanel(t,bo,ho.x,ho.y,ho.z,H.getState().actionState.solarPanelOrientation??br.landscape,H.getState().actionState.solarPanelPoleHeight??1,H.getState().actionState.solarPanelPoleSpacing??3,H.getState().actionState.solarPanelTiltAngle??0,H.getState().actionState.solarPanelRelativeAzimuth??0,vo,Ii.getRotationOnCuboid(vo),H.getState().actionState.solarPanelFrameColor??"white");return w(Pr=>{Pr.elements.push(Bo)}),Bo}else return S(t,Dn.point,(Wo=Dn.face)==null?void 0:Wo.normal)},wt=An=>{if(An.button===2)return;E()||k(e,An,er.Select);const Dn=A();let sr=!1;if(An.intersections[0].object.name===z.Polygon&&H.getState().objectTypeToAdd!==z.None&&(sr=!0),(Dn==null?void 0:Dn.id)===e||sr)if(Be(H.getState().objectTypeToAdd)&&t){ze(!0);const Vo=ft(An);if(Vo){const Wo={name:"Add",timestamp:Date.now(),addedElement:Vo,undo:()=>{v(Wo.addedElement.id,!1)},redo:()=>{w(To=>{To.elements.push(Wo.addedElement),To.selectedElement=Wo.addedElement})}};F(Wo),w(To=>{To.selectedElementIdSet.clear(),To.selectedElementIdSet.add(Vo.id),To.selectedElement=Vo,To.objectTypeToAdd=z.None})}}else jn.getState().selectNone(),jn.setState({cuboidRef:Ae});else if(Dn&&Dn.parentId===e&&it(Dn.type)){ze(!0);const{rot:Vo,pos:Wo}=ye.getWorldDataById(e);ut.current.copy(Wo),ht.current=Vo,ge.current=Dn;let To;for(const Go of An.intersections)if(Go.object===se.current){To=Go.face;break}switch(To&&pt(To.normal),jn.getState().setEnableOrbitController(!1),Re.current.x=Dn.cx,Re.current.y=Dn.cy,Re.current.z=Dn.cz,_e.current.fromArray(Dn.normal),qe.current.x=Dn.lx,qe.current.y=Dn.ly,qe.current.z=Dn.lz,Dn.type){case z.SolarPanel:He.current=Dn.relativeAzimuth,dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e);break;case z.Polygon:Ye.current=Dn.vertices.map(Go=>({...Go}));break}}},kt=An=>{var No,ho;if(!se.current)return;const Dn=$.intersectObjects([se.current]);if(Dn.length===0)return;const sr=Dn[0].face;if(!sr)return;const Vo=O0.getIntersectionObjects(An);if(Vo.length===0||Vo[0].eventObject.userData.id!==e){Eo(!1),ge.current=null;return}const Wo=H.getState().selectedElement;if(!!(Wo&&!Wo.locked&&Wo.type===z.SolarPanel&&H.getState().moveHandleType)&&(ge.current=Wo),sr.normal.z===1&&((No=ge.current)==null?void 0:No.type)!==z.Polygon){const vo=!!(((ho=ge.current)==null?void 0:ho.type)===z.SolarPanel&&(H.getState().moveHandleType||H.getState().rotateHandleType||H.getState().resizeHandleType)&&!ge.current.locked);Eo(vo),vo&&(gt.set(0,0,ge.current.poleHeight+a/2),pt(new ue(0,0,1)),ze(!0));return}else if(Eo(!1),ge.current&&t&&!ge.current.locked){const vo=new _t(An.offsetX/ee.clientWidth*2-1,1-An.offsetY/ee.clientHeight*2);$.setFromCamera(vo,oe);let bo=Dn[0].point;if(H.getState().moveHandleType){const Bo=sr.normal;if(pt(Bo),bo=ye.relativeCoordinates(bo.x,bo.y,bo.z,t),ge.current.type===z.Polygon){const Pr=ge.current;if(H.getState().moveHandleType===Ho.Default){const so=ye.calculatePolygonCentroid(Ye.current),zo=new ue().fromArray(Pr.normal);let Ci,ea;ye.isSame(zo,b1)?(Ci=-(so.x+bo.z),ea=bo.y-so.y):ye.isSame(zo,S1)?(Ci=bo.z-so.x,ea=bo.y-so.y):ye.isSame(zo,Zc)?(Ci=bo.x-so.x,ea=-(so.y+bo.z)):ye.isSame(zo,T1)?(Ci=bo.x-so.x,ea=bo.z-so.y):(Ci=bo.x-so.x,ea=bo.y-so.y);const rs=Ye.current.map(Da=>({...Da}));rs.forEach(Da=>{Da.x+=Ci,Da.y+=ea}),L(Pr.id,rs)}}else R(ge.current.id,bo.x,bo.y,bo.z),D(ge.current.id,Bo.x,Bo.y,Bo.z),ge.current.parentId!==e&&H.getState().set(Pr=>{const so=Pr.elements.find(zo=>{var Ci;return zo.id===((Ci=ge.current)==null?void 0:Ci.id)&&zo.type===z.SolarPanel});so&&(so.parentId!==e||so.foundationId!==e)&&(so.parentId=e,so.foundationId=e,so.parentType=z.Cuboid,Pr.selectedElement&&(Pr.selectedElement.parentId=e,so.color=Pr.selectedElement.color))})}else if(H.getState().resizeHandleType)switch(ge.current.type){case z.SolarPanel:{const Bo=ge.current;if(Bo.normal[2]===1)break;const[Pr,so]=Ii.getSolarPanelUnitLength(Bo),zo=H.getState().resizeAnchor,Ci=H.getState().resizeHandleType;if(Ci===xt.Lower||Ci===xt.Upper){const rs=Math.max(1,Math.round(Math.abs(bo.z-zo.z)/so))*so,Da=new ue(0,0,bo.z-zo.z).normalize().multiplyScalar(rs),or=new ue().addVectors(zo,Da.clone().divideScalar(2));w(cr=>{const ii=cr.elements.find(Ga=>Ga.id===Bo.id);ii&&(ii.cz=(or.z-ut.current.z)/a,ii.ly=Math.abs(Da.z))})}else if(Ci===xt.Left||Ci===xt.Right){const ea=new ue().subVectors(bo,zo).setZ(0),Da=Math.max(1,Math.round(ea.length()/Pr))*Pr,or=ea.clone().normalize().multiplyScalar(Da),cr=new ue().addVectors(zo,or.clone().divideScalar(2)),ii=new ue().subVectors(cr,ut.current).applyEuler(new cn(0,0,-ht.current));w(Ga=>{const xi=Ga.elements.find(Uu=>Uu.id===Bo.id);xi&&(Math.abs(Math.abs(xi.normal[1])-1)<.01?xi.cx=ii.x/r:xi.cy=ii.y/i,xi.lx=or.length())})}break}case z.Polygon:{if(H.getState().resizeHandleType===xt.Default){let Bo=new ue(bo.x-ut.current.x,bo.y-ut.current.y,0).applyEuler(new cn(0,0,-ht.current,"ZXY"));const Pr=ge.current,so=new ue().fromArray(Pr.normal);let zo,Ci;ye.isSame(so,b1)?(zo=t.lz,Ci=t.ly,Bo.x=-bo.z+ut.current.z):ye.isSame(so,S1)?(zo=t.lz,Ci=t.ly,Bo.x=bo.z-ut.current.z):ye.isSame(so,Zc)?(zo=t.lx,Ci=t.lz,Bo.y=-bo.z+ut.current.z):ye.isSame(so,T1)?(zo=t.lx,Ci=t.lz,Bo.y=bo.z-ut.current.z):(zo=t.lx,Ci=t.ly),Bo=H.getState().enableFineGrid?ye.snapToFineGrid(Bo):ye.snapToNormalGrid(Bo),Bo.x/=zo,Bo.y/=Ci,j(Pr.id,Pr.selectedIndex,Bo.x,Bo.y)}break}}ze(!0)}},Zt=An=>{if(Oe.current&&ge.current&&t){if(ge.current.type!==z.SolarPanel)return;const Dn=ge.current;if(Dn.locked)return;$.setFromCamera(ae,oe);const sr=$.intersectObjects([Oe.current]);if(sr.length>0){let Vo=sr[0].point.clone();if(H.getState().moveHandleType)Vo=ye.relativeCoordinates(Vo.x,Vo.y,Vo.z-Dn.poleHeight,t),R(Dn.id,Vo.x,Vo.y,Vo.z),D(ge.current.id,0,0,1),ge.current.parentId!==e&&H.getState().set(Wo=>{const To=Wo.elements.find(Go=>{var No;return Go.id===((No=ge.current)==null?void 0:No.id)&&Go.type===z.SolarPanel});To&&(To.parentId!==e||To.foundationId!==e)&&(To.parentId=e,To.foundationId=e,To.parentType=z.Cuboid,Wo.selectedElement&&(Wo.selectedElement.parentId=e,To.color=Wo.selectedElement.color))});else if(H.getState().rotateHandleType&&H.getState().rotateHandleType!==ai.Tilt){const Wo=ht.current,To=new _t(ut.current.x,ut.current.y),Go=new _t(t.lx*Dn.cx,t.ly*Dn.cy).rotateAround(ui,Wo),No=new _t().addVectors(Go,To),ho=-Wo+Math.atan2(-Vo.x+No.x,Vo.y-No.y)+(H.getState().rotateHandleType===ai.Lower?0:Math.PI),vo=Math.abs(ho)>Math.PI?-Math.sign(ho)*fa:0,bo=ho+vo;N(Dn.id,bo),Le.current=bo}else if(H.getState().resizeHandleType){const Wo=H.getState().resizeAnchor,To=U(Dn.pvModelName),Go=new _t(Vo.x,Vo.y),No=new _t(Wo.x,Wo.y),ho=Go.distanceTo(No),vo=Dn.relativeAzimuth+ht.current,bo=new _t().subVectors(Go,No);switch(H.getState().resizeHandleType){case xt.Lower:case xt.Upper:{const Bo=H.getState().resizeHandleType===xt.Lower?1:-1,Pr=bo.angle()-vo+Bo*$t;let so=ho*Math.cos(Pr);Dn.orientation===br.portrait?so=Math.max(1,Math.ceil((so-To.length/2)/To.length))*To.length:so=Math.max(1,Math.ceil((so-To.width/2)/To.width))*To.width;const zo=Wo.x+Bo*(so*Math.sin(vo))/2,Ci=Wo.y-Bo*(so*Math.cos(vo))/2,ea=new _t(zo,Ci),rs=new _t(ut.current.x,ut.current.y),Da=new _t().subVectors(ea,rs).rotateAround(ui,-ht.current),or=Da.x/r,cr=Da.y/i;qt(Dn,or,cr,Dn.lx,so)&&(T(Dn.id,so),R(Dn.id,or,cr));break}case xt.Left:case xt.Right:{const Bo=H.getState().resizeHandleType===xt.Left?-1:1,Pr=bo.angle()-vo+(H.getState().resizeHandleType===xt.Left?Math.PI:0);let so=ho*Math.cos(Pr);Dn.orientation===br.portrait?so=Math.max(1,Math.ceil((so-To.width/2)/To.width))*To.width:so=Math.max(1,Math.ceil((so-To.length/2)/To.length))*To.length;const zo=Wo.x+Bo*(so*Math.cos(vo))/2,Ci=Wo.y+Bo*(so*Math.sin(vo))/2,ea=new _t(zo,Ci),rs=new _t(ut.current.x,ut.current.y),Da=new _t().subVectors(ea,rs).rotateAround(ui,-ht.current),or=Da.x/r,cr=Da.y/i;qt(Dn,or,cr,so,Dn.ly)&&(b(Dn.id,so),R(Dn.id,or,cr));break}}}}}},Ot=(An,Dn,sr)=>{const Vo=JSON.parse(JSON.stringify(An));return Vo.cx=Dn,Vo.cy=sr,Y(Vo)?(co(B.t("message.MoveCancelledBecauseOfOverlap",Qe)),!1):ye.isIdentical(An.normal,fs)&&!ye.isSolarCollectorWithinHorizontalSurface(Vo,t)?(co(B.t("message.MoveOutsideBoundaryCancelled",Qe)),!1):!0},on=(An,Dn)=>{const sr=JSON.parse(JSON.stringify(An));return sr.relativeAzimuth=Dn,Y(sr)?(co(B.t("message.RotationCancelledBecauseOfOverlap",Qe)),!1):ye.isSolarCollectorWithinHorizontalSurface(sr,t)?!0:(co(B.t("message.RotationOutsideBoundaryCancelled",Qe)),!1)},qt=(An,Dn,sr,Vo,Wo)=>{if(An.tiltAngle!==0&&.5*Wo*Math.abs(Math.sin(An.tiltAngle))>An.poleHeight)return!1;const To=JSON.parse(JSON.stringify(An));return To.cx=Dn,To.cy=sr,To.lx=Vo,To.ly=Wo,!!ye.isSolarCollectorWithinHorizontalSurface(To,t)},rn=()=>{if(!ge.current)return;const An=P(ge.current.id);if(An){if(An.type===z.Polygon){if(H.getState().moveHandleType||H.getState().resizeHandleType){lt.current=An.vertices.map(sr=>({...sr}));const Dn={name:H.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:Ye.current,newValue:lt.current,changedElementId:An.id,changedElementType:An.type,undo:()=>{L(Dn.changedElementId,Dn.oldValue)},redo:()=>{L(Dn.changedElementId,Dn.newValue)}};F(Dn)}}else if(H.getState().resizeHandleType){if(Ne.current.x=An.cx,Ne.current.y=An.cy,Ne.current.z=An.cz,Fe.current.x=An.lx,Fe.current.y=An.ly,Fe.current.z=An.lz,Ne.current.distanceToSquared(Re.current)>Ht&&Fe.current.distanceToSquared(qe.current)>Ht){const Dn={name:"Resize",timestamp:Date.now(),resizedElementId:ge.current.id,resizedElementType:ge.current.type,oldCx:Re.current.x,oldCy:Re.current.y,oldCz:Re.current.z,newCx:Ne.current.x,newCy:Ne.current.y,newCz:Ne.current.z,oldLx:qe.current.x,oldLy:qe.current.y,oldLz:qe.current.z,newLx:Fe.current.x,newLy:Fe.current.y,newLz:Fe.current.z,undo:()=>{R(Dn.resizedElementId,Dn.oldCx,Dn.oldCy,Dn.oldCz),M(Dn.resizedElementId,Dn.oldLx,Dn.oldLy,Dn.oldLz)},redo:()=>{R(Dn.resizedElementId,Dn.newCx,Dn.newCy,Dn.newCz),M(Dn.resizedElementId,Dn.newLx,Dn.newLy,Dn.newLz)}};F(Dn)}}else if(H.getState().rotateHandleType){if(ge.current.type===z.SolarPanel){const Dn=ge.current;if(Math.abs(Le.current-He.current)>Ht)if(on(Dn,Le.current)){w(Vo=>{Vo.selectedElementAngle=Le.current});const sr={name:"Rotate",timestamp:Date.now(),oldValue:He.current,newValue:Le.current,changedElementId:Dn.id,changedElementType:Dn.type,undo:()=>{N(sr.changedElementId,sr.oldValue)},redo:()=>{N(sr.changedElementId,sr.newValue)}};F(sr)}else N(Dn.id,He.current)}}else if(Ne.current.x=An.cx,Ne.current.y=An.cy,Ne.current.z=An.cz,Ue.current.fromArray(An.normal),Ne.current.distanceToSquared(Re.current)>Ht){let Dn=!0;An.type===z.SolarPanel&&(Dn=Ot(An,An.cx,An.cy)),Dn?O0.addUndoableMove():w(sr=>{const Vo=sr.elements.find(No=>No.id===An.id);if(!Vo||!sr.selectedElement)return;const Wo=sr.selectedElement;Vo.cx=Wo.cx,Vo.cy=Wo.cy,Vo.cz=Wo.cz,Vo.rotation=[...Wo.rotation],Vo.normal=[...Wo.normal];const To=dt.getState().oldParentId,Go=dt.getState().oldFoundationId;To&&(Vo.parentId=To),Go&&(Vo.foundationId=Go)})}ge.current=null}},Pn=An=>{An.intersections.length>0&&An.intersections[0].object===se.current&&Ie(!0)},fo=An=>{ge.current&&ye.isPlantOrHuman(ge.current)&&An.intersections[0].object===se.current&&ze(!0)},to=()=>{Ie(!1),ze(!1)},Dt=An=>{k(e,An,er.ContextMenu),w(Dn=>{Dn.pastePoint.copy(An.intersections[0].point);const sr=An.intersections[0].face;sr&&(Dn.pasteNormal=sr.normal.clone(),ye.isSame(sr.normal,b1)?Dn.selectedSideIndex=0:ye.isSame(sr.normal,S1)?Dn.selectedSideIndex=1:ye.isSame(sr.normal,Zc)?Dn.selectedSideIndex=2:ye.isSame(sr.normal,T1)?Dn.selectedSideIndex=3:ye.isSame(sr.normal,Oo)&&(Dn.selectedSideIndex=4)),Dn.clickObjectType=z.Cuboid,An.intersections.length>0&&An.intersections[0].object===se.current&&(Dn.contextMenuObjectType=z.Cuboid)})},{transparent:fn,opacity:kn}=pI(m!==void 0&&m>0,1-(m??0));g.useEffect(()=>{if(se.current)for(let An=0;An<6;An++)se.current.material[An].needsUpdate=!0},[fn]);const yo=[0,1,2,3,4,5],ur=[O&&ce?ce:St,O&&he?he:zt,O&&le?le:yt,O&&te?te:Lt,O&&Z?Z:It,null],lr=t&&t.faceColors?yo.map(An=>f&&f[An]!==Do.NoTexture?O?h.jsx("meshBasicMaterial",{side:$i,attach:`material-${An}`,color:"white",map:ur[An],transparent:fn,opacity:kn},An):h.jsx("meshStandardMaterial",{side:$i,attach:`material-${An}`,color:"white",map:ur[An],transparent:fn,opacity:kn},An):O?h.jsx("meshBasicMaterial",{side:$i,attach:`material-${An}`,color:"white",map:ur[An],transparent:fn,opacity:kn},An):h.jsx("meshStandardMaterial",{side:$i,attach:`material-${An}`,color:t.faceColors?t.faceColors[An]:l,map:ur[An],transparent:fn,opacity:kn},An)):h.jsx("meshStandardMaterial",{side:$i,color:l,transparent:fn,opacity:kn}),xo=g.useMemo(()=>[nt,mt,tt],[nt,mt,tt]),wo=y&&!u,[Rr,Eo]=g.useState(!1);return h.jsxs("group",{ref:Ae,name:"Cuboid Group "+e,children:[h.jsx(di,{castShadow:W,receiveShadow:W,userData:{simulation:!0,stand:!0,stackable:p,id:e,aabb:!0},uuid:e,ref:se,args:[r,i,a],name:"Cuboid "+e,onContextMenu:Dt,onPointerDown:wt,onPointerMove:kt,onPointerUp:rn,onPointerOver:Pn,onPointerOut:to,onPointerEnter:fo,children:lr}),Rr&&h.jsx(yi,{ref:Oe,name:"Intersection Plane",position:gt,args:[r,i],visible:!1,onPointerMove:Zt}),ve&&h.jsxs(h.Fragment,{children:[(H.getState().moveHandleType||H.getState().resizeHandleType)&&h.jsx(C5e,{hx:Te.current.x,hy:Te.current.y,hz:Te.current.z,position:Se,rotation:Ce.current}),H.getState().rotateHandleType&&ge.current&&ge.current.type===z.SolarPanel&&h.jsx(j3e,{element:ge.current,height:ge.current.poleHeight+tt})]}),y&&h.jsx(B3e,{element:t,verticalLift:Xe}),(m||!y||Q)&&h.jsx(o4,{hx:nt,hy:mt,hz:tt,lineColor:m||Q&&C?"white":s,lineWidth:m?c*15:Q&&C?c*5:c}),y&&u&&h.jsx(o4,{hx:nt,hy:mt,hz:tt,lineColor:i0,lineWidth:c*5}),wo&&h.jsx($dn,{id:e,args:xo}),(pe||d)&&!y&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:Ve,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,tt+((t==null?void 0:t.labelHeight)??.2)]})]})},Qdn=xe.memo(qdn),Yot=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="white",lineColor:d="black",lineWidth:f=.1,locked:p=!1,label:m,showLabel:y=!1,parentId:w,foundationId:x,light:C=!0,heatFlux:P=!1}=t,A=H(pn),S=H(xs),v=H(z0),b=Fc(e),{gl:{domElement:T}}=ti(),[R,M]=g.useState(!1),D=g.useRef(null),k=g.useRef(null),N=Kt(),U=H(_=>{for(const G of _.elements)if(G.id===w)return G}),W=H(_=>{for(const G of _.elements)if(G.id===x)return G});let F=n,E=o,L=r;if(w&&U)switch(U.type){case z.Foundation:{if(L=U.cz+U.lz/2,ye.isZero(s[2]))F=U.cx+n*U.lx,E=U.cy+o*U.ly;else{const _=new ue(n*U.lx,o*U.ly,0);_.applyAxisAngle(Oo,s[2]),F=U.cx+_.x,E=U.cy+_.y}break}case z.Wall:{if((W==null?void 0:W.type)===z.Foundation){const _=ye.absoluteCoordinates(n,o,r,U,W);F=_.x,E=_.y,L=_.z}break}case z.Roof:{if((W==null?void 0:W.type)===z.Foundation){const _=ye.absoluteCoordinates(n*W.lx,o*W.ly,r+W.cz,U,W);F=_.x,E=_.y,L=_.z+l/2}break}}const j=l/2,Y=g.useMemo(()=>{if((U==null?void 0:U.type)===z.Wall){const G=U,Q=W?W.rotation[2]+G.relativeAngle:G.relativeAngle;return new cn($t,0,Q,"ZXY")}if((U==null?void 0:U.type)===z.Roof)return new cn(s[0],s[1],W?W.rotation[2]+s[2]:s[2],"ZXY");if((U==null?void 0:U.type)===z.Cuboid)return Ii.getRotationFromNormal(c);const _=new ue().fromArray(c);return ye.isSame(_,b1)?new cn(0,$t,s[2],"ZXY"):ye.isSame(_,S1)?new cn(0,-$t,s[2],"ZXY"):ye.isSame(_,Zc)?new cn(-$t,0,s[2],"ZXY"):ye.isSame(_,T1)?new cn($t,0,s[2],"ZXY"):new cn(0,0,s[2])},[c,s,W==null?void 0:W.rotation]),O=g.useMemo(()=>(m||B.t("shared.SensorElement",N))+(p?" ("+B.t("shared.ElementLocked",N)+")":"")+` +`+B.t("word.Coordinates",N)+": ("+F.toFixed(1)+", "+E.toFixed(1)+", "+L.toFixed(1)+") "+B.t("word.MeterAbbreviation",N),[m,p,N,F,E,L]);return h.jsxs("group",{name:"Sensor Group "+e,rotation:Y,position:[F,E,L+j],children:[h.jsx(di,{receiveShadow:S,uuid:e,ref:D,args:[i,a,l],name:"Sensor",onPointerDown:_=>{_.button!==2&&(v(e,_,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=w,G.oldParentId=w,G.oldFoundationId=x}),A(G=>{G.moveHandleType=Ho.Default}))},onContextMenu:_=>{v(e,_,er.ContextMenu),A(G=>{_.intersections.length>0&&_.intersections[0].object===D.current&&(G.contextMenuObjectType=z.Sensor)})},onPointerOver:_=>{_.intersections.length>0&&_.intersections[0].object===D.current&&(M(!0),T.style.cursor="move")},onPointerOut:()=>{M(!1),T.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:t!=null&&t.lit?Aa:u})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Meter",castShadow:!1,receiveShadow:!1,args:[i*.3,a*.3,j,8,1],position:new ue(0,0,j),rotation:[$t,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:"black"})}),!b&&h.jsx(o4,{hx:i/2,hy:a/2,hz:l/2,lineColor:d,lineWidth:f}),b&&p&&h.jsx(o4,{hx:i/2,hy:a/2,hz:l/2,lineColor:i0,lineWidth:f*10}),b&&!p&&h.jsx(Ys,{ref:k,position:new ue(0,0,0),args:[Tm,6,6,0,Math.PI],name:Ho.Default,onPointerDown:_=>{_.button===2?(v(e,_,er.ContextMenu),A(G=>{_.intersections.length>0&&_.intersections[0].object===k.current&&(G.contextMenuObjectType=z.Sensor)})):v(e,_,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=w,G.oldParentId=w,G.oldFoundationId=x}),A(G=>{G.moveHandleType=Ho.Default})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(R||y)&&!b&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:O,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l+((t==null?void 0:t.labelHeight)??.2)]})]})}),Oot=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="#ffff99",lineWidth:d=.1,locked:f=!1,label:p,showLabel:m=!1,parentId:y,foundationId:w,decay:x=2,distance:C=5,intensity:P=3,inside:A=!1}=t,S=H(pn),v=H(xs),b=H(z0),R=H(I7).z<=0,M=Fc(e),{gl:{domElement:D}}=ti(),[k,N]=g.useState(!1),U=g.useRef(null),W=g.useRef(null),F=Kt(),E=H(ee=>{for(const $ of ee.elements)if($.id===y)return $}),L=H(ee=>{for(const $ of ee.elements)if($.id===w)return $});let j=.1,Y=n,O=o,_=r;if(y&&E)switch(E.type){case z.Foundation:if(_=E.cz+E.lz/2,ye.isZero(s[2]))Y=E.cx+n*E.lx,O=E.cy+o*E.ly;else{const ee=new ue(n*E.lx,o*E.ly,0);ee.applyAxisAngle(Oo,s[2]),Y=E.cx+ee.x,O=E.cy+ee.y}break;case z.Wall:if((L==null?void 0:L.type)===z.Foundation){const ee=ye.absoluteCoordinates(n,o,r,E,L);Y=ee.x,O=ee.y,_=ee.z}j=E.ly;break;case z.Roof:if((L==null?void 0:L.type)===z.Foundation){const ee=ye.absoluteCoordinates(n*L.lx,o*L.ly,r+L.cz,E,L);Y=ee.x,O=ee.y,_=ee.z+l/2}j=E.thickness;break}const G=l/2,Q=g.useMemo(()=>{if((E==null?void 0:E.type)===z.Wall){const $=E,ae=L?L.rotation[2]+$.relativeAngle:$.relativeAngle;return new cn($t,0,ae,"ZXY")}if((E==null?void 0:E.type)===z.Roof)return new cn(s[0],s[1],L?L.rotation[2]+s[2]:s[2],"ZXY");if((E==null?void 0:E.type)===z.Cuboid)return Ii.getRotationFromNormal(c);const ee=new ue().fromArray(c);return ye.isSame(ee,b1)?new cn(0,$t,s[2],"ZXY"):ye.isSame(ee,S1)?new cn(0,-$t,s[2],"ZXY"):ye.isSame(ee,Zc)?new cn(-$t,0,s[2],"ZXY"):ye.isSame(ee,T1)?new cn($t,0,s[2],"ZXY"):new cn(0,0,s[2])},[c,s,L,E]),oe=g.useMemo(()=>(p||B.t("shared.LightElement",F))+(f?" ("+B.t("shared.ElementLocked",F)+")":"")+` +`+B.t("word.Coordinates",F)+": ("+Y.toFixed(1)+", "+O.toFixed(1)+", "+_.toFixed(1)+") "+B.t("word.MeterAbbreviation",F),[p,f,F,Y,O,_]);return h.jsxs("group",{name:"Light Group "+e,rotation:Q,position:[Y,O,_],children:[R&&h.jsx("pointLight",{color:u,name:"Point Light "+e,position:[0,0,A?-j-G:G],decay:x*.2,distance:C,intensity:P,castShadow:!0}),h.jsx(wa,{receiveShadow:v,userData:{unintersectable:!0},uuid:e,ref:U,position:[0,0,A?-j:0],rotation:[$t,0,0],args:[i*.5,a*.5,G,16,1],name:"Light Base",onPointerDown:ee=>{ee.button!==2&&(b(e,ee,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set($=>{$.showWallIntersectionPlaneId=y,$.oldParentId=y,$.oldFoundationId=w}))},onContextMenu:ee=>{b(e,ee,er.ContextMenu),S($=>{ee.intersections.length>0&&ee.intersections[0].object===U.current&&($.contextMenuObjectType=z.Light)})},onPointerOver:ee=>{ee.intersections.length>0&&ee.intersections[0].object===U.current&&(N(!0),D.style.cursor="move")},onPointerOut:()=>{N(!1),D.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:"lightgray"})}),h.jsx(Ys,{userData:{unintersectable:!0},name:"Light Bulb",castShadow:!1,receiveShadow:v,args:[i*.3,8,8,0,fa,0,Math.PI],position:new ue(0,0,A?-j-G:G),rotation:[$t,0,0],children:R?h.jsx("meshBasicMaterial",{attach:"material",color:"white"}):h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),M&&f&&h.jsx(o4,{hx:i/2,hy:a/2,hz:l/2,lineColor:i0,lineWidth:d*10}),M&&!f&&h.jsx(Ys,{ref:W,position:new ue(0,0,A?-j-G:G),args:[Tm,6,6,A?Math.PI:0,Math.PI],name:Ho.Default,onPointerDown:ee=>{ee.button===2?(b(e,ee,er.ContextMenu),S($=>{ee.intersections.length>0&&ee.intersections[0].object===W.current&&($.contextMenuObjectType=z.Light)})):b(e,ee,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set($=>{$.showWallIntersectionPlaneId=y,$.oldParentId=y,$.oldFoundationId=w})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(k||m)&&!M&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:oe,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(A?-j:0)+l+((t==null?void 0:t.labelHeight)??.2)]})]})}),Vv="Cuboid Wrapper",_ot="Cuboid Stackable Child",Vot=({elements:t,cuboidModel:e})=>{const{id:n,cx:o,cy:r,lx:i,ly:a,lz:l,rotation:s}=e,c=l/2,u=d=>Bot(d)&&d.parentId===n;return h.jsxs("group",{name:Vv,position:[o,r,c],rotation:[0,0,s[2]],userData:{id:n,fId:n},children:[h.jsx(Qdn,{...e}),h.jsx(V3e,{parentId:n,foundationId:n,wrapperType:z.Cuboid,plx:i,ply:a,plz:l}),t.map(d=>{if(u(d))return h.jsx("group",{name:_ot,position:[0,0,c],children:h.jsx(Vot,{elements:t,cuboidModel:d})},d.id);if(d.parentId===n){const{lx:f,ly:p,lz:m}=e;switch(d.type){case z.Sensor:return h.jsx(Yot,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*m},d.id);case z.Light:return h.jsx(Oot,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*m},d.id);default:return null}}else return null})]})},lR=t=>{const[e,n]=g.useState(t);return g.useEffect(()=>{t!==e&&n(t)},[t]),[e,n]},ote=(t,e)=>{const{gl:n}=ti(),[o,r]=g.useState(t),i=g.useRef(!1),a=g.useRef(!1);return g.useEffect(()=>{const u=()=>{i.current&&(i.current=!1,a.current||(r(t),n.domElement.style.cursor="default"))};return window.addEventListener("pointerup",u),()=>window.removeEventListener("pointerup",u)},[]),{_color:o,_onPointerDown:()=>{i.current=!0,setTimeout(()=>{n.domElement.style.cursor=e},10)},_onPointerMove:u=>{u.intersections.length==0||u.intersections[0].object!==u.object?(a.current=!1,r(t),n.domElement.style.cursor="default"):(a.current=!0,r(Aa),n.domElement.style.cursor=e)},_onPointerLeave:()=>{a.current=!1,i.current||(r(t),n.domElement.style.cursor="default")}}},Got=(t,e)=>{const[n,o]=g.useState(t),[r,i]=g.useState(e);return g.useEffect(()=>{o(t),i(e)},[t,e]),{materialLx:n,materialLy:r,setMaterialSize:(l,s)=>{l===Fr.ResizeX?s!==n&&o(Math.abs(s)):s!==r&&i(Math.abs(s))}}},Xot=t=>{const e=dt(vs),n=H(Df),[o,r]=g.useState(null);return g.useEffect(()=>{if(e){const i=In.getState().getHeatmap(t);i&&r(ye.fetchHeatmapTexture(i,n??5))}},[e,n]),o},Zdn=(t,e,n,o,r,i)=>{const a=r??((n==null?void 0:n.color)==="Black"&&(n==null?void 0:n.cellType)==="Monocrystalline"?"silver":"white"),l=i??"gray",s=g.useMemo(()=>{if(!n)return null;const{cellType:d,length:f,width:p,m,n:y,color:w}=n;return o===br.portrait?iMe(d,p,f,y,m,w,a,l):iMe(d,f,p,m,y,w,a,l)},[n,o,a,l]),[c,u]=g.useState(s);return g.useEffect(()=>{if(s&&n){const{length:d,width:f}=n,p=Math.max(1,Math.round(t/(o===br.landscape?d:f))),m=Math.max(1,Math.round(e/(o===br.landscape?f:d)));s.repeat.set(p,m),s.wrapS=s.wrapT=es,u(s.clone())}},[s,t,e]),c},iMe=(t,e,n,o,r,i,a,l)=>{e*=lbe,n*=lbe;const s=document.createElement("canvas");[s.width,s.height]=[e,n];const c=s.getContext("2d");if(c){c.fillStyle=a,c.fillRect(0,0,e,n);const u=Math.max(e,n)*Fvt;if(c.fillStyle=l,c.fillRect(u,u,e-2*u,n-2*u),c.fillStyle=i==="Black"?Wvt:Nvt,t==="Thin Film"){const d=u*.6;c.fillRect(d,d,e-d*2,n-d*2)}else{const d=Math.max(e,n)*Lvt,f=u+d,p=(e-f*2-d*(o-1))/o,m=(n-f*2-d*(r-1))/r,y=p*.1,w=m*.1;if(t==="Monocrystalline")for(let x=0;x{const o=l2(),{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=ote(ll,"grab"),s=c=>{n(c),i()};return h.jsxs("group",{name:e,position:[0,t,0],rotation:[$t,0,0],scale:o*3,onPointerDown:s,onPointerMove:a,onPointerLeave:l,children:[h.jsx(O2e,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[$t,0,$t],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(Rf,{args:[.1,.1,6],rotation:[$t,0,0],position:[.15,0,.05],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(fH,{args:[.05,6],rotation:[0,$t,0],position:[0,0,.15],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(yi,{args:[.35,.35],position:[0,.05,0],rotation:[-$t,0,0],visible:!1})]})}),efn=xe.memo(g.forwardRef(({tiltAngle:t,positionZ:e,isOnVerticalSurface:n,onPointerDown:o,onPointerMove:r},i)=>{const a=l2()*3,l=Math.PI/12,s=g.useMemo(()=>n?$t:Math.PI,[n]),c=g.useMemo(()=>n?new Array(7).fill(0):new Array(13).fill(0),[n]),u=g.useMemo(()=>n?e:0,[n,e]),[d,f]=g.useState(!1),p=g.useRef(null),m=g.useRef(null),y=g.useRef(null),{_color:w,_onPointerDown:x,_onPointerMove:C,_onPointerLeave:P}=ote(ll,"grab");g.useImperativeHandle(i,()=>({setVisiable(b){p.current&&(p.current.visible=b)},update(b,T){m.current&&m.current.rotation.set(b,0,0),y.current&&(y.current.text=A(b)),p.current&&(p.current.position.z=T)}}),[]);const A=b=>{const T=n?-b:b;return`${Math.floor(T/Math.PI*180)}°`},S=b=>{f(!0),o(b),x()},v=b=>{r(b)};return g.useEffect(()=>{const b=()=>{f(!1)};return window.addEventListener("pointerup",b),()=>window.addEventListener("pointerup",b)},[]),h.jsxs("group",{name:"Tilt_Handle_Group",ref:p,position:[0,0,u],children:[h.jsx(FX,{name:ai.Tilt,args:[a,1.125*a,18,2,0,s],rotation:[$t,0,$t,"ZXY"],onPointerDown:S,onPointerMove:C,onPointerLeave:P,children:h.jsx("meshBasicMaterial",{side:zr,color:w})}),d&&h.jsxs(h.Fragment,{children:[h.jsx(FX,{name:"Tilt_Handle_Intersection_Plane",args:[a,2*a,18,2,0,s],rotation:[$t,0,$t,"ZXY"],onPointerMove:v,children:h.jsx("meshBasicMaterial",{transparent:!0,depthTest:!1,opacity:.5,side:zr})}),h.jsx("group",{rotation:[-$t,0,0],children:c.map((b,T)=>{const R=n?`${90-T*15}°`:`${T*15-90}°`;return h.jsxs("group",{rotation:[l*T,0,0,"ZXY"],children:[h.jsx(On,{points:[[0,0,1.8*a],[0,0,2*a]],color:"white",transparent:!0,opacity:.5}),h.jsx("textSprite",{userData:{unintersectable:!0},text:R,fontSize:20*a,fontFace:"Times Roman",textHeight:.15*a,position:[0,0,1.6*a]})]},T)})}),h.jsxs("group",{ref:m,rotation:[t,0,0],children:[h.jsx(On,{points:[[0,0,a],[0,0,1.75*a]]}),h.jsx("textSprite",{ref:y,userData:{unintersectable:!0},text:A(t),fontSize:20*a,fontFace:"Times Roman",textHeight:.2*a,position:[0,0,.75*a]})]})]})]})})),tfn=xe.memo(()=>h.jsxs("group",{name:"Normal Pointer Group",children:[h.jsx(On,{points:[[0,0,0],[0,0,1]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),h.jsx(Rf,{position:[0,0,1],rotation:[$t,0,0],userData:{unintersectable:!0},args:[.04,.2,4,2],children:h.jsx("meshBasicMaterial",{color:"white"})})]})),nfn=xe.memo(xe.forwardRef(({positionZ:t,rotationX:e,topTiltGroupRef:n},o)=>{const r=H(Ky),i=H(ml),a=H(tu),l=g.useMemo(()=>Math.max(100,10*r),[r]),s=g.useMemo(()=>zi(new Date(i),a),[i,a]),c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),[f,p]=g.useState(null),[m,y]=g.useState(null),[w,x]=g.useState(new ue),[C,P]=g.useState(!1),A=M=>{M?C||P(!0):C&&P(!1)},S=M=>!(s.z<0||M<0||M>90),v=()=>n.current?n.current.getWorldDirection(ra).angleTo(s)/Math.PI*180:-1,b=M=>M.toFixed(1)+"°",T=()=>{if(!n.current||!c.current)return null;const M=Xc.setFromQuaternion(c.current.getWorldQuaternion(m0)).z;Xc.set(0,0,-M);const D=c.current.getWorldPosition(MJ),k=n.current.localToWorld(ra.set(0,0,.5)).sub(D).applyEuler(Xc),N=u.current.localToWorld(gh.set(0,0,.5)).sub(D).applyEuler(Xc);return[k.clone(),N.clone()]},R=M=>{if(!f||f.length!==2||!M||M.length!==2)return!1;const[D,k]=M,[N,U]=f;return ye.isSame(D,N)&&ye.isSame(k,U)};return g.useImperativeHandle(o,()=>({setPositionZ(M){c.current&&(c.current.position.z=M)},setRotationX(M){c.current&&(c.current.rotation.x=M)}}),[]),g.useEffect(()=>{if(!n.current)return;const M=v();if(S(M))A(!0);else{A(!1);return}y(b(M));const k=T();if(p(k),k&&k.length===2){const[N,U]=k,W=new ue().addVectors(N,U).divideScalar(2).multiplyScalar(1.5);x(W)}},[]),Gp(()=>{if(!n.current)return;const M=v();if(S(M))A(!0);else{A(!1);return}u.current&&u.current.lookAt(u.current.getWorldPosition(ra).add(s));const k=T();if(R(k)||p(k),d.current&&(k==null?void 0:k.length)===2){const[N,U]=k;d.current.position.addVectors(N,U).divideScalar(2).multiplyScalar(1.5),d.current.text=b(M)}}),C?h.jsxs("group",{ref:c,position:[0,0,t],rotation:[e,0,0],children:[h.jsx(On,{name:"Sun Beam",ref:u,points:[[0,0,0],[0,0,l]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),f&&w&&m&&h.jsxs(h.Fragment,{children:[h.jsx(On,{name:"Angle Line",points:f,userData:{unintersectable:!0},lineWidth:1,color:"white"}),h.jsx("textSprite",{ref:d,position:w,text:m,userData:{unintersectable:!0},fontSize:20,fontFace:"Times Roman",textHeight:.1})]})]}):null})),ofn=xe.memo(g.forwardRef(({tiltAngle:t,trackerType:e,surfaceType:n,children:o},r)=>{const i=g.useRef(null),a=H(ml),l=H(tu),s=g.useRef(new ue),c=g.useMemo(()=>{const f=zi(new Date(a),l);return s.current.copy(f),f},[a,l]),u=()=>{i.current&&i.current.rotation.set(0,0,0)},d=(f,p)=>{if(i.current)switch(f){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{i.current.rotation.set(Math.atan2(Math.hypot(s.current.x,s.current.y),s.current.z),0,Math.atan2(s.current.y,s.current.x)+$t-p,"ZXY");break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{i.current.rotation.set(t,0,Math.atan2(s.current.y,s.current.x)+$t-p,"ZXY");break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const m=new ue().copy(s.current).applyEuler(Xc.set(0,0,-p));i.current.rotation.set(0,Math.atan2(m.x,m.z),0,"ZXY");break}}};return g.useImperativeHandle(r,()=>({reset(){u()},update(f,p){d(f,p)}}),[]),g.useEffect(()=>{if(!i.current)return;if(e===Bl.NO_TRACKER||n!==qa.Horizontal){u();return}const f=Ii.findParentGroup(i.current,[Mp,Vv]);f&&d(e,Xc.setFromQuaternion(f.getWorldQuaternion(m0)).z)},[c,e,n]),h.jsx("group",{ref:i,children:o})})),rfn=({solarPanel:t,lx:e,ly:n})=>{const{id:o,tiltAngle:r,pvModelName:i,orientation:a,color:l}=t,s=dt(vs),c=H(M0)??!1,u=H(_2e),d=H(jM),f=H(BM),m=g.useMemo(()=>({...f,...d}),[d,f])[i],y=Zdn(e,n,m,a,t.frameColor,t.backsheetColor),w=Xot(o),x=()=>s&&w?h.jsx("meshBasicMaterial",{attach:"material-4",map:w}):y?c||u===0?h.jsx("meshStandardMaterial",{attach:"material-4",map:y,color:l}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new ir((m==null?void 0:m.color)==="Blue"?ibe:EX),shininess:u??K8,side:$i,map:y,color:l}):null,C=()=>(m==null?void 0:m.bifacialityFactor)===0||c?h.jsx("meshStandardMaterial",{attach:"material-5",color:l}):y?h.jsx("meshPhongMaterial",{attach:"material-5",specular:new ir((m==null?void 0:m.color)==="Blue"?ibe:EX),shininess:u??K8,side:$i,map:y,color:l}):null;return h.jsxs(h.Fragment,{children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:l}),h.jsx("meshStandardMaterial",{attach:"material-1",color:l}),h.jsx("meshStandardMaterial",{attach:"material-2",color:l}),h.jsx("meshStandardMaterial",{attach:"material-3",color:l}),x(),C()]})},ifn=xe.memo(g.forwardRef(({lx:t,ly:e,poleRadius:n,poleHeight:o,poleSpacing:r,tiltAngle:i,color:a,visiable:l},s)=>{const c=H(A=>A.elements.length>100?2:4),[u,d]=lR(t),[f,p]=lR(e),[m,y]=lR(i),[w,x]=lR(l),C=g.useRef(null);g.useImperativeHandle(s,()=>({update({lx:A,ly:S,tilt:v}){A!==void 0&&d(A),S!==void 0&&p(S),v!==void 0&&y(v)},setVisiable(A){x(A)}}),[]);const P=g.useMemo(()=>{const A=[],S=Math.floor(.5*u/r),v=Math.floor(.5*f*Math.abs(Math.cos(m))/r),b=Math.tan(m);for(let T=-S;T<=S;T++)for(let R=-v;R<=v;R++){const M=T*r,D=R*r,k=b*D+o,N=(k-o)/2;A.push(new Ba(M,D,N,k))}return A},[u,f,m,r,o]);return w?h.jsx("group",{name:"Poles group",ref:C,position:[0,0,-o/2],children:P.map((A,S)=>A.w<0?null:h.jsx(wa,{userData:{unintersectable:!0},name:"Pole "+S,args:[n,n,A.w,c,1],position:[A.x,A.y,A.z],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{color:a})},S))}):null})),afn=xe.memo(({hlx:t,hly:e})=>h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-t,-e,0],[-t,e,0],[t,e,0],[t,-e,0],[-t,-e,0]],lineWidth:3,color:i0})),lfn=xe.memo(({solarPanel:t,boxRef:e})=>{const{ly:n,tiltAngle:o,label:r,locked:i,labelColor:a="white",labelFontSize:l=20,labelSize:s=.2,labelHeight:c}=t,u=n/2,d=Kt(),[f,p]=g.useState("");g.useEffect(()=>{if(!e.current)return;const{x:y,y:w,z:x}=e.current.getWorldPosition(ra);p((r||B.t("shared.SolarPanelElement",d))+(i?" ("+B.t("shared.ElementLocked",d)+")":"")+(r?"":` +`+B.t("word.Coordinates",d)+": ("+y.toFixed(1)+", "+w.toFixed(1)+", "+x.toFixed(1)+") "+B.t("word.MeterAbbreviation",d)))},[r,i,d]);const m=c??Math.max(u*Math.abs(Math.sin(o))+.1,.2);return h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:f,color:a,fontSize:l,textHeight:s,position:[0,0,m]})}),Jot=xe.memo(({onPointerDown:t})=>{const{_color:e,_onPointerDown:n,_onPointerMove:o,_onPointerLeave:r}=ote(q8,"move"),i=l2()*.75,{gl:a}=ti();return h.jsx(Ys,{name:"Move_Handle",args:[i],onPointerDown:l=>{t(l),n(),a.domElement.style.cursor="move"},onPointerMove:o,onPointerLeave:r,children:h.jsx("meshBasicMaterial",{color:e})})}),Gv=xe.memo(({cx:t,cy:e,size:n,type:o})=>{const{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=ote(ll,"pointer");return h.jsx(di,{name:o,position:[t,e,.1],args:[n,n,.1],onPointerDown:i,onPointerMove:a,onPointerLeave:l,children:h.jsx("meshBasicMaterial",{color:r})})}),sfn=xe.memo(g.forwardRef(({hlx:t,hly:e,onPointerDown:n},o)=>{const r=l2();return h.jsxs("group",{name:"Resize_Handles_Group",ref:o,onPointerDown:n,children:[h.jsx(Gv,{type:xt.Left,cx:-t,cy:0,size:r}),h.jsx(Gv,{type:xt.Right,cx:t,cy:0,size:r}),h.jsx(Gv,{type:xt.Lower,cx:0,cy:-e,size:r}),h.jsx(Gv,{type:xt.Upper,cx:0,cy:e,size:r})]})})),cfn=xe.memo(({children:t,onPointerOut:e,onPointerOver:n})=>{const o=H(xs);return h.jsx(di,{name:"Box_Mesh",receiveShadow:o,castShadow:o,onPointerOver:n,onPointerOut:e,children:t})}),ufn=({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>{const a=[],[l,s,c]=[t/2,e/2,n/2];let u,d;o===br.portrait?(u=Math.max(1,Math.round(t/i)),d=Math.max(1,Math.round(e/r))):(u=Math.max(1,Math.round(t/r)),d=Math.max(1,Math.round(e/i)));const f=t/u,p=e/d;for(let m=0;m<=u;m++)a.push({points:[new ue(-l+m*f,-s,c),new ue(-l+m*f,s,c)]});for(let m=0;m<=d;m++)a.push({points:[new ue(-l,-s+m*p,c),new ue(l,-s+m*p,c)]});return h.jsx("group",{name:"Solar Panel Heatmap Lines Group",position:[0,0,.005],children:a.map((m,y)=>h.jsx(On,{name:"Solar Panel Lines",userData:{unintersectable:!0},points:m.points,lineWidth:.2},y))})},dfn=xe.memo(({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>dt(vs)?h.jsx(ufn,{lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i}):null),_3e=xe.memo(g.forwardRef(({lx:t,ly:e,relativeAzimuth:n},o)=>{const r=Math.max(5,Math.hypot(t,e)*.75),i=g.useMemo(()=>new Array(25).fill(0),[]),a=B5(NM,gI),l=r*.05,s={font:a,height:0,size:l},c=f=>f===0?-l*.3:f>0&&f<7?-l*.8:-l*1.2,[u,d]=g.useState(n);return g.useImperativeHandle(o,()=>({setAzimuth:f=>{f<-Math.PI?d(f+Math.PI*2):f>Math.PI?d(f-Math.PI*2):d(f)}})),h.jsxs("group",{rotation:[$t,0,0],position:[0,0,.1],name:"Solar Panel Polar Grid Group",children:[h.jsx("polarGridHelper",{args:[r,24,6,120,"white","white"],userData:{unintersectable:!0}}),h.jsx(FX,{args:[r*.98,r,24,1,$t,u],userData:{unintersectable:!0},rotation:[-$t,0,0],children:h.jsx("meshBasicMaterial",{side:zr,color:"yellow"})}),h.jsx("group",{rotation:[0,u,0],children:h.jsx("mesh",{position:[-.5,0,-r*.9],rotation:[-$t,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-ye.toDegrees(u).toFixed(1)}°`,s]})})}),i.map((f,p)=>{let m=Math.ceil(p/2)*(p%2===0?1:-1);m===-12&&(m=12);const y=c(Math.abs(m));return h.jsx("group",{rotation:[0,m*Math.PI/12,0],children:h.jsxs("mesh",{position:[y,0,-r*1.05],rotation:[-$t,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*m}°`,s]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},p)})]})})),ffn=xe.memo(g.forwardRef(({lx:t,ly:e,tiltAngle:n,modelLength:o,visiable:r},i)=>{const a=H(xs),l=.75,s=(A,S)=>{const v=S*l,b=Math.cos(A),T=A/2,R=v*Math.sin(T)*2,M=T;return{cz:(v-S/2)*b+R*Math.sin(M),mountAngle:M,length:R}},{cz:c,mountAngle:u,length:d}=g.useMemo(()=>s(n,e),[n,e]),[f,p]=lR(t),[m,y]=lR(r),w=g.useMemo(()=>{const A=[];let v=Math.round(f/o)%2===0?o/2:0;for(;v({update(A,S){if(x.current&&C.current&&P.current){const{cz:v,mountAngle:b,length:T}=s(-A,S);x.current.position.y=-v,C.current.rotation.x=-b,P.current.position.z=T/2,P.current.scale.z=T-.025}},resizeX(A){p(A)},setVisiable(A){y(A)}}));const x=g.useRef(null),C=g.useRef(null),P=g.useRef(null);return m?h.jsx("group",{ref:x,position:[0,-c,0],castShadow:a,receiveShadow:a,children:h.jsx("group",{ref:C,rotation:[-u,0,0],children:h.jsx("group",{ref:P,position:[0,0,d/2],scale:[1,1,d-.025],children:w.map((A,S)=>h.jsx(di,{position:[A,0,0],args:[.05,.05,1],children:h.jsx("meshStandardMaterial",{color:"#BFBFBF"})},S))})})}):null})),hfn="Intersection Plane XY",k_=1,aMe=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,rotation:l,normal:s,relativeAzimuth:c,tiltAngle:u,parentType:d,drawSunBeam:f,trackerType:p=Bl.NO_TRACKER,pvModelName:m="SPR-X21-335-BLK",orientation:y=br.landscape,poleHeight:w,poleRadius:x,poleSpacing:C,color:P="white",locked:A}=t,S=g.useMemo(()=>Ii.getPVModel(m),[m]),v=Math.max(S.thickness,.02),[b,T,R]=[i/2,a/2,v/2],M=Fc(e),{materialLx:D,materialLy:k,setMaterialSize:N}=Got(i,a),{set:U,get:W,raycaster:F}=ti(),E=H(pn),L=H(vQ),[j,Y]=g.useState(!1),[O,_]=g.useState(!1),[G,Q]=g.useState(!1),oe=g.useRef(null),ee=g.useRef(null),$=g.useRef(null),ae=g.useRef(null),Z=g.useRef(null),ne=g.useRef(null),te=g.useRef(null),q=g.useRef(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(null),ce=g.useRef(null),Pe=g.useRef(null),pe=g.useRef(new ue),Ie=g.useRef(new ue),ve=g.useRef(null),ze=g.useRef(null),Ae=g.useRef(null),se=g.useRef(null),ge=g.useRef(null),we=g.useMemo(()=>Ii.getSurfaceType(d,new ue().fromArray(s)),[d,s]),Se=g.useMemo(()=>Ii.isTrackerEnabled(we,p),[we,p]),Me=g.useMemo(()=>-T*Math.sin(Math.min(0,u)),[u,T]),Ce=g.useMemo(()=>{switch(we){case qa.Horizontal:return R+w;case qa.Vertical:return R+Me;case qa.Inclined:return R}return R},[w,R,we,Me]),Te=g.useMemo(()=>M&&!A,[M,A]),Re=g.useMemo(()=>M&&we===qa.Horizontal&&!Se&&!A,[M,we,Se,A]),Ne=g.useMemo(()=>!M||Se||A?!1:we===qa.Vertical||we===qa.Horizontal&&w>0,[M,we,w,Se,A]),_e=g.useMemo(()=>w>0&&we===qa.Horizontal,[w,we]),Ue=g.useMemo(()=>we===qa.Vertical,[we]),qe=Ct=>{U({frameloop:Ct})},Fe=()=>{if(!Z.current)return;const[Ct,yt]=Z.current.scale.toArray().map(at=>at/2);if(ne.current)for(const at of ne.current.children)switch(at.name){case xt.Left:{at.position.x=-Ct;break}case xt.Right:{at.position.x=Ct;break}case xt.Upper:{at.position.y=yt;break}case xt.Lower:{at.position.y=-yt;break}}if(te.current)for(const at of te.current.children)switch(at.name){case ai.Lower:{at.position.y=-yt-k_;break}case ai.Upper:{at.position.y=yt+k_;break}}},He=Ct=>{if(!Ct)return;const[yt,at,Et]=Ii.getRotationOnCuboid(Ct);Le(yt,at,Et),ye.isEqual(Ct.z,1)?Pe.current!==null?$.current.rotation.z=Pe.current-Xc.z:$.current.rotation.z=c:$.current.rotation.set(0,0,0)},Le=(Ct,yt,at)=>{oe.current&&oe.current.rotation.set(Ct,yt,at,"ZXY"),le.current&&le.current.setRotationX(-Ct)},Ye=Ct=>{$.current&&($.current.position.z=Ct),le.current&&le.current.setPositionZ(Ct)},lt=(Ct,yt)=>{ae.current&&(ae.current.rotation.x=Ct),q.current&&q.current.update(Ct,yt),de.current&&de.current.update({tilt:Ct}),ce.current&&ce.current.update(Ct,a)},Oe=(Ct,yt)=>{const at=jn.getState().solarPanelCountRef;at&&at.current&&(at.current.textContent=`${Ii.getRackCount(y,Ct,yt,S.length,S.width)}`)},ut=Ct=>{me.current&&me.current.setAzimuth(Ct)},ht=Ct=>{ce.current&&ce.current.resizeX(Math.abs(Ct))},Qe=Ct=>{ce.current&&ce.current.update(u,Math.abs(Ct))},nt=(Ct,yt,at)=>{switch(at){case Fr.Move:{const Et=Ct.intersectObjects(yt.children);for(const Lt of Et){if(Lt.object.name===VL){const Je=Lt.object.parent;return Je?{intersection:Lt,parentGroup:Je,parentType:z.Foundation}:null}if(Lt.object.name.includes(O0.WALL_OUTSIDE_SURFACE_MESH_NAME)){const Je=Lt.object.parent;return Je?{intersection:Lt,parentGroup:Je,parentType:z.Wall}:null}if(Lt.object.name.includes("Roof")){const Je=Ii.findParentGroup(Lt.object,[VL]);return Je?{intersection:Lt,parentGroup:Je,parentType:z.Roof}:null}if(Lt.object.name.includes("Cuboid")){const Je=Ii.findParentGroup(Lt.object,[Vv]);return Je?{intersection:Lt,parentGroup:Je,parentType:z.Cuboid}:null}}break}case Fr.ResizeX:case Fr.ResizeY:case Fr.RotateLower:case Fr.RotateUpper:{if(!O||!he.current||!ge.current)return null;const Et=Ct.intersectObjects([he.current]),Lt=Et[0];return!Lt||ye.isEqual(Lt.point.z,0)?null:{intersection:Et[0],parentGroup:ge.current,parentType:d}}}return null},mt=(Ct,yt)=>{const{length:at,width:Et}=Ii.getUnitSize(y,S.length,S.width);return Ct===Fr.ResizeX?(yt-at&&(yt=at),Math.round(yt/at)*at):Ct===Fr.ResizeY?(yt-Et&&(yt=Et),Math.round(yt/Et)*Et):yt},tt=(Ct,yt)=>{if(yt===Fr.ResizeX)return Ct;{const at=Math.abs(2*w/Math.sin(u));return ye.clamp(Ct,-at,at)}},gt=(Ct,yt,at,Et)=>{var Je;const Lt=yt.children.find(st=>st.name===Npe);if(Lt&&Ct&&Lt!==Ct){Ct.children=Ct.children.filter(It=>It!==oe.current),Lt.children.push(oe.current),oe.current.parent=Lt;const st=(Je=Lt.parent)==null?void 0:Je.userData;if(st&&st.id&&st.fId&&(ve.current=st.id,ze.current=st.fId),at===z.Roof){const It=Ii.getRoofId(Et);It&&(ve.current=It)}}Ae.current=at},Ve=Ct=>{Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object||(Ct.stopPropagation(),Ct.button===2?(H.getState().selectedElementIdSet.has(e)||L(e),E(yt=>{yt.contextMenuObjectType=z.SolarPanel})):L(e))},je=Ct=>{if(!M||!oe.current||!$.current||Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object)return;qe("always"),jn.getState().setEnableOrbitController(!1),se.current=Fr.Move;const yt=Ii.findParentGroup(oe.current,[Mp,Vv]);yt&&(Pe.current=Xc.setFromQuaternion(yt.getWorldQuaternion(m0.set(0,0,0,0))).z+c)},et=Ct=>{if(!(!M||!oe.current||!$.current)&&!(Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object)){switch(qe("always"),jn.getState().setEnableOrbitController(!1),Ct.object.name){case xt.Left:case xt.Right:{se.current=Fr.ResizeX;break}case xt.Upper:case xt.Lower:{se.current=Fr.ResizeY;break}}we===qa.Horizontal?($.current.localToWorld(pe.current.set(-Ct.object.position.x,-Ct.object.position.y*Math.abs(Math.cos(u)),-R-w)),oe.current.getWorldPosition(Ie.current).sub(pe.current).normalize()):($.current.localToWorld(pe.current.set(-Ct.object.position.x,-Ct.object.position.y,0)),$.current.getWorldPosition(Ie.current).sub(pe.current).normalize()),_(!0),ge.current=Ii.findParentGroup(oe.current,[Kot,Mp,Vv])}},bt=Ct=>{if(!(!$.current||!te.current)&&!(Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object)){switch(qe("always"),jn.getState().setEnableOrbitController(!1),Ct.eventObject.name){case ai.Upper:{se.current=Fr.RotateUpper;break}case ai.Lower:{se.current=Fr.RotateLower;break}}$.current.getWorldPosition(pe.current),pe.current.z=0,_(!0),Q(!0),ge.current=Ii.findParentGroup(oe.current,[Mp,Vv])}},St=Ct=>{Ct.intersections.length==0||Ct.intersections[0].object!==Ct.object||(se.current=Fr.Tilt,qe("always"),jn.getState().setEnableOrbitController(!1),we===qa.Vertical?oe.current.getWorldPosition(pe.current):$.current.getWorldPosition(pe.current))},Pt=Ct=>{if(!$.current||!ae.current||!q.current)return;const yt=ra.subVectors(Ct.point,pe.current),at=$.current.localToWorld(gh.set(0,-1,0)).sub(pe.current),Et=yt.angleTo(at),Je=Math.sign($t-Et)*yt.angleTo($.current.getWorldDirection(MJ));if(we===qa.Vertical){const st=Je>0?-Je:Je,It=R-T*Math.sin(st);Ye(It),lt(st,-It)}else{const st=w>=T?$t:Math.asin(w/T);lt(ye.clamp(Je,-st,st),0)}},Yt=g.useCallback(()=>{if(!se.current)return;const Ct=H.getState().elements.find(at=>at.id===e);switch(se.current){case Fr.Move:{E(at=>{if(!oe.current||!se.current)return;const Et=jn.getState().pointer;F.setFromCamera(Et,W().camera);const Lt=nt(F,W().scene,se.current),Je=at.elements.find(st=>st.id===e);if(Je)if(Je.parentId!==ve.current&&ve.current&&ze.current&&(Je.parentId=ve.current,Je.foundationId=ze.current),Ae.current&&Ae.current!==Je.parentType&&(Je.parentType=Ae.current),Je.parentType===z.Wall){const st=at.elements.find(It=>It.id===Je.parentId);st&&(Je.cx=oe.current.position.x/st.lx,Je.cy=0,Je.cz=oe.current.position.z/st.lz,Je.rotation=[$t,0,0],Je.normal=[0,-1,0])}else if(Je.cx=oe.current.position.x,Je.cy=oe.current.position.y,Je.cz=oe.current.position.z,Pe.current!==null&&(Lt!=null&&Lt.parentGroup)&&(Je.relativeAzimuth=Pe.current-Xc.setFromQuaternion(Lt.parentGroup.getWorldQuaternion(m0.set(0,0,0,0))).z),Lt!=null&&Lt.intersection)if(Ii.getSurfaceType(Lt.parentType,Lt.intersection.normal)===qa.Horizontal)Je.rotation=[0,0,0],Je.normal=[0,0,1];else{const{x:It,y:ot,z:it}=oe.current.rotation,Be=ra.set(0,0,1).applyEuler(oe.current.rotation);Je.rotation=[It,ot,it],Je.normal=[Be.x,Be.y,Be.z]}else{const{x:st,y:It,z:ot}=oe.current.rotation,it=ra.set(0,0,1).applyEuler(oe.current.rotation);Je.rotation=[st,It,ot],Je.normal=[it.x,it.y,it.z]}});break}case Fr.ResizeX:case Fr.ResizeY:{E(at=>{if(!Z.current||!oe.current)return;const Et=at.elements.find(Lt=>Lt.id===e);if(Et)if(Et.lx=Z.current.scale.x,Et.ly=Z.current.scale.y,Et.parentType===z.Wall){const Lt=at.elements.find(Je=>Je.id===Et.parentId);Lt&&(Et.cx=oe.current.position.x/Lt.lx,Et.cy=0,Et.cz=oe.current.position.z/Lt.lz)}else Et.parentType===z.Roof&&(at.updateElementOnRoofFlag=!at.updateElementOnRoofFlag),[Et.cx,Et.cy,Et.cz]=oe.current.position});break}case Fr.RotateLower:case Fr.RotateUpper:{E(at=>{if(!$.current)return;const Et=at.elements.find(Lt=>Lt.id===e);Et&&(Et.relativeAzimuth=Ii.getRelativeAzimuth($.current.rotation.z))});break}case Fr.Tilt:{E(at=>{if(!ae.current)return;const Et=at.elements.find(Lt=>Lt.id===e);Et&&(Et.tiltAngle=ae.current.rotation.x)});break}}const yt=H.getState().elements.find(at=>at.id===e);Ct&&yt&&(Ii.isNewPositionOk(yt)?Ii.addUndoable(Ct,se.current):setTimeout(()=>{E(at=>{const Et=at.elements.findIndex(Lt=>Lt.id===e);Et!==-1&&(at.elements[Et]=Ct)})},10)),W().frameloop!=="demand"&&qe("demand"),jn.getState().setEnableOrbitController(!0),se.current=null,Pe.current=null,ve.current=null,ze.current=null,Ae.current=null,ge.current=null,_(!1),Q(!1)},[]);g.useEffect(()=>(window.addEventListener("pointerup",Yt),()=>window.removeEventListener("pointerup",Yt)),[Yt]),Gp(({camera:Ct,scene:yt,raycaster:at})=>{if(!oe.current||!$.current||!M||!se.current||se.current===Fr.Tilt)return;const Et=jn.getState().pointer;at.setFromCamera(Et,Ct);const Lt=nt(at,yt,se.current);if(!Lt)return;const{intersection:Je,parentGroup:st,parentType:It}=Lt,ot=Je.point;switch(se.current){case Fr.Move:{if(!It)break;switch(gt(oe.current.parent,st,It,Je.object),It){case z.Foundation:{oe.current.position.x=ot.x-st.position.x,oe.current.position.y=ot.y-st.position.y,oe.current.position.z=ot.z-st.position.z,oe.current.position.applyEuler(Xc.set(0,0,-st.rotation.z)),Le(0,0,0),Pe.current!==null?$.current.rotation.z=Pe.current-st.rotation.z:$.current.rotation.z=c;break}case z.Wall:{const Be=Ii.findParentGroup(st,[Mp]);Be&&(st.localToWorld(ra.set(0,0,0)),gh.set(0,0,0).subVectors(ot,ra).applyEuler(Xc.set(0,0,-Be.rotation.z-st.rotation.z)),oe.current.position.x=gh.x,oe.current.position.y=0,oe.current.position.z=gh.z,Le($t,0,0),$.current.rotation.set(0,0,0));break}case z.Roof:{const Be=Ii.getRoofSegmentData(Je.object);if(Be){const{roofId:pt,foundation:ct,centroid:Xe,roofSegments:ft}=Be;if(ct&&Xe&&ft&&pt){const wt=new ue().subVectors(ot,new ue(ct.cx,ct.cy,ct.cz)).applyEuler(new cn(0,0,-ct.rotation[2])),kt=wt.clone().sub(Xe),{normal:Zt,rotation:Ot}=Rn.computeState(ft,kt);oe.current.position.x=wt.x,oe.current.position.y=wt.y,oe.current.position.z=wt.z,ye.isEqual(Ot[0],0)?(Le(0,0,0),Pe.current!==null?$.current.rotation.set(0,0,Pe.current-st.rotation.z):$.current.rotation.set(0,0,c)):(Le(Ot[0],Ot[1],Ot[2]),$.current.rotation.set(0,0,0))}}break}case z.Cuboid:st.getWorldPosition(ra),st.getWorldQuaternion(m0),Xc.setFromQuaternion(m0),oe.current.position.subVectors(ot,ra).applyQuaternion(m0.invert()),He(Je.normal)}const it=Ii.getSurfaceType(It,Je.normal);switch(it===qa.Horizontal?(de.current&&de.current.setVisiable(!0),ce.current&&ce.current.setVisiable(!1),Ye(w+R)):(de.current&&de.current.setVisiable(!1),ce.current&&ce.current.setVisiable(!0),Ye(R)),it){case qa.Horizontal:{lt(u,0);break}case qa.Vertical:{const Be=Math.min(0,u),pt=R-T*Math.sin(Be);Ye(pt),lt(Be,-pt);break}case qa.Inclined:{lt(0,0);break}}Ii.isTrackerEnabled(it,p)?($.current.rotation.set(0,0,0),ae.current.rotation.set(0,0,0),ee.current.update(p,Xc.setFromQuaternion(st.getWorldQuaternion(m0)).z)):ee.current.reset();break}case Fr.ResizeX:case Fr.ResizeY:{const it=pe.current,Be=ra.subVectors(ot,it),pt=Ie.current,ct=Be.angleTo(pt),Xe=Be.length()*Math.cos(ct),ft=mt(se.current,Xe);if(we===qa.Vertical){const wt=oe.current.getWorldPosition(ra).sub($.current.getWorldPosition(gh)),kt=MJ.copy(pt).multiplyScalar(ft/2).add(it).add(wt).sub(st.getWorldPosition(_L)).applyQuaternion(st.getWorldQuaternion(m0).invert());oe.current.position.x=kt.x,oe.current.position.z=kt.z,It===z.Cuboid&&(oe.current.position.y=kt.y),se.current===Fr.ResizeX?(Z.current.scale.x=Math.abs(ft),ht(ft)):se.current===Fr.ResizeY&&(Z.current.scale.y=Math.abs(ft),Qe(ft),It===z.Wall&&Ye(Math.abs(ft/2*Math.sin(Math.min(0,u))))),N(se.current,ft)}else{const wt=tt(ft,se.current),kt=ra.copy(pt).multiplyScalar(wt/2).add(it).sub(st.getWorldPosition(_L)).applyQuaternion(st.getWorldQuaternion(m0).invert()),Zt=Math.abs(wt);se.current===Fr.ResizeX?(Z.current.scale.x=Zt,de.current&&de.current.update({lx:Zt})):se.current===Fr.ResizeY&&(Z.current.scale.y=Zt,de.current&&de.current.update({ly:Zt})),oe.current.position.x=kt.x,oe.current.position.y=kt.y,oe.current.position.z=kt.z,N(se.current,wt)}Fe(),Oe(Z.current.scale.x,Z.current.scale.y);break}case Fr.RotateUpper:{ra.subVectors(ot,pe.current).setZ(0);let it=ra.angleTo(gh.set(0,1,0));ra.x>0&&(it=-it),$.current.rotation.z=it-Xc.setFromQuaternion(st.getWorldQuaternion(m0)).z,ut($.current.rotation.z);break}case Fr.RotateLower:{ra.subVectors(ot,pe.current).setZ(0);let it=ra.angleTo(gh.set(0,-1,0));ra.x<0&&(it=-it),$.current.rotation.z=it-Xc.setFromQuaternion(st.getWorldQuaternion(m0)).z,ut($.current.rotation.z);break}}});const zt=g.useMemo(()=>we===qa.Horizontal&&!Se?new cn(0,0,c,"ZXY"):new cn(0,0,0,"ZXY"),[we,c,Se]),Rt=g.useMemo(()=>Se?new cn(0,0,0,"ZXY"):we===qa.Horizontal&&w>0?new cn(u,0,0,"ZXY"):we===qa.Vertical?new cn(Math.min(0,u),0,0,"ZXY"):new cn(0,0,0,"ZXY"),[w,we,u,Se]);return h.jsxs("group",{name:`Ref_Solar_Panel_Group ${e}`,ref:oe,position:[n,o,r],rotation:[l[0],l[1],l[2],"ZXY"],onPointerDown:Ve,children:[h.jsxs("group",{name:"Top_Azimuth_Group",ref:$,position:[0,0,Ce],rotation:zt,children:[h.jsx(ofn,{ref:ee,tiltAngle:u,trackerType:p,surfaceType:we,children:h.jsxs("group",{name:"Top_Tilt_Group",ref:ae,rotation:Rt,children:[h.jsxs("group",{ref:Z,scale:[i,a,v],children:[h.jsx(cfn,{onPointerOver:()=>Y(!0),onPointerOut:()=>Y(!1),children:h.jsx(rfn,{solarPanel:t,lx:D,ly:k})}),h.jsx(yi,{name:"Solar Panel Simulation Plane",uuid:e,userData:{simulation:!0},visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})})]}),M&&A&&h.jsx(afn,{hlx:b,hly:T}),h.jsx(dfn,{lx:D,ly:k,lz:v,orientation:y,modelLength:S.length,modelWidth:S.width}),Te&&h.jsxs(h.Fragment,{children:[h.jsx(Jot,{onPointerDown:je}),h.jsx(sfn,{ref:ne,hlx:b,hly:T,onPointerDown:et})]}),f&&h.jsx(tfn,{})]})}),O&&h.jsx(yi,{name:hfn,ref:he,args:[1e4,1e4],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),Re&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:te,children:[h.jsx(DJ,{name:ai.Upper,positionY:T+k_,onPointerDown:bt}),h.jsx(DJ,{name:ai.Lower,positionY:-T-k_,onPointerDown:bt})]}),Ne&&h.jsx(efn,{ref:q,tiltAngle:u,positionZ:-Me,isOnVerticalSurface:we===qa.Vertical,onPointerDown:St,onPointerMove:Pt}),h.jsx(ifn,{ref:de,lx:i,ly:a,tiltAngle:u,poleHeight:w,poleRadius:x,poleSpacing:C,color:P,visiable:_e}),(j||t.showLabel)&&!M&&h.jsx(lfn,{solarPanel:t,boxRef:Z})]}),f&&h.jsx(nfn,{ref:le,topTiltGroupRef:ae,positionZ:Ce,rotationX:-l[0]}),h.jsx(ffn,{ref:ce,tiltAngle:-u,lx:i,ly:a,modelLength:S.length,visiable:Ue}),G&&h.jsx(_3e,{ref:me,lx:i,ly:a,relativeAzimuth:c})]})}),Npe="Solar_Panels_Wrapper_Group",V3e=xe.memo(({parentId:t,foundationId:e,wrapperType:n,plx:o,ply:r,plz:i})=>{const a=g.useCallback(s=>{if(s.type!==z.SolarPanel)return!1;const c=s;switch(n){case z.Foundation:return c.foundationId===e&&(c.parentType===z.Foundation||c.parentType===z.Roof);case z.Cuboid:return c.foundationId===e&&c.parentType===z.Cuboid;case z.Wall:return s.parentId===t&&c.parentType===z.Wall}return!1},[t,e,n]),l=H(s=>s.elements.filter(a),Qy);switch(n){case z.Foundation:case z.Cuboid:return h.jsx("group",{name:Npe,children:l.map(s=>h.jsx(aMe,{...s},s.id))});case z.Wall:return h.jsx("group",{name:Npe,children:l.map(s=>h.jsx(aMe,{...s,cx:s.cx*o,cz:s.cz*i},s.id))});default:return null}}),Kot="Wall_Group",pfn=({wallModel:t,foundationModel:e})=>{const{id:n,roofId:o,cx:r,cy:i,lx:a,ly:l,lz:s,relativeAngle:c,fill:u,locked:d,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialHeight:m,rightTopPartialHeight:y,leftJoints:w,rightJoints:x,parentId:C}=t,P=Fc(n),[A,S]=[a/2,s/2],v=u===Ul.Partial,b=w.length>0?t.leftRoofHeight:s,T=x.length>0?t.rightRoofHeight:s,R=b??s,M=T??s,D=v?Math.min(R,m):R,k=v?Math.min(M,y):M,N=a===0,U=()=>u===Ul.Empty?h.jsx(kdn,{...t}):h.jsx(xhn,{wallModel:t,foundationModel:e});return h.jsxs("group",{name:`${Kot} ${n}`,position:[r,i,S],rotation:[0,0,c],userData:{aabb:!0,id:n,fId:C},children:[h.jsx(V3e,{parentId:n,foundationId:C,wrapperType:z.Wall,plx:a,ply:l,plz:s}),U(),P&&!d&&h.jsxs(h.Fragment,{children:[a>.5&&h.jsx(Ldn,{ply:l,phz:S}),h.jsx(Ndn,{id:n,parentLz:e.lz,roofId:o,absAngle:c+e.rotation[2],x:A,z:S,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialResizeHandleHeight:D,rightTopPartialResizeHandleHeight:k,fill:u,wallLeftHeight:R,wallRightHeight:M,highLight:N,leftJoints:w,rightJoints:x})]})]})},gfn=(t,e)=>t.wallModel===e.wallModel,mfn=xe.memo(pfn,gfn),$ot="Building Group",yfn=t=>{const{id:e,lx:n,ly:o,lz:r}=t,i=l=>l.foundationId!==e?!1:l.type===z.Wall||l.type===z.Roof||l.type===z.SolarPanel&&l.parentType===z.Roof||l.type===z.Window&&l.parentType===z.Roof,a=H(l=>l.elements.filter(i),Qy);return a.length===0?null:h.jsx("group",{name:$ot,position:[0,0,r/2],children:a.map(l=>{switch(l.type){case z.Wall:return h.jsx(mfn,{wallModel:l,foundationModel:t},l.id);case z.Roof:return h.jsx(vdn,{roofModel:l,foundationModel:t},l.id);case z.Window:return h.jsx(nrt,{...l,cz:l.cz},l.id);default:return null}})})},Afn=(t,e)=>t.lx===e.lx&&t.ly===e.ly&&t.lz===e.lz&&t.rotation===e.rotation,wfn=xe.memo(yfn,Afn),lMe=xe.memo(({hx:t,hy:e,position:n,direction:o,color:r})=>{if(n===null)return null;const[i,a]=n,l=[];if(o==="x")l.push([-t,a,0]),l.push([t,a,0]);else if(o==="y")l.push([i,-e,0]),l.push([i,e,0]);else return o==="xy"?h.jsxs(h.Fragment,{children:[h.jsx(On,{points:[[-t,a,0],[t,a,0]],color:r}),h.jsx(On,{points:[[i,-e,0],[i,e,0]],color:r})]}):null;return h.jsx(On,{points:l,color:r})});class Pv{static addUndoable(e,n){if(e)switch(n){case Fr.Move:{Pv.addUndoableMove(e);break}case Fr.ResizeX:{Pv.addUndoableResize(e,"X");break}case Fr.ResizeY:{Pv.addUndoableResize(e,"Y");break}case Fr.ResizeHeight:{Pv.addUndoableResizeHeight(e);break}case Fr.RotateLower:case Fr.RotateUpper:{Pv.addUndoableRotate(e);break}}}static addUndoableMove(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Move Water Heater",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new ue().fromArray(e.normal),newNormal:new ue().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};H.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{H.getState().set(f=>{const p=f.elements.find(m=>m.id===i);!p||p.type!==z.SolarWaterHeater||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e,n){const o=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!o)return;const r={name:`Resize Water Heater ${n}`,timestamp:Date.now(),id:o.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[o.cx,o.cy,o.cz],newDms:[o.lx,o.ly,o.lz],newRot:[...o.rotation],newNor:[...o.normal],undo(){H.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.oldPos],[a.lx,a.ly,a.lz]=[...r.oldDms],a.normal=[...r.oldNor],a.rotation=[...r.oldRot];break}})},redo(){H.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.newPos],[a.lx,a.ly,a.lz]=[...r.newDms],a.normal=[...r.newNor],a.rotation=[...r.newRot];break}})}};H.getState().addUndoable(r)}static addUndoableResizeHeight(e){const n=H.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarWaterHeater);if(!n)return;const o={name:"Resize Solar Water Heater Height",timestamp:Date.now(),changedElementId:n.id,oldValue:e.lz,newValue:n.lz,undo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.oldValue;break}})},redo(){H.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.newValue;break}})}};H.getState().addUndoable(o)}static addUndoableRotate(e){const n=H.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Rotate Water Heater",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarWaterHeater,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};H.getState().addUndoable(o);const r=i=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarWaterHeater);l&&(l.relativeAzimuth=i)})}}}const xfn=xe.memo(({waterTankLength:t,waterTankRadius:e,panelWidth:n})=>{const o=t/2,r=n/2,i=r+e;return h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-o,-r,0],[-o,i,0],[o,i,0],[o,-r,0],[-o,-r,0]],lineWidth:3,color:i0})}),vfn=(t,e)=>{const[n,o]=g.useState(cE),r=g.useMemo(()=>Math.max(1,Math.round(t/.15)),[t]);return g.useEffect(()=>{cE&&(cE.repeat.set(r,1),cE.wrapS=es,o(cE.clone()))},[r]),n},bfn=()=>{const t=document.createElement("canvas");[t.width,t.height]=[100,100];const e=t.getContext("2d");if(e){e.fillStyle="#A3A3A3",e.fillRect(0,0,100,15);const n=e.createLinearGradient(0,15,0,35);n.addColorStop(0,"#C0C0C0"),n.addColorStop(1,"#E0E0E0"),e.fillStyle=n,e.fillRect(0,15,100,20);const o=e.createLinearGradient(0,35,0,100);o.addColorStop(0,"#949494"),o.addColorStop(.6,"#464646"),o.addColorStop(.85,"#616161"),o.addColorStop(1,"#4B4B4B"),e.fillStyle=o,e.fillRect(0,35,100,65)}return new o3(t)},Sfn=()=>{const t=document.createElement("canvas");[t.width,t.height]=[130,100];const e=t.getContext("2d");if(e){e.fillStyle="#768ca6",e.fillRect(10,0,15,100);const n=e.createLinearGradient(25,0,45,0);n.addColorStop(0,"#7ea4cf"),n.addColorStop(1,"#9ab7d9"),e.fillStyle=n,e.fillRect(25,0,20,100);const o=e.createLinearGradient(45,0,110,0);o.addColorStop(0,"#6F87A1"),o.addColorStop(.6,"#30455B"),o.addColorStop(.85,"#496279"),o.addColorStop(1,"#3E536B"),e.fillStyle=o,e.fillRect(45,0,65,100)}return new o3(t)},cE=Sfn(),Xse=bfn(),sMe=xe.memo(g.forwardRef(({id:t,lx:e,ly:n,side:o},r)=>{const{materialLx:i,setMaterialSize:a}=Got(e,n),l=dt(vs),s=H(M0)??!1,c=H(_2e),u=vfn(i),d=Xot(t),f=()=>l&&d?h.jsx("meshBasicMaterial",{map:d,side:o}):u?s||c===0?h.jsx("meshStandardMaterial",{map:u,side:o,transparent:!0}):h.jsx("meshPhongMaterial",{specular:new ir(EX),shininess:c??K8,side:o,map:u,transparent:!0}):null;return g.useImperativeHandle(r,()=>({update(p,m){p!==void 0&&a(Fr.ResizeX,p),m!==void 0&&a(Fr.ResizeY,m)}})),h.jsx(h.Fragment,{children:f()})})),Tfn=()=>{const t=H(M0)??!1,e=H(_2e),n=()=>Xse?t||e===0?h.jsx("meshStandardMaterial",{map:Xse}):h.jsx("meshPhongMaterial",{specular:new ir(EX),shininess:e??K8,map:Xse}):null;return h.jsx(h.Fragment,{children:n()})},Pfn=xe.memo(({solarWaterHeater:t,groupRef:e})=>{const{label:n,locked:o,labelColor:r="white",labelFontSize:i=20,labelSize:a=.2,labelHeight:l=2}=t,s=Kt(),[c,u]=g.useState("");return g.useEffect(()=>{if(!e.current)return;const{x:d,y:f,z:p}=e.current.getWorldPosition(ra);u((n||B.t("shared.SolarWaterHeaterElement",s))+(o?" ("+B.t("shared.ElementLocked",s)+")":"")+(n?"":` +`+B.t("word.Coordinates",s)+": ("+d.toFixed(1)+", "+f.toFixed(1)+", "+p.toFixed(1)+") "+B.t("word.MeterAbbreviation",s)))},[n,o,s]),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:c,color:r,fontSize:i,textHeight:a,position:[0,0,l]})}),cMe="Mount Left",uMe="Mount Right",qot=.3,Cfn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l,waterTankRadius:s=qot,rotation:c,normal:u,relativeAzimuth:d,parentType:f,locked:p,color:m="grey"}=t,y=Math.hypot(l-s,a),w=i+.25,x=l-s*2,C=Math.atan2(l-s,a),P=.5,A=g.useRef(null),S=g.useRef(null),v=g.useRef(null),b=g.useRef(null),T=g.useRef(new ue),R=g.useRef(new ue),M=g.useRef(null),D=g.useRef(null),k=g.useRef(null),N=g.useRef(null),U=g.useRef(null),W=g.useRef(null),F=g.useRef(null),E=g.useRef(null),L=g.useRef(null),j=g.useRef(null),Y=g.useRef(null),O=g.useRef(null),_=g.useRef(null),G=g.useRef(null),Q=g.useRef(null),oe=g.useRef(null),ee=g.useRef(null),$=g.useRef(null),ae=g.useRef(null),Z=g.useRef(null),ne=H(xs),te=dt(vs),q=H(vQ),[le,de]=g.useState(!1),[he,me]=g.useState(!1),[ce,Pe]=g.useState(null),[pe,Ie]=g.useState(!1),[ve,ze]=g.useState(!1),Ae=Fc(e),se=l2(),{set:ge,get:we,raycaster:Se}=ti(),Me=g.useMemo(()=>Ii.getSurfaceType(f,new ue().fromArray(u)),[f,u]),Ce=g.useMemo(()=>Me===qa.Horizontal?new cn(0,0,d,"ZXY"):new cn(0,0,0,"ZXY"),[Me,d]),Te=g.useMemo(()=>Ae&&Me===qa.Horizontal&&!p,[Ae,Me,p]),Re=H(pn),Ne=nt=>{ge({frameloop:nt})},_e=(nt,mt,tt)=>{switch(tt){case Fr.Move:{const gt=nt.intersectObjects(mt.children);for(const Ve of gt)if(Ve.object.name.includes("Roof")){const je=Ii.findParentGroup(Ve.object,[VL]);return je?{intersection:Ve,parentGroup:je,parentType:z.Roof}:null}break}case Fr.ResizeX:case Fr.ResizeY:case Fr.RotateLower:case Fr.RotateUpper:{if(!le||!_.current||!M.current)return null;const gt=nt.intersectObjects([_.current]),Ve=gt[0];return!Ve||ye.isEqual(Ve.point.z,0)?null:{intersection:gt[0],parentGroup:M.current,parentType:f}}case Fr.ResizeHeight:{if(!he||!G.current||!M.current)return null;const gt=nt.intersectObjects([G.current]),Ve=gt[0];return!Ve||ye.isEqual(Ve.point.z,0)?null:{intersection:gt[0],parentGroup:M.current,parentType:f}}}return null},Ue=(nt,mt,tt)=>{D.current&&D.current.rotation.set(nt,mt,tt,"ZXY")},qe=(nt,mt,tt,gt)=>{var je;const Ve=mt.children.find(et=>et.name===Qot);if(Ve&&nt&&Ve!==nt){nt.children=nt.children.filter(bt=>bt!==D.current),Ve.children.push(D.current),D.current.parent=Ve;const et=(je=Ve.parent)==null?void 0:je.userData;if(et&&et.id&&et.fId&&(v.current=et.id,b.current=et.fId),tt===z.Roof){const bt=Ii.getRoofId(gt);bt&&(v.current=bt)}}},Fe=(nt,mt)=>{if(j.current&&nt!==null){const tt=nt/2;for(const gt of j.current.children)switch(gt.name){case xt.Left:{gt.position.x=-tt;break}case xt.Right:{gt.position.x=tt;break}}}if(Y.current&&mt!==null&&(Y.current.position.y=-mt/2),O.current&&mt!==null)for(const tt of O.current.children)switch(tt.name){case ai.Lower:{tt.position.y=-mt/2-P;break}case ai.Upper:{tt.position.y=mt/2+s+P;break}}if(N.current&&mt!==null&&(N.current.position.y=mt/2),L.current&&nt!==null&&(L.current.scale.y=nt+.25),Q.current&&nt!==null)for(const tt of Q.current.children)switch(tt.name){case cMe:{tt.position.x=-nt*.4;break}case uMe:{tt.position.x=nt*.4;break}}},He=nt=>{oe.current&&oe.current.setAzimuth(nt)},Le=nt=>{nt.intersections.length==0||nt.intersections[0].object!==nt.object||(nt.stopPropagation(),nt.button===2?(H.getState().selectedElementIdSet.has(e)||q(e),Re(mt=>{mt.contextMenuObjectType=z.SolarWaterHeater})):q(e))},Ye=nt=>{if(!Ae||!D.current||nt.intersections.length==0||nt.intersections[0].object!==nt.object)return;Ne("always"),jn.getState().setEnableOrbitController(!1),A.current=Fr.Move;const mt=Ii.findParentGroup(D.current,[Mp]);mt&&(S.current=Xc.setFromQuaternion(mt.getWorldQuaternion(m0.set(0,0,0,0))).z+d)},lt=nt=>{if(!(!Ae||!D.current||!k.current)&&!(nt.intersections.length==0||nt.intersections[0].object!==nt.object)){switch(Ne("always"),jn.getState().setEnableOrbitController(!1),nt.object.name){case xt.Left:case xt.Right:{A.current=Fr.ResizeX;break}case xt.Upper:case xt.Lower:{A.current=Fr.ResizeY;break}}Me===qa.Horizontal?(k.current.localToWorld(T.current.set(-nt.object.position.x,-nt.object.position.y,0)),D.current.getWorldPosition(R.current).sub(T.current).normalize()):(k.current.localToWorld(T.current.set(-nt.object.position.x,-nt.object.position.y,0)),k.current.getWorldPosition(R.current).sub(T.current).normalize()),de(!0),Pe(x/2),M.current=Ii.findParentGroup(D.current,[Mp])}},Oe=nt=>{!Ae||!D.current||!N.current||nt.intersections.length==0||nt.intersections[0].object!==nt.object||(Ne("always"),jn.getState().setEnableOrbitController(!1),A.current=Fr.ResizeY,Me===qa.Horizontal?(N.current.localToWorld(T.current.set(0,0,0)),D.current.getWorldPosition(R.current).sub(T.current).normalize()):(k.current.localToWorld(T.current.set(0,0,0)),k.current.getWorldPosition(R.current).sub(T.current).normalize()),de(!0),Pe(0),M.current=Ii.findParentGroup(D.current,[Mp]))},ut=nt=>{!Ae||!D.current||!k.current||nt.intersections.length==0||nt.intersections[0].object!==nt.object||(Ne("always"),jn.getState().setEnableOrbitController(!1),A.current=Fr.ResizeHeight,M.current=Ii.findParentGroup(D.current,[Mp]),me(!0),setTimeout(()=>{if(G.current){const mt=we().camera.position;nt.intersections[0].object.localToWorld(ra.set(0,0,-l)),G.current.lookAt(mt.x,mt.y,ra.z),nt.intersections[0].object.localToWorld(T.current.set(0,0,-l)),setTimeout(()=>{G.current.userData.state=!0},10)}},0))},ht=nt=>{if(!(!k.current||!O.current)&&!(nt.intersections.length==0||nt.intersections[0].object!==nt.object)){switch(Ne("always"),jn.getState().setEnableOrbitController(!1),nt.eventObject.name){case ai.Upper:{A.current=Fr.RotateUpper;break}case ai.Lower:{A.current=Fr.RotateLower;break}}k.current.getWorldPosition(T.current),T.current.z=0,de(!0),Pe(x/2),ze(!0),M.current=Ii.findParentGroup(D.current,[Mp])}},Qe=g.useCallback(()=>{if(!A.current)return;const nt=H.getState().elements.find(tt=>tt.id===e);switch(A.current){case Fr.Move:{Re(tt=>{if(!D.current||!A.current)return;const gt=jn.getState().pointer;Se.setFromCamera(gt,we().camera);const Ve=_e(Se,we().scene,A.current),je=tt.elements.find(et=>et.id===e);if(je)if(je.parentId!==v.current&&v.current&&b.current&&(je.parentId=v.current,je.foundationId=b.current),je.cx=D.current.position.x,je.cy=D.current.position.y,je.cz=D.current.position.z,S.current!==null&&(Ve!=null&&Ve.parentGroup)&&(je.relativeAzimuth=S.current-Xc.setFromQuaternion(Ve.parentGroup.getWorldQuaternion(m0.set(0,0,0,0))).z),Ve!=null&&Ve.intersection)if(Ii.getSurfaceType(Ve.parentType,Ve.intersection.normal)===qa.Horizontal)je.rotation=[0,0,0],je.normal=[0,0,1];else{const{x:bt,y:St,z:Pt}=D.current.rotation,Yt=ra.set(0,0,1).applyEuler(D.current.rotation);je.rotation=[bt,St,Pt],je.normal=[Yt.x,Yt.y,Yt.z]}else{const{x:et,y:bt,z:St}=D.current.rotation,Pt=ra.set(0,0,1).applyEuler(D.current.rotation);je.rotation=[et,bt,St],je.normal=[Pt.x,Pt.y,Pt.z]}});break}case Fr.ResizeX:{Re(tt=>{if(!E.current||!D.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.lx=E.current.scale.x,gt.parentType===z.Roof&&(tt.updateElementOnRoofFlag=!tt.updateElementOnRoofFlag),[gt.cx,gt.cy,gt.cz]=D.current.position)});break}case Fr.ResizeY:{Re(tt=>{if(!E.current||!N.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.ly=N.current.position.y*2,gt.parentType===z.Roof&&(tt.updateElementOnRoofFlag=!tt.updateElementOnRoofFlag),[gt.cx,gt.cy,gt.cz]=D.current.position)});break}case Fr.ResizeHeight:{Re(tt=>{if(!U.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.lz=U.current.position.z+s)});break}case Fr.RotateLower:case Fr.RotateUpper:{Re(tt=>{if(!k.current)return;const gt=tt.elements.find(Ve=>Ve.id===e);gt&&(gt.relativeAzimuth=Ii.getRelativeAzimuth(k.current.rotation.z))});break}}const mt=H.getState().elements.find(tt=>tt.id===e);nt&&mt&&(Ii.isNewPositionOk(mt)?Pv.addUndoable(nt,A.current):setTimeout(()=>{Re(tt=>{const gt=tt.elements.findIndex(Ve=>Ve.id===e);gt!==-1&&(tt.elements[gt]=nt)})},10)),we().frameloop!=="demand"&&Ne("demand"),jn.getState().setEnableOrbitController(!0),A.current=null,S.current=null,v.current=null,b.current=null,M.current=null,de(!1),Pe(null),me(!1),ze(!1)},[]);return g.useEffect(()=>(window.addEventListener("pointerup",Qe),()=>window.removeEventListener("pointerup",Qe)),[Qe]),Gp(({camera:nt,scene:mt,raycaster:tt})=>{if(!D.current||!k.current||!Ae||!A.current)return;const gt=jn.getState().pointer;tt.setFromCamera(gt,nt);const Ve=_e(tt,mt,A.current);if(!Ve)return;const{intersection:je,parentGroup:et,parentType:bt}=Ve,St=je.point;switch(A.current){case Fr.Move:{if(!bt)break;switch(qe(D.current.parent,et,bt,je.object),bt){case z.Roof:{const Pt=Ii.getRoofSegmentData(je.object);if(Pt){const{roofId:Yt,foundation:zt,centroid:Rt,roofSegments:Ct}=Pt;if(zt&&Rt&&Ct&&Yt){const yt=new ue().subVectors(St,new ue(zt.cx,zt.cy,zt.cz)).applyEuler(new cn(0,0,-zt.rotation[2])),at=yt.clone().sub(Rt),{normal:Et,rotation:Lt}=Rn.computeState(Ct,at);D.current.position.x=yt.x,D.current.position.y=yt.y,D.current.position.z=yt.z,ye.isEqual(Lt[0],0)?(Ue(0,0,0),S.current!==null?k.current.rotation.set(0,0,S.current-et.rotation.z):k.current.rotation.set(0,0,d)):(Ue(Lt[0],Lt[1],Lt[2]),k.current.rotation.set(0,0,0))}}break}}break}case Fr.ResizeX:{const Pt=T.current,Yt=ra.subVectors(St,Pt),zt=R.current,Rt=Yt.angleTo(zt),Ct=Yt.length()*Math.cos(Rt);if(Me!==qa.Vertical){const yt=ra.copy(zt).multiplyScalar(Ct/2).add(Pt).sub(et.getWorldPosition(_L)).applyQuaternion(et.getWorldQuaternion(m0).invert()),at=Math.abs(Ct);E.current.scale.x=at,D.current.position.x=yt.x,D.current.position.y=yt.y,D.current.position.z=yt.z,ae.current&&ae.current.update(E.current.scale.x),Fe(at,null)}break}case Fr.ResizeY:{const Pt=T.current,Yt=ra.subVectors(St,Pt),zt=R.current,Rt=Yt.angleTo(zt),Ct=Math.cos(Rt)>0?Yt.length()*Math.cos(Rt):.1;if(Me!==qa.Vertical){const yt=l-s,at=Math.hypot(Ct,yt),Et=Math.asin(yt/at),Lt=ra.copy(zt).multiplyScalar(Ct/2).add(Pt).sub(et.getWorldPosition(_L)).applyQuaternion(et.getWorldQuaternion(m0).invert());D.current.position.x=Lt.x,D.current.position.y=Lt.y,W.current.rotation.x=Et,F.current.position.y=-at/2,E.current.scale.y=at,Fe(null,Ct)}break}case Fr.RotateUpper:{ra.subVectors(St,T.current).setZ(0);let Pt=ra.angleTo(gh.set(0,1,0));ra.x>0&&(Pt=-Pt),k.current.rotation.z=Pt-Xc.setFromQuaternion(et.getWorldQuaternion(m0)).z,He(k.current.rotation.z);break}case Fr.RotateLower:{ra.subVectors(St,T.current).setZ(0);let Pt=ra.angleTo(gh.set(0,-1,0));ra.x<0&&(Pt=-Pt),k.current.rotation.z=Pt-Xc.setFromQuaternion(et.getWorldQuaternion(m0)).z,He(k.current.rotation.z);break}case Fr.ResizeHeight:{if(G.current.userData.state&&U.current){const Pt=Math.max(St.z-T.current.z,s*2),Yt=Pt-s,zt=Pt-s*2,Rt=Math.hypot(Yt,a);U.current.position.z=Yt,W.current&&Q.current&&(Q.current.scale.y=zt,Q.current.position.z=zt/2,W.current.rotation.x=Math.asin(Yt/Rt),F.current.position.y=-Rt/2,E.current.scale.y=Rt,O.current&&(O.current.position.z=zt/2))}break}}}),h.jsxs("group",{ref:D,position:[n,o,r],rotation:[c[0],c[1],c[2],"ZXY"],onPointerDown:Le,onPointerOver:()=>Ie(!0),onPointerOut:()=>Ie(!1),children:[h.jsxs("group",{ref:k,rotation:Ce,children:[h.jsxs("group",{ref:N,position:[0,a/2,0],children:[h.jsxs("group",{ref:U,position:[0,0,s+x],children:[h.jsxs("group",{ref:$,children:[h.jsx(wa,{ref:L,args:[s,s,1],castShadow:ne&&!te,receiveShadow:ne&&!te,rotation:[0,0,$t],scale:[1,w,1],children:h.jsx("meshStandardMaterial",{color:m,roughness:.2})}),Ae&&h.jsx(di,{ref:ee,args:[se,.1,se],position:[0,0,s],onPointerDown:ut,children:h.jsx("meshBasicMaterial",{color:"white"})})]}),h.jsx("group",{ref:W,rotation:[C,0,0],children:h.jsxs("group",{ref:F,position:[0,-y/2,0],children:[h.jsxs("group",{ref:E,scale:[i,y,1],children:[h.jsx(yi,{castShadow:!1,receiveShadow:ne,children:h.jsx(sMe,{ref:ae,id:e,lx:i,ly:a,side:$i})}),!te&&h.jsx(yi,{receiveShadow:ne,position:[0,-.475,.001],args:[1,.05],children:h.jsx(Tfn,{})}),ne&&h.jsx(yi,{castShadow:ne,receiveShadow:!1,position:[0,0,-.05],children:h.jsx(sMe,{ref:Z,id:e,lx:i,ly:a,side:js})}),h.jsx(yi,{name:"Water Heater Simulation Plane",uuid:e,userData:{simulation:!0},position:[0,0,.001],visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})})]}),Ae&&!p&&h.jsxs(h.Fragment,{children:[h.jsx(Jot,{onPointerDown:Ye}),h.jsxs("group",{name:"X_Resize_Handles_Group",ref:j,onPointerDown:lt,children:[h.jsx(Gv,{cx:i/2,cy:0,type:xt.Right,size:se}),h.jsx(Gv,{cx:-i/2,cy:0,type:xt.Left,size:se})]})]}),Ae&&p&&h.jsx(xfn,{waterTankLength:w,waterTankRadius:s,panelWidth:y})]})})]}),h.jsxs("group",{ref:Q,position:[0,0,x/2],rotation:[$t,0,0],scale:[1,x+.1,1],children:[h.jsx(wa,{name:cMe,args:[.05,.05,1],position:[-i*.4,0,0],castShadow:ne,children:h.jsx("meshStandardMaterial",{color:"grey"})}),h.jsx(wa,{name:uMe,args:[.05,.05,1],position:[i*.4,0,0],castShadow:ne,children:h.jsx("meshStandardMaterial",{color:"grey"})})]}),he&&h.jsx(yi,{ref:G,args:[1e4,1e4],rotation:[$t,0,0,"ZXY"],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})})]}),Ae&&!p&&h.jsx("group",{name:"Y_Resize_Handles_Group",ref:Y,position:[0,-a/2,0],onPointerDown:Oe,children:h.jsx(Gv,{cx:0,cy:0,type:xt.Lower,size:se})}),Te&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:O,position:[0,0,x/2],children:[h.jsx(DJ,{name:ai.Upper,positionY:a/2+s+P,onPointerDown:ht}),h.jsx(DJ,{name:ai.Lower,positionY:-a/2-P,onPointerDown:ht})]}),(pe||t.showLabel)&&!Ae&&h.jsx(Pfn,{solarWaterHeater:t,groupRef:D})]}),le&&ce!==null&&h.jsx(yi,{ref:_,args:[1e4,1e4],position:[0,0,ce],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),ve&&h.jsx(_3e,{ref:oe,lx:i,ly:a,relativeAzimuth:d})]})}),Qot="Water_Heater_Wrapper_Group",Rfn=xe.memo(({foundationId:t,wrapperType:e})=>{const n=g.useCallback(r=>{if(r.type!==z.SolarWaterHeater)return!1;const i=r;switch(e){case z.Foundation:return i.foundationId===t&&i.parentType===z.Roof;case z.Cuboid:case z.Wall:}return!1},[t,e]),o=H(r=>r.elements.filter(n),Qy);switch(e){case z.Foundation:return h.jsx("group",{name:Qot,children:o.map(r=>h.jsx(Cfn,{...r},r.id))});default:return null}}),Zot="Battery Storage Wrapper";var ol=(t=>(t.Move="Move",t.ResizeXY="ResizeXY",t.ResizeX="ResizeX",t.ResizeY="ResizeY",t.ResizeZ="ResizeZ",t.RotateUpper="RotateUpper",t.RotateLower="RotateLower",t.None="None",t))(ol||{});const Hfn=g.forwardRef((t,e)=>{const n="lightGray",o=B5(NM,gI),r={font:o,height:0,size:.2},i={font:o,height:0,size:.35},[a,l]=g.useState(t.lz),s=m(t.handle),c=y(),u=Math.ceil(a)+1,d=`${a.toFixed(1)} m`,f=a-.175,p=new Array(u+1).fill(0);g.useImperativeHandle(e,()=>({updateLz:w=>{l(w)}}));function m(w){const{hx:x,hy:C}=t;switch(w){case xt.LowerLeftTop:return new ue(-x,-C,0);case xt.LowerRightTop:return new ue(x,-C,0);case xt.UpperLeftTop:return new ue(-x,C,0);case xt.UpperRightTop:return new ue(x,C,0);default:return new ue}}function y(){const w=H.getState().cameraDirection,x=-Math.atan2(w.x,w.y)+Math.PI,C=H.getState().elements.reduce((P,A)=>((A.id===t.id||A.id===t.fId)&&(P+=A.rotation[2]),P),0);return new cn($t,0,x-C,"ZXY")}return h.jsxs("group",{position:s,rotation:c,name:"Vertical Ruler",children:[h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[0,u,0]],color:n}),h.jsxs("mesh",{position:[-1.5,f,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[d,i]}),h.jsx("meshBasicMaterial",{attach:"material",color:"white"})]}),p.map((w,x)=>{const C=.2+(x%5===0?.05:0),P=h.jsx("textGeometry",{args:[`${x}`,r]});return h.jsxs("group",{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[-C,x,0],[C,x,0]],lineWidth:.5,color:n}),h.jsxs("mesh",{position:[.4,x-.125,0],userData:{unintersectable:!0},children:[P,h.jsx("meshBasicMaterial",{color:n})]})]},x)})]})}),sR="Text Sprite",Mfn=g.forwardRef((t,e)=>{const n=Kt(),[o,r]=g.useState(t.hx),[i,a]=g.useState(t.hy),l=o*2,s=i*2,c=.1,u=.2,d=.2,f=1,p=.5,m="white",y="darkorchid",w=Math.max(.3,(o+i)/32),x=.5;g.useImperativeHandle(e,()=>({update(v,b){r(v),a(b)}}));const C=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:s.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[-o-x,0,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o-x,-i,c],[-o-x,i,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o-x+d,-i+3*d,c],[-o-x,-i,c],[-o-x-d,-i+3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o-x+d,i-3*d,c],[-o-x,i,c],[-o-x-d,i-3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,-i,c],[-o-x*2,-i,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,i,c],[-o-x*2,i,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]),P=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:s.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[o+x,0,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[o+x,-i,c],[o+x,i,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o+x+d,-i+3*d,c],[o+x,-i,c],[o+x-d,-i+3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o+x+d,i-3*d,c],[o+x,i,c],[o+x-d,i-3*d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,-i,c],[o+x*2,-i,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,i,c],[o+x*2,i,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]),A=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:l.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[0,-i-x,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,-i-x,c],[o,-i-x,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o+3*d,-i-x-d,c],[-o,-i-x,c],[-o+3*d,-i-x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o-3*d,-i-x-d,c],[o,-i-x,c],[o-3*d,-i-x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,-i,c],[-o,-i-x*2,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,-i,c],[o,-i-x*2,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]),S=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{name:sR,userData:{unintersectable:!0},backgroundColor:y,text:l.toFixed(1)+B.t("word.MeterAbbreviation",n),fontSize:80,fontFace:"Times Roman",textHeight:w,position:[0,i+x,c+u]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,i+x,c],[o,i+x,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o+3*d,i+x-d,c],[-o,i+x,c],[-o+3*d,i+x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[o-3*d,i+x-d,c],[o,i+x,c],[o-3*d,i+x+d,c]],color:m,linewidth:f}),h.jsx(On,{userData:{unintersectable:!0},points:[[-o,i,c],[-o,i+x*2,c]],color:m,linewidth:p}),h.jsx(On,{userData:{unintersectable:!0},points:[[o,i,c],[o,i+x*2,c]],color:m,linewidth:p})]}),[o,i,c,n,m,u]);switch(t.handle){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[C,A]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[P,A]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[C,S]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[P,S]})}return h.jsx(h.Fragment,{})}),Ifn=g.forwardRef(({id:t,hx:e,hy:n,hz:o,fId:r,onMoveHandlePointerDown:i,onResizeHandlePointerDown:a,onRotateHandlePointerDown:l},s)=>{const c=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(null),p=g.useRef(null),m=H(M0),{gl:y}=ti(),w=l2(.2),x=w*1.2,C=o*2,P=g.useMemo(()=>[0,Math.min(-1.2*n,-n-.75)-w*2,$8/2],[n,o,w]),A=g.useMemo(()=>[0,Math.max(1.2*n,n+.75)+w*2,$8/2],[n,o,w]),S=H(pn),[v,b]=g.useState(null),[T,R]=g.useState(null),M=T||v,D=g.useCallback((W,F)=>{dt.getState().duringCameraInteraction||W.intersections.length>0&&(W.intersections[0].object===W.eventObject||W.intersections.length>1&&W.intersections[1].object===W.eventObject)&&(S(L=>{L.hoveredHandle=F}),b(F),ye.isMoveHandle(F)?y.domElement.style.cursor="move":F===ai.Upper||F===ai.Lower?y.domElement.style.cursor="grab":y.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"pointer")},[]),k=g.useCallback(()=>{S(W=>{W.hoveredHandle=null}),b(null),y.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),N=W=>{W.intersections.length==0||W.intersections[0].object!==W.object&&W.intersections[0].object.name!==sR||(a(W),R(W.object.name))};g.useEffect(()=>{const W=()=>{R(null)};return window.addEventListener("pointerup",W),()=>window.removeEventListener("pointerup",W)},[]),g.useImperativeHandle(s,()=>({update(W,F,E){if(c.current)for(const L of c.current.children)switch(L.name){case Ho.Left:{L.position.x=-W-x;break}case Ho.Right:{L.position.x=W+x;break}case Ho.Lower:{L.position.y=-F-x;break}case Ho.Upper:{L.position.y=F+x;break}case Ho.Top:{L.position.z=E*2;break}}if(u.current)for(const L of u.current.children)switch(L.name){case xt.Left:{L.position.x=-W;break}case xt.Right:{L.position.x=W;break}case xt.Upper:{L.position.y=F;break}case xt.Lower:{L.position.y=-F;break}case xt.UpperLeft:{L.position.x=-W,L.position.y=F;break}case xt.UpperRight:{L.position.x=W,L.position.y=F;break}case xt.LowerLeft:{L.position.x=-W,L.position.y=-F;break}case xt.LowerRight:{L.position.x=W,L.position.y=-F;break}case xt.UpperLeftTop:{L.position.x=-W,L.position.y=F,L.position.z=E*2;break}case xt.UpperRightTop:{L.position.x=W,L.position.y=F,L.position.z=E*2;break}case xt.LowerLeftTop:{L.position.x=-W,L.position.y=-F,L.position.z=E*2;break}case xt.LowerRightTop:{L.position.x=W,L.position.y=-F,L.position.z=E*2;break}}if(d.current)for(const L of d.current.children)switch(L.name){case ai.Upper:{L.position.y=Math.max(1.2*F,F+.75)+w*2;break}case ai.Lower:{L.position.y=Math.min(-1.2*F,-F-.75)-w*2;break}}f.current&&f.current.updateLz(E*2),p.current&&p.current.update(W,F)}}));const U=W=>{if(!W)return null;switch(W){case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:return h.jsx(Mfn,{ref:p,hx:e,hy:n,handle:W});case xt.LowerLeftTop:case xt.UpperLeftTop:case xt.LowerRightTop:case xt.UpperRightTop:return h.jsx(Hfn,{ref:f,id:t,fId:r,hx:e,hy:n,lz:C,handle:W})}return null};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Move Handles Group",ref:c,onPointerDown:i,children:[h.jsx(Q9,{handleType:Ho.Lower,position:[0,-n-x,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Upper,position:[0,n+x,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Left,position:[-e-x,0,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Right,position:[e+x,0,0],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Q9,{handleType:Ho.Top,position:[0,0,C],size:w,onPointerOver:D,onPointerOut:k})]}),h.jsxs("group",{name:"Resize Handles Group",ref:u,onPointerDown:N,children:[h.jsx(Vc,{handleType:xt.UpperLeft,position:[-e,n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRight,position:[e,n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerLeft,position:[-e,-n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRight,position:[e,-n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Left,position:[-e,0,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Right,position:[e,0,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Upper,position:[0,n,w/2],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.Lower,position:[0,-n,w/2],size:w,onPointerOver:D,onPointerOut:k}),!m&&h.jsxs(h.Fragment,{children:[h.jsx(Vc,{handleType:xt.LowerLeftTop,position:[-e,-n,C],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperLeftTop,position:[-e,n,C],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.LowerRightTop,position:[e,-n,C],size:w,onPointerOver:D,onPointerOut:k}),h.jsx(Vc,{handleType:xt.UpperRightTop,position:[e,n,C],size:w,onPointerOver:D,onPointerOut:k})]})]}),h.jsxs("group",{name:"Rotate Handles Group",ref:d,onPointerDown:l,children:[h.jsx(MH,{id:t,handleType:ai.Lower,position:P,ratio:w*4,hoverHandle:D,noHoverHandle:k}),h.jsx(MH,{id:t,position:A,handleType:ai.Upper,ratio:w*4,hoverHandle:D,noHoverHandle:k})]}),U(M)]})});class Qk{static addUndoable(e,n){const o=H.getState().elements.find(r=>r.id===e.id);if(o)switch(n){case ol.Move:{Qk.addUndoableMove(e,o);break}case ol.ResizeX:case ol.ResizeY:case ol.ResizeZ:case ol.ResizeXY:{Qk.addUndoableResize(e,o);break}case ol.RotateUpper:case ol.RotateLower:{Qk.addUndoableRotate(e,o);break}}}static addUndoableMove(e,n){const o={name:"Move Battery Storage",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentId:e.parentId,newParentId:n.parentId,oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(o.movedElementId,[o.oldCx,o.oldCy,o.oldCz],o.oldParentId,o.oldRotation)},redo(){r(o.movedElementId,[o.newCx,o.newCy,o.newCz],o.newParentId,o.newRotation)}};H.getState().addUndoable(o);const r=(i,a,l,s)=>{H.getState().set(c=>{const u=c.elements.find(d=>d.id===i);!u||u.type!==z.BatteryStorage||([u.cx,u.cy,u.cz]=[...a],l&&(u.parentId=l,u.foundationId=l),s&&(u.rotation=[...s]))})}}static addUndoableResize(e,n){const o={name:"Resize Battery Storage",timestamp:Date.now(),id:n.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],newPos:[n.cx,n.cy,n.cz],newDms:[n.lx,n.ly,n.lz],undo(){r(o.id,o.oldPos,o.oldDms)},redo(){r(o.id,o.newPos,o.newDms)}};H.getState().addUndoable(o);const r=(i,a,l)=>{H.getState().set(s=>{const c=s.elements.find(u=>u.id===i);c&&([c.cx,c.cy,c.cz]=[...a],[c.lx,c.ly,c.lz]=[...l])})}}static addUndoableRotate(e,n){const o={name:"Rotate Battery Storage",timestamp:Date.now(),changedElementId:n.id,oldValue:e.rotation[2],newValue:n.rotation[2],changedElementType:e.type,undo:()=>{r(o.changedElementId,o.oldValue)},redo:()=>{r(o.changedElementId,o.newValue)}};H.getState().addUndoable(o);const r=(i,a)=>{H.getState().set(l=>{const s=l.elements.find(c=>c.id===i);s&&(s.rotation[2]=a)})}}}const zfn=xe.memo(({element:t,groupRef:e})=>{const{lz:n,label:o,locked:r,labelColor:i="white",labelFontSize:a=20,labelSize:l=.2,labelHeight:s=.2}=t,c=Kt(),[u,d]=g.useState("");return g.useEffect(()=>{if(!e.current)return;const{x:f,y:p,z:m}=e.current.getWorldPosition(ra.set(0,0,0));d((o||B.t("batteryStorageMenu.BatteryStorage",c))+(r?" ("+B.t("shared.ElementLocked",c)+")":"")+(o?"":` +`+B.t("word.Coordinates",c)+": ("+f.toFixed(1)+", "+p.toFixed(1)+", "+(m+n/2).toFixed(1)+") "+B.t("word.MeterAbbreviation",c)))},[o,r,c]),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:u,color:i,fontSize:a,textHeight:l,position:[0,0,s+n]})}),Dfn=()=>{const t=document.createElement("canvas");[t.width,t.height]=[100,150];const e=t.getContext("2d");return e&&(e.fillStyle="white",e.fillRect(0,0,100,150),e.lineWidth=1.5,e.strokeStyle="black",e.beginPath(),e.moveTo(0,25),e.lineTo(0,125),e.moveTo(100,25),e.lineTo(100,125),e.stroke(),e.lineWidth=3,e.beginPath(),e.moveTo(25,50),e.lineTo(75,50),e.moveTo(25,60),e.lineTo(75,60),e.moveTo(25,70),e.lineTo(75,70),e.moveTo(25,80),e.lineTo(75,80),e.moveTo(25,90),e.lineTo(75,90),e.moveTo(25,100),e.lineTo(75,100),e.stroke()),new o3(t)},Efn=(t,e)=>{const n=document.createElement("canvas");[n.width,n.height]=[300*t,300*e];const o=n.width/2,r=n.height/2,i=n.getContext("2d");return i&&(i.fillStyle="white",i.fillRect(0,0,300*t,300*e),i.lineWidth=8,i.strokeStyle="blue",i.beginPath(),i.arc(o,r,130,0,2*Math.PI),i.stroke(),i.beginPath(),i.moveTo(o+10,r-100),i.lineTo(o-40,r+15),i.lineTo(o-3,r+15),i.lineTo(o-10,r+100),i.lineTo(o+40,r-10),i.lineTo(o+3,r-10),i.closePath(),i.lineWidth=8,i.stroke()),new o3(n)},kfn=xe.memo(g.forwardRef(({lx:t,ly:e,lz:n,color:o},r)=>{const i=g.useMemo(()=>{const c=Dfn();return c.wrapS=es,c.repeat.set(Math.max(1,Math.round(t/1.5)),1),c},[]),a=(c,u)=>{const d=Efn(c,u);return d.wrapS=es,d.wrapT=es,d.repeat.set(1,1),d.rotation=$t,d},[l,s]=g.useState(a(e,n));return g.useImperativeHandle(r,()=>({update(c,u,d){i.repeat.setX(Math.max(1,Math.round(c/1.5))),s(a(u,d))}})),h.jsxs(h.Fragment,{children:[h.jsx("meshStandardMaterial",{side:$i,attach:"material-0",color:o,map:l}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-1",color:o,map:l}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-2",color:o,map:i}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-3",color:o,map:i}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-4",color:o}),h.jsx("meshStandardMaterial",{side:$i,attach:"material-5",color:o})]})})),F_=.5,Ffn=t=>{const{id:e,parentId:n,cx:o,cy:r,lx:i,ly:a,lz:l,rotation:s,locked:c,color:u="white",showLabel:d,lineColor:f="black",lineWidth:p=.2}=t,m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),P=g.useRef(null),A=g.useRef(null),S=g.useRef(null),v=H(xs),b=H(pn),T=H(vQ),{set:R}=ti(),M=Fc(e),[D,k]=g.useState(!1),[N,U]=g.useState(!1),W=g.useRef(ol.None),F=g.useRef(null),E=g.useRef(new ue),L=g.useRef(new ue),j=g.useRef(new cn(0,0,0,"ZXY")),Y=g.useRef(new ue),O=g.useRef(null),_=g.useRef(null),[G,Q,oe]=[i/2,a/2,l/2],[ee,$,ae]=s,Z=M&&!c,ne=pe=>{R({frameloop:pe})},te=(pe,Ie,ve)=>{switch(ve){case ol.Move:{const ze=pe.intersectObjects(Ie.children);for(const Ae of ze)if(Ae.object.name===VL){const se=Ae.object.parent;return se?{intersection:Ae,parentGroup:se}:null}break}case ol.ResizeX:case ol.ResizeY:case ol.ResizeXY:case ol.ResizeZ:case ol.RotateLower:case ol.RotateUpper:{if(!D||!x.current||!O.current)return null;const ze=pe.intersectObjects([x.current]),Ae=ze[0];return!Ae||ye.isEqual(Ae.point.z,0)?null:{intersection:ze[0],parentGroup:O.current}}}return null},q=(pe,Ie)=>{var ze;const ve=Ie.children.find(Ae=>Ae.name===Zot);if(ve&&pe&&ve!==pe){pe.children=pe.children.filter(se=>se!==m.current),ve.children.push(m.current),m.current.parent=ve;const Ae=(ze=ve.parent)==null?void 0:ze.userData;Ae&&Ae.id&&Ae.fId&&(_.current=Ae.id)}},le=pe=>{A.current&&A.current.setAzimuth(pe)},de=pe=>{pe.intersections.length==0||pe.intersections[0].object!==pe.object||(T(e),pe.button===2&&b(Ie=>{Ie.contextMenuObjectType=z.BatteryStorage}))},he=pe=>{if(pe.intersections.length==0||pe.intersections[0].object!==pe.object)return;ne("always"),jn.getState().setEnableOrbitController(!1),W.current=ol.Move,E.current.set(-pe.object.position.x,-pe.object.position.y,0);const Ie=Ii.findParentGroup(m.current,[Mp]);Ie&&(F.current=Xc.setFromQuaternion(Ie.getWorldQuaternion(m0.set(0,0,0,0))).z+m.current.rotation.z)},me=pe=>{if(pe.intersections.length==0||pe.intersections[0].object!==pe.object&&pe.intersections[0].object.name!==sR)return;ne("always"),jn.getState().setEnableOrbitController(!1);const Ie=pe.object.name;if(Ie.includes("Top")){W.current=ol.ResizeZ;const ze=H.getState().elements.find(Ae=>Ae.id===n);if(ze){const Ae=H.getState().cameraDirection,se=Math.atan2(-Ae.y,-Ae.x)-m.current.rotation.z-ze.rotation[2];L.current.copy(pe.object.position),j.current.set($t,0,-$t+se,"ZXY")}}else Ie===xt.Left||Ie===xt.Right?(W.current=ol.ResizeX,m.current&&Y.current.subVectors(m.current.localToWorld(ra.set(1,0,0)),m.current.localToWorld(gh.set(0,0,0)))):Ie===xt.Upper||Ie===xt.Lower?(W.current=ol.ResizeY,m.current&&Y.current.subVectors(m.current.localToWorld(ra.set(0,1,0)),m.current.localToWorld(gh.set(0,0,0)))):(W.current=ol.ResizeXY,m.current&&Y.current.subVectors(m.current.localToWorld(ra.set(1,0,0)),m.current.localToWorld(gh.set(0,0,0)))),L.current.set(0,0,0),j.current.set(0,0,0);O.current=Ii.findParentGroup(m.current,[Mp]),k(!0)},ce=pe=>{pe.intersections.length==0||pe.intersections[0].object!==pe.object||(ne("always"),jn.getState().setEnableOrbitController(!1),pe.object.name===ai.Lower?W.current=ol.RotateLower:pe.object.name===ai.Upper?W.current=ol.RotateUpper:W.current=ol.None,k(!0),U(!0),L.current.set(0,0,0),j.current.set(0,0,0),O.current=Ii.findParentGroup(m.current,[Mp]))},Pe=g.useCallback(()=>{if(W.current===ol.None)return;const pe=H.getState().elements.find(Ie=>Ie.id===e);b(Ie=>{if(m.current&&y.current&&w.current){const ve=Ie.elements.find(ze=>ze.id===e&&ze.type===z.BatteryStorage);ve&&(ve.cx=m.current.position.x,ve.cy=m.current.position.y,ve.cz=y.current.position.z,ve.lx=w.current.scale.x,ve.ly=w.current.scale.y,ve.lz=w.current.scale.z,ve.rotation[2]=m.current.rotation.z,_.current&&_.current&&(ve.parentId=_.current,ve.foundationId=_.current))}}),pe&&Qk.addUndoable(pe,W.current),ne("demand"),jn.getState().setEnableOrbitController(!0),k(!1),W.current=ol.None,_.current=null,U(!1)},[]);return g.useEffect(()=>(window.addEventListener("pointerup",Pe),()=>window.removeEventListener("pointerup",Pe)),[Pe]),Gp(({camera:pe,scene:Ie,raycaster:ve})=>{if(!m.current&&W.current===ol.None)return;const ze=jn.getState().pointer;ve.setFromCamera(ze,pe);const Ae=te(ve,Ie,W.current);if(!Ae)return;const{intersection:se,parentGroup:ge}=Ae,we=se.point;switch(W.current){case ol.Move:{if(ge){q(m.current.parent,ge),F.current!==null?m.current.rotation.z=F.current-ge.rotation.z:m.current.rotation.z=ae;const Te=ra.copy(E.current).applyEuler(Xc.set(0,0,ge.rotation.z+m.current.rotation.z));m.current.position.x=we.x+Te.x-ge.position.x,m.current.position.y=we.y+Te.y-ge.position.y,m.current.position.applyEuler(Xc.set(0,0,-ge.rotation.z))}break}case ol.ResizeX:case ol.ResizeY:{const Te=H.getState().resizeAnchor,Re=ra.subVectors(we,Te),Ne=Re.angleTo(Y.current),_e=Re.length()*Math.cos(Ne),Ue=_e>0?Math.max(F_,_e):Math.min(-.5,_e),qe=ra.copy(Y.current).multiplyScalar(Ue/2).add(Te).sub(ge.getWorldPosition(_L)).applyQuaternion(ge.getWorldQuaternion(m0).invert()),Fe=Math.abs(Ue);W.current===ol.ResizeX?w.current.scale.x=Fe:W.current===ol.ResizeY&&(w.current.scale.y=Fe),S.current&&S.current.update(w.current.scale.x,w.current.scale.y,l),m.current.position.x=qe.x,m.current.position.y=qe.y;break}case ol.ResizeXY:{const Te=we.clone().setZ(0),Re=H.getState().resizeAnchor.clone().setZ(0),Ne=ra.subVectors(Te,Re).applyEuler(Xc.set(0,0,-m.current.rotation.z-ge.rotation.z)),_e=gh.addVectors(Te,Re).multiplyScalar(.5),Ue=MJ.subVectors(_e,ge.position).setZ(0).applyEuler(Xc.set(0,0,-ge.rotation.z)),qe=Math.abs(Ne.x),Fe=Math.abs(Ne.y);qe>F_&&Fe>F_&&(m.current.position.x=Ue.x,m.current.position.y=Ue.y,w.current.scale.x=qe,w.current.scale.y=Fe,S.current&&S.current.update(qe,Fe,l));break}case ol.ResizeZ:{if(y.current){const Te=Math.max(F_,we.z-ge.position.z*2);w.current.scale.z=Te,y.current.position.z=Te/2,S.current&&S.current.update(i,a,Te)}break}case ol.RotateLower:{const Te=ra.subVectors(we,m.current.localToWorld(gh.set(0,0,0))).setZ(0).normalize(),Re=Math.atan2(Te.y,Te.x);m.current.rotation.z=Re-ge.rotation.z+$t,le(m.current.rotation.z);break}case ol.RotateUpper:{const Te=ra.subVectors(we,m.current.localToWorld(gh.set(0,0,0))).setZ(0).normalize(),Re=Math.atan2(Te.y,Te.x);m.current.rotation.z=Re-ge.rotation.z-$t,le(m.current.rotation.z);break}}const[Se,Me,Ce]=w.current.scale.toArray().map(Te=>Te/2);C.current&&C.current.update(Se,Me,Ce)}),h.jsxs(h.Fragment,{children:[h.jsxs("group",{ref:m,position:[o,r,0],rotation:[0,0,ae],onPointerDown:de,children:[h.jsx("group",{ref:y,position:[0,0,oe],children:h.jsx(di,{ref:w,scale:[i,a,l],castShadow:v,receiveShadow:v,children:h.jsx(kfn,{ref:S,lx:i,ly:a,lz:l,color:u})})}),Z&&h.jsx(Ifn,{ref:C,id:e,hx:G,hy:Q,hz:oe,fId:n,onMoveHandlePointerDown:he,onResizeHandlePointerDown:me,onRotateHandlePointerDown:ce}),d&&!M&&h.jsx(zfn,{element:t,groupRef:m}),!M&&h.jsx("group",{position:[0,0,oe],children:h.jsx(o4,{hx:G,hy:Q,hz:oe,lineColor:f,lineWidth:p})}),D&&h.jsx(yi,{name:"Intersection Plane",ref:x,args:[1e4,1e4],position:L.current,rotation:j.current,visible:!1})]}),N&&h.jsx("group",{ref:P,position:[o,r,0],children:h.jsx(_3e,{ref:A,lx:i,ly:a,relativeAzimuth:s[2]})})]})},Lfn=({foundationId:t,hz:e})=>{const n=g.useCallback(r=>r.type===z.BatteryStorage&&r.foundationId===t,[]),o=H(r=>r.elements.filter(n),Qy);return h.jsx("group",{name:Zot,position:[0,0,e],children:o.map(r=>h.jsx(Ffn,{...r},r.id))})},Mp="Foundation_Group",VL="Foundation",Wfn=xe.memo(t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=.1,rotation:l=[0,0,0],color:s="gray",lineColor:c="black",lineWidth:u=.2,locked:d=!1,showLabel:f=!1,textureType:p=Xi.NoTexture,solarStructure:m}=t,y=Fc(e),w=H(Au),x=H(M0),C=H(Jn),P=H(HS),A=H(pn),S=H(Q3),v=H(u5e),b=H(Z3),T=H(H7),R=H(T5e),M=H(P5e),D=H(qRt),k=H(yQ),N=H(pXe),U=H(M7),W=H(OXe),F=H(_Xe),E=H(Jp),L=H(z0),j=H(y5e),Y=H(O5),O=H(_Rt),_=H($Rt),G=H(xs),Q=H(h4),oe=H(TQ),ee=H(Fn),$=H(b5e),ae=H(c5e),Z=H($y),ne=dt(vs),te=H(Df),q=H(V2e),le=In(O1),{camera:de,gl:{domElement:he}}=ti(),[me,ce]=g.useState(!1),[Pe,pe]=g.useState(null),[Ie,ve]=g.useState(!1),[ze,Ae]=g.useState({show:!1,direction:null,position:null}),[se,ge]=g.useState([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]),we=g.useRef(null),Se=g.useRef(!1),Me=g.useRef(!1),Ce=g.useRef(null),Te=g.useRef(Qr.null),Re=g.useRef(new Map),Ne=g.useRef(null),_e=g.useRef(null),Ue=g.useRef(null),qe=g.useRef(null),Fe=g.useRef(null),He=g.useRef(null),Le=g.useRef(null),Ye=g.useRef(null),lt=g.useRef(null),Oe=g.useRef(null),ut=g.useRef(null),ht=g.useRef(null),Qe=g.useRef(new ue),nt=g.useRef(new ue),mt=g.useRef(new ue(1,1,1)),tt=g.useRef(new ue(1,1,1)),gt=g.useRef(0),Ve=g.useRef(0),je=g.useRef([]),et=g.useRef([]),bt=g.useRef([]),St=g.useRef([]),Pt=g.useRef([]),Yt=g.useRef([]),zt=g.useMemo(()=>({lng:w}),[w]),Rt=g.useMemo(()=>new _t,[]),Ct=g.useMemo(()=>new yu,[]),yt=r/2,at=i/2,Et=a/2,Lt=g.useMemo(()=>new ue(-yt,-at,Et),[yt,at,Et]),Je=g.useMemo(()=>new ue(-yt,at,Et),[yt,at,Et]),st=g.useMemo(()=>new ue(yt,-at,Et),[yt,at,Et]),It=g.useMemo(()=>new ue(yt,at,Et),[yt,at,Et]),ot=l2(),it=ot,Be=ot,pt=ot*4,ct=at+pt,Xe=g.useRef(!1),ft=g.useRef(null),wt=H(GRt),kt=H(HJe),Zt=g.useMemo(()=>new ue,[]);if(Ue.current){let gn=-1;switch(Ue.current.type){case z.SolarPanel:{gn=Ue.current.poleHeight;break}case z.ParabolicTrough:{const tn=Ue.current;gn=tn.poleHeight+tn.lx/2;break}case z.ParabolicDish:{const tn=Ue.current;gn=tn.poleHeight+tn.lx/2+tn.lx*tn.lx/(4*tn.latusRectum);break}case z.FresnelReflector:{const tn=Ue.current;gn=tn.poleHeight+tn.lx/2;break}}gn>=0&&Zt.set(0,0,(t==null?void 0:t.lz)/2+gn)}g.useEffect(()=>{Re.current.clear();for(const gn of H.getState().elements)gn.type===z.Wall&&gn.parentId===e&&Re.current.set(gn.id,gn)},[e,_]),g.useEffect(()=>{O&&O===we.current&&(Re.current.delete(O),Se.current=!1,Me.current=!1,we.current=null,A(gn=>{gn.addedWallId===gn.deletedWallId&&(gn.addedWallId=null),gn.deletedWallId=null}),jn.getState().setEnableOrbitController(!0),Ae({show:!1,direction:null,position:null}),ge([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]))},[O]),g.useEffect(()=>{if(t&&ne){const gn=le(t.id);pe(gn?ye.fetchHeatmapTexture(gn,te??5):null)}},[ne,te,q]),g.useEffect(()=>{!Xe.current||!H.getState().getAutoDeletedElements()||Ot()},[wt,kt]);const Ot=A3.debounce(()=>{if(!ft.current)return;const gn=H.getState().getAutoDeletedElements();if(!gn)return;const{wall:tn,newAngle:Gt,newJoints:wn}=ft.current,Cn={name:"Move Wall",timestamp:Date.now(),id:tn.id,oldPoints:[[...Pt.current[0]],[...Pt.current[1]]],newPoints:[[...tn.leftPoint],[...tn.rightPoint]],oldJoints:[[...bt.current[0]],[...bt.current[1]]],newJoints:[[...wn[0]],[...wn[1]]],oldAngle:gt.current,newAngle:Gt,flippedWallSide:Te.current,autoDeletedElements:[...gn],undo(){switch(this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const Nt=C(this.newJoints[0][0]);Nt&&lr(Nt);break}case Qr.right:{const Nt=C(this.newJoints[1][0]);Nt&&xo(Nt);break}}const[Wn,Un]=this.oldJoints,[rt,vt]=this.newJoints;A(Nt=>{for(const Ft of Nt.elements)if(Ft.id===this.id){const[en,sn]=this.oldPoints;Ft.cx=(en[0]+sn[0])/2,Ft.cy=(en[1]+sn[1])/2,Ft.lx=Math.hypot(en[0]-sn[0],en[1]-sn[1]);const dn=Ft;dn.relativeAngle=this.oldAngle,dn.leftPoint=[...en],dn.rightPoint=[...sn],dn.leftJoints=[...Wn],dn.rightJoints=[...Un];break}Nt.resizeHandleType=null,Nt.elements.push(...this.autoDeletedElements),Nt.deletedRoofId=null,Nt.autoDeletedChild=null,Nt.autoDeletedRoofs=null,Nt.autoDeletedRoofIdSet.clear()}),Wn[0]!==rt[0]&&A(Nt=>{for(const Ft of Nt.elements)Ft.type===z.Wall&&(Ft.id===Wn[0]&&(Ft.rightJoints=[this.id]),Ft.id===rt[0]&&(this.flippedWallSide!==Qr.left?Ft.rightJoints=[]:Ft.leftJoints=[]))}),Un[0]!==vt[0]&&A(Nt=>{for(const Ft of Nt.elements)Ft.type===z.Wall&&(Ft.id===Un[0]&&(Ft.leftJoints=[this.id]),Ft.id===vt[0]&&(this.flippedWallSide!==Qr.right?Ft.leftJoints=[]:Ft.rightJoints=[]))}),Te.current=Qr.null},redo(){const[Wn,Un]=this.oldJoints,[rt,vt]=this.newJoints;switch(A(Ft=>{for(const en of Ft.elements)if(en.id===this.id&&en.type===z.Wall){const[sn,dn]=this.newPoints;en.cx=(sn[0]+dn[0])/2,en.cy=(sn[1]+dn[1])/2,en.lx=Math.hypot(sn[0]-dn[0],sn[1]-dn[1]);const En=en;En.relativeAngle=this.newAngle,En.leftPoint=[...sn],En.rightPoint=[...dn],En.leftJoints=[...rt],En.rightJoints=[...vt];break}}),Wn[0]!==rt[0]&&A(Ft=>{for(const en of Ft.elements)en.type===z.Wall&&(en.id===Wn[0]&&(en.rightJoints=[]),en.id===rt[0]&&(this.flippedWallSide===Qr.right?en.leftJoints=[this.id]:en.rightJoints=[this.id]))}),Un[0]!==vt[0]&&A(Ft=>{for(const en of Ft.elements)en.type===z.Wall&&(en.id===Un[0]&&(en.leftJoints=[]),en.id===vt[0]&&(this.flippedWallSide===Qr.right?en.rightJoints=[this.id]:en.leftJoints=[this.id]))}),this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const Ft=C(this.newJoints[0][0]);Ft&&xo(Ft);break}case Qr.right:{const Ft=C(this.newJoints[1][0]);Ft&&lr(Ft);break}}const Nt=new Set(this.autoDeletedElements.map(Ft=>Ft.id));A(Ft=>{Ft.resizeHandleType=null,Ft.elements=Ft.elements.filter(sn=>!Nt.has(sn.id));const en=this.autoDeletedElements.find(sn=>sn.type===z.Roof);en&&(Ft.deletedRoofId=en.id)}),Te.current=Qr.null}};ee(Cn),Xe.current=!1,A(Wn=>{Wn.autoDeletedRoofs=null,Wn.autoDeletedRoofIdSet.clear(),Wn.autoDeletedChild=null})},100),on=gn=>{Rt.x=gn.offsetX/he.clientWidth*2-1,Rt.y=-(gn.offsetY/he.clientHeight)*2+1,Ct.setFromCamera(Rt,de)},qt=gn=>{switch(gn){case Xi.Texture01:return{x:1,y:1};case Xi.Texture02:return{x:2,y:2};case Xi.Texture03:return{x:.4,y:.4};case Xi.Texture04:return{x:.25,y:.25};case Xi.Texture05:return{x:5,y:5};case Xi.Texture06:return{x:1,y:1};case Xi.Texture07:return{x:1,y:1};default:return{x:1,y:1}}},Pn=Up((gn=>{switch(gn){case Xi.Texture01:return Dot;case Xi.Texture02:return Eot;case Xi.Texture03:return kot;case Xi.Texture04:return Fot;case Xi.Texture05:return Lot;case Xi.Texture06:return Wot;case Xi.Texture07:return Not;default:return Gg}})(p)),fo=g.useMemo(()=>{const gn=Pn.clone();gn.wrapS=gn.wrapT=es;const tn=qt(p);return gn.repeat.set(r/tn.x,i/tn.y),gn.needsUpdate=!0,gn},[Pn,r,i]),to=g.useCallback((gn,tn)=>{dt.getState().duringCameraInteraction||gn.intersections.length>0&&(gn.intersections[0].object===gn.eventObject||gn.intersections.length>1&&gn.intersections[1].object===gn.eventObject)&&(A(wn=>{wn.hoveredHandle=tn}),ye.isMoveHandle(tn)?he.style.cursor="move":tn===ai.Lower||tn===ai.Upper?he.style.cursor="grab":he.style.cursor=H.getState().addedFoundationId?"crosshair":"pointer")},[]),Dt=g.useCallback(()=>{A(gn=>{gn.hoveredHandle=null}),he.style.cursor=H.getState().addedFoundationId?"crosshair":"default"},[]),fn=gn=>{switch(gn){case z.Human:case z.Tree:case z.Flower:case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Wall:case z.BatteryStorage:return!0;default:return!1}},kn=(gn,tn)=>{let Gt=tn,wn=null,Cn=null,Wn=null,Un;if(!H.getState().enableFineGrid)for(const[rt,vt]of Re.current){if(rt===we.current||Ue.current&&rt===Ue.current.id)continue;const Nt=new ue(vt.leftPoint[0],vt.leftPoint[1],0),Ft=new ue(vt.rightPoint[0],vt.rightPoint[1],0),en=(Nt==null?void 0:Nt.distanceTo(gn))??Number.MAX_VALUE,sn=(Ft==null?void 0:Ft.distanceTo(gn))??Number.MAX_VALUE,dn=en<=sn,En=dn?en:sn,xn=dn?Nt:Ft;En<=Gt+.01&&(Gt=En,wn=xn,Un=dn?vt.leftJoints[0]:vt.rightJoints[0],Cn=rt,Wn=dn?Eg.Left:Eg.Right)}return{id:Cn,point:wn,side:Wn,jointId:Un}},yo=(gn,tn)=>(H.getState().enableFineGrid?(gn=ye.snapToFineGrid(gn),tn=null):tn?gn=tn:gn=ye.snapToNormalGrid(gn),gn),ur=gn=>{Re.current.clear();for(const Gt of H.getState().elements)Gt.type===z.Wall&&Gt.parentId===e&&Re.current.set(Gt.id,Gt);let tn=Re.current.get(gn);for(;tn&&tn.leftJoints.length>0;){const Gt=Re.current.get(tn.id);if(!Gt||(A(wn=>{for(const Cn of wn.elements)if(Cn.id===Gt.id){const Wn=Cn;Wn.relativeAngle=(Gt.relativeAngle+Math.PI)%fa,Wn.leftPoint=[...Gt.rightPoint],Wn.rightPoint=[...Gt.leftPoint],Wn.leftJoints=[Gt.rightJoints[0]],Wn.rightJoints=[Gt.leftJoints[0]];break}}),tn=Re.current.get(tn.leftJoints[0]),tn&&tn.id===gn))break}A(Gt=>{Gt.updateWallMapOnFoundationFlag=!Gt.updateWallMapOnFoundationFlag,H.getState().resizeHandleType&&(Gt.resizeHandleType=H.getState().resizeHandleType===xt.LowerLeft?xt.LowerRight:xt.LowerLeft)}),Te.current=Te.current===Qr.null?Qr.loop:Qr.null},lr=(gn,tn)=>{Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);const Gt=gn;let wn=gn;for(;wn;){const Cn=Re.current.get(wn.id);if(!Cn)break;A(Un=>{for(const rt of Un.elements)if(Cn&&rt.id===Cn.id){const vt=rt;vt.relativeAngle=(Cn.relativeAngle+Math.PI)%fa,vt.leftPoint=[...Cn.rightPoint],vt.rightPoint=[...Cn.leftPoint],vt.leftJoints=Cn.rightJoints.length>0?[Cn.rightJoints[0]]:[],vt.rightJoints=Cn.leftJoints.length>0?[Cn.leftJoints[0]]:[];break}});let Wn;if(Cn.leftJoints.length>0&&(Wn=Re.current.get(Cn.leftJoints[0])),Wn&&Wn.id!==Gt.id)wn=Wn;else break}A(Cn=>{if(tn)for(const Wn of Cn.elements)Wn.type===z.Wall&&(Wn.id===Gt.id&&(Wn.leftJoints=[tn.id]),Wn.id===tn.id&&(Wn.rightJoints=[Gt.id]));Cn.updateWallMapOnFoundationFlag=!Cn.updateWallMapOnFoundationFlag,Cn.resizeHandleType=xt.LowerLeft}),Te.current=Te.current===Qr.null?Qr.right:Qr.null},xo=(gn,tn)=>{Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);const Gt=gn;let wn=gn;for(;wn;){const Cn=Re.current.get(wn.id);if(!Cn)break;A(Un=>{for(const rt of Un.elements)if(Cn&&rt.id===Cn.id){const vt=rt;vt.relativeAngle=(Cn.relativeAngle+Math.PI)%fa,vt.leftPoint=[...Cn.rightPoint],vt.rightPoint=[...Cn.leftPoint],vt.leftJoints=Cn.rightJoints.length>0?[Cn.rightJoints[0]]:[],vt.rightJoints=Cn.leftJoints.length>0?[Cn.leftJoints[0]]:[];break}});let Wn;if(Cn.rightJoints.length>0&&(Wn=Re.current.get(Cn.rightJoints[0])),Wn&&Wn.id!==Gt.id)wn=Wn;else break}A(Cn=>{if(tn)for(const Wn of Cn.elements)Wn.type===z.Wall&&(Wn.id===Gt.id&&(Wn.rightJoints=[tn.id]),Wn.id===tn.id&&(Wn.leftJoints=[Gt.id]));Cn.updateWallMapOnFoundationFlag=!Cn.updateWallMapOnFoundationFlag,Cn.resizeHandleType=xt.LowerRight}),Te.current=Te.current===Qr.null?Qr.left:Qr.null},wo=gn=>{let tn;Re.current.clear();for(const wn of H.getState().elements)wn.id===gn&&(tn=wn),wn.type===z.Wall&&wn.parentId===e&&Re.current.set(wn.id,wn);let Gt=!1;for(;tn&&tn.leftJoints.length>0;)if(tn=Re.current.get(tn.leftJoints[0]),(tn==null?void 0:tn.id)===gn){Gt=!0;break}if(Gt){let wn=0,Cn=0;for(;tn&&tn.leftJoints.length>0;){const Wn=Re.current.get(tn.leftJoints[0]),Un=(Math.PI*3-(tn.relativeAngle-Wn.relativeAngle))%fa;if(wn+=Un,Cn+=1,tn=Wn,tn.id===gn)break}wn>(Cn-2)*Math.PI+.1?ur(gn):Te.current!==Qr.null&&(Te.current=Qr.loop)}return Gt},Rr=gn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:gn,undo:()=>{E(tn.addedElement.id,!1)},redo:()=>{A(Gt=>{Gt.elements.push(tn.addedElement),Gt.selectedElement=tn.addedElement})}};ee(tn)},Eo=gn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:gn,flippedWallSide:Te.current,undo:()=>{const Gt=tn.addedElement;if(E(Gt.id,!1),(tn.flippedWallSide===Qr.right||tn.flippedWallSide===Qr.loop)&&Gt.rightJoints.length>0){const wn=C(Gt.rightJoints[0]);wn&&xo(wn)}else if(tn.flippedWallSide===Qr.left&&Gt.leftJoints.length>0){const wn=C(Gt.leftJoints[0]);wn&&lr(wn)}},redo:()=>{const Gt=tn.addedElement;if(tn.flippedWallSide===Qr.right||tn.flippedWallSide===Qr.loop&&Gt.rightJoints.length>0){const wn=C(Gt.rightJoints[0]);wn&&lr(wn)}else if(tn.flippedWallSide===Qr.left&&Gt.leftJoints.length>0){const wn=C(Gt.leftJoints[0]);wn&&xo(wn)}Gt.rightJoints.length>0&&R(Gt.rightJoints[0],[Gt.id]),Gt.leftJoints.length>0&&M(Gt.leftJoints[0],[Gt.id]),A(wn=>{wn.elements.push(Gt),wn.selectedElement=Gt,wn.updateWallMapOnFoundationFlag=!wn.updateWallMapOnFoundationFlag})}};ee(tn)},An=gn=>{const tn=H.getState().getAutoDeletedElements(),Gt={name:"Resize Wall",timestamp:Date.now(),resizedElementId:gn.id,resizedElementType:gn.type,oldPosition:Qe.current.clone(),newPosition:nt.current.clone(),oldDimension:mt.current.clone(),newDimension:tt.current.clone(),oldAngle:gt.current,newAngle:Ve.current,oldJoints:[[...bt.current[0]],[...bt.current[1]]],newJoints:[[...St.current[0]],[...St.current[1]]],oldPoint:[[...Pt.current[0]],[...Pt.current[1]]],newPoint:[[...Yt.current[0]],[...Yt.current[1]]],flippedWallSide:Te.current,autoDeletedElement:tn?[...tn]:[],undo:()=>{switch(Gt.flippedWallSide){case Qr.right:if(Gt.newJoints[1]){const wn=C(Gt.newJoints[1][0]);wn&&xo(wn)}break;case Qr.left:if(Gt.newJoints[0]){const wn=C(Gt.newJoints[0][0]);wn&&lr(wn)}break;case Qr.loop:if(Gt.newJoints[0]&&Gt.newJoints[1])ur(Gt.resizedElementId);else if(Gt.newJoints[1]){const wn=C(Gt.newJoints[1][0]);wn&&xo(wn)}else if(Gt.newJoints[0]){const wn=C(Gt.newJoints[0][0]);wn&&lr(wn)}break}A(wn=>{for(const Cn of wn.elements)if(Cn.id===Gt.resizedElementId){const Wn=Cn;switch(Wn.cx=Gt.oldPosition.x,Wn.cy=Gt.oldPosition.y,Wn.cz=Gt.oldPosition.z,Wn.lx=Gt.oldDimension.x,Wn.ly=Gt.oldDimension.y,Wn.lz=Gt.oldDimension.z,Wn.relativeAngle=Gt.oldAngle,Wn.leftJoints=[...Gt.oldJoints[0]],Wn.rightJoints=[...Gt.oldJoints[1]],Wn.leftPoint=[...Gt.oldPoint[0]],Wn.rightPoint=[...Gt.oldPoint[1]],Gt.flippedWallSide){case Qr.loop:{if(Gt.oldJoints[0]!==Gt.newJoints[1])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[1][0]&&(Un.rightJoints=[]),Un.id===Gt.oldJoints[0][0]&&(Un.rightJoints=[Gt.resizedElementId]));else if(Gt.oldJoints[1]!==Gt.newJoints[0])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[0][0]&&(Un.leftJoints=[]),Un.id===Gt.oldJoints[1][0]&&(Un.leftJoints=[Gt.resizedElementId]));break}case Qr.left:case Qr.right:{if(!Gt.oldJoints[0]&&Gt.newJoints[1]){for(const Un of wn.elements)if(Un.type===z.Wall&&Un.id===Gt.newJoints[1][0]){Un.leftJoints=[];break}}else if(!Gt.oldJoints[1]&&Gt.newJoints[0]){for(const Un of wn.elements)if(Un.type===z.Wall&&Un.id===Gt.newJoints[0][0]){Un.rightJoints=[];break}}else if(Gt.flippedWallSide===Qr.left&&Gt.oldJoints[0])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[1][0]&&(Un.leftJoints=[]),Un.id===Gt.oldJoints[0][0]&&(Un.rightJoints=[Wn.id]));else if(Gt.flippedWallSide===Qr.right&&Gt.oldJoints[1])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[0][0]&&(Un.rightJoints=[]),Un.id===Gt.oldJoints[1][0]&&(Un.leftJoints=[Wn.id]));break}case Qr.null:{if(Gt.oldJoints[0]!==Gt.newJoints[0])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[0][0]&&(Un.rightJoints=[]),Un.id===Gt.oldJoints[0][0]&&(Un.rightJoints=[Wn.id]));if(Gt.oldJoints[1]!==Gt.newJoints[1])for(const Un of wn.elements)Un.type===z.Wall&&(Un.id===Gt.newJoints[1][0]&&(Un.leftJoints=[]),Un.id===Gt.oldJoints[1][0]&&(Un.leftJoints=[Wn.id]));wn.updateWallMapOnFoundationFlag=!wn.updateWallMapOnFoundationFlag;break}}break}wn.elements.push(...Gt.autoDeletedElement),wn.resizeHandleType=null,wn.deletedRoofId=null,wn.autoDeletedRoofs=null,wn.autoDeletedRoofIdSet.clear(),wn.autoDeletedChild=null}),Te.current=Qr.null},redo:()=>{Gt.autoDeletedElement.length>0&&E(Gt.autoDeletedElement[0].id,!1,!1,!0);const wn=new Set(Gt.autoDeletedElement.map(Cn=>Cn.id));switch(A(Cn=>{Cn.elements=Cn.elements.filter(Wn=>!wn.has(Wn.id));for(const Wn of Cn.elements)if(Wn.id===Gt.resizedElementId){const Un=Wn;switch(Un.cx=Gt.newPosition.x,Un.cy=Gt.newPosition.y,Un.cz=Gt.newPosition.z,Un.lx=Gt.newDimension.x,Un.ly=Gt.newDimension.y,Un.lz=Gt.newDimension.z,Gt.flippedWallSide){case Qr.left:Un.relativeAngle=(Gt.newAngle+Math.PI)%fa;for(const rt of Cn.elements)if(rt.type===z.Wall&&rt.id===Gt.oldJoints[0][0]){rt.rightJoints=[];break}break;case Qr.right:Un.relativeAngle=(Gt.newAngle+Math.PI)%fa;for(const rt of Cn.elements)if(rt.type===z.Wall&&rt.id===Gt.oldJoints[1][0]){rt.leftJoints=[];break}break;case Qr.loop:Un.relativeAngle=(Gt.newAngle+Math.PI)%fa,Un.leftJoints=[...Gt.newJoints[1]],Un.rightJoints=[...Gt.newJoints[0]],Un.leftPoint=[...Gt.newPoint[1]],Un.rightPoint=[...Gt.newPoint[0]];for(const rt of Cn.elements)rt.type===z.Wall&&(rt.id===Gt.newJoints[0][0]&&(rt.leftJoints=[Un.id]),rt.id===Gt.newJoints[1][0]&&(rt.rightJoints=[Un.id]));break;case Qr.null:if(Un.relativeAngle=Gt.newAngle,Un.leftJoints=[...Gt.newJoints[0]],Un.rightJoints=[...Gt.newJoints[1]],Un.leftPoint=[...Gt.newPoint[0]],Un.rightPoint=[...Gt.newPoint[1]],Gt.oldJoints[0][0]!==Gt.newJoints[0][0])for(const rt of Cn.elements)rt.type===z.Wall&&(rt.id===Gt.newJoints[0][0]&&(rt.rightJoints=[Un.id]),rt.id===Gt.oldJoints[0][0]&&(rt.rightJoints=[]));if(Gt.oldJoints[1][0]!==Gt.newJoints[1][0])for(const rt of Cn.elements)rt.type===z.Wall&&(rt.id===Gt.newJoints[1][0]&&(rt.leftJoints=[Un.id]),rt.id===Gt.oldJoints[1][0]&&(rt.leftJoints=[]));Cn.updateWallMapOnFoundationFlag=!Cn.updateWallMapOnFoundationFlag;break}break}Cn.resizeHandleType=null}),setTimeout(()=>{A(Cn=>{Cn.deletedRoofId=null,Cn.autoDeletedRoofs=null,Cn.autoDeletedRoofIdSet.clear()})}),Gt.flippedWallSide){case Qr.left:{const Cn=C(Gt.resizedElementId),Wn=C(Gt.newJoints[1][0]);xo(Cn,Wn);break}case Qr.right:{const Cn=C(Gt.resizedElementId),Wn=C(Gt.newJoints[0][0]);lr(Cn,Wn);break}case Qr.loop:Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);ur(Gt.resizedElementId);break}Te.current=Qr.null}};ee(Gt),A(wn=>{wn.actionState.wallHeight=gn.lz,wn.deletedRoofId=null,wn.autoDeletedRoofs=null,wn.autoDeletedRoofIdSet.clear(),wn.autoDeletedChild=[]})},Dn=(gn,tn,Gt)=>{if(gn.roofId)Xe.current=!0,ft.current={wall:gn,newAngle:tn,newJoints:[[...Gt[0]],[...Gt[1]]]};else{const wn={name:"Move Wall",timestamp:Date.now(),id:gn.id,oldPoints:[[...Pt.current[0]],[...Pt.current[1]]],newPoints:[[...gn.leftPoint],[...gn.rightPoint]],oldJoints:[[...bt.current[0]],[...bt.current[1]]],newJoints:[[...Gt[0]],[...Gt[1]]],oldAngle:gt.current,newAngle:tn,flippedWallSide:Te.current,undo(){switch(this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const vt=C(this.newJoints[0][0]);vt&&lr(vt);break}case Qr.right:{const vt=C(this.newJoints[1][0]);vt&&xo(vt);break}}const[Cn,Wn]=this.oldJoints,[Un,rt]=this.newJoints;A(vt=>{for(const Nt of vt.elements)if(Nt.id===this.id){const[Ft,en]=this.oldPoints;Nt.cx=(Ft[0]+en[0])/2,Nt.cy=(Ft[1]+en[1])/2,Nt.lx=Math.hypot(Ft[0]-en[0],Ft[1]-en[1]);const sn=Nt;sn.relativeAngle=this.oldAngle,sn.leftPoint=[...Ft],sn.rightPoint=[...en],sn.leftJoints=[...Cn],sn.rightJoints=[...Wn];break}vt.resizeHandleType=null}),Cn[0]!==Un[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Cn[0]&&(Nt.rightJoints=[this.id]),Nt.id===Un[0]&&(this.flippedWallSide!==Qr.left?Nt.rightJoints=[]:Nt.leftJoints=[]))}),Wn[0]!==rt[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Wn[0]&&(Nt.leftJoints=[this.id]),Nt.id===rt[0]&&(this.flippedWallSide!==Qr.right?Nt.leftJoints=[]:Nt.rightJoints=[]))}),Te.current=Qr.null},redo(){const[Cn,Wn]=this.oldJoints,[Un,rt]=this.newJoints;switch(A(vt=>{for(const Nt of vt.elements)if(Nt.id===this.id&&Nt.type===z.Wall){const[Ft,en]=this.newPoints;Nt.cx=(Ft[0]+en[0])/2,Nt.cy=(Ft[1]+en[1])/2,Nt.lx=Math.hypot(Ft[0]-en[0],Ft[1]-en[1]);const sn=Nt;sn.relativeAngle=this.newAngle,sn.leftPoint=[...Ft],sn.rightPoint=[...en],sn.leftJoints=[...Un],sn.rightJoints=[...rt];break}}),Cn[0]!==Un[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Cn[0]&&(Nt.rightJoints=[]),Nt.id===Un[0]&&(this.flippedWallSide===Qr.right?Nt.leftJoints=[this.id]:Nt.rightJoints=[this.id]))}),Wn[0]!==rt[0]&&A(vt=>{for(const Nt of vt.elements)Nt.type===z.Wall&&(Nt.id===Wn[0]&&(Nt.leftJoints=[]),Nt.id===rt[0]&&(this.flippedWallSide===Qr.right?Nt.rightJoints=[this.id]:Nt.leftJoints=[this.id]))}),this.flippedWallSide){case Qr.loop:{ur(this.id);break}case Qr.left:{const vt=C(this.newJoints[0][0]);vt&&xo(vt);break}case Qr.right:{const vt=C(this.newJoints[1][0]);vt&&lr(vt);break}}A(vt=>{vt.resizeHandleType=null}),Te.current=Qr.null}};ee(wn)}},sr=gn=>{if(gn.button===2){gn.altKey&&L(e,gn,er.Select);return}A(wn=>{wn.contextMenuObjectType=null}),H.getState().objectTypeToAdd!==z.Window&&!$()&&L(e,gn,er.Select);const tn=P();let Gt=!1;if(gn.intersections[0].object.name===z.Polygon&&H.getState().objectTypeToAdd!==z.None&&(Gt=!0),(tn==null?void 0:tn.id)===e||Gt)if(fn(H.getState().objectTypeToAdd)){if(t){ve(!0);const wn=gn.intersections.filter(Wn=>!Wn.eventObject.name.startsWith("Wall Intersection Plane"))[0].point,Cn=j(t,wn);Cn&&Rr(Cn),A(Wn=>{Wn.actionModeLock||(Wn.objectTypeToAdd=z.None)})}}else jn.getState().selectNone(),jn.setState({foundationRef:Ne});else if(tn&&tn.parentId===e&&fn(tn.type))switch(Ue.current=tn,tn.type===z.Wall&&!Se.current&&(Ce.current=[...H.getState().elements]),ve(!0),Qe.current.set(tn.cx,tn.cy,tn.cz),mt.current.set(tn.lx,tn.ly,tn.lz),dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e),tn.type){case z.SolarPanel:case z.ParabolicTrough:case z.FresnelReflector:{gt.current=tn.relativeAzimuth;break}case z.Polygon:{je.current=tn.vertices.map(wn=>({...wn}));break}case z.Wall:{const wn=tn;gt.current=wn.relativeAngle,bt.current=[[...wn.leftJoints],[...wn.rightJoints]],Pt.current=[[...wn.leftPoint],[...wn.rightPoint]],Wo.current=wn.leftJoints[0],To.current=wn.rightJoints[0],Re.current.clear();for(const Cn of H.getState().elements)Cn.type===z.Wall&&Cn.parentId===e&&Re.current.set(Cn.id,Cn);break}}if(Se.current&&we.current&&_e.current){const wn=Ct.intersectObjects([_e.current]);if(wn.length===0)return;let Cn=ye.wallRelativePosition(wn[0].point,t);se[0].position&&(Cn.setX(se[0].position[0]),Cn.setY(se[0].position[1]));const{id:Wn,point:Un,side:rt,jointId:vt}=kn(Cn,1.5);Cn=yo(Cn,Un);let Nt=xt.LowerRight;if(Wn){const Ft=C(Wn);rt===Eg.Right?A(en=>{for(const sn of en.elements)if(sn.type===z.Wall){if(sn.id===we.current){const dn=sn;dn.cx=Cn.x,dn.cy=Cn.y,Ft.rightJoints.length===0&&(dn.leftJoints=[Ft.id])}sn.id===Wn&&Ft.rightJoints.length===0&&(sn.rightJoints=we.current?[we.current]:[])}}):rt===Eg.Left&&!vt&&(A(en=>{for(const sn of en.elements)if(sn.type===z.Wall){if(sn.id===we.current){const dn=sn;dn.cx=Cn.x,dn.cy=Cn.y,Ft.leftJoints.length===0&&(dn.rightJoints=[Ft.id])}sn.id===Wn&&Ft.leftJoints.length===0&&(sn.leftJoints=we.current?[we.current]:[])}}),Nt=xt.LowerLeft)}else S(we.current,Cn.x,Cn.y);Se.current=!1,Me.current=!0,D(we.current,[Cn.x,Cn.y,Cn.z]),A(Ft=>{Ft.resizeHandleType=Nt,Ft.resizeAnchor=ye.wallAbsolutePosition(Cn,t)}),jn.getState().setEnableOrbitController(!1),Ue.current=tn}},Vo=gn=>{if(Cs&&Rs(!1),gn.altKey&&gn.button===2&&F&&F.length>0){A(wn=>{wn.pastePoint.copy(gn.intersections[0].point),wn.clickObjectType=z.Foundation,wn.pasteNormal=Oo});const Gt=W();if(Gt.length>0){const wn={name:"Paste to Point",timestamp:Date.now(),pastedElements:Gt.map(Cn=>({...Cn})),undo:()=>{for(const Cn of wn.pastedElements)E(Cn.id,!1)},redo:()=>{A(Cn=>{Cn.elements.push(...wn.pastedElements),Cn.selectedElement=wn.pastedElements[0]})}};ee(wn)}}if(!Ue.current||Ue.current.type===z.Tree||Ue.current.type===z.Flower||Ue.current.type===z.Human)return;const tn=C(Ue.current.id);if(tn){switch(tn.type){case z.Wall:{const Gt=tn;if(Se.current)A(wn=>{wn.elements.pop(),wn.addedWallId=null,wn.actionModeLock&&(wn.objectTypeToAdd=z.Wall,xb.selectNone(wn))}),we.current&&Re.current.delete(we.current),we.current=null,Se.current=!1,Me.current=!1;else if(Me.current&&we.current&&_e.current)jn.getState().setEnableOrbitController(!0),A(wn=>{wn.actionModeLock&&(wn.objectTypeToAdd=z.Wall,xb.selectNone(wn)),wn.addedWallId=null,Gt.lx===0&&Ce.current?(wn.elements=[...Ce.current],we.current&&Re.current.delete(we.current)):(Eo(Gt),Re.current.set(Gt.id,Gt))}),we.current=null,Me.current=!1;else if(H.getState().resizeHandleType)Gt.lx>.45?(Re.current.set(Gt.id,Gt),nt.current.set(Gt.cx,Gt.cy,Gt.cz),tt.current.set(Gt.lx,Gt.ly,Gt.lz),Ve.current=Gt.relativeAngle,St.current=[[...Gt.leftJoints],[...Gt.rightJoints]],Yt.current=[[...Gt.leftPoint],[...Gt.rightPoint]],An(Gt)):A(wn=>{Ce.current&&(wn.elements=[...Ce.current],Ce.current=null)});else if(H.getState().moveHandleType){let wn=Gt.relativeAngle,Cn=[],Wn=[];if(Wo.current)if(Gt.leftJoints.length>0&&(Wo.current!==Gt.leftJoints[0]||Wo.current===Gt.leftJoints[0]&&Go.current)&&M(Gt.leftJoints[0],[]),Go.current)R(Wo.current,[Gt.id]),Wn=[Wo.current];else if(Cn=[Wo.current],ho.current){R(Wo.current,[Gt.id]);const Un=C(Wo.current);Un&&xo(Un)}else M(Wo.current,[Gt.id]);else Gt.leftJoints.length>0&&Gt.leftJoints[0]!==To.current&&(Cn=[],M(Gt.leftJoints[0],[]));if(To.current)if(Gt.rightJoints.length>0&&(To.current!==Gt.rightJoints[0]||To.current===Gt.rightJoints[0]&&Go.current)&&Gt.rightJoints[0]!==Wo.current&&R(Gt.rightJoints[0],[]),Go.current)M(To.current,[Gt.id]),Cn=[To.current];else if(Wn=[To.current],No.current){M(To.current,[Gt.id]);const Un=C(To.current);Un&&lr(Un)}else R(To.current,[Gt.id]);else Gt.rightJoints.length>0&&Gt.rightJoints[0]!==Wo.current&&(Wn=[],R(Gt.rightJoints[0],[]));A(Un=>{for(const rt of Un.elements)if(rt.id===Gt.id&&rt.type===z.Wall){const vt=rt;if(Go.current&&(wn=(vt.relativeAngle+Math.PI)%fa,vt.relativeAngle=wn,[vt.leftPoint,vt.rightPoint]=[[...vt.rightPoint],[...vt.leftPoint]]),Cn.length===0&&Wn.length===0)vt.roofId=null;else if(Cn.length>0){const Nt=Un.elements.find(Ft=>Ft.id===Cn[0]);Nt&&(vt.roofId=Nt.roofId)}else if(Wn.length>0){const Nt=Un.elements.find(Ft=>Ft.id===Wn[0]);Nt&&(vt.roofId=Nt.roofId)}vt.leftJoints=[...Cn],vt.rightJoints=[...Wn];break}Un.updateWallMapOnFoundationFlag=!Un.updateWallMapOnFoundationFlag}),wo(Gt.id),Dn(Gt,wn,[[...Cn],[...Wn]]),Go.current=!1,ho.current=!1,No.current=!1,Wo.current=null,To.current=null}Te.current=Qr.null,A(wn=>{wn.updateWallMapOnFoundationFlag=!wn.updateWallMapOnFoundationFlag}),Ae({show:!1,direction:null,position:null}),ge([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]);break}case z.Polygon:{if(H.getState().moveHandleType||H.getState().resizeHandleType){et.current=tn.vertices.map(wn=>({...wn}));const Gt={name:H.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:je.current,newValue:et.current,changedElementId:tn.id,changedElementType:tn.type,undo:()=>{U(Gt.changedElementId,Gt.oldValue)},redo:()=>{U(Gt.changedElementId,Gt.newValue)}};ee(Gt)}break}default:if(H.getState().resizeHandleType){if(nt.current.set(tn.cx,tn.cy,tn.cz),tt.current.set(tn.lx,tn.ly,tn.lz),nt.current.distanceToSquared(Qe.current)>Ht||tt.current.distanceToSquared(mt.current)>Ht){const Gt={name:"Resize",timestamp:Date.now(),resizedElementId:Ue.current.id,resizedElementType:Ue.current.type,oldCx:Qe.current.x,oldCy:Qe.current.y,oldCz:Qe.current.z,newCx:nt.current.x,newCy:nt.current.y,newCz:nt.current.z,oldLx:mt.current.x,oldLy:mt.current.y,oldLz:mt.current.z,newLx:tt.current.x,newLy:tt.current.y,newLz:tt.current.z,undo:()=>{S(Gt.resizedElementId,Gt.oldCx,Gt.oldCy,Gt.oldCz),v(Gt.resizedElementId,Gt.oldLx,Gt.oldLy,Gt.oldLz)},redo:()=>{S(Gt.resizedElementId,Gt.newCx,Gt.newCy,Gt.newCz),v(Gt.resizedElementId,Gt.newLx,Gt.newLy,Gt.newLz)}};ee(Gt)}}else if(H.getState().rotateHandleType){if(ye.isSolarCollector(Ue.current)){const Gt=Ue.current;if(Math.abs(Ve.current-gt.current)>Ht)if(Uu(Gt,Ve.current)){A(Cn=>{Cn.selectedElementAngle=Ve.current});const wn={name:"Rotate",timestamp:Date.now(),oldValue:gt.current,newValue:Ve.current,changedElementId:Gt.id,changedElementType:Gt.type,undo:()=>{k(wn.changedElementId,wn.oldValue)},redo:()=>{k(wn.changedElementId,wn.newValue)}};ee(wn)}else k(Gt.id,gt.current)}}else if(nt.current.set(tn.cx,tn.cy,tn.cz),nt.current.distanceToSquared(Qe.current)>Ht){let Gt=!0;ye.isSolarCollector(tn)&&(Gt=xi(tn,tn.cx,tn.cy)),Gt?O0.addUndoableMove():A(wn=>{const Cn=wn.elements.find(vt=>vt.id===tn.id);if(!Cn||!wn.selectedElement)return;const Wn=wn.selectedElement;Cn.cx=Wn.cx,Cn.cy=Wn.cy,Cn.cz=Wn.cz,Cn.rotation=[...Wn.rotation],Cn.normal=[...Wn.normal];const Un=dt.getState().oldParentId,rt=dt.getState().oldFoundationId;Un&&(Cn.parentId=Un),rt&&(Cn.foundationId=rt)})}}ve(!1),Ue.current=null,A(Gt=>{Gt.resizeHandleType=null,Gt.moveHandleType=null})}},Wo=g.useRef(null),To=g.useRef(null),Go=g.useRef(!1),No=g.useRef(!1),ho=g.useRef(!1),vo=(gn,tn,Gt)=>{let wn=Math.atan2(tn.y-gn.y,tn.x-gn.x)-(Gt===xt.LowerLeft?Math.PI:0);return wn=wn>=0?wn:(fa+wn)%fa,wn},bo=(gn,tn)=>{let wn=null,Cn=null,Wn=1/0,Un=1/0;for(const[rt,vt]of Re.current)if(Ue.current!==null&&vt.id!==Ue.current.id&&vt.id!==tn){const Nt=Math.abs(gn.x-vt.leftPoint[0]),Ft=Math.abs(gn.x-vt.rightPoint[0]),en=Math.abs(gn.y-vt.leftPoint[1]),sn=Math.abs(gn.y-vt.rightPoint[1]);Nt<1&&Nt{const Wn=vo(gn,tn,Gt);let Un=null,rt=null;return Wn<.05||Wn>fa-.05||Math.abs(Wn-Math.PI)<.05||Math.abs(tn.y-gn.y)<1?rt=gn.y:(Math.abs(Wn-Math.PI/2)<.05||Math.abs(Wn-3*Math.PI/2)<.05||Math.abs(tn.x-gn.x)<1)&&(Un=gn.x),[Un,rt]},Pr=(gn,tn,Gt,wn)=>{const[Cn,Wn]=bo(tn),[Un,rt]=Bo(gn,tn,Gt),vt=so(tn.x,Cn,Un),Nt=so(tn.y,Wn,rt);return new ue(vt,Nt,tn.z)},so=(gn,tn,Gt)=>tn!==null&&Gt!==null?Math.abs(tn-gn){let[wn,Cn]=[1/0,1/0],Wn=null,Un=null;for(const[rt,vt]of Re.current)if(Ue.current!==null&&vt.id!==Ue.current.id&&vt.id!==Gt){const Nt=Math.abs(gn.x-vt.leftPoint[0]),Ft=Math.abs(gn.x-vt.rightPoint[0]);Nt<.01&&Nt{Wn!==null&&Un!==null?(rt[tn].direction="xy",rt[tn].position=[Wn,Un]):Wn!==null?(rt[tn].direction="y",rt[tn].position=[Wn,gn.y]):Un!==null?(rt[tn].direction="x",rt[tn].position=[gn.x,Un]):(rt[tn].direction=null,rt[tn].position=null)})),[Wn!==null,Un!==null]},Ci=(gn,tn)=>Math.abs(tn)<.01||Math.abs(tn-Math.PI)<.01?(Ae(Gt=>({...Gt,direction:"x",position:[gn.x,gn.y]})),[!0,!1]):Math.abs(tn-Math.PI/2)<.01||Math.abs(tn-3*Math.PI/2)<.01?(Ae(Gt=>({...Gt,direction:"y",position:[gn.x,gn.y]})),[!1,!0]):(Ae(Gt=>({...Gt,direction:null,position:null})),[!1,!1]),ea=(gn,tn)=>{ge(Dv(Gt=>{Gt[0].show=gn})),Ae(Gt=>({...Gt,show:tn}))},rs=(gn,tn)=>{const[Gt,wn]=zo(gn),[Cn,Wn]=Ci(gn,tn);Gt&&wn?ea(!0,!1):Gt?ea(!0,!Wn&&Cn):wn?ea(!0,!Cn&&Wn):ea(!1,Cn||Wn)},Da=gn=>{var Wn,Un;if(!t||(Vs(gn),Ue.current&&ye.isSolarCollector(Ue.current)))return;const tn=H.getState().objectTypeToAdd;if(!Ue.current&&!we.current&&tn!==z.Wall||((Wn=Ue.current)==null?void 0:Wn.parentId)!==e&&tn===z.None)return;const Gt=H.getState().moveHandleType,wn=H.getState().resizeHandleType,Cn=H.getState().resizeAnchor;if(on(gn),_e.current){const rt=Ct.intersectObjects([_e.current]);if(rt.length===0)return;let vt=rt[0].point;if(Ue.current&&Ue.current.type&&!Ue.current.locked&&rt.length>0)switch(ve(!0),Ue.current.type){case z.Sensor:case z.Light:case z.WindTurbine:{vt=ye.relativeCoordinates(vt.x,vt.y,vt.z,t),S(Ue.current.id,vt.x,vt.y);break}case z.Polygon:{const Nt=Ue.current;if(Gt===Ho.Default){vt=ye.relativeCoordinates(vt.x,vt.y,vt.z,t);const Ft=ye.calculatePolygonCentroid(Nt.vertices),en=vt.x-Ft.x,sn=vt.y-Ft.y,dn=Nt.vertices.map(En=>({...En}));dn.forEach(En=>{En.x+=en,En.y+=sn}),U(Nt.id,dn)}else wn===xt.Default&&(vt.x-=t.cx,vt.y-=t.cy,vt.applyEuler(new cn().fromArray(t.rotation.map(Ft=>-Ft))),vt=H.getState().enableFineGrid?ye.snapToFineGrid(vt):ye.snapToNormalGrid(vt),vt.x/=t.lx,vt.y/=t.ly,N(Nt.id,Nt.selectedIndex,vt.x,vt.y));break}case z.Wall:{if(((Un=H.getState().selectedElement)==null?void 0:Un.type)!==z.Wall)break;if(wn&&(wn===xt.LowerLeft||wn===xt.LowerRight)){const Nt=ye.wallRelativePosition(Cn,t);vt=ye.wallRelativePosition(vt,t);let Ft=null;H.getState().enableFineGrid?vt=ye.snapToFineGrid(vt):(Ft=kn(vt,1.5),Ft!=null&&Ft.point?vt=Ft.point:(vt=ye.snapToNormalGrid(vt),vt=Pr(Nt,vt,wn),Ft=kn(vt,1.5),Ft!=null&&Ft.point&&(vt=Ft.point)));const en=vo(Nt,vt,wn);rs(vt,en);const sn=vt.distanceTo(Nt),dn=new ue().addVectors(vt,Nt).divideScalar(2),En=wn===xt.LowerLeft?vt:Nt,xn=wn===xt.LowerLeft?Nt:vt;A(_n=>{for(const Vn of _n.elements)if(Vn.id===Ue.current.id&&Vn.type===z.Wall){const Gn=Vn;Gn.cx=dn.x,Gn.cy=dn.y,Gn.lx=sn,Gn.relativeAngle=en,Gn.leftPoint=[En.x,En.y,0],Gn.rightPoint=[xn.x,xn.y,0];break}});const Tn=C(Ue.current.id);if(Tn){if(Ft&&Ft.point){if(Ft.id&&Ft.side&&!Ft.jointId){const _n=C(Ft.id);if(_n){if(wn===xt.LowerLeft&&_n.leftJoints.length===0&&Ft.side===Eg.Left){if(Tn.leftJoints.length>0&&Tn.leftJoints[0]!==Ft.id){const Vn=Tn.leftJoints[0];A(Gn=>{for(const go of Gn.elements)if(go.id===Vn&&go.type===z.Wall){go.rightJoints=[];break}})}xo(Tn,_n)}else if(wn===xt.LowerRight&&_n.rightJoints.length===0&&Ft.side===Eg.Right){if(Tn.rightJoints.length>0&&Tn.rightJoints[0]!==Ft.id){const Vn=Tn.rightJoints[0];A(Gn=>{for(const go of Gn.elements)if(go.id===Vn&&go.type===z.Wall){go.leftJoints=[];break}})}lr(Tn,_n)}else wn===xt.LowerRight&&Ft.side===Eg.Left&&_n.leftJoints.length===0&&_n.rightJoints[0]!==Tn.id?A(Vn=>{let Gn=null;Tn.rightJoints.length>0&&Tn.rightJoints[0]!==(Ft==null?void 0:Ft.id)&&(Gn=Tn.rightJoints[0]);for(const go of Vn.elements)go.type===z.Wall&&(go.id===Tn.id&&(go.rightJoints=[_n.id]),go.id===_n.id&&(go.leftJoints=[Tn.id]),go.id===Gn&&(go.leftJoints=[]))}):wn===xt.LowerLeft&&Ft.side===Eg.Right&&_n.rightJoints.length===0&&_n.leftJoints[0]!==Tn.id&&A(Vn=>{let Gn=null;Tn.leftJoints.length>0&&Tn.leftJoints[0]!==(Ft==null?void 0:Ft.id)&&(Gn=Tn.leftJoints[0]);for(const go of Vn.elements)go.type===z.Wall&&(go.id===Tn.id&&(go.leftJoints=[_n.id]),go.id===_n.id&&(go.rightJoints=[Tn.id]),go.id===Gn&&(go.rightJoints=[]))});wo(Tn.id)}}}else if(wn===xt.LowerRight&&Tn.rightJoints.length>0){const _n=Tn.rightJoints[0];A(Vn=>{for(const Gn of Vn.elements)Gn.type===z.Wall&&(Gn.id===Tn.id&&(Gn.rightJoints=[]),Gn.id===_n&&(Gn.leftJoints=[]));Vn.updateWallMapOnFoundationFlag=!Vn.updateWallMapOnFoundationFlag})}else if(wn===xt.LowerLeft&&Tn.leftJoints.length>0){const _n=Tn.leftJoints[0];A(Vn=>{for(const Gn of Vn.elements)Gn.type===z.Wall&&(Gn.id===Tn.id&&(Gn.leftJoints=[]),Gn.id===_n&&(Gn.rightJoints=[]));Vn.updateWallMapOnFoundationFlag=!Vn.updateWallMapOnFoundationFlag})}}}else if(Gt){const Nt=C(Ue.current.id);if(Nt){vt=ye.wallRelativePosition(vt,t);const Ft=new ue,en=new cn(0,0,Nt.relativeAngle);Gt===Ho.Lower?Ft.setY(ot):Gt===Ho.Upper&&Ft.setY(-ot-Nt.ly),vt.add(Ft.applyEuler(en));const sn=new ue().addVectors(vt,new ue(-Nt.lx/2,0,0).applyEuler(en)),dn=new ue().addVectors(vt,new ue(Nt.lx/2,0,0).applyEuler(en));let En=null,xn=null,Tn=!1;Go.current=!1,ho.current=!1,No.current=!1,Wo.current=null,To.current=null;const _n=(Vn,Gn)=>{const go=Gn==="left"?sn:dn,qo=new ue().subVectors(Vn,go);vt.add(qo),sn.add(qo),dn.add(qo)};if(!H.getState().enableFineGrid){let Vn=kn(sn,1);Vn.point?(_n(Vn.point,"left"),Vn.id&&(!Vn.jointId||Vn.jointId===Nt.id)&&(Wo.current=Vn.id,En=Vn.side===Eg.Left)):Wo.current=null;let Gn=kn(dn,1);if(Gn.point?(Vn.id||_n(Gn.point,"right"),Gn.id&&(!Gn.jointId||Gn.jointId===Nt.id)&&(Vn.id!==Gn.id||Vn.side!==Gn.side)&&(To.current=Gn.id,xn=Gn.side===Eg.Right)):To.current=null,!Vn.point&&!Gn.point){const[na,k0]=bo(sn),[Gh,cc]=bo(dn);if(na!==null||Gh!==null){const wu=(na??1/0)-sn.x,ps=(Gh??1/0)-dn.x,ud=Math.min(wu,ps);sn.setX(sn.x+ud),dn.setX(dn.x+ud),vt.setX(vt.x+ud),Vn=kn(sn,1),Vn.point?(_n(Vn.point,"left"),Vn.id&&(!Vn.jointId||Vn.jointId===Nt.id)&&(Wo.current=Vn.id,En=Vn.side===Eg.Left)):Wo.current=null}if(k0!==null||cc!==null){const wu=(k0??1/0)-sn.y,ps=(cc??1/0)-dn.y,ud=Math.min(wu,ps);sn.setY(sn.y+ud),dn.setY(dn.y+ud),vt.setY(vt.y+ud),Gn=kn(dn,1),Gn.point?(Vn.id||_n(Gn.point,"right"),Gn.id&&(!Gn.jointId||Gn.jointId===Nt.id)&&(Vn.id!==Gn.id||Vn.side!==Gn.side)&&(To.current=Gn.id,xn=Gn.side===Eg.Right)):To.current=null}}const[go,qo]=zo(sn,0),[Xr,qr]=zo(dn,1);ge(Dv(na=>{na[0].show=go||qo,na[1].show=Xr||qr})),En&&xn===null||xn&&En===null||En&&xn?Go.current=!0:(En&&xn===!1||xn&&En===!1)&&(ho.current=En,No.current=xn),Vn.point&&Gn.point&&(Vn.id!==Gn.id||Vn.side!==Gn.side)&&(sn.copy(Vn.point),dn.copy(Gn.point),Tn=!0)}A(Vn=>{var Gn;for(const go of Vn.elements)if(go.id===((Gn=Ue.current)==null?void 0:Gn.id)&&go.type===z.Wall){const qo=go;if(Tn){qo.cx=(sn.x+dn.x)/2,qo.cy=(sn.y+dn.y)/2,qo.lx=sn.distanceTo(dn);let Xr=Math.atan2(dn.y-sn.y,dn.x-sn.x);Xr=Xr>=0?Xr:(fa+Xr)%fa,qo.relativeAngle=Xr}else qo.cx=vt.x,qo.cy=vt.y;qo.leftPoint=sn.toArray(),qo.rightPoint=dn.toArray();break}})}}break}}if(tn===z.Wall&&!Se.current){Ce.current=[...H.getState().elements];const Nt=j(t,vt);Ue.current=Nt,we.current=Nt.id,Se.current=!0,ve(!0),jn.getState().setEnableOrbitController(!1),A(Ft=>{Ft.addedWallId=Nt.id,Ft.objectTypeToAdd=z.None})}if(we.current&&Se.current){vt=ye.wallRelativePosition(rt[0].point,t);let Nt=null;if(H.getState().enableFineGrid)vt=ye.snapToFineGrid(vt);else if(Nt=kn(vt,1.5),Nt!=null&&Nt.point)vt=Nt.point;else{vt=ye.snapToNormalGrid(vt);const[sn,dn]=bo(vt);sn!==null&&vt.setX(sn),dn!==null&&vt.setY(dn),Nt=kn(vt,1.5),Nt!=null&&Nt.point&&(vt=Nt.point)}const[Ft,en]=zo(vt);ge(Dv(sn=>{sn[0].show=Ft||en})),S(we.current,vt.x,vt.y)}}},or=gn=>{gn.intersections.length>0&&gn.intersections[0].object===_e.current&&ce(!0)},cr=gn=>{A(tn=>{xb.selectMe(tn,e,gn,er.ContextMenu),tn.pastePoint.copy(gn.intersections[0].point),tn.clickObjectType=z.Foundation,tn.pasteNormal=Oo,gn.altKey?tn.contextMenuObjectType=null:gn.intersections.length>0&&gn.intersections[0].object===_e.current&&(tn.contextMenuObjectType=z.Foundation),tn.pasteNormal=Oo})},ii=()=>{Cs&&(Rs(!1),Ue.current=null),ce(!1),ve(!1),Ue.current&&Se.current&&(E(Ue.current.id,!1),Se.current=!1,A(gn=>{gn.addedWallId=null,gn.objectTypeToAdd=z.Wall}),Ue.current=null),Ae({show:!1,direction:null,position:null}),ge([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}])},Ga=gn=>{Ue.current&&ye.isPlantOrHuman(Ue.current)&&gn.intersections[0].object===_e.current&&ve(!0)},xi=(gn,tn,Gt)=>{const wn=JSON.parse(JSON.stringify(gn));return wn.cx=tn,wn.cy=Gt,ae(wn)?(co(B.t("message.MoveCancelledBecauseOfOverlap",zt)),!1):ye.isSolarCollectorWithinHorizontalSurface(wn,t)?!0:(co(B.t("message.MoveOutsideBoundaryCancelled",zt)),!1)},Uu=(gn,tn)=>{const Gt=JSON.parse(JSON.stringify(gn));return Gt.relativeAzimuth=tn,ae(Gt)?(co(B.t("message.RotationCancelledBecauseOfOverlap",zt)),!1):ye.isSolarCollectorWithinHorizontalSurface(Gt,t)?!0:(co(B.t("message.RotationOutsideBoundaryCancelled",zt)),!1)},_s=(gn,tn,Gt,wn,Cn)=>{if(gn.type===z.SolarPanel&&gn.tiltAngle!==0&&.5*Cn*Math.abs(Math.sin(gn.tiltAngle))>gn.poleHeight)return!1;const Wn=JSON.parse(JSON.stringify(gn));return Wn.cx=tn,Wn.cy=Gt,Wn.lx=wn,Wn.ly=Cn,ye.isSolarCollectorWithinHorizontalSurface(Wn,t)},sc=gn=>{if(qe.current&&t&&Ue.current&&t){if(!ye.isSolarCollector(Ue.current))return;const tn=Ue.current;on(gn);const Gt=Ct.intersectObjects([qe.current]);if(Gt.length>0){let wn=Gt[0].point;const Cn=H.getState().moveHandleType,Wn=H.getState().rotateHandleType,Un=H.getState().resizeHandleType;if(Cn&&t)wn=ye.relativeCoordinates(wn.x,wn.y,wn.z,t),S(tn.id,wn.x,wn.y),tn.parentId!==e&&H.getState().set(rt=>{const vt=rt.elements.find(Nt=>Nt.id===tn.id&&Nt.type===z.SolarPanel);vt&&(vt.parentId!==e||vt.foundationId!==e)&&(vt.parentId=e,vt.foundationId=e,vt.parentType=z.Foundation,rt.selectedElement&&(rt.selectedElement.parentId=e,vt.color=rt.selectedElement.color))});else if(Wn){if(Wn===ai.Upper||Wn===ai.Lower){const rt=t.rotation[2],vt=new _t(t.cx,t.cy),Nt=new _t(t.lx*tn.cx,t.ly*tn.cy).rotateAround(ui,rt),Ft=new _t().addVectors(Nt,vt),en=Math.atan2(-wn.x+Ft.x,wn.y-Ft.y)-rt+(Wn===ai.Lower?0:Math.PI),sn=Math.abs(en)>Math.PI?-Math.sign(en)*fa:0,dn=en+sn;k(tn.id,dn),Ve.current=dn}}else if(Un){const rt=H.getState().resizeAnchor,vt=new _t(wn.x,wn.y),Nt=new _t(rt.x,rt.y),Ft=vt.distanceTo(Nt),en=tn.relativeAzimuth+l[2],sn=new _t().subVectors(vt,Nt),dn=new _t(n,o);if(tn.type===z.SolarPanel){const En=tn,xn=Y(En.pvModelName);switch(Un){case xt.Lower:case xt.Upper:{const Tn=Un===xt.Lower?1:-1,_n=sn.angle()-en+Tn*$t;let Vn=Ft*Math.cos(_n);En.orientation===br.portrait?Vn=Math.max(1,Math.ceil((Vn-xn.length/2)/xn.length))*xn.length:Vn=Math.max(1,Math.ceil((Vn-xn.width/2)/xn.width))*xn.width;const Gn=rt.x+Tn*(Vn*Math.sin(en))/2,go=rt.y-Tn*(Vn*Math.cos(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,tn.lx,Vn)&&(T(tn.id,Vn),S(tn.id,qr,na))}break;case xt.Left:case xt.Right:{const Tn=Un===xt.Left?-1:1,_n=sn.angle()-en+(Un===xt.Left?Math.PI:0);let Vn=Ft*Math.cos(_n);En.orientation===br.portrait?Vn=Math.max(1,Math.ceil((Vn-xn.width/2)/xn.width))*xn.width:Vn=Math.max(1,Math.ceil((Vn-xn.length/2)/xn.length))*xn.length;const Gn=rt.x+Tn*(Vn*Math.cos(en))/2,go=rt.y+Tn*(Vn*Math.sin(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,Vn,tn.ly)&&(b(tn.id,Vn),S(tn.id,qr,na))}break}}else if(tn.type===z.ParabolicTrough){const En=tn;switch(Un){case xt.Lower:case xt.Upper:{const xn=Un===xt.Lower?1:-1,Tn=sn.angle()-en+xn*$t;let _n=Ft*Math.cos(Tn);_n=Math.max(1,Math.ceil((_n-En.moduleLength/2)/En.moduleLength))*En.moduleLength;const Gn=rt.x+xn*(_n*Math.sin(en))/2,go=rt.y-xn*(_n*Math.cos(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,tn.lx,_n)&&(T(tn.id,_n),S(tn.id,qr,na))}break;case xt.Left:case xt.Right:{const xn=Un===xt.Left?-1:1,Tn=sn.angle()-en+(Un===xt.Left?Math.PI:0),_n=Ft*Math.cos(Tn),Vn=rt.x+xn*(_n*Math.cos(en))/2,Gn=rt.y+xn*(_n*Math.sin(en))/2,go=new _t(Vn,Gn),qo=new _t().subVectors(go,dn).rotateAround(ui,-l[2]),Xr=qo.x/r,qr=qo.y/i;_s(tn,Xr,qr,_n,tn.ly)&&(b(tn.id,_n),S(tn.id,Xr,qr),A(na=>{na.actionState.parabolicTroughWidth=_n}))}break}}else if(tn.type===z.FresnelReflector){const En=tn;switch(Un){case xt.Lower:case xt.Upper:{const xn=Un===xt.Lower?1:-1,Tn=sn.angle()-en+xn*$t;let _n=Ft*Math.cos(Tn);_n=Math.max(1,Math.ceil((_n-En.moduleLength/2)/En.moduleLength))*En.moduleLength;const Gn=rt.x+xn*(_n*Math.sin(en))/2,go=rt.y-xn*(_n*Math.cos(en))/2,qo=new _t(Gn,go),Xr=new _t().subVectors(qo,dn).rotateAround(ui,-l[2]),qr=Xr.x/r,na=Xr.y/i;_s(tn,qr,na,tn.lx,_n)&&(T(tn.id,_n),S(tn.id,qr,na))}break;case xt.Left:case xt.Right:{const xn=Un===xt.Left?-1:1,Tn=sn.angle()-en+(Un===xt.Left?Math.PI:0),_n=Ft*Math.cos(Tn),Vn=rt.x+xn*(_n*Math.cos(en))/2,Gn=rt.y+xn*(_n*Math.sin(en))/2,go=new _t(Vn,Gn),qo=new _t().subVectors(go,dn).rotateAround(ui,-l[2]),Xr=qo.x/r,qr=qo.y/i;_s(tn,Xr,qr,_n,tn.ly)&&(b(tn.id,_n),S(tn.id,Xr,qr),A(na=>{na.actionState.fresnelReflectorWidth=_n}))}break}}else if(tn.type===z.ParabolicDish){const En=tn;switch(Un){case xt.Left:case xt.Right:case xt.Lower:case xt.Upper:{const xn=Math.min(10,Ft);_s(tn,En.cx,En.cy,tn.lx,xn)&&(b(tn.id,xn),T(tn.id,xn),A(Tn=>{Tn.actionState.parabolicDishRimDiameter=xn}));break}}}}}}},{transparent:ta,opacity:Ea}=pI();g.useEffect(()=>{_e.current&&(_e.current.material[4].needsUpdate=!0)},[ta]);const[Cs,El]=g.useState(!1),Vs=gn=>{const tn=O0.getIntersectionObjects(gn);if(tn.length==0||tn[0].eventObject.userData.id!==e){Cs&&(Rs(!1),Ue.current=null,ve(!1));return}const Gt=H.getState().selectedElement;!Cs&&Gt&&!Gt.locked&&Gt.type===z.SolarPanel&&H.getState().moveHandleType&&(Rs(!0,Gt.poleHeight),Ue.current=Gt,ve(!0))},Rs=(gn,tn)=>{gn&&tn!==void 0?(El(!0),Zt.setZ(tn)):(El(!1),Zt.setZ(0))},qp=()=>Cs?!0:Ue.current&&ye.isSolarCollector(Ue.current)&&!Ue.current.locked;return g.useEffect(()=>{const gn=()=>{Ue.current&&Se.current&&E(Ue.current.id,!1)};return window.addEventListener("beforeunload",gn),()=>{window.removeEventListener("beforeunload",gn)}},[]),h.jsx(h.Fragment,{children:h.jsxs("group",{ref:Ne,name:`${Mp} ${e}`,position:[n,o,Et],rotation:[0,0,l[2]],userData:{id:e,fId:e},children:[h.jsx(V3e,{parentId:e,foundationId:e,wrapperType:z.Foundation,plx:r,ply:i,plz:a}),h.jsx(Rfn,{foundationId:e,wrapperType:z.Foundation}),h.jsx(Lfn,{foundationId:e,hz:Et}),h.jsxs(di,{castShadow:G,receiveShadow:G,uuid:e,userData:{simulation:!0,stand:!0,id:e,aabb:!0},ref:_e,name:VL,args:[r,i,a],onContextMenu:cr,onPointerOver:or,onPointerDown:sr,onPointerUp:Vo,onPointerMove:A3.throttle(Da,hL,{trailing:!1}),onPointerOut:ii,onPointerEnter:Ga,children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:s}),h.jsx("meshStandardMaterial",{attach:"material-1",color:s}),h.jsx("meshStandardMaterial",{attach:"material-2",color:s}),h.jsx("meshStandardMaterial",{attach:"material-3",color:s}),ne&&Pe?h.jsx("meshBasicMaterial",{attach:"material-4",color:"white",map:Pe,transparent:ta,opacity:Ea}):h.jsx("meshStandardMaterial",{attach:"material-4",color:p===Xi.NoTexture?s:"white",map:fo,transparent:ta,opacity:Ea}),h.jsx("meshStandardMaterial",{attach:"material-5",color:s})]}),qp()&&h.jsx(yi,{ref:qe,name:"Foundation Intersection Plane",position:Zt,args:[r,i],visible:!1,onPointerMove:A3.throttle(sc,hL)}),Ie&&h.jsxs(h.Fragment,{children:[H.getState().rotateHandleType&&Ue.current&&ye.isSolarCollector(Ue.current)&&h.jsx(j3e,{element:Ue.current,height:Ue.current.poleHeight+Et}),(H.getState().moveHandleType||H.getState().resizeHandleType||we.current)&&h.jsx(C5e,{hx:yt,hy:at,hz:Et})]}),y&&h.jsx(B3e,{element:t,verticalLift:it}),(!y||Q)&&h.jsx(o4,{hx:yt,hy:at,hz:Et,lineColor:Q&&x?"white":c,lineWidth:Q&&x?u*3:u}),y&&d&&h.jsx(o4,{hx:yt,hy:at,hz:Et,lineColor:i0,lineWidth:u*5}),ze.show&&h.jsx("group",{position:[0,0,Et+.01],children:h.jsx(lMe,{hx:yt,hy:at,position:ze.position,direction:ze.direction,color:"black"})}),h.jsx("group",{position:[0,0,Et+.01],children:se.map((gn,tn)=>gn.show?h.jsx(lMe,{hx:yt,hy:at,position:gn.position,direction:gn.direction,color:"yellow"},tn):null)}),y&&!d&&h.jsxs(h.Fragment,{children:[h.jsx(di,{ref:Fe,position:[Lt.x,Lt.y,0],args:[Be,Be,a*1.2],name:xt.LowerLeft,onPointerDown:gn=>{L(e,gn,er.Resize),Fe.current&&A(tn=>{const Gt=Fe.current.localToWorld(new ue(r,i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.LowerLeft)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.LowerLeft||H.getState().resizeHandleType===xt.LowerLeft?Aa:ll})}),h.jsx(di,{ref:He,position:[Je.x,Je.y,0],args:[Be,Be,a*1.2],name:xt.UpperLeft,onPointerDown:gn=>{L(e,gn,er.Resize),He.current&&A(tn=>{const Gt=He.current.localToWorld(new ue(r,-i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.UpperLeft)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.UpperLeft||H.getState().resizeHandleType===xt.UpperLeft?Aa:ll})}),h.jsx(di,{ref:Le,position:[st.x,st.y,0],args:[Be,Be,a*1.2],name:xt.LowerRight,onPointerDown:gn=>{L(e,gn,er.Resize),Le.current&&A(tn=>{const Gt=Le.current.localToWorld(new ue(-r,i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.LowerRight)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.LowerRight||H.getState().resizeHandleType===xt.LowerRight?Aa:ll})}),h.jsx(di,{ref:Ye,position:[It.x,It.y,0],args:[Be,Be,a*1.2],name:xt.UpperRight,onPointerDown:gn=>{L(e,gn,er.Resize),Ye.current&&A(tn=>{const Gt=Ye.current.localToWorld(new ue(-r,-i,0));tn.resizeAnchor.copy(Gt)})},onPointerOver:gn=>{to(gn,xt.UpperRight)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===xt.UpperRight||H.getState().resizeHandleType===xt.UpperRight?Aa:ll})}),!oe&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:lt,args:[it,6,6,0,Math.PI],position:[0,-at-it,0],name:Ho.Lower,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Lower,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Lower)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Lower||H.getState().moveHandleType===Ho.Lower?Aa:gL})}),h.jsx(Ys,{ref:Oe,args:[it,6,6,0,Math.PI],position:[0,at+it,0],name:Ho.Upper,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Upper,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Upper)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Upper||H.getState().moveHandleType===Ho.Upper?Aa:gL})}),h.jsx(Ys,{ref:ut,args:[it,6,6,0,Math.PI],position:[-yt-it,0,0],name:Ho.Left,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Left,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Left)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Left||H.getState().moveHandleType===Ho.Left?Aa:q8})}),h.jsx(Ys,{ref:ht,args:[it,6,6,0,Math.PI],position:[yt+it,0,0],name:Ho.Right,onPointerDown:()=>{A(gn=>{gn.moveHandleType=Ho.Right,gn.selectedElement=gn.elements.find(tn=>tn.id===e)??null;for(const tn of gn.elements)gn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&gn.selectedElementIdSet.delete(tn.id)}),jn.getState().setEnableOrbitController(!1)},onPointerOver:gn=>{to(gn,Ho.Right)},onPointerOut:Dt,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Ho.Right||H.getState().moveHandleType===Ho.Right?Aa:q8})}),h.jsx(MH,{id:e,position:[0,-ct,0],color:Z===ai.Lower||H.getState().rotateHandleType===ai.Lower?Aa:ll,ratio:pt,handleType:ai.Lower,hoverHandle:to,noHoverHandle:Dt}),h.jsx(MH,{id:e,position:[0,ct,0],color:Z===ai.Upper||H.getState().rotateHandleType===ai.Upper?Aa:ll,ratio:pt,handleType:ai.Upper,hoverHandle:to,noHoverHandle:Dt})]})]}),!oe&&h.jsxs(h.Fragment,{children:[(me||f)&&!y&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(t!=null&&t.label?t.label:B.t("shared.FoundationElement",zt))+(d?" ("+B.t("shared.ElementLocked",zt)+")":""),color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Et+.2]}),!d&&Z===xt.LowerLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LL",text:"LL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-yt,-at,Et+.2]}),!d&&Z===xt.UpperLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UL",text:"UL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-yt,at,Et+.2]}),!d&&Z===xt.LowerRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LR",text:"LR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[yt,-at,Et+.2]}),!d&&Z===xt.UpperRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UR",text:"UR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[yt,at,Et+.2]})]}),m===Nn.FocusPipe&&h.jsx(Ddn,{foundation:t}),m===Nn.FocusTower&&h.jsx(zdn,{foundation:t}),m===Nn.UpdraftTower&&h.jsx(Idn,{foundation:t}),h.jsx(wfn,{...t})]})})}),G3e="Handles Intersection Plane",uE=t=>{if(t.intersections.length>0){for(const e of t.intersections)if(e.eventObject.name===G3e)return e.point.z<0?null:e.point}return null},Jx=(t,e)=>new ue().subVectors(t,new ue(e.cx,e.cy,e.lz)).applyEuler(new cn(0,0,-e.rotation[2])),ert=(t,e,n,o,r)=>{const[i,a]=[e/2,n/2],[l,s,c]=o,u=new cn().fromArray([l-$t,s,c,"ZXY"]),d=r.map(f=>({x:f.x,y:f.y}));for(let f=-1;f<=1;f+=2)for(let p=-1;p<=1;p+=2){const m=new ue(i*f,0,a*p).applyEuler(u),y=new ue().addVectors(t,m);if(!ye.isPointInside(y.x,y.y,d))return!1}return!0},Nfn=(t,e,n,o,r,i,a)=>{const l=n/2,[s,c,u]=i,d=new cn().fromArray([s-$t,c,u,"ZXY"]),f=a.map(m=>({x:m.x,y:m.y})),p=new ue().addVectors(t,new ue(o*e,0,l+r).applyEuler(d));return!(!ye.isPointInside(p.x,p.y,f)||!ert(t,e,n,i,a))},Ufn=(t,e,n)=>{if(t.intersections.length>0)for(const o of t.intersections){const r=o.eventObject.name;if(r.includes("Window")&&r.includes(e)&&o.object.name!==G3e)return null;if(r.includes("Roof")&&r.includes(n)){const i=o.point.clone(),a=Number.parseInt(o.object.name.split(" ").pop()??"-1");return{pointer:i,segmentIdx:a}}}return null},dMe=t=>{switch(t){case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:return!0}return!1},jfn=(t,e,n)=>{const o=new ue().subVectors(e,t).applyEuler(new cn(0,0,-n)),r=Math.abs(o.x),i=Math.hypot(o.y,o.z),a=new ue().addVectors(t,e).divideScalar(2);return{newLx:r,newLz:i,newCenter:a}},Bfn=(t,e,n)=>n===Zo.Gambrel?U3e(t).map(o=>o.add(e)):t.map(o=>o.points[0].clone().add(e)),fMe=(t,e,n)=>{H.getState().set(o=>{const r=o.elements.find(i=>i.id===t&&i.type===z.Window);r&&([r.cx,r.cy,r.cz]=e,r.rotation=[...n])})},hMe=(t,e,n,o)=>{H.getState().set(r=>{const i=r.elements.find(a=>a.id===t&&a.type===z.Window);i&&([i.cx,i.cy,i.cz]=e,[i.lx,i.ly,i.lz]=n,o!=null&&(i.archHeight=o))})},pMe=(t,e)=>{H.getState().set(n=>{const o=n.elements.find(r=>r.id===t&&r.type===z.Window);o&&(o.polygonTop=[...e])})},Yfn=(t,e,n=.01)=>{if(t.type!==z.SolarPanel&&t.type!==z.Window)return null;const o=new cn().fromArray([t.rotation[0],t.rotation[1],t.rotation[2],"ZXY"]),r=new ue,i=t.lx/2+n;let a=n;t.type===z.SolarPanel?(a+=t.ly/2,r.set(t.cx*e.lx,t.cy*e.ly,0)):(a+=t.lz/2,r.set(t.cx,t.cy,0));const l=[];for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=new ue(s*i,s*c*a).applyEuler(o).add(r);l.push(u)}if(t.type===z.Window&&t.windowType===Ti.Polygonal){const[s,c]=t.polygonTop??P1,u=new ue(s*i,c+a).applyEuler(o).add(r);l.push(u)}return l},Jse=t=>{if(t.windowType===Ti.Polygonal)return t.polygonTop??P1},trt=({z:t})=>{const e=g.useRef(null),[n,o]=g.useState("white");return h.jsx(di,{ref:e,name:xt.Arch,args:[.2,.2,.2],position:[0,0,t],onPointerEnter:()=>{o("red")},onPointerLeave:()=>{o("white")},children:h.jsx("meshBasicMaterial",{color:n})})},Ofn=({id:t,parentId:e,foundationId:n,lx:o,lz:r,polygonTop:i,rotation:a,windowType:l,parentType:s})=>{const c=H(te=>te.addedWindowId),u=H(Fn),d=c===t,f=s===z.Roof,p=g.useRef(null),m=g.useRef(null),y=g.useRef(null),w=g.useRef(null),x=g.useRef(null),C=g.useRef(null),P=g.useRef(null),A=g.useRef(null),S=g.useRef([]),v=g.useRef(null),b=g.useRef(null),T=g.useRef(null),R=g.useRef(null),M=g.useRef(null),[D,k]=g.useState(!1),[N,U]=[o/2,r/2],[W,F]=i,E=g.useMemo(()=>o*W,[o,W]),L=H(pn),j=(te,q,le)=>{if(!n)return null;const de=H.getState().elements.find(ve=>ve.id===n&&ve.type===z.Foundation);if(!de)return null;const he=te.object.localToWorld(new ue),[me,ce,Pe]=a,pe=new cn().fromArray([me-$t,ce,Pe+de.rotation[2],"ZXY"]),Ie=new ue(q,0,le).applyEuler(pe);return new ue().addVectors(he,Ie)},Y=te=>{let q,le,de;for(const ge of H.getState().elements)ge.id===t&&ge.type===z.Window?q=ge:ge.id===n&&ge.type===z.Foundation?le=ge:ge.id===e&&ge.type===z.Roof&&(de=ge);const he=jn.getState().contentRef;if(!q||!le||!de||!he||!he.current)return;const me=le.id,ce=he.current.children.find(ge=>ge.name===`${Mp} ${me}`);if(!ce)return;const Pe=ce.children.find(ge=>ge.name===$ot);if(!Pe)return;const pe=Pe.children.find(ge=>ge.name.includes("Roof")&&ge.name.includes(e));if(!pe)return;const Ie=pe.children[0];if(!Ie)return;for(const ge of H.getState().elements)if(ge.parentId===e&&ge.id!==t){const we=Yfn(ge,le);we&&S.current.push(we)}const{centroid:ve,roofSegments:ze}=Ie.userData,se=new ue(q.cx,q.cy,q.cz+le.lz).clone().sub(ve);p.current=te,m.current=le,y.current=de,C.current=Rn.getSegmentIdx(ze,se),x.current=ve,w.current=ze,A.current=Bfn(w.current,x.current,de.roofType),v.current=[q.cx,q.cy,q.cz],T.current=[q.lx,q.ly,q.lz],b.current=[...q.rotation],R.current=q.archHeight,M.current=q.polygonTop??null},O=()=>{if(!v.current||!b.current)return;const te=H.getState().elements.find(le=>le.id===t&&le.type===z.Window);if(!te)return;const q={name:"Move skylight",timestamp:Date.now(),id:te.id,oldPosition:[...v.current],newPosition:[te.cx,te.cy,te.cz],oldRotation:[...b.current],newRotation:[...te.rotation],undo(){fMe(q.id,q.oldPosition,q.oldRotation)},redo(){fMe(q.id,q.newPosition,q.newRotation)}};u(q)},_=()=>{if(!T.current||!v.current)return;const te=H.getState().elements.find(le=>le.id===t&&le.type===z.Window);if(!te)return;const q={name:"Resize skylight",timestamp:Date.now(),id:te.id,oldPosition:[...v.current],newPosition:[te.cx,te.cy,te.cz],oldDimension:[...T.current],newDimension:[te.lx,te.ly,te.lz],oldArchHeight:R.current,newArchHeight:te.archHeight,undo(){hMe(this.id,this.oldPosition,this.oldDimension,this.oldArchHeight)},redo(){hMe(this.id,this.newPosition,this.newDimension,this.newArchHeight)}};u(q)},G=()=>{if(!M.current)return;const te=H.getState().elements.find(le=>le.id===t&&le.type===z.Window);if(!te)return;const q={name:"Resize skylight top vertex",timestamp:Date.now(),id:te.id,oldPolygonTop:[...M.current],newPolygonTop:te.polygonTop??P1,undo(){pMe(this.id,this.oldPolygonTop)},redo(){pMe(this.id,this.newPolygonTop)}};u(q)},Q=te=>te.roofType===Zo.Gable?!1:Math.abs(te.rise)<.001,oe=te=>{if(y.current&&Q(y.current))return A.current;if(te!=null){const le=In.getState().getRoofSegmentVertices(e);if(!le)return;const de=te===-1?le.length-1:te;return le[de]}},ee=(te,q,le,de,he)=>{const[me,ce]=[q/2,le/2],Pe=new cn().fromArray([de[0],de[1],de[2],"ZXY"]),pe=[];for(let Ie=-1;Ie<=1;Ie+=2)for(let ve=-1;ve<=1;ve+=2){const ze=new ue(Ie*me,Ie*ve*ce).applyEuler(Pe).add(te);pe.push(ze)}if(he){const[Ie,ve]=he,ze=new ue(Ie*me*2,ve+ce).applyEuler(Pe).add(te);pe.push(ze)}for(const Ie of S.current){for(const ve of pe)if(ye.isPointInside(ve.x,ve.y,Ie))return!1;for(const ve of Ie)if(ye.isPointInside(ve.x,ve.y,pe))return!1}return!0},$=(te,q,le,de,he,me)=>{if(me){const[ce,Pe]=me;return Nfn(q,le,de,ce,Pe,he,te)}else return ert(q,le,de,he,te)},ae=te=>{if(!f||d)return;const q=te.object.name;switch(q){case Ho.Mid:break;case xt.LowerLeft:{P.current=j(te,o,r);break}case xt.LowerRight:{P.current=j(te,-o,r);break}case xt.UpperLeft:{P.current=j(te,o,-r);break}case xt.UpperRight:{P.current=j(te,-o,-r);break}case xt.Arch:{P.current=j(te,0,-r);break}case xt.Upper:break;default:return}Y(q),k(!0),jn.getState().setEnableOrbitController(!1)},Z=te=>{if(p.current===null||!m.current||!y.current||!w.current||!x.current||!A.current)return;const q=m.current;if(p.current===Ho.Mid){const le=y.current,de=Ufn(te,t,e),he=new ue;if(Q(le)){const me=uE(te);if(!me)return;he.copy(me);const ce=Jx(he,q);L(Pe=>{if(!A.current)return;const pe=Pe.elements.find(Se=>Se.id===t&&Se.type===z.Window);if(!pe)return;const{lx:Ie,lz:ve,rotation:ze}=pe,Ae=A.current,se=Jse(pe),ge=$(Ae,ce,Ie,ve,ze,se),we=ee(ce,Ie,ve,ze,se);ge&&we&&(pe.cx=ce.x,pe.cy=ce.y,pe.cz=ce.z)})}else{if(de&&de.segmentIdx!==C.current){const ve=de.pointer;he.copy(ve)}else{const ve=uE(te);if(!ve)return;he.copy(ve)}const me=Jx(he,q),ce=me.clone().sub(x.current),{rotation:Pe,segmentVertices:pe,segmentIdx:Ie}=Rn.computeState(w.current,ce);pe?me.setZ(Rn.getRooftopElementZ(pe,ce,x.current.z+le.thickness)):me.setZ(x.current.z+le.thickness),L(ve=>{const ze=In.getState().getRoofSegmentVertices(e);if(!ze)return;const Ae=Ie===-1?ze.length-1:Ie,se=ze[Ae];if(!se)return;const ge=ve.elements.find(Re=>Re.id===t&&Re.type===z.Window);if(!ge)return;const{lx:we,lz:Se}=ge,Me=Jse(ge),Ce=$(se,me,we,Se,Pe,Me),Te=ee(me,we,Se,Pe,Me);Ce&&Te&&(ge.cx=me.x,ge.cy=me.y,ge.cz=me.z,ge.rotation=[...Pe],de&&de.segmentIdx!==C.current&&(C.current=de.segmentIdx))})}}else if(dMe(p.current)){const le=oe(C.current),de=uE(te),he=P.current;if(!de||!he||!le)return;const me=Jx(de,q),ce=Jx(he,q),{newLx:Pe,newLz:pe,newCenter:Ie}=jfn(ce,me,a[2]);H.getState().set(ve=>{const ze=ve.elements.find(we=>we.id===t&&we.type===z.Window);if(!ze)return;const Ae=Jse(ze),se=$(le,Ie,Pe,pe,a,Ae),ge=ee(Ie,Pe,pe,a,Ae);se&&ge&&(ze.cx=Ie.x,ze.cy=Ie.y,ze.cz=Ie.z,ze.lx=Pe,ze.lz=Math.max(.001,pe))})}else if(p.current===xt.Upper){const le=oe(C.current),de=uE(te);if(!de||!le)return;const he=Jx(de,q);L(me=>{const ce=me.elements.find(He=>He.id===t);if(!ce)return;const[Pe,pe]=[ce.lx/2,ce.lz/2],Ie=new ue(ce.cx,ce.cy,ce.cz),ve=new cn().fromArray([ce.rotation[0],ce.rotation[1],ce.rotation[2],"ZXY"]),ze=new ue(-Pe,-pe,0).applyEuler(ve).add(Ie),Ae=new ue(Pe,-pe,0).applyEuler(ve).add(Ie),se=new ue().subVectors(he,ze),ge=new ue().subVectors(Ae,ze).normalize(),we=se.clone().projectOnVector(ge).applyEuler(new cn(0,0,-ce.rotation[2])),Se=ye.clamp((we.x-Pe)/ce.lx,-.5,.5),Me=Rn.getDistance(ze,Ae,he),Ce=Math.hypot(Me,he.z-ze.z),Te=Math.max(0,Ce-ce.lz),Re=[Se,Te],Ne=new ue(ce.cx,ce.cy,ce.cz),{lx:_e,lz:Ue}=ce,qe=$(le,Ne,_e,Ue,a,Re),Fe=ee(Ne,_e,Ue,a,Re);qe&&Fe&&(ce.polygonTop=[...Re])})}else if(p.current===xt.Arch){const le=uE(te),de=P.current,he=oe(C.current);if(!le||!de||!he)return;const me=Jx(le,q),ce=Jx(de,q);L(Pe=>{const pe=Pe.elements.find(Te=>Te.id===t&&Te.type===z.Window);if(!pe)return;const[Ie,ve]=[pe.lx/2,pe.lz/2],ze=new ue(pe.cx,pe.cy,pe.cz),Ae=new cn().fromArray([pe.rotation[0],pe.rotation[1],pe.rotation[2],"ZXY"]),se=new ue(-Ie,-ve,0).applyEuler(Ae).add(ze),ge=new ue(Ie,-ve,0).applyEuler(Ae).add(ze),we=Rn.getDistance(se,ge,me);let Se=Math.hypot(we,me.z-se.z);const Me=Math.min(pe.archHeight,pe.lz,pe.lx/2),Ce=pe.lz-Me;if(Se>Ce&&Se{p.current===Ho.Mid?O():dMe(p.current)?_():p.current===xt.Upper?G():p.current===xt.Arch&&_(),v.current=null,T.current=null,b.current=null,R.current=null,M.current=null,p.current=null,m.current=null,y.current=null,w.current=null,x.current=null,C.current=null,P.current=null,A.current=null,S.current=[],k(!1),jn.getState().setEnableOrbitController(!0)};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Handle Wrapper",onPointerDown:ae,children:[!d&&h.jsxs(h.Fragment,{children:[l===Ti.Polygonal&&h.jsx(xv,{x:E,z:U+F,handleType:xt.Upper,scale:[.5,1,1.5]}),h.jsx(xv,{x:-N,z:U,handleType:xt.UpperLeft}),h.jsx(xv,{x:N,z:U,handleType:xt.UpperRight}),h.jsx(xv,{x:-N,z:-U,handleType:xt.LowerLeft}),h.jsx(xv,{x:N,z:-U,handleType:xt.LowerRight}),l===Ti.Arched&&h.jsx(trt,{z:U})]}),h.jsx(rHt,{handleType:Ho.Mid})]}),f&&D&&h.jsx(yi,{name:G3e,args:[1e3,1e3],rotation:[$t,0,0],onPointerMove:Z,onPointerUp:ne,visible:!1,children:h.jsx("meshBasicMaterial",{color:"red",side:zr,transparent:!0,opacity:.5})})]})},_fn=xe.memo(Ofn),Vfn=new vf({color:"white",side:zr}),Gfn=xe.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i]=t,{width:a,horizontalMullionSpacing:l,verticalMullionSpacing:s,color:c}=e,u=3,d=1,f=a/2,p=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),m=g.useMemo(()=>{const w=[],x=Math.round(o/s)-1;if(x<=0||a===0)return w;const C=o/(x+1);let P=C/2;x%2!==0&&(w.push(0),P=C);for(let A=0;A{const w=[],x=Math.round(i/l)-1;if(x<=0||a===0)return w;const C=i/(x+1);let P=C/2;x%2!==0&&(w.push(0),P=C);for(let A=0;Ah.jsx(wa,{position:[w,25e-5,0],args:[f,f,i,u,d],rotation:[$t,$t,0],receiveShadow:n,castShadow:n,children:p},x)),e.horizontalMullion&&y.map((w,x)=>h.jsx(wa,{position:[0,5e-4,w],args:[f,f,o,u,d],rotation:[0,0,$t],receiveShadow:n,castShadow:n,children:p},x))]})}),Xfn=xe.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i]=t,{color:a,width:l,sillWidth:s}=e,c=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]),u=l/2,d=u/2,f=o+l*3,p=l;return h.jsxs("group",{name:"Window Frame Group",position:[0,-d/2,0],children:[h.jsx(di,{position:[0,0,i/2],args:[o+2*l,d,l],castShadow:n,receiveShadow:n,children:c}),h.jsx(di,{position:[-o/2-u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(di,{position:[o/2+u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(di,{position:[0,0,-i/2-(s===0?0:p/2)],args:s===0?[o+2*l,d,l]:[f,s??l,p],castShadow:n,receiveShadow:n,children:c})]})}),Jfn=xe.memo(({cy:t,dimension:e,wireframeData:n})=>{const[o,r,i]=e,{lineWidth:a,lineColor:l,selected:s,locked:c,opacity:u}=n,d=o/2,f=i/2,p=3,m=1,y=g.useMemo(()=>new vf({color:l}),[l]),w=g.useMemo(()=>new vf({color:i0}),[]),x=(C,P)=>{const A=C/2;return h.jsxs(h.Fragment,{children:[h.jsx(wa,{args:[C,C,o,p,m],rotation:[0,0,$t],position:[0,0,f-A],material:P}),h.jsx(wa,{args:[C,C,o,p,m],rotation:[0,0,$t],position:[0,0,-f+A],material:P}),h.jsx(wa,{args:[C,C,i,p,m],rotation:[$t,$t,0],position:[d-A,0,0],material:P}),h.jsx(wa,{args:[C,C,i,p,m],rotation:[$t,$t,0],position:[-d+A,0,0],material:P})]})};return h.jsxs("group",{name:"Window Wireframe Group",children:[u>0&&h.jsx("group",{position:[0,t,0],children:x(a/20,y)}),c&&s&&x(a/5,w)]})}),Kfn=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:m,foundation:y})=>{const w=H.getState().world,x=H(Y5),C=H(J3),P=H(K3),A=H(xs),S=In(PS),v=g.useRef(0),b=g.useRef(),[T,R,M]=e,[D,k,N]=n,U=g.useMemo(()=>{if(!d||m||y&&y.notBuilding)return;const L=S.get(t);if(!L)return;const j=L.reduce(($,ae)=>$+ae,0);if(f===0)return;const Y=X3*(w.solarRadiationHeatmapGridCellSize??.5),O=Math.max(2,Math.round(T/Y)),_=Math.max(2,Math.round(M/Y)),G=T/O,Q=M/_,oe=j/f*(x??Ny);v.current=oe<0?1:0,b.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(oe)*$t);const ee=[];if(oe<0)for(let $=0;$c*T,[T,c]),F=g.useMemo(()=>(W+r.width+T)/2*1.025,[T,W,r.width]),E=(L,j,Y)=>h.jsx(yi,{name:"Window Seal Plane",args:L,position:j,rotation:Y,material:Vfn,receiveShadow:A,castShadow:A});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Rectangle Window Plane Group",position:[0,k,0],children:[h.jsx(yi,{name:"Window Glass Plane",args:[T,M],rotation:[$t,0,0],children:u}),(o.horizontalMullion||o.verticalMullion)&&h.jsx(Gfn,{dimension:e,mullionData:o,shadowEnabled:A})]}),r.showFrame&&h.jsx(Xfn,{dimension:e,frameData:r,shadowEnabled:A}),h.jsx(J3e,{cx:F,lx:W,lz:M,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),h.jsx(Jfn,{cy:k,dimension:e,wireframeData:i}),E([R,M],[-T/2+.001,R/2,0],[$t,$t,0]),E([R,M],[T/2-1e-4,R/2,0],[$t,-$t,0]),E([T,R],[0,R/2,M/2-.001],[Math.PI,0,0]),E([T,R],[0,R/2,-M/2+.001]),U&&U.map((L,j)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:L,name:"Heat Flux "+j,lineWidth:P??Uy,color:C??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:L[v.current].clone().add(new ue(0,v.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:b.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??Fu})})]},j))]})},$fn=xe.memo(Kfn),X3e=({element:t})=>{const e=H(Au),n=H(Cm),o=H($y),r=t.lx/2,i=t.lz/2,a=.05,l=1,s=.5,c=t.lineColor??"white",u="darkorchid",d=Math.max(.25,(r+i)/32),f=.25,p=30,m=-.1,y=g.useMemo(()=>({lng:e}),[e]),w=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[-r-f,m,0]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r-f,0,-i],[-r-f,0,i]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r-f+a,0,-i+3*a],[-r-f,0,-i],[-r-f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r-f+a,0,i-3*a],[-r-f,0,i],[-r-f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r-f*2,0,-i]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,i],[-r-f*2,0,i]],color:c,linewidth:s})]}),[r,i,y]),x=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[r+f,m,0]}),h.jsx(On,{userData:{unintersectable:!0},points:[[r+f,0,-i],[r+f,0,i]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r+f+a,0,-i+3*a],[r+f,0,-i],[r+f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r+f+a,0,i-3*a],[r+f,0,i],[r+f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,-i],[r+f*2,0,-i]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,i],[r+f*2,0,i]],color:c,linewidth:s})]}),[r,i,y]),C=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,m,-i-f]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,-i-f],[r,0,-i-f]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r+3*a,0,-i-f-a],[-r,0,-i-f],[-r+3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r-3*a,0,-i-f-a],[r,0,-i-f],[r-3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r,0,-i-f*2]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,-i],[r,0,-i-f*2]],color:c,linewidth:s})]}),[r,i,y]),P=g.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+B.t("word.MeterAbbreviation",y),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,m,i+f]}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,i+f],[r,0,i+f]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r+3*a,0,i+f-a],[-r,0,i+f],[-r+3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[r-3*a,0,i+f-a],[r,0,i+f],[r-3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(On,{userData:{unintersectable:!0},points:[[-r,0,i],[-r,0,i+f*2]],color:c,linewidth:s}),h.jsx(On,{userData:{unintersectable:!0},points:[[r,0,i],[r,0,i+f*2]],color:c,linewidth:s})]}),[r,i,y]);if(n)switch(n){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[w,C]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[x,C]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[w,P]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[x,P]})}if(o)switch(o){case xt.LowerLeft:return h.jsxs(h.Fragment,{children:[w,C]});case xt.LowerRight:return h.jsxs(h.Fragment,{children:[x,C]});case xt.UpperLeft:return h.jsxs(h.Fragment,{children:[w,P]});case xt.UpperRight:return h.jsxs(h.Fragment,{children:[x,P]})}return h.jsx(h.Fragment,{})};xe.memo(X3e);const J3e=({cx:t,cz:e=0,lx:n,lz:o,color:r,showLeft:i,showRight:a,spacing:l})=>{const s=H(xs),c=dt(vs),u=dt(n6);return c||u?null:h.jsxs("group",{name:"Shutter Group",children:[a&&h.jsx(di,{args:[n,.1,o],position:[t+l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})}),i&&h.jsx(di,{args:[n,.1,o],position:[-t-l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})})]})},Upe="Window Group",P1=[0,.5],qfn=t=>{const{id:e,parentId:n,foundationId:o,cx:r,cy:i,cz:a,lx:l,ly:s,lz:c,rotation:u,locked:d,lineWidth:f=.2,lineColor:p="black",horizontalMullion:m=!0,verticalMullion:y=!0,mullionWidth:w=.06,horizontalMullionSpacing:x=.5,verticalMullionSpacing:C=.5,tint:P="#73D8FF",opacity:A=.5,leftShutter:S=!1,rightShutter:v=!1,shutterColor:b="gray",shutterWidth:T=.5,mullionColor:R="white",frame:M=!1,color:D="white",frameWidth:k=.1,sillWidth:N=.1,windowType:U=Ti.Default,archHeight:W,parentType:F=z.Wall,polygonTop:E=P1}=t,L=`${Upe} ${e}`,j=H(pn),Y=H(p4),O=dt(kf),_=H(TGe),G=H(sQ),Q=Fc(e),oe=(ve=!1)=>{G&&dt.getState().set(ze=>{ze.modelTreeExpandedKeys=[e]}),j(ze=>{if(ze.contextMenuObjectType=null,ze.groupActionMode)ze.multiSelectionsMode||ze.selectedElementIdSet.clear(),t.foundationId&&(ze.selectedElementIdSet.has(n)?ze.selectedElementIdSet.delete(n):ze.selectedElementIdSet.add(t.foundationId));else for(const Ae of ze.elements)if(Ae.id===e)if(Ae.selected=!0,ze.selectedElement=Ae,ve)if(ze.selectedElementIdSet.has(e))for(const se of ze.elements)ze.selectedElementIdSet.has(se.id)&&se.type!==ze.selectedElement.type&&ze.selectedElementIdSet.delete(se.id);else if(ze.multiSelectionsMode){ze.selectedElementIdSet.add(e);for(const se of ze.elements)ze.selectedElementIdSet.has(se.id)&&se.type!==ze.selectedElement.type&&ze.selectedElementIdSet.delete(se.id)}else ze.selectedElementIdSet.clear(),ze.selectedElementIdSet.add(e);else ze.multiSelectionsMode?ze.selectedElementIdSet.has(e)?ze.selectedElementIdSet.delete(e):ze.selectedElementIdSet.add(e):(ze.selectedElementIdSet.clear(),ze.selectedElementIdSet.add(e));else Ae.selected=!1})},ee=ve=>ve.intersections.length>0&&ve.intersections[0].eventObject.name===L&&!H.getState().moveHandleType&&!H.getState().resizeHandleType&&!H.getState().isAddingElement()&&H.getState().objectTypeToAdd===z.None,$=ve=>{if(ve.eventObject.name===L&&ve.intersections.length>0)switch(ve.object.name){case Ho.Mid:case xt.UpperLeft:case xt.UpperRight:case xt.LowerLeft:case xt.LowerRight:case xt.Arch:case xt.Upper:return!0}return!1},ae=(ve,ze)=>{jn.getState().setEnableOrbitController(!1),O("showWallIntersectionPlaneId",n),j(Ae=>{Ae.resizeHandleType=ve,Ae.resizeAnchor.copy(new ue(r,0,a).add(ze))})},Z=ve=>{if(!(ve.button===2||H.getState().addedWallId)&&(ee(ve)&&oe(),$(ve))){const ze=ve.intersections[0].eventObject.name;switch(ze){case Ho.Mid:{jn.getState().setEnableOrbitController(!1),dt.getState().set(Ae=>{Ae.showWallIntersectionPlaneId=n,Ae.oldParentId=n,Ae.oldFoundationId=o}),j(Ae=>{Ae.moveHandleType=ze,Ae.selectedElement=Ae.elements.find(se=>{var ge;return se.id===((ge=Ae.selectedElement)==null?void 0:ge.id)})});break}case xt.UpperLeft:{ae(ze,new ue(l/2,0,-c/2));break}case xt.UpperRight:{ae(ze,new ue(-l/2,0,-c/2));break}case xt.LowerLeft:{ae(ze,new ue(l/2,0,c/2));break}case xt.LowerRight:{ae(ze,new ue(-l/2,0,c/2));break}case xt.Arch:{ae(ze,new ue(0,0,0));break}case xt.Upper:{ae(ze,new ue(0,0,c/2));break}}}},ne=ve=>{H.getState().addedWallId||ee(ve)&&(oe(!0),j(ze=>{ze.contextMenuObjectType=z.Window}))},te=g.useMemo(()=>{if(F===z.Roof){const[ve,ze,Ae]=u;return new cn().fromArray([ve-$t,ze,Ae,"ZXY"])}else return new cn},[F,u]),q=g.useMemo(()=>h.jsx("meshPhongMaterial",{specular:new ir("white"),shininess:_??DX,color:P,side:zr,opacity:A,transparent:!0}),[_,P,A]),le=g.useMemo(()=>W!==void 0?[l,s,c,W]:[l,s,c],[l,s,c,W]),de=g.useMemo(()=>F===z.Roof?[r,.05,a]:[r,i,a],[r,i,a,F]),he=g.useMemo(()=>({horizontalMullion:m,verticalMullion:y,width:w,horizontalMullionSpacing:x,verticalMullionSpacing:C,color:R}),[m,y,w,x,C,R]),me=g.useMemo(()=>({showFrame:M,width:k,color:D,sillWidth:N}),[M,k,D,N]),ce=g.useMemo(()=>({lineColor:p,lineWidth:f,selected:Q,locked:d,opacity:A}),[p,f,Q,d,A]),Pe=dt(n6),pe=()=>{switch(U){case Ti.Default:return h.jsx($fn,{id:t.id,dimension:le,position:de,mullionData:he,frameData:me,wireframeData:ce,leftShutter:S,rightShutter:v,shutterColor:b,shutterWidth:T,glassMaterial:q,showHeatFluxes:Pe,area:ye.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:Y(t)});case Ti.Arched:return h.jsx(AHt,{id:t.id,dimension:le,position:de,mullionData:he,frameData:me,wireframeData:ce,leftShutter:S,rightShutter:v,shutterColor:b,shutterWidth:T,glassMaterial:q,showHeatFluxes:Pe,area:ye.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:Y(t)});case Ti.Polygonal:return h.jsx(PHt,{id:t.id,dimension:le,polygonTop:E,position:de,glassMaterial:q,empty:!!t.empty,interior:!!t.interior,wireframeData:ce,frameData:me,leftShutter:S,rightShutter:v,shutterColor:b,shutterWidth:T,showHeatFluxes:Pe,area:ye.getWindowArea(t),foundation:Y(t)})}},Ie=F===z.Roof?i:0;return h.jsxs("group",{name:L,position:[r,Ie,a],rotation:te,onPointerDown:Z,onContextMenu:ne,onPointerMove:()=>{},children:[pe(),Q&&h.jsx(X3e,{element:t}),Q&&!d&&h.jsx(_fn,{id:e,parentId:n,foundationId:o,lx:l,lz:c,polygonTop:E,rotation:u,windowType:U,parentType:F})]},e)},nrt=xe.memo(qfn),Qfn=xe.memo(({lineColor:t="black",lineWidth:e=.2,hx:n,hz:o,fill:r,isTopPartial:i,leftUnfilledHeight:a,rightUnfilledHeight:l,showParapet:s=!1,leftHeight:c=2*o,rightHeight:u=2*o,center:d,centerLeft:f,centerRight:p})=>{const m=H(S=>S.viewState.orthographic),y=[-n,-o+.001+(r===Ul.Partial?a:0),.001],w=[n,-o+.001+(r===Ul.Partial?l:0),.001],x=[-n,c-o-.001,.001],C=[n,u-o-.001,.001],P=n*2,A=[];if(m)e=2,A.push(x,C);else if(s)A.push(x,y,w,C);else if(i)A.push(y,x,C,w,y);else{if(A.push(y,x),f){const S=[f[0]*P,f[1]-o,.001];A.push(S)}if(d){const S=[d[0]*P,d[1]-o,.001];A.push(S)}if(p){const S=[p[0]*P,p[1]-o,.001];A.push(S)}A.push(C,w)}return h.jsx(xe.Fragment,{children:h.jsx(On,{rotation:[$t,0,0],points:A,color:t,lineWidth:e})})});var Wd=(t=>(t.Default="Default",t.Arched="Arched",t))(Wd||{});const Zfn=xe.memo(({dimension:t,lineColor:e,lineWidth:n})=>{const[o,r,i]=t.map(u=>u/2),a=[-o,0,i+.05],l=[o,0,i+.05],s=[-o,0,-i],c=[o,0,-i];return h.jsx(On,{points:[s,a,l,c],lineWidth:n,color:e})}),ehn=xe.memo(({dimension:t,color:e})=>{const[n,o,r]=t,i=H(xs),a=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:e}),[e]),l=.1,s=l/2;return h.jsxs("group",{name:"Door frame group",children:[h.jsx(di,{position:[0,0,r/2],args:[n,l,l],castShadow:i,receiveShadow:i,children:a}),h.jsx(di,{position:[-n/2+s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a}),h.jsx(di,{position:[n/2-s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a})]})}),thn=xe.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,area:s,showHeatFluxes:c,foundation:u})=>{const d=H.getState().world,f=H(Y5),p=H(J3),m=H(K3),y=H(xs),w=In(PS),x=g.useRef(0),C=g.useRef(),[P,A,S]=e,v=g.useMemo(()=>{if(!c||u&&u.notBuilding)return;const T=w.get(t);if(!T)return;const R=T.reduce((E,L)=>E+L,0);if(s===0)return;const M=X3*(d.solarRadiationHeatmapGridCellSize??.5),D=Math.max(2,Math.round(P/M)),k=Math.max(2,Math.round(S/M)),N=P/D,U=S/k,W=R/s*(f??Ny);x.current=W<0?1:0,C.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(W)*$t);const F=[];if(W<0)for(let E=0;E{const T=new jl,[R,M]=[P/2,S/2],D=Math.max(R,M)*.2;return T.moveTo(-R,-M),T.lineTo(-R,M),T.lineTo(R,M),T.lineTo(R,-M),l||(T.lineTo(R-D,-M),T.lineTo(R-D,M-D),T.lineTo(-R+D,M-D),T.lineTo(-R+D,-M)),T.closePath(),T},[P,S,l]);return h.jsxs("group",{name:"Rectangle door group",position:[0,-.01,0],children:[h.jsx("mesh",{name:"Rectangular Door Mesh",rotation:[$t,0,0],material:a,castShadow:y&&l,receiveShadow:y&&l,children:h.jsx("shapeGeometry",{args:[b]})}),l&&h.jsxs("mesh",{name:"Rectangular Door Simulation Mesh",rotation:[$t,0,0],uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[b]}),h.jsx("meshBasicMaterial",{side:zr})]}),l&&h.jsx("mesh",{name:"Door plane inside",position:[0,.1,0],rotation:[-$t,0,Math.PI],material:a,castShadow:y&&l,receiveShadow:y&&l,children:h.jsx("shapeGeometry",{args:[b]})}),h.jsx(Zfn,{dimension:e,lineColor:r&&i?i0:"black",lineWidth:r&&i?2:.2}),h.jsx(ehn,{dimension:e,color:o}),v&&v.map((T,R)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:T,name:"Heat Flux "+R,lineWidth:m??Uy,color:p??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:T[x.current].clone().add(new ue(0,x.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:p??Fu})})]},R))]})}),nhn=xe.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,showHeatFluxes:s,area:c,foundation:u})=>{const d=H.getState().world,f=H(xs),p=H(Y5),m=H(J3),y=H(K3),w=In(PS),x=g.useRef(0),C=g.useRef(),[P,A,S,v]=e,b=(D,k)=>{if(v>0){const N=.5*P,U=.5*S,W=Math.min(v,S,N),F=.5*(W+N*N/W);if(Math.abs(D)-U)return!0;const E=k-(S-F-U);return D*D+E*E{if(!s||u&&u.notBuilding)return;const D=w.get(t);if(!D)return;const k=D.reduce((Y,O)=>Y+O,0);if(c===0)return;const N=X3*(d.solarRadiationHeatmapGridCellSize??.5),U=Math.max(2,Math.round(P/N)),W=Math.max(2,Math.round(S/N)),F=P/U,E=S/W,L=k/c*(p??Ny);x.current=L<0?1:0,C.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(L)*$t);const j=[];if(L<0)for(let Y=0;Y{const D=new jl,k=P/2,N=S/2,U=Math.min(v,S,k);if(D.moveTo(k,-N),D.lineTo(k,N-U),U>.1){const W=U/2+P**2/(8*U),[F,E]=[0,N-W],L=Math.acos(Math.min(k/W,1)),j=Math.PI-L;D.absarc(F,E,W,L,j,!1)}else D.lineTo(-k,N);if(D.lineTo(-k,-N),!l){const W=P*.4,F=S*.4,E=Math.min(v*.8,S*.8,k*.8);if(D.lineTo(-W,-N),E>.1){D.lineTo(-W,N-E);const L=E/2+(P*.8)**2/(8*E),[j,Y]=[0,F-L],O=Math.acos(Math.min(W/L,1)),_=Math.PI-O;D.absarc(j,Y,L,_,O,!0)}else D.lineTo(-W,F),D.lineTo(W,F);D.lineTo(W,-N)}return D.closePath(),D},[P,S,v,l]),M=g.useMemo(()=>({lineColor:"black",lineWidth:i&&r?.2:.1,opacity:1,selected:r,locked:i}),[r,i]);return h.jsxs("group",{name:"Arched door group",children:[h.jsx("mesh",{name:"Arched Door Mesh",rotation:[$t,0,0],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),l&&h.jsxs("mesh",{name:"Arched Door Simulation Mesh",rotation:[$t,0,0],material:a,uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[R]}),h.jsx("meshBasicMaterial",{side:zr})]}),l&&h.jsx("mesh",{name:"Door plane mesh inside",position:[0,.1,0],rotation:[-$t,0,Math.PI],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),h.jsx(Xde,{cy:0,dimension:e,wireframeData:M}),h.jsx(Xde,{cy:A,dimension:e,wireframeData:M}),T&&T.map((D,k)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{points:D,name:"Heat Flux "+k,lineWidth:y??Uy,color:m??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:D[x.current].clone().add(new ue(0,x.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:m??Fu})})]},k))]})}),ort="/aladdin/assets/door_edge-Dxz9LnYZ.png",rrt="/aladdin/assets/door_01-Bl1yYWKp.png",jpe="/aladdin/assets/door_02-eLAy3erM.png",irt="/aladdin/assets/door_03-CX-eEQtv.png",art="/aladdin/assets/door_04-Bk3Xe_KE.png",lrt="/aladdin/assets/door_05-15BnnbHK.png",srt="/aladdin/assets/door_06-B08sjms-.png",crt="/aladdin/assets/door_07-BVyEwygm.png",urt="/aladdin/assets/door_08-Cd1Vc7FQ.png",drt="/aladdin/assets/door_09-DQcA4jCn.png",frt="/aladdin/assets/door_10-DVLJsY3W.png",hrt="/aladdin/assets/door_11-dOCMnkGG.png",prt="/aladdin/assets/door_12-7f2iD2B7.png",grt="/aladdin/assets/door_13-IsPl-xmI.png",mrt="/aladdin/assets/door_14-CljRO-fX.png",yrt="/aladdin/assets/door_15-CoUc1lfF.png",Art="/aladdin/assets/door_16-Dlbc5tIF.png",wrt="/aladdin/assets/door_17-CHob_UgA.png",ohn=(t,e,n,o)=>{const r=g.useMemo(()=>{let s;switch(t){case dr.Default:s=ort;break;case dr.NoTexture:s=Gg;break;case dr.Texture01:s=rrt;break;case dr.Texture02:s=jpe;break;case dr.Texture03:s=irt;break;case dr.Texture04:s=art;break;case dr.Texture05:s=lrt;break;case dr.Texture06:s=srt;break;case dr.Texture07:s=crt;break;case dr.Texture08:s=urt;break;case dr.Texture09:s=drt;break;case dr.Texture10:s=frt;break;case dr.Texture11:s=hrt;break;case dr.Texture12:s=prt;break;case dr.Texture13:s=grt;break;case dr.Texture14:s=mrt;break;case dr.Texture15:s=yrt;break;case dr.Texture16:s=Art;break;case dr.Texture17:s=wrt;break;default:s=jpe}return new Qg().load(s,c=>{n!==void 0&&o!==void 0&&(c.offset.set(.5,.5),c.repeat.set(1/n,1/o)),a(c),l()})},[t,e,n,o]),[i,a]=g.useState(r),{invalidate:l}=ti();return i},rhn=new vf({color:"white",side:$i}),ihn=xe.memo(({dimension:t,doorType:e})=>{const[n,o,r]=t.map(a=>a/2);return n===0&&r===0?null:h.jsxs("group",{name:"Door handle wrapper",children:[h.jsx(xv,{x:-n,z:r,handleType:xt.UpperLeft}),h.jsx(xv,{x:n,z:r,handleType:xt.UpperRight}),e===Wd.Arched&&h.jsx(trt,{z:r})]})}),ahn=xe.memo(({dimension:t})=>{const e=H(xs),[n,o,r]=t,[i,a,l]=t.map(c=>c/2),s=(c,u,d)=>h.jsx(yi,{name:"Door seal plane",args:c,position:u,rotation:d,material:rhn,receiveShadow:e});return h.jsxs("group",{name:"Door seal planes group",children:[s([o,r],[-i,a,0],[$t,$t,0]),s([o,r],[i,a,0],[$t,-$t,0]),s([n,o],[0,a,l],[Math.PI,0,0])]})}),lhn=t=>{const{id:e,parentId:n,cx:o,cy:r,cz:i,lx:a,ly:l,lz:s,textureType:c,locked:u=!1,color:d="white",doorType:f=Wd.Default,archHeight:p=1,filled:m=!0,opacity:y=1,frameColor:w="white"}=t,x=`Door Group ${e}`,C=H(pn),P=dt(kf),A=H(TGe),S=H(sQ),v=Fc(e),b=g.useRef(!1);g.useEffect(()=>{const oe=()=>{b.current=!1};return window.addEventListener("pointerup",oe),()=>window.removeEventListener("pointerup",oe)},[]);const T=(oe=!1)=>{S&&dt.getState().set(ee=>{ee.modelTreeExpandedKeys=[e]}),C(ee=>{if(ee.groupActionMode)ee.multiSelectionsMode||ee.selectedElementIdSet.clear(),t.foundationId&&(ee.selectedElementIdSet.has(n)?ee.selectedElementIdSet.delete(n):ee.selectedElementIdSet.add(t.foundationId));else for(const $ of ee.elements)if($.id===e)if($.selected=!0,ee.selectedElement=$,oe)if(ee.selectedElementIdSet.has(e))for(const ae of ee.elements)ee.selectedElementIdSet.has(ae.id)&&ae.type!==ee.selectedElement.type&&ee.selectedElementIdSet.delete(ae.id);else if(ee.multiSelectionsMode){ee.selectedElementIdSet.add(e);for(const ae of ee.elements)ee.selectedElementIdSet.has(ae.id)&&ae.type!==ee.selectedElement.type&&ee.selectedElementIdSet.delete(ae.id)}else ee.selectedElementIdSet.clear(),ee.selectedElementIdSet.add(e);else ee.multiSelectionsMode?ee.selectedElementIdSet.has(e)?ee.selectedElementIdSet.delete(e):ee.selectedElementIdSet.add(e):(ee.selectedElementIdSet.clear(),ee.selectedElementIdSet.add(e));else $.selected=!1})},R=oe=>oe.intersections.length>0&&oe.intersections[0].eventObject.name===x&&!H.getState().moveHandleType&&!H.getState().resizeHandleType&&!H.getState().isAddingElement()&&H.getState().objectTypeToAdd===z.None,M=oe=>{if(oe.eventObject.name===x&&oe.intersections.length>0)switch(oe.object.name){case xt.UpperLeft:case xt.UpperRight:case xt.Arch:return!0}return!1},D=(oe,ee)=>{jn.getState().setEnableOrbitController(!1),P("showWallIntersectionPlaneId",n),C($=>{$.resizeHandleType=oe,$.resizeAnchor.copy(new ue(o,0,i).add(ee))})},k=oe=>{H.getState().addedWallId||R(oe)&&(T(!0),C(ee=>{ee.contextMenuObjectType=z.Door}))},N=oe=>{if(!(b.current||oe.button===2||H.getState().addedWallId)&&(b.current=!0,R(oe)&&T(),M(oe))){const ee=oe.intersections[0].eventObject.name;switch(ee){case xt.UpperLeft:{D(ee,new ue(a/2,0,-s/2));break}case xt.UpperRight:{D(ee,new ue(-a/2,0,-s/2));break}case xt.Arch:{D(ee,new ue(0,0,0));break}}}},U=H(p4),W=dt(vs),F=dt(n6),E=H(Df),L=In(O1),[j,Y]=g.useState(null),O=()=>{switch(f){case Wd.Default:return h.jsx(thn,{id:e,dimension:G,color:d,frameColor:w,selected:v,locked:u,material:Q,filled:m,showHeatFluxes:F,area:ye.getDoorArea(t),foundation:U(t)});case Wd.Arched:return h.jsx(nhn,{id:e,dimension:G,color:d,frameColor:w,selected:v,locked:u,material:Q,filled:m,showHeatFluxes:F,area:ye.getDoorArea(t),foundation:U(t)})}};g.useEffect(()=>{if(t&&W){const oe=L(t.id);if(oe){const ee=ye.fetchHeatmapTexture(oe,E??5);ee&&(ee.wrapS=es,ee.wrapT=es,ee.offset.set(-a/2,-s/2),ee.center.set(a/2,s/2),ee.repeat.set(1/a,1/s),Y(ee))}}},[W,E]);const _=ohn(c,f,a,s),G=g.useMemo(()=>[a,l,s,p],[a,l,s,p]),Q=g.useMemo(()=>W&&j&&t.filled?new _3({color:d,map:j,side:$i}):m?c===dr.Default||c===dr.NoTexture?y<1?new S2e({specular:"white",shininess:A??DX,color:d,side:$i,opacity:y,transparent:!0}):new vf({map:_,color:d,side:$i}):new vf({map:_,side:$i}):new vf({opacity:d===kde?.5:0,color:d,transparent:!0,side:zr}),[W,j,d,c,_,m,y]);return h.jsxs("group",{name:x,position:[o,0,i],onPointerDown:N,onContextMenu:k,children:[O(),v&&h.jsx(X3e,{element:t}),v&&!u&&h.jsx(ihn,{dimension:G,doorType:f}),h.jsx(ahn,{dimension:G})]})},shn=xe.memo(lhn),chn="/aladdin/assets/polygon_08-BBFzZjDj.png",uhn="/aladdin/assets/polygon_09-B_8KpAt3.png",dhn="/aladdin/assets/polygon_10-CKqrpQre.png",xrt=({id:t,lz:e=.1,filled:n=!1,rotation:o=[0,0,0],normal:r=[0,0,1],color:i="yellow",label:a,text:l,fontSize:s=1,fontColor:c="black",fontOutlineWidth:u=0,fontOutlineColor:d="white",fontStrokeWidth:f=0,fontStrokeColor:p="black",lineStyle:m=Ap.Solid,lineColor:y="black",lineWidth:w=1,locked:x=!1,showLabel:C=!1,parentId:P,foundationId:A,vertices:S,opacity:v=1,noOutline:b=!1,shininess:T=0,selectedIndex:R=-1,textureType:M=Zr.NoTexture})=>{const D=H(pn),k=H(z0),N=H(bQ),U=H(xs),W=Fc(t),{gl:{domElement:F}}=ti(),[E,L]=g.useState(!1),[j,Y]=g.useState(0),[O,_]=g.useState(0),[G,Q]=g.useState(null),oe=g.useRef(null),ee=g.useRef(null),$=H(Te=>{for(const Re of Te.elements)if(Re.id===P)return Re}),ae=new ue,Z=new cn;if(($==null?void 0:$.type)===z.Cuboid){const{pos:Te,rot:Re}=ye.getWorldDataById($.id);ae.copy(Te),Z.set(0,0,Re)}const ne=$?Math.max(1,Math.max($.lx,$.ly)/24):1,te=$8*ne,q=Tm*ne,le=Kt(),de=(Te,Re)=>{D(Ne=>{for(const _e of Ne.elements)if(_e.type===z.Polygon&&_e.id===Te){_e.selectedIndex=Re;break}})},he=g.useMemo(()=>{const Te=new Array;if($){switch($.type){case z.Foundation:{for(const Ne of S)Te.push({x:Ne.x*$.lx,y:Ne.y*$.ly});break}case z.Wall:{for(const Ne of S)Te.push({x:Ne.x*$.lx,y:Ne.y*$.lz});break}case z.Cuboid:{const Ne=new ue().fromArray(r);let _e,Ue;ye.isUnitVectorX(Ne)?(_e=$.lz,Ue=$.ly):ye.isUnitVectorY(Ne)?(_e=$.lx,Ue=$.lz):(_e=$.lx,Ue=$.ly);for(const qe of S)Te.push({x:qe.x*_e,y:qe.y*Ue});break}}const Re=ye.calculatePolygonCentroid(Te);Y(Re.x),_(Re.y)}return Te},[S,$,r]),ce=(()=>{if(($==null?void 0:$.type)===z.Cuboid){const Te=ye.isIdentical(r,fs);return ae.z+($.lz+(Te?0:e))/2+.01}return($==null?void 0:$.type)===z.Foundation?$.lz+.01:e/2+.01})(),pe=(()=>{if(($==null?void 0:$.type)===z.Wall)return new cn(-$t,0,Math.PI,"ZXY");const Te=new ue().fromArray(r);let Re=o[2];return($==null?void 0:$.type)===z.Cuboid&&(Re=Z.z),ye.isSame(Te,b1)?new cn(0,$t,Re,"ZXY"):ye.isSame(Te,S1)?new cn(0,-$t,Re,"ZXY"):ye.isSame(Te,Zc)?new cn(-$t,0,Re,"ZXY"):ye.isSame(Te,T1)?new cn($t,0,Re,"ZXY"):new cn(0,0,Re,"ZXY")})(),ve=(()=>{if($){if($.type===z.Cuboid){const Te=new ue(ae.x,ae.y,ce),Re=new ue().fromArray(r);let Ne=!1;const _e=new ue;return ye.isSame(Re,b1)?(Ne=!0,_e.x=$.lx/2+.01):ye.isSame(Re,S1)?(Ne=!0,_e.x=-$.lx/2-.01):ye.isSame(Re,Zc)?(Ne=!0,_e.y=$.ly/2+.01):ye.isSame(Re,T1)&&(Ne=!0,_e.y=-$.ly/2-.01),Ne&&(_e.applyEuler(Z),Te.x=ae.x+_e.x,Te.y=ae.y+_e.y,Te.z=ae.z+_e.z),Te}else if($.type===z.Wall)return new ue(0,-.01,0)}return new ue(($==null?void 0:$.cx)??0,($==null?void 0:$.cy)??0,ce)})(),ze=g.useMemo(()=>{const Te=new Array;for(const Re of he)Te.push(new ue(Re.x,Re.y,0));return Te.push(new ue(he[0].x,he[0].y,0)),Te},[he]),Ae=g.useMemo(()=>{const Te=new jl;Te.moveTo(he[0].x,he[0].y);for(let Re=1;Re{Te.intersections.length>0&&Te.intersections[0].object===Te.eventObject&&(Q(Re),Re===Ho.Default?F.style.cursor="move":F.style.cursor="pointer")},[]),ge=g.useCallback(()=>{Q(null),F.style.cursor="default"},[]),we=Te=>{switch(Te){case Zr.Texture01:return{x:1,y:1};case Zr.Texture02:return{x:2,y:2};case Zr.Texture03:return{x:.4,y:.4};case Zr.Texture04:return{x:.25,y:.25};case Zr.Texture05:return{x:5,y:5};case Zr.Texture06:return{x:1,y:1};case Zr.Texture07:return{x:1,y:1};case Zr.Texture08:return{x:2,y:2};case Zr.Texture09:return{x:2,y:2};case Zr.Texture10:return{x:4,y:4};default:return{x:1,y:1}}},Se=g.useMemo(()=>{let Te;switch(M){case Zr.Texture01:Te=Dot;break;case Zr.Texture02:Te=Eot;break;case Zr.Texture03:Te=kot;break;case Zr.Texture04:Te=Fot;break;case Zr.Texture05:Te=Lot;break;case Zr.Texture06:Te=Wot;break;case Zr.Texture07:Te=Not;break;case Zr.Texture08:Te=chn;break;case Zr.Texture09:Te=uhn;break;case Zr.Texture10:Te=dhn;break;default:Te=Gg}return new Qg().load(Te,Re=>{const Ne=we(M);Re.wrapT=Re.wrapS=es,Re.repeat.set(1/Ne.x,1/Ne.y);const _e=new ue().fromArray(r);ye.isSame(_e,b1)?Re.rotation=$t:ye.isSame(_e,S1)?Re.rotation=-$t:ye.isSame(_e,T1)&&(Re.rotation=Math.PI),Ce(Re)})},[M,r]),[Me,Ce]=g.useState(Se);return h.jsxs("group",{name:"Polygon Group "+t,rotation:pe,position:ve,children:[n&&h.jsxs("mesh",{uuid:t,ref:oe,receiveShadow:U,castShadow:!1,name:z.Polygon,onPointerDown:Te=>{Te.button!==2&&N===z.None&&k(t,Te)},onContextMenu:Te=>{k(t,Te,er.ContextMenu),D(Re=>{Te.intersections.length>0&&Te.intersections[0].object===oe.current&&(Te.intersections.length>1&&Re.pastePoint.copy(Te.intersections[1].point),Re.contextMenuObjectType=z.Polygon)})},onPointerOver:Te=>{Te.intersections.length>0&&Te.intersections[0].object===oe.current&&L(!0)},onPointerOut:()=>{L(!1),F.style.cursor="default"},children:[h.jsx("shapeGeometry",{attach:"geometry",args:[Ae]}),T===void 0||T===0?h.jsx("meshStandardMaterial",{attach:"material",color:M===Zr.NoTexture?i:"white",map:Me,side:zr,transparent:v<1,opacity:v}):h.jsx("meshPhongMaterial",{attach:"material",color:M===Zr.NoTexture?i:"white",map:Me,side:$i,specular:new ir("white"),shininess:T,transparent:v<1,opacity:v})]}),l&&h.jsx(Nbt,{fontSize:s,scale:[1,1,1],color:c,position:[j,O,.01],rotation:[0,0,($==null?void 0:$.type)===z.Wall?Math.PI:0],anchorX:"center",anchorY:"middle",outlineWidth:u,outlineColor:d,strokeWidth:f,strokeColor:p,children:l}),(!b||x&&W)&&h.jsx(On,{points:ze,color:x&&W?i0:y,lineWidth:w,dashed:m&&m!==Ap.Solid,dashSize:m===Ap.Dashed?.3:.1,gapSize:.1,uuid:t,receiveShadow:!1,castShadow:!1,name:"Polygon Wireframe",onPointerDown:Te=>{Te.button!==2&&k(t,Te)},onContextMenu:Te=>{N===z.None&&(k(t,Te,er.ContextMenu),D(Re=>{if(Te.intersections.length>0){const Ne=Te.intersections[0].object;Ne.name==="Polygon Wireframe"&&Ne.uuid===t&&(Re.contextMenuObjectType=z.Polygon)}}))}}),!n&&h.jsx(On,{position:[0,0,.1],points:ze,visible:!1,lineWidth:Math.min(w*10,10),receiveShadow:!1,castShadow:!1,uuid:t,name:"Polygon Enlarged Line",onPointerDown:Te=>{Te.button!==2&&k(t,Te)},onContextMenu:Te=>{N===z.None&&(k(t,Te,er.ContextMenu),D(Re=>{if(Te.intersections.length>0){const Ne=Te.intersections[0].object;Ne.name==="Polygon Enlarged Line"&&Ne.uuid===t&&(Re.contextMenuObjectType=z.Polygon)}}))}}),W&&!x&&h.jsx(Ys,{ref:ee,position:[j,O,0],args:[q,6,6],name:Ho.Default,onPointerDown:Te=>{Te.button!==2&&(k(t,Te,er.Move),jn.getState().setEnableOrbitController(!1),dt.getState().set(Re=>{Re.showWallIntersectionPlaneId=P,Re.oldParentId=P,Re.oldFoundationId=A}),D(Re=>{Re.moveHandleType=Ho.Default}))},onPointerOver:Te=>{se(Te,Ho.Default)},onPointerOut:ge,children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),W&&!x&&he.map((Te,Re)=>h.jsxs(xe.Fragment,{children:[h.jsx(di,{userData:{vertexIndex:Re},position:[Te.x,Te.y,0],name:xt.Default,args:[te,te,e/2+(n?0:.1)],onPointerDown:Ne=>{Ne.button!==2&&(k(t,Ne,er.Resize),de(t,Re),jn.getState().setEnableOrbitController(!1),dt.getState().set(_e=>{_e.showWallIntersectionPlaneId=P,_e.oldParentId=P,_e.oldFoundationId=A}),D(_e=>{_e.resizeHandleType=xt.Default}))},onPointerOver:Ne=>{se(Ne,xt.Default),de(t,Re)},onPointerOut:ge,onContextMenu:Ne=>{D(_e=>{if(Ne.intersections.length>0){const Ue=Ne.intersections[0].object.userData.vertexIndex;Ue!==void 0&&(_e.contextMenuObjectType=z.PolygonVertex,de(t,Ue))}})},children:h.jsx("meshBasicMaterial",{attach:"material",color:(G===xt.Default||H.getState().resizeHandleType===xt.Default)&&R===Re?Aa:ll})}),h.jsx("textSprite",{name:"Label "+Re,text:""+Re,fontSize:20*ne,fontFace:"Times Roman",textHeight:.2*ne,position:[Te.x,Te.y,.2*ne]})]},"resize-handle-"+Re)),(E||C)&&!W&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(a??B.t("shared.PolygonElement",le))+(x?" ("+B.t("shared.ElementLocked",le)+")":""),fontSize:20*ne,fontFace:"Times Roman",textHeight:.2*ne,position:[0,0,e+.2]})]})},K3e={display:!1,color:"white",textureType:Jo.NoTexture,parapetHeight:1,copingsWidth:.5,copingsHeight:.1},fhn=({args:t,wallData:e,parapetZ:n,currWallPointData:o,leftWallPointData:r,rightWallPointData:i})=>{const{display:a,color:l,textureType:s,parapetHeight:c,copingsWidth:u,copingsHeight:d}=t,{id:f,cx:p,cy:m,hx:y,hy:w,angle:x}=e,C=c-d,P=Pot(s),A=g.useMemo(()=>{const W=new ue(-y,w-u/2),F=new ue(y,w-u/2),E=new ue(y,w+u/2),L=new ue(-y,w+u/2),j=[W,F,E,L];if(i||r){const Y=gMe(o);if(i&&L_(o.rightPoint,i.leftPoint)){const O=M(Y,i);O&&(F.copy(O.outerIntersection),E.copy(O.innerIntersection))}if(r&&L_(o.leftPoint,r.rightPoint)){const O=M(Y,r);O&&(W.copy(O.outerIntersection),L.copy(O.innerIntersection))}}return j},[y,w,u,o,r,i]),S=g.useMemo(()=>{const W=new jl,F=new ue(-y,w*2),E=new ue(y,w*2);if(i||r){const L=EJ(o,o.ly);if(i&&L_(o.rightPoint,i.leftPoint)){const j=D(L,i);j&&E.copy(j)}if(r&&L_(o.leftPoint,r.rightPoint)){const j=D(L,r);j&&F.copy(j)}}return W.moveTo(-y,0),W.lineTo(y,0),W.lineTo(E.x,E.y),W.lineTo(F.x,F.y),W.closePath(),W},[y,w,o,r,i]),v=g.useMemo(()=>{const W=new jl;if(u===0)return W;const[F,E,L,j]=A;return W.moveTo(F.x,F.y),W.lineTo(E.x,E.y),W.lineTo(L.x,L.y),W.lineTo(j.x,j.y),W.closePath(),W},[u,A]),b=g.useMemo(()=>A.map(W=>W.toArray()),[A]),T=g.useMemo(()=>[new ue(-y,0,0),new ue(y,0,0)],[y]),R=g.useMemo(()=>[new ue,new ue(0,0,C)],[C]);function M(W,F){const E=gMe(F),L=Kse(W.outerPoints.leftPoint,W.outerPoints.rightPoint,E.outerPoints.leftPoint,E.outerPoints.rightPoint);if(!L)return null;const j=Kse(W.innerPoints.leftPoint,W.innerPoints.rightPoint,E.innerPoints.leftPoint,E.innerPoints.rightPoint);return j?{innerIntersection:new ue().subVectors(j,new ue(p,m)).applyEuler(new cn(0,0,-x)),outerIntersection:new ue().subVectors(L,new ue(p,m)).applyEuler(new cn(0,0,-x))}:null}function D(W,F){const E=EJ(F,F.ly),L=Kse(W.leftPoint,W.rightPoint,E.leftPoint,E.rightPoint);return L?new ue().subVectors(L,new ue(p,m)).applyEuler(new cn(0,0,-x)):null}function k(){return!(H.getState().moveHandleType||H.getState().resizeHandleType||H.getState().isAddingElement())}function N(W){W.button!==2&&W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&k()&&H.getState().selectMe(f,W,er.Select,!0)}function U(W){H.getState().selectMe(f,W,er.ContextMenu,!0),H.getState().set(F=>{W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&(F.contextMenuObjectType=z.Wall)})}return a?h.jsxs("group",{name:"Wall Parapet Group",position:[0,0,n],onContextMenu:U,onPointerDown:N,children:[h.jsx(Q8,{name:"Body Extrude Mesh",args:[S,{steps:1,depth:C,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l,map:P})}),h.jsx(On,{position:[y,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(On,{position:[-y,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(On,{position:[0,0,C],points:T,color:"black",lineWidth:.2}),h.jsx(Q8,{name:"Copings Extrude Mesh",position:[0,0,C],args:[v,{steps:1,depth:d,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l})}),h.jsx(On,{position:[0,0,C+d],points:b,color:"black",lineWidth:.2}),h.jsx(On,{position:[0,0,C],points:b,color:"black",lineWidth:.2})]}):null};function gMe(t){const e=(t.ly+t.copingsWidth)/2,n=(t.ly-t.copingsWidth)/2;return{innerPoints:EJ(t,e),outerPoints:EJ(t,n)}}function EJ(t,e){const{leftPoint:n,rightPoint:o}=t,r=new ue().fromArray(n),i=new ue().fromArray(o),l=new ue().subVectors(i,r).applyEuler(new cn(0,0,$t)).normalize().clone().multiplyScalar(e);return{leftPoint:r.clone().add(l),rightPoint:i.clone().add(l)}}function L_(t,e){return Math.abs(t[0]-e[0]){const{id:n,lx:o,lz:r}=t,i=H($3),a=H(Y5),l=H(J3),s=H(K3),c=In(PS),u=dt(n6),d=g.useRef(0),f=g.useRef(),p=g.useMemo(()=>{if(!u||e)return;const m=c.get(n);if(!m)return;const y=m.reduce((j,Y)=>j+Y,0),w=t.fill===Ul.Partial&&!ye.isPartialWallFull(t),x=ye.getWallVertices(t,0),C=w?ye.getPartialWallVertices(t,0):x,P=ye.getPolygonArea(x);let A=w?ye.getPolygonArea(C):P;if(A===0)return;const S=i(z.Window,n),v=i(z.Door,n);if(S&&S.length>0)for(const j of S)A-=ye.getWindowArea(j,t);if(v&&v.length>0)for(const j of v)A-=j.lx*j.lz*t.lx*t.lz;const b=H.getState().world,T=X3*(b.solarRadiationHeatmapGridCellSize??.5),R=ye.getHighestPointOfWall(t),M=Math.max(2,Math.round(o/T)),D=Math.max(2,Math.round(R/T)),k=o/M,N=R/D,U=(R-t.lz)/2,W=y/A*(a??Ny);d.current=W<0?1:0,f.current=ye.getEuler(Oo,Zc,"YXZ",Math.sign(W)*$t);const F=[],E=w?ye.getPartialWallVertices(t,0):ye.getWallVertices(t,0);let L;for(let j=0;j0)for(const Q of S){if(Q.type!==z.Window)continue;const oe=Q.cx*t.lx,ee=Q.cz*t.lz,$=Q.lx*t.lx/2,ae=Q.lz*t.lz/2;if(Q.windowType===Ti.Arched){if(_>=oe-$&&_=ee-ae&&G=oe-$&&_=ee-ae&&G0)for(const Q of v){const oe=Q.cx*o,ee=Q.cz*R,$=Q.lx*o/2,ae=Q.lz*R/2;if(_>=oe-$&&_=ee-ae&&Gh.jsxs(xe.Fragment,{children:[h.jsx(On,{points:m,name:"Heat Flux "+y,lineWidth:s??Uy,color:l??Fu}),h.jsx(Rf,{userData:{unintersectable:!0},position:m[d.current].clone().add(new ue(0,d.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:f.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:l??Fu})})]},y))}):null},ghn=xe.memo(phn),$se="Wall Block Plane",mhn="Wall Intersection Plane",fC=.1,yhn=xe.memo(({transparent:t,color:e,opacity:n})=>{const r=H(I7).z<=0;return h.jsx("meshStandardMaterial",{color:t?e:"white",transparent:t,opacity:n,side:r?js:zr})}),Ahn=({wallModel:t,foundationModel:e})=>{var tn,Gt,wn,Cn,Wn,Un;const{id:n,cx:o,cy:r,lx:i=1,ly:a=.5,lz:l=5,relativeAngle:s,leftJoints:c,rightJoints:u,textureType:d,color:f="white",lineColor:p="black",lineWidth:m=.2,parentId:y,locked:w=!1,roofId:x,leftRoofHeight:C,rightRoofHeight:P,centerRoofHeight:A,centerLeftRoofHeight:S,centerRightRoofHeight:v,wallStructure:b=Tc.Default,structureSpacing:T=2,structureWidth:R=.1,structureColor:M="white",opacity:D=.5,fill:k=Ul.Full,leftUnfilledHeight:N=.5,rightUnfilledHeight:U=.5,leftTopPartialHeight:W=l,rightTopPartialHeight:F=l,parapet:E=K3e,leftPoint:L,rightPoint:j}=t,Y=c.length>0?C:l,O=u.length>0?P:l,_=Pot(d),G=Fc(n),Q=H(pn),oe=H(HS),ee=H(z0),$=H(Fn),ae=H(b5e),Z=In(O1),ne=H(M7),te=H(xs),q=H(S5e),le=H(RJe),de=H(Df),he=dt(kf),me=dt(vs),ce=dt(rt=>rt.elementBeingCanceledId),Pe=dt(rt=>rt.showWallIntersectionPlaneId),[pe,Ie]=g.useState(!1),[ve,ze]=g.useState(null),{camera:Ae,gl:se}=ti(),{elementsOnWall:ge,leftWall:we,rightWall:Se}=ydn(n,c[0],u[0]),Me=Cot(e),Ce=g.useRef(null),Te=g.useRef(null),Re=g.useRef(null),Ne=g.useRef(null),_e=g.useRef(null),Ue=g.useRef(null),qe=g.useRef(null),Fe=g.useRef(null),He=i/2,Le=a/2,Ye=l/2,lt=Me?Me.rotation[2]+s:s,Oe=ye.getInnerWallOffset(we,i,a,s,"left"),ut=ye.getInnerWallOffset(Se,i,a,s,"right"),ht=b===Tc.Stud||b===Tc.Pillar,Qe=Y??l,nt=O??l,mt=k===Ul.Partial,tt=mt?N:0,gt=mt?U:0,Ve=mt?Math.min(Qe,W):Qe,je=mt?Math.min(nt,F):nt,et=mt&&(!ye.isZero(Qe-Ve)||!ye.isZero(nt-je)),bt=te&&!ht,St=E.display,Pt=Math.max(Ve,je)-Ye,Yt=g.useMemo(()=>new _t,[]),zt=g.useMemo(()=>new yu,[]),Rt=g.useMemo(()=>new vf({color:"white",side:zr,transparent:ht,opacity:D}),[ht,D]),Ct=g.useMemo(()=>ye.getHighestPointOfWall(t),[t.lz,t.leftRoofHeight,t.rightRoofHeight,t.centerRoofHeight,t.centerLeftRoofHeight,t.centerRightRoofHeight]),yt=g.useMemo(()=>{const rt=new jl;return ct(rt,i,l,0,0,0,0),ge.forEach(vt=>{if(vt.type===z.Window&&vt.id!==qe.current&&vt.lx>0&&vt.lz>0){const Nt=vt,Ft=new jl,[en,sn,dn,En]=[vt.lx*i,vt.lz*l,vt.cx*i,vt.cz*l];if(Nt.windowType)switch(Nt.windowType){case Ti.Arched:fo(Ft,en,sn,dn,En,Nt.archHeight);break;case Ti.Polygonal:{const[xn,Tn]=Nt.polygonTop??P1;to(Ft,en,sn,dn,En,xn*en,Tn);break}case Ti.Default:default:Pn(Ft,en,sn,dn,En)}else Pn(Ft,en,sn,dn,En);rt.holes.push(Ft)}}),rt},[i,l,k,N,U,Ve,je,ge,Y,O,A,S,v]),at=g.useMemo(()=>{const rt=new jl,vt=l,Nt=l/2;if(mt)rt.moveTo(-He+Oe,-Nt+N),rt.lineTo(He-ut,-Nt+U);else{rt.moveTo(-He+Oe,-Nt);const Ft=ge.filter(en=>en.type===z.Door).sort((en,sn)=>en.cx-sn.cx);for(const en of Ft)if(en.id!==qe.current){const[sn,dn,En,xn]=[en.cx*i,en.cz*vt,en.lx*i,en.lz*vt];if(en.doorType===Wd.Default)rt.lineTo(sn-En/2,-Nt),rt.lineTo(sn-En/2,-Nt+xn),rt.lineTo(sn+En/2,-Nt+xn),rt.lineTo(sn+En/2,-Nt);else{const Tn=Math.min(en.archHeight,xn,En/2);if(rt.lineTo(sn-En/2,-Nt),Tn>.1){rt.lineTo(sn-En/2,-Nt+xn/2-Tn);const _n=Tn/2+En**2/(8*Tn),[Vn,Gn]=[sn,dn+xn/2-_n],go=Math.acos(Math.min(En/2/_n,1)),qo=Math.PI-go;rt.absarc(Vn,Gn,_n,qo,go,!0)}else rt.lineTo(sn-En/2,-Nt+xn),rt.lineTo(sn+En/2,-Nt+xn);rt.lineTo(sn+En/2,-Nt)}}rt.lineTo(He-ut,-Nt)}if(et){const Ft=je-Ve,en=(i-ut)*Ft/i,sn=Oe*Ft/i;rt.lineTo(He-ut,-Nt+Ve+en),rt.lineTo(-He+Oe,-Nt+Ve+sn)}else x?(O?rt.lineTo(He-ut,O-Nt):rt.lineTo(He-ut,Nt),v&&rt.lineTo(v[0]*i,v[1]-Nt),A&&rt.lineTo(A[0]*i,A[1]-Nt),S&&rt.lineTo(S[0]*i,S[1]-Nt),Y?rt.lineTo(-He+Oe,Y-Nt):rt.lineTo(-He+Oe,Nt)):(rt.lineTo(He-ut,Nt),rt.lineTo(-He+Oe,Nt));return rt.closePath(),ge.forEach(Ft=>{if(Ft.type===z.Window&&Ft.id!==qe.current&&Ft.lx>0&&Ft.lz>0){const en=Ft,sn=new jl,[dn,En,xn,Tn]=[Ft.lx*i,Ft.lz*l,Ft.cx*i,Ft.cz*l];if(en.windowType)switch(en.windowType){case Ti.Arched:fo(sn,dn,En,xn,Tn,en.archHeight);break;case Ti.Polygonal:{const[_n,Vn]=en.polygonTop??P1;to(sn,dn,En,xn,Tn,_n*dn,Vn);break}case Ti.Default:default:Pn(sn,dn,En,xn,Tn);break}else Pn(sn,dn,En,xn,Tn);rt.holes.push(sn)}}),rt},[i,l,k,N,U,Ve,je,Oe,ut,ge,x,Y,O,A,S,v]),Et=g.useMemo(()=>mt?(Ve+je)/2-Ye:Ye,[Ye,mt,Ve,je]),Lt=g.useMemo(()=>{const rt=je-Ve;return!mt||Math.abs(rt)<.01?0:Math.atan2(rt,i)},[i,mt,Ve,je]),Je=g.useMemo(()=>{const rt=new jl;if(!mt||Math.abs(Lt)<1e-4)return rn(rt,i,a,Oe,ut),rt;{const vt=i/2,Nt=a/2,Ft=Math.cos(Lt),en=vt/Ft,sn=(vt-Oe)/Ft,dn=(vt-ut)/Ft;return rt.moveTo(-en,-Nt),rt.lineTo(en,-Nt),rt.lineTo(dn,Nt),rt.lineTo(-sn,Nt),rt.closePath(),rt}},[i,a,Oe,ut,mt,Lt]),st=g.useMemo(()=>{const rt=[],vt=i/2,Nt=l/2;return mt?(rt.push({x:-vt+Oe,y:-Nt+tt}),rt.push({x:vt-ut,y:-Nt+gt})):(rt.push({x:-vt,y:-Nt}),rt.push({x:vt,y:-Nt})),et?(rt.push({x:vt-ut,y:-Nt+je}),rt.push({x:-vt+Oe,y:-Nt+Ve})):(O?rt.push({x:vt,y:O-Nt}):rt.push({x:vt,y:Nt}),v&&rt.push({x:v[0]*i,y:v[1]-Nt}),A&&rt.push({x:A[0]*i,y:A[1]-Nt}),S&&rt.push({x:S[0]*i,y:S[1]-Nt}),Y?rt.push({x:-vt,y:Y-Nt}):rt.push({x:-vt,y:Nt})),rt},[i,l,k,tt,gt,Ve,je,Y,O,A,S,v]),It=g.useMemo(()=>{const rt=[];let vt=0,Nt=0;if(k===Ul.Partial&&(vt=(U-N)/i,Nt=N+He*vt),b===Tc.Stud){let Ft=-He+R/2;for(;Ft<=He;)rt.push([Ft,vt*Ft+Nt]),Ft+=T;Ft=He-R/2,rt.push([Ft,vt*Ft+Nt])}else if(b===Tc.Pillar){let Ft=-He;for(;Ft<=He;)rt.push([Ft,vt*Ft+Nt]),Ft+=T;rt.push([He,vt*He+Nt])}return rt},[b,R,T,i,a,l,N,U]),ot=g.useMemo(()=>({id:n,parentId:y,cx:o,cy:r,hx:He,hy:Le,angle:s,selected:G}),[n,y,o,r,He,Le,s,G]),it=g.useMemo(()=>({leftPoint:L,rightPoint:j,ly:a,copingsWidth:E.copingsWidth}),[L,j,a,E.copingsWidth]),Be=g.useMemo(()=>!we||!we.parapet||!we.parapet.display?null:{leftPoint:we.leftPoint,rightPoint:we.rightPoint,ly:we.ly,copingsWidth:we.parapet.copingsWidth},[we==null?void 0:we.leftPoint,we==null?void 0:we.rightPoint,we==null?void 0:we.ly,(tn=we==null?void 0:we.parapet)==null?void 0:tn.copingsWidth,(Gt=we==null?void 0:we.parapet)==null?void 0:Gt.display]),pt=g.useMemo(()=>!Se||!Se.parapet||!Se.parapet.display?null:{leftPoint:Se.leftPoint,rightPoint:Se.rightPoint,ly:Se.ly,copingsWidth:Se.parapet.copingsWidth},[Se==null?void 0:Se.leftPoint,Se==null?void 0:Se.rightPoint,Se==null?void 0:Se.ly,(wn=Se==null?void 0:Se.parapet)==null?void 0:wn.copingsWidth,(Cn=Se==null?void 0:Se.parapet)==null?void 0:Cn.display]);g.useEffect(()=>{Fe.current&&Fe.current.id===ce&&(Fe.current=null,wo())},[ce]),g.useEffect(()=>{if(t&&me){const rt=Z(t.id);if(rt){const vt=ye.fetchHeatmapTexture(rt,de??5);if(vt){vt.wrapS=es,vt.wrapT=es;const Nt=l===Ct?0:(1-l/Ct)/2;vt.offset.set(-i/2,-Ct/2-Nt),vt.center.set(i/2,Ct/2),vt.repeat.set(1/i,1/Ct),ze(vt)}}}},[me,de]),g.useEffect(()=>{x&&(q.has(x)||le.has(x))&&H.getState().set(rt=>{const vt=new Set;for(const Nt of rt.elements)if(Nt.id===n&&Nt.type===z.Wall){const Ft=Nt;if(Ft.roofId=null,Ft.leftRoofHeight=void 0,Ft.rightRoofHeight=void 0,Ft.centerRoofHeight=void 0,Ft.centerLeftRoofHeight=void 0,Ft.centerRightRoofHeight=void 0,ge.length>0){const en=Rn.getWallPoints2D(Ft);ge.forEach(sn=>{if(sn.type===z.Polygon)return;const dn=sn.type===z.Door,En=sn.type===z.SolarPanel,xn=En?sn.lx-.01:sn.lx*i,Tn=En?sn.ly-.01:sn.lz*l,_n=new ue(sn.cx*i,0,sn.cz*l);ye.isElementInsideWall(_n,xn,Tn,en,dn)||(vt.add(sn.id),rt.autoDeletedChild?rt.autoDeletedChild.push(sn):rt.autoDeletedChild=[sn])})}break}vt.size>0?rt.elements=rt.elements.filter(Nt=>!vt.has(Nt.id)):rt.autoDeletedChild===null&&(rt.autoDeletedChild=[])})},[x,q,le]);function ct(rt,vt,Nt,Ft=0,en=0,sn=0,dn=0,En=!0){const xn=vt/2,Tn=Nt/2;if(mt?rt.moveTo(Ft-xn+sn,en-Tn+N):rt.moveTo(Ft-xn+sn,en-Tn),En){const _n=ge.filter(Vn=>Vn.type===z.Door).sort((Vn,Gn)=>Vn.cx-Gn.cx);for(const Vn of _n)if(Vn.id!==qe.current){const[Gn,go,qo,Xr]=[Vn.cx*vt,Vn.cz*Nt,Vn.lx*vt,Vn.lz*l];if(Vn.doorType===Wd.Default)rt.lineTo(Ft+Gn-qo/2,en-Tn),rt.lineTo(Ft+Gn-qo/2,en-Tn+Xr),rt.lineTo(Ft+Gn+qo/2,en-Tn+Xr),rt.lineTo(Ft+Gn+qo/2,en-Tn);else{const qr=Math.min(Vn.archHeight,Xr,qo/2);if(rt.lineTo(Ft+Gn-qo/2,en-Tn),qr>.1){rt.lineTo(Ft+Gn-qo/2,en-Tn+Xr/2-qr);const na=qr/2+qo**2/(8*qr),[k0,Gh]=[Gn,en+go+Xr/2-na],cc=Math.acos(Math.min(qo/2/na,1)),wu=Math.PI-cc;rt.absarc(k0,Gh,na,wu,cc,!0)}else rt.lineTo(Ft+Gn-qo/2,en-Tn+Xr),rt.lineTo(Ft+Gn+qo/2,en-Tn+Xr);rt.lineTo(Ft+Gn+qo/2,en-Tn)}}}mt?rt.lineTo(Ft+xn-dn,en-Tn+U):rt.lineTo(Ft+xn-dn,en-Tn),et?(rt.lineTo(Ft+xn-dn,en-Tn+je),rt.lineTo(Ft-xn+sn,en-Tn+Ve)):x?(O?rt.lineTo(Ft+xn-dn,O-Tn):rt.lineTo(Ft+xn-dn,en+Tn),v&&rt.lineTo(v[0]*vt,v[1]-Tn),A&&rt.lineTo(A[0]*vt,A[1]-Tn),S&&rt.lineTo(S[0]*vt,S[1]-Tn),Y?rt.lineTo(Ft-xn+sn,Y-Tn):rt.lineTo(Ft-xn+sn,en+Tn)):(rt.lineTo(Ft+xn-dn,en+Tn),rt.lineTo(Ft-xn+sn,en+Tn)),rt.closePath()}function Xe(rt,vt){const{cx:Nt,cy:Ft,cz:en}=vt;if(Me&<!==void 0){const sn=ye.wallAbsolutePosition(new ue(Nt,Ft,en),Me).setZ(l/2+Me.lz);return new ue().subVectors(rt,sn).applyEuler(new cn(0,0,-lt))}return new ue}function ft(rt){const vt=[];for(let Nt=-1;Nt<=1;Nt+=2)for(let Ft=-1;Ft<=1;Ft+=2){const[en,sn]=[Nt,Nt*Ft];switch(rt.type){case z.Window:{const[dn,En]=[rt.cx*i,rt.cz*l],[xn,Tn]=[rt.lx*i/2,rt.lz*l/2],_n=dn+en*xn,Vn=En+sn*Tn;vt.push({x:_n,y:Vn});break}case z.Door:{const[dn,En]=[rt.cx*i,rt.cz*l],[xn,Tn]=[rt.lx*i/2,rt.lz*l/2],_n=dn+en*xn,Vn=En+sn*Tn;vt.push({x:_n,y:Vn});break}case z.SolarPanel:{const[dn,En]=[rt.cx*i,rt.cz*l],[xn,Tn]=[rt.lx/2,rt.ly/2],_n=dn+en*xn,Vn=En+sn*Tn;vt.push({x:_n,y:Vn})}}}if(rt.type===z.Window&&rt.windowType===Ti.Polygonal){const Nt=rt,[Ft,en]=Nt.polygonTop??[0,0];vt.push({x:rt.cx*i+Ft*rt.lx*i,y:rt.cz*l+rt.lz*l/2+en})}return vt}function wt(rt,vt=0){if(!mt)return ye.getWallVertices(rt,vt);const Nt=rt.lx/2,Ft=rt.lz/2,en={x:-Nt-vt,y:rt.leftUnfilledHeight-Ft-vt},sn={x:Nt+vt,y:rt.rightUnfilledHeight-Ft-vt},dn={x:-Nt-vt,y:rt.leftTopPartialHeight-Ft+vt},En={x:Nt+vt,y:rt.rightTopPartialHeight-Ft+vt},xn=[];return xn.push(dn,en,sn,En),et||(rt.centerRightRoofHeight&&xn.push({x:rt.centerRightRoofHeight[0]*rt.lx,y:rt.centerRightRoofHeight[1]-Ft+vt}),rt.centerRoofHeight&&xn.push({x:rt.centerRoofHeight[0]*rt.lx,y:rt.centerRoofHeight[1]-Ft+vt}),rt.centerLeftRoofHeight&&xn.push({x:rt.centerLeftRoofHeight[0]*rt.lx,y:rt.centerLeftRoofHeight[1]-Ft+vt})),xn}function kt(rt,vt,Nt,Ft,en){if(Nt<.1||Ft<.1||Nt>i||!x&&Ft>l)return qe.current=rt,!1;const sn=.1;Nt+=sn,Ft+=sn;for(const dn of ge){if(dn.id===rt||dn.type===z.Polygon)continue;const En=ft(dn),xn=[];for(let Tn=-1;Tn<=1;Tn+=2)for(let _n=-1;_n<=1;_n+=2){const Vn=vt.x+Tn*Nt/2,Gn=vt.z+Tn*_n*Ft/2;if(xn.push({x:Vn,y:Gn}),ye.isPointInside(Vn,Gn,En))return qe.current=rt,!1}if(en){const[Tn,_n]=en,Vn=vt.x+Tn*Nt,Gn=vt.z+Ft/2+_n;if(xn.push({x:Vn,y:Gn}),ye.isPointInside(Vn,Gn,En))return qe.current=rt,!1}for(const Tn of En)if(ye.isPointInside(Tn.x,Tn.y,xn))return qe.current=rt,!1}return qe.current=null,!0}function Zt(rt,vt,Nt,Ft,en){return ye.isElementInsideWall(vt,Nt,Ft,st,en)?!0:(qe.current=rt,!1)}function Ot(rt,vt,Nt,Ft){const[en,sn]=Ft,dn=rt.x+vt*en,En=rt.z+Nt/2+sn;return ye.isPointInside(dn,En,wt(t,0))}function on(rt){Yt.x=rt.offsetX/se.domElement.clientWidth*2-1,Yt.y=-(rt.offsetY/se.domElement.clientHeight)*2+1,zt.setFromCamera(Yt,Ae)}function qt(rt){return!(rt.button===2||H.getState().addedWallId||Ue.current||H.getState().moveHandleType||H.getState().resizeHandleType||H.getState().objectTypeToAdd!==z.None||G||ae())}function rn(rt,vt,Nt,Ft,en){const sn=vt/2,dn=Nt/2;rt.moveTo(-sn,-dn),rt.lineTo(sn,-dn),rt.lineTo(sn-en,dn),rt.lineTo(-sn+Ft,dn),rt.closePath()}function Pn(rt,vt,Nt,Ft=0,en=0){const sn=vt/2,dn=Nt/2;rt.moveTo(Ft-sn,en-dn),rt.lineTo(Ft+sn,en-dn),rt.lineTo(Ft+sn,en+dn),rt.lineTo(Ft-sn,en+dn),rt.closePath()}function fo(rt,vt,Nt,Ft,en,sn=0){const dn=vt/2,En=Nt/2,xn=Math.min(sn,Nt,dn);if(rt.moveTo(Ft-dn,en-En),rt.lineTo(Ft+dn,en-En),rt.lineTo(Ft+dn,en+En-xn),xn>0){const Tn=xn/2+vt**2/(8*xn),[_n,Vn]=[Ft,en+En-Tn],Gn=Math.acos(Math.min(1,dn/Tn)),go=Math.PI-Gn;rt.absarc(_n,Vn,Tn,Gn,go,!1)}else rt.lineTo(Ft-dn,en+En);rt.closePath()}function to(rt,vt,Nt,Ft,en,sn,dn){const[En,xn]=[vt/2,Nt/2];rt.moveTo(Ft-En,en-xn),rt.lineTo(Ft+En,en-xn),rt.lineTo(Ft+En,en+xn),rt.lineTo(Ft+sn,en+xn+dn),rt.lineTo(Ft-En,en+xn),rt.closePath()}function Dt(rt){const vt=parseFloat((Math.round(rt.x/yA)*yA).toFixed(1)),Nt=parseFloat((Math.round(rt.z/yA)*yA).toFixed(1));return new ue(vt,rt.y,Nt)}function fn(rt){const vt=parseFloat((Math.round(rt.x/r3)*r3).toFixed(1)),Nt=parseFloat((Math.round(rt.z/r3)*r3).toFixed(1));return new ue(vt,rt.y,Nt)}function kn(rt){return H.getState().enableFineGrid?rt=fn(rt):rt=Dt(rt),rt}function yo(rt,vt,Nt,Ft,en){H.getState().set(sn=>{for(const dn of sn.elements)if(dn.id===rt){if([dn.cx,dn.cy,dn.cz]=vt,[dn.lx,dn.ly,dn.lz]=Nt,Ft!==void 0&&(dn.type===z.Window||dn.type===z.Door)&&(dn.archHeight=Ft),en!==void 0&&dn.type===z.Window){const En=dn;En.windowType===Ti.Polygonal&&(En.polygonTop=[...en])}break}})}function ur(rt){return rt.type===z.Window&&rt.windowType===Ti.Polygonal&&rt.polygonTop}function lr(rt){const vt={name:"Add",timestamp:Date.now(),addedElement:rt,undo:()=>{H.getState().removeElementById(rt.id,!1)},redo:()=>{H.getState().set(Nt=>{Nt.elements.push(vt.addedElement),Nt.selectedElement=vt.addedElement,Nt.deletedRoofId=null})}};$(vt)}function xo(){const rt=H.getState().selectedElement;if(!rt)return;const vt=H.getState().getElementById(rt.id);if(vt)switch(vt.type){case z.Door:case z.Window:case z.SolarPanel:{const Nt={name:`Resize ${vt.type}`,timestamp:Date.now(),resizedElementId:vt.id,resizedElementType:vt.type,oldPosition:[rt.cx,rt.cy,rt.cz],oldDimension:[rt.lx,rt.ly,rt.lz],newPosition:[vt.cx,vt.cy,vt.cz],newDimension:[vt.lx,vt.ly,vt.lz],oldArchHeight:rt.type===z.Window||rt.type===z.Door?rt.archHeight:void 0,newArchHeight:vt.type===z.Window||vt.type===z.Door?vt.archHeight:void 0,oldPolygonTop:ur(rt)?[...rt.polygonTop]:void 0,newPolygonTop:ur(vt)?[...vt.polygonTop]:void 0,undo(){yo(this.resizedElementId,this.oldPosition,this.oldDimension,this.oldArchHeight,this.oldPolygonTop)},redo(){yo(this.resizedElementId,this.newPosition,this.newDimension,this.newArchHeight,this.newPolygonTop)}};$(Nt);break}case z.Polygon:{const Nt=rt,Ft=vt,en={name:"Edit Polygon",timestamp:Date.now(),oldValue:[...Nt.vertices],newValue:[...Ft.vertices],changedElementId:Ft.id,changedElementType:Ft.type,undo(){ne(this.changedElementId,this.oldValue)},redo(){ne(this.changedElementId,this.newValue)}};$(en);break}}}function wo(){H.getState().set(rt=>{rt.addedWindowId=null,rt.addedDoorId=null})}function Rr(rt){return rt===z.Window||rt===z.Door}function Eo(rt,vt){const Nt=O0.getIntersectionObjects(rt);return Nt.length>0&&Nt[0].object.name===`${O0.WALL_OUTSIDE_SURFACE_MESH_NAME} ${vt}`}function An(rt){return rt.intersections.length>0&&rt.intersections[0].object===rt.eventObject}function Dn(rt,vt,Nt){if(H.getState().moveHandleType&&vt&&sr(vt)&&vt.parentId!==rt){const Ft=Nt.intersections.filter(sn=>sn.eventObject.name.includes(O0.WALL_OUTSIDE_SURFACE_MESH_NAME)||sn.eventObject.name.includes(Upe)||sn.eventObject.name===$se);if(!(Ft.length>0&&(Ft[0].eventObject.name===$se||Ft[0].eventObject.name.includes(Upe))))return!0}return!1}function sr(rt){if(!rt)return!1;switch(rt.type){case z.Window:case z.Door:case z.SolarPanel:case z.Light:case z.Sensor:return!0}return!1}function Vo(rt){if(H.getState().resizeHandleType!==xt.Arch)return!1;if(rt.type===z.Window){const vt=rt;return vt.windowType===Ti.Arched&&vt.archHeight!==void 0}if(rt.type===z.Door){const vt=rt;return vt.doorType===Wd.Arched&&vt.archHeight!==void 0}}function Wo(rt,vt){const Nt=rt.getPoints().map(Ft=>({x:Ft.x,y:Ft.y}));return!ye.isPointInside(vt.x,vt.y,Nt)}function To(rt,vt,Nt,Ft,en,sn=!1){const dn=new ue().subVectors(vt,rt).normalize(),[En,xn]=sn?[vt.y,rt.y]:[rt.y,vt.y];let Tn;if(En(Tn.type===z.Wall&&Tn.parentId===y&&xn.set(Tn.id,Tn),xn),new Map);let Ft=!1,en=0;const sn={lng:H.getState().language},dn=t;let En=dn;for(;En&&En.rightJoints.length>0;){en++;const xn=Nt.get(En.rightJoints[0]);if(!xn)break;if(vt&&xn.lz!==dn.lz)return co(B.t("message.WallsAreNotAtSameHeight",sn)),!1;if(xn.id===dn.id){Ft=!0;break}if(En=xn,en>100)break}return Ft?!0:(co(B.t("message.WallsAreNotConnected",sn)),!1)}function vo(){return Fe.current&&Fe.current.status===0&&H.getState().moveHandleType===Ho.Mid}function bo(){return!(H.getState().moveHandleType||H.getState().resizeHandleType||ae())}function Bo(){return et||N!==U||W!==F?!1:x?Y!==O?!1:!(A!==void 0||S!==void 0||v!==void 0):!0}function Pr(rt,vt,Nt){var En;on(rt);const en=((En=(vt?zt.intersectObjects([vt]):rt.intersections)[0])==null?void 0:En.point)??rt.point,sn=Xe(en,t),dn=Nt?kn(sn.clone().add(Nt)).sub(Nt):kn(sn);return{relativePointer:sn,pointerOnGrid:dn}}function so(rt,vt){if(!Ce.current)return null;const{pointerOnGrid:Nt}=Pr(rt,Ce.current),Ft=Nt.x/t.lx,en=Nt.z/t.lz;return vt===z.Window?Qa.makeWindow(t,Ft,0,en,z.Wall):vt===z.Door?Qa.makeDoor(t):null}function zo(rt){rt&&(Fe.current={id:rt.id,type:rt.type,status:0}),Q(vt=>{rt&&(vt.elements.push(rt),vt.selectedElement=rt,vt.selectedElementIdSet.clear(),vt.selectedElementIdSet.add(rt.id),rt.type===z.Window?vt.addedWindowId=rt.id:rt.type===z.Door&&(vt.addedDoorId=rt.id)),vt.moveHandleType=Ho.Mid,vt.objectTypeToAdd=z.None})}function Ci(rt){if(!rt)return;const{id:vt,type:Nt}=rt;Q(Ft=>{Ft.elements=Ft.elements.filter(en=>en.id!==vt),Ft.selectedElement=null,Ft.moveHandleType=null,Ft.objectTypeToAdd=Nt,Ft.addedWindowId=null,Ft.addedDoorId=null}),Fe.current=null}function ea(rt){if(!rt)return[0,0];switch(rt.type){case z.Window:{const vt=dt.getState().oldParentId;if(rt.parentId!==vt){const Nt=H.getState().elements.find(Ft=>Ft.id===vt);return Nt?[rt.lx*Nt.lx/2,rt.lz*Nt.lz/2]:[0,0]}else return[rt.lx*i/2,rt.lz*l/2]}case z.Door:return[rt.lx*i/2,rt.lz*l/2];case z.SolarPanel:return[rt.lx/2,rt.ly/2]}return[fC,fC]}function rs(){const rt=[];if(A){const vt=A[0];if(vt===.5&&Y!==void 0)return rt.push(new ue(He,A[1]-Ye),new ue(-He,Y-Ye)),rt;if(vt===-.5&&O!==void 0)return rt.push(new ue(He,O-Ye),new ue(-He,A[1]-Ye)),rt}return O!==void 0?rt.push(new ue(He,O-Ye)):rt.push(new ue(He,Ye)),v!==void 0&&rt.push(new ue(v[0]*i,v[1]-Ye)),A!==void 0&&rt.push(new ue(A[0]*i,A[1]-Ye)),S!==void 0&&rt.push(new ue(S[0]*i,S[1]-Ye)),Y!==void 0?rt.push(new ue(-He,Y-Ye)):rt.push(new ue(-He,Ye)),rt}function Da(rt,vt){const Nt=vt==null?void 0:vt.ignorePadding,Ft=vt!=null&&vt.elementHalfSize?[...vt.elementHalfSize]:[0,0],en=Nt?0:fC,sn=Nt?0:fC+Oe,dn=Nt?0:fC+ut,[En,xn]=Ft,[Tn,_n,Vn,Gn]=[-He+En+sn,He-En-dn,-Ye+xn+en,Ye-xn-en],go=rt.clone();if(Bo()){const qo=mt?N:0,Xr=l-(mt?Ve:l);return go.setX(ye.clamp(rt.x,Tn,_n)),go.setZ(ye.clamp(rt.z,Vn+qo,Gn-Xr)),go}else{const qo=cr(En,xn,Tn,_n,en),Xr=new _t(rt.x,rt.z);let qr=1/0,na=-1/0;if(vt!=null&&vt.resizeAnchor){const cc=vt.resizeAnchor.x,wu=[];if(et)wu.push(new ue(-He,-Ye+Ve),new ue(He,-Ye+je));else{const Wc=rs().reverse();wu.push(...Wc)}for(let Wc=1;Wc=ju.x&&cc<=Qp.x){const K1=(Qp.y-ju.y)/(Qp.x-ju.x),a0=-K1*ju.x+ju.y;qr=K1*cc+a0;break}}const ps=new ue(-He,-Ye+tt),ud=new ue(He,-Ye+gt),Mm=(ud.y-ps.y)/(ud.x-ps.x),Xh=-Mm*ps.x+ps.y;na=Mm*cc+Xh}const k0=Xr.y>qr;if(Wo(qo,Xr)){const cc=Go(qo,Xr);go.setX(cc.x),go.setZ(ye.clamp(cc.y,na+en,qr-en))}else k0&&go.setZ(qr-en)}return go.setZ(Math.max(Vn,go.z)),go}function or(rt,vt){Q(Nt=>{const Ft=Nt.elements.find(en=>en.id===rt);if(Ft)switch(Ft.type){case z.Window:{Ft.cx=vt.x/i,Ft.cz=vt.z/l,Ft.cy=Ft.id===qe.current?-.01:.3,Ft.tint=Ft.id===qe.current?"red":Nt.selectedElement.tint;break}case z.Door:{const en=l/2;Ft.cx=vt.x/i,Ft.cz=(vt.z-en)/2/l,Ft.lz=(vt.z+en)/l;break}case z.SolarPanel:{Ft.cx=vt.x/i,Ft.cz=vt.z/l,Ft.color=Ft.id===qe.current?"red":"#fff";break}case z.Sensor:case z.Light:{Ft.cx=vt.x/i,Ft.cz=vt.z/l;break}case z.Polygon:{const en=Ft;if(en.vertices.length>0){const sn=ye.calculatePolygonCentroid(en.vertices),dn=-vt.x/i-sn.x,En=-vt.z/l-sn.y;Ft.vertices=en.vertices.map(xn=>({x:xn.x+dn,y:xn.y+En}))}break}}})}function cr(rt,vt,Nt,Ft,en){const sn=[],dn=new ue(-He,-Ye+tt),En=new ue(He,-Ye+gt);if(To(dn,En,rt,vt,en,!0),sn.push({start:new ue(Nt,Ye),end:new ue(Nt,dn.y)}),sn.push({start:dn.clone(),end:En.clone()}),sn.push({start:new ue(Ft,En.y),end:new ue(Ft,Ye)}),et){const Tn=new ue(He,-Ye+je),_n=new ue(-He,-Ye+Ve);To(Tn,_n,rt,vt,en),sn.push({start:Tn.clone(),end:_n.clone()})}else{const Tn=rs();for(let _n=1;_n{const en=Ft.elements.find(xn=>xn.id===(Nt==null?void 0:Nt.id));if(!en||en.type===z.SolarPanel&&en.parentType===void 0)return;if(en.type===z.Window){const xn=Ft.elements.find(Tn=>Tn.id===en.parentId);if(xn){const Tn=en.lx*xn.lx,_n=en.lz*xn.lz;en.lx=Tn/i,en.lz=_n/l}}const{pointerOnGrid:sn}=Pr(rt,Ce.current),dn=ea(en),En=Da(sn,{elementHalfSize:dn,ignorePadding:en.type===z.SolarPanel});kt(en.id,En,dn[0]*2,dn[1]*2),en.cx=En.x/i,en.cz=En.z/l,en.parentId=n,en.foundationId=y,Ft.selectedElement&&(Ft.selectedElement.parentId=n,Ft.selectedElement.foundationId=y),en.type===z.Window?(en.cy=en.id===qe.current?-.01:0,en.tint=en.id===qe.current?"red":Ft.selectedElement.tint):en.type===z.SolarPanel&&(en.color=en.id===qe.current?"red":"#fff",en.parentType=z.Wall)}),he("showWallIntersectionPlaneId",n))}else vo()&&Ci(Fe.current)}function xi(rt){if(rt.button!==2){if(vo()){jn.getState().setEnableOrbitController(!1),Ie(!0);const{pointerOnGrid:vt}=Pr(rt,Ce.current),Nt=Da(vt);Q(Ft=>{var en,sn;Ft.moveHandleType=null,((en=Fe.current)==null?void 0:en.type)===z.Window?(Ft.resizeHandleType=xt.LowerRight,Ft.resizeAnchor.copy(Nt)):((sn=Fe.current)==null?void 0:sn.type)===z.Door&&(Ft.resizeHandleType=xt.UpperRight,Ft.resizeAnchor.copy(Nt).setZ(-l/2))}),Fe.current.status=1}else if(An(rt))if(H.getState().objectTypeToAdd!==z.None){const Nt=rt.point;Ea(Nt,!0)}else H.getState().groupActionMode?(Q(Nt=>{for(const Ft of Nt.elements)Ft.selected=Ft.id===y;Nt.multiSelectionsMode||Nt.selectedElementIdSet.clear(),Nt.selectedElementIdSet.has(y)?Nt.selectedElementIdSet.delete(y):Nt.selectedElementIdSet.add(y)}),rt.stopPropagation()):bo()&&H.getState().selectMe(n,rt,er.Select)}}function Uu(){Fe.current&&Fe.current.status===0&&(Q(rt=>{rt.elements.pop(),rt.addedDoorId=null,rt.addedWindowId=null,rt.moveHandleType=null,rt.actionModeLock&&Fe.current&&(rt.objectTypeToAdd=Fe.current.type)}),Fe.current=null)}function _s(){vo()&&Ci(Fe.current),qe.current=null}function sc(rt){const vt=H.getState().selectedElement??oe();if((vt==null?void 0:vt.parentId)===t.id){if(H.getState().moveHandleType){const Nt=vt.type!==z.Polygon?new ue(-vt.lx/2*i,0,vt.lz/2*l):void 0,{pointerOnGrid:Ft}=Pr(rt,Ne.current,Nt),en=ea(vt),sn=Da(Ft,{elementHalfSize:en,ignorePadding:vt.type===z.SolarPanel}),[dn,En]=[en[0]*2,en[1]*2];if(vt.type!==z.SolarPanel&&Zt(vt.id,sn,dn,En),vt.type!==z.Polygon){let xn=!0,Tn;vt.type===z.Window&&vt.windowType===Ti.Polygonal&&(Tn=vt.polygonTop??P1,xn=Ot(sn,dn,En,Tn));const _n=kt(vt.id,sn,dn,En,Tn);xn&&_n?qe.current=null:qe.current=vt.id}or(vt.id,sn)}else if(H.getState().resizeHandleType){const{relativePointer:Nt,pointerOnGrid:Ft}=Pr(rt,Ne.current),en=H.getState().resizeHandleType,sn=H.getState().resizeAnchor;switch(vt.type){case z.Window:{const dn=vt,En=Da(Ft,{resizeAnchor:sn});if(Vo(dn)){const{newLz:xn,newCz:Tn,newArchHeight:_n}=ii(dn,En,sn),Vn=new ue(dn.cx*i,0,Tn);kt(dn.id,Vn,dn.lx*i,xn),Zt(dn.id,Vn,dn.lx*i,xn),Q(Gn=>{const go=Gn.elements.find(qo=>qo.id===dn.id);go&&(go.lz=xn/l,go.cz=Tn/l,go.archHeight=_n,go.cy=go.id===qe.current?-.01:.3,go.tint=go.id===qe.current?"red":dn.tint)})}else if(en===xt.Upper){const xn=new ue(dn.cx*i,0,dn.cz*l),[Tn,_n]=[dn.lx*i,dn.lz*l],Vn=ye.clamp((Ft.x-sn.x)/Tn,-.5,.5),Gn=Math.max(0,Ft.z-sn.z),go=[Vn,Gn];(!kt(dn.id,xn,Tn,_n,go)||!Ot(xn,Tn,_n,go))&&(qe.current=dn.id),Q(qo=>{const Xr=qo.elements.find(qr=>qr.id===dn.id);Xr&&(Xr.polygonTop=[...go],Xr.cy=Xr.id===qe.current?-.01:.3,Xr.tint=Xr.id===qe.current?"red":dn.tint)})}else{const{dimensionXZ:xn,positionXZ:Tn}=No(rt,En,sn),_n=new ue(Tn.x,0,Tn.z);let Vn=!0,Gn;dn.windowType===Ti.Polygonal&&(Gn=dn.polygonTop??P1,Vn=Ot(_n,xn.x,xn.z,Gn)),(!kt(dn.id,_n,xn.x,xn.z,Gn)||!Vn||!Zt(dn.id,_n,xn.x,xn.z))&&(qe.current=dn.id),Q(go=>{const qo=go.elements.find(Xr=>Xr.id===dn.id);qo&&(qo.lx=xn.x/i,qo.lz=xn.z/l,qo.cx=Tn.x/i,qo.cz=Tn.z/l,qo.cy=qo.id===qe.current?-.01:.3,qo.tint=qo.id===qe.current?"red":dn.tint)})}break}case z.Door:{const dn=vt,En=Da(Ft,{resizeAnchor:sn});if(Vo(dn)){const{newLz:xn,newCz:Tn,newArchHeight:_n}=ii(dn,En,sn),Vn=new ue(dn.cx*i,0,Tn);kt(dn.id,Vn,dn.lx*i,xn),Zt(dn.id,Vn,dn.lx*i,xn,!0),Q(Gn=>{const go=Gn.elements.find(qo=>qo.id===dn.id);go&&(go.lz=xn/l,go.cz=Tn/l,go.archHeight=_n,go.color=go.id===qe.current?kde:vt.color)})}else{const{dimensionXZ:xn,positionXZ:Tn}=No(rt,En,sn),_n=new ue(Tn.x,0,Tn.z);kt(dn.id,_n,xn.x,xn.z),Zt(dn.id,_n,xn.x,xn.z,!0),Q(Vn=>{const Gn=Vn.elements.find(go=>go.id===dn.id);Gn&&(Gn.cx=Tn.x/i,Gn.lx=xn.x/i,Gn.cz=(En.z-l/2)/2/l,Gn.lz=(En.z+l/2)/l,Gn.color=Gn.id===qe.current?kde:vt.color)})}break}case z.SolarPanel:{const dn=vt,[En,xn]=Ii.getSolarPanelUnitLength(dn);if(en===xt.Lower||en===xt.Upper){const _n=Math.max(1,Math.round(Math.abs(Nt.z-sn.z)/xn))*xn,Vn=new ue(0,0,Nt.z-sn.z).normalize().multiplyScalar(_n),Gn=new ue().addVectors(sn,Vn.clone().divideScalar(2));if(!ye.isElementInsideWall(Gn,dn.lx-.01,_n-.01,st))return;kt(dn.id,Gn,dn.lx,Math.abs(Vn.z)),Q(go=>{const qo=go.elements.find(Xr=>Xr.id===dn.id);qo&&(qo.cz=Gn.z/l,qo.ly=Math.abs(Vn.z),qo.color=qo.id===qe.current?"red":"#fff")})}else if(en===xt.Left||en===xt.Right){const _n=Math.max(1,Math.round(Math.abs(Nt.x-sn.x)/En))*En,Vn=new ue(Nt.x-sn.x,0,0).normalize().multiplyScalar(_n),Gn=new ue().addVectors(sn,Vn.clone().divideScalar(2));if(!ye.isElementInsideWall(Gn,_n-.01,dn.ly-.01,st))return;kt(dn.id,Gn,Math.abs(Vn.x),dn.ly),Q(go=>{const qo=go.elements.find(Xr=>Xr.id===dn.id);qo&&(qo.cx=Gn.x/i,qo.lx=Math.abs(Vn.x),qo.color=qo.id===qe.current?"red":"#fff")})}break}case z.Polygon:{Q(dn=>{const En=dn.elements.find(xn=>xn.id===vt.id);(En==null?void 0:En.selectedIndex)>=0&&(En.vertices[En.selectedIndex].x=-Ft.x/i,En.vertices[En.selectedIndex].y=-Ft.z/l)});break}}}}}function ta(){if(qe.current)Fe.current&&Fe.current.status===1?(Q(rt=>{rt.elements.pop(),rt.actionModeLock&&Fe.current&&(rt.objectTypeToAdd=Fe.current.type)}),Fe.current=null):(H.getState().moveHandleType||H.getState().resizeHandleType)&&O0.undoInvalidOperation();else if(Fe.current){if(Fe.current.status===0)Q(rt=>{rt.elements.pop(),rt.actionModeLock&&Fe.current&&(rt.objectTypeToAdd=Fe.current.type)}),Fe.current=null;else if(Fe.current.status===1){const rt=H.getState().elements,vt=rt[rt.length-1];vt.lx*i<.1||vt.lz*l<.1?Q(Nt=>{Nt.elements.pop(),Nt.actionModeLock&&Fe.current&&(Nt.objectTypeToAdd=Fe.current.type)}):(Q(Nt=>{Nt.actionModeLock&&Fe.current&&(Nt.objectTypeToAdd=Fe.current.type,xb.selectNone(Nt))}),lr(vt)),Fe.current=null}}else H.getState().moveHandleType?O0.addUndoableMove():H.getState().resizeHandleType&&xo();jn.getState().setEnableOrbitController(!0),Ie(!1),Q(rt=>{rt.moveHandleType=null,rt.resizeHandleType=null,rt.selectedElement=rt.elements.find(vt=>{var Nt;return vt.id===((Nt=rt.selectedElement)==null?void 0:Nt.id)})}),he("showWallIntersectionPlaneId",null),qe.current=null,wo()}function Ea(rt,vt){if(Me&&H.getState().objectTypeToAdd){let Nt=null;switch(H.getState().objectTypeToAdd){case z.PyramidRoof:{!x&&ho(!1,!0)&&(Nt=Qa.makePyramidRoof([t.id],Me));break}case z.GableRoof:{!x&&ho(!1,!1)&&(Nt=Qa.makeGableRoof([t.id],Me));break}case z.HipRoof:{!x&&ho(!1,!0)&&(Nt=Qa.makeHipRoof([t.id],Me,i/2));break}case z.GambrelRoof:{!x&&ho(!1,!1)&&(Nt=Qa.makeGambrelRoof([t.id],Me));break}case z.MansardRoof:{!x&&ho(!1,!0)&&(Nt=Qa.makeMansardRoof([t.id],Me));break}case z.SolarPanel:{if(rt&&vt){const Ft=Xe(rt,t),en=H.getState().actionState;let sn=H.getState().getPvModule(H.getState().actionState.solarPanelModelName??g3);sn||(sn=H.getState().getPvModule(g3)),Nt=Qa.makeSolarPanel(t,sn,Ft.x/i,0,Ft.z/l,en.solarPanelOrientation??br.landscape,en.solarPanelPoleHeight??1,en.solarPanelPoleSpacing??3,0,0,new ue(0,-1,0),[$t,0,0],en.solarPanelFrameColor)}break}case z.Sensor:{if(rt&&vt){const Ft=Xe(rt,t),en=t.relativeAngle-$t;Nt=Qa.makeSensor(t,(Ft.x-.05)/i,0,(Ft.z-.05)/l,new ue(Math.cos(en),Math.sin(en),0),[0,0,0])}break}case z.Light:{if(rt&&vt){const Ft=Xe(rt,t),en=t.relativeAngle-$t,sn=H.getState().actionState;Nt=Qa.makeLight(t,2,sn.lightDistance,sn.lightIntensity,sn.lightColor,(Ft.x-.05)/i,0,(Ft.z-.05)/l,new ue(Math.cos(en),Math.sin(en),0),[0,0,0])}break}}Nt&&(lr(Nt),Q(Ft=>{Nt&&(Ft.elements.push(Nt),Ft.selectedElementIdSet.clear(),Ft.selectedElementIdSet.add(Nt.id),Ft.selectedElement=Nt,Nt&&Nt.type===z.Roof&&Ft.addedRoofIdSet.add(Nt.id),Ft.actionModeLock||(Ft.objectTypeToAdd=z.None))}))}}function Cs(rt,vt,Nt){_e.current||(ee(n,rt,er.ContextMenu),Q(Ft=>{rt.intersections.length>0&&rt.intersections[0].object===vt&&(Ft.contextMenuObjectType=z.Wall,Nt&&Ft.pastePoint.copy(rt.intersections[0].point))}),rt.stopPropagation())}function El(rt){if(rt.button===2)return;const vt=H.getState().objectTypeToAdd;!vo()&&!ae()&&An(rt)&&vt===z.None?H.getState().groupActionMode?(Q(Nt=>{for(const Ft of Nt.elements)Ft.selected=Ft.id===y}),rt.stopPropagation()):bo()&&H.getState().selectMe(n,rt,er.Select):Rn.isTypeRoof(vt)&&xi(rt)}function Vs(rt){rt.button===2||rt.intersections.length===0||rt.intersections[0].object!==rt.eventObject||(H.getState().groupActionMode?Q(vt=>{for(const Nt of vt.elements)Nt.selected=Nt.id===y;vt.selectedElementIdSet.clear(),vt.selectedElementIdSet.add(y)}):(qt(rt)&&(Q(vt=>{vt.contextMenuObjectType=null}),ee(n,rt,er.Select)),Ea(),rt.stopPropagation()))}function Rs(rt){rt.intersections.length>0&&rt.intersections[0].object===rt.eventObject&&(ee(n,rt,er.ContextMenu),Q(vt=>{vt.contextMenuObjectType=z.Wall}),rt.stopPropagation())}function qp(){const[rt,vt]=A??[0,(Ve+je)/2],Nt=rt*i,Ft=Nt+He,en=Math.hypot(Ft,vt-Ve),sn=-Math.atan2(vt-Ve,Ft),dn=He-Nt,En=Math.hypot(dn,je-vt),xn=-Math.atan2(je-vt,dn);return h.jsxs("group",{name:`wall stud group ${n}`,children:[It.map(([Tn,_n],Vn)=>{let Gn;return Tn{let go;return _n0||b===Tc.Default)&&h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{name:"Wall Simulation Mesh",uuid:n,userData:{simulation:!0},rotation:[$t,0,0],castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[yt]}),h.jsx("meshBasicMaterial",{side:zr})]}),h.jsxs("mesh",{name:`${O0.WALL_OUTSIDE_SURFACE_MESH_NAME} ${n}`,ref:Ce,rotation:[$t,0,0],castShadow:bt,receiveShadow:te,onContextMenu:rt=>{Cs(rt,Ce.current,!0)},onPointerMove:Ga,onPointerDown:xi,onPointerUp:Uu,onPointerOut:_s,children:[h.jsx("shapeGeometry",{args:[yt]}),me&&ve?h.jsx("meshBasicMaterial",{attach:"material",map:ve,color:"white",opacity:D,transparent:ht}):h.jsx("meshStandardMaterial",{attach:"material",color:d===Jo.Default||d===Jo.NoTexture?f:"white",map:_,transparent:ht,opacity:D})]}),h.jsxs("mesh",{rotation:[$t,0,0],position:[0,.05,0],castShadow:bt,children:[h.jsx("shapeGeometry",{args:[at]}),h.jsx("meshStandardMaterial",{color:"white",side:js,transparent:ht,opacity:D})]}),h.jsxs("mesh",{name:"Inside Wall",ref:Te,position:[0,a,0],rotation:[$t,0,0],castShadow:bt,receiveShadow:te,onPointerDown:El,onContextMenu:rt=>{Cs(rt,Te.current)},children:[h.jsx("shapeGeometry",{args:[at]}),h.jsx(yhn,{transparent:ht,color:f,opacity:D})]}),h.jsxs("mesh",{rotation:[$t,0,0],position:[0,a-.01,0],receiveShadow:!0,children:[h.jsx("shapeGeometry",{args:[at]}),h.jsx("meshStandardMaterial",{color:"white",side:$i,transparent:ht,opacity:D})]}),(!x||et)&&!St&&h.jsx("mesh",{name:"Top Wall",ref:Re,material:Rt,position:[0,Le,Et],rotation:[0,-Lt,0],castShadow:bt,receiveShadow:te,onPointerDown:El,onContextMenu:rt=>{Cs(rt,Re.current)},children:h.jsx("shapeGeometry",{args:[Je]})}),Oe===0&&h.jsx(yi,{args:[Ve-tt,a],material:Rt,position:[-He+.01,Le,-Ye+tt+(Ve-tt)/2],rotation:[0,$t,0],castShadow:bt,receiveShadow:te,onPointerDown:El}),ut===0&&h.jsx(yi,{args:[je-gt,a],material:Rt,position:[He-.01,Le,-Ye+gt+(je-gt)/2],rotation:[0,$t,0],castShadow:bt,receiveShadow:te,onPointerDown:El}),(pe||Pe===n)&&((Wn=H.getState().selectedElement)==null?void 0:Wn.parentId)===n&&h.jsxs(h.Fragment,{children:[h.jsx(yi,{ref:Ne,name:mhn,args:[1e4,1e4],position:[0,a/3,0],rotation:[$t,0,0],onPointerMove:sc,onPointerUp:ta,visible:!1,children:h.jsx("meshBasicMaterial",{color:"blue",side:zr})}),h.jsx(yi,{name:$se,args:[i,l],rotation:[$t,0,0],position:[0,a,0],onPointerMove:()=>{},visible:!1})]}),ge.map(rt=>{switch(rt.type){case z.Window:return h.jsx(nrt,{...rt,cx:rt.cx*i,cy:rt.cy*a,cz:rt.cz*l,lx:rt.lx*i,ly:a,lz:rt.lz*l},rt.id);case z.Door:return k!==Ul.Full?null:h.jsx(shn,{...rt,cx:rt.cx*i,cy:0,cz:rt.cz*l,lx:rt.lx*i,ly:a,lz:rt.lz*l},rt.id);default:return null}})]}),ge.map(rt=>rt.type===z.Polygon&&k!==Ul.Empty?h.jsx(xrt,{...rt},rt.id):null),b===Tc.Stud&&qp(),b===Tc.Pillar&&gn(),St&&h.jsx(hhn,{args:E,wallData:ot,parapetZ:Pt,currWallPointData:it,leftWallPointData:Be,rightWallPointData:pt}),(b===Tc.Default||w&&G)&&h.jsx(Qfn,{lineColor:G&&w?i0:p,lineWidth:G&&w?2:m,hx:He,hz:Ye,fill:k,isTopPartial:et,leftUnfilledHeight:N,rightUnfilledHeight:U,showParapet:St,leftHeight:Ve,rightHeight:je,center:A,centerLeft:S,centerRight:v}),G&&h.jsx(B3e,{element:t,verticalLift:0}),(pe||Pe===n)&&((Un=H.getState().selectedElement)==null?void 0:Un.parentId)===n&&h.jsx("group",{position:[0,-.001,0],rotation:[$t,0,0],children:h.jsx(C5e,{hx:He,hy:Ye,hz:0})}),h.jsx(ghn,{wallModel:t,notBuilding:Me.notBuilding})]})},whn=(t,e)=>t.wallModel===e.wallModel,xhn=xe.memo(Ahn,whn);class Rn{static getWireframeStyle(e,n,o,r){return[o&&r?i0:e,o&&r?1:n]}static getComposedWallNormal(e){return new ue().subVectors(e.leftPoint,e.rightPoint).applyEuler(kX).normalize()}static getWallNormal(e){return new ue().subVectors(new ue(e.leftPoint[0],e.leftPoint[1]),new ue(e.rightPoint[0],e.rightPoint[1])).applyEuler(kX).normalize()}static isTypeRoof(e){return e===z.Roof||e===z.PyramidRoof||e===z.HipRoof||e===z.GableRoof||e===z.GambrelRoof||e===z.MansardRoof}static getIntersectionPoint(e,n,o,r){if(Math.abs(e.x-n.x)<.001&&Math.abs(o.x-r.x)<.001)return n.clone();const i=(n.y-e.y)/(n.x-e.x),a=(r.y-o.y)/(r.x-o.x);if(Math.abs(i-a)<.001)return n.clone();const l=[e.x,n.x,o.x,r.x],s=[e.y,n.y,o.y,r.y],c=((l[2]-l[3])*(l[1]*s[0]-l[0]*s[1])-(l[0]-l[1])*(l[3]*s[2]-l[2]*s[3]))/((l[2]-l[3])*(s[0]-s[1])-(l[0]-l[1])*(s[2]-s[3])),u=((s[2]-s[3])*(s[1]*l[0]-s[0]*l[1])-(s[0]-s[1])*(s[3]*l[2]-s[2]*l[3]))/((s[2]-s[3])*(l[0]-l[1])-(s[0]-s[1])*(l[2]-l[3]));return!Number.isFinite(c)||!Number.isFinite(u)?n.clone():new ue(c,u)}static getDistance(e,n,o){const r=n.y-e.y;if(r===0)return Math.abs(e.y-o.y);const i=e.x-n.x;if(i===0)return Math.abs(e.x-o.x);const a=n.x*e.y-e.x*n.y,l=Math.abs((r*o.x+i*o.y+a)/Math.sqrt(r*r+i*i));return l===0?1/0:l}static getWallPoints2D(e,n,o,r){const{lx:i,lz:a,rightRoofHeight:l,leftRoofHeight:s}=e,c=o??e.centerLeftRoofHeight,u=n??e.centerRoofHeight,d=r??e.centerRightRoofHeight,f=[],p=i/2,m=a/2;return f.push({x:-p,y:-m}),f.push({x:p,y:-m}),l?f.push({x:p,y:l-m}):f.push({x:p,y:m}),d&&f.push({x:d[0]*i,y:d[1]-m}),u&&f.push({x:u[0]*i,y:u[1]-m}),c&&f.push({x:c[0]*i,y:c[1]-m}),s?f.push({x:-p,y:s-m}):f.push({x:-p,y:m}),f}static isPointInside(e,n,o){let r=!1;for(let i=0,a=e.length-1;io!=u>o&&n<(c-l)*(o-s)/(u-s)+l&&(r=!r)}return r}static isRoofValid(e,n,o,r,i,a){for(const l of H.getState().elements)if(l.type===z.Wall&&l.roofId===e){const s=l;let c=[];if(s.id===n)c=Rn.getWallPoints2D(s,r,i,a);else if(s.id===o){let u,d,f;r&&(u=[-r[0],r[1]]),a&&(d=[-a[0],a[1]]),i&&(f=[-i[0],i[1]]),c=Rn.getWallPoints2D(s,u,d,f)}if(s.id===n||s.id===o){for(const u of H.getState().elements)if(u.parentId===s.id){let d=u.lx/2,f=u.lz/2,p=fC;u.type===z.SolarPanel&&(d=(d-.01)/s.lx,f=(u.ly/2-.01)/s.lz,p=0);const m=u.cx*s.lx-d*s.lx,y=u.cx*s.lx+d*s.lx,w=u.cz*s.lz+f*s.lz+p;if(!Rn.isPointInside(c,m,w)||!Rn.isPointInside(c,y,w))return!1}}}return!0}static getSegmentIdx(e,n){for(let o=0;oi.z){const u=[l,a,r];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}else{const u=[l,a,i];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else if(s<=c){const u=[l,a,i];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else{const u=[l,a,r];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}}static getSegmentNormal(e){const[n,o,r]=e;return new ue().crossVectors(new ue().subVectors(n,o),new ue().subVectors(n,r)).normalize()}static getRotationFromNormal(e){return ye.isSame(e.normalize(),Oo)?[0,0,0]:[Math.PI/2-Math.atan2(e.z,Math.hypot(e.x,e.y)),0,Math.atan2(e.y,e.x)+Math.PI/2]}static getRooftopElementZ(e,n,o){const[r,i,a]=e,l=(i.y-r.y)*(a.z-r.z)-(i.z-r.z)*(a.y-r.y),s=(i.z-r.z)*(a.x-r.x)-(i.x-r.x)*(a.z-r.z),c=(i.x-r.x)*(a.y-r.y)-(i.y-r.y)*(a.x-r.x);return-(-(l*r.x+s*r.y+c*r.z)+l*n.x+s*n.y)/c+o}static computeState(e,n,o){const r=Rn.getSegmentIdx(e,n);if(o)return{segmentIdx:-1,segmentVertices:null,normal:new ue(0,0,1),rotation:[0,0,0]};if(r!==-1){const i=Rn.getSegmentVertices(e,r,n),a=Rn.getSegmentNormal(i),l=Rn.getRotationFromNormal(a);return{segmentIdx:r,segmentVertices:i,normal:a,rotation:l}}else return{segmentIdx:-1,segmentVertices:null,normal:new ue(0,0,1),rotation:[0,0,0]}}static getOrderedWallArrayOfRoof(e){const n=new Map;for(const a of H.getState().elements)a.type===z.Wall&&a.roofId===e&&n.set(a.id,a);if(n.size===0)return{orderedWallArray:[],isLoop:!1};const o=n.entries().next().value[1],r=[o];let i=o.rightJoints[0];for(;i&&i!==o.id;){const a=n.get(i);if(a)r.push(a),i=a.rightJoints[0];else break}if(i===o.id)return{orderedWallArray:r,isLoop:!0};for(i=o.leftJoints[0];i;){const a=n.get(i);if(a)r.unshift(a),i=a.leftJoints[0];else break}return{orderedWallArray:r,isLoop:!1}}static getRoofBoundaryVertices(e){const n=In.getState().roofSegmentVerticesMap.get(e.id);if(!n)throw new Error;if(e.roofType!==Zo.Gable&&e.rise<.01)return n[0].map(o=>({x:o.x,y:o.y}));switch(e.roofType){case Zo.Gable:return n.length===1?n[0].map(o=>({x:o.x,y:o.y})):n.reduce((o,r)=>(o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Zo.Gambrel:return n.reduce((o,r,i)=>((i===0||i===3)&&o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Zo.Mansard:return n.reduce((o,r,i)=>(i!==n.length-1&&o.push({x:r[0].x,y:r[0].y}),o),[]);default:return n.reduce((o,r,i)=>(o.push({x:r[0].x,y:r[0].y}),o),[])}}static getAbsoluteWindowVerticesOnRoof(e,n){const o=[],r=new ue(e.cx,e.cy,e.cz),i=new ue(n.cx,n.cy,n.lz);if(e.windowType===Ti.Arched){const a=Math.min(e.archHeight,e.lx/2,e.lz);for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=s*c>0?new ue(e.lx/2*s,(e.lz/2-a)*c*s,0):new ue(e.lx/2*s,e.lz/2*c*s,0);u.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),u.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(u)}const l=new ue(0,e.lz/2,0);l.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),l.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(l)}else{for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new ue(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}if(e.windowType===Ti.Polygonal&&e.polygonTop){const a=new ue(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);a.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),a.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(a)}}return o}static getRelativeWindowVerticesOnRoof(e){const n=[],o=new ue(e.cx,e.cy,e.cz);if(e.windowType===Ti.Arched){const r=Math.min(e.archHeight,e.lx/2,e.lz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=a*l>0?new ue(e.lx/2*a,(e.lz/2-r)*l*a,0):new ue(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(s)}const i=new ue(0,e.lz/2,0);i.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(i)}else{for(let r=-1;r<=1;r+=2)for(let i=-1;i<=1;i+=2){const a=new ue(e.lx/2*r,e.lz/2*i*r,0);a.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(a)}if(e.windowType===Ti.Polygonal&&e.polygonTop){const r=new ue(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);r.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(r)}}return n}static getAbsoluteSolarPanelVerticesOnRoof(e,n){const o=[],r=new ue(e.cx,e.cy,e.cz),i=new ue(n.cx,n.cy,n.cz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new ue(e.lx/2*a,e.ly/2*l*a,0);e.rotation[0]===0?s.applyEuler(new cn(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):s.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new cn(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}return o}static getElementVerticesOnRoof(e,n){return e.type===z.SolarPanel?Rn.getSolarPanelVerticesOnRoof(e,n):e.type===z.SolarWaterHeater?Rn.getSolarWaterHeaterVerticesOnRoof(e,n):[]}static getSolarPanelVerticesOnRoof(e,n){const o=[],r=new ue(e.cx,e.cy,e.cz+n.cz);for(let i=-1;i<=1;i+=2)for(let a=-1;a<=1;a+=2){const l=new ue(e.lx/2*i,e.ly/2*a*i,0);e.rotation[0]===0?l.applyEuler(new cn(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):l.applyEuler(new cn(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),o.push(l)}return o}static getSolarWaterHeaterVerticesOnRoof(e,n){const o=[],{lx:r,ly:i,lz:a,waterTankRadius:l,relativeAzimuth:s}=e,c=a-l*2,u=Math.asin(Math.min(1,(c+l)/i)),d=i*Math.cos(u),f=i/2+l,p=new ue(e.cx,e.cy,e.cz+n.cz),m=new cn(0,0,s,"ZXY");return o.push(new ue(-r/2,f).applyEuler(m).add(p)),o.push(new ue(-r/2,f-d).applyEuler(m).add(p)),o.push(new ue(r/2,f-d).applyEuler(m).add(p)),o.push(new ue(r/2,f).applyEuler(m).add(p)),o}static getWindowVerticesOnRoof(e,n=0){const o=[],r=new ue(e.cx,e.cy,e.cz),[i,a]=[e.lx/2+n,e.lz/2+n];for(let l=-1;l<=1;l+=2)for(let s=-1;s<=1;s+=2){const c=new ue(l*i,l*s*a);c.applyEuler(new cn().fromArray([e.rotation[0],e.rotation[1],e.rotation[2],"ZXY"])).add(r),o.push(c)}if(e.windowType===Ti.Polygonal){const[l,s]=e.polygonTop??P1,c=new ue(l*e.lx,e.lz+s).add(r);o.push(c)}return o}static rooftopElementBoundaryCheck(e,n){for(const o of e)if(!ye.isPointInside(o.x,o.y,n))return!1;return!0}static rooftopWindowCollisionCheck(e,n,o){const r=[];for(const i of H.getState().elements)if(i.parentId===o&&i.id!==e){const a=Rn.getWindowVerticesOnRoof(i);r.push(a)}for(const i of r){for(const a of n)if(ye.isPointInside(a.x,a.y,i))return!1;for(const a of i)if(ye.isPointInside(a.x,a.y,n))return!1}return!0}static rooftopElementCollisionCheck(e,n,o){for(const r of H.getState().elements)if((r.type===z.SolarPanel||r.type===z.SolarWaterHeater)&&r.parentId===e.parentId&&r.id!==e.id){const i=Rn.getElementVerticesOnRoof(r,n);for(const s of o)if(ye.isPointInside(s.x,s.y,i))return!1;for(const s of i)if(ye.isPointInside(s.x,s.y,o))return!1;const a=o.map(ye.mapVector3ToPoint2),l=i.map(ye.mapVector3ToPoint2);a.push(a[0]),l.push(l[0]);for(let s=0;s0){for(const i of r)if(!i.leftJoints||i.leftJoints.length===0||!i.rightJoints||i.rightJoints.length===0)return $c.WALL_DISJOINED}return $c.COMPLETE}static calculateBuildingArea(e){const n=jo.getWallPointsOfRoof(e);return jo.getPolygonArea(n)}static toUValueInUS(e){return e/5.67826}static toUValueInSI(e){return e*5.67826}static toRValueInUS(e){return e*5.67826}static toRValueInSI(e){return e/5.67826}static fetchWaterTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");if(r){const i=r.createRadialGradient(e/2,n/2,0,e/2,n/2,Math.max(e,n)/2);i.addColorStop(0,"#45AAEA"),i.addColorStop(.04,"#2B65EC"),i.addColorStop(.2,"#0000FF"),r.fillStyle=i,r.fillRect(0,0,e,n)}return new o3(o)}static fetchWhiteTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");return r&&(r.fillStyle="white",r.fillRect(0,0,e,n)),new o3(o)}static fetchIntersectables(e){const n=[];return e.traverse(o=>{o.userData.unintersectable||n.push(o)}),n}static fetchSimulationElements(e,n){if(e.userData.simulation&&n.push(e),e.children.length>0)for(const o of e.children)jo.fetchSimulationElements(o,n)}static getSimulationElements(e,n,o){if(e.userData.simulation&&e.uuid!==o&&n.push(e),e.children.length>0)for(const r of e.children)jo.getSimulationElements(r,n,o)}static hasMovingParts(e){for(const n of e)switch(n.type){case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:return!0;case z.SolarPanel:if(n.trackerType!==Bl.NO_TRACKER)return!0}return!1}static onBuildingEnvelope(e){return e.type===z.Foundation||e.type===z.Window||e.type===z.Door||e.type===z.Wall||e.type===z.Roof}static getWindowArea(e,n){if(n){if(e.windowType===Ti.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ti.Polygonal&&e.polygonTop){let o=e.lx*e.lz*n.lx*n.lz;return o+=e.lx*n.lx*e.polygonTop[1]/2,o}return e.lx*e.lz*n.lx*n.lz}else{if(e.windowType===Ti.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ti.Polygonal&&e.polygonTop){let o=e.lx*e.lz;return o+=e.lx*e.polygonTop[1]/2,o}return e.lx*e.lz}}static getDoorArea(e,n){if(n){if(e.doorType===Wd.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz*n.lx*n.lz}else{if(e.doorType===Wd.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz}}static hasHeliostatOrFresnelReflectors(e){for(const n of e)if(n.type===z.FresnelReflector||n.type===z.Heliostat)return!0;return!1}static lineIntersection(e,n,o,r){const i=n.x-e.x,a=n.y-e.y,l=i*(r.y-o.y)-(r.x-o.x)*a;if(l===0)return;const s=((r.y-o.y)*(r.x-e.x)+(o.x-r.x)*(r.y-e.y))/l,c=((e.y-n.y)*(r.x-e.x)+i*(r.y-e.y))/l;if(!(!(0<=s&&s<=1)||!(0<=c&&c<=1)))return{x:e.x+s*i,y:e.y+s*a}}static calculateSolarRadiationColor(e,n){const o=n/(OD.length-1);let r=Math.max(0,Math.floor(e/o));r>OD.length-2&&(r=OD.length-2);const i=Math.min(1,(e-o*r)/o);return new ir(OD[r]).lerp(OD[r+1],i)}static transpose(e){return e[0].map((n,o)=>e.map(r=>r[o]))}static clone2DArray(e){return e.map(n=>[...n])}static fetchHeatmapTexture(e,n,o){if(!e)return null;const r=document.createElement("canvas"),i=e.length,a=e[0].length;r.width=i,r.height=a;const l=r.getContext("2d");if(l){l.clearRect(0,0,i,a);const s=l.getImageData(0,0,i,a),c=s.data;for(let u=0;un!=u>n&&e<(c-l)*(n-s)/(u-s)+l&&(r=!r)}return r}static getPoints(e){const n=[];for(const o of e)n.push({x:o.x,y:o.y});return n}static polygonIntersections(e,n,o){const r=new Array;let i,a,l;for(let s=0;s0&&(n>l.x&&(n=l.x),r>l.y&&(r=l.y),ol||Math.abs(f)>s||(d=o+c*i+u*a,f=r+c*a-u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i-u*a,f=r-c*a+u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i+u*a,f=r-c*a-u*i,Math.abs(d)>l||Math.abs(f)>s))}static isWallWithin(e,n){const o=n.lx*.5,r=n.ly*.5,i=e.leftPoint[0],a=e.leftPoint[1];if(Math.abs(i)>=o||Math.abs(a)>=r)return!1;const l=e.rightPoint[0],s=e.rightPoint[1];return!(Math.abs(l)>=o||Math.abs(s)>=r)}static isSensorWithin(e,n){return Math.abs(e.cx)<.5-e.lx/n.lx&&Math.abs(e.cy)<.5-e.ly/n.ly}static isSolarCollectorWithinHorizontalSurface(e,n){const o=e.cx,r=e.cy,i=Math.cos(e.relativeAzimuth),a=Math.sin(e.relativeAzimuth),l=n.lx*.5,s=n.ly*.5,c=e.lx*.5,u=e.ly*.5*Math.cos(e.tiltAngle);let d=o+c*i-u*a,f=r+c*a+u*i;return!(Math.abs(d)>l||Math.abs(f)>s||(d=o+c*i+u*a,f=r+c*a-u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i-u*a,f=r-c*a+u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i+u*a,f=r-c*a-u*i,Math.abs(d)>l||Math.abs(f)>s))}static isWindTurbineWithinHorizontalSurface(e,n){return Math.abs(e.cx)<=.5&&Math.abs(e.cy)<=.5}static isUnitVectorX(e){return jo.isSame(e,b1)||jo.isSame(e,S1)}static isUnitVectorY(e){return jo.isSame(e,Zc)||jo.isSame(e,T1)}static isSame(e,n){return Math.abs(e.x-n.x)Ht)return!1;return!0}static isEqual(e,n){return Math.abs(e-n)-1&&e.splice(o,1)}static fixElements(e){const n=[];for(const o of e)o.type||n.push(o);if(n.length>0)for(const o of n)jo.deleteElement(e,o)}static fixViewStateLight(e){e.ambientLightIntensity&&(e.ambientLightIntensity*=2),e.directLightIntensity&&(e.directLightIntensity*=3.5)}static isResizingVertical(e){switch(e){case xt.LowerLeftTop:case xt.UpperLeftTop:case xt.LowerRightTop:case xt.UpperRightTop:return!0;default:return!1}}static isTopResizeHandle(e){return e===xt.LowerLeftTop||e===xt.LowerRightTop||e===xt.UpperLeftTop||e===xt.UpperRightTop||e===xt.Top}static isXResizeHandle(e){return e===xt.Left||e===xt.Right}static isYResizeHandle(e){return e===xt.Upper||e===xt.Lower}static isTopResizeHandleOfWall(e){return e===xt.UpperLeft||e===xt.UpperRight}static isRiseHandleOfRoof(e){return e===Ur.Top||e===Ur.Mid||e===Ur.TopMid}static isMoveHandle(e){return e===Ho.Default||e===Ho.Top||e===Ho.Upper||e===Ho.Lower||e===Ho.Left||e===Ho.Right}static snapToNormalGrid(e){const n=Math.round(e.x/yA)*yA,o=Math.round(e.y/yA)*yA;return new ue(n,o,e.z)}static snapToFineGrid(e){const n=Math.round(e.x/r3)*r3,o=Math.round(e.y/r3)*r3;return new ue(n,o,e.z)}static isPositionRelative(e){return e===z.BatteryStorage||e===z.SolarPanel||e===z.ParabolicTrough||e===z.ParabolicDish||e===z.FresnelReflector||e===z.Heliostat||e===z.WindTurbine||e===z.SolarWaterHeater||e===z.Sensor||e===z.Light||e===z.Polygon||e===z.Window||e===z.Door||e===z.Roof||e===z.Wall}static isPlantOrHuman(e){return e.type===z.Tree||e.type===z.Flower||e.type===z.Human}static isFoundationOrCuboid(e){return e.type===z.Foundation||e.type===z.Cuboid}static isSolarCollector(e){return jo.isSolarCollectorType(e.type)}static isSolarCollectorType(e){return e===z.SolarPanel||e===z.SolarWaterHeater||jo.isCspCollectorType(e)}static isCspCollector(e){return jo.isCspCollectorType(e.type)}static isCspCollectorType(e){return e===z.ParabolicDish||e===z.ParabolicTrough||e===z.FresnelReflector||e===z.Heliostat}static isParabolicCollector(e){return jo.isParabolaType(e.type)}static isParabolaType(e){return e===z.ParabolicDish||e===z.ParabolicTrough}static isParabolicTroughOrFresnelReflector(e){return e===z.FresnelReflector||e===z.ParabolicTrough}static isHeliostatOrFresnelReflector(e){return e===z.FresnelReflector||e===z.Heliostat}static isLegalOnWall(e){switch(e){case z.Window:case z.Door:case z.Sensor:case z.Light:case z.SolarPanel:case z.Polygon:return!0}return!1}static isDescendantOf(e,n){const o=e.parentId;if(!o||o===rr)return!1;const r=H.getState().getElementById(o);return r?r.id===n?!0:jo.isDescendantOf(r,n):!1}static isElementInsideWall(e,n,o,r,i){const a=n/2,l=o/2;for(let c=-1;c<=1;c+=2)for(let u=-1;u<=1;u+=2){if(i&&u===-1)continue;const d=e.x+a*c,f=e.z+l*u;if(!jo.isPointInside(d,f,r))return!1}const s=[{x:e.x-a,y:e.z-l},{x:e.x-a,y:e.z+l},{x:e.x+a,y:e.z+l},{x:e.x+a,y:e.z-l}];for(const c of r)if(jo.isPointInside(c.x,c.y,s))return!1;return!0}static isRectOutsideBoundary(e,n,o,r,i,a){return e+o>i||e-o<-i||n+r>a||n-r<-a}static getSolarPanelVerticesOnCuboidVerticalFace(e){const n=[],[o,r]=[e.lx/2,e.ly/2];return jo.isIdentical(e.normal,[-1,0,0])||jo.isIdentical(e.normal,[1,0,0])?(n.push({x:e.cy-o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz+r}),n.push({x:e.cy-o,y:e.cz+r})):(jo.isIdentical(e.normal,[0,1,0])||jo.isIdentical(e.normal,[0,-1,0]))&&(n.push({x:e.cx-o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz+r}),n.push({x:e.cx-o,y:e.cz+r})),n}static checkCollisionOnCuboidSameVerticalFace(e){for(const n of H.getState().elements)if(n.type===z.SolarPanel&&n.id!==e.id&&n.parentId===e.parentId&&jo.isIdentical(n.normal,e.normal)){const o=jo.getSolarPanelVerticesOnCuboidVerticalFace(n),r=jo.getSolarPanelVerticesOnCuboidVerticalFace(e);for(const i of o)if(jo.isPointInside(i.x,i.y,r))return!0;for(const i of r)if(jo.isPointInside(i.x,i.y,o))return!0}return!1}static checkElementOnCuboidState(e,n){if(jo.isIdentical(e.normal,[0,0,1])){if(!jo.isSolarCollectorWithinHorizontalSurface(e,n))return ya.OutsideBoundary;if(H.getState().overlapWithSibling(e))return ya.OverLap}else{const[o,r]=[e.lx/2,e.ly/2],[i,a,l]=[n.lx/2,n.ly/2,n.lz/2];if(jo.isIdentical(e.normal,[-1,0,0])||jo.isIdentical(e.normal,[1,0,0])){if(jo.isRectOutsideBoundary(e.cy,e.cz,o,r,a,l))return ya.OutsideBoundary}else if((jo.isIdentical(e.normal,[0,1,0])||jo.isIdentical(e.normal,[0,-1,0]))&&jo.isRectOutsideBoundary(e.cx,e.cz,o,r,i,l))return ya.OutsideBoundary;if(jo.checkCollisionOnCuboidSameVerticalFace(e))return ya.OverLap}return ya.Valid}static checkElementOnWallState(e,n){let r=e.lx/2+1e-5,i=e.lz/2+1e-5;n&&e.type===z.SolarPanel&&(r=r/n.lx+1e-5,i=e.ly/2/n.lz+1e-5);const a=e.cx-r,l=e.cx+r,s=e.cz-i,c=e.cz+i;if(n&&n.type===z.Wall&&!jo.isElementInsideWall(new ue(e.cx*n.lx,e.cy,e.cz*n.lz),n.lx*r*2,n.lz*i*2,jo.getWallInnerSideShapePoints(n),e.type===z.Door))return ya.OutsideBoundary;for(const u of H.getState().elements)if(jo.isLegalOnWall(u.type)&&u.type!==z.Polygon&&u.parentId===e.parentId&&u.id!==e.id){let d=u.lx/2,f=u.lz/2;n&&u.type===z.SolarPanel&&(d=d/n.lx,f=u.ly/2/n.lz);const p=u.cx-d,m=u.cx+d,y=u.cz-f,w=u.cz+f;if((a>=p&&a<=m||l>=p&&l<=m||p>=a&&p<=l||m>=a&&m<=l)&&(s>=y&&s<=w||c>=y&&c<=w||y>=s&&y<=c||w>=s&&w<=c))return ya.OverLap}return ya.Valid}static checkElementOnRoofState(e,n){if(e.foundationId){const o=H.getState().getElementById(e.foundationId);if(o){const r=Rn.getElementVerticesOnRoof(e,o),i=Rn.getRoofBoundaryVertices(n);return Rn.rooftopElementBoundaryCheck(r,i)?Rn.rooftopElementCollisionCheck(e,o,r)?ya.Valid:ya.OverLap:ya.OutsideBoundary}}return ya.Invalid}static relativeCoordinates(e,n,o,r,i){const a=new ue(e,n,o);if(r.type===z.Wall){const l=new ue(r.cx,r.cy),s=H.getState().getParent(r);if(s){const c=new ue(s.cx,s.cy);l.applyEuler(new cn(0,0,s.rotation[2])).add(c).setZ(s.lz+r.lz/2),a.sub(l).applyEuler(new cn(0,0,-r.relativeAngle-s.rotation[2]))}}else{const{pos:l,rot:s}=jo.getWorldDataById(r.id);a.set(e-l.x,n-l.y,o-l.z),a.applyEuler(new cn(0,0,-s))}return i||(a.x/=r.lx,a.y/=r.ly,a.z/=r.lz),a}static absoluteCoordinates(e,n,o,r,i,a,l){if(r.type===z.Wall&&i){const c=r,u=i?i.rotation[2]+c.relativeAngle:c.relativeAngle;if(u!==void 0){const d=jo.wallAbsolutePosition(new ue(c.cx,c.cy,c.cz),i).setZ(c.lz/2+i.lz),f=new ue(e*c.lx,n*c.ly,o*c.lz);if(f.applyAxisAngle(Oo,u),a){const p=a*Math.cos(u-$t),m=a*Math.sin(u-$t);return new ue(d.x+f.x+p,d.y+f.y+m,d.z+f.z)}return new ue(d.x+f.x,d.y+f.y,d.z+f.z)}}if(r.type===z.Roof&&i){const c=new ue(e,n,o+i.cz);return c.applyEuler(new cn().fromArray(i.rotation)),c.x+=i.cx,c.y+=i.cy,c}const s=new ue;return l?s.set(e,n,o):s.set(e*r.lx,n*r.ly,o*r.lz),s.applyEuler(new cn().fromArray(r.rotation)),s.x+=r.cx,s.y+=r.cy,s.z+=r.cz,s}static absoluteHumanOrTreeCoordinates(e,n,o,r){const i=new ue(e,n,o);return i.applyEuler(new cn().fromArray(r.rotation)),i.x+=r.cx,i.y+=r.cy,i.z+=r.cz,i}static relativePoint(e,n){const o=new ue(e.x-n.cx,e.y-n.cy,e.z-n.cz);return o.applyEuler(new cn().fromArray(n.rotation.map(r=>-r))),o}static wallAbsolutePosition(e,n){const o=new ue(n.cx,n.cy);return new ue().addVectors(o,new ue(e.x,e.y).applyAxisAngle(Oo,n.rotation[2]))}static wallRelativePosition(e,n){const o=new ue(n.cx,n.cy);return new ue().subVectors(new ue(e.x,e.y),o).applyAxisAngle(Oo,-n.rotation[2])}static getObjectChildById(e,n){if(e){for(const o of e.children)if(o.name===Vv){const r=jo.getStackCuboidObjectById(o,n);if(r)return r}else if(o.name.includes(n))return o}return null}static getStackCuboidObjectById(e,n){if(e)for(const o of e.children){if(o.name.includes(n))return o;if(o.name===_ot){const r=jo.getStackCuboidObjectById(o.children[0],n);if(r)return r}}return null}static toRadians(e){return e*(Math.PI/180)}static toDegrees(e){return e*(180/Math.PI)}static getArrayMax(e){return e.reduce((n,o)=>Math.max(n,o))}static getArrayMin(e){return e.reduce((n,o)=>Math.min(n,o))}static getArrayMax2D(e){return jo.getArrayMax(e.map(jo.getArrayMax))}static getArrayMin2D(e){return jo.getArrayMin(e.map(jo.getArrayMin))}static sphericalToCartesianZ(e){const n=e.x*Math.cos(e.z),o=n*Math.cos(e.y),r=n*Math.sin(e.y),i=e.x*Math.sin(e.z);return e.set(o,r,i),e}static getDistance(e,n,o,r){return e=jo.toRadians(e),n=jo.toRadians(n),o=jo.toRadians(o),r=jo.toRadians(r),Math.acos(Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos(Math.abs(e-o)))}static minutesIntoDay(e){return e.getHours()*60+e.getMinutes()}static dayOfYear(e){return(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())-Date.UTC(e.getFullYear(),0,0))/864e5}static daysInYear(e){const n=e.getFullYear();return n%4===0&&n%100>0||n%400===0?366:365}static daysOfMonth(e,n){return new Date(n,e+1,0).getDate()}static fahrenheitToCelsius(e){return(e-32)*5/9}static celsiusToFahrenheit(e){return e*(9/5)+32}static getOS(){var e;return(e=lVe.os)==null?void 0:e.family}static isMac(){const e=jo.getOS();return e?e.includes("Mac")||e.includes("OS X"):!1}static isChrome(){const e=jo.getOS();return e?e.includes("Chrome"):!1}static detectWebGLContext(){try{const e=document.createElement("canvas");return!!window.WebGLRenderingContext&&(!!e.getContext("webgl")||!!e.getContext("experimental-webgl"))}catch{return!1}}static clamp(e,n,o){return n>o?(n+o)/2:Math.min(Math.max(e,n),o)}static distanceFromPointToLine2D(e,n,o){const[r,i]=[e.x,e.y],[a,l]=[n.x,n.y],[s,c]=[o.x,o.y],u=r-a,d=i-l,f=s-a,p=c-l,m=u*f+d*p,y=f*f+p*p;let w=-1;y!==0&&(w=m/y);let x,C;w<0?(x=a,C=l):w>1?(x=s,C=c):(x=a+w*f,C=l+w*p);const P=r-x,A=i-C;return Math.sqrt(P*P+A*A)}static mapVector3ToPoint2(e){return{x:e.x,y:e.y}}static getWallVertices(e,n){const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:-r-n},a={x:o+n,y:-r-n},l={x:-o-n,y:(e.leftRoofHeight??e.lz)-r+n},s={x:o+n,y:(e.rightRoofHeight??e.lz)-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static isPartialWallFull(e){return jo.isZero((e.leftRoofHeight??e.lz)-e.leftTopPartialHeight)&&jo.isZero((e.rightRoofHeight??e.lz)-e.rightTopPartialHeight)&&jo.isZero(e.leftUnfilledHeight)&&jo.isZero(e.rightUnfilledHeight)}static getPartialWallVertices(e,n){if(jo.isPartialWallFull(e))return jo.getWallVertices(e,n);const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:e.leftUnfilledHeight-r-n},a={x:o+n,y:e.rightUnfilledHeight-r-n},l={x:-o-n,y:e.leftTopPartialHeight-r+n},s={x:o+n,y:e.rightTopPartialHeight-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static getHighestPointOfWall(e){let n=e.lz;return e.leftRoofHeight&&(n=Math.max(n,e.leftRoofHeight)),e.rightRoofHeight&&(n=Math.max(n,e.rightRoofHeight)),e.centerRightRoofHeight&&(n=Math.max(n,e.centerRightRoofHeight[1])),e.centerRoofHeight&&(n=Math.max(n,e.centerRoofHeight[1])),e.centerLeftRoofHeight&&(n=Math.max(n,e.centerLeftRoofHeight[1])),n}static getWallPointsOfRoof(e,n){let o=n??H.getState().getElementById(e.wallsId[0]);if(!o)return[];const r=o,i=[];for(;o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.leftJoints[0]);)if(o.leftJoints[0]!==r.id)o=H.getState().getElementById(o.leftJoints[0]);else return i.reverse(),i;for(i.reverse(),o=H.getState().getElementById(r==null?void 0:r.rightJoints[0]);o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.rightJoints[0]&&o.rightJoints[0]!==r.id);)o=H.getState().getElementById(o.rightJoints[0]);return i}static getWallInnerSideShapePoints(e){const{lx:n,ly:o,lz:r,relativeAngle:i,fill:a,leftUnfilledHeight:l,rightUnfilledHeight:s,leftRoofHeight:c,centerLeftRoofHeight:u,centerRoofHeight:d,centerRightRoofHeight:f,rightRoofHeight:p,leftJoints:m,rightJoints:y}=e,w=m.length>0?H.getState().getElementById(m[0]):null,x=y.length>0?H.getState().getElementById(y[0]):null,C=w&&w.type===z.Wall?jo.getInnerWallOffset(w,n,o,i,"left"):0,P=x&&x.type===z.Wall?jo.getInnerWallOffset(x,n,o,i,"right"):0,A=[],S=n/2,v=r/2;return a===Ul.Partial?(A.push({x:-S+C,y:-v+l}),A.push({x:S-P,y:-v+s})):(A.push({x:-S+C,y:-v}),A.push({x:S-P,y:-v})),p?A.push({x:S-P,y:p-v}):A.push({x:S-P,y:v}),f&&A.push({x:f[0]*n,y:f[1]-v}),d&&A.push({x:d[0]*n,y:d[1]-v}),u&&A.push({x:u[0]*n,y:u[1]-v}),c?A.push({x:-S+C,y:c-v}):A.push({x:-S+C,y:v}),A}static getInnerWallOffset(e,n,o,r,i){let a=0;if(e&&e.fill!==Ul.Empty){const l=i==="left"?-1:1,s=(Math.PI*3+l*(r-e.relativeAngle))%fa;s<=$t+.01&&s>0&&(a=Math.min(o/Math.tan(s)+e.ly,n))}return a}static isElementAllowedMultipleMoveOnGround(e){return e.type===z.Foundation||e.type===z.Cuboid&&e.parentId===rr}static areBasesOverlapped(e,n,o){const r=o.get(e),i=o.get(n);if(!r||!i)return!1;for(const a of r)if(jo.isPointInside(a.x,a.y,i))return!0;for(const a of i)if(jo.isPointInside(a.x,a.y,r))return!0;r.push(r[0]),i.push(i[0]);for(let a=0;aNumber(c)),[a,l,s]=n.split(".").map(c=>Number(c));return oa?!1:rl?!1:i{const n=H.getState().getElementById,o=[],r=e;for(;e&&(o.push(e),e.leftJoints[0]);)if(e.leftJoints[0]!==r.id){const a=n(e.leftJoints[0]);a&&a.type===z.Wall&&(e=a)}else return o;const i=n(r.rightJoints[0]);for(i&&i.type===z.Wall&&(e=i);e&&(o.push(e),e.rightJoints[0]&&e.rightJoints[0]!==r.id);){const a=n(e.rightJoints[0]);a&&(e=a)}return o},jo.getWorldDataById=e=>{const n=H.getState().getElementById(e);if(!n)return{pos:new ue,rot:0,topZ:0};const o=new ue(n.cx,n.cy,n.cz),r=n.rotation[2],i=n.lz;if(n.parentId===rr)return{pos:o,rot:r,topZ:i};const{pos:a,rot:l,topZ:s}=jo.getWorldDataById(n.parentId),c=new cn(0,0,l);return{pos:new ue().addVectors(o.applyEuler(c),a.clone().setZ(s)),rot:r+l,topZ:i+s}},jo.isChild=(e,n,o=!1)=>{const r=H.getState().getElementById(n);return!r||o&&r.locked?!1:r.parentId===e?!0:jo.isChild(e,r.parentId,o)},jo.getBaseId=e=>{const n=H.getState().getElementById(e);return n?n.parentId===rr?n.id:jo.getBaseId(n.parentId):null},jo.isElementTriggerAutoDeletion=e=>{if(e.type===z.Roof){const r=e;if(r.roofType===Zo.Gable||r.roofType===Zo.Gambrel)return!0}if(e.type!==z.Wall)return!1;const n=e;if(!n.roofId)return!1;const o=H.getState().getElementById(n.roofId);if(!o)return!1;switch(o.roofType){case Zo.Hip:case Zo.Gable:case Zo.Gambrel:return!0;case Zo.Pyramid:case Zo.Mansard:return o.wallsId.length===0?!1:o.wallsId[0]===n.id;default:return!1}};let ye=jo;var vrt;vrt=Ly;class mMe{constructor(){this[vrt]=!0,this.latitude=42.2844063,this.longitude=-71.3488548,this.address=zX,this.countryCode="US",this.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),this.name="default",this.ground={albedo:.3,thermalDiffusivity:.05,snowReflectionFactors:new Array(12).fill(0)},this.leafDayOfYear1=tQ,this.leafDayOfYear2=nQ,this.airAttenuationCoefficient=.01,this.airConvectiveCoefficient=5,this.timesPerHour=1,this.daysPerYear=12,this.monthlyIrradianceLosses=new Array(12).fill(.05),this.pvGridCellSize=.5,this.discretization=Ay.APPROXIMATE,this.diurnalTemperatureModel=a5.Sinusoidal,this.highestTemperatureTimeInMinutes=900,this.solarPanelVisibilityGridCellSize=.2,this.solarRadiationHeatmapGridCellSize=.5,this.cspTimesPerHour=1,this.cspDaysPerYear=4,this.cspGridCellSize=.5,this.sutTimesPerHour=1,this.sutDaysPerYear=4,this.sutGridCellSize=1,this.noAnimationForHeatmapSimulation=!1,this.noAnimationForThermalSimulation=!1,this.noAnimationForSensorDataCollection=!1,this.noAnimationForSolarPanelSimulation=!1,this.noAnimationForSolarUpdraftTowerSimulation=!1}static resetWorldModel(e){e.latitude=42.2844063,e.longitude=-71.3488548,e.address=zX,e.countryCode="US",e.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),e.name="default",e.ground.albedo=.3,e.ground.thermalDiffusivity=.05,e.ground.snowReflectionFactors.fill(0),e.airAttenuationCoefficient=.01,e.airConvectiveCoefficient=5,e.timesPerHour=1,e.daysPerYear=12,e.monthlyIrradianceLosses=new Array(12).fill(.05),e.pvGridCellSize=.5,e.discretization=Ay.APPROXIMATE,e.diurnalTemperatureModel=a5.Sinusoidal,e.highestTemperatureTimeInMinutes=900,e.solarPanelVisibilityGridCellSize=.2,e.solarRadiationHeatmapGridCellSize=.5,e.cspTimesPerHour=1,e.cspDaysPerYear=4,e.cspGridCellSize=.5,e.sutTimesPerHour=1,e.sutDaysPerYear=4,e.sutGridCellSize=1,e.noAnimationForHeatmapSimulation=!1,e.noAnimationForThermalSimulation=!1,e.noAnimationForSensorDataCollection=!1,e.noAnimationForSolarPanelSimulation=!1,e.noAnimationForSolarUpdraftTowerSimulation=!1}getElements(){const e=[],n={type:z.Foundation,cx:0,cy:0,cz:.05,lx:10,ly:10,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:rr,textureType:Xi.NoTexture,id:Oi.generate()};e.push(n);const o={type:z.Sensor,cx:-.1,cy:0,cz:.105,lx:.1,ly:.1,lz:.01,parentId:n.id,foundationId:n.id,normal:[0,0,1],rotation:[0,0,0],id:Oi.generate(),showLabel:!0,light:!0,heatFlux:!1};e.push(o);const r={type:z.Human,name:Vt.Judd,cx:1,cy:-1,cz:0,lx:hh.fetchWidth(Vt.Jiya),lz:hh.fetchHeight(Vt.Jiya),normal:[1,0,0],rotation:[0,0,0],parentId:rr,id:Oi.generate()};return e.push(r),e}}class Pl{static clone(e,n,o,r,i,a,l,s){let c=null;switch(n.type){case z.Polygon:e&&(c=Pl.clonePolygon(e,n,o,r,i,a,l));break;case z.Sensor:e&&(c=Pl.cloneSensor(e,n,o,r,i));break;case z.Light:e&&(c=Pl.cloneLight(e,n,o,r,i));break;case z.SolarPanel:e&&(c=Pl.cloneSolarPanel(e,n,o,r,i));break;case z.SolarWaterHeater:e&&(c=Pl.cloneSolarWaterHeater(e,n,o,r,i));break;case z.ParabolicTrough:e&&(c=Pl.cloneParabolicTrough(e,n,o,r,i));break;case z.ParabolicDish:e&&(c=Pl.cloneParabolicDish(e,n,o,r,i));break;case z.FresnelReflector:e&&(c=Pl.cloneFresnelReflector(e,n,o,r,i));break;case z.Heliostat:e&&(c=Pl.cloneHeliostat(e,n,o,r,i));break;case z.WindTurbine:e&&(c=Pl.cloneWindTurbine(e,n,o,r,i));break;case z.Wall:e&&(c=Pl.cloneWall(e,n,o,r,i));break;case z.Window:e&&(c=Pl.cloneWindow(e,n,o,r,i,s));break;case z.Door:e&&(c=Pl.cloneDoor(e,n,o,r,i));break;case z.Roof:e&&(c=Pl.cloneRoof(e,n,o,r,i));break;case z.Human:c=Pl.cloneHuman(n,o,r,i,e);break;case z.Tree:c=Pl.cloneTree(n,o,r,i,e);break;case z.Flower:c=Pl.cloneFlower(n,o,r,i,e);break;case z.Foundation:c=Pl.cloneFoundation(n,o,r);break;case z.Cuboid:{const u=e?e.id:rr;c=Pl.cloneCuboid(u,n,o,r);break}case z.BatteryStorage:e&&(c=Pl.cloneBatteryStorage(e.id,n,o,r))}return c}static cloneHuman(e,n,o,r,i){return{type:z.Human,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Oi.generate()}}static cloneTree(e,n,o,r,i){return{type:z.Tree,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Oi.generate()}}static cloneFlower(e,n,o,r,i){return{type:z.Flower,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Oi.generate()}}static clonePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=n.vertices.map(d=>({...d})),u={type:z.Polygon,cx:o,cy:r,cz:i,lx:n.lx,ly:n.ly,lz:n.lz,filled:n.filled,noOutline:n.noOutline,color:n.color,lineColor:n.lineColor,lineWidth:n.lineWidth,opacity:n.opacity,textureType:n.textureType,text:n.text,fontSize:n.fontSize,fontColor:n.fontColor,normal:[...n.normal],rotation:n.parentId?[...e.rotation]:[0,0,0],vertices:c,parentId:e.id,parentType:e.type,foundationId:s,id:Oi.generate()};if(!a){let d=o,f=r;if(e.type===z.Cuboid&&l){ye.isSame(l,S1)?d=i??0:ye.isSame(l,b1)?d=-(i??0):ye.isSame(l,T1)?f=i??0:ye.isSame(l,Zc)&&(f=-(i??0));const p=l.dot(new ue().fromArray(n.normal));if(Math.abs(p)0&&this.commands.length>this.limit&&this.commands.splice(0,this.commands.length-this.limit),this.index=this.commands.length-1)}undo(){const e=this.commands[this.index];if(e)return this.isExecuting=!0,e.undo(),this.isExecuting=!1,this.index--,e.name}redo(){const e=this.commands[this.index+1];if(e)return this.isExecuting=!0,e.redo(),this.isExecuting=!1,this.index++,e.name}clear(){this.commands=[],this.index=-1}hasUndo(){return this.index!==-1}hasRedo(){return this.index0||this.cuboidCount>0||this.wallCount>0||this.windowCount>0||this.doorCount>0||this.humanCount>0||this.treeCount>0||this.flowerCount>0||this.polygonCount>0||this.sensorCount>0||this.insideLightCount>0||this.outsideLightCount>0||this.solarPanelCount>0||this.parabolicTroughCount>0||this.parabolicDishCount>0||this.fresnelReflectorCount>0||this.heliostatCount>0||this.solarUpdraftTowerCount>0||this.windTurbineCount>0}}var Trt;Trt=Ly;class bhn{constructor(e){this[Trt]=!0,this.problem=e,this.objectiveFunctionType=Mo.DAILY_TOTAL_OUTPUT,this.selectionMethod=by.ROULETTE_WHEEL,this.searchMethod=As.GLOBAL_SEARCH_UNIFORM_SELECTION,this.populationSize=20,this.maximumGenerations=5,this.selectionRate=.5,this.crossoverRate=.5,this.mutationRate=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}var Prt;Prt=Ly;class Shn{constructor(e){this[Prt]=!0,this.problem=e,this.objectiveFunctionType=Mo.DAILY_TOTAL_OUTPUT,this.searchMethod=As.GLOBAL_SEARCH_UNIFORM_SELECTION,this.swarmSize=20,this.maximumSteps=5,this.vmax=.01,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}var Crt;Crt=Ly;class xMe{constructor(){this[Crt]=!0,this.geneticAlgorithmParams=new bhn(Pi.SOLAR_PANEL_TILT_ANGLE),this.particleSwarmOptimizationParams=new Shn(Pi.SOLAR_PANEL_TILT_ANGLE)}}var Rrt;Rrt=Ly;class kJ{constructor(){this[Rrt]=!0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-$t,this.maximumTiltAngle=$t,this.poleHeight=1,this.poleSpacing=5,this.orientation=br.landscape,this.pvModelName="CS6X-355P-FG",this.rowAxis=Nl.leftRight}}var Hrt;Hrt=Ly;class vMe{constructor(){this[Hrt]=!0,this.projectLifeSpan=25,this.electricitySellingPrice=.25,this.operationalCostPerUnit=.15}}var Mrt;Mrt=Ly;class bMe{constructor(){this[Mrt]=!0,this.humanName=Vt.Jack,this.flowerType=uo.YellowFlower,this.treeType=yr.Dogwood,this.treeSpread=3,this.treeHeight=4,this.foundationHeight=.1,this.foundationColor="#808080",this.foundationTexture=Xi.NoTexture,this.groundFloorRValue=Kw,this.cuboidHeight=4,this.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"],this.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture],this.cuboidStackable=!1,this.cuboidTransparency=0,this.wallHeight=5,this.wallThickness=.3,this.wallColor="#ffffff",this.wallTexture=Jo.Default,this.wallStructure=Tc.Default,this.wallStructureSpacing=2,this.wallStructureWidth=.1,this.wallStructureColor="#ffffff",this.wallOpacity=.5,this.wallRValue=U9,this.wallVolumetricHeatCapacity=.5,this.wallEavesLength=.3,this.wallParapet=K3e,this.roofColor="#454769",this.roofSideColor="#ffffff",this.roofTexture=Yr.Default,this.roofThickness=.2,this.roofStructure=Hc.Default,this.roofGlassOpacity=.5,this.roofGlassTint="#73D8FF",this.roofRafterWidth=.1,this.roofRafterSpacing=1,this.roofRafterColor="#ffffff",this.roofRValue=pA,this.roofVolumetricHeatCapacity=.5,this.roofRise=2,this.roofCeiling=!1,this.ceilingRValue=dA,this.doorColor="#ffffff",this.doorFrameColor="#ffffff",this.doorTexture=dr.Default,this.doorType=Wd.Default,this.doorArchHeight=1,this.doorFilled=!0,this.doorInterior=!1,this.doorUValue=fA,this.doorOpacity=1,this.doorVolumetricHeatCapacity=.5,this.windowWidth=1,this.windowHeight=1,this.windowColor="#ffffff",this.windowTint="#73D8FF",this.windowOpacity=.5,this.windowUValue=X9,this.windowHorizontalMullion=!0,this.windowVerticalMullion=!0,this.windowMullionWidth=.06,this.windowHorizontalMullionSpacing=.5,this.windowVerticalMullionSpacing=.5,this.windowMullionColor="#ffffff",this.windowFrame=!1,this.windowFrameWidth=.1,this.windowSillWidth=.1,this.windowType=Ti.Default,this.windowArchHeight=1,this.windowShutterLeft=!1,this.windowShutterRight=!1,this.windowShutterColor="gray",this.windowShutterWidth=.5,this.windowEmpty=!1,this.windowInterior=!1,this.windTurbineBirdSafeDesign=wc.None,this.windTurbineBladeColor=j9,this.windTurbineStripeColor=B9,this.windTurbineNumberOfBlades=3,this.windTurbinePitchAngle=Math.PI/18,this.windTurbineRelativeYawAngle=0,this.windTurbineInitialRotorAngle=0,this.windTurbineTowerHeight=20,this.windTurbineTowerRadius=.5,this.windTurbineBladeRadius=10,this.windTurbineBladeMaximumChordLength=1,this.windTurbineBladeMaximumChordRadius=3,this.windTurbineBladeRootRadius=.3,this.windTurbineHubRadius=.75,this.windTurbineHubLength=1.5,this.solarPanelModelName=g3,this.solarPanelOrientation=br.landscape,this.solarPanelPoleHeight=1,this.solarPanelPoleSpacing=3,this.solarPanelTiltAngle=0,this.solarPanelRelativeAzimuth=0,this.solarPanelFrameColor="#ffffff",this.solarPanelCx=0,this.solarPanelCy=0,this.solarWaterHeaterColor="grey",this.solarWaterHeaterRelativeAzimuth=0,this.solarWaterHeaterTankRadius=qot,this.solarWaterHeaterHeight=1,this.parabolicDishReflectance=.9,this.parabolicDishAbsorptance=.95,this.parabolicDishOpticalEfficiency=.7,this.parabolicDishThermalEfficiency=.3,this.parabolicDishRimDiameter=4,this.parabolicDishLatusRectum=8,this.parabolicDishPoleHeight=.2,this.parabolicDishPoleRadius=.1,this.parabolicDishReceiverStructure=pf.CentralPole,this.parabolicTroughReflectance=.9,this.parabolicTroughAbsorptance=.95,this.parabolicTroughOpticalEfficiency=.7,this.parabolicTroughThermalEfficiency=.3,this.parabolicTroughLatusRectum=2,this.parabolicTroughPoleHeight=.2,this.parabolicTroughWidth=2,this.parabolicTroughModuleLength=3,this.fresnelReflectorReceiver="None",this.fresnelReflectorReflectance=.9,this.fresnelReflectorPoleHeight=.2,this.fresnelReflectorWidth=2,this.fresnelReflectorModuleLength=3,this.heliostatTower="None",this.heliostatReflectance=.9,this.heliostatPoleHeight=.2,this.heliostatPoleRadius=.1,this.heliostatWidth=4,this.heliostatLength=2,this.lightColor="#ffff99",this.lightIntensity=3,this.lightDistance=5}}var Irt;Irt=Ly;class SMe{constructor(){this[Irt]=!0,this.dailyPvIndividualOutputs=!1,this.yearlyPvIndividualOutputs=!1,this.dailyParabolicDishIndividualOutputs=!1,this.yearlyParabolicDishIndividualOutputs=!1,this.dailyParabolicTroughIndividualOutputs=!1,this.yearlyParabolicTroughIndividualOutputs=!1,this.dailyFresnelReflectorIndividualOutputs=!1,this.yearlyFresnelReflectorIndividualOutputs=!1,this.dailyHeliostatIndividualOutputs=!1,this.yearlyHeliostatIndividualOutputs=!1,this.dailyUpdraftTowerIndividualOutputs=!1,this.yearlyUpdraftTowerIndividualOutputs=!1}}class Td{static getDefaultHiddenParameters(e){return e===Pi.SOLAR_PANEL_ARRAY?["latitude","orientation","poleHeight"]:[]}static getVariables(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("rowWidth"),n.includes("tiltAngle")||o.push("tiltAngle"),n.includes("interRowSpacing")||o.push("interRowSpacing"),n.includes("latitude")||o.push("latitude"),n.includes("orientation")||o.push("orientation"),n.includes("poleHeight")||o.push("poleHeight"),n.includes("unitCost")||o.push("unitCost"),n.includes("sellingPrice")||o.push("sellingPrice"),n.includes("totalYearlyCost")||o.push("totalYearlyCost"),n.includes("totalYearlyYield")||o.push("totalYearlyYield"),n.includes("meanYearlyYield")||o.push("meanYearlyYield"),n.includes("yearlyProfit")||o.push("yearlyProfit"),o}return[]}static getTitles(e,n,o){if(e===Pi.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(B.t("polygonMenu.SolarPanelArrayRowWidth",n)),o.includes("tiltAngle")||r.push(B.t("polygonMenu.SolarPanelArrayTiltAngle",n)),o.includes("interRowSpacing")||r.push(B.t("polygonMenu.SolarPanelArrayRowSpacing",n)),o.includes("latitude")||r.push(B.t("word.Latitude",n)),o.includes("orientation")||r.push(B.t("polygonMenu.SolarPanelArrayOrientation",n)),o.includes("poleHeight")||r.push(B.t("polygonMenu.SolarPanelArrayPoleHeight",n)),o.includes("unitCost")||r.push(B.t("economicsPanel.UnitCost",n)),o.includes("sellingPrice")||r.push(B.t("economicsPanel.SellingPrice",n)),o.includes("totalYearlyCost")||r.push(B.t("polygonMenu.SolarPanelArrayTotalYearlyCost",n)),o.includes("totalYearlyYield")||r.push(B.t("polygonMenu.SolarPanelArrayTotalYearlyYield",n)),o.includes("meanYearlyYield")||r.push(B.t("polygonMenu.SolarPanelArrayMeanYearlyYield",n)),o.includes("yearlyProfit")||r.push(B.t("polygonMenu.SolarPanelArrayYearlyProfit",n)),r}return[]}static getTypes(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("number"),n.includes("tiltAngle")||o.push("number"),n.includes("interRowSpacing")||o.push("number"),n.includes("latitude")||o.push("number"),n.includes("orientation")||o.push("boolean"),n.includes("poleHeight")||o.push("number"),n.includes("unitCost")||o.push("number"),n.includes("sellingPrice")||o.push("number"),n.includes("totalYearlyCost")||o.push("number"),n.includes("totalYearlyYield")||o.push("number"),n.includes("meanYearlyYield")||o.push("number"),n.includes("yearlyProfit")||o.push("number"),o}return[]}static getDigits(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(0),n.includes("tiltAngle")||o.push(1),n.includes("interRowSpacing")||o.push(1),n.includes("latitude")||o.push(1),n.includes("orientation")||o.push(0),n.includes("poleHeight")||o.push(1),n.includes("unitCost")||o.push(2),n.includes("sellingPrice")||o.push(2),n.includes("totalYearlyCost")||o.push(1),n.includes("totalYearlyYield")||o.push(1),n.includes("meanYearlyYield")||o.push(1),n.includes("yearlyProfit")||o.push(3),o}return[]}static getTickIntegers(e,n){if(e===Pi.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(!0),n.includes("tiltAngle")||o.push(!1),n.includes("interRowSpacing")||o.push(!1),n.includes("latitude")||o.push(!1),n.includes("orientation")||o.push(!0),n.includes("poleHeight")||o.push(!1),n.includes("unitCost")||o.push(!1),n.includes("sellingPrice")||o.push(!1),n.includes("totalYearlyCost")||o.push(!1),n.includes("totalYearlyYield")||o.push(!1),n.includes("meanYearlyYield")||o.push(!1),n.includes("yearlyProfit")||o.push(!1),o}return[]}static getUnits(e,n,o){if(e===Pi.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(" "+B.t("solarPanelMenu.Panels",n)),o.includes("tiltAngle")||r.push("°"),o.includes("interRowSpacing")||r.push(" "+B.t("word.MeterAbbreviation",n)),o.includes("latitude")||r.push("°"),o.includes("orientation")||r.push(""),o.includes("poleHeight")||r.push(" "+B.t("word.MeterAbbreviation",n)),o.includes("unitCost")||r.push(""),o.includes("sellingPrice")||r.push(""),o.includes("totalYearlyCost")||r.push("K"),o.includes("totalYearlyYield")||r.push(" MWh"),o.includes("meanYearlyYield")||r.push(" kWh"),o.includes("yearlyProfit")||r.push("K"),r}return[]}static getUnit(e,n){return e==="tiltAngle"||e==="latitude"?"°":e==="interRowSpacing"||e==="poleHeight"?B.t("word.MeterAbbreviation",n):e==="totalYearlyYield"?"MWh":e==="meanYearlyYield"?"kWh":e==="totalYearlyCost"||e==="yearlyProfit"?"K":""}static setScatterData(e,n,o,r){switch(e){case"rowWidth":o[n]=r.rowsPerRack;break;case"tiltAngle":o[n]=ye.toDegrees(r.tiltAngle);break;case"interRowSpacing":o[n]=r.interRowSpacing;break;case"latitude":o[n]=r.latitude;break;case"orientation":o[n]=r.orientation===br.landscape?0:1;break;case"poleHeight":o[n]=r.poleHeight;break;case"unitCost":o[n]=r.unitCost;break;case"sellingPrice":o[n]=r.sellingPrice;break;case"totalYearlyCost":o[n]=ye.calculateCost(r);break;case"totalYearlyYield":o[n]=r.yearlyYield*.001;break;case"meanYearlyYield":o[n]=r.yearlyYield/r.panelCount;break;case"yearlyProfit":o[n]=ye.calculateProfit(r);break}}}class Thn{static updateOldFileData(){H.getState().set(e=>{ye.compareVersion(e.version,Cvt)&&(e.viewState.ambientLightIntensity&&(e.viewState.ambientLightIntensity*=3),e.viewState.directLightIntensity&&(e.viewState.directLightIntensity*=3.5));const n=new Map;for(const o of e.elements)n.set(o.id,o);for(const o of e.elements)switch(o.type){case z.Foundation:{const r=o;o.parentId!==rr&&(console.error("Error: "+o.parentId+" is not ground!"),o.parentId=rr),r.hvacSystem||(r.hvacSystem={...fVe});break}case z.Wall:{const r=o;if(r.wallStructure===void 0&&(r.wallStructure=Tc.Default),r.structureSpacing===void 0&&(r.structureSpacing=2),r.structureWidth===void 0&&(r.structureWidth=.1),r.structureColor===void 0&&(r.structureColor="white"),r.opacity===void 0&&(r.opacity=.5),r.fill===void 0&&(r.fill=Ul.Full),r.unfilledHeight===void 0&&(r.unfilledHeight=.5),r.leftUnfilledHeight===void 0||r.rightUnfilledHeight===void 0){const i=r.unfilledHeight??.5;r.leftUnfilledHeight=i,r.rightUnfilledHeight=i}if((r.leftTopPartialHeight===void 0||r.rightTopPartialHeight===void 0)&&(r.leftTopPartialHeight=r.lz,r.rightTopPartialHeight=r.lz),r.eavesLength===void 0&&r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;r.eavesLength=a.overhang!==void 0?a.overhang:.3}else r.eavesLength=.3}if(r.parapet===void 0&&(r.parapet={...K3e}),r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;(a.roofType===Zo.Pyramid||a.roofType===Zo.Hip||a.roofType===Zo.Mansard)&&(r.leftRoofHeight=void 0,r.rightRoofHeight=void 0)}}break}case z.Window:{const r=o;r.horizontalMullion===void 0&&(r.horizontalMullion=r.mullion),r.verticalMullion===void 0&&(r.verticalMullion=r.mullion),r.mullionWidth===void 0&&(r.mullionWidth=.06),r.horizontalMullionSpacing===void 0&&(r.horizontalMullionSpacing=r.mullionSpacing??.5),r.verticalMullionSpacing===void 0&&(r.verticalMullionSpacing=r.mullionSpacing??.5),r.tint===void 0&&(r.tint="#73D8FF"),r.opacity===void 0&&(r.opacity=.5),r.shutter&&(r.leftShutter=r.shutter.showLeft,r.rightShutter=r.shutter.showRight,r.shutterColor=r.shutter.color,r.shutterWidth=r.shutter.width,r.shutter=void 0),r.shutterColor===void 0&&(r.shutterColor="gray"),r.shutterWidth===void 0&&(r.shutterWidth=.5),r.mullionColor===void 0&&(r.mullionColor="white"),r.frame===void 0&&(r.frame=!1),r.color===void 0&&(r.color="white"),r.frameWidth===void 0&&(r.frameWidth=.1),r.windowType===void 0&&(r.windowType=Ti.Default),r.archHeight===void 0&&(r.archHeight=1);break}case z.Door:{const r=o;r.doorType===void 0&&(r.doorType=Wd.Default),r.archHeight===void 0&&(r.archHeight=1),r.filled===void 0&&(r.filled=!0);break}case z.Roof:{const r=o;if(r.ceiling===void 0&&(r.ceiling=!1),r.roofType===Zo.Gambrel){const i=r;i.frontRidgePoint===void 0&&(i.frontRidgePoint=i.frontRidgeLeftPoint?[...i.frontRidgeLeftPoint]:[.35,.5],i.frontRidgeLeftPoint=void 0,i.frontRidgeRightPoint=void 0),i.backRidgePoint===void 0&&(i.backRidgePoint=i.backRidgeLeftPoint?[...i.backRidgeLeftPoint]:[-.35,.5],i.backRidgeLeftPoint=void 0,i.backRidgeRightPoint=void 0),i.topRidgePoint===void 0&&(i.topRidgePoint=i.topRidgeLeftPoint?[...i.topRidgeLeftPoint]:[0,1],i.topRidgeLeftPoint=void 0,i.topRidgeRightPoint=void 0)}break}case z.SolarPanel:{const r=o;if(r.version===void 0)switch(r.version=1,r.parentType){case void 0:case z.Foundation:{r.parentType=z.Foundation;const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz),r.rotation[2]!==0&&(r.rotation=[0,0,0]);break}case z.Cuboid:{const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz,r.rotation=Ii.getRotationOnCuboid(new ue().fromArray(r.normal)),ye.isEqual(0,r.rotation[0])&&r.rotation[2]!==0&&(r.rotation=[0,0,0]));break}case z.Wall:{r.normal=[0,-1,0],r.rotation=[$t,0,0];break}case z.Roof:{if(r.foundationId){const i=n.get(r.foundationId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz+i.lz/2)}break}}break}}})}}function Cd(t){return t.type===z.Foundation||t.type===z.Cuboid}y9t();const H=pq()(xvt(Tvt((t,e)=>{const n=ye.isOpenFromURL(),o=new mMe,r=n?[]:o.getElements(),i=a=>t(Dv(a));return{set:a=>{try{i(a)}catch(l){console.log(l)}},version:HR,world:o,elements:r,user:{},viewState:new yMe,actionState:new bMe,graphState:new SMe,solarPanelArrayLayoutParams:new AMe,solarPanelArrayLayoutConstraints:new kJ,evolutionaryAlgorithmState:new xMe,economicsParams:new vMe,geneticAlgorithmWizardSelectedTab:"1",particleSwarmOptimizationWizardSelectedTab:"1",modelType:ga.UNKNOWN,modelAuthor:null,modelLabel:null,modelDescription:null,projectView:!1,canvasPercentWidth:100,projectState:{owner:null,title:null,description:null,type:Pi.SOLAR_PANEL_ARRAY,designs:new Array,ranges:new Array,filters:new Array,hiddenParameters:Td.getDefaultHiddenParameters(Pi.SOLAR_PANEL_ARRAY),counter:0,dataColoring:$9.ALL,selectedProperty:null,sortDescending:!1,xAxisNameScatterPlot:null,yAxisNameScatterPlot:null,dotSizeScatterPlot:5,thumbnailWidth:200},projectImages:new Map,designProjectType:null,cloudFileBelongToProject(){const a=e().cloudFile;if(!a)return!1;const l=e().projectState.designs;if(l){for(const s of l)if(s.title===a)return!0}return!1},closeProject(){i(a=>{a.loggable&&(a.actionInfo={name:"Close Project",timestamp:new Date().getTime(),details:a.projectState.title}),a.canvasPercentWidth=100,a.projectView=!1,a.projectState.title=null,a.projectState.description=null,a.projectState.owner=null;const l=a.projectState.designs;if(l){for(const s of l)if(s.title===a.cloudFile){a.cloudFile=void 0;break}}a.projectImages.clear(),a.undoManager.clear()}),dt.getState().set(a=>{a.projectImagesUpdateFlag=!a.projectImagesUpdateFlag})},notes:[],language:"en",floatingWindowOpacity:Lu,selectedFloatingWindow:null,cloudFile:void 0,latestModelSite:void 0,modelSites:new Map,allModelSites:new Map,peopleModels:new Map,allPeopleModels:new Map,modelsMapLatitude:42.2844063,modelsMapLongitude:-71.3488548,modelsMapAddress:zX,modelsMapZoom:cVe,modelsMapType:"roadmap",modelsMapTilt:0,showModelsAllTime:!0,showModelsFromDate:"2021-01-01",showModelsToDate:"2025-12-31",minimumNavigationMoveSpeed:3,minimumNavigationTurnSpeed:3,tempHumanPlant:[],ray:new yu,mouse:new _t,fileChanged:!1,setNavigationView(a){i(l=>{l.viewState.navigationView=a,l.viewState.enableRotate=!a,a&&(l.viewState.orthographic=!1)})},set2DView(a){i(l=>{l.viewState.orthographic=a,l.viewState.enableRotate=!a,a&&(l.viewState.navigationView=!1)})},applyCount:0,setApplyCount(a){i(l=>{l.applyCount=a})},revertApply(){if(e().applyCount){for(let a=0;a{s.version=a.version,s.world=a.world,s.viewState=a.view,s.graphState=a.graphState??new SMe,s.elements=a.elements,s.notes=a.notes??[],s.animate24Hours=!!a.animate24Hours,s.canvasPercentWidth=a.canvasPercentWidth??(s.viewState.showModelTree?75:100),s.modelType=a.modelType??ga.UNKNOWN,s.modelAuthor=a.modelAuthor??null,s.modelLabel=a.modelLabel??null,s.modelDescription=a.modelDescription??null,s.designProjectType=a.designProjectType??null,s.cloudFile=l,s.currentUndoable=void 0,s.actionInfo=void 0,s.sceneRadius=a.sceneRadius??100,s.updateSceneRadiusFlag=!s.updateSceneRadiusFlag,s.localContentToImportAfterCloudFileUpdate=void 0,s.fileChanged=!s.fileChanged,s.evolutionMethod=a.evolutionMethod??ec.GENETIC_ALGORITHM,s.solarPanelArrayLayoutParams=a.solarPanelArrayLayoutParams??new AMe,s.solarPanelArrayLayoutConstraints=a.solarPanelArrayLayoutConstraints??new kJ,s.evolutionaryAlgorithmState=a.evolutionaryAlgorithmState??new xMe,s.economicsParams=a.economicsParams??new vMe,s.minimumNavigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.minimumNavigationTurnSpeed=a.minimumNavigationTurnSpeed??3,s.fittestIndividualResults.length=0,s.undoManager.clear(),s.deletedRoofId=null,s.autoDeletedRoofs=null,s.autoDeletedRoofIdSet.clear(),s.autoDeletedChild=null,s.deletedRoofIdSet.clear(),s.addedRoofIdSet.clear(),s.actionState=new bMe,s.multiSelectionsMode=!1,s.selectedElementIdSet.clear(),s.groupActionMode=!1,s.selectedFloatingWindow=null,s.customPvModules=a.customPvModules??{}}),Thn.updateOldFileData(),dt.getState().set(s=>{s.changed=!1,s.skipChange=!0,s.animateSun=!1,s.showSolarRadiationHeatmap=!1,s.showHeatFluxes=!1,s.simulationInProgress=!1,s.simulationPaused=!1,s.clearDailySimulationResultsFlag=!s.clearDailySimulationResultsFlag,s.clearYearlySimulationResultsFlag=!s.clearYearlySimulationResultsFlag,s.navigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.navigationTurnSpeed=a.minimumNavigationTurnSpeed??3}),In.getState().clearDataStore(),In.getState().clearRoofVerticesMap()},exportContent(){const a=e(),l=new Date,s=JSON.parse(JSON.stringify(a.elements));return ye.fixElements(s),{docid:Oi.generate(),time:il(l).format("MM/DD/YYYY hh:mm A"),timestamp:l.getTime(),userid:a.user.uid,owner:a.user.signFile?a.user.displayName:null,email:a.user.signFile?a.user.email:null,version:HR,world:JSON.parse(JSON.stringify(a.world)),elements:s,sceneRadius:a.sceneRadius,view:JSON.parse(JSON.stringify(a.viewState)),canvasPercentWidth:a.canvasPercentWidth,animate24Hours:a.animate24Hours,graphState:JSON.parse(JSON.stringify(a.graphState)),evolutionMethod:a.evolutionMethod,solarPanelArrayLayoutParams:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutParams)),solarPanelArrayLayoutConstraints:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutConstraints)),evolutionaryAlgorithmState:JSON.parse(JSON.stringify(a.evolutionaryAlgorithmState)),economicsParams:JSON.parse(JSON.stringify(a.economicsParams)),modelType:a.modelType,modelAuthor:a.modelAuthor,modelLabel:a.modelLabel,modelDescription:a.modelDescription,designProjectType:a.designProjectType,notes:a.notes,minimumNavigationMoveSpeed:a.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:a.minimumNavigationTurnSpeed,customPvModules:JSON.parse(JSON.stringify(a.customPvModules))}},clearContent(){i(a=>{a.elements=[],a.sceneRadius=100}),In.getState().clearDataStore(),In.getState().clearRoofVerticesMap()},createEmptyFile(){i(a=>{mMe.resetWorldModel(a.world),yMe.resetViewState(a.viewState),a.version=HR,a.elements=[],a.sceneRadius=100,a.cloudFile=void 0,a.localContentToImportAfterCloudFileUpdate=void 0,a.notes=[],a.fileChanged=!a.fileChanged,a.currentUndoable=void 0,a.actionInfo=void 0,a.undoManager.clear(),a.modelType=ga.UNKNOWN,a.modelLabel=null,a.modelDescription=null,a.designProjectType=null,a.minimumNavigationMoveSpeed=3,a.minimumNavigationTurnSpeed=3,a.multiSelectionsMode=!1,a.selectedElementIdSet.clear(),a.groupActionMode=!1,a.selectedFloatingWindow=null,a.deletedRoofId=null,a.autoDeletedRoofs=null,a.autoDeletedRoofIdSet.clear(),a.autoDeletedChild=null,a.deletedRoofIdSet.clear(),a.addedRoofIdSet.clear(),a.customPvModules={},a.actionState.solarPanelModelName=g3}),dt.getState().set(a=>{a.changed=!1,a.skipChange=!0,a.animateSun=!1,a.showSolarRadiationHeatmap=!1,a.showHeatFluxes=!1}),In.getState().clearDataStore(),In.getState().clearRoofVerticesMap()},undoManager:new vhn,addUndoable(a){dt.getState().muteUndoMessage||idn(a.name),i(l=>{l.loggable&&(l.currentUndoable=a),l.undoManager.add(a)})},fittestIndividualResults:[],setFittestIndividualResults(a){i(l=>{l.fittestIndividualResults=[...a]})},variableLabels:[],setVariableLabels(a){i(l=>{l.variableLabels=[...a]})},aabb:new Cf(new ue(-10,-10,-10),new ue(10,10,10)),animate24Hours:!1,evolutionMethod:ec.GENETIC_ALGORITHM,clickObjectType:null,contextMenuObjectType:null,hoveredHandle:null,moveHandleType:null,resizeHandleType:null,rotateHandleType:null,resizeAnchor:new ue,selectedElement:null,getSelectedElement(){if(e().selectedElementIdSet.size===0)return null;const a=e().selectedElement;return a?e().elements.find(l=>l.id===a.id)??null:null},selectedElementIdSet:new Set,multiSelectionsMode:!1,findNearestSibling(a){let l=null;const s=e().getElementById(a);if(s){let c=Number.MAX_VALUE;for(const u of e().elements)if(u.type===s.type&&u.parentId===s.parentId&&u.id!==a){const d=s.cx-u.cx,f=s.cy-u.cy,p=s.cz-u.cz,m=d*d+f*f+p*p;c>m&&(c=m,l=u.id)}}return l},overlapWithSibling(a,l){let s=!1;if(l===void 0){const c=e().getParent(a);if(c){for(const u of e().elements)if(u.type===a.type&&u.parentId===a.parentId&&u.id!==a.id){if(a.type===z.SolarPanel){if(ye.doSolarPanelsOverlap(a,u,c)){s=!0;break}}else if(Math.abs(a.cx-u.cx)*c.lx<.5*(a.lx+u.lx)&&Math.abs(a.cy-u.cy)*c.ly<.5*(a.ly+u.ly)&&Math.abs(a.cz-u.cz)*c.lz<.5*(a.lz+u.lz)){s=!0;break}}}}else{const c=l*l,u=e().getParent(a);for(const d of e().elements)if(d.type===a.type&&d.parentId===a.parentId&&d.id!==a.id){const f=(a.cx-d.cx)*(u?u.lx:1),p=(a.cy-d.cy)*(u?u.ly:1),m=(a.cz-d.cz)*(u?u.lz:1);if(f*f+p*p+m*mC.id===m);if(x){const C=new ue(x.cx,x.cy,x.lz),P=new cn(0,0,x.rotation[2]),A=new ue;switch(l){case xt.UpperLeft:{A.fromArray(w.leftPoint).setZ(0);break}case xt.UpperRight:{A.fromArray(w.rightPoint).setZ(0);break}}y.copy(A.applyEuler(P).add(C))}break}case z.Roof:{const w=e().elements.find(x=>x.id===m);if(w){const x=new ue(w.cx,w.cy,w.lz),C=new cn(0,0,w.rotation[2]),P=new ue(e().selectedElementX,e().selectedElementY).applyEuler(C).add(x);y.set(P.x,P.y,w.lz)}break}case z.Tree:{const w=e().elements.find(x=>x.id===m);if(w){const x=new ue(w.cx,w.cy,w.cz+w.lz/2),C=new cn(0,0,w.rotation[2]);y.copy(new ue(a.cx,a.cy,w.lz).applyEuler(C).add(x))}break}}return y},getElementById(a){const l=e().elements;for(const s of l)if(s.id===a)return s;return null},getParent(a){const l=e().elements;for(const s of l)if(s.id===a.parentId)return s;return null},getFoundation(a){const l=e().elements;for(const s of l)if(s.id===a.foundationId&&s.type===z.Foundation)return s;return null},selectNone(){i(a=>{a.selectedElementIdSet.clear();for(const l of a.elements)l.selected=!1;a.selectedElement=null,a.viewState.showModelTree&&dt.getState().set(l=>{l.modelTreeExpandedKeys=[]})}),jn.getState().selectNone()},selectElement(a,l){i(s=>{if(s.multiSelectionsMode)s.selectedElementIdSet.has(a)?s.selectedElementIdSet.delete(a):s.selectedElementIdSet.add(a);else{s.selectedElementIdSet.clear(),!l&&s.viewState.showModelTree&&dt.getState().set(c=>{c.modelTreeExpandedKeys=[]});for(const c of s.elements)c.id===a?(c.selected=!0,s.selectedElement=c,s.selectedElementIdSet.add(a),!l&&s.viewState.showModelTree&&dt.getState().set(u=>{u.modelTreeExpandedKeys=[a]})):c.selected=!1}})},selectMe(a,l,s,c){const u=jn.getState().setEnableOrbitController;l.intersections.length>0&&(l.intersections.filter(f=>!f.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===l.eventObject||c)&&i(f=>{var p,m,y,w;f.viewState.showModelTree&&dt.getState().set(x=>{x.modelTreeExpandedKeys=[]});for(const x of f.elements){if(x.id===a)if(x.selected=!0,f.selectedElement=x,f.selectedElementHeight=x.lz,f.groupActionMode){let C=x.foundationId??null;!C&&Cd(x)&&(C=ye.getBaseId(x.id)),C&&(f.multiSelectionsMode||f.selectedElementIdSet.clear(),f.selectedElementIdSet.has(C)?f.selectedElementIdSet.delete(C):f.selectedElementIdSet.add(C))}else if(s===er.ContextMenu)if(f.selectedElementIdSet.has(a))for(const C of f.elements)f.selectedElementIdSet.has(C.id)&&C.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(C.id);else if(f.multiSelectionsMode){f.selectedElementIdSet.add(a);for(const C of f.elements)f.selectedElementIdSet.has(C.id)&&C.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(C.id)}else f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a);else f.multiSelectionsMode?f.selectedElementIdSet.has(a)?f.selectedElementIdSet.delete(a):f.selectedElementIdSet.add(a):(f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a));else x.selected=!1;f.viewState.showModelTree&&dt.getState().set(C=>{C.modelTreeExpandedKeys=[a]})}if(f.moveHandleType=null,f.resizeHandleType=null,f.rotateHandleType=null,f.contextMenuObjectType=null,s)switch(s){case er.Move:{((p=f.selectedElement)==null?void 0:p.type)===z.Tree||((m=f.selectedElement)==null?void 0:m.type)===z.Human||((y=f.selectedElement)==null?void 0:y.type)===z.Flower?f.moveHandleType=Ho.Default:f.moveHandleType=l.eventObject.name,u(!1);break}case er.Resize:{f.resizeHandleType=l.eventObject.name,u(!1);break}case er.Rotate:{f.rotateHandleType=l.eventObject.name,u(!1);break}case er.Select:{f.selectedElementAngle=((w=l.object.parent)==null?void 0:w.rotation.z)??0,u(!0);break}default:u(!0)}})},countHeatmapCells(){let a=0;return i(l=>{const s=l.world.solarRadiationHeatmapGridCellSize??.5,c=s*s;for(const u of l.elements)(u.type===z.Foundation||u.type===z.Cuboid)&&(a+=u.lx*u.ly/c)}),Math.round(a)},updateAllElementLocks(a){i(l=>{for(const s of l.elements)s.locked=a})},updateElementLockByFoundationId(a,l){i(s=>{for(const c of s.elements)(c.foundationId===a||c.parentId===a||c.id===a)&&(c.locked=l)})},updateElementLockByParentId(a,l,s){i(c=>{for(const u of c.elements)u.parentId===a&&l===u.type&&(u.locked=s)})},updateElementLockById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.locked=l;break}})},updateElementReferenceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.referenceId=l;break}})},updateElementLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.label=l;break}})},updateElementShowLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.showLabel=l;break}})},updateElementColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.color=l;break}})},updateElementColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.color=c)})},updateElementColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.color=s)})},updateElementColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.color=l)})},updateElementLineColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lineColor=l;break}})},updateElementLineColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.lineColor=c)})},updateElementLineColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineColor=s)})},updateElementLineColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineColor=l)})},updateElementLineWidthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.lineWidth=l;break}})},updateElementLineWidthOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.lineWidth=c)})},updateElementLineWidthAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineWidth=s)})},updateElementLineWidthForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineWidth=l)})},updateElementCxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cx=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cy=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cz=l;break}})},updateElementCzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cz=l)})},updateElementLxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lx=l;break}})},updateElementLxAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lx=s)})},updateElementLxOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lx=c)}})},updateElementLxForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lx=l)})},updateElementLyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.ly=l;break}})},updateElementLyAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.ly=s)})},updateElementLyOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.ly=c)}})},updateElementLyForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.ly=l)})},updateElementLzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lz=l;break}})},updateElementLzAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lz=s)})},updateElementLzOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lz=c)}})},updateElementLzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lz=l)})},updateElementRotationById(a,l,s,c){i(u=>{for(const d of u.elements)(d.id===a&&!d.locked||d.parentId===a&&!Bot(d)&&d.type!==z.SolarPanel&&d.type!==z.BatteryStorage)&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);u.selectedElementAngle=c})},updateElementRotationForAll(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a)d.locked||(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);else{const f=u.getParent(d);f&&!f.locked&&f.type===a&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c)}})},updateSolarCollectorDrawSunBeamById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.drawSunBeam=l;break}})},updateSolarCollectorDrawSunBeamAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.drawSunBeam=s)})},updateSolarCollectorDrawSunBeamForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.locked||c.type===a&&(c.drawSunBeam=l)})},updateSolarCollectorRelativeAzimuthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.relativeAzimuth=l,s.selectedElementAngle=l;break}})},updateSolarCollectorRelativeAzimuthAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&u.parentType!==z.Wall&&(u.relativeAzimuth=s)})},updateSolarCollectorRelativeAzimuthOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.relativeAzimuth=c)}})},updateSolarCollectorRelativeAzimuthForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&c.parentType!==z.Wall&&(c.relativeAzimuth=l)})},updateSolarCollectorXById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.cx=l;break}})},updateSolarCollectorXAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cx=s)})},updateSolarCollectorXForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cx=l)})},updateSolarCollectorYById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.cy=l;break}})},updateSolarCollectorYAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cy=s)})},updateSolarCollectorYForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cy=l)})},updateSolarCollectorPoleHeightById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.poleHeight=l;break}})},updateSolarCollectorPoleHeightAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleHeight=s)})},updateSolarCollectorPoleHeightOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleHeight=c)}})},updateSolarCollectorPoleHeightForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleHeight=l)})},updateSolarCollectorPoleRadiusById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.poleRadius=l;break}})},updateSolarCollectorPoleRadiusAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleRadius=s)})},updateSolarCollectorPoleRadiusOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleRadius=c)}})},updateSolarCollectorPoleRadiusForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleRadius=l)})},clearAllSolarCollectorYields(){i(a=>{for(const l of a.elements)if(ye.isSolarCollector(l)){const s=l;s.dailyYield=0,s.yearlyYield=0}})},updateSolarCollectorDailyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isSolarCollector(c)){c.dailyYield=l;break}})},updateSolarCollectorYearlyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isSolarCollector(c)){c.yearlyYield=l;break}})},updateCspReflectanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isCspCollector(c)){c.reflectance=l;break}})},updateCspReflectanceAboveFoundation(a,l,s){ye.isCspCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.reflectance=s)})},updateCspReflectanceForAll(a,l){ye.isCspCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.reflectance=l)})},updateParabolicCollectorAbsorptanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.absorptance=l;break}})},updateParabolicCollectorAbsorptanceAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.absorptance=s)})},updateParabolicCollectorAbsorptanceForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.absorptance=l)})},updateParabolicCollectorOpticalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.opticalEfficiency=l;break}})},updateParabolicCollectorOpticalEfficiencyAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.opticalEfficiency=s)})},updateParabolicCollectorOpticalEfficiencyForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.opticalEfficiency=l)})},updateParabolicCollectorThermalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.thermalEfficiency=l;break}})},updateParabolicCollectorThermalEfficiencyAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.thermalEfficiency=s)})},updateParabolicCollectorThermalEfficiencyForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.thermalEfficiency=l)})},foundationActionScope:ie.OnlyThisObject,setFoundationActionScope(a){i(l=>{l.foundationActionScope=a})},cuboidActionScope:ie.OnlyThisObject,setCuboidActionScope(a){i(l=>{l.cuboidActionScope=a})},batteryStorageActionScope:ie.OnlyThisObject,setBatteryStorageActionScope(a){i(l=>{l.batteryStorageActionScope=a})},polygonActionScope:ie.OnlyThisObject,setPolygonActionScope(a){i(l=>{l.polygonActionScope=a})},updatePolygonVertexPositionById(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===z.Polygon&&d.id===a){const f=d;l>=0&&l{for(const c of s.elements)if(c.type===z.Polygon&&c.id===a){const u=c;u.vertices=l;break}})},solarWaterHeaterActionScope:ie.OnlyThisObject,setSolarWaterHeaterActionScope(a){i(l=>{l.solarWaterHeaterActionScope=a})},solarPanelActionScope:ie.OnlyThisObject,setSolarPanelActionScope(a){i(l=>{l.solarPanelActionScope=a})},updateSolarPanelTiltAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.SolarPanel&&c.id===a&&!c.locked){const u=c;u.tiltAngle=l;break}})},setSolarPanelOrientation(a,l,s){if(a.orientation=s,a.orientation===br.portrait){const c=Math.max(1,Math.round(a.lx/l.width)),u=Math.max(1,Math.round(a.ly/l.length));a.lx=c*l.width,a.ly=u*l.length}else{const c=Math.max(1,Math.round(a.lx/l.length)),u=Math.max(1,Math.round(a.ly/l.width));a.lx=c*l.length,a.ly=u*l.width}},parabolicTroughActionScope:ie.OnlyThisObject,setParabolicTroughActionScope(a){i(l=>{l.parabolicTroughActionScope=a})},fresnelReflectorActionScope:ie.OnlyThisObject,setFresnelReflectorActionScope(a){i(l=>{l.fresnelReflectorActionScope=a})},heliostatActionScope:ie.OnlyThisObject,setHeliostatActionScope(a){i(l=>{l.heliostatActionScope=a})},updateSolarReceiverById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.Heliostat){c.towerId=l;break}else if(c.type===z.FresnelReflector){c.receiverId=l;break}}})},updateSolarReceiverAboveFoundation(a,l,s){ye.isHeliostatOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.Heliostat?u.towerId=s:u.type===z.FresnelReflector&&(u.receiverId=s))})},updateSolarReceiverForAll(a,l){ye.isHeliostatOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.Heliostat?c.towerId=l:c.type===z.FresnelReflector&&(c.receiverId=l))})},parabolicDishActionScope:ie.OnlyThisObject,setParabolicDishActionScope(a){i(l=>{l.parabolicDishActionScope=a})},updateModuleLengthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.ParabolicTrough){c.moduleLength=l;break}else if(c.type===z.FresnelReflector){c.moduleLength=l;break}}})},updateModuleLengthAboveFoundation(a,l,s){ye.isParabolicTroughOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.FresnelReflector)&&(u.moduleLength=s)})},updateModuleLengthForAll(a,l){ye.isParabolicTroughOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.FresnelReflector)&&(c.moduleLength=l)})},updateParabolaLatusRectumById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l);break}})},updateParabolaLatusRectumAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.ParabolicDish)&&(u.latusRectum=s)})},updateParabolaLatusRectumForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l)})},windTurbineActionScope:ie.OnlyThisObject,setWindTurbineActionScope(a){i(l=>{l.windTurbineActionScope=a})},wallActionScope:ie.OnlyThisObject,setWallActionScope(a){i(l=>{l.wallActionScope=a})},roofActionScope:ie.OnlyThisObject,setRoofActionScope(a){i(l=>{l.roofActionScope=a})},windowActionScope:ie.OnlyThisObject,setWindowActionScope(a){i(l=>{l.windowActionScope=a})},doorActionScope:ie.OnlyThisObject,setDoorActionScope(a){i(l=>{l.doorActionScope=a})},updateWallRelativeAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.relativeAngle=l;break}})},updateWallLeftJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.leftJoints=l;break}})},updateWallRightJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.rightJoints=l;break}})},updateWallLeftPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.leftPoint=[...l];break}})},updateWallRightPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.rightPoint=[...l];break}})},updateRoofRiseById(a,l,s){i(c=>{for(const u of c.elements)if(u.id===a&&u.type===z.Roof){u.rise=l,c.actionState.roofRise=l,s!==void 0&&(c.selectedElementHeight=s);break}})},updateRoofStructureById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&c.type===z.Roof){const u=c;u.roofStructure=l;break}})},updateInsideLightById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Light&&c.id===a){c.inside=l;break}})},updateInsideLightsByParentId(a,l){i(s=>{for(const c of s.elements)c.parentId===a&&c.type===z.Light&&(c.inside=l)})},setElementPosition(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].cx=l,u.elements[d].cy=s,c!==void 0&&(u.elements[d].cz=c);break}})},setElementNormal(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a||f.parentId===a){const p=u.elements[d];p.normal[0]=l,p.normal[1]=s,p.normal[2]=c}})},setElementSize(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].lx=l,u.elements[d].ly=s,c&&(u.elements[d].lz=c,u.selectedElementHeight=c);break}})},actionModeLock:!1,objectTypeToAdd:z.None,addElement(a,l,s){let c=null;const u="id"in a?a.id:rr;return i(d=>{switch(d.objectTypeToAdd){case z.Human:{const f=new ue().copy(l);if(u!==rr){const{rot:m,pos:y}=ye.getWorldDataById(u);f.sub(new ue(y.x,y.y,y.z)).applyEuler(new cn(0,0,-m))}const p=Qa.makeHuman(d.actionState.humanName,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Tree:{const f=new ue().copy(l);if(u!==rr){const{rot:m,pos:y}=ye.getWorldDataById(u);f.sub(new ue(y.x,y.y,y.z)).applyEuler(new cn(0,0,-m))}const p=Qa.makeTree(d.actionState.treeType,d.actionState.treeSpread,d.actionState.treeHeight,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Flower:{const f=new ue().copy(l);if(u!==rr){const{rot:m,pos:y}=ye.getWorldDataById(u);f.sub(new ue(y.x,y.y,y.z)).applyEuler(new cn(0,0,-m))}const p=Qa.makeFlower(d.actionState.flowerType,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Polygon:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makePolygon(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,f.type);c=m,d.elements.push(m);break}case z.Sensor:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeSensor(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=m,d.elements.push(m);break}case z.Light:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeLight(f,2,d.actionState.lightDistance,d.actionState.lightIntensity,d.actionState.lightColor,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=m,d.elements.push(m);break}case z.SolarPanel:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f,!0);let m=d.getPvModule(d.actionState.solarPanelModelName??g3);m||(m=d.getPvModule(g3));const y=Qa.makeSolarPanel(f,m,p.x,p.y,p.z,d.actionState.solarPanelOrientation??br.landscape,d.actionState.solarPanelPoleHeight??1,d.actionState.solarPanelPoleSpacing??3,d.actionState.solarPanelTiltAngle??0,d.actionState.solarPanelRelativeAzimuth??0,s,[0,0,0],d.actionState.solarPanelFrameColor??"white");c=y,d.elements.push(y);break}case z.ParabolicTrough:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeParabolicTrough(f,d.actionState.parabolicTroughReflectance,d.actionState.parabolicTroughAbsorptance,d.actionState.parabolicTroughOpticalEfficiency,d.actionState.parabolicTroughThermalEfficiency,d.actionState.parabolicTroughLatusRectum,d.actionState.parabolicTroughPoleHeight,d.actionState.parabolicTroughModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicTroughWidth);c=m,d.elements.push(m);break}case z.ParabolicDish:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeParabolicDish(f,d.actionState.parabolicDishReflectance,d.actionState.parabolicDishAbsorptance,d.actionState.parabolicDishOpticalEfficiency,d.actionState.parabolicDishThermalEfficiency,d.actionState.parabolicDishLatusRectum,d.actionState.parabolicDishPoleHeight,d.actionState.parabolicDishReceiverStructure,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicDishRimDiameter,d.actionState.parabolicDishRimDiameter);c=m,d.elements.push(m);break}case z.FresnelReflector:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeFresnelReflector(f,d.actionState.fresnelReflectorReceiver,d.actionState.fresnelReflectorReflectance,d.actionState.fresnelReflectorPoleHeight,d.actionState.fresnelReflectorModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.fresnelReflectorWidth);c=m,d.elements.push(m);break}case z.Heliostat:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),m=Qa.makeHeliostat(f,d.actionState.heliostatTower,d.actionState.heliostatReflectance,d.actionState.heliostatPoleHeight,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.heliostatLength,d.actionState.heliostatWidth);c=m,d.elements.push(m);break}case z.WindTurbine:{const f=a,p=ye.relativeCoordinates(l.x,l.y,0,f),m=Qa.makeWindTurbine(f,d.actionState.windTurbineBirdSafeDesign??wc.None,d.actionState.windTurbineBladeColor??j9,d.actionState.windTurbineStripeColor??B9,d.actionState.windTurbineNumberOfBlades??3,d.actionState.windTurbineInitialRotorAngle??0,d.actionState.windTurbineRelativeYawAngle??0,d.actionState.windTurbinePitchAngle??Math.PI/18,d.actionState.windTurbineBladeRadius??10,d.actionState.windTurbineBladeRootRadius??.3,d.actionState.windTurbineBladeMaximumChordLength??1,d.actionState.windTurbineBladeMaximumChordRadius??3,d.actionState.windTurbineTowerRadius??.5,d.actionState.windTurbineTowerHeight??20,d.actionState.windTurbineHubRadius??.75,d.actionState.windTurbineHubLength??1.5,p.x,p.y,0);c=m,d.elements.push(m);break}case z.Foundation:{const f=Qa.makeFoundation(l.x,l.y,d.actionState.foundationHeight,d.actionState.foundationColor,d.actionState.foundationTexture);c=f,d.elements.push(f);break}case z.Cuboid:{const f=Qa.makeCuboid(l.x,l.y,d.actionState.cuboidHeight,d.actionState.cuboidFaceColors,d.actionState.cuboidFaceTextures);c=f,d.elements.push(f);break}case z.Wall:{const f=a,p=ye.wallRelativePosition(new ue(l.x,l.y),f),m=Qa.makeWall(f,p.x,p.y,p.z,s);d.elements.push(m),d.selectedElement=m,c=m;break}case z.BatteryStorage:{const f=a,{x:p,y:m,z:y}=ye.relativeCoordinates(l.x,l.y,l.z,f,!0),w=Qa.makeBatteryStorage(f,p,m,y);d.elements.push(w),d.selectedElement=w,c=w;break}}c&&(d.selectedElementIdSet.clear(),d.selectedElementIdSet.add(c.id),d.selectedElement=c)}),c},elementsToPaste:[],deletedElements:[],clearDeletedElements(){i(a=>{a.deletedElements=[]})},pastePoint:new ue,pasteNormal:void 0,copyElementById(a){i(l=>{l.elementsToPaste=[];for(const s of l.elements)if(s.id===a){if(s.type===z.Polygon){const c=ye.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y,l.elementsToPaste.push(s)}else l.elementsToPaste.push(s);break}for(const s of l.elements)if(ye.isChild(a,s.id)){if(s.type===z.Polygon){const c=ye.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y}l.elementsToPaste.push(s)}})},removeSelectedElements(){const a=e().selectedElementIdSet;if(a.size===0)return[];const l=Array.from(a),s=new Set,c=new Set;for(const u of e().elements)if(a.has(u.id))s.add(u),c.add(u.id);else for(const d of l)ye.isChild(d,u.id)&&(s.add(u),c.add(u.id));return i(u=>{u.autoDeletedRoofs=[],u.deletedElements=Array.from(s),u.elements=u.elements.filter(d=>{var f,p;if(c.has(d.id)){switch(d.type){case z.Wall:{const m=d;let y="",w="";m.leftJoints.length>0&&(y=((f=u.getElementById(m.leftJoints[0]))==null?void 0:f.id)??""),m.rightJoints.length>0&&(w=((p=u.getElementById(m.rightJoints[0]))==null?void 0:p.id)??"");for(const x of u.elements)x.id===y?x.rightJoints=[]:x.id===w&&(x.leftJoints=[]);u.updateWallMapOnFoundationFlag=!u.updateWallMapOnFoundationFlag;break}case z.Roof:{u.deletedRoofIdSet.add(d.id),In.getState().deleteRoofSegmentVertices(d.id),In.getState().deleteRoofSegmentVerticesWithoutOverhang(d.id);break}}return!1}else return!0})}),Array.from(s)},removeElementById(a,l,s=!0,c){const u=e().elements.filter(d=>d.id===a||ye.isChild(a,d.id));return i(d=>{var f,p;for(const m of d.elements)if(m.id===a){if(l)if(m.type===z.Polygon){const y=ye.calculatePolygonCentroid(m.vertices);m.cx=y.x,m.cy=y.y,d.elementsToPaste=[m]}else d.elementsToPaste=[m];else c||(d.deletedElements=[m]);switch(m.selected=!1,m.type){case z.Roof:{const y=m;d.deletedRoofId=m.id,d.deletedRoofIdSet.add(m.id),In.getState().deleteRoofSegmentVertices(a),In.getState().deleteRoofSegmentVerticesWithoutOverhang(a),c&&(d.autoDeletedRoofs?d.autoDeletedRoofs.push(y):d.autoDeletedRoofs=[y],d.autoDeletedRoofIdSet.add(y.id));break}case z.Wall:{const y=m;let w="",x="";y.leftJoints.length>0&&(w=((f=d.getElementById(y.leftJoints[0]))==null?void 0:f.id)??""),y.rightJoints.length>0&&(x=((p=d.getElementById(y.rightJoints[0]))==null?void 0:p.id)??"");for(const C of d.elements)C.id===w?C.rightJoints=[]:C.id===x&&(C.leftJoints=[]);d.elements=d.elements.filter(C=>!(C.type===z.Roof&&C.wallsId.length===0)),d.updateWallMapOnFoundationFlag=!d.updateWallMapOnFoundationFlag,d.deletedWallId=m.id;break}case z.Foundation:{d.deletedFoundationId=m.id;break}case z.Cuboid:{d.deletedCuboidId=m.id;break}}break}if(c)for(const m of d.elements)ye.isChild(a,m.id)&&(d.autoDeletedChild?d.autoDeletedChild.push(m):d.autoDeletedChild=[m]);else if(l)for(const m of d.elements)ye.isChild(a,m.id)&&d.elementsToPaste.push(m);else for(const m of d.elements)ye.isChild(a,m.id)&&d.deletedElements.push(m);d.elements=d.elements.filter(m=>m.id===a||m.parentId===a||m.foundationId===a||ye.isChild(a,m.id)?(m.type===z.Roof&&(In.getState().deleteRoofSegmentVertices(a),In.getState().deleteRoofSegmentVerticesWithoutOverhang(a)),!1):!0),d.selectedElementIdSet.delete(a),s&&(d.selectedElement=null,d.selectedElementIdSet.clear())}),u},removeElementsByType(a){i(l=>{a===z.Foundation?l.elements=l.elements.filter(s=>s.locked||s.type!==z.Foundation&&!s.foundationId?!0:(s.type===z.Roof&&(In.getState().deleteRoofSegmentVertices(s.id),In.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1)):l.elements=l.elements.filter(s=>s.locked||s.type!==a?!0:(s.type===z.Roof&&(In.getState().deleteRoofSegmentVertices(s.id),In.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1))})},countElementsByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===a&&!c.locked&&s++;else for(const c of e().elements)c.type===a&&s++;return s},countSolarStructuresByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===z.Foundation&&!c.locked&&c.solarStructure===a&&s++;else for(const c of e().elements)c.type===z.Foundation&&c.solarStructure===a&&s++;return s},countObservers(){let a=0;for(const l of e().elements)l.type===z.Human&&l.observer&&a++;return a},removeElementsByReferenceId(a,l){i(s=>{if(l){s.deletedElements=[];for(const c of s.elements)c.referenceId===a&&s.deletedElements.push(c)}s.elements=s.elements.filter(c=>c.referenceId!==a)})},countElementsByReferenceId(a){let l=0;for(const s of e().elements)s.referenceId===a&&l++;return l},getChildren(a){const l=[];for(const s of e().elements)s.parentId===a&&l.push(s);return l},getChildrenOfType(a,l){const s=[];for(const c of e().elements)c.type===a&&c.parentId===l&&s.push(c);return s},removeAllChildElementsByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.parentId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},removeAllElementsOnFoundationByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.foundationId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},countAllElements(a){let l=0;if(a)for(const s of e().elements)s.locked||l++;else l=e().elements.length;return l},countAllElementsByType(a){const l=new wMe;for(const s of e().elements)if(s.locked?l.lockedCount++:l.unlockedCount++,!(a&&s.locked))switch(s.type){case z.Foundation:{s.solarStructure===Nn.UpdraftTower&&l.solarUpdraftTowerCount++,l.foundationCount++;break}case z.Cuboid:{l.cuboidCount++;break}case z.Wall:{l.wallCount++;break}case z.Window:{l.windowCount++;break}case z.Door:{l.doorCount++;break}case z.Human:{l.humanCount++;break}case z.Tree:{l.treeCount++;break}case z.Flower:{l.flowerCount++;break}case z.Polygon:{l.polygonCount++;break}case z.Sensor:{l.sensorCount++;break}case z.Light:{s.inside?l.insideLightCount++:l.outsideLightCount++;break}case z.SolarPanel:{l.solarPanelCount++;const c=s,u=e().getPvModule(c.pvModelName);u&&(l.solarPanelModuleCount+=ye.countSolarPanelsOnRack(c,u));break}case z.ParabolicDish:{l.parabolicDishCount++;break}case z.ParabolicTrough:{l.parabolicTroughCount++;break}case z.FresnelReflector:{l.fresnelReflectorCount++;break}case z.Heliostat:{l.heliostatCount++;break}case z.WindTurbine:{l.windTurbineCount++;break}}return l},countAllOffspringsByTypeAtOnce(a,l){const s=new wMe;for(const c of e().elements){const u=c.parentId===a||c.foundationId===a;if(u&&(c.locked?s.lockedCount++:s.unlockedCount++),(l||!c.locked)&&u)switch(c.type){case z.Foundation:{c.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTowerCount++,s.foundationCount++;break}case z.Cuboid:{s.cuboidCount++;break}case z.Wall:{s.wallCount++;break}case z.Window:{s.windowCount++,c.locked&&s.lockedWindowCount++;break}case z.Door:{s.doorCount++,c.locked&&s.lockedDoorCount++;break}case z.Human:{s.humanCount++;break}case z.Tree:{s.treeCount++;break}case z.Flower:{s.flowerCount++;break}case z.Polygon:{s.polygonCount++,c.locked&&s.lockedPolygonCount++;break}case z.Sensor:{s.sensorCount++,c.locked&&s.lockedSensorCount++;break}case z.Light:{c.inside?s.insideLightCount++:s.outsideLightCount++,c.locked&&s.lockedLightCount++;break}case z.SolarPanel:{s.solarPanelCount++,c.locked&&s.lockedSolarPanelCount++;const d=c,f=e().getPvModule(d.pvModelName);f&&(s.solarPanelModuleCount+=ye.countSolarPanelsOnRack(d,f));break}case z.ParabolicDish:{s.parabolicDishCount++;break}case z.ParabolicTrough:{s.parabolicTroughCount++;break}case z.FresnelReflector:{s.fresnelReflectorCount++;break}case z.Heliostat:{s.heliostatCount++;break}case z.WindTurbine:{s.windTurbineCount++,c.locked&&s.lockedWindTurbineCount++;break}}}return s},countSolarPanelsOnRack(a){let l=0;for(const s of e().elements)if(s.id===a&&s.type===z.SolarPanel){const c=s,u=e().getPvModule(c.pvModelName);if(u){l=ye.countSolarPanelsOnRack(c,u);break}}return l},copyCutElements(){const a=[],l=new Map,s=new Map,c=new Map;for(let u=0;um.id===d.parentId);if(p){const m=l.get(p.id);m&&(e().getElementById(d.id)?(f=Pl.clone(m,d,d.cx,d.cy,d.cz,d.type===z.Polygon),((f==null?void 0:f.type)===z.SolarPanel||(f==null?void 0:f.type)===z.SolarWaterHeater)&&(f.rotation=[...d.rotation],f.normal=[...d.normal])):f=JSON.parse(JSON.stringify(d)))}}f&&(l.set(d.id,f),s.set(d.id,f.id),c.set(f.id,d.id),a.push(f))}for(const u of a){if(u.type===z.Roof){const d=c.get(u.id);if(d)for(const f of e().elementsToPaste)f.id===d&&(u.wallsId=f.wallsId.map(p=>s.get(p)))}if(u.type===z.Wall){const d=c.get(u.id);if(d){for(const f of e().elementsToPaste)if(f.id===d&&f.type===z.Wall){const p=f,m=s.get(p.leftJoints[0]);m&&(u.leftJoints=[m]);const y=s.get(p.rightJoints[0]);if(y&&(u.rightJoints=[y]),p.roofId){const w=s.get(p.roofId);w&&(u.roofId=w)}break}}}}return a},pasteElementsToPoint(){const a=[];return i(l=>{if(l.elementsToPaste.length===1){let s=l.pastePoint;const c=l.elementsToPaste[0];let u=l.selectedElement;const d=l.getParent(c);if(u){if(u.type===z.Polygon){const p=l.getParent(u);p&&(u=p,c.parentId=u.id,ye.isPositionRelative(c.type)&&(s=ye.relativeCoordinates(s.x,s.y,s.z,u)))}else if(u.type===z.Roof){if(u.parentId){const p=l.getElementById(u.parentId);p&&(c.type===z.SolarPanel||c.type===z.SolarWaterHeater?s.sub(new ue(p.cx,p.cy,p.cz)).applyEuler(new cn(0,0,-p.rotation[2])):(s.sub(new ue(p.cx,p.cy,p.lz)).applyEuler(new cn(0,0,-p.rotation[2])),c.type!==z.Window&&(s.setX(s.x/p.lx),s.setY(s.y/p.ly))))}}else if(u.type===z.Cuboid){if(c.type===z.Cuboid){const{pos:p}=ye.getWorldDataById(u.id);s.sub(p)}else ye.isPositionRelative(c.type)&&(c.type===z.SolarPanel?s=ye.relativeCoordinates(s.x,s.y,s.z,u,!0):s=ye.relativeCoordinates(s.x,s.y,s.z,u));c.parentId=u.id}else u.type===z.Wall?s=ye.relativeCoordinates(s.x,s.y,s.z,u):d&&d.type&&c.type!==z.Foundation&&(c.parentId=u.id,ye.isPositionRelative(c.type)&&(c.type===z.SolarPanel||c.type===z.BatteryStorage?s=ye.relativeCoordinates(s.x,s.y,s.z,u,!0):s=ye.relativeCoordinates(s.x,s.y,s.z,u)));c.type===z.Wall&&s.set(s.x*u.lx,s.y*u.ly,0)}const f=Pl.clone(u,c,s.x,s.y,s.z,!1,l.pasteNormal,d);if(f){l.pasteNormal&&(u==null?void 0:u.type)===z.Cuboid&&(f.normal=l.pasteNormal.toArray(),f.rotation=Rn.getRotationFromNormal(l.pasteNormal));const p={lng:l.language};let m=!1;switch(f.type){case z.Cuboid:{const y=C=>{const P=[];for(const A of e().elements)if(A.parentId===C.id)switch(P.push(A),A.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:P.push(...y(A))}return P},w=y(c),x=new Map;a.push(f),x.set(c.id,f);for(const C of w){const P=x.get(C.parentId);if(P){const A=Pl.clone(P,C,C.cx,C.cy,C.cz,C.type===z.Polygon);A&&(f.normal&&(A.normal=[...C.normal]),a.push(A),x.set(C.id,A))}}l.elements.push(...a),l.elementsToPaste=[f],m=!1;break}case z.Foundation:{const y=new Map,w=new Map;for(const x of l.elements)if(x.parentId===c.id){const C=Pl.clone(f,x,x.cx,x.cy,x.cz,x.type===z.Polygon);if(C&&(f.normal&&(C.normal=[...x.normal]),a.push(C),(C==null?void 0:C.type)===z.Wall||(C==null?void 0:C.type)===z.Roof)){y.set(C.id,x.id),w.set(x.id,C.id);for(const P of l.elements)if(P.parentId===x.id){const A=Pl.clone(C,P,P.cx,P.cy,P.cz);A&&(x.normal&&(A.normal=[...P.normal]),a.push(A))}}}l.elements.push(...a),m=!0;for(const x of l.elements){if(x.type===z.Roof){const C=y.get(x.id);if(C){const P=e().getElementById(C);P&&(x.wallsId=P.wallsId.map(A=>w.get(A)))}}if(x.type===z.Wall){const C=y.get(x.id);if(C){for(const P of l.elements)if(P.id===C&&P.type===z.Wall){const A=P,S=w.get(A.leftJoints[0]);S&&(x.leftJoints=[S]);const v=w.get(A.rightJoints[0]);if(v&&(x.rightJoints=[v]),A.roofId){const b=w.get(A.roofId);b&&(x.roofId=b)}break}}}}break}case z.SolarPanel:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(ye.checkElementOnWallState(f,u)){case ya.Valid:{const y=u.relativeAngle-$t;f.normal=[Math.cos(y),Math.sin(y),0],m=!0;break}case ya.OverLap:co(B.t("message.CannotPasteBecauseOfOverlap",p));break;case ya.OutsideBoundary:co(B.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const y=l.getElementById(f.foundationId);if(y){const w=Rn.getSolarPanelVerticesOnRoof(f,y),x=Rn.getRoofBoundaryVertices(u);if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopElementCollisionCheck(f,y,w)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(B.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&ye.isIdentical(f.normal,fs))&&ye.isSolarCollector(f)?(m=ye.isSolarCollectorWithinHorizontalSurface(f,u),m||co(B.t("message.CannotPasteOutsideBoundary",p))):m=!0;break}case z.SolarWaterHeater:{if(u&&u.type===z.Roof){if(f.foundationId){const y=l.getElementById(f.foundationId);if(y){const w=Rn.getSolarWaterHeaterVerticesOnRoof(f,y),x=Rn.getRoofBoundaryVertices(u);if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopElementCollisionCheck(f,y,w)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0,l.updateElementOnRoofFlag=!0}}break}break}case z.Sensor:case z.Light:case z.WindTurbine:case z.ParabolicDish:case z.Heliostat:case z.FresnelReflector:case z.ParabolicTrough:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(ye.checkElementOnWallState(f,u)){case ya.Valid:{const y=u.relativeAngle-$t;f.normal=[Math.cos(y),Math.sin(y),0],m=!0;break}case ya.OverLap:co(B.t("message.CannotPasteBecauseOfOverlap",p));break;case ya.OutsideBoundary:co(B.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const y=l.getElementById(f.foundationId);if(y){const w=Rn.getSolarPanelVerticesOnRoof(f,y),x=Rn.getRoofBoundaryVertices(u);if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopElementCollisionCheck(f,y,w)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(B.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&ye.isIdentical(f.normal,fs))&&ye.isSolarCollector(f)?(m=ye.isSolarCollectorWithinHorizontalSurface(f,u),m||co(B.t("message.CannotPasteOutsideBoundary",p))):m=!0;break}case z.Wall:{const y=new ue(f.cx,f.cy,0),w=new ue(f.lx/2,0,0),x=new ue(-f.lx/2,0,0),C=f,P=new cn(0,0,C.relativeAngle);C.leftPoint=y.clone().add(x.applyEuler(P)).toArray(),C.rightPoint=y.clone().add(w.applyEuler(P)).toArray(),C.roofId=void 0,C.leftRoofHeight=void 0,C.rightRoofHeight=void 0,C.centerLeftRoofHeight=void 0,C.centerRightRoofHeight=void 0,C.centerRoofHeight=void 0;for(const A of l.elements)if(A.parentId===c.id){const S=Pl.clone(f,A,A.cx,A.cy,A.cz,A.type===z.Polygon);S&&(f.normal&&(S.normal=[...A.normal]),a.push(S))}l.elements.push(...a),l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,m=!0;break}case z.Door:case z.Window:{if((u==null?void 0:u.type)===z.Wall)switch(ye.checkElementOnWallState(f,u)){case ya.Valid:m=!0;break;case ya.OverLap:co(B.t("message.CannotPasteBecauseOfOverlap",p));break;case ya.OutsideBoundary:co(B.t("message.CannotPasteOutsideBoundary",p));break}else if((u==null?void 0:u.type)===z.Roof){const y=Rn.getRotationOnRoof(u.id,s);y&&(f.rotation=[...y]);const w=Rn.getWindowVerticesOnRoof(f),x=Rn.getRoofSegmentBoundary(u.id,s);if(!x)break;if(!Rn.rooftopElementBoundaryCheck(w,x)){co(B.t("message.CannotPasteOutsideBoundary",p));break}if(!Rn.rooftopWindowCollisionCheck(f.id,w,u.id)){co(B.t("message.CannotPasteBecauseOfOverlap",p));break}m=!0}break}default:if(m=!0,ye.isPlantOrHuman(f))if(u){const y=l.getParent(f);if(y){const w=ye.relativePoint(l.pastePoint,y);f.cx=w.x,f.cy=w.y,f.cz=w.z}}else f.parentId=rr}m&&(l.elements.push(f),a.push(f))}}else if(l.elementsToPaste.length>1){let s=l.pastePoint;const c=l.copyCutElements();if(c.length>0){if(c[0].type===z.Cuboid){const u=l.selectedElement;if(u&&u.type===z.Cuboid){const{pos:d}=ye.getWorldDataById(u.id);s.sub(d),c[0].parentId=u.id}}else if(c[0].type===z.Wall){const u=l.selectedElement;u&&u.type===z.Foundation&&(s=ye.relativeCoordinates(s.x,s.y,s.z,u),s.set(s.x*u.lx,s.y*u.ly,0),c[0].parentId=u.id,c[0].foundationId=u.id)}c[0].cx=s.x,c[0].cy=s.y,c[0].cz=s.z,c[0].type===z.Foundation?c[0].cz+=c[0].lz/2:c[0].type===z.Cuboid&&(c[0].cz=c[0].lz/2),l.elements.push(...c),a.push(...c)}}a.length>0&&(l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(a[0].id),l.selectedElement=a[0])}),a},pasteElementsByKey(){const a=[];return i(l=>{if(l.elementsToPaste.length>0){const s=l.elementsToPaste[0],c=l.getParent(s),u=Pl.clone(c,s,s.cx,s.cy,s.cz);if(u){let d=!1;switch(u.type){case z.Door:case z.Window:{if(c){const f=u.lx/2;if(u.cx+=f*3,c.type===z.Wall)for(;u.cx+f<.5;)if(ye.checkElementOnWallState(u,c)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx+=f;else if(c.type===z.Roof){const p=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));p&&(u.rotation=[...p]);let m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy));const w=Rn.getRoofBoundaryVertices(c);for(;Rn.rooftopElementBoundaryCheck(m,w);)if(y&&Rn.rooftopElementBoundaryCheck(m,y)&&Rn.rooftopWindowCollisionCheck(u.id,m,c.id)){l.elements.push(u),d=!0;break}else{u.cx+=f/2;const x=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));x&&(u.rotation=[...x]),m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy))}}if(!d){u.cx=s.cx-f*3;const p=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));if(p&&(u.rotation=[...p]),c.type===z.Wall){for(;u.cx-f>-.5;)if(c.type===z.Wall)if(ye.checkElementOnWallState(u,c)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx-=f}else if(c.type===z.Roof){let m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy));const w=Rn.getRoofBoundaryVertices(c);for(;Rn.rooftopElementBoundaryCheck(m,w);)if(y&&Rn.rooftopElementBoundaryCheck(m,y)&&Rn.rooftopWindowCollisionCheck(u.id,m,c.id)){l.elements.push(u),d=!0;break}else{u.cx-=f;const x=Rn.getRotationOnRoof(c.id,new ue(u.cx,u.cy));x&&(u.rotation=[...x]),m=Rn.getWindowVerticesOnRoof(u),y=Rn.getRoofSegmentBoundary(c.id,new ue(u.cx,u.cy))}}}if(!d){const p={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",p))}c.type===z.Roof&&d&&(l.updateElementOnRoofFlag=!0)}break}case z.Human:{u.cx+=1,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.Tree:case z.Flower:{u.cx+=u.lx,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.SolarPanel:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const y=u.lx/f.lx/2;for(u.cx+=y*3;u.cx+y<.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx+=y;if(!d)for(u.cx=s.cx-y*3;u.cx-y>-.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=y;if(!d){const w={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",w))}break}else if(f.type===z.Roof){if(s.foundationId){const y=l.getElementById(s.foundationId);if(y){const w=Rn.getRoofBoundaryVertices(f),x=u.lx*1.25;for(u.cx+=x;u.cx+u.lx/2-y.lx/2;){const C=Rn.getSolarPanelVerticesOnRoof(u,y);if(Rn.rooftopElementBoundaryCheck(C,w)&&Rn.rooftopElementCollisionCheck(u,y,C)){l.elements.push(u),d=!0;break}else u.cx-=x}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",C))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation]);const p=l.findNearestSibling(s.id);if(p){const y=l.getElementById(p);if(y){const w=u.cx,x=u.cy,C=u.cz,P=y.cx-s.cx,A=y.cy-s.cy,S=y.cz-s.cz;u.cx=y.cx+P,u.cy=y.cy+A,u.cz=y.cz+S,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-A,u.cz=s.cz-S,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*A,u.cz=s.cz-2*S,l.overlapWithSibling(u)&&(u.cx=w-P,u.cy=x-A,u.cz=C-S)))}else u.cx+=1.25*u.lx}else u.cx+=1.25*u.lx;const m={lng:l.language};l.overlapWithSibling(u)?co(B.t("message.CannotPasteBecauseOfOverlap",m)):f.type===z.Foundation||f.type===z.Cuboid&&ye.isIdentical(u.normal,fs)?ye.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(B.t("message.CannotPasteOutsideBoundary",m)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.SolarWaterHeater:{if(u.parentId){const f=l.getParent(u);if(f)if(f.type===z.Roof){if(s.foundationId){const p=l.getElementById(s.foundationId);if(p){const m=Rn.getRoofBoundaryVertices(f),y=u.lx*1.25;for(u.cx+=y;u.cx+u.lx/2-p.lx/2;){const w=Rn.getSolarWaterHeaterVerticesOnRoof(u,p);if(Rn.rooftopElementBoundaryCheck(w,m)&&Rn.rooftopElementCollisionCheck(u,p,w)){l.elements.push(u),d=!0;break}else u.cx-=y}if(d)l.updateElementOnRoofFlag=!0;else{const w={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",w))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation])}break}case z.FresnelReflector:case z.Heliostat:case z.ParabolicDish:case z.ParabolicTrough:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const y=u.lx/f.lx/2;for(u.cx+=y*3;u.cx+y<.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),d=!0;break}else u.cx+=y;if(!d)for(u.cx=s.cx-y*3;u.cx-y>-.5;)if(ye.checkElementOnWallState(u,f)===ya.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=y;if(!d){const w={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",w))}break}else if(f.type===z.Roof){if(s.foundationId){const y=l.getElementById(s.foundationId);if(y){const w=Rn.getRoofBoundaryVertices(f),x=u.lx/y.lx/2;for(u.cx+=x*1.25;u.cx+x<.5;){const C=Rn.getSolarPanelVerticesOnRoof(u,y);if(Rn.rooftopElementBoundaryCheck(C,w)&&Rn.rooftopElementCollisionCheck(u,y,C)){l.elements.push(u),d=!0;break}else u.cx+=x*1.25}if(!d)for(u.cx=s.cx-x*1.25;u.cx-x>-.5;){const C=Rn.getSolarPanelVerticesOnRoof(u,y);if(Rn.rooftopElementBoundaryCheck(C,w)&&Rn.rooftopElementCollisionCheck(u,y,C)){l.elements.push(u),d=!0;break}else u.cx-=x*1.25}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(B.t("message.CannotPasteOutsideBoundary",C))}}}break}const p=l.findNearestSibling(s.id);if(p){const y=l.getElementById(p);if(y){const w=u.cx,x=u.cy,C=u.cz,P=y.cx-s.cx,A=y.cy-s.cy,S=y.cz-s.cz;u.cx=y.cx+P,u.cy=y.cy+A,u.cz=y.cz+S,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-A,u.cz=s.cz-S,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*A,u.cz=s.cz-2*S,l.overlapWithSibling(u)&&(u.cx=w-P,u.cy=x-A,u.cz=C-S)))}else u.cx+=(.01+u.lx)/f.lx}else u.cx+=(.01+u.lx)/f.lx;const m={lng:l.language};l.overlapWithSibling(u)?co(B.t("message.CannotPasteBecauseOfOverlap",m)):f.type===z.Foundation||f.type===z.Cuboid&&ye.isIdentical(u.normal,fs)?ye.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(B.t("message.CannotPasteOutsideBoundary",m)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.Sensor:case z.Light:case z.WindTurbine:{if(u.parentId){const f=l.getParent(u);f&&(u.cx+=u.lx/f.lx),u.cx<.5&&(l.elements.push(u),l.elementsToPaste=[u],d=!0)}break}case z.Polygon:{const f=u;for(const p of f.vertices)p.x+=.1;f.cx+=.1,l.elements.push(f),l.elementsToPaste=[f],d=!0;break}case z.Cuboid:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=y=>{const w=[];for(const x of e().elements)if(x.parentId===y.id)switch(w.push(x),x.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:w.push(...f(x))}return w},p=f(s),m=new Map;a.push(u),m.set(s.id,u);for(const y of p){const w=m.get(y.parentId);if(w){const x=Pl.clone(w,y,y.cx,y.cy,y.cz,y.type===z.Polygon);x&&(u.normal&&(x.normal=[...y.normal]),a.push(x),m.set(y.id,x))}}l.elements.push(...a),l.elementsToPaste=[u],l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),l.elementsToPaste=[...f],a.push(...f),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!1;break}case z.Foundation:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=new Map,p=new Map;for(const m of l.elements)if(m.parentId===s.id&&m.parentId!==m.id){const y=Pl.clone(u,m,m.cx,m.cy,m.cz,m.type===z.Polygon);if(y&&(u.normal&&(y.normal=[...m.normal]),a.push(y),(y==null?void 0:y.type)===z.Wall||(y==null?void 0:y.type)===z.Roof)){f.set(y.id,m.id),p.set(m.id,y.id);for(const w of l.elements)if(w.parentId===m.id){const x=Pl.clone(y,w,w.cx,w.cy,w.cz);x&&(m.normal&&(x.normal=[...w.normal]),a.push(x))}}}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u];for(const m of l.elements){if(m.type===z.Roof){const y=f.get(m.id);if(y){const w=e().getElementById(y);w&&(m.wallsId=w.wallsId.map(x=>p.get(x)))}}if(m.type===z.Wall){const y=f.get(m.id);if(y){for(const w of l.elements)if(w.id===y&&w.type===z.Wall){const x=w,C=p.get(x.leftJoints[0]);C&&(m.leftJoints=[C]);const P=p.get(x.rightJoints[0]);if(P&&(m.rightJoints=[P]),x.roofId){const A=p.get(x.roofId);A&&(m.roofId=A)}break}}}}}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),a.push(...f),l.elementsToPaste=f,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!0;break}case z.Wall:{const f=u,p=new ue(1,-1,0).applyEuler(new cn(0,0,f.relativeAngle));if(u.cx+=p.x,u.cy+=p.y,l.elementsToPaste.length===1){const m=new ue(u.cx,u.cy,0),y=new ue(u.lx/2,0,0),w=new ue(-u.lx/2,0,0),x=new cn(0,0,f.relativeAngle);f.leftPoint=m.clone().add(w.applyEuler(x)).toArray(),f.rightPoint=m.clone().add(y.applyEuler(x)).toArray(),f.roofId=void 0,f.leftRoofHeight=void 0,f.rightRoofHeight=void 0,f.centerLeftRoofHeight=void 0,f.centerRightRoofHeight=void 0,f.centerRoofHeight=void 0;for(const C of l.elements)if(C.parentId===s.id){const P=Pl.clone(u,C,C.cx,C.cy,C.cz,C.type===z.Polygon);P&&(u.normal&&(P.normal=[...C.normal]),a.push(P))}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u]}else if(l.elementsToPaste.length>1){const m=l.copyCutElements();m.length>0&&(m[0].cx+=p.x,m[0].cy-=p.y,l.elements.push(...m),a.push(...m),l.elementsToPaste=m,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(m[0].id),l.selectedElement=m[0])}l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,d=!0;break}case z.BatteryStorage:u.cx+=u.lx*1.25,l.elements.push(u),l.elementsToPaste=[u],d=!0}l.elementsToPaste.length===1&&d&&(a.push(u),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u)}}}),a},supportedPvModules:{},customPvModules:{},loadSupportedPvModules(){const a=[];CY.parse(u9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c={name:s[0].trim(),brand:s[1].trim(),cellType:s[2].trim(),efficiency:parseFloat(s[3].trim()),length:parseFloat(s[4].trim()),nominalLength:parseFloat(s[5].trim()),width:parseFloat(s[6].trim()),nominalWidth:parseFloat(s[7].trim()),thickness:parseFloat(s[8].trim()),m:parseFloat(s[9].trim()),n:parseFloat(s[10].trim()),pmax:parseFloat(s[11].trim()),vmpp:parseFloat(s[12].trim()),impp:parseFloat(s[13].trim()),voc:parseFloat(s[14].trim()),isc:parseFloat(s[15].trim()),pmaxTC:parseFloat(s[16].trim()),noct:parseFloat(s[17].trim()),weight:parseFloat(s[18].trim()),color:s[19].trim(),shadeTolerance:s[20].trim(),bifacialityFactor:parseFloat(s[21].trim())};a.push(c)}console.log(a.length+" PV models loaded"),i(s=>{for(const c of a)s.supportedPvModules[c.name]=c})}})},getPvModule(a){let l=e().supportedPvModules[a];return l||(l=e().customPvModules[a]),l},addCustomPvModule(a){i(l=>{l.customPvModules[a.name]=a})},weatherModel:void 0,setWeatherModel(a){i(l=>{l.weatherModel=l.weatherData[a]})},weatherData:{},loadWeatherData(){if(Object.keys(e().weatherData).length>0)return;const a=[];CY.parse(l9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[],u=[],d=[];for(let p=5;p<29;p++)(p-5)%2===0?c.push(parseFloat(s[p].trim())):u.push(parseFloat(s[p].trim()));for(let p=29;p<41;p++)d.push(parseFloat(s[p].trim()));const f={city:s[0].trim(),country:s[1].trim(),longitude:parseFloat(s[2].trim()),latitude:parseFloat(s[3].trim()),elevation:parseFloat(s[4].trim()),lowestTemperatures:c,highestTemperatures:u,sunshineHours:d};a.push(f)}i(s=>{for(const c of a)s.weatherData[c.city+", "+c.country]=c;s.weatherModel=s.weatherData["Boston MA, USA"]}),console.log(a.length+" weather datasets loaded")}})},getWeather(a){const l=e().weatherModel;return l||e().weatherData[a]},horizontalSolarRadiationData:{},loadHorizontalSolarRadiationData(){const a=[];CY.parse(s9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.horizontalSolarRadiationData[c.city+", "+c.country]=c})}})},getHorizontalSolarRadiation(a){return e().horizontalSolarRadiationData[a]},verticalSolarRadiationData:{},loadVerticalSolarRadiationData(){const a=[];CY.parse(c9t,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.verticalSolarRadiationData[c.city+", "+c.country]=c})}})},getVerticalSolarRadiation(a){return e().verticalSolarRadiationData[a]},getClosestCity(a,l){let s=Number.MAX_VALUE,c=null,u;const d=e().weatherData;for(const f in d)Object.hasOwn(d,f)&&(u=ye.getDistance(l,a,d[f].longitude,d[f].latitude),u{l.sunlightDirection=a.clone()})},cameraDirection:new ue,getCameraDirection(){return e().cameraDirection},updateSceneRadiusFlag:!1,updateSceneRadius(){i(a=>{a.updateSceneRadiusFlag=!a.updateSceneRadiusFlag})},sceneRadius:100,setSceneRadius(a){i(l=>{l.sceneRadius=a})},selectedElementAngle:0,selectedElementHeight:0,selectedElementX:0,selectedElementY:0,isAddingElement(){return!!(e().addedCuboidId||e().addedFoundationId||e().addedWallId||e().addedWindowId||e().addedDoorId)},addedFoundationId:null,deletedFoundationId:null,addedCuboidId:null,deletedCuboidId:null,addedWallId:null,deletedWallId:null,updateWallMapOnFoundationFlag:!1,updateWallMapOnFoundation(){i(a=>{a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},updateElementOnRoofFlag:!1,setUpdateElementOnRoofFlag(a){i(l=>{l.updateElementOnRoofFlag=a})},updateElementOnRoofFn(){i(a=>{a.updateElementOnRoofFlag=!0})},addedWindowId:null,addedDoorId:null,addedRoofIdSet:new Set,deletedRoofId:null,deletedRoofIdSet:new Set,autoDeletedRoofs:null,autoDeletedRoofIdSet:new Set,autoDeletedChild:null,getAutoDeletedElements(){const a=e().autoDeletedRoofs,l=e().autoDeletedChild;return!a||!l?null:[...a,...l]},deleteAddedRoofId(a){i(l=>{l.addedRoofIdSet.delete(a)})},groupActionMode:!1,setGroupActionMode(a){i(l=>{l.groupActionMode=a})},groupActionUpdateFlag:!1,locale:Yye,localFileDialogRequested:!1,loggable:!1,actionInfo:void 0,logAction(a){i(l=>{l.actionInfo={name:a,timestamp:new Date().getTime()}})},currentUndoable:void 0,showCloudFileTitleDialog:!1,showCloudFileTitleDialogFlag:!1,localContentToImportAfterCloudFileUpdate:void 0,enableFineGrid:!1,setEnableFineGrid(a){i(l=>{l.enableFineGrid=a})}}},{name:"aladdin-storage",storage:aVe(()=>new URLSearchParams(window.location.search).get("viewonly")==="true"?sessionStorage:localStorage),skipHydration:ye.isOpenFromURL(),partialize:t=>({language:t.language,animate24Hours:t.animate24Hours,floatingWindowOpacity:t.floatingWindowOpacity,selectedFloatingWindow:t.selectedFloatingWindow,locale:t.locale,cloudFile:t.cloudFile,latestModelSite:t.latestModelSite,modelSites:t.modelSites,allModelSites:t.allModelSites,modelsMapLatitude:t.modelsMapLatitude,modelsMapLongitude:t.modelsMapLongitude,modelsMapAddress:t.modelsMapAddress,modelsMapZoom:t.modelsMapZoom,modelsMapType:t.modelsMapType,modelsMapTilt:t.modelsMapTilt,showModelsAllTime:t.showModelsAllTime,showModelsFromDate:t.showModelsFromDate,showModelsToDate:t.showModelsToDate,world:t.world,elements:t.elements,viewState:t.viewState,graphState:t.graphState,actionState:t.actionState,modelType:t.modelType,modelAuthor:t.modelAuthor,modelLabel:t.modelLabel,modelDescription:t.modelDescription,canvasPercentWidth:t.canvasPercentWidth,projectView:t.projectView,projectState:t.projectState,designProjectType:t.designProjectType,notes:t.notes,user:t.user,sceneRadius:t.sceneRadius,weatherModel:t.weatherModel,solarPanelArrayLayoutParams:t.solarPanelArrayLayoutParams,solarPanelArrayLayoutConstraints:t.solarPanelArrayLayoutConstraints,economicsParams:t.economicsParams,evolutionMethod:t.evolutionMethod,evolutionaryAlgorithmState:t.evolutionaryAlgorithmState,geneticAlgorithmWizardSelectedTab:t.geneticAlgorithmWizardSelectedTab,particleSwarmOptimizationWizardSelectedTab:t.particleSwarmOptimizationWizardSelectedTab,minimumNavigationMoveSpeed:t.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:t.minimumNavigationTurnSpeed,customPvModules:t.customPvModules})})));class Phn extends xe.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,n){}clearCacheAndReload(){localStorage.clear(),window.location.reload()}render(){return this.state.hasError?h.jsxs("div",{style:{marginTop:10,marginLeft:20},children:[h.jsx("h1",{children:"Error"}),h.jsx("p",{children:"Something went wrong. Please click the following button to clear the cache and reload the page."}),h.jsx("p",{children:h.jsx("button",{onClick:this.clearCacheAndReload,children:"Refresh"})})]}):this.props.children}}const Chn=t=>{const e=typeof t=="function",n=g.useRef(t);g.useEffect(()=>{n.current=t}),g.useEffect(()=>{if(e){const o=r=>{const i=n.current(r);if(typeof i=="string")return r.preventDefault(),r.returnValue=i;if(r.defaultPrevented)return r.returnValue=""};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}}},[e])},Rhn=({children:t=null,onBeforeunload:e})=>(Chn(e),t),Hhn="/aladdin/assets/daysky-xGPh_lTa.jpg",Mhn="/aladdin/assets/desert-C1g8PGRA.jpg",Ihn="/aladdin/assets/dune-BTLjQ9Lc.jpg",zhn="/aladdin/assets/forest-4yWLHFWh.jpg",Dhn="/aladdin/assets/grassland-CDTfZBr_.jpg",TMe="/aladdin/assets/hill-spring-BepVmTLf.jpg",PMe="/aladdin/assets/hill-summer-RoU04vrD.jpg",CMe="/aladdin/assets/hill-fall-BPbpF4zI.jpg",RMe="/aladdin/assets/hill-winter-CQjb4ZNm.jpg",Ehn="/aladdin/assets/lake-Dj_bK41O.jpg",khn="/aladdin/assets/mountain-Du_Jo4ue.jpg",Fhn="/aladdin/assets/rural-BqG-D3I1.jpg",Lhn=xe.memo(({theme:t="Default"})=>{const e=H(pn),n=H(qN),o=H(HS),r=H(s5e),i=H(v5e),a=H(RS),l=H(Jn),s=H(Z3),c=H(d5e),u=H(Cm),d=H(tu),f=H(ml),p=H(Fn),m=H(Q3),y=H(uXe),{scene:w,camera:x,gl:{domElement:C}}=ti(),P=g.useRef(null),A=g.useRef(null),S=g.useRef(null),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new ue),R=g.useRef(new ue),M=g.useRef(new ue(1,1,1)),D=g.useRef(0),k=g.useRef(0),N=g.useRef(new Map),U=g.useRef(new Map),W=g.useRef(new Map),F=g.useRef(new Map),E=g.useRef(null),L=Kt(),j=g.useMemo(()=>new yu,[]),Y=g.useMemo(()=>new cn,[]),_=new Date(f).getMonth()+1,[G,Q]=g.useState(dh.Sky),oe=g.useMemo(()=>new ue,[]),ee=g.useMemo(()=>new cn,[]);if(A.current&&u){G!==dh.Vertical&&Q(dh.Vertical);const se=i(A.current,u),ge=r(),we=-Math.atan2(ge.x,ge.y);oe.set(se.x,se.y,0),ee.set(-$t,0,we,"ZXY")}const $=g.useMemo(()=>{switch(t){case qs.Desert:return .5;case qs.Dune:return .25;case qs.Forest:return .25;case qs.Grassland:return .15;case qs.Hill:return .3;case qs.Lake:return .1;case qs.Mountain:return .4;case qs.Rural:return .25;default:return .2}},[t]),ae=g.useMemo(()=>{switch(t){case qs.Desert:return Mhn;case qs.Dune:return Ihn;case qs.Forest:return zhn;case qs.Grassland:return Dhn;case qs.Hill:return d>0?_>=12||_<=3?RMe:_>3&&_<=5?TMe:_>5&&_<=9?PMe:CMe:_>=12||_<=3?PMe:_>3&&_<=5?CMe:_>5&&_<=9?RMe:TMe;case qs.Lake:return Ehn;case qs.Mountain:return khn;case qs.Rural:return Fhn;default:return Hhn}},[t,_,d]),Z=Up(ae),ne=se=>se===z.Foundation||se===z.Cuboid||se===z.Tree||se===z.Flower||se===z.Human,te=se=>{if(se.intersections.length>0)if(se.intersections[0].object===P.current)n(),e(we=>{we.clickObjectType=z.Sky});else{const we=o();we&&ne(we.type)&&(A.current=we,ye.isPlantOrHuman(A.current)&&(Q(dh.Vertical),ee.set(-$t,0,0,"ZXY")),we.type!==z.Foundation&&we.type!==z.Cuboid&&jn.getState().setEnableOrbitController(!1))}},q=se=>{if(!se)return"";const ge=se.name.split(" ");return ge[2]?ge[2]:q(se.parent)},le=(se,ge)=>{if(se==null)return null;for(const we of se.children)if(we.name.includes(`${ge}`))return we;return null},de=(se,ge)=>{var Ce,Te;const we=jn.getState().contentRef,Se=le(we==null?void 0:we.current,se.id);if(Se){for(const Re of Se.children)if(Re.name.includes(`${ge.id}`)){(Te=(Ce=jn.getState().contentRef)==null?void 0:Ce.current)==null||Te.add(Re);break}}ge.parentId=rr;const Me=new ue(ge.cx,ge.cy,ge.cz).applyEuler(new cn(0,0,se.rotation[2])).add(T.current);ge.cx=Me.x,ge.cy=Me.y,ge.cz=0,W.current.set(ge.id,new ue(Me.x,Me.y,0)),F.current.set(ge.id,rr)},he=(se,ge,we)=>{if(!se||!ge)return;const Se=jn.getState().contentRef;if(Se!=null&&Se.current){const Me=ye.getObjectChildById(Se.current,ge),Ce=ye.getObjectChildById(ge===rr?Se.current:Me,we);if(Ce){if(se===rr)Se.current.add(Ce);else{const Te=ye.getObjectChildById(Se.current,se);Te==null||Te.add(Ce)}Ip()}}},me=(se,ge)=>{se&&e(we=>{for(const Se of we.elements)if(Se.id===ge&&!ye.isFoundationOrCuboid(Se)){Se.parentId=se;break}})},ce=se=>{for(const ge of se)if(ge.object.userData.stand)return ge;return null},Pe=(se,ge)=>{if(se&&se.current){const we=ce(ge.intersections);if(we){const Se=we.object,Me=se.current.parent;if(Se.name==="Ground"){if(Me&&Me.name!=="Content"){const Ce=jn.getState().contentRef;Ce&&Ce.current&&(Ce.current.add(se.current),me(rr,q(se.current)))}se.current.position.copy(we.point),Ip()}else if(Se.userData.stand){const Ce=Se.parent;if(Ce){Me&&Me.uuid!==Ce.uuid&&(Ce.add(se.current),me(q(Ce),q(se.current))),Y.set(0,0,-Ce.rotation.z);const Te=new ue().subVectors(we.point,Ce.position).applyEuler(Y);se.current.position.copy(Te),Ip()}}}}},pe=(se,ge,we)=>{e(Se=>{for(const Me of Se.elements)if(Me.id===se){ye.isFoundationOrCuboid(Me)||(Me.parentId=ge),Me.cx=we.x,Me.cy=we.y,Me.cz=we.z;break}})},Ie=()=>{if(H.getState().viewState.orthographic)return!1;if(P.current){const se=j.intersectObjects(ye.fetchIntersectables(w),!1);if(se.length>0){for(const ge of se)if(ge.object.userData.stand)return!1}}return j.intersectObjects([P.current]).length>0},ve=se=>{if(A.current&&A.current.type&&!A.current.locked){const ge=new _t;ge.x=se.offsetX/C.clientWidth*2-1,ge.y=-(se.offsetY/C.clientHeight)*2+1,j.setFromCamera(ge,x);let we;if(S.current&&G===dh.Vertical&&(we=j.intersectObjects([S.current]),we&&we.length>0)){const Se=we[0].point;switch(A.current.type){case z.Tree:{const Me=A.current;switch(u){case xt.Top:c(Me.id,Se.z),e(Ce=>{Ce.selectedElementHeight=Math.max(1,Se.z)});break;case xt.Left:case xt.Right:case xt.Upper:case xt.Lower:s(Me.id,2*Math.hypot(Se.x-Me.cx,Se.y-Me.cy));break}Pe(jn.getState().treeRef,se);break}case z.Human:{Pe(jn.getState().humanRef,se);break}case z.Cuboid:{if(ye.isTopResizeHandle(u)){e(Ce=>{var Te;for(const Re of Ce.elements)if(Re.id===((Te=A.current)==null?void 0:Te.id)){Re.cz=Math.max(.5,Se.z/2),Re.lz=Math.max(1,Se.z);break}Ce.selectedElementHeight=Math.max(1,Se.z)});const Me=jn.getState().cuboidRef;if(Me!=null&&Me.current){for(const Ce of Me.current.children)if(Ce.name.includes("Human")||Ce.name.includes("Tree")){const Te=v.current.get(q(Ce));Te&&(Math.abs(k.current-Te.z)<.01?Ce.position.setZ(Math.max(Se.z/2,.5)):Ce.position.setZ(Te.z-Me.current.position.z))}}}break}}}}},ze=se=>{if(se.button===2)return;e(we=>{we.contextMenuObjectType=null}),te(se);const ge=A.current;if(ge)switch(k.current=ge.lz,T.current.set(ge.cx,ge.cy,ge.cz),ge.type){case z.Human:E.current=ge.parentId;break;case z.Tree:E.current=ge.parentId,D.current=ge.lx;break;case z.Cuboid:{T.current.set(ge.cx,ge.cy,ge.cz),M.current.set(ge.lx,ge.ly,ge.lz),v.current.clear();const we=new ue(ge.cx,ge.cy,ge.cz),Se=a(ge.id);if(Se.length>0){N.current.clear();const Me=ge.rotation[2];for(const Ce of Se)switch(Ce.type){case z.Tree:case z.Human:{const Te=new ue(Ce.cx,Ce.cy,Ce.cz).applyEuler(new cn(0,0,Me));Te.add(we),v.current.set(Ce.id,Te),N.current.set(Ce.id,new ue(Ce.cx,Ce.cy,Ce.cz));break}case z.SolarPanel:case z.Sensor:{if(ye.isIdentical(Ce.normal,fs)){const Te=new ue(Ce.cx*ge.lx,Ce.cy*ge.ly,Ce.cz*ge.lz).applyEuler(new cn(0,0,Me));Te.add(we),v.current.set(Ce.id,Te)}break}case z.Polygon:{if(ye.isIdentical(Ce.normal,fs)){const Te=Ce,Re=[];for(const Ne of Te.vertices){const _e=new _t(Ne.x*ge.lx,Ne.y*ge.ly).rotateAround(ui,Me);_e.add(new _t(we.x,we.y)),Re.push(_e)}b.current.set(Te.id,Re)}break}}}break}}},Ae=()=>{var se,ge;if(A.current){const we=l(A.current.id);if(we&&!we.locked){let Se=null,Me=E.current;switch(we.type){case z.Cuboid:switch(u){case xt.UpperLeftTop:case xt.UpperRightTop:case xt.LowerLeftTop:case xt.LowerRightTop:{U.current.clear(),e(Re=>{Re.actionState.cuboidHeight=we.lz;for(const Ne of Re.elements)if(ye.isPlantOrHuman(Ne)&&Ne.parentId===we.id)if(U.current.set(Ne.id,we.id),Math.abs(M.current.z/2-Ne.cz)<.01)Ne.cz=we.lz/2;else{const _e=Ne.cz+T.current.z-we.cz;Math.abs(_e)>we.lz/2?de(we,Ne):Ne.cz=_e}});const Ce=a(we.id);if(Ce.length>0)for(const Re of Ce)W.current.set(Re.id,new ue(Re.cx,Re.cy,Re.cz));const Te={name:"Change Cuboid Height",timestamp:Date.now(),changedElementId:we.id,changedElementType:we.type,oldValue:k.current,newValue:we.lz,oldChildrenPositionsMap:new Map(N.current),newChildrenPositionsMap:new Map(W.current),oldChildrenParentIdMap:new Map(U.current),newChildrenParentIdMap:new Map(F.current),undo:()=>{var Re,Ne;if(e(_e=>{for(const Ue of _e.elements)if(Ue.id===Te.changedElementId){Ue.lz=Te.oldValue,Ue.cz=Te.oldValue/2;break}}),Te.oldChildrenPositionsMap&&Te.oldChildrenPositionsMap.size>0)for(const[_e,Ue]of Te.oldChildrenPositionsMap.entries()){const qe=l(_e);if((qe==null?void 0:qe.type)!==z.Polygon){m(_e,Ue.x,Ue.y,Ue.z);const Fe=(Re=Te.oldChildrenParentIdMap)==null?void 0:Re.get(_e),He=(Ne=Te.newChildrenParentIdMap)==null?void 0:Ne.get(_e);Fe&&He&&Fe!==He&&(he(Fe,He,_e),me(Fe,_e))}}},redo:()=>{var Re,Ne;if(e(_e=>{for(const Ue of _e.elements)if(Ue.id===Te.changedElementId){Ue.lz=Te.newValue,Ue.cz=Te.newValue/2;break}}),Te.newChildrenPositionsMap&&Te.newChildrenPositionsMap.size>0)for(const[_e,Ue]of Te.newChildrenPositionsMap.entries()){m(_e,Ue.x,Ue.y,Ue.z);const qe=(Re=Te.oldChildrenParentIdMap)==null?void 0:Re.get(_e),Fe=(Ne=Te.newChildrenParentIdMap)==null?void 0:Ne.get(_e);qe&&Fe&&qe!==Fe&&(he(Fe,qe,_e),me(Fe,_e))}}};p(Te);break}}break;case z.Tree:switch(u){case xt.Top:{const Ce={name:"Change Tree Height",timestamp:Date.now(),changedElementId:we.id,changedElementType:we.type,oldValue:k.current,newValue:we.lz,undo:()=>{c(Ce.changedElementId,Ce.oldValue)},redo:()=>{c(Ce.changedElementId,Ce.newValue)}};p(Ce),e(Te=>{Te.actionState.treeHeight=we.lz});break}case xt.Left:case xt.Right:case xt.Lower:case xt.Upper:{const Ce={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:we.id,changedElementType:we.type,oldValue:D.current,newValue:we.lx,undo:()=>{s(Ce.changedElementId,Ce.oldValue)},redo:()=>{s(Ce.changedElementId,Ce.newValue)}};p(Ce),e(Te=>{Te.actionState.treeSpread=we.lx});break}}Se=(se=jn.getState().treeRef)==null?void 0:se.current;break;case z.Human:Se=(ge=jn.getState().humanRef)==null?void 0:ge.current;break}if(Se){const Ce=j.intersectObjects(ye.fetchIntersectables(w),!1),Te=ce(Ce);if(Te){const Re=Te.point;if(Te.object.name==="Ground")pe(we.id,rr,Re),R.current.set(Re.x,Re.y,Re.z),Me=rr;else if(Te.object.userData.stand){const Ne=q(Te.object),_e=Te.object.parent;if(_e){const Ue=new ue().subVectors(Re,_e.position).applyEuler(Y);pe(we.id,Ne,Ue),R.current.set(Ue.x,Ue.y,Ue.z),Me=Ne}}}}if(H.getState().moveHandleType&&ye.isPlantOrHuman(we)&&(R.current.distanceToSquared(T.current)>Ht||j.intersectObjects([P.current]).length>0)){let Ce=!0;if(!H.getState().viewState.orthographic&&(Ce=R.current.length().02}if(!Ce||Ie()){m(we.id,T.current.x,T.current.y,T.current.z),Se&&ye.isPlantOrHuman(we)&&Se.position.copy(T.current),ye.isPlantOrHuman(we)&&me(E.current,we.id);const Te=jn.getState().contentRef;if(Te!=null&&Te.current&&E.current&&Se){if(E.current===rr)Te.current.add(Se);else{const Re=ye.getObjectChildById(Te.current,E.current);Re==null||Re.add(Se)}Ip()}co(B.t("message.CannotMoveObjectTooFar",L))}else{const Te={name:"Move",timestamp:Date.now(),movedElementId:we.id,movedElementType:we.type,oldCx:T.current.x,oldCy:T.current.y,oldCz:T.current.z,newCx:R.current.x,newCy:R.current.y,newCz:R.current.z,oldParentId:E.current,newParentId:Me,undo:()=>{m(Te.movedElementId,Te.oldCx,Te.oldCy,Te.oldCz),me(Te.oldParentId,Te.movedElementId),he(Te.oldParentId,Te.newParentId,Te.movedElementId)},redo:()=>{m(Te.movedElementId,Te.newCx,Te.newCy,Te.newCz),me(Te.newParentId,Te.movedElementId),he(Te.newParentId,Te.oldParentId,Te.movedElementId)}};p(Te),y()}}}A.current=null,Q(dh.Sky),e(Se=>{Se.moveHandleType=null,Se.resizeHandleType=null,Se.rotateHandleType=null}),jn.setState({humanRef:null,treeRef:null}),jn.getState().setEnableOrbitController(!0)}};return h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{ref:P,name:"Sky",rotation:[$t,0,0],scale:[1,$,1],onContextMenu:se=>{se.intersections.length>0&&se.intersections[0].object===P.current&&(n(),e(we=>{we.clickObjectType=z.Sky,we.contextMenuObjectType=z.Sky}))},onPointerDown:ze,children:[h.jsx("sphereGeometry",{args:[zvt,16,8,0,fa,0,$t]}),h.jsx("meshToonMaterial",{map:Z,side:js,opacity:1,color:"skyblue"})]}),A.current&&G!==dh.Sky&&h.jsx(yi,{ref:S,visible:!1,name:"Sky Intersection Plane",rotation:ee,position:oe,args:[1e3,1e3],onPointerMove:A3.throttle(ve,hL),onPointerUp:Ae,children:h.jsx("meshStandardMaterial",{side:zr})})]})}),Whn=xe.memo(({lineWidth:t=1,endPoint:e=1e3,showTickMarks:n=!0,showTickLabels:o=!0})=>{const r=H(sPt),i=H(Ky),a=H(M0),[l,s]=g.useState(!1),c=50,u=g.useRef(1),d=g.useRef(u.current*10),f=g.useRef(new Array(c).fill(1)),p=.1,m=.3,y="FloralWhite",w=t/2,x=B5(NM,gI),C=Math.min(1,Math.max(.5,i*.01)),P={font:x,height:0,size:C},A=a?r.max.z+.01:0;g.useEffect(()=>{i<50?u.current=1:i<100?u.current=2:u.current=5,d.current=10*u.current,f.current=new Array(c).fill(1),s(!l)},[i]);const S=v=>v%(5*u.current)===0?m:p;return h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},name:"x axis line",points:[[-e,0,A],[e,0,A]],color:"red",lineWidth:t}),a&&n&&f.current.map((v,b)=>{const T=(b+1)*u.current,R=S(T);return h.jsxs(xe.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[T,-R,A],[T,R,A]],color:y,lineWidth:w}),h.jsx(On,{userData:{unintersectable:!0},points:[[-T,-R,A],[-T,R,A]],color:y,lineWidth:w})]},T)}),a&&o&&f.current.map((v,b)=>{const T=(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[T-C,-.3*2-C,A],children:[h.jsx("textGeometry",{args:[(T<10?" ":"")+T,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),a&&o&&f.current.map((v,b)=>{const T=-(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[T-C,-.3*2-C,A],children:[h.jsx("textGeometry",{args:[(T>-10?" ":"")+T,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),h.jsx(On,{name:"y axis line",userData:{unintersectable:!0},points:[[0,-e,A],[0,e,A]],color:"blue",lineWidth:t}),a&&n&&f.current.map((v,b)=>{const T=(b+1)*u.current,R=S(T);return h.jsxs(xe.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[-R,T,A],[R,T,A]],color:y,lineWidth:w*1.5}),h.jsx(On,{userData:{unintersectable:!0},points:[[-R,-T,A],[R,-T,A]],color:y,lineWidth:w*1.5})]},T)}),a&&o&&f.current.map((v,b)=>{const T=(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-.3*2-C*2,T-C/2,A],children:[h.jsx("textGeometry",{args:[T+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),a&&o&&f.current.map((v,b)=>{const T=-(b+1)*u.current;return T%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-.3*2-C*2,T-C/2,A],children:[h.jsx("textGeometry",{args:[T+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},T):h.jsx(xe.Fragment,{},T)}),!a&&h.jsx(On,{userData:{unintersectable:!0},name:"z axis line",points:[[0,0,0],[0,0,e]],color:"green",lineWidth:t})]})}),Nhn=xe.memo(t=>{var G;const{id:e,cx:n,cy:o,cz:r,name:i=Vt.Jack,locked:a=!1,flip:l=!1,observer:s=!1,parentId:c}=t;let u=!1;H(Q=>{if(c===rr)u=!0;else for(const oe of Q.elements)if(oe.id===c){u=!0;break}});const d=H(Jp);g.useEffect(()=>{u||d(e,!1)},[u,e]);const f=H(pn),p=H(M0)??!1,m=H(z0),y=H(FS),w=H($y),x=dt(vs),C=Fc(e),{gl:P}=ti(),[A,S]=g.useState(!1),v=jn(Q=>Q.contentRef),b=g.useRef(null),T=g.useRef(null),R=Kt(),M=g.useRef(!1),D=H(OM);D!==M.current&&(M.current=D,v!=null&&v.current&&b.current&&v.current.add(b.current)),g.useEffect(()=>{if(c!==rr){const Q=E();Q&&b.current&&Q.add(b.current)}},[D,c]);const k=Up(hh.fetchTextureImage(i)),N=g.useMemo(()=>{const Q=k.clone();return l?(Q.wrapS=es,Q.repeat.x=-1,Q.needsUpdate=!0):Q.repeat.x=1,Q},[k,l]),U=g.useMemo(()=>hh.fetchWidth(i),[i]),W=g.useMemo(()=>hh.fetchHeight(i),[i]),F=g.useMemo(()=>hh.fetchLabel(i,R)+(a?" ("+B.t("shared.ElementLocked",R)+")":"")+` +`+B.t("word.Coordinates",R)+": ("+n.toFixed(1)+", "+o.toFixed(1)+") "+B.t("word.MeterAbbreviation",R),[i,a,n,o,R]);g.useEffect(()=>{const Q=E();Q&&b.current&&Q.add(b.current)},[v]);const E=()=>c!==rr&&(v!=null&&v.current)?ye.getObjectChildById(v.current,c):null;Gp(({camera:Q})=>{if(b.current){const{rot:oe}=ye.getWorldDataById(c);if(p)b.current.rotation.set($t,Math.PI-oe,0);else{const{x:ee,y:$}=Q.position,{x:ae,y:Z}=b.current.localToWorld(new ue);b.current.rotation.set(0,0,-Math.atan2(ee-ae,$-Z)-oe)}}});const L=g.useCallback((Q,oe)=>{dt.getState().duringCameraInteraction||Q.intersections.length>0&&(Q.intersections[0].object===Q.eventObject||Q.intersections.length>1&&Q.intersections[1].object===Q.eventObject)&&(f($=>{$.hoveredHandle=oe,$.selectedElementHeight=t.lz}),ye.isMoveHandle(oe)?P.domElement.style.cursor="move":P.domElement.style.cursor="pointer")},[t.lz]),j=g.useCallback(()=>{f(Q=>{Q.hoveredHandle=null}),P.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),Y=s?hh.fetchGender(t.name):Fa.Male,O=s?(t.flip?-1:1)*hh.fetchHatOffsetX(t.name):0,_=s?hh.fetchHatOffsetY(t.name):0;return u?h.jsx("group",{ref:b,name:"Human Group "+e,userData:{aabb:!0},position:[n,o,r??0],children:h.jsxs("group",{position:[0,.1,W/2],children:[h.jsx(MR,{rotation:[$t,0,0],uuid:e,name:i,follow:!1,children:h.jsx(yi,{ref:T,renderOrder:3,receiveShadow:!x,name:`Human ${i} plane`,args:[U,W],onContextMenu:Q=>{m(e,Q,er.ContextMenu),f(oe=>{Q.intersections.length>0&&Q.intersections[0].object===T.current&&(oe.contextMenuObjectType=z.Human)})},onPointerDown:Q=>{Q.button!==2&&Q.eventObject===Q.intersections[0].eventObject&&(m(e,Q,er.Move),jn.setState({humanRef:b}))},onPointerOver:Q=>{Q.intersections.length>0&&Q.intersections[0].object===T.current&&S(!0)},onPointerOut:()=>{S(!1)},children:h.jsx("meshToonMaterial",{map:N,alphaTest:.5,side:zr})})}),C&&a&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-U/2,0,-W/2],[-U/2,0,W/2],[-U/2,0,W/2],[U/2,0,W/2],[U/2,0,-W/2],[U/2,0,W/2],[U/2,0,-W/2],[-U/2,0,-W/2]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(G=T.current)==null?void 0:G.rotation,color:i0}),s&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{uuid:e,visible:!1,userData:{eyeball:!0},name:i+" eyeball",args:[U/5,4,4,0,fa,0,fa],position:[0,0,t.lz/2],children:h.jsx("meshBasicMaterial",{attach:"material",side:zr})}),h.jsx(wa,{name:"Observer hat 1",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.1,.1,.1,16,2],position:[O,0,t.lz/2-.05+_],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:Y===Fa.Male?"gray":"hotpink"})}),h.jsx(wa,{name:"Observer hat 2",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.2,.2,.01,16,2],position:[O,0,t.lz/2-.1+_],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:Y===Fa.Male?"gray":"hotpink"})})]}),C&&!a&&h.jsx(Ys,{position:[0,0,-W/2],args:[Tm*4,6,6,0,Math.PI],name:Ho.Default,onPointerDown:Q=>{Q.button!==2&&Q.eventObject===Q.intersections[0].eventObject&&(m(e,Q,er.Move),jn.setState({humanRef:b}))},onPointerEnter:Q=>{L(Q,Ho.Default)},onPointerLeave:j,children:h.jsx("meshBasicMaterial",{attach:"material",color:w===Ho.Default||y===Ho.Default?Aa:q8})}),A&&!C&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:F,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,W/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null}),Uhn=xe.memo(t=>{var ge;const{parentId:e,id:n,cx:o,cy:r,cz:i,lx:a,lz:l,name:s=yr.Pine,flip:c=!1,locked:u=!1,showModel:d=!1,showLabel:f=!1}=t;let p=!1;H(we=>{if(e===rr)p=!0;else for(const Se of we.elements)if(Se.id===e){p=!0;break}});const m=H(Jp);g.useEffect(()=>{p||m(n,!1)},[p]);const y=H(pn),w=H(M0)??!1,x=H(ml),C=H(tu),P=H(K2e)??tQ,A=H($2e)??nQ,S=H(xs),v=H(z0),b=H(FS),T=H(Cm),R=H($y),M=Fc(n),[D,k]=g.useState(!1),{gl:N}=ti(),U=jn(we=>we.contentRef),W=g.useRef(null),F=g.useRef(null),E=g.useRef(null),L=g.useRef(null),j=g.useRef(null),Y=g.useRef(null),O=g.useRef(null),_=g.useRef(null),G=g.useRef(null),Q=g.useRef(null),oe=Kt(),ee=g.useMemo(()=>ye.dayOfYear(new Date(x)),[x]),$=g.useMemo(()=>!Sv.isEvergreen(t?t.name:yr.Dogwood)&&(C>0?eeA:ee>=P&&ee<=A),[ee,P,A,C,t==null?void 0:t.name]),ae=g.useRef(!1),Z=H(OM);Z!==ae.current&&(ae.current=Z,U!=null&&U.current&&W.current&&U.current.add(W.current)),g.useEffect(()=>{if(e!==rr){const we=Ae();we&&W.current&&we.add(W.current)}},[Z]),g.useEffect(()=>{const we=Ae();we&&W.current&&we.add(W.current)},[U]);const ne=Up(Sv.fetchTextureImage(s,ee,C,P,A)),te=g.useMemo(()=>{const we=ne.clone();return c?(we.wrapS=es,we.repeat.x=-1,we.needsUpdate=!0):we.repeat.x=1,we},[ne,c]),q=g.useMemo(()=>(t!=null&&t.label?t.label:Sv.fetchLabel(s,oe))+(u?" ("+B.t("shared.ElementLocked",oe)+")":"")+(t!=null&&t.label?"":` +`+B.t("word.Coordinates",oe)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+B.t("word.MeterAbbreviation",oe)),[t==null?void 0:t.label,s,o,r,u,oe]),le=g.useMemo(()=>Sv.fetchTheta(s),[s]),de=a/2,he=l/2,me=g.useMemo(()=>new ue(0,0,he),[he]),ce=g.useMemo(()=>new ue(-de,0,0),[de]),Pe=g.useMemo(()=>new ue(de,0,0),[de]),pe=g.useMemo(()=>new ue(0,-de,0),[de]),Ie=g.useMemo(()=>new ue(0,de,0),[de]),ve=g.useCallback((we,Se)=>{dt.getState().duringCameraInteraction||we.intersections.length>0&&(we.intersections[0].object===we.eventObject||we.intersections.length>1&&we.intersections[1].object===we.eventObject)&&(y(Ce=>{Ce.hoveredHandle=Se,Ce.selectedElementHeight=t.lz}),ye.isMoveHandle(Se)?N.domElement.style.cursor="move":N.domElement.style.cursor="pointer")},[t==null?void 0:t.lz]),ze=g.useCallback(()=>{y(we=>{we.hoveredHandle=null}),N.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),Ae=()=>e!==rr&&(U!=null&&U.current)?ye.getObjectChildById(U.current,e):null;Gp(({camera:we})=>{if(F.current&&W.current&&E.current&&j.current){const{rot:Se}=ye.getWorldDataById(e),{x:Me,y:Ce}=we.position,{x:Te,y:Re}=W.current.position,{x:Ne,y:_e}=H.getState().sunlightDirection;if(Ae()){const qe=W.current.localToWorld(new ue),Fe=Math.atan2(Me-qe.x,Ce-qe.y)+Se;F.current.rotation.set($t,-Fe,0),j.current.rotation.set(-$t,Fe,0),E.current.rotation.set($t,-Math.atan2(Ne,_e)-Se,0)}else{const qe=Math.atan2(Me-Te,Ce-Re);F.current.rotation.set($t,-qe,0),j.current.rotation.set(-$t,qe,0),E.current.rotation.set($t,-Math.atan2(Ne,_e),0)}}});const se=Tm*3;return h.jsx(h.Fragment,{children:p?h.jsx("group",{ref:W,name:"Tree Group "+n,userData:{aabb:!0},position:[o,r,i??0],children:h.jsxs("group",{position:[0,0,l/2],children:[h.jsx(MR,{ref:F,uuid:n,name:s,follow:!1,children:h.jsx(yi,{args:[a,l],children:h.jsx("meshToonMaterial",{map:te,side:zr,alphaTest:.5})})}),h.jsx(MR,{ref:E,name:s+" Shadow Billboard",follow:!1,children:h.jsx(yi,{args:[a,l],castShadow:S,children:h.jsx("meshBasicMaterial",{map:te,side:zr,alphaTest:.5,opacity:0})})}),Sv.isConic(s)?h.jsx(Rf,{visible:d||w,name:s+" Model",userData:{simulation:!0},position:[0,0,s===yr.Spruce?0:l*.06],args:[a/2,l,8,8,!0],scale:[1,1,1],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:zr,transparent:!0,opacity:.75})}):h.jsx(Ys,{visible:d||w,userData:{simulation:!$},name:s+" Model",args:[a/2,8,8,0,fa,0,le],scale:[1,l/a,1],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:zr,transparent:!0,opacity:.75})}),h.jsx(MR,{ref:j,name:"Interaction Billboard",visible:!1,position:[0,0,-l/2+.5],children:h.jsx(yi,{ref:L,renderOrder:3,name:s+" plane",args:[a/2,l/3],rotation:[w?$t:0,0,0],onContextMenu:we=>{v(n,we,er.ContextMenu),y(Se=>{we.intersections.length>0&&we.intersections[0].object===L.current&&(Se.contextMenuObjectType=z.Tree)})},onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(v(n,we,er.Move),jn.setState({treeRef:W}))},onPointerOver:we=>{we.intersections.length>0&&we.intersections[0].object===L.current&&k(!0)},onPointerOut:()=>{k(!1)}})}),M&&u&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-a/2,-l/2,0],[-a/2,l/2,0],[-a/2,l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[-a/2,-l/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(ge=F.current)==null?void 0:ge.rotation,color:i0}),M&&!u&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{position:new ue(0,0,-l/2),args:[se,6,6,0,Math.PI],name:Ho.Default,renderOrder:2,onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(v(n,we,er.Move),jn.setState({treeRef:W}))},onPointerEnter:we=>{ve(we,Ho.Default)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Ho.Default||b===Ho.Default?Aa:q8})}),!w&&h.jsxs(h.Fragment,{children:[h.jsx(di,{ref:Y,name:xt.Top,args:[se,se,se],position:me,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Top)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Top||T===xt.Top?Aa:ll})}),h.jsx(di,{ref:O,name:xt.Left,args:[se,se,se],position:ce,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Left)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Left||T===xt.Left?Aa:ll})}),h.jsx(di,{ref:_,name:xt.Right,args:[se,se,se],position:Pe,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Right)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Right||T===xt.Right?Aa:ll})}),h.jsx(di,{ref:G,name:xt.Lower,args:[se,se,se],position:pe,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Lower)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Lower||T===xt.Lower?Aa:ll})}),h.jsx(di,{ref:Q,name:xt.Upper,args:[se,se,se],position:Ie,onPointerDown:we=>{v(n,we,er.Resize)},onPointerEnter:we=>{ve(we,xt.Upper)},onPointerLeave:ze,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===xt.Upper||T===xt.Upper?Aa:ll})})]})]}),(D||f)&&!M&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:q,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});function zrt(t){const e=t+"Geometry";return g.forwardRef(({args:n,children:o,...r},i)=>h.jsxs("mesh",{ref:i,...r,children:[h.jsx(e,{attach:"geometry",args:n}),o]}))}const HMe=zrt("ParabolicCylinder"),MMe=zrt("Paraboloid"),jhn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,absorberTubeRadius:c=.05,latusRectum:u=2,tiltAngle:d,relativeAzimuth:f,moduleLength:p,poleHeight:m,poleRadius:y,drawSunBeam:w,rotation:x=[0,0,0],color:C="white",lineColor:P="black",lineWidth:A=.5,showLabel:S=!1,locked:v=!1,parentId:b}=t,T=H(pn),R=H(ml),M=H(tu),D=H(Qn),k=dt(vs),N=H(Df),U=In(O1),W=H(xs),F=H(Jn),E=H(z0),L=H(Ky),j=H(Cm),Y=H(I7),O=Up(Uot),_=Up(jot),G=Fc(e),{gl:{domElement:Q}}=ti(),[oe,ee]=g.useState(!1),[$,ae]=g.useState(null),[Z,ne]=g.useState(1),[te,q]=g.useState(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(null),ce=g.useRef(null),Pe=g.useRef(null),pe=g.useRef(null),Ie=g.useRef(!1),ve=g.useRef(null),ze=Math.max(100,10*L),Ae=16,se=Y.z<=0,ge=Kt();let we=n,Se=o,Me=r;const Ce=i/2,Te=a/2,Re=l/2,Ne=m+Ce,_e=H(at=>{for(const Et of at.elements)if(Et.id===b)return Et});if(b&&_e)switch(_e.type){case z.Foundation:if(Me=Ne+Re+_e.lz,ye.isZero(x[2]))we=_e.cx+n*_e.lx,Se=_e.cy+o*_e.ly;else{const at=new ue(n*_e.lx,o*_e.ly,0);at.applyAxisAngle(Oo,x[2]),we=_e.cx+at.x,Se=_e.cy+at.y}break}const Ue=Ce*Ce/u,qe=.25*u,Fe=new ue(-Ce,-Te,Re+Ue),He=new ue(-Ce,Te,Re+Ue),Le=new ue(Ce,-Te,Re+Ue),Ye=new ue(Ce,Te,Re+Ue);g.useEffect(()=>{if(t&&k){const at=U(t.id);at&&q(ye.fetchHeatmapTexture(at,N??5))}},[k,N]),g.useEffect(()=>{ne(Math.max(1,Math.round(a/p)))},[a,p]),g.useEffect(()=>{const at=()=>{jn.getState().setEnableOrbitController(!0),Ie.current=!1};return window.addEventListener("pointerup",at),()=>{window.removeEventListener("pointerup",at)}},[]);const lt=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.ParabolicTroughElement",ge))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",ge)+")":"")+(t!=null&&t.label?"":` +`+B.t("word.Coordinates",ge)+": ("+we.toFixed(1)+", "+Se.toFixed(1)+", "+Me.toFixed(1)+") "+B.t("word.MeterAbbreviation",ge)),[t==null?void 0:t.label,t==null?void 0:t.locked,we,Se,Me,ge]),Oe=g.useMemo(()=>new cn(0,0,x[2],"ZXY"),[x]),ut=(at,Et)=>{at.intersections.length>0&&at.intersections[0].object===at.eventObject&&(ae(Et),Et===Ho.Top?Q.style.cursor="move":Et===ai.Lower||Et===ai.Upper||Et===ai.Tilt?Q.style.cursor="grab":Q.style.cursor="pointer")},ht=()=>{ae(null),Q.style.cursor="default"},Qe=g.useMemo(()=>zi(new Date(R),M),[R,M]),nt=g.useMemo(()=>{var at;return(at=F(b))==null?void 0:at.rotation[2]},[b]),mt=nt?Qe.clone().applyAxisAngle(Oo,-nt):Qe,tt=g.useMemo(()=>Qe.z>0?new cn(0,Math.atan2(mt.x,mt.z),0,"ZXY"):new cn(d,0,f,"ZXY"),[Qe,d,f,mt.x,mt.z]),gt=g.useMemo(()=>{if(Qe.z>0){const at=nt?Math.cos(nt):1,Et=nt?Math.sin(nt):0;return-qe*(Qe.x*Et+Qe.y*at)/Math.hypot(Qe.x,Qe.z)}return 0},[Qe,nt,qe]),Ve=new ue(0,gt,qe).applyEuler(tt),je=Qe.clone().multiplyScalar(ze).applyEuler(new cn(-Oe.x,0,-Oe.z)),et=-(Ne+l)/2,bt=g.useMemo(()=>{const at=[],Et=Math.cos(f)*p,Lt=Math.sin(f)*p,Je=Z/2-.5;for(let st=0;st{const at=[],Et=a/Z,Lt=-i/u,Je=-2*Lt/Ae;for(let st=0;st<=Z;st++){const It=[];for(let ot=0;ot<=Ae;ot++){const it=Lt+ot*Je;It.push(new ue(u*it/2,-Te+st*Et,u*it*it/4))}at.push({points:It})}return at},[i,a,Z,u]),Pt=Math.max(1,(i+a)/16),Yt=$8*Pt*1.5,zt=Tm*Pt*2,Rt=D.length<50&&St.length<10,Ct=Rt?4:2,yt=c*6;return Gp(({camera:at})=>{if(!ve.current||!_e)return;const Et=ve.current.localToWorld(new ue(0,0,0)),Lt=new ue().subVectors(at.position,Et).applyEuler(new cn(0,0,-(_e==null?void 0:_e.rotation[2])-f)),Je=Math.atan2(Lt.z,Lt.x);ve.current.rotation.y=-Math.PI/2-Je}),h.jsxs("group",{name:"Parabolic Trough Group "+e,rotation:Oe,position:[we,Se,Me+Re],children:[h.jsxs("group",{rotation:tt,children:[h.jsx(HMe,{receiveShadow:W,castShadow:W,uuid:e,ref:le,args:[u/2,i,a,Ae,4],name:"Parabolic Trough Front Side",onPointerDown:at=>{at.button!==2&&E(e,at,er.Select)},onContextMenu:at=>{E(e,at,er.ContextMenu),T(Et=>{at.intersections.length>0&&at.intersections[0].object===le.current&&(Et.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:at=>{at.intersections.length>0&&at.intersections[0].object===le.current&&(ee(!0),Q.style.cursor="move")},onPointerOut:()=>{ee(!1),Q.style.cursor="default"},children:k&&te?h.jsx("meshBasicMaterial",{attach:"material",side:$i,map:te}):h.jsx("meshPhongMaterial",{attach:"material",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"})}),h.jsx(HMe,{receiveShadow:W,castShadow:W,uuid:e+" backside",ref:de,args:[u/2,i,a,Ae,4],name:"Parabolic Trough Back Side",position:[0,0,-Re/2],onPointerDown:at=>{at.button!==2&&E(e,at,er.Select)},onContextMenu:at=>{E(e,at,er.ContextMenu),T(Et=>{at.intersections.length>0&&at.intersections[0].object===de.current&&(Et.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:at=>{at.intersections.length>0&&at.intersections[0].object===de.current&&(ee(!0),Q.style.cursor="move")},onPointerOut:()=>{ee(!1),Q.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:js,color:"white"})}),St&&St.map((at,Et)=>h.jsxs(xe.Fragment,{children:[Rt&&h.jsx(On,{name:"Parabolic Trough Rim Lines",userData:{unintersectable:!0},points:at.points,castShadow:!1,receiveShadow:!1,lineWidth:A,color:P}),(Et===0||Et===St.length-1||Rt)&&h.jsx(On,{name:"Parabolic Trough Focal Lines",userData:{unintersectable:!0},points:[at.points[Ae/2].clone(),at.points[Ae/2].clone().add(new ue(0,0,qe))],castShadow:!1,receiveShadow:!1,lineWidth:A,color:se?"dimgray":"white"})]},Et)),Rt&&h.jsx(On,{name:"Parabolic Trough Outline 1",userData:{unintersectable:!0},points:[[-Ce,-Te,Ue],[-Ce,Te,Ue]],castShadow:!1,receiveShadow:!1,lineWidth:A,color:P}),Rt&&h.jsx(On,{name:"Parabolic Trough Outline 2",userData:{unintersectable:!0},points:[[Ce,-Te,Ue],[Ce,Te,Ue]],castShadow:!1,receiveShadow:!1,lineWidth:A,color:P}),h.jsx(wa,{name:"Parabolic Trough Absorber Tube",uuid:e,args:[c,c,a,Rt?6:2,1],position:[0,0,qe],receiveShadow:!1,castShadow:!0,children:se?h.jsx("meshStandardMaterial",{color:"white"}):h.jsx("meshBasicMaterial",{color:[1,1,1],toneMapped:!1})}),Qe.z>0&&h.jsxs("group",{ref:ve,position:[0,0,qe],children:[h.jsx(yi,{args:[yt,a],children:h.jsx("meshBasicMaterial",{side:zr,map:O,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],rotation:[0,0,Math.PI],position:[yt/4,yt/4+a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],rotation:[0,0,-Math.PI/2],position:[-yt/4,yt/4+a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],rotation:[0,0,Math.PI/2],position:[yt/4,-yt/4-a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})}),h.jsx(yi,{args:[yt/2,yt/2],position:[-yt/4,-yt/4-a/2,0],children:h.jsx("meshBasicMaterial",{side:zr,map:_,color:"white",blending:Th,transparent:!0})})]}),h.jsx(yi,{name:"Parabolic Trough Simulation Plane",uuid:e,args:[i,a],position:[0,0,Ue],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),G&&v&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-Ce,-Te,Ue],[-Ce,Te,Ue],[Ce,Te,Ue],[Ce,-Te,Ue],[-Ce,-Te,Ue]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),G&&!v&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:he,position:new ue(0,0,0),args:[zt,6,6],name:Ho.Default,onPointerOver:at=>{ut(at,Ho.Top)},onPointerOut:()=>{ht()},onPointerDown:at=>{at.button!==2&&E(e,at,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(di,{ref:me,position:[(Fe.x+Le.x)/2,Fe.y,Fe.z-Ue],args:[Yt,Yt,l*1.2],name:xt.Lower,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=me.current.localToWorld(new ue(0,a,-Fe.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Lower)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===xt.Lower||j===xt.Lower?Aa:ll})}),h.jsx(di,{ref:ce,position:[(He.x+Ye.x)/2,He.y,He.z-Ue],args:[Yt,Yt,l*1.2],name:xt.Upper,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=ce.current.localToWorld(new ue(0,-a,-He.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Upper)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===xt.Upper||j===xt.Upper?Aa:ll})}),h.jsx(di,{ref:Pe,position:[Fe.x,(Fe.y+He.y)/2,Fe.z],args:[Yt,Yt,l*1.2],name:xt.Left,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=Pe.current.localToWorld(new ue(i,0,-Fe.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Left)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===xt.Left||j===xt.Left?Aa:ll})}),h.jsx(di,{ref:pe,position:[Le.x,(Le.y+Ye.y)/2,Le.z],args:[Yt,Yt,l*1.2],name:xt.Right,onPointerDown:at=>{E(e,at,er.Resize),Pe.current&&T(Et=>{const Lt=pe.current.localToWorld(new ue(-i,0,-Le.z));Et.resizeAnchor.copy(Lt)})},onPointerOver:at=>{ut(at,xt.Right)},onPointerOut:()=>{ht()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===xt.Right||j===xt.Right?Aa:ll})})]})]})]}),Ne>0&&bt.map((at,Et)=>Et%5!==0&&!Rt?h.jsx(xe.Fragment,{},Et):h.jsx(wa,{userData:{unintersectable:!0},name:"Pole "+Et,castShadow:!1,receiveShadow:!1,args:[y,y,Ne+(at.z-et)*2+l,Ct,1],position:at,rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:C})},Et)),w&&Qe.z>0&&h.jsx(On,{userData:{unintersectable:!0},points:[Ve,new ue(-.3*Ce,0,.09*Ue).applyEuler(tt),je,new ue(-.6*Ce,0,.36*Ue).applyEuler(tt),Ve,new ue(-.9*Ce,0,.81*Ue).applyEuler(tt),je,new ue(0,0,0),Ve,new ue(.3*Ce,0,.09*Ue).applyEuler(tt),je,new ue(.6*Ce,0,.36*Ue).applyEuler(tt),Ve,new ue(.9*Ce,0,.81*Ue).applyEuler(tt),je],name:"Sun Beams",lineWidth:.25,color:"white"}),(oe||S)&&!G&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:lt,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(Te*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),Bhn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,structureType:c=pf.CentralPole,receiverRadius:u=.25,receiverPoleRadius:d=.1,latusRectum:f=2,tiltAngle:p,relativeAzimuth:m,poleHeight:y,poleRadius:w=.2,drawSunBeam:x,rotation:C=[0,0,0],color:P="white",lineColor:A="black",lineWidth:S=.25,showLabel:v=!1,locked:b=!1,parentId:T}=t,R=H(pn),M=H(ml),D=H(tu),k=H(Qn),N=dt(vs),U=H(Df),W=In(O1),F=H(xs),E=H(Jn),L=H(z0),j=H(Ky),Y=H(Cm),O=H(I7),_=Fc(e),{gl:{domElement:G}}=ti(),[Q,oe]=g.useState(!1),[ee,$]=g.useState(null),[ae,Z]=g.useState(null),ne=g.useRef(null),te=g.useRef(null),q=g.useRef(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(null),ce=g.useRef(!1),Pe=Math.max(100,10*j),pe=32,Ie=8,ve=O.z<=0;let ze=n,Ae=o,se=r;const ge=i/2,we=a/2,Se=l/2,Me=y+ge,Ce=Kt(),Te=H(Rt=>{for(const Ct of Rt.elements)if(Ct.id===T)return Ct});if(T&&Te)switch(Te.type){case z.Foundation:if(se=Me+Se+Te.lz,ye.isZero(C[2]))ze=Te.cx+n*Te.lx,Ae=Te.cy+o*Te.ly;else{const Rt=new ue(n*Te.lx,o*Te.ly,0);Rt.applyAxisAngle(Oo,C[2]),ze=Te.cx+Rt.x,Ae=Te.cy+Rt.y}break}const Re=ge*ge/f,Ne=.25*f,_e=new ue(-ge,-we,Se+Re),Ue=new ue(-ge,we,Se+Re),qe=new ue(ge,-we,Se+Re),Fe=new ue(ge,we,Se+Re),He=Up(O3e),Le=u+1;g.useEffect(()=>{if(t&&N){const Rt=W(t.id);Rt&&Z(ye.fetchHeatmapTexture(Rt,U??5))}},[N,U]),g.useEffect(()=>{const Rt=()=>{jn.getState().setEnableOrbitController(!0),ce.current=!1};return window.addEventListener("pointerup",Rt),()=>{window.removeEventListener("pointerup",Rt)}},[]);const Ye=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.ParabolicDishElement",Ce))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",Ce)+")":"")+(t!=null&&t.label?"":` +`+B.t("word.Coordinates",Ce)+": ("+ze.toFixed(1)+", "+Ae.toFixed(1)+", "+se.toFixed(1)+") "+B.t("word.MeterAbbreviation",Ce)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ce,ze,Ae,se]),lt=g.useMemo(()=>new cn(0,0,C[2],"ZXY"),[C]),Oe=(Rt,Ct)=>{Rt.intersections.length>0&&Rt.intersections[0].object===Rt.eventObject&&($(Ct),Ct===Ho.Top?G.style.cursor="move":Ct===ai.Lower||Ct===ai.Upper||Ct===ai.Tilt?G.style.cursor="grab":G.style.cursor="pointer")},ut=()=>{$(null),G.style.cursor="default"},ht=g.useMemo(()=>zi(new Date(M),D),[M,D]),Qe=g.useMemo(()=>{var Rt;return(Rt=E(T))==null?void 0:Rt.rotation[2]},[T]),nt=Qe?ht.clone().applyAxisAngle(Oo,-Qe):ht,mt=g.useMemo(()=>{if(ht.z>0){const Rt=Math.hypot(nt.x,nt.y);return new cn(Math.atan2(Rt,nt.z),0,Math.atan2(nt.y,nt.x)+$t,"ZXY")}return new cn(p,0,m,"ZXY")},[ht,p,m,nt.x,nt.y,nt.z]),tt=-(Me+l)/2,gt=k.length<50,Ve=g.useMemo(()=>{const Rt=[];if(gt){const Ct=[],yt=[];let at,Et,Lt;const Je=.25*Re;for(let st=0;st<=pe;st++)at=fa*st/pe,Et=Math.cos(at),Lt=Math.sin(at),Ct.push(new ue(ge*Et,ge*Lt,Re)),yt.push(new ue(ge*Et/2,ge*Lt/2,Je));Rt.push({points:Ct}),Rt.push({points:yt});for(let st=0;st<12;st++){at=fa*st/12,Et=Math.cos(at),Lt=Math.sin(at);const It=[];for(let ot=0;ot<=Ie;ot++){const it=ot===0?0:ot/Ie*ge;It.push(new ue(it*Et,it*Lt,it*it/f+.01))}Rt.push({points:It})}}return Rt},[ge,f,gt]),je=g.useMemo(()=>{if(c===pf.CentralPoleWithTripod){const Rt=[];let Ct;for(let yt=0;yt<3;yt++){Ct=fa*yt/3;const at=[];at.push(new ue(ge*Math.cos(Ct),ge*Math.sin(Ct),Re)),at.push(new ue(0,0,Ne)),Rt.push({points:at})}return Rt}},[ge,f,c]),et=g.useMemo(()=>{if(c===pf.Quadrupod){const Rt=[];let Ct;for(let yt=0;yt<4;yt++){Ct=fa*yt/4;const at=[];at.push(new ue(ge*Math.cos(Ct),ge*Math.sin(Ct),Re)),at.push(new ue(0,0,Ne)),Rt.push({points:at})}return Rt}},[ge,f,c]),bt=Math.max(1,(i+a)/16),St=$8*bt*1.5,Pt=Tm*bt*3,Yt=ht.clone().multiplyScalar(Pe),zt=new ue(0,0,Ne).applyEuler(mt);return h.jsxs("group",{name:"Parabolic Dish Group "+e,rotation:lt,position:[ze,Ae,se+Se],children:[h.jsxs("group",{rotation:mt,children:[h.jsx(MMe,{receiveShadow:F,castShadow:F,uuid:e,ref:ne,args:[f/2,ge,pe,Ie],name:"Parabolic Dish Front Side",onPointerDown:Rt=>{Rt.button!==2&&L(e,Rt,er.Select)},onContextMenu:Rt=>{L(e,Rt,er.ContextMenu),R(Ct=>{Rt.intersections.length>0&&Rt.intersections[0].object===ne.current&&(Ct.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:Rt=>{Rt.intersections.length>0&&Rt.intersections[0].object===ne.current&&(oe(!0),G.style.cursor="move")},onPointerOut:()=>{oe(!1),G.style.cursor="default"},children:N&&ae?h.jsx("meshBasicMaterial",{attach:"material",side:$i,map:ae}):h.jsx("meshPhongMaterial",{attach:"material",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"})}),h.jsx(MMe,{receiveShadow:F,castShadow:F,uuid:e+" backside",ref:te,args:[f/2,ge,pe,Ie],name:"Parabolic Dish Back Side",position:[0,0,-Se/4],onPointerDown:Rt=>{Rt.button!==2&&L(e,Rt,er.Select)},onContextMenu:Rt=>{L(e,Rt,er.ContextMenu),R(Ct=>{Rt.intersections.length>0&&Rt.intersections[0].object===te.current&&(Ct.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:Rt=>{Rt.intersections.length>0&&Rt.intersections[0].object===te.current&&(oe(!0),G.style.cursor="move")},onPointerOut:()=>{oe(!1),G.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:js,color:P})}),Ve&&Ve.length>0&&Ve.map((Rt,Ct)=>h.jsx(xe.Fragment,{children:h.jsx(On,{name:"Parabolic Dish Wireframe",userData:{unintersectable:!0},points:Rt.points,castShadow:!1,receiveShadow:!1,lineWidth:S,color:A})},Ct)),h.jsx(wa,{name:"Parabolic Dish Receiver",uuid:e,args:[u,u,.5,gt?12:4,1],rotation:[$t,0,0],position:[0,0,Ne-.1],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),ht.z>0&&h.jsx("mesh",{position:[0,0,Ne-.1],children:h.jsx("sprite",{scale:[Le,Le,Le],children:h.jsx("spriteMaterial",{map:He,transparent:!1,color:16777215,blending:Th,depthWrite:!1})})}),(c===pf.CentralPole||c===pf.CentralPoleWithTripod)&&h.jsx(wa,{name:"Parabolic Dish Receiver Pole",uuid:e,args:[d,d,Ne,gt?6:2,1],rotation:[$t,0,0],position:[0,0,Ne/2],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),c===pf.CentralPoleWithTripod&&je&&je.map((Rt,Ct)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{name:"Parabolic Dish Tripod Lines",userData:{unintersectable:!0},points:Rt.points,castShadow:!1,receiveShadow:!1,lineWidth:1,color:ve?"dimgray":P}),h.jsx(Ys,{position:new ue(Rt.points[0].x,Rt.points[0].y,Rt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Tripod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Ct)),c===pf.Quadrupod&&et&&et.map((Rt,Ct)=>h.jsxs(xe.Fragment,{children:[h.jsx(On,{name:"Parabolic Dish Quadrupod Lines",userData:{unintersectable:!0},points:Rt.points,castShadow:!1,receiveShadow:!1,lineWidth:2,color:ve?"dimgray":P}),h.jsx(Ys,{position:new ue(Rt.points[0].x,Rt.points[0].y,Rt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Quadrupod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Ct)),h.jsx(fH,{name:"Parabolic Dish Simulation Circle",uuid:e,args:[i/2,pe],position:[0,0,Re],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),_&&b&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ge,-we,Re],[-ge,we,Re],[ge,we,Re],[ge,-we,Re],[-ge,-we,Re]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),_&&!b&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:q,position:new ue(0,0,0),args:[Pt,6,6],name:Ho.Default,onPointerOver:Rt=>{Oe(Rt,Ho.Top)},onPointerOut:()=>{ut()},onPointerDown:Rt=>{Rt.button!==2&&L(e,Rt,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(di,{ref:le,position:[(_e.x+qe.x)/2,_e.y,_e.z],args:[St,St,l*1.2],name:xt.Lower,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=le.current.localToWorld(new ue(0,a,-_e.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Lower)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Lower||Y===xt.Lower?Aa:ll})}),h.jsx(di,{ref:de,position:[(Ue.x+Fe.x)/2,Ue.y,Ue.z],args:[St,St,l*1.2],name:xt.Upper,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=de.current.localToWorld(new ue(0,-a,-Ue.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Upper)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Upper||Y===xt.Upper?Aa:ll})}),h.jsx(di,{ref:he,position:[_e.x,(_e.y+Ue.y)/2,_e.z],args:[St,St,l*1.2],name:xt.Left,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=he.current.localToWorld(new ue(i,0,-_e.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Left)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Left||Y===xt.Left?Aa:ll})}),h.jsx(di,{ref:me,position:[qe.x,(qe.y+Fe.y)/2,qe.z],args:[St,St,l*1.2],name:xt.Right,onPointerDown:Rt=>{L(e,Rt,er.Resize),he.current&&R(Ct=>{const yt=me.current.localToWorld(new ue(-i,0,-qe.z));Ct.resizeAnchor.copy(yt)})},onPointerOver:Rt=>{Oe(Rt,xt.Right)},onPointerOut:()=>{ut()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ee===xt.Right||Y===xt.Right?Aa:ll})})]})]})]}),Me>0&&h.jsx(wa,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[w,w,Me+l,gt?4:2,1],position:[0,0,tt],rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),x&&ht.z>0&&h.jsx(On,{rotation:[-lt.x,0,-lt.z],userData:{unintersectable:!0},points:[zt,new ue(-.3*ge,0,.09*Re).applyEuler(mt),Yt,new ue(-.6*ge,0,.36*Re).applyEuler(mt),zt,new ue(-.9*ge,0,.81*Re).applyEuler(mt),Yt,zt,new ue(.3*ge,0,.09*Re).applyEuler(mt),Yt,new ue(.6*ge,0,.36*Re).applyEuler(mt),zt,new ue(.9*ge,0,.81*Re).applyEuler(mt),Yt],name:"Sun Beams",lineWidth:.25,color:"white"}),(Q||v)&&!_&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Ye,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(we*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),Yhn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,moduleLength:d,poleHeight:f,poleRadius:p=.1,drawSunBeam:m,rotation:y=[0,0,0],color:w="white",lineColor:x="black",lineWidth:C=.5,showLabel:P=!1,locked:A=!1,parentId:S,receiverId:v}=t,b=H(pn),T=H(Au),R=H(ml),M=H(tu),D=H(Qn),k=dt(vs),N=H(Df),U=In(O1),W=H(xs),F=H(Jn),E=H(z0),L=H(Ky),j=H(Cm),Y=Fc(e),{gl:{domElement:O}}=ti(),[_,G]=g.useState(!1),[Q,oe]=g.useState(null),[ee,$]=g.useState(1),[ae,Z]=g.useState(null),ne=g.useRef(null),te=g.useRef(null),q=g.useRef(null),le=g.useRef(null),de=g.useRef(null),he=g.useRef(null),me=g.useRef(!1),ce=Math.max(100,10*L),Pe=g.useMemo(()=>({lng:T}),[T]);let pe=n,Ie=o,ve=r;const ze=i/2,Ae=a/2,se=l/2,ge=f+ze,we=H(tt=>{for(const gt of tt.elements)if(gt.id===S)return gt});if(we)switch(we.type){case z.Foundation:if(ve=ge+se+we.lz,ye.isZero(y[2]))pe=we.cx+n*we.lx,Ie=we.cy+o*we.ly;else{const tt=new ue(n*we.lx,o*we.ly,0);tt.applyAxisAngle(Oo,y[2]),pe=we.cx+tt.x,Ie=we.cy+tt.y}break}const Se=new ue(-ze,-Ae,se),Me=new ue(-ze,Ae,se),Ce=new ue(ze,-Ae,se),Te=new ue(ze,Ae,se);g.useEffect(()=>{if(t&&k){const tt=U(t.id);tt&&Z(ye.fetchHeatmapTexture(tt,N??5))}},[k,N]),g.useEffect(()=>{$(Math.max(1,Math.round(a/d)))},[a,d]),g.useEffect(()=>{const tt=()=>{jn.getState().setEnableOrbitController(!0),me.current=!1};return window.addEventListener("pointerup",tt),()=>{window.removeEventListener("pointerup",tt)}},[]);const Re=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.FresnelReflectorElement",Pe))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",Pe)+")":"")+(t!=null&&t.label?"":` +`+B.t("word.Coordinates",Pe)+": ("+pe.toFixed(1)+", "+Ie.toFixed(1)+", "+ve.toFixed(1)+") "+B.t("word.MeterAbbreviation",Pe)),[t==null?void 0:t.label,t==null?void 0:t.locked,Pe,pe,Ie,ve]),Ne=g.useMemo(()=>new cn(0,0,y[2],"ZXY"),[y]),_e=(tt,gt)=>{tt.intersections.length>0&&tt.intersections[0].object===tt.eventObject&&(oe(gt),gt===Ho.Top?O.style.cursor="move":gt===ai.Lower||gt===ai.Upper||gt===ai.Tilt?O.style.cursor="grab":O.style.cursor="pointer")},Ue=()=>{oe(null),O.style.cursor="default"},qe=g.useMemo(()=>zi(new Date(R),M),[R,M]),Fe=we==null?void 0:we.rotation[2],He=v&&v!==S?F(v):null,Le=g.useMemo(()=>{if(He){if(He.type===z.Foundation){const tt=He;if(tt.solarStructure===Nn.FocusPipe&&tt.solarAbsorberPipe)return new ue((tt.cx-pe)*(Fe?Math.cos(Fe):1),(tt.cy-Ie)*(Fe?Math.sin(Fe):0),tt.cz-ve+tt.lz/2+(tt.solarAbsorberPipe.absorberHeight??10))}}else if(we&&we.type===z.Foundation){const tt=we;if(tt.solarStructure===Nn.FocusPipe&&tt.solarAbsorberPipe)return new ue((tt.cx-pe)*(Fe?Math.cos(Fe):1),(tt.cy-Ie)*(Fe?Math.sin(Fe):0),tt.cz-ve+tt.lz/2+(tt.solarAbsorberPipe.absorberHeight??10))}return null},[He,we,pe,Ie,ve,Fe]),Ye=g.useRef(new ue),lt=g.useMemo(()=>{if(Le&&qe.z>0){const tt=Fe?new ue(Math.sin(Fe),Math.cos(Fe),0):new ue(0,1,0);Ye.current.set(Le.x,Le.y,Le.z);const gt=qe.z{const tt=[],gt=Math.cos(u)*d,Ve=Math.sin(u)*d,je=ee/2-.5;for(let et=0;et{const tt=[],gt=a/ee;for(let Ve=0;Ve<=ee;Ve++){const je=[];je.push(new ue(-ze,-Ae+Ve*gt,se)),je.push(new ue(ze,-Ae+Ve*gt,se)),tt.push({points:je})}return tt},[i,a,se,ee]),Qe=Math.max(1,Math.min(i*5,a*5,(i+a)/16)),nt=$8*Qe*1.5,mt=Tm*Qe*2;return h.jsxs("group",{name:"Fresnel Reflector Group "+e,rotation:Ne,position:[pe,Ie,ve+se],children:[h.jsxs("group",{rotation:lt,children:[h.jsxs(di,{receiveShadow:W,castShadow:W,uuid:e,ref:ne,args:[i,a,l],name:"Fresnel Reflector",onPointerDown:tt=>{tt.button!==2&&E(e,tt,er.Select)},onContextMenu:tt=>{E(e,tt,er.ContextMenu),b(gt=>{tt.intersections.length>0&&tt.intersections[0].object===ne.current&&(gt.contextMenuObjectType=z.FresnelReflector)})},onPointerOver:tt=>{tt.intersections.length>0&&tt.intersections[0].object===ne.current&&(G(!0),O.style.cursor="move")},onPointerOut:()=>{G(!1),O.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:w}),h.jsx("meshStandardMaterial",{attach:"material-1",color:w}),h.jsx("meshStandardMaterial",{attach:"material-2",color:w}),h.jsx("meshStandardMaterial",{attach:"material-3",color:w}),k&&ae?h.jsx("meshBasicMaterial",{attach:"material-4",side:$i,map:ae}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:w})]}),ht&&ht.map((tt,gt)=>h.jsx(On,{name:"Fresnel Reflector Module Line",userData:{unintersectable:!0},points:tt.points,castShadow:!1,receiveShadow:!1,lineWidth:C,color:x},gt)),h.jsx(On,{name:"Fresnel Reflector Outline 1",userData:{unintersectable:!0},points:[[-ze,-Ae,se],[-ze,Ae,se]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:x}),h.jsx(On,{name:"Fresnel Reflector Outline 2",userData:{unintersectable:!0},points:[[ze,-Ae,se],[ze,Ae,se]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:x}),h.jsx(yi,{name:"Fresnel Reflector Simulation Plane",uuid:e,args:[i,a],position:[0,0,se],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),Y&&A&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ze,-Ae,se],[-ze,Ae,se],[ze,Ae,se],[ze,-Ae,se],[-ze,-Ae,se]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),Y&&!A&&h.jsxs(h.Fragment,{children:[h.jsx(Ys,{ref:te,position:new ue(0,0,0),args:[mt,6,6],name:Ho.Default,castShadow:!1,receiveShadow:!1,onPointerOver:tt=>{_e(tt,Ho.Top)},onPointerOut:()=>{Ue()},onPointerDown:tt=>{tt.button!==2&&E(e,tt,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(di,{ref:q,position:[(Se.x+Ce.x)/2,Se.y,Se.z-se],args:[nt,nt,l*1.2],name:xt.Lower,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=q.current.localToWorld(new ue(0,a,-Se.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Lower)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Lower||j===xt.Lower?Aa:ll})}),h.jsx(di,{ref:le,position:[(Me.x+Te.x)/2,Me.y,Me.z-se],args:[nt,nt,l*1.2],name:xt.Upper,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=le.current.localToWorld(new ue(0,-a,-Me.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Upper)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Upper||j===xt.Upper?Aa:ll})}),h.jsx(di,{ref:de,position:[Se.x,(Se.y+Me.y)/2,Se.z],args:[nt,nt,l*1.2],name:xt.Left,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=de.current.localToWorld(new ue(i,0,-Se.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Left)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Left||j===xt.Left?Aa:ll})}),h.jsx(di,{ref:he,position:[Ce.x,(Ce.y+Te.y)/2,Ce.z],args:[nt,nt,l*1.2],name:xt.Right,castShadow:!1,receiveShadow:!1,onPointerDown:tt=>{E(e,tt,er.Resize),de.current&&b(gt=>{const Ve=he.current.localToWorld(new ue(-i,0,-Ce.z));gt.resizeAnchor.copy(Ve)})},onPointerOver:tt=>{_e(tt,xt.Right)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:Q===xt.Right||j===xt.Right?Aa:ll})})]})]})]}),ge>0&&ut.map((tt,gt)=>{const Ve=D.length<100?4:2;return h.jsx(wa,{userData:{unintersectable:!0},name:"Pole "+gt,castShadow:!1,receiveShadow:!1,args:[p,p,ge+(tt.z-Oe)*2+l,Ve,1],position:tt,rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})},gt)}),m&&qe.z>0&&h.jsx(On,{rotation:[-Ne.x,0,-Ne.z],userData:{unintersectable:!0},points:Le?[Ye.current,new ue(0,0,se),qe.clone().multiplyScalar(ce)]:[new ue(0,0,se),qe.clone().multiplyScalar(ce)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(_||P)&&!Y&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Re,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(Ae*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),Ohn=xe.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,poleHeight:d,poleRadius:f=Math.min(i,a)/20,drawSunBeam:p,rotation:m=[0,0,0],color:y="white",lineColor:w="black",lineWidth:x=.5,showLabel:C=!1,locked:P=!1,parentId:A,towerId:S}=t,v=H(pn),b=H(ml),T=H(tu),R=H(Qn),M=dt(vs),D=H(Df),k=In(O1),N=H(xs),U=H(Jn),W=H(z0),F=H(Ky),E=Fc(e),{gl:{domElement:L}}=ti(),[j,Y]=g.useState(!1),[O,_]=g.useState(null),G=g.useRef(null),Q=g.useRef(null),oe=g.useRef(!1),ee=Math.max(100,10*F),$=Kt();let ae=n,Z=o,ne=r;const te=i/2,q=a/2,le=l/2,de=d+Math.max(te,q),he=H(Me=>{for(const Ce of Me.elements)if(Ce.id===A)return Ce});if(he)switch(he.type){case z.Foundation:if(ne=de+le+he.lz,ye.isZero(m[2]))ae=he.cx+n*he.lx,Z=he.cy+o*he.ly;else{const Me=new ue(n*he.lx,o*he.ly,0);Me.applyAxisAngle(Oo,m[2]),ae=he.cx+Me.x,Z=he.cy+Me.y}break}g.useEffect(()=>{if(t&&M){const Me=k(t.id);Me&&_(ye.fetchHeatmapTexture(Me,D??5))}},[M,D]),g.useEffect(()=>{const Me=()=>{jn.getState().setEnableOrbitController(!0),oe.current=!1};return window.addEventListener("pointerup",Me),()=>{window.removeEventListener("pointerup",Me)}},[]);const me=g.useMemo(()=>(t!=null&&t.label?t.label:B.t("shared.HeliostatElement",$))+(t!=null&&t.locked?" ("+B.t("shared.ElementLocked",$)+")":"")+(t!=null&&t.label?"":` +`+B.t("word.Coordinates",$)+": ("+ae.toFixed(1)+", "+Z.toFixed(1)+", "+ne.toFixed(1)+") "+B.t("word.MeterAbbreviation",$)),[t==null?void 0:t.label,t==null?void 0:t.locked,$,ae,Z,ne]),ce=g.useMemo(()=>new cn(0,0,m[2],"ZXY"),[m]),Pe=(Me,Ce)=>{Me.intersections.length>0&&Me.intersections[0].object===Me.eventObject&&(L.style.cursor=Ce===Ho.Default?"move":"pointer")},pe=()=>{L.style.cursor="default"},Ie=g.useMemo(()=>zi(new Date(b),T),[b,T]),ve=he==null?void 0:he.rotation[2],ze=S&&S!==A?U(S):null,Ae=g.useMemo(()=>{if(ze){if(ze.type===z.Foundation){const Me=ze;if(Me.solarStructure===Nn.FocusTower&&Me.solarPowerTower)return new ue(Me.cx-ae,Me.cy-Z,Me.cz-ne+Me.lz/2+(Me.solarPowerTower.towerHeight??20))}}else if(he&&he.type===z.Foundation){const Me=he;if(Me.solarStructure===Nn.FocusTower&&Me.solarPowerTower)return new ue(Me.cx-ae,Me.cy-Z,Me.cz-ne+Me.lz/2+(Me.solarPowerTower.towerHeight??20))}return null},[he,ae,Z,ne,ze]),se=g.useMemo(()=>{if(Ae&&Ie.z>0){let Ce=Ae.clone().normalize().add(Ie).normalize();ye.isSame(Ce,Oo)&&(Ce=new ue(-.001,0,1).normalize()),ve&&Ce.applyAxisAngle(Oo,-ve);const Te=Math.hypot(Ce.x,Ce.y);return new cn(Math.atan2(Te,Ce.z),0,Math.atan2(Ce.y,Ce.x)+$t,"ZXY")}return new cn(c,0,u,"ZXY")},[Ae,Ie,c,u,ve]),ge=-(de+l)/2,we=Math.max(1,(i+a)/8),Se=Tm*we*4;return h.jsxs("group",{name:"Heliostat Group "+e,rotation:ce,position:[ae,Z,ne+le],children:[h.jsxs("group",{rotation:se,children:[h.jsxs(di,{receiveShadow:N,castShadow:N,uuid:e,ref:G,args:[i,a,l],name:"Heliostat",onPointerDown:Me=>{Me.button!==2&&W(e,Me,er.Select)},onContextMenu:Me=>{W(e,Me,er.ContextMenu),v(Ce=>{Me.intersections.length>0&&Me.intersections[0].object===G.current&&(Ce.contextMenuObjectType=z.Heliostat)})},onPointerOver:Me=>{Me.intersections.length>0&&Me.intersections[0].object===G.current&&(Y(!0),L.style.cursor="move")},onPointerOut:()=>{Y(!1),L.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:y}),h.jsx("meshStandardMaterial",{attach:"material-1",color:y}),h.jsx("meshStandardMaterial",{attach:"material-2",color:y}),h.jsx("meshStandardMaterial",{attach:"material-3",color:y}),M&&O?h.jsx("meshBasicMaterial",{attach:"material-4",side:$i,map:O}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new ir("white"),shininess:100*s,side:$i,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:y})]}),h.jsx(yi,{name:"Heliostat Simulation Plane",uuid:e,args:[i,a],position:[0,0,le],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:zr})}),E&&P&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-te,-q,le],[-te,q,le],[te,q,le],[te,-q,le],[-te,-q,le]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),E&&!P&&h.jsx(Ys,{ref:Q,position:new ue(0,0,0),args:[Se,6,6],name:Ho.Default,castShadow:!1,receiveShadow:!1,onPointerOver:Me=>{Pe(Me,Ho.Default)},onPointerOut:()=>{pe()},onPointerDown:Me=>{Me.button!==2&&W(e,Me,er.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})})]}),de>0&&h.jsx(wa,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[f,f,de+l,R.length<100?4:2,1],position:new ue(0,0,ge),rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:y})}),p&&Ie.z>0&&h.jsx(On,{rotation:[-ce.x,0,-ce.z],userData:{unintersectable:!0},points:Ae?[Ae,new ue(0,0,le),Ie.clone().multiplyScalar(ee)]:[new ue(0,0,le),Ie.clone().multiplyScalar(ee)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(j||C)&&!E&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:me,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(q*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),_hn=xe.memo(t=>{var ae;const{parentId:e,id:n,cx:o,cy:r,cz:i,name:a=uo.WhiteFlower,flip:l=!1,locked:s=!1}=t;let c=!1;H(Z=>{if(e===rr)c=!0;else for(const ne of Z.elements)if(ne.id===e){c=!0;break}});const u=H(Jp);g.useEffect(()=>{c||u(n,!1)},[c]);const d=H(pn),f=H(Au),p=H(M0)??!1,m=H(ml),y=H(tu),w=H(K2e)??tQ,x=H($2e)??nQ,C=H(z0),P=H(FS),A=H($y),S=dt(vs),[v,b]=g.useState(!1),{gl:T}=ti(),R=Fc(n),M=jn(Z=>Z.contentRef),D=g.useRef(null),k=g.useRef(null),N=g.useRef(null),U=g.useRef(null),W=g.useMemo(()=>({lng:f}),[f]),F=g.useMemo(()=>{const Z=ye.dayOfYear(new Date(m));return y>0?Zx:Z>=w&&Z<=x},[m,w,x,y]),E=g.useRef(!1),L=H(OM);L!==E.current&&(E.current=L,M!=null&&M.current&&D.current&&M.current.add(D.current)),g.useEffect(()=>{if(e!==rr){const Z=Q();Z&&D.current&&Z.add(D.current)}},[L,e]),g.useEffect(()=>{const Z=Q();Z&&D.current&&Z.add(D.current)},[M]);const j=Up(i3.fetchTextureImage(a,F)),Y=g.useMemo(()=>{const Z=j.clone();return l?(Z.wrapS=es,Z.repeat.x=-1,Z.needsUpdate=!0):Z.repeat.x=1,Z},[j,l]),O=g.useMemo(()=>i3.fetchLabel(a,W)+(s?" ("+B.t("shared.ElementLocked",W)+")":"")+` +`+B.t("word.Coordinates",W)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+B.t("word.MeterAbbreviation",W),[a,o,r,s,W]),_=g.useCallback((Z,ne)=>{dt.getState().duringCameraInteraction||Z.intersections.length>0&&(Z.intersections[0].object===Z.eventObject||Z.intersections.length>1&&Z.intersections[1].object===Z.eventObject)&&(d(q=>{q.hoveredHandle=ne,q.selectedElementHeight=t.lz}),ye.isMoveHandle(ne)?T.domElement.style.cursor="move":T.domElement.style.cursor="pointer")},[t.lz]),G=g.useCallback(()=>{d(Z=>{Z.hoveredHandle=null}),T.domElement.style.cursor=H.getState().addedCuboidId?"crosshair":"default"},[]),Q=()=>e!==rr&&(M!=null&&M.current)?ye.getObjectChildById(M.current,e):null,oe=g.useMemo(()=>i3.fetchSpread(a),[a]),ee=g.useMemo(()=>i3.fetchHeight(a),[a]);Gp(({camera:Z})=>{if(D.current){const{rot:ne}=ye.getWorldDataById(e);if(p)k.current&&U.current&&(k.current.rotation.set($t,0,0),U.current.rotation.set(0,0,0)),D.current.rotation.set(-$t,0,0);else{if(k.current&&U.current){const{x:te,y:q}=Z.position,{x:le,y:de}=D.current.position;if(Q()){const me=D.current.localToWorld(new ue),ce=Math.atan2(te-me.x,q-me.y)+ne;k.current.rotation.set($t,-ce,0),U.current.rotation.set(-$t,ce,0)}else{const me=Math.atan2(te-le,q-de);k.current.rotation.set($t,-me,0),U.current.rotation.set(-$t,me,0)}}D.current.rotation.set(0,0,0)}}});const $=Tm*3;return h.jsx(h.Fragment,{children:c?h.jsx("group",{ref:D,name:"Flower Group "+n,userData:{aabb:!0},position:[o,r,(i??0)+(p?.25:0)],children:h.jsxs("group",{position:[0,0,ee/2],children:[h.jsx(MR,{ref:k,uuid:n,name:a,follow:!1,rotation:[$t,0,0],children:h.jsx(yi,{args:[oe,ee],receiveShadow:!S,children:h.jsx("meshToonMaterial",{map:Y,side:zr,alphaTest:.5})})}),h.jsx(MR,{ref:U,name:"Interaction Billboard",visible:!1,position:[0,0,-ee/2],children:h.jsx(yi,{ref:N,renderOrder:3,name:a+" plane",args:[oe/2,ee*2],rotation:[p?$t:0,0,0],onContextMenu:Z=>{C(n,Z,er.ContextMenu),d(ne=>{Z.intersections.length>0&&Z.intersections[0].object===N.current&&(ne.contextMenuObjectType=z.Flower)})},onPointerDown:Z=>{Z.button!==2&&Z.eventObject===Z.intersections[0].eventObject&&(C(n,Z,er.Move),jn.setState({flowerRef:D}))},onPointerOver:Z=>{Z.intersections.length>0&&Z.intersections[0].object===N.current&&b(!0)},onPointerOut:()=>{b(!1)}})}),R&&s&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-oe/2,-ee/2,0],[-oe/2,ee/2,0],[-oe/2,ee/2,0],[oe/2,ee/2,0],[oe/2,-ee/2,0],[oe/2,ee/2,0],[oe/2,-ee/2,0],[-oe/2,-ee/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(ae=k.current)==null?void 0:ae.rotation,color:i0}),R&&!s&&h.jsx(h.Fragment,{children:h.jsx(Ys,{position:new ue(0,0,-ee/2),args:[$,6,6,0,Math.PI],name:Ho.Default,renderOrder:2,onPointerDown:Z=>{Z.button!==2&&Z.eventObject===Z.intersections[0].eventObject&&(C(n,Z,er.Move),jn.setState({flowerRef:D}))},onPointerEnter:Z=>{_(Z,Ho.Default)},onPointerLeave:G,children:h.jsx("meshBasicMaterial",{attach:"material",color:A===Ho.Default||P===Ho.Default?Aa:q8})})}),v&&!R&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:O,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,ee/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});var Bpe=function(t,e){return Bpe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},Bpe(t,e)};function Mr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Bpe(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var n0=function(){return n0=Object.assign||function(e){for(var n,o=1,r=arguments.length;o0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ep(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var o=n.call(t),r,i=[],a;try{for(;(e===void 0||e-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(l){a={error:l}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function xl(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o0?Id(mI,--Vy):0,zH--,v0===10&&(zH=1,ite--),v0}function P5(){return v0=Vy2||Ope(v0)>3?"":" "}function epn(t,e){for(;--e&&P5()&&!(v0<48||v0>102||v0>57&&v0<65||v0>70&&v0<97););return lte(t,CG()+(e<6&&vb()==32&&P5()==32))}function _pe(t){for(;P5();)switch(v0){case t:return Vy;case 34:case 39:t!==34&&t!==39&&_pe(v0);break;case 40:t===41&&_pe(t);break;case 92:P5();break}return Vy}function tpn(t,e){for(;P5()&&t+v0!==57;)if(t+v0===84&&vb()===47)break;return"/*"+lte(e,Vy-1)+"*"+q3e(t===47?t:P5())}function npn(t){for(;!Ope(vb());)P5();return lte(t,Vy)}function opn(t){return Qhn(RG("",null,null,null,[""],t=qhn(t),0,[0],t))}function RG(t,e,n,o,r,i,a,l,s){for(var c=0,u=0,d=a,f=0,p=0,m=0,y=1,w=1,x=1,C=0,P="",A=r,S=i,v=o,b=P;w;)switch(m=C,C=P5()){case 40:if(m!=108&&Id(b,d-1)==58){PG(b+=za(qse(C),"&","&\f"),"&\f",krt(c?l[c-1]:0))!=-1&&(x=-1);break}case 34:case 39:case 91:b+=qse(C);break;case 9:case 10:case 13:case 32:b+=Zhn(m);break;case 92:b+=epn(CG()-1,7);continue;case 47:switch(vb()){case 42:case 47:ik(rpn(tpn(P5(),CG()),e,n,s),s);break;default:b+="/"}break;case 123*y:l[c++]=J9(b)*x;case 125*y:case 59:case 0:switch(C){case 0:case 125:w=0;case 59+u:x==-1&&(b=za(b,/\f/g,"")),p>0&&J9(b)-d&&ik(p>32?DMe(b+";",o,n,d-1,s):DMe(za(b," ","")+";",o,n,d-2,s),s);break;case 59:b+=";";default:if(ik(v=zMe(b,e,n,c,u,r,l,P,A=[],S=[],d,i),i),C===123)if(u===0)RG(b,e,v,v,A,i,d,l,S);else switch(f===99&&Id(b,3)===110?100:f){case 100:case 108:case 109:case 115:RG(t,v,v,o&&ik(zMe(t,v,v,0,0,r,l,P,r,A=[],d,S),S),r,S,d,l,o?A:S);break;default:RG(b,v,v,v,[""],S,0,l,S)}}c=u=p=0,y=x=1,P=b="",d=a;break;case 58:d=1+J9(b),p=m;default:if(y<1){if(C==123)--y;else if(C==125&&y++==0&&$hn()==125)continue}switch(b+=q3e(C),C*y){case 38:x=u>0?1:(b+="\f",-1);break;case 44:l[c++]=(J9(b)-1)*x,x=1;break;case 64:vb()===45&&(b+=qse(P5())),f=vb(),u=d=J9(P=b+=npn(CG())),C++;break;case 45:m===45&&J9(b)==2&&(y=0)}}return i}function zMe(t,e,n,o,r,i,a,l,s,c,u,d){for(var f=r-1,p=r===0?i:[""],m=Lrt(p),y=0,w=0,x=0;y0?p[C]+" "+P:za(P,/&\f/g,p[C])))&&(s[x++]=A);return ate(t,e,n,r===0?rte:l,s,c,u,d)}function rpn(t,e,n,o){return ate(t,e,n,Drt,q3e(Khn()),IH(t,2,-2),0,o)}function DMe(t,e,n,o,r){return ate(t,e,n,$3e,IH(t,0,o),IH(t,o+1,-1),o,r)}function Nrt(t,e,n){switch(Xhn(t,e)){case 5103:return is+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return is+t+t;case 4789:return Zk+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return is+t+Zk+t+mc+t+t;case 5936:switch(Id(t,e+11)){case 114:return is+t+mc+za(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return is+t+mc+za(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return is+t+mc+za(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return is+t+mc+t+t;case 6165:return is+t+mc+"flex-"+t+t;case 5187:return is+t+za(t,/(\w+).+(:[^]+)/,is+"box-$1$2"+mc+"flex-$1$2")+t;case 5443:return is+t+mc+"flex-item-"+za(t,/flex-|-self/g,"")+(lA(t,/flex-|baseline/)?"":mc+"grid-row-"+za(t,/flex-|-self/g,""))+t;case 4675:return is+t+mc+"flex-line-pack"+za(t,/align-content|flex-|-self/g,"")+t;case 5548:return is+t+mc+za(t,"shrink","negative")+t;case 5292:return is+t+mc+za(t,"basis","preferred-size")+t;case 6060:return is+"box-"+za(t,"-grow","")+is+t+mc+za(t,"grow","positive")+t;case 4554:return is+za(t,/([^-])(transform)/g,"$1"+is+"$2")+t;case 6187:return za(za(za(t,/(zoom-|grab)/,is+"$1"),/(image-set)/,is+"$1"),t,"")+t;case 5495:case 3959:return za(t,/(image-set\([^]*)/,is+"$1$`$1");case 4968:return za(za(t,/(.+:)(flex-)?(.*)/,is+"box-pack:$3"+mc+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+is+t+t;case 4200:if(!lA(t,/flex-|baseline/))return mc+"grid-column-align"+IH(t,e)+t;break;case 2592:case 3360:return mc+za(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(o,r){return e=r,lA(o.props,/grid-\w+-end/)})?~PG(t+(n=n[e].value),"span",0)?t:mc+za(t,"-start","")+t+mc+"grid-row-span:"+(~PG(n,"span",0)?lA(n,/\d+/):+lA(n,/\d+/)-+lA(t,/\d+/))+";":mc+za(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(o){return lA(o.props,/grid-\w+-start/)})?t:mc+za(za(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return za(t,/(.+)-inline(.+)/,is+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(J9(t)-1-e>6)switch(Id(t,e+1)){case 109:if(Id(t,e+4)!==45)break;case 102:return za(t,/(.+:)(.+)-([^]+)/,"$1"+is+"$2-$3$1"+Zk+(Id(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~PG(t,"stretch",0)?Nrt(za(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return za(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,r,i,a,l,s,c){return mc+r+":"+i+c+(a?mc+r+"-span:"+(l?s:+s-+i)+c:"")+t});case 4949:if(Id(t,e+6)===121)return za(t,":",":"+is)+t;break;case 6444:switch(Id(t,Id(t,14)===45?18:11)){case 120:return za(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+is+(Id(t,14)===45?"inline-":"")+"box$3$1"+is+"$2$3$1"+mc+"$2box$3")+t;case 100:return za(t,":",":"+mc)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return za(t,"scroll-","scroll-snap-")+t}return t}function FJ(t,e){for(var n="",o=0;o-1&&!t.return)switch(t.type){case $3e:t.return=Nrt(t.value,t.length,n);return;case Ert:return FJ([kw(t,{value:za(t.value,"@","@"+is)})],o);case rte:if(t.length)return Jhn(n=t.props,function(r){switch(lA(r,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":XP(kw(t,{props:[za(r,/:(read-\w+)/,":"+Zk+"$1")]})),XP(kw(t,{props:[r]})),Ype(t,{props:IMe(n,o)});break;case"::placeholder":XP(kw(t,{props:[za(r,/:(plac\w+)/,":"+is+"input-$1")]})),XP(kw(t,{props:[za(r,/:(plac\w+)/,":"+Zk+"$1")]})),XP(kw(t,{props:[za(r,/:(plac\w+)/,mc+"input-$1")]})),XP(kw(t,{props:[r]})),Ype(t,{props:IMe(n,o)});break}return""})}}var cpn={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ug={},DH=typeof process<"u"&&Ug!==void 0&&(Ug.REACT_APP_SC_ATTR||Ug.SC_ATTR)||"data-styled",Urt="active",jrt="data-styled-version",ste="6.1.10",Q3e=`/*!sc*/ +`,Z3e=typeof window<"u"&&"HTMLElement"in window,upn=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Ug!==void 0&&Ug.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Ug.REACT_APP_SC_DISABLE_SPEEDY!==""?Ug.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Ug.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Ug!==void 0&&Ug.SC_DISABLE_SPEEDY!==void 0&&Ug.SC_DISABLE_SPEEDY!==""&&Ug.SC_DISABLE_SPEEDY!=="false"&&Ug.SC_DISABLE_SPEEDY),cte=Object.freeze([]),EH=Object.freeze({});function dpn(t,e,n){return n===void 0&&(n=EH),t.theme!==n.theme&&t.theme||e||n.theme}var Brt=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),fpn=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,hpn=/(^-|-$)/g;function EMe(t){return t.replace(fpn,"-").replace(hpn,"")}var ppn=/(a)(d)/gi,W_=52,kMe=function(t){return String.fromCharCode(t+(t>25?39:97))};function Vpe(t){var e,n="";for(e=Math.abs(t);e>W_;e=e/W_|0)n=kMe(e%W_)+n;return(kMe(e%W_)+n).replace(ppn,"$1-$2")}var Qse,Yrt=5381,cR=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},Ort=function(t){return cR(Yrt,t)};function gpn(t){return Vpe(Ort(t)>>>0)}function mpn(t){return t.displayName||t.name||"Component"}function Zse(t){return typeof t=="string"&&!0}var _rt=typeof Symbol=="function"&&Symbol.for,Vrt=_rt?Symbol.for("react.memo"):60115,ypn=_rt?Symbol.for("react.forward_ref"):60112,Apn={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},wpn={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Grt={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},xpn=((Qse={})[ypn]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Qse[Vrt]=Grt,Qse);function FMe(t){return("type"in(e=t)&&e.type.$$typeof)===Vrt?Grt:"$$typeof"in t?xpn[t.$$typeof]:Apn;var e}var vpn=Object.defineProperty,bpn=Object.getOwnPropertyNames,LMe=Object.getOwnPropertySymbols,Spn=Object.getOwnPropertyDescriptor,Tpn=Object.getPrototypeOf,WMe=Object.prototype;function Xrt(t,e,n){if(typeof e!="string"){if(WMe){var o=Tpn(e);o&&o!==WMe&&Xrt(t,o,n)}var r=bpn(e);LMe&&(r=r.concat(LMe(e)));for(var i=FMe(t),a=FMe(e),l=0;l0?" Args: ".concat(e.join(", ")):""))}var Ppn=function(){function t(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return t.prototype.indexOfGroup=function(e){for(var n=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,r=o.length,i=r;e>=i;)if((i<<=1)<0)throw LU(16,"".concat(e));this.groupSizes=new Uint32Array(i),this.groupSizes.set(o),this.length=i;for(var a=r;a=this.length||this.groupSizes[e]===0)return n;for(var o=this.groupSizes[e],r=this.indexOfGroup(e),i=r+o,a=r;a=0){var o=document.createTextNode(n);return this.element.insertBefore(o,this.nodes[e]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.prototype.getRule=function(e){return e0&&(w+="".concat(x,","))}),s+="".concat(m).concat(y,'{content:"').concat(w,'"}').concat(Q3e)},u=0;u0?".".concat(e):f},u=s.slice();u.push(function(f){f.type===rte&&f.value.includes("&")&&(f.props[0]=f.props[0].replace(Lpn,n).replace(o,c))}),a.prefix&&u.push(spn),u.push(ipn);var d=function(f,p,m,y){p===void 0&&(p=""),m===void 0&&(m=""),y===void 0&&(y="&"),e=y,n=p,o=new RegExp("\\".concat(n,"\\b"),"g");var w=f.replace(Wpn,""),x=opn(m||p?"".concat(m," ").concat(p," { ").concat(w," }"):w);a.namespace&&(x=$rt(x,a.namespace));var C=[];return FJ(x,apn(u.concat(lpn(function(P){return C.push(P)})))),C};return d.hash=s.length?s.reduce(function(f,p){return p.name||LU(15),cR(f,p.name)},Yrt).toString():"",d}var Upn=new Krt,Xpe=Npn(),qrt=xe.createContext({shouldForwardProp:void 0,styleSheet:Upn,stylis:Xpe});qrt.Consumer;xe.createContext(void 0);function jMe(){return g.useContext(qrt)}var jpn=function(){function t(e,n){var o=this;this.inject=function(r,i){i===void 0&&(i=Xpe);var a=o.name+i.hash;r.hasNameForId(o.id,a)||r.insertRules(o.id,a,i(o.rules,a,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=n,t6e(this,function(){throw LU(12,String(o.name))})}return t.prototype.getName=function(e){return e===void 0&&(e=Xpe),this.name+e.hash},t}(),Bpn=function(t){return t>="A"&&t<="Z"};function BMe(t){for(var e="",n=0;n>>0);if(!n.hasNameForId(this.componentId,a)){var l=o(i,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,l)}r=Xv(r,a),this.staticRulesId=a}else{for(var s=cR(this.baseHash,o.hash),c="",u=0;u>>0);n.hasNameForId(this.componentId,p)||n.insertRules(this.componentId,p,o(c,".".concat(p),void 0,this.componentId)),r=Xv(r,p)}}return r},t}(),eit=xe.createContext(void 0);eit.Consumer;var ece={};function Vpn(t,e,n){var o=e6e(t),r=t,i=!Zse(t),a=e.attrs,l=a===void 0?cte:a,s=e.componentId,c=s===void 0?function(A,S){var v=typeof A!="string"?"sc":EMe(A);ece[v]=(ece[v]||0)+1;var b="".concat(v,"-").concat(gpn(ste+v+ece[v]));return S?"".concat(S,"-").concat(b):b}(e.displayName,e.parentComponentId):s,u=e.displayName,d=u===void 0?function(A){return Zse(A)?"styled.".concat(A):"Styled(".concat(mpn(A),")")}(t):u,f=e.displayName&&e.componentId?"".concat(EMe(e.displayName),"-").concat(e.componentId):e.componentId||c,p=o&&r.attrs?r.attrs.concat(l).filter(Boolean):l,m=e.shouldForwardProp;if(o&&r.shouldForwardProp){var y=r.shouldForwardProp;if(e.shouldForwardProp){var w=e.shouldForwardProp;m=function(A,S){return y(A,S)&&w(A,S)}}else m=y}var x=new _pn(n,f,o?r.componentStyle:void 0);function C(A,S){return function(v,b,T){var R=v.attrs,M=v.componentStyle,D=v.defaultProps,k=v.foldedComponentIds,N=v.styledComponentId,U=v.target,W=xe.useContext(eit),F=jMe(),E=v.shouldForwardProp||F.shouldForwardProp,L=dpn(b,W,D)||EH,j=function(oe,ee,$){for(var ae,Z=n0(n0({},ee),{className:void 0,theme:$}),ne=0;ne{if(H(OM),!dt.getState().waiting)return null;const e=()=>(g.useEffect(()=>(dt.getState().set(n=>{n.waiting=!1}),()=>{dt.getState().set(n=>{n.waiting=!1})})),null);return h.jsx(e,{})},Zpn=xe.memo(({id:t,cx:e,cy:n,cz:o,lx:r,lz:i,birdSafe:a=wc.None,numberOfBlades:l=3,speed:s=10,hubRadius:c=.75,hubLength:u=1.5,maximumChordRadius:d=3,maximumChordLength:f=1,towerHeight:p,towerRadius:m,bladeRadius:y,bladeTipWidth:w=.2,bladeRootRadius:x=.3,rotation:C=[0,0,0],relativeYawAngle:P=0,initialRotorAngle:A=0,pitchAngle:S=ye.toRadians(10),color:v="white",bladeColor:b=j9,stripeColor:T=B9,lineColor:R="black",lineWidth:M=.5,showLabel:D=!1,locked:k=!1,parentId:N})=>{const U=H(pn),W=H(Jn),F=H(z0),E=Fc(t),L=H(xs),j=H(ml),{gl:{domElement:Y}}=ti(),[O,_]=g.useState(!1),G=g.useRef(null),Q=g.useRef(null),oe=g.useRef(!1),ee=Kt(),q=g.useMemo(()=>ye.fetchBladeTexture(y,x*2,100,a,b,T),[x,y,a,b,T]),ae=H(ze=>{for(const Ae of ze.elements)if(Ae.id===N)return Ae});if(ae)switch(ae.type){case z.Foundation:if(o=ae.lz,ye.isZero(C[2]))e=ae.cx+e*ae.lx,n=ae.cy+n*ae.ly;else{const ze=new ue(e*ae.lx,n*ae.ly,0);ze.applyAxisAngle(Oo,C[2]),e=ae.cx+ze.x,n=ae.cy+ze.y}break}const Z=W(t),ne=c*1.25,te=u*2.5,$=y-d/3,le=g.useMemo(()=>{const ze=f-x,Ae=new jl,se=[];return se.push(new _t(-x,0)),se.push(new _t(-ze/2,y-$)),se.push(new _t(-ze,d)),se.push(new _t(x-w,y)),Ae.moveTo(-x,0),Ae.splineThru(se),Ae.lineTo(x,y),Ae.lineTo(x,0),Ae.closePath(),Ae},[y,$,f,d,x,w]),de=g.useMemo(()=>{const ze=new Date(j);return A+s*(ze.getHours()*60+ze.getMinutes())*Math.PI/72},[j,s,A]);g.useEffect(()=>{const ze=()=>{jn.getState().setEnableOrbitController(!0),oe.current=!1};return window.addEventListener("pointerup",ze),()=>{window.removeEventListener("pointerup",ze)}},[]);const he=g.useMemo(()=>(Z!=null&&Z.label?Z.label:B.t("shared.WindTurbineElement",ee))+(Z!=null&&Z.locked?" ("+B.t("shared.ElementLocked",ee)+")":"")+(Z!=null&&Z.label?"":` -`+B.t("word.Coordinates",ee)+": ("+e.toFixed(1)+", "+n.toFixed(1)+", "+o.toFixed(1)+") "+B.t("word.MeterAbbreviation",ee)),[Z==null?void 0:Z.label,Z==null?void 0:Z.locked,ee,e,n,o]),me=g.useMemo(()=>new cn(0,0,C[2]+P,"ZXY"),[C,P]),ce=(ze,Ae)=>{ze.intersections.length>0&&ze.intersections[0].object===ze.eventObject&&(Y.style.cursor=Ae===Ho.Default?"move":"pointer")},Pe=()=>{Y.style.cursor="default"},pe=Tm*4,Ie=g.useMemo(()=>{const ze=Math.PI*2/l,Ae=new Array;for(let se=0;seh.jsxs("group",{position:new ue(0,-u*.85,p),rotation:[$t,S,Ae,"XZY"],children:[h.jsxs("mesh",{name:"Blade "+ze+" Font Side",receiveShadow:L,castShadow:L,children:[h.jsx("shapeGeometry",{attach:"geometry",args:[le]}),h.jsx("meshStandardMaterial",{attach:"material",color:b,side:$i,map:se})]}),h.jsxs("mesh",{name:"Blade "+ze+" Back Side",receiveShadow:L,castShadow:L,position:new ue(0,-.05,0),children:[h.jsx("shapeGeometry",{attach:"geometry",args:[le]}),h.jsx("meshStandardMaterial",{attach:"material",color:b,side:js,map:se})]}),h.jsx(wa,{name:"Blade root",castShadow:!1,receiveShadow:!1,args:[x*1.1,x*1.1,.24,12,1],position:new ue(0,c-.14,0),children:h.jsx("meshStandardMaterial",{attach:"material",color:v})})]},ze);return h.jsxs("group",{name:"Wind Turbine Group "+t,rotation:me,position:[e,n,o],children:[h.jsx("group",{children:E&&!k&&h.jsx(Ys,{ref:Q,position:new ue(0,0,0),args:[pe+m,6,6],name:Ho.Default,castShadow:!1,receiveShadow:!1,onPointerOver:ze=>{ce(ze,Ho.Default)},onPointerOut:()=>{Pe()},onPointerDown:ze=>{ze.button!==2&&F(t,ze,er.Move)},children:h.jsx("meshStandardMaterial",{attach:"material",color:"orange"})})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Tower",ref:G,castShadow:L,receiveShadow:L,args:[m*.8,m*1.2,p,4,1],position:new ue(0,0,p*.5),rotation:[$t,0,0],onPointerDown:ze=>{ze.button!==2&&(F(t,ze,er.Select),jn.getState().setEnableOrbitController(!1))},onContextMenu:ze=>{F(t,ze,er.ContextMenu),U(Ae=>{ze.intersections.length>0&&ze.intersections[0].object===G.current&&(Ae.contextMenuObjectType=z.WindTurbine)})},onPointerOver:ze=>{ze.intersections.length>0&&ze.intersections[0].object===G.current&&(_(!0),Y.style.cursor="move")},onPointerOut:()=>{_(!1),Y.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),h.jsx(Ys,{userData:{unintersectable:!0},name:"Hub",castShadow:L,receiveShadow:L,args:[c,8,8,$t,Math.PI,0,Math.PI],position:new ue(0,-u*.5,p),rotation:[Math.PI,0,$t],scale:[u/c,1,1],children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Hub Cap",castShadow:L,receiveShadow:L,args:[c,c,.01,16,1],position:new ue(0,-u*.5,p),rotation:[Math.PI,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),h.jsx(_bt,{userData:{unintersectable:!0},name:"Nacelle",castShadow:L,receiveShadow:L,radius:.1,smoothness:4,args:[ne,ne,te],position:new ue(0,(te-u)*.5-.1,p),rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),a!==wc.None&&Ie.map((ze,Ae)=>ve(Ae,ze,q)),a===wc.None&&Ie.map((ze,Ae)=>ve(Ae,ze,null)),E&&k&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-r/2,0,0],[-r/2,i,0],[-r/2,i,0],[r/2,i,0],[r/2,0,0],[r/2,i,0],[r/2,0,0],[-r/2,0,0]],rotation:[$t,0,0],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),(O||D)&&!E&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:he,color:(Z==null?void 0:Z.labelColor)??"white",fontSize:(Z==null?void 0:Z.labelFontSize)??20,textHeight:(Z==null?void 0:Z.labelSize)??1,castShadow:!1,receiveShadow:!1,position:[0,0,1+p+c]})]})}),e1n=xe.memo(()=>{const t=H(Qn),e=g.useRef(null);return g.useEffect(()=>{e&&jn.setState({contentRef:e})},[]),console.debug(t),h.jsxs("group",{ref:e,name:"Content",children:[t.map(n=>{switch(n.type){case z.Foundation:return h.jsx(Wfn,{...n},n.id);case z.Sensor:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(Yot,{...o},n.id)}case z.Light:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(Oot,{...o},n.id)}case z.Cuboid:return n.parentId!==rr?null:h.jsx(Vot,{elements:t,cuboidModel:n},n.id);case z.Human:return h.jsx(Nhn,{...n},n.id);case z.Tree:return h.jsx(Uhn,{...n},n.id);case z.Flower:return h.jsx(_hn,{...n},n.id);case z.ParabolicDish:return h.jsx(Bhn,{...n},n.id);case z.ParabolicTrough:return h.jsx(jhn,{...n},n.id);case z.FresnelReflector:return h.jsx(Yhn,{...n},n.id);case z.Heliostat:return h.jsx(Ohn,{...n},n.id);case z.WindTurbine:return h.jsx(Zpn,{...n},n.id);case z.Polygon:switch(n.parentType){case z.Wall:return null;default:return h.jsx(xrt,{...n},n.id)}default:if(n.id)return h.jsx(xe.Fragment,{},n.id)}return null}),h.jsx(Qpn,{}),h.jsx(t1n,{})]})}),t1n=()=>{const t=H(S5e);return g.useEffect(()=>{H.getState().set(e=>{e.deletedRoofIdSet.clear()})},[t]),null},n1n=xe.memo(()=>{const t=H(pn),e=H(HS),n=H(RS),o=H(Q3),r=H(mQ),i=H(y5e),a=H(Jn),l=H(Z3),s=H(d5e),c=H(Jp),u=H(s5e),d=H(v5e),f=H(Fn),p=H(M7),m=H(uXe),y=H(bQ),w=H(FS),x=H(Cm),C=H(SQ),P=H(BRt),A=H(xs),S=H(EGe),v=H(kGe),b=H(Be=>Be.world.ground),T=H(YRt),R=H(ORt),M=dt(vs),D=dt(MCt),{get:k,scene:N,invalidate:U}=ti(),W=g.useRef(null),F=g.useRef(null),E=g.useRef(null),L=g.useRef(new ue),j=g.useRef(new ue),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(new Map),G=g.useRef(new Map),Q=g.useRef(new Map),oe=g.useRef(new Map),ee=g.useRef(new Map),q=g.useRef(new Map),ae=g.useRef(new ue(1,1,1)),Z=g.useRef(new ue(1,1,1)),ne=g.useRef([0,0,1]),te=g.useRef([0,0,1]),$=g.useRef(null),le=g.useRef(null),de=g.useRef(new Map),he=g.useRef(new Map),me=g.useRef(new Map),ce=g.useRef(!1),Pe=g.useRef(!1),pe=g.useRef(!1),Ie=g.useRef(!1),ve=g.useRef(!1),ze=g.useRef(new Map),Ae=g.useRef(new Map),se=g.useRef(new Map),ge=g.useRef(new ue),we=Kt();g.useEffect(()=>(window.addEventListener("pointerup",et),()=>{window.removeEventListener("pointerup",et)}),[]),g.useEffect(()=>{T&&(t(Be=>{Be.addedFoundationId=null,Be.deletedFoundationId=null}),ce.current=!1,Pe.current=!1)},[T]),g.useEffect(()=>{R&&(t(Be=>{Be.addedCuboidId=null,Be.deletedCuboidId=null}),pe.current=!1,Ie.current=!1)},[R]);const{camera:Se}=ti(),Me=g.useMemo(()=>new yu,[]),Ce=g.useMemo(()=>new _t,[]),Te=E.current?Math.cos(E.current.rotation[2]):1,Re=E.current?Math.sin(E.current.rotation[2]):0;let Ne=dh.Ground;const _e=g.useMemo(()=>new ue,[]),Ue=g.useMemo(()=>new cn,[]),qe=g.useMemo(()=>new cn,[]);if(E.current){if(ye.isPlantOrHuman(E.current)){Ne=dh.Vertical;const Be=H.getState().viewState.orthographic?0:-$t,{x:pt,y:ct}=Se.position,Xe=-Math.atan2(pt,ct);Ue.set(Be,0,Xe,"ZXY"),_e.set(E.current.cx,E.current.cy,0)}else if(w===Ho.Top)Ne=dh.Horizontal,_e.set(E.current.cx,E.current.cy,E.current.lz),Ue.set(0,0,0);else if(ye.isMoveHandle(w)||x===xt.Left||x===xt.Right||x===xt.Lower||x===xt.Upper||x===xt.LowerLeft||x===xt.UpperLeft&&E.current.type!==z.Wall||x===xt.LowerRight||x===xt.UpperRight&&E.current.type!==z.Wall||C===ai.Lower||C===ai.Upper)Ne=dh.Horizontal,_e.set(E.current.cx,E.current.cy,Tm),Ue.set(0,0,0);else if(x){Ne=dh.Vertical;const Be=d(E.current,x),pt=u(),ct=-Math.atan2(pt.x,pt.y);_e.set(Be.x,Be.y,0),Ue.set(-$t,0,ct,"ZXY")}}const Fe=Be=>{Ce.x=Be.offsetX/k().gl.domElement.clientWidth*2-1,Ce.y=-(Be.offsetY/k().gl.domElement.clientHeight)*2+1,Me.setFromCamera(Ce,k().camera)},He=Be=>{for(const pt of Be)if(pt.object.userData.stand)return pt;return null},Le=(Be,pt)=>{Be&&t(ct=>{for(const Xe of ct.elements)if(Xe.id===pt&&Xe.type!==z.Foundation){Xe.parentId=Be;break}})},Ye=Be=>{if(!Be)return"";if(Be.userData.id)return Be.userData.id;const pt=Be.name.split(" ");return pt[2]&&pt[2].length>0?pt[2]:Ye(Be.parent)},lt=(Be,pt,ct)=>{if(!Be||!pt)return;const Xe=jn.getState().contentRef;if(Xe!=null&&Xe.current){const ft=ye.getObjectChildById(Xe.current,pt),wt=ye.getObjectChildById(pt===rr?Xe.current:ft,ct);if(wt){if(Be===rr)Xe.current.add(wt);else{const kt=ye.getObjectChildById(Xe.current,Be);kt==null||kt.add(wt)}U()}}},Oe=(Be,pt)=>{if(Be&&Be.current){const ct=He(pt.intersections);if(ct){const Xe=ct.object,ft=Be.current.parent;if(Xe.name==="Ground"){if(ft&&ft.name!=="Content"){const wt=jn.getState().contentRef;wt&&wt.current&&(wt.current.add(Be.current),Le(rr,Ye(Be.current)))}Be.current.position.copy(ct.point),U()}else if(Xe.userData.stand){const wt=Xe.parent;if(wt){ft&&ft.uuid!==wt.uuid&&(wt.add(Be.current),Le(Ye(wt),Ye(Be.current)));const{rot:kt}=ye.getWorldDataById(Ye(wt));qe.set(0,0,-kt);const Zt=new ue().subVectors(ct.point,wt.localToWorld(new ue)).applyEuler(qe);Be.current.position.copy(Zt),U()}}ve.current||(ve.current=!0)}}},ut=(Be,pt,ct)=>{t(Xe=>{for(const ft of Xe.elements)if(ft.id===Be){ye.isFoundationOrCuboid(ft)||(ft.parentId=pt),ft.cx=ct.x,ft.cy=ct.y,ft.cz=ct.z;break}})},ht=()=>{if(!E.current)return;const Be={name:"Resize",timestamp:Date.now(),resizedElementId:E.current.id,resizedElementType:E.current.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldLx:ae.current.x,oldLy:ae.current.y,oldLz:ae.current.z,newLx:Z.current.x,newLy:Z.current.y,newLz:Z.current.z,oldChildrenPositionsMap:new Map(Y.current),newChildrenPositionsMap:new Map(O.current),oldPolygonVerticesMap:new Map(_.current),newPolygonVerticesMap:new Map(G.current),oldChildrenParentIdMap:new Map(ee.current),newChildrenParentIdMap:new Map(q.current),oldWallPointsMap:new Map(Q.current),newWallPointsMap:new Map(oe.current),undo:()=>{var pt,ct;if(t(Xe=>{for(const ft of Xe.elements)if(ft.id===Be.resizedElementId){ft.cx=Be.oldCx,ft.cy=Be.oldCy,ft.cz=Be.oldCz,ft.lx=Be.oldLx,ft.ly=Be.oldLy,ft.lz=Be.oldLz;break}}),Be.oldChildrenPositionsMap.size>0)for(const[Xe,ft]of Be.oldChildrenPositionsMap.entries()){const wt=a(Xe);if((wt==null?void 0:wt.type)!==z.Polygon){t(Ot=>{for(const on of Ot.elements)if(on.id===Xe){if(on.cx=ft.x,on.cy=ft.y,Yt(on)||(on.cz=ft.z),on.type===z.Wall){const qt=on,rn=Be.oldWallPointsMap.get(qt.id);rn&&(qt.leftPoint=[rn[0].x,rn[0].y,0],qt.rightPoint=[rn[1].x,rn[1].y,0])}break}Be.oldWallPointsMap.size>0&&(Ot.updateWallMapOnFoundationFlag=!Ot.updateWallMapOnFoundationFlag)});const kt=(pt=Be.oldChildrenParentIdMap)==null?void 0:pt.get(Xe),Zt=(ct=Be.newChildrenParentIdMap)==null?void 0:ct.get(Xe);kt&&Zt&&kt!==Zt&&(lt(kt,Zt,Xe),Le(kt,Xe))}}if(Be.oldPolygonVerticesMap.size>0)for(const[Xe,ft]of Be.oldPolygonVerticesMap.entries()){const wt=a(Xe);(wt==null?void 0:wt.type)===z.Polygon&&p(Xe,ft)}},redo:()=>{var pt,ct;if(t(Xe=>{for(const ft of Xe.elements)if(ft.id===Be.resizedElementId){ft.cx=Be.newCx,ft.cy=Be.newCy,ft.cz=Be.newCz,ft.lx=Be.newLx,ft.ly=Be.newLy,ft.lz=Be.newLz;break}}),Be.newChildrenPositionsMap.size>0)for(const[Xe,ft]of Be.newChildrenPositionsMap.entries()){t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===Xe){if(Ot.cx=ft.x,Ot.cy=ft.y,(Ot.type!==z.SolarPanel||Ot.parentType!==z.Roof)&&(Ot.cz=ft.z),Ot.type===z.Wall){const on=Ot,qt=Be.newWallPointsMap.get(on.id);qt&&(on.leftPoint=[qt[0].x,qt[0].y,0],on.rightPoint=[qt[1].x,qt[1].y,0])}break}Be.newWallPointsMap.size>0&&(Zt.updateWallMapOnFoundationFlag=!Zt.updateWallMapOnFoundationFlag)});const wt=(pt=Be.oldChildrenParentIdMap)==null?void 0:pt.get(Xe),kt=(ct=Be.newChildrenParentIdMap)==null?void 0:ct.get(Xe);wt&&kt&&wt!==kt&&(lt(kt,wt,Xe),Le(kt,Xe))}if(Be.newPolygonVerticesMap.size>0)for(const[Xe,ft]of Be.newPolygonVerticesMap.entries()){const wt=a(Xe);(wt==null?void 0:wt.type)===z.Polygon&&p(Xe,ft)}}};return Be},Qe=(Be,pt)=>{var wt,kt;const ct=jn.getState().contentRef,Xe=ye.getObjectChildById(ct==null?void 0:ct.current,Be.id);if(Xe){for(const Zt of Xe.children)if(Zt.name.includes(`${pt.id}`)){(kt=(wt=jn.getState().contentRef)==null?void 0:wt.current)==null||kt.add(Zt);break}}pt.parentId=rr;const ft=new ue(pt.cx,pt.cy,pt.cz).applyEuler(new cn(0,0,Be.rotation[2])).add(L.current);pt.cx=ft.x,pt.cy=ft.y,pt.cz=0,O.current.set(pt.id,new ue(ft.x,ft.y,0)),q.current.set(pt.id,rr)},nt=Be=>{Be.intersections.length>0&&Be.intersections[0].object===W.current&&t(ct=>{xb.selectNone(ct),ct.pastePoint.copy(Be.intersections[0].point),ct.clickObjectType=z.Ground,ct.contextMenuObjectType=z.Ground,ct.pasteNormal=Oo})},mt=Be=>{const pt=H.getState().resizeHandleType;switch(Be.type){case z.Tree:switch(pt){case xt.Top:{const ct={name:"Change Tree Height",timestamp:Date.now(),changedElementId:Be.id,changedElementType:Be.type,oldValue:ae.current.z,newValue:Be.lz,undo:()=>{s(ct.changedElementId,ct.oldValue)},redo:()=>{s(ct.changedElementId,ct.newValue)}};f(ct),t(Xe=>{Xe.actionState.treeHeight=Be.lz});return}case xt.Left:case xt.Right:case xt.Lower:case xt.Upper:{const ct={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:Be.id,changedElementType:Be.type,oldValue:ae.current.x,newValue:Be.lx,undo:()=>{l(ct.changedElementId,ct.oldValue)},redo:()=>{l(ct.changedElementId,ct.newValue)}};f(ct),t(Xe=>{Xe.actionState.treeSpread=Be.lx});return}}break;case z.Wall:{const ct={name:"Change Wall Height",timestamp:Date.now(),changedElementId:Be.id,changedElementType:Be.type,oldValue:ae.current.z,newValue:Be.lz,undo:()=>{s(ct.changedElementId,ct.oldValue)},redo:()=>{s(ct.changedElementId,ct.newValue)}};f(ct),t(Xe=>{Xe.actionState.wallHeight=Be.lz});return}}if(j.current.set(Be.cx,Be.cy,Be.cz),Z.current.set(Be.lx,Be.ly,Be.lz),ee.current.clear(),q.current.clear(),O.current.clear(),G.current.clear(),oe.current.clear(),t(ct=>{if(Be.type===z.Cuboid&&(ct.actionState.cuboidHeight=Be.lz),ct.updateSceneRadius(),ct.updateWallMapOnFoundationFlag=!ct.updateWallMapOnFoundationFlag,Be.parentId===rr){for(const Xe of ct.elements)if(ye.isPlantOrHuman(Xe)&&Xe.parentId===Be.id&&(ee.current.set(Xe.id,Be.id),!ye.isResizingVertical(H.getState().resizeHandleType)))if(Math.abs(ae.current.z/2-Xe.cz)<.01){const ft=new ue(Xe.cx,Xe.cy,Xe.cz).applyEuler(new cn(0,0,Be.rotation[2])).add(L.current).sub(j.current).applyEuler(new cn(0,0,-Be.rotation[2]));Math.abs(ft.x)>Math.abs(Z.current.x/2)+.01||Math.abs(ft.y)>Math.abs(Z.current.y/2)+.01?Qe(Be,Xe):(Xe.cx=ft.x,Xe.cy=ft.y)}else{const ft=new ue(Xe.cx,Xe.cy,Xe.cz),wt=new ue().subVectors(j.current,L.current),kt=new ue().subVectors(ft,wt);Math.abs(ft.x/ae.current.x)>.49?Math.abs(kt.y)>Be.ly/2+.5?Qe(Be,Xe):(Xe.cx=(ft.x>0?Be.lx:-Be.lx)/2,Xe.cy=kt.y):Math.abs(ft.y/ae.current.y)>.49&&(Math.abs(kt.x)>Be.lx/2+.5?Qe(Be,Xe):(Xe.cx=kt.x,Xe.cy=(ft.y>0?Be.ly:-Be.ly)/2))}}}),j.current.distanceToSquared(L.current)>Ht&&Z.current.distanceToSquared(ae.current)>Ht){if(Be.type===z.Foundation||Be.type===z.Cuboid){const Xe=n(Be.id);if(Xe.length>0)for(const ft of Xe)if(ft.type===z.Polygon)G.current.set(ft.id,ft.vertices.map(wt=>({...wt})));else{if(ft.type===z.Wall){const wt=ft,kt=new _t(wt.leftPoint[0],wt.leftPoint[1]),Zt=new _t(wt.rightPoint[0],wt.rightPoint[1]);oe.current.set(ft.id,[kt,Zt])}O.current.set(ft.id,new ue(ft.cx,ft.cy,ft.cz))}if(Be.type===z.Foundation){const ft=zt(Be.id);if(ft.length>0)for(const wt of ft){const kt=new ue(wt.cx,wt.cy);O.current.set(wt.id,kt)}}}const ct=ht();ct&&f(ct)}},tt=()=>{if(H.getState().viewState.orthographic)return!1;if(W.current){const Be=Me.intersectObjects(k().scene.children,!0);if(Be.length>0){for(const pt of Be)if(pt.object.userData.stand)return!1}}return Me.intersectObjects([W.current]).length===0},gt=Be=>{t(pt=>{for(const ct of pt.elements)if(Be.has(ct.id)){const Xe=Be.get(ct.id);Xe&&(ct.cx=Xe[0],ct.cy=Xe[1],ct.cz=Xe[2])}})},Ve=(Be,pt)=>{var ft,wt,kt;if(Be.locked)return;j.current.set(Be.cx,Be.cy,Be.cz);let ct=$.current,Xe=null;switch(Fe(pt),Be.type){case z.Tree:Xe=(ft=jn.getState().treeRef)==null?void 0:ft.current;break;case z.Flower:Xe=(wt=jn.getState().flowerRef)==null?void 0:wt.current;break;case z.Human:Xe=(kt=jn.getState().humanRef)==null?void 0:kt.current;break}if(Xe&&ve.current){const Zt=Me.intersectObjects(ye.fetchIntersectables(N),!1),Ot=He(Zt);if(Ot){const on=Ot.point;if(Ot.object.name==="Ground")ut(Be.id,rr,on),j.current.set(on.x,on.y,on.z),ct=rr;else if(Ot.object.userData.stand){const qt=Ye(Ot.object),rn=Ot.object.parent;if(rn){const Pn=new ue().subVectors(on,rn.localToWorld(new ue)).applyEuler(qe);ut(Be.id,qt,Pn),j.current.set(Pn.x,Pn.y,Pn.z),ct=qt}}}ve.current=!1}if(j.current.distanceToSquared(L.current)>Ht||Me.intersectObjects([W.current]).length===0){let Zt=!0;if(!H.getState().viewState.orthographic&&(Zt=j.current.length().02}if(!Zt||tt()){o(Be.id,L.current.x,L.current.y,L.current.z),Xe&&ye.isPlantOrHuman(Be)&&Xe.position.copy(L.current),ye.isPlantOrHuman(Be)&&Le($.current,Be.id);const Ot=jn.getState().contentRef;if(Ot!=null&&Ot.current&&$.current&&Xe){if($.current===rr)Ot.current.add(Xe);else{const on=ye.getObjectChildById(Ot.current,$.current);on==null||on.add(Xe)}U()}co(B.t("message.CannotMoveObjectTooFar",we))}else{if(ze.current.size>1){se.current.clear();for(const on of H.getState().elements)Ae.current.has(on.id)&&se.current.set(on.id,[on.cx,on.cy,on.cz]);const Ot={name:"Move Foundation Group",timestamp:Date.now(),oldPositionMap:new Map(Ae.current),newPositionMap:new Map(se.current),undo:()=>{gt(Ot.oldPositionMap)},redo:()=>{gt(Ot.newPositionMap)}};f(Ot)}else{const Ot=Be.type===z.Cuboid,on=Ot?le.current:$.current,qt=Ot?Be.parentId:ct,rn={name:"Move",timestamp:Date.now(),movedElementId:Be.id,movedElementType:Be.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldRotation:[...ne.current],newRotation:[...Be.rotation],oldParentId:on,newParentId:qt,undo:()=>{o(rn.movedElementId,rn.oldCx,rn.oldCy,rn.oldCz),t(Pn=>{const fo=Pn.elements.find(to=>to.id===rn.movedElementId);fo&&rn.oldRotation&&(fo.rotation=[...rn.oldRotation])}),Le(rn.oldParentId,rn.movedElementId),rn.movedElementType&&Ct(rn.movedElementType)&<(rn.oldParentId,rn.newParentId,rn.movedElementId)},redo:()=>{o(rn.movedElementId,rn.newCx,rn.newCy,rn.newCz),t(Pn=>{const fo=Pn.elements.find(to=>to.id===rn.movedElementId);fo&&rn.newRotation&&(fo.rotation=[...rn.newRotation])}),Le(rn.newParentId,rn.movedElementId),rn.movedElementType&&Ct(rn.movedElementType)&<(rn.newParentId,rn.oldParentId,rn.movedElementId)}};f(rn)}ze.current.clear(),m()}}},je=Be=>{te.current=[...Be.rotation];const pt=new ue().fromArray(ne.current);if(new ue().fromArray(te.current).distanceToSquared(pt)>Ht){const Xe={name:"Rotate",timestamp:Date.now(),rotatedElementId:Be.id,rotatedElementType:Be.type,oldRotation:ne.current,newRotation:te.current,undo:()=>{r(Xe.rotatedElementId,Xe.oldRotation[0],Xe.oldRotation[1],Xe.oldRotation[2])},redo:()=>{r(Xe.rotatedElementId,Xe.newRotation[0],Xe.newRotation[1],Xe.newRotation[2])}};f(Xe)}},et=Be=>{if(Be.button!==2){if(jn.getState().setEnableOrbitController(!0),E.current){const pt=a(E.current.id);if(pt)if(Pe.current)if(ce.current=!1,Pe.current=!1,t(ct=>{ct.addedFoundationId=null,ct.updateSceneRadius()}),pt.lx<=.1||pt.ly<=.1)c(pt.id,!1);else{const ct={name:"Add",timestamp:Date.now(),addedElement:pt,undo:()=>{c(ct.addedElement.id,!1),m()},redo:()=>{t(Xe=>{Xe.elements.push(ct.addedElement),Xe.selectedElement=ct.addedElement,Xe.updateSceneRadius()})}};f(ct)}else if(Ie.current)if(pe.current=!1,Ie.current=!1,t(ct=>{ct.addedCuboidId=null,ct.updateSceneRadius()}),pt.lx<=.1||pt.ly<=.1)c(pt.id,!1);else{const ct={name:"Add",timestamp:Date.now(),addedElement:pt,undo:()=>{c(ct.addedElement.id,!1),m()},redo:()=>{t(Xe=>{Xe.elements.push(ct.addedElement),Xe.selectedElement=ct.addedElement,Xe.updateSceneRadius()})}};f(ct)}else H.getState().resizeHandleType?mt(pt):H.getState().rotateHandleType?je(pt):H.getState().moveHandleType&&Ve(pt,Be),pt.type===z.Foundation&&dt.getState().updateFoundationMovedFlag();E.current=null}t(pt=>{pt.moveHandleType=null,pt.resizeHandleType=null,pt.rotateHandleType=null}),jn.setState({humanRef:null,treeRef:null,flowerRef:null}),dt.getState().set(pt=>{pt.showWallIntersectionPlaneId=null,pt.oldParentId=null,pt.oldFoundationId=null})}},bt=(Be,pt)=>{const{pos:ct}=ye.getWorldDataById(Be.id),Xe=new ue(ct.x,ct.y),ft=new ue().subVectors(Xe,pt);ze.current.set(Be.id,ft),Ae.current.set(Be.id,[Be.cx,Be.cy,Be.cz])},St=(Be,pt)=>{const ct=Be.intersections[0].point.clone().setZ(0);for(const Xe of H.getState().elements)Cd(Xe)&&Xe.parentId===rr&&!Xe.locked&&Xe.id!==pt.id&&!ze.current.has(Xe.id)&&!ye.isChild(pt.id,Xe.id)&&!ye.isChild(Xe.id,pt.id)&&ye.areTwoBasesOverlapped(Xe,pt)&&(bt(Xe,ct),Xe.enableGroupMaster&&St(Be,Xe)),Xe.id===pt.id&&bt(Xe,ct)},Pt=(Be,pt)=>{ze.current.clear(),Ae.current.clear(),pt.enableGroupMaster&&H.getState().moveHandleType&&St(Be,pt)},Yt=Be=>{if(Be.type===z.SolarPanel&&Be.parentType===z.Roof||Be.type===z.Window&&Be.parentType===z.Roof)return!0},zt=Be=>H.getState().elements.filter(pt=>pt.foundationId!==Be?!1:pt.type===z.SolarPanel&&pt.parentType===z.Roof||pt.type===z.SolarWaterHeater&&pt.parentType===z.Roof||pt.type===z.Window&&pt.parentType===z.Roof||pt.type===z.Sensor||pt.type===z.Light),Rt=Be=>{if(Be.button===2||Be.intersections.length===0||!W.current)return;if(ce.current){Fe(Be);const ct=Me.intersectObjects([W.current]);ct.length>0&&(jn.getState().setEnableOrbitController(!1),t(Xe=>{Xe.moveHandleType=null,Xe.resizeHandleType=xt.LowerRight,Xe.resizeAnchor.copy(ct[0].point)}),ce.current=!1,Pe.current=!0);return}if(pe.current){Fe(Be);const ct=Me.intersectObjects([W.current]);ct.length>0&&(jn.getState().setEnableOrbitController(!1),t(Xe=>{var ft;if(Xe.moveHandleType=null,Xe.resizeHandleType=xt.LowerRight,Xe.resizeAnchor.copy(ct[0].point),E.current){const wt=at(Be,(ft=E.current)==null?void 0:ft.id);if(wt){const kt=Me.intersectObjects([wt.eventObject]);kt.length>0&&Xe.resizeAnchor.copy(kt[0].point)}}}),pe.current=!1,Ie.current=!0);return}if(Be.intersections[0].object===W.current){if(H.getState().multiSelectionsMode||t(ct=>{ct.clickObjectType=z.Ground,ct.selectedElement=null,xb.selectNone(ct),ct.contextMenuObjectType=null}),Je(y)){const ct=Be.intersections[0].point,Xe=i(b,ct),ft={name:"Add",timestamp:Date.now(),addedElement:Xe,undo:()=>{c(ft.addedElement.id,!1),m()},redo:()=>{t(wt=>{wt.elements.push(ft.addedElement),wt.selectedElement=ft.addedElement,wt.updateSceneRadius()})}};f(ft),t(wt=>{wt.actionModeLock||(wt.objectTypeToAdd=z.None),wt.updateSceneRadius()})}E.current=null}else{const ct=H.getState().selectedElementIdSet;if(ct.size>1){const Xe=H.getState().selectedElement;if(Xe){E.current=Xe,ze.current.clear();for(const ft of H.getState().elements)if(ye.isElementAllowedMultipleMoveOnGround(ft)&&ct.has(ft.id))if(ft.enableGroupMaster)St(Be,ft);else{const kt=Be.intersections[0].point.clone().setZ(0);bt(ft,kt)}}}else{const Xe=e();if(Xe&&Je(Xe.type)){if(E.current=Xe,L.current.set(Xe.cx,Xe.cy,Xe.cz),ae.current.set(Xe.lx,Xe.ly,Xe.lz),ne.current=[...Xe.rotation],Xe.type===z.Foundation||Xe.type===z.Cuboid){const ft=n(Xe.id);if(Y.current.clear(),_.current.clear(),Q.current.clear(),ft.length>0)for(const wt of ft)if(wt.type===z.Polygon)_.current.set(wt.id,wt.vertices.map(kt=>({...kt})));else{if(wt.type===z.Wall){const kt=wt,Zt=new _t(kt.leftPoint[0],kt.leftPoint[1]),Ot=new _t(kt.rightPoint[0],kt.rightPoint[1]);Q.current.set(wt.id,[Zt,Ot])}Y.current.set(wt.id,new ue(wt.cx,wt.cy,wt.cz))}if(Xe.type===z.Foundation){const wt=zt(Xe.id);if(wt.length>0)for(const kt of wt){const Zt=new ue(kt.cx,kt.cy);Y.current.set(kt.id,Zt)}}}switch(Xe.type){case z.Tree:$.current=Xe.parentId,ae.current.set(Xe.lx,Xe.ly,Xe.lz);break;case z.Flower:$.current=Xe.parentId;break;case z.Human:$.current=Xe.parentId;break;case z.Cuboid:{if(Cd(Xe)&&Xe.parentId===rr?Pt(Be,Xe):ze.current.clear(),le.current=Xe.parentId,H.getState().moveHandleType){const{rot:on}=ye.getWorldDataById(Xe.id),qt=new cn(0,0,on);switch(H.getState().moveHandleType){case Ho.Right:{ge.current.set(-Xe.lx/2,0,0).applyEuler(qt);break}case Ho.Left:{ge.current.set(Xe.lx/2,0,0).applyEuler(qt);break}case Ho.Lower:{ge.current.set(0,Xe.ly/2,0).applyEuler(qt);break}case Ho.Upper:{ge.current.set(0,-Xe.ly/2,0).applyEuler(qt);break}default:{ge.current.set(0,0,0);break}}}de.current.clear();const{pos:wt,rot:kt}=ye.getWorldDataById(Xe.id),Zt=new ue(wt.x,wt.y,wt.z),Ot=n(Xe.id);if(Ot.length>0)for(const on of Ot)switch(on.type){case z.Cuboid:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,kt));qt.add(Zt),de.current.set(on.id,qt);break}case z.Tree:case z.Flower:case z.Human:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,kt));qt.add(Zt),de.current.set(on.id,qt);break}case z.SolarPanel:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,kt)).add(Zt);de.current.set(on.id,qt);break}case z.Light:case z.Sensor:if(ye.isIdentical(on.normal,fs)){const qt=new ue(on.cx*Xe.lx,on.cy*Xe.ly,on.cz*Xe.lz).applyEuler(new cn(0,0,kt));qt.add(Zt),de.current.set(on.id,qt)}break;case z.Polygon:if(ye.isIdentical(on.normal,fs)){const qt=on,rn=[];for(const Pn of qt.vertices){const fo=new _t(Pn.x*Xe.lx,Pn.y*Xe.ly).rotateAround(ui,kt);fo.add(new _t(Zt.x,Zt.y)),rn.push(fo)}he.current.set(qt.id,rn)}break}break}case z.Foundation:{Cd(Xe)&&Pt(Be,Xe),de.current.clear(),he.current.clear(),me.current.clear();const ft=new _t(Xe.cx,Xe.cy),wt=new ue(Xe.cx,Xe.cy,Xe.cz),kt=n(Xe.id);if(kt.length>0){const Ot=Xe.rotation[2];for(const on of kt)switch(on.type){case z.Wall:{const qt=on,rn=new _t(qt.cx,qt.cy).rotateAround(ui,Ot);rn.add(ft);const Pn=new _t(qt.leftPoint[0],qt.leftPoint[1]).rotateAround(ui,Ot);Pn.add(ft);const fo=new _t(qt.rightPoint[0],qt.rightPoint[1]).rotateAround(ui,Ot);fo.add(ft),me.current.set(qt.id,{centerPointAbsPos:rn,leftPointAbsPos:Pn,rightPointAbsPos:fo});break}case z.Tree:case z.Flower:case z.Human:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,Ot));qt.add(wt),de.current.set(on.id,qt);break}case z.BatteryStorage:case z.SolarPanel:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,Ot)).add(wt);de.current.set(on.id,qt);break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:{const qt=new ue(on.cx*Xe.lx,on.cy*Xe.ly,on.cz*Xe.lz).applyEuler(new cn(0,0,Ot));qt.add(wt),de.current.set(on.id,qt);break}case z.Polygon:{const qt=on,rn=[];for(const Pn of qt.vertices){const fo=new _t(Pn.x*Xe.lx,Pn.y*Xe.ly).rotateAround(ui,Ot);fo.add(ft),rn.push(fo)}he.current.set(qt.id,rn);break}}}const Zt=zt(Xe.id);if(Zt.length>0){const Ot=new cn(0,0,Xe.rotation[2]);for(const on of Zt)if(on.type===z.Window||on.type===z.SolarPanel||on.type===z.SolarWaterHeater){const qt=new ue(on.cx,on.cy).applyEuler(Ot);qt.add(wt),de.current.set(on.id,qt)}else{const qt=new ue(on.cx*Xe.lx,on.cy*Xe.ly).applyEuler(Ot);qt.add(wt),de.current.set(on.id,qt)}}break}}}else E.current=null}}},Ct=Be=>Be===z.Human||Be===z.Tree||Be===z.Flower,yt=(Be,pt)=>{if(Be.tempHumanPlant.length===0){const ct=Be.elements.filter(ft=>Ct(ft.type)&&ye.isDescendantOf(ft,pt));Be.tempHumanPlant=ct;const Xe=new Set(ct.map(ft=>ft.id));Be.elements=Be.elements.filter(ft=>!Xe.has(ft.id))}},at=(Be,pt)=>{const ct=Be.intersections.find(ft=>{const wt=ft.eventObject;if(!wt.name.includes("Cuboid"))return!1;const kt=wt.name.split(" ");return kt.length!==2?!1:kt[1]!==pt&&wt.userData.stackable});if(!ct)return;const Xe=ct.eventObject.name.split(" ")[1];if(!ze.current.has(Xe))return ye.isChild(pt,Xe)?void 0:ct};g.useEffect(()=>{E.current&&(D||y!==z.None)&&(ce.current&&y!==z.Foundation?(ce.current=!1,Pe.current=!1,t(Be=>{Be.addedFoundationId=null,Be.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(E.current.id,!1),E.current=null):pe.current&&y!==z.Cuboid&&(pe.current=!1,Ie.current=!1,t(Be=>{Be.addedCuboidId=null,Be.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(E.current.id,!1),E.current=null))},[y,D]);const Et=Be=>{if(E.current&&E.current.type&&!E.current.locked){Fe(Be);let pt;switch(E.current.type){case z.Foundation:F.current&&(pt=Me.intersectObjects([F.current]),pt.length>0&&(w?it(pt[0].point):x?It(pt[0].point):C&&ot(pt[0].point)));break;case z.Cuboid:if(F.current&&Ne===dh.Horizontal&&(pt=Me.intersectObjects([F.current]),pt.length>0)){const ct=pt[0].point.clone(),Xe=at(Be,E.current.id);if(w)if(ze.current.size>1)it(ct);else if(Xe){if(pt=Me.intersectObjects([Xe.eventObject]),pt.length===0)return;ct.copy(pt[0].point).add(ge.current);const ft=Xe.eventObject.name.split(" ")[1];t(wt=>{const kt=wt.elements.find(Ot=>{var on;return Ot.id===((on=wt.selectedElement)==null?void 0:on.id)}),Zt=wt.selectedElement;if(kt&&Zt){const{pos:Ot,rot:on}=ye.getWorldDataById(ft),qt=new ue().subVectors(ct,Ot);if(qt.applyEuler(new cn(0,0,-on)),kt.cx=qt.x,kt.cy=qt.y,Zt.parentId!==ft){kt.parentId!==ft&&yt(wt,kt.id);const{rot:rn}=ye.getWorldDataById(Zt.id);kt.rotation[2]=rn-on,kt.parentId=ft}else kt.parentId!==ft&&(kt.parentId!==Zt.parentId&&yt(wt,kt.id),kt.parentId=Zt.parentId,kt.rotation[2]=Zt.rotation[2])}})}else t(ft=>{const wt=ft.elements.find(kt=>kt.id===E.current.id);if(wt&&wt.parentId!==rr){wt.parentId!==rr&&yt(ft,wt.id);const{rot:kt}=ye.getWorldDataById(wt.parentId);wt.rotation[2]+=kt,wt.parentId=rr}}),it(ct);else if(x){const ft=a(E.current.id);ft&&ft.parentId===rr&&It(ct)}}break}}if(W.current){if(y!==z.None){Fe(Be);const pt=Me.intersectObjects([W.current]);if(pt.length>0){const ct=pt[0].point;switch(y){case z.Foundation:{const Xe=i(b,ct);Xe&&(t(ft=>{ft.addedFoundationId=Xe.id,ft.objectTypeToAdd=z.None}),E.current=Xe,ce.current=!0);break}case z.Cuboid:{const Xe=i(b,ct);Xe&&(t(ft=>{ft.addedCuboidId=Xe.id,ft.objectTypeToAdd=z.None}),E.current=Xe,pe.current=!0);break}}}}if(E.current&&(ce.current||pe.current)){Fe(Be);let pt=Me.intersectObjects([W.current]);if(pt.length===0)return;const ct=pt[0].point;if(E.current.type===z.Foundation)o(E.current.id,ct.x,ct.y);else if(E.current.type===z.Cuboid){const Xe=at(Be,E.current.id);if(Xe){if(pt=Me.intersectObjects([Xe.eventObject]),pt.length===0)return;ct.copy(pt[0].point);const ft=Xe.eventObject.name.split(" ")[1];t(wt=>{const kt=wt.elements.find(Zt=>{var Ot;return Zt.id===((Ot=E.current)==null?void 0:Ot.id)});if(kt){const{pos:Zt,rot:Ot}=ye.getWorldDataById(ft),on=new ue().subVectors(ct,Zt);on.applyEuler(new cn(0,0,-Ot)),kt.cx=on.x,kt.cy=on.y,kt.parentId=ft,kt.rotation[2]=-Ot}})}else t(ft=>{const wt=ft.elements.find(kt=>{var Zt;return kt.id===((Zt=E.current)==null?void 0:Zt.id)});if(wt&&wt.parentId!==rr){const{rot:kt}=ye.getWorldDataById(wt.parentId);wt.rotation[2]+=kt,wt.parentId=rr}}),o(E.current.id,ct.x,ct.y)}}}},Lt=Be=>{if(E.current&&E.current.type&&!E.current.locked){Fe(Be);let pt;if(F.current&&Ne===dh.Vertical&&(pt=Me.intersectObjects([F.current]),pt&&pt.length>0)){const ct=pt[0].point;switch(E.current.type){case z.Tree:{const Xe=E.current;switch(x){case xt.Top:s(Xe.id,ct.z),t(ft=>{ft.selectedElementHeight=Math.max(1,ct.z)});break;case xt.Left:case xt.Right:case xt.Upper:case xt.Lower:l(Xe.id,2*Math.hypot(ct.x-Xe.cx,ct.y-Xe.cy));break}Oe(jn.getState().treeRef,Be);break}case z.Flower:{Oe(jn.getState().flowerRef,Be);break}case z.Human:{Oe(jn.getState().humanRef,Be);break}}}}},Je=Be=>Be===z.Foundation||Be===z.Cuboid||Be===z.Tree||Be===z.Flower||Be===z.Human,st=(Be,pt,ct,Xe,ft)=>{if(Be){for(const wt of Be.children)if(wt.name.includes("Human")||wt.name.includes("Tree")||wt.name.includes("Flower")){const kt=Ye(wt),Zt=de.current.get(kt);if(Zt)if(Math.abs(ae.current.z/2-wt.position.z)<.01){const Ot=new ue().subVectors(Zt,Xe).applyEuler(new cn(0,0,-ft));wt.position.setX(Ot.x),wt.position.setY(Ot.y)}else{const Ot=new ue().subVectors(Zt,L.current).applyEuler(new cn(0,0,-ft)),on=new ue().subVectors(Xe,L.current),qt=new ue().subVectors(Ot,on);Math.abs(Ot.x/ae.current.x)>.49?(wt.position.setX((Ot.x>0?pt:-pt)/2),wt.position.setY(qt.y)):Math.abs(Ot.y/ae.current.y)>.49&&(wt.position.setX(qt.x),wt.position.setY((Ot.y>0?ct:-ct)/2))}}}},It=Be=>{if(!E.current)return;const pt=new _t(Be.x,Be.y),ct=new _t(P.x,P.y),Xe=ct.distanceTo(pt),ft=Math.atan2(pt.x-P.x,pt.y-P.y)+E.current.rotation[2];let wt=Math.abs(Xe*Math.sin(ft)),kt=Math.abs(Xe*Math.cos(ft));const Zt=new _t().addVectors(pt,ct).multiplyScalar(.5);if(E.current.type===z.Cuboid&&(x===xt.Lower||x===xt.Upper||x===xt.Left||x===xt.Right)){const Ot=new ue(P.x,P.y),on=E.current.rotation[2],qt=new ue(Be.x,Be.y).sub(Ot).applyEuler(new cn(0,0,-on)),rn=new ue(1,0,0);(x===xt.Upper||x===xt.Lower)&&rn.set(0,1,0),rn.applyEuler(new cn(0,0,on));const Pn=Ot.clone().add(rn.clone().multiplyScalar(qt.x/2));x===xt.Left||x===xt.Right?(wt=Math.abs(qt.x),kt=E.current.ly):(x===xt.Upper||x===xt.Lower)&&(wt=E.current.lx,kt=Math.abs(qt.y),Pn.copy(Ot.add(rn.clone().multiplyScalar(qt.y/2)))),Zt.x=Pn.x,Zt.y=Pn.y}switch(t(Ot=>{if(!E.current)return;let on=!1;for(const qt of Ot.elements)if(qt.id===E.current.id){switch(qt.type){case z.Cuboid:case z.Foundation:{const rn=n(qt.id);if(rn.length>0){const Pn=[];for(const to of rn){if(ye.isPlantOrHuman(to))continue;const Dt=JSON.parse(JSON.stringify(to));if(Pn.push(Dt),ye.isIdentical(Dt.normal,fs))if(to.type===z.Wall){const fn=me.current.get(to.id);if(fn){const kn=-qt.rotation[2],{centerPointAbsPos:yo,leftPointAbsPos:ur,rightPointAbsPos:lr}=fn,xo=new _t().subVectors(yo,Zt).rotateAround(ui,kn),wo=new _t().subVectors(ur,Zt).rotateAround(ui,kn),Rr=new _t().subVectors(lr,Zt).rotateAround(ui,kn);switch(x){case xt.Lower:case xt.Upper:Dt.cy=xo.y;break;case xt.Left:case xt.Right:Dt.cx=xo.x;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:Dt.cx=xo.x,Dt.cy=xo.y;break}Dt.leftPoint=[wo.x,wo.y,0],Dt.rightPoint=[Rr.x,Rr.y,0]}}else{const fn=de.current.get(to.id);if(fn){const kn=-qt.rotation[2],yo=new _t().subVectors(new _t(fn.x,fn.y),Zt).rotateAround(ui,kn);switch(x){case xt.Lower:case xt.Upper:Dt.type===z.SolarPanel?Dt.cy=yo.y:Dt.cy=yo.y/kt;break;case xt.Left:case xt.Right:Dt.type===z.SolarPanel||Dt.type===z.SolarWaterHeater?Dt.cx=yo.x:Dt.cx=yo.x/wt;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:Dt.type===z.SolarPanel?(Dt.cx=yo.x,Dt.cy=yo.y):(Dt.cx=yo.x/wt,Dt.cy=yo.y/kt);break}}}else if((Dt.type===z.SolarPanel||Dt.type===z.SolarWaterHeater)&&Dt.parentType===z.Roof||Dt.type===z.BatteryStorage){const fn=de.current.get(to.id);if(fn){const kn=new _t().subVectors(new _t(fn.x,fn.y),Zt).rotateAround(ui,-qt.rotation[2]);Dt.cx=kn.x,Dt.cy=kn.y}}}const fo=JSON.parse(JSON.stringify(qt));switch(x){case xt.Lower:case xt.Upper:case xt.Left:case xt.Right:case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:fo.lx=wt,fo.ly=kt,fo.cx=Zt.x,fo.cy=Zt.y;break}if(ye.doesParentContainAllChildren(fo,Pn)){switch(x){case xt.Lower:case xt.Upper:case xt.Left:case xt.Right:case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.lx=wt,qt.ly=kt,qt.cx=Zt.x,qt.cy=Zt.y;break}on=!0}}else if(wt>.49&&kt>.49){switch(x){case xt.Lower:case xt.Upper:case xt.Left:case xt.Right:case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.lx=wt,qt.ly=kt,qt.cx=Zt.x,qt.cy=Zt.y;break}on=!0}break}}break}if(on)for(const qt of Ot.elements){if(qt.parentId===E.current.id)switch(qt.type){case z.Wall:{const rn=qt,Pn=me.current.get(qt.id);if(Pn){const fo=-E.current.rotation[2],{centerPointAbsPos:to,leftPointAbsPos:Dt,rightPointAbsPos:fn}=Pn,kn=new _t().subVectors(to,Zt).rotateAround(ui,fo),yo=new _t().subVectors(Dt,Zt).rotateAround(ui,fo),ur=new _t().subVectors(fn,Zt).rotateAround(ui,fo);switch(x){case xt.Lower:case xt.Upper:qt.cy=kn.y;break;case xt.Left:case xt.Right:qt.cx=kn.x;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.cx=kn.x,qt.cy=kn.y;break}rn.leftPoint=[yo.x,yo.y,0],rn.rightPoint=[ur.x,ur.y,0]}break}case z.BatteryStorage:{const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);qt.cx=Pn.x,qt.cy=Pn.y}break}case z.SolarPanel:{const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]),[fo,to,Dt]=qt.normal;ye.isEqual(Dt,1)&&(qt.cx=Pn.x,qt.cy=Pn.y),ye.isEqual(fo,0)&&ye.isEqual(to,1)?qt.cy=kt/2:ye.isEqual(fo,0)&&ye.isEqual(to,-1)?qt.cy=-kt/2:ye.isEqual(fo,-1)&&ye.isEqual(to,0)?qt.cx=-wt/2:ye.isEqual(fo,1)&&ye.isEqual(to,0)&&(qt.cx=wt/2)}break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:if(ye.isIdentical(qt.normal,fs)){const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);switch(x){case xt.Lower:case xt.Upper:qt.cy=Pn.y/kt;break;case xt.Left:case xt.Right:qt.cx=Pn.x/wt;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.cx=Pn.x/wt,qt.cy=Pn.y/kt;break}}}break;case z.Cuboid:{const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);switch(x){case xt.Lower:case xt.Upper:qt.cy=Pn.y;break;case xt.Left:case xt.Right:qt.cx=Pn.x;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.cx=Pn.x,qt.cy=Pn.y;break}}break}case z.Polygon:if(ye.isIdentical(qt.normal,fs)){const rn=qt,Pn=he.current.get(rn.id);if(Pn){const fo=[];Pn.forEach(to=>{const Dt=new _t().subVectors(to,Zt).rotateAround(ui,-E.current.rotation[2]);fo.push({x:Dt.x/wt,y:Dt.y/kt})}),rn.vertices=fo}}break}if(qt.foundationId===E.current.id&&(qt.type===z.SolarPanel||qt.type===z.SolarWaterHeater||qt.type===z.Window)&&qt.parentType===z.Roof){const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);qt.cx=Pn.x,qt.cy=Pn.y}}if(qt.foundationId===E.current.id&&(qt.type===z.Sensor||qt.type===z.Light)&&qt.parentType===z.Roof){const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);qt.cx=Pn.x/wt,qt.cy=Pn.y/kt}}}}),E.current.type){case z.Foundation:{const Ot=jn.getState().foundationRef;Ot!=null&&Ot.current&&st(Ot==null?void 0:Ot.current,wt,kt,Ot.current.position,E.current.rotation[2]);break}case z.Cuboid:{const Ot=jn.getState().cuboidRef;Ot!=null&&Ot.current&&Ot.current.parent&&st(Ot==null?void 0:Ot.current,wt,kt,Ot.current.parent.position,E.current.rotation[2]);break}}},ot=Be=>{const{cx:pt,cy:ct}=E.current,Xe=Math.atan2(pt-Be.x,Be.y-ct)+(C===ai.Upper?0:Math.PI),ft=Math.abs(Xe)>Math.PI?-Math.sign(Xe)*fa:0;r(E.current.id,0,0,Xe+ft)},it=Be=>{const pt=ze.current.size>1;if(pt){t(kt=>{for(const Zt of kt.elements)if(Cd(Zt)&&ze.current.has(Zt.id)){const Ot=ze.current.get(Zt.id);Ot&&(Zt.cx=Be.x+Ot.x,Zt.cy=Be.y+Ot.y)}});return}let ct,Xe;const ft=E.current.lx/2,wt=E.current.ly/2;switch(w){case Ho.Top:{if(pt){const kt=new ue(Be.x,Be.y);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,Be.x,Be.y);break}case Ho.Upper:if(ct=Be.x+Re*wt,Xe=Be.y-Te*wt,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break;case Ho.Lower:if(ct=Be.x-Re*wt,Xe=Be.y+Te*wt,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break;case Ho.Left:if(ct=Be.x+Te*ft,Xe=Be.y+Re*ft,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break;case Ho.Right:if(ct=Be.x-Te*ft,Xe=Be.y-Re*ft,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break}};return g.useEffect(()=>{const Be=()=>{const pt=H.getState().addedFoundationId,ct=H.getState().addedCuboidId;pt&&(c(pt,!1),t(Xe=>{Xe.objectTypeToAdd=z.Foundation,Xe.addedFoundationId=null}),jn.getState().setEnableOrbitController(!0),E.current=null,ce.current=!1,Pe.current=!1),ct&&(c(ct,!1),t(Xe=>{Xe.objectTypeToAdd=z.Cuboid,Xe.addedCuboidId=null}),jn.getState().setEnableOrbitController(!0),E.current=null,pe.current=!1,Ie.current=!1)};return window.addEventListener("beforeunload",Be),()=>{window.removeEventListener("beforeunload",Be)}},[]),h.jsxs(h.Fragment,{children:[E.current&&Ne!==dh.Ground&&h.jsx(yi,{ref:F,visible:!1,name:"Ground Intersection Plane",rotation:Ue,position:_e,args:[1e5,1e5],onPointerMove:A3.throttle(Lt,hL,{trailing:!1}),children:h.jsx("meshStandardMaterial",{side:zr,opacity:.5,transparent:!0})}),h.jsx(yi,{receiveShadow:A,ref:W,name:"Ground",userData:{stand:!0},rotation:[0,0,0],position:[0,0,0],args:[1e4,1e4],renderOrder:-2,onContextMenu:nt,onPointerDown:Rt,onPointerMove:A3.throttle(Et,hL,{trailing:!1}),children:M&&!v?h.jsx("meshBasicMaterial",{color:S}):h.jsx("meshStandardMaterial",{depthTest:!1,color:v?"white":S,map:v?ye.WATER_TEXTURE:ye.WHITE_TEXTURE,needsUpdate:!0})})]})}),tce=48,o1n=72,r1n=12,i1n=xe.memo(({date:t,hourAngle:e,declinationAngle:n,worldLatitude:o})=>{const r=H(Ky),i=H(LGe),a=H(HGe)??!0,l=H(MGe)??!0,s=H(IGe)??!0,[c,u]=g.useState(ye.toRadians(42)),d=Up(O3e),f=Math.max(2,r*.2),p=Math.max(.4,r*.025),m=B5(NM,gI),y=r*.05,w={font:m,height:0,size:y},x=6,C=new Array(2*x+1).fill(0),P=_=>_===0?-y*.3:_>0&&_<7?-y*.8:-y*1.2;g.useEffect(()=>{u(ye.toRadians(o))},[o]);const A=6,[S,v]=g.useMemo(()=>{const _=new Ni,G=new Ni,Q=[],oe=[],ee=fa/o1n;let q=0;for(let $=0;$Ht&&(de=.05*r+(q%3===0?.2:0),he=new ue(r,le,0),he.z=.002,oe.push(ye.sphericalToCartesianZ(he)),he=new ue(r+de,le,0),he.z=.002,oe.push(ye.sphericalToCartesianZ(he))),q++}const ae=Q.length*3,Z=new Float32Array(ae),ne=new Float32Array(ae),te=new Float32Array(ae);for(let $=0;${const _=[],G=pl(t,ye.toDegrees(c)),Q=E_(G.sunrise),oe=E_(G.sunset),ee=(oe-Q)/tce;for(let q=Q;q-.01&&_.push(ae)}return _},[t,c,r,n]),T=_=>{const G=FU(_),Q=[],oe=pl(_,ye.toDegrees(c)),ee=E_(oe.sunrise),q=E_(oe.sunset),ae=(q-ee)/tce;for(let Z=ee;Z-.01&&Q.push(ne)}return Q},R=g.useMemo(()=>{const _=[];for(let G=0;G<=A;G++){const Q=new Date(2021,G===0?11:G-1,22);_.push(T(Q))}return _},[c,r]),M=g.useMemo(()=>_9(r,e,n,c),[c,n,e,r]),D=g.useMemo(()=>M.clone().normalize(),[M]),k=g.useMemo(()=>new ue(M.x,M.y,0).normalize(),[M]),N=g.useMemo(()=>Math.asin(M.z/M.length()),[M]),U=g.useMemo(()=>{const G=new x5(0,0,f,f,0,N,!1,0).getPoints(25),Q=new Array;for(const oe of G)Q.push(new ue(oe.x,oe.y,0));return Q},[N,M,f]),W=g.useMemo(()=>Math.acos(M.z/M.length()),[M]),F=g.useMemo(()=>{const G=new x5(0,0,f*.8,f*.8,N,$t,!1,0).getPoints(25),Q=new Array;for(const oe of G)Q.push(new ue(oe.x,oe.y,0));return Q},[W,M,f,N]),E=g.useMemo(()=>{const _=Math.acos(M.y/Math.hypot(M.x,M.y));return M.x>0?-_:_},[M]),L=g.useMemo(()=>{const G=new x5(0,0,f*1.2,f*1.2,$t,$t+E,M.x>0,0).getPoints(50),Q=new Array;for(const oe of G)Q.push(new ue(oe.x,oe.y,0));return Q},[E,M,f]),j=g.useMemo(()=>{const _=2*dC/r1n,G=fa/tce,Q=new Ni;let oe=0;const ee=[],q=[];for(let ae=-dC;aeMath.PI&&(ne=Math.PI),te>dC&&(te=dC);const $=_9(r,Z,ae,c),le=_9(r,ne,ae,c),de=_9(r,ne,te,c),he=_9(r,Z,te,c);($.z>=0||le.z>=0||de.z>=0||he.z>=0)&&(ee.push($,le,de,he),q.push(oe),q.push(oe+1),q.push(oe+2),q.push(oe),q.push(oe+2),q.push(oe+3),oe+=4)}return Q.setFromPoints(ee),Q.setIndex(new _a(new Uint16Array(q),1)),Q},[c,r]),Y=.05*r,O=2+5*Y;return h.jsxs("group",{children:[C.map((_,G)=>{let Q=Math.ceil(G/2)*(G%2===0?1:-1);Q===-6&&(Q=x);const oe=P(Math.abs(Q));return h.jsx("group",{rotation:[$t,Q*Math.PI/x,0],children:h.jsxs("mesh",{position:[oe,0,-r*1.1],rotation:[-$t,0,0],children:[h.jsx("textGeometry",{args:[`${-30*Q}°`,w]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},G)}),h.jsxs("mesh",{rotation:new cn(0,0,0),name:"Heliodon",children:[h.jsxs("mesh",{children:[h.jsx("bufferGeometry",{...S}),h.jsx("meshBasicMaterial",{side:zr,vertexColors:!0,polygonOffset:!0,polygonOffsetFactor:-.7,polygonOffsetUnits:-2})]}),h.jsxs("lineSegments",{children:[h.jsx("bufferGeometry",{...v}),h.jsx("meshBasicMaterial",{color:0})]}),h.jsxs("mesh",{children:[b.length>3&&h.jsx(On,{lineWidth:2,points:b,color:"yellow"}),R.filter(_=>_.length>3).map((_,G)=>h.jsx(On,{opacity:G===0||G===A?1:.5,lineWidth:G===0||G===A?1:.5,points:_,color:"#999"},G)),h.jsx("mesh",{args:[j],children:h.jsx("meshBasicMaterial",{side:zr,color:[1,1,0],transparent:!0,opacity:.5,depthWrite:!1,clippingPlanes:[new V9(Zc,0)]})}),h.jsx("mesh",{position:M,children:h.jsx("sprite",{scale:[O,O,O],children:h.jsx("spriteMaterial",{map:d,transparent:!1,color:16777215,blending:Th,depthWrite:!1})})}),h.jsxs("mesh",{position:M,children:[h.jsx("sphereGeometry",{args:[Y,10,10]}),h.jsx("meshBasicMaterial",{color:"white"})]})]})]}),h.jsx(yi,{args:[1e4,1e4],renderOrder:-1,userData:{unintersectable:!0},children:h.jsx("meshBasicMaterial",{transparent:!0,opacity:0})}),i&&M.z>0&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[M.x,M.y,M.z]],name:"Line from origin to sun",lineWidth:.5,color:"white"}),h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[M.x,M.y,0]],name:"Line from origin to sun projection on ground",lineWidth:.5,color:"white"}),h.jsx(On,{userData:{unintersectable:!0},points:[[M.x,M.y,0],[M.x,M.y,M.z]],name:"Line from sun projection on ground to sun",lineWidth:.5,color:"white"}),l&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},linewidth:.5,points:U,position:[0,0,0],rotation:new cn($t,0,$t+E,"ZXY"),color:"white",name:"Elevation Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Elevation Angle",backgroundColor:"indigo",text:ye.toDegrees(N).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:D.clone().multiplyScalar(f).add(k.clone().multiplyScalar(f)).multiplyScalar(.65)})]}),s&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},linewidth:.5,points:F,position:[0,0,0],rotation:new cn($t,0,$t+E,"ZXY"),color:"white",name:"Zenith Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Zenith Angle",backgroundColor:"navy",text:ye.toDegrees(W).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:D.clone().multiplyScalar(f).add(Oo.clone().multiplyScalar(f)).multiplyScalar(.57)})]}),a&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},linewidth:.5,points:L,position:[0,0,0],color:"white",name:"Azimuth Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Azimuth Angle",backgroundColor:"firebrick",text:ye.toDegrees(Math.abs(E-Math.PI)<1e-6?E:-E).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:k.clone().multiplyScalar(f).add(Zc.clone().multiplyScalar(f)).multiplyScalar(1.1).add(new ue(0,0,p/2))})]})]})]})}),a1n=xe.memo(()=>{const t=H(FGe),e=H(Ky),n=H(tu),o=H(ml),r=H(HCt),i=g.useMemo(()=>new Date(o),[o]),[a,l]=g.useMemo(()=>[Y3e(i),FU(i)],[i]);return g.useEffect(()=>{r(_9(e,a,l,ye.toRadians(n)))},[n,a,l,e]),h.jsx(h.Fragment,{children:t&&h.jsx(i1n,{date:new Date(o),hourAngle:a,declinationAngle:l,worldLatitude:n})})}),_Me="/aladdin/assets/ifi-logo-CwxGDl7t.png",l1n="/aladdin/assets/magic-lamp-XxXOV1dq.png",s1n=xe.memo(({top:t,height:e,color:n})=>{const o=H(Au),r=g.useMemo(()=>({lng:o}),[o]);return h.jsx("div",{children:h.jsxs("div",{style:{position:"absolute",borderRadius:"20px",border:"thin",textAlign:"center",left:"5%",right:"5%",top:t+"px",height:(e??300)+"px"},children:[h.jsx("h2",{style:{marginTop:"20px",color:n},children:B.t("aboutUs.ProductBroughtToYouBy",r)}),h.jsx("p",{style:{fontSize:"16px",color:n},children:"Charles Xie and Xiaotong Ding"}),h.jsxs("div",{style:{position:"absolute",marginTop:"20px",fontSize:"12px",textAlign:"justify",color:n},children:[B.t("aboutUs.Translators",r),": ",G9.Ukrainian," (Andriy Kashyrskyy), ",G9.Spanish," (Alex Barco), ",G9.Turkish," (Hasan Bircan)",h.jsx("br",{}),h.jsx("br",{}),B.t("aboutUs.Acknowledgment",r),": ",B.t("aboutUs.FundingInformation",r)," ",B.t("aboutUs.Contact",r),h.jsx("hr",{style:{width:"100%",marginTop:"20px",color:n}}),h.jsxs("p",{style:{textAlign:"center",paddingTop:"6px",fontSize:"12px",color:n},children:[h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-terms.html",style:{color:n,textDecoration:"none"},children:B.t("aboutUs.TermsOfService",r)}),"   |   ",h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-privacy.html",style:{color:n,textDecoration:"none"},children:B.t("aboutUs.PrivacyPolicy",r)})]})]})]})})}),c1n=ko.div` +`,qpn=xe.memo(function({initializing:e}){const n=dt(ZPt),o=dt(Ef),r=dt(GXe),i=dt(A5e),a=dt(XXe),l=H(Q2e),s=H(Z2e),c=H(q2e),u=H(qGe),d=H(uTt),f=dt(eJe),p=dt(tJe),m=dt(SJe),y=dt(TJe),w=dt(yJe),x=dt(AJe),C=dt(BN),P=dt(jN),A=dt(dQ),S=H.getState().elements;return h.jsx(h.Fragment,{children:(e||n||o||r)&&h.jsxs(h.Fragment,{children:[o&&(!c&&C||!d&&(P||A)||!l&&(m||y)||!u&&(w||x)||!s&&(f||p)||ye.hasMovingParts(S))&&h.jsx(Jpn,{}),r&&h.jsx($pn,{}),h.jsx(ute,{spinning:!i||!a})]})})}),Qpn=()=>{if(H(OM),!dt.getState().waiting)return null;const e=()=>(g.useEffect(()=>(dt.getState().set(n=>{n.waiting=!1}),()=>{dt.getState().set(n=>{n.waiting=!1})})),null);return h.jsx(e,{})},Zpn=xe.memo(({id:t,cx:e,cy:n,cz:o,lx:r,lz:i,birdSafe:a=wc.None,numberOfBlades:l=3,speed:s=10,hubRadius:c=.75,hubLength:u=1.5,maximumChordRadius:d=3,maximumChordLength:f=1,towerHeight:p,towerRadius:m,bladeRadius:y,bladeTipWidth:w=.2,bladeRootRadius:x=.3,rotation:C=[0,0,0],relativeYawAngle:P=0,initialRotorAngle:A=0,pitchAngle:S=ye.toRadians(10),color:v="white",bladeColor:b=j9,stripeColor:T=B9,lineColor:R="black",lineWidth:M=.5,showLabel:D=!1,locked:k=!1,parentId:N})=>{const U=H(pn),W=H(Jn),F=H(z0),E=Fc(t),L=H(xs),j=H(ml),{gl:{domElement:Y}}=ti(),[O,_]=g.useState(!1),G=g.useRef(null),Q=g.useRef(null),oe=g.useRef(!1),ee=Kt(),$=g.useMemo(()=>ye.fetchBladeTexture(y,x*2,100,a,b,T),[x,y,a,b,T]),ae=H(ze=>{for(const Ae of ze.elements)if(Ae.id===N)return Ae});if(ae)switch(ae.type){case z.Foundation:if(o=ae.lz,ye.isZero(C[2]))e=ae.cx+e*ae.lx,n=ae.cy+n*ae.ly;else{const ze=new ue(e*ae.lx,n*ae.ly,0);ze.applyAxisAngle(Oo,C[2]),e=ae.cx+ze.x,n=ae.cy+ze.y}break}const Z=W(t),ne=c*1.25,te=u*2.5,q=y-d/3,le=g.useMemo(()=>{const ze=f-x,Ae=new jl,se=[];return se.push(new _t(-x,0)),se.push(new _t(-ze/2,y-q)),se.push(new _t(-ze,d)),se.push(new _t(x-w,y)),Ae.moveTo(-x,0),Ae.splineThru(se),Ae.lineTo(x,y),Ae.lineTo(x,0),Ae.closePath(),Ae},[y,q,f,d,x,w]),de=g.useMemo(()=>{const ze=new Date(j);return A+s*(ze.getHours()*60+ze.getMinutes())*Math.PI/72},[j,s,A]);g.useEffect(()=>{const ze=()=>{jn.getState().setEnableOrbitController(!0),oe.current=!1};return window.addEventListener("pointerup",ze),()=>{window.removeEventListener("pointerup",ze)}},[]);const he=g.useMemo(()=>(Z!=null&&Z.label?Z.label:B.t("shared.WindTurbineElement",ee))+(Z!=null&&Z.locked?" ("+B.t("shared.ElementLocked",ee)+")":"")+(Z!=null&&Z.label?"":` +`+B.t("word.Coordinates",ee)+": ("+e.toFixed(1)+", "+n.toFixed(1)+", "+o.toFixed(1)+") "+B.t("word.MeterAbbreviation",ee)),[Z==null?void 0:Z.label,Z==null?void 0:Z.locked,ee,e,n,o]),me=g.useMemo(()=>new cn(0,0,C[2]+P,"ZXY"),[C,P]),ce=(ze,Ae)=>{ze.intersections.length>0&&ze.intersections[0].object===ze.eventObject&&(Y.style.cursor=Ae===Ho.Default?"move":"pointer")},Pe=()=>{Y.style.cursor="default"},pe=Tm*4,Ie=g.useMemo(()=>{const ze=Math.PI*2/l,Ae=new Array;for(let se=0;seh.jsxs("group",{position:new ue(0,-u*.85,p),rotation:[$t,S,Ae,"XZY"],children:[h.jsxs("mesh",{name:"Blade "+ze+" Font Side",receiveShadow:L,castShadow:L,children:[h.jsx("shapeGeometry",{attach:"geometry",args:[le]}),h.jsx("meshStandardMaterial",{attach:"material",color:b,side:$i,map:se})]}),h.jsxs("mesh",{name:"Blade "+ze+" Back Side",receiveShadow:L,castShadow:L,position:new ue(0,-.05,0),children:[h.jsx("shapeGeometry",{attach:"geometry",args:[le]}),h.jsx("meshStandardMaterial",{attach:"material",color:b,side:js,map:se})]}),h.jsx(wa,{name:"Blade root",castShadow:!1,receiveShadow:!1,args:[x*1.1,x*1.1,.24,12,1],position:new ue(0,c-.14,0),children:h.jsx("meshStandardMaterial",{attach:"material",color:v})})]},ze);return h.jsxs("group",{name:"Wind Turbine Group "+t,rotation:me,position:[e,n,o],children:[h.jsx("group",{children:E&&!k&&h.jsx(Ys,{ref:Q,position:new ue(0,0,0),args:[pe+m,6,6],name:Ho.Default,castShadow:!1,receiveShadow:!1,onPointerOver:ze=>{ce(ze,Ho.Default)},onPointerOut:()=>{Pe()},onPointerDown:ze=>{ze.button!==2&&F(t,ze,er.Move)},children:h.jsx("meshStandardMaterial",{attach:"material",color:"orange"})})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Tower",ref:G,castShadow:L,receiveShadow:L,args:[m*.8,m*1.2,p,4,1],position:new ue(0,0,p*.5),rotation:[$t,0,0],onPointerDown:ze=>{ze.button!==2&&(F(t,ze,er.Select),jn.getState().setEnableOrbitController(!1))},onContextMenu:ze=>{F(t,ze,er.ContextMenu),U(Ae=>{ze.intersections.length>0&&ze.intersections[0].object===G.current&&(Ae.contextMenuObjectType=z.WindTurbine)})},onPointerOver:ze=>{ze.intersections.length>0&&ze.intersections[0].object===G.current&&(_(!0),Y.style.cursor="move")},onPointerOut:()=>{_(!1),Y.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),h.jsx(Ys,{userData:{unintersectable:!0},name:"Hub",castShadow:L,receiveShadow:L,args:[c,8,8,$t,Math.PI,0,Math.PI],position:new ue(0,-u*.5,p),rotation:[Math.PI,0,$t],scale:[u/c,1,1],children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),h.jsx(wa,{userData:{unintersectable:!0},name:"Hub Cap",castShadow:L,receiveShadow:L,args:[c,c,.01,16,1],position:new ue(0,-u*.5,p),rotation:[Math.PI,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),h.jsx(_bt,{userData:{unintersectable:!0},name:"Nacelle",castShadow:L,receiveShadow:L,radius:.1,smoothness:4,args:[ne,ne,te],position:new ue(0,(te-u)*.5-.1,p),rotation:[$t,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:v})}),a!==wc.None&&Ie.map((ze,Ae)=>ve(Ae,ze,$)),a===wc.None&&Ie.map((ze,Ae)=>ve(Ae,ze,null)),E&&k&&h.jsx(On,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-r/2,0,0],[-r/2,i,0],[-r/2,i,0],[r/2,i,0],[r/2,0,0],[r/2,i,0],[r/2,0,0],[-r/2,0,0]],rotation:[$t,0,0],castShadow:!1,receiveShadow:!1,lineWidth:1,color:i0}),(O||D)&&!E&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:he,color:(Z==null?void 0:Z.labelColor)??"white",fontSize:(Z==null?void 0:Z.labelFontSize)??20,textHeight:(Z==null?void 0:Z.labelSize)??1,castShadow:!1,receiveShadow:!1,position:[0,0,1+p+c]})]})}),e1n=xe.memo(()=>{const t=H(Qn),e=g.useRef(null);return g.useEffect(()=>{e&&jn.setState({contentRef:e})},[]),console.debug(t),h.jsxs("group",{ref:e,name:"Content",children:[t.map(n=>{switch(n.type){case z.Foundation:return h.jsx(Wfn,{...n},n.id);case z.Sensor:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(Yot,{...o},n.id)}case z.Light:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(Oot,{...o},n.id)}case z.Cuboid:return n.parentId!==rr?null:h.jsx(Vot,{elements:t,cuboidModel:n},n.id);case z.Human:return h.jsx(Nhn,{...n},n.id);case z.Tree:return h.jsx(Uhn,{...n},n.id);case z.Flower:return h.jsx(_hn,{...n},n.id);case z.ParabolicDish:return h.jsx(Bhn,{...n},n.id);case z.ParabolicTrough:return h.jsx(jhn,{...n},n.id);case z.FresnelReflector:return h.jsx(Yhn,{...n},n.id);case z.Heliostat:return h.jsx(Ohn,{...n},n.id);case z.WindTurbine:return h.jsx(Zpn,{...n},n.id);case z.Polygon:switch(n.parentType){case z.Wall:return null;default:return h.jsx(xrt,{...n},n.id)}default:if(n.id)return h.jsx(xe.Fragment,{},n.id)}return null}),h.jsx(Qpn,{}),h.jsx(t1n,{})]})}),t1n=()=>{const t=H(S5e);return g.useEffect(()=>{H.getState().set(e=>{e.deletedRoofIdSet.clear()})},[t]),null},n1n=xe.memo(()=>{const t=H(pn),e=H(HS),n=H(RS),o=H(Q3),r=H(mQ),i=H(y5e),a=H(Jn),l=H(Z3),s=H(d5e),c=H(Jp),u=H(s5e),d=H(v5e),f=H(Fn),p=H(M7),m=H(uXe),y=H(bQ),w=H(FS),x=H(Cm),C=H(SQ),P=H(BRt),A=H(xs),S=H(EGe),v=H(kGe),b=H(Be=>Be.world.ground),T=H(YRt),R=H(ORt),M=dt(vs),D=dt(MCt),{get:k,scene:N,invalidate:U}=ti(),W=g.useRef(null),F=g.useRef(null),E=g.useRef(null),L=g.useRef(new ue),j=g.useRef(new ue),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(new Map),G=g.useRef(new Map),Q=g.useRef(new Map),oe=g.useRef(new Map),ee=g.useRef(new Map),$=g.useRef(new Map),ae=g.useRef(new ue(1,1,1)),Z=g.useRef(new ue(1,1,1)),ne=g.useRef([0,0,1]),te=g.useRef([0,0,1]),q=g.useRef(null),le=g.useRef(null),de=g.useRef(new Map),he=g.useRef(new Map),me=g.useRef(new Map),ce=g.useRef(!1),Pe=g.useRef(!1),pe=g.useRef(!1),Ie=g.useRef(!1),ve=g.useRef(!1),ze=g.useRef(new Map),Ae=g.useRef(new Map),se=g.useRef(new Map),ge=g.useRef(new ue),we=Kt();g.useEffect(()=>(window.addEventListener("pointerup",et),()=>{window.removeEventListener("pointerup",et)}),[]),g.useEffect(()=>{T&&(t(Be=>{Be.addedFoundationId=null,Be.deletedFoundationId=null}),ce.current=!1,Pe.current=!1)},[T]),g.useEffect(()=>{R&&(t(Be=>{Be.addedCuboidId=null,Be.deletedCuboidId=null}),pe.current=!1,Ie.current=!1)},[R]);const{camera:Se}=ti(),Me=g.useMemo(()=>new yu,[]),Ce=g.useMemo(()=>new _t,[]),Te=E.current?Math.cos(E.current.rotation[2]):1,Re=E.current?Math.sin(E.current.rotation[2]):0;let Ne=dh.Ground;const _e=g.useMemo(()=>new ue,[]),Ue=g.useMemo(()=>new cn,[]),qe=g.useMemo(()=>new cn,[]);if(E.current){if(ye.isPlantOrHuman(E.current)){Ne=dh.Vertical;const Be=H.getState().viewState.orthographic?0:-$t,{x:pt,y:ct}=Se.position,Xe=-Math.atan2(pt,ct);Ue.set(Be,0,Xe,"ZXY"),_e.set(E.current.cx,E.current.cy,0)}else if(w===Ho.Top)Ne=dh.Horizontal,_e.set(E.current.cx,E.current.cy,E.current.lz),Ue.set(0,0,0);else if(ye.isMoveHandle(w)||x===xt.Left||x===xt.Right||x===xt.Lower||x===xt.Upper||x===xt.LowerLeft||x===xt.UpperLeft&&E.current.type!==z.Wall||x===xt.LowerRight||x===xt.UpperRight&&E.current.type!==z.Wall||C===ai.Lower||C===ai.Upper)Ne=dh.Horizontal,_e.set(E.current.cx,E.current.cy,Tm),Ue.set(0,0,0);else if(x){Ne=dh.Vertical;const Be=d(E.current,x),pt=u(),ct=-Math.atan2(pt.x,pt.y);_e.set(Be.x,Be.y,0),Ue.set(-$t,0,ct,"ZXY")}}const Fe=Be=>{Ce.x=Be.offsetX/k().gl.domElement.clientWidth*2-1,Ce.y=-(Be.offsetY/k().gl.domElement.clientHeight)*2+1,Me.setFromCamera(Ce,k().camera)},He=Be=>{for(const pt of Be)if(pt.object.userData.stand)return pt;return null},Le=(Be,pt)=>{Be&&t(ct=>{for(const Xe of ct.elements)if(Xe.id===pt&&Xe.type!==z.Foundation){Xe.parentId=Be;break}})},Ye=Be=>{if(!Be)return"";if(Be.userData.id)return Be.userData.id;const pt=Be.name.split(" ");return pt[2]&&pt[2].length>0?pt[2]:Ye(Be.parent)},lt=(Be,pt,ct)=>{if(!Be||!pt)return;const Xe=jn.getState().contentRef;if(Xe!=null&&Xe.current){const ft=ye.getObjectChildById(Xe.current,pt),wt=ye.getObjectChildById(pt===rr?Xe.current:ft,ct);if(wt){if(Be===rr)Xe.current.add(wt);else{const kt=ye.getObjectChildById(Xe.current,Be);kt==null||kt.add(wt)}U()}}},Oe=(Be,pt)=>{if(Be&&Be.current){const ct=He(pt.intersections);if(ct){const Xe=ct.object,ft=Be.current.parent;if(Xe.name==="Ground"){if(ft&&ft.name!=="Content"){const wt=jn.getState().contentRef;wt&&wt.current&&(wt.current.add(Be.current),Le(rr,Ye(Be.current)))}Be.current.position.copy(ct.point),U()}else if(Xe.userData.stand){const wt=Xe.parent;if(wt){ft&&ft.uuid!==wt.uuid&&(wt.add(Be.current),Le(Ye(wt),Ye(Be.current)));const{rot:kt}=ye.getWorldDataById(Ye(wt));qe.set(0,0,-kt);const Zt=new ue().subVectors(ct.point,wt.localToWorld(new ue)).applyEuler(qe);Be.current.position.copy(Zt),U()}}ve.current||(ve.current=!0)}}},ut=(Be,pt,ct)=>{t(Xe=>{for(const ft of Xe.elements)if(ft.id===Be){ye.isFoundationOrCuboid(ft)||(ft.parentId=pt),ft.cx=ct.x,ft.cy=ct.y,ft.cz=ct.z;break}})},ht=()=>{if(!E.current)return;const Be={name:"Resize",timestamp:Date.now(),resizedElementId:E.current.id,resizedElementType:E.current.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldLx:ae.current.x,oldLy:ae.current.y,oldLz:ae.current.z,newLx:Z.current.x,newLy:Z.current.y,newLz:Z.current.z,oldChildrenPositionsMap:new Map(Y.current),newChildrenPositionsMap:new Map(O.current),oldPolygonVerticesMap:new Map(_.current),newPolygonVerticesMap:new Map(G.current),oldChildrenParentIdMap:new Map(ee.current),newChildrenParentIdMap:new Map($.current),oldWallPointsMap:new Map(Q.current),newWallPointsMap:new Map(oe.current),undo:()=>{var pt,ct;if(t(Xe=>{for(const ft of Xe.elements)if(ft.id===Be.resizedElementId){ft.cx=Be.oldCx,ft.cy=Be.oldCy,ft.cz=Be.oldCz,ft.lx=Be.oldLx,ft.ly=Be.oldLy,ft.lz=Be.oldLz;break}}),Be.oldChildrenPositionsMap.size>0)for(const[Xe,ft]of Be.oldChildrenPositionsMap.entries()){const wt=a(Xe);if((wt==null?void 0:wt.type)!==z.Polygon){t(Ot=>{for(const on of Ot.elements)if(on.id===Xe){if(on.cx=ft.x,on.cy=ft.y,Yt(on)||(on.cz=ft.z),on.type===z.Wall){const qt=on,rn=Be.oldWallPointsMap.get(qt.id);rn&&(qt.leftPoint=[rn[0].x,rn[0].y,0],qt.rightPoint=[rn[1].x,rn[1].y,0])}break}Be.oldWallPointsMap.size>0&&(Ot.updateWallMapOnFoundationFlag=!Ot.updateWallMapOnFoundationFlag)});const kt=(pt=Be.oldChildrenParentIdMap)==null?void 0:pt.get(Xe),Zt=(ct=Be.newChildrenParentIdMap)==null?void 0:ct.get(Xe);kt&&Zt&&kt!==Zt&&(lt(kt,Zt,Xe),Le(kt,Xe))}}if(Be.oldPolygonVerticesMap.size>0)for(const[Xe,ft]of Be.oldPolygonVerticesMap.entries()){const wt=a(Xe);(wt==null?void 0:wt.type)===z.Polygon&&p(Xe,ft)}},redo:()=>{var pt,ct;if(t(Xe=>{for(const ft of Xe.elements)if(ft.id===Be.resizedElementId){ft.cx=Be.newCx,ft.cy=Be.newCy,ft.cz=Be.newCz,ft.lx=Be.newLx,ft.ly=Be.newLy,ft.lz=Be.newLz;break}}),Be.newChildrenPositionsMap.size>0)for(const[Xe,ft]of Be.newChildrenPositionsMap.entries()){t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===Xe){if(Ot.cx=ft.x,Ot.cy=ft.y,(Ot.type!==z.SolarPanel||Ot.parentType!==z.Roof)&&(Ot.cz=ft.z),Ot.type===z.Wall){const on=Ot,qt=Be.newWallPointsMap.get(on.id);qt&&(on.leftPoint=[qt[0].x,qt[0].y,0],on.rightPoint=[qt[1].x,qt[1].y,0])}break}Be.newWallPointsMap.size>0&&(Zt.updateWallMapOnFoundationFlag=!Zt.updateWallMapOnFoundationFlag)});const wt=(pt=Be.oldChildrenParentIdMap)==null?void 0:pt.get(Xe),kt=(ct=Be.newChildrenParentIdMap)==null?void 0:ct.get(Xe);wt&&kt&&wt!==kt&&(lt(kt,wt,Xe),Le(kt,Xe))}if(Be.newPolygonVerticesMap.size>0)for(const[Xe,ft]of Be.newPolygonVerticesMap.entries()){const wt=a(Xe);(wt==null?void 0:wt.type)===z.Polygon&&p(Xe,ft)}}};return Be},Qe=(Be,pt)=>{var wt,kt;const ct=jn.getState().contentRef,Xe=ye.getObjectChildById(ct==null?void 0:ct.current,Be.id);if(Xe){for(const Zt of Xe.children)if(Zt.name.includes(`${pt.id}`)){(kt=(wt=jn.getState().contentRef)==null?void 0:wt.current)==null||kt.add(Zt);break}}pt.parentId=rr;const ft=new ue(pt.cx,pt.cy,pt.cz).applyEuler(new cn(0,0,Be.rotation[2])).add(L.current);pt.cx=ft.x,pt.cy=ft.y,pt.cz=0,O.current.set(pt.id,new ue(ft.x,ft.y,0)),$.current.set(pt.id,rr)},nt=Be=>{Be.intersections.length>0&&Be.intersections[0].object===W.current&&t(ct=>{xb.selectNone(ct),ct.pastePoint.copy(Be.intersections[0].point),ct.clickObjectType=z.Ground,ct.contextMenuObjectType=z.Ground,ct.pasteNormal=Oo})},mt=Be=>{const pt=H.getState().resizeHandleType;switch(Be.type){case z.Tree:switch(pt){case xt.Top:{const ct={name:"Change Tree Height",timestamp:Date.now(),changedElementId:Be.id,changedElementType:Be.type,oldValue:ae.current.z,newValue:Be.lz,undo:()=>{s(ct.changedElementId,ct.oldValue)},redo:()=>{s(ct.changedElementId,ct.newValue)}};f(ct),t(Xe=>{Xe.actionState.treeHeight=Be.lz});return}case xt.Left:case xt.Right:case xt.Lower:case xt.Upper:{const ct={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:Be.id,changedElementType:Be.type,oldValue:ae.current.x,newValue:Be.lx,undo:()=>{l(ct.changedElementId,ct.oldValue)},redo:()=>{l(ct.changedElementId,ct.newValue)}};f(ct),t(Xe=>{Xe.actionState.treeSpread=Be.lx});return}}break;case z.Wall:{const ct={name:"Change Wall Height",timestamp:Date.now(),changedElementId:Be.id,changedElementType:Be.type,oldValue:ae.current.z,newValue:Be.lz,undo:()=>{s(ct.changedElementId,ct.oldValue)},redo:()=>{s(ct.changedElementId,ct.newValue)}};f(ct),t(Xe=>{Xe.actionState.wallHeight=Be.lz});return}}if(j.current.set(Be.cx,Be.cy,Be.cz),Z.current.set(Be.lx,Be.ly,Be.lz),ee.current.clear(),$.current.clear(),O.current.clear(),G.current.clear(),oe.current.clear(),t(ct=>{if(Be.type===z.Cuboid&&(ct.actionState.cuboidHeight=Be.lz),ct.updateSceneRadius(),ct.updateWallMapOnFoundationFlag=!ct.updateWallMapOnFoundationFlag,Be.parentId===rr){for(const Xe of ct.elements)if(ye.isPlantOrHuman(Xe)&&Xe.parentId===Be.id&&(ee.current.set(Xe.id,Be.id),!ye.isResizingVertical(H.getState().resizeHandleType)))if(Math.abs(ae.current.z/2-Xe.cz)<.01){const ft=new ue(Xe.cx,Xe.cy,Xe.cz).applyEuler(new cn(0,0,Be.rotation[2])).add(L.current).sub(j.current).applyEuler(new cn(0,0,-Be.rotation[2]));Math.abs(ft.x)>Math.abs(Z.current.x/2)+.01||Math.abs(ft.y)>Math.abs(Z.current.y/2)+.01?Qe(Be,Xe):(Xe.cx=ft.x,Xe.cy=ft.y)}else{const ft=new ue(Xe.cx,Xe.cy,Xe.cz),wt=new ue().subVectors(j.current,L.current),kt=new ue().subVectors(ft,wt);Math.abs(ft.x/ae.current.x)>.49?Math.abs(kt.y)>Be.ly/2+.5?Qe(Be,Xe):(Xe.cx=(ft.x>0?Be.lx:-Be.lx)/2,Xe.cy=kt.y):Math.abs(ft.y/ae.current.y)>.49&&(Math.abs(kt.x)>Be.lx/2+.5?Qe(Be,Xe):(Xe.cx=kt.x,Xe.cy=(ft.y>0?Be.ly:-Be.ly)/2))}}}),j.current.distanceToSquared(L.current)>Ht&&Z.current.distanceToSquared(ae.current)>Ht){if(Be.type===z.Foundation||Be.type===z.Cuboid){const Xe=n(Be.id);if(Xe.length>0)for(const ft of Xe)if(ft.type===z.Polygon)G.current.set(ft.id,ft.vertices.map(wt=>({...wt})));else{if(ft.type===z.Wall){const wt=ft,kt=new _t(wt.leftPoint[0],wt.leftPoint[1]),Zt=new _t(wt.rightPoint[0],wt.rightPoint[1]);oe.current.set(ft.id,[kt,Zt])}O.current.set(ft.id,new ue(ft.cx,ft.cy,ft.cz))}if(Be.type===z.Foundation){const ft=zt(Be.id);if(ft.length>0)for(const wt of ft){const kt=new ue(wt.cx,wt.cy);O.current.set(wt.id,kt)}}}const ct=ht();ct&&f(ct)}},tt=()=>{if(H.getState().viewState.orthographic)return!1;if(W.current){const Be=Me.intersectObjects(k().scene.children,!0);if(Be.length>0){for(const pt of Be)if(pt.object.userData.stand)return!1}}return Me.intersectObjects([W.current]).length===0},gt=Be=>{t(pt=>{for(const ct of pt.elements)if(Be.has(ct.id)){const Xe=Be.get(ct.id);Xe&&(ct.cx=Xe[0],ct.cy=Xe[1],ct.cz=Xe[2])}})},Ve=(Be,pt)=>{var ft,wt,kt;if(Be.locked)return;j.current.set(Be.cx,Be.cy,Be.cz);let ct=q.current,Xe=null;switch(Fe(pt),Be.type){case z.Tree:Xe=(ft=jn.getState().treeRef)==null?void 0:ft.current;break;case z.Flower:Xe=(wt=jn.getState().flowerRef)==null?void 0:wt.current;break;case z.Human:Xe=(kt=jn.getState().humanRef)==null?void 0:kt.current;break}if(Xe&&ve.current){const Zt=Me.intersectObjects(ye.fetchIntersectables(N),!1),Ot=He(Zt);if(Ot){const on=Ot.point;if(Ot.object.name==="Ground")ut(Be.id,rr,on),j.current.set(on.x,on.y,on.z),ct=rr;else if(Ot.object.userData.stand){const qt=Ye(Ot.object),rn=Ot.object.parent;if(rn){const Pn=new ue().subVectors(on,rn.localToWorld(new ue)).applyEuler(qe);ut(Be.id,qt,Pn),j.current.set(Pn.x,Pn.y,Pn.z),ct=qt}}}ve.current=!1}if(j.current.distanceToSquared(L.current)>Ht||Me.intersectObjects([W.current]).length===0){let Zt=!0;if(!H.getState().viewState.orthographic&&(Zt=j.current.length().02}if(!Zt||tt()){o(Be.id,L.current.x,L.current.y,L.current.z),Xe&&ye.isPlantOrHuman(Be)&&Xe.position.copy(L.current),ye.isPlantOrHuman(Be)&&Le(q.current,Be.id);const Ot=jn.getState().contentRef;if(Ot!=null&&Ot.current&&q.current&&Xe){if(q.current===rr)Ot.current.add(Xe);else{const on=ye.getObjectChildById(Ot.current,q.current);on==null||on.add(Xe)}U()}co(B.t("message.CannotMoveObjectTooFar",we))}else{if(ze.current.size>1){se.current.clear();for(const on of H.getState().elements)Ae.current.has(on.id)&&se.current.set(on.id,[on.cx,on.cy,on.cz]);const Ot={name:"Move Foundation Group",timestamp:Date.now(),oldPositionMap:new Map(Ae.current),newPositionMap:new Map(se.current),undo:()=>{gt(Ot.oldPositionMap)},redo:()=>{gt(Ot.newPositionMap)}};f(Ot)}else{const Ot=Be.type===z.Cuboid,on=Ot?le.current:q.current,qt=Ot?Be.parentId:ct,rn={name:"Move",timestamp:Date.now(),movedElementId:Be.id,movedElementType:Be.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldRotation:[...ne.current],newRotation:[...Be.rotation],oldParentId:on,newParentId:qt,undo:()=>{o(rn.movedElementId,rn.oldCx,rn.oldCy,rn.oldCz),t(Pn=>{const fo=Pn.elements.find(to=>to.id===rn.movedElementId);fo&&rn.oldRotation&&(fo.rotation=[...rn.oldRotation])}),Le(rn.oldParentId,rn.movedElementId),rn.movedElementType&&Ct(rn.movedElementType)&<(rn.oldParentId,rn.newParentId,rn.movedElementId)},redo:()=>{o(rn.movedElementId,rn.newCx,rn.newCy,rn.newCz),t(Pn=>{const fo=Pn.elements.find(to=>to.id===rn.movedElementId);fo&&rn.newRotation&&(fo.rotation=[...rn.newRotation])}),Le(rn.newParentId,rn.movedElementId),rn.movedElementType&&Ct(rn.movedElementType)&<(rn.newParentId,rn.oldParentId,rn.movedElementId)}};f(rn)}ze.current.clear(),m()}}},je=Be=>{te.current=[...Be.rotation];const pt=new ue().fromArray(ne.current);if(new ue().fromArray(te.current).distanceToSquared(pt)>Ht){const Xe={name:"Rotate",timestamp:Date.now(),rotatedElementId:Be.id,rotatedElementType:Be.type,oldRotation:ne.current,newRotation:te.current,undo:()=>{r(Xe.rotatedElementId,Xe.oldRotation[0],Xe.oldRotation[1],Xe.oldRotation[2])},redo:()=>{r(Xe.rotatedElementId,Xe.newRotation[0],Xe.newRotation[1],Xe.newRotation[2])}};f(Xe)}},et=Be=>{if(Be.button!==2){if(jn.getState().setEnableOrbitController(!0),E.current){const pt=a(E.current.id);if(pt)if(Pe.current)if(ce.current=!1,Pe.current=!1,t(ct=>{ct.addedFoundationId=null,ct.updateSceneRadius()}),pt.lx<=.1||pt.ly<=.1)c(pt.id,!1);else{const ct={name:"Add",timestamp:Date.now(),addedElement:pt,undo:()=>{c(ct.addedElement.id,!1),m()},redo:()=>{t(Xe=>{Xe.elements.push(ct.addedElement),Xe.selectedElement=ct.addedElement,Xe.updateSceneRadius()})}};f(ct)}else if(Ie.current)if(pe.current=!1,Ie.current=!1,t(ct=>{ct.addedCuboidId=null,ct.updateSceneRadius()}),pt.lx<=.1||pt.ly<=.1)c(pt.id,!1);else{const ct={name:"Add",timestamp:Date.now(),addedElement:pt,undo:()=>{c(ct.addedElement.id,!1),m()},redo:()=>{t(Xe=>{Xe.elements.push(ct.addedElement),Xe.selectedElement=ct.addedElement,Xe.updateSceneRadius()})}};f(ct)}else H.getState().resizeHandleType?mt(pt):H.getState().rotateHandleType?je(pt):H.getState().moveHandleType&&Ve(pt,Be),pt.type===z.Foundation&&dt.getState().updateFoundationMovedFlag();E.current=null}t(pt=>{pt.moveHandleType=null,pt.resizeHandleType=null,pt.rotateHandleType=null}),jn.setState({humanRef:null,treeRef:null,flowerRef:null}),dt.getState().set(pt=>{pt.showWallIntersectionPlaneId=null,pt.oldParentId=null,pt.oldFoundationId=null})}},bt=(Be,pt)=>{const{pos:ct}=ye.getWorldDataById(Be.id),Xe=new ue(ct.x,ct.y),ft=new ue().subVectors(Xe,pt);ze.current.set(Be.id,ft),Ae.current.set(Be.id,[Be.cx,Be.cy,Be.cz])},St=(Be,pt)=>{const ct=Be.intersections[0].point.clone().setZ(0);for(const Xe of H.getState().elements)Cd(Xe)&&Xe.parentId===rr&&!Xe.locked&&Xe.id!==pt.id&&!ze.current.has(Xe.id)&&!ye.isChild(pt.id,Xe.id)&&!ye.isChild(Xe.id,pt.id)&&ye.areTwoBasesOverlapped(Xe,pt)&&(bt(Xe,ct),Xe.enableGroupMaster&&St(Be,Xe)),Xe.id===pt.id&&bt(Xe,ct)},Pt=(Be,pt)=>{ze.current.clear(),Ae.current.clear(),pt.enableGroupMaster&&H.getState().moveHandleType&&St(Be,pt)},Yt=Be=>{if(Be.type===z.SolarPanel&&Be.parentType===z.Roof||Be.type===z.Window&&Be.parentType===z.Roof)return!0},zt=Be=>H.getState().elements.filter(pt=>pt.foundationId!==Be?!1:pt.type===z.SolarPanel&&pt.parentType===z.Roof||pt.type===z.SolarWaterHeater&&pt.parentType===z.Roof||pt.type===z.Window&&pt.parentType===z.Roof||pt.type===z.Sensor||pt.type===z.Light),Rt=Be=>{if(Be.button===2||Be.intersections.length===0||!W.current)return;if(ce.current){Fe(Be);const ct=Me.intersectObjects([W.current]);ct.length>0&&(jn.getState().setEnableOrbitController(!1),t(Xe=>{Xe.moveHandleType=null,Xe.resizeHandleType=xt.LowerRight,Xe.resizeAnchor.copy(ct[0].point)}),ce.current=!1,Pe.current=!0);return}if(pe.current){Fe(Be);const ct=Me.intersectObjects([W.current]);ct.length>0&&(jn.getState().setEnableOrbitController(!1),t(Xe=>{var ft;if(Xe.moveHandleType=null,Xe.resizeHandleType=xt.LowerRight,Xe.resizeAnchor.copy(ct[0].point),E.current){const wt=at(Be,(ft=E.current)==null?void 0:ft.id);if(wt){const kt=Me.intersectObjects([wt.eventObject]);kt.length>0&&Xe.resizeAnchor.copy(kt[0].point)}}}),pe.current=!1,Ie.current=!0);return}if(Be.intersections[0].object===W.current){if(H.getState().multiSelectionsMode||t(ct=>{ct.clickObjectType=z.Ground,ct.selectedElement=null,xb.selectNone(ct),ct.contextMenuObjectType=null}),Je(y)){const ct=Be.intersections[0].point,Xe=i(b,ct),ft={name:"Add",timestamp:Date.now(),addedElement:Xe,undo:()=>{c(ft.addedElement.id,!1),m()},redo:()=>{t(wt=>{wt.elements.push(ft.addedElement),wt.selectedElement=ft.addedElement,wt.updateSceneRadius()})}};f(ft),t(wt=>{wt.actionModeLock||(wt.objectTypeToAdd=z.None),wt.updateSceneRadius()})}E.current=null}else{const ct=H.getState().selectedElementIdSet;if(ct.size>1){const Xe=H.getState().selectedElement;if(Xe){E.current=Xe,ze.current.clear();for(const ft of H.getState().elements)if(ye.isElementAllowedMultipleMoveOnGround(ft)&&ct.has(ft.id))if(ft.enableGroupMaster)St(Be,ft);else{const kt=Be.intersections[0].point.clone().setZ(0);bt(ft,kt)}}}else{const Xe=e();if(Xe&&Je(Xe.type)){if(E.current=Xe,L.current.set(Xe.cx,Xe.cy,Xe.cz),ae.current.set(Xe.lx,Xe.ly,Xe.lz),ne.current=[...Xe.rotation],Xe.type===z.Foundation||Xe.type===z.Cuboid){const ft=n(Xe.id);if(Y.current.clear(),_.current.clear(),Q.current.clear(),ft.length>0)for(const wt of ft)if(wt.type===z.Polygon)_.current.set(wt.id,wt.vertices.map(kt=>({...kt})));else{if(wt.type===z.Wall){const kt=wt,Zt=new _t(kt.leftPoint[0],kt.leftPoint[1]),Ot=new _t(kt.rightPoint[0],kt.rightPoint[1]);Q.current.set(wt.id,[Zt,Ot])}Y.current.set(wt.id,new ue(wt.cx,wt.cy,wt.cz))}if(Xe.type===z.Foundation){const wt=zt(Xe.id);if(wt.length>0)for(const kt of wt){const Zt=new ue(kt.cx,kt.cy);Y.current.set(kt.id,Zt)}}}switch(Xe.type){case z.Tree:q.current=Xe.parentId,ae.current.set(Xe.lx,Xe.ly,Xe.lz);break;case z.Flower:q.current=Xe.parentId;break;case z.Human:q.current=Xe.parentId;break;case z.Cuboid:{if(Cd(Xe)&&Xe.parentId===rr?Pt(Be,Xe):ze.current.clear(),le.current=Xe.parentId,H.getState().moveHandleType){const{rot:on}=ye.getWorldDataById(Xe.id),qt=new cn(0,0,on);switch(H.getState().moveHandleType){case Ho.Right:{ge.current.set(-Xe.lx/2,0,0).applyEuler(qt);break}case Ho.Left:{ge.current.set(Xe.lx/2,0,0).applyEuler(qt);break}case Ho.Lower:{ge.current.set(0,Xe.ly/2,0).applyEuler(qt);break}case Ho.Upper:{ge.current.set(0,-Xe.ly/2,0).applyEuler(qt);break}default:{ge.current.set(0,0,0);break}}}de.current.clear();const{pos:wt,rot:kt}=ye.getWorldDataById(Xe.id),Zt=new ue(wt.x,wt.y,wt.z),Ot=n(Xe.id);if(Ot.length>0)for(const on of Ot)switch(on.type){case z.Cuboid:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,kt));qt.add(Zt),de.current.set(on.id,qt);break}case z.Tree:case z.Flower:case z.Human:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,kt));qt.add(Zt),de.current.set(on.id,qt);break}case z.SolarPanel:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,kt)).add(Zt);de.current.set(on.id,qt);break}case z.Light:case z.Sensor:if(ye.isIdentical(on.normal,fs)){const qt=new ue(on.cx*Xe.lx,on.cy*Xe.ly,on.cz*Xe.lz).applyEuler(new cn(0,0,kt));qt.add(Zt),de.current.set(on.id,qt)}break;case z.Polygon:if(ye.isIdentical(on.normal,fs)){const qt=on,rn=[];for(const Pn of qt.vertices){const fo=new _t(Pn.x*Xe.lx,Pn.y*Xe.ly).rotateAround(ui,kt);fo.add(new _t(Zt.x,Zt.y)),rn.push(fo)}he.current.set(qt.id,rn)}break}break}case z.Foundation:{Cd(Xe)&&Pt(Be,Xe),de.current.clear(),he.current.clear(),me.current.clear();const ft=new _t(Xe.cx,Xe.cy),wt=new ue(Xe.cx,Xe.cy,Xe.cz),kt=n(Xe.id);if(kt.length>0){const Ot=Xe.rotation[2];for(const on of kt)switch(on.type){case z.Wall:{const qt=on,rn=new _t(qt.cx,qt.cy).rotateAround(ui,Ot);rn.add(ft);const Pn=new _t(qt.leftPoint[0],qt.leftPoint[1]).rotateAround(ui,Ot);Pn.add(ft);const fo=new _t(qt.rightPoint[0],qt.rightPoint[1]).rotateAround(ui,Ot);fo.add(ft),me.current.set(qt.id,{centerPointAbsPos:rn,leftPointAbsPos:Pn,rightPointAbsPos:fo});break}case z.Tree:case z.Flower:case z.Human:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,Ot));qt.add(wt),de.current.set(on.id,qt);break}case z.BatteryStorage:case z.SolarPanel:{const qt=new ue(on.cx,on.cy,on.cz).applyEuler(new cn(0,0,Ot)).add(wt);de.current.set(on.id,qt);break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:{const qt=new ue(on.cx*Xe.lx,on.cy*Xe.ly,on.cz*Xe.lz).applyEuler(new cn(0,0,Ot));qt.add(wt),de.current.set(on.id,qt);break}case z.Polygon:{const qt=on,rn=[];for(const Pn of qt.vertices){const fo=new _t(Pn.x*Xe.lx,Pn.y*Xe.ly).rotateAround(ui,Ot);fo.add(ft),rn.push(fo)}he.current.set(qt.id,rn);break}}}const Zt=zt(Xe.id);if(Zt.length>0){const Ot=new cn(0,0,Xe.rotation[2]);for(const on of Zt)if(on.type===z.Window||on.type===z.SolarPanel||on.type===z.SolarWaterHeater){const qt=new ue(on.cx,on.cy).applyEuler(Ot);qt.add(wt),de.current.set(on.id,qt)}else{const qt=new ue(on.cx*Xe.lx,on.cy*Xe.ly).applyEuler(Ot);qt.add(wt),de.current.set(on.id,qt)}}break}}}else E.current=null}}},Ct=Be=>Be===z.Human||Be===z.Tree||Be===z.Flower,yt=(Be,pt)=>{if(Be.tempHumanPlant.length===0){const ct=Be.elements.filter(ft=>Ct(ft.type)&&ye.isDescendantOf(ft,pt));Be.tempHumanPlant=ct;const Xe=new Set(ct.map(ft=>ft.id));Be.elements=Be.elements.filter(ft=>!Xe.has(ft.id))}},at=(Be,pt)=>{const ct=Be.intersections.find(ft=>{const wt=ft.eventObject;if(!wt.name.includes("Cuboid"))return!1;const kt=wt.name.split(" ");return kt.length!==2?!1:kt[1]!==pt&&wt.userData.stackable});if(!ct)return;const Xe=ct.eventObject.name.split(" ")[1];if(!ze.current.has(Xe))return ye.isChild(pt,Xe)?void 0:ct};g.useEffect(()=>{E.current&&(D||y!==z.None)&&(ce.current&&y!==z.Foundation?(ce.current=!1,Pe.current=!1,t(Be=>{Be.addedFoundationId=null,Be.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(E.current.id,!1),E.current=null):pe.current&&y!==z.Cuboid&&(pe.current=!1,Ie.current=!1,t(Be=>{Be.addedCuboidId=null,Be.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(E.current.id,!1),E.current=null))},[y,D]);const Et=Be=>{if(E.current&&E.current.type&&!E.current.locked){Fe(Be);let pt;switch(E.current.type){case z.Foundation:F.current&&(pt=Me.intersectObjects([F.current]),pt.length>0&&(w?it(pt[0].point):x?It(pt[0].point):C&&ot(pt[0].point)));break;case z.Cuboid:if(F.current&&Ne===dh.Horizontal&&(pt=Me.intersectObjects([F.current]),pt.length>0)){const ct=pt[0].point.clone(),Xe=at(Be,E.current.id);if(w)if(ze.current.size>1)it(ct);else if(Xe){if(pt=Me.intersectObjects([Xe.eventObject]),pt.length===0)return;ct.copy(pt[0].point).add(ge.current);const ft=Xe.eventObject.name.split(" ")[1];t(wt=>{const kt=wt.elements.find(Ot=>{var on;return Ot.id===((on=wt.selectedElement)==null?void 0:on.id)}),Zt=wt.selectedElement;if(kt&&Zt){const{pos:Ot,rot:on}=ye.getWorldDataById(ft),qt=new ue().subVectors(ct,Ot);if(qt.applyEuler(new cn(0,0,-on)),kt.cx=qt.x,kt.cy=qt.y,Zt.parentId!==ft){kt.parentId!==ft&&yt(wt,kt.id);const{rot:rn}=ye.getWorldDataById(Zt.id);kt.rotation[2]=rn-on,kt.parentId=ft}else kt.parentId!==ft&&(kt.parentId!==Zt.parentId&&yt(wt,kt.id),kt.parentId=Zt.parentId,kt.rotation[2]=Zt.rotation[2])}})}else t(ft=>{const wt=ft.elements.find(kt=>kt.id===E.current.id);if(wt&&wt.parentId!==rr){wt.parentId!==rr&&yt(ft,wt.id);const{rot:kt}=ye.getWorldDataById(wt.parentId);wt.rotation[2]+=kt,wt.parentId=rr}}),it(ct);else if(x){const ft=a(E.current.id);ft&&ft.parentId===rr&&It(ct)}}break}}if(W.current){if(y!==z.None){Fe(Be);const pt=Me.intersectObjects([W.current]);if(pt.length>0){const ct=pt[0].point;switch(y){case z.Foundation:{const Xe=i(b,ct);Xe&&(t(ft=>{ft.addedFoundationId=Xe.id,ft.objectTypeToAdd=z.None}),E.current=Xe,ce.current=!0);break}case z.Cuboid:{const Xe=i(b,ct);Xe&&(t(ft=>{ft.addedCuboidId=Xe.id,ft.objectTypeToAdd=z.None}),E.current=Xe,pe.current=!0);break}}}}if(E.current&&(ce.current||pe.current)){Fe(Be);let pt=Me.intersectObjects([W.current]);if(pt.length===0)return;const ct=pt[0].point;if(E.current.type===z.Foundation)o(E.current.id,ct.x,ct.y);else if(E.current.type===z.Cuboid){const Xe=at(Be,E.current.id);if(Xe){if(pt=Me.intersectObjects([Xe.eventObject]),pt.length===0)return;ct.copy(pt[0].point);const ft=Xe.eventObject.name.split(" ")[1];t(wt=>{const kt=wt.elements.find(Zt=>{var Ot;return Zt.id===((Ot=E.current)==null?void 0:Ot.id)});if(kt){const{pos:Zt,rot:Ot}=ye.getWorldDataById(ft),on=new ue().subVectors(ct,Zt);on.applyEuler(new cn(0,0,-Ot)),kt.cx=on.x,kt.cy=on.y,kt.parentId=ft,kt.rotation[2]=-Ot}})}else t(ft=>{const wt=ft.elements.find(kt=>{var Zt;return kt.id===((Zt=E.current)==null?void 0:Zt.id)});if(wt&&wt.parentId!==rr){const{rot:kt}=ye.getWorldDataById(wt.parentId);wt.rotation[2]+=kt,wt.parentId=rr}}),o(E.current.id,ct.x,ct.y)}}}},Lt=Be=>{if(E.current&&E.current.type&&!E.current.locked){Fe(Be);let pt;if(F.current&&Ne===dh.Vertical&&(pt=Me.intersectObjects([F.current]),pt&&pt.length>0)){const ct=pt[0].point;switch(E.current.type){case z.Tree:{const Xe=E.current;switch(x){case xt.Top:s(Xe.id,ct.z),t(ft=>{ft.selectedElementHeight=Math.max(1,ct.z)});break;case xt.Left:case xt.Right:case xt.Upper:case xt.Lower:l(Xe.id,2*Math.hypot(ct.x-Xe.cx,ct.y-Xe.cy));break}Oe(jn.getState().treeRef,Be);break}case z.Flower:{Oe(jn.getState().flowerRef,Be);break}case z.Human:{Oe(jn.getState().humanRef,Be);break}}}}},Je=Be=>Be===z.Foundation||Be===z.Cuboid||Be===z.Tree||Be===z.Flower||Be===z.Human,st=(Be,pt,ct,Xe,ft)=>{if(Be){for(const wt of Be.children)if(wt.name.includes("Human")||wt.name.includes("Tree")||wt.name.includes("Flower")){const kt=Ye(wt),Zt=de.current.get(kt);if(Zt)if(Math.abs(ae.current.z/2-wt.position.z)<.01){const Ot=new ue().subVectors(Zt,Xe).applyEuler(new cn(0,0,-ft));wt.position.setX(Ot.x),wt.position.setY(Ot.y)}else{const Ot=new ue().subVectors(Zt,L.current).applyEuler(new cn(0,0,-ft)),on=new ue().subVectors(Xe,L.current),qt=new ue().subVectors(Ot,on);Math.abs(Ot.x/ae.current.x)>.49?(wt.position.setX((Ot.x>0?pt:-pt)/2),wt.position.setY(qt.y)):Math.abs(Ot.y/ae.current.y)>.49&&(wt.position.setX(qt.x),wt.position.setY((Ot.y>0?ct:-ct)/2))}}}},It=Be=>{if(!E.current)return;const pt=new _t(Be.x,Be.y),ct=new _t(P.x,P.y),Xe=ct.distanceTo(pt),ft=Math.atan2(pt.x-P.x,pt.y-P.y)+E.current.rotation[2];let wt=Math.abs(Xe*Math.sin(ft)),kt=Math.abs(Xe*Math.cos(ft));const Zt=new _t().addVectors(pt,ct).multiplyScalar(.5);if(E.current.type===z.Cuboid&&(x===xt.Lower||x===xt.Upper||x===xt.Left||x===xt.Right)){const Ot=new ue(P.x,P.y),on=E.current.rotation[2],qt=new ue(Be.x,Be.y).sub(Ot).applyEuler(new cn(0,0,-on)),rn=new ue(1,0,0);(x===xt.Upper||x===xt.Lower)&&rn.set(0,1,0),rn.applyEuler(new cn(0,0,on));const Pn=Ot.clone().add(rn.clone().multiplyScalar(qt.x/2));x===xt.Left||x===xt.Right?(wt=Math.abs(qt.x),kt=E.current.ly):(x===xt.Upper||x===xt.Lower)&&(wt=E.current.lx,kt=Math.abs(qt.y),Pn.copy(Ot.add(rn.clone().multiplyScalar(qt.y/2)))),Zt.x=Pn.x,Zt.y=Pn.y}switch(t(Ot=>{if(!E.current)return;let on=!1;for(const qt of Ot.elements)if(qt.id===E.current.id){switch(qt.type){case z.Cuboid:case z.Foundation:{const rn=n(qt.id);if(rn.length>0){const Pn=[];for(const to of rn){if(ye.isPlantOrHuman(to))continue;const Dt=JSON.parse(JSON.stringify(to));if(Pn.push(Dt),ye.isIdentical(Dt.normal,fs))if(to.type===z.Wall){const fn=me.current.get(to.id);if(fn){const kn=-qt.rotation[2],{centerPointAbsPos:yo,leftPointAbsPos:ur,rightPointAbsPos:lr}=fn,xo=new _t().subVectors(yo,Zt).rotateAround(ui,kn),wo=new _t().subVectors(ur,Zt).rotateAround(ui,kn),Rr=new _t().subVectors(lr,Zt).rotateAround(ui,kn);switch(x){case xt.Lower:case xt.Upper:Dt.cy=xo.y;break;case xt.Left:case xt.Right:Dt.cx=xo.x;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:Dt.cx=xo.x,Dt.cy=xo.y;break}Dt.leftPoint=[wo.x,wo.y,0],Dt.rightPoint=[Rr.x,Rr.y,0]}}else{const fn=de.current.get(to.id);if(fn){const kn=-qt.rotation[2],yo=new _t().subVectors(new _t(fn.x,fn.y),Zt).rotateAround(ui,kn);switch(x){case xt.Lower:case xt.Upper:Dt.type===z.SolarPanel?Dt.cy=yo.y:Dt.cy=yo.y/kt;break;case xt.Left:case xt.Right:Dt.type===z.SolarPanel||Dt.type===z.SolarWaterHeater?Dt.cx=yo.x:Dt.cx=yo.x/wt;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:Dt.type===z.SolarPanel?(Dt.cx=yo.x,Dt.cy=yo.y):(Dt.cx=yo.x/wt,Dt.cy=yo.y/kt);break}}}else if((Dt.type===z.SolarPanel||Dt.type===z.SolarWaterHeater)&&Dt.parentType===z.Roof||Dt.type===z.BatteryStorage){const fn=de.current.get(to.id);if(fn){const kn=new _t().subVectors(new _t(fn.x,fn.y),Zt).rotateAround(ui,-qt.rotation[2]);Dt.cx=kn.x,Dt.cy=kn.y}}}const fo=JSON.parse(JSON.stringify(qt));switch(x){case xt.Lower:case xt.Upper:case xt.Left:case xt.Right:case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:fo.lx=wt,fo.ly=kt,fo.cx=Zt.x,fo.cy=Zt.y;break}if(ye.doesParentContainAllChildren(fo,Pn)){switch(x){case xt.Lower:case xt.Upper:case xt.Left:case xt.Right:case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.lx=wt,qt.ly=kt,qt.cx=Zt.x,qt.cy=Zt.y;break}on=!0}}else if(wt>.49&&kt>.49){switch(x){case xt.Lower:case xt.Upper:case xt.Left:case xt.Right:case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.lx=wt,qt.ly=kt,qt.cx=Zt.x,qt.cy=Zt.y;break}on=!0}break}}break}if(on)for(const qt of Ot.elements){if(qt.parentId===E.current.id)switch(qt.type){case z.Wall:{const rn=qt,Pn=me.current.get(qt.id);if(Pn){const fo=-E.current.rotation[2],{centerPointAbsPos:to,leftPointAbsPos:Dt,rightPointAbsPos:fn}=Pn,kn=new _t().subVectors(to,Zt).rotateAround(ui,fo),yo=new _t().subVectors(Dt,Zt).rotateAround(ui,fo),ur=new _t().subVectors(fn,Zt).rotateAround(ui,fo);switch(x){case xt.Lower:case xt.Upper:qt.cy=kn.y;break;case xt.Left:case xt.Right:qt.cx=kn.x;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.cx=kn.x,qt.cy=kn.y;break}rn.leftPoint=[yo.x,yo.y,0],rn.rightPoint=[ur.x,ur.y,0]}break}case z.BatteryStorage:{const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);qt.cx=Pn.x,qt.cy=Pn.y}break}case z.SolarPanel:{const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]),[fo,to,Dt]=qt.normal;ye.isEqual(Dt,1)&&(qt.cx=Pn.x,qt.cy=Pn.y),ye.isEqual(fo,0)&&ye.isEqual(to,1)?qt.cy=kt/2:ye.isEqual(fo,0)&&ye.isEqual(to,-1)?qt.cy=-kt/2:ye.isEqual(fo,-1)&&ye.isEqual(to,0)?qt.cx=-wt/2:ye.isEqual(fo,1)&&ye.isEqual(to,0)&&(qt.cx=wt/2)}break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:if(ye.isIdentical(qt.normal,fs)){const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);switch(x){case xt.Lower:case xt.Upper:qt.cy=Pn.y/kt;break;case xt.Left:case xt.Right:qt.cx=Pn.x/wt;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.cx=Pn.x/wt,qt.cy=Pn.y/kt;break}}}break;case z.Cuboid:{const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);switch(x){case xt.Lower:case xt.Upper:qt.cy=Pn.y;break;case xt.Left:case xt.Right:qt.cx=Pn.x;break;case xt.LowerLeft:case xt.LowerRight:case xt.UpperLeft:case xt.UpperRight:qt.cx=Pn.x,qt.cy=Pn.y;break}}break}case z.Polygon:if(ye.isIdentical(qt.normal,fs)){const rn=qt,Pn=he.current.get(rn.id);if(Pn){const fo=[];Pn.forEach(to=>{const Dt=new _t().subVectors(to,Zt).rotateAround(ui,-E.current.rotation[2]);fo.push({x:Dt.x/wt,y:Dt.y/kt})}),rn.vertices=fo}}break}if(qt.foundationId===E.current.id&&(qt.type===z.SolarPanel||qt.type===z.SolarWaterHeater||qt.type===z.Window)&&qt.parentType===z.Roof){const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);qt.cx=Pn.x,qt.cy=Pn.y}}if(qt.foundationId===E.current.id&&(qt.type===z.Sensor||qt.type===z.Light)&&qt.parentType===z.Roof){const rn=de.current.get(qt.id);if(rn){const Pn=new _t().subVectors(new _t(rn.x,rn.y),Zt).rotateAround(ui,-E.current.rotation[2]);qt.cx=Pn.x/wt,qt.cy=Pn.y/kt}}}}),E.current.type){case z.Foundation:{const Ot=jn.getState().foundationRef;Ot!=null&&Ot.current&&st(Ot==null?void 0:Ot.current,wt,kt,Ot.current.position,E.current.rotation[2]);break}case z.Cuboid:{const Ot=jn.getState().cuboidRef;Ot!=null&&Ot.current&&Ot.current.parent&&st(Ot==null?void 0:Ot.current,wt,kt,Ot.current.parent.position,E.current.rotation[2]);break}}},ot=Be=>{const{cx:pt,cy:ct}=E.current,Xe=Math.atan2(pt-Be.x,Be.y-ct)+(C===ai.Upper?0:Math.PI),ft=Math.abs(Xe)>Math.PI?-Math.sign(Xe)*fa:0;r(E.current.id,0,0,Xe+ft)},it=Be=>{const pt=ze.current.size>1;if(pt){t(kt=>{for(const Zt of kt.elements)if(Cd(Zt)&&ze.current.has(Zt.id)){const Ot=ze.current.get(Zt.id);Ot&&(Zt.cx=Be.x+Ot.x,Zt.cy=Be.y+Ot.y)}});return}let ct,Xe;const ft=E.current.lx/2,wt=E.current.ly/2;switch(w){case Ho.Top:{if(pt){const kt=new ue(Be.x,Be.y);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,Be.x,Be.y);break}case Ho.Upper:if(ct=Be.x+Re*wt,Xe=Be.y-Te*wt,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break;case Ho.Lower:if(ct=Be.x-Re*wt,Xe=Be.y+Te*wt,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break;case Ho.Left:if(ct=Be.x+Te*ft,Xe=Be.y+Re*ft,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break;case Ho.Right:if(ct=Be.x-Te*ft,Xe=Be.y-Re*ft,pt){const kt=new ue(ct,Xe);t(Zt=>{for(const Ot of Zt.elements)if(Ot.id===E.current.id)Ot.cx=kt.x,Ot.cy=kt.y;else if(ze.current.has(Ot.id)){const on=ze.current.get(Ot.id);if(on){const qt=new ue().addVectors(kt,on);Ot.cx=qt.x,Ot.cy=qt.y}}})}else o(E.current.id,ct,Xe);break}};return g.useEffect(()=>{const Be=()=>{const pt=H.getState().addedFoundationId,ct=H.getState().addedCuboidId;pt&&(c(pt,!1),t(Xe=>{Xe.objectTypeToAdd=z.Foundation,Xe.addedFoundationId=null}),jn.getState().setEnableOrbitController(!0),E.current=null,ce.current=!1,Pe.current=!1),ct&&(c(ct,!1),t(Xe=>{Xe.objectTypeToAdd=z.Cuboid,Xe.addedCuboidId=null}),jn.getState().setEnableOrbitController(!0),E.current=null,pe.current=!1,Ie.current=!1)};return window.addEventListener("beforeunload",Be),()=>{window.removeEventListener("beforeunload",Be)}},[]),h.jsxs(h.Fragment,{children:[E.current&&Ne!==dh.Ground&&h.jsx(yi,{ref:F,visible:!1,name:"Ground Intersection Plane",rotation:Ue,position:_e,args:[1e5,1e5],onPointerMove:A3.throttle(Lt,hL,{trailing:!1}),children:h.jsx("meshStandardMaterial",{side:zr,opacity:.5,transparent:!0})}),h.jsx(yi,{receiveShadow:A,ref:W,name:"Ground",userData:{stand:!0},rotation:[0,0,0],position:[0,0,0],args:[1e4,1e4],renderOrder:-2,onContextMenu:nt,onPointerDown:Rt,onPointerMove:A3.throttle(Et,hL,{trailing:!1}),children:M&&!v?h.jsx("meshBasicMaterial",{color:S}):h.jsx("meshStandardMaterial",{depthTest:!1,color:v?"white":S,map:v?ye.WATER_TEXTURE:ye.WHITE_TEXTURE,needsUpdate:!0})})]})}),tce=48,o1n=72,r1n=12,i1n=xe.memo(({date:t,hourAngle:e,declinationAngle:n,worldLatitude:o})=>{const r=H(Ky),i=H(LGe),a=H(HGe)??!0,l=H(MGe)??!0,s=H(IGe)??!0,[c,u]=g.useState(ye.toRadians(42)),d=Up(O3e),f=Math.max(2,r*.2),p=Math.max(.4,r*.025),m=B5(NM,gI),y=r*.05,w={font:m,height:0,size:y},x=6,C=new Array(2*x+1).fill(0),P=_=>_===0?-y*.3:_>0&&_<7?-y*.8:-y*1.2;g.useEffect(()=>{u(ye.toRadians(o))},[o]);const A=6,[S,v]=g.useMemo(()=>{const _=new Ni,G=new Ni,Q=[],oe=[],ee=fa/o1n;let $=0;for(let q=0;qHt&&(de=.05*r+($%3===0?.2:0),he=new ue(r,le,0),he.z=.002,oe.push(ye.sphericalToCartesianZ(he)),he=new ue(r+de,le,0),he.z=.002,oe.push(ye.sphericalToCartesianZ(he))),$++}const ae=Q.length*3,Z=new Float32Array(ae),ne=new Float32Array(ae),te=new Float32Array(ae);for(let q=0;q{const _=[],G=pl(t,ye.toDegrees(c)),Q=E_(G.sunrise),oe=E_(G.sunset),ee=(oe-Q)/tce;for(let $=Q;$-.01&&_.push(ae)}return _},[t,c,r,n]),T=_=>{const G=FU(_),Q=[],oe=pl(_,ye.toDegrees(c)),ee=E_(oe.sunrise),$=E_(oe.sunset),ae=($-ee)/tce;for(let Z=ee;Z<$+ae/2;Z+=ae){const ne=_9(r,Z,G,c);ne.z>-.01&&Q.push(ne)}return Q},R=g.useMemo(()=>{const _=[];for(let G=0;G<=A;G++){const Q=new Date(2021,G===0?11:G-1,22);_.push(T(Q))}return _},[c,r]),M=g.useMemo(()=>_9(r,e,n,c),[c,n,e,r]),D=g.useMemo(()=>M.clone().normalize(),[M]),k=g.useMemo(()=>new ue(M.x,M.y,0).normalize(),[M]),N=g.useMemo(()=>Math.asin(M.z/M.length()),[M]),U=g.useMemo(()=>{const G=new x5(0,0,f,f,0,N,!1,0).getPoints(25),Q=new Array;for(const oe of G)Q.push(new ue(oe.x,oe.y,0));return Q},[N,M,f]),W=g.useMemo(()=>Math.acos(M.z/M.length()),[M]),F=g.useMemo(()=>{const G=new x5(0,0,f*.8,f*.8,N,$t,!1,0).getPoints(25),Q=new Array;for(const oe of G)Q.push(new ue(oe.x,oe.y,0));return Q},[W,M,f,N]),E=g.useMemo(()=>{const _=Math.acos(M.y/Math.hypot(M.x,M.y));return M.x>0?-_:_},[M]),L=g.useMemo(()=>{const G=new x5(0,0,f*1.2,f*1.2,$t,$t+E,M.x>0,0).getPoints(50),Q=new Array;for(const oe of G)Q.push(new ue(oe.x,oe.y,0));return Q},[E,M,f]),j=g.useMemo(()=>{const _=2*dC/r1n,G=fa/tce,Q=new Ni;let oe=0;const ee=[],$=[];for(let ae=-dC;aeMath.PI&&(ne=Math.PI),te>dC&&(te=dC);const q=_9(r,Z,ae,c),le=_9(r,ne,ae,c),de=_9(r,ne,te,c),he=_9(r,Z,te,c);(q.z>=0||le.z>=0||de.z>=0||he.z>=0)&&(ee.push(q,le,de,he),$.push(oe),$.push(oe+1),$.push(oe+2),$.push(oe),$.push(oe+2),$.push(oe+3),oe+=4)}return Q.setFromPoints(ee),Q.setIndex(new _a(new Uint16Array($),1)),Q},[c,r]),Y=.05*r,O=2+5*Y;return h.jsxs("group",{children:[C.map((_,G)=>{let Q=Math.ceil(G/2)*(G%2===0?1:-1);Q===-6&&(Q=x);const oe=P(Math.abs(Q));return h.jsx("group",{rotation:[$t,Q*Math.PI/x,0],children:h.jsxs("mesh",{position:[oe,0,-r*1.1],rotation:[-$t,0,0],children:[h.jsx("textGeometry",{args:[`${-30*Q}°`,w]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},G)}),h.jsxs("mesh",{rotation:new cn(0,0,0),name:"Heliodon",children:[h.jsxs("mesh",{children:[h.jsx("bufferGeometry",{...S}),h.jsx("meshBasicMaterial",{side:zr,vertexColors:!0,polygonOffset:!0,polygonOffsetFactor:-.7,polygonOffsetUnits:-2})]}),h.jsxs("lineSegments",{children:[h.jsx("bufferGeometry",{...v}),h.jsx("meshBasicMaterial",{color:0})]}),h.jsxs("mesh",{children:[b.length>3&&h.jsx(On,{lineWidth:2,points:b,color:"yellow"}),R.filter(_=>_.length>3).map((_,G)=>h.jsx(On,{opacity:G===0||G===A?1:.5,lineWidth:G===0||G===A?1:.5,points:_,color:"#999"},G)),h.jsx("mesh",{args:[j],children:h.jsx("meshBasicMaterial",{side:zr,color:[1,1,0],transparent:!0,opacity:.5,depthWrite:!1,clippingPlanes:[new V9(Zc,0)]})}),h.jsx("mesh",{position:M,children:h.jsx("sprite",{scale:[O,O,O],children:h.jsx("spriteMaterial",{map:d,transparent:!1,color:16777215,blending:Th,depthWrite:!1})})}),h.jsxs("mesh",{position:M,children:[h.jsx("sphereGeometry",{args:[Y,10,10]}),h.jsx("meshBasicMaterial",{color:"white"})]})]})]}),h.jsx(yi,{args:[1e4,1e4],renderOrder:-1,userData:{unintersectable:!0},children:h.jsx("meshBasicMaterial",{transparent:!0,opacity:0})}),i&&M.z>0&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[M.x,M.y,M.z]],name:"Line from origin to sun",lineWidth:.5,color:"white"}),h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[M.x,M.y,0]],name:"Line from origin to sun projection on ground",lineWidth:.5,color:"white"}),h.jsx(On,{userData:{unintersectable:!0},points:[[M.x,M.y,0],[M.x,M.y,M.z]],name:"Line from sun projection on ground to sun",lineWidth:.5,color:"white"}),l&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},linewidth:.5,points:U,position:[0,0,0],rotation:new cn($t,0,$t+E,"ZXY"),color:"white",name:"Elevation Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Elevation Angle",backgroundColor:"indigo",text:ye.toDegrees(N).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:D.clone().multiplyScalar(f).add(k.clone().multiplyScalar(f)).multiplyScalar(.65)})]}),s&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},linewidth:.5,points:F,position:[0,0,0],rotation:new cn($t,0,$t+E,"ZXY"),color:"white",name:"Zenith Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Zenith Angle",backgroundColor:"navy",text:ye.toDegrees(W).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:D.clone().multiplyScalar(f).add(Oo.clone().multiplyScalar(f)).multiplyScalar(.57)})]}),a&&h.jsxs(h.Fragment,{children:[h.jsx(On,{userData:{unintersectable:!0},linewidth:.5,points:L,position:[0,0,0],color:"white",name:"Azimuth Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Azimuth Angle",backgroundColor:"firebrick",text:ye.toDegrees(Math.abs(E-Math.PI)<1e-6?E:-E).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:k.clone().multiplyScalar(f).add(Zc.clone().multiplyScalar(f)).multiplyScalar(1.1).add(new ue(0,0,p/2))})]})]})]})}),a1n=xe.memo(()=>{const t=H(FGe),e=H(Ky),n=H(tu),o=H(ml),r=H(HCt),i=g.useMemo(()=>new Date(o),[o]),[a,l]=g.useMemo(()=>[Y3e(i),FU(i)],[i]);return g.useEffect(()=>{r(_9(e,a,l,ye.toRadians(n)))},[n,a,l,e]),h.jsx(h.Fragment,{children:t&&h.jsx(i1n,{date:new Date(o),hourAngle:a,declinationAngle:l,worldLatitude:n})})}),_Me="/aladdin/assets/ifi-logo-CwxGDl7t.png",l1n="/aladdin/assets/magic-lamp-XxXOV1dq.png",s1n=xe.memo(({top:t,height:e,color:n})=>{const o=H(Au),r=g.useMemo(()=>({lng:o}),[o]);return h.jsx("div",{children:h.jsxs("div",{style:{position:"absolute",borderRadius:"20px",border:"thin",textAlign:"center",left:"5%",right:"5%",top:t+"px",height:(e??300)+"px"},children:[h.jsx("h2",{style:{marginTop:"20px",color:n},children:B.t("aboutUs.ProductBroughtToYouBy",r)}),h.jsx("p",{style:{fontSize:"16px",color:n},children:"Charles Xie and Xiaotong Ding"}),h.jsxs("div",{style:{position:"absolute",marginTop:"20px",fontSize:"12px",textAlign:"justify",color:n},children:[B.t("aboutUs.Translators",r),": ",G9.Ukrainian," (Andriy Kashyrskyy), ",G9.Spanish," (Alex Barco), ",G9.Turkish," (Hasan Bircan)",h.jsx("br",{}),h.jsx("br",{}),B.t("aboutUs.Acknowledgment",r),": ",B.t("aboutUs.FundingInformation",r)," ",B.t("aboutUs.Contact",r),h.jsx("hr",{style:{width:"100%",marginTop:"20px",color:n}}),h.jsxs("p",{style:{textAlign:"center",paddingTop:"6px",fontSize:"12px",color:n},children:[h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-terms.html",style:{color:n,textDecoration:"none"},children:B.t("aboutUs.TermsOfService",r)}),"   |   ",h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-privacy.html",style:{color:n,textDecoration:"none"},children:B.t("aboutUs.PrivacyPolicy",r)})]})]})]})})}),c1n=ko.div` position: absolute; top: 80px; left: 10px; @@ -7044,8 +7044,8 @@ Content-Type: `+c.contentType+`\r background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0)); background: linear-gradient(to top, #000, rgba(0,0,0,0)); } - `),xe.createElement("div",{style:u.white,className:"saturation-white"},xe.createElement("div",{style:u.black,className:"saturation-black"}),xe.createElement("div",{style:u.pointer},this.props.pointer?xe.createElement(this.props.pointer,this.props):xe.createElement("div",{style:u.circle}))))}}]),e}(g.PureComponent||g.Component);function I9o(t,e){for(var n=-1,o=t==null?0:t.length;++n=0,i=!n&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(o=this.toRgbString()),e==="prgb"&&(o=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(o=this.toHexString()),e==="hex3"&&(o=this.toHexString(!0)),e==="hex4"&&(o=this.toHex8String(!0)),e==="hex8"&&(o=this.toHex8String()),e==="name"&&(o=this.toName()),e==="hsl"&&(o=this.toHslString()),e==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return ri(this.toString())},_applyModification:function(e,n){var o=e.apply(null,[this].concat([].slice.call(n)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(K9o,arguments)},brighten:function(){return this._applyModification($9o,arguments)},darken:function(){return this._applyModification(q9o,arguments)},desaturate:function(){return this._applyModification(G9o,arguments)},saturate:function(){return this._applyModification(X9o,arguments)},greyscale:function(){return this._applyModification(J9o,arguments)},spin:function(){return this._applyModification(Q9o,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(t3o,arguments)},complement:function(){return this._applyCombination(Z9o,arguments)},monochromatic:function(){return this._applyCombination(n3o,arguments)},splitcomplement:function(){return this._applyCombination(e3o,arguments)},triad:function(){return this._applyCombination(QDe,[3])},tetrad:function(){return this._applyCombination(QDe,[4])}};ri.fromRatio=function(t,e){if(RK(t)=="object"){var n={};for(var o in t)t.hasOwnProperty(o)&&(o==="a"?n[o]=t[o]:n[o]=ck(t[o]));t=n}return ri(t,e)};function B9o(t){var e={r:0,g:0,b:0},n=1,o=null,r=null,i=null,a=!1,l=!1;return typeof t=="string"&&(t=l3o(t)),RK(t)=="object"&&(nA(t.r)&&nA(t.g)&&nA(t.b)?(e=Y9o(t.r,t.g,t.b),a=!0,l=String(t.r).substr(-1)==="%"?"prgb":"rgb"):nA(t.h)&&nA(t.s)&&nA(t.v)?(o=ck(t.s),r=ck(t.v),e=_9o(t.h,o,r),a=!0,l="hsv"):nA(t.h)&&nA(t.s)&&nA(t.l)&&(o=ck(t.s),i=ck(t.l),e=O9o(t.h,o,i),a=!0,l="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=Cut(n),{ok:a,format:t.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:n}}function Y9o(t,e,n){return{r:Jc(t,255)*255,g:Jc(e,255)*255,b:Jc(n,255)*255}}function JDe(t,e,n){t=Jc(t,255),e=Jc(e,255),n=Jc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=(o+r)/2;if(o==r)i=a=0;else{var s=o-r;switch(a=l>.5?s/(2-o-r):s/(o+r),o){case t:i=(e-n)/s+(e1&&(d-=1),d<1/6?c+(u-c)*6*d:d<1/2?u:d<2/3?c+(u-c)*(2/3-d)*6:c}if(e===0)o=r=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;o=a(s,l,t+1/3),r=a(s,l,t),i=a(s,l,t-1/3)}return{r:o*255,g:r*255,b:i*255}}function KDe(t,e,n){t=Jc(t,255),e=Jc(e,255),n=Jc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=o,s=o-r;if(a=o===0?0:s/o,o==r)i=0;else{switch(o){case t:i=(e-n)/s+(e>1)+720)%360;--e;)o.h=(o.h+r)%360,i.push(ri(o));return i}function n3o(t,e){e=e||6;for(var n=ri(t).toHsv(),o=n.h,r=n.s,i=n.v,a=[],l=1/e;e--;)a.push(ri({h:o,s:r,v:i})),i=(i+l)%1;return a}ri.mix=function(t,e,n){n=n===0?0:n||50;var o=ri(t).toRgb(),r=ri(e).toRgb(),i=n/100,a={r:(r.r-o.r)*i+o.r,g:(r.g-o.g)*i+o.g,b:(r.b-o.b)*i+o.b,a:(r.a-o.a)*i+o.a};return ri(a)};ri.readability=function(t,e){var n=ri(t),o=ri(e);return(Math.max(n.getLuminance(),o.getLuminance())+.05)/(Math.min(n.getLuminance(),o.getLuminance())+.05)};ri.isReadable=function(t,e,n){var o=ri.readability(t,e),r,i;switch(i=!1,r=s3o(n),r.level+r.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7;break}return i};ri.mostReadable=function(t,e,n){var o=null,r=0,i,a,l,s;n=n||{},a=n.includeFallbackColors,l=n.level,s=n.size;for(var c=0;cr&&(r=i,o=ri(e[c]));return ri.isReadable(t,o,{level:l,size:s})||!a?o:(n.includeFallbackColors=!1,ri.mostReadable(t,["#fff","#000"],n))};var L1e=ri.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},o3o=ri.hexNames=r3o(L1e);function r3o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function Cut(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Jc(t,e){i3o(t)&&(t="100%");var n=a3o(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Wne(t){return Math.min(1,Math.max(0,t))}function Wg(t){return parseInt(t,16)}function i3o(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function a3o(t){return typeof t=="string"&&t.indexOf("%")!=-1}function h5(t){return t.length==1?"0"+t:""+t}function ck(t){return t<=1&&(t=t*100+"%"),t}function Rut(t){return Math.round(parseFloat(t)*255).toString(16)}function ZDe(t){return Wg(t)/255}var V2=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function nA(t){return!!V2.CSS_UNIT.exec(t)}function l3o(t){t=t.replace(U9o,"").replace(j9o,"").toLowerCase();var e=!1;if(L1e[t])t=L1e[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=V2.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=V2.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=V2.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=V2.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=V2.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=V2.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=V2.hex8.exec(t))?{r:Wg(n[1]),g:Wg(n[2]),b:Wg(n[3]),a:ZDe(n[4]),format:e?"name":"hex8"}:(n=V2.hex6.exec(t))?{r:Wg(n[1]),g:Wg(n[2]),b:Wg(n[3]),format:e?"name":"hex"}:(n=V2.hex4.exec(t))?{r:Wg(n[1]+""+n[1]),g:Wg(n[2]+""+n[2]),b:Wg(n[3]+""+n[3]),a:ZDe(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=V2.hex3.exec(t))?{r:Wg(n[1]+""+n[1]),g:Wg(n[2]+""+n[2]),b:Wg(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function s3o(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:e,size:n}}var eEe=function(e){var n=["r","g","b","a","h","s","l","v"],o=0,r=0;return N9o(n,function(i){if(e[i]&&(o+=1,isNaN(e[i])||(r+=1),i==="s"||i==="l")){var a=/^\d+%$/;a.test(e[i])&&(r+=1)}}),o===r?e:!1},uk=function(e,n){var o=e.hex?ri(e.hex):ri(e),r=o.toHsl(),i=o.toHsv(),a=o.toRgb(),l=o.toHex();r.s===0&&(r.h=n||0,i.h=n||0);var s=l==="000000"&&a.a===0;return{hsl:r,hex:s?"transparent":"#"+l,rgb:a,hsv:i,oldHue:e.h||n||r.h,source:e.source}},O7=function(e){if(e==="transparent")return!0;var n=String(e).charAt(0)==="#"?1:0;return e.length!==4+n&&e.length<7+n&&ri(e).isValid()},p4e=function(e){if(!e)return"#fff";var n=uk(e);if(n.hex==="transparent")return"rgba(0,0,0,0.4)";var o=(n.rgb.r*299+n.rgb.g*587+n.rgb.b*114)/1e3;return o>=128?"#000":"#fff"},kce=function(e,n){var o=e.replace("°","");return ri(n+" ("+o+")")._ok},mE=Object.assign||function(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){m3o(r,o);function r(){var i,a,l,s;g3o(this,r);for(var c=arguments.length,u=Array(c),d=0;dl))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,p=n&H3o?new HK:void 0;for(i.set(t,e),i.set(e,t);++d=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var rV=24,Y6o=Wut.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?rV:o,i=t.height,a=i===void 0?rV:i,l=t.style,s=l===void 0?{}:l,c=B6o(t,["fill","width","height","style"]);return AEe.default.createElement("svg",yEe({viewBox:"0 0 "+rV+" "+rV,style:yEe({fill:n,width:r,height:a},s)},c),AEe.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},O6o=function(){function t(e,n){for(var o=0;o1&&(r.a=1),o.props.onChange({h:o.props.hsl.h,s:o.props.hsl.s,l:o.props.hsl.l,a:Math.round(r.a*100)/100,source:"rgb"},i)):(r.h||r.s||r.l)&&(typeof r.s=="string"&&r.s.includes("%")&&(r.s=r.s.replace("%","")),typeof r.l=="string"&&r.l.includes("%")&&(r.l=r.l.replace("%","")),r.s==1?r.s=.01:r.l==1&&(r.l=.01),o.props.onChange({h:r.h||o.props.hsl.h,s:Number(mEe(r.s)?o.props.hsl.s:r.s),l:Number(mEe(r.l)?o.props.hsl.l:r.l),source:"hsl"},i))},o.showHighlight=function(r){r.currentTarget.style.background="#eee"},o.hideHighlight=function(r){r.currentTarget.style.background="transparent"},n.hsl.a!==1&&n.view==="hex"?o.state={view:"rgb"}:o.state={view:n.view},o}return O6o(e,[{key:"render",value:function(){var o=this,r=Zi({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),i=void 0;return this.state.view==="hex"?i=xe.createElement("div",{style:r.fields,className:"flexbox-fix"},xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?i=xe.createElement("div",{style:r.fields,className:"flexbox-fix"},xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),xe.createElement("div",{style:r.alpha},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(i=xe.createElement("div",{style:r.fields,className:"flexbox-fix"},xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),xe.createElement("div",{style:r.alpha},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),xe.createElement("div",{style:r.wrap,className:"flexbox-fix"},i,xe.createElement("div",{style:r.toggle},xe.createElement("div",{style:r.icon,onClick:this.toggleViews,ref:function(l){return o.icon=l}},xe.createElement(Y6o,{style:r.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.hsl.a!==1&&r.view==="hex"?{view:"rgb"}:null}}]),e}(xe.Component);Nut.defaultProps={view:"hex"};var wEe=function(){var e=Zi({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return xe.createElement("div",{style:e.picker})},X6o=function(){var e=Zi({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return xe.createElement("div",{style:e.picker})},x4e=function(e){var n=e.width,o=e.onChange,r=e.disableAlpha,i=e.rgb,a=e.hsl,l=e.hsv,s=e.hex,c=e.renderers,u=e.styles,d=u===void 0?{}:u,f=e.className,p=f===void 0?"":f,m=e.defaultView,y=Zi(G1({default:{picker:{width:n,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+i.r+", "+i.g+", "+i.b+", "+i.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},d),{disableAlpha:r});return xe.createElement("div",{style:y.picker,className:"chrome-picker "+p},xe.createElement("div",{style:y.saturation},xe.createElement(Lne,{style:y.Saturation,hsl:a,hsv:l,pointer:X6o,onChange:o})),xe.createElement("div",{style:y.body},xe.createElement("div",{style:y.controls,className:"flexbox-fix"},xe.createElement("div",{style:y.color},xe.createElement("div",{style:y.swatch},xe.createElement("div",{style:y.active}),xe.createElement(UI,{renderers:c}))),xe.createElement("div",{style:y.toggles},xe.createElement("div",{style:y.hue},xe.createElement(jI,{style:y.Hue,hsl:a,pointer:wEe,onChange:o})),xe.createElement("div",{style:y.alpha},xe.createElement(a4e,{style:y.Alpha,rgb:i,hsl:a,pointer:wEe,renderers:c,onChange:o})))),xe.createElement(Nut,{rgb:i,hsl:a,hex:s,view:m,onChange:o,disableAlpha:r})))};x4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),disableAlpha:Ao.bool,styles:Ao.object,defaultView:Ao.oneOf(["hex","rgb","hsl"])};x4e.defaultProps={width:225,disableAlpha:!1,styles:{}};X1(x4e);var J6o=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.active,l=Zi({default:{color:{background:n,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:p4e(n),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:a,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return xe.createElement(iT,{style:l.color,color:n,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},xe.createElement("div",{style:l.dot}))},K6o=function(e){var n=e.hex,o=e.rgb,r=e.onChange,i=Zi({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:n},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),a=function(s,c){s.r||s.g||s.b?r({r:s.r||o.r,g:s.g||o.g,b:s.b||o.b,source:"rgb"},c):r({hex:s.hex,source:"hex"},c)};return xe.createElement("div",{style:i.fields,className:"flexbox-fix"},xe.createElement("div",{style:i.active}),xe.createElement(hl,{style:{wrap:i.HEXwrap,input:i.HEXinput,label:i.HEXlabel},label:"hex",value:n,onChange:a}),xe.createElement(hl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"r",value:o.r,onChange:a}),xe.createElement(hl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"g",value:o.g,onChange:a}),xe.createElement(hl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"b",value:o.b,onChange:a}))},v4e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.colors,i=e.hex,a=e.rgb,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=Zi(G1({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},s)),f=function(m,y){m.hex?O7(m.hex)&&n({hex:m.hex,source:"hex"},y):n(m,y)};return xe.createElement(Aj,{style:d.Compact,styles:s},xe.createElement("div",{style:d.compact,className:"compact-picker "+u},xe.createElement("div",null,aT(r,function(p){return xe.createElement(J6o,{key:p,color:p,active:p.toLowerCase()===i,onClick:f,onSwatchHover:o})}),xe.createElement("div",{style:d.clear})),xe.createElement(K6o,{hex:i,rgb:a,onChange:f})))};v4e.propTypes={colors:Ao.arrayOf(Ao.string),styles:Ao.object};v4e.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};const sd=X1(v4e);var $6o=function(e){var n=e.hover,o=e.color,r=e.onClick,i=e.onSwatchHover,a={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},l=Zi({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:a}},{hover:n});return xe.createElement("div",{style:l.swatch},xe.createElement(iT,{color:o,onClick:r,onHover:i,focusStyle:a}))};const q6o=i4e($6o);var b4e=function(e){var n=e.width,o=e.colors,r=e.onChange,i=e.onSwatchHover,a=e.triangle,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=Zi(G1({default:{card:{width:n,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},s),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right","bottom-left-triangle":a==="bottom-left","bottom-right-triangle":a==="bottom-right"}),f=function(m,y){return r({hex:m,source:"hex"},y)};return xe.createElement("div",{style:d.card,className:"github-picker "+u},xe.createElement("div",{style:d.triangleShadow}),xe.createElement("div",{style:d.triangle}),aT(o,function(p){return xe.createElement(q6o,{color:p,key:p,onClick:f,onSwatchHover:i})}))};b4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),colors:Ao.arrayOf(Ao.string),triangle:Ao.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ao.object};b4e.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};X1(b4e);var Q6o=function(e){var n=e.direction,o=Zi({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return xe.createElement("div",{style:o.picker})},Z6o=Object.assign||function(t){for(var e=1;e.5});return xe.createElement("div",{style:o.picker})},oAo=function(){var e=Zi({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return xe.createElement("div",{style:e.pointer},xe.createElement("div",{style:e.left},xe.createElement("div",{style:e.leftInside})),xe.createElement("div",{style:e.right},xe.createElement("div",{style:e.rightInside})))},xEe=function(e){var n=e.onClick,o=e.label,r=e.children,i=e.active,a=Zi({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:i});return xe.createElement("div",{style:a.button,onClick:n},o||r)},rAo=function(e){var n=e.rgb,o=e.currentColor,r=Zi({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+n.r+","+n.g+", "+n.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:o,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return xe.createElement("div",null,xe.createElement("div",{style:r.label},"new"),xe.createElement("div",{style:r.swatches},xe.createElement("div",{style:r.new}),xe.createElement("div",{style:r.current})),xe.createElement("div",{style:r.label},"current"))},iAo=function(){function t(e,n){for(var o=0;o100&&(u.a=100),u.a/=100,n({h:r.h,s:r.s,l:r.l,a:u.a,source:"rgb"},d))};return xe.createElement("div",{style:l.fields,className:"flexbox-fix"},xe.createElement("div",{style:l.double},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"hex",value:i.replace("#",""),onChange:s})),xe.createElement("div",{style:l.single},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"r",value:o.r,onChange:s,dragLabel:"true",dragMax:"255"})),xe.createElement("div",{style:l.single},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"g",value:o.g,onChange:s,dragLabel:"true",dragMax:"255"})),xe.createElement("div",{style:l.single},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"b",value:o.b,onChange:s,dragLabel:"true",dragMax:"255"})),xe.createElement("div",{style:l.alpha},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"a",value:Math.round(o.a*100),onChange:s,dragLabel:"true",dragMax:"100"})))},uAo=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var iV=24,yAo=jut.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?iV:o,i=t.height,a=i===void 0?iV:i,l=t.style,s=l===void 0?{}:l,c=mAo(t,["fill","width","height","style"]);return bEe.default.createElement("svg",vEe({viewBox:"0 0 "+iV+" "+iV,style:vEe({fill:n,width:r,height:a},s)},c),bEe.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},AAo=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.first,l=e.last,s=e.active,c=Zi({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:p4e(n),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:a,last:l,active:s,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return xe.createElement(iT,{color:n,style:c.color,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},xe.createElement("div",{style:c.check},xe.createElement(yAo,null)))},wAo=function(e){var n=e.onClick,o=e.onSwatchHover,r=e.group,i=e.active,a=Zi({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return xe.createElement("div",{style:a.group},aT(r,function(l,s){return xe.createElement(AAo,{key:l,color:l,active:l.toLowerCase()===i,first:s===0,last:s===r.length-1,onClick:n,onSwatchHover:o})}))},R4e=function(e){var n=e.width,o=e.height,r=e.onChange,i=e.onSwatchHover,a=e.colors,l=e.hex,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=Zi(G1({default:{picker:{width:n,height:o},overflow:{height:o,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),p=function(y,w){return r({hex:y,source:"hex"},w)};return xe.createElement("div",{style:f.picker,className:"swatches-picker "+d},xe.createElement(Aj,null,xe.createElement("div",{style:f.overflow},xe.createElement("div",{style:f.body},aT(a,function(m){return xe.createElement(wAo,{key:m.toString(),group:m,active:l,onClick:p,onSwatchHover:i})}),xe.createElement("div",{style:f.clear})))))};R4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),height:Ao.oneOfType([Ao.string,Ao.number]),colors:Ao.arrayOf(Ao.arrayOf(Ao.string)),styles:Ao.object};R4e.defaultProps={width:320,height:240,colors:[[mC[900],mC[700],mC[500],mC[300],mC[100]],[yC[900],yC[700],yC[500],yC[300],yC[100]],[AC[900],AC[700],AC[500],AC[300],AC[100]],[wC[900],wC[700],wC[500],wC[300],wC[100]],[xC[900],xC[700],xC[500],xC[300],xC[100]],[vC[900],vC[700],vC[500],vC[300],vC[100]],[bC[900],bC[700],bC[500],bC[300],bC[100]],[SC[900],SC[700],SC[500],SC[300],SC[100]],[TC[900],TC[700],TC[500],TC[300],TC[100]],["#194D33",dk[700],dk[500],dk[300],dk[100]],[PC[900],PC[700],PC[500],PC[300],PC[100]],[CC[900],CC[700],CC[500],CC[300],CC[100]],[RC[900],RC[700],RC[500],RC[300],RC[100]],[HC[900],HC[700],HC[500],HC[300],HC[100]],[MC[900],MC[700],MC[500],MC[300],MC[100]],[IC[900],IC[700],IC[500],IC[300],IC[100]],[zC[900],zC[700],zC[500],zC[300],zC[100]],[DC[900],DC[700],DC[500],DC[300],DC[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};X1(R4e);var H4e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.hex,i=e.colors,a=e.width,l=e.triangle,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=Zi(G1({default:{card:{width:a,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":l==="hide","top-left-triangle":l==="top-left","top-right-triangle":l==="top-right"}),p=function(y,w){O7(y)&&n({hex:y,source:"hex"},w)};return xe.createElement("div",{style:f.card,className:"twitter-picker "+d},xe.createElement("div",{style:f.triangleShadow}),xe.createElement("div",{style:f.triangle}),xe.createElement("div",{style:f.body},aT(i,function(m,y){return xe.createElement(iT,{key:y,color:m,hex:m,style:f.swatch,onClick:p,onHover:o,focusStyle:{boxShadow:"0 0 4px "+m}})}),xe.createElement("div",{style:f.hash},"#"),xe.createElement(hl,{label:null,style:{input:f.input},value:r.replace("#",""),onChange:p}),xe.createElement("div",{style:f.clear})))};H4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),triangle:Ao.oneOf(["hide","top-left","top-right"]),colors:Ao.arrayOf(Ao.string),styles:Ao.object};H4e.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};X1(H4e);var M4e=function(e){var n=Zi({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return xe.createElement("div",{style:n.picker})};M4e.propTypes={hsl:Ao.shape({h:Ao.number,s:Ao.number,l:Ao.number,a:Ao.number})};M4e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var I4e=function(e){var n=Zi({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return xe.createElement("div",{style:n.picker})};I4e.propTypes={hsl:Ao.shape({h:Ao.number,s:Ao.number,l:Ao.number,a:Ao.number})};I4e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var xAo=function(e){var n=e.onChange,o=e.rgb,r=e.hsl,i=e.hex,a=e.hsv,l=function(p,m){if(p.hex)O7(p.hex)&&n({hex:p.hex,source:"hex"},m);else if(p.rgb){var y=p.rgb.split(",");kce(p.rgb,"rgb")&&n({r:y[0],g:y[1],b:y[2],a:1,source:"rgb"},m)}else if(p.hsv){var w=p.hsv.split(",");kce(p.hsv,"hsv")&&(w[2]=w[2].replace("%",""),w[1]=w[1].replace("%",""),w[0]=w[0].replace("°",""),w[1]==1?w[1]=.01:w[2]==1&&(w[2]=.01),n({h:Number(w[0]),s:Number(w[1]),v:Number(w[2]),source:"hsv"},m))}else if(p.hsl){var x=p.hsl.split(",");kce(p.hsl,"hsl")&&(x[2]=x[2].replace("%",""),x[1]=x[1].replace("%",""),x[0]=x[0].replace("°",""),d[1]==1?d[1]=.01:d[2]==1&&(d[2]=.01),n({h:Number(x[0]),s:Number(x[1]),v:Number(x[2]),source:"hsl"},m))}},s=Zi({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=o.r+", "+o.g+", "+o.b,u=Math.round(r.h)+"°, "+Math.round(r.s*100)+"%, "+Math.round(r.l*100)+"%",d=Math.round(a.h)+"°, "+Math.round(a.s*100)+"%, "+Math.round(a.v*100)+"%";return xe.createElement("div",{style:s.wrap,className:"flexbox-fix"},xe.createElement("div",{style:s.fields},xe.createElement("div",{style:s.double},xe.createElement(hl,{style:{input:s.input,label:s.label},label:"hex",value:i,onChange:l})),xe.createElement("div",{style:s.column},xe.createElement("div",{style:s.single},xe.createElement(hl,{style:{input:s.input2,label:s.label2},label:"rgb",value:c,onChange:l})),xe.createElement("div",{style:s.single},xe.createElement(hl,{style:{input:s.input2,label:s.label2},label:"hsv",value:d,onChange:l})),xe.createElement("div",{style:s.single},xe.createElement(hl,{style:{input:s.input2,label:s.label2},label:"hsl",value:u,onChange:l})))))},z4e=function(e){var n=e.width,o=e.onChange,r=e.rgb,i=e.hsl,a=e.hsv,l=e.hex,s=e.header,c=e.styles,u=c===void 0?{}:c,d=e.className,f=d===void 0?"":d,p=Zi(G1({default:{picker:{width:n,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+r.r+", "+r.g+", "+r.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},u));return xe.createElement("div",{style:p.picker,className:"google-picker "+f},xe.createElement("div",{style:p.head},s),xe.createElement("div",{style:p.swatch}),xe.createElement("div",{style:p.saturation},xe.createElement(Lne,{hsl:i,hsv:a,pointer:M4e,onChange:o})),xe.createElement("div",{style:p.body},xe.createElement("div",{style:p.controls,className:"flexbox-fix"},xe.createElement("div",{style:p.hue},xe.createElement(jI,{style:p.Hue,hsl:i,radius:"4px",pointer:I4e,onChange:o}))),xe.createElement(xAo,{rgb:r,hsl:i,hex:l,hsv:a,onChange:o})))};z4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),styles:Ao.object,header:Ao.string};z4e.defaultProps={width:652,styles:{},header:"Color picker"};X1(z4e);const vAo=({setDialogVisible:t})=>{const e=H(pn),n=H(f5e),o=H(Jn),r=H(h5e),i=H(Fn),a=H(ac),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState((s==null?void 0:s.color)??"#808080"),d=Kt(),f=x=>{switch(a){case ie.AllSelectedObjectsOfThisType:{for(const C of H.getState().elements)if(C.type===z.Foundation&&!C.locked&&H.getState().selectedElementIdSet.has(C.id)&&x!==C.color)return!0;break}case ie.AllObjectsOfThisType:for(const C of H.getState().elements)if(C.type===z.Foundation&&!C.locked&&x!==C.color)return!0;break;default:if(x!==(s==null?void 0:s.color))return!0}return!1},p=(x,C)=>{H.getState().set(P=>{for(const A of P.elements)if(A.type===z.Foundation&&x.has(A.id))if(C!==void 0)A.color=C;else{const S=x.get(A.id);S!==void 0&&(A.color=S)}})},m=x=>{if(s&&f(x)){switch(a){case ie.AllSelectedObjectsOfThisType:{const C=new Map;for(const A of H.getState().elements)A.type===z.Foundation&&H.getState().selectedElementIdSet.has(A.id)&&C.set(A.id,A.color??"#808080");const P={name:"Set Color for Selected Foundations",timestamp:Date.now(),oldValues:C,newValue:x,undo:()=>{p(P.oldValues)},redo:()=>{p(P.oldValues,P.newValue)}};i(P),p(C,x),l(H.getState().applyCount+1);break}case ie.AllObjectsOfThisType:{const C=new Map;for(const A of H.getState().elements)A.type===z.Foundation&&C.set(A.id,A.color??"#808080");const P={name:"Set Color for All Foundations",timestamp:Date.now(),oldValues:C,newValue:x,undo:()=>{for(const[A,S]of P.oldValues.entries())n(A,S)},redo:()=>{r(z.Foundation,P.newValue)}};i(P),r(z.Foundation,x),l(H.getState().applyCount+1);break}default:{const C=o(s.id),P=C?C.color:s.color,A={name:"Set Color of Selected Foundation",timestamp:Date.now(),oldValue:P,newValue:x,changedElementId:s.id,changedElementType:s.type,undo:()=>{n(A.changedElementId,A.oldValue)},redo:()=>{n(A.changedElementId,A.newValue)}};i(A),n(s.id,x),l(H.getState().applyCount+1);break}}e(C=>{C.actionState.foundationColor=x})}},y=()=>{m(c)},w=()=>{t(!1)};return h.jsx(ro,{width:600,title:B.t("word.Color",d),onApply:y,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:c,onChangeComplete:x=>{u(x.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:x=>H.getState().setFoundationActionScope(x.target.value),value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},bAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(fXe),r=H(Z3),i=H(YN),a=H(M7),l=H(RS),s=H(Q3),c=H(Fn),u=H(ac),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Foundation),[w,x]=g.useState((y==null?void 0:y.lx)??.1),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=ae=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const Z of e)if(Z.type===z.Foundation&&H.getState().selectedElementIdSet.has(Z.id)){const ne=Z,te=l(ne.id);if(te.length>0&&!ye.doesNewSizeContainAllChildren(ne,te,ae,ne.ly))return!1}break}case ie.AllObjectsOfThisType:{for(const Z of e)if(Z.type===z.Foundation){const ne=Z,te=l(ne.id);if(te.length>0&&!ye.doesNewSizeContainAllChildren(ne,te,ae,ne.ly))return!1}break}default:{const Z=l(y.id);if(Z.length>0)return ye.doesNewSizeContainAllChildren(y,Z,ae,y.ly);break}}return!0}},U=ae=>!N(ae),W=ae=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const Z of e)if(Z.type===z.Foundation&&!Z.locked&&H.getState().selectedElementIdSet.has(Z.id)&&Math.abs(Z.lx-ae)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const Z of e)if(Z.type===z.Foundation&&!Z.locked&&Math.abs(Z.lx-ae)>Ht)return!0;break;default:if(Math.abs((y==null?void 0:y.lx)-ae)>Ht)return!0}return!1}},F=(ae,Z)=>{if(ae==null)return null;for(const ne of ae.children)if(ne.name.includes(`${Z}`))return ne;return null},E=(ae,Z,ne)=>{var te,$;if(ae){for(const le of ae.children)if(le.name.includes(`${ne.id}`)){($=(te=jn.getState().contentRef)==null?void 0:te.current)==null||$.add(le);break}d(le=>{for(const de of le.elements)if(de.id===ne.id){de.parentId=rr;const he=new _t(de.cx,de.cy).rotateAround(ui,Z.rotation[2]).add(new _t(Z.cx,Z.cy));de.cx=he.x,de.cy=he.y,de.cz=0,S.current.set(de.id,new ue(he.x,he.y,0)),P.current.set(de.id,rr);break}})}},L=(ae,Z)=>{const ne=l(ae.id),te=ae.rotation[2];if(v.current.clear(),R.current.clear(),ne.length>0)for(const $ of ne)switch($.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const le=new _t($.cx*ae.lx,$.cy*ae.ly).rotateAround(ui,te);v.current.set($.id,le),A.current.set($.id,new ue($.cx,$.cy));break}case z.Polygon:{const le=$,de=[];for(const he of le.vertices)de.push(new _t(he.x*ae.lx,he.y*ae.ly).rotateAround(ui,te));R.current.set($.id,de),b.current.set($.id,le.vertices.map(he=>({...he})));break}case z.Human:case z.Tree:{A.current.set($.id,new ue($.cx,$.cy,$.cz));break}}if(r(ae.id,Z),ne.length>0)for(const $ of ne)switch($.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const le=v.current.get($.id);if(le){const he=new _t(le.x,le.y).rotateAround(ui,-te).x/Z;o($.id,he),S.current.set($.id,new ue(he,$.cy))}break}case z.Polygon:{const le=R.current.get($.id);if(le){const de=[];for(const he of le){const me=he.rotateAround(ui,-te),ce=me.x/Z,Pe=me.y/ae.ly;de.push({x:ce,y:Pe})}a($.id,de),T.current.set($.id,de.map(he=>({...he})))}break}case z.Human:case z.Tree:{if(S.current.set($.id,new ue($.cx,$.cy,$.cz)),C.current.set($.id,ae.id),Math.abs($.cz-ae.lz/2)0){const le=jn.getState().contentRef,de=F(le==null?void 0:le.current,ae.id);E(de,ae,$)}}else if(Math.abs(Math.abs($.cx)-ae.lx/2)0?Z:-Z)/2;o($.id,le),S.current.set($.id,new ue(le,$.cy,$.cz))}break}}},j=(ae,Z,ne)=>{if(!ae||!Z)return;const te=jn.getState().contentRef,$=F(te==null?void 0:te.current,Z),le=F(Z===rr?te==null?void 0:te.current:$,ne);if(le&&(te!=null&&te.current)){if(ae===rr)te.current.add(le);else{const de=F(te.current,ae);de==null||de.add(le)}Ip()}},Y=(ae,Z)=>{ae&&d(ne=>{for(const te of ne.elements)if(te.id===Z){te.parentId=ae;break}})},O=(ae,Z)=>{H.getState().set(ne=>{for(const te of ne.elements)if(ae.has(te.id))if(Z!==void 0)te.lx=Z;else{const $=ae.get(te.id);$!==void 0&&(te.lx=$)}})},_=ae=>{if(!y||!W(ae))return;const Z=n(y.id),ne=Z?Z.lx:y.lx;if(D.current=void 0,M.current=U(ae),M.current)D.current=ae,x(ne);else switch(A.current.clear(),S.current.clear(),b.current.clear(),T.current.clear(),u){case ie.AllSelectedObjectsOfThisType:{const te=new Map;for(const le of e)le.type===z.Foundation&&H.getState().selectedElementIdSet.has(le.id)&&te.set(le.id,le.lx);for(const le of e)le.type===z.Foundation&&H.getState().selectedElementIdSet.has(le.id)&&L(le,ae);const $={name:"Set Length for Selected Foundations",timestamp:Date.now(),oldSizes:te,newSize:ae,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;if(O($.oldSizes),$.oldChildrenPositionsMap&&$.oldChildrenPositionsMap.size>0)for(const[he,me]of $.oldChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(ce,Pe,he),Y(ce,he))}if($.oldChildrenVerticesMap&&$.oldChildrenVerticesMap.size>0)for(const[he,me]of $.oldChildrenVerticesMap.entries())a(he,me)},redo:()=>{var le,de;if(O($.oldSizes,$.newSize),$.newChildrenPositionsMap&&$.newChildrenPositionsMap.size>0)for(const[he,me]of $.newChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(Pe,ce,he),Y(Pe,he))}if($.newChildrenVerticesMap&&$.newChildrenVerticesMap.size>0)for(const[he,me]of $.newChildrenVerticesMap.entries())a(he,me)}};c($),p(f+1);break}case ie.AllObjectsOfThisType:{const te=new Map;for(const le of e)le.type===z.Foundation&&te.set(le.id,le.lx);for(const le of e)le.type===z.Foundation&&L(le,ae);const $={name:"Set Length for All Foundations",timestamp:Date.now(),oldSizes:te,newSize:ae,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;for(const[he,me]of $.oldSizes.entries())r(he,me);if($.oldChildrenPositionsMap&&$.oldChildrenPositionsMap.size>0)for(const[he,me]of $.oldChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(ce,Pe,he),Y(ce,he))}if($.oldChildrenVerticesMap&&$.oldChildrenVerticesMap.size>0)for(const[he,me]of $.oldChildrenVerticesMap.entries())a(he,me)},redo:()=>{var le,de;if(i(z.Foundation,$.newSize),$.newChildrenPositionsMap&&$.newChildrenPositionsMap.size>0)for(const[he,me]of $.newChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(Pe,ce,he),Y(Pe,he))}if($.newChildrenVerticesMap&&$.newChildrenVerticesMap.size>0)for(const[he,me]of $.newChildrenVerticesMap.entries())a(he,me)}};c($),p(f+1);break}default:{L(y,ae);const te={name:"Set Foundation Length",timestamp:Date.now(),oldSize:ne,newSize:ae,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var $,le;if(r(y.id,te.oldSize),te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[de,he]of te.oldChildrenPositionsMap.entries()){s(de,he.x,he.y,he.z);const me=($=te.oldChildrenParentIdMap)==null?void 0:$.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(me,ce,de),Y(me,de))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[de,he]of te.oldChildrenVerticesMap.entries())a(de,he)},redo:()=>{var $,le;if(r(y.id,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[de,he]of te.newChildrenPositionsMap.entries()){s(de,he.x,he.y,he.z);const me=($=te.oldChildrenParentIdMap)==null?void 0:$.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(ce,me,de),Y(ce,de))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[de,he]of te.newChildrenVerticesMap.entries())a(de,he)}};c(te),p(f+1);break}}},G=()=>{t(!1)},Q=()=>{G(),m()},oe=()=>{_(w),M.current||(t(!1),p(0))},ee=()=>{_(w)},q=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",k),rejectedMessage:q,onApply:ee,onClose:G,onClickCancel:Q,onClickOk:oe,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:w,onChange:ae=>{ae!==null&&x(ae)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 1000] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:ae=>H.getState().setFoundationActionScope(ae.target.value),value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",k)})]})})})]})})},SAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(Q3),r=H(hXe),i=H(H7),a=H(ON),l=H(M7),s=H(RS),c=H(Fn),u=H(ac),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Foundation),[w,x]=g.useState((y==null?void 0:y.ly)??.1),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=q=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const ae of e)if(ae.type===z.Foundation&&H.getState().selectedElementIdSet.has(ae.id)){const Z=ae,ne=s(Z.id);if(ne.length>0&&!ye.doesNewSizeContainAllChildren(Z,ne,Z.lx,q))return!1}break}case ie.AllObjectsOfThisType:{for(const ae of e)if(ae.type===z.Foundation){const Z=ae,ne=s(Z.id);if(ne.length>0&&!ye.doesNewSizeContainAllChildren(Z,ne,Z.lx,q))return!1}break}default:{const ae=s(y.id);if(ae.length>0)return ye.doesNewSizeContainAllChildren(y,ae,y.lx,q);break}}return!0}},U=q=>!N(q),W=q=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const ae of e)if(ae.type===z.Foundation&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.ly-q)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const ae of e)if(ae.type===z.Foundation&&!ae.locked&&Math.abs(ae.ly-q)>Ht)return!0;break;default:if(Math.abs((y==null?void 0:y.ly)-q)>Ht)return!0}return!1}},F=(q,ae)=>{if(q==null)return null;for(const Z of q.children)if(Z.name.includes(`${ae}`))return Z;return null},E=(q,ae,Z)=>{var ne,te;if(q){for(const $ of q.children)if($.name.includes(`${Z.id}`)){(te=(ne=jn.getState().contentRef)==null?void 0:ne.current)==null||te.add($);break}d($=>{for(const le of $.elements)if(le.id===Z.id){le.parentId=rr;const de=new _t(le.cx,le.cy).rotateAround(ui,ae.rotation[2]).add(new _t(ae.cx,ae.cy));le.cx=de.x,le.cy=de.y,le.cz=0,S.current.set(le.id,new ue(de.x,de.y,0)),P.current.set(le.id,rr);break}})}},L=(q,ae)=>{const Z=s(q.id),ne=q.rotation[2];if(v.current.clear(),R.current.clear(),Z.length>0)for(const te of Z)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const $=new _t(te.cx*q.lx,te.cy*q.ly).rotateAround(ui,ne);v.current.set(te.id,$),A.current.set(te.id,new ue(te.cx,te.cy));break}case z.Polygon:{const $=te,le=[];for(const de of $.vertices)le.push(new _t(de.x*q.lx,de.y*q.ly).rotateAround(ui,ne));R.current.set(te.id,le),b.current.set(te.id,$.vertices.map(de=>({...de})));break}case z.Human:case z.Tree:{A.current.set(te.id,new ue(te.cx,te.cy,te.cz));break}}if(i(q.id,ae),Z.length>0)for(const te of Z)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const $=v.current.get(te.id);if($){const de=new _t($.x,$.y).rotateAround(ui,-ne).y/ae;r(te.id,de),S.current.set(te.id,new ue(te.cx,de))}break}case z.Polygon:{const $=R.current.get(te.id);if($){const le=[];for(const de of $){const he=de.rotateAround(ui,-ne),me=he.x/q.lx,ce=he.y/ae;le.push({x:me,y:ce})}l(te.id,le),T.current.set(te.id,le.map(de=>({...de})))}break}case z.Human:case z.Tree:{if(S.current.set(te.id,new ue(te.cx,te.cy,te.cz)),C.current.set(te.id,q.id),Math.abs(te.cz-q.lz/2)0){const $=jn.getState().contentRef,le=F($==null?void 0:$.current,q.id);E(le,q,te)}}else if(Math.abs(Math.abs(te.cy)-q.ly/2)0?ae:-ae)/2;r(te.id,$),S.current.set(te.id,new ue(te.cz,$,te.cz))}break}}},j=(q,ae,Z)=>{if(!q||!ae)return;const ne=jn.getState().contentRef,te=F(ne==null?void 0:ne.current,ae),$=F(ae===rr?ne==null?void 0:ne.current:te,Z);if($&&(ne!=null&&ne.current)){if(q===rr)ne.current.add($);else{const le=F(ne.current,q);le==null||le.add($)}Ip()}},Y=(q,ae)=>{q&&d(Z=>{for(const ne of Z.elements)if(ne.id===ae){ne.parentId=q;break}})},O=q=>{if(!y||!W(q))return;const ae=n(y.id),Z=ae?ae.ly:y.ly;if(D.current=void 0,M.current=U(q),M.current)D.current=q,x(Z);else switch(A.current.clear(),S.current.clear(),b.current.clear(),T.current.clear(),u){case ie.AllSelectedObjectsOfThisType:{const ne=new Map;for(const $ of e)$.type===z.Foundation&&H.getState().selectedElementIdSet.has($.id)&&ne.set($.id,$.ly);for(const $ of e)$.type===z.Foundation&&H.getState().selectedElementIdSet.has($.id)&&L($,q);const te={name:"Set Width for Selected Foundations",timestamp:Date.now(),oldSizes:ne,newSize:q,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var $,le;for(const[de,he]of te.oldSizes.entries())i(de,he);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[de,he]of te.oldChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=($=te.oldChildrenParentIdMap)==null?void 0:$.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(me,ce,de),Y(me,de))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[de,he]of te.oldChildrenVerticesMap.entries())l(de,he)},redo:()=>{var $,le;for(const[de,he]of te.oldSizes.entries())i(de,te.newSize);if(te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[de,he]of te.newChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=($=te.oldChildrenParentIdMap)==null?void 0:$.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(ce,me,de),Y(ce,de))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[de,he]of te.newChildrenVerticesMap.entries())l(de,he)}};c(te),p(f+1);break}case ie.AllObjectsOfThisType:{const ne=new Map;for(const $ of e)$.type===z.Foundation&&ne.set($.id,$.ly);for(const $ of e)$.type===z.Foundation&&L($,q);const te={name:"Set Width for All Foundations",timestamp:Date.now(),oldSizes:ne,newSize:q,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var $,le;for(const[de,he]of te.oldSizes.entries())i(de,he);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[de,he]of te.oldChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=($=te.oldChildrenParentIdMap)==null?void 0:$.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(me,ce,de),Y(me,de))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[de,he]of te.oldChildrenVerticesMap.entries())l(de,he)},redo:()=>{var $,le;if(a(z.Foundation,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[de,he]of te.newChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=($=te.oldChildrenParentIdMap)==null?void 0:$.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(ce,me,de),Y(ce,de))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[de,he]of te.newChildrenVerticesMap.entries())l(de,he)}};c(te),p(f+1);break}default:{L(y,q);const ne={name:"Set Foundation Width",timestamp:Date.now(),oldSize:Z,newSize:q,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var te,$;if(i(y.id,ne.oldSize),ne.oldChildrenPositionsMap&&ne.oldChildrenPositionsMap.size>0)for(const[le,de]of ne.oldChildrenPositionsMap.entries()){o(le,de.x,de.y,de.z);const he=(te=ne.oldChildrenParentIdMap)==null?void 0:te.get(le),me=($=ne.newChildrenParentIdMap)==null?void 0:$.get(le);he&&me&&he!==me&&(j(he,me,le),Y(he,le))}if(ne.oldChildrenVerticesMap&&ne.oldChildrenVerticesMap.size>0)for(const[le,de]of ne.oldChildrenVerticesMap.entries())l(le,de)},redo:()=>{var te,$;if(i(y.id,ne.newSize),ne.newChildrenPositionsMap&&ne.newChildrenPositionsMap.size>0)for(const[le,de]of ne.newChildrenPositionsMap.entries()){o(le,de.x,de.y,de.z);const he=(te=ne.oldChildrenParentIdMap)==null?void 0:te.get(le),me=($=ne.newChildrenParentIdMap)==null?void 0:$.get(le);he&&me&&he!==me&&(j(me,he,le),Y(me,le))}if(ne.newChildrenVerticesMap&&ne.newChildrenVerticesMap.size>0)for(const[le,de]of ne.newChildrenVerticesMap.entries())l(le,de)}};c(ne),p(f+1);break}}},_=()=>{t(!1)},G=()=>{_(),m()},Q=()=>{O(w),M.current||(t(!1),p(0))},oe=()=>{O(w)},ee=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Width",k),rejectedMessage:ee,onApply:oe,onClickCancel:G,onClickOk:Q,onClose:_,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:w,onChange:q=>{q!==null&&x(q)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 1000] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:q=>H.getState().setFoundationActionScope(q.target.value),value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",k)})]})})})]})})},TAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(Q3),l=H(no),s=H(qn),c=ao(z.Foundation),[u,d]=g.useState((c==null?void 0:c.lz)??.1),f=g.useRef(new Map),p=g.useRef(new Map),m=g.useRef(new Map),y=g.useRef(new Map),w=Kt(),x=(N,U)=>{e(W=>{const F=W.elements.find(E=>E.id===N);F&&(F.lz=U,F.cz=U/2)})},C=(N,U)=>{e(W=>{for(const F of W.elements)F.type===N&&!F.locked&&(F.lz=U,F.cz=U/2)})},P=N=>{if(c){switch(i){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Foundation&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.lz-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:for(const U of n)if(U.type===z.Foundation&&!U.locked&&Math.abs(U.lz-N)>Ht)return!0;break;default:if(Math.abs((c==null?void 0:c.lz)-N)>Ht)return!0}return!1}},A=(N,U)=>{if(N==null)return null;for(const W of N.children)if(W.name.includes(`${U}`))return W;return null},S=(N,U,W)=>{var F,E;if(N){for(const j of N.children)if(j.name.includes(`${W.id}`)){(E=(F=jn.getState().contentRef)==null?void 0:F.current)==null||E.add(j);break}W.parentId=rr;const L=new _t(W.cx,W.cy).rotateAround(ui,-U.rotation[2]).add(new _t(U.cx,U.cy));W.cx=L.x,W.cy=L.y,W.cz=0,y.current.set(W.id,new ue(L.x,L.y,0)),p.current.set(W.id,rr)}},v=(N,U,W)=>{e(F=>{for(const E of F.elements)if(E.parentId===N.id)if(f.current.set(E.id,N.id),m.current.set(E.id,new ue(E.cx,E.cy,E.cz)),ye.isPlantOrHuman(E))if(Math.abs(E.cz-N.lz/2)U/2){const j=jn.getState().contentRef,Y=A(j==null?void 0:j.current,N.id);S(Y,N,E)}else E.cz=L,y.current.set(E.id,new ue(E.cx,E.cy,L))}else E.type===z.SolarPanel&&(E.cz=U/2,y.current.set(E.id,new ue(E.cx,E.cy,U/2)));else E.foundationId===N.id&&E.type===z.SolarPanel&&E.parentType==z.Roof&&W!==void 0&&(m.current.set(E.id,new ue(E.cx,E.cy,E.cz)),E.cz=E.cz-W/2+U/2,y.current.set(E.id,new ue(E.cx,E.cy,E.cz)))})},b=(N,U,W)=>{if(!N||!U)return;const F=jn.getState().contentRef,E=A(F==null?void 0:F.current,U),L=A(U===rr?F==null?void 0:F.current:E,W);if(L&&(F!=null&&F.current)){if(N===rr)F.current.add(L);else{const j=A(F.current,N);j==null||j.add(L)}Ip()}},T=(N,U)=>{N&&e(W=>{for(const F of W.elements)if(F.id===U){F.parentId=N;break}})},R=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)if(N.has(F.id))if(U!==void 0)F.lz=U,F.cz=U/2;else{const E=N.get(F.id);E!==void 0&&(F.lz=E,F.cz=E/2)}})},M=N=>{if(c&&P(N)){switch(i){case ie.AllSelectedObjectsOfThisType:{const U=new Map;for(const F of n)F.type===z.Foundation&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.lz);for(const F of n)F.type===z.Foundation&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&v(F,N,U.get(F.id));const W={name:"Set Height for Selected Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(m.current),newChildrenPositionsMap:new Map(y.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var F,E;if(R(W.oldValues),W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const Y=(F=W.oldChildrenParentIdMap)==null?void 0:F.get(L),O=(E=W.newChildrenParentIdMap)==null?void 0:E.get(L);Y&&O&&Y!==O&&(b(Y,O,L),T(Y,L))}},redo:()=>{var E,L;const F=W.newValue;if(R(W.oldValues,F),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,Y]of W.newChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=W.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(_,O,j),T(_,j))}}};r(W),R(U,N),s(l+1);break}case ie.AllObjectsOfThisType:{const U=new Map;for(const F of n)F.type===z.Foundation&&U.set(F.id,F.lz);for(const F of n)F.type===z.Foundation&&v(F,N,U.get(F.id));const W={name:"Set Height for All Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(m.current),newChildrenPositionsMap:new Map(y.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var F,E;for(const[L,j]of W.oldValues.entries())x(L,j);if(W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const Y=(F=W.oldChildrenParentIdMap)==null?void 0:F.get(L),O=(E=W.newChildrenParentIdMap)==null?void 0:E.get(L);Y&&O&&Y!==O&&(b(Y,O,L),T(Y,L))}},redo:()=>{var E,L;const F=W.newValue;if(C(z.Foundation,F),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,Y]of W.newChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=W.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(_,O,j),T(_,j))}}};r(W),C(z.Foundation,N),s(l+1);break}default:{const U=o(c.id),W=U?U.lz:c.lz;v(c,N,W),x(c.id,N);const F={name:"Set Foundation Height",timestamp:Date.now(),oldValue:W,newValue:N,oldChildrenPositionsMap:new Map(m.current),newChildrenPositionsMap:new Map(y.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),changedElementId:c.id,changedElementType:c.type,undo:()=>{var E,L;if(x(F.changedElementId,F.oldValue),F.oldChildrenPositionsMap&&F.oldChildrenPositionsMap.size>0)for(const[j,Y]of F.oldChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=F.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=F.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(O,_,j),T(O,j))}},redo:()=>{var E,L;if(x(F.changedElementId,F.newValue),F.newChildrenPositionsMap&&F.newChildrenPositionsMap.size>0)for(const[j,Y]of F.newChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=F.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=F.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(_,O,j),T(_,j))}}};r(F),s(l+1);break}}e(U=>{U.actionState.foundationHeight=N})}},D=()=>{t(!1)},k=()=>{M(u)};return h.jsx(ro,{width:550,title:B.t("word.Height",w),onApply:k,onClose:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:10,style:{width:120},step:.1,precision:2,value:u,onChange:N=>{N!==null&&d(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",w),": [0.1, 10] ",B.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:N=>H.getState().setFoundationActionScope(N.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",w)})]})})})]})})},PAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(mQ),r=H(LPt),i=H(Fn),a=H(ac),l=H(no),s=H(qn),c=ao(z.Foundation),[u,d]=g.useState(c?-(c==null?void 0:c.rotation[2]):0),f=Kt(),p=C=>{if(c){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const P of e)if(P.type===z.Foundation&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(-P.rotation[2]-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:for(const P of e)if(P.type===z.Foundation&&!P.locked&&Math.abs(-P.rotation[2]-C)>Ht)return!0;break;default:if(Math.abs(-(c==null?void 0:c.rotation[2])-C)>Ht)return!0}return!1}},m=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(C.has(S.id))if(P!==void 0)S.rotation[2]=P;else{const v=C.get(S.id);v!==void 0&&(S.rotation[2]=-v)}})},y=C=>{if(c&&p(C))switch(a){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Foundation&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,-S.rotation[2]);const A={name:"Set Azimuth for All Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{m(A.oldValues)},redo:()=>{m(A.oldValues,-A.newValue)}};i(A),m(P,-C),s(l+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Foundation&&P.set(S.id,-S.rotation[2]);const A={name:"Set Azimuth for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[S,v]of A.oldValues.entries())o(S,0,0,-v)},redo:()=>{r(z.Foundation,0,0,-A.newValue)}};i(A),r(z.Foundation,0,0,-C),s(l+1);break}default:{const P=n(c.id),A=P?-P.rotation[2]:-c.rotation[2],S={name:"Set Foundation Azimuth",timestamp:Date.now(),oldValue:A,newValue:C,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(S.changedElementId,0,0,-S.oldValue)},redo:()=>{o(S.changedElementId,0,0,-S.newValue)}};i(S),o(c.id,0,0,-C),s(l+1);break}}},w=()=>{t(!1)},x=()=>{y(u)};return h.jsx(ro,{width:500,title:B.t("word.Azimuth",f),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(u).toFixed(2)),formatter:C=>`${C}°`,onChange:C=>{C!==null&&d(ye.toRadians(C))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:C=>H.getState().setFoundationActionScope(C.target.value),value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},CAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(q3),o=H(Fn),r=H(ac),i=H(WPt),a=H(no),l=H(qn),s=H(Ji),c=H(Jn),u=H(pn),d=H(F=>{if(n){for(const E of F.elements)if(E.id===n.id)return E}return null}),[f,p]=g.useState((d==null?void 0:d.rValue)??Kw),[m,y]=g.useState(ye.toRValueInUS(f)),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S=Kt();g.useEffect(()=>{d&&p((d==null?void 0:d.rValue)??Kw)},[d==null?void 0:d.rValue]);const v=F=>{switch(r){case ie.AllObjectsOfThisType:for(const E of e)if(E.type===z.Foundation&&!E.locked){const L=E;if(L.rValue===void 0||Math.abs(L.rValue-F)>Ht)return!0}break;default:if((d==null?void 0:d.rValue)===void 0||Math.abs((d==null?void 0:d.rValue)-F)>Ht)return!0}return!1},b=(F,E)=>{u(L=>{for(const j of L.elements)if(j.id===F){j.rValue=E;break}})},T=F=>{for(const[E,L]of F.entries())b(E,L)},R=(F,E)=>{for(const L of F.keys())b(L,E)},M=F=>{if(d&&v(F)){switch(r){case ie.AllObjectsOfThisType:{const E=new Map;u(j=>{for(const Y of j.elements)if(Y.type===z.Foundation&&!Y.locked){const O=Y;E.set(Y.id,O.rValue??Kw),O.rValue=F}});const L={name:"Set R-Value for All Ground Floors",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{T(L.oldValues)},redo:()=>{R(L.oldValues,L.newValue)}};o(L),l(a+1);break}default:{if(d){const L=c(d.id).rValue??d.rValue??Kw,j={name:"Set Ground Floor R-Value",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:d.id,changedElementType:d.type,undo:()=>{b(j.changedElementId,j.oldValue)},redo:()=>{b(j.changedElementId,j.newValue)}};o(j),b(d.id,F),l(a+1)}break}}u(E=>{E.actionState.groundFloorRValue=F})}},D=(F,E)=>{if(A.current){const{clientWidth:L,clientHeight:j}=window.document.documentElement,Y=A.current.getBoundingClientRect();P({left:-Y.left+E.x,right:L-(Y.right-E.x),top:-Y.top+E.y,bottom:j-((Y==null?void 0:Y.bottom)-E.y)})}},k=()=>{p((d==null?void 0:d.rValue)??Kw),t(!1)},N=()=>{k(),s()},U=()=>{M(f),t(!1),l(0)},W=()=>{M(f)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:[B.t("word.RValue",S)+" ","(",B.t("word.ThermalResistance",S),")"]}),footer:[h.jsx(oo,{onClick:W,children:B.t("word.Apply",S)},"Apply"),h.jsx(oo,{onClick:N,children:B.t("word.Cancel",S)},"Cancel"),h.jsx(oo,{type:"primary",onClick:U,children:B.t("word.OK",S)},"OK")],onCancel:k,maskClosable:!1,destroyOnClose:!1,modalRender:F=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(E,L)=>D(E,L),children:h.jsx("div",{ref:A,children:F})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:F=>Number(F).toFixed(2),onChange:F=>{F!==null&&(p(F),y(ye.toRValueInUS(F)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",S),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:m,formatter:F=>Number(F).toFixed(2),onChange:F=>{F!==null&&(y(F),p(ye.toRValueInSI(F)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",S),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:F=>i(F.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisGroundFloor",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllGroundFloors",S)})]})})})]})})})},RAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberHeight)??10),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberHeight=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberHeight=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberHeight=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberHeight===void 0||Math.abs(v.solarAbsorberPipe.absorberHeight-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberHeight===void 0||Math.abs(v.solarAbsorberPipe.absorberHeight-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberHeight)===void 0||Math.abs((c==null?void 0:c.absorberHeight)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberHeight??10)}const v={name:"Set Absorber Height for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberHeight??10)}const v={name:"Set Absorber Height for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberHeight??10:c.absorberHeight??10;p(s.id,A);const b={name:"Set Absorber Height on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarAbsorberPipeMenu.AbsorberHeight",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:50,style:{width:120},step:.5,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [1, 50] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},HAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.apertureWidth)??.6),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.apertureWidth=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.apertureWidth=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.apertureWidth=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.apertureWidth===void 0||Math.abs(v.solarAbsorberPipe.apertureWidth-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.apertureWidth===void 0||Math.abs(v.solarAbsorberPipe.apertureWidth-A)>Ht))return!0}break;default:if((c==null?void 0:c.apertureWidth)===void 0||Math.abs((c==null?void 0:c.apertureWidth)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.apertureWidth??.6)}const v={name:"Set Absorber Aperture Width for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.apertureWidth??.6)}const v={name:"Set Absorber Aperture Width for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.apertureWidth??.6:c.apertureWidth??.6;p(s.id,A);const b={name:"Set Absorber Aperture Width on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarAbsorberPipeMenu.AbsorberApertureWidth",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0.1, 2] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},MAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.poleNumber)??5),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.poleNumber=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.poleNumber=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.poleNumber=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.poleNumber===void 0||v.solarAbsorberPipe.poleNumber!==A))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.poleNumber===void 0||v.solarAbsorberPipe.poleNumber!==A))return!0}break;default:if((c==null?void 0:c.poleNumber)===void 0||(c==null?void 0:c.poleNumber)!==A)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.poleNumber??5)}const v={name:"Set Absorber Pipe Pole Number for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.poleNumber??5)}const v={name:"Set Absorber Pipe Pole Number for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.poleNumber??5:c.poleNumber??5;p(s.id,A);const b={name:"Set Absorber Pipe Pole Number on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:1,max:100,style:{width:120},step:1,precision:0,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [1, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},IAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberAbsorptance)??.95),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberAbsorptance=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberAbsorptance=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberAbsorptance=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(v.solarAbsorberPipe.absorberAbsorptance-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(v.solarAbsorberPipe.absorberAbsorptance-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberAbsorptance)===void 0||Math.abs((c==null?void 0:c.absorberAbsorptance)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberAbsorptance??.95)}const v={name:"Set Absorber Pipe Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberAbsorptance??.95)}const v={name:"Set Absorber Pipe Absorptance for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberAbsorptance??.95:c.absorberAbsorptance??.95;p(s.id,A);const b={name:"Set Absorber Pipe Absorptance on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarAbsorberPipeMenu.AbsorberAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},zAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberOpticalEfficiency)??.7),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberOpticalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberOpticalEfficiency=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberOpticalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberOpticalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberOpticalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberOpticalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const v={name:"Set Absorber Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const v={name:"Set Absorber Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberOpticalEfficiency??.7:c.absorberOpticalEfficiency??.7;p(s.id,A);const b={name:"Set Absorber Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},DAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberThermalEfficiency)??.3),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberThermalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberThermalEfficiency=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberThermalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberThermalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberThermalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberThermalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberThermalEfficiency??.3)}const v={name:"Set Absorber Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberThermalEfficiency??.3)}const v={name:"Set Absorber Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberThermalEfficiency??.3:c.absorberThermalEfficiency??.3;p(s.id,A);const b={name:"Set Absorber Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},EAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.towerHeight)??20),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerHeight=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerHeight=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerHeight=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerHeight===void 0||Math.abs(v.solarPowerTower.towerHeight-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerHeight===void 0||Math.abs(v.solarPowerTower.towerHeight-A)>Ht))return!0}break;default:if((c==null?void 0:c.towerHeight)===void 0||Math.abs((c==null?void 0:c.towerHeight)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerHeight??20)}const v={name:"Set Tower Height for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerHeight??20)}const v={name:"Set Tower Height for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.towerHeight??20:c.towerHeight??20;p(s.id,A);const b={name:"Set Tower Height on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarPowerTowerMenu.ReceiverTowerHeight",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:10,max:500,style:{width:120},step:1,precision:1,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [10, 500] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},kAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.towerRadius)??1),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerRadius=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerRadius=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerRadius=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerRadius===void 0||Math.abs(v.solarPowerTower.towerRadius-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerRadius===void 0||Math.abs(v.solarPowerTower.towerRadius-A)>Ht))return!0}break;default:if((c==null?void 0:c.towerRadius)===void 0||Math.abs((c==null?void 0:c.towerRadius)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerRadius??1)}const v={name:"Set Tower Radius for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerRadius??1)}const v={name:"Set Tower Radius for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.towerRadius??1:c.towerRadius??1;p(s.id,A);const b={name:"Set Tower Radius on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarPowerTowerMenu.ReceiverTowerRadius",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.5,max:10,style:{width:120},step:.5,precision:1,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0.5, 10] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},FAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.receiverAbsorptance)??.95),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverAbsorptance=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverAbsorptance=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverAbsorptance=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverAbsorptance===void 0||Math.abs(v.solarPowerTower.receiverAbsorptance-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverAbsorptance===void 0||Math.abs(v.solarPowerTower.receiverAbsorptance-A)>Ht))return!0}break;default:if((c==null?void 0:c.receiverAbsorptance)===void 0||Math.abs((c==null?void 0:c.receiverAbsorptance)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverAbsorptance??.95)}const v={name:"Set Receiver Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverAbsorptance??.95)}const v={name:"Set Receiver Absorptance for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.receiverAbsorptance??.95:c.receiverAbsorptance??.95;p(s.id,A);const b={name:"Set Receiver Absorptance on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarPowerTowerMenu.ReceiverAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},LAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.receiverThermalEfficiency)??.3),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverThermalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverThermalEfficiency=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverThermalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverThermalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverThermalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.receiverThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverThermalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverThermalEfficiency??.3)}const v={name:"Set Receiver Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverThermalEfficiency??.3)}const v={name:"Set Receiver Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.receiverThermalEfficiency??.3:c.receiverThermalEfficiency??.3;p(s.id,A);const b={name:"Set Receiver Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarPowerTowerMenu.ReceiverThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},WAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.receiverOpticalEfficiency)??.7),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverOpticalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverOpticalEfficiency=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverOpticalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverOpticalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverOpticalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.receiverOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverOpticalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverOpticalEfficiency??.7)}const v={name:"Set Receiver Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverOpticalEfficiency??.7)}const v={name:"Set Receiver Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.receiverOpticalEfficiency??.7:c.receiverOpticalEfficiency??.7;p(s.id,A);const b={name:"Set Receiver Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},NAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyHeight)??Math.max((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0)),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyHeight=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyHeight=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyHeight=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyHeight===void 0||Math.abs(v.solarUpdraftTower.chimneyHeight-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyHeight===void 0||Math.abs(v.solarUpdraftTower.chimneyHeight-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyHeight===void 0||Math.abs(s.solarUpdraftTower.chimneyHeight-A)>Ht))return!0}return!1},w=A=>{var S,v;if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation&&H.getState().selectedElementIdSet.has(R.id)){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((S=M.solarUpdraftTower)==null?void 0:S.chimneyHeight)??Math.max(M.lx,M.ly))}const T={name:"Set Solar Chimney Height for Selected Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{m(T.oldValues,T.newValue)}};r(T),m(b,A),l(a+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((v=M.solarUpdraftTower)==null?void 0:v.chimneyHeight)??Math.max(M.lx,M.ly))}const T={name:"Set Solar Chimney Height for All Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};r(T),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const b=o(s.id),T=b&&b.solarUpdraftTower?b.solarUpdraftTower.chimneyHeight??Math.max(b.lx,b.ly):s.solarUpdraftTower.chimneyHeight??Math.max(s.lx,s.ly);f(s.id,A);const R={name:"Set Solar Chimney Height on Foundation",timestamp:Date.now(),oldValue:T,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [1, 1000] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},UAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyRadius)??Math.max(1,.025*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyRadius=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyRadius=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyRadius=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyRadius===void 0||Math.abs(v.solarUpdraftTower.chimneyRadius-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyRadius===void 0||Math.abs(v.solarUpdraftTower.chimneyRadius-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyRadius===void 0||Math.abs(s.solarUpdraftTower.chimneyRadius-A)>Ht))return!0}return!1},w=A=>{var S,v;if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation&&H.getState().selectedElementIdSet.has(R.id)){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((S=M.solarUpdraftTower)==null?void 0:S.chimneyRadius)??Math.max(1,.025*Math.min(M.lx,M.ly)))}const T={name:"Set Solar Chimney Radius for Selected Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{m(T.oldValues,T.newValue)}};r(T),m(b,A),l(a+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((v=M.solarUpdraftTower)==null?void 0:v.chimneyRadius)??Math.max(1,.025*Math.min(M.lx,M.ly)))}const T={name:"Set Solar Chimney Radius for All Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};r(T),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const b=o(s.id),T=b&&b.solarUpdraftTower?b.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(b.lx,b.ly)):s.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(s.lx,s.ly));f(s.id,A);const R={name:"Set Solar Chimney Radius on Foundation",timestamp:Date.now(),oldValue:T,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:10,style:{width:120},step:1,precision:1,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.1, 10] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},jAo=({setDialogVisible:t})=>{var x;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=ao(z.Foundation),[l,s]=g.useState(((x=a==null?void 0:a.solarUpdraftTower)==null?void 0:x.collectorHeight)??Math.max(3,10*((a==null?void 0:a.lz)??0))),c=Kt(),u=(C,P)=>{e(A=>{for(const S of A.elements)if(S.type===z.Foundation&&S.id===C&&!S.locked){const v=S;v.solarStructure===Nn.UpdraftTower&&(v.solarUpdraftTower||(v.solarUpdraftTower={}),v.solarUpdraftTower.collectorHeight=P);break}})},d=C=>{e(P=>{for(const A of P.elements)if(A.type===z.Foundation&&!A.locked){const S=A;S.solarStructure===Nn.UpdraftTower&&(S.solarUpdraftTower||(S.solarUpdraftTower={}),S.solarUpdraftTower.collectorHeight=C)}})},f=(C,P)=>{e(A=>{for(const S of A.elements)if(S.type===z.Foundation&&!S.locked&&C.has(S.id)){const v=S;v.solarStructure===Nn.UpdraftTower&&(v.solarUpdraftTower||(v.solarUpdraftTower={}),v.solarUpdraftTower.collectorHeight=P)}})},p=C=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)){const A=P;if(A.solarStructure===Nn.UpdraftTower&&A.solarUpdraftTower&&(A.solarUpdraftTower.collectorHeight===void 0||Math.abs(A.solarUpdraftTower.collectorHeight-C)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked){const A=P;if(A.solarStructure===Nn.UpdraftTower&&A.solarUpdraftTower&&(A.solarUpdraftTower.collectorHeight===void 0||Math.abs(A.solarUpdraftTower.collectorHeight-C)>Ht))return!0}break;default:if(a&&a.solarStructure===Nn.UpdraftTower&&a.solarUpdraftTower&&(a.solarUpdraftTower.collectorHeight===void 0||Math.abs(a.solarUpdraftTower.collectorHeight-C)>Ht))return!0}return!1},m=C=>{if(a&&p(C))switch(i){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of n)if(S.type===z.Foundation&&H.getState().selectedElementIdSet.has(S.id)){const v=S;v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&P.set(S.id,v.solarUpdraftTower.collectorHeight??Math.max(3,10*v.lz))}const A={name:"Set Solar Collector Height for Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[S,v]of A.oldValues.entries())u(S,v)},redo:()=>{f(A.oldValues,A.newValue)}};r(A),f(P,C);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of n)if(S.type===z.Foundation){const v=S;v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&P.set(S.id,v.solarUpdraftTower.collectorHeight??Math.max(3,10*v.lz))}const A={name:"Set Solar Collector Height for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[S,v]of A.oldValues.entries())u(S,v)},redo:()=>{d(A.newValue)}};r(A),d(C);break}default:{if(a.solarStructure===Nn.UpdraftTower&&a.solarUpdraftTower){const P=o(a.id),A=P&&P.solarUpdraftTower?P.solarUpdraftTower.collectorHeight??Math.max(3,10*P.lz):a.solarUpdraftTower.collectorHeight??Math.max(3,10*a.lz);u(a.id,C);const S={name:"Set Solar Collector Height on Foundation",timestamp:Date.now(),oldValue:A,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{u(S.changedElementId,S.oldValue)},redo:()=>{u(S.changedElementId,S.newValue)}};r(S)}break}}},y=()=>{t(!1)},w=()=>{m(l)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",c),onApply:w,onClose:y,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:20,style:{width:120},step:1,precision:1,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 20] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:C=>H.getState().setFoundationActionScope(C.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",c)})]})})})]})})},BAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorRadius)??Math.max(10,.5*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorRadius=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorRadius=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorRadius=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorRadius===void 0||Math.abs(v.solarUpdraftTower.collectorRadius-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorRadius===void 0||Math.abs(v.solarUpdraftTower.collectorRadius-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorRadius===void 0||Math.abs(s.solarUpdraftTower.collectorRadius-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(T.lx,T.ly)))}const v={name:"Set Solar Collector Radius for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(T.lx,T.ly)))}const v={name:"Set Solar Collector Radius for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(S.lx,S.ly)):s.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(s.lx,s.ly));f(s.id,A);const b={name:"Set Solar Collector Radius on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [1, 1000] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},YAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorTransmissivity)??.9),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorTransmissivity=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorTransmissivity=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorTransmissivity=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorTransmissivity-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorTransmissivity-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorTransmissivity-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorTransmissivity??.9)}const v={name:"Set Solar Collector Transmissivity for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorTransmissivity??.9)}const v={name:"Set Solar Collector Transmissivity for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.collectorTransmissivity??.9:s.solarUpdraftTower.collectorTransmissivity??.9;f(s.id,A);const b={name:"Set Solar Collector Transmissivity on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},OAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorEmissivity)??.95),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorEmissivity=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorEmissivity=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorEmissivity=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorEmissivity-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorEmissivity-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorEmissivity-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorEmissivity??.95)}const v={name:"Set Solar Collector Emissivity for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorEmissivity??.95)}const v={name:"Set Solar Collector Emissivity for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.collectorEmissivity??.95:s.solarUpdraftTower.collectorEmissivity??.95;f(s.id,A);const b={name:"Set Solar Collector Emissivity on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},_Ao=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.dischargeCoefficient)??.65),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.dischargeCoefficient=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.dischargeCoefficient=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.dischargeCoefficient=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(v.solarUpdraftTower.dischargeCoefficient-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(v.solarUpdraftTower.dischargeCoefficient-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(s.solarUpdraftTower.dischargeCoefficient-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.dischargeCoefficient??.65)}const v={name:"Set Solar Chimney Discharge Coefficient for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.dischargeCoefficient??.65)}const v={name:"Set Solar Chimney Discharge Coefficient for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.dischargeCoefficient??.65:s.solarUpdraftTower.dischargeCoefficient??.65;f(s.id,A);const b={name:"Set Solar Chimney Discharge Coefficient on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.65,max:.7,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.65, 0.70]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},VAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.turbineEfficiency)??.3),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.turbineEfficiency=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.turbineEfficiency=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.turbineEfficiency=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(v.solarUpdraftTower.turbineEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(v.solarUpdraftTower.turbineEfficiency-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(s.solarUpdraftTower.turbineEfficiency-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.turbineEfficiency??.3)}const v={name:"Set Solar Updraft Tower Turbine Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.turbineEfficiency??.3)}const v={name:"Set Solar Updraft Tower Turbine Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.turbineEfficiency??.3:s.solarUpdraftTower.turbineEfficiency??.3;f(s.id,A);const b={name:"Set Solar Updraft Tower Turbine Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.2,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.2, 1.0]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},{Option:qP}=Ko,GAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),[i,a]=g.useState(!1),[l,s]=g.useState(!1),[c,u]=g.useState({left:0,top:0,bottom:0,right:0}),d=g.useRef(null),f=H(w4).geneticAlgorithmParams,p=g.useRef(f.selectionMethod),m=g.useRef(f.searchMethod),y=g.useRef(Math.min(f.objectiveFunctionType,Mo.YEARLY_TOTAL_OUTPUT)),w=g.useRef(f.populationSize),x=g.useRef(f.maximumGenerations),C=g.useRef(f.mutationRate),P=g.useRef(f.selectionRate??.5),A=g.useRef(f.crossoverRate??.5),S=g.useRef(f.convergenceThreshold),v=g.useRef(f.localSearchRadius),b=g.useRef(null);g.useEffect(()=>{var N;(N=b.current)==null||N.focus()},[]);const T={lng:o},R=(N,U)=>{if(d.current){const{clientWidth:W,clientHeight:F}=window.document.documentElement,E=d.current.getBoundingClientRect();u({left:-E.left+U.x,right:W-(E.right-U.x),top:-E.top+U.y,bottom:F-((E==null?void 0:E.bottom)-U.y)})}},M=()=>{e(N=>{N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=y.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=p.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=m.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=w.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=x.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=P.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=A.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=C.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=S.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=v.current})},D=()=>{r||yn(k("message.EvolutionStarted",T)),M(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=ec.GENETIC_ALGORITHM,N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Genetic Algorithm for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:k}=Jl();return h.jsx(h.Fragment,{children:h.jsxs(li,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:[k("optimizationMenu.SolarPanelTiltAngleOptimization",T)+": ",k("optimizationMenu.GeneticAlgorithmSettings",T)]}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:k("word.Cancel",T)},"Cancel"),h.jsx(oo,{type:"primary",ref:b,onClick:()=>{D(),t(!1)},children:k("word.Run",T)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Vi,{disabled:!l,bounds:c,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:d,children:N})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.Objective",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:y.current,style:{width:"100%"},value:y.current,onChange:N=>{y.current=N,a(!i)},children:[h.jsx(qP,{value:Mo.DAILY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionDailyTotalYield",T)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(qP,{value:Mo.YEARLY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionYearlyTotalYield",T)},Mo.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.GeneticAlgorithmSelectionMethod",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,a(!i)},children:[h.jsx(qP,{value:by.ROULETTE_WHEEL,children:k("optimizationMenu.RouletteWheel",T)},by.ROULETTE_WHEEL),h.jsx(qP,{value:by.TOURNAMENT,children:k("optimizationMenu.Tournament",T)},by.TOURNAMENT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.PopulationSize",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:w.current,step:1,onChange:N=>{N!==null&&(w.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MaximumGenerations",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:x.current,onChange:N=>{N!==null&&(x.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SelectionRate",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{N!==null&&(P.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.CrossoverRate",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:A.current,step:.01,onChange:N=>{N!==null&&(A.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MutationRate",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{N!==null&&(C.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.ConvergenceThreshold",T)+" [0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:S.current,step:.001,onChange:N=>{N!==null&&(S.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SearchMethod",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:m.current,style:{width:"100%"},value:m.current,onChange:N=>{m.current=Number(N),a(!i)},children:[h.jsx(qP,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:k("optimizationMenu.GlobalSearchUniformSelection",T)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(qP,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:k("optimizationMenu.LocalSearchRandomOptimization",T)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),m.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.LocalSearchRadius",T)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{N!==null&&(v.current=Number(N),a(!i))}})})]})]})})},{Option:aV}=Ko,XAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),i=H(w4).particleSwarmOptimizationParams,[a,l]=g.useState(!1),[s,c]=g.useState(!1),[u,d]=g.useState({left:0,top:0,bottom:0,right:0}),f=g.useRef(null),p=g.useRef(Math.min(i.objectiveFunctionType,Mo.YEARLY_TOTAL_OUTPUT)),m=g.useRef(i.searchMethod),y=g.useRef(i.swarmSize),w=g.useRef(i.maximumSteps),x=g.useRef(i.vmax??.01),C=g.useRef(i.inertia??.8),P=g.useRef(i.cognitiveCoefficient??.1),A=g.useRef(i.socialCoefficient??.1),S=g.useRef(i.convergenceThreshold),v=g.useRef(i.localSearchRadius),b=g.useRef(null);g.useEffect(()=>{var N;(N=b.current)==null||N.focus()},[]);const T={lng:o},R=(N,U)=>{if(f.current){const{clientWidth:W,clientHeight:F}=window.document.documentElement,E=f.current.getBoundingClientRect();d({left:-E.left+U.x,right:W-(E.right-U.x),top:-E.top+U.y,bottom:F-((E==null?void 0:E.bottom)-U.y)})}},M=()=>{e(N=>{N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=p.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=m.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=y.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=w.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=P.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=A.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=x.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=C.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=S.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=v.current})},D=()=>{r||yn(k("message.EvolutionStarted",T)),M(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=ec.PARTICLE_SWARM_OPTIMIZATION,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:k}=Jl();return h.jsx(h.Fragment,{children:h.jsxs(li,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>c(!0),onMouseOut:()=>c(!1),children:[k("optimizationMenu.SolarPanelTiltAngleOptimization",T)+": ",k("optimizationMenu.ParticleSwarmOptimizationSettings",T)]}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:k("word.Cancel",T)},"Cancel"),h.jsx(oo,{type:"primary",ref:b,onClick:()=>{D(),t(!1)},children:k("word.Run",T)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Vi,{disabled:!s,bounds:u,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:f,children:N})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.Objective",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,l(!a)},children:[h.jsx(aV,{value:Mo.DAILY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionDailyTotalYield",T)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(aV,{value:Mo.YEARLY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionYearlyTotalYield",T)},Mo.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SwarmSize",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,value:y.current,step:1,formatter:N=>Number(N).toFixed(0),onChange:N=>{y.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MaximumSteps",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:w.current,formatter:N=>Number(N).toFixed(0),onChange:N=>{w.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.CognitiveCoefficient",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{P.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SocialCoefficient",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:A.current,step:.01,onChange:N=>{A.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.InertiaWeight",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{C.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MaximumVelocity",T)+" [0.001, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:x.current,step:.001,onChange:N=>{x.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.ConvergenceThreshold",T)+" [0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:S.current,step:.001,onChange:N=>{S.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SearchMethod",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:m.current,style:{width:"100%"},value:m.current,onChange:N=>{m.current=Number(N),l(!a)},children:[h.jsx(aV,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:k("optimizationMenu.GlobalSearchUniformSelection",T)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(aV,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:k("optimizationMenu.LocalSearchRandomOptimization",T)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),m.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.LocalSearchRadius",T)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{v.current=Number(N),l(!a)}})})]})]})})},s2=({children:t,width:e="90px"})=>h.jsx("div",{style:{width:e},children:t}),JAo=({element:t})=>{const e=Sct(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!(t!=null&&t.showLabel),onChange:e,children:B.t("labelSubMenu.KeepShowingLabel",n)})})},KAo=({element:t})=>{const{labelText:e,setLabelText:n}=bct(t),o=Tct(t,e),r=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelText",r)+":"}),value:e,onChange:i=>n(i.target.value),onPressEnter:o,onBlur:o})})},$Ao=({element:t})=>{const e=Cao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelHeight",n)+":"}),min:.2,max:100,step:1,precision:1,value:t.labelHeight??.2,onChange:o=>e(o)})})},qAo=({element:t})=>{const e=Sao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelFontSize",n)+":"}),min:10,max:100,step:1,precision:0,value:t.labelFontSize??20,onChange:o=>e(o)})})},QAo=({element:t})=>{const e=Tao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelSize",n)+":"}),min:.2,max:5,step:.1,precision:1,value:t.labelSize??.2,onChange:o=>e(o)})})},ZAo=({element:t})=>{const e=Pao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelColor",n)+":"}),value:t.labelColor??"#ffffff",onChange:o=>e(o.target.value)})})},q5=t=>[{key:`${t.type}-show-label`,label:h.jsx(JAo,{element:t})},{key:`${t.type}-label-text`,label:h.jsx(KAo,{element:t})},{key:`${t.type}-label-height`,label:h.jsx($Ao,{element:t})},{key:`${t.type}-label-font-size`,label:h.jsx(qAo,{element:t})},{key:`${t.type}-label-size`,label:h.jsx(QAo,{element:t})},{key:`${t.type}-label-color`,label:h.jsx(ZAo,{element:t})}],e4o=[{key:"windowCount",objectType:z.Window},{key:"doorCount",objectType:z.Door},{key:"sensorCount",objectType:z.Sensor},{key:"outsideLightCount",objectType:z.Light},{key:"parabolicTroughCount",objectType:z.ParabolicTrough},{key:"parabolicDishCount",objectType:z.ParabolicDish},{key:"fresnelReflectorCount",objectType:z.FresnelReflector},{key:"heliostatCount",objectType:z.Heliostat},{key:"windTurbineCount",objectType:z.WindTurbine},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower}],SEe=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.Wall:{o=`${B.t("foundationMenu.RemoveAllUnlockedWalls",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllWallsOnFoundation",n)} (${e} ${B.t("foundationMenu.Walls",n)})`;break}case z.Window:{o=`${B.t("foundationMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllWindowsOnFoundation",n)} (${e} ${B.t("foundationMenu.Windows",n)})`;break}case z.Door:{o=`${B.t("foundationMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllDoorsOnFoundation",n)} (${e} ${B.t("foundationMenu.Doors",n)})`;break}case z.Sensor:{o=`${B.t("foundationMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllSensorsOnFoundation",n)} (${e} ${B.t("foundationMenu.Sensors",n)})`;break}case z.Light:{o=`${B.t("foundationMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllLightsOnFoundation",n)} (${e} ${B.t("foundationMenu.Lights",n)})`;break}case z.ParabolicTrough:{o=`${B.t("foundationMenu.RemoveAllUnlockedParabolicTroughs",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation",n)} (${e} ${B.t("foundationMenu.ParabolicTroughs",n)})`;break}case z.ParabolicDish:{o=`${B.t("foundationMenu.RemoveAllUnlockedParabolicDishes",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicDishesOnFoundation",n)} (${e} ${B.t("foundationMenu.ParabolicDishes",n)})`;break}case z.FresnelReflector:{o=`${B.t("foundationMenu.RemoveAllUnlockedFresnelReflectors",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation",n)} (${e} ${B.t("foundationMenu.FresnelReflectors",n)})`;break}case z.Heliostat:{o=`${B.t("foundationMenu.RemoveAllUnlockedHeliostats",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllHeliostatsOnFoundation",n)} (${e} ${B.t("foundationMenu.Heliostats",n)})`;break}case z.WindTurbine:{o=`${B.t("foundationMenu.RemoveAllUnlockedWindTurbines",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllWindTurbinesOnFoundation",n)} (${e} ${B.t("foundationMenu.WindTurbines",n)})`;break}case z.Polygon:{o=`${B.t("foundationMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllPolygonsOnFoundation",n)} (${e} ${B.t("foundationMenu.Polygons",n)})`;break}case z.Human:{o=`${B.t("foundationMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllHumansOnFoundation",n)} (${e} ${B.t("foundationMenu.Humans",n)})`;break}case z.Tree:{o=`${B.t("foundationMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllTreesOnFoundation",n)} (${e} ${B.t("foundationMenu.Trees",n)})`;break}case z.Flower:{o=`${B.t("foundationMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllFlowersOnFoundation",n)} (${e} ${B.t("foundationMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},t4o=(t,e,n)=>n===z.Light?t.insideLightCount+t.outsideLightCount:t[e],n4o=t=>{const e=H.getState().set,n=new Set;H.getState().elements.forEach(a=>{!a.locked&&a.type===z.Wall&&(a.parentId===t.id||a.foundationId===t.id)&&n.add(a.id)});const o=H.getState().elements.filter(a=>n.has(a.id)||n.has(a.parentId));e(a=>{a.elements=a.elements.filter(l=>!n.has(l.id)&&!n.has(l.parentId))});const r=JSON.parse(JSON.stringify(o)),i={name:"Remove All Walls on Foundation",timestamp:Date.now(),parentId:t.id,removedElements:r,undo:()=>{e(a=>{a.elements.push(...i.removedElements),a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},redo:()=>{const a=new Set;H.getState().elements.forEach(l=>{!l.locked&&l.type===z.Wall&&l.parentId===i.parentId&&a.add(l.id)}),e(l=>{l.elements=l.elements.filter(s=>!a.has(s.id)&&!a.has(s.parentId))})}};H.getState().addUndoable(i)},o4o=(t,e,n)=>{const o=[],r={lng:H.getState().language};if(e.unlockedCount>0&&o.push({key:"lock-all-offsprings",label:h.jsx(Oze,{foundation:t,lock:!0,count:e.unlockedCount})}),e.lockedCount>0&&o.push({key:"unlock-all-offsprings",label:h.jsx(Oze,{foundation:t,lock:!1,count:e.lockedCount})}),n.wallCount>0){const{itemLabel:i,modalTitle:a}=SEe(z.Wall,n.wallCount);o.push({key:"remove-all-walls-on-foundation",label:h.jsx(Tce,{foundation:t,objectType:z.Wall,modalTitle:a,onClickOk:()=>n4o(t),children:i})})}if(n.solarPanelCount>0){const i=B.t("foundationMenu.DoYouReallyWantToRemoveAllSolarPanelsOnFoundation",r)+" ("+n.solarPanelModuleCount+" "+B.t("foundationMenu.SolarPanels",r)+", "+n.solarPanelCount+" "+B.t("foundationMenu.Racks",r)+")?";o.push({key:"remove-all-solar-panels-on-foundation",label:h.jsxs(Tce,{foundation:t,objectType:z.SolarPanel,modalTitle:i,children:[B.t("foundationMenu.RemoveAllUnlockedSolarPanels",r),"  (",n.solarPanelModuleCount," ",B.t("foundationMenu.SolarPanels",r),", ",n.solarPanelCount," ",B.t("foundationMenu.Racks",r),")"]})})}return e4o.forEach(({key:i,objectType:a})=>{const l=t4o(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=SEe(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-foundation`,label:h.jsx(Tce,{foundation:t,objectType:a,modalTitle:c,children:s})})}}),o},r4o=[{time:6,heat:20,cool:20},{time:8,heat:20,cool:20},{time:18,heat:20,cool:20},{time:23,heat:20,cool:20}],AE="HH:mm",i4o=({setDialogVisible:t})=>{const e=H(Fn),n=H(qn),o=Kt(),r=ao(z.Foundation),i=r==null?void 0:r.hvacSystem,a=g.useRef(i==null?void 0:i.id),[l,s]=g.useState((i==null?void 0:i.type)??"Simple"),[c,u]=g.useState((i==null?void 0:i.temperatureThreshold)??2),[d,f]=g.useState((i==null?void 0:i.heatingSetpoint)??(i==null?void 0:i.thermostatSetpoint)??20),[p,m]=g.useState((i==null?void 0:i.coolingSetpoint)??(i==null?void 0:i.thermostatSetpoint)??20),[y,w]=g.useState((i==null?void 0:i.thermostatSetpoints)??r4o),[x,C]=g.useState(null),P=N=>{if(!r)return!1;const U=r.hvacSystem,W=N;if(U.id!==W.id||U.temperatureThreshold!==W.temperatureThreshold||U.heatingSetpoint!==W.heatingSetpoint||U.coolingSetpoint!==W.coolingSetpoint||U.type!==W.type)return!1;if(U.thermostatSetpoints&&W.thermostatSetpoints){for(let F=0;F{H.getState().set(W=>{for(const F of W.elements)if(N.has(F.id)&&F.type===z.Foundation)if(U)F.hvacSystem=U;else{const E=N.get(F.id);E&&(F.hvacSystem={...E})}})},S=N=>{const U={...N};if(N.thermostatSetpoints){const W=[];for(const F of N.thermostatSetpoints)W.push({...F});U.thermostatSetpoints=W}return U},v=N=>{if(!r)return;const U=new Map;H.getState().set(F=>{for(const E of F.elements)(E.id===r.id||a.current&&E.type===z.Foundation&&E.hvacSystem.id===a.current)&&(U.set(E.id,S(E.hvacSystem)),E.hvacSystem=N)}),n(H.getState().applyCount+1);const W={name:"Set Building HVAC System",timestamp:Date.now(),foundationID:r.id,systemID:r.hvacSystem.id,oldValues:U,newValue:N,undo(){A(W.oldValues)},redo(){A(W.oldValues,W.newValue)}};e(W)},b=N=>{const U=Math.floor(N),W=Math.round((N-U)*60);return il(`${U}:${W}`,AE)},T=(N,U,W)=>{w(Dv(F=>{W===0?F[U].time=N:W===1?F[U].heat=N:W===2&&(F[U].cool=N)}))},R=()=>{for(let N=1;NW)return C(N),!0}return!1},M=()=>{const N={heatingSetpoint:d,coolingSetpoint:p,temperatureThreshold:c,type:l,thermostatSetpoints:y};a.current&&(N.id=a.current),!(P(N)||R())&&v(N)},D=()=>{R()||(M(),k(),n(0))},k=()=>{t(!1)};return h.jsxs(ro,{width:500,title:B.t("HVACMenu.BuildingHVACSystem",o),onApply:M,onClose:k,onClickOk:D,children:[h.jsxs(Qt,{style:{padding:"4px 0"},children:[h.jsx(Ge,{span:2,style:{display:"flex",alignItems:"center"},children:h.jsxs("b",{children:[B.t("HVACMenu.ID",o),":"]})}),h.jsx(Ge,{span:8,children:h.jsx(Vl,{defaultValue:a.current,onChange:N=>{const U=N.target.value.trim();U.length===0?a.current=void 0:a.current=U}})}),h.jsx(Ge,{span:7,style:{display:"flex",alignItems:"center",justifyContent:"right"},children:h.jsx(Jt,{title:B.t("HVACMenu.ToleranceExplanation",o),style:{paddingRight:"8px"},children:h.jsx("b",{children:B.t("HVACMenu.Tolerance",o)+":"})})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:c,min:0,max:10,onChange:N=>{N!==null&&u(Number(N))}})})]}),h.jsxs(Qt,{style:{padding:"4px 0",height:"39px"},children:[h.jsx(Ge,{span:8,style:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:h.jsxs("b",{children:[B.t("HVACMenu.ThermostatType",o),":"]})}),h.jsx(Ge,{span:16,style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},children:h.jsxs(We.Group,{defaultValue:l,onChange:N=>s(N.target.value),children:[h.jsx(We,{value:"Simple",children:B.t("HVACMenu.Simple",o)}),h.jsx(We,{style:{margin:"0 0 0 48px"},value:"Programmable",children:B.t("HVACMenu.Programmable",o)})]})})]}),h.jsx(pJ,{style:{margin:"12px 0"}}),l==="Simple"?h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{children:[h.jsx(Ge,{span:11,style:{display:"flex",alignItems:"center"},children:h.jsxs("b",{children:[B.t("HVACMenu.HeatingSetpoint",o),":"]})}),h.jsx(Ge,{span:13,children:h.jsx(mn,{addonAfter:"°C",value:d,min:0,max:30,onChange:N=>{N!==null&&f(Number(N))}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:11,style:{display:"flex",alignItems:"center"},children:h.jsxs("b",{children:[B.t("HVACMenu.CoolingSetpoint",o),":"]})}),h.jsx(Ge,{span:13,children:h.jsx(mn,{addonAfter:"°C",value:p,min:0,max:30,onChange:N=>{N!==null&&m(Number(N))}})})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{style:{height:"34px"},children:[h.jsx(Ge,{span:4,children:h.jsx("b",{children:B.t("HVACMenu.Period",o)})}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx("b",{children:B.t("HVACMenu.StartTime",o)})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx("b",{children:B.t("HVACMenu.HeatingSetpoint",o)})}),h.jsx(Ge,{span:7,children:h.jsx("b",{children:B.t("HVACMenu.CoolingSetpoint",o)})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Wake",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{value:b(y[0].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,0,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[0].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,0,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[0].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,0,2)}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Day",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{status:x===1?"error":void 0,value:b(y[1].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,1,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[1].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,1,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[1].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,1,2)}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Evening",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{status:x===2?"error":void 0,value:b(y[2].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,2,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[2].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,2,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[2].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,2,2)}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Sleep",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{status:x===3?"error":void 0,value:b(y[3].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,3,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[3].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,3,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[3].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,3,2)}})})]})]}),h.jsx("br",{}),x!==null&&h.jsx("div",{style:{color:"red"},children:B.t("HVACMenu.TimeErrorMessage",o)})]})},a4o=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.Light||e.type===z.SolarPanel||e.type===z.SolarWaterHeater||e.type===z.ParabolicDish||e.type===z.Heliostat||e.type===z.FresnelReflector||e.type===z.ParabolicTrough||e.type===z.WindTurbine||e.type===z.BatteryStorage||e.type===z.Wall)return!0}return!1},l4o=t=>{const e=[];if(t.type!==z.Foundation)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked,i=!n.notBuilding&&ye.getBuildingCompletionStatus(n,H.getState().elements)===$c.COMPLETE,a=H.getState().countAllOffspringsByTypeAtOnce(n.id,!0),l=H.getState().countAllOffspringsByTypeAtOnce(n.id,!1);return a4o()&&e.push({key:"foundation-paste",label:h.jsx(yI,{})}),e.push({key:"foundation-copy",label:h.jsx(ad,{})}),r&&e.push({key:"foundation-cut",label:h.jsx(ld,{})}),e.push({key:"foundation-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"foundation-group-master",label:h.jsx(nit,{groupableElement:n})}),e.push({key:"building",label:h.jsx(xao,{foundation:n})}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-foundation",label:h.jsx(ln,{children:B.t("word.Elements",o)}),children:o4o(n,a,l)}),r&&((!n.textureType||n.textureType===Xi.NoTexture)&&e.push({key:"foundation-color",label:h.jsxs(Zn,{Dialog:vAo,children:[B.t("word.Color",o)," ..."]})}),e.push({key:"foundation-texture",label:h.jsxs(Zn,{Dialog:Rao,children:[B.t("word.Texture",o)," ..."]})}),e.push({key:"foundation-length",label:h.jsxs(Zn,{Dialog:bAo,children:[B.t("word.Length",o)," ..."]})}),e.push({key:"foundation-width",label:h.jsxs(Zn,{Dialog:SAo,children:[B.t("word.Width",o)," ..."]})}),e.push({key:"foundation-height",label:h.jsxs(Zn,{Dialog:TAo,children:[B.t("word.Height",o)," ..."]})}),e.push({key:"foundation-azimuth",label:h.jsxs(Zn,{Dialog:PAo,children:[B.t("word.Azimuth",o)," ..."]})}),i&&e.push({key:"ground-floor-r-value",label:h.jsxs(Zn,{Dialog:CAo,children:[B.t("foundationMenu.GroundFloorRValue",o)," ..."]})})),e.push({key:"add-polygon-on-foundation",label:h.jsx(vao,{foundation:n})}),!n.notBuilding&&a.wallCount>0&&e.push({key:"building-programmable-hvac",label:h.jsxs(Zn,{Dialog:i4o,children:[B.t("HVACMenu.BuildingHVACSystem",o)," ..."]})}),r&&(e.push({key:"select-solar-structure",label:h.jsx(ln,{children:B.t("foundationMenu.SolarStructure",o)}),children:[{key:"select-solar-structure-submenu",label:h.jsx(bao,{foundation:n}),style:{backgroundColor:"white"}}]}),n.solarStructure===Nn.FocusPipe&&e.push({key:"solar-absorber-pipe-physical-properties",label:h.jsx(ln,{children:B.t("solarAbsorberPipeMenu.AbsorberPipePhysicalProperties",o)}),children:[{key:"solar-absorber-pipe-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:RAo,children:[B.t("solarAbsorberPipeMenu.AbsorberHeight",o)," ..."]})},{key:"solar-absorber-pipe-aperture-width",label:h.jsxs(Zn,{noPadding:!0,Dialog:HAo,children:[B.t("solarAbsorberPipeMenu.AbsorberApertureWidth",o)," ..."]})},{key:"foundation-solar-receiver-pipe-pole-number",label:h.jsxs(Zn,{noPadding:!0,Dialog:MAo,children:[B.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",o)," ..."]})},{key:"solar-absorber-pipe-absorptance",label:h.jsxs(Zn,{noPadding:!0,Dialog:IAo,children:[B.t("solarAbsorberPipeMenu.AbsorberAbsorptance",o)," ..."]})},{key:"solar-absorber-optical-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:zAo,children:[B.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",o)," ..."]})},{key:"solar-absorber-thermal-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:DAo,children:[B.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Nn.FocusTower&&e.push({key:"solar-power-tower-physical-properties",label:h.jsx(ln,{children:B.t("solarPowerTowerMenu.ReceiverTowerPhysicalProperties",o)}),children:[{key:"solar-power-tower-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:EAo,children:[B.t("solarPowerTowerMenu.ReceiverTowerHeight",o)," ..."]})},{key:"solar-power-tower-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:kAo,children:[B.t("solarPowerTowerMenu.ReceiverTowerRadius",o)," ..."]})},{key:"solar-power-tower-receiver-absorptance",label:h.jsxs(Zn,{noPadding:!0,Dialog:FAo,children:[B.t("solarPowerTowerMenu.ReceiverAbsorptance",o)," ..."]})},{key:"solar-power-tower-receiver-optical-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:WAo,children:[B.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",o)," ..."]})},{key:"solar-power-tower-receiver-thermal-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:LAo,children:[B.t("solarPowerTowerMenu.ReceiverThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Nn.UpdraftTower&&e.push({key:"solar-updraft-tower-physical-properties",label:h.jsx(ln,{children:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerPhysicalProperties",o)}),children:[{key:"solar-updraft-tower-chimney-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:NAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",o)," ..."]})},{key:"solar-updraft-tower-chimney-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:UAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:jAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",o)," ..."]})},{key:"solar-updraft-tower-collector-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:BAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-transmissivity",label:h.jsxs(Zn,{noPadding:!0,Dialog:YAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",o)," ..."]})},{key:"solar-updraft-tower-collector-emissivity",label:h.jsxs(Zn,{noPadding:!0,Dialog:OAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",o)," ..."]})},{key:"solar-updraft-tower-discharge-coefficient",label:h.jsxs(Zn,{noPadding:!0,Dialog:_Ao,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",o)," ..."]})},{key:"solar-updraft-tower-turbine-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:VAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",o)," ..."]})}]})),e.push({key:"optimization",label:h.jsx(ln,{children:B.t("optimizationMenu.Optimization",o)}),children:[{key:"genetic-algorithms",label:h.jsx(ln,{noPadding:!0,children:B.t("optimizationMenu.GeneticAlgorithm",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-ga-optimizer",label:h.jsxs(Zn,{noPadding:!0,Dialog:GAo,children:[B.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]},{key:"particle-swarm-optimization",label:h.jsx(ln,{noPadding:!0,children:B.t("optimizationMenu.ParticleSwarmOptimization",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-pso-optimizer",label:h.jsxs(Zn,{noPadding:!0,Dialog:XAo,children:[B.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]}]}),r&&e.push({key:"foundation-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},s4o=xe.memo(({cuboid:t})=>{const e=Kt(),n=()=>{H.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Cuboid){const i=r,a=!i.stackable;i.stackable=a,o.actionState.cuboidStackable=a;break}})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.stackable,onChange:n,children:B.t("cuboidMenu.Stackable",e)})})}),c4o=xe.memo(({cuboid:t,selectedSideIndex:e})=>{const n=Kt(),o=H.getState().set,r=()=>{o(c=>{c.objectTypeToAdd=z.Polygon});const{pos:i}=ye.getWorldDataById(t.id);let a;switch(e){case 0:a=b1;break;case 1:a=S1;break;case 2:a=Zc;break;case 3:a=T1;break;default:a=Oo,i.z=t.lz}const l=H.getState().addElement(t,i,a),s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{H.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{o(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};H.getState().addUndoable(s),o(c=>{c.objectTypeToAdd=z.None})};return h.jsx(ln,{onClick:r,children:B.t("cuboidMenu.AddPolygon",n)})}),TEe=xe.memo(({cuboid:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=H.getState().removeAllChildElementsByType,a=()=>{const s=H.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Cuboid`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{H.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};H.getState().addUndoable(u)},l=()=>{const s=o??a;li.confirm({title:n,icon:h.jsx(_y,{}),onOk:s})};return h.jsx(ln,{noPadding:!0,onClick:l,children:r})}),u4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(MS),i=H(IS),a=H(dXe),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState((c==null?void 0:c.color)??"#808080"),[f,p]=g.useState(!1),m=Kt();g.useEffect(()=>{P()},[c,a]);const y=(R,M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.Cuboid&&N.id===M&&!N.locked){const U=N;U.faceColors||(U.faceColors=new Array(6),U.faceColors.fill(U.color??D)),U.faceColors[R]=D;break}})},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.Cuboid&&k.id===R&&!k.locked){k.color=M;const N=k;N.faceColors||(N.faceColors=new Array(6));for(let U=0;U<4;U++)N.faceColors[U]=M;break}})},x=R=>{e(M=>{for(const D of M.elements)if(D.type===z.Cuboid&&!D.locked){D.color=R;const k=D;k.faceColors||(k.faceColors=new Array(6));for(let N=0;N<4;N++)k.faceColors[N]=R}})},C=R=>{i(R.target.value),p(!f)},P=()=>{c&&(a>=0&&c.faceColors?d(c.faceColors[a]):d(c.color??"#808080"))},A=R=>{if(c){switch(r){case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.Cuboid&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)){const D=M;if(D.faceColors){for(let k=0;k<4;k++)if(R!==D.faceColors[k])return!0}else if(R!==D.color)return!0}break;case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.Cuboid&&!M.locked){const D=M;if(D.faceColors){for(let k=0;k<4;k++)if(R!==D.faceColors[k])return!0}else if(R!==D.color)return!0}break;case ie.OnlyThisObject:if(c.faceColors){for(let M=0;M<4;M++)if(R!==c.faceColors[M])return!0}else if(R!==(c==null?void 0:c.color))return!0;break;default:if(a>=0){const M=c!=null&&c.faceColors?c==null?void 0:c.faceColors[a]:c==null?void 0:c.color;if(R!==M)return!0}else if(R!==(c==null?void 0:c.color))return!0}return!1}},S=R=>{if(c&&A(R)){switch(r){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)if(k.type===z.Cuboid&&H.getState().selectedElementIdSet.has(k.id)){const N=k;if(N.faceColors)M.set(k.id,[...N.faceColors]);else{const U=N.color??"#808080";M.set(k.id,[U,U,U,U,U,U])}}const D={name:"Set Color for Selected Cuboids",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{for(const[k,N]of D.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)k.actionState.cuboidFaceColors[N]=R});break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)if(k.type===z.Cuboid){const N=k;if(N.faceColors)M.set(k.id,[...N.faceColors]);else{const U=N.color??"#808080";M.set(k.id,[U,U,U,U,U,U])}}const D={name:"Set Color for All Cuboids",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{x(D.newValue)}};o(D),x(R),s(l+1),e(k=>{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)k.actionState.cuboidFaceColors[N]=R});break}case ie.OnlyThisObject:{let M;if(c.faceColors)M=[...c.faceColors];else{const k=c.color??"#808080";M=[k,k,k,k,k,k]}const D={name:"Set Color for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(D.oldValue&&Array.isArray(D.oldValue))for(let k=0;k{w(D.changedElementId,D.newValue)}};o(D),w(c.id,R),s(l+1),e(k=>{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)k.actionState.cuboidFaceColors[N]=R});break}default:{if(a>=0){const M=c.faceColors?c.faceColors[a]:c.color,D={name:"Set Color for Selected Side of Cuboid",timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{D.changedSideIndex!==void 0&&y(D.changedSideIndex,D.changedElementId,D.oldValue)},redo:()=>{D.changedSideIndex!==void 0&&y(D.changedSideIndex,D.changedElementId,D.newValue)}};o(D),y(a,c.id,R),s(l+1),e(k=>{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]),k.actionState.cuboidFaceColors[a]=R})}break}}p(!f)}},v=()=>{P(),t(!1)},b=()=>{S(u),t(!1),s(0)},T=a>=0&&(c!=null&&c.faceColors)?c.faceColors[a]:(c==null?void 0:c.color)??"#808080";return h.jsx(ro,{width:600,title:B.t("word.Color",m),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:u??T,onChangeComplete:R=>{d(R.hex),p(!f)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:C,value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("cuboidMenu.OnlyThisSide",m)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.AllSidesOfThisCuboid",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfSelectedCuboids",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfAllCuboids",m)})]})})})]})})},d4o="/aladdin/assets/building_facade_01_menu-BAm4EVGn.png",f4o="/aladdin/assets/building_facade_02_menu-BylQ9E0j.png",h4o="/aladdin/assets/building_facade_03_menu-DfU_cdlP.png",p4o="/aladdin/assets/building_facade_04_menu-Bz2bcbq0.png",g4o="/aladdin/assets/building_facade_05_menu-hF6OsAF0.png",m4o="/aladdin/assets/building_facade_06_menu-CUmtyI19.png",y4o="/aladdin/assets/building_facade_07_menu-B8_DYqYz.png",A4o="/aladdin/assets/building_facade_08_menu-CTA_rxim.png",w4o="/aladdin/assets/building_facade_09_menu-BpQDoLbY.png",x4o="/aladdin/assets/building_facade_10_menu-z_jZrQMT.png",v4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(MS),i=H(IS),a=H(dXe),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState(c&&c.textureTypes&&a>=0?c.textureTypes[a]:Do.NoTexture),f=Kt(),{Option:p}=Ko;g.useEffect(()=>{c&&d(c.textureTypes&&a>=0?c.textureTypes[a]:Do.NoTexture)},[c,a]);const m=(b,T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.Cuboid&&D.id===T&&!D.locked){const k=D;k.textureTypes||(k.textureTypes=new Array(6),k.textureTypes.fill(Do.NoTexture)),k.textureTypes[b]=R;break}})},y=(b,T)=>{e(R=>{for(const M of R.elements)if(M.type===z.Cuboid&&M.id===b&&!M.locked){const D=M;D.textureTypes||(D.textureTypes=new Array(6),D.textureTypes.fill(Do.NoTexture));for(let k=0;k<4;k++)D.textureTypes[k]=T;break}})},w=(b,T)=>{e(R=>{for(const M of R.elements)if(M.type===z.Cuboid&&!M.locked&&b.has(M.id)){const D=M;if(D.textureTypes||(D.textureTypes=new Array(6),D.textureTypes.fill(Do.NoTexture)),T!==void 0)for(let k=0;k<4;k++)D.textureTypes[k]=T;else{const k=b.get(M.id);if(k&&k.length>=4)for(let N=0;N<4;N++)D.textureTypes[N]=k[N]}}})},x=b=>{e(T=>{for(const R of T.elements)if(R.type===z.Cuboid&&!R.locked){const M=R;M.textureTypes||(M.textureTypes=new Array(6),M.textureTypes.fill(Do.NoTexture));for(let D=0;D<4;D++)M.textureTypes[D]=b}})},C=b=>{i(b.target.value)},P=b=>{if(c){switch(r){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Cuboid&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;if(R.textureTypes){for(let M=0;M<4;M++)if(b!==R.textureTypes[M])return!0}}break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.Cuboid&&!T.locked){const R=T;if(R.textureTypes){for(let M=0;M<4;M++)if(b!==R.textureTypes[M])return!0}}break;case ie.OnlyThisObject:if(c.textureTypes){for(let T=0;T<4;T++)if(b!==c.textureTypes[T])return!0}break;default:if(a>=0&&c.textureTypes&&b!==c.textureTypes[a])return!0}return!1}},A=b=>{if(c&&P(b))switch(r){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)if(M.type===z.Cuboid&&H.getState().selectedElementIdSet.has(M.id)){const D=M;T.set(M.id,D.textureTypes?[...D.textureTypes]:void 0)}const R={name:"Set Texture for Selected Cuboids",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())if(D&&Array.isArray(D))for(let k=0;k{w(R.oldValues,R.newValue)}};o(R),w(T,b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]);for(let D=0;D<4;D++)M.actionState.cuboidFaceTextures[D]=b});break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)if(M.type===z.Cuboid){const D=M;T.set(M.id,D.textureTypes?[...D.textureTypes]:void 0)}const R={name:"Set Texture for All Cuboids",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())if(D&&Array.isArray(D))for(let k=0;k{x(R.newValue)}};o(R),x(b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]);for(let D=0;D<4;D++)M.actionState.cuboidFaceTextures[D]=b});break}case ie.OnlyThisObject:{const T=c.textureTypes?[...c.textureTypes]:void 0,R={name:"Set Texture for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(R.oldValue&&Array.isArray(R.oldValue))for(let M=0;M{y(R.changedElementId,R.newValue)}};o(R),y(c.id,b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]);for(let D=0;D<4;D++)M.actionState.cuboidFaceTextures[D]=b});break}default:{if(a>=0){const T=c.textureTypes?c.textureTypes[a]:Do.NoTexture,R={name:"Set Texture for Selected Side of Cuboid",timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{R.changedSideIndex!==void 0&&m(R.changedSideIndex,R.changedElementId,R.oldValue)},redo:()=>{R.changedSideIndex!==void 0&&m(R.changedSideIndex,R.changedElementId,R.newValue)}};o(R),m(a,c.id,b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]),M.actionState.cuboidFaceTextures[a]=b})}break}}},S=()=>{c!=null&&c.textureTypes&&a>=0&&d(c.textureTypes[a]),t(!1)},v=()=>{A(u)};return h.jsx(ro,{width:600,title:B.t("word.Texture",f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(p,{value:Do.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",f)]},Do.NoTexture),h.jsxs(p,{value:Do.Facade01,children:[h.jsx("img",{alt:Do.Facade01,src:d4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture01",f)]},Do.Facade01),h.jsxs(p,{value:Do.Facade02,children:[h.jsx("img",{alt:Do.Facade02,src:f4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture02",f)]},Do.Facade02),h.jsxs(p,{value:Do.Facade03,children:[h.jsx("img",{alt:Do.Facade03,src:h4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture03",f)]},Do.Facade03),h.jsxs(p,{value:Do.Facade04,children:[h.jsx("img",{alt:Do.Facade04,src:p4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture04",f)]},Do.Facade04),h.jsxs(p,{value:Do.Facade05,children:[h.jsx("img",{alt:Do.Facade05,src:g4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture05",f)]},Do.Facade05),h.jsxs(p,{value:Do.Facade06,children:[h.jsx("img",{alt:Do.Facade06,src:m4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture06",f)]},Do.Facade06),h.jsxs(p,{value:Do.Facade07,children:[h.jsx("img",{alt:Do.Facade07,src:y4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture07",f)]},Do.Facade07),h.jsxs(p,{value:Do.Facade08,children:[h.jsx("img",{alt:Do.Facade08,src:A4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture08",f)]},Do.Facade08),h.jsxs(p,{value:Do.Facade09,children:[h.jsx("img",{alt:Do.Facade09,src:w4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture09",f)]},Do.Facade09),h.jsxs(p,{value:Do.Facade10,children:[h.jsx("img",{alt:Do.Facade10,src:x4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture10",f)]},Do.Facade10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:C,value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("cuboidMenu.OnlyThisSide",f)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.AllSidesOfThisCuboid",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfSelectedCuboids",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfAllCuboids",f)})]})})})]})})},b4o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(RS),r=H(fXe),i=H(Z3),a=H(M7),l=H(Q3),s=H(Fn),c=H(MS),u=H(IS),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Cuboid),[w,x]=g.useState((y==null?void 0:y.lx)??0),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=Z=>{u(Z.target.value)},U=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid&&H.getState().selectedElementIdSet.has(ne.id)){const te=ne,$=o(te.id);if($.length>0&&!ye.doesNewSizeContainAllChildren(te,$,Z,te.ly))return!1}break}case ie.AllObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid){const te=ne,$=o(te.id);if($.length>0&&!ye.doesNewSizeContainAllChildren(te,$,Z,te.ly))return!1}break}default:{const ne=o(y.id);if(ne.length>0)return ye.doesNewSizeContainAllChildren(y,ne,Z,y.ly);break}}return!0}},W=Z=>!U(Z),F=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&H.getState().selectedElementIdSet.has(ne.id)&&Math.abs(ne.lx-Z)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&Math.abs(ne.lx-Z)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const ne of e)if(ne.type===z.Cuboid&&ne.parentId===(y==null?void 0:y.parentId)&&!ne.locked&&Math.abs(ne.lx-Z)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((y==null?void 0:y.lx)-Z)>Ht)return!0}return!1}},E=(Z,ne)=>{if(Z==null)return null;for(const te of Z.children)if(te.name.includes(`${ne}`))return te;return null},L=(Z,ne,te)=>{var $,le;if(Z){for(const de of Z.children)if(de.name.includes(`${te.id}`)){(le=($=jn.getState().contentRef)==null?void 0:$.current)==null||le.add(de);break}d(de=>{for(const he of de.elements)if(he.id===te.id){he.parentId=rr;const me=new _t(he.cx,he.cy).rotateAround(ui,ne.rotation[2]).add(new _t(ne.cx,ne.cy));he.cx=me.x,he.cy=me.y,he.cz=0,S.current.set(he.id,new ue(me.x,me.y,0)),P.current.set(he.id,rr);break}})}},j=Z=>{for(const ne of e)ne.type===z.Cuboid&&!ne.locked&&ne.parentId===(y==null?void 0:y.parentId)&&Y(ne,Z)},Y=(Z,ne)=>{const te=o(Z.id),$=Z.rotation[2];if(v.current.clear(),R.current.clear(),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=new _t(le.cx*Z.lx,le.cy*Z.ly).rotateAround(ui,$);v.current.set(le.id,de),A.current.set(le.id,new ue(le.cx,le.cy));break}case z.Polygon:{const de=le,he=[];for(const me of de.vertices)he.push(new _t(me.x*Z.lx,me.y*Z.ly).rotateAround(ui,$));R.current.set(le.id,he),b.current.set(le.id,de.vertices.map(me=>({...me})));break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[0],-1)||ye.isEqual(le.normal[0],1))&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz));ye.isPlantOrHuman(le)&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz))}if(i(Z.id,ne),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=v.current.get(le.id);if(de){const me=new _t(de.x,de.y).rotateAround(ui,-$).x/ne;r(le.id,me),S.current.set(le.id,new ue(me,le.cy))}break}case z.Polygon:{const de=R.current.get(le.id);if(de){const he=[];for(const me of de){const ce=me.rotateAround(ui,-$),Pe=ce.x/ne,pe=ce.y/Z.ly;he.push({x:Pe,y:pe})}a(le.id,he),T.current.set(le.id,he.map(me=>({...me})))}break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[0],-1)&&(r(le.id,-ne/2),S.current.set(le.id,new ue(-ne/2,le.cy,le.cz))),ye.isEqual(le.normal[0],1)&&(r(le.id,ne/2),S.current.set(le.id,new ue(ne/2,le.cy,le.cz))));if(ye.isPlantOrHuman(le)){if(S.current.set(le.id,new ue(le.cx,le.cy,le.cz)),C.current.set(le.id,Z.id),Math.abs(le.cz-Z.lz/2)0){const de=jn.getState().contentRef,he=E(de==null?void 0:de.current,Z.id);L(he,Z,le)}}else if(Math.abs(Math.abs(le.cx)-Z.lx/2)0?ne:-ne)/2;r(le.id,de),S.current.set(le.id,new ue(de,le.cy,le.cz))}}}},O=(Z,ne,te)=>{if(!Z||!ne)return;const $=jn.getState().contentRef,le=E($==null?void 0:$.current,ne),de=E(ne===rr?$==null?void 0:$.current:le,te);if(de&&($!=null&&$.current)){if(Z===rr)$.current.add(de);else{const he=E($.current,Z);he==null||he.add(de)}Ip()}},_=(Z,ne)=>{Z&&d(te=>{for(const $ of te.elements)if($.id===ne){$.parentId=Z;break}})},G=Z=>{if(!y||!F(Z))return;const ne=n(y.id),te=ne?ne.lx:y.lx;if(D.current=void 0,M.current=W(Z),M.current)D.current=Z,x(te);else switch(c){case ie.AllSelectedObjectsOfThisType:{const $=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&H.getState().selectedElementIdSet.has(de.id)&&($.set(de.id,de.lx),Y(de,Z));const le={name:"Set Length for Selected Cuboids",timestamp:Date.now(),oldSizes:$,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())a(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())a(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const $=new Map;for(const de of e)de.type===z.Cuboid&&de.parentId===y.parentId&&!de.locked&&($.set(de.id,de.lx),Y(de,Z));const le={name:"Set Length for All Cuboids on Surface",timestamp:Date.now(),oldSizes:$,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())a(me,ce)},redo:()=>{var de,he;if(j(le.newSize),le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())a(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisType:{const $=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&($.set(de.id,de.lx),Y(de,Z));const le={name:"Set Length for All Cuboids",timestamp:Date.now(),oldSizes:$,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())a(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())a(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{Y(y,Z);const $={name:"Set Cuboid Length",timestamp:Date.now(),oldSize:te,newSize:Z,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;if(i(y.id,$.oldSize),$.oldChildrenPositionsMap&&$.oldChildrenPositionsMap.size>0)for(const[he,me]of $.oldChildrenPositionsMap.entries()){l(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(ce,Pe,he),_(ce,he))}if($.oldChildrenVerticesMap&&$.oldChildrenVerticesMap.size>0)for(const[he,me]of $.oldChildrenVerticesMap.entries())a(he,me)},redo:()=>{var le,de;if(i(y.id,$.newSize),$.newChildrenPositionsMap&&$.newChildrenPositionsMap.size>0)for(const[he,me]of $.newChildrenPositionsMap.entries()){l(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(Pe,ce,he),_(Pe,he))}if($.newChildrenVerticesMap&&$.newChildrenVerticesMap.size>0)for(const[he,me]of $.newChildrenVerticesMap.entries())a(he,me)}};s($),p(f+1);break}}},Q=()=>{t(!1)},oe=()=>{Q(),m()},ee=()=>{G(w),M.current||(t(!1),p(0))},q=()=>{G(w)},ae=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",k),rejectedMessage:ae,onApply:q,onClose:Q,onClickCancel:oe,onClickOk:ee,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:w,onChange:Z=>{Z!==null&&x(Z)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 500] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:N,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",k)})]})})})]})})},S4o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(RS),r=H(Q3),i=H(hXe),a=H(H7),l=H(M7),s=H(Fn),c=H(MS),u=H(IS),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Cuboid),[w,x]=g.useState((y==null?void 0:y.ly)??0),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=Z=>{u(Z.target.value)},U=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid&&H.getState().selectedElementIdSet.has(ne.id)){const te=ne,$=o(te.id);if($.length>0&&!ye.doesNewSizeContainAllChildren(te,$,te.lx,Z))return!1}break}case ie.AllObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid){const te=ne,$=o(te.id);if($.length>0&&!ye.doesNewSizeContainAllChildren(te,$,te.lx,Z))return!1}break}default:{const ne=o(y.id);if(ne.length>0)return ye.doesNewSizeContainAllChildren(y,ne,y.lx,Z);break}}return!0}},W=Z=>!U(Z),F=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&H.getState().selectedElementIdSet.has(ne.id)&&Math.abs(ne.ly-Z)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const ne of e)if(ne.type===z.Cuboid&&ne.parentId===(y==null?void 0:y.parentId)&&!ne.locked&&Math.abs(ne.ly-Z)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&Math.abs(ne.ly-Z)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((y==null?void 0:y.ly)-Z)>Ht)return!0}return!1}},E=(Z,ne)=>{if(Z==null)return null;for(const te of Z.children)if(te.name.includes(`${ne}`))return te;return null},L=(Z,ne,te)=>{var $,le;if(Z){for(const de of Z.children)if(de.name.includes(`${te.id}`)){(le=($=jn.getState().contentRef)==null?void 0:$.current)==null||le.add(de);break}d(de=>{for(const he of de.elements)if(he.id===te.id){he.parentId=rr;const me=new _t(he.cx,he.cy).rotateAround(ui,ne.rotation[2]).add(new _t(ne.cx,ne.cy));he.cx=me.x,he.cy=me.y,he.cz=0,S.current.set(he.id,new ue(me.x,me.y,0)),P.current.set(he.id,rr);break}})}},j=Z=>{for(const ne of e)ne.type===z.Cuboid&&!ne.locked&&ne.parentId===(y==null?void 0:y.parentId)&&Y(ne,Z)},Y=(Z,ne)=>{const te=o(Z.id),$=Z.rotation[2];if(v.current.clear(),R.current.clear(),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=new _t(le.cx*Z.lx,le.cy*Z.ly).rotateAround(ui,$);v.current.set(le.id,de),A.current.set(le.id,new ue(le.cx,le.cy));break}case z.Polygon:{const de=le,he=[];for(const me of de.vertices)he.push(new _t(me.x*Z.lx,me.y*Z.ly).rotateAround(ui,$));R.current.set(le.id,he),b.current.set(le.id,de.vertices.map(me=>({...me})));break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[1],-1)||ye.isEqual(le.normal[1],1))&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz));ye.isPlantOrHuman(le)&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz))}if(a(Z.id,ne),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=v.current.get(le.id);if(de){const me=new _t(de.x,de.y).rotateAround(ui,-$).y/ne;i(le.id,me),S.current.set(le.id,new ue(le.cx,me))}break}case z.Polygon:{const de=R.current.get(le.id);if(de){const he=[];for(const me of de){const ce=me.rotateAround(ui,-$),Pe=ce.x/Z.lx,pe=ce.y/ne;he.push({x:Pe,y:pe})}l(le.id,he),T.current.set(le.id,he.map(me=>({...me})))}break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[1],-1)&&(i(le.id,-ne/2),S.current.set(le.id,new ue(le.cx,-ne/2,le.cz))),ye.isEqual(le.normal[1],1)&&(i(le.id,ne/2),S.current.set(le.id,new ue(le.cx,ne/2,le.cz))));if(ye.isPlantOrHuman(le)){if(S.current.set(le.id,new ue(le.cx,le.cy,le.cz)),C.current.set(le.id,Z.id),Math.abs(le.cz-Z.lz/2)0){const de=jn.getState().contentRef,he=E(de==null?void 0:de.current,Z.id);L(he,Z,le)}}else if(Math.abs(Math.abs(le.cy)-Z.ly/2)0?ne:-ne)/2;i(le.id,de),S.current.set(le.id,new ue(le.cz,de,le.cz))}}}},O=(Z,ne,te)=>{if(!Z||!ne)return;const $=jn.getState().contentRef,le=E($==null?void 0:$.current,ne),de=E(ne===rr?$==null?void 0:$.current:le,te);if(de&&($!=null&&$.current)){if(Z===rr)$.current.add(de);else{const he=E($.current,Z);he==null||he.add(de)}Ip()}},_=(Z,ne)=>{Z&&d(te=>{for(const $ of te.elements)if($.id===ne){$.parentId=Z;break}})},G=Z=>{if(!y||!F(Z))return;const ne=n(y.id),te=ne?ne.ly:y.ly;if(D.current=void 0,M.current=W(Z),M.current)D.current=Z,x(te);else switch(A.current.clear(),S.current.clear(),b.current.clear(),T.current.clear(),c){case ie.AllSelectedObjectsOfThisType:{const $=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&H.getState().selectedElementIdSet.has(de.id)&&($.set(de.id,de.ly),Y(de,Z));const le={name:"Set Width for Selected Cuboids on Surface",timestamp:Date.now(),oldSizes:$,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())l(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())l(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const $=new Map;for(const de of e)de.type===z.Cuboid&&de.parentId===y.parentId&&!de.locked&&($.set(de.id,de.ly),Y(de,Z));const le={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:$,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())l(me,ce)},redo:()=>{var de,he;if(j(le.newSize),le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())l(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisType:{const $=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&($.set(de.id,de.ly),Y(de,Z));const le={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:$,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())l(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())l(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{Y(y,Z);const $={name:"Set Cuboid Width",timestamp:Date.now(),oldSize:te,newSize:Z,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;if(a(y.id,$.oldSize),$.oldChildrenPositionsMap&&$.oldChildrenPositionsMap.size>0)for(const[he,me]of $.oldChildrenPositionsMap.entries()){r(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(ce,Pe,he),_(ce,he))}if($.oldChildrenVerticesMap&&$.oldChildrenVerticesMap.size>0)for(const[he,me]of $.oldChildrenVerticesMap.entries())l(he,me)},redo:()=>{var le,de;if(a(y.id,$.newSize),$.newChildrenPositionsMap&&$.newChildrenPositionsMap.size>0)for(const[he,me]of $.newChildrenPositionsMap.entries()){r(he,me.x,me.y,me.z);const ce=(le=$.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=$.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(Pe,ce,he),_(Pe,he))}if($.newChildrenVerticesMap&&$.newChildrenVerticesMap.size>0)for(const[he,me]of $.newChildrenVerticesMap.entries())l(he,me)}};s($),p(f+1);break}}},Q=()=>{t(!1)},oe=()=>{Q(),m()},ee=()=>{G(w),M.current||(t(!1),p(0))},q=()=>{G(w)},ae=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Width",k),rejectedMessage:ae,onApply:q,onClose:Q,onClickCancel:oe,onClickOk:ee,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:w,onChange:Z=>{Z!==null&&x(Z)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 500] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:N,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",k)})]})})})]})})},T4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Jn),i=H(d5e),a=H(SPt),l=H(PPt),s=H(TPt),c=H(Fn),u=H(MS),d=H(IS),f=H(Q3),p=H(no),m=H(qn),y=ao(z.Cuboid),[w,x]=g.useState((y==null?void 0:y.lz)??0),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=Kt(),b=O=>{d(O.target.value)},T=(O,_)=>{i(O,_),a(O,_/2)},R=O=>{if(!y)return;const _=o(y);if(_)for(const G of n)G.type===z.Cuboid&&!G.locked&&G.parentId===_.id&&(i(G.id,O),a(G.id,O/2))},M=O=>{if(!y)return;const _=ye.getBaseId(y.id);if(_)for(const G of n)G.type===z.Cuboid&&!G.locked&&ye.getBaseId(G.id)===_&&(i(G.id,O),a(G.id,O/2))},D=O=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const _ of n)if(_.type===z.Cuboid&&!_.locked&&H.getState().selectedElementIdSet.has(_.id)&&Math.abs(_.lz-O)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const _ of n)if(_.type===z.Cuboid&&!_.locked&&Math.abs(_.lz-O)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{const _=ye.getBaseId(y==null?void 0:y.id);if(_&&_!==rr){for(const G of n)if(G.type===z.Cuboid&&G.parentId&&G.parentId!==rr&&!G.locked){const Q=G;if(_===ye.getBaseId(Q.id)&&Math.abs(Q.lz-O)>Ht)return!0}}break}case ie.AllObjectsOfThisTypeOnSurface:{for(const _ of n)if(_.type===z.Cuboid&&_.parentId!==rr&&_.parentId===(y==null?void 0:y.parentId)&&!_.locked&&Math.abs(_.lz-O)>Ht)return!0;break}default:{if(Math.abs((y==null?void 0:y.lz)-O)>Ht)return!0;break}}return!1}},k=(O,_)=>{if(O==null)return null;for(const G of O.children)if(G.name.includes(`${_}`))return G;return null},N=(O,_,G)=>{var Q,oe;if(O){for(const q of O.children)if(q.name.includes(`${G.id}`)){(oe=(Q=jn.getState().contentRef)==null?void 0:Q.current)==null||oe.add(q);break}G.parentId=rr;const ee=new _t(G.cx,G.cy).rotateAround(ui,-_.rotation[2]).add(new _t(_.cx,_.cy));G.cx=ee.x,G.cy=ee.y,G.cz=0,S.current.set(G.id,new ue(ee.x,ee.y,0)),P.current.set(G.id,rr)}},U=(O,_)=>{e(G=>{for(const Q of G.elements)if(Q.parentId===O.id)if(C.current.set(Q.id,O.id),A.current.set(Q.id,new ue(Q.cx,Q.cy,Q.cz)),ye.isPlantOrHuman(Q))if(Math.abs(Q.cz-O.lz/2)_/2){const ee=jn.getState().contentRef,q=k(ee==null?void 0:ee.current,O.id);N(q,O,Q)}else Q.cz=oe,S.current.set(Q.id,new ue(Q.cx,Q.cy,oe))}else Q.type===z.SolarPanel&&ye.isEqual(Q.normal[2],1)&&(Q.cz=_/2,S.current.set(Q.id,new ue(Q.cx,Q.cy,_/2)))})},W=(O,_,G)=>{if(!O||!_)return;const Q=jn.getState().contentRef,oe=k(Q==null?void 0:Q.current,_),ee=k(_===rr?Q==null?void 0:Q.current:oe,G);if(ee&&(Q!=null&&Q.current)){if(O===rr)Q.current.add(ee);else{const q=k(Q.current,O);q==null||q.add(ee)}Ip()}},F=(O,_)=>{O&&e(G=>{for(const Q of G.elements)if(Q.id===_){Q.parentId=O;break}})},E=(O,_)=>{H.getState().set(G=>{for(const Q of G.elements)if(O.has(Q.id))if(_!==void 0)Q.lz=_,Q.cz=_/2;else{const oe=O.get(Q.id);oe!==void 0&&(Q.lz=oe,Q.cz=oe/2)}})},L=O=>{if(y&&D(O)){switch(u){case ie.AllSelectedObjectsOfThisType:{const _=new Map;for(const Q of n)Q.type===z.Cuboid&&H.getState().selectedElementIdSet.has(Q.id)&&(_.set(Q.id,Q.lz),U(Q,O));const G={name:"Set Height for Selected Cuboids",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var Q,oe;if(E(G.oldValues),G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ee,q]of G.oldChildrenPositionsMap.entries()){f(ee,q.x,q.y,q.z);const ae=(Q=G.oldChildrenParentIdMap)==null?void 0:Q.get(ee),Z=(oe=G.newChildrenParentIdMap)==null?void 0:oe.get(ee);ae&&Z&&ae!==Z&&(W(ae,Z,ee),F(ae,ee))}},redo:()=>{var oe,ee;const Q=G.newValue;if(E(G.oldValues,Q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[q,ae]of G.newChildrenPositionsMap.entries()){f(q,ae.x,ae.y,ae.z);const Z=(oe=G.oldChildrenParentIdMap)==null?void 0:oe.get(q),ne=(ee=G.newChildrenParentIdMap)==null?void 0:ee.get(q);Z&&ne&&Z!==ne&&(W(ne,Z,q),F(ne,q))}}};c(G),E(_,O),m(p+1);break}case ie.AllObjectsOfThisType:{const _=new Map;for(const Q of n)Q.type===z.Cuboid&&(_.set(Q.id,Q.lz),U(Q,O));const G={name:"Set Height for All Cuboids",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var Q,oe;for(const[ee,q]of G.oldValues.entries())T(ee,q);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ee,q]of G.oldChildrenPositionsMap.entries()){f(ee,q.x,q.y,q.z);const ae=(Q=G.oldChildrenParentIdMap)==null?void 0:Q.get(ee),Z=(oe=G.newChildrenParentIdMap)==null?void 0:oe.get(ee);ae&&Z&&ae!==Z&&(W(ae,Z,ee),F(ae,ee))}},redo:()=>{var oe,ee;const Q=G.newValue;if(l(z.Cuboid,Q),s(z.Cuboid,Q/2),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[q,ae]of G.newChildrenPositionsMap.entries()){f(q,ae.x,ae.y,ae.z);const Z=(oe=G.oldChildrenParentIdMap)==null?void 0:oe.get(q),ne=(ee=G.newChildrenParentIdMap)==null?void 0:ee.get(q);Z&&ne&&Z!==ne&&(W(ne,Z,q),F(ne,q))}}};c(G),l(z.Cuboid,O),s(z.Cuboid,O/2),m(p+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const _=new Map,G=ye.getBaseId(y.id);for(const oe of n)oe.type===z.Cuboid&&ye.getBaseId(oe.id)===G&&(_.set(oe.id,oe.lz),U(oe,O));const Q={name:"Set Height for All Cuboids Above Same Base",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var oe,ee;for(const[q,ae]of Q.oldValues.entries())T(q,ae);if(Q.oldChildrenPositionsMap&&Q.oldChildrenPositionsMap.size>0)for(const[q,ae]of Q.oldChildrenPositionsMap.entries()){f(q,ae.x,ae.y,ae.z);const Z=(oe=Q.oldChildrenParentIdMap)==null?void 0:oe.get(q),ne=(ee=Q.newChildrenParentIdMap)==null?void 0:ee.get(q);Z&&ne&&Z!==ne&&(W(Z,ne,q),F(Z,q))}},redo:()=>{var ee,q;const oe=Q.newValue;if(M(oe),Q.newChildrenPositionsMap&&Q.newChildrenPositionsMap.size>0)for(const[ae,Z]of Q.newChildrenPositionsMap.entries()){f(ae,Z.x,Z.y,Z.z);const ne=(ee=Q.oldChildrenParentIdMap)==null?void 0:ee.get(ae),te=(q=Q.newChildrenParentIdMap)==null?void 0:q.get(ae);ne&&te&&ne!==te&&(W(te,ne,ae),F(te,ae))}}};c(Q),M(O),m(p+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const _=new Map;for(const Q of n)Q.type===z.Cuboid&&Q.parentId===y.parentId&&(_.set(Q.id,Q.lz),U(Q,O));const G={name:"Set Height for All Cuboids on Same Surface",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var Q,oe;for(const[ee,q]of G.oldValues.entries())T(ee,q);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ee,q]of G.oldChildrenPositionsMap.entries()){f(ee,q.x,q.y,q.z);const ae=(Q=G.oldChildrenParentIdMap)==null?void 0:Q.get(ee),Z=(oe=G.newChildrenParentIdMap)==null?void 0:oe.get(ee);ae&&Z&&ae!==Z&&(W(ae,Z,ee),F(ae,ee))}},redo:()=>{var oe,ee;const Q=G.newValue;if(R(Q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[q,ae]of G.newChildrenPositionsMap.entries()){f(q,ae.x,ae.y,ae.z);const Z=(oe=G.oldChildrenParentIdMap)==null?void 0:oe.get(q),ne=(ee=G.newChildrenParentIdMap)==null?void 0:ee.get(q);Z&&ne&&Z!==ne&&(W(ne,Z,q),F(ne,q))}}};c(G),R(O),m(p+1);break}default:{const _=r(y.id),G=_?_.lz:y.lz;U(y,O),T(y.id,O);const Q={name:"Set Cuboid Width",timestamp:Date.now(),oldValue:G,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),changedElementId:y.id,changedElementType:y.type,undo:()=>{var oe,ee;if(T(Q.changedElementId,Q.oldValue),Q.oldChildrenPositionsMap&&Q.oldChildrenPositionsMap.size>0)for(const[q,ae]of Q.oldChildrenPositionsMap.entries()){f(q,ae.x,ae.y,ae.z);const Z=(oe=Q.oldChildrenParentIdMap)==null?void 0:oe.get(q),ne=(ee=Q.newChildrenParentIdMap)==null?void 0:ee.get(q);Z&&ne&&Z!==ne&&(W(Z,ne,q),F(Z,q))}},redo:()=>{var oe,ee;if(T(Q.changedElementId,Q.newValue),Q.newChildrenPositionsMap&&Q.newChildrenPositionsMap.size>0)for(const[q,ae]of Q.newChildrenPositionsMap.entries()){f(q,ae.x,ae.y,ae.z);const Z=(oe=Q.oldChildrenParentIdMap)==null?void 0:oe.get(q),ne=(ee=Q.newChildrenParentIdMap)==null?void 0:ee.get(q);Z&&ne&&Z!==ne&&(W(ne,Z,q),F(ne,q))}}};c(Q),m(p+1);break}}e(_=>{_.actionState.cuboidHeight=O})}},j=()=>{t(!1)},Y=()=>{L(w)};return h.jsx(ro,{width:550,title:B.t("word.Height",v),onApply:Y,onClose:j,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:w,onChange:O=>{O!==null&&x(O)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",v),": [0.1, 1000] ",B.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",v)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",v)}),(y==null?void 0:y.parentId)!==rr&&h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("cuboidMenu.AllCuboidsAboveSameBase",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",v)})]})})})]})})},P4o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(mQ),r=H(Fn),i=H(MS),a=H(IS),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState(c?-c.rotation[2]:0),f=Kt(),p=A=>{a(A.target.value)},m=A=>{for(const S of e)S.type===z.Cuboid&&!S.locked&&S.parentId===(c==null?void 0:c.parentId)&&o(S.id,0,0,-A)},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Cuboid&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&Math.abs(-S.rotation[2]-A)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const S of e)if(S.type===z.Cuboid&&S.parentId===(c==null?void 0:c.parentId)&&!S.locked&&Math.abs(-S.rotation[2]-A)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const S of e)if(S.type===z.Cuboid&&!S.locked&&Math.abs(-S.rotation[2]-A)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((c?-c.rotation[2]:0)-A)>Ht)return!0}return!1},w=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(A.has(b.id))if(S!==void 0)b.rotation[2]=S;else{const T=A.get(b.id);T!==void 0&&(b.rotation[2]=-T)}})},x=A=>{if(c&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Cuboid&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&S.set(b.id,-b.rotation[2]);const v={name:"Set Azimuth for Selected Cuboids",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{w(v.oldValues)},redo:()=>{w(v.oldValues,-v.newValue)}};r(v),w(S,-A),s(l+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const S=new Map;for(const b of e)b.type===z.Cuboid&&b.parentId===c.parentId&&!b.locked&&S.set(b.id,-b.rotation[2]);const v={name:"Set Azimuth for All Cuboids on Surface",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())o(b,0,0,-T)},redo:()=>{m(v.newValue)}};r(v),m(A),s(l+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Cuboid&&!b.locked&&S.set(b.id,-b.rotation[2]);const v={name:"Set Azimuth for All Cuboids",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{w(v.oldValues)},redo:()=>{w(v.oldValues,-v.newValue)}};r(v),w(S,-A),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{const S=n(c.id),v=S?-S.rotation[2]:-c.rotation[2],b={name:"Set Cuboid Azimuth",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(b.changedElementId,0,0,-b.oldValue)},redo:()=>{o(b.changedElementId,0,0,-b.newValue)}};r(b),o(c.id,0,0,-A),s(l+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("word.Azimuth",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(u).toFixed(2)),formatter:A=>`${A}°`,onChange:A=>{A!==null&&d(ye.toRadians(A))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:p,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",f)})]})})})]})})},C4o=[{key:"sensorCount",objectType:z.Sensor},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower},{key:"outsideLightCount",objectType:z.Light}],R4o=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.Light:{o=`${B.t("cuboidMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllLightsOnCuboid",n)} (${e} ${B.t("cuboidMenu.Lights",n)})`;break}case z.Sensor:{o=`${B.t("cuboidMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllSensorsOnCuboid",n)} (${e} ${B.t("cuboidMenu.Sensors",n)})`;break}case z.Polygon:{o=`${B.t("cuboidMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllPolygonsOnCuboid",n)} (${e} ${B.t("cuboidMenu.Polygons",n)})`;break}case z.Human:{o=`${B.t("cuboidMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllHumansOnCuboid",n)} (${e} ${B.t("cuboidMenu.Humans",n)})`;break}case z.Tree:{o=`${B.t("cuboidMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllTreesOnCuboid",n)} (${e} ${B.t("cuboidMenu.Trees",n)})`;break}case z.Flower:{o=`${B.t("cuboidMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllFlowersOnCuboid",n)} (${e} ${B.t("cuboidMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},H4o=(t,e)=>{const n=[],o={lng:H.getState().language};if(e.solarPanelCount>0){const r=B.t("cuboidMenu.DoYouReallyWantToRemoveAllSolarPanelsOnCuboid",o)+" ("+e.solarPanelModuleCount+" "+B.t("cuboidMenu.SolarPanels",o)+", "+e.solarPanelCount+" "+B.t("cuboidMenu.Racks",o)+")?";n.push({key:"remove-all-solar-panels-on-cuboid",label:h.jsxs(TEe,{cuboid:t,objectType:z.SolarPanel,modalTitle:r,children:[B.t("cuboidMenu.RemoveAllUnlockedSolarPanels",o),"  (",e.solarPanelModuleCount," ",B.t("cuboidMenu.SolarPanels",o),",",e.solarPanelCount," ",B.t("cuboidMenu.Racks",o),")"]})})}return C4o.forEach(({key:r,objectType:i})=>{const a=e[r];if(typeof a=="number"&&a>0){const{itemLabel:l,modalTitle:s}=R4o(i,a),c=i.replaceAll(" ","");n.push({key:`remove-all-${c}s-on-cuboid`,label:h.jsx(TEe,{cuboid:t,objectType:i,modalTitle:s,children:l})})}}),n},M4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(MS),a=H(IS),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState((c==null?void 0:c.transparency)??0),f=Kt(),p=(S,v)=>{e(b=>{for(const T of b.elements)if(T.type===z.Cuboid&&T.id===S&&!T.locked){T.transparency=v;break}})},m=S=>{for(const v of n)v.type===z.Cuboid&&!v.locked&&v.parentId===(c==null?void 0:c.parentId)&&p(v.id,S)},y=(S,v)=>{e(b=>{for(const T of b.elements)if(T.type===z.Cuboid&&S.has(T.id))if(v!==void 0)T.transparency=v;else{const R=S.get(T.id);R!==void 0&&(T.transparency=R)}})},w=S=>{a(S.target.value)},x=S=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Cuboid&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&Math.abs((v.transparency??0)-S)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const v of n)if(v.type===z.Cuboid&&v.parentId===(c==null?void 0:c.parentId)&&!v.locked&&Math.abs((v.transparency??0)-S)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Cuboid&&!v.locked&&Math.abs((v.transparency??0)-S)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs(((c==null?void 0:c.transparency)??0)-S)>Ht)return!0}return!1},C=S=>{if(c&&x(S))switch(i){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Cuboid&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.transparency??0);const b={name:"Set Transparency for Selected Cuboids",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{y(b.oldValues,-b.newValue)}};r(b),y(v,S),s(l+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const v=new Map;for(const T of n)T.type===z.Cuboid&&T.parentId===c.parentId&&!T.locked&&v.set(T.id,T.transparency??0);const b={name:"Set Transparency for All Cuboids on Surface",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())p(T,R)},redo:()=>{m(b.newValue)}};r(b),m(S),s(l+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Cuboid&&!T.locked&&v.set(T.id,T.transparency??0);const b={name:"Set Transparency for All Cuboids",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{y(b.oldValues,-b.newValue)}};r(b),y(v,S),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{const v=o(c.id),b=v?v.transparency:c.transparency,T={name:"Set Cuboid Transparency",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(T.changedElementId,T.oldValue)},redo:()=>{p(T.changedElementId,T.newValue)}};r(T),p(c.id,S),s(l+1);break}}},P=()=>{t(!1)},A=()=>{C(u)};return h.jsx(ro,{width:550,title:B.t("word.Transparency",f),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.1,precision:2,value:u,onChange:S=>{S!==null&&d(S)}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",f)})]})})})]})})},I4o=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.SolarPanel||e.type===z.Cuboid)return!0}return!1},z4o=t=>{const e=[];if(t.type!==z.Cuboid)return{items:e};const n=t,o=H.getState().selectedSideIndex,r={lng:H.getState().language},i=H.getState().countAllOffspringsByTypeAtOnce(n.id,!1),a=!(n!=null&&n.locked),l=!n.textureTypes||o>=0&&n.textureTypes[o]===Do.NoTexture;return I4o()&&e.push({key:"cuboid-paste",label:h.jsx(yI,{})}),e.push({key:"cuboid-copy",label:h.jsx(ad,{})}),a&&e.push({key:"cuboid-cut",label:h.jsx(ld,{})}),e.push({key:"cuboid-lock",label:h.jsx(D0,{selectedElement:n})}),e.push({key:"cuboid-group-master",label:h.jsx(nit,{groupableElement:n})}),e.push({key:"cuboid-stackable",label:h.jsx(s4o,{cuboid:n})}),i.gotSome()&&e.push({key:"cuboid-clear",label:h.jsx(ln,{children:B.t("word.Clear",r)}),children:H4o(n,i)}),a&&(l&&e.push({key:"cuboid-color",label:h.jsxs(Zn,{Dialog:u4o,children:[B.t("word.Color",r)," ..."]})}),e.push({key:"cuboid-texture",label:h.jsxs(Zn,{Dialog:v4o,children:[B.t("word.Texture",r)," ..."]})}),e.push({key:"cuboid-length",label:h.jsxs(Zn,{Dialog:b4o,children:[B.t("word.Length",r)," ..."]})}),e.push({key:"cuboid-width",label:h.jsxs(Zn,{Dialog:S4o,children:[B.t("word.Width",r)," ..."]})}),e.push({key:"cuboid-height",label:h.jsxs(Zn,{Dialog:T4o,children:[B.t("word.Height",r)," ..."]})}),e.push({key:"cuboid-azimuth",label:h.jsxs(Zn,{Dialog:P4o,children:[B.t("word.Azimuth",r)," ..."]})}),e.push({key:"cuboid-transparency",label:h.jsxs(Zn,{Dialog:M4o,children:[B.t("word.Transparency",r)," ..."]})})),e.push({key:"add-polygon-on-cuboid",label:h.jsx(c4o,{cuboid:n,selectedSideIndex:o})}),a&&e.push({key:"cuboid-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)}),{items:e}},D4o=()=>{const t=H(h4),e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.groundImage=r,i.viewState.groundImageType=i.viewState.mapType})},o=r=>{const i=r.target.checked,a={name:"Show Ground Image",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};H.getState().addUndoable(a),n(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("groundMenu.ImageOnGround",e)})})},E4o=()=>{const t=H(kGe),e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.waterSurface=r})},o=r=>{const i=r.target.checked,a={name:"Water Surface",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};H.getState().addUndoable(a),n(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,update:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("groundMenu.WaterSurface",e)})})},k4o=()=>{const t=H(EGe),e=o=>{H.getState().set(r=>{r.viewState.groundColor=o})},n=o=>{const r=t,i=o.hex,a={name:"Set Ground Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{e(a.oldValue)},redo:()=>{e(a.newValue)}};H.getState().addUndoable(a),e(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(sd,{color:t,onChangeComplete:n})})},F4o=()=>{const t=H(K2e)??tQ,n=H(tu)>0,o=Kt(),r=s=>{H.getState().set(c=>{c.world.leafDayOfYear1=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 1",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};H.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"100px"},children:B.t(n?"groundMenu.LeafOutDay":"groundMenu.LeafOffDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(1-150)"});return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:1,max:150,step:1,precision:0,value:t,onChange:i})})},L4o=()=>{const t=H($2e)??nQ,n=H(tu)>0,o=Kt(),r=s=>{H.getState().set(c=>{c.world.leafDayOfYear2=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 2",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};H.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"100px"},children:B.t(n?"groundMenu.LeafOffDay":"groundMenu.LeafOutDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(215-365)"});return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:215,max:365,step:1,precision:0,value:t,onChange:i})})},PEe=({monthIndex:t})=>{const e=H(i=>i.world.monthlyIrradianceLosses?i.world.monthlyIrradianceLosses[t]:.05)??.05,n=Kt(),o=i=>{H.getState().set(a=>{a.world.monthlyIrradianceLosses||(a.world.monthlyIrradianceLosses=new Array(12).fill(.05)),a.world.monthlyIrradianceLosses[t]=i})},r=i=>{if(i===null)return;const a=e,l=i,s={name:"Set Irradiance Loss in "+abe[t],timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{o(s.oldValue)},redo:()=>{o(s.newValue)}};H.getState().addUndoable(s),o(l)};return h.jsx(mn,{addonBefore:h.jsx("span",{style:{fontFamily:"monospace"},children:B.t(`month.${abe[t]}`,n)}),style:{width:"120px",paddingRight:t%2===0?"6px":0},min:0,max:1,step:.01,precision:2,value:e,onChange:r})},W4o=()=>{const t=H(r=>r.world.ground.albedo),e=Kt(),n=r=>{H.getState().set(i=>{i.world.ground.albedo=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ground Albedo",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"60px"},children:[B.t("groundMenu.Albedo",e),":"]}),h.jsx(mn,{min:.05,max:1,step:.01,precision:2,value:t,onChange:o})]})},N4o=({itemLabel:t,modalTitle:e,objectType:n})=>{const o=H.getState().removeElementsByType,r=()=>{const a=H.getState().elements.filter(c=>!c.locked&&c.type===n);o(n);const l=JSON.parse(JSON.stringify(a)),s={name:"Remove All "+n+"s",timestamp:Date.now(),removedElements:l,undo:()=>{H.getState().set(c=>{c.elements.push(...s.removedElements)})},redo:()=>{o(n)}};H.getState().addUndoable(s),dt.getState().updateContextMenu()},i=()=>{li.confirm({title:e,onOk:r,icon:h.jsx(_y,{})})};return h.jsx(ln,{onClick:i,children:t})},CEe=({lock:t,count:e,label:n})=>{const o=H.getState().updateAllElementLocks,r=()=>{const i=new Map;for(const c of H.getState().elements)i.set(c.id,!!c.locked);const s={name:`${t?"Lock":"Unlock"} All ${t?"Unlocked":"Locked"} Elements`,timestamp:Date.now(),oldValues:i,newValue:!0,undo:()=>{for(const[c,u]of s.oldValues.entries())H.getState().updateElementLockById(c,u)},redo:()=>{o(t)}};H.getState().addUndoable(s),o(t)};return h.jsxs(ln,{update:!0,onClick:r,children:[n," (",e,")"]})},U4o=[{key:"humanCount",type:z.Human,itemLabel:"groundMenu.RemoveAllUnlockedPeople",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllPeople"},{key:"treeCount",type:z.Tree,itemLabel:"groundMenu.RemoveAllUnlockedTrees",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllTrees"},{key:"flowerCount",type:z.Flower,itemLabel:"groundMenu.RemoveAllUnlockedFlowers",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFlowers"},{key:"solarPanelCount",type:z.SolarPanel,itemLabel:"groundMenu.RemoveAllUnlockedSolarPanels",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllSolarPanels"},{key:"foundationCount",type:z.Foundation,itemLabel:"groundMenu.RemoveAllUnlockedFoundations",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFoundations"},{key:"cuboidCount",type:z.Cuboid,itemLabel:"groundMenu.RemoveAllUnlockedCuboids",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllCuboids"}],j4o=()=>{const t=H.getState().elementsToPaste;if(!t||t.length===0)return!1;const e=t[0];return e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Cuboid||e.type===z.Foundation},B4o=()=>Bs.slice().reduce((t,e,n,o)=>(t&&n%2!==0&&t.push({key:`${o[n-1]}-${o[n]}`,label:h.jsxs(ln,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(PEe,{monthIndex:n-1}),h.jsx(PEe,{monthIndex:n})]})}),t),[]),Y4o=()=>{const t={lng:H.getState().language},e=H.getState().countAllElementsByType(!0),n=[];return j4o()&&n.push({key:"ground-paste",label:h.jsx(yI,{})}),U4o.forEach(({key:o,type:r,itemLabel:i,modalTitle:a})=>{const l=e[o];typeof l=="number"&&l>0&&n.push({key:`ground-remove-all-${r}s`,label:h.jsx(N4o,{objectType:r,itemLabel:`${B.t(i,t)} (${l})`,modalTitle:`${B.t(a,t)} (${l})?`})})}),e.unlockedCount>0&&n.push({key:"lock-all-elements",label:h.jsx(CEe,{lock:!0,count:e.unlockedCount,label:B.t("groundMenu.LockAllUnlockedElements",t)})}),e.lockedCount>0&&H.getState().elements.length>0&&n.push({key:"unlock-all-elements",label:h.jsx(CEe,{lock:!1,count:e.lockedCount,label:B.t("groundMenu.UnlockAllLockedElements",t)})}),n.push({key:"image-on-ground",label:h.jsx(D4o,{})}),n.push({key:"water-surface",label:h.jsx(E4o,{})}),H.getState().viewState.waterSurface||n.push({key:"ground-color-submenu",label:h.jsx(ln,{children:B.t("word.Color",t)}),children:[{key:"ground-color-picker",label:h.jsx(k4o,{}),style:{backgroundColor:"white"}}]}),n.push({key:"vegetation-submenu",label:h.jsx(ln,{children:B.t("groundMenu.Vegetation",t)}),children:[{key:"leaf-out-day",label:h.jsx(F4o,{})},{key:"leaf-shed-day",label:h.jsx(L4o,{})}]}),n.push({key:"monthly-irradiance-loss-submenu",label:h.jsx(ln,{children:B.t("groundMenu.MonthlyIrradianceLoss",t)}),children:B4o()}),n.push({key:"ground-albedo",label:h.jsx(W4o,{})}),{items:n}};var But={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t}}},fk;typeof self>"u"&&typeof process<"u"&&process.hrtime?fk=function(){var t=process.hrtime();return t[0]*1e3+t[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?fk=self.performance.now.bind(self.performance):Date.now!==void 0?fk=Date.now:fk=function(){return new Date().getTime()};var EC=fk,O4o=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(n){return e._tweens[n]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},t.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},t.prototype.update=function(e,n){e===void 0&&(e=EC()),n===void 0&&(n=!1);var o=Object.keys(this._tweens);if(o.length===0)return!1;for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?i(t[n],t[n-1],n-o):i(t[r],t[r+1>n?n:r+1],o-r)},Utils:{Linear:function(t,e,n){return(e-t)*n+t}}},Out=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),_ut=new O4o,_4o=function(){function t(e,n){n===void 0&&(n=_ut),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=But.Linear.None,this._interpolationFunction=Yut.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Out.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(e,n){return this._valuesEnd=Object.create(e),n!==void 0&&(this._duration=n),this},t.prototype.duration=function(e){return this._duration=e,this},t.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?EC()+parseFloat(e):e:EC(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(e,n,o,r){for(var i in o){var a=e[i],l=Array.isArray(a),s=l?"array":typeof a,c=!l&&Array.isArray(o[i]);if(!(s==="undefined"||s==="function")){if(c){var u=o[i];if(u.length===0)continue;u=u.map(this._handleRelativeValue.bind(this,a)),o[i]=[a].concat(u)}if((s==="object"||l)&&a&&!c){n[i]=l?[]:{};for(var d in a)n[i][d]=a[d];r[i]=l?[]:{},this._setupProperties(a,n[i],o[i],r[i])}else typeof n[i]>"u"&&(n[i]=a),l||(n[i]*=1),c?r[i]=o[i].slice().reverse():r[i]=n[i]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(e){return e===void 0&&(e=EC()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},t.prototype.resume=function(e){return e===void 0&&(e=EC()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},t.prototype.stopChainedTweens=function(){for(var e=0,n=this._chainedTweens.length;ei)return!1;n&&this.start(e)}if(this._goToEnd=!1,e1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var l=0,s=this._chainedTweens.length;l{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&(l.type===z.Human||l.type===z.Tree||l.type===z.Flower)){const s=l;s.flip=i;break}})},o=r=>{const i=r.target.checked,a={name:`Flip ${t.type}`,timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.flip,onChange:o,children:B.t("peopleMenu.Flip",e)})})}),G4o=xe.memo(({human:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Human&&l.id===r){l.observer=i;break}})},o=r=>{const i=r.target.checked,a={name:"Set Observer",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.observer,onChange:o,children:B.t("peopleMenu.Observer",e)})})}),X4o=xe.memo(({human:t})=>{const e=Kt(),[n,o]=g.useState(!1),r=g.useRef(0),i=g.useRef(-1),a=g.useRef(!0),l=g.useRef(!1);g.useEffect(()=>{if(l.current){if(a.current)return r.current=requestAnimationFrame(c),u(),()=>{cancelAnimationFrame(r.current)};a.current=!0}},[n]);const s=(f,p,m)=>{const y=jn.getState().orbitControlsRef;y!=null&&y.current&&(y.current.object.position.set(f,p,m),y.current.update(),H.getState().set(w=>{const x=w.viewState;x.cameraPosition=[f,p,m]}))},c=()=>{requestAnimationFrame(c);const f=Date.now();f-i.current>100&&(V4o(),i.current=f)},u=()=>{if(!t)return;let f=t.cx,p=t.cy,m=t.cz+t.lz;const y=H.getState().getParent(t);if(y){const C=ye.absoluteHumanOrTreeCoordinates(f,p,m,y);f=C.x,p=C.y,m=C.z}const w=H.getState().cameraDirection.clone().normalize().multiplyScalar(.5);f+=w.x,p+=w.y;const x=[...H.getState().viewState.cameraPosition];new _4o(x).to([f,p,m],1e3).easing(But.Quadratic.In).onUpdate(C=>{s(C[0],C[1],C[2])}).onComplete(()=>{H.getState().selectNone()}).start()},d=()=>{o(!n),l.current=!0};return h.jsx(ln,{onClick:d,children:B.t("peopleMenu.ViewFromThisPerson",e)})}),J4o=xe.memo(({tree:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Tree&&l.id===r){l.showModel=i;break}})},o=r=>{const i={name:"Show Tree Model",timestamp:Date.now(),checked:r,selectedElementId:t.id,selectedElementType:z.Tree,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};H.getState().addUndoable(i),n(t.id,r)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:(t==null?void 0:t.showModel)&&(t==null?void 0:t.type)===z.Tree,onChange:r=>o(r.target.checked),children:B.t("treeMenu.ShowModel",e)})})}),K4o=xe.memo(({tree:t})=>{const e=H.getState().updateElementLxById,n=Kt(),o=t.lx??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Spread",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),e(t.id,i),H.getState().set(l=>{l.actionState.treeSpread=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"100px"},children:[B.t("treeMenu.Spread",n)+" ("+B.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(mn,{style:{width:"160px"},min:1,max:50,step:1,precision:1,value:o,onChange:r})]})}),$4o=xe.memo(({tree:t})=>{const e=H.getState().updateElementLzById,n=Kt(),o=t.lz??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Height",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),e(t.id,i),H.getState().set(l=>{l.actionState.treeHeight=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"100px"},children:[B.t("word.Height",n)+" ("+B.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(mn,{style:{width:"160px"},min:1,max:30,step:1,precision:1,value:o,onChange:r})]})}),{Option:tl}=Ko,q4o=xe.memo(({human:t})=>{const e=H(pn),n=H(Fn),[o,r]=g.useState(!1),i=Kt(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Human&&u.id===l){const d=u;d.name=s,d.lx=hh.fetchWidth(s),d.lz=hh.fetchHeight(s);break}})};return h.jsxs(Ko,{style:{width:"140px"},value:(t==null?void 0:t.name)??Vt.Jack,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change People",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.humanName=l}),r(!o)}}},children:[h.jsxs(tl,{value:Vt.Jack,children:[h.jsx("img",{alt:Vt.Jack,src:DVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jack",i)]},Vt.Jack),h.jsxs(tl,{value:Vt.Jacob,children:[h.jsx("img",{alt:Vt.Jacob,src:EVe,height:20,style:{paddingRight:"16px"}})," ",B.t("people.Jacob",i)]},Vt.Jacob),h.jsxs(tl,{value:Vt.Jacqueline,children:[h.jsx("img",{alt:Vt.Jacqueline,src:kVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jacqueline",i)]},Vt.Jacqueline),h.jsxs(tl,{value:Vt.Jaah,children:[h.jsx("img",{alt:Vt.Jaah,src:zVe,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jaah",i)]},Vt.Jaah),h.jsxs(tl,{value:Vt.Jade,children:[h.jsx("img",{alt:Vt.Jade,src:FVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jade",i)]},Vt.Jade),h.jsxs(tl,{value:Vt.Jamelia,children:[h.jsx("img",{alt:Vt.Jamelia,src:LVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jamelia",i)]},Vt.Jamelia),h.jsxs(tl,{value:Vt.James,children:[h.jsx("img",{alt:Vt.James,src:WVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.James",i)]},Vt.James),h.jsxs(tl,{value:Vt.Jane,children:[h.jsx("img",{alt:Vt.Jane,src:NVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jane",i)]},Vt.Jane),h.jsxs(tl,{value:Vt.Jaya,children:[h.jsx("img",{alt:Vt.Jaya,src:UVe,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jaya",i)]},Vt.Jaya),h.jsxs(tl,{value:Vt.Jaye,children:[h.jsx("img",{alt:Vt.Jaye,src:jVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jaye",i)]},Vt.Jaye),h.jsxs(tl,{value:Vt.Jeanette,children:[h.jsx("img",{alt:Vt.Jeanette,src:BVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jeanette",i)]},Vt.Jeanette),h.jsxs(tl,{value:Vt.Jedi,children:[h.jsx("img",{alt:Vt.Jedi,src:YVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jedi",i)]},Vt.Jedi),h.jsxs(tl,{value:Vt.Jeff,children:[h.jsx("img",{alt:Vt.Jeff,src:OVe,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jeff",i)]},Vt.Jeff),h.jsxs(tl,{value:Vt.Jena,children:[h.jsx("img",{alt:Vt.Jena,src:_Ve,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jena",i)]},Vt.Jena),h.jsxs(tl,{value:Vt.Jennifer,children:[h.jsx("img",{alt:Vt.Jennifer,src:VVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jennifer",i)]},Vt.Jennifer),h.jsxs(tl,{value:Vt.Jess,children:[h.jsx("img",{alt:Vt.Jess,src:GVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jess",i)]},Vt.Jess),h.jsxs(tl,{value:Vt.Jett,children:[h.jsx("img",{alt:Vt.Jett,src:XVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jett",i)]},Vt.Jett),h.jsxs(tl,{value:Vt.Jill,children:[h.jsx("img",{alt:Vt.Jill,src:JVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jill",i)]},Vt.Jill),h.jsxs(tl,{value:Vt.Jiya,children:[h.jsx("img",{alt:Vt.Jiya,src:KVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jiya",i)]},Vt.Jiya),h.jsxs(tl,{value:Vt.Joan,children:[h.jsx("img",{alt:Vt.Joan,src:$Ve,height:20,style:{paddingRight:"8px"}})," ",B.t("people.Joan",i)]},Vt.Joan),h.jsxs(tl,{value:Vt.Jocelyn,children:[h.jsx("img",{alt:Vt.Jocelyn,src:qVe,height:20,style:{paddingRight:"23px"}})," ",B.t("people.Jocelyn",i)]},Vt.Jocelyn),h.jsxs(tl,{value:Vt.Joel,children:[h.jsx("img",{alt:Vt.Joel,src:QVe,height:20,style:{paddingRight:"7px"}})," ",B.t("people.Joel",i)]},Vt.Joel),h.jsxs(tl,{value:Vt.Joey,children:[h.jsx("img",{alt:Vt.Joey,src:ZVe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Joey",i)]},Vt.Joey),h.jsxs(tl,{value:Vt.John,children:[h.jsx("img",{alt:Vt.John,src:eGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.John",i)]},Vt.John),h.jsxs(tl,{value:Vt.Jonathon,children:[h.jsx("img",{alt:Vt.Jonathon,src:tGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jonathon",i)]},Vt.Jonathon),h.jsxs(tl,{value:Vt.Jose,children:[h.jsx("img",{alt:Vt.Jose,src:nGe,height:20,style:{paddingRight:"5px"}})," ",B.t("people.Jose",i)]},Vt.Jose),h.jsxs(tl,{value:Vt.Joseph,children:[h.jsx("img",{alt:Vt.Joseph,src:oGe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Joseph",i)]},Vt.Joseph),h.jsxs(tl,{value:Vt.Joshua,children:[h.jsx("img",{alt:Vt.Joshua,src:rGe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Joshua",i)]},Vt.Joshua),h.jsxs(tl,{value:Vt.Judd,children:[h.jsx("img",{alt:Vt.Judd,src:iGe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Judd",i)]},Vt.Judd),h.jsxs(tl,{value:Vt.Judy,children:[h.jsx("img",{alt:Vt.Judy,src:aGe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Judy",i)]},Vt.Judy),h.jsxs(tl,{value:Vt.Julia,children:[h.jsx("img",{alt:Vt.Julia,src:lGe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Julia",i)]},Vt.Julia),h.jsxs(tl,{value:Vt.Julio,children:[h.jsx("img",{alt:Vt.Julio,src:sGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Julio",i)]},Vt.Julio),h.jsxs(tl,{value:Vt.Jumapili,children:[h.jsx("img",{alt:Vt.Jumapili,src:cGe,height:20,style:{paddingRight:"16px"}})," ",B.t("people.Jumapili",i)]},Vt.Jumapili),h.jsxs(tl,{value:Vt.June,children:[h.jsx("img",{alt:Vt.June,src:uGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.June",i)]},Vt.June),h.jsxs(tl,{value:Vt.Juro,children:[h.jsx("img",{alt:Vt.Juro,src:dGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Juro",i)]},Vt.Juro),h.jsxs(tl,{value:Vt.Justin,children:[h.jsx("img",{alt:Vt.Justin,src:fGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Justin",i)]},Vt.Justin)]})}),Q4o=t=>{const e=[];if(t.type!==z.Human)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=H.getState().viewState.orthographic??!1;return e.push({key:"human-copy",label:h.jsx(ad,{})}),o&&e.push({key:"human-cut",label:h.jsx(ld,{})}),e.push({key:"human-lock",label:h.jsx(D0,{selectedElement:n})}),o&&e.push({key:"human-flip",label:h.jsx(D4e,{billboardModel:n})}),i||e.push({key:"human-move-view",label:h.jsx(X4o,{human:n})}),o&&(e.push({key:"human-obserber",label:h.jsx(G4o,{human:n})}),e.push({key:"human-selection",label:h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"120px"},children:[B.t("peopleMenu.ChangePerson",r),": "]}),h.jsx(q4o,{human:n})]})})),{items:e}},{Option:af}=Ko,Z4o=xe.memo(({flower:t})=>{const e=H(pn),n=H(Fn),[o,r]=g.useState(!1),i=Kt(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Flower&&u.id===l){const d=u;d.name=s,d.lx=i3.fetchSpread(s),d.lz=i3.fetchHeight(s);break}})};return h.jsxs(Ko,{style:{width:"200px"},value:(t==null?void 0:t.name)??uo.WhiteFlower,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Flower",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.flowerType=l}),r(!o)}}},children:[h.jsxs(af,{value:uo.WhiteFlower,children:[h.jsx("img",{alt:uo.WhiteFlower,src:bGe,height:20,style:{paddingRight:"17px"}})," ",B.t("flower.WhiteFlower",i)]},uo.WhiteFlower),h.jsxs(af,{value:uo.YellowFlower,children:[h.jsx("img",{alt:uo.YellowFlower,src:SGe,height:20,style:{paddingRight:"16px"}})," ",B.t("flower.YellowFlower",i)]},uo.YellowFlower),h.jsxs(af,{value:uo.Hibiscus,children:[h.jsx("img",{alt:uo.Hibiscus,src:pGe,height:20,style:{paddingRight:"19px"}})," ",B.t("flower.Hibiscus",i)]},uo.Hibiscus),h.jsxs(af,{value:uo.Hydrangea,children:[h.jsx("img",{alt:uo.Hydrangea,src:gGe,height:20,style:{paddingRight:"18px"}})," ",B.t("flower.Hydrangea",i)]},uo.Hydrangea),h.jsxs(af,{value:uo.Spirea,children:[h.jsx("img",{alt:uo.Spirea,src:wGe,height:20,style:{paddingRight:"18px"}})," ",B.t("flower.Spirea",i)]},uo.Spirea),h.jsxs(af,{value:uo.Hosta,children:[h.jsx("img",{alt:uo.Hosta,src:mGe,height:20,style:{paddingRight:"18px"}})," ",B.t("flower.Hosta",i)]},uo.Hosta),h.jsxs(af,{value:uo.Peony,children:[h.jsx("img",{alt:uo.Peony,src:yGe,height:20,style:{paddingRight:"17px"}})," ",B.t("flower.Peony",i)]},uo.Peony),h.jsxs(af,{value:uo.Boxwood,children:[h.jsx("img",{alt:uo.Boxwood,src:jde,height:20,style:{paddingRight:"23px"}})," ",B.t("flower.Boxwood",i)]},uo.Boxwood),h.jsxs(af,{value:uo.TallBush,children:[h.jsx("img",{alt:uo.TallBush,src:Vde,height:20,style:{paddingRight:"32px"}})," ",B.t("flower.TallBush",i)]},uo.TallBush),h.jsxs(af,{value:uo.CactusCombo1,children:[h.jsx("img",{alt:uo.CactusCombo1,src:Bde,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo1",i)]},uo.CactusCombo1),h.jsxs(af,{value:uo.CactusCombo2,children:[h.jsx("img",{alt:uo.CactusCombo2,src:Yde,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo2",i)]},uo.CactusCombo2),h.jsxs(af,{value:uo.CactusCombo3,children:[h.jsx("img",{alt:uo.CactusCombo3,src:Ode,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo3",i)]},uo.CactusCombo3),h.jsxs(af,{value:uo.CactusCombo4,children:[h.jsx("img",{alt:uo.CactusCombo4,src:_de,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo4",i)]},uo.CactusCombo4),h.jsxs(af,{value:uo.RedRose,children:[h.jsx("img",{alt:uo.RedRose,src:AGe,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.RedRose",i)]},uo.RedRose),h.jsxs(af,{value:uo.Bellflower,children:[h.jsx("img",{alt:uo.Bellflower,src:hGe,height:20,style:{paddingRight:"20px"}})," ",B.t("flower.Bellflower",i)]},uo.Bellflower),h.jsxs(af,{value:uo.Sunflower,children:[h.jsx("img",{alt:uo.Sunflower,src:xGe,height:20,style:{paddingRight:"32px"}})," ",B.t("flower.Sunflower",i)]},uo.Sunflower),h.jsxs(af,{value:uo.Tulip,children:[h.jsx("img",{alt:uo.Tulip,src:vGe,height:20,style:{paddingRight:"24px"}})," ",B.t("flower.Tulip",i)]},uo.Tulip)]})}),ewo=t=>{const e=[];if(t.type!==z.Flower)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"flower-copy",label:h.jsx(ad,{})}),o&&e.push({key:"flower-cut",label:h.jsx(ld,{})}),e.push({key:"flower-lock",label:h.jsx(D0,{selectedElement:n})}),o&&e.push({key:"flower-flip",label:h.jsx(D4e,{billboardModel:n})}),o&&e.push({key:"flower-change-type",label:h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"60px"},children:[B.t("flowerMenu.Type",r),": "]}),h.jsx(Z4o,{flower:n})]})}),{items:e}},two=({polygon:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.filled=i;break}})},o=r=>{const i={name:"Fill Polygon",timestamp:Date.now(),checked:!t.filled,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};H.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:B.t("polygonMenu.Filled",e)})})},nwo=({polygon:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.shininess=i;break}})},o=r=>{const a={name:"Shiny Polygon",timestamp:Date.now(),checked:((t==null?void 0:t.shininess)??0)>0,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,a.checked?0:100)},redo:()=>{n(t.id,a.checked?100:0)}};H.getState().addUndoable(a),n(t.id,r.target.checked?100:0)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.shininess,onChange:o,children:B.t("polygonMenu.Shiny",e)})})},owo=({polygon:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.noOutline=i;break}})},o=r=>{const i={name:"No Outline for Polygon",timestamp:Date.now(),checked:!t.noOutline,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};H.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.noOutline,onChange:o,children:B.t("polygonMenu.NoOutline",e)})})},rwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.text)??""),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.text=l);break}})},i=()=>{const a={name:"Set Text for Polygon",timestamp:Date.now(),oldValue:t.text??"",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("word.Text",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},iwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontSize)??1),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontSize=l);break}})},i=()=>{const a={name:"Set Font Size for Polygon",timestamp:Date.now(),oldValue:t.fontSize??1,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("word.FontSize",e),":"]}),min:.1,max:5,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},awo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontColor)??"black"),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontColor=l);break}})},i=()=>{const a={name:"Set Font Color for Polygon",timestamp:Date.now(),oldValue:t.fontColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("word.FontColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},lwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontOutlineColor)??"white"),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineColor=l);break}})},i=()=>{const a={name:"Set Font Outline Color for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineColor??"white",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontOutlineColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},swo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontOutlineWidth)??0),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineWidth=l);break}})},i=()=>{const a={name:"Set Font Outline Width for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontOutlineWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},cwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontStrokeColor)??"black"),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeColor=l);break}})},i=()=>{const a={name:"Set Font Stroke Color for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontStrokeColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},uwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontStrokeWidth)??0),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeWidth=l);break}})},i=()=>{const a={name:"Set Font Stroke Width for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontStrokeWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},dwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H($r),r=H(HPt),i=H(MPt),a=H(IPt),l=H(zPt),s=H(Fn),c=H(VM),u=H(GM),d=H(no),f=H(qn),p=ao(z.Polygon),[m,y]=g.useState((p==null?void 0:p.lineColor)??"black"),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&b!==T.lineColor)return!0;break;case ie.AllObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&b!==T.lineColor)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Polygon&&T.parentId===p.parentId&&ye.isIdentical(T.normal,p.normal)&&!T.locked&&T.lineColor!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Polygon&&T.foundationId===(p==null?void 0:p.foundationId)&&!T.locked&&T.lineColor!==b)return!0;break;default:if(b!==(p==null?void 0:p.lineColor))return!0}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Polygon&&!M.locked&&b.has(M.id)&&(M.lineColor=T)})},A=b=>{if(p&&C(b))switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.lineColor??"black");const R={name:"Set Line Color for Selected Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&T.set(M.id,M.lineColor??"black");const R={name:"Set Line Color for All Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,b),f(d+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const D of e)D.type===z.Polygon&&D.parentId===p.parentId&&ye.isIdentical(D.normal,p.normal)&&R.set(D.id,D.lineColor??"gray");const M={name:"Set Line Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:b,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{M.groupId&&i(z.Polygon,M.groupId,M.normal,M.newValue)}};s(M),i(z.Polygon,p.parentId,p.normal,b),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of e)M.type===z.Polygon&&M.foundationId===p.foundationId&&T.set(M.id,M.lineColor??"black");const R={name:"Set Line Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,b),f(d+1)}break}default:{const T=n(p.id),R=T?T.lineColor:p.lineColor,M={name:"Set Line Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}},S=()=>{t(!1)},v=()=>{A(m)};return h.jsx(ro,{width:600,title:B.t("polygonMenu.LineColor",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:m??(p==null?void 0:p.lineColor)??"black",onChangeComplete:b=>{y(b.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",w)})]})})})]})})},fwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(VM),l=H(GM),s=H(no),c=H(qn),u=ao(z.Polygon),[d,f]=g.useState((u==null?void 0:u.lineStyle)??Ap.Solid),p=Kt(),{Option:m}=Ko,y=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.Polygon&&k.id===R){k.lineStyle=M;break}})},w=(R,M,D)=>{e(k=>{for(const N of k.elements)N.type===z.Polygon&&N.parentId===R&&ye.isIdentical(N.normal,M)&&!N.locked&&(N.lineStyle=D)})},x=(R,M)=>{e(D=>{for(const k of D.elements)k.type===z.Polygon&&k.foundationId===R&&!k.locked&&(k.lineStyle=M)})},C=R=>{e(M=>{for(const D of M.elements)D.type===z.Polygon&&!D.locked&&(D.lineStyle=R)})},P=R=>{l(R.target.value)},A=R=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&R!==M.lineStyle)return!0;break;case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&R!==M.lineStyle)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const M of n)if(M.type===z.Polygon&&M.parentId===u.parentId&&ye.isIdentical(M.normal,u.normal)&&!M.locked&&R!==M.lineStyle)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.Polygon&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&R!==M.lineStyle)return!0;break;default:if(R!==(u==null?void 0:u.lineStyle))return!0}return!1}},S=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)k.type===z.Polygon&&!k.locked&&R.has(k.id)&&(k.lineStyle=M)})},v=R=>{if(u&&A(R))switch(a){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.lineStyle??Ap.Solid);const D={name:"Set Line Style for Selected Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{S(D.oldValues,D.newValue)}};i(D),S(M,R),c(s+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&M.set(k.id,k.lineStyle??Ap.Solid);const D={name:"Set Line Style for All Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{C(D.newValue)}};i(D),C(R),c(s+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(r(u)){const D=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&ye.isIdentical(N.normal,u.normal)&&D.set(N.id,N.lineStyle??Ap.Solid);const k={name:"Set Line Style for All Polygons on Same Surface",timestamp:Date.now(),oldValues:D,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of k.oldValues.entries())y(N,U)},redo:()=>{k.groupId&&w(k.groupId,k.normal,k.newValue)}};i(k),w(u.parentId,u.normal,R),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.Polygon&&k.foundationId===u.foundationId&&M.set(k.id,k.lineStyle??Ap.Solid);const D={name:"Set Line Style for All Polygons Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};i(D),x(u.foundationId,R),c(s+1)}break}default:{const M=o(u.id),D=M?M.lineStyle:u.lineStyle,k={name:"Set Line Style of Selected Polygon",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(k.changedElementId,k.oldValue)},redo:()=>{y(k.changedElementId,k.newValue)}};i(k),y(u.id,R),c(s+1);break}}},b=()=>{t(!1)},T=()=>{v(d)};return h.jsx(ro,{width:600,title:B.t("polygonMenu.LineStyle",p),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"200px"},value:d,onChange:R=>f(R),children:[h.jsxs(m,{value:Ap.Solid,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px solid dimGray"},children:" "}),B.t("polygonMenu.SolidLine",p)]},Ap.Solid),h.jsxs(m,{value:Ap.Dashed,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dashed dimGray"},children:" "}),B.t("polygonMenu.DashedLine",p)]},Ap.Dashed),h.jsxs(m,{value:Ap.Dotted,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dotted dimGray"},children:" "}),B.t("polygonMenu.DottedLine",p)]},Ap.Dotted)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",p)})]})})})]})})},hwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H($r),r=H(DPt),i=H(EPt),a=H(kPt),l=H(FPt),s=H(Fn),c=H(VM),u=H(GM),d=H(no),f=H(qn),p=ao(z.Polygon),[m,y]=g.useState((p==null?void 0:p.lineWidth)??1),w=Kt(),{Option:x}=Ko,C=T=>{u(T.target.value)},P=T=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&T!==R.lineWidth)return!0;break;case ie.AllObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&T!==R.lineWidth)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const R of e)if(R.type===z.Polygon&&R.parentId===p.parentId&&ye.isIdentical(R.normal,p.normal)&&!R.locked&&R.lineWidth!==T)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const R of e)if(R.type===z.Polygon&&R.foundationId===(p==null?void 0:p.foundationId)&&!R.locked&&R.lineWidth!==T)return!0;break;default:if(T!==(p==null?void 0:p.lineWidth))return!0}return!1}},A=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)D.type===z.Polygon&&!D.locked&&T.has(D.id)&&(D.lineWidth=R)})},S=T=>{if(p&&P(T))switch(c){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of e)D.type===z.Polygon&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.lineWidth??1);const M={name:"Set Line Width for Selected Polygons",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{A(M.oldValues,M.newValue)}};s(M),A(R,T),f(d+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of e)D.type===z.Polygon&&R.set(D.id,D.lineWidth??1);const M={name:"Set Line Width for All Polygons",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{l(z.Polygon,M.newValue)}};s(M),l(z.Polygon,T),f(d+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(o(p)){const M=new Map;for(const k of e)k.type===z.Polygon&&k.parentId===p.parentId&&ye.isIdentical(k.normal,p.normal)&&M.set(k.id,k.lineWidth??1);const D={name:"Set Line Width for All Polygons on Same Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[k,N]of D.oldValues.entries())r(k,N)},redo:()=>{D.groupId&&i(z.Polygon,D.groupId,D.normal,D.newValue)}};s(D),i(z.Polygon,p.parentId,p.normal,T),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const R=new Map;for(const D of e)D.type===z.Polygon&&D.foundationId===p.foundationId&&R.set(D.id,D.lineWidth??1);const M={name:"Set Line Width for All Polygons Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:p.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{M.groupId&&a(z.Polygon,M.groupId,M.newValue)}};s(M),a(z.Polygon,p.foundationId,T),f(d+1)}break}default:{const R=n(p.id),M=R?R.lineWidth:p.lineWidth,D={name:"Set Line Width of Selected Polygon",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(D.changedElementId,D.oldValue)},redo:()=>{r(D.changedElementId,D.newValue)}};s(D),r(p.id,T),f(d+1);break}}},v=()=>{t(!1)},b=()=>{S(m),t(!1),f(0)};return h.jsx(ro,{width:560,title:B.t("polygonMenu.LineWidth",w),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"200px"},value:m,onChange:T=>y(T),children:[h.jsx(x,{value:j2.One,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"1px solid dimGray"}})},j2.One),h.jsx(x,{value:j2.Two,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"2px solid dimGray"}})},j2.Two),h.jsx(x,{value:j2.Three,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"3px solid dimGray"}})},j2.Three),h.jsx(x,{value:j2.Four,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"4px solid dimGray"}})},j2.Four),h.jsx(x,{value:j2.Five,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"5px solid dimGray"}})},j2.Five)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:C,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",w)})]})})})]})})},pwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H($r),r=H(f5e),i=H(CPt),a=H(RPt),l=H(h5e),s=H(Fn),c=H(VM),u=H(GM),d=H(no),f=H(qn),p=ao(z.Polygon),[m,y]=g.useState((p==null?void 0:p.color)??"gray"),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&b!==T.color)return!0;break;case ie.AllObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&b!==T.color)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Polygon&&T.foundationId===p.foundationId&&!T.locked&&T.color!==b)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Polygon&&T.parentId===p.parentId&&ye.isIdentical(T.normal,p.normal)&&!T.locked&&T.color!==b)return!0;break;default:if(b!==p.color)return!0}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Polygon&&!M.locked&&b.has(M.id)&&(M.color=T)})},A=b=>{if(p&&C(b))switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.color??"gray");const R={name:"Set Fill Color for Selected Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&T.set(M.id,M.color??"gray");const R={name:"Set Fill Color for All Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,b),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of e)M.type===z.Polygon&&M.foundationId===p.foundationId&&T.set(M.id,M.color??"gray");const R={name:"Set Fill Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,b),f(d+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const D of e)D.type===z.Polygon&&D.parentId===p.parentId&&ye.isIdentical(D.normal,p.normal)&&R.set(D.id,D.color??"gray");const M={name:"Set Fill Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:b,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{M.groupId&&i(z.Polygon,M.groupId,M.normal,M.newValue)}};s(M),i(z.Polygon,p.parentId,p.normal,b),f(d+1)}break}default:{const T=n(p.id),R=T?T.color:p.color,M={name:"Set Fill Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}},S=()=>{t(!1)},v=()=>{A(m)};return h.jsx(ro,{width:600,title:B.t("polygonMenu.FillColor",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:m??(p==null?void 0:p.color)??"gray",onChangeComplete:b=>{y(b.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",w)})]})})})]})})},gwo="/aladdin/assets/polygon_08_menu-RpvWW3pg.png",mwo="/aladdin/assets/polygon_09_menu-CCH8lYni.png",ywo="/aladdin/assets/polygon_10_menu-BYFeRpsw.png",Awo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(VM),l=H(GM),s=H(no),c=H(qn),u=ao(z.Polygon),[d,f]=g.useState((u==null?void 0:u.textureType)??Zr.NoTexture),p=Kt(),{Option:m}=Ko,y=(R,M)=>{e(D=>{for(const k of D.elements)if(k.id===R&&k.type===z.Polygon&&!k.locked){k.textureType=M;break}})},w=(R,M,D)=>{e(k=>{for(const N of k.elements)N.type===z.Polygon&&N.parentId===R&&ye.isIdentical(N.normal,M)&&!N.locked&&(N.textureType=D)})},x=(R,M)=>{e(D=>{for(const k of D.elements)k.type===z.Polygon&&k.foundationId===R&&!k.locked&&(k.textureType=M)})},C=R=>{e(M=>{for(const D of M.elements)D.type===z.Polygon&&!D.locked&&(D.textureType=R)})},P=R=>{l(R.target.value)},A=R=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&R!==M.textureType)return!0;break;case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&R!==M.textureType)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const M of n)if(M.type===z.Polygon&&M.parentId===u.parentId&&ye.isIdentical(M.normal,u.normal)&&!M.locked&&M.textureType!==R)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.Polygon&&M.foundationId===u.foundationId&&!M.locked&&M.textureType!==R)return!0;break;default:if(R!==(u==null?void 0:u.textureType))return!0}return!1}},S=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)k.type===z.Polygon&&!k.locked&&R.has(k.id)&&(k.textureType=M)})},v=R=>{if(u&&A(R))switch(a){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.textureType??Zr.NoTexture);const D={name:"Set Texture for Selected Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{S(D.oldValues,D.newValue)}};i(D),S(M,R),c(s+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&M.set(k.id,k.textureType??Zr.NoTexture);const D={name:"Set Texture for All Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{C(D.newValue)}};i(D),C(R),c(s+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(r(u)){const D=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&ye.isIdentical(N.normal,u.normal)&&D.set(N.id,N.textureType??Zr.NoTexture);const k={name:"Set Texture for All Polygons on Same Surface",timestamp:Date.now(),oldValues:D,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of k.oldValues.entries())y(N,U)},redo:()=>{k.groupId&&w(k.groupId,k.normal,k.newValue)}};i(k),w(u.parentId,u.normal,R),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.Polygon&&k.foundationId===u.foundationId&&M.set(k.id,k.textureType??Zr.NoTexture);const D={name:"Set Texture for All Polygons Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};i(D),x(u.foundationId,R),c(s+1)}break}default:{const M=o(u.id),D=M?M.textureType:u.textureType,k={name:"Set Texture of Selected Polygon",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(k.changedElementId,k.oldValue)},redo:()=>{y(k.changedElementId,k.newValue)}};i(k),y(u.id,R),c(s+1);break}}},b=()=>{t(!1)},T=()=>{v(d)};return h.jsx(ro,{width:500,title:B.t("polygonMenu.FillTexture",p),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"150px"},value:d,onChange:R=>f(R),children:[h.jsxs(m,{value:Zr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",p)]},Zr.NoTexture),h.jsxs(m,{value:Zr.Texture01,children:[h.jsx("img",{alt:Zr.Texture01,src:gct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture01",p)]},Zr.Texture01),h.jsxs(m,{value:Zr.Texture02,children:[h.jsx("img",{alt:Zr.Texture02,src:mct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture02",p)]},Zr.Texture02),h.jsxs(m,{value:Zr.Texture03,children:[h.jsx("img",{alt:Zr.Texture03,src:yct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture03",p)]},Zr.Texture03),h.jsxs(m,{value:Zr.Texture04,children:[h.jsx("img",{alt:Zr.Texture04,src:Act,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture04",p)]},Zr.Texture04),h.jsxs(m,{value:Zr.Texture05,children:[h.jsx("img",{alt:Zr.Texture05,src:wct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture05",p)]},Zr.Texture05),h.jsxs(m,{value:Zr.Texture06,children:[h.jsx("img",{alt:Zr.Texture06,src:xct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture06",p)]},Zr.Texture06),h.jsxs(m,{value:Zr.Texture07,children:[h.jsx("img",{alt:Zr.Texture07,src:vct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture07",p)]},Zr.Texture07),h.jsxs(m,{value:Zr.Texture08,children:[h.jsx("img",{alt:Zr.Texture08,src:gwo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture08",p)]},Zr.Texture08),h.jsxs(m,{value:Zr.Texture09,children:[h.jsx("img",{alt:Zr.Texture09,src:mwo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture09",p)]},Zr.Texture09),h.jsxs(m,{value:Zr.Texture10,children:[h.jsx("img",{alt:Zr.Texture10,src:ywo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture10",p)]},Zr.Texture10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",p)})]})})})]})})},wwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(VM),r=H(GM),i=H(no),a=H(qn),l=H(Jn),s=H(pn),c=ao(z.Polygon),[u,d]=g.useState((c==null?void 0:c.opacity)!==void 0?c.opacity:1),f=Kt(),p=(A,S)=>{s(v=>{for(const b of v.elements)if(b.id===A){b.opacity=S;break}})},m=A=>{for(const[S,v]of A.entries())p(S,v)},y=(A,S)=>{for(const v of A.keys())p(v,S)},w=A=>{if(c){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Polygon&&A!==S.opacity&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Polygon&&A!==S.opacity&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Polygon&&S.foundationId===c.foundationId&&A!==S.opacity&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const S of e)if(S.type===z.Polygon&&S.parentId===c.parentId&&ye.isIdentical(S.normal,c.normal)&&A!==S.opacity&&!S.locked)return!0;break;default:if(A!==(c==null?void 0:c.opacity))return!0;break}return!1}},x=A=>{if(c&&w(A))switch(o){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of e)if(b.type===z.Polygon&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for Selected Polygons",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of e)if(b.type===z.Polygon&&!b.locked){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for All Polygons",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const S=new Map;for(const b of e)if(b.type===z.Polygon&&b.foundationId===c.foundationId&&!b.locked){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:c.foundationId,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{if(c.parentId){const S=new Map;for(const b of e)if(b.type===z.Polygon&&b.parentId===c.parentId&&ye.isIdentical(b.normal,c.normal)&&!b.locked){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:c.foundationId,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1)}break}default:if(c){const S=l(c.id),v=S.opacity!==void 0?S.opacity:c.opacity!==void 0?c.opacity:1,b={name:"Set Polygon Opacity",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};n(b),p(c.id,A),a(i+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("polygonMenu.Opacity",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.1,precision:1,value:u,formatter:A=>Number(A).toFixed(1),onChange:A=>d(A)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>r(A.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",f)})]})})})]})})};class ZH{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=ye.calculatePolygonBounds(e.vertices),m=(r===br.portrait?o.length:o.width)*a;if(s===Nl.upDown){const y=Math.floor(((p.maxX()-p.minX())*n.lx-m)/l),w=p.minX()+m/(2*n.lx)+d/n.lx,x=l/n.lx,C=.5*Math.abs(Math.cos(i))*m/n.lx,P={x:0,y:-.5},A={x:0,y:.5},S=void 0;for(let v=0;v<=y;v++){const b=w+v*x;P.x=A.x=b-C;const T=ye.polygonIntersections(P,A,e.vertices).sort((D,k)=>D.y-k.y);P.x=A.x=b+C;const R=ye.polygonIntersections(P,A,e.vertices).sort((D,k)=>D.y-k.y),M=Math.max(T.length,R.length)/2;if(M>0)for(let D=0;DD.x-k.x);P.y=A.y=b+C;const R=ye.polygonIntersections(P,A,e.vertices).sort((D,k)=>D.x-k.x),M=Math.max(T.length,R.length)/2;if(M>0)for(let D=0;D0)return Qa.makeSolarPanel(s,c,a*s.lx,(y+w)/2*s.ly,s.cz,br.portrait,d,f,u,$t,Oo,i,void 0,x*s.ly,l)}static makeLeftRightSegment(e,n,o,r,i,a,l,s,c,u,d,f,p){const m=Math.abs(e.x-n.x)0)return Qa.makeSolarPanel(s,c,(y+w)/2*s.lx,a*s.ly,s.cz,br.portrait,d,f,u,0,Oo,i,void 0,x*s.lx,l)}}class xwo{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=!ye.isZero(n.rotation[2]),m=[];for(const P of e.vertices)m.push({x:P.x*n.lx+n.cx,y:P.y*n.ly+n.cy});const y=p?ye.rotatePolygon(m,n.cx,n.cy,n.rotation[2]):m,w=ye.calculatePolygonBounds(y),x=(r===br.portrait?o.length:o.width)*a,C=.5*Math.abs(Math.cos(i))*x;if(s===Nl.eastWest){const P=w.maxY()-w.minY(),A=Math.floor((P-2*d-x)/l),S=w.minY()+x/2+d,v={x:w.minX(),y:0},b={x:w.maxX(),y:0};for(let T=0;T<=A;T++){const R=S+T*l;v.y=b.y=R-C;const M=ye.polygonIntersections(v,b,y).sort((N,U)=>N.x-U.x);v.y=b.y=R+C;const D=ye.polygonIntersections(v,b,y).sort((N,U)=>N.x-U.x),k=Math.max(M.length,D.length)/2;if(k>0)for(let N=0;N0){const oe=ye.relativeCoordinates((Y+O)/2,R,0,n),ee=Qa.makeSolarPanel(n,o,oe.x*n.lx,oe.y*n.ly,n.cz,br.portrait,c,u,i,-n.rotation[2],Oo,[0,0,0],void 0,Q,x);ee.referenceId=e.id,ye.changeOrientation(ee,o,r),f.push(ee)}}}}else if(s===Nl.northSouth){const P=w.maxX()-w.minX(),A=Math.floor((P-2*d-x)/l),S=w.minX()+x/2+d,v={x:0,y:w.minY()},b={x:0,y:w.maxY()};for(let T=0;T<=A;T++){const R=S+T*l;v.x=b.x=R-C;const M=ye.polygonIntersections(v,b,y).sort((N,U)=>N.y-U.y);v.x=b.x=R+C;const D=ye.polygonIntersections(v,b,y).sort((N,U)=>N.y-U.y),k=Math.max(M.length,D.length)/2;if(k>0)for(let N=0;N0){const oe=ye.relativeCoordinates(R,(_+G)/2,0,n),ee=Qa.makeSolarPanel(n,o,oe.x*n.lx,oe.y*n.ly,n.cz,br.portrait,c,u,i,-n.rotation[2]+$t,Oo,[0,0,0],void 0,Q,x);ee.referenceId=e.id,ye.changeOrientation(ee,o,r),f.push(ee)}}}}return f}}const{Option:Qx}=Ko,vwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H.getState().solarPanelArrayLayoutParams,r=H(HS),i=H($r),a=H(jM),l=H(BM),s=H(O5),c=H(xPt),u=H(XPt),d=H(m5e),f=H(GPt),p=H(Fn),m=H(no),y=H(qn),w=H(Ji),[x,C]=g.useState(!1),[P,A]=g.useState(!1),[S,v]=g.useState(!1),[b,T]=g.useState({left:0,top:0,bottom:0,right:0}),R=g.useRef(null),M=g.useRef(!0),D=g.useRef(null),k=g.useRef(null),N=g.useRef(!1),U=g.useRef(H(qbt)),W=g.useRef(H(Qbt)),F=g.useRef(H(iSt)),E=g.useRef(H(rSt)),L=g.useRef(H(Zbt)),j=g.useRef(H(eSt)),Y=g.useRef(H(tSt)??0),O=g.useRef(H(nSt)),_=g.useRef(H(oSt)),G=Kt(),Q=s(U.current),oe=r(),ee=g.useMemo(()=>({...l,...a}),[a,l]);g.useEffect(()=>{var pe;(pe=D.current)==null||pe.focus()},[]),g.useEffect(()=>{var pe;P&&((pe=k.current)==null||pe.focus())},[P]);const q=(pe,Ie)=>{if(R.current){const{clientWidth:ve,clientHeight:ze}=window.document.documentElement,Ae=R.current.getBoundingClientRect();T({left:-Ae.left+Ie.x,right:ve-(Ae.right-Ie.x),top:-Ae.top+Ie.y,bottom:ze-((Ae==null?void 0:Ae.bottom)-Ie.y)})}},ae=()=>{const pe=(F.current===br.portrait?Q.length:Q.width)*L.current;return .5*(pe*Math.abs(Math.sin(E.current)))>O.current?(co(B.t("message.SolarPanelsCannotIntersectWithGround",G)),!1):pe>j.current?(co(B.t("message.SolarPanelsCannotOverlapWithOneAnother",G)),!1):!0},Z=pe=>{const Ie=n.filter(ve=>ve.type===z.SolarPanel&&ve.parentId===pe.parentId);if(Ie.length>0)for(const ve of Ie)ve.referenceId!==pe.id&&ye.isPointInside(ve.cx,ve.cy,pe.vertices)&&c(ve.id,pe.id)},ne=()=>{if((oe==null?void 0:oe.type)===z.Polygon){const pe=i(oe);if(pe){const Ie=[],ze=W.current===Nl.eastWest||W.current===Nl.northSouth?xwo.create(oe,pe,Q,F.current,E.current,L.current,j.current,W.current,O.current,_.current,Y.current):ZH.create(oe,pe,Q,F.current,E.current,L.current,j.current,W.current,O.current,_.current,Y.current);if(ze.length>0){for(const se of ze)Ie.push(JSON.parse(JSON.stringify(se))),e(ge=>{ge.elements.push(se)});const Ae={name:"Solar Panel Array Layout",timestamp:Date.now(),oldElements:H.getState().deletedElements,newElements:Ie,oldParams:{pvModelName:o.pvModelName,rowAxis:o.rowAxis,orientation:o.orientation,tiltAngle:o.tiltAngle,rowsPerRack:o.rowsPerRack,interRowSpacing:o.interRowSpacing,poleHeight:o.poleHeight,poleSpacing:o.poleSpacing,margin:o.margin},newParams:{pvModelName:U.current,rowAxis:W.current,orientation:F.current,tiltAngle:E.current,rowsPerRack:L.current,interRowSpacing:j.current,poleHeight:O.current,poleSpacing:_.current,margin:Y.current},referenceId:oe.id,undo:()=>{d(Ae.referenceId,!1),Ae.oldElements.length>0&&e(se=>{for(const ge of Ae.oldElements)se.elements.push(ge)}),te(Ae.oldParams),$()},redo:()=>{d(Ae.referenceId,!1),Ae.newElements.length>0&&e(se=>{for(const ge of Ae.newElements)se.elements.push(ge)}),te(Ae.newParams),$()}};p(Ae),y(m+1)}}M.current=!1,$()}},te=pe=>{U.current=pe.pvModelName,W.current=pe.rowAxis,F.current=pe.orientation,E.current=pe.tiltAngle,L.current=pe.rowsPerRack,j.current=pe.interRowSpacing,O.current=pe.poleHeight,_.current=pe.poleSpacing,Y.current=pe.margin??0},$=()=>{e(pe=>{pe.solarPanelArrayLayoutParams.pvModelName=U.current,pe.solarPanelArrayLayoutParams.rowAxis=W.current,pe.solarPanelArrayLayoutParams.orientation=F.current,pe.solarPanelArrayLayoutParams.tiltAngle=E.current,pe.solarPanelArrayLayoutParams.rowsPerRack=L.current,pe.solarPanelArrayLayoutParams.interRowSpacing=j.current,pe.solarPanelArrayLayoutParams.poleHeight=O.current,pe.solarPanelArrayLayoutParams.poleSpacing=_.current,pe.solarPanelArrayLayoutParams.margin=Y.current})},le=()=>{M.current&&(ae()?oe&&(Z(oe),u(oe.id)>0?A(!0):(f(),ne())):co(B.t("polygonMenu.LayoutNotAcceptedCheckYourParameters",G)))},de=()=>{le(),N.current=!1},he=()=>{t(!1),w(),M.current=!0,N.current=!1},me=()=>{M.current?(le(),N.current=!0):t(!1)},ce=()=>{A(!1)},Pe=()=>{oe&&(d(oe.id,!0),ne(),N.current&&(t(!1),y(0))),A(!1)};return h.jsxs(h.Fragment,{children:[P&&h.jsx(li,{width:400,open:P,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>v(!0),onMouseOut:()=>v(!1),children:B.t("word.Reminder",G)}),footer:[h.jsx(oo,{onClick:ce,children:B.t("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:k,onClick:Pe,children:B.t("word.OK",G)},"OK")],children:B.t("message.ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout",G)+" "+B.t("message.DoYouWantToContinue",G)}),h.jsxs(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>v(!0),onMouseOut:()=>v(!1),children:B.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",G)}),footer:[h.jsx(oo,{disabled:!M.current,onClick:de,children:B.t("word.Apply",G)},"Apply"),h.jsx(oo,{onClick:he,children:B.t("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:D,onClick:me,children:B.t("word.OK",G)},"OK")],onCancel:()=>{t(!1),M.current=!0},maskClosable:!1,destroyOnClose:!1,modalRender:pe=>h.jsx(Vi,{disabled:!S,bounds:b,onStart:(Ie,ve)=>q(Ie,ve),children:h.jsx("div",{ref:R,children:pe})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px",paddingTop:"10px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(ee).length+" "+B.t("word.Options",G)+"):"}),h.jsx(Ge,{span:11,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:U.current,onChange:pe=>{pe!==null&&(U.current=pe,M.current=!0,C(!x))},children:Object.keys(ee).map(pe=>h.jsx(Qx,{value:pe,children:pe+(ee[pe].bifacialityFactor>0?" ("+B.t("pvModelPanel.Bifacial",G)+")":"")},pe))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{style:{width:"100%"},value:W.current,onChange:pe=>{pe!==null&&(W.current=pe,M.current=!0,C(!x))},children:[h.jsx(Qx,{value:Nl.leftRight,children:B.t("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},Nl.leftRight),h.jsx(Qx,{value:Nl.upDown,children:B.t("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},Nl.upDown),h.jsx(Qx,{value:Nl.eastWest,children:B.t("polygonMenu.SolarPanelArrayEastWestRowAxis",G)},Nl.eastWest),h.jsx(Qx,{value:Nl.northSouth,children:B.t("polygonMenu.SolarPanelArrayNorthSouthRowAxis",G)},Nl.northSouth)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{style:{width:"100%"},value:F.current,onChange:pe=>{pe!==null&&(F.current=pe,M.current=!0,C(!x))},children:[h.jsx(Qx,{value:br.portrait,children:B.t("solarPanelMenu.Portrait",G)},br.portrait),h.jsx(Qx,{value:br.landscape,children:B.t("solarPanelMenu.Landscape",G)},br.landscape)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayTiltAngle",G)+" ([-90°, 90°]): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:-90,max:90,style:{width:"100%"},precision:2,value:parseFloat(ye.toDegrees(E.current).toFixed(2)),step:1,formatter:pe=>`${pe}°`,onChange:pe=>{pe!==null&&(E.current=ye.toRadians(pe),M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayRowWidth",G)+" ([1-100] "+B.t("solarPanelMenu.Panels",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:1,max:100,step:1,style:{width:"100%"},precision:0,formatter:pe=>Number(pe).toFixed(0),value:L.current,onChange:pe=>{pe!==null&&(L.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayInterRowSpacing",G)+" ([1, 20] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:1,max:20,style:{width:"100%"},precision:2,value:j.current,step:.5,onChange:pe=>{pe!==null&&(j.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayMargin",G)+" ([0, 5] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:0,max:5,style:{width:"100%"},precision:1,value:Y.current,step:.1,onChange:pe=>{pe!==null&&(Y.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayPoleHeight",G)+" ([0, 10] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:0,max:10,style:{width:"100%"},precision:2,value:O.current,step:.1,onChange:pe=>{pe!==null&&(O.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayPoleSpacing",G)+" ([2, 50] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:2,max:50,style:{width:"100%"},precision:2,value:_.current,step:.5,onChange:pe=>{pe!==null&&(_.current=pe,M.current=!0,C(!x))}})})]})]})]})},{Option:hp}=Ko,bwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),i=H(jM),a=H(BM),l=H(q3),s=H($r),c=H($3),u=H(w4).geneticAlgorithmParams,d=H(MQ),f=H(ZRt),p=H(CQ),[m,y]=g.useState(!1),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S=g.useRef(u.objectiveFunctionType),v=g.useRef(u.selectionMethod),b=g.useRef(u.searchMethod),T=g.useRef(u.populationSize),R=g.useRef(u.maximumGenerations),M=g.useRef(u.mutationRate),D=g.useRef(u.selectionRate??.5),k=g.useRef(u.crossoverRate??.5),N=g.useRef(u.convergenceThreshold),U=g.useRef(u.localSearchRadius),W=g.useRef(d.minimumTiltAngle??-$t),F=g.useRef(d.maximumTiltAngle??$t),E=g.useRef(d.minimumRowsPerRack),L=g.useRef(d.maximumRowsPerRack),j=g.useRef(d.minimumInterRowSpacing),Y=g.useRef(d.maximumInterRowSpacing),O=g.useRef(null),_=g.useMemo(()=>({...a,...i}),[i,a]);g.useEffect(()=>{var pe;(pe=O.current)==null||pe.focus()},[]);const G={lng:o},Q=g.useRef(d.rowAxis??Nl.leftRight),oe=l?s(l):void 0,ee=oe?c(z.SolarPanel,oe.id):void 0,q=g.useRef(ee&&ee.length>0?ee[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),ae=g.useRef(ee&&ee.length>0?ee[0].orientation:d.orientation??br.landscape),Z=g.useRef(ee&&ee.length>0?ee[0].poleHeight:d.poleHeight??1),ne=g.useRef(ee&&ee.length>0?ee[0].poleSpacing:d.poleSpacing??3),te=g.useRef(d.margin??0),$=g.useRef(p.electricitySellingPrice),le=g.useRef(p.operationalCostPerUnit);g.useEffect(()=>{$.current=p.electricitySellingPrice},[p.electricitySellingPrice]),g.useEffect(()=>{le.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const de=(pe,Ie)=>{if(A.current){const{clientWidth:ve,clientHeight:ze}=window.document.documentElement,Ae=A.current.getBoundingClientRect();P({left:-Ae.left+Ie.x,right:ve-(Ae.right-Ie.x),top:-Ae.top+Ie.y,bottom:ze-((Ae==null?void 0:Ae.bottom)-Ie.y)})}},he=()=>{e(pe=>{pe.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Pi.SOLAR_PANEL_ARRAY,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=S.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=v.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=b.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=T.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=R.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=D.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=k.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=M.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=N.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=U.current,pe.solarPanelArrayLayoutConstraints||(pe.solarPanelArrayLayoutConstraints=new kJ),pe.solarPanelArrayLayoutConstraints.minimumRowsPerRack=E.current,pe.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,pe.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,pe.solarPanelArrayLayoutConstraints.maximumTiltAngle=F.current,pe.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,pe.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=Y.current,pe.solarPanelArrayLayoutConstraints.poleHeight=Z.current,pe.solarPanelArrayLayoutConstraints.poleSpacing=ne.current,pe.solarPanelArrayLayoutConstraints.pvModelName=q.current,pe.solarPanelArrayLayoutConstraints.rowAxis=Q.current,pe.solarPanelArrayLayoutConstraints.orientation=ae.current,pe.solarPanelArrayLayoutConstraints.margin=te.current,pe.economicsParams.operationalCostPerUnit=le.current,pe.economicsParams.electricitySellingPrice=$.current})},me=()=>{r||yn(ce("message.EvolutionStarted",G)),he(),setTimeout(()=>{dt.getState().set(pe=>{pe.runEvolution=!pe.runEvolution}),e(pe=>{pe.evolutionMethod=ec.GENETIC_ALGORITHM,n&&(pe.actionInfo={name:"Run Genetic Algorithm for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...H.getState().evolutionaryAlgorithmState.geneticAlgorithmParams,...H.getState().solarPanelArrayLayoutConstraints,...H.getState().economicsParams}})})},100)},{t:ce}=Jl(),Pe=[{key:"1",label:ce("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.Objective",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:S.current,style:{width:"100%"},value:S.current,onChange:pe=>{S.current=pe,y(!m)},children:[h.jsx(hp,{value:Mo.DAILY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(hp,{value:Mo.YEARLY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Mo.YEARLY_TOTAL_OUTPUT),h.jsx(hp,{value:Mo.DAILY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Mo.DAILY_AVERAGE_OUTPUT),h.jsx(hp,{value:Mo.YEARLY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Mo.YEARLY_AVERAGE_OUTPUT),h.jsx(hp,{value:Mo.DAILY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Mo.DAILY_PROFIT),h.jsx(hp,{value:Mo.YEARLY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Mo.YEARLY_PROFIT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.GeneticAlgorithmSelectionMethod",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:v.current,style:{width:"100%"},value:v.current,onChange:pe=>{v.current=pe,y(!m)},children:[h.jsx(hp,{value:by.ROULETTE_WHEEL,children:ce("optimizationMenu.RouletteWheel",G)},by.ROULETTE_WHEEL),h.jsx(hp,{value:by.TOURNAMENT,children:ce("optimizationMenu.Tournament",G)},by.TOURNAMENT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.PopulationSize",G)+" [10, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,value:T.current,step:1,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{pe!==null&&(T.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MaximumGenerations",G)+" [5, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:R.current,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{pe!==null&&(R.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SelectionRate",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:D.current,step:.01,onChange:pe=>{pe!==null&&(D.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.CrossoverRate",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:k.current,step:.01,onChange:pe=>{pe!==null&&(k.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MutationRate",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:M.current,step:.01,onChange:pe=>{pe!==null&&(M.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:pe=>{pe!==null&&(N.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:b.current,style:{width:"100%"},value:b.current,onChange:pe=>{b.current=Number(pe),y(!m)},children:[h.jsx(hp,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:ce("optimizationMenu.GlobalSearchUniformSelection",G)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(hp,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:ce("optimizationMenu.LocalSearchRandomOptimization",G)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),b.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:pe=>{pe!==null&&(U.current=Number(pe),y(!m))}})})]})]})},{key:"2",label:ce("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{W.current=ye.toRadians(pe[0]),F.current=ye.toRadians(pe[1]),y(!m)},min:-90,max:90,defaultValue:[ye.toDegrees(W.current),ye.toDegrees(F.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{E.current=pe[0],L.current=pe[1],y(!m)},min:1,max:9,defaultValue:[E.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{j.current=pe[0],Y.current=pe[1],y(!m)},min:1,max:10,defaultValue:[j.current,Y.current],marks:{1:{style:{fontSize:"10px"},label:"1m"},3:{style:{fontSize:"10px"},label:"3m"},5:{style:{fontSize:"10px"},label:"5m"},7:{style:{fontSize:"10px"},label:"7m"},9:{style:{fontSize:"10px"},label:"9m"}}})})]})]})},{key:"3",label:ce("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(_).length+" "+ce("word.Options",G)+"):"}),h.jsx(Ge,{span:12,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:q.current,onChange:pe=>{q.current=pe,y(!m)},children:Object.keys(_).map(pe=>h.jsx(hp,{value:pe,children:pe+(_[pe].bifacialityFactor>0?" ("+ce("pvModelPanel.Bifacial",G)+")":"")},pe))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:Q.current,onChange:pe=>{Q.current=pe,y(!m)},children:[h.jsx(hp,{value:Nl.leftRight,children:ce("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},Nl.leftRight),h.jsx(hp,{value:Nl.upDown,children:ce("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},Nl.upDown)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:ae.current,onChange:pe=>{ae.current=pe,y(!m)},children:[h.jsx(hp,{value:br.portrait,children:ce("solarPanelMenu.Portrait",G)},br.portrait),h.jsx(hp,{value:br.landscape,children:ce("solarPanelMenu.Landscape",G)},br.landscape)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{te.current=pe,y(!m)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{Z.current=pe,y(!m)},min:0,max:10,step:.1,defaultValue:Z.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{ne.current=pe,y(!m)},min:2,max:10,step:.1,defaultValue:ne.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{le.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:le.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{$.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:$.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:ce("optimizationMenu.SolarPanelArrayLayout",G)+": "+ce("optimizationMenu.GeneticAlgorithmSettings",G)}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:ce("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:O,onClick:()=>{me(),t(!1)},children:ce("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:pe=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(Ie,ve)=>de(Ie,ve),children:h.jsx("div",{ref:A,children:pe})}),children:h.jsx(dee,{defaultActiveKey:f,items:Pe,type:"card",onChange:pe=>{e(Ie=>{Ie.geneticAlgorithmWizardSelectedTab=pe})}})})})},{Option:Dg}=Ko,Swo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),i=H(jM),a=H(BM),l=H(q3),s=H($r),c=H($3),u=H(w4).particleSwarmOptimizationParams,d=H(MQ),f=H(eHt),p=H(CQ),[m,y]=g.useState(!1),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S=g.useRef(u.objectiveFunctionType),v=g.useRef(u.searchMethod),b=g.useRef(u.swarmSize),T=g.useRef(u.maximumSteps),R=g.useRef(u.vmax??.01),M=g.useRef(u.inertia??.8),D=g.useRef(u.cognitiveCoefficient??.1),k=g.useRef(u.socialCoefficient??.1),N=g.useRef(u.convergenceThreshold),U=g.useRef(u.localSearchRadius),W=g.useRef(d.minimumTiltAngle??-$t),F=g.useRef(d.maximumTiltAngle??$t),E=g.useRef(d.minimumRowsPerRack),L=g.useRef(d.maximumRowsPerRack),j=g.useRef(d.minimumInterRowSpacing),Y=g.useRef(d.maximumInterRowSpacing),O=g.useRef(null),_=g.useMemo(()=>({...a,...i}),[i,a]);g.useEffect(()=>{var pe;(pe=O.current)==null||pe.focus()},[]);const G={lng:o},Q=g.useRef(d.rowAxis??Nl.leftRight),oe=l?s(l):void 0,ee=oe?c(z.SolarPanel,oe.id):void 0,q=g.useRef(ee&&ee.length>0?ee[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),ae=g.useRef(ee&&ee.length>0?ee[0].orientation:d.orientation??br.landscape),Z=g.useRef(ee&&ee.length>0?ee[0].poleHeight:d.poleHeight??1),ne=g.useRef(ee&&ee.length>0?ee[0].poleSpacing:d.poleSpacing??3),te=g.useRef(d.margin??0),$=g.useRef(p.electricitySellingPrice),le=g.useRef(p.operationalCostPerUnit);g.useEffect(()=>{$.current=p.electricitySellingPrice},[p.electricitySellingPrice]),g.useEffect(()=>{le.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const de=(pe,Ie)=>{if(A.current){const{clientWidth:ve,clientHeight:ze}=window.document.documentElement,Ae=A.current.getBoundingClientRect();P({left:-Ae.left+Ie.x,right:ve-(Ae.right-Ie.x),top:-Ae.top+Ie.y,bottom:ze-((Ae==null?void 0:Ae.bottom)-Ie.y)})}},he=()=>{e(pe=>{pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Pi.SOLAR_PANEL_ARRAY,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=S.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=v.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=b.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=T.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=D.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=k.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=R.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=M.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=N.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=U.current,pe.solarPanelArrayLayoutConstraints||(pe.solarPanelArrayLayoutConstraints=new kJ),pe.solarPanelArrayLayoutConstraints.minimumRowsPerRack=E.current,pe.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,pe.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,pe.solarPanelArrayLayoutConstraints.maximumTiltAngle=F.current,pe.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,pe.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=Y.current,pe.solarPanelArrayLayoutConstraints.poleHeight=Z.current,pe.solarPanelArrayLayoutConstraints.poleSpacing=ne.current,pe.solarPanelArrayLayoutConstraints.pvModelName=q.current,pe.solarPanelArrayLayoutConstraints.rowAxis=Q.current,pe.solarPanelArrayLayoutConstraints.orientation=ae.current,pe.solarPanelArrayLayoutConstraints.margin=te.current,pe.economicsParams.operationalCostPerUnit=le.current,pe.economicsParams.electricitySellingPrice=$.current})},me=()=>{r||yn(ce("message.EvolutionStarted",G)),he(),setTimeout(()=>{dt.getState().set(pe=>{pe.runEvolution=!pe.runEvolution}),e(pe=>{pe.evolutionMethod=ec.PARTICLE_SWARM_OPTIMIZATION,n&&(pe.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...H.getState().evolutionaryAlgorithmState.particleSwarmOptimizationParams,...H.getState().solarPanelArrayLayoutConstraints,...H.getState().economicsParams}})})},100)},{t:ce}=Jl(),Pe=[{key:"1",label:ce("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.Objective",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:S.current,style:{width:"100%"},value:S.current,onChange:pe=>{S.current=pe,y(!m)},children:[h.jsx(Dg,{value:Mo.DAILY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(Dg,{value:Mo.YEARLY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Mo.YEARLY_TOTAL_OUTPUT),h.jsx(Dg,{value:Mo.DAILY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Mo.DAILY_AVERAGE_OUTPUT),h.jsx(Dg,{value:Mo.YEARLY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Mo.YEARLY_AVERAGE_OUTPUT),h.jsx(Dg,{value:Mo.DAILY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Mo.DAILY_PROFIT),h.jsx(Dg,{value:Mo.YEARLY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Mo.YEARLY_PROFIT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SwarmSize",G)+" [10, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,value:b.current,step:1,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{b.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MaximumSteps",G)+" [5, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:T.current,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{T.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.CognitiveCoefficient",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:D.current,step:.01,onChange:pe=>{D.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SocialCoefficient",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:k.current,step:.01,onChange:pe=>{k.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.InertiaWeight",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:M.current,step:.01,onChange:pe=>{M.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MaximumVelocity",G)+" [0.001, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:R.current,step:.001,onChange:pe=>{R.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:pe=>{N.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:v.current,style:{width:"100%"},value:v.current,onChange:pe=>{v.current=Number(pe),y(!m)},children:[h.jsx(Dg,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:ce("optimizationMenu.GlobalSearchUniformSelection",G)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(Dg,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:ce("optimizationMenu.LocalSearchRandomOptimization",G)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),v.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:pe=>{U.current=Number(pe),y(!m)}})})]})]})},{key:"2",label:ce("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{W.current=ye.toRadians(pe[0]),F.current=ye.toRadians(pe[1]),y(!m)},min:-90,max:90,defaultValue:[ye.toDegrees(W.current),ye.toDegrees(F.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{E.current=pe[0],L.current=pe[1],y(!m)},min:1,max:9,defaultValue:[E.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{j.current=pe[0],Y.current=pe[1],y(!m)},min:2,max:10,defaultValue:[j.current,Y.current],marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]})]})},{key:"3",label:ce("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(_).length+" "+ce("word.Options",G)+"):"}),h.jsx(Ge,{span:12,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:q.current,onChange:pe=>{q.current=pe,y(!m)},children:Object.keys(_).map(pe=>h.jsx(Dg,{value:pe,children:pe+(_[pe].bifacialityFactor>0?" ("+ce("pvModelPanel.Bifacial",G)+")":"")},pe))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:Q.current,onChange:pe=>{Q.current=pe,y(!m)},children:[h.jsx(Dg,{value:Nl.leftRight,children:ce("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},Nl.leftRight),h.jsx(Dg,{value:Nl.upDown,children:ce("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},Nl.upDown)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:ae.current,onChange:pe=>{ae.current=pe,y(!m)},children:[h.jsx(Dg,{value:br.portrait,children:ce("solarPanelMenu.Portrait",G)},br.portrait),h.jsx(Dg,{value:br.landscape,children:ce("solarPanelMenu.Landscape",G)},br.landscape)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{te.current=pe,y(!m)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{Z.current=pe,y(!m)},min:0,max:10,step:.1,defaultValue:Z.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{ne.current=pe,y(!m)},min:2,max:10,step:.1,defaultValue:ne.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{le.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:le.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{$.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:$.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:ce("optimizationMenu.SolarPanelArrayLayout",G)+": "+ce("optimizationMenu.ParticleSwarmOptimizationSettings",G)}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:ce("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:O,onClick:()=>{me(),t(!1)},children:ce("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:pe=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(Ie,ve)=>de(Ie,ve),children:h.jsx("div",{ref:A,children:pe})}),children:h.jsx(dee,{defaultActiveKey:f,items:Pe,type:"card",onChange:pe=>{e(Ie=>{Ie.particleSwarmOptimizationWizardSelectedTab=pe})}})})})},Two=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o=H.getState().getParent(n),r={lng:H.getState().language},i=!n.locked;return e.push({key:"polygon-paste",label:h.jsx(yI,{})}),e.push({key:"polygon-copy",label:h.jsx(ad,{})}),i&&e.push({key:"polygon-cut",label:h.jsx(ld,{})}),o&&(o.type===z.Foundation||o.type===z.Cuboid)&&e.push({key:"polygon-layout-submenu",label:h.jsx(ln,{children:B.t("polygonMenu.Layout",r)}),children:[{key:"solar-panel-layout-wizard",label:h.jsxs(Zn,{noPadding:!0,Dialog:vwo,children:[B.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",r)," ..."]})},{key:"solar-panel-layout-ai",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.SolarPanelArrayLayoutGenerativeDesign",r)}),children:[{key:"solar-panel-layout-ga",label:h.jsxs(Zn,{noPadding:!0,Dialog:bwo,children:[B.t("optimizationMenu.GeneticAlgorithm",r)," ..."]})},{key:"solar-panel-layout-pso",label:h.jsxs(Zn,{noPadding:!0,Dialog:Swo,children:[B.t("optimizationMenu.ParticleSwarmOptimization",r)," ..."]})}]}]}),e.push({key:"polygon-lock",label:h.jsx(D0,{selectedElement:n})}),i&&(e.push({key:"polygon-filled",label:h.jsx(two,{polygon:n})}),n.filled&&e.push({key:"polygon-shiny",label:h.jsx(nwo,{polygon:n})}),e.push({key:"polygon-no-outline",label:h.jsx(owo,{polygon:n})})),i&&(e.push({key:"polygon-line-color",label:h.jsxs(Zn,{Dialog:dwo,children:[B.t("polygonMenu.LineColor",r)," ..."]})},{key:"polygon-line-style",label:h.jsxs(Zn,{Dialog:fwo,children:[B.t("polygonMenu.LineStyle",r)," ..."]})},{key:"polygon-line-width",label:h.jsxs(Zn,{Dialog:hwo,children:[B.t("polygonMenu.LineWidth",r)," ..."]})}),n.filled&&((!n.textureType||n.textureType===Zr.NoTexture)&&e.push({key:"polygon-fill-color",label:h.jsxs(Zn,{Dialog:pwo,children:[B.t("polygonMenu.FillColor",r)," ..."]})}),e.push({key:"polygon-texture",label:h.jsxs(Zn,{Dialog:Awo,children:[B.t("polygonMenu.FillTexture",r)," ..."]})},{key:"polygon-opacity",label:h.jsxs(Zn,{Dialog:wwo,children:[B.t("polygonMenu.Opacity",r)," ..."]})})),e.push({key:"polygon-text-box",label:h.jsx(ln,{children:B.t("polygonMenu.TextBox",r)}),children:[{key:"polygon-text",label:h.jsx(rwo,{polygon:n})},{key:"polygon-font-size",label:h.jsx(iwo,{polygon:n})},{key:"polygon-font-color",label:h.jsx(awo,{polygon:n})},{key:"polygon-font-outline-color",label:h.jsx(lwo,{polygon:n})},{key:"polygon-font-outline-width",label:h.jsx(swo,{polygon:n})},{key:"polygon-font-stroke-color",label:h.jsx(cwo,{polygon:n})},{key:"polygon-font-stroke-width",label:h.jsx(uwo,{polygon:n})}]})),{items:e}},Pwo=(t,e)=>{H.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){o.vertices.splice(e,1);break}})},Cwo=(t,e)=>{H.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>0&&e{H.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>=0&&e{if(t.selectedIndex>=0){const n=t.vertices.map(i=>({...i}));switch(e){case db.Delete:Pwo(t.id,t.selectedIndex);break;case db.InsertBeforeIndex:Cwo(t.id,t.selectedIndex);break;case db.InsertAfterIndex:Rwo(t.id,t.selectedIndex);break}const o=H.getState().getElementById(t.id).vertices.map(i=>({...i})),r={name:e,timestamp:Date.now(),changedElementId:t.id,changedElementType:t.type,oldValue:n,newValue:o,undo:()=>{r.oldValue&&Array.isArray(r.oldValue)&&H.getState().updatePolygonVerticesById(r.changedElementId,n)},redo:()=>{H.getState().updatePolygonVerticesById(r.changedElementId,o)}};H.getState().addUndoable(r)}},Hwo=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o={lng:H.getState().language};return e.push({key:"polygon-vertex-insert-before-index",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.InsertVertexBeforeIndex",o)})},{key:"polygon-vertex-insert-after-index",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.InsertVertexAfterIndex",o)})}),n.vertices.length>3&&e.push({key:"polygon-vertex-delete",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.DeleteVertex",o)})}),{items:e,onClick:({key:i})=>{switch(i){case"polygon-vertex-insert-before-index":Lce(n,db.InsertBeforeIndex);break;case"polygon-vertex-insert-after-index":Lce(n,db.InsertAfterIndex);break;case"polygon-vertex-delete":Lce(n,db.Delete);break}}}},Mwo=({sensor:t})=>{const e=Kt(),n=Sct(t);return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.showLabel,onChange:n,children:B.t("labelSubMenu.KeepShowingLabel",e)})})},Iwo=({sensor:t})=>{const e=Kt(),{labelText:n,setLabelText:o}=bct(t),r=Tct(t,n);return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"80px"},children:B.t("labelSubMenu.LabelText",e)+":"}),h.jsx(Vl,{style:{width:"150px"},value:n,onChange:i=>o(i.target.value),onPressEnter:r,onBlur:r})]})},zwo=t=>{const e=[];if(t.type!==z.Sensor)return{items:e};const n=t,o=!n.locked;return e.push({key:"sensor-copy",label:h.jsx(ad,{})}),o&&e.push({key:"sensor-cut",label:h.jsx(ld,{})}),e.push({key:"sensor-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"sensor-show-label",label:h.jsx(Mwo,{sensor:n})}),e.push({key:"sensor-label-text",label:h.jsx(Iwo,{sensor:n})})),{items:e}},Dwo=({light:t})=>{const e=Kt(),n=H.getState().updateInsideLightById,o=r=>{const i=r.target.checked,a={name:"Inside Light",timestamp:Date.now(),checked:i,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.inside,onChange:o,children:B.t("lightMenu.Inside",e)})})},Ewo=({light:t})=>{const e=Kt(),n=t.intensity??3,o=(i,a)=>{H.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.intensity=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Intensity",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),o(t.id,i),H.getState().set(l=>{l.actionState.lightIntensity=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"80px"},children:[B.t("lightMenu.Intensity",e),":"]}),h.jsx(mn,{min:.1,max:10,step:.1,precision:1,value:n,onChange:r})]})},kwo=({light:t})=>{const e=Kt(),n=t.distance??5,o=(i,a)=>{H.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.distance=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Distance",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),o(t.id,i),H.getState().set(l=>{l.actionState.lightDistance=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"80px"},children:[B.t("lightMenu.MaximumDistance",e),":"]}),h.jsx(mn,{min:1,max:10,step:1,precision:1,value:n,onChange:r})]})},Fwo=({light:t})=>{const e=t.color??"#ffff99",n=(o,r)=>{H.getState().set(i=>{for(const a of i.elements)if(a.type===z.Light&&a.id===o){a.color=r;break}})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(sd,{color:e,onChangeComplete:o=>{const r=t.color,i=o.hex,a={name:"Set Light Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{n(t.id,a.oldValue)},redo:()=>{n(t.id,a.newValue)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.lightColor=i})}})})},Lwo=t=>{const e=[];if(t.type!==z.Light)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=n.parentId?H.getState().getParent(n):void 0;return e.push({key:"light-copy",label:h.jsx(ad,{})}),o&&e.push({key:"light-cut",label:h.jsx(ld,{})}),e.push({key:"light-lock",label:h.jsx(D0,{selectedElement:n})}),o&&i&&(i.type===z.Roof||i.type===z.Wall)&&e.push({key:"light-inside",label:h.jsx(Dwo,{light:n})}),o&&e.push({key:"light-intensity",label:h.jsx(Ewo,{light:n})},{key:"light-distance",label:h.jsx(kwo,{light:n})},{key:"light-color",label:h.jsx(ln,{children:B.t("word.Color",r)}),children:[{key:"light-color-picker",label:h.jsx(Fwo,{light:n}),style:{backgroundColor:"white"}}]}),{items:e}},Wwo=()=>{const t=H(G2e),e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.axes=r})},o=r=>{const i=r.target.checked,a={name:"Show Axes",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};H.getState().addUndoable(a),n(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.Axes",e)})})},Nwo=()=>{const t=H(RGe),e=Kt(),n=i=>{H.getState().set(a=>{a.viewState.theme=i})},o=i=>{const a=t,l=i.target.value,s={name:"Select Theme",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(s.oldValue)},redo:()=>{n(s.newValue)}};H.getState().addUndoable(s),n(l)},r=[{value:qs.Default,label:"skyMenu.ThemeDefault"},{value:qs.Desert,label:"skyMenu.ThemeDesert"},{value:qs.Dune,label:"skyMenu.ThemeDune"},{value:qs.Forest,label:"skyMenu.ThemeForest"},{value:qs.Grassland,label:"skyMenu.ThemeGrassland"},{value:qs.Hill,label:"skyMenu.ThemeHill"},{value:qs.Lake,label:"skyMenu.ThemeLake"},{value:qs.Mountain,label:"skyMenu.ThemeMountain"},{value:qs.Rural,label:"skyMenu.ThemeRural"}];return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t,onChange:o,children:h.jsx(Jt,{direction:"vertical",children:r.map((i,a)=>h.jsx(We,{style:{width:"100%"},value:i.value,children:B.t(i.label,e)},`${a}-${i.value}`))})})})},Uwo=()=>{const t=H(HGe)??!0,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.showAzimuthAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Azimuth Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.ShowAzimuthAngle",e)})})},jwo=()=>{const t=H(MGe)??!0,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.showElevationAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Elevation Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.ShowElevationAngle",e)})})},Bwo=()=>{const t=H(IGe)??!0,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.showZenithAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Zenith Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.ShowZenithAngle",e)})})},Ywo=()=>{const t=H(CGe)??3.5,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.directLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Direct Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.DirectLightBrightnessAtNoon",e)+" [0.1-10]:"}),h.jsx(mn,{min:.1,max:10,step:.1,precision:2,value:t,onChange:o})]})},Owo=()=>{const t=H(PGe)??.2,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.ambientLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ambient Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.AmbientLightBrightnessAtNoon",e)+" [0.01-1]:"}),h.jsx(mn,{min:.01,max:1,step:.01,precision:2,value:t,onChange:o})]})},_wo=()=>{const t=H(eTt)??.01,e=Kt(),n=r=>{H.getState().set(i=>{i.world.airAttenuationCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Sunlight Attenuation Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.SunlightAttenuationCoefficientInAir",e)+":"}),h.jsx(mn,{min:0,max:.1,step:.001,precision:3,value:t,onChange:o})]})},Vwo=()=>{const t=H(tTt)??5,e=Kt(),n=r=>{H.getState().set(i=>{i.world.airConvectiveCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Convective Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.ConvectiveCoefficientOfAir",e)+" [W/(m²×K)]:"}),h.jsx(mn,{min:2.5,max:20,step:.1,precision:2,value:t,onChange:o})]})},Gwo=()=>{const t=H(WN)??900,e=H.getState().world,n=Kt(),o=g.useMemo(()=>pl(new Date(e.date),e.latitude),[e.date,e.latitude]),r=a=>{H.getState().set(l=>{l.world.highestTemperatureTimeInMinutes=a})},i=a=>{if(a===null)return;const l=t,s=a,c={name:"Set Time of Highest Temperature in Minutes",timestamp:Date.now(),oldValue:l,newValue:s,undo:()=>{r(c.oldValue)},redo:()=>{r(c.newValue)}};H.getState().addUndoable(c),r(s)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.HighestTemperatureTimeInMinutes",n)+":"}),h.jsx(mn,{min:720,max:o.sunset,step:5,precision:0,value:t,onChange:i})]})},Xwo=()=>{const t={lng:H.getState().language},e=[];return e.push({key:"axes",label:h.jsx(Wwo,{})}),e.push({key:"theme-submenu",label:h.jsx(ln,{children:B.t("skyMenu.Theme",t)}),children:[{key:"theme-radio-group",label:h.jsx(Nwo,{}),style:{backgroundColor:"white"}}]}),e.push({key:"sun-angles-submenu",label:h.jsx(ln,{children:B.t("skyMenu.SelectSunAnglesToShow",t)}),children:[{key:"show-azimuth-angle",label:h.jsx(Uwo,{})},{key:"ShowElevationAngle",label:h.jsx(jwo,{})},{key:"ShowZenithAngle",label:h.jsx(Bwo,{})}]}),e.push({key:"direct-light-intensity",label:h.jsx(Ywo,{})}),e.push({key:"ambient-light-intensity",label:h.jsx(Owo,{})}),e.push({key:"air-attenuation-coefficient",label:h.jsx(_wo,{})}),e.push({key:"air-convective-coefficient",label:h.jsx(Vwo,{})}),e.push({key:"highest-temperature-time-in-minutes",label:h.jsx(Gwo,{})}),{items:e}},$$=class $${constructor(){this.n=14,this.nominalStrings=new Array(this.n),this.nominalWidths=new Array(this.n),this.nominalHeights=new Array(this.n),this.cellNx=new Array(this.n),this.cellNy=new Array(this.n),this.nominalWidths[0]=.99,this.nominalHeights[0]=1.65,this.cellNx[0]=6,this.cellNy[0]=10,this.nominalWidths[1]=.99,this.nominalHeights[1]=1.96,this.cellNx[1]=6,this.cellNy[1]=12,this.nominalWidths[2]=1.05,this.nominalHeights[2]=1.56,this.cellNx[2]=8,this.cellNy[2]=12,this.nominalWidths[3]=1.31,this.nominalHeights[3]=1.96,this.cellNx[3]=8,this.cellNy[3]=12,this.nominalWidths[4]=1.07,this.nominalHeights[4]=2.07,this.cellNx[4]=8,this.cellNy[4]=16,this.nominalWidths[5]=.6,this.nominalHeights[5]=1.2,this.cellNx[5]=10,this.cellNy[5]=20,this.nominalWidths[6]=1.2,this.nominalHeights[6]=2,this.cellNx[6]=10,this.cellNy[6]=20,this.nominalWidths[7]=1,this.nominalHeights[7]=2.07,this.cellNx[7]=6,this.cellNy[7]=12,this.nominalWidths[8]=.8,this.nominalHeights[8]=1.56,this.cellNx[8]=6,this.cellNy[8]=12,this.nominalWidths[9]=.83,this.nominalHeights[9]=1.58,this.cellNx[9]=6,this.cellNy[9]=12,this.nominalWidths[10]=.99,this.nominalHeights[10]=1.31,this.cellNx[10]=6,this.cellNy[10]=8,this.nominalWidths[11]=.99,this.nominalHeights[11]=1.5,this.cellNx[11]=6,this.cellNy[11]=9,this.nominalWidths[12]=1.05,this.nominalHeights[12]=1.81,this.cellNx[12]=8,this.cellNy[12]=14,this.nominalWidths[13]=1.05,this.nominalHeights[13]=1.69,this.cellNx[13]=8,this.cellNy[13]=13;for(let e=0;e{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(jM),a=H(BM),l=H(O5),s=H(Fn),c=H(Wh),u=H(Nh),d=H(no),f=H(qn),p=ao(),[m,y]=g.useState((p==null?void 0:p.pvModelName)??"SPR-X21-335-BLK"),[w,x]=g.useState(),C=Kt(),P=g.useMemo(()=>({...a,...i}),[i,a]),A=l(m??"SPR-X21-335-BLK");g.useEffect(()=>{x(A.nominalWidth.toFixed(2)+"m×"+A.nominalLength.toFixed(2)+"m ("+A.n+"×"+A.m+" "+B.t("pvModelPanel.Cells",C)+")")},[A]);const S=(W,F)=>{e(E=>{for(const L of E.elements)if(L.type===z.SolarPanel&&L.id===W&&!L.locked){const j=L;j.pvModelName=F;let Y=E.supportedPvModules[F];if(Y||(Y=E.customPvModules[F]),j.orientation===br.portrait){const O=Math.max(1,Math.round(j.lx/Y.width)),_=Math.max(1,Math.round(j.ly/Y.length));j.lx=O*Y.width,j.ly=_*Y.length}else{const O=Math.max(1,Math.round(j.lx/Y.length)),_=Math.max(1,Math.round(j.ly/Y.width));j.lx=O*Y.length,j.ly=_*Y.width}break}})},v=(W,F)=>{e(E=>{let L=E.supportedPvModules[F];L||(L=E.customPvModules[F]);for(const j of E.elements)if(j.type===z.SolarPanel&&j.foundationId===W&&!j.locked){const Y=j;if(Y.pvModelName=F,Y.orientation===br.portrait){const O=Math.max(1,Math.round(Y.lx/L.width)),_=Math.max(1,Math.round(Y.ly/L.length));Y.lx=O*L.width,Y.ly=_*L.length}else{const O=Math.max(1,Math.round(Y.lx/L.length)),_=Math.max(1,Math.round(Y.ly/L.width));Y.lx=O*L.length,Y.ly=_*L.width}}})},b=(W,F,E)=>{e(L=>{let j=L.supportedPvModules[E];j||(j=L.customPvModules[E]);for(const Y of L.elements)if(Y.type===z.SolarPanel&&!Y.locked){let O;if(F?O=Y.parentId===W&&ye.isIdentical(Y.normal,F):O=Y.parentId===W,O){const _=Y;if(_.pvModelName=E,_.orientation===br.portrait){const G=Math.max(1,Math.round(_.lx/j.width)),Q=Math.max(1,Math.round(_.ly/j.length));_.lx=G*j.width,_.ly=Q*j.length}else{const G=Math.max(1,Math.round(_.lx/j.length)),Q=Math.max(1,Math.round(_.ly/j.width));_.lx=G*j.length,_.ly=Q*j.width}}}})},T=W=>{e(F=>{let E=F.supportedPvModules[W];E||(E=F.customPvModules[W]);for(const L of F.elements)if(L.type===z.SolarPanel&&!L.locked){const j=L;if(j.pvModelName=W,j.orientation===br.portrait){const Y=Math.max(1,Math.round(j.lx/E.width)),O=Math.max(1,Math.round(j.ly/E.length));j.lx=Y*E.width,j.ly=O*E.length}else{const Y=Math.max(1,Math.round(j.lx/E.length)),O=Math.max(1,Math.round(j.ly/E.width));j.lx=Y*E.length,j.ly=O*E.width}}})},R=(W,F)=>{H.getState().set(E=>{let L=E.supportedPvModules[F];L||(L=E.customPvModules[F]);for(const j of E.elements)if(j.type===z.SolarPanel&&!j.locked&&W.has(j.id)){const Y=j;if(Y.pvModelName=F,Y.orientation===br.portrait){const O=Math.max(1,Math.round(Y.lx/L.width)),_=Math.max(1,Math.round(Y.ly/L.length));Y.lx=O*L.width,Y.ly=_*L.length}else{const O=Math.max(1,Math.round(Y.lx/L.length)),_=Math.max(1,Math.round(Y.ly/L.width));Y.lx=O*L.length,Y.ly=_*L.width}}})},M=W=>{u(W.target.value)},D=W=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const F of n)if(F.type===z.SolarPanel&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&F.pvModelName!==W)return!0;break}case ie.AllObjectsOfThisType:{for(const F of n)if(F.type===z.SolarPanel&&!F.locked&&F.pvModelName!==W)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const F of n)if(F.type===z.SolarPanel&&F.foundationId===(p==null?void 0:p.foundationId)&&!F.locked&&F.pvModelName!==W)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const F=r(p);if(F){if(F.type===z.Cuboid){for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&ye.isIdentical(L.normal,p.normal)&&!L.locked&&L.pvModelName!==W)return!0}else for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&!L.locked&&L.pvModelName!==W)return!0}break}default:{if((p==null?void 0:p.pvModelName)!==W)return!0;break}}return!1}},k=W=>{if(p&&D(W)){switch(c){case ie.AllSelectedObjectsOfThisType:{const F=new Map;for(const L of n)L.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.pvModelName);const E={name:"Set Model for Selected Solar Panels",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())S(L,j)},redo:()=>{R(E.oldValues,E.newValue)}};s(E),R(F,W),f(d+1);break}case ie.AllObjectsOfThisType:{const F=new Map;for(const L of n)L.type===z.SolarPanel&&F.set(L.id,L.pvModelName);const E={name:"Set Model for All Solar Panels",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())S(L,j)},redo:()=>{T(E.newValue)}};s(E),T(W),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const F=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===p.foundationId&&F.set(L.id,L.pvModelName);const E={name:"Set Model for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())S(L,j)},redo:()=>{E.groupId&&v(E.groupId,E.newValue)}};s(E),v(p.foundationId,W),f(d+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const F=r(p);if(F){const E=new Map,L=F.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&ye.isIdentical(O.normal,p.normal)&&E.set(O.id,O.pvModelName);else for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&E.set(O.id,O.pvModelName);const j=L?p.normal:void 0,Y={name:"Set Model for All Solar Panels on Surface",timestamp:Date.now(),oldValues:E,newValue:W,groupId:p.parentId,normal:j,undo:()=>{for(const[O,_]of Y.oldValues.entries())S(O,_)},redo:()=>{Y.groupId&&b(Y.groupId,Y.normal,Y.newValue)}};s(Y),b(p.parentId,j,W),f(d+1)}break}default:{const F=o(p.id),E=F?F.pvModelName:p.pvModelName,L={name:"Set Model for Selected Solar Panel",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{S(L.changedElementId,L.oldValue)},redo:()=>{S(L.changedElementId,L.newValue)}};s(L),S(p.id,W),f(d+1);break}}e(F=>{F.actionState.solarPanelModelName=W})}},N=()=>{t(!1)},U=()=>{k(m)};return h.jsxs(ro,{width:640,title:B.t("pvModelPanel.SolarPanelSpecs",C),onApply:U,onClose:N,children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.Model",C)+" ("+Object.keys(P).length+" "+B.t("word.Options",C)+"):"}),h.jsx(Ge,{span:11,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:m,onChange:y,children:Object.keys(P).map(W=>h.jsx(Zx,{value:W,children:W+(P[W].bifacialityFactor>0?" ("+B.t("pvModelPanel.Bifacial",C)+")":"")},W))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.PanelSize",C)+":"}),h.jsx(Ge,{span:11,children:h.jsx(Ko,{disabled:!0,style:{width:"100%"},value:w,onChange:W=>{},children:B1e.instance.nominalStrings.map(W=>h.jsx(Zx,{value:W,children:W},W))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.CellType",C)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{disabled:!0,style:{width:"100%"},value:A.cellType,onChange:W=>{},children:[h.jsx(Zx,{value:"Monocrystalline",children:B.t("pvModelPanel.Monocrystalline",C)},"Monocrystalline"),h.jsx(Zx,{value:"Polycrystalline",children:B.t("pvModelPanel.Polycrystalline",C)},"Polycrystalline"),h.jsx(Zx,{value:"Thin Film",children:B.t("pvModelPanel.ThinFilm",C)},"Thin Film")]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.PowerBifaciality",C)+":"}),h.jsx(Ge,{span:11,children:h.jsx(mn,{disabled:!0,style:{width:"100%"},precision:2,value:A.bifacialityFactor,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("word.Color",C)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{disabled:!0,style:{width:"100%"},value:A.color,onChange:W=>{},children:[h.jsx(Zx,{value:"Black",children:B.t("pvModelPanel.Black",C)},"Black"),h.jsx(Zx,{value:"Blue",children:B.t("pvModelPanel.Blue",C)},"Blue")]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.SolarCellEfficiency",C)+" (%):"}),h.jsx(Ge,{span:11,children:h.jsx(mn,{disabled:!0,style:{width:"100%"},precision:2,value:100*A.efficiency,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.NominalOperatingCellTemperature",C)+" (°C):"}),h.jsx(Ge,{span:11,children:h.jsx(mn,{disabled:!0,style:{width:"100%"},precision:1,value:A.noct,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.TemperatureCoefficientOfPmax",C)+" (%/°C):"}),h.jsx(Ge,{span:11,children:h.jsx(Vl,{disabled:!0,style:{width:"100%"},value:A.pmaxTC,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{border:"2px dashed #ccc",marginTop:"6px",marginLeft:"0",marginRight:"0",paddingLeft:"8px",paddingTop:"8px",paddingBottom:"8px"},children:[h.jsx(Ge,{span:3,children:B.t("word.ApplyTo",C)+":"}),h.jsx(Ge,{span:21,children:h.jsx(We.Group,{onChange:M,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})]})},{Option:REe}=Ko,Kwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(O5),i=H($r),a=H(u5e),l=H(Fn),s=H(Wh),c=H(Nh),u=H(no),d=H(qn),f=H(Ji),p=ao(),[m,y]=g.useState((p==null?void 0:p.orientation)??br.portrait),w=g.useRef(!1),x=g.useRef(),C=Kt(),P=(j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&_.id===j&&!_.locked){const G=_;let Q=O.supportedPvModules[G.pvModelName];Q||(Q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,Q,Y);break}})},A=(j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&_.foundationId===j&&!_.locked){const G=_;let Q=O.supportedPvModules[G.pvModelName];Q||(Q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,Q,Y)}})},S=(j,Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&!G.locked){let Q;if(Y?Q=G.parentId===j&&ye.isIdentical(G.normal,Y):Q=G.parentId===j,Q){const oe=G;let ee=_.supportedPvModules[oe.pvModelName];ee||(ee=_.customPvModules[oe.pvModelName]),_.setSolarPanelOrientation(oe,ee,O)}}})},v=j=>{e(Y=>{for(const O of Y.elements)if(O.type===z.SolarPanel&&!O.locked){const _=O;let G=Y.supportedPvModules[_.pvModelName];G||(G=Y.customPvModules[_.pvModelName]),Y.setSolarPanelOrientation(_,G,j)}})},b=(j,Y)=>{H.getState().set(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked&&j.has(_.id)){const G=_;let Q=O.supportedPvModules[G.pvModelName];Q||(Q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,Q,Y)}})},T=j=>{c(j.target.value)},R=j=>{if(p){const Y=r(p.pvModelName);if(j===br.portrait){const O=Math.max(1,Math.round(p.lx/Y.width)),_=Math.max(1,Math.round(p.ly/Y.length));a(p.id,O*Y.width,_*Y.length)}else{const O=Math.max(1,Math.round(p.lx/Y.length)),_=Math.max(1,Math.round(p.ly/Y.width));a(p.id,O*Y.length,_*Y.width)}P(p.id,j)}},M=(j,Y)=>{const O=i(j);if(O){if(O.type===z.Cuboid&&!ye.isIdentical(j.normal,fs))return!0;const _=JSON.parse(JSON.stringify(j));_.orientation=Y;const G=r(_.pvModelName);if(Y===br.portrait){const Q=Math.max(1,Math.round(_.lx/G.width)),oe=Math.max(1,Math.round(_.ly/G.length));_.lx=Q*G.width,_.ly=oe*G.length}else{const Q=Math.max(1,Math.round(_.lx/G.length)),oe=Math.max(1,Math.round(_.ly/G.width));_.lx=Q*G.length,_.ly=oe*G.width}return O.type===z.Wall?ye.checkElementOnWallState(_,O)===ya.Valid:O.type===z.Roof?ye.checkElementOnRoofState(_,O)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(_,O)}return!1},D=(j,Y)=>!M(j,Y),k=j=>{if(p){switch(s){case ie.AllSelectedObjectsOfThisType:{for(const Y of n)if(Y.type===z.SolarPanel&&!Y.locked&&H.getState().selectedElementIdSet.has(Y.id)&&Y.orientation!==j)return!0;break}case ie.AllObjectsOfThisType:{for(const Y of n)if(Y.type===z.SolarPanel&&!Y.locked&&Y.orientation!==j)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const Y of n)if(Y.type===z.SolarPanel&&Y.foundationId===(p==null?void 0:p.foundationId)&&!Y.locked&&Y.orientation!==j)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const Y=i(p);if(Y){if(Y.type===z.Cuboid){for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&ye.isIdentical(_.normal,p.normal)&&!_.locked&&_.orientation!==j)return!0}else for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&!_.locked&&_.orientation!==j)return!0}break}default:{if((p==null?void 0:p.orientation)!==j)return!0;break}}return!1}},N=j=>{if(p&&k(j)){switch(x.current=void 0,s){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const Y of n)if(Y.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(Y.id)&&D(Y,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const Y=new Map;for(const _ of n)_.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(_.id)&&Y.set(_.id,_.orientation);const O={name:"Set Orientation for Selected Solar Panels",timestamp:Date.now(),oldValues:Y,newValue:j,undo:()=>{for(const[_,G]of O.oldValues.entries())P(_,G)},redo:()=>{b(O.oldValues,O.newValue)}};l(O),b(Y,j),d(u+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const Y of n)if(Y.type===z.SolarPanel&&D(Y,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const Y=new Map;for(const _ of n)_.type===z.SolarPanel&&Y.set(_.id,_.orientation);const O={name:"Set Orientation for All Solar Panels",timestamp:Date.now(),oldValues:Y,newValue:j,undo:()=>{for(const[_,G]of O.oldValues.entries())P(_,G)},redo:()=>{v(O.newValue)}};l(O),v(j),d(u+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){w.current=!1;for(const Y of n)if(Y.type===z.SolarPanel&&Y.foundationId===p.foundationId&&D(Y,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const Y=new Map;for(const _ of n)_.type===z.SolarPanel&&_.foundationId===p.foundationId&&Y.set(_.id,_.orientation);const O={name:"Set Orientation for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:Y,newValue:j,groupId:p.foundationId,undo:()=>{for(const[_,G]of O.oldValues.entries())P(_,G)},redo:()=>{O.groupId&&A(O.groupId,O.newValue)}};l(O),A(p.foundationId,j),d(u+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const Y=i(p);if(Y){if(w.current=!1,Y.type===z.Cuboid){for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&ye.isIdentical(_.normal,p.normal)&&D(_,j)){w.current=!0;break}}else for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&D(_,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const _=new Map,G=Y.type===z.Cuboid;if(G)for(const ee of n)ee.type===z.SolarPanel&&ee.parentId===p.parentId&&ye.isIdentical(ee.normal,p.normal)&&_.set(ee.id,ee.orientation);else for(const ee of n)ee.type===z.SolarPanel&&ee.parentId===p.parentId&&_.set(ee.id,ee.orientation);const Q=G?p.normal:void 0,oe={name:"Set Orientation for All Solar Panels on Surface",timestamp:Date.now(),oldValues:_,newValue:j,groupId:p.parentId,normal:Q,undo:()=>{for(const[ee,q]of oe.oldValues.entries())P(ee,q)},redo:()=>{oe.groupId&&S(oe.groupId,oe.normal,oe.newValue)}};l(oe),S(p.parentId,Q,j),d(u+1)}}break}default:{const Y=o(p.id),O=Y?Y.orientation:p.orientation;if(w.current=!1,w.current)x.current=j,y(O);else{const _={name:"Set Orientation of Selected Solar Panel",timestamp:Date.now(),oldValue:O,newValue:j,changedElementId:p.id,changedElementType:p.type,undo:()=>{R(_.oldValue)},redo:()=>{R(_.newValue)}};l(_),R(j),d(u+1)}break}}e(Y=>{Y.actionState.solarPanelOrientation=j})}},U=()=>{p&&(y(p.orientation),w.current=!1,t(!1))},W=()=>{U(),f()},F=()=>{N(m),w.current||(t(!1),d(0))},E=()=>{N(m)},L=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current?" ("+(x.current===br.portrait?B.t("solarPanelMenu.Portrait",C):B.t("solarPanelMenu.Landscape",C))+")":""):"";return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.Orientation",C),rejectedMessage:L,onApply:E,onClose:U,onClickCancel:W,onClickOk:F,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsxs(Ko,{style:{width:"150px"},value:m,onChange:j=>y(j),children:[h.jsx(REe,{value:br.portrait,children:B.t("solarPanelMenu.Portrait",C)},br.portrait),h.jsx(REe,{value:br.landscape,children:B.t("solarPanelMenu.Landscape",C)},br.landscape)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:T,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})})},$wo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(O5),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=ao(z.SolarPanel),[p,m]=g.useState((f==null?void 0:f.lx)??1),[y,w]=g.useState(0),x=g.useRef(!1),C=g.useRef(),P=Kt();g.useEffect(()=>{if(f){const Y=r(f.pvModelName)??r("SPR-X21-335-BLK");w(f.orientation===br.portrait?Y.width:Y.length)}},[f]);const A=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.id===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.lx=ye.panelizeLx(Q,oe,O);break}})},S=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.foundationId===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.lx=ye.panelizeLx(Q,oe,O)}})},v=(Y,O,_)=>{e(G=>{for(const Q of G.elements)if(Q.type===z.SolarPanel&&!Q.locked){let oe;if(O?oe=Q.parentId===Y&&ye.isIdentical(Q.normal,O):oe=Q.parentId===Y,oe){const ee=Q,q=G.getPvModule(ee.pvModelName);Q.lx=ye.panelizeLx(ee,q,_)}}})},b=Y=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked){const G=_,Q=O.getPvModule(G.pvModelName);_.lx=ye.panelizeLx(G,Q,Y)}})},T=(Y,O)=>{H.getState().set(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&!G.locked&&Y.has(G.id)){const Q=G,oe=_.getPvModule(Q.pvModelName);G.lx=ye.panelizeLx(Q,oe,O)}})},R=Y=>{s(Y.target.value)},M=(Y,O)=>{const _=i(Y);if(_){if(_.type===z.Cuboid&&!ye.isIdentical(Y.normal,fs))return!0;const G=JSON.parse(JSON.stringify(Y));return G.lx=O,_.type===z.Wall?ye.checkElementOnWallState(G,_)===ya.Valid:_.type===z.Roof?ye.checkElementOnRoofState(G,_)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(G,_)}return!1},D=(Y,O)=>!M(Y,O),k=Y=>{if(f){switch(l){case ie.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&H.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.lx-Y)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.lx-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.lx-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.lx-Y)>Ht)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.lx-Y)>Ht)return!0}break}default:{if(Math.abs((f==null?void 0:f.lx)-Y)>Ht)return!0;break}}return!1}},N=Y=>{if(f&&k(Y))switch(C.current=void 0,l){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const _={name:"Set Length for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{T(_.oldValues,_.newValue)}};a(_),T(O,Y),u(c+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const _={name:"Set Length for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{b(_.newValue)}};a(_),b(Y),u(c+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.lx);const _={name:"Set Length for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:Y,groupId:f.foundationId,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{_.groupId&&S(_.groupId,_.newValue)}};a(_),S(f.foundationId,Y),u(c+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(x.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&D(G,Y)){x.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&D(G,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const G=new Map,Q=O.type===z.Cuboid;if(Q)for(const q of n)q.type===z.SolarPanel&&q.parentId===f.parentId&&ye.isIdentical(q.normal,f.normal)&&G.set(q.id,q.lx);else for(const q of n)q.type===z.SolarPanel&&q.parentId===f.parentId&&G.set(q.id,q.lx);const oe=Q?f.normal:void 0,ee={name:"Set Length for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:Y,groupId:f.parentId,normal:oe,undo:()=>{for(const[q,ae]of ee.oldValues.entries())A(q,ae)},redo:()=>{ee.groupId&&v(ee.groupId,ee.normal,ee.newValue)}};a(ee),v(f.parentId,oe,Y),u(c+1)}}break}default:{const O=o(f.id),_=O?O.lx:f.lx;if(x.current=D(f,Y),x.current)C.current=Y,m(_);else{const G={name:"Set Solar Panel Array Length",timestamp:Date.now(),oldValue:_,newValue:Y,changedElementId:f.id,changedElementType:f.type,undo:()=>{A(G.changedElementId,G.oldValue)},redo:()=>{A(G.changedElementId,G.newValue)}};a(G),A(f.id,Y),u(c+1)}break}}},U=Y=>{let O=Y??1;return O=Math.max(1,Math.ceil((O-y/2)/y))*y,O},W=()=>{x.current=!1,t(!1)},F=()=>{W(),d()},E=()=>{N(p),x.current||(t(!1),u(0))},L=()=>{N(p)},j=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",P),rejectedMessage:j,onApply:L,onClose:W,onClickCancel:F,onClickOk:E,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:y,max:100*y,step:y,style:{width:120},precision:2,value:p,onChange:Y=>{Y!==null&&m(U(Y))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/y)+" "+B.t("solarPanelMenu.PanelsWide",P),h.jsx("br",{}),B.t("word.MaximumNumber",P),": 100 ",B.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:R,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},qwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(O5),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=ao(z.SolarPanel),[p,m]=g.useState((f==null?void 0:f.ly)??2),[y,w]=g.useState(0),x=g.useRef(!1),C=g.useRef(),P=Kt();g.useEffect(()=>{if(f){const Y=r(f.pvModelName)??r("SPR-X21-335-BLK");w(f.orientation===br.portrait?Y.length:Y.width),m(f.ly)}},[f]);const A=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.id===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.ly=ye.panelizeLy(Q,oe,O);break}})},S=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.foundationId===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.ly=ye.panelizeLy(Q,oe,O)}})},v=(Y,O,_)=>{e(G=>{for(const Q of G.elements)if(Q.type===z.SolarPanel&&!Q.locked){let oe;if(O?oe=Q.parentId===Y&&ye.isIdentical(Q.normal,O):oe=Q.parentId===Y,oe){const ee=Q,q=G.getPvModule(ee.pvModelName);Q.ly=ye.panelizeLy(ee,q,_)}}})},b=Y=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked){const G=_,Q=O.getPvModule(G.pvModelName);_.ly=ye.panelizeLy(G,Q,Y)}})},T=(Y,O)=>{H.getState().set(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&!G.locked&&Y.has(G.id)){const Q=G,oe=_.getPvModule(Q.pvModelName);G.ly=ye.panelizeLy(Q,oe,O)}})},R=Y=>{s(Y.target.value)},M=(Y,O)=>{const _=i(Y);if(_){if(_.type===z.Cuboid&&!ye.isIdentical(Y.normal,fs))return!0;const G=JSON.parse(JSON.stringify(Y));return G.ly=O,_.type===z.Wall?ye.checkElementOnWallState(G,_)===ya.Valid:_.type===z.Roof?ye.checkElementOnRoofState(G,_)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(G,_)}return!1},D=(Y,O)=>Y.tiltAngle!==0&&.5*O*Math.abs(Math.sin(Y.tiltAngle))>Y.poleHeight||!M(Y,O),k=Y=>{if(f){switch(l){case ie.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&H.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.ly-Y)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.ly-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.ly-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.ly-Y)>Ht)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.ly-Y)>Ht)return!0}break}default:{if(Math.abs((f==null?void 0:f.ly)-Y)>Ht)return!0;break}}return!1}},N=Y=>{if(f&&k(Y))switch(C.current=void 0,l){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.ly);const _={name:"Set Width for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{T(_.oldValues,_.newValue)}};a(_),T(O,Y),u(c+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&O.set(G.id,G.ly);const _={name:"Set Width for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{b(_.newValue)}};a(_),b(Y),u(c+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.ly);const _={name:"Set Width for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:Y,groupId:f.foundationId,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{_.groupId&&S(_.groupId,_.newValue)}};a(_),S(f.foundationId,Y),u(c+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(x.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&D(G,Y)){x.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&D(G,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const G=new Map,Q=O.type===z.Cuboid;if(Q)for(const q of n)q.type===z.SolarPanel&&q.parentId===f.parentId&&ye.isIdentical(q.normal,f.normal)&&G.set(q.id,q.ly);else for(const q of n)q.type===z.SolarPanel&&q.parentId===f.parentId&&G.set(q.id,q.ly);const oe=Q?f.normal:void 0,ee={name:"Set Width for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:Y,groupId:f.parentId,normal:oe,undo:()=>{for(const[q,ae]of ee.oldValues.entries())A(q,ae)},redo:()=>{ee.groupId&&v(ee.groupId,ee.normal,ee.newValue)}};a(ee),v(f.parentId,oe,Y),u(c+1)}}break}default:{const O=o(f.id),_=O?O.ly:f.ly;if(x.current=D(f,Y),x.current)C.current=Y,m(_);else{const G={name:"Set Solar Panel Array Width",timestamp:Date.now(),oldValue:_,newValue:Y,changedElementId:f.id,changedElementType:f.type,undo:()=>{A(G.changedElementId,G.oldValue)},redo:()=>{A(G.changedElementId,G.newValue)}};a(G),A(f.id,Y),u(c+1)}break}}},U=()=>{x.current=!1,t(!1)},W=()=>{U(),d()},F=()=>{N(p),x.current||(t(!1),u(0))},E=Y=>{let O=Y??1;return O=Math.max(1,Math.ceil((O-y/2)/y))*y,O},L=()=>{N(p)},j=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Width",P),rejectedMessage:j,onApply:L,onClose:U,onClickCancel:W,onClickOk:F,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:y,max:100*y,step:y,style:{width:120},precision:2,value:p,onChange:Y=>{Y!==null&&m(E(Y))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/y)+" "+B.t("solarPanelMenu.PanelsLong",P),h.jsx("br",{}),B.t("word.MaximumNumber",P),": 100 ",B.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:R,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},Qwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=H(T=>T.elements.find(R=>R.selected&&R.type===z.SolarPanel)),[d,f]=g.useState((u==null?void 0:u.inverterEfficiency)??.95),p=Kt(),m=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.id===T&&!D.locked){D.inverterEfficiency=R;break}})},y=(T,R)=>{e(M=>{for(const D of M.elements)D.type===z.SolarPanel&&D.foundationId===T&&!D.locked&&(D.inverterEfficiency=R)})},w=(T,R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&!k.locked){let N;R?N=k.parentId===T&&ye.isIdentical(k.normal,R):N=k.parentId===T,N&&(k.inverterEfficiency=M)}})},x=T=>{e(R=>{for(const M of R.elements)M.type===z.SolarPanel&&!M.locked&&(M.inverterEfficiency=T)})},C=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)D.type===z.SolarPanel&&!D.locked&&T.has(D.id)&&(D.inverterEfficiency=R)})},P=T=>{l(T.target.value)},A=T=>{switch(a){case ie.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&Math.abs((R.inverterEfficiency??.95)-T)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&ye.isIdentical(D.normal,u.normal)&&!D.locked&&Math.abs((D.inverterEfficiency??.95)-T)>Ht)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&!D.locked&&Math.abs((D.inverterEfficiency??.95)-T)>Ht)return!0}break}default:{if(Math.abs(((u==null?void 0:u.inverterEfficiency)??.95)-T)>Ht)return!0;break}}return!1},S=T=>{if(u&&A(T))switch(a){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.inverterEfficiency??.95);const M={name:"Set Inverter Efficiency for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{C(M.oldValues,M.newValue)}};i(M),C(R,T),c(s+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&R.set(D.id,D.inverterEfficiency??.95);const M={name:"Set Inverter Efficiency for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{x(M.newValue)}};i(M),x(T),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===u.foundationId&&R.set(D.id,D.inverterEfficiency??.95);const M={name:"Set Inverter Efficiency for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:u.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{M.groupId&&y(M.groupId,M.newValue)}};i(M),y(u.foundationId,T),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const M=new Map,D=R.type===z.Cuboid;if(D)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&M.set(U.id,U.inverterEfficiency??.95);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&M.set(U.id,U.inverterEfficiency??.95);const k=D?u.normal:void 0,N={name:"Set Inverter Efficiency for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:u.parentId,normal:k,undo:()=>{for(const[U,W]of N.oldValues.entries())m(U,W)},redo:()=>{N.groupId&&w(N.groupId,N.normal,N.newValue)}};i(N),w(u.parentId,k,T),c(s+1)}break}default:{const R=o(u.id),M=R?R.inverterEfficiency??.95:u.inverterEfficiency??.95,D={name:"Set Solar Panel Array Inverter Efficiency",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:u.id,changedElementType:u.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};i(D),m(u.id,T),c(s+1);break}}},v=()=>{t(!1)},b=()=>{S(d)};return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.InverterEfficiency",p),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.5,max:1,step:.01,style:{width:120},precision:2,value:d,onChange:T=>{T!==null&&f(T)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[0.5, 1.0]",h.jsx("br",{}),B.t("solarPanelMenu.InverterEfficiencyExplained",p)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},Zwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Au),o=H(Qn),r=H(Jn),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=H(L=>L.elements.find(j=>j.selected&&j.type===z.SolarPanel)),[p,m]=g.useState(!1),[y,w]=g.useState(!1),[x,C]=g.useState({left:0,top:0,bottom:0,right:0}),P=g.useRef(null),A=g.useRef((f==null?void 0:f.dcToAcRatio)??1),S={lng:n};g.useEffect(()=>{f&&(A.current=f.dcToAcRatio??1)},[f.dcToAcRatio]);const v=(L,j)=>{e(Y=>{for(const O of Y.elements)if(O.type===z.SolarPanel&&O.id===L&&!O.locked){O.dcToAcRatio=j;break}})},b=(L,j)=>{e(Y=>{for(const O of Y.elements)O.type===z.SolarPanel&&O.foundationId===L&&!O.locked&&(O.dcToAcRatio=j)})},T=(L,j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked){let G;j?G=_.parentId===L&&ye.isIdentical(_.normal,j):G=_.parentId===L,G&&(_.dcToAcRatio=Y)}})},R=L=>{e(j=>{for(const Y of j.elements)Y.type===z.SolarPanel&&!Y.locked&&(Y.dcToAcRatio=L)})},M=(L,j)=>{H.getState().set(Y=>{for(const O of Y.elements)O.type===z.SolarPanel&&!O.locked&&L.has(O.id)&&(O.dcToAcRatio=j)})},D=L=>{s(L.target.value),m(!p)},k=L=>{switch(l){case ie.AllSelectedObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&Math.abs((j.dcToAcRatio??1)-L)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const j of o)if(j.type===z.SolarPanel&&j.foundationId===(f==null?void 0:f.foundationId)&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){if(j.type===z.Cuboid){for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&ye.isIdentical(O.normal,f.normal)&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Ht)return!0}else for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Ht)return!0}break}default:{if(Math.abs(((f==null?void 0:f.dcToAcRatio)??1)-L)>Ht)return!0;break}}return!1},N=L=>{if(f&&k(L)){switch(l){case ie.AllSelectedObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.dcToAcRatio??1);const Y={name:"Set DC-AC Ratio for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())v(O,_)},redo:()=>{M(Y.oldValues,Y.newValue)}};a(Y),M(j,L),u(c+1);break}case ie.AllObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&j.set(O.id,O.dcToAcRatio??1);const Y={name:"Set DC-AC Ratio for All Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())v(O,_)},redo:()=>{R(Y.newValue)}};a(Y),R(L),u(c+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const j=new Map;for(const O of o)O.type===z.SolarPanel&&O.foundationId===f.foundationId&&j.set(O.id,O.dcToAcRatio??1);const Y={name:"Set DC-AC Ratio for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:f.foundationId,undo:()=>{for(const[O,_]of Y.oldValues.entries())v(O,_)},redo:()=>{Y.groupId&&b(Y.groupId,Y.newValue)}};a(Y),b(f.foundationId,L),u(c+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){const Y=new Map,O=j.type===z.Cuboid;if(O)for(const Q of o)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&ye.isIdentical(Q.normal,f.normal)&&Y.set(Q.id,Q.dcToAcRatio??1);else for(const Q of o)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&Y.set(Q.id,Q.dcToAcRatio??1);const _=O?f.normal:void 0,G={name:"Set DC-AC Ratio for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:Y,newValue:L,groupId:f.parentId,normal:_,undo:()=>{for(const[Q,oe]of G.oldValues.entries())v(Q,oe)},redo:()=>{G.groupId&&T(G.groupId,G.normal,G.newValue)}};a(G),T(f.parentId,_,L),u(c+1)}break}default:{const j=r(f.id),Y=j?j.dcToAcRatio??1:f.dcToAcRatio??1,O={name:"Set Solar Panel Array DC-AC Ratio",timestamp:Date.now(),oldValue:Y,newValue:L,changedElementId:f.id,changedElementType:f.type,undo:()=>{v(O.changedElementId,O.oldValue)},redo:()=>{v(O.changedElementId,O.newValue)}};a(O),v(f.id,L),u(c+1);break}}m(!p)}},U=(L,j)=>{if(P.current){const{clientWidth:Y,clientHeight:O}=window.document.documentElement,_=P.current.getBoundingClientRect();C({left:-_.left+j.x,right:Y-(_.right-j.x),top:-_.top+j.y,bottom:O-((_==null?void 0:_.bottom)-j.y)})}},W=()=>{A.current=f.dcToAcRatio??1,t(!1)},F=()=>{W(),d()},E=()=>{N(A.current),t(!1),u(0)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:550,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),children:B.t("solarPanelMenu.DcToAcSizeRatio",S)}),footer:[h.jsx(oo,{onClick:()=>{N(A.current)},children:B.t("word.Apply",S)},"Apply"),h.jsx(oo,{onClick:F,children:B.t("word.Cancel",S)},"Cancel"),h.jsx(oo,{type:"primary",onClick:E,children:B.t("word.OK",S)},"OK")],onCancel:W,maskClosable:!1,destroyOnClose:!1,modalRender:L=>h.jsx(Vi,{disabled:!y,bounds:x,onStart:(j,Y)=>U(j,Y),children:h.jsx("div",{ref:P,children:L})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:2,step:.01,style:{width:120},precision:2,value:A.current,onChange:L=>{L!==null&&(A.current=L,m(!p))},onPressEnter:E}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[1.0, 2.0]",h.jsx("br",{}),B.t("solarPanelMenu.DcToAcSizeRatioExplained",S)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:D,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",S)})]})})})]})})})},HEe=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(NPt),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=ao(z.SolarPanel),p=(f==null?void 0:f.tiltAngle)??0,m=(f==null?void 0:f.parentType)===z.Wall,[y,w]=g.useState(m?-p:p),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarPanel&&Y.foundationId===F&&!Y.locked){const O=Y;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-E:E):O.tiltAngle=E}})},S=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarPanel&&!Y.locked){let O;if(E?O=Y.parentId===F&&ye.isIdentical(Y.normal,E):O=Y.parentId===F,O){const _=Y;_.tiltAngle=L}}})},v=(F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked){const Y=j;Y.parentType===z.Wall?Y.tiltAngle=Math.min(0,E?-F:F):Y.tiltAngle=F}})},b=(F,E,L)=>{H.getState().set(j=>{for(const Y of j.elements)if(Y.type===z.SolarPanel&&!Y.locked&&F.has(Y.id)){const O=Y;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-E:E):O.tiltAngle=E}})},T=F=>{s(F.target.value)},R=F=>{if(f){switch(l){case ie.AllSelectedObjectsOfThisType:{for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(E.tiltAngle-F)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&Math.abs(E.tiltAngle-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===(f==null?void 0:f.foundationId)&&!E.locked&&Math.abs(E.tiltAngle-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const E=i(f);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&ye.isIdentical(j.normal,f.normal)&&!j.locked&&Math.abs(j.tiltAngle-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&!j.locked&&Math.abs(j.tiltAngle-F)>Ht)return!0}break}default:{if(Math.abs((f==null?void 0:f.tiltAngle)-F)>Ht)return!0;break}}return!1}},M=F=>{if(m&&(F=-F),!!f&&R(F)){switch(C.current=void 0,l){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(E.id)&&.5*E.ly*Math.abs(Math.sin(F))>E.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,Y)},redo:()=>{b(L.oldValues,L.newValue,!m)}};a(L),b(E,F,!m),u(c+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&.5*E.ly*Math.abs(Math.sin(F))>E.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&E.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,Y)},redo:()=>{v(L.newValue,!m)}};a(L),v(F,!m),u(c+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){x.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===f.foundationId&&E.parentType!==z.Wall&&.5*E.ly*Math.abs(Math.sin(F))>E.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===f.foundationId&&E.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:f.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,Y)},redo:()=>{L.groupId&&A(L.groupId,L.newValue,!m)}};a(L),A(f.foundationId,F,!m),u(c+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const E=i(f);if(E){x.current=!1;const L=E.type===z.Cuboid;if(L){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&ye.isIdentical(j.normal,f.normal)&&.5*j.ly*Math.abs(Math.sin(F))>j.poleHeight){x.current=!0;break}}else if(f.parentType===z.Wall)x.current=!1;else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&.5*j.ly*Math.abs(Math.sin(F))>j.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const j=new Map;if(L)for(const _ of n)_.type===z.SolarPanel&&_.parentId===f.parentId&&ye.isIdentical(_.normal,f.normal)&&j.set(_.id,_.tiltAngle);else for(const _ of n)_.type===z.SolarPanel&&_.parentId===f.parentId&&j.set(_.id,_.tiltAngle);const Y=L?f.normal:void 0,O={name:"Set Tilt Angle for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:f.parentId,normal:Y,undo:()=>{for(const[_,G]of O.oldValues.entries())r(_,G)},redo:()=>{O.groupId&&S(O.groupId,O.normal,O.newValue)}};a(O),S(f.parentId,Y,F),u(c+1)}}break}default:{const E=o(f.id),L=E?E.tiltAngle:f.tiltAngle;if(x.current=.5*f.ly*Math.abs(Math.sin(F))>f.poleHeight,f.parentType===z.Wall&&(x.current=!1),x.current)C.current=F,w(L);else{const j={name:"Set Solar Panel Array Tilt Angle",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(j.changedElementId,j.oldValue)},redo:()=>{r(j.changedElementId,j.newValue)}};a(j),r(f.id,F),u(c+1)}break}}e(E=>{E.actionState.solarPanelTiltAngle=F})}},D=()=>{x.current=!1,t(!1)},k=()=>{D(),d()},N=()=>{M(y),x.current||(t(!1),u(0))},U=()=>{M(y)},W=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+ye.toDegrees(C.current).toFixed(1)+"°)":null):null;return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.TiltAngle",P),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:m?0:-90,max:90,style:{width:120},precision:2,value:parseFloat(ye.toDegrees(y).toFixed(2)),step:1,formatter:F=>`${F}°`,onChange:F=>{F!==null&&w(ye.toRadians(F))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [",m?"0°":"-90°",", 90°]",h.jsx("br",{}),B.t("solarPanelMenu.SouthFacingIsPositive",P)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(We.Group,{onChange:T,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},e8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(yQ),i=H(AXe),a=H(wXe),l=H(xXe),s=H($r),c=H(Fn),u=H(Wh),d=H(Nh),f=H(no),p=H(qn),m=H(Ji),y=ao(z.SolarPanel),w=g.useRef(!1),x=g.useRef(),[C,P]=g.useState(y?-y.relativeAzimuth:0),A=Kt(),S=F=>{d(F.target.value)},v=(F,E)=>{const L=s(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.relativeAzimuth=-E,L.type===z.Roof?ye.checkElementOnRoofState(j,L)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(F,E)=>!v(F,E),T=F=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&E.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&E.parentType!==z.Wall&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===(y==null?void 0:y.foundationId)&&!E.locked&&E.parentType!==z.Wall&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:if(y!=null&&y.parentId){const E=s(y);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}}break;default:if(Math.abs(-(y==null?void 0:y.relativeAzimuth)-F)>Ht)return!0}return!1}},R=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked&&F.has(j.id)){const Y=j;Y.relativeAzimuth=E}})},M=F=>{if(y&&T(F)){switch(x.current=void 0,u){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(E.id)&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(E,-F),p(f+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{l(z.SolarPanel,-L.newValue)}};c(L),l(z.SolarPanel,-F),p(f+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(y.foundationId){w.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===y.foundationId&&E.parentType!==z.Wall&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===y.foundationId&&j.parentType!==z.Wall&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:y.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{L.groupId&&a(z.SolarPanel,L.groupId,-L.newValue)}};c(L),a(z.SolarPanel,y.foundationId,-F),p(f+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{if(y.parentId){const E=s(y);if(E){if(w.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&b(j,F)){w.current=!0;break}}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&b(j,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarPanel&&G.parentId===y.parentId&&ye.isIdentical(G.normal,y.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarPanel&&G.parentId===y.parentId&&j.set(G.id,-G.relativeAzimuth);const O=Y?y.normal:void 0,_={name:"Set Relative Azimuth for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:y.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())r(G,-Q)},redo:()=>{_.groupId&&i(z.SolarPanel,_.groupId,_.normal,-_.newValue)}};c(_),i(z.SolarPanel,y.parentId,O,-F),p(f+1)}}}break}default:{const E=o(y.id),L=E?-E.relativeAzimuth:-y.relativeAzimuth;if(w.current=b(y,F),w.current)x.current=F,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:y.id,changedElementType:y.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(y.id,-F),p(f+1)}break}}e(E=>{E.actionState.solarPanelRelativeAzimuth=-F})}},D=()=>{w.current=!1,t(!1)},k=()=>{D(),m()},N=()=>{M(C),w.current||(t(!1),p(0))},U=()=>{M(C)},W=w.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(x.current!==void 0?" ("+ye.toDegrees(x.current).toFixed(1)+"°)":null):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeAzimuth",A),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(C).toFixed(2)),formatter:F=>`${F}°`,onChange:F=>{F!==null&&P(ye.toRadians(F))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",A),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",A)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(We.Group,{onChange:S,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",A)})]})})})]})})},t8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=ao(),[d,f]=g.useState((u==null?void 0:u.trackerType)??Bl.NO_TRACKER),p=Kt(),{Option:m}=Ko,y=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&k.id===R&&!k.locked){k.trackerType=M;break}})},w=(R,M)=>{e(D=>{for(const k of D.elements)k.type===z.SolarPanel&&k.foundationId===R&&!k.locked&&(k.trackerType=M)})},x=(R,M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.SolarPanel&&!N.locked){let U;M?U=N.parentId===R&&ye.isIdentical(N.normal,M):U=N.parentId===R,U&&(N.trackerType=D)}})},C=R=>{e(M=>{for(const D of M.elements)D.type===z.SolarPanel&&!D.locked&&(D.trackerType=R)})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)k.type===z.SolarPanel&&!k.locked&&R.has(k.id)&&(k.trackerType=M)})},A=R=>{l(R.target.value)},S=R=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const M of n)if(M.type===z.SolarPanel&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&M.trackerType!==R)return!0;break}case ie.AllObjectsOfThisType:{for(const M of n)if(M.type===z.SolarPanel&&!M.locked&&M.trackerType!==R)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const M of n)if(M.type===z.SolarPanel&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&M.trackerType!==R)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const M=r(u);if(M){if(M.type===z.Cuboid){for(const k of n)if(k.type===z.SolarPanel&&k.parentId===u.parentId&&ye.isIdentical(k.normal,u.normal)&&!k.locked&&k.trackerType!==R)return!0}else for(const k of n)if(k.type===z.SolarPanel&&k.parentId===u.parentId&&!k.locked&&k.trackerType!==R)return!0}break}default:{if((u==null?void 0:u.trackerType)!==R)return!0;break}}return!1}},v=R=>{if(u&&S(R))switch(a){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.trackerType);const D={name:"Set Tracker Type for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};i(D),P(M,R),c(s+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.SolarPanel&&M.set(k.id,k.trackerType);const D={name:"Set Tracker Type for All Solar Panel Arrays",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{C(D.newValue)}};i(D),C(R),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.SolarPanel&&k.foundationId===u.foundationId&&M.set(k.id,k.trackerType);const D={name:"Set Tracker Type for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{D.groupId&&w(D.groupId,D.newValue)}};i(D),w(u.foundationId,R),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const M=r(u);if(M){const D=new Map,k=M.type===z.Cuboid;if(k)for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&ye.isIdentical(W.normal,u.normal)&&D.set(W.id,W.trackerType);else for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&D.set(W.id,W.trackerType);const N=k?u.normal:void 0,U={name:"Set Tracker Type for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:D,newValue:R,groupId:u.parentId,normal:N,undo:()=>{for(const[W,F]of U.oldValues.entries())y(W,F)},redo:()=>{U.groupId&&x(U.groupId,U.normal,U.newValue)}};i(U),x(u.parentId,N,R),c(s+1)}break}default:{const M=o(u.id),D=M?M.trackerType:u.trackerType,k={name:"Set Solar Panel Array Tracker Type",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(k.changedElementId,k.oldValue)},redo:()=>{y(k.changedElementId,k.newValue)}};i(k),y(u.id,R),c(s+1);break}}},b=()=>{t(!1)},T=()=>{v(d)};return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.Tracker",p),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsxs(Ko,{style:{width:"120px"},value:d,onChange:R=>f(R),children:[h.jsx(m,{value:Bl.NO_TRACKER,title:B.t("solarPanelMenu.NoTracker",p),children:B.t("word.None",p)},"NONE"),h.jsx(m,{value:Bl.HORIZONTAL_SINGLE_AXIS_TRACKER,title:B.t("solarPanelMenu.HorizontalSingleAxisTracker",p),children:"HSAT"},"HSAT"),h.jsx(m,{value:Bl.VERTICAL_SINGLE_AXIS_TRACKER,title:B.t("solarPanelMenu.VerticalSingleAxisTracker",p),children:"VSAT"},"VSAT"),h.jsx(m,{value:Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER,title:B.t("solarPanelMenu.AltazimuthDualAxisTracker",p),children:"AADAT"},"AADAT")]}),h.jsx("div",{style:{paddingTop:"20px",paddingRight:"10px",textAlign:"left",fontSize:"11px"},children:B.t("solarPanelMenu.SolarTrackerFollowsSun",p)})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},n8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=ao(z.SolarPanel),[d,f]=g.useState((u==null?void 0:u.frameColor)??"white"),p=Kt(),m=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.id===T&&!D.locked){D.frameColor=R;break}})},y=(T,R)=>{e(M=>{for(const D of M.elements)D.type===z.SolarPanel&&D.foundationId===T&&!D.locked&&(D.frameColor=R)})},w=(T,R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&!k.locked){let N;R?N=k.parentId===T&&ye.isIdentical(k.normal,R):N=k.parentId===T,N&&(k.frameColor=M)}})},x=T=>{e(R=>{for(const M of R.elements)M.type===z.SolarPanel&&!M.locked&&(M.frameColor=T)})},C=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)D.type===z.SolarPanel&&!D.locked&&T.has(D.id)&&(D.frameColor=R)})},P=T=>{l(T.target.value)},A=T=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&R.frameColor!==T)return!0;break}case ie.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&R.frameColor!==T)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&R.frameColor!==T)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&ye.isIdentical(D.normal,u.normal)&&!D.locked&&D.frameColor!==T)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&!D.locked&&D.frameColor!==T)return!0}break}default:{if((u==null?void 0:u.frameColor)!==T)return!0;break}}return!1}},S=T=>{if(u&&A(T)){switch(a){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.frameColor??"white");const M={name:"Set Frame Color for Selected Solar Panels",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{C(M.oldValues,M.newValue)}};i(M),C(R,T),c(s+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&R.set(D.id,D.frameColor??"white");const M={name:"Set Frame Color for All Solar Panels",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{x(M.newValue)}};i(M),x(T),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===u.foundationId&&R.set(D.id,D.frameColor??"white");const M={name:"Set Frame Color for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:u.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{M.groupId&&y(M.groupId,M.newValue)}};i(M),y(u.foundationId,T),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const M=new Map,D=R.type===z.Cuboid;if(D)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&M.set(U.id,U.frameColor??"white");else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&M.set(U.id,U.frameColor??"white");const k=D?u.normal:void 0,N={name:"Set Frame Color for All Solar Panels on Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:u.parentId,normal:k,undo:()=>{for(const[U,W]of N.oldValues.entries())m(U,W)},redo:()=>{N.groupId&&w(N.groupId,N.normal,N.newValue)}};i(N),w(u.parentId,k,T),c(s+1)}break}default:{const R=o(u.id),M=R?R.frameColor:u.frameColor,D={name:"Set Frame Color of Selected Solar Panel",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:u.id,changedElementType:u.type,undo:()=>{m(u.id,D.oldValue)},redo:()=>{m(u.id,D.newValue)}};i(D),m(u.id,T),c(s+1);break}}e(R=>{R.actionState.solarPanelFrameColor=T})}},v=()=>{t(!1)},b=()=>{S(d)};return h.jsx(ro,{width:680,title:B.t("solarPanelMenu.FrameColor",p),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsx(sd,{color:d??(u==null?void 0:u.color)??"white",onChangeComplete:T=>{f(T.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},o8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(VPt),a=H(KN),l=H($N),s=H($r),c=H(Fn),u=H(Wh),d=H(Nh),f=H(no),p=H(qn),m=H(Ji),y=ao(z.SolarPanel),[w,x]=g.useState((y==null?void 0:y.poleHeight)??0),C=g.useRef(!1),P=g.useRef(),A=Kt(),S=U=>{d(U.target.value)},v=U=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(y==null?void 0:y.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const W=s(y);if(W){if(W.type===z.Cuboid){for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&ye.isIdentical(E.normal,y.normal)&&!E.locked&&Math.abs(E.poleHeight-U)>Ht)return!0}else for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&!E.locked&&Math.abs(E.poleHeight-U)>Ht)return!0}break}default:{if(Math.abs((y==null?void 0:y.poleHeight)-U)>Ht)return!0;break}}return!1}},b=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked&&U.has(E.id)){const L=E;L.poleHeight=W}})},T=U=>{if(y&&v(U)){switch(P.current=void 0,u){case ie.AllSelectedObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const W=new Map;for(const E of n)E.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(E.id)&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{b(F.oldValues,F.newValue)}};c(F),b(W,U),p(f+1)}break}case ie.AllObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const W=new Map;for(const E of n)E.type===z.SolarPanel&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{l(z.SolarPanel,F.newValue)}};c(F),l(z.SolarPanel,U),p(f+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(y.foundationId){C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===y.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const W=new Map;for(const E of n)E.type===z.SolarPanel&&E.foundationId===y.foundationId&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:y.foundationId,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{F.groupId&&a(z.SolarPanel,F.groupId,F.newValue)}};c(F),a(z.SolarPanel,y.foundationId,U),p(f+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const W=s(y);if(W){if(C.current=!1,W.type===z.Cuboid){for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&ye.isIdentical(E.normal,y.normal)&&.5*E.ly*Math.abs(Math.sin(E.tiltAngle))>U){C.current=!0;break}}else for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&.5*E.ly*Math.abs(Math.sin(E.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const E=new Map,L=W.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===y.parentId&&ye.isIdentical(O.normal,y.normal)&&E.set(O.id,O.poleHeight);else for(const O of n)O.type===z.SolarPanel&&O.parentId===y.parentId&&E.set(O.id,O.poleHeight);const j=L?y.normal:void 0,Y={name:"Set Pole Height for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:E,newValue:U,groupId:y.parentId,normal:j,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_)},redo:()=>{Y.groupId&&i(z.SolarPanel,Y.groupId,Y.normal,Y.newValue)}};c(Y),i(z.SolarPanel,y.parentId,j,U),p(f+1)}}break}default:{const W=o(y.id),F=W?W.poleHeight:y.poleHeight;if(C.current=.5*y.ly*Math.abs(Math.sin(y.tiltAngle))>U,C.current)P.current=U,x(F);else{const E={name:"Set Solar Panel Array Pole Height",timestamp:Date.now(),oldValue:F,newValue:U,changedElementId:y.id,changedElementType:y.type,undo:()=>{r(E.changedElementId,E.oldValue)},redo:()=>{r(E.changedElementId,E.newValue)}};c(E),r(y.id,U),p(f+1)}break}}e(W=>{W.actionState.solarPanelPoleHeight=U})}},R=()=>{C.current=!1,t(!1)},M=()=>{R(),m()},D=()=>{T(w),C.current||(t(!1),p(0))},k=()=>{T(w)},N=C.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(P.current!==void 0?" ("+P.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.PoleHeight",A),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:10,style:{width:120},step:.1,precision:2,value:w,onChange:U=>{U!==null&&x(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [0, 10] ",B.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",A)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",A)})]})})})]})})},r8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=ao(z.SolarPanel),[d,f]=g.useState((u==null?void 0:u.poleSpacing)??0),p=Kt(),m=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.id===T&&!D.locked){const k=D;k.poleSpacing=R;break}})},y=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.foundationId===T&&!D.locked){const k=D;k.poleSpacing=R}})},w=(T,R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&!k.locked){let N;if(R?N=k.parentId===T&&ye.isIdentical(k.normal,R):N=k.parentId===T,N){const U=k;U.poleSpacing=M}}})},x=T=>{e(R=>{for(const M of R.elements)if(M.type===z.SolarPanel&&!M.locked){const D=M;D.poleSpacing=T}})},C=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&!D.locked&&T.has(D.id)){const k=D;k.poleSpacing=R}})},P=T=>{l(T.target.value)},A=T=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&Math.abs(R.poleSpacing-T)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs(R.poleSpacing-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs(R.poleSpacing-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&ye.isIdentical(D.normal,u.normal)&&!D.locked&&Math.abs(D.poleSpacing-T)>Ht)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&!D.locked&&Math.abs(D.poleSpacing-T)>Ht)return!0}break}default:{if(Math.abs((u==null?void 0:u.poleSpacing)-T)>Ht)return!0;break}}return!1}},S=T=>{if(u&&A(T)){switch(a){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.poleSpacing);const M={name:"Set Pole Spacing for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{C(M.oldValues,M.newValue)}};i(M),C(R,T),c(s+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&R.set(D.id,D.poleSpacing);const M={name:"Set Pole Spacing for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{x(M.newValue)}};i(M),x(T),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===u.foundationId&&R.set(D.id,D.poleSpacing);const M={name:"Set Pole Spacing for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:u.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{M.groupId&&y(M.groupId,M.newValue)}};i(M),y(u.foundationId,T),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const M=new Map,D=R.type===z.Cuboid;if(D)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&M.set(U.id,U.poleSpacing);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&M.set(U.id,U.poleSpacing);const k=D?u.normal:void 0,N={name:"Set Pole Spacing for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:u.parentId,normal:k,undo:()=>{for(const[U,W]of N.oldValues.entries())m(U,W)},redo:()=>{N.groupId&&w(N.groupId,N.normal,N.newValue)}};i(N),w(u.parentId,k,T),c(s+1)}break}default:{const R=o(u.id),M=R?R.poleSpacing:u.poleSpacing,D={name:"Set Solar Panel Array Pole Spacing",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:u.id,changedElementType:u.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};i(D),m(u.id,T),c(s+1);break}}e(R=>{R.actionState.solarPanelPoleSpacing=T})}},v=()=>{t(!1)},b=()=>{S(d),t(!1),c(0)};return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.PoleSpacing",p),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:1,style:{width:120},precision:2,value:d,onChange:T=>{T!==null&&f(T)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [1, 10] ",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},i8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Jn),i=H(UPt),a=H(jPt),l=H(BPt),s=H(Fn),c=H(Wh),u=H(Nh),d=H(no),f=H(qn),p=H(Ji),m=ao(z.SolarPanel),[y,w]=g.useState((m==null?void 0:m.cx)??0),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=U=>{u(U.target.value)},S=U=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cx-U)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cx-U)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(m==null?void 0:m.foundationId)&&!W.locked&&Math.abs(W.cx-U)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.cx)-U)>Ht)return!0}return!1}},v=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked&&U.has(E.id)){const L=E;L.cx=W}})},b=(U,W,F)=>U+.5*W/F<.5&&U-.5*W/F>-.5,T=U=>{if(!m||!S(U))return;C.current=void 0;const W=o(m);if(W){switch(c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(F.id)&&!b(U,m.lx,W.lx)){x.current=!0;break}if(x.current)C.current=U,w(m.cx);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.cx);const E={name:"Set Center X for Selected Solar Panel",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{v(E.oldValues,E.newValue)}};s(E),v(F,U),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&!b(U,m.lx,W.lx)){x.current=!0;break}if(x.current)C.current=U,w(m.cx);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&F.set(L.id,L.cx);const E={name:"Set Center X for All Solar Panels",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,E.newValue)}};s(E),l(z.SolarPanel,U),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&F.foundationId===m.foundationId&&!b(U,m.lx,W.lx)){x.current=!0;break}if(x.current)C.current=U,w(m.cx);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===m.foundationId&&F.set(L.id,L.cx);const E={name:"Set Center X for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:F,newValue:U,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{E.groupId&&a(z.SolarPanel,E.groupId,E.newValue)}};s(E),a(z.SolarPanel,m.foundationId,U),f(d+1)}}break}default:{const F=r(m.id),E=F?F.cx:m.cx;if(x.current=!b(U,m.lx,W.lx),x.current)C.current=U,w(E);else{const L={name:"Set Solar Panel Center X",timestamp:Date.now(),oldValue:E,newValue:U,changedElementId:m.id,changedElementType:m.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(m.id,U),f(d+1)}break}}e(F=>{F.actionState.solarPanelCx=U})}},R=()=>{x.current=!1,t(!1)},M=()=>{R(),p()},D=()=>{T(y),x.current||(t(!1),f(0))},k=()=>{T(y)},N=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeXCoordinateOfCenter",P),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:y,onChange:U=>{U!==null&&w(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},a8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Jn),i=H(YPt),a=H(OPt),l=H(_Pt),s=H(Fn),c=H(Wh),u=H(Nh),d=H(no),f=H(qn),p=H(Ji),m=ao(z.SolarPanel),[y,w]=g.useState((m==null?void 0:m.cy)??0),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=U=>{u(U.target.value)},S=U=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cy-U)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cy-U)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(m==null?void 0:m.foundationId)&&!W.locked&&Math.abs(W.cy-U)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.cy)-U)>Ht)return!0}return!1}},v=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked&&U.has(E.id)){const L=E;L.cy=W}})},b=(U,W,F)=>U+.5*W/F<.5&&U-.5*W/F>-.5,T=U=>{if(!m||!S(U))return;C.current=void 0;const W=o(m);if(W){switch(c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(F.id)&&!b(U,m.ly,W.ly)){x.current=!0;break}if(x.current)C.current=U,w(m.cy);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.cy);const E={name:"Set Center Y for Selected Solar Panel",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{v(E.oldValues,E.newValue)}};s(E),v(F,U),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&!b(U,m.ly,W.ly)){x.current=!0;break}if(x.current)C.current=U,w(m.cy);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&F.set(L.id,L.cy);const E={name:"Set Center Y for All Solar Panels",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,E.newValue)}};s(E),l(z.SolarPanel,U),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&F.foundationId===m.foundationId&&!b(U,m.ly,W.ly)){x.current=!0;break}if(x.current)C.current=U,w(m.cy);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===m.foundationId&&F.set(L.id,L.cy);const E={name:"Set Center Y for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:F,newValue:U,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{E.groupId&&a(z.SolarPanel,E.groupId,E.newValue)}};s(E),a(z.SolarPanel,m.foundationId,U),f(d+1)}}break}default:{const F=r(m.id),E=F?F.cy:m.cy;if(x.current=!b(U,m.ly,W.ly),x.current)C.current=U,w(E);else{const L={name:"Set Solar Panel Center Y",timestamp:Date.now(),oldValue:E,newValue:U,changedElementId:m.id,changedElementType:m.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(m.id,U),f(d+1)}break}}e(F=>{F.actionState.solarPanelCy=U})}},R=()=>{x.current=!1,t(!1)},M=()=>{R(),p()},D=()=>{T(y),x.current||(t(!1),f(0))},k=()=>{T(y)},N=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeYCoordinateOfCenter",P),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:y,onChange:U=>{U!==null&&w(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},l8o=t=>{const e=[];if(t.type!==z.SolarPanel)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=t.type===z.SolarPanel&&ye.isIdentical(n.normal,fs);return e.push({key:"solar-panel-copy",label:h.jsx(ad,{})}),o&&e.push({key:"solar-panel-cut",label:h.jsx(ld,{})}),e.push({key:"solar-panel-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"solar-panel-model-change",label:h.jsxs(Zn,{Dialog:Jwo,children:[B.t("solarPanelMenu.ChangePvModel",r)," (",n.pvModelName,") ..."]})},{key:"solar-panel-orientation",label:h.jsxs(Zn,{Dialog:Kwo,children:[B.t("solarPanelMenu.Orientation",r)," ..."]})},{key:"solar-panel-length",label:h.jsxs(Zn,{Dialog:$wo,children:[B.t("word.Length",r)," ..."]})},{key:"solar-panel-width",label:h.jsxs(Zn,{Dialog:qwo,children:[B.t("word.Width",r)," ..."]})}),e.push({key:"solar-panel-coordinates-submenu",label:h.jsx(ln,{children:B.t("solarCollectorMenu.Coordinates",r)}),children:[{key:"solar-panel-center-x",label:h.jsxs(Zn,{Dialog:i8o,children:[B.t("solarCollectorMenu.RelativeXCoordinateOfCenter",r)," ..."]})},{key:"solar-panel-center-y",label:h.jsxs(Zn,{Dialog:a8o,children:[B.t("solarCollectorMenu.RelativeYCoordinateOfCenter",r)," ..."]})}]}),n.parentType===z.Wall&&e.push({key:"solar-panel-tilt-angle-on-wall",label:h.jsxs(Zn,{Dialog:HEe,children:[B.t("solarPanelMenu.TiltAngle",r)," ..."]})}),i&&(n.trackerType===Bl.NO_TRACKER&&e.push({key:"solar-panel-tilt-angle",label:h.jsxs(Zn,{Dialog:HEe,children:[B.t("solarPanelMenu.TiltAngle",r)," ..."]})}),e.push({key:"solar-panel-relative-azimuth",label:h.jsxs(Zn,{Dialog:e8o,children:[B.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),n.parentType!==z.Roof&&e.push({key:"solar-panel-tracker",label:h.jsxs(Zn,{Dialog:t8o,children:[B.t("solarPanelMenu.Tracker",r)," ..."]})})),e.push({key:"solar-panel-frame-color",label:h.jsxs(Zn,{Dialog:n8o,children:[B.t("solarPanelMenu.FrameColor",r)," ..."]})}),e.push({key:"solar-panel-draw-sun-beam",label:h.jsx(n6e,{solarCollector:n})}),e.push({key:"solar-panel-electrical-submenu",label:h.jsx(ln,{children:B.t("solarPanelMenu.ElectricalProperties",r)}),children:[{key:"solar-panel-inverter-efficiency",label:h.jsxs(Zn,{Dialog:Qwo,children:[B.t("solarPanelMenu.InverterEfficiency",r)," ..."]})},{key:"solar-panel-dc-ac-ratio",label:h.jsxs(Zn,{Dialog:Zwo,children:[B.t("solarPanelMenu.DcToAcSizeRatio",r)," ..."]})}]}),e.push({key:"solar-panel-pole-submenu",label:h.jsx(ln,{children:B.t("solarCollectorMenu.Pole",r)}),children:[{key:"solar-panel-pole-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:o8o,children:[B.t("solarCollectorMenu.PoleHeight",r)," ..."]})},{key:"solar-panel-pole-spacing",label:h.jsxs(Zn,{noPadding:!0,Dialog:r8o,children:[B.t("solarPanelMenu.PoleSpacing",r)," ..."]})}]}),e.push({key:"solar-panel-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)})),{items:e}},s8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(H7),r=H(gQ),i=H(ON),a=H($r),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=H(Ji),p=ao(z.ParabolicTrough),[m,y]=g.useState((p==null?void 0:p.ly)??9),w=g.useRef(!1),x=g.useRef(),C=Kt(),P=W=>{c(W.target.value)},A=(W,F)=>{const E=a(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.ly=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},S=(W,F)=>!A(W,F),v=W=>{if(p){switch(s){case ie.AllSelectedObjectsOfThisType:for(const F of e)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of e)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of e)if(F.type===z.ParabolicTrough&&F.foundationId===(p==null?void 0:p.foundationId)&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Ht)return!0}return!1}},b=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.ly=F)})},T=W=>{if(p&&v(W))switch(x.current=void 0,s){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.ly);const E={name:"Set Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{b(E.oldValues,E.newValue)}};l(E),b(F,W),d(u+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.ParabolicTrough&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.ParabolicTrough&&F.set(L.id,L.ly);const E={name:"Set Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{i(z.ParabolicTrough,E.newValue)}};l(E),i(z.ParabolicTrough,W),d(u+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){w.current=!1;for(const F of e)if(F.type===z.ParabolicTrough&&F.foundationId===p.foundationId&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.ParabolicTrough&&L.foundationId===p.foundationId&&F.set(L.id,L.ly);const E={name:"Set Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{E.groupId&&r(z.ParabolicTrough,E.groupId,E.newValue)}};l(E),r(z.ParabolicTrough,p.foundationId,W),d(u+1)}}break}default:{const F=n(p.id),E=F?F.ly:p.ly;if(w.current=S(p,W),w.current)x.current=W,y(E);else{const L={name:"Set Parabolic Trough Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{w.current=!1,t(!1)},M=()=>{R(),f()},D=()=>{T(m),w.current||(t(!1),d(0))},k=W=>{if(!p)return 1;let F=W??1;return F=Math.max(1,Math.ceil((F-p.moduleLength/2)/p.moduleLength))*p.moduleLength,F},N=()=>{T(m)};if((p==null?void 0:p.type)!==z.ParabolicTrough)return null;const U=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current!==void 0?" ("+x.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:p.moduleLength,max:100*p.moduleLength,step:p.moduleLength,precision:2,style:{width:120},value:m,onChange:W=>{y(k(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("parabolicTroughMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+B.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(m/p.moduleLength)+" "+B.t("parabolicTroughMenu.ModulesLong",C),h.jsx("br",{}),B.t("word.Maximum",C),": 100 ",B.t("parabolicTroughMenu.Modules",C)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",C)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",C)})]})})})]})})},c8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(pQ),a=H(YN),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.lx)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.lx=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.lx)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.lx=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.lx);const E={name:"Set Width for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&F.set(L.id,L.lx);const E={name:"Set Width for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,E.newValue)}};s(E),a(z.ParabolicTrough,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===m.foundationId&&F.set(L.id,L.lx);const E={name:"Set Width for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicTrough,E.groupId,E.newValue)}};s(E),i(z.ParabolicTrough,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.lx:m.lx;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Trough Width",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicTroughWidth=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},u8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(UXe),i=H(jXe),a=H(BXe),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.moduleLength)??3),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.moduleLength)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.moduleLength=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,E.newValue)}};s(E),a(z.ParabolicTrough,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===m.foundationId&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicTrough,E.groupId,E.newValue)}};s(E),i(z.ParabolicTrough,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.moduleLength:m.moduleLength;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Trough Module Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicTroughModuleLength=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},d8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(LXe),i=H(WXe),a=H(NXe),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.latusRectum)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.latusRectum)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.latusRectum=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,E.newValue)}};s(E),a(z.ParabolicTrough,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===m.foundationId&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicTrough,E.groupId,E.newValue)}};s(E),i(z.ParabolicTrough,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.latusRectum:m.latusRectum;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Trough Latus Rectum",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicTroughLatusRectum=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},f8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=N=>{u(N.target.value)},S=N=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===(m==null?void 0:m.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const W of n)if(W.type===z.ParabolicTrough&&W.parentId===m.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-N)>Ht)return!0;break}}return!1}},v=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)F.type===z.ParabolicTrough&&!F.locked&&N.has(F.id)&&(F.tiltAngle=U)})},b=N=>{if(m&&S(N)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{v(W.oldValues,W.newValue)}};s(W),v(U,N),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicTrough&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{a(z.ParabolicTrough,W.newValue)}};s(W),a(z.ParabolicTrough,N),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===m.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:m.foundationId,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{W.groupId&&i(z.ParabolicTrough,W.groupId,W.newValue)}};s(W),i(z.ParabolicTrough,m.foundationId,N),f(d+1)}}break}default:{const U=o(m.id),W=U?U.poleHeight:m.poleHeight;if(x.current=.5*m.lx*Math.abs(Math.sin(m.tiltAngle))>N,x.current)C.current=N,w(W);else{const F={name:"Set Parabolic Trough Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(m.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicTroughPoleHeight=N})}},T=()=>{x.current=!1,t(!1)},R=()=>{T(),p()},M=()=>{b(y),x.current||(t(!1),f(0))},D=()=>{b(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const k=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:k,onApply:D,onClose:T,onClickCancel:R,onClickOk:M,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:N=>{N!==null&&w(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [0, 5] ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},h8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Parabolic Trough Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},p8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(TXe),i=H(PXe),a=H(CXe),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.absorptance)??.95),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.absorptance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.absorptance:f.absorptance,R={name:"Set Parabolic Trough Absorptance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughAbsorptance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},g8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(RXe),i=H(HXe),a=H(MXe),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.opticalEfficiency)??.7),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.opticalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Trough Optical Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughOpticalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},m8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(IXe),i=H(zXe),a=H(DXe),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.thermalEfficiency)??.3),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.thermalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Trough Thermal Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughThermalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},y8o=t=>{const e=[];if(t.type!==z.ParabolicTrough)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"parabolic-trough-copy",label:h.jsx(ad,{})}),r&&e.push({key:"parabolic-trough-cut",label:h.jsx(ld,{})}),e.push({key:"parabolic-trough-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"parabolic-trough-length",label:h.jsxs(Zn,{Dialog:s8o,children:[B.t("word.Length",o)," ..."]})},{key:"parabolic-trough-width",label:h.jsxs(Zn,{Dialog:c8o,children:[B.t("word.Width",o)," ..."]})},{key:"parabolic-trough-module-length",label:h.jsxs(Zn,{Dialog:u8o,children:[B.t("parabolicTroughMenu.ModuleLength",o)," ..."]})},{key:"parabolic-trough-latus-rectum",label:h.jsxs(Zn,{Dialog:d8o,children:[B.t("parabolicTroughMenu.LatusRectum",o)," ..."]})},{key:"parabolic-trough-pole-height",label:h.jsxs(Zn,{Dialog:f8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-trough-reflectance",label:h.jsxs(Zn,{Dialog:h8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-trough-absorptance",label:h.jsxs(Zn,{Dialog:p8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-trough-optical-efficiency",label:h.jsxs(Zn,{Dialog:g8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-trough-thermal-efficiency",label:h.jsxs(Zn,{Dialog:m8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(n6e,{solarCollector:n})},{key:"parabolic-trough-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},A8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(H7),a=H(pQ),l=H(gQ),s=H(YN),c=H(ON),u=H($r),d=H(Fn),f=H(y4),p=H(A4),m=H(no),y=H(qn),w=H(Ji),x=ao(z.ParabolicDish),[C,P]=g.useState((x==null?void 0:x.lx)??2),A=g.useRef(!1),S=g.useRef(),v=Kt(),b=L=>{p(L.target.value)},T=(L,j)=>{const Y=u(L);if(Y){const O=JSON.parse(JSON.stringify(L));return O.lx=j,ye.isSolarCollectorWithinHorizontalSurface(O,Y)}return!1},R=(L,j)=>!T(L,j),M=L=>{if(x){switch(f){case ie.AllSelectedObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.lx-L)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&Math.abs(j.lx-L)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===(x==null?void 0:x.foundationId)&&!j.locked&&Math.abs(j.lx-L)>Ht)return!0;break;default:if(Math.abs((x==null?void 0:x.lx)-L)>Ht)return!0}return!1}},D=(L,j)=>{H.getState().set(Y=>{for(const O of Y.elements)O.type===z.ParabolicDish&&!O.locked&&L.has(O.id)&&(O.lx=j,O.ly=j)})},k=L=>{if(x&&M(L)){switch(S.current=void 0,f){case ie.AllSelectedObjectsOfThisType:{A.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(j.id)&&R(j,L)){A.current=!0;break}if(A.current)S.current=L,P(x.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.lx);const Y={name:"Set Diameter for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_),i(O,_)},redo:()=>{D(Y.oldValues,Y.newValue)}};d(Y),D(j,L),y(m+1)}break}case ie.AllObjectsOfThisType:{A.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&R(j,L)){A.current=!0;break}if(A.current)S.current=L,P(x.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&j.set(O.id,O.lx);const Y={name:"Set Diameter for All Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_),i(O,_)},redo:()=>{s(z.ParabolicDish,Y.newValue),c(z.ParabolicDish,Y.newValue)}};d(Y),s(z.ParabolicDish,L),c(z.ParabolicDish,L),y(m+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(x.foundationId){A.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===x.foundationId&&R(j,L)){A.current=!0;break}if(A.current)S.current=L,P(x.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&O.foundationId===x.foundationId&&j.set(O.id,O.lx);const Y={name:"Set Diameter for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:x.foundationId,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_),i(O,_)},redo:()=>{Y.groupId&&(a(z.ParabolicDish,Y.groupId,Y.newValue),l(z.ParabolicDish,Y.groupId,Y.newValue))}};d(Y),a(z.ParabolicDish,x.foundationId,L),l(z.ParabolicDish,x.foundationId,L),y(m+1)}}break}default:{const j=o(x.id),Y=j?j.lx:x.lx;if(A.current=R(x,L),A.current)S.current=L,P(Y);else{const O={name:"Set Parabolic Dish Diameter",timestamp:Date.now(),oldValue:Y,newValue:L,changedElementId:x.id,changedElementType:x.type,undo:()=>{r(O.changedElementId,O.oldValue),i(O.changedElementId,O.oldValue)},redo:()=>{r(O.changedElementId,O.newValue),i(O.changedElementId,O.newValue)}};d(O),r(x.id,L),i(x.id,L),y(m+1)}break}}e(j=>{j.actionState.parabolicDishRimDiameter=L})}},N=()=>{A.current=!1,t(!1)},U=()=>{N(),w()},W=()=>{k(C),A.current||(t(!1),y(0))},F=()=>{k(C)};if((x==null?void 0:x.type)!==z.ParabolicDish)return null;const E=A.current?": "+B.t("message.NotApplicableToSelectedAction",v)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicDishMenu.RimDiameter",v),rejectedMessage:E,onApply:F,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:C,onChange:L=>{L!==null&&P(L)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",v),": 1 ",B.t("word.MeterAbbreviation",v),h.jsx("br",{}),B.t("word.MaximumValue",v),": 10 ",B.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",v)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b,value:f,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",v)})]})})})]})})},w8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(LXe),i=H(WXe),a=H(NXe),l=H($r),s=H(Fn),c=H(y4),u=H(A4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicDish),[y,w]=g.useState((m==null?void 0:m.latusRectum)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicDish&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicDish&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicDish&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.latusRectum)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicDish&&!L.locked&&W.has(L.id)&&(L.latusRectum=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicDish&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicDish&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Dishes",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicDish,E.newValue)}};s(E),a(z.ParabolicDish,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicDish&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicDish&&L.foundationId===m.foundationId&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicDish,E.groupId,E.newValue)}};s(E),i(z.ParabolicDish,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.latusRectum:m.latusRectum;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Dish Latus Rectum",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicDishLatusRectum=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicDish)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicDishMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},x8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(y4),a=H(A4),l=H(no),s=H(qn),c=ao(z.ParabolicDish),[u,d]=g.useState((c==null?void 0:c.structureType)??pf.CentralPole),f=Kt(),{Option:p}=Ko,m=(b,T)=>{e(R=>{for(const M of R.elements)if(M.id===b&&!M.locked&&M.type===z.ParabolicDish){M.structureType=T;break}})},y=(b,T)=>{e(R=>{for(const M of R.elements)M.foundationId===b&&!M.locked&&M.type===z.ParabolicDish&&(M.structureType=T)})},w=b=>{e(T=>{for(const R of T.elements)R.locked||R.type===z.ParabolicDish&&(R.structureType=b)})},x=b=>{a(b.target.value)},C=b=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.structureType!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&T.structureType!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of n)if(T.type===z.ParabolicDish&&T.foundationId===(c==null?void 0:c.foundationId)&&!T.locked&&T.structureType!==b)return!0;break;default:if((c==null?void 0:c.structureType)!==b)return!0}return!1},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.ParabolicDish&&!M.locked&&b.has(M.id)&&(M.structureType=T)})},A=b=>{if(c&&C(b)){switch(i){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.structureType);const R={name:"Set Structure Type for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())m(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};r(R),P(T,b),s(l+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&T.set(M.id,M.structureType);const R={name:"Set Structure Type for All Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())m(M,D)},redo:()=>{w(R.newValue)}};r(R),w(b),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const T=new Map;for(const M of n)M.type===z.ParabolicDish&&M.foundationId===c.foundationId&&T.set(M.id,M.structureType);const R={name:"Set Structure Type for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())m(M,D)},redo:()=>{R.groupId&&y(R.groupId,R.newValue)}};r(R),y(c.foundationId,b),s(l+1)}break}default:{const T=o(c.id),R=T?T.structureType:c.structureType,M={name:"Set Parabolic Dish Structure Type",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{m(M.changedElementId,M.oldValue)},redo:()=>{m(M.changedElementId,M.newValue)}};r(M),m(c.id,b),s(l+1);break}}e(T=>{T.actionState.parabolicDishReceiverStructure=b})}},S=()=>{t(!1)},v=()=>{A(u)};return(c==null?void 0:c.type)!==z.ParabolicDish?null:h.jsx(ro,{width:640,title:B.t("parabolicDishMenu.ReceiverStructure",f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsxs(Ko,{value:u,onChange:b=>d(b),children:[h.jsx(p,{value:pf.CentralPole,children:B.t("parabolicDishMenu.CentralPole",f)},pf.CentralPole),h.jsx(p,{value:pf.CentralPoleWithTripod,children:B.t("parabolicDishMenu.CentralPoleWithTripod",f)},pf.CentralPoleWithTripod),h.jsx(p,{value:pf.Quadrupod,children:B.t("parabolicDishMenu.Quadrupod",f)},pf.Quadrupod)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:x,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",f)})]})})})]})})},v8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(y4),u=H(A4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicDish),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=N=>{u(N.target.value)},S=N=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===(m==null?void 0:m.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const W of n)if(W.type===z.ParabolicDish&&W.parentId===m.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-N)>Ht)return!0;break}}return!1}},v=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)F.type===z.ParabolicDish&&!F.locked&&N.has(F.id)&&(F.tiltAngle=U)})},b=N=>{if(m&&S(N)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{v(W.oldValues,W.newValue)}};s(W),v(U,N),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicDish&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{a(z.ParabolicDish,W.newValue)}};s(W),a(z.ParabolicDish,N),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===m.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicDish&&F.foundationId===m.foundationId&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:m.foundationId,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{W.groupId&&i(z.ParabolicDish,W.groupId,W.newValue)}};s(W),i(z.ParabolicDish,m.foundationId,N),f(d+1)}}break}default:{const U=o(m.id),W=U?U.poleHeight:m.poleHeight;if(x.current=.5*m.lx*Math.abs(Math.sin(m.tiltAngle))>N,x.current)C.current=N,w(W);else{const F={name:"Set Parabolic Dish Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(m.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicDishPoleHeight=N})}},T=()=>{x.current=!1,t(!1)},R=()=>{T(),p()},M=()=>{b(y),x.current||(t(!1),f(0))},D=()=>{b(y)};if((m==null?void 0:m.type)!==z.ParabolicDish)return null;const k=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicDishMenu.ExtraPoleHeightInAdditionToRadius",P),rejectedMessage:k,onApply:D,onClose:T,onClickCancel:R,onClickOk:M,children:h.jsxs(Qt,{children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:N=>{N!==null&&w(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [0, 5] ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},b8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(vXe),i=H(bXe),a=H(SXe),l=H($r),s=H(Fn),c=H(y4),u=H(A4),d=H(no),f=H(qn),p=ao(z.ParabolicDish),[m,y]=g.useState((p==null?void 0:p.poleRadius)??.1),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of n)if(T.type===z.ParabolicDish&&T.foundationId===(p==null?void 0:p.foundationId)&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.ParabolicDish&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-b)>Ht)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-b)>Ht)return!0;break}}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.ParabolicDish&&!M.locked&&b.has(M.id)&&(M.poleRadius=T)})},A=b=>{if(p&&C(b)){switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.ParabolicDish,R.newValue)}};s(R),a(z.ParabolicDish,b),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of n)M.type===z.ParabolicDish&&M.foundationId===p.foundationId&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.ParabolicDish,R.groupId,R.newValue)}};s(R),i(z.ParabolicDish,p.foundationId,b),f(d+1)}break}default:{const T=o(p.id),R=T?T.poleRadius:p.poleRadius,M={name:"Set Parabolic Dish Pole Radius",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}e(T=>{T.actionState.parabolicDishPoleRadius=b})}},S=()=>{t(!1)},v=()=>{A(m)};return(p==null?void 0:p.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.PoleRadius",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:m,onChange:b=>{b!==null&&y(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",w),": [0.1, 0.5] ",B.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",w)})]})})})]})})},S8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Parabolic Dish Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},T8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(TXe),i=H(PXe),a=H(CXe),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.absorptance)??.95),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.absorptance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.absorptance:f.absorptance,R={name:"Set Parabolic Dish Absorptance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishAbsorptance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},P8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(RXe),i=H(HXe),a=H(MXe),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.opticalEfficiency)??.7),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.opticalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Dish Optical Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishOpticalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},C8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(IXe),i=H(zXe),a=H(DXe),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.thermalEfficiency)??.3),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.thermalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Dish Thermal Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishThermalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},R8o=t=>{const e=[];if(t.type!==z.ParabolicDish)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"parabolic-dish-copy",label:h.jsx(ad,{})}),r&&e.push({key:"parabolic-dish-cut",label:h.jsx(ld,{})}),e.push({key:"parabolic-dish-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"parabolic-dish-radius",label:h.jsxs(Zn,{Dialog:A8o,children:[B.t("parabolicDishMenu.RimDiameter",o)," ..."]})},{key:"parabolic-dish-latus-rectum",label:h.jsxs(Zn,{Dialog:w8o,children:[B.t("parabolicDishMenu.LatusRectum",o)," ..."]})},{key:"parabolic-dish-structure-type",label:h.jsxs(Zn,{Dialog:x8o,children:[B.t("parabolicDishMenu.ReceiverStructure",o)," ..."]})},{key:"parabolic-dish-pole-height",label:h.jsxs(Zn,{Dialog:v8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-dish-pole-radius",label:h.jsxs(Zn,{Dialog:b8o,children:[B.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"parabolic-dish-reflectance",label:h.jsxs(Zn,{Dialog:S8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-dish-absorptance",label:h.jsxs(Zn,{Dialog:T8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-dish-optical-efficiency",label:h.jsxs(Zn,{Dialog:P8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-dish-thermal-efficiency",label:h.jsxs(Zn,{Dialog:C8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(n6e,{solarCollector:n})},{key:"parabolic-dish-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},H8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(gXe),r=H(mXe),i=H(yXe),a=H(Fn),l=H(zS),s=H(DS),c=H(no),u=H(qn),d=ao(z.FresnelReflector),[f,p]=g.useState(!!(d!=null&&d.drawSunBeam)),m=Kt(),y=S=>{s(S.target.value)},w=S=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.FresnelReflector&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.FresnelReflector&&!v.locked&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.FresnelReflector&&v.foundationId===(d==null?void 0:d.foundationId)&&!v.locked&&v.drawSunBeam!==S)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==S)return!0}return!1},x=(S,v)=>{H.getState().set(b=>{for(const T of b.elements)ye.isSolarCollectorType(T.type)&&!T.locked&&T.type===z.FresnelReflector&&S.has(T.id)&&(T.drawSunBeam=v)})},C=S=>{if(d&&w(S))switch(l){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{x(b.oldValues,b.newValue)}};a(b),x(v,S),u(c+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.FresnelReflector&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Fresnel Reflectors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{i(z.FresnelReflector,b.newValue)}};a(b),i(z.FresnelReflector,S),u(c+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const v=new Map;for(const T of e)T.type===z.FresnelReflector&&T.foundationId===d.foundationId&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:d.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{b.groupId&&r(z.FresnelReflector,b.groupId,b.newValue)}};a(b),r(z.FresnelReflector,d.foundationId,S),u(c+1)}break}default:{const v=n(d.id),b=v?v.drawSunBeam:d.drawSunBeam,T={name:"Draw Sun Beam for Fresnel Reflector",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(T.changedElementId,T.oldValue)},redo:()=>{o(T.changedElementId,T.newValue)}};a(T),o(d.id,S),u(c+1);break}}},P=()=>{t(!1)},A=()=>{C(f)};return(d==null?void 0:d.type)!==z.FresnelReflector?null:h.jsx(ro,{width:500,title:B.t("solarCollectorMenu.DrawSunBeam",m),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsx(zc,{checked:f,onChange:S=>{p(S)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:y,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",m)})]})})})]})})},{Option:M8o}=Ko,I8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(EXe),i=H(kXe),a=H(FXe),l=H(Fn),s=H(zS),c=H(DS),u=H(no),d=H(qn),f=ao(z.FresnelReflector),[p,m]=g.useState((f==null?void 0:f.receiverId)??"None"),y=Kt(),w=g.useMemo(()=>{const b=[];for(const T of n)if(T.type===z.Foundation){const R=T;R.solarStructure===Nn.FocusPipe&&b.push(R.id)}return b},[n]);g.useEffect(()=>{if(m("None"),f)if(f.receiverId)m(f.receiverId);else{const b=o(f.parentId);b&&b.type===z.Foundation&&b.solarStructure===Nn.FocusPipe&&m(b.id)}},[f]);const x=b=>{c(b.target.value)},C=b=>{switch(s){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.FresnelReflector&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.receiverId!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.FresnelReflector&&!T.locked&&T.receiverId!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of n)if(T.type===z.FresnelReflector&&T.foundationId===(f==null?void 0:f.foundationId)&&!T.locked&&T.receiverId!==b)return!0;break;default:if((f==null?void 0:f.receiverId)!==b)return!0}return!1},P=(b,T)=>{e(R=>{for(const M of R.elements)ye.isHeliostatOrFresnelReflector(M.type)&&!M.locked&&b.has(M.id)&&(M.type===z.Heliostat?M.towerId=T:M.type===z.FresnelReflector&&(M.receiverId=T))})},A=b=>{if(f&&C(b)){switch(s){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.receiverId);const R={name:"Set Receiver for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(T,b),d(u+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.FresnelReflector&&T.set(M.id,M.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.FresnelReflector,R.newValue)}};l(R),a(z.FresnelReflector,b),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const T=new Map;for(const M of n)M.type===z.FresnelReflector&&M.foundationId===f.foundationId&&T.set(M.id,M.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:f.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.FresnelReflector,R.groupId,R.newValue)}};l(R),i(z.FresnelReflector,f.foundationId,b),d(u+1)}break}default:{const T=o(f.id),R=T?T.receiverId:f.receiverId,M={name:"Set Receiver for Fresnel Reflector",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};l(M),r(f.id,b),d(u+1);break}}e(T=>{T.actionState.fresnelReflectorReceiver=b})}},S=()=>{t(!1)},v=()=>{p&&A(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(ro,{width:640,title:B.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",y),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsx(Ko,{style:{width:"160px"},value:p,onChange:b=>{m(b)},children:w.map((b,T)=>h.jsx(M8o,{value:b,children:B.t("fresnelReflectorMenu.AbsorberPipe",y)+" "+(T+1)},T))})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:x,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",y)})]})})})]})})},z8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(H7),r=H(gQ),i=H(ON),a=H($r),l=H(Fn),s=H(zS),c=H(DS),u=H(no),d=H(qn),f=H(Ji),p=ao(z.FresnelReflector),[m,y]=g.useState((p==null?void 0:p.ly)??9),w=g.useRef(!1),x=g.useRef(),C=Kt(),P=W=>{c(W.target.value)},A=(W,F)=>{const E=a(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.ly=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},S=(W,F)=>!A(W,F),v=W=>{if(p){switch(s){case ie.AllSelectedObjectsOfThisType:for(const F of e)if(F.type===z.FresnelReflector&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of e)if(F.type===z.FresnelReflector&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of e)if(F.type===z.FresnelReflector&&F.foundationId===(p==null?void 0:p.foundationId)&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Ht)return!0}return!1}},b=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.ly=F)})},T=W=>{if(p&&v(W))switch(x.current=void 0,s){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(F.id)&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.ly);const E={name:"Set Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{b(E.oldValues,E.newValue)}};l(E),b(F,W),d(u+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.FresnelReflector&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.FresnelReflector&&F.set(L.id,L.ly);const E={name:"Set Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{i(z.FresnelReflector,E.newValue)}};l(E),i(z.FresnelReflector,W),d(u+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){w.current=!1;for(const F of e)if(F.type===z.FresnelReflector&&F.foundationId===p.foundationId&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.FresnelReflector&&L.foundationId===p.foundationId&&F.set(L.id,L.ly);const E={name:"Set Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{E.groupId&&r(z.FresnelReflector,E.groupId,E.newValue)}};l(E),r(z.FresnelReflector,p.foundationId,W),d(u+1)}}break}default:{const F=n(p.id),E=F?F.ly:p.ly;if(w.current=S(p,W),w.current)x.current=W,y(E);else{const L={name:"Set Fresnel Reflector Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{w.current=!1,t(!1)},M=()=>{R(),f()},D=()=>{T(m),w.current||(t(!1),d(0))},k=W=>{if(!p)return 1;let F=W??1;return F=Math.max(1,Math.ceil((F-p.moduleLength/2)/p.moduleLength))*p.moduleLength,F},N=()=>{T(m)};if((p==null?void 0:p.type)!==z.FresnelReflector)return null;const U=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current!==void 0?" ("+x.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:p.moduleLength,max:200*p.moduleLength,step:p.moduleLength,style:{width:120},precision:2,value:m,onChange:W=>{W!==null&&y(k(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("fresnelReflectorMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+B.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(m/p.moduleLength)+" "+B.t("fresnelReflectorMenu.ModulesLong",C),h.jsx("br",{}),B.t("word.Maximum",C),": 200 ",B.t("fresnelReflectorMenu.Modules",C)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",C)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",C)})]})})})]})})},D8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(pQ),a=H(YN),l=H($r),s=H(Fn),c=H(zS),u=H(DS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.FresnelReflector),[y,w]=g.useState((m==null?void 0:m.lx)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.lx=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.lx)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.lx=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.lx);const E={name:"Set Width for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&F.set(L.id,L.lx);const E={name:"Set Width for All Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,E.newValue)}};s(E),a(z.FresnelReflector,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===m.foundationId&&F.set(L.id,L.lx);const E={name:"Set Width for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.FresnelReflector,E.groupId,E.newValue)}};s(E),i(z.FresnelReflector,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.lx:m.lx;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Fresnel Reflector Width",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.fresnelReflectorWidth=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.FresnelReflector)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},E8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(UXe),i=H(jXe),a=H(BXe),l=H($r),s=H(Fn),c=H(zS),u=H(DS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.FresnelReflector),[y,w]=g.useState((m==null?void 0:m.moduleLength)??3),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.moduleLength)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.moduleLength=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,E.newValue)}};s(E),a(z.FresnelReflector,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===m.foundationId&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.FresnelReflector,E.groupId,E.newValue)}};s(E),i(z.FresnelReflector,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.moduleLength:m.moduleLength;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Fresnel Reflector Module Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.fresnelReflectorModuleLength=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.FresnelReflector)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("fresnelReflectorMenu.ModuleLength",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},k8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(zS),u=H(DS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.FresnelReflector),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=g.useRef((m==null?void 0:m.poleHeight)??1),A=Kt(),S=U=>{u(U.target.value)},v=U=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===(m==null?void 0:m.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const F of n)if(F.type===z.FresnelReflector&&F.parentId===m.parentId&&!F.locked&&Math.abs(F.poleHeight-U)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-U)>Ht)return!0;break}}return!1}},b=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)E.type===z.FresnelReflector&&!E.locked&&U.has(E.id)&&(E.poleHeight=W)})},T=U=>{if(m&&v(U)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){x.current=!0;break}if(x.current)C.current=U,P.current=m.poleHeight;else{const W=new Map;for(const E of n)E.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(E.id)&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{b(F.oldValues,F.newValue)}};s(F),b(W,U),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){x.current=!0;break}if(x.current)C.current=U,P.current=m.poleHeight;else{const W=new Map;for(const E of n)E.type===z.FresnelReflector&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{a(z.FresnelReflector,F.newValue)}};s(F),a(z.FresnelReflector,U),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===m.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){x.current=!0;break}if(x.current)C.current=U,P.current=m.poleHeight;else{const W=new Map;for(const E of n)E.type===z.FresnelReflector&&E.foundationId===m.foundationId&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:m.foundationId,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{F.groupId&&i(z.FresnelReflector,F.groupId,F.newValue)}};s(F),i(z.FresnelReflector,m.foundationId,U),f(d+1)}}break}default:{const W=o(m.id),F=W?W.poleHeight:m.poleHeight;if(x.current=.5*m.lx*Math.abs(Math.sin(m.tiltAngle))>U,x.current)C.current=U,P.current=F;else{const E={name:"Set Fresnel Reflector Pole Height",timestamp:Date.now(),oldValue:F,newValue:U,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(E.changedElementId,E.oldValue)},redo:()=>{r(E.changedElementId,E.newValue)}};s(E),r(m.id,U),f(d+1)}break}}e(W=>{W.actionState.fresnelReflectorPoleHeight=U})}},R=()=>{t(!1)},M=()=>{R(),p()},D=()=>{T(y),x.current||(t(!1),f(0))},k=()=>{T(y)};if((m==null?void 0:m.type)!==z.FresnelReflector)return null;const N=x.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",A),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:U=>{U!==null&&w(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [0, 5] ",B.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",A)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",A)})]})})})]})})},F8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(zS),c=H(DS),u=H(no),d=H(qn),f=ao(z.FresnelReflector),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.FresnelReflector&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.FresnelReflector&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.FresnelReflector&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.FresnelReflector,T.newValue)}};l(T),a(z.FresnelReflector,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.FresnelReflector&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.FresnelReflector,T.groupId,T.newValue)}};l(T),i(z.FresnelReflector,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Fresnel Reflector Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.fresnelReflectorReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,value:p,step:.01,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",y)})]})})})]})})},L8o=t=>{const e=[];if(t.type!==z.FresnelReflector)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"fresnel-reflector-copy",label:h.jsx(ad,{})}),r&&e.push({key:"fresnel-reflector-cut",label:h.jsx(ld,{})}),e.push({key:"fresnel-reflector-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"fresnel-reflector-receiver",label:h.jsxs(Zn,{Dialog:I8o,children:[B.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",o)," ..."]})},{key:"fresnel-reflector-length",label:h.jsxs(Zn,{Dialog:z8o,children:[B.t("word.Length",o)," ..."]})},{key:"fresnel-reflector-width",label:h.jsxs(Zn,{Dialog:D8o,children:[B.t("word.Width",o)," ..."]})},{key:"fresnel-reflector-module-length",label:h.jsxs(Zn,{Dialog:E8o,children:[B.t("fresnelReflectorMenu.ModuleLength",o)," ..."]})},{key:"fresnel-reflector-pole-height",label:h.jsxs(Zn,{Dialog:k8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"fresnel-reflector-reflectance",label:h.jsxs(Zn,{Dialog:F8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"fresnel-reflector-draw-sun-beam",label:h.jsxs(Zn,{Dialog:H8o,children:[B.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"fresnel-reflector-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},W8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(gXe),r=H(mXe),i=H(yXe),a=H(Fn),l=H(ES),s=H(kS),c=H(no),u=H(qn),d=ao(z.Heliostat),[f,p]=g.useState(!!(d!=null&&d.drawSunBeam)),m=Kt(),y=S=>{s(S.target.value)},w=S=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Heliostat&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Heliostat&&!v.locked&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Heliostat&&v.foundationId===(d==null?void 0:d.foundationId)&&!v.locked&&v.drawSunBeam!==S)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==S)return!0}return!1},x=(S,v)=>{H.getState().set(b=>{for(const T of b.elements)T.type===z.Heliostat&&!T.locked&&S.has(T.id)&&(T.drawSunBeam=v)})},C=S=>{if(d&&w(S))switch(l){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.Heliostat&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for Selected Heliostats",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{x(b.oldValues,b.newValue)}};a(b),x(v,S),u(c+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.Heliostat&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Heliostats",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{i(z.Heliostat,b.newValue)}};a(b),i(z.Heliostat,S),u(c+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const v=new Map;for(const T of e)T.type===z.Heliostat&&T.foundationId===d.foundationId&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:d.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{b.groupId&&r(z.Heliostat,b.groupId,b.newValue)}};a(b),r(z.Heliostat,d.foundationId,S),u(c+1)}break}default:{const v=n(d.id),b=v?v.drawSunBeam:d.drawSunBeam,T={name:"Draw Sun Beam for Heliostat",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(T.changedElementId,T.oldValue)},redo:()=>{o(T.changedElementId,T.newValue)}};a(T),o(d.id,S),u(c+1);break}}},P=()=>{t(!1)},A=()=>{C(f)};return(d==null?void 0:d.type)!==z.Heliostat?null:h.jsx(ro,{width:500,title:B.t("solarCollectorMenu.DrawSunBeam",m),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsx(zc,{checked:f,onChange:p})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:y,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",m)})]})})})]})})},{Option:N8o}=Ko,U8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(EXe),i=H(kXe),a=H(FXe),l=H(Fn),s=H(ES),c=H(kS),u=H(no),d=H(qn),f=ao(z.Heliostat),[p,m]=g.useState((f==null?void 0:f.towerId)??"None"),y=Kt(),w=g.useMemo(()=>{const b=[];for(const T of n)if(T.type===z.Foundation){const R=T;R.solarStructure===Nn.FocusTower&&b.push(R.id)}return b},[n]);g.useEffect(()=>{if(m("None"),f)if(f.towerId)m(f.towerId);else{const b=o(f.parentId);b&&b.type===z.Foundation&&b.solarStructure===Nn.FocusTower&&m(b.id)}},[f]);const x=b=>{c(b.target.value)},C=b=>{switch(s){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Heliostat&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.towerId!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.Heliostat&&!T.locked&&T.towerId!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of n)if(T.type===z.Heliostat&&T.foundationId===(f==null?void 0:f.foundationId)&&!T.locked&&T.towerId!==b)return!0;break;default:if((f==null?void 0:f.towerId)!==b)return!0}return!1},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Heliostat&&!M.locked&&b.has(M.id)&&(M.towerId=T)})},A=b=>{if(f&&C(b)){switch(s){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.towerId);const R={name:"Set Tower for Selected Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(T,b),d(u+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&T.set(M.id,M.towerId);const R={name:"Set Tower for All Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.Heliostat,R.newValue)}};l(R),a(z.Heliostat,b),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const T=new Map;for(const M of n)M.type===z.Heliostat&&M.foundationId===f.foundationId&&T.set(M.id,M.towerId);const R={name:"Set Tower for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:f.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};l(R),i(z.Heliostat,f.foundationId,b),d(u+1)}break}default:{const T=o(f.id),R=T?T.towerId:f.towerId,M={name:"Set Tower for Heliostat",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};l(M),r(f.id,b),d(u+1);break}}e(T=>{T.actionState.heliostatTower=b})}},S=()=>{t(!1)},v=()=>{p&&A(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(ro,{width:600,title:B.t("heliostatMenu.SelectTowerToReflectSunlightTo",y),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsx(Ko,{style:{width:"120px"},value:p,onChange:m,children:w.map((b,T)=>h.jsx(N8o,{value:b,children:B.t("heliostatMenu.Tower",y)+" "+(T+1)},T))})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:x,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",y)})]})})})]})})},j8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(pQ),a=H(YN),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.Heliostat),[y,w]=g.useState((m==null?void 0:m.lx)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.lx=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.Heliostat&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.lx)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.lx=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.lx);const E={name:"Set Length for Selected Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&F.set(L.id,L.lx);const E={name:"Set Length for All Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,E.newValue)}};s(E),a(z.Heliostat,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.Heliostat&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===m.foundationId&&F.set(L.id,L.lx);const E={name:"Set Length for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.Heliostat,E.groupId,E.newValue)}};s(E),i(z.Heliostat,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.lx:m.lx;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Heliostat Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.heliostatLength=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.Heliostat)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Length",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},B8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(H7),i=H(gQ),a=H(ON),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.Heliostat),[y,w]=g.useState((m==null?void 0:m.ly)??4),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.ly=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.Heliostat&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.ly)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.ly=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.ly);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.ly);const E={name:"Set Width for Selected Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.ly);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&F.set(L.id,L.ly);const E={name:"Set Width for All Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,E.newValue)}};s(E),a(z.Heliostat,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.Heliostat&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.ly);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===m.foundationId&&F.set(L.id,L.ly);const E={name:"Set Width for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.Heliostat,E.groupId,E.newValue)}};s(E),i(z.Heliostat,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.ly:m.ly;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Heliostat Width",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.heliostatWidth=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.Heliostat)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},Y8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.Heliostat),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=N=>{u(N.target.value)},S=N=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.Heliostat&&U.foundationId===(m==null?void 0:m.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const W of n)if(W.type===z.Heliostat&&W.parentId===m.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-N)>Ht)return!0;break}}return!1}},v=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)F.type===z.Heliostat&&!F.locked&&N.has(F.id)&&(F.poleHeight=U)})},b=N=>{if(m&&S(N)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.Heliostat&&H.getState().selectedElementIdSet.has(U.id)&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.Heliostat&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for Selected Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{v(W.oldValues,W.newValue)}};s(W),v(U,N),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.Heliostat&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.Heliostat&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{a(z.Heliostat,W.newValue)}};s(W),a(z.Heliostat,N),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const U of n)if(U.type===z.Heliostat&&U.foundationId===m.foundationId&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.Heliostat&&F.foundationId===m.foundationId&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:m.foundationId,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{W.groupId&&i(z.Heliostat,W.groupId,W.newValue)}};s(W),i(z.Heliostat,m.foundationId,N),f(d+1)}}break}default:{const U=o(m.id),W=U?U.poleHeight:m.poleHeight;if(x.current=.5*Math.max(m.lx,m.ly)*Math.abs(Math.sin(m.tiltAngle))>N,x.current)C.current=N,w(W);else{const F={name:"Set Heliostat Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(m.id,N),f(d+1)}break}}e(U=>{U.actionState.heliostatPoleHeight=N})}},T=()=>{x.current=!1,t(!1)},R=()=>{T(),p()},M=()=>{b(y),x.current||(t(!1),f(0))},D=()=>{b(y)};if((m==null?void 0:m.type)!==z.Heliostat)return null;const k=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:k,onApply:D,onClose:T,onClickCancel:R,onClickOk:M,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:N=>{N!==null&&w(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [0, 5] ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},O8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(vXe),i=H(bXe),a=H(SXe),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=ao(z.Heliostat),[m,y]=g.useState((p==null?void 0:p.poleRadius)??.1),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const T of n)if(T.type===z.Heliostat&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const T of n)if(T.type===z.Heliostat&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of n)if(T.type===z.Heliostat&&T.foundationId===(p==null?void 0:p.foundationId)&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.Heliostat&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-b)>Ht)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-b)>Ht)return!0;break}}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Heliostat&&!M.locked&&b.has(M.id)&&(M.poleRadius=T)})},A=b=>{if(p&&C(b)){switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for Selected Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.Heliostat,R.newValue)}};s(R),a(z.Heliostat,b),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of n)M.type===z.Heliostat&&M.foundationId===p.foundationId&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};s(R),i(z.Heliostat,p.foundationId,b),f(d+1)}break}default:{const T=o(p.id),R=T?T.poleRadius:p.poleRadius,M={name:"Set Heliostat Pole Radius",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}e(T=>{T.actionState.heliostatPoleRadius=b})}},S=()=>{t(!1)},v=()=>{A(m)};return(p==null?void 0:p.type)!==z.Heliostat?null:h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.PoleRadius",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:m,onChange:b=>{b!==null&&y(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",w),": [0.1, 0.5] ",B.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",w)})]})})})]})})},_8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(ES),c=H(kS),u=H(no),d=H(qn),f=ao(z.Heliostat),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.Heliostat&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.Heliostat&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Heliostat&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Heliostats",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Heliostat&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Heliostats",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.Heliostat,T.newValue)}};l(T),a(z.Heliostat,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.Heliostat&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.Heliostat,T.groupId,T.newValue)}};l(T),i(z.Heliostat,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Heliostat Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.heliostatReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",y)})]})})})]})})},V8o=t=>{const e=[];if(t.type!==z.Heliostat)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"heliostat-copy",label:h.jsx(ad,{})}),r&&e.push({key:"heliostat-cut",label:h.jsx(ld,{})}),e.push({key:"heliostat-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"heliostat-tower",label:h.jsxs(Zn,{Dialog:U8o,children:[B.t("heliostatMenu.SelectTowerToReflectSunlightTo",o)," ..."]})},{key:"heliostat-length",label:h.jsxs(Zn,{Dialog:j8o,children:[B.t("word.Length",o)," ..."]})},{key:"heliostat-width",label:h.jsxs(Zn,{Dialog:B8o,children:[B.t("word.Width",o)," ..."]})},{key:"heliostat-pole-height",label:h.jsxs(Zn,{Dialog:Y8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"heliostat-pole-radius",label:h.jsxs(Zn,{Dialog:O8o,children:[B.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"heliostat-reflectance",label:h.jsxs(Zn,{Dialog:_8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"heliostat-draw-sun-beam",label:h.jsxs(Zn,{Dialog:W8o,children:[B.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"heliostat-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},{Option:ty}=Ko,G8o=xe.memo(({tree:t})=>{const e=H(pn),n=H(Fn),[o,r]=g.useState(!1),i=Kt(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Tree&&u.id===l){u.name=s;break}})};return h.jsxs(Ko,{style:{width:"160px"},value:(t==null?void 0:t.name)??yr.Pine,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Tree",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.treeType=l}),r(!o)}}},children:[h.jsxs(ty,{value:yr.Apple,children:[h.jsx("img",{alt:yr.Apple,src:ape,height:20,style:{paddingRight:"8px"}})," ",B.t("tree.Apple",i)]},yr.Apple),h.jsxs(ty,{value:yr.Birch,children:[h.jsx("img",{alt:yr.Birch,src:lpe,height:20,style:{paddingRight:"20px"}})," ",B.t("tree.Birch",i)]},yr.Birch),h.jsxs(ty,{value:yr.Coconut,children:[h.jsx("img",{alt:yr.Coconut,src:mnt,height:20,style:{paddingRight:"18px"}})," ",B.t("tree.Coconut",i)]},yr.Coconut),h.jsxs(ty,{value:yr.Dogwood,children:[h.jsx("img",{alt:yr.Dogwood,src:spe,height:20,style:{paddingRight:"10px"}})," ",B.t("tree.Dogwood",i)]},yr.Dogwood),h.jsxs(ty,{value:yr.Elm,children:[h.jsx("img",{alt:yr.Elm,src:cpe,height:20,style:{paddingRight:"20px"}}),B.t("tree.Elm",i)]},yr.Elm),h.jsxs(ty,{value:yr.FanPalm,children:[h.jsx("img",{alt:yr.FanPalm,src:ynt,height:20,style:{paddingRight:"18px"}})," ",B.t("tree.FanPalm",i)]},yr.FanPalm),h.jsxs(ty,{value:yr.Linden,children:[h.jsx("img",{alt:yr.Linden,src:upe,height:20,style:{paddingRight:"10px"}})," ",B.t("tree.Linden",i)]},yr.Linden),h.jsxs(ty,{value:yr.Magnolia,children:[h.jsx("img",{alt:yr.Magnolia,src:dpe,height:20,style:{paddingRight:"10px"}})," ",B.t("tree.Magnolia",i)]},yr.Magnolia),h.jsxs(ty,{value:yr.Maple,children:[h.jsx("img",{alt:yr.Maple,src:fpe,height:20,style:{paddingRight:"12px"}})," ",B.t("tree.Maple",i)]},yr.Maple),h.jsxs(ty,{value:yr.Oak,children:[h.jsx("img",{alt:yr.Oak,src:hpe,height:20,style:{paddingRight:"17px"}}),B.t("tree.Oak",i)]},yr.Oak),h.jsxs(ty,{value:yr.Pine,children:[h.jsx("img",{alt:yr.Pine,src:Ant,height:20,style:{paddingRight:"18px"}})," ",B.t("tree.Pine",i)]},yr.Pine),h.jsxs(ty,{value:yr.Spruce,children:[h.jsx("img",{alt:yr.Spruce,src:wnt,height:20,style:{paddingRight:"20px"}})," ",B.t("tree.Spruce",i)]},yr.Spruce)]})}),X8o=t=>{const e=[];if(t.type!==z.Tree)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"tree-copy",label:h.jsx(ad,{})}),o&&e.push({key:"tree-cut",label:h.jsx(ld,{})}),e.push({key:"tree-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"tree-show-model",label:h.jsx(J4o,{tree:n})},{key:"tree-flip",label:h.jsx(D4e,{billboardModel:n})}),e.push({key:"tree-change-type",label:h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"100px"},children:[B.t("treeMenu.Type",r),": "]}),h.jsx(G8o,{tree:n})]})},{key:"tree-spread",label:h.jsx(K4o,{tree:n})},{key:"tree-height",label:h.jsx($4o,{tree:n})},{key:"tree-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)})),{items:e}},J8o=({wall:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=H.getState().removeAllChildElementsByType,a=()=>{const s=H.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Wall`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{H.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};H.getState().addUndoable(u)},l=()=>{const s=o??a;li.confirm({title:n,icon:h.jsx(_y,{}),onOk:s})};return h.jsx(ln,{update:!0,noPadding:!0,onClick:l,children:r})},MEe=({wall:t,objectType:e,lock:n,children:o})=>{const r=H.getState().updateElementLockById,i=H.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of H.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Wall`:`Unlock All Locked ${l} on Wall`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};H.getState().addUndoable(u)};return h.jsx(ln,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},K8o=({wall:t})=>{const e=Kt(),n=H.getState().set,o=(i,a)=>{n(l=>{const s=l.elements.find(c=>c.id===i&&c.type===z.Wall);s&&(s.parapet.display=a)})},r=i=>{const a=i.target.checked,l={name:"Parapet",timestamp:Date.now(),checked:a,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{o(t.id,!l.checked)},redo:()=>{o(t.id,l.checked)}};H.getState().addUndoable(l),o(t.id,a),n(s=>{s.actionState.wallParapet.display=a})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.parapet.display,onChange:r,children:B.t("wallMenu.Parapet",e)})})},$8o=({wall:t})=>{const e=Kt(),n=(i,a)=>{H.getState().set(l=>{for(const s of l.elements)if(s.id===i&&s.type===z.Wall){const c=s;c.wallStructure=a,(a===Tc.Stud||a===Tc.Pillar)&&(c.opacity=0);break}})},o=i=>{const a={name:"Select Wall Structure",timestamp:Date.now(),oldValue:t.wallStructure,newValue:i.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(a.changedElementId,a.oldValue)},redo:()=>{n(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),n(t.id,i.target.value),H.getState().set(l=>{l.actionState.wallStructure=i.target.value,(l.actionState.wallStructure===Tc.Stud||l.actionState.wallStructure===Tc.Pillar)&&(l.actionState.wallOpacity=0)})},r=t.wallStructure??Tc.Default;return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:r,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Tc.Default,children:B.t("wallMenu.DefaultStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Tc.Stud,children:B.t("wallMenu.StudStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Tc.Pillar,children:B.t("wallMenu.PillarStructure",e)})]})})})},q8o=({wall:t})=>{const e=H.getState().set,n=Kt(),o=(i,a,l)=>{const{cx:s,cy:c,cz:u}=a,d=l?l.rotation[2]+a.relativeAngle:a.relativeAngle;if(l&&d!==void 0){const f=ye.wallAbsolutePosition(new ue(s,c,u),l).setZ(a.lz/2+l.lz);return new ue().subVectors(i,f).applyEuler(new cn(0,0,-d))}return new ue},r=()=>{const i=H.getState().getFoundation(t);if(!i)return;const a=o(H.getState().pastePoint,t,i),l=Qa.makePolygon(t,-a.x/t.lx,0,-a.z/t.lz,new ue(0,0,1),[0,0,0],z.Wall);e(c=>{c.elements.push(l),c.objectTypeToAdd=z.None});const s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{H.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{e(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};H.getState().addUndoable(s)};return h.jsx(ln,{onClick:r,children:B.t("foundationMenu.AddPolygon",n)})},Q8o=({wall:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.fill=i;break}})},o=r=>{const i={name:"Select Wall Fill",timestamp:Date.now(),oldValue:t.fill,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.value)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t.fill,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Ul.Full,children:B.t("wallMenu.Full",e)}),h.jsx(We,{style:{width:"100%"},value:Ul.Partial,children:B.t("wallMenu.Partial",e)}),h.jsx(We,{style:{width:"100%"},value:Ul.Empty,children:B.t("wallMenu.Empty",e)})]})})})},Z8o=({wall:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.openToOutside=i;break}})},o=r=>{const i={name:"Set Open to Outside",timestamp:Date.now(),oldValue:!!t.openToOutside,newValue:r.target.checked,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.openToOutside,onChange:o,children:B.t("wallMenu.OpenToOutside",e)})})},Wce=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"doorCount",lockedKey:"lockedDoorCount",objectType:z.Door},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"polygonCount",lockedKey:"lockedPolygonCount",objectType:z.Polygon},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],e7o=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${B.t("wallMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisWall",n)} (${e} ${B.t("wallMenu.SolarPanels",n)})`;break}case z.Window:{o=`${B.t("wallMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllWindowsOnThisWall",n)} (${e} ${B.t("wallMenu.Windows",n)})`;break}case z.Door:{o=`${B.t("wallMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllDoorsOnThisWall",n)} (${e} ${B.t("wallMenu.Doors",n)})`;break}case z.Sensor:{o=`${B.t("wallMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllSensorsOnThisWall",n)} (${e} ${B.t("wallMenu.Sensors",n)})`;break}case z.Light:{o=`${B.t("wallMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllLightsOnThisWall",n)} (${e} ${B.t("wallMenu.Lights",n)})`;break}case z.Polygon:{o=`${B.t("wallMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllPolygonsOnThisWall",n)} (${e} ${B.t("wallMenu.Polygons",n)})`;break}}return{itemLabel:o,modalTitle:r}},Nce=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],t7o=(t,e,n)=>{const o=[],r={lng:H.getState().language};return Wce.forEach(({key:i,objectType:a})=>{const l=Nce(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=e7o(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-wall`,label:h.jsx(J8o,{wall:t,objectType:a,modalTitle:c,children:s})})}}),Wce.forEach(({key:i,objectType:a})=>{const l=Nce(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-wall`,label:h.jsxs(MEe,{wall:t,objectType:a,lock:!0,children:[B.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),Wce.forEach(({lockedKey:i,objectType:a})=>{const l=Nce(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(MEe,{wall:t,objectType:a,lock:!1,children:[B.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!0,children:[B.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!1,children:[B.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},n7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),c=Kt(),[u,d]=vne((s==null?void 0:s.parapet.color)??"#ffffff"),f=(S,v)=>{e(b=>{for(const T of b.elements)if(T.id===S&&T.type===z.Wall&&!T.locked){T.parapet.color=v;break}})},p=S=>{if(!s)return;const v=ye.getAllConnectedWalls(s);v.length!==0&&e(b=>{for(const T of v)if(!T.locked)for(const R of b.elements)R.id===T.id&&R.type===z.Wall&&(R.parapet.color=S)})},m=(S,v)=>{e(b=>{for(const T of b.elements)T.parentId===S&&T.type===z.Wall&&!T.locked&&(T.parapet.color=v)})},y=S=>{e(v=>{for(const b of v.elements)b.type===z.Wall&&!b.locked&&(b.parapet.color=S)})},w=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&S.has(T.id)&&(T.parapet.color=v)})},x=S=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.parapet.color&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.parapet.color&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of n)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.parapet.color&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.parapet.color&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.parapet.color))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(r){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.parapet.color??"#ffffff");const b={name:"Set Parapet Color for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{w(b.oldValues,b.newValue)}};o(b),w(v,S),a(i+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&v.set(T.id,T.parapet.color??"#ffffff");const b={name:"Set Parapet Color for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{y(b.newValue)}};o(b),y(S),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const T of n)T.type===z.Wall&&T.foundationId===s.foundationId&&v.set(T.id,T.parapet.color??"#ffffff");const b={name:"Set Parapet Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{b.groupId&&m(b.groupId,b.newValue)}};o(b),m(s.foundationId,S),a(i+1)}break;case ie.AllConnectedObjects:if(s){const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)b.set(R.id,R.color??"#ffffff");const T={name:"Set Parapet Color for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};o(T),p(S),a(i+1)}break;default:if(s){const v=l(s.id),b=(v==null?void 0:v.parapet.color)??s.parapet.color??"#ffffff",T={name:"Set Parapet Color of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(T.changedElementId,T.oldValue)},redo:()=>{f(T.changedElementId,T.newValue)}};o(T),f(s.id,S),a(i+1)}}e(v=>{v.actionState.wallParapet.color=S})}},P=()=>{C(u)},A=()=>{t(!1)};return h.jsx(ro,{width:640,title:B.t("wallMenu.ParapetColor",c),onApply:P,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u,onChangeComplete:d})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",c)})]})})})]})})},Vut="/aladdin/assets/wall_01_menu-BlJdKfby.png",Gut="/aladdin/assets/wall_02_menu-DfsmvvWJ.png",Xut="/aladdin/assets/wall_03_menu-B95_FEuA.png",Jut="/aladdin/assets/wall_04_menu-D-Kn25E7.png",Kut="/aladdin/assets/wall_05_menu-DGgjaMY9.png",$ut="/aladdin/assets/wall_06_menu-EOIch2eu.png",qut="/aladdin/assets/wall_07_menu-DvXS_qn2.png",Qut="/aladdin/assets/wall_08_menu-CfftE2pF.png",Zut="/aladdin/assets/wall_09_menu-_O8A0WOE.png",e0t="/aladdin/assets/wall_10_menu-B5QfhD3g.png",o7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),[c,u]=g.useState((s==null?void 0:s.parapet.textureType)??Jo.Default),d=Kt(),{Option:f}=Ko,p=(v,b)=>{e(T=>{for(const R of T.elements)if(R.type===z.Wall&&R.id===v&&!R.locked){R.parapet.textureType=b;break}})},m=v=>{if(!s)return;const b=ye.getAllConnectedWalls(s);b.length!==0&&e(T=>{for(const R of b)if(!R.locked)for(const M of T.elements)M.id===R.id&&M.type===z.Wall&&(M.parapet.textureType=v)})},y=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&R.foundationId===v&&!R.locked&&(R.parapet.textureType=b)})},w=v=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&(T.parapet.textureType=v)})},x=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&!R.locked&&v.has(R.id)&&(R.parapet.textureType=b)})},C=v=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.parapet.textureType&&!b.locked&&H.getState().selectedElementIdSet.has(b.id))return!0;break}case ie.AllObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.parapet.textureType&&!b.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.Wall&&b.foundationId===s.foundationId&&v!==b.parapet.textureType&&!b.locked)return!0;break}case ie.AllConnectedObjects:{const b=ye.getAllConnectedWalls(s);for(const T of b)if(v!==T.parapet.textureType&&!T.locked)return!0;break}default:{if(v!==(s==null?void 0:s.parapet.textureType))return!0;break}}return!1}},P=v=>{if(s&&C(v)){switch(r){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.parapet.textureType??Jo.Default);const T={name:"Set Parapet Texture for Selected Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{x(T.oldValues,T.newValue)}};o(T),x(b,v),a(i+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&b.set(R.id,R.parapet.textureType??Jo.Default);const T={name:"Set Parapet Texture for All Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{w(T.newValue)}};o(T),w(v),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const b=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===s.foundationId&&!R.locked&&b.set(R.id,R.parapet.textureType);const T={name:"Set Parapet Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:s.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{T.groupId&&y(T.groupId,T.newValue)}};o(T),y(s.foundationId,v),a(i+1)}break;case ie.AllConnectedObjects:if(s){const b=ye.getAllConnectedWalls(s),T=new Map;for(const M of b)T.set(M.id,M.parapet.textureType);const R={name:"Set Parapet Texture for All Connected Walls",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{m(R.newValue)}};o(R),m(v),a(i+1)}break;default:if(s){const b=l(s.id),T=(b==null?void 0:b.parapet.textureType)??s.parapet.textureType,R={name:"Set Parapet Texture of Selected Wall",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(s.id,v),a(i+1)}}e(b=>{b.actionState.wallParapet.textureType=v})}},A=()=>{t(!1)},S=()=>{P(c)};return h.jsx(ro,{width:550,title:B.t("word.Texture",d),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:c,onChange:u,children:[h.jsxs(f,{value:Jo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",d)]},Jo.NoTexture),h.jsxs(f,{value:Jo.Default,children:[h.jsx("img",{alt:Jo.Default,src:k3e,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.TextureDefault",d)]},Jo.Default),h.jsxs(f,{value:Jo.Texture01,children:[h.jsx("img",{alt:Jo.Texture01,src:Vut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture01",d)]},Jo.Texture01),h.jsxs(f,{value:Jo.Texture02,children:[h.jsx("img",{alt:Jo.Texture02,src:Gut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture02",d)]},Jo.Texture02),h.jsxs(f,{value:Jo.Texture03,children:[h.jsx("img",{alt:Jo.Texture03,src:Xut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture03",d)]},Jo.Texture03),h.jsxs(f,{value:Jo.Texture04,children:[h.jsx("img",{alt:Jo.Texture04,src:Jut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture04",d)]},Jo.Texture04),h.jsxs(f,{value:Jo.Texture05,children:[h.jsx("img",{alt:Jo.Texture05,src:Kut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture05",d)]},Jo.Texture05),h.jsxs(f,{value:Jo.Texture06,children:[h.jsx("img",{alt:Jo.Texture06,src:$ut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture06",d)]},Jo.Texture06),h.jsxs(f,{value:Jo.Texture07,children:[h.jsx("img",{alt:Jo.Texture07,src:qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture07",d)]},Jo.Texture07),h.jsxs(f,{value:Jo.Texture08,children:[h.jsx("img",{alt:Jo.Texture08,src:Qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture08",d)]},Jo.Texture08),h.jsxs(f,{value:Jo.Texture09,children:[h.jsx("img",{alt:Jo.Texture09,src:Zut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture09",d)]},Jo.Texture09),h.jsxs(f,{value:Jo.Texture10,children:[h.jsx("img",{alt:Jo.Texture10,src:e0t,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture10",d)]},Jo.Texture10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:v=>H.getState().setWallActionScope(v.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",d)})]})})})]})})},Uce=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=H(Qn),s=H(Fn),c=H(o6),u=H(no),d=H(qn),f=H(pn),p=g.useRef(t.parapet[n]),m=Kt(),y=R=>{f(M=>{switch(n){case"copingsHeight":M.actionState.wallParapet.copingsHeight=R;break;case"copingsWidth":M.actionState.wallParapet.copingsWidth=R;break;case"parapetHeight":M.actionState.wallParapet.parapetHeight=R;break}})},w=(R,M)=>{f(D=>{for(const k of D.elements)if(k.id===R&&k.type===z.Wall&&!k.locked){k.parapet[n]=M;break}}),y(M)},x=R=>{const M=ye.getAllConnectedWalls(t);M.length!==0&&(f(D=>{for(const k of M)if(!k.locked)for(const N of D.elements)N.id===k.id&&N.type===z.Wall&&(N.parapet[n]=R)}),y(R))},C=(R,M)=>{f(D=>{for(const k of D.elements)k.parentId===R&&k.type===z.Wall&&!k.locked&&(k.parapet[n]=M)}),y(M)},P=R=>{f(M=>{for(const D of M.elements)D.type===z.Wall&&!D.locked&&(D.parapet[n]=R)}),y(R)},A=(R,M)=>{f(D=>{for(const k of D.elements)k.type===z.Wall&&!k.locked&&R.has(k.id)&&(k.parapet[n]=M)}),y(M)},S=R=>{switch(c){case ie.AllSelectedObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M.parapet[n]&&!M.locked&&H.getState().selectedElementIdSet.has(M.id))return!0;break}case ie.AllObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M.parapet[n]&&!M.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const M of l)if(M.type===z.Wall&&M.foundationId===t.foundationId&&R!==M.parapet[n]&&!M.locked)return!0;break}case ie.AllConnectedObjects:{const M=ye.getAllConnectedWalls(t);for(const D of M)if(R!==D.parapet[n]&&!D.locked)return!0;break}default:{if(R!==t.parapet[n])return!0;break}}return!1},v=R=>{if(t&&S(R))switch(c){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.parapet[n]);const D={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{A(D.oldValues,D.newValue)}};s(D),A(M,R),d(u+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&M.set(k.id,k.parapet[n]);const D={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.newValue)}};s(D),P(R),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const M=new Map;for(const k of l)k.type===z.Wall&&k.foundationId===t.foundationId&&M.set(k.id,k.parapet[n]);const D={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&C(D.groupId,D.newValue)}};s(D),C(t.foundationId,R),d(u+1)}break;case ie.AllConnectedObjects:if(t){const M=ye.getAllConnectedWalls(t),D=new Map;for(const N of M)D.set(N.id,N.parapet[n]);const k={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:D,newValue:R,undo:()=>{for(const[N,U]of k.oldValues.entries())w(N,U)},redo:()=>{x(k.newValue)}};s(k),x(R),d(u+1)}break;default:if(t){const M=t.parapet[n],D={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{w(D.changedElementId,D.oldValue)},redo:()=>{w(D.changedElementId,D.newValue)}};s(D),w(t.id,R),d(u+1)}}},b=()=>{a(!1)},T=()=>{v(p.current)};return h.jsx(ro,{width:550,title:B.t(`wallMenu.${e}`,m),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t.parapet[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",m),": [",o.toString(),"] ",i]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:R=>H.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",m)})]})})})]})})};var NG=(t=>(t.ParapetHeight="ParapetHeight",t.CopingsHeight="CopingsHeight",t.CopingsWidth="CopingsWidth",t))(NG||{});const r7o={ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},jce=({Dialog:t,wall:e,dataType:n,children:o})=>{const r=Kt(),[i,a]=g.useState(!1),l=()=>{H.getState().setApplyCount(0),a(!0)},s=r7o[n];return h.jsxs(h.Fragment,{children:[h.jsx(ln,{noPadding:!0,onClick:l,children:o}),i&&h.jsx(t,{wall:e,dataType:n,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?B.t(s.unit,r):void 0,setDialogVisible:a})]})},i7o=t=>{const e={lng:H.getState().language},n=[];return n.push({key:"parapet-checkbox",label:h.jsx(K8o,{wall:t})}),t.parapet.display&&n.push({type:"divider"},{key:"parapet-color",label:h.jsxs(Zn,{noPadding:!0,Dialog:n7o,children:[B.t("wallMenu.ParapetColor",e)," ..."]})},{key:"parapet-texture",label:h.jsxs(Zn,{noPadding:!0,Dialog:o7o,children:[B.t("wallMenu.ParapetTexture",e)," ..."]})},{key:"parapet-height",label:h.jsxs(jce,{wall:t,dataType:NG.ParapetHeight,Dialog:Uce,children:[B.t("wallMenu.ParapetHeight",e)," ..."]})},{key:"copings-height",label:h.jsxs(jce,{wall:t,dataType:NG.CopingsHeight,Dialog:Uce,children:[B.t("wallMenu.CopingsHeight",e)," ..."]})},{key:"copings-width",label:h.jsxs(jce,{wall:t,dataType:NG.CopingsWidth,Dialog:Uce,children:[B.t("wallMenu.CopingsWidth",e)," ..."]})}),n},hR=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=H(Qn),s=H(Fn),c=H(o6),u=H(no),d=H(qn),f=H(pn),p=g.useRef(t[n]),m=Kt(),y=R=>{f(M=>{switch(n){case"ly":M.actionState.wallThickness=R;break;case"lz":M.actionState.wallHeight=R;break;case"opacity":M.actionState.wallOpacity=R;break;case"structureSpacing":M.actionState.wallStructureSpacing=R;break;case"structureWidth":M.actionState.wallStructureWidth=R;break;case"eavesLength":M.actionState.wallEavesLength=R;break}})},w=(R,M)=>{f(D=>{for(const k of D.elements)if(k.id===R&&k.type===z.Wall&&!k.locked){k[n]=M;break}}),y(M)},x=R=>{const M=ye.getAllConnectedWalls(t);M.length!==0&&(f(D=>{for(const k of M)if(!k.locked)for(const N of D.elements)N.id===k.id&&N.type===z.Wall&&(N[n]=R)}),y(R))},C=(R,M)=>{f(D=>{for(const k of D.elements)k.parentId===R&&k.type===z.Wall&&!k.locked&&(k[n]=M)}),y(M)},P=R=>{f(M=>{for(const D of M.elements)D.type===z.Wall&&!D.locked&&(D[n]=R)}),y(R)},A=(R,M)=>{f(D=>{for(const k of D.elements)k.type===z.Wall&&!k.locked&&R.has(k.id)&&(k[n]=M)}),y(M)},S=R=>{switch(c){case ie.AllSelectedObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M[n]&&!M.locked&&H.getState().selectedElementIdSet.has(M.id))return!0;break}case ie.AllObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M[n]&&!M.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const M of l)if(M.type===z.Wall&&M.foundationId===t.foundationId&&R!==M[n]&&!M.locked)return!0;break}case ie.AllConnectedObjects:{const M=ye.getAllConnectedWalls(t);for(const D of M)if(R!==D[n]&&!D.locked)return!0;break}default:{if(R!==t[n])return!0;break}}return!1},v=R=>{if(t&&S(R))switch(c){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k[n]);const D={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{A(D.oldValues,D.newValue)}};s(D),A(M,R),d(u+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.newValue)}};s(D),P(R),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const M=new Map;for(const k of l)k.type===z.Wall&&k.foundationId===t.foundationId&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&C(D.groupId,D.newValue)}};s(D),C(t.foundationId,R),d(u+1)}break;case ie.AllConnectedObjects:if(t){const M=ye.getAllConnectedWalls(t),D=new Map;for(const N of M)D.set(N.id,N[n]);const k={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:D,newValue:R,undo:()=>{for(const[N,U]of k.oldValues.entries())w(N,U)},redo:()=>{x(k.newValue)}};s(k),x(R),d(u+1)}break;default:if(t){const M=t[n],D={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{w(D.changedElementId,D.oldValue)},redo:()=>{w(D.changedElementId,D.newValue)}};s(D),w(t.id,R),d(u+1)}}},b=()=>{p.current=t[n],a(!1)},T=()=>{v(p.current)};return h.jsx(ro,{width:550,title:B.t(`wallMenu.${e}`,m),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",m),": [",o.toString(),"] ",i]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:R=>H.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",m)})]})})})]})})},pR=({Dialog:t,noPadding:e,dataType:n,children:o})=>{const r=Kt(),[i,a]=g.useState(!1),l=ao(z.Wall),s=()=>{H.getState().setApplyCount(0),a(!0)},c=h7o[n];return h.jsxs(h.Fragment,{children:[h.jsx(ln,{noPadding:e,onClick:s,children:o}),i&&l&&h.jsx(t,{wall:l,dataType:n,attributeKey:c.attributeKey,range:c.range,step:c.step,unit:c.unit?B.t(c.unit,r):void 0,setDialogVisible:a})]})},a7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),[c,u]=vne((s==null?void 0:s.structureColor)??"#ffffff"),d=Kt(),f=(S,v)=>{e(b=>{for(const T of b.elements)if(T.id===S&&T.type===z.Wall&&!T.locked){T.structureColor=v;break}})},p=S=>{if(!s)return;const v=ye.getAllConnectedWalls(s);v.length!==0&&e(b=>{for(const T of v)if(!T.locked)for(const R of b.elements)R.id===T.id&&R.type===z.Wall&&(R.structureColor=S)})},m=(S,v)=>{e(b=>{for(const T of b.elements)T.parentId===S&&T.type===z.Wall&&!T.locked&&(T.structureColor=v)})},y=S=>{e(v=>{for(const b of v.elements)b.type===z.Wall&&!b.locked&&(b.structureColor=S)})},w=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&S.has(T.id)&&(T.color=v)})},x=S=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.structureColor&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.structureColor&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of n)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.structureColor&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.structureColor&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.structureColor))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(r){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.structureColor??"#ffffff");const b={name:"Set Structure Color for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{w(b.oldValues,b.newValue)}};o(b),w(v,S),a(i+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&v.set(T.id,T.structureColor??"#ffffff");const b={name:"Set Structure Color for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{y(b.newValue)}};o(b),y(S),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const T of n)T.type===z.Wall&&T.foundationId===s.foundationId&&v.set(T.id,T.structureColor??"#ffffff");const b={name:"Set Structure Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{b.groupId&&m(b.groupId,b.newValue)}};o(b),m(s.foundationId,S),a(i+1)}break;case ie.AllConnectedObjects:if(s){const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)b.set(R.id,R.color??"#ffffff");const T={name:"Set Structure Color for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};o(T),p(S),a(i+1)}break;default:if(s){const v=l(s.id),b=(v==null?void 0:v.structureColor)??s.structureColor??"#ffffff",T={name:"Set Structure Color of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(T.changedElementId,T.oldValue)},redo:()=>{f(T.changedElementId,T.newValue)}};o(T),f(s.id,S),a(i+1)}}e(v=>{v.actionState.wallStructureColor=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:640,title:B.t("wallMenu.StructureColor",d),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:u})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",d)})]})})})]})})};var Og=(t=>(t.Height="Height",t.Opacity="Opacity",t.StructureSpacing="StructureSpacing",t.StructureWidth="StructureWidth",t.Thickness="Thickness",t.EavesLength="EavesLength",t))(Og||{});const l7o=t=>{const e=[],n={lng:H.getState().language};return e.push({key:"wall-structure-submenu-radio-group",label:h.jsx($8o,{wall:t}),style:{backgroundColor:"white"}}),t.wallStructure!==Tc.Default&&e.push({type:"divider"},{key:"wall-structure-spacing",label:h.jsxs(pR,{noPadding:!0,dataType:Og.StructureSpacing,Dialog:hR,children:[B.t(`wallMenu.${Og.StructureSpacing}`,n)," ..."]})},{key:"wall-structure-width",label:h.jsxs(pR,{noPadding:!0,dataType:Og.StructureWidth,Dialog:hR,children:[B.t(`wallMenu.${Og.StructureWidth}`,n)," ..."]})},{key:"wall-structure-color",label:h.jsxs(Zn,{noPadding:!0,Dialog:a7o,children:[B.t("wallMenu.StructureColor",n)," ..."]})}),e},s7o=t=>{const e=[];return e.push({key:"wall-fill-radio-group",label:h.jsx(Q8o,{wall:t}),style:{backgroundColor:"white"}}),t.fill!==Ul.Full&&e.push({type:"divider"},{key:"wall-open-to-outside-checkbox",label:h.jsx(Z8o,{wall:t})}),e},c7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(o6),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Wall),[c,u]=g.useState((s==null?void 0:s.rValue)??U9),[d,f]=g.useState(ye.toRValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.rValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:{for(const v of e)if(v.type===z.Wall&&S!==v.rValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of e)if(v.type===z.Wall&&S!==v.rValue&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of e)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.rValue&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.rValue&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.rValue))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Wall&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;v.set(T.id,R.rValue??U9),m(R.id,S)}const b={name:"Set R-Value for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Wall&&!T.locked){const R=T;v.set(T.id,R.rValue??U9),m(R.id,S)}const b={name:"Set R-Value for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s!=null&&s.foundationId){const v=new Map;for(const T of e)if(T.type===z.Wall&&T.foundationId===s.foundationId&&!T.locked){const R=T;v.set(T.id,R.rValue??U9),m(R.id,S)}const b={name:"Set R-Value for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;case ie.AllConnectedObjects:if(s){const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)if(!R.locked){const M=R;b.set(R.id,M.rValue??U9),m(M.id,S)}const T={name:"Set R-Value for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{y(T.oldValues)},redo:()=>{w(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const b=a(s.id).rValue??s.rValue??U9,T={name:"Set Wall R-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}}l(v=>{v.actionState.wallRValue=S})}},P=()=>{u((s==null?void 0:s.rValue)??U9),t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("word.RValue",p)+" "}(${B.t("word.ThermalResistance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toRValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toRValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",p)})]})})})]})})},u7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(o6),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Wall),[c,u]=g.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.volumetricHeatCapacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Wall&&P!==S.volumetricHeatCapacity&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Wall&&P!==S.volumetricHeatCapacity&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Wall&&S.foundationId===s.foundationId&&P!==S.volumetricHeatCapacity&&!S.locked)return!0;break;case ie.AllConnectedObjects:const A=ye.getAllConnectedWalls(s);for(const S of A)if(P!==S.volumetricHeatCapacity&&!S.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Wall&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)){const b=v;A.set(v.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const S={name:"Set Volumetric Heat Capacity for Selected Walls",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Wall&&!v.locked){const b=v;A.set(v.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const S={name:"Set Volumetric Heat Capacity for All Walls",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(s!=null&&s.foundationId){const A=new Map;for(const v of e)if(v.type===z.Wall&&v.foundationId===s.foundationId&&!v.locked){const b=v;A.set(v.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const S={name:"Set Volumetric Heat Capacity for All Walls Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break}case ie.AllConnectedObjects:{if(s){const A=ye.getAllConnectedWalls(s),S=new Map;for(const b of A)if(!b.locked){const T=b;S.set(b.id,T.volumetricHeatCapacity??.5),f(T.id,P)}const v={name:"Set Volumetric Heat Capacity for All Connected Walls",timestamp:Date.now(),oldValues:S,newValue:P,undo:()=>{p(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),i(r+1)}break}default:{if(s){const S=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,v={name:"Set Volumetric Heat Capacity of Wall",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}break}}l(A=>{A.actionState.wallVolumetricHeatCapacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setWallActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",d)})]})})})]})})},d7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=Kt(),c=ao(z.Wall),[u,d]=g.useState((c==null?void 0:c.textureType)??Jo.Default),{Option:f}=Ko,p=(v,b)=>{e(T=>{for(const R of T.elements)if(R.type===z.Wall&&R.id===v&&!R.locked){R.textureType=b;break}})},m=v=>{if(!c)return;const b=ye.getAllConnectedWalls(c);b.length!==0&&e(T=>{for(const R of b)if(!R.locked)for(const M of T.elements)M.id===R.id&&M.type===z.Wall&&(M.textureType=v)})},y=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&R.foundationId===v&&!R.locked&&(R.textureType=b)})},w=v=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&(T.textureType=v)})},x=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&!R.locked&&v.has(R.id)&&(R.textureType=b)})},C=v=>{if(c){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.textureType&&!b.locked&&H.getState().selectedElementIdSet.has(b.id))return!0;break}case ie.AllObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.textureType&&!b.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.Wall&&b.foundationId===c.foundationId&&v!==b.textureType&&!b.locked)return!0;break}case ie.AllConnectedObjects:{const b=ye.getAllConnectedWalls(c);for(const T of b)if(v!==T.textureType&&!T.locked)return!0;break}default:{if(v!==(c==null?void 0:c.textureType))return!0;break}}return!1}},P=v=>{if(c&&C(v)){switch(r){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.textureType??Jo.Default);const T={name:"Set Texture for Selected Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{x(T.oldValues,T.newValue)}};o(T),x(b,v),a(i+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&b.set(R.id,R.textureType??Jo.Default);const T={name:"Set Texture for All Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{w(T.newValue)}};o(T),w(v),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const b=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===c.foundationId&&!R.locked&&b.set(R.id,R.textureType);const T={name:"Set Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:c.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{T.groupId&&y(T.groupId,T.newValue)}};o(T),y(c.foundationId,v),a(i+1)}break;case ie.AllConnectedObjects:if(c){const b=ye.getAllConnectedWalls(c),T=new Map;for(const M of b)T.set(M.id,M.textureType);const R={name:"Set Texture for All Connected Walls",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{m(R.newValue)}};o(R),m(v),a(i+1)}break;default:if(c){const b=l(c.id),T=(b==null?void 0:b.textureType)??c.textureType,R={name:"Set Texture of Selected Wall",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(c.id,v),a(i+1)}}e(b=>{b.actionState.wallTexture=v})}},A=()=>{t(!1)},S=()=>{P(u)};return h.jsx(ro,{width:550,title:B.t("word.Texture",s),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(f,{value:Jo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",s)]},Jo.NoTexture),h.jsxs(f,{value:Jo.Default,children:[h.jsx("img",{alt:Jo.Default,src:k3e,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.TextureDefault",s)]},Jo.Default),h.jsxs(f,{value:Jo.Texture01,children:[h.jsx("img",{alt:Jo.Texture01,src:Vut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture01",s)]},Jo.Texture01),h.jsxs(f,{value:Jo.Texture02,children:[h.jsx("img",{alt:Jo.Texture02,src:Gut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture02",s)]},Jo.Texture02),h.jsxs(f,{value:Jo.Texture03,children:[h.jsx("img",{alt:Jo.Texture03,src:Xut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture03",s)]},Jo.Texture03),h.jsxs(f,{value:Jo.Texture04,children:[h.jsx("img",{alt:Jo.Texture04,src:Jut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture04",s)]},Jo.Texture04),h.jsxs(f,{value:Jo.Texture05,children:[h.jsx("img",{alt:Jo.Texture05,src:Kut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture05",s)]},Jo.Texture05),h.jsxs(f,{value:Jo.Texture06,children:[h.jsx("img",{alt:Jo.Texture06,src:$ut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture06",s)]},Jo.Texture06),h.jsxs(f,{value:Jo.Texture07,children:[h.jsx("img",{alt:Jo.Texture07,src:qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture07",s)]},Jo.Texture07),h.jsxs(f,{value:Jo.Texture08,children:[h.jsx("img",{alt:Jo.Texture08,src:Qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture08",s)]},Jo.Texture08),h.jsxs(f,{value:Jo.Texture09,children:[h.jsx("img",{alt:Jo.Texture09,src:Zut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture09",s)]},Jo.Texture09),h.jsxs(f,{value:Jo.Texture10,children:[h.jsx("img",{alt:Jo.Texture10,src:e0t,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture10",s)]},Jo.Texture10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:v=>H.getState().setWallActionScope(v.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",s)})]})})})]})})},f7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),c=Kt(),[u,d]=vne((s==null?void 0:s.color)??"#ffffff"),f=(S,v)=>{e(b=>{for(const T of b.elements)if(T.type===z.Wall&&T.id===S&&!T.locked){T.color=v;break}})},p=S=>{if(!s)return;const v=ye.getAllConnectedWalls(s);v.length!==0&&e(b=>{for(const T of v)if(!T.locked)for(const R of b.elements)R.id===T.id&&R.type===z.Wall&&(R.color=S)})},m=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&T.foundationId===S&&!T.locked&&(T.color=v)})},y=S=>{e(v=>{for(const b of v.elements)b.type===z.Wall&&!b.locked&&(b.color=S)})},w=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&S.has(T.id)&&(T.color=v)})},x=S=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.color&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.color&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of n)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.color&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.color&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.color))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(r){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.color??"#ffffff");const b={name:"Set Color for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{w(b.oldValues,b.newValue)}};o(b),w(v,S),a(i+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&v.set(T.id,T.color??"#ffffff");const b={name:"Set Color for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{y(b.newValue)}};o(b),y(S),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const v=new Map;for(const T of n)T.type===z.Wall&&T.foundationId===s.foundationId&&v.set(T.id,T.color??"#ffffff");const b={name:"Set Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{b.groupId&&m(b.groupId,b.newValue)}};o(b),m(s.foundationId,S),a(i+1)}break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)b.set(R.id,R.color??"#ffffff");const T={name:"Set Color for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};o(T),p(S),a(i+1);break}default:{if(s){const v=l(s.id),b=(v==null?void 0:v.color)??s.color??"#ffffff",T={name:"Set Color of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(T.changedElementId,T.oldValue)},redo:()=>{f(T.changedElementId,T.newValue)}};o(T),f(s.id,S),a(i+1)}break}}e(v=>{v.actionState.wallColor=S})}},P=()=>{t(!1)},A=()=>{C(u)};return h.jsx(ro,{width:640,title:B.t("wallMenu.Color",c),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u,onChangeComplete:d})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",c)})]})})})]})})},h7o={Height:{attributeKey:"lz",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},Opacity:{attributeKey:"opacity",range:[0,1],step:.01},StructureSpacing:{attributeKey:"structureSpacing",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},StructureWidth:{attributeKey:"structureWidth",range:[.01,1],step:.1,unit:"word.MeterAbbreviation"},Thickness:{attributeKey:"ly",range:[.1,1],step:.01,unit:"word.MeterAbbreviation"},EavesLength:{attributeKey:"eavesLength",range:[-.1,5],step:.01,unit:"word.MeterAbbreviation"},ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},p7o=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(ye.isLegalOnWall(e.type))return!0}return!1},g7o=t=>{const e=[];if(t.type!==z.Wall)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=H.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1);return p7o()&&e.push({key:"wall-paste",label:h.jsx(yI,{})}),e.push({key:"wall-copy",label:h.jsx(ad,{})}),o&&e.push({key:"wall-cut",label:h.jsx(ld,{})}),e.push({key:"wall-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(a.gotSome()&&e.push({key:"lock-unlock-clear-on-wall",label:h.jsx(ln,{children:B.t("word.Elements",r)}),children:t7o(n,a,l)}),e.push({key:"wall-parapet",label:h.jsx(ln,{children:B.t("wallMenu.Parapet",r)}),children:i7o(n)}),e.push({key:"wall-structure",label:h.jsx(ln,{children:B.t("wallMenu.WallStructure",r)}),children:l7o(n)}),n.wallStructure!==Tc.Default&&e.push({key:"wall-opacity",label:h.jsxs(pR,{dataType:Og.Opacity,Dialog:hR,children:[B.t(`wallMenu.${Og.Opacity}`,r)," ..."]})}),e.push({key:"wall-fill",label:h.jsx(ln,{children:B.t("wallMenu.Fill",r)}),children:s7o(n)},{key:"add-polygon-on-wall",label:h.jsx(q8o,{wall:n})},{key:"wall-thickness",label:h.jsxs(pR,{dataType:Og.Thickness,Dialog:hR,children:[B.t(`wallMenu.${Og.Thickness}`,r)," ..."]})},{key:"wall-height",label:h.jsxs(pR,{dataType:Og.Height,Dialog:hR,children:[B.t(`wallMenu.${Og.Height}`,r)," ..."]})},{key:"wall-eaves-length",label:h.jsxs(pR,{dataType:Og.EavesLength,Dialog:hR,children:[B.t(`wallMenu.${Og.EavesLength}`,r)," ..."]})},{key:"wall-r-value",label:h.jsxs(Zn,{Dialog:c7o,children:[B.t("word.RValue",r)," ..."]})},{key:"wall-heat-capacity",label:h.jsxs(Zn,{Dialog:u7o,children:[B.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"wall-texture",label:h.jsxs(Zn,{Dialog:d7o,children:[B.t("wallMenu.Texture",r)," ..."]})},{key:"wall-color",label:h.jsxs(Zn,{Dialog:f7o,children:[B.t("wallMenu.Color",r)," ..."]})})),{items:e}},m7o=xe.memo(({door:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.filled=i;break}})},o=r=>{const i=r.target.checked,a={name:"Filled Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.doorFilled=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:B.t("doorMenu.Filled",e)})})}),y7o=xe.memo(({door:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.doorInterior=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.interior,onChange:o,children:B.t("doorMenu.Interior",e)})})}),A7o=xe.memo(({door:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.doorType=i;break}})},o=r=>{const i={name:"Select Door Type",timestamp:Date.now(),oldValue:t.doorType,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.value),H.getState().set(a=>{a.actionState.doorType=r.target.value})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t.doorType,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Wd.Default,children:B.t("doorMenu.Default",e)}),h.jsx(We,{style:{width:"100%"},value:Wd.Arched,children:B.t("doorMenu.Arched",e)})]})})})}),w7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=H($r),c=ao(z.Door),u=g.useMemo(()=>{const b=c?c.lx:1,T=c?s(c):null;return T?b*T.lx:b},[c==null?void 0:c.lx]),[d,f]=g.useState(u),p=Kt(),m=(b,T)=>{l(R=>{for(const M of R.elements)if(M.id===b&&M.type===z.Door){const D=M,k=s(D);D.lx=k?T/k.lx:T;break}})},y=b=>{for(const[T,R]of b.entries())m(T,R)},w=(b,T)=>{for(const R of b.keys())m(R,T)},x=b=>{if(c){switch(o){case ie.AllSelectedObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}case ie.AllObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of e)if(T.type===z.Door&&T.foundationId===c.foundationId&&!T.locked){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}case ie.OnlyThisSide:{for(const T of e)if(T.type===z.Door&&T.parentId===c.parentId&&!T.locked){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}default:{const T=s(c);if(T&&b!==c.lx*T.lx)return!0;break}}return!1}},C=b=>{if(c&&x(b))switch(o){case ie.AllSelectedObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for Selected Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for All Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.foundationId===c.foundationId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for All Doors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case ie.OnlyThisSide:if(c.parentId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.parentId===c.parentId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for All Doors On the Same Wall",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.parentId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const T=a(c.id),R=c?s(T):null,M=(T.lx??c.lx??.1)*(R?R.lx:1),D={name:"Set Door Width",timestamp:Date.now(),oldValue:M,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};n(D),m(c.id,b),i(r+1)}}},P=()=>{t(!1)},A=()=>{C(d)},S=c?s(c):null,v=S&&c?2*S.lx*Math.min(Math.abs(.5-c.cx),Math.abs(-.5-c.cx)):100;return h.jsx(ro,{width:550,title:B.t("word.Width",p),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:v,style:{width:120},step:.1,precision:2,value:d,formatter:b=>Number(b).toFixed(2),onChange:b=>f(b)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.1, ",v.toFixed(1),"]",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b=>H.getState().setDoorActionScope(b.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",p)})]})})})]})})},x7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=H($r),c=ao(z.Door),u=g.useMemo(()=>{const b=c?c.lz:1,T=c?s(c):null;return T?b*T.lz:b},[c==null?void 0:c.lz]),[d,f]=g.useState(u),p=Kt(),m=(b,T)=>{l(R=>{for(const M of R.elements)if(M.id===b&&M.type===z.Door){const D=M,k=s(D);D.lz=k?T/k.lz:T,k&&(D.cz=-(k.lz-T)/(2*k.lz));break}})},y=b=>{for(const[T,R]of b.entries())m(T,R)},w=(b,T)=>{for(const R of b.keys())m(R,T)},x=b=>{if(c){switch(o){case ie.AllSelectedObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}case ie.AllObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of e)if(T.type===z.Door&&T.foundationId===c.foundationId&&!T.locked){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}case ie.OnlyThisSide:{for(const T of e)if(T.type===z.Door&&T.parentId===c.parentId&&!T.locked){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}default:{const T=s(c);if(T&&b!==c.lz*T.lz)return!0;break}}return!1}},C=b=>{if(c&&x(b))switch(o){case ie.AllSelectedObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for Selected Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for All Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.foundationId===c.foundationId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for All Doors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case ie.OnlyThisSide:if(c.parentId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.parentId===c.parentId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for All Doors On the Same Wall",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.parentId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const T=a(c.id),R=c?s(T):null,M=(T.lz??c.lz??.2)*(R?R.lz:1),D={name:"Set Door Height",timestamp:Date.now(),oldValue:M,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};n(D),m(c.id,b),i(r+1)}}},P=()=>{f(u),t(!1)},A=()=>{C(d)},S=c?s(c):null,v=(S==null?void 0:S.lz)??20;return h.jsx(ro,{width:550,title:B.t("word.Height",p),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:v,style:{width:120},step:.1,precision:2,value:d,formatter:b=>Number(b).toFixed(2),onChange:b=>{b!==null&&f(b)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.1, ",v.toFixed(1),"]",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b=>H.getState().setDoorActionScope(b.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",p)})]})})})]})})},v7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.opacity)??1),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.opacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.opacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.opacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Door&&A.foundationId===s.foundationId&&P!==A.opacity&&!A.locked)return!0;break;case ie.OnlyThisSide:for(const A of e)if(A.type===z.Door&&A.parentId===s.parentId&&P!==A.opacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.foundationId===s.foundationId&&!b.locked){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.parentId===s.parentId&&!b.locked){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).opacity??s.opacity??1,v={name:"Set Opacity of Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.doorOpacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("wallMenu.Opacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},b7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.uValue)??fA),[d,f]=g.useState(ye.toUValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.uValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Door&&S!==v.uValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Door&&S!==v.uValue&&!v.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Door&&v.foundationId===s.foundationId&&S!==v.uValue&&!v.locked)return!0;break;case ie.OnlyThisSide:for(const v of e)if(v.type===z.Door&&v.parentId===s.parentId&&S!==v.uValue&&!v.locked)return!0;break;default:if(S!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for All Doors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&R.foundationId===s.foundationId&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&R.parentId===s.parentId&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.parentId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;default:if(s){const b=a(s.id).uValue??s.uValue??fA,T={name:"Set Door U-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}}l(v=>{v.actionState.doorUValue=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("word.UValue",p)+" "}(${B.t("word.ThermalTransmittance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toUValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toUValueInUS(.01),max:ye.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toUValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toUValueInUS(.01).toFixed(3),", ",ye.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setDoorActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",p)})]})})})]})})},S7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.volumetricHeatCapacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.volumetricHeatCapacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Door&&A.foundationId===(s==null?void 0:s.foundationId)&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;case ie.OnlyThisSide:for(const A of e)if(A.type===z.Door&&A.parentId===(s==null?void 0:s.parentId)&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.foundationId===s.foundationId&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.parentId===s.parentId&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,v={name:"Set Volumetric Heat Capacity of Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.doorVolumetricHeatCapacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},T7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(pn),l=H(Jn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.textureType)??dr.Default),d=Kt(),{Option:f}=Ko,p=(A,S)=>{a(v=>{for(const b of v.elements)if(b.id===A){b.locked||(b.textureType=S);break}})},m=(A,S)=>{for(const v of A.keys())p(v,S)},y=A=>{for(const[S,v]of A.entries())p(S,v)},w=A=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Door&&A!==S.textureType&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Door&&A!==S.textureType&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Door&&S.foundationId===s.foundationId&&A!==S.textureType&&!S.locked)return!0;break;case ie.OnlyThisSide:for(const S of e)if(S.type===z.Door&&S.parentId===s.parentId&&A!==S.textureType&&!S.locked)return!0;break;default:if(A!==(s==null?void 0:s.textureType))return!0;break}return!1}},x=A=>{if(s&&w(A)){switch(o){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&S.set(b.id,b.textureType??dr.Default);const v={name:"Set Texture for Selected Doors",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&!b.locked&&S.set(b.id,b.textureType??dr.Default);const v={name:"Set Texture for All Doors",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&b.foundationId===s.foundationId&&!b.locked&&S.set(b.id,b.textureType);const v={name:"Set Texture for All Doors Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:s.foundationId,undo:()=>{y(v.oldValues)},redo:()=>{v.groupId&&m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&b.parentId===s.parentId&&!b.locked&&S.set(b.id,b.textureType);const v={name:"Set Texture for All Doors On the Same Wall",timestamp:Date.now(),oldValues:S,newValue:A,groupId:s.parentId,undo:()=>{y(v.oldValues)},redo:()=>{v.groupId&&m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1)}break;default:if(s){const S=l(s.id),v=S?S.textureType:s.textureType,b={name:"Set Texture of Selected Door",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};n(b),p(s.id,A),i(r+1)}}a(S=>{S.actionState.doorTexture=A})}},C=()=>{t(!1)},P=()=>{x(c)};return h.jsx(ro,{width:550,title:B.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:c,onChange:A=>u(A),children:[h.jsxs(f,{value:dr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",d)]},dr.NoTexture),h.jsxs(f,{value:dr.Default,children:[h.jsx("img",{alt:dr.Default,src:ort,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.TextureDefault",d)]},dr.Default),h.jsxs(f,{value:dr.Texture01,children:[h.jsx("img",{alt:dr.Texture01,src:rrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture01",d)]},dr.Texture01),h.jsxs(f,{value:dr.Texture02,children:[h.jsx("img",{alt:dr.Texture02,src:jpe,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture02",d)]},dr.Texture02),h.jsxs(f,{value:dr.Texture03,children:[h.jsx("img",{alt:dr.Texture03,src:irt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture03",d)]},dr.Texture03),h.jsxs(f,{value:dr.Texture04,children:[h.jsx("img",{alt:dr.Texture04,src:art,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture04",d)]},dr.Texture04),h.jsxs(f,{value:dr.Texture05,children:[h.jsx("img",{alt:dr.Texture05,src:lrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture05",d)]},dr.Texture05),h.jsxs(f,{value:dr.Texture06,children:[h.jsx("img",{alt:dr.Texture06,src:srt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture06",d)]},dr.Texture06),h.jsxs(f,{value:dr.Texture07,children:[h.jsx("img",{alt:dr.Texture07,src:crt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture07",d)]},dr.Texture07),h.jsxs(f,{value:dr.Texture08,children:[h.jsx("img",{alt:dr.Texture08,src:urt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture08",d)]},dr.Texture08),h.jsxs(f,{value:dr.Texture09,children:[h.jsx("img",{alt:dr.Texture09,src:drt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture09",d)]},dr.Texture09),h.jsxs(f,{value:dr.Texture10,children:[h.jsx("img",{alt:dr.Texture10,src:frt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture10",d)]},dr.Texture10),h.jsxs(f,{value:dr.Texture11,children:[h.jsx("img",{alt:dr.Texture11,src:hrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture11",d)]},dr.Texture11),h.jsxs(f,{value:dr.Texture12,children:[h.jsx("img",{alt:dr.Texture12,src:prt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture12",d)]},dr.Texture12),h.jsxs(f,{value:dr.Texture13,children:[h.jsx("img",{alt:dr.Texture13,src:grt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture13",d)]},dr.Texture13),h.jsxs(f,{value:dr.Texture14,children:[h.jsx("img",{alt:dr.Texture14,src:mrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture14",d)]},dr.Texture14),h.jsxs(f,{value:dr.Texture15,children:[h.jsx("img",{alt:dr.Texture15,src:yrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture15",d)]},dr.Texture15),h.jsxs(f,{value:dr.Texture16,children:[h.jsx("img",{alt:dr.Texture16,src:Art,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture16",d)]},dr.Texture16),h.jsxs(f,{value:dr.Texture17,children:[h.jsx("img",{alt:dr.Texture17,src:wrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture17",d)]},dr.Texture17)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:A=>H.getState().setDoorActionScope(A.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},P7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(z7),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.color)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.color=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Door&&P!==A.color&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Door&&P!==A.color&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Door&&A.foundationId===(s==null?void 0:s.foundationId)&&P!==A.color&&!A.locked)return!0;break;case ie.OnlyThisSide:for(const A of n)if(A.type===z.Door&&A.parentId===(s==null?void 0:s.parentId)&&P!==A.color&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.parentId===s.parentId&&!s.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.color:s.color)??"#ffffff",v={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}e(A=>{A.actionState.doorColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("word.Color",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},C7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(z7),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.frameColor)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){!v.locked&&v.type===z.Door&&(v.frameColor=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Door&&!A.locked&&H.getState().selectedElementIdSet.has(A.id)&&P!==A.frameColor)return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Door&&!A.locked&&P!==A.frameColor)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Door&&A.foundationId===(s==null?void 0:s.foundationId)&&!A.locked&&P!==A.frameColor)return!0;break;case ie.OnlyThisSide:for(const A of n)if(A.type===z.Door&&A.parentId===(s==null?void 0:s.parentId)&&!A.locked&&P!==A.frameColor)return!0;break;default:if(P!==(s==null?void 0:s.frameColor))return!0;break}return!1},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.parentId===s.parentId&&!s.locked&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.frameColor:s.frameColor)??"#ffffff",v={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}e(A=>{A.actionState.doorColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("doorMenu.FrameColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c??(s==null?void 0:s.frameColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},R7o=t=>{const e=[];if(t.type!==z.Door)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"door-copy",label:h.jsx(ad,{})}),o&&e.push({key:"door-cut",label:h.jsx(ld,{})}),e.push({key:"door-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"door-filled",label:h.jsx(m7o,{door:n})},{key:"door-interior",label:h.jsx(y7o,{door:n})}),e.push({key:"door-type-submenu",label:h.jsx(ln,{children:B.t("doorMenu.DoorType",r)}),children:[{key:"door-type-radio-group",label:h.jsx(A7o,{door:n}),style:{backgroundColor:"white"}}]},{key:"door-width",label:h.jsxs(Zn,{Dialog:w7o,children:[B.t("word.Width",r)," ..."]})},{key:"door-height",label:h.jsxs(Zn,{Dialog:x7o,children:[B.t("word.Height",r)," ..."]})}),n.filled&&(e.push({key:"door-u-value",label:h.jsxs(Zn,{Dialog:b7o,children:[B.t("word.UValue",r)," ..."]})},{key:"door-heat-capacity",label:h.jsxs(Zn,{Dialog:S7o,children:[B.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"door-texture",label:h.jsxs(Zn,{Dialog:T7o,children:[B.t("word.Texture",r)," ..."]})},{key:"door-color",label:h.jsxs(Zn,{Dialog:P7o,children:[B.t("word.Color",r)," ..."]})},{key:"door-frame-color",label:h.jsxs(Zn,{Dialog:C7o,children:[B.t("doorMenu.FrameColor",r)," ..."]})}),(n.textureType===dr.Default||n.textureType===dr.NoTexture)&&e.push({key:"door-opacity",label:h.jsxs(Zn,{Dialog:v7o,children:[B.t("wallMenu.Opacity",r)," ..."]})}))),{items:e}},H7o=({windowModel:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,note:a,digit:l,setDialogVisible:s})=>{const c=H(Qn),u=H(Fn),d=H(ZN),f=H(no),p=H(qn),m=H(pn),y=H($r),w=g.useMemo(()=>{const W=t[n],F=y(t);if(F&&t.parentType!==z.Roof){if(n==="lx")return W*F.lx;if(n==="lz")return W*F.lz}return n==="sillWidth"&&W===void 0?.2:W},[n,t]),[x,C]=g.useState(w),P=Kt(),A=(W,F,E)=>{const L=y(W);L&&(F==="lx"||F==="lz")?W.parentType===z.Roof?W[F]=E:W[F]=E/L[F]:W[F]=E},S=(W,F)=>{m(E=>{for(const L of E.elements)if(L.id===W){!L.locked&&L.type===z.Window&&A(L,n,F);break}})},v=(W,F)=>{W&&m(E=>{for(const L of E.elements)!L.locked&&L.type===z.Window&&L.parentId===W&&A(L,n,F)})},b=(W,F)=>{W&&m(E=>{for(const L of E.elements)!L.locked&&L.type===z.Window&&L.foundationId===W&&A(L,n,F)})},T=W=>{m(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&A(E,n,W)})},R=(W,F)=>{m(E=>{for(const L of E.elements)!L.locked&&L.type===z.Window&&W.has(L.id)&&A(L,n,F)})},M=W=>{for(const[F,E]of W.entries())S(F,E)},D=W=>{switch(d){case ie.AllSelectedObjectsOfThisType:{for(const F of c)if(F.type===z.Window&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}case ie.AllObjectsOfThisType:{for(const F of c)if(F.type===z.Window&&!F.locked){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const F of c)if(F.type===z.Window&&F.foundationId===t.foundationId&&!F.locked){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}case ie.OnlyThisSide:{for(const F of c)if(F.type===z.Window&&F.parentId===t.parentId&&!F.locked){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}default:{const F=y(t);if(F&&t.parentType!==z.Roof){if(n==="lx"){if(W!==t[n]*F.lx)return!0}else if(n==="lz"){if(W!==t[n]*F.lz)return!0}else if(W!==t[n])return!0}else if(W!==t[n])return!0;break}}return!1},k=W=>{if(t&&D(W)){switch(d){case ie.AllSelectedObjectsOfThisType:{const F=new Map;for(const L of c)if(L.type===z.Window&&!L.locked&&H.getState().selectedElementIdSet.has(L.id)){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{M(E.oldValues)},redo:()=>{R(E.oldValues,E.newValue)}};u(E),R(F,W),p(f+1);break}case ie.AllObjectsOfThisType:{const F=new Map;for(const L of c)if(L.type===z.Window&&!L.locked){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{M(E.oldValues)},redo:()=>{T(E.newValue)}};u(E),T(W),p(f+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const F=new Map;for(const L of c)if(L.type===z.Window&&L.foundationId===t.foundationId&&!L.locked){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:F,newValue:W,groupId:t.foundationId,undo:()=>{M(E.oldValues)},redo:()=>{b(t.foundationId,E.newValue)}};u(E),b(t.foundationId,W),p(f+1)}break;case ie.OnlyThisSide:if(t.parentId){const F=new Map;for(const L of c)if(L.type===z.Window&&L.parentId===t.parentId&&!L.locked){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for All Windows On the Same Parent`,timestamp:Date.now(),oldValues:F,newValue:W,groupId:t.parentId,undo:()=>{M(E.oldValues)},redo:()=>{v(t.parentId,E.newValue)}};u(E),v(t.parentId,W),p(f+1)}break;default:if(t){let F=t[n];const E=y(t);E&&t.parentType!==z.Roof&&(n==="lx"?F*=E.lx:n==="lz"&&(F*=E.lz));const L={name:`Set Window ${e}`,timestamp:Date.now(),oldValue:F,newValue:W,changedElementId:t.id,changedElementType:t.type,undo:()=>{S(L.changedElementId,L.oldValue)},redo:()=>{S(L.changedElementId,L.newValue)}};u(L),S(t.id,W),p(f+1)}}m(F=>{switch(e){case Tp.Width:F.actionState.windowWidth=W;break;case Tp.Height:F.actionState.windowHeight=W;break;case Tp.Opacity:F.actionState.windowOpacity=W;break;case Tp.FrameWidth:F.actionState.windowFrameWidth=W;break;case Tp.SillWidth:F.actionState.windowSillWidth=W;break;case Tp.HorizontalMullionSpacing:F.actionState.windowHorizontalMullionSpacing=W;break;case Tp.VerticalMullionSpacing:F.actionState.windowVerticalMullionSpacing=W;break;case Tp.MullionWidth:F.actionState.windowMullionWidth=W;break}})}},N=()=>{s(!1)},U=()=>{k(x)};return h.jsx(ro,{width:550,title:B.t(`windowMenu.${e}`,P),onApply:U,onClose:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,value:x,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&C(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [",o[0].toFixed(o[0]===0?0:l??0),","," ",o[1].toFixed(l??0),"] ",i," ",h.jsx("br",{}),h.jsx("br",{})," ",a]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:W=>H.getState().setWindowActionScope(W.target.value),value:d,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",P)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",P)})]})})})]})})},M7o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=H(Qn),i=H(pn),a=H(Fn),l=H(ZN),s=H(no),c=H(qn),[u,d]=vne(t[n]??"#ffffff"),f=Kt(),p=(b,T)=>{i(R=>{for(const M of R.elements)if(M.id===b){!M.locked&&M.type===z.Window&&(M[n]=T);break}})},m=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.parentId===b&&(M[n]=T)})},y=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.foundationId===b&&(M[n]=T)})},w=b=>{i(T=>{for(const R of T.elements)!R.locked&&R.type===z.Window&&(R[n]=b)})},x=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&b.has(M.id)&&(M[n]=T)})},C=b=>{for(const[T,R]of b.entries())p(T,R)},P=b=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const T of r)if(T.type===z.Window&&b!==T[n]&&!T.locked&&H.getState().selectedElementIdSet.has(T.id))return!0;break;case ie.AllObjectsOfThisType:for(const T of r)if(T.type===z.Window&&b!==T[n]&&!T.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of r)if(T.type===z.Window&&T.foundationId===t.foundationId&&b!==T[n]&&!T.locked)return!0;break;case ie.OnlyThisSide:for(const T of r)if(T.type===z.Window&&T.parentId===t.parentId&&b!==T[n]&&!T.locked)return!0;break;default:if(b!==t[n])return!0;break}return!1},A=b=>{if(t&&P(b)){switch(l){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{x(R.oldValues,R.newValue)}};a(R),x(T,b),c(s+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{w(R.newValue)}};a(R),w(b),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const T=new Map;for(const M of r)M.type===z.Window&&M.foundationId===t.foundationId&&!t.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{y(R.groupId,R.newValue)}};a(R),y(t.foundationId,b),c(s+1)}break}case ie.OnlyThisSide:{if(t.parentId){const T=new Map;for(const M of r)M.type===z.Window&&M.parentId===t.parentId&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{m(t.parentId,R.newValue)}};a(R),m(t.parentId,b),c(s+1)}break}default:{if(t){const T=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,b),c(s+1)}break}}i(T=>{switch(e){case Tp.Tint:T.actionState.windowTint=b;break;case Tp.MullionColor:T.actionState.windowMullionColor=b;break;case Tp.Color:T.actionState.windowColor=b;break}})}},S=()=>{o()},v=()=>{t[n]!==u&&A(u)};return h.jsx(ro,{width:640,title:B.t(`windowMenu.${e}`,f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u??"#73D8FF",onChangeComplete:d})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:b=>H.getState().setWindowActionScope(b.target.value),value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",f)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",f)})]})})})]})})},I7o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=H(Qn),i=H(pn),a=H(Fn),l=H(ZN),s=H(no),c=H(qn),[u,d]=g.useState(t[n]),f=Kt(),p=(b,T)=>{i(R=>{for(const M of R.elements)if(M.id===b&&!M.locked&&M.type===z.Window){M[n]=T;break}})},m=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.parentId===b&&(M[n]=T)})},y=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.foundationId===b&&(M[n]=T)})},w=b=>{i(T=>{for(const R of T.elements)!R.locked&&R.type===z.Window&&(R[n]=b)})},x=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&b.has(M.id)&&(M[n]=T)})},C=b=>{for(const[T,R]of b.entries())p(T,R)},P=b=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const T of r)if(T.type===z.Window&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T[n]!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of r)if(T.type===z.Window&&!T.locked&&T[n]!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of r)if(T.type===z.Window&&T.foundationId===t.foundationId&&!T.locked&&T[n]!==b)return!0;break;case ie.OnlyThisSide:for(const T of r)if(T.type===z.Window&&T.parentId===t.parentId&&!T.locked&&T[n]!==b)return!0;break;default:if(t[n]!==b)return!0;break}return!1},A=b=>{if(t&&P(b))switch(l){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{x(R.oldValues,R.newValue)}};a(R),x(T,b),c(s+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{w(R.newValue)}};a(R),w(b),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const T=new Map;for(const M of r)M.type===z.Window&&M.foundationId===t.foundationId&&!t.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{y(R.groupId,R.newValue)}};a(R),y(t.foundationId,b),c(s+1)}break}case ie.OnlyThisSide:{if(t.parentId){const T=new Map;for(const M of r)M.type===z.Window&&M.parentId===t.parentId&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{m(t.parentId,R.newValue)}};a(R),m(t.parentId,b),c(s+1)}break}default:{if(t){const T=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,b),c(s+1)}break}}},S=()=>{o()},v=()=>{t[n]!==u&&A(u)};return h.jsx(ro,{width:500,title:B.t(`windowMenu.${e}`,f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsx(zc,{checked:u,onChange:b=>{d(b)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:b=>H.getState().setWindowActionScope(b.target.value),value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",f)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",f)})]})})})]})})},{Option:z7o}=Ko,D7o=({window:t,dataType:e,attributeKey:n,options:o,optionsText:r,setDialogVisible:i})=>{const a=H(Qn),l=H(pn),s=H(Fn),c=H(ZN),u=H(no),d=H(qn),[f,p]=g.useState(t[n]),m=Kt(),y=(R,M)=>{l(D=>{for(const k of D.elements)if(k.id===R){!k.locked&&k.type===z.Window&&(k[n]=M);break}})},w=(R,M)=>{l(D=>{for(const k of D.elements)!k.locked&&k.type===z.Window&&k.parentId===R&&(k[n]=M)})},x=(R,M)=>{l(D=>{for(const k of D.elements)!k.locked&&k.type===z.Window&&k.foundationId===R&&(k[n]=M)})},C=R=>{l(M=>{for(const D of M.elements)!D.locked&&D.type===z.Window&&(D[n]=R)})},P=(R,M)=>{l(D=>{for(const k of D.elements)!k.locked&&k.type===z.Window&&R.has(k.id)&&(k[n]=M)})},A=R=>{for(const[M,D]of R.entries())y(M,D)},S=R=>{if(t){switch(c){case ie.AllSelectedObjectsOfThisType:for(const M of a)if(M.type===z.Window&&R!==M[n]&&!M.locked&&H.getState().selectedElementIdSet.has(M.id))return!0;break;case ie.AllObjectsOfThisType:for(const M of a)if(M.type===z.Window&&R!==M[n]&&!M.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of a)if(M.type===z.Window&&M.foundationId===t.foundationId&&R!==M[n]&&!M.locked)return!0;break;case ie.OnlyThisSide:for(const M of a)if(M.type===z.Window&&M.parentId===t.parentId&&R!==M[n]&&!M.locked)return!0;break;default:if(R!==t[n])return!0;break}return!1}},v=R=>{if(t&&S(R)){switch(c){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of a)k.type===z.Window&&!k.locked&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k[n]);const D={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{A(D.oldValues)},redo:()=>{P(D.oldValues,D.newValue)}};s(D),P(M,R),d(u+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of a)k.type===z.Window&&!k.locked&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{A(D.oldValues)},redo:()=>{C(D.newValue)}};s(D),C(R),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const M=new Map;for(const k of a)k.type===z.Window&&k.foundationId===t.foundationId&&!t.locked&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.foundationId,undo:()=>{A(D.oldValues)},redo:()=>{x(D.groupId,D.newValue)}};s(D),x(t.foundationId,R),d(u+1)}break}case ie.OnlyThisSide:{if(t.parentId){const M=new Map;for(const k of a)k.type===z.Window&&k.parentId===t.parentId&&!k.locked&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.parentId,undo:()=>{A(D.oldValues)},redo:()=>{w(t.parentId,D.newValue)}};s(D),w(t.parentId,R),d(u+1)}break}default:{if(t){const M=t[n],D={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{y(D.changedElementId,D.oldValue)},redo:()=>{y(D.changedElementId,D.newValue)}};s(D),y(t.id,R),d(u+1)}break}}l(M=>{switch(e){case Tp.Tint:M.actionState.windowTint=R;break;case Tp.MullionColor:M.actionState.windowMullionColor=R;break;case Tp.Color:M.actionState.windowColor=R;break}})}},b=()=>{i()},T=()=>{v(f)};return h.jsx(ro,{width:560,title:B.t(`windowMenu.${e}`,m),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsx(Ko,{style:{width:"150px"},value:f,onChange:R=>p(R),children:o.map((R,M)=>h.jsx(z7o,{value:R,children:r[M]},R))})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:R=>H.getState().setWindowActionScope(R.target.value),value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",m)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",m)})]})})})]})})};var am=(t=>(t.Opacity="Opacity",t.Width="Width",t.Height="Height",t.Setback="Setback",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionWidth="MullionWidth",t.SillWidth="SillWidth",t.FrameWidth="FrameWidth",t.ShutterWidth="ShutterWidth",t))(am||{}),wj=(t=>(t.ShutterColor="ShutterColor",t.Color="Color",t.MullionColor="MullionColor",t.Tint="Tint",t))(wj||{}),eM=(t=>(t.Frame="Frame",t.LeftShutter="LeftShutter",t.RightShutter="RightShutter",t.HorizontalMullion="HorizontalMullion",t.VerticalMullion="VerticalMullion",t))(eM||{}),t0t=(t=>(t.WindowType="WindowType",t))(t0t||{});const s3=({dataType:t,noPadding:e})=>{const n=Kt(),[o,r]=g.useState(!1),i=ao(z.Window),a=i?H.getState().getParent(i):null,l=()=>{H.getState().setApplyCount(0),r(!0)},s=O7o[t];return t===am.Width?s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lx*Math.min(Math.abs(.5-i.cx),Math.abs(-.5-i.cx)):100:t===am.Height&&(s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lz*Math.min(Math.abs(.5-i.cz),Math.abs(-.5-i.cz)):100),h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:l,children:[B.t(`windowMenu.${t}`,n)," ..."]}),o&&s&&i&&h.jsx(H7o,{windowModel:i,dataType:t,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?B.t(s.unit,n):void 0,note:s.note?B.t(s.note,n):void 0,digit:s.digit??0,setDialogVisible:r})]})},Une=({dataType:t,noPadding:e})=>{const[n,o]=g.useState(!1),r=Kt(),i=ao(z.Window),a=()=>{H.getState().setApplyCount(0),o(!0)},l=j7o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:a,children:[B.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(M7o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},pW=({dataType:t,noPadding:e})=>{const[n,o]=g.useState(!1),r=Kt(),i=ao(z.Window),a=()=>{H.getState().setApplyCount(0),o(!0)},l=B7o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:a,children:[B.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(I7o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},E7o=({dataType:t,noPadding:e})=>{const n=Kt(),[o,r]=g.useState(!1),i=ao(z.Window),a=()=>{H.getState().setApplyCount(0),r(!0)},l=Y7o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:a,children:[B.t(`windowMenu.${t}`,n)," ..."]}),o&&l&&i&&h.jsx(D7o,{window:i,dataType:t,attributeKey:l.attributeKey,options:[Ti.Default,Ti.Arched,Ti.Polygonal],optionsText:[B.t("windowMenu.Default",n),B.t("windowMenu.Arched",n),B.t("windowMenu.Polygonal",n)],setDialogVisible:()=>r(!1)})]})},k7o=({window:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.empty=i;break}})},o=r=>{const i=r.target.checked,a={name:"Empty Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.windowEmpty=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.empty,onChange:o,children:B.t("windowMenu.Empty",e)})})},F7o=({window:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.windowInterior=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.interior,onChange:o,children:B.t("windowMenu.Interior",e)})})},L7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(ZN),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Window),[c,u]=g.useState((s==null?void 0:s.uValue)??X9),[d,f]=g.useState(ye.toUValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.uValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Window&&S!==v.uValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Window&&S!==v.uValue&&!v.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Window&&v.foundationId===s.foundationId&&S!==v.uValue&&!v.locked)return!0;break;case ie.OnlyThisSide:for(const v of e)if(v.type===z.Window&&v.parentId===s.parentId&&S!==v.uValue&&!v.locked)return!0;break;default:if(S!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Window&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for Selected Windows",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Window&&!T.locked){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for All Windows",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const v=new Map;for(const T of e)if(T.type===z.Window&&T.foundationId===s.foundationId&&!T.locked){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for All Windows Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break}case ie.OnlyThisSide:{if(s.parentId){const v=new Map;for(const T of e)if(T.type===z.Window&&T.parentId===s.parentId&&!T.locked){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for All Windows On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.parentId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break}default:{if(s){const b=a(s.id).uValue??s.uValue??X9,T={name:"Set Window U-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}break}}l(v=>{v.actionState.windowUValue=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("word.UValue",p)+" "}(${B.t("word.ThermalTransmittance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toUValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toUValueInUS(.01),max:ye.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toUValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toUValueInUS(.01).toFixed(3),", ",ye.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setWindowActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",p)})]})})})]})})},W7o=t=>{const e=[];return e.push({key:"window-frame-boolean",label:h.jsx(pW,{noPadding:!0,dataType:eM.Frame})}),t.frame&&e.push({type:"divider"},{key:"window-frame-width",label:h.jsx(s3,{noPadding:!0,dataType:am.FrameWidth})},{key:"window-sill-width",label:h.jsx(s3,{noPadding:!0,dataType:am.SillWidth})},{key:"window-frame-color",label:h.jsx(Une,{noPadding:!0,dataType:wj.Color})}),e},N7o=t=>{const e=[];return e.push({key:"window-horizontal-mullion",label:h.jsx(pW,{noPadding:!0,dataType:eM.HorizontalMullion})},{key:"window-vertical-mullion",label:h.jsx(pW,{noPadding:!0,dataType:eM.VerticalMullion})}),(t.horizontalMullion||t.verticalMullion)&&(e.push({type:"divider"},{key:"window-mullion-width",label:h.jsx(s3,{noPadding:!0,dataType:am.MullionWidth})},{key:"window-mullion-color",label:h.jsx(Une,{noPadding:!0,dataType:wj.MullionColor})}),t.horizontalMullion&&e.push({key:"window-horizontal-mullion-spacing",label:h.jsx(s3,{noPadding:!0,dataType:am.HorizontalMullionSpacing})}),t.verticalMullion&&e.push({key:"window-vertical-mullion-spacing",label:h.jsx(s3,{noPadding:!0,dataType:am.VerticalMullionSpacing})})),e},U7o=t=>{const e=[];return e.push({key:"window-left-shutter",label:h.jsx(pW,{noPadding:!0,dataType:eM.LeftShutter})},{key:"window-right-shutter",label:h.jsx(pW,{noPadding:!0,dataType:eM.RightShutter})}),(t.leftShutter||t.rightShutter)&&e.push({type:"divider"},{key:"window-shutter-color",label:h.jsx(Une,{noPadding:!0,dataType:wj.ShutterColor})},{key:"window-shutter-width",label:h.jsx(s3,{noPadding:!0,dataType:am.ShutterWidth})}),e};var Tp=(t=>(t.Color="Color",t.Tint="Tint",t.Opacity="Opacity",t.WindowType="WindowType",t.MullionWidth="MullionWidth",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionColor="MullionColor",t.Frame="Frame",t.FrameWidth="FrameWidth",t.SillWidth="SillWidth",t.Width="Width",t.Height="Height",t))(Tp||{});const j7o={Tint:{attributeKey:"tint"},Color:{attributeKey:"color"},MullionColor:{attributeKey:"mullionColor"},ShutterColor:{attributeKey:"shutterColor"}},B7o={HorizontalMullion:{attributeKey:"horizontalMullion"},VerticalMullion:{attributeKey:"verticalMullion"},Frame:{attributeKey:"frame"},LeftShutter:{attributeKey:"leftShutter"},RightShutter:{attributeKey:"rightShutter"}},Y7o={WindowType:{attributeKey:"windowType",options:[Ti.Default,Ti.Arched,Ti.Polygonal]}},O7o={Opacity:{attributeKey:"opacity",range:[0,.9],step:.1,note:"windowMenu.SolarHeatGainCoefficient",digit:1},Width:{attributeKey:"lx",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Height:{attributeKey:"lz",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Setback:{attributeKey:"cy",range:[0,1],step:.01,unit:"",digit:0,note:"windowMenu.RelativeToWallThickness"},MullionWidth:{attributeKey:"mullionWidth",range:[0,.5],step:.1,unit:"word.MeterAbbreviation",digit:1},ShutterWidth:{attributeKey:"shutterWidth",range:[0,.5],step:.01,unit:"",digit:1},HorizontalMullionSpacing:{attributeKey:"horizontalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},VerticalMullionSpacing:{attributeKey:"verticalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},FrameWidth:{attributeKey:"frameWidth",range:[.05,.2],step:.01,unit:"word.MeterAbbreviation",digit:2},SillWidth:{attributeKey:"sillWidth",range:[0,.5],step:.01,unit:"word.MeterAbbreviation",digit:2}},_7o=t=>{const e=[];if(t.type!==z.Window)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"window-copy",label:h.jsx(ad,{})}),o&&e.push({key:"window-cut",label:h.jsx(ld,{})}),e.push({key:"window-lock",label:h.jsx(D0,{selectedElement:n})}),o&&e.push({key:"window-empty",label:h.jsx(k7o,{window:n})},{key:"window-interior",label:h.jsx(F7o,{window:n})}),o&&e.push({key:"window-type",label:h.jsx(E7o,{dataType:t0t.WindowType})},{key:"window-width",label:h.jsx(s3,{dataType:am.Width})},{key:"window-height",label:h.jsx(s3,{dataType:am.Height})},{key:"window-setback",label:h.jsx(s3,{dataType:am.Setback})},{key:"window-opacity",label:h.jsx(s3,{dataType:am.Opacity})},{key:"window-tint",label:h.jsx(Une,{dataType:wj.Tint})},{key:"window-u-value",label:h.jsxs(Zn,{Dialog:L7o,children:[B.t("word.UValue",r)," ..."]})},{key:"window-mullion-submenu",label:h.jsx(ln,{children:B.t("windowMenu.Mullion",r)}),children:N7o(n)},{key:"window-frame-submenu",label:h.jsx(ln,{children:B.t("windowMenu.Frame",r)}),children:W7o(n)},{key:"window-shutter-submenu",label:h.jsx(ln,{children:B.t("windowMenu.Shutter",r)}),children:U7o(n)}),{items:e}},V7o=({roof:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===r&&s.type===z.Roof);l&&(l.ceiling=i,a.actionState.roofCeiling=i)})},o=r=>{const i=r.target.checked,a={name:"Roof Ceiling",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.ceiling,onChange:o,children:B.t("roofMenu.Ceiling",e)})})},G7o=({roof:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=H.getState().removeAllChildElementsByType,a=()=>{const s=H.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Roof`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{H.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};H.getState().addUndoable(u)},l=()=>{const s=o??a;li.confirm({title:n,icon:h.jsx(_y,{}),onOk:s})};return h.jsx(ln,{update:!0,noPadding:!0,onClick:l,children:r})},IEe=({roof:t,objectType:e,lock:n,children:o})=>{const r=H.getState().updateElementLockById,i=H.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of H.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Roof`:`Unlock All Locked ${l} on Roof`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};H.getState().addUndoable(u)};return h.jsx(ln,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},X7o=({roof:t})=>{const e=Kt(),n=H.getState().updateRoofStructureById,o=r=>{const i={name:"Select Roof Structure",timestamp:Date.now(),oldValue:t.roofStructure??Hc.Default,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.value),H.getState().set(a=>{a.actionState.roofStructure=r.target.value})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t.roofStructure??Hc.Default,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Hc.Default,children:B.t("roofMenu.DefaultStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Hc.Rafter,children:B.t("roofMenu.RafterStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Hc.Glass,children:B.t("roofMenu.GlassStructure",e)})]})})})},Bce=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],J7o=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${B.t("roofMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof",n)} (${e} ${B.t("roofMenu.SolarPanels",n)})`;break}case z.Window:{o=`${B.t("roofMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllWindowsOnThisRoof",n)} (${e} ${B.t("roofMenu.Windows",n)})`;break}case z.Sensor:{o=`${B.t("roofMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllSensorsOnThisRoof",n)} (${e} ${B.t("roofMenu.Sensors",n)})`;break}case z.Light:{o=`${B.t("roofMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllLightsOnThisRoof",n)} (${e} ${B.t("roofMenu.Lights",n)})`;break}}return{itemLabel:o,modalTitle:r}},Yce=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],K7o=(t,e,n)=>{const o=[],r={lng:H.getState().language};return Bce.forEach(({key:i,objectType:a})=>{const l=Yce(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=J7o(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-roof`,label:h.jsx(G7o,{roof:t,objectType:a,modalTitle:c,children:s})})}}),Bce.forEach(({key:i,objectType:a})=>{const l=Yce(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-roof`,label:h.jsxs(IEe,{roof:t,objectType:a,lock:!0,children:[B.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),Bce.forEach(({lockedKey:i,objectType:a})=>{const l=Yce(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(IEe,{roof:t,objectType:a,lock:!1,children:[B.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!0,children:[B.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!1,children:[B.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},$7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.thickness)??.4),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)v.id===P&&(v.thickness=A,S.updateElementOnRoofFlag=!0),v.parentId===P&&v.type===z.Window&&(v.ly=A)})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.thickness&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.thickness&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.thickness&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.thickness))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)){const b=v;A.set(v.id,b.thickness),f(b.id,P)}const S={name:"Set Thickness for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked){const b=v;A.set(v.id,b.thickness),f(b.id,P)}const S={name:"Set Thickness for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked){const b=v;A.set(v.id,b.thickness),f(b.id,P)}const S={name:"Set Thickness for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).thickness??s.thickness??.4,v={name:"Set Roof Thickness",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.roofThickness=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.Thickness",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.05,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.05, 1] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},q7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=ao(z.Roof),[s,c]=g.useState((l==null?void 0:l.rise)??0),u=Kt(),d=(C,P)=>{H.getState().updateRoofRiseById(C,P),H.getState().set(A=>{A.updateElementOnRoofFlag=!0})},f=C=>{for(const[P,A]of C.entries())d(P,A)},p=(C,P)=>{for(const A of C.keys())d(A,P)},m=C=>{if(l){switch(o){case ie.AllSelectedObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked&&H.getState().selectedElementIdSet.has(P.id))return!0;break;case ie.AllObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const P of e)if(P.type===z.Roof&&P.foundationId===l.foundationId&&C!==P.rise&&!P.locked)return!0;break;default:if(C!==(l==null?void 0:l.rise))return!0;break}return!1}},y=C=>{if(l&&m(C))switch(H.getState().roofActionScope){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Roof&&!S.locked&&(P.set(S.id,S.rise),d(S.id,C));const A={name:"Set Rise for Selected Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{p(A.oldValues,A.newValue)}};n(A),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Roof&&!S.locked&&(P.set(S.id,S.rise),d(S.id,C));const A={name:"Set Rise for All Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{p(A.oldValues,A.newValue)}};n(A),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(l.foundationId){const P=new Map;for(const S of e)S.type===z.Roof&&S.foundationId===l.foundationId&&!S.locked&&(P.set(S.id,S.rise),d(S.id,C));const A={name:"Set Rise for All Roofs Above Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:l.foundationId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.oldValues,A.newValue)}};n(A),i(r+1)}break;default:if(l){const P=a(l.id),A=(P==null?void 0:P.rise)??(l==null?void 0:l.rise)??0,S={name:"Set Roof Rise",timestamp:Date.now(),oldValue:A,newValue:C,changedElementId:l.id,changedElementType:l.type,undo:()=>{d(S.changedElementId,S.oldValue)},redo:()=>{d(S.changedElementId,S.newValue)}};n(S),d(l.id,C),i(r+1)}}},w=()=>{t(!1)},x=()=>{y(s)};return h.jsx(ro,{width:550,title:B.t("roofMenu.Rise",u),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:200,style:{width:120},step:.1,precision:2,value:s,formatter:C=>Number(C).toFixed(2),onChange:C=>c(C)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",u),": [0, 200] ",B.t("word.MeterAbbreviation",u)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",u)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:C=>H.getState().setRoofActionScope(C.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",u)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",u)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",u)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",u)})]})})})]})})},Q7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rValue)??pA),[d,f]=g.useState(ye.toRValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.rValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&S!==v.rValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&S!==v.rValue&&!v.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&S!==v.rValue&&!v.locked)return!0;break;default:if(S!==(s==null?void 0:s.rValue))return!0;break}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Roof&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;v.set(T.id,R.rValue??pA),m(R.id,S)}const b={name:"Set R-Value for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Roof&&!T.locked){const R=T;v.set(T.id,R.rValue??pA),m(R.id,S)}const b={name:"Set R-Value for All Roofs",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const T of e)if(T.type===z.Roof&&T.foundationId===s.foundationId&&!T.locked){const R=T;v.set(T.id,R.rValue??pA),m(R.id,S)}const b={name:"Set R-Value for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;default:if(s){const b=a(s.id).rValue??s.rValue??pA,T={name:"Set Roof R-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}}l(v=>{v.actionState.roofRValue=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("roofMenu.RoofRValue",p)+" "}(${B.t("word.ThermalResistance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toRValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toRValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setRoofActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",p)})]})})})]})})},Z7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(o6),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.volumetricHeatCapacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.volumetricHeatCapacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Roof&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Roof&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Roof&&b.foundationId===s.foundationId&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,v={name:"Set Volumetric Heat Capacity of Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.roofVolumetricHeatCapacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},exo="/aladdin/assets/roof_edge-DBy_1Q5D.png",txo="/aladdin/assets/roof_01-BwuyLpwq.png",nxo="/aladdin/assets/roof_02-DAbYjnV7.png",oxo="/aladdin/assets/roof_03-haZGIixv.png",rxo="/aladdin/assets/roof_04-DDuwUcDr.png",ixo="/aladdin/assets/roof_05-CtBb5xIW.png",axo="/aladdin/assets/roof_06-DuyyebV8.png",lxo="/aladdin/assets/roof_07-DXWGQN8a.png",sxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(pn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.textureType)??Yr.Default),d=Kt(),{Option:f}=Ko,p=(A,S)=>{a(v=>{for(const b of v.elements)if(b.id===A){b.locked||(b.textureType=S);break}})},m=(A,S)=>{for(const v of A.keys())p(v,S)},y=A=>{for(const[S,v]of A.entries())p(S,v)},w=A=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Roof&&A!==S.textureType&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Roof&&A!==S.textureType&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Roof&&S.foundationId===s.foundationId&&A!==S.textureType&&!S.locked)return!0;break;default:if(A!==(s==null?void 0:s.textureType))return!0;break}return!1}},x=A=>{if(s&&w(A)){switch(o){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Roof&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&S.set(b.id,b.textureType??Yr.Default);const v={name:"Set Texture for Selected Roofs",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Roof&&!b.locked&&S.set(b.id,b.textureType??Yr.Default);const v={name:"Set Texture for All Roofs",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const S=new Map;for(const b of e)b.type===z.Roof&&b.foundationId===s.foundationId&&!b.locked&&S.set(b.id,b.textureType);const v={name:"Set Texture for All Roofs Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:s.foundationId,undo:()=>{y(v.oldValues)},redo:()=>{v.groupId&&m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1)}break;default:if(s){const S=l(s.id),v=S?S.textureType:s.textureType,b={name:"Set Texture of Selected Roof",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};n(b),p(s.id,A),i(r+1)}}a(S=>{S.actionState.roofTexture=A})}},C=()=>{t(!1)},P=()=>{x(c)};return h.jsx(ro,{width:550,title:B.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:c,onChange:A=>u(A),children:[h.jsxs(f,{value:Yr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",d)]},Yr.NoTexture),h.jsxs(f,{value:Yr.Default,children:[h.jsx("img",{alt:Yr.Default,src:exo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.TextureDefault",d)]},Yr.Default),h.jsxs(f,{value:Yr.Texture01,children:[h.jsx("img",{alt:Yr.Texture01,src:txo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture01",d)]},Yr.Texture01),h.jsxs(f,{value:Yr.Texture02,children:[h.jsx("img",{alt:Yr.Texture02,src:nxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture02",d)]},Yr.Texture02),h.jsxs(f,{value:Yr.Texture03,children:[h.jsx("img",{alt:Yr.Texture03,src:oxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture03",d)]},Yr.Texture03),h.jsxs(f,{value:Yr.Texture04,children:[h.jsx("img",{alt:Yr.Texture04,src:rxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture04",d)]},Yr.Texture04),h.jsxs(f,{value:Yr.Texture05,children:[h.jsx("img",{alt:Yr.Texture05,src:ixo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture05",d)]},Yr.Texture05),h.jsxs(f,{value:Yr.Texture06,children:[h.jsx("img",{alt:Yr.Texture06,src:axo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture06",d)]},Yr.Texture06),h.jsxs(f,{value:Yr.Texture07,children:[h.jsx("img",{alt:Yr.Texture07,src:lxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture07",d)]},Yr.Texture07)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:A=>H.getState().setRoofActionScope(A.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},cxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(qy),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.color)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.color=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.color&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.color&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.color&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of n)v.type===z.Roof&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.color:s.color)??"#ffffff",v={name:"Set Color of Selected Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}e(A=>{A.actionState.roofColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("roofMenu.RoofColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},uxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(pn),o=H(Fn),r=H(qy),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.sideColor)??"#ffffff"),d=Kt(),f=(P,A)=>{n(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.sideColor=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.sideColor&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.sideColor&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.sideColor&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.sideColor))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.sideColor??"#ffffff");const S={name:"Set Side Color for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&A.set(v.id,v.sideColor??"#ffffff");const S={name:"Set Side Color for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)v.type===z.Roof&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.sideColor??"#ffffff");const S={name:"Set Side Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.sideColor:s.sideColor)??"#ffffff",v={name:"Set Side Color of Selected Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}n(A=>{A.actionState.roofSideColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("roofMenu.RoofSideColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c??(s==null?void 0:s.sideColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},dxo=({setDialogVisible:t})=>{const e=H(Au),n=H(q3),o=H(Fn),r=H(qy),i=H(IJe),a=H(no),l=H(qn),s=H(Ji),c=H(Jn),u=H(pn),d=H(W=>{if(n){for(const F of W.elements)if(F.id===n.id)return F}return null}),[f,p]=g.useState((d==null?void 0:d.ceilingRValue)??dA),[m,y]=g.useState(ye.toRValueInUS(f)),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S={lng:e};g.useEffect(()=>{d&&p((d==null?void 0:d.ceilingRValue)??dA)},[d==null?void 0:d.ceilingRValue]);const v=(W,F)=>{u(E=>{for(const L of E.elements)if(L.id===W){L.ceilingRValue=F;break}})},b=W=>{for(const[F,E]of W.entries())v(F,E)},T=(W,F)=>{for(const E of W.keys())v(E,F)},R=W=>{if(d){switch(r){case ie.AllObjectsOfThisType:{const F=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&!j.locked){const Y=j;F.set(j.id,Y.ceilingRValue??dA),Y.ceilingRValue=W}});const E={name:"Set R-Value for All Ceilings",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{b(E.oldValues)},redo:()=>{T(E.oldValues,E.newValue)}};o(E),l(a+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const F=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&j.foundationId===d.foundationId&&!j.locked){const Y=j;F.set(j.id,Y.ceilingRValue??dA),Y.ceilingRValue=W}});const E={name:"Set R-Value for All Ceilings Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:d.foundationId,undo:()=>{b(E.oldValues)},redo:()=>{T(E.oldValues,E.newValue)}};o(E),l(a+1)}break}default:{if(d){const E=c(d.id).ceilingRValue??d.ceilingRValue??dA,L={name:"Set Ceiling R-Value",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:d.id,changedElementType:d.type,undo:()=>{v(L.changedElementId,L.oldValue)},redo:()=>{v(L.changedElementId,L.newValue)}};o(L),v(d.id,W),l(a+1)}break}}u(F=>{F.actionState.roofRValue=W})}},M=(W,F)=>{if(A.current){const{clientWidth:E,clientHeight:L}=window.document.documentElement,j=A.current.getBoundingClientRect();P({left:-j.left+F.x,right:E-(j.right-F.x),top:-j.top+F.y,bottom:L-((j==null?void 0:j.bottom)-F.y)})}},D=()=>{p((d==null?void 0:d.ceilingRValue)??dA),t(!1)},k=()=>{D(),s()},N=()=>{R(f),t(!1),l(0)},U=()=>{R(f)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:[B.t("roofMenu.CeilingRValue",S)+" ","(",B.t("word.ThermalResistance",S),")"]}),footer:[h.jsx(oo,{onClick:U,children:B.t("word.Apply",S)},"Apply"),h.jsx(oo,{onClick:k,children:B.t("word.Cancel",S)},"Cancel"),h.jsx(oo,{type:"primary",onClick:N,children:B.t("word.OK",S)},"OK")],onCancel:D,maskClosable:!1,destroyOnClose:!1,modalRender:W=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(F,E)=>M(F,E),children:h.jsx("div",{ref:A,children:W})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(p(W),y(ye.toRValueInUS(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",S),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:m,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(y(W),p(ye.toRValueInSI(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",S),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:W=>i(W.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisCeiling",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllCeilingsAboveFoundation",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllCeilings",S)})]})})})]})})})},fxo=t=>{const e={lng:H.getState().language},n=[];return n.push({key:"roof-ceiling",label:h.jsx(V7o,{roof:t})}),t.ceiling&&n.push({type:"divider"},{key:"ceiling-r-value",label:h.jsxs(Zn,{noPadding:!0,Dialog:dxo,children:[B.t("roofMenu.CeilingRValue",e)," ..."]})}),n},hxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(qy),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rafterColor)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.rafterColor=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.rafterColor&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.rafterColor&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.rafterColor&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterColor))return!0;break}return!1}},w=P=>{if(s&&y(P))switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.rafterColor??"#ffffff");const S={name:"Set Rafter Color for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&A.set(v.id,v.rafterColor??"#ffffff");const S={name:"Set Rafter Color for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of n)v.type===z.Roof&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.rafterColor??"#ffffff");const S={name:"Set Rafter Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.rafterColor:s.rafterColor)??"#ffffff",v={name:"Set Rafter Color of Selected Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("roofMenu.RoofColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},pxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rafterSpacing)??1),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.rafterSpacing=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterSpacing&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterSpacing&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.rafterSpacing&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterSpacing))return!0;break}return!1}},w=P=>{if(s&&y(P))switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&(A.set(v.id,v.rafterSpacing??1),f(v.id,P));const S={name:"Set Rafter Spacing for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&(A.set(v.id,v.rafterSpacing??1),f(v.id,P));const S={name:"Set Rafter Spacing for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked&&(A.set(v.id,v.rafterSpacing??1),f(v.id,P));const S={name:"Set Rafter Spacing for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).rafterSpacing??s.rafterSpacing??1,v={name:"Set Roof Rafter Spacing",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("roofMenu.RafterSpacing",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:100,style:{width:120},step:.1,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.1, 100] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},gxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rafterWidth)??.1),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.rafterWidth=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterWidth&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterWidth&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.rafterWidth&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterWidth))return!0;break}return!1}},w=P=>{if(s&&y(P))switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&(A.set(v.id,v.rafterWidth??.1),f(v.id,P));const S={name:"Set Rafter Width for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&(A.set(v.id,v.rafterWidth??.1),f(v.id,P));const S={name:"Set Rafter Width for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked&&(A.set(v.id,v.rafterWidth??.1),f(v.id,P));const S={name:"Set Rafter Width for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).rafterWidth??s.rafterWidth??.1,v={name:"Set Roof Rafter Width",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("roofMenu.RafterWidth",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.01, 1] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},mxo=({setDialogVisible:t})=>{const e=H(pn),n=H(q3),o=H(Fn),r=H(qy),i=H(IJe),a=H(no),l=H(qn),s=H(Ji),c=H(Jn),[u,d]=g.useState((n==null?void 0:n.glassTint)??"#73D8FF"),[f,p]=g.useState(!1),[m,y]=g.useState({left:0,top:0,bottom:0,right:0}),w=g.useRef(null),x=g.useRef(null);g.useEffect(()=>{var k;(k=x.current)==null||k.focus()});const C=Kt();g.useEffect(()=>{n&&d((n==null?void 0:n.glassTint)??"#73D8FF")},[n]);const P=(k,N)=>{e(U=>{for(const W of U.elements)if(W.id===k){W.locked||(W.glassTint=N);break}})},A=(k,N)=>{for(const U of k.keys())P(U,N)},S=k=>{for(const[N,U]of k.entries())P(N,U)},v=k=>{if(n)switch(r){case ie.AllObjectsOfThisType:{const N=new Map;for(const W of H.getState().elements)W.type===z.Roof&&!W.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs",timestamp:Date.now(),oldValues:N,newValue:k,undo:()=>{S(U.oldValues)},redo:()=>{A(U.oldValues,U.newValue)}};o(U),A(N,k),l(a+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(n.foundationId){const N=new Map;for(const W of H.getState().elements)W.type===z.Roof&&W.foundationId===n.foundationId&&!n.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs Above Foundation",timestamp:Date.now(),oldValues:N,newValue:k,groupId:n.foundationId,undo:()=>{S(U.oldValues)},redo:()=>{U.groupId&&A(U.oldValues,U.newValue)}};o(U),A(N,k),l(a+1)}break}default:{if(n){const N=c(n.id),U=(N?N.glassTint:n.glassTint)??"#73D8FF",W={name:"Set Glass Tint of Selected Roof",timestamp:Date.now(),oldValue:U,newValue:k,changedElementId:n.id,changedElementType:n.type,undo:()=>{P(W.changedElementId,W.oldValue)},redo:()=>{P(W.changedElementId,W.newValue)}};o(W),P(n.id,k),l(a+1)}break}}},b=(k,N)=>{if(w.current){const{clientWidth:U,clientHeight:W}=window.document.documentElement,F=w.current.getBoundingClientRect();y({left:-F.left+N.x,right:U-(F.right-N.x),top:-F.top+N.y,bottom:W-((F==null?void 0:F.bottom)-N.y)})}},T=()=>{n!=null&&n.glassTint&&d(n.glassTint),t(!1)},R=()=>{T(),s()},M=()=>{const k=c(n.id);k&&k.glassTint!==u&&v(u),t(!1),l(0)},D=()=>{v(u)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>p(!0),onMouseOut:()=>p(!1),children:B.t("roofMenu.GlassTint",C)}),footer:[h.jsx(oo,{onClick:D,children:B.t("word.Apply",C)},"Apply"),h.jsx(oo,{onClick:R,children:B.t("word.Cancel",C)},"Cancel"),h.jsx(oo,{type:"primary",ref:x,onClick:M,children:B.t("word.OK",C)},"OK")],onCancel:T,maskClosable:!1,destroyOnClose:!1,modalRender:k=>h.jsx(Vi,{disabled:!f,bounds:m,onStart:(N,U)=>b(N,U),children:h.jsx("div",{ref:w,children:k})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u??(n==null?void 0:n.glassTint)??"#73D8FF",onChangeComplete:k=>{d(k.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:k=>i(k.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",C)})]})})})]})})})},yxo=t=>{const e={lng:H.getState().language},n=[];return n.push({key:"roof-structure-radio-group",label:h.jsx(X7o,{roof:t}),style:{backgroundColor:"white"}}),t.roofStructure===Hc.Rafter&&n.push({type:"divider"},{key:"roof-rafter-spacing",label:h.jsxs(Zn,{noPadding:!0,Dialog:pxo,children:[B.t("roofMenu.RafterSpacing",e)," ..."]})},{key:"roof-rafter-width",label:h.jsxs(Zn,{noPadding:!0,Dialog:gxo,children:[B.t("roofMenu.RafterWidth",e)," ..."]})},{key:"roof-rafter-color",label:h.jsxs(Zn,{noPadding:!0,Dialog:hxo,children:[B.t("roofMenu.RafterColor",e)," ..."]})}),t.roofStructure===Hc.Glass&&n.push({type:"divider"},{key:"roof-glass-tint-selection",label:h.jsxs(Zn,{noPadding:!0,Dialog:mxo,children:[B.t("roofMenu.GlassTint",e)," ..."]})}),n},Axo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.opacity)!==void 0?s.opacity:.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.opacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.opacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.opacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.opacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked){const b=v;A.set(v.id,b.opacity),f(b.id,P)}const S={name:"Set Opacity for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked){const b=v;A.set(v.id,b.opacity),f(b.id,P)}const S={name:"Set Opacity for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked){const b=v;A.set(v.id,b.opacity),f(b.id,P)}const S={name:"Set Opacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const A=a(s.id),S=A.opacity!==void 0?A.opacity:s.opacity!==void 0?s.opacity:.5,v={name:"Set Roof Opacity",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.roofGlassOpacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("roofMenu.Opacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},wxo=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0)switch(t[0].type){case z.Window:case z.SolarPanel:case z.SolarWaterHeater:case z.Sensor:case z.Light:return!0}return!1},xxo=t=>{const e=[];if(t.type!==z.Roof)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=H.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1),s=n.roofStructure!==Hc.Rafter||n.opacity===void 0||n.opacity>0;return wxo()&&e.push({key:"roof-paste",label:h.jsx(yI,{})}),e.push({key:"roof-lock",label:h.jsx(D0,{selectedElement:n})}),n.rise>0&&e.push({key:"roof-ceiling-submenu",label:h.jsx(ln,{children:B.t("roofMenu.Ceiling",r)}),children:fxo(n)}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-roof",label:h.jsx(ln,{children:B.t("word.Elements",r)}),children:K7o(n,a,l)}),o&&(n.roofType===Zo.Gable&&(e.push({key:"roof-structure-submenu",label:h.jsx(ln,{children:B.t("roofMenu.RoofStructure",r)}),children:yxo(n)}),(n.roofStructure===Hc.Rafter||n.roofStructure===Hc.Glass)&&e.push({key:"opacity",label:h.jsxs(Zn,{Dialog:Axo,children:[B.t("roofMenu.Opacity",r)," ..."]})})),e.push({key:"roof-thickness",label:h.jsxs(Zn,{Dialog:$7o,children:[B.t(n.roofStructure===Hc.Rafter?"roofMenu.RafterThickness":"word.Thickness",r)," ","..."]})}),e.push({key:"roof-rise",label:h.jsxs(Zn,{Dialog:q7o,children:[B.t("roofMenu.Rise",r)," ..."]})}),s&&(e.push({key:"roof-r-value",label:h.jsxs(Zn,{Dialog:Q7o,children:[B.t("roofMenu.RoofRValue",r)," ..."]})},{key:"roof-heat-capacity",label:h.jsxs(Zn,{Dialog:Z7o,children:[B.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"roof-texture",label:h.jsxs(Zn,{Dialog:sxo,children:[B.t("word.Texture",r)," ..."]})}),(n.textureType===Yr.NoTexture||n.textureType===Yr.Default)&&e.push({key:"roof-color",label:h.jsxs(Zn,{Dialog:cxo,children:[B.t("roofMenu.RoofColor",r)," ..."]})}),e.push({key:"roof-side-color",label:h.jsxs(Zn,{Dialog:uxo,children:[B.t("roofMenu.RoofSideColor",r)," ..."]})}))),{items:e}},vxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.relativeYawAngle)??0),p=Kt(),m=R=>{a(R.target.value)},y=R=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.relativeYawAngle??0)-R)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.WindTurbine&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&Math.abs((M.relativeYawAngle??0)-R)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.relativeYawAngle??0)-R)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.relativeYawAngle)??0)-R)>Ht)return!0}return!1}},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.id===R&&!k.locked){const N=k;N.relativeYawAngle=M;break}})},x=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.foundationId===R&&!k.locked){const N=k;N.relativeYawAngle=M}})},C=R=>{e(M=>{for(const D of M.elements)if(D.type===z.WindTurbine&&!D.locked){const k=D;k.relativeYawAngle=R}})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked&&R.has(k.id)){const N=k;N.relativeYawAngle=M}})},A=R=>{if(u&&y(R)){switch(i){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.relativeYawAngle);const D={name:"Set Relative Yaw Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};r(D),P(M,R),s(l+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&M.set(k.id,k.relativeYawAngle);const D={name:"Set Relative Yaw Angle for All Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{C(D.newValue)}};r(D),C(R),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.WindTurbine&&k.foundationId===u.foundationId&&M.set(k.id,k.relativeYawAngle);const D={name:"Set Relative Yaw Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};r(D),x(u.foundationId,R),s(l+1)}break}default:{const M=o(u.id),D=M?M.relativeYawAngle:u.relativeYawAngle,k={name:"Set Wind Turbine Relative Yaw Angle",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(k.changedElementId,k.oldValue)},redo:()=>{w(k.changedElementId,k.newValue)}};r(k),w(u.id,R),s(l+1);break}}e(M=>{M.actionState.windTurbineRelativeYawAngle=R})}},S=()=>{t(!1)},v=()=>{S(),c()},b=()=>{A(d),t(!1),s(0)},T=()=>{A(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RelativeYawAngle",p),onApply:T,onClose:S,onClickCancel:v,onClickOk:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(ye.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [-180°, 180°]",h.jsx("br",{}),B.t("message.SouthFacingIsZero",p),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",p)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:m,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},bxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.numberOfBlades)??3),p=Kt(),{Option:m}=Ko,y=M=>{a(M.target.value)},w=M=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.numberOfBlades??0)-M)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.WindTurbine&&D.foundationId===(u==null?void 0:u.foundationId)&&!D.locked&&Math.abs((D.numberOfBlades??0)-M)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.numberOfBlades??0)-M)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.numberOfBlades)??0)-M)>Ht)return!0}return!1}},x=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.id===M&&!N.locked){const U=N;U.numberOfBlades=D;break}})},C=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.foundationId===M&&!N.locked){const U=N;U.numberOfBlades=D}})},P=M=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked){const N=k;N.numberOfBlades=M}})},A=(M,D)=>{H.getState().set(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&!N.locked&&M.has(N.id)){const U=N;U.numberOfBlades=D}})},S=M=>{if(u&&w(M)){switch(i){case ie.AllSelectedObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&D.set(N.id,N.numberOfBlades??3);const k={name:"Select Blade Number for Selected Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{A(k.oldValues,k.newValue)}};r(k),A(D,M),s(l+1);break}case ie.AllObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&D.set(N.id,N.numberOfBlades??3);const k={name:"Select Blade Number for All Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{P(k.newValue)}};r(k),P(M),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const D=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===u.foundationId&&D.set(N.id,N.numberOfBlades??3);const k={name:"Select Blade Number for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:D,newValue:M,groupId:u.foundationId,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{k.groupId&&C(k.groupId,k.newValue)}};r(k),C(u.foundationId,M),s(l+1)}break}default:{const D=o(u.id),k=D?D.numberOfBlades??3:u.numberOfBlades??3,N={name:"Select Wind Turbine Blade Number",timestamp:Date.now(),oldValue:k,newValue:M,changedElementId:u.id,changedElementType:u.type,undo:()=>{x(N.changedElementId,N.oldValue)},redo:()=>{x(N.changedElementId,N.newValue)}};r(N),x(u.id,M),s(l+1);break}}e(D=>{D.actionState.windTurbineNumberOfBlades=M})}},v=()=>{t(!1)},b=()=>{v(),c()},T=()=>{S(d),t(!1),s(0)},R=()=>{S(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.BladeNumber",p),onApply:R,onClose:v,onClickCancel:b,onClickOk:T,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsxs(Ko,{style:{width:"60px"},value:d,onChange:M=>{M!==null&&f(M)},children:[h.jsx(m,{value:1,children:"1"},1),h.jsx(m,{value:2,children:"2"},2),h.jsx(m,{value:3,children:"3"},3),h.jsx(m,{value:4,children:"4"},4),h.jsx(m,{value:8,children:"8"},8)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:y,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Sxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.initialRotorAngle)??0),p=Kt(),m=R=>{a(R.target.value)},y=R=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.initialRotorAngle??0)-R)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.WindTurbine&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&Math.abs((M.initialRotorAngle??0)-R)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.initialRotorAngle??0)-R)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.initialRotorAngle)??0)-R)>Ht)return!0}return!1}},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.id===R&&!k.locked){const N=k;N.initialRotorAngle=M;break}})},x=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.foundationId===R&&!k.locked){const N=k;N.initialRotorAngle=M}})},C=R=>{e(M=>{for(const D of M.elements)if(D.type===z.WindTurbine&&!D.locked){const k=D;k.initialRotorAngle=R}})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked&&R.has(k.id)){const N=k;N.initialRotorAngle=M}})},A=R=>{if(u&&y(R)){switch(i){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.initialRotorAngle);const D={name:"Set Rotor Initial Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};r(D),P(M,R),s(l+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&M.set(k.id,k.initialRotorAngle);const D={name:"Set Rotor Initial Angle for All Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{C(D.newValue)}};r(D),C(R),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.WindTurbine&&k.foundationId===u.foundationId&&M.set(k.id,k.initialRotorAngle);const D={name:"Set Rotor Initial Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};r(D),x(u.foundationId,R),s(l+1)}break}default:{const M=o(u.id),D=M?M.initialRotorAngle:u.initialRotorAngle,k={name:"Set Wind Turbine Rotor Initial Angle",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(k.changedElementId,k.oldValue)},redo:()=>{w(k.changedElementId,k.newValue)}};r(k),w(u.id,R),s(l+1);break}}e(M=>{M.actionState.windTurbineInitialRotorAngle=R})}},S=()=>{t(!1)},v=()=>{S(),c()},b=()=>{A(d),t(!1),s(0)},T=()=>{A(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RotorInitialAngle",p),onApply:T,onClose:S,onClickCancel:v,onClickOk:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:360,style:{width:120},precision:1,step:1,value:parseFloat(ye.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(ye.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0°, 360°]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:m,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Txo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ye.toRadians(10),d=ao(z.WindTurbine),[f,p]=g.useState((d==null?void 0:d.pitchAngle)??u),m=Kt(),y=M=>{a(M.target.value)},w=M=>{if(d){switch(i){case ie.AllObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.pitchAngle??u)-M)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.WindTurbine&&D.foundationId===(d==null?void 0:d.foundationId)&&!D.locked&&Math.abs((D.pitchAngle??u)-M)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.pitchAngle??u)-M)>Ht)return!0;break;default:if(Math.abs(((d==null?void 0:d.pitchAngle)??u)-M)>Ht)return!0}return!1}},x=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.id===M&&!N.locked){const U=N;U.pitchAngle=D;break}})},C=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.foundationId===M&&!N.locked){const U=N;U.pitchAngle=D}})},P=M=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked){const N=k;N.pitchAngle=M}})},A=(M,D)=>{H.getState().set(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&!N.locked&&M.has(N.id)){const U=N;U.pitchAngle=D}})},S=M=>{if(d&&w(M)){switch(i){case ie.AllSelectedObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&D.set(N.id,N.pitchAngle);const k={name:"Set Pitch Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{A(k.oldValues,k.newValue)}};r(k),A(D,M),s(l+1);break}case ie.AllObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&D.set(N.id,N.pitchAngle);const k={name:"Set Pitch Angle for All Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{P(k.newValue)}};r(k),P(M),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const D=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===d.foundationId&&D.set(N.id,N.pitchAngle);const k={name:"Set Pitch Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:D,newValue:M,groupId:d.foundationId,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{k.groupId&&C(k.groupId,k.newValue)}};r(k),C(d.foundationId,M),s(l+1)}break}default:{const D=o(d.id),k=D?D.pitchAngle:d.pitchAngle,N={name:"Set Wind Turbine Pitch Angle",timestamp:Date.now(),oldValue:k,newValue:M,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(N.changedElementId,N.oldValue)},redo:()=>{x(N.changedElementId,N.newValue)}};r(N),x(d.id,M),s(l+1);break}}e(D=>{D.actionState.windTurbinePitchAngle=M})}},v=()=>{t(!1)},b=()=>{v(),c()},T=()=>{S(f),t(!1),s(0)},R=()=>{S(f)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RotorBladePitchAngle",m),onApply:R,onClose:v,onClickCancel:b,onClickOk:T,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(f).toFixed(2)),formatter:M=>`${M}°`,onChange:M=>{M!==null&&p(ye.toRadians(M))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",m),": [-180°, 180°]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:y,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",m)})]})})})]})})},Pxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.bladeRadius)??0),p=g.useRef(!1),m=g.useRef(),y=Kt(),w=k=>{a(k.target.value)},x=k=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-k)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.bladeRadius-k)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-k)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.bladeRadius)-k)>Ht)return!0}return!1}},C=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===k&&!W.locked){const F=W;F.bladeRadius=N,F.lx=F.ly=N*2,F.lz=F.towerHeight+N;break}})},P=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===k&&!W.locked){const F=W;F.bladeRadius=N,F.lx=F.ly=N*2,F.lz=F.towerHeight+N}})},A=k=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.bladeRadius=k,W.lx=W.ly=k*2,W.lz=W.towerHeight+k}})},S=(k,N)=>{H.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&k.has(W.id)){const F=W;F.bladeRadius=N,F.lx=F.ly=N*2,F.lz=F.towerHeight+N}})},v=k=>{if(u&&x(k)){switch(m.current=void 0,i){case ie.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&N.towerHeight{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{S(U.oldValues,U.newValue)}};r(U),S(N,k),s(l+1)}break}case ie.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.towerHeight{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{A(U.newValue)}};r(U),A(k),s(l+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.towerHeight{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,k),s(l+1)}}break}default:{const N=o(u.id),U=N?N.bladeRadius:u.bladeRadius;if(p.current=u.towerHeight{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,k),s(l+1)}break}}e(N=>{N.actionState.windTurbineBladeRadius=k})}},b=()=>{p.current=!1,t(!1)},T=()=>{b(),c()},R=()=>{v(d),p.current||(t(!1),s(0))},M=()=>{v(d)},D=p.current?": "+B.t("message.NotApplicableToSelectedAction",y)+(m.current!==void 0?" ("+m.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RotorBladeRadius",y),rejectedMessage:D,onApply:M,onClose:b,onClickCancel:T,onClickOk:R,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:k=>{k!==null&&f(k)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [1, 100] ",B.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",y)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",y)})]})})})]})})},Cxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.bladeRootRadius)??.3),[p,m]=g.useState((u==null?void 0:u.maximumChordLength)??1),[y,w]=g.useState((u==null?void 0:u.maximumChordRadius)??3),x=g.useRef(null),C=Kt(),P=555;g.useEffect(()=>{if(!x.current||!u)return;const q=x.current.getContext("2d");if(!q)return;const ae=x.current.width,Z=x.current.height,ne=20,te=Z*.7;q.clearRect(0,0,ae,Z),q.setLineDash([]),q.strokeStyle="gray",q.lineWidth=1,q.rect(0,0,ae,Z),q.stroke();const $=(ae-ne*2)/u.bladeRadius,le=$*u.bladeTipWidth,de=$*y,he=$*p,me=$*u.bladeRadius,ce=$*d,Pe=he-ce,pe=me-de/3,Ie=[];Ie.push(new _t(ne,te-ce)),Ie.push(new _t(ne+me-pe,te-Pe/2)),Ie.push(new _t(ne+de,te-Pe)),Ie.push(new _t(ne+me,te+ce-le));const ze=new jq(Ie).getPoints(50);q.beginPath(),q.moveTo(ze[0].x,ze[0].y);for(let Ae=1;Ae{a(q.target.value)},S=q=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.bladeRootRadius-q)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const ae of n)if(ae.type===z.WindTurbine&&ae.foundationId===(u==null?void 0:u.foundationId)&&!ae.locked&&Math.abs(ae.bladeRootRadius-q)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.bladeRootRadius-q)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.bladeRootRadius)??.3)-q)>Ht)return!0}return!1}},v=(q,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.id===q&&!ne.locked){const te=ne;te.bladeRootRadius=ae;break}})},b=(q,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.foundationId===q&&!ne.locked){const te=ne;te.bladeRootRadius=ae}})},T=q=>{e(ae=>{for(const Z of ae.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ne=Z;ne.bladeRootRadius=q}})},R=(q,ae)=>{H.getState().set(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&!ne.locked&&q.has(ne.id)){const te=ne;te.bladeRootRadius=ae}})},M=q=>{if(u&&S(q)){switch(i){case ie.AllSelectedObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(ne.id)&&ae.set(ne.id,ne.bladeRootRadius);const Z={name:"Set Root Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:q,undo:()=>{for(const[ne,te]of Z.oldValues.entries())v(ne,te)},redo:()=>{R(Z.oldValues,Z.newValue)}};r(Z),R(ae,q),s(l+1);break}case ie.AllObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ae.set(ne.id,ne.bladeRootRadius);const Z={name:"Set Root Radius for All Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:q,undo:()=>{for(const[ne,te]of Z.oldValues.entries())v(ne,te)},redo:()=>{T(Z.newValue)}};r(Z),T(q),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ne.foundationId===u.foundationId&&ae.set(ne.id,ne.bladeRootRadius);const Z={name:"Set Root Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:ae,newValue:q,groupId:u.foundationId,undo:()=>{for(const[ne,te]of Z.oldValues.entries())v(ne,te)},redo:()=>{Z.groupId&&b(Z.groupId,Z.newValue)}};r(Z),b(u.foundationId,q),s(l+1)}break}default:{const ae=o(u.id),Z=ae?ae.bladeRootRadius:u.bladeRootRadius,ne={name:"Set Wind Turbine Root Radius",timestamp:Date.now(),oldValue:Z,newValue:q,changedElementId:u.id,changedElementType:u.type,undo:()=>{v(ne.changedElementId,ne.oldValue)},redo:()=>{v(ne.changedElementId,ne.newValue)}};r(ne),v(u.id,q),s(l+1);break}}e(ae=>{ae.actionState.windTurbineBladeRootRadius=q})}},D=q=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordLength-q)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const ae of n)if(ae.type===z.WindTurbine&&ae.foundationId===(u==null?void 0:u.foundationId)&&!ae.locked&&Math.abs(ae.maximumChordLength-q)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordLength-q)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordLength)-q)>Ht)return!0}return!1}},k=(q,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.id===q&&!ne.locked){const te=ne;te.maximumChordLength=ae;break}})},N=(q,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.foundationId===q&&!ne.locked){const te=ne;te.maximumChordLength=ae}})},U=q=>{e(ae=>{for(const Z of ae.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ne=Z;ne.maximumChordLength=q}})},W=(q,ae)=>{H.getState().set(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&!ne.locked&&q.has(ne.id)){const te=ne;te.maximumChordLength=ae}})},F=q=>{if(u&&D(q)){switch(i){case ie.AllSelectedObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(ne.id)&&ae.set(ne.id,ne.maximumChordLength);const Z={name:"Set Chord Length for Selected Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:q,undo:()=>{for(const[ne,te]of Z.oldValues.entries())k(ne,te)},redo:()=>{W(Z.oldValues,Z.newValue)}};r(Z),W(ae,q),s(l+1);break}case ie.AllObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ae.set(ne.id,ne.maximumChordLength);const Z={name:"Set Chord Length for All Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:q,undo:()=>{for(const[ne,te]of Z.oldValues.entries())k(ne,te)},redo:()=>{U(Z.newValue)}};r(Z),U(q),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ne.foundationId===u.foundationId&&ae.set(ne.id,ne.maximumChordLength);const Z={name:"Set Chord Length for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:ae,newValue:q,groupId:u.foundationId,undo:()=>{for(const[ne,te]of Z.oldValues.entries())k(ne,te)},redo:()=>{Z.groupId&&N(Z.groupId,Z.newValue)}};r(Z),N(u.foundationId,q),s(l+1)}break}default:{const ae=o(u.id),Z=ae?ae.maximumChordLength:u.maximumChordLength,ne={name:"Set Wind Turbine Chord Length",timestamp:Date.now(),oldValue:Z,newValue:q,changedElementId:u.id,changedElementType:u.type,undo:()=>{k(ne.changedElementId,ne.oldValue)},redo:()=>{k(ne.changedElementId,ne.newValue)}};r(ne),k(u.id,q),s(l+1);break}}e(ae=>{ae.actionState.windTurbineBladeMaximumChordLength=q})}},E=q=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordRadius-q)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const ae of n)if(ae.type===z.WindTurbine&&ae.foundationId===(u==null?void 0:u.foundationId)&&!ae.locked&&Math.abs(ae.maximumChordRadius-q)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordRadius-q)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordRadius)-q)>Ht)return!0}return!1}},L=(q,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.id===q&&!ne.locked){const te=ne;te.maximumChordRadius=ae;break}})},j=(q,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.foundationId===q&&!ne.locked){const te=ne;te.maximumChordRadius=ae}})},Y=q=>{e(ae=>{for(const Z of ae.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ne=Z;ne.maximumChordRadius=q}})},O=(q,ae)=>{H.getState().set(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&!ne.locked&&q.has(ne.id)){const te=ne;te.maximumChordRadius=ae}})},_=q=>{if(u&&E(q)){switch(i){case ie.AllSelectedObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(ne.id)&&ae.set(ne.id,ne.maximumChordRadius);const Z={name:"Set Chord Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:q,undo:()=>{for(const[ne,te]of Z.oldValues.entries())L(ne,te)},redo:()=>{O(Z.oldValues,Z.newValue)}};r(Z),O(ae,q),s(l+1);break}case ie.AllObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ae.set(ne.id,ne.maximumChordRadius);const Z={name:"Set Chord Radius for All Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:q,undo:()=>{for(const[ne,te]of Z.oldValues.entries())L(ne,te)},redo:()=>{Y(Z.newValue)}};r(Z),Y(q),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ne.foundationId===u.foundationId&&ae.set(ne.id,ne.maximumChordRadius);const Z={name:"Set Chord Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:ae,newValue:q,groupId:u.foundationId,undo:()=>{for(const[ne,te]of Z.oldValues.entries())L(ne,te)},redo:()=>{Z.groupId&&j(Z.groupId,Z.newValue)}};r(Z),j(u.foundationId,q),s(l+1)}break}default:{const ae=o(u.id),Z=ae?ae.maximumChordRadius:u.maximumChordRadius,ne={name:"Set Wind Turbine Chord Radius",timestamp:Date.now(),oldValue:Z,newValue:q,changedElementId:u.id,changedElementType:u.type,undo:()=>{L(ne.changedElementId,ne.oldValue)},redo:()=>{L(ne.changedElementId,ne.newValue)}};r(ne),L(u.id,q),s(l+1);break}}e(ae=>{ae.actionState.windTurbineBladeMaximumChordRadius=q})}},G=()=>{t(!1)},Q=()=>{G(),c()},oe=()=>{F(p),_(y),M(d),t(!1),s(0)},ee=()=>{F(p),_(y),M(d)};return h.jsxs(ro,{width:600,title:B.t("windTurbineMenu.RotorBladeDesign",C),onApply:ee,onClose:G,onClickCancel:Q,onClickOk:oe,children:[h.jsx(Qt,{children:h.jsx(Ge,{span:24,children:h.jsx("canvas",{ref:x,id:"blade-design-canvas",width:P,height:P*.25,style:{paddingBottom:"12px"}})})}),h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ge,{style:{textAlign:"center",fontStyle:"italic"},children:"A: "}),h.jsx(Ge,{children:h.jsx(mn,{min:.1,max:1,style:{width:"70px"},step:.01,precision:2,value:d,onChange:q=>{q&&f(q)}})}),h.jsxs(Ge,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.1, 1] ",B.t("word.MeterAbbreviation",C)]})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ge,{style:{textAlign:"center",fontStyle:"italic"},children:"C: "}),h.jsx(Ge,{children:h.jsx(mn,{min:.5,max:2,style:{width:"70px"},step:.01,precision:2,value:p,onChange:q=>{q&&m(q)}})}),h.jsxs(Ge,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.5, 2] ",B.t("word.MeterAbbreviation",C)]})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{style:{textAlign:"center",fontStyle:"italic"},children:"D:"}),h.jsx(Ge,{children:h.jsx(mn,{min:2,max:((u==null?void 0:u.bladeRadius)??10)/2,style:{width:70},step:.01,precision:2,value:y,onChange:q=>{q&&w(q)}})}),h.jsxs(Ge,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[2, ",((u==null?void 0:u.bladeRadius)??10)/2,"] ",B.t("word.MeterAbbreviation",C)]})]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",C)})]})})})]})]})},Rxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.hubRadius)??0),[p,m]=g.useState((u==null?void 0:u.hubLength)??0),y=Kt(),w=D=>{a(D.target.value)},x=(D,k)=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-D)>Ht||Math.abs(U.hubLength-k)>Ht)return!0}break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked){const U=N;if(Math.abs(U.hubRadius-D)>Ht||Math.abs(U.hubLength-k)>Ht)return!0}break;case ie.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-D)>Ht||Math.abs(U.hubLength-k)>Ht)return!0}break;default:if(Math.abs((u==null?void 0:u.hubRadius)-D)>Ht||Math.abs((u==null?void 0:u.hubLength)-k)>Ht)return!0}return!1}},C=(D,k)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.id===D&&!U.locked){const W=U;W.hubRadius=k[0],W.hubLength=k[1];break}})},P=(D,k)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.foundationId===D&&!U.locked){const W=U;W.hubRadius=k[0],W.hubLength=k[1]}})},A=D=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&!N.locked){const U=N;U.hubRadius=D[0],U.hubLength=D[1]}})},S=(D,k)=>{H.getState().set(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked&&D.has(U.id)){const W=U;W.hubRadius=k[0],W.hubLength=k[1]}})},v=D=>{if(u&&x(D[0],D[1])){switch(i){case ie.AllSelectedObjectsOfThisType:{const k=new Map;for(const U of n)if(U.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(U.id)){const W=U;k.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for Selected Wind Turbines",timestamp:Date.now(),oldValues:k,newValue:D,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{S(N.oldValues,N.newValue)}};r(N),S(k,D),s(l+1);break}case ie.AllObjectsOfThisType:{const k=new Map;for(const U of n)if(U.type===z.WindTurbine){const W=U;k.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines",timestamp:Date.now(),oldValues:k,newValue:D,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{A(N.newValue)}};r(N),A(D),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const k=new Map;for(const U of n)if(U.type===z.WindTurbine&&U.foundationId===u.foundationId){const W=U;k.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:k,newValue:D,groupId:u.foundationId,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{N.groupId&&P(N.groupId,N.newValue)}};r(N),P(u.foundationId,D),s(l+1)}break}default:{const k=o(u.id),N=k?k.hubRadius:u.hubRadius,U=k?k.hubLength:u.hubLength,W={name:"Set Wind Turbine Hub Parameters",timestamp:Date.now(),oldValue:[N,U],newValue:D,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,D),s(l+1);break}}e(k=>{k.actionState.windTurbineHubRadius=D[0],k.actionState.windTurbineHubLength=D[1]})}},b=()=>{t(!1)},T=()=>{b(),c()},R=()=>{v([d,p]),t(!1),s(0)},M=()=>{v([d,p])};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.HubDesign",y),onApply:M,onClose:b,onClickCancel:T,onClickOk:R,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx("div",{style:{marginTop:"-20px",textAlign:"left",fontSize:"12px"},children:B.t("windTurbineMenu.HubRadius",y)}),h.jsx(mn,{min:.5,max:5,style:{width:120},step:.01,precision:2,value:d,onChange:D=>{D!==null&&f(D)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0.5, 5] ",B.t("word.MeterAbbreviation",y)]}),h.jsx("div",{style:{paddingTop:"10px",textAlign:"left",fontSize:"12px"},children:B.t("windTurbineMenu.HubLength",y)}),h.jsx(mn,{min:1,max:10,style:{width:120},step:.01,precision:2,value:p,onChange:D=>{D!==null&&m(D)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [1, 10] ",B.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",y)})]})})})]})})},Hxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.birdSafe)??wc.None),[p,m]=g.useState((u==null?void 0:u.bladeColor)??j9),[y,w]=g.useState((u==null?void 0:u.stripeColor)??B9),x=Kt(),{Option:C}=Ko,P=U=>{a(U.target.value)},A=(U,W,F)=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const E of n)if(E.type===z.WindTurbine&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)){const L=E;if((L.birdSafe??wc.None)!==U||(L.bladeColor??j9)!==W||(L.stripeColor??B9)!==F)return!0}break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const E of n)if(E.type===z.WindTurbine&&E.foundationId===(u==null?void 0:u.foundationId)&&!E.locked){const L=E;if((L.birdSafe??wc.None)!==U||(L.bladeColor??j9)!==W||(L.stripeColor??B9)!==F)return!0}break;case ie.AllSelectedObjectsOfThisType:for(const E of n)if(E.type===z.WindTurbine&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)){const L=E;if((L.birdSafe??wc.None)!==U||(L.bladeColor??j9)!==W||(L.stripeColor??B9)!==F)return!0}break;default:if((u.birdSafe??wc.None)!==U||(u.bladeColor??j9)!==W||(u.stripeColor??B9)!==F)return!0}return!1}},S=(U,W,F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.id===U&&!j.locked){const Y=j;Y.birdSafe=W,Y.bladeColor=F,Y.stripeColor=E;break}})},v=(U,W,F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.foundationId===U&&!j.locked){const Y=j;Y.birdSafe=W,Y.bladeColor=F,Y.stripeColor=E}})},b=(U,W,F)=>{e(E=>{for(const L of E.elements)if(L.type===z.WindTurbine&&!L.locked){const j=L;j.birdSafe=U,j.bladeColor=W,j.stripeColor=F}})},T=(U,W,F,E)=>{H.getState().set(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&!j.locked&&U.has(j.id)){const Y=j;Y.birdSafe=W,Y.bladeColor=F,Y.stripeColor=E}})},R=(U,W,F)=>{if(u&&A(U,W,F)){switch(i){case ie.AllSelectedObjectsOfThisType:{const E=new Map;for(const j of n)if(j.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(j.id)){const Y=j;E.set(j.id,[(Y.birdSafe??wc.None).toString(),Y.bladeColor,Y.stripeColor])}const L={name:"Select Bird-Safe Design for Selected Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:[U.toString(),W,F],undo:()=>{for(const[j,Y]of L.oldValues.entries()){const O=Y;S(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;T(L.oldValues,Number(j[0]),j[1],j[2])}};r(L),T(E,U,W,F),s(l+1);break}case ie.AllObjectsOfThisType:{const E=new Map;for(const j of n)if(j.type===z.WindTurbine){const Y=j;E.set(j.id,[(Y.birdSafe??wc.None).toString(),Y.bladeColor,Y.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:[U.toString(),W,F],undo:()=>{for(const[j,Y]of L.oldValues.entries()){const O=Y;S(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;b(Number(j[0]),j[1],j[2])}};r(L),b(U,W,F),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const E=new Map;for(const j of n)if(j.type===z.WindTurbine&&j.foundationId===u.foundationId){const Y=j;E.set(j.id,[(Y.birdSafe??wc.None).toString(),Y.bladeColor,Y.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:E,newValue:[U.toString(),W,F],groupId:u.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries()){const O=Y;S(j,Number(O[0]),O[1],O[2])}},redo:()=>{if(L.groupId){const j=L.newValue;v(L.groupId,Number(j[0]),j[1],j[2])}}};r(L),v(u.foundationId,U,W,F),s(l+1)}break}default:{const E=o(u.id),L=E?E.birdSafe??wc.None:u.birdSafe??wc.None,j=E?E.bladeColor??j9:u.bladeColor??j9,Y=E?E.stripeColor??B9:u.stripeColor??B9,O=[L.toString(),j,Y],_={name:"Select Bird-Safe Design for Wind Turbine",timestamp:Date.now(),oldValue:O,newValue:[U.toString(),W,F],changedElementId:u.id,changedElementType:u.type,undo:()=>{const G=_.oldValue;S(_.changedElementId,Number(G[0]),G[1],G[2])},redo:()=>{S(_.changedElementId,U,W,F)}};r(_),S(u.id,U,W,F),s(l+1);break}}e(E=>{E.actionState.windTurbineBirdSafeDesign=U,E.actionState.windTurbineBladeColor=W,E.actionState.windTurbineStripeColor=F})}},M=()=>{t(!1)},D=()=>{M(),c()},k=()=>{R(d,p,y),t(!1),s(0)},N=()=>{R(d,p,y)};return h.jsx(ro,{width:600,title:B.t("windTurbineMenu.BirdSafeDesign",x),onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsxs("span",{children:[B.t("word.Pattern",x),": "]}),h.jsxs(Ko,{style:{width:"116px"},value:d,onChange:U=>{U!==null&&f(U)},children:[h.jsx(C,{value:wc.None,children:B.t("windTurbineMenu.BirdSafeNone",x)},wc.None),h.jsx(C,{value:wc.Bicolor,children:B.t("windTurbineMenu.BirdSafeBicolor",x)},wc.Bicolor),h.jsx(C,{value:wc.Striped,children:B.t("windTurbineMenu.BirdSafeStriped",x)},wc.Striped)]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[B.t("word.Color",x)," 1: "]}),h.jsx("input",{type:"color",value:p,onChange:U=>{m(U.target.value)}})]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[B.t("word.Color",x)," 2: "]}),h.jsx("input",{type:"color",value:y,onChange:U=>{w(U.target.value)}})]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:P,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",x)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",x)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",x)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",x)})]})})})]})})},Mxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.towerHeight)??0),p=g.useRef(!1),m=g.useRef(),y=Kt(),w=k=>{a(k.target.value)},x=k=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-k)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.towerHeight-k)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-k)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.towerHeight)-k)>Ht)return!0}return!1}},C=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===k&&!W.locked){const F=W;F.towerHeight=N,F.lz=N+F.bladeRadius;break}})},P=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===k&&!W.locked){const F=W;F.towerHeight=N,F.lz=N+F.bladeRadius}})},A=k=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.towerHeight=k,W.lz=k+W.bladeRadius}})},S=(k,N)=>{H.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&k.has(W.id)){const F=W;F.towerHeight=N,F.lz=N+F.bladeRadius}})},v=k=>{if(u&&x(k)){switch(m.current=void 0,i){case ie.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&N.bladeRadius>k){p.current=!0;break}if(p.current)m.current=k,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(W.id)&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for Selected Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:k,undo:()=>{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{S(U.oldValues,U.newValue)}};r(U),S(N,k),s(l+1)}break}case ie.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.bladeRadius>k){p.current=!0;break}if(p.current)m.current=k,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:k,undo:()=>{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{A(U.newValue)}};r(U),A(k),s(l+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.bladeRadius>k){p.current=!0;break}if(p.current)m.current=k,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&W.foundationId===u.foundationId&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:N,newValue:k,groupId:u.foundationId,undo:()=>{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,k),s(l+1)}}break}default:{const N=o(u.id),U=N?N.towerHeight:u.towerHeight;if(p.current=u.bladeRadius>k,p.current)m.current=k,f(U);else{const W={name:"Set Wind Turbine Tower Height",timestamp:Date.now(),oldValue:U,newValue:k,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,k),s(l+1)}break}}e(N=>{N.actionState.windTurbineTowerHeight=k})}},b=()=>{p.current=!1,t(!1)},T=()=>{b(),c()},R=()=>{v(d),p.current||(t(!1),s(0))},M=()=>{v(d)},D=p.current?": "+B.t("message.NotApplicableToSelectedAction",y)+(m.current!==void 0?" ("+m.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.TowerHeight",y),rejectedMessage:D,onApply:M,onClose:b,onClickCancel:T,onClickOk:R,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:k=>{k!==null&&f(k)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [1, 100] ",B.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",y)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",y)})]})})})]})})},Ixo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.towerRadius)??0),p=Kt(),m=R=>{a(R.target.value)},y=R=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs(M.towerRadius-R)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.WindTurbine&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&Math.abs(M.towerRadius-R)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs(M.towerRadius-R)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.towerRadius)-R)>Ht)return!0}return!1}},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.id===R&&!k.locked){const N=k;N.towerRadius=M;break}})},x=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.foundationId===R&&!k.locked){const N=k;N.towerRadius=M}})},C=R=>{e(M=>{for(const D of M.elements)if(D.type===z.WindTurbine&&!D.locked){const k=D;k.towerRadius=R}})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked&&R.has(k.id)){const N=k;N.towerRadius=M}})},A=R=>{if(u&&y(R)){switch(i){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.towerRadius);const D={name:"Set Tower Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};r(D),P(M,R),s(l+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&M.set(k.id,k.towerRadius);const D={name:"Set Tower Radius for All Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{C(D.newValue)}};r(D),C(R),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.WindTurbine&&k.foundationId===u.foundationId&&M.set(k.id,k.towerRadius);const D={name:"Set Tower Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};r(D),x(u.foundationId,R),s(l+1)}break}default:{const M=o(u.id),D=M?M.towerRadius:u.towerRadius,k={name:"Set Wind Turbine Tower Radius",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(k.changedElementId,k.oldValue)},redo:()=>{w(k.changedElementId,k.newValue)}};r(k),w(u.id,R),s(l+1);break}}e(M=>{M.actionState.windTurbineTowerRadius=R})}},S=()=>{t(!1)},v=()=>{S(),c()},b=()=>{A(d),t(!1),s(0)},T=()=>{A(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.TowerRadius",p),onApply:T,onClose:S,onClickCancel:v,onClickOk:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:d,onChange:R=>{R!==null&&f(R)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.1, 2] ",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:m,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},zxo=t=>{const e=[];if(t.type!==z.WindTurbine)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"wind-turbine-copy",label:h.jsx(ad,{})}),r&&e.push({key:"wind-turbine-cut",label:h.jsx(ld,{})}),e.push({key:"wind-turbine-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"wind-turbine-relative-yaw-angle",label:h.jsxs(Zn,{Dialog:vxo,children:[B.t("windTurbineMenu.RelativeYawAngle",o)," ..."]})},{key:"wind-turbine-rotor-submenu",label:h.jsx(ln,{children:B.t("windTurbineMenu.Rotor",o)}),children:[{key:"wind-turbine-rotor-blade-number",label:h.jsxs(Zn,{noPadding:!0,Dialog:bxo,children:[B.t("windTurbineMenu.BladeNumber",o)," ..."]})},{key:"wind-turbine-rotor-initial-angle",label:h.jsxs(Zn,{noPadding:!0,Dialog:Sxo,children:[B.t("windTurbineMenu.RotorInitialAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-pitch-angle",label:h.jsxs(Zn,{noPadding:!0,Dialog:Txo,children:[B.t("windTurbineMenu.RotorBladePitchAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:Pxo,children:[B.t("windTurbineMenu.RotorBladeRadius",o)," ..."]})},{key:"wind-turbine-rotor-blade-design",label:h.jsxs(Zn,{noPadding:!0,Dialog:Cxo,children:[B.t("windTurbineMenu.RotorBladeDesign",o)," ..."]})},{key:"wind-turbine-hub-design",label:h.jsxs(Zn,{noPadding:!0,Dialog:Rxo,children:[B.t("windTurbineMenu.HubDesign",o)," ..."]})},{key:"wind-turbine-bird-safe-blade",label:h.jsxs(Zn,{noPadding:!0,Dialog:Hxo,children:[B.t("windTurbineMenu.BirdSafeDesign",o)," ..."]})}]},{key:"wind-turbine-tower-submenu",label:h.jsx(ln,{children:B.t("windTurbineMenu.Tower",o)}),children:[{key:"wind-turbine-tower-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:Mxo,children:[B.t("windTurbineMenu.TowerHeight",o)," ..."]})},{key:"wind-turbine-tower-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:Ixo,children:[B.t("windTurbineMenu.TowerRadius",o)," ..."]})}]},{key:"wind-turbine-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},Dxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(p5e),l=H(g5e),s=H(no),c=H(qn),u=H(Ji),d=ao(z.SolarWaterHeater),[f,p]=g.useState((d==null?void 0:d.lx)??1),m=g.useRef(!1),y=g.useRef(),w=Kt(),x=(F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===F&&!j.locked){j.lx=E;break}})},C=(F,E)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===F&&!j.locked&&(j.lx=E)})},P=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarWaterHeater&&!Y.locked){let O;E?O=Y.parentId===F&&ye.isIdentical(Y.normal,E):O=Y.parentId===F,O&&(Y.lx=L)}})},A=F=>{e(E=>{for(const L of E.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lx=F)})},S=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&F.has(j.id)&&(j.lx=E)})},v=F=>{l(F.target.value)},b=(F,E)=>{const L=r(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.lx=E,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},T=(F,E)=>!b(F,E),R=F=>{if(d){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(E.lx-F)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&Math.abs(E.lx-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const E of n)if(E.type===z.SolarWaterHeater&&E.foundationId===(d==null?void 0:d.foundationId)&&!E.locked&&Math.abs(E.lx-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lx-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lx-F)>Ht)return!0}break}default:{if(Math.abs((d==null?void 0:d.lx)-F)>Ht)return!0;break}}return!1}},M=F=>{if(d&&R(F))switch(y.current=void 0,a){case ie.AllSelectedObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.lx);const L={name:"Set Length for Selected Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{S(L.oldValues,L.newValue)}};i(L),S(E,F),c(s+1)}break}case ie.AllObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.lx);const L={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{A(L.newValue)}};i(L),A(F),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&E.foundationId===d.foundationId&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&E.set(j.id,j.lx);const L={name:"Set Length for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:d.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,F),c(s+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(m.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&T(j,F)){m.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&T(j,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&ye.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lx);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lx);const O=Y?d.normal:void 0,_={name:"Set Length for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:d.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())x(G,Q)},redo:()=>{_.groupId&&P(_.groupId,_.normal,_.newValue)}};i(_),P(d.parentId,O,F),c(s+1)}}break}default:{const E=o(d.id),L=E?E.lx:d.lx;if(m.current=T(d,F),m.current)y.current=F,p(L);else{const j={name:"Set Water Heater Length",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(j.changedElementId,j.oldValue)},redo:()=>{x(j.changedElementId,j.newValue)}};i(j),x(d.id,F),c(s+1)}break}}},D=()=>{m.current=!1,t(!1)},k=()=>{D(),u()},N=()=>{M(f),m.current||(t(!1),c(0))},U=()=>{M(f)},W=m.current?": "+B.t("message.NotApplicableToSelectedAction",w)+(y.current!==void 0?" ("+y.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",w),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:6,children:h.jsx(mn,{min:0,max:100,step:.1,style:{width:120},precision:2,value:f,onChange:F=>{F!==null&&p(F)}})}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:v,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",w)})]})})})]})})},Exo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=H(Ji),d=ao(z.SolarWaterHeater),[f,p]=g.useState(0),[m,y]=g.useState((d==null?void 0:d.ly)??1),w=g.useRef(!1),x=g.useRef(),C=Kt();g.useEffect(()=>{d&&p(Number((d.lz-.3).toFixed(2)))},[d]);const P=(L,j)=>{e(Y=>{for(const O of Y.elements)if(O.type===z.SolarWaterHeater&&O.id===L&&!O.locked){O.ly=j;break}})},A=(L,j)=>{e(Y=>{for(const O of Y.elements)O.type===z.SolarWaterHeater&&O.foundationId===L&&!O.locked&&(O.ly=j)})},S=(L,j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarWaterHeater&&!_.locked){let G;j?G=_.parentId===L&&ye.isIdentical(_.normal,j):G=_.parentId===L,G&&(_.ly=Y)}})},v=L=>{e(j=>{for(const Y of j.elements)Y.type===z.SolarWaterHeater&&!Y.locked&&(Y.ly=L)})},b=(L,j)=>{H.getState().set(Y=>{for(const O of Y.elements)O.type===z.SolarWaterHeater&&!O.locked&&L.has(O.id)&&(O.ly=j)})},T=L=>{l(L.target.value)},R=(L,j)=>{const Y=r(L);if(Y){if(Y.type===z.Cuboid&&!ye.isIdentical(L.normal,fs))return!0;const O=JSON.parse(JSON.stringify(L));return O.ly=j,Y.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(O,Y)}return!1},M=(L,j)=>!R(L,j),D=L=>{if(d){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.ly-L)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&Math.abs(j.ly-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const j of n)if(j.type===z.SolarWaterHeater&&j.foundationId===(d==null?void 0:d.foundationId)&&!j.locked&&Math.abs(j.ly-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&ye.isIdentical(O.normal,d.normal)&&!O.locked&&Math.abs(O.ly-L)>Ht)return!0}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&Math.abs(O.ly-L)>Ht)return!0}break}default:{if(Math.abs((d==null?void 0:d.ly)-L)>Ht)return!0;break}}return!1}},k=L=>{if(d&&D(L))switch(x.current=void 0,a){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&M(j,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&H.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.ly);const Y={name:"Set Width for Selected Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())P(O,_)},redo:()=>{b(Y.oldValues,Y.newValue)}};i(Y),b(j,L),c(s+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&M(j,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&j.set(O.id,O.ly);const Y={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())P(O,_)},redo:()=>{v(Y.newValue)}};i(Y),v(L),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){w.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.foundationId===d.foundationId&&M(j,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&O.foundationId===d.foundationId&&j.set(O.id,O.ly);const Y={name:"Set Width for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:d.foundationId,undo:()=>{for(const[O,_]of Y.oldValues.entries())P(O,_)},redo:()=>{Y.groupId&&A(Y.groupId,Y.newValue)}};i(Y),A(d.foundationId,L),c(s+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(w.current=!1,j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&ye.isIdentical(O.normal,d.normal)&&!O.locked&&M(O,L)){w.current=!0;break}}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&M(O,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const O=new Map,_=j.type===z.Cuboid;if(_)for(const oe of n)oe.type===z.SolarWaterHeater&&oe.parentId===d.parentId&&ye.isIdentical(oe.normal,d.normal)&&!oe.locked&&O.set(oe.id,oe.ly);else for(const oe of n)oe.type===z.SolarWaterHeater&&oe.parentId===d.parentId&&!oe.locked&&O.set(oe.id,oe.ly);const G=_?d.normal:void 0,Q={name:"Set Width for All Water Heater on Surface",timestamp:Date.now(),oldValues:O,newValue:L,groupId:d.parentId,normal:G,undo:()=>{for(const[oe,ee]of Q.oldValues.entries())P(oe,ee)},redo:()=>{Q.groupId&&S(Q.groupId,Q.normal,Q.newValue)}};i(Q),S(d.parentId,G,L),c(s+1)}}break}default:{const j=o(d.id),Y=j?j.ly:d.ly;if(w.current=M(d,L),w.current)x.current=L,y(Y);else{const O={name:"Set Water Heater Width",timestamp:Date.now(),oldValue:Y,newValue:L,changedElementId:d.id,changedElementType:d.type,undo:()=>{P(O.changedElementId,O.oldValue)},redo:()=>{P(O.changedElementId,O.newValue)}};i(O),P(d.id,L),c(s+1)}break}}},N=()=>{w.current=!1,t(!1)},U=()=>{N(),u()},W=()=>{k(m),w.current||(t(!1),c(0))},F=()=>{k(m)},E=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current!==void 0?" ("+x.current.toFixed(2)+")":""):null;return console.log("min",f),h.jsx(ro,{width:550,title:B.t("word.Width",C),rejectedMessage:E,onApply:F,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:6,children:h.jsx(mn,{min:f,max:100,step:.1,style:{width:120},precision:2,value:m,onChange:L=>{L!==null&&y(L)}})}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",C)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:T,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",C)})]})})})]})})},kxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(yQ),i=H(AXe),a=H(wXe),l=H(xXe),s=H($r),c=H(Fn),u=H(p5e),d=H(g5e),f=H(no),p=H(qn),m=H(Ji),y=ao(z.SolarWaterHeater),w=g.useRef(!1),x=g.useRef(),[C,P]=g.useState(y?-y.relativeAzimuth:0),A=Kt(),S=F=>{d(F.target.value)},v=(F,E)=>{const L=s(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.relativeAzimuth=-E,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(F,E)=>!v(F,E),T=F=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const E of n)if(E.type===z.SolarWaterHeater&&E.foundationId===(y==null?void 0:y.foundationId)&&!E.locked&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:if(y!=null&&y.parentId){const E=s(y);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===y.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}}break;default:if(Math.abs(-(y==null?void 0:y.relativeAzimuth)-F)>Ht)return!0}return!1}},R=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&!j.locked&&F.has(j.id)){const Y=j;Y.relativeAzimuth=E}})},M=F=>{if(y&&T(F)){switch(x.current=void 0,u){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(E,-F),p(f+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{l(z.SolarWaterHeater,-L.newValue)}};c(L),l(z.SolarWaterHeater,-F),p(f+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(y.foundationId){w.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&E.foundationId===y.foundationId&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===y.foundationId&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:y.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{L.groupId&&a(z.SolarWaterHeater,L.groupId,-L.newValue)}};c(L),a(z.SolarWaterHeater,y.foundationId,-F),p(f+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{if(y.parentId){const E=s(y);if(E){if(w.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&b(j,F)){w.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===y.parentId&&b(j,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===y.parentId&&ye.isIdentical(G.normal,y.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===y.parentId&&j.set(G.id,-G.relativeAzimuth);const O=Y?y.normal:void 0,_={name:"Set Relative Azimuth for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:y.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())r(G,-Q)},redo:()=>{_.groupId&&i(z.SolarWaterHeater,_.groupId,_.normal,-_.newValue)}};c(_),i(z.SolarWaterHeater,y.parentId,O,-F),p(f+1)}}}break}default:{const E=o(y.id),L=E?-E.relativeAzimuth:-y.relativeAzimuth;if(w.current=b(y,F),w.current)x.current=F,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:y.id,changedElementType:y.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(y.id,-F),p(f+1)}break}}e(E=>{E.actionState.solarWaterHeaterRelativeAzimuth=-F})}},D=()=>{w.current=!1,t(!1)},k=()=>{D(),m()},N=()=>{M(C),w.current||(t(!1),p(0))},U=()=>{M(C)},W=w.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(x.current!==void 0?" ("+ye.toDegrees(x.current).toFixed(1)+"°)":null):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeAzimuth",A),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(C).toFixed(2)),formatter:F=>`${F}°`,onChange:F=>{F!==null&&P(ye.toRadians(F))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",A),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",A)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(We.Group,{onChange:S,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",A)})]})})})]})})},Fxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(p5e),l=H(g5e),s=H(no),c=H(qn),u=H(Ji),d=ao(z.SolarWaterHeater),[f,p]=g.useState((d==null?void 0:d.lz)??1),m=g.useRef(!1),y=g.useRef(),w=Kt(),x=(F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===F&&!j.locked){j.lz=E;break}})},C=(F,E)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===F&&!j.locked&&(j.lz=E)})},P=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarWaterHeater&&!Y.locked){let O;E?O=Y.parentId===F&&ye.isIdentical(Y.normal,E):O=Y.parentId===F,O&&(Y.lz=L)}})},A=F=>{e(E=>{for(const L of E.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lz=F)})},S=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&F.has(j.id)&&(j.lz=E)})},v=F=>{l(F.target.value)},b=(F,E)=>{const L=r(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.lz=E,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},T=(F,E)=>!b(F,E),R=F=>{if(d){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(E.lz-F)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&Math.abs(E.lz-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const E of n)if(E.type===z.SolarWaterHeater&&E.foundationId===(d==null?void 0:d.foundationId)&&!E.locked&&Math.abs(E.lz-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lz-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lz-F)>Ht)return!0}break}default:{if(Math.abs((d==null?void 0:d.lz)-F)>Ht)return!0;break}}return!1}},M=F=>{if(d&&R(F)){switch(y.current=void 0,a){case ie.AllSelectedObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.lz);const L={name:"Set Height for Selected Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{S(L.oldValues,L.newValue)}};i(L),S(E,F),c(s+1)}break}case ie.AllObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&E.set(j.id,j.lz);const L={name:"Set Height for All Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{A(L.newValue)}};i(L),A(F),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&E.foundationId===d.foundationId&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&E.set(j.id,j.lz);const L={name:"Set Height for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:d.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,F),c(s+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(m.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&T(j,F)){m.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&T(j,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&ye.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lz);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lz);const O=Y?d.normal:void 0,_={name:"Set Height for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:d.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())x(G,Q)},redo:()=>{_.groupId&&P(_.groupId,_.normal,_.newValue)}};i(_),P(d.parentId,O,F),c(s+1)}}break}default:{const E=o(d.id),L=E?E.lz:d.lz;if(m.current=T(d,F),m.current)y.current=F,p(L);else{const j={name:"Set Water Heater Height",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(j.changedElementId,j.oldValue)},redo:()=>{x(j.changedElementId,j.newValue)}};i(j),x(d.id,F),c(s+1)}break}}e(E=>{E.actionState.solarWaterHeaterHeight=F})}},D=()=>{m.current=!1,t(!1)},k=()=>{D(),u()},N=()=>{M(f),m.current||(t(!1),c(0))},U=()=>{M(f)},W=m.current?": "+B.t("message.NotApplicableToSelectedAction",w)+(y.current!==void 0?" ("+y.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Height",w),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:6,children:h.jsx(mn,{min:.6,max:10,step:.1,style:{width:120},precision:2,value:f,onChange:F=>{F!==null&&p(F)}})}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:v,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",w)})]})})})]})})},Lxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Fn),i=H(Wh),a=H(Nh),l=H(no),s=H(qn),c=ao(z.SolarWaterHeater),[u,d]=g.useState((c==null?void 0:c.color)??"grey"),f=Kt(),p=(b,T)=>{e(R=>{for(const M of R.elements)if(M.type===z.SolarWaterHeater&&M.id===b&&!M.locked){M.color=T;break}})},m=(b,T)=>{e(R=>{for(const M of R.elements)M.type===z.SolarWaterHeater&&M.foundationId===b&&!M.locked&&(M.color=T)})},y=(b,T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarWaterHeater&&!D.locked){let k;T?k=D.parentId===b&&ye.isIdentical(D.normal,T):k=D.parentId===b,k&&(D.color=R)}})},w=b=>{e(T=>{for(const R of T.elements)R.type===z.SolarWaterHeater&&!R.locked&&(R.color=b)})},x=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.SolarWaterHeater&&!M.locked&&b.has(M.id)&&(M.color=T)})},C=b=>{a(b.target.value)},P=b=>{if(c){switch(i){case ie.AllSelectedObjectsOfThisType:{for(const T of n)if(T.type===z.SolarWaterHeater&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.color!==b)return!0;break}case ie.AllObjectsOfThisType:{for(const T of n)if(T.type===z.SolarWaterHeater&&!T.locked&&T.color!==b)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of n)if(T.type===z.SolarWaterHeater&&T.foundationId===(c==null?void 0:c.foundationId)&&!T.locked&&T.color!==b)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const T=o(c);if(T){if(T.type===z.Cuboid){for(const M of n)if(M.type===z.SolarWaterHeater&&M.parentId===c.parentId&&ye.isIdentical(M.normal,c.normal)&&!M.locked&&M.color!==b)return!0}else for(const M of n)if(M.type===z.SolarWaterHeater&&M.parentId===c.parentId&&!M.locked&&M.color!==b)return!0}break}default:{if((c==null?void 0:c.color)!==b)return!0;break}}return!1}},A=b=>{if(c&&P(b)){switch(i){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(M.id)&&!M.locked&&T.set(M.id,M.color??"grey");const R={name:"Set Color for Selected Solar Water Heaters",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{x(R.oldValues,R.newValue)}};r(R),x(T,b),s(l+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.SolarWaterHeater&&!M.locked&&T.set(M.id,M.color??"grey");const R={name:"Set Color for All Solar Water Heaters",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{w(R.newValue)}};r(R),w(b),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const T=new Map;for(const M of n)M.type===z.SolarWaterHeater&&!M.locked&&M.foundationId===c.foundationId&&T.set(M.id,M.color??"grey");const R={name:"Set Color for All Water Heaters Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{R.groupId&&m(R.groupId,R.newValue)}};r(R),m(c.foundationId,b),s(l+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const T=o(c);if(T){const R=new Map,M=T.type===z.Cuboid;if(M)for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&ye.isIdentical(N.normal,c.normal)&&R.set(N.id,N.color??"grey");else for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&R.set(N.id,N.color??"grey");const D=M?c.normal:void 0,k={name:"Set Color for All Water Heaters on Surface",timestamp:Date.now(),oldValues:R,newValue:b,groupId:c.parentId,normal:D,undo:()=>{for(const[N,U]of k.oldValues.entries())p(N,U)},redo:()=>{k.groupId&&y(k.groupId,k.normal,k.newValue)}};r(k),y(c.parentId,D,b),s(l+1)}break}default:{const T=c?c.color:"grey",R={name:"Set Color of Selected Water Heater",timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(c.id,R.oldValue)},redo:()=>{p(c.id,R.newValue)}};r(R),p(c.id,b),s(l+1);break}}e(T=>{T.actionState.solarWaterHeaterColor=b})}},S=()=>{t(!1)},v=()=>{A(u)};return h.jsx(ro,{width:680,title:B.t("word.Color",f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsx(sd,{color:u??(c==null?void 0:c.color)??"grey",onChangeComplete:b=>{d(b.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:C,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",f)})]})})})]})})},Wxo=t=>{const e=[];if(t.type!==z.SolarWaterHeater)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=t.type===z.SolarWaterHeater&&ye.isIdentical(n.normal,fs);return e.push({key:"water-heater-copy",label:h.jsx(ad,{})}),o&&e.push({key:"water-heater-cut",label:h.jsx(ld,{})}),e.push({key:"water-heater-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"water-heater-length",label:h.jsxs(Zn,{Dialog:Dxo,children:[B.t("word.Length",r)," ..."]})},{key:"water-heater-width",label:h.jsxs(Zn,{Dialog:Exo,children:[B.t("word.Width",r)," ..."]})},{key:"water-heater-height",label:h.jsxs(Zn,{Dialog:Fxo,children:[B.t("word.Height",r)," ..."]})}),i&&e.push({key:"water-heater-relative-azimuth",label:h.jsxs(Zn,{Dialog:kxo,children:[B.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),e.push({key:"water-heater-frame-color",label:h.jsxs(Zn,{Dialog:Lxo,children:[B.t("word.Color",r)," ..."]})}),e.push({key:"solar-water-heater-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)})),{items:e}},Nxo=({setDialogVisible:t})=>{const e=H(Jn),n=H(mQ),o=H(Fn),r=H(_N),i=H(VN),a=H(no),l=H(qn),s=ao(z.BatteryStorage),[c,u]=g.useState(s?-s.rotation[2]:0),d=Kt(),f=P=>{i(P.target.value)},p=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)v.type===z.BatteryStorage&&!v.locked&&v.parentId===P&&(v.rotation[2]=-A)})},m=P=>{switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&H.getState().selectedElementIdSet.has(A.id)&&Math.abs(-A.rotation[2]-P)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&Math.abs(-A.rotation[2]-P)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&A.parentId===(s==null?void 0:s.parentId)&&!A.locked&&Math.abs(-A.rotation[2]-P)>Ht)return!0;break;default:if(Math.abs((s?-s.rotation[2]:0)-P)>Ht)return!0}return!1},y=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)if(P.has(v.id))if(A!==void 0)v.rotation[2]=A;else{const b=P.get(v.id);b!==void 0&&(v.rotation[2]=-b)}})},w=P=>{if(s&&m(P))switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,-v.rotation[2]);const S={name:"Set Azimuth for Selected Battery Storages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{y(S.oldValues)},redo:()=>{y(S.oldValues,-S.newValue)}};o(S),y(A,-P),l(a+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&!v.locked&&A.set(v.id,-v.rotation[2]);const S={name:"Set Azimuth for All Battery Storages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{y(S.oldValues)},redo:()=>{y(S.oldValues,-S.newValue)}};o(S),y(A,-P),l(a+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&v.parentId===s.parentId&&!v.locked&&A.set(v.id,-v.rotation[2]);const S={name:"Set Azimuth for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{for(const[v,b]of S.oldValues.entries())n(v,0,0,-b)},redo:()=>{p(S.groupId,S.newValue)}};o(S),p(s.parentId,P),l(a+1);break}default:{const A=e(s.id),S=A?-A.rotation[2]:-s.rotation[2],v={name:"Set Battery Storage Azimuth",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{n(v.changedElementId,0,0,-v.oldValue)},redo:()=>{n(v.changedElementId,0,0,-v.newValue)}};o(v),n(s.id,0,0,-P),l(a+1);break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.Azimuth",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(c).toFixed(2)),formatter:P=>`${P}°`,onChange:P=>{P!==null&&u(ye.toRadians(P))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",d),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",d)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:f,value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",d)})]})})})]})})},Uxo=({setDialogVisible:t})=>{const e=H(Fn),n=H(_N),o=H(VN),r=H(no),i=H(qn),a=ao(z.BatteryStorage),[l,s]=g.useState((a==null?void 0:a.lz)??0),c=Kt(),u=C=>{o(C.target.value)},d=C=>{if(a){switch(n){case ie.AllSelectedObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(P.lz-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&Math.abs(P.lz-C)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&P.parentId===a.parentId&&!P.locked&&Math.abs(P.lz-C)>Ht)return!0;break}default:{if(Math.abs((a==null?void 0:a.lz)-C)>Ht)return!0;break}}return!1}},f=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(S.type===z.BatteryStorage&&C.has(S.id))if(P!==void 0)S.lz=P;else{const v=C.get(S.id);v!==void 0&&(S.lz=v)}})},p=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)S.type===z.BatteryStorage&&!S.locked&&S.parentId===C&&(S.lz=P)})},m=(C,P)=>{H.getState().set(A=>{const S=A.elements.find(v=>v.id===C);S&&(S.lz=P)})},y=C=>{if(a&&d(C))switch(n){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,S.lz);const A={name:"Set Lz for Selected Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&P.set(S.id,S.lz);const A={name:"Set Lz for All Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&S.parentId===a.parentId&&!S.locked&&P.set(S.id,S.lz);const A={name:"Set Lz for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:a.parentId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.groupId,A.newValue)}};e(A),p(a.parentId,C),i(r+1);break}default:{const P={name:"Set Battery Storage Lz",timestamp:Date.now(),oldValue:a.lz,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{m(P.changedElementId,P.oldValue)},redo:()=>{m(P.changedElementId,P.newValue)}};e(P),m(a.id,C),i(r+1);break}}},w=()=>{t(!1)},x=()=>{y(l)};return h.jsx(ro,{width:550,title:B.t("word.Height",c),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 1000] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:u,value:n,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",c)})]})})})]})})},jxo=({setDialogVisible:t})=>{const e=H(Fn),n=H(_N),o=H(VN),r=H(no),i=H(qn),a=ao(z.BatteryStorage),[l,s]=g.useState((a==null?void 0:a.ly)??0),c=Kt(),u=C=>{o(C.target.value)},d=C=>{if(a){switch(n){case ie.AllSelectedObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(P.ly-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&Math.abs(P.ly-C)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&P.parentId===a.parentId&&!P.locked&&Math.abs(P.ly-C)>Ht)return!0;break}default:{if(Math.abs((a==null?void 0:a.ly)-C)>Ht)return!0;break}}return!1}},f=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(S.type===z.BatteryStorage&&C.has(S.id))if(P!==void 0)S.ly=P;else{const v=C.get(S.id);v!==void 0&&(S.ly=v)}})},p=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)S.type===z.BatteryStorage&&!S.locked&&S.parentId===C&&(S.ly=P)})},m=(C,P)=>{H.getState().set(A=>{const S=A.elements.find(v=>v.id===C);S&&(S.ly=P)})},y=C=>{if(a&&d(C))switch(n){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,S.ly);const A={name:"Set Ly for Selected Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&P.set(S.id,S.ly);const A={name:"Set Ly for All Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&S.parentId===a.parentId&&!S.locked&&P.set(S.id,S.ly);const A={name:"Set Ly for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:a.parentId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.groupId,A.newValue)}};e(A),p(a.parentId,C),i(r+1);break}default:{const P={name:"Set Battery Storage Ly",timestamp:Date.now(),oldValue:a.ly,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{m(P.changedElementId,P.oldValue)},redo:()=>{m(P.changedElementId,P.newValue)}};e(P),m(a.id,C),i(r+1);break}}},w=()=>{t(!1)},x=()=>{y(l)};return h.jsx(ro,{width:550,title:B.t("word.Width",c),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:100,style:{width:120},step:.5,precision:2,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 100] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:u,value:n,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",c)})]})})})]})})},Bxo=({setDialogVisible:t})=>{const e=H(Fn),n=H(_N),o=H(VN),r=H(no),i=H(qn),a=ao(z.BatteryStorage),[l,s]=g.useState((a==null?void 0:a.lx)??0),c=Kt(),u=C=>{o(C.target.value)},d=C=>{if(a){switch(n){case ie.AllSelectedObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(P.lx-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&Math.abs(P.lx-C)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&P.parentId===a.parentId&&!P.locked&&Math.abs(P.lx-C)>Ht)return!0;break}default:{if(Math.abs((a==null?void 0:a.lx)-C)>Ht)return!0;break}}return!1}},f=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(S.type===z.BatteryStorage&&C.has(S.id))if(P!==void 0)S.lx=P;else{const v=C.get(S.id);v!==void 0&&(S.lx=v)}})},p=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)S.type===z.BatteryStorage&&!S.locked&&S.parentId===C&&(S.lx=P)})},m=(C,P)=>{H.getState().set(A=>{const S=A.elements.find(v=>v.id===C);S&&(S.lx=P)})},y=C=>{if(a&&d(C))switch(n){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,S.lx);const A={name:"Set Lx for Selected Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&P.set(S.id,S.lx);const A={name:"Set Lx for All Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&S.parentId===a.parentId&&!S.locked&&P.set(S.id,S.lx);const A={name:"Set Lx for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:a.parentId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.groupId,A.newValue)}};e(A),p(a.parentId,C),i(r+1);break}default:{const P={name:"Set Battery Storage Lx",timestamp:Date.now(),oldValue:a.lx,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{m(P.changedElementId,P.oldValue)},redo:()=>{m(P.changedElementId,P.newValue)}};e(P),m(a.id,C),i(r+1);break}}},w=()=>{t(!1)},x=()=>{y(l)};return h.jsx(ro,{width:550,title:B.t("word.Length",c),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:100,style:{width:120},step:.5,precision:2,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 100] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:u,value:n,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",c)})]})})})]})})},Yxo=({setDialogVisible:t})=>{const e=H(f5e),n=H(Jn),o=H(h5e),r=H(Fn),i=H(qn),a=H(_N),l=H(VN),s=ao(z.BatteryStorage),[c,u]=g.useState((s==null?void 0:s.color)??"#808080"),d=Kt(),f=P=>{l(P.target.value)},p=P=>{switch(a){case ie.AllSelectedObjectsOfThisType:{for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&H.getState().selectedElementIdSet.has(A.id)&&P!==A.color)return!0;break}case ie.AllObjectsOfThisType:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&P!==A.color)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&A.parentId===(s==null?void 0:s.parentId)&&!A.locked&&P!==A.color)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0}return!1},m=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)if(v.type===z.BatteryStorage&&P.has(v.id))if(A!==void 0)v.color=A;else{const b=P.get(v.id);b!==void 0&&(v.color=b)}})},y=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)v.type===z.BatteryStorage&&!v.locked&&v.parentId===P&&(v.color=A)})},w=P=>{if(s&&p(P))switch(a){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.color??"#808080");const S={name:"Set Color for Selected BatteryStorages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};r(S),m(A,P),i(H.getState().applyCount+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&A.set(v.id,v.color??"#808080");const S={name:"Set Color for All BatteryStorages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{o(z.BatteryStorage,S.newValue)}};r(S),o(z.BatteryStorage,P),i(H.getState().applyCount+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&v.parentId===s.parentId&&!v.locked&&A.set(v.id,v.color??"#808080");const S={name:"Set Color for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{m(S.oldValues)},redo:()=>{y(S.groupId,S.newValue)}};r(S),y(s.parentId,P),i(H.getState().applyCount+1);break}default:{const A=n(s.id),S=A?A.color:s.color,v={name:"Set Color of Selected Battery Storage",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{e(v.changedElementId,v.oldValue)},redo:()=>{e(v.changedElementId,v.newValue)}};r(v),e(s.id,P),i(H.getState().applyCount+1);break}}},x=()=>{w(c)},C=()=>{t(!1)};return h.jsx(ro,{width:650,title:B.t("word.Color",d),onApply:x,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:f,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",d)})]})})})]})})},Oxo=t=>{const e=[];if(t.type!==z.BatteryStorage)return{items:e};const n=t,o={lng:H.getState().language},r=!(n!=null&&n.locked);return e.push({key:"battery-storage-copy",label:h.jsx(ad,{})}),r&&e.push({key:"battery-storage-cut",label:h.jsx(ld,{})}),e.push({key:"battery-storage-lock",label:h.jsx(D0,{selectedElement:n})}),r&&(e.push({key:"battery-storage-color",label:h.jsxs(Zn,{Dialog:Yxo,children:[B.t("word.Color",o)," ..."]})}),e.push({key:"battery-storage-length",label:h.jsxs(Zn,{Dialog:Bxo,children:[B.t("word.Length",o)," ..."]})}),e.push({key:"battery-storage-width",label:h.jsxs(Zn,{Dialog:jxo,children:[B.t("word.Width",o)," ..."]})}),e.push({key:"battery-storage-height",label:h.jsxs(Zn,{Dialog:Uxo,children:[B.t("word.Height",o)," ..."]})}),e.push({key:"battery-storage-azimuth",label:h.jsxs(Zn,{Dialog:Nxo,children:[B.t("word.Azimuth",o)," ..."]})}),e.push({key:"battery-storage-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)})),{items:e}},_xo=()=>{const t=H(eCt),e=ao(),n=g.useRef(t),o=g.useRef(e);return t!==null?(n.current=t,o.current=e):setTimeout(()=>{n.current=t,o.current=t===null?void 0:e},200),[n.current,o.current]},Vxo=({children:t})=>{dt(r=>r.contextMenuFlag);const[e,n]=_xo(),o=()=>{if(!n)return e===z.Ground?Y4o():e===z.Sky?Xwo():{items:[]};switch(e){case z.Foundation:return l4o(n);case z.Cuboid:return z4o(n);case z.Wall:return g7o(n);case z.Roof:return xxo(n);case z.SolarPanel:return l8o(n);case z.Window:return _7o(n);case z.Door:return R7o(n);case z.Sensor:return zwo(n);case z.Light:return Lwo(n);case z.Human:return Q4o(n);case z.Tree:return X8o(n);case z.Flower:return ewo(n);case z.ParabolicTrough:return y8o(n);case z.ParabolicDish:return R8o(n);case z.FresnelReflector:return L8o(n);case z.Heliostat:return V8o(n);case z.Polygon:return Two(n);case z.PolygonVertex:return Hwo(n);case z.WindTurbine:return zxo(n);case z.SolarWaterHeater:return Wxo(n);case z.BatteryStorage:return Oxo(n);default:return{items:[]}}};return h.jsx(e4,{trigger:["contextMenu"],menu:o(),overlayClassName:"my-overlay",children:t})},Gxo=xe.memo(Vxo);(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(I,V,fe){I!=Array.prototype&&I!=Object.prototype&&(I[V]=fe.value)};function n(I){I=[typeof window=="object"&&window,typeof self=="object"&&self,typeof global=="object"&&global,I];for(var V=0;VI.b&&(I.b++,V.next=I.a,I.a=V)}function Y(){this.b=this.a=null}var O=new L(function(){return new G},function(I){I.reset()});Y.prototype.add=function(I,V){var fe=O.get();fe.set(I,V),this.b?this.b.next=fe:this.a=fe,this.b=fe};function _(){var I=Wo,V=null;return I.a&&(V=I.a,I.a=I.a.next,I.a||(I.b=null),V.next=null),V}function G(){this.next=this.b=this.a=null}G.prototype.set=function(I,V){this.a=I,this.b=V,this.next=null},G.prototype.reset=function(){this.next=this.b=this.a=null};var Q=Array.prototype.indexOf?function(I,V){return Array.prototype.indexOf.call(I,V,void 0)}:function(I,V){if(typeof I=="string")return typeof V!="string"||V.length!=1?-1:I.indexOf(V,0);for(var fe=0;feV?null:typeof I=="string"?I.charAt(V):I[V]}function te(I,V){return 0<=Q(I,V)}function $(I,V){V=Q(I,V);var fe;return(fe=0<=V)&&Array.prototype.splice.call(I,V,1),fe}function le(I,V){var fe=0;ee(I,function(De,Ke){V.call(void 0,De,Ke,I)&&Array.prototype.splice.call(I,Ke,1).length==1&&fe++})}function de(I){return Array.prototype.concat.apply([],arguments)}function he(I){var V=I.length;if(0/g,Ie=/"/g,ve=/'/g,ze=/\x00/g,Ae=/[\x00&<>"']/;function se(I,V){return I.indexOf(V)!=-1}function ge(I,V){return IV?1:0}var we;e:{var Se=s.navigator;if(Se){var Me=Se.userAgent;if(Me){we=Me;break e}}we=""}function Ce(I){return se(we,I)}function Te(I,V){for(var fe in I)V.call(void 0,I[fe],fe,I)}function Re(I){for(var V in I)return!1;return!0}function Ne(I){var V={},fe;for(fe in I)V[fe]=I[fe];return V}var _e="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ue(I,V){for(var fe,De,Ke=1;Ke"}else Tt=I===void 0?"undefined":I===null?"null":typeof I;E("Argument is not a %s (or a non-Element, non-Location mock); got: %s",V,Tt)}}function Fe(I,V){this.a=I===Ye&&V||"",this.b=Le}Fe.prototype.ta=!0,Fe.prototype.sa=function(){return this.a},Fe.prototype.toString=function(){return"Const{"+this.a+"}"};function He(I){return I instanceof Fe&&I.constructor===Fe&&I.b===Le?I.a:(E("expected object of type Const, got '"+I+"'"),"type_error:Const")}var Le={},Ye={},lt;function Oe(){if(lt===void 0){var I=null,V=s.trustedTypes;if(V&&V.createPolicy){try{I=V.createPolicy("goog#html",{createHTML:v,createScript:v,createScriptURL:v})}catch(fe){s.console&&s.console.error(fe.message)}lt=I}else lt=I}return lt}function ut(I,V){this.a=V===tt?I:""}ut.prototype.ta=!0,ut.prototype.sa=function(){return this.a.toString()},ut.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};function ht(I){return I instanceof ut&&I.constructor===ut?I.a:(E("expected object of type TrustedResourceUrl, got '"+I+"' of type "+p(I)),"type_error:TrustedResourceUrl")}function Qe(I,V){var fe=He(I);if(!mt.test(fe))throw Error("Invalid TrustedResourceUrl format: "+fe);return I=fe.replace(nt,function(De,Ke){if(!Object.prototype.hasOwnProperty.call(V,Ke))throw Error('Found marker, "'+Ke+'", in format string, "'+fe+'", but no valid label mapping found in args: '+JSON.stringify(V));return De=V[Ke],De instanceof Fe?He(De):encodeURIComponent(String(De))}),gt(I)}var nt=/%{(\w+)}/g,mt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,tt={};function gt(I){var V=Oe();return I=V?V.createScriptURL(I):I,new ut(I,tt)}function Ve(I,V){this.a=V===zt?I:""}Ve.prototype.ta=!0,Ve.prototype.sa=function(){return this.a.toString()},Ve.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};function je(I){return I instanceof Ve&&I.constructor===Ve?I.a:(E("expected object of type SafeUrl, got '"+I+"' of type "+p(I)),"type_error:SafeUrl")}var et=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,bt=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,St=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Pt(I){if(I instanceof Ve)return I;if(I=typeof I=="object"&&I.ta?I.sa():String(I),St.test(I))I=new Ve(I,zt);else{I=String(I),I=I.replace(/(%0A|%0D)/g,"");var V=I.match(bt);I=V&&et.test(V[1])?new Ve(I,zt):null}return I}function Yt(I){return I instanceof Ve?I:(I=typeof I=="object"&&I.ta?I.sa():String(I),St.test(I)||(I="about:invalid#zClosurez"),new Ve(I,zt))}var zt={},Rt=new Ve("about:invalid#zClosurez",zt);function Ct(I,V,fe){this.a=fe===at?I:""}Ct.prototype.ta=!0,Ct.prototype.sa=function(){return this.a.toString()},Ct.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};function yt(I){return I instanceof Ct&&I.constructor===Ct?I.a:(E("expected object of type SafeHtml, got '"+I+"' of type "+p(I)),"type_error:SafeHtml")}var at={};function Et(I,V){qe(I,"HTMLScriptElement"),I.src=ht(V),(V=I.ownerDocument&&I.ownerDocument.defaultView)&&V!=s?V=d(V.document):(u===null&&(u=d(s.document)),V=u),V&&I.setAttribute("nonce",V)}function Lt(I,V,fe,De){return I=I instanceof Ve?I:Yt(I),V=V||s,fe=fe instanceof Fe?He(fe):fe||"",V.open(je(I),fe,De,void 0)}function Je(I,V){for(var fe=I.split("%s"),De="",Ke=Array.prototype.slice.call(arguments,1);Ke.length&&1")!=-1&&(I=I.replace(pe,">")),I.indexOf('"')!=-1&&(I=I.replace(Ie,""")),I.indexOf("'")!=-1&&(I=I.replace(ve,"'")),I.indexOf("\0")!=-1&&(I=I.replace(ze,"�"))),I}function It(I){return It[" "](I),I}It[" "]=f;function ot(I,V){var fe=qt;return Object.prototype.hasOwnProperty.call(fe,I)?fe[I]:fe[I]=V(I)}var it=Ce("Opera"),Be=Ce("Trident")||Ce("MSIE"),pt=Ce("Edge"),ct=pt||Be,Xe=Ce("Gecko")&&!(se(we.toLowerCase(),"webkit")&&!Ce("Edge"))&&!(Ce("Trident")||Ce("MSIE"))&&!Ce("Edge"),ft=se(we.toLowerCase(),"webkit")&&!Ce("Edge");function wt(){var I=s.document;return I?I.documentMode:void 0}var kt;e:{var Zt="",Ot=function(){var I=we;if(Xe)return/rv:([^\);]+)(\)|;)/.exec(I);if(pt)return/Edge\/([\d\.]+)/.exec(I);if(Be)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(I);if(ft)return/WebKit\/(\S+)/.exec(I);if(it)return/(?:Version)[ \/]?(\S+)/.exec(I)}();if(Ot&&(Zt=Ot?Ot[1]:""),Be){var on=wt();if(on!=null&&on>parseFloat(Zt)){kt=String(on);break e}}kt=Zt}var qt={};function rn(I){return ot(I,function(){for(var V=0,fe=me(String(kt)).split("."),De=me(String(I)).split("."),Ke=Math.max(fe.length,De.length),Tt=0;V==0&&Tt"),Tt=Tt.join("")}return Tt=xo(Ke,Tt),Wt&&(typeof Wt=="string"?Tt.className=Wt:Array.isArray(Wt)?Tt.className=Wt.join(" "):kn(Tt,Wt)),2"u"&&typeof window<"u"&&window.postMessage&&window.addEventListener&&!Ce("Presto")&&(I=function(){var Ke=xo(document,"IFRAME");Ke.style.display="none",document.documentElement.appendChild(Ke);var Tt=Ke.contentWindow;Ke=Tt.document,Ke.open(),Ke.close();var Wt="callImmediate"+Math.random(),un=Tt.location.protocol=="file:"?"*":Tt.location.protocol+"//"+Tt.location.host;Ke=P(function(po){(un=="*"||po.origin==un)&&po.data==Wt&&this.port1.onmessage()},this),Tt.addEventListener("message",Ke,!1),this.port1={},this.port2={postMessage:function(){Tt.postMessage(Wt,un)}}}),typeof I<"u"&&!Ce("Trident")&&!Ce("MSIE")){var V=new I,fe={},De=fe;return V.port1.onmessage=function(){if(fe.next!==void 0){fe=fe.next;var Ke=fe.Hb;fe.Hb=null,Ke()}},function(Ke){De.next={Hb:Ke},De=De.next,V.port2.postMessage(0)}}return function(Ke){s.setTimeout(Ke,0)}}function An(I,V){Dn||sr(),Vo||(Dn(),Vo=!0),Wo.add(I,V)}var Dn;function sr(){if(s.Promise&&s.Promise.resolve){var I=s.Promise.resolve(void 0);Dn=function(){I.then(To)}}else Dn=function(){var V=To;!y(s.setImmediate)||s.Window&&s.Window.prototype&&!Ce("Edge")&&s.Window.prototype.setImmediate==s.setImmediate?(Rr||(Rr=Eo()),Rr(V)):s.setImmediate(V)}}var Vo=!1,Wo=new Y;function To(){for(var I;I=_();){try{I.a.call(I.b)}catch(V){wo(V)}j(O,I)}Vo=!1}function Go(I,V){if(this.a=No,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,I!=f)try{var fe=this;I.call(V,function(De){ii(fe,ho,De)},function(De){if(!(De instanceof El))try{throw De instanceof Error?De:Error("Promise rejected.")}catch{}ii(fe,vo,De)})}catch(De){ii(this,vo,De)}}var No=0,ho=2,vo=3;function bo(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}bo.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var Bo=new L(function(){return new bo},function(I){I.reset()});function Pr(I,V,fe){var De=Bo.get();return De.g=I,De.b=V,De.f=fe,De}function so(I){if(I instanceof Go)return I;var V=new Go(f);return ii(V,ho,I),V}function zo(I){return new Go(function(V,fe){fe(I)})}function Ci(I,V,fe){Ga(I,V,fe,null)||An(A(V,I))}function ea(I){return new Go(function(V,fe){var De=I.length,Ke=[];if(De)for(var Tt=function(Fo,Bi){De--,Ke[Fo]=Bi,De==0&&V(Ke)},Wt=function(Fo){fe(Fo)},un=0,po;un=I.keyCode)&&(I.keyCode=-1)}catch{}},Wn.prototype.g=function(){return this.a};var rt="closure_listenable_"+(1e6*Math.random()|0),vt=0;function Nt(I,V,fe,De,Ke){this.listener=I,this.proxy=null,this.src=V,this.type=fe,this.capture=!!De,this.Wa=Ke,this.key=++vt,this.wa=this.Qa=!1}function Ft(I){I.wa=!0,I.listener=null,I.proxy=null,I.src=null,I.Wa=null}function en(I){this.src=I,this.a={},this.b=0}en.prototype.add=function(I,V,fe,De,Ke){var Tt=I.toString();I=this.a[Tt],I||(I=this.a[Tt]=[],this.b++);var Wt=dn(I,V,De,Ke);return-1De.keyCode||De.returnValue!=null)){e:{var Ke=!1;if(De.keyCode==0)try{De.keyCode=-1;break e}catch{Ke=!0}(Ke||De.returnValue==null)&&(De.returnValue=!0)}for(De=[],Ke=V.b;Ke;Ke=Ke.parentNode)De.push(Ke);for(I=I.type,Ke=De.length-1;0<=Ke;Ke--){V.b=De[Ke];var Tt=qr(De[Ke],I,!0,V);fe=fe&&Tt}for(Ke=0;Ke>>0);function wu(I){return y(I)?I:(I[cc]||(I[cc]=function(V){return I.handleEvent(V)}),I[cc])}function ps(){Vs.call(this),this.v=new en(this),this.bc=this,this.hb=null}S(ps,Vs),ps.prototype[rt]=!0,ps.prototype.addEventListener=function(I,V,fe,De){Tn(this,I,V,fe,De)},ps.prototype.removeEventListener=function(I,V,fe,De){go(this,I,V,fe,De)},ps.prototype.dispatchEvent=function(I){var V,fe=this.hb;if(fe)for(V=[];fe;fe=fe.hb)V.push(fe);fe=this.bc;var De=I.type||I;if(typeof I=="string")I=new Cn(I,fe);else if(I instanceof Cn)I.target=I.target||fe;else{var Ke=I;I=new Cn(De,fe),Ue(I,Ke)}if(Ke=!0,V)for(var Tt=V.length-1;0<=Tt;Tt--){var Wt=I.b=V[Tt];Ke=Xh(Wt,De,!0,I)&&Ke}if(Wt=I.b=fe,Ke=Xh(Wt,De,!0,I)&&Ke,Ke=Xh(Wt,De,!1,I)&&Ke,V)for(Tt=0;TtV)throw Error("Bad port number "+V);I.g=V}else I.g=null}function Bu(I,V,fe){V instanceof jf?(I.b=V,i9(I.b,I.i)):(fe||(V=n9(V,o9)),I.b=new jf(V,I.i))}function va(I,V,fe){I.b.set(V,fe)}function Ha(I,V){return I.b.get(V)}function iu(I){return I instanceof q1?new q1(I):new q1(I,void 0)}function dd(I,V,fe,De){var Ke=new q1(null,void 0);return I&&Im(Ke,I),V&&(Ke.a=V),fe&&ru(Ke,fe),De&&(Ke.f=De),Ke}function t9(I,V){return I?V?decodeURI(I.replace(/%25/g,"%2525")):decodeURIComponent(I):""}function n9(I,V,fe){return typeof I=="string"?(I=encodeURI(I).replace(V,$7),fe&&(I=I.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),I):null}function $7(I){return I=I.charCodeAt(0),"%"+(I>>4&15).toString(16)+(I&15).toString(16)}var I4=/[#\/\?@]/g,h2=/[#\?:]/g,p6=/[#\?]/g,o9=/[#\?@]/g,g6=/#/g;function jf(I,V){this.b=this.a=null,this.c=I||null,this.f=!!V}function xu(I){I.a||(I.a=new ou,I.b=0,I.c&&$1(I.c,function(V,fe){I.add(decodeURIComponent(V.replace(/\+/g," ")),fe)}))}function r9(I){var V=K1(I);if(typeof V>"u")throw Error("Keys are undefined");var fe=new jf(null,void 0);I=Qp(I);for(var De=0;De2*I.c&&Zp(I)))}t.clear=function(){this.a=this.c=null,this.b=0};function zm(I,V){return xu(I),V=$l(I,V),F0(I.a.b,V)}t.forEach=function(I,V){xu(this),this.a.forEach(function(fe,De){oe(fe,function(Ke){I.call(V,Ke,De,this)},this)},this)},t.Y=function(){xu(this);for(var I=this.a.X(),V=this.a.Y(),fe=[],De=0;DeI?!1:!Be||!to||9',I=(De=Oe())?De.createHTML(I):I,I=new Ct(I,null,at),De=Wt.document)&&(De.write(yt(I)),De.close())):(Wt=Lt(V,De,fe,Wt))&&I.noopener&&(Wt.opener=null),Wt)try{Wt.focus()}catch{}return Wt}function vu(I){return new Go(function(V){function fe(){ju(2e3).then(function(){if(!I||I.closed)V();else return fe()})}return fe()})}var bu=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,L0=/^[^@]+@[^@]+$/;function $h(){var I=null;return new Go(function(V){s.document.readyState=="complete"?V():(I=function(){V()},Gn(window,"load",I))}).o(function(V){throw go(window,"load",I),V})}function y6(){return Dm(void 0)?$h().then(function(){return new Go(function(I,V){var fe=s.document,De=setTimeout(function(){V(Error("Cordova framework is not ready."))},1e3);fe.addEventListener("deviceready",function(){clearTimeout(De),I()},!1)})}):zo(Error("Cordova must run in an Android or iOS file scheme."))}function Dm(I){return I=I||gs(),!(eg()!=="file:"&&eg()!=="ionic:"||!I.toLowerCase().match(/iphone|ipad|ipod|android/))}function uc(){var I=s.window;try{return!(!I||I==I.top)}catch{return!1}}function l0(){return typeof s.WorkerGlobalScope<"u"&&typeof s.importScripts=="function"}function aa(){return eo.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":eo.INTERNAL.hasOwnProperty("node")?"Node":l0()?"Worker":"Browser"}function z4(){var I=aa();return I==="ReactNative"||I==="Node"}function t1(){for(var I=50,V=[];0"u"?null:p2(I)}function tg(I){var V={},fe;for(fe in I)I.hasOwnProperty(fe)&&I[fe]!==null&&I[fe]!==void 0&&(V[fe]=I[fe]);return V}function N0(I){if(I!==null)return JSON.parse(I)}function Yf(I){return I||Math.floor(1e9*Math.random()).toString()}function l9(I){return I=I||gs(),!(Z1(I)=="Safari"||I.toLowerCase().match(/iphone|ipad|ipod/))}function Q7(){var I=s.___jsl;if(I&&I.H){for(var V in I.H)if(I.H[V].r=I.H[V].r||[],I.H[V].L=I.H[V].L||[],I.H[V].r=I.H[V].L.concat(),I.CP)for(var fe=0;feV)throw Error("Short delay should be less than long delay!");this.a=I,this.c=V,I=gs(),V=aa(),this.b=Gi(I)||V==="ReactNative"}ng.prototype.get=function(){var I=s.navigator;return!(I&&typeof I.onLine=="boolean"&&(a9()||eg()==="chrome-extension:"||typeof I.connection<"u"))||I.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};function y2(){var I=s.document;return I&&typeof I.visibilityState<"u"?I.visibilityState=="visible":!0}function x6(){var I=s.document,V=null;return y2()||!I?so():new Go(function(fe){V=function(){y2()&&(I.removeEventListener("visibilitychange",V,!1),fe())},I.addEventListener("visibilitychange",V,!1)}).o(function(fe){throw I.removeEventListener("visibilitychange",V,!1),fe})}function og(I){try{var V=new Date(parseInt(I,10));if(!isNaN(V.getTime())&&!/[^0-9]/.test(I))return V.toUTCString()}catch{}return null}function Z7(){return!(!kl("fireauth.oauthhelper",s)&&!kl("fireauth.iframe",s))}function ex(){var I=s.navigator;return I&&I.serviceWorker&&I.serviceWorker.controller||null}function oz(){var I=s.navigator;return I&&I.serviceWorker?so().then(function(){return I.serviceWorker.ready}).then(function(V){return V.active||null}).o(function(){return null}):so(null)}var tx={};function dc(I){tx[I]||(tx[I]=!0,typeof console<"u"&&typeof console.warn=="function"&&console.warn(I))}var Su;try{var D4={};Object.defineProperty(D4,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(D4,"abcd",{configurable:!0,enumerable:!0,value:2}),Su=D4.abcd==2}catch{Su=!1}function Nr(I,V,fe){Su?Object.defineProperty(I,V,{configurable:!0,enumerable:!0,value:fe}):I[V]=fe}function Yu(I,V){if(V)for(var fe in V)V.hasOwnProperty(fe)&&Nr(I,fe,V[fe])}function Qh(I){var V={};return Yu(V,I),V}function s9(I){var V={},fe;for(fe in I)I.hasOwnProperty(fe)&&(V[fe]=I[fe]);return V}function v6(I,V){if(!V||!V.length)return!0;if(!I)return!1;for(var fe=0;fe"u")throw new b("missing-continue-uri");if(typeof V!="string"||typeof V=="string"&&!V.length)throw new b("invalid-continue-uri");this.h=V,this.b=this.a=null,this.g=!1;var fe=I[ix];if(fe&&typeof fe=="object"){V=fe[P6];var De=fe[sx];if(fe=fe[cx],typeof V=="string"&&V.length){if(this.a=V,typeof De<"u"&&typeof De!="boolean")throw new b("argument-error",sx+" property must be a boolean when specified.");if(this.g=!!De,typeof fe<"u"&&(typeof fe!="string"||typeof fe=="string"&&!fe.length))throw new b("argument-error",cx+" property must be a non empty string when specified.");this.b=fe||null}else{if(typeof V<"u")throw new b("argument-error",P6+" property must be a non empty string when specified.");if(typeof De<"u"||typeof fe<"u")throw new b("missing-android-pkg-name")}}else if(typeof fe<"u")throw new b("argument-error",ix+" property must be a non null object when specified.");if(this.f=null,(V=I[ax])&&typeof V=="object"){if(V=V[cg],typeof V=="string"&&V.length)this.f=V;else if(typeof V<"u")throw new b("argument-error",cg+" property must be a non empty string when specified.")}else if(typeof V<"u")throw new b("argument-error",ax+" property must be a non null object when specified.");if(V=I[fd],typeof V<"u"&&typeof V!="boolean")throw new b("argument-error",fd+" property must be a boolean when specified.");if(this.c=!!V,I=I[T6],typeof I<"u"&&(typeof I!="string"||typeof I=="string"&&!I.length))throw new b("argument-error",T6+" property must be a non empty string when specified.");this.i=I||null}var ix="android",T6="dynamicLinkDomain",fd="handleCodeInApp",ax="iOS",lx="url",sx="installApp",cx="minimumVersion",P6="packageName",cg="bundleId";function h9(I){var V={};V.continueUrl=I.h,V.canHandleCodeInApp=I.c,(V.androidPackageName=I.a)&&(V.androidMinimumVersion=I.b,V.androidInstallApp=I.g),V.iOSBundleId=I.f,V.dynamicLinkDomain=I.i;for(var fe in V)V[fe]===null&&delete V[fe];return V}function bT(I){return ae(I,function(V){return V=V.toString(16),1>4),Wt!=64&&(V(Tt<<4&240|Wt>>2),un!=64&&V(Wt<<6&192|un))}}function L4(){if(!Ns){Ns={};for(var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),V=["+/=","+/","-_=","-_.","-_"],fe=0;5>fe;fe++)for(var De=I.concat(V[fe].split("")),Ke=0;Kethis.a?this.a:I),this.b=V.provider_id||V.firebase&&V.firebase.sign_in_provider||null,this.f=V.firebase&&V.firebase.tenant||null,this.c=!!V.is_anonymous||this.b=="anonymous"}o1.prototype.T=function(){return this.f},o1.prototype.l=function(){return this.c},o1.prototype.toString=function(){return this.h};function W4(I){try{return new o1(I)}catch{return null}}function wr(I){if(!I||(I=I.split("."),I.length!=3))return null;I=I[1];for(var V=(4-I.length%4)%4,fe=0;feKe)I[fe++]=String.fromCharCode(Ke);else if(191Ke){var Tt=De[V++];I[fe++]=String.fromCharCode((Ke&31)<<6|Tt&63)}else if(239Ke){Tt=De[V++];var Wt=De[V++],un=De[V++],po=((Ke&7)<<18|(Tt&63)<<12|(Wt&63)<<6|un&63)-65536;I[fe++]=String.fromCharCode(55296+(po>>10)),I[fe++]=String.fromCharCode(56320+(po&1023))}else Tt=De[V++],Wt=De[V++],I[fe++]=String.fromCharCode((Ke&15)<<12|(Tt&63)<<6|Wt&63)}return JSON.parse(I.join(""))}catch{}return null}var p9="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),g9=["client_id","response_type","scope","redirect_uri","state"],N4={nd:{Ja:"locale",va:700,ua:600,fa:"facebook.com",Ya:g9},pd:{Ja:null,va:500,ua:750,fa:"github.com",Ya:g9},qd:{Ja:"hl",va:515,ua:680,fa:"google.com",Ya:g9},wd:{Ja:"lang",va:485,ua:705,fa:"twitter.com",Ya:p9},kd:{Ja:"locale",va:640,ua:600,fa:"apple.com",Ya:[]}};function C6(I){for(var V in N4)if(N4[V].fa==I)return N4[V];return null}function Of(I){var V={};V["facebook.com"]=tp,V["google.com"]=ug,V["github.com"]=H6,V["twitter.com"]=hd;var fe=I&&I[U4];try{if(fe)return V[fe]?new V[fe](I):new ep(I);if(typeof I[r1]<"u")return new R6(I)}catch{}return null}var r1="idToken",U4="providerId";function R6(I){var V=I[U4];if(!V&&I[r1]){var fe=W4(I[r1]);fe&&fe.b&&(V=fe.b)}if(!V)throw Error("Invalid additional user info!");(V=="anonymous"||V=="custom")&&(V=null),fe=!1,typeof I.isNewUser<"u"?fe=!!I.isNewUser:I.kind==="identitytoolkit#SignupNewUserResponse"&&(fe=!0),Nr(this,"providerId",V),Nr(this,"isNewUser",fe)}function ep(I){R6.call(this,I),I=N0(I.rawUserInfo||"{}"),Nr(this,"profile",b6(I||{}))}S(ep,R6);function tp(I){if(ep.call(this,I),this.providerId!="facebook.com")throw Error("Invalid provider ID!")}S(tp,ep);function H6(I){if(ep.call(this,I),this.providerId!="github.com")throw Error("Invalid provider ID!");Nr(this,"username",this.profile&&this.profile.login||null)}S(H6,ep);function ug(I){if(ep.call(this,I),this.providerId!="google.com")throw Error("Invalid provider ID!")}S(ug,ep);function hd(I){if(ep.call(this,I),this.providerId!="twitter.com")throw Error("Invalid provider ID!");Nr(this,"username",I.screenName||null)}S(hd,ep);function j4(I){var V=iu(I),fe=Ha(V,"link"),De=Ha(iu(fe),"link");return V=Ha(V,"deep_link_id"),Ha(iu(V),"link")||V||De||fe||I}function A2(I,V){if(!I&&!V)throw new b("internal-error","Internal assert: no raw session string available");if(I&&V)throw new b("internal-error","Internal assert: unable to determine the session type");this.a=I||null,this.b=V||null,this.type=this.a?w2:i1}var w2="enroll",i1="signin";A2.prototype.Ha=function(){return this.a?so(this.a):so(this.b)},A2.prototype.w=function(){return this.type==w2?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}};function s0(){}s0.prototype.ka=function(){},s0.prototype.b=function(){},s0.prototype.c=function(){},s0.prototype.w=function(){};function x2(I,V){return I.then(function(fe){if(fe[ke]){var De=W4(fe[ke]);if(!De||V!=De.i)throw new b("user-mismatch");return fe}throw new b("user-mismatch")}).o(function(fe){throw fe&&fe.code&&fe.code==R+"user-not-found"?new b("user-mismatch"):fe})}function v2(I,V){if(V)this.a=V;else throw new b("internal-error","failed to construct a credential");Nr(this,"providerId",I),Nr(this,"signInMethod",I)}v2.prototype.ka=function(I){return R2(I,b2(this))},v2.prototype.b=function(I,V){var fe=b2(this);return fe.idToken=V,sz(I,fe)},v2.prototype.c=function(I,V){return x2(Ax(I,b2(this)),V)};function b2(I){return{pendingToken:I.a,requestUri:"http://localhost"}}v2.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}};function ST(I){if(I&&I.providerId&&I.signInMethod&&I.providerId.indexOf("saml.")==0&&I.pendingToken)try{return new v2(I.providerId,I.pendingToken)}catch{}return null}function np(I,V,fe){if(this.a=null,V.idToken||V.accessToken)V.idToken&&Nr(this,"idToken",V.idToken),V.accessToken&&Nr(this,"accessToken",V.accessToken),V.nonce&&!V.pendingToken&&Nr(this,"nonce",V.nonce),V.pendingToken&&(this.a=V.pendingToken);else if(V.oauthToken&&V.oauthTokenSecret)Nr(this,"accessToken",V.oauthToken),Nr(this,"secret",V.oauthTokenSecret);else throw new b("internal-error","failed to construct a credential");Nr(this,"providerId",I),Nr(this,"signInMethod",fe)}np.prototype.ka=function(I){return R2(I,Nc(this))},np.prototype.b=function(I,V){var fe=Nc(this);return fe.idToken=V,sz(I,fe)},np.prototype.c=function(I,V){var fe=Nc(this);return x2(Ax(I,fe),V)};function Nc(I){var V={};return I.idToken&&(V.id_token=I.idToken),I.accessToken&&(V.access_token=I.accessToken),I.secret&&(V.oauth_token_secret=I.secret),V.providerId=I.providerId,I.nonce&&!I.a&&(V.nonce=I.nonce),V={postBody:r9(V).toString(),requestUri:"http://localhost"},I.a&&(delete V.postBody,V.pendingToken=I.a),V}np.prototype.w=function(){var I={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(I.oauthIdToken=this.idToken),this.accessToken&&(I.oauthAccessToken=this.accessToken),this.secret&&(I.oauthTokenSecret=this.secret),this.nonce&&(I.nonce=this.nonce),this.a&&(I.pendingToken=this.a),I};function m9(I){if(I&&I.providerId&&I.signInMethod){var V={idToken:I.oauthIdToken,accessToken:I.oauthTokenSecret?null:I.oauthAccessToken,oauthTokenSecret:I.oauthTokenSecret,oauthToken:I.oauthTokenSecret&&I.oauthAccessToken,nonce:I.nonce,pendingToken:I.pendingToken};try{return new np(I.providerId,V,I.signInMethod)}catch{}}return null}function op(I,V){this.Qc=V||[],Yu(this,{providerId:I,isOAuthProvider:!0}),this.Jb={},this.qb=(C6(I)||{}).Ja||null,this.pb=null}op.prototype.Ka=function(I){return this.Jb=Ne(I),this};function pd(I){if(typeof I!="string"||I.indexOf("saml.")!=0)throw new b("argument-error",'SAML provider IDs must be prefixed with "saml."');op.call(this,I,[])}S(pd,op);function Tu(I){op.call(this,I,g9),this.a=[]}S(Tu,op),Tu.prototype.Ca=function(I){return te(this.a,I)||this.a.push(I),this},Tu.prototype.Rb=function(){return he(this.a)},Tu.prototype.credential=function(I,V){var fe;if(w(I)?fe={idToken:I.idToken||null,accessToken:I.accessToken||null,nonce:I.rawNonce||null}:fe={idToken:I||null,accessToken:V||null},!fe.idToken&&!fe.accessToken)throw new b("argument-error","credential failed: must provide the ID token and/or the access token.");return new np(this.providerId,fe,this.providerId)};function Xd(){Tu.call(this,"facebook.com")}S(Xd,Tu),Nr(Xd,"PROVIDER_ID","facebook.com"),Nr(Xd,"FACEBOOK_SIGN_IN_METHOD","facebook.com");function _f(I){if(!I)throw new b("argument-error","credential failed: expected 1 argument (the OAuth access token).");var V=I;return w(I)&&(V=I.accessToken),new Xd().credential({accessToken:V})}function a1(){Tu.call(this,"github.com")}S(a1,Tu),Nr(a1,"PROVIDER_ID","github.com"),Nr(a1,"GITHUB_SIGN_IN_METHOD","github.com");function Pu(I){if(!I)throw new b("argument-error","credential failed: expected 1 argument (the OAuth access token).");var V=I;return w(I)&&(V=I.accessToken),new a1().credential({accessToken:V})}function rp(){Tu.call(this,"google.com"),this.Ca("profile")}S(rp,Tu),Nr(rp,"PROVIDER_ID","google.com"),Nr(rp,"GOOGLE_SIGN_IN_METHOD","google.com");function ux(I,V){var fe=I;return w(I)&&(fe=I.idToken,V=I.accessToken),new rp().credential({idToken:fe,accessToken:V})}function Lm(){op.call(this,"twitter.com",p9)}S(Lm,op),Nr(Lm,"PROVIDER_ID","twitter.com"),Nr(Lm,"TWITTER_SIGN_IN_METHOD","twitter.com");function TT(I,V){var fe=I;if(w(fe)||(fe={oauthToken:I,oauthTokenSecret:V}),!fe.oauthToken||!fe.oauthTokenSecret)throw new b("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new np("twitter.com",fe,"twitter.com")}function Jd(I,V,fe){this.a=I,this.f=V,Nr(this,"providerId","password"),Nr(this,"signInMethod",fe===Ma.EMAIL_LINK_SIGN_IN_METHOD?Ma.EMAIL_LINK_SIGN_IN_METHOD:Ma.EMAIL_PASSWORD_SIGN_IN_METHOD)}Jd.prototype.ka=function(I){return this.signInMethod==Ma.EMAIL_LINK_SIGN_IN_METHOD?ka(I,Zoe,{email:this.a,oobCode:this.f}):ka(I,$4,{email:this.a,password:this.f})},Jd.prototype.b=function(I,V){return this.signInMethod==Ma.EMAIL_LINK_SIGN_IN_METHOD?ka(I,ere,{idToken:V,email:this.a,oobCode:this.f}):ka(I,Kj,{idToken:V,email:this.a,password:this.f})},Jd.prototype.c=function(I,V){return x2(this.ka(I),V)},Jd.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}};function dx(I){return I&&I.email&&I.password?new Jd(I.email,I.password,I.signInMethod):null}function Ma(){Yu(this,{providerId:"password",isOAuthProvider:!1})}function oa(I,V){if(V=Gs(V),!V)throw new b("argument-error","Invalid email link!");return new Jd(I,V.code,Ma.EMAIL_LINK_SIGN_IN_METHOD)}function Gs(I){return I=j4(I),(I=F4(I))&&I.operation===Vd?I:null}Yu(Ma,{PROVIDER_ID:"password"}),Yu(Ma,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Yu(Ma,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"});function ql(I){if(!(I.fb&&I.eb||I.La&&I.ea))throw new b("internal-error");this.a=I,Nr(this,"providerId","phone"),this.fa="phone",Nr(this,"signInMethod","phone")}ql.prototype.ka=function(I){return I.gb(_u(this))},ql.prototype.b=function(I,V){var fe=_u(this);return fe.idToken=V,ka(I,Zj,fe)},ql.prototype.c=function(I,V){var fe=_u(this);return fe.operation="REAUTH",I=ka(I,eB,fe),x2(I,V)},ql.prototype.w=function(){var I={providerId:"phone"};return this.a.fb&&(I.verificationId=this.a.fb),this.a.eb&&(I.verificationCode=this.a.eb),this.a.La&&(I.temporaryProof=this.a.La),this.a.ea&&(I.phoneNumber=this.a.ea),I};function fc(I){if(I&&I.providerId==="phone"&&(I.verificationId&&I.verificationCode||I.temporaryProof&&I.phoneNumber)){var V={};return oe(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(fe){I[fe]&&(V[fe]=I[fe])}),new ql(V)}return null}function _u(I){return I.a.La&&I.a.ea?{temporaryProof:I.a.La,phoneNumber:I.a.ea}:{sessionInfo:I.a.fb,code:I.a.eb}}function gd(I){try{this.a=I||eo.auth()}catch{throw new b("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Yu(this,{providerId:"phone",isOAuthProvider:!1})}gd.prototype.gb=function(I,V){var fe=this.a.a;return so(V.verify()).then(function(De){if(typeof De!="string")throw new b("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(V.type){case"recaptcha":var Ke=w(I)?I.session:null,Tt=w(I)?I.phoneNumber:I,Wt;return Ke&&Ke.type==w2?Wt=Ke.Ha().then(function(un){return ja(fe,{idToken:un,phoneEnrollmentInfo:{phoneNumber:Tt,recaptchaToken:De}})}):Ke&&Ke.type==i1?Wt=Ke.Ha().then(function(un){return X4(fe,{mfaPendingCredential:un,mfaEnrollmentId:I.multiFactorHint&&I.multiFactorHint.uid||I.multiFactorUid,phoneSignInInfo:{recaptchaToken:De}})}):Wt=Bc(fe,{phoneNumber:Tt,recaptchaToken:De}),Wt.then(function(un){return typeof V.reset=="function"&&V.reset(),un},function(un){throw typeof V.reset=="function"&&V.reset(),un});default:throw new b("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})};function Xs(I,V){if(!I)throw new b("missing-verification-id");if(!V)throw new b("missing-verification-code");return new ql({fb:I,eb:V})}Yu(gd,{PROVIDER_ID:"phone"}),Yu(gd,{PHONE_SIGN_IN_METHOD:"phone"});function Wm(I){if(I.temporaryProof&&I.phoneNumber)return new ql({La:I.temporaryProof,ea:I.phoneNumber});var V=I&&I.providerId;if(!V||V==="password")return null;var fe=I&&I.oauthAccessToken,De=I&&I.oauthTokenSecret,Ke=I&&I.nonce,Tt=I&&I.oauthIdToken,Wt=I&&I.pendingToken;try{switch(V){case"google.com":return ux(Tt,fe);case"facebook.com":return _f(fe);case"github.com":return Pu(fe);case"twitter.com":return TT(fe,De);default:return fe||De||Tt||Wt?Wt?V.indexOf("saml.")==0?new v2(V,Wt):new np(V,{pendingToken:Wt,idToken:I.oauthIdToken,accessToken:I.oauthAccessToken},V):new Tu(V).credential({idToken:Tt,accessToken:fe,rawNonce:Ke}):null}}catch{return null}}function Nm(I){if(!I.isOAuthProvider)throw new b("invalid-oauth-provider")}function md(I,V,fe,De,Ke,Tt,Wt){if(this.c=I,this.b=V||null,this.g=fe||null,this.f=De||null,this.i=Tt||null,this.h=Wt||null,this.a=Ke||null,this.g||this.a){if(this.g&&this.a)throw new b("invalid-auth-event");if(this.g&&!this.f)throw new b("invalid-auth-event")}else throw new b("invalid-auth-event")}md.prototype.getUid=function(){var I=[];return I.push(this.c),this.b&&I.push(this.b),this.f&&I.push(this.f),this.h&&I.push(this.h),I.join("-")},md.prototype.T=function(){return this.h},md.prototype.w=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.w()}};function B4(I){return I=I||{},I.type?new md(I.type,I.eventId,I.urlResponse,I.sessionId,I.error&&T(I.error),I.postBody,I.tenantId):null}function y9(){this.b=null,this.a=[]}var Cu=null;function fx(I){var V=Cu;V.a.push(I),V.b||(V.b=function(fe){for(var De=0;De Auth section -> Sign in method tab.",I):De=="http"||De=="https"?fe=Je("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",I):V="operation-not-supported-in-this-environment",b.call(this,V,fe)}S(S2,b);function ip(I,V,fe){b.call(this,I,fe),I=V||{},I.Kb&&Nr(this,"email",I.Kb),I.ea&&Nr(this,"phoneNumber",I.ea),I.credential&&Nr(this,"credential",I.credential),I.$b&&Nr(this,"tenantId",I.$b)}S(ip,b),ip.prototype.w=function(){var I={code:this.code,message:this.message};this.email&&(I.email=this.email),this.phoneNumber&&(I.phoneNumber=this.phoneNumber),this.tenantId&&(I.tenantId=this.tenantId);var V=this.credential&&this.credential.w();return V&&Ue(I,V),I},ip.prototype.toJSON=function(){return this.w()};function Um(I){if(I.code){var V=I.code||"";V.indexOf(R)==0&&(V=V.substring(R.length));var fe={credential:Wm(I),$b:I.tenantId};if(I.email)fe.Kb=I.email;else if(I.phoneNumber)fe.ea=I.phoneNumber;else if(!fe.credential)return new b(V,I.message||void 0);return new ip(V,fe,I.message)}return null}function jm(){}jm.prototype.c=null;function Vf(I){return I.c||(I.c=I.b())}var A9;function Gf(){}S(Gf,jm),Gf.prototype.a=function(){var I=w9(this);return I?new ActiveXObject(I):new XMLHttpRequest},Gf.prototype.b=function(){var I={};return w9(this)&&(I[0]=!0,I[1]=!0),I};function w9(I){if(!I.f&&typeof XMLHttpRequest>"u"&&typeof ActiveXObject<"u"){for(var V=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],fe=0;fe=Y4(this).value)for(y(V)&&(V=V()),I=new Ym(I,String(V),this.f),fe&&(I.a=fe),fe=this;fe;)fe=fe.a};var dg={},I6=null;function l1(I){I6||(I6=new Ru(""),dg[""]=I6,I6.c=fi);var V;if(!(V=dg[I])){V=new Ru(I);var fe=I.lastIndexOf("."),De=I.substr(fe+1);fe=l1(I.substr(0,fe)),fe.b||(fe.b={}),fe.b[De]=V,V.a=fe,dg[I]=V}return V}function $d(I,V){I&&I.log(PT,V,void 0)}function c0(I){this.f=I}S(c0,jm),c0.prototype.a=function(){return new v9(this.f)},c0.prototype.b=function(I){return function(){return I}}({});function v9(I){ps.call(this),this.u=I,this.h=void 0,this.readyState=Xf,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.l=new Headers,this.b=null,this.s="GET",this.f="",this.a=!1,this.i=l1("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}S(v9,ps);var Xf=0;t=v9.prototype,t.open=function(I,V){if(this.readyState!=Xf)throw this.abort(),Error("Error reopening a connection");this.s=I,this.f=V,this.readyState=1,_m(this)},t.send=function(I){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.a=!0;var V={headers:this.l,method:this.s,credentials:this.h,cache:void 0};I&&(V.body=I),this.u.fetch(new Request(this.f,V)).then(this.uc.bind(this),this.Va.bind(this))},t.abort=function(){this.response=this.responseText="",this.l=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&this.readyState!=4&&(this.a=!1,T2(this)),this.readyState=Xf},t.uc=function(I){this.a&&(this.g=I,this.b||(this.status=this.g.status,this.statusText=this.g.statusText,this.b=I.headers,this.readyState=2,_m(this)),this.a&&(this.readyState=3,_m(this),this.a&&(this.responseType==="arraybuffer"?I.arrayBuffer().then(this.sc.bind(this),this.Va.bind(this)):typeof s.ReadableStream<"u"&&"body"in I?(this.response=this.responseText="",this.c=I.body.getReader(),this.m=new TextDecoder,z6(this)):I.text().then(this.tc.bind(this),this.Va.bind(this)))))};function z6(I){I.c.read().then(I.pc.bind(I)).catch(I.Va.bind(I))}t.pc=function(I){if(this.a){var V=this.m.decode(I.value?I.value:new Uint8Array(0),{stream:!I.done});V&&(this.response=this.responseText+=V),I.done?T2(this):_m(this),this.readyState==3&&z6(this)}},t.tc=function(I){this.a&&(this.response=this.responseText=I,T2(this))},t.sc=function(I){this.a&&(this.response=I,T2(this))},t.Va=function(I){var V=this.i;V&&V.log(Om,"Failed to fetch url "+this.f,I instanceof Error?I:Error(I)),this.a&&T2(this)};function T2(I){I.readyState=4,I.g=null,I.c=null,I.m=null,_m(I)}t.setRequestHeader=function(I,V){this.l.append(I,V)},t.getResponseHeader=function(I){return this.b?this.b.get(I.toLowerCase())||"":((I=this.i)&&I.log(Om,"Attempting to get response header but no headers have been received for url: "+this.f,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var I=this.i;return I&&I.log(Om,"Attempting to get all response headers but no headers have been received for url: "+this.f,void 0),""}I=[];for(var V=this.b.entries(),fe=V.next();!fe.done;)fe=fe.value,I.push(fe[0]+": "+fe[1]),fe=V.next();return I.join(`\r -`)};function _m(I){I.onreadystatechange&&I.onreadystatechange.call(I)}Object.defineProperty(v9.prototype,"withCredentials",{get:function(){return this.h==="include"},set:function(I){this.h=I?"include":"same-origin"}});function Uc(I){ps.call(this),this.headers=new ou,this.D=I||null,this.c=!1,this.C=this.a=null,this.h=this.P=this.l="",this.f=this.N=this.i=this.J=!1,this.g=0,this.s=null,this.m=fg,this.u=this.S=!1}S(Uc,ps);var fg="";Uc.prototype.b=l1("goog.net.XhrIo");var hx=/^https?$/i,px=["POST","PUT"];function D6(I,V,fe,De,Ke){if(I.a)throw Error("[goog.net.XhrIo] Object is active with another request="+I.l+"; newUri="+V);fe=fe?fe.toUpperCase():"GET",I.l=V,I.h="",I.P=fe,I.J=!1,I.c=!0,I.a=I.D?I.D.a():A9.a(),I.C=I.D?Vf(I.D):Vf(A9),I.a.onreadystatechange=P(I.Wb,I);try{$d(I.b,Kf(I,"Opening Xhr")),I.N=!0,I.a.open(fe,String(V),!0),I.N=!1}catch(Wt){$d(I.b,Kf(I,"Error opening Xhr: "+Wt.message)),hg(I,Wt);return}V=De||"";var Tt=new ou(I.headers);Ke&&a0(Ke,function(Wt,un){Tt.set(un,Wt)}),Ke=ne(Tt.Y()),De=s.FormData&&V instanceof s.FormData,!te(px,fe)||Ke||De||Tt.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),Tt.forEach(function(Wt,un){this.a.setRequestHeader(un,Wt)},I),I.m&&(I.a.responseType=I.m),"withCredentials"in I.a&&I.a.withCredentials!==I.S&&(I.a.withCredentials=I.S);try{mx(I),0=V.l&&V.cancel())}this.u?this.u.call(this.s,this):this.v=!0,this.a||(I=new jc,b9(this),u0(this,!1,I))}},P2.prototype.m=function(I,V){this.i=!1,u0(this,I,V)};function u0(I,V,fe){I.a=!0,I.c=fe,I.f=!V,pg(I)}function b9(I){if(I.a){if(!I.v)throw new Gm;I.v=!1}}function CT(I,V){lp(I,null,V,void 0)}function lp(I,V,fe,De){I.g.push([V,fe,De]),I.a&&pg(I)}P2.prototype.then=function(I,V,fe){var De,Ke,Tt=new Go(function(Wt,un){De=Wt,Ke=un});return lp(this,De,function(Wt){Wt instanceof jc?Tt.cancel():Ke(Wt)}),Tt.then(I,V,fe)},P2.prototype.$goog_Thenable=!0;function F6(I){return Z(I.g,function(V){return y(V[1])})}function pg(I){if(I.h&&I.a&&F6(I)){var V=I.h,fe=O4[V];fe&&(s.clearTimeout(fe.a),delete O4[V]),I.h=0}I.b&&(I.b.l--,delete I.b),V=I.c;for(var De=fe=!1;I.g.length&&!I.i;){var Ke=I.g.shift(),Tt=Ke[0],Wt=Ke[1];if(Ke=Ke[2],Tt=I.f?Wt:Tt)try{var un=Tt.call(Ke||I.s,V);un!==void 0&&(I.f=I.f&&(un==V||un instanceof Error),I.c=V=un),(U(V)||typeof s.Promise=="function"&&V instanceof s.Promise)&&(De=!0,I.i=!0)}catch(po){V=po,I.f=!0,F6(I)||(fe=!0)}}I.c=V,De&&(un=P(I.m,I,!0),De=P(I.m,I,!1),V instanceof P2?(lp(V,un,De),V.C=!0):V.then(un,De)),fe&&(V=new qd(V),O4[V.a]=V,I.h=V.a)}function Gm(){W.call(this)}S(Gm,W),Gm.prototype.message="Deferred has already fired",Gm.prototype.name="AlreadyCalledError";function jc(){W.call(this)}S(jc,W),jc.prototype.message="Deferred was canceled",jc.prototype.name="CanceledError";function qd(I){this.a=s.setTimeout(P(this.c,this),0),this.b=I}qd.prototype.c=function(){throw delete O4[this.a],this.b};var O4={};function _4(I){var V={},fe=V.document||document,De=ht(I).toString(),Ke=xo(document,"SCRIPT"),Tt={Xb:Ke,Ma:void 0},Wt=new P2(Tt),un=null,po=V.timeout!=null?V.timeout:5e3;return 0"u"||typeof s.Headers>"u"||typeof s.Request>"u"))throw new b("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var Wt=new Uc(this.f);if(Tt){Wt.g=Math.max(0,Tt);var un=setTimeout(function(){Wt.dispatchEvent("timeout")},Tt)}ud(Wt,"complete",function(){un&&clearTimeout(un);var po=null;try{po=JSON.parse(yx(this))||null}catch{po=null}V&&V(po)}),Mm(Wt,"ready",function(){un&&clearTimeout(un),qp(this)}),Mm(Wt,"timeout",function(){un&&clearTimeout(un),qp(this),V&&V(null)}),D6(Wt,I,fe,De,Ke)};var Fl=new Fe(Ye,"https://apis.google.com/js/client.js?onload=%{onload}"),Jr="__fcb"+Math.floor(1e6*Math.random()).toString();function d0(I,V){if(((window.gapi||{}).client||{}).request)I();else{s[Jr]=function(){((window.gapi||{}).client||{}).request?I():V(Error("CORS_UNSUPPORTED"))};var fe=Qe(Fl,{onload:Jr});CT(_4(fe),function(){V(Error("CORS_UNSUPPORTED"))})}}K.prototype.s=function(I,V,fe,De,Ke){var Tt=this;be.then(function(){window.gapi.client.setApiKey(Tt.c);var Wt=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:I,method:fe,body:De,headers:Ke,authType:"none",callback:function(un){window.gapi.auth.setToken(Wt),V&&V(un)}})}).o(function(Wt){V&&V({error:{message:Wt&&Wt.message||"CORS_UNSUPPORTED"}})})};function Qd(I,V){return new Go(function(fe,De){V.grant_type=="refresh_token"&&V.refresh_token||V.grant_type=="authorization_code"&&V.code?ni(I,I.l+"?key="+encodeURIComponent(I.c),function(Ke){Ke?Ke.error?De(M2(Ke)):Ke.access_token&&Ke.refresh_token?fe(Ke):De(new b("internal-error")):De(new b("network-request-failed"))},"POST",r9(V).toString(),I.g,I.m.get()):De(new b("internal-error"))})}function Yn(I,V,fe,De,Ke,Tt,Wt){var un=iu(V+fe);va(un,"key",I.c),Wt&&va(un,"cb",Date.now().toString());var po=De=="GET";if(po)for(var Fo in Ke)Ke.hasOwnProperty(Fo)&&va(un,Fo,Ke[Fo]);return new Go(function(Bi,Zl){ni(I,un.toString(),function(Al){Al?Al.error?Zl(M2(Al,Tt||{})):Bi(Al):Zl(new b("network-request-failed"))},De,po?void 0:p2(tg(Ke)),I.a,I.v.get())})}function zn(I){if(I=I.email,typeof I!="string"||!L0.test(I))throw new b("invalid-email")}function Kn(I){"email"in I&&zn(I)}function Cr(I,V){return ka(I,_j,{identifier:V,continueUri:a9()?lo():"http://localhost"}).then(function(fe){return fe.signinMethods||[]})}function Kr(I){return ka(I,rre,{}).then(function(V){return V.authorizedDomains||[]})}function ci(I){if(!I[ke])throw I.mfaPendingCredential?new b("multi-factor-auth-required",null,Ne(I)):new b("internal-error")}function ki(I){if(I.phoneNumber||I.temporaryProof){if(!I.phoneNumber||!I.temporaryProof)throw new b("internal-error")}else{if(!I.sessionInfo)throw new b("missing-verification-id");if(!I.code)throw new b("missing-verification-code")}}K.prototype.Ab=function(){return ka(this,ire,{})},K.prototype.Cb=function(I,V){return ka(this,Jj,{idToken:I,email:V})},K.prototype.Db=function(I,V){return ka(this,Kj,{idToken:I,password:V})};var la={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};t=K.prototype,t.Eb=function(I,V){var fe={idToken:I},De=[];return Te(la,function(Ke,Tt){var Wt=V[Tt];Wt===null?De.push(Ke):Tt in V&&(fe[Tt]=Wt)}),De.length&&(fe.deleteAttribute=De),ka(this,Jj,fe)},t.wb=function(I,V){return I={requestType:"PASSWORD_RESET",email:I},Ue(I,V),ka(this,ore,I)},t.xb=function(I,V){return I={requestType:"EMAIL_SIGNIN",email:I},Ue(I,V),ka(this,cz,I)},t.vb=function(I,V){return I={requestType:"VERIFY_EMAIL",idToken:I},Ue(I,V),ka(this,nre,I)},t.Fb=function(I,V,fe){return I={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:I,newEmail:V},Ue(I,fe),ka(this,uz,I)};function Bc(I,V){return ka(I,Xj,V)}t.gb=function(I){return ka(this,fz,I)};function ja(I,V){return ka(I,are,V).then(function(fe){return fe.phoneSessionInfo.sessionInfo})}function sp(I){if(!I.phoneVerificationInfo)throw new b("internal-error");if(!I.phoneVerificationInfo.sessionInfo)throw new b("missing-verification-id");if(!I.phoneVerificationInfo.code)throw new b("missing-verification-code")}function X4(I,V){return ka(I,$j,V).then(function(fe){return fe.phoneResponseInfo.sessionInfo})}function J4(I,V,fe){return ka(I,Vj,{idToken:V,deleteProvider:fe})}function mi(I){if(!I.requestUri||!I.sessionId&&!I.postBody&&!I.pendingToken)throw new b("internal-error")}function K4(I,V){return V.oauthIdToken&&V.providerId&&V.providerId.indexOf("oidc.")==0&&!V.pendingToken&&(I.sessionId?V.nonce=I.sessionId:I.postBody&&(I=new jf(I.postBody),zm(I,"nonce")&&(V.nonce=I.get("nonce")))),V}function RT(I){var V=null;if(I.needConfirmation?(I.code="account-exists-with-different-credential",V=Um(I)):I.errorMessage=="FEDERATED_USER_ID_ALREADY_LINKED"?(I.code="credential-already-in-use",V=Um(I)):I.errorMessage=="EMAIL_EXISTS"?(I.code="email-already-in-use",V=Um(I)):I.errorMessage&&(V=gg(I.errorMessage)),V)throw V;ci(I)}function R2(I,V){return V.returnIdpCredential=!0,ka(I,qj,V)}function sz(I,V){return V.returnIdpCredential=!0,ka(I,dz,V)}function Ax(I,V){return V.returnIdpCredential=!0,V.autoCreate=!1,ka(I,lre,V)}function HT(I){if(!I.oobCode)throw new b("invalid-action-code")}t.ob=function(I,V){return ka(this,Gj,{oobCode:I,newPassword:V})},t.Sa=function(I){return ka(this,$oe,{oobCode:I})},t.kb=function(I){return ka(this,Ad,{oobCode:I})};var Ad={endpoint:"setAccountInfo",A:HT,Z:"email",B:!0},$oe={endpoint:"resetPassword",A:HT,G:function(I){var V=I.requestType;if(!V||!I.email&&V!="EMAIL_SIGNIN"&&V!="VERIFY_AND_CHANGE_EMAIL")throw new b("internal-error")},B:!0},qoe={endpoint:"signupNewUser",A:function(I){if(zn(I),!I.password)throw new b("weak-password")},G:ci,V:!0,B:!0},_j={endpoint:"createAuthUri",B:!0},Qoe={endpoint:"deleteAccount",O:["idToken"]},Vj={endpoint:"setAccountInfo",O:["idToken","deleteProvider"],A:function(I){if(!Array.isArray(I.deleteProvider))throw new b("internal-error")}},Zoe={endpoint:"emailLinkSignin",O:["email","oobCode"],A:zn,G:ci,V:!0,B:!0},ere={endpoint:"emailLinkSignin",O:["idToken","email","oobCode"],A:zn,G:ci,V:!0},tre={endpoint:"accounts/mfaEnrollment:finalize",O:["idToken","phoneVerificationInfo"],A:sp,G:ci,B:!0,Na:!0},H2={endpoint:"accounts/mfaSignIn:finalize",O:["mfaPendingCredential","phoneVerificationInfo"],A:sp,G:ci,B:!0,Na:!0},Zd={endpoint:"getAccountInfo"},cz={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="EMAIL_SIGNIN")throw new b("internal-error");zn(I)},Z:"email",B:!0},nre={endpoint:"getOobConfirmationCode",O:["idToken","requestType"],A:function(I){if(I.requestType!="VERIFY_EMAIL")throw new b("internal-error")},Z:"email",B:!0},uz={endpoint:"getOobConfirmationCode",O:["idToken","newEmail","requestType"],A:function(I){if(I.requestType!="VERIFY_AND_CHANGE_EMAIL")throw new b("internal-error")},Z:"email",B:!0},ore={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="PASSWORD_RESET")throw new b("internal-error");zn(I)},Z:"email",B:!0},rre={mb:!0,endpoint:"getProjectConfig",Vb:"GET"},wx={mb:!0,endpoint:"getRecaptchaParam",Vb:"GET",G:function(I){if(!I.recaptchaSiteKey)throw new b("internal-error")}},Gj={endpoint:"resetPassword",A:HT,Z:"email",B:!0},Xj={endpoint:"sendVerificationCode",O:["phoneNumber","recaptchaToken"],Z:"sessionInfo",B:!0},Jj={endpoint:"setAccountInfo",O:["idToken"],A:Kn,V:!0},Kj={endpoint:"setAccountInfo",O:["idToken"],A:function(I){if(Kn(I),!I.password)throw new b("weak-password")},G:ci,V:!0},ire={endpoint:"signupNewUser",G:ci,V:!0,B:!0},are={endpoint:"accounts/mfaEnrollment:start",O:["idToken","phoneEnrollmentInfo"],A:function(I){if(!I.phoneEnrollmentInfo)throw new b("internal-error");if(!I.phoneEnrollmentInfo.phoneNumber)throw new b("missing-phone-number");if(!I.phoneEnrollmentInfo.recaptchaToken)throw new b("missing-app-credential")},G:function(I){if(!I.phoneSessionInfo||!I.phoneSessionInfo.sessionInfo)throw new b("internal-error")},B:!0,Na:!0},$j={endpoint:"accounts/mfaSignIn:start",O:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(I){if(!I.phoneSignInInfo||!I.phoneSignInInfo.recaptchaToken)throw new b("missing-app-credential")},G:function(I){if(!I.phoneResponseInfo||!I.phoneResponseInfo.sessionInfo)throw new b("internal-error")},B:!0,Na:!0},qj={endpoint:"verifyAssertion",A:mi,Za:K4,G:RT,V:!0,B:!0},lre={endpoint:"verifyAssertion",A:mi,Za:K4,G:function(I){if(I.errorMessage&&I.errorMessage=="USER_NOT_FOUND")throw new b("user-not-found");if(I.errorMessage)throw gg(I.errorMessage);ci(I)},V:!0,B:!0},dz={endpoint:"verifyAssertion",A:function(I){if(mi(I),!I.idToken)throw new b("internal-error")},Za:K4,G:RT,V:!0},Qj={endpoint:"verifyCustomToken",A:function(I){if(!I.token)throw new b("invalid-custom-token")},G:ci,V:!0,B:!0},$4={endpoint:"verifyPassword",A:function(I){if(zn(I),!I.password)throw new b("wrong-password")},G:ci,V:!0,B:!0},fz={endpoint:"verifyPhoneNumber",A:ki,G:ci,B:!0},Zj={endpoint:"verifyPhoneNumber",A:function(I){if(!I.idToken)throw new b("internal-error");ki(I)},G:function(I){if(I.temporaryProof)throw I.code="credential-already-in-use",Um(I);ci(I)}},eB={Ib:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:ki,G:ci,B:!0},MT={endpoint:"accounts/mfaEnrollment:withdraw",O:["idToken","mfaEnrollmentId"],G:function(I){if(!!I[ke]^!!I.refreshToken)throw new b("internal-error")},B:!0,Na:!0};function ka(I,V,fe){if(!v6(fe,V.O))return zo(new b("internal-error"));var De=!!V.Na,Ke=V.Vb||"POST",Tt;return so(fe).then(V.A).then(function(){return V.V&&(fe.returnSecureToken=!0),V.B&&I.b&&typeof fe.tenantId>"u"&&(fe.tenantId=I.b),De?Yn(I,I.i,V.endpoint,Ke,fe,V.Ib,V.mb||!1):Yn(I,I.h,V.endpoint,Ke,fe,V.Ib,V.mb||!1)}).then(function(Wt){return Tt=Wt,V.Za?V.Za(fe,Tt):Tt}).then(V.G).then(function(){if(!V.Z)return Tt;if(!(V.Z in Tt))throw new b("internal-error");return Tt[V.Z]})}function gg(I){return M2({error:{errors:[{message:I}],code:400,message:I}})}function M2(I,V){var fe=(I.error&&I.error.errors&&I.error.errors[0]||{}).reason||"",De={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(fe=De[fe]?new b(De[fe]):null)return fe;fe=I.error&&I.error.message||"",De={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation",INVALID_TENANT_ID:"invalid-tenant-id",TENANT_ID_MISMATCH:"tenant-id-mismatch",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",EMAIL_CHANGE_NEEDS_VERIFICATION:"email-change-needs-verification",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",UNSUPPORTED_FIRST_FACTOR:"unsupported-first-factor",UNVERIFIED_EMAIL:"unverified-email"},Ue(De,V||{}),V=(V=fe.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1"u"&&delete un[po]}),I.ports[0].postMessage({status:"done",eventId:fe,eventType:V,response:Wt})})}};function aB(I,V,fe){Re(I.a)&&I.b.addEventListener("message",I.f),typeof I.a[V]>"u"&&(I.a[V]=[]),I.a[V].push(fe)}function lB(I){this.a=I}lB.prototype.postMessage=function(I,V){this.a.postMessage(I,V)};function sB(I){this.c=I,this.b=!1,this.a=[]}function cp(I,V,fe,De){var Ke,Tt=fe||{},Wt,un,po,Fo=null;if(I.b)return zo(Error("connection_unavailable"));var Bi=De?800:50,Zl=typeof MessageChannel<"u"?new MessageChannel:null;return new Go(function(Al,Mu){Zl?(Ke=Math.floor(Math.random()*Math.pow(10,20)).toString(),Zl.port1.start(),un=setTimeout(function(){Mu(Error("unsupported_event"))},Bi),Wt=function(yg){yg.data.eventId===Ke&&(yg.data.status==="ack"?(clearTimeout(un),po=setTimeout(function(){Mu(Error("timeout"))},3e3)):yg.data.status==="done"?(clearTimeout(po),typeof yg.data.response<"u"?Al(yg.data.response):Mu(Error("unknown_error"))):(clearTimeout(un),clearTimeout(po),Mu(Error("invalid_response"))))},Fo={messageChannel:Zl,onMessage:Wt},I.a.push(Fo),Zl.port1.addEventListener("message",Wt),I.c.postMessage({eventType:V,eventId:Ke,data:Tt},[Zl.port2])):Mu(Error("connection_unavailable"))}).then(function(Al){return wz(I,Fo),Al}).o(function(Al){throw wz(I,Fo),Al})}function wz(I,V){if(V){var fe=V.messageChannel,De=V.onMessage;fe&&(fe.port1.removeEventListener("message",De),fe.port1.close()),le(I.a,function(Ke){return Ke==V})}}sB.prototype.close=function(){for(;0"u"&&(De=null);var Ke=s.localStorage.getItem(fe);Ke!==De&&(this.b[fe]=Ke,this.nb(fe))}else if(V.indexOf("firebase:")==0&&this.a[V]){if(typeof I.a.a<"u"?U6(this,"local").ia(this.f):Hz(this),this.m){if(fe=s.localStorage.getItem(V),De=I.a.newValue,De!==fe)De!==null?s.localStorage.setItem(V,De):s.localStorage.removeItem(V);else if(this.b[V]===De&&typeof I.a.a>"u")return}var Tt=this;fe=function(){(typeof I.a.a<"u"||Tt.b[V]!==s.localStorage.getItem(V))&&(Tt.b[V]=s.localStorage.getItem(V),Tt.nb(V))},Be&&to&&to==10&&s.localStorage.getItem(V)!==I.a.newValue&&I.a.newValue!==I.a.oldValue?setTimeout(fe,10):fe()}}else oe(I,P(this.nb,this))},t.nb=function(I){this.a[I]&&oe(this.a[I],function(V){V()})};function ET(I){this.a=I,this.b=Sx()}var Mz={name:"authEvent",F:"local"};function Rre(I){return I.b.get(Mz,I.a).then(function(V){return B4(V)})}function Hre(){this.a=Sx()}function Mre(){this.b=-1}function kT(I,V){this.b=xB,this.f=s.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=I,this.h=V,this.l=s.Int32Array?new Int32Array(64):Array(64),FT===void 0&&(s.Int32Array?FT=new Int32Array(SB):FT=SB),this.reset()}var FT;S(kT,Mre);for(var xB=64,Ire=xB-1,vB=[],Iz=0;IzV;V++){Ke=fe[V-15]|0,De=fe[V-2]|0;var Tt=(fe[V-16]|0)+((Ke>>>7|Ke<<25)^(Ke>>>18|Ke<<14)^Ke>>>3)|0,Wt=(fe[V-7]|0)+((De>>>17|De<<15)^(De>>>19|De<<13)^De>>>10)|0;fe[V]=Tt+Wt|0}De=I.a[0]|0,Ke=I.a[1]|0;var un=I.a[2]|0,po=I.a[3]|0,Fo=I.a[4]|0,Bi=I.a[5]|0,Zl=I.a[6]|0;for(Tt=I.a[7]|0,V=0;64>V;V++){var Al=((De>>>2|De<<30)^(De>>>13|De<<19)^(De>>>22|De<<10))+(De&Ke^De&un^Ke&un)|0;Wt=Fo&Bi^~Fo&Zl,Tt=Tt+((Fo>>>6|Fo<<26)^(Fo>>>11|Fo<<21)^(Fo>>>25|Fo<<7))|0,Wt=Wt+(FT[V]|0)|0,Wt=Tt+(Wt+(fe[V]|0)|0)|0,Tt=Zl,Zl=Bi,Bi=Fo,Fo=po+Wt|0,po=un,un=Ke,Ke=De,De=Wt+Al|0}I.a[0]=I.a[0]+De|0,I.a[1]=I.a[1]+Ke|0,I.a[2]=I.a[2]+un|0,I.a[3]=I.a[3]+po|0,I.a[4]=I.a[4]+Fo|0,I.a[5]=I.a[5]+Bi|0,I.a[6]=I.a[6]+Zl|0,I.a[7]=I.a[7]+Tt|0}function Dz(I,V,fe){fe===void 0&&(fe=V.length);var De=0,Ke=I.c;if(typeof V=="string")for(;De=Tt&&Tt==(Tt|0)))throw Error("message must be a byte array");I.f[Ke++]=Tt,Ke==I.b&&(zz(I),Ke=0)}else throw Error("message must be string or array");I.c=Ke,I.g+=fe}var SB=[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 TB(){kT.call(this,8,zre)}S(TB,kT);var zre=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function Ez(I,V,fe,De,Ke,Tt){this.v=I,this.i=V,this.l=fe,this.m=De||null,this.u=Ke||null,this.s=Tt,this.h=V+":"+fe,this.C=new Hre,this.g=new ET(this.h),this.f=null,this.b=[],this.a=this.c=null}function Tx(I){return new b("invalid-cordova-configuration",I)}t=Ez.prototype,t.ma=function(){return this.Ia?this.Ia:this.Ia=y6().then(function(){if(typeof kl("universalLinks.subscribe",s)!="function")throw Tx("cordova-universal-links-plugin-fix is not installed");if(typeof kl("BuildInfo.packageName",s)>"u")throw Tx("cordova-plugin-buildinfo is not installed");if(typeof kl("cordova.plugins.browsertab.openUrl",s)!="function")throw Tx("cordova-plugin-browsertab is not installed");if(typeof kl("cordova.InAppBrowser.open",s)!="function")throw Tx("cordova-plugin-inappbrowser is not installed")},function(){throw new b("cordova-not-ready")})};function Dre(){for(var I=20,V=[];0V.c?Dz(V,bB,56-V.c):Dz(V,bB,V.b-(V.c-56));for(var De=63;56<=De;De--)V.f[De]=fe&255,fe/=256;for(zz(V),De=fe=0;De>Ke&255;return bT(I)}t.Pb=function(I,V){return V(new b("operation-not-supported-in-this-environment")),so()},t.Nb=function(){return zo(new b("operation-not-supported-in-this-environment"))},t.ac=function(){return!1},t.Yb=function(){return!0},t.Ub=function(){return!0},t.Ob=function(I,V,fe,De){if(this.c)return zo(new b("redirect-operation-pending"));var Ke=this,Tt=s.document,Wt=null,un=null,po=null,Fo=null;return this.c=so().then(function(){return Nm(V),Px(Ke)}).then(function(){return kre(Ke,I,V,fe,De)}).then(function(){return new Go(function(Bi,Zl){un=function(){var Al=kl("cordova.plugins.browsertab.close",s);return Bi(),typeof Al=="function"&&Al(),Ke.a&&typeof Ke.a.close=="function"&&(Ke.a.close(),Ke.a=null),!1},Ke.Ea(un),po=function(){Wt||(Wt=ju(2e3).then(function(){Zl(new b("redirect-cancelled-by-user"))}))},Fo=function(){y2()&&po()},Tt.addEventListener("resume",po,!1),gs().toLowerCase().match(/android/)||Tt.addEventListener("visibilitychange",Fo,!1)}).o(function(Bi){return kz(Ke).then(function(){throw Bi})})}).oa(function(){po&&Tt.removeEventListener("resume",po,!1),Fo&&Tt.removeEventListener("visibilitychange",Fo,!1),Wt&&Wt.cancel(),un&&Ke.Ta(un),Ke.c=null})};function kre(I,V,fe,De,Ke){var Tt=Dre(),Wt=new md(V,De,null,Tt,new b("no-auth-event"),null,Ke),un=kl("BuildInfo.packageName",s);if(typeof un!="string")throw new b("invalid-cordova-configuration");var po=kl("BuildInfo.displayName",s),Fo={};if(gs().toLowerCase().match(/iphone|ipad|ipod/))Fo.ibi=un;else if(gs().toLowerCase().match(/android/))Fo.apn=un;else return zo(new b("operation-not-supported-in-this-environment"));po&&(Fo.appDisplayName=po),Tt=Ere(Tt),Fo.sessionId=Tt;var Bi=xx(I.v,I.i,I.l,V,fe,null,De,I.m,Fo,I.u,Ke,I.s);return I.ma().then(function(){var Zl=I.h;return I.C.a.set(Mz,Wt.w(),Zl)}).then(function(){var Zl=kl("cordova.plugins.browsertab.isAvailable",s);if(typeof Zl!="function")throw new b("invalid-cordova-configuration");var Al=null;Zl(function(Mu){if(Mu){if(Al=kl("cordova.plugins.browsertab.openUrl",s),typeof Al!="function")throw new b("invalid-cordova-configuration");Al(Bi)}else{if(Al=kl("cordova.InAppBrowser.open",s),typeof Al!="function")throw new b("invalid-cordova-configuration");Mu=gs(),I.a=Al(Bi,Mu.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||Mu.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}})})}function PB(I,V){for(var fe=0;feI.f&&(I.a=I.f),V)}function Vz(I,V){I.stop(),I.b=ju(Gre(I,V)).then(function(){return x6()}).then(function(){return I.h()}).then(function(){Vz(I,!0)}).o(function(fe){I.i(fe)&&Vz(I,!1)})}Xm.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)};function Gz(I){this.f=I,this.b=this.a=null,this.c=Date.now()}Gz.prototype.w=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:this.c}};function WB(I,V){typeof V>"u"&&(I.b?(V=I.b,V=V.a-V.g):V=0),I.c=Date.now()+1e3*V}function NB(I,V){I.b=W4(V[ke]||""),I.a=V.refreshToken,V=V.expiresIn,WB(I,typeof V<"u"?Number(V):void 0)}function Xz(I,V){I.b=V.b,I.a=V.a,I.c=V.c}function Xre(I,V){return Qd(I.f,V).then(function(fe){return I.b=W4(fe.access_token),I.a=fe.refresh_token,WB(I,fe.expires_in),{accessToken:I.b.toString(),refreshToken:I.a}}).o(function(fe){throw fe.code=="auth/user-token-expired"&&(I.a=null),fe})}Gz.prototype.getToken=function(I){return I=!!I,this.b&&!this.a?zo(new b("user-token-expired")):I||!this.b||Date.now()>this.c-3e4?this.a?Xre(this,{grant_type:"refresh_token",refresh_token:this.a}):so(null):so({accessToken:this.b.toString(),refreshToken:this.a})};function c1(I,V){this.a=I||null,this.b=V||null,Yu(this,{lastSignInTime:og(V||null),creationTime:og(I||null)})}function UB(I){return new c1(I.a,I.b)}c1.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}};function OT(I,V,fe,De,Ke,Tt){Yu(this,{uid:I,displayName:De||null,photoURL:Ke||null,email:fe||null,phoneNumber:Tt||null,providerId:V})}function Xa(I,V,fe){this.N=[],this.l=I.apiKey,this.m=I.appName,this.s=I.authDomain||null;var De=eo.SDK_VERSION?n1(eo.SDK_VERSION):null;this.a=new K(this.l,k(N),De),(this.u=I.emulatorConfig||null)&&Xo(this.a,this.u),this.h=new Gz(this.a),Y6(this,V[ke]),NB(this.h,V),Nr(this,"refreshToken",this.h.a),Hx(this,fe||{}),ps.call(this),this.P=!1,this.s&&qh()&&(this.b=jz(this.s,this.l,this.m,this.u)),this.W=[],this.i=null,this.D=Jre(this),this.ba=P(this.ib,this);var Ke=this;this.za=null,this.Pa=function(Tt){Ke.xa(Tt.h)},this.qa=null,this.Ba=function(Tt){Js(Ke,Tt.c)},this.$=null,this.aa=[],this.Oa=function(Tt){Rx(Ke,Tt.f)},this.ja=null,this.S=new wd(this,fe),Nr(this,"multiFactor",this.S)}S(Xa,ps),Xa.prototype.xa=function(I){this.za=I,io(this.a,I)};function Js(I,V){I.u=V,Xo(I.a,V),I.b&&(V=I.b,I.b=jz(I.s,I.l,I.m,I.u),I.P&&(Wz(V,I),j6(I.b,I)))}Xa.prototype.la=function(){return this.za};function _T(I,V){I.qa&&go(I.qa,"languageCodeChanged",I.Pa),(I.qa=V)&&Tn(V,"languageCodeChanged",I.Pa)}function Jz(I,V){I.$&&go(I.$,"emulatorConfigChanged",I.Ba),(I.$=V)&&Tn(V,"emulatorConfigChanged",I.Ba)}function Rx(I,V){I.aa=V,Ei(I.a,eo.SDK_VERSION?n1(eo.SDK_VERSION,I.aa):null)}Xa.prototype.Ga=function(){return he(this.aa)};function Kz(I,V){I.ja&&go(I.ja,"frameworkChanged",I.Oa),(I.ja=V)&&Tn(V,"frameworkChanged",I.Oa)}Xa.prototype.ib=function(){this.D.b&&(this.D.stop(),this.D.start())};function $z(I){try{return eo.app(I.m).auth()}catch{throw new b("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+I.m+"'!")}}function Jre(I){return new Xm(function(){return I.I(!0)},function(V){return!!(V&&V.code=="auth/network-request-failed")},function(){var V=I.h.c-Date.now()-3e5;return 0"u"||Re(I)?{}:h9(new S6(I))}).then(function(De){return V.a.vb(fe,De)}).then(function(De){if(V.email!=De)return V.reload()}).then(function(){}))},t.Fb=function(I,V){var fe=this,De=null;return Yc(this,this.I().then(function(Ke){return De=Ke,typeof V>"u"||Re(V)?{}:h9(new S6(V))}).then(function(Ke){return fe.a.Fb(De,I,Ke)}).then(function(Ke){if(fe.email!=Ke)return fe.reload()}).then(function(){}))};function Yc(I,V,fe){var De=Kre(I,V,fe);return I.N.push(De),De.oa(function(){$(I.N,De)}),De.o(function(Ke){var Tt=null;throw Ke&&Ke.code==="auth/multi-factor-auth-required"&&(Tt=LB(Ke.w(),$z(I),P(I.jc,I))),Tt||Ke})}t.jc=function(I){var V=null,fe=this;return I=x2(so(I),fe.uid).then(function(De){return V=nw(fe,De,"reauthenticate"),f0(fe,De),fe.i=null,fe.reload()}).then(function(){return V}),Yc(this,I,!0)};function Kre(I,V,fe){return I.i&&!fe?(V.cancel(),zo(I.i)):V.o(function(De){throw!De||De.code!="auth/user-disabled"&&De.code!="auth/user-token-expired"||(I.i||I.dispatchEvent(new ew("userInvalidated")),I.i=De),De})}t.toJSON=function(){return this.w()},t.w=function(){var I={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.s,stsTokenManager:this.h.w(),redirectEventId:this.ga||null};return this.metadata&&Ue(I,this.metadata.w()),oe(this.providerData,function(V){I.providerData.push(s9(V))}),Ue(I,this.S.w()),I};function VB(I){if(!I.apiKey)return null;var V={apiKey:I.apiKey,authDomain:I.authDomain,appName:I.appName,emulatorConfig:I.emulatorConfig},fe={};if(I.stsTokenManager&&I.stsTokenManager.accessToken){fe[ke]=I.stsTokenManager.accessToken,fe.refreshToken=I.stsTokenManager.refreshToken||null;var De=I.stsTokenManager.expirationTime;De&&(fe.expiresIn=(De-Date.now())/1e3)}else return null;var Ke=new Xa(V,fe,I);return I.providerData&&oe(I.providerData,function(Tt){Tt&&Zz(Ke,Qh(Tt))}),I.redirectEventId&&(Ke.ga=I.redirectEventId),Ke}function $re(I,V,fe,De){var Ke=new Xa(I,V);return fe&&(Ke.ha=fe),De&&Rx(Ke,De),Ke.reload().then(function(){return Ke})}function qre(I,V,fe,De){var Ke=I.h,Tt={};return Tt[ke]=Ke.b&&Ke.b.toString(),Tt.refreshToken=Ke.a,V=new Xa(V||{apiKey:I.l,authDomain:I.s,appName:I.m},Tt),fe&&(V.ha=fe),De&&Rx(V,De),GT(V,I),V}function Qre(I){this.a=I,this.b=Sx()}var tD={name:"redirectUser",F:"session"};function GB(I){return Z4(I.b,tD,I.a)}function Zre(I,V){return I.b.get(tD,I.a).then(function(fe){return fe&&V&&(fe.authDomain=V),VB(fe||{})})}function nD(I){this.a=I,this.b=Sx(),this.c=null,this.f=eie(this),this.b.addListener(Jm("local"),this.a,P(this.g,this))}nD.prototype.g=function(){var I=this,V=Jm("local");ow(this,function(){return so().then(function(){return I.c&&I.c.F!="local"?I.b.get(V,I.a):null}).then(function(fe){if(fe)return oD(I,"local").then(function(){I.c=V})})})};function oD(I,V){var fe=[],De;for(De in N6)N6[De]!==V&&fe.push(Z4(I.b,Jm(N6[De]),I.a));return fe.push(Z4(I.b,rD,I.a)),ea(fe)}function eie(I){var V=Jm("local"),fe=Jm("session"),De=Jm("none");return Cre(I.b,V,I.a).then(function(){return I.b.get(fe,I.a)}).then(function(Ke){return Ke?fe:I.b.get(De,I.a).then(function(Tt){return Tt?De:I.b.get(V,I.a).then(function(Wt){return Wt?V:I.b.get(rD,I.a).then(function(un){return un?Jm(un):V})})})}).then(function(Ke){return I.c=Ke,oD(I,Ke.F)}).o(function(){I.c||(I.c=V)})}var rD={name:"persistence",F:"session"};function Jm(I){return{name:"authUser",F:I}}nD.prototype.yb=function(I){var V=null,fe=this;return Pre(I),ow(this,function(){return I!=fe.c.F?fe.b.get(fe.c,fe.a).then(function(De){return V=De,oD(fe,I)}).then(function(){if(fe.c=Jm(I),V)return fe.b.set(fe.c,V,fe.a)}):so()})};function iD(I){return ow(I,function(){return I.b.set(rD,I.c.F,I.a)})}function XB(I,V){return ow(I,function(){return I.b.set(I.c,V.w(),I.a)})}function JT(I){return ow(I,function(){return Z4(I.b,I.c,I.a)})}function JB(I,V,fe){return ow(I,function(){return I.b.get(I.c,I.a).then(function(De){return De&&V&&(De.authDomain=V),De&&fe&&(De.emulatorConfig=fe),VB(De||{})})})}function ow(I,V){return I.f=I.f.then(V,V),I.f}function mg(I){if(this.l=!1,Nr(this,"settings",new EB),Nr(this,"app",I),Ql(this).options&&Ql(this).options.apiKey)I=eo.SDK_VERSION?n1(eo.SDK_VERSION):null,this.a=new K(Ql(this).options&&Ql(this).options.apiKey,k(N),I);else throw new b("invalid-api-key");this.P=[],this.s=[],this.N=[],this.Pa=eo.INTERNAL.createSubscribe(P(this.zc,this)),this.W=void 0,this.ib=eo.INTERNAL.createSubscribe(P(this.Ac,this)),_6(this,null),this.i=new nD(Ql(this).options.apiKey+":"+Ql(this).name),this.D=new Qre(Ql(this).options.apiKey+":"+Ql(this).name),this.$=ms(this,aie(this)),this.h=ms(this,lie(this)),this.ba=!1,this.ja=P(this.Zc,this),this.Ba=P(this.da,this),this.qa=P(this.mc,this),this.za=P(this.wc,this),this.Aa=P(this.xc,this),this.b=null,oie(this),this.INTERNAL={},this.INTERNAL.delete=P(this.delete,this),this.INTERNAL.logFramework=P(this.Gc,this),this.u=0,ps.call(this),nie(this),this.J=[],this.R=null}S(mg,ps);function Gu(I){Cn.call(this,"languageCodeChanged"),this.h=I}S(Gu,Cn);function tf(I){Cn.call(this,"emulatorConfigChanged"),this.c=I}S(tf,Cn);function KB(I){Cn.call(this,"frameworkChanged"),this.f=I}S(KB,Cn),t=mg.prototype,t.yb=function(I){return I=this.i.yb(I),ms(this,I)},t.xa=function(I){this.aa===I||this.l||(this.aa=I,io(this.a,this.aa),this.dispatchEvent(new Gu(this.la())))},t.la=function(){return this.aa},t.fd=function(){var I=s.navigator;this.xa(I&&(I.languages&&I.languages[0]||I.language||I.userLanguage)||null)},t.gd=function(I,V){if(!this.R){if(!/^https?:\/\//.test(I))throw new b("argument-error","Emulator URL must start with a valid scheme (http:// or https://).");V=V?!!V.disableWarnings:!1,tie(V),this.R={url:I,ec:V},this.settings.jb=!0,Xo(this.a,this.R),this.dispatchEvent(new tf(this.R))}};function tie(I){typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),s.document&&!I&&$h().then(function(){var V=s.document.createElement("div");V.innerText="Running in emulator mode. Do not use with production credentials.",V.style.position="fixed",V.style.width="100%",V.style.backgroundColor="#ffffff",V.style.border=".1em solid #000000",V.style.color="#b50000",V.style.bottom="0px",V.style.left="0px",V.style.margin="0px",V.style.zIndex=1e4,V.style.textAlign="center",V.classList.add("firebase-emulator-warning"),s.document.body.appendChild(V)})}t.Gc=function(I){this.J.push(I),Ei(this.a,eo.SDK_VERSION?n1(eo.SDK_VERSION,this.J):null),this.dispatchEvent(new KB(this.J))},t.Ga=function(){return he(this.J)},t.zb=function(I){this.S===I||this.l||(this.S=I,this.a.b=this.S)},t.T=function(){return this.S};function nie(I){Object.defineProperty(I,"lc",{get:function(){return this.la()},set:function(V){this.xa(V)},enumerable:!1}),I.aa=null,Object.defineProperty(I,"ti",{get:function(){return this.T()},set:function(V){this.zb(V)},enumerable:!1}),I.S=null,Object.defineProperty(I,"emulatorConfig",{get:function(){if(this.R){var V=iu(this.R.url);V=Qh({protocol:V.c,host:V.a,port:V.g,options:Qh({disableWarnings:this.R.ec})})}else V=null;return V},enumerable:!1})}t.toJSON=function(){return{apiKey:Ql(this).options.apiKey,authDomain:Ql(this).options.authDomain,appName:Ql(this).name,currentUser:da(this)&&da(this).w()}};function KT(I){return I.Oa||zo(new b("auth-domain-config-required"))}function oie(I){var V=Ql(I).options.authDomain,fe=Ql(I).options.apiKey;V&&qh()&&(I.Oa=I.$.then(function(){if(!I.l){if(I.b=jz(V,fe,Ql(I).name,I.R),j6(I.b,I),da(I)&&tw(da(I)),I.m){tw(I.m);var De=I.m;De.xa(I.la()),_T(De,I),De=I.m,Rx(De,I.J),Kz(De,I),De=I.m,Js(De,I.R),Jz(De,I),I.m=null}return I.b}}))}t.Gb=function(I,V){switch(I){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==V&&!!this.f;default:return!1}},t.na=function(I,V,fe,De){I=="signInViaPopup"&&this.g==De&&(fe&&this.C?this.C(fe):V&&!fe&&this.f&&this.f(V),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(I,V){return I=="signInViaRedirect"||I=="signInViaPopup"&&this.g==V&&this.f?P(this.ic,this):null},t.ic=function(I,V,fe,De){var Ke=this,Tt={requestUri:I,postBody:De,sessionId:V,tenantId:fe};return this.c&&(this.c.cancel(),this.c=null),Ke.$.then(function(){return R9(Ke,R2(Ke.a,Tt))})},t.Xc=function(I){if(!qh())return zo(new b("operation-not-supported-in-this-environment"));var V=this,fe=C6(I.providerId),De=Yf(),Ke=null;(!Bf()||uc())&&Ql(this).options.authDomain&&I.isOAuthProvider&&(Ke=xx(Ql(this).options.authDomain,Ql(this).options.apiKey,Ql(this).name,"signInViaPopup",I,null,De,eo.SDK_VERSION||null,null,null,this.T(),this.R));var Tt=vi(Ke,fe&&fe.va,fe&&fe.ua);return fe=KT(this).then(function(Wt){return WT(Wt,Tt,"signInViaPopup",I,De,!!Ke,V.T())}).then(function(){return new Go(function(Wt,un){V.na("signInViaPopup",null,new b("cancelled-popup-request"),V.g),V.f=Wt,V.C=un,V.g=De,V.c=Uz(V.b,V,"signInViaPopup",Tt,De)})}).then(function(Wt){return Tt&&yl(Tt),Wt?Qh(Wt):null}).o(function(Wt){throw Tt&&yl(Tt),Wt}),ms(this,fe)},t.Yc=function(I){if(!qh())return zo(new b("operation-not-supported-in-this-environment"));var V=this,fe=KT(this).then(function(){return iD(V.i)}).then(function(){return Nz(V.b,"signInViaRedirect",I,void 0,V.T())});return ms(this,fe)};function $B(I){if(!qh())return zo(new b("operation-not-supported-in-this-environment"));var V=KT(I).then(function(){return I.b.ra()}).then(function(fe){return fe?Qh(fe):null});return ms(I,V)}t.ra=function(){var I=this;return $B(this).then(function(V){return I.b&&B6(I.b.b),V}).o(function(V){throw I.b&&B6(I.b.b),V})},t.dd=function(I){if(!I)return zo(new b("null-user"));if(this.S!=I.tenantId)return zo(new b("tenant-id-mismatch"));var V=this,fe={};fe.apiKey=Ql(this).options.apiKey,fe.authDomain=Ql(this).options.authDomain,fe.appName=Ql(this).name;var De=qre(I,fe,V.D,V.Ga());return ms(this,this.h.then(function(){if(Ql(V).options.apiKey!=I.l)return De.reload()}).then(function(){return da(V)&&I.uid==da(V).uid?(GT(da(V),I),V.da(I)):(_6(V,De),tw(De),V.da(De))}).then(function(){Mx(V)}))};function rie(I,V){var fe={};return fe.apiKey=Ql(I).options.apiKey,fe.authDomain=Ql(I).options.authDomain,fe.appName=Ql(I).name,I.R&&(fe.emulatorConfig=I.R),I.$.then(function(){return $re(fe,V,I.D,I.Ga())}).then(function(De){return da(I)&&De.uid==da(I).uid?(GT(da(I),De),I.da(De)):(_6(I,De),tw(De),I.da(De))}).then(function(){Mx(I)})}function _6(I,V){da(I)&&(qz(da(I),I.Ba),go(da(I),"tokenChanged",I.qa),go(da(I),"userDeleted",I.za),go(da(I),"userInvalidated",I.Aa),VT(da(I))),V&&(V.W.push(I.Ba),Tn(V,"tokenChanged",I.qa),Tn(V,"userDeleted",I.za),Tn(V,"userInvalidated",I.Aa),0this.u&&(this.u=0),this.u==0&&da(this)&&VT(da(this)),this.removeAuthTokenListener(I)},t.addAuthTokenListener=function(I){var V=this;this.s.push(I),ms(this,this.h.then(function(){V.l||te(V.s,I)&&I($T(V))}))},t.removeAuthTokenListener=function(I){le(this.s,function(V){return V==I})};function sie(I,V){I.N.push(V),ms(I,I.h.then(function(){!I.l&&te(I.N,V)&&I.W!==I.getUid()&&(I.W=I.getUid(),V($T(I)))}))}t.delete=function(){this.l=!0;for(var I=0;I"u"||Re(V)?{}:h9(new S6(V))}).then(function(De){return fe.a.wb(I,De)}).then(function(){}))},t.Wc=function(I,V){return ms(this,Yz(this,I,V,P(this.ab,this)))},t.Vc=function(I,V){var fe=this;return ms(this,so().then(function(){var De=V||lo(),Ke=oa(I,De);if(De=Gs(De),!De)throw new b("argument-error","Invalid email link!");if(De.tenantId!==fe.T())throw new b("tenant-id-mismatch");return fe.ab(Ke)}))};function Ix(){}Ix.prototype.render=function(){},Ix.prototype.reset=function(){},Ix.prototype.getResponse=function(){},Ix.prototype.execute=function(){};function rw(){this.a={},this.b=1e12}var aD=null;rw.prototype.render=function(I,V){return this.a[this.b.toString()]=new zx(I,V),this.b++},rw.prototype.reset=function(I){var V=lD(this,I);I=qB(I),V&&I&&(V.delete(),delete this.a[I])},rw.prototype.getResponse=function(I){return(I=lD(this,I))?I.getResponse():null},rw.prototype.execute=function(I){(I=lD(this,I))&&I.execute()};function lD(I,V){return(V=qB(V))&&I.a[V]||null}function qB(I){return(I=typeof I>"u"?1e12:I)?I.toString():null}function zx(I,V){this.g=!1,this.c=V,this.a=this.b=null,this.h=this.c.size!=="invisible",this.f=fn(I);var fe=this;this.i=function(){fe.execute()},this.h?this.execute():Tn(this.f,"click",this.i)}zx.prototype.getResponse=function(){return qT(this),this.b},zx.prototype.execute=function(){qT(this);var I=this;this.a||(this.a=setTimeout(function(){I.b=t1();var V=I.c.callback,fe=I.c["expired-callback"];if(V)try{V(I.b)}catch{}I.a=setTimeout(function(){if(I.a=null,I.b=null,fe)try{fe()}catch{}I.h&&I.execute()},6e4)},500))},zx.prototype.delete=function(){qT(this),this.g=!0,clearTimeout(this.a),this.a=null,go(this.f,"click",this.i)};function qT(I){if(I.g)throw Error("reCAPTCHA mock was already deleted!")}function sD(){}Nr(sD,"FACTOR_ID","phone");function cD(){}cD.prototype.g=function(){return aD||(aD=new rw),so(aD)},cD.prototype.c=function(){};var uD=null;function dD(){this.b=s.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var cie=new Fe(Ye,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),uie=new ng(3e4,6e4);dD.prototype.g=function(I){var V=this;return new Go(function(fe,De){var Ke=setTimeout(function(){De(new b("network-request-failed"))},uie.get());if(!s.grecaptcha||I!==V.f&&!V.b){s[V.a]=function(){if(s.grecaptcha){V.f=I;var Wt=s.grecaptcha.render;s.grecaptcha.render=function(un,po){return un=Wt(un,po),V.b++,un},clearTimeout(Ke),fe(s.grecaptcha)}else clearTimeout(Ke),De(new b("internal-error"));delete s[V.a]};var Tt=Qe(cie,{onload:V.a,hl:I||""});so(_4(Tt)).o(function(){clearTimeout(Ke),De(new b("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else clearTimeout(Ke),fe(s.grecaptcha)})},dD.prototype.c=function(){this.b--};var fD=null;function hD(I,V,fe,De,Ke,Tt,Wt){if(Nr(this,"type","recaptcha"),this.c=this.f=null,this.J=!1,this.v=V,this.g=null,Wt?(uD||(uD=new cD),Wt=uD):(fD||(fD=new dD),Wt=fD),this.m=Wt,this.a=fe||{theme:"light",type:"image"},this.h=[],this.a[eY])throw new b("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i=this.a[die]==="invisible",!s.document)throw new b("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!fn(V)||!this.i&&fn(V).hasChildNodes())throw new b("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new K(I,Tt||null,Ke||null),this.u=De||function(){return null};var un=this;this.l=[];var po=this.a[QB];this.a[QB]=function(Bi){if(tY(un,Bi),typeof po=="function")po(Bi);else if(typeof po=="string"){var Zl=kl(po,s);typeof Zl=="function"&&Zl(Bi)}};var Fo=this.a[ZB];this.a[ZB]=function(){if(tY(un,null),typeof Fo=="function")Fo();else if(typeof Fo=="string"){var Bi=kl(Fo,s);typeof Bi=="function"&&Bi()}}}var QB="callback",ZB="expired-callback",eY="sitekey",die="size";function tY(I,V){for(var fe=0;feKe||Ke>=oY.length)throw new b("internal-error","Argument validator received an unsupported number of arguments.");fe=oY[Ke],De=(De?"":fe+" argument ")+(V.name?'"'+V.name+'" ':"")+"must be "+V.K+".";break e}De=null}}if(De)throw new b("argument-error",I+" failed: "+De)}var oY="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Br(I,V){return{name:I||"",K:"a valid string",optional:!!V,M:function(fe){return typeof fe=="string"}}}function mD(I,V){return{name:I||"",K:"a boolean",optional:!!V,M:function(fe){return typeof fe=="boolean"}}}function Hu(I,V){return{name:I||"",K:"a valid object",optional:!!V,M:w}}function iw(I,V){return{name:I||"",K:"a function",optional:!!V,M:function(fe){return typeof fe=="function"}}}function Km(I,V){return{name:I||"",K:"null",optional:!!V,M:function(fe){return fe===null}}}function hie(){return{name:"",K:"an HTML element",optional:!1,M:function(I){return!!(I&&I instanceof Element)}}}function yD(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(I){return!!(I&&I instanceof mg)}}}function rY(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(I){return!!(I&&I instanceof eo.app.App)}}}function z2(I){return{name:I?I+"Credential":"credential",K:I?"a valid "+I+" credential":"a valid credential",optional:!1,M:function(V){if(!V)return!1;var fe=!I||V.providerId===I;return!(!V.ka||!fe)}}}function iY(){return{name:"multiFactorAssertion",K:"a valid multiFactorAssertion",optional:!1,M:function(I){return I?!!I.tb:!1}}}function aw(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(I){return!!(I&&I.providerId&&I.hasOwnProperty&&I.hasOwnProperty("isOAuthProvider"))}}}function AD(I,V){return w(I)&&typeof I.type=="string"&&I.type===V&&typeof I.Ha=="function"}function ZT(I){return w(I)&&typeof I.uid=="string"}function eP(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(I){return!(!I||typeof I.type!="string"||typeof I.verify!="function")}}}function lu(I,V,fe,De){return{name:fe||"",K:I.K+" or "+V.K,optional:!!De,M:function(Ke){return I.M(Ke)||V.M(Ke)}}}function hc(I,V){for(var fe in V){var De=V[fe].name;I[De]=aY(De,I[fe],V[fe].j)}}function nf(I,V){for(var fe in V){var De=V[fe].name;De!==fe&&Object.defineProperty(I,De,{get:A(function(Ke){return this[Ke]},fe),set:A(function(Ke,Tt,Wt,un){nY(Ke,[Wt],[un],!0),this[Tt]=un},De,fe,V[fe].lb),enumerable:!0})}}function pc(I,V,fe,De){I[V]=aY(V,fe,De)}function aY(I,V,fe){function De(){var Wt=Array.prototype.slice.call(arguments);return nY(Ke,fe,Wt),V.apply(this,Wt)}if(!fe)return V;var Ke=pie(I),Tt;for(Tt in V)De[Tt]=V[Tt];for(Tt in V.prototype)De.prototype[Tt]=V.prototype[Tt];return De}function pie(I){return I=I.split("."),I[I.length-1]}hc(mg.prototype,{kb:{name:"applyActionCode",j:[Br("code")]},Sa:{name:"checkActionCode",j:[Br("code")]},ob:{name:"confirmPasswordReset",j:[Br("code"),Br("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[Br("email"),Br("password")]},hc:{name:"fetchSignInMethodsForEmail",j:[Br("email")]},ra:{name:"getRedirectResult",j:[]},Bc:{name:"isSignInWithEmailLink",j:[Br("emailLink")]},Hc:{name:"onAuthStateChanged",j:[lu(Hu(),iw(),"nextOrObserver"),iw("opt_error",!0),iw("opt_completed",!0)]},Ic:{name:"onIdTokenChanged",j:[lu(Hu(),iw(),"nextOrObserver"),iw("opt_error",!0),iw("opt_completed",!0)]},wb:{name:"sendPasswordResetEmail",j:[Br("email"),lu(Hu("opt_actionCodeSettings",!0),Km(null,!0),"opt_actionCodeSettings",!0)]},xb:{name:"sendSignInLinkToEmail",j:[Br("email"),Hu("actionCodeSettings")]},yb:{name:"setPersistence",j:[Br("persistence")]},Sc:{name:"signInAndRetrieveDataWithCredential",j:[z2()]},Ab:{name:"signInAnonymously",j:[]},ab:{name:"signInWithCredential",j:[z2()]},Tc:{name:"signInWithCustomToken",j:[Br("token")]},Uc:{name:"signInWithEmailAndPassword",j:[Br("email"),Br("password")]},Vc:{name:"signInWithEmailLink",j:[Br("email"),Br("emailLink",!0)]},Wc:{name:"signInWithPhoneNumber",j:[Br("phoneNumber"),eP()]},Xc:{name:"signInWithPopup",j:[aw()]},Yc:{name:"signInWithRedirect",j:[aw()]},dd:{name:"updateCurrentUser",j:[lu(function(I){return{name:"user",K:"an instance of Firebase User",optional:!1,M:function(V){return!!(V&&V instanceof Xa)}}}(),Km(),"user")]},Bb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Br(null,!0)]},fd:{name:"useDeviceLanguage",j:[]},gd:{name:"useEmulator",j:[Br("url"),Hu("options",!0)]},jd:{name:"verifyPasswordResetCode",j:[Br("code")]}}),nf(mg.prototype,{lc:{name:"languageCode",lb:lu(Br(),Km(),"languageCode")},ti:{name:"tenantId",lb:lu(Br(),Km(),"tenantId")}}),mg.Persistence=N6,mg.Persistence.LOCAL="local",mg.Persistence.SESSION="session",mg.Persistence.NONE="none",hc(Xa.prototype,{delete:{name:"delete",j:[]},oc:{name:"getIdTokenResult",j:[mD("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[mD("opt_forceRefresh",!0)]},Cc:{name:"linkAndRetrieveDataWithCredential",j:[z2()]},rb:{name:"linkWithCredential",j:[z2()]},Dc:{name:"linkWithPhoneNumber",j:[Br("phoneNumber"),eP()]},Ec:{name:"linkWithPopup",j:[aw()]},Fc:{name:"linkWithRedirect",j:[aw()]},Lc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[z2()]},ub:{name:"reauthenticateWithCredential",j:[z2()]},Mc:{name:"reauthenticateWithPhoneNumber",j:[Br("phoneNumber"),eP()]},Nc:{name:"reauthenticateWithPopup",j:[aw()]},Oc:{name:"reauthenticateWithRedirect",j:[aw()]},reload:{name:"reload",j:[]},vb:{name:"sendEmailVerification",j:[lu(Hu("opt_actionCodeSettings",!0),Km(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Br(null,!0)]},cd:{name:"unlink",j:[Br("provider")]},Cb:{name:"updateEmail",j:[Br("email")]},Db:{name:"updatePassword",j:[Br("password")]},ed:{name:"updatePhoneNumber",j:[z2("phone")]},Eb:{name:"updateProfile",j:[Hu("profile")]},Fb:{name:"verifyBeforeUpdateEmail",j:[Br("email"),lu(Hu("opt_actionCodeSettings",!0),Km(null,!0),"opt_actionCodeSettings",!0)]}}),hc(rw.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),hc(Ix.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),hc(Go.prototype,{oa:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),nf(EB.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",lb:mD("appVerificationDisabledForTesting")}}),hc(Bz.prototype,{confirm:{name:"confirm",j:[Br("verificationCode")]}}),pc(s0,"fromJSON",function(I){I=typeof I=="string"?JSON.parse(I):I;for(var V,fe=[m9,dx,fc,ST],De=0;De=0,i=!n&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(o=this.toRgbString()),e==="prgb"&&(o=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(o=this.toHexString()),e==="hex3"&&(o=this.toHexString(!0)),e==="hex4"&&(o=this.toHex8String(!0)),e==="hex8"&&(o=this.toHex8String()),e==="name"&&(o=this.toName()),e==="hsl"&&(o=this.toHslString()),e==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return ri(this.toString())},_applyModification:function(e,n){var o=e.apply(null,[this].concat([].slice.call(n)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(K9o,arguments)},brighten:function(){return this._applyModification($9o,arguments)},darken:function(){return this._applyModification(q9o,arguments)},desaturate:function(){return this._applyModification(G9o,arguments)},saturate:function(){return this._applyModification(X9o,arguments)},greyscale:function(){return this._applyModification(J9o,arguments)},spin:function(){return this._applyModification(Q9o,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(t3o,arguments)},complement:function(){return this._applyCombination(Z9o,arguments)},monochromatic:function(){return this._applyCombination(n3o,arguments)},splitcomplement:function(){return this._applyCombination(e3o,arguments)},triad:function(){return this._applyCombination(QDe,[3])},tetrad:function(){return this._applyCombination(QDe,[4])}};ri.fromRatio=function(t,e){if(RK(t)=="object"){var n={};for(var o in t)t.hasOwnProperty(o)&&(o==="a"?n[o]=t[o]:n[o]=ck(t[o]));t=n}return ri(t,e)};function B9o(t){var e={r:0,g:0,b:0},n=1,o=null,r=null,i=null,a=!1,l=!1;return typeof t=="string"&&(t=l3o(t)),RK(t)=="object"&&(nA(t.r)&&nA(t.g)&&nA(t.b)?(e=Y9o(t.r,t.g,t.b),a=!0,l=String(t.r).substr(-1)==="%"?"prgb":"rgb"):nA(t.h)&&nA(t.s)&&nA(t.v)?(o=ck(t.s),r=ck(t.v),e=_9o(t.h,o,r),a=!0,l="hsv"):nA(t.h)&&nA(t.s)&&nA(t.l)&&(o=ck(t.s),i=ck(t.l),e=O9o(t.h,o,i),a=!0,l="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=Cut(n),{ok:a,format:t.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:n}}function Y9o(t,e,n){return{r:Jc(t,255)*255,g:Jc(e,255)*255,b:Jc(n,255)*255}}function JDe(t,e,n){t=Jc(t,255),e=Jc(e,255),n=Jc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=(o+r)/2;if(o==r)i=a=0;else{var s=o-r;switch(a=l>.5?s/(2-o-r):s/(o+r),o){case t:i=(e-n)/s+(e1&&(d-=1),d<1/6?c+(u-c)*6*d:d<1/2?u:d<2/3?c+(u-c)*(2/3-d)*6:c}if(e===0)o=r=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;o=a(s,l,t+1/3),r=a(s,l,t),i=a(s,l,t-1/3)}return{r:o*255,g:r*255,b:i*255}}function KDe(t,e,n){t=Jc(t,255),e=Jc(e,255),n=Jc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=o,s=o-r;if(a=o===0?0:s/o,o==r)i=0;else{switch(o){case t:i=(e-n)/s+(e>1)+720)%360;--e;)o.h=(o.h+r)%360,i.push(ri(o));return i}function n3o(t,e){e=e||6;for(var n=ri(t).toHsv(),o=n.h,r=n.s,i=n.v,a=[],l=1/e;e--;)a.push(ri({h:o,s:r,v:i})),i=(i+l)%1;return a}ri.mix=function(t,e,n){n=n===0?0:n||50;var o=ri(t).toRgb(),r=ri(e).toRgb(),i=n/100,a={r:(r.r-o.r)*i+o.r,g:(r.g-o.g)*i+o.g,b:(r.b-o.b)*i+o.b,a:(r.a-o.a)*i+o.a};return ri(a)};ri.readability=function(t,e){var n=ri(t),o=ri(e);return(Math.max(n.getLuminance(),o.getLuminance())+.05)/(Math.min(n.getLuminance(),o.getLuminance())+.05)};ri.isReadable=function(t,e,n){var o=ri.readability(t,e),r,i;switch(i=!1,r=s3o(n),r.level+r.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7;break}return i};ri.mostReadable=function(t,e,n){var o=null,r=0,i,a,l,s;n=n||{},a=n.includeFallbackColors,l=n.level,s=n.size;for(var c=0;cr&&(r=i,o=ri(e[c]));return ri.isReadable(t,o,{level:l,size:s})||!a?o:(n.includeFallbackColors=!1,ri.mostReadable(t,["#fff","#000"],n))};var L1e=ri.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},o3o=ri.hexNames=r3o(L1e);function r3o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function Cut(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Jc(t,e){i3o(t)&&(t="100%");var n=a3o(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Wne(t){return Math.min(1,Math.max(0,t))}function Wg(t){return parseInt(t,16)}function i3o(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function a3o(t){return typeof t=="string"&&t.indexOf("%")!=-1}function h5(t){return t.length==1?"0"+t:""+t}function ck(t){return t<=1&&(t=t*100+"%"),t}function Rut(t){return Math.round(parseFloat(t)*255).toString(16)}function ZDe(t){return Wg(t)/255}var V2=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function nA(t){return!!V2.CSS_UNIT.exec(t)}function l3o(t){t=t.replace(U9o,"").replace(j9o,"").toLowerCase();var e=!1;if(L1e[t])t=L1e[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=V2.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=V2.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=V2.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=V2.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=V2.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=V2.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=V2.hex8.exec(t))?{r:Wg(n[1]),g:Wg(n[2]),b:Wg(n[3]),a:ZDe(n[4]),format:e?"name":"hex8"}:(n=V2.hex6.exec(t))?{r:Wg(n[1]),g:Wg(n[2]),b:Wg(n[3]),format:e?"name":"hex"}:(n=V2.hex4.exec(t))?{r:Wg(n[1]+""+n[1]),g:Wg(n[2]+""+n[2]),b:Wg(n[3]+""+n[3]),a:ZDe(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=V2.hex3.exec(t))?{r:Wg(n[1]+""+n[1]),g:Wg(n[2]+""+n[2]),b:Wg(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function s3o(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:e,size:n}}var eEe=function(e){var n=["r","g","b","a","h","s","l","v"],o=0,r=0;return N9o(n,function(i){if(e[i]&&(o+=1,isNaN(e[i])||(r+=1),i==="s"||i==="l")){var a=/^\d+%$/;a.test(e[i])&&(r+=1)}}),o===r?e:!1},uk=function(e,n){var o=e.hex?ri(e.hex):ri(e),r=o.toHsl(),i=o.toHsv(),a=o.toRgb(),l=o.toHex();r.s===0&&(r.h=n||0,i.h=n||0);var s=l==="000000"&&a.a===0;return{hsl:r,hex:s?"transparent":"#"+l,rgb:a,hsv:i,oldHue:e.h||n||r.h,source:e.source}},O7=function(e){if(e==="transparent")return!0;var n=String(e).charAt(0)==="#"?1:0;return e.length!==4+n&&e.length<7+n&&ri(e).isValid()},p4e=function(e){if(!e)return"#fff";var n=uk(e);if(n.hex==="transparent")return"rgba(0,0,0,0.4)";var o=(n.rgb.r*299+n.rgb.g*587+n.rgb.b*114)/1e3;return o>=128?"#000":"#fff"},kce=function(e,n){var o=e.replace("°","");return ri(n+" ("+o+")")._ok},mE=Object.assign||function(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){m3o(r,o);function r(){var i,a,l,s;g3o(this,r);for(var c=arguments.length,u=Array(c),d=0;dl))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,p=n&H3o?new HK:void 0;for(i.set(t,e),i.set(e,t);++d=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var rV=24,Y6o=Wut.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?rV:o,i=t.height,a=i===void 0?rV:i,l=t.style,s=l===void 0?{}:l,c=B6o(t,["fill","width","height","style"]);return AEe.default.createElement("svg",yEe({viewBox:"0 0 "+rV+" "+rV,style:yEe({fill:n,width:r,height:a},s)},c),AEe.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},O6o=function(){function t(e,n){for(var o=0;o1&&(r.a=1),o.props.onChange({h:o.props.hsl.h,s:o.props.hsl.s,l:o.props.hsl.l,a:Math.round(r.a*100)/100,source:"rgb"},i)):(r.h||r.s||r.l)&&(typeof r.s=="string"&&r.s.includes("%")&&(r.s=r.s.replace("%","")),typeof r.l=="string"&&r.l.includes("%")&&(r.l=r.l.replace("%","")),r.s==1?r.s=.01:r.l==1&&(r.l=.01),o.props.onChange({h:r.h||o.props.hsl.h,s:Number(mEe(r.s)?o.props.hsl.s:r.s),l:Number(mEe(r.l)?o.props.hsl.l:r.l),source:"hsl"},i))},o.showHighlight=function(r){r.currentTarget.style.background="#eee"},o.hideHighlight=function(r){r.currentTarget.style.background="transparent"},n.hsl.a!==1&&n.view==="hex"?o.state={view:"rgb"}:o.state={view:n.view},o}return O6o(e,[{key:"render",value:function(){var o=this,r=Zi({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),i=void 0;return this.state.view==="hex"?i=xe.createElement("div",{style:r.fields,className:"flexbox-fix"},xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?i=xe.createElement("div",{style:r.fields,className:"flexbox-fix"},xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),xe.createElement("div",{style:r.alpha},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(i=xe.createElement("div",{style:r.fields,className:"flexbox-fix"},xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),xe.createElement("div",{style:r.field},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),xe.createElement("div",{style:r.alpha},xe.createElement(hl,{style:{input:r.input,label:r.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),xe.createElement("div",{style:r.wrap,className:"flexbox-fix"},i,xe.createElement("div",{style:r.toggle},xe.createElement("div",{style:r.icon,onClick:this.toggleViews,ref:function(l){return o.icon=l}},xe.createElement(Y6o,{style:r.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.hsl.a!==1&&r.view==="hex"?{view:"rgb"}:null}}]),e}(xe.Component);Nut.defaultProps={view:"hex"};var wEe=function(){var e=Zi({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return xe.createElement("div",{style:e.picker})},X6o=function(){var e=Zi({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return xe.createElement("div",{style:e.picker})},x4e=function(e){var n=e.width,o=e.onChange,r=e.disableAlpha,i=e.rgb,a=e.hsl,l=e.hsv,s=e.hex,c=e.renderers,u=e.styles,d=u===void 0?{}:u,f=e.className,p=f===void 0?"":f,m=e.defaultView,y=Zi(G1({default:{picker:{width:n,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+i.r+", "+i.g+", "+i.b+", "+i.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},d),{disableAlpha:r});return xe.createElement("div",{style:y.picker,className:"chrome-picker "+p},xe.createElement("div",{style:y.saturation},xe.createElement(Lne,{style:y.Saturation,hsl:a,hsv:l,pointer:X6o,onChange:o})),xe.createElement("div",{style:y.body},xe.createElement("div",{style:y.controls,className:"flexbox-fix"},xe.createElement("div",{style:y.color},xe.createElement("div",{style:y.swatch},xe.createElement("div",{style:y.active}),xe.createElement(UI,{renderers:c}))),xe.createElement("div",{style:y.toggles},xe.createElement("div",{style:y.hue},xe.createElement(jI,{style:y.Hue,hsl:a,pointer:wEe,onChange:o})),xe.createElement("div",{style:y.alpha},xe.createElement(a4e,{style:y.Alpha,rgb:i,hsl:a,pointer:wEe,renderers:c,onChange:o})))),xe.createElement(Nut,{rgb:i,hsl:a,hex:s,view:m,onChange:o,disableAlpha:r})))};x4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),disableAlpha:Ao.bool,styles:Ao.object,defaultView:Ao.oneOf(["hex","rgb","hsl"])};x4e.defaultProps={width:225,disableAlpha:!1,styles:{}};X1(x4e);var J6o=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.active,l=Zi({default:{color:{background:n,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:p4e(n),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:a,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return xe.createElement(iT,{style:l.color,color:n,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},xe.createElement("div",{style:l.dot}))},K6o=function(e){var n=e.hex,o=e.rgb,r=e.onChange,i=Zi({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:n},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),a=function(s,c){s.r||s.g||s.b?r({r:s.r||o.r,g:s.g||o.g,b:s.b||o.b,source:"rgb"},c):r({hex:s.hex,source:"hex"},c)};return xe.createElement("div",{style:i.fields,className:"flexbox-fix"},xe.createElement("div",{style:i.active}),xe.createElement(hl,{style:{wrap:i.HEXwrap,input:i.HEXinput,label:i.HEXlabel},label:"hex",value:n,onChange:a}),xe.createElement(hl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"r",value:o.r,onChange:a}),xe.createElement(hl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"g",value:o.g,onChange:a}),xe.createElement(hl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"b",value:o.b,onChange:a}))},v4e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.colors,i=e.hex,a=e.rgb,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=Zi(G1({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},s)),f=function(m,y){m.hex?O7(m.hex)&&n({hex:m.hex,source:"hex"},y):n(m,y)};return xe.createElement(Aj,{style:d.Compact,styles:s},xe.createElement("div",{style:d.compact,className:"compact-picker "+u},xe.createElement("div",null,aT(r,function(p){return xe.createElement(J6o,{key:p,color:p,active:p.toLowerCase()===i,onClick:f,onSwatchHover:o})}),xe.createElement("div",{style:d.clear})),xe.createElement(K6o,{hex:i,rgb:a,onChange:f})))};v4e.propTypes={colors:Ao.arrayOf(Ao.string),styles:Ao.object};v4e.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};const sd=X1(v4e);var $6o=function(e){var n=e.hover,o=e.color,r=e.onClick,i=e.onSwatchHover,a={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},l=Zi({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:a}},{hover:n});return xe.createElement("div",{style:l.swatch},xe.createElement(iT,{color:o,onClick:r,onHover:i,focusStyle:a}))};const q6o=i4e($6o);var b4e=function(e){var n=e.width,o=e.colors,r=e.onChange,i=e.onSwatchHover,a=e.triangle,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=Zi(G1({default:{card:{width:n,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},s),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right","bottom-left-triangle":a==="bottom-left","bottom-right-triangle":a==="bottom-right"}),f=function(m,y){return r({hex:m,source:"hex"},y)};return xe.createElement("div",{style:d.card,className:"github-picker "+u},xe.createElement("div",{style:d.triangleShadow}),xe.createElement("div",{style:d.triangle}),aT(o,function(p){return xe.createElement(q6o,{color:p,key:p,onClick:f,onSwatchHover:i})}))};b4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),colors:Ao.arrayOf(Ao.string),triangle:Ao.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ao.object};b4e.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};X1(b4e);var Q6o=function(e){var n=e.direction,o=Zi({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return xe.createElement("div",{style:o.picker})},Z6o=Object.assign||function(t){for(var e=1;e.5});return xe.createElement("div",{style:o.picker})},oAo=function(){var e=Zi({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return xe.createElement("div",{style:e.pointer},xe.createElement("div",{style:e.left},xe.createElement("div",{style:e.leftInside})),xe.createElement("div",{style:e.right},xe.createElement("div",{style:e.rightInside})))},xEe=function(e){var n=e.onClick,o=e.label,r=e.children,i=e.active,a=Zi({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:i});return xe.createElement("div",{style:a.button,onClick:n},o||r)},rAo=function(e){var n=e.rgb,o=e.currentColor,r=Zi({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+n.r+","+n.g+", "+n.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:o,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return xe.createElement("div",null,xe.createElement("div",{style:r.label},"new"),xe.createElement("div",{style:r.swatches},xe.createElement("div",{style:r.new}),xe.createElement("div",{style:r.current})),xe.createElement("div",{style:r.label},"current"))},iAo=function(){function t(e,n){for(var o=0;o100&&(u.a=100),u.a/=100,n({h:r.h,s:r.s,l:r.l,a:u.a,source:"rgb"},d))};return xe.createElement("div",{style:l.fields,className:"flexbox-fix"},xe.createElement("div",{style:l.double},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"hex",value:i.replace("#",""),onChange:s})),xe.createElement("div",{style:l.single},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"r",value:o.r,onChange:s,dragLabel:"true",dragMax:"255"})),xe.createElement("div",{style:l.single},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"g",value:o.g,onChange:s,dragLabel:"true",dragMax:"255"})),xe.createElement("div",{style:l.single},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"b",value:o.b,onChange:s,dragLabel:"true",dragMax:"255"})),xe.createElement("div",{style:l.alpha},xe.createElement(hl,{style:{input:l.input,label:l.label},label:"a",value:Math.round(o.a*100),onChange:s,dragLabel:"true",dragMax:"100"})))},uAo=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var iV=24,yAo=jut.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?iV:o,i=t.height,a=i===void 0?iV:i,l=t.style,s=l===void 0?{}:l,c=mAo(t,["fill","width","height","style"]);return bEe.default.createElement("svg",vEe({viewBox:"0 0 "+iV+" "+iV,style:vEe({fill:n,width:r,height:a},s)},c),bEe.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},AAo=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.first,l=e.last,s=e.active,c=Zi({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:p4e(n),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:a,last:l,active:s,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return xe.createElement(iT,{color:n,style:c.color,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},xe.createElement("div",{style:c.check},xe.createElement(yAo,null)))},wAo=function(e){var n=e.onClick,o=e.onSwatchHover,r=e.group,i=e.active,a=Zi({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return xe.createElement("div",{style:a.group},aT(r,function(l,s){return xe.createElement(AAo,{key:l,color:l,active:l.toLowerCase()===i,first:s===0,last:s===r.length-1,onClick:n,onSwatchHover:o})}))},R4e=function(e){var n=e.width,o=e.height,r=e.onChange,i=e.onSwatchHover,a=e.colors,l=e.hex,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=Zi(G1({default:{picker:{width:n,height:o},overflow:{height:o,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),p=function(y,w){return r({hex:y,source:"hex"},w)};return xe.createElement("div",{style:f.picker,className:"swatches-picker "+d},xe.createElement(Aj,null,xe.createElement("div",{style:f.overflow},xe.createElement("div",{style:f.body},aT(a,function(m){return xe.createElement(wAo,{key:m.toString(),group:m,active:l,onClick:p,onSwatchHover:i})}),xe.createElement("div",{style:f.clear})))))};R4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),height:Ao.oneOfType([Ao.string,Ao.number]),colors:Ao.arrayOf(Ao.arrayOf(Ao.string)),styles:Ao.object};R4e.defaultProps={width:320,height:240,colors:[[mC[900],mC[700],mC[500],mC[300],mC[100]],[yC[900],yC[700],yC[500],yC[300],yC[100]],[AC[900],AC[700],AC[500],AC[300],AC[100]],[wC[900],wC[700],wC[500],wC[300],wC[100]],[xC[900],xC[700],xC[500],xC[300],xC[100]],[vC[900],vC[700],vC[500],vC[300],vC[100]],[bC[900],bC[700],bC[500],bC[300],bC[100]],[SC[900],SC[700],SC[500],SC[300],SC[100]],[TC[900],TC[700],TC[500],TC[300],TC[100]],["#194D33",dk[700],dk[500],dk[300],dk[100]],[PC[900],PC[700],PC[500],PC[300],PC[100]],[CC[900],CC[700],CC[500],CC[300],CC[100]],[RC[900],RC[700],RC[500],RC[300],RC[100]],[HC[900],HC[700],HC[500],HC[300],HC[100]],[MC[900],MC[700],MC[500],MC[300],MC[100]],[IC[900],IC[700],IC[500],IC[300],IC[100]],[zC[900],zC[700],zC[500],zC[300],zC[100]],[DC[900],DC[700],DC[500],DC[300],DC[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};X1(R4e);var H4e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.hex,i=e.colors,a=e.width,l=e.triangle,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=Zi(G1({default:{card:{width:a,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":l==="hide","top-left-triangle":l==="top-left","top-right-triangle":l==="top-right"}),p=function(y,w){O7(y)&&n({hex:y,source:"hex"},w)};return xe.createElement("div",{style:f.card,className:"twitter-picker "+d},xe.createElement("div",{style:f.triangleShadow}),xe.createElement("div",{style:f.triangle}),xe.createElement("div",{style:f.body},aT(i,function(m,y){return xe.createElement(iT,{key:y,color:m,hex:m,style:f.swatch,onClick:p,onHover:o,focusStyle:{boxShadow:"0 0 4px "+m}})}),xe.createElement("div",{style:f.hash},"#"),xe.createElement(hl,{label:null,style:{input:f.input},value:r.replace("#",""),onChange:p}),xe.createElement("div",{style:f.clear})))};H4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),triangle:Ao.oneOf(["hide","top-left","top-right"]),colors:Ao.arrayOf(Ao.string),styles:Ao.object};H4e.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};X1(H4e);var M4e=function(e){var n=Zi({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return xe.createElement("div",{style:n.picker})};M4e.propTypes={hsl:Ao.shape({h:Ao.number,s:Ao.number,l:Ao.number,a:Ao.number})};M4e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var I4e=function(e){var n=Zi({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return xe.createElement("div",{style:n.picker})};I4e.propTypes={hsl:Ao.shape({h:Ao.number,s:Ao.number,l:Ao.number,a:Ao.number})};I4e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var xAo=function(e){var n=e.onChange,o=e.rgb,r=e.hsl,i=e.hex,a=e.hsv,l=function(p,m){if(p.hex)O7(p.hex)&&n({hex:p.hex,source:"hex"},m);else if(p.rgb){var y=p.rgb.split(",");kce(p.rgb,"rgb")&&n({r:y[0],g:y[1],b:y[2],a:1,source:"rgb"},m)}else if(p.hsv){var w=p.hsv.split(",");kce(p.hsv,"hsv")&&(w[2]=w[2].replace("%",""),w[1]=w[1].replace("%",""),w[0]=w[0].replace("°",""),w[1]==1?w[1]=.01:w[2]==1&&(w[2]=.01),n({h:Number(w[0]),s:Number(w[1]),v:Number(w[2]),source:"hsv"},m))}else if(p.hsl){var x=p.hsl.split(",");kce(p.hsl,"hsl")&&(x[2]=x[2].replace("%",""),x[1]=x[1].replace("%",""),x[0]=x[0].replace("°",""),d[1]==1?d[1]=.01:d[2]==1&&(d[2]=.01),n({h:Number(x[0]),s:Number(x[1]),v:Number(x[2]),source:"hsl"},m))}},s=Zi({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=o.r+", "+o.g+", "+o.b,u=Math.round(r.h)+"°, "+Math.round(r.s*100)+"%, "+Math.round(r.l*100)+"%",d=Math.round(a.h)+"°, "+Math.round(a.s*100)+"%, "+Math.round(a.v*100)+"%";return xe.createElement("div",{style:s.wrap,className:"flexbox-fix"},xe.createElement("div",{style:s.fields},xe.createElement("div",{style:s.double},xe.createElement(hl,{style:{input:s.input,label:s.label},label:"hex",value:i,onChange:l})),xe.createElement("div",{style:s.column},xe.createElement("div",{style:s.single},xe.createElement(hl,{style:{input:s.input2,label:s.label2},label:"rgb",value:c,onChange:l})),xe.createElement("div",{style:s.single},xe.createElement(hl,{style:{input:s.input2,label:s.label2},label:"hsv",value:d,onChange:l})),xe.createElement("div",{style:s.single},xe.createElement(hl,{style:{input:s.input2,label:s.label2},label:"hsl",value:u,onChange:l})))))},z4e=function(e){var n=e.width,o=e.onChange,r=e.rgb,i=e.hsl,a=e.hsv,l=e.hex,s=e.header,c=e.styles,u=c===void 0?{}:c,d=e.className,f=d===void 0?"":d,p=Zi(G1({default:{picker:{width:n,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+r.r+", "+r.g+", "+r.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},u));return xe.createElement("div",{style:p.picker,className:"google-picker "+f},xe.createElement("div",{style:p.head},s),xe.createElement("div",{style:p.swatch}),xe.createElement("div",{style:p.saturation},xe.createElement(Lne,{hsl:i,hsv:a,pointer:M4e,onChange:o})),xe.createElement("div",{style:p.body},xe.createElement("div",{style:p.controls,className:"flexbox-fix"},xe.createElement("div",{style:p.hue},xe.createElement(jI,{style:p.Hue,hsl:i,radius:"4px",pointer:I4e,onChange:o}))),xe.createElement(xAo,{rgb:r,hsl:i,hex:l,hsv:a,onChange:o})))};z4e.propTypes={width:Ao.oneOfType([Ao.string,Ao.number]),styles:Ao.object,header:Ao.string};z4e.defaultProps={width:652,styles:{},header:"Color picker"};X1(z4e);const vAo=({setDialogVisible:t})=>{const e=H(pn),n=H(f5e),o=H(Jn),r=H(h5e),i=H(Fn),a=H(ac),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState((s==null?void 0:s.color)??"#808080"),d=Kt(),f=x=>{switch(a){case ie.AllSelectedObjectsOfThisType:{for(const C of H.getState().elements)if(C.type===z.Foundation&&!C.locked&&H.getState().selectedElementIdSet.has(C.id)&&x!==C.color)return!0;break}case ie.AllObjectsOfThisType:for(const C of H.getState().elements)if(C.type===z.Foundation&&!C.locked&&x!==C.color)return!0;break;default:if(x!==(s==null?void 0:s.color))return!0}return!1},p=(x,C)=>{H.getState().set(P=>{for(const A of P.elements)if(A.type===z.Foundation&&x.has(A.id))if(C!==void 0)A.color=C;else{const S=x.get(A.id);S!==void 0&&(A.color=S)}})},m=x=>{if(s&&f(x)){switch(a){case ie.AllSelectedObjectsOfThisType:{const C=new Map;for(const A of H.getState().elements)A.type===z.Foundation&&H.getState().selectedElementIdSet.has(A.id)&&C.set(A.id,A.color??"#808080");const P={name:"Set Color for Selected Foundations",timestamp:Date.now(),oldValues:C,newValue:x,undo:()=>{p(P.oldValues)},redo:()=>{p(P.oldValues,P.newValue)}};i(P),p(C,x),l(H.getState().applyCount+1);break}case ie.AllObjectsOfThisType:{const C=new Map;for(const A of H.getState().elements)A.type===z.Foundation&&C.set(A.id,A.color??"#808080");const P={name:"Set Color for All Foundations",timestamp:Date.now(),oldValues:C,newValue:x,undo:()=>{for(const[A,S]of P.oldValues.entries())n(A,S)},redo:()=>{r(z.Foundation,P.newValue)}};i(P),r(z.Foundation,x),l(H.getState().applyCount+1);break}default:{const C=o(s.id),P=C?C.color:s.color,A={name:"Set Color of Selected Foundation",timestamp:Date.now(),oldValue:P,newValue:x,changedElementId:s.id,changedElementType:s.type,undo:()=>{n(A.changedElementId,A.oldValue)},redo:()=>{n(A.changedElementId,A.newValue)}};i(A),n(s.id,x),l(H.getState().applyCount+1);break}}e(C=>{C.actionState.foundationColor=x})}},y=()=>{m(c)},w=()=>{t(!1)};return h.jsx(ro,{width:600,title:B.t("word.Color",d),onApply:y,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:c,onChangeComplete:x=>{u(x.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:x=>H.getState().setFoundationActionScope(x.target.value),value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},bAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(fXe),r=H(Z3),i=H(YN),a=H(M7),l=H(RS),s=H(Q3),c=H(Fn),u=H(ac),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Foundation),[w,x]=g.useState((y==null?void 0:y.lx)??.1),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=ae=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const Z of e)if(Z.type===z.Foundation&&H.getState().selectedElementIdSet.has(Z.id)){const ne=Z,te=l(ne.id);if(te.length>0&&!ye.doesNewSizeContainAllChildren(ne,te,ae,ne.ly))return!1}break}case ie.AllObjectsOfThisType:{for(const Z of e)if(Z.type===z.Foundation){const ne=Z,te=l(ne.id);if(te.length>0&&!ye.doesNewSizeContainAllChildren(ne,te,ae,ne.ly))return!1}break}default:{const Z=l(y.id);if(Z.length>0)return ye.doesNewSizeContainAllChildren(y,Z,ae,y.ly);break}}return!0}},U=ae=>!N(ae),W=ae=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const Z of e)if(Z.type===z.Foundation&&!Z.locked&&H.getState().selectedElementIdSet.has(Z.id)&&Math.abs(Z.lx-ae)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const Z of e)if(Z.type===z.Foundation&&!Z.locked&&Math.abs(Z.lx-ae)>Ht)return!0;break;default:if(Math.abs((y==null?void 0:y.lx)-ae)>Ht)return!0}return!1}},F=(ae,Z)=>{if(ae==null)return null;for(const ne of ae.children)if(ne.name.includes(`${Z}`))return ne;return null},E=(ae,Z,ne)=>{var te,q;if(ae){for(const le of ae.children)if(le.name.includes(`${ne.id}`)){(q=(te=jn.getState().contentRef)==null?void 0:te.current)==null||q.add(le);break}d(le=>{for(const de of le.elements)if(de.id===ne.id){de.parentId=rr;const he=new _t(de.cx,de.cy).rotateAround(ui,Z.rotation[2]).add(new _t(Z.cx,Z.cy));de.cx=he.x,de.cy=he.y,de.cz=0,S.current.set(de.id,new ue(he.x,he.y,0)),P.current.set(de.id,rr);break}})}},L=(ae,Z)=>{const ne=l(ae.id),te=ae.rotation[2];if(v.current.clear(),R.current.clear(),ne.length>0)for(const q of ne)switch(q.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const le=new _t(q.cx*ae.lx,q.cy*ae.ly).rotateAround(ui,te);v.current.set(q.id,le),A.current.set(q.id,new ue(q.cx,q.cy));break}case z.Polygon:{const le=q,de=[];for(const he of le.vertices)de.push(new _t(he.x*ae.lx,he.y*ae.ly).rotateAround(ui,te));R.current.set(q.id,de),b.current.set(q.id,le.vertices.map(he=>({...he})));break}case z.Human:case z.Tree:{A.current.set(q.id,new ue(q.cx,q.cy,q.cz));break}}if(r(ae.id,Z),ne.length>0)for(const q of ne)switch(q.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const le=v.current.get(q.id);if(le){const he=new _t(le.x,le.y).rotateAround(ui,-te).x/Z;o(q.id,he),S.current.set(q.id,new ue(he,q.cy))}break}case z.Polygon:{const le=R.current.get(q.id);if(le){const de=[];for(const he of le){const me=he.rotateAround(ui,-te),ce=me.x/Z,Pe=me.y/ae.ly;de.push({x:ce,y:Pe})}a(q.id,de),T.current.set(q.id,de.map(he=>({...he})))}break}case z.Human:case z.Tree:{if(S.current.set(q.id,new ue(q.cx,q.cy,q.cz)),C.current.set(q.id,ae.id),Math.abs(q.cz-ae.lz/2)0){const le=jn.getState().contentRef,de=F(le==null?void 0:le.current,ae.id);E(de,ae,q)}}else if(Math.abs(Math.abs(q.cx)-ae.lx/2)0?Z:-Z)/2;o(q.id,le),S.current.set(q.id,new ue(le,q.cy,q.cz))}break}}},j=(ae,Z,ne)=>{if(!ae||!Z)return;const te=jn.getState().contentRef,q=F(te==null?void 0:te.current,Z),le=F(Z===rr?te==null?void 0:te.current:q,ne);if(le&&(te!=null&&te.current)){if(ae===rr)te.current.add(le);else{const de=F(te.current,ae);de==null||de.add(le)}Ip()}},Y=(ae,Z)=>{ae&&d(ne=>{for(const te of ne.elements)if(te.id===Z){te.parentId=ae;break}})},O=(ae,Z)=>{H.getState().set(ne=>{for(const te of ne.elements)if(ae.has(te.id))if(Z!==void 0)te.lx=Z;else{const q=ae.get(te.id);q!==void 0&&(te.lx=q)}})},_=ae=>{if(!y||!W(ae))return;const Z=n(y.id),ne=Z?Z.lx:y.lx;if(D.current=void 0,M.current=U(ae),M.current)D.current=ae,x(ne);else switch(A.current.clear(),S.current.clear(),b.current.clear(),T.current.clear(),u){case ie.AllSelectedObjectsOfThisType:{const te=new Map;for(const le of e)le.type===z.Foundation&&H.getState().selectedElementIdSet.has(le.id)&&te.set(le.id,le.lx);for(const le of e)le.type===z.Foundation&&H.getState().selectedElementIdSet.has(le.id)&&L(le,ae);const q={name:"Set Length for Selected Foundations",timestamp:Date.now(),oldSizes:te,newSize:ae,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;if(O(q.oldSizes),q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[he,me]of q.oldChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(ce,Pe,he),Y(ce,he))}if(q.oldChildrenVerticesMap&&q.oldChildrenVerticesMap.size>0)for(const[he,me]of q.oldChildrenVerticesMap.entries())a(he,me)},redo:()=>{var le,de;if(O(q.oldSizes,q.newSize),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[he,me]of q.newChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(Pe,ce,he),Y(Pe,he))}if(q.newChildrenVerticesMap&&q.newChildrenVerticesMap.size>0)for(const[he,me]of q.newChildrenVerticesMap.entries())a(he,me)}};c(q),p(f+1);break}case ie.AllObjectsOfThisType:{const te=new Map;for(const le of e)le.type===z.Foundation&&te.set(le.id,le.lx);for(const le of e)le.type===z.Foundation&&L(le,ae);const q={name:"Set Length for All Foundations",timestamp:Date.now(),oldSizes:te,newSize:ae,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;for(const[he,me]of q.oldSizes.entries())r(he,me);if(q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[he,me]of q.oldChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(ce,Pe,he),Y(ce,he))}if(q.oldChildrenVerticesMap&&q.oldChildrenVerticesMap.size>0)for(const[he,me]of q.oldChildrenVerticesMap.entries())a(he,me)},redo:()=>{var le,de;if(i(z.Foundation,q.newSize),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[he,me]of q.newChildrenPositionsMap.entries()){s(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(j(Pe,ce,he),Y(Pe,he))}if(q.newChildrenVerticesMap&&q.newChildrenVerticesMap.size>0)for(const[he,me]of q.newChildrenVerticesMap.entries())a(he,me)}};c(q),p(f+1);break}default:{L(y,ae);const te={name:"Set Foundation Length",timestamp:Date.now(),oldSize:ne,newSize:ae,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,le;if(r(y.id,te.oldSize),te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[de,he]of te.oldChildrenPositionsMap.entries()){s(de,he.x,he.y,he.z);const me=(q=te.oldChildrenParentIdMap)==null?void 0:q.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(me,ce,de),Y(me,de))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[de,he]of te.oldChildrenVerticesMap.entries())a(de,he)},redo:()=>{var q,le;if(r(y.id,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[de,he]of te.newChildrenPositionsMap.entries()){s(de,he.x,he.y,he.z);const me=(q=te.oldChildrenParentIdMap)==null?void 0:q.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(ce,me,de),Y(ce,de))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[de,he]of te.newChildrenVerticesMap.entries())a(de,he)}};c(te),p(f+1);break}}},G=()=>{t(!1)},Q=()=>{G(),m()},oe=()=>{_(w),M.current||(t(!1),p(0))},ee=()=>{_(w)},$=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",k),rejectedMessage:$,onApply:ee,onClose:G,onClickCancel:Q,onClickOk:oe,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:w,onChange:ae=>{ae!==null&&x(ae)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 1000] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:ae=>H.getState().setFoundationActionScope(ae.target.value),value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",k)})]})})})]})})},SAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(Q3),r=H(hXe),i=H(H7),a=H(ON),l=H(M7),s=H(RS),c=H(Fn),u=H(ac),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Foundation),[w,x]=g.useState((y==null?void 0:y.ly)??.1),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=$=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const ae of e)if(ae.type===z.Foundation&&H.getState().selectedElementIdSet.has(ae.id)){const Z=ae,ne=s(Z.id);if(ne.length>0&&!ye.doesNewSizeContainAllChildren(Z,ne,Z.lx,$))return!1}break}case ie.AllObjectsOfThisType:{for(const ae of e)if(ae.type===z.Foundation){const Z=ae,ne=s(Z.id);if(ne.length>0&&!ye.doesNewSizeContainAllChildren(Z,ne,Z.lx,$))return!1}break}default:{const ae=s(y.id);if(ae.length>0)return ye.doesNewSizeContainAllChildren(y,ae,y.lx,$);break}}return!0}},U=$=>!N($),W=$=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const ae of e)if(ae.type===z.Foundation&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.ly-$)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const ae of e)if(ae.type===z.Foundation&&!ae.locked&&Math.abs(ae.ly-$)>Ht)return!0;break;default:if(Math.abs((y==null?void 0:y.ly)-$)>Ht)return!0}return!1}},F=($,ae)=>{if($==null)return null;for(const Z of $.children)if(Z.name.includes(`${ae}`))return Z;return null},E=($,ae,Z)=>{var ne,te;if($){for(const q of $.children)if(q.name.includes(`${Z.id}`)){(te=(ne=jn.getState().contentRef)==null?void 0:ne.current)==null||te.add(q);break}d(q=>{for(const le of q.elements)if(le.id===Z.id){le.parentId=rr;const de=new _t(le.cx,le.cy).rotateAround(ui,ae.rotation[2]).add(new _t(ae.cx,ae.cy));le.cx=de.x,le.cy=de.y,le.cz=0,S.current.set(le.id,new ue(de.x,de.y,0)),P.current.set(le.id,rr);break}})}},L=($,ae)=>{const Z=s($.id),ne=$.rotation[2];if(v.current.clear(),R.current.clear(),Z.length>0)for(const te of Z)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const q=new _t(te.cx*$.lx,te.cy*$.ly).rotateAround(ui,ne);v.current.set(te.id,q),A.current.set(te.id,new ue(te.cx,te.cy));break}case z.Polygon:{const q=te,le=[];for(const de of q.vertices)le.push(new _t(de.x*$.lx,de.y*$.ly).rotateAround(ui,ne));R.current.set(te.id,le),b.current.set(te.id,q.vertices.map(de=>({...de})));break}case z.Human:case z.Tree:{A.current.set(te.id,new ue(te.cx,te.cy,te.cz));break}}if(i($.id,ae),Z.length>0)for(const te of Z)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const q=v.current.get(te.id);if(q){const de=new _t(q.x,q.y).rotateAround(ui,-ne).y/ae;r(te.id,de),S.current.set(te.id,new ue(te.cx,de))}break}case z.Polygon:{const q=R.current.get(te.id);if(q){const le=[];for(const de of q){const he=de.rotateAround(ui,-ne),me=he.x/$.lx,ce=he.y/ae;le.push({x:me,y:ce})}l(te.id,le),T.current.set(te.id,le.map(de=>({...de})))}break}case z.Human:case z.Tree:{if(S.current.set(te.id,new ue(te.cx,te.cy,te.cz)),C.current.set(te.id,$.id),Math.abs(te.cz-$.lz/2)0){const q=jn.getState().contentRef,le=F(q==null?void 0:q.current,$.id);E(le,$,te)}}else if(Math.abs(Math.abs(te.cy)-$.ly/2)0?ae:-ae)/2;r(te.id,q),S.current.set(te.id,new ue(te.cz,q,te.cz))}break}}},j=($,ae,Z)=>{if(!$||!ae)return;const ne=jn.getState().contentRef,te=F(ne==null?void 0:ne.current,ae),q=F(ae===rr?ne==null?void 0:ne.current:te,Z);if(q&&(ne!=null&&ne.current)){if($===rr)ne.current.add(q);else{const le=F(ne.current,$);le==null||le.add(q)}Ip()}},Y=($,ae)=>{$&&d(Z=>{for(const ne of Z.elements)if(ne.id===ae){ne.parentId=$;break}})},O=$=>{if(!y||!W($))return;const ae=n(y.id),Z=ae?ae.ly:y.ly;if(D.current=void 0,M.current=U($),M.current)D.current=$,x(Z);else switch(A.current.clear(),S.current.clear(),b.current.clear(),T.current.clear(),u){case ie.AllSelectedObjectsOfThisType:{const ne=new Map;for(const q of e)q.type===z.Foundation&&H.getState().selectedElementIdSet.has(q.id)&&ne.set(q.id,q.ly);for(const q of e)q.type===z.Foundation&&H.getState().selectedElementIdSet.has(q.id)&&L(q,$);const te={name:"Set Width for Selected Foundations",timestamp:Date.now(),oldSizes:ne,newSize:$,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,le;for(const[de,he]of te.oldSizes.entries())i(de,he);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[de,he]of te.oldChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=(q=te.oldChildrenParentIdMap)==null?void 0:q.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(me,ce,de),Y(me,de))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[de,he]of te.oldChildrenVerticesMap.entries())l(de,he)},redo:()=>{var q,le;for(const[de,he]of te.oldSizes.entries())i(de,te.newSize);if(te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[de,he]of te.newChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=(q=te.oldChildrenParentIdMap)==null?void 0:q.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(ce,me,de),Y(ce,de))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[de,he]of te.newChildrenVerticesMap.entries())l(de,he)}};c(te),p(f+1);break}case ie.AllObjectsOfThisType:{const ne=new Map;for(const q of e)q.type===z.Foundation&&ne.set(q.id,q.ly);for(const q of e)q.type===z.Foundation&&L(q,$);const te={name:"Set Width for All Foundations",timestamp:Date.now(),oldSizes:ne,newSize:$,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,le;for(const[de,he]of te.oldSizes.entries())i(de,he);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[de,he]of te.oldChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=(q=te.oldChildrenParentIdMap)==null?void 0:q.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(me,ce,de),Y(me,de))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[de,he]of te.oldChildrenVerticesMap.entries())l(de,he)},redo:()=>{var q,le;if(a(z.Foundation,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[de,he]of te.newChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const me=(q=te.oldChildrenParentIdMap)==null?void 0:q.get(de),ce=(le=te.newChildrenParentIdMap)==null?void 0:le.get(de);me&&ce&&me!==ce&&(j(ce,me,de),Y(ce,de))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[de,he]of te.newChildrenVerticesMap.entries())l(de,he)}};c(te),p(f+1);break}default:{L(y,$);const ne={name:"Set Foundation Width",timestamp:Date.now(),oldSize:Z,newSize:$,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var te,q;if(i(y.id,ne.oldSize),ne.oldChildrenPositionsMap&&ne.oldChildrenPositionsMap.size>0)for(const[le,de]of ne.oldChildrenPositionsMap.entries()){o(le,de.x,de.y,de.z);const he=(te=ne.oldChildrenParentIdMap)==null?void 0:te.get(le),me=(q=ne.newChildrenParentIdMap)==null?void 0:q.get(le);he&&me&&he!==me&&(j(he,me,le),Y(he,le))}if(ne.oldChildrenVerticesMap&&ne.oldChildrenVerticesMap.size>0)for(const[le,de]of ne.oldChildrenVerticesMap.entries())l(le,de)},redo:()=>{var te,q;if(i(y.id,ne.newSize),ne.newChildrenPositionsMap&&ne.newChildrenPositionsMap.size>0)for(const[le,de]of ne.newChildrenPositionsMap.entries()){o(le,de.x,de.y,de.z);const he=(te=ne.oldChildrenParentIdMap)==null?void 0:te.get(le),me=(q=ne.newChildrenParentIdMap)==null?void 0:q.get(le);he&&me&&he!==me&&(j(me,he,le),Y(me,le))}if(ne.newChildrenVerticesMap&&ne.newChildrenVerticesMap.size>0)for(const[le,de]of ne.newChildrenVerticesMap.entries())l(le,de)}};c(ne),p(f+1);break}}},_=()=>{t(!1)},G=()=>{_(),m()},Q=()=>{O(w),M.current||(t(!1),p(0))},oe=()=>{O(w)},ee=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Width",k),rejectedMessage:ee,onApply:oe,onClickCancel:G,onClickOk:Q,onClose:_,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:w,onChange:$=>{$!==null&&x($)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 1000] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:$=>H.getState().setFoundationActionScope($.target.value),value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",k)})]})})})]})})},TAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(Q3),l=H(no),s=H(qn),c=ao(z.Foundation),[u,d]=g.useState((c==null?void 0:c.lz)??.1),f=g.useRef(new Map),p=g.useRef(new Map),m=g.useRef(new Map),y=g.useRef(new Map),w=Kt(),x=(N,U)=>{e(W=>{const F=W.elements.find(E=>E.id===N);F&&(F.lz=U,F.cz=U/2)})},C=(N,U)=>{e(W=>{for(const F of W.elements)F.type===N&&!F.locked&&(F.lz=U,F.cz=U/2)})},P=N=>{if(c){switch(i){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Foundation&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.lz-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:for(const U of n)if(U.type===z.Foundation&&!U.locked&&Math.abs(U.lz-N)>Ht)return!0;break;default:if(Math.abs((c==null?void 0:c.lz)-N)>Ht)return!0}return!1}},A=(N,U)=>{if(N==null)return null;for(const W of N.children)if(W.name.includes(`${U}`))return W;return null},S=(N,U,W)=>{var F,E;if(N){for(const j of N.children)if(j.name.includes(`${W.id}`)){(E=(F=jn.getState().contentRef)==null?void 0:F.current)==null||E.add(j);break}W.parentId=rr;const L=new _t(W.cx,W.cy).rotateAround(ui,-U.rotation[2]).add(new _t(U.cx,U.cy));W.cx=L.x,W.cy=L.y,W.cz=0,y.current.set(W.id,new ue(L.x,L.y,0)),p.current.set(W.id,rr)}},v=(N,U,W)=>{e(F=>{for(const E of F.elements)if(E.parentId===N.id)if(f.current.set(E.id,N.id),m.current.set(E.id,new ue(E.cx,E.cy,E.cz)),ye.isPlantOrHuman(E))if(Math.abs(E.cz-N.lz/2)U/2){const j=jn.getState().contentRef,Y=A(j==null?void 0:j.current,N.id);S(Y,N,E)}else E.cz=L,y.current.set(E.id,new ue(E.cx,E.cy,L))}else E.type===z.SolarPanel&&(E.cz=U/2,y.current.set(E.id,new ue(E.cx,E.cy,U/2)));else E.foundationId===N.id&&E.type===z.SolarPanel&&E.parentType==z.Roof&&W!==void 0&&(m.current.set(E.id,new ue(E.cx,E.cy,E.cz)),E.cz=E.cz-W/2+U/2,y.current.set(E.id,new ue(E.cx,E.cy,E.cz)))})},b=(N,U,W)=>{if(!N||!U)return;const F=jn.getState().contentRef,E=A(F==null?void 0:F.current,U),L=A(U===rr?F==null?void 0:F.current:E,W);if(L&&(F!=null&&F.current)){if(N===rr)F.current.add(L);else{const j=A(F.current,N);j==null||j.add(L)}Ip()}},T=(N,U)=>{N&&e(W=>{for(const F of W.elements)if(F.id===U){F.parentId=N;break}})},R=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)if(N.has(F.id))if(U!==void 0)F.lz=U,F.cz=U/2;else{const E=N.get(F.id);E!==void 0&&(F.lz=E,F.cz=E/2)}})},M=N=>{if(c&&P(N)){switch(i){case ie.AllSelectedObjectsOfThisType:{const U=new Map;for(const F of n)F.type===z.Foundation&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.lz);for(const F of n)F.type===z.Foundation&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&v(F,N,U.get(F.id));const W={name:"Set Height for Selected Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(m.current),newChildrenPositionsMap:new Map(y.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var F,E;if(R(W.oldValues),W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const Y=(F=W.oldChildrenParentIdMap)==null?void 0:F.get(L),O=(E=W.newChildrenParentIdMap)==null?void 0:E.get(L);Y&&O&&Y!==O&&(b(Y,O,L),T(Y,L))}},redo:()=>{var E,L;const F=W.newValue;if(R(W.oldValues,F),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,Y]of W.newChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=W.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(_,O,j),T(_,j))}}};r(W),R(U,N),s(l+1);break}case ie.AllObjectsOfThisType:{const U=new Map;for(const F of n)F.type===z.Foundation&&U.set(F.id,F.lz);for(const F of n)F.type===z.Foundation&&v(F,N,U.get(F.id));const W={name:"Set Height for All Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(m.current),newChildrenPositionsMap:new Map(y.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var F,E;for(const[L,j]of W.oldValues.entries())x(L,j);if(W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const Y=(F=W.oldChildrenParentIdMap)==null?void 0:F.get(L),O=(E=W.newChildrenParentIdMap)==null?void 0:E.get(L);Y&&O&&Y!==O&&(b(Y,O,L),T(Y,L))}},redo:()=>{var E,L;const F=W.newValue;if(C(z.Foundation,F),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,Y]of W.newChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=W.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(_,O,j),T(_,j))}}};r(W),C(z.Foundation,N),s(l+1);break}default:{const U=o(c.id),W=U?U.lz:c.lz;v(c,N,W),x(c.id,N);const F={name:"Set Foundation Height",timestamp:Date.now(),oldValue:W,newValue:N,oldChildrenPositionsMap:new Map(m.current),newChildrenPositionsMap:new Map(y.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),changedElementId:c.id,changedElementType:c.type,undo:()=>{var E,L;if(x(F.changedElementId,F.oldValue),F.oldChildrenPositionsMap&&F.oldChildrenPositionsMap.size>0)for(const[j,Y]of F.oldChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=F.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=F.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(O,_,j),T(O,j))}},redo:()=>{var E,L;if(x(F.changedElementId,F.newValue),F.newChildrenPositionsMap&&F.newChildrenPositionsMap.size>0)for(const[j,Y]of F.newChildrenPositionsMap.entries()){a(j,Y.x,Y.y,Y.z);const O=(E=F.oldChildrenParentIdMap)==null?void 0:E.get(j),_=(L=F.newChildrenParentIdMap)==null?void 0:L.get(j);O&&_&&O!==_&&(b(_,O,j),T(_,j))}}};r(F),s(l+1);break}}e(U=>{U.actionState.foundationHeight=N})}},D=()=>{t(!1)},k=()=>{M(u)};return h.jsx(ro,{width:550,title:B.t("word.Height",w),onApply:k,onClose:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:10,style:{width:120},step:.1,precision:2,value:u,onChange:N=>{N!==null&&d(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",w),": [0.1, 10] ",B.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:N=>H.getState().setFoundationActionScope(N.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",w)})]})})})]})})},PAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(mQ),r=H(LPt),i=H(Fn),a=H(ac),l=H(no),s=H(qn),c=ao(z.Foundation),[u,d]=g.useState(c?-(c==null?void 0:c.rotation[2]):0),f=Kt(),p=C=>{if(c){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const P of e)if(P.type===z.Foundation&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(-P.rotation[2]-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:for(const P of e)if(P.type===z.Foundation&&!P.locked&&Math.abs(-P.rotation[2]-C)>Ht)return!0;break;default:if(Math.abs(-(c==null?void 0:c.rotation[2])-C)>Ht)return!0}return!1}},m=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(C.has(S.id))if(P!==void 0)S.rotation[2]=P;else{const v=C.get(S.id);v!==void 0&&(S.rotation[2]=-v)}})},y=C=>{if(c&&p(C))switch(a){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Foundation&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,-S.rotation[2]);const A={name:"Set Azimuth for All Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{m(A.oldValues)},redo:()=>{m(A.oldValues,-A.newValue)}};i(A),m(P,-C),s(l+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Foundation&&P.set(S.id,-S.rotation[2]);const A={name:"Set Azimuth for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[S,v]of A.oldValues.entries())o(S,0,0,-v)},redo:()=>{r(z.Foundation,0,0,-A.newValue)}};i(A),r(z.Foundation,0,0,-C),s(l+1);break}default:{const P=n(c.id),A=P?-P.rotation[2]:-c.rotation[2],S={name:"Set Foundation Azimuth",timestamp:Date.now(),oldValue:A,newValue:C,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(S.changedElementId,0,0,-S.oldValue)},redo:()=>{o(S.changedElementId,0,0,-S.newValue)}};i(S),o(c.id,0,0,-C),s(l+1);break}}},w=()=>{t(!1)},x=()=>{y(u)};return h.jsx(ro,{width:500,title:B.t("word.Azimuth",f),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(u).toFixed(2)),formatter:C=>`${C}°`,onChange:C=>{C!==null&&d(ye.toRadians(C))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:C=>H.getState().setFoundationActionScope(C.target.value),value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},CAo=({setDialogVisible:t})=>{const e=H(Qn),n=H(q3),o=H(Fn),r=H(ac),i=H(WPt),a=H(no),l=H(qn),s=H(Ji),c=H(Jn),u=H(pn),d=H(F=>{if(n){for(const E of F.elements)if(E.id===n.id)return E}return null}),[f,p]=g.useState((d==null?void 0:d.rValue)??Kw),[m,y]=g.useState(ye.toRValueInUS(f)),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S=Kt();g.useEffect(()=>{d&&p((d==null?void 0:d.rValue)??Kw)},[d==null?void 0:d.rValue]);const v=F=>{switch(r){case ie.AllObjectsOfThisType:for(const E of e)if(E.type===z.Foundation&&!E.locked){const L=E;if(L.rValue===void 0||Math.abs(L.rValue-F)>Ht)return!0}break;default:if((d==null?void 0:d.rValue)===void 0||Math.abs((d==null?void 0:d.rValue)-F)>Ht)return!0}return!1},b=(F,E)=>{u(L=>{for(const j of L.elements)if(j.id===F){j.rValue=E;break}})},T=F=>{for(const[E,L]of F.entries())b(E,L)},R=(F,E)=>{for(const L of F.keys())b(L,E)},M=F=>{if(d&&v(F)){switch(r){case ie.AllObjectsOfThisType:{const E=new Map;u(j=>{for(const Y of j.elements)if(Y.type===z.Foundation&&!Y.locked){const O=Y;E.set(Y.id,O.rValue??Kw),O.rValue=F}});const L={name:"Set R-Value for All Ground Floors",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{T(L.oldValues)},redo:()=>{R(L.oldValues,L.newValue)}};o(L),l(a+1);break}default:{if(d){const L=c(d.id).rValue??d.rValue??Kw,j={name:"Set Ground Floor R-Value",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:d.id,changedElementType:d.type,undo:()=>{b(j.changedElementId,j.oldValue)},redo:()=>{b(j.changedElementId,j.newValue)}};o(j),b(d.id,F),l(a+1)}break}}u(E=>{E.actionState.groundFloorRValue=F})}},D=(F,E)=>{if(A.current){const{clientWidth:L,clientHeight:j}=window.document.documentElement,Y=A.current.getBoundingClientRect();P({left:-Y.left+E.x,right:L-(Y.right-E.x),top:-Y.top+E.y,bottom:j-((Y==null?void 0:Y.bottom)-E.y)})}},k=()=>{p((d==null?void 0:d.rValue)??Kw),t(!1)},N=()=>{k(),s()},U=()=>{M(f),t(!1),l(0)},W=()=>{M(f)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:[B.t("word.RValue",S)+" ","(",B.t("word.ThermalResistance",S),")"]}),footer:[h.jsx(oo,{onClick:W,children:B.t("word.Apply",S)},"Apply"),h.jsx(oo,{onClick:N,children:B.t("word.Cancel",S)},"Cancel"),h.jsx(oo,{type:"primary",onClick:U,children:B.t("word.OK",S)},"OK")],onCancel:k,maskClosable:!1,destroyOnClose:!1,modalRender:F=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(E,L)=>D(E,L),children:h.jsx("div",{ref:A,children:F})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:F=>Number(F).toFixed(2),onChange:F=>{F!==null&&(p(F),y(ye.toRValueInUS(F)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",S),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:m,formatter:F=>Number(F).toFixed(2),onChange:F=>{F!==null&&(y(F),p(ye.toRValueInSI(F)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",S),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:F=>i(F.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisGroundFloor",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllGroundFloors",S)})]})})})]})})})},RAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberHeight)??10),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberHeight=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberHeight=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberHeight=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberHeight===void 0||Math.abs(v.solarAbsorberPipe.absorberHeight-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberHeight===void 0||Math.abs(v.solarAbsorberPipe.absorberHeight-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberHeight)===void 0||Math.abs((c==null?void 0:c.absorberHeight)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberHeight??10)}const v={name:"Set Absorber Height for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberHeight??10)}const v={name:"Set Absorber Height for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberHeight??10:c.absorberHeight??10;p(s.id,A);const b={name:"Set Absorber Height on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarAbsorberPipeMenu.AbsorberHeight",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:50,style:{width:120},step:.5,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [1, 50] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},HAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.apertureWidth)??.6),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.apertureWidth=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.apertureWidth=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.apertureWidth=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.apertureWidth===void 0||Math.abs(v.solarAbsorberPipe.apertureWidth-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.apertureWidth===void 0||Math.abs(v.solarAbsorberPipe.apertureWidth-A)>Ht))return!0}break;default:if((c==null?void 0:c.apertureWidth)===void 0||Math.abs((c==null?void 0:c.apertureWidth)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.apertureWidth??.6)}const v={name:"Set Absorber Aperture Width for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.apertureWidth??.6)}const v={name:"Set Absorber Aperture Width for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.apertureWidth??.6:c.apertureWidth??.6;p(s.id,A);const b={name:"Set Absorber Aperture Width on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarAbsorberPipeMenu.AbsorberApertureWidth",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0.1, 2] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},MAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.poleNumber)??5),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.poleNumber=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.poleNumber=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.poleNumber=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.poleNumber===void 0||v.solarAbsorberPipe.poleNumber!==A))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.poleNumber===void 0||v.solarAbsorberPipe.poleNumber!==A))return!0}break;default:if((c==null?void 0:c.poleNumber)===void 0||(c==null?void 0:c.poleNumber)!==A)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.poleNumber??5)}const v={name:"Set Absorber Pipe Pole Number for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.poleNumber??5)}const v={name:"Set Absorber Pipe Pole Number for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.poleNumber??5:c.poleNumber??5;p(s.id,A);const b={name:"Set Absorber Pipe Pole Number on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:1,max:100,style:{width:120},step:1,precision:0,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [1, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},IAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberAbsorptance)??.95),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberAbsorptance=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberAbsorptance=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberAbsorptance=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(v.solarAbsorberPipe.absorberAbsorptance-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(v.solarAbsorberPipe.absorberAbsorptance-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberAbsorptance)===void 0||Math.abs((c==null?void 0:c.absorberAbsorptance)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberAbsorptance??.95)}const v={name:"Set Absorber Pipe Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberAbsorptance??.95)}const v={name:"Set Absorber Pipe Absorptance for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberAbsorptance??.95:c.absorberAbsorptance??.95;p(s.id,A);const b={name:"Set Absorber Pipe Absorptance on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarAbsorberPipeMenu.AbsorberAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},zAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberOpticalEfficiency)??.7),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberOpticalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberOpticalEfficiency=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberOpticalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberOpticalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberOpticalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberOpticalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const v={name:"Set Absorber Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const v={name:"Set Absorber Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberOpticalEfficiency??.7:c.absorberOpticalEfficiency??.7;p(s.id,A);const b={name:"Set Absorber Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},DAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=g.useState((c==null?void 0:c.absorberThermalEfficiency)??.3),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberThermalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberThermalEfficiency=A)}})},y=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusPipe&&(T.solarAbsorberPipe||(T.solarAbsorberPipe={}),T.solarAbsorberPipe.absorberThermalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberThermalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusPipe&&v.solarAbsorberPipe&&(v.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(v.solarAbsorberPipe.absorberThermalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.absorberThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberThermalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberThermalEfficiency??.3)}const v={name:"Set Absorber Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarAbsorberPipe&&S.set(b.id,T.solarAbsorberPipe.absorberThermalEfficiency??.3)}const v={name:"Set Absorber Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarAbsorberPipe?S.solarAbsorberPipe.absorberThermalEfficiency??.3:c.absorberThermalEfficiency??.3;p(s.id,A);const b={name:"Set Absorber Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},EAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.towerHeight)??20),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerHeight=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerHeight=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerHeight=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerHeight===void 0||Math.abs(v.solarPowerTower.towerHeight-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerHeight===void 0||Math.abs(v.solarPowerTower.towerHeight-A)>Ht))return!0}break;default:if((c==null?void 0:c.towerHeight)===void 0||Math.abs((c==null?void 0:c.towerHeight)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerHeight??20)}const v={name:"Set Tower Height for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerHeight??20)}const v={name:"Set Tower Height for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.towerHeight??20:c.towerHeight??20;p(s.id,A);const b={name:"Set Tower Height on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarPowerTowerMenu.ReceiverTowerHeight",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:10,max:500,style:{width:120},step:1,precision:1,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [10, 500] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},kAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.towerRadius)??1),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerRadius=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerRadius=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.towerRadius=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerRadius===void 0||Math.abs(v.solarPowerTower.towerRadius-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.towerRadius===void 0||Math.abs(v.solarPowerTower.towerRadius-A)>Ht))return!0}break;default:if((c==null?void 0:c.towerRadius)===void 0||Math.abs((c==null?void 0:c.towerRadius)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerRadius??1)}const v={name:"Set Tower Radius for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.towerRadius??1)}const v={name:"Set Tower Radius for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.towerRadius??1:c.towerRadius??1;p(s.id,A);const b={name:"Set Tower Radius on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarPowerTowerMenu.ReceiverTowerRadius",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.5,max:10,style:{width:120},step:.5,precision:1,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0.5, 10] ",B.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",f)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},FAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.receiverAbsorptance)??.95),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverAbsorptance=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverAbsorptance=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverAbsorptance=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverAbsorptance===void 0||Math.abs(v.solarPowerTower.receiverAbsorptance-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverAbsorptance===void 0||Math.abs(v.solarPowerTower.receiverAbsorptance-A)>Ht))return!0}break;default:if((c==null?void 0:c.receiverAbsorptance)===void 0||Math.abs((c==null?void 0:c.receiverAbsorptance)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverAbsorptance??.95)}const v={name:"Set Receiver Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverAbsorptance??.95)}const v={name:"Set Receiver Absorptance for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.receiverAbsorptance??.95:c.receiverAbsorptance??.95;p(s.id,A);const b={name:"Set Receiver Absorptance on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarPowerTowerMenu.ReceiverAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},LAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.receiverThermalEfficiency)??.3),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverThermalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverThermalEfficiency=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverThermalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverThermalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverThermalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.receiverThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverThermalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverThermalEfficiency??.3)}const v={name:"Set Receiver Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverThermalEfficiency??.3)}const v={name:"Set Receiver Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.receiverThermalEfficiency??.3:c.receiverThermalEfficiency??.3;p(s.id,A);const b={name:"Set Receiver Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("solarPowerTowerMenu.ReceiverThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},WAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=g.useState((c==null?void 0:c.receiverOpticalEfficiency)??.7),f=Kt(),p=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverOpticalEfficiency=S);break}})},m=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverOpticalEfficiency=A)}})},y=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.FocusTower&&(T.solarPowerTower||(T.solarPowerTower={}),T.solarPowerTower.receiverOpticalEfficiency=S)}})},w=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverOpticalEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.FocusTower&&v.solarPowerTower&&(v.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(v.solarPowerTower.receiverOpticalEfficiency-A)>Ht))return!0}break;default:if((c==null?void 0:c.receiverOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverOpticalEfficiency)-A)>Ht)return!0}return!1},x=A=>{if(!(!s||!c)&&w(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverOpticalEfficiency??.7)}const v={name:"Set Receiver Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{y(v.oldValues,v.newValue)}};r(v),y(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarPowerTower&&S.set(b.id,T.solarPowerTower.receiverOpticalEfficiency??.7)}const v={name:"Set Receiver Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())p(b,T)},redo:()=>{m(v.newValue)}};r(v),m(A),l(a+1);break}default:{const S=o(s.id),v=S&&S.solarPowerTower?S.solarPowerTower.receiverOpticalEfficiency??.7:c.receiverOpticalEfficiency??.7;p(s.id,A);const b={name:"Set Receiver Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),l(a+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:500,title:B.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:A=>{A!==null&&d(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",f)})]})})})]})})},NAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyHeight)??Math.max((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0)),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyHeight=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyHeight=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyHeight=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyHeight===void 0||Math.abs(v.solarUpdraftTower.chimneyHeight-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyHeight===void 0||Math.abs(v.solarUpdraftTower.chimneyHeight-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyHeight===void 0||Math.abs(s.solarUpdraftTower.chimneyHeight-A)>Ht))return!0}return!1},w=A=>{var S,v;if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation&&H.getState().selectedElementIdSet.has(R.id)){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((S=M.solarUpdraftTower)==null?void 0:S.chimneyHeight)??Math.max(M.lx,M.ly))}const T={name:"Set Solar Chimney Height for Selected Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{m(T.oldValues,T.newValue)}};r(T),m(b,A),l(a+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((v=M.solarUpdraftTower)==null?void 0:v.chimneyHeight)??Math.max(M.lx,M.ly))}const T={name:"Set Solar Chimney Height for All Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};r(T),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const b=o(s.id),T=b&&b.solarUpdraftTower?b.solarUpdraftTower.chimneyHeight??Math.max(b.lx,b.ly):s.solarUpdraftTower.chimneyHeight??Math.max(s.lx,s.ly);f(s.id,A);const R={name:"Set Solar Chimney Height on Foundation",timestamp:Date.now(),oldValue:T,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [1, 1000] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},UAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyRadius)??Math.max(1,.025*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyRadius=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyRadius=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.chimneyRadius=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyRadius===void 0||Math.abs(v.solarUpdraftTower.chimneyRadius-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.chimneyRadius===void 0||Math.abs(v.solarUpdraftTower.chimneyRadius-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyRadius===void 0||Math.abs(s.solarUpdraftTower.chimneyRadius-A)>Ht))return!0}return!1},w=A=>{var S,v;if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation&&H.getState().selectedElementIdSet.has(R.id)){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((S=M.solarUpdraftTower)==null?void 0:S.chimneyRadius)??Math.max(1,.025*Math.min(M.lx,M.ly)))}const T={name:"Set Solar Chimney Radius for Selected Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{m(T.oldValues,T.newValue)}};r(T),m(b,A),l(a+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)if(R.type===z.Foundation){const M=R;M.solarStructure===Nn.UpdraftTower&&M.solarUpdraftTower&&b.set(R.id,((v=M.solarUpdraftTower)==null?void 0:v.chimneyRadius)??Math.max(1,.025*Math.min(M.lx,M.ly)))}const T={name:"Set Solar Chimney Radius for All Foundations",timestamp:Date.now(),oldValues:b,newValue:A,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};r(T),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const b=o(s.id),T=b&&b.solarUpdraftTower?b.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(b.lx,b.ly)):s.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(s.lx,s.ly));f(s.id,A);const R={name:"Set Solar Chimney Radius on Foundation",timestamp:Date.now(),oldValue:T,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:10,style:{width:120},step:1,precision:1,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.1, 10] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},jAo=({setDialogVisible:t})=>{var x;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=ao(z.Foundation),[l,s]=g.useState(((x=a==null?void 0:a.solarUpdraftTower)==null?void 0:x.collectorHeight)??Math.max(3,10*((a==null?void 0:a.lz)??0))),c=Kt(),u=(C,P)=>{e(A=>{for(const S of A.elements)if(S.type===z.Foundation&&S.id===C&&!S.locked){const v=S;v.solarStructure===Nn.UpdraftTower&&(v.solarUpdraftTower||(v.solarUpdraftTower={}),v.solarUpdraftTower.collectorHeight=P);break}})},d=C=>{e(P=>{for(const A of P.elements)if(A.type===z.Foundation&&!A.locked){const S=A;S.solarStructure===Nn.UpdraftTower&&(S.solarUpdraftTower||(S.solarUpdraftTower={}),S.solarUpdraftTower.collectorHeight=C)}})},f=(C,P)=>{e(A=>{for(const S of A.elements)if(S.type===z.Foundation&&!S.locked&&C.has(S.id)){const v=S;v.solarStructure===Nn.UpdraftTower&&(v.solarUpdraftTower||(v.solarUpdraftTower={}),v.solarUpdraftTower.collectorHeight=P)}})},p=C=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)){const A=P;if(A.solarStructure===Nn.UpdraftTower&&A.solarUpdraftTower&&(A.solarUpdraftTower.collectorHeight===void 0||Math.abs(A.solarUpdraftTower.collectorHeight-C)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked){const A=P;if(A.solarStructure===Nn.UpdraftTower&&A.solarUpdraftTower&&(A.solarUpdraftTower.collectorHeight===void 0||Math.abs(A.solarUpdraftTower.collectorHeight-C)>Ht))return!0}break;default:if(a&&a.solarStructure===Nn.UpdraftTower&&a.solarUpdraftTower&&(a.solarUpdraftTower.collectorHeight===void 0||Math.abs(a.solarUpdraftTower.collectorHeight-C)>Ht))return!0}return!1},m=C=>{if(a&&p(C))switch(i){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of n)if(S.type===z.Foundation&&H.getState().selectedElementIdSet.has(S.id)){const v=S;v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&P.set(S.id,v.solarUpdraftTower.collectorHeight??Math.max(3,10*v.lz))}const A={name:"Set Solar Collector Height for Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[S,v]of A.oldValues.entries())u(S,v)},redo:()=>{f(A.oldValues,A.newValue)}};r(A),f(P,C);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of n)if(S.type===z.Foundation){const v=S;v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&P.set(S.id,v.solarUpdraftTower.collectorHeight??Math.max(3,10*v.lz))}const A={name:"Set Solar Collector Height for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[S,v]of A.oldValues.entries())u(S,v)},redo:()=>{d(A.newValue)}};r(A),d(C);break}default:{if(a.solarStructure===Nn.UpdraftTower&&a.solarUpdraftTower){const P=o(a.id),A=P&&P.solarUpdraftTower?P.solarUpdraftTower.collectorHeight??Math.max(3,10*P.lz):a.solarUpdraftTower.collectorHeight??Math.max(3,10*a.lz);u(a.id,C);const S={name:"Set Solar Collector Height on Foundation",timestamp:Date.now(),oldValue:A,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{u(S.changedElementId,S.oldValue)},redo:()=>{u(S.changedElementId,S.newValue)}};r(S)}break}}},y=()=>{t(!1)},w=()=>{m(l)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",c),onApply:w,onClose:y,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:20,style:{width:120},step:1,precision:1,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 20] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:C=>H.getState().setFoundationActionScope(C.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",c)})]})})})]})})},BAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorRadius)??Math.max(10,.5*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorRadius=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorRadius=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorRadius=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorRadius===void 0||Math.abs(v.solarUpdraftTower.collectorRadius-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorRadius===void 0||Math.abs(v.solarUpdraftTower.collectorRadius-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorRadius===void 0||Math.abs(s.solarUpdraftTower.collectorRadius-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(T.lx,T.ly)))}const v={name:"Set Solar Collector Radius for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(T.lx,T.ly)))}const v={name:"Set Solar Collector Radius for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(S.lx,S.ly)):s.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(s.lx,s.ly));f(s.id,A);const b={name:"Set Solar Collector Radius on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [1, 1000] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},YAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorTransmissivity)??.9),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorTransmissivity=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorTransmissivity=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorTransmissivity=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorTransmissivity-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorTransmissivity-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorTransmissivity-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorTransmissivity??.9)}const v={name:"Set Solar Collector Transmissivity for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorTransmissivity??.9)}const v={name:"Set Solar Collector Transmissivity for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.collectorTransmissivity??.9:s.solarUpdraftTower.collectorTransmissivity??.9;f(s.id,A);const b={name:"Set Solar Collector Transmissivity on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},OAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorEmissivity)??.95),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorEmissivity=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorEmissivity=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorEmissivity=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorEmissivity-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(v.solarUpdraftTower.collectorEmissivity-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorEmissivity-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorEmissivity??.95)}const v={name:"Set Solar Collector Emissivity for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.collectorEmissivity??.95)}const v={name:"Set Solar Collector Emissivity for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.collectorEmissivity??.95:s.solarUpdraftTower.collectorEmissivity??.95;f(s.id,A);const b={name:"Set Solar Collector Emissivity on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},_Ao=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.dischargeCoefficient)??.65),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.dischargeCoefficient=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.dischargeCoefficient=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.dischargeCoefficient=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(v.solarUpdraftTower.dischargeCoefficient-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(v.solarUpdraftTower.dischargeCoefficient-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(s.solarUpdraftTower.dischargeCoefficient-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.dischargeCoefficient??.65)}const v={name:"Set Solar Chimney Discharge Coefficient for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.dischargeCoefficient??.65)}const v={name:"Set Solar Chimney Discharge Coefficient for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.dischargeCoefficient??.65:s.solarUpdraftTower.dischargeCoefficient??.65;f(s.id,A);const b={name:"Set Solar Chimney Discharge Coefficient on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.65,max:.7,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.65, 0.70]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},VAo=({setDialogVisible:t})=>{var P;const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(ac),a=H(no),l=H(qn),s=ao(z.Foundation),[c,u]=g.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.turbineEfficiency)??.3),d=Kt(),f=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&b.id===A&&!b.locked){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.turbineEfficiency=S);break}})},p=A=>{e(S=>{for(const v of S.elements)if(v.type===z.Foundation&&!v.locked){const b=v;b.solarStructure===Nn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.turbineEfficiency=A)}})},m=(A,S)=>{e(v=>{for(const b of v.elements)if(b.type===z.Foundation&&!b.locked&&A.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.turbineEfficiency=S)}})},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(v.solarUpdraftTower.turbineEfficiency-A)>Ht))return!0}break;case ie.AllObjectsOfThisType:for(const S of n)if(S.type===z.Foundation&&!S.locked){const v=S;if(v.solarStructure===Nn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(v.solarUpdraftTower.turbineEfficiency-A)>Ht))return!0}break;default:if(s&&s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(s.solarUpdraftTower.turbineEfficiency-A)>Ht))return!0}return!1},w=A=>{if(s&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation&&H.getState().selectedElementIdSet.has(b.id)){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.turbineEfficiency??.3)}const v={name:"Set Solar Updraft Tower Turbine Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{m(v.oldValues,v.newValue)}};r(v),m(S,A),l(a+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of n)if(b.type===z.Foundation){const T=b;T.solarStructure===Nn.UpdraftTower&&T.solarUpdraftTower&&S.set(b.id,T.solarUpdraftTower.turbineEfficiency??.3)}const v={name:"Set Solar Updraft Tower Turbine Efficiency for All Foundations",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())f(b,T)},redo:()=>{p(v.newValue)}};r(v),p(A),l(a+1);break}default:{if(s.solarStructure===Nn.UpdraftTower&&s.solarUpdraftTower){const S=o(s.id),v=S&&S.solarUpdraftTower?S.solarUpdraftTower.turbineEfficiency??.3:s.solarUpdraftTower.turbineEfficiency??.3;f(s.id,A);const b={name:"Set Solar Updraft Tower Turbine Efficiency on Foundation",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};r(b),l(a+1)}break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:540,title:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.2,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:A=>{A!==null&&u(A)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.2, 1.0]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>H.getState().setFoundationActionScope(A.target.value),value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("foundationMenu.AllFoundations",d)})]})})})]})})},{Option:qP}=Ko,GAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),[i,a]=g.useState(!1),[l,s]=g.useState(!1),[c,u]=g.useState({left:0,top:0,bottom:0,right:0}),d=g.useRef(null),f=H(w4).geneticAlgorithmParams,p=g.useRef(f.selectionMethod),m=g.useRef(f.searchMethod),y=g.useRef(Math.min(f.objectiveFunctionType,Mo.YEARLY_TOTAL_OUTPUT)),w=g.useRef(f.populationSize),x=g.useRef(f.maximumGenerations),C=g.useRef(f.mutationRate),P=g.useRef(f.selectionRate??.5),A=g.useRef(f.crossoverRate??.5),S=g.useRef(f.convergenceThreshold),v=g.useRef(f.localSearchRadius),b=g.useRef(null);g.useEffect(()=>{var N;(N=b.current)==null||N.focus()},[]);const T={lng:o},R=(N,U)=>{if(d.current){const{clientWidth:W,clientHeight:F}=window.document.documentElement,E=d.current.getBoundingClientRect();u({left:-E.left+U.x,right:W-(E.right-U.x),top:-E.top+U.y,bottom:F-((E==null?void 0:E.bottom)-U.y)})}},M=()=>{e(N=>{N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=y.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=p.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=m.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=w.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=x.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=P.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=A.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=C.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=S.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=v.current})},D=()=>{r||yn(k("message.EvolutionStarted",T)),M(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=ec.GENETIC_ALGORITHM,N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Genetic Algorithm for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:k}=Jl();return h.jsx(h.Fragment,{children:h.jsxs(li,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:[k("optimizationMenu.SolarPanelTiltAngleOptimization",T)+": ",k("optimizationMenu.GeneticAlgorithmSettings",T)]}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:k("word.Cancel",T)},"Cancel"),h.jsx(oo,{type:"primary",ref:b,onClick:()=>{D(),t(!1)},children:k("word.Run",T)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Vi,{disabled:!l,bounds:c,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:d,children:N})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.Objective",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:y.current,style:{width:"100%"},value:y.current,onChange:N=>{y.current=N,a(!i)},children:[h.jsx(qP,{value:Mo.DAILY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionDailyTotalYield",T)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(qP,{value:Mo.YEARLY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionYearlyTotalYield",T)},Mo.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.GeneticAlgorithmSelectionMethod",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,a(!i)},children:[h.jsx(qP,{value:by.ROULETTE_WHEEL,children:k("optimizationMenu.RouletteWheel",T)},by.ROULETTE_WHEEL),h.jsx(qP,{value:by.TOURNAMENT,children:k("optimizationMenu.Tournament",T)},by.TOURNAMENT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.PopulationSize",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:w.current,step:1,onChange:N=>{N!==null&&(w.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MaximumGenerations",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:x.current,onChange:N=>{N!==null&&(x.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SelectionRate",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{N!==null&&(P.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.CrossoverRate",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:A.current,step:.01,onChange:N=>{N!==null&&(A.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MutationRate",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{N!==null&&(C.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.ConvergenceThreshold",T)+" [0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:S.current,step:.001,onChange:N=>{N!==null&&(S.current=Number(N),a(!i))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SearchMethod",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:m.current,style:{width:"100%"},value:m.current,onChange:N=>{m.current=Number(N),a(!i)},children:[h.jsx(qP,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:k("optimizationMenu.GlobalSearchUniformSelection",T)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(qP,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:k("optimizationMenu.LocalSearchRandomOptimization",T)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),m.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.LocalSearchRadius",T)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{N!==null&&(v.current=Number(N),a(!i))}})})]})]})})},{Option:aV}=Ko,XAo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),i=H(w4).particleSwarmOptimizationParams,[a,l]=g.useState(!1),[s,c]=g.useState(!1),[u,d]=g.useState({left:0,top:0,bottom:0,right:0}),f=g.useRef(null),p=g.useRef(Math.min(i.objectiveFunctionType,Mo.YEARLY_TOTAL_OUTPUT)),m=g.useRef(i.searchMethod),y=g.useRef(i.swarmSize),w=g.useRef(i.maximumSteps),x=g.useRef(i.vmax??.01),C=g.useRef(i.inertia??.8),P=g.useRef(i.cognitiveCoefficient??.1),A=g.useRef(i.socialCoefficient??.1),S=g.useRef(i.convergenceThreshold),v=g.useRef(i.localSearchRadius),b=g.useRef(null);g.useEffect(()=>{var N;(N=b.current)==null||N.focus()},[]);const T={lng:o},R=(N,U)=>{if(f.current){const{clientWidth:W,clientHeight:F}=window.document.documentElement,E=f.current.getBoundingClientRect();d({left:-E.left+U.x,right:W-(E.right-U.x),top:-E.top+U.y,bottom:F-((E==null?void 0:E.bottom)-U.y)})}},M=()=>{e(N=>{N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=p.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=m.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=y.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=w.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=P.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=A.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=x.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=C.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=S.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=v.current})},D=()=>{r||yn(k("message.EvolutionStarted",T)),M(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=ec.PARTICLE_SWARM_OPTIMIZATION,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Pi.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:k}=Jl();return h.jsx(h.Fragment,{children:h.jsxs(li,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>c(!0),onMouseOut:()=>c(!1),children:[k("optimizationMenu.SolarPanelTiltAngleOptimization",T)+": ",k("optimizationMenu.ParticleSwarmOptimizationSettings",T)]}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:k("word.Cancel",T)},"Cancel"),h.jsx(oo,{type:"primary",ref:b,onClick:()=>{D(),t(!1)},children:k("word.Run",T)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Vi,{disabled:!s,bounds:u,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:f,children:N})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.Objective",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,l(!a)},children:[h.jsx(aV,{value:Mo.DAILY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionDailyTotalYield",T)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(aV,{value:Mo.YEARLY_TOTAL_OUTPUT,children:k("optimizationMenu.ObjectiveFunctionYearlyTotalYield",T)},Mo.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SwarmSize",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,value:y.current,step:1,formatter:N=>Number(N).toFixed(0),onChange:N=>{y.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MaximumSteps",T)+":"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:w.current,formatter:N=>Number(N).toFixed(0),onChange:N=>{w.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.CognitiveCoefficient",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{P.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SocialCoefficient",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:A.current,step:.01,onChange:N=>{A.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.InertiaWeight",T)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{C.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.MaximumVelocity",T)+" [0.001, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:x.current,step:.001,onChange:N=>{x.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.ConvergenceThreshold",T)+" [0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:S.current,step:.001,onChange:N=>{S.current=Number(N),l(!a)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.SearchMethod",T)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:m.current,style:{width:"100%"},value:m.current,onChange:N=>{m.current=Number(N),l(!a)},children:[h.jsx(aV,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:k("optimizationMenu.GlobalSearchUniformSelection",T)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(aV,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:k("optimizationMenu.LocalSearchRandomOptimization",T)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),m.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:k("optimizationMenu.LocalSearchRadius",T)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{v.current=Number(N),l(!a)}})})]})]})})},s2=({children:t,width:e="90px"})=>h.jsx("div",{style:{width:e},children:t}),JAo=({element:t})=>{const e=Sct(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!(t!=null&&t.showLabel),onChange:e,children:B.t("labelSubMenu.KeepShowingLabel",n)})})},KAo=({element:t})=>{const{labelText:e,setLabelText:n}=bct(t),o=Tct(t,e),r=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelText",r)+":"}),value:e,onChange:i=>n(i.target.value),onPressEnter:o,onBlur:o})})},$Ao=({element:t})=>{const e=Cao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelHeight",n)+":"}),min:.2,max:100,step:1,precision:1,value:t.labelHeight??.2,onChange:o=>e(o)})})},qAo=({element:t})=>{const e=Sao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelFontSize",n)+":"}),min:10,max:100,step:1,precision:0,value:t.labelFontSize??20,onChange:o=>e(o)})})},QAo=({element:t})=>{const e=Tao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelSize",n)+":"}),min:.2,max:5,step:.1,precision:1,value:t.labelSize??.2,onChange:o=>e(o)})})},ZAo=({element:t})=>{const e=Pao(t),n=Kt();return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsx(s2,{children:B.t("labelSubMenu.LabelColor",n)+":"}),value:t.labelColor??"#ffffff",onChange:o=>e(o.target.value)})})},q5=t=>[{key:`${t.type}-show-label`,label:h.jsx(JAo,{element:t})},{key:`${t.type}-label-text`,label:h.jsx(KAo,{element:t})},{key:`${t.type}-label-height`,label:h.jsx($Ao,{element:t})},{key:`${t.type}-label-font-size`,label:h.jsx(qAo,{element:t})},{key:`${t.type}-label-size`,label:h.jsx(QAo,{element:t})},{key:`${t.type}-label-color`,label:h.jsx(ZAo,{element:t})}],e4o=[{key:"windowCount",objectType:z.Window},{key:"doorCount",objectType:z.Door},{key:"sensorCount",objectType:z.Sensor},{key:"outsideLightCount",objectType:z.Light},{key:"parabolicTroughCount",objectType:z.ParabolicTrough},{key:"parabolicDishCount",objectType:z.ParabolicDish},{key:"fresnelReflectorCount",objectType:z.FresnelReflector},{key:"heliostatCount",objectType:z.Heliostat},{key:"windTurbineCount",objectType:z.WindTurbine},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower}],SEe=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.Wall:{o=`${B.t("foundationMenu.RemoveAllUnlockedWalls",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllWallsOnFoundation",n)} (${e} ${B.t("foundationMenu.Walls",n)})`;break}case z.Window:{o=`${B.t("foundationMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllWindowsOnFoundation",n)} (${e} ${B.t("foundationMenu.Windows",n)})`;break}case z.Door:{o=`${B.t("foundationMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllDoorsOnFoundation",n)} (${e} ${B.t("foundationMenu.Doors",n)})`;break}case z.Sensor:{o=`${B.t("foundationMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllSensorsOnFoundation",n)} (${e} ${B.t("foundationMenu.Sensors",n)})`;break}case z.Light:{o=`${B.t("foundationMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllLightsOnFoundation",n)} (${e} ${B.t("foundationMenu.Lights",n)})`;break}case z.ParabolicTrough:{o=`${B.t("foundationMenu.RemoveAllUnlockedParabolicTroughs",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation",n)} (${e} ${B.t("foundationMenu.ParabolicTroughs",n)})`;break}case z.ParabolicDish:{o=`${B.t("foundationMenu.RemoveAllUnlockedParabolicDishes",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicDishesOnFoundation",n)} (${e} ${B.t("foundationMenu.ParabolicDishes",n)})`;break}case z.FresnelReflector:{o=`${B.t("foundationMenu.RemoveAllUnlockedFresnelReflectors",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation",n)} (${e} ${B.t("foundationMenu.FresnelReflectors",n)})`;break}case z.Heliostat:{o=`${B.t("foundationMenu.RemoveAllUnlockedHeliostats",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllHeliostatsOnFoundation",n)} (${e} ${B.t("foundationMenu.Heliostats",n)})`;break}case z.WindTurbine:{o=`${B.t("foundationMenu.RemoveAllUnlockedWindTurbines",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllWindTurbinesOnFoundation",n)} (${e} ${B.t("foundationMenu.WindTurbines",n)})`;break}case z.Polygon:{o=`${B.t("foundationMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllPolygonsOnFoundation",n)} (${e} ${B.t("foundationMenu.Polygons",n)})`;break}case z.Human:{o=`${B.t("foundationMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllHumansOnFoundation",n)} (${e} ${B.t("foundationMenu.Humans",n)})`;break}case z.Tree:{o=`${B.t("foundationMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllTreesOnFoundation",n)} (${e} ${B.t("foundationMenu.Trees",n)})`;break}case z.Flower:{o=`${B.t("foundationMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${B.t("foundationMenu.DoYouReallyWantToRemoveAllFlowersOnFoundation",n)} (${e} ${B.t("foundationMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},t4o=(t,e,n)=>n===z.Light?t.insideLightCount+t.outsideLightCount:t[e],n4o=t=>{const e=H.getState().set,n=new Set;H.getState().elements.forEach(a=>{!a.locked&&a.type===z.Wall&&(a.parentId===t.id||a.foundationId===t.id)&&n.add(a.id)});const o=H.getState().elements.filter(a=>n.has(a.id)||n.has(a.parentId));e(a=>{a.elements=a.elements.filter(l=>!n.has(l.id)&&!n.has(l.parentId))});const r=JSON.parse(JSON.stringify(o)),i={name:"Remove All Walls on Foundation",timestamp:Date.now(),parentId:t.id,removedElements:r,undo:()=>{e(a=>{a.elements.push(...i.removedElements),a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},redo:()=>{const a=new Set;H.getState().elements.forEach(l=>{!l.locked&&l.type===z.Wall&&l.parentId===i.parentId&&a.add(l.id)}),e(l=>{l.elements=l.elements.filter(s=>!a.has(s.id)&&!a.has(s.parentId))})}};H.getState().addUndoable(i)},o4o=(t,e,n)=>{const o=[],r={lng:H.getState().language};if(e.unlockedCount>0&&o.push({key:"lock-all-offsprings",label:h.jsx(Oze,{foundation:t,lock:!0,count:e.unlockedCount})}),e.lockedCount>0&&o.push({key:"unlock-all-offsprings",label:h.jsx(Oze,{foundation:t,lock:!1,count:e.lockedCount})}),n.wallCount>0){const{itemLabel:i,modalTitle:a}=SEe(z.Wall,n.wallCount);o.push({key:"remove-all-walls-on-foundation",label:h.jsx(Tce,{foundation:t,objectType:z.Wall,modalTitle:a,onClickOk:()=>n4o(t),children:i})})}if(n.solarPanelCount>0){const i=B.t("foundationMenu.DoYouReallyWantToRemoveAllSolarPanelsOnFoundation",r)+" ("+n.solarPanelModuleCount+" "+B.t("foundationMenu.SolarPanels",r)+", "+n.solarPanelCount+" "+B.t("foundationMenu.Racks",r)+")?";o.push({key:"remove-all-solar-panels-on-foundation",label:h.jsxs(Tce,{foundation:t,objectType:z.SolarPanel,modalTitle:i,children:[B.t("foundationMenu.RemoveAllUnlockedSolarPanels",r),"  (",n.solarPanelModuleCount," ",B.t("foundationMenu.SolarPanels",r),", ",n.solarPanelCount," ",B.t("foundationMenu.Racks",r),")"]})})}return e4o.forEach(({key:i,objectType:a})=>{const l=t4o(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=SEe(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-foundation`,label:h.jsx(Tce,{foundation:t,objectType:a,modalTitle:c,children:s})})}}),o},r4o=[{time:6,heat:20,cool:20},{time:8,heat:20,cool:20},{time:18,heat:20,cool:20},{time:23,heat:20,cool:20}],AE="HH:mm",i4o=({setDialogVisible:t})=>{const e=H(Fn),n=H(qn),o=Kt(),r=ao(z.Foundation),i=r==null?void 0:r.hvacSystem,a=g.useRef(i==null?void 0:i.id),[l,s]=g.useState((i==null?void 0:i.type)??"Simple"),[c,u]=g.useState((i==null?void 0:i.temperatureThreshold)??2),[d,f]=g.useState((i==null?void 0:i.heatingSetpoint)??(i==null?void 0:i.thermostatSetpoint)??20),[p,m]=g.useState((i==null?void 0:i.coolingSetpoint)??(i==null?void 0:i.thermostatSetpoint)??20),[y,w]=g.useState((i==null?void 0:i.thermostatSetpoints)??r4o),[x,C]=g.useState(null),P=N=>{if(!r)return!1;const U=r.hvacSystem,W=N;if(U.id!==W.id||U.temperatureThreshold!==W.temperatureThreshold||U.heatingSetpoint!==W.heatingSetpoint||U.coolingSetpoint!==W.coolingSetpoint||U.type!==W.type)return!1;if(U.thermostatSetpoints&&W.thermostatSetpoints){for(let F=0;F{H.getState().set(W=>{for(const F of W.elements)if(N.has(F.id)&&F.type===z.Foundation)if(U)F.hvacSystem=U;else{const E=N.get(F.id);E&&(F.hvacSystem={...E})}})},S=N=>{const U={...N};if(N.thermostatSetpoints){const W=[];for(const F of N.thermostatSetpoints)W.push({...F});U.thermostatSetpoints=W}return U},v=N=>{if(!r)return;const U=new Map;H.getState().set(F=>{for(const E of F.elements)(E.id===r.id||a.current&&E.type===z.Foundation&&E.hvacSystem.id===a.current)&&(U.set(E.id,S(E.hvacSystem)),E.hvacSystem=N)}),n(H.getState().applyCount+1);const W={name:"Set Building HVAC System",timestamp:Date.now(),foundationID:r.id,systemID:r.hvacSystem.id,oldValues:U,newValue:N,undo(){A(W.oldValues)},redo(){A(W.oldValues,W.newValue)}};e(W)},b=N=>{const U=Math.floor(N),W=Math.round((N-U)*60);return il(`${U}:${W}`,AE)},T=(N,U,W)=>{w(Dv(F=>{W===0?F[U].time=N:W===1?F[U].heat=N:W===2&&(F[U].cool=N)}))},R=()=>{for(let N=1;NW)return C(N),!0}return!1},M=()=>{const N={heatingSetpoint:d,coolingSetpoint:p,temperatureThreshold:c,type:l,thermostatSetpoints:y};a.current&&(N.id=a.current),!(P(N)||R())&&v(N)},D=()=>{R()||(M(),k(),n(0))},k=()=>{t(!1)};return h.jsxs(ro,{width:500,title:B.t("HVACMenu.BuildingHVACSystem",o),onApply:M,onClose:k,onClickOk:D,children:[h.jsxs(Qt,{style:{padding:"4px 0"},children:[h.jsx(Ge,{span:2,style:{display:"flex",alignItems:"center"},children:h.jsxs("b",{children:[B.t("HVACMenu.ID",o),":"]})}),h.jsx(Ge,{span:8,children:h.jsx(Vl,{defaultValue:a.current,onChange:N=>{const U=N.target.value.trim();U.length===0?a.current=void 0:a.current=U}})}),h.jsx(Ge,{span:7,style:{display:"flex",alignItems:"center",justifyContent:"right"},children:h.jsx(Jt,{title:B.t("HVACMenu.ToleranceExplanation",o),style:{paddingRight:"8px"},children:h.jsx("b",{children:B.t("HVACMenu.Tolerance",o)+":"})})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:c,min:0,max:10,onChange:N=>{N!==null&&u(Number(N))}})})]}),h.jsxs(Qt,{style:{padding:"4px 0",height:"39px"},children:[h.jsx(Ge,{span:8,style:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:h.jsxs("b",{children:[B.t("HVACMenu.ThermostatType",o),":"]})}),h.jsx(Ge,{span:16,style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},children:h.jsxs(We.Group,{defaultValue:l,onChange:N=>s(N.target.value),children:[h.jsx(We,{value:"Simple",children:B.t("HVACMenu.Simple",o)}),h.jsx(We,{style:{margin:"0 0 0 48px"},value:"Programmable",children:B.t("HVACMenu.Programmable",o)})]})})]}),h.jsx(pJ,{style:{margin:"12px 0"}}),l==="Simple"?h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{children:[h.jsx(Ge,{span:11,style:{display:"flex",alignItems:"center"},children:h.jsxs("b",{children:[B.t("HVACMenu.HeatingSetpoint",o),":"]})}),h.jsx(Ge,{span:13,children:h.jsx(mn,{addonAfter:"°C",value:d,min:0,max:30,onChange:N=>{N!==null&&f(Number(N))}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:11,style:{display:"flex",alignItems:"center"},children:h.jsxs("b",{children:[B.t("HVACMenu.CoolingSetpoint",o),":"]})}),h.jsx(Ge,{span:13,children:h.jsx(mn,{addonAfter:"°C",value:p,min:0,max:30,onChange:N=>{N!==null&&m(Number(N))}})})]})]}):h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{style:{height:"34px"},children:[h.jsx(Ge,{span:4,children:h.jsx("b",{children:B.t("HVACMenu.Period",o)})}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx("b",{children:B.t("HVACMenu.StartTime",o)})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx("b",{children:B.t("HVACMenu.HeatingSetpoint",o)})}),h.jsx(Ge,{span:7,children:h.jsx("b",{children:B.t("HVACMenu.CoolingSetpoint",o)})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Wake",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{value:b(y[0].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,0,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[0].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,0,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[0].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,0,2)}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Day",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{status:x===1?"error":void 0,value:b(y[1].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,1,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[1].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,1,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[1].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,1,2)}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Evening",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{status:x===2?"error":void 0,value:b(y[2].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,2,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[2].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,2,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[2].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,2,2)}})})]}),h.jsxs(Qt,{children:[h.jsx(Ge,{span:4,style:{paddingRight:"6px"},children:B.t("HVACMenu.Sleep",o)}),h.jsx(Ge,{span:6,style:{paddingRight:"6px"},children:h.jsx(AA,{status:x===3?"error":void 0,value:b(y[3].time),format:AE,onChange:N=>{T(N.hour()+N.minute()/60,3,0),C(null)}})}),h.jsx(Ge,{span:7,style:{paddingRight:"6px"},children:h.jsx(mn,{addonAfter:"°C",value:y[3].heat??20,min:0,max:30,onChange:N=>{N!==null&&T(N,3,1)}})}),h.jsx(Ge,{span:7,children:h.jsx(mn,{addonAfter:"°C",value:y[3].cool??20,min:0,max:30,onChange:N=>{N!==null&&T(N,3,2)}})})]})]}),h.jsx("br",{}),x!==null&&h.jsx("div",{style:{color:"red"},children:B.t("HVACMenu.TimeErrorMessage",o)})]})},a4o=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.Light||e.type===z.SolarPanel||e.type===z.SolarWaterHeater||e.type===z.ParabolicDish||e.type===z.Heliostat||e.type===z.FresnelReflector||e.type===z.ParabolicTrough||e.type===z.WindTurbine||e.type===z.BatteryStorage||e.type===z.Wall)return!0}return!1},l4o=t=>{const e=[];if(t.type!==z.Foundation)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked,i=!n.notBuilding&&ye.getBuildingCompletionStatus(n,H.getState().elements)===$c.COMPLETE,a=H.getState().countAllOffspringsByTypeAtOnce(n.id,!0),l=H.getState().countAllOffspringsByTypeAtOnce(n.id,!1);return a4o()&&e.push({key:"foundation-paste",label:h.jsx(yI,{})}),e.push({key:"foundation-copy",label:h.jsx(ad,{})}),r&&e.push({key:"foundation-cut",label:h.jsx(ld,{})}),e.push({key:"foundation-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"foundation-group-master",label:h.jsx(nit,{groupableElement:n})}),e.push({key:"building",label:h.jsx(xao,{foundation:n})}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-foundation",label:h.jsx(ln,{children:B.t("word.Elements",o)}),children:o4o(n,a,l)}),r&&((!n.textureType||n.textureType===Xi.NoTexture)&&e.push({key:"foundation-color",label:h.jsxs(Zn,{Dialog:vAo,children:[B.t("word.Color",o)," ..."]})}),e.push({key:"foundation-texture",label:h.jsxs(Zn,{Dialog:Rao,children:[B.t("word.Texture",o)," ..."]})}),e.push({key:"foundation-length",label:h.jsxs(Zn,{Dialog:bAo,children:[B.t("word.Length",o)," ..."]})}),e.push({key:"foundation-width",label:h.jsxs(Zn,{Dialog:SAo,children:[B.t("word.Width",o)," ..."]})}),e.push({key:"foundation-height",label:h.jsxs(Zn,{Dialog:TAo,children:[B.t("word.Height",o)," ..."]})}),e.push({key:"foundation-azimuth",label:h.jsxs(Zn,{Dialog:PAo,children:[B.t("word.Azimuth",o)," ..."]})}),i&&e.push({key:"ground-floor-r-value",label:h.jsxs(Zn,{Dialog:CAo,children:[B.t("foundationMenu.GroundFloorRValue",o)," ..."]})})),e.push({key:"add-polygon-on-foundation",label:h.jsx(vao,{foundation:n})}),!n.notBuilding&&a.wallCount>0&&e.push({key:"building-programmable-hvac",label:h.jsxs(Zn,{Dialog:i4o,children:[B.t("HVACMenu.BuildingHVACSystem",o)," ..."]})}),r&&(e.push({key:"select-solar-structure",label:h.jsx(ln,{children:B.t("foundationMenu.SolarStructure",o)}),children:[{key:"select-solar-structure-submenu",label:h.jsx(bao,{foundation:n}),style:{backgroundColor:"white"}}]}),n.solarStructure===Nn.FocusPipe&&e.push({key:"solar-absorber-pipe-physical-properties",label:h.jsx(ln,{children:B.t("solarAbsorberPipeMenu.AbsorberPipePhysicalProperties",o)}),children:[{key:"solar-absorber-pipe-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:RAo,children:[B.t("solarAbsorberPipeMenu.AbsorberHeight",o)," ..."]})},{key:"solar-absorber-pipe-aperture-width",label:h.jsxs(Zn,{noPadding:!0,Dialog:HAo,children:[B.t("solarAbsorberPipeMenu.AbsorberApertureWidth",o)," ..."]})},{key:"foundation-solar-receiver-pipe-pole-number",label:h.jsxs(Zn,{noPadding:!0,Dialog:MAo,children:[B.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",o)," ..."]})},{key:"solar-absorber-pipe-absorptance",label:h.jsxs(Zn,{noPadding:!0,Dialog:IAo,children:[B.t("solarAbsorberPipeMenu.AbsorberAbsorptance",o)," ..."]})},{key:"solar-absorber-optical-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:zAo,children:[B.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",o)," ..."]})},{key:"solar-absorber-thermal-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:DAo,children:[B.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Nn.FocusTower&&e.push({key:"solar-power-tower-physical-properties",label:h.jsx(ln,{children:B.t("solarPowerTowerMenu.ReceiverTowerPhysicalProperties",o)}),children:[{key:"solar-power-tower-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:EAo,children:[B.t("solarPowerTowerMenu.ReceiverTowerHeight",o)," ..."]})},{key:"solar-power-tower-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:kAo,children:[B.t("solarPowerTowerMenu.ReceiverTowerRadius",o)," ..."]})},{key:"solar-power-tower-receiver-absorptance",label:h.jsxs(Zn,{noPadding:!0,Dialog:FAo,children:[B.t("solarPowerTowerMenu.ReceiverAbsorptance",o)," ..."]})},{key:"solar-power-tower-receiver-optical-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:WAo,children:[B.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",o)," ..."]})},{key:"solar-power-tower-receiver-thermal-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:LAo,children:[B.t("solarPowerTowerMenu.ReceiverThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Nn.UpdraftTower&&e.push({key:"solar-updraft-tower-physical-properties",label:h.jsx(ln,{children:B.t("solarUpdraftTowerMenu.SolarUpdraftTowerPhysicalProperties",o)}),children:[{key:"solar-updraft-tower-chimney-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:NAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",o)," ..."]})},{key:"solar-updraft-tower-chimney-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:UAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:jAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",o)," ..."]})},{key:"solar-updraft-tower-collector-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:BAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-transmissivity",label:h.jsxs(Zn,{noPadding:!0,Dialog:YAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",o)," ..."]})},{key:"solar-updraft-tower-collector-emissivity",label:h.jsxs(Zn,{noPadding:!0,Dialog:OAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",o)," ..."]})},{key:"solar-updraft-tower-discharge-coefficient",label:h.jsxs(Zn,{noPadding:!0,Dialog:_Ao,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",o)," ..."]})},{key:"solar-updraft-tower-turbine-efficiency",label:h.jsxs(Zn,{noPadding:!0,Dialog:VAo,children:[B.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",o)," ..."]})}]})),e.push({key:"optimization",label:h.jsx(ln,{children:B.t("optimizationMenu.Optimization",o)}),children:[{key:"genetic-algorithms",label:h.jsx(ln,{noPadding:!0,children:B.t("optimizationMenu.GeneticAlgorithm",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-ga-optimizer",label:h.jsxs(Zn,{noPadding:!0,Dialog:GAo,children:[B.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]},{key:"particle-swarm-optimization",label:h.jsx(ln,{noPadding:!0,children:B.t("optimizationMenu.ParticleSwarmOptimization",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-pso-optimizer",label:h.jsxs(Zn,{noPadding:!0,Dialog:XAo,children:[B.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]}]}),r&&e.push({key:"foundation-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},s4o=xe.memo(({cuboid:t})=>{const e=Kt(),n=()=>{H.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Cuboid){const i=r,a=!i.stackable;i.stackable=a,o.actionState.cuboidStackable=a;break}})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.stackable,onChange:n,children:B.t("cuboidMenu.Stackable",e)})})}),c4o=xe.memo(({cuboid:t,selectedSideIndex:e})=>{const n=Kt(),o=H.getState().set,r=()=>{o(c=>{c.objectTypeToAdd=z.Polygon});const{pos:i}=ye.getWorldDataById(t.id);let a;switch(e){case 0:a=b1;break;case 1:a=S1;break;case 2:a=Zc;break;case 3:a=T1;break;default:a=Oo,i.z=t.lz}const l=H.getState().addElement(t,i,a),s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{H.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{o(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};H.getState().addUndoable(s),o(c=>{c.objectTypeToAdd=z.None})};return h.jsx(ln,{onClick:r,children:B.t("cuboidMenu.AddPolygon",n)})}),TEe=xe.memo(({cuboid:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=H.getState().removeAllChildElementsByType,a=()=>{const s=H.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Cuboid`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{H.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};H.getState().addUndoable(u)},l=()=>{const s=o??a;li.confirm({title:n,icon:h.jsx(_y,{}),onOk:s})};return h.jsx(ln,{noPadding:!0,onClick:l,children:r})}),u4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(MS),i=H(IS),a=H(dXe),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState((c==null?void 0:c.color)??"#808080"),[f,p]=g.useState(!1),m=Kt();g.useEffect(()=>{P()},[c,a]);const y=(R,M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.Cuboid&&N.id===M&&!N.locked){const U=N;U.faceColors||(U.faceColors=new Array(6),U.faceColors.fill(U.color??D)),U.faceColors[R]=D;break}})},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.Cuboid&&k.id===R&&!k.locked){k.color=M;const N=k;N.faceColors||(N.faceColors=new Array(6));for(let U=0;U<4;U++)N.faceColors[U]=M;break}})},x=R=>{e(M=>{for(const D of M.elements)if(D.type===z.Cuboid&&!D.locked){D.color=R;const k=D;k.faceColors||(k.faceColors=new Array(6));for(let N=0;N<4;N++)k.faceColors[N]=R}})},C=R=>{i(R.target.value),p(!f)},P=()=>{c&&(a>=0&&c.faceColors?d(c.faceColors[a]):d(c.color??"#808080"))},A=R=>{if(c){switch(r){case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.Cuboid&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)){const D=M;if(D.faceColors){for(let k=0;k<4;k++)if(R!==D.faceColors[k])return!0}else if(R!==D.color)return!0}break;case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.Cuboid&&!M.locked){const D=M;if(D.faceColors){for(let k=0;k<4;k++)if(R!==D.faceColors[k])return!0}else if(R!==D.color)return!0}break;case ie.OnlyThisObject:if(c.faceColors){for(let M=0;M<4;M++)if(R!==c.faceColors[M])return!0}else if(R!==(c==null?void 0:c.color))return!0;break;default:if(a>=0){const M=c!=null&&c.faceColors?c==null?void 0:c.faceColors[a]:c==null?void 0:c.color;if(R!==M)return!0}else if(R!==(c==null?void 0:c.color))return!0}return!1}},S=R=>{if(c&&A(R)){switch(r){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)if(k.type===z.Cuboid&&H.getState().selectedElementIdSet.has(k.id)){const N=k;if(N.faceColors)M.set(k.id,[...N.faceColors]);else{const U=N.color??"#808080";M.set(k.id,[U,U,U,U,U,U])}}const D={name:"Set Color for Selected Cuboids",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{for(const[k,N]of D.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)k.actionState.cuboidFaceColors[N]=R});break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)if(k.type===z.Cuboid){const N=k;if(N.faceColors)M.set(k.id,[...N.faceColors]);else{const U=N.color??"#808080";M.set(k.id,[U,U,U,U,U,U])}}const D={name:"Set Color for All Cuboids",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{x(D.newValue)}};o(D),x(R),s(l+1),e(k=>{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)k.actionState.cuboidFaceColors[N]=R});break}case ie.OnlyThisObject:{let M;if(c.faceColors)M=[...c.faceColors];else{const k=c.color??"#808080";M=[k,k,k,k,k,k]}const D={name:"Set Color for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(D.oldValue&&Array.isArray(D.oldValue))for(let k=0;k{w(D.changedElementId,D.newValue)}};o(D),w(c.id,R),s(l+1),e(k=>{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)k.actionState.cuboidFaceColors[N]=R});break}default:{if(a>=0){const M=c.faceColors?c.faceColors[a]:c.color,D={name:"Set Color for Selected Side of Cuboid",timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{D.changedSideIndex!==void 0&&y(D.changedSideIndex,D.changedElementId,D.oldValue)},redo:()=>{D.changedSideIndex!==void 0&&y(D.changedSideIndex,D.changedElementId,D.newValue)}};o(D),y(a,c.id,R),s(l+1),e(k=>{k.actionState.cuboidFaceColors||(k.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]),k.actionState.cuboidFaceColors[a]=R})}break}}p(!f)}},v=()=>{P(),t(!1)},b=()=>{S(u),t(!1),s(0)},T=a>=0&&(c!=null&&c.faceColors)?c.faceColors[a]:(c==null?void 0:c.color)??"#808080";return h.jsx(ro,{width:600,title:B.t("word.Color",m),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:u??T,onChangeComplete:R=>{d(R.hex),p(!f)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:C,value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("cuboidMenu.OnlyThisSide",m)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.AllSidesOfThisCuboid",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfSelectedCuboids",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfAllCuboids",m)})]})})})]})})},d4o="/aladdin/assets/building_facade_01_menu-BAm4EVGn.png",f4o="/aladdin/assets/building_facade_02_menu-BylQ9E0j.png",h4o="/aladdin/assets/building_facade_03_menu-DfU_cdlP.png",p4o="/aladdin/assets/building_facade_04_menu-Bz2bcbq0.png",g4o="/aladdin/assets/building_facade_05_menu-hF6OsAF0.png",m4o="/aladdin/assets/building_facade_06_menu-CUmtyI19.png",y4o="/aladdin/assets/building_facade_07_menu-B8_DYqYz.png",A4o="/aladdin/assets/building_facade_08_menu-CTA_rxim.png",w4o="/aladdin/assets/building_facade_09_menu-BpQDoLbY.png",x4o="/aladdin/assets/building_facade_10_menu-z_jZrQMT.png",v4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(MS),i=H(IS),a=H(dXe),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState(c&&c.textureTypes&&a>=0?c.textureTypes[a]:Do.NoTexture),f=Kt(),{Option:p}=Ko;g.useEffect(()=>{c&&d(c.textureTypes&&a>=0?c.textureTypes[a]:Do.NoTexture)},[c,a]);const m=(b,T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.Cuboid&&D.id===T&&!D.locked){const k=D;k.textureTypes||(k.textureTypes=new Array(6),k.textureTypes.fill(Do.NoTexture)),k.textureTypes[b]=R;break}})},y=(b,T)=>{e(R=>{for(const M of R.elements)if(M.type===z.Cuboid&&M.id===b&&!M.locked){const D=M;D.textureTypes||(D.textureTypes=new Array(6),D.textureTypes.fill(Do.NoTexture));for(let k=0;k<4;k++)D.textureTypes[k]=T;break}})},w=(b,T)=>{e(R=>{for(const M of R.elements)if(M.type===z.Cuboid&&!M.locked&&b.has(M.id)){const D=M;if(D.textureTypes||(D.textureTypes=new Array(6),D.textureTypes.fill(Do.NoTexture)),T!==void 0)for(let k=0;k<4;k++)D.textureTypes[k]=T;else{const k=b.get(M.id);if(k&&k.length>=4)for(let N=0;N<4;N++)D.textureTypes[N]=k[N]}}})},x=b=>{e(T=>{for(const R of T.elements)if(R.type===z.Cuboid&&!R.locked){const M=R;M.textureTypes||(M.textureTypes=new Array(6),M.textureTypes.fill(Do.NoTexture));for(let D=0;D<4;D++)M.textureTypes[D]=b}})},C=b=>{i(b.target.value)},P=b=>{if(c){switch(r){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Cuboid&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;if(R.textureTypes){for(let M=0;M<4;M++)if(b!==R.textureTypes[M])return!0}}break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.Cuboid&&!T.locked){const R=T;if(R.textureTypes){for(let M=0;M<4;M++)if(b!==R.textureTypes[M])return!0}}break;case ie.OnlyThisObject:if(c.textureTypes){for(let T=0;T<4;T++)if(b!==c.textureTypes[T])return!0}break;default:if(a>=0&&c.textureTypes&&b!==c.textureTypes[a])return!0}return!1}},A=b=>{if(c&&P(b))switch(r){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)if(M.type===z.Cuboid&&H.getState().selectedElementIdSet.has(M.id)){const D=M;T.set(M.id,D.textureTypes?[...D.textureTypes]:void 0)}const R={name:"Set Texture for Selected Cuboids",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())if(D&&Array.isArray(D))for(let k=0;k{w(R.oldValues,R.newValue)}};o(R),w(T,b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]);for(let D=0;D<4;D++)M.actionState.cuboidFaceTextures[D]=b});break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)if(M.type===z.Cuboid){const D=M;T.set(M.id,D.textureTypes?[...D.textureTypes]:void 0)}const R={name:"Set Texture for All Cuboids",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())if(D&&Array.isArray(D))for(let k=0;k{x(R.newValue)}};o(R),x(b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]);for(let D=0;D<4;D++)M.actionState.cuboidFaceTextures[D]=b});break}case ie.OnlyThisObject:{const T=c.textureTypes?[...c.textureTypes]:void 0,R={name:"Set Texture for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(R.oldValue&&Array.isArray(R.oldValue))for(let M=0;M{y(R.changedElementId,R.newValue)}};o(R),y(c.id,b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]);for(let D=0;D<4;D++)M.actionState.cuboidFaceTextures[D]=b});break}default:{if(a>=0){const T=c.textureTypes?c.textureTypes[a]:Do.NoTexture,R={name:"Set Texture for Selected Side of Cuboid",timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{R.changedSideIndex!==void 0&&m(R.changedSideIndex,R.changedElementId,R.oldValue)},redo:()=>{R.changedSideIndex!==void 0&&m(R.changedSideIndex,R.changedElementId,R.newValue)}};o(R),m(a,c.id,b),s(l+1),e(M=>{M.actionState.cuboidFaceTextures||(M.actionState.cuboidFaceTextures=[Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture,Do.NoTexture]),M.actionState.cuboidFaceTextures[a]=b})}break}}},S=()=>{c!=null&&c.textureTypes&&a>=0&&d(c.textureTypes[a]),t(!1)},v=()=>{A(u)};return h.jsx(ro,{width:600,title:B.t("word.Texture",f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(p,{value:Do.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",f)]},Do.NoTexture),h.jsxs(p,{value:Do.Facade01,children:[h.jsx("img",{alt:Do.Facade01,src:d4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture01",f)]},Do.Facade01),h.jsxs(p,{value:Do.Facade02,children:[h.jsx("img",{alt:Do.Facade02,src:f4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture02",f)]},Do.Facade02),h.jsxs(p,{value:Do.Facade03,children:[h.jsx("img",{alt:Do.Facade03,src:h4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture03",f)]},Do.Facade03),h.jsxs(p,{value:Do.Facade04,children:[h.jsx("img",{alt:Do.Facade04,src:p4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture04",f)]},Do.Facade04),h.jsxs(p,{value:Do.Facade05,children:[h.jsx("img",{alt:Do.Facade05,src:g4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture05",f)]},Do.Facade05),h.jsxs(p,{value:Do.Facade06,children:[h.jsx("img",{alt:Do.Facade06,src:m4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture06",f)]},Do.Facade06),h.jsxs(p,{value:Do.Facade07,children:[h.jsx("img",{alt:Do.Facade07,src:y4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture07",f)]},Do.Facade07),h.jsxs(p,{value:Do.Facade08,children:[h.jsx("img",{alt:Do.Facade08,src:A4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture08",f)]},Do.Facade08),h.jsxs(p,{value:Do.Facade09,children:[h.jsx("img",{alt:Do.Facade09,src:w4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture09",f)]},Do.Facade09),h.jsxs(p,{value:Do.Facade10,children:[h.jsx("img",{alt:Do.Facade10,src:x4o,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("cuboidMenu.Texture10",f)]},Do.Facade10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:C,value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("cuboidMenu.OnlyThisSide",f)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.AllSidesOfThisCuboid",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfSelectedCuboids",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllSidesOfAllCuboids",f)})]})})})]})})},b4o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(RS),r=H(fXe),i=H(Z3),a=H(M7),l=H(Q3),s=H(Fn),c=H(MS),u=H(IS),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Cuboid),[w,x]=g.useState((y==null?void 0:y.lx)??0),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=Z=>{u(Z.target.value)},U=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid&&H.getState().selectedElementIdSet.has(ne.id)){const te=ne,q=o(te.id);if(q.length>0&&!ye.doesNewSizeContainAllChildren(te,q,Z,te.ly))return!1}break}case ie.AllObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid){const te=ne,q=o(te.id);if(q.length>0&&!ye.doesNewSizeContainAllChildren(te,q,Z,te.ly))return!1}break}default:{const ne=o(y.id);if(ne.length>0)return ye.doesNewSizeContainAllChildren(y,ne,Z,y.ly);break}}return!0}},W=Z=>!U(Z),F=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&H.getState().selectedElementIdSet.has(ne.id)&&Math.abs(ne.lx-Z)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&Math.abs(ne.lx-Z)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const ne of e)if(ne.type===z.Cuboid&&ne.parentId===(y==null?void 0:y.parentId)&&!ne.locked&&Math.abs(ne.lx-Z)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((y==null?void 0:y.lx)-Z)>Ht)return!0}return!1}},E=(Z,ne)=>{if(Z==null)return null;for(const te of Z.children)if(te.name.includes(`${ne}`))return te;return null},L=(Z,ne,te)=>{var q,le;if(Z){for(const de of Z.children)if(de.name.includes(`${te.id}`)){(le=(q=jn.getState().contentRef)==null?void 0:q.current)==null||le.add(de);break}d(de=>{for(const he of de.elements)if(he.id===te.id){he.parentId=rr;const me=new _t(he.cx,he.cy).rotateAround(ui,ne.rotation[2]).add(new _t(ne.cx,ne.cy));he.cx=me.x,he.cy=me.y,he.cz=0,S.current.set(he.id,new ue(me.x,me.y,0)),P.current.set(he.id,rr);break}})}},j=Z=>{for(const ne of e)ne.type===z.Cuboid&&!ne.locked&&ne.parentId===(y==null?void 0:y.parentId)&&Y(ne,Z)},Y=(Z,ne)=>{const te=o(Z.id),q=Z.rotation[2];if(v.current.clear(),R.current.clear(),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=new _t(le.cx*Z.lx,le.cy*Z.ly).rotateAround(ui,q);v.current.set(le.id,de),A.current.set(le.id,new ue(le.cx,le.cy));break}case z.Polygon:{const de=le,he=[];for(const me of de.vertices)he.push(new _t(me.x*Z.lx,me.y*Z.ly).rotateAround(ui,q));R.current.set(le.id,he),b.current.set(le.id,de.vertices.map(me=>({...me})));break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[0],-1)||ye.isEqual(le.normal[0],1))&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz));ye.isPlantOrHuman(le)&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz))}if(i(Z.id,ne),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=v.current.get(le.id);if(de){const me=new _t(de.x,de.y).rotateAround(ui,-q).x/ne;r(le.id,me),S.current.set(le.id,new ue(me,le.cy))}break}case z.Polygon:{const de=R.current.get(le.id);if(de){const he=[];for(const me of de){const ce=me.rotateAround(ui,-q),Pe=ce.x/ne,pe=ce.y/Z.ly;he.push({x:Pe,y:pe})}a(le.id,he),T.current.set(le.id,he.map(me=>({...me})))}break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[0],-1)&&(r(le.id,-ne/2),S.current.set(le.id,new ue(-ne/2,le.cy,le.cz))),ye.isEqual(le.normal[0],1)&&(r(le.id,ne/2),S.current.set(le.id,new ue(ne/2,le.cy,le.cz))));if(ye.isPlantOrHuman(le)){if(S.current.set(le.id,new ue(le.cx,le.cy,le.cz)),C.current.set(le.id,Z.id),Math.abs(le.cz-Z.lz/2)0){const de=jn.getState().contentRef,he=E(de==null?void 0:de.current,Z.id);L(he,Z,le)}}else if(Math.abs(Math.abs(le.cx)-Z.lx/2)0?ne:-ne)/2;r(le.id,de),S.current.set(le.id,new ue(de,le.cy,le.cz))}}}},O=(Z,ne,te)=>{if(!Z||!ne)return;const q=jn.getState().contentRef,le=E(q==null?void 0:q.current,ne),de=E(ne===rr?q==null?void 0:q.current:le,te);if(de&&(q!=null&&q.current)){if(Z===rr)q.current.add(de);else{const he=E(q.current,Z);he==null||he.add(de)}Ip()}},_=(Z,ne)=>{Z&&d(te=>{for(const q of te.elements)if(q.id===ne){q.parentId=Z;break}})},G=Z=>{if(!y||!F(Z))return;const ne=n(y.id),te=ne?ne.lx:y.lx;if(D.current=void 0,M.current=W(Z),M.current)D.current=Z,x(te);else switch(c){case ie.AllSelectedObjectsOfThisType:{const q=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&H.getState().selectedElementIdSet.has(de.id)&&(q.set(de.id,de.lx),Y(de,Z));const le={name:"Set Length for Selected Cuboids",timestamp:Date.now(),oldSizes:q,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())a(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())a(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const q=new Map;for(const de of e)de.type===z.Cuboid&&de.parentId===y.parentId&&!de.locked&&(q.set(de.id,de.lx),Y(de,Z));const le={name:"Set Length for All Cuboids on Surface",timestamp:Date.now(),oldSizes:q,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())a(me,ce)},redo:()=>{var de,he;if(j(le.newSize),le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())a(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisType:{const q=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&(q.set(de.id,de.lx),Y(de,Z));const le={name:"Set Length for All Cuboids",timestamp:Date.now(),oldSizes:q,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())a(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())i(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){l(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())a(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{Y(y,Z);const q={name:"Set Cuboid Length",timestamp:Date.now(),oldSize:te,newSize:Z,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;if(i(y.id,q.oldSize),q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[he,me]of q.oldChildrenPositionsMap.entries()){l(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(ce,Pe,he),_(ce,he))}if(q.oldChildrenVerticesMap&&q.oldChildrenVerticesMap.size>0)for(const[he,me]of q.oldChildrenVerticesMap.entries())a(he,me)},redo:()=>{var le,de;if(i(y.id,q.newSize),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[he,me]of q.newChildrenPositionsMap.entries()){l(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(Pe,ce,he),_(Pe,he))}if(q.newChildrenVerticesMap&&q.newChildrenVerticesMap.size>0)for(const[he,me]of q.newChildrenVerticesMap.entries())a(he,me)}};s(q),p(f+1);break}}},Q=()=>{t(!1)},oe=()=>{Q(),m()},ee=()=>{G(w),M.current||(t(!1),p(0))},$=()=>{G(w)},ae=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",k),rejectedMessage:ae,onApply:$,onClose:Q,onClickCancel:oe,onClickOk:ee,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:w,onChange:Z=>{Z!==null&&x(Z)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 500] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:N,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",k)})]})})})]})})},S4o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(RS),r=H(Q3),i=H(hXe),a=H(H7),l=H(M7),s=H(Fn),c=H(MS),u=H(IS),d=H(pn),f=H(no),p=H(qn),m=H(Ji),y=ao(z.Cuboid),[w,x]=g.useState((y==null?void 0:y.ly)??0),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new Map),M=g.useRef(!1),D=g.useRef(),k=Kt(),N=Z=>{u(Z.target.value)},U=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid&&H.getState().selectedElementIdSet.has(ne.id)){const te=ne,q=o(te.id);if(q.length>0&&!ye.doesNewSizeContainAllChildren(te,q,te.lx,Z))return!1}break}case ie.AllObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid){const te=ne,q=o(te.id);if(q.length>0&&!ye.doesNewSizeContainAllChildren(te,q,te.lx,Z))return!1}break}default:{const ne=o(y.id);if(ne.length>0)return ye.doesNewSizeContainAllChildren(y,ne,y.lx,Z);break}}return!0}},W=Z=>!U(Z),F=Z=>{if(y){switch(c){case ie.AllSelectedObjectsOfThisType:for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&H.getState().selectedElementIdSet.has(ne.id)&&Math.abs(ne.ly-Z)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const ne of e)if(ne.type===z.Cuboid&&ne.parentId===(y==null?void 0:y.parentId)&&!ne.locked&&Math.abs(ne.ly-Z)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const ne of e)if(ne.type===z.Cuboid&&!ne.locked&&Math.abs(ne.ly-Z)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((y==null?void 0:y.ly)-Z)>Ht)return!0}return!1}},E=(Z,ne)=>{if(Z==null)return null;for(const te of Z.children)if(te.name.includes(`${ne}`))return te;return null},L=(Z,ne,te)=>{var q,le;if(Z){for(const de of Z.children)if(de.name.includes(`${te.id}`)){(le=(q=jn.getState().contentRef)==null?void 0:q.current)==null||le.add(de);break}d(de=>{for(const he of de.elements)if(he.id===te.id){he.parentId=rr;const me=new _t(he.cx,he.cy).rotateAround(ui,ne.rotation[2]).add(new _t(ne.cx,ne.cy));he.cx=me.x,he.cy=me.y,he.cz=0,S.current.set(he.id,new ue(me.x,me.y,0)),P.current.set(he.id,rr);break}})}},j=Z=>{for(const ne of e)ne.type===z.Cuboid&&!ne.locked&&ne.parentId===(y==null?void 0:y.parentId)&&Y(ne,Z)},Y=(Z,ne)=>{const te=o(Z.id),q=Z.rotation[2];if(v.current.clear(),R.current.clear(),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=new _t(le.cx*Z.lx,le.cy*Z.ly).rotateAround(ui,q);v.current.set(le.id,de),A.current.set(le.id,new ue(le.cx,le.cy));break}case z.Polygon:{const de=le,he=[];for(const me of de.vertices)he.push(new _t(me.x*Z.lx,me.y*Z.ly).rotateAround(ui,q));R.current.set(le.id,he),b.current.set(le.id,de.vertices.map(me=>({...me})));break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[1],-1)||ye.isEqual(le.normal[1],1))&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz));ye.isPlantOrHuman(le)&&A.current.set(le.id,new ue(le.cx,le.cy,le.cz))}if(a(Z.id,ne),te.length>0)for(const le of te){if(ye.isIdentical(le.normal,fs))switch(le.type){case z.Sensor:{const de=v.current.get(le.id);if(de){const me=new _t(de.x,de.y).rotateAround(ui,-q).y/ne;i(le.id,me),S.current.set(le.id,new ue(le.cx,me))}break}case z.Polygon:{const de=R.current.get(le.id);if(de){const he=[];for(const me of de){const ce=me.rotateAround(ui,-q),Pe=ce.x/Z.lx,pe=ce.y/ne;he.push({x:Pe,y:pe})}l(le.id,he),T.current.set(le.id,he.map(me=>({...me})))}break}}else le.type===z.SolarPanel&&(ye.isEqual(le.normal[1],-1)&&(i(le.id,-ne/2),S.current.set(le.id,new ue(le.cx,-ne/2,le.cz))),ye.isEqual(le.normal[1],1)&&(i(le.id,ne/2),S.current.set(le.id,new ue(le.cx,ne/2,le.cz))));if(ye.isPlantOrHuman(le)){if(S.current.set(le.id,new ue(le.cx,le.cy,le.cz)),C.current.set(le.id,Z.id),Math.abs(le.cz-Z.lz/2)0){const de=jn.getState().contentRef,he=E(de==null?void 0:de.current,Z.id);L(he,Z,le)}}else if(Math.abs(Math.abs(le.cy)-Z.ly/2)0?ne:-ne)/2;i(le.id,de),S.current.set(le.id,new ue(le.cz,de,le.cz))}}}},O=(Z,ne,te)=>{if(!Z||!ne)return;const q=jn.getState().contentRef,le=E(q==null?void 0:q.current,ne),de=E(ne===rr?q==null?void 0:q.current:le,te);if(de&&(q!=null&&q.current)){if(Z===rr)q.current.add(de);else{const he=E(q.current,Z);he==null||he.add(de)}Ip()}},_=(Z,ne)=>{Z&&d(te=>{for(const q of te.elements)if(q.id===ne){q.parentId=Z;break}})},G=Z=>{if(!y||!F(Z))return;const ne=n(y.id),te=ne?ne.ly:y.ly;if(D.current=void 0,M.current=W(Z),M.current)D.current=Z,x(te);else switch(A.current.clear(),S.current.clear(),b.current.clear(),T.current.clear(),c){case ie.AllSelectedObjectsOfThisType:{const q=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&H.getState().selectedElementIdSet.has(de.id)&&(q.set(de.id,de.ly),Y(de,Z));const le={name:"Set Width for Selected Cuboids on Surface",timestamp:Date.now(),oldSizes:q,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())l(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())l(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const q=new Map;for(const de of e)de.type===z.Cuboid&&de.parentId===y.parentId&&!de.locked&&(q.set(de.id,de.ly),Y(de,Z));const le={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:q,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())l(me,ce)},redo:()=>{var de,he;if(j(le.newSize),le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())l(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisType:{const q=new Map;for(const de of e)de.type===z.Cuboid&&!de.locked&&(q.set(de.id,de.ly),Y(de,Z));const le={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:q,newSize:Z,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,ce);if(le.oldChildrenPositionsMap&&le.oldChildrenPositionsMap.size>0)for(const[me,ce]of le.oldChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(Pe,pe,me),_(Pe,me))}if(le.oldChildrenVerticesMap&&le.oldChildrenVerticesMap.size>0)for(const[me,ce]of le.oldChildrenVerticesMap.entries())l(me,ce)},redo:()=>{var de,he;for(const[me,ce]of le.oldSizes.entries())a(me,le.newSize);if(le.newChildrenPositionsMap&&le.newChildrenPositionsMap.size>0)for(const[me,ce]of le.newChildrenPositionsMap.entries()){r(me,ce.x,ce.y,ce.z);const Pe=(de=le.oldChildrenParentIdMap)==null?void 0:de.get(me),pe=(he=le.newChildrenParentIdMap)==null?void 0:he.get(me);Pe&&pe&&Pe!==pe&&(O(pe,Pe,me),_(pe,me))}if(le.newChildrenVerticesMap&&le.newChildrenVerticesMap.size>0)for(const[me,ce]of le.newChildrenVerticesMap.entries())l(me,ce)}};s(le),p(f+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{Y(y,Z);const q={name:"Set Cuboid Width",timestamp:Date.now(),oldSize:te,newSize:Z,resizedElementId:y.id,resizedElementType:y.type,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenVerticesMap:new Map(b.current),newChildrenVerticesMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var le,de;if(a(y.id,q.oldSize),q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[he,me]of q.oldChildrenPositionsMap.entries()){r(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(ce,Pe,he),_(ce,he))}if(q.oldChildrenVerticesMap&&q.oldChildrenVerticesMap.size>0)for(const[he,me]of q.oldChildrenVerticesMap.entries())l(he,me)},redo:()=>{var le,de;if(a(y.id,q.newSize),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[he,me]of q.newChildrenPositionsMap.entries()){r(he,me.x,me.y,me.z);const ce=(le=q.oldChildrenParentIdMap)==null?void 0:le.get(he),Pe=(de=q.newChildrenParentIdMap)==null?void 0:de.get(he);ce&&Pe&&ce!==Pe&&(O(Pe,ce,he),_(Pe,he))}if(q.newChildrenVerticesMap&&q.newChildrenVerticesMap.size>0)for(const[he,me]of q.newChildrenVerticesMap.entries())l(he,me)}};s(q),p(f+1);break}}},Q=()=>{t(!1)},oe=()=>{Q(),m()},ee=()=>{G(w),M.current||(t(!1),p(0))},$=()=>{G(w)},ae=M.current?": "+B.t("message.NotApplicableToSelectedAction",k)+(D.current!==void 0?" ("+D.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Width",k),rejectedMessage:ae,onApply:$,onClose:Q,onClickCancel:oe,onClickOk:ee,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:w,onChange:Z=>{Z!==null&&x(Z)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",k),": [0.1, 500] ",B.t("word.MeterAbbreviation",k)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",k)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:N,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",k)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",k)})]})})})]})})},T4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Jn),i=H(d5e),a=H(SPt),l=H(PPt),s=H(TPt),c=H(Fn),u=H(MS),d=H(IS),f=H(Q3),p=H(no),m=H(qn),y=ao(z.Cuboid),[w,x]=g.useState((y==null?void 0:y.lz)??0),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=Kt(),b=O=>{d(O.target.value)},T=(O,_)=>{i(O,_),a(O,_/2)},R=O=>{if(!y)return;const _=o(y);if(_)for(const G of n)G.type===z.Cuboid&&!G.locked&&G.parentId===_.id&&(i(G.id,O),a(G.id,O/2))},M=O=>{if(!y)return;const _=ye.getBaseId(y.id);if(_)for(const G of n)G.type===z.Cuboid&&!G.locked&&ye.getBaseId(G.id)===_&&(i(G.id,O),a(G.id,O/2))},D=O=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const _ of n)if(_.type===z.Cuboid&&!_.locked&&H.getState().selectedElementIdSet.has(_.id)&&Math.abs(_.lz-O)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const _ of n)if(_.type===z.Cuboid&&!_.locked&&Math.abs(_.lz-O)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{const _=ye.getBaseId(y==null?void 0:y.id);if(_&&_!==rr){for(const G of n)if(G.type===z.Cuboid&&G.parentId&&G.parentId!==rr&&!G.locked){const Q=G;if(_===ye.getBaseId(Q.id)&&Math.abs(Q.lz-O)>Ht)return!0}}break}case ie.AllObjectsOfThisTypeOnSurface:{for(const _ of n)if(_.type===z.Cuboid&&_.parentId!==rr&&_.parentId===(y==null?void 0:y.parentId)&&!_.locked&&Math.abs(_.lz-O)>Ht)return!0;break}default:{if(Math.abs((y==null?void 0:y.lz)-O)>Ht)return!0;break}}return!1}},k=(O,_)=>{if(O==null)return null;for(const G of O.children)if(G.name.includes(`${_}`))return G;return null},N=(O,_,G)=>{var Q,oe;if(O){for(const $ of O.children)if($.name.includes(`${G.id}`)){(oe=(Q=jn.getState().contentRef)==null?void 0:Q.current)==null||oe.add($);break}G.parentId=rr;const ee=new _t(G.cx,G.cy).rotateAround(ui,-_.rotation[2]).add(new _t(_.cx,_.cy));G.cx=ee.x,G.cy=ee.y,G.cz=0,S.current.set(G.id,new ue(ee.x,ee.y,0)),P.current.set(G.id,rr)}},U=(O,_)=>{e(G=>{for(const Q of G.elements)if(Q.parentId===O.id)if(C.current.set(Q.id,O.id),A.current.set(Q.id,new ue(Q.cx,Q.cy,Q.cz)),ye.isPlantOrHuman(Q))if(Math.abs(Q.cz-O.lz/2)_/2){const ee=jn.getState().contentRef,$=k(ee==null?void 0:ee.current,O.id);N($,O,Q)}else Q.cz=oe,S.current.set(Q.id,new ue(Q.cx,Q.cy,oe))}else Q.type===z.SolarPanel&&ye.isEqual(Q.normal[2],1)&&(Q.cz=_/2,S.current.set(Q.id,new ue(Q.cx,Q.cy,_/2)))})},W=(O,_,G)=>{if(!O||!_)return;const Q=jn.getState().contentRef,oe=k(Q==null?void 0:Q.current,_),ee=k(_===rr?Q==null?void 0:Q.current:oe,G);if(ee&&(Q!=null&&Q.current)){if(O===rr)Q.current.add(ee);else{const $=k(Q.current,O);$==null||$.add(ee)}Ip()}},F=(O,_)=>{O&&e(G=>{for(const Q of G.elements)if(Q.id===_){Q.parentId=O;break}})},E=(O,_)=>{H.getState().set(G=>{for(const Q of G.elements)if(O.has(Q.id))if(_!==void 0)Q.lz=_,Q.cz=_/2;else{const oe=O.get(Q.id);oe!==void 0&&(Q.lz=oe,Q.cz=oe/2)}})},L=O=>{if(y&&D(O)){switch(u){case ie.AllSelectedObjectsOfThisType:{const _=new Map;for(const Q of n)Q.type===z.Cuboid&&H.getState().selectedElementIdSet.has(Q.id)&&(_.set(Q.id,Q.lz),U(Q,O));const G={name:"Set Height for Selected Cuboids",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var Q,oe;if(E(G.oldValues),G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ee,$]of G.oldChildrenPositionsMap.entries()){f(ee,$.x,$.y,$.z);const ae=(Q=G.oldChildrenParentIdMap)==null?void 0:Q.get(ee),Z=(oe=G.newChildrenParentIdMap)==null?void 0:oe.get(ee);ae&&Z&&ae!==Z&&(W(ae,Z,ee),F(ae,ee))}},redo:()=>{var oe,ee;const Q=G.newValue;if(E(G.oldValues,Q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[$,ae]of G.newChildrenPositionsMap.entries()){f($,ae.x,ae.y,ae.z);const Z=(oe=G.oldChildrenParentIdMap)==null?void 0:oe.get($),ne=(ee=G.newChildrenParentIdMap)==null?void 0:ee.get($);Z&&ne&&Z!==ne&&(W(ne,Z,$),F(ne,$))}}};c(G),E(_,O),m(p+1);break}case ie.AllObjectsOfThisType:{const _=new Map;for(const Q of n)Q.type===z.Cuboid&&(_.set(Q.id,Q.lz),U(Q,O));const G={name:"Set Height for All Cuboids",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var Q,oe;for(const[ee,$]of G.oldValues.entries())T(ee,$);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ee,$]of G.oldChildrenPositionsMap.entries()){f(ee,$.x,$.y,$.z);const ae=(Q=G.oldChildrenParentIdMap)==null?void 0:Q.get(ee),Z=(oe=G.newChildrenParentIdMap)==null?void 0:oe.get(ee);ae&&Z&&ae!==Z&&(W(ae,Z,ee),F(ae,ee))}},redo:()=>{var oe,ee;const Q=G.newValue;if(l(z.Cuboid,Q),s(z.Cuboid,Q/2),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[$,ae]of G.newChildrenPositionsMap.entries()){f($,ae.x,ae.y,ae.z);const Z=(oe=G.oldChildrenParentIdMap)==null?void 0:oe.get($),ne=(ee=G.newChildrenParentIdMap)==null?void 0:ee.get($);Z&&ne&&Z!==ne&&(W(ne,Z,$),F(ne,$))}}};c(G),l(z.Cuboid,O),s(z.Cuboid,O/2),m(p+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const _=new Map,G=ye.getBaseId(y.id);for(const oe of n)oe.type===z.Cuboid&&ye.getBaseId(oe.id)===G&&(_.set(oe.id,oe.lz),U(oe,O));const Q={name:"Set Height for All Cuboids Above Same Base",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var oe,ee;for(const[$,ae]of Q.oldValues.entries())T($,ae);if(Q.oldChildrenPositionsMap&&Q.oldChildrenPositionsMap.size>0)for(const[$,ae]of Q.oldChildrenPositionsMap.entries()){f($,ae.x,ae.y,ae.z);const Z=(oe=Q.oldChildrenParentIdMap)==null?void 0:oe.get($),ne=(ee=Q.newChildrenParentIdMap)==null?void 0:ee.get($);Z&&ne&&Z!==ne&&(W(Z,ne,$),F(Z,$))}},redo:()=>{var ee,$;const oe=Q.newValue;if(M(oe),Q.newChildrenPositionsMap&&Q.newChildrenPositionsMap.size>0)for(const[ae,Z]of Q.newChildrenPositionsMap.entries()){f(ae,Z.x,Z.y,Z.z);const ne=(ee=Q.oldChildrenParentIdMap)==null?void 0:ee.get(ae),te=($=Q.newChildrenParentIdMap)==null?void 0:$.get(ae);ne&&te&&ne!==te&&(W(te,ne,ae),F(te,ae))}}};c(Q),M(O),m(p+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const _=new Map;for(const Q of n)Q.type===z.Cuboid&&Q.parentId===y.parentId&&(_.set(Q.id,Q.lz),U(Q,O));const G={name:"Set Height for All Cuboids on Same Surface",timestamp:Date.now(),oldValues:_,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var Q,oe;for(const[ee,$]of G.oldValues.entries())T(ee,$);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ee,$]of G.oldChildrenPositionsMap.entries()){f(ee,$.x,$.y,$.z);const ae=(Q=G.oldChildrenParentIdMap)==null?void 0:Q.get(ee),Z=(oe=G.newChildrenParentIdMap)==null?void 0:oe.get(ee);ae&&Z&&ae!==Z&&(W(ae,Z,ee),F(ae,ee))}},redo:()=>{var oe,ee;const Q=G.newValue;if(R(Q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[$,ae]of G.newChildrenPositionsMap.entries()){f($,ae.x,ae.y,ae.z);const Z=(oe=G.oldChildrenParentIdMap)==null?void 0:oe.get($),ne=(ee=G.newChildrenParentIdMap)==null?void 0:ee.get($);Z&&ne&&Z!==ne&&(W(ne,Z,$),F(ne,$))}}};c(G),R(O),m(p+1);break}default:{const _=r(y.id),G=_?_.lz:y.lz;U(y,O),T(y.id,O);const Q={name:"Set Cuboid Width",timestamp:Date.now(),oldValue:G,newValue:O,oldChildrenPositionsMap:new Map(A.current),newChildrenPositionsMap:new Map(S.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),changedElementId:y.id,changedElementType:y.type,undo:()=>{var oe,ee;if(T(Q.changedElementId,Q.oldValue),Q.oldChildrenPositionsMap&&Q.oldChildrenPositionsMap.size>0)for(const[$,ae]of Q.oldChildrenPositionsMap.entries()){f($,ae.x,ae.y,ae.z);const Z=(oe=Q.oldChildrenParentIdMap)==null?void 0:oe.get($),ne=(ee=Q.newChildrenParentIdMap)==null?void 0:ee.get($);Z&&ne&&Z!==ne&&(W(Z,ne,$),F(Z,$))}},redo:()=>{var oe,ee;if(T(Q.changedElementId,Q.newValue),Q.newChildrenPositionsMap&&Q.newChildrenPositionsMap.size>0)for(const[$,ae]of Q.newChildrenPositionsMap.entries()){f($,ae.x,ae.y,ae.z);const Z=(oe=Q.oldChildrenParentIdMap)==null?void 0:oe.get($),ne=(ee=Q.newChildrenParentIdMap)==null?void 0:ee.get($);Z&&ne&&Z!==ne&&(W(ne,Z,$),F(ne,$))}}};c(Q),m(p+1);break}}e(_=>{_.actionState.cuboidHeight=O})}},j=()=>{t(!1)},Y=()=>{L(w)};return h.jsx(ro,{width:550,title:B.t("word.Height",v),onApply:Y,onClose:j,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:w,onChange:O=>{O!==null&&x(O)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",v),": [0.1, 1000] ",B.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",v)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",v)}),(y==null?void 0:y.parentId)!==rr&&h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("cuboidMenu.AllCuboidsAboveSameBase",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",v)})]})})})]})})},P4o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(mQ),r=H(Fn),i=H(MS),a=H(IS),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState(c?-c.rotation[2]:0),f=Kt(),p=A=>{a(A.target.value)},m=A=>{for(const S of e)S.type===z.Cuboid&&!S.locked&&S.parentId===(c==null?void 0:c.parentId)&&o(S.id,0,0,-A)},y=A=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Cuboid&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&Math.abs(-S.rotation[2]-A)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const S of e)if(S.type===z.Cuboid&&S.parentId===(c==null?void 0:c.parentId)&&!S.locked&&Math.abs(-S.rotation[2]-A)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const S of e)if(S.type===z.Cuboid&&!S.locked&&Math.abs(-S.rotation[2]-A)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((c?-c.rotation[2]:0)-A)>Ht)return!0}return!1},w=(A,S)=>{H.getState().set(v=>{for(const b of v.elements)if(A.has(b.id))if(S!==void 0)b.rotation[2]=S;else{const T=A.get(b.id);T!==void 0&&(b.rotation[2]=-T)}})},x=A=>{if(c&&y(A))switch(i){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Cuboid&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&S.set(b.id,-b.rotation[2]);const v={name:"Set Azimuth for Selected Cuboids",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{w(v.oldValues)},redo:()=>{w(v.oldValues,-v.newValue)}};r(v),w(S,-A),s(l+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const S=new Map;for(const b of e)b.type===z.Cuboid&&b.parentId===c.parentId&&!b.locked&&S.set(b.id,-b.rotation[2]);const v={name:"Set Azimuth for All Cuboids on Surface",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{for(const[b,T]of v.oldValues.entries())o(b,0,0,-T)},redo:()=>{m(v.newValue)}};r(v),m(A),s(l+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Cuboid&&!b.locked&&S.set(b.id,-b.rotation[2]);const v={name:"Set Azimuth for All Cuboids",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{w(v.oldValues)},redo:()=>{w(v.oldValues,-v.newValue)}};r(v),w(S,-A),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{const S=n(c.id),v=S?-S.rotation[2]:-c.rotation[2],b={name:"Set Cuboid Azimuth",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(b.changedElementId,0,0,-b.oldValue)},redo:()=>{o(b.changedElementId,0,0,-b.newValue)}};r(b),o(c.id,0,0,-A),s(l+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("word.Azimuth",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(u).toFixed(2)),formatter:A=>`${A}°`,onChange:A=>{A!==null&&d(ye.toRadians(A))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:p,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",f)})]})})})]})})},C4o=[{key:"sensorCount",objectType:z.Sensor},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower},{key:"outsideLightCount",objectType:z.Light}],R4o=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.Light:{o=`${B.t("cuboidMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllLightsOnCuboid",n)} (${e} ${B.t("cuboidMenu.Lights",n)})`;break}case z.Sensor:{o=`${B.t("cuboidMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllSensorsOnCuboid",n)} (${e} ${B.t("cuboidMenu.Sensors",n)})`;break}case z.Polygon:{o=`${B.t("cuboidMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllPolygonsOnCuboid",n)} (${e} ${B.t("cuboidMenu.Polygons",n)})`;break}case z.Human:{o=`${B.t("cuboidMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllHumansOnCuboid",n)} (${e} ${B.t("cuboidMenu.Humans",n)})`;break}case z.Tree:{o=`${B.t("cuboidMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllTreesOnCuboid",n)} (${e} ${B.t("cuboidMenu.Trees",n)})`;break}case z.Flower:{o=`${B.t("cuboidMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${B.t("cuboidMenu.DoYouReallyWantToRemoveAllFlowersOnCuboid",n)} (${e} ${B.t("cuboidMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},H4o=(t,e)=>{const n=[],o={lng:H.getState().language};if(e.solarPanelCount>0){const r=B.t("cuboidMenu.DoYouReallyWantToRemoveAllSolarPanelsOnCuboid",o)+" ("+e.solarPanelModuleCount+" "+B.t("cuboidMenu.SolarPanels",o)+", "+e.solarPanelCount+" "+B.t("cuboidMenu.Racks",o)+")?";n.push({key:"remove-all-solar-panels-on-cuboid",label:h.jsxs(TEe,{cuboid:t,objectType:z.SolarPanel,modalTitle:r,children:[B.t("cuboidMenu.RemoveAllUnlockedSolarPanels",o),"  (",e.solarPanelModuleCount," ",B.t("cuboidMenu.SolarPanels",o),",",e.solarPanelCount," ",B.t("cuboidMenu.Racks",o),")"]})})}return C4o.forEach(({key:r,objectType:i})=>{const a=e[r];if(typeof a=="number"&&a>0){const{itemLabel:l,modalTitle:s}=R4o(i,a),c=i.replaceAll(" ","");n.push({key:`remove-all-${c}s-on-cuboid`,label:h.jsx(TEe,{cuboid:t,objectType:i,modalTitle:s,children:l})})}}),n},M4o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(MS),a=H(IS),l=H(no),s=H(qn),c=ao(z.Cuboid),[u,d]=g.useState((c==null?void 0:c.transparency)??0),f=Kt(),p=(S,v)=>{e(b=>{for(const T of b.elements)if(T.type===z.Cuboid&&T.id===S&&!T.locked){T.transparency=v;break}})},m=S=>{for(const v of n)v.type===z.Cuboid&&!v.locked&&v.parentId===(c==null?void 0:c.parentId)&&p(v.id,S)},y=(S,v)=>{e(b=>{for(const T of b.elements)if(T.type===z.Cuboid&&S.has(T.id))if(v!==void 0)T.transparency=v;else{const R=S.get(T.id);R!==void 0&&(T.transparency=R)}})},w=S=>{a(S.target.value)},x=S=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Cuboid&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&Math.abs((v.transparency??0)-S)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const v of n)if(v.type===z.Cuboid&&v.parentId===(c==null?void 0:c.parentId)&&!v.locked&&Math.abs((v.transparency??0)-S)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Cuboid&&!v.locked&&Math.abs((v.transparency??0)-S)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs(((c==null?void 0:c.transparency)??0)-S)>Ht)return!0}return!1},C=S=>{if(c&&x(S))switch(i){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Cuboid&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.transparency??0);const b={name:"Set Transparency for Selected Cuboids",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{y(b.oldValues,-b.newValue)}};r(b),y(v,S),s(l+1);break}case ie.AllObjectsOfThisTypeOnSurface:{const v=new Map;for(const T of n)T.type===z.Cuboid&&T.parentId===c.parentId&&!T.locked&&v.set(T.id,T.transparency??0);const b={name:"Set Transparency for All Cuboids on Surface",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())p(T,R)},redo:()=>{m(b.newValue)}};r(b),m(S),s(l+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Cuboid&&!T.locked&&v.set(T.id,T.transparency??0);const b={name:"Set Transparency for All Cuboids",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{y(b.oldValues,-b.newValue)}};r(b),y(v,S),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:break;default:{const v=o(c.id),b=v?v.transparency:c.transparency,T={name:"Set Cuboid Transparency",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(T.changedElementId,T.oldValue)},redo:()=>{p(T.changedElementId,T.newValue)}};r(T),p(c.id,S),s(l+1);break}}},P=()=>{t(!1)},A=()=>{C(u)};return h.jsx(ro,{width:550,title:B.t("word.Transparency",f),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.1,precision:2,value:u,onChange:S=>{S!==null&&d(S)}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("cuboidMenu.AllCuboids",f)})]})})})]})})},I4o=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.SolarPanel||e.type===z.Cuboid)return!0}return!1},z4o=t=>{const e=[];if(t.type!==z.Cuboid)return{items:e};const n=t,o=H.getState().selectedSideIndex,r={lng:H.getState().language},i=H.getState().countAllOffspringsByTypeAtOnce(n.id,!1),a=!(n!=null&&n.locked),l=!n.textureTypes||o>=0&&n.textureTypes[o]===Do.NoTexture;return I4o()&&e.push({key:"cuboid-paste",label:h.jsx(yI,{})}),e.push({key:"cuboid-copy",label:h.jsx(ad,{})}),a&&e.push({key:"cuboid-cut",label:h.jsx(ld,{})}),e.push({key:"cuboid-lock",label:h.jsx(D0,{selectedElement:n})}),e.push({key:"cuboid-group-master",label:h.jsx(nit,{groupableElement:n})}),e.push({key:"cuboid-stackable",label:h.jsx(s4o,{cuboid:n})}),i.gotSome()&&e.push({key:"cuboid-clear",label:h.jsx(ln,{children:B.t("word.Clear",r)}),children:H4o(n,i)}),a&&(l&&e.push({key:"cuboid-color",label:h.jsxs(Zn,{Dialog:u4o,children:[B.t("word.Color",r)," ..."]})}),e.push({key:"cuboid-texture",label:h.jsxs(Zn,{Dialog:v4o,children:[B.t("word.Texture",r)," ..."]})}),e.push({key:"cuboid-length",label:h.jsxs(Zn,{Dialog:b4o,children:[B.t("word.Length",r)," ..."]})}),e.push({key:"cuboid-width",label:h.jsxs(Zn,{Dialog:S4o,children:[B.t("word.Width",r)," ..."]})}),e.push({key:"cuboid-height",label:h.jsxs(Zn,{Dialog:T4o,children:[B.t("word.Height",r)," ..."]})}),e.push({key:"cuboid-azimuth",label:h.jsxs(Zn,{Dialog:P4o,children:[B.t("word.Azimuth",r)," ..."]})}),e.push({key:"cuboid-transparency",label:h.jsxs(Zn,{Dialog:M4o,children:[B.t("word.Transparency",r)," ..."]})})),e.push({key:"add-polygon-on-cuboid",label:h.jsx(c4o,{cuboid:n,selectedSideIndex:o})}),a&&e.push({key:"cuboid-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)}),{items:e}},D4o=()=>{const t=H(h4),e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.groundImage=r,i.viewState.groundImageType=i.viewState.mapType})},o=r=>{const i=r.target.checked,a={name:"Show Ground Image",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};H.getState().addUndoable(a),n(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("groundMenu.ImageOnGround",e)})})},E4o=()=>{const t=H(kGe),e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.waterSurface=r})},o=r=>{const i=r.target.checked,a={name:"Water Surface",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};H.getState().addUndoable(a),n(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,update:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("groundMenu.WaterSurface",e)})})},k4o=()=>{const t=H(EGe),e=o=>{H.getState().set(r=>{r.viewState.groundColor=o})},n=o=>{const r=t,i=o.hex,a={name:"Set Ground Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{e(a.oldValue)},redo:()=>{e(a.newValue)}};H.getState().addUndoable(a),e(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(sd,{color:t,onChangeComplete:n})})},F4o=()=>{const t=H(K2e)??tQ,n=H(tu)>0,o=Kt(),r=s=>{H.getState().set(c=>{c.world.leafDayOfYear1=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 1",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};H.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"100px"},children:B.t(n?"groundMenu.LeafOutDay":"groundMenu.LeafOffDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(1-150)"});return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:1,max:150,step:1,precision:0,value:t,onChange:i})})},L4o=()=>{const t=H($2e)??nQ,n=H(tu)>0,o=Kt(),r=s=>{H.getState().set(c=>{c.world.leafDayOfYear2=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 2",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};H.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"100px"},children:B.t(n?"groundMenu.LeafOffDay":"groundMenu.LeafOutDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(215-365)"});return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:215,max:365,step:1,precision:0,value:t,onChange:i})})},PEe=({monthIndex:t})=>{const e=H(i=>i.world.monthlyIrradianceLosses?i.world.monthlyIrradianceLosses[t]:.05)??.05,n=Kt(),o=i=>{H.getState().set(a=>{a.world.monthlyIrradianceLosses||(a.world.monthlyIrradianceLosses=new Array(12).fill(.05)),a.world.monthlyIrradianceLosses[t]=i})},r=i=>{if(i===null)return;const a=e,l=i,s={name:"Set Irradiance Loss in "+abe[t],timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{o(s.oldValue)},redo:()=>{o(s.newValue)}};H.getState().addUndoable(s),o(l)};return h.jsx(mn,{addonBefore:h.jsx("span",{style:{fontFamily:"monospace"},children:B.t(`month.${abe[t]}`,n)}),style:{width:"120px",paddingRight:t%2===0?"6px":0},min:0,max:1,step:.01,precision:2,value:e,onChange:r})},W4o=()=>{const t=H(r=>r.world.ground.albedo),e=Kt(),n=r=>{H.getState().set(i=>{i.world.ground.albedo=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ground Albedo",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"60px"},children:[B.t("groundMenu.Albedo",e),":"]}),h.jsx(mn,{min:.05,max:1,step:.01,precision:2,value:t,onChange:o})]})},N4o=({itemLabel:t,modalTitle:e,objectType:n})=>{const o=H.getState().removeElementsByType,r=()=>{const a=H.getState().elements.filter(c=>!c.locked&&c.type===n);o(n);const l=JSON.parse(JSON.stringify(a)),s={name:"Remove All "+n+"s",timestamp:Date.now(),removedElements:l,undo:()=>{H.getState().set(c=>{c.elements.push(...s.removedElements)})},redo:()=>{o(n)}};H.getState().addUndoable(s),dt.getState().updateContextMenu()},i=()=>{li.confirm({title:e,onOk:r,icon:h.jsx(_y,{})})};return h.jsx(ln,{onClick:i,children:t})},CEe=({lock:t,count:e,label:n})=>{const o=H.getState().updateAllElementLocks,r=()=>{const i=new Map;for(const c of H.getState().elements)i.set(c.id,!!c.locked);const s={name:`${t?"Lock":"Unlock"} All ${t?"Unlocked":"Locked"} Elements`,timestamp:Date.now(),oldValues:i,newValue:!0,undo:()=>{for(const[c,u]of s.oldValues.entries())H.getState().updateElementLockById(c,u)},redo:()=>{o(t)}};H.getState().addUndoable(s),o(t)};return h.jsxs(ln,{update:!0,onClick:r,children:[n," (",e,")"]})},U4o=[{key:"humanCount",type:z.Human,itemLabel:"groundMenu.RemoveAllUnlockedPeople",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllPeople"},{key:"treeCount",type:z.Tree,itemLabel:"groundMenu.RemoveAllUnlockedTrees",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllTrees"},{key:"flowerCount",type:z.Flower,itemLabel:"groundMenu.RemoveAllUnlockedFlowers",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFlowers"},{key:"solarPanelCount",type:z.SolarPanel,itemLabel:"groundMenu.RemoveAllUnlockedSolarPanels",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllSolarPanels"},{key:"foundationCount",type:z.Foundation,itemLabel:"groundMenu.RemoveAllUnlockedFoundations",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFoundations"},{key:"cuboidCount",type:z.Cuboid,itemLabel:"groundMenu.RemoveAllUnlockedCuboids",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllCuboids"}],j4o=()=>{const t=H.getState().elementsToPaste;if(!t||t.length===0)return!1;const e=t[0];return e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Cuboid||e.type===z.Foundation},B4o=()=>Bs.slice().reduce((t,e,n,o)=>(t&&n%2!==0&&t.push({key:`${o[n-1]}-${o[n]}`,label:h.jsxs(ln,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(PEe,{monthIndex:n-1}),h.jsx(PEe,{monthIndex:n})]})}),t),[]),Y4o=()=>{const t={lng:H.getState().language},e=H.getState().countAllElementsByType(!0),n=[];return j4o()&&n.push({key:"ground-paste",label:h.jsx(yI,{})}),U4o.forEach(({key:o,type:r,itemLabel:i,modalTitle:a})=>{const l=e[o];typeof l=="number"&&l>0&&n.push({key:`ground-remove-all-${r}s`,label:h.jsx(N4o,{objectType:r,itemLabel:`${B.t(i,t)} (${l})`,modalTitle:`${B.t(a,t)} (${l})?`})})}),e.unlockedCount>0&&n.push({key:"lock-all-elements",label:h.jsx(CEe,{lock:!0,count:e.unlockedCount,label:B.t("groundMenu.LockAllUnlockedElements",t)})}),e.lockedCount>0&&H.getState().elements.length>0&&n.push({key:"unlock-all-elements",label:h.jsx(CEe,{lock:!1,count:e.lockedCount,label:B.t("groundMenu.UnlockAllLockedElements",t)})}),n.push({key:"image-on-ground",label:h.jsx(D4o,{})}),n.push({key:"water-surface",label:h.jsx(E4o,{})}),H.getState().viewState.waterSurface||n.push({key:"ground-color-submenu",label:h.jsx(ln,{children:B.t("word.Color",t)}),children:[{key:"ground-color-picker",label:h.jsx(k4o,{}),style:{backgroundColor:"white"}}]}),n.push({key:"vegetation-submenu",label:h.jsx(ln,{children:B.t("groundMenu.Vegetation",t)}),children:[{key:"leaf-out-day",label:h.jsx(F4o,{})},{key:"leaf-shed-day",label:h.jsx(L4o,{})}]}),n.push({key:"monthly-irradiance-loss-submenu",label:h.jsx(ln,{children:B.t("groundMenu.MonthlyIrradianceLoss",t)}),children:B4o()}),n.push({key:"ground-albedo",label:h.jsx(W4o,{})}),{items:n}};var But={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t}}},fk;typeof self>"u"&&typeof process<"u"&&process.hrtime?fk=function(){var t=process.hrtime();return t[0]*1e3+t[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?fk=self.performance.now.bind(self.performance):Date.now!==void 0?fk=Date.now:fk=function(){return new Date().getTime()};var EC=fk,O4o=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(n){return e._tweens[n]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},t.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},t.prototype.update=function(e,n){e===void 0&&(e=EC()),n===void 0&&(n=!1);var o=Object.keys(this._tweens);if(o.length===0)return!1;for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?i(t[n],t[n-1],n-o):i(t[r],t[r+1>n?n:r+1],o-r)},Utils:{Linear:function(t,e,n){return(e-t)*n+t}}},Out=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),_ut=new O4o,_4o=function(){function t(e,n){n===void 0&&(n=_ut),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=But.Linear.None,this._interpolationFunction=Yut.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Out.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(e,n){return this._valuesEnd=Object.create(e),n!==void 0&&(this._duration=n),this},t.prototype.duration=function(e){return this._duration=e,this},t.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?EC()+parseFloat(e):e:EC(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(e,n,o,r){for(var i in o){var a=e[i],l=Array.isArray(a),s=l?"array":typeof a,c=!l&&Array.isArray(o[i]);if(!(s==="undefined"||s==="function")){if(c){var u=o[i];if(u.length===0)continue;u=u.map(this._handleRelativeValue.bind(this,a)),o[i]=[a].concat(u)}if((s==="object"||l)&&a&&!c){n[i]=l?[]:{};for(var d in a)n[i][d]=a[d];r[i]=l?[]:{},this._setupProperties(a,n[i],o[i],r[i])}else typeof n[i]>"u"&&(n[i]=a),l||(n[i]*=1),c?r[i]=o[i].slice().reverse():r[i]=n[i]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(e){return e===void 0&&(e=EC()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},t.prototype.resume=function(e){return e===void 0&&(e=EC()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},t.prototype.stopChainedTweens=function(){for(var e=0,n=this._chainedTweens.length;ei)return!1;n&&this.start(e)}if(this._goToEnd=!1,e1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var l=0,s=this._chainedTweens.length;l{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&(l.type===z.Human||l.type===z.Tree||l.type===z.Flower)){const s=l;s.flip=i;break}})},o=r=>{const i=r.target.checked,a={name:`Flip ${t.type}`,timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.flip,onChange:o,children:B.t("peopleMenu.Flip",e)})})}),G4o=xe.memo(({human:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Human&&l.id===r){l.observer=i;break}})},o=r=>{const i=r.target.checked,a={name:"Set Observer",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.observer,onChange:o,children:B.t("peopleMenu.Observer",e)})})}),X4o=xe.memo(({human:t})=>{const e=Kt(),[n,o]=g.useState(!1),r=g.useRef(0),i=g.useRef(-1),a=g.useRef(!0),l=g.useRef(!1);g.useEffect(()=>{if(l.current){if(a.current)return r.current=requestAnimationFrame(c),u(),()=>{cancelAnimationFrame(r.current)};a.current=!0}},[n]);const s=(f,p,m)=>{const y=jn.getState().orbitControlsRef;y!=null&&y.current&&(y.current.object.position.set(f,p,m),y.current.update(),H.getState().set(w=>{const x=w.viewState;x.cameraPosition=[f,p,m]}))},c=()=>{requestAnimationFrame(c);const f=Date.now();f-i.current>100&&(V4o(),i.current=f)},u=()=>{if(!t)return;let f=t.cx,p=t.cy,m=t.cz+t.lz;const y=H.getState().getParent(t);if(y){const C=ye.absoluteHumanOrTreeCoordinates(f,p,m,y);f=C.x,p=C.y,m=C.z}const w=H.getState().cameraDirection.clone().normalize().multiplyScalar(.5);f+=w.x,p+=w.y;const x=[...H.getState().viewState.cameraPosition];new _4o(x).to([f,p,m],1e3).easing(But.Quadratic.In).onUpdate(C=>{s(C[0],C[1],C[2])}).onComplete(()=>{H.getState().selectNone()}).start()},d=()=>{o(!n),l.current=!0};return h.jsx(ln,{onClick:d,children:B.t("peopleMenu.ViewFromThisPerson",e)})}),J4o=xe.memo(({tree:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Tree&&l.id===r){l.showModel=i;break}})},o=r=>{const i={name:"Show Tree Model",timestamp:Date.now(),checked:r,selectedElementId:t.id,selectedElementType:z.Tree,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};H.getState().addUndoable(i),n(t.id,r)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:(t==null?void 0:t.showModel)&&(t==null?void 0:t.type)===z.Tree,onChange:r=>o(r.target.checked),children:B.t("treeMenu.ShowModel",e)})})}),K4o=xe.memo(({tree:t})=>{const e=H.getState().updateElementLxById,n=Kt(),o=t.lx??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Spread",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),e(t.id,i),H.getState().set(l=>{l.actionState.treeSpread=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"100px"},children:[B.t("treeMenu.Spread",n)+" ("+B.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(mn,{style:{width:"160px"},min:1,max:50,step:1,precision:1,value:o,onChange:r})]})}),$4o=xe.memo(({tree:t})=>{const e=H.getState().updateElementLzById,n=Kt(),o=t.lz??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Height",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),e(t.id,i),H.getState().set(l=>{l.actionState.treeHeight=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"100px"},children:[B.t("word.Height",n)+" ("+B.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(mn,{style:{width:"160px"},min:1,max:30,step:1,precision:1,value:o,onChange:r})]})}),{Option:tl}=Ko,q4o=xe.memo(({human:t})=>{const e=H(pn),n=H(Fn),[o,r]=g.useState(!1),i=Kt(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Human&&u.id===l){const d=u;d.name=s,d.lx=hh.fetchWidth(s),d.lz=hh.fetchHeight(s);break}})};return h.jsxs(Ko,{style:{width:"140px"},value:(t==null?void 0:t.name)??Vt.Jack,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change People",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.humanName=l}),r(!o)}}},children:[h.jsxs(tl,{value:Vt.Jack,children:[h.jsx("img",{alt:Vt.Jack,src:DVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jack",i)]},Vt.Jack),h.jsxs(tl,{value:Vt.Jacob,children:[h.jsx("img",{alt:Vt.Jacob,src:EVe,height:20,style:{paddingRight:"16px"}})," ",B.t("people.Jacob",i)]},Vt.Jacob),h.jsxs(tl,{value:Vt.Jacqueline,children:[h.jsx("img",{alt:Vt.Jacqueline,src:kVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jacqueline",i)]},Vt.Jacqueline),h.jsxs(tl,{value:Vt.Jaah,children:[h.jsx("img",{alt:Vt.Jaah,src:zVe,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jaah",i)]},Vt.Jaah),h.jsxs(tl,{value:Vt.Jade,children:[h.jsx("img",{alt:Vt.Jade,src:FVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jade",i)]},Vt.Jade),h.jsxs(tl,{value:Vt.Jamelia,children:[h.jsx("img",{alt:Vt.Jamelia,src:LVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jamelia",i)]},Vt.Jamelia),h.jsxs(tl,{value:Vt.James,children:[h.jsx("img",{alt:Vt.James,src:WVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.James",i)]},Vt.James),h.jsxs(tl,{value:Vt.Jane,children:[h.jsx("img",{alt:Vt.Jane,src:NVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jane",i)]},Vt.Jane),h.jsxs(tl,{value:Vt.Jaya,children:[h.jsx("img",{alt:Vt.Jaya,src:UVe,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jaya",i)]},Vt.Jaya),h.jsxs(tl,{value:Vt.Jaye,children:[h.jsx("img",{alt:Vt.Jaye,src:jVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jaye",i)]},Vt.Jaye),h.jsxs(tl,{value:Vt.Jeanette,children:[h.jsx("img",{alt:Vt.Jeanette,src:BVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jeanette",i)]},Vt.Jeanette),h.jsxs(tl,{value:Vt.Jedi,children:[h.jsx("img",{alt:Vt.Jedi,src:YVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jedi",i)]},Vt.Jedi),h.jsxs(tl,{value:Vt.Jeff,children:[h.jsx("img",{alt:Vt.Jeff,src:OVe,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jeff",i)]},Vt.Jeff),h.jsxs(tl,{value:Vt.Jena,children:[h.jsx("img",{alt:Vt.Jena,src:_Ve,height:20,style:{paddingRight:"19px"}})," ",B.t("people.Jena",i)]},Vt.Jena),h.jsxs(tl,{value:Vt.Jennifer,children:[h.jsx("img",{alt:Vt.Jennifer,src:VVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jennifer",i)]},Vt.Jennifer),h.jsxs(tl,{value:Vt.Jess,children:[h.jsx("img",{alt:Vt.Jess,src:GVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jess",i)]},Vt.Jess),h.jsxs(tl,{value:Vt.Jett,children:[h.jsx("img",{alt:Vt.Jett,src:XVe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Jett",i)]},Vt.Jett),h.jsxs(tl,{value:Vt.Jill,children:[h.jsx("img",{alt:Vt.Jill,src:JVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jill",i)]},Vt.Jill),h.jsxs(tl,{value:Vt.Jiya,children:[h.jsx("img",{alt:Vt.Jiya,src:KVe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jiya",i)]},Vt.Jiya),h.jsxs(tl,{value:Vt.Joan,children:[h.jsx("img",{alt:Vt.Joan,src:$Ve,height:20,style:{paddingRight:"8px"}})," ",B.t("people.Joan",i)]},Vt.Joan),h.jsxs(tl,{value:Vt.Jocelyn,children:[h.jsx("img",{alt:Vt.Jocelyn,src:qVe,height:20,style:{paddingRight:"23px"}})," ",B.t("people.Jocelyn",i)]},Vt.Jocelyn),h.jsxs(tl,{value:Vt.Joel,children:[h.jsx("img",{alt:Vt.Joel,src:QVe,height:20,style:{paddingRight:"7px"}})," ",B.t("people.Joel",i)]},Vt.Joel),h.jsxs(tl,{value:Vt.Joey,children:[h.jsx("img",{alt:Vt.Joey,src:ZVe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Joey",i)]},Vt.Joey),h.jsxs(tl,{value:Vt.John,children:[h.jsx("img",{alt:Vt.John,src:eGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.John",i)]},Vt.John),h.jsxs(tl,{value:Vt.Jonathon,children:[h.jsx("img",{alt:Vt.Jonathon,src:tGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Jonathon",i)]},Vt.Jonathon),h.jsxs(tl,{value:Vt.Jose,children:[h.jsx("img",{alt:Vt.Jose,src:nGe,height:20,style:{paddingRight:"5px"}})," ",B.t("people.Jose",i)]},Vt.Jose),h.jsxs(tl,{value:Vt.Joseph,children:[h.jsx("img",{alt:Vt.Joseph,src:oGe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Joseph",i)]},Vt.Joseph),h.jsxs(tl,{value:Vt.Joshua,children:[h.jsx("img",{alt:Vt.Joshua,src:rGe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Joshua",i)]},Vt.Joshua),h.jsxs(tl,{value:Vt.Judd,children:[h.jsx("img",{alt:Vt.Judd,src:iGe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Judd",i)]},Vt.Judd),h.jsxs(tl,{value:Vt.Judy,children:[h.jsx("img",{alt:Vt.Judy,src:aGe,height:20,style:{paddingRight:"21px"}})," ",B.t("people.Judy",i)]},Vt.Judy),h.jsxs(tl,{value:Vt.Julia,children:[h.jsx("img",{alt:Vt.Julia,src:lGe,height:20,style:{paddingRight:"22px"}})," ",B.t("people.Julia",i)]},Vt.Julia),h.jsxs(tl,{value:Vt.Julio,children:[h.jsx("img",{alt:Vt.Julio,src:sGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Julio",i)]},Vt.Julio),h.jsxs(tl,{value:Vt.Jumapili,children:[h.jsx("img",{alt:Vt.Jumapili,src:cGe,height:20,style:{paddingRight:"16px"}})," ",B.t("people.Jumapili",i)]},Vt.Jumapili),h.jsxs(tl,{value:Vt.June,children:[h.jsx("img",{alt:Vt.June,src:uGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.June",i)]},Vt.June),h.jsxs(tl,{value:Vt.Juro,children:[h.jsx("img",{alt:Vt.Juro,src:dGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Juro",i)]},Vt.Juro),h.jsxs(tl,{value:Vt.Justin,children:[h.jsx("img",{alt:Vt.Justin,src:fGe,height:20,style:{paddingRight:"20px"}})," ",B.t("people.Justin",i)]},Vt.Justin)]})}),Q4o=t=>{const e=[];if(t.type!==z.Human)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=H.getState().viewState.orthographic??!1;return e.push({key:"human-copy",label:h.jsx(ad,{})}),o&&e.push({key:"human-cut",label:h.jsx(ld,{})}),e.push({key:"human-lock",label:h.jsx(D0,{selectedElement:n})}),o&&e.push({key:"human-flip",label:h.jsx(D4e,{billboardModel:n})}),i||e.push({key:"human-move-view",label:h.jsx(X4o,{human:n})}),o&&(e.push({key:"human-obserber",label:h.jsx(G4o,{human:n})}),e.push({key:"human-selection",label:h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"120px"},children:[B.t("peopleMenu.ChangePerson",r),": "]}),h.jsx(q4o,{human:n})]})})),{items:e}},{Option:af}=Ko,Z4o=xe.memo(({flower:t})=>{const e=H(pn),n=H(Fn),[o,r]=g.useState(!1),i=Kt(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Flower&&u.id===l){const d=u;d.name=s,d.lx=i3.fetchSpread(s),d.lz=i3.fetchHeight(s);break}})};return h.jsxs(Ko,{style:{width:"200px"},value:(t==null?void 0:t.name)??uo.WhiteFlower,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Flower",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.flowerType=l}),r(!o)}}},children:[h.jsxs(af,{value:uo.WhiteFlower,children:[h.jsx("img",{alt:uo.WhiteFlower,src:bGe,height:20,style:{paddingRight:"17px"}})," ",B.t("flower.WhiteFlower",i)]},uo.WhiteFlower),h.jsxs(af,{value:uo.YellowFlower,children:[h.jsx("img",{alt:uo.YellowFlower,src:SGe,height:20,style:{paddingRight:"16px"}})," ",B.t("flower.YellowFlower",i)]},uo.YellowFlower),h.jsxs(af,{value:uo.Hibiscus,children:[h.jsx("img",{alt:uo.Hibiscus,src:pGe,height:20,style:{paddingRight:"19px"}})," ",B.t("flower.Hibiscus",i)]},uo.Hibiscus),h.jsxs(af,{value:uo.Hydrangea,children:[h.jsx("img",{alt:uo.Hydrangea,src:gGe,height:20,style:{paddingRight:"18px"}})," ",B.t("flower.Hydrangea",i)]},uo.Hydrangea),h.jsxs(af,{value:uo.Spirea,children:[h.jsx("img",{alt:uo.Spirea,src:wGe,height:20,style:{paddingRight:"18px"}})," ",B.t("flower.Spirea",i)]},uo.Spirea),h.jsxs(af,{value:uo.Hosta,children:[h.jsx("img",{alt:uo.Hosta,src:mGe,height:20,style:{paddingRight:"18px"}})," ",B.t("flower.Hosta",i)]},uo.Hosta),h.jsxs(af,{value:uo.Peony,children:[h.jsx("img",{alt:uo.Peony,src:yGe,height:20,style:{paddingRight:"17px"}})," ",B.t("flower.Peony",i)]},uo.Peony),h.jsxs(af,{value:uo.Boxwood,children:[h.jsx("img",{alt:uo.Boxwood,src:jde,height:20,style:{paddingRight:"23px"}})," ",B.t("flower.Boxwood",i)]},uo.Boxwood),h.jsxs(af,{value:uo.TallBush,children:[h.jsx("img",{alt:uo.TallBush,src:Vde,height:20,style:{paddingRight:"32px"}})," ",B.t("flower.TallBush",i)]},uo.TallBush),h.jsxs(af,{value:uo.CactusCombo1,children:[h.jsx("img",{alt:uo.CactusCombo1,src:Bde,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo1",i)]},uo.CactusCombo1),h.jsxs(af,{value:uo.CactusCombo2,children:[h.jsx("img",{alt:uo.CactusCombo2,src:Yde,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo2",i)]},uo.CactusCombo2),h.jsxs(af,{value:uo.CactusCombo3,children:[h.jsx("img",{alt:uo.CactusCombo3,src:Ode,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo3",i)]},uo.CactusCombo3),h.jsxs(af,{value:uo.CactusCombo4,children:[h.jsx("img",{alt:uo.CactusCombo4,src:_de,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.CactusCombo4",i)]},uo.CactusCombo4),h.jsxs(af,{value:uo.RedRose,children:[h.jsx("img",{alt:uo.RedRose,src:AGe,height:20,style:{paddingRight:"26px"}})," ",B.t("flower.RedRose",i)]},uo.RedRose),h.jsxs(af,{value:uo.Bellflower,children:[h.jsx("img",{alt:uo.Bellflower,src:hGe,height:20,style:{paddingRight:"20px"}})," ",B.t("flower.Bellflower",i)]},uo.Bellflower),h.jsxs(af,{value:uo.Sunflower,children:[h.jsx("img",{alt:uo.Sunflower,src:xGe,height:20,style:{paddingRight:"32px"}})," ",B.t("flower.Sunflower",i)]},uo.Sunflower),h.jsxs(af,{value:uo.Tulip,children:[h.jsx("img",{alt:uo.Tulip,src:vGe,height:20,style:{paddingRight:"24px"}})," ",B.t("flower.Tulip",i)]},uo.Tulip)]})}),ewo=t=>{const e=[];if(t.type!==z.Flower)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"flower-copy",label:h.jsx(ad,{})}),o&&e.push({key:"flower-cut",label:h.jsx(ld,{})}),e.push({key:"flower-lock",label:h.jsx(D0,{selectedElement:n})}),o&&e.push({key:"flower-flip",label:h.jsx(D4e,{billboardModel:n})}),o&&e.push({key:"flower-change-type",label:h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"60px"},children:[B.t("flowerMenu.Type",r),": "]}),h.jsx(Z4o,{flower:n})]})}),{items:e}},two=({polygon:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.filled=i;break}})},o=r=>{const i={name:"Fill Polygon",timestamp:Date.now(),checked:!t.filled,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};H.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:B.t("polygonMenu.Filled",e)})})},nwo=({polygon:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.shininess=i;break}})},o=r=>{const a={name:"Shiny Polygon",timestamp:Date.now(),checked:((t==null?void 0:t.shininess)??0)>0,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,a.checked?0:100)},redo:()=>{n(t.id,a.checked?100:0)}};H.getState().addUndoable(a),n(t.id,r.target.checked?100:0)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.shininess,onChange:o,children:B.t("polygonMenu.Shiny",e)})})},owo=({polygon:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.noOutline=i;break}})},o=r=>{const i={name:"No Outline for Polygon",timestamp:Date.now(),checked:!t.noOutline,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};H.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.noOutline,onChange:o,children:B.t("polygonMenu.NoOutline",e)})})},rwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.text)??""),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.text=l);break}})},i=()=>{const a={name:"Set Text for Polygon",timestamp:Date.now(),oldValue:t.text??"",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("word.Text",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},iwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontSize)??1),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontSize=l);break}})},i=()=>{const a={name:"Set Font Size for Polygon",timestamp:Date.now(),oldValue:t.fontSize??1,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("word.FontSize",e),":"]}),min:.1,max:5,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},awo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontColor)??"black"),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontColor=l);break}})},i=()=>{const a={name:"Set Font Color for Polygon",timestamp:Date.now(),oldValue:t.fontColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("word.FontColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},lwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontOutlineColor)??"white"),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineColor=l);break}})},i=()=>{const a={name:"Set Font Outline Color for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineColor??"white",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontOutlineColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},swo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontOutlineWidth)??0),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineWidth=l);break}})},i=()=>{const a={name:"Set Font Outline Width for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontOutlineWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},cwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontStrokeColor)??"black"),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeColor=l);break}})},i=()=>{const a={name:"Set Font Stroke Color for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Vl,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontStrokeColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},uwo=({polygon:t})=>{const e=Kt(),[n,o]=g.useState((t==null?void 0:t.fontStrokeWidth)??0),r=(a,l)=>{H.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeWidth=l);break}})},i=()=>{const a={name:"Set Font Stroke Width for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};H.getState().addUndoable(a),r(t.id,n)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(mn,{addonBefore:h.jsxs(s2,{width:"120px",children:[B.t("polygonMenu.FontStrokeWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},dwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H($r),r=H(HPt),i=H(MPt),a=H(IPt),l=H(zPt),s=H(Fn),c=H(VM),u=H(GM),d=H(no),f=H(qn),p=ao(z.Polygon),[m,y]=g.useState((p==null?void 0:p.lineColor)??"black"),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&b!==T.lineColor)return!0;break;case ie.AllObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&b!==T.lineColor)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Polygon&&T.parentId===p.parentId&&ye.isIdentical(T.normal,p.normal)&&!T.locked&&T.lineColor!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Polygon&&T.foundationId===(p==null?void 0:p.foundationId)&&!T.locked&&T.lineColor!==b)return!0;break;default:if(b!==(p==null?void 0:p.lineColor))return!0}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Polygon&&!M.locked&&b.has(M.id)&&(M.lineColor=T)})},A=b=>{if(p&&C(b))switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.lineColor??"black");const R={name:"Set Line Color for Selected Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&T.set(M.id,M.lineColor??"black");const R={name:"Set Line Color for All Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,b),f(d+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const D of e)D.type===z.Polygon&&D.parentId===p.parentId&&ye.isIdentical(D.normal,p.normal)&&R.set(D.id,D.lineColor??"gray");const M={name:"Set Line Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:b,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{M.groupId&&i(z.Polygon,M.groupId,M.normal,M.newValue)}};s(M),i(z.Polygon,p.parentId,p.normal,b),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of e)M.type===z.Polygon&&M.foundationId===p.foundationId&&T.set(M.id,M.lineColor??"black");const R={name:"Set Line Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,b),f(d+1)}break}default:{const T=n(p.id),R=T?T.lineColor:p.lineColor,M={name:"Set Line Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}},S=()=>{t(!1)},v=()=>{A(m)};return h.jsx(ro,{width:600,title:B.t("polygonMenu.LineColor",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:m??(p==null?void 0:p.lineColor)??"black",onChangeComplete:b=>{y(b.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",w)})]})})})]})})},fwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(VM),l=H(GM),s=H(no),c=H(qn),u=ao(z.Polygon),[d,f]=g.useState((u==null?void 0:u.lineStyle)??Ap.Solid),p=Kt(),{Option:m}=Ko,y=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.Polygon&&k.id===R){k.lineStyle=M;break}})},w=(R,M,D)=>{e(k=>{for(const N of k.elements)N.type===z.Polygon&&N.parentId===R&&ye.isIdentical(N.normal,M)&&!N.locked&&(N.lineStyle=D)})},x=(R,M)=>{e(D=>{for(const k of D.elements)k.type===z.Polygon&&k.foundationId===R&&!k.locked&&(k.lineStyle=M)})},C=R=>{e(M=>{for(const D of M.elements)D.type===z.Polygon&&!D.locked&&(D.lineStyle=R)})},P=R=>{l(R.target.value)},A=R=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&R!==M.lineStyle)return!0;break;case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&R!==M.lineStyle)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const M of n)if(M.type===z.Polygon&&M.parentId===u.parentId&&ye.isIdentical(M.normal,u.normal)&&!M.locked&&R!==M.lineStyle)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.Polygon&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&R!==M.lineStyle)return!0;break;default:if(R!==(u==null?void 0:u.lineStyle))return!0}return!1}},S=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)k.type===z.Polygon&&!k.locked&&R.has(k.id)&&(k.lineStyle=M)})},v=R=>{if(u&&A(R))switch(a){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.lineStyle??Ap.Solid);const D={name:"Set Line Style for Selected Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{S(D.oldValues,D.newValue)}};i(D),S(M,R),c(s+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&M.set(k.id,k.lineStyle??Ap.Solid);const D={name:"Set Line Style for All Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{C(D.newValue)}};i(D),C(R),c(s+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(r(u)){const D=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&ye.isIdentical(N.normal,u.normal)&&D.set(N.id,N.lineStyle??Ap.Solid);const k={name:"Set Line Style for All Polygons on Same Surface",timestamp:Date.now(),oldValues:D,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of k.oldValues.entries())y(N,U)},redo:()=>{k.groupId&&w(k.groupId,k.normal,k.newValue)}};i(k),w(u.parentId,u.normal,R),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.Polygon&&k.foundationId===u.foundationId&&M.set(k.id,k.lineStyle??Ap.Solid);const D={name:"Set Line Style for All Polygons Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};i(D),x(u.foundationId,R),c(s+1)}break}default:{const M=o(u.id),D=M?M.lineStyle:u.lineStyle,k={name:"Set Line Style of Selected Polygon",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(k.changedElementId,k.oldValue)},redo:()=>{y(k.changedElementId,k.newValue)}};i(k),y(u.id,R),c(s+1);break}}},b=()=>{t(!1)},T=()=>{v(d)};return h.jsx(ro,{width:600,title:B.t("polygonMenu.LineStyle",p),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"200px"},value:d,onChange:R=>f(R),children:[h.jsxs(m,{value:Ap.Solid,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px solid dimGray"},children:" "}),B.t("polygonMenu.SolidLine",p)]},Ap.Solid),h.jsxs(m,{value:Ap.Dashed,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dashed dimGray"},children:" "}),B.t("polygonMenu.DashedLine",p)]},Ap.Dashed),h.jsxs(m,{value:Ap.Dotted,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dotted dimGray"},children:" "}),B.t("polygonMenu.DottedLine",p)]},Ap.Dotted)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",p)})]})})})]})})},hwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H($r),r=H(DPt),i=H(EPt),a=H(kPt),l=H(FPt),s=H(Fn),c=H(VM),u=H(GM),d=H(no),f=H(qn),p=ao(z.Polygon),[m,y]=g.useState((p==null?void 0:p.lineWidth)??1),w=Kt(),{Option:x}=Ko,C=T=>{u(T.target.value)},P=T=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&T!==R.lineWidth)return!0;break;case ie.AllObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&T!==R.lineWidth)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const R of e)if(R.type===z.Polygon&&R.parentId===p.parentId&&ye.isIdentical(R.normal,p.normal)&&!R.locked&&R.lineWidth!==T)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const R of e)if(R.type===z.Polygon&&R.foundationId===(p==null?void 0:p.foundationId)&&!R.locked&&R.lineWidth!==T)return!0;break;default:if(T!==(p==null?void 0:p.lineWidth))return!0}return!1}},A=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)D.type===z.Polygon&&!D.locked&&T.has(D.id)&&(D.lineWidth=R)})},S=T=>{if(p&&P(T))switch(c){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of e)D.type===z.Polygon&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.lineWidth??1);const M={name:"Set Line Width for Selected Polygons",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{A(M.oldValues,M.newValue)}};s(M),A(R,T),f(d+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of e)D.type===z.Polygon&&R.set(D.id,D.lineWidth??1);const M={name:"Set Line Width for All Polygons",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{l(z.Polygon,M.newValue)}};s(M),l(z.Polygon,T),f(d+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(o(p)){const M=new Map;for(const k of e)k.type===z.Polygon&&k.parentId===p.parentId&&ye.isIdentical(k.normal,p.normal)&&M.set(k.id,k.lineWidth??1);const D={name:"Set Line Width for All Polygons on Same Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[k,N]of D.oldValues.entries())r(k,N)},redo:()=>{D.groupId&&i(z.Polygon,D.groupId,D.normal,D.newValue)}};s(D),i(z.Polygon,p.parentId,p.normal,T),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const R=new Map;for(const D of e)D.type===z.Polygon&&D.foundationId===p.foundationId&&R.set(D.id,D.lineWidth??1);const M={name:"Set Line Width for All Polygons Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:p.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{M.groupId&&a(z.Polygon,M.groupId,M.newValue)}};s(M),a(z.Polygon,p.foundationId,T),f(d+1)}break}default:{const R=n(p.id),M=R?R.lineWidth:p.lineWidth,D={name:"Set Line Width of Selected Polygon",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(D.changedElementId,D.oldValue)},redo:()=>{r(D.changedElementId,D.newValue)}};s(D),r(p.id,T),f(d+1);break}}},v=()=>{t(!1)},b=()=>{S(m),t(!1),f(0)};return h.jsx(ro,{width:560,title:B.t("polygonMenu.LineWidth",w),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"200px"},value:m,onChange:T=>y(T),children:[h.jsx(x,{value:j2.One,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"1px solid dimGray"}})},j2.One),h.jsx(x,{value:j2.Two,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"2px solid dimGray"}})},j2.Two),h.jsx(x,{value:j2.Three,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"3px solid dimGray"}})},j2.Three),h.jsx(x,{value:j2.Four,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"4px solid dimGray"}})},j2.Four),h.jsx(x,{value:j2.Five,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"5px solid dimGray"}})},j2.Five)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:C,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",w)})]})})})]})})},pwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H($r),r=H(f5e),i=H(CPt),a=H(RPt),l=H(h5e),s=H(Fn),c=H(VM),u=H(GM),d=H(no),f=H(qn),p=ao(z.Polygon),[m,y]=g.useState((p==null?void 0:p.color)??"gray"),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&b!==T.color)return!0;break;case ie.AllObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&!T.locked&&b!==T.color)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Polygon&&T.foundationId===p.foundationId&&!T.locked&&T.color!==b)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Polygon&&T.parentId===p.parentId&&ye.isIdentical(T.normal,p.normal)&&!T.locked&&T.color!==b)return!0;break;default:if(b!==p.color)return!0}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Polygon&&!M.locked&&b.has(M.id)&&(M.color=T)})},A=b=>{if(p&&C(b))switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.color??"gray");const R={name:"Set Fill Color for Selected Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of e)M.type===z.Polygon&&T.set(M.id,M.color??"gray");const R={name:"Set Fill Color for All Polygons",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,b),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of e)M.type===z.Polygon&&M.foundationId===p.foundationId&&T.set(M.id,M.color??"gray");const R={name:"Set Fill Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,b),f(d+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const D of e)D.type===z.Polygon&&D.parentId===p.parentId&&ye.isIdentical(D.normal,p.normal)&&R.set(D.id,D.color??"gray");const M={name:"Set Fill Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:b,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[D,k]of M.oldValues.entries())r(D,k)},redo:()=>{M.groupId&&i(z.Polygon,M.groupId,M.normal,M.newValue)}};s(M),i(z.Polygon,p.parentId,p.normal,b),f(d+1)}break}default:{const T=n(p.id),R=T?T.color:p.color,M={name:"Set Fill Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}},S=()=>{t(!1)},v=()=>{A(m)};return h.jsx(ro,{width:600,title:B.t("polygonMenu.FillColor",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:m??(p==null?void 0:p.color)??"gray",onChangeComplete:b=>{y(b.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",w)})]})})})]})})},gwo="/aladdin/assets/polygon_08_menu-RpvWW3pg.png",mwo="/aladdin/assets/polygon_09_menu-CCH8lYni.png",ywo="/aladdin/assets/polygon_10_menu-BYFeRpsw.png",Awo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(VM),l=H(GM),s=H(no),c=H(qn),u=ao(z.Polygon),[d,f]=g.useState((u==null?void 0:u.textureType)??Zr.NoTexture),p=Kt(),{Option:m}=Ko,y=(R,M)=>{e(D=>{for(const k of D.elements)if(k.id===R&&k.type===z.Polygon&&!k.locked){k.textureType=M;break}})},w=(R,M,D)=>{e(k=>{for(const N of k.elements)N.type===z.Polygon&&N.parentId===R&&ye.isIdentical(N.normal,M)&&!N.locked&&(N.textureType=D)})},x=(R,M)=>{e(D=>{for(const k of D.elements)k.type===z.Polygon&&k.foundationId===R&&!k.locked&&(k.textureType=M)})},C=R=>{e(M=>{for(const D of M.elements)D.type===z.Polygon&&!D.locked&&(D.textureType=R)})},P=R=>{l(R.target.value)},A=R=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&R!==M.textureType)return!0;break;case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.Polygon&&!M.locked&&R!==M.textureType)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const M of n)if(M.type===z.Polygon&&M.parentId===u.parentId&&ye.isIdentical(M.normal,u.normal)&&!M.locked&&M.textureType!==R)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.Polygon&&M.foundationId===u.foundationId&&!M.locked&&M.textureType!==R)return!0;break;default:if(R!==(u==null?void 0:u.textureType))return!0}return!1}},S=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)k.type===z.Polygon&&!k.locked&&R.has(k.id)&&(k.textureType=M)})},v=R=>{if(u&&A(R))switch(a){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.textureType??Zr.NoTexture);const D={name:"Set Texture for Selected Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{S(D.oldValues,D.newValue)}};i(D),S(M,R),c(s+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.Polygon&&M.set(k.id,k.textureType??Zr.NoTexture);const D={name:"Set Texture for All Polygons",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{C(D.newValue)}};i(D),C(R),c(s+1);break}case ie.AllObjectsOfThisTypeOnSurface:{if(r(u)){const D=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&ye.isIdentical(N.normal,u.normal)&&D.set(N.id,N.textureType??Zr.NoTexture);const k={name:"Set Texture for All Polygons on Same Surface",timestamp:Date.now(),oldValues:D,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of k.oldValues.entries())y(N,U)},redo:()=>{k.groupId&&w(k.groupId,k.normal,k.newValue)}};i(k),w(u.parentId,u.normal,R),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.Polygon&&k.foundationId===u.foundationId&&M.set(k.id,k.textureType??Zr.NoTexture);const D={name:"Set Texture for All Polygons Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};i(D),x(u.foundationId,R),c(s+1)}break}default:{const M=o(u.id),D=M?M.textureType:u.textureType,k={name:"Set Texture of Selected Polygon",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(k.changedElementId,k.oldValue)},redo:()=>{y(k.changedElementId,k.newValue)}};i(k),y(u.id,R),c(s+1);break}}},b=()=>{t(!1)},T=()=>{v(d)};return h.jsx(ro,{width:500,title:B.t("polygonMenu.FillTexture",p),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"150px"},value:d,onChange:R=>f(R),children:[h.jsxs(m,{value:Zr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",p)]},Zr.NoTexture),h.jsxs(m,{value:Zr.Texture01,children:[h.jsx("img",{alt:Zr.Texture01,src:gct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture01",p)]},Zr.Texture01),h.jsxs(m,{value:Zr.Texture02,children:[h.jsx("img",{alt:Zr.Texture02,src:mct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture02",p)]},Zr.Texture02),h.jsxs(m,{value:Zr.Texture03,children:[h.jsx("img",{alt:Zr.Texture03,src:yct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture03",p)]},Zr.Texture03),h.jsxs(m,{value:Zr.Texture04,children:[h.jsx("img",{alt:Zr.Texture04,src:Act,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture04",p)]},Zr.Texture04),h.jsxs(m,{value:Zr.Texture05,children:[h.jsx("img",{alt:Zr.Texture05,src:wct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture05",p)]},Zr.Texture05),h.jsxs(m,{value:Zr.Texture06,children:[h.jsx("img",{alt:Zr.Texture06,src:xct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture06",p)]},Zr.Texture06),h.jsxs(m,{value:Zr.Texture07,children:[h.jsx("img",{alt:Zr.Texture07,src:vct,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture07",p)]},Zr.Texture07),h.jsxs(m,{value:Zr.Texture08,children:[h.jsx("img",{alt:Zr.Texture08,src:gwo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture08",p)]},Zr.Texture08),h.jsxs(m,{value:Zr.Texture09,children:[h.jsx("img",{alt:Zr.Texture09,src:mwo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture09",p)]},Zr.Texture09),h.jsxs(m,{value:Zr.Texture10,children:[h.jsx("img",{alt:Zr.Texture10,src:ywo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("polygonMenu.Texture10",p)]},Zr.Texture10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",p)})]})})})]})})},wwo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(VM),r=H(GM),i=H(no),a=H(qn),l=H(Jn),s=H(pn),c=ao(z.Polygon),[u,d]=g.useState((c==null?void 0:c.opacity)!==void 0?c.opacity:1),f=Kt(),p=(A,S)=>{s(v=>{for(const b of v.elements)if(b.id===A){b.opacity=S;break}})},m=A=>{for(const[S,v]of A.entries())p(S,v)},y=(A,S)=>{for(const v of A.keys())p(v,S)},w=A=>{if(c){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Polygon&&A!==S.opacity&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Polygon&&A!==S.opacity&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Polygon&&S.foundationId===c.foundationId&&A!==S.opacity&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:for(const S of e)if(S.type===z.Polygon&&S.parentId===c.parentId&&ye.isIdentical(S.normal,c.normal)&&A!==S.opacity&&!S.locked)return!0;break;default:if(A!==(c==null?void 0:c.opacity))return!0;break}return!1}},x=A=>{if(c&&w(A))switch(o){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of e)if(b.type===z.Polygon&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for Selected Polygons",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of e)if(b.type===z.Polygon&&!b.locked){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for All Polygons",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const S=new Map;for(const b of e)if(b.type===z.Polygon&&b.foundationId===c.foundationId&&!b.locked){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:c.foundationId,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{if(c.parentId){const S=new Map;for(const b of e)if(b.type===z.Polygon&&b.parentId===c.parentId&&ye.isIdentical(b.normal,c.normal)&&!b.locked){const T=b;S.set(b.id,T.opacity),p(T.id,A)}const v={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:c.foundationId,undo:()=>{m(v.oldValues)},redo:()=>{y(v.oldValues,v.newValue)}};n(v),a(i+1)}break}default:if(c){const S=l(c.id),v=S.opacity!==void 0?S.opacity:c.opacity!==void 0?c.opacity:1,b={name:"Set Polygon Opacity",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};n(b),p(c.id,A),a(i+1);break}}},C=()=>{t(!1)},P=()=>{x(u)};return h.jsx(ro,{width:550,title:B.t("polygonMenu.Opacity",f),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.1,precision:1,value:u,formatter:A=>Number(A).toFixed(1),onChange:A=>d(A)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A=>r(A.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("polygonMenu.OnlyThisPolygon",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("polygonMenu.AllPolygonsOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("polygonMenu.AllPolygonsAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("polygonMenu.AllSelectedPolygons",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("polygonMenu.AllPolygons",f)})]})})})]})})};class ZH{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=ye.calculatePolygonBounds(e.vertices),m=(r===br.portrait?o.length:o.width)*a;if(s===Nl.upDown){const y=Math.floor(((p.maxX()-p.minX())*n.lx-m)/l),w=p.minX()+m/(2*n.lx)+d/n.lx,x=l/n.lx,C=.5*Math.abs(Math.cos(i))*m/n.lx,P={x:0,y:-.5},A={x:0,y:.5},S=void 0;for(let v=0;v<=y;v++){const b=w+v*x;P.x=A.x=b-C;const T=ye.polygonIntersections(P,A,e.vertices).sort((D,k)=>D.y-k.y);P.x=A.x=b+C;const R=ye.polygonIntersections(P,A,e.vertices).sort((D,k)=>D.y-k.y),M=Math.max(T.length,R.length)/2;if(M>0)for(let D=0;DD.x-k.x);P.y=A.y=b+C;const R=ye.polygonIntersections(P,A,e.vertices).sort((D,k)=>D.x-k.x),M=Math.max(T.length,R.length)/2;if(M>0)for(let D=0;D0)return Qa.makeSolarPanel(s,c,a*s.lx,(y+w)/2*s.ly,s.cz,br.portrait,d,f,u,$t,Oo,i,void 0,x*s.ly,l)}static makeLeftRightSegment(e,n,o,r,i,a,l,s,c,u,d,f,p){const m=Math.abs(e.x-n.x)0)return Qa.makeSolarPanel(s,c,(y+w)/2*s.lx,a*s.ly,s.cz,br.portrait,d,f,u,0,Oo,i,void 0,x*s.lx,l)}}class xwo{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=!ye.isZero(n.rotation[2]),m=[];for(const P of e.vertices)m.push({x:P.x*n.lx+n.cx,y:P.y*n.ly+n.cy});const y=p?ye.rotatePolygon(m,n.cx,n.cy,n.rotation[2]):m,w=ye.calculatePolygonBounds(y),x=(r===br.portrait?o.length:o.width)*a,C=.5*Math.abs(Math.cos(i))*x;if(s===Nl.eastWest){const P=w.maxY()-w.minY(),A=Math.floor((P-2*d-x)/l),S=w.minY()+x/2+d,v={x:w.minX(),y:0},b={x:w.maxX(),y:0};for(let T=0;T<=A;T++){const R=S+T*l;v.y=b.y=R-C;const M=ye.polygonIntersections(v,b,y).sort((N,U)=>N.x-U.x);v.y=b.y=R+C;const D=ye.polygonIntersections(v,b,y).sort((N,U)=>N.x-U.x),k=Math.max(M.length,D.length)/2;if(k>0)for(let N=0;N0){const oe=ye.relativeCoordinates((Y+O)/2,R,0,n),ee=Qa.makeSolarPanel(n,o,oe.x*n.lx,oe.y*n.ly,n.cz,br.portrait,c,u,i,-n.rotation[2],Oo,[0,0,0],void 0,Q,x);ee.referenceId=e.id,ye.changeOrientation(ee,o,r),f.push(ee)}}}}else if(s===Nl.northSouth){const P=w.maxX()-w.minX(),A=Math.floor((P-2*d-x)/l),S=w.minX()+x/2+d,v={x:0,y:w.minY()},b={x:0,y:w.maxY()};for(let T=0;T<=A;T++){const R=S+T*l;v.x=b.x=R-C;const M=ye.polygonIntersections(v,b,y).sort((N,U)=>N.y-U.y);v.x=b.x=R+C;const D=ye.polygonIntersections(v,b,y).sort((N,U)=>N.y-U.y),k=Math.max(M.length,D.length)/2;if(k>0)for(let N=0;N0){const oe=ye.relativeCoordinates(R,(_+G)/2,0,n),ee=Qa.makeSolarPanel(n,o,oe.x*n.lx,oe.y*n.ly,n.cz,br.portrait,c,u,i,-n.rotation[2]+$t,Oo,[0,0,0],void 0,Q,x);ee.referenceId=e.id,ye.changeOrientation(ee,o,r),f.push(ee)}}}}return f}}const{Option:Qx}=Ko,vwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H.getState().solarPanelArrayLayoutParams,r=H(HS),i=H($r),a=H(jM),l=H(BM),s=H(O5),c=H(xPt),u=H(XPt),d=H(m5e),f=H(GPt),p=H(Fn),m=H(no),y=H(qn),w=H(Ji),[x,C]=g.useState(!1),[P,A]=g.useState(!1),[S,v]=g.useState(!1),[b,T]=g.useState({left:0,top:0,bottom:0,right:0}),R=g.useRef(null),M=g.useRef(!0),D=g.useRef(null),k=g.useRef(null),N=g.useRef(!1),U=g.useRef(H(qbt)),W=g.useRef(H(Qbt)),F=g.useRef(H(iSt)),E=g.useRef(H(rSt)),L=g.useRef(H(Zbt)),j=g.useRef(H(eSt)),Y=g.useRef(H(tSt)??0),O=g.useRef(H(nSt)),_=g.useRef(H(oSt)),G=Kt(),Q=s(U.current),oe=r(),ee=g.useMemo(()=>({...l,...a}),[a,l]);g.useEffect(()=>{var pe;(pe=D.current)==null||pe.focus()},[]),g.useEffect(()=>{var pe;P&&((pe=k.current)==null||pe.focus())},[P]);const $=(pe,Ie)=>{if(R.current){const{clientWidth:ve,clientHeight:ze}=window.document.documentElement,Ae=R.current.getBoundingClientRect();T({left:-Ae.left+Ie.x,right:ve-(Ae.right-Ie.x),top:-Ae.top+Ie.y,bottom:ze-((Ae==null?void 0:Ae.bottom)-Ie.y)})}},ae=()=>{const pe=(F.current===br.portrait?Q.length:Q.width)*L.current;return .5*(pe*Math.abs(Math.sin(E.current)))>O.current?(co(B.t("message.SolarPanelsCannotIntersectWithGround",G)),!1):pe>j.current?(co(B.t("message.SolarPanelsCannotOverlapWithOneAnother",G)),!1):!0},Z=pe=>{const Ie=n.filter(ve=>ve.type===z.SolarPanel&&ve.parentId===pe.parentId);if(Ie.length>0)for(const ve of Ie)ve.referenceId!==pe.id&&ye.isPointInside(ve.cx,ve.cy,pe.vertices)&&c(ve.id,pe.id)},ne=()=>{if((oe==null?void 0:oe.type)===z.Polygon){const pe=i(oe);if(pe){const Ie=[],ze=W.current===Nl.eastWest||W.current===Nl.northSouth?xwo.create(oe,pe,Q,F.current,E.current,L.current,j.current,W.current,O.current,_.current,Y.current):ZH.create(oe,pe,Q,F.current,E.current,L.current,j.current,W.current,O.current,_.current,Y.current);if(ze.length>0){for(const se of ze)Ie.push(JSON.parse(JSON.stringify(se))),e(ge=>{ge.elements.push(se)});const Ae={name:"Solar Panel Array Layout",timestamp:Date.now(),oldElements:H.getState().deletedElements,newElements:Ie,oldParams:{pvModelName:o.pvModelName,rowAxis:o.rowAxis,orientation:o.orientation,tiltAngle:o.tiltAngle,rowsPerRack:o.rowsPerRack,interRowSpacing:o.interRowSpacing,poleHeight:o.poleHeight,poleSpacing:o.poleSpacing,margin:o.margin},newParams:{pvModelName:U.current,rowAxis:W.current,orientation:F.current,tiltAngle:E.current,rowsPerRack:L.current,interRowSpacing:j.current,poleHeight:O.current,poleSpacing:_.current,margin:Y.current},referenceId:oe.id,undo:()=>{d(Ae.referenceId,!1),Ae.oldElements.length>0&&e(se=>{for(const ge of Ae.oldElements)se.elements.push(ge)}),te(Ae.oldParams),q()},redo:()=>{d(Ae.referenceId,!1),Ae.newElements.length>0&&e(se=>{for(const ge of Ae.newElements)se.elements.push(ge)}),te(Ae.newParams),q()}};p(Ae),y(m+1)}}M.current=!1,q()}},te=pe=>{U.current=pe.pvModelName,W.current=pe.rowAxis,F.current=pe.orientation,E.current=pe.tiltAngle,L.current=pe.rowsPerRack,j.current=pe.interRowSpacing,O.current=pe.poleHeight,_.current=pe.poleSpacing,Y.current=pe.margin??0},q=()=>{e(pe=>{pe.solarPanelArrayLayoutParams.pvModelName=U.current,pe.solarPanelArrayLayoutParams.rowAxis=W.current,pe.solarPanelArrayLayoutParams.orientation=F.current,pe.solarPanelArrayLayoutParams.tiltAngle=E.current,pe.solarPanelArrayLayoutParams.rowsPerRack=L.current,pe.solarPanelArrayLayoutParams.interRowSpacing=j.current,pe.solarPanelArrayLayoutParams.poleHeight=O.current,pe.solarPanelArrayLayoutParams.poleSpacing=_.current,pe.solarPanelArrayLayoutParams.margin=Y.current})},le=()=>{M.current&&(ae()?oe&&(Z(oe),u(oe.id)>0?A(!0):(f(),ne())):co(B.t("polygonMenu.LayoutNotAcceptedCheckYourParameters",G)))},de=()=>{le(),N.current=!1},he=()=>{t(!1),w(),M.current=!0,N.current=!1},me=()=>{M.current?(le(),N.current=!0):t(!1)},ce=()=>{A(!1)},Pe=()=>{oe&&(d(oe.id,!0),ne(),N.current&&(t(!1),y(0))),A(!1)};return h.jsxs(h.Fragment,{children:[P&&h.jsx(li,{width:400,open:P,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>v(!0),onMouseOut:()=>v(!1),children:B.t("word.Reminder",G)}),footer:[h.jsx(oo,{onClick:ce,children:B.t("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:k,onClick:Pe,children:B.t("word.OK",G)},"OK")],children:B.t("message.ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout",G)+" "+B.t("message.DoYouWantToContinue",G)}),h.jsxs(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>v(!0),onMouseOut:()=>v(!1),children:B.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",G)}),footer:[h.jsx(oo,{disabled:!M.current,onClick:de,children:B.t("word.Apply",G)},"Apply"),h.jsx(oo,{onClick:he,children:B.t("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:D,onClick:me,children:B.t("word.OK",G)},"OK")],onCancel:()=>{t(!1),M.current=!0},maskClosable:!1,destroyOnClose:!1,modalRender:pe=>h.jsx(Vi,{disabled:!S,bounds:b,onStart:(Ie,ve)=>$(Ie,ve),children:h.jsx("div",{ref:R,children:pe})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px",paddingTop:"10px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(ee).length+" "+B.t("word.Options",G)+"):"}),h.jsx(Ge,{span:11,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:U.current,onChange:pe=>{pe!==null&&(U.current=pe,M.current=!0,C(!x))},children:Object.keys(ee).map(pe=>h.jsx(Qx,{value:pe,children:pe+(ee[pe].bifacialityFactor>0?" ("+B.t("pvModelPanel.Bifacial",G)+")":"")},pe))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{style:{width:"100%"},value:W.current,onChange:pe=>{pe!==null&&(W.current=pe,M.current=!0,C(!x))},children:[h.jsx(Qx,{value:Nl.leftRight,children:B.t("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},Nl.leftRight),h.jsx(Qx,{value:Nl.upDown,children:B.t("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},Nl.upDown),h.jsx(Qx,{value:Nl.eastWest,children:B.t("polygonMenu.SolarPanelArrayEastWestRowAxis",G)},Nl.eastWest),h.jsx(Qx,{value:Nl.northSouth,children:B.t("polygonMenu.SolarPanelArrayNorthSouthRowAxis",G)},Nl.northSouth)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{style:{width:"100%"},value:F.current,onChange:pe=>{pe!==null&&(F.current=pe,M.current=!0,C(!x))},children:[h.jsx(Qx,{value:br.portrait,children:B.t("solarPanelMenu.Portrait",G)},br.portrait),h.jsx(Qx,{value:br.landscape,children:B.t("solarPanelMenu.Landscape",G)},br.landscape)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayTiltAngle",G)+" ([-90°, 90°]): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:-90,max:90,style:{width:"100%"},precision:2,value:parseFloat(ye.toDegrees(E.current).toFixed(2)),step:1,formatter:pe=>`${pe}°`,onChange:pe=>{pe!==null&&(E.current=ye.toRadians(pe),M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayRowWidth",G)+" ([1-100] "+B.t("solarPanelMenu.Panels",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:1,max:100,step:1,style:{width:"100%"},precision:0,formatter:pe=>Number(pe).toFixed(0),value:L.current,onChange:pe=>{pe!==null&&(L.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayInterRowSpacing",G)+" ([1, 20] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:1,max:20,style:{width:"100%"},precision:2,value:j.current,step:.5,onChange:pe=>{pe!==null&&(j.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayMargin",G)+" ([0, 5] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:0,max:5,style:{width:"100%"},precision:1,value:Y.current,step:.1,onChange:pe=>{pe!==null&&(Y.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayPoleHeight",G)+" ([0, 10] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:0,max:10,style:{width:"100%"},precision:2,value:O.current,step:.1,onChange:pe=>{pe!==null&&(O.current=pe,M.current=!0,C(!x))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("polygonMenu.SolarPanelArrayPoleSpacing",G)+" ([2, 50] "+B.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ge,{span:11,children:h.jsx(mn,{min:2,max:50,style:{width:"100%"},precision:2,value:_.current,step:.5,onChange:pe=>{pe!==null&&(_.current=pe,M.current=!0,C(!x))}})})]})]})]})},{Option:hp}=Ko,bwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),i=H(jM),a=H(BM),l=H(q3),s=H($r),c=H($3),u=H(w4).geneticAlgorithmParams,d=H(MQ),f=H(ZRt),p=H(CQ),[m,y]=g.useState(!1),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S=g.useRef(u.objectiveFunctionType),v=g.useRef(u.selectionMethod),b=g.useRef(u.searchMethod),T=g.useRef(u.populationSize),R=g.useRef(u.maximumGenerations),M=g.useRef(u.mutationRate),D=g.useRef(u.selectionRate??.5),k=g.useRef(u.crossoverRate??.5),N=g.useRef(u.convergenceThreshold),U=g.useRef(u.localSearchRadius),W=g.useRef(d.minimumTiltAngle??-$t),F=g.useRef(d.maximumTiltAngle??$t),E=g.useRef(d.minimumRowsPerRack),L=g.useRef(d.maximumRowsPerRack),j=g.useRef(d.minimumInterRowSpacing),Y=g.useRef(d.maximumInterRowSpacing),O=g.useRef(null),_=g.useMemo(()=>({...a,...i}),[i,a]);g.useEffect(()=>{var pe;(pe=O.current)==null||pe.focus()},[]);const G={lng:o},Q=g.useRef(d.rowAxis??Nl.leftRight),oe=l?s(l):void 0,ee=oe?c(z.SolarPanel,oe.id):void 0,$=g.useRef(ee&&ee.length>0?ee[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),ae=g.useRef(ee&&ee.length>0?ee[0].orientation:d.orientation??br.landscape),Z=g.useRef(ee&&ee.length>0?ee[0].poleHeight:d.poleHeight??1),ne=g.useRef(ee&&ee.length>0?ee[0].poleSpacing:d.poleSpacing??3),te=g.useRef(d.margin??0),q=g.useRef(p.electricitySellingPrice),le=g.useRef(p.operationalCostPerUnit);g.useEffect(()=>{q.current=p.electricitySellingPrice},[p.electricitySellingPrice]),g.useEffect(()=>{le.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const de=(pe,Ie)=>{if(A.current){const{clientWidth:ve,clientHeight:ze}=window.document.documentElement,Ae=A.current.getBoundingClientRect();P({left:-Ae.left+Ie.x,right:ve-(Ae.right-Ie.x),top:-Ae.top+Ie.y,bottom:ze-((Ae==null?void 0:Ae.bottom)-Ie.y)})}},he=()=>{e(pe=>{pe.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Pi.SOLAR_PANEL_ARRAY,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=S.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=v.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=b.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=T.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=R.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=D.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=k.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=M.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=N.current,pe.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=U.current,pe.solarPanelArrayLayoutConstraints||(pe.solarPanelArrayLayoutConstraints=new kJ),pe.solarPanelArrayLayoutConstraints.minimumRowsPerRack=E.current,pe.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,pe.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,pe.solarPanelArrayLayoutConstraints.maximumTiltAngle=F.current,pe.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,pe.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=Y.current,pe.solarPanelArrayLayoutConstraints.poleHeight=Z.current,pe.solarPanelArrayLayoutConstraints.poleSpacing=ne.current,pe.solarPanelArrayLayoutConstraints.pvModelName=$.current,pe.solarPanelArrayLayoutConstraints.rowAxis=Q.current,pe.solarPanelArrayLayoutConstraints.orientation=ae.current,pe.solarPanelArrayLayoutConstraints.margin=te.current,pe.economicsParams.operationalCostPerUnit=le.current,pe.economicsParams.electricitySellingPrice=q.current})},me=()=>{r||yn(ce("message.EvolutionStarted",G)),he(),setTimeout(()=>{dt.getState().set(pe=>{pe.runEvolution=!pe.runEvolution}),e(pe=>{pe.evolutionMethod=ec.GENETIC_ALGORITHM,n&&(pe.actionInfo={name:"Run Genetic Algorithm for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...H.getState().evolutionaryAlgorithmState.geneticAlgorithmParams,...H.getState().solarPanelArrayLayoutConstraints,...H.getState().economicsParams}})})},100)},{t:ce}=Jl(),Pe=[{key:"1",label:ce("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.Objective",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:S.current,style:{width:"100%"},value:S.current,onChange:pe=>{S.current=pe,y(!m)},children:[h.jsx(hp,{value:Mo.DAILY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(hp,{value:Mo.YEARLY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Mo.YEARLY_TOTAL_OUTPUT),h.jsx(hp,{value:Mo.DAILY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Mo.DAILY_AVERAGE_OUTPUT),h.jsx(hp,{value:Mo.YEARLY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Mo.YEARLY_AVERAGE_OUTPUT),h.jsx(hp,{value:Mo.DAILY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Mo.DAILY_PROFIT),h.jsx(hp,{value:Mo.YEARLY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Mo.YEARLY_PROFIT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.GeneticAlgorithmSelectionMethod",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:v.current,style:{width:"100%"},value:v.current,onChange:pe=>{v.current=pe,y(!m)},children:[h.jsx(hp,{value:by.ROULETTE_WHEEL,children:ce("optimizationMenu.RouletteWheel",G)},by.ROULETTE_WHEEL),h.jsx(hp,{value:by.TOURNAMENT,children:ce("optimizationMenu.Tournament",G)},by.TOURNAMENT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.PopulationSize",G)+" [10, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,value:T.current,step:1,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{pe!==null&&(T.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MaximumGenerations",G)+" [5, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:R.current,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{pe!==null&&(R.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SelectionRate",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:D.current,step:.01,onChange:pe=>{pe!==null&&(D.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.CrossoverRate",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:k.current,step:.01,onChange:pe=>{pe!==null&&(k.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MutationRate",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:M.current,step:.01,onChange:pe=>{pe!==null&&(M.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:pe=>{pe!==null&&(N.current=Number(pe),y(!m))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:b.current,style:{width:"100%"},value:b.current,onChange:pe=>{b.current=Number(pe),y(!m)},children:[h.jsx(hp,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:ce("optimizationMenu.GlobalSearchUniformSelection",G)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(hp,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:ce("optimizationMenu.LocalSearchRandomOptimization",G)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),b.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:pe=>{pe!==null&&(U.current=Number(pe),y(!m))}})})]})]})},{key:"2",label:ce("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{W.current=ye.toRadians(pe[0]),F.current=ye.toRadians(pe[1]),y(!m)},min:-90,max:90,defaultValue:[ye.toDegrees(W.current),ye.toDegrees(F.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{E.current=pe[0],L.current=pe[1],y(!m)},min:1,max:9,defaultValue:[E.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{j.current=pe[0],Y.current=pe[1],y(!m)},min:1,max:10,defaultValue:[j.current,Y.current],marks:{1:{style:{fontSize:"10px"},label:"1m"},3:{style:{fontSize:"10px"},label:"3m"},5:{style:{fontSize:"10px"},label:"5m"},7:{style:{fontSize:"10px"},label:"7m"},9:{style:{fontSize:"10px"},label:"9m"}}})})]})]})},{key:"3",label:ce("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(_).length+" "+ce("word.Options",G)+"):"}),h.jsx(Ge,{span:12,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:$.current,onChange:pe=>{$.current=pe,y(!m)},children:Object.keys(_).map(pe=>h.jsx(hp,{value:pe,children:pe+(_[pe].bifacialityFactor>0?" ("+ce("pvModelPanel.Bifacial",G)+")":"")},pe))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:Q.current,onChange:pe=>{Q.current=pe,y(!m)},children:[h.jsx(hp,{value:Nl.leftRight,children:ce("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},Nl.leftRight),h.jsx(hp,{value:Nl.upDown,children:ce("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},Nl.upDown)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:ae.current,onChange:pe=>{ae.current=pe,y(!m)},children:[h.jsx(hp,{value:br.portrait,children:ce("solarPanelMenu.Portrait",G)},br.portrait),h.jsx(hp,{value:br.landscape,children:ce("solarPanelMenu.Landscape",G)},br.landscape)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{te.current=pe,y(!m)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{Z.current=pe,y(!m)},min:0,max:10,step:.1,defaultValue:Z.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{ne.current=pe,y(!m)},min:2,max:10,step:.1,defaultValue:ne.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{le.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:le.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{q.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:q.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:ce("optimizationMenu.SolarPanelArrayLayout",G)+": "+ce("optimizationMenu.GeneticAlgorithmSettings",G)}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:ce("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:O,onClick:()=>{me(),t(!1)},children:ce("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:pe=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(Ie,ve)=>de(Ie,ve),children:h.jsx("div",{ref:A,children:pe})}),children:h.jsx(dee,{defaultActiveKey:f,items:Pe,type:"card",onChange:pe=>{e(Ie=>{Ie.geneticAlgorithmWizardSelectedTab=pe})}})})})},{Option:Dg}=Ko,Swo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qi),o=H(Au),r=dt(_5),i=H(jM),a=H(BM),l=H(q3),s=H($r),c=H($3),u=H(w4).particleSwarmOptimizationParams,d=H(MQ),f=H(eHt),p=H(CQ),[m,y]=g.useState(!1),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S=g.useRef(u.objectiveFunctionType),v=g.useRef(u.searchMethod),b=g.useRef(u.swarmSize),T=g.useRef(u.maximumSteps),R=g.useRef(u.vmax??.01),M=g.useRef(u.inertia??.8),D=g.useRef(u.cognitiveCoefficient??.1),k=g.useRef(u.socialCoefficient??.1),N=g.useRef(u.convergenceThreshold),U=g.useRef(u.localSearchRadius),W=g.useRef(d.minimumTiltAngle??-$t),F=g.useRef(d.maximumTiltAngle??$t),E=g.useRef(d.minimumRowsPerRack),L=g.useRef(d.maximumRowsPerRack),j=g.useRef(d.minimumInterRowSpacing),Y=g.useRef(d.maximumInterRowSpacing),O=g.useRef(null),_=g.useMemo(()=>({...a,...i}),[i,a]);g.useEffect(()=>{var pe;(pe=O.current)==null||pe.focus()},[]);const G={lng:o},Q=g.useRef(d.rowAxis??Nl.leftRight),oe=l?s(l):void 0,ee=oe?c(z.SolarPanel,oe.id):void 0,$=g.useRef(ee&&ee.length>0?ee[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),ae=g.useRef(ee&&ee.length>0?ee[0].orientation:d.orientation??br.landscape),Z=g.useRef(ee&&ee.length>0?ee[0].poleHeight:d.poleHeight??1),ne=g.useRef(ee&&ee.length>0?ee[0].poleSpacing:d.poleSpacing??3),te=g.useRef(d.margin??0),q=g.useRef(p.electricitySellingPrice),le=g.useRef(p.operationalCostPerUnit);g.useEffect(()=>{q.current=p.electricitySellingPrice},[p.electricitySellingPrice]),g.useEffect(()=>{le.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const de=(pe,Ie)=>{if(A.current){const{clientWidth:ve,clientHeight:ze}=window.document.documentElement,Ae=A.current.getBoundingClientRect();P({left:-Ae.left+Ie.x,right:ve-(Ae.right-Ie.x),top:-Ae.top+Ie.y,bottom:ze-((Ae==null?void 0:Ae.bottom)-Ie.y)})}},he=()=>{e(pe=>{pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Pi.SOLAR_PANEL_ARRAY,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=S.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=v.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=b.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=T.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=D.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=k.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=R.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=M.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=N.current,pe.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=U.current,pe.solarPanelArrayLayoutConstraints||(pe.solarPanelArrayLayoutConstraints=new kJ),pe.solarPanelArrayLayoutConstraints.minimumRowsPerRack=E.current,pe.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,pe.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,pe.solarPanelArrayLayoutConstraints.maximumTiltAngle=F.current,pe.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,pe.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=Y.current,pe.solarPanelArrayLayoutConstraints.poleHeight=Z.current,pe.solarPanelArrayLayoutConstraints.poleSpacing=ne.current,pe.solarPanelArrayLayoutConstraints.pvModelName=$.current,pe.solarPanelArrayLayoutConstraints.rowAxis=Q.current,pe.solarPanelArrayLayoutConstraints.orientation=ae.current,pe.solarPanelArrayLayoutConstraints.margin=te.current,pe.economicsParams.operationalCostPerUnit=le.current,pe.economicsParams.electricitySellingPrice=q.current})},me=()=>{r||yn(ce("message.EvolutionStarted",G)),he(),setTimeout(()=>{dt.getState().set(pe=>{pe.runEvolution=!pe.runEvolution}),e(pe=>{pe.evolutionMethod=ec.PARTICLE_SWARM_OPTIMIZATION,n&&(pe.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...H.getState().evolutionaryAlgorithmState.particleSwarmOptimizationParams,...H.getState().solarPanelArrayLayoutConstraints,...H.getState().economicsParams}})})},100)},{t:ce}=Jl(),Pe=[{key:"1",label:ce("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.Objective",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:S.current,style:{width:"100%"},value:S.current,onChange:pe=>{S.current=pe,y(!m)},children:[h.jsx(Dg,{value:Mo.DAILY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Mo.DAILY_TOTAL_OUTPUT),h.jsx(Dg,{value:Mo.YEARLY_TOTAL_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Mo.YEARLY_TOTAL_OUTPUT),h.jsx(Dg,{value:Mo.DAILY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Mo.DAILY_AVERAGE_OUTPUT),h.jsx(Dg,{value:Mo.YEARLY_AVERAGE_OUTPUT,children:ce("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Mo.YEARLY_AVERAGE_OUTPUT),h.jsx(Dg,{value:Mo.DAILY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Mo.DAILY_PROFIT),h.jsx(Dg,{value:Mo.YEARLY_PROFIT,children:ce("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Mo.YEARLY_PROFIT)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SwarmSize",G)+" [10, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:10,max:100,style:{width:"100%"},precision:0,value:b.current,step:1,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{b.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MaximumSteps",G)+" [5, 100]:"}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:T.current,formatter:pe=>Number(pe).toFixed(0),onChange:pe=>{T.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.CognitiveCoefficient",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:D.current,step:.01,onChange:pe=>{D.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SocialCoefficient",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:k.current,step:.01,onChange:pe=>{k.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.InertiaWeight",G)+" [0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:M.current,step:.01,onChange:pe=>{M.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.MaximumVelocity",G)+" [0.001, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:R.current,step:.001,onChange:pe=>{R.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:pe=>{N.current=Number(pe),y(!m)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{defaultValue:v.current,style:{width:"100%"},value:v.current,onChange:pe=>{v.current=Number(pe),y(!m)},children:[h.jsx(Dg,{value:As.GLOBAL_SEARCH_UNIFORM_SELECTION,children:ce("optimizationMenu.GlobalSearchUniformSelection",G)},As.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(Dg,{value:As.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:ce("optimizationMenu.LocalSearchRandomOptimization",G)},As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),v.current===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ge,{span:12,children:h.jsx(mn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:pe=>{U.current=Number(pe),y(!m)}})})]})]})},{key:"2",label:ce("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{W.current=ye.toRadians(pe[0]),F.current=ye.toRadians(pe[1]),y(!m)},min:-90,max:90,defaultValue:[ye.toDegrees(W.current),ye.toDegrees(F.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{E.current=pe[0],L.current=pe[1],y(!m)},min:1,max:9,defaultValue:[E.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:ce("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{range:!0,onChange:pe=>{j.current=pe[0],Y.current=pe[1],y(!m)},min:2,max:10,defaultValue:[j.current,Y.current],marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]})]})},{key:"3",label:ce("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(_).length+" "+ce("word.Options",G)+"):"}),h.jsx(Ge,{span:12,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:$.current,onChange:pe=>{$.current=pe,y(!m)},children:Object.keys(_).map(pe=>h.jsx(Dg,{value:pe,children:pe+(_[pe].bifacialityFactor>0?" ("+ce("pvModelPanel.Bifacial",G)+")":"")},pe))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:Q.current,onChange:pe=>{Q.current=pe,y(!m)},children:[h.jsx(Dg,{value:Nl.leftRight,children:ce("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},Nl.leftRight),h.jsx(Dg,{value:Nl.upDown,children:ce("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},Nl.upDown)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ge,{span:12,children:h.jsxs(Ko,{style:{width:"100%"},value:ae.current,onChange:pe=>{ae.current=pe,y(!m)},children:[h.jsx(Dg,{value:br.portrait,children:ce("solarPanelMenu.Portrait",G)},br.portrait),h.jsx(Dg,{value:br.landscape,children:ce("solarPanelMenu.Landscape",G)},br.landscape)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{te.current=pe,y(!m)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{Z.current=pe,y(!m)},min:0,max:10,step:.1,defaultValue:Z.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{ne.current=pe,y(!m)},min:2,max:10,step:.1,defaultValue:ne.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{le.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:le.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ge,{span:12,children:ce("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ge,{span:12,children:h.jsx(B0,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:pe=>{q.current=pe,y(!m)},min:.1,max:1,step:.01,defaultValue:q.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:ce("optimizationMenu.SolarPanelArrayLayout",G)+": "+ce("optimizationMenu.ParticleSwarmOptimizationSettings",G)}),footer:[h.jsx(oo,{onClick:()=>{t(!1)},children:ce("word.Cancel",G)},"Cancel"),h.jsx(oo,{type:"primary",ref:O,onClick:()=>{me(),t(!1)},children:ce("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:pe=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(Ie,ve)=>de(Ie,ve),children:h.jsx("div",{ref:A,children:pe})}),children:h.jsx(dee,{defaultActiveKey:f,items:Pe,type:"card",onChange:pe=>{e(Ie=>{Ie.particleSwarmOptimizationWizardSelectedTab=pe})}})})})},Two=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o=H.getState().getParent(n),r={lng:H.getState().language},i=!n.locked;return e.push({key:"polygon-paste",label:h.jsx(yI,{})}),e.push({key:"polygon-copy",label:h.jsx(ad,{})}),i&&e.push({key:"polygon-cut",label:h.jsx(ld,{})}),o&&(o.type===z.Foundation||o.type===z.Cuboid)&&e.push({key:"polygon-layout-submenu",label:h.jsx(ln,{children:B.t("polygonMenu.Layout",r)}),children:[{key:"solar-panel-layout-wizard",label:h.jsxs(Zn,{noPadding:!0,Dialog:vwo,children:[B.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",r)," ..."]})},{key:"solar-panel-layout-ai",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.SolarPanelArrayLayoutGenerativeDesign",r)}),children:[{key:"solar-panel-layout-ga",label:h.jsxs(Zn,{noPadding:!0,Dialog:bwo,children:[B.t("optimizationMenu.GeneticAlgorithm",r)," ..."]})},{key:"solar-panel-layout-pso",label:h.jsxs(Zn,{noPadding:!0,Dialog:Swo,children:[B.t("optimizationMenu.ParticleSwarmOptimization",r)," ..."]})}]}]}),e.push({key:"polygon-lock",label:h.jsx(D0,{selectedElement:n})}),i&&(e.push({key:"polygon-filled",label:h.jsx(two,{polygon:n})}),n.filled&&e.push({key:"polygon-shiny",label:h.jsx(nwo,{polygon:n})}),e.push({key:"polygon-no-outline",label:h.jsx(owo,{polygon:n})})),i&&(e.push({key:"polygon-line-color",label:h.jsxs(Zn,{Dialog:dwo,children:[B.t("polygonMenu.LineColor",r)," ..."]})},{key:"polygon-line-style",label:h.jsxs(Zn,{Dialog:fwo,children:[B.t("polygonMenu.LineStyle",r)," ..."]})},{key:"polygon-line-width",label:h.jsxs(Zn,{Dialog:hwo,children:[B.t("polygonMenu.LineWidth",r)," ..."]})}),n.filled&&((!n.textureType||n.textureType===Zr.NoTexture)&&e.push({key:"polygon-fill-color",label:h.jsxs(Zn,{Dialog:pwo,children:[B.t("polygonMenu.FillColor",r)," ..."]})}),e.push({key:"polygon-texture",label:h.jsxs(Zn,{Dialog:Awo,children:[B.t("polygonMenu.FillTexture",r)," ..."]})},{key:"polygon-opacity",label:h.jsxs(Zn,{Dialog:wwo,children:[B.t("polygonMenu.Opacity",r)," ..."]})})),e.push({key:"polygon-text-box",label:h.jsx(ln,{children:B.t("polygonMenu.TextBox",r)}),children:[{key:"polygon-text",label:h.jsx(rwo,{polygon:n})},{key:"polygon-font-size",label:h.jsx(iwo,{polygon:n})},{key:"polygon-font-color",label:h.jsx(awo,{polygon:n})},{key:"polygon-font-outline-color",label:h.jsx(lwo,{polygon:n})},{key:"polygon-font-outline-width",label:h.jsx(swo,{polygon:n})},{key:"polygon-font-stroke-color",label:h.jsx(cwo,{polygon:n})},{key:"polygon-font-stroke-width",label:h.jsx(uwo,{polygon:n})}]})),{items:e}},Pwo=(t,e)=>{H.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){o.vertices.splice(e,1);break}})},Cwo=(t,e)=>{H.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>0&&e{H.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>=0&&e{if(t.selectedIndex>=0){const n=t.vertices.map(i=>({...i}));switch(e){case db.Delete:Pwo(t.id,t.selectedIndex);break;case db.InsertBeforeIndex:Cwo(t.id,t.selectedIndex);break;case db.InsertAfterIndex:Rwo(t.id,t.selectedIndex);break}const o=H.getState().getElementById(t.id).vertices.map(i=>({...i})),r={name:e,timestamp:Date.now(),changedElementId:t.id,changedElementType:t.type,oldValue:n,newValue:o,undo:()=>{r.oldValue&&Array.isArray(r.oldValue)&&H.getState().updatePolygonVerticesById(r.changedElementId,n)},redo:()=>{H.getState().updatePolygonVerticesById(r.changedElementId,o)}};H.getState().addUndoable(r)}},Hwo=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o={lng:H.getState().language};return e.push({key:"polygon-vertex-insert-before-index",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.InsertVertexBeforeIndex",o)})},{key:"polygon-vertex-insert-after-index",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.InsertVertexAfterIndex",o)})}),n.vertices.length>3&&e.push({key:"polygon-vertex-delete",label:h.jsx(ln,{noPadding:!0,children:B.t("polygonMenu.DeleteVertex",o)})}),{items:e,onClick:({key:i})=>{switch(i){case"polygon-vertex-insert-before-index":Lce(n,db.InsertBeforeIndex);break;case"polygon-vertex-insert-after-index":Lce(n,db.InsertAfterIndex);break;case"polygon-vertex-delete":Lce(n,db.Delete);break}}}},Mwo=({sensor:t})=>{const e=Kt(),n=Sct(t);return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.showLabel,onChange:n,children:B.t("labelSubMenu.KeepShowingLabel",e)})})},Iwo=({sensor:t})=>{const e=Kt(),{labelText:n,setLabelText:o}=bct(t),r=Tct(t,n);return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"80px"},children:B.t("labelSubMenu.LabelText",e)+":"}),h.jsx(Vl,{style:{width:"150px"},value:n,onChange:i=>o(i.target.value),onPressEnter:r,onBlur:r})]})},zwo=t=>{const e=[];if(t.type!==z.Sensor)return{items:e};const n=t,o=!n.locked;return e.push({key:"sensor-copy",label:h.jsx(ad,{})}),o&&e.push({key:"sensor-cut",label:h.jsx(ld,{})}),e.push({key:"sensor-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"sensor-show-label",label:h.jsx(Mwo,{sensor:n})}),e.push({key:"sensor-label-text",label:h.jsx(Iwo,{sensor:n})})),{items:e}},Dwo=({light:t})=>{const e=Kt(),n=H.getState().updateInsideLightById,o=r=>{const i=r.target.checked,a={name:"Inside Light",timestamp:Date.now(),checked:i,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.inside,onChange:o,children:B.t("lightMenu.Inside",e)})})},Ewo=({light:t})=>{const e=Kt(),n=t.intensity??3,o=(i,a)=>{H.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.intensity=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Intensity",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),o(t.id,i),H.getState().set(l=>{l.actionState.lightIntensity=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"80px"},children:[B.t("lightMenu.Intensity",e),":"]}),h.jsx(mn,{min:.1,max:10,step:.1,precision:1,value:n,onChange:r})]})},kwo=({light:t})=>{const e=Kt(),n=t.distance??5,o=(i,a)=>{H.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.distance=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Distance",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),o(t.id,i),H.getState().set(l=>{l.actionState.lightDistance=i})};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"80px"},children:[B.t("lightMenu.MaximumDistance",e),":"]}),h.jsx(mn,{min:1,max:10,step:1,precision:1,value:n,onChange:r})]})},Fwo=({light:t})=>{const e=t.color??"#ffff99",n=(o,r)=>{H.getState().set(i=>{for(const a of i.elements)if(a.type===z.Light&&a.id===o){a.color=r;break}})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(sd,{color:e,onChangeComplete:o=>{const r=t.color,i=o.hex,a={name:"Set Light Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{n(t.id,a.oldValue)},redo:()=>{n(t.id,a.newValue)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.lightColor=i})}})})},Lwo=t=>{const e=[];if(t.type!==z.Light)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=n.parentId?H.getState().getParent(n):void 0;return e.push({key:"light-copy",label:h.jsx(ad,{})}),o&&e.push({key:"light-cut",label:h.jsx(ld,{})}),e.push({key:"light-lock",label:h.jsx(D0,{selectedElement:n})}),o&&i&&(i.type===z.Roof||i.type===z.Wall)&&e.push({key:"light-inside",label:h.jsx(Dwo,{light:n})}),o&&e.push({key:"light-intensity",label:h.jsx(Ewo,{light:n})},{key:"light-distance",label:h.jsx(kwo,{light:n})},{key:"light-color",label:h.jsx(ln,{children:B.t("word.Color",r)}),children:[{key:"light-color-picker",label:h.jsx(Fwo,{light:n}),style:{backgroundColor:"white"}}]}),{items:e}},Wwo=()=>{const t=H(G2e),e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.axes=r})},o=r=>{const i=r.target.checked,a={name:"Show Axes",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};H.getState().addUndoable(a),n(i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.Axes",e)})})},Nwo=()=>{const t=H(RGe),e=Kt(),n=i=>{H.getState().set(a=>{a.viewState.theme=i})},o=i=>{const a=t,l=i.target.value,s={name:"Select Theme",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(s.oldValue)},redo:()=>{n(s.newValue)}};H.getState().addUndoable(s),n(l)},r=[{value:qs.Default,label:"skyMenu.ThemeDefault"},{value:qs.Desert,label:"skyMenu.ThemeDesert"},{value:qs.Dune,label:"skyMenu.ThemeDune"},{value:qs.Forest,label:"skyMenu.ThemeForest"},{value:qs.Grassland,label:"skyMenu.ThemeGrassland"},{value:qs.Hill,label:"skyMenu.ThemeHill"},{value:qs.Lake,label:"skyMenu.ThemeLake"},{value:qs.Mountain,label:"skyMenu.ThemeMountain"},{value:qs.Rural,label:"skyMenu.ThemeRural"}];return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t,onChange:o,children:h.jsx(Jt,{direction:"vertical",children:r.map((i,a)=>h.jsx(We,{style:{width:"100%"},value:i.value,children:B.t(i.label,e)},`${a}-${i.value}`))})})})},Uwo=()=>{const t=H(HGe)??!0,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.showAzimuthAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Azimuth Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.ShowAzimuthAngle",e)})})},jwo=()=>{const t=H(MGe)??!0,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.showElevationAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Elevation Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.ShowElevationAngle",e)})})},Bwo=()=>{const t=H(IGe)??!0,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.showZenithAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Zenith Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:B.t("skyMenu.ShowZenithAngle",e)})})},Ywo=()=>{const t=H(CGe)??3.5,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.directLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Direct Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.DirectLightBrightnessAtNoon",e)+" [0.1-10]:"}),h.jsx(mn,{min:.1,max:10,step:.1,precision:2,value:t,onChange:o})]})},Owo=()=>{const t=H(PGe)??.2,e=Kt(),n=r=>{H.getState().set(i=>{i.viewState.ambientLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ambient Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.AmbientLightBrightnessAtNoon",e)+" [0.01-1]:"}),h.jsx(mn,{min:.01,max:1,step:.01,precision:2,value:t,onChange:o})]})},_wo=()=>{const t=H(eTt)??.01,e=Kt(),n=r=>{H.getState().set(i=>{i.world.airAttenuationCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Sunlight Attenuation Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.SunlightAttenuationCoefficientInAir",e)+":"}),h.jsx(mn,{min:0,max:.1,step:.001,precision:3,value:t,onChange:o})]})},Vwo=()=>{const t=H(tTt)??5,e=Kt(),n=r=>{H.getState().set(i=>{i.world.airConvectiveCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Convective Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};H.getState().addUndoable(l),n(a)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.ConvectiveCoefficientOfAir",e)+" [W/(m²×K)]:"}),h.jsx(mn,{min:2.5,max:20,step:.1,precision:2,value:t,onChange:o})]})},Gwo=()=>{const t=H(WN)??900,e=H.getState().world,n=Kt(),o=g.useMemo(()=>pl(new Date(e.date),e.latitude),[e.date,e.latitude]),r=a=>{H.getState().set(l=>{l.world.highestTemperatureTimeInMinutes=a})},i=a=>{if(a===null)return;const l=t,s=a,c={name:"Set Time of Highest Temperature in Minutes",timestamp:Date.now(),oldValue:l,newValue:s,undo:()=>{r(c.oldValue)},redo:()=>{r(c.newValue)}};H.getState().addUndoable(c),r(s)};return h.jsxs(ln,{stayAfterClick:!0,children:[h.jsx(Jt,{style:{width:"270px"},children:B.t("skyMenu.HighestTemperatureTimeInMinutes",n)+":"}),h.jsx(mn,{min:720,max:o.sunset,step:5,precision:0,value:t,onChange:i})]})},Xwo=()=>{const t={lng:H.getState().language},e=[];return e.push({key:"axes",label:h.jsx(Wwo,{})}),e.push({key:"theme-submenu",label:h.jsx(ln,{children:B.t("skyMenu.Theme",t)}),children:[{key:"theme-radio-group",label:h.jsx(Nwo,{}),style:{backgroundColor:"white"}}]}),e.push({key:"sun-angles-submenu",label:h.jsx(ln,{children:B.t("skyMenu.SelectSunAnglesToShow",t)}),children:[{key:"show-azimuth-angle",label:h.jsx(Uwo,{})},{key:"ShowElevationAngle",label:h.jsx(jwo,{})},{key:"ShowZenithAngle",label:h.jsx(Bwo,{})}]}),e.push({key:"direct-light-intensity",label:h.jsx(Ywo,{})}),e.push({key:"ambient-light-intensity",label:h.jsx(Owo,{})}),e.push({key:"air-attenuation-coefficient",label:h.jsx(_wo,{})}),e.push({key:"air-convective-coefficient",label:h.jsx(Vwo,{})}),e.push({key:"highest-temperature-time-in-minutes",label:h.jsx(Gwo,{})}),{items:e}},$$=class $${constructor(){this.n=14,this.nominalStrings=new Array(this.n),this.nominalWidths=new Array(this.n),this.nominalHeights=new Array(this.n),this.cellNx=new Array(this.n),this.cellNy=new Array(this.n),this.nominalWidths[0]=.99,this.nominalHeights[0]=1.65,this.cellNx[0]=6,this.cellNy[0]=10,this.nominalWidths[1]=.99,this.nominalHeights[1]=1.96,this.cellNx[1]=6,this.cellNy[1]=12,this.nominalWidths[2]=1.05,this.nominalHeights[2]=1.56,this.cellNx[2]=8,this.cellNy[2]=12,this.nominalWidths[3]=1.31,this.nominalHeights[3]=1.96,this.cellNx[3]=8,this.cellNy[3]=12,this.nominalWidths[4]=1.07,this.nominalHeights[4]=2.07,this.cellNx[4]=8,this.cellNy[4]=16,this.nominalWidths[5]=.6,this.nominalHeights[5]=1.2,this.cellNx[5]=10,this.cellNy[5]=20,this.nominalWidths[6]=1.2,this.nominalHeights[6]=2,this.cellNx[6]=10,this.cellNy[6]=20,this.nominalWidths[7]=1,this.nominalHeights[7]=2.07,this.cellNx[7]=6,this.cellNy[7]=12,this.nominalWidths[8]=.8,this.nominalHeights[8]=1.56,this.cellNx[8]=6,this.cellNy[8]=12,this.nominalWidths[9]=.83,this.nominalHeights[9]=1.58,this.cellNx[9]=6,this.cellNy[9]=12,this.nominalWidths[10]=.99,this.nominalHeights[10]=1.31,this.cellNx[10]=6,this.cellNy[10]=8,this.nominalWidths[11]=.99,this.nominalHeights[11]=1.5,this.cellNx[11]=6,this.cellNy[11]=9,this.nominalWidths[12]=1.05,this.nominalHeights[12]=1.81,this.cellNx[12]=8,this.cellNy[12]=14,this.nominalWidths[13]=1.05,this.nominalHeights[13]=1.69,this.cellNx[13]=8,this.cellNy[13]=13;for(let e=0;e{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(jM),a=H(BM),l=H(O5),s=H(Fn),c=H(Wh),u=H(Nh),d=H(no),f=H(qn),p=ao(),[m,y]=g.useState((p==null?void 0:p.pvModelName)??"SPR-X21-335-BLK"),[w,x]=g.useState(),C=Kt(),P=g.useMemo(()=>({...a,...i}),[i,a]),A=l(m??"SPR-X21-335-BLK");g.useEffect(()=>{x(A.nominalWidth.toFixed(2)+"m×"+A.nominalLength.toFixed(2)+"m ("+A.n+"×"+A.m+" "+B.t("pvModelPanel.Cells",C)+")")},[A]);const S=(W,F)=>{e(E=>{for(const L of E.elements)if(L.type===z.SolarPanel&&L.id===W&&!L.locked){const j=L;j.pvModelName=F;let Y=E.supportedPvModules[F];if(Y||(Y=E.customPvModules[F]),j.orientation===br.portrait){const O=Math.max(1,Math.round(j.lx/Y.width)),_=Math.max(1,Math.round(j.ly/Y.length));j.lx=O*Y.width,j.ly=_*Y.length}else{const O=Math.max(1,Math.round(j.lx/Y.length)),_=Math.max(1,Math.round(j.ly/Y.width));j.lx=O*Y.length,j.ly=_*Y.width}break}})},v=(W,F)=>{e(E=>{let L=E.supportedPvModules[F];L||(L=E.customPvModules[F]);for(const j of E.elements)if(j.type===z.SolarPanel&&j.foundationId===W&&!j.locked){const Y=j;if(Y.pvModelName=F,Y.orientation===br.portrait){const O=Math.max(1,Math.round(Y.lx/L.width)),_=Math.max(1,Math.round(Y.ly/L.length));Y.lx=O*L.width,Y.ly=_*L.length}else{const O=Math.max(1,Math.round(Y.lx/L.length)),_=Math.max(1,Math.round(Y.ly/L.width));Y.lx=O*L.length,Y.ly=_*L.width}}})},b=(W,F,E)=>{e(L=>{let j=L.supportedPvModules[E];j||(j=L.customPvModules[E]);for(const Y of L.elements)if(Y.type===z.SolarPanel&&!Y.locked){let O;if(F?O=Y.parentId===W&&ye.isIdentical(Y.normal,F):O=Y.parentId===W,O){const _=Y;if(_.pvModelName=E,_.orientation===br.portrait){const G=Math.max(1,Math.round(_.lx/j.width)),Q=Math.max(1,Math.round(_.ly/j.length));_.lx=G*j.width,_.ly=Q*j.length}else{const G=Math.max(1,Math.round(_.lx/j.length)),Q=Math.max(1,Math.round(_.ly/j.width));_.lx=G*j.length,_.ly=Q*j.width}}}})},T=W=>{e(F=>{let E=F.supportedPvModules[W];E||(E=F.customPvModules[W]);for(const L of F.elements)if(L.type===z.SolarPanel&&!L.locked){const j=L;if(j.pvModelName=W,j.orientation===br.portrait){const Y=Math.max(1,Math.round(j.lx/E.width)),O=Math.max(1,Math.round(j.ly/E.length));j.lx=Y*E.width,j.ly=O*E.length}else{const Y=Math.max(1,Math.round(j.lx/E.length)),O=Math.max(1,Math.round(j.ly/E.width));j.lx=Y*E.length,j.ly=O*E.width}}})},R=(W,F)=>{H.getState().set(E=>{let L=E.supportedPvModules[F];L||(L=E.customPvModules[F]);for(const j of E.elements)if(j.type===z.SolarPanel&&!j.locked&&W.has(j.id)){const Y=j;if(Y.pvModelName=F,Y.orientation===br.portrait){const O=Math.max(1,Math.round(Y.lx/L.width)),_=Math.max(1,Math.round(Y.ly/L.length));Y.lx=O*L.width,Y.ly=_*L.length}else{const O=Math.max(1,Math.round(Y.lx/L.length)),_=Math.max(1,Math.round(Y.ly/L.width));Y.lx=O*L.length,Y.ly=_*L.width}}})},M=W=>{u(W.target.value)},D=W=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const F of n)if(F.type===z.SolarPanel&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&F.pvModelName!==W)return!0;break}case ie.AllObjectsOfThisType:{for(const F of n)if(F.type===z.SolarPanel&&!F.locked&&F.pvModelName!==W)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const F of n)if(F.type===z.SolarPanel&&F.foundationId===(p==null?void 0:p.foundationId)&&!F.locked&&F.pvModelName!==W)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const F=r(p);if(F){if(F.type===z.Cuboid){for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&ye.isIdentical(L.normal,p.normal)&&!L.locked&&L.pvModelName!==W)return!0}else for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&!L.locked&&L.pvModelName!==W)return!0}break}default:{if((p==null?void 0:p.pvModelName)!==W)return!0;break}}return!1}},k=W=>{if(p&&D(W)){switch(c){case ie.AllSelectedObjectsOfThisType:{const F=new Map;for(const L of n)L.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.pvModelName);const E={name:"Set Model for Selected Solar Panels",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())S(L,j)},redo:()=>{R(E.oldValues,E.newValue)}};s(E),R(F,W),f(d+1);break}case ie.AllObjectsOfThisType:{const F=new Map;for(const L of n)L.type===z.SolarPanel&&F.set(L.id,L.pvModelName);const E={name:"Set Model for All Solar Panels",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())S(L,j)},redo:()=>{T(E.newValue)}};s(E),T(W),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const F=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===p.foundationId&&F.set(L.id,L.pvModelName);const E={name:"Set Model for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())S(L,j)},redo:()=>{E.groupId&&v(E.groupId,E.newValue)}};s(E),v(p.foundationId,W),f(d+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const F=r(p);if(F){const E=new Map,L=F.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&ye.isIdentical(O.normal,p.normal)&&E.set(O.id,O.pvModelName);else for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&E.set(O.id,O.pvModelName);const j=L?p.normal:void 0,Y={name:"Set Model for All Solar Panels on Surface",timestamp:Date.now(),oldValues:E,newValue:W,groupId:p.parentId,normal:j,undo:()=>{for(const[O,_]of Y.oldValues.entries())S(O,_)},redo:()=>{Y.groupId&&b(Y.groupId,Y.normal,Y.newValue)}};s(Y),b(p.parentId,j,W),f(d+1)}break}default:{const F=o(p.id),E=F?F.pvModelName:p.pvModelName,L={name:"Set Model for Selected Solar Panel",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{S(L.changedElementId,L.oldValue)},redo:()=>{S(L.changedElementId,L.newValue)}};s(L),S(p.id,W),f(d+1);break}}e(F=>{F.actionState.solarPanelModelName=W})}},N=()=>{t(!1)},U=()=>{k(m)};return h.jsxs(ro,{width:640,title:B.t("pvModelPanel.SolarPanelSpecs",C),onApply:U,onClose:N,children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.Model",C)+" ("+Object.keys(P).length+" "+B.t("word.Options",C)+"):"}),h.jsx(Ge,{span:11,children:h.jsx(Ko,{defaultValue:"Custom",style:{width:"100%"},value:m,onChange:y,children:Object.keys(P).map(W=>h.jsx(Zx,{value:W,children:W+(P[W].bifacialityFactor>0?" ("+B.t("pvModelPanel.Bifacial",C)+")":"")},W))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.PanelSize",C)+":"}),h.jsx(Ge,{span:11,children:h.jsx(Ko,{disabled:!0,style:{width:"100%"},value:w,onChange:W=>{},children:B1e.instance.nominalStrings.map(W=>h.jsx(Zx,{value:W,children:W},W))})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.CellType",C)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{disabled:!0,style:{width:"100%"},value:A.cellType,onChange:W=>{},children:[h.jsx(Zx,{value:"Monocrystalline",children:B.t("pvModelPanel.Monocrystalline",C)},"Monocrystalline"),h.jsx(Zx,{value:"Polycrystalline",children:B.t("pvModelPanel.Polycrystalline",C)},"Polycrystalline"),h.jsx(Zx,{value:"Thin Film",children:B.t("pvModelPanel.ThinFilm",C)},"Thin Film")]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.PowerBifaciality",C)+":"}),h.jsx(Ge,{span:11,children:h.jsx(mn,{disabled:!0,style:{width:"100%"},precision:2,value:A.bifacialityFactor,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("word.Color",C)+":"}),h.jsx(Ge,{span:11,children:h.jsxs(Ko,{disabled:!0,style:{width:"100%"},value:A.color,onChange:W=>{},children:[h.jsx(Zx,{value:"Black",children:B.t("pvModelPanel.Black",C)},"Black"),h.jsx(Zx,{value:"Blue",children:B.t("pvModelPanel.Blue",C)},"Blue")]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.SolarCellEfficiency",C)+" (%):"}),h.jsx(Ge,{span:11,children:h.jsx(mn,{disabled:!0,style:{width:"100%"},precision:2,value:100*A.efficiency,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.NominalOperatingCellTemperature",C)+" (°C):"}),h.jsx(Ge,{span:11,children:h.jsx(mn,{disabled:!0,style:{width:"100%"},precision:1,value:A.noct,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:13,children:B.t("pvModelPanel.TemperatureCoefficientOfPmax",C)+" (%/°C):"}),h.jsx(Ge,{span:11,children:h.jsx(Vl,{disabled:!0,style:{width:"100%"},value:A.pmaxTC,onChange:W=>{}})})]}),h.jsxs(Qt,{gutter:6,style:{border:"2px dashed #ccc",marginTop:"6px",marginLeft:"0",marginRight:"0",paddingLeft:"8px",paddingTop:"8px",paddingBottom:"8px"},children:[h.jsx(Ge,{span:3,children:B.t("word.ApplyTo",C)+":"}),h.jsx(Ge,{span:21,children:h.jsx(We.Group,{onChange:M,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})]})},{Option:REe}=Ko,Kwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(O5),i=H($r),a=H(u5e),l=H(Fn),s=H(Wh),c=H(Nh),u=H(no),d=H(qn),f=H(Ji),p=ao(),[m,y]=g.useState((p==null?void 0:p.orientation)??br.portrait),w=g.useRef(!1),x=g.useRef(),C=Kt(),P=(j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&_.id===j&&!_.locked){const G=_;let Q=O.supportedPvModules[G.pvModelName];Q||(Q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,Q,Y);break}})},A=(j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&_.foundationId===j&&!_.locked){const G=_;let Q=O.supportedPvModules[G.pvModelName];Q||(Q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,Q,Y)}})},S=(j,Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&!G.locked){let Q;if(Y?Q=G.parentId===j&&ye.isIdentical(G.normal,Y):Q=G.parentId===j,Q){const oe=G;let ee=_.supportedPvModules[oe.pvModelName];ee||(ee=_.customPvModules[oe.pvModelName]),_.setSolarPanelOrientation(oe,ee,O)}}})},v=j=>{e(Y=>{for(const O of Y.elements)if(O.type===z.SolarPanel&&!O.locked){const _=O;let G=Y.supportedPvModules[_.pvModelName];G||(G=Y.customPvModules[_.pvModelName]),Y.setSolarPanelOrientation(_,G,j)}})},b=(j,Y)=>{H.getState().set(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked&&j.has(_.id)){const G=_;let Q=O.supportedPvModules[G.pvModelName];Q||(Q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,Q,Y)}})},T=j=>{c(j.target.value)},R=j=>{if(p){const Y=r(p.pvModelName);if(j===br.portrait){const O=Math.max(1,Math.round(p.lx/Y.width)),_=Math.max(1,Math.round(p.ly/Y.length));a(p.id,O*Y.width,_*Y.length)}else{const O=Math.max(1,Math.round(p.lx/Y.length)),_=Math.max(1,Math.round(p.ly/Y.width));a(p.id,O*Y.length,_*Y.width)}P(p.id,j)}},M=(j,Y)=>{const O=i(j);if(O){if(O.type===z.Cuboid&&!ye.isIdentical(j.normal,fs))return!0;const _=JSON.parse(JSON.stringify(j));_.orientation=Y;const G=r(_.pvModelName);if(Y===br.portrait){const Q=Math.max(1,Math.round(_.lx/G.width)),oe=Math.max(1,Math.round(_.ly/G.length));_.lx=Q*G.width,_.ly=oe*G.length}else{const Q=Math.max(1,Math.round(_.lx/G.length)),oe=Math.max(1,Math.round(_.ly/G.width));_.lx=Q*G.length,_.ly=oe*G.width}return O.type===z.Wall?ye.checkElementOnWallState(_,O)===ya.Valid:O.type===z.Roof?ye.checkElementOnRoofState(_,O)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(_,O)}return!1},D=(j,Y)=>!M(j,Y),k=j=>{if(p){switch(s){case ie.AllSelectedObjectsOfThisType:{for(const Y of n)if(Y.type===z.SolarPanel&&!Y.locked&&H.getState().selectedElementIdSet.has(Y.id)&&Y.orientation!==j)return!0;break}case ie.AllObjectsOfThisType:{for(const Y of n)if(Y.type===z.SolarPanel&&!Y.locked&&Y.orientation!==j)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const Y of n)if(Y.type===z.SolarPanel&&Y.foundationId===(p==null?void 0:p.foundationId)&&!Y.locked&&Y.orientation!==j)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const Y=i(p);if(Y){if(Y.type===z.Cuboid){for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&ye.isIdentical(_.normal,p.normal)&&!_.locked&&_.orientation!==j)return!0}else for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&!_.locked&&_.orientation!==j)return!0}break}default:{if((p==null?void 0:p.orientation)!==j)return!0;break}}return!1}},N=j=>{if(p&&k(j)){switch(x.current=void 0,s){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const Y of n)if(Y.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(Y.id)&&D(Y,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const Y=new Map;for(const _ of n)_.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(_.id)&&Y.set(_.id,_.orientation);const O={name:"Set Orientation for Selected Solar Panels",timestamp:Date.now(),oldValues:Y,newValue:j,undo:()=>{for(const[_,G]of O.oldValues.entries())P(_,G)},redo:()=>{b(O.oldValues,O.newValue)}};l(O),b(Y,j),d(u+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const Y of n)if(Y.type===z.SolarPanel&&D(Y,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const Y=new Map;for(const _ of n)_.type===z.SolarPanel&&Y.set(_.id,_.orientation);const O={name:"Set Orientation for All Solar Panels",timestamp:Date.now(),oldValues:Y,newValue:j,undo:()=>{for(const[_,G]of O.oldValues.entries())P(_,G)},redo:()=>{v(O.newValue)}};l(O),v(j),d(u+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){w.current=!1;for(const Y of n)if(Y.type===z.SolarPanel&&Y.foundationId===p.foundationId&&D(Y,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const Y=new Map;for(const _ of n)_.type===z.SolarPanel&&_.foundationId===p.foundationId&&Y.set(_.id,_.orientation);const O={name:"Set Orientation for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:Y,newValue:j,groupId:p.foundationId,undo:()=>{for(const[_,G]of O.oldValues.entries())P(_,G)},redo:()=>{O.groupId&&A(O.groupId,O.newValue)}};l(O),A(p.foundationId,j),d(u+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const Y=i(p);if(Y){if(w.current=!1,Y.type===z.Cuboid){for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&ye.isIdentical(_.normal,p.normal)&&D(_,j)){w.current=!0;break}}else for(const _ of n)if(_.type===z.SolarPanel&&_.parentId===p.parentId&&D(_,j)){w.current=!0;break}if(w.current)x.current=j,y(p.orientation);else{const _=new Map,G=Y.type===z.Cuboid;if(G)for(const ee of n)ee.type===z.SolarPanel&&ee.parentId===p.parentId&&ye.isIdentical(ee.normal,p.normal)&&_.set(ee.id,ee.orientation);else for(const ee of n)ee.type===z.SolarPanel&&ee.parentId===p.parentId&&_.set(ee.id,ee.orientation);const Q=G?p.normal:void 0,oe={name:"Set Orientation for All Solar Panels on Surface",timestamp:Date.now(),oldValues:_,newValue:j,groupId:p.parentId,normal:Q,undo:()=>{for(const[ee,$]of oe.oldValues.entries())P(ee,$)},redo:()=>{oe.groupId&&S(oe.groupId,oe.normal,oe.newValue)}};l(oe),S(p.parentId,Q,j),d(u+1)}}break}default:{const Y=o(p.id),O=Y?Y.orientation:p.orientation;if(w.current=!1,w.current)x.current=j,y(O);else{const _={name:"Set Orientation of Selected Solar Panel",timestamp:Date.now(),oldValue:O,newValue:j,changedElementId:p.id,changedElementType:p.type,undo:()=>{R(_.oldValue)},redo:()=>{R(_.newValue)}};l(_),R(j),d(u+1)}break}}e(Y=>{Y.actionState.solarPanelOrientation=j})}},U=()=>{p&&(y(p.orientation),w.current=!1,t(!1))},W=()=>{U(),f()},F=()=>{N(m),w.current||(t(!1),d(0))},E=()=>{N(m)},L=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current?" ("+(x.current===br.portrait?B.t("solarPanelMenu.Portrait",C):B.t("solarPanelMenu.Landscape",C))+")":""):"";return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.Orientation",C),rejectedMessage:L,onApply:E,onClose:U,onClickCancel:W,onClickOk:F,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsxs(Ko,{style:{width:"150px"},value:m,onChange:j=>y(j),children:[h.jsx(REe,{value:br.portrait,children:B.t("solarPanelMenu.Portrait",C)},br.portrait),h.jsx(REe,{value:br.landscape,children:B.t("solarPanelMenu.Landscape",C)},br.landscape)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:T,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})})},$wo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(O5),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=ao(z.SolarPanel),[p,m]=g.useState((f==null?void 0:f.lx)??1),[y,w]=g.useState(0),x=g.useRef(!1),C=g.useRef(),P=Kt();g.useEffect(()=>{if(f){const Y=r(f.pvModelName)??r("SPR-X21-335-BLK");w(f.orientation===br.portrait?Y.width:Y.length)}},[f]);const A=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.id===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.lx=ye.panelizeLx(Q,oe,O);break}})},S=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.foundationId===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.lx=ye.panelizeLx(Q,oe,O)}})},v=(Y,O,_)=>{e(G=>{for(const Q of G.elements)if(Q.type===z.SolarPanel&&!Q.locked){let oe;if(O?oe=Q.parentId===Y&&ye.isIdentical(Q.normal,O):oe=Q.parentId===Y,oe){const ee=Q,$=G.getPvModule(ee.pvModelName);Q.lx=ye.panelizeLx(ee,$,_)}}})},b=Y=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked){const G=_,Q=O.getPvModule(G.pvModelName);_.lx=ye.panelizeLx(G,Q,Y)}})},T=(Y,O)=>{H.getState().set(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&!G.locked&&Y.has(G.id)){const Q=G,oe=_.getPvModule(Q.pvModelName);G.lx=ye.panelizeLx(Q,oe,O)}})},R=Y=>{s(Y.target.value)},M=(Y,O)=>{const _=i(Y);if(_){if(_.type===z.Cuboid&&!ye.isIdentical(Y.normal,fs))return!0;const G=JSON.parse(JSON.stringify(Y));return G.lx=O,_.type===z.Wall?ye.checkElementOnWallState(G,_)===ya.Valid:_.type===z.Roof?ye.checkElementOnRoofState(G,_)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(G,_)}return!1},D=(Y,O)=>!M(Y,O),k=Y=>{if(f){switch(l){case ie.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&H.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.lx-Y)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.lx-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.lx-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.lx-Y)>Ht)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.lx-Y)>Ht)return!0}break}default:{if(Math.abs((f==null?void 0:f.lx)-Y)>Ht)return!0;break}}return!1}},N=Y=>{if(f&&k(Y))switch(C.current=void 0,l){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const _={name:"Set Length for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{T(_.oldValues,_.newValue)}};a(_),T(O,Y),u(c+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const _={name:"Set Length for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{b(_.newValue)}};a(_),b(Y),u(c+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.lx);const _={name:"Set Length for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:Y,groupId:f.foundationId,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{_.groupId&&S(_.groupId,_.newValue)}};a(_),S(f.foundationId,Y),u(c+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(x.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&D(G,Y)){x.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&D(G,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.lx);else{const G=new Map,Q=O.type===z.Cuboid;if(Q)for(const $ of n)$.type===z.SolarPanel&&$.parentId===f.parentId&&ye.isIdentical($.normal,f.normal)&&G.set($.id,$.lx);else for(const $ of n)$.type===z.SolarPanel&&$.parentId===f.parentId&&G.set($.id,$.lx);const oe=Q?f.normal:void 0,ee={name:"Set Length for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:Y,groupId:f.parentId,normal:oe,undo:()=>{for(const[$,ae]of ee.oldValues.entries())A($,ae)},redo:()=>{ee.groupId&&v(ee.groupId,ee.normal,ee.newValue)}};a(ee),v(f.parentId,oe,Y),u(c+1)}}break}default:{const O=o(f.id),_=O?O.lx:f.lx;if(x.current=D(f,Y),x.current)C.current=Y,m(_);else{const G={name:"Set Solar Panel Array Length",timestamp:Date.now(),oldValue:_,newValue:Y,changedElementId:f.id,changedElementType:f.type,undo:()=>{A(G.changedElementId,G.oldValue)},redo:()=>{A(G.changedElementId,G.newValue)}};a(G),A(f.id,Y),u(c+1)}break}}},U=Y=>{let O=Y??1;return O=Math.max(1,Math.ceil((O-y/2)/y))*y,O},W=()=>{x.current=!1,t(!1)},F=()=>{W(),d()},E=()=>{N(p),x.current||(t(!1),u(0))},L=()=>{N(p)},j=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",P),rejectedMessage:j,onApply:L,onClose:W,onClickCancel:F,onClickOk:E,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:y,max:100*y,step:y,style:{width:120},precision:2,value:p,onChange:Y=>{Y!==null&&m(U(Y))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/y)+" "+B.t("solarPanelMenu.PanelsWide",P),h.jsx("br",{}),B.t("word.MaximumNumber",P),": 100 ",B.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:R,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},qwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(O5),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=ao(z.SolarPanel),[p,m]=g.useState((f==null?void 0:f.ly)??2),[y,w]=g.useState(0),x=g.useRef(!1),C=g.useRef(),P=Kt();g.useEffect(()=>{if(f){const Y=r(f.pvModelName)??r("SPR-X21-335-BLK");w(f.orientation===br.portrait?Y.length:Y.width),m(f.ly)}},[f]);const A=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.id===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.ly=ye.panelizeLy(Q,oe,O);break}})},S=(Y,O)=>{e(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&G.foundationId===Y&&!G.locked){const Q=G,oe=_.getPvModule(Q.pvModelName);G.ly=ye.panelizeLy(Q,oe,O)}})},v=(Y,O,_)=>{e(G=>{for(const Q of G.elements)if(Q.type===z.SolarPanel&&!Q.locked){let oe;if(O?oe=Q.parentId===Y&&ye.isIdentical(Q.normal,O):oe=Q.parentId===Y,oe){const ee=Q,$=G.getPvModule(ee.pvModelName);Q.ly=ye.panelizeLy(ee,$,_)}}})},b=Y=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked){const G=_,Q=O.getPvModule(G.pvModelName);_.ly=ye.panelizeLy(G,Q,Y)}})},T=(Y,O)=>{H.getState().set(_=>{for(const G of _.elements)if(G.type===z.SolarPanel&&!G.locked&&Y.has(G.id)){const Q=G,oe=_.getPvModule(Q.pvModelName);G.ly=ye.panelizeLy(Q,oe,O)}})},R=Y=>{s(Y.target.value)},M=(Y,O)=>{const _=i(Y);if(_){if(_.type===z.Cuboid&&!ye.isIdentical(Y.normal,fs))return!0;const G=JSON.parse(JSON.stringify(Y));return G.ly=O,_.type===z.Wall?ye.checkElementOnWallState(G,_)===ya.Valid:_.type===z.Roof?ye.checkElementOnRoofState(G,_)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(G,_)}return!1},D=(Y,O)=>Y.tiltAngle!==0&&.5*O*Math.abs(Math.sin(Y.tiltAngle))>Y.poleHeight||!M(Y,O),k=Y=>{if(f){switch(l){case ie.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&H.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.ly-Y)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.ly-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.ly-Y)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.ly-Y)>Ht)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.ly-Y)>Ht)return!0}break}default:{if(Math.abs((f==null?void 0:f.ly)-Y)>Ht)return!0;break}}return!1}},N=Y=>{if(f&&k(Y))switch(C.current=void 0,l){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.ly);const _={name:"Set Width for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{T(_.oldValues,_.newValue)}};a(_),T(O,Y),u(c+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&O.set(G.id,G.ly);const _={name:"Set Width for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:Y,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{b(_.newValue)}};a(_),b(Y),u(c+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){x.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&D(O,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.ly);const _={name:"Set Width for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:Y,groupId:f.foundationId,undo:()=>{for(const[G,Q]of _.oldValues.entries())A(G,Q)},redo:()=>{_.groupId&&S(_.groupId,_.newValue)}};a(_),S(f.foundationId,Y),u(c+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(x.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&D(G,Y)){x.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&D(G,Y)){x.current=!0;break}if(x.current)C.current=Y,m(f.ly);else{const G=new Map,Q=O.type===z.Cuboid;if(Q)for(const $ of n)$.type===z.SolarPanel&&$.parentId===f.parentId&&ye.isIdentical($.normal,f.normal)&&G.set($.id,$.ly);else for(const $ of n)$.type===z.SolarPanel&&$.parentId===f.parentId&&G.set($.id,$.ly);const oe=Q?f.normal:void 0,ee={name:"Set Width for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:Y,groupId:f.parentId,normal:oe,undo:()=>{for(const[$,ae]of ee.oldValues.entries())A($,ae)},redo:()=>{ee.groupId&&v(ee.groupId,ee.normal,ee.newValue)}};a(ee),v(f.parentId,oe,Y),u(c+1)}}break}default:{const O=o(f.id),_=O?O.ly:f.ly;if(x.current=D(f,Y),x.current)C.current=Y,m(_);else{const G={name:"Set Solar Panel Array Width",timestamp:Date.now(),oldValue:_,newValue:Y,changedElementId:f.id,changedElementType:f.type,undo:()=>{A(G.changedElementId,G.oldValue)},redo:()=>{A(G.changedElementId,G.newValue)}};a(G),A(f.id,Y),u(c+1)}break}}},U=()=>{x.current=!1,t(!1)},W=()=>{U(),d()},F=()=>{N(p),x.current||(t(!1),u(0))},E=Y=>{let O=Y??1;return O=Math.max(1,Math.ceil((O-y/2)/y))*y,O},L=()=>{N(p)},j=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Width",P),rejectedMessage:j,onApply:L,onClose:U,onClickCancel:W,onClickOk:F,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:y,max:100*y,step:y,style:{width:120},precision:2,value:p,onChange:Y=>{Y!==null&&m(E(Y))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/y)+" "+B.t("solarPanelMenu.PanelsLong",P),h.jsx("br",{}),B.t("word.MaximumNumber",P),": 100 ",B.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:R,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},Qwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=H(T=>T.elements.find(R=>R.selected&&R.type===z.SolarPanel)),[d,f]=g.useState((u==null?void 0:u.inverterEfficiency)??.95),p=Kt(),m=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.id===T&&!D.locked){D.inverterEfficiency=R;break}})},y=(T,R)=>{e(M=>{for(const D of M.elements)D.type===z.SolarPanel&&D.foundationId===T&&!D.locked&&(D.inverterEfficiency=R)})},w=(T,R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&!k.locked){let N;R?N=k.parentId===T&&ye.isIdentical(k.normal,R):N=k.parentId===T,N&&(k.inverterEfficiency=M)}})},x=T=>{e(R=>{for(const M of R.elements)M.type===z.SolarPanel&&!M.locked&&(M.inverterEfficiency=T)})},C=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)D.type===z.SolarPanel&&!D.locked&&T.has(D.id)&&(D.inverterEfficiency=R)})},P=T=>{l(T.target.value)},A=T=>{switch(a){case ie.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&Math.abs((R.inverterEfficiency??.95)-T)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&ye.isIdentical(D.normal,u.normal)&&!D.locked&&Math.abs((D.inverterEfficiency??.95)-T)>Ht)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&!D.locked&&Math.abs((D.inverterEfficiency??.95)-T)>Ht)return!0}break}default:{if(Math.abs(((u==null?void 0:u.inverterEfficiency)??.95)-T)>Ht)return!0;break}}return!1},S=T=>{if(u&&A(T))switch(a){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.inverterEfficiency??.95);const M={name:"Set Inverter Efficiency for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{C(M.oldValues,M.newValue)}};i(M),C(R,T),c(s+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&R.set(D.id,D.inverterEfficiency??.95);const M={name:"Set Inverter Efficiency for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{x(M.newValue)}};i(M),x(T),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===u.foundationId&&R.set(D.id,D.inverterEfficiency??.95);const M={name:"Set Inverter Efficiency for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:u.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{M.groupId&&y(M.groupId,M.newValue)}};i(M),y(u.foundationId,T),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const M=new Map,D=R.type===z.Cuboid;if(D)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&M.set(U.id,U.inverterEfficiency??.95);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&M.set(U.id,U.inverterEfficiency??.95);const k=D?u.normal:void 0,N={name:"Set Inverter Efficiency for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:u.parentId,normal:k,undo:()=>{for(const[U,W]of N.oldValues.entries())m(U,W)},redo:()=>{N.groupId&&w(N.groupId,N.normal,N.newValue)}};i(N),w(u.parentId,k,T),c(s+1)}break}default:{const R=o(u.id),M=R?R.inverterEfficiency??.95:u.inverterEfficiency??.95,D={name:"Set Solar Panel Array Inverter Efficiency",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:u.id,changedElementType:u.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};i(D),m(u.id,T),c(s+1);break}}},v=()=>{t(!1)},b=()=>{S(d)};return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.InverterEfficiency",p),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.5,max:1,step:.01,style:{width:120},precision:2,value:d,onChange:T=>{T!==null&&f(T)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[0.5, 1.0]",h.jsx("br",{}),B.t("solarPanelMenu.InverterEfficiencyExplained",p)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},Zwo=({setDialogVisible:t})=>{const e=H(pn),n=H(Au),o=H(Qn),r=H(Jn),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=H(L=>L.elements.find(j=>j.selected&&j.type===z.SolarPanel)),[p,m]=g.useState(!1),[y,w]=g.useState(!1),[x,C]=g.useState({left:0,top:0,bottom:0,right:0}),P=g.useRef(null),A=g.useRef((f==null?void 0:f.dcToAcRatio)??1),S={lng:n};g.useEffect(()=>{f&&(A.current=f.dcToAcRatio??1)},[f.dcToAcRatio]);const v=(L,j)=>{e(Y=>{for(const O of Y.elements)if(O.type===z.SolarPanel&&O.id===L&&!O.locked){O.dcToAcRatio=j;break}})},b=(L,j)=>{e(Y=>{for(const O of Y.elements)O.type===z.SolarPanel&&O.foundationId===L&&!O.locked&&(O.dcToAcRatio=j)})},T=(L,j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarPanel&&!_.locked){let G;j?G=_.parentId===L&&ye.isIdentical(_.normal,j):G=_.parentId===L,G&&(_.dcToAcRatio=Y)}})},R=L=>{e(j=>{for(const Y of j.elements)Y.type===z.SolarPanel&&!Y.locked&&(Y.dcToAcRatio=L)})},M=(L,j)=>{H.getState().set(Y=>{for(const O of Y.elements)O.type===z.SolarPanel&&!O.locked&&L.has(O.id)&&(O.dcToAcRatio=j)})},D=L=>{s(L.target.value),m(!p)},k=L=>{switch(l){case ie.AllSelectedObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&Math.abs((j.dcToAcRatio??1)-L)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const j of o)if(j.type===z.SolarPanel&&j.foundationId===(f==null?void 0:f.foundationId)&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){if(j.type===z.Cuboid){for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&ye.isIdentical(O.normal,f.normal)&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Ht)return!0}else for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Ht)return!0}break}default:{if(Math.abs(((f==null?void 0:f.dcToAcRatio)??1)-L)>Ht)return!0;break}}return!1},N=L=>{if(f&&k(L)){switch(l){case ie.AllSelectedObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.dcToAcRatio??1);const Y={name:"Set DC-AC Ratio for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())v(O,_)},redo:()=>{M(Y.oldValues,Y.newValue)}};a(Y),M(j,L),u(c+1);break}case ie.AllObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&j.set(O.id,O.dcToAcRatio??1);const Y={name:"Set DC-AC Ratio for All Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())v(O,_)},redo:()=>{R(Y.newValue)}};a(Y),R(L),u(c+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const j=new Map;for(const O of o)O.type===z.SolarPanel&&O.foundationId===f.foundationId&&j.set(O.id,O.dcToAcRatio??1);const Y={name:"Set DC-AC Ratio for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:f.foundationId,undo:()=>{for(const[O,_]of Y.oldValues.entries())v(O,_)},redo:()=>{Y.groupId&&b(Y.groupId,Y.newValue)}};a(Y),b(f.foundationId,L),u(c+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){const Y=new Map,O=j.type===z.Cuboid;if(O)for(const Q of o)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&ye.isIdentical(Q.normal,f.normal)&&Y.set(Q.id,Q.dcToAcRatio??1);else for(const Q of o)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&Y.set(Q.id,Q.dcToAcRatio??1);const _=O?f.normal:void 0,G={name:"Set DC-AC Ratio for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:Y,newValue:L,groupId:f.parentId,normal:_,undo:()=>{for(const[Q,oe]of G.oldValues.entries())v(Q,oe)},redo:()=>{G.groupId&&T(G.groupId,G.normal,G.newValue)}};a(G),T(f.parentId,_,L),u(c+1)}break}default:{const j=r(f.id),Y=j?j.dcToAcRatio??1:f.dcToAcRatio??1,O={name:"Set Solar Panel Array DC-AC Ratio",timestamp:Date.now(),oldValue:Y,newValue:L,changedElementId:f.id,changedElementType:f.type,undo:()=>{v(O.changedElementId,O.oldValue)},redo:()=>{v(O.changedElementId,O.newValue)}};a(O),v(f.id,L),u(c+1);break}}m(!p)}},U=(L,j)=>{if(P.current){const{clientWidth:Y,clientHeight:O}=window.document.documentElement,_=P.current.getBoundingClientRect();C({left:-_.left+j.x,right:Y-(_.right-j.x),top:-_.top+j.y,bottom:O-((_==null?void 0:_.bottom)-j.y)})}},W=()=>{A.current=f.dcToAcRatio??1,t(!1)},F=()=>{W(),d()},E=()=>{N(A.current),t(!1),u(0)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:550,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),children:B.t("solarPanelMenu.DcToAcSizeRatio",S)}),footer:[h.jsx(oo,{onClick:()=>{N(A.current)},children:B.t("word.Apply",S)},"Apply"),h.jsx(oo,{onClick:F,children:B.t("word.Cancel",S)},"Cancel"),h.jsx(oo,{type:"primary",onClick:E,children:B.t("word.OK",S)},"OK")],onCancel:W,maskClosable:!1,destroyOnClose:!1,modalRender:L=>h.jsx(Vi,{disabled:!y,bounds:x,onStart:(j,Y)=>U(j,Y),children:h.jsx("div",{ref:P,children:L})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:2,step:.01,style:{width:120},precision:2,value:A.current,onChange:L=>{L!==null&&(A.current=L,m(!p))},onPressEnter:E}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[1.0, 2.0]",h.jsx("br",{}),B.t("solarPanelMenu.DcToAcSizeRatioExplained",S)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:D,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",S)})]})})})]})})})},HEe=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(NPt),i=H($r),a=H(Fn),l=H(Wh),s=H(Nh),c=H(no),u=H(qn),d=H(Ji),f=ao(z.SolarPanel),p=(f==null?void 0:f.tiltAngle)??0,m=(f==null?void 0:f.parentType)===z.Wall,[y,w]=g.useState(m?-p:p),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarPanel&&Y.foundationId===F&&!Y.locked){const O=Y;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-E:E):O.tiltAngle=E}})},S=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarPanel&&!Y.locked){let O;if(E?O=Y.parentId===F&&ye.isIdentical(Y.normal,E):O=Y.parentId===F,O){const _=Y;_.tiltAngle=L}}})},v=(F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked){const Y=j;Y.parentType===z.Wall?Y.tiltAngle=Math.min(0,E?-F:F):Y.tiltAngle=F}})},b=(F,E,L)=>{H.getState().set(j=>{for(const Y of j.elements)if(Y.type===z.SolarPanel&&!Y.locked&&F.has(Y.id)){const O=Y;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-E:E):O.tiltAngle=E}})},T=F=>{s(F.target.value)},R=F=>{if(f){switch(l){case ie.AllSelectedObjectsOfThisType:{for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(E.tiltAngle-F)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&Math.abs(E.tiltAngle-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===(f==null?void 0:f.foundationId)&&!E.locked&&Math.abs(E.tiltAngle-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const E=i(f);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&ye.isIdentical(j.normal,f.normal)&&!j.locked&&Math.abs(j.tiltAngle-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&!j.locked&&Math.abs(j.tiltAngle-F)>Ht)return!0}break}default:{if(Math.abs((f==null?void 0:f.tiltAngle)-F)>Ht)return!0;break}}return!1}},M=F=>{if(m&&(F=-F),!!f&&R(F)){switch(C.current=void 0,l){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(E.id)&&.5*E.ly*Math.abs(Math.sin(F))>E.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,Y)},redo:()=>{b(L.oldValues,L.newValue,!m)}};a(L),b(E,F,!m),u(c+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&.5*E.ly*Math.abs(Math.sin(F))>E.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&E.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,Y)},redo:()=>{v(L.newValue,!m)}};a(L),v(F,!m),u(c+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){x.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===f.foundationId&&E.parentType!==z.Wall&&.5*E.ly*Math.abs(Math.sin(F))>E.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===f.foundationId&&E.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:f.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,Y)},redo:()=>{L.groupId&&A(L.groupId,L.newValue,!m)}};a(L),A(f.foundationId,F,!m),u(c+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const E=i(f);if(E){x.current=!1;const L=E.type===z.Cuboid;if(L){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&ye.isIdentical(j.normal,f.normal)&&.5*j.ly*Math.abs(Math.sin(F))>j.poleHeight){x.current=!0;break}}else if(f.parentType===z.Wall)x.current=!1;else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&.5*j.ly*Math.abs(Math.sin(F))>j.poleHeight){x.current=!0;break}if(x.current)C.current=F,w(f.tiltAngle);else{const j=new Map;if(L)for(const _ of n)_.type===z.SolarPanel&&_.parentId===f.parentId&&ye.isIdentical(_.normal,f.normal)&&j.set(_.id,_.tiltAngle);else for(const _ of n)_.type===z.SolarPanel&&_.parentId===f.parentId&&j.set(_.id,_.tiltAngle);const Y=L?f.normal:void 0,O={name:"Set Tilt Angle for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:f.parentId,normal:Y,undo:()=>{for(const[_,G]of O.oldValues.entries())r(_,G)},redo:()=>{O.groupId&&S(O.groupId,O.normal,O.newValue)}};a(O),S(f.parentId,Y,F),u(c+1)}}break}default:{const E=o(f.id),L=E?E.tiltAngle:f.tiltAngle;if(x.current=.5*f.ly*Math.abs(Math.sin(F))>f.poleHeight,f.parentType===z.Wall&&(x.current=!1),x.current)C.current=F,w(L);else{const j={name:"Set Solar Panel Array Tilt Angle",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(j.changedElementId,j.oldValue)},redo:()=>{r(j.changedElementId,j.newValue)}};a(j),r(f.id,F),u(c+1)}break}}e(E=>{E.actionState.solarPanelTiltAngle=F})}},D=()=>{x.current=!1,t(!1)},k=()=>{D(),d()},N=()=>{M(y),x.current||(t(!1),u(0))},U=()=>{M(y)},W=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+ye.toDegrees(C.current).toFixed(1)+"°)":null):null;return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.TiltAngle",P),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:m?0:-90,max:90,style:{width:120},precision:2,value:parseFloat(ye.toDegrees(y).toFixed(2)),step:1,formatter:F=>`${F}°`,onChange:F=>{F!==null&&w(ye.toRadians(F))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [",m?"0°":"-90°",", 90°]",h.jsx("br",{}),B.t("solarPanelMenu.SouthFacingIsPositive",P)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(We.Group,{onChange:T,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},e8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(yQ),i=H(AXe),a=H(wXe),l=H(xXe),s=H($r),c=H(Fn),u=H(Wh),d=H(Nh),f=H(no),p=H(qn),m=H(Ji),y=ao(z.SolarPanel),w=g.useRef(!1),x=g.useRef(),[C,P]=g.useState(y?-y.relativeAzimuth:0),A=Kt(),S=F=>{d(F.target.value)},v=(F,E)=>{const L=s(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.relativeAzimuth=-E,L.type===z.Roof?ye.checkElementOnRoofState(j,L)===ya.Valid:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(F,E)=>!v(F,E),T=F=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&E.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const E of n)if(E.type===z.SolarPanel&&!E.locked&&E.parentType!==z.Wall&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===(y==null?void 0:y.foundationId)&&!E.locked&&E.parentType!==z.Wall&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:if(y!=null&&y.parentId){const E=s(y);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}}break;default:if(Math.abs(-(y==null?void 0:y.relativeAzimuth)-F)>Ht)return!0}return!1}},R=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked&&F.has(j.id)){const Y=j;Y.relativeAzimuth=E}})},M=F=>{if(y&&T(F)){switch(x.current=void 0,u){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(E.id)&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(E,-F),p(f+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.parentType!==z.Wall&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{l(z.SolarPanel,-L.newValue)}};c(L),l(z.SolarPanel,-F),p(f+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(y.foundationId){w.current=!1;for(const E of n)if(E.type===z.SolarPanel&&E.foundationId===y.foundationId&&E.parentType!==z.Wall&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===y.foundationId&&j.parentType!==z.Wall&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:y.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{L.groupId&&a(z.SolarPanel,L.groupId,-L.newValue)}};c(L),a(z.SolarPanel,y.foundationId,-F),p(f+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{if(y.parentId){const E=s(y);if(E){if(w.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&b(j,F)){w.current=!0;break}}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===y.parentId&&b(j,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarPanel&&G.parentId===y.parentId&&ye.isIdentical(G.normal,y.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarPanel&&G.parentId===y.parentId&&j.set(G.id,-G.relativeAzimuth);const O=Y?y.normal:void 0,_={name:"Set Relative Azimuth for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:y.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())r(G,-Q)},redo:()=>{_.groupId&&i(z.SolarPanel,_.groupId,_.normal,-_.newValue)}};c(_),i(z.SolarPanel,y.parentId,O,-F),p(f+1)}}}break}default:{const E=o(y.id),L=E?-E.relativeAzimuth:-y.relativeAzimuth;if(w.current=b(y,F),w.current)x.current=F,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:y.id,changedElementType:y.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(y.id,-F),p(f+1)}break}}e(E=>{E.actionState.solarPanelRelativeAzimuth=-F})}},D=()=>{w.current=!1,t(!1)},k=()=>{D(),m()},N=()=>{M(C),w.current||(t(!1),p(0))},U=()=>{M(C)},W=w.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(x.current!==void 0?" ("+ye.toDegrees(x.current).toFixed(1)+"°)":null):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeAzimuth",A),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(C).toFixed(2)),formatter:F=>`${F}°`,onChange:F=>{F!==null&&P(ye.toRadians(F))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",A),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",A)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(We.Group,{onChange:S,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",A)})]})})})]})})},t8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=ao(),[d,f]=g.useState((u==null?void 0:u.trackerType)??Bl.NO_TRACKER),p=Kt(),{Option:m}=Ko,y=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&k.id===R&&!k.locked){k.trackerType=M;break}})},w=(R,M)=>{e(D=>{for(const k of D.elements)k.type===z.SolarPanel&&k.foundationId===R&&!k.locked&&(k.trackerType=M)})},x=(R,M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.SolarPanel&&!N.locked){let U;M?U=N.parentId===R&&ye.isIdentical(N.normal,M):U=N.parentId===R,U&&(N.trackerType=D)}})},C=R=>{e(M=>{for(const D of M.elements)D.type===z.SolarPanel&&!D.locked&&(D.trackerType=R)})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)k.type===z.SolarPanel&&!k.locked&&R.has(k.id)&&(k.trackerType=M)})},A=R=>{l(R.target.value)},S=R=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const M of n)if(M.type===z.SolarPanel&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&M.trackerType!==R)return!0;break}case ie.AllObjectsOfThisType:{for(const M of n)if(M.type===z.SolarPanel&&!M.locked&&M.trackerType!==R)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const M of n)if(M.type===z.SolarPanel&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&M.trackerType!==R)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const M=r(u);if(M){if(M.type===z.Cuboid){for(const k of n)if(k.type===z.SolarPanel&&k.parentId===u.parentId&&ye.isIdentical(k.normal,u.normal)&&!k.locked&&k.trackerType!==R)return!0}else for(const k of n)if(k.type===z.SolarPanel&&k.parentId===u.parentId&&!k.locked&&k.trackerType!==R)return!0}break}default:{if((u==null?void 0:u.trackerType)!==R)return!0;break}}return!1}},v=R=>{if(u&&S(R))switch(a){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.trackerType);const D={name:"Set Tracker Type for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};i(D),P(M,R),c(s+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.SolarPanel&&M.set(k.id,k.trackerType);const D={name:"Set Tracker Type for All Solar Panel Arrays",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{C(D.newValue)}};i(D),C(R),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.SolarPanel&&k.foundationId===u.foundationId&&M.set(k.id,k.trackerType);const D={name:"Set Tracker Type for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())y(k,N)},redo:()=>{D.groupId&&w(D.groupId,D.newValue)}};i(D),w(u.foundationId,R),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const M=r(u);if(M){const D=new Map,k=M.type===z.Cuboid;if(k)for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&ye.isIdentical(W.normal,u.normal)&&D.set(W.id,W.trackerType);else for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&D.set(W.id,W.trackerType);const N=k?u.normal:void 0,U={name:"Set Tracker Type for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:D,newValue:R,groupId:u.parentId,normal:N,undo:()=>{for(const[W,F]of U.oldValues.entries())y(W,F)},redo:()=>{U.groupId&&x(U.groupId,U.normal,U.newValue)}};i(U),x(u.parentId,N,R),c(s+1)}break}default:{const M=o(u.id),D=M?M.trackerType:u.trackerType,k={name:"Set Solar Panel Array Tracker Type",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(k.changedElementId,k.oldValue)},redo:()=>{y(k.changedElementId,k.newValue)}};i(k),y(u.id,R),c(s+1);break}}},b=()=>{t(!1)},T=()=>{v(d)};return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.Tracker",p),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsxs(Ko,{style:{width:"120px"},value:d,onChange:R=>f(R),children:[h.jsx(m,{value:Bl.NO_TRACKER,title:B.t("solarPanelMenu.NoTracker",p),children:B.t("word.None",p)},"NONE"),h.jsx(m,{value:Bl.HORIZONTAL_SINGLE_AXIS_TRACKER,title:B.t("solarPanelMenu.HorizontalSingleAxisTracker",p),children:"HSAT"},"HSAT"),h.jsx(m,{value:Bl.VERTICAL_SINGLE_AXIS_TRACKER,title:B.t("solarPanelMenu.VerticalSingleAxisTracker",p),children:"VSAT"},"VSAT"),h.jsx(m,{value:Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER,title:B.t("solarPanelMenu.AltazimuthDualAxisTracker",p),children:"AADAT"},"AADAT")]}),h.jsx("div",{style:{paddingTop:"20px",paddingRight:"10px",textAlign:"left",fontSize:"11px"},children:B.t("solarPanelMenu.SolarTrackerFollowsSun",p)})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},n8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=ao(z.SolarPanel),[d,f]=g.useState((u==null?void 0:u.frameColor)??"white"),p=Kt(),m=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.id===T&&!D.locked){D.frameColor=R;break}})},y=(T,R)=>{e(M=>{for(const D of M.elements)D.type===z.SolarPanel&&D.foundationId===T&&!D.locked&&(D.frameColor=R)})},w=(T,R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&!k.locked){let N;R?N=k.parentId===T&&ye.isIdentical(k.normal,R):N=k.parentId===T,N&&(k.frameColor=M)}})},x=T=>{e(R=>{for(const M of R.elements)M.type===z.SolarPanel&&!M.locked&&(M.frameColor=T)})},C=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)D.type===z.SolarPanel&&!D.locked&&T.has(D.id)&&(D.frameColor=R)})},P=T=>{l(T.target.value)},A=T=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&R.frameColor!==T)return!0;break}case ie.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&R.frameColor!==T)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&R.frameColor!==T)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&ye.isIdentical(D.normal,u.normal)&&!D.locked&&D.frameColor!==T)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&!D.locked&&D.frameColor!==T)return!0}break}default:{if((u==null?void 0:u.frameColor)!==T)return!0;break}}return!1}},S=T=>{if(u&&A(T)){switch(a){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.frameColor??"white");const M={name:"Set Frame Color for Selected Solar Panels",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{C(M.oldValues,M.newValue)}};i(M),C(R,T),c(s+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&R.set(D.id,D.frameColor??"white");const M={name:"Set Frame Color for All Solar Panels",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{x(M.newValue)}};i(M),x(T),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===u.foundationId&&R.set(D.id,D.frameColor??"white");const M={name:"Set Frame Color for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:u.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{M.groupId&&y(M.groupId,M.newValue)}};i(M),y(u.foundationId,T),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const M=new Map,D=R.type===z.Cuboid;if(D)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&M.set(U.id,U.frameColor??"white");else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&M.set(U.id,U.frameColor??"white");const k=D?u.normal:void 0,N={name:"Set Frame Color for All Solar Panels on Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:u.parentId,normal:k,undo:()=>{for(const[U,W]of N.oldValues.entries())m(U,W)},redo:()=>{N.groupId&&w(N.groupId,N.normal,N.newValue)}};i(N),w(u.parentId,k,T),c(s+1)}break}default:{const R=o(u.id),M=R?R.frameColor:u.frameColor,D={name:"Set Frame Color of Selected Solar Panel",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:u.id,changedElementType:u.type,undo:()=>{m(u.id,D.oldValue)},redo:()=>{m(u.id,D.newValue)}};i(D),m(u.id,T),c(s+1);break}}e(R=>{R.actionState.solarPanelFrameColor=T})}},v=()=>{t(!1)},b=()=>{S(d)};return h.jsx(ro,{width:680,title:B.t("solarPanelMenu.FrameColor",p),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsx(sd,{color:d??(u==null?void 0:u.color)??"white",onChangeComplete:T=>{f(T.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},o8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(VPt),a=H(KN),l=H($N),s=H($r),c=H(Fn),u=H(Wh),d=H(Nh),f=H(no),p=H(qn),m=H(Ji),y=ao(z.SolarPanel),[w,x]=g.useState((y==null?void 0:y.poleHeight)??0),C=g.useRef(!1),P=g.useRef(),A=Kt(),S=U=>{d(U.target.value)},v=U=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(y==null?void 0:y.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const W=s(y);if(W){if(W.type===z.Cuboid){for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&ye.isIdentical(E.normal,y.normal)&&!E.locked&&Math.abs(E.poleHeight-U)>Ht)return!0}else for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&!E.locked&&Math.abs(E.poleHeight-U)>Ht)return!0}break}default:{if(Math.abs((y==null?void 0:y.poleHeight)-U)>Ht)return!0;break}}return!1}},b=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked&&U.has(E.id)){const L=E;L.poleHeight=W}})},T=U=>{if(y&&v(U)){switch(P.current=void 0,u){case ie.AllSelectedObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const W=new Map;for(const E of n)E.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(E.id)&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{b(F.oldValues,F.newValue)}};c(F),b(W,U),p(f+1)}break}case ie.AllObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const W=new Map;for(const E of n)E.type===z.SolarPanel&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{l(z.SolarPanel,F.newValue)}};c(F),l(z.SolarPanel,U),p(f+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(y.foundationId){C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===y.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const W=new Map;for(const E of n)E.type===z.SolarPanel&&E.foundationId===y.foundationId&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:y.foundationId,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{F.groupId&&a(z.SolarPanel,F.groupId,F.newValue)}};c(F),a(z.SolarPanel,y.foundationId,U),p(f+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const W=s(y);if(W){if(C.current=!1,W.type===z.Cuboid){for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&ye.isIdentical(E.normal,y.normal)&&.5*E.ly*Math.abs(Math.sin(E.tiltAngle))>U){C.current=!0;break}}else for(const E of n)if(E.type===z.SolarPanel&&E.parentId===y.parentId&&.5*E.ly*Math.abs(Math.sin(E.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,x(y.poleHeight);else{const E=new Map,L=W.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===y.parentId&&ye.isIdentical(O.normal,y.normal)&&E.set(O.id,O.poleHeight);else for(const O of n)O.type===z.SolarPanel&&O.parentId===y.parentId&&E.set(O.id,O.poleHeight);const j=L?y.normal:void 0,Y={name:"Set Pole Height for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:E,newValue:U,groupId:y.parentId,normal:j,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_)},redo:()=>{Y.groupId&&i(z.SolarPanel,Y.groupId,Y.normal,Y.newValue)}};c(Y),i(z.SolarPanel,y.parentId,j,U),p(f+1)}}break}default:{const W=o(y.id),F=W?W.poleHeight:y.poleHeight;if(C.current=.5*y.ly*Math.abs(Math.sin(y.tiltAngle))>U,C.current)P.current=U,x(F);else{const E={name:"Set Solar Panel Array Pole Height",timestamp:Date.now(),oldValue:F,newValue:U,changedElementId:y.id,changedElementType:y.type,undo:()=>{r(E.changedElementId,E.oldValue)},redo:()=>{r(E.changedElementId,E.newValue)}};c(E),r(y.id,U),p(f+1)}break}}e(W=>{W.actionState.solarPanelPoleHeight=U})}},R=()=>{C.current=!1,t(!1)},M=()=>{R(),m()},D=()=>{T(w),C.current||(t(!1),p(0))},k=()=>{T(w)},N=C.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(P.current!==void 0?" ("+P.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.PoleHeight",A),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:10,style:{width:120},step:.1,precision:2,value:w,onChange:U=>{U!==null&&x(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [0, 10] ",B.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",A)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",A)})]})})})]})})},r8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=ao(z.SolarPanel),[d,f]=g.useState((u==null?void 0:u.poleSpacing)??0),p=Kt(),m=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.id===T&&!D.locked){const k=D;k.poleSpacing=R;break}})},y=(T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&D.foundationId===T&&!D.locked){const k=D;k.poleSpacing=R}})},w=(T,R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.SolarPanel&&!k.locked){let N;if(R?N=k.parentId===T&&ye.isIdentical(k.normal,R):N=k.parentId===T,N){const U=k;U.poleSpacing=M}}})},x=T=>{e(R=>{for(const M of R.elements)if(M.type===z.SolarPanel&&!M.locked){const D=M;D.poleSpacing=T}})},C=(T,R)=>{H.getState().set(M=>{for(const D of M.elements)if(D.type===z.SolarPanel&&!D.locked&&T.has(D.id)){const k=D;k.poleSpacing=R}})},P=T=>{l(T.target.value)},A=T=>{if(u){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&Math.abs(R.poleSpacing-T)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs(R.poleSpacing-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs(R.poleSpacing-T)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&ye.isIdentical(D.normal,u.normal)&&!D.locked&&Math.abs(D.poleSpacing-T)>Ht)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===u.parentId&&!D.locked&&Math.abs(D.poleSpacing-T)>Ht)return!0}break}default:{if(Math.abs((u==null?void 0:u.poleSpacing)-T)>Ht)return!0;break}}return!1}},S=T=>{if(u&&A(T)){switch(a){case ie.AllSelectedObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(D.id)&&R.set(D.id,D.poleSpacing);const M={name:"Set Pole Spacing for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{C(M.oldValues,M.newValue)}};i(M),C(R,T),c(s+1);break}case ie.AllObjectsOfThisType:{const R=new Map;for(const D of n)D.type===z.SolarPanel&&R.set(D.id,D.poleSpacing);const M={name:"Set Pole Spacing for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:T,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{x(M.newValue)}};i(M),x(T),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===u.foundationId&&R.set(D.id,D.poleSpacing);const M={name:"Set Pole Spacing for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:T,groupId:u.foundationId,undo:()=>{for(const[D,k]of M.oldValues.entries())m(D,k)},redo:()=>{M.groupId&&y(M.groupId,M.newValue)}};i(M),y(u.foundationId,T),c(s+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const M=new Map,D=R.type===z.Cuboid;if(D)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&M.set(U.id,U.poleSpacing);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&M.set(U.id,U.poleSpacing);const k=D?u.normal:void 0,N={name:"Set Pole Spacing for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:M,newValue:T,groupId:u.parentId,normal:k,undo:()=>{for(const[U,W]of N.oldValues.entries())m(U,W)},redo:()=>{N.groupId&&w(N.groupId,N.normal,N.newValue)}};i(N),w(u.parentId,k,T),c(s+1)}break}default:{const R=o(u.id),M=R?R.poleSpacing:u.poleSpacing,D={name:"Set Solar Panel Array Pole Spacing",timestamp:Date.now(),oldValue:M,newValue:T,changedElementId:u.id,changedElementType:u.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};i(D),m(u.id,T),c(s+1);break}}e(R=>{R.actionState.solarPanelPoleSpacing=T})}},v=()=>{t(!1)},b=()=>{S(d),t(!1),c(0)};return h.jsx(ro,{width:550,title:B.t("solarPanelMenu.PoleSpacing",p),onApply:b,onClose:v,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:1,style:{width:120},precision:2,value:d,onChange:T=>{T!==null&&f(T)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [1, 10] ",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},i8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Jn),i=H(UPt),a=H(jPt),l=H(BPt),s=H(Fn),c=H(Wh),u=H(Nh),d=H(no),f=H(qn),p=H(Ji),m=ao(z.SolarPanel),[y,w]=g.useState((m==null?void 0:m.cx)??0),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=U=>{u(U.target.value)},S=U=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cx-U)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cx-U)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(m==null?void 0:m.foundationId)&&!W.locked&&Math.abs(W.cx-U)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.cx)-U)>Ht)return!0}return!1}},v=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked&&U.has(E.id)){const L=E;L.cx=W}})},b=(U,W,F)=>U+.5*W/F<.5&&U-.5*W/F>-.5,T=U=>{if(!m||!S(U))return;C.current=void 0;const W=o(m);if(W){switch(c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(F.id)&&!b(U,m.lx,W.lx)){x.current=!0;break}if(x.current)C.current=U,w(m.cx);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.cx);const E={name:"Set Center X for Selected Solar Panel",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{v(E.oldValues,E.newValue)}};s(E),v(F,U),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&!b(U,m.lx,W.lx)){x.current=!0;break}if(x.current)C.current=U,w(m.cx);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&F.set(L.id,L.cx);const E={name:"Set Center X for All Solar Panels",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,E.newValue)}};s(E),l(z.SolarPanel,U),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&F.foundationId===m.foundationId&&!b(U,m.lx,W.lx)){x.current=!0;break}if(x.current)C.current=U,w(m.cx);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===m.foundationId&&F.set(L.id,L.cx);const E={name:"Set Center X for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:F,newValue:U,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{E.groupId&&a(z.SolarPanel,E.groupId,E.newValue)}};s(E),a(z.SolarPanel,m.foundationId,U),f(d+1)}}break}default:{const F=r(m.id),E=F?F.cx:m.cx;if(x.current=!b(U,m.lx,W.lx),x.current)C.current=U,w(E);else{const L={name:"Set Solar Panel Center X",timestamp:Date.now(),oldValue:E,newValue:U,changedElementId:m.id,changedElementType:m.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(m.id,U),f(d+1)}break}}e(F=>{F.actionState.solarPanelCx=U})}},R=()=>{x.current=!1,t(!1)},M=()=>{R(),p()},D=()=>{T(y),x.current||(t(!1),f(0))},k=()=>{T(y)},N=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeXCoordinateOfCenter",P),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:y,onChange:U=>{U!==null&&w(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},a8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Jn),i=H(YPt),a=H(OPt),l=H(_Pt),s=H(Fn),c=H(Wh),u=H(Nh),d=H(no),f=H(qn),p=H(Ji),m=ao(z.SolarPanel),[y,w]=g.useState((m==null?void 0:m.cy)??0),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=U=>{u(U.target.value)},S=U=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cy-U)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cy-U)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(m==null?void 0:m.foundationId)&&!W.locked&&Math.abs(W.cy-U)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.cy)-U)>Ht)return!0}return!1}},v=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked&&U.has(E.id)){const L=E;L.cy=W}})},b=(U,W,F)=>U+.5*W/F<.5&&U-.5*W/F>-.5,T=U=>{if(!m||!S(U))return;C.current=void 0;const W=o(m);if(W){switch(c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(F.id)&&!b(U,m.ly,W.ly)){x.current=!0;break}if(x.current)C.current=U,w(m.cy);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.cy);const E={name:"Set Center Y for Selected Solar Panel",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{v(E.oldValues,E.newValue)}};s(E),v(F,U),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&!b(U,m.ly,W.ly)){x.current=!0;break}if(x.current)C.current=U,w(m.cy);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&F.set(L.id,L.cy);const E={name:"Set Center Y for All Solar Panels",timestamp:Date.now(),oldValues:F,newValue:U,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,E.newValue)}};s(E),l(z.SolarPanel,U),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.SolarPanel&&F.foundationId===m.foundationId&&!b(U,m.ly,W.ly)){x.current=!0;break}if(x.current)C.current=U,w(m.cy);else{const F=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===m.foundationId&&F.set(L.id,L.cy);const E={name:"Set Center Y for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:F,newValue:U,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())i(L,j)},redo:()=>{E.groupId&&a(z.SolarPanel,E.groupId,E.newValue)}};s(E),a(z.SolarPanel,m.foundationId,U),f(d+1)}}break}default:{const F=r(m.id),E=F?F.cy:m.cy;if(x.current=!b(U,m.ly,W.ly),x.current)C.current=U,w(E);else{const L={name:"Set Solar Panel Center Y",timestamp:Date.now(),oldValue:E,newValue:U,changedElementId:m.id,changedElementType:m.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(m.id,U),f(d+1)}break}}e(F=>{F.actionState.solarPanelCy=U})}},R=()=>{x.current=!1,t(!1)},M=()=>{R(),p()},D=()=>{T(y),x.current||(t(!1),f(0))},k=()=>{T(y)},N=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeYCoordinateOfCenter",P),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:y,onChange:U=>{U!==null&&w(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},l8o=t=>{const e=[];if(t.type!==z.SolarPanel)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=t.type===z.SolarPanel&&ye.isIdentical(n.normal,fs);return e.push({key:"solar-panel-copy",label:h.jsx(ad,{})}),o&&e.push({key:"solar-panel-cut",label:h.jsx(ld,{})}),e.push({key:"solar-panel-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"solar-panel-model-change",label:h.jsxs(Zn,{Dialog:Jwo,children:[B.t("solarPanelMenu.ChangePvModel",r)," (",n.pvModelName,") ..."]})},{key:"solar-panel-orientation",label:h.jsxs(Zn,{Dialog:Kwo,children:[B.t("solarPanelMenu.Orientation",r)," ..."]})},{key:"solar-panel-length",label:h.jsxs(Zn,{Dialog:$wo,children:[B.t("word.Length",r)," ..."]})},{key:"solar-panel-width",label:h.jsxs(Zn,{Dialog:qwo,children:[B.t("word.Width",r)," ..."]})}),e.push({key:"solar-panel-coordinates-submenu",label:h.jsx(ln,{children:B.t("solarCollectorMenu.Coordinates",r)}),children:[{key:"solar-panel-center-x",label:h.jsxs(Zn,{Dialog:i8o,children:[B.t("solarCollectorMenu.RelativeXCoordinateOfCenter",r)," ..."]})},{key:"solar-panel-center-y",label:h.jsxs(Zn,{Dialog:a8o,children:[B.t("solarCollectorMenu.RelativeYCoordinateOfCenter",r)," ..."]})}]}),n.parentType===z.Wall&&e.push({key:"solar-panel-tilt-angle-on-wall",label:h.jsxs(Zn,{Dialog:HEe,children:[B.t("solarPanelMenu.TiltAngle",r)," ..."]})}),i&&(n.trackerType===Bl.NO_TRACKER&&e.push({key:"solar-panel-tilt-angle",label:h.jsxs(Zn,{Dialog:HEe,children:[B.t("solarPanelMenu.TiltAngle",r)," ..."]})}),e.push({key:"solar-panel-relative-azimuth",label:h.jsxs(Zn,{Dialog:e8o,children:[B.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),n.parentType!==z.Roof&&e.push({key:"solar-panel-tracker",label:h.jsxs(Zn,{Dialog:t8o,children:[B.t("solarPanelMenu.Tracker",r)," ..."]})})),e.push({key:"solar-panel-frame-color",label:h.jsxs(Zn,{Dialog:n8o,children:[B.t("solarPanelMenu.FrameColor",r)," ..."]})}),e.push({key:"solar-panel-draw-sun-beam",label:h.jsx(n6e,{solarCollector:n})}),e.push({key:"solar-panel-electrical-submenu",label:h.jsx(ln,{children:B.t("solarPanelMenu.ElectricalProperties",r)}),children:[{key:"solar-panel-inverter-efficiency",label:h.jsxs(Zn,{Dialog:Qwo,children:[B.t("solarPanelMenu.InverterEfficiency",r)," ..."]})},{key:"solar-panel-dc-ac-ratio",label:h.jsxs(Zn,{Dialog:Zwo,children:[B.t("solarPanelMenu.DcToAcSizeRatio",r)," ..."]})}]}),e.push({key:"solar-panel-pole-submenu",label:h.jsx(ln,{children:B.t("solarCollectorMenu.Pole",r)}),children:[{key:"solar-panel-pole-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:o8o,children:[B.t("solarCollectorMenu.PoleHeight",r)," ..."]})},{key:"solar-panel-pole-spacing",label:h.jsxs(Zn,{noPadding:!0,Dialog:r8o,children:[B.t("solarPanelMenu.PoleSpacing",r)," ..."]})}]}),e.push({key:"solar-panel-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)})),{items:e}},s8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(H7),r=H(gQ),i=H(ON),a=H($r),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=H(Ji),p=ao(z.ParabolicTrough),[m,y]=g.useState((p==null?void 0:p.ly)??9),w=g.useRef(!1),x=g.useRef(),C=Kt(),P=W=>{c(W.target.value)},A=(W,F)=>{const E=a(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.ly=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},S=(W,F)=>!A(W,F),v=W=>{if(p){switch(s){case ie.AllSelectedObjectsOfThisType:for(const F of e)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of e)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of e)if(F.type===z.ParabolicTrough&&F.foundationId===(p==null?void 0:p.foundationId)&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Ht)return!0}return!1}},b=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.ly=F)})},T=W=>{if(p&&v(W))switch(x.current=void 0,s){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.ly);const E={name:"Set Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{b(E.oldValues,E.newValue)}};l(E),b(F,W),d(u+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.ParabolicTrough&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.ParabolicTrough&&F.set(L.id,L.ly);const E={name:"Set Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{i(z.ParabolicTrough,E.newValue)}};l(E),i(z.ParabolicTrough,W),d(u+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){w.current=!1;for(const F of e)if(F.type===z.ParabolicTrough&&F.foundationId===p.foundationId&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.ParabolicTrough&&L.foundationId===p.foundationId&&F.set(L.id,L.ly);const E={name:"Set Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{E.groupId&&r(z.ParabolicTrough,E.groupId,E.newValue)}};l(E),r(z.ParabolicTrough,p.foundationId,W),d(u+1)}}break}default:{const F=n(p.id),E=F?F.ly:p.ly;if(w.current=S(p,W),w.current)x.current=W,y(E);else{const L={name:"Set Parabolic Trough Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{w.current=!1,t(!1)},M=()=>{R(),f()},D=()=>{T(m),w.current||(t(!1),d(0))},k=W=>{if(!p)return 1;let F=W??1;return F=Math.max(1,Math.ceil((F-p.moduleLength/2)/p.moduleLength))*p.moduleLength,F},N=()=>{T(m)};if((p==null?void 0:p.type)!==z.ParabolicTrough)return null;const U=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current!==void 0?" ("+x.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:p.moduleLength,max:100*p.moduleLength,step:p.moduleLength,precision:2,style:{width:120},value:m,onChange:W=>{y(k(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("parabolicTroughMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+B.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(m/p.moduleLength)+" "+B.t("parabolicTroughMenu.ModulesLong",C),h.jsx("br",{}),B.t("word.Maximum",C),": 100 ",B.t("parabolicTroughMenu.Modules",C)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",C)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",C)})]})})})]})})},c8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(pQ),a=H(YN),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.lx)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.lx=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.lx)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.lx=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.lx);const E={name:"Set Width for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&F.set(L.id,L.lx);const E={name:"Set Width for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,E.newValue)}};s(E),a(z.ParabolicTrough,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===m.foundationId&&F.set(L.id,L.lx);const E={name:"Set Width for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicTrough,E.groupId,E.newValue)}};s(E),i(z.ParabolicTrough,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.lx:m.lx;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Trough Width",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicTroughWidth=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},u8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(UXe),i=H(jXe),a=H(BXe),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.moduleLength)??3),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.moduleLength)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.moduleLength=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,E.newValue)}};s(E),a(z.ParabolicTrough,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===m.foundationId&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicTrough,E.groupId,E.newValue)}};s(E),i(z.ParabolicTrough,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.moduleLength:m.moduleLength;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Trough Module Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicTroughModuleLength=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},d8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(LXe),i=H(WXe),a=H(NXe),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.latusRectum)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicTrough&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.latusRectum)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.latusRectum=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Troughs",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,E.newValue)}};s(E),a(z.ParabolicTrough,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===m.foundationId&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicTrough,E.groupId,E.newValue)}};s(E),i(z.ParabolicTrough,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.latusRectum:m.latusRectum;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Trough Latus Rectum",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicTroughLatusRectum=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},f8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(g4),u=H(m4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicTrough),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=N=>{u(N.target.value)},S=N=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===(m==null?void 0:m.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const W of n)if(W.type===z.ParabolicTrough&&W.parentId===m.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-N)>Ht)return!0;break}}return!1}},v=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)F.type===z.ParabolicTrough&&!F.locked&&N.has(F.id)&&(F.tiltAngle=U)})},b=N=>{if(m&&S(N)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{v(W.oldValues,W.newValue)}};s(W),v(U,N),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicTrough&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{a(z.ParabolicTrough,W.newValue)}};s(W),a(z.ParabolicTrough,N),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===m.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicTrough&&F.foundationId===m.foundationId&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:m.foundationId,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{W.groupId&&i(z.ParabolicTrough,W.groupId,W.newValue)}};s(W),i(z.ParabolicTrough,m.foundationId,N),f(d+1)}}break}default:{const U=o(m.id),W=U?U.poleHeight:m.poleHeight;if(x.current=.5*m.lx*Math.abs(Math.sin(m.tiltAngle))>N,x.current)C.current=N,w(W);else{const F={name:"Set Parabolic Trough Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(m.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicTroughPoleHeight=N})}},T=()=>{x.current=!1,t(!1)},R=()=>{T(),p()},M=()=>{b(y),x.current||(t(!1),f(0))},D=()=>{b(y)};if((m==null?void 0:m.type)!==z.ParabolicTrough)return null;const k=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:k,onApply:D,onClose:T,onClickCancel:R,onClickOk:M,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:N=>{N!==null&&w(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [0, 5] ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},h8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Parabolic Trough Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},p8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(TXe),i=H(PXe),a=H(CXe),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.absorptance)??.95),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.absorptance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.absorptance:f.absorptance,R={name:"Set Parabolic Trough Absorptance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughAbsorptance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},g8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(RXe),i=H(HXe),a=H(MXe),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.opticalEfficiency)??.7),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.opticalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Trough Optical Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughOpticalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},m8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(IXe),i=H(zXe),a=H(DXe),l=H(Fn),s=H(g4),c=H(m4),u=H(no),d=H(qn),f=ao(z.ParabolicTrough),[p,m]=g.useState((f==null?void 0:f.thermalEfficiency)??.3),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicTrough&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicTrough&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicTrough&&!R.locked&&v.has(R.id)&&(R.thermalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicTrough,T.newValue)}};l(T),a(z.ParabolicTrough,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicTrough,T.groupId,T.newValue)}};l(T),i(z.ParabolicTrough,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Trough Thermal Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicTroughThermalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicTroughMenu.OnlyThisParabolicTrough",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicTroughMenu.AllSelectedParabolicTroughs",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicTroughMenu.AllParabolicTroughs",y)})]})})})]})})},y8o=t=>{const e=[];if(t.type!==z.ParabolicTrough)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"parabolic-trough-copy",label:h.jsx(ad,{})}),r&&e.push({key:"parabolic-trough-cut",label:h.jsx(ld,{})}),e.push({key:"parabolic-trough-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"parabolic-trough-length",label:h.jsxs(Zn,{Dialog:s8o,children:[B.t("word.Length",o)," ..."]})},{key:"parabolic-trough-width",label:h.jsxs(Zn,{Dialog:c8o,children:[B.t("word.Width",o)," ..."]})},{key:"parabolic-trough-module-length",label:h.jsxs(Zn,{Dialog:u8o,children:[B.t("parabolicTroughMenu.ModuleLength",o)," ..."]})},{key:"parabolic-trough-latus-rectum",label:h.jsxs(Zn,{Dialog:d8o,children:[B.t("parabolicTroughMenu.LatusRectum",o)," ..."]})},{key:"parabolic-trough-pole-height",label:h.jsxs(Zn,{Dialog:f8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-trough-reflectance",label:h.jsxs(Zn,{Dialog:h8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-trough-absorptance",label:h.jsxs(Zn,{Dialog:p8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-trough-optical-efficiency",label:h.jsxs(Zn,{Dialog:g8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-trough-thermal-efficiency",label:h.jsxs(Zn,{Dialog:m8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(n6e,{solarCollector:n})},{key:"parabolic-trough-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},A8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(H7),a=H(pQ),l=H(gQ),s=H(YN),c=H(ON),u=H($r),d=H(Fn),f=H(y4),p=H(A4),m=H(no),y=H(qn),w=H(Ji),x=ao(z.ParabolicDish),[C,P]=g.useState((x==null?void 0:x.lx)??2),A=g.useRef(!1),S=g.useRef(),v=Kt(),b=L=>{p(L.target.value)},T=(L,j)=>{const Y=u(L);if(Y){const O=JSON.parse(JSON.stringify(L));return O.lx=j,ye.isSolarCollectorWithinHorizontalSurface(O,Y)}return!1},R=(L,j)=>!T(L,j),M=L=>{if(x){switch(f){case ie.AllSelectedObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.lx-L)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&Math.abs(j.lx-L)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===(x==null?void 0:x.foundationId)&&!j.locked&&Math.abs(j.lx-L)>Ht)return!0;break;default:if(Math.abs((x==null?void 0:x.lx)-L)>Ht)return!0}return!1}},D=(L,j)=>{H.getState().set(Y=>{for(const O of Y.elements)O.type===z.ParabolicDish&&!O.locked&&L.has(O.id)&&(O.lx=j,O.ly=j)})},k=L=>{if(x&&M(L)){switch(S.current=void 0,f){case ie.AllSelectedObjectsOfThisType:{A.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(j.id)&&R(j,L)){A.current=!0;break}if(A.current)S.current=L,P(x.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.lx);const Y={name:"Set Diameter for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_),i(O,_)},redo:()=>{D(Y.oldValues,Y.newValue)}};d(Y),D(j,L),y(m+1)}break}case ie.AllObjectsOfThisType:{A.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&R(j,L)){A.current=!0;break}if(A.current)S.current=L,P(x.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&j.set(O.id,O.lx);const Y={name:"Set Diameter for All Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_),i(O,_)},redo:()=>{s(z.ParabolicDish,Y.newValue),c(z.ParabolicDish,Y.newValue)}};d(Y),s(z.ParabolicDish,L),c(z.ParabolicDish,L),y(m+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(x.foundationId){A.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===x.foundationId&&R(j,L)){A.current=!0;break}if(A.current)S.current=L,P(x.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&O.foundationId===x.foundationId&&j.set(O.id,O.lx);const Y={name:"Set Diameter for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:x.foundationId,undo:()=>{for(const[O,_]of Y.oldValues.entries())r(O,_),i(O,_)},redo:()=>{Y.groupId&&(a(z.ParabolicDish,Y.groupId,Y.newValue),l(z.ParabolicDish,Y.groupId,Y.newValue))}};d(Y),a(z.ParabolicDish,x.foundationId,L),l(z.ParabolicDish,x.foundationId,L),y(m+1)}}break}default:{const j=o(x.id),Y=j?j.lx:x.lx;if(A.current=R(x,L),A.current)S.current=L,P(Y);else{const O={name:"Set Parabolic Dish Diameter",timestamp:Date.now(),oldValue:Y,newValue:L,changedElementId:x.id,changedElementType:x.type,undo:()=>{r(O.changedElementId,O.oldValue),i(O.changedElementId,O.oldValue)},redo:()=>{r(O.changedElementId,O.newValue),i(O.changedElementId,O.newValue)}};d(O),r(x.id,L),i(x.id,L),y(m+1)}break}}e(j=>{j.actionState.parabolicDishRimDiameter=L})}},N=()=>{A.current=!1,t(!1)},U=()=>{N(),w()},W=()=>{k(C),A.current||(t(!1),y(0))},F=()=>{k(C)};if((x==null?void 0:x.type)!==z.ParabolicDish)return null;const E=A.current?": "+B.t("message.NotApplicableToSelectedAction",v)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicDishMenu.RimDiameter",v),rejectedMessage:E,onApply:F,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:C,onChange:L=>{L!==null&&P(L)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",v),": 1 ",B.t("word.MeterAbbreviation",v),h.jsx("br",{}),B.t("word.MaximumValue",v),": 10 ",B.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",v)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b,value:f,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",v)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",v)})]})})})]})})},w8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(LXe),i=H(WXe),a=H(NXe),l=H($r),s=H(Fn),c=H(y4),u=H(A4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicDish),[y,w]=g.useState((m==null?void 0:m.latusRectum)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicDish&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.ParabolicDish&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.ParabolicDish&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.latusRectum-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.latusRectum)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.ParabolicDish&&!L.locked&&W.has(L.id)&&(L.latusRectum=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.ParabolicDish&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicDish&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Dishes",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicDish,E.newValue)}};s(E),a(z.ParabolicDish,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.ParabolicDish&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.latusRectum);else{const F=new Map;for(const L of n)L.type===z.ParabolicDish&&L.foundationId===m.foundationId&&F.set(L.id,L.latusRectum);const E={name:"Set Latus Rectum for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.ParabolicDish,E.groupId,E.newValue)}};s(E),i(z.ParabolicDish,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.latusRectum:m.latusRectum;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Parabolic Dish Latus Rectum",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.parabolicDishLatusRectum=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.ParabolicDish)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicDishMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},x8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(y4),a=H(A4),l=H(no),s=H(qn),c=ao(z.ParabolicDish),[u,d]=g.useState((c==null?void 0:c.structureType)??pf.CentralPole),f=Kt(),{Option:p}=Ko,m=(b,T)=>{e(R=>{for(const M of R.elements)if(M.id===b&&!M.locked&&M.type===z.ParabolicDish){M.structureType=T;break}})},y=(b,T)=>{e(R=>{for(const M of R.elements)M.foundationId===b&&!M.locked&&M.type===z.ParabolicDish&&(M.structureType=T)})},w=b=>{e(T=>{for(const R of T.elements)R.locked||R.type===z.ParabolicDish&&(R.structureType=b)})},x=b=>{a(b.target.value)},C=b=>{switch(i){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.structureType!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&T.structureType!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of n)if(T.type===z.ParabolicDish&&T.foundationId===(c==null?void 0:c.foundationId)&&!T.locked&&T.structureType!==b)return!0;break;default:if((c==null?void 0:c.structureType)!==b)return!0}return!1},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.ParabolicDish&&!M.locked&&b.has(M.id)&&(M.structureType=T)})},A=b=>{if(c&&C(b)){switch(i){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.structureType);const R={name:"Set Structure Type for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())m(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};r(R),P(T,b),s(l+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&T.set(M.id,M.structureType);const R={name:"Set Structure Type for All Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())m(M,D)},redo:()=>{w(R.newValue)}};r(R),w(b),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const T=new Map;for(const M of n)M.type===z.ParabolicDish&&M.foundationId===c.foundationId&&T.set(M.id,M.structureType);const R={name:"Set Structure Type for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())m(M,D)},redo:()=>{R.groupId&&y(R.groupId,R.newValue)}};r(R),y(c.foundationId,b),s(l+1)}break}default:{const T=o(c.id),R=T?T.structureType:c.structureType,M={name:"Set Parabolic Dish Structure Type",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{m(M.changedElementId,M.oldValue)},redo:()=>{m(M.changedElementId,M.newValue)}};r(M),m(c.id,b),s(l+1);break}}e(T=>{T.actionState.parabolicDishReceiverStructure=b})}},S=()=>{t(!1)},v=()=>{A(u)};return(c==null?void 0:c.type)!==z.ParabolicDish?null:h.jsx(ro,{width:640,title:B.t("parabolicDishMenu.ReceiverStructure",f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsxs(Ko,{value:u,onChange:b=>d(b),children:[h.jsx(p,{value:pf.CentralPole,children:B.t("parabolicDishMenu.CentralPole",f)},pf.CentralPole),h.jsx(p,{value:pf.CentralPoleWithTripod,children:B.t("parabolicDishMenu.CentralPoleWithTripod",f)},pf.CentralPoleWithTripod),h.jsx(p,{value:pf.Quadrupod,children:B.t("parabolicDishMenu.Quadrupod",f)},pf.Quadrupod)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:x,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",f)})]})})})]})})},v8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(y4),u=H(A4),d=H(no),f=H(qn),p=H(Ji),m=ao(z.ParabolicDish),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=N=>{u(N.target.value)},S=N=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===(m==null?void 0:m.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const W of n)if(W.type===z.ParabolicDish&&W.parentId===m.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-N)>Ht)return!0;break}}return!1}},v=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)F.type===z.ParabolicDish&&!F.locked&&N.has(F.id)&&(F.tiltAngle=U)})},b=N=>{if(m&&S(N)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{v(W.oldValues,W.newValue)}};s(W),v(U,N),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicDish&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{a(z.ParabolicDish,W.newValue)}};s(W),a(z.ParabolicDish,N),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===m.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.ParabolicDish&&F.foundationId===m.foundationId&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:m.foundationId,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{W.groupId&&i(z.ParabolicDish,W.groupId,W.newValue)}};s(W),i(z.ParabolicDish,m.foundationId,N),f(d+1)}}break}default:{const U=o(m.id),W=U?U.poleHeight:m.poleHeight;if(x.current=.5*m.lx*Math.abs(Math.sin(m.tiltAngle))>N,x.current)C.current=N,w(W);else{const F={name:"Set Parabolic Dish Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(m.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicDishPoleHeight=N})}},T=()=>{x.current=!1,t(!1)},R=()=>{T(),p()},M=()=>{b(y),x.current||(t(!1),f(0))},D=()=>{b(y)};if((m==null?void 0:m.type)!==z.ParabolicDish)return null;const k=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("parabolicDishMenu.ExtraPoleHeightInAdditionToRadius",P),rejectedMessage:k,onApply:D,onClose:T,onClickCancel:R,onClickOk:M,children:h.jsxs(Qt,{children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:N=>{N!==null&&w(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [0, 5] ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},b8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(vXe),i=H(bXe),a=H(SXe),l=H($r),s=H(Fn),c=H(y4),u=H(A4),d=H(no),f=H(qn),p=ao(z.ParabolicDish),[m,y]=g.useState((p==null?void 0:p.poleRadius)??.1),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const T of n)if(T.type===z.ParabolicDish&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of n)if(T.type===z.ParabolicDish&&T.foundationId===(p==null?void 0:p.foundationId)&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.ParabolicDish&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-b)>Ht)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-b)>Ht)return!0;break}}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.ParabolicDish&&!M.locked&&b.has(M.id)&&(M.poleRadius=T)})},A=b=>{if(p&&C(b)){switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.ParabolicDish&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.ParabolicDish,R.newValue)}};s(R),a(z.ParabolicDish,b),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of n)M.type===z.ParabolicDish&&M.foundationId===p.foundationId&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.ParabolicDish,R.groupId,R.newValue)}};s(R),i(z.ParabolicDish,p.foundationId,b),f(d+1)}break}default:{const T=o(p.id),R=T?T.poleRadius:p.poleRadius,M={name:"Set Parabolic Dish Pole Radius",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}e(T=>{T.actionState.parabolicDishPoleRadius=b})}},S=()=>{t(!1)},v=()=>{A(m)};return(p==null?void 0:p.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.PoleRadius",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:m,onChange:b=>{b!==null&&y(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",w),": [0.1, 0.5] ",B.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",w)})]})})})]})})},S8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Parabolic Dish Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},T8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(TXe),i=H(PXe),a=H(CXe),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.absorptance)??.95),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.absorptance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.absorptance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.absorptance);const T={name:"Set Absorptance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.absorptance:f.absorptance,R={name:"Set Parabolic Dish Absorptance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishAbsorptance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},P8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(RXe),i=H(HXe),a=H(MXe),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.opticalEfficiency)??.7),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.opticalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.opticalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.opticalEfficiency);const T={name:"Set Optical Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Dish Optical Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishOpticalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},C8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(IXe),i=H(zXe),a=H(DXe),l=H(Fn),s=H(y4),c=H(A4),u=H(no),d=H(qn),f=ao(z.ParabolicDish),[p,m]=g.useState((f==null?void 0:f.thermalEfficiency)??.3),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.thermalEfficiency-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.ParabolicDish&&!R.locked&&v.has(R.id)&&(R.thermalEfficiency=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.ParabolicDish&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.ParabolicDish,T.newValue)}};l(T),a(z.ParabolicDish,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&b.set(R.id,R.thermalEfficiency);const T={name:"Set Thermal Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.ParabolicDish,T.groupId,T.newValue)}};l(T),i(z.ParabolicDish,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Dish Thermal Efficiency",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.parabolicDishThermalEfficiency=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},R8o=t=>{const e=[];if(t.type!==z.ParabolicDish)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"parabolic-dish-copy",label:h.jsx(ad,{})}),r&&e.push({key:"parabolic-dish-cut",label:h.jsx(ld,{})}),e.push({key:"parabolic-dish-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"parabolic-dish-radius",label:h.jsxs(Zn,{Dialog:A8o,children:[B.t("parabolicDishMenu.RimDiameter",o)," ..."]})},{key:"parabolic-dish-latus-rectum",label:h.jsxs(Zn,{Dialog:w8o,children:[B.t("parabolicDishMenu.LatusRectum",o)," ..."]})},{key:"parabolic-dish-structure-type",label:h.jsxs(Zn,{Dialog:x8o,children:[B.t("parabolicDishMenu.ReceiverStructure",o)," ..."]})},{key:"parabolic-dish-pole-height",label:h.jsxs(Zn,{Dialog:v8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-dish-pole-radius",label:h.jsxs(Zn,{Dialog:b8o,children:[B.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"parabolic-dish-reflectance",label:h.jsxs(Zn,{Dialog:S8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-dish-absorptance",label:h.jsxs(Zn,{Dialog:T8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-dish-optical-efficiency",label:h.jsxs(Zn,{Dialog:P8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-dish-thermal-efficiency",label:h.jsxs(Zn,{Dialog:C8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(n6e,{solarCollector:n})},{key:"parabolic-dish-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},H8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(gXe),r=H(mXe),i=H(yXe),a=H(Fn),l=H(zS),s=H(DS),c=H(no),u=H(qn),d=ao(z.FresnelReflector),[f,p]=g.useState(!!(d!=null&&d.drawSunBeam)),m=Kt(),y=S=>{s(S.target.value)},w=S=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.FresnelReflector&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.FresnelReflector&&!v.locked&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.FresnelReflector&&v.foundationId===(d==null?void 0:d.foundationId)&&!v.locked&&v.drawSunBeam!==S)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==S)return!0}return!1},x=(S,v)=>{H.getState().set(b=>{for(const T of b.elements)ye.isSolarCollectorType(T.type)&&!T.locked&&T.type===z.FresnelReflector&&S.has(T.id)&&(T.drawSunBeam=v)})},C=S=>{if(d&&w(S))switch(l){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{x(b.oldValues,b.newValue)}};a(b),x(v,S),u(c+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.FresnelReflector&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Fresnel Reflectors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{i(z.FresnelReflector,b.newValue)}};a(b),i(z.FresnelReflector,S),u(c+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const v=new Map;for(const T of e)T.type===z.FresnelReflector&&T.foundationId===d.foundationId&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:d.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{b.groupId&&r(z.FresnelReflector,b.groupId,b.newValue)}};a(b),r(z.FresnelReflector,d.foundationId,S),u(c+1)}break}default:{const v=n(d.id),b=v?v.drawSunBeam:d.drawSunBeam,T={name:"Draw Sun Beam for Fresnel Reflector",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(T.changedElementId,T.oldValue)},redo:()=>{o(T.changedElementId,T.newValue)}};a(T),o(d.id,S),u(c+1);break}}},P=()=>{t(!1)},A=()=>{C(f)};return(d==null?void 0:d.type)!==z.FresnelReflector?null:h.jsx(ro,{width:500,title:B.t("solarCollectorMenu.DrawSunBeam",m),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsx(zc,{checked:f,onChange:S=>{p(S)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:y,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",m)})]})})})]})})},{Option:M8o}=Ko,I8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(EXe),i=H(kXe),a=H(FXe),l=H(Fn),s=H(zS),c=H(DS),u=H(no),d=H(qn),f=ao(z.FresnelReflector),[p,m]=g.useState((f==null?void 0:f.receiverId)??"None"),y=Kt(),w=g.useMemo(()=>{const b=[];for(const T of n)if(T.type===z.Foundation){const R=T;R.solarStructure===Nn.FocusPipe&&b.push(R.id)}return b},[n]);g.useEffect(()=>{if(m("None"),f)if(f.receiverId)m(f.receiverId);else{const b=o(f.parentId);b&&b.type===z.Foundation&&b.solarStructure===Nn.FocusPipe&&m(b.id)}},[f]);const x=b=>{c(b.target.value)},C=b=>{switch(s){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.FresnelReflector&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.receiverId!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.FresnelReflector&&!T.locked&&T.receiverId!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of n)if(T.type===z.FresnelReflector&&T.foundationId===(f==null?void 0:f.foundationId)&&!T.locked&&T.receiverId!==b)return!0;break;default:if((f==null?void 0:f.receiverId)!==b)return!0}return!1},P=(b,T)=>{e(R=>{for(const M of R.elements)ye.isHeliostatOrFresnelReflector(M.type)&&!M.locked&&b.has(M.id)&&(M.type===z.Heliostat?M.towerId=T:M.type===z.FresnelReflector&&(M.receiverId=T))})},A=b=>{if(f&&C(b)){switch(s){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.receiverId);const R={name:"Set Receiver for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(T,b),d(u+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.FresnelReflector&&T.set(M.id,M.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.FresnelReflector,R.newValue)}};l(R),a(z.FresnelReflector,b),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const T=new Map;for(const M of n)M.type===z.FresnelReflector&&M.foundationId===f.foundationId&&T.set(M.id,M.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:f.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.FresnelReflector,R.groupId,R.newValue)}};l(R),i(z.FresnelReflector,f.foundationId,b),d(u+1)}break}default:{const T=o(f.id),R=T?T.receiverId:f.receiverId,M={name:"Set Receiver for Fresnel Reflector",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};l(M),r(f.id,b),d(u+1);break}}e(T=>{T.actionState.fresnelReflectorReceiver=b})}},S=()=>{t(!1)},v=()=>{p&&A(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(ro,{width:640,title:B.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",y),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsx(Ko,{style:{width:"160px"},value:p,onChange:b=>{m(b)},children:w.map((b,T)=>h.jsx(M8o,{value:b,children:B.t("fresnelReflectorMenu.AbsorberPipe",y)+" "+(T+1)},T))})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:x,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",y)})]})})})]})})},z8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(H7),r=H(gQ),i=H(ON),a=H($r),l=H(Fn),s=H(zS),c=H(DS),u=H(no),d=H(qn),f=H(Ji),p=ao(z.FresnelReflector),[m,y]=g.useState((p==null?void 0:p.ly)??9),w=g.useRef(!1),x=g.useRef(),C=Kt(),P=W=>{c(W.target.value)},A=(W,F)=>{const E=a(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.ly=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},S=(W,F)=>!A(W,F),v=W=>{if(p){switch(s){case ie.AllSelectedObjectsOfThisType:for(const F of e)if(F.type===z.FresnelReflector&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of e)if(F.type===z.FresnelReflector&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of e)if(F.type===z.FresnelReflector&&F.foundationId===(p==null?void 0:p.foundationId)&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Ht)return!0}return!1}},b=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.ly=F)})},T=W=>{if(p&&v(W))switch(x.current=void 0,s){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(F.id)&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.ly);const E={name:"Set Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{b(E.oldValues,E.newValue)}};l(E),b(F,W),d(u+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const F of e)if(F.type===z.FresnelReflector&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.FresnelReflector&&F.set(L.id,L.ly);const E={name:"Set Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{i(z.FresnelReflector,E.newValue)}};l(E),i(z.FresnelReflector,W),d(u+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){w.current=!1;for(const F of e)if(F.type===z.FresnelReflector&&F.foundationId===p.foundationId&&S(F,W)){w.current=!0;break}if(w.current)x.current=W,y(p.ly);else{const F=new Map;for(const L of e)L.type===z.FresnelReflector&&L.foundationId===p.foundationId&&F.set(L.id,L.ly);const E={name:"Set Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())o(L,j)},redo:()=>{E.groupId&&r(z.FresnelReflector,E.groupId,E.newValue)}};l(E),r(z.FresnelReflector,p.foundationId,W),d(u+1)}}break}default:{const F=n(p.id),E=F?F.ly:p.ly;if(w.current=S(p,W),w.current)x.current=W,y(E);else{const L={name:"Set Fresnel Reflector Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{w.current=!1,t(!1)},M=()=>{R(),f()},D=()=>{T(m),w.current||(t(!1),d(0))},k=W=>{if(!p)return 1;let F=W??1;return F=Math.max(1,Math.ceil((F-p.moduleLength/2)/p.moduleLength))*p.moduleLength,F},N=()=>{T(m)};if((p==null?void 0:p.type)!==z.FresnelReflector)return null;const U=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current!==void 0?" ("+x.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:p.moduleLength,max:200*p.moduleLength,step:p.moduleLength,style:{width:120},precision:2,value:m,onChange:W=>{W!==null&&y(k(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("fresnelReflectorMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+B.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(m/p.moduleLength)+" "+B.t("fresnelReflectorMenu.ModulesLong",C),h.jsx("br",{}),B.t("word.Maximum",C),": 200 ",B.t("fresnelReflectorMenu.Modules",C)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",C)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",C)})]})})})]})})},D8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(pQ),a=H(YN),l=H($r),s=H(Fn),c=H(zS),u=H(DS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.FresnelReflector),[y,w]=g.useState((m==null?void 0:m.lx)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.lx=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.lx)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.lx=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.lx);const E={name:"Set Width for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&F.set(L.id,L.lx);const E={name:"Set Width for All Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,E.newValue)}};s(E),a(z.FresnelReflector,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===m.foundationId&&F.set(L.id,L.lx);const E={name:"Set Width for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.FresnelReflector,E.groupId,E.newValue)}};s(E),i(z.FresnelReflector,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.lx:m.lx;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Fresnel Reflector Width",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.fresnelReflectorWidth=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.FresnelReflector)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},E8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(UXe),i=H(jXe),a=H(BXe),l=H($r),s=H(Fn),c=H(zS),u=H(DS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.FresnelReflector),[y,w]=g.useState((m==null?void 0:m.moduleLength)??3),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.FresnelReflector&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.moduleLength-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.moduleLength)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.moduleLength=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,E.newValue)}};s(E),a(z.FresnelReflector,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.FresnelReflector&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.moduleLength);else{const F=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===m.foundationId&&F.set(L.id,L.moduleLength);const E={name:"Set Module Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.FresnelReflector,E.groupId,E.newValue)}};s(E),i(z.FresnelReflector,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.moduleLength:m.moduleLength;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Fresnel Reflector Module Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.fresnelReflectorModuleLength=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.FresnelReflector)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("fresnelReflectorMenu.ModuleLength",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 10 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},k8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(zS),u=H(DS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.FresnelReflector),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=g.useRef((m==null?void 0:m.poleHeight)??1),A=Kt(),S=U=>{u(U.target.value)},v=U=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&H.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===(m==null?void 0:m.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const F of n)if(F.type===z.FresnelReflector&&F.parentId===m.parentId&&!F.locked&&Math.abs(F.poleHeight-U)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-U)>Ht)return!0;break}}return!1}},b=(U,W)=>{H.getState().set(F=>{for(const E of F.elements)E.type===z.FresnelReflector&&!E.locked&&U.has(E.id)&&(E.poleHeight=W)})},T=U=>{if(m&&v(U)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){x.current=!0;break}if(x.current)C.current=U,P.current=m.poleHeight;else{const W=new Map;for(const E of n)E.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(E.id)&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{b(F.oldValues,F.newValue)}};s(F),b(W,U),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){x.current=!0;break}if(x.current)C.current=U,P.current=m.poleHeight;else{const W=new Map;for(const E of n)E.type===z.FresnelReflector&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{a(z.FresnelReflector,F.newValue)}};s(F),a(z.FresnelReflector,U),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===m.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){x.current=!0;break}if(x.current)C.current=U,P.current=m.poleHeight;else{const W=new Map;for(const E of n)E.type===z.FresnelReflector&&E.foundationId===m.foundationId&&W.set(E.id,E.poleHeight);const F={name:"Set Pole Height for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:m.foundationId,undo:()=>{for(const[E,L]of F.oldValues.entries())r(E,L)},redo:()=>{F.groupId&&i(z.FresnelReflector,F.groupId,F.newValue)}};s(F),i(z.FresnelReflector,m.foundationId,U),f(d+1)}}break}default:{const W=o(m.id),F=W?W.poleHeight:m.poleHeight;if(x.current=.5*m.lx*Math.abs(Math.sin(m.tiltAngle))>U,x.current)C.current=U,P.current=F;else{const E={name:"Set Fresnel Reflector Pole Height",timestamp:Date.now(),oldValue:F,newValue:U,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(E.changedElementId,E.oldValue)},redo:()=>{r(E.changedElementId,E.newValue)}};s(E),r(m.id,U),f(d+1)}break}}e(W=>{W.actionState.fresnelReflectorPoleHeight=U})}},R=()=>{t(!1)},M=()=>{R(),p()},D=()=>{T(y),x.current||(t(!1),f(0))},k=()=>{T(y)};if((m==null?void 0:m.type)!==z.FresnelReflector)return null;const N=x.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",A),rejectedMessage:N,onApply:k,onClose:R,onClickCancel:M,onClickOk:D,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:U=>{U!==null&&w(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [0, 5] ",B.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",A)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",A)})]})})})]})})},F8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(zS),c=H(DS),u=H(no),d=H(qn),f=ao(z.FresnelReflector),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.FresnelReflector&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.FresnelReflector&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.FresnelReflector&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.FresnelReflector&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.FresnelReflector,T.newValue)}};l(T),a(z.FresnelReflector,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.FresnelReflector&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.FresnelReflector,T.groupId,T.newValue)}};l(T),i(z.FresnelReflector,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Fresnel Reflector Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.fresnelReflectorReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,value:p,step:.01,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("fresnelReflectorMenu.OnlyThisFresnelReflector",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("fresnelReflectorMenu.AllFresnelReflectors",y)})]})})})]})})},L8o=t=>{const e=[];if(t.type!==z.FresnelReflector)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"fresnel-reflector-copy",label:h.jsx(ad,{})}),r&&e.push({key:"fresnel-reflector-cut",label:h.jsx(ld,{})}),e.push({key:"fresnel-reflector-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"fresnel-reflector-receiver",label:h.jsxs(Zn,{Dialog:I8o,children:[B.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",o)," ..."]})},{key:"fresnel-reflector-length",label:h.jsxs(Zn,{Dialog:z8o,children:[B.t("word.Length",o)," ..."]})},{key:"fresnel-reflector-width",label:h.jsxs(Zn,{Dialog:D8o,children:[B.t("word.Width",o)," ..."]})},{key:"fresnel-reflector-module-length",label:h.jsxs(Zn,{Dialog:E8o,children:[B.t("fresnelReflectorMenu.ModuleLength",o)," ..."]})},{key:"fresnel-reflector-pole-height",label:h.jsxs(Zn,{Dialog:k8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"fresnel-reflector-reflectance",label:h.jsxs(Zn,{Dialog:F8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"fresnel-reflector-draw-sun-beam",label:h.jsxs(Zn,{Dialog:H8o,children:[B.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"fresnel-reflector-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},W8o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Jn),o=H(gXe),r=H(mXe),i=H(yXe),a=H(Fn),l=H(ES),s=H(kS),c=H(no),u=H(qn),d=ao(z.Heliostat),[f,p]=g.useState(!!(d!=null&&d.drawSunBeam)),m=Kt(),y=S=>{s(S.target.value)},w=S=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Heliostat&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Heliostat&&!v.locked&&v.drawSunBeam!==S)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Heliostat&&v.foundationId===(d==null?void 0:d.foundationId)&&!v.locked&&v.drawSunBeam!==S)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==S)return!0}return!1},x=(S,v)=>{H.getState().set(b=>{for(const T of b.elements)T.type===z.Heliostat&&!T.locked&&S.has(T.id)&&(T.drawSunBeam=v)})},C=S=>{if(d&&w(S))switch(l){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.Heliostat&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for Selected Heliostats",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{x(b.oldValues,b.newValue)}};a(b),x(v,S),u(c+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)T.type===z.Heliostat&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Heliostats",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{i(z.Heliostat,b.newValue)}};a(b),i(z.Heliostat,S),u(c+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const v=new Map;for(const T of e)T.type===z.Heliostat&&T.foundationId===d.foundationId&&v.set(T.id,T.drawSunBeam);const b={name:"Draw Sun Beam for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:d.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())o(T,R)},redo:()=>{b.groupId&&r(z.Heliostat,b.groupId,b.newValue)}};a(b),r(z.Heliostat,d.foundationId,S),u(c+1)}break}default:{const v=n(d.id),b=v?v.drawSunBeam:d.drawSunBeam,T={name:"Draw Sun Beam for Heliostat",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(T.changedElementId,T.oldValue)},redo:()=>{o(T.changedElementId,T.newValue)}};a(T),o(d.id,S),u(c+1);break}}},P=()=>{t(!1)},A=()=>{C(f)};return(d==null?void 0:d.type)!==z.Heliostat?null:h.jsx(ro,{width:500,title:B.t("solarCollectorMenu.DrawSunBeam",m),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsx(zc,{checked:f,onChange:p})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:y,value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",m)})]})})})]})})},{Option:N8o}=Ko,U8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(EXe),i=H(kXe),a=H(FXe),l=H(Fn),s=H(ES),c=H(kS),u=H(no),d=H(qn),f=ao(z.Heliostat),[p,m]=g.useState((f==null?void 0:f.towerId)??"None"),y=Kt(),w=g.useMemo(()=>{const b=[];for(const T of n)if(T.type===z.Foundation){const R=T;R.solarStructure===Nn.FocusTower&&b.push(R.id)}return b},[n]);g.useEffect(()=>{if(m("None"),f)if(f.towerId)m(f.towerId);else{const b=o(f.parentId);b&&b.type===z.Foundation&&b.solarStructure===Nn.FocusTower&&m(b.id)}},[f]);const x=b=>{c(b.target.value)},C=b=>{switch(s){case ie.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Heliostat&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.towerId!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of n)if(T.type===z.Heliostat&&!T.locked&&T.towerId!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of n)if(T.type===z.Heliostat&&T.foundationId===(f==null?void 0:f.foundationId)&&!T.locked&&T.towerId!==b)return!0;break;default:if((f==null?void 0:f.towerId)!==b)return!0}return!1},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Heliostat&&!M.locked&&b.has(M.id)&&(M.towerId=T)})},A=b=>{if(f&&C(b)){switch(s){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.towerId);const R={name:"Set Tower for Selected Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(T,b),d(u+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&T.set(M.id,M.towerId);const R={name:"Set Tower for All Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.Heliostat,R.newValue)}};l(R),a(z.Heliostat,b),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const T=new Map;for(const M of n)M.type===z.Heliostat&&M.foundationId===f.foundationId&&T.set(M.id,M.towerId);const R={name:"Set Tower for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:f.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};l(R),i(z.Heliostat,f.foundationId,b),d(u+1)}break}default:{const T=o(f.id),R=T?T.towerId:f.towerId,M={name:"Set Tower for Heliostat",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};l(M),r(f.id,b),d(u+1);break}}e(T=>{T.actionState.heliostatTower=b})}},S=()=>{t(!1)},v=()=>{p&&A(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(ro,{width:600,title:B.t("heliostatMenu.SelectTowerToReflectSunlightTo",y),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsx(Ko,{style:{width:"120px"},value:p,onChange:m,children:w.map((b,T)=>h.jsx(N8o,{value:b,children:B.t("heliostatMenu.Tower",y)+" "+(T+1)},T))})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:x,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",y)})]})})})]})})},j8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Z3),i=H(pQ),a=H(YN),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.Heliostat),[y,w]=g.useState((m==null?void 0:m.lx)??2),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.lx=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.Heliostat&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.lx-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.lx)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.lx=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.lx);const E={name:"Set Length for Selected Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&F.set(L.id,L.lx);const E={name:"Set Length for All Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,E.newValue)}};s(E),a(z.Heliostat,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.Heliostat&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.lx);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===m.foundationId&&F.set(L.id,L.lx);const E={name:"Set Length for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.Heliostat,E.groupId,E.newValue)}};s(E),i(z.Heliostat,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.lx:m.lx;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Heliostat Length",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.heliostatLength=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.Heliostat)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Length",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},B8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(H7),i=H(gQ),a=H(ON),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.Heliostat),[y,w]=g.useState((m==null?void 0:m.ly)??4),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=W=>{u(W.target.value)},S=(W,F)=>{const E=l(W);if(E){const L=JSON.parse(JSON.stringify(W));return L.ly=F,ye.isSolarCollectorWithinHorizontalSurface(L,E)}return!1},v=(W,F)=>!S(W,F),b=W=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const F of n)if(F.type===z.Heliostat&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.Heliostat&&F.foundationId===(m==null?void 0:m.foundationId)&&!F.locked&&Math.abs(F.ly-W)>Ht)return!0;break;default:if(Math.abs((m==null?void 0:m.ly)-W)>Ht)return!0}return!1}},T=(W,F)=>{H.getState().set(E=>{for(const L of E.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.ly=F)})},R=W=>{if(m&&b(W)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&H.getState().selectedElementIdSet.has(F.id)&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.ly);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&H.getState().selectedElementIdSet.has(L.id)&&F.set(L.id,L.ly);const E={name:"Set Width for Selected Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{T(E.oldValues,E.newValue)}};s(E),T(F,W),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const F of n)if(F.type===z.Heliostat&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.ly);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&F.set(L.id,L.ly);const E={name:"Set Width for All Heliostats",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,E.newValue)}};s(E),a(z.Heliostat,W),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const F of n)if(F.type===z.Heliostat&&F.foundationId===m.foundationId&&v(F,W)){x.current=!0;break}if(x.current)C.current=W,w(m.ly);else{const F=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===m.foundationId&&F.set(L.id,L.ly);const E={name:"Set Width for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:m.foundationId,undo:()=>{for(const[L,j]of E.oldValues.entries())r(L,j)},redo:()=>{E.groupId&&i(z.Heliostat,E.groupId,E.newValue)}};s(E),i(z.Heliostat,m.foundationId,W),f(d+1)}}break}default:{const F=o(m.id),E=F?F.ly:m.ly;if(x.current=v(m,W),x.current)C.current=W,w(E);else{const L={name:"Set Heliostat Width",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(m.id,W),f(d+1)}break}}e(F=>{F.actionState.heliostatWidth=W})}},M=()=>{x.current=!1,t(!1)},D=()=>{M(),p()},k=()=>{R(y),x.current||(t(!1),f(0))},N=()=>{R(y)};if((m==null?void 0:m.type)!==z.Heliostat)return null;const U=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:y,onChange:W=>{W!==null&&w(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.MinimumValue",P),": 1 ",B.t("word.MeterAbbreviation",P),h.jsx("br",{}),B.t("word.MaximumValue",P),": 20 ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},Y8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(JN),i=H(KN),a=H($N),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=H(Ji),m=ao(z.Heliostat),[y,w]=g.useState((m==null?void 0:m.poleHeight)??1),x=g.useRef(!1),C=g.useRef(),P=Kt(),A=N=>{u(N.target.value)},S=N=>{if(m){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&H.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.Heliostat&&U.foundationId===(m==null?void 0:m.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(m)){for(const W of n)if(W.type===z.Heliostat&&W.parentId===m.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Ht)return!0}break}default:{if(Math.abs((m==null?void 0:m.poleHeight)-N)>Ht)return!0;break}}return!1}},v=(N,U)=>{H.getState().set(W=>{for(const F of W.elements)F.type===z.Heliostat&&!F.locked&&N.has(F.id)&&(F.poleHeight=U)})},b=N=>{if(m&&S(N)){switch(C.current=void 0,c){case ie.AllSelectedObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.Heliostat&&H.getState().selectedElementIdSet.has(U.id)&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.Heliostat&&H.getState().selectedElementIdSet.has(F.id)&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for Selected Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{v(W.oldValues,W.newValue)}};s(W),v(U,N),f(d+1)}break}case ie.AllObjectsOfThisType:{x.current=!1;for(const U of n)if(U.type===z.Heliostat&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.Heliostat&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{a(z.Heliostat,W.newValue)}};s(W),a(z.Heliostat,N),f(d+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(m.foundationId){x.current=!1;for(const U of n)if(U.type===z.Heliostat&&U.foundationId===m.foundationId&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){x.current=!0;break}if(x.current)C.current=N,w(m.poleHeight);else{const U=new Map;for(const F of n)F.type===z.Heliostat&&F.foundationId===m.foundationId&&U.set(F.id,F.poleHeight);const W={name:"Set Pole Height for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:m.foundationId,undo:()=>{for(const[F,E]of W.oldValues.entries())r(F,E)},redo:()=>{W.groupId&&i(z.Heliostat,W.groupId,W.newValue)}};s(W),i(z.Heliostat,m.foundationId,N),f(d+1)}}break}default:{const U=o(m.id),W=U?U.poleHeight:m.poleHeight;if(x.current=.5*Math.max(m.lx,m.ly)*Math.abs(Math.sin(m.tiltAngle))>N,x.current)C.current=N,w(W);else{const F={name:"Set Heliostat Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:m.id,changedElementType:m.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(m.id,N),f(d+1)}break}}e(U=>{U.actionState.heliostatPoleHeight=N})}},T=()=>{x.current=!1,t(!1)},R=()=>{T(),p()},M=()=>{b(y),x.current||(t(!1),f(0))},D=()=>{b(y)};if((m==null?void 0:m.type)!==z.Heliostat)return null;const k=x.current?": "+B.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:k,onApply:D,onClose:T,onClickCancel:R,onClickOk:M,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:y,onChange:N=>{N!==null&&w(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [0, 5] ",B.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",P)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:A,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},O8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(vXe),i=H(bXe),a=H(SXe),l=H($r),s=H(Fn),c=H(ES),u=H(kS),d=H(no),f=H(qn),p=ao(z.Heliostat),[m,y]=g.useState((p==null?void 0:p.poleRadius)??.1),w=Kt(),x=b=>{u(b.target.value)},C=b=>{if(p){switch(c){case ie.AllSelectedObjectsOfThisType:{for(const T of n)if(T.type===z.Heliostat&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const T of n)if(T.type===z.Heliostat&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of n)if(T.type===z.Heliostat&&T.foundationId===(p==null?void 0:p.foundationId)&&!T.locked&&Math.abs(T.poleRadius-b)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.Heliostat&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-b)>Ht)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-b)>Ht)return!0;break}}return!1}},P=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.Heliostat&&!M.locked&&b.has(M.id)&&(M.poleRadius=T)})},A=b=>{if(p&&C(b)){switch(c){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for Selected Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(T,b),f(d+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.Heliostat&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Heliostats",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{a(z.Heliostat,R.newValue)}};s(R),a(z.Heliostat,b),f(d+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const T=new Map;for(const M of n)M.type===z.Heliostat&&M.foundationId===p.foundationId&&T.set(M.id,M.poleRadius);const R={name:"Set Pole Radius for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:p.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())r(M,D)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};s(R),i(z.Heliostat,p.foundationId,b),f(d+1)}break}default:{const T=o(p.id),R=T?T.poleRadius:p.poleRadius,M={name:"Set Heliostat Pole Radius",timestamp:Date.now(),oldValue:R,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(M.changedElementId,M.oldValue)},redo:()=>{r(M.changedElementId,M.newValue)}};s(M),r(p.id,b),f(d+1);break}}e(T=>{T.actionState.heliostatPoleRadius=b})}},S=()=>{t(!1)},v=()=>{A(m)};return(p==null?void 0:p.type)!==z.Heliostat?null:h.jsx(ro,{width:600,title:B.t("solarCollectorMenu.PoleRadius",w),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:m,onChange:b=>{b!==null&&y(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",w),": [0.1, 0.5] ",B.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:x,value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",w)})]})})})]})})},_8o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(AQ),i=H(wQ),a=H(xQ),l=H(Fn),s=H(ES),c=H(kS),u=H(no),d=H(qn),f=ao(z.Heliostat),[p,m]=g.useState((f==null?void 0:f.reflectance)??.9),y=Kt(),w=v=>{c(v.target.value)},x=v=>{if(f){switch(s){case ie.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.Heliostat&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&Math.abs(b.reflectance-v)>Ht)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-v)>Ht)return!0}return!1}},C=(v,b)=>{H.getState().set(T=>{for(const R of T.elements)R.type===z.Heliostat&&!R.locked&&v.has(R.id)&&(R.reflectance=b)})},P=v=>{if(f&&x(v)){switch(s){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Heliostat&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for Selected Heliostats",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{C(T.oldValues,T.newValue)}};l(T),C(b,v),d(u+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Heliostat&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Heliostats",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{a(z.Heliostat,T.newValue)}};l(T),a(z.Heliostat,v),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const R of n)R.type===z.Heliostat&&R.foundationId===f.foundationId&&b.set(R.id,R.reflectance);const T={name:"Set Reflectance for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:f.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())r(R,M)},redo:()=>{T.groupId&&i(z.Heliostat,T.groupId,T.newValue)}};l(T),i(z.Heliostat,f.foundationId,v),d(u+1)}break}default:{const b=o(f.id),T=b?b.reflectance:f.reflectance,R={name:"Set Heliostat Reflectance",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,v),d(u+1);break}}e(b=>{b.actionState.heliostatReflectance=v})}},A=()=>{t(!1)},S=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(ro,{width:600,title:B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",y),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:v=>{v!==null&&m(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:s,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("heliostatMenu.OnlyThisHeliostat",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("heliostatMenu.AllHeliostatsAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("heliostatMenu.AllSelectedHeliostats",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("heliostatMenu.AllHeliostats",y)})]})})})]})})},V8o=t=>{const e=[];if(t.type!==z.Heliostat)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"heliostat-copy",label:h.jsx(ad,{})}),r&&e.push({key:"heliostat-cut",label:h.jsx(ld,{})}),e.push({key:"heliostat-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"heliostat-tower",label:h.jsxs(Zn,{Dialog:U8o,children:[B.t("heliostatMenu.SelectTowerToReflectSunlightTo",o)," ..."]})},{key:"heliostat-length",label:h.jsxs(Zn,{Dialog:j8o,children:[B.t("word.Length",o)," ..."]})},{key:"heliostat-width",label:h.jsxs(Zn,{Dialog:B8o,children:[B.t("word.Width",o)," ..."]})},{key:"heliostat-pole-height",label:h.jsxs(Zn,{Dialog:Y8o,children:[B.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"heliostat-pole-radius",label:h.jsxs(Zn,{Dialog:O8o,children:[B.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"heliostat-reflectance",label:h.jsxs(Zn,{Dialog:_8o,children:[B.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"heliostat-draw-sun-beam",label:h.jsxs(Zn,{Dialog:W8o,children:[B.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"heliostat-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},{Option:ty}=Ko,G8o=xe.memo(({tree:t})=>{const e=H(pn),n=H(Fn),[o,r]=g.useState(!1),i=Kt(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Tree&&u.id===l){u.name=s;break}})};return h.jsxs(Ko,{style:{width:"160px"},value:(t==null?void 0:t.name)??yr.Pine,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Tree",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.treeType=l}),r(!o)}}},children:[h.jsxs(ty,{value:yr.Apple,children:[h.jsx("img",{alt:yr.Apple,src:ape,height:20,style:{paddingRight:"8px"}})," ",B.t("tree.Apple",i)]},yr.Apple),h.jsxs(ty,{value:yr.Birch,children:[h.jsx("img",{alt:yr.Birch,src:lpe,height:20,style:{paddingRight:"20px"}})," ",B.t("tree.Birch",i)]},yr.Birch),h.jsxs(ty,{value:yr.Coconut,children:[h.jsx("img",{alt:yr.Coconut,src:mnt,height:20,style:{paddingRight:"18px"}})," ",B.t("tree.Coconut",i)]},yr.Coconut),h.jsxs(ty,{value:yr.Dogwood,children:[h.jsx("img",{alt:yr.Dogwood,src:spe,height:20,style:{paddingRight:"10px"}})," ",B.t("tree.Dogwood",i)]},yr.Dogwood),h.jsxs(ty,{value:yr.Elm,children:[h.jsx("img",{alt:yr.Elm,src:cpe,height:20,style:{paddingRight:"20px"}}),B.t("tree.Elm",i)]},yr.Elm),h.jsxs(ty,{value:yr.FanPalm,children:[h.jsx("img",{alt:yr.FanPalm,src:ynt,height:20,style:{paddingRight:"18px"}})," ",B.t("tree.FanPalm",i)]},yr.FanPalm),h.jsxs(ty,{value:yr.Linden,children:[h.jsx("img",{alt:yr.Linden,src:upe,height:20,style:{paddingRight:"10px"}})," ",B.t("tree.Linden",i)]},yr.Linden),h.jsxs(ty,{value:yr.Magnolia,children:[h.jsx("img",{alt:yr.Magnolia,src:dpe,height:20,style:{paddingRight:"10px"}})," ",B.t("tree.Magnolia",i)]},yr.Magnolia),h.jsxs(ty,{value:yr.Maple,children:[h.jsx("img",{alt:yr.Maple,src:fpe,height:20,style:{paddingRight:"12px"}})," ",B.t("tree.Maple",i)]},yr.Maple),h.jsxs(ty,{value:yr.Oak,children:[h.jsx("img",{alt:yr.Oak,src:hpe,height:20,style:{paddingRight:"17px"}}),B.t("tree.Oak",i)]},yr.Oak),h.jsxs(ty,{value:yr.Pine,children:[h.jsx("img",{alt:yr.Pine,src:Ant,height:20,style:{paddingRight:"18px"}})," ",B.t("tree.Pine",i)]},yr.Pine),h.jsxs(ty,{value:yr.Spruce,children:[h.jsx("img",{alt:yr.Spruce,src:wnt,height:20,style:{paddingRight:"20px"}})," ",B.t("tree.Spruce",i)]},yr.Spruce)]})}),X8o=t=>{const e=[];if(t.type!==z.Tree)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"tree-copy",label:h.jsx(ad,{})}),o&&e.push({key:"tree-cut",label:h.jsx(ld,{})}),e.push({key:"tree-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"tree-show-model",label:h.jsx(J4o,{tree:n})},{key:"tree-flip",label:h.jsx(D4e,{billboardModel:n})}),e.push({key:"tree-change-type",label:h.jsxs(ln,{stayAfterClick:!0,children:[h.jsxs(Jt,{style:{width:"100px"},children:[B.t("treeMenu.Type",r),": "]}),h.jsx(G8o,{tree:n})]})},{key:"tree-spread",label:h.jsx(K4o,{tree:n})},{key:"tree-height",label:h.jsx($4o,{tree:n})},{key:"tree-label-submenu",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)})),{items:e}},J8o=({wall:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=H.getState().removeAllChildElementsByType,a=()=>{const s=H.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Wall`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{H.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};H.getState().addUndoable(u)},l=()=>{const s=o??a;li.confirm({title:n,icon:h.jsx(_y,{}),onOk:s})};return h.jsx(ln,{update:!0,noPadding:!0,onClick:l,children:r})},MEe=({wall:t,objectType:e,lock:n,children:o})=>{const r=H.getState().updateElementLockById,i=H.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of H.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Wall`:`Unlock All Locked ${l} on Wall`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};H.getState().addUndoable(u)};return h.jsx(ln,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},K8o=({wall:t})=>{const e=Kt(),n=H.getState().set,o=(i,a)=>{n(l=>{const s=l.elements.find(c=>c.id===i&&c.type===z.Wall);s&&(s.parapet.display=a)})},r=i=>{const a=i.target.checked,l={name:"Parapet",timestamp:Date.now(),checked:a,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{o(t.id,!l.checked)},redo:()=>{o(t.id,l.checked)}};H.getState().addUndoable(l),o(t.id,a),n(s=>{s.actionState.wallParapet.display=a})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.parapet.display,onChange:r,children:B.t("wallMenu.Parapet",e)})})},$8o=({wall:t})=>{const e=Kt(),n=(i,a)=>{H.getState().set(l=>{for(const s of l.elements)if(s.id===i&&s.type===z.Wall){const c=s;c.wallStructure=a,(a===Tc.Stud||a===Tc.Pillar)&&(c.opacity=0);break}})},o=i=>{const a={name:"Select Wall Structure",timestamp:Date.now(),oldValue:t.wallStructure,newValue:i.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(a.changedElementId,a.oldValue)},redo:()=>{n(a.changedElementId,a.newValue)}};H.getState().addUndoable(a),n(t.id,i.target.value),H.getState().set(l=>{l.actionState.wallStructure=i.target.value,(l.actionState.wallStructure===Tc.Stud||l.actionState.wallStructure===Tc.Pillar)&&(l.actionState.wallOpacity=0)})},r=t.wallStructure??Tc.Default;return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:r,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Tc.Default,children:B.t("wallMenu.DefaultStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Tc.Stud,children:B.t("wallMenu.StudStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Tc.Pillar,children:B.t("wallMenu.PillarStructure",e)})]})})})},q8o=({wall:t})=>{const e=H.getState().set,n=Kt(),o=(i,a,l)=>{const{cx:s,cy:c,cz:u}=a,d=l?l.rotation[2]+a.relativeAngle:a.relativeAngle;if(l&&d!==void 0){const f=ye.wallAbsolutePosition(new ue(s,c,u),l).setZ(a.lz/2+l.lz);return new ue().subVectors(i,f).applyEuler(new cn(0,0,-d))}return new ue},r=()=>{const i=H.getState().getFoundation(t);if(!i)return;const a=o(H.getState().pastePoint,t,i),l=Qa.makePolygon(t,-a.x/t.lx,0,-a.z/t.lz,new ue(0,0,1),[0,0,0],z.Wall);e(c=>{c.elements.push(l),c.objectTypeToAdd=z.None});const s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{H.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{e(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};H.getState().addUndoable(s)};return h.jsx(ln,{onClick:r,children:B.t("foundationMenu.AddPolygon",n)})},Q8o=({wall:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.fill=i;break}})},o=r=>{const i={name:"Select Wall Fill",timestamp:Date.now(),oldValue:t.fill,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.value)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t.fill,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Ul.Full,children:B.t("wallMenu.Full",e)}),h.jsx(We,{style:{width:"100%"},value:Ul.Partial,children:B.t("wallMenu.Partial",e)}),h.jsx(We,{style:{width:"100%"},value:Ul.Empty,children:B.t("wallMenu.Empty",e)})]})})})},Z8o=({wall:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.openToOutside=i;break}})},o=r=>{const i={name:"Set Open to Outside",timestamp:Date.now(),oldValue:!!t.openToOutside,newValue:r.target.checked,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.openToOutside,onChange:o,children:B.t("wallMenu.OpenToOutside",e)})})},Wce=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"doorCount",lockedKey:"lockedDoorCount",objectType:z.Door},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"polygonCount",lockedKey:"lockedPolygonCount",objectType:z.Polygon},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],e7o=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${B.t("wallMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisWall",n)} (${e} ${B.t("wallMenu.SolarPanels",n)})`;break}case z.Window:{o=`${B.t("wallMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllWindowsOnThisWall",n)} (${e} ${B.t("wallMenu.Windows",n)})`;break}case z.Door:{o=`${B.t("wallMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllDoorsOnThisWall",n)} (${e} ${B.t("wallMenu.Doors",n)})`;break}case z.Sensor:{o=`${B.t("wallMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllSensorsOnThisWall",n)} (${e} ${B.t("wallMenu.Sensors",n)})`;break}case z.Light:{o=`${B.t("wallMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllLightsOnThisWall",n)} (${e} ${B.t("wallMenu.Lights",n)})`;break}case z.Polygon:{o=`${B.t("wallMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${B.t("wallMenu.DoYouReallyWantToRemoveAllPolygonsOnThisWall",n)} (${e} ${B.t("wallMenu.Polygons",n)})`;break}}return{itemLabel:o,modalTitle:r}},Nce=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],t7o=(t,e,n)=>{const o=[],r={lng:H.getState().language};return Wce.forEach(({key:i,objectType:a})=>{const l=Nce(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=e7o(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-wall`,label:h.jsx(J8o,{wall:t,objectType:a,modalTitle:c,children:s})})}}),Wce.forEach(({key:i,objectType:a})=>{const l=Nce(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-wall`,label:h.jsxs(MEe,{wall:t,objectType:a,lock:!0,children:[B.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),Wce.forEach(({lockedKey:i,objectType:a})=>{const l=Nce(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(MEe,{wall:t,objectType:a,lock:!1,children:[B.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!0,children:[B.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!1,children:[B.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},n7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),c=Kt(),[u,d]=vne((s==null?void 0:s.parapet.color)??"#ffffff"),f=(S,v)=>{e(b=>{for(const T of b.elements)if(T.id===S&&T.type===z.Wall&&!T.locked){T.parapet.color=v;break}})},p=S=>{if(!s)return;const v=ye.getAllConnectedWalls(s);v.length!==0&&e(b=>{for(const T of v)if(!T.locked)for(const R of b.elements)R.id===T.id&&R.type===z.Wall&&(R.parapet.color=S)})},m=(S,v)=>{e(b=>{for(const T of b.elements)T.parentId===S&&T.type===z.Wall&&!T.locked&&(T.parapet.color=v)})},y=S=>{e(v=>{for(const b of v.elements)b.type===z.Wall&&!b.locked&&(b.parapet.color=S)})},w=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&S.has(T.id)&&(T.parapet.color=v)})},x=S=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.parapet.color&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.parapet.color&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of n)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.parapet.color&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.parapet.color&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.parapet.color))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(r){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.parapet.color??"#ffffff");const b={name:"Set Parapet Color for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{w(b.oldValues,b.newValue)}};o(b),w(v,S),a(i+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&v.set(T.id,T.parapet.color??"#ffffff");const b={name:"Set Parapet Color for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{y(b.newValue)}};o(b),y(S),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const T of n)T.type===z.Wall&&T.foundationId===s.foundationId&&v.set(T.id,T.parapet.color??"#ffffff");const b={name:"Set Parapet Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{b.groupId&&m(b.groupId,b.newValue)}};o(b),m(s.foundationId,S),a(i+1)}break;case ie.AllConnectedObjects:if(s){const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)b.set(R.id,R.color??"#ffffff");const T={name:"Set Parapet Color for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};o(T),p(S),a(i+1)}break;default:if(s){const v=l(s.id),b=(v==null?void 0:v.parapet.color)??s.parapet.color??"#ffffff",T={name:"Set Parapet Color of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(T.changedElementId,T.oldValue)},redo:()=>{f(T.changedElementId,T.newValue)}};o(T),f(s.id,S),a(i+1)}}e(v=>{v.actionState.wallParapet.color=S})}},P=()=>{C(u)},A=()=>{t(!1)};return h.jsx(ro,{width:640,title:B.t("wallMenu.ParapetColor",c),onApply:P,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u,onChangeComplete:d})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",c)})]})})})]})})},Vut="/aladdin/assets/wall_01_menu-BlJdKfby.png",Gut="/aladdin/assets/wall_02_menu-DfsmvvWJ.png",Xut="/aladdin/assets/wall_03_menu-B95_FEuA.png",Jut="/aladdin/assets/wall_04_menu-D-Kn25E7.png",Kut="/aladdin/assets/wall_05_menu-DGgjaMY9.png",$ut="/aladdin/assets/wall_06_menu-EOIch2eu.png",qut="/aladdin/assets/wall_07_menu-DvXS_qn2.png",Qut="/aladdin/assets/wall_08_menu-CfftE2pF.png",Zut="/aladdin/assets/wall_09_menu-_O8A0WOE.png",e0t="/aladdin/assets/wall_10_menu-B5QfhD3g.png",o7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),[c,u]=g.useState((s==null?void 0:s.parapet.textureType)??Jo.Default),d=Kt(),{Option:f}=Ko,p=(v,b)=>{e(T=>{for(const R of T.elements)if(R.type===z.Wall&&R.id===v&&!R.locked){R.parapet.textureType=b;break}})},m=v=>{if(!s)return;const b=ye.getAllConnectedWalls(s);b.length!==0&&e(T=>{for(const R of b)if(!R.locked)for(const M of T.elements)M.id===R.id&&M.type===z.Wall&&(M.parapet.textureType=v)})},y=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&R.foundationId===v&&!R.locked&&(R.parapet.textureType=b)})},w=v=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&(T.parapet.textureType=v)})},x=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&!R.locked&&v.has(R.id)&&(R.parapet.textureType=b)})},C=v=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.parapet.textureType&&!b.locked&&H.getState().selectedElementIdSet.has(b.id))return!0;break}case ie.AllObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.parapet.textureType&&!b.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.Wall&&b.foundationId===s.foundationId&&v!==b.parapet.textureType&&!b.locked)return!0;break}case ie.AllConnectedObjects:{const b=ye.getAllConnectedWalls(s);for(const T of b)if(v!==T.parapet.textureType&&!T.locked)return!0;break}default:{if(v!==(s==null?void 0:s.parapet.textureType))return!0;break}}return!1}},P=v=>{if(s&&C(v)){switch(r){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.parapet.textureType??Jo.Default);const T={name:"Set Parapet Texture for Selected Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{x(T.oldValues,T.newValue)}};o(T),x(b,v),a(i+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&b.set(R.id,R.parapet.textureType??Jo.Default);const T={name:"Set Parapet Texture for All Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{w(T.newValue)}};o(T),w(v),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const b=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===s.foundationId&&!R.locked&&b.set(R.id,R.parapet.textureType);const T={name:"Set Parapet Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:s.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{T.groupId&&y(T.groupId,T.newValue)}};o(T),y(s.foundationId,v),a(i+1)}break;case ie.AllConnectedObjects:if(s){const b=ye.getAllConnectedWalls(s),T=new Map;for(const M of b)T.set(M.id,M.parapet.textureType);const R={name:"Set Parapet Texture for All Connected Walls",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{m(R.newValue)}};o(R),m(v),a(i+1)}break;default:if(s){const b=l(s.id),T=(b==null?void 0:b.parapet.textureType)??s.parapet.textureType,R={name:"Set Parapet Texture of Selected Wall",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(s.id,v),a(i+1)}}e(b=>{b.actionState.wallParapet.textureType=v})}},A=()=>{t(!1)},S=()=>{P(c)};return h.jsx(ro,{width:550,title:B.t("word.Texture",d),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:c,onChange:u,children:[h.jsxs(f,{value:Jo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",d)]},Jo.NoTexture),h.jsxs(f,{value:Jo.Default,children:[h.jsx("img",{alt:Jo.Default,src:k3e,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.TextureDefault",d)]},Jo.Default),h.jsxs(f,{value:Jo.Texture01,children:[h.jsx("img",{alt:Jo.Texture01,src:Vut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture01",d)]},Jo.Texture01),h.jsxs(f,{value:Jo.Texture02,children:[h.jsx("img",{alt:Jo.Texture02,src:Gut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture02",d)]},Jo.Texture02),h.jsxs(f,{value:Jo.Texture03,children:[h.jsx("img",{alt:Jo.Texture03,src:Xut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture03",d)]},Jo.Texture03),h.jsxs(f,{value:Jo.Texture04,children:[h.jsx("img",{alt:Jo.Texture04,src:Jut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture04",d)]},Jo.Texture04),h.jsxs(f,{value:Jo.Texture05,children:[h.jsx("img",{alt:Jo.Texture05,src:Kut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture05",d)]},Jo.Texture05),h.jsxs(f,{value:Jo.Texture06,children:[h.jsx("img",{alt:Jo.Texture06,src:$ut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture06",d)]},Jo.Texture06),h.jsxs(f,{value:Jo.Texture07,children:[h.jsx("img",{alt:Jo.Texture07,src:qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture07",d)]},Jo.Texture07),h.jsxs(f,{value:Jo.Texture08,children:[h.jsx("img",{alt:Jo.Texture08,src:Qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture08",d)]},Jo.Texture08),h.jsxs(f,{value:Jo.Texture09,children:[h.jsx("img",{alt:Jo.Texture09,src:Zut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture09",d)]},Jo.Texture09),h.jsxs(f,{value:Jo.Texture10,children:[h.jsx("img",{alt:Jo.Texture10,src:e0t,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture10",d)]},Jo.Texture10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:v=>H.getState().setWallActionScope(v.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",d)})]})})})]})})},Uce=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=H(Qn),s=H(Fn),c=H(o6),u=H(no),d=H(qn),f=H(pn),p=g.useRef(t.parapet[n]),m=Kt(),y=R=>{f(M=>{switch(n){case"copingsHeight":M.actionState.wallParapet.copingsHeight=R;break;case"copingsWidth":M.actionState.wallParapet.copingsWidth=R;break;case"parapetHeight":M.actionState.wallParapet.parapetHeight=R;break}})},w=(R,M)=>{f(D=>{for(const k of D.elements)if(k.id===R&&k.type===z.Wall&&!k.locked){k.parapet[n]=M;break}}),y(M)},x=R=>{const M=ye.getAllConnectedWalls(t);M.length!==0&&(f(D=>{for(const k of M)if(!k.locked)for(const N of D.elements)N.id===k.id&&N.type===z.Wall&&(N.parapet[n]=R)}),y(R))},C=(R,M)=>{f(D=>{for(const k of D.elements)k.parentId===R&&k.type===z.Wall&&!k.locked&&(k.parapet[n]=M)}),y(M)},P=R=>{f(M=>{for(const D of M.elements)D.type===z.Wall&&!D.locked&&(D.parapet[n]=R)}),y(R)},A=(R,M)=>{f(D=>{for(const k of D.elements)k.type===z.Wall&&!k.locked&&R.has(k.id)&&(k.parapet[n]=M)}),y(M)},S=R=>{switch(c){case ie.AllSelectedObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M.parapet[n]&&!M.locked&&H.getState().selectedElementIdSet.has(M.id))return!0;break}case ie.AllObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M.parapet[n]&&!M.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const M of l)if(M.type===z.Wall&&M.foundationId===t.foundationId&&R!==M.parapet[n]&&!M.locked)return!0;break}case ie.AllConnectedObjects:{const M=ye.getAllConnectedWalls(t);for(const D of M)if(R!==D.parapet[n]&&!D.locked)return!0;break}default:{if(R!==t.parapet[n])return!0;break}}return!1},v=R=>{if(t&&S(R))switch(c){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.parapet[n]);const D={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{A(D.oldValues,D.newValue)}};s(D),A(M,R),d(u+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&M.set(k.id,k.parapet[n]);const D={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.newValue)}};s(D),P(R),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const M=new Map;for(const k of l)k.type===z.Wall&&k.foundationId===t.foundationId&&M.set(k.id,k.parapet[n]);const D={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&C(D.groupId,D.newValue)}};s(D),C(t.foundationId,R),d(u+1)}break;case ie.AllConnectedObjects:if(t){const M=ye.getAllConnectedWalls(t),D=new Map;for(const N of M)D.set(N.id,N.parapet[n]);const k={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:D,newValue:R,undo:()=>{for(const[N,U]of k.oldValues.entries())w(N,U)},redo:()=>{x(k.newValue)}};s(k),x(R),d(u+1)}break;default:if(t){const M=t.parapet[n],D={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{w(D.changedElementId,D.oldValue)},redo:()=>{w(D.changedElementId,D.newValue)}};s(D),w(t.id,R),d(u+1)}}},b=()=>{a(!1)},T=()=>{v(p.current)};return h.jsx(ro,{width:550,title:B.t(`wallMenu.${e}`,m),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t.parapet[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",m),": [",o.toString(),"] ",i]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:R=>H.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",m)})]})})})]})})};var NG=(t=>(t.ParapetHeight="ParapetHeight",t.CopingsHeight="CopingsHeight",t.CopingsWidth="CopingsWidth",t))(NG||{});const r7o={ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},jce=({Dialog:t,wall:e,dataType:n,children:o})=>{const r=Kt(),[i,a]=g.useState(!1),l=()=>{H.getState().setApplyCount(0),a(!0)},s=r7o[n];return h.jsxs(h.Fragment,{children:[h.jsx(ln,{noPadding:!0,onClick:l,children:o}),i&&h.jsx(t,{wall:e,dataType:n,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?B.t(s.unit,r):void 0,setDialogVisible:a})]})},i7o=t=>{const e={lng:H.getState().language},n=[];return n.push({key:"parapet-checkbox",label:h.jsx(K8o,{wall:t})}),t.parapet.display&&n.push({type:"divider"},{key:"parapet-color",label:h.jsxs(Zn,{noPadding:!0,Dialog:n7o,children:[B.t("wallMenu.ParapetColor",e)," ..."]})},{key:"parapet-texture",label:h.jsxs(Zn,{noPadding:!0,Dialog:o7o,children:[B.t("wallMenu.ParapetTexture",e)," ..."]})},{key:"parapet-height",label:h.jsxs(jce,{wall:t,dataType:NG.ParapetHeight,Dialog:Uce,children:[B.t("wallMenu.ParapetHeight",e)," ..."]})},{key:"copings-height",label:h.jsxs(jce,{wall:t,dataType:NG.CopingsHeight,Dialog:Uce,children:[B.t("wallMenu.CopingsHeight",e)," ..."]})},{key:"copings-width",label:h.jsxs(jce,{wall:t,dataType:NG.CopingsWidth,Dialog:Uce,children:[B.t("wallMenu.CopingsWidth",e)," ..."]})}),n},hR=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=H(Qn),s=H(Fn),c=H(o6),u=H(no),d=H(qn),f=H(pn),p=g.useRef(t[n]),m=Kt(),y=R=>{f(M=>{switch(n){case"ly":M.actionState.wallThickness=R;break;case"lz":M.actionState.wallHeight=R;break;case"opacity":M.actionState.wallOpacity=R;break;case"structureSpacing":M.actionState.wallStructureSpacing=R;break;case"structureWidth":M.actionState.wallStructureWidth=R;break;case"eavesLength":M.actionState.wallEavesLength=R;break}})},w=(R,M)=>{f(D=>{for(const k of D.elements)if(k.id===R&&k.type===z.Wall&&!k.locked){k[n]=M;break}}),y(M)},x=R=>{const M=ye.getAllConnectedWalls(t);M.length!==0&&(f(D=>{for(const k of M)if(!k.locked)for(const N of D.elements)N.id===k.id&&N.type===z.Wall&&(N[n]=R)}),y(R))},C=(R,M)=>{f(D=>{for(const k of D.elements)k.parentId===R&&k.type===z.Wall&&!k.locked&&(k[n]=M)}),y(M)},P=R=>{f(M=>{for(const D of M.elements)D.type===z.Wall&&!D.locked&&(D[n]=R)}),y(R)},A=(R,M)=>{f(D=>{for(const k of D.elements)k.type===z.Wall&&!k.locked&&R.has(k.id)&&(k[n]=M)}),y(M)},S=R=>{switch(c){case ie.AllSelectedObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M[n]&&!M.locked&&H.getState().selectedElementIdSet.has(M.id))return!0;break}case ie.AllObjectsOfThisType:{for(const M of l)if(M.type===z.Wall&&R!==M[n]&&!M.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const M of l)if(M.type===z.Wall&&M.foundationId===t.foundationId&&R!==M[n]&&!M.locked)return!0;break}case ie.AllConnectedObjects:{const M=ye.getAllConnectedWalls(t);for(const D of M)if(R!==D[n]&&!D.locked)return!0;break}default:{if(R!==t[n])return!0;break}}return!1},v=R=>{if(t&&S(R))switch(c){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k[n]);const D={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{A(D.oldValues,D.newValue)}};s(D),A(M,R),d(u+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of l)k.type===z.Wall&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.newValue)}};s(D),P(R),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const M=new Map;for(const k of l)k.type===z.Wall&&k.foundationId===t.foundationId&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&C(D.groupId,D.newValue)}};s(D),C(t.foundationId,R),d(u+1)}break;case ie.AllConnectedObjects:if(t){const M=ye.getAllConnectedWalls(t),D=new Map;for(const N of M)D.set(N.id,N[n]);const k={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:D,newValue:R,undo:()=>{for(const[N,U]of k.oldValues.entries())w(N,U)},redo:()=>{x(k.newValue)}};s(k),x(R),d(u+1)}break;default:if(t){const M=t[n],D={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{w(D.changedElementId,D.oldValue)},redo:()=>{w(D.changedElementId,D.newValue)}};s(D),w(t.id,R),d(u+1)}}},b=()=>{p.current=t[n],a(!1)},T=()=>{v(p.current)};return h.jsx(ro,{width:550,title:B.t(`wallMenu.${e}`,m),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",m),": [",o.toString(),"] ",i]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:R=>H.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",m)})]})})})]})})},pR=({Dialog:t,noPadding:e,dataType:n,children:o})=>{const r=Kt(),[i,a]=g.useState(!1),l=ao(z.Wall),s=()=>{H.getState().setApplyCount(0),a(!0)},c=h7o[n];return h.jsxs(h.Fragment,{children:[h.jsx(ln,{noPadding:e,onClick:s,children:o}),i&&l&&h.jsx(t,{wall:l,dataType:n,attributeKey:c.attributeKey,range:c.range,step:c.step,unit:c.unit?B.t(c.unit,r):void 0,setDialogVisible:a})]})},a7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),[c,u]=vne((s==null?void 0:s.structureColor)??"#ffffff"),d=Kt(),f=(S,v)=>{e(b=>{for(const T of b.elements)if(T.id===S&&T.type===z.Wall&&!T.locked){T.structureColor=v;break}})},p=S=>{if(!s)return;const v=ye.getAllConnectedWalls(s);v.length!==0&&e(b=>{for(const T of v)if(!T.locked)for(const R of b.elements)R.id===T.id&&R.type===z.Wall&&(R.structureColor=S)})},m=(S,v)=>{e(b=>{for(const T of b.elements)T.parentId===S&&T.type===z.Wall&&!T.locked&&(T.structureColor=v)})},y=S=>{e(v=>{for(const b of v.elements)b.type===z.Wall&&!b.locked&&(b.structureColor=S)})},w=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&S.has(T.id)&&(T.color=v)})},x=S=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.structureColor&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.structureColor&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of n)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.structureColor&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.structureColor&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.structureColor))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(r){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.structureColor??"#ffffff");const b={name:"Set Structure Color for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{w(b.oldValues,b.newValue)}};o(b),w(v,S),a(i+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&v.set(T.id,T.structureColor??"#ffffff");const b={name:"Set Structure Color for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{y(b.newValue)}};o(b),y(S),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const T of n)T.type===z.Wall&&T.foundationId===s.foundationId&&v.set(T.id,T.structureColor??"#ffffff");const b={name:"Set Structure Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{b.groupId&&m(b.groupId,b.newValue)}};o(b),m(s.foundationId,S),a(i+1)}break;case ie.AllConnectedObjects:if(s){const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)b.set(R.id,R.color??"#ffffff");const T={name:"Set Structure Color for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};o(T),p(S),a(i+1)}break;default:if(s){const v=l(s.id),b=(v==null?void 0:v.structureColor)??s.structureColor??"#ffffff",T={name:"Set Structure Color of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(T.changedElementId,T.oldValue)},redo:()=>{f(T.changedElementId,T.newValue)}};o(T),f(s.id,S),a(i+1)}}e(v=>{v.actionState.wallStructureColor=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:640,title:B.t("wallMenu.StructureColor",d),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:u})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",d)})]})})})]})})};var Og=(t=>(t.Height="Height",t.Opacity="Opacity",t.StructureSpacing="StructureSpacing",t.StructureWidth="StructureWidth",t.Thickness="Thickness",t.EavesLength="EavesLength",t))(Og||{});const l7o=t=>{const e=[],n={lng:H.getState().language};return e.push({key:"wall-structure-submenu-radio-group",label:h.jsx($8o,{wall:t}),style:{backgroundColor:"white"}}),t.wallStructure!==Tc.Default&&e.push({type:"divider"},{key:"wall-structure-spacing",label:h.jsxs(pR,{noPadding:!0,dataType:Og.StructureSpacing,Dialog:hR,children:[B.t(`wallMenu.${Og.StructureSpacing}`,n)," ..."]})},{key:"wall-structure-width",label:h.jsxs(pR,{noPadding:!0,dataType:Og.StructureWidth,Dialog:hR,children:[B.t(`wallMenu.${Og.StructureWidth}`,n)," ..."]})},{key:"wall-structure-color",label:h.jsxs(Zn,{noPadding:!0,Dialog:a7o,children:[B.t("wallMenu.StructureColor",n)," ..."]})}),e},s7o=t=>{const e=[];return e.push({key:"wall-fill-radio-group",label:h.jsx(Q8o,{wall:t}),style:{backgroundColor:"white"}}),t.fill!==Ul.Full&&e.push({type:"divider"},{key:"wall-open-to-outside-checkbox",label:h.jsx(Z8o,{wall:t})}),e},c7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(o6),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Wall),[c,u]=g.useState((s==null?void 0:s.rValue)??U9),[d,f]=g.useState(ye.toRValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.rValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:{for(const v of e)if(v.type===z.Wall&&S!==v.rValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of e)if(v.type===z.Wall&&S!==v.rValue&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of e)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.rValue&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.rValue&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.rValue))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Wall&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;v.set(T.id,R.rValue??U9),m(R.id,S)}const b={name:"Set R-Value for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Wall&&!T.locked){const R=T;v.set(T.id,R.rValue??U9),m(R.id,S)}const b={name:"Set R-Value for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s!=null&&s.foundationId){const v=new Map;for(const T of e)if(T.type===z.Wall&&T.foundationId===s.foundationId&&!T.locked){const R=T;v.set(T.id,R.rValue??U9),m(R.id,S)}const b={name:"Set R-Value for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;case ie.AllConnectedObjects:if(s){const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)if(!R.locked){const M=R;b.set(R.id,M.rValue??U9),m(M.id,S)}const T={name:"Set R-Value for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{y(T.oldValues)},redo:()=>{w(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const b=a(s.id).rValue??s.rValue??U9,T={name:"Set Wall R-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}}l(v=>{v.actionState.wallRValue=S})}},P=()=>{u((s==null?void 0:s.rValue)??U9),t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("word.RValue",p)+" "}(${B.t("word.ThermalResistance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toRValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toRValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",p)})]})})})]})})},u7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(o6),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Wall),[c,u]=g.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.volumetricHeatCapacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Wall&&P!==S.volumetricHeatCapacity&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Wall&&P!==S.volumetricHeatCapacity&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Wall&&S.foundationId===s.foundationId&&P!==S.volumetricHeatCapacity&&!S.locked)return!0;break;case ie.AllConnectedObjects:const A=ye.getAllConnectedWalls(s);for(const S of A)if(P!==S.volumetricHeatCapacity&&!S.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Wall&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)){const b=v;A.set(v.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const S={name:"Set Volumetric Heat Capacity for Selected Walls",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Wall&&!v.locked){const b=v;A.set(v.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const S={name:"Set Volumetric Heat Capacity for All Walls",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(s!=null&&s.foundationId){const A=new Map;for(const v of e)if(v.type===z.Wall&&v.foundationId===s.foundationId&&!v.locked){const b=v;A.set(v.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const S={name:"Set Volumetric Heat Capacity for All Walls Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break}case ie.AllConnectedObjects:{if(s){const A=ye.getAllConnectedWalls(s),S=new Map;for(const b of A)if(!b.locked){const T=b;S.set(b.id,T.volumetricHeatCapacity??.5),f(T.id,P)}const v={name:"Set Volumetric Heat Capacity for All Connected Walls",timestamp:Date.now(),oldValues:S,newValue:P,undo:()=>{p(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),i(r+1)}break}default:{if(s){const S=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,v={name:"Set Volumetric Heat Capacity of Wall",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}break}}l(A=>{A.actionState.wallVolumetricHeatCapacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setWallActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",d)})]})})})]})})},d7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=Kt(),c=ao(z.Wall),[u,d]=g.useState((c==null?void 0:c.textureType)??Jo.Default),{Option:f}=Ko,p=(v,b)=>{e(T=>{for(const R of T.elements)if(R.type===z.Wall&&R.id===v&&!R.locked){R.textureType=b;break}})},m=v=>{if(!c)return;const b=ye.getAllConnectedWalls(c);b.length!==0&&e(T=>{for(const R of b)if(!R.locked)for(const M of T.elements)M.id===R.id&&M.type===z.Wall&&(M.textureType=v)})},y=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&R.foundationId===v&&!R.locked&&(R.textureType=b)})},w=v=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&(T.textureType=v)})},x=(v,b)=>{e(T=>{for(const R of T.elements)R.type===z.Wall&&!R.locked&&v.has(R.id)&&(R.textureType=b)})},C=v=>{if(c){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.textureType&&!b.locked&&H.getState().selectedElementIdSet.has(b.id))return!0;break}case ie.AllObjectsOfThisType:{for(const b of n)if(b.type===z.Wall&&v!==b.textureType&&!b.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.Wall&&b.foundationId===c.foundationId&&v!==b.textureType&&!b.locked)return!0;break}case ie.AllConnectedObjects:{const b=ye.getAllConnectedWalls(c);for(const T of b)if(v!==T.textureType&&!T.locked)return!0;break}default:{if(v!==(c==null?void 0:c.textureType))return!0;break}}return!1}},P=v=>{if(c&&C(v)){switch(r){case ie.AllSelectedObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&H.getState().selectedElementIdSet.has(R.id)&&b.set(R.id,R.textureType??Jo.Default);const T={name:"Set Texture for Selected Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{x(T.oldValues,T.newValue)}};o(T),x(b,v),a(i+1);break}case ie.AllObjectsOfThisType:{const b=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&b.set(R.id,R.textureType??Jo.Default);const T={name:"Set Texture for All Walls",timestamp:Date.now(),oldValues:b,newValue:v,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{w(T.newValue)}};o(T),w(v),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const b=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===c.foundationId&&!R.locked&&b.set(R.id,R.textureType);const T={name:"Set Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:b,newValue:v,groupId:c.foundationId,undo:()=>{for(const[R,M]of T.oldValues.entries())p(R,M)},redo:()=>{T.groupId&&y(T.groupId,T.newValue)}};o(T),y(c.foundationId,v),a(i+1)}break;case ie.AllConnectedObjects:if(c){const b=ye.getAllConnectedWalls(c),T=new Map;for(const M of b)T.set(M.id,M.textureType);const R={name:"Set Texture for All Connected Walls",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{m(R.newValue)}};o(R),m(v),a(i+1)}break;default:if(c){const b=l(c.id),T=(b==null?void 0:b.textureType)??c.textureType,R={name:"Set Texture of Selected Wall",timestamp:Date.now(),oldValue:T,newValue:v,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(c.id,v),a(i+1)}}e(b=>{b.actionState.wallTexture=v})}},A=()=>{t(!1)},S=()=>{P(u)};return h.jsx(ro,{width:550,title:B.t("word.Texture",s),onApply:S,onClose:A,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(f,{value:Jo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",s)]},Jo.NoTexture),h.jsxs(f,{value:Jo.Default,children:[h.jsx("img",{alt:Jo.Default,src:k3e,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.TextureDefault",s)]},Jo.Default),h.jsxs(f,{value:Jo.Texture01,children:[h.jsx("img",{alt:Jo.Texture01,src:Vut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture01",s)]},Jo.Texture01),h.jsxs(f,{value:Jo.Texture02,children:[h.jsx("img",{alt:Jo.Texture02,src:Gut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture02",s)]},Jo.Texture02),h.jsxs(f,{value:Jo.Texture03,children:[h.jsx("img",{alt:Jo.Texture03,src:Xut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture03",s)]},Jo.Texture03),h.jsxs(f,{value:Jo.Texture04,children:[h.jsx("img",{alt:Jo.Texture04,src:Jut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture04",s)]},Jo.Texture04),h.jsxs(f,{value:Jo.Texture05,children:[h.jsx("img",{alt:Jo.Texture05,src:Kut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture05",s)]},Jo.Texture05),h.jsxs(f,{value:Jo.Texture06,children:[h.jsx("img",{alt:Jo.Texture06,src:$ut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture06",s)]},Jo.Texture06),h.jsxs(f,{value:Jo.Texture07,children:[h.jsx("img",{alt:Jo.Texture07,src:qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture07",s)]},Jo.Texture07),h.jsxs(f,{value:Jo.Texture08,children:[h.jsx("img",{alt:Jo.Texture08,src:Qut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture08",s)]},Jo.Texture08),h.jsxs(f,{value:Jo.Texture09,children:[h.jsx("img",{alt:Jo.Texture09,src:Zut,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture09",s)]},Jo.Texture09),h.jsxs(f,{value:Jo.Texture10,children:[h.jsx("img",{alt:Jo.Texture10,src:e0t,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("wallMenu.Texture10",s)]},Jo.Texture10)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:v=>H.getState().setWallActionScope(v.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",s)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",s)})]})})})]})})},f7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(o6),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Wall),c=Kt(),[u,d]=vne((s==null?void 0:s.color)??"#ffffff"),f=(S,v)=>{e(b=>{for(const T of b.elements)if(T.type===z.Wall&&T.id===S&&!T.locked){T.color=v;break}})},p=S=>{if(!s)return;const v=ye.getAllConnectedWalls(s);v.length!==0&&e(b=>{for(const T of v)if(!T.locked)for(const R of b.elements)R.id===T.id&&R.type===z.Wall&&(R.color=S)})},m=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&T.foundationId===S&&!T.locked&&(T.color=v)})},y=S=>{e(v=>{for(const b of v.elements)b.type===z.Wall&&!b.locked&&(b.color=S)})},w=(S,v)=>{e(b=>{for(const T of b.elements)T.type===z.Wall&&!T.locked&&S.has(T.id)&&(T.color=v)})},x=S=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.color&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break}case ie.AllObjectsOfThisType:{for(const v of n)if(v.type===z.Wall&&S!==v.color&&!v.locked)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const v of n)if(v.type===z.Wall&&v.foundationId===s.foundationId&&S!==v.color&&!v.locked)return!0;break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s);for(const b of v)if(S!==b.color&&!b.locked)return!0;break}default:{if(S!==(s==null?void 0:s.color))return!0;break}}return!1}},C=S=>{if(s&&x(S)){switch(r){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&H.getState().selectedElementIdSet.has(T.id)&&v.set(T.id,T.color??"#ffffff");const b={name:"Set Color for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{w(b.oldValues,b.newValue)}};o(b),w(v,S),a(i+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of n)T.type===z.Wall&&v.set(T.id,T.color??"#ffffff");const b={name:"Set Color for All Walls",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{y(b.newValue)}};o(b),y(S),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const v=new Map;for(const T of n)T.type===z.Wall&&T.foundationId===s.foundationId&&v.set(T.id,T.color??"#ffffff");const b={name:"Set Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{for(const[T,R]of b.oldValues.entries())f(T,R)},redo:()=>{b.groupId&&m(b.groupId,b.newValue)}};o(b),m(s.foundationId,S),a(i+1)}break}case ie.AllConnectedObjects:{const v=ye.getAllConnectedWalls(s),b=new Map;for(const R of v)b.set(R.id,R.color??"#ffffff");const T={name:"Set Color for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:S,undo:()=>{for(const[R,M]of T.oldValues.entries())f(R,M)},redo:()=>{p(T.newValue)}};o(T),p(S),a(i+1);break}default:{if(s){const v=l(s.id),b=(v==null?void 0:v.color)??s.color??"#ffffff",T={name:"Set Color of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(T.changedElementId,T.oldValue)},redo:()=>{f(T.changedElementId,T.newValue)}};o(T),f(s.id,S),a(i+1)}break}}e(v=>{v.actionState.wallColor=S})}},P=()=>{t(!1)},A=()=>{C(u)};return h.jsx(ro,{width:640,title:B.t("wallMenu.Color",c),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u,onChangeComplete:d})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:S=>H.getState().setWallActionScope(S.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("wallMenu.OnlyThisWall",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllConnectedObjects,children:B.t("wallMenu.AllConnectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("wallMenu.AllSelectedWalls",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("wallMenu.AllWalls",c)})]})})})]})})},h7o={Height:{attributeKey:"lz",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},Opacity:{attributeKey:"opacity",range:[0,1],step:.01},StructureSpacing:{attributeKey:"structureSpacing",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},StructureWidth:{attributeKey:"structureWidth",range:[.01,1],step:.1,unit:"word.MeterAbbreviation"},Thickness:{attributeKey:"ly",range:[.1,1],step:.01,unit:"word.MeterAbbreviation"},EavesLength:{attributeKey:"eavesLength",range:[-.1,5],step:.01,unit:"word.MeterAbbreviation"},ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},p7o=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(ye.isLegalOnWall(e.type))return!0}return!1},g7o=t=>{const e=[];if(t.type!==z.Wall)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=H.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1);return p7o()&&e.push({key:"wall-paste",label:h.jsx(yI,{})}),e.push({key:"wall-copy",label:h.jsx(ad,{})}),o&&e.push({key:"wall-cut",label:h.jsx(ld,{})}),e.push({key:"wall-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(a.gotSome()&&e.push({key:"lock-unlock-clear-on-wall",label:h.jsx(ln,{children:B.t("word.Elements",r)}),children:t7o(n,a,l)}),e.push({key:"wall-parapet",label:h.jsx(ln,{children:B.t("wallMenu.Parapet",r)}),children:i7o(n)}),e.push({key:"wall-structure",label:h.jsx(ln,{children:B.t("wallMenu.WallStructure",r)}),children:l7o(n)}),n.wallStructure!==Tc.Default&&e.push({key:"wall-opacity",label:h.jsxs(pR,{dataType:Og.Opacity,Dialog:hR,children:[B.t(`wallMenu.${Og.Opacity}`,r)," ..."]})}),e.push({key:"wall-fill",label:h.jsx(ln,{children:B.t("wallMenu.Fill",r)}),children:s7o(n)},{key:"add-polygon-on-wall",label:h.jsx(q8o,{wall:n})},{key:"wall-thickness",label:h.jsxs(pR,{dataType:Og.Thickness,Dialog:hR,children:[B.t(`wallMenu.${Og.Thickness}`,r)," ..."]})},{key:"wall-height",label:h.jsxs(pR,{dataType:Og.Height,Dialog:hR,children:[B.t(`wallMenu.${Og.Height}`,r)," ..."]})},{key:"wall-eaves-length",label:h.jsxs(pR,{dataType:Og.EavesLength,Dialog:hR,children:[B.t(`wallMenu.${Og.EavesLength}`,r)," ..."]})},{key:"wall-r-value",label:h.jsxs(Zn,{Dialog:c7o,children:[B.t("word.RValue",r)," ..."]})},{key:"wall-heat-capacity",label:h.jsxs(Zn,{Dialog:u7o,children:[B.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"wall-texture",label:h.jsxs(Zn,{Dialog:d7o,children:[B.t("wallMenu.Texture",r)," ..."]})},{key:"wall-color",label:h.jsxs(Zn,{Dialog:f7o,children:[B.t("wallMenu.Color",r)," ..."]})})),{items:e}},m7o=xe.memo(({door:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.filled=i;break}})},o=r=>{const i=r.target.checked,a={name:"Filled Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.doorFilled=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:B.t("doorMenu.Filled",e)})})}),y7o=xe.memo(({door:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.doorInterior=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.interior,onChange:o,children:B.t("doorMenu.Interior",e)})})}),A7o=xe.memo(({door:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.doorType=i;break}})},o=r=>{const i={name:"Select Door Type",timestamp:Date.now(),oldValue:t.doorType,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.value),H.getState().set(a=>{a.actionState.doorType=r.target.value})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t.doorType,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Wd.Default,children:B.t("doorMenu.Default",e)}),h.jsx(We,{style:{width:"100%"},value:Wd.Arched,children:B.t("doorMenu.Arched",e)})]})})})}),w7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=H($r),c=ao(z.Door),u=g.useMemo(()=>{const b=c?c.lx:1,T=c?s(c):null;return T?b*T.lx:b},[c==null?void 0:c.lx]),[d,f]=g.useState(u),p=Kt(),m=(b,T)=>{l(R=>{for(const M of R.elements)if(M.id===b&&M.type===z.Door){const D=M,k=s(D);D.lx=k?T/k.lx:T;break}})},y=b=>{for(const[T,R]of b.entries())m(T,R)},w=(b,T)=>{for(const R of b.keys())m(R,T)},x=b=>{if(c){switch(o){case ie.AllSelectedObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}case ie.AllObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of e)if(T.type===z.Door&&T.foundationId===c.foundationId&&!T.locked){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}case ie.OnlyThisSide:{for(const T of e)if(T.type===z.Door&&T.parentId===c.parentId&&!T.locked){const R=s(T);if(R&&b!==T.lx*R.lx)return!0}break}default:{const T=s(c);if(T&&b!==c.lx*T.lx)return!0;break}}return!1}},C=b=>{if(c&&x(b))switch(o){case ie.AllSelectedObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for Selected Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for All Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.foundationId===c.foundationId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for All Doors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case ie.OnlyThisSide:if(c.parentId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.parentId===c.parentId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lx*(N?N.lx:1)),k.lx=N?b/N.lx:b}});const R={name:"Set Width for All Doors On the Same Wall",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.parentId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const T=a(c.id),R=c?s(T):null,M=(T.lx??c.lx??.1)*(R?R.lx:1),D={name:"Set Door Width",timestamp:Date.now(),oldValue:M,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};n(D),m(c.id,b),i(r+1)}}},P=()=>{t(!1)},A=()=>{C(d)},S=c?s(c):null,v=S&&c?2*S.lx*Math.min(Math.abs(.5-c.cx),Math.abs(-.5-c.cx)):100;return h.jsx(ro,{width:550,title:B.t("word.Width",p),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:v,style:{width:120},step:.1,precision:2,value:d,formatter:b=>Number(b).toFixed(2),onChange:b=>f(b)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.1, ",v.toFixed(1),"]",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b=>H.getState().setDoorActionScope(b.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",p)})]})})})]})})},x7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=H($r),c=ao(z.Door),u=g.useMemo(()=>{const b=c?c.lz:1,T=c?s(c):null;return T?b*T.lz:b},[c==null?void 0:c.lz]),[d,f]=g.useState(u),p=Kt(),m=(b,T)=>{l(R=>{for(const M of R.elements)if(M.id===b&&M.type===z.Door){const D=M,k=s(D);D.lz=k?T/k.lz:T,k&&(D.cz=-(k.lz-T)/(2*k.lz));break}})},y=b=>{for(const[T,R]of b.entries())m(T,R)},w=(b,T)=>{for(const R of b.keys())m(R,T)},x=b=>{if(c){switch(o){case ie.AllSelectedObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}case ie.AllObjectsOfThisType:{for(const T of e)if(T.type===z.Door&&!T.locked){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of e)if(T.type===z.Door&&T.foundationId===c.foundationId&&!T.locked){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}case ie.OnlyThisSide:{for(const T of e)if(T.type===z.Door&&T.parentId===c.parentId&&!T.locked){const R=s(T);if(R&&b!==T.lz*R.lz)return!0}break}default:{const T=s(c);if(T&&b!==c.lz*T.lz)return!0;break}}return!1}},C=b=>{if(c&&x(b))switch(o){case ie.AllSelectedObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for Selected Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisType:{const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for All Doors",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.foundationId===c.foundationId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for All Doors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case ie.OnlyThisSide:if(c.parentId){const T=new Map;l(M=>{for(const D of M.elements)if(D.type===z.Door&&D.parentId===c.parentId&&!D.locked){const k=D,N=k?s(k):null;T.set(D.id,k.lz*(N?N.lz:1)),k.lz=N?b/N.lz:b,N&&(k.cz=-(N.lz-b)/(2*N.lz))}});const R={name:"Set Height for All Doors On the Same Wall",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.parentId,undo:()=>{y(R.oldValues)},redo:()=>{w(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const T=a(c.id),R=c?s(T):null,M=(T.lz??c.lz??.2)*(R?R.lz:1),D={name:"Set Door Height",timestamp:Date.now(),oldValue:M,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{m(D.changedElementId,D.oldValue)},redo:()=>{m(D.changedElementId,D.newValue)}};n(D),m(c.id,b),i(r+1)}}},P=()=>{f(u),t(!1)},A=()=>{C(d)},S=c?s(c):null,v=(S==null?void 0:S.lz)??20;return h.jsx(ro,{width:550,title:B.t("word.Height",p),onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:v,style:{width:120},step:.1,precision:2,value:d,formatter:b=>Number(b).toFixed(2),onChange:b=>{b!==null&&f(b)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.1, ",v.toFixed(1),"]",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:b=>H.getState().setDoorActionScope(b.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",p)})]})})})]})})},v7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.opacity)??1),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.opacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.opacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.opacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Door&&A.foundationId===s.foundationId&&P!==A.opacity&&!A.locked)return!0;break;case ie.OnlyThisSide:for(const A of e)if(A.type===z.Door&&A.parentId===s.parentId&&P!==A.opacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.foundationId===s.foundationId&&!b.locked){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.parentId===s.parentId&&!b.locked){const T=b;A.set(b.id,T.opacity??1),T.opacity=P}});const S={name:"Set Opacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).opacity??s.opacity??1,v={name:"Set Opacity of Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.doorOpacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("wallMenu.Opacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},b7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.uValue)??fA),[d,f]=g.useState(ye.toUValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.uValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Door&&S!==v.uValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Door&&S!==v.uValue&&!v.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Door&&v.foundationId===s.foundationId&&S!==v.uValue&&!v.locked)return!0;break;case ie.OnlyThisSide:for(const v of e)if(v.type===z.Door&&v.parentId===s.parentId&&S!==v.uValue&&!v.locked)return!0;break;default:if(S!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for All Doors",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&R.foundationId===s.foundationId&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const v=new Map;l(T=>{for(const R of T.elements)if(R.type===z.Door&&R.parentId===s.parentId&&!R.locked){const M=R;v.set(R.id,M.uValue??fA),M.uValue=S}});const b={name:"Set U-Value for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.parentId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;default:if(s){const b=a(s.id).uValue??s.uValue??fA,T={name:"Set Door U-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}}l(v=>{v.actionState.doorUValue=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("word.UValue",p)+" "}(${B.t("word.ThermalTransmittance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toUValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toUValueInUS(.01),max:ye.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toUValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toUValueInUS(.01).toFixed(3),", ",ye.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setDoorActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",p)})]})})})]})})},S7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.volumetricHeatCapacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.volumetricHeatCapacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Door&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Door&&A.foundationId===(s==null?void 0:s.foundationId)&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;case ie.OnlyThisSide:for(const A of e)if(A.type===z.Door&&A.parentId===(s==null?void 0:s.parentId)&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.foundationId===s.foundationId&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Door&&b.parentId===s.parentId&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,v={name:"Set Volumetric Heat Capacity of Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.doorVolumetricHeatCapacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},T7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(z7),r=H(no),i=H(qn),a=H(pn),l=H(Jn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.textureType)??dr.Default),d=Kt(),{Option:f}=Ko,p=(A,S)=>{a(v=>{for(const b of v.elements)if(b.id===A){b.locked||(b.textureType=S);break}})},m=(A,S)=>{for(const v of A.keys())p(v,S)},y=A=>{for(const[S,v]of A.entries())p(S,v)},w=A=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Door&&A!==S.textureType&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Door&&A!==S.textureType&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Door&&S.foundationId===s.foundationId&&A!==S.textureType&&!S.locked)return!0;break;case ie.OnlyThisSide:for(const S of e)if(S.type===z.Door&&S.parentId===s.parentId&&A!==S.textureType&&!S.locked)return!0;break;default:if(A!==(s==null?void 0:s.textureType))return!0;break}return!1}},x=A=>{if(s&&w(A)){switch(o){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&S.set(b.id,b.textureType??dr.Default);const v={name:"Set Texture for Selected Doors",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&!b.locked&&S.set(b.id,b.textureType??dr.Default);const v={name:"Set Texture for All Doors",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&b.foundationId===s.foundationId&&!b.locked&&S.set(b.id,b.textureType);const v={name:"Set Texture for All Doors Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:s.foundationId,undo:()=>{y(v.oldValues)},redo:()=>{v.groupId&&m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1)}break;case ie.OnlyThisSide:if(s.parentId){const S=new Map;for(const b of H.getState().elements)b.type===z.Door&&b.parentId===s.parentId&&!b.locked&&S.set(b.id,b.textureType);const v={name:"Set Texture for All Doors On the Same Wall",timestamp:Date.now(),oldValues:S,newValue:A,groupId:s.parentId,undo:()=>{y(v.oldValues)},redo:()=>{v.groupId&&m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1)}break;default:if(s){const S=l(s.id),v=S?S.textureType:s.textureType,b={name:"Set Texture of Selected Door",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};n(b),p(s.id,A),i(r+1)}}a(S=>{S.actionState.doorTexture=A})}},C=()=>{t(!1)},P=()=>{x(c)};return h.jsx(ro,{width:550,title:B.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:c,onChange:A=>u(A),children:[h.jsxs(f,{value:dr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",d)]},dr.NoTexture),h.jsxs(f,{value:dr.Default,children:[h.jsx("img",{alt:dr.Default,src:ort,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.TextureDefault",d)]},dr.Default),h.jsxs(f,{value:dr.Texture01,children:[h.jsx("img",{alt:dr.Texture01,src:rrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture01",d)]},dr.Texture01),h.jsxs(f,{value:dr.Texture02,children:[h.jsx("img",{alt:dr.Texture02,src:jpe,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture02",d)]},dr.Texture02),h.jsxs(f,{value:dr.Texture03,children:[h.jsx("img",{alt:dr.Texture03,src:irt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture03",d)]},dr.Texture03),h.jsxs(f,{value:dr.Texture04,children:[h.jsx("img",{alt:dr.Texture04,src:art,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture04",d)]},dr.Texture04),h.jsxs(f,{value:dr.Texture05,children:[h.jsx("img",{alt:dr.Texture05,src:lrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture05",d)]},dr.Texture05),h.jsxs(f,{value:dr.Texture06,children:[h.jsx("img",{alt:dr.Texture06,src:srt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture06",d)]},dr.Texture06),h.jsxs(f,{value:dr.Texture07,children:[h.jsx("img",{alt:dr.Texture07,src:crt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture07",d)]},dr.Texture07),h.jsxs(f,{value:dr.Texture08,children:[h.jsx("img",{alt:dr.Texture08,src:urt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture08",d)]},dr.Texture08),h.jsxs(f,{value:dr.Texture09,children:[h.jsx("img",{alt:dr.Texture09,src:drt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture09",d)]},dr.Texture09),h.jsxs(f,{value:dr.Texture10,children:[h.jsx("img",{alt:dr.Texture10,src:frt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture10",d)]},dr.Texture10),h.jsxs(f,{value:dr.Texture11,children:[h.jsx("img",{alt:dr.Texture11,src:hrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture11",d)]},dr.Texture11),h.jsxs(f,{value:dr.Texture12,children:[h.jsx("img",{alt:dr.Texture12,src:prt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture12",d)]},dr.Texture12),h.jsxs(f,{value:dr.Texture13,children:[h.jsx("img",{alt:dr.Texture13,src:grt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture13",d)]},dr.Texture13),h.jsxs(f,{value:dr.Texture14,children:[h.jsx("img",{alt:dr.Texture14,src:mrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture14",d)]},dr.Texture14),h.jsxs(f,{value:dr.Texture15,children:[h.jsx("img",{alt:dr.Texture15,src:yrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture15",d)]},dr.Texture15),h.jsxs(f,{value:dr.Texture16,children:[h.jsx("img",{alt:dr.Texture16,src:Art,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture16",d)]},dr.Texture16),h.jsxs(f,{value:dr.Texture17,children:[h.jsx("img",{alt:dr.Texture17,src:wrt,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("doorMenu.Texture17",d)]},dr.Texture17)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:A=>H.getState().setDoorActionScope(A.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},P7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(z7),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.color)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.color=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Door&&P!==A.color&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Door&&P!==A.color&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Door&&A.foundationId===(s==null?void 0:s.foundationId)&&P!==A.color&&!A.locked)return!0;break;case ie.OnlyThisSide:for(const A of n)if(A.type===z.Door&&A.parentId===(s==null?void 0:s.parentId)&&P!==A.color&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.parentId===s.parentId&&!s.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.color:s.color)??"#ffffff",v={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}e(A=>{A.actionState.doorColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("word.Color",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},C7o=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(z7),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Door),[c,u]=g.useState((s==null?void 0:s.frameColor)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){!v.locked&&v.type===z.Door&&(v.frameColor=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Door&&!A.locked&&H.getState().selectedElementIdSet.has(A.id)&&P!==A.frameColor)return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Door&&!A.locked&&P!==A.frameColor)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Door&&A.foundationId===(s==null?void 0:s.foundationId)&&!A.locked&&P!==A.frameColor)return!0;break;case ie.OnlyThisSide:for(const A of n)if(A.type===z.Door&&A.parentId===(s==null?void 0:s.parentId)&&!A.locked&&P!==A.frameColor)return!0;break;default:if(P!==(s==null?void 0:s.frameColor))return!0;break}return!1},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&!v.locked&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;case ie.OnlyThisSide:if(s.parentId){const A=new Map;for(const v of H.getState().elements)v.type===z.Door&&v.parentId===s.parentId&&!s.locked&&A.set(v.id,v.frameColor??"#ffffff");const S={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.frameColor:s.frameColor)??"#ffffff",v={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}e(A=>{A.actionState.doorColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("doorMenu.FrameColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c??(s==null?void 0:s.frameColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("doorMenu.OnlyThisDoor",d)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("doorMenu.AllSelectedDoors",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("doorMenu.AllDoors",d)})]})})})]})})},R7o=t=>{const e=[];if(t.type!==z.Door)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"door-copy",label:h.jsx(ad,{})}),o&&e.push({key:"door-cut",label:h.jsx(ld,{})}),e.push({key:"door-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"door-filled",label:h.jsx(m7o,{door:n})},{key:"door-interior",label:h.jsx(y7o,{door:n})}),e.push({key:"door-type-submenu",label:h.jsx(ln,{children:B.t("doorMenu.DoorType",r)}),children:[{key:"door-type-radio-group",label:h.jsx(A7o,{door:n}),style:{backgroundColor:"white"}}]},{key:"door-width",label:h.jsxs(Zn,{Dialog:w7o,children:[B.t("word.Width",r)," ..."]})},{key:"door-height",label:h.jsxs(Zn,{Dialog:x7o,children:[B.t("word.Height",r)," ..."]})}),n.filled&&(e.push({key:"door-u-value",label:h.jsxs(Zn,{Dialog:b7o,children:[B.t("word.UValue",r)," ..."]})},{key:"door-heat-capacity",label:h.jsxs(Zn,{Dialog:S7o,children:[B.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"door-texture",label:h.jsxs(Zn,{Dialog:T7o,children:[B.t("word.Texture",r)," ..."]})},{key:"door-color",label:h.jsxs(Zn,{Dialog:P7o,children:[B.t("word.Color",r)," ..."]})},{key:"door-frame-color",label:h.jsxs(Zn,{Dialog:C7o,children:[B.t("doorMenu.FrameColor",r)," ..."]})}),(n.textureType===dr.Default||n.textureType===dr.NoTexture)&&e.push({key:"door-opacity",label:h.jsxs(Zn,{Dialog:v7o,children:[B.t("wallMenu.Opacity",r)," ..."]})}))),{items:e}},H7o=({windowModel:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,note:a,digit:l,setDialogVisible:s})=>{const c=H(Qn),u=H(Fn),d=H(ZN),f=H(no),p=H(qn),m=H(pn),y=H($r),w=g.useMemo(()=>{const W=t[n],F=y(t);if(F&&t.parentType!==z.Roof){if(n==="lx")return W*F.lx;if(n==="lz")return W*F.lz}return n==="sillWidth"&&W===void 0?.2:W},[n,t]),[x,C]=g.useState(w),P=Kt(),A=(W,F,E)=>{const L=y(W);L&&(F==="lx"||F==="lz")?W.parentType===z.Roof?W[F]=E:W[F]=E/L[F]:W[F]=E},S=(W,F)=>{m(E=>{for(const L of E.elements)if(L.id===W){!L.locked&&L.type===z.Window&&A(L,n,F);break}})},v=(W,F)=>{W&&m(E=>{for(const L of E.elements)!L.locked&&L.type===z.Window&&L.parentId===W&&A(L,n,F)})},b=(W,F)=>{W&&m(E=>{for(const L of E.elements)!L.locked&&L.type===z.Window&&L.foundationId===W&&A(L,n,F)})},T=W=>{m(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&A(E,n,W)})},R=(W,F)=>{m(E=>{for(const L of E.elements)!L.locked&&L.type===z.Window&&W.has(L.id)&&A(L,n,F)})},M=W=>{for(const[F,E]of W.entries())S(F,E)},D=W=>{switch(d){case ie.AllSelectedObjectsOfThisType:{for(const F of c)if(F.type===z.Window&&!F.locked&&H.getState().selectedElementIdSet.has(F.id)){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}case ie.AllObjectsOfThisType:{for(const F of c)if(F.type===z.Window&&!F.locked){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const F of c)if(F.type===z.Window&&F.foundationId===t.foundationId&&!F.locked){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}case ie.OnlyThisSide:{for(const F of c)if(F.type===z.Window&&F.parentId===t.parentId&&!F.locked){const E=F,L=y(E);if(L&&E.parentType!==z.Roof){if(n==="lx"){if(W!==E[n]*L.lx)return!0}else if(n==="lz"){if(W!==E[n]*L.lz)return!0}else if(W!==E[n])return!0}else if(W!==E[n])return!0}break}default:{const F=y(t);if(F&&t.parentType!==z.Roof){if(n==="lx"){if(W!==t[n]*F.lx)return!0}else if(n==="lz"){if(W!==t[n]*F.lz)return!0}else if(W!==t[n])return!0}else if(W!==t[n])return!0;break}}return!1},k=W=>{if(t&&D(W)){switch(d){case ie.AllSelectedObjectsOfThisType:{const F=new Map;for(const L of c)if(L.type===z.Window&&!L.locked&&H.getState().selectedElementIdSet.has(L.id)){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{M(E.oldValues)},redo:()=>{R(E.oldValues,E.newValue)}};u(E),R(F,W),p(f+1);break}case ie.AllObjectsOfThisType:{const F=new Map;for(const L of c)if(L.type===z.Window&&!L.locked){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{M(E.oldValues)},redo:()=>{T(E.newValue)}};u(E),T(W),p(f+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const F=new Map;for(const L of c)if(L.type===z.Window&&L.foundationId===t.foundationId&&!L.locked){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:F,newValue:W,groupId:t.foundationId,undo:()=>{M(E.oldValues)},redo:()=>{b(t.foundationId,E.newValue)}};u(E),b(t.foundationId,W),p(f+1)}break;case ie.OnlyThisSide:if(t.parentId){const F=new Map;for(const L of c)if(L.type===z.Window&&L.parentId===t.parentId&&!L.locked){const j=L,Y=y(j);let O=j[n];Y&&j.parentType!==z.Roof&&(n==="lx"?O*=Y.lx:n==="lz"&&(O*=Y.lz)),F.set(L.id,O)}const E={name:`Set ${e} for All Windows On the Same Parent`,timestamp:Date.now(),oldValues:F,newValue:W,groupId:t.parentId,undo:()=>{M(E.oldValues)},redo:()=>{v(t.parentId,E.newValue)}};u(E),v(t.parentId,W),p(f+1)}break;default:if(t){let F=t[n];const E=y(t);E&&t.parentType!==z.Roof&&(n==="lx"?F*=E.lx:n==="lz"&&(F*=E.lz));const L={name:`Set Window ${e}`,timestamp:Date.now(),oldValue:F,newValue:W,changedElementId:t.id,changedElementType:t.type,undo:()=>{S(L.changedElementId,L.oldValue)},redo:()=>{S(L.changedElementId,L.newValue)}};u(L),S(t.id,W),p(f+1)}}m(F=>{switch(e){case Tp.Width:F.actionState.windowWidth=W;break;case Tp.Height:F.actionState.windowHeight=W;break;case Tp.Opacity:F.actionState.windowOpacity=W;break;case Tp.FrameWidth:F.actionState.windowFrameWidth=W;break;case Tp.SillWidth:F.actionState.windowSillWidth=W;break;case Tp.HorizontalMullionSpacing:F.actionState.windowHorizontalMullionSpacing=W;break;case Tp.VerticalMullionSpacing:F.actionState.windowVerticalMullionSpacing=W;break;case Tp.MullionWidth:F.actionState.windowMullionWidth=W;break}})}},N=()=>{s(!1)},U=()=>{k(x)};return h.jsx(ro,{width:550,title:B.t(`windowMenu.${e}`,P),onApply:U,onClose:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,value:x,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&C(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",P),": [",o[0].toFixed(o[0]===0?0:l??0),","," ",o[1].toFixed(l??0),"] ",i," ",h.jsx("br",{}),h.jsx("br",{})," ",a]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:W=>H.getState().setWindowActionScope(W.target.value),value:d,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",P)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",P)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",P)})]})})})]})})},M7o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=H(Qn),i=H(pn),a=H(Fn),l=H(ZN),s=H(no),c=H(qn),[u,d]=vne(t[n]??"#ffffff"),f=Kt(),p=(b,T)=>{i(R=>{for(const M of R.elements)if(M.id===b){!M.locked&&M.type===z.Window&&(M[n]=T);break}})},m=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.parentId===b&&(M[n]=T)})},y=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.foundationId===b&&(M[n]=T)})},w=b=>{i(T=>{for(const R of T.elements)!R.locked&&R.type===z.Window&&(R[n]=b)})},x=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&b.has(M.id)&&(M[n]=T)})},C=b=>{for(const[T,R]of b.entries())p(T,R)},P=b=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const T of r)if(T.type===z.Window&&b!==T[n]&&!T.locked&&H.getState().selectedElementIdSet.has(T.id))return!0;break;case ie.AllObjectsOfThisType:for(const T of r)if(T.type===z.Window&&b!==T[n]&&!T.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of r)if(T.type===z.Window&&T.foundationId===t.foundationId&&b!==T[n]&&!T.locked)return!0;break;case ie.OnlyThisSide:for(const T of r)if(T.type===z.Window&&T.parentId===t.parentId&&b!==T[n]&&!T.locked)return!0;break;default:if(b!==t[n])return!0;break}return!1},A=b=>{if(t&&P(b)){switch(l){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{x(R.oldValues,R.newValue)}};a(R),x(T,b),c(s+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{w(R.newValue)}};a(R),w(b),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const T=new Map;for(const M of r)M.type===z.Window&&M.foundationId===t.foundationId&&!t.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{y(R.groupId,R.newValue)}};a(R),y(t.foundationId,b),c(s+1)}break}case ie.OnlyThisSide:{if(t.parentId){const T=new Map;for(const M of r)M.type===z.Window&&M.parentId===t.parentId&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{m(t.parentId,R.newValue)}};a(R),m(t.parentId,b),c(s+1)}break}default:{if(t){const T=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,b),c(s+1)}break}}i(T=>{switch(e){case Tp.Tint:T.actionState.windowTint=b;break;case Tp.MullionColor:T.actionState.windowMullionColor=b;break;case Tp.Color:T.actionState.windowColor=b;break}})}},S=()=>{o()},v=()=>{t[n]!==u&&A(u)};return h.jsx(ro,{width:640,title:B.t(`windowMenu.${e}`,f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u??"#73D8FF",onChangeComplete:d})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:b=>H.getState().setWindowActionScope(b.target.value),value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",f)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",f)})]})})})]})})},I7o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=H(Qn),i=H(pn),a=H(Fn),l=H(ZN),s=H(no),c=H(qn),[u,d]=g.useState(t[n]),f=Kt(),p=(b,T)=>{i(R=>{for(const M of R.elements)if(M.id===b&&!M.locked&&M.type===z.Window){M[n]=T;break}})},m=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.parentId===b&&(M[n]=T)})},y=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&M.foundationId===b&&(M[n]=T)})},w=b=>{i(T=>{for(const R of T.elements)!R.locked&&R.type===z.Window&&(R[n]=b)})},x=(b,T)=>{i(R=>{for(const M of R.elements)!M.locked&&M.type===z.Window&&b.has(M.id)&&(M[n]=T)})},C=b=>{for(const[T,R]of b.entries())p(T,R)},P=b=>{switch(l){case ie.AllSelectedObjectsOfThisType:for(const T of r)if(T.type===z.Window&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T[n]!==b)return!0;break;case ie.AllObjectsOfThisType:for(const T of r)if(T.type===z.Window&&!T.locked&&T[n]!==b)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const T of r)if(T.type===z.Window&&T.foundationId===t.foundationId&&!T.locked&&T[n]!==b)return!0;break;case ie.OnlyThisSide:for(const T of r)if(T.type===z.Window&&T.parentId===t.parentId&&!T.locked&&T[n]!==b)return!0;break;default:if(t[n]!==b)return!0;break}return!1},A=b=>{if(t&&P(b))switch(l){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&T.set(M.id,M[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{x(R.oldValues,R.newValue)}};a(R),x(T,b),c(s+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of r)M.type===z.Window&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{C(R.oldValues)},redo:()=>{w(R.newValue)}};a(R),w(b),c(s+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const T=new Map;for(const M of r)M.type===z.Window&&M.foundationId===t.foundationId&&!t.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{y(R.groupId,R.newValue)}};a(R),y(t.foundationId,b),c(s+1)}break}case ie.OnlyThisSide:{if(t.parentId){const T=new Map;for(const M of r)M.type===z.Window&&M.parentId===t.parentId&&!M.locked&&T.set(M.id,M[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:T,newValue:b,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{m(t.parentId,R.newValue)}};a(R),m(t.parentId,b),c(s+1)}break}default:{if(t){const T=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,b),c(s+1)}break}}},S=()=>{o()},v=()=>{t[n]!==u&&A(u)};return h.jsx(ro,{width:500,title:B.t(`windowMenu.${e}`,f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsx(zc,{checked:u,onChange:b=>{d(b)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:b=>H.getState().setWindowActionScope(b.target.value),value:l,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",f)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",f)})]})})})]})})},{Option:z7o}=Ko,D7o=({window:t,dataType:e,attributeKey:n,options:o,optionsText:r,setDialogVisible:i})=>{const a=H(Qn),l=H(pn),s=H(Fn),c=H(ZN),u=H(no),d=H(qn),[f,p]=g.useState(t[n]),m=Kt(),y=(R,M)=>{l(D=>{for(const k of D.elements)if(k.id===R){!k.locked&&k.type===z.Window&&(k[n]=M);break}})},w=(R,M)=>{l(D=>{for(const k of D.elements)!k.locked&&k.type===z.Window&&k.parentId===R&&(k[n]=M)})},x=(R,M)=>{l(D=>{for(const k of D.elements)!k.locked&&k.type===z.Window&&k.foundationId===R&&(k[n]=M)})},C=R=>{l(M=>{for(const D of M.elements)!D.locked&&D.type===z.Window&&(D[n]=R)})},P=(R,M)=>{l(D=>{for(const k of D.elements)!k.locked&&k.type===z.Window&&R.has(k.id)&&(k[n]=M)})},A=R=>{for(const[M,D]of R.entries())y(M,D)},S=R=>{if(t){switch(c){case ie.AllSelectedObjectsOfThisType:for(const M of a)if(M.type===z.Window&&R!==M[n]&&!M.locked&&H.getState().selectedElementIdSet.has(M.id))return!0;break;case ie.AllObjectsOfThisType:for(const M of a)if(M.type===z.Window&&R!==M[n]&&!M.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of a)if(M.type===z.Window&&M.foundationId===t.foundationId&&R!==M[n]&&!M.locked)return!0;break;case ie.OnlyThisSide:for(const M of a)if(M.type===z.Window&&M.parentId===t.parentId&&R!==M[n]&&!M.locked)return!0;break;default:if(R!==t[n])return!0;break}return!1}},v=R=>{if(t&&S(R)){switch(c){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of a)k.type===z.Window&&!k.locked&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k[n]);const D={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{A(D.oldValues)},redo:()=>{P(D.oldValues,D.newValue)}};s(D),P(M,R),d(u+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of a)k.type===z.Window&&!k.locked&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{A(D.oldValues)},redo:()=>{C(D.newValue)}};s(D),C(R),d(u+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const M=new Map;for(const k of a)k.type===z.Window&&k.foundationId===t.foundationId&&!t.locked&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.foundationId,undo:()=>{A(D.oldValues)},redo:()=>{x(D.groupId,D.newValue)}};s(D),x(t.foundationId,R),d(u+1)}break}case ie.OnlyThisSide:{if(t.parentId){const M=new Map;for(const k of a)k.type===z.Window&&k.parentId===t.parentId&&!k.locked&&M.set(k.id,k[n]);const D={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:M,newValue:R,groupId:t.parentId,undo:()=>{A(D.oldValues)},redo:()=>{w(t.parentId,D.newValue)}};s(D),w(t.parentId,R),d(u+1)}break}default:{if(t){const M=t[n],D={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:M,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{y(D.changedElementId,D.oldValue)},redo:()=>{y(D.changedElementId,D.newValue)}};s(D),y(t.id,R),d(u+1)}break}}l(M=>{switch(e){case Tp.Tint:M.actionState.windowTint=R;break;case Tp.MullionColor:M.actionState.windowMullionColor=R;break;case Tp.Color:M.actionState.windowColor=R;break}})}},b=()=>{i()},T=()=>{v(f)};return h.jsx(ro,{width:560,title:B.t(`windowMenu.${e}`,m),onApply:T,onClose:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:8,children:h.jsx(Ko,{style:{width:"150px"},value:f,onChange:R=>p(R),children:o.map((R,M)=>h.jsx(z7o,{value:R,children:r[M]},R))})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:R=>H.getState().setWindowActionScope(R.target.value),value:c,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",m)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",m)})]})})})]})})};var am=(t=>(t.Opacity="Opacity",t.Width="Width",t.Height="Height",t.Setback="Setback",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionWidth="MullionWidth",t.SillWidth="SillWidth",t.FrameWidth="FrameWidth",t.ShutterWidth="ShutterWidth",t))(am||{}),wj=(t=>(t.ShutterColor="ShutterColor",t.Color="Color",t.MullionColor="MullionColor",t.Tint="Tint",t))(wj||{}),eM=(t=>(t.Frame="Frame",t.LeftShutter="LeftShutter",t.RightShutter="RightShutter",t.HorizontalMullion="HorizontalMullion",t.VerticalMullion="VerticalMullion",t))(eM||{}),t0t=(t=>(t.WindowType="WindowType",t))(t0t||{});const s3=({dataType:t,noPadding:e})=>{const n=Kt(),[o,r]=g.useState(!1),i=ao(z.Window),a=i?H.getState().getParent(i):null,l=()=>{H.getState().setApplyCount(0),r(!0)},s=O7o[t];return t===am.Width?s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lx*Math.min(Math.abs(.5-i.cx),Math.abs(-.5-i.cx)):100:t===am.Height&&(s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lz*Math.min(Math.abs(.5-i.cz),Math.abs(-.5-i.cz)):100),h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:l,children:[B.t(`windowMenu.${t}`,n)," ..."]}),o&&s&&i&&h.jsx(H7o,{windowModel:i,dataType:t,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?B.t(s.unit,n):void 0,note:s.note?B.t(s.note,n):void 0,digit:s.digit??0,setDialogVisible:r})]})},Une=({dataType:t,noPadding:e})=>{const[n,o]=g.useState(!1),r=Kt(),i=ao(z.Window),a=()=>{H.getState().setApplyCount(0),o(!0)},l=j7o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:a,children:[B.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(M7o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},pW=({dataType:t,noPadding:e})=>{const[n,o]=g.useState(!1),r=Kt(),i=ao(z.Window),a=()=>{H.getState().setApplyCount(0),o(!0)},l=B7o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:a,children:[B.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(I7o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},E7o=({dataType:t,noPadding:e})=>{const n=Kt(),[o,r]=g.useState(!1),i=ao(z.Window),a=()=>{H.getState().setApplyCount(0),r(!0)},l=Y7o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(ln,{noPadding:e,onClick:a,children:[B.t(`windowMenu.${t}`,n)," ..."]}),o&&l&&i&&h.jsx(D7o,{window:i,dataType:t,attributeKey:l.attributeKey,options:[Ti.Default,Ti.Arched,Ti.Polygonal],optionsText:[B.t("windowMenu.Default",n),B.t("windowMenu.Arched",n),B.t("windowMenu.Polygonal",n)],setDialogVisible:()=>r(!1)})]})},k7o=({window:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.empty=i;break}})},o=r=>{const i=r.target.checked,a={name:"Empty Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.windowEmpty=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.empty,onChange:o,children:B.t("windowMenu.Empty",e)})})},F7o=({window:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i),H.getState().set(l=>{l.actionState.windowInterior=i})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.interior,onChange:o,children:B.t("windowMenu.Interior",e)})})},L7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(ZN),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Window),[c,u]=g.useState((s==null?void 0:s.uValue)??X9),[d,f]=g.useState(ye.toUValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.uValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Window&&S!==v.uValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Window&&S!==v.uValue&&!v.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Window&&v.foundationId===s.foundationId&&S!==v.uValue&&!v.locked)return!0;break;case ie.OnlyThisSide:for(const v of e)if(v.type===z.Window&&v.parentId===s.parentId&&S!==v.uValue&&!v.locked)return!0;break;default:if(S!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Window&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for Selected Windows",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Window&&!T.locked){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for All Windows",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const v=new Map;for(const T of e)if(T.type===z.Window&&T.foundationId===s.foundationId&&!T.locked){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for All Windows Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break}case ie.OnlyThisSide:{if(s.parentId){const v=new Map;for(const T of e)if(T.type===z.Window&&T.parentId===s.parentId&&!T.locked){const R=T;v.set(T.id,R.uValue??X9),m(R.id,S)}const b={name:"Set U-Value for All Windows On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.parentId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break}default:{if(s){const b=a(s.id).uValue??s.uValue??X9,T={name:"Set Window U-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}break}}l(v=>{v.actionState.windowUValue=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("word.UValue",p)+" "}(${B.t("word.ThermalTransmittance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toUValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toUValueInUS(.01),max:ye.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toUValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toUValueInUS(.01).toFixed(3),", ",ye.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setWindowActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windowMenu.OnlyThisWindow",p)}),h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisSide,children:B.t("windowMenu.AllWindowsOnSurface",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windowMenu.AllWindowsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windowMenu.AllSelectedWindows",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windowMenu.AllWindows",p)})]})})})]})})},W7o=t=>{const e=[];return e.push({key:"window-frame-boolean",label:h.jsx(pW,{noPadding:!0,dataType:eM.Frame})}),t.frame&&e.push({type:"divider"},{key:"window-frame-width",label:h.jsx(s3,{noPadding:!0,dataType:am.FrameWidth})},{key:"window-sill-width",label:h.jsx(s3,{noPadding:!0,dataType:am.SillWidth})},{key:"window-frame-color",label:h.jsx(Une,{noPadding:!0,dataType:wj.Color})}),e},N7o=t=>{const e=[];return e.push({key:"window-horizontal-mullion",label:h.jsx(pW,{noPadding:!0,dataType:eM.HorizontalMullion})},{key:"window-vertical-mullion",label:h.jsx(pW,{noPadding:!0,dataType:eM.VerticalMullion})}),(t.horizontalMullion||t.verticalMullion)&&(e.push({type:"divider"},{key:"window-mullion-width",label:h.jsx(s3,{noPadding:!0,dataType:am.MullionWidth})},{key:"window-mullion-color",label:h.jsx(Une,{noPadding:!0,dataType:wj.MullionColor})}),t.horizontalMullion&&e.push({key:"window-horizontal-mullion-spacing",label:h.jsx(s3,{noPadding:!0,dataType:am.HorizontalMullionSpacing})}),t.verticalMullion&&e.push({key:"window-vertical-mullion-spacing",label:h.jsx(s3,{noPadding:!0,dataType:am.VerticalMullionSpacing})})),e},U7o=t=>{const e=[];return e.push({key:"window-left-shutter",label:h.jsx(pW,{noPadding:!0,dataType:eM.LeftShutter})},{key:"window-right-shutter",label:h.jsx(pW,{noPadding:!0,dataType:eM.RightShutter})}),(t.leftShutter||t.rightShutter)&&e.push({type:"divider"},{key:"window-shutter-color",label:h.jsx(Une,{noPadding:!0,dataType:wj.ShutterColor})},{key:"window-shutter-width",label:h.jsx(s3,{noPadding:!0,dataType:am.ShutterWidth})}),e};var Tp=(t=>(t.Color="Color",t.Tint="Tint",t.Opacity="Opacity",t.WindowType="WindowType",t.MullionWidth="MullionWidth",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionColor="MullionColor",t.Frame="Frame",t.FrameWidth="FrameWidth",t.SillWidth="SillWidth",t.Width="Width",t.Height="Height",t))(Tp||{});const j7o={Tint:{attributeKey:"tint"},Color:{attributeKey:"color"},MullionColor:{attributeKey:"mullionColor"},ShutterColor:{attributeKey:"shutterColor"}},B7o={HorizontalMullion:{attributeKey:"horizontalMullion"},VerticalMullion:{attributeKey:"verticalMullion"},Frame:{attributeKey:"frame"},LeftShutter:{attributeKey:"leftShutter"},RightShutter:{attributeKey:"rightShutter"}},Y7o={WindowType:{attributeKey:"windowType",options:[Ti.Default,Ti.Arched,Ti.Polygonal]}},O7o={Opacity:{attributeKey:"opacity",range:[0,.9],step:.1,note:"windowMenu.SolarHeatGainCoefficient",digit:1},Width:{attributeKey:"lx",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Height:{attributeKey:"lz",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Setback:{attributeKey:"cy",range:[0,1],step:.01,unit:"",digit:0,note:"windowMenu.RelativeToWallThickness"},MullionWidth:{attributeKey:"mullionWidth",range:[0,.5],step:.1,unit:"word.MeterAbbreviation",digit:1},ShutterWidth:{attributeKey:"shutterWidth",range:[0,.5],step:.01,unit:"",digit:1},HorizontalMullionSpacing:{attributeKey:"horizontalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},VerticalMullionSpacing:{attributeKey:"verticalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},FrameWidth:{attributeKey:"frameWidth",range:[.05,.2],step:.01,unit:"word.MeterAbbreviation",digit:2},SillWidth:{attributeKey:"sillWidth",range:[0,.5],step:.01,unit:"word.MeterAbbreviation",digit:2}},_7o=t=>{const e=[];if(t.type!==z.Window)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language};return e.push({key:"window-copy",label:h.jsx(ad,{})}),o&&e.push({key:"window-cut",label:h.jsx(ld,{})}),e.push({key:"window-lock",label:h.jsx(D0,{selectedElement:n})}),o&&e.push({key:"window-empty",label:h.jsx(k7o,{window:n})},{key:"window-interior",label:h.jsx(F7o,{window:n})}),o&&e.push({key:"window-type",label:h.jsx(E7o,{dataType:t0t.WindowType})},{key:"window-width",label:h.jsx(s3,{dataType:am.Width})},{key:"window-height",label:h.jsx(s3,{dataType:am.Height})},{key:"window-setback",label:h.jsx(s3,{dataType:am.Setback})},{key:"window-opacity",label:h.jsx(s3,{dataType:am.Opacity})},{key:"window-tint",label:h.jsx(Une,{dataType:wj.Tint})},{key:"window-u-value",label:h.jsxs(Zn,{Dialog:L7o,children:[B.t("word.UValue",r)," ..."]})},{key:"window-mullion-submenu",label:h.jsx(ln,{children:B.t("windowMenu.Mullion",r)}),children:N7o(n)},{key:"window-frame-submenu",label:h.jsx(ln,{children:B.t("windowMenu.Frame",r)}),children:W7o(n)},{key:"window-shutter-submenu",label:h.jsx(ln,{children:B.t("windowMenu.Shutter",r)}),children:U7o(n)}),{items:e}},V7o=({roof:t})=>{const e=Kt(),n=(r,i)=>{H.getState().set(a=>{const l=a.elements.find(s=>s.id===r&&s.type===z.Roof);l&&(l.ceiling=i,a.actionState.roofCeiling=i)})},o=r=>{const i=r.target.checked,a={name:"Roof Ceiling",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};H.getState().addUndoable(a),n(t.id,i)};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.ceiling,onChange:o,children:B.t("roofMenu.Ceiling",e)})})},G7o=({roof:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=H.getState().removeAllChildElementsByType,a=()=>{const s=H.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Roof`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{H.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};H.getState().addUndoable(u)},l=()=>{const s=o??a;li.confirm({title:n,icon:h.jsx(_y,{}),onOk:s})};return h.jsx(ln,{update:!0,noPadding:!0,onClick:l,children:r})},IEe=({roof:t,objectType:e,lock:n,children:o})=>{const r=H.getState().updateElementLockById,i=H.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of H.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Roof`:`Unlock All Locked ${l} on Roof`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};H.getState().addUndoable(u)};return h.jsx(ln,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},X7o=({roof:t})=>{const e=Kt(),n=H.getState().updateRoofStructureById,o=r=>{const i={name:"Select Roof Structure",timestamp:Date.now(),oldValue:t.roofStructure??Hc.Default,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};H.getState().addUndoable(i),n(t.id,r.target.value),H.getState().set(a=>{a.actionState.roofStructure=r.target.value})};return h.jsx(ln,{stayAfterClick:!0,noPadding:!0,children:h.jsx(We.Group,{value:t.roofStructure??Hc.Default,onChange:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:Hc.Default,children:B.t("roofMenu.DefaultStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Hc.Rafter,children:B.t("roofMenu.RafterStructure",e)}),h.jsx(We,{style:{width:"100%"},value:Hc.Glass,children:B.t("roofMenu.GlassStructure",e)})]})})})},Bce=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],J7o=(t,e)=>{const n={lng:H.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${B.t("roofMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof",n)} (${e} ${B.t("roofMenu.SolarPanels",n)})`;break}case z.Window:{o=`${B.t("roofMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllWindowsOnThisRoof",n)} (${e} ${B.t("roofMenu.Windows",n)})`;break}case z.Sensor:{o=`${B.t("roofMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllSensorsOnThisRoof",n)} (${e} ${B.t("roofMenu.Sensors",n)})`;break}case z.Light:{o=`${B.t("roofMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${B.t("roofMenu.DoYouReallyWantToRemoveAllLightsOnThisRoof",n)} (${e} ${B.t("roofMenu.Lights",n)})`;break}}return{itemLabel:o,modalTitle:r}},Yce=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],K7o=(t,e,n)=>{const o=[],r={lng:H.getState().language};return Bce.forEach(({key:i,objectType:a})=>{const l=Yce(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=J7o(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-roof`,label:h.jsx(G7o,{roof:t,objectType:a,modalTitle:c,children:s})})}}),Bce.forEach(({key:i,objectType:a})=>{const l=Yce(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-roof`,label:h.jsxs(IEe,{roof:t,objectType:a,lock:!0,children:[B.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),Bce.forEach(({lockedKey:i,objectType:a})=>{const l=Yce(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(IEe,{roof:t,objectType:a,lock:!1,children:[B.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!0,children:[B.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(WJ,{element:t,inside:!1,children:[B.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},$7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.thickness)??.4),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)v.id===P&&(v.thickness=A,S.updateElementOnRoofFlag=!0),v.parentId===P&&v.type===z.Window&&(v.ly=A)})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.thickness&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.thickness&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.thickness&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.thickness))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)){const b=v;A.set(v.id,b.thickness),f(b.id,P)}const S={name:"Set Thickness for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked){const b=v;A.set(v.id,b.thickness),f(b.id,P)}const S={name:"Set Thickness for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked){const b=v;A.set(v.id,b.thickness),f(b.id,P)}const S={name:"Set Thickness for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).thickness??s.thickness??.4,v={name:"Set Roof Thickness",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.roofThickness=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.Thickness",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.05,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.05, 1] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},q7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=ao(z.Roof),[s,c]=g.useState((l==null?void 0:l.rise)??0),u=Kt(),d=(C,P)=>{H.getState().updateRoofRiseById(C,P),H.getState().set(A=>{A.updateElementOnRoofFlag=!0})},f=C=>{for(const[P,A]of C.entries())d(P,A)},p=(C,P)=>{for(const A of C.keys())d(A,P)},m=C=>{if(l){switch(o){case ie.AllSelectedObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked&&H.getState().selectedElementIdSet.has(P.id))return!0;break;case ie.AllObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const P of e)if(P.type===z.Roof&&P.foundationId===l.foundationId&&C!==P.rise&&!P.locked)return!0;break;default:if(C!==(l==null?void 0:l.rise))return!0;break}return!1}},y=C=>{if(l&&m(C))switch(H.getState().roofActionScope){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Roof&&!S.locked&&(P.set(S.id,S.rise),d(S.id,C));const A={name:"Set Rise for Selected Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{p(A.oldValues,A.newValue)}};n(A),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of e)S.type===z.Roof&&!S.locked&&(P.set(S.id,S.rise),d(S.id,C));const A={name:"Set Rise for All Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{p(A.oldValues,A.newValue)}};n(A),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(l.foundationId){const P=new Map;for(const S of e)S.type===z.Roof&&S.foundationId===l.foundationId&&!S.locked&&(P.set(S.id,S.rise),d(S.id,C));const A={name:"Set Rise for All Roofs Above Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:l.foundationId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.oldValues,A.newValue)}};n(A),i(r+1)}break;default:if(l){const P=a(l.id),A=(P==null?void 0:P.rise)??(l==null?void 0:l.rise)??0,S={name:"Set Roof Rise",timestamp:Date.now(),oldValue:A,newValue:C,changedElementId:l.id,changedElementType:l.type,undo:()=>{d(S.changedElementId,S.oldValue)},redo:()=>{d(S.changedElementId,S.newValue)}};n(S),d(l.id,C),i(r+1)}}},w=()=>{t(!1)},x=()=>{y(s)};return h.jsx(ro,{width:550,title:B.t("roofMenu.Rise",u),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:200,style:{width:120},step:.1,precision:2,value:s,formatter:C=>Number(C).toFixed(2),onChange:C=>c(C)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",u),": [0, 200] ",B.t("word.MeterAbbreviation",u)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",u)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:C=>H.getState().setRoofActionScope(C.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",u)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",u)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",u)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",u)})]})})})]})})},Q7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rValue)??pA),[d,f]=g.useState(ye.toRValueInUS(c)),p=Kt(),m=(S,v)=>{l(b=>{for(const T of b.elements)if(T.id===S){T.rValue=v;break}})},y=S=>{for(const[v,b]of S.entries())m(v,b)},w=(S,v)=>{for(const b of S.keys())m(b,v)},x=S=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&S!==v.rValue&&!v.locked&&H.getState().selectedElementIdSet.has(v.id))return!0;break;case ie.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&S!==v.rValue&&!v.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&S!==v.rValue&&!v.locked)return!0;break;default:if(S!==(s==null?void 0:s.rValue))return!0;break}return!1}},C=S=>{if(s&&x(S)){switch(o){case ie.AllSelectedObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Roof&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)){const R=T;v.set(T.id,R.rValue??pA),m(R.id,S)}const b={name:"Set R-Value for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisType:{const v=new Map;for(const T of e)if(T.type===z.Roof&&!T.locked){const R=T;v.set(T.id,R.rValue??pA),m(R.id,S)}const b={name:"Set R-Value for All Roofs",timestamp:Date.now(),oldValues:v,newValue:S,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const T of e)if(T.type===z.Roof&&T.foundationId===s.foundationId&&!T.locked){const R=T;v.set(T.id,R.rValue??pA),m(R.id,S)}const b={name:"Set R-Value for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:S,groupId:s.foundationId,undo:()=>{y(b.oldValues)},redo:()=>{w(b.oldValues,b.newValue)}};n(b),i(r+1)}break;default:if(s){const b=a(s.id).rValue??s.rValue??pA,T={name:"Set Roof R-Value",timestamp:Date.now(),oldValue:b,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{m(T.changedElementId,T.oldValue)},redo:()=>{m(T.changedElementId,T.newValue)}};n(T),m(s.id,S),i(r+1)}}l(v=>{v.actionState.roofRValue=S})}},P=()=>{t(!1)},A=()=>{C(c)};return h.jsx(ro,{width:550,title:`${B.t("roofMenu.RoofRValue",p)+" "}(${B.t("word.ThermalResistance",p)})`,onApply:A,onClose:P,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(u(S),f(ye.toRValueInUS(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:S=>Number(S).toFixed(2),onChange:S=>{S!==null&&(f(S),u(ye.toRValueInSI(S)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:S=>H.getState().setRoofActionScope(S.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",p)})]})})})]})})},Z7o=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(o6),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.volumetricHeatCapacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.volumetricHeatCapacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.volumetricHeatCapacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Roof&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Roof&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;l(v=>{for(const b of v.elements)if(b.type===z.Roof&&b.foundationId===s.foundationId&&!b.locked){const T=b;A.set(b.id,T.volumetricHeatCapacity??.5),T.volumetricHeatCapacity=P}});const S={name:"Set Volumetric Heat Capacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,v={name:"Set Volumetric Heat Capacity of Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.roofVolumetricHeatCapacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),B.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},exo="/aladdin/assets/roof_edge-DBy_1Q5D.png",txo="/aladdin/assets/roof_01-BwuyLpwq.png",nxo="/aladdin/assets/roof_02-DAbYjnV7.png",oxo="/aladdin/assets/roof_03-haZGIixv.png",rxo="/aladdin/assets/roof_04-DDuwUcDr.png",ixo="/aladdin/assets/roof_05-CtBb5xIW.png",axo="/aladdin/assets/roof_06-DuyyebV8.png",lxo="/aladdin/assets/roof_07-DXWGQN8a.png",sxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(pn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.textureType)??Yr.Default),d=Kt(),{Option:f}=Ko,p=(A,S)=>{a(v=>{for(const b of v.elements)if(b.id===A){b.locked||(b.textureType=S);break}})},m=(A,S)=>{for(const v of A.keys())p(v,S)},y=A=>{for(const[S,v]of A.entries())p(S,v)},w=A=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const S of e)if(S.type===z.Roof&&A!==S.textureType&&!S.locked&&H.getState().selectedElementIdSet.has(S.id))return!0;break;case ie.AllObjectsOfThisType:for(const S of e)if(S.type===z.Roof&&A!==S.textureType&&!S.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const S of e)if(S.type===z.Roof&&S.foundationId===s.foundationId&&A!==S.textureType&&!S.locked)return!0;break;default:if(A!==(s==null?void 0:s.textureType))return!0;break}return!1}},x=A=>{if(s&&w(A)){switch(o){case ie.AllSelectedObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Roof&&!b.locked&&H.getState().selectedElementIdSet.has(b.id)&&S.set(b.id,b.textureType??Yr.Default);const v={name:"Set Texture for Selected Roofs",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisType:{const S=new Map;for(const b of e)b.type===z.Roof&&!b.locked&&S.set(b.id,b.textureType??Yr.Default);const v={name:"Set Texture for All Roofs",timestamp:Date.now(),oldValues:S,newValue:A,undo:()=>{y(v.oldValues)},redo:()=>{m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const S=new Map;for(const b of e)b.type===z.Roof&&b.foundationId===s.foundationId&&!b.locked&&S.set(b.id,b.textureType);const v={name:"Set Texture for All Roofs Above Foundation",timestamp:Date.now(),oldValues:S,newValue:A,groupId:s.foundationId,undo:()=>{y(v.oldValues)},redo:()=>{v.groupId&&m(v.oldValues,v.newValue)}};n(v),m(S,A),i(r+1)}break;default:if(s){const S=l(s.id),v=S?S.textureType:s.textureType,b={name:"Set Texture of Selected Roof",timestamp:Date.now(),oldValue:v,newValue:A,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};n(b),p(s.id,A),i(r+1)}}a(S=>{S.actionState.roofTexture=A})}},C=()=>{t(!1)},P=()=>{x(c)};return h.jsx(ro,{width:550,title:B.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:9,children:h.jsxs(Ko,{style:{width:"150px"},value:c,onChange:A=>u(A),children:[h.jsxs(f,{value:Yr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),B.t("shared.NoTexture",d)]},Yr.NoTexture),h.jsxs(f,{value:Yr.Default,children:[h.jsx("img",{alt:Yr.Default,src:exo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.TextureDefault",d)]},Yr.Default),h.jsxs(f,{value:Yr.Texture01,children:[h.jsx("img",{alt:Yr.Texture01,src:txo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture01",d)]},Yr.Texture01),h.jsxs(f,{value:Yr.Texture02,children:[h.jsx("img",{alt:Yr.Texture02,src:nxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture02",d)]},Yr.Texture02),h.jsxs(f,{value:Yr.Texture03,children:[h.jsx("img",{alt:Yr.Texture03,src:oxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture03",d)]},Yr.Texture03),h.jsxs(f,{value:Yr.Texture04,children:[h.jsx("img",{alt:Yr.Texture04,src:rxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture04",d)]},Yr.Texture04),h.jsxs(f,{value:Yr.Texture05,children:[h.jsx("img",{alt:Yr.Texture05,src:ixo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture05",d)]},Yr.Texture05),h.jsxs(f,{value:Yr.Texture06,children:[h.jsx("img",{alt:Yr.Texture06,src:axo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture06",d)]},Yr.Texture06),h.jsxs(f,{value:Yr.Texture07,children:[h.jsx("img",{alt:Yr.Texture07,src:lxo,height:20,width:40,style:{paddingRight:"8px"}})," ",B.t("roofMenu.Texture07",d)]},Yr.Texture07)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(We.Group,{onChange:A=>H.getState().setRoofActionScope(A.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},cxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(qy),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.color)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.color=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.color&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.color&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.color&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of n)v.type===z.Roof&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.color??"#ffffff");const S={name:"Set Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.color:s.color)??"#ffffff",v={name:"Set Color of Selected Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}e(A=>{A.actionState.roofColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("roofMenu.RoofColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},uxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(pn),o=H(Fn),r=H(qy),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.sideColor)??"#ffffff"),d=Kt(),f=(P,A)=>{n(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.sideColor=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.sideColor&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.sideColor&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.sideColor&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.sideColor))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.sideColor??"#ffffff");const S={name:"Set Side Color for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&A.set(v.id,v.sideColor??"#ffffff");const S={name:"Set Side Color for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)v.type===z.Roof&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.sideColor??"#ffffff");const S={name:"Set Side Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.sideColor:s.sideColor)??"#ffffff",v={name:"Set Side Color of Selected Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}n(A=>{A.actionState.roofSideColor=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("roofMenu.RoofSideColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c??(s==null?void 0:s.sideColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},dxo=({setDialogVisible:t})=>{const e=H(Au),n=H(q3),o=H(Fn),r=H(qy),i=H(IJe),a=H(no),l=H(qn),s=H(Ji),c=H(Jn),u=H(pn),d=H(W=>{if(n){for(const F of W.elements)if(F.id===n.id)return F}return null}),[f,p]=g.useState((d==null?void 0:d.ceilingRValue)??dA),[m,y]=g.useState(ye.toRValueInUS(f)),[w,x]=g.useState(!1),[C,P]=g.useState({left:0,top:0,bottom:0,right:0}),A=g.useRef(null),S={lng:e};g.useEffect(()=>{d&&p((d==null?void 0:d.ceilingRValue)??dA)},[d==null?void 0:d.ceilingRValue]);const v=(W,F)=>{u(E=>{for(const L of E.elements)if(L.id===W){L.ceilingRValue=F;break}})},b=W=>{for(const[F,E]of W.entries())v(F,E)},T=(W,F)=>{for(const E of W.keys())v(E,F)},R=W=>{if(d){switch(r){case ie.AllObjectsOfThisType:{const F=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&!j.locked){const Y=j;F.set(j.id,Y.ceilingRValue??dA),Y.ceilingRValue=W}});const E={name:"Set R-Value for All Ceilings",timestamp:Date.now(),oldValues:F,newValue:W,undo:()=>{b(E.oldValues)},redo:()=>{T(E.oldValues,E.newValue)}};o(E),l(a+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const F=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&j.foundationId===d.foundationId&&!j.locked){const Y=j;F.set(j.id,Y.ceilingRValue??dA),Y.ceilingRValue=W}});const E={name:"Set R-Value for All Ceilings Above Foundation",timestamp:Date.now(),oldValues:F,newValue:W,groupId:d.foundationId,undo:()=>{b(E.oldValues)},redo:()=>{T(E.oldValues,E.newValue)}};o(E),l(a+1)}break}default:{if(d){const E=c(d.id).ceilingRValue??d.ceilingRValue??dA,L={name:"Set Ceiling R-Value",timestamp:Date.now(),oldValue:E,newValue:W,changedElementId:d.id,changedElementType:d.type,undo:()=>{v(L.changedElementId,L.oldValue)},redo:()=>{v(L.changedElementId,L.newValue)}};o(L),v(d.id,W),l(a+1)}break}}u(F=>{F.actionState.roofRValue=W})}},M=(W,F)=>{if(A.current){const{clientWidth:E,clientHeight:L}=window.document.documentElement,j=A.current.getBoundingClientRect();P({left:-j.left+F.x,right:E-(j.right-F.x),top:-j.top+F.y,bottom:L-((j==null?void 0:j.bottom)-F.y)})}},D=()=>{p((d==null?void 0:d.ceilingRValue)??dA),t(!1)},k=()=>{D(),s()},N=()=>{R(f),t(!1),l(0)},U=()=>{R(f)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>x(!0),onMouseOut:()=>x(!1),children:[B.t("roofMenu.CeilingRValue",S)+" ","(",B.t("word.ThermalResistance",S),")"]}),footer:[h.jsx(oo,{onClick:U,children:B.t("word.Apply",S)},"Apply"),h.jsx(oo,{onClick:k,children:B.t("word.Cancel",S)},"Cancel"),h.jsx(oo,{type:"primary",onClick:N,children:B.t("word.OK",S)},"OK")],onCancel:D,maskClosable:!1,destroyOnClose:!1,modalRender:W=>h.jsx(Vi,{disabled:!w,bounds:C,onStart:(F,E)=>M(F,E),children:h.jsx("div",{ref:A,children:W})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(p(W),y(ye.toRValueInUS(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [0.01, 100]",h.jsx("br",{}),B.t("word.SIUnit",S),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(mn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:m,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(y(W),p(ye.toRValueInSI(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",S),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),B.t("word.USUnit",S),": h·ft²·℉/Btu"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:W=>i(W.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisCeiling",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllCeilingsAboveFoundation",S)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllCeilings",S)})]})})})]})})})},fxo=t=>{const e={lng:H.getState().language},n=[];return n.push({key:"roof-ceiling",label:h.jsx(V7o,{roof:t})}),t.ceiling&&n.push({type:"divider"},{key:"ceiling-r-value",label:h.jsxs(Zn,{noPadding:!0,Dialog:dxo,children:[B.t("roofMenu.CeilingRValue",e)," ..."]})}),n},hxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Fn),r=H(qy),i=H(no),a=H(qn),l=H(Jn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rafterColor)??"#ffffff"),d=Kt(),f=(P,A)=>{e(S=>{for(const v of S.elements)if(v.id===P){v.locked||(v.rafterColor=A);break}})},p=(P,A)=>{for(const S of P.keys())f(S,A)},m=P=>{for(const[A,S]of P.entries())f(A,S)},y=P=>{if(s){switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.rafterColor&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of n)if(A.type===z.Roof&&P!==A.rafterColor&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of n)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.rafterColor&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterColor))return!0;break}return!1}},w=P=>{if(s&&y(P))switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.rafterColor??"#ffffff");const S={name:"Set Rafter Color for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of n)v.type===z.Roof&&!v.locked&&A.set(v.id,v.rafterColor??"#ffffff");const S={name:"Set Rafter Color for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of n)v.type===z.Roof&&v.foundationId===s.foundationId&&!s.locked&&A.set(v.id,v.rafterColor??"#ffffff");const S={name:"Set Rafter Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{m(S.oldValues)},redo:()=>{S.groupId&&p(S.oldValues,S.newValue)}};o(S),p(A,P),a(i+1)}break;default:if(s){const A=l(s.id),S=(A?A.rafterColor:s.rafterColor)??"#ffffff",v={name:"Set Rafter Color of Selected Roof",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};o(v),f(s.id,P),a(i+1)}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:640,title:B.t("roofMenu.RoofColor",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},pxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rafterSpacing)??1),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.rafterSpacing=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterSpacing&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterSpacing&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.rafterSpacing&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterSpacing))return!0;break}return!1}},w=P=>{if(s&&y(P))switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&(A.set(v.id,v.rafterSpacing??1),f(v.id,P));const S={name:"Set Rafter Spacing for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&(A.set(v.id,v.rafterSpacing??1),f(v.id,P));const S={name:"Set Rafter Spacing for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked&&(A.set(v.id,v.rafterSpacing??1),f(v.id,P));const S={name:"Set Rafter Spacing for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).rafterSpacing??s.rafterSpacing??1,v={name:"Set Roof Rafter Spacing",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("roofMenu.RafterSpacing",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:100,style:{width:120},step:.1,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.1, 100] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},gxo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.rafterWidth)??.1),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.rafterWidth=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterWidth&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.rafterWidth&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.rafterWidth&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterWidth))return!0;break}return!1}},w=P=>{if(s&&y(P))switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&(A.set(v.id,v.rafterWidth??.1),f(v.id,P));const S={name:"Set Rafter Width for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)v.type===z.Roof&&!v.locked&&(A.set(v.id,v.rafterWidth??.1),f(v.id,P));const S={name:"Set Rafter Width for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked&&(A.set(v.id,v.rafterWidth??.1),f(v.id,P));const S={name:"Set Rafter Width for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const S=a(s.id).rafterWidth??s.rafterWidth??.1,v={name:"Set Roof Rafter Width",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("roofMenu.RafterWidth",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0.01, 1] ",B.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",d)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},mxo=({setDialogVisible:t})=>{const e=H(pn),n=H(q3),o=H(Fn),r=H(qy),i=H(IJe),a=H(no),l=H(qn),s=H(Ji),c=H(Jn),[u,d]=g.useState((n==null?void 0:n.glassTint)??"#73D8FF"),[f,p]=g.useState(!1),[m,y]=g.useState({left:0,top:0,bottom:0,right:0}),w=g.useRef(null),x=g.useRef(null);g.useEffect(()=>{var k;(k=x.current)==null||k.focus()});const C=Kt();g.useEffect(()=>{n&&d((n==null?void 0:n.glassTint)??"#73D8FF")},[n]);const P=(k,N)=>{e(U=>{for(const W of U.elements)if(W.id===k){W.locked||(W.glassTint=N);break}})},A=(k,N)=>{for(const U of k.keys())P(U,N)},S=k=>{for(const[N,U]of k.entries())P(N,U)},v=k=>{if(n)switch(r){case ie.AllObjectsOfThisType:{const N=new Map;for(const W of H.getState().elements)W.type===z.Roof&&!W.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs",timestamp:Date.now(),oldValues:N,newValue:k,undo:()=>{S(U.oldValues)},redo:()=>{A(U.oldValues,U.newValue)}};o(U),A(N,k),l(a+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(n.foundationId){const N=new Map;for(const W of H.getState().elements)W.type===z.Roof&&W.foundationId===n.foundationId&&!n.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs Above Foundation",timestamp:Date.now(),oldValues:N,newValue:k,groupId:n.foundationId,undo:()=>{S(U.oldValues)},redo:()=>{U.groupId&&A(U.oldValues,U.newValue)}};o(U),A(N,k),l(a+1)}break}default:{if(n){const N=c(n.id),U=(N?N.glassTint:n.glassTint)??"#73D8FF",W={name:"Set Glass Tint of Selected Roof",timestamp:Date.now(),oldValue:U,newValue:k,changedElementId:n.id,changedElementType:n.type,undo:()=>{P(W.changedElementId,W.oldValue)},redo:()=>{P(W.changedElementId,W.newValue)}};o(W),P(n.id,k),l(a+1)}break}}},b=(k,N)=>{if(w.current){const{clientWidth:U,clientHeight:W}=window.document.documentElement,F=w.current.getBoundingClientRect();y({left:-F.left+N.x,right:U-(F.right-N.x),top:-F.top+N.y,bottom:W-((F==null?void 0:F.bottom)-N.y)})}},T=()=>{n!=null&&n.glassTint&&d(n.glassTint),t(!1)},R=()=>{T(),s()},M=()=>{const k=c(n.id);k&&k.glassTint!==u&&v(u),t(!1),l(0)},D=()=>{v(u)};return h.jsx(h.Fragment,{children:h.jsx(li,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>p(!0),onMouseOut:()=>p(!1),children:B.t("roofMenu.GlassTint",C)}),footer:[h.jsx(oo,{onClick:D,children:B.t("word.Apply",C)},"Apply"),h.jsx(oo,{onClick:R,children:B.t("word.Cancel",C)},"Cancel"),h.jsx(oo,{type:"primary",ref:x,onClick:M,children:B.t("word.OK",C)},"OK")],onCancel:T,maskClosable:!1,destroyOnClose:!1,modalRender:k=>h.jsx(Vi,{disabled:!f,bounds:m,onStart:(N,U)=>b(N,U),children:h.jsx("div",{ref:w,children:k})}),children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:11,children:h.jsx(sd,{color:u??(n==null?void 0:n.glassTint)??"#73D8FF",onChangeComplete:k=>{d(k.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(We.Group,{onChange:k=>i(k.target.value),value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",C)})]})})})]})})})},yxo=t=>{const e={lng:H.getState().language},n=[];return n.push({key:"roof-structure-radio-group",label:h.jsx(X7o,{roof:t}),style:{backgroundColor:"white"}}),t.roofStructure===Hc.Rafter&&n.push({type:"divider"},{key:"roof-rafter-spacing",label:h.jsxs(Zn,{noPadding:!0,Dialog:pxo,children:[B.t("roofMenu.RafterSpacing",e)," ..."]})},{key:"roof-rafter-width",label:h.jsxs(Zn,{noPadding:!0,Dialog:gxo,children:[B.t("roofMenu.RafterWidth",e)," ..."]})},{key:"roof-rafter-color",label:h.jsxs(Zn,{noPadding:!0,Dialog:hxo,children:[B.t("roofMenu.RafterColor",e)," ..."]})}),t.roofStructure===Hc.Glass&&n.push({type:"divider"},{key:"roof-glass-tint-selection",label:h.jsxs(Zn,{noPadding:!0,Dialog:mxo,children:[B.t("roofMenu.GlassTint",e)," ..."]})}),n},Axo=({setDialogVisible:t})=>{const e=H(Qn),n=H(Fn),o=H(qy),r=H(no),i=H(qn),a=H(Jn),l=H(pn),s=ao(z.Roof),[c,u]=g.useState((s==null?void 0:s.opacity)!==void 0?s.opacity:.5),d=Kt(),f=(P,A)=>{l(S=>{for(const v of S.elements)if(v.id===P){v.opacity=A;break}})},p=P=>{for(const[A,S]of P.entries())f(A,S)},m=(P,A)=>{for(const S of P.keys())f(S,A)},y=P=>{if(s){switch(o){case ie.AllSelectedObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.opacity&&!A.locked&&H.getState().selectedElementIdSet.has(A.id))return!0;break;case ie.AllObjectsOfThisType:for(const A of e)if(A.type===z.Roof&&P!==A.opacity&&!A.locked)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of e)if(A.type===z.Roof&&A.foundationId===s.foundationId&&P!==A.opacity&&!A.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},w=P=>{if(s&&y(P)){switch(o){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked){const b=v;A.set(v.id,b.opacity),f(b.id,P)}const S={name:"Set Opacity for Selected Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of e)if(v.type===z.Roof&&!v.locked){const b=v;A.set(v.id,b.opacity),f(b.id,P)}const S={name:"Set Opacity for All Roofs",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const A=new Map;for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&!v.locked){const b=v;A.set(v.id,b.opacity),f(b.id,P)}const S={name:"Set Opacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.foundationId,undo:()=>{p(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};n(S),i(r+1)}break;default:if(s){const A=a(s.id),S=A.opacity!==void 0?A.opacity:s.opacity!==void 0?s.opacity:.5,v={name:"Set Roof Opacity",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(v.changedElementId,v.oldValue)},redo:()=>{f(v.changedElementId,v.newValue)}};n(v),f(s.id,P),i(r+1)}}l(A=>{A.actionState.roofGlassOpacity=P})}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("roofMenu.Opacity",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:P=>H.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("roofMenu.OnlyThisRoof",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("roofMenu.AllRoofs",d)})]})})})]})})},wxo=()=>{const t=H.getState().elementsToPaste;if(t&&t.length>0)switch(t[0].type){case z.Window:case z.SolarPanel:case z.SolarWaterHeater:case z.Sensor:case z.Light:return!0}return!1},xxo=t=>{const e=[];if(t.type!==z.Roof)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=H.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1),s=n.roofStructure!==Hc.Rafter||n.opacity===void 0||n.opacity>0;return wxo()&&e.push({key:"roof-paste",label:h.jsx(yI,{})}),e.push({key:"roof-lock",label:h.jsx(D0,{selectedElement:n})}),n.rise>0&&e.push({key:"roof-ceiling-submenu",label:h.jsx(ln,{children:B.t("roofMenu.Ceiling",r)}),children:fxo(n)}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-roof",label:h.jsx(ln,{children:B.t("word.Elements",r)}),children:K7o(n,a,l)}),o&&(n.roofType===Zo.Gable&&(e.push({key:"roof-structure-submenu",label:h.jsx(ln,{children:B.t("roofMenu.RoofStructure",r)}),children:yxo(n)}),(n.roofStructure===Hc.Rafter||n.roofStructure===Hc.Glass)&&e.push({key:"opacity",label:h.jsxs(Zn,{Dialog:Axo,children:[B.t("roofMenu.Opacity",r)," ..."]})})),e.push({key:"roof-thickness",label:h.jsxs(Zn,{Dialog:$7o,children:[B.t(n.roofStructure===Hc.Rafter?"roofMenu.RafterThickness":"word.Thickness",r)," ","..."]})}),e.push({key:"roof-rise",label:h.jsxs(Zn,{Dialog:q7o,children:[B.t("roofMenu.Rise",r)," ..."]})}),s&&(e.push({key:"roof-r-value",label:h.jsxs(Zn,{Dialog:Q7o,children:[B.t("roofMenu.RoofRValue",r)," ..."]})},{key:"roof-heat-capacity",label:h.jsxs(Zn,{Dialog:Z7o,children:[B.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"roof-texture",label:h.jsxs(Zn,{Dialog:sxo,children:[B.t("word.Texture",r)," ..."]})}),(n.textureType===Yr.NoTexture||n.textureType===Yr.Default)&&e.push({key:"roof-color",label:h.jsxs(Zn,{Dialog:cxo,children:[B.t("roofMenu.RoofColor",r)," ..."]})}),e.push({key:"roof-side-color",label:h.jsxs(Zn,{Dialog:uxo,children:[B.t("roofMenu.RoofSideColor",r)," ..."]})}))),{items:e}},vxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.relativeYawAngle)??0),p=Kt(),m=R=>{a(R.target.value)},y=R=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.relativeYawAngle??0)-R)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.WindTurbine&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&Math.abs((M.relativeYawAngle??0)-R)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.relativeYawAngle??0)-R)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.relativeYawAngle)??0)-R)>Ht)return!0}return!1}},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.id===R&&!k.locked){const N=k;N.relativeYawAngle=M;break}})},x=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.foundationId===R&&!k.locked){const N=k;N.relativeYawAngle=M}})},C=R=>{e(M=>{for(const D of M.elements)if(D.type===z.WindTurbine&&!D.locked){const k=D;k.relativeYawAngle=R}})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked&&R.has(k.id)){const N=k;N.relativeYawAngle=M}})},A=R=>{if(u&&y(R)){switch(i){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.relativeYawAngle);const D={name:"Set Relative Yaw Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};r(D),P(M,R),s(l+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&M.set(k.id,k.relativeYawAngle);const D={name:"Set Relative Yaw Angle for All Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{C(D.newValue)}};r(D),C(R),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.WindTurbine&&k.foundationId===u.foundationId&&M.set(k.id,k.relativeYawAngle);const D={name:"Set Relative Yaw Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};r(D),x(u.foundationId,R),s(l+1)}break}default:{const M=o(u.id),D=M?M.relativeYawAngle:u.relativeYawAngle,k={name:"Set Wind Turbine Relative Yaw Angle",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(k.changedElementId,k.oldValue)},redo:()=>{w(k.changedElementId,k.newValue)}};r(k),w(u.id,R),s(l+1);break}}e(M=>{M.actionState.windTurbineRelativeYawAngle=R})}},S=()=>{t(!1)},v=()=>{S(),c()},b=()=>{A(d),t(!1),s(0)},T=()=>{A(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RelativeYawAngle",p),onApply:T,onClose:S,onClickCancel:v,onClickOk:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(ye.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [-180°, 180°]",h.jsx("br",{}),B.t("message.SouthFacingIsZero",p),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",p)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:m,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},bxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.numberOfBlades)??3),p=Kt(),{Option:m}=Ko,y=M=>{a(M.target.value)},w=M=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.numberOfBlades??0)-M)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.WindTurbine&&D.foundationId===(u==null?void 0:u.foundationId)&&!D.locked&&Math.abs((D.numberOfBlades??0)-M)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.numberOfBlades??0)-M)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.numberOfBlades)??0)-M)>Ht)return!0}return!1}},x=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.id===M&&!N.locked){const U=N;U.numberOfBlades=D;break}})},C=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.foundationId===M&&!N.locked){const U=N;U.numberOfBlades=D}})},P=M=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked){const N=k;N.numberOfBlades=M}})},A=(M,D)=>{H.getState().set(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&!N.locked&&M.has(N.id)){const U=N;U.numberOfBlades=D}})},S=M=>{if(u&&w(M)){switch(i){case ie.AllSelectedObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&D.set(N.id,N.numberOfBlades??3);const k={name:"Select Blade Number for Selected Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{A(k.oldValues,k.newValue)}};r(k),A(D,M),s(l+1);break}case ie.AllObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&D.set(N.id,N.numberOfBlades??3);const k={name:"Select Blade Number for All Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{P(k.newValue)}};r(k),P(M),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const D=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===u.foundationId&&D.set(N.id,N.numberOfBlades??3);const k={name:"Select Blade Number for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:D,newValue:M,groupId:u.foundationId,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{k.groupId&&C(k.groupId,k.newValue)}};r(k),C(u.foundationId,M),s(l+1)}break}default:{const D=o(u.id),k=D?D.numberOfBlades??3:u.numberOfBlades??3,N={name:"Select Wind Turbine Blade Number",timestamp:Date.now(),oldValue:k,newValue:M,changedElementId:u.id,changedElementType:u.type,undo:()=>{x(N.changedElementId,N.oldValue)},redo:()=>{x(N.changedElementId,N.newValue)}};r(N),x(u.id,M),s(l+1);break}}e(D=>{D.actionState.windTurbineNumberOfBlades=M})}},v=()=>{t(!1)},b=()=>{v(),c()},T=()=>{S(d),t(!1),s(0)},R=()=>{S(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.BladeNumber",p),onApply:R,onClose:v,onClickCancel:b,onClickOk:T,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:4,children:h.jsxs(Ko,{style:{width:"60px"},value:d,onChange:M=>{M!==null&&f(M)},children:[h.jsx(m,{value:1,children:"1"},1),h.jsx(m,{value:2,children:"2"},2),h.jsx(m,{value:3,children:"3"},3),h.jsx(m,{value:4,children:"4"},4),h.jsx(m,{value:8,children:"8"},8)]})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(We.Group,{onChange:y,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Sxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.initialRotorAngle)??0),p=Kt(),m=R=>{a(R.target.value)},y=R=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.initialRotorAngle??0)-R)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.WindTurbine&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&Math.abs((M.initialRotorAngle??0)-R)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs((M.initialRotorAngle??0)-R)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.initialRotorAngle)??0)-R)>Ht)return!0}return!1}},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.id===R&&!k.locked){const N=k;N.initialRotorAngle=M;break}})},x=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.foundationId===R&&!k.locked){const N=k;N.initialRotorAngle=M}})},C=R=>{e(M=>{for(const D of M.elements)if(D.type===z.WindTurbine&&!D.locked){const k=D;k.initialRotorAngle=R}})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked&&R.has(k.id)){const N=k;N.initialRotorAngle=M}})},A=R=>{if(u&&y(R)){switch(i){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.initialRotorAngle);const D={name:"Set Rotor Initial Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};r(D),P(M,R),s(l+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&M.set(k.id,k.initialRotorAngle);const D={name:"Set Rotor Initial Angle for All Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{C(D.newValue)}};r(D),C(R),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.WindTurbine&&k.foundationId===u.foundationId&&M.set(k.id,k.initialRotorAngle);const D={name:"Set Rotor Initial Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};r(D),x(u.foundationId,R),s(l+1)}break}default:{const M=o(u.id),D=M?M.initialRotorAngle:u.initialRotorAngle,k={name:"Set Wind Turbine Rotor Initial Angle",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(k.changedElementId,k.oldValue)},redo:()=>{w(k.changedElementId,k.newValue)}};r(k),w(u.id,R),s(l+1);break}}e(M=>{M.actionState.windTurbineInitialRotorAngle=R})}},S=()=>{t(!1)},v=()=>{S(),c()},b=()=>{A(d),t(!1),s(0)},T=()=>{A(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RotorInitialAngle",p),onApply:T,onClose:S,onClickCancel:v,onClickOk:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:0,max:360,style:{width:120},precision:1,step:1,value:parseFloat(ye.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(ye.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0°, 360°]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:m,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Txo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ye.toRadians(10),d=ao(z.WindTurbine),[f,p]=g.useState((d==null?void 0:d.pitchAngle)??u),m=Kt(),y=M=>{a(M.target.value)},w=M=>{if(d){switch(i){case ie.AllObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.pitchAngle??u)-M)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.WindTurbine&&D.foundationId===(d==null?void 0:d.foundationId)&&!D.locked&&Math.abs((D.pitchAngle??u)-M)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&H.getState().selectedElementIdSet.has(D.id)&&Math.abs((D.pitchAngle??u)-M)>Ht)return!0;break;default:if(Math.abs(((d==null?void 0:d.pitchAngle)??u)-M)>Ht)return!0}return!1}},x=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.id===M&&!N.locked){const U=N;U.pitchAngle=D;break}})},C=(M,D)=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&N.foundationId===M&&!N.locked){const U=N;U.pitchAngle=D}})},P=M=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked){const N=k;N.pitchAngle=M}})},A=(M,D)=>{H.getState().set(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&!N.locked&&M.has(N.id)){const U=N;U.pitchAngle=D}})},S=M=>{if(d&&w(M)){switch(i){case ie.AllSelectedObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&D.set(N.id,N.pitchAngle);const k={name:"Set Pitch Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{A(k.oldValues,k.newValue)}};r(k),A(D,M),s(l+1);break}case ie.AllObjectsOfThisType:{const D=new Map;for(const N of n)N.type===z.WindTurbine&&D.set(N.id,N.pitchAngle);const k={name:"Set Pitch Angle for All Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:M,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{P(k.newValue)}};r(k),P(M),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const D=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===d.foundationId&&D.set(N.id,N.pitchAngle);const k={name:"Set Pitch Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:D,newValue:M,groupId:d.foundationId,undo:()=>{for(const[N,U]of k.oldValues.entries())x(N,U)},redo:()=>{k.groupId&&C(k.groupId,k.newValue)}};r(k),C(d.foundationId,M),s(l+1)}break}default:{const D=o(d.id),k=D?D.pitchAngle:d.pitchAngle,N={name:"Set Wind Turbine Pitch Angle",timestamp:Date.now(),oldValue:k,newValue:M,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(N.changedElementId,N.oldValue)},redo:()=>{x(N.changedElementId,N.newValue)}};r(N),x(d.id,M),s(l+1);break}}e(D=>{D.actionState.windTurbinePitchAngle=M})}},v=()=>{t(!1)},b=()=>{v(),c()},T=()=>{S(f),t(!1),s(0)},R=()=>{S(f)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RotorBladePitchAngle",m),onApply:R,onClose:v,onClickCancel:b,onClickOk:T,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(f).toFixed(2)),formatter:M=>`${M}°`,onChange:M=>{M!==null&&p(ye.toRadians(M))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",m),": [-180°, 180°]"]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:y,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",m)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",m)})]})})})]})})},Pxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.bladeRadius)??0),p=g.useRef(!1),m=g.useRef(),y=Kt(),w=k=>{a(k.target.value)},x=k=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-k)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.bladeRadius-k)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-k)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.bladeRadius)-k)>Ht)return!0}return!1}},C=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===k&&!W.locked){const F=W;F.bladeRadius=N,F.lx=F.ly=N*2,F.lz=F.towerHeight+N;break}})},P=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===k&&!W.locked){const F=W;F.bladeRadius=N,F.lx=F.ly=N*2,F.lz=F.towerHeight+N}})},A=k=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.bladeRadius=k,W.lx=W.ly=k*2,W.lz=W.towerHeight+k}})},S=(k,N)=>{H.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&k.has(W.id)){const F=W;F.bladeRadius=N,F.lx=F.ly=N*2,F.lz=F.towerHeight+N}})},v=k=>{if(u&&x(k)){switch(m.current=void 0,i){case ie.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&N.towerHeight{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{S(U.oldValues,U.newValue)}};r(U),S(N,k),s(l+1)}break}case ie.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.towerHeight{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{A(U.newValue)}};r(U),A(k),s(l+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.towerHeight{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,k),s(l+1)}}break}default:{const N=o(u.id),U=N?N.bladeRadius:u.bladeRadius;if(p.current=u.towerHeight{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,k),s(l+1)}break}}e(N=>{N.actionState.windTurbineBladeRadius=k})}},b=()=>{p.current=!1,t(!1)},T=()=>{b(),c()},R=()=>{v(d),p.current||(t(!1),s(0))},M=()=>{v(d)},D=p.current?": "+B.t("message.NotApplicableToSelectedAction",y)+(m.current!==void 0?" ("+m.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.RotorBladeRadius",y),rejectedMessage:D,onApply:M,onClose:b,onClickCancel:T,onClickOk:R,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:k=>{k!==null&&f(k)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [1, 100] ",B.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",y)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",y)})]})})})]})})},Cxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.bladeRootRadius)??.3),[p,m]=g.useState((u==null?void 0:u.maximumChordLength)??1),[y,w]=g.useState((u==null?void 0:u.maximumChordRadius)??3),x=g.useRef(null),C=Kt(),P=555;g.useEffect(()=>{if(!x.current||!u)return;const $=x.current.getContext("2d");if(!$)return;const ae=x.current.width,Z=x.current.height,ne=20,te=Z*.7;$.clearRect(0,0,ae,Z),$.setLineDash([]),$.strokeStyle="gray",$.lineWidth=1,$.rect(0,0,ae,Z),$.stroke();const q=(ae-ne*2)/u.bladeRadius,le=q*u.bladeTipWidth,de=q*y,he=q*p,me=q*u.bladeRadius,ce=q*d,Pe=he-ce,pe=me-de/3,Ie=[];Ie.push(new _t(ne,te-ce)),Ie.push(new _t(ne+me-pe,te-Pe/2)),Ie.push(new _t(ne+de,te-Pe)),Ie.push(new _t(ne+me,te+ce-le));const ze=new jq(Ie).getPoints(50);$.beginPath(),$.moveTo(ze[0].x,ze[0].y);for(let Ae=1;Ae{a($.target.value)},S=$=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.bladeRootRadius-$)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const ae of n)if(ae.type===z.WindTurbine&&ae.foundationId===(u==null?void 0:u.foundationId)&&!ae.locked&&Math.abs(ae.bladeRootRadius-$)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.bladeRootRadius-$)>Ht)return!0;break;default:if(Math.abs(((u==null?void 0:u.bladeRootRadius)??.3)-$)>Ht)return!0}return!1}},v=($,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.id===$&&!ne.locked){const te=ne;te.bladeRootRadius=ae;break}})},b=($,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.foundationId===$&&!ne.locked){const te=ne;te.bladeRootRadius=ae}})},T=$=>{e(ae=>{for(const Z of ae.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ne=Z;ne.bladeRootRadius=$}})},R=($,ae)=>{H.getState().set(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&!ne.locked&&$.has(ne.id)){const te=ne;te.bladeRootRadius=ae}})},M=$=>{if(u&&S($)){switch(i){case ie.AllSelectedObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(ne.id)&&ae.set(ne.id,ne.bladeRootRadius);const Z={name:"Set Root Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:$,undo:()=>{for(const[ne,te]of Z.oldValues.entries())v(ne,te)},redo:()=>{R(Z.oldValues,Z.newValue)}};r(Z),R(ae,$),s(l+1);break}case ie.AllObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ae.set(ne.id,ne.bladeRootRadius);const Z={name:"Set Root Radius for All Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:$,undo:()=>{for(const[ne,te]of Z.oldValues.entries())v(ne,te)},redo:()=>{T(Z.newValue)}};r(Z),T($),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ne.foundationId===u.foundationId&&ae.set(ne.id,ne.bladeRootRadius);const Z={name:"Set Root Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:ae,newValue:$,groupId:u.foundationId,undo:()=>{for(const[ne,te]of Z.oldValues.entries())v(ne,te)},redo:()=>{Z.groupId&&b(Z.groupId,Z.newValue)}};r(Z),b(u.foundationId,$),s(l+1)}break}default:{const ae=o(u.id),Z=ae?ae.bladeRootRadius:u.bladeRootRadius,ne={name:"Set Wind Turbine Root Radius",timestamp:Date.now(),oldValue:Z,newValue:$,changedElementId:u.id,changedElementType:u.type,undo:()=>{v(ne.changedElementId,ne.oldValue)},redo:()=>{v(ne.changedElementId,ne.newValue)}};r(ne),v(u.id,$),s(l+1);break}}e(ae=>{ae.actionState.windTurbineBladeRootRadius=$})}},D=$=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordLength-$)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const ae of n)if(ae.type===z.WindTurbine&&ae.foundationId===(u==null?void 0:u.foundationId)&&!ae.locked&&Math.abs(ae.maximumChordLength-$)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordLength-$)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordLength)-$)>Ht)return!0}return!1}},k=($,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.id===$&&!ne.locked){const te=ne;te.maximumChordLength=ae;break}})},N=($,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.foundationId===$&&!ne.locked){const te=ne;te.maximumChordLength=ae}})},U=$=>{e(ae=>{for(const Z of ae.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ne=Z;ne.maximumChordLength=$}})},W=($,ae)=>{H.getState().set(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&!ne.locked&&$.has(ne.id)){const te=ne;te.maximumChordLength=ae}})},F=$=>{if(u&&D($)){switch(i){case ie.AllSelectedObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(ne.id)&&ae.set(ne.id,ne.maximumChordLength);const Z={name:"Set Chord Length for Selected Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:$,undo:()=>{for(const[ne,te]of Z.oldValues.entries())k(ne,te)},redo:()=>{W(Z.oldValues,Z.newValue)}};r(Z),W(ae,$),s(l+1);break}case ie.AllObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ae.set(ne.id,ne.maximumChordLength);const Z={name:"Set Chord Length for All Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:$,undo:()=>{for(const[ne,te]of Z.oldValues.entries())k(ne,te)},redo:()=>{U(Z.newValue)}};r(Z),U($),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ne.foundationId===u.foundationId&&ae.set(ne.id,ne.maximumChordLength);const Z={name:"Set Chord Length for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:ae,newValue:$,groupId:u.foundationId,undo:()=>{for(const[ne,te]of Z.oldValues.entries())k(ne,te)},redo:()=>{Z.groupId&&N(Z.groupId,Z.newValue)}};r(Z),N(u.foundationId,$),s(l+1)}break}default:{const ae=o(u.id),Z=ae?ae.maximumChordLength:u.maximumChordLength,ne={name:"Set Wind Turbine Chord Length",timestamp:Date.now(),oldValue:Z,newValue:$,changedElementId:u.id,changedElementType:u.type,undo:()=>{k(ne.changedElementId,ne.oldValue)},redo:()=>{k(ne.changedElementId,ne.newValue)}};r(ne),k(u.id,$),s(l+1);break}}e(ae=>{ae.actionState.windTurbineBladeMaximumChordLength=$})}},E=$=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordRadius-$)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const ae of n)if(ae.type===z.WindTurbine&&ae.foundationId===(u==null?void 0:u.foundationId)&&!ae.locked&&Math.abs(ae.maximumChordRadius-$)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const ae of n)if(ae.type===z.WindTurbine&&!ae.locked&&H.getState().selectedElementIdSet.has(ae.id)&&Math.abs(ae.maximumChordRadius-$)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordRadius)-$)>Ht)return!0}return!1}},L=($,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.id===$&&!ne.locked){const te=ne;te.maximumChordRadius=ae;break}})},j=($,ae)=>{e(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&ne.foundationId===$&&!ne.locked){const te=ne;te.maximumChordRadius=ae}})},Y=$=>{e(ae=>{for(const Z of ae.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ne=Z;ne.maximumChordRadius=$}})},O=($,ae)=>{H.getState().set(Z=>{for(const ne of Z.elements)if(ne.type===z.WindTurbine&&!ne.locked&&$.has(ne.id)){const te=ne;te.maximumChordRadius=ae}})},_=$=>{if(u&&E($)){switch(i){case ie.AllSelectedObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(ne.id)&&ae.set(ne.id,ne.maximumChordRadius);const Z={name:"Set Chord Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:$,undo:()=>{for(const[ne,te]of Z.oldValues.entries())L(ne,te)},redo:()=>{O(Z.oldValues,Z.newValue)}};r(Z),O(ae,$),s(l+1);break}case ie.AllObjectsOfThisType:{const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ae.set(ne.id,ne.maximumChordRadius);const Z={name:"Set Chord Radius for All Wind Turbines",timestamp:Date.now(),oldValues:ae,newValue:$,undo:()=>{for(const[ne,te]of Z.oldValues.entries())L(ne,te)},redo:()=>{Y(Z.newValue)}};r(Z),Y($),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const ae=new Map;for(const ne of n)ne.type===z.WindTurbine&&ne.foundationId===u.foundationId&&ae.set(ne.id,ne.maximumChordRadius);const Z={name:"Set Chord Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:ae,newValue:$,groupId:u.foundationId,undo:()=>{for(const[ne,te]of Z.oldValues.entries())L(ne,te)},redo:()=>{Z.groupId&&j(Z.groupId,Z.newValue)}};r(Z),j(u.foundationId,$),s(l+1)}break}default:{const ae=o(u.id),Z=ae?ae.maximumChordRadius:u.maximumChordRadius,ne={name:"Set Wind Turbine Chord Radius",timestamp:Date.now(),oldValue:Z,newValue:$,changedElementId:u.id,changedElementType:u.type,undo:()=>{L(ne.changedElementId,ne.oldValue)},redo:()=>{L(ne.changedElementId,ne.newValue)}};r(ne),L(u.id,$),s(l+1);break}}e(ae=>{ae.actionState.windTurbineBladeMaximumChordRadius=$})}},G=()=>{t(!1)},Q=()=>{G(),c()},oe=()=>{F(p),_(y),M(d),t(!1),s(0)},ee=()=>{F(p),_(y),M(d)};return h.jsxs(ro,{width:600,title:B.t("windTurbineMenu.RotorBladeDesign",C),onApply:ee,onClose:G,onClickCancel:Q,onClickOk:oe,children:[h.jsx(Qt,{children:h.jsx(Ge,{span:24,children:h.jsx("canvas",{ref:x,id:"blade-design-canvas",width:P,height:P*.25,style:{paddingBottom:"12px"}})})}),h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ge,{style:{textAlign:"center",fontStyle:"italic"},children:"A: "}),h.jsx(Ge,{children:h.jsx(mn,{min:.1,max:1,style:{width:"70px"},step:.01,precision:2,value:d,onChange:$=>{$&&f($)}})}),h.jsxs(Ge,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.1, 1] ",B.t("word.MeterAbbreviation",C)]})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ge,{style:{textAlign:"center",fontStyle:"italic"},children:"C: "}),h.jsx(Ge,{children:h.jsx(mn,{min:.5,max:2,style:{width:"70px"},step:.01,precision:2,value:p,onChange:$=>{$&&m($)}})}),h.jsxs(Ge,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.5, 2] ",B.t("word.MeterAbbreviation",C)]})]}),h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{style:{textAlign:"center",fontStyle:"italic"},children:"D:"}),h.jsx(Ge,{children:h.jsx(mn,{min:2,max:((u==null?void 0:u.bladeRadius)??10)/2,style:{width:70},step:.01,precision:2,value:y,onChange:$=>{$&&w($)}})}),h.jsxs(Ge,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[2, ",((u==null?void 0:u.bladeRadius)??10)/2,"] ",B.t("word.MeterAbbreviation",C)]})]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:A,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",C)})]})})})]})]})},Rxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.hubRadius)??0),[p,m]=g.useState((u==null?void 0:u.hubLength)??0),y=Kt(),w=D=>{a(D.target.value)},x=(D,k)=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-D)>Ht||Math.abs(U.hubLength-k)>Ht)return!0}break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked){const U=N;if(Math.abs(U.hubRadius-D)>Ht||Math.abs(U.hubLength-k)>Ht)return!0}break;case ie.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-D)>Ht||Math.abs(U.hubLength-k)>Ht)return!0}break;default:if(Math.abs((u==null?void 0:u.hubRadius)-D)>Ht||Math.abs((u==null?void 0:u.hubLength)-k)>Ht)return!0}return!1}},C=(D,k)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.id===D&&!U.locked){const W=U;W.hubRadius=k[0],W.hubLength=k[1];break}})},P=(D,k)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.foundationId===D&&!U.locked){const W=U;W.hubRadius=k[0],W.hubLength=k[1]}})},A=D=>{e(k=>{for(const N of k.elements)if(N.type===z.WindTurbine&&!N.locked){const U=N;U.hubRadius=D[0],U.hubLength=D[1]}})},S=(D,k)=>{H.getState().set(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked&&D.has(U.id)){const W=U;W.hubRadius=k[0],W.hubLength=k[1]}})},v=D=>{if(u&&x(D[0],D[1])){switch(i){case ie.AllSelectedObjectsOfThisType:{const k=new Map;for(const U of n)if(U.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(U.id)){const W=U;k.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for Selected Wind Turbines",timestamp:Date.now(),oldValues:k,newValue:D,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{S(N.oldValues,N.newValue)}};r(N),S(k,D),s(l+1);break}case ie.AllObjectsOfThisType:{const k=new Map;for(const U of n)if(U.type===z.WindTurbine){const W=U;k.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines",timestamp:Date.now(),oldValues:k,newValue:D,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{A(N.newValue)}};r(N),A(D),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const k=new Map;for(const U of n)if(U.type===z.WindTurbine&&U.foundationId===u.foundationId){const W=U;k.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:k,newValue:D,groupId:u.foundationId,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{N.groupId&&P(N.groupId,N.newValue)}};r(N),P(u.foundationId,D),s(l+1)}break}default:{const k=o(u.id),N=k?k.hubRadius:u.hubRadius,U=k?k.hubLength:u.hubLength,W={name:"Set Wind Turbine Hub Parameters",timestamp:Date.now(),oldValue:[N,U],newValue:D,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,D),s(l+1);break}}e(k=>{k.actionState.windTurbineHubRadius=D[0],k.actionState.windTurbineHubLength=D[1]})}},b=()=>{t(!1)},T=()=>{b(),c()},R=()=>{v([d,p]),t(!1),s(0)},M=()=>{v([d,p])};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.HubDesign",y),onApply:M,onClose:b,onClickCancel:T,onClickOk:R,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx("div",{style:{marginTop:"-20px",textAlign:"left",fontSize:"12px"},children:B.t("windTurbineMenu.HubRadius",y)}),h.jsx(mn,{min:.5,max:5,style:{width:120},step:.01,precision:2,value:d,onChange:D=>{D!==null&&f(D)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [0.5, 5] ",B.t("word.MeterAbbreviation",y)]}),h.jsx("div",{style:{paddingTop:"10px",textAlign:"left",fontSize:"12px"},children:B.t("windTurbineMenu.HubLength",y)}),h.jsx(mn,{min:1,max:10,style:{width:120},step:.01,precision:2,value:p,onChange:D=>{D!==null&&m(D)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [1, 10] ",B.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",y)})]})})})]})})},Hxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.birdSafe)??wc.None),[p,m]=g.useState((u==null?void 0:u.bladeColor)??j9),[y,w]=g.useState((u==null?void 0:u.stripeColor)??B9),x=Kt(),{Option:C}=Ko,P=U=>{a(U.target.value)},A=(U,W,F)=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const E of n)if(E.type===z.WindTurbine&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)){const L=E;if((L.birdSafe??wc.None)!==U||(L.bladeColor??j9)!==W||(L.stripeColor??B9)!==F)return!0}break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const E of n)if(E.type===z.WindTurbine&&E.foundationId===(u==null?void 0:u.foundationId)&&!E.locked){const L=E;if((L.birdSafe??wc.None)!==U||(L.bladeColor??j9)!==W||(L.stripeColor??B9)!==F)return!0}break;case ie.AllSelectedObjectsOfThisType:for(const E of n)if(E.type===z.WindTurbine&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)){const L=E;if((L.birdSafe??wc.None)!==U||(L.bladeColor??j9)!==W||(L.stripeColor??B9)!==F)return!0}break;default:if((u.birdSafe??wc.None)!==U||(u.bladeColor??j9)!==W||(u.stripeColor??B9)!==F)return!0}return!1}},S=(U,W,F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.id===U&&!j.locked){const Y=j;Y.birdSafe=W,Y.bladeColor=F,Y.stripeColor=E;break}})},v=(U,W,F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.foundationId===U&&!j.locked){const Y=j;Y.birdSafe=W,Y.bladeColor=F,Y.stripeColor=E}})},b=(U,W,F)=>{e(E=>{for(const L of E.elements)if(L.type===z.WindTurbine&&!L.locked){const j=L;j.birdSafe=U,j.bladeColor=W,j.stripeColor=F}})},T=(U,W,F,E)=>{H.getState().set(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&!j.locked&&U.has(j.id)){const Y=j;Y.birdSafe=W,Y.bladeColor=F,Y.stripeColor=E}})},R=(U,W,F)=>{if(u&&A(U,W,F)){switch(i){case ie.AllSelectedObjectsOfThisType:{const E=new Map;for(const j of n)if(j.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(j.id)){const Y=j;E.set(j.id,[(Y.birdSafe??wc.None).toString(),Y.bladeColor,Y.stripeColor])}const L={name:"Select Bird-Safe Design for Selected Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:[U.toString(),W,F],undo:()=>{for(const[j,Y]of L.oldValues.entries()){const O=Y;S(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;T(L.oldValues,Number(j[0]),j[1],j[2])}};r(L),T(E,U,W,F),s(l+1);break}case ie.AllObjectsOfThisType:{const E=new Map;for(const j of n)if(j.type===z.WindTurbine){const Y=j;E.set(j.id,[(Y.birdSafe??wc.None).toString(),Y.bladeColor,Y.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:[U.toString(),W,F],undo:()=>{for(const[j,Y]of L.oldValues.entries()){const O=Y;S(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;b(Number(j[0]),j[1],j[2])}};r(L),b(U,W,F),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const E=new Map;for(const j of n)if(j.type===z.WindTurbine&&j.foundationId===u.foundationId){const Y=j;E.set(j.id,[(Y.birdSafe??wc.None).toString(),Y.bladeColor,Y.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:E,newValue:[U.toString(),W,F],groupId:u.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries()){const O=Y;S(j,Number(O[0]),O[1],O[2])}},redo:()=>{if(L.groupId){const j=L.newValue;v(L.groupId,Number(j[0]),j[1],j[2])}}};r(L),v(u.foundationId,U,W,F),s(l+1)}break}default:{const E=o(u.id),L=E?E.birdSafe??wc.None:u.birdSafe??wc.None,j=E?E.bladeColor??j9:u.bladeColor??j9,Y=E?E.stripeColor??B9:u.stripeColor??B9,O=[L.toString(),j,Y],_={name:"Select Bird-Safe Design for Wind Turbine",timestamp:Date.now(),oldValue:O,newValue:[U.toString(),W,F],changedElementId:u.id,changedElementType:u.type,undo:()=>{const G=_.oldValue;S(_.changedElementId,Number(G[0]),G[1],G[2])},redo:()=>{S(_.changedElementId,U,W,F)}};r(_),S(u.id,U,W,F),s(l+1);break}}e(E=>{E.actionState.windTurbineBirdSafeDesign=U,E.actionState.windTurbineBladeColor=W,E.actionState.windTurbineStripeColor=F})}},M=()=>{t(!1)},D=()=>{M(),c()},k=()=>{R(d,p,y),t(!1),s(0)},N=()=>{R(d,p,y)};return h.jsx(ro,{width:600,title:B.t("windTurbineMenu.BirdSafeDesign",x),onApply:N,onClose:M,onClickCancel:D,onClickOk:k,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:8,children:[h.jsxs("span",{children:[B.t("word.Pattern",x),": "]}),h.jsxs(Ko,{style:{width:"116px"},value:d,onChange:U=>{U!==null&&f(U)},children:[h.jsx(C,{value:wc.None,children:B.t("windTurbineMenu.BirdSafeNone",x)},wc.None),h.jsx(C,{value:wc.Bicolor,children:B.t("windTurbineMenu.BirdSafeBicolor",x)},wc.Bicolor),h.jsx(C,{value:wc.Striped,children:B.t("windTurbineMenu.BirdSafeStriped",x)},wc.Striped)]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[B.t("word.Color",x)," 1: "]}),h.jsx("input",{type:"color",value:p,onChange:U=>{m(U.target.value)}})]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[B.t("word.Color",x)," 2: "]}),h.jsx("input",{type:"color",value:y,onChange:U=>{w(U.target.value)}})]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(We.Group,{onChange:P,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",x)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",x)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",x)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",x)})]})})})]})})},Mxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.towerHeight)??0),p=g.useRef(!1),m=g.useRef(),y=Kt(),w=k=>{a(k.target.value)},x=k=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-k)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.towerHeight-k)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&H.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-k)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.towerHeight)-k)>Ht)return!0}return!1}},C=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===k&&!W.locked){const F=W;F.towerHeight=N,F.lz=N+F.bladeRadius;break}})},P=(k,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===k&&!W.locked){const F=W;F.towerHeight=N,F.lz=N+F.bladeRadius}})},A=k=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.towerHeight=k,W.lz=k+W.bladeRadius}})},S=(k,N)=>{H.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&k.has(W.id)){const F=W;F.towerHeight=N,F.lz=N+F.bladeRadius}})},v=k=>{if(u&&x(k)){switch(m.current=void 0,i){case ie.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(N.id)&&N.bladeRadius>k){p.current=!0;break}if(p.current)m.current=k,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(W.id)&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for Selected Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:k,undo:()=>{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{S(U.oldValues,U.newValue)}};r(U),S(N,k),s(l+1)}break}case ie.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.bladeRadius>k){p.current=!0;break}if(p.current)m.current=k,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:k,undo:()=>{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{A(U.newValue)}};r(U),A(k),s(l+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.bladeRadius>k){p.current=!0;break}if(p.current)m.current=k,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&W.foundationId===u.foundationId&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:N,newValue:k,groupId:u.foundationId,undo:()=>{for(const[W,F]of U.oldValues.entries())C(W,F)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,k),s(l+1)}}break}default:{const N=o(u.id),U=N?N.towerHeight:u.towerHeight;if(p.current=u.bladeRadius>k,p.current)m.current=k,f(U);else{const W={name:"Set Wind Turbine Tower Height",timestamp:Date.now(),oldValue:U,newValue:k,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,k),s(l+1)}break}}e(N=>{N.actionState.windTurbineTowerHeight=k})}},b=()=>{p.current=!1,t(!1)},T=()=>{b(),c()},R=()=>{v(d),p.current||(t(!1),s(0))},M=()=>{v(d)},D=p.current?": "+B.t("message.NotApplicableToSelectedAction",y)+(m.current!==void 0?" ("+m.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.TowerHeight",y),rejectedMessage:D,onApply:M,onClose:b,onClickCancel:T,onClickOk:R,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:k=>{k!==null&&f(k)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",y),": [1, 100] ",B.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",y)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:w,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",y)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",y)})]})})})]})})},Ixo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(Fn),i=H(e6),a=H(t6),l=H(no),s=H(qn),c=H(Ji),u=ao(z.WindTurbine),[d,f]=g.useState((u==null?void 0:u.towerRadius)??0),p=Kt(),m=R=>{a(R.target.value)},y=R=>{if(u){switch(i){case ie.AllObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs(M.towerRadius-R)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const M of n)if(M.type===z.WindTurbine&&M.foundationId===(u==null?void 0:u.foundationId)&&!M.locked&&Math.abs(M.towerRadius-R)>Ht)return!0;break;case ie.AllSelectedObjectsOfThisType:for(const M of n)if(M.type===z.WindTurbine&&!M.locked&&H.getState().selectedElementIdSet.has(M.id)&&Math.abs(M.towerRadius-R)>Ht)return!0;break;default:if(Math.abs((u==null?void 0:u.towerRadius)-R)>Ht)return!0}return!1}},w=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.id===R&&!k.locked){const N=k;N.towerRadius=M;break}})},x=(R,M)=>{e(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&k.foundationId===R&&!k.locked){const N=k;N.towerRadius=M}})},C=R=>{e(M=>{for(const D of M.elements)if(D.type===z.WindTurbine&&!D.locked){const k=D;k.towerRadius=R}})},P=(R,M)=>{H.getState().set(D=>{for(const k of D.elements)if(k.type===z.WindTurbine&&!k.locked&&R.has(k.id)){const N=k;N.towerRadius=M}})},A=R=>{if(u&&y(R)){switch(i){case ie.AllSelectedObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&H.getState().selectedElementIdSet.has(k.id)&&M.set(k.id,k.towerRadius);const D={name:"Set Tower Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{P(D.oldValues,D.newValue)}};r(D),P(M,R),s(l+1);break}case ie.AllObjectsOfThisType:{const M=new Map;for(const k of n)k.type===z.WindTurbine&&M.set(k.id,k.towerRadius);const D={name:"Set Tower Radius for All Wind Turbines",timestamp:Date.now(),oldValues:M,newValue:R,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{C(D.newValue)}};r(D),C(R),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const M=new Map;for(const k of n)k.type===z.WindTurbine&&k.foundationId===u.foundationId&&M.set(k.id,k.towerRadius);const D={name:"Set Tower Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:M,newValue:R,groupId:u.foundationId,undo:()=>{for(const[k,N]of D.oldValues.entries())w(k,N)},redo:()=>{D.groupId&&x(D.groupId,D.newValue)}};r(D),x(u.foundationId,R),s(l+1)}break}default:{const M=o(u.id),D=M?M.towerRadius:u.towerRadius,k={name:"Set Wind Turbine Tower Radius",timestamp:Date.now(),oldValue:D,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(k.changedElementId,k.oldValue)},redo:()=>{w(k.changedElementId,k.newValue)}};r(k),w(u.id,R),s(l+1);break}}e(M=>{M.actionState.windTurbineTowerRadius=R})}},S=()=>{t(!1)},v=()=>{S(),c()},b=()=>{A(d),t(!1),s(0)},T=()=>{A(d)};return h.jsx(ro,{width:550,title:B.t("windTurbineMenu.TowerRadius",p),onApply:T,onClose:S,onClickCancel:v,onClickOk:b,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:d,onChange:R=>{R!==null&&f(R)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",p),": [0.1, 2] ",B.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",p)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:m,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},zxo=t=>{const e=[];if(t.type!==z.WindTurbine)return{items:e};const n=t,o={lng:H.getState().language},r=!n.locked;return e.push({key:"wind-turbine-copy",label:h.jsx(ad,{})}),r&&e.push({key:"wind-turbine-cut",label:h.jsx(ld,{})}),e.push({key:"wind-turbine-lock",label:h.jsx(D0,{selectedElement:n})}),r&&e.push({key:"wind-turbine-relative-yaw-angle",label:h.jsxs(Zn,{Dialog:vxo,children:[B.t("windTurbineMenu.RelativeYawAngle",o)," ..."]})},{key:"wind-turbine-rotor-submenu",label:h.jsx(ln,{children:B.t("windTurbineMenu.Rotor",o)}),children:[{key:"wind-turbine-rotor-blade-number",label:h.jsxs(Zn,{noPadding:!0,Dialog:bxo,children:[B.t("windTurbineMenu.BladeNumber",o)," ..."]})},{key:"wind-turbine-rotor-initial-angle",label:h.jsxs(Zn,{noPadding:!0,Dialog:Sxo,children:[B.t("windTurbineMenu.RotorInitialAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-pitch-angle",label:h.jsxs(Zn,{noPadding:!0,Dialog:Txo,children:[B.t("windTurbineMenu.RotorBladePitchAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:Pxo,children:[B.t("windTurbineMenu.RotorBladeRadius",o)," ..."]})},{key:"wind-turbine-rotor-blade-design",label:h.jsxs(Zn,{noPadding:!0,Dialog:Cxo,children:[B.t("windTurbineMenu.RotorBladeDesign",o)," ..."]})},{key:"wind-turbine-hub-design",label:h.jsxs(Zn,{noPadding:!0,Dialog:Rxo,children:[B.t("windTurbineMenu.HubDesign",o)," ..."]})},{key:"wind-turbine-bird-safe-blade",label:h.jsxs(Zn,{noPadding:!0,Dialog:Hxo,children:[B.t("windTurbineMenu.BirdSafeDesign",o)," ..."]})}]},{key:"wind-turbine-tower-submenu",label:h.jsx(ln,{children:B.t("windTurbineMenu.Tower",o)}),children:[{key:"wind-turbine-tower-height",label:h.jsxs(Zn,{noPadding:!0,Dialog:Mxo,children:[B.t("windTurbineMenu.TowerHeight",o)," ..."]})},{key:"wind-turbine-tower-radius",label:h.jsxs(Zn,{noPadding:!0,Dialog:Ixo,children:[B.t("windTurbineMenu.TowerRadius",o)," ..."]})}]},{key:"wind-turbine-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)}),{items:e}},Dxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(p5e),l=H(g5e),s=H(no),c=H(qn),u=H(Ji),d=ao(z.SolarWaterHeater),[f,p]=g.useState((d==null?void 0:d.lx)??1),m=g.useRef(!1),y=g.useRef(),w=Kt(),x=(F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===F&&!j.locked){j.lx=E;break}})},C=(F,E)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===F&&!j.locked&&(j.lx=E)})},P=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarWaterHeater&&!Y.locked){let O;E?O=Y.parentId===F&&ye.isIdentical(Y.normal,E):O=Y.parentId===F,O&&(Y.lx=L)}})},A=F=>{e(E=>{for(const L of E.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lx=F)})},S=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&F.has(j.id)&&(j.lx=E)})},v=F=>{l(F.target.value)},b=(F,E)=>{const L=r(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.lx=E,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},T=(F,E)=>!b(F,E),R=F=>{if(d){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(E.lx-F)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&Math.abs(E.lx-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const E of n)if(E.type===z.SolarWaterHeater&&E.foundationId===(d==null?void 0:d.foundationId)&&!E.locked&&Math.abs(E.lx-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lx-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lx-F)>Ht)return!0}break}default:{if(Math.abs((d==null?void 0:d.lx)-F)>Ht)return!0;break}}return!1}},M=F=>{if(d&&R(F))switch(y.current=void 0,a){case ie.AllSelectedObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.lx);const L={name:"Set Length for Selected Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{S(L.oldValues,L.newValue)}};i(L),S(E,F),c(s+1)}break}case ie.AllObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.lx);const L={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{A(L.newValue)}};i(L),A(F),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&E.foundationId===d.foundationId&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&E.set(j.id,j.lx);const L={name:"Set Length for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:d.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,F),c(s+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(m.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&T(j,F)){m.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&T(j,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lx);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&ye.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lx);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lx);const O=Y?d.normal:void 0,_={name:"Set Length for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:d.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())x(G,Q)},redo:()=>{_.groupId&&P(_.groupId,_.normal,_.newValue)}};i(_),P(d.parentId,O,F),c(s+1)}}break}default:{const E=o(d.id),L=E?E.lx:d.lx;if(m.current=T(d,F),m.current)y.current=F,p(L);else{const j={name:"Set Water Heater Length",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(j.changedElementId,j.oldValue)},redo:()=>{x(j.changedElementId,j.newValue)}};i(j),x(d.id,F),c(s+1)}break}}},D=()=>{m.current=!1,t(!1)},k=()=>{D(),u()},N=()=>{M(f),m.current||(t(!1),c(0))},U=()=>{M(f)},W=m.current?": "+B.t("message.NotApplicableToSelectedAction",w)+(y.current!==void 0?" ("+y.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Length",w),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:6,children:h.jsx(mn,{min:0,max:100,step:.1,style:{width:120},precision:2,value:f,onChange:F=>{F!==null&&p(F)}})}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:v,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",w)})]})})})]})})},Exo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(Wh),l=H(Nh),s=H(no),c=H(qn),u=H(Ji),d=ao(z.SolarWaterHeater),[f,p]=g.useState(0),[m,y]=g.useState((d==null?void 0:d.ly)??1),w=g.useRef(!1),x=g.useRef(),C=Kt();g.useEffect(()=>{d&&p(Number((d.lz-.3).toFixed(2)))},[d]);const P=(L,j)=>{e(Y=>{for(const O of Y.elements)if(O.type===z.SolarWaterHeater&&O.id===L&&!O.locked){O.ly=j;break}})},A=(L,j)=>{e(Y=>{for(const O of Y.elements)O.type===z.SolarWaterHeater&&O.foundationId===L&&!O.locked&&(O.ly=j)})},S=(L,j,Y)=>{e(O=>{for(const _ of O.elements)if(_.type===z.SolarWaterHeater&&!_.locked){let G;j?G=_.parentId===L&&ye.isIdentical(_.normal,j):G=_.parentId===L,G&&(_.ly=Y)}})},v=L=>{e(j=>{for(const Y of j.elements)Y.type===z.SolarWaterHeater&&!Y.locked&&(Y.ly=L)})},b=(L,j)=>{H.getState().set(Y=>{for(const O of Y.elements)O.type===z.SolarWaterHeater&&!O.locked&&L.has(O.id)&&(O.ly=j)})},T=L=>{l(L.target.value)},R=(L,j)=>{const Y=r(L);if(Y){if(Y.type===z.Cuboid&&!ye.isIdentical(L.normal,fs))return!0;const O=JSON.parse(JSON.stringify(L));return O.ly=j,Y.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(O,Y)}return!1},M=(L,j)=>!R(L,j),D=L=>{if(d){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.ly-L)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&Math.abs(j.ly-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const j of n)if(j.type===z.SolarWaterHeater&&j.foundationId===(d==null?void 0:d.foundationId)&&!j.locked&&Math.abs(j.ly-L)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&ye.isIdentical(O.normal,d.normal)&&!O.locked&&Math.abs(O.ly-L)>Ht)return!0}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&Math.abs(O.ly-L)>Ht)return!0}break}default:{if(Math.abs((d==null?void 0:d.ly)-L)>Ht)return!0;break}}return!1}},k=L=>{if(d&&D(L))switch(x.current=void 0,a){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&H.getState().selectedElementIdSet.has(j.id)&&M(j,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&H.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.ly);const Y={name:"Set Width for Selected Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())P(O,_)},redo:()=>{b(Y.oldValues,Y.newValue)}};i(Y),b(j,L),c(s+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&M(j,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&j.set(O.id,O.ly);const Y={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,_]of Y.oldValues.entries())P(O,_)},redo:()=>{v(Y.newValue)}};i(Y),v(L),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){w.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.foundationId===d.foundationId&&M(j,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&O.foundationId===d.foundationId&&j.set(O.id,O.ly);const Y={name:"Set Width for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:d.foundationId,undo:()=>{for(const[O,_]of Y.oldValues.entries())P(O,_)},redo:()=>{Y.groupId&&A(Y.groupId,Y.newValue)}};i(Y),A(d.foundationId,L),c(s+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(w.current=!1,j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&ye.isIdentical(O.normal,d.normal)&&!O.locked&&M(O,L)){w.current=!0;break}}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&M(O,L)){w.current=!0;break}if(w.current)x.current=L,y(d.ly);else{const O=new Map,_=j.type===z.Cuboid;if(_)for(const oe of n)oe.type===z.SolarWaterHeater&&oe.parentId===d.parentId&&ye.isIdentical(oe.normal,d.normal)&&!oe.locked&&O.set(oe.id,oe.ly);else for(const oe of n)oe.type===z.SolarWaterHeater&&oe.parentId===d.parentId&&!oe.locked&&O.set(oe.id,oe.ly);const G=_?d.normal:void 0,Q={name:"Set Width for All Water Heater on Surface",timestamp:Date.now(),oldValues:O,newValue:L,groupId:d.parentId,normal:G,undo:()=>{for(const[oe,ee]of Q.oldValues.entries())P(oe,ee)},redo:()=>{Q.groupId&&S(Q.groupId,Q.normal,Q.newValue)}};i(Q),S(d.parentId,G,L),c(s+1)}}break}default:{const j=o(d.id),Y=j?j.ly:d.ly;if(w.current=M(d,L),w.current)x.current=L,y(Y);else{const O={name:"Set Water Heater Width",timestamp:Date.now(),oldValue:Y,newValue:L,changedElementId:d.id,changedElementType:d.type,undo:()=>{P(O.changedElementId,O.oldValue)},redo:()=>{P(O.changedElementId,O.newValue)}};i(O),P(d.id,L),c(s+1)}break}}},N=()=>{w.current=!1,t(!1)},U=()=>{N(),u()},W=()=>{k(m),w.current||(t(!1),c(0))},F=()=>{k(m)},E=w.current?": "+B.t("message.NotApplicableToSelectedAction",C)+(x.current!==void 0?" ("+x.current.toFixed(2)+")":""):null;return console.log("min",f),h.jsx(ro,{width:550,title:B.t("word.Width",C),rejectedMessage:E,onApply:F,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:6,children:h.jsx(mn,{min:f,max:100,step:.1,style:{width:120},precision:2,value:m,onChange:L=>{L!==null&&y(L)}})}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",C)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:T,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",C)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",C)})]})})})]})})},kxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H(yQ),i=H(AXe),a=H(wXe),l=H(xXe),s=H($r),c=H(Fn),u=H(p5e),d=H(g5e),f=H(no),p=H(qn),m=H(Ji),y=ao(z.SolarWaterHeater),w=g.useRef(!1),x=g.useRef(),[C,P]=g.useState(y?-y.relativeAzimuth:0),A=Kt(),S=F=>{d(F.target.value)},v=(F,E)=>{const L=s(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.relativeAzimuth=-E,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(F,E)=>!v(F,E),T=F=>{if(y){switch(u){case ie.AllSelectedObjectsOfThisType:for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisType:for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const E of n)if(E.type===z.SolarWaterHeater&&E.foundationId===(y==null?void 0:y.foundationId)&&!E.locked&&Math.abs(-E.relativeAzimuth-F)>Ht)return!0;break;case ie.AllObjectsOfThisTypeOnSurface:if(y!=null&&y.parentId){const E=s(y);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===y.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-F)>Ht)return!0}}break;default:if(Math.abs(-(y==null?void 0:y.relativeAzimuth)-F)>Ht)return!0}return!1}},R=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&!j.locked&&F.has(j.id)){const Y=j;Y.relativeAzimuth=E}})},M=F=>{if(y&&T(F)){switch(x.current=void 0,u){case ie.AllSelectedObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(E,-F),p(f+1)}break}case ie.AllObjectsOfThisType:{w.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{l(z.SolarWaterHeater,-L.newValue)}};c(L),l(z.SolarWaterHeater,-F),p(f+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(y.foundationId){w.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&E.foundationId===y.foundationId&&b(E,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===y.foundationId&&E.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:y.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())r(j,-Y)},redo:()=>{L.groupId&&a(z.SolarWaterHeater,L.groupId,-L.newValue)}};c(L),a(z.SolarWaterHeater,y.foundationId,-F),p(f+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{if(y.parentId){const E=s(y);if(E){if(w.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===y.parentId&&ye.isIdentical(j.normal,y.normal)&&b(j,F)){w.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===y.parentId&&b(j,F)){w.current=!0;break}if(w.current)x.current=F,P(-y.relativeAzimuth);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===y.parentId&&ye.isIdentical(G.normal,y.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===y.parentId&&j.set(G.id,-G.relativeAzimuth);const O=Y?y.normal:void 0,_={name:"Set Relative Azimuth for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:y.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())r(G,-Q)},redo:()=>{_.groupId&&i(z.SolarWaterHeater,_.groupId,_.normal,-_.newValue)}};c(_),i(z.SolarWaterHeater,y.parentId,O,-F),p(f+1)}}}break}default:{const E=o(y.id),L=E?-E.relativeAzimuth:-y.relativeAzimuth;if(w.current=b(y,F),w.current)x.current=F,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:y.id,changedElementType:y.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(y.id,-F),p(f+1)}break}}e(E=>{E.actionState.solarWaterHeaterRelativeAzimuth=-F})}},D=()=>{w.current=!1,t(!1)},k=()=>{D(),m()},N=()=>{M(C),w.current||(t(!1),p(0))},U=()=>{M(C)},W=w.current?": "+B.t("message.NotApplicableToSelectedAction",A)+(x.current!==void 0?" ("+ye.toDegrees(x.current).toFixed(1)+"°)":null):null;return h.jsx(ro,{width:550,title:B.t("solarCollectorMenu.RelativeAzimuth",A),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(C).toFixed(2)),formatter:F=>`${F}°`,onChange:F=>{F!==null&&P(ye.toRadians(F))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",A),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",A),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",A)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(We.Group,{onChange:S,value:u,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",A)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",A)})]})})})]})})},Fxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H(Jn),r=H($r),i=H(Fn),a=H(p5e),l=H(g5e),s=H(no),c=H(qn),u=H(Ji),d=ao(z.SolarWaterHeater),[f,p]=g.useState((d==null?void 0:d.lz)??1),m=g.useRef(!1),y=g.useRef(),w=Kt(),x=(F,E)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===F&&!j.locked){j.lz=E;break}})},C=(F,E)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===F&&!j.locked&&(j.lz=E)})},P=(F,E,L)=>{e(j=>{for(const Y of j.elements)if(Y.type===z.SolarWaterHeater&&!Y.locked){let O;E?O=Y.parentId===F&&ye.isIdentical(Y.normal,E):O=Y.parentId===F,O&&(Y.lz=L)}})},A=F=>{e(E=>{for(const L of E.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lz=F)})},S=(F,E)=>{H.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&F.has(j.id)&&(j.lz=E)})},v=F=>{l(F.target.value)},b=(F,E)=>{const L=r(F);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(F.normal,fs))return!0;const j=JSON.parse(JSON.stringify(F));return j.lz=E,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},T=(F,E)=>!b(F,E),R=F=>{if(d){switch(a){case ie.AllSelectedObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&Math.abs(E.lz-F)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&Math.abs(E.lz-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const E of n)if(E.type===z.SolarWaterHeater&&E.foundationId===(d==null?void 0:d.foundationId)&&!E.locked&&Math.abs(E.lz-F)>Ht)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lz-F)>Ht)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lz-F)>Ht)return!0}break}default:{if(Math.abs((d==null?void 0:d.lz)-F)>Ht)return!0;break}}return!1}},M=F=>{if(d&&R(F)){switch(y.current=void 0,a){case ie.AllSelectedObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&H.getState().selectedElementIdSet.has(E.id)&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(j.id)&&E.set(j.id,j.lz);const L={name:"Set Height for Selected Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{S(L.oldValues,L.newValue)}};i(L),S(E,F),c(s+1)}break}case ie.AllObjectsOfThisType:{m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&E.set(j.id,j.lz);const L={name:"Set Height for All Water Heater",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{A(L.newValue)}};i(L),A(F),c(s+1)}break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){m.current=!1;for(const E of n)if(E.type===z.SolarWaterHeater&&!E.locked&&E.foundationId===d.foundationId&&T(E,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const E=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&E.set(j.id,j.lz);const L={name:"Set Height for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:d.foundationId,undo:()=>{for(const[j,Y]of L.oldValues.entries())x(j,Y)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,F),c(s+1)}}break}case ie.AllObjectsOfThisTypeOnSurface:{const E=r(d);if(E){if(m.current=!1,E.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&T(j,F)){m.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&T(j,F)){m.current=!0;break}if(m.current)y.current=F,p(d.lz);else{const j=new Map,Y=E.type===z.Cuboid;if(Y)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&ye.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lz);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lz);const O=Y?d.normal:void 0,_={name:"Set Height for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:F,groupId:d.parentId,normal:O,undo:()=>{for(const[G,Q]of _.oldValues.entries())x(G,Q)},redo:()=>{_.groupId&&P(_.groupId,_.normal,_.newValue)}};i(_),P(d.parentId,O,F),c(s+1)}}break}default:{const E=o(d.id),L=E?E.lz:d.lz;if(m.current=T(d,F),m.current)y.current=F,p(L);else{const j={name:"Set Water Heater Height",timestamp:Date.now(),oldValue:L,newValue:F,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(j.changedElementId,j.oldValue)},redo:()=>{x(j.changedElementId,j.newValue)}};i(j),x(d.id,F),c(s+1)}break}}e(E=>{E.actionState.solarWaterHeaterHeight=F})}},D=()=>{m.current=!1,t(!1)},k=()=>{D(),u()},N=()=>{M(f),m.current||(t(!1),c(0))},U=()=>{M(f)},W=m.current?": "+B.t("message.NotApplicableToSelectedAction",w)+(y.current!==void 0?" ("+y.current.toFixed(2)+")":""):null;return h.jsx(ro,{width:550,title:B.t("word.Height",w),rejectedMessage:W,onApply:U,onClose:D,onClickCancel:k,onClickOk:N,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:6,children:h.jsx(mn,{min:.6,max:10,step:.1,style:{width:120},precision:2,value:f,onChange:F=>{F!==null&&p(F)}})}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",w)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:v,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",w)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",w)})]})})})]})})},Lxo=({setDialogVisible:t})=>{const e=H(pn),n=H(Qn),o=H($r),r=H(Fn),i=H(Wh),a=H(Nh),l=H(no),s=H(qn),c=ao(z.SolarWaterHeater),[u,d]=g.useState((c==null?void 0:c.color)??"grey"),f=Kt(),p=(b,T)=>{e(R=>{for(const M of R.elements)if(M.type===z.SolarWaterHeater&&M.id===b&&!M.locked){M.color=T;break}})},m=(b,T)=>{e(R=>{for(const M of R.elements)M.type===z.SolarWaterHeater&&M.foundationId===b&&!M.locked&&(M.color=T)})},y=(b,T,R)=>{e(M=>{for(const D of M.elements)if(D.type===z.SolarWaterHeater&&!D.locked){let k;T?k=D.parentId===b&&ye.isIdentical(D.normal,T):k=D.parentId===b,k&&(D.color=R)}})},w=b=>{e(T=>{for(const R of T.elements)R.type===z.SolarWaterHeater&&!R.locked&&(R.color=b)})},x=(b,T)=>{H.getState().set(R=>{for(const M of R.elements)M.type===z.SolarWaterHeater&&!M.locked&&b.has(M.id)&&(M.color=T)})},C=b=>{a(b.target.value)},P=b=>{if(c){switch(i){case ie.AllSelectedObjectsOfThisType:{for(const T of n)if(T.type===z.SolarWaterHeater&&!T.locked&&H.getState().selectedElementIdSet.has(T.id)&&T.color!==b)return!0;break}case ie.AllObjectsOfThisType:{for(const T of n)if(T.type===z.SolarWaterHeater&&!T.locked&&T.color!==b)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const T of n)if(T.type===z.SolarWaterHeater&&T.foundationId===(c==null?void 0:c.foundationId)&&!T.locked&&T.color!==b)return!0;break}case ie.AllObjectsOfThisTypeOnSurface:{const T=o(c);if(T){if(T.type===z.Cuboid){for(const M of n)if(M.type===z.SolarWaterHeater&&M.parentId===c.parentId&&ye.isIdentical(M.normal,c.normal)&&!M.locked&&M.color!==b)return!0}else for(const M of n)if(M.type===z.SolarWaterHeater&&M.parentId===c.parentId&&!M.locked&&M.color!==b)return!0}break}default:{if((c==null?void 0:c.color)!==b)return!0;break}}return!1}},A=b=>{if(c&&P(b)){switch(i){case ie.AllSelectedObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.SolarWaterHeater&&H.getState().selectedElementIdSet.has(M.id)&&!M.locked&&T.set(M.id,M.color??"grey");const R={name:"Set Color for Selected Solar Water Heaters",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{x(R.oldValues,R.newValue)}};r(R),x(T,b),s(l+1);break}case ie.AllObjectsOfThisType:{const T=new Map;for(const M of n)M.type===z.SolarWaterHeater&&!M.locked&&T.set(M.id,M.color??"grey");const R={name:"Set Color for All Solar Water Heaters",timestamp:Date.now(),oldValues:T,newValue:b,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{w(R.newValue)}};r(R),w(b),s(l+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const T=new Map;for(const M of n)M.type===z.SolarWaterHeater&&!M.locked&&M.foundationId===c.foundationId&&T.set(M.id,M.color??"grey");const R={name:"Set Color for All Water Heaters Above Foundation",timestamp:Date.now(),oldValues:T,newValue:b,groupId:c.foundationId,undo:()=>{for(const[M,D]of R.oldValues.entries())p(M,D)},redo:()=>{R.groupId&&m(R.groupId,R.newValue)}};r(R),m(c.foundationId,b),s(l+1)}break}case ie.AllObjectsOfThisTypeOnSurface:{const T=o(c);if(T){const R=new Map,M=T.type===z.Cuboid;if(M)for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&ye.isIdentical(N.normal,c.normal)&&R.set(N.id,N.color??"grey");else for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&R.set(N.id,N.color??"grey");const D=M?c.normal:void 0,k={name:"Set Color for All Water Heaters on Surface",timestamp:Date.now(),oldValues:R,newValue:b,groupId:c.parentId,normal:D,undo:()=>{for(const[N,U]of k.oldValues.entries())p(N,U)},redo:()=>{k.groupId&&y(k.groupId,k.normal,k.newValue)}};r(k),y(c.parentId,D,b),s(l+1)}break}default:{const T=c?c.color:"grey",R={name:"Set Color of Selected Water Heater",timestamp:Date.now(),oldValue:T,newValue:b,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(c.id,R.oldValue)},redo:()=>{p(c.id,R.newValue)}};r(R),p(c.id,b),s(l+1);break}}e(T=>{T.actionState.solarWaterHeaterColor=b})}},S=()=>{t(!1)},v=()=>{A(u)};return h.jsx(ro,{width:680,title:B.t("word.Color",f),onApply:v,onClose:S,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:10,children:h.jsx(sd,{color:u??(c==null?void 0:c.color)??"grey",onChangeComplete:b=>{d(b.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(We.Group,{onChange:C,value:i,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeOnSurface,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",f)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("solarWaterHeaterMenu.AllSolarWaterHeaters",f)})]})})})]})})},Wxo=t=>{const e=[];if(t.type!==z.SolarWaterHeater)return{items:e};const n=t,o=!n.locked,r={lng:H.getState().language},i=t.type===z.SolarWaterHeater&&ye.isIdentical(n.normal,fs);return e.push({key:"water-heater-copy",label:h.jsx(ad,{})}),o&&e.push({key:"water-heater-cut",label:h.jsx(ld,{})}),e.push({key:"water-heater-lock",label:h.jsx(D0,{selectedElement:n})}),o&&(e.push({key:"water-heater-length",label:h.jsxs(Zn,{Dialog:Dxo,children:[B.t("word.Length",r)," ..."]})},{key:"water-heater-width",label:h.jsxs(Zn,{Dialog:Exo,children:[B.t("word.Width",r)," ..."]})},{key:"water-heater-height",label:h.jsxs(Zn,{Dialog:Fxo,children:[B.t("word.Height",r)," ..."]})}),i&&e.push({key:"water-heater-relative-azimuth",label:h.jsxs(Zn,{Dialog:kxo,children:[B.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),e.push({key:"water-heater-frame-color",label:h.jsxs(Zn,{Dialog:Lxo,children:[B.t("word.Color",r)," ..."]})}),e.push({key:"solar-water-heater-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",r)}),children:q5(n)})),{items:e}},Nxo=({setDialogVisible:t})=>{const e=H(Jn),n=H(mQ),o=H(Fn),r=H(_N),i=H(VN),a=H(no),l=H(qn),s=ao(z.BatteryStorage),[c,u]=g.useState(s?-s.rotation[2]:0),d=Kt(),f=P=>{i(P.target.value)},p=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)v.type===z.BatteryStorage&&!v.locked&&v.parentId===P&&(v.rotation[2]=-A)})},m=P=>{switch(r){case ie.AllSelectedObjectsOfThisType:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&H.getState().selectedElementIdSet.has(A.id)&&Math.abs(-A.rotation[2]-P)>Ht)return!0;break;case ie.AllObjectsOfThisType:{for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&Math.abs(-A.rotation[2]-P)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&A.parentId===(s==null?void 0:s.parentId)&&!A.locked&&Math.abs(-A.rotation[2]-P)>Ht)return!0;break;default:if(Math.abs((s?-s.rotation[2]:0)-P)>Ht)return!0}return!1},y=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)if(P.has(v.id))if(A!==void 0)v.rotation[2]=A;else{const b=P.get(v.id);b!==void 0&&(v.rotation[2]=-b)}})},w=P=>{if(s&&m(P))switch(r){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&!v.locked&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,-v.rotation[2]);const S={name:"Set Azimuth for Selected Battery Storages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{y(S.oldValues)},redo:()=>{y(S.oldValues,-S.newValue)}};o(S),y(A,-P),l(a+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&!v.locked&&A.set(v.id,-v.rotation[2]);const S={name:"Set Azimuth for All Battery Storages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{y(S.oldValues)},redo:()=>{y(S.oldValues,-S.newValue)}};o(S),y(A,-P),l(a+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&v.parentId===s.parentId&&!v.locked&&A.set(v.id,-v.rotation[2]);const S={name:"Set Azimuth for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{for(const[v,b]of S.oldValues.entries())n(v,0,0,-b)},redo:()=>{p(S.groupId,S.newValue)}};o(S),p(s.parentId,P),l(a+1);break}default:{const A=e(s.id),S=A?-A.rotation[2]:-s.rotation[2],v={name:"Set Battery Storage Azimuth",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{n(v.changedElementId,0,0,-v.oldValue)},redo:()=>{n(v.changedElementId,0,0,-v.newValue)}};o(v),n(s.id,0,0,-P),l(a+1);break}}},x=()=>{t(!1)},C=()=>{w(c)};return h.jsx(ro,{width:550,title:B.t("word.Azimuth",d),onApply:C,onClose:x,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:7,children:[h.jsx(mn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(c).toFixed(2)),formatter:P=>`${P}°`,onChange:P=>{P!==null&&u(ye.toRadians(P))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",d),": [-180°, 180°]",h.jsx("br",{}),B.t("message.AzimuthOfNorthIsZero",d),h.jsx("br",{}),B.t("message.CounterclockwiseAzimuthIsPositive",d)]})]}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:f,value:r,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",d)})]})})})]})})},Uxo=({setDialogVisible:t})=>{const e=H(Fn),n=H(_N),o=H(VN),r=H(no),i=H(qn),a=ao(z.BatteryStorage),[l,s]=g.useState((a==null?void 0:a.lz)??0),c=Kt(),u=C=>{o(C.target.value)},d=C=>{if(a){switch(n){case ie.AllSelectedObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(P.lz-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&Math.abs(P.lz-C)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&P.parentId===a.parentId&&!P.locked&&Math.abs(P.lz-C)>Ht)return!0;break}default:{if(Math.abs((a==null?void 0:a.lz)-C)>Ht)return!0;break}}return!1}},f=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(S.type===z.BatteryStorage&&C.has(S.id))if(P!==void 0)S.lz=P;else{const v=C.get(S.id);v!==void 0&&(S.lz=v)}})},p=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)S.type===z.BatteryStorage&&!S.locked&&S.parentId===C&&(S.lz=P)})},m=(C,P)=>{H.getState().set(A=>{const S=A.elements.find(v=>v.id===C);S&&(S.lz=P)})},y=C=>{if(a&&d(C))switch(n){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,S.lz);const A={name:"Set Lz for Selected Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&P.set(S.id,S.lz);const A={name:"Set Lz for All Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&S.parentId===a.parentId&&!S.locked&&P.set(S.id,S.lz);const A={name:"Set Lz for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:a.parentId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.groupId,A.newValue)}};e(A),p(a.parentId,C),i(r+1);break}default:{const P={name:"Set Battery Storage Lz",timestamp:Date.now(),oldValue:a.lz,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{m(P.changedElementId,P.oldValue)},redo:()=>{m(P.changedElementId,P.newValue)}};e(P),m(a.id,C),i(r+1);break}}},w=()=>{t(!1)},x=()=>{y(l)};return h.jsx(ro,{width:550,title:B.t("word.Height",c),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 1000] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:u,value:n,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",c)})]})})})]})})},jxo=({setDialogVisible:t})=>{const e=H(Fn),n=H(_N),o=H(VN),r=H(no),i=H(qn),a=ao(z.BatteryStorage),[l,s]=g.useState((a==null?void 0:a.ly)??0),c=Kt(),u=C=>{o(C.target.value)},d=C=>{if(a){switch(n){case ie.AllSelectedObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(P.ly-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&Math.abs(P.ly-C)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&P.parentId===a.parentId&&!P.locked&&Math.abs(P.ly-C)>Ht)return!0;break}default:{if(Math.abs((a==null?void 0:a.ly)-C)>Ht)return!0;break}}return!1}},f=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(S.type===z.BatteryStorage&&C.has(S.id))if(P!==void 0)S.ly=P;else{const v=C.get(S.id);v!==void 0&&(S.ly=v)}})},p=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)S.type===z.BatteryStorage&&!S.locked&&S.parentId===C&&(S.ly=P)})},m=(C,P)=>{H.getState().set(A=>{const S=A.elements.find(v=>v.id===C);S&&(S.ly=P)})},y=C=>{if(a&&d(C))switch(n){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,S.ly);const A={name:"Set Ly for Selected Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&P.set(S.id,S.ly);const A={name:"Set Ly for All Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&S.parentId===a.parentId&&!S.locked&&P.set(S.id,S.ly);const A={name:"Set Ly for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:a.parentId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.groupId,A.newValue)}};e(A),p(a.parentId,C),i(r+1);break}default:{const P={name:"Set Battery Storage Ly",timestamp:Date.now(),oldValue:a.ly,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{m(P.changedElementId,P.oldValue)},redo:()=>{m(P.changedElementId,P.newValue)}};e(P),m(a.id,C),i(r+1);break}}},w=()=>{t(!1)},x=()=>{y(l)};return h.jsx(ro,{width:550,title:B.t("word.Width",c),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:100,style:{width:120},step:.5,precision:2,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 100] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:u,value:n,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",c)})]})})})]})})},Bxo=({setDialogVisible:t})=>{const e=H(Fn),n=H(_N),o=H(VN),r=H(no),i=H(qn),a=ao(z.BatteryStorage),[l,s]=g.useState((a==null?void 0:a.lx)??0),c=Kt(),u=C=>{o(C.target.value)},d=C=>{if(a){switch(n){case ie.AllSelectedObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&H.getState().selectedElementIdSet.has(P.id)&&Math.abs(P.lx-C)>Ht)return!0;break}case ie.AllObjectsOfThisType:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&!P.locked&&Math.abs(P.lx-C)>Ht)return!0;break}case ie.AllObjectsOfThisTypeAboveFoundation:{for(const P of H.getState().elements)if(P.type===z.BatteryStorage&&P.parentId===a.parentId&&!P.locked&&Math.abs(P.lx-C)>Ht)return!0;break}default:{if(Math.abs((a==null?void 0:a.lx)-C)>Ht)return!0;break}}return!1}},f=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)if(S.type===z.BatteryStorage&&C.has(S.id))if(P!==void 0)S.lx=P;else{const v=C.get(S.id);v!==void 0&&(S.lx=v)}})},p=(C,P)=>{H.getState().set(A=>{for(const S of A.elements)S.type===z.BatteryStorage&&!S.locked&&S.parentId===C&&(S.lx=P)})},m=(C,P)=>{H.getState().set(A=>{const S=A.elements.find(v=>v.id===C);S&&(S.lx=P)})},y=C=>{if(a&&d(C))switch(n){case ie.AllSelectedObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&H.getState().selectedElementIdSet.has(S.id)&&P.set(S.id,S.lx);const A={name:"Set Lx for Selected Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisType:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&!S.locked&&P.set(S.id,S.lx);const A={name:"Set Lx for All Battery Storages",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(A.oldValues)},redo:()=>{f(A.oldValues,A.newValue)}};e(A),f(P,C),i(r+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const P=new Map;for(const S of H.getState().elements)S.type===z.BatteryStorage&&S.parentId===a.parentId&&!S.locked&&P.set(S.id,S.lx);const A={name:"Set Lx for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:a.parentId,undo:()=>{f(A.oldValues)},redo:()=>{p(A.groupId,A.newValue)}};e(A),p(a.parentId,C),i(r+1);break}default:{const P={name:"Set Battery Storage Lx",timestamp:Date.now(),oldValue:a.lx,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{m(P.changedElementId,P.oldValue)},redo:()=>{m(P.changedElementId,P.newValue)}};e(P),m(a.id,C),i(r+1);break}}},w=()=>{t(!1)},x=()=>{y(l)};return h.jsx(ro,{width:550,title:B.t("word.Length",c),onApply:x,onClose:w,children:h.jsxs(Qt,{gutter:6,children:[h.jsxs(Ge,{span:6,children:[h.jsx(mn,{min:.1,max:100,style:{width:120},step:.5,precision:2,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[B.t("word.Range",c),": [0.1, 100] ",B.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ge,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:B.t("word.MeterAbbreviation",c)}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(We.Group,{onChange:u,value:n,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",c)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",c)})]})})})]})})},Yxo=({setDialogVisible:t})=>{const e=H(f5e),n=H(Jn),o=H(h5e),r=H(Fn),i=H(qn),a=H(_N),l=H(VN),s=ao(z.BatteryStorage),[c,u]=g.useState((s==null?void 0:s.color)??"#808080"),d=Kt(),f=P=>{l(P.target.value)},p=P=>{switch(a){case ie.AllSelectedObjectsOfThisType:{for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&H.getState().selectedElementIdSet.has(A.id)&&P!==A.color)return!0;break}case ie.AllObjectsOfThisType:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&!A.locked&&P!==A.color)return!0;break;case ie.AllObjectsOfThisTypeAboveFoundation:for(const A of H.getState().elements)if(A.type===z.BatteryStorage&&A.parentId===(s==null?void 0:s.parentId)&&!A.locked&&P!==A.color)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0}return!1},m=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)if(v.type===z.BatteryStorage&&P.has(v.id))if(A!==void 0)v.color=A;else{const b=P.get(v.id);b!==void 0&&(v.color=b)}})},y=(P,A)=>{H.getState().set(S=>{for(const v of S.elements)v.type===z.BatteryStorage&&!v.locked&&v.parentId===P&&(v.color=A)})},w=P=>{if(s&&p(P))switch(a){case ie.AllSelectedObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&H.getState().selectedElementIdSet.has(v.id)&&A.set(v.id,v.color??"#808080");const S={name:"Set Color for Selected BatteryStorages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{m(S.oldValues,S.newValue)}};r(S),m(A,P),i(H.getState().applyCount+1);break}case ie.AllObjectsOfThisType:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&A.set(v.id,v.color??"#808080");const S={name:"Set Color for All BatteryStorages",timestamp:Date.now(),oldValues:A,newValue:P,undo:()=>{m(S.oldValues)},redo:()=>{o(z.BatteryStorage,S.newValue)}};r(S),o(z.BatteryStorage,P),i(H.getState().applyCount+1);break}case ie.AllObjectsOfThisTypeAboveFoundation:{const A=new Map;for(const v of H.getState().elements)v.type===z.BatteryStorage&&v.parentId===s.parentId&&!v.locked&&A.set(v.id,v.color??"#808080");const S={name:"Set Color for All Battery Storage on Same Foundation",timestamp:Date.now(),oldValues:A,newValue:P,groupId:s.parentId,undo:()=>{m(S.oldValues)},redo:()=>{y(S.groupId,S.newValue)}};r(S),y(s.parentId,P),i(H.getState().applyCount+1);break}default:{const A=n(s.id),S=A?A.color:s.color,v={name:"Set Color of Selected Battery Storage",timestamp:Date.now(),oldValue:S,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{e(v.changedElementId,v.oldValue)},redo:()=>{e(v.changedElementId,v.newValue)}};r(v),e(s.id,P),i(H.getState().applyCount+1);break}}},x=()=>{w(c)},C=()=>{t(!1)};return h.jsx(ro,{width:650,title:B.t("word.Color",d),onApply:x,onClose:C,children:h.jsxs(Qt,{gutter:6,children:[h.jsx(Ge,{span:12,children:h.jsx(sd,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ge,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(We.Group,{onChange:f,value:a,children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(We,{style:{width:"100%"},value:ie.OnlyThisObject,children:B.t("batteryStorageMenu.OnlyThisBatteryStorage",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisTypeAboveFoundation,children:B.t("batteryStorageMenu.AllBatteryStoragesAboveSameBase",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllSelectedObjectsOfThisType,children:B.t("batteryStorageMenu.AllSelectedBatteryStorages",d)}),h.jsx(We,{style:{width:"100%"},value:ie.AllObjectsOfThisType,children:B.t("batteryStorageMenu.AllBatteryStorages",d)})]})})})]})})},Oxo=t=>{const e=[];if(t.type!==z.BatteryStorage)return{items:e};const n=t,o={lng:H.getState().language},r=!(n!=null&&n.locked);return e.push({key:"battery-storage-copy",label:h.jsx(ad,{})}),r&&e.push({key:"battery-storage-cut",label:h.jsx(ld,{})}),e.push({key:"battery-storage-lock",label:h.jsx(D0,{selectedElement:n})}),r&&(e.push({key:"battery-storage-color",label:h.jsxs(Zn,{Dialog:Yxo,children:[B.t("word.Color",o)," ..."]})}),e.push({key:"battery-storage-length",label:h.jsxs(Zn,{Dialog:Bxo,children:[B.t("word.Length",o)," ..."]})}),e.push({key:"battery-storage-width",label:h.jsxs(Zn,{Dialog:jxo,children:[B.t("word.Width",o)," ..."]})}),e.push({key:"battery-storage-height",label:h.jsxs(Zn,{Dialog:Uxo,children:[B.t("word.Height",o)," ..."]})}),e.push({key:"battery-storage-azimuth",label:h.jsxs(Zn,{Dialog:Nxo,children:[B.t("word.Azimuth",o)," ..."]})}),e.push({key:"battery-storage-label",label:h.jsx(ln,{children:B.t("labelSubMenu.Label",o)}),children:q5(n)})),{items:e}},_xo=()=>{const t=H(eCt),e=ao(),n=g.useRef(t),o=g.useRef(e);return t!==null?(n.current=t,o.current=e):setTimeout(()=>{n.current=t,o.current=t===null?void 0:e},200),[n.current,o.current]},Vxo=({children:t})=>{dt(r=>r.contextMenuFlag);const[e,n]=_xo(),o=()=>{if(!n)return e===z.Ground?Y4o():e===z.Sky?Xwo():{items:[]};switch(e){case z.Foundation:return l4o(n);case z.Cuboid:return z4o(n);case z.Wall:return g7o(n);case z.Roof:return xxo(n);case z.SolarPanel:return l8o(n);case z.Window:return _7o(n);case z.Door:return R7o(n);case z.Sensor:return zwo(n);case z.Light:return Lwo(n);case z.Human:return Q4o(n);case z.Tree:return X8o(n);case z.Flower:return ewo(n);case z.ParabolicTrough:return y8o(n);case z.ParabolicDish:return R8o(n);case z.FresnelReflector:return L8o(n);case z.Heliostat:return V8o(n);case z.Polygon:return Two(n);case z.PolygonVertex:return Hwo(n);case z.WindTurbine:return zxo(n);case z.SolarWaterHeater:return Wxo(n);case z.BatteryStorage:return Oxo(n);default:return{items:[]}}};return h.jsx(e4,{trigger:["contextMenu"],menu:o(),overlayClassName:"my-overlay",children:t})},Gxo=xe.memo(Vxo);(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(I,V,fe){I!=Array.prototype&&I!=Object.prototype&&(I[V]=fe.value)};function n(I){I=[typeof window=="object"&&window,typeof self=="object"&&self,typeof global=="object"&&global,I];for(var V=0;VI.b&&(I.b++,V.next=I.a,I.a=V)}function Y(){this.b=this.a=null}var O=new L(function(){return new G},function(I){I.reset()});Y.prototype.add=function(I,V){var fe=O.get();fe.set(I,V),this.b?this.b.next=fe:this.a=fe,this.b=fe};function _(){var I=Wo,V=null;return I.a&&(V=I.a,I.a=I.a.next,I.a||(I.b=null),V.next=null),V}function G(){this.next=this.b=this.a=null}G.prototype.set=function(I,V){this.a=I,this.b=V,this.next=null},G.prototype.reset=function(){this.next=this.b=this.a=null};var Q=Array.prototype.indexOf?function(I,V){return Array.prototype.indexOf.call(I,V,void 0)}:function(I,V){if(typeof I=="string")return typeof V!="string"||V.length!=1?-1:I.indexOf(V,0);for(var fe=0;feV?null:typeof I=="string"?I.charAt(V):I[V]}function te(I,V){return 0<=Q(I,V)}function q(I,V){V=Q(I,V);var fe;return(fe=0<=V)&&Array.prototype.splice.call(I,V,1),fe}function le(I,V){var fe=0;ee(I,function(De,Ke){V.call(void 0,De,Ke,I)&&Array.prototype.splice.call(I,Ke,1).length==1&&fe++})}function de(I){return Array.prototype.concat.apply([],arguments)}function he(I){var V=I.length;if(0/g,Ie=/"/g,ve=/'/g,ze=/\x00/g,Ae=/[\x00&<>"']/;function se(I,V){return I.indexOf(V)!=-1}function ge(I,V){return IV?1:0}var we;e:{var Se=s.navigator;if(Se){var Me=Se.userAgent;if(Me){we=Me;break e}}we=""}function Ce(I){return se(we,I)}function Te(I,V){for(var fe in I)V.call(void 0,I[fe],fe,I)}function Re(I){for(var V in I)return!1;return!0}function Ne(I){var V={},fe;for(fe in I)V[fe]=I[fe];return V}var _e="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ue(I,V){for(var fe,De,Ke=1;Ke"}else Tt=I===void 0?"undefined":I===null?"null":typeof I;E("Argument is not a %s (or a non-Element, non-Location mock); got: %s",V,Tt)}}function Fe(I,V){this.a=I===Ye&&V||"",this.b=Le}Fe.prototype.ta=!0,Fe.prototype.sa=function(){return this.a},Fe.prototype.toString=function(){return"Const{"+this.a+"}"};function He(I){return I instanceof Fe&&I.constructor===Fe&&I.b===Le?I.a:(E("expected object of type Const, got '"+I+"'"),"type_error:Const")}var Le={},Ye={},lt;function Oe(){if(lt===void 0){var I=null,V=s.trustedTypes;if(V&&V.createPolicy){try{I=V.createPolicy("goog#html",{createHTML:v,createScript:v,createScriptURL:v})}catch(fe){s.console&&s.console.error(fe.message)}lt=I}else lt=I}return lt}function ut(I,V){this.a=V===tt?I:""}ut.prototype.ta=!0,ut.prototype.sa=function(){return this.a.toString()},ut.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};function ht(I){return I instanceof ut&&I.constructor===ut?I.a:(E("expected object of type TrustedResourceUrl, got '"+I+"' of type "+p(I)),"type_error:TrustedResourceUrl")}function Qe(I,V){var fe=He(I);if(!mt.test(fe))throw Error("Invalid TrustedResourceUrl format: "+fe);return I=fe.replace(nt,function(De,Ke){if(!Object.prototype.hasOwnProperty.call(V,Ke))throw Error('Found marker, "'+Ke+'", in format string, "'+fe+'", but no valid label mapping found in args: '+JSON.stringify(V));return De=V[Ke],De instanceof Fe?He(De):encodeURIComponent(String(De))}),gt(I)}var nt=/%{(\w+)}/g,mt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,tt={};function gt(I){var V=Oe();return I=V?V.createScriptURL(I):I,new ut(I,tt)}function Ve(I,V){this.a=V===zt?I:""}Ve.prototype.ta=!0,Ve.prototype.sa=function(){return this.a.toString()},Ve.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};function je(I){return I instanceof Ve&&I.constructor===Ve?I.a:(E("expected object of type SafeUrl, got '"+I+"' of type "+p(I)),"type_error:SafeUrl")}var et=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,bt=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,St=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Pt(I){if(I instanceof Ve)return I;if(I=typeof I=="object"&&I.ta?I.sa():String(I),St.test(I))I=new Ve(I,zt);else{I=String(I),I=I.replace(/(%0A|%0D)/g,"");var V=I.match(bt);I=V&&et.test(V[1])?new Ve(I,zt):null}return I}function Yt(I){return I instanceof Ve?I:(I=typeof I=="object"&&I.ta?I.sa():String(I),St.test(I)||(I="about:invalid#zClosurez"),new Ve(I,zt))}var zt={},Rt=new Ve("about:invalid#zClosurez",zt);function Ct(I,V,fe){this.a=fe===at?I:""}Ct.prototype.ta=!0,Ct.prototype.sa=function(){return this.a.toString()},Ct.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};function yt(I){return I instanceof Ct&&I.constructor===Ct?I.a:(E("expected object of type SafeHtml, got '"+I+"' of type "+p(I)),"type_error:SafeHtml")}var at={};function Et(I,V){qe(I,"HTMLScriptElement"),I.src=ht(V),(V=I.ownerDocument&&I.ownerDocument.defaultView)&&V!=s?V=d(V.document):(u===null&&(u=d(s.document)),V=u),V&&I.setAttribute("nonce",V)}function Lt(I,V,fe,De){return I=I instanceof Ve?I:Yt(I),V=V||s,fe=fe instanceof Fe?He(fe):fe||"",V.open(je(I),fe,De,void 0)}function Je(I,V){for(var fe=I.split("%s"),De="",Ke=Array.prototype.slice.call(arguments,1);Ke.length&&1")!=-1&&(I=I.replace(pe,">")),I.indexOf('"')!=-1&&(I=I.replace(Ie,""")),I.indexOf("'")!=-1&&(I=I.replace(ve,"'")),I.indexOf("\0")!=-1&&(I=I.replace(ze,"�"))),I}function It(I){return It[" "](I),I}It[" "]=f;function ot(I,V){var fe=qt;return Object.prototype.hasOwnProperty.call(fe,I)?fe[I]:fe[I]=V(I)}var it=Ce("Opera"),Be=Ce("Trident")||Ce("MSIE"),pt=Ce("Edge"),ct=pt||Be,Xe=Ce("Gecko")&&!(se(we.toLowerCase(),"webkit")&&!Ce("Edge"))&&!(Ce("Trident")||Ce("MSIE"))&&!Ce("Edge"),ft=se(we.toLowerCase(),"webkit")&&!Ce("Edge");function wt(){var I=s.document;return I?I.documentMode:void 0}var kt;e:{var Zt="",Ot=function(){var I=we;if(Xe)return/rv:([^\);]+)(\)|;)/.exec(I);if(pt)return/Edge\/([\d\.]+)/.exec(I);if(Be)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(I);if(ft)return/WebKit\/(\S+)/.exec(I);if(it)return/(?:Version)[ \/]?(\S+)/.exec(I)}();if(Ot&&(Zt=Ot?Ot[1]:""),Be){var on=wt();if(on!=null&&on>parseFloat(Zt)){kt=String(on);break e}}kt=Zt}var qt={};function rn(I){return ot(I,function(){for(var V=0,fe=me(String(kt)).split("."),De=me(String(I)).split("."),Ke=Math.max(fe.length,De.length),Tt=0;V==0&&Tt"),Tt=Tt.join("")}return Tt=xo(Ke,Tt),Wt&&(typeof Wt=="string"?Tt.className=Wt:Array.isArray(Wt)?Tt.className=Wt.join(" "):kn(Tt,Wt)),2"u"&&typeof window<"u"&&window.postMessage&&window.addEventListener&&!Ce("Presto")&&(I=function(){var Ke=xo(document,"IFRAME");Ke.style.display="none",document.documentElement.appendChild(Ke);var Tt=Ke.contentWindow;Ke=Tt.document,Ke.open(),Ke.close();var Wt="callImmediate"+Math.random(),un=Tt.location.protocol=="file:"?"*":Tt.location.protocol+"//"+Tt.location.host;Ke=P(function(po){(un=="*"||po.origin==un)&&po.data==Wt&&this.port1.onmessage()},this),Tt.addEventListener("message",Ke,!1),this.port1={},this.port2={postMessage:function(){Tt.postMessage(Wt,un)}}}),typeof I<"u"&&!Ce("Trident")&&!Ce("MSIE")){var V=new I,fe={},De=fe;return V.port1.onmessage=function(){if(fe.next!==void 0){fe=fe.next;var Ke=fe.Hb;fe.Hb=null,Ke()}},function(Ke){De.next={Hb:Ke},De=De.next,V.port2.postMessage(0)}}return function(Ke){s.setTimeout(Ke,0)}}function An(I,V){Dn||sr(),Vo||(Dn(),Vo=!0),Wo.add(I,V)}var Dn;function sr(){if(s.Promise&&s.Promise.resolve){var I=s.Promise.resolve(void 0);Dn=function(){I.then(To)}}else Dn=function(){var V=To;!y(s.setImmediate)||s.Window&&s.Window.prototype&&!Ce("Edge")&&s.Window.prototype.setImmediate==s.setImmediate?(Rr||(Rr=Eo()),Rr(V)):s.setImmediate(V)}}var Vo=!1,Wo=new Y;function To(){for(var I;I=_();){try{I.a.call(I.b)}catch(V){wo(V)}j(O,I)}Vo=!1}function Go(I,V){if(this.a=No,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,I!=f)try{var fe=this;I.call(V,function(De){ii(fe,ho,De)},function(De){if(!(De instanceof El))try{throw De instanceof Error?De:Error("Promise rejected.")}catch{}ii(fe,vo,De)})}catch(De){ii(this,vo,De)}}var No=0,ho=2,vo=3;function bo(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}bo.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var Bo=new L(function(){return new bo},function(I){I.reset()});function Pr(I,V,fe){var De=Bo.get();return De.g=I,De.b=V,De.f=fe,De}function so(I){if(I instanceof Go)return I;var V=new Go(f);return ii(V,ho,I),V}function zo(I){return new Go(function(V,fe){fe(I)})}function Ci(I,V,fe){Ga(I,V,fe,null)||An(A(V,I))}function ea(I){return new Go(function(V,fe){var De=I.length,Ke=[];if(De)for(var Tt=function(Fo,Bi){De--,Ke[Fo]=Bi,De==0&&V(Ke)},Wt=function(Fo){fe(Fo)},un=0,po;un=I.keyCode)&&(I.keyCode=-1)}catch{}},Wn.prototype.g=function(){return this.a};var rt="closure_listenable_"+(1e6*Math.random()|0),vt=0;function Nt(I,V,fe,De,Ke){this.listener=I,this.proxy=null,this.src=V,this.type=fe,this.capture=!!De,this.Wa=Ke,this.key=++vt,this.wa=this.Qa=!1}function Ft(I){I.wa=!0,I.listener=null,I.proxy=null,I.src=null,I.Wa=null}function en(I){this.src=I,this.a={},this.b=0}en.prototype.add=function(I,V,fe,De,Ke){var Tt=I.toString();I=this.a[Tt],I||(I=this.a[Tt]=[],this.b++);var Wt=dn(I,V,De,Ke);return-1De.keyCode||De.returnValue!=null)){e:{var Ke=!1;if(De.keyCode==0)try{De.keyCode=-1;break e}catch{Ke=!0}(Ke||De.returnValue==null)&&(De.returnValue=!0)}for(De=[],Ke=V.b;Ke;Ke=Ke.parentNode)De.push(Ke);for(I=I.type,Ke=De.length-1;0<=Ke;Ke--){V.b=De[Ke];var Tt=qr(De[Ke],I,!0,V);fe=fe&&Tt}for(Ke=0;Ke>>0);function wu(I){return y(I)?I:(I[cc]||(I[cc]=function(V){return I.handleEvent(V)}),I[cc])}function ps(){Vs.call(this),this.v=new en(this),this.bc=this,this.hb=null}S(ps,Vs),ps.prototype[rt]=!0,ps.prototype.addEventListener=function(I,V,fe,De){Tn(this,I,V,fe,De)},ps.prototype.removeEventListener=function(I,V,fe,De){go(this,I,V,fe,De)},ps.prototype.dispatchEvent=function(I){var V,fe=this.hb;if(fe)for(V=[];fe;fe=fe.hb)V.push(fe);fe=this.bc;var De=I.type||I;if(typeof I=="string")I=new Cn(I,fe);else if(I instanceof Cn)I.target=I.target||fe;else{var Ke=I;I=new Cn(De,fe),Ue(I,Ke)}if(Ke=!0,V)for(var Tt=V.length-1;0<=Tt;Tt--){var Wt=I.b=V[Tt];Ke=Xh(Wt,De,!0,I)&&Ke}if(Wt=I.b=fe,Ke=Xh(Wt,De,!0,I)&&Ke,Ke=Xh(Wt,De,!1,I)&&Ke,V)for(Tt=0;TtV)throw Error("Bad port number "+V);I.g=V}else I.g=null}function Bu(I,V,fe){V instanceof jf?(I.b=V,i9(I.b,I.i)):(fe||(V=n9(V,o9)),I.b=new jf(V,I.i))}function va(I,V,fe){I.b.set(V,fe)}function Ha(I,V){return I.b.get(V)}function iu(I){return I instanceof q1?new q1(I):new q1(I,void 0)}function dd(I,V,fe,De){var Ke=new q1(null,void 0);return I&&Im(Ke,I),V&&(Ke.a=V),fe&&ru(Ke,fe),De&&(Ke.f=De),Ke}function t9(I,V){return I?V?decodeURI(I.replace(/%25/g,"%2525")):decodeURIComponent(I):""}function n9(I,V,fe){return typeof I=="string"?(I=encodeURI(I).replace(V,$7),fe&&(I=I.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),I):null}function $7(I){return I=I.charCodeAt(0),"%"+(I>>4&15).toString(16)+(I&15).toString(16)}var I4=/[#\/\?@]/g,h2=/[#\?:]/g,p6=/[#\?]/g,o9=/[#\?@]/g,g6=/#/g;function jf(I,V){this.b=this.a=null,this.c=I||null,this.f=!!V}function xu(I){I.a||(I.a=new ou,I.b=0,I.c&&$1(I.c,function(V,fe){I.add(decodeURIComponent(V.replace(/\+/g," ")),fe)}))}function r9(I){var V=K1(I);if(typeof V>"u")throw Error("Keys are undefined");var fe=new jf(null,void 0);I=Qp(I);for(var De=0;De2*I.c&&Zp(I)))}t.clear=function(){this.a=this.c=null,this.b=0};function zm(I,V){return xu(I),V=$l(I,V),F0(I.a.b,V)}t.forEach=function(I,V){xu(this),this.a.forEach(function(fe,De){oe(fe,function(Ke){I.call(V,Ke,De,this)},this)},this)},t.Y=function(){xu(this);for(var I=this.a.X(),V=this.a.Y(),fe=[],De=0;DeI?!1:!Be||!to||9',I=(De=Oe())?De.createHTML(I):I,I=new Ct(I,null,at),De=Wt.document)&&(De.write(yt(I)),De.close())):(Wt=Lt(V,De,fe,Wt))&&I.noopener&&(Wt.opener=null),Wt)try{Wt.focus()}catch{}return Wt}function vu(I){return new Go(function(V){function fe(){ju(2e3).then(function(){if(!I||I.closed)V();else return fe()})}return fe()})}var bu=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,L0=/^[^@]+@[^@]+$/;function $h(){var I=null;return new Go(function(V){s.document.readyState=="complete"?V():(I=function(){V()},Gn(window,"load",I))}).o(function(V){throw go(window,"load",I),V})}function y6(){return Dm(void 0)?$h().then(function(){return new Go(function(I,V){var fe=s.document,De=setTimeout(function(){V(Error("Cordova framework is not ready."))},1e3);fe.addEventListener("deviceready",function(){clearTimeout(De),I()},!1)})}):zo(Error("Cordova must run in an Android or iOS file scheme."))}function Dm(I){return I=I||gs(),!(eg()!=="file:"&&eg()!=="ionic:"||!I.toLowerCase().match(/iphone|ipad|ipod|android/))}function uc(){var I=s.window;try{return!(!I||I==I.top)}catch{return!1}}function l0(){return typeof s.WorkerGlobalScope<"u"&&typeof s.importScripts=="function"}function aa(){return eo.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":eo.INTERNAL.hasOwnProperty("node")?"Node":l0()?"Worker":"Browser"}function z4(){var I=aa();return I==="ReactNative"||I==="Node"}function t1(){for(var I=50,V=[];0"u"?null:p2(I)}function tg(I){var V={},fe;for(fe in I)I.hasOwnProperty(fe)&&I[fe]!==null&&I[fe]!==void 0&&(V[fe]=I[fe]);return V}function N0(I){if(I!==null)return JSON.parse(I)}function Yf(I){return I||Math.floor(1e9*Math.random()).toString()}function l9(I){return I=I||gs(),!(Z1(I)=="Safari"||I.toLowerCase().match(/iphone|ipad|ipod/))}function Q7(){var I=s.___jsl;if(I&&I.H){for(var V in I.H)if(I.H[V].r=I.H[V].r||[],I.H[V].L=I.H[V].L||[],I.H[V].r=I.H[V].L.concat(),I.CP)for(var fe=0;feV)throw Error("Short delay should be less than long delay!");this.a=I,this.c=V,I=gs(),V=aa(),this.b=Gi(I)||V==="ReactNative"}ng.prototype.get=function(){var I=s.navigator;return!(I&&typeof I.onLine=="boolean"&&(a9()||eg()==="chrome-extension:"||typeof I.connection<"u"))||I.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};function y2(){var I=s.document;return I&&typeof I.visibilityState<"u"?I.visibilityState=="visible":!0}function x6(){var I=s.document,V=null;return y2()||!I?so():new Go(function(fe){V=function(){y2()&&(I.removeEventListener("visibilitychange",V,!1),fe())},I.addEventListener("visibilitychange",V,!1)}).o(function(fe){throw I.removeEventListener("visibilitychange",V,!1),fe})}function og(I){try{var V=new Date(parseInt(I,10));if(!isNaN(V.getTime())&&!/[^0-9]/.test(I))return V.toUTCString()}catch{}return null}function Z7(){return!(!kl("fireauth.oauthhelper",s)&&!kl("fireauth.iframe",s))}function ex(){var I=s.navigator;return I&&I.serviceWorker&&I.serviceWorker.controller||null}function oz(){var I=s.navigator;return I&&I.serviceWorker?so().then(function(){return I.serviceWorker.ready}).then(function(V){return V.active||null}).o(function(){return null}):so(null)}var tx={};function dc(I){tx[I]||(tx[I]=!0,typeof console<"u"&&typeof console.warn=="function"&&console.warn(I))}var Su;try{var D4={};Object.defineProperty(D4,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(D4,"abcd",{configurable:!0,enumerable:!0,value:2}),Su=D4.abcd==2}catch{Su=!1}function Nr(I,V,fe){Su?Object.defineProperty(I,V,{configurable:!0,enumerable:!0,value:fe}):I[V]=fe}function Yu(I,V){if(V)for(var fe in V)V.hasOwnProperty(fe)&&Nr(I,fe,V[fe])}function Qh(I){var V={};return Yu(V,I),V}function s9(I){var V={},fe;for(fe in I)I.hasOwnProperty(fe)&&(V[fe]=I[fe]);return V}function v6(I,V){if(!V||!V.length)return!0;if(!I)return!1;for(var fe=0;fe"u")throw new b("missing-continue-uri");if(typeof V!="string"||typeof V=="string"&&!V.length)throw new b("invalid-continue-uri");this.h=V,this.b=this.a=null,this.g=!1;var fe=I[ix];if(fe&&typeof fe=="object"){V=fe[P6];var De=fe[sx];if(fe=fe[cx],typeof V=="string"&&V.length){if(this.a=V,typeof De<"u"&&typeof De!="boolean")throw new b("argument-error",sx+" property must be a boolean when specified.");if(this.g=!!De,typeof fe<"u"&&(typeof fe!="string"||typeof fe=="string"&&!fe.length))throw new b("argument-error",cx+" property must be a non empty string when specified.");this.b=fe||null}else{if(typeof V<"u")throw new b("argument-error",P6+" property must be a non empty string when specified.");if(typeof De<"u"||typeof fe<"u")throw new b("missing-android-pkg-name")}}else if(typeof fe<"u")throw new b("argument-error",ix+" property must be a non null object when specified.");if(this.f=null,(V=I[ax])&&typeof V=="object"){if(V=V[cg],typeof V=="string"&&V.length)this.f=V;else if(typeof V<"u")throw new b("argument-error",cg+" property must be a non empty string when specified.")}else if(typeof V<"u")throw new b("argument-error",ax+" property must be a non null object when specified.");if(V=I[fd],typeof V<"u"&&typeof V!="boolean")throw new b("argument-error",fd+" property must be a boolean when specified.");if(this.c=!!V,I=I[T6],typeof I<"u"&&(typeof I!="string"||typeof I=="string"&&!I.length))throw new b("argument-error",T6+" property must be a non empty string when specified.");this.i=I||null}var ix="android",T6="dynamicLinkDomain",fd="handleCodeInApp",ax="iOS",lx="url",sx="installApp",cx="minimumVersion",P6="packageName",cg="bundleId";function h9(I){var V={};V.continueUrl=I.h,V.canHandleCodeInApp=I.c,(V.androidPackageName=I.a)&&(V.androidMinimumVersion=I.b,V.androidInstallApp=I.g),V.iOSBundleId=I.f,V.dynamicLinkDomain=I.i;for(var fe in V)V[fe]===null&&delete V[fe];return V}function bT(I){return ae(I,function(V){return V=V.toString(16),1>4),Wt!=64&&(V(Tt<<4&240|Wt>>2),un!=64&&V(Wt<<6&192|un))}}function L4(){if(!Ns){Ns={};for(var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),V=["+/=","+/","-_=","-_.","-_"],fe=0;5>fe;fe++)for(var De=I.concat(V[fe].split("")),Ke=0;Kethis.a?this.a:I),this.b=V.provider_id||V.firebase&&V.firebase.sign_in_provider||null,this.f=V.firebase&&V.firebase.tenant||null,this.c=!!V.is_anonymous||this.b=="anonymous"}o1.prototype.T=function(){return this.f},o1.prototype.l=function(){return this.c},o1.prototype.toString=function(){return this.h};function W4(I){try{return new o1(I)}catch{return null}}function wr(I){if(!I||(I=I.split("."),I.length!=3))return null;I=I[1];for(var V=(4-I.length%4)%4,fe=0;feKe)I[fe++]=String.fromCharCode(Ke);else if(191Ke){var Tt=De[V++];I[fe++]=String.fromCharCode((Ke&31)<<6|Tt&63)}else if(239Ke){Tt=De[V++];var Wt=De[V++],un=De[V++],po=((Ke&7)<<18|(Tt&63)<<12|(Wt&63)<<6|un&63)-65536;I[fe++]=String.fromCharCode(55296+(po>>10)),I[fe++]=String.fromCharCode(56320+(po&1023))}else Tt=De[V++],Wt=De[V++],I[fe++]=String.fromCharCode((Ke&15)<<12|(Tt&63)<<6|Wt&63)}return JSON.parse(I.join(""))}catch{}return null}var p9="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),g9=["client_id","response_type","scope","redirect_uri","state"],N4={nd:{Ja:"locale",va:700,ua:600,fa:"facebook.com",Ya:g9},pd:{Ja:null,va:500,ua:750,fa:"github.com",Ya:g9},qd:{Ja:"hl",va:515,ua:680,fa:"google.com",Ya:g9},wd:{Ja:"lang",va:485,ua:705,fa:"twitter.com",Ya:p9},kd:{Ja:"locale",va:640,ua:600,fa:"apple.com",Ya:[]}};function C6(I){for(var V in N4)if(N4[V].fa==I)return N4[V];return null}function Of(I){var V={};V["facebook.com"]=tp,V["google.com"]=ug,V["github.com"]=H6,V["twitter.com"]=hd;var fe=I&&I[U4];try{if(fe)return V[fe]?new V[fe](I):new ep(I);if(typeof I[r1]<"u")return new R6(I)}catch{}return null}var r1="idToken",U4="providerId";function R6(I){var V=I[U4];if(!V&&I[r1]){var fe=W4(I[r1]);fe&&fe.b&&(V=fe.b)}if(!V)throw Error("Invalid additional user info!");(V=="anonymous"||V=="custom")&&(V=null),fe=!1,typeof I.isNewUser<"u"?fe=!!I.isNewUser:I.kind==="identitytoolkit#SignupNewUserResponse"&&(fe=!0),Nr(this,"providerId",V),Nr(this,"isNewUser",fe)}function ep(I){R6.call(this,I),I=N0(I.rawUserInfo||"{}"),Nr(this,"profile",b6(I||{}))}S(ep,R6);function tp(I){if(ep.call(this,I),this.providerId!="facebook.com")throw Error("Invalid provider ID!")}S(tp,ep);function H6(I){if(ep.call(this,I),this.providerId!="github.com")throw Error("Invalid provider ID!");Nr(this,"username",this.profile&&this.profile.login||null)}S(H6,ep);function ug(I){if(ep.call(this,I),this.providerId!="google.com")throw Error("Invalid provider ID!")}S(ug,ep);function hd(I){if(ep.call(this,I),this.providerId!="twitter.com")throw Error("Invalid provider ID!");Nr(this,"username",I.screenName||null)}S(hd,ep);function j4(I){var V=iu(I),fe=Ha(V,"link"),De=Ha(iu(fe),"link");return V=Ha(V,"deep_link_id"),Ha(iu(V),"link")||V||De||fe||I}function A2(I,V){if(!I&&!V)throw new b("internal-error","Internal assert: no raw session string available");if(I&&V)throw new b("internal-error","Internal assert: unable to determine the session type");this.a=I||null,this.b=V||null,this.type=this.a?w2:i1}var w2="enroll",i1="signin";A2.prototype.Ha=function(){return this.a?so(this.a):so(this.b)},A2.prototype.w=function(){return this.type==w2?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}};function s0(){}s0.prototype.ka=function(){},s0.prototype.b=function(){},s0.prototype.c=function(){},s0.prototype.w=function(){};function x2(I,V){return I.then(function(fe){if(fe[ke]){var De=W4(fe[ke]);if(!De||V!=De.i)throw new b("user-mismatch");return fe}throw new b("user-mismatch")}).o(function(fe){throw fe&&fe.code&&fe.code==R+"user-not-found"?new b("user-mismatch"):fe})}function v2(I,V){if(V)this.a=V;else throw new b("internal-error","failed to construct a credential");Nr(this,"providerId",I),Nr(this,"signInMethod",I)}v2.prototype.ka=function(I){return R2(I,b2(this))},v2.prototype.b=function(I,V){var fe=b2(this);return fe.idToken=V,sz(I,fe)},v2.prototype.c=function(I,V){return x2(Ax(I,b2(this)),V)};function b2(I){return{pendingToken:I.a,requestUri:"http://localhost"}}v2.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}};function ST(I){if(I&&I.providerId&&I.signInMethod&&I.providerId.indexOf("saml.")==0&&I.pendingToken)try{return new v2(I.providerId,I.pendingToken)}catch{}return null}function np(I,V,fe){if(this.a=null,V.idToken||V.accessToken)V.idToken&&Nr(this,"idToken",V.idToken),V.accessToken&&Nr(this,"accessToken",V.accessToken),V.nonce&&!V.pendingToken&&Nr(this,"nonce",V.nonce),V.pendingToken&&(this.a=V.pendingToken);else if(V.oauthToken&&V.oauthTokenSecret)Nr(this,"accessToken",V.oauthToken),Nr(this,"secret",V.oauthTokenSecret);else throw new b("internal-error","failed to construct a credential");Nr(this,"providerId",I),Nr(this,"signInMethod",fe)}np.prototype.ka=function(I){return R2(I,Nc(this))},np.prototype.b=function(I,V){var fe=Nc(this);return fe.idToken=V,sz(I,fe)},np.prototype.c=function(I,V){var fe=Nc(this);return x2(Ax(I,fe),V)};function Nc(I){var V={};return I.idToken&&(V.id_token=I.idToken),I.accessToken&&(V.access_token=I.accessToken),I.secret&&(V.oauth_token_secret=I.secret),V.providerId=I.providerId,I.nonce&&!I.a&&(V.nonce=I.nonce),V={postBody:r9(V).toString(),requestUri:"http://localhost"},I.a&&(delete V.postBody,V.pendingToken=I.a),V}np.prototype.w=function(){var I={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(I.oauthIdToken=this.idToken),this.accessToken&&(I.oauthAccessToken=this.accessToken),this.secret&&(I.oauthTokenSecret=this.secret),this.nonce&&(I.nonce=this.nonce),this.a&&(I.pendingToken=this.a),I};function m9(I){if(I&&I.providerId&&I.signInMethod){var V={idToken:I.oauthIdToken,accessToken:I.oauthTokenSecret?null:I.oauthAccessToken,oauthTokenSecret:I.oauthTokenSecret,oauthToken:I.oauthTokenSecret&&I.oauthAccessToken,nonce:I.nonce,pendingToken:I.pendingToken};try{return new np(I.providerId,V,I.signInMethod)}catch{}}return null}function op(I,V){this.Qc=V||[],Yu(this,{providerId:I,isOAuthProvider:!0}),this.Jb={},this.qb=(C6(I)||{}).Ja||null,this.pb=null}op.prototype.Ka=function(I){return this.Jb=Ne(I),this};function pd(I){if(typeof I!="string"||I.indexOf("saml.")!=0)throw new b("argument-error",'SAML provider IDs must be prefixed with "saml."');op.call(this,I,[])}S(pd,op);function Tu(I){op.call(this,I,g9),this.a=[]}S(Tu,op),Tu.prototype.Ca=function(I){return te(this.a,I)||this.a.push(I),this},Tu.prototype.Rb=function(){return he(this.a)},Tu.prototype.credential=function(I,V){var fe;if(w(I)?fe={idToken:I.idToken||null,accessToken:I.accessToken||null,nonce:I.rawNonce||null}:fe={idToken:I||null,accessToken:V||null},!fe.idToken&&!fe.accessToken)throw new b("argument-error","credential failed: must provide the ID token and/or the access token.");return new np(this.providerId,fe,this.providerId)};function Xd(){Tu.call(this,"facebook.com")}S(Xd,Tu),Nr(Xd,"PROVIDER_ID","facebook.com"),Nr(Xd,"FACEBOOK_SIGN_IN_METHOD","facebook.com");function _f(I){if(!I)throw new b("argument-error","credential failed: expected 1 argument (the OAuth access token).");var V=I;return w(I)&&(V=I.accessToken),new Xd().credential({accessToken:V})}function a1(){Tu.call(this,"github.com")}S(a1,Tu),Nr(a1,"PROVIDER_ID","github.com"),Nr(a1,"GITHUB_SIGN_IN_METHOD","github.com");function Pu(I){if(!I)throw new b("argument-error","credential failed: expected 1 argument (the OAuth access token).");var V=I;return w(I)&&(V=I.accessToken),new a1().credential({accessToken:V})}function rp(){Tu.call(this,"google.com"),this.Ca("profile")}S(rp,Tu),Nr(rp,"PROVIDER_ID","google.com"),Nr(rp,"GOOGLE_SIGN_IN_METHOD","google.com");function ux(I,V){var fe=I;return w(I)&&(fe=I.idToken,V=I.accessToken),new rp().credential({idToken:fe,accessToken:V})}function Lm(){op.call(this,"twitter.com",p9)}S(Lm,op),Nr(Lm,"PROVIDER_ID","twitter.com"),Nr(Lm,"TWITTER_SIGN_IN_METHOD","twitter.com");function TT(I,V){var fe=I;if(w(fe)||(fe={oauthToken:I,oauthTokenSecret:V}),!fe.oauthToken||!fe.oauthTokenSecret)throw new b("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new np("twitter.com",fe,"twitter.com")}function Jd(I,V,fe){this.a=I,this.f=V,Nr(this,"providerId","password"),Nr(this,"signInMethod",fe===Ma.EMAIL_LINK_SIGN_IN_METHOD?Ma.EMAIL_LINK_SIGN_IN_METHOD:Ma.EMAIL_PASSWORD_SIGN_IN_METHOD)}Jd.prototype.ka=function(I){return this.signInMethod==Ma.EMAIL_LINK_SIGN_IN_METHOD?ka(I,Zoe,{email:this.a,oobCode:this.f}):ka(I,$4,{email:this.a,password:this.f})},Jd.prototype.b=function(I,V){return this.signInMethod==Ma.EMAIL_LINK_SIGN_IN_METHOD?ka(I,ere,{idToken:V,email:this.a,oobCode:this.f}):ka(I,Kj,{idToken:V,email:this.a,password:this.f})},Jd.prototype.c=function(I,V){return x2(this.ka(I),V)},Jd.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}};function dx(I){return I&&I.email&&I.password?new Jd(I.email,I.password,I.signInMethod):null}function Ma(){Yu(this,{providerId:"password",isOAuthProvider:!1})}function oa(I,V){if(V=Gs(V),!V)throw new b("argument-error","Invalid email link!");return new Jd(I,V.code,Ma.EMAIL_LINK_SIGN_IN_METHOD)}function Gs(I){return I=j4(I),(I=F4(I))&&I.operation===Vd?I:null}Yu(Ma,{PROVIDER_ID:"password"}),Yu(Ma,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Yu(Ma,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"});function ql(I){if(!(I.fb&&I.eb||I.La&&I.ea))throw new b("internal-error");this.a=I,Nr(this,"providerId","phone"),this.fa="phone",Nr(this,"signInMethod","phone")}ql.prototype.ka=function(I){return I.gb(_u(this))},ql.prototype.b=function(I,V){var fe=_u(this);return fe.idToken=V,ka(I,Zj,fe)},ql.prototype.c=function(I,V){var fe=_u(this);return fe.operation="REAUTH",I=ka(I,eB,fe),x2(I,V)},ql.prototype.w=function(){var I={providerId:"phone"};return this.a.fb&&(I.verificationId=this.a.fb),this.a.eb&&(I.verificationCode=this.a.eb),this.a.La&&(I.temporaryProof=this.a.La),this.a.ea&&(I.phoneNumber=this.a.ea),I};function fc(I){if(I&&I.providerId==="phone"&&(I.verificationId&&I.verificationCode||I.temporaryProof&&I.phoneNumber)){var V={};return oe(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(fe){I[fe]&&(V[fe]=I[fe])}),new ql(V)}return null}function _u(I){return I.a.La&&I.a.ea?{temporaryProof:I.a.La,phoneNumber:I.a.ea}:{sessionInfo:I.a.fb,code:I.a.eb}}function gd(I){try{this.a=I||eo.auth()}catch{throw new b("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Yu(this,{providerId:"phone",isOAuthProvider:!1})}gd.prototype.gb=function(I,V){var fe=this.a.a;return so(V.verify()).then(function(De){if(typeof De!="string")throw new b("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(V.type){case"recaptcha":var Ke=w(I)?I.session:null,Tt=w(I)?I.phoneNumber:I,Wt;return Ke&&Ke.type==w2?Wt=Ke.Ha().then(function(un){return ja(fe,{idToken:un,phoneEnrollmentInfo:{phoneNumber:Tt,recaptchaToken:De}})}):Ke&&Ke.type==i1?Wt=Ke.Ha().then(function(un){return X4(fe,{mfaPendingCredential:un,mfaEnrollmentId:I.multiFactorHint&&I.multiFactorHint.uid||I.multiFactorUid,phoneSignInInfo:{recaptchaToken:De}})}):Wt=Bc(fe,{phoneNumber:Tt,recaptchaToken:De}),Wt.then(function(un){return typeof V.reset=="function"&&V.reset(),un},function(un){throw typeof V.reset=="function"&&V.reset(),un});default:throw new b("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})};function Xs(I,V){if(!I)throw new b("missing-verification-id");if(!V)throw new b("missing-verification-code");return new ql({fb:I,eb:V})}Yu(gd,{PROVIDER_ID:"phone"}),Yu(gd,{PHONE_SIGN_IN_METHOD:"phone"});function Wm(I){if(I.temporaryProof&&I.phoneNumber)return new ql({La:I.temporaryProof,ea:I.phoneNumber});var V=I&&I.providerId;if(!V||V==="password")return null;var fe=I&&I.oauthAccessToken,De=I&&I.oauthTokenSecret,Ke=I&&I.nonce,Tt=I&&I.oauthIdToken,Wt=I&&I.pendingToken;try{switch(V){case"google.com":return ux(Tt,fe);case"facebook.com":return _f(fe);case"github.com":return Pu(fe);case"twitter.com":return TT(fe,De);default:return fe||De||Tt||Wt?Wt?V.indexOf("saml.")==0?new v2(V,Wt):new np(V,{pendingToken:Wt,idToken:I.oauthIdToken,accessToken:I.oauthAccessToken},V):new Tu(V).credential({idToken:Tt,accessToken:fe,rawNonce:Ke}):null}}catch{return null}}function Nm(I){if(!I.isOAuthProvider)throw new b("invalid-oauth-provider")}function md(I,V,fe,De,Ke,Tt,Wt){if(this.c=I,this.b=V||null,this.g=fe||null,this.f=De||null,this.i=Tt||null,this.h=Wt||null,this.a=Ke||null,this.g||this.a){if(this.g&&this.a)throw new b("invalid-auth-event");if(this.g&&!this.f)throw new b("invalid-auth-event")}else throw new b("invalid-auth-event")}md.prototype.getUid=function(){var I=[];return I.push(this.c),this.b&&I.push(this.b),this.f&&I.push(this.f),this.h&&I.push(this.h),I.join("-")},md.prototype.T=function(){return this.h},md.prototype.w=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.w()}};function B4(I){return I=I||{},I.type?new md(I.type,I.eventId,I.urlResponse,I.sessionId,I.error&&T(I.error),I.postBody,I.tenantId):null}function y9(){this.b=null,this.a=[]}var Cu=null;function fx(I){var V=Cu;V.a.push(I),V.b||(V.b=function(fe){for(var De=0;De Auth section -> Sign in method tab.",I):De=="http"||De=="https"?fe=Je("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",I):V="operation-not-supported-in-this-environment",b.call(this,V,fe)}S(S2,b);function ip(I,V,fe){b.call(this,I,fe),I=V||{},I.Kb&&Nr(this,"email",I.Kb),I.ea&&Nr(this,"phoneNumber",I.ea),I.credential&&Nr(this,"credential",I.credential),I.$b&&Nr(this,"tenantId",I.$b)}S(ip,b),ip.prototype.w=function(){var I={code:this.code,message:this.message};this.email&&(I.email=this.email),this.phoneNumber&&(I.phoneNumber=this.phoneNumber),this.tenantId&&(I.tenantId=this.tenantId);var V=this.credential&&this.credential.w();return V&&Ue(I,V),I},ip.prototype.toJSON=function(){return this.w()};function Um(I){if(I.code){var V=I.code||"";V.indexOf(R)==0&&(V=V.substring(R.length));var fe={credential:Wm(I),$b:I.tenantId};if(I.email)fe.Kb=I.email;else if(I.phoneNumber)fe.ea=I.phoneNumber;else if(!fe.credential)return new b(V,I.message||void 0);return new ip(V,fe,I.message)}return null}function jm(){}jm.prototype.c=null;function Vf(I){return I.c||(I.c=I.b())}var A9;function Gf(){}S(Gf,jm),Gf.prototype.a=function(){var I=w9(this);return I?new ActiveXObject(I):new XMLHttpRequest},Gf.prototype.b=function(){var I={};return w9(this)&&(I[0]=!0,I[1]=!0),I};function w9(I){if(!I.f&&typeof XMLHttpRequest>"u"&&typeof ActiveXObject<"u"){for(var V=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],fe=0;fe=Y4(this).value)for(y(V)&&(V=V()),I=new Ym(I,String(V),this.f),fe&&(I.a=fe),fe=this;fe;)fe=fe.a};var dg={},I6=null;function l1(I){I6||(I6=new Ru(""),dg[""]=I6,I6.c=fi);var V;if(!(V=dg[I])){V=new Ru(I);var fe=I.lastIndexOf("."),De=I.substr(fe+1);fe=l1(I.substr(0,fe)),fe.b||(fe.b={}),fe.b[De]=V,V.a=fe,dg[I]=V}return V}function $d(I,V){I&&I.log(PT,V,void 0)}function c0(I){this.f=I}S(c0,jm),c0.prototype.a=function(){return new v9(this.f)},c0.prototype.b=function(I){return function(){return I}}({});function v9(I){ps.call(this),this.u=I,this.h=void 0,this.readyState=Xf,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.l=new Headers,this.b=null,this.s="GET",this.f="",this.a=!1,this.i=l1("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}S(v9,ps);var Xf=0;t=v9.prototype,t.open=function(I,V){if(this.readyState!=Xf)throw this.abort(),Error("Error reopening a connection");this.s=I,this.f=V,this.readyState=1,_m(this)},t.send=function(I){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.a=!0;var V={headers:this.l,method:this.s,credentials:this.h,cache:void 0};I&&(V.body=I),this.u.fetch(new Request(this.f,V)).then(this.uc.bind(this),this.Va.bind(this))},t.abort=function(){this.response=this.responseText="",this.l=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&this.readyState!=4&&(this.a=!1,T2(this)),this.readyState=Xf},t.uc=function(I){this.a&&(this.g=I,this.b||(this.status=this.g.status,this.statusText=this.g.statusText,this.b=I.headers,this.readyState=2,_m(this)),this.a&&(this.readyState=3,_m(this),this.a&&(this.responseType==="arraybuffer"?I.arrayBuffer().then(this.sc.bind(this),this.Va.bind(this)):typeof s.ReadableStream<"u"&&"body"in I?(this.response=this.responseText="",this.c=I.body.getReader(),this.m=new TextDecoder,z6(this)):I.text().then(this.tc.bind(this),this.Va.bind(this)))))};function z6(I){I.c.read().then(I.pc.bind(I)).catch(I.Va.bind(I))}t.pc=function(I){if(this.a){var V=this.m.decode(I.value?I.value:new Uint8Array(0),{stream:!I.done});V&&(this.response=this.responseText+=V),I.done?T2(this):_m(this),this.readyState==3&&z6(this)}},t.tc=function(I){this.a&&(this.response=this.responseText=I,T2(this))},t.sc=function(I){this.a&&(this.response=I,T2(this))},t.Va=function(I){var V=this.i;V&&V.log(Om,"Failed to fetch url "+this.f,I instanceof Error?I:Error(I)),this.a&&T2(this)};function T2(I){I.readyState=4,I.g=null,I.c=null,I.m=null,_m(I)}t.setRequestHeader=function(I,V){this.l.append(I,V)},t.getResponseHeader=function(I){return this.b?this.b.get(I.toLowerCase())||"":((I=this.i)&&I.log(Om,"Attempting to get response header but no headers have been received for url: "+this.f,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var I=this.i;return I&&I.log(Om,"Attempting to get all response headers but no headers have been received for url: "+this.f,void 0),""}I=[];for(var V=this.b.entries(),fe=V.next();!fe.done;)fe=fe.value,I.push(fe[0]+": "+fe[1]),fe=V.next();return I.join(`\r +`)};function _m(I){I.onreadystatechange&&I.onreadystatechange.call(I)}Object.defineProperty(v9.prototype,"withCredentials",{get:function(){return this.h==="include"},set:function(I){this.h=I?"include":"same-origin"}});function Uc(I){ps.call(this),this.headers=new ou,this.D=I||null,this.c=!1,this.C=this.a=null,this.h=this.P=this.l="",this.f=this.N=this.i=this.J=!1,this.g=0,this.s=null,this.m=fg,this.u=this.S=!1}S(Uc,ps);var fg="";Uc.prototype.b=l1("goog.net.XhrIo");var hx=/^https?$/i,px=["POST","PUT"];function D6(I,V,fe,De,Ke){if(I.a)throw Error("[goog.net.XhrIo] Object is active with another request="+I.l+"; newUri="+V);fe=fe?fe.toUpperCase():"GET",I.l=V,I.h="",I.P=fe,I.J=!1,I.c=!0,I.a=I.D?I.D.a():A9.a(),I.C=I.D?Vf(I.D):Vf(A9),I.a.onreadystatechange=P(I.Wb,I);try{$d(I.b,Kf(I,"Opening Xhr")),I.N=!0,I.a.open(fe,String(V),!0),I.N=!1}catch(Wt){$d(I.b,Kf(I,"Error opening Xhr: "+Wt.message)),hg(I,Wt);return}V=De||"";var Tt=new ou(I.headers);Ke&&a0(Ke,function(Wt,un){Tt.set(un,Wt)}),Ke=ne(Tt.Y()),De=s.FormData&&V instanceof s.FormData,!te(px,fe)||Ke||De||Tt.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),Tt.forEach(function(Wt,un){this.a.setRequestHeader(un,Wt)},I),I.m&&(I.a.responseType=I.m),"withCredentials"in I.a&&I.a.withCredentials!==I.S&&(I.a.withCredentials=I.S);try{mx(I),0=V.l&&V.cancel())}this.u?this.u.call(this.s,this):this.v=!0,this.a||(I=new jc,b9(this),u0(this,!1,I))}},P2.prototype.m=function(I,V){this.i=!1,u0(this,I,V)};function u0(I,V,fe){I.a=!0,I.c=fe,I.f=!V,pg(I)}function b9(I){if(I.a){if(!I.v)throw new Gm;I.v=!1}}function CT(I,V){lp(I,null,V,void 0)}function lp(I,V,fe,De){I.g.push([V,fe,De]),I.a&&pg(I)}P2.prototype.then=function(I,V,fe){var De,Ke,Tt=new Go(function(Wt,un){De=Wt,Ke=un});return lp(this,De,function(Wt){Wt instanceof jc?Tt.cancel():Ke(Wt)}),Tt.then(I,V,fe)},P2.prototype.$goog_Thenable=!0;function F6(I){return Z(I.g,function(V){return y(V[1])})}function pg(I){if(I.h&&I.a&&F6(I)){var V=I.h,fe=O4[V];fe&&(s.clearTimeout(fe.a),delete O4[V]),I.h=0}I.b&&(I.b.l--,delete I.b),V=I.c;for(var De=fe=!1;I.g.length&&!I.i;){var Ke=I.g.shift(),Tt=Ke[0],Wt=Ke[1];if(Ke=Ke[2],Tt=I.f?Wt:Tt)try{var un=Tt.call(Ke||I.s,V);un!==void 0&&(I.f=I.f&&(un==V||un instanceof Error),I.c=V=un),(U(V)||typeof s.Promise=="function"&&V instanceof s.Promise)&&(De=!0,I.i=!0)}catch(po){V=po,I.f=!0,F6(I)||(fe=!0)}}I.c=V,De&&(un=P(I.m,I,!0),De=P(I.m,I,!1),V instanceof P2?(lp(V,un,De),V.C=!0):V.then(un,De)),fe&&(V=new qd(V),O4[V.a]=V,I.h=V.a)}function Gm(){W.call(this)}S(Gm,W),Gm.prototype.message="Deferred has already fired",Gm.prototype.name="AlreadyCalledError";function jc(){W.call(this)}S(jc,W),jc.prototype.message="Deferred was canceled",jc.prototype.name="CanceledError";function qd(I){this.a=s.setTimeout(P(this.c,this),0),this.b=I}qd.prototype.c=function(){throw delete O4[this.a],this.b};var O4={};function _4(I){var V={},fe=V.document||document,De=ht(I).toString(),Ke=xo(document,"SCRIPT"),Tt={Xb:Ke,Ma:void 0},Wt=new P2(Tt),un=null,po=V.timeout!=null?V.timeout:5e3;return 0"u"||typeof s.Headers>"u"||typeof s.Request>"u"))throw new b("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var Wt=new Uc(this.f);if(Tt){Wt.g=Math.max(0,Tt);var un=setTimeout(function(){Wt.dispatchEvent("timeout")},Tt)}ud(Wt,"complete",function(){un&&clearTimeout(un);var po=null;try{po=JSON.parse(yx(this))||null}catch{po=null}V&&V(po)}),Mm(Wt,"ready",function(){un&&clearTimeout(un),qp(this)}),Mm(Wt,"timeout",function(){un&&clearTimeout(un),qp(this),V&&V(null)}),D6(Wt,I,fe,De,Ke)};var Fl=new Fe(Ye,"https://apis.google.com/js/client.js?onload=%{onload}"),Jr="__fcb"+Math.floor(1e6*Math.random()).toString();function d0(I,V){if(((window.gapi||{}).client||{}).request)I();else{s[Jr]=function(){((window.gapi||{}).client||{}).request?I():V(Error("CORS_UNSUPPORTED"))};var fe=Qe(Fl,{onload:Jr});CT(_4(fe),function(){V(Error("CORS_UNSUPPORTED"))})}}K.prototype.s=function(I,V,fe,De,Ke){var Tt=this;be.then(function(){window.gapi.client.setApiKey(Tt.c);var Wt=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:I,method:fe,body:De,headers:Ke,authType:"none",callback:function(un){window.gapi.auth.setToken(Wt),V&&V(un)}})}).o(function(Wt){V&&V({error:{message:Wt&&Wt.message||"CORS_UNSUPPORTED"}})})};function Qd(I,V){return new Go(function(fe,De){V.grant_type=="refresh_token"&&V.refresh_token||V.grant_type=="authorization_code"&&V.code?ni(I,I.l+"?key="+encodeURIComponent(I.c),function(Ke){Ke?Ke.error?De(M2(Ke)):Ke.access_token&&Ke.refresh_token?fe(Ke):De(new b("internal-error")):De(new b("network-request-failed"))},"POST",r9(V).toString(),I.g,I.m.get()):De(new b("internal-error"))})}function Yn(I,V,fe,De,Ke,Tt,Wt){var un=iu(V+fe);va(un,"key",I.c),Wt&&va(un,"cb",Date.now().toString());var po=De=="GET";if(po)for(var Fo in Ke)Ke.hasOwnProperty(Fo)&&va(un,Fo,Ke[Fo]);return new Go(function(Bi,Zl){ni(I,un.toString(),function(Al){Al?Al.error?Zl(M2(Al,Tt||{})):Bi(Al):Zl(new b("network-request-failed"))},De,po?void 0:p2(tg(Ke)),I.a,I.v.get())})}function zn(I){if(I=I.email,typeof I!="string"||!L0.test(I))throw new b("invalid-email")}function Kn(I){"email"in I&&zn(I)}function Cr(I,V){return ka(I,_j,{identifier:V,continueUri:a9()?lo():"http://localhost"}).then(function(fe){return fe.signinMethods||[]})}function Kr(I){return ka(I,rre,{}).then(function(V){return V.authorizedDomains||[]})}function ci(I){if(!I[ke])throw I.mfaPendingCredential?new b("multi-factor-auth-required",null,Ne(I)):new b("internal-error")}function ki(I){if(I.phoneNumber||I.temporaryProof){if(!I.phoneNumber||!I.temporaryProof)throw new b("internal-error")}else{if(!I.sessionInfo)throw new b("missing-verification-id");if(!I.code)throw new b("missing-verification-code")}}K.prototype.Ab=function(){return ka(this,ire,{})},K.prototype.Cb=function(I,V){return ka(this,Jj,{idToken:I,email:V})},K.prototype.Db=function(I,V){return ka(this,Kj,{idToken:I,password:V})};var la={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};t=K.prototype,t.Eb=function(I,V){var fe={idToken:I},De=[];return Te(la,function(Ke,Tt){var Wt=V[Tt];Wt===null?De.push(Ke):Tt in V&&(fe[Tt]=Wt)}),De.length&&(fe.deleteAttribute=De),ka(this,Jj,fe)},t.wb=function(I,V){return I={requestType:"PASSWORD_RESET",email:I},Ue(I,V),ka(this,ore,I)},t.xb=function(I,V){return I={requestType:"EMAIL_SIGNIN",email:I},Ue(I,V),ka(this,cz,I)},t.vb=function(I,V){return I={requestType:"VERIFY_EMAIL",idToken:I},Ue(I,V),ka(this,nre,I)},t.Fb=function(I,V,fe){return I={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:I,newEmail:V},Ue(I,fe),ka(this,uz,I)};function Bc(I,V){return ka(I,Xj,V)}t.gb=function(I){return ka(this,fz,I)};function ja(I,V){return ka(I,are,V).then(function(fe){return fe.phoneSessionInfo.sessionInfo})}function sp(I){if(!I.phoneVerificationInfo)throw new b("internal-error");if(!I.phoneVerificationInfo.sessionInfo)throw new b("missing-verification-id");if(!I.phoneVerificationInfo.code)throw new b("missing-verification-code")}function X4(I,V){return ka(I,$j,V).then(function(fe){return fe.phoneResponseInfo.sessionInfo})}function J4(I,V,fe){return ka(I,Vj,{idToken:V,deleteProvider:fe})}function mi(I){if(!I.requestUri||!I.sessionId&&!I.postBody&&!I.pendingToken)throw new b("internal-error")}function K4(I,V){return V.oauthIdToken&&V.providerId&&V.providerId.indexOf("oidc.")==0&&!V.pendingToken&&(I.sessionId?V.nonce=I.sessionId:I.postBody&&(I=new jf(I.postBody),zm(I,"nonce")&&(V.nonce=I.get("nonce")))),V}function RT(I){var V=null;if(I.needConfirmation?(I.code="account-exists-with-different-credential",V=Um(I)):I.errorMessage=="FEDERATED_USER_ID_ALREADY_LINKED"?(I.code="credential-already-in-use",V=Um(I)):I.errorMessage=="EMAIL_EXISTS"?(I.code="email-already-in-use",V=Um(I)):I.errorMessage&&(V=gg(I.errorMessage)),V)throw V;ci(I)}function R2(I,V){return V.returnIdpCredential=!0,ka(I,qj,V)}function sz(I,V){return V.returnIdpCredential=!0,ka(I,dz,V)}function Ax(I,V){return V.returnIdpCredential=!0,V.autoCreate=!1,ka(I,lre,V)}function HT(I){if(!I.oobCode)throw new b("invalid-action-code")}t.ob=function(I,V){return ka(this,Gj,{oobCode:I,newPassword:V})},t.Sa=function(I){return ka(this,$oe,{oobCode:I})},t.kb=function(I){return ka(this,Ad,{oobCode:I})};var Ad={endpoint:"setAccountInfo",A:HT,Z:"email",B:!0},$oe={endpoint:"resetPassword",A:HT,G:function(I){var V=I.requestType;if(!V||!I.email&&V!="EMAIL_SIGNIN"&&V!="VERIFY_AND_CHANGE_EMAIL")throw new b("internal-error")},B:!0},qoe={endpoint:"signupNewUser",A:function(I){if(zn(I),!I.password)throw new b("weak-password")},G:ci,V:!0,B:!0},_j={endpoint:"createAuthUri",B:!0},Qoe={endpoint:"deleteAccount",O:["idToken"]},Vj={endpoint:"setAccountInfo",O:["idToken","deleteProvider"],A:function(I){if(!Array.isArray(I.deleteProvider))throw new b("internal-error")}},Zoe={endpoint:"emailLinkSignin",O:["email","oobCode"],A:zn,G:ci,V:!0,B:!0},ere={endpoint:"emailLinkSignin",O:["idToken","email","oobCode"],A:zn,G:ci,V:!0},tre={endpoint:"accounts/mfaEnrollment:finalize",O:["idToken","phoneVerificationInfo"],A:sp,G:ci,B:!0,Na:!0},H2={endpoint:"accounts/mfaSignIn:finalize",O:["mfaPendingCredential","phoneVerificationInfo"],A:sp,G:ci,B:!0,Na:!0},Zd={endpoint:"getAccountInfo"},cz={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="EMAIL_SIGNIN")throw new b("internal-error");zn(I)},Z:"email",B:!0},nre={endpoint:"getOobConfirmationCode",O:["idToken","requestType"],A:function(I){if(I.requestType!="VERIFY_EMAIL")throw new b("internal-error")},Z:"email",B:!0},uz={endpoint:"getOobConfirmationCode",O:["idToken","newEmail","requestType"],A:function(I){if(I.requestType!="VERIFY_AND_CHANGE_EMAIL")throw new b("internal-error")},Z:"email",B:!0},ore={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="PASSWORD_RESET")throw new b("internal-error");zn(I)},Z:"email",B:!0},rre={mb:!0,endpoint:"getProjectConfig",Vb:"GET"},wx={mb:!0,endpoint:"getRecaptchaParam",Vb:"GET",G:function(I){if(!I.recaptchaSiteKey)throw new b("internal-error")}},Gj={endpoint:"resetPassword",A:HT,Z:"email",B:!0},Xj={endpoint:"sendVerificationCode",O:["phoneNumber","recaptchaToken"],Z:"sessionInfo",B:!0},Jj={endpoint:"setAccountInfo",O:["idToken"],A:Kn,V:!0},Kj={endpoint:"setAccountInfo",O:["idToken"],A:function(I){if(Kn(I),!I.password)throw new b("weak-password")},G:ci,V:!0},ire={endpoint:"signupNewUser",G:ci,V:!0,B:!0},are={endpoint:"accounts/mfaEnrollment:start",O:["idToken","phoneEnrollmentInfo"],A:function(I){if(!I.phoneEnrollmentInfo)throw new b("internal-error");if(!I.phoneEnrollmentInfo.phoneNumber)throw new b("missing-phone-number");if(!I.phoneEnrollmentInfo.recaptchaToken)throw new b("missing-app-credential")},G:function(I){if(!I.phoneSessionInfo||!I.phoneSessionInfo.sessionInfo)throw new b("internal-error")},B:!0,Na:!0},$j={endpoint:"accounts/mfaSignIn:start",O:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(I){if(!I.phoneSignInInfo||!I.phoneSignInInfo.recaptchaToken)throw new b("missing-app-credential")},G:function(I){if(!I.phoneResponseInfo||!I.phoneResponseInfo.sessionInfo)throw new b("internal-error")},B:!0,Na:!0},qj={endpoint:"verifyAssertion",A:mi,Za:K4,G:RT,V:!0,B:!0},lre={endpoint:"verifyAssertion",A:mi,Za:K4,G:function(I){if(I.errorMessage&&I.errorMessage=="USER_NOT_FOUND")throw new b("user-not-found");if(I.errorMessage)throw gg(I.errorMessage);ci(I)},V:!0,B:!0},dz={endpoint:"verifyAssertion",A:function(I){if(mi(I),!I.idToken)throw new b("internal-error")},Za:K4,G:RT,V:!0},Qj={endpoint:"verifyCustomToken",A:function(I){if(!I.token)throw new b("invalid-custom-token")},G:ci,V:!0,B:!0},$4={endpoint:"verifyPassword",A:function(I){if(zn(I),!I.password)throw new b("wrong-password")},G:ci,V:!0,B:!0},fz={endpoint:"verifyPhoneNumber",A:ki,G:ci,B:!0},Zj={endpoint:"verifyPhoneNumber",A:function(I){if(!I.idToken)throw new b("internal-error");ki(I)},G:function(I){if(I.temporaryProof)throw I.code="credential-already-in-use",Um(I);ci(I)}},eB={Ib:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:ki,G:ci,B:!0},MT={endpoint:"accounts/mfaEnrollment:withdraw",O:["idToken","mfaEnrollmentId"],G:function(I){if(!!I[ke]^!!I.refreshToken)throw new b("internal-error")},B:!0,Na:!0};function ka(I,V,fe){if(!v6(fe,V.O))return zo(new b("internal-error"));var De=!!V.Na,Ke=V.Vb||"POST",Tt;return so(fe).then(V.A).then(function(){return V.V&&(fe.returnSecureToken=!0),V.B&&I.b&&typeof fe.tenantId>"u"&&(fe.tenantId=I.b),De?Yn(I,I.i,V.endpoint,Ke,fe,V.Ib,V.mb||!1):Yn(I,I.h,V.endpoint,Ke,fe,V.Ib,V.mb||!1)}).then(function(Wt){return Tt=Wt,V.Za?V.Za(fe,Tt):Tt}).then(V.G).then(function(){if(!V.Z)return Tt;if(!(V.Z in Tt))throw new b("internal-error");return Tt[V.Z]})}function gg(I){return M2({error:{errors:[{message:I}],code:400,message:I}})}function M2(I,V){var fe=(I.error&&I.error.errors&&I.error.errors[0]||{}).reason||"",De={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(fe=De[fe]?new b(De[fe]):null)return fe;fe=I.error&&I.error.message||"",De={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation",INVALID_TENANT_ID:"invalid-tenant-id",TENANT_ID_MISMATCH:"tenant-id-mismatch",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",EMAIL_CHANGE_NEEDS_VERIFICATION:"email-change-needs-verification",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",UNSUPPORTED_FIRST_FACTOR:"unsupported-first-factor",UNVERIFIED_EMAIL:"unverified-email"},Ue(De,V||{}),V=(V=fe.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1"u"&&delete un[po]}),I.ports[0].postMessage({status:"done",eventId:fe,eventType:V,response:Wt})})}};function aB(I,V,fe){Re(I.a)&&I.b.addEventListener("message",I.f),typeof I.a[V]>"u"&&(I.a[V]=[]),I.a[V].push(fe)}function lB(I){this.a=I}lB.prototype.postMessage=function(I,V){this.a.postMessage(I,V)};function sB(I){this.c=I,this.b=!1,this.a=[]}function cp(I,V,fe,De){var Ke,Tt=fe||{},Wt,un,po,Fo=null;if(I.b)return zo(Error("connection_unavailable"));var Bi=De?800:50,Zl=typeof MessageChannel<"u"?new MessageChannel:null;return new Go(function(Al,Mu){Zl?(Ke=Math.floor(Math.random()*Math.pow(10,20)).toString(),Zl.port1.start(),un=setTimeout(function(){Mu(Error("unsupported_event"))},Bi),Wt=function(yg){yg.data.eventId===Ke&&(yg.data.status==="ack"?(clearTimeout(un),po=setTimeout(function(){Mu(Error("timeout"))},3e3)):yg.data.status==="done"?(clearTimeout(po),typeof yg.data.response<"u"?Al(yg.data.response):Mu(Error("unknown_error"))):(clearTimeout(un),clearTimeout(po),Mu(Error("invalid_response"))))},Fo={messageChannel:Zl,onMessage:Wt},I.a.push(Fo),Zl.port1.addEventListener("message",Wt),I.c.postMessage({eventType:V,eventId:Ke,data:Tt},[Zl.port2])):Mu(Error("connection_unavailable"))}).then(function(Al){return wz(I,Fo),Al}).o(function(Al){throw wz(I,Fo),Al})}function wz(I,V){if(V){var fe=V.messageChannel,De=V.onMessage;fe&&(fe.port1.removeEventListener("message",De),fe.port1.close()),le(I.a,function(Ke){return Ke==V})}}sB.prototype.close=function(){for(;0"u"&&(De=null);var Ke=s.localStorage.getItem(fe);Ke!==De&&(this.b[fe]=Ke,this.nb(fe))}else if(V.indexOf("firebase:")==0&&this.a[V]){if(typeof I.a.a<"u"?U6(this,"local").ia(this.f):Hz(this),this.m){if(fe=s.localStorage.getItem(V),De=I.a.newValue,De!==fe)De!==null?s.localStorage.setItem(V,De):s.localStorage.removeItem(V);else if(this.b[V]===De&&typeof I.a.a>"u")return}var Tt=this;fe=function(){(typeof I.a.a<"u"||Tt.b[V]!==s.localStorage.getItem(V))&&(Tt.b[V]=s.localStorage.getItem(V),Tt.nb(V))},Be&&to&&to==10&&s.localStorage.getItem(V)!==I.a.newValue&&I.a.newValue!==I.a.oldValue?setTimeout(fe,10):fe()}}else oe(I,P(this.nb,this))},t.nb=function(I){this.a[I]&&oe(this.a[I],function(V){V()})};function ET(I){this.a=I,this.b=Sx()}var Mz={name:"authEvent",F:"local"};function Rre(I){return I.b.get(Mz,I.a).then(function(V){return B4(V)})}function Hre(){this.a=Sx()}function Mre(){this.b=-1}function kT(I,V){this.b=xB,this.f=s.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=I,this.h=V,this.l=s.Int32Array?new Int32Array(64):Array(64),FT===void 0&&(s.Int32Array?FT=new Int32Array(SB):FT=SB),this.reset()}var FT;S(kT,Mre);for(var xB=64,Ire=xB-1,vB=[],Iz=0;IzV;V++){Ke=fe[V-15]|0,De=fe[V-2]|0;var Tt=(fe[V-16]|0)+((Ke>>>7|Ke<<25)^(Ke>>>18|Ke<<14)^Ke>>>3)|0,Wt=(fe[V-7]|0)+((De>>>17|De<<15)^(De>>>19|De<<13)^De>>>10)|0;fe[V]=Tt+Wt|0}De=I.a[0]|0,Ke=I.a[1]|0;var un=I.a[2]|0,po=I.a[3]|0,Fo=I.a[4]|0,Bi=I.a[5]|0,Zl=I.a[6]|0;for(Tt=I.a[7]|0,V=0;64>V;V++){var Al=((De>>>2|De<<30)^(De>>>13|De<<19)^(De>>>22|De<<10))+(De&Ke^De&un^Ke&un)|0;Wt=Fo&Bi^~Fo&Zl,Tt=Tt+((Fo>>>6|Fo<<26)^(Fo>>>11|Fo<<21)^(Fo>>>25|Fo<<7))|0,Wt=Wt+(FT[V]|0)|0,Wt=Tt+(Wt+(fe[V]|0)|0)|0,Tt=Zl,Zl=Bi,Bi=Fo,Fo=po+Wt|0,po=un,un=Ke,Ke=De,De=Wt+Al|0}I.a[0]=I.a[0]+De|0,I.a[1]=I.a[1]+Ke|0,I.a[2]=I.a[2]+un|0,I.a[3]=I.a[3]+po|0,I.a[4]=I.a[4]+Fo|0,I.a[5]=I.a[5]+Bi|0,I.a[6]=I.a[6]+Zl|0,I.a[7]=I.a[7]+Tt|0}function Dz(I,V,fe){fe===void 0&&(fe=V.length);var De=0,Ke=I.c;if(typeof V=="string")for(;De=Tt&&Tt==(Tt|0)))throw Error("message must be a byte array");I.f[Ke++]=Tt,Ke==I.b&&(zz(I),Ke=0)}else throw Error("message must be string or array");I.c=Ke,I.g+=fe}var SB=[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 TB(){kT.call(this,8,zre)}S(TB,kT);var zre=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function Ez(I,V,fe,De,Ke,Tt){this.v=I,this.i=V,this.l=fe,this.m=De||null,this.u=Ke||null,this.s=Tt,this.h=V+":"+fe,this.C=new Hre,this.g=new ET(this.h),this.f=null,this.b=[],this.a=this.c=null}function Tx(I){return new b("invalid-cordova-configuration",I)}t=Ez.prototype,t.ma=function(){return this.Ia?this.Ia:this.Ia=y6().then(function(){if(typeof kl("universalLinks.subscribe",s)!="function")throw Tx("cordova-universal-links-plugin-fix is not installed");if(typeof kl("BuildInfo.packageName",s)>"u")throw Tx("cordova-plugin-buildinfo is not installed");if(typeof kl("cordova.plugins.browsertab.openUrl",s)!="function")throw Tx("cordova-plugin-browsertab is not installed");if(typeof kl("cordova.InAppBrowser.open",s)!="function")throw Tx("cordova-plugin-inappbrowser is not installed")},function(){throw new b("cordova-not-ready")})};function Dre(){for(var I=20,V=[];0V.c?Dz(V,bB,56-V.c):Dz(V,bB,V.b-(V.c-56));for(var De=63;56<=De;De--)V.f[De]=fe&255,fe/=256;for(zz(V),De=fe=0;De>Ke&255;return bT(I)}t.Pb=function(I,V){return V(new b("operation-not-supported-in-this-environment")),so()},t.Nb=function(){return zo(new b("operation-not-supported-in-this-environment"))},t.ac=function(){return!1},t.Yb=function(){return!0},t.Ub=function(){return!0},t.Ob=function(I,V,fe,De){if(this.c)return zo(new b("redirect-operation-pending"));var Ke=this,Tt=s.document,Wt=null,un=null,po=null,Fo=null;return this.c=so().then(function(){return Nm(V),Px(Ke)}).then(function(){return kre(Ke,I,V,fe,De)}).then(function(){return new Go(function(Bi,Zl){un=function(){var Al=kl("cordova.plugins.browsertab.close",s);return Bi(),typeof Al=="function"&&Al(),Ke.a&&typeof Ke.a.close=="function"&&(Ke.a.close(),Ke.a=null),!1},Ke.Ea(un),po=function(){Wt||(Wt=ju(2e3).then(function(){Zl(new b("redirect-cancelled-by-user"))}))},Fo=function(){y2()&&po()},Tt.addEventListener("resume",po,!1),gs().toLowerCase().match(/android/)||Tt.addEventListener("visibilitychange",Fo,!1)}).o(function(Bi){return kz(Ke).then(function(){throw Bi})})}).oa(function(){po&&Tt.removeEventListener("resume",po,!1),Fo&&Tt.removeEventListener("visibilitychange",Fo,!1),Wt&&Wt.cancel(),un&&Ke.Ta(un),Ke.c=null})};function kre(I,V,fe,De,Ke){var Tt=Dre(),Wt=new md(V,De,null,Tt,new b("no-auth-event"),null,Ke),un=kl("BuildInfo.packageName",s);if(typeof un!="string")throw new b("invalid-cordova-configuration");var po=kl("BuildInfo.displayName",s),Fo={};if(gs().toLowerCase().match(/iphone|ipad|ipod/))Fo.ibi=un;else if(gs().toLowerCase().match(/android/))Fo.apn=un;else return zo(new b("operation-not-supported-in-this-environment"));po&&(Fo.appDisplayName=po),Tt=Ere(Tt),Fo.sessionId=Tt;var Bi=xx(I.v,I.i,I.l,V,fe,null,De,I.m,Fo,I.u,Ke,I.s);return I.ma().then(function(){var Zl=I.h;return I.C.a.set(Mz,Wt.w(),Zl)}).then(function(){var Zl=kl("cordova.plugins.browsertab.isAvailable",s);if(typeof Zl!="function")throw new b("invalid-cordova-configuration");var Al=null;Zl(function(Mu){if(Mu){if(Al=kl("cordova.plugins.browsertab.openUrl",s),typeof Al!="function")throw new b("invalid-cordova-configuration");Al(Bi)}else{if(Al=kl("cordova.InAppBrowser.open",s),typeof Al!="function")throw new b("invalid-cordova-configuration");Mu=gs(),I.a=Al(Bi,Mu.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||Mu.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}})})}function PB(I,V){for(var fe=0;feI.f&&(I.a=I.f),V)}function Vz(I,V){I.stop(),I.b=ju(Gre(I,V)).then(function(){return x6()}).then(function(){return I.h()}).then(function(){Vz(I,!0)}).o(function(fe){I.i(fe)&&Vz(I,!1)})}Xm.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)};function Gz(I){this.f=I,this.b=this.a=null,this.c=Date.now()}Gz.prototype.w=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:this.c}};function WB(I,V){typeof V>"u"&&(I.b?(V=I.b,V=V.a-V.g):V=0),I.c=Date.now()+1e3*V}function NB(I,V){I.b=W4(V[ke]||""),I.a=V.refreshToken,V=V.expiresIn,WB(I,typeof V<"u"?Number(V):void 0)}function Xz(I,V){I.b=V.b,I.a=V.a,I.c=V.c}function Xre(I,V){return Qd(I.f,V).then(function(fe){return I.b=W4(fe.access_token),I.a=fe.refresh_token,WB(I,fe.expires_in),{accessToken:I.b.toString(),refreshToken:I.a}}).o(function(fe){throw fe.code=="auth/user-token-expired"&&(I.a=null),fe})}Gz.prototype.getToken=function(I){return I=!!I,this.b&&!this.a?zo(new b("user-token-expired")):I||!this.b||Date.now()>this.c-3e4?this.a?Xre(this,{grant_type:"refresh_token",refresh_token:this.a}):so(null):so({accessToken:this.b.toString(),refreshToken:this.a})};function c1(I,V){this.a=I||null,this.b=V||null,Yu(this,{lastSignInTime:og(V||null),creationTime:og(I||null)})}function UB(I){return new c1(I.a,I.b)}c1.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}};function OT(I,V,fe,De,Ke,Tt){Yu(this,{uid:I,displayName:De||null,photoURL:Ke||null,email:fe||null,phoneNumber:Tt||null,providerId:V})}function Xa(I,V,fe){this.N=[],this.l=I.apiKey,this.m=I.appName,this.s=I.authDomain||null;var De=eo.SDK_VERSION?n1(eo.SDK_VERSION):null;this.a=new K(this.l,k(N),De),(this.u=I.emulatorConfig||null)&&Xo(this.a,this.u),this.h=new Gz(this.a),Y6(this,V[ke]),NB(this.h,V),Nr(this,"refreshToken",this.h.a),Hx(this,fe||{}),ps.call(this),this.P=!1,this.s&&qh()&&(this.b=jz(this.s,this.l,this.m,this.u)),this.W=[],this.i=null,this.D=Jre(this),this.ba=P(this.ib,this);var Ke=this;this.za=null,this.Pa=function(Tt){Ke.xa(Tt.h)},this.qa=null,this.Ba=function(Tt){Js(Ke,Tt.c)},this.$=null,this.aa=[],this.Oa=function(Tt){Rx(Ke,Tt.f)},this.ja=null,this.S=new wd(this,fe),Nr(this,"multiFactor",this.S)}S(Xa,ps),Xa.prototype.xa=function(I){this.za=I,io(this.a,I)};function Js(I,V){I.u=V,Xo(I.a,V),I.b&&(V=I.b,I.b=jz(I.s,I.l,I.m,I.u),I.P&&(Wz(V,I),j6(I.b,I)))}Xa.prototype.la=function(){return this.za};function _T(I,V){I.qa&&go(I.qa,"languageCodeChanged",I.Pa),(I.qa=V)&&Tn(V,"languageCodeChanged",I.Pa)}function Jz(I,V){I.$&&go(I.$,"emulatorConfigChanged",I.Ba),(I.$=V)&&Tn(V,"emulatorConfigChanged",I.Ba)}function Rx(I,V){I.aa=V,Ei(I.a,eo.SDK_VERSION?n1(eo.SDK_VERSION,I.aa):null)}Xa.prototype.Ga=function(){return he(this.aa)};function Kz(I,V){I.ja&&go(I.ja,"frameworkChanged",I.Oa),(I.ja=V)&&Tn(V,"frameworkChanged",I.Oa)}Xa.prototype.ib=function(){this.D.b&&(this.D.stop(),this.D.start())};function $z(I){try{return eo.app(I.m).auth()}catch{throw new b("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+I.m+"'!")}}function Jre(I){return new Xm(function(){return I.I(!0)},function(V){return!!(V&&V.code=="auth/network-request-failed")},function(){var V=I.h.c-Date.now()-3e5;return 0"u"||Re(I)?{}:h9(new S6(I))}).then(function(De){return V.a.vb(fe,De)}).then(function(De){if(V.email!=De)return V.reload()}).then(function(){}))},t.Fb=function(I,V){var fe=this,De=null;return Yc(this,this.I().then(function(Ke){return De=Ke,typeof V>"u"||Re(V)?{}:h9(new S6(V))}).then(function(Ke){return fe.a.Fb(De,I,Ke)}).then(function(Ke){if(fe.email!=Ke)return fe.reload()}).then(function(){}))};function Yc(I,V,fe){var De=Kre(I,V,fe);return I.N.push(De),De.oa(function(){q(I.N,De)}),De.o(function(Ke){var Tt=null;throw Ke&&Ke.code==="auth/multi-factor-auth-required"&&(Tt=LB(Ke.w(),$z(I),P(I.jc,I))),Tt||Ke})}t.jc=function(I){var V=null,fe=this;return I=x2(so(I),fe.uid).then(function(De){return V=nw(fe,De,"reauthenticate"),f0(fe,De),fe.i=null,fe.reload()}).then(function(){return V}),Yc(this,I,!0)};function Kre(I,V,fe){return I.i&&!fe?(V.cancel(),zo(I.i)):V.o(function(De){throw!De||De.code!="auth/user-disabled"&&De.code!="auth/user-token-expired"||(I.i||I.dispatchEvent(new ew("userInvalidated")),I.i=De),De})}t.toJSON=function(){return this.w()},t.w=function(){var I={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.s,stsTokenManager:this.h.w(),redirectEventId:this.ga||null};return this.metadata&&Ue(I,this.metadata.w()),oe(this.providerData,function(V){I.providerData.push(s9(V))}),Ue(I,this.S.w()),I};function VB(I){if(!I.apiKey)return null;var V={apiKey:I.apiKey,authDomain:I.authDomain,appName:I.appName,emulatorConfig:I.emulatorConfig},fe={};if(I.stsTokenManager&&I.stsTokenManager.accessToken){fe[ke]=I.stsTokenManager.accessToken,fe.refreshToken=I.stsTokenManager.refreshToken||null;var De=I.stsTokenManager.expirationTime;De&&(fe.expiresIn=(De-Date.now())/1e3)}else return null;var Ke=new Xa(V,fe,I);return I.providerData&&oe(I.providerData,function(Tt){Tt&&Zz(Ke,Qh(Tt))}),I.redirectEventId&&(Ke.ga=I.redirectEventId),Ke}function $re(I,V,fe,De){var Ke=new Xa(I,V);return fe&&(Ke.ha=fe),De&&Rx(Ke,De),Ke.reload().then(function(){return Ke})}function qre(I,V,fe,De){var Ke=I.h,Tt={};return Tt[ke]=Ke.b&&Ke.b.toString(),Tt.refreshToken=Ke.a,V=new Xa(V||{apiKey:I.l,authDomain:I.s,appName:I.m},Tt),fe&&(V.ha=fe),De&&Rx(V,De),GT(V,I),V}function Qre(I){this.a=I,this.b=Sx()}var tD={name:"redirectUser",F:"session"};function GB(I){return Z4(I.b,tD,I.a)}function Zre(I,V){return I.b.get(tD,I.a).then(function(fe){return fe&&V&&(fe.authDomain=V),VB(fe||{})})}function nD(I){this.a=I,this.b=Sx(),this.c=null,this.f=eie(this),this.b.addListener(Jm("local"),this.a,P(this.g,this))}nD.prototype.g=function(){var I=this,V=Jm("local");ow(this,function(){return so().then(function(){return I.c&&I.c.F!="local"?I.b.get(V,I.a):null}).then(function(fe){if(fe)return oD(I,"local").then(function(){I.c=V})})})};function oD(I,V){var fe=[],De;for(De in N6)N6[De]!==V&&fe.push(Z4(I.b,Jm(N6[De]),I.a));return fe.push(Z4(I.b,rD,I.a)),ea(fe)}function eie(I){var V=Jm("local"),fe=Jm("session"),De=Jm("none");return Cre(I.b,V,I.a).then(function(){return I.b.get(fe,I.a)}).then(function(Ke){return Ke?fe:I.b.get(De,I.a).then(function(Tt){return Tt?De:I.b.get(V,I.a).then(function(Wt){return Wt?V:I.b.get(rD,I.a).then(function(un){return un?Jm(un):V})})})}).then(function(Ke){return I.c=Ke,oD(I,Ke.F)}).o(function(){I.c||(I.c=V)})}var rD={name:"persistence",F:"session"};function Jm(I){return{name:"authUser",F:I}}nD.prototype.yb=function(I){var V=null,fe=this;return Pre(I),ow(this,function(){return I!=fe.c.F?fe.b.get(fe.c,fe.a).then(function(De){return V=De,oD(fe,I)}).then(function(){if(fe.c=Jm(I),V)return fe.b.set(fe.c,V,fe.a)}):so()})};function iD(I){return ow(I,function(){return I.b.set(rD,I.c.F,I.a)})}function XB(I,V){return ow(I,function(){return I.b.set(I.c,V.w(),I.a)})}function JT(I){return ow(I,function(){return Z4(I.b,I.c,I.a)})}function JB(I,V,fe){return ow(I,function(){return I.b.get(I.c,I.a).then(function(De){return De&&V&&(De.authDomain=V),De&&fe&&(De.emulatorConfig=fe),VB(De||{})})})}function ow(I,V){return I.f=I.f.then(V,V),I.f}function mg(I){if(this.l=!1,Nr(this,"settings",new EB),Nr(this,"app",I),Ql(this).options&&Ql(this).options.apiKey)I=eo.SDK_VERSION?n1(eo.SDK_VERSION):null,this.a=new K(Ql(this).options&&Ql(this).options.apiKey,k(N),I);else throw new b("invalid-api-key");this.P=[],this.s=[],this.N=[],this.Pa=eo.INTERNAL.createSubscribe(P(this.zc,this)),this.W=void 0,this.ib=eo.INTERNAL.createSubscribe(P(this.Ac,this)),_6(this,null),this.i=new nD(Ql(this).options.apiKey+":"+Ql(this).name),this.D=new Qre(Ql(this).options.apiKey+":"+Ql(this).name),this.$=ms(this,aie(this)),this.h=ms(this,lie(this)),this.ba=!1,this.ja=P(this.Zc,this),this.Ba=P(this.da,this),this.qa=P(this.mc,this),this.za=P(this.wc,this),this.Aa=P(this.xc,this),this.b=null,oie(this),this.INTERNAL={},this.INTERNAL.delete=P(this.delete,this),this.INTERNAL.logFramework=P(this.Gc,this),this.u=0,ps.call(this),nie(this),this.J=[],this.R=null}S(mg,ps);function Gu(I){Cn.call(this,"languageCodeChanged"),this.h=I}S(Gu,Cn);function tf(I){Cn.call(this,"emulatorConfigChanged"),this.c=I}S(tf,Cn);function KB(I){Cn.call(this,"frameworkChanged"),this.f=I}S(KB,Cn),t=mg.prototype,t.yb=function(I){return I=this.i.yb(I),ms(this,I)},t.xa=function(I){this.aa===I||this.l||(this.aa=I,io(this.a,this.aa),this.dispatchEvent(new Gu(this.la())))},t.la=function(){return this.aa},t.fd=function(){var I=s.navigator;this.xa(I&&(I.languages&&I.languages[0]||I.language||I.userLanguage)||null)},t.gd=function(I,V){if(!this.R){if(!/^https?:\/\//.test(I))throw new b("argument-error","Emulator URL must start with a valid scheme (http:// or https://).");V=V?!!V.disableWarnings:!1,tie(V),this.R={url:I,ec:V},this.settings.jb=!0,Xo(this.a,this.R),this.dispatchEvent(new tf(this.R))}};function tie(I){typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),s.document&&!I&&$h().then(function(){var V=s.document.createElement("div");V.innerText="Running in emulator mode. Do not use with production credentials.",V.style.position="fixed",V.style.width="100%",V.style.backgroundColor="#ffffff",V.style.border=".1em solid #000000",V.style.color="#b50000",V.style.bottom="0px",V.style.left="0px",V.style.margin="0px",V.style.zIndex=1e4,V.style.textAlign="center",V.classList.add("firebase-emulator-warning"),s.document.body.appendChild(V)})}t.Gc=function(I){this.J.push(I),Ei(this.a,eo.SDK_VERSION?n1(eo.SDK_VERSION,this.J):null),this.dispatchEvent(new KB(this.J))},t.Ga=function(){return he(this.J)},t.zb=function(I){this.S===I||this.l||(this.S=I,this.a.b=this.S)},t.T=function(){return this.S};function nie(I){Object.defineProperty(I,"lc",{get:function(){return this.la()},set:function(V){this.xa(V)},enumerable:!1}),I.aa=null,Object.defineProperty(I,"ti",{get:function(){return this.T()},set:function(V){this.zb(V)},enumerable:!1}),I.S=null,Object.defineProperty(I,"emulatorConfig",{get:function(){if(this.R){var V=iu(this.R.url);V=Qh({protocol:V.c,host:V.a,port:V.g,options:Qh({disableWarnings:this.R.ec})})}else V=null;return V},enumerable:!1})}t.toJSON=function(){return{apiKey:Ql(this).options.apiKey,authDomain:Ql(this).options.authDomain,appName:Ql(this).name,currentUser:da(this)&&da(this).w()}};function KT(I){return I.Oa||zo(new b("auth-domain-config-required"))}function oie(I){var V=Ql(I).options.authDomain,fe=Ql(I).options.apiKey;V&&qh()&&(I.Oa=I.$.then(function(){if(!I.l){if(I.b=jz(V,fe,Ql(I).name,I.R),j6(I.b,I),da(I)&&tw(da(I)),I.m){tw(I.m);var De=I.m;De.xa(I.la()),_T(De,I),De=I.m,Rx(De,I.J),Kz(De,I),De=I.m,Js(De,I.R),Jz(De,I),I.m=null}return I.b}}))}t.Gb=function(I,V){switch(I){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==V&&!!this.f;default:return!1}},t.na=function(I,V,fe,De){I=="signInViaPopup"&&this.g==De&&(fe&&this.C?this.C(fe):V&&!fe&&this.f&&this.f(V),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(I,V){return I=="signInViaRedirect"||I=="signInViaPopup"&&this.g==V&&this.f?P(this.ic,this):null},t.ic=function(I,V,fe,De){var Ke=this,Tt={requestUri:I,postBody:De,sessionId:V,tenantId:fe};return this.c&&(this.c.cancel(),this.c=null),Ke.$.then(function(){return R9(Ke,R2(Ke.a,Tt))})},t.Xc=function(I){if(!qh())return zo(new b("operation-not-supported-in-this-environment"));var V=this,fe=C6(I.providerId),De=Yf(),Ke=null;(!Bf()||uc())&&Ql(this).options.authDomain&&I.isOAuthProvider&&(Ke=xx(Ql(this).options.authDomain,Ql(this).options.apiKey,Ql(this).name,"signInViaPopup",I,null,De,eo.SDK_VERSION||null,null,null,this.T(),this.R));var Tt=vi(Ke,fe&&fe.va,fe&&fe.ua);return fe=KT(this).then(function(Wt){return WT(Wt,Tt,"signInViaPopup",I,De,!!Ke,V.T())}).then(function(){return new Go(function(Wt,un){V.na("signInViaPopup",null,new b("cancelled-popup-request"),V.g),V.f=Wt,V.C=un,V.g=De,V.c=Uz(V.b,V,"signInViaPopup",Tt,De)})}).then(function(Wt){return Tt&&yl(Tt),Wt?Qh(Wt):null}).o(function(Wt){throw Tt&&yl(Tt),Wt}),ms(this,fe)},t.Yc=function(I){if(!qh())return zo(new b("operation-not-supported-in-this-environment"));var V=this,fe=KT(this).then(function(){return iD(V.i)}).then(function(){return Nz(V.b,"signInViaRedirect",I,void 0,V.T())});return ms(this,fe)};function $B(I){if(!qh())return zo(new b("operation-not-supported-in-this-environment"));var V=KT(I).then(function(){return I.b.ra()}).then(function(fe){return fe?Qh(fe):null});return ms(I,V)}t.ra=function(){var I=this;return $B(this).then(function(V){return I.b&&B6(I.b.b),V}).o(function(V){throw I.b&&B6(I.b.b),V})},t.dd=function(I){if(!I)return zo(new b("null-user"));if(this.S!=I.tenantId)return zo(new b("tenant-id-mismatch"));var V=this,fe={};fe.apiKey=Ql(this).options.apiKey,fe.authDomain=Ql(this).options.authDomain,fe.appName=Ql(this).name;var De=qre(I,fe,V.D,V.Ga());return ms(this,this.h.then(function(){if(Ql(V).options.apiKey!=I.l)return De.reload()}).then(function(){return da(V)&&I.uid==da(V).uid?(GT(da(V),I),V.da(I)):(_6(V,De),tw(De),V.da(De))}).then(function(){Mx(V)}))};function rie(I,V){var fe={};return fe.apiKey=Ql(I).options.apiKey,fe.authDomain=Ql(I).options.authDomain,fe.appName=Ql(I).name,I.R&&(fe.emulatorConfig=I.R),I.$.then(function(){return $re(fe,V,I.D,I.Ga())}).then(function(De){return da(I)&&De.uid==da(I).uid?(GT(da(I),De),I.da(De)):(_6(I,De),tw(De),I.da(De))}).then(function(){Mx(I)})}function _6(I,V){da(I)&&(qz(da(I),I.Ba),go(da(I),"tokenChanged",I.qa),go(da(I),"userDeleted",I.za),go(da(I),"userInvalidated",I.Aa),VT(da(I))),V&&(V.W.push(I.Ba),Tn(V,"tokenChanged",I.qa),Tn(V,"userDeleted",I.za),Tn(V,"userInvalidated",I.Aa),0this.u&&(this.u=0),this.u==0&&da(this)&&VT(da(this)),this.removeAuthTokenListener(I)},t.addAuthTokenListener=function(I){var V=this;this.s.push(I),ms(this,this.h.then(function(){V.l||te(V.s,I)&&I($T(V))}))},t.removeAuthTokenListener=function(I){le(this.s,function(V){return V==I})};function sie(I,V){I.N.push(V),ms(I,I.h.then(function(){!I.l&&te(I.N,V)&&I.W!==I.getUid()&&(I.W=I.getUid(),V($T(I)))}))}t.delete=function(){this.l=!0;for(var I=0;I"u"||Re(V)?{}:h9(new S6(V))}).then(function(De){return fe.a.wb(I,De)}).then(function(){}))},t.Wc=function(I,V){return ms(this,Yz(this,I,V,P(this.ab,this)))},t.Vc=function(I,V){var fe=this;return ms(this,so().then(function(){var De=V||lo(),Ke=oa(I,De);if(De=Gs(De),!De)throw new b("argument-error","Invalid email link!");if(De.tenantId!==fe.T())throw new b("tenant-id-mismatch");return fe.ab(Ke)}))};function Ix(){}Ix.prototype.render=function(){},Ix.prototype.reset=function(){},Ix.prototype.getResponse=function(){},Ix.prototype.execute=function(){};function rw(){this.a={},this.b=1e12}var aD=null;rw.prototype.render=function(I,V){return this.a[this.b.toString()]=new zx(I,V),this.b++},rw.prototype.reset=function(I){var V=lD(this,I);I=qB(I),V&&I&&(V.delete(),delete this.a[I])},rw.prototype.getResponse=function(I){return(I=lD(this,I))?I.getResponse():null},rw.prototype.execute=function(I){(I=lD(this,I))&&I.execute()};function lD(I,V){return(V=qB(V))&&I.a[V]||null}function qB(I){return(I=typeof I>"u"?1e12:I)?I.toString():null}function zx(I,V){this.g=!1,this.c=V,this.a=this.b=null,this.h=this.c.size!=="invisible",this.f=fn(I);var fe=this;this.i=function(){fe.execute()},this.h?this.execute():Tn(this.f,"click",this.i)}zx.prototype.getResponse=function(){return qT(this),this.b},zx.prototype.execute=function(){qT(this);var I=this;this.a||(this.a=setTimeout(function(){I.b=t1();var V=I.c.callback,fe=I.c["expired-callback"];if(V)try{V(I.b)}catch{}I.a=setTimeout(function(){if(I.a=null,I.b=null,fe)try{fe()}catch{}I.h&&I.execute()},6e4)},500))},zx.prototype.delete=function(){qT(this),this.g=!0,clearTimeout(this.a),this.a=null,go(this.f,"click",this.i)};function qT(I){if(I.g)throw Error("reCAPTCHA mock was already deleted!")}function sD(){}Nr(sD,"FACTOR_ID","phone");function cD(){}cD.prototype.g=function(){return aD||(aD=new rw),so(aD)},cD.prototype.c=function(){};var uD=null;function dD(){this.b=s.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var cie=new Fe(Ye,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),uie=new ng(3e4,6e4);dD.prototype.g=function(I){var V=this;return new Go(function(fe,De){var Ke=setTimeout(function(){De(new b("network-request-failed"))},uie.get());if(!s.grecaptcha||I!==V.f&&!V.b){s[V.a]=function(){if(s.grecaptcha){V.f=I;var Wt=s.grecaptcha.render;s.grecaptcha.render=function(un,po){return un=Wt(un,po),V.b++,un},clearTimeout(Ke),fe(s.grecaptcha)}else clearTimeout(Ke),De(new b("internal-error"));delete s[V.a]};var Tt=Qe(cie,{onload:V.a,hl:I||""});so(_4(Tt)).o(function(){clearTimeout(Ke),De(new b("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else clearTimeout(Ke),fe(s.grecaptcha)})},dD.prototype.c=function(){this.b--};var fD=null;function hD(I,V,fe,De,Ke,Tt,Wt){if(Nr(this,"type","recaptcha"),this.c=this.f=null,this.J=!1,this.v=V,this.g=null,Wt?(uD||(uD=new cD),Wt=uD):(fD||(fD=new dD),Wt=fD),this.m=Wt,this.a=fe||{theme:"light",type:"image"},this.h=[],this.a[eY])throw new b("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i=this.a[die]==="invisible",!s.document)throw new b("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!fn(V)||!this.i&&fn(V).hasChildNodes())throw new b("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new K(I,Tt||null,Ke||null),this.u=De||function(){return null};var un=this;this.l=[];var po=this.a[QB];this.a[QB]=function(Bi){if(tY(un,Bi),typeof po=="function")po(Bi);else if(typeof po=="string"){var Zl=kl(po,s);typeof Zl=="function"&&Zl(Bi)}};var Fo=this.a[ZB];this.a[ZB]=function(){if(tY(un,null),typeof Fo=="function")Fo();else if(typeof Fo=="string"){var Bi=kl(Fo,s);typeof Bi=="function"&&Bi()}}}var QB="callback",ZB="expired-callback",eY="sitekey",die="size";function tY(I,V){for(var fe=0;feKe||Ke>=oY.length)throw new b("internal-error","Argument validator received an unsupported number of arguments.");fe=oY[Ke],De=(De?"":fe+" argument ")+(V.name?'"'+V.name+'" ':"")+"must be "+V.K+".";break e}De=null}}if(De)throw new b("argument-error",I+" failed: "+De)}var oY="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Br(I,V){return{name:I||"",K:"a valid string",optional:!!V,M:function(fe){return typeof fe=="string"}}}function mD(I,V){return{name:I||"",K:"a boolean",optional:!!V,M:function(fe){return typeof fe=="boolean"}}}function Hu(I,V){return{name:I||"",K:"a valid object",optional:!!V,M:w}}function iw(I,V){return{name:I||"",K:"a function",optional:!!V,M:function(fe){return typeof fe=="function"}}}function Km(I,V){return{name:I||"",K:"null",optional:!!V,M:function(fe){return fe===null}}}function hie(){return{name:"",K:"an HTML element",optional:!1,M:function(I){return!!(I&&I instanceof Element)}}}function yD(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(I){return!!(I&&I instanceof mg)}}}function rY(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(I){return!!(I&&I instanceof eo.app.App)}}}function z2(I){return{name:I?I+"Credential":"credential",K:I?"a valid "+I+" credential":"a valid credential",optional:!1,M:function(V){if(!V)return!1;var fe=!I||V.providerId===I;return!(!V.ka||!fe)}}}function iY(){return{name:"multiFactorAssertion",K:"a valid multiFactorAssertion",optional:!1,M:function(I){return I?!!I.tb:!1}}}function aw(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(I){return!!(I&&I.providerId&&I.hasOwnProperty&&I.hasOwnProperty("isOAuthProvider"))}}}function AD(I,V){return w(I)&&typeof I.type=="string"&&I.type===V&&typeof I.Ha=="function"}function ZT(I){return w(I)&&typeof I.uid=="string"}function eP(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(I){return!(!I||typeof I.type!="string"||typeof I.verify!="function")}}}function lu(I,V,fe,De){return{name:fe||"",K:I.K+" or "+V.K,optional:!!De,M:function(Ke){return I.M(Ke)||V.M(Ke)}}}function hc(I,V){for(var fe in V){var De=V[fe].name;I[De]=aY(De,I[fe],V[fe].j)}}function nf(I,V){for(var fe in V){var De=V[fe].name;De!==fe&&Object.defineProperty(I,De,{get:A(function(Ke){return this[Ke]},fe),set:A(function(Ke,Tt,Wt,un){nY(Ke,[Wt],[un],!0),this[Tt]=un},De,fe,V[fe].lb),enumerable:!0})}}function pc(I,V,fe,De){I[V]=aY(V,fe,De)}function aY(I,V,fe){function De(){var Wt=Array.prototype.slice.call(arguments);return nY(Ke,fe,Wt),V.apply(this,Wt)}if(!fe)return V;var Ke=pie(I),Tt;for(Tt in V)De[Tt]=V[Tt];for(Tt in V.prototype)De.prototype[Tt]=V.prototype[Tt];return De}function pie(I){return I=I.split("."),I[I.length-1]}hc(mg.prototype,{kb:{name:"applyActionCode",j:[Br("code")]},Sa:{name:"checkActionCode",j:[Br("code")]},ob:{name:"confirmPasswordReset",j:[Br("code"),Br("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[Br("email"),Br("password")]},hc:{name:"fetchSignInMethodsForEmail",j:[Br("email")]},ra:{name:"getRedirectResult",j:[]},Bc:{name:"isSignInWithEmailLink",j:[Br("emailLink")]},Hc:{name:"onAuthStateChanged",j:[lu(Hu(),iw(),"nextOrObserver"),iw("opt_error",!0),iw("opt_completed",!0)]},Ic:{name:"onIdTokenChanged",j:[lu(Hu(),iw(),"nextOrObserver"),iw("opt_error",!0),iw("opt_completed",!0)]},wb:{name:"sendPasswordResetEmail",j:[Br("email"),lu(Hu("opt_actionCodeSettings",!0),Km(null,!0),"opt_actionCodeSettings",!0)]},xb:{name:"sendSignInLinkToEmail",j:[Br("email"),Hu("actionCodeSettings")]},yb:{name:"setPersistence",j:[Br("persistence")]},Sc:{name:"signInAndRetrieveDataWithCredential",j:[z2()]},Ab:{name:"signInAnonymously",j:[]},ab:{name:"signInWithCredential",j:[z2()]},Tc:{name:"signInWithCustomToken",j:[Br("token")]},Uc:{name:"signInWithEmailAndPassword",j:[Br("email"),Br("password")]},Vc:{name:"signInWithEmailLink",j:[Br("email"),Br("emailLink",!0)]},Wc:{name:"signInWithPhoneNumber",j:[Br("phoneNumber"),eP()]},Xc:{name:"signInWithPopup",j:[aw()]},Yc:{name:"signInWithRedirect",j:[aw()]},dd:{name:"updateCurrentUser",j:[lu(function(I){return{name:"user",K:"an instance of Firebase User",optional:!1,M:function(V){return!!(V&&V instanceof Xa)}}}(),Km(),"user")]},Bb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Br(null,!0)]},fd:{name:"useDeviceLanguage",j:[]},gd:{name:"useEmulator",j:[Br("url"),Hu("options",!0)]},jd:{name:"verifyPasswordResetCode",j:[Br("code")]}}),nf(mg.prototype,{lc:{name:"languageCode",lb:lu(Br(),Km(),"languageCode")},ti:{name:"tenantId",lb:lu(Br(),Km(),"tenantId")}}),mg.Persistence=N6,mg.Persistence.LOCAL="local",mg.Persistence.SESSION="session",mg.Persistence.NONE="none",hc(Xa.prototype,{delete:{name:"delete",j:[]},oc:{name:"getIdTokenResult",j:[mD("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[mD("opt_forceRefresh",!0)]},Cc:{name:"linkAndRetrieveDataWithCredential",j:[z2()]},rb:{name:"linkWithCredential",j:[z2()]},Dc:{name:"linkWithPhoneNumber",j:[Br("phoneNumber"),eP()]},Ec:{name:"linkWithPopup",j:[aw()]},Fc:{name:"linkWithRedirect",j:[aw()]},Lc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[z2()]},ub:{name:"reauthenticateWithCredential",j:[z2()]},Mc:{name:"reauthenticateWithPhoneNumber",j:[Br("phoneNumber"),eP()]},Nc:{name:"reauthenticateWithPopup",j:[aw()]},Oc:{name:"reauthenticateWithRedirect",j:[aw()]},reload:{name:"reload",j:[]},vb:{name:"sendEmailVerification",j:[lu(Hu("opt_actionCodeSettings",!0),Km(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Br(null,!0)]},cd:{name:"unlink",j:[Br("provider")]},Cb:{name:"updateEmail",j:[Br("email")]},Db:{name:"updatePassword",j:[Br("password")]},ed:{name:"updatePhoneNumber",j:[z2("phone")]},Eb:{name:"updateProfile",j:[Hu("profile")]},Fb:{name:"verifyBeforeUpdateEmail",j:[Br("email"),lu(Hu("opt_actionCodeSettings",!0),Km(null,!0),"opt_actionCodeSettings",!0)]}}),hc(rw.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),hc(Ix.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),hc(Go.prototype,{oa:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),nf(EB.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",lb:mD("appVerificationDisabledForTesting")}}),hc(Bz.prototype,{confirm:{name:"confirm",j:[Br("verificationCode")]}}),pc(s0,"fromJSON",function(I){I=typeof I=="string"?JSON.parse(I):I;for(var V,fe=[m9,dx,fc,ST],De=0;De{var v,b,T;const e=H(pn),n=dt(kf),o=H(Xp),r=dt(dTt),i=dt(xCt),a=dt(vCt),l=xe.useRef(null),s=g.useRef(null),c=g.useRef(o.schoolID??yc.UNKNOWN),u=g.useRef(o.classID??$a.UNKNOWN),d=s.current?s.current.clientWidth+40:640,f=s.current?s.current.clientHeight+100:600,[p,m]=g.useState({x:0,y:0}),y=Kt();g.useEffect(()=>{const R=()=>{m({x:Math.max(0,d-window.innerWidth),y:Math.min(0,window.innerHeight-f)})};return window.addEventListener("resize",R),()=>{window.removeEventListener("resize",R)}},[]);const w=(R,M)=>{m({x:Math.max(M.x,d-window.innerWidth),y:Math.min(M.y,window.innerHeight-f)})},x=(R,M)=>{},C=()=>{dt.getState().set(R=>{R.showAccountSettingsPanel=!1})},P=o&&o.email&&o.email.endsWith("intofuture.org"),A=!1,{t:S}=Jl();return h.jsxs(h.Fragment,{children:[i&&h.jsx(ovo,{likesArray:o.likes??[],openCloudFile:t}),a&&h.jsx(svo,{publishedModels:o.published??[],openCloudFile:t}),h.jsx(Vi,{nodeRef:l,handle:".handle",bounds:"parent",axis:"both",position:p,onDrag:w,onStop:x,children:h.jsx(cvo,{ref:l,children:h.jsxs(uvo,{ref:s,children:[h.jsxs(dvo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:S("accountSettingsPanel.MyAccountSettings",y)+(o.anonymous?" ("+S("word.Anonymous",y)+")":"")}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{C()},onTouchStart:()=>{C()},children:S("word.Close",y)})]}),h.jsxs(Qt,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,onClick:()=>{o.uid&&navigator.clipboard.writeText(o.uid).then(()=>d5(S("accountSettingsPanel.IDInClipBoard",y)))},children:h.jsx(oo,{title:S("accountSettingsPanel.ClickToCopyMyID",y),style:{cursor:"copy",borderRadius:"8px"},children:S("accountSettingsPanel.MyID",y)})}),h.jsx(Ge,{style:{paddingTop:"8px"},span:18,children:o.uid})]}),A,h.jsxs(Qt,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{style:{paddingTop:"8px"},span:6,children:S("accountSettingsPanel.SchoolID",y)}),h.jsx(Ge,{span:18,children:h.jsxs(Ko,{style:{width:"90%"},value:c.current,onChange:R=>{c.current=R,e(M=>{M.user.schoolID=R}),dt.getState().set(M=>{M.saveAccountSettingsFlag=!0})},children:[h.jsx(lh,{value:yc.UNKNOWN,children:yc.UNKNOWN},yc.UNKNOWN),h.jsx(lh,{value:yc.SCHOOL1,children:yc.SCHOOL1},yc.SCHOOL1),h.jsx(lh,{value:yc.SCHOOL2,children:yc.SCHOOL2},yc.SCHOOL2),h.jsx(lh,{value:yc.SCHOOL3,children:yc.SCHOOL3},yc.SCHOOL3),h.jsx(lh,{value:yc.SCHOOL4,children:yc.SCHOOL4},yc.SCHOOL4),h.jsx(lh,{value:yc.SCHOOL5,children:yc.SCHOOL5},yc.SCHOOL5)]})})]}),h.jsxs(Qt,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{style:{paddingTop:"8px"},span:6,children:S("accountSettingsPanel.ClassID",y)}),h.jsx(Ge,{span:18,children:h.jsxs(Ko,{style:{width:"90%"},value:u.current,onChange:R=>{u.current=R,e(M=>{M.user.classID=R}),dt.getState().set(M=>{M.saveAccountSettingsFlag=!0})},children:[h.jsx(lh,{value:$a.UNKNOWN,children:$a.UNKNOWN},$a.UNKNOWN),h.jsx(lh,{value:$a.CLASS1,children:$a.CLASS1},$a.CLASS1),h.jsx(lh,{value:$a.CLASS2,children:$a.CLASS2},$a.CLASS2),h.jsx(lh,{value:$a.CLASS3,children:$a.CLASS3},$a.CLASS3),h.jsx(lh,{value:$a.CLASS4,children:$a.CLASS4},$a.CLASS4),h.jsx(lh,{value:$a.CLASS5,children:$a.CLASS5},$a.CLASS5),h.jsx(lh,{value:$a.CLASS6,children:$a.CLASS6},$a.CLASS6),h.jsx(lh,{value:$a.CLASS7,children:$a.CLASS7},$a.CLASS7),h.jsx(lh,{value:$a.CLASS8,children:$a.CLASS8},$a.CLASS8),h.jsx(lh,{value:$a.CLASS9,children:$a.CLASS9},$a.CLASS9)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,children:S("accountSettingsPanel.AllPublished",y)}),h.jsx(Ge,{span:18,children:h.jsx("span",{style:{cursor:"pointer"},onClick:()=>{n("showPublishedModelsPanel",!0)},children:((v=o.published)==null?void 0:v.length)??0})})]}),h.jsxs(Qt,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,children:S("accountSettingsPanel.PublishedUnderAliases",y)}),h.jsx(Ge,{span:18,children:h.jsx("span",{style:{fontSize:"10px"},children:(b=o.aliases)==null?void 0:b.map((R,M)=>o.aliases?R+(M{n("showLikesPanel",!0)},children:((T=o.likes)==null?void 0:T.length)??0})})]}),P&&h.jsxs(Qt,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,children:S("accountSettingsPanel.UserCount",y)}),h.jsx(Ge,{span:18,children:r})]})]})})})]})});function gW(t){"@babel/helpers - typeof";return gW=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gW(t)}function hvo(t,e){if(gW(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(gW(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pvo(t){var e=hvo(t,"string");return gW(e)=="symbol"?e:e+""}function mo(t,e,n){return(e=pvo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o0t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _ce,zEe;function gvo(){if(zEe)return _ce;zEe=1;var t=function(n,o,r,i,a,l,s,c){if(!n){var u;if(o===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[r,i,a,l,s,c],f=0;u=new Error(o.replace(/%s/g,function(){return d[f++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};return _ce=t,_ce}var mvo=gvo(),od=o0t(mvo),Ra=g.createContext(null);function yvo(){od(!!g.useContext,"useGoogleMap is React hook and requires React version 16.8+");var t=g.useContext(Ra);return od(!!t,"useGoogleMap needs a GoogleMap available up in the tree"),t}function Avo(t,e,n){return Object.keys(t).reduce(function(r,i){return e(r,t[i],i)},n)}function wvo(t,e){Object.keys(t).forEach(n=>e(t[n],n))}function xvo(t,e,n,o){var r={},i=(a,l)=>{var s=n[l];s!==e[l]&&(r[l]=s,a(o,s))};return wvo(t,i),r}function vvo(t,e,n){var o=Avo(n,function(i,a,l){return typeof t[l]=="function"&&i.push(google.maps.event.addListener(e,a,t[l])),i},[]);return o}function bvo(t){google.maps.event.removeListener(t)}function Za(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];t.forEach(bvo)}function Va(t){var{updaterMap:e,eventMap:n,prevProps:o,nextProps:r,instance:i}=t,a=vvo(r,i,n);return xvo(e,o,r,i),a}var DEe={onDblClick:"dblclick",onDragEnd:"dragend",onDragStart:"dragstart",onMapTypeIdChanged:"maptypeid_changed",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseDown:"mousedown",onMouseUp:"mouseup",onRightClick:"rightclick",onTilesLoaded:"tilesloaded",onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onDrag:"drag",onHeadingChanged:"heading_changed",onIdle:"idle",onProjectionChanged:"projection_changed",onResize:"resize",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed"},EEe={extraMapTypes(t,e){e.forEach(function(o,r){t.mapTypes.set(String(r),o)})},center(t,e){t.setCenter(e)},clickableIcons(t,e){t.setClickableIcons(e)},heading(t,e){t.setHeading(e)},mapTypeId(t,e){t.setMapTypeId(e)},options(t,e){t.setOptions(e)},streetView(t,e){t.setStreetView(e)},tilt(t,e){t.setTilt(e)},zoom(t,e){t.setZoom(e)}};function Svo(t){var{children:e,options:n,id:o,mapContainerStyle:r,mapContainerClassName:i,center:a,onClick:l,onDblClick:s,onDrag:c,onDragEnd:u,onDragStart:d,onMouseMove:f,onMouseOut:p,onMouseOver:m,onMouseDown:y,onMouseUp:w,onRightClick:x,onCenterChanged:C,onLoad:P,onUnmount:A}=t,[S,v]=g.useState(null),b=g.useRef(null),[T,R]=g.useState(null),[M,D]=g.useState(null),[k,N]=g.useState(null),[U,W]=g.useState(null),[F,E]=g.useState(null),[L,j]=g.useState(null),[Y,O]=g.useState(null),[_,G]=g.useState(null),[Q,oe]=g.useState(null),[ee,q]=g.useState(null),[ae,Z]=g.useState(null),[ne,te]=g.useState(null);return g.useEffect(()=>{n&&S!==null&&S.setOptions(n)},[S,n]),g.useEffect(()=>{S!==null&&typeof a<"u"&&S.setCenter(a)},[S,a]),g.useEffect(()=>{S&&s&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(S,"dblclick",s)))},[s]),g.useEffect(()=>{S&&u&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(S,"dragend",u)))},[u]),g.useEffect(()=>{S&&d&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(S,"dragstart",d)))},[d]),g.useEffect(()=>{S&&y&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(S,"mousedown",y)))},[y]),g.useEffect(()=>{S&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(S,"mousemove",f)))},[f]),g.useEffect(()=>{S&&p&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(S,"mouseout",p)))},[p]),g.useEffect(()=>{S&&m&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(S,"mouseover",m)))},[m]),g.useEffect(()=>{S&&w&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(S,"mouseup",w)))},[w]),g.useEffect(()=>{S&&x&&(ee!==null&&google.maps.event.removeListener(ee),q(google.maps.event.addListener(S,"rightclick",x)))},[x]),g.useEffect(()=>{S&&l&&(ae!==null&&google.maps.event.removeListener(ae),Z(google.maps.event.addListener(S,"click",l)))},[l]),g.useEffect(()=>{S&&c&&(ne!==null&&google.maps.event.removeListener(ne),te(google.maps.event.addListener(S,"drag",c)))},[c]),g.useEffect(()=>{S&&C&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(S,"center_changed",C)))},[l]),g.useEffect(()=>{var $=b.current===null?null:new google.maps.Map(b.current,n);return v($),$!==null&&P&&P($),()=>{$!==null&&A&&A($)}},[]),h.jsx("div",{id:o,ref:b,style:r,className:i,children:h.jsx(Ra.Provider,{value:S,children:S!==null?e:null})})}g.memo(Svo);class r0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{map:null}),mo(this,"registeredEvents",[]),mo(this,"mapRef",null),mo(this,"getInstance",()=>this.mapRef===null?null:new google.maps.Map(this.mapRef,this.props.options)),mo(this,"panTo",e=>{var n=this.getInstance();n&&n.panTo(e)}),mo(this,"setMapCallback",()=>{this.state.map!==null&&this.props.onLoad&&this.props.onLoad(this.state.map)}),mo(this,"getRef",e=>{this.mapRef=e})}componentDidMount(){var e=this.getInstance();this.registeredEvents=Va({updaterMap:EEe,eventMap:DEe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{map:e}},this.setMapCallback)}componentDidUpdate(e){this.state.map!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:EEe,eventMap:DEe,prevProps:e,nextProps:this.props,instance:this.state.map}))}componentWillUnmount(){this.state.map!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.map),Za(this.registeredEvents))}render(){return h.jsx("div",{id:this.props.id,ref:this.getRef,style:this.props.mapContainerStyle,className:this.props.mapContainerClassName,children:h.jsx(Ra.Provider,{value:this.state.map,children:this.state.map!==null?this.props.children:null})})}}function kEe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){return void n(c)}l.done?e(s):Promise.resolve(s).then(o,r)}function i0t(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){kEe(i,o,r,a,l,"next",s)}function l(s){kEe(i,o,r,a,l,"throw",s)}a(void 0)})}}function a0t(t){var{googleMapsApiKey:e,googleMapsClientId:n,version:o="weekly",language:r,region:i,libraries:a,channel:l,mapIds:s,authReferrerPolicy:c}=t,u=[];return od(e&&n||!(e&&n),"You need to specify either googleMapsApiKey or googleMapsClientId for @react-google-maps/api load script to work. You cannot use both at the same time."),e?u.push("key=".concat(e)):n&&u.push("client=".concat(n)),o&&u.push("v=".concat(o)),r&&u.push("language=".concat(r)),i&&u.push("region=".concat(i)),a&&a.length&&u.push("libraries=".concat(a.sort().join(","))),l&&u.push("channel=".concat(l)),s&&s.length&&u.push("map_ids=".concat(s.join(","))),c&&u.push("auth_referrer_policy=".concat(c)),u.push("loading=async"),u.push("callback=initMap"),"https://maps.googleapis.com/maps/api/js?".concat(u.join("&"))}var m8=typeof document<"u";function l0t(t){var{url:e,id:n,nonce:o}=t;return m8?new Promise(function(i,a){var l=document.getElementById(n),s=window;if(l){var c=l.getAttribute("data-state");if(l.src===e&&c!=="error"){if(c==="ready")return i(n);var u=s.initMap,d=l.onerror;s.initMap=function(){u&&u(),i(n)},l.onerror=function(p){d&&d(p),a(p)};return}else l.remove()}var f=document.createElement("script");f.type="text/javascript",f.src=e,f.id=n,f.async=!0,f.nonce=o||"",f.onerror=function(m){f.setAttribute("data-state","error"),a(m)},s.initMap=function(){f.setAttribute("data-state","ready"),i(n)},document.head.appendChild(f)}).catch(r=>{throw console.error("injectScript error: ",r),r}):Promise.reject(new Error("document is undefined"))}function FEe(t){var e=t.href;return e&&(e.indexOf("https://fonts.googleapis.com/css?family=Roboto")===0||e.indexOf("https://fonts.googleapis.com/css?family=Google+Sans+Text")===0)?!0:t.tagName.toLowerCase()==="style"&&t.styleSheet&&t.styleSheet.cssText&&t.styleSheet.cssText.replace(`\r +`,fvo=xe.memo(({openCloudFile:t})=>{var v,b,T;const e=H(pn),n=dt(kf),o=H(Xp),r=dt(dTt),i=dt(xCt),a=dt(vCt),l=xe.useRef(null),s=g.useRef(null),c=g.useRef(o.schoolID??yc.UNKNOWN),u=g.useRef(o.classID??$a.UNKNOWN),d=s.current?s.current.clientWidth+40:640,f=s.current?s.current.clientHeight+100:600,[p,m]=g.useState({x:0,y:0}),y=Kt();g.useEffect(()=>{const R=()=>{m({x:Math.max(0,d-window.innerWidth),y:Math.min(0,window.innerHeight-f)})};return window.addEventListener("resize",R),()=>{window.removeEventListener("resize",R)}},[]);const w=(R,M)=>{m({x:Math.max(M.x,d-window.innerWidth),y:Math.min(M.y,window.innerHeight-f)})},x=(R,M)=>{},C=()=>{dt.getState().set(R=>{R.showAccountSettingsPanel=!1})},P=o&&o.email&&o.email.endsWith("intofuture.org"),A=!1,{t:S}=Jl();return h.jsxs(h.Fragment,{children:[i&&h.jsx(ovo,{likesArray:o.likes??[],openCloudFile:t}),a&&h.jsx(svo,{publishedModels:o.published??[],openCloudFile:t}),h.jsx(Vi,{nodeRef:l,handle:".handle",bounds:"parent",axis:"both",position:p,onDrag:w,onStop:x,children:h.jsx(cvo,{ref:l,children:h.jsxs(uvo,{ref:s,children:[h.jsxs(dvo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:S("accountSettingsPanel.MyAccountSettings",y)+(o.anonymous?" ("+S("word.Anonymous",y)+")":"")}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{C()},onTouchStart:()=>{C()},children:S("word.Close",y)})]}),h.jsxs(Qt,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,onClick:()=>{o.uid&&navigator.clipboard.writeText(o.uid).then(()=>d5(S("accountSettingsPanel.IDInClipBoard",y)))},children:h.jsx(oo,{title:S("accountSettingsPanel.ClickToCopyMyID",y),style:{cursor:"copy",borderRadius:"8px"},children:S("accountSettingsPanel.MyID",y)})}),h.jsx(Ge,{style:{paddingTop:"8px"},span:18,children:o.uid})]}),A,h.jsxs(Qt,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{style:{paddingTop:"8px"},span:6,children:S("accountSettingsPanel.SchoolID",y)}),h.jsx(Ge,{span:18,children:h.jsxs(Ko,{style:{width:"90%"},value:c.current,onChange:R=>{c.current=R,e(M=>{M.user.schoolID=R}),dt.getState().set(M=>{M.saveAccountSettingsFlag=!0})},children:[h.jsx(lh,{value:yc.UNKNOWN,children:yc.UNKNOWN},yc.UNKNOWN),h.jsx(lh,{value:yc.SCHOOL1,children:yc.SCHOOL1},yc.SCHOOL1),h.jsx(lh,{value:yc.SCHOOL2,children:yc.SCHOOL2},yc.SCHOOL2),h.jsx(lh,{value:yc.SCHOOL3,children:yc.SCHOOL3},yc.SCHOOL3),h.jsx(lh,{value:yc.SCHOOL4,children:yc.SCHOOL4},yc.SCHOOL4),h.jsx(lh,{value:yc.SCHOOL5,children:yc.SCHOOL5},yc.SCHOOL5)]})})]}),h.jsxs(Qt,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{style:{paddingTop:"8px"},span:6,children:S("accountSettingsPanel.ClassID",y)}),h.jsx(Ge,{span:18,children:h.jsxs(Ko,{style:{width:"90%"},value:u.current,onChange:R=>{u.current=R,e(M=>{M.user.classID=R}),dt.getState().set(M=>{M.saveAccountSettingsFlag=!0})},children:[h.jsx(lh,{value:$a.UNKNOWN,children:$a.UNKNOWN},$a.UNKNOWN),h.jsx(lh,{value:$a.CLASS1,children:$a.CLASS1},$a.CLASS1),h.jsx(lh,{value:$a.CLASS2,children:$a.CLASS2},$a.CLASS2),h.jsx(lh,{value:$a.CLASS3,children:$a.CLASS3},$a.CLASS3),h.jsx(lh,{value:$a.CLASS4,children:$a.CLASS4},$a.CLASS4),h.jsx(lh,{value:$a.CLASS5,children:$a.CLASS5},$a.CLASS5),h.jsx(lh,{value:$a.CLASS6,children:$a.CLASS6},$a.CLASS6),h.jsx(lh,{value:$a.CLASS7,children:$a.CLASS7},$a.CLASS7),h.jsx(lh,{value:$a.CLASS8,children:$a.CLASS8},$a.CLASS8),h.jsx(lh,{value:$a.CLASS9,children:$a.CLASS9},$a.CLASS9)]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,children:S("accountSettingsPanel.AllPublished",y)}),h.jsx(Ge,{span:18,children:h.jsx("span",{style:{cursor:"pointer"},onClick:()=>{n("showPublishedModelsPanel",!0)},children:((v=o.published)==null?void 0:v.length)??0})})]}),h.jsxs(Qt,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,children:S("accountSettingsPanel.PublishedUnderAliases",y)}),h.jsx(Ge,{span:18,children:h.jsx("span",{style:{fontSize:"10px"},children:(b=o.aliases)==null?void 0:b.map((R,M)=>o.aliases?R+(M{n("showLikesPanel",!0)},children:((T=o.likes)==null?void 0:T.length)??0})})]}),P&&h.jsxs(Qt,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ge,{span:6,children:S("accountSettingsPanel.UserCount",y)}),h.jsx(Ge,{span:18,children:r})]})]})})})]})});function gW(t){"@babel/helpers - typeof";return gW=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gW(t)}function hvo(t,e){if(gW(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(gW(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pvo(t){var e=hvo(t,"string");return gW(e)=="symbol"?e:e+""}function mo(t,e,n){return(e=pvo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o0t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _ce,zEe;function gvo(){if(zEe)return _ce;zEe=1;var t=function(n,o,r,i,a,l,s,c){if(!n){var u;if(o===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[r,i,a,l,s,c],f=0;u=new Error(o.replace(/%s/g,function(){return d[f++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};return _ce=t,_ce}var mvo=gvo(),od=o0t(mvo),Ra=g.createContext(null);function yvo(){od(!!g.useContext,"useGoogleMap is React hook and requires React version 16.8+");var t=g.useContext(Ra);return od(!!t,"useGoogleMap needs a GoogleMap available up in the tree"),t}function Avo(t,e,n){return Object.keys(t).reduce(function(r,i){return e(r,t[i],i)},n)}function wvo(t,e){Object.keys(t).forEach(n=>e(t[n],n))}function xvo(t,e,n,o){var r={},i=(a,l)=>{var s=n[l];s!==e[l]&&(r[l]=s,a(o,s))};return wvo(t,i),r}function vvo(t,e,n){var o=Avo(n,function(i,a,l){return typeof t[l]=="function"&&i.push(google.maps.event.addListener(e,a,t[l])),i},[]);return o}function bvo(t){google.maps.event.removeListener(t)}function Za(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];t.forEach(bvo)}function Va(t){var{updaterMap:e,eventMap:n,prevProps:o,nextProps:r,instance:i}=t,a=vvo(r,i,n);return xvo(e,o,r,i),a}var DEe={onDblClick:"dblclick",onDragEnd:"dragend",onDragStart:"dragstart",onMapTypeIdChanged:"maptypeid_changed",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseDown:"mousedown",onMouseUp:"mouseup",onRightClick:"rightclick",onTilesLoaded:"tilesloaded",onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onDrag:"drag",onHeadingChanged:"heading_changed",onIdle:"idle",onProjectionChanged:"projection_changed",onResize:"resize",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed"},EEe={extraMapTypes(t,e){e.forEach(function(o,r){t.mapTypes.set(String(r),o)})},center(t,e){t.setCenter(e)},clickableIcons(t,e){t.setClickableIcons(e)},heading(t,e){t.setHeading(e)},mapTypeId(t,e){t.setMapTypeId(e)},options(t,e){t.setOptions(e)},streetView(t,e){t.setStreetView(e)},tilt(t,e){t.setTilt(e)},zoom(t,e){t.setZoom(e)}};function Svo(t){var{children:e,options:n,id:o,mapContainerStyle:r,mapContainerClassName:i,center:a,onClick:l,onDblClick:s,onDrag:c,onDragEnd:u,onDragStart:d,onMouseMove:f,onMouseOut:p,onMouseOver:m,onMouseDown:y,onMouseUp:w,onRightClick:x,onCenterChanged:C,onLoad:P,onUnmount:A}=t,[S,v]=g.useState(null),b=g.useRef(null),[T,R]=g.useState(null),[M,D]=g.useState(null),[k,N]=g.useState(null),[U,W]=g.useState(null),[F,E]=g.useState(null),[L,j]=g.useState(null),[Y,O]=g.useState(null),[_,G]=g.useState(null),[Q,oe]=g.useState(null),[ee,$]=g.useState(null),[ae,Z]=g.useState(null),[ne,te]=g.useState(null);return g.useEffect(()=>{n&&S!==null&&S.setOptions(n)},[S,n]),g.useEffect(()=>{S!==null&&typeof a<"u"&&S.setCenter(a)},[S,a]),g.useEffect(()=>{S&&s&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(S,"dblclick",s)))},[s]),g.useEffect(()=>{S&&u&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(S,"dragend",u)))},[u]),g.useEffect(()=>{S&&d&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(S,"dragstart",d)))},[d]),g.useEffect(()=>{S&&y&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(S,"mousedown",y)))},[y]),g.useEffect(()=>{S&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(S,"mousemove",f)))},[f]),g.useEffect(()=>{S&&p&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(S,"mouseout",p)))},[p]),g.useEffect(()=>{S&&m&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(S,"mouseover",m)))},[m]),g.useEffect(()=>{S&&w&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(S,"mouseup",w)))},[w]),g.useEffect(()=>{S&&x&&(ee!==null&&google.maps.event.removeListener(ee),$(google.maps.event.addListener(S,"rightclick",x)))},[x]),g.useEffect(()=>{S&&l&&(ae!==null&&google.maps.event.removeListener(ae),Z(google.maps.event.addListener(S,"click",l)))},[l]),g.useEffect(()=>{S&&c&&(ne!==null&&google.maps.event.removeListener(ne),te(google.maps.event.addListener(S,"drag",c)))},[c]),g.useEffect(()=>{S&&C&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(S,"center_changed",C)))},[l]),g.useEffect(()=>{var q=b.current===null?null:new google.maps.Map(b.current,n);return v(q),q!==null&&P&&P(q),()=>{q!==null&&A&&A(q)}},[]),h.jsx("div",{id:o,ref:b,style:r,className:i,children:h.jsx(Ra.Provider,{value:S,children:S!==null?e:null})})}g.memo(Svo);class r0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{map:null}),mo(this,"registeredEvents",[]),mo(this,"mapRef",null),mo(this,"getInstance",()=>this.mapRef===null?null:new google.maps.Map(this.mapRef,this.props.options)),mo(this,"panTo",e=>{var n=this.getInstance();n&&n.panTo(e)}),mo(this,"setMapCallback",()=>{this.state.map!==null&&this.props.onLoad&&this.props.onLoad(this.state.map)}),mo(this,"getRef",e=>{this.mapRef=e})}componentDidMount(){var e=this.getInstance();this.registeredEvents=Va({updaterMap:EEe,eventMap:DEe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{map:e}},this.setMapCallback)}componentDidUpdate(e){this.state.map!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:EEe,eventMap:DEe,prevProps:e,nextProps:this.props,instance:this.state.map}))}componentWillUnmount(){this.state.map!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.map),Za(this.registeredEvents))}render(){return h.jsx("div",{id:this.props.id,ref:this.getRef,style:this.props.mapContainerStyle,className:this.props.mapContainerClassName,children:h.jsx(Ra.Provider,{value:this.state.map,children:this.state.map!==null?this.props.children:null})})}}function kEe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){return void n(c)}l.done?e(s):Promise.resolve(s).then(o,r)}function i0t(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){kEe(i,o,r,a,l,"next",s)}function l(s){kEe(i,o,r,a,l,"throw",s)}a(void 0)})}}function a0t(t){var{googleMapsApiKey:e,googleMapsClientId:n,version:o="weekly",language:r,region:i,libraries:a,channel:l,mapIds:s,authReferrerPolicy:c}=t,u=[];return od(e&&n||!(e&&n),"You need to specify either googleMapsApiKey or googleMapsClientId for @react-google-maps/api load script to work. You cannot use both at the same time."),e?u.push("key=".concat(e)):n&&u.push("client=".concat(n)),o&&u.push("v=".concat(o)),r&&u.push("language=".concat(r)),i&&u.push("region=".concat(i)),a&&a.length&&u.push("libraries=".concat(a.sort().join(","))),l&&u.push("channel=".concat(l)),s&&s.length&&u.push("map_ids=".concat(s.join(","))),c&&u.push("auth_referrer_policy=".concat(c)),u.push("loading=async"),u.push("callback=initMap"),"https://maps.googleapis.com/maps/api/js?".concat(u.join("&"))}var m8=typeof document<"u";function l0t(t){var{url:e,id:n,nonce:o}=t;return m8?new Promise(function(i,a){var l=document.getElementById(n),s=window;if(l){var c=l.getAttribute("data-state");if(l.src===e&&c!=="error"){if(c==="ready")return i(n);var u=s.initMap,d=l.onerror;s.initMap=function(){u&&u(),i(n)},l.onerror=function(p){d&&d(p),a(p)};return}else l.remove()}var f=document.createElement("script");f.type="text/javascript",f.src=e,f.id=n,f.async=!0,f.nonce=o||"",f.onerror=function(m){f.setAttribute("data-state","error"),a(m)},s.initMap=function(){f.setAttribute("data-state","ready"),i(n)},document.head.appendChild(f)}).catch(r=>{throw console.error("injectScript error: ",r),r}):Promise.reject(new Error("document is undefined"))}function FEe(t){var e=t.href;return e&&(e.indexOf("https://fonts.googleapis.com/css?family=Roboto")===0||e.indexOf("https://fonts.googleapis.com/css?family=Google+Sans+Text")===0)?!0:t.tagName.toLowerCase()==="style"&&t.styleSheet&&t.styleSheet.cssText&&t.styleSheet.cssText.replace(`\r `,"").indexOf(".gm-style")===0?(t.styleSheet.cssText="",!0):t.tagName.toLowerCase()==="style"&&t.innerHTML&&t.innerHTML.replace(`\r `,"").indexOf(".gm-style")===0?(t.innerHTML="",!0):t.tagName.toLowerCase()==="style"&&!t.styleSheet&&!t.innerHTML}function E4e(){var t=document.getElementsByTagName("head")[0];if(t){var e=t.insertBefore.bind(t);t.insertBefore=function(r,i){return FEe(r)||Reflect.apply(e,t,[r,i]),r};var n=t.appendChild.bind(t);t.appendChild=function(r){return FEe(r)||Reflect.apply(n,t,[r]),r}}}var wE=!1;function s0t(){return h.jsx("div",{children:"Loading..."})}var mW={id:"script-loader",version:"weekly"};class Tvo extends g.PureComponent{constructor(){super(...arguments),mo(this,"check",g.createRef()),mo(this,"state",{loaded:!1}),mo(this,"cleanupCallback",()=>{delete window.google.maps,this.injectScript()}),mo(this,"isCleaningUp",i0t(function*(){function e(n){if(!wE)n();else if(m8)var o=window.setInterval(function(){wE||(window.clearInterval(o),n())},1)}return new Promise(e)})),mo(this,"cleanup",()=>{wE=!0;var e=document.getElementById(this.props.id);e&&e.parentNode&&e.parentNode.removeChild(e),Array.prototype.slice.call(document.getElementsByTagName("script")).filter(function(o){return typeof o.src=="string"&&o.src.includes("maps.googleapis")}).forEach(function(o){o.parentNode&&o.parentNode.removeChild(o)}),Array.prototype.slice.call(document.getElementsByTagName("link")).filter(function(o){return o.href==="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Google+Sans"}).forEach(function(o){o.parentNode&&o.parentNode.removeChild(o)}),Array.prototype.slice.call(document.getElementsByTagName("style")).filter(function(o){return o.innerText!==void 0&&o.innerText.length>0&&o.innerText.includes(".gm-")}).forEach(function(o){o.parentNode&&o.parentNode.removeChild(o)})}),mo(this,"injectScript",()=>{this.props.preventGoogleFontsLoading&&E4e(),od(!!this.props.id,'LoadScript requires "id" prop to be a string: %s',this.props.id);var e={id:this.props.id,nonce:this.props.nonce,url:a0t(this.props)};l0t(e).then(()=>{this.props.onLoad&&this.props.onLoad(),this.setState(function(){return{loaded:!0}})}).catch(n=>{this.props.onError&&this.props.onError(n),console.error(` There has been an Error with loading Google Maps API script, please check that you provided correct google API key (`.concat(this.props.googleMapsApiKey||"-",") or Client ID (").concat(this.props.googleMapsClientId||"-",`) to @@ -7214,7 +7214,7 @@ Content-Type: `+c.contentType+`\r `))})})}componentDidMount(){if(m8){if(window.google&&window.google.maps&&!wE){console.error("google api is already presented");return}this.isCleaningUp().then(this.injectScript).catch(function(n){console.error("Error at injecting script after cleaning up: ",n)})}}componentDidUpdate(e){this.props.libraries!==e.libraries&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),m8&&e.language!==this.props.language&&(this.cleanup(),this.setState(function(){return{loaded:!1}},this.cleanupCallback))}componentWillUnmount(){if(m8){this.cleanup();var e=()=>{this.check.current||(delete window.google,wE=!1)};window.setTimeout(e,1),this.props.onUnmount&&this.props.onUnmount()}}render(){return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:this.check}),this.state.loaded?this.props.children:this.props.loadingElement||h.jsx(s0t,{})]})}}mo(Tvo,"defaultProps",mW);function Pvo(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.includes(o))continue;n[o]=t[o]}return n}function k4e(t,e){if(t==null)return{};var n,o,r=Pvo(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o{p.current=!1}},[]),g.useEffect(function(){m8&&c&&E4e()},[c]),g.useEffect(function(){m&&od(!!window.google,"useLoadScript was marked as loaded, but window.google is not present. Something went wrong.")},[m]);var C=a0t({version:n,googleMapsApiKey:r,googleMapsClientId:i,language:a,region:l,libraries:s,channel:u,mapIds:d,authReferrerPolicy:f});g.useEffect(function(){if(!m8)return;function S(){p.current&&(y(!0),LEe=C)}if(window.google&&window.google.maps&&LEe===C){S();return}l0t({id:e,url:C,nonce:o}).then(S).catch(function(b){p.current&&x(b),console.warn(` There has been an Error with loading Google Maps API script, please check that you provided correct google API key (`.concat(r||"-",") or Client ID (").concat(i||"-",`) Otherwise it is a Network issue. - `)),console.error(b)})},[e,C,o]);var P=g.useRef();return g.useEffect(function(){P.current&&s!==P.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),P.current=s},[s]),{isLoaded:m,loadError:w,url:C}}var Rvo=["loadingElement","onLoad","onError","onUnmount","children"],Hvo=h.jsx(s0t,{});function Mvo(t){var{loadingElement:e,onLoad:n,onError:o,onUnmount:r,children:i}=t,a=k4e(t,Rvo),{isLoaded:l,loadError:s}=Cvo(a);return g.useEffect(function(){l&&typeof n=="function"&&n()},[l,n]),g.useEffect(function(){s&&typeof o=="function"&&o(s)},[s,o]),g.useEffect(function(){return()=>{r&&r()}},[r]),l?i:e||Hvo}g.memo(Mvo);function Ivo(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,[])).next())})}function zvo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Dvo=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n},Evo=zvo(Dvo),WEe="__googleMapsScriptId",gR;(function(t){t[t.INITIALIZED=0]="INITIALIZED",t[t.LOADING=1]="LOADING",t[t.SUCCESS=2]="SUCCESS",t[t.FAILURE=3]="FAILURE"})(gR||(gR={}));class Rv{constructor(e){var{apiKey:n,authReferrerPolicy:o,channel:r,client:i,id:a=WEe,language:l,libraries:s=[],mapIds:c,nonce:u,region:d,retries:f=3,url:p="https://maps.googleapis.com/maps/api/js",version:m}=e;if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=n,this.authReferrerPolicy=o,this.channel=r,this.client=i,this.id=a||WEe,this.language=l,this.libraries=s,this.mapIds=c,this.nonce=u,this.region=d,this.retries=f,this.url=p,this.version=m,Rv.instance){if(!Evo(this.options,Rv.instance.options))throw new Error("Loader must not be called again with different options. ".concat(JSON.stringify(this.options)," !== ").concat(JSON.stringify(Rv.instance.options)));return Rv.instance}Rv.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?gR.FAILURE:this.done?gR.SUCCESS:this.loading?gR.LOADING:gR.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){var e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+="&key=".concat(this.apiKey)),this.channel&&(e+="&channel=".concat(this.channel)),this.client&&(e+="&client=".concat(this.client)),this.libraries.length>0&&(e+="&libraries=".concat(this.libraries.join(","))),this.language&&(e+="&language=".concat(this.language)),this.region&&(e+="®ion=".concat(this.region)),this.version&&(e+="&v=".concat(this.version)),this.mapIds&&(e+="&map_ids=".concat(this.mapIds.join(","))),this.authReferrerPolicy&&(e+="&auth_referrer_policy=".concat(this.authReferrerPolicy)),e}deleteScript(){var e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,n)=>{this.loadCallback(o=>{o?n(o.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,n;if(document.getElementById(this.id)){this.callback();return}var o={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(o).forEach(i=>!o[i]&&delete o[i]),!((n=(e=window==null?void 0:window.google)===null||e===void 0?void 0:e.maps)===null||n===void 0)&&n.importLibrary||(i=>{var a,l,s,c="The Google Maps JavaScript API",u="google",d="importLibrary",f="__ib__",p=document,m=window;m=m[u]||(m[u]={});var y=m.maps||(m.maps={}),w=new Set,x=new URLSearchParams,C=()=>a||(a=new Promise((P,A)=>Ivo(this,void 0,void 0,function*(){var S;yield l=p.createElement("script"),l.id=this.id,x.set("libraries",[...w]+"");for(s in i)x.set(s.replace(/[A-Z]/g,v=>"_"+v[0].toLowerCase()),i[s]);x.set("callback",u+".maps."+f),l.src=this.url+"?"+x,y[f]=P,l.onerror=()=>a=A(Error(c+" could not load.")),l.nonce=this.nonce||((S=p.querySelector("script[nonce]"))===null||S===void 0?void 0:S.nonce)||"",p.head.append(l)})));y[d]?console.warn(c+" only loads once. Ignoring:",i):y[d]=function(P){for(var A=arguments.length,S=new Array(A>1?A-1:0),v=1;vy[d](P,...S))}})(o);var r=this.libraries.map(i=>this.importLibrary(i));r.length||r.push(this.importLibrary("core")),Promise.all(r).then(()=>this.callback(),i=>{var a=new ErrorEvent("error",{error:i});this.loadErrorCallback(a)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){var n=this.errors.length*Math.pow(2,this.errors.length);console.error("Failed to load Google Maps script, retrying in ".concat(n," ms.")),setTimeout(()=>{this.deleteScript(),this.setScript()},n)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading=!0,this.setScript()}}}var kvo=["maps"];function c0t(t){var{id:e=mW.id,version:n=mW.version,nonce:o,googleMapsApiKey:r,language:i,region:a,libraries:l=kvo,preventGoogleFontsLoading:s,mapIds:c,authReferrerPolicy:u}=t,d=g.useRef(!1),[f,p]=g.useState(!1),[m,y]=g.useState(void 0);g.useEffect(function(){return d.current=!0,()=>{d.current=!1}},[]);var w=g.useMemo(()=>new Rv({id:e,apiKey:r,version:n,libraries:l,language:i||"en",region:a||"US",mapIds:c||[],nonce:o||"",authReferrerPolicy:u||"origin"}),[e,r,n,l,i,a,c,o,u]);g.useEffect(function(){f||w.load().then(()=>{d.current&&p(!0)}).catch(P=>{y(P)})},[]),g.useEffect(()=>{m8&&s&&E4e()},[s]);var x=g.useRef();return g.useEffect(()=>{x.current&&l!==x.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),x.current=l},[l]),{isLoaded:f,loadError:m}}function NEe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function MK(t){for(var e=1;e{i!==null&&i.setMap(r)},[r]),g.useEffect(()=>{e&&i!==null&&i.setOptions(e)},[i,e]),g.useEffect(()=>{var l=new google.maps.TrafficLayer(MK(MK({},e),{},{map:r}));return a(l),n&&n(l),()=>{i!==null&&(o&&o(i),i.setMap(null))}},[]),null}g.memo(Fvo);class Lvo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{trafficLayer:null}),mo(this,"setTrafficLayerCallback",()=>{this.state.trafficLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.trafficLayer)}),mo(this,"registeredEvents",[])}componentDidMount(){var e=new google.maps.TrafficLayer(MK(MK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:jEe,eventMap:UEe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{trafficLayer:e}},this.setTrafficLayerCallback)}componentDidUpdate(e){this.state.trafficLayer!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:jEe,eventMap:UEe,prevProps:e,nextProps:this.props,instance:this.state.trafficLayer}))}componentWillUnmount(){this.state.trafficLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.trafficLayer),Za(this.registeredEvents),this.state.trafficLayer.setMap(null))}render(){return null}}mo(Lvo,"contextType",Ra);function Wvo(t){var{onLoad:e,onUnmount:n}=t,o=g.useContext(Ra),[r,i]=g.useState(null);return g.useEffect(()=>{r!==null&&r.setMap(o)},[o]),g.useEffect(()=>{var a=new google.maps.BicyclingLayer;return i(a),a.setMap(o),e&&e(a),()=>{a!==null&&(n&&n(a),a.setMap(null))}},[]),null}g.memo(Wvo);class Nvo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{bicyclingLayer:null}),mo(this,"setBicyclingLayerCallback",()=>{this.state.bicyclingLayer!==null&&(this.state.bicyclingLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.bicyclingLayer))})}componentDidMount(){var e=new google.maps.BicyclingLayer;this.setState(()=>({bicyclingLayer:e}),this.setBicyclingLayerCallback)}componentWillUnmount(){this.state.bicyclingLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.bicyclingLayer),this.state.bicyclingLayer.setMap(null))}render(){return null}}mo(Nvo,"contextType",Ra);function Uvo(t){var{onLoad:e,onUnmount:n}=t,o=g.useContext(Ra),[r,i]=g.useState(null);return g.useEffect(()=>{r!==null&&r.setMap(o)},[o]),g.useEffect(()=>{var a=new google.maps.TransitLayer;return i(a),a.setMap(o),e&&e(a),()=>{r!==null&&(n&&n(r),r.setMap(null))}},[]),null}g.memo(Uvo);class jvo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{transitLayer:null}),mo(this,"setTransitLayerCallback",()=>{this.state.transitLayer!==null&&(this.state.transitLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.transitLayer))})}componentDidMount(){var e=new google.maps.TransitLayer;this.setState(function(){return{transitLayer:e}},this.setTransitLayerCallback)}componentWillUnmount(){this.state.transitLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.transitLayer),this.state.transitLayer.setMap(null))}render(){return null}}mo(jvo,"contextType",Ra);function BEe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function IK(t){for(var e=1;e{f!==null&&f.setMap(d)},[d]),g.useEffect(()=>{e&&f!==null&&f.setOptions(e)},[f,e]),g.useEffect(()=>{f!==null&&f.setDrawingMode(n??null)},[f,n]),g.useEffect(()=>{f&&o&&(m!==null&&google.maps.event.removeListener(m),y(google.maps.event.addListener(f,"circlecomplete",o)))},[f,o]),g.useEffect(()=>{f&&r&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(f,"markercomplete",r)))},[f,r]),g.useEffect(()=>{f&&i&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(f,"overlaycomplete",i)))},[f,i]),g.useEffect(()=>{f&&a&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(f,"polygoncomplete",a)))},[f,a]),g.useEffect(()=>{f&&l&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(f,"polylinecomplete",l)))},[f,l]),g.useEffect(()=>{f&&s&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(f,"rectanglecomplete",s)))},[f,s]),g.useEffect(()=>{od(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing);var M=new google.maps.drawing.DrawingManager(IK(IK({},e),{},{map:d}));return n&&M.setDrawingMode(n),o&&y(google.maps.event.addListener(M,"circlecomplete",o)),r&&x(google.maps.event.addListener(M,"markercomplete",r)),i&&P(google.maps.event.addListener(M,"overlaycomplete",i)),a&&S(google.maps.event.addListener(M,"polygoncomplete",a)),l&&b(google.maps.event.addListener(M,"polylinecomplete",l)),s&&R(google.maps.event.addListener(M,"rectanglecomplete",s)),p(M),c&&c(M),()=>{f!==null&&(m&&google.maps.event.removeListener(m),w&&google.maps.event.removeListener(w),C&&google.maps.event.removeListener(C),A&&google.maps.event.removeListener(A),v&&google.maps.event.removeListener(v),T&&google.maps.event.removeListener(T),u&&u(f),f.setMap(null))}},[]),null}g.memo(Bvo);class Yvo extends g.PureComponent{constructor(e){super(e),mo(this,"registeredEvents",[]),mo(this,"state",{drawingManager:null}),mo(this,"setDrawingManagerCallback",()=>{this.state.drawingManager!==null&&this.props.onLoad&&this.props.onLoad(this.state.drawingManager)}),od(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing)}componentDidMount(){var e=new google.maps.drawing.DrawingManager(IK(IK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:OEe,eventMap:YEe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{drawingManager:e}},this.setDrawingManagerCallback)}componentDidUpdate(e){this.state.drawingManager!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:OEe,eventMap:YEe,prevProps:e,nextProps:this.props,instance:this.state.drawingManager}))}componentWillUnmount(){this.state.drawingManager!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.drawingManager),Za(this.registeredEvents),this.state.drawingManager.setMap(null))}render(){return null}}mo(Yvo,"contextType",Ra);function _Ee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function BR(t){for(var e=1;e{oe!==null&&oe.setMap(Q)},[Q]),g.useEffect(()=>{typeof n<"u"&&oe!==null&&oe.setOptions(n)},[oe,n]),g.useEffect(()=>{typeof a<"u"&&oe!==null&&oe.setDraggable(a)},[oe,a]),g.useEffect(()=>{e&&oe!==null&&oe.setPosition(e)},[oe,e]),g.useEffect(()=>{typeof l<"u"&&oe!==null&&oe.setVisible(l)},[oe,l]),g.useEffect(()=>{oe==null||oe.setAnimation(s)},[oe,s]),g.useEffect(()=>{oe&&c!==void 0&&oe.setClickable(c)},[oe,c]),g.useEffect(()=>{oe&&u!==void 0&&oe.setCursor(u)},[oe,u]),g.useEffect(()=>{oe&&d!==void 0&&oe.setIcon(d)},[oe,d]),g.useEffect(()=>{oe&&f!==void 0&&oe.setLabel(f)},[oe,f]),g.useEffect(()=>{oe&&p!==void 0&&oe.setOpacity(p)},[oe,p]),g.useEffect(()=>{oe&&m!==void 0&&oe.setShape(m)},[oe,m]),g.useEffect(()=>{oe&&y!==void 0&&oe.setTitle(y)},[oe,y]),g.useEffect(()=>{oe&&w!==void 0&&oe.setZIndex(w)},[oe,w]),g.useEffect(()=>{oe&&C&&(q!==null&&google.maps.event.removeListener(q),ae(google.maps.event.addListener(oe,"dblclick",C)))},[C]),g.useEffect(()=>{oe&&A&&(Z!==null&&google.maps.event.removeListener(Z),ne(google.maps.event.addListener(oe,"dragend",A)))},[A]),g.useEffect(()=>{oe&&S&&(te!==null&&google.maps.event.removeListener(te),$(google.maps.event.addListener(oe,"dragstart",S)))},[S]),g.useEffect(()=>{oe&&R&&(le!==null&&google.maps.event.removeListener(le),de(google.maps.event.addListener(oe,"mousedown",R)))},[R]),g.useEffect(()=>{oe&&v&&(he!==null&&google.maps.event.removeListener(he),me(google.maps.event.addListener(oe,"mouseout",v)))},[v]),g.useEffect(()=>{oe&&b&&(ce!==null&&google.maps.event.removeListener(ce),Pe(google.maps.event.addListener(oe,"mouseover",b)))},[b]),g.useEffect(()=>{oe&&T&&(pe!==null&&google.maps.event.removeListener(pe),Ie(google.maps.event.addListener(oe,"mouseup",T)))},[T]),g.useEffect(()=>{oe&&M&&(ve!==null&&google.maps.event.removeListener(ve),ze(google.maps.event.addListener(oe,"rightclick",M)))},[M]),g.useEffect(()=>{oe&&x&&(Ae!==null&&google.maps.event.removeListener(Ae),se(google.maps.event.addListener(oe,"click",x)))},[x]),g.useEffect(()=>{oe&&P&&(ge!==null&&google.maps.event.removeListener(ge),we(google.maps.event.addListener(oe,"drag",P)))},[P]),g.useEffect(()=>{oe&&D&&(Se!==null&&google.maps.event.removeListener(Se),Me(google.maps.event.addListener(oe,"clickable_changed",D)))},[D]),g.useEffect(()=>{oe&&k&&(Ce!==null&&google.maps.event.removeListener(Ce),Te(google.maps.event.addListener(oe,"cursor_changed",k)))},[k]),g.useEffect(()=>{oe&&N&&(Re!==null&&google.maps.event.removeListener(Re),Ne(google.maps.event.addListener(oe,"animation_changed",N)))},[N]),g.useEffect(()=>{oe&&U&&(_e!==null&&google.maps.event.removeListener(_e),Ue(google.maps.event.addListener(oe,"draggable_changed",U)))},[U]),g.useEffect(()=>{oe&&W&&(qe!==null&&google.maps.event.removeListener(qe),Fe(google.maps.event.addListener(oe,"flat_changed",W)))},[W]),g.useEffect(()=>{oe&&F&&(He!==null&&google.maps.event.removeListener(He),Le(google.maps.event.addListener(oe,"icon_changed",F)))},[F]),g.useEffect(()=>{oe&&E&&(Ye!==null&&google.maps.event.removeListener(Ye),lt(google.maps.event.addListener(oe,"position_changed",E)))},[E]),g.useEffect(()=>{oe&&L&&(Oe!==null&&google.maps.event.removeListener(Oe),ut(google.maps.event.addListener(oe,"shape_changed",L)))},[L]),g.useEffect(()=>{oe&&j&&(ht!==null&&google.maps.event.removeListener(ht),Qe(google.maps.event.addListener(oe,"title_changed",j)))},[j]),g.useEffect(()=>{oe&&Y&&(nt!==null&&google.maps.event.removeListener(nt),mt(google.maps.event.addListener(oe,"visible_changed",Y)))},[Y]),g.useEffect(()=>{oe&&O&&(tt!==null&&google.maps.event.removeListener(tt),gt(google.maps.event.addListener(oe,"zindex_changed",O)))},[O]),g.useEffect(()=>{var je=BR(BR(BR({},n||zK),o?zK:{map:Q}),{},{position:e}),et=new google.maps.Marker(je);return o?o.addMarker(et,!!r):et.setMap(Q),e&&et.setPosition(e),typeof l<"u"&&et.setVisible(l),typeof a<"u"&&et.setDraggable(a),typeof c<"u"&&et.setClickable(c),typeof u=="string"&&et.setCursor(u),d&&et.setIcon(d),typeof f<"u"&&et.setLabel(f),typeof p<"u"&&et.setOpacity(p),m&&et.setShape(m),typeof y=="string"&&et.setTitle(y),typeof w=="number"&&et.setZIndex(w),C&&ae(google.maps.event.addListener(et,"dblclick",C)),A&&ne(google.maps.event.addListener(et,"dragend",A)),S&&$(google.maps.event.addListener(et,"dragstart",S)),R&&de(google.maps.event.addListener(et,"mousedown",R)),v&&me(google.maps.event.addListener(et,"mouseout",v)),b&&Pe(google.maps.event.addListener(et,"mouseover",b)),T&&Ie(google.maps.event.addListener(et,"mouseup",T)),M&&ze(google.maps.event.addListener(et,"rightclick",M)),x&&se(google.maps.event.addListener(et,"click",x)),P&&we(google.maps.event.addListener(et,"drag",P)),D&&Me(google.maps.event.addListener(et,"clickable_changed",D)),k&&Te(google.maps.event.addListener(et,"cursor_changed",k)),N&&Ne(google.maps.event.addListener(et,"animation_changed",N)),U&&Ue(google.maps.event.addListener(et,"draggable_changed",U)),W&&Fe(google.maps.event.addListener(et,"flat_changed",W)),F&&Le(google.maps.event.addListener(et,"icon_changed",F)),E&<(google.maps.event.addListener(et,"position_changed",E)),L&&ut(google.maps.event.addListener(et,"shape_changed",L)),j&&Qe(google.maps.event.addListener(et,"title_changed",j)),Y&&mt(google.maps.event.addListener(et,"visible_changed",Y)),O&>(google.maps.event.addListener(et,"zindex_changed",O)),ee(et),_&&_(et),()=>{q!==null&&google.maps.event.removeListener(q),Z!==null&&google.maps.event.removeListener(Z),te!==null&&google.maps.event.removeListener(te),le!==null&&google.maps.event.removeListener(le),he!==null&&google.maps.event.removeListener(he),ce!==null&&google.maps.event.removeListener(ce),pe!==null&&google.maps.event.removeListener(pe),ve!==null&&google.maps.event.removeListener(ve),Ae!==null&&google.maps.event.removeListener(Ae),Se!==null&&google.maps.event.removeListener(Se),Ce!==null&&google.maps.event.removeListener(Ce),Re!==null&&google.maps.event.removeListener(Re),_e!==null&&google.maps.event.removeListener(_e),qe!==null&&google.maps.event.removeListener(qe),He!==null&&google.maps.event.removeListener(He),Ye!==null&&google.maps.event.removeListener(Ye),ht!==null&&google.maps.event.removeListener(ht),nt!==null&&google.maps.event.removeListener(nt),tt!==null&&google.maps.event.removeListener(tt),G&&G(et),o?o.removeMarker(et,!!r):et&&et.setMap(null)}},[]);var Ve=g.useMemo(()=>i?g.Children.map(i,je=>{if(!g.isValidElement(je))return je;var et=je;return g.cloneElement(et,{anchor:oe})}):null,[i,oe]);return h.jsx(h.Fragment,{children:Ve})||null}g.memo(Ovo);class Y1e extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[])}componentDidMount(){var e=this;return i0t(function*(){var n=BR(BR(BR({},e.props.options||zK),e.props.clusterer?zK:{map:e.context}),{},{position:e.props.position});e.marker=new google.maps.Marker(n),e.props.clusterer?e.props.clusterer.addMarker(e.marker,!!e.props.noClustererRedraw):e.marker.setMap(e.context),e.registeredEvents=Va({updaterMap:GEe,eventMap:VEe,prevProps:{},nextProps:e.props,instance:e.marker}),e.props.onLoad&&e.props.onLoad(e.marker)})()}componentDidUpdate(e){this.marker&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:GEe,eventMap:VEe,prevProps:e,nextProps:this.props,instance:this.marker}))}componentWillUnmount(){this.marker&&(this.props.onUnmount&&this.props.onUnmount(this.marker),Za(this.registeredEvents),this.props.clusterer?this.props.clusterer.removeMarker(this.marker,!!this.props.noClustererRedraw):this.marker&&this.marker.setMap(null))}render(){var e=this.props.children?g.Children.map(this.props.children,n=>{if(!g.isValidElement(n))return n;var o=n;return g.cloneElement(o,{anchor:this.marker})}):null;return e||null}}mo(Y1e,"contextType",Ra);var _vo=function(){function t(e,n){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=n,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(e.getMap()),this.onBoundsChanged=this.onBoundsChanged.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onClick=this.onClick.bind(this),this.onMouseOver=this.onMouseOver.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onAdd=this.onAdd.bind(this),this.onRemove=this.onRemove.bind(this),this.draw=this.draw.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.useStyle=this.useStyle.bind(this),this.setCenter=this.setCenter.bind(this),this.getPosFromLatLng=this.getPosFromLatLng.bind(this)}return t.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},t.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},t.prototype.onClick=function(e){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var n=this.cluster.getClusterer();if(google.maps.event.trigger(n,"click",this.cluster),google.maps.event.trigger(n,"clusterclick",this.cluster),n.getZoomOnClick()){var o=n.getMaxZoom(),r=this.cluster.getBounds(),i=n.getMap();i!==null&&"fitBounds"in i&&i.fitBounds(r),this.timeOut=window.setTimeout(function(){var a=n.getMap();if(a!==null){"fitBounds"in a&&a.fitBounds(r);var l=a.getZoom()||0;o!==null&&l>o&&a.setZoom(o+1)}},100)}e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}},t.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},t.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},t.prototype.onAdd=function(){var e;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),(e=this.getPanes())===null||e===void 0||e.overlayMouseTarget.appendChild(this.div);var n=this.getMap();n!==null&&(this.boundsChangedListener=google.maps.event.addListener(n,"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut))},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),this.boundsChangedListener!==null&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),this.timeOut!==null&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},t.prototype.draw=function(){if(this.visible&&this.div!==null&&this.center){var e=this.getPosFromLatLng(this.center);this.div.style.top=e!==null?"".concat(e.y,"px"):"0",this.div.style.left=e!==null?"".concat(e.x,"px"):"0"}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var e,n,o,r,i,a;if(this.div&&this.center){var l=this.sums===null||typeof this.sums.title>"u"||this.sums.title===""?this.cluster.getClusterer().getTitle():this.sums.title,s=this.backgroundPosition.split(" "),c=parseInt(((e=s[0])===null||e===void 0?void 0:e.replace(/^\s+|\s+$/g,""))||"0",10),u=parseInt(((n=s[1])===null||n===void 0?void 0:n.replace(/^\s+|\s+$/g,""))||"0",10),d=this.getPosFromLatLng(this.center);this.div.className=this.className,this.div.setAttribute("style","cursor: pointer; position: absolute; top: ".concat(d!==null?"".concat(d.y,"px"):"0","; left: ").concat(d!==null?"".concat(d.x,"px"):"0","; width: ").concat(this.width,"px; height: ").concat(this.height,"px; "));var f=document.createElement("img");f.alt=l,f.src=this.url,f.width=this.width,f.height=this.height,f.setAttribute("style","position: absolute; top: ".concat(u,"px; left: ").concat(c,"px")),this.cluster.getClusterer().enableRetinaIcons||(f.style.clip="rect(-".concat(u,"px, -").concat(c+this.width,"px, -").concat(u+this.height,", -").concat(c,")"));var p=document.createElement("div");p.setAttribute("style","position: absolute; top: ".concat(this.anchorText[0],"px; left: ").concat(this.anchorText[1],"px; color: ").concat(this.textColor,"; font-size: ").concat(this.textSize,"px; font-family: ").concat(this.fontFamily,"; font-weight: ").concat(this.fontWeight,"; fontStyle: ").concat(this.fontStyle,"; text-decoration: ").concat(this.textDecoration,"; text-align: center; width: ").concat(this.width,"px; line-height: ").concat(this.height,"px")),!((o=this.sums)===null||o===void 0)&&o.text&&(p.innerText="".concat((r=this.sums)===null||r===void 0?void 0:r.text)),!((i=this.sums)===null||i===void 0)&&i.html&&(p.innerHTML="".concat((a=this.sums)===null||a===void 0?void 0:a.html)),this.div.innerHTML="",this.div.appendChild(f),this.div.appendChild(p),this.div.title=l,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(e){this.sums=e;var n=this.cluster.getClusterer().getStyles(),o=n[Math.min(n.length-1,Math.max(0,e.index-1))];o&&(this.url=o.url,this.height=o.height,this.width=o.width,o.className&&(this.className="".concat(this.clusterClassName," ").concat(o.className)),this.anchorText=o.anchorText||[0,0],this.anchorIcon=o.anchorIcon||[this.height/2,this.width/2],this.textColor=o.textColor||"black",this.textSize=o.textSize||11,this.textDecoration=o.textDecoration||"none",this.fontWeight=o.fontWeight||"bold",this.fontStyle=o.fontStyle||"normal",this.fontFamily=o.fontFamily||"Arial,sans-serif",this.backgroundPosition=o.backgroundPosition||"0 0")},t.prototype.setCenter=function(e){this.center=e},t.prototype.getPosFromLatLng=function(e){var n=this.getProjection().fromLatLngToDivPixel(e);return n!==null&&(n.x-=this.anchorIcon[1],n.y-=this.anchorIcon[0]),n},t}(),Vvo=function(){function t(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new _vo(this,this.markerClusterer.getStyles()),this.getSize=this.getSize.bind(this),this.getMarkers=this.getMarkers.bind(this),this.getCenter=this.getCenter.bind(this),this.getMap=this.getMap.bind(this),this.getClusterer=this.getClusterer.bind(this),this.getBounds=this.getBounds.bind(this),this.remove=this.remove.bind(this),this.addMarker=this.addMarker.bind(this),this.isMarkerInClusterBounds=this.isMarkerInClusterBounds.bind(this),this.calculateBounds=this.calculateBounds.bind(this),this.updateIcon=this.updateIcon.bind(this),this.isMarkerAlreadyAdded=this.isMarkerAlreadyAdded.bind(this)}return t.prototype.getSize=function(){return this.markers.length},t.prototype.getMarkers=function(){return this.markers},t.prototype.getCenter=function(){return this.center},t.prototype.getMap=function(){return this.map},t.prototype.getClusterer=function(){return this.markerClusterer},t.prototype.getBounds=function(){for(var e=new google.maps.LatLngBounds(this.center,this.center),n=this.getMarkers(),o=0,r=n;oa)e.getMap()!==this.map&&e.setMap(this.map);else if(io){this.clusterIcon.hide();return}if(n0))for(var e=0;e3?new google.maps.LatLngBounds(r==null?void 0:r.getSouthWest(),r==null?void 0:r.getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),l=this.getExtendedBounds(a),s=Math.min(e+this.batchSize,this.markers.length),c=e;c{R&&v&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(R,ay.onMouseOut,v)))},[v]),g.useEffect(()=>{R&&S&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(R,ay.onMouseOver,S)))},[S]),g.useEffect(()=>{R&&C&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(R,ay.onClick,C)))},[C]),g.useEffect(()=>{R&&P&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(R,ay.onClusteringBegin,P)))},[P]),g.useEffect(()=>{R&&A&&(F!==null&&google.maps.event.removeListener(F),W(google.maps.event.addListener(R,ay.onClusteringEnd,A)))},[A]),g.useEffect(()=>{typeof o<"u"&&R!==null&&Ll.averageCenter(R,o)},[R,o]),g.useEffect(()=>{typeof r<"u"&&R!==null&&Ll.batchSizeIE(R,r)},[R,r]),g.useEffect(()=>{typeof i<"u"&&R!==null&&Ll.calculator(R,i)},[R,i]),g.useEffect(()=>{typeof a<"u"&&R!==null&&Ll.clusterClass(R,a)},[R,a]),g.useEffect(()=>{typeof l<"u"&&R!==null&&Ll.enableRetinaIcons(R,l)},[R,l]),g.useEffect(()=>{typeof s<"u"&&R!==null&&Ll.gridSize(R,s)},[R,s]),g.useEffect(()=>{typeof c<"u"&&R!==null&&Ll.ignoreHidden(R,c)},[R,c]),g.useEffect(()=>{typeof u<"u"&&R!==null&&Ll.imageExtension(R,u)},[R,u]),g.useEffect(()=>{typeof d<"u"&&R!==null&&Ll.imagePath(R,d)},[R,d]),g.useEffect(()=>{typeof f<"u"&&R!==null&&Ll.imageSizes(R,f)},[R,f]),g.useEffect(()=>{typeof p<"u"&&R!==null&&Ll.maxZoom(R,p)},[R,p]),g.useEffect(()=>{typeof m<"u"&&R!==null&&Ll.minimumClusterSize(R,m)},[R,m]),g.useEffect(()=>{typeof y<"u"&&R!==null&&Ll.styles(R,y)},[R,y]),g.useEffect(()=>{typeof w<"u"&&R!==null&&Ll.title(R,w)},[R,w]),g.useEffect(()=>{typeof x<"u"&&R!==null&&Ll.zoomOnClick(R,x)},[R,x]),g.useEffect(()=>{if(D){var _=Zvo({},n||ebo),G=new u0t(D,[],_);return o&&Ll.averageCenter(G,o),r&&Ll.batchSizeIE(G,r),i&&Ll.calculator(G,i),a&&Ll.clusterClass(G,a),l&&Ll.enableRetinaIcons(G,l),s&&Ll.gridSize(G,s),c&&Ll.ignoreHidden(G,c),u&&Ll.imageExtension(G,u),d&&Ll.imagePath(G,d),f&&Ll.imageSizes(G,f),p&&Ll.maxZoom(G,p),m&&Ll.minimumClusterSize(G,m),y&&Ll.styles(G,y),w&&Ll.title(G,w),x&&Ll.zoomOnClick(G,x),v&&j(google.maps.event.addListener(G,ay.onMouseOut,v)),S&&O(google.maps.event.addListener(G,ay.onMouseOver,S)),C&&N(google.maps.event.addListener(G,ay.onClick,C)),P&&W(google.maps.event.addListener(G,ay.onClusteringBegin,P)),A&&E(google.maps.event.addListener(G,ay.onClusteringEnd,A)),M(G),b&&b(G),()=>{L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),T&&T(G)}}},[]),R!==null&&e(R)||null}g.memo(tbo);class d0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{markerClusterer:null}),mo(this,"setClustererCallback",()=>{this.state.markerClusterer!==null&&this.props.onLoad&&this.props.onLoad(this.state.markerClusterer)})}componentDidMount(){if(this.context){var e=new u0t(this.context,[],this.props.options);this.registeredEvents=Va({updaterMap:Ll,eventMap:ay,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({markerClusterer:e}),this.setClustererCallback)}}componentDidUpdate(e){this.state.markerClusterer&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Ll,eventMap:ay,prevProps:e,nextProps:this.props,instance:this.state.markerClusterer}))}componentWillUnmount(){this.state.markerClusterer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.markerClusterer),Za(this.registeredEvents),this.state.markerClusterer.setMap(null))}render(){return this.state.markerClusterer!==null?this.props.children(this.state.markerClusterer):null}}mo(d0t,"contextType",Ra);function JEe(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}var f0t=function(){function t(e){e===void 0&&(e={}),this.getCloseClickHandler=this.getCloseClickHandler.bind(this),this.closeClickHandler=this.closeClickHandler.bind(this),this.createInfoBoxDiv=this.createInfoBoxDiv.bind(this),this.addClickHandler=this.addClickHandler.bind(this),this.getCloseBoxImg=this.getCloseBoxImg.bind(this),this.getBoxWidths=this.getBoxWidths.bind(this),this.setBoxStyle=this.setBoxStyle.bind(this),this.setPosition=this.setPosition.bind(this),this.getPosition=this.getPosition.bind(this),this.setOptions=this.setOptions.bind(this),this.setContent=this.setContent.bind(this),this.setVisible=this.setVisible.bind(this),this.getContent=this.getContent.bind(this),this.getVisible=this.getVisible.bind(this),this.setZIndex=this.setZIndex.bind(this),this.getZIndex=this.getZIndex.bind(this),this.onRemove=this.onRemove.bind(this),this.panBox=this.panBox.bind(this),this.extend=this.extend.bind(this),this.close=this.close.bind(this),this.draw=this.draw.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.open=this.open.bind(this),this.extend(t,google.maps.OverlayView),this.content=e.content||"",this.disableAutoPan=e.disableAutoPan||!1,this.maxWidth=e.maxWidth||0,this.pixelOffset=e.pixelOffset||new google.maps.Size(0,0),this.position=e.position||new google.maps.LatLng(0,0),this.zIndex=e.zIndex||null,this.boxClass=e.boxClass||"infoBox",this.boxStyle=e.boxStyle||{},this.closeBoxMargin=e.closeBoxMargin||"2px",this.closeBoxURL=e.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",e.closeBoxURL===""&&(this.closeBoxURL=""),this.infoBoxClearance=e.infoBoxClearance||new google.maps.Size(1,1),typeof e.visible>"u"&&(typeof e.isHidden>"u"?e.visible=!0:e.visible=!e.isHidden),this.isHidden=!e.visible,this.alignBottom=e.alignBottom||!1,this.pane=e.pane||"floatPane",this.enableEventPropagation=e.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var e=this,n=function(u){u.returnValue=!1,u.preventDefault&&u.preventDefault(),e.enableEventPropagation||JEe(u)};if(!this.div){this.div=document.createElement("div"),this.setBoxStyle(),typeof this.content=="string"?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content));var o=this.getPanes();if(o!==null&&o[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(this.maxWidth!==0&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var r=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-r.left-r.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var i=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],a=0,l=i;al&&(o=w.x+d+c+p-l),this.alignBottom?w.y<-u+m+f?r=w.y+u-m-f:w.y+u+m>s&&(r=w.y+u+m-s):w.y<-u+m?r=w.y+u-m:w.y+f+u+m>s&&(r=w.y+f+u+m-s)),o===0&&r===0||n.panBy(o,r)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var e=this.boxStyle;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.div.style[n]=e[n]);if(this.div.style.webkitTransform="translateZ(0)",typeof this.div.style.opacity<"u"&&this.div.style.opacity!==""){var o=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+o*100+')"',this.div.style.filter="alpha(opacity="+o*100+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",this.zIndex!==null&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var e={top:0,bottom:0,left:0,right:0};if(!this.div)return e;if(document.defaultView){var n=this.div.ownerDocument,o=n&&n.defaultView?n.defaultView.getComputedStyle(this.div,""):null;o&&(e.top=parseInt(o.borderTopWidth||"",10)||0,e.bottom=parseInt(o.borderBottomWidth||"",10)||0,e.left=parseInt(o.borderLeftWidth||"",10)||0,e.right=parseInt(o.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var r=this.div.currentStyle;r&&(e.top=parseInt(r.borderTopWidth||"",10)||0,e.bottom=parseInt(r.borderBottomWidth||"",10)||0,e.left=parseInt(r.borderLeftWidth||"",10)||0,e.right=parseInt(r.borderRightWidth||"",10)||0)}return e},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var e=this.getProjection(),n=e.fromLatLngToDivPixel(this.position);n!==null&&(this.div.style.left=n.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(n.y+this.pixelOffset.height)+"px":this.div.style.top=n.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(e){e===void 0&&(e={}),typeof e.boxClass<"u"&&(this.boxClass=e.boxClass,this.setBoxStyle()),typeof e.boxStyle<"u"&&(this.boxStyle=e.boxStyle,this.setBoxStyle()),typeof e.content<"u"&&this.setContent(e.content),typeof e.disableAutoPan<"u"&&(this.disableAutoPan=e.disableAutoPan),typeof e.maxWidth<"u"&&(this.maxWidth=e.maxWidth),typeof e.pixelOffset<"u"&&(this.pixelOffset=e.pixelOffset),typeof e.alignBottom<"u"&&(this.alignBottom=e.alignBottom),typeof e.position<"u"&&this.setPosition(e.position),typeof e.zIndex<"u"&&this.setZIndex(e.zIndex),typeof e.closeBoxMargin<"u"&&(this.closeBoxMargin=e.closeBoxMargin),typeof e.closeBoxURL<"u"&&(this.closeBoxURL=e.closeBoxURL),typeof e.infoBoxClearance<"u"&&(this.infoBoxClearance=e.infoBoxClearance),typeof e.isHidden<"u"&&(this.isHidden=e.isHidden),typeof e.visible<"u"&&(this.isHidden=!e.visible),typeof e.enableEventPropagation<"u"&&(this.enableEventPropagation=e.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(e){this.content=e,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px",typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(e){this.position=e,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(e){this.isHidden=!e,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(e){this.zIndex=e,this.div&&(this.div.style.zIndex=e+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var e=this.getMap();return typeof e>"u"||e===null?!1:!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(e,n){var o=this;n&&(this.position=n.getPosition(),this.moveListener=google.maps.event.addListener(n,"position_changed",function(){var r=n.getPosition();o.setPosition(r)}),this.mapListener=google.maps.event.addListener(n,"map_changed",function(){o.setMap(n.map)})),this.setMap(e),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var e=0,n=this.eventListeners;e{p&&m!==null&&(m.close(),n?m.open(p,n):m.getPosition()&&m.open(p))},[p,m,n]),g.useEffect(()=>{o&&m!==null&&m.setOptions(o)},[m,o]),g.useEffect(()=>{if(r&&m!==null){var D=r instanceof google.maps.LatLng?r:new google.maps.LatLng(r.lat,r.lng);m.setPosition(D)}},[r]),g.useEffect(()=>{typeof i=="number"&&m!==null&&m.setZIndex(i)},[i]),g.useEffect(()=>{m&&a&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(m,"closeclick",a)))},[a]),g.useEffect(()=>{m&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(m,"domready",l)))},[l]),g.useEffect(()=>{m&&s&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(m,"content_changed",s)))},[s]),g.useEffect(()=>{m&&c&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(m,"position_changed",c)))},[c]),g.useEffect(()=>{m&&u&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(m,"zindex_changed",u)))},[u]),g.useEffect(()=>{if(p){var D=o||rbo,{position:k}=D,N=k4e(D,nbo),U;k&&!(k instanceof google.maps.LatLng)&&(U=new google.maps.LatLng(k.lat,k.lng));var W=new f0t(DK(DK({},N),U?{position:U}:{}));M.current=document.createElement("div"),y(W),a&&x(google.maps.event.addListener(W,"closeclick",a)),l&&P(google.maps.event.addListener(W,"domready",l)),s&&S(google.maps.event.addListener(W,"content_changed",s)),c&&b(google.maps.event.addListener(W,"position_changed",c)),u&&R(google.maps.event.addListener(W,"zindex_changed",u)),W.setContent(M.current),n?W.open(p,n):W.getPosition()?W.open(p):od(!1,"You must provide either an anchor or a position prop for ."),d&&d(W)}return()=>{m!==null&&(w&&google.maps.event.removeListener(w),A&&google.maps.event.removeListener(A),C&&google.maps.event.removeListener(C),v&&google.maps.event.removeListener(v),T&&google.maps.event.removeListener(T),f&&f(m),m.close())}},[]),M.current?r0.createPortal(g.Children.only(e),M.current):null}g.memo(ibo);class abo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",null),mo(this,"state",{infoBox:null}),mo(this,"open",(e,n)=>{n?this.context!==null&&e.open(this.context,n):e.getPosition()?this.context!==null&&e.open(this.context):od(!1,"You must provide either an anchor or a position prop for .")}),mo(this,"setInfoBoxCallback",()=>{this.state.infoBox!==null&&this.containerElement!==null&&(this.state.infoBox.setContent(this.containerElement),this.open(this.state.infoBox,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoBox))})}componentDidMount(){var e=this.props.options||{},{position:n}=e,o=k4e(e,obo),r;n&&!(n instanceof google.maps.LatLng)&&(r=new google.maps.LatLng(n.lat,n.lng));var i=new f0t(DK(DK({},o),r?{position:r}:{}));this.containerElement=document.createElement("div"),this.registeredEvents=Va({updaterMap:qEe,eventMap:$Ee,prevProps:{},nextProps:this.props,instance:i}),this.setState({infoBox:i},this.setInfoBoxCallback)}componentDidUpdate(e){var{infoBox:n}=this.state;n!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:qEe,eventMap:$Ee,prevProps:e,nextProps:this.props,instance:n}))}componentWillUnmount(){var{onUnmount:e}=this.props,{infoBox:n}=this.state;n!==null&&(e&&e(n),Za(this.registeredEvents),n.close())}render(){return this.containerElement?r0.createPortal(g.Children.only(this.props.children),this.containerElement):null}}mo(abo,"contextType",Ra);var Vce,QEe;function lbo(){return QEe||(QEe=1,Vce=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n}),Vce}var sbo=lbo(),ZEe=o0t(sbo),eke=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Gce=1,xE=8;class F4e{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var[n,o]=new Uint8Array(e,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");var r=o>>4;if(r!==Gce)throw new Error("Got v".concat(r," data when expected v").concat(Gce,"."));var i=eke[o&15];if(!i)throw new Error("Unrecognized array type.");var[a]=new Uint16Array(e,2,1),[l]=new Uint32Array(e,4,1);return new F4e(l,a,i,e)}constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:64,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float64Array,r=arguments.length>3?arguments[3]:void 0;if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;var i=eke.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(i<0)throw new Error("Unexpected typed array class: ".concat(o,"."));r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,xE,e),this.coords=new this.ArrayType(this.data,xE+l+s,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(xE+a+l+s),this.ids=new this.IndexArrayType(this.data,xE,e),this.coords=new this.ArrayType(this.data,xE+l+s,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Gce<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){var o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=n,o}finish(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return O1e(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,o,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:i,coords:a,nodeSize:l}=this,s=[0,i.length-1,0],c=[];s.length;){var u=s.pop()||0,d=s.pop()||0,f=s.pop()||0;if(d-f<=l){for(var p=f;p<=d;p++){var m=a[2*p],y=a[2*p+1];m>=e&&m<=o&&y>=n&&y<=r&&c.push(i[p])}continue}var w=f+d>>1,x=a[2*w],C=a[2*w+1];x>=e&&x<=o&&C>=n&&C<=r&&c.push(i[w]),(u===0?e<=x:n<=C)&&(s.push(f),s.push(w-1),s.push(1-u)),(u===0?o>=x:r>=C)&&(s.push(w+1),s.push(d),s.push(1-u))}return c}within(e,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:r,coords:i,nodeSize:a}=this,l=[0,r.length-1,0],s=[],c=o*o;l.length;){var u=l.pop()||0,d=l.pop()||0,f=l.pop()||0;if(d-f<=a){for(var p=f;p<=d;p++)tke(i[2*p],i[2*p+1],e,n)<=c&&s.push(r[p]);continue}var m=f+d>>1,y=i[2*m],w=i[2*m+1];tke(y,w,e,n)<=c&&s.push(r[m]),(u===0?e-o<=y:n-o<=w)&&(l.push(f),l.push(m-1),l.push(1-u)),(u===0?e+o>=y:n+o>=w)&&(l.push(m+1),l.push(d),l.push(1-u))}return s}}function O1e(t,e,n,o,r,i){if(!(r-o<=n)){var a=o+r>>1;h0t(t,e,a,o,r,i),O1e(t,e,n,o,a-1,1-i),O1e(t,e,n,a+1,r,1-i)}}function h0t(t,e,n,o,r,i){for(;r>o;){if(r-o>600){var a=r-o+1,l=n-o+1,s=Math.log(a),c=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*c*(a-c)/a)*(l-a/2<0?-1:1),d=Math.max(o,Math.floor(n-l*c/a+u)),f=Math.min(r,Math.floor(n+(a-l)*c/a+u));h0t(t,e,n,d,f,i)}var p=e[2*n+i],m=o,y=r;for(vE(t,e,o,n),e[2*r+i]>p&&vE(t,e,o,r);mp;)y--}e[2*o+i]===p?vE(t,e,o,y):(y++,vE(t,e,y,r)),y<=n&&(o=y+1),n<=y&&(r=y-1)}}function vE(t,e,n,o){Xce(t,n,o),Xce(e,2*n,2*o),Xce(e,2*n+1,2*o+1)}function Xce(t,e,n){var o=t[e];t[e]=t[n],t[n]=o}function tke(t,e,n,o){var r=t-n,i=e-o;return r*r+i*i}var cbo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},nke=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),ev=2,_w=3,Jce=4,Fw=5,p0t=6;class ubo{constructor(e){this.options=Object.assign(Object.create(cbo),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){var{log:n,minZoom:o,maxZoom:r}=this.options;n&&console.time("total time");var i="prepare ".concat(e.length," points");n&&console.time(i),this.points=e;for(var a=[],l=0;l=o;m--){var y=+Date.now();p=this.trees[m]=this._createTree(this._cluster(p,m)),n&&console.log("z%d: %d clusters in %dms",m,p.numItems,+Date.now()-y)}return n&&console.timeEnd("total time"),this}getClusters(e,n){var o=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,i=180;else if(o>i){var l=this.getClusters([o,r,180,a],n),s=this.getClusters([-180,r,i,a],n);return l.concat(s)}var c=this.trees[this._limitZoom(n)],u=c.range(lV(o),sV(a),lV(i),sV(r)),d=c.data,f=[];for(var p of u){var m=this.stride*p;f.push(d[m+Fw]>1?oke(d,m,this.clusterProps):this.points[d[m+_w]])}return f}getChildren(e){var n=this._getOriginId(e),o=this._getOriginZoom(e),r="No cluster with the specified id.",i=this.trees[o];if(!i)throw new Error(r);var a=i.data;if(n*this.stride>=a.length)throw new Error(r);var l=this.options.radius/(this.options.extent*Math.pow(2,o-1)),s=a[n*this.stride],c=a[n*this.stride+1],u=i.within(s,c,l),d=[];for(var f of u){var p=f*this.stride;a[p+Jce]===e&&d.push(a[p+Fw]>1?oke(a,p,this.clusterProps):this.points[a[p+_w]])}if(d.length===0)throw new Error(r);return d}getLeaves(e,n,o){n=n||10,o=o||0;var r=[];return this._appendLeaves(r,e,n,o,0),r}getTile(e,n,o){var r=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:a,radius:l}=this.options,s=l/a,c=(o-s)/i,u=(o+1+s)/i,d={features:[]};return this._addTileFeatures(r.range((n-s)/i,c,(n+1+s)/i,u),r.data,n,o,i,d),n===0&&this._addTileFeatures(r.range(1-s/i,c,1,u),r.data,i,o,i,d),n===i-1&&this._addTileFeatures(r.range(0,c,s/i,u),r.data,-1,o,i,d),d.features.length?d:null}getClusterExpansionZoom(e){for(var n=this._getOriginZoom(e)-1;n<=this.options.maxZoom;){var o=this.getChildren(e);if(n++,o.length!==1)break;e=o[0].properties.cluster_id}return n}_appendLeaves(e,n,o,r,i){var a=this.getChildren(n);for(var l of a){var s=l.properties;if(s&&s.cluster?i+s.point_count<=r?i+=s.point_count:i=this._appendLeaves(e,s.cluster_id,o,r,i):i1,u=void 0,d=void 0,f=void 0;if(c)u=g0t(n,s,this.clusterProps),d=n[s],f=n[s+1];else{var p=this.points[n[s+_w]];u=p.properties;var[m,y]=p.geometry.coordinates;d=lV(m),f=sV(y)}var w={type:1,geometry:[[Math.round(this.options.extent*(d*i-o)),Math.round(this.options.extent*(f*i-r))]],tags:u},x=void 0;c||this.options.generateId?x=n[s+_w]:x=this.points[n[s+_w]].id,x!==void 0&&(w.id=x),a.features.push(w)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,n){for(var{radius:o,extent:r,reduce:i,minPoints:a}=this.options,l=o/(r*Math.pow(2,n)),s=e.data,c=[],u=this.stride,d=0;dn&&(w+=s[C+Fw])}if(w>y&&w>=a){var P=f*y,A=p*y,S=void 0,v=-1,b=((d/u|0)<<5)+(n+1)+this.points.length;for(var T of m){var R=T*u;if(!(s[R+ev]<=n)){s[R+ev]=n;var M=s[R+Fw];P+=s[R]*M,A+=s[R+1]*M,s[R+Jce]=b,i&&(S||(S=this._map(s,d,!0),v=this.clusterProps.length,this.clusterProps.push(S)),i(S,this._map(s,R)))}}s[d+Jce]=b,c.push(P/w,A/w,1/0,b,-1,w),i&&c.push(v)}else{for(var D=0;D1)for(var k of m){var N=k*u;if(!(s[N+ev]<=n)){s[N+ev]=n;for(var U=0;U>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,n,o){if(e[n+Fw]>1){var r=this.clusterProps[e[n+p0t]];return o?Object.assign({},r):r}var i=this.points[e[n+_w]].properties,a=this.options.map(i);return o&&a===i?Object.assign({},a):a}}function oke(t,e,n){return{type:"Feature",id:t[e+_w],properties:g0t(t,e,n),geometry:{type:"Point",coordinates:[dbo(t[e]),fbo(t[e+1])]}}}function g0t(t,e,n){var o=t[e+Fw],r=o>=1e4?"".concat(Math.round(o/1e3),"k"):o>=1e3?"".concat(Math.round(o/100)/10,"k"):o,i=t[e+p0t],a=i===-1?{}:Object.assign({},n[i]);return Object.assign(a,{cluster:!0,cluster_id:t[e+_w],point_count:o,point_count_abbreviated:r})}function lV(t){return t/360+.5}function sV(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function dbo(t){return(t-.5)*360}function fbo(t){var e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}/*! ***************************************************************************** + `)),console.error(b)})},[e,C,o]);var P=g.useRef();return g.useEffect(function(){P.current&&s!==P.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),P.current=s},[s]),{isLoaded:m,loadError:w,url:C}}var Rvo=["loadingElement","onLoad","onError","onUnmount","children"],Hvo=h.jsx(s0t,{});function Mvo(t){var{loadingElement:e,onLoad:n,onError:o,onUnmount:r,children:i}=t,a=k4e(t,Rvo),{isLoaded:l,loadError:s}=Cvo(a);return g.useEffect(function(){l&&typeof n=="function"&&n()},[l,n]),g.useEffect(function(){s&&typeof o=="function"&&o(s)},[s,o]),g.useEffect(function(){return()=>{r&&r()}},[r]),l?i:e||Hvo}g.memo(Mvo);function Ivo(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,[])).next())})}function zvo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Dvo=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n},Evo=zvo(Dvo),WEe="__googleMapsScriptId",gR;(function(t){t[t.INITIALIZED=0]="INITIALIZED",t[t.LOADING=1]="LOADING",t[t.SUCCESS=2]="SUCCESS",t[t.FAILURE=3]="FAILURE"})(gR||(gR={}));class Rv{constructor(e){var{apiKey:n,authReferrerPolicy:o,channel:r,client:i,id:a=WEe,language:l,libraries:s=[],mapIds:c,nonce:u,region:d,retries:f=3,url:p="https://maps.googleapis.com/maps/api/js",version:m}=e;if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=n,this.authReferrerPolicy=o,this.channel=r,this.client=i,this.id=a||WEe,this.language=l,this.libraries=s,this.mapIds=c,this.nonce=u,this.region=d,this.retries=f,this.url=p,this.version=m,Rv.instance){if(!Evo(this.options,Rv.instance.options))throw new Error("Loader must not be called again with different options. ".concat(JSON.stringify(this.options)," !== ").concat(JSON.stringify(Rv.instance.options)));return Rv.instance}Rv.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?gR.FAILURE:this.done?gR.SUCCESS:this.loading?gR.LOADING:gR.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){var e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+="&key=".concat(this.apiKey)),this.channel&&(e+="&channel=".concat(this.channel)),this.client&&(e+="&client=".concat(this.client)),this.libraries.length>0&&(e+="&libraries=".concat(this.libraries.join(","))),this.language&&(e+="&language=".concat(this.language)),this.region&&(e+="®ion=".concat(this.region)),this.version&&(e+="&v=".concat(this.version)),this.mapIds&&(e+="&map_ids=".concat(this.mapIds.join(","))),this.authReferrerPolicy&&(e+="&auth_referrer_policy=".concat(this.authReferrerPolicy)),e}deleteScript(){var e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,n)=>{this.loadCallback(o=>{o?n(o.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,n;if(document.getElementById(this.id)){this.callback();return}var o={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(o).forEach(i=>!o[i]&&delete o[i]),!((n=(e=window==null?void 0:window.google)===null||e===void 0?void 0:e.maps)===null||n===void 0)&&n.importLibrary||(i=>{var a,l,s,c="The Google Maps JavaScript API",u="google",d="importLibrary",f="__ib__",p=document,m=window;m=m[u]||(m[u]={});var y=m.maps||(m.maps={}),w=new Set,x=new URLSearchParams,C=()=>a||(a=new Promise((P,A)=>Ivo(this,void 0,void 0,function*(){var S;yield l=p.createElement("script"),l.id=this.id,x.set("libraries",[...w]+"");for(s in i)x.set(s.replace(/[A-Z]/g,v=>"_"+v[0].toLowerCase()),i[s]);x.set("callback",u+".maps."+f),l.src=this.url+"?"+x,y[f]=P,l.onerror=()=>a=A(Error(c+" could not load.")),l.nonce=this.nonce||((S=p.querySelector("script[nonce]"))===null||S===void 0?void 0:S.nonce)||"",p.head.append(l)})));y[d]?console.warn(c+" only loads once. Ignoring:",i):y[d]=function(P){for(var A=arguments.length,S=new Array(A>1?A-1:0),v=1;vy[d](P,...S))}})(o);var r=this.libraries.map(i=>this.importLibrary(i));r.length||r.push(this.importLibrary("core")),Promise.all(r).then(()=>this.callback(),i=>{var a=new ErrorEvent("error",{error:i});this.loadErrorCallback(a)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){var n=this.errors.length*Math.pow(2,this.errors.length);console.error("Failed to load Google Maps script, retrying in ".concat(n," ms.")),setTimeout(()=>{this.deleteScript(),this.setScript()},n)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading=!0,this.setScript()}}}var kvo=["maps"];function c0t(t){var{id:e=mW.id,version:n=mW.version,nonce:o,googleMapsApiKey:r,language:i,region:a,libraries:l=kvo,preventGoogleFontsLoading:s,mapIds:c,authReferrerPolicy:u}=t,d=g.useRef(!1),[f,p]=g.useState(!1),[m,y]=g.useState(void 0);g.useEffect(function(){return d.current=!0,()=>{d.current=!1}},[]);var w=g.useMemo(()=>new Rv({id:e,apiKey:r,version:n,libraries:l,language:i||"en",region:a||"US",mapIds:c||[],nonce:o||"",authReferrerPolicy:u||"origin"}),[e,r,n,l,i,a,c,o,u]);g.useEffect(function(){f||w.load().then(()=>{d.current&&p(!0)}).catch(P=>{y(P)})},[]),g.useEffect(()=>{m8&&s&&E4e()},[s]);var x=g.useRef();return g.useEffect(()=>{x.current&&l!==x.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),x.current=l},[l]),{isLoaded:f,loadError:m}}function NEe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function MK(t){for(var e=1;e{i!==null&&i.setMap(r)},[r]),g.useEffect(()=>{e&&i!==null&&i.setOptions(e)},[i,e]),g.useEffect(()=>{var l=new google.maps.TrafficLayer(MK(MK({},e),{},{map:r}));return a(l),n&&n(l),()=>{i!==null&&(o&&o(i),i.setMap(null))}},[]),null}g.memo(Fvo);class Lvo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{trafficLayer:null}),mo(this,"setTrafficLayerCallback",()=>{this.state.trafficLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.trafficLayer)}),mo(this,"registeredEvents",[])}componentDidMount(){var e=new google.maps.TrafficLayer(MK(MK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:jEe,eventMap:UEe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{trafficLayer:e}},this.setTrafficLayerCallback)}componentDidUpdate(e){this.state.trafficLayer!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:jEe,eventMap:UEe,prevProps:e,nextProps:this.props,instance:this.state.trafficLayer}))}componentWillUnmount(){this.state.trafficLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.trafficLayer),Za(this.registeredEvents),this.state.trafficLayer.setMap(null))}render(){return null}}mo(Lvo,"contextType",Ra);function Wvo(t){var{onLoad:e,onUnmount:n}=t,o=g.useContext(Ra),[r,i]=g.useState(null);return g.useEffect(()=>{r!==null&&r.setMap(o)},[o]),g.useEffect(()=>{var a=new google.maps.BicyclingLayer;return i(a),a.setMap(o),e&&e(a),()=>{a!==null&&(n&&n(a),a.setMap(null))}},[]),null}g.memo(Wvo);class Nvo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{bicyclingLayer:null}),mo(this,"setBicyclingLayerCallback",()=>{this.state.bicyclingLayer!==null&&(this.state.bicyclingLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.bicyclingLayer))})}componentDidMount(){var e=new google.maps.BicyclingLayer;this.setState(()=>({bicyclingLayer:e}),this.setBicyclingLayerCallback)}componentWillUnmount(){this.state.bicyclingLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.bicyclingLayer),this.state.bicyclingLayer.setMap(null))}render(){return null}}mo(Nvo,"contextType",Ra);function Uvo(t){var{onLoad:e,onUnmount:n}=t,o=g.useContext(Ra),[r,i]=g.useState(null);return g.useEffect(()=>{r!==null&&r.setMap(o)},[o]),g.useEffect(()=>{var a=new google.maps.TransitLayer;return i(a),a.setMap(o),e&&e(a),()=>{r!==null&&(n&&n(r),r.setMap(null))}},[]),null}g.memo(Uvo);class jvo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{transitLayer:null}),mo(this,"setTransitLayerCallback",()=>{this.state.transitLayer!==null&&(this.state.transitLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.transitLayer))})}componentDidMount(){var e=new google.maps.TransitLayer;this.setState(function(){return{transitLayer:e}},this.setTransitLayerCallback)}componentWillUnmount(){this.state.transitLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.transitLayer),this.state.transitLayer.setMap(null))}render(){return null}}mo(jvo,"contextType",Ra);function BEe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function IK(t){for(var e=1;e{f!==null&&f.setMap(d)},[d]),g.useEffect(()=>{e&&f!==null&&f.setOptions(e)},[f,e]),g.useEffect(()=>{f!==null&&f.setDrawingMode(n??null)},[f,n]),g.useEffect(()=>{f&&o&&(m!==null&&google.maps.event.removeListener(m),y(google.maps.event.addListener(f,"circlecomplete",o)))},[f,o]),g.useEffect(()=>{f&&r&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(f,"markercomplete",r)))},[f,r]),g.useEffect(()=>{f&&i&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(f,"overlaycomplete",i)))},[f,i]),g.useEffect(()=>{f&&a&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(f,"polygoncomplete",a)))},[f,a]),g.useEffect(()=>{f&&l&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(f,"polylinecomplete",l)))},[f,l]),g.useEffect(()=>{f&&s&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(f,"rectanglecomplete",s)))},[f,s]),g.useEffect(()=>{od(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing);var M=new google.maps.drawing.DrawingManager(IK(IK({},e),{},{map:d}));return n&&M.setDrawingMode(n),o&&y(google.maps.event.addListener(M,"circlecomplete",o)),r&&x(google.maps.event.addListener(M,"markercomplete",r)),i&&P(google.maps.event.addListener(M,"overlaycomplete",i)),a&&S(google.maps.event.addListener(M,"polygoncomplete",a)),l&&b(google.maps.event.addListener(M,"polylinecomplete",l)),s&&R(google.maps.event.addListener(M,"rectanglecomplete",s)),p(M),c&&c(M),()=>{f!==null&&(m&&google.maps.event.removeListener(m),w&&google.maps.event.removeListener(w),C&&google.maps.event.removeListener(C),A&&google.maps.event.removeListener(A),v&&google.maps.event.removeListener(v),T&&google.maps.event.removeListener(T),u&&u(f),f.setMap(null))}},[]),null}g.memo(Bvo);class Yvo extends g.PureComponent{constructor(e){super(e),mo(this,"registeredEvents",[]),mo(this,"state",{drawingManager:null}),mo(this,"setDrawingManagerCallback",()=>{this.state.drawingManager!==null&&this.props.onLoad&&this.props.onLoad(this.state.drawingManager)}),od(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing)}componentDidMount(){var e=new google.maps.drawing.DrawingManager(IK(IK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:OEe,eventMap:YEe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{drawingManager:e}},this.setDrawingManagerCallback)}componentDidUpdate(e){this.state.drawingManager!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:OEe,eventMap:YEe,prevProps:e,nextProps:this.props,instance:this.state.drawingManager}))}componentWillUnmount(){this.state.drawingManager!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.drawingManager),Za(this.registeredEvents),this.state.drawingManager.setMap(null))}render(){return null}}mo(Yvo,"contextType",Ra);function _Ee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function BR(t){for(var e=1;e{oe!==null&&oe.setMap(Q)},[Q]),g.useEffect(()=>{typeof n<"u"&&oe!==null&&oe.setOptions(n)},[oe,n]),g.useEffect(()=>{typeof a<"u"&&oe!==null&&oe.setDraggable(a)},[oe,a]),g.useEffect(()=>{e&&oe!==null&&oe.setPosition(e)},[oe,e]),g.useEffect(()=>{typeof l<"u"&&oe!==null&&oe.setVisible(l)},[oe,l]),g.useEffect(()=>{oe==null||oe.setAnimation(s)},[oe,s]),g.useEffect(()=>{oe&&c!==void 0&&oe.setClickable(c)},[oe,c]),g.useEffect(()=>{oe&&u!==void 0&&oe.setCursor(u)},[oe,u]),g.useEffect(()=>{oe&&d!==void 0&&oe.setIcon(d)},[oe,d]),g.useEffect(()=>{oe&&f!==void 0&&oe.setLabel(f)},[oe,f]),g.useEffect(()=>{oe&&p!==void 0&&oe.setOpacity(p)},[oe,p]),g.useEffect(()=>{oe&&m!==void 0&&oe.setShape(m)},[oe,m]),g.useEffect(()=>{oe&&y!==void 0&&oe.setTitle(y)},[oe,y]),g.useEffect(()=>{oe&&w!==void 0&&oe.setZIndex(w)},[oe,w]),g.useEffect(()=>{oe&&C&&($!==null&&google.maps.event.removeListener($),ae(google.maps.event.addListener(oe,"dblclick",C)))},[C]),g.useEffect(()=>{oe&&A&&(Z!==null&&google.maps.event.removeListener(Z),ne(google.maps.event.addListener(oe,"dragend",A)))},[A]),g.useEffect(()=>{oe&&S&&(te!==null&&google.maps.event.removeListener(te),q(google.maps.event.addListener(oe,"dragstart",S)))},[S]),g.useEffect(()=>{oe&&R&&(le!==null&&google.maps.event.removeListener(le),de(google.maps.event.addListener(oe,"mousedown",R)))},[R]),g.useEffect(()=>{oe&&v&&(he!==null&&google.maps.event.removeListener(he),me(google.maps.event.addListener(oe,"mouseout",v)))},[v]),g.useEffect(()=>{oe&&b&&(ce!==null&&google.maps.event.removeListener(ce),Pe(google.maps.event.addListener(oe,"mouseover",b)))},[b]),g.useEffect(()=>{oe&&T&&(pe!==null&&google.maps.event.removeListener(pe),Ie(google.maps.event.addListener(oe,"mouseup",T)))},[T]),g.useEffect(()=>{oe&&M&&(ve!==null&&google.maps.event.removeListener(ve),ze(google.maps.event.addListener(oe,"rightclick",M)))},[M]),g.useEffect(()=>{oe&&x&&(Ae!==null&&google.maps.event.removeListener(Ae),se(google.maps.event.addListener(oe,"click",x)))},[x]),g.useEffect(()=>{oe&&P&&(ge!==null&&google.maps.event.removeListener(ge),we(google.maps.event.addListener(oe,"drag",P)))},[P]),g.useEffect(()=>{oe&&D&&(Se!==null&&google.maps.event.removeListener(Se),Me(google.maps.event.addListener(oe,"clickable_changed",D)))},[D]),g.useEffect(()=>{oe&&k&&(Ce!==null&&google.maps.event.removeListener(Ce),Te(google.maps.event.addListener(oe,"cursor_changed",k)))},[k]),g.useEffect(()=>{oe&&N&&(Re!==null&&google.maps.event.removeListener(Re),Ne(google.maps.event.addListener(oe,"animation_changed",N)))},[N]),g.useEffect(()=>{oe&&U&&(_e!==null&&google.maps.event.removeListener(_e),Ue(google.maps.event.addListener(oe,"draggable_changed",U)))},[U]),g.useEffect(()=>{oe&&W&&(qe!==null&&google.maps.event.removeListener(qe),Fe(google.maps.event.addListener(oe,"flat_changed",W)))},[W]),g.useEffect(()=>{oe&&F&&(He!==null&&google.maps.event.removeListener(He),Le(google.maps.event.addListener(oe,"icon_changed",F)))},[F]),g.useEffect(()=>{oe&&E&&(Ye!==null&&google.maps.event.removeListener(Ye),lt(google.maps.event.addListener(oe,"position_changed",E)))},[E]),g.useEffect(()=>{oe&&L&&(Oe!==null&&google.maps.event.removeListener(Oe),ut(google.maps.event.addListener(oe,"shape_changed",L)))},[L]),g.useEffect(()=>{oe&&j&&(ht!==null&&google.maps.event.removeListener(ht),Qe(google.maps.event.addListener(oe,"title_changed",j)))},[j]),g.useEffect(()=>{oe&&Y&&(nt!==null&&google.maps.event.removeListener(nt),mt(google.maps.event.addListener(oe,"visible_changed",Y)))},[Y]),g.useEffect(()=>{oe&&O&&(tt!==null&&google.maps.event.removeListener(tt),gt(google.maps.event.addListener(oe,"zindex_changed",O)))},[O]),g.useEffect(()=>{var je=BR(BR(BR({},n||zK),o?zK:{map:Q}),{},{position:e}),et=new google.maps.Marker(je);return o?o.addMarker(et,!!r):et.setMap(Q),e&&et.setPosition(e),typeof l<"u"&&et.setVisible(l),typeof a<"u"&&et.setDraggable(a),typeof c<"u"&&et.setClickable(c),typeof u=="string"&&et.setCursor(u),d&&et.setIcon(d),typeof f<"u"&&et.setLabel(f),typeof p<"u"&&et.setOpacity(p),m&&et.setShape(m),typeof y=="string"&&et.setTitle(y),typeof w=="number"&&et.setZIndex(w),C&&ae(google.maps.event.addListener(et,"dblclick",C)),A&&ne(google.maps.event.addListener(et,"dragend",A)),S&&q(google.maps.event.addListener(et,"dragstart",S)),R&&de(google.maps.event.addListener(et,"mousedown",R)),v&&me(google.maps.event.addListener(et,"mouseout",v)),b&&Pe(google.maps.event.addListener(et,"mouseover",b)),T&&Ie(google.maps.event.addListener(et,"mouseup",T)),M&&ze(google.maps.event.addListener(et,"rightclick",M)),x&&se(google.maps.event.addListener(et,"click",x)),P&&we(google.maps.event.addListener(et,"drag",P)),D&&Me(google.maps.event.addListener(et,"clickable_changed",D)),k&&Te(google.maps.event.addListener(et,"cursor_changed",k)),N&&Ne(google.maps.event.addListener(et,"animation_changed",N)),U&&Ue(google.maps.event.addListener(et,"draggable_changed",U)),W&&Fe(google.maps.event.addListener(et,"flat_changed",W)),F&&Le(google.maps.event.addListener(et,"icon_changed",F)),E&<(google.maps.event.addListener(et,"position_changed",E)),L&&ut(google.maps.event.addListener(et,"shape_changed",L)),j&&Qe(google.maps.event.addListener(et,"title_changed",j)),Y&&mt(google.maps.event.addListener(et,"visible_changed",Y)),O&>(google.maps.event.addListener(et,"zindex_changed",O)),ee(et),_&&_(et),()=>{$!==null&&google.maps.event.removeListener($),Z!==null&&google.maps.event.removeListener(Z),te!==null&&google.maps.event.removeListener(te),le!==null&&google.maps.event.removeListener(le),he!==null&&google.maps.event.removeListener(he),ce!==null&&google.maps.event.removeListener(ce),pe!==null&&google.maps.event.removeListener(pe),ve!==null&&google.maps.event.removeListener(ve),Ae!==null&&google.maps.event.removeListener(Ae),Se!==null&&google.maps.event.removeListener(Se),Ce!==null&&google.maps.event.removeListener(Ce),Re!==null&&google.maps.event.removeListener(Re),_e!==null&&google.maps.event.removeListener(_e),qe!==null&&google.maps.event.removeListener(qe),He!==null&&google.maps.event.removeListener(He),Ye!==null&&google.maps.event.removeListener(Ye),ht!==null&&google.maps.event.removeListener(ht),nt!==null&&google.maps.event.removeListener(nt),tt!==null&&google.maps.event.removeListener(tt),G&&G(et),o?o.removeMarker(et,!!r):et&&et.setMap(null)}},[]);var Ve=g.useMemo(()=>i?g.Children.map(i,je=>{if(!g.isValidElement(je))return je;var et=je;return g.cloneElement(et,{anchor:oe})}):null,[i,oe]);return h.jsx(h.Fragment,{children:Ve})||null}g.memo(Ovo);class Y1e extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[])}componentDidMount(){var e=this;return i0t(function*(){var n=BR(BR(BR({},e.props.options||zK),e.props.clusterer?zK:{map:e.context}),{},{position:e.props.position});e.marker=new google.maps.Marker(n),e.props.clusterer?e.props.clusterer.addMarker(e.marker,!!e.props.noClustererRedraw):e.marker.setMap(e.context),e.registeredEvents=Va({updaterMap:GEe,eventMap:VEe,prevProps:{},nextProps:e.props,instance:e.marker}),e.props.onLoad&&e.props.onLoad(e.marker)})()}componentDidUpdate(e){this.marker&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:GEe,eventMap:VEe,prevProps:e,nextProps:this.props,instance:this.marker}))}componentWillUnmount(){this.marker&&(this.props.onUnmount&&this.props.onUnmount(this.marker),Za(this.registeredEvents),this.props.clusterer?this.props.clusterer.removeMarker(this.marker,!!this.props.noClustererRedraw):this.marker&&this.marker.setMap(null))}render(){var e=this.props.children?g.Children.map(this.props.children,n=>{if(!g.isValidElement(n))return n;var o=n;return g.cloneElement(o,{anchor:this.marker})}):null;return e||null}}mo(Y1e,"contextType",Ra);var _vo=function(){function t(e,n){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=n,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(e.getMap()),this.onBoundsChanged=this.onBoundsChanged.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onClick=this.onClick.bind(this),this.onMouseOver=this.onMouseOver.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onAdd=this.onAdd.bind(this),this.onRemove=this.onRemove.bind(this),this.draw=this.draw.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.useStyle=this.useStyle.bind(this),this.setCenter=this.setCenter.bind(this),this.getPosFromLatLng=this.getPosFromLatLng.bind(this)}return t.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},t.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},t.prototype.onClick=function(e){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var n=this.cluster.getClusterer();if(google.maps.event.trigger(n,"click",this.cluster),google.maps.event.trigger(n,"clusterclick",this.cluster),n.getZoomOnClick()){var o=n.getMaxZoom(),r=this.cluster.getBounds(),i=n.getMap();i!==null&&"fitBounds"in i&&i.fitBounds(r),this.timeOut=window.setTimeout(function(){var a=n.getMap();if(a!==null){"fitBounds"in a&&a.fitBounds(r);var l=a.getZoom()||0;o!==null&&l>o&&a.setZoom(o+1)}},100)}e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}},t.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},t.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},t.prototype.onAdd=function(){var e;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),(e=this.getPanes())===null||e===void 0||e.overlayMouseTarget.appendChild(this.div);var n=this.getMap();n!==null&&(this.boundsChangedListener=google.maps.event.addListener(n,"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut))},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),this.boundsChangedListener!==null&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),this.timeOut!==null&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},t.prototype.draw=function(){if(this.visible&&this.div!==null&&this.center){var e=this.getPosFromLatLng(this.center);this.div.style.top=e!==null?"".concat(e.y,"px"):"0",this.div.style.left=e!==null?"".concat(e.x,"px"):"0"}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var e,n,o,r,i,a;if(this.div&&this.center){var l=this.sums===null||typeof this.sums.title>"u"||this.sums.title===""?this.cluster.getClusterer().getTitle():this.sums.title,s=this.backgroundPosition.split(" "),c=parseInt(((e=s[0])===null||e===void 0?void 0:e.replace(/^\s+|\s+$/g,""))||"0",10),u=parseInt(((n=s[1])===null||n===void 0?void 0:n.replace(/^\s+|\s+$/g,""))||"0",10),d=this.getPosFromLatLng(this.center);this.div.className=this.className,this.div.setAttribute("style","cursor: pointer; position: absolute; top: ".concat(d!==null?"".concat(d.y,"px"):"0","; left: ").concat(d!==null?"".concat(d.x,"px"):"0","; width: ").concat(this.width,"px; height: ").concat(this.height,"px; "));var f=document.createElement("img");f.alt=l,f.src=this.url,f.width=this.width,f.height=this.height,f.setAttribute("style","position: absolute; top: ".concat(u,"px; left: ").concat(c,"px")),this.cluster.getClusterer().enableRetinaIcons||(f.style.clip="rect(-".concat(u,"px, -").concat(c+this.width,"px, -").concat(u+this.height,", -").concat(c,")"));var p=document.createElement("div");p.setAttribute("style","position: absolute; top: ".concat(this.anchorText[0],"px; left: ").concat(this.anchorText[1],"px; color: ").concat(this.textColor,"; font-size: ").concat(this.textSize,"px; font-family: ").concat(this.fontFamily,"; font-weight: ").concat(this.fontWeight,"; fontStyle: ").concat(this.fontStyle,"; text-decoration: ").concat(this.textDecoration,"; text-align: center; width: ").concat(this.width,"px; line-height: ").concat(this.height,"px")),!((o=this.sums)===null||o===void 0)&&o.text&&(p.innerText="".concat((r=this.sums)===null||r===void 0?void 0:r.text)),!((i=this.sums)===null||i===void 0)&&i.html&&(p.innerHTML="".concat((a=this.sums)===null||a===void 0?void 0:a.html)),this.div.innerHTML="",this.div.appendChild(f),this.div.appendChild(p),this.div.title=l,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(e){this.sums=e;var n=this.cluster.getClusterer().getStyles(),o=n[Math.min(n.length-1,Math.max(0,e.index-1))];o&&(this.url=o.url,this.height=o.height,this.width=o.width,o.className&&(this.className="".concat(this.clusterClassName," ").concat(o.className)),this.anchorText=o.anchorText||[0,0],this.anchorIcon=o.anchorIcon||[this.height/2,this.width/2],this.textColor=o.textColor||"black",this.textSize=o.textSize||11,this.textDecoration=o.textDecoration||"none",this.fontWeight=o.fontWeight||"bold",this.fontStyle=o.fontStyle||"normal",this.fontFamily=o.fontFamily||"Arial,sans-serif",this.backgroundPosition=o.backgroundPosition||"0 0")},t.prototype.setCenter=function(e){this.center=e},t.prototype.getPosFromLatLng=function(e){var n=this.getProjection().fromLatLngToDivPixel(e);return n!==null&&(n.x-=this.anchorIcon[1],n.y-=this.anchorIcon[0]),n},t}(),Vvo=function(){function t(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new _vo(this,this.markerClusterer.getStyles()),this.getSize=this.getSize.bind(this),this.getMarkers=this.getMarkers.bind(this),this.getCenter=this.getCenter.bind(this),this.getMap=this.getMap.bind(this),this.getClusterer=this.getClusterer.bind(this),this.getBounds=this.getBounds.bind(this),this.remove=this.remove.bind(this),this.addMarker=this.addMarker.bind(this),this.isMarkerInClusterBounds=this.isMarkerInClusterBounds.bind(this),this.calculateBounds=this.calculateBounds.bind(this),this.updateIcon=this.updateIcon.bind(this),this.isMarkerAlreadyAdded=this.isMarkerAlreadyAdded.bind(this)}return t.prototype.getSize=function(){return this.markers.length},t.prototype.getMarkers=function(){return this.markers},t.prototype.getCenter=function(){return this.center},t.prototype.getMap=function(){return this.map},t.prototype.getClusterer=function(){return this.markerClusterer},t.prototype.getBounds=function(){for(var e=new google.maps.LatLngBounds(this.center,this.center),n=this.getMarkers(),o=0,r=n;oa)e.getMap()!==this.map&&e.setMap(this.map);else if(io){this.clusterIcon.hide();return}if(n0))for(var e=0;e3?new google.maps.LatLngBounds(r==null?void 0:r.getSouthWest(),r==null?void 0:r.getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),l=this.getExtendedBounds(a),s=Math.min(e+this.batchSize,this.markers.length),c=e;c{R&&v&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(R,ay.onMouseOut,v)))},[v]),g.useEffect(()=>{R&&S&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(R,ay.onMouseOver,S)))},[S]),g.useEffect(()=>{R&&C&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(R,ay.onClick,C)))},[C]),g.useEffect(()=>{R&&P&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(R,ay.onClusteringBegin,P)))},[P]),g.useEffect(()=>{R&&A&&(F!==null&&google.maps.event.removeListener(F),W(google.maps.event.addListener(R,ay.onClusteringEnd,A)))},[A]),g.useEffect(()=>{typeof o<"u"&&R!==null&&Ll.averageCenter(R,o)},[R,o]),g.useEffect(()=>{typeof r<"u"&&R!==null&&Ll.batchSizeIE(R,r)},[R,r]),g.useEffect(()=>{typeof i<"u"&&R!==null&&Ll.calculator(R,i)},[R,i]),g.useEffect(()=>{typeof a<"u"&&R!==null&&Ll.clusterClass(R,a)},[R,a]),g.useEffect(()=>{typeof l<"u"&&R!==null&&Ll.enableRetinaIcons(R,l)},[R,l]),g.useEffect(()=>{typeof s<"u"&&R!==null&&Ll.gridSize(R,s)},[R,s]),g.useEffect(()=>{typeof c<"u"&&R!==null&&Ll.ignoreHidden(R,c)},[R,c]),g.useEffect(()=>{typeof u<"u"&&R!==null&&Ll.imageExtension(R,u)},[R,u]),g.useEffect(()=>{typeof d<"u"&&R!==null&&Ll.imagePath(R,d)},[R,d]),g.useEffect(()=>{typeof f<"u"&&R!==null&&Ll.imageSizes(R,f)},[R,f]),g.useEffect(()=>{typeof p<"u"&&R!==null&&Ll.maxZoom(R,p)},[R,p]),g.useEffect(()=>{typeof m<"u"&&R!==null&&Ll.minimumClusterSize(R,m)},[R,m]),g.useEffect(()=>{typeof y<"u"&&R!==null&&Ll.styles(R,y)},[R,y]),g.useEffect(()=>{typeof w<"u"&&R!==null&&Ll.title(R,w)},[R,w]),g.useEffect(()=>{typeof x<"u"&&R!==null&&Ll.zoomOnClick(R,x)},[R,x]),g.useEffect(()=>{if(D){var _=Zvo({},n||ebo),G=new u0t(D,[],_);return o&&Ll.averageCenter(G,o),r&&Ll.batchSizeIE(G,r),i&&Ll.calculator(G,i),a&&Ll.clusterClass(G,a),l&&Ll.enableRetinaIcons(G,l),s&&Ll.gridSize(G,s),c&&Ll.ignoreHidden(G,c),u&&Ll.imageExtension(G,u),d&&Ll.imagePath(G,d),f&&Ll.imageSizes(G,f),p&&Ll.maxZoom(G,p),m&&Ll.minimumClusterSize(G,m),y&&Ll.styles(G,y),w&&Ll.title(G,w),x&&Ll.zoomOnClick(G,x),v&&j(google.maps.event.addListener(G,ay.onMouseOut,v)),S&&O(google.maps.event.addListener(G,ay.onMouseOver,S)),C&&N(google.maps.event.addListener(G,ay.onClick,C)),P&&W(google.maps.event.addListener(G,ay.onClusteringBegin,P)),A&&E(google.maps.event.addListener(G,ay.onClusteringEnd,A)),M(G),b&&b(G),()=>{L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),T&&T(G)}}},[]),R!==null&&e(R)||null}g.memo(tbo);class d0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{markerClusterer:null}),mo(this,"setClustererCallback",()=>{this.state.markerClusterer!==null&&this.props.onLoad&&this.props.onLoad(this.state.markerClusterer)})}componentDidMount(){if(this.context){var e=new u0t(this.context,[],this.props.options);this.registeredEvents=Va({updaterMap:Ll,eventMap:ay,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({markerClusterer:e}),this.setClustererCallback)}}componentDidUpdate(e){this.state.markerClusterer&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Ll,eventMap:ay,prevProps:e,nextProps:this.props,instance:this.state.markerClusterer}))}componentWillUnmount(){this.state.markerClusterer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.markerClusterer),Za(this.registeredEvents),this.state.markerClusterer.setMap(null))}render(){return this.state.markerClusterer!==null?this.props.children(this.state.markerClusterer):null}}mo(d0t,"contextType",Ra);function JEe(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}var f0t=function(){function t(e){e===void 0&&(e={}),this.getCloseClickHandler=this.getCloseClickHandler.bind(this),this.closeClickHandler=this.closeClickHandler.bind(this),this.createInfoBoxDiv=this.createInfoBoxDiv.bind(this),this.addClickHandler=this.addClickHandler.bind(this),this.getCloseBoxImg=this.getCloseBoxImg.bind(this),this.getBoxWidths=this.getBoxWidths.bind(this),this.setBoxStyle=this.setBoxStyle.bind(this),this.setPosition=this.setPosition.bind(this),this.getPosition=this.getPosition.bind(this),this.setOptions=this.setOptions.bind(this),this.setContent=this.setContent.bind(this),this.setVisible=this.setVisible.bind(this),this.getContent=this.getContent.bind(this),this.getVisible=this.getVisible.bind(this),this.setZIndex=this.setZIndex.bind(this),this.getZIndex=this.getZIndex.bind(this),this.onRemove=this.onRemove.bind(this),this.panBox=this.panBox.bind(this),this.extend=this.extend.bind(this),this.close=this.close.bind(this),this.draw=this.draw.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.open=this.open.bind(this),this.extend(t,google.maps.OverlayView),this.content=e.content||"",this.disableAutoPan=e.disableAutoPan||!1,this.maxWidth=e.maxWidth||0,this.pixelOffset=e.pixelOffset||new google.maps.Size(0,0),this.position=e.position||new google.maps.LatLng(0,0),this.zIndex=e.zIndex||null,this.boxClass=e.boxClass||"infoBox",this.boxStyle=e.boxStyle||{},this.closeBoxMargin=e.closeBoxMargin||"2px",this.closeBoxURL=e.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",e.closeBoxURL===""&&(this.closeBoxURL=""),this.infoBoxClearance=e.infoBoxClearance||new google.maps.Size(1,1),typeof e.visible>"u"&&(typeof e.isHidden>"u"?e.visible=!0:e.visible=!e.isHidden),this.isHidden=!e.visible,this.alignBottom=e.alignBottom||!1,this.pane=e.pane||"floatPane",this.enableEventPropagation=e.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var e=this,n=function(u){u.returnValue=!1,u.preventDefault&&u.preventDefault(),e.enableEventPropagation||JEe(u)};if(!this.div){this.div=document.createElement("div"),this.setBoxStyle(),typeof this.content=="string"?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content));var o=this.getPanes();if(o!==null&&o[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(this.maxWidth!==0&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var r=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-r.left-r.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var i=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],a=0,l=i;al&&(o=w.x+d+c+p-l),this.alignBottom?w.y<-u+m+f?r=w.y+u-m-f:w.y+u+m>s&&(r=w.y+u+m-s):w.y<-u+m?r=w.y+u-m:w.y+f+u+m>s&&(r=w.y+f+u+m-s)),o===0&&r===0||n.panBy(o,r)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var e=this.boxStyle;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.div.style[n]=e[n]);if(this.div.style.webkitTransform="translateZ(0)",typeof this.div.style.opacity<"u"&&this.div.style.opacity!==""){var o=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+o*100+')"',this.div.style.filter="alpha(opacity="+o*100+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",this.zIndex!==null&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var e={top:0,bottom:0,left:0,right:0};if(!this.div)return e;if(document.defaultView){var n=this.div.ownerDocument,o=n&&n.defaultView?n.defaultView.getComputedStyle(this.div,""):null;o&&(e.top=parseInt(o.borderTopWidth||"",10)||0,e.bottom=parseInt(o.borderBottomWidth||"",10)||0,e.left=parseInt(o.borderLeftWidth||"",10)||0,e.right=parseInt(o.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var r=this.div.currentStyle;r&&(e.top=parseInt(r.borderTopWidth||"",10)||0,e.bottom=parseInt(r.borderBottomWidth||"",10)||0,e.left=parseInt(r.borderLeftWidth||"",10)||0,e.right=parseInt(r.borderRightWidth||"",10)||0)}return e},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var e=this.getProjection(),n=e.fromLatLngToDivPixel(this.position);n!==null&&(this.div.style.left=n.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(n.y+this.pixelOffset.height)+"px":this.div.style.top=n.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(e){e===void 0&&(e={}),typeof e.boxClass<"u"&&(this.boxClass=e.boxClass,this.setBoxStyle()),typeof e.boxStyle<"u"&&(this.boxStyle=e.boxStyle,this.setBoxStyle()),typeof e.content<"u"&&this.setContent(e.content),typeof e.disableAutoPan<"u"&&(this.disableAutoPan=e.disableAutoPan),typeof e.maxWidth<"u"&&(this.maxWidth=e.maxWidth),typeof e.pixelOffset<"u"&&(this.pixelOffset=e.pixelOffset),typeof e.alignBottom<"u"&&(this.alignBottom=e.alignBottom),typeof e.position<"u"&&this.setPosition(e.position),typeof e.zIndex<"u"&&this.setZIndex(e.zIndex),typeof e.closeBoxMargin<"u"&&(this.closeBoxMargin=e.closeBoxMargin),typeof e.closeBoxURL<"u"&&(this.closeBoxURL=e.closeBoxURL),typeof e.infoBoxClearance<"u"&&(this.infoBoxClearance=e.infoBoxClearance),typeof e.isHidden<"u"&&(this.isHidden=e.isHidden),typeof e.visible<"u"&&(this.isHidden=!e.visible),typeof e.enableEventPropagation<"u"&&(this.enableEventPropagation=e.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(e){this.content=e,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px",typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(e){this.position=e,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(e){this.isHidden=!e,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(e){this.zIndex=e,this.div&&(this.div.style.zIndex=e+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var e=this.getMap();return typeof e>"u"||e===null?!1:!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(e,n){var o=this;n&&(this.position=n.getPosition(),this.moveListener=google.maps.event.addListener(n,"position_changed",function(){var r=n.getPosition();o.setPosition(r)}),this.mapListener=google.maps.event.addListener(n,"map_changed",function(){o.setMap(n.map)})),this.setMap(e),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var e=0,n=this.eventListeners;e{p&&m!==null&&(m.close(),n?m.open(p,n):m.getPosition()&&m.open(p))},[p,m,n]),g.useEffect(()=>{o&&m!==null&&m.setOptions(o)},[m,o]),g.useEffect(()=>{if(r&&m!==null){var D=r instanceof google.maps.LatLng?r:new google.maps.LatLng(r.lat,r.lng);m.setPosition(D)}},[r]),g.useEffect(()=>{typeof i=="number"&&m!==null&&m.setZIndex(i)},[i]),g.useEffect(()=>{m&&a&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(m,"closeclick",a)))},[a]),g.useEffect(()=>{m&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(m,"domready",l)))},[l]),g.useEffect(()=>{m&&s&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(m,"content_changed",s)))},[s]),g.useEffect(()=>{m&&c&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(m,"position_changed",c)))},[c]),g.useEffect(()=>{m&&u&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(m,"zindex_changed",u)))},[u]),g.useEffect(()=>{if(p){var D=o||rbo,{position:k}=D,N=k4e(D,nbo),U;k&&!(k instanceof google.maps.LatLng)&&(U=new google.maps.LatLng(k.lat,k.lng));var W=new f0t(DK(DK({},N),U?{position:U}:{}));M.current=document.createElement("div"),y(W),a&&x(google.maps.event.addListener(W,"closeclick",a)),l&&P(google.maps.event.addListener(W,"domready",l)),s&&S(google.maps.event.addListener(W,"content_changed",s)),c&&b(google.maps.event.addListener(W,"position_changed",c)),u&&R(google.maps.event.addListener(W,"zindex_changed",u)),W.setContent(M.current),n?W.open(p,n):W.getPosition()?W.open(p):od(!1,"You must provide either an anchor or a position prop for ."),d&&d(W)}return()=>{m!==null&&(w&&google.maps.event.removeListener(w),A&&google.maps.event.removeListener(A),C&&google.maps.event.removeListener(C),v&&google.maps.event.removeListener(v),T&&google.maps.event.removeListener(T),f&&f(m),m.close())}},[]),M.current?r0.createPortal(g.Children.only(e),M.current):null}g.memo(ibo);class abo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",null),mo(this,"state",{infoBox:null}),mo(this,"open",(e,n)=>{n?this.context!==null&&e.open(this.context,n):e.getPosition()?this.context!==null&&e.open(this.context):od(!1,"You must provide either an anchor or a position prop for .")}),mo(this,"setInfoBoxCallback",()=>{this.state.infoBox!==null&&this.containerElement!==null&&(this.state.infoBox.setContent(this.containerElement),this.open(this.state.infoBox,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoBox))})}componentDidMount(){var e=this.props.options||{},{position:n}=e,o=k4e(e,obo),r;n&&!(n instanceof google.maps.LatLng)&&(r=new google.maps.LatLng(n.lat,n.lng));var i=new f0t(DK(DK({},o),r?{position:r}:{}));this.containerElement=document.createElement("div"),this.registeredEvents=Va({updaterMap:qEe,eventMap:$Ee,prevProps:{},nextProps:this.props,instance:i}),this.setState({infoBox:i},this.setInfoBoxCallback)}componentDidUpdate(e){var{infoBox:n}=this.state;n!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:qEe,eventMap:$Ee,prevProps:e,nextProps:this.props,instance:n}))}componentWillUnmount(){var{onUnmount:e}=this.props,{infoBox:n}=this.state;n!==null&&(e&&e(n),Za(this.registeredEvents),n.close())}render(){return this.containerElement?r0.createPortal(g.Children.only(this.props.children),this.containerElement):null}}mo(abo,"contextType",Ra);var Vce,QEe;function lbo(){return QEe||(QEe=1,Vce=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n}),Vce}var sbo=lbo(),ZEe=o0t(sbo),eke=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Gce=1,xE=8;class F4e{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var[n,o]=new Uint8Array(e,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");var r=o>>4;if(r!==Gce)throw new Error("Got v".concat(r," data when expected v").concat(Gce,"."));var i=eke[o&15];if(!i)throw new Error("Unrecognized array type.");var[a]=new Uint16Array(e,2,1),[l]=new Uint32Array(e,4,1);return new F4e(l,a,i,e)}constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:64,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float64Array,r=arguments.length>3?arguments[3]:void 0;if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;var i=eke.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(i<0)throw new Error("Unexpected typed array class: ".concat(o,"."));r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,xE,e),this.coords=new this.ArrayType(this.data,xE+l+s,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(xE+a+l+s),this.ids=new this.IndexArrayType(this.data,xE,e),this.coords=new this.ArrayType(this.data,xE+l+s,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Gce<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){var o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=n,o}finish(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return O1e(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,o,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:i,coords:a,nodeSize:l}=this,s=[0,i.length-1,0],c=[];s.length;){var u=s.pop()||0,d=s.pop()||0,f=s.pop()||0;if(d-f<=l){for(var p=f;p<=d;p++){var m=a[2*p],y=a[2*p+1];m>=e&&m<=o&&y>=n&&y<=r&&c.push(i[p])}continue}var w=f+d>>1,x=a[2*w],C=a[2*w+1];x>=e&&x<=o&&C>=n&&C<=r&&c.push(i[w]),(u===0?e<=x:n<=C)&&(s.push(f),s.push(w-1),s.push(1-u)),(u===0?o>=x:r>=C)&&(s.push(w+1),s.push(d),s.push(1-u))}return c}within(e,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:r,coords:i,nodeSize:a}=this,l=[0,r.length-1,0],s=[],c=o*o;l.length;){var u=l.pop()||0,d=l.pop()||0,f=l.pop()||0;if(d-f<=a){for(var p=f;p<=d;p++)tke(i[2*p],i[2*p+1],e,n)<=c&&s.push(r[p]);continue}var m=f+d>>1,y=i[2*m],w=i[2*m+1];tke(y,w,e,n)<=c&&s.push(r[m]),(u===0?e-o<=y:n-o<=w)&&(l.push(f),l.push(m-1),l.push(1-u)),(u===0?e+o>=y:n+o>=w)&&(l.push(m+1),l.push(d),l.push(1-u))}return s}}function O1e(t,e,n,o,r,i){if(!(r-o<=n)){var a=o+r>>1;h0t(t,e,a,o,r,i),O1e(t,e,n,o,a-1,1-i),O1e(t,e,n,a+1,r,1-i)}}function h0t(t,e,n,o,r,i){for(;r>o;){if(r-o>600){var a=r-o+1,l=n-o+1,s=Math.log(a),c=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*c*(a-c)/a)*(l-a/2<0?-1:1),d=Math.max(o,Math.floor(n-l*c/a+u)),f=Math.min(r,Math.floor(n+(a-l)*c/a+u));h0t(t,e,n,d,f,i)}var p=e[2*n+i],m=o,y=r;for(vE(t,e,o,n),e[2*r+i]>p&&vE(t,e,o,r);mp;)y--}e[2*o+i]===p?vE(t,e,o,y):(y++,vE(t,e,y,r)),y<=n&&(o=y+1),n<=y&&(r=y-1)}}function vE(t,e,n,o){Xce(t,n,o),Xce(e,2*n,2*o),Xce(e,2*n+1,2*o+1)}function Xce(t,e,n){var o=t[e];t[e]=t[n],t[n]=o}function tke(t,e,n,o){var r=t-n,i=e-o;return r*r+i*i}var cbo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},nke=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),ev=2,_w=3,Jce=4,Fw=5,p0t=6;class ubo{constructor(e){this.options=Object.assign(Object.create(cbo),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){var{log:n,minZoom:o,maxZoom:r}=this.options;n&&console.time("total time");var i="prepare ".concat(e.length," points");n&&console.time(i),this.points=e;for(var a=[],l=0;l=o;m--){var y=+Date.now();p=this.trees[m]=this._createTree(this._cluster(p,m)),n&&console.log("z%d: %d clusters in %dms",m,p.numItems,+Date.now()-y)}return n&&console.timeEnd("total time"),this}getClusters(e,n){var o=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,i=180;else if(o>i){var l=this.getClusters([o,r,180,a],n),s=this.getClusters([-180,r,i,a],n);return l.concat(s)}var c=this.trees[this._limitZoom(n)],u=c.range(lV(o),sV(a),lV(i),sV(r)),d=c.data,f=[];for(var p of u){var m=this.stride*p;f.push(d[m+Fw]>1?oke(d,m,this.clusterProps):this.points[d[m+_w]])}return f}getChildren(e){var n=this._getOriginId(e),o=this._getOriginZoom(e),r="No cluster with the specified id.",i=this.trees[o];if(!i)throw new Error(r);var a=i.data;if(n*this.stride>=a.length)throw new Error(r);var l=this.options.radius/(this.options.extent*Math.pow(2,o-1)),s=a[n*this.stride],c=a[n*this.stride+1],u=i.within(s,c,l),d=[];for(var f of u){var p=f*this.stride;a[p+Jce]===e&&d.push(a[p+Fw]>1?oke(a,p,this.clusterProps):this.points[a[p+_w]])}if(d.length===0)throw new Error(r);return d}getLeaves(e,n,o){n=n||10,o=o||0;var r=[];return this._appendLeaves(r,e,n,o,0),r}getTile(e,n,o){var r=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:a,radius:l}=this.options,s=l/a,c=(o-s)/i,u=(o+1+s)/i,d={features:[]};return this._addTileFeatures(r.range((n-s)/i,c,(n+1+s)/i,u),r.data,n,o,i,d),n===0&&this._addTileFeatures(r.range(1-s/i,c,1,u),r.data,i,o,i,d),n===i-1&&this._addTileFeatures(r.range(0,c,s/i,u),r.data,-1,o,i,d),d.features.length?d:null}getClusterExpansionZoom(e){for(var n=this._getOriginZoom(e)-1;n<=this.options.maxZoom;){var o=this.getChildren(e);if(n++,o.length!==1)break;e=o[0].properties.cluster_id}return n}_appendLeaves(e,n,o,r,i){var a=this.getChildren(n);for(var l of a){var s=l.properties;if(s&&s.cluster?i+s.point_count<=r?i+=s.point_count:i=this._appendLeaves(e,s.cluster_id,o,r,i):i1,u=void 0,d=void 0,f=void 0;if(c)u=g0t(n,s,this.clusterProps),d=n[s],f=n[s+1];else{var p=this.points[n[s+_w]];u=p.properties;var[m,y]=p.geometry.coordinates;d=lV(m),f=sV(y)}var w={type:1,geometry:[[Math.round(this.options.extent*(d*i-o)),Math.round(this.options.extent*(f*i-r))]],tags:u},x=void 0;c||this.options.generateId?x=n[s+_w]:x=this.points[n[s+_w]].id,x!==void 0&&(w.id=x),a.features.push(w)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,n){for(var{radius:o,extent:r,reduce:i,minPoints:a}=this.options,l=o/(r*Math.pow(2,n)),s=e.data,c=[],u=this.stride,d=0;dn&&(w+=s[C+Fw])}if(w>y&&w>=a){var P=f*y,A=p*y,S=void 0,v=-1,b=((d/u|0)<<5)+(n+1)+this.points.length;for(var T of m){var R=T*u;if(!(s[R+ev]<=n)){s[R+ev]=n;var M=s[R+Fw];P+=s[R]*M,A+=s[R+1]*M,s[R+Jce]=b,i&&(S||(S=this._map(s,d,!0),v=this.clusterProps.length,this.clusterProps.push(S)),i(S,this._map(s,R)))}}s[d+Jce]=b,c.push(P/w,A/w,1/0,b,-1,w),i&&c.push(v)}else{for(var D=0;D1)for(var k of m){var N=k*u;if(!(s[N+ev]<=n)){s[N+ev]=n;for(var U=0;U>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,n,o){if(e[n+Fw]>1){var r=this.clusterProps[e[n+p0t]];return o?Object.assign({},r):r}var i=this.points[e[n+_w]].properties,a=this.options.map(i);return o&&a===i?Object.assign({},a):a}}function oke(t,e,n){return{type:"Feature",id:t[e+_w],properties:g0t(t,e,n),geometry:{type:"Point",coordinates:[dbo(t[e]),fbo(t[e+1])]}}}function g0t(t,e,n){var o=t[e+Fw],r=o>=1e4?"".concat(Math.round(o/1e3),"k"):o>=1e3?"".concat(Math.round(o/100)/10,"k"):o,i=t[e+p0t],a=i===-1?{}:Object.assign({},n[i]);return Object.assign(a,{cluster:!0,cluster_id:t[e+_w],point_count:o,point_count_abbreviated:r})}function lV(t){return t/360+.5}function sV(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function dbo(t){return(t-.5)*360}function fbo(t){var e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -7232,7 +7232,7 @@ PERFORMANCE OF THIS SOFTWARE. `).concat(r,` -`),s="Cluster of ".concat(r," markers"),c=Number(google.maps.Marker.MAX_ZINDEX)+r;if(Kg.isAdvancedMarkerAvailable(o)){var u=new DOMParser,d=u.parseFromString(l,"image/svg+xml").documentElement;d.setAttribute("transform","translate(0 25)");var f={map:o,position:i,zIndex:c,title:s,content:d};return new google.maps.marker.AdvancedMarkerElement(f)}var p={position:i,zIndex:c,title:s,icon:{url:"data:image/svg+xml;base64,".concat(btoa(l)),anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(p)}}function wbo(t,e){for(var n in e.prototype)t.prototype[n]=e.prototype[n]}class L4e{constructor(){wbo(L4e,google.maps.OverlayView)}}var lF;(function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click"})(lF||(lF={}));var xbo=(t,e,n)=>{n.fitBounds(e.bounds)};class vbo extends L4e{constructor(e){var{map:n,markers:o=[],algorithmOptions:r={},algorithm:i=new mbo(r),renderer:a=new Abo,onClusterClick:l=xbo}=e;super(),this.markers=[...o],this.clusters=[],this.algorithm=i,this.renderer=a,this.onClusterClick=l,n&&this.setMap(n)}addMarker(e,n){this.markers.includes(e)||(this.markers.push(e),n||this.render())}addMarkers(e,n){e.forEach(o=>{this.addMarker(o,!0)}),n||this.render()}removeMarker(e,n){var o=this.markers.indexOf(e);return o===-1?!1:(Kg.setMap(e,null),this.markers.splice(o,1),n||this.render(),!0)}removeMarkers(e,n){var o=!1;return e.forEach(r=>{o=this.removeMarker(r,!0)||o}),o&&!n&&this.render(),o}clearMarkers(e){this.markers.length=0,e||this.render()}render(){var e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,lF.CLUSTERING_BEGIN,this);var{clusters:n,changed:o}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(o||o==null){var r=new Set;for(var i of n)i.markers.length==1&&r.add(i.markers[0]);var a=[];for(var l of this.clusters)l.marker!=null&&(l.markers.length==1?r.has(l.marker)||Kg.setMap(l.marker,null):a.push(l.marker));this.clusters=n,this.renderClusters(),requestAnimationFrame(()=>a.forEach(s=>Kg.setMap(s,null)))}google.maps.event.trigger(this,lF.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(e=>Kg.setMap(e,null)),this.clusters.forEach(e=>e.delete()),this.clusters=[]}renderClusters(){var e=new ybo(this.markers,this.clusters),n=this.getMap();this.clusters.forEach(o=>{o.markers.length===1?o.marker=o.markers[0]:(o.marker=this.renderer.render(o,e,n),o.markers.forEach(r=>Kg.setMap(r,null)),this.onClusterClick&&o.marker.addListener("click",r=>{google.maps.event.trigger(this,lF.CLUSTER_CLICK,o),this.onClusterClick(r,o,n)})),Kg.setMap(o.marker,n)})}}function rke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function ike(t){for(var e=1;e{if(e&&n===null){var r=new vbo(ike(ike({},t),{},{map:e}));o(r)}},[e]),n}function Sbo(t){var{children:e,options:n}=t,o=bbo(n);return o!==null?e(o):null}g.memo(Sbo);var ake={onCloseClick:"closeclick",onContentChanged:"content_changed",onDomReady:"domready",onPositionChanged:"position_changed",onZindexChanged:"zindex_changed"},lke={options(t,e){t.setOptions(e)},position(t,e){t.setPosition(e)},zIndex(t,e){t.setZIndex(e)}};function Tbo(t){var{children:e,anchor:n,options:o,position:r,zIndex:i,onCloseClick:a,onDomReady:l,onContentChanged:s,onPositionChanged:c,onZindexChanged:u,onLoad:d,onUnmount:f}=t,p=g.useContext(Ra),[m,y]=g.useState(null),[w,x]=g.useState(null),[C,P]=g.useState(null),[A,S]=g.useState(null),[v,b]=g.useState(null),[T,R]=g.useState(null),M=g.useRef(null);return g.useEffect(()=>{m!==null&&(m.close(),n?m.open(p,n):m.getPosition()&&m.open(p))},[p,m,n]),g.useEffect(()=>{o&&m!==null&&m.setOptions(o)},[m,o]),g.useEffect(()=>{r&&m!==null&&m.setPosition(r)},[r]),g.useEffect(()=>{typeof i=="number"&&m!==null&&m.setZIndex(i)},[i]),g.useEffect(()=>{m&&a&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(m,"closeclick",a)))},[a]),g.useEffect(()=>{m&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(m,"domready",l)))},[l]),g.useEffect(()=>{m&&s&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(m,"content_changed",s)))},[s]),g.useEffect(()=>{m&&c&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(m,"position_changed",c)))},[c]),g.useEffect(()=>{m&&u&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(m,"zindex_changed",u)))},[u]),g.useEffect(()=>{var D=new google.maps.InfoWindow(o);return y(D),M.current=document.createElement("div"),a&&x(google.maps.event.addListener(D,"closeclick",a)),l&&P(google.maps.event.addListener(D,"domready",l)),s&&S(google.maps.event.addListener(D,"content_changed",s)),c&&b(google.maps.event.addListener(D,"position_changed",c)),u&&R(google.maps.event.addListener(D,"zindex_changed",u)),D.setContent(M.current),r&&D.setPosition(r),i&&D.setZIndex(i),n?D.open(p,n):D.getPosition()?D.open(p):od(!1,"You must provide either an anchor (typically render it inside a ) or a position props for ."),d&&d(D),()=>{w&&google.maps.event.removeListener(w),A&&google.maps.event.removeListener(A),C&&google.maps.event.removeListener(C),v&&google.maps.event.removeListener(v),T&&google.maps.event.removeListener(T),f&&f(D),D.close()}},[]),M.current?r0.createPortal(g.Children.only(e),M.current):null}g.memo(Tbo);class m0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",null),mo(this,"state",{infoWindow:null}),mo(this,"open",(e,n)=>{n?e.open(this.context,n):e.getPosition()?e.open(this.context):od(!1,"You must provide either an anchor (typically render it inside a ) or a position props for .")}),mo(this,"setInfoWindowCallback",()=>{this.state.infoWindow!==null&&this.containerElement!==null&&(this.state.infoWindow.setContent(this.containerElement),this.open(this.state.infoWindow,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoWindow))})}componentDidMount(){var e=new google.maps.InfoWindow(this.props.options);this.containerElement=document.createElement("div"),this.registeredEvents=Va({updaterMap:lke,eventMap:ake,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({infoWindow:e}),this.setInfoWindowCallback)}componentDidUpdate(e){this.state.infoWindow!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:lke,eventMap:ake,prevProps:e,nextProps:this.props,instance:this.state.infoWindow}))}componentWillUnmount(){this.state.infoWindow!==null&&(Za(this.registeredEvents),this.props.onUnmount&&this.props.onUnmount(this.state.infoWindow),this.state.infoWindow.close())}render(){return this.containerElement?r0.createPortal(g.Children.only(this.props.children),this.containerElement):null}}mo(m0t,"contextType",Ra);function ske(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function EK(t){for(var e=1;e{A!==null&&A.setMap(P)},[P]),g.useEffect(()=>{typeof e<"u"&&A!==null&&A.setOptions(e)},[A,e]),g.useEffect(()=>{typeof n<"u"&&A!==null&&A.setDraggable(n)},[A,n]),g.useEffect(()=>{typeof o<"u"&&A!==null&&A.setEditable(o)},[A,o]),g.useEffect(()=>{typeof r<"u"&&A!==null&&A.setVisible(r)},[A,r]),g.useEffect(()=>{typeof i<"u"&&A!==null&&A.setPath(i)},[A,i]),g.useEffect(()=>{A&&a&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(A,"dblclick",a)))},[a]),g.useEffect(()=>{A&&l&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(A,"dragend",l)))},[l]),g.useEffect(()=>{A&&s&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(A,"dragstart",s)))},[s]),g.useEffect(()=>{A&&c&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(A,"mousedown",c)))},[c]),g.useEffect(()=>{A&&u&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(A,"mousemove",u)))},[u]),g.useEffect(()=>{A&&d&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(A,"mouseout",d)))},[d]),g.useEffect(()=>{A&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(A,"mouseover",f)))},[f]),g.useEffect(()=>{A&&p&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(A,"mouseup",p)))},[p]),g.useEffect(()=>{A&&m&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(A,"rightclick",m)))},[m]),g.useEffect(()=>{A&&y&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(A,"click",y)))},[y]),g.useEffect(()=>{A&&w&&(ee!==null&&google.maps.event.removeListener(ee),q(google.maps.event.addListener(A,"drag",w)))},[w]),g.useEffect(()=>{var ae=new google.maps.Polyline(EK(EK({},e||Pbo),{},{map:P}));return i&&ae.setPath(i),typeof r<"u"&&ae.setVisible(r),typeof o<"u"&&ae.setEditable(o),typeof n<"u"&&ae.setDraggable(n),a&&b(google.maps.event.addListener(ae,"dblclick",a)),l&&R(google.maps.event.addListener(ae,"dragend",l)),s&&D(google.maps.event.addListener(ae,"dragstart",s)),c&&N(google.maps.event.addListener(ae,"mousedown",c)),u&&W(google.maps.event.addListener(ae,"mousemove",u)),d&&E(google.maps.event.addListener(ae,"mouseout",d)),f&&j(google.maps.event.addListener(ae,"mouseover",f)),p&&O(google.maps.event.addListener(ae,"mouseup",p)),m&&G(google.maps.event.addListener(ae,"rightclick",m)),y&&oe(google.maps.event.addListener(ae,"click",y)),w&&q(google.maps.event.addListener(ae,"drag",w)),S(ae),x&&x(ae),()=>{v!==null&&google.maps.event.removeListener(v),T!==null&&google.maps.event.removeListener(T),M!==null&&google.maps.event.removeListener(M),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),_!==null&&google.maps.event.removeListener(_),Q!==null&&google.maps.event.removeListener(Q),C&&C(ae),ae.setMap(null)}},[]),null}g.memo(Cbo);class Rbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{polyline:null}),mo(this,"setPolylineCallback",()=>{this.state.polyline!==null&&this.props.onLoad&&this.props.onLoad(this.state.polyline)})}componentDidMount(){var e=new google.maps.Polyline(EK(EK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:uke,eventMap:cke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{polyline:e}},this.setPolylineCallback)}componentDidUpdate(e){this.state.polyline!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:uke,eventMap:cke,prevProps:e,nextProps:this.props,instance:this.state.polyline}))}componentWillUnmount(){this.state.polyline!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.polyline),Za(this.registeredEvents),this.state.polyline.setMap(null))}render(){return null}}mo(Rbo,"contextType",Ra);function dke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function fke(t){for(var e=1;e{v!==null&&v.setMap(S)},[S]),g.useEffect(()=>{typeof e<"u"&&v!==null&&v.setOptions(e)},[v,e]),g.useEffect(()=>{typeof n<"u"&&v!==null&&v.setDraggable(n)},[v,n]),g.useEffect(()=>{typeof o<"u"&&v!==null&&v.setEditable(o)},[v,o]),g.useEffect(()=>{typeof r<"u"&&v!==null&&v.setVisible(r)},[v,r]),g.useEffect(()=>{typeof i<"u"&&v!==null&&v.setPath(i)},[v,i]),g.useEffect(()=>{typeof a<"u"&&v!==null&&v.setPaths(a)},[v,a]),g.useEffect(()=>{v&&typeof l=="function"&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(v,"dblclick",l)))},[l]),g.useEffect(()=>{v&&(google.maps.event.addListener(v.getPath(),"insert_at",()=>{A==null||A(v)}),google.maps.event.addListener(v.getPath(),"set_at",()=>{A==null||A(v)}),google.maps.event.addListener(v.getPath(),"remove_at",()=>{A==null||A(v)}))},[v,A]),g.useEffect(()=>{v&&typeof s=="function"&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(v,"dragend",s)))},[s]),g.useEffect(()=>{v&&typeof c=="function"&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(v,"dragstart",c)))},[c]),g.useEffect(()=>{v&&typeof u=="function"&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(v,"mousedown",u)))},[u]),g.useEffect(()=>{v&&typeof d=="function"&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(v,"mousemove",d)))},[d]),g.useEffect(()=>{v&&typeof f=="function"&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(v,"mouseout",f)))},[f]),g.useEffect(()=>{v&&typeof p=="function"&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(v,"mouseover",p)))},[p]),g.useEffect(()=>{v&&typeof m=="function"&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(v,"mouseup",m)))},[m]),g.useEffect(()=>{v&&typeof y=="function"&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(v,"rightclick",y)))},[y]),g.useEffect(()=>{v&&typeof w=="function"&&(ee!==null&&google.maps.event.removeListener(ee),q(google.maps.event.addListener(v,"click",w)))},[w]),g.useEffect(()=>{v&&typeof x=="function"&&(ae!==null&&google.maps.event.removeListener(ae),Z(google.maps.event.addListener(v,"drag",x)))},[x]),g.useEffect(()=>{var ne=new google.maps.Polygon(fke(fke({},e),{},{map:S}));return i&&ne.setPath(i),a&&ne.setPaths(a),typeof r<"u"&&ne.setVisible(r),typeof o<"u"&&ne.setEditable(o),typeof n<"u"&&ne.setDraggable(n),l&&R(google.maps.event.addListener(ne,"dblclick",l)),s&&D(google.maps.event.addListener(ne,"dragend",s)),c&&N(google.maps.event.addListener(ne,"dragstart",c)),u&&W(google.maps.event.addListener(ne,"mousedown",u)),d&&E(google.maps.event.addListener(ne,"mousemove",d)),f&&j(google.maps.event.addListener(ne,"mouseout",f)),p&&O(google.maps.event.addListener(ne,"mouseover",p)),m&&G(google.maps.event.addListener(ne,"mouseup",m)),y&&oe(google.maps.event.addListener(ne,"rightclick",y)),w&&q(google.maps.event.addListener(ne,"click",w)),x&&Z(google.maps.event.addListener(ne,"drag",x)),b(ne),C&&C(ne),()=>{T!==null&&google.maps.event.removeListener(T),M!==null&&google.maps.event.removeListener(M),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),_!==null&&google.maps.event.removeListener(_),Q!==null&&google.maps.event.removeListener(Q),ee!==null&&google.maps.event.removeListener(ee),P&&P(ne),ne.setMap(null)}},[]),null}g.memo(Hbo);class Mbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[])}componentDidMount(){var e=this.props.options||{};this.polygon=new google.maps.Polygon(e),this.polygon.setMap(this.context),this.registeredEvents=Va({updaterMap:pke,eventMap:hke,prevProps:{},nextProps:this.props,instance:this.polygon}),this.props.onLoad&&this.props.onLoad(this.polygon)}componentDidUpdate(e){this.polygon&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:pke,eventMap:hke,prevProps:e,nextProps:this.props,instance:this.polygon}))}componentWillUnmount(){this.polygon&&(this.props.onUnmount&&this.props.onUnmount(this.polygon),Za(this.registeredEvents),this.polygon&&this.polygon.setMap(null))}render(){return null}}mo(Mbo,"contextType",Ra);function gke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function kK(t){for(var e=1;e{S!==null&&S.setMap(A)},[A]),g.useEffect(()=>{typeof e<"u"&&S!==null&&S.setOptions(e)},[S,e]),g.useEffect(()=>{typeof o<"u"&&S!==null&&S.setDraggable(o)},[S,o]),g.useEffect(()=>{typeof r<"u"&&S!==null&&S.setEditable(r)},[S,r]),g.useEffect(()=>{typeof i<"u"&&S!==null&&S.setVisible(i)},[S,i]),g.useEffect(()=>{typeof n<"u"&&S!==null&&S.setBounds(n)},[S,n]),g.useEffect(()=>{S&&a&&(b!==null&&google.maps.event.removeListener(b),T(google.maps.event.addListener(S,"dblclick",a)))},[a]),g.useEffect(()=>{S&&l&&(R!==null&&google.maps.event.removeListener(R),M(google.maps.event.addListener(S,"dragend",l)))},[l]),g.useEffect(()=>{S&&s&&(D!==null&&google.maps.event.removeListener(D),k(google.maps.event.addListener(S,"dragstart",s)))},[s]),g.useEffect(()=>{S&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(S,"mousedown",c)))},[c]),g.useEffect(()=>{S&&u&&(W!==null&&google.maps.event.removeListener(W),F(google.maps.event.addListener(S,"mousemove",u)))},[u]),g.useEffect(()=>{S&&d&&(E!==null&&google.maps.event.removeListener(E),L(google.maps.event.addListener(S,"mouseout",d)))},[d]),g.useEffect(()=>{S&&f&&(j!==null&&google.maps.event.removeListener(j),Y(google.maps.event.addListener(S,"mouseover",f)))},[f]),g.useEffect(()=>{S&&p&&(O!==null&&google.maps.event.removeListener(O),_(google.maps.event.addListener(S,"mouseup",p)))},[p]),g.useEffect(()=>{S&&m&&(G!==null&&google.maps.event.removeListener(G),Q(google.maps.event.addListener(S,"rightclick",m)))},[m]),g.useEffect(()=>{S&&y&&(oe!==null&&google.maps.event.removeListener(oe),ee(google.maps.event.addListener(S,"click",y)))},[y]),g.useEffect(()=>{S&&w&&(q!==null&&google.maps.event.removeListener(q),ae(google.maps.event.addListener(S,"drag",w)))},[w]),g.useEffect(()=>{S&&x&&(Z!==null&&google.maps.event.removeListener(Z),ne(google.maps.event.addListener(S,"bounds_changed",x)))},[x]),g.useEffect(()=>{var te=new google.maps.Rectangle(kK(kK({},e),{},{map:A}));return typeof i<"u"&&te.setVisible(i),typeof r<"u"&&te.setEditable(r),typeof o<"u"&&te.setDraggable(o),typeof n<"u"&&te.setBounds(n),a&&T(google.maps.event.addListener(te,"dblclick",a)),l&&M(google.maps.event.addListener(te,"dragend",l)),s&&k(google.maps.event.addListener(te,"dragstart",s)),c&&U(google.maps.event.addListener(te,"mousedown",c)),u&&F(google.maps.event.addListener(te,"mousemove",u)),d&&L(google.maps.event.addListener(te,"mouseout",d)),f&&Y(google.maps.event.addListener(te,"mouseover",f)),p&&_(google.maps.event.addListener(te,"mouseup",p)),m&&Q(google.maps.event.addListener(te,"rightclick",m)),y&&ee(google.maps.event.addListener(te,"click",y)),w&&ae(google.maps.event.addListener(te,"drag",w)),x&&ne(google.maps.event.addListener(te,"bounds_changed",x)),v(te),C&&C(te),()=>{b!==null&&google.maps.event.removeListener(b),R!==null&&google.maps.event.removeListener(R),D!==null&&google.maps.event.removeListener(D),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),E!==null&&google.maps.event.removeListener(E),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),oe!==null&&google.maps.event.removeListener(oe),q!==null&&google.maps.event.removeListener(q),Z!==null&&google.maps.event.removeListener(Z),P&&P(te),te.setMap(null)}},[]),null}g.memo(Ibo);let zbo=class extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{rectangle:null}),mo(this,"setRectangleCallback",()=>{this.state.rectangle!==null&&this.props.onLoad&&this.props.onLoad(this.state.rectangle)})}componentDidMount(){var e=new google.maps.Rectangle(kK(kK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:yke,eventMap:mke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{rectangle:e}},this.setRectangleCallback)}componentDidUpdate(e){this.state.rectangle!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:yke,eventMap:mke,prevProps:e,nextProps:this.props,instance:this.state.rectangle}))}componentWillUnmount(){this.state.rectangle!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.rectangle),Za(this.registeredEvents),this.state.rectangle.setMap(null))}render(){return null}};mo(zbo,"contextType",Ra);function Ake(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function FK(t){for(var e=1;e{b!==null&&b.setMap(v)},[v]),g.useEffect(()=>{typeof e<"u"&&b!==null&&b.setOptions(e)},[b,e]),g.useEffect(()=>{typeof r<"u"&&b!==null&&b.setDraggable(r)},[b,r]),g.useEffect(()=>{typeof i<"u"&&b!==null&&b.setEditable(i)},[b,i]),g.useEffect(()=>{typeof a<"u"&&b!==null&&b.setVisible(a)},[b,a]),g.useEffect(()=>{typeof o=="number"&&b!==null&&b.setRadius(o)},[b,o]),g.useEffect(()=>{typeof n<"u"&&b!==null&&b.setCenter(n)},[b,n]),g.useEffect(()=>{b&&l&&(R!==null&&google.maps.event.removeListener(R),M(google.maps.event.addListener(b,"dblclick",l)))},[l]),g.useEffect(()=>{b&&s&&(D!==null&&google.maps.event.removeListener(D),k(google.maps.event.addListener(b,"dragend",s)))},[s]),g.useEffect(()=>{b&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(b,"dragstart",c)))},[c]),g.useEffect(()=>{b&&u&&(W!==null&&google.maps.event.removeListener(W),F(google.maps.event.addListener(b,"mousedown",u)))},[u]),g.useEffect(()=>{b&&d&&(E!==null&&google.maps.event.removeListener(E),L(google.maps.event.addListener(b,"mousemove",d)))},[d]),g.useEffect(()=>{b&&f&&(j!==null&&google.maps.event.removeListener(j),Y(google.maps.event.addListener(b,"mouseout",f)))},[f]),g.useEffect(()=>{b&&p&&(O!==null&&google.maps.event.removeListener(O),_(google.maps.event.addListener(b,"mouseover",p)))},[p]),g.useEffect(()=>{b&&m&&(G!==null&&google.maps.event.removeListener(G),Q(google.maps.event.addListener(b,"mouseup",m)))},[m]),g.useEffect(()=>{b&&y&&(oe!==null&&google.maps.event.removeListener(oe),ee(google.maps.event.addListener(b,"rightclick",y)))},[y]),g.useEffect(()=>{b&&w&&(q!==null&&google.maps.event.removeListener(q),ae(google.maps.event.addListener(b,"click",w)))},[w]),g.useEffect(()=>{b&&x&&(Z!==null&&google.maps.event.removeListener(Z),ne(google.maps.event.addListener(b,"drag",x)))},[x]),g.useEffect(()=>{b&&C&&(te!==null&&google.maps.event.removeListener(te),$(google.maps.event.addListener(b,"center_changed",C)))},[w]),g.useEffect(()=>{b&&P&&(le!==null&&google.maps.event.removeListener(le),de(google.maps.event.addListener(b,"radius_changed",P)))},[P]),g.useEffect(()=>{var he=new google.maps.Circle(FK(FK({},e||Dbo),{},{map:v}));return typeof o=="number"&&he.setRadius(o),typeof n<"u"&&he.setCenter(n),typeof o=="number"&&he.setRadius(o),typeof a<"u"&&he.setVisible(a),typeof i<"u"&&he.setEditable(i),typeof r<"u"&&he.setDraggable(r),l&&M(google.maps.event.addListener(he,"dblclick",l)),s&&k(google.maps.event.addListener(he,"dragend",s)),c&&U(google.maps.event.addListener(he,"dragstart",c)),u&&F(google.maps.event.addListener(he,"mousedown",u)),d&&L(google.maps.event.addListener(he,"mousemove",d)),f&&Y(google.maps.event.addListener(he,"mouseout",f)),p&&_(google.maps.event.addListener(he,"mouseover",p)),m&&Q(google.maps.event.addListener(he,"mouseup",m)),y&&ee(google.maps.event.addListener(he,"rightclick",y)),w&&ae(google.maps.event.addListener(he,"click",w)),x&&ne(google.maps.event.addListener(he,"drag",x)),C&&$(google.maps.event.addListener(he,"center_changed",C)),P&&de(google.maps.event.addListener(he,"radius_changed",P)),T(he),A&&A(he),()=>{R!==null&&google.maps.event.removeListener(R),D!==null&&google.maps.event.removeListener(D),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),E!==null&&google.maps.event.removeListener(E),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),oe!==null&&google.maps.event.removeListener(oe),q!==null&&google.maps.event.removeListener(q),te!==null&&google.maps.event.removeListener(te),le!==null&&google.maps.event.removeListener(le),S&&S(he),he.setMap(null)}},[]),null}g.memo(Ebo);class kbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{circle:null}),mo(this,"setCircleCallback",()=>{this.state.circle!==null&&this.props.onLoad&&this.props.onLoad(this.state.circle)})}componentDidMount(){var e=new google.maps.Circle(FK(FK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:xke,eventMap:wke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{circle:e}},this.setCircleCallback)}componentDidUpdate(e){this.state.circle!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:xke,eventMap:wke,prevProps:e,nextProps:this.props,instance:this.state.circle}))}componentWillUnmount(){if(this.state.circle!==null){var e;this.props.onUnmount&&this.props.onUnmount(this.state.circle),Za(this.registeredEvents),(e=this.state.circle)===null||e===void 0||e.setMap(null)}}render(){return null}}mo(kbo,"contextType",Ra);function vke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function LK(t){for(var e=1;e{C!==null&&C.setMap(x)},[x]),g.useEffect(()=>{C&&o&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(C,"dblclick",o)))},[o]),g.useEffect(()=>{C&&r&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(C,"mousedown",r)))},[r]),g.useEffect(()=>{C&&i&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(C,"mousemove",i)))},[i]),g.useEffect(()=>{C&&a&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(C,"mouseout",a)))},[a]),g.useEffect(()=>{C&&l&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(C,"mouseover",l)))},[l]),g.useEffect(()=>{C&&s&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(C,"mouseup",s)))},[s]),g.useEffect(()=>{C&&c&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(C,"rightclick",c)))},[c]),g.useEffect(()=>{C&&n&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(C,"click",n)))},[n]),g.useEffect(()=>{C&&u&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(C,"addfeature",u)))},[u]),g.useEffect(()=>{C&&d&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(C,"removefeature",d)))},[d]),g.useEffect(()=>{C&&f&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(C,"removeproperty",f)))},[f]),g.useEffect(()=>{C&&p&&(ee!==null&&google.maps.event.removeListener(ee),q(google.maps.event.addListener(C,"setgeometry",p)))},[p]),g.useEffect(()=>{C&&m&&(ae!==null&&google.maps.event.removeListener(ae),Z(google.maps.event.addListener(C,"setproperty",m)))},[m]),g.useEffect(()=>{if(x!==null){var ne=new google.maps.Data(LK(LK({},e),{},{map:x}));o&&S(google.maps.event.addListener(ne,"dblclick",o)),r&&b(google.maps.event.addListener(ne,"mousedown",r)),i&&R(google.maps.event.addListener(ne,"mousemove",i)),a&&D(google.maps.event.addListener(ne,"mouseout",a)),l&&N(google.maps.event.addListener(ne,"mouseover",l)),s&&W(google.maps.event.addListener(ne,"mouseup",s)),c&&E(google.maps.event.addListener(ne,"rightclick",c)),n&&j(google.maps.event.addListener(ne,"click",n)),u&&O(google.maps.event.addListener(ne,"addfeature",u)),d&&G(google.maps.event.addListener(ne,"removefeature",d)),f&&oe(google.maps.event.addListener(ne,"removeproperty",f)),p&&q(google.maps.event.addListener(ne,"setgeometry",p)),m&&Z(google.maps.event.addListener(ne,"setproperty",m)),P(ne),y&&y(ne)}return()=>{C&&(A!==null&&google.maps.event.removeListener(A),v!==null&&google.maps.event.removeListener(v),T!==null&&google.maps.event.removeListener(T),M!==null&&google.maps.event.removeListener(M),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),_!==null&&google.maps.event.removeListener(_),Q!==null&&google.maps.event.removeListener(Q),ee!==null&&google.maps.event.removeListener(ee),ae!==null&&google.maps.event.removeListener(ae),w&&w(C),C.setMap(null))}},[]),null}g.memo(Fbo);class Lbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{data:null}),mo(this,"setDataCallback",()=>{this.state.data!==null&&this.props.onLoad&&this.props.onLoad(this.state.data)})}componentDidMount(){if(this.context!==null){var e=new google.maps.Data(LK(LK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:Ske,eventMap:bke,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({data:e}),this.setDataCallback)}}componentDidUpdate(e){this.state.data!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Ske,eventMap:bke,prevProps:e,nextProps:this.props,instance:this.state.data}))}componentWillUnmount(){this.state.data!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.data),Za(this.registeredEvents),this.state.data&&this.state.data.setMap(null))}render(){return null}}mo(Lbo,"contextType",Ra);function Tke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Pke(t){for(var e=1;e{this.state.kmlLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.kmlLayer)})}componentDidMount(){var e=new google.maps.KmlLayer(Pke(Pke({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:Rke,eventMap:Cke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{kmlLayer:e}},this.setKmlLayerCallback)}componentDidUpdate(e){this.state.kmlLayer!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Rke,eventMap:Cke,prevProps:e,nextProps:this.props,instance:this.state.kmlLayer}))}componentWillUnmount(){this.state.kmlLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.kmlLayer),Za(this.registeredEvents),this.state.kmlLayer.setMap(null))}render(){return null}}mo(Wbo,"contextType",Ra);function y0t(t,e){return typeof e=="function"?e(t.offsetWidth,t.offsetHeight):{x:0,y:0}}function Nbo(t,e){return new e(t.lat,t.lng)}function Ubo(t,e){return new e(new google.maps.LatLng(t.ne.lat,t.ne.lng),new google.maps.LatLng(t.sw.lat,t.sw.lng))}function jbo(t,e,n){return t instanceof e?t:n(t,e)}function Bbo(t,e,n){return t instanceof e?t:n(t,e)}function Ybo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n.getNorthEast()),r=t&&t.fromLatLngToDivPixel(n.getSouthWest());return o&&r?{left:"".concat(r.x+e.x,"px"),top:"".concat(o.y+e.y,"px"),width:"".concat(o.x-r.x-e.x,"px"),height:"".concat(r.y-o.y-e.y,"px")}:{left:"-9999px",top:"-9999px"}}function Obo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n);if(o){var{x:r,y:i}=o;return{left:"".concat(r+e.x,"px"),top:"".concat(i+e.y,"px")}}return{left:"-9999px",top:"-9999px"}}function A0t(t,e,n,o){return n!==void 0?Ybo(t,e,Bbo(n,google.maps.LatLngBounds,Ubo)):Obo(t,e,jbo(o,google.maps.LatLng,Nbo))}function _bo(t,e){return t.left===e.left&&t.top===e.top&&t.width===e.height&&t.height===e.height}function Hke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Vbo(t){for(var e=1;e{var f=document.createElement("div");return f.style.position="absolute",f},[]),d=g.useMemo(()=>Gbo(u,o,e,n,l),[u,o,e,n]);return g.useEffect(()=>(i==null||i(d),d==null||d.setMap(c),()=>{a==null||a(d),d==null||d.setMap(null)}),[c,d]),g.useEffect(()=>{u.style.zIndex="".concat(r)},[r,u]),r0.createPortal(s,u)}g.memo(Jbo);class YI extends g.PureComponent{constructor(e){super(e),mo(this,"state",{paneEl:null,containerStyle:{position:"absolute"}}),mo(this,"updatePane",()=>{var o=this.props.mapPaneName,r=this.overlayView.getPanes();od(!!o,"OverlayView requires props.mapPaneName but got %s",o),r?this.setState({paneEl:r[o]}):this.setState({paneEl:null})}),mo(this,"onAdd",()=>{var o,r;this.updatePane(),(o=(r=this.props).onLoad)===null||o===void 0||o.call(r,this.overlayView)}),mo(this,"onPositionElement",()=>{var o=this.overlayView.getProjection(),r=Xbo({x:0,y:0},this.containerRef.current?y0t(this.containerRef.current,this.props.getPixelPositionOffset):{}),i=A0t(o,r,this.props.bounds,this.props.position);if(!_bo(i,{left:this.state.containerStyle.left,top:this.state.containerStyle.top,width:this.state.containerStyle.width,height:this.state.containerStyle.height})){var a,l,s,c;this.setState({containerStyle:{top:(a=i.top)!==null&&a!==void 0?a:0,left:(l=i.left)!==null&&l!==void 0?l:0,width:(s=i.width)!==null&&s!==void 0?s:0,height:(c=i.height)!==null&&c!==void 0?c:0,position:"absolute"}})}}),mo(this,"draw",()=>{this.onPositionElement()}),mo(this,"onRemove",()=>{var o,r;this.setState(()=>({paneEl:null})),(o=(r=this.props).onUnmount)===null||o===void 0||o.call(r,this.overlayView)}),this.containerRef=g.createRef();var n=new google.maps.OverlayView;n.onAdd=this.onAdd,n.draw=this.draw,n.onRemove=this.onRemove,this.overlayView=n}componentDidMount(){this.overlayView.setMap(this.context)}componentDidUpdate(e){var n=Ike(e.position),o=Ike(this.props.position),r=zke(e.bounds),i=zke(this.props.bounds);(n!==o||r!==i)&&this.overlayView.draw(),e.mapPaneName!==this.props.mapPaneName&&this.updatePane()}componentWillUnmount(){this.overlayView.setMap(null)}render(){var e=this.state.paneEl;return e?r0.createPortal(h.jsx("div",{ref:this.containerRef,style:this.state.containerStyle,children:g.Children.only(this.props.children)}),e):null}}mo(YI,"FLOAT_PANE","floatPane");mo(YI,"MAP_PANE","mapPane");mo(YI,"MARKER_LAYER","markerLayer");mo(YI,"OVERLAY_LAYER","overlayLayer");mo(YI,"OVERLAY_MOUSE_TARGET","overlayMouseTarget");mo(YI,"contextType",Ra);function Kbo(){}function Dke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Eke(t){for(var e=1;enew google.maps.GroundOverlay(e,a,o),[]);return g.useEffect(()=>{l!==null&&l.setMap(i)},[i]),g.useEffect(()=>{typeof e<"u"&&l!==null&&(l.set("url",e),l.setMap(i))},[l,e]),g.useEffect(()=>{typeof r<"u"&&l!==null&&l.setOpacity(r?1:0)},[l,r]),g.useEffect(()=>{var s=new google.maps.LatLngBounds(new google.maps.LatLng(n.south,n.west),new google.maps.LatLng(n.north,n.east));typeof n<"u"&&l!==null&&(l.set("bounds",s),l.setMap(i))},[l,n]),null}g.memo($bo);class w0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{groundOverlay:null}),mo(this,"setGroundOverlayCallback",()=>{this.state.groundOverlay!==null&&this.props.onLoad&&this.props.onLoad(this.state.groundOverlay)})}componentDidMount(){od(!!this.props.url||!!this.props.bounds,"For GroundOverlay, url and bounds are passed in to constructor and are immutable after instantiated. This is the behavior of Google Maps JavaScript API v3 ( See https://developers.google.com/maps/documentation/javascript/reference#GroundOverlay) Hence, use the corresponding two props provided by `react-google-maps-api`, url and bounds. In some cases, you'll need the GroundOverlay component to reflect the changes of url and bounds. You can leverage the React's key property to remount the component. Typically, just `key={url}` would serve your need. See https://github.com/tomchentw/react-google-maps/issues/655");var e=new google.maps.GroundOverlay(this.props.url,this.props.bounds,Eke(Eke({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:Fke,eventMap:kke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{groundOverlay:e}},this.setGroundOverlayCallback)}componentDidUpdate(e){this.state.groundOverlay!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Fke,eventMap:kke,prevProps:e,nextProps:this.props,instance:this.state.groundOverlay}))}componentWillUnmount(){this.state.groundOverlay&&(this.props.onUnmount&&this.props.onUnmount(this.state.groundOverlay),this.state.groundOverlay.setMap(null))}render(){return null}}mo(w0t,"defaultProps",{onLoad:Kbo});mo(w0t,"contextType",Ra);function Lke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function WK(t){for(var e=1;e{google.maps.visualization||od(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} in useJsApiScript? %s',google.maps.visualization)},[]),g.useEffect(()=>{od(!!e,"data property is required in HeatmapLayer %s",e)},[e]),g.useEffect(()=>{a!==null&&a.setMap(i)},[i]),g.useEffect(()=>{r&&a!==null&&a.setOptions(r)},[a,r]),g.useEffect(()=>{var s=new google.maps.visualization.HeatmapLayer(WK(WK({},r),{},{data:e,map:i}));return l(s),n&&n(s),()=>{a!==null&&(o&&o(a),a.setMap(null))}},[]),null}g.memo(qbo);class Qbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{heatmapLayer:null}),mo(this,"setHeatmapLayerCallback",()=>{this.state.heatmapLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.heatmapLayer)})}componentDidMount(){od(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} to ? %s',google.maps.visualization),od(!!this.props.data,"data property is required in HeatmapLayer %s",this.props.data);var e=new google.maps.visualization.HeatmapLayer(WK(WK({},this.props.options),{},{data:this.props.data,map:this.context}));this.registeredEvents=Va({updaterMap:Nke,eventMap:Wke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{heatmapLayer:e}},this.setHeatmapLayerCallback)}componentDidUpdate(e){Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Nke,eventMap:Wke,prevProps:e,nextProps:this.props,instance:this.state.heatmapLayer})}componentWillUnmount(){this.state.heatmapLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.heatmapLayer),Za(this.registeredEvents),this.state.heatmapLayer.setMap(null))}render(){return null}}mo(Qbo,"contextType",Ra);var Uke={onCloseClick:"closeclick",onPanoChanged:"pano_changed",onPositionChanged:"position_changed",onPovChanged:"pov_changed",onResize:"resize",onStatusChanged:"status_changed",onVisibleChanged:"visible_changed",onZoomChanged:"zoom_changed"},jke={register(t,e,n){t.registerPanoProvider(e,n)},links(t,e){t.setLinks(e)},motionTracking(t,e){t.setMotionTracking(e)},options(t,e){t.setOptions(e)},pano(t,e){t.setPano(e)},position(t,e){t.setPosition(e)},pov(t,e){t.setPov(e)},visible(t,e){t.setVisible(e)},zoom(t,e){t.setZoom(e)}};class Zbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{streetViewPanorama:null}),mo(this,"setStreetViewPanoramaCallback",()=>{this.state.streetViewPanorama!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewPanorama)})}componentDidMount(){var e,n,o=(e=(n=this.context)===null||n===void 0?void 0:n.getStreetView())!==null&&e!==void 0?e:null;this.registeredEvents=Va({updaterMap:jke,eventMap:Uke,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({streetViewPanorama:o}),this.setStreetViewPanoramaCallback)}componentDidUpdate(e){this.state.streetViewPanorama!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:jke,eventMap:Uke,prevProps:e,nextProps:this.props,instance:this.state.streetViewPanorama}))}componentWillUnmount(){this.state.streetViewPanorama!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.streetViewPanorama),Za(this.registeredEvents),this.state.streetViewPanorama.setVisible(!1))}render(){return null}}mo(Zbo,"contextType",Ra);class eSo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{streetViewService:null}),mo(this,"setStreetViewServiceCallback",()=>{this.state.streetViewService!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewService)})}componentDidMount(){var e=new google.maps.StreetViewService;this.setState(function(){return{streetViewService:e}},this.setStreetViewServiceCallback)}componentWillUnmount(){this.state.streetViewService!==null&&this.props.onUnmount&&this.props.onUnmount(this.state.streetViewService)}render(){return null}}mo(eSo,"contextType",Ra);var Bke={onDirectionsChanged:"directions_changed"},Yke={directions(t,e){t.setDirections(e)},map(t,e){t.setMap(e)},options(t,e){t.setOptions(e)},panel(t,e){t.setPanel(e)},routeIndex(t,e){t.setRouteIndex(e)}};class tSo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{directionsRenderer:null}),mo(this,"setDirectionsRendererCallback",()=>{this.state.directionsRenderer!==null&&(this.state.directionsRenderer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.directionsRenderer))})}componentDidMount(){var e=new google.maps.DirectionsRenderer(this.props.options);this.registeredEvents=Va({updaterMap:Yke,eventMap:Bke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{directionsRenderer:e}},this.setDirectionsRendererCallback)}componentDidUpdate(e){this.state.directionsRenderer!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Yke,eventMap:Bke,prevProps:e,nextProps:this.props,instance:this.state.directionsRenderer}))}componentWillUnmount(){this.state.directionsRenderer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.directionsRenderer),Za(this.registeredEvents),this.state.directionsRenderer&&this.state.directionsRenderer.setMap(null))}render(){return null}}mo(tSo,"contextType",Ra);var Oke={onPlacesChanged:"places_changed"},_ke={bounds(t,e){t.setBounds(e)}};class W4e extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",g.createRef()),mo(this,"state",{searchBox:null}),mo(this,"setSearchBoxCallback",()=>{this.state.searchBox!==null&&this.props.onLoad&&this.props.onLoad(this.state.searchBox)})}componentDidMount(){if(od(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places),this.containerElement!==null&&this.containerElement.current!==null){var e=this.containerElement.current.querySelector("input");if(e!==null){var n=new google.maps.places.SearchBox(e,this.props.options);this.registeredEvents=Va({updaterMap:_ke,eventMap:Oke,prevProps:{},nextProps:this.props,instance:n}),this.setState(function(){return{searchBox:n}},this.setSearchBoxCallback)}}}componentDidUpdate(e){this.state.searchBox!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:_ke,eventMap:Oke,prevProps:e,nextProps:this.props,instance:this.state.searchBox}))}componentWillUnmount(){this.state.searchBox!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.searchBox),Za(this.registeredEvents))}render(){return h.jsx("div",{ref:this.containerElement,children:g.Children.only(this.props.children)})}}mo(W4e,"contextType",Ra);var Vke={onPlaceChanged:"place_changed"},Gke={bounds(t,e){t.setBounds(e)},restrictions(t,e){t.setComponentRestrictions(e)},fields(t,e){t.setFields(e)},options(t,e){t.setOptions(e)},types(t,e){t.setTypes(e)}};class x0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",g.createRef()),mo(this,"state",{autocomplete:null}),mo(this,"setAutocompleteCallback",()=>{this.state.autocomplete!==null&&this.props.onLoad&&this.props.onLoad(this.state.autocomplete)})}componentDidMount(){var e;od(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places);var n=(e=this.containerElement.current)===null||e===void 0?void 0:e.querySelector("input");if(n){var o=new google.maps.places.Autocomplete(n,this.props.options);this.registeredEvents=Va({updaterMap:Gke,eventMap:Vke,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({autocomplete:o}),this.setAutocompleteCallback)}}componentDidUpdate(e){Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Gke,eventMap:Vke,prevProps:e,nextProps:this.props,instance:this.state.autocomplete})}componentWillUnmount(){this.state.autocomplete!==null&&Za(this.registeredEvents)}render(){return h.jsx("div",{ref:this.containerElement,className:this.props.className,children:g.Children.only(this.props.children)})}}mo(x0t,"defaultProps",{className:""});mo(x0t,"contextType",Ra);const Xke="/aladdin/assets/empty_heart-B57-2tMp.png",nSo="/aladdin/assets/red_heart-BaAtCixH.png",oSo="/aladdin/assets/open_file-B6scZwPU.png",rSo="/aladdin/assets/export_link-Dxa4UObV.png",iSo="/aladdin/assets/click_count-BZx6BgQJ.png";function cV(t){const e=new Date(t);if(!Number.isNaN(e.valueOf()))return e;const n=String(t).match(/\d+/g);if(n==null||n.length<=2)return e;{const[o,r,...i]=n.map(s=>parseInt(s)),a=[o,r-1,...i];return new Date(Date.UTC(...a))}}function Jke(t,e,n){const o=t!==1?e+"s":e;return t+" "+o+" "+n}function V1e(){return V1e=Object.assign?Object.assign.bind():function(t){for(var e=1;eDate.now();function lSo({date:t,formatter:e=Jke,component:n="time",live:o=!0,minPeriod:r=0,maxPeriod:i=uV,title:a,now:l=aSo,...s}){const[c,u]=g.useState(l());g.useEffect(()=>{if(!o)return;const S=(()=>{const v=cV(t).valueOf();if(!v)return console.warn("[react-timeago] Invalid Date provided"),0;const b=Math.round(Math.abs(c-v)/1e3),T=b{u(l())},R):0})();return()=>{S&&clearTimeout(S)}},[t,o,i,r,l,c]);const d=n,f=cV(t).valueOf();if(!f)return null;const p=Math.round(Math.abs(c-f)/1e3),m=f"u"?typeof t=="string"?t:cV(t).toISOString().substr(0,16).replace("T"," "):a,C=d==="time"?{...s,dateTime:cV(t).toISOString()}:s,P=Jke.bind(null,y,w,m);return g.createElement(d,V1e({},C,{title:x}),e(y,w,m,f,P,l))}function NK(){return NK=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}var cSo=["cdnSuffix","cdnUrl","countryCode","style","svg"],uSo="https://cdn.jsdelivr.net/gh/lipis/flag-icons/flags/4x3/",dSo="svg",fSo=127397,v0t=function(e){var n=e.cdnSuffix,o=n===void 0?dSo:n,r=e.cdnUrl,i=r===void 0?uSo:r,a=e.countryCode,l=e.style,s=e.svg,c=s===void 0?!1:s,u=sSo(e,cSo);if(typeof a!="string")return null;if(c){var d=""+i+a.toLowerCase()+"."+o;return g.createElement("img",Object.assign({},u,{src:d,style:NK({display:"inline-block",width:"1em",height:"1em",verticalAlign:"middle"},l)}))}var f=a.toUpperCase().replace(/./g,function(p){return String.fromCodePoint(p.charCodeAt(0)+fSo)});return g.createElement("span",Object.assign({role:"img"},u,{style:NK({display:"inline-block",fontSize:"1em",lineHeight:"1em",verticalAlign:"middle"},l)}),f)};const b0t=t=>{switch(t.type){case ga.PHOTOVOLTAIC:return lit;case ga.PARABOLIC_DISH:return sit;case ga.PARABOLIC_TROUGH:return cit;case ga.FRESNEL_REFLECTOR:return uit;case ga.SOLAR_POWER_TOWER:return dit;case ga.WIND_TURBINE:return pit;case ga.COLOCATION_PROJECTS:return git;case ga.RESIDENTIAL_BUILDING:return oit;case ga.COMMERCIAL_BUILDING:return rit;case ga.SCHOOL_BUILDING:return iit;case ga.TOURIST_ATTRACTION:return ait;case ga.UNDER_CONSTRUCTION:return fit}return hit},{Panel:hSo}=r9e,pSo=xe.memo(({latRef:t,lngRef:e,selectAuthor:n,closeMap:o,openModel:r,deleteModel:i,likeModel:a,pinModel:l})=>{var de;const s=H.getState().user,c=H(pn),u=H(Fn),d=H(WTt)??cVe,f=H(NTt)??0,p=H(r5e)??"roadmap",m=H(x5e),y=dt(ZGe),w=H(tXe),[x,C]=g.useState(null),[P,A]=g.useState(null),[S,v]=g.useState(null),[b,T]=g.useState(!0),[R,M]=g.useState(!1),D=g.useRef(null),k=g.useRef([]),N=g.useRef(-1),U=g.useRef([]),W=Kt(),F=14,E=(de=s.email)==null?void 0:de.endsWith("@intofuture.org"),L=()=>{U.current.length=0;for(const he in m)if(Object.hasOwn(m,he)){const me=m[he],ce=new google.maps.LatLng(me.latitude,me.longitude);U.current.push(ce)}},j=g.useCallback(he=>{C(he),L(),he.setMapTypeId(p)},[p]),Y=g.useCallback(function(){C(null)},[]),O=()=>{if(x){const he=x.getCenter();he&&(t.current=he.lat(),e.current=he.lng())}},_=()=>{if(x){const he=x.getZoom();he!==void 0&&he!==d&&c(me=>{me.modelsMapZoom=he})}},G=()=>{if(x){const he=x.getTilt();if(he!==void 0&&he!==f){const me={name:"Tilt Model Map",timestamp:Date.now(),oldValue:f,newValue:he,undo:()=>{c(ce=>{ce.modelsMapTilt=me.oldValue})},redo:()=>{c(ce=>{ce.modelsMapTilt=me.newValue})}};u(me),c(ce=>{ce.modelsMapTilt=he})}}},Q=()=>{if(x){const he=x.getMapTypeId();if(he!==void 0&&he!==p){const me={name:"Change Model Map Type",timestamp:Date.now(),oldValue:p,newValue:he,undo:()=>{c(ce=>{ce.modelsMapType=me.oldValue})},redo:()=>{c(ce=>{ce.modelsMapType=me.newValue})}};u(me),c(ce=>{ce.modelsMapType=he})}}},oe={styles:[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"labels",stylers:[{visibility:"off"}]}]},ee=he=>{he.userid&&he.title?(r(he),o()):co(B.t("message.ModelNotFound",W))},q=he=>{if(he.userid&&he.title){const me=k1+"?client=web&userid="+he.userid+"&title="+encodeURIComponent(he.title);navigator.clipboard.writeText(me).then(()=>d5(B.t("cloudFilePanel.LinkGeneratedInClipBoard",W)+"."))}else co(B.t("message.ModelNotFound",W))},ae=he=>{li.confirm({title:B.t("message.DoYouWantToDeleteModelFromMap",W),icon:h.jsx(_y,{}),onOk:()=>{i(he,()=>{c(me=>{var ce,Pe;if(me.modelSites){const pe=me.modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(pe){let Ie;for(const[ve,ze]of pe)if(ze.userid===he.userid&&ze.title===he.title){Ie=ve;break}Ie&&(pe.delete(Ie),pe.size===0&&((Pe=(ce=k.current[N.current])==null?void 0:ce.marker)==null||Pe.setMap(null)))}}}),A(null),v(null)})},onCancel:()=>{},okText:B.t("word.Yes",W),cancelText:B.t("word.No",W)})},Z=he=>{var me;if(he.userid&&he.title){const ce=ye.getModelKey(he),Pe=!!((me=s.likes)!=null&&me.includes(ce));a(he,!Pe,()=>{c(pe=>{if(pe.user)if(pe.user.likes||(pe.user.likes=[]),pe.user.likes.includes(ce)){const Ie=pe.user.likes.indexOf(ce);Ie>=0&&pe.user.likes.splice(Ie,1)}else pe.user.likes.push(ce);if(pe.modelSites){const Ie=pe.modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(Ie){for(const ve of Ie.values())if(ve.userid===he.userid&&ve.title===he.title){ve.likeCount===void 0&&(ve.likeCount=0),ve.likeCount+=Pe?-1:1;break}}}}),M(!R)})}},ne=he=>{const me=H.getState().modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(me){for(const ce of me.values())if(ce.userid===he.userid&&ce.title===he.title)return ce.likeCount??0}return 0},te=he=>{const me=H.getState().modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(me){for(const ce of me.values())if(ce.userid===he.userid&&ce.title===he.title)return ce.clickCount??0}return 0},$=he=>{const me=H.getState().modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(me){for(const ce of me.values())if(ce.userid===he.userid&&ce.title===he.title)return ce.pinned}return!1},le=(he,me)=>{he.userid&&he.title&&l(he,me,()=>{c(ce=>{if(ce.modelSites){const Pe=ce.modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(Pe){for(const pe of Pe.values())if(pe.userid===he.userid&&pe.title===he.title){pe.pinned=me,M(!R);break}}}})})};return h.jsx(r0t,{mapContainerStyle:{border:"1px solid",width:"100%",height:"100%"},mapTypeId:p,options:oe,center:{lat:t.current,lng:e.current},zoom:d,tilt:f,onLoad:j,onUnmount:Y,onCenterChanged:O,onZoomChanged:_,onTiltChanged:G,onMapTypeIdChanged:Q,children:h.jsxs(h.Fragment,{children:[y&&U.current.map((he,me)=>{const ce=.2*d;return h.jsx(Y1e,{icon:{path:google.maps.SymbolPath.CIRCLE,strokeColor:"red",strokeWeight:ce+2,scale:ce},position:he},me)}),P&&P.size&&S&&h.jsx(m0t,{position:{lat:S.lat(),lng:S.lng()},children:h.jsxs("div",{style:{border:"2px solid gainsboro",maxHeight:"400px",overflowY:"auto"},onMouseLeave:()=>{A(null),v(null)},children:[P.size>1?h.jsxs("div",{style:{background:"#dddddd",textAlign:"left",borderBottom:"1px solid gainsboro",paddingBottom:"4px",marginBottom:"4px"},children:[b?h.jsx(XZt,{title:B.t("modelsMap.SortFromNewestToOldest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{T(!1)}}):h.jsx(stn,{title:B.t("modelsMap.SortFromOldestToNewest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{T(!0)}}),h.jsxs("span",{style:{fontSize:"10px"},children:[P.size," ",B.t("modelsMap.ModelsFoundOnThisSite",W)]}),S&&h.jsxs("span",{style:{fontSize:"10px"},children:[" —"," ",B.t("word.Coordinates",W)+": ("+S.lat().toFixed(a8)+"°, "+S.lng().toFixed(a8)+"°)"]})]}):"",[...P.keys()].sort((he,me)=>{const ce=P.get(he),Pe=P.get(me);return ce!=null&&ce.pinned&&!(Pe!=null&&Pe.pinned)?-1:Pe!=null&&Pe.pinned&&!(ce!=null&&ce.pinned)?1:(b?1:-1)*(((ce==null?void 0:ce.timeCreated)??0)-((Pe==null?void 0:Pe.timeCreated)??0))}).map((he,me)=>{const ce=P.get(he);return ce?h.jsxs("div",{style:{padding:(P==null?void 0:P.size)>1?"5px 5px 20px 5px":"5px",background:me%2===0?"white":"#eeeeee"},children:[me===0&&h.jsxs("div",{style:{fontSize:"12px",display:"block",paddingBottom:"6px"},children:[ce.countryCode&&h.jsx(v0t,{countryCode:ce.countryCode,style:{marginRight:"6px",width:"20px"},svg:!0}),ce.address??"Unknown",P.size===1&&h.jsx("span",{style:{fontSize:"10px",display:"block",paddingTop:"10px"},children:B.t("word.Coordinates",W)+": ("+S.lat().toFixed(a8)+"°, "+S.lng().toFixed(a8)+"°)"})]}),h.jsx(r9e,{style:{background:$(ce)?"#FEF9EC":me%2===0?"white":"#eeeeee",width:"400px"},bordered:!1,ghost:!0,defaultActiveKey:["0"],children:h.jsx(hSo,{header:h.jsxs(h.Fragment,{children:[ce.label,$(ce)&&h.jsx(RCe,{style:{marginLeft:"8px"}})]}),style:{fontSize:"12px"},children:h.jsx("div",{style:{fontSize:"10px",display:"block",textAlign:"left"},children:h.jsxs(Jt,{align:"start",children:[ce.thumbnailUrl&&h.jsx("img",{alt:ce.label,title:B.t("word.Open",W),src:ce.thumbnailUrl,style:{border:"1px solid #222",cursor:"pointer"},onClick:()=>ee(ce)}),h.jsxs("div",{children:[ce.description&&ce.description.trim()!==""?ce.description:""," —  By"," ",h.jsx("span",{style:{cursor:"pointer"},title:B.t("modelsMap.ShowModelsPublishedByThisAuthor",W),onClick:()=>{n(ce.author)},children:!ce.author||ce.author===""?B.t("word.Anonymous",W):ce.author}),", ",ce.timeCreated&&h.jsx(lSo,{date:new Date(ce.timeCreated)})]})]})})},me)}),h.jsxs("div",{style:{marginTop:"10px",fontSize:"11px"},children:[E&&h.jsx(h.Fragment,{children:$(ce)?h.jsx(jen,{style:{cursor:"pointer"},title:B.t("word.Unpin",W),onClick:()=>le(ce,!1)}):h.jsx(RCe,{style:{cursor:"pointer"},title:B.t("word.Pin",W),onClick:()=>le(ce,!0)})}),h.jsx("img",{alt:"Open",onClick:()=>ee(ce),style:{marginLeft:"10px",cursor:"pointer"},title:B.t("word.Open",W),src:oSo,height:F,width:F}),h.jsx("img",{alt:"Export link",onClick:()=>q(ce),style:{marginLeft:"5px",cursor:"pointer"},title:B.t("word.Share",W),src:rSo,height:F,width:F}),ce.userid===s.uid&&h.jsx("img",{alt:"Delete",onClick:()=>ae(ce),style:{marginLeft:"5px",cursor:"pointer"},title:B.t("word.Delete",W),src:n0t,height:F,width:F}),s.uid?h.jsx(h.Fragment,{children:s.likes&&s.likes.includes(ye.getModelKey(ce))?h.jsx("img",{alt:"Like",onClick:()=>Z(ce),style:{marginLeft:"10px",cursor:"pointer"},title:B.t("word.AlreadyLike",W),src:nSo,height:F,width:F}):h.jsx("img",{alt:"Like",onClick:()=>Z(ce),style:{marginLeft:"10px",cursor:"pointer"},title:B.t("word.Like",W),src:Xke,height:F,width:F})}):h.jsx(h.Fragment,{children:h.jsx("img",{alt:"Like",style:{marginLeft:"10px",opacity:.5},title:B.t("word.MustLogInToLike",W),src:Xke,height:F,width:F})}),"   ",ne(ce),h.jsx("img",{alt:"Click counter",style:{marginLeft:"10px"},title:B.t("word.ClickCount",W),src:iSo,height:F,width:F}),"   ",te(ce)]})]},me):null})]})}),!!w&&!!w.size&&h.jsx(d0t,{children:he=>h.jsx("div",{children:[...w.keys()].map((me,ce)=>{const Pe=w.get(me);if(!Pe||!Pe.size)return null;const pe=[...Pe.keys()].sort((se,ge)=>{const we=Pe.get(se),Se=Pe.get(ge);return we!=null&&we.pinned&&!(Se!=null&&Se.pinned)?-1:Se!=null&&Se.pinned&&!(we!=null&&we.pinned)?1:(b?1:-1)*(((we==null?void 0:we.timeCreated)??0)-((Se==null?void 0:Se.timeCreated)??0))}),Ie=Pe.get(pe[0]);if(!Ie)return null;const ve=b0t(Ie),ze=dt.getState().modelsMapSelectedSite;let Ae=!1;for(const[se,ge]of Pe)if(ge.title===(ze==null?void 0:ze.title)){Ae=!0;break}return h.jsx(Y1e,{label:Ae?{text:"⇧",color:"red",fontSize:"24px",fontWeight:"bold"}:void 0,ref:se=>k.current[ce]=se,clusterer:he,icon:ve?{url:ve,labelOrigin:{x:15,y:42}}:void 0,position:{lat:Ie.latitude,lng:Ie.longitude},onClick:()=>ee(Ie),onMouseOver:()=>{D.current=P,N.current=ce,A(Pe);const se=me.split(", ");v(new google.maps.LatLng(Number.parseFloat(se[0]),Number.parseFloat(se[1])))},onMouseOut:()=>{P===D.current&&(A(null),v(null))}},ce)})})})]})})}),gSo="/aladdin/assets/image_load_failure-HGDkwC0S.png",S0t=xe.memo(({latRef:t,lngRef:e,author:n,models:o,closeCallback:r,openCloudFile:i})=>{const a=H(Xp),l=H(Au),s=H(pn),c=H(r5e),u=g.useRef(o?new Map(o):new Map),[d,f]=g.useState(!1),[p,m]=g.useState(),[y,w]=g.useState(!1),{Search:x}=Vl,C=g.useMemo(()=>({lng:l}),[l]);g.useEffect(()=>{o&&(u.current=new Map(o),f(!d))},[o]);const P=g.useMemo(()=>{let S=0;for(const v of u.current.values())(n||v.userid===a.uid)&&S++;return S},[u.current,n,a.uid,d]),A=n&&c!=="roadmap";return u.current.size===0?h.jsx(jhe,{mask:!1,styles:{header:{height:"40px",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",background:A?"#6A6B6E":"whitesmoke"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:A?"#2A2B2E":"white"}},style:{scrollbarColor:A?"#6A6B6E":"whitesmoke"},title:(n??B.t("modelsMap.MyPublishedModels",C))+" (0)",placement:"bottom",open:!0,height:"150px",onClose:()=>{r()},children:h.jsx(w1,{image:w1.PRESENTED_IMAGE_SIMPLE,style:{color:A?"lightgray":"dimgray"}})}):h.jsx(jhe,{extra:h.jsxs(Jt,{children:[y?h.jsx(Pen,{title:B.t("modelsMap.SortFromNewestToOldest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{w(!1)}}):h.jsx(mtt,{title:B.t("modelsMap.SortFromOldestToNewest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{w(!0)}}),h.jsx(x,{title:B.t("modelsMap.SearchByLabel",C),allowClear:!0,size:"small",enterButton:!0,onSearch:S=>{var v;if(o){u.current.clear();for(const[b,T]of o)(v=T.label)!=null&&v.toLowerCase().includes(S.toLowerCase())&&u.current.set(b,T);f(!d)}}})]}),mask:!1,styles:{header:{height:"40px",color:A?"white":"black",background:A?"#6A6B6E":"whitesmoke",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",border:"none"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:A?"#2A2B2E":"white"}},title:(n??B.t("modelsMap.MyPublishedModels",C))+" ("+P+")",placement:"bottom",open:!0,height:"164px",onClose:()=>{m(void 0),r()},children:h.jsx("table",{children:h.jsx("tbody",{children:h.jsx("tr",{children:[...u.current.keys()].sort((S,v)=>{const b=u.current.get(S),T=u.current.get(v);return!b||!T?0:(y?-1:1)*((T.timeCreated??0)-(b.timeCreated??0))}).map((S,v)=>{const b=u.current.get(S);return!b||!n&&b.userid!==a.uid?null:h.jsx("td",{children:h.jsxs("div",{style:{display:"block",marginTop:"4px"},children:[h.jsx("img",{loading:"lazy",height:"100px",width:"auto",onError:T=>{T.target.src=gSo},alt:b.label,title:b.label,src:b.thumbnailUrl,style:{cursor:"pointer",borderRadius:p===b?"0":"10px",border:p===b?"4px solid "+(A?"goldenrod":"red"):"none",marginRight:"4px"},onClick:()=>{m(b),i?i(b.userid,b.title):(s(T=>{b&&(T.modelsMapLatitude=b.latitude,T.modelsMapLongitude=b.longitude,T.modelsMapZoom=17,t&&(t.current=b.latitude),e&&(e.current=b.longitude))}),dt.getState().set(T=>{T.modelsMapSelectedSite=b}))}}),h.jsxs("div",{children:[h.jsx("img",{alt:b.type,src:b0t(b),style:{position:"relative",left:"8px",bottom:"28px",width:"16px",height:"16px"}}),h.jsx("span",{style:{position:"relative",left:"16px",bottom:"24px",color:"white",fontSize:"8px",fontWeight:"bold"},children:b.label?b.label.length>30?b.label.substring(0,30)+"...":b.label:"Unknown"})]})]})},v)})})})})})}),mSo=["places"],{RangePicker:ySo}=F7,ASo=ko.div` +`),s="Cluster of ".concat(r," markers"),c=Number(google.maps.Marker.MAX_ZINDEX)+r;if(Kg.isAdvancedMarkerAvailable(o)){var u=new DOMParser,d=u.parseFromString(l,"image/svg+xml").documentElement;d.setAttribute("transform","translate(0 25)");var f={map:o,position:i,zIndex:c,title:s,content:d};return new google.maps.marker.AdvancedMarkerElement(f)}var p={position:i,zIndex:c,title:s,icon:{url:"data:image/svg+xml;base64,".concat(btoa(l)),anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(p)}}function wbo(t,e){for(var n in e.prototype)t.prototype[n]=e.prototype[n]}class L4e{constructor(){wbo(L4e,google.maps.OverlayView)}}var lF;(function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click"})(lF||(lF={}));var xbo=(t,e,n)=>{n.fitBounds(e.bounds)};class vbo extends L4e{constructor(e){var{map:n,markers:o=[],algorithmOptions:r={},algorithm:i=new mbo(r),renderer:a=new Abo,onClusterClick:l=xbo}=e;super(),this.markers=[...o],this.clusters=[],this.algorithm=i,this.renderer=a,this.onClusterClick=l,n&&this.setMap(n)}addMarker(e,n){this.markers.includes(e)||(this.markers.push(e),n||this.render())}addMarkers(e,n){e.forEach(o=>{this.addMarker(o,!0)}),n||this.render()}removeMarker(e,n){var o=this.markers.indexOf(e);return o===-1?!1:(Kg.setMap(e,null),this.markers.splice(o,1),n||this.render(),!0)}removeMarkers(e,n){var o=!1;return e.forEach(r=>{o=this.removeMarker(r,!0)||o}),o&&!n&&this.render(),o}clearMarkers(e){this.markers.length=0,e||this.render()}render(){var e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,lF.CLUSTERING_BEGIN,this);var{clusters:n,changed:o}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(o||o==null){var r=new Set;for(var i of n)i.markers.length==1&&r.add(i.markers[0]);var a=[];for(var l of this.clusters)l.marker!=null&&(l.markers.length==1?r.has(l.marker)||Kg.setMap(l.marker,null):a.push(l.marker));this.clusters=n,this.renderClusters(),requestAnimationFrame(()=>a.forEach(s=>Kg.setMap(s,null)))}google.maps.event.trigger(this,lF.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(e=>Kg.setMap(e,null)),this.clusters.forEach(e=>e.delete()),this.clusters=[]}renderClusters(){var e=new ybo(this.markers,this.clusters),n=this.getMap();this.clusters.forEach(o=>{o.markers.length===1?o.marker=o.markers[0]:(o.marker=this.renderer.render(o,e,n),o.markers.forEach(r=>Kg.setMap(r,null)),this.onClusterClick&&o.marker.addListener("click",r=>{google.maps.event.trigger(this,lF.CLUSTER_CLICK,o),this.onClusterClick(r,o,n)})),Kg.setMap(o.marker,n)})}}function rke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function ike(t){for(var e=1;e{if(e&&n===null){var r=new vbo(ike(ike({},t),{},{map:e}));o(r)}},[e]),n}function Sbo(t){var{children:e,options:n}=t,o=bbo(n);return o!==null?e(o):null}g.memo(Sbo);var ake={onCloseClick:"closeclick",onContentChanged:"content_changed",onDomReady:"domready",onPositionChanged:"position_changed",onZindexChanged:"zindex_changed"},lke={options(t,e){t.setOptions(e)},position(t,e){t.setPosition(e)},zIndex(t,e){t.setZIndex(e)}};function Tbo(t){var{children:e,anchor:n,options:o,position:r,zIndex:i,onCloseClick:a,onDomReady:l,onContentChanged:s,onPositionChanged:c,onZindexChanged:u,onLoad:d,onUnmount:f}=t,p=g.useContext(Ra),[m,y]=g.useState(null),[w,x]=g.useState(null),[C,P]=g.useState(null),[A,S]=g.useState(null),[v,b]=g.useState(null),[T,R]=g.useState(null),M=g.useRef(null);return g.useEffect(()=>{m!==null&&(m.close(),n?m.open(p,n):m.getPosition()&&m.open(p))},[p,m,n]),g.useEffect(()=>{o&&m!==null&&m.setOptions(o)},[m,o]),g.useEffect(()=>{r&&m!==null&&m.setPosition(r)},[r]),g.useEffect(()=>{typeof i=="number"&&m!==null&&m.setZIndex(i)},[i]),g.useEffect(()=>{m&&a&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(m,"closeclick",a)))},[a]),g.useEffect(()=>{m&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(m,"domready",l)))},[l]),g.useEffect(()=>{m&&s&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(m,"content_changed",s)))},[s]),g.useEffect(()=>{m&&c&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(m,"position_changed",c)))},[c]),g.useEffect(()=>{m&&u&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(m,"zindex_changed",u)))},[u]),g.useEffect(()=>{var D=new google.maps.InfoWindow(o);return y(D),M.current=document.createElement("div"),a&&x(google.maps.event.addListener(D,"closeclick",a)),l&&P(google.maps.event.addListener(D,"domready",l)),s&&S(google.maps.event.addListener(D,"content_changed",s)),c&&b(google.maps.event.addListener(D,"position_changed",c)),u&&R(google.maps.event.addListener(D,"zindex_changed",u)),D.setContent(M.current),r&&D.setPosition(r),i&&D.setZIndex(i),n?D.open(p,n):D.getPosition()?D.open(p):od(!1,"You must provide either an anchor (typically render it inside a ) or a position props for ."),d&&d(D),()=>{w&&google.maps.event.removeListener(w),A&&google.maps.event.removeListener(A),C&&google.maps.event.removeListener(C),v&&google.maps.event.removeListener(v),T&&google.maps.event.removeListener(T),f&&f(D),D.close()}},[]),M.current?r0.createPortal(g.Children.only(e),M.current):null}g.memo(Tbo);class m0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",null),mo(this,"state",{infoWindow:null}),mo(this,"open",(e,n)=>{n?e.open(this.context,n):e.getPosition()?e.open(this.context):od(!1,"You must provide either an anchor (typically render it inside a ) or a position props for .")}),mo(this,"setInfoWindowCallback",()=>{this.state.infoWindow!==null&&this.containerElement!==null&&(this.state.infoWindow.setContent(this.containerElement),this.open(this.state.infoWindow,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoWindow))})}componentDidMount(){var e=new google.maps.InfoWindow(this.props.options);this.containerElement=document.createElement("div"),this.registeredEvents=Va({updaterMap:lke,eventMap:ake,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({infoWindow:e}),this.setInfoWindowCallback)}componentDidUpdate(e){this.state.infoWindow!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:lke,eventMap:ake,prevProps:e,nextProps:this.props,instance:this.state.infoWindow}))}componentWillUnmount(){this.state.infoWindow!==null&&(Za(this.registeredEvents),this.props.onUnmount&&this.props.onUnmount(this.state.infoWindow),this.state.infoWindow.close())}render(){return this.containerElement?r0.createPortal(g.Children.only(this.props.children),this.containerElement):null}}mo(m0t,"contextType",Ra);function ske(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function EK(t){for(var e=1;e{A!==null&&A.setMap(P)},[P]),g.useEffect(()=>{typeof e<"u"&&A!==null&&A.setOptions(e)},[A,e]),g.useEffect(()=>{typeof n<"u"&&A!==null&&A.setDraggable(n)},[A,n]),g.useEffect(()=>{typeof o<"u"&&A!==null&&A.setEditable(o)},[A,o]),g.useEffect(()=>{typeof r<"u"&&A!==null&&A.setVisible(r)},[A,r]),g.useEffect(()=>{typeof i<"u"&&A!==null&&A.setPath(i)},[A,i]),g.useEffect(()=>{A&&a&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(A,"dblclick",a)))},[a]),g.useEffect(()=>{A&&l&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(A,"dragend",l)))},[l]),g.useEffect(()=>{A&&s&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(A,"dragstart",s)))},[s]),g.useEffect(()=>{A&&c&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(A,"mousedown",c)))},[c]),g.useEffect(()=>{A&&u&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(A,"mousemove",u)))},[u]),g.useEffect(()=>{A&&d&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(A,"mouseout",d)))},[d]),g.useEffect(()=>{A&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(A,"mouseover",f)))},[f]),g.useEffect(()=>{A&&p&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(A,"mouseup",p)))},[p]),g.useEffect(()=>{A&&m&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(A,"rightclick",m)))},[m]),g.useEffect(()=>{A&&y&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(A,"click",y)))},[y]),g.useEffect(()=>{A&&w&&(ee!==null&&google.maps.event.removeListener(ee),$(google.maps.event.addListener(A,"drag",w)))},[w]),g.useEffect(()=>{var ae=new google.maps.Polyline(EK(EK({},e||Pbo),{},{map:P}));return i&&ae.setPath(i),typeof r<"u"&&ae.setVisible(r),typeof o<"u"&&ae.setEditable(o),typeof n<"u"&&ae.setDraggable(n),a&&b(google.maps.event.addListener(ae,"dblclick",a)),l&&R(google.maps.event.addListener(ae,"dragend",l)),s&&D(google.maps.event.addListener(ae,"dragstart",s)),c&&N(google.maps.event.addListener(ae,"mousedown",c)),u&&W(google.maps.event.addListener(ae,"mousemove",u)),d&&E(google.maps.event.addListener(ae,"mouseout",d)),f&&j(google.maps.event.addListener(ae,"mouseover",f)),p&&O(google.maps.event.addListener(ae,"mouseup",p)),m&&G(google.maps.event.addListener(ae,"rightclick",m)),y&&oe(google.maps.event.addListener(ae,"click",y)),w&&$(google.maps.event.addListener(ae,"drag",w)),S(ae),x&&x(ae),()=>{v!==null&&google.maps.event.removeListener(v),T!==null&&google.maps.event.removeListener(T),M!==null&&google.maps.event.removeListener(M),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),_!==null&&google.maps.event.removeListener(_),Q!==null&&google.maps.event.removeListener(Q),C&&C(ae),ae.setMap(null)}},[]),null}g.memo(Cbo);class Rbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{polyline:null}),mo(this,"setPolylineCallback",()=>{this.state.polyline!==null&&this.props.onLoad&&this.props.onLoad(this.state.polyline)})}componentDidMount(){var e=new google.maps.Polyline(EK(EK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:uke,eventMap:cke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{polyline:e}},this.setPolylineCallback)}componentDidUpdate(e){this.state.polyline!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:uke,eventMap:cke,prevProps:e,nextProps:this.props,instance:this.state.polyline}))}componentWillUnmount(){this.state.polyline!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.polyline),Za(this.registeredEvents),this.state.polyline.setMap(null))}render(){return null}}mo(Rbo,"contextType",Ra);function dke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function fke(t){for(var e=1;e{v!==null&&v.setMap(S)},[S]),g.useEffect(()=>{typeof e<"u"&&v!==null&&v.setOptions(e)},[v,e]),g.useEffect(()=>{typeof n<"u"&&v!==null&&v.setDraggable(n)},[v,n]),g.useEffect(()=>{typeof o<"u"&&v!==null&&v.setEditable(o)},[v,o]),g.useEffect(()=>{typeof r<"u"&&v!==null&&v.setVisible(r)},[v,r]),g.useEffect(()=>{typeof i<"u"&&v!==null&&v.setPath(i)},[v,i]),g.useEffect(()=>{typeof a<"u"&&v!==null&&v.setPaths(a)},[v,a]),g.useEffect(()=>{v&&typeof l=="function"&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(v,"dblclick",l)))},[l]),g.useEffect(()=>{v&&(google.maps.event.addListener(v.getPath(),"insert_at",()=>{A==null||A(v)}),google.maps.event.addListener(v.getPath(),"set_at",()=>{A==null||A(v)}),google.maps.event.addListener(v.getPath(),"remove_at",()=>{A==null||A(v)}))},[v,A]),g.useEffect(()=>{v&&typeof s=="function"&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(v,"dragend",s)))},[s]),g.useEffect(()=>{v&&typeof c=="function"&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(v,"dragstart",c)))},[c]),g.useEffect(()=>{v&&typeof u=="function"&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(v,"mousedown",u)))},[u]),g.useEffect(()=>{v&&typeof d=="function"&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(v,"mousemove",d)))},[d]),g.useEffect(()=>{v&&typeof f=="function"&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(v,"mouseout",f)))},[f]),g.useEffect(()=>{v&&typeof p=="function"&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(v,"mouseover",p)))},[p]),g.useEffect(()=>{v&&typeof m=="function"&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(v,"mouseup",m)))},[m]),g.useEffect(()=>{v&&typeof y=="function"&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(v,"rightclick",y)))},[y]),g.useEffect(()=>{v&&typeof w=="function"&&(ee!==null&&google.maps.event.removeListener(ee),$(google.maps.event.addListener(v,"click",w)))},[w]),g.useEffect(()=>{v&&typeof x=="function"&&(ae!==null&&google.maps.event.removeListener(ae),Z(google.maps.event.addListener(v,"drag",x)))},[x]),g.useEffect(()=>{var ne=new google.maps.Polygon(fke(fke({},e),{},{map:S}));return i&&ne.setPath(i),a&&ne.setPaths(a),typeof r<"u"&&ne.setVisible(r),typeof o<"u"&&ne.setEditable(o),typeof n<"u"&&ne.setDraggable(n),l&&R(google.maps.event.addListener(ne,"dblclick",l)),s&&D(google.maps.event.addListener(ne,"dragend",s)),c&&N(google.maps.event.addListener(ne,"dragstart",c)),u&&W(google.maps.event.addListener(ne,"mousedown",u)),d&&E(google.maps.event.addListener(ne,"mousemove",d)),f&&j(google.maps.event.addListener(ne,"mouseout",f)),p&&O(google.maps.event.addListener(ne,"mouseover",p)),m&&G(google.maps.event.addListener(ne,"mouseup",m)),y&&oe(google.maps.event.addListener(ne,"rightclick",y)),w&&$(google.maps.event.addListener(ne,"click",w)),x&&Z(google.maps.event.addListener(ne,"drag",x)),b(ne),C&&C(ne),()=>{T!==null&&google.maps.event.removeListener(T),M!==null&&google.maps.event.removeListener(M),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),_!==null&&google.maps.event.removeListener(_),Q!==null&&google.maps.event.removeListener(Q),ee!==null&&google.maps.event.removeListener(ee),P&&P(ne),ne.setMap(null)}},[]),null}g.memo(Hbo);class Mbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[])}componentDidMount(){var e=this.props.options||{};this.polygon=new google.maps.Polygon(e),this.polygon.setMap(this.context),this.registeredEvents=Va({updaterMap:pke,eventMap:hke,prevProps:{},nextProps:this.props,instance:this.polygon}),this.props.onLoad&&this.props.onLoad(this.polygon)}componentDidUpdate(e){this.polygon&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:pke,eventMap:hke,prevProps:e,nextProps:this.props,instance:this.polygon}))}componentWillUnmount(){this.polygon&&(this.props.onUnmount&&this.props.onUnmount(this.polygon),Za(this.registeredEvents),this.polygon&&this.polygon.setMap(null))}render(){return null}}mo(Mbo,"contextType",Ra);function gke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function kK(t){for(var e=1;e{S!==null&&S.setMap(A)},[A]),g.useEffect(()=>{typeof e<"u"&&S!==null&&S.setOptions(e)},[S,e]),g.useEffect(()=>{typeof o<"u"&&S!==null&&S.setDraggable(o)},[S,o]),g.useEffect(()=>{typeof r<"u"&&S!==null&&S.setEditable(r)},[S,r]),g.useEffect(()=>{typeof i<"u"&&S!==null&&S.setVisible(i)},[S,i]),g.useEffect(()=>{typeof n<"u"&&S!==null&&S.setBounds(n)},[S,n]),g.useEffect(()=>{S&&a&&(b!==null&&google.maps.event.removeListener(b),T(google.maps.event.addListener(S,"dblclick",a)))},[a]),g.useEffect(()=>{S&&l&&(R!==null&&google.maps.event.removeListener(R),M(google.maps.event.addListener(S,"dragend",l)))},[l]),g.useEffect(()=>{S&&s&&(D!==null&&google.maps.event.removeListener(D),k(google.maps.event.addListener(S,"dragstart",s)))},[s]),g.useEffect(()=>{S&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(S,"mousedown",c)))},[c]),g.useEffect(()=>{S&&u&&(W!==null&&google.maps.event.removeListener(W),F(google.maps.event.addListener(S,"mousemove",u)))},[u]),g.useEffect(()=>{S&&d&&(E!==null&&google.maps.event.removeListener(E),L(google.maps.event.addListener(S,"mouseout",d)))},[d]),g.useEffect(()=>{S&&f&&(j!==null&&google.maps.event.removeListener(j),Y(google.maps.event.addListener(S,"mouseover",f)))},[f]),g.useEffect(()=>{S&&p&&(O!==null&&google.maps.event.removeListener(O),_(google.maps.event.addListener(S,"mouseup",p)))},[p]),g.useEffect(()=>{S&&m&&(G!==null&&google.maps.event.removeListener(G),Q(google.maps.event.addListener(S,"rightclick",m)))},[m]),g.useEffect(()=>{S&&y&&(oe!==null&&google.maps.event.removeListener(oe),ee(google.maps.event.addListener(S,"click",y)))},[y]),g.useEffect(()=>{S&&w&&($!==null&&google.maps.event.removeListener($),ae(google.maps.event.addListener(S,"drag",w)))},[w]),g.useEffect(()=>{S&&x&&(Z!==null&&google.maps.event.removeListener(Z),ne(google.maps.event.addListener(S,"bounds_changed",x)))},[x]),g.useEffect(()=>{var te=new google.maps.Rectangle(kK(kK({},e),{},{map:A}));return typeof i<"u"&&te.setVisible(i),typeof r<"u"&&te.setEditable(r),typeof o<"u"&&te.setDraggable(o),typeof n<"u"&&te.setBounds(n),a&&T(google.maps.event.addListener(te,"dblclick",a)),l&&M(google.maps.event.addListener(te,"dragend",l)),s&&k(google.maps.event.addListener(te,"dragstart",s)),c&&U(google.maps.event.addListener(te,"mousedown",c)),u&&F(google.maps.event.addListener(te,"mousemove",u)),d&&L(google.maps.event.addListener(te,"mouseout",d)),f&&Y(google.maps.event.addListener(te,"mouseover",f)),p&&_(google.maps.event.addListener(te,"mouseup",p)),m&&Q(google.maps.event.addListener(te,"rightclick",m)),y&&ee(google.maps.event.addListener(te,"click",y)),w&&ae(google.maps.event.addListener(te,"drag",w)),x&&ne(google.maps.event.addListener(te,"bounds_changed",x)),v(te),C&&C(te),()=>{b!==null&&google.maps.event.removeListener(b),R!==null&&google.maps.event.removeListener(R),D!==null&&google.maps.event.removeListener(D),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),E!==null&&google.maps.event.removeListener(E),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),oe!==null&&google.maps.event.removeListener(oe),$!==null&&google.maps.event.removeListener($),Z!==null&&google.maps.event.removeListener(Z),P&&P(te),te.setMap(null)}},[]),null}g.memo(Ibo);let zbo=class extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{rectangle:null}),mo(this,"setRectangleCallback",()=>{this.state.rectangle!==null&&this.props.onLoad&&this.props.onLoad(this.state.rectangle)})}componentDidMount(){var e=new google.maps.Rectangle(kK(kK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:yke,eventMap:mke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{rectangle:e}},this.setRectangleCallback)}componentDidUpdate(e){this.state.rectangle!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:yke,eventMap:mke,prevProps:e,nextProps:this.props,instance:this.state.rectangle}))}componentWillUnmount(){this.state.rectangle!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.rectangle),Za(this.registeredEvents),this.state.rectangle.setMap(null))}render(){return null}};mo(zbo,"contextType",Ra);function Ake(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function FK(t){for(var e=1;e{b!==null&&b.setMap(v)},[v]),g.useEffect(()=>{typeof e<"u"&&b!==null&&b.setOptions(e)},[b,e]),g.useEffect(()=>{typeof r<"u"&&b!==null&&b.setDraggable(r)},[b,r]),g.useEffect(()=>{typeof i<"u"&&b!==null&&b.setEditable(i)},[b,i]),g.useEffect(()=>{typeof a<"u"&&b!==null&&b.setVisible(a)},[b,a]),g.useEffect(()=>{typeof o=="number"&&b!==null&&b.setRadius(o)},[b,o]),g.useEffect(()=>{typeof n<"u"&&b!==null&&b.setCenter(n)},[b,n]),g.useEffect(()=>{b&&l&&(R!==null&&google.maps.event.removeListener(R),M(google.maps.event.addListener(b,"dblclick",l)))},[l]),g.useEffect(()=>{b&&s&&(D!==null&&google.maps.event.removeListener(D),k(google.maps.event.addListener(b,"dragend",s)))},[s]),g.useEffect(()=>{b&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(b,"dragstart",c)))},[c]),g.useEffect(()=>{b&&u&&(W!==null&&google.maps.event.removeListener(W),F(google.maps.event.addListener(b,"mousedown",u)))},[u]),g.useEffect(()=>{b&&d&&(E!==null&&google.maps.event.removeListener(E),L(google.maps.event.addListener(b,"mousemove",d)))},[d]),g.useEffect(()=>{b&&f&&(j!==null&&google.maps.event.removeListener(j),Y(google.maps.event.addListener(b,"mouseout",f)))},[f]),g.useEffect(()=>{b&&p&&(O!==null&&google.maps.event.removeListener(O),_(google.maps.event.addListener(b,"mouseover",p)))},[p]),g.useEffect(()=>{b&&m&&(G!==null&&google.maps.event.removeListener(G),Q(google.maps.event.addListener(b,"mouseup",m)))},[m]),g.useEffect(()=>{b&&y&&(oe!==null&&google.maps.event.removeListener(oe),ee(google.maps.event.addListener(b,"rightclick",y)))},[y]),g.useEffect(()=>{b&&w&&($!==null&&google.maps.event.removeListener($),ae(google.maps.event.addListener(b,"click",w)))},[w]),g.useEffect(()=>{b&&x&&(Z!==null&&google.maps.event.removeListener(Z),ne(google.maps.event.addListener(b,"drag",x)))},[x]),g.useEffect(()=>{b&&C&&(te!==null&&google.maps.event.removeListener(te),q(google.maps.event.addListener(b,"center_changed",C)))},[w]),g.useEffect(()=>{b&&P&&(le!==null&&google.maps.event.removeListener(le),de(google.maps.event.addListener(b,"radius_changed",P)))},[P]),g.useEffect(()=>{var he=new google.maps.Circle(FK(FK({},e||Dbo),{},{map:v}));return typeof o=="number"&&he.setRadius(o),typeof n<"u"&&he.setCenter(n),typeof o=="number"&&he.setRadius(o),typeof a<"u"&&he.setVisible(a),typeof i<"u"&&he.setEditable(i),typeof r<"u"&&he.setDraggable(r),l&&M(google.maps.event.addListener(he,"dblclick",l)),s&&k(google.maps.event.addListener(he,"dragend",s)),c&&U(google.maps.event.addListener(he,"dragstart",c)),u&&F(google.maps.event.addListener(he,"mousedown",u)),d&&L(google.maps.event.addListener(he,"mousemove",d)),f&&Y(google.maps.event.addListener(he,"mouseout",f)),p&&_(google.maps.event.addListener(he,"mouseover",p)),m&&Q(google.maps.event.addListener(he,"mouseup",m)),y&&ee(google.maps.event.addListener(he,"rightclick",y)),w&&ae(google.maps.event.addListener(he,"click",w)),x&&ne(google.maps.event.addListener(he,"drag",x)),C&&q(google.maps.event.addListener(he,"center_changed",C)),P&&de(google.maps.event.addListener(he,"radius_changed",P)),T(he),A&&A(he),()=>{R!==null&&google.maps.event.removeListener(R),D!==null&&google.maps.event.removeListener(D),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),E!==null&&google.maps.event.removeListener(E),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),oe!==null&&google.maps.event.removeListener(oe),$!==null&&google.maps.event.removeListener($),te!==null&&google.maps.event.removeListener(te),le!==null&&google.maps.event.removeListener(le),S&&S(he),he.setMap(null)}},[]),null}g.memo(Ebo);class kbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{circle:null}),mo(this,"setCircleCallback",()=>{this.state.circle!==null&&this.props.onLoad&&this.props.onLoad(this.state.circle)})}componentDidMount(){var e=new google.maps.Circle(FK(FK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:xke,eventMap:wke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{circle:e}},this.setCircleCallback)}componentDidUpdate(e){this.state.circle!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:xke,eventMap:wke,prevProps:e,nextProps:this.props,instance:this.state.circle}))}componentWillUnmount(){if(this.state.circle!==null){var e;this.props.onUnmount&&this.props.onUnmount(this.state.circle),Za(this.registeredEvents),(e=this.state.circle)===null||e===void 0||e.setMap(null)}}render(){return null}}mo(kbo,"contextType",Ra);function vke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function LK(t){for(var e=1;e{C!==null&&C.setMap(x)},[x]),g.useEffect(()=>{C&&o&&(A!==null&&google.maps.event.removeListener(A),S(google.maps.event.addListener(C,"dblclick",o)))},[o]),g.useEffect(()=>{C&&r&&(v!==null&&google.maps.event.removeListener(v),b(google.maps.event.addListener(C,"mousedown",r)))},[r]),g.useEffect(()=>{C&&i&&(T!==null&&google.maps.event.removeListener(T),R(google.maps.event.addListener(C,"mousemove",i)))},[i]),g.useEffect(()=>{C&&a&&(M!==null&&google.maps.event.removeListener(M),D(google.maps.event.addListener(C,"mouseout",a)))},[a]),g.useEffect(()=>{C&&l&&(k!==null&&google.maps.event.removeListener(k),N(google.maps.event.addListener(C,"mouseover",l)))},[l]),g.useEffect(()=>{C&&s&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(C,"mouseup",s)))},[s]),g.useEffect(()=>{C&&c&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(C,"rightclick",c)))},[c]),g.useEffect(()=>{C&&n&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(C,"click",n)))},[n]),g.useEffect(()=>{C&&u&&(Y!==null&&google.maps.event.removeListener(Y),O(google.maps.event.addListener(C,"addfeature",u)))},[u]),g.useEffect(()=>{C&&d&&(_!==null&&google.maps.event.removeListener(_),G(google.maps.event.addListener(C,"removefeature",d)))},[d]),g.useEffect(()=>{C&&f&&(Q!==null&&google.maps.event.removeListener(Q),oe(google.maps.event.addListener(C,"removeproperty",f)))},[f]),g.useEffect(()=>{C&&p&&(ee!==null&&google.maps.event.removeListener(ee),$(google.maps.event.addListener(C,"setgeometry",p)))},[p]),g.useEffect(()=>{C&&m&&(ae!==null&&google.maps.event.removeListener(ae),Z(google.maps.event.addListener(C,"setproperty",m)))},[m]),g.useEffect(()=>{if(x!==null){var ne=new google.maps.Data(LK(LK({},e),{},{map:x}));o&&S(google.maps.event.addListener(ne,"dblclick",o)),r&&b(google.maps.event.addListener(ne,"mousedown",r)),i&&R(google.maps.event.addListener(ne,"mousemove",i)),a&&D(google.maps.event.addListener(ne,"mouseout",a)),l&&N(google.maps.event.addListener(ne,"mouseover",l)),s&&W(google.maps.event.addListener(ne,"mouseup",s)),c&&E(google.maps.event.addListener(ne,"rightclick",c)),n&&j(google.maps.event.addListener(ne,"click",n)),u&&O(google.maps.event.addListener(ne,"addfeature",u)),d&&G(google.maps.event.addListener(ne,"removefeature",d)),f&&oe(google.maps.event.addListener(ne,"removeproperty",f)),p&&$(google.maps.event.addListener(ne,"setgeometry",p)),m&&Z(google.maps.event.addListener(ne,"setproperty",m)),P(ne),y&&y(ne)}return()=>{C&&(A!==null&&google.maps.event.removeListener(A),v!==null&&google.maps.event.removeListener(v),T!==null&&google.maps.event.removeListener(T),M!==null&&google.maps.event.removeListener(M),k!==null&&google.maps.event.removeListener(k),U!==null&&google.maps.event.removeListener(U),F!==null&&google.maps.event.removeListener(F),L!==null&&google.maps.event.removeListener(L),Y!==null&&google.maps.event.removeListener(Y),_!==null&&google.maps.event.removeListener(_),Q!==null&&google.maps.event.removeListener(Q),ee!==null&&google.maps.event.removeListener(ee),ae!==null&&google.maps.event.removeListener(ae),w&&w(C),C.setMap(null))}},[]),null}g.memo(Fbo);class Lbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{data:null}),mo(this,"setDataCallback",()=>{this.state.data!==null&&this.props.onLoad&&this.props.onLoad(this.state.data)})}componentDidMount(){if(this.context!==null){var e=new google.maps.Data(LK(LK({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:Ske,eventMap:bke,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({data:e}),this.setDataCallback)}}componentDidUpdate(e){this.state.data!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Ske,eventMap:bke,prevProps:e,nextProps:this.props,instance:this.state.data}))}componentWillUnmount(){this.state.data!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.data),Za(this.registeredEvents),this.state.data&&this.state.data.setMap(null))}render(){return null}}mo(Lbo,"contextType",Ra);function Tke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Pke(t){for(var e=1;e{this.state.kmlLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.kmlLayer)})}componentDidMount(){var e=new google.maps.KmlLayer(Pke(Pke({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:Rke,eventMap:Cke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{kmlLayer:e}},this.setKmlLayerCallback)}componentDidUpdate(e){this.state.kmlLayer!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Rke,eventMap:Cke,prevProps:e,nextProps:this.props,instance:this.state.kmlLayer}))}componentWillUnmount(){this.state.kmlLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.kmlLayer),Za(this.registeredEvents),this.state.kmlLayer.setMap(null))}render(){return null}}mo(Wbo,"contextType",Ra);function y0t(t,e){return typeof e=="function"?e(t.offsetWidth,t.offsetHeight):{x:0,y:0}}function Nbo(t,e){return new e(t.lat,t.lng)}function Ubo(t,e){return new e(new google.maps.LatLng(t.ne.lat,t.ne.lng),new google.maps.LatLng(t.sw.lat,t.sw.lng))}function jbo(t,e,n){return t instanceof e?t:n(t,e)}function Bbo(t,e,n){return t instanceof e?t:n(t,e)}function Ybo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n.getNorthEast()),r=t&&t.fromLatLngToDivPixel(n.getSouthWest());return o&&r?{left:"".concat(r.x+e.x,"px"),top:"".concat(o.y+e.y,"px"),width:"".concat(o.x-r.x-e.x,"px"),height:"".concat(r.y-o.y-e.y,"px")}:{left:"-9999px",top:"-9999px"}}function Obo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n);if(o){var{x:r,y:i}=o;return{left:"".concat(r+e.x,"px"),top:"".concat(i+e.y,"px")}}return{left:"-9999px",top:"-9999px"}}function A0t(t,e,n,o){return n!==void 0?Ybo(t,e,Bbo(n,google.maps.LatLngBounds,Ubo)):Obo(t,e,jbo(o,google.maps.LatLng,Nbo))}function _bo(t,e){return t.left===e.left&&t.top===e.top&&t.width===e.height&&t.height===e.height}function Hke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Vbo(t){for(var e=1;e{var f=document.createElement("div");return f.style.position="absolute",f},[]),d=g.useMemo(()=>Gbo(u,o,e,n,l),[u,o,e,n]);return g.useEffect(()=>(i==null||i(d),d==null||d.setMap(c),()=>{a==null||a(d),d==null||d.setMap(null)}),[c,d]),g.useEffect(()=>{u.style.zIndex="".concat(r)},[r,u]),r0.createPortal(s,u)}g.memo(Jbo);class YI extends g.PureComponent{constructor(e){super(e),mo(this,"state",{paneEl:null,containerStyle:{position:"absolute"}}),mo(this,"updatePane",()=>{var o=this.props.mapPaneName,r=this.overlayView.getPanes();od(!!o,"OverlayView requires props.mapPaneName but got %s",o),r?this.setState({paneEl:r[o]}):this.setState({paneEl:null})}),mo(this,"onAdd",()=>{var o,r;this.updatePane(),(o=(r=this.props).onLoad)===null||o===void 0||o.call(r,this.overlayView)}),mo(this,"onPositionElement",()=>{var o=this.overlayView.getProjection(),r=Xbo({x:0,y:0},this.containerRef.current?y0t(this.containerRef.current,this.props.getPixelPositionOffset):{}),i=A0t(o,r,this.props.bounds,this.props.position);if(!_bo(i,{left:this.state.containerStyle.left,top:this.state.containerStyle.top,width:this.state.containerStyle.width,height:this.state.containerStyle.height})){var a,l,s,c;this.setState({containerStyle:{top:(a=i.top)!==null&&a!==void 0?a:0,left:(l=i.left)!==null&&l!==void 0?l:0,width:(s=i.width)!==null&&s!==void 0?s:0,height:(c=i.height)!==null&&c!==void 0?c:0,position:"absolute"}})}}),mo(this,"draw",()=>{this.onPositionElement()}),mo(this,"onRemove",()=>{var o,r;this.setState(()=>({paneEl:null})),(o=(r=this.props).onUnmount)===null||o===void 0||o.call(r,this.overlayView)}),this.containerRef=g.createRef();var n=new google.maps.OverlayView;n.onAdd=this.onAdd,n.draw=this.draw,n.onRemove=this.onRemove,this.overlayView=n}componentDidMount(){this.overlayView.setMap(this.context)}componentDidUpdate(e){var n=Ike(e.position),o=Ike(this.props.position),r=zke(e.bounds),i=zke(this.props.bounds);(n!==o||r!==i)&&this.overlayView.draw(),e.mapPaneName!==this.props.mapPaneName&&this.updatePane()}componentWillUnmount(){this.overlayView.setMap(null)}render(){var e=this.state.paneEl;return e?r0.createPortal(h.jsx("div",{ref:this.containerRef,style:this.state.containerStyle,children:g.Children.only(this.props.children)}),e):null}}mo(YI,"FLOAT_PANE","floatPane");mo(YI,"MAP_PANE","mapPane");mo(YI,"MARKER_LAYER","markerLayer");mo(YI,"OVERLAY_LAYER","overlayLayer");mo(YI,"OVERLAY_MOUSE_TARGET","overlayMouseTarget");mo(YI,"contextType",Ra);function Kbo(){}function Dke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Eke(t){for(var e=1;enew google.maps.GroundOverlay(e,a,o),[]);return g.useEffect(()=>{l!==null&&l.setMap(i)},[i]),g.useEffect(()=>{typeof e<"u"&&l!==null&&(l.set("url",e),l.setMap(i))},[l,e]),g.useEffect(()=>{typeof r<"u"&&l!==null&&l.setOpacity(r?1:0)},[l,r]),g.useEffect(()=>{var s=new google.maps.LatLngBounds(new google.maps.LatLng(n.south,n.west),new google.maps.LatLng(n.north,n.east));typeof n<"u"&&l!==null&&(l.set("bounds",s),l.setMap(i))},[l,n]),null}g.memo($bo);class w0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{groundOverlay:null}),mo(this,"setGroundOverlayCallback",()=>{this.state.groundOverlay!==null&&this.props.onLoad&&this.props.onLoad(this.state.groundOverlay)})}componentDidMount(){od(!!this.props.url||!!this.props.bounds,"For GroundOverlay, url and bounds are passed in to constructor and are immutable after instantiated. This is the behavior of Google Maps JavaScript API v3 ( See https://developers.google.com/maps/documentation/javascript/reference#GroundOverlay) Hence, use the corresponding two props provided by `react-google-maps-api`, url and bounds. In some cases, you'll need the GroundOverlay component to reflect the changes of url and bounds. You can leverage the React's key property to remount the component. Typically, just `key={url}` would serve your need. See https://github.com/tomchentw/react-google-maps/issues/655");var e=new google.maps.GroundOverlay(this.props.url,this.props.bounds,Eke(Eke({},this.props.options),{},{map:this.context}));this.registeredEvents=Va({updaterMap:Fke,eventMap:kke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{groundOverlay:e}},this.setGroundOverlayCallback)}componentDidUpdate(e){this.state.groundOverlay!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Fke,eventMap:kke,prevProps:e,nextProps:this.props,instance:this.state.groundOverlay}))}componentWillUnmount(){this.state.groundOverlay&&(this.props.onUnmount&&this.props.onUnmount(this.state.groundOverlay),this.state.groundOverlay.setMap(null))}render(){return null}}mo(w0t,"defaultProps",{onLoad:Kbo});mo(w0t,"contextType",Ra);function Lke(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function WK(t){for(var e=1;e{google.maps.visualization||od(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} in useJsApiScript? %s',google.maps.visualization)},[]),g.useEffect(()=>{od(!!e,"data property is required in HeatmapLayer %s",e)},[e]),g.useEffect(()=>{a!==null&&a.setMap(i)},[i]),g.useEffect(()=>{r&&a!==null&&a.setOptions(r)},[a,r]),g.useEffect(()=>{var s=new google.maps.visualization.HeatmapLayer(WK(WK({},r),{},{data:e,map:i}));return l(s),n&&n(s),()=>{a!==null&&(o&&o(a),a.setMap(null))}},[]),null}g.memo(qbo);class Qbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{heatmapLayer:null}),mo(this,"setHeatmapLayerCallback",()=>{this.state.heatmapLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.heatmapLayer)})}componentDidMount(){od(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} to ? %s',google.maps.visualization),od(!!this.props.data,"data property is required in HeatmapLayer %s",this.props.data);var e=new google.maps.visualization.HeatmapLayer(WK(WK({},this.props.options),{},{data:this.props.data,map:this.context}));this.registeredEvents=Va({updaterMap:Nke,eventMap:Wke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{heatmapLayer:e}},this.setHeatmapLayerCallback)}componentDidUpdate(e){Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Nke,eventMap:Wke,prevProps:e,nextProps:this.props,instance:this.state.heatmapLayer})}componentWillUnmount(){this.state.heatmapLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.heatmapLayer),Za(this.registeredEvents),this.state.heatmapLayer.setMap(null))}render(){return null}}mo(Qbo,"contextType",Ra);var Uke={onCloseClick:"closeclick",onPanoChanged:"pano_changed",onPositionChanged:"position_changed",onPovChanged:"pov_changed",onResize:"resize",onStatusChanged:"status_changed",onVisibleChanged:"visible_changed",onZoomChanged:"zoom_changed"},jke={register(t,e,n){t.registerPanoProvider(e,n)},links(t,e){t.setLinks(e)},motionTracking(t,e){t.setMotionTracking(e)},options(t,e){t.setOptions(e)},pano(t,e){t.setPano(e)},position(t,e){t.setPosition(e)},pov(t,e){t.setPov(e)},visible(t,e){t.setVisible(e)},zoom(t,e){t.setZoom(e)}};class Zbo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{streetViewPanorama:null}),mo(this,"setStreetViewPanoramaCallback",()=>{this.state.streetViewPanorama!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewPanorama)})}componentDidMount(){var e,n,o=(e=(n=this.context)===null||n===void 0?void 0:n.getStreetView())!==null&&e!==void 0?e:null;this.registeredEvents=Va({updaterMap:jke,eventMap:Uke,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({streetViewPanorama:o}),this.setStreetViewPanoramaCallback)}componentDidUpdate(e){this.state.streetViewPanorama!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:jke,eventMap:Uke,prevProps:e,nextProps:this.props,instance:this.state.streetViewPanorama}))}componentWillUnmount(){this.state.streetViewPanorama!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.streetViewPanorama),Za(this.registeredEvents),this.state.streetViewPanorama.setVisible(!1))}render(){return null}}mo(Zbo,"contextType",Ra);class eSo extends g.PureComponent{constructor(){super(...arguments),mo(this,"state",{streetViewService:null}),mo(this,"setStreetViewServiceCallback",()=>{this.state.streetViewService!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewService)})}componentDidMount(){var e=new google.maps.StreetViewService;this.setState(function(){return{streetViewService:e}},this.setStreetViewServiceCallback)}componentWillUnmount(){this.state.streetViewService!==null&&this.props.onUnmount&&this.props.onUnmount(this.state.streetViewService)}render(){return null}}mo(eSo,"contextType",Ra);var Bke={onDirectionsChanged:"directions_changed"},Yke={directions(t,e){t.setDirections(e)},map(t,e){t.setMap(e)},options(t,e){t.setOptions(e)},panel(t,e){t.setPanel(e)},routeIndex(t,e){t.setRouteIndex(e)}};class tSo extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"state",{directionsRenderer:null}),mo(this,"setDirectionsRendererCallback",()=>{this.state.directionsRenderer!==null&&(this.state.directionsRenderer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.directionsRenderer))})}componentDidMount(){var e=new google.maps.DirectionsRenderer(this.props.options);this.registeredEvents=Va({updaterMap:Yke,eventMap:Bke,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{directionsRenderer:e}},this.setDirectionsRendererCallback)}componentDidUpdate(e){this.state.directionsRenderer!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Yke,eventMap:Bke,prevProps:e,nextProps:this.props,instance:this.state.directionsRenderer}))}componentWillUnmount(){this.state.directionsRenderer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.directionsRenderer),Za(this.registeredEvents),this.state.directionsRenderer&&this.state.directionsRenderer.setMap(null))}render(){return null}}mo(tSo,"contextType",Ra);var Oke={onPlacesChanged:"places_changed"},_ke={bounds(t,e){t.setBounds(e)}};class W4e extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",g.createRef()),mo(this,"state",{searchBox:null}),mo(this,"setSearchBoxCallback",()=>{this.state.searchBox!==null&&this.props.onLoad&&this.props.onLoad(this.state.searchBox)})}componentDidMount(){if(od(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places),this.containerElement!==null&&this.containerElement.current!==null){var e=this.containerElement.current.querySelector("input");if(e!==null){var n=new google.maps.places.SearchBox(e,this.props.options);this.registeredEvents=Va({updaterMap:_ke,eventMap:Oke,prevProps:{},nextProps:this.props,instance:n}),this.setState(function(){return{searchBox:n}},this.setSearchBoxCallback)}}}componentDidUpdate(e){this.state.searchBox!==null&&(Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:_ke,eventMap:Oke,prevProps:e,nextProps:this.props,instance:this.state.searchBox}))}componentWillUnmount(){this.state.searchBox!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.searchBox),Za(this.registeredEvents))}render(){return h.jsx("div",{ref:this.containerElement,children:g.Children.only(this.props.children)})}}mo(W4e,"contextType",Ra);var Vke={onPlaceChanged:"place_changed"},Gke={bounds(t,e){t.setBounds(e)},restrictions(t,e){t.setComponentRestrictions(e)},fields(t,e){t.setFields(e)},options(t,e){t.setOptions(e)},types(t,e){t.setTypes(e)}};class x0t extends g.PureComponent{constructor(){super(...arguments),mo(this,"registeredEvents",[]),mo(this,"containerElement",g.createRef()),mo(this,"state",{autocomplete:null}),mo(this,"setAutocompleteCallback",()=>{this.state.autocomplete!==null&&this.props.onLoad&&this.props.onLoad(this.state.autocomplete)})}componentDidMount(){var e;od(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places);var n=(e=this.containerElement.current)===null||e===void 0?void 0:e.querySelector("input");if(n){var o=new google.maps.places.Autocomplete(n,this.props.options);this.registeredEvents=Va({updaterMap:Gke,eventMap:Vke,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({autocomplete:o}),this.setAutocompleteCallback)}}componentDidUpdate(e){Za(this.registeredEvents),this.registeredEvents=Va({updaterMap:Gke,eventMap:Vke,prevProps:e,nextProps:this.props,instance:this.state.autocomplete})}componentWillUnmount(){this.state.autocomplete!==null&&Za(this.registeredEvents)}render(){return h.jsx("div",{ref:this.containerElement,className:this.props.className,children:g.Children.only(this.props.children)})}}mo(x0t,"defaultProps",{className:""});mo(x0t,"contextType",Ra);const Xke="/aladdin/assets/empty_heart-B57-2tMp.png",nSo="/aladdin/assets/red_heart-BaAtCixH.png",oSo="/aladdin/assets/open_file-B6scZwPU.png",rSo="/aladdin/assets/export_link-Dxa4UObV.png",iSo="/aladdin/assets/click_count-BZx6BgQJ.png";function cV(t){const e=new Date(t);if(!Number.isNaN(e.valueOf()))return e;const n=String(t).match(/\d+/g);if(n==null||n.length<=2)return e;{const[o,r,...i]=n.map(s=>parseInt(s)),a=[o,r-1,...i];return new Date(Date.UTC(...a))}}function Jke(t,e,n){const o=t!==1?e+"s":e;return t+" "+o+" "+n}function V1e(){return V1e=Object.assign?Object.assign.bind():function(t){for(var e=1;eDate.now();function lSo({date:t,formatter:e=Jke,component:n="time",live:o=!0,minPeriod:r=0,maxPeriod:i=uV,title:a,now:l=aSo,...s}){const[c,u]=g.useState(l());g.useEffect(()=>{if(!o)return;const S=(()=>{const v=cV(t).valueOf();if(!v)return console.warn("[react-timeago] Invalid Date provided"),0;const b=Math.round(Math.abs(c-v)/1e3),T=b{u(l())},R):0})();return()=>{S&&clearTimeout(S)}},[t,o,i,r,l,c]);const d=n,f=cV(t).valueOf();if(!f)return null;const p=Math.round(Math.abs(c-f)/1e3),m=f"u"?typeof t=="string"?t:cV(t).toISOString().substr(0,16).replace("T"," "):a,C=d==="time"?{...s,dateTime:cV(t).toISOString()}:s,P=Jke.bind(null,y,w,m);return g.createElement(d,V1e({},C,{title:x}),e(y,w,m,f,P,l))}function NK(){return NK=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}var cSo=["cdnSuffix","cdnUrl","countryCode","style","svg"],uSo="https://cdn.jsdelivr.net/gh/lipis/flag-icons/flags/4x3/",dSo="svg",fSo=127397,v0t=function(e){var n=e.cdnSuffix,o=n===void 0?dSo:n,r=e.cdnUrl,i=r===void 0?uSo:r,a=e.countryCode,l=e.style,s=e.svg,c=s===void 0?!1:s,u=sSo(e,cSo);if(typeof a!="string")return null;if(c){var d=""+i+a.toLowerCase()+"."+o;return g.createElement("img",Object.assign({},u,{src:d,style:NK({display:"inline-block",width:"1em",height:"1em",verticalAlign:"middle"},l)}))}var f=a.toUpperCase().replace(/./g,function(p){return String.fromCodePoint(p.charCodeAt(0)+fSo)});return g.createElement("span",Object.assign({role:"img"},u,{style:NK({display:"inline-block",fontSize:"1em",lineHeight:"1em",verticalAlign:"middle"},l)}),f)};const b0t=t=>{switch(t.type){case ga.PHOTOVOLTAIC:return lit;case ga.PARABOLIC_DISH:return sit;case ga.PARABOLIC_TROUGH:return cit;case ga.FRESNEL_REFLECTOR:return uit;case ga.SOLAR_POWER_TOWER:return dit;case ga.WIND_TURBINE:return pit;case ga.COLOCATION_PROJECTS:return git;case ga.RESIDENTIAL_BUILDING:return oit;case ga.COMMERCIAL_BUILDING:return rit;case ga.SCHOOL_BUILDING:return iit;case ga.TOURIST_ATTRACTION:return ait;case ga.UNDER_CONSTRUCTION:return fit}return hit},{Panel:hSo}=r9e,pSo=xe.memo(({latRef:t,lngRef:e,selectAuthor:n,closeMap:o,openModel:r,deleteModel:i,likeModel:a,pinModel:l})=>{var de;const s=H.getState().user,c=H(pn),u=H(Fn),d=H(WTt)??cVe,f=H(NTt)??0,p=H(r5e)??"roadmap",m=H(x5e),y=dt(ZGe),w=H(tXe),[x,C]=g.useState(null),[P,A]=g.useState(null),[S,v]=g.useState(null),[b,T]=g.useState(!0),[R,M]=g.useState(!1),D=g.useRef(null),k=g.useRef([]),N=g.useRef(-1),U=g.useRef([]),W=Kt(),F=14,E=(de=s.email)==null?void 0:de.endsWith("@intofuture.org"),L=()=>{U.current.length=0;for(const he in m)if(Object.hasOwn(m,he)){const me=m[he],ce=new google.maps.LatLng(me.latitude,me.longitude);U.current.push(ce)}},j=g.useCallback(he=>{C(he),L(),he.setMapTypeId(p)},[p]),Y=g.useCallback(function(){C(null)},[]),O=()=>{if(x){const he=x.getCenter();he&&(t.current=he.lat(),e.current=he.lng())}},_=()=>{if(x){const he=x.getZoom();he!==void 0&&he!==d&&c(me=>{me.modelsMapZoom=he})}},G=()=>{if(x){const he=x.getTilt();if(he!==void 0&&he!==f){const me={name:"Tilt Model Map",timestamp:Date.now(),oldValue:f,newValue:he,undo:()=>{c(ce=>{ce.modelsMapTilt=me.oldValue})},redo:()=>{c(ce=>{ce.modelsMapTilt=me.newValue})}};u(me),c(ce=>{ce.modelsMapTilt=he})}}},Q=()=>{if(x){const he=x.getMapTypeId();if(he!==void 0&&he!==p){const me={name:"Change Model Map Type",timestamp:Date.now(),oldValue:p,newValue:he,undo:()=>{c(ce=>{ce.modelsMapType=me.oldValue})},redo:()=>{c(ce=>{ce.modelsMapType=me.newValue})}};u(me),c(ce=>{ce.modelsMapType=he})}}},oe={styles:[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"labels",stylers:[{visibility:"off"}]}]},ee=he=>{he.userid&&he.title?(r(he),o()):co(B.t("message.ModelNotFound",W))},$=he=>{if(he.userid&&he.title){const me=k1+"?client=web&userid="+he.userid+"&title="+encodeURIComponent(he.title);navigator.clipboard.writeText(me).then(()=>d5(B.t("cloudFilePanel.LinkGeneratedInClipBoard",W)+"."))}else co(B.t("message.ModelNotFound",W))},ae=he=>{li.confirm({title:B.t("message.DoYouWantToDeleteModelFromMap",W),icon:h.jsx(_y,{}),onOk:()=>{i(he,()=>{c(me=>{var ce,Pe;if(me.modelSites){const pe=me.modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(pe){let Ie;for(const[ve,ze]of pe)if(ze.userid===he.userid&&ze.title===he.title){Ie=ve;break}Ie&&(pe.delete(Ie),pe.size===0&&((Pe=(ce=k.current[N.current])==null?void 0:ce.marker)==null||Pe.setMap(null)))}}}),A(null),v(null)})},onCancel:()=>{},okText:B.t("word.Yes",W),cancelText:B.t("word.No",W)})},Z=he=>{var me;if(he.userid&&he.title){const ce=ye.getModelKey(he),Pe=!!((me=s.likes)!=null&&me.includes(ce));a(he,!Pe,()=>{c(pe=>{if(pe.user)if(pe.user.likes||(pe.user.likes=[]),pe.user.likes.includes(ce)){const Ie=pe.user.likes.indexOf(ce);Ie>=0&&pe.user.likes.splice(Ie,1)}else pe.user.likes.push(ce);if(pe.modelSites){const Ie=pe.modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(Ie){for(const ve of Ie.values())if(ve.userid===he.userid&&ve.title===he.title){ve.likeCount===void 0&&(ve.likeCount=0),ve.likeCount+=Pe?-1:1;break}}}}),M(!R)})}},ne=he=>{const me=H.getState().modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(me){for(const ce of me.values())if(ce.userid===he.userid&&ce.title===he.title)return ce.likeCount??0}return 0},te=he=>{const me=H.getState().modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(me){for(const ce of me.values())if(ce.userid===he.userid&&ce.title===he.title)return ce.clickCount??0}return 0},q=he=>{const me=H.getState().modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(me){for(const ce of me.values())if(ce.userid===he.userid&&ce.title===he.title)return ce.pinned}return!1},le=(he,me)=>{he.userid&&he.title&&l(he,me,()=>{c(ce=>{if(ce.modelSites){const Pe=ce.modelSites.get(ye.getLatLngKey(he.latitude,he.longitude));if(Pe){for(const pe of Pe.values())if(pe.userid===he.userid&&pe.title===he.title){pe.pinned=me,M(!R);break}}}})})};return h.jsx(r0t,{mapContainerStyle:{border:"1px solid",width:"100%",height:"100%"},mapTypeId:p,options:oe,center:{lat:t.current,lng:e.current},zoom:d,tilt:f,onLoad:j,onUnmount:Y,onCenterChanged:O,onZoomChanged:_,onTiltChanged:G,onMapTypeIdChanged:Q,children:h.jsxs(h.Fragment,{children:[y&&U.current.map((he,me)=>{const ce=.2*d;return h.jsx(Y1e,{icon:{path:google.maps.SymbolPath.CIRCLE,strokeColor:"red",strokeWeight:ce+2,scale:ce},position:he},me)}),P&&P.size&&S&&h.jsx(m0t,{position:{lat:S.lat(),lng:S.lng()},children:h.jsxs("div",{style:{border:"2px solid gainsboro",maxHeight:"400px",overflowY:"auto"},onMouseLeave:()=>{A(null),v(null)},children:[P.size>1?h.jsxs("div",{style:{background:"#dddddd",textAlign:"left",borderBottom:"1px solid gainsboro",paddingBottom:"4px",marginBottom:"4px"},children:[b?h.jsx(XZt,{title:B.t("modelsMap.SortFromNewestToOldest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{T(!1)}}):h.jsx(stn,{title:B.t("modelsMap.SortFromOldestToNewest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{T(!0)}}),h.jsxs("span",{style:{fontSize:"10px"},children:[P.size," ",B.t("modelsMap.ModelsFoundOnThisSite",W)]}),S&&h.jsxs("span",{style:{fontSize:"10px"},children:[" —"," ",B.t("word.Coordinates",W)+": ("+S.lat().toFixed(a8)+"°, "+S.lng().toFixed(a8)+"°)"]})]}):"",[...P.keys()].sort((he,me)=>{const ce=P.get(he),Pe=P.get(me);return ce!=null&&ce.pinned&&!(Pe!=null&&Pe.pinned)?-1:Pe!=null&&Pe.pinned&&!(ce!=null&&ce.pinned)?1:(b?1:-1)*(((ce==null?void 0:ce.timeCreated)??0)-((Pe==null?void 0:Pe.timeCreated)??0))}).map((he,me)=>{const ce=P.get(he);return ce?h.jsxs("div",{style:{padding:(P==null?void 0:P.size)>1?"5px 5px 20px 5px":"5px",background:me%2===0?"white":"#eeeeee"},children:[me===0&&h.jsxs("div",{style:{fontSize:"12px",display:"block",paddingBottom:"6px"},children:[ce.countryCode&&h.jsx(v0t,{countryCode:ce.countryCode,style:{marginRight:"6px",width:"20px"},svg:!0}),ce.address??"Unknown",P.size===1&&h.jsx("span",{style:{fontSize:"10px",display:"block",paddingTop:"10px"},children:B.t("word.Coordinates",W)+": ("+S.lat().toFixed(a8)+"°, "+S.lng().toFixed(a8)+"°)"})]}),h.jsx(r9e,{style:{background:q(ce)?"#FEF9EC":me%2===0?"white":"#eeeeee",width:"400px"},bordered:!1,ghost:!0,defaultActiveKey:["0"],children:h.jsx(hSo,{header:h.jsxs(h.Fragment,{children:[ce.label,q(ce)&&h.jsx(RCe,{style:{marginLeft:"8px"}})]}),style:{fontSize:"12px"},children:h.jsx("div",{style:{fontSize:"10px",display:"block",textAlign:"left"},children:h.jsxs(Jt,{align:"start",children:[ce.thumbnailUrl&&h.jsx("img",{alt:ce.label,title:B.t("word.Open",W),src:ce.thumbnailUrl,style:{border:"1px solid #222",cursor:"pointer"},onClick:()=>ee(ce)}),h.jsxs("div",{children:[ce.description&&ce.description.trim()!==""?ce.description:""," —  By"," ",h.jsx("span",{style:{cursor:"pointer"},title:B.t("modelsMap.ShowModelsPublishedByThisAuthor",W),onClick:()=>{n(ce.author)},children:!ce.author||ce.author===""?B.t("word.Anonymous",W):ce.author}),", ",ce.timeCreated&&h.jsx(lSo,{date:new Date(ce.timeCreated)})]})]})})},me)}),h.jsxs("div",{style:{marginTop:"10px",fontSize:"11px"},children:[E&&h.jsx(h.Fragment,{children:q(ce)?h.jsx(jen,{style:{cursor:"pointer"},title:B.t("word.Unpin",W),onClick:()=>le(ce,!1)}):h.jsx(RCe,{style:{cursor:"pointer"},title:B.t("word.Pin",W),onClick:()=>le(ce,!0)})}),h.jsx("img",{alt:"Open",onClick:()=>ee(ce),style:{marginLeft:"10px",cursor:"pointer"},title:B.t("word.Open",W),src:oSo,height:F,width:F}),h.jsx("img",{alt:"Export link",onClick:()=>$(ce),style:{marginLeft:"5px",cursor:"pointer"},title:B.t("word.Share",W),src:rSo,height:F,width:F}),ce.userid===s.uid&&h.jsx("img",{alt:"Delete",onClick:()=>ae(ce),style:{marginLeft:"5px",cursor:"pointer"},title:B.t("word.Delete",W),src:n0t,height:F,width:F}),s.uid?h.jsx(h.Fragment,{children:s.likes&&s.likes.includes(ye.getModelKey(ce))?h.jsx("img",{alt:"Like",onClick:()=>Z(ce),style:{marginLeft:"10px",cursor:"pointer"},title:B.t("word.AlreadyLike",W),src:nSo,height:F,width:F}):h.jsx("img",{alt:"Like",onClick:()=>Z(ce),style:{marginLeft:"10px",cursor:"pointer"},title:B.t("word.Like",W),src:Xke,height:F,width:F})}):h.jsx(h.Fragment,{children:h.jsx("img",{alt:"Like",style:{marginLeft:"10px",opacity:.5},title:B.t("word.MustLogInToLike",W),src:Xke,height:F,width:F})}),"   ",ne(ce),h.jsx("img",{alt:"Click counter",style:{marginLeft:"10px"},title:B.t("word.ClickCount",W),src:iSo,height:F,width:F}),"   ",te(ce)]})]},me):null})]})}),!!w&&!!w.size&&h.jsx(d0t,{children:he=>h.jsx("div",{children:[...w.keys()].map((me,ce)=>{const Pe=w.get(me);if(!Pe||!Pe.size)return null;const pe=[...Pe.keys()].sort((se,ge)=>{const we=Pe.get(se),Se=Pe.get(ge);return we!=null&&we.pinned&&!(Se!=null&&Se.pinned)?-1:Se!=null&&Se.pinned&&!(we!=null&&we.pinned)?1:(b?1:-1)*(((we==null?void 0:we.timeCreated)??0)-((Se==null?void 0:Se.timeCreated)??0))}),Ie=Pe.get(pe[0]);if(!Ie)return null;const ve=b0t(Ie),ze=dt.getState().modelsMapSelectedSite;let Ae=!1;for(const[se,ge]of Pe)if(ge.title===(ze==null?void 0:ze.title)){Ae=!0;break}return h.jsx(Y1e,{label:Ae?{text:"⇧",color:"red",fontSize:"24px",fontWeight:"bold"}:void 0,ref:se=>k.current[ce]=se,clusterer:he,icon:ve?{url:ve,labelOrigin:{x:15,y:42}}:void 0,position:{lat:Ie.latitude,lng:Ie.longitude},onClick:()=>ee(Ie),onMouseOver:()=>{D.current=P,N.current=ce,A(Pe);const se=me.split(", ");v(new google.maps.LatLng(Number.parseFloat(se[0]),Number.parseFloat(se[1])))},onMouseOut:()=>{P===D.current&&(A(null),v(null))}},ce)})})})]})})}),gSo="/aladdin/assets/image_load_failure-HGDkwC0S.png",S0t=xe.memo(({latRef:t,lngRef:e,author:n,models:o,closeCallback:r,openCloudFile:i})=>{const a=H(Xp),l=H(Au),s=H(pn),c=H(r5e),u=g.useRef(o?new Map(o):new Map),[d,f]=g.useState(!1),[p,m]=g.useState(),[y,w]=g.useState(!1),{Search:x}=Vl,C=g.useMemo(()=>({lng:l}),[l]);g.useEffect(()=>{o&&(u.current=new Map(o),f(!d))},[o]);const P=g.useMemo(()=>{let S=0;for(const v of u.current.values())(n||v.userid===a.uid)&&S++;return S},[u.current,n,a.uid,d]),A=n&&c!=="roadmap";return u.current.size===0?h.jsx(jhe,{mask:!1,styles:{header:{height:"40px",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",background:A?"#6A6B6E":"whitesmoke"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:A?"#2A2B2E":"white"}},style:{scrollbarColor:A?"#6A6B6E":"whitesmoke"},title:(n??B.t("modelsMap.MyPublishedModels",C))+" (0)",placement:"bottom",open:!0,height:"150px",onClose:()=>{r()},children:h.jsx(w1,{image:w1.PRESENTED_IMAGE_SIMPLE,style:{color:A?"lightgray":"dimgray"}})}):h.jsx(jhe,{extra:h.jsxs(Jt,{children:[y?h.jsx(Pen,{title:B.t("modelsMap.SortFromNewestToOldest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{w(!1)}}):h.jsx(mtt,{title:B.t("modelsMap.SortFromOldestToNewest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{w(!0)}}),h.jsx(x,{title:B.t("modelsMap.SearchByLabel",C),allowClear:!0,size:"small",enterButton:!0,onSearch:S=>{var v;if(o){u.current.clear();for(const[b,T]of o)(v=T.label)!=null&&v.toLowerCase().includes(S.toLowerCase())&&u.current.set(b,T);f(!d)}}})]}),mask:!1,styles:{header:{height:"40px",color:A?"white":"black",background:A?"#6A6B6E":"whitesmoke",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",border:"none"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:A?"#2A2B2E":"white"}},title:(n??B.t("modelsMap.MyPublishedModels",C))+" ("+P+")",placement:"bottom",open:!0,height:"164px",onClose:()=>{m(void 0),r()},children:h.jsx("table",{children:h.jsx("tbody",{children:h.jsx("tr",{children:[...u.current.keys()].sort((S,v)=>{const b=u.current.get(S),T=u.current.get(v);return!b||!T?0:(y?-1:1)*((T.timeCreated??0)-(b.timeCreated??0))}).map((S,v)=>{const b=u.current.get(S);return!b||!n&&b.userid!==a.uid?null:h.jsx("td",{children:h.jsxs("div",{style:{display:"block",marginTop:"4px"},children:[h.jsx("img",{loading:"lazy",height:"100px",width:"auto",onError:T=>{T.target.src=gSo},alt:b.label,title:b.label,src:b.thumbnailUrl,style:{cursor:"pointer",borderRadius:p===b?"0":"10px",border:p===b?"4px solid "+(A?"goldenrod":"red"):"none",marginRight:"4px"},onClick:()=>{m(b),i?i(b.userid,b.title):(s(T=>{b&&(T.modelsMapLatitude=b.latitude,T.modelsMapLongitude=b.longitude,T.modelsMapZoom=17,t&&(t.current=b.latitude),e&&(e.current=b.longitude))}),dt.getState().set(T=>{T.modelsMapSelectedSite=b}))}}),h.jsxs("div",{children:[h.jsx("img",{alt:b.type,src:b0t(b),style:{position:"relative",left:"8px",bottom:"28px",width:"16px",height:"16px"}}),h.jsx("span",{style:{position:"relative",left:"16px",bottom:"24px",color:"white",fontSize:"8px",fontWeight:"bold"},children:b.label?b.label.length>30?b.label.substring(0,30)+"...":b.label:"Unknown"})]})]})},v)})})})})})}),mSo=["places"],{RangePicker:ySo}=F7,ASo=ko.div` position: absolute; top: 70px; left: 0; @@ -7244,9 +7244,9 @@ PERFORMANCE OF THIS SOFTWARE. z-index: 999; tab-index: 0; background: white; -`,qke=xe.memo(({openCloudFile:t,deleteModelFromMap:e,likeModelFromMap:n,pinModelFromMap:o})=>{var Z;const r=H(Xp),i=H(pn),a=dt(kf),l=H(Fn),s=H(r5e),c=H(FTt),u=c!==void 0?c:42.2844063,d=H(LTt),f=d!==void 0?d:-71.3488548,p=H.getState().modelsMapAddress??zX,m=dt(ZGe),y=H(oXe),w=H(rXe),x=H(iXe),C=dt(ZTt),P=H(jTt),A=H(tXe),S=H(BTt),v=H(nXe),b=H(YTt),T=g.useRef(v?new Map(v):new Map),[R,M]=g.useState(),[D,k]=g.useState(!1),N=g.useRef(),U=g.useRef(),W=g.useRef(u),F=g.useRef(f),E=Kt(),{Search:L}=Vl;g.useEffect(()=>{T.current=v?new Map(v):new Map,R&&(N.current=v.get(R)),k(!D)},[v,R]);const j=ne=>{M(ne),dt.getState().set(te=>{te.showLeaderboard||(te.leaderboardFlag=!0),ne&&(N.current=T.current.get(ne))})},{isLoaded:Y,loadError:O}=c0t({id:"google-map-script",googleMapsApiKey:"AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",libraries:mSo}),_=()=>{dt.getState().set(ne=>{ne.openModelsMap=!1}),i(ne=>{ne.modelsMapLatitude=W.current,ne.modelsMapLongitude=F.current})},G=ne=>{U.current=ne},Q=()=>{var te;const ne=(te=U.current)==null?void 0:te.getPlaces();if(ne&&ne.length>0){const $=ne[0].geometry;if($&&$.location){const le={name:"Set Model Map Location",timestamp:Date.now(),oldLatitude:u,newLatitude:$.location.lat(),oldLongitude:f,newLongitude:$.location.lng(),oldAddress:p,newAddress:ne[0].formatted_address,undo:()=>{i(de=>{de.modelsMapLatitude=le.oldLatitude,de.modelsMapLongitude=le.oldLongitude,de.modelsMapAddress=le.oldAddress,W.current=de.modelsMapLatitude,F.current=de.modelsMapLongitude})},redo:()=>{i(de=>{de.modelsMapLatitude=le.newLatitude,de.modelsMapLongitude=le.newLongitude,de.modelsMapAddress=le.newAddress,W.current=de.modelsMapLatitude,F.current=de.modelsMapLongitude})}};l(le),i(de=>{$.location&&(de.modelsMapLatitude=$.location.lat(),de.modelsMapLongitude=$.location.lng(),W.current=de.modelsMapLatitude,F.current=de.modelsMapLongitude),de.modelsMapAddress=ne[0].formatted_address})}}},oe=(Z=r.email)==null?void 0:Z.endsWith("@intofuture.org"),ee=g.useMemo(()=>{if(!S||!S.size)return 0;let ne=0;for(const te of S.values())ne+=te.size??0;return ne},[S]),q=g.useMemo(()=>{if(!A||!A.size)return 0;let ne=0;for(const te of A.values())ne+=te.size??0;return ne},[A]),ae=(ne,te)=>{const $=new Map;for(const[le,de]of b){const he=new Map;for(const[me,ce]of de)ce.timeCreated&&ce.timeCreated>=ne&&ce.timeCreated<=te&&he.set(me,ce);he.size>0&&$.set(le,he)}i(le=>{le.peopleModels=$})};return h.jsxs(ASo,{onKeyDown:ne=>{ne.key==="Escape"&&_()},children:[Y&&h.jsxs(Jt,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"240px",width:"300px",height:"28px",background:"white",borderRadius:"5px",boxShadow:"1px 1px 1px 1px gray"},children:[h.jsx(W4e,{onLoad:G,onPlacesChanged:Q,children:h.jsx("input",{type:"text",placeholder:p,style:{boxSizing:"border-box",border:"1px solid transparent",width:"100%",height:"100%",fontSize:"12px",paddingLeft:"8px",paddingRight:"8px",outline:"none",textOverflow:"ellipses",position:"relative"}})}),h.jsx(HZ,{style:{marginLeft:"100px"}})]}),Y&&h.jsxs(Jt,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"540px",width:"400px",height:"28px",paddingLeft:"12px"},children:[h.jsx(Li,{checked:y,onChange:ne=>{const te=ne.target.checked;if(i($=>{$.showModelsAllTime=te}),te)i($=>{$.peopleModels=new Map($.allPeopleModels)});else{const $=il(w).toDate().getTime(),le=il(x).toDate().getTime();ae($,le)}dt.getState().set($=>{$.modelsMapFlag=!0})},children:B.t("modelsMap.AllTime",E)}),!y&&h.jsx(ySo,{format:"YYYY-MM-DD",size:"small",allowClear:!1,needConfirm:!0,value:[il(w),il(x)],onOk:ne=>{if(!ne)return;const te=["2021-01-01","2025-12-31"];ne[0]&&(te[0]=ne[0].toISOString()),ne[1]&&(te[1]=ne[1].toISOString());const $=il(te[0]).toDate().getTime(),le=il(te[1]).toDate().getTime(),de=new Map;for(const[he,me]of S){const ce=new Map;for(const[Pe,pe]of me)pe.timeCreated&&pe.timeCreated>=$&&pe.timeCreated<=le&&ce.set(Pe,pe);ce.size>0&&de.set(he,ce)}i(he=>{he.showModelsFromDate=te[0],he.showModelsToDate=te[1],he.modelSites=de}),C&&ae($,le)}})]}),Y?h.jsx(pSo,{latRef:W,lngRef:F,selectAuthor:j,closeMap:_,openModel:t,deleteModel:e,likeModel:n,pinModel:o}):h.jsx(ute,{}),O&&h.jsx(Jt,{children:h.jsx("div",{children:"Map cannot be loaded right now, sorry."})}),h.jsxs(h.Fragment,{children:[R&&h.jsx(S0t,{latRef:W,lngRef:F,author:R,models:N.current,closeCallback:()=>{M(void 0),a("modelsMapSelectedSite",void 0),N.current=void 0}}),C&&!R&&h.jsx("div",{style:{position:"absolute",fontSize:"10px",color:"black",bottom:"33px",left:"5px",width:"180px",height:"360px",overflowY:"auto",padding:"6px 6px 6px 6px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",textAlign:"left"},children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(L,{title:B.t("modelsMap.SearchByPublisher",E),allowClear:!0,size:"small",enterButton:!0,onSearch:ne=>{if(v){T.current.clear();for(const[te,$]of v)te.toLowerCase().includes(ne.toLowerCase())&&T.current.set(te,$);k(!D)}}}),T.current.size===0?h.jsx(w1,{image:w1.PRESENTED_IMAGE_SIMPLE}):h.jsx("table",{children:h.jsx("tbody",{children:[...T.current.keys()].sort((ne,te)=>{const $=T.current.get(ne),le=T.current.get(te);return(le?le.size:0)-($?$.size:0)}).map((ne,te)=>{if(te>50)return null;const $=T.current.get(ne);return($==null?void 0:$.size)===void 0||($==null?void 0:$.size)===0?null:h.jsxs("tr",{style:{width:"180px"},children:[h.jsx("td",{style:{width:"150px"},children:h.jsx(fnt,{icon:h.jsx(dtn,{}),color:($==null?void 0:$.size)>10?"gold":($==null?void 0:$.size)>5?"lime":($==null?void 0:$.size)>1?"blue":"magenta",style:{cursor:"pointer",fontSize:"10px",fontWeight:"bold",width:"130px"},onClick:()=>M(ne),title:ne,children:ne.length>16?ne.substring(0,15)+"...":ne})}),h.jsx("td",{children:$==null?void 0:$.size})]},te)})})})]})}),h.jsx(Jt,{children:h.jsxs("div",{title:B.t("modelsMap.TotalNumberOfUserPublishedModelsInSelectedPeriod",E)+": "+q+` -`+B.t("modelsMap.AllTimeTotal",E)+": "+ee,style:{position:"absolute",fontSize:"14px",color:"black",bottom:"6px",left:"5px",width:"180px",height:"25px",paddingTop:"4px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",cursor:"pointer",userSelect:"none"},onClick:()=>{dt.getState().set(ne=>{ne.showLeaderboard||(ne.leaderboardFlag=!0),ne.showLeaderboard=!ne.showLeaderboard})},children:[C?h.jsx(ptn,{title:B.t("word.Close",E),style:{marginRight:"8px"}}):h.jsx(VYt,{title:B.t("word.Open",E),style:{marginRight:"8px"}}),B.t("word.Leaderboard",E)]})}),P&&h.jsx(Jt,{children:h.jsxs("div",{style:{position:"absolute",fontSize:"10px",color:s==="roadmap"?"black":"white",bottom:"6px",left:"188px",height:"25x",padding:"6px 6px 2px 6px",cursor:"pointer"},onClick:()=>{i(ne=>{P&&(ne.modelsMapLatitude=P.latitude,ne.modelsMapLongitude=P.longitude,ne.modelsMapZoom=20,W.current=ne.modelsMapLatitude,F.current=ne.modelsMapLongitude)})},children:[B.t("word.Latest",E)+": ",P.countryCode&&h.jsx(v0t,{countryCode:P.countryCode,style:{marginLeft:"2px",marginRight:"4px",width:"20px"},svg:!0}),P.title+", by "+P.author]})}),h.jsx(Jt,{children:h.jsx("div",{style:{position:"absolute",fontSize:"12px",color:s==="roadmap"?"black":"white",top:"6px",height:"25x",padding:"6px 6px 2px 6px"},children:A.size+" "+B.t("modelsMap.SitesFound",E)})}),h.jsx(Jt,{children:h.jsx("div",{style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:r.uid?"60px":"100px",width:"64px",height:"28px",background:"orange",boxShadow:"1px 1px 1px 1px gray",paddingTop:"4px"},onMouseDown:()=>{_()},children:B.t("word.Close",E)})}),oe&&h.jsx(Jt,{children:h.jsx(Li,{checked:m,style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:"130px",width:"160px",height:"28px",background:"white",boxShadow:"1px 1px 1px 1px gray",paddingLeft:"4px"},onChange:()=>{dt.getState().set(ne=>{ne.modelsMapWeatherStations=!ne.modelsMapWeatherStations})},children:m?h.jsx("span",{title:B.t("mapPanel.WeatherStationsNote",E),children:B.t("mapPanel.WeatherStations",E)}):h.jsx("span",{children:B.t("mapPanel.WeatherStations",E)})})})]})]})}),wSo="/aladdin/assets/tiny_lock-DSfuZD8Y.png",xSo="/aladdin/assets/select-C-gZZ0yB.png",Qke="/aladdin/assets/foundation-Bf2d60AT.png",Zke="/aladdin/assets/cuboid-C70KMDTq.png",eFe="/aladdin/assets/sensor-BZ9UhBbW.png",G1e="/aladdin/assets/solar-panel-BLllvFhu.png",tFe="/aladdin/assets/wall-Dcb0OCnD.png",nFe="/aladdin/assets/window-uls1fTpz.png",oFe="/aladdin/assets/door-DmvdjDKR.png",rFe="/aladdin/assets/pyramid_roof-CRzRVezC.png",iFe="/aladdin/assets/hip_roof-gO3gEx_s.png",aFe="/aladdin/assets/gambrel_roof-BKCAWDsb.png",lFe="/aladdin/assets/mansard_roof-DRTaI5DY.png",sFe="/aladdin/assets/gable_roof-9fruWngj.png",cFe="/aladdin/assets/tree-BUu2qyTB.png",uFe="/aladdin/assets/flower-DErmZ90Q.png",dFe="/aladdin/assets/human-EToF5YZi.png",fFe="/aladdin/assets/parabolic_trough-CSR3V81L.png",hFe="/aladdin/assets/parabolic_dish-BYGRlVcr.png",pFe="/aladdin/assets/fresnel_reflector-CBKiWWxR.png",X1e="/aladdin/assets/heliostat-Kq0JVQG1.png",gFe="/aladdin/assets/wind_turbine-D02sl9A9.png",vSo="/aladdin/assets/vertical_axis_wind_turbine-C-KZaZtD.png",mFe="/aladdin/assets/led_light-D7hmM4q6.png",bSo="/aladdin/assets/group-BuZ9lmWH.png",SSo="/aladdin/assets/clear-BZ83yweM.png",TSo="/aladdin/assets/heliodon-CPHdpxt2.png",PSo="/aladdin/assets/analyze-CgmQCUK0.png",yFe="/aladdin/assets/battery_storage-DDItm8kX.png",AFe="/aladdin/assets/solar_water_heater-ifX6Xha6.png",Cw=({...t})=>h.jsx("div",{style:{verticalAlign:"top",display:"inline-block",marginTop:"4px",marginRight:"8px"},children:t.children}),gv="invert(41%) sepia(0%) saturate(0%) hue-rotate(224deg) brightness(93%) contrast(81%)",QP="invert(93%) sepia(3%) saturate(1955%) hue-rotate(26deg) brightness(113%) contrast(96%)",su=({objectType:t,srcImg:e,setFlag:n,replacingText:o})=>{const r=a=>{H.getState().set(l=>{l.objectTypeToAdd=a,l.groupActionMode=!1,l.actionModeLock=!1}),jn.getState().setEnableOrbitController(!1),H.getState().selectNone()},i=Kt();return h.jsxs(ln,{noPadding:!0,textSelectable:!1,onClick:()=>{n(t),r(t)},children:[h.jsx("img",{alt:t,src:e,height:36,width:36,style:{filter:gv,verticalAlign:"middle",marginRight:"10px"}}),B.t(`toolbar.Add${o??t.replaceAll(" ","")}`,i)]})},CSo=xe.memo(()=>{const t=H(pn),e=dt(kf),n=H(Qi),o=H(YM),r=H(Qn),i=H(Au),a=H(qN),l=H(KPt),s=H(UGe),c=H(q2e),u=dt(vs),d=H(lPt),f=H(bQ),p=H(TQ),m=H(PQ),y=H(CJe),w=H(JRt),x=H(KRt),C=H(Fn),P=dt(BN),A=dt(l5e),S=H(MJe),v=H(tHt),[b,T]=g.useState(z.Foundation),[R,M]=g.useState(z.Wall),[D,k]=g.useState(z.SolarPanel),N=g.useMemo(()=>({lng:i}),[i]),U=()=>{t($=>{$.objectTypeToAdd=z.None,$.groupActionMode=!1,$.actionModeLock=!1}),dt.getState().setSelectButtonClicked(!0)},W=()=>{t($=>{$.groupActionMode||($.objectTypeToAdd=z.None),$.groupActionMode=!$.groupActionMode})},F=()=>{li.confirm({title:B.t("toolbar.DoYouReallyWantToClearContent",N)+"?",icon:h.jsx(_y,{}),onOk:()=>{const $=JSON.parse(JSON.stringify(H.getState().elements));d();const le={name:"Clear Scene",timestamp:Date.now(),removedElements:$,undo:()=>{t(de=>{de.elements.push(...le.removedElements)})},redo:()=>{d()}};C(le)}}),U()},E=()=>{const $={name:"Show Sun and Time Settings Panel",timestamp:Date.now(),checked:!s,undo:()=>{t(le=>{le.viewState.showHeliodonPanel=!$.checked})},redo:()=>{t(le=>{le.viewState.showHeliodonPanel=$.checked})}};C($),t(le=>{le.viewState.showHeliodonPanel=!le.viewState.showHeliodonPanel,le.viewState.showHeliodonPanel&&(le.selectedFloatingWindow="heliodonPanel")})},L=()=>{A||yn(B.t("message.SimulationStarted",N)),setTimeout(()=>{a(),e("runStaticSimulation",!A),n&&o("Generate Daily Solar Radiation Heatmap (Static)")},100)},j=()=>{P||yn(B.t("message.SimulationStarted",N)),setTimeout(()=>{a(),e("runDynamicSimulation",!P),n&&o("Generate Daily Solar Radiation Heatmap (Dynamic)")},100)},Y=$=>{t(le=>{le.objectTypeToAdd=$,le.groupActionMode=!1,le.actionModeLock=!1}),jn.getState().setEnableOrbitController(!1),dt.getState().setSelectButtonClicked(!1),a()},O=$=>{switch($){case z.Human:case z.Tree:case z.Flower:case z.Sensor:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.VerticalAxisWindTurbine:case z.Light:case z.Wall:case z.Window:return!0;default:return!1}},_=($,le,de,he)=>{const me=O($),ce=()=>B.t(`toolbar.Add${he??$.replaceAll(" ","")}`,N)+(me?` -`+(l?B.t("toolbar.ClickToUnlockThisModeForNextAction",N):B.t("toolbar.DoubleClickToLockThisModeForNextAction",N)):"");return h.jsxs(h.Fragment,{children:[h.jsx("img",{title:ce(),alt:$,src:le,height:36,width:36,style:{filter:f===$||de?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{Y($)},onDoubleClick:()=>{me&&t(Pe=>{Pe.actionModeLock=!0})}}),(f===$||de)&&me&&l&&h.jsx("img",{alt:"Tiny lock",src:wSo,style:{marginLeft:"-2px",filter:f===$||de?QP:gv,verticalAlign:"top"}})]})},G=$=>h.jsx(e4,{menu:$,trigger:["click"],children:h.jsx("span",{title:B.t("toolbar.ClickForMoreButtons",N),style:{cursor:"pointer",verticalAlign:"middle",fontSize:"10px",marginLeft:"4px",width:"10px",height:"36px",color:"#666666",fontWeight:"bold"},children:"▼"})}),Q=[{key:"add-foundation",label:h.jsx(su,{objectType:z.Foundation,srcImg:Qke,setFlag:T})},{key:"add-cuboid",label:h.jsx(su,{objectType:z.Cuboid,srcImg:Zke,setFlag:T})},{key:"add-tree",label:h.jsx(su,{objectType:z.Tree,srcImg:cFe,setFlag:T})},{key:"add-flower",label:h.jsx(su,{objectType:z.Flower,srcImg:uFe,setFlag:T})},{key:"add-human",label:h.jsx(su,{objectType:z.Human,srcImg:dFe,setFlag:T,replacingText:"People"})}],oe=[{key:"add-wall",label:h.jsx(su,{objectType:z.Wall,srcImg:tFe,setFlag:M})},{key:"add-window",label:h.jsx(su,{objectType:z.Window,srcImg:nFe,setFlag:M})},{key:"add-door",label:h.jsx(su,{objectType:z.Door,srcImg:oFe,setFlag:M})},{key:"add-pyramid-roof",label:h.jsx(su,{objectType:z.PyramidRoof,srcImg:rFe,setFlag:M})},{key:"add-hip-roof",label:h.jsx(su,{objectType:z.HipRoof,srcImg:iFe,setFlag:M})},{key:"add-gable-roof",label:h.jsx(su,{objectType:z.GableRoof,srcImg:sFe,setFlag:M})},{key:"add-gambrel-roof",label:h.jsx(su,{objectType:z.GambrelRoof,srcImg:aFe,setFlag:M})},{key:"add-mansard-roof",label:h.jsx(su,{objectType:z.MansardRoof,srcImg:lFe,setFlag:M})}],ee=[{key:"add-solar-panel",label:h.jsx(su,{objectType:z.SolarPanel,srcImg:G1e,setFlag:k})},{key:"add-parabolic-trough",label:h.jsx(su,{objectType:z.ParabolicTrough,srcImg:fFe,setFlag:k})},{key:"add-parabolic-dish",label:h.jsx(su,{objectType:z.ParabolicDish,srcImg:hFe,setFlag:k})},{key:"add-fresnel-reflector",label:h.jsx(su,{objectType:z.FresnelReflector,srcImg:pFe,setFlag:k})},{key:"add-heliostat",label:h.jsx(su,{objectType:z.Heliostat,srcImg:X1e,setFlag:k})},{key:"add-wind-turbine",label:h.jsx(su,{objectType:z.WindTurbine,srcImg:gFe,setFlag:k})},{key:"add-sensor",label:h.jsx(su,{objectType:z.Sensor,srcImg:eFe,setFlag:k})},{key:"add-light",label:h.jsx(su,{objectType:z.Light,srcImg:mFe,setFlag:k})},{key:"add-water-heater",label:h.jsx(su,{objectType:z.SolarWaterHeater,srcImg:AFe,setFlag:k})},{key:"add-battery-storage",label:h.jsx(su,{objectType:z.BatteryStorage,srcImg:yFe,setFlag:k})}],q=$=>{switch($){case z.Foundation:return _($,Qke,H.getState().addedFoundationId);case z.Cuboid:return _($,Zke,H.getState().addedCuboidId);case z.Tree:return _($,cFe);case z.Flower:return _($,uFe);case z.Human:return _($,dFe,void 0,"People")}},ae=$=>{switch($){case z.Wall:return _($,tFe,H.getState().addedWallId);case z.Window:return _($,nFe,H.getState().addedWindowId);case z.Door:return _($,oFe,H.getState().addedDoorId);case z.PyramidRoof:return _(z.PyramidRoof,rFe);case z.HipRoof:return _(z.HipRoof,iFe);case z.GableRoof:return _(z.GableRoof,sFe);case z.GambrelRoof:return _(z.GambrelRoof,aFe);case z.MansardRoof:return _(z.MansardRoof,lFe)}},Z=$=>{switch($){case z.SolarPanel:return _($,G1e);case z.ParabolicTrough:return _($,fFe);case z.ParabolicDish:return _($,hFe);case z.FresnelReflector:return _($,pFe);case z.Heliostat:return _($,X1e);case z.Sensor:return _($,eFe);case z.WindTurbine:return _($,gFe);case z.VerticalAxisWindTurbine:return _($,vSo);case z.Light:return _($,mFe);case z.SolarWaterHeater:return _($,AFe);case z.BatteryStorage:return _($,yFe)}},ne=()=>f===z.None&&!p&&!m&&!y&&!w&&!x&&!S,te=()=>{!c||ye.hasMovingParts(r)?j():L()};return h.jsxs("div",{children:[h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.Select",N),alt:"Select",src:xSo,height:36,width:36,style:{filter:ne()?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:U})}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.ManipulateGroup",N),alt:"Group",src:bSo,height:36,width:36,style:{filter:S?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:W})}),h.jsxs(Cw,{children:[q(b),G({items:Q})]}),h.jsxs(Cw,{children:[ae(R),G({items:oe})]}),h.jsxs(Cw,{children:[Z(D),G({items:ee})]}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.ClearScene",N),alt:"Clear",src:SSo,height:36,width:36,color:"#666666",style:{cursor:"pointer"},onClick:F})}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.SpatialAnalysisOfEnergy",N),alt:"Spatial analysis",src:PSo,height:36,width:36,color:"#666666",style:{filter:u?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{u?dt.getState().set($=>{$.showSolarRadiationHeatmap=!1,$.showHeatFluxes=!1}):v()>dVe?li.confirm({title:B.t("message.CalculationMayBeSlowDoYouWantToContinue",N)+" ("+B.t("message.IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp",N)+")",icon:h.jsx(t4,{}),onOk:()=>{te()},onCancel:()=>{},okText:`${B.t("word.Yes",N)}`,cancelText:`${B.t("word.No",N)}`}):te()}})}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.ShowSunAndTimeSettings",N),alt:"Heliodon",src:TSo,height:36,width:36,color:"#666666",style:{filter:s?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:E})})]})}),RSo=ko.div` +`,qke=xe.memo(({openCloudFile:t,deleteModelFromMap:e,likeModelFromMap:n,pinModelFromMap:o})=>{var Z;const r=H(Xp),i=H(pn),a=dt(kf),l=H(Fn),s=H(r5e),c=H(FTt),u=c!==void 0?c:42.2844063,d=H(LTt),f=d!==void 0?d:-71.3488548,p=H.getState().modelsMapAddress??zX,m=dt(ZGe),y=H(oXe),w=H(rXe),x=H(iXe),C=dt(ZTt),P=H(jTt),A=H(tXe),S=H(BTt),v=H(nXe),b=H(YTt),T=g.useRef(v?new Map(v):new Map),[R,M]=g.useState(),[D,k]=g.useState(!1),N=g.useRef(),U=g.useRef(),W=g.useRef(u),F=g.useRef(f),E=Kt(),{Search:L}=Vl;g.useEffect(()=>{T.current=v?new Map(v):new Map,R&&(N.current=v.get(R)),k(!D)},[v,R]);const j=ne=>{M(ne),dt.getState().set(te=>{te.showLeaderboard||(te.leaderboardFlag=!0),ne&&(N.current=T.current.get(ne))})},{isLoaded:Y,loadError:O}=c0t({id:"google-map-script",googleMapsApiKey:"AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",libraries:mSo}),_=()=>{dt.getState().set(ne=>{ne.openModelsMap=!1}),i(ne=>{ne.modelsMapLatitude=W.current,ne.modelsMapLongitude=F.current})},G=ne=>{U.current=ne},Q=()=>{var te;const ne=(te=U.current)==null?void 0:te.getPlaces();if(ne&&ne.length>0){const q=ne[0].geometry;if(q&&q.location){const le={name:"Set Model Map Location",timestamp:Date.now(),oldLatitude:u,newLatitude:q.location.lat(),oldLongitude:f,newLongitude:q.location.lng(),oldAddress:p,newAddress:ne[0].formatted_address,undo:()=>{i(de=>{de.modelsMapLatitude=le.oldLatitude,de.modelsMapLongitude=le.oldLongitude,de.modelsMapAddress=le.oldAddress,W.current=de.modelsMapLatitude,F.current=de.modelsMapLongitude})},redo:()=>{i(de=>{de.modelsMapLatitude=le.newLatitude,de.modelsMapLongitude=le.newLongitude,de.modelsMapAddress=le.newAddress,W.current=de.modelsMapLatitude,F.current=de.modelsMapLongitude})}};l(le),i(de=>{q.location&&(de.modelsMapLatitude=q.location.lat(),de.modelsMapLongitude=q.location.lng(),W.current=de.modelsMapLatitude,F.current=de.modelsMapLongitude),de.modelsMapAddress=ne[0].formatted_address})}}},oe=(Z=r.email)==null?void 0:Z.endsWith("@intofuture.org"),ee=g.useMemo(()=>{if(!S||!S.size)return 0;let ne=0;for(const te of S.values())ne+=te.size??0;return ne},[S]),$=g.useMemo(()=>{if(!A||!A.size)return 0;let ne=0;for(const te of A.values())ne+=te.size??0;return ne},[A]),ae=(ne,te)=>{const q=new Map;for(const[le,de]of b){const he=new Map;for(const[me,ce]of de)ce.timeCreated&&ce.timeCreated>=ne&&ce.timeCreated<=te&&he.set(me,ce);he.size>0&&q.set(le,he)}i(le=>{le.peopleModels=q})};return h.jsxs(ASo,{onKeyDown:ne=>{ne.key==="Escape"&&_()},children:[Y&&h.jsxs(Jt,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"240px",width:"300px",height:"28px",background:"white",borderRadius:"5px",boxShadow:"1px 1px 1px 1px gray"},children:[h.jsx(W4e,{onLoad:G,onPlacesChanged:Q,children:h.jsx("input",{type:"text",placeholder:p,style:{boxSizing:"border-box",border:"1px solid transparent",width:"100%",height:"100%",fontSize:"12px",paddingLeft:"8px",paddingRight:"8px",outline:"none",textOverflow:"ellipses",position:"relative"}})}),h.jsx(HZ,{style:{marginLeft:"100px"}})]}),Y&&h.jsxs(Jt,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"540px",width:"400px",height:"28px",paddingLeft:"12px"},children:[h.jsx(Li,{checked:y,onChange:ne=>{const te=ne.target.checked;if(i(q=>{q.showModelsAllTime=te}),te)i(q=>{q.peopleModels=new Map(q.allPeopleModels)});else{const q=il(w).toDate().getTime(),le=il(x).toDate().getTime();ae(q,le)}dt.getState().set(q=>{q.modelsMapFlag=!0})},children:B.t("modelsMap.AllTime",E)}),!y&&h.jsx(ySo,{format:"YYYY-MM-DD",size:"small",allowClear:!1,needConfirm:!0,value:[il(w),il(x)],onOk:ne=>{if(!ne)return;const te=["2021-01-01","2025-12-31"];ne[0]&&(te[0]=ne[0].toISOString()),ne[1]&&(te[1]=ne[1].toISOString());const q=il(te[0]).toDate().getTime(),le=il(te[1]).toDate().getTime(),de=new Map;for(const[he,me]of S){const ce=new Map;for(const[Pe,pe]of me)pe.timeCreated&&pe.timeCreated>=q&&pe.timeCreated<=le&&ce.set(Pe,pe);ce.size>0&&de.set(he,ce)}i(he=>{he.showModelsFromDate=te[0],he.showModelsToDate=te[1],he.modelSites=de}),C&&ae(q,le)}})]}),Y?h.jsx(pSo,{latRef:W,lngRef:F,selectAuthor:j,closeMap:_,openModel:t,deleteModel:e,likeModel:n,pinModel:o}):h.jsx(ute,{}),O&&h.jsx(Jt,{children:h.jsx("div",{children:"Map cannot be loaded right now, sorry."})}),h.jsxs(h.Fragment,{children:[R&&h.jsx(S0t,{latRef:W,lngRef:F,author:R,models:N.current,closeCallback:()=>{M(void 0),a("modelsMapSelectedSite",void 0),N.current=void 0}}),C&&!R&&h.jsx("div",{style:{position:"absolute",fontSize:"10px",color:"black",bottom:"33px",left:"5px",width:"180px",height:"360px",overflowY:"auto",padding:"6px 6px 6px 6px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",textAlign:"left"},children:h.jsxs(Jt,{direction:"vertical",children:[h.jsx(L,{title:B.t("modelsMap.SearchByPublisher",E),allowClear:!0,size:"small",enterButton:!0,onSearch:ne=>{if(v){T.current.clear();for(const[te,q]of v)te.toLowerCase().includes(ne.toLowerCase())&&T.current.set(te,q);k(!D)}}}),T.current.size===0?h.jsx(w1,{image:w1.PRESENTED_IMAGE_SIMPLE}):h.jsx("table",{children:h.jsx("tbody",{children:[...T.current.keys()].sort((ne,te)=>{const q=T.current.get(ne),le=T.current.get(te);return(le?le.size:0)-(q?q.size:0)}).map((ne,te)=>{if(te>50)return null;const q=T.current.get(ne);return(q==null?void 0:q.size)===void 0||(q==null?void 0:q.size)===0?null:h.jsxs("tr",{style:{width:"180px"},children:[h.jsx("td",{style:{width:"150px"},children:h.jsx(fnt,{icon:h.jsx(dtn,{}),color:(q==null?void 0:q.size)>10?"gold":(q==null?void 0:q.size)>5?"lime":(q==null?void 0:q.size)>1?"blue":"magenta",style:{cursor:"pointer",fontSize:"10px",fontWeight:"bold",width:"130px"},onClick:()=>M(ne),title:ne,children:ne.length>16?ne.substring(0,15)+"...":ne})}),h.jsx("td",{children:q==null?void 0:q.size})]},te)})})})]})}),h.jsx(Jt,{children:h.jsxs("div",{title:B.t("modelsMap.TotalNumberOfUserPublishedModelsInSelectedPeriod",E)+": "+$+` +`+B.t("modelsMap.AllTimeTotal",E)+": "+ee,style:{position:"absolute",fontSize:"14px",color:"black",bottom:"6px",left:"5px",width:"180px",height:"25px",paddingTop:"4px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",cursor:"pointer",userSelect:"none"},onClick:()=>{dt.getState().set(ne=>{ne.showLeaderboard||(ne.leaderboardFlag=!0),ne.showLeaderboard=!ne.showLeaderboard})},children:[C?h.jsx(ptn,{title:B.t("word.Close",E),style:{marginRight:"8px"}}):h.jsx(VYt,{title:B.t("word.Open",E),style:{marginRight:"8px"}}),B.t("word.Leaderboard",E)]})}),P&&h.jsx(Jt,{children:h.jsxs("div",{style:{position:"absolute",fontSize:"10px",color:s==="roadmap"?"black":"white",bottom:"6px",left:"188px",height:"25x",padding:"6px 6px 2px 6px",cursor:"pointer"},onClick:()=>{i(ne=>{P&&(ne.modelsMapLatitude=P.latitude,ne.modelsMapLongitude=P.longitude,ne.modelsMapZoom=20,W.current=ne.modelsMapLatitude,F.current=ne.modelsMapLongitude)})},children:[B.t("word.Latest",E)+": ",P.countryCode&&h.jsx(v0t,{countryCode:P.countryCode,style:{marginLeft:"2px",marginRight:"4px",width:"20px"},svg:!0}),P.title+", by "+P.author]})}),h.jsx(Jt,{children:h.jsx("div",{style:{position:"absolute",fontSize:"12px",color:s==="roadmap"?"black":"white",top:"6px",height:"25x",padding:"6px 6px 2px 6px"},children:A.size+" "+B.t("modelsMap.SitesFound",E)})}),h.jsx(Jt,{children:h.jsx("div",{style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:r.uid?"60px":"100px",width:"64px",height:"28px",background:"orange",boxShadow:"1px 1px 1px 1px gray",paddingTop:"4px"},onMouseDown:()=>{_()},children:B.t("word.Close",E)})}),oe&&h.jsx(Jt,{children:h.jsx(Li,{checked:m,style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:"130px",width:"160px",height:"28px",background:"white",boxShadow:"1px 1px 1px 1px gray",paddingLeft:"4px"},onChange:()=>{dt.getState().set(ne=>{ne.modelsMapWeatherStations=!ne.modelsMapWeatherStations})},children:m?h.jsx("span",{title:B.t("mapPanel.WeatherStationsNote",E),children:B.t("mapPanel.WeatherStations",E)}):h.jsx("span",{children:B.t("mapPanel.WeatherStations",E)})})})]})]})}),wSo="/aladdin/assets/tiny_lock-DSfuZD8Y.png",xSo="/aladdin/assets/select-C-gZZ0yB.png",Qke="/aladdin/assets/foundation-Bf2d60AT.png",Zke="/aladdin/assets/cuboid-C70KMDTq.png",eFe="/aladdin/assets/sensor-BZ9UhBbW.png",G1e="/aladdin/assets/solar-panel-BLllvFhu.png",tFe="/aladdin/assets/wall-Dcb0OCnD.png",nFe="/aladdin/assets/window-uls1fTpz.png",oFe="/aladdin/assets/door-DmvdjDKR.png",rFe="/aladdin/assets/pyramid_roof-CRzRVezC.png",iFe="/aladdin/assets/hip_roof-gO3gEx_s.png",aFe="/aladdin/assets/gambrel_roof-BKCAWDsb.png",lFe="/aladdin/assets/mansard_roof-DRTaI5DY.png",sFe="/aladdin/assets/gable_roof-9fruWngj.png",cFe="/aladdin/assets/tree-BUu2qyTB.png",uFe="/aladdin/assets/flower-DErmZ90Q.png",dFe="/aladdin/assets/human-EToF5YZi.png",fFe="/aladdin/assets/parabolic_trough-CSR3V81L.png",hFe="/aladdin/assets/parabolic_dish-BYGRlVcr.png",pFe="/aladdin/assets/fresnel_reflector-CBKiWWxR.png",X1e="/aladdin/assets/heliostat-Kq0JVQG1.png",gFe="/aladdin/assets/wind_turbine-D02sl9A9.png",vSo="/aladdin/assets/vertical_axis_wind_turbine-C-KZaZtD.png",mFe="/aladdin/assets/led_light-D7hmM4q6.png",bSo="/aladdin/assets/group-BuZ9lmWH.png",SSo="/aladdin/assets/clear-BZ83yweM.png",TSo="/aladdin/assets/heliodon-CPHdpxt2.png",PSo="/aladdin/assets/analyze-CgmQCUK0.png",yFe="/aladdin/assets/battery_storage-DDItm8kX.png",AFe="/aladdin/assets/solar_water_heater-ifX6Xha6.png",Cw=({...t})=>h.jsx("div",{style:{verticalAlign:"top",display:"inline-block",marginTop:"4px",marginRight:"8px"},children:t.children}),gv="invert(41%) sepia(0%) saturate(0%) hue-rotate(224deg) brightness(93%) contrast(81%)",QP="invert(93%) sepia(3%) saturate(1955%) hue-rotate(26deg) brightness(113%) contrast(96%)",su=({objectType:t,srcImg:e,setFlag:n,replacingText:o})=>{const r=a=>{H.getState().set(l=>{l.objectTypeToAdd=a,l.groupActionMode=!1,l.actionModeLock=!1}),jn.getState().setEnableOrbitController(!1),H.getState().selectNone()},i=Kt();return h.jsxs(ln,{noPadding:!0,textSelectable:!1,onClick:()=>{n(t),r(t)},children:[h.jsx("img",{alt:t,src:e,height:36,width:36,style:{filter:gv,verticalAlign:"middle",marginRight:"10px"}}),B.t(`toolbar.Add${o??t.replaceAll(" ","")}`,i)]})},CSo=xe.memo(()=>{const t=H(pn),e=dt(kf),n=H(Qi),o=H(YM),r=H(Qn),i=H(Au),a=H(qN),l=H(KPt),s=H(UGe),c=H(q2e),u=dt(vs),d=H(lPt),f=H(bQ),p=H(TQ),m=H(PQ),y=H(CJe),w=H(JRt),x=H(KRt),C=H(Fn),P=dt(BN),A=dt(l5e),S=H(MJe),v=H(tHt),[b,T]=g.useState(z.Foundation),[R,M]=g.useState(z.Wall),[D,k]=g.useState(z.SolarPanel),N=g.useMemo(()=>({lng:i}),[i]),U=()=>{t(q=>{q.objectTypeToAdd=z.None,q.groupActionMode=!1,q.actionModeLock=!1}),dt.getState().setSelectButtonClicked(!0)},W=()=>{t(q=>{q.groupActionMode||(q.objectTypeToAdd=z.None),q.groupActionMode=!q.groupActionMode})},F=()=>{li.confirm({title:B.t("toolbar.DoYouReallyWantToClearContent",N)+"?",icon:h.jsx(_y,{}),onOk:()=>{const q=JSON.parse(JSON.stringify(H.getState().elements));d();const le={name:"Clear Scene",timestamp:Date.now(),removedElements:q,undo:()=>{t(de=>{de.elements.push(...le.removedElements)})},redo:()=>{d()}};C(le)}}),U()},E=()=>{const q={name:"Show Sun and Time Settings Panel",timestamp:Date.now(),checked:!s,undo:()=>{t(le=>{le.viewState.showHeliodonPanel=!q.checked})},redo:()=>{t(le=>{le.viewState.showHeliodonPanel=q.checked})}};C(q),t(le=>{le.viewState.showHeliodonPanel=!le.viewState.showHeliodonPanel,le.viewState.showHeliodonPanel&&(le.selectedFloatingWindow="heliodonPanel")})},L=()=>{A||yn(B.t("message.SimulationStarted",N)),setTimeout(()=>{a(),e("runStaticSimulation",!A),n&&o("Generate Daily Solar Radiation Heatmap (Static)")},100)},j=()=>{P||yn(B.t("message.SimulationStarted",N)),setTimeout(()=>{a(),e("runDynamicSimulation",!P),n&&o("Generate Daily Solar Radiation Heatmap (Dynamic)")},100)},Y=q=>{t(le=>{le.objectTypeToAdd=q,le.groupActionMode=!1,le.actionModeLock=!1}),jn.getState().setEnableOrbitController(!1),dt.getState().setSelectButtonClicked(!1),a()},O=q=>{switch(q){case z.Human:case z.Tree:case z.Flower:case z.Sensor:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.VerticalAxisWindTurbine:case z.Light:case z.Wall:case z.Window:return!0;default:return!1}},_=(q,le,de,he)=>{const me=O(q),ce=()=>B.t(`toolbar.Add${he??q.replaceAll(" ","")}`,N)+(me?` +`+(l?B.t("toolbar.ClickToUnlockThisModeForNextAction",N):B.t("toolbar.DoubleClickToLockThisModeForNextAction",N)):"");return h.jsxs(h.Fragment,{children:[h.jsx("img",{title:ce(),alt:q,src:le,height:36,width:36,style:{filter:f===q||de?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{Y(q)},onDoubleClick:()=>{me&&t(Pe=>{Pe.actionModeLock=!0})}}),(f===q||de)&&me&&l&&h.jsx("img",{alt:"Tiny lock",src:wSo,style:{marginLeft:"-2px",filter:f===q||de?QP:gv,verticalAlign:"top"}})]})},G=q=>h.jsx(e4,{menu:q,trigger:["click"],children:h.jsx("span",{title:B.t("toolbar.ClickForMoreButtons",N),style:{cursor:"pointer",verticalAlign:"middle",fontSize:"10px",marginLeft:"4px",width:"10px",height:"36px",color:"#666666",fontWeight:"bold"},children:"▼"})}),Q=[{key:"add-foundation",label:h.jsx(su,{objectType:z.Foundation,srcImg:Qke,setFlag:T})},{key:"add-cuboid",label:h.jsx(su,{objectType:z.Cuboid,srcImg:Zke,setFlag:T})},{key:"add-tree",label:h.jsx(su,{objectType:z.Tree,srcImg:cFe,setFlag:T})},{key:"add-flower",label:h.jsx(su,{objectType:z.Flower,srcImg:uFe,setFlag:T})},{key:"add-human",label:h.jsx(su,{objectType:z.Human,srcImg:dFe,setFlag:T,replacingText:"People"})}],oe=[{key:"add-wall",label:h.jsx(su,{objectType:z.Wall,srcImg:tFe,setFlag:M})},{key:"add-window",label:h.jsx(su,{objectType:z.Window,srcImg:nFe,setFlag:M})},{key:"add-door",label:h.jsx(su,{objectType:z.Door,srcImg:oFe,setFlag:M})},{key:"add-pyramid-roof",label:h.jsx(su,{objectType:z.PyramidRoof,srcImg:rFe,setFlag:M})},{key:"add-hip-roof",label:h.jsx(su,{objectType:z.HipRoof,srcImg:iFe,setFlag:M})},{key:"add-gable-roof",label:h.jsx(su,{objectType:z.GableRoof,srcImg:sFe,setFlag:M})},{key:"add-gambrel-roof",label:h.jsx(su,{objectType:z.GambrelRoof,srcImg:aFe,setFlag:M})},{key:"add-mansard-roof",label:h.jsx(su,{objectType:z.MansardRoof,srcImg:lFe,setFlag:M})}],ee=[{key:"add-solar-panel",label:h.jsx(su,{objectType:z.SolarPanel,srcImg:G1e,setFlag:k})},{key:"add-parabolic-trough",label:h.jsx(su,{objectType:z.ParabolicTrough,srcImg:fFe,setFlag:k})},{key:"add-parabolic-dish",label:h.jsx(su,{objectType:z.ParabolicDish,srcImg:hFe,setFlag:k})},{key:"add-fresnel-reflector",label:h.jsx(su,{objectType:z.FresnelReflector,srcImg:pFe,setFlag:k})},{key:"add-heliostat",label:h.jsx(su,{objectType:z.Heliostat,srcImg:X1e,setFlag:k})},{key:"add-wind-turbine",label:h.jsx(su,{objectType:z.WindTurbine,srcImg:gFe,setFlag:k})},{key:"add-sensor",label:h.jsx(su,{objectType:z.Sensor,srcImg:eFe,setFlag:k})},{key:"add-light",label:h.jsx(su,{objectType:z.Light,srcImg:mFe,setFlag:k})},{key:"add-water-heater",label:h.jsx(su,{objectType:z.SolarWaterHeater,srcImg:AFe,setFlag:k})},{key:"add-battery-storage",label:h.jsx(su,{objectType:z.BatteryStorage,srcImg:yFe,setFlag:k})}],$=q=>{switch(q){case z.Foundation:return _(q,Qke,H.getState().addedFoundationId);case z.Cuboid:return _(q,Zke,H.getState().addedCuboidId);case z.Tree:return _(q,cFe);case z.Flower:return _(q,uFe);case z.Human:return _(q,dFe,void 0,"People")}},ae=q=>{switch(q){case z.Wall:return _(q,tFe,H.getState().addedWallId);case z.Window:return _(q,nFe,H.getState().addedWindowId);case z.Door:return _(q,oFe,H.getState().addedDoorId);case z.PyramidRoof:return _(z.PyramidRoof,rFe);case z.HipRoof:return _(z.HipRoof,iFe);case z.GableRoof:return _(z.GableRoof,sFe);case z.GambrelRoof:return _(z.GambrelRoof,aFe);case z.MansardRoof:return _(z.MansardRoof,lFe)}},Z=q=>{switch(q){case z.SolarPanel:return _(q,G1e);case z.ParabolicTrough:return _(q,fFe);case z.ParabolicDish:return _(q,hFe);case z.FresnelReflector:return _(q,pFe);case z.Heliostat:return _(q,X1e);case z.Sensor:return _(q,eFe);case z.WindTurbine:return _(q,gFe);case z.VerticalAxisWindTurbine:return _(q,vSo);case z.Light:return _(q,mFe);case z.SolarWaterHeater:return _(q,AFe);case z.BatteryStorage:return _(q,yFe)}},ne=()=>f===z.None&&!p&&!m&&!y&&!w&&!x&&!S,te=()=>{!c||ye.hasMovingParts(r)?j():L()};return h.jsxs("div",{children:[h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.Select",N),alt:"Select",src:xSo,height:36,width:36,style:{filter:ne()?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:U})}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.ManipulateGroup",N),alt:"Group",src:bSo,height:36,width:36,style:{filter:S?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:W})}),h.jsxs(Cw,{children:[$(b),G({items:Q})]}),h.jsxs(Cw,{children:[ae(R),G({items:oe})]}),h.jsxs(Cw,{children:[Z(D),G({items:ee})]}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.ClearScene",N),alt:"Clear",src:SSo,height:36,width:36,color:"#666666",style:{cursor:"pointer"},onClick:F})}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.SpatialAnalysisOfEnergy",N),alt:"Spatial analysis",src:PSo,height:36,width:36,color:"#666666",style:{filter:u?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{u?dt.getState().set(q=>{q.showSolarRadiationHeatmap=!1,q.showHeatFluxes=!1}):v()>dVe?li.confirm({title:B.t("message.CalculationMayBeSlowDoYouWantToContinue",N)+" ("+B.t("message.IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp",N)+")",icon:h.jsx(t4,{}),onOk:()=>{te()},onCancel:()=>{},okText:`${B.t("word.Yes",N)}`,cancelText:`${B.t("word.No",N)}`}):te()}})}),h.jsx(Cw,{children:h.jsx("img",{title:B.t("toolbar.ShowSunAndTimeSettings",N),alt:"Heliodon",src:TSo,height:36,width:36,color:"#666666",style:{filter:s?QP:gv,cursor:"pointer",verticalAlign:"middle"},onClick:E})})]})}),RSo=ko.div` position: absolute; top: 0; right: 10px; @@ -7298,7 +7298,7 @@ PERFORMANCE OF THIS SOFTWARE. justify-content: space-between; align-items: center; cursor: move; -`,ESo=xe.memo(({projects:t,setProjectState:e,deleteProject:n,renameProject:o})=>{const r=H(Xp),i=H(Qi),a=H(YM),l=H(i5e),s=H(pn),c=H(kc),u=xe.useRef(null),d=g.useRef(null),f=d.current?d.current.clientWidth+40:680,p=d.current?d.current.clientHeight+100:600,[m,y]=g.useState({x:0,y:0}),[w,x]=g.useState(!1),[C,P]=g.useState(!1),[A,S]=g.useState({left:0,top:0,bottom:0,right:0}),[v,b]=g.useState(),[T,R]=g.useState(),M=g.useRef(null),D=g.useRef([...t]),[k,N]=g.useState(!1),[U,W]=g.useState(-1),{Search:F}=Vl,{t:E}=Jl(),L=Kt();g.useEffect(()=>{const ee=()=>{y({x:Math.max(0,f-window.innerWidth),y:Math.min(0,window.innerHeight-p)})};return window.addEventListener("resize",ee),()=>{window.removeEventListener("resize",ee)}},[]),g.useEffect(()=>{t&&(D.current=[...t],N(!k))},[t]);const j=(ee,q)=>{y({x:Math.max(q.x,f-window.innerWidth),y:Math.min(q.y,window.innerHeight-p)})},Y=(ee,q)=>{},O=()=>{dt.getState().set(ee=>{ee.showProjectListPanel=!1}),i&&a("Close Project List")},_=ee=>{li.confirm({title:E("projectListPanel.DoYouReallyWantToDeleteProject",L)+' "'+ee+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(a7,{style:{marginRight:"6px"}}),E("word.Warning",L)+": "+E("message.ThisCannotBeUndone",L)]}),icon:h.jsx(t4,{}),onOk:()=>{n(ee),i&&s(q=>{q.actionInfo={name:"Delete Project",timestamp:new Date().getTime(),details:ee}})}})},G=()=>{v&&T&&(o(v,T),R(void 0),N(!k),i&&s(ee=>{ee.actionInfo={name:"Rename Project",timestamp:new Date().getTime(),details:{oldTitle:v,newTitle:T}}})),x(!1)},Q=ee=>{e(ee),l.clear(),s(q=>{q.canvasPercentWidth===100&&(q.canvasPercentWidth=50),q.viewState.showModelTree=!1}),i&&s(q=>{q.actionInfo={name:"Open Project",timestamp:new Date().getTime(),details:ee.title}})},oe=(ee,q)=>{if(M.current){const{clientWidth:ae,clientHeight:Z}=window.document.documentElement,ne=M.current.getBoundingClientRect();S({left:-ne.left+q.x,right:ae-(ne.right-q.x),top:-ne.top+q.y,bottom:Z-((ne==null?void 0:ne.bottom)-q.y)})}};return h.jsxs(h.Fragment,{children:[h.jsx(li,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>P(!0),onMouseOut:()=>P(!1),children:E("word.Rename",L)}),open:w,onOk:G,onCancel:()=>{x(!1),R(void 0)},modalRender:ee=>h.jsx(Vi,{disabled:!C,bounds:A,onStart:(q,ae)=>oe(q,ae),children:h.jsx("div",{ref:M,children:ee})}),children:h.jsxs(Jt,{direction:"vertical",style:{width:"100%"},children:[h.jsx(Vl,{placeholder:"Title",value:T||v,onPressEnter:G,onKeyDown:ee=>{if(!dH.test(ee.key))return ee.preventDefault(),!1},onChange:ee=>{R(ee.target.value)}}),h.jsxs("span",{style:{fontSize:"11px",color:"red"},children:[h.jsx(a7,{style:{marginRight:"4px"}}),E("word.Caution",L)+": "+E("projectListPanel.IfSharedOrPublishedRenamingProjectBreaksExistingLinks",L),"."]})]})}),h.jsx(Vi,{nodeRef:u,handle:".handle",bounds:"parent",axis:"both",position:m,onDrag:j,onStop:Y,onMouseDown:()=>{s(ee=>{ee.selectedFloatingWindow="projectListPanel"})},children:h.jsx(ISo,{ref:u,style:{zIndex:c==="projectListPanel"?Ec:14},children:h.jsxs(zSo,{ref:d,children:[h.jsxs(DSo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:E("projectListPanel.MyProjects",L)+" ("+D.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{O()},onTouchStart:()=>{O()},children:E("word.Close",L)})]}),h.jsx("span",{style:{direction:"ltr"},children:h.jsx(F,{style:{width:"50%",paddingTop:"8px",paddingBottom:"8px"},title:E("projectListPanel.SearchByTitle",L),allowClear:!0,size:"small",enterButton:!0,onSearch:ee=>{var q;if(t){D.current=[];for(const ae of t)(q=ae.title)!=null&&q.toLowerCase().includes(ee.toLowerCase())&&D.current.push(ae);N(!k)}}})}),h.jsxs(Bd,{size:"small",style:{width:"100%",direction:"ltr",verticalAlign:"top"},dataSource:D.current,scroll:{y:360},pagination:{defaultPageSize:10,showSizeChanger:!0,position:["bottomCenter"],pageSizeOptions:["10","20","50"]},children:[h.jsx(Kce,{title:`${E("word.Title",L)}`,dataIndex:"title",width:"50%",sortDirections:["ascend","descend","ascend"],sorter:(ee,q)=>ee.title.localeCompare(q.title),render:(ee,q,ae)=>{const Z=[{key:"project-title",label:h.jsxs(h.Fragment,{children:[h.jsx(ln,{noPadding:!0,fontWeight:"bold",children:ee}),h.jsx("hr",{})]})},{key:"open-project",label:h.jsx(ln,{noPadding:!0,onClick:()=>Q(q),children:E("word.Open",L)})},{key:"copy-title-to-clip-board",label:h.jsx(ln,{noPadding:!0,onClick:()=>{navigator.clipboard.writeText(ee).then(()=>{d5(E("projectListPanel.TitleCopiedToClipBoard",L)+"."),i&&s(ne=>{ne.actionInfo={name:"Copy Project Title",timestamp:new Date().getTime(),details:ee}})})},children:E("projectListPanel.CopyTitle",L)})},{key:"rename-project",label:h.jsx(ln,{noPadding:!0,onClick:()=>{b(ee),x(!0)},children:E("word.Rename",L)})},{key:"delete-project",label:h.jsx(ln,{noPadding:!0,onClick:()=>_(ee),children:E("word.Delete",L)})},{key:"generate-project-link",label:h.jsx(ln,{noPadding:!0,onClick:()=>{const ne=k1+"?client=web&userid="+r.uid+"&project="+encodeURIComponent(ee);navigator.clipboard.writeText(ne).then(()=>{d5(E("projectListPanel.ProjectLinkGeneratedInClipBoard",L)+"."),i&&s(te=>{te.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:ne}})})},children:E("projectListPanel.GenerateProjectLink",L)})}];return h.jsxs(Jt,{style:{width:"100%"},children:[h.jsx(e4,{menu:{items:Z},trigger:["hover"],children:h.jsx(utt,{style:{fontSize:"12px",cursor:"pointer"},onMouseEnter:()=>{ae!==void 0&&W(ae)},onMouseLeave:()=>{W(-1)}})}),h.jsx(DA.Text,{title:E("word.Open",L),style:{fontSize:"12px",cursor:"pointer",verticalAlign:"top"},onClick:()=>{const ne=window.getSelection();ne&&ne.toString().length>0||Q(q)},children:ee})]})},onCell:(ee,q)=>({style:{background:U===q?"lightskyblue":q!==void 0&&q%2===0?"beige":"gainsboro"}})},"title"),h.jsx(Kce,{title:`${E("word.Type",L)}`,dataIndex:"type",width:"25%",render:ee=>h.jsx(DA.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:ee}),onCell:(ee,q)=>({style:{background:U===q?"lightskyblue":q!==void 0&&q%2===0?"beige":"gainsboro"}})},"type"),h.jsx(Kce,{title:`${E("word.Time",L)}`,dataIndex:"time",width:"25%",defaultSortOrder:"descend",sortDirections:["ascend","descend","ascend"],sorter:(ee,q)=>ee.timestamp-q.timestamp,render:ee=>h.jsx(DA.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:ee}),onCell:(ee,q)=>({style:{background:U===q?"lightskyblue":q!==void 0&&q%2===0?"beige":"gainsboro"}})},"time")]})]})})})]})}),kSo="/aladdin/assets/anonymous-DoSV0M20.png",ny=(t,e,n)=>{g.useEffect(()=>{t&&(e(),n())},[t])},FSo=xe.memo(({viewOnly:t=!1,canvas:e})=>{const n=H(pn),o=dt(kf),r=H(Xp),i=H(tu),a=H(TS),l=H(cQ),s=H(ZSt),c=H(lXe),u=dt(oCt),d=dt(yCt),f=dt(ACt),p=dt(wCt),m=dt(uQ),y=H(CS),w=dt(OTt),x=dt(_Tt),C=dt(qTt),P=dt(QTt),A=dt(ePt),S=dt(tPt),v=dt(nPt),b=H(UTt),T=H(eXe),R=H(a5e),M=H(sXe),D=dt(o5e),k=H(oPt),N=H(nXe),U=dt(VTt),W=dt(GTt),F=dt(XTt),E=dt(JTt),L=dt(KTt),j=H(rXe),Y=H(iXe),O=H(oXe),[_,G]=g.useState(!1),[Q,oe]=g.useState(!1),[ee,q]=g.useState(y??"My Aladdin File"),[ae,Z]=g.useState(!1),ne=g.useRef(),te=g.useRef([]),[$,le]=g.useState([]),[de,he]=g.useState(!1),me=g.useRef(),[ce,Pe]=g.useState([]),[pe,Ie]=g.useState(!1),ve=Kt();ny(w,Te,()=>o("saveAccountSettingsFlag",!1)),ny(x,Yt,()=>o("saveCloudFileFlag",!1)),ny(C,zt,()=>o("modelsMapFlag",!1)),ny(P,Rt,()=>o("leaderboardFlag",!1)),ny(A,Ct,()=>o("publishOnModelsMapFlag",!1)),ny(U,yt,()=>o("createProjectFlag",!1)),ny(W,at,()=>o("saveProjectAsFlag",!1)),ny(E,st,()=>o("showProjectsFlag",!1)),ny(L,It,()=>o("updateProjectsFlag",!1)),ny(S,Lt,()=>o("listCloudFilesFlag",!1)),ny(v,Je,()=>o("refreshCloudFilesFlag",!1)),ny(F,Et,()=>o("curateDesignToProjectFlag",!1)),g.useEffect(()=>{const ot={apiKey:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",authDomain:"aladdin-316017.firebaseapp.com",projectId:"aladdin-316017",storageBucket:"aladdin-316017.appspot.com",databaseURL:"https://aladdin-316017.firebaseio.com",messagingSenderId:"169516488625",appId:"1:169516488625:web:bb0ae3c3f7c6e813250f90"};let it=eo.apps.length===0;return eo.apps.length===1&&eo.apps[0].name===MX.LOG_DATA&&(it=!0),it?eo.initializeApp(ot):eo.app(),eo.auth().onAuthStateChanged(Be=>{const ct=new URLSearchParams(window.location.search).get("title");n(Be?Xe=>{Xe.user&&(Xe.user.uid=Be.uid,Xe.user.displayName=Be.displayName??"Anonymous",Xe.user.email=Be.email,Xe.user.photoURL=Be.photoURL??kSo,Me({...Xe.user}).then(()=>{})),Xe.cloudFile=ct??void 0}:Xe=>{Xe.cloudFile=ct??void 0})}),Ae(),window.addEventListener("popstate",ze),()=>{window.removeEventListener("popstate",ze)}},[]);const ze=()=>{if(t)return;const ot=new URLSearchParams(window.location.search),it=ot.get("userid"),Be=ot.get("title");it&&Be&&et(it,Be,!0)};g.useEffect(()=>{r.uid&&te.current.length===0&&eao(r.uid,te.current).then(()=>{})},[r.uid]),g.useEffect(()=>{if(de){if(te.current.length>0&&r.uid){const ot=[];te.current.forEach((it,Be)=>{ot.push({title:it.title,timestamp:it.timestamp})}),ot.sort((it,Be)=>Be.timestamp-it.timestamp),le(ot)}he(!1)}},[de]),g.useEffect(()=>{if(pe){if(me.current){const ot=[];me.current.forEach((it,Be)=>{ot.push({key:Be.toString(),owner:it.owner,title:it.title,time:il(new Date(it.timestamp)).format("MM/DD/YYYY hh:mm A"),timestamp:it.timestamp,description:it.description,dataColoring:it.dataColoring,selectedProperty:it.selectedProperty,sortDescending:it.sortDescending,xAxisNameScatterPlot:it.xAxisNameScatterPlot,yAxisNameScatterPlot:it.yAxisNameScatterPlot,dotSizeScatterPlot:it.dotSizeScatterPlot,thumbnailWidth:it.thumbnailWidth,type:it.type,designs:it.designs,ranges:it.ranges??[],filters:it.filters??[],hiddenParameters:it.hiddenParameters??Td.getDefaultHiddenParameters(it.type),counter:it.counter,action:""})}),ot.sort((it,Be)=>Be.timestamp-it.timestamp),Pe(ot)}Ie(!1)}},[pe]),g.useEffect(()=>{if(ne.current=new Map,r.aliases&&r.aliases.length>0){for(const ot of r.aliases)if(ot!==r.displayName){const it=N.get(ot);it&&(ne.current=new Map([...ne.current,...it]))}}if(r.displayName){const ot=N.get(r.displayName);ot&&(ne.current=new Map([...ne.current,...ot]))}},[N,r.displayName,r.aliases]),g.useEffect(()=>{Z(b)},[T]),g.useEffect(()=>{q(y??"My Aladdin File")},[y]);const Ae=()=>{const ot=new URLSearchParams(window.location.search),it=ot.get("userid");if(it){const Be=ot.get("title"),pt=ot.get("project");pt?(G(!0),cct(it,pt,ut).finally(()=>{G(!1)}),Be&&ht(it,Be)):Be&&et(it,Be)}else n(Be=>{Be.cloudFile=void 0});ge().then(()=>{})},se=()=>{n(ot=>{ot.objectTypeToAdd=z.None,ot.groupActionMode=!1})},ge=async()=>{await eo.firestore().collection("app").doc("info").get().then(ot=>{if(ot.exists){const it=ot.data();it&&it.latestVersion&&dt.getState().set(Be=>{Be.latestVersion=it.latestVersion})}}).catch(ot=>{console.log(ot)})},we=()=>{eo.auth().signInAnonymously().then(ot=>{n(it=>{ot.user&&(it.user.uid=ot.user.uid,it.user.anonymous=!0,it.user.displayName="Anonymous",Me({...it.user}).then(()=>{}))})}).catch(ot=>{ot.code!=="auth/popup-closed-by-user"&&ot.code!=="auth/cancelled-popup-request"&&co(B.t("message.CannotSignIn",ve)+": "+ot)}),se()},Se=()=>{const ot=new eo.auth.GoogleAuthProvider;eo.auth().signInWithPopup(ot).then(it=>{n(Be=>{it.user&&(Be.user.uid=it.user.uid,Be.user.email=it.user.email,Be.user.displayName=it.user.displayName,Be.user.photoURL=it.user.photoURL,Me({...Be.user}).then(()=>{}))})}).catch(it=>{it.code!=="auth/popup-closed-by-user"&&it.code!=="auth/cancelled-popup-request"&&co(B.t("message.CannotSignIn",ve)+": "+it)}),se()},Me=async ot=>{const it=eo.firestore();let Be=!1,pt=!1,ct=!1,Xe=yc.UNKNOWN,ft=$a.UNKNOWN,wt=[],kt=[],Zt=[],Ot=[],on=!1,qt=0;ot.uid!==null&&(ot&&ot.email==="charles@intofuture.org"&&await it.collection("users").get().then(Pn=>{qt=Pn.size}),on=await it.collection("users").doc(ot.uid).get().then(Pn=>{const fo=Pn.data();return fo?(Be=!!fo.signFile,pt=!!fo.noLogging,ct=!!fo.anonymous,Xe=fo.schoolID?fo.schoolID:yc.UNKNOWN,ft=fo.classID?fo.classID:$a.UNKNOWN,fo.fileList&&(wt=fo.fileList),fo.likes&&(kt=fo.likes),fo.published&&(Zt=fo.published),fo.aliases&&(Ot=fo.aliases),!0):!1})),on?(n(rn=>{rn.user.signFile=Be,rn.user.noLogging=pt,rn.user.anonymous=ct,rn.user.schoolID=Xe,rn.user.classID=ft,rn.user.fileList=wt,rn.user.likes=kt,rn.user.published=Zt,rn.user.aliases=Ot}),dt.getState().set(rn=>{rn.userCount=qt}),ot.signFile=Be,ot.noLogging=pt,ot.anonymous=ct,ot.schoolID=Xe,ot.classID=ft,ot.fileList=wt,ot.likes=kt,ot.published=Zt,ot.aliases=Ot):ot.uid&&it.collection("users").doc(ot.uid).set({uid:ot.uid,anonymous:!!ot.anonymous,signFile:!!ot.signFile,noLogging:!!ot.noLogging,schoolID:ot.schoolID??yc.UNKNOWN,classID:ot.classID??$a.UNKNOWN,since:il(new Date).format("MM/DD/YYYY hh:mm A"),os:ye.getOS()}).then(()=>{yn(B.t("message.YourAccountWasCreated",ve))}).catch(rn=>{co(B.t("message.CannotCreateAccount",ve)+": "+rn)})},Ce=()=>{eo.auth().signOut().then(()=>{n(ot=>{ot.user.uid=null,ot.user.email=null,ot.user.displayName=null,ot.user.photoURL=null,ot.user.signFile=!1,ot.user.fileList=[],ot.user.likes=[],ot.user.published=[],ot.user.aliases=[],ot.cloudFile=void 0}),dt.getState().set(ot=>{ot.showCloudFilePanel=!1,ot.showAccountSettingsPanel=!1,ot.showModelsGallery=!1,ot.showProjectListPanel=!1})}).catch(ot=>{co(B.t("message.CannotSignOut",ve)+": "+ot)})};function Te(){r.uid&&eo.firestore().collection("users").doc(r.uid).update({signFile:!!r.signFile,schoolID:r.schoolID??yc.UNKNOWN,classID:r.classID??$a.UNKNOWN}).then(()=>{yn(B.t("message.YourAccountSettingsWereSaved",ve))}).catch(it=>{co(B.t("message.CannotSaveYourAccountSettings",ve)+": "+it)})}const Re=async()=>{G(!0);const ot=il(j).toDate().getTime(),it=il(Y).toDate().getTime();await eo.firestore().collection("models").get().then(Be=>{const pt=new Map,ct=new Map;return Be.forEach(Xe=>{var wt;const ft=Xe.data();if(ft){const kt=new Map,Zt=new Map;for(const Ot in ft){if(ft[Ot].countryCode||(wt=ft[Ot].address)!=null&&wt.endsWith("USA")&&(ft[Ot].countryCode="US"),O)kt.set(Ot,ft[Ot]);else{const on=ft[Ot].timeCreated;(on===void 0||on>=ot&&on<=it)&&kt.set(Ot,ft[Ot])}Zt.set(Ot,ft[Ot])}kt.size>0&&pt.set(Xe.id,kt),Zt.size>0&&ct.set(Xe.id,Zt)}}),n(Xe=>{Xe.modelSites=pt,Xe.allModelSites=ct}),pt}).catch(Be=>{co(B.t("message.CannotLoadModelsOnMap",ve)+": "+Be)}).finally(()=>{G(!1)})},Ne=async()=>{await eo.firestore().collection("board").doc("info").get().then(ot=>{if(ot.exists){const it=ot.data();it&&it.latestModel&&n(Be=>{var Xe;let pt=!1;const ct=it.latestModel;ct.author&&(pt=!!((Xe=Be.peopleModels.get(ct.author))!=null&&Xe.get(ye.getModelKey(ct)))),Be.latestModelSite=pt?ct:void 0})}}).catch(ot=>{console.log(ot)})},_e=async()=>{G(!0);const ot=il(j).toDate().getTime(),it=il(Y).toDate().getTime();await eo.firestore().collection("board").doc("people").get().then(Be=>{const pt=Be.data();if(pt){const ct=new Map,Xe=new Map;for(const ft in pt){if(O)ct.set(ft,new Map(Object.entries(pt[ft])));else{const wt=new Map;for(const kt of Object.entries(pt[ft])){const Zt=kt[1].timeCreated;(Zt===void 0||Zt>=ot&&Zt<=it)&&wt.set(kt[0],kt[1])}wt.size>0&&ct.set(ft,wt)}Xe.set(ft,new Map(Object.entries(pt[ft])))}n(ft=>{ft.peopleModels=ct,ft.allPeopleModels=Xe})}}).catch(Be=>{co(B.t("message.CannotLoadLeaderboard",ve)+": "+Be)}).finally(()=>{G(!1)})},Ue=(ot,it)=>{r&&r.uid&&(eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update({[ye.getModelKey(ot)]:eo.firestore.FieldValue.delete()}).then(()=>{d5(B.t("message.ModelDeletedFromMap",ve)),it&&it()}).catch(Be=>{co(B.t("message.CannotDeleteModelFromMap",ve)+": "+Be)}),eo.firestore().collection("board").doc("people").update({[(ot.author??"Anonymous")+"."+ye.getModelKey(ot)]:eo.firestore.FieldValue.delete()}).then(()=>{n(Be=>{Be.peopleModels&&(Be.peopleModels.delete(ye.getModelKey(ot)),dt.getState().set(pt=>{pt.leaderboardFlag=!0}))})}),eo.firestore().collection("users").doc(r.uid).update({published:eo.firestore.FieldValue.arrayRemove(ot.title)}).then(()=>{n(Be=>{if(Be.user&&Be.user.published&&Be.user.published.includes(ot.title)){const pt=Be.user.published.indexOf(ot.title);pt>=0&&Be.user.published.splice(pt,1)}})}))},qe=(ot,it,Be)=>{if(r&&r.uid){const pt=ye.getModelKey(ot);eo.firestore().collection("users").doc(r.uid).update(it?{likes:eo.firestore.FieldValue.arrayUnion(pt)}:{likes:eo.firestore.FieldValue.arrayRemove(pt)}).then(()=>{}).catch(Xe=>{co(B.t("message.CannotLikeModelFromMap",ve)+": "+Xe)});const ct=pt+".likeCount";eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update(it?{[ct]:eo.firestore.FieldValue.increment(1)}:{[ct]:eo.firestore.FieldValue.increment(-1)}).then(()=>{Be&&Be()}).catch(Xe=>{co(B.t("message.CannotLikeModelFromMap",ve)+": "+Xe)})}},Fe=(ot,it,Be)=>{r&&r.uid&&eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update({[ye.getModelKey(ot)+".pinned"]:it}).then(()=>{Be&&Be()}).catch(()=>{})},He=ot=>{r&&r.uid&&eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update({[ye.getModelKey(ot)+".clickCount"]:eo.firestore.FieldValue.increment(1)}).then(()=>{}).catch(()=>{})},Le=async ot=>{r.uid&&(ot||G(!0),me.current=await eo.firestore().collection("users").doc(r.uid).collection("projects").get().then(it=>{const Be=[];return it.forEach(pt=>{const ct=pt.data();Be.push({owner:r.uid,title:pt.id,timestamp:ct.timestamp,description:ct.description,dataColoring:ct.dataColoring,selectedProperty:ct.selectedProperty,sortDescending:ct.sortDescending,xAxisNameScatterPlot:ct.xAxisNameScatterPlot,yAxisNameScatterPlot:ct.yAxisNameScatterPlot,dotSizeScatterPlot:ct.dotSizeScatterPlot,thumbnailWidth:ct.thumbnailWidth,type:ct.type,designs:ct.designs??[],ranges:ct.ranges??[],filters:ct.filters??[],hiddenParameters:ct.hiddenParameters??Td.getDefaultHiddenParameters(ct.type),counter:ct.counter??0})}),Be}).catch(it=>{co(B.t("message.CannotOpenYourProjects",ve)+": "+it)}).finally(()=>{ot||G(!1),Ie(!0)}))},Ye=ot=>{r.uid&&Le(!ot).then(()=>{ot&&dt.getState().set(it=>{it.showProjectListPanel=!0})})},lt=ot=>{r.uid&&eo.firestore().collection("users").doc(r.uid).collection("projects").doc(ot).delete().then(()=>{if(me.current&&r.uid){for(const it of me.current)if(it.title===ot&&it.designs){for(const Be of it.designs)n(pt=>{Be.title===pt.cloudFile&&(pt.cloudFile=void 0)}),eo.firestore().collection("users").doc(r.uid).collection("designs").doc(Be.title).delete().then(()=>{}).catch(pt=>{co(B.t("message.CannotDeleteCloudFile",ve)+": "+pt)});Ie(!0);break}me.current=me.current.filter(it=>it.title!==ot),oe(!Q)}n(it=>{ot===it.projectState.title&&(it.projectState.title=null,it.projectState.description=null,it.projectState.dataColoring=$9.ALL,it.projectState.selectedProperty=null,it.projectState.sortDescending=!1,it.projectState.xAxisNameScatterPlot=null,it.projectState.yAxisNameScatterPlot=null,it.projectState.dotSizeScatterPlot=5,it.projectState.thumbnailWidth=200,it.projectState.counter=0,it.projectState.designs=[],it.projectState.ranges=[],it.projectState.filters=[],it.projectState.hiddenParameters=Td.getDefaultHiddenParameters(it.projectState.type),it.designProjectType=null,it.projectView=!1)})}).catch(it=>{co(B.t("message.CannotDeleteProject",ve)+": "+it)})},Oe=(ot,it)=>{const Be=r.uid;Be&&Sce(Be,it,pt=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+pt)}).then(pt=>{if(pt)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+it);else{const ct=eo.firestore().collection("users").doc(Be).collection("projects");ct.doc(ot).get().then(Xe=>{if(Xe.exists){const ft=Xe.data();if(ft){const wt={...ft};if(ft.designs&&ft.designs.length>0){const kt=Lze(it,ft.designs)??[];for(const[Zt,Ot]of ft.designs.entries())Wze(Ot.title,kt[Zt].title,ft.owner,Be);wt.designs=kt,n(Zt=>{Zt.projectState.designs=kt})}ct.doc(it).set(wt).then(()=>{if(ct.doc(ot).delete().then(()=>{}),me.current){const kt=[];for(const Zt of me.current)Zt.title===ot?kt.push({owner:Zt.owner,timestamp:Zt.timestamp,title:it,description:Zt.description,type:Zt.type,designs:Zt.designs,ranges:Zt.ranges??null,filters:Zt.filters??null,hiddenParameters:Zt.hiddenParameters,counter:Zt.counter}):kt.push(Zt);me.current=kt,oe(!Q),Ie(!0)}n(kt=>{kt.projectState.title===ot&&(kt.projectState.title=it)})})}}}).catch(Xe=>{co(B.t("message.CannotRenameProject",ve)+": "+Xe)})}})},ut=ot=>{n(it=>{it.projectState={...ot},it.projectImages.clear(),it.projectView=!0}),dt.getState().set(it=>{it.projectImagesUpdateFlag=!it.projectImagesUpdateFlag,it.updateProjectsFlag=!0})},ht=(ot,it)=>{ot&&it&&(G(!0),mK(ot,it,!0,!0,t).finally(()=>{G(!1)}))},Qe=(ot,it,Be,pt)=>{if(!r.uid||!e)return;const ct=ye.resizeCanvas(e,pt).toDataURL(),Xe=uct(ot,Be,ct);eo.firestore().collection("users").doc(r.uid).collection("projects").doc(it).update({designs:eo.firestore.FieldValue.arrayUnion(Xe),counter:eo.firestore.FieldValue.increment(1)}).then(()=>{n(ft=>{var wt;(wt=ft.projectState.designs)==null||wt.push(Xe),ft.projectState.counter++,ft.designProjectType=ft.projectState.type,ft.cloudFile=Xe.title}),gt(Be,!0,!0)}).catch(ft=>{co(B.t("message.CannotAddDesignToProject",ve)+": "+ft)}).finally(()=>{G(!1)})},nt=(ot,it,Be)=>{if(!r.uid)return;const pt=ot.trim();if(pt.length===0){co(B.t("menu.file.SavingAbortedMustHaveValidTitle",ve)+".");return}G(!0),Be?Nze(r.uid,ot,ct=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+ct)}).then(ct=>{ct?(G(!1),li.confirm({title:`${B.t("message.CloudFileWithTitleExistsDoYouWantToOverwrite",ve)}`,icon:h.jsx(t4,{}),onOk:()=>{gt(pt,it)},onCancel:()=>{n(Xe=>{Xe.showCloudFileTitleDialogFlag=!Xe.showCloudFileTitleDialogFlag,Xe.showCloudFileTitleDialog=!0})},okText:`${B.t("word.Yes",ve)}`,cancelText:`${B.t("word.No",ve)}`})):gt(pt,it)}):gt(pt,it),Z(!1)},mt=(ot,it)=>{if(te.current.length>0){let Be=-1;for(const[pt,ct]of te.current.entries())if(ct.title===it){Be=pt,jze(ot,ct).then(()=>{});break}Be!==-1&&te.current.splice(Be,1)}},tt=(ot,it,Be)=>{if(te.current.length>0){let pt=-1,ct=null,Xe=null;for(const[ft,wt]of te.current.entries())if(wt.title===it){pt=ft,ct={title:it,timestamp:wt.timestamp},Xe={title:Be,timestamp:wt.timestamp};break}if(pt!==-1&&Xe&&ct){te.current.splice(pt,1),te.current.push(Xe);const ft=Xe;jze(ot,ct).then(()=>{Uze(ot,ft).then(()=>{})})}}},gt=(ot,it,Be)=>{const pt=r.uid;if(pt)try{const ct=eo.firestore().collection("users").doc(pt);if(ct){k&&dt.getState().set(ft=>{ft.waiting=!0});const Xe=ct.collection(Be?"designs":"files").doc(ot);Xe.set(c()).then(()=>{if(it||(n(ft=>{ft.cloudFile=ot}),dt.getState().setChanged(!1)),k)k==="CREATE_NEW_FILE"?M():R(k);else if(!Be){const ft=k1+"?client=web&userid="+pt+"&title="+encodeURIComponent(ot);window.history.pushState({},document.title,ft)}Be||Xe.get().then(ft=>{const wt=ft.data();if(wt&&te.current.length>0){mt(pt,ot);const kt={timestamp:wt.timestamp,title:ot};te.current.push(kt),Uze(pt,kt).then(()=>{}),he(!0)}})}).catch(ft=>{co(B.t("message.CannotSaveYourFileToCloud",ve)+": "+ft)}).finally(()=>{G(!1)})}}catch(ct){co(B.t("message.CannotSaveYourFileToCloud",ve)+": "+ct),G(!1)}},Ve=(ot,it)=>{D?li.confirm({title:`${B.t("message.DoYouWantToSaveChanges",ve)}`,icon:h.jsx(_y,{}),onOk:()=>{y?(nt(y,!0,!1),et(ot,it)):n(Be=>{Be.showCloudFileTitleDialogFlag=!Be.showCloudFileTitleDialogFlag,Be.showCloudFileTitleDialog=!0})},onCancel:()=>{et(ot,it)},okText:`${B.t("word.Yes",ve)}`,cancelText:`${B.t("word.No",ve)}`}):et(ot,it)},je=ot=>{D?li.confirm({title:`${B.t("message.DoYouWantToSaveChanges",ve)}`,icon:h.jsx(_y,{}),onOk:()=>{y?(nt(y,!0,!1),et(ot.userid,ot.title),He(ot)):n(it=>{it.showCloudFileTitleDialogFlag=!it.showCloudFileTitleDialogFlag,it.showCloudFileTitleDialog=!0})},onCancel:()=>{et(ot.userid,ot.title),He(ot)},okText:`${B.t("word.Yes",ve)}`,cancelText:`${B.t("word.No",ve)}`}):(et(ot.userid,ot.title),He(ot))},et=(ot,it,Be)=>{ot&&it&&(G(!0),mK(ot,it,!1,Be,t).finally(()=>{G(!1)}))},bt=async ot=>{const it=r.uid;it&&(G(!0),te.current=[],await eo.firestore().collection("users").doc(it).get().then(async Be=>{var ct,Xe;const pt=(ct=Be.data())==null?void 0:ct.fileList;!ot&&pt&&pt.length>0?(Xe=te.current)==null||Xe.push(...pt):await eo.firestore().collection("users").doc(it).collection("files").get().then(ft=>{ft.forEach(wt=>{var Zt;const kt=wt.data();(Zt=te.current)==null||Zt.push({timestamp:kt.timestamp,title:wt.id})})}).catch(ft=>{co(B.t("message.CannotOpenCloudFolder",ve)+": "+ft)}).finally(()=>{eo.firestore().collection("users").doc(it).update({fileList:te.current}).then(()=>{}).catch(ft=>{console.log(ft)})})}).finally(()=>{G(!1),he(!0)}))},St=(ot,it)=>{eo.firestore().collection("users").doc(ot).collection("files").doc(it).delete().then(()=>{mt(ot,it),le($.filter(Be=>Be.title!==it)),n(Be=>{it===Be.cloudFile&&(Be.cloudFile=void 0)})}).catch(Be=>{co(B.t("message.CannotDeleteCloudFile",ve)+": "+Be)})},Pt=(ot,it,Be)=>{Nze(ot,Be,pt=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+pt)}).then(pt=>{if(pt)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+Be);else{const ct=eo.firestore().collection("users").doc(ot).collection("files");ct.doc(it).get().then(Xe=>{if(Xe.exists){const ft=Xe.data();ft&&ct.doc(Be).set(ft).then(()=>{ct.doc(it).delete().then(()=>{}).catch(kt=>{co(B.t("message.CannotDeleteCloudFile",ve)+" "+it+": "+kt)});for(const kt of $)if(kt.title===it){kt.title=Be;break}le([...$]),tt(ot,it,Be),n(kt=>{kt.cloudFile===it&&(kt.cloudFile=Be)});const wt=new URLSearchParams(window.location.search);if(wt.get("title")===it&&wt.get("userid")===r.uid){const kt=k1+"?client=web&userid="+r.uid+"&title="+encodeURIComponent(Be);window.history.pushState({},document.title,kt)}})}}).catch(Xe=>{co(B.t("message.CannotRenameCloudFile",ve)+": "+Xe)})}})};function Yt(){y&&(nt(y,!1,!1),q(y))}function zt(){Re().then(()=>{Ne().then(()=>{})})}function Rt(){_e().then(()=>{Ne().then(()=>{})})}function Ct(){if(r&&r.uid&&ee){const ot=new URLSearchParams(window.location.search);if(ot.get("userid")===r.uid&&ot.get("title")===ee){const it={latitude:i,longitude:a,address:l??null,countryCode:s??null,type:H.getState().modelType,author:H.getState().modelAuthor??r.displayName,userid:r.uid,title:ee,label:H.getState().modelLabel,description:H.getState().modelDescription,timeCreated:Date.now()},Be=ye.getModelKey(it),pt=eo.firestore().collection("models");if(pt){const ct=eo.storage().ref();e&&ye.resizeCanvas(e,200).toBlob(ft=>{if(ft){const wt={contentType:"image/png"},kt=ct.child("images/"+Be+".png").put(ft,wt);kt.on(eo.storage.TaskEvent.STATE_CHANGED,Zt=>{const Ot=Zt.bytesTransferred/Zt.totalBytes*100;Ot>0&&yn(B.t("word.Upload",ve)+": "+Ot+"%")},Zt=>{co("Storage: "+Zt)},()=>{kt.snapshot.ref.getDownloadURL().then(Zt=>{const Ot={...it,thumbnailUrl:Zt},on=pt.doc(ye.getLatLngKey(i,a));on.get().then(qt=>{if(qt.exists){const rn=qt.data();rn&&rn[Be]?on.set({[Be]:Ot},{merge:!0}).then(()=>{d5(B.t("menu.file.UpdatedOnModelsMap",ve)+".")}):on.set({[Be]:Ot},{merge:!0}).then(()=>{d5(B.t("menu.file.PublishedOnModelsMap",ve)+".")})}else on.set({[Be]:Ot},{merge:!0}).then(()=>{d5(B.t("menu.file.PublishedOnModelsMap",ve)+".")})}).catch(qt=>{co(B.t("message.CannotPublishModelOnMap",ve)+": "+qt)}),eo.firestore().collection("board").doc("people").update({[(Ot.author??"Anonymous")+"."+ye.getModelKey(Ot)]:Ot}).then(()=>{n(qt=>{if(qt.peopleModels){const rn=qt.peopleModels.get(Ot.author??"Anonymous");rn&&rn.set(ye.getModelKey(Ot),Ot)}})}),eo.firestore().collection("board").doc("info").set({latestModel:Ot},{merge:!0}).then(()=>{})})})}})}eo.firestore().collection("users").doc(r.uid).update(H.getState().modelAuthor===r.displayName?{published:eo.firestore.FieldValue.arrayUnion(ee)}:{published:eo.firestore.FieldValue.arrayUnion(ee),aliases:eo.firestore.FieldValue.arrayUnion(H.getState().modelAuthor)}).then(()=>{n(ct=>{ct.user&&(ct.user.published||(ct.user.published=[]),ct.user.published.includes(ee)||ct.user.published.push(ee),ct.user.aliases||(ct.user.aliases=[]),ct.modelAuthor&&!ct.user.aliases.includes(ct.modelAuthor)&&ct.modelAuthor!==r.displayName&&ct.user.aliases.push(ct.modelAuthor))})})}}}function yt(){if(!r||!r.uid)return;const ot=dt.getState().projectTitle;if(!ot){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}const it=ot.trim();if(it.length===0){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}Sce(r.uid,it,Be=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+Be)}).then(Be=>{if(Be)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+it);else if(r&&r.uid){const pt=dt.getState().projectType??Pi.SOLAR_PANEL_ARRAY,ct=dt.getState().projectDescription??null,Xe=new Date().getTime();eo.firestore().collection("users").doc(r.uid).collection("projects").doc(it).set({owner:r.uid,timestamp:Xe,type:pt,description:ct,counter:0,designs:[],hiddenParameters:Td.getDefaultHiddenParameters(pt)}).then(()=>{n(wt=>{wt.projectView=!0,wt.projectState.owner=r.uid,wt.projectState.type=pt,wt.projectState.title=ot,wt.projectState.description=ct,wt.projectState.counter=0,wt.projectState.dataColoring=$9.ALL,wt.projectState.selectedProperty=null,wt.projectState.sortDescending=!1,wt.projectState.xAxisNameScatterPlot=null,wt.projectState.yAxisNameScatterPlot=null,wt.projectState.dotSizeScatterPlot=5,wt.projectState.thumbnailWidth=200,wt.projectState.designs=[],wt.projectState.ranges=[],wt.projectState.filters=[],wt.projectState.hiddenParameters=Td.getDefaultHiddenParameters(wt.projectState.type)})}).catch(wt=>{co(B.t("message.CannotCreateNewProject",ve)+": "+wt)}).finally(()=>{d&&Le(!1).then(()=>{oe(!Q)}),G(!1)})}}).finally(()=>{G(!1)})}function at(){if(!r||!r.uid)return;const ot=dt.getState().projectTitle;if(!ot){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}const it=ot.trim();if(it.length===0){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}Sce(r.uid,it,Be=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+Be)}).then(Be=>{if(Be)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+it);else if(r&&r.uid){const pt=H.getState().projectState.designs;if(pt){const ct=dt.getState().projectType,Xe=dt.getState().projectDescription,ft=H.getState().projectState.owner,wt=new Date().getTime(),kt=H.getState().projectState.counter,Zt=H.getState().projectState.dataColoring??null,Ot=H.getState().projectState.selectedProperty??null,on=!!H.getState().projectState.sortDescending,qt=H.getState().projectState.xAxisNameScatterPlot??"rowWidth",rn=H.getState().projectState.yAxisNameScatterPlot??"rowWidth",Pn=H.getState().projectState.dotSizeScatterPlot??5,fo=H.getState().projectState.thumbnailWidth??200,to=Lze(it,pt)??[];for(const[fn,kn]of pt.entries())Wze(kn.title,to[fn].title,ft,r.uid);const Dt=H.getState().projectImages;if(Dt&&Dt.size>0){for(const[fn,kn]of pt.entries()){const yo=Dt.get(kn.title);yo&&(to[fn].thumbnail=qio(yo))}eo.firestore().collection("users").doc(r.uid).collection("projects").doc(it).set({owner:r.uid,timestamp:wt,type:ct,description:Xe,counter:kt,dataColoring:Zt,selectedProperty:Ot,sortDescending:on,xAxisNameScatterPlot:qt,yAxisNameScatterPlot:rn,dotSizeScatterPlot:Pn,thumbnailWidth:fo,designs:to,ranges:H.getState().projectState.ranges??null,filters:H.getState().projectState.filters??null,hiddenParameters:H.getState().projectState.hiddenParameters}).then(()=>{n(fn=>{fn.projectView=!0,fn.projectState.owner=r.uid,fn.projectState.type=ct,fn.projectState.title=ot,fn.projectState.description=Xe,fn.projectState.designs=to})}).catch(fn=>{co(B.t("message.CannotCreateNewProject",ve)+": "+fn)}).finally(()=>{d&&Le(!1).then(()=>{oe(!Q)}),G(!1)})}}}})}function Et(){const ot=H.getState().projectState.owner;if(r.uid!==ot)yn(B.t("message.CannotAddDesignToProjectOwnedByOthers",ve));else{const it=H.getState().projectState.title;if(it){G(!0);const Be=H.getState().projectState.type??Pi.SOLAR_PANEL_ARRAY,pt=H.getState().projectState.thumbnailWidth??200,ct=H.getState().projectState.counter??0;Qe(Be,it,it+" "+ct,pt)}}}function Lt(){r.uid&&bt(!1).then(()=>{dt.getState().set(ot=>{ot.showCloudFilePanel=!0})})}function Je(){r.uid&&bt(!0).then(()=>{})}function st(){Ye(!0)}function It(){Ye(!1),oe(!Q)}return t?h.jsx(h.Fragment,{children:m&&h.jsx(qke,{openCloudFile:je,deleteModelFromMap:Ue,likeModelFromMap:qe,pinModelFromMap:Fe})}):h.jsxs(h.Fragment,{children:[_&&h.jsx(ute,{}),h.jsx(MSo,{saveToCloud:nt,isLoading:()=>_,setTitle:q,getTitle:()=>ee,setTitleDialogVisible:Z,isTitleDialogVisible:()=>ae}),h.jsx(HSo,{signIn:Se,signInAnonymously:we,signOut:Ce}),u&&h.jsx(Qxo,{cloudFileArray:$,openCloudFile:ot=>{r.uid&&Ve(r.uid,ot)},deleteCloudFile:ot=>{r.uid&&St(r.uid,ot)},renameCloudFile:(ot,it)=>{r.uid&&Pt(r.uid,ot,it)}}),d&&me.current&&h.jsx(ESo,{projects:ce,setProjectState:ut,deleteProject:lt,renameProject:Oe}),f&&h.jsx(S0t,{author:void 0,models:ne.current,openCloudFile:Ve,closeCallback:()=>{o("showModelsGallery",!1),o("modelsMapSelectedSite",void 0),ne.current=void 0}}),p&&h.jsx(fvo,{openCloudFile:et}),m&&h.jsx(qke,{openCloudFile:je,deleteModelFromMap:Ue,likeModelFromMap:qe,pinModelFromMap:Fe})]})});var LSo={},WSo="@firebase/database",NSo="0.11.0";/** +`,ESo=xe.memo(({projects:t,setProjectState:e,deleteProject:n,renameProject:o})=>{const r=H(Xp),i=H(Qi),a=H(YM),l=H(i5e),s=H(pn),c=H(kc),u=xe.useRef(null),d=g.useRef(null),f=d.current?d.current.clientWidth+40:680,p=d.current?d.current.clientHeight+100:600,[m,y]=g.useState({x:0,y:0}),[w,x]=g.useState(!1),[C,P]=g.useState(!1),[A,S]=g.useState({left:0,top:0,bottom:0,right:0}),[v,b]=g.useState(),[T,R]=g.useState(),M=g.useRef(null),D=g.useRef([...t]),[k,N]=g.useState(!1),[U,W]=g.useState(-1),{Search:F}=Vl,{t:E}=Jl(),L=Kt();g.useEffect(()=>{const ee=()=>{y({x:Math.max(0,f-window.innerWidth),y:Math.min(0,window.innerHeight-p)})};return window.addEventListener("resize",ee),()=>{window.removeEventListener("resize",ee)}},[]),g.useEffect(()=>{t&&(D.current=[...t],N(!k))},[t]);const j=(ee,$)=>{y({x:Math.max($.x,f-window.innerWidth),y:Math.min($.y,window.innerHeight-p)})},Y=(ee,$)=>{},O=()=>{dt.getState().set(ee=>{ee.showProjectListPanel=!1}),i&&a("Close Project List")},_=ee=>{li.confirm({title:E("projectListPanel.DoYouReallyWantToDeleteProject",L)+' "'+ee+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(a7,{style:{marginRight:"6px"}}),E("word.Warning",L)+": "+E("message.ThisCannotBeUndone",L)]}),icon:h.jsx(t4,{}),onOk:()=>{n(ee),i&&s($=>{$.actionInfo={name:"Delete Project",timestamp:new Date().getTime(),details:ee}})}})},G=()=>{v&&T&&(o(v,T),R(void 0),N(!k),i&&s(ee=>{ee.actionInfo={name:"Rename Project",timestamp:new Date().getTime(),details:{oldTitle:v,newTitle:T}}})),x(!1)},Q=ee=>{e(ee),l.clear(),s($=>{$.canvasPercentWidth===100&&($.canvasPercentWidth=50),$.viewState.showModelTree=!1}),i&&s($=>{$.actionInfo={name:"Open Project",timestamp:new Date().getTime(),details:ee.title}})},oe=(ee,$)=>{if(M.current){const{clientWidth:ae,clientHeight:Z}=window.document.documentElement,ne=M.current.getBoundingClientRect();S({left:-ne.left+$.x,right:ae-(ne.right-$.x),top:-ne.top+$.y,bottom:Z-((ne==null?void 0:ne.bottom)-$.y)})}};return h.jsxs(h.Fragment,{children:[h.jsx(li,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>P(!0),onMouseOut:()=>P(!1),children:E("word.Rename",L)}),open:w,onOk:G,onCancel:()=>{x(!1),R(void 0)},modalRender:ee=>h.jsx(Vi,{disabled:!C,bounds:A,onStart:($,ae)=>oe($,ae),children:h.jsx("div",{ref:M,children:ee})}),children:h.jsxs(Jt,{direction:"vertical",style:{width:"100%"},children:[h.jsx(Vl,{placeholder:"Title",value:T||v,onPressEnter:G,onKeyDown:ee=>{if(!dH.test(ee.key))return ee.preventDefault(),!1},onChange:ee=>{R(ee.target.value)}}),h.jsxs("span",{style:{fontSize:"11px",color:"red"},children:[h.jsx(a7,{style:{marginRight:"4px"}}),E("word.Caution",L)+": "+E("projectListPanel.IfSharedOrPublishedRenamingProjectBreaksExistingLinks",L),"."]})]})}),h.jsx(Vi,{nodeRef:u,handle:".handle",bounds:"parent",axis:"both",position:m,onDrag:j,onStop:Y,onMouseDown:()=>{s(ee=>{ee.selectedFloatingWindow="projectListPanel"})},children:h.jsx(ISo,{ref:u,style:{zIndex:c==="projectListPanel"?Ec:14},children:h.jsxs(zSo,{ref:d,children:[h.jsxs(DSo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:E("projectListPanel.MyProjects",L)+" ("+D.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{O()},onTouchStart:()=>{O()},children:E("word.Close",L)})]}),h.jsx("span",{style:{direction:"ltr"},children:h.jsx(F,{style:{width:"50%",paddingTop:"8px",paddingBottom:"8px"},title:E("projectListPanel.SearchByTitle",L),allowClear:!0,size:"small",enterButton:!0,onSearch:ee=>{var $;if(t){D.current=[];for(const ae of t)($=ae.title)!=null&&$.toLowerCase().includes(ee.toLowerCase())&&D.current.push(ae);N(!k)}}})}),h.jsxs(Bd,{size:"small",style:{width:"100%",direction:"ltr",verticalAlign:"top"},dataSource:D.current,scroll:{y:360},pagination:{defaultPageSize:10,showSizeChanger:!0,position:["bottomCenter"],pageSizeOptions:["10","20","50"]},children:[h.jsx(Kce,{title:`${E("word.Title",L)}`,dataIndex:"title",width:"50%",sortDirections:["ascend","descend","ascend"],sorter:(ee,$)=>ee.title.localeCompare($.title),render:(ee,$,ae)=>{const Z=[{key:"project-title",label:h.jsxs(h.Fragment,{children:[h.jsx(ln,{noPadding:!0,fontWeight:"bold",children:ee}),h.jsx("hr",{})]})},{key:"open-project",label:h.jsx(ln,{noPadding:!0,onClick:()=>Q($),children:E("word.Open",L)})},{key:"copy-title-to-clip-board",label:h.jsx(ln,{noPadding:!0,onClick:()=>{navigator.clipboard.writeText(ee).then(()=>{d5(E("projectListPanel.TitleCopiedToClipBoard",L)+"."),i&&s(ne=>{ne.actionInfo={name:"Copy Project Title",timestamp:new Date().getTime(),details:ee}})})},children:E("projectListPanel.CopyTitle",L)})},{key:"rename-project",label:h.jsx(ln,{noPadding:!0,onClick:()=>{b(ee),x(!0)},children:E("word.Rename",L)})},{key:"delete-project",label:h.jsx(ln,{noPadding:!0,onClick:()=>_(ee),children:E("word.Delete",L)})},{key:"generate-project-link",label:h.jsx(ln,{noPadding:!0,onClick:()=>{const ne=k1+"?client=web&userid="+r.uid+"&project="+encodeURIComponent(ee);navigator.clipboard.writeText(ne).then(()=>{d5(E("projectListPanel.ProjectLinkGeneratedInClipBoard",L)+"."),i&&s(te=>{te.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:ne}})})},children:E("projectListPanel.GenerateProjectLink",L)})}];return h.jsxs(Jt,{style:{width:"100%"},children:[h.jsx(e4,{menu:{items:Z},trigger:["hover"],children:h.jsx(utt,{style:{fontSize:"12px",cursor:"pointer"},onMouseEnter:()=>{ae!==void 0&&W(ae)},onMouseLeave:()=>{W(-1)}})}),h.jsx(DA.Text,{title:E("word.Open",L),style:{fontSize:"12px",cursor:"pointer",verticalAlign:"top"},onClick:()=>{const ne=window.getSelection();ne&&ne.toString().length>0||Q($)},children:ee})]})},onCell:(ee,$)=>({style:{background:U===$?"lightskyblue":$!==void 0&&$%2===0?"beige":"gainsboro"}})},"title"),h.jsx(Kce,{title:`${E("word.Type",L)}`,dataIndex:"type",width:"25%",render:ee=>h.jsx(DA.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:ee}),onCell:(ee,$)=>({style:{background:U===$?"lightskyblue":$!==void 0&&$%2===0?"beige":"gainsboro"}})},"type"),h.jsx(Kce,{title:`${E("word.Time",L)}`,dataIndex:"time",width:"25%",defaultSortOrder:"descend",sortDirections:["ascend","descend","ascend"],sorter:(ee,$)=>ee.timestamp-$.timestamp,render:ee=>h.jsx(DA.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:ee}),onCell:(ee,$)=>({style:{background:U===$?"lightskyblue":$!==void 0&&$%2===0?"beige":"gainsboro"}})},"time")]})]})})})]})}),kSo="/aladdin/assets/anonymous-DoSV0M20.png",ny=(t,e,n)=>{g.useEffect(()=>{t&&(e(),n())},[t])},FSo=xe.memo(({viewOnly:t=!1,canvas:e})=>{const n=H(pn),o=dt(kf),r=H(Xp),i=H(tu),a=H(TS),l=H(cQ),s=H(ZSt),c=H(lXe),u=dt(oCt),d=dt(yCt),f=dt(ACt),p=dt(wCt),m=dt(uQ),y=H(CS),w=dt(OTt),x=dt(_Tt),C=dt(qTt),P=dt(QTt),A=dt(ePt),S=dt(tPt),v=dt(nPt),b=H(UTt),T=H(eXe),R=H(a5e),M=H(sXe),D=dt(o5e),k=H(oPt),N=H(nXe),U=dt(VTt),W=dt(GTt),F=dt(XTt),E=dt(JTt),L=dt(KTt),j=H(rXe),Y=H(iXe),O=H(oXe),[_,G]=g.useState(!1),[Q,oe]=g.useState(!1),[ee,$]=g.useState(y??"My Aladdin File"),[ae,Z]=g.useState(!1),ne=g.useRef(),te=g.useRef([]),[q,le]=g.useState([]),[de,he]=g.useState(!1),me=g.useRef(),[ce,Pe]=g.useState([]),[pe,Ie]=g.useState(!1),ve=Kt();ny(w,Te,()=>o("saveAccountSettingsFlag",!1)),ny(x,Yt,()=>o("saveCloudFileFlag",!1)),ny(C,zt,()=>o("modelsMapFlag",!1)),ny(P,Rt,()=>o("leaderboardFlag",!1)),ny(A,Ct,()=>o("publishOnModelsMapFlag",!1)),ny(U,yt,()=>o("createProjectFlag",!1)),ny(W,at,()=>o("saveProjectAsFlag",!1)),ny(E,st,()=>o("showProjectsFlag",!1)),ny(L,It,()=>o("updateProjectsFlag",!1)),ny(S,Lt,()=>o("listCloudFilesFlag",!1)),ny(v,Je,()=>o("refreshCloudFilesFlag",!1)),ny(F,Et,()=>o("curateDesignToProjectFlag",!1)),g.useEffect(()=>{const ot={apiKey:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",authDomain:"aladdin-316017.firebaseapp.com",projectId:"aladdin-316017",storageBucket:"aladdin-316017.appspot.com",databaseURL:"https://aladdin-316017.firebaseio.com",messagingSenderId:"169516488625",appId:"1:169516488625:web:bb0ae3c3f7c6e813250f90"};let it=eo.apps.length===0;return eo.apps.length===1&&eo.apps[0].name===MX.LOG_DATA&&(it=!0),it?eo.initializeApp(ot):eo.app(),eo.auth().onAuthStateChanged(Be=>{const ct=new URLSearchParams(window.location.search).get("title");n(Be?Xe=>{Xe.user&&(Xe.user.uid=Be.uid,Xe.user.displayName=Be.displayName??"Anonymous",Xe.user.email=Be.email,Xe.user.photoURL=Be.photoURL??kSo,Me({...Xe.user}).then(()=>{})),Xe.cloudFile=ct??void 0}:Xe=>{Xe.cloudFile=ct??void 0})}),Ae(),window.addEventListener("popstate",ze),()=>{window.removeEventListener("popstate",ze)}},[]);const ze=()=>{if(t)return;const ot=new URLSearchParams(window.location.search),it=ot.get("userid"),Be=ot.get("title");it&&Be&&et(it,Be,!0)};g.useEffect(()=>{r.uid&&te.current.length===0&&eao(r.uid,te.current).then(()=>{})},[r.uid]),g.useEffect(()=>{if(de){if(te.current.length>0&&r.uid){const ot=[];te.current.forEach((it,Be)=>{ot.push({title:it.title,timestamp:it.timestamp})}),ot.sort((it,Be)=>Be.timestamp-it.timestamp),le(ot)}he(!1)}},[de]),g.useEffect(()=>{if(pe){if(me.current){const ot=[];me.current.forEach((it,Be)=>{ot.push({key:Be.toString(),owner:it.owner,title:it.title,time:il(new Date(it.timestamp)).format("MM/DD/YYYY hh:mm A"),timestamp:it.timestamp,description:it.description,dataColoring:it.dataColoring,selectedProperty:it.selectedProperty,sortDescending:it.sortDescending,xAxisNameScatterPlot:it.xAxisNameScatterPlot,yAxisNameScatterPlot:it.yAxisNameScatterPlot,dotSizeScatterPlot:it.dotSizeScatterPlot,thumbnailWidth:it.thumbnailWidth,type:it.type,designs:it.designs,ranges:it.ranges??[],filters:it.filters??[],hiddenParameters:it.hiddenParameters??Td.getDefaultHiddenParameters(it.type),counter:it.counter,action:""})}),ot.sort((it,Be)=>Be.timestamp-it.timestamp),Pe(ot)}Ie(!1)}},[pe]),g.useEffect(()=>{if(ne.current=new Map,r.aliases&&r.aliases.length>0){for(const ot of r.aliases)if(ot!==r.displayName){const it=N.get(ot);it&&(ne.current=new Map([...ne.current,...it]))}}if(r.displayName){const ot=N.get(r.displayName);ot&&(ne.current=new Map([...ne.current,...ot]))}},[N,r.displayName,r.aliases]),g.useEffect(()=>{Z(b)},[T]),g.useEffect(()=>{$(y??"My Aladdin File")},[y]);const Ae=()=>{const ot=new URLSearchParams(window.location.search),it=ot.get("userid");if(it){const Be=ot.get("title"),pt=ot.get("project");pt?(G(!0),cct(it,pt,ut).finally(()=>{G(!1)}),Be&&ht(it,Be)):Be&&et(it,Be)}else n(Be=>{Be.cloudFile=void 0});ge().then(()=>{})},se=()=>{n(ot=>{ot.objectTypeToAdd=z.None,ot.groupActionMode=!1})},ge=async()=>{await eo.firestore().collection("app").doc("info").get().then(ot=>{if(ot.exists){const it=ot.data();it&&it.latestVersion&&dt.getState().set(Be=>{Be.latestVersion=it.latestVersion})}}).catch(ot=>{console.log(ot)})},we=()=>{eo.auth().signInAnonymously().then(ot=>{n(it=>{ot.user&&(it.user.uid=ot.user.uid,it.user.anonymous=!0,it.user.displayName="Anonymous",Me({...it.user}).then(()=>{}))})}).catch(ot=>{ot.code!=="auth/popup-closed-by-user"&&ot.code!=="auth/cancelled-popup-request"&&co(B.t("message.CannotSignIn",ve)+": "+ot)}),se()},Se=()=>{const ot=new eo.auth.GoogleAuthProvider;eo.auth().signInWithPopup(ot).then(it=>{n(Be=>{it.user&&(Be.user.uid=it.user.uid,Be.user.email=it.user.email,Be.user.displayName=it.user.displayName,Be.user.photoURL=it.user.photoURL,Me({...Be.user}).then(()=>{}))})}).catch(it=>{it.code!=="auth/popup-closed-by-user"&&it.code!=="auth/cancelled-popup-request"&&co(B.t("message.CannotSignIn",ve)+": "+it)}),se()},Me=async ot=>{const it=eo.firestore();let Be=!1,pt=!1,ct=!1,Xe=yc.UNKNOWN,ft=$a.UNKNOWN,wt=[],kt=[],Zt=[],Ot=[],on=!1,qt=0;ot.uid!==null&&(ot&&ot.email==="charles@intofuture.org"&&await it.collection("users").get().then(Pn=>{qt=Pn.size}),on=await it.collection("users").doc(ot.uid).get().then(Pn=>{const fo=Pn.data();return fo?(Be=!!fo.signFile,pt=!!fo.noLogging,ct=!!fo.anonymous,Xe=fo.schoolID?fo.schoolID:yc.UNKNOWN,ft=fo.classID?fo.classID:$a.UNKNOWN,fo.fileList&&(wt=fo.fileList),fo.likes&&(kt=fo.likes),fo.published&&(Zt=fo.published),fo.aliases&&(Ot=fo.aliases),!0):!1})),on?(n(rn=>{rn.user.signFile=Be,rn.user.noLogging=pt,rn.user.anonymous=ct,rn.user.schoolID=Xe,rn.user.classID=ft,rn.user.fileList=wt,rn.user.likes=kt,rn.user.published=Zt,rn.user.aliases=Ot}),dt.getState().set(rn=>{rn.userCount=qt}),ot.signFile=Be,ot.noLogging=pt,ot.anonymous=ct,ot.schoolID=Xe,ot.classID=ft,ot.fileList=wt,ot.likes=kt,ot.published=Zt,ot.aliases=Ot):ot.uid&&it.collection("users").doc(ot.uid).set({uid:ot.uid,anonymous:!!ot.anonymous,signFile:!!ot.signFile,noLogging:!!ot.noLogging,schoolID:ot.schoolID??yc.UNKNOWN,classID:ot.classID??$a.UNKNOWN,since:il(new Date).format("MM/DD/YYYY hh:mm A"),os:ye.getOS()}).then(()=>{yn(B.t("message.YourAccountWasCreated",ve))}).catch(rn=>{co(B.t("message.CannotCreateAccount",ve)+": "+rn)})},Ce=()=>{eo.auth().signOut().then(()=>{n(ot=>{ot.user.uid=null,ot.user.email=null,ot.user.displayName=null,ot.user.photoURL=null,ot.user.signFile=!1,ot.user.fileList=[],ot.user.likes=[],ot.user.published=[],ot.user.aliases=[],ot.cloudFile=void 0}),dt.getState().set(ot=>{ot.showCloudFilePanel=!1,ot.showAccountSettingsPanel=!1,ot.showModelsGallery=!1,ot.showProjectListPanel=!1})}).catch(ot=>{co(B.t("message.CannotSignOut",ve)+": "+ot)})};function Te(){r.uid&&eo.firestore().collection("users").doc(r.uid).update({signFile:!!r.signFile,schoolID:r.schoolID??yc.UNKNOWN,classID:r.classID??$a.UNKNOWN}).then(()=>{yn(B.t("message.YourAccountSettingsWereSaved",ve))}).catch(it=>{co(B.t("message.CannotSaveYourAccountSettings",ve)+": "+it)})}const Re=async()=>{G(!0);const ot=il(j).toDate().getTime(),it=il(Y).toDate().getTime();await eo.firestore().collection("models").get().then(Be=>{const pt=new Map,ct=new Map;return Be.forEach(Xe=>{var wt;const ft=Xe.data();if(ft){const kt=new Map,Zt=new Map;for(const Ot in ft){if(ft[Ot].countryCode||(wt=ft[Ot].address)!=null&&wt.endsWith("USA")&&(ft[Ot].countryCode="US"),O)kt.set(Ot,ft[Ot]);else{const on=ft[Ot].timeCreated;(on===void 0||on>=ot&&on<=it)&&kt.set(Ot,ft[Ot])}Zt.set(Ot,ft[Ot])}kt.size>0&&pt.set(Xe.id,kt),Zt.size>0&&ct.set(Xe.id,Zt)}}),n(Xe=>{Xe.modelSites=pt,Xe.allModelSites=ct}),pt}).catch(Be=>{co(B.t("message.CannotLoadModelsOnMap",ve)+": "+Be)}).finally(()=>{G(!1)})},Ne=async()=>{await eo.firestore().collection("board").doc("info").get().then(ot=>{if(ot.exists){const it=ot.data();it&&it.latestModel&&n(Be=>{var Xe;let pt=!1;const ct=it.latestModel;ct.author&&(pt=!!((Xe=Be.peopleModels.get(ct.author))!=null&&Xe.get(ye.getModelKey(ct)))),Be.latestModelSite=pt?ct:void 0})}}).catch(ot=>{console.log(ot)})},_e=async()=>{G(!0);const ot=il(j).toDate().getTime(),it=il(Y).toDate().getTime();await eo.firestore().collection("board").doc("people").get().then(Be=>{const pt=Be.data();if(pt){const ct=new Map,Xe=new Map;for(const ft in pt){if(O)ct.set(ft,new Map(Object.entries(pt[ft])));else{const wt=new Map;for(const kt of Object.entries(pt[ft])){const Zt=kt[1].timeCreated;(Zt===void 0||Zt>=ot&&Zt<=it)&&wt.set(kt[0],kt[1])}wt.size>0&&ct.set(ft,wt)}Xe.set(ft,new Map(Object.entries(pt[ft])))}n(ft=>{ft.peopleModels=ct,ft.allPeopleModels=Xe})}}).catch(Be=>{co(B.t("message.CannotLoadLeaderboard",ve)+": "+Be)}).finally(()=>{G(!1)})},Ue=(ot,it)=>{r&&r.uid&&(eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update({[ye.getModelKey(ot)]:eo.firestore.FieldValue.delete()}).then(()=>{d5(B.t("message.ModelDeletedFromMap",ve)),it&&it()}).catch(Be=>{co(B.t("message.CannotDeleteModelFromMap",ve)+": "+Be)}),eo.firestore().collection("board").doc("people").update({[(ot.author??"Anonymous")+"."+ye.getModelKey(ot)]:eo.firestore.FieldValue.delete()}).then(()=>{n(Be=>{Be.peopleModels&&(Be.peopleModels.delete(ye.getModelKey(ot)),dt.getState().set(pt=>{pt.leaderboardFlag=!0}))})}),eo.firestore().collection("users").doc(r.uid).update({published:eo.firestore.FieldValue.arrayRemove(ot.title)}).then(()=>{n(Be=>{if(Be.user&&Be.user.published&&Be.user.published.includes(ot.title)){const pt=Be.user.published.indexOf(ot.title);pt>=0&&Be.user.published.splice(pt,1)}})}))},qe=(ot,it,Be)=>{if(r&&r.uid){const pt=ye.getModelKey(ot);eo.firestore().collection("users").doc(r.uid).update(it?{likes:eo.firestore.FieldValue.arrayUnion(pt)}:{likes:eo.firestore.FieldValue.arrayRemove(pt)}).then(()=>{}).catch(Xe=>{co(B.t("message.CannotLikeModelFromMap",ve)+": "+Xe)});const ct=pt+".likeCount";eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update(it?{[ct]:eo.firestore.FieldValue.increment(1)}:{[ct]:eo.firestore.FieldValue.increment(-1)}).then(()=>{Be&&Be()}).catch(Xe=>{co(B.t("message.CannotLikeModelFromMap",ve)+": "+Xe)})}},Fe=(ot,it,Be)=>{r&&r.uid&&eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update({[ye.getModelKey(ot)+".pinned"]:it}).then(()=>{Be&&Be()}).catch(()=>{})},He=ot=>{r&&r.uid&&eo.firestore().collection("models").doc(ye.getLatLngKey(ot.latitude,ot.longitude)).update({[ye.getModelKey(ot)+".clickCount"]:eo.firestore.FieldValue.increment(1)}).then(()=>{}).catch(()=>{})},Le=async ot=>{r.uid&&(ot||G(!0),me.current=await eo.firestore().collection("users").doc(r.uid).collection("projects").get().then(it=>{const Be=[];return it.forEach(pt=>{const ct=pt.data();Be.push({owner:r.uid,title:pt.id,timestamp:ct.timestamp,description:ct.description,dataColoring:ct.dataColoring,selectedProperty:ct.selectedProperty,sortDescending:ct.sortDescending,xAxisNameScatterPlot:ct.xAxisNameScatterPlot,yAxisNameScatterPlot:ct.yAxisNameScatterPlot,dotSizeScatterPlot:ct.dotSizeScatterPlot,thumbnailWidth:ct.thumbnailWidth,type:ct.type,designs:ct.designs??[],ranges:ct.ranges??[],filters:ct.filters??[],hiddenParameters:ct.hiddenParameters??Td.getDefaultHiddenParameters(ct.type),counter:ct.counter??0})}),Be}).catch(it=>{co(B.t("message.CannotOpenYourProjects",ve)+": "+it)}).finally(()=>{ot||G(!1),Ie(!0)}))},Ye=ot=>{r.uid&&Le(!ot).then(()=>{ot&&dt.getState().set(it=>{it.showProjectListPanel=!0})})},lt=ot=>{r.uid&&eo.firestore().collection("users").doc(r.uid).collection("projects").doc(ot).delete().then(()=>{if(me.current&&r.uid){for(const it of me.current)if(it.title===ot&&it.designs){for(const Be of it.designs)n(pt=>{Be.title===pt.cloudFile&&(pt.cloudFile=void 0)}),eo.firestore().collection("users").doc(r.uid).collection("designs").doc(Be.title).delete().then(()=>{}).catch(pt=>{co(B.t("message.CannotDeleteCloudFile",ve)+": "+pt)});Ie(!0);break}me.current=me.current.filter(it=>it.title!==ot),oe(!Q)}n(it=>{ot===it.projectState.title&&(it.projectState.title=null,it.projectState.description=null,it.projectState.dataColoring=$9.ALL,it.projectState.selectedProperty=null,it.projectState.sortDescending=!1,it.projectState.xAxisNameScatterPlot=null,it.projectState.yAxisNameScatterPlot=null,it.projectState.dotSizeScatterPlot=5,it.projectState.thumbnailWidth=200,it.projectState.counter=0,it.projectState.designs=[],it.projectState.ranges=[],it.projectState.filters=[],it.projectState.hiddenParameters=Td.getDefaultHiddenParameters(it.projectState.type),it.designProjectType=null,it.projectView=!1)})}).catch(it=>{co(B.t("message.CannotDeleteProject",ve)+": "+it)})},Oe=(ot,it)=>{const Be=r.uid;Be&&Sce(Be,it,pt=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+pt)}).then(pt=>{if(pt)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+it);else{const ct=eo.firestore().collection("users").doc(Be).collection("projects");ct.doc(ot).get().then(Xe=>{if(Xe.exists){const ft=Xe.data();if(ft){const wt={...ft};if(ft.designs&&ft.designs.length>0){const kt=Lze(it,ft.designs)??[];for(const[Zt,Ot]of ft.designs.entries())Wze(Ot.title,kt[Zt].title,ft.owner,Be);wt.designs=kt,n(Zt=>{Zt.projectState.designs=kt})}ct.doc(it).set(wt).then(()=>{if(ct.doc(ot).delete().then(()=>{}),me.current){const kt=[];for(const Zt of me.current)Zt.title===ot?kt.push({owner:Zt.owner,timestamp:Zt.timestamp,title:it,description:Zt.description,type:Zt.type,designs:Zt.designs,ranges:Zt.ranges??null,filters:Zt.filters??null,hiddenParameters:Zt.hiddenParameters,counter:Zt.counter}):kt.push(Zt);me.current=kt,oe(!Q),Ie(!0)}n(kt=>{kt.projectState.title===ot&&(kt.projectState.title=it)})})}}}).catch(Xe=>{co(B.t("message.CannotRenameProject",ve)+": "+Xe)})}})},ut=ot=>{n(it=>{it.projectState={...ot},it.projectImages.clear(),it.projectView=!0}),dt.getState().set(it=>{it.projectImagesUpdateFlag=!it.projectImagesUpdateFlag,it.updateProjectsFlag=!0})},ht=(ot,it)=>{ot&&it&&(G(!0),mK(ot,it,!0,!0,t).finally(()=>{G(!1)}))},Qe=(ot,it,Be,pt)=>{if(!r.uid||!e)return;const ct=ye.resizeCanvas(e,pt).toDataURL(),Xe=uct(ot,Be,ct);eo.firestore().collection("users").doc(r.uid).collection("projects").doc(it).update({designs:eo.firestore.FieldValue.arrayUnion(Xe),counter:eo.firestore.FieldValue.increment(1)}).then(()=>{n(ft=>{var wt;(wt=ft.projectState.designs)==null||wt.push(Xe),ft.projectState.counter++,ft.designProjectType=ft.projectState.type,ft.cloudFile=Xe.title}),gt(Be,!0,!0)}).catch(ft=>{co(B.t("message.CannotAddDesignToProject",ve)+": "+ft)}).finally(()=>{G(!1)})},nt=(ot,it,Be)=>{if(!r.uid)return;const pt=ot.trim();if(pt.length===0){co(B.t("menu.file.SavingAbortedMustHaveValidTitle",ve)+".");return}G(!0),Be?Nze(r.uid,ot,ct=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+ct)}).then(ct=>{ct?(G(!1),li.confirm({title:`${B.t("message.CloudFileWithTitleExistsDoYouWantToOverwrite",ve)}`,icon:h.jsx(t4,{}),onOk:()=>{gt(pt,it)},onCancel:()=>{n(Xe=>{Xe.showCloudFileTitleDialogFlag=!Xe.showCloudFileTitleDialogFlag,Xe.showCloudFileTitleDialog=!0})},okText:`${B.t("word.Yes",ve)}`,cancelText:`${B.t("word.No",ve)}`})):gt(pt,it)}):gt(pt,it),Z(!1)},mt=(ot,it)=>{if(te.current.length>0){let Be=-1;for(const[pt,ct]of te.current.entries())if(ct.title===it){Be=pt,jze(ot,ct).then(()=>{});break}Be!==-1&&te.current.splice(Be,1)}},tt=(ot,it,Be)=>{if(te.current.length>0){let pt=-1,ct=null,Xe=null;for(const[ft,wt]of te.current.entries())if(wt.title===it){pt=ft,ct={title:it,timestamp:wt.timestamp},Xe={title:Be,timestamp:wt.timestamp};break}if(pt!==-1&&Xe&&ct){te.current.splice(pt,1),te.current.push(Xe);const ft=Xe;jze(ot,ct).then(()=>{Uze(ot,ft).then(()=>{})})}}},gt=(ot,it,Be)=>{const pt=r.uid;if(pt)try{const ct=eo.firestore().collection("users").doc(pt);if(ct){k&&dt.getState().set(ft=>{ft.waiting=!0});const Xe=ct.collection(Be?"designs":"files").doc(ot);Xe.set(c()).then(()=>{if(it||(n(ft=>{ft.cloudFile=ot}),dt.getState().setChanged(!1)),k)k==="CREATE_NEW_FILE"?M():R(k);else if(!Be){const ft=k1+"?client=web&userid="+pt+"&title="+encodeURIComponent(ot);window.history.pushState({},document.title,ft)}Be||Xe.get().then(ft=>{const wt=ft.data();if(wt&&te.current.length>0){mt(pt,ot);const kt={timestamp:wt.timestamp,title:ot};te.current.push(kt),Uze(pt,kt).then(()=>{}),he(!0)}})}).catch(ft=>{co(B.t("message.CannotSaveYourFileToCloud",ve)+": "+ft)}).finally(()=>{G(!1)})}}catch(ct){co(B.t("message.CannotSaveYourFileToCloud",ve)+": "+ct),G(!1)}},Ve=(ot,it)=>{D?li.confirm({title:`${B.t("message.DoYouWantToSaveChanges",ve)}`,icon:h.jsx(_y,{}),onOk:()=>{y?(nt(y,!0,!1),et(ot,it)):n(Be=>{Be.showCloudFileTitleDialogFlag=!Be.showCloudFileTitleDialogFlag,Be.showCloudFileTitleDialog=!0})},onCancel:()=>{et(ot,it)},okText:`${B.t("word.Yes",ve)}`,cancelText:`${B.t("word.No",ve)}`}):et(ot,it)},je=ot=>{D?li.confirm({title:`${B.t("message.DoYouWantToSaveChanges",ve)}`,icon:h.jsx(_y,{}),onOk:()=>{y?(nt(y,!0,!1),et(ot.userid,ot.title),He(ot)):n(it=>{it.showCloudFileTitleDialogFlag=!it.showCloudFileTitleDialogFlag,it.showCloudFileTitleDialog=!0})},onCancel:()=>{et(ot.userid,ot.title),He(ot)},okText:`${B.t("word.Yes",ve)}`,cancelText:`${B.t("word.No",ve)}`}):(et(ot.userid,ot.title),He(ot))},et=(ot,it,Be)=>{ot&&it&&(G(!0),mK(ot,it,!1,Be,t).finally(()=>{G(!1)}))},bt=async ot=>{const it=r.uid;it&&(G(!0),te.current=[],await eo.firestore().collection("users").doc(it).get().then(async Be=>{var ct,Xe;const pt=(ct=Be.data())==null?void 0:ct.fileList;!ot&&pt&&pt.length>0?(Xe=te.current)==null||Xe.push(...pt):await eo.firestore().collection("users").doc(it).collection("files").get().then(ft=>{ft.forEach(wt=>{var Zt;const kt=wt.data();(Zt=te.current)==null||Zt.push({timestamp:kt.timestamp,title:wt.id})})}).catch(ft=>{co(B.t("message.CannotOpenCloudFolder",ve)+": "+ft)}).finally(()=>{eo.firestore().collection("users").doc(it).update({fileList:te.current}).then(()=>{}).catch(ft=>{console.log(ft)})})}).finally(()=>{G(!1),he(!0)}))},St=(ot,it)=>{eo.firestore().collection("users").doc(ot).collection("files").doc(it).delete().then(()=>{mt(ot,it),le(q.filter(Be=>Be.title!==it)),n(Be=>{it===Be.cloudFile&&(Be.cloudFile=void 0)})}).catch(Be=>{co(B.t("message.CannotDeleteCloudFile",ve)+": "+Be)})},Pt=(ot,it,Be)=>{Nze(ot,Be,pt=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+pt)}).then(pt=>{if(pt)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+Be);else{const ct=eo.firestore().collection("users").doc(ot).collection("files");ct.doc(it).get().then(Xe=>{if(Xe.exists){const ft=Xe.data();ft&&ct.doc(Be).set(ft).then(()=>{ct.doc(it).delete().then(()=>{}).catch(kt=>{co(B.t("message.CannotDeleteCloudFile",ve)+" "+it+": "+kt)});for(const kt of q)if(kt.title===it){kt.title=Be;break}le([...q]),tt(ot,it,Be),n(kt=>{kt.cloudFile===it&&(kt.cloudFile=Be)});const wt=new URLSearchParams(window.location.search);if(wt.get("title")===it&&wt.get("userid")===r.uid){const kt=k1+"?client=web&userid="+r.uid+"&title="+encodeURIComponent(Be);window.history.pushState({},document.title,kt)}})}}).catch(Xe=>{co(B.t("message.CannotRenameCloudFile",ve)+": "+Xe)})}})};function Yt(){y&&(nt(y,!1,!1),$(y))}function zt(){Re().then(()=>{Ne().then(()=>{})})}function Rt(){_e().then(()=>{Ne().then(()=>{})})}function Ct(){if(r&&r.uid&&ee){const ot=new URLSearchParams(window.location.search);if(ot.get("userid")===r.uid&&ot.get("title")===ee){const it={latitude:i,longitude:a,address:l??null,countryCode:s??null,type:H.getState().modelType,author:H.getState().modelAuthor??r.displayName,userid:r.uid,title:ee,label:H.getState().modelLabel,description:H.getState().modelDescription,timeCreated:Date.now()},Be=ye.getModelKey(it),pt=eo.firestore().collection("models");if(pt){const ct=eo.storage().ref();e&&ye.resizeCanvas(e,200).toBlob(ft=>{if(ft){const wt={contentType:"image/png"},kt=ct.child("images/"+Be+".png").put(ft,wt);kt.on(eo.storage.TaskEvent.STATE_CHANGED,Zt=>{const Ot=Zt.bytesTransferred/Zt.totalBytes*100;Ot>0&&yn(B.t("word.Upload",ve)+": "+Ot+"%")},Zt=>{co("Storage: "+Zt)},()=>{kt.snapshot.ref.getDownloadURL().then(Zt=>{const Ot={...it,thumbnailUrl:Zt},on=pt.doc(ye.getLatLngKey(i,a));on.get().then(qt=>{if(qt.exists){const rn=qt.data();rn&&rn[Be]?on.set({[Be]:Ot},{merge:!0}).then(()=>{d5(B.t("menu.file.UpdatedOnModelsMap",ve)+".")}):on.set({[Be]:Ot},{merge:!0}).then(()=>{d5(B.t("menu.file.PublishedOnModelsMap",ve)+".")})}else on.set({[Be]:Ot},{merge:!0}).then(()=>{d5(B.t("menu.file.PublishedOnModelsMap",ve)+".")})}).catch(qt=>{co(B.t("message.CannotPublishModelOnMap",ve)+": "+qt)}),eo.firestore().collection("board").doc("people").update({[(Ot.author??"Anonymous")+"."+ye.getModelKey(Ot)]:Ot}).then(()=>{n(qt=>{if(qt.peopleModels){const rn=qt.peopleModels.get(Ot.author??"Anonymous");rn&&rn.set(ye.getModelKey(Ot),Ot)}})}),eo.firestore().collection("board").doc("info").set({latestModel:Ot},{merge:!0}).then(()=>{})})})}})}eo.firestore().collection("users").doc(r.uid).update(H.getState().modelAuthor===r.displayName?{published:eo.firestore.FieldValue.arrayUnion(ee)}:{published:eo.firestore.FieldValue.arrayUnion(ee),aliases:eo.firestore.FieldValue.arrayUnion(H.getState().modelAuthor)}).then(()=>{n(ct=>{ct.user&&(ct.user.published||(ct.user.published=[]),ct.user.published.includes(ee)||ct.user.published.push(ee),ct.user.aliases||(ct.user.aliases=[]),ct.modelAuthor&&!ct.user.aliases.includes(ct.modelAuthor)&&ct.modelAuthor!==r.displayName&&ct.user.aliases.push(ct.modelAuthor))})})}}}function yt(){if(!r||!r.uid)return;const ot=dt.getState().projectTitle;if(!ot){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}const it=ot.trim();if(it.length===0){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}Sce(r.uid,it,Be=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+Be)}).then(Be=>{if(Be)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+it);else if(r&&r.uid){const pt=dt.getState().projectType??Pi.SOLAR_PANEL_ARRAY,ct=dt.getState().projectDescription??null,Xe=new Date().getTime();eo.firestore().collection("users").doc(r.uid).collection("projects").doc(it).set({owner:r.uid,timestamp:Xe,type:pt,description:ct,counter:0,designs:[],hiddenParameters:Td.getDefaultHiddenParameters(pt)}).then(()=>{n(wt=>{wt.projectView=!0,wt.projectState.owner=r.uid,wt.projectState.type=pt,wt.projectState.title=ot,wt.projectState.description=ct,wt.projectState.counter=0,wt.projectState.dataColoring=$9.ALL,wt.projectState.selectedProperty=null,wt.projectState.sortDescending=!1,wt.projectState.xAxisNameScatterPlot=null,wt.projectState.yAxisNameScatterPlot=null,wt.projectState.dotSizeScatterPlot=5,wt.projectState.thumbnailWidth=200,wt.projectState.designs=[],wt.projectState.ranges=[],wt.projectState.filters=[],wt.projectState.hiddenParameters=Td.getDefaultHiddenParameters(wt.projectState.type)})}).catch(wt=>{co(B.t("message.CannotCreateNewProject",ve)+": "+wt)}).finally(()=>{d&&Le(!1).then(()=>{oe(!Q)}),G(!1)})}}).finally(()=>{G(!1)})}function at(){if(!r||!r.uid)return;const ot=dt.getState().projectTitle;if(!ot){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}const it=ot.trim();if(it.length===0){co(B.t("message.CannotCreateNewProjectWithoutTitle",ve)+".");return}Sce(r.uid,it,Be=>{co(B.t("message.CannotOpenCloudFile",ve)+": "+Be)}).then(Be=>{if(Be)yn(B.t("message.TitleUsedChooseDifferentOne",ve)+": "+it);else if(r&&r.uid){const pt=H.getState().projectState.designs;if(pt){const ct=dt.getState().projectType,Xe=dt.getState().projectDescription,ft=H.getState().projectState.owner,wt=new Date().getTime(),kt=H.getState().projectState.counter,Zt=H.getState().projectState.dataColoring??null,Ot=H.getState().projectState.selectedProperty??null,on=!!H.getState().projectState.sortDescending,qt=H.getState().projectState.xAxisNameScatterPlot??"rowWidth",rn=H.getState().projectState.yAxisNameScatterPlot??"rowWidth",Pn=H.getState().projectState.dotSizeScatterPlot??5,fo=H.getState().projectState.thumbnailWidth??200,to=Lze(it,pt)??[];for(const[fn,kn]of pt.entries())Wze(kn.title,to[fn].title,ft,r.uid);const Dt=H.getState().projectImages;if(Dt&&Dt.size>0){for(const[fn,kn]of pt.entries()){const yo=Dt.get(kn.title);yo&&(to[fn].thumbnail=qio(yo))}eo.firestore().collection("users").doc(r.uid).collection("projects").doc(it).set({owner:r.uid,timestamp:wt,type:ct,description:Xe,counter:kt,dataColoring:Zt,selectedProperty:Ot,sortDescending:on,xAxisNameScatterPlot:qt,yAxisNameScatterPlot:rn,dotSizeScatterPlot:Pn,thumbnailWidth:fo,designs:to,ranges:H.getState().projectState.ranges??null,filters:H.getState().projectState.filters??null,hiddenParameters:H.getState().projectState.hiddenParameters}).then(()=>{n(fn=>{fn.projectView=!0,fn.projectState.owner=r.uid,fn.projectState.type=ct,fn.projectState.title=ot,fn.projectState.description=Xe,fn.projectState.designs=to})}).catch(fn=>{co(B.t("message.CannotCreateNewProject",ve)+": "+fn)}).finally(()=>{d&&Le(!1).then(()=>{oe(!Q)}),G(!1)})}}}})}function Et(){const ot=H.getState().projectState.owner;if(r.uid!==ot)yn(B.t("message.CannotAddDesignToProjectOwnedByOthers",ve));else{const it=H.getState().projectState.title;if(it){G(!0);const Be=H.getState().projectState.type??Pi.SOLAR_PANEL_ARRAY,pt=H.getState().projectState.thumbnailWidth??200,ct=H.getState().projectState.counter??0;Qe(Be,it,it+" "+ct,pt)}}}function Lt(){r.uid&&bt(!1).then(()=>{dt.getState().set(ot=>{ot.showCloudFilePanel=!0})})}function Je(){r.uid&&bt(!0).then(()=>{})}function st(){Ye(!0)}function It(){Ye(!1),oe(!Q)}return t?h.jsx(h.Fragment,{children:m&&h.jsx(qke,{openCloudFile:je,deleteModelFromMap:Ue,likeModelFromMap:qe,pinModelFromMap:Fe})}):h.jsxs(h.Fragment,{children:[_&&h.jsx(ute,{}),h.jsx(MSo,{saveToCloud:nt,isLoading:()=>_,setTitle:$,getTitle:()=>ee,setTitleDialogVisible:Z,isTitleDialogVisible:()=>ae}),h.jsx(HSo,{signIn:Se,signInAnonymously:we,signOut:Ce}),u&&h.jsx(Qxo,{cloudFileArray:q,openCloudFile:ot=>{r.uid&&Ve(r.uid,ot)},deleteCloudFile:ot=>{r.uid&&St(r.uid,ot)},renameCloudFile:(ot,it)=>{r.uid&&Pt(r.uid,ot,it)}}),d&&me.current&&h.jsx(ESo,{projects:ce,setProjectState:ut,deleteProject:lt,renameProject:Oe}),f&&h.jsx(S0t,{author:void 0,models:ne.current,openCloudFile:Ve,closeCallback:()=>{o("showModelsGallery",!1),o("modelsMapSelectedSite",void 0),ne.current=void 0}}),p&&h.jsx(fvo,{openCloudFile:et}),m&&h.jsx(qke,{openCloudFile:je,deleteModelFromMap:Ue,likeModelFromMap:qe,pinModelFromMap:Fe})]})});var LSo={},WSo="@firebase/database",NSo="0.11.0";/** * @license * Copyright 2019 Google LLC * @@ -8699,15 +8699,15 @@ return orthographicDepthToViewZ(depth,cameraNear,cameraFar); `+o),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,t.colorSpace===al&&(o+=`color0 = sRGBToLinear(color0); `),t.uvTransformation?(r=`vec2 transformedUv = vUv; `+r,t.defines.set("UV","transformedUv")):t.defines.set("UV","vUv"),t.shaderParts.set(Wl.FRAGMENT_HEAD,n),t.shaderParts.set(Wl.FRAGMENT_MAIN_IMAGE,o),t.shaderParts.set(Wl.FRAGMENT_MAIN_UV,r);for(const[a,l]of t.shaderParts)l!==null&&t.shaderParts.set(a,l.trim().replace(/^#/,` -#`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(t)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(t,e=b7){this.fullscreenMaterial.depthBuffer=t,this.fullscreenMaterial.depthPacking=e;for(const n of this.effects)n.setDepthTexture(t,e)}render(t,e,n,o,r){for(const i of this.effects)i.update(t,e,o);if(!this.skipRendering||this.renderToScreen){const i=this.fullscreenMaterial;i.inputBuffer=e.texture,i.time+=o*this.timeScale,t.setRenderTarget(this.renderToScreen?null:n),t.render(this.scene,this.camera)}}setSize(t,e){this.fullscreenMaterial.setSize(t,e);for(const n of this.effects)n.setSize(t,e)}initialize(t,e,n){this.renderer=t;for(const o of this.effects)o.initialize(t,e,n);this.updateMaterial(),n!==void 0&&n!==xf&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const t of this.effects)t.removeEventListener("change",this.listener),t.dispose()}handleEvent(t){switch(t.type){case"change":this.recompile();break}}},mMo=class extends J1{constructor(t,e,{renderTarget:n,resolutionScale:o=1,width:r=Mh.AUTO_SIZE,height:i=Mh.AUTO_SIZE,resolutionX:a=r,resolutionY:l=i}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new eft(t,e,new T2e);const s=this.renderPass;s.ignoreBackground=!0,s.skipShadowMapUpdate=!0;const c=s.getClearPass();c.overrideClearColor=new ir(7829503),c.overrideClearAlpha=1,this.renderTarget=n,this.renderTarget===void 0&&(this.renderTarget=new ku(1,1,{minFilter:Cc,magFilter:Cc}),this.renderTarget.texture.name="NormalPass.Target");const u=this.resolution=new Mh(this,a,l,o);u.addEventListener("change",d=>this.setSize(u.baseWidth,u.baseHeight))}set mainScene(t){this.renderPass.mainScene=t}set mainCamera(t){this.renderPass.mainCamera=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,n,o,r){const i=this.renderToScreen?null:this.renderTarget;this.renderPass.render(t,i,i)}setSize(t,e){const n=this.resolution;n.setBaseSize(t,e),this.renderTarget.setSize(n.width,n.height)}};let CE;function yMo(){var t;if(CE!==void 0)return CE;try{let e;const n=document.createElement("canvas");return CE=!!(window.WebGL2RenderingContext&&(e=n.getContext("webgl2"))),e&&((t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()),CE}catch{return CE=!1}}const AMo=g.createContext(null),lLe=t=>(t.getAttributes()&NA.CONVOLUTION)===NA.CONVOLUTION,wMo=xe.memo(g.forwardRef(({children:t,camera:e,scene:n,resolutionScale:o,enabled:r=!0,renderPriority:i=1,autoClear:a=!0,depthBuffer:l,enableNormalPass:s,stencilBuffer:c,multisampling:u=8,frameBufferType:d=G8},f)=>{const{gl:p,scene:m,camera:y,size:w}=ti(),x=n||m,C=e||y,[P,A,S]=g.useMemo(()=>{const R=yMo(),M=new sHo(p,{depthBuffer:l,stencilBuffer:c,multisampling:u>0&&R?u:0,frameBufferType:d});M.addPass(new eft(x,C));let D=null,k=null;return s&&(k=new mMo(x,C),k.enabled=!1,M.addPass(k),o!==void 0&&R&&(D=new uMo({normalBuffer:k.texture,resolutionScale:o}),D.enabled=!1,M.addPass(D))),[M,k,D]},[C,p,l,c,u,d,x,s,o]);g.useEffect(()=>P==null?void 0:P.setSize(w.width,w.height),[P,w]),Gp((R,M)=>{if(r){const D=p.autoClear;p.autoClear=a,c&&!a&&p.clearStencil(),P.render(M),p.autoClear=D}},r?i:0);const v=g.useRef(null),b=Txt(v);g.useLayoutEffect(()=>{const R=[];if(v.current&&b.current&&P){const M=b.current.objects;for(let D=0;D{for(const M of R)P==null||P.removePass(M);A&&(A.enabled=!1),S&&(S.enabled=!1)}},[P,t,C,A,S,b]),g.useEffect(()=>{const R=p.toneMapping;return p.toneMapping=w5,()=>{p.toneMapping=R}},[]);const T=g.useMemo(()=>({composer:P,normalPass:A,downSamplingPass:S,resolutionScale:o,camera:C,scene:x}),[P,A,S,o,C,x]);return g.useImperativeHandle(f,()=>P,[P]),h.jsx(AMo.Provider,{value:T,children:h.jsx("group",{ref:v,children:t})})}));let xMo=0;const sLe=new WeakMap,vMo=(t,e)=>xe.forwardRef(function({blendFunction:o=e==null?void 0:e.blendFunction,opacity:r=e==null?void 0:e.opacity,...i},a){let l=sLe.get(t);if(!l){const u=`@react-three/postprocessing/${t.name}-${xMo++}`;R7({[u]:t}),sLe.set(t,l=u)}const s=ti(u=>u.camera),c=xe.useMemo(()=>{var u,d;return[...(u=e==null?void 0:e.args)!=null?u:[],...(d=i.args)!=null?d:[{...e,...i}]]},[JSON.stringify(i)]);return h.jsx(l,{camera:s,"blendMode-blendFunction":o,"blendMode-opacity-value":r,...i,ref:a,args:c})}),bMo=vMo(aMo,{blendFunction:Ka.ADD}),SMo=()=>h.jsx(wMo,{children:h.jsx(bMo,{mipmapBlur:!0,luminanceThreshold:10,intensity:.05,radius:.1})}),TMo=xe.memo(()=>{const t=H(CGe)??3.5,e=H(PGe)??.2,n=H(aQ)??pL,o=ye.getShadowMapSize(),r=H(I7),i=H(Ky),a=2*i,l=i+100,s=H(xs),c=g.useRef(null);c.current&&(c.current.shadow.camera.left=-l,c.current.shadow.camera.bottom=-l,c.current.shadow.camera.right=l,c.current.shadow.camera.top=l,c.current.shadow.camera.updateProjectionMatrix());const u=r.z>0,d=u?r.normalize().dot(Oo):0;return h.jsxs(h.Fragment,{children:[h.jsx(SMo,{}),h.jsx("ambientLight",{intensity:Evt+(u?e*d:0),name:"Ambient Light"}),h.jsx("directionalLight",{ref:c,name:"Directional Light",color:"white",position:r.normalize().multiplyScalar(a),intensity:u?t*d:0,castShadow:s,"shadow-bias":0,"shadow-mapSize-height":o,"shadow-mapSize-width":o,"shadow-camera-near":1,"shadow-camera-far":n})]})}),PMo=xe.memo(({element:t})=>{const e=H(mPt),n=H(Cm),o=H($y),r=H(v5e),i=t.type===z.Roof,a="lightGray",l=B5(NM,gI),s={font:l,height:0,size:.2},c={font:l,height:0,size:.35},u=g.useMemo(()=>r(t,n??o),[n,o]),d=g.useMemo(()=>{const P=-Math.atan2(e.x,e.y)+Math.PI;return new cn($t,0,P,"ZXY")},[e.x,e.y]),f=()=>{let P=t.lz;return i&&(P=H.getState().selectedElementHeight),Math.ceil(P)+1},p=()=>{let P=t.lz;return i&&(P=t.rise),P.toFixed(1)+" m"},m=()=>i?H.getState().selectedElementHeight+1:t.lz-.175;if(!n&&!o)return null;const y=f(),w=p(),x=m(),C=new Array(y+1).fill(0);return h.jsxs("group",{position:u,rotation:d,name:"Vertical Ruler",children:[h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[0,y,0]],color:a}),h.jsxs("mesh",{position:[-1.5,x,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[w,c]}),h.jsx("meshBasicMaterial",{attach:"material",color:"white"})]}),C.map((P,A)=>{const S=.2+(A%5===0?.05:0),v=h.jsx("textGeometry",{args:[`${A}`,s]});return h.jsxs("group",{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[-S,A,0],[S,A,0]],lineWidth:.5,color:a}),!i&&h.jsxs("mesh",{position:[.4,A-.125,0],userData:{unintersectable:!0},children:[v,h.jsx("meshBasicMaterial",{attach:"material",color:a})]})]},A)})]})}),CMo=xe.memo(()=>{const t=H(FS),e=H(SQ),n=H(Cm),o=H($y),r=H(h4),i=H(Ky),a=H(PQ),l=H(TQ),s=H(A=>{if(A.selectedElement){const S=A.selectedElement.id;return A.elements.find(v=>v.id===S)}}),[c,u]=g.useState(!1),[d,f]=g.useState(2*i),[p,m]=g.useState(2*i);g.useEffect(()=>{const A=Math.floor(i/50)+1,S=Math.round(i/A)*2;f(S*A),m(S)},[i]),g.useEffect(()=>{if(n){const A=ye.isTopResizeHandle(n)||n===xt.UpperLeft&&(s==null?void 0:s.type)===z.Wall||n===xt.UpperRight&&(s==null?void 0:s.type)===z.Wall;u(!A)}else u(!1)},[n,s==null?void 0:s.type]);const y=()=>{if(!s)return!1;const A=s.type;return A===z.Foundation||A===z.Cuboid||A===z.Tree&&s.parentId===z.Ground||A===z.Human&&s.parentId===z.Ground},w=o===ai.Lower||o===ai.Upper,P=(A=>ye.isTopResizeHandle(A)&&(s==null?void 0:s.type)!==z.BatteryStorage||(s==null?void 0:s.type)===z.Wall&&ye.isTopResizeHandleOfWall(A)||(s==null?void 0:s.type)===z.Roof&&ye.isRiseHandleOfRoof(A))(n??o);return s?h.jsxs(h.Fragment,{children:[((c||t||ye.isMoveHandle(o))&&!r&&y()||a||l)&&h.jsx("gridHelper",{rotation:[$t,0,0],name:"Grid",args:[d,p,"gray","#444444"]}),(e||w)&&s&&y()&&h.jsx(j3e,{element:s}),P&&h.jsx(PMo,{element:s})]}):null}),iue=120,tv="DarkSlateGray",RE="white",RMo=xe.memo(({visible:t=!0})=>{const e=g.useRef(null),n=Kt(),o=window.devicePixelRatio,r=iue*o,i=r/150,l=20*i+"px serif";return g.useEffect(()=>{e.current&&jn.setState({compassRef:e})},[]),g.useEffect(()=>{if(!e.current||!t)return;const s=e.current.getContext("2d");if(!s)return;const c=55*i,u=10*i,d=40*i,f=5*i,p=30*i,m=i,y=i,w=15*i,x=r/2;s.clearRect(0,0,r,r),s.beginPath(),s.arc(x,x,d,0,Math.PI*2),s.lineWidth=f,s.strokeStyle=tv,s.stroke(),s.beginPath(),s.arc(x,x,p,0,Math.PI*2),s.lineWidth=m,s.strokeStyle=tv,s.stroke(),s.lineWidth=y,s.beginPath(),s.moveTo(x,x-c),s.lineTo(x-u,x-u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x,x-c),s.lineTo(x+u,x-u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x,x+c),s.lineTo(x-u,x+u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x,x+c),s.lineTo(x+u,x+u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x-c,x),s.lineTo(x-u,x-u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x-c,x),s.lineTo(x-u,x+u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x+c,x),s.lineTo(x+u,x-u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x+c,x),s.lineTo(x+u,x+u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.font=l,s.fillStyle=RE,s.textAlign="center",s.fillText(`${B.t("compass.N",n)}`,x,w),s.save(),s.translate(r,r),s.rotate(Math.PI),s.fillText(`${B.t("compass.S",n)}`,x,w),s.restore(),s.fillStyle=tv,s.save(),s.translate(0,r),s.rotate(-Math.PI/2),s.fillText(`${B.t("compass.W",n)}`,x,w),s.restore(),s.save(),s.translate(r,0),s.rotate(Math.PI/2),s.fillText(`${B.t("compass.E",n)}`,x,w),s.restore()},[n,t]),t?h.jsx("canvas",{ref:e,id:"compassCanvas",width:r,height:r,style:{position:"absolute",bottom:"0",right:"0",height:`${iue}px`,width:`${iue}px`,margin:"5px",pointerEvents:"none"}}):null});var tft={exports:{}};(function(t,e){(function(n,o){t.exports=o(g,rQ)})(window,function(n,o){return function(r){var i={};function a(l){if(i[l])return i[l].exports;var s=i[l]={i:l,l:!1,exports:{}};return r[l].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=r,a.c=i,a.d=function(l,s,c){a.o(l,s)||Object.defineProperty(l,s,{enumerable:!0,get:c})},a.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},a.t=function(l,s){if(1&s&&(l=a(l)),8&s||4&s&&typeof l=="object"&&l&&l.__esModule)return l;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:l}),2&s&&typeof l!="string")for(var u in l)a.d(c,u,(function(d){return l[d]}).bind(null,u));return c},a.n=function(l){var s=l&&l.__esModule?function(){return l.default}:function(){return l};return a.d(s,"a",s),s},a.o=function(l,s){return Object.prototype.hasOwnProperty.call(l,s)},a.p="",a(a.s=0)}([function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=a(1);Object.defineProperty(i,"default",{enumerable:!0,get:function(){return function(s){return s&&s.__esModule?s:{default:s}}(l).default}}),r.exports=i.default},function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=Object.assign||function(y){for(var w=1;w0&&p[0]!==this)return!1;var R=x.target===document.body||T,M=this.childrenContainer&&this.childrenContainer.contains(x.target);if(!(b?M:R))return!1;var D=(0,d.findMatchedKey)(x,A);return!!D&&(S(D,x),!0)}},{key:"render",value:function(){var x=this,C=this.props.children,P=Object.assign({},this.props),A=!0,S=!1,v=void 0;try{for(var b,T=Object.keys(w.propTypes)[Symbol.iterator]();!(A=(b=T.next()).done);A=!0)delete P[b.value]}catch(R){S=!0,v=R}finally{try{!A&&T.return&&T.return()}finally{if(S)throw v}}return C?c.default.createElement("span",l({ref:function(R){x.childrenContainer=R}},P),C):null}}]),w}();i.default=m,m.propTypes={handleKeys:u.default.array,handleEventType:u.default.oneOf(["keydown","keyup","keypress"]),handleFocusableElements:u.default.bool,onKeyEvent:u.default.func,isDisabled:u.default.bool,isExclusive:u.default.bool,children:u.default.any},m.defaultProps={handleKeys:[],handleFocusableElements:!1,handleEventType:"keydown",onKeyEvent:function(){return null}},r.exports=i.default},function(r,i){r.exports=n},function(r,i){r.exports=o},function(r,i,a){function l(C,P,A){return P in C?Object.defineProperty(C,P,{value:A,enumerable:!0,configurable:!0,writable:!0}):C[P]=A,C}Object.defineProperty(i,"__esModule",{value:!0}),i.matchKeyEvent=x,i.findMatchedKey=function(C,P){var A=P.map(function(S){var v=S.toLowerCase(),b=w[v];return b||[S]}).reduce(function(S,v){return S.concat(v)},[]).find(function(S){return x(C,S)});return!A&&P.includes("all")&&(A="other"),A};var s={backspace:[8],del:[46],delete:[46],ins:[45],insert:[45],tab:[9],enter:[13],return:[13],esc:[27],space:[32],pageup:[33],pagedown:[34],end:[35],home:[36],left:[37],up:[38],right:[39],down:[40],shift:[16],ctrl:[17],alt:[18],cap:[20],num:[144],clear:[12],meta:[91],";":[186,59],"=":[187,61],",":[188,44],"-":[189,45,173,109],minus:[189,45,173,109],".":[190,110],"/":[191,111],"`":[192],"[":[219],"\\":[220],"]":[221],"*":[106],"+":[107],plus:[107],"'":[222],quote:[222]},c=Object.keys(s).reduce(function(C,P){return Object.assign(C,l({},P.toUpperCase(),s[P]))},{}),u="0123456789".split("").reduce(function(C,P,A){return Object.assign(C,l({},P,[A+48,A+96]))},{}),d="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(C,P,A){return Object.assign(C,l({},P.toLowerCase(),[A+65]),l({},P,[A+65]))},{}),f="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(C,P,A){return Object.assign(C,l({},"f"+P,[A+112]))},{}),p={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},m=i.AllKeys=Object.assign({},s,c,u,d,f),y=Object.assign({},u,d),w={all:Object.keys(m),alphanumeric:Object.keys(y),numeric:Object.keys(u),alphabetic:Object.keys(d),function:Object.keys(f)};function x(C,P){var A=C.which||C.keyCode,S=C.type,v=Object.keys(p).filter(function(U){return C[U+"Key"]}).sort(),b=P.toLowerCase().trim(),T=b==="+"?["+"]:b.split(/\s?\+\s?/),R=T.pop(),M=m[R],D=T;if(S==="keypress")return P==String.fromCharCode(A).toLowerCase();if(D.length===0&&v.length===0)return M.indexOf(A)>=0;if(D.length>0&&v.length>0){var k=D.map(function(U){return p[U]}).sort(),N=k.length===v.length&&k.every(function(U,W){return v[W]===U});return M.indexOf(A)>=0&&N}return D.length==0&&v.length===1&&R===v[0]}}])})})(tft);var HMo=tft.exports;const mge=ji(HMo),MMo=xe.memo(()=>{var s,c;const t=H(pn),e=H(P5e),n=H(T5e),o=H(Fn),r=g.useRef(!1),i=g.useRef(!1);H(RJe),H(HJe),dt(u=>u.selectedElementId),g.useEffect(()=>{jn.setState({listenToAutoDeletionByDeleteRef:r,listenToAutoDeletionByCutRef:i})},[]);const a=A3.debounce(()=>{var A,S;const u=dt.getState().selectedElementId,d=H.getState().selectedElementIdSet;if(!u||d.size===0)return;const f=H.getState().getAutoDeletedElements();if(!f)return;const p=H.getState().deletedElements,m=H.getState().elementsToPaste,y=(A=jn.getState().listenToAutoDeletionByCutRef)==null?void 0:A.current,w=(S=jn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:S.current;let x=[],C="";y?(jn.getState().setListenToAutoDeletionByCut(!1),x=[...m,...f],C="Cut"):w&&(jn.getState().setListenToAutoDeletionByDelete(!1),x=[...p,...f],C="Delete");const P={name:C,timestamp:Date.now(),deletedElements:[...x],selectedElementId:u,selectedElementIdSet:new Set(d),undo(){const v=P.deletedElements;if(!v||v.length===0)return;for(const T of this.deletedElements)if(T.type===z.Wall){const R=T;R.leftJoints.length>0&&e(R.leftJoints[0],[R.id]),R.rightJoints.length>0&&n(R.rightJoints[0],[R.id])}else T.type===z.Roof&&t(R=>{R.addedRoofIdSet.add(T.id)});const b=v.find(T=>T.id===this.selectedElementId)??null;t(T=>{T.elements.push(...v),T.selectedElement=b,T.selectedElementIdSet=new Set(this.selectedElementIdSet),T.updateWallMapOnFoundationFlag=!T.updateWallMapOnFoundationFlag,T.deletedRoofId=null,T.autoDeletedRoofs=null,T.deletedRoofIdSet.clear(),T.autoDeletedRoofIdSet.clear(),T.autoDeletedChild=null})},redo(){P.deletedElements.length!==0&&(t(v=>{v.selectedElement=v.elements.find(b=>b.id===this.selectedElementId)??null,v.selectedElementIdSet=new Set(this.selectedElementIdSet)}),H.getState().removeSelectedElements())}};o(P),t(v=>{v.selectedElement=null,v.selectedElementIdSet.clear(),v.deletedRoofId=null,v.deletedRoofIdSet.clear(),v.autoDeletedRoofs=null,v.autoDeletedRoofIdSet.clear(),v.autoDeletedChild=null}),dt.getState().setPrimitiveStore("selectedElementId",null)},50);return(((s=jn.getState().listenToAutoDeletionByCutRef)==null?void 0:s.current)||((c=jn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:c.current))&&H.getState().getAutoDeletedElements()&&a(),null}),cLe=["left","up","right","down","shift+left","shift+up","shift+right","shift+down","ctrl+shift+left","ctrl+shift+up","ctrl+shift+right","ctrl+shift+down","meta+shift+left","meta+shift+up","meta+shift+right","meta+shift+down","ctrl+f","meta+f","ctrl+o","meta+o","ctrl+s","meta+s","ctrl+c","meta+c","ctrl+x","meta+x","ctrl+v","meta+v","ctrl+[","meta+[","ctrl+]","meta+]","ctrl+z","meta+z","ctrl+y","meta+y","ctrl+m","meta+m","ctrl+u","meta+u","ctrl+b","meta+b","shift","esc","ctrl+home","ctrl+alt+h","ctrl+shift+o","meta+shift+o","ctrl+shift+s","meta+shift+s","delete","backspace","alt+backspace","f2","f4","ctrl"],IMo=xe.memo(({canvas:t})=>{const e=H(pn),n=H(Qi),o=H(qN),r=H(Au),i=H(i5e),a=H(Fn),l=H(M0)??!1,s=H(HS),c=H(Jn),u=H(YXe),d=H(Jp),f=H(JPt),p=H($r),m=H(T5e),y=H(P5e),w=H(nCt),x=H(c5e),C=H(YM),P=.1,A=g.useMemo(()=>({lng:r}),[r]),S=(G,Q)=>(t&&(t.style.cursor="default"),d(G,Q)),v=()=>{if(H.getState().viewState.navigationView)return;const G=H.getState().set2DView,Q={name:"Set 2D View",timestamp:Date.now(),checked:!l,undo:()=>{G(!Q.checked)},redo:()=>{G(Q.checked)}};a(Q),G(!l),e(oe=>{oe.viewState.autoRotate=!1})},b=()=>{if(l)return;const G=H.getState().setNavigationView,Q={name:"Set Navigation View",timestamp:Date.now(),checked:!H.getState().viewState.navigationView,undo:()=>{G(!Q.checked)},redo:()=>{G(Q.checked)}};a(Q),G(!H.getState().viewState.navigationView),e(oe=>{oe.viewState.autoRotate=!1})},T=()=>{if(l)return;const G={name:"Auto Rotate",timestamp:Date.now(),checked:!H.getState().viewState.autoRotate,undo:()=>{e(Q=>{Q.objectTypeToAdd=z.None,Q.groupActionMode=!1,Q.viewState.autoRotate=!G.checked})},redo:()=>{e(Q=>{Q.objectTypeToAdd=z.None,Q.groupActionMode=!1,Q.viewState.autoRotate=G.checked})}};a(G),e(Q=>{Q.objectTypeToAdd=z.None,Q.groupActionMode=!1,Q.viewState.autoRotate=!Q.viewState.autoRotate})},R=(G,Q,oe)=>{const ee=JSON.parse(JSON.stringify(G));if(ee.cx=Q,ee.cy=oe,G.type===z.SolarPanel&&G.parentType===z.Roof){if(G.parentId&&G.foundationId){const q=c(G.parentId),ae=c(G.foundationId);if(q&&ae){const Z=Rn.getRoofBoundaryVertices(q),ne=Rn.getSolarPanelVerticesOnRoof(ee,ae);if(!Hot(ne,Z)||!Mot(ee,ae,ne))return!1}}return!0}if(x(ee))return co(B.t("message.MoveCancelledBecauseOfOverlap",A)),!1;if(ee.type===z.SolarPanel){const q=p(G);if(q&&!ye.isSolarCollectorWithinHorizontalSurface(ee,q))return co(B.t("message.MoveOutsideBoundaryCancelled",A)),!1}return!0},M=G=>{switch(G.type){case z.Roof:case z.Door:case z.Window:return!1;case z.SolarPanel:case z.Sensor:case z.Light:{const Q=G;return Q.parentType===z.Wall||Q.parentType===z.Roof?!1:Q.parentType===z.Cuboid?Q.rotation[2]===1:!0}case z.Wall:{const Q=G;return!(Q.leftJoints.length!==0||Q.rightJoints.length!==0)}default:return!0}},D=(G,Q)=>{switch(G){case z.Foundation:case z.Cuboid:return Q===z.Foundation||Q===z.Cuboid;default:return Q!==z.Foundation&&Q!==z.Cuboid}},k=G=>{const Q=H.getState().elements.filter(ae=>Cd(ae)&&ae.parentId===rr),oe=new Set(G.map(ae=>ae.id)),ee=new Map;for(const ae of Q){const Z=ye.fetchFoundationVertexCoordinates(ae);ee.set(ae.id,Z)}const q=ae=>{for(const Z of Q)!oe.has(Z.id)&&ye.areBasesOverlapped(ae.id,Z.id,ee)&&(oe.add(Z.id),G.push(Z),Z.enableGroupMaster&&q(Z))};for(const ae of G)ae.enableGroupMaster&&q(ae)},N=()=>{const G=[],Q=H.getState().selectedElementIdSet,oe=s();if(!oe||Q.size===0)return G;if(oe){const ee=oe.type,q=oe.parentId,ae=H.getState().elements.filter(Z=>D(ee,Z.type)&&M(Z)&&Z.parentId===q&&Q.has(Z.id));G.push(...ae),Cd(oe)&&G.length>0&&q===rr&&k(G)}return G},U=(G,Q,oe,ee)=>{switch(ee){case Sl.Left:return[G-oe,Q];case Sl.Right:return[G+oe,Q];case Sl.Up:return[G,Q+oe];case Sl.Down:return[G,Q-oe]}},W=(G,Q)=>{e(oe=>{var q,ae;let ee=!1;for(const Z of oe.elements)if(G.has(Z.id)){const ne=G.get(Z.id);if(ne!==void 0){const[te,$]=U(Z.cx,Z.cy,ne,Q);if(Z.type===z.Wall){const le=Z,de=new ue(te-le.cx,$-le.cy),he=new ue().fromArray(le.leftPoint).setZ(0).add(de),me=new ue().fromArray(le.rightPoint).setZ(0).add(de);le.leftPoint=he.toArray(),le.rightPoint=me.toArray(),ee=!0}Z.cx=te,Z.cy=$}}else oe.selectedElementIdSet.has(Z.id)&&oe.selectedElementIdSet.delete(Z.id);((q=oe.selectedElement)==null?void 0:q.type)===z.Cuboid||((ae=oe.selectedElement)==null?void 0:ae.type)===z.Foundation?oe.groupActionUpdateFlag=!oe.groupActionUpdateFlag:ee&&(oe.updateWallMapOnFoundationFlag=!oe.updateWallMapOnFoundationFlag)})},F=(G,Q)=>{e(oe=>{for(const ee of oe.elements)(ye.isFoundationOrCuboid(ee)||ye.isPlantOrHuman(ee)&&ee.parentId===rr)&&([ee.cx,ee.cy]=U(ee.cx,ee.cy,G,Q))})},E=G=>G===Sl.Left?Sl.Right:G===Sl.Right?Sl.Left:G===Sl.Up?Sl.Down:G===Sl.Down?Sl.Up:(console.error("Undo direction is possibly incorrect:",G),G),L=(G,Q)=>{if(!l)return;const oe=N(),ee=s(),q=Q*P;if(ee&&oe.length>0){const ae=new Map;for(const ne of oe)switch(ne.type){case z.Foundation:case z.Cuboid:case z.Wall:case z.Tree:case z.Flower:case z.Human:{ae.set(ne.id,q);break}case z.Light:case z.Sensor:{const te=p(ee);if(te){let $=q/te.lx;const[le,de]=U(ne.cx,ne.cy,$,G),he=ne.lx/(2*te.lx),me=ne.lx/(2*te.ly);switch(G){case Sl.Left:case Sl.Right:{const ce=ye.clamp(le,-.5+he,.5-he);$=Math.abs(ce-ee.cx);break}case Sl.Up:case Sl.Down:{const ce=ye.clamp(de,-.5+me,.5-me);$=Math.abs(ce-ee.cy);break}}ae.set(ne.id,$)}break}case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:{const te=p(ne);if(te){let $=!0,le=q;switch(G){case Sl.Left:case Sl.Right:{le=q/te.lx;break}case Sl.Up:case Sl.Down:{le=q/te.ly;break}}if(ne.type===z.SolarPanel){const[de,he]=U(ne.cx,ne.cy,le,G);$=R(ne,de,he)}if($)ae.set(ne.id,le);else return}break}}W(ae,G);const Z={name:`Move Selected Elements ${G} By Key`,timestamp:Date.now(),direction:G,movedElementsDisplacementMap:new Map(ae),undo:()=>{const ne=E(Z.direction);W(Z.movedElementsDisplacementMap,ne)},redo:()=>{W(Z.movedElementsDisplacementMap,Z.direction)}};a(Z)}else{F(q,G);const ae={name:`Move All ${G} By Key`,timestamp:Date.now(),direction:G,displacement:q,undo:()=>{const Z=E(ae.direction);F(ae.displacement,Z)},redo:()=>{F(ae.displacement,ae.direction)}};a(ae)}},j=G=>{H.getState().set(Q=>{Q.multiSelectionsMode=G})},Y=G=>{const Q=s(),oe=1;switch(G){case"left":L(Sl.Left,oe);break;case"shift+left":L(Sl.Left,oe/W9);break;case"ctrl+shift+left":case"meta+shift+left":L(Sl.Left,oe*W9);break;case"right":L(Sl.Right,oe);break;case"shift+right":L(Sl.Right,oe/W9);break;case"ctrl+shift+right":case"meta+shift+right":L(Sl.Right,oe*W9);break;case"down":L(Sl.Down,oe);break;case"shift+down":L(Sl.Down,oe/W9);break;case"ctrl+shift+down":case"meta+shift+down":L(Sl.Down,oe*W9);break;case"up":L(Sl.Up,oe);break;case"shift+up":L(Sl.Up,oe/W9);break;case"ctrl+shift+up":case"meta+shift+up":L(Sl.Up,oe*W9);break;case"ctrl+[":case"meta+[":UJ(.9);break;case"ctrl+]":case"meta+]":UJ(1.1);break;case"ctrl+c":case"meta+c":Q&&Q.type!==z.Roof&&(u(Q.id),e(ee=>{ee.selectedElementIdSet.clear(),ee.selectedElementIdSet.add(Q.id)}),n&&e(ee=>{ee.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:Q.id,elementType:Q.type}}));break;case"ctrl+x":case"meta+x":if(!Q||Q.type===z.Roof)break;if(Q.locked)yn(B.t("message.ThisElementIsLocked",A));else{const ee=S(Q.id,!0);if(ee.length===0)break;if(ye.isElementTriggerAutoDeletion(Q))jn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",Q.id);else{const q={name:"Cut",timestamp:Date.now(),deletedElements:ee,selectedElementId:Q.id,undo:()=>{const ae=q.deletedElements;if(ae.length===0)return;const Z=ae.find(ne=>ne.id===q.selectedElementId);Z&&e(ne=>{if(ne.elements.push(...ae),ne.selectedElementIdSet.clear(),ne.selectedElementIdSet.add(Z.id),ne.selectedElement=Z,Z.type===z.Wall){const te=Z;let $=null,le=null;if(te.leftJoints.length>0&&($=te.leftJoints[0]),te.rightJoints.length>0&&(le=te.rightJoints[0]),$||le)for(const de of ne.elements)de.id===$&&de.type===z.Wall&&(de.rightJoints[0]=te.id),de.id===le&&de.type===z.Wall&&(de.leftJoints[0]=te.id)}})},redo:()=>{q.deletedElements&&q.deletedElements.length>0&&S(q.deletedElements[0].id,!0)}};a(q)}}break;case"ctrl+v":case"meta+v":{const ee=f();if(ee.length>0){const q={name:"Paste by Key",timestamp:Date.now(),pastedElements:JSON.parse(JSON.stringify(ee)),undo:()=>{for(const ae of q.pastedElements)d(ae.id,!1)},redo:()=>{e(ae=>{ae.elements.push(...q.pastedElements),ae.selectedElement=q.pastedElements[0]})}};a(q)}break}case"ctrl+alt+h":case"ctrl+home":{if(!l){const ee=H.getState().viewState.cameraPosition,q=H.getState().viewState.panCenter;if(ee[0]!==ee[1]||ee[1]!==ee[2]||ee[0]!==ee[2]||q[0]!==0||q[1]!==0||q[2]!==0){const ae={name:"Reset View",timestamp:Date.now(),oldCameraPosition:[...ee],oldPanCenter:[...q],undo:()=>{const Z=jn.getState().orbitControlsRef;Z!=null&&Z.current&&(Z.current.object.position.set(ae.oldCameraPosition[0],ae.oldCameraPosition[1],ae.oldCameraPosition[2]),Z.current.target.set(ae.oldPanCenter[0],ae.oldPanCenter[1],ae.oldPanCenter[2]),Z.current.update(),e(ne=>{const te=ne.viewState;te.cameraPosition=[...ae.oldCameraPosition],te.panCenter=[...ae.oldPanCenter]}))},redo:()=>{NJ()}};a(ae),e(Z=>{Z.objectTypeToAdd=z.None,Z.groupActionMode=!1,Z.viewState.orthographic=!1}),NJ()}}break}case"f2":case"ctrl+b":case"meta+b":v();break;case"ctrl+u":case"meta+u":b();break;case"f4":case"ctrl+m":case"meta+m":T();break;case"ctrl+f":case"meta+f":dt.getState().set(ee=>{ee.createNewFileFlag=!0,ee.openModelsMap=!1}),e(ee=>{ee.objectTypeToAdd=z.None,ee.groupActionMode=!1,window.history.pushState({},document.title,k1),n&&C("Create New File")});break;case"ctrl+s":case"meta+s":dt.getState().set(ee=>{ee.saveLocalFileDialogVisible=!0}),n&&C("Save Local File");break;case"ctrl+shift+o":case"meta+shift+o":dt.getState().set(ee=>{ee.listCloudFilesFlag=!0,ee.openModelsMap=!1}),n&&C("List Cloud Files");break;case"ctrl+shift+s":case"meta+shift+s":dt.getState().setSaveCloudFileFlag(!0),n&&C("Save Cloud File");break;case"alt+backspace":case"backspace":case"delete":{const ee=H.getState().selectedElementIdSet;if(!Q||ee.size===0)break;const q=H.getState().removeSelectedElements();if(q.length===0)break;if((()=>{const Z=q.filter($=>$.type===z.Foundation),ne=new Set(Z.map($=>$.id));return!!q.find($=>!ne.has($.parentId)&&ye.isElementTriggerAutoDeletion($))})())jn.getState().setListenToAutoDeletionByDelete(!0),dt.getState().setPrimitiveStore("selectedElementId",Q.id);else{if(q.length===1){const Z={name:"Delete",timestamp:Date.now(),deletedElements:[...q],selectedElementId:Q.id,undo:()=>{const ne=Z.deletedElements;if(!ne||ne.length===0)return;const te=ne.find($=>$.id===Z.selectedElementId);if(te&&(e($=>{$.elements.push(...ne),$.selectedElementIdSet.clear(),$.selectedElementIdSet.add(te.id),$.selectedElement=te,$.updateWallMapOnFoundationFlag=!$.updateWallMapOnFoundationFlag,$.deletedRoofId=null,$.deletedRoofIdSet.clear()}),te.type===z.Wall)){const $=te;$.leftJoints.length>0&&y($.leftJoints[0],[$.id]),$.rightJoints.length>0&&m($.rightJoints[0],[$.id])}},redo:()=>{const ne=Z.deletedElements;if(!ne||ne.length===0)return;const te=ne.find($=>$.id===Z.selectedElementId);te&&S(te.id,!1)}};a(Z)}else{const Z={name:"Delete Multiple",timestamp:Date.now(),deletedElements:[...q],selectedElementId:Q.id,selectedElementIdSet:new Set(ee),undo(){const ne=this.deletedElements;if(!ne||ne.length===0)return;const te=ne.find($=>$.id===this.selectedElementId);if(te){e($=>{$.elements.push(...ne),$.selectedElement=te,$.selectedElementIdSet=new Set(this.selectedElementIdSet),$.updateWallMapOnFoundationFlag=!$.updateWallMapOnFoundationFlag,$.deletedRoofId=null,$.deletedRoofIdSet.clear()});for(const $ of this.deletedElements)if($.type===z.Wall){const le=$;le.leftJoints.length>0&&y(le.leftJoints[0],[le.id]),le.rightJoints.length>0&&m(le.rightJoints[0],[le.id])}}},redo(){e(ne=>{ne.selectedElement=ne.elements.find(te=>te.id===this.selectedElementId)??null,ne.selectedElementIdSet=new Set(this.selectedElementIdSet)}),H.getState().removeSelectedElements()}};a(Z)}e(Z=>{Z.selectedElement=null,Z.selectedElementIdSet.clear()})}break}case"ctrl+z":case"meta+z":if(i.hasUndo()){const ee=i.undo();ee&&(Dp.destroy(),yn(B.t("menu.edit.Undo",A)+": "+ee,Ob)),H.getState().groupActionMode&&e(q=>{q.groupActionUpdateFlag=!q.groupActionUpdateFlag}),n&&C("Undo")}break;case"ctrl+y":case"meta+y":if(i.hasRedo()){const ee=i.redo();ee&&(Dp.destroy(),yn(B.t("menu.edit.Redo",A)+": "+ee,Ob)),H.getState().groupActionMode&&e(q=>{q.groupActionUpdateFlag=!q.groupActionUpdateFlag}),n&&C("Redo")}break;case"shift":H.getState().viewState.navigationView&&dt.getState().set(ee=>{ee.navigationMoveSpeed=5*H.getState().minimumNavigationMoveSpeed,ee.navigationTurnSpeed=5*H.getState().minimumNavigationTurnSpeed}),w(!0);break;case"esc":{const ee=H.getState().addedFoundationId,q=H.getState().addedCuboidId,ae=H.getState().addedWallId,Z=H.getState().addedWindowId,ne=H.getState().addedDoorId;ee?d(ee,!1):q?d(q,!1):ae?d(ae,!1):Z?(d(Z,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",Z)):ne&&(d(ne,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",ne)),e(te=>{te.objectTypeToAdd=z.None,te.actionModeLock=!1,te.moveHandleType=null,te.resizeHandleType=null,te.groupActionMode=!1}),jn.getState().setEnableOrbitController(!0),o();break}case"ctrl":{j(!0);break}}},O=G=>{switch(G){case"shift":H.getState().viewState.navigationView&&dt.getState().set(Q=>{Q.navigationMoveSpeed=H.getState().minimumNavigationMoveSpeed,Q.navigationTurnSpeed=H.getState().minimumNavigationTurnSpeed}),w(!1);break;case"ctrl+o":case"meta+o":H.getState().localFileDialogRequested||(dt.getState().set(Q=>{Q.openLocalFileFlag=!0}),e(Q=>{Q.localFileDialogRequested=!0,n&&Q.logAction("Open Local File")}));break;case"ctrl":{j(!1);break}}};g.useEffect(()=>()=>{_.current=null},[]);const _=g.useRef(null);return h.jsxs(h.Fragment,{children:[h.jsx(mge,{handleFocusableElements:!1,handleKeys:cLe,handleEventType:"keydown",onKeyEvent:(G,Q)=>{Q.preventDefault(),_.current!==G&&(_.current=G,Y(G))}}),h.jsx(mge,{handleFocusableElements:!1,handleKeys:cLe,handleEventType:"keyup",onKeyEvent:(G,Q)=>{Q.preventDefault(),_.current=null,O(G)}}),h.jsx(MMo,{})]})}),zMo="/aladdin/assets/cloud-B68yt6QG.png",DMo=xe.memo(()=>{const t=H(pn),e=H(gPt),{scene:n}=ti();g.useEffect(()=>{const r=n.children.filter(l=>l.name==="Content"),i=[];if(r.length>0){const l=r[0].children;for(const s of l)o(s,i)}const a=[];for(const l of i)a.push(new Cf().setFromObject(l));if(a.length>0){const l=new ue,s=new ue;for(const u of a)l.min(u.min),s.max(u.max);let c=Math.abs(l.x);c{u.aabb=new Cf(l,s),!isNaN(c)&&isFinite(c)&&(u.sceneRadius=Math.round(Math.max(10,c*1.25)))})}},[e]);const o=(r,i)=>{if(r.userData.aabb&&i.push(r),r.children.length>0)for(const a of r.children)o(a,i)};return h.jsx(h.Fragment,{})}),yge=t=>{const e=new ue().subVectors(t.localToWorld(new ue(0,0,1e3)),t.position);return e.x===0&&e.y===0&&t.getWorldDirection(e),e},eC=t=>{const e=document.getElementById("compassCanvas"),n=o=>{dt.getState().set(r=>{r.isCameraUnderGround=o})};if(e){const o=yge(t).normalize(),i=(Math.atan2(o.y,o.x)+Math.PI/2)/Math.PI*180;e.style.transform=`rotate(${i}deg)`;const a=t.position.z<.001;a&&!dt.getState().isCameraUnderGround?n(!0):!a&&dt.getState().isCameraUnderGround&&n(!1)}},EMo=xe.memo(()=>{const t=H(pn),e=H(M0),n=H(lSt),o=H(zGe),r=H(OM),i=H(Ky),a=H(sSt),l=H(cSt),s=H(aQ)??pL,c=H(iQ),u=dt(wTt),d=dt(xTt),f=H(eXe),p=dt(aXe),m=c&&!e,y=Math.hypot(a[0],a[1],a[2]),w=(e?l*50:y*10)*i,x=g.useMemo(()=>new ue(-w,-w,0),[w]),C=g.useMemo(()=>new ue(w,w,w/2),[w]),{gl:P,invalidate:A,get:S,set:v,camera:b}=ti(),T=g.useMemo(()=>{const L=S().camera;return L.up.set(0,0,1),L},[]),R=g.useMemo(()=>P.domElement,[]),M=g.useRef(null),D=g.useRef(null),k=g.useRef(null);g.useEffect(()=>{jn.setState({canvas:{gl:P,camera:b}}),!e&&D.current&&jn.setState({canvas:{gl:P,camera:D.current}})},[e]),g.useEffect(()=>{H.getState().viewState.cameraPosition2D[2]<100&&t(L=>{L.viewState.cameraPosition2D[2]=150})},[]),g.useEffect(()=>{M&&M.current&&jn.setState({orbitControlsRef:M})},[]),g.useEffect(()=>{M.current&&(M.current.addEventListener("change",N),M.current.addEventListener("start",U),M.current.addEventListener("end",W));const L=M.current;return()=>{L&&(L.removeEventListener("change",N),L.removeEventListener("start",U),L.removeEventListener("end",W))}},[m]),g.useEffect(()=>{const L=H.getState().viewState;if(M.current){if(D.current){if(m){const j=S().camera,Y=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(Y),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"])}else{const j=F(L.cameraPosition??[0,0,20]),Y=F(L.panCenter??[0,0,0]);D.current.position.copy(j),D.current.lookAt(Y),D.current.zoom=1,e||(M.current.object=D.current,M.current.target.copy(Y))}b.updateMatrixWorld(),eC(S().camera)}if(k.current){const j=F(L.cameraPosition2D??[0,0,1e3]).setZ(1e3),Y=F(L.panCenter2D??[0,0,0]);k.current.position.copy(j),k.current.rotation.set(0,0,0),k.current.lookAt(Y),k.current.zoom=L.cameraZoom,e&&(M.current.object=k.current,M.current.target.copy(Y))}}},[r]),g.useEffect(()=>{if(!k.current||!D.current||!M.current)return;const L=H.getState().viewState,j=M.current,Y=k.current,O=D.current;e?(Y.rotation.set(0,0,0),j.object=Y,j.target.copy(F(L.panCenter2D??[0,0,0])),v({camera:Y})):(j.object=O,j.target.copy(F(L.panCenter??[0,0,0])),v({camera:O}),eC(S().camera))},[e]),g.useEffect(()=>{e&&M.current&&(k.current&&(k.current.zoom=l,M.current.object=k.current),N(),M.current.update())},[l]);const N=()=>{A(),H.getState().viewState.orthographic||(eC(S().camera),M.current&&M.current.target.clamp(x,C))},U=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!0})},W=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!1}),t(L=>{if(!M.current)return;const j=L.viewState,Y=S().camera,O=Y.position,_=M.current.target;j.orthographic?(Y.zoom&&!isNaN(Y.zoom)?j.cameraZoom=Y.zoom:j.cameraZoom=20,j.cameraPosition2D=[O.x,O.y,150],j.panCenter2D=[_.x,_.y,_.z]):m?(j.cameraPositionNav=[O.x,O.y,O.z],j.cameraRotationNav=[Y.rotation.x,Y.rotation.y,Y.rotation.z],L.cameraDirection=yge(Y)):(j.cameraPosition=[O.x,O.y,O.z],j.panCenter=[_.x,_.y,_.z],L.cameraDirection=yge(Y))})},F=L=>L&&Array.isArray(L)?new ue(L[0],L[1],L[2]):L&&L.x!==null?new ue(L.x,L.y,L.z):new ue(0,0,5);Gp(()=>{o&&M.current&&M.current.update()});const E=jn(L=>L.compassRef);return g.useEffect(()=>{eC(S().camera)},[E]),g.useEffect(()=>{M.current&&(m&&!p&&!f?M.current.listenToKeyEvents(window):M.current.removeKeyEvents())},[m,p,f]),g.useEffect(()=>{if(!M.current)return;const L=H.getState().viewState;if(m){const j=S().camera,Y=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(Y),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"]),j.updateMatrixWorld(),eC(S().camera)}else if(M.current&&D.current){const j=F(L.cameraPosition??[0,0,20]),Y=F(L.panCenter??[0,0,0]);D.current.position.copy(j),D.current.lookAt(Y),D.current.zoom=1,e||(M.current.object=D.current,M.current.target.copy(Y)),D.current.updateMatrixWorld(),eC(D.current)}A()},[m]),h.jsxs(h.Fragment,{children:[h.jsx(Ybt,{ref:D,fov:uVe,far:s,up:[0,0,1]}),h.jsx(jbt,{ref:k,up:[0,0,1]}),h.jsx("myOrbitControls",{ref:M,args:[T,R],autoRotate:o,enableRotate:n,enablePan:!0,enableZoom:!0,enableDamping:!1,maxAzimuthAngle:1/0,minAzimuthAngle:-1/0,maxPolarAngle:$t,minPolarAngle:0,moveSpeed:u??3,turnSpeed:d??3})]})});var Age={exports:{}},wge={exports:{}},bW=1e3,SW=bW*60,TW=SW*60,PW=TW*24,kMo=PW*365.25,FMo=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return LMo(t);if(n==="number"&&isNaN(t)===!1)return e.long?NMo(t):WMo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function LMo(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),o=(e[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*kMo;case"days":case"day":case"d":return n*PW;case"hours":case"hour":case"hrs":case"hr":case"h":return n*TW;case"minutes":case"minute":case"mins":case"min":case"m":return n*SW;case"seconds":case"second":case"secs":case"sec":case"s":return n*bW;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function WMo(t){return t>=PW?Math.round(t/PW)+"d":t>=TW?Math.round(t/TW)+"h":t>=SW?Math.round(t/SW)+"m":t>=bW?Math.round(t/bW)+"s":t+"ms"}function NMo(t){return hV(t,PW,"day")||hV(t,TW,"hour")||hV(t,SW,"minute")||hV(t,bW,"second")||t+" ms"}function hV(t,e,n){if(!(t=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}};function r(c){var u=this.useColors;if(c[0]=(u?"%c":"")+this.namespace+(u?" %c":" ")+c[0]+(u?"%c ":" ")+"+"+e.humanize(this.diff),!!u){var d="color: "+this.color;c.splice(1,0,d,"color: inherit");var f=0,p=0;c[0].replace(/%[a-zA-Z%]/g,function(m){m!=="%%"&&(f++,m==="%c"&&(p=f))}),c.splice(p,0,d)}}function i(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(c){try{c==null?e.storage.removeItem("debug"):e.storage.debug=c}catch{}}function l(){var c;try{c=e.storage.debug}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}e.enable(l());function s(){try{return window.localStorage}catch{}}})(Age,Age.exports);var jMo=Age.exports,uLe=jMo("jsonp"),BMo=_Mo,YMo=0;function OMo(){}function _Mo(t,e,n){typeof e=="function"&&(n=e,e={}),e||(e={});var o=e.prefix||"__jp",r=e.name||o+YMo++,i=e.param||"callback",a=e.timeout!=null?e.timeout:6e4,l=encodeURIComponent,s=document.getElementsByTagName("script")[0]||document.head,c,u;a&&(u=setTimeout(function(){d(),n&&n(new Error("Timeout"))},a));function d(){c.parentNode&&c.parentNode.removeChild(c),window[r]=OMo,u&&clearTimeout(u)}function f(){window[r]&&d()}return window[r]=function(p){uLe("jsonp got",p),d(),n&&n(null,p)},t+=(~t.indexOf("?")?"&":"?")+i+"="+l(r),t=t.replace("?&","?"),uLe('jsonp req "%s"',t),c=document.createElement("script"),c.src=t,s.parentNode.insertBefore(c,s),f}const uT=ji(BMo);var VMo=Object.defineProperty,GMo=Object.defineProperties,XMo=Object.getOwnPropertyDescriptors,QK=Object.getOwnPropertySymbols,nft=Object.prototype.hasOwnProperty,oft=Object.prototype.propertyIsEnumerable,dLe=(t,e,n)=>e in t?VMo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$g=(t,e)=>{for(var n in e||(e={}))nft.call(e,n)&&dLe(t,n,e[n]);if(QK)for(var n of QK(e))oft.call(e,n)&&dLe(t,n,e[n]);return t},ioe=(t,e)=>GMo(t,XMo(e)),aoe=(t,e)=>{var n={};for(var o in t)nft.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&QK)for(var o of QK(t))e.indexOf(o)<0&&oft.call(t,o)&&(n[o]=t[o]);return n};function V7(t){return n=>{var o=n,{bgStyle:r={},borderRadius:i=0,iconFillColor:a="white",round:l=!1,size:s=64}=o,c=aoe(o,["bgStyle","borderRadius","iconFillColor","round","size"]);return h.jsxs("svg",ioe($g({viewBox:"0 0 64 64",width:s,height:s},c),{children:[l?h.jsx("circle",{cx:"32",cy:"32",r:"32",fill:t.color,style:r}):h.jsx("rect",{width:"64",height:"64",rx:i,ry:i,fill:t.color,style:r}),h.jsx("path",{d:t.path,fill:a})]}))}}const JMo=V7({color:"#7f7f7f",path:"M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z"}),KMo=JMo;function lc(t){const e=Object.entries(t).filter(([,n])=>n!=null).map(([n,o])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);return e.length>0?`?${e.join("&")}`:""}const $Mo=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",qMo=(t,e)=>({left:window.outerWidth/2+(window.screenX||window.screenLeft||0)-t/2,top:window.outerHeight/2+(window.screenY||window.screenTop||0)-e/2}),QMo=(t,e)=>({top:(window.screen.height-e)/2,left:(window.screen.width-t)/2});function ZMo(t,e,n){var o=e,{height:r,width:i}=o,a=aoe(o,["height","width"]);const l=$g({height:r,width:i,location:"no",toolbar:"no",status:"no",directories:"no",menubar:"no",scrollbars:"yes",resizable:"no",centerscreen:"yes",chrome:"yes"},a),s=window.open(t,"",Object.keys(l).map(c=>`${c}=${l[c]}`).join(", "));if(n){const c=window.setInterval(()=>{try{(s===null||s.closed)&&(window.clearInterval(c),n(s))}catch(u){console.error(u)}},1e3)}return s}function eIo(t){var e=t,{beforeOnClick:n,children:o,className:r,disabled:i,disabledStyle:a={opacity:.6},forwardedRef:l,htmlTitle:s,networkLink:c,networkName:u,onClick:d,onShareWindowClose:f,openShareDialogOnClick:p=!0,opts:m,resetButtonStyle:y=!0,style:w,url:x,windowHeight:C=400,windowPosition:P="windowCenter",windowWidth:A=550}=e,S=aoe(e,["beforeOnClick","children","className","disabled","disabledStyle","forwardedRef","htmlTitle","networkLink","networkName","onClick","onShareWindowClose","openShareDialogOnClick","opts","resetButtonStyle","style","url","windowHeight","windowPosition","windowWidth"]);const v=async R=>{const M=c(x,m);if(!i){if(R.preventDefault(),n){const D=n();$Mo(D)&&await D}if(p){const D=$g({height:C,width:A},P==="windowCenter"?qMo(A,C):QMo(A,C));ZMo(M,D,f)}d&&d(R,M)}},b=Bn("react-share__ShareButton",{"react-share__ShareButton--disabled":!!i,disabled:!!i},r),T=$g($g(y?{backgroundColor:"transparent",border:"none",padding:0,font:"inherit",color:"inherit",cursor:"pointer"}:{},w),i&&a);return h.jsx("button",ioe($g({},S),{className:b,onClick:v,ref:l,style:T,title:s,children:o}))}function Nu(t,e,n,o){function r(i,a){const l=n(i),s=$g({},i);return Object.keys(l).forEach(u=>{delete s[u]}),h.jsx(eIo,ioe($g($g({},o),s),{forwardedRef:a,networkName:t,networkLink:e,opts:n(i)}))}return r.displayName=`ShareButton-${t}`,g.forwardRef(r)}function tIo(t,{subject:e,body:n,separator:o}){return"mailto:"+lc({subject:e,body:n?n+o+t:t})}const nIo=Nu("email",tIo,t=>({subject:t.subject,body:t.body,separator:t.separator||" "}),{openShareDialogOnClick:!1,onClick:(t,e)=>{window.location.href=e}}),oIo=nIo,rIo=V7({color:"#0965FE",path:"M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z"}),iIo=rIo;function aIo(t,{appId:e,redirectUri:n,to:o}){return"https://www.facebook.com/dialog/send"+lc({link:t,redirect_uri:n||t,app_id:e,to:o})}Nu("facebookmessenger",aIo,t=>({appId:t.appId,redirectUri:t.redirectUri,to:t.to}),{windowWidth:1e3,windowHeight:820});class lIo extends Error{constructor(e){super(e),this.name="AssertionError"}}function gu(t,e){if(!t)throw new lIo(e)}function sIo(t,{hashtag:e}){return gu(t,"facebook.url"),"https://www.facebook.com/sharer/sharer.php"+lc({u:t,hashtag:e})}const cIo=Nu("facebook",sIo,t=>({hashtag:t.hashtag}),{windowWidth:550,windowHeight:400}),uIo=cIo;function dIo(){const t=g.useRef(!1);return g.useEffect(()=>(t.current=!0,()=>{t.current=!1}),[]),g.useCallback(()=>t.current,[])}function fIo(t){var e=t,{children:n=f=>f,className:o,getCount:r,url:i}=e,a=aoe(e,["children","className","getCount","url"]);const l=dIo(),[s,c]=g.useState(void 0),[u,d]=g.useState(!1);return g.useEffect(()=>{d(!0),r(i,f=>{l()&&(c(f),d(!1))})},[i]),h.jsx("span",ioe($g({className:Bn("react-share__ShareCount",o)},a),{children:!u&&s!==void 0&&n(s)}))}function dT(t){const e=n=>h.jsx(fIo,$g({getCount:t},n));return e.displayName=`ShareCount(${t.name})`,e}function hIo(t,e){const n=`https://graph.facebook.com/?id=${t}&fields=og_object{engagement}`;uT(n,(o,r)=>{e(!o&&r&&r.og_object&&r.og_object.engagement?r.og_object.engagement.count:void 0)})}dT(hIo);function pIo(t,{title:e}){return gu(t,"hatena.url"),`http://b.hatena.ne.jp/add?mode=confirm&url=${t}&title=${e}`}Nu("hatena",pIo,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"});function gIo(t,e){uT("https://bookmark.hatenaapis.com/count/entry"+lc({url:t}),(o,r)=>{e(r??void 0)})}dT(gIo);function mIo(t,{title:e,description:n}){return gu(t,"instapaper.url"),"http://www.instapaper.com/hello2"+lc({url:t,title:e,description:n})}Nu("instapaper",mIo,t=>({title:t.title,description:t.description}),{windowWidth:500,windowHeight:500,windowPosition:"windowCenter"});const yIo=V7({color:"#00b800",path:"M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z"}),AIo=yIo;function wIo(t,{title:e}){return gu(t,"line.url"),"https://social-plugins.line.me/lineit/share"+lc({url:t,text:e})}const xIo=Nu("line",wIo,t=>({title:t.title}),{windowWidth:500,windowHeight:500}),vIo=xIo,bIo=V7({color:"#0077B5",path:"M20.4,44h5.4V26.6h-5.4V44z M23.1,18c-1.7,0-3.1,1.4-3.1,3.1c0,1.7,1.4,3.1,3.1,3.1 c1.7,0,3.1-1.4,3.1-3.1C26.2,19.4,24.8,18,23.1,18z M39.5,26.2c-2.6,0-4.4,1.4-5.1,2.8h-0.1v-2.4h-5.2V44h5.4v-8.6 c0-2.3,0.4-4.5,3.2-4.5c2.8,0,2.8,2.6,2.8,4.6V44H46v-9.5C46,29.8,45,26.2,39.5,26.2z"}),SIo=bIo;function TIo(t,{title:e,summary:n,source:o}){return gu(t,"linkedin.url"),"https://linkedin.com/shareArticle"+lc({url:t,mini:"true",title:e,summary:n,source:o})}const PIo=Nu("linkedin",TIo,({title:t,summary:e,source:n})=>({title:t,summary:e,source:n}),{windowWidth:750,windowHeight:600}),CIo=PIo;function RIo(t,{title:e,description:n}){return gu(t,"livejournal.url"),"https://www.livejournal.com/update.bml"+lc({subject:e,event:n})}Nu("livejournal",RIo,t=>({title:t.title,description:t.description}),{windowWidth:660,windowHeight:460});function HIo(t,{title:e,description:n,imageUrl:o}){return gu(t,"mailru.url"),"https://connect.mail.ru/share"+lc({url:t,title:e,description:n,image_url:o})}Nu("mailru",HIo,t=>({title:t.title,description:t.description,imageUrl:t.imageUrl}),{windowWidth:660,windowHeight:460});function MIo(t,{title:e,description:n,image:o}){return gu(t,"ok.url"),"https://connect.ok.ru/offer"+lc({url:t,title:e,description:n,imageUrl:o})}Nu("ok",MIo,t=>({title:t.title,description:t.description,image:t.image}),{windowWidth:588,windowHeight:480,windowPosition:"screenCenter"});function IIo(t,e){window.OK||(window.OK={Share:{count:function(i,a){var l,s;(s=(l=window.OK.callbacks)[i])==null||s.call(l,a)}},callbacks:[]});const n="https://connect.ok.ru/dk",o=window.OK.callbacks.length;return window.ODKL={updateCount(r,i){var a,l;const s=r===""?0:parseInt(r.replace("react-share-",""),10);(l=(a=window.OK.callbacks)[s])==null||l.call(a,i===""?void 0:parseInt(i,10))}},window.OK.callbacks.push(e),uT(n+lc({"st.cmd":"extLike",uid:`react-share-${o}`,ref:t}))}dT(IIo);function zIo(t,{media:e,description:n,pinId:o}){return o?`https://pinterest.com/pin/${o}/repin/x/`:(gu(t,"pinterest.url"),gu(e,"pinterest.media"),"https://pinterest.com/pin/create/button/"+lc({url:t,media:e,description:n}))}Nu("pinterest",zIo,t=>({media:t.media,description:t.description,pinId:t.pinId}),{windowWidth:1e3,windowHeight:730});function DIo(t,e){uT("https://api.pinterest.com/v1/urls/count.json"+lc({url:t}),(o,r)=>{e(r?r.count:void 0)})}dT(DIo);function EIo(t,{title:e}){return gu(t,"pocket.url"),"https://getpocket.com/save"+lc({url:t,title:e})}Nu("pocket",EIo,t=>({title:t.title}),{windowWidth:500,windowHeight:500});const kIo=V7({color:"#FF5700",path:"M 53.34375 32 C 53.277344 30.160156 52.136719 28.53125 50.429688 27.839844 C 48.722656 27.148438 46.769531 27.523438 45.441406 28.800781 C 41.800781 26.324219 37.519531 24.957031 33.121094 24.863281 L 35.199219 14.878906 L 42.046875 16.320312 C 42.214844 17.882812 43.496094 19.09375 45.066406 19.171875 C 46.636719 19.253906 48.03125 18.183594 48.359375 16.644531 C 48.6875 15.105469 47.847656 13.558594 46.382812 12.992188 C 44.914062 12.425781 43.253906 13.007812 42.464844 14.367188 L 34.625 12.800781 C 34.363281 12.742188 34.09375 12.792969 33.871094 12.9375 C 33.648438 13.082031 33.492188 13.308594 33.441406 13.566406 L 31.070312 24.671875 C 26.617188 24.738281 22.277344 26.105469 18.59375 28.609375 C 17.242188 27.339844 15.273438 26.988281 13.570312 27.707031 C 11.863281 28.429688 10.746094 30.089844 10.71875 31.941406 C 10.691406 33.789062 11.757812 35.484375 13.441406 36.257812 C 13.402344 36.726562 13.402344 37.195312 13.441406 37.664062 C 13.441406 44.832031 21.792969 50.65625 32.097656 50.65625 C 42.398438 50.65625 50.753906 44.832031 50.753906 37.664062 C 50.789062 37.195312 50.789062 36.726562 50.753906 36.257812 C 52.363281 35.453125 53.371094 33.800781 53.34375 32 Z M 21.34375 35.199219 C 21.34375 33.433594 22.777344 32 24.542969 32 C 26.3125 32 27.742188 33.433594 27.742188 35.199219 C 27.742188 36.96875 26.3125 38.398438 24.542969 38.398438 C 22.777344 38.398438 21.34375 36.96875 21.34375 35.199219 Z M 39.9375 44 C 37.664062 45.710938 34.871094 46.582031 32.03125 46.464844 C 29.191406 46.582031 26.398438 45.710938 24.128906 44 C 23.847656 43.65625 23.871094 43.15625 24.183594 42.839844 C 24.5 42.527344 25 42.503906 25.34375 42.785156 C 27.269531 44.195312 29.617188 44.90625 32 44.800781 C 34.386719 44.929688 36.746094 44.242188 38.6875 42.847656 C 39.042969 42.503906 39.605469 42.511719 39.953125 42.863281 C 40.296875 43.21875 40.289062 43.785156 39.9375 44.128906 Z M 39.359375 38.527344 C 37.59375 38.527344 36.160156 37.09375 36.160156 35.328125 C 36.160156 33.5625 37.59375 32.128906 39.359375 32.128906 C 41.128906 32.128906 42.558594 33.5625 42.558594 35.328125 C 42.59375 36.203125 42.269531 37.054688 41.65625 37.6875 C 41.046875 38.316406 40.203125 38.664062 39.328125 38.65625 Z M 39.359375 38.527344"}),FIo=kIo;function LIo(t,{title:e}){return gu(t,"reddit.url"),"https://www.reddit.com/web/submit"+lc({url:t,title:e})}const WIo=Nu("reddit",LIo,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"}),NIo=WIo;function UIo(t,{title:e}){return gu(t,"gab.url"),"https://gab.com/compose"+lc({url:t,text:e})}Nu("gab",UIo,t=>({title:t.title}),{windowWidth:660,windowHeight:640,windowPosition:"windowCenter"});function jIo(t,e){const n=`https://www.reddit.com/api/info.json?limit=1&url=${t}`;uT(n,{param:"jsonp"},(o,r)=>{e(!o&&r&&r.data&&r.data.children.length>0&&r.data.children[0].data.score?r.data.children[0].data.score:void 0)})}dT(jIo);const BIo=V7({color:"#25A3E3",path:"m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957"}),YIo=BIo;function OIo(t,{title:e}){return gu(t,"telegram.url"),"https://telegram.me/share/url"+lc({url:t,text:e})}const _Io=Nu("telegram",OIo,t=>({title:t.title}),{windowWidth:550,windowHeight:400}),VIo=_Io;function GIo(t,{title:e,caption:n,tags:o,posttype:r}){return gu(t,"tumblr.url"),"https://www.tumblr.com/widgets/share/tool"+lc({canonicalUrl:t,title:e,caption:n,tags:o,posttype:r})}Nu("tumblr",GIo,t=>({title:t.title,tags:(t.tags||[]).join(","),caption:t.caption,posttype:t.posttype||"link"}),{windowWidth:660,windowHeight:460});function XIo(t,e){return uT("https://api.tumblr.com/v2/share/stats"+lc({url:t}),(o,r)=>{e(!o&&r&&r.response?r.response.note_count:void 0)})}dT(XIo);function JIo(t,{title:e,via:n,hashtags:o=[],related:r=[]}){return gu(t,"twitter.url"),gu(Array.isArray(o),"twitter.hashtags is not an array"),gu(Array.isArray(r),"twitter.related is not an array"),"https://twitter.com/intent/tweet"+lc({url:t,text:e,via:n,hashtags:o.length>0?o.join(","):void 0,related:r.length>0?r.join(","):void 0})}const KIo=Nu("twitter",JIo,t=>({hashtags:t.hashtags,title:t.title,via:t.via,related:t.related}),{windowWidth:550,windowHeight:400}),$Io=KIo;function qIo(t,{title:e,separator:n}){return gu(t,"viber.url"),"viber://forward"+lc({text:e?e+n+t:t})}Nu("viber",qIo,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:660,windowHeight:460});function QIo(t,{title:e,image:n,noParse:o,noVkLinks:r}){return gu(t,"vk.url"),"https://vk.com/share.php"+lc({url:t,title:e,image:n,noparse:o?1:0,no_vk_links:r?1:0})}Nu("vk",QIo,t=>({title:t.title,image:t.image,noParse:t.noParse,noVkLinks:t.noVkLinks}),{windowWidth:660,windowHeight:460});function ZIo(t,e){window.VK||(window.VK={}),window.VK.Share={count:(r,i)=>{var a,l;return(l=(a=window.VK.callbacks)==null?void 0:a[r])==null?void 0:l.call(a,i)}},window.VK.callbacks=[];const n="https://vk.com/share.php",o=window.VK.callbacks.length;return window.VK.callbacks.push(e),uT(n+lc({act:"count",index:o,url:t}))}dT(ZIo);function ezo(t,{title:e,image:n}){return gu(t,"weibo.url"),"http://service.weibo.com/share/share.php"+lc({url:t,title:e,pic:n})}Nu("weibo",ezo,t=>({title:t.title,image:t.image}),{windowWidth:660,windowHeight:550,windowPosition:"screenCenter"});const tzo=V7({color:"#25D366",path:"m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915"}),nzo=tzo;function ozo(){return/(android|iphone|ipad|mobile)/i.test(navigator.userAgent)}function rzo(t,{title:e,separator:n}){return gu(t,"whatsapp.url"),"https://"+(ozo()?"api":"web")+".whatsapp.com/send"+lc({text:e?e+n+t:t})}const izo=Nu("whatsapp",rzo,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:550,windowHeight:400}),azo=izo;function lzo(t,{quote:e,hashtag:n}){return gu(t,"workplace.url"),"https://work.facebook.com/sharer.php"+lc({u:t,quote:e,hashtag:n})}Nu("workplace",lzo,t=>({quote:t.quote,hashtag:t.hashtag}),{windowWidth:550,windowHeight:400});const szo=V7({color:"#000000",path:"M 41.116 18.375 h 4.962 l -10.8405 12.39 l 12.753 16.86 H 38.005 l -7.821 -10.2255 L 21.235 47.625 H 16.27 l 11.595 -13.2525 L 15.631 18.375 H 25.87 l 7.0695 9.3465 z m -1.7415 26.28 h 2.7495 L 24.376 21.189 H 21.4255 z"}),czo=szo,uzo=ko.div` +#`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(t)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(t,e=b7){this.fullscreenMaterial.depthBuffer=t,this.fullscreenMaterial.depthPacking=e;for(const n of this.effects)n.setDepthTexture(t,e)}render(t,e,n,o,r){for(const i of this.effects)i.update(t,e,o);if(!this.skipRendering||this.renderToScreen){const i=this.fullscreenMaterial;i.inputBuffer=e.texture,i.time+=o*this.timeScale,t.setRenderTarget(this.renderToScreen?null:n),t.render(this.scene,this.camera)}}setSize(t,e){this.fullscreenMaterial.setSize(t,e);for(const n of this.effects)n.setSize(t,e)}initialize(t,e,n){this.renderer=t;for(const o of this.effects)o.initialize(t,e,n);this.updateMaterial(),n!==void 0&&n!==xf&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const t of this.effects)t.removeEventListener("change",this.listener),t.dispose()}handleEvent(t){switch(t.type){case"change":this.recompile();break}}},mMo=class extends J1{constructor(t,e,{renderTarget:n,resolutionScale:o=1,width:r=Mh.AUTO_SIZE,height:i=Mh.AUTO_SIZE,resolutionX:a=r,resolutionY:l=i}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new eft(t,e,new T2e);const s=this.renderPass;s.ignoreBackground=!0,s.skipShadowMapUpdate=!0;const c=s.getClearPass();c.overrideClearColor=new ir(7829503),c.overrideClearAlpha=1,this.renderTarget=n,this.renderTarget===void 0&&(this.renderTarget=new ku(1,1,{minFilter:Cc,magFilter:Cc}),this.renderTarget.texture.name="NormalPass.Target");const u=this.resolution=new Mh(this,a,l,o);u.addEventListener("change",d=>this.setSize(u.baseWidth,u.baseHeight))}set mainScene(t){this.renderPass.mainScene=t}set mainCamera(t){this.renderPass.mainCamera=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,n,o,r){const i=this.renderToScreen?null:this.renderTarget;this.renderPass.render(t,i,i)}setSize(t,e){const n=this.resolution;n.setBaseSize(t,e),this.renderTarget.setSize(n.width,n.height)}};let CE;function yMo(){var t;if(CE!==void 0)return CE;try{let e;const n=document.createElement("canvas");return CE=!!(window.WebGL2RenderingContext&&(e=n.getContext("webgl2"))),e&&((t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()),CE}catch{return CE=!1}}const AMo=g.createContext(null),lLe=t=>(t.getAttributes()&NA.CONVOLUTION)===NA.CONVOLUTION,wMo=xe.memo(g.forwardRef(({children:t,camera:e,scene:n,resolutionScale:o,enabled:r=!0,renderPriority:i=1,autoClear:a=!0,depthBuffer:l,enableNormalPass:s,stencilBuffer:c,multisampling:u=8,frameBufferType:d=G8},f)=>{const{gl:p,scene:m,camera:y,size:w}=ti(),x=n||m,C=e||y,[P,A,S]=g.useMemo(()=>{const R=yMo(),M=new sHo(p,{depthBuffer:l,stencilBuffer:c,multisampling:u>0&&R?u:0,frameBufferType:d});M.addPass(new eft(x,C));let D=null,k=null;return s&&(k=new mMo(x,C),k.enabled=!1,M.addPass(k),o!==void 0&&R&&(D=new uMo({normalBuffer:k.texture,resolutionScale:o}),D.enabled=!1,M.addPass(D))),[M,k,D]},[C,p,l,c,u,d,x,s,o]);g.useEffect(()=>P==null?void 0:P.setSize(w.width,w.height),[P,w]),Gp((R,M)=>{if(r){const D=p.autoClear;p.autoClear=a,c&&!a&&p.clearStencil(),P.render(M),p.autoClear=D}},r?i:0);const v=g.useRef(null),b=Txt(v);g.useLayoutEffect(()=>{const R=[];if(v.current&&b.current&&P){const M=b.current.objects;for(let D=0;D{for(const M of R)P==null||P.removePass(M);A&&(A.enabled=!1),S&&(S.enabled=!1)}},[P,t,C,A,S,b]),g.useEffect(()=>{const R=p.toneMapping;return p.toneMapping=w5,()=>{p.toneMapping=R}},[]);const T=g.useMemo(()=>({composer:P,normalPass:A,downSamplingPass:S,resolutionScale:o,camera:C,scene:x}),[P,A,S,o,C,x]);return g.useImperativeHandle(f,()=>P,[P]),h.jsx(AMo.Provider,{value:T,children:h.jsx("group",{ref:v,children:t})})}));let xMo=0;const sLe=new WeakMap,vMo=(t,e)=>xe.forwardRef(function({blendFunction:o=e==null?void 0:e.blendFunction,opacity:r=e==null?void 0:e.opacity,...i},a){let l=sLe.get(t);if(!l){const u=`@react-three/postprocessing/${t.name}-${xMo++}`;R7({[u]:t}),sLe.set(t,l=u)}const s=ti(u=>u.camera),c=xe.useMemo(()=>{var u,d;return[...(u=e==null?void 0:e.args)!=null?u:[],...(d=i.args)!=null?d:[{...e,...i}]]},[JSON.stringify(i)]);return h.jsx(l,{camera:s,"blendMode-blendFunction":o,"blendMode-opacity-value":r,...i,ref:a,args:c})}),bMo=vMo(aMo,{blendFunction:Ka.ADD}),SMo=()=>h.jsx(wMo,{children:h.jsx(bMo,{mipmapBlur:!0,luminanceThreshold:10,intensity:.05,radius:.1})}),TMo=xe.memo(()=>{const t=H(CGe)??3.5,e=H(PGe)??.2,n=H(aQ)??pL,o=ye.getShadowMapSize(),r=H(I7),i=H(Ky),a=2*i,l=i+100,s=H(xs),c=g.useRef(null);c.current&&(c.current.shadow.camera.left=-l,c.current.shadow.camera.bottom=-l,c.current.shadow.camera.right=l,c.current.shadow.camera.top=l,c.current.shadow.camera.updateProjectionMatrix());const u=r.z>0,d=u?r.normalize().dot(Oo):0;return h.jsxs(h.Fragment,{children:[h.jsx(SMo,{}),h.jsx("ambientLight",{intensity:Evt+(u?e*d:0),name:"Ambient Light"}),h.jsx("directionalLight",{ref:c,name:"Directional Light",color:"white",position:r.normalize().multiplyScalar(a),intensity:u?t*d:0,castShadow:s,"shadow-bias":0,"shadow-mapSize-height":o,"shadow-mapSize-width":o,"shadow-camera-near":1,"shadow-camera-far":n})]})}),PMo=xe.memo(({element:t})=>{const e=H(mPt),n=H(Cm),o=H($y),r=H(v5e),i=t.type===z.Roof,a="lightGray",l=B5(NM,gI),s={font:l,height:0,size:.2},c={font:l,height:0,size:.35},u=g.useMemo(()=>r(t,n??o),[n,o]),d=g.useMemo(()=>{const P=-Math.atan2(e.x,e.y)+Math.PI;return new cn($t,0,P,"ZXY")},[e.x,e.y]),f=()=>{let P=t.lz;return i&&(P=H.getState().selectedElementHeight),Math.ceil(P)+1},p=()=>{let P=t.lz;return i&&(P=t.rise),P.toFixed(1)+" m"},m=()=>i?H.getState().selectedElementHeight+1:t.lz-.175;if(!n&&!o)return null;const y=f(),w=p(),x=m(),C=new Array(y+1).fill(0);return h.jsxs("group",{position:u,rotation:d,name:"Vertical Ruler",children:[h.jsx(On,{userData:{unintersectable:!0},points:[[0,0,0],[0,y,0]],color:a}),h.jsxs("mesh",{position:[-1.5,x,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[w,c]}),h.jsx("meshBasicMaterial",{attach:"material",color:"white"})]}),C.map((P,A)=>{const S=.2+(A%5===0?.05:0),v=h.jsx("textGeometry",{args:[`${A}`,s]});return h.jsxs("group",{children:[h.jsx(On,{userData:{unintersectable:!0},points:[[-S,A,0],[S,A,0]],lineWidth:.5,color:a}),!i&&h.jsxs("mesh",{position:[.4,A-.125,0],userData:{unintersectable:!0},children:[v,h.jsx("meshBasicMaterial",{attach:"material",color:a})]})]},A)})]})}),CMo=xe.memo(()=>{const t=H(FS),e=H(SQ),n=H(Cm),o=H($y),r=H(h4),i=H(Ky),a=H(PQ),l=H(TQ),s=H(A=>{if(A.selectedElement){const S=A.selectedElement.id;return A.elements.find(v=>v.id===S)}}),[c,u]=g.useState(!1),[d,f]=g.useState(2*i),[p,m]=g.useState(2*i);g.useEffect(()=>{const A=Math.floor(i/50)+1,S=Math.round(i/A)*2;f(S*A),m(S)},[i]),g.useEffect(()=>{if(n){const A=ye.isTopResizeHandle(n)||n===xt.UpperLeft&&(s==null?void 0:s.type)===z.Wall||n===xt.UpperRight&&(s==null?void 0:s.type)===z.Wall;u(!A)}else u(!1)},[n,s==null?void 0:s.type]);const y=()=>{if(!s)return!1;const A=s.type;return A===z.Foundation||A===z.Cuboid||A===z.Tree&&s.parentId===z.Ground||A===z.Human&&s.parentId===z.Ground},w=o===ai.Lower||o===ai.Upper,P=(A=>ye.isTopResizeHandle(A)&&(s==null?void 0:s.type)!==z.BatteryStorage||(s==null?void 0:s.type)===z.Wall&&ye.isTopResizeHandleOfWall(A)||(s==null?void 0:s.type)===z.Roof&&ye.isRiseHandleOfRoof(A))(n??o);return s?h.jsxs(h.Fragment,{children:[((c||t||ye.isMoveHandle(o))&&!r&&y()||a||l)&&h.jsx("gridHelper",{rotation:[$t,0,0],name:"Grid",args:[d,p,"gray","#444444"]}),(e||w)&&s&&y()&&h.jsx(j3e,{element:s}),P&&h.jsx(PMo,{element:s})]}):null}),iue=120,tv="DarkSlateGray",RE="white",RMo=xe.memo(({visible:t=!0})=>{const e=g.useRef(null),n=Kt(),o=window.devicePixelRatio,r=iue*o,i=r/150,l=20*i+"px serif";return g.useEffect(()=>{e.current&&jn.setState({compassRef:e})},[]),g.useEffect(()=>{if(!e.current||!t)return;const s=e.current.getContext("2d");if(!s)return;const c=55*i,u=10*i,d=40*i,f=5*i,p=30*i,m=i,y=i,w=15*i,x=r/2;s.clearRect(0,0,r,r),s.beginPath(),s.arc(x,x,d,0,Math.PI*2),s.lineWidth=f,s.strokeStyle=tv,s.stroke(),s.beginPath(),s.arc(x,x,p,0,Math.PI*2),s.lineWidth=m,s.strokeStyle=tv,s.stroke(),s.lineWidth=y,s.beginPath(),s.moveTo(x,x-c),s.lineTo(x-u,x-u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x,x-c),s.lineTo(x+u,x-u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x,x+c),s.lineTo(x-u,x+u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x,x+c),s.lineTo(x+u,x+u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x-c,x),s.lineTo(x-u,x-u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x-c,x),s.lineTo(x-u,x+u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x+c,x),s.lineTo(x+u,x-u),s.lineTo(x,x),s.fillStyle=RE,s.stroke(),s.fill(),s.beginPath(),s.moveTo(x+c,x),s.lineTo(x+u,x+u),s.lineTo(x,x),s.fillStyle=tv,s.stroke(),s.fill(),s.font=l,s.fillStyle=RE,s.textAlign="center",s.fillText(`${B.t("compass.N",n)}`,x,w),s.save(),s.translate(r,r),s.rotate(Math.PI),s.fillText(`${B.t("compass.S",n)}`,x,w),s.restore(),s.fillStyle=tv,s.save(),s.translate(0,r),s.rotate(-Math.PI/2),s.fillText(`${B.t("compass.W",n)}`,x,w),s.restore(),s.save(),s.translate(r,0),s.rotate(Math.PI/2),s.fillText(`${B.t("compass.E",n)}`,x,w),s.restore()},[n,t]),t?h.jsx("canvas",{ref:e,id:"compassCanvas",width:r,height:r,style:{position:"absolute",bottom:"0",right:"0",height:`${iue}px`,width:`${iue}px`,margin:"5px",pointerEvents:"none"}}):null});var tft={exports:{}};(function(t,e){(function(n,o){t.exports=o(g,rQ)})(window,function(n,o){return function(r){var i={};function a(l){if(i[l])return i[l].exports;var s=i[l]={i:l,l:!1,exports:{}};return r[l].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=r,a.c=i,a.d=function(l,s,c){a.o(l,s)||Object.defineProperty(l,s,{enumerable:!0,get:c})},a.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},a.t=function(l,s){if(1&s&&(l=a(l)),8&s||4&s&&typeof l=="object"&&l&&l.__esModule)return l;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:l}),2&s&&typeof l!="string")for(var u in l)a.d(c,u,(function(d){return l[d]}).bind(null,u));return c},a.n=function(l){var s=l&&l.__esModule?function(){return l.default}:function(){return l};return a.d(s,"a",s),s},a.o=function(l,s){return Object.prototype.hasOwnProperty.call(l,s)},a.p="",a(a.s=0)}([function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=a(1);Object.defineProperty(i,"default",{enumerable:!0,get:function(){return function(s){return s&&s.__esModule?s:{default:s}}(l).default}}),r.exports=i.default},function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=Object.assign||function(y){for(var w=1;w0&&p[0]!==this)return!1;var R=x.target===document.body||T,M=this.childrenContainer&&this.childrenContainer.contains(x.target);if(!(b?M:R))return!1;var D=(0,d.findMatchedKey)(x,A);return!!D&&(S(D,x),!0)}},{key:"render",value:function(){var x=this,C=this.props.children,P=Object.assign({},this.props),A=!0,S=!1,v=void 0;try{for(var b,T=Object.keys(w.propTypes)[Symbol.iterator]();!(A=(b=T.next()).done);A=!0)delete P[b.value]}catch(R){S=!0,v=R}finally{try{!A&&T.return&&T.return()}finally{if(S)throw v}}return C?c.default.createElement("span",l({ref:function(R){x.childrenContainer=R}},P),C):null}}]),w}();i.default=m,m.propTypes={handleKeys:u.default.array,handleEventType:u.default.oneOf(["keydown","keyup","keypress"]),handleFocusableElements:u.default.bool,onKeyEvent:u.default.func,isDisabled:u.default.bool,isExclusive:u.default.bool,children:u.default.any},m.defaultProps={handleKeys:[],handleFocusableElements:!1,handleEventType:"keydown",onKeyEvent:function(){return null}},r.exports=i.default},function(r,i){r.exports=n},function(r,i){r.exports=o},function(r,i,a){function l(C,P,A){return P in C?Object.defineProperty(C,P,{value:A,enumerable:!0,configurable:!0,writable:!0}):C[P]=A,C}Object.defineProperty(i,"__esModule",{value:!0}),i.matchKeyEvent=x,i.findMatchedKey=function(C,P){var A=P.map(function(S){var v=S.toLowerCase(),b=w[v];return b||[S]}).reduce(function(S,v){return S.concat(v)},[]).find(function(S){return x(C,S)});return!A&&P.includes("all")&&(A="other"),A};var s={backspace:[8],del:[46],delete:[46],ins:[45],insert:[45],tab:[9],enter:[13],return:[13],esc:[27],space:[32],pageup:[33],pagedown:[34],end:[35],home:[36],left:[37],up:[38],right:[39],down:[40],shift:[16],ctrl:[17],alt:[18],cap:[20],num:[144],clear:[12],meta:[91],";":[186,59],"=":[187,61],",":[188,44],"-":[189,45,173,109],minus:[189,45,173,109],".":[190,110],"/":[191,111],"`":[192],"[":[219],"\\":[220],"]":[221],"*":[106],"+":[107],plus:[107],"'":[222],quote:[222]},c=Object.keys(s).reduce(function(C,P){return Object.assign(C,l({},P.toUpperCase(),s[P]))},{}),u="0123456789".split("").reduce(function(C,P,A){return Object.assign(C,l({},P,[A+48,A+96]))},{}),d="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(C,P,A){return Object.assign(C,l({},P.toLowerCase(),[A+65]),l({},P,[A+65]))},{}),f="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(C,P,A){return Object.assign(C,l({},"f"+P,[A+112]))},{}),p={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},m=i.AllKeys=Object.assign({},s,c,u,d,f),y=Object.assign({},u,d),w={all:Object.keys(m),alphanumeric:Object.keys(y),numeric:Object.keys(u),alphabetic:Object.keys(d),function:Object.keys(f)};function x(C,P){var A=C.which||C.keyCode,S=C.type,v=Object.keys(p).filter(function(U){return C[U+"Key"]}).sort(),b=P.toLowerCase().trim(),T=b==="+"?["+"]:b.split(/\s?\+\s?/),R=T.pop(),M=m[R],D=T;if(S==="keypress")return P==String.fromCharCode(A).toLowerCase();if(D.length===0&&v.length===0)return M.indexOf(A)>=0;if(D.length>0&&v.length>0){var k=D.map(function(U){return p[U]}).sort(),N=k.length===v.length&&k.every(function(U,W){return v[W]===U});return M.indexOf(A)>=0&&N}return D.length==0&&v.length===1&&R===v[0]}}])})})(tft);var HMo=tft.exports;const mge=ji(HMo),MMo=xe.memo(()=>{var s,c;const t=H(pn),e=H(P5e),n=H(T5e),o=H(Fn),r=g.useRef(!1),i=g.useRef(!1);H(RJe),H(HJe),dt(u=>u.selectedElementId),g.useEffect(()=>{jn.setState({listenToAutoDeletionByDeleteRef:r,listenToAutoDeletionByCutRef:i})},[]);const a=A3.debounce(()=>{var A,S;const u=dt.getState().selectedElementId,d=H.getState().selectedElementIdSet;if(!u||d.size===0)return;const f=H.getState().getAutoDeletedElements();if(!f)return;const p=H.getState().deletedElements,m=H.getState().elementsToPaste,y=(A=jn.getState().listenToAutoDeletionByCutRef)==null?void 0:A.current,w=(S=jn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:S.current;let x=[],C="";y?(jn.getState().setListenToAutoDeletionByCut(!1),x=[...m,...f],C="Cut"):w&&(jn.getState().setListenToAutoDeletionByDelete(!1),x=[...p,...f],C="Delete");const P={name:C,timestamp:Date.now(),deletedElements:[...x],selectedElementId:u,selectedElementIdSet:new Set(d),undo(){const v=P.deletedElements;if(!v||v.length===0)return;for(const T of this.deletedElements)if(T.type===z.Wall){const R=T;R.leftJoints.length>0&&e(R.leftJoints[0],[R.id]),R.rightJoints.length>0&&n(R.rightJoints[0],[R.id])}else T.type===z.Roof&&t(R=>{R.addedRoofIdSet.add(T.id)});const b=v.find(T=>T.id===this.selectedElementId)??null;t(T=>{T.elements.push(...v),T.selectedElement=b,T.selectedElementIdSet=new Set(this.selectedElementIdSet),T.updateWallMapOnFoundationFlag=!T.updateWallMapOnFoundationFlag,T.deletedRoofId=null,T.autoDeletedRoofs=null,T.deletedRoofIdSet.clear(),T.autoDeletedRoofIdSet.clear(),T.autoDeletedChild=null})},redo(){P.deletedElements.length!==0&&(t(v=>{v.selectedElement=v.elements.find(b=>b.id===this.selectedElementId)??null,v.selectedElementIdSet=new Set(this.selectedElementIdSet)}),H.getState().removeSelectedElements())}};o(P),t(v=>{v.selectedElement=null,v.selectedElementIdSet.clear(),v.deletedRoofId=null,v.deletedRoofIdSet.clear(),v.autoDeletedRoofs=null,v.autoDeletedRoofIdSet.clear(),v.autoDeletedChild=null}),dt.getState().setPrimitiveStore("selectedElementId",null)},50);return(((s=jn.getState().listenToAutoDeletionByCutRef)==null?void 0:s.current)||((c=jn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:c.current))&&H.getState().getAutoDeletedElements()&&a(),null}),cLe=["left","up","right","down","shift+left","shift+up","shift+right","shift+down","ctrl+shift+left","ctrl+shift+up","ctrl+shift+right","ctrl+shift+down","meta+shift+left","meta+shift+up","meta+shift+right","meta+shift+down","ctrl+f","meta+f","ctrl+o","meta+o","ctrl+s","meta+s","ctrl+c","meta+c","ctrl+x","meta+x","ctrl+v","meta+v","ctrl+[","meta+[","ctrl+]","meta+]","ctrl+z","meta+z","ctrl+y","meta+y","ctrl+m","meta+m","ctrl+u","meta+u","ctrl+b","meta+b","shift","esc","ctrl+home","ctrl+alt+h","ctrl+shift+o","meta+shift+o","ctrl+shift+s","meta+shift+s","delete","backspace","alt+backspace","f2","f4","ctrl"],IMo=xe.memo(({canvas:t})=>{const e=H(pn),n=H(Qi),o=H(qN),r=H(Au),i=H(i5e),a=H(Fn),l=H(M0)??!1,s=H(HS),c=H(Jn),u=H(YXe),d=H(Jp),f=H(JPt),p=H($r),m=H(T5e),y=H(P5e),w=H(nCt),x=H(c5e),C=H(YM),P=.1,A=g.useMemo(()=>({lng:r}),[r]),S=(G,Q)=>(t&&(t.style.cursor="default"),d(G,Q)),v=()=>{if(H.getState().viewState.navigationView)return;const G=H.getState().set2DView,Q={name:"Set 2D View",timestamp:Date.now(),checked:!l,undo:()=>{G(!Q.checked)},redo:()=>{G(Q.checked)}};a(Q),G(!l),e(oe=>{oe.viewState.autoRotate=!1})},b=()=>{if(l)return;const G=H.getState().setNavigationView,Q={name:"Set Navigation View",timestamp:Date.now(),checked:!H.getState().viewState.navigationView,undo:()=>{G(!Q.checked)},redo:()=>{G(Q.checked)}};a(Q),G(!H.getState().viewState.navigationView),e(oe=>{oe.viewState.autoRotate=!1})},T=()=>{if(l)return;const G={name:"Auto Rotate",timestamp:Date.now(),checked:!H.getState().viewState.autoRotate,undo:()=>{e(Q=>{Q.objectTypeToAdd=z.None,Q.groupActionMode=!1,Q.viewState.autoRotate=!G.checked})},redo:()=>{e(Q=>{Q.objectTypeToAdd=z.None,Q.groupActionMode=!1,Q.viewState.autoRotate=G.checked})}};a(G),e(Q=>{Q.objectTypeToAdd=z.None,Q.groupActionMode=!1,Q.viewState.autoRotate=!Q.viewState.autoRotate})},R=(G,Q,oe)=>{const ee=JSON.parse(JSON.stringify(G));if(ee.cx=Q,ee.cy=oe,G.type===z.SolarPanel&&G.parentType===z.Roof){if(G.parentId&&G.foundationId){const $=c(G.parentId),ae=c(G.foundationId);if($&&ae){const Z=Rn.getRoofBoundaryVertices($),ne=Rn.getSolarPanelVerticesOnRoof(ee,ae);if(!Hot(ne,Z)||!Mot(ee,ae,ne))return!1}}return!0}if(x(ee))return co(B.t("message.MoveCancelledBecauseOfOverlap",A)),!1;if(ee.type===z.SolarPanel){const $=p(G);if($&&!ye.isSolarCollectorWithinHorizontalSurface(ee,$))return co(B.t("message.MoveOutsideBoundaryCancelled",A)),!1}return!0},M=G=>{switch(G.type){case z.Roof:case z.Door:case z.Window:return!1;case z.SolarPanel:case z.Sensor:case z.Light:{const Q=G;return Q.parentType===z.Wall||Q.parentType===z.Roof?!1:Q.parentType===z.Cuboid?Q.rotation[2]===1:!0}case z.Wall:{const Q=G;return!(Q.leftJoints.length!==0||Q.rightJoints.length!==0)}default:return!0}},D=(G,Q)=>{switch(G){case z.Foundation:case z.Cuboid:return Q===z.Foundation||Q===z.Cuboid;default:return Q!==z.Foundation&&Q!==z.Cuboid}},k=G=>{const Q=H.getState().elements.filter(ae=>Cd(ae)&&ae.parentId===rr),oe=new Set(G.map(ae=>ae.id)),ee=new Map;for(const ae of Q){const Z=ye.fetchFoundationVertexCoordinates(ae);ee.set(ae.id,Z)}const $=ae=>{for(const Z of Q)!oe.has(Z.id)&&ye.areBasesOverlapped(ae.id,Z.id,ee)&&(oe.add(Z.id),G.push(Z),Z.enableGroupMaster&&$(Z))};for(const ae of G)ae.enableGroupMaster&&$(ae)},N=()=>{const G=[],Q=H.getState().selectedElementIdSet,oe=s();if(!oe||Q.size===0)return G;if(oe){const ee=oe.type,$=oe.parentId,ae=H.getState().elements.filter(Z=>D(ee,Z.type)&&M(Z)&&Z.parentId===$&&Q.has(Z.id));G.push(...ae),Cd(oe)&&G.length>0&&$===rr&&k(G)}return G},U=(G,Q,oe,ee)=>{switch(ee){case Sl.Left:return[G-oe,Q];case Sl.Right:return[G+oe,Q];case Sl.Up:return[G,Q+oe];case Sl.Down:return[G,Q-oe]}},W=(G,Q)=>{e(oe=>{var $,ae;let ee=!1;for(const Z of oe.elements)if(G.has(Z.id)){const ne=G.get(Z.id);if(ne!==void 0){const[te,q]=U(Z.cx,Z.cy,ne,Q);if(Z.type===z.Wall){const le=Z,de=new ue(te-le.cx,q-le.cy),he=new ue().fromArray(le.leftPoint).setZ(0).add(de),me=new ue().fromArray(le.rightPoint).setZ(0).add(de);le.leftPoint=he.toArray(),le.rightPoint=me.toArray(),ee=!0}Z.cx=te,Z.cy=q}}else oe.selectedElementIdSet.has(Z.id)&&oe.selectedElementIdSet.delete(Z.id);(($=oe.selectedElement)==null?void 0:$.type)===z.Cuboid||((ae=oe.selectedElement)==null?void 0:ae.type)===z.Foundation?oe.groupActionUpdateFlag=!oe.groupActionUpdateFlag:ee&&(oe.updateWallMapOnFoundationFlag=!oe.updateWallMapOnFoundationFlag)})},F=(G,Q)=>{e(oe=>{for(const ee of oe.elements)(ye.isFoundationOrCuboid(ee)||ye.isPlantOrHuman(ee)&&ee.parentId===rr)&&([ee.cx,ee.cy]=U(ee.cx,ee.cy,G,Q))})},E=G=>G===Sl.Left?Sl.Right:G===Sl.Right?Sl.Left:G===Sl.Up?Sl.Down:G===Sl.Down?Sl.Up:(console.error("Undo direction is possibly incorrect:",G),G),L=(G,Q)=>{if(!l)return;const oe=N(),ee=s(),$=Q*P;if(ee&&oe.length>0){const ae=new Map;for(const ne of oe)switch(ne.type){case z.Foundation:case z.Cuboid:case z.Wall:case z.Tree:case z.Flower:case z.Human:{ae.set(ne.id,$);break}case z.Light:case z.Sensor:{const te=p(ee);if(te){let q=$/te.lx;const[le,de]=U(ne.cx,ne.cy,q,G),he=ne.lx/(2*te.lx),me=ne.lx/(2*te.ly);switch(G){case Sl.Left:case Sl.Right:{const ce=ye.clamp(le,-.5+he,.5-he);q=Math.abs(ce-ee.cx);break}case Sl.Up:case Sl.Down:{const ce=ye.clamp(de,-.5+me,.5-me);q=Math.abs(ce-ee.cy);break}}ae.set(ne.id,q)}break}case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:{const te=p(ne);if(te){let q=!0,le=$;switch(G){case Sl.Left:case Sl.Right:{le=$/te.lx;break}case Sl.Up:case Sl.Down:{le=$/te.ly;break}}if(ne.type===z.SolarPanel){const[de,he]=U(ne.cx,ne.cy,le,G);q=R(ne,de,he)}if(q)ae.set(ne.id,le);else return}break}}W(ae,G);const Z={name:`Move Selected Elements ${G} By Key`,timestamp:Date.now(),direction:G,movedElementsDisplacementMap:new Map(ae),undo:()=>{const ne=E(Z.direction);W(Z.movedElementsDisplacementMap,ne)},redo:()=>{W(Z.movedElementsDisplacementMap,Z.direction)}};a(Z)}else{F($,G);const ae={name:`Move All ${G} By Key`,timestamp:Date.now(),direction:G,displacement:$,undo:()=>{const Z=E(ae.direction);F(ae.displacement,Z)},redo:()=>{F(ae.displacement,ae.direction)}};a(ae)}},j=G=>{H.getState().set(Q=>{Q.multiSelectionsMode=G})},Y=G=>{const Q=s(),oe=1;switch(G){case"left":L(Sl.Left,oe);break;case"shift+left":L(Sl.Left,oe/W9);break;case"ctrl+shift+left":case"meta+shift+left":L(Sl.Left,oe*W9);break;case"right":L(Sl.Right,oe);break;case"shift+right":L(Sl.Right,oe/W9);break;case"ctrl+shift+right":case"meta+shift+right":L(Sl.Right,oe*W9);break;case"down":L(Sl.Down,oe);break;case"shift+down":L(Sl.Down,oe/W9);break;case"ctrl+shift+down":case"meta+shift+down":L(Sl.Down,oe*W9);break;case"up":L(Sl.Up,oe);break;case"shift+up":L(Sl.Up,oe/W9);break;case"ctrl+shift+up":case"meta+shift+up":L(Sl.Up,oe*W9);break;case"ctrl+[":case"meta+[":UJ(.9);break;case"ctrl+]":case"meta+]":UJ(1.1);break;case"ctrl+c":case"meta+c":Q&&Q.type!==z.Roof&&(u(Q.id),e(ee=>{ee.selectedElementIdSet.clear(),ee.selectedElementIdSet.add(Q.id)}),n&&e(ee=>{ee.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:Q.id,elementType:Q.type}}));break;case"ctrl+x":case"meta+x":if(!Q||Q.type===z.Roof)break;if(Q.locked)yn(B.t("message.ThisElementIsLocked",A));else{const ee=S(Q.id,!0);if(ee.length===0)break;if(ye.isElementTriggerAutoDeletion(Q))jn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",Q.id);else{const $={name:"Cut",timestamp:Date.now(),deletedElements:ee,selectedElementId:Q.id,undo:()=>{const ae=$.deletedElements;if(ae.length===0)return;const Z=ae.find(ne=>ne.id===$.selectedElementId);Z&&e(ne=>{if(ne.elements.push(...ae),ne.selectedElementIdSet.clear(),ne.selectedElementIdSet.add(Z.id),ne.selectedElement=Z,Z.type===z.Wall){const te=Z;let q=null,le=null;if(te.leftJoints.length>0&&(q=te.leftJoints[0]),te.rightJoints.length>0&&(le=te.rightJoints[0]),q||le)for(const de of ne.elements)de.id===q&&de.type===z.Wall&&(de.rightJoints[0]=te.id),de.id===le&&de.type===z.Wall&&(de.leftJoints[0]=te.id)}})},redo:()=>{$.deletedElements&&$.deletedElements.length>0&&S($.deletedElements[0].id,!0)}};a($)}}break;case"ctrl+v":case"meta+v":{const ee=f();if(ee.length>0){const $={name:"Paste by Key",timestamp:Date.now(),pastedElements:JSON.parse(JSON.stringify(ee)),undo:()=>{for(const ae of $.pastedElements)d(ae.id,!1)},redo:()=>{e(ae=>{ae.elements.push(...$.pastedElements),ae.selectedElement=$.pastedElements[0]})}};a($)}break}case"ctrl+alt+h":case"ctrl+home":{if(!l){const ee=H.getState().viewState.cameraPosition,$=H.getState().viewState.panCenter;if(ee[0]!==ee[1]||ee[1]!==ee[2]||ee[0]!==ee[2]||$[0]!==0||$[1]!==0||$[2]!==0){const ae={name:"Reset View",timestamp:Date.now(),oldCameraPosition:[...ee],oldPanCenter:[...$],undo:()=>{const Z=jn.getState().orbitControlsRef;Z!=null&&Z.current&&(Z.current.object.position.set(ae.oldCameraPosition[0],ae.oldCameraPosition[1],ae.oldCameraPosition[2]),Z.current.target.set(ae.oldPanCenter[0],ae.oldPanCenter[1],ae.oldPanCenter[2]),Z.current.update(),e(ne=>{const te=ne.viewState;te.cameraPosition=[...ae.oldCameraPosition],te.panCenter=[...ae.oldPanCenter]}))},redo:()=>{NJ()}};a(ae),e(Z=>{Z.objectTypeToAdd=z.None,Z.groupActionMode=!1,Z.viewState.orthographic=!1}),NJ()}}break}case"f2":case"ctrl+b":case"meta+b":v();break;case"ctrl+u":case"meta+u":b();break;case"f4":case"ctrl+m":case"meta+m":T();break;case"ctrl+f":case"meta+f":dt.getState().set(ee=>{ee.createNewFileFlag=!0,ee.openModelsMap=!1}),e(ee=>{ee.objectTypeToAdd=z.None,ee.groupActionMode=!1,window.history.pushState({},document.title,k1),n&&C("Create New File")});break;case"ctrl+s":case"meta+s":dt.getState().set(ee=>{ee.saveLocalFileDialogVisible=!0}),n&&C("Save Local File");break;case"ctrl+shift+o":case"meta+shift+o":dt.getState().set(ee=>{ee.listCloudFilesFlag=!0,ee.openModelsMap=!1}),n&&C("List Cloud Files");break;case"ctrl+shift+s":case"meta+shift+s":dt.getState().setSaveCloudFileFlag(!0),n&&C("Save Cloud File");break;case"alt+backspace":case"backspace":case"delete":{const ee=H.getState().selectedElementIdSet;if(!Q||ee.size===0)break;const $=H.getState().removeSelectedElements();if($.length===0)break;if((()=>{const Z=$.filter(q=>q.type===z.Foundation),ne=new Set(Z.map(q=>q.id));return!!$.find(q=>!ne.has(q.parentId)&&ye.isElementTriggerAutoDeletion(q))})())jn.getState().setListenToAutoDeletionByDelete(!0),dt.getState().setPrimitiveStore("selectedElementId",Q.id);else{if($.length===1){const Z={name:"Delete",timestamp:Date.now(),deletedElements:[...$],selectedElementId:Q.id,undo:()=>{const ne=Z.deletedElements;if(!ne||ne.length===0)return;const te=ne.find(q=>q.id===Z.selectedElementId);if(te&&(e(q=>{q.elements.push(...ne),q.selectedElementIdSet.clear(),q.selectedElementIdSet.add(te.id),q.selectedElement=te,q.updateWallMapOnFoundationFlag=!q.updateWallMapOnFoundationFlag,q.deletedRoofId=null,q.deletedRoofIdSet.clear()}),te.type===z.Wall)){const q=te;q.leftJoints.length>0&&y(q.leftJoints[0],[q.id]),q.rightJoints.length>0&&m(q.rightJoints[0],[q.id])}},redo:()=>{const ne=Z.deletedElements;if(!ne||ne.length===0)return;const te=ne.find(q=>q.id===Z.selectedElementId);te&&S(te.id,!1)}};a(Z)}else{const Z={name:"Delete Multiple",timestamp:Date.now(),deletedElements:[...$],selectedElementId:Q.id,selectedElementIdSet:new Set(ee),undo(){const ne=this.deletedElements;if(!ne||ne.length===0)return;const te=ne.find(q=>q.id===this.selectedElementId);if(te){e(q=>{q.elements.push(...ne),q.selectedElement=te,q.selectedElementIdSet=new Set(this.selectedElementIdSet),q.updateWallMapOnFoundationFlag=!q.updateWallMapOnFoundationFlag,q.deletedRoofId=null,q.deletedRoofIdSet.clear()});for(const q of this.deletedElements)if(q.type===z.Wall){const le=q;le.leftJoints.length>0&&y(le.leftJoints[0],[le.id]),le.rightJoints.length>0&&m(le.rightJoints[0],[le.id])}}},redo(){e(ne=>{ne.selectedElement=ne.elements.find(te=>te.id===this.selectedElementId)??null,ne.selectedElementIdSet=new Set(this.selectedElementIdSet)}),H.getState().removeSelectedElements()}};a(Z)}e(Z=>{Z.selectedElement=null,Z.selectedElementIdSet.clear()})}break}case"ctrl+z":case"meta+z":if(i.hasUndo()){const ee=i.undo();ee&&(Dp.destroy(),yn(B.t("menu.edit.Undo",A)+": "+ee,Ob)),H.getState().groupActionMode&&e($=>{$.groupActionUpdateFlag=!$.groupActionUpdateFlag}),n&&C("Undo")}break;case"ctrl+y":case"meta+y":if(i.hasRedo()){const ee=i.redo();ee&&(Dp.destroy(),yn(B.t("menu.edit.Redo",A)+": "+ee,Ob)),H.getState().groupActionMode&&e($=>{$.groupActionUpdateFlag=!$.groupActionUpdateFlag}),n&&C("Redo")}break;case"shift":H.getState().viewState.navigationView&&dt.getState().set(ee=>{ee.navigationMoveSpeed=5*H.getState().minimumNavigationMoveSpeed,ee.navigationTurnSpeed=5*H.getState().minimumNavigationTurnSpeed}),w(!0);break;case"esc":{const ee=H.getState().addedFoundationId,$=H.getState().addedCuboidId,ae=H.getState().addedWallId,Z=H.getState().addedWindowId,ne=H.getState().addedDoorId;ee?d(ee,!1):$?d($,!1):ae?d(ae,!1):Z?(d(Z,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",Z)):ne&&(d(ne,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",ne)),e(te=>{te.objectTypeToAdd=z.None,te.actionModeLock=!1,te.moveHandleType=null,te.resizeHandleType=null,te.groupActionMode=!1}),jn.getState().setEnableOrbitController(!0),o();break}case"ctrl":{j(!0);break}}},O=G=>{switch(G){case"shift":H.getState().viewState.navigationView&&dt.getState().set(Q=>{Q.navigationMoveSpeed=H.getState().minimumNavigationMoveSpeed,Q.navigationTurnSpeed=H.getState().minimumNavigationTurnSpeed}),w(!1);break;case"ctrl+o":case"meta+o":H.getState().localFileDialogRequested||(dt.getState().set(Q=>{Q.openLocalFileFlag=!0}),e(Q=>{Q.localFileDialogRequested=!0,n&&Q.logAction("Open Local File")}));break;case"ctrl":{j(!1);break}}};g.useEffect(()=>()=>{_.current=null},[]);const _=g.useRef(null);return h.jsxs(h.Fragment,{children:[h.jsx(mge,{handleFocusableElements:!1,handleKeys:cLe,handleEventType:"keydown",onKeyEvent:(G,Q)=>{Q.preventDefault(),_.current!==G&&(_.current=G,Y(G))}}),h.jsx(mge,{handleFocusableElements:!1,handleKeys:cLe,handleEventType:"keyup",onKeyEvent:(G,Q)=>{Q.preventDefault(),_.current=null,O(G)}}),h.jsx(MMo,{})]})}),zMo="/aladdin/assets/cloud-B68yt6QG.png",DMo=xe.memo(()=>{const t=H(pn),e=H(gPt),{scene:n}=ti();g.useEffect(()=>{const r=n.children.filter(l=>l.name==="Content"),i=[];if(r.length>0){const l=r[0].children;for(const s of l)o(s,i)}const a=[];for(const l of i)a.push(new Cf().setFromObject(l));if(a.length>0){const l=new ue,s=new ue;for(const u of a)l.min(u.min),s.max(u.max);let c=Math.abs(l.x);c{u.aabb=new Cf(l,s),!isNaN(c)&&isFinite(c)&&(u.sceneRadius=Math.round(Math.max(10,c*1.25)))})}},[e]);const o=(r,i)=>{if(r.userData.aabb&&i.push(r),r.children.length>0)for(const a of r.children)o(a,i)};return h.jsx(h.Fragment,{})}),yge=t=>{const e=new ue().subVectors(t.localToWorld(new ue(0,0,1e3)),t.position);return e.x===0&&e.y===0&&t.getWorldDirection(e),e},eC=t=>{const e=document.getElementById("compassCanvas"),n=o=>{dt.getState().set(r=>{r.isCameraUnderGround=o})};if(e){const o=yge(t).normalize(),i=(Math.atan2(o.y,o.x)+Math.PI/2)/Math.PI*180;e.style.transform=`rotate(${i}deg)`;const a=t.position.z<.001;a&&!dt.getState().isCameraUnderGround?n(!0):!a&&dt.getState().isCameraUnderGround&&n(!1)}},EMo=xe.memo(()=>{const t=H(pn),e=H(M0),n=H(lSt),o=H(zGe),r=H(OM),i=H(Ky),a=H(sSt),l=H(cSt),s=H(aQ)??pL,c=H(iQ),u=dt(wTt),d=dt(xTt),f=H(eXe),p=dt(aXe),m=c&&!e,y=Math.hypot(a[0],a[1],a[2]),w=(e?l*50:y*10)*i,x=g.useMemo(()=>new ue(-w,-w,0),[w]),C=g.useMemo(()=>new ue(w,w,w/2),[w]),{gl:P,invalidate:A,get:S,set:v,camera:b}=ti(),T=g.useMemo(()=>{const L=S().camera;return L.up.set(0,0,1),L},[]),R=g.useMemo(()=>P.domElement,[]),M=g.useRef(null),D=g.useRef(null),k=g.useRef(null);g.useEffect(()=>{jn.setState({canvas:{gl:P,camera:b}}),!e&&D.current&&jn.setState({canvas:{gl:P,camera:D.current}})},[e]),g.useEffect(()=>{H.getState().viewState.cameraPosition2D[2]<100&&t(L=>{L.viewState.cameraPosition2D[2]=150})},[]),g.useEffect(()=>{M&&M.current&&jn.setState({orbitControlsRef:M})},[]),g.useEffect(()=>{M.current&&(M.current.addEventListener("change",N),M.current.addEventListener("start",U),M.current.addEventListener("end",W));const L=M.current;return()=>{L&&(L.removeEventListener("change",N),L.removeEventListener("start",U),L.removeEventListener("end",W))}},[m]),g.useEffect(()=>{const L=H.getState().viewState;if(M.current){if(D.current){if(m){const j=S().camera,Y=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(Y),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"])}else{const j=F(L.cameraPosition??[0,0,20]),Y=F(L.panCenter??[0,0,0]);D.current.position.copy(j),D.current.lookAt(Y),D.current.zoom=1,e||(M.current.object=D.current,M.current.target.copy(Y))}b.updateMatrixWorld(),eC(S().camera)}if(k.current){const j=F(L.cameraPosition2D??[0,0,1e3]).setZ(1e3),Y=F(L.panCenter2D??[0,0,0]);k.current.position.copy(j),k.current.rotation.set(0,0,0),k.current.lookAt(Y),k.current.zoom=L.cameraZoom,e&&(M.current.object=k.current,M.current.target.copy(Y))}}},[r]),g.useEffect(()=>{if(!k.current||!D.current||!M.current)return;const L=H.getState().viewState,j=M.current,Y=k.current,O=D.current;e?(Y.rotation.set(0,0,0),j.object=Y,j.target.copy(F(L.panCenter2D??[0,0,0])),v({camera:Y})):(j.object=O,j.target.copy(F(L.panCenter??[0,0,0])),v({camera:O}),eC(S().camera))},[e]),g.useEffect(()=>{e&&M.current&&(k.current&&(k.current.zoom=l,M.current.object=k.current),N(),M.current.update())},[l]);const N=()=>{A(),H.getState().viewState.orthographic||(eC(S().camera),M.current&&M.current.target.clamp(x,C))},U=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!0})},W=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!1}),t(L=>{if(!M.current)return;const j=L.viewState,Y=S().camera,O=Y.position,_=M.current.target;j.orthographic?(Y.zoom&&!isNaN(Y.zoom)?j.cameraZoom=Y.zoom:j.cameraZoom=20,j.cameraPosition2D=[O.x,O.y,150],j.panCenter2D=[_.x,_.y,_.z]):m?(j.cameraPositionNav=[O.x,O.y,O.z],j.cameraRotationNav=[Y.rotation.x,Y.rotation.y,Y.rotation.z],L.cameraDirection=yge(Y)):(j.cameraPosition=[O.x,O.y,O.z],j.panCenter=[_.x,_.y,_.z],L.cameraDirection=yge(Y))})},F=L=>L&&Array.isArray(L)?new ue(L[0],L[1],L[2]):L&&L.x!==null?new ue(L.x,L.y,L.z):new ue(0,0,5);Gp(()=>{o&&M.current&&M.current.update()});const E=jn(L=>L.compassRef);return g.useEffect(()=>{eC(S().camera)},[E]),g.useEffect(()=>{M.current&&(m&&!p&&!f?M.current.listenToKeyEvents(window):M.current.removeKeyEvents())},[m,p,f]),g.useEffect(()=>{if(!M.current)return;const L=H.getState().viewState;if(m){const j=S().camera,Y=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(Y),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"]),j.updateMatrixWorld(),eC(S().camera)}else if(M.current&&D.current){const j=F(L.cameraPosition??[0,0,20]),Y=F(L.panCenter??[0,0,0]);D.current.position.copy(j),D.current.lookAt(Y),D.current.zoom=1,e||(M.current.object=D.current,M.current.target.copy(Y)),D.current.updateMatrixWorld(),eC(D.current)}A()},[m]),h.jsxs(h.Fragment,{children:[h.jsx(Ybt,{ref:D,fov:uVe,far:s,up:[0,0,1]}),h.jsx(jbt,{ref:k,up:[0,0,1]}),h.jsx("myOrbitControls",{ref:M,args:[T,R],autoRotate:o,enableRotate:n,enablePan:!0,enableZoom:!0,enableDamping:!1,maxAzimuthAngle:1/0,minAzimuthAngle:-1/0,maxPolarAngle:$t,minPolarAngle:0,moveSpeed:u??3,turnSpeed:d??3})]})});var Age={exports:{}},wge={exports:{}},bW=1e3,SW=bW*60,TW=SW*60,PW=TW*24,kMo=PW*365.25,FMo=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return LMo(t);if(n==="number"&&isNaN(t)===!1)return e.long?NMo(t):WMo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function LMo(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),o=(e[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*kMo;case"days":case"day":case"d":return n*PW;case"hours":case"hour":case"hrs":case"hr":case"h":return n*TW;case"minutes":case"minute":case"mins":case"min":case"m":return n*SW;case"seconds":case"second":case"secs":case"sec":case"s":return n*bW;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function WMo(t){return t>=PW?Math.round(t/PW)+"d":t>=TW?Math.round(t/TW)+"h":t>=SW?Math.round(t/SW)+"m":t>=bW?Math.round(t/bW)+"s":t+"ms"}function NMo(t){return hV(t,PW,"day")||hV(t,TW,"hour")||hV(t,SW,"minute")||hV(t,bW,"second")||t+" ms"}function hV(t,e,n){if(!(t=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}};function r(c){var u=this.useColors;if(c[0]=(u?"%c":"")+this.namespace+(u?" %c":" ")+c[0]+(u?"%c ":" ")+"+"+e.humanize(this.diff),!!u){var d="color: "+this.color;c.splice(1,0,d,"color: inherit");var f=0,p=0;c[0].replace(/%[a-zA-Z%]/g,function(m){m!=="%%"&&(f++,m==="%c"&&(p=f))}),c.splice(p,0,d)}}function i(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(c){try{c==null?e.storage.removeItem("debug"):e.storage.debug=c}catch{}}function l(){var c;try{c=e.storage.debug}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}e.enable(l());function s(){try{return window.localStorage}catch{}}})(Age,Age.exports);var jMo=Age.exports,uLe=jMo("jsonp"),BMo=_Mo,YMo=0;function OMo(){}function _Mo(t,e,n){typeof e=="function"&&(n=e,e={}),e||(e={});var o=e.prefix||"__jp",r=e.name||o+YMo++,i=e.param||"callback",a=e.timeout!=null?e.timeout:6e4,l=encodeURIComponent,s=document.getElementsByTagName("script")[0]||document.head,c,u;a&&(u=setTimeout(function(){d(),n&&n(new Error("Timeout"))},a));function d(){c.parentNode&&c.parentNode.removeChild(c),window[r]=OMo,u&&clearTimeout(u)}function f(){window[r]&&d()}return window[r]=function(p){uLe("jsonp got",p),d(),n&&n(null,p)},t+=(~t.indexOf("?")?"&":"?")+i+"="+l(r),t=t.replace("?&","?"),uLe('jsonp req "%s"',t),c=document.createElement("script"),c.src=t,s.parentNode.insertBefore(c,s),f}const uT=ji(BMo);var VMo=Object.defineProperty,GMo=Object.defineProperties,XMo=Object.getOwnPropertyDescriptors,QK=Object.getOwnPropertySymbols,nft=Object.prototype.hasOwnProperty,oft=Object.prototype.propertyIsEnumerable,dLe=(t,e,n)=>e in t?VMo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$g=(t,e)=>{for(var n in e||(e={}))nft.call(e,n)&&dLe(t,n,e[n]);if(QK)for(var n of QK(e))oft.call(e,n)&&dLe(t,n,e[n]);return t},ioe=(t,e)=>GMo(t,XMo(e)),aoe=(t,e)=>{var n={};for(var o in t)nft.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&QK)for(var o of QK(t))e.indexOf(o)<0&&oft.call(t,o)&&(n[o]=t[o]);return n};function V7(t){return n=>{var o=n,{bgStyle:r={},borderRadius:i=0,iconFillColor:a="white",round:l=!1,size:s=64}=o,c=aoe(o,["bgStyle","borderRadius","iconFillColor","round","size"]);return h.jsxs("svg",ioe($g({viewBox:"0 0 64 64",width:s,height:s},c),{children:[l?h.jsx("circle",{cx:"32",cy:"32",r:"32",fill:t.color,style:r}):h.jsx("rect",{width:"64",height:"64",rx:i,ry:i,fill:t.color,style:r}),h.jsx("path",{d:t.path,fill:a})]}))}}const JMo=V7({color:"#7f7f7f",path:"M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z"}),KMo=JMo;function lc(t){const e=Object.entries(t).filter(([,n])=>n!=null).map(([n,o])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);return e.length>0?`?${e.join("&")}`:""}const $Mo=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",qMo=(t,e)=>({left:window.outerWidth/2+(window.screenX||window.screenLeft||0)-t/2,top:window.outerHeight/2+(window.screenY||window.screenTop||0)-e/2}),QMo=(t,e)=>({top:(window.screen.height-e)/2,left:(window.screen.width-t)/2});function ZMo(t,e,n){var o=e,{height:r,width:i}=o,a=aoe(o,["height","width"]);const l=$g({height:r,width:i,location:"no",toolbar:"no",status:"no",directories:"no",menubar:"no",scrollbars:"yes",resizable:"no",centerscreen:"yes",chrome:"yes"},a),s=window.open(t,"",Object.keys(l).map(c=>`${c}=${l[c]}`).join(", "));if(n){const c=window.setInterval(()=>{try{(s===null||s.closed)&&(window.clearInterval(c),n(s))}catch(u){console.error(u)}},1e3)}return s}function eIo(t){var e=t,{beforeOnClick:n,children:o,className:r,disabled:i,disabledStyle:a={opacity:.6},forwardedRef:l,htmlTitle:s,networkLink:c,networkName:u,onClick:d,onShareWindowClose:f,openShareDialogOnClick:p=!0,opts:m,resetButtonStyle:y=!0,style:w,url:x,windowHeight:C=400,windowPosition:P="windowCenter",windowWidth:A=550}=e,S=aoe(e,["beforeOnClick","children","className","disabled","disabledStyle","forwardedRef","htmlTitle","networkLink","networkName","onClick","onShareWindowClose","openShareDialogOnClick","opts","resetButtonStyle","style","url","windowHeight","windowPosition","windowWidth"]);const v=async R=>{const M=c(x,m);if(!i){if(R.preventDefault(),n){const D=n();$Mo(D)&&await D}if(p){const D=$g({height:C,width:A},P==="windowCenter"?qMo(A,C):QMo(A,C));ZMo(M,D,f)}d&&d(R,M)}},b=Bn("react-share__ShareButton",{"react-share__ShareButton--disabled":!!i,disabled:!!i},r),T=$g($g(y?{backgroundColor:"transparent",border:"none",padding:0,font:"inherit",color:"inherit",cursor:"pointer"}:{},w),i&&a);return h.jsx("button",ioe($g({},S),{className:b,onClick:v,ref:l,style:T,title:s,children:o}))}function Nu(t,e,n,o){function r(i,a){const l=n(i),s=$g({},i);return Object.keys(l).forEach(u=>{delete s[u]}),h.jsx(eIo,ioe($g($g({},o),s),{forwardedRef:a,networkName:t,networkLink:e,opts:n(i)}))}return r.displayName=`ShareButton-${t}`,g.forwardRef(r)}function tIo(t,{subject:e,body:n,separator:o}){return"mailto:"+lc({subject:e,body:n?n+o+t:t})}const nIo=Nu("email",tIo,t=>({subject:t.subject,body:t.body,separator:t.separator||" "}),{openShareDialogOnClick:!1,onClick:(t,e)=>{window.location.href=e}}),oIo=nIo,rIo=V7({color:"#0965FE",path:"M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z"}),iIo=rIo;function aIo(t,{appId:e,redirectUri:n,to:o}){return"https://www.facebook.com/dialog/send"+lc({link:t,redirect_uri:n||t,app_id:e,to:o})}Nu("facebookmessenger",aIo,t=>({appId:t.appId,redirectUri:t.redirectUri,to:t.to}),{windowWidth:1e3,windowHeight:820});class lIo extends Error{constructor(e){super(e),this.name="AssertionError"}}function gu(t,e){if(!t)throw new lIo(e)}function sIo(t,{hashtag:e}){return gu(t,"facebook.url"),"https://www.facebook.com/sharer/sharer.php"+lc({u:t,hashtag:e})}const cIo=Nu("facebook",sIo,t=>({hashtag:t.hashtag}),{windowWidth:550,windowHeight:400}),uIo=cIo;function dIo(){const t=g.useRef(!1);return g.useEffect(()=>(t.current=!0,()=>{t.current=!1}),[]),g.useCallback(()=>t.current,[])}function fIo(t){var e=t,{children:n=f=>f,className:o,getCount:r,url:i}=e,a=aoe(e,["children","className","getCount","url"]);const l=dIo(),[s,c]=g.useState(void 0),[u,d]=g.useState(!1);return g.useEffect(()=>{d(!0),r(i,f=>{l()&&(c(f),d(!1))})},[i]),h.jsx("span",ioe($g({className:Bn("react-share__ShareCount",o)},a),{children:!u&&s!==void 0&&n(s)}))}function dT(t){const e=n=>h.jsx(fIo,$g({getCount:t},n));return e.displayName=`ShareCount(${t.name})`,e}function hIo(t,e){const n=`https://graph.facebook.com/?id=${t}&fields=og_object{engagement}`;uT(n,(o,r)=>{e(!o&&r&&r.og_object&&r.og_object.engagement?r.og_object.engagement.count:void 0)})}dT(hIo);function pIo(t,{title:e}){return gu(t,"hatena.url"),`http://b.hatena.ne.jp/add?mode=confirm&url=${t}&title=${e}`}Nu("hatena",pIo,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"});function gIo(t,e){uT("https://bookmark.hatenaapis.com/count/entry"+lc({url:t}),(o,r)=>{e(r??void 0)})}dT(gIo);function mIo(t,{title:e,description:n}){return gu(t,"instapaper.url"),"http://www.instapaper.com/hello2"+lc({url:t,title:e,description:n})}Nu("instapaper",mIo,t=>({title:t.title,description:t.description}),{windowWidth:500,windowHeight:500,windowPosition:"windowCenter"});const yIo=V7({color:"#00b800",path:"M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z"}),AIo=yIo;function wIo(t,{title:e}){return gu(t,"line.url"),"https://social-plugins.line.me/lineit/share"+lc({url:t,text:e})}const xIo=Nu("line",wIo,t=>({title:t.title}),{windowWidth:500,windowHeight:500}),vIo=xIo,bIo=V7({color:"#0077B5",path:"M20.4,44h5.4V26.6h-5.4V44z M23.1,18c-1.7,0-3.1,1.4-3.1,3.1c0,1.7,1.4,3.1,3.1,3.1 c1.7,0,3.1-1.4,3.1-3.1C26.2,19.4,24.8,18,23.1,18z M39.5,26.2c-2.6,0-4.4,1.4-5.1,2.8h-0.1v-2.4h-5.2V44h5.4v-8.6 c0-2.3,0.4-4.5,3.2-4.5c2.8,0,2.8,2.6,2.8,4.6V44H46v-9.5C46,29.8,45,26.2,39.5,26.2z"}),SIo=bIo;function TIo(t,{title:e,summary:n,source:o}){return gu(t,"linkedin.url"),"https://linkedin.com/shareArticle"+lc({url:t,mini:"true",title:e,summary:n,source:o})}const PIo=Nu("linkedin",TIo,({title:t,summary:e,source:n})=>({title:t,summary:e,source:n}),{windowWidth:750,windowHeight:600}),CIo=PIo;function RIo(t,{title:e,description:n}){return gu(t,"livejournal.url"),"https://www.livejournal.com/update.bml"+lc({subject:e,event:n})}Nu("livejournal",RIo,t=>({title:t.title,description:t.description}),{windowWidth:660,windowHeight:460});function HIo(t,{title:e,description:n,imageUrl:o}){return gu(t,"mailru.url"),"https://connect.mail.ru/share"+lc({url:t,title:e,description:n,image_url:o})}Nu("mailru",HIo,t=>({title:t.title,description:t.description,imageUrl:t.imageUrl}),{windowWidth:660,windowHeight:460});function MIo(t,{title:e,description:n,image:o}){return gu(t,"ok.url"),"https://connect.ok.ru/offer"+lc({url:t,title:e,description:n,imageUrl:o})}Nu("ok",MIo,t=>({title:t.title,description:t.description,image:t.image}),{windowWidth:588,windowHeight:480,windowPosition:"screenCenter"});function IIo(t,e){window.OK||(window.OK={Share:{count:function(i,a){var l,s;(s=(l=window.OK.callbacks)[i])==null||s.call(l,a)}},callbacks:[]});const n="https://connect.ok.ru/dk",o=window.OK.callbacks.length;return window.ODKL={updateCount(r,i){var a,l;const s=r===""?0:parseInt(r.replace("react-share-",""),10);(l=(a=window.OK.callbacks)[s])==null||l.call(a,i===""?void 0:parseInt(i,10))}},window.OK.callbacks.push(e),uT(n+lc({"st.cmd":"extLike",uid:`react-share-${o}`,ref:t}))}dT(IIo);function zIo(t,{media:e,description:n,pinId:o}){return o?`https://pinterest.com/pin/${o}/repin/x/`:(gu(t,"pinterest.url"),gu(e,"pinterest.media"),"https://pinterest.com/pin/create/button/"+lc({url:t,media:e,description:n}))}Nu("pinterest",zIo,t=>({media:t.media,description:t.description,pinId:t.pinId}),{windowWidth:1e3,windowHeight:730});function DIo(t,e){uT("https://api.pinterest.com/v1/urls/count.json"+lc({url:t}),(o,r)=>{e(r?r.count:void 0)})}dT(DIo);function EIo(t,{title:e}){return gu(t,"pocket.url"),"https://getpocket.com/save"+lc({url:t,title:e})}Nu("pocket",EIo,t=>({title:t.title}),{windowWidth:500,windowHeight:500});const kIo=V7({color:"#FF5700",path:"M 53.34375 32 C 53.277344 30.160156 52.136719 28.53125 50.429688 27.839844 C 48.722656 27.148438 46.769531 27.523438 45.441406 28.800781 C 41.800781 26.324219 37.519531 24.957031 33.121094 24.863281 L 35.199219 14.878906 L 42.046875 16.320312 C 42.214844 17.882812 43.496094 19.09375 45.066406 19.171875 C 46.636719 19.253906 48.03125 18.183594 48.359375 16.644531 C 48.6875 15.105469 47.847656 13.558594 46.382812 12.992188 C 44.914062 12.425781 43.253906 13.007812 42.464844 14.367188 L 34.625 12.800781 C 34.363281 12.742188 34.09375 12.792969 33.871094 12.9375 C 33.648438 13.082031 33.492188 13.308594 33.441406 13.566406 L 31.070312 24.671875 C 26.617188 24.738281 22.277344 26.105469 18.59375 28.609375 C 17.242188 27.339844 15.273438 26.988281 13.570312 27.707031 C 11.863281 28.429688 10.746094 30.089844 10.71875 31.941406 C 10.691406 33.789062 11.757812 35.484375 13.441406 36.257812 C 13.402344 36.726562 13.402344 37.195312 13.441406 37.664062 C 13.441406 44.832031 21.792969 50.65625 32.097656 50.65625 C 42.398438 50.65625 50.753906 44.832031 50.753906 37.664062 C 50.789062 37.195312 50.789062 36.726562 50.753906 36.257812 C 52.363281 35.453125 53.371094 33.800781 53.34375 32 Z M 21.34375 35.199219 C 21.34375 33.433594 22.777344 32 24.542969 32 C 26.3125 32 27.742188 33.433594 27.742188 35.199219 C 27.742188 36.96875 26.3125 38.398438 24.542969 38.398438 C 22.777344 38.398438 21.34375 36.96875 21.34375 35.199219 Z M 39.9375 44 C 37.664062 45.710938 34.871094 46.582031 32.03125 46.464844 C 29.191406 46.582031 26.398438 45.710938 24.128906 44 C 23.847656 43.65625 23.871094 43.15625 24.183594 42.839844 C 24.5 42.527344 25 42.503906 25.34375 42.785156 C 27.269531 44.195312 29.617188 44.90625 32 44.800781 C 34.386719 44.929688 36.746094 44.242188 38.6875 42.847656 C 39.042969 42.503906 39.605469 42.511719 39.953125 42.863281 C 40.296875 43.21875 40.289062 43.785156 39.9375 44.128906 Z M 39.359375 38.527344 C 37.59375 38.527344 36.160156 37.09375 36.160156 35.328125 C 36.160156 33.5625 37.59375 32.128906 39.359375 32.128906 C 41.128906 32.128906 42.558594 33.5625 42.558594 35.328125 C 42.59375 36.203125 42.269531 37.054688 41.65625 37.6875 C 41.046875 38.316406 40.203125 38.664062 39.328125 38.65625 Z M 39.359375 38.527344"}),FIo=kIo;function LIo(t,{title:e}){return gu(t,"reddit.url"),"https://www.reddit.com/web/submit"+lc({url:t,title:e})}const WIo=Nu("reddit",LIo,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"}),NIo=WIo;function UIo(t,{title:e}){return gu(t,"gab.url"),"https://gab.com/compose"+lc({url:t,text:e})}Nu("gab",UIo,t=>({title:t.title}),{windowWidth:660,windowHeight:640,windowPosition:"windowCenter"});function jIo(t,e){const n=`https://www.reddit.com/api/info.json?limit=1&url=${t}`;uT(n,{param:"jsonp"},(o,r)=>{e(!o&&r&&r.data&&r.data.children.length>0&&r.data.children[0].data.score?r.data.children[0].data.score:void 0)})}dT(jIo);const BIo=V7({color:"#25A3E3",path:"m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957"}),YIo=BIo;function OIo(t,{title:e}){return gu(t,"telegram.url"),"https://telegram.me/share/url"+lc({url:t,text:e})}const _Io=Nu("telegram",OIo,t=>({title:t.title}),{windowWidth:550,windowHeight:400}),VIo=_Io;function GIo(t,{title:e,caption:n,tags:o,posttype:r}){return gu(t,"tumblr.url"),"https://www.tumblr.com/widgets/share/tool"+lc({canonicalUrl:t,title:e,caption:n,tags:o,posttype:r})}Nu("tumblr",GIo,t=>({title:t.title,tags:(t.tags||[]).join(","),caption:t.caption,posttype:t.posttype||"link"}),{windowWidth:660,windowHeight:460});function XIo(t,e){return uT("https://api.tumblr.com/v2/share/stats"+lc({url:t}),(o,r)=>{e(!o&&r&&r.response?r.response.note_count:void 0)})}dT(XIo);function JIo(t,{title:e,via:n,hashtags:o=[],related:r=[]}){return gu(t,"twitter.url"),gu(Array.isArray(o),"twitter.hashtags is not an array"),gu(Array.isArray(r),"twitter.related is not an array"),"https://twitter.com/intent/tweet"+lc({url:t,text:e,via:n,hashtags:o.length>0?o.join(","):void 0,related:r.length>0?r.join(","):void 0})}const KIo=Nu("twitter",JIo,t=>({hashtags:t.hashtags,title:t.title,via:t.via,related:t.related}),{windowWidth:550,windowHeight:400}),$Io=KIo;function qIo(t,{title:e,separator:n}){return gu(t,"viber.url"),"viber://forward"+lc({text:e?e+n+t:t})}Nu("viber",qIo,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:660,windowHeight:460});function QIo(t,{title:e,image:n,noParse:o,noVkLinks:r}){return gu(t,"vk.url"),"https://vk.com/share.php"+lc({url:t,title:e,image:n,noparse:o?1:0,no_vk_links:r?1:0})}Nu("vk",QIo,t=>({title:t.title,image:t.image,noParse:t.noParse,noVkLinks:t.noVkLinks}),{windowWidth:660,windowHeight:460});function ZIo(t,e){window.VK||(window.VK={}),window.VK.Share={count:(r,i)=>{var a,l;return(l=(a=window.VK.callbacks)==null?void 0:a[r])==null?void 0:l.call(a,i)}},window.VK.callbacks=[];const n="https://vk.com/share.php",o=window.VK.callbacks.length;return window.VK.callbacks.push(e),uT(n+lc({act:"count",index:o,url:t}))}dT(ZIo);function ezo(t,{title:e,image:n}){return gu(t,"weibo.url"),"http://service.weibo.com/share/share.php"+lc({url:t,title:e,pic:n})}Nu("weibo",ezo,t=>({title:t.title,image:t.image}),{windowWidth:660,windowHeight:550,windowPosition:"screenCenter"});const tzo=V7({color:"#25D366",path:"m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915"}),nzo=tzo;function ozo(){return/(android|iphone|ipad|mobile)/i.test(navigator.userAgent)}function rzo(t,{title:e,separator:n}){return gu(t,"whatsapp.url"),"https://"+(ozo()?"api":"web")+".whatsapp.com/send"+lc({text:e?e+n+t:t})}const izo=Nu("whatsapp",rzo,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:550,windowHeight:400}),azo=izo;function lzo(t,{quote:e,hashtag:n}){return gu(t,"workplace.url"),"https://work.facebook.com/sharer.php"+lc({u:t,quote:e,hashtag:n})}Nu("workplace",lzo,t=>({quote:t.quote,hashtag:t.hashtag}),{windowWidth:550,windowHeight:400});const szo=V7({color:"#000000",path:"M 41.116 18.375 h 4.962 l -10.8405 12.39 l 12.753 16.86 H 38.005 l -7.821 -10.2255 L 21.235 47.625 H 16.27 l 11.595 -13.2525 L 15.631 18.375 H 25.87 l 7.0695 9.3465 z m -1.7415 26.28 h 2.7495 L 24.376 21.189 H 21.4255 z"}),czo=szo,uzo=ko.div` display: flex; flex-direction: column; z-index: 999; `,dzo=xe.memo(({style:t,size:e,margin:n,round:o,handleShareWindowClose:r})=>{const i=H(Xp),a=H(CS),s=new URLSearchParams(window.location.search).get("userid"),c=Kt(),u=a??B.t("name.Tagline",c),d="aladdinIFI "+(a?B.t("name.Tagline",c):"");let f=k1;return a&&(s?f+="?client=web&userid="+s+"&title="+encodeURIComponent(a):i.uid&&(f+="?client=web&userid="+i.uid+"&title="+encodeURIComponent(a))),h.jsxs(uzo,{style:t,children:[h.jsx(oIo,{url:f,subject:u,children:h.jsx(KMo,{size:e,round:o})}),h.jsx($Io,{url:f,title:u,via:d,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(czo,{size:e,round:o})}),h.jsx(uIo,{url:f,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(iIo,{size:e,round:o})}),h.jsx(NIo,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(FIo,{size:e,round:o})}),h.jsx(VIo,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(YIo,{size:e,round:o})}),h.jsx(vIo,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(AIo,{size:e,round:o})}),h.jsx(CIo,{url:f,title:u,summary:d,source:B.t("name.IFI",c),style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(SIo,{size:e,round:o})}),h.jsx(azo,{url:f,title:u,separator:":: ",onShareWindowClose:r,children:h.jsx(nzo,{size:e,round:o})})]})});class mR{constructor(e,n,o){if(this.fitness=Number.NaN,this.chromosome=new Array(e),this.discretizationSteps=o,n)if(o)for(let r=0;re.fitness?1:this.fitness=this.chromosome.length)throw new Error("Gene index out of bound: "+e);this.chromosome[e]=n}getGene(e){if(e<0||e>=this.chromosome.length)throw new Error("Gene index out of bound: "+e);return this.chromosome[e]}copyGenes(e){const n=Math.min(this.chromosome.length,e.chromosome.length);for(let o=0;on.compare(e))}getNicheCount(e,n){let o=0;for(const r of this.individuals){const i=e.distance(r);let a=0;ie&&(e=o.fitness,n=o);return n}evolve(e,n){this.selectSurvivors(e),this.crossover(n)}selectSurvivors(e){this.survivors=[],this.sort();const n=Math.floor(e*this.individuals.length);for(let o=0;o=r){o=l;break}let a=null;do{r=Math.random()*n,i=0;for(const l of this.survivors)if(i+=l.fitness-e,i>=r){l!==o&&(a=l);break}}while(a===null);return o&&a?new fLe(o,a):null}selectParentsByTournament(){const e=this.survivors.length;if(e<=1)throw new Error("Must have at least two survivors to be used as parents");const n=e-1;let o=Math.floor(Math.random()*n),r;do r=Math.floor(Math.random()*n);while(r===o);const i=this.survivors[o].fitness>this.survivors[r].fitness?o:r;o=Math.floor(Math.random()*n);do r=Math.floor(Math.random()*n);while(r===o);let a=this.survivors[o].fitness>this.survivors[r].fitness?o:r;for(;a===i;){o=Math.floor(Math.random()*n);do r=Math.floor(Math.random()*n);while(r===o);a=this.survivors[o].fitness>this.survivors[r].fitness?o:r}return new fLe(this.survivors[i],this.survivors[a])}mutate(e){if(ye.isZero(e))return;let n=Math.floor(e*(this.individuals.length-1));for(n===0?n=1:n===this.individuals.length-1&&(n=this.individuals.length-2),this.mutants=[];this.mutants.lengthe)return!1}return!0}}class rft{constructor(e,n,o,r,i,a,l,s,c,u){this.fitnessSharingRadius=.1,this.searchMethod=As.GLOBAL_SEARCH_UNIFORM_SELECTION,this.localSearchRadius=.1,this.constraints=[],this.stopped=!0,this.mutationRate=.1,this.crossoverRate=.5,this.selectionRate=.5,this.maximumGenerations=5,this.fittestOfGenerations=[],this.populationOfGenerations=[],this.outsideGenerationCounter=0,this.computeCounter=0,this.converged=!1,this.population=new hLe(o,i,a,u),this.objectiveFunctionType=n,this.convergenceThreshold=l,this.maximumGenerations=r,this.searchMethod=s,this.localSearchRadius=c,this.geneNames=new Array(i),this.foundation=e;const d=e.cx,f=e.cy,p=e.lx,m=e.ly;this.minima=new Array(i),this.maxima=new Array(i);for(let y=0;y=this.maximumGenerations}}class CW{static gaussian(){let e=0,n=0;for(;e===0;)e=Math.random();for(;n===0;)n=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*n)}static twoGaussians(){let e=0,n=0;for(;e===0;)e=Math.random();for(;n===0;)n=Math.random();const o=new Array(2),r=Math.sqrt(-2*Math.log(e)),i=2*Math.PI*n;return o[0]=r*Math.cos(i),o[1]=r*Math.sin(i),o}static poisson(e){let n=0,o=Math.exp(-e),r=o;const i=Math.random();for(;i>r;)n++,o*=e/n,r+=o;return n}}class RW extends rft{constructor(e,n,o,r,i,a,l,s,c){super(n,o,r,i,e.length,a,l,s,c),this.solarPanels=e;const u=this.population.individuals[0];for(const[d,f]of e.entries()){const p=.5*(1+f.tiltAngle/$t);if(u.setGene(d,p),this.searchMethod===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)for(let m=1;m1;)w=CW.gaussian()*this.localSearchRadius+p;y.setGene(d,w)}this.geneNames[d]="Tilt Angle ("+f.id+")"}}applyFittest(){const e=this.population.getFittest();if(e){for(let n=0;n{const t=H(pn),e=H(Qi),n=H(UM)??6,o=H(_M),r=dt(_5),i=dt(fQ),a=H(q3),l=H($3),s=H(RQ),c=dt(hQ),u=H(eU),d=H(HQ),f=H(w4).geneticAlgorithmParams,p=Kt(),m=g.useRef(0),y=g.useRef(!1),w=g.useRef(!1),x=g.useRef(),C=g.useRef(),P=g.useRef(0),A=g.useRef(!1),S=g.useRef([]);g.useEffect(()=>{if(f.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&o===ec.GENETIC_ALGORITHM&&r){v(),m.current=requestAnimationFrame(T);const D=[...S.current];return()=>{cancelAnimationFrame(m.current),y.current||(yn(B.t("message.EvolutionAborted",p)),dt.getState().set(k=>{k.evolutionInProgress=!1}),D.length>0&&(x.current=D,R(!0)))}}},[r]),g.useEffect(()=>{w.current=i,i?(cancelAnimationFrame(m.current),dt.getState().set(D=>{D.evolutionPaused=!0}),yn(B.t("message.EvolutionPaused",p))):(dt.getState().set(D=>{D.evolutionPaused=!1}),T())},[i]);const v=()=>{if(!a)return;dt.getState().set(N=>{N.evolutionInProgress=!0,N.objectiveEvaluationIndex=0}),y.current=!1;const D=l(z.SolarPanel,a.id);S.current.length=0;for(const N of D)S.current.push(JSON.parse(JSON.stringify(N)));x.current=[];const k=[];for(const N of D)x.current.push(JSON.parse(JSON.stringify(N))),k.push(N.label);x.current.length>0?(C.current=new RW(x.current,a,f.objectiveFunctionType,f.populationSize,f.maximumGenerations,f.selectionMethod,f.convergenceThreshold,f.searchMethod,f.localSearchRadius),C.current.selectionRate=f.selectionRate,C.current.crossoverRate=f.crossoverRate,C.current.mutationRate=f.mutationRate,P.current=0,A.current=!1,d(k),C.current.startEvolving(),t(N=>{N.viewState.showEvolutionPanel=!0,N.selectedFloatingWindow="solarPanelOptimizationResult"})):co(B.t("message.EncounterEvolutionError",p))},b=()=>{let D=0;switch(f.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:{const k=In.getState().dailyPvYield;for(const N of k)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(D+=N[U]);break}case Mo.YEARLY_TOTAL_OUTPUT:{const k=In.getState().yearlyPvYield;for(const N of k)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(D+=N[U]);D*=12/n;break}}return D};g.useEffect(()=>{!C.current||!c||(A.current=C.current.evolveIndividual(P.current%f.populationSize,b()),M(),P.current++,C.current.outsideGenerationCounter=Math.floor(P.current/f.populationSize),m.current=requestAnimationFrame(T))},[c]);const T=()=>{if(C.current&&o===ec.GENETIC_ALGORITHM&&r&&!w.current){if(A.current||C.current.outsideGenerationCounter>=f.maximumGenerations){if(cancelAnimationFrame(m.current),y.current=!0,C.current.applyFittest(),M(),R(!0),yn(B.t("message.EvolutionCompleted",p)+` `+(A.current?B.t("message.ConvergenceThresholdHasBeenReached",p):B.t("message.MaximumNumberOfGenerationsHasBeenReached",p))),e&&C.current){const D=C.current.population.getFittest();D&&t(k=>{var N;k.actionInfo={name:"Genetic Algorithm for Solar Panel Tilt Angle Completed",result:RW.individualToString(D),steps:(N=C.current)==null?void 0:N.outsideGenerationCounter,timestamp:new Date().getTime()}})}return}C.current.translateIndividual(P.current%f.populationSize),R(!1)}},R=D=>{dt.getState().set(k=>{if(x.current)switch(f.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:D?k.runDailySimulationForSolarPanelsLastStep=!0:k.runDailySimulationForSolarPanels=!0;break;case Mo.YEARLY_TOTAL_OUTPUT:D?k.runYearlySimulationForSolarPanelsLastStep=!0:k.runYearlySimulationForSolarPanels=!0;break;default:co(B.t("message.ObjectiveFunctionTypeError",p),60)}}),t(k=>{if(x.current){switch(f.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:k.graphState&&(k.graphState.dailyPvIndividualOutputs=!1);break;case Mo.YEARLY_TOTAL_OUTPUT:k.graphState&&(k.graphState.yearlyPvIndividualOutputs=!1);break;default:co(B.t("message.ObjectiveFunctionTypeError",p),60)}for(const N of k.elements)if(N.type===z.SolarPanel){const U=N;for(const W of x.current)if(U.id===W.id){U.tiltAngle=W.tiltAngle;break}}}}),D&&dt.getState().set(k=>{k.runEvolution=!1,k.evolutionInProgress=!1,k.objectiveEvaluationIndex=0})},M=()=>{var k;if(!C.current)return;const D=[];for(let N=0;N0){const E=C.current.populationOfGenerations[N-1];if(E){let L=0;for(let j=0;j0&&D.push(U)}s(D)};return h.jsx(h.Fragment,{})});class hzo extends rft{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y,w,x,C,P,A,S,v,b){if(super(c,u,d,f,3,p,m,y,w),this.orientation=br.landscape,this.rowAxis=Nl.leftRight,this.poleHeight=2,this.poleSpacing=5,this.solarPanelCount=0,this.solarRackCount=0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-$t,this.maximumTiltAngle=$t,this.margin=0,this.polygon=s,this.pvModel=e,this.rowAxis=n,this.orientation=o,this.poleHeight=r,this.poleSpacing=i,this.minimumInterRowSpacing=x,this.maximumInterRowSpacing=C,this.minimumRowsPerRack=P,this.maximumRowsPerRack=A,this.minimumTiltAngle=S,this.maximumTiltAngle=v,this.margin=b,this.setInterRowSpacingBounds(),this.geneNames[0]="Tilt Angle",this.geneNames[1]="Inter-Row Spacing",this.geneNames[2]="Rack Width",a&&a.length>0){const T=a[0];if(a.length>1){const R=this.population.individuals[0],M=this.maximumTiltAngle===this.minimumTiltAngle?0:(T.tiltAngle-this.minimumTiltAngle)/(this.maximumTiltAngle-this.minimumTiltAngle);R.setGene(0,M);const D=a[1],k=l?l.interRowSpacing:this.rowAxis===Nl.upDown?Math.abs(T.cx-D.cx)*this.foundation.lx:Math.abs(T.cy-D.cy)*this.foundation.ly;let N=this.maximumInterRowSpacing===this.minimumInterRowSpacing?0:(k-this.minimumInterRowSpacing)/(this.maximumInterRowSpacing-this.minimumInterRowSpacing);N<0?N=0:N>1&&(N=1),R.setGene(1,N);const U=l?l.rowsPerRack:Math.max(1,Math.round(T.ly/(T.orientation===br.portrait?e.length:e.width)));let W=this.maximumRowsPerRack===this.minimumRowsPerRack?0:(U-this.minimumRowsPerRack)/(this.maximumRowsPerRack-this.minimumRowsPerRack);W<0?W=0:W>1&&(W=1),R.setGene(2,W)}}}setInterRowSpacingBounds(){this.bounds=ye.calculatePolygonBounds(this.polygon.vertices)}applyFittest(){const e=this.population.getFittest();e&&console.log("Fittest: "+this.individualToString(e)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount)}getObjectiveUnit(){switch(this.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:return"kWh";case Mo.YEARLY_PROFIT:case Mo.DAILY_PROFIT:return"dollars"}return null}individualToString(e){let n="F("+ye.toDegrees(e.getGene(0)*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle).toFixed(3)+"°, ";return n+=(e.getGene(1)*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing).toFixed(3)+"m, ",n+=Math.floor(e.getGene(2)*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack)+")",n+" = "+e.fitness.toFixed(5)+" "+this.getObjectiveUnit()}startEvolving(){this.outsideGenerationCounter=0,this.computeCounter=0,this.fittestOfGenerations.fill(null),this.setInterRowSpacingBounds()}translateIndividualByIndex(e){return this.translateIndividual(this.population.individuals[e])}translateBest(){const e=this.population.getFittest();return e?this.translateIndividual(e):[]}translateIndividual(e){if(!this.bounds)return[];const n=e.getGene(0)*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle,o=e.getGene(1)*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing,r=Math.floor(e.getGene(2)*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack),i=ZH.create(this.polygon,this.foundation,this.pvModel,this.orientation,n,r,o,this.rowAxis,this.poleHeight,this.poleSpacing,this.margin);if(this.solarPanelCount=0,this.solarRackCount=i.length,i.length>0)for(const a of i)this.solarPanelCount+=ye.countSolarPanelsOnRack(a,this.pvModel);return i}evolveIndividual(e,n){var r;const o=this.population.individuals.length;if(!this.converged){const i=this.population.individuals[e];i.fitness=n,this.computeCounter===0&&e===0&&(this.fittestOfGenerations[0]=i.getCopy());const a=Math.floor(this.computeCounter/o);console.log("Generation "+(a+1)+", individual "+e+" : "+this.individualToString(i)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount);const l=(r=this.populationOfGenerations[a])==null?void 0:r.individuals[e];if(l){for(let c=0;c{const t=H(pn),e=H(Qi),n=H(UM)??6,o=H(_M),r=dt(_5),i=dt(fQ),a=H($r),l=H(q3),s=H($3),c=H(RQ),u=dt(hQ),d=H(eU),f=H(HQ),p=H(O5),m=H(m5e),y=H(w4).geneticAlgorithmParams,w=H.getState().solarPanelArrayLayoutConstraints,x=H.getState().economicsParams,C=H.getState().solarPanelArrayLayoutParams,P=g.useRef(0),A=g.useRef(!1),S=g.useRef(!1),v=g.useRef(),b=g.useRef(0),T=g.useRef(!1),R=g.useRef([]),M=g.useRef([]),D=Kt(),k=l?a(l):void 0;g.useEffect(()=>{if(o===ec.GENETIC_ALGORITHM&&y.problem===Pi.SOLAR_PANEL_ARRAY&&r){N(),P.current=requestAnimationFrame(W);const L=[...M.current];return()=>{cancelAnimationFrame(P.current),A.current||(yn(B.t("message.EvolutionAborted",D)),dt.getState().set(j=>{j.evolutionInProgress=!1,j.runDailySimulationForSolarPanels=!1,j.runYearlySimulationForSolarPanels=!1}),setTimeout(()=>{R.current.length>0&&m(l.id,!1),L.length>0&&(R.current=L,F(!0))},100))}}},[r]),g.useEffect(()=>{S.current=i,i?(cancelAnimationFrame(P.current),dt.getState().set(L=>{L.evolutionPaused=!0}),yn(B.t("message.EvolutionPaused",D))):(dt.getState().set(L=>{L.evolutionPaused=!1}),W())},[i]);const N=()=>{if(!l||!k)return;dt.getState().set(j=>{j.evolutionInProgress=!0,j.objectiveEvaluationIndex=0}),A.current=!1;const L=s(z.SolarPanel,k.id);M.current.length=0;for(const j of L)M.current.push(JSON.parse(JSON.stringify(j)));v.current=new hzo(p(w.pvModelName??"CS6X-355P-FG"),w.rowAxis??Nl.leftRight,w.orientation??br.landscape,w.poleHeight??1,w.poleSpacing??3,M.current,C,l,k,y.objectiveFunctionType,y.populationSize,y.maximumGenerations,y.selectionMethod,y.convergenceThreshold,y.searchMethod,y.localSearchRadius,w.minimumInterRowSpacing,w.maximumInterRowSpacing,w.minimumRowsPerRack,w.maximumRowsPerRack,w.minimumTiltAngle,w.maximumTiltAngle,w.margin??0),v.current.selectionRate=y.selectionRate,v.current.crossoverRate=y.crossoverRate,v.current.mutationRate=y.mutationRate,b.current=0,T.current=!1,f([...v.current.geneNames]),v.current.startEvolving(),t(j=>{j.viewState.showEvolutionPanel=!0,j.selectedFloatingWindow="solarPanelOptimizationResult"})},U=()=>{var Y;let L=0;switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:{const O=In.getState().dailyPvYield;for(const _ of O)for(const G in _)Object.hasOwn(_,G)&&G==="Total"&&(L+=_[G]);break}case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:{const O=In.getState().yearlyPvYield;for(const _ of O)for(const G in _)Object.hasOwn(_,G)&&G==="Total"&&(L+=_[G]);L*=12/n;break}}const j=(Y=v.current)==null?void 0:Y.solarPanelCount;switch(y.objectiveFunctionType){case Mo.DAILY_AVERAGE_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:j&&(L/=j);break;case Mo.DAILY_PROFIT:L=L*x.electricitySellingPrice,j&&(L-=j*x.operationalCostPerUnit);break;case Mo.YEARLY_PROFIT:L=L*x.electricitySellingPrice,j&&(L-=j*x.operationalCostPerUnit*365);break}return L};g.useEffect(()=>{!v.current||!u||(T.current=v.current.evolveIndividual(b.current%y.populationSize,U()),E(),b.current++,v.current.outsideGenerationCounter=Math.floor(b.current/y.populationSize),P.current=requestAnimationFrame(W))},[u]);const W=()=>{if(v.current&&o===ec.GENETIC_ALGORITHM&&r&&!S.current){if(T.current||v.current.outsideGenerationCounter>=y.maximumGenerations){if(cancelAnimationFrame(P.current),A.current=!0,R.current.length>0&&m(l.id,!1),R.current=v.current.translateBest(),v.current.applyFittest(),E(),F(!0),yn(B.t("message.EvolutionCompleted",D)+` -`+(T.current?B.t("message.ConvergenceThresholdHasBeenReached",D):B.t("message.MaximumNumberOfGenerationsHasBeenReached",D))),v.current){const L=v.current.population.getFittest();if(L){const j=L.getGene(0)*(w.maximumTiltAngle-w.minimumTiltAngle)+w.minimumTiltAngle,Y=L.getGene(1)*(w.maximumInterRowSpacing-w.minimumInterRowSpacing)+w.minimumInterRowSpacing,O=Math.floor(L.getGene(2)*(w.maximumRowsPerRack-w.minimumRowsPerRack)+w.minimumRowsPerRack);t(_=>{_.solarPanelArrayLayoutParams.tiltAngle=j,_.solarPanelArrayLayoutParams.interRowSpacing=Y,_.solarPanelArrayLayoutParams.rowsPerRack=O,_.solarPanelArrayLayoutParams.orientation=w.orientation,_.solarPanelArrayLayoutParams.poleHeight=w.poleHeight}),e&&t(_=>{var G,Q;_.actionInfo={name:"Genetic Algorithm for Solar Panel Array Layout Completed",result:(G=v.current)==null?void 0:G.individualToString(L),steps:(Q=v.current)==null?void 0:Q.outsideGenerationCounter,timestamp:new Date().getTime()}})}}return}m(l.id,!1),setTimeout(()=>{v.current&&(R.current=v.current.translateIndividualByIndex(b.current%y.populationSize)),F(!1)},100)}},F=L=>{dt.getState().set(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:L?j.runDailySimulationForSolarPanelsLastStep=!0:j.runDailySimulationForSolarPanels=!0;break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:L?j.runYearlySimulationForSolarPanelsLastStep=!0:j.runYearlySimulationForSolarPanels=!0;break}}),t(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:j.graphState&&(j.graphState.dailyPvIndividualOutputs=!1);break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:j.graphState&&(j.graphState.yearlyPvIndividualOutputs=!1);break}j.elements.push(...R.current)}),L&&dt.getState().set(j=>{j.runEvolution=!1,j.evolutionInProgress=!1,j.objectiveEvaluationIndex=0})},E=()=>{if(!v.current)return;const L=[];for(let j=0;j0){const G=v.current.populationOfGenerations[j-1];if(G){let Q=0;for(let oe=0;oe0&&L.push(Y)}c(L)};return h.jsx(h.Fragment,{})});class gzo{constructor(e,n){this.fitness=Number.NaN,this.position=new Array,this.velocity=new Array,this.bestPositionOfParticle=new Array;for(let o=0;oe.fitness?1:this.fitnessn.compare(e)),Number.isNaN(this.bestFitness)||this.bestFitnesse)return!1}return!0}}class ift{constructor(e,n,o,r,i,a,l,s,c){this.stopped=!0,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.maximumSteps=5,this.bestPositionOfSteps=[],this.bestFitnessOfSteps=[],this.swarmOfSteps=[],this.outsideStepCounter=0,this.computeCounter=0,this.convergenceThreshold=.1,this.converged=!1,this.searchMethod=As.GLOBAL_SEARCH_UNIFORM_SELECTION,this.localSearchRadius=.1,this.swarm=new pLe(o,a,r),this.objectiveFunctionType=n,this.convergenceThreshold=l,this.searchMethod=s,this.localSearchRadius=c,this.maximumSteps=i,this.foundation=e,this.bestPositionOfSteps=new Array(this.maximumSteps+1),this.bestPositionOfSteps.fill(null),this.bestFitnessOfSteps=new Array(this.maximumSteps+1),this.bestFitnessOfSteps.fill(0),this.swarmOfSteps=new Array(this.maximumSteps);for(let u=0;u=this.maximumSteps}}class HW extends ift{constructor(e,n,o,r,i,a,l,s,c){super(n,o,r,i,a,e.length,l,s,c),this.solarPanels=e;const u=this.swarm.particles[0];for(const[d,f]of e.entries()){const p=.5*(1+f.tiltAngle/$t);if(u.position[d]=p,this.searchMethod===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)for(let m=1;m1;)w=CW.gaussian()*this.localSearchRadius+p;y.position[d]=w}}}applyFittest(){const e=this.swarm.bestPositionOfSwarm;if(e){for(let n=0;ni.fitness&&i.updateBestPosition(),i.fitness=n,this.computeCounter===0&&e===0&&(this.bestPositionOfSteps[0]=[...i.position],this.bestFitnessOfSteps[0]=n);const a=Math.floor(this.computeCounter/o);console.log("Step "+(a+1)+", particle "+e+" : "+HW.particleToString(i.position,n));const l=(r=this.swarmOfSteps[a])==null?void 0:r.particles[e];if(l){for(let c=0;c{const t=H(pn),e=H(Qi),n=H(UM)??6,o=H(_M),r=dt(_5),i=dt(fQ),a=H(q3),l=H($3),s=H(RQ),c=dt(hQ),u=H(eU),d=H(HQ),f=H(w4).particleSwarmOptimizationParams,p=Kt(),m=g.useRef(0),y=g.useRef(!1),w=g.useRef(!1),x=g.useRef(),C=g.useRef(),P=g.useRef(0),A=g.useRef(!1),S=g.useRef([]);g.useEffect(()=>{if(f.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&o===ec.PARTICLE_SWARM_OPTIMIZATION&&r){v(),m.current=requestAnimationFrame(T);const D=[...S.current];return()=>{cancelAnimationFrame(m.current),y.current||(yn(B.t("message.EvolutionAborted",p)),dt.getState().set(k=>{k.evolutionInProgress=!1}),D.length>0&&(x.current=D,R(!0)))}}},[r]),g.useEffect(()=>{w.current=i,i?(cancelAnimationFrame(m.current),dt.getState().set(D=>{D.evolutionPaused=!0}),yn(B.t("message.EvolutionPaused",p))):(dt.getState().set(D=>{D.evolutionPaused=!1}),T())},[i]);const v=()=>{if(!a)return;dt.getState().set(N=>{N.evolutionInProgress=!0,N.objectiveEvaluationIndex=0}),y.current=!1;const D=l(z.SolarPanel,a.id);S.current.length=0;for(const N of D)S.current.push(JSON.parse(JSON.stringify(N)));x.current=[];const k=[];for(const N of D)x.current.push(JSON.parse(JSON.stringify(N))),k.push(N.label);x.current.length>0?(C.current=new HW(x.current,a,f.objectiveFunctionType,f.swarmSize,f.vmax,f.maximumSteps,f.convergenceThreshold,f.searchMethod,f.localSearchRadius),C.current.inertia=f.inertia,C.current.cognitiveCoefficient=f.cognitiveCoefficient,C.current.socialCoefficient=f.socialCoefficient,P.current=0,A.current=!1,d(k),C.current.startEvolving(),t(N=>{N.viewState.showEvolutionPanel=!0,N.selectedFloatingWindow="solarPanelOptimizationResult"})):co(B.t("message.EncounterEvolutionError",p))},b=()=>{let D=0;switch(f.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:{const k=In.getState().dailyPvYield;for(const N of k)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(D+=N[U]);break}case Mo.YEARLY_TOTAL_OUTPUT:{const k=In.getState().yearlyPvYield;for(const N of k)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(D+=N[U]);D*=12/n;break}}return D};g.useEffect(()=>{!C.current||!c||(A.current=C.current.updateParticle(P.current%f.swarmSize,b()),M(),P.current++,C.current.outsideStepCounter=Math.floor(P.current/f.swarmSize),m.current=requestAnimationFrame(T))},[c]);const T=()=>{if(C.current&&o===ec.PARTICLE_SWARM_OPTIMIZATION&&r&&!w.current){if(A.current||C.current.outsideStepCounter>=f.maximumSteps){if(cancelAnimationFrame(m.current),y.current=!0,C.current.applyFittest(),M(),R(!0),yn(B.t("message.EvolutionCompleted",p)+` +`+(T.current?B.t("message.ConvergenceThresholdHasBeenReached",D):B.t("message.MaximumNumberOfGenerationsHasBeenReached",D))),v.current){const L=v.current.population.getFittest();if(L){const j=L.getGene(0)*(w.maximumTiltAngle-w.minimumTiltAngle)+w.minimumTiltAngle,Y=L.getGene(1)*(w.maximumInterRowSpacing-w.minimumInterRowSpacing)+w.minimumInterRowSpacing,O=Math.floor(L.getGene(2)*(w.maximumRowsPerRack-w.minimumRowsPerRack)+w.minimumRowsPerRack);t(_=>{_.solarPanelArrayLayoutParams.tiltAngle=j,_.solarPanelArrayLayoutParams.interRowSpacing=Y,_.solarPanelArrayLayoutParams.rowsPerRack=O,_.solarPanelArrayLayoutParams.orientation=w.orientation,_.solarPanelArrayLayoutParams.poleHeight=w.poleHeight}),e&&t(_=>{var G,Q;_.actionInfo={name:"Genetic Algorithm for Solar Panel Array Layout Completed",result:(G=v.current)==null?void 0:G.individualToString(L),steps:(Q=v.current)==null?void 0:Q.outsideGenerationCounter,timestamp:new Date().getTime()}})}}return}m(l.id,!1),setTimeout(()=>{v.current&&(R.current=v.current.translateIndividualByIndex(b.current%y.populationSize)),F(!1)},100)}},F=L=>{dt.getState().set(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:L?j.runDailySimulationForSolarPanelsLastStep=!0:j.runDailySimulationForSolarPanels=!0;break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:L?j.runYearlySimulationForSolarPanelsLastStep=!0:j.runYearlySimulationForSolarPanels=!0;break}}),t(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:j.graphState&&(j.graphState.dailyPvIndividualOutputs=!1);break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:j.graphState&&(j.graphState.yearlyPvIndividualOutputs=!1);break}j.elements.push(...R.current)}),L&&dt.getState().set(j=>{j.runEvolution=!1,j.evolutionInProgress=!1,j.objectiveEvaluationIndex=0})},E=()=>{if(!v.current)return;const L=[];for(let j=0;j0){const G=v.current.populationOfGenerations[j-1];if(G){let Q=0;for(let oe=0;oe0&&L.push(Y)}c(L)};return h.jsx(h.Fragment,{})});class gzo{constructor(e,n){this.fitness=Number.NaN,this.position=new Array,this.velocity=new Array,this.bestPositionOfParticle=new Array;for(let o=0;oe.fitness?1:this.fitnessn.compare(e)),Number.isNaN(this.bestFitness)||this.bestFitnesse)return!1}return!0}}class ift{constructor(e,n,o,r,i,a,l,s,c){this.stopped=!0,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.maximumSteps=5,this.bestPositionOfSteps=[],this.bestFitnessOfSteps=[],this.swarmOfSteps=[],this.outsideStepCounter=0,this.computeCounter=0,this.convergenceThreshold=.1,this.converged=!1,this.searchMethod=As.GLOBAL_SEARCH_UNIFORM_SELECTION,this.localSearchRadius=.1,this.swarm=new pLe(o,a,r),this.objectiveFunctionType=n,this.convergenceThreshold=l,this.searchMethod=s,this.localSearchRadius=c,this.maximumSteps=i,this.foundation=e,this.bestPositionOfSteps=new Array(this.maximumSteps+1),this.bestPositionOfSteps.fill(null),this.bestFitnessOfSteps=new Array(this.maximumSteps+1),this.bestFitnessOfSteps.fill(0),this.swarmOfSteps=new Array(this.maximumSteps);for(let u=0;u=this.maximumSteps}}class HW extends ift{constructor(e,n,o,r,i,a,l,s,c){super(n,o,r,i,a,e.length,l,s,c),this.solarPanels=e;const u=this.swarm.particles[0];for(const[d,f]of e.entries()){const p=.5*(1+f.tiltAngle/$t);if(u.position[d]=p,this.searchMethod===As.LOCAL_SEARCH_RANDOM_OPTIMIZATION)for(let m=1;m1;)w=CW.gaussian()*this.localSearchRadius+p;y.position[d]=w}}}applyFittest(){const e=this.swarm.bestPositionOfSwarm;if(e){for(let n=0;ni.fitness&&i.updateBestPosition(),i.fitness=n,this.computeCounter===0&&e===0&&(this.bestPositionOfSteps[0]=[...i.position],this.bestFitnessOfSteps[0]=n);const a=Math.floor(this.computeCounter/o);console.log("Step "+(a+1)+", particle "+e+" : "+HW.particleToString(i.position,n));const l=(r=this.swarmOfSteps[a])==null?void 0:r.particles[e];if(l){for(let c=0;c{const t=H(pn),e=H(Qi),n=H(UM)??6,o=H(_M),r=dt(_5),i=dt(fQ),a=H(q3),l=H($3),s=H(RQ),c=dt(hQ),u=H(eU),d=H(HQ),f=H(w4).particleSwarmOptimizationParams,p=Kt(),m=g.useRef(0),y=g.useRef(!1),w=g.useRef(!1),x=g.useRef(),C=g.useRef(),P=g.useRef(0),A=g.useRef(!1),S=g.useRef([]);g.useEffect(()=>{if(f.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&o===ec.PARTICLE_SWARM_OPTIMIZATION&&r){v(),m.current=requestAnimationFrame(T);const D=[...S.current];return()=>{cancelAnimationFrame(m.current),y.current||(yn(B.t("message.EvolutionAborted",p)),dt.getState().set(k=>{k.evolutionInProgress=!1}),D.length>0&&(x.current=D,R(!0)))}}},[r]),g.useEffect(()=>{w.current=i,i?(cancelAnimationFrame(m.current),dt.getState().set(D=>{D.evolutionPaused=!0}),yn(B.t("message.EvolutionPaused",p))):(dt.getState().set(D=>{D.evolutionPaused=!1}),T())},[i]);const v=()=>{if(!a)return;dt.getState().set(N=>{N.evolutionInProgress=!0,N.objectiveEvaluationIndex=0}),y.current=!1;const D=l(z.SolarPanel,a.id);S.current.length=0;for(const N of D)S.current.push(JSON.parse(JSON.stringify(N)));x.current=[];const k=[];for(const N of D)x.current.push(JSON.parse(JSON.stringify(N))),k.push(N.label);x.current.length>0?(C.current=new HW(x.current,a,f.objectiveFunctionType,f.swarmSize,f.vmax,f.maximumSteps,f.convergenceThreshold,f.searchMethod,f.localSearchRadius),C.current.inertia=f.inertia,C.current.cognitiveCoefficient=f.cognitiveCoefficient,C.current.socialCoefficient=f.socialCoefficient,P.current=0,A.current=!1,d(k),C.current.startEvolving(),t(N=>{N.viewState.showEvolutionPanel=!0,N.selectedFloatingWindow="solarPanelOptimizationResult"})):co(B.t("message.EncounterEvolutionError",p))},b=()=>{let D=0;switch(f.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:{const k=In.getState().dailyPvYield;for(const N of k)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(D+=N[U]);break}case Mo.YEARLY_TOTAL_OUTPUT:{const k=In.getState().yearlyPvYield;for(const N of k)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(D+=N[U]);D*=12/n;break}}return D};g.useEffect(()=>{!C.current||!c||(A.current=C.current.updateParticle(P.current%f.swarmSize,b()),M(),P.current++,C.current.outsideStepCounter=Math.floor(P.current/f.swarmSize),m.current=requestAnimationFrame(T))},[c]);const T=()=>{if(C.current&&o===ec.PARTICLE_SWARM_OPTIMIZATION&&r&&!w.current){if(A.current||C.current.outsideStepCounter>=f.maximumSteps){if(cancelAnimationFrame(m.current),y.current=!0,C.current.applyFittest(),M(),R(!0),yn(B.t("message.EvolutionCompleted",p)+` `+(A.current?B.t("message.ConvergenceThresholdHasBeenReached",p):B.t("message.MaximumNumberOfStepsHasBeenReached",p))),e&&C.current){const D=C.current.swarm.bestPositionOfSwarm,k=C.current.swarm.bestFitness;D&&k&&t(N=>{var U;N.actionInfo={name:"Particle Swarm Optimization for Solar Panel Tilt Angle Completed",result:HW.particleToString(D,k),steps:(U=C.current)==null?void 0:U.outsideStepCounter,timestamp:new Date().getTime()}})}return}C.current.translateParticle(P.current%f.swarmSize),R(!1)}},R=D=>{dt.getState().set(k=>{if(x.current)switch(f.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:D?k.runDailySimulationForSolarPanelsLastStep=!0:k.runDailySimulationForSolarPanels=!0;break;case Mo.YEARLY_TOTAL_OUTPUT:D?k.runYearlySimulationForSolarPanelsLastStep=!0:k.runYearlySimulationForSolarPanels=!0;break}}),t(k=>{if(x.current){switch(f.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:k.graphState&&(k.graphState.dailyPvIndividualOutputs=!1);break;case Mo.YEARLY_TOTAL_OUTPUT:k.graphState&&(k.graphState.yearlyPvIndividualOutputs=!1);break}for(const N of k.elements)if(N.type===z.SolarPanel){const U=N;for(const W of x.current)if(U.id===W.id){U.tiltAngle=W.tiltAngle;break}}}}),D&&dt.getState().set(k=>{k.runEvolution=!1,k.evolutionInProgress=!1,k.objectiveEvaluationIndex=0})},M=()=>{var k;if(!C.current)return;const D=[];for(let N=0;N0){const E=C.current.swarmOfSteps[N-1];if(E){let L=0;for(let j=0;j0&&D.push(U)}s(D)};return h.jsx(h.Fragment,{})});class yzo extends ift{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,m,y,w,x,C,P,A,S,v,b){if(super(c,u,d,f,p,3,m,y,w),this.orientation=br.landscape,this.rowAxis=Nl.leftRight,this.relativeMargin=.01,this.poleHeight=2,this.poleSpacing=5,this.solarPanelCount=0,this.solarRackCount=0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-$t,this.maximumTiltAngle=$t,this.margin=0,this.polygon=s,this.pvModel=e,this.rowAxis=n,this.orientation=o,this.poleHeight=r,this.poleSpacing=i,this.minimumInterRowSpacing=x,this.maximumInterRowSpacing=C,this.minimumRowsPerRack=P,this.maximumRowsPerRack=A,this.minimumTiltAngle=S,this.maximumTiltAngle=v,this.margin=b,this.setInterRowSpacingBounds(),a&&a.length>0){const T=a[0];if(a.length>1){const R=this.swarm.particles[0];R.position[0]=this.maximumTiltAngle===this.minimumTiltAngle?0:(T.tiltAngle-this.minimumTiltAngle)/(this.maximumTiltAngle-this.minimumTiltAngle);const M=a[1],D=l?l.interRowSpacing:this.rowAxis===Nl.upDown?Math.abs(T.cx-M.cx)*this.foundation.lx:Math.abs(T.cy-M.cy)*this.foundation.ly;let k=this.maximumInterRowSpacing===this.minimumInterRowSpacing?0:(D-this.minimumInterRowSpacing)/(this.maximumInterRowSpacing-this.minimumInterRowSpacing);k<0?k=0:k>1&&(k=1),R.position[1]=k;const N=l?l.rowsPerRack:Math.max(1,Math.round(T.ly/(T.orientation===br.portrait?e.length:e.width)));let U=this.maximumRowsPerRack===this.minimumRowsPerRack?0:(N-this.minimumRowsPerRack)/(this.maximumRowsPerRack-this.minimumRowsPerRack);U<0?U=0:U>1&&(U=1),R.position[2]=U}}}setInterRowSpacingBounds(){this.bounds=ye.calculatePolygonBounds(this.polygon.vertices)}applyFittest(){this.swarm.bestPositionOfSwarm&&console.log("Best: "+this.particleToString(this.swarm.bestPositionOfSwarm,this.swarm.bestFitness)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount)}getObjectiveUnit(){switch(this.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:return"kWh";case Mo.YEARLY_PROFIT:case Mo.DAILY_PROFIT:return"dollars"}return null}particleToString(e,n){let o="F("+ye.toDegrees(e[0]*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle).toFixed(3)+"°, ";return o+=(e[1]*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing).toFixed(3)+"m, ",o+=Math.floor(e[2]*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack)+")",o+" = "+n.toFixed(5)+" "+this.getObjectiveUnit()}startEvolving(){this.outsideStepCounter=0,this.computeCounter=0,this.bestPositionOfSteps.fill(null),this.bestFitnessOfSteps.fill(0),this.setInterRowSpacingBounds()}translateParticleByIndex(e){return this.translatePosition(this.swarm.particles[e].position)}translateBest(){return this.swarm.bestPositionOfSwarm?this.translatePosition(this.swarm.bestPositionOfSwarm):[]}translatePosition(e){if(!this.bounds)return[];const n=e[0]*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle,o=e[1]*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing,r=Math.floor(e[2]*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack),i=ZH.create(this.polygon,this.foundation,this.pvModel,this.orientation,n,r,o,this.rowAxis,this.poleHeight,this.poleSpacing,this.margin);if(this.solarPanelCount=0,this.solarRackCount=i.length,i.length>0)for(const a of i)this.solarPanelCount+=ye.countSolarPanelsOnRack(a,this.pvModel);return i}updateParticle(e,n){var r;const o=this.swarm.particles.length;if(!this.converged){const i=this.swarm.particles[e];i.fitness=n,this.computeCounter===0&&e===0&&(this.bestPositionOfSteps[0]=[...i.position],this.bestFitnessOfSteps[0]=n);const a=Math.floor(this.computeCounter/o);console.log("Step "+(a+1)+", particle "+e+" : "+this.particleToString(i.position,n)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount);const l=(r=this.swarmOfSteps[a])==null?void 0:r.particles[e];if(l){for(let c=0;c{const t=H(pn),e=H(Qi),n=H(UM)??6,o=H(_M),r=dt(_5),i=dt(fQ),a=H($r),l=H(q3),s=H($3),c=H(O5),u=H(m5e),d=H(RQ),f=dt(hQ),p=H(eU),m=H(HQ),y=H(w4).particleSwarmOptimizationParams,w=H.getState().solarPanelArrayLayoutConstraints,x=H.getState().economicsParams,C=H.getState().solarPanelArrayLayoutParams,P=g.useRef(0),A=g.useRef(!1),S=g.useRef(!1),v=g.useRef(),b=g.useRef(0),T=g.useRef(!1),R=g.useRef([]),M=g.useRef([]),D=Kt(),k=l?a(l):void 0;g.useEffect(()=>{if(o===ec.PARTICLE_SWARM_OPTIMIZATION&&y.problem===Pi.SOLAR_PANEL_ARRAY&&r){N(),P.current=requestAnimationFrame(W);const L=[...M.current];return()=>{cancelAnimationFrame(P.current),A.current||(yn(B.t("message.EvolutionAborted",D)),dt.getState().set(j=>{j.evolutionInProgress=!1,j.runDailySimulationForSolarPanels=!1,j.runYearlySimulationForSolarPanels=!1}),setTimeout(()=>{R.current.length>0&&u(l.id,!1),L.length>0&&(R.current=L,F(!0))},100))}}},[r]),g.useEffect(()=>{S.current=i,i?(cancelAnimationFrame(P.current),dt.getState().set(L=>{L.evolutionPaused=!0}),yn(B.t("message.EvolutionPaused",D))):(dt.getState().set(L=>{L.evolutionPaused=!1}),W())},[i]);const N=()=>{if(!l||!k)return;dt.getState().set(j=>{j.evolutionInProgress=!0,j.objectiveEvaluationIndex=0}),A.current=!1;const L=s(z.SolarPanel,k.id);M.current.length=0;for(const j of L)M.current.push(JSON.parse(JSON.stringify(j)));v.current=new yzo(c(w.pvModelName??"CS6X-355P-FG"),w.rowAxis??Nl.leftRight,w.orientation??br.landscape,w.poleHeight??1,w.poleSpacing??3,M.current,C,l,k,y.objectiveFunctionType,y.swarmSize,y.vmax,y.maximumSteps,y.convergenceThreshold,y.searchMethod,y.localSearchRadius,w.minimumInterRowSpacing,w.maximumInterRowSpacing,w.minimumRowsPerRack,w.maximumRowsPerRack,w.minimumTiltAngle,w.maximumTiltAngle,w.margin??0),v.current.inertia=y.inertia,v.current.cognitiveCoefficient=y.cognitiveCoefficient,v.current.socialCoefficient=y.socialCoefficient,b.current=0,T.current=!1,m(["Tilt Angle","Inter-Row Spacing","Rack Width"]),v.current.startEvolving(),t(j=>{j.viewState.showEvolutionPanel=!0,j.selectedFloatingWindow="solarPanelOptimizationResult"})},U=()=>{var Y;let L=0;switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:{const O=In.getState().dailyPvYield;for(const _ of O)for(const G in _)Object.hasOwn(_,G)&&G==="Total"&&(L+=_[G]);break}case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:{const O=In.getState().yearlyPvYield;for(const _ of O)for(const G in _)Object.hasOwn(_,G)&&G==="Total"&&(L+=_[G]);L*=12/n;break}}const j=(Y=v.current)==null?void 0:Y.solarPanelCount;switch(y.objectiveFunctionType){case Mo.DAILY_AVERAGE_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:j&&(L/=j);break;case Mo.DAILY_PROFIT:L=L*x.electricitySellingPrice,j&&(L-=j*x.operationalCostPerUnit);break;case Mo.YEARLY_PROFIT:L=L*x.electricitySellingPrice,j&&(L-=j*x.operationalCostPerUnit*365);break}return L};g.useEffect(()=>{!v.current||!f||(T.current=v.current.updateParticle(b.current%y.swarmSize,U()),E(),b.current++,v.current.outsideStepCounter=Math.floor(b.current/y.swarmSize),P.current=requestAnimationFrame(W))},[f]);const W=()=>{if(v.current&&o===ec.PARTICLE_SWARM_OPTIMIZATION&&r&&!S.current){if(T.current||v.current.outsideStepCounter>=y.maximumSteps){if(cancelAnimationFrame(P.current),A.current=!0,R.current.length>0&&u(l.id,!1),R.current=v.current.translateBest(),v.current.applyFittest(),E(),F(!0),yn(B.t("message.EvolutionCompleted",D)+` -`+(T.current?B.t("message.ConvergenceThresholdHasBeenReached",D):B.t("message.MaximumNumberOfStepsHasBeenReached",D))),v.current){const L=v.current.swarm.bestPositionOfSwarm,j=v.current.swarm.bestFitness;if(L&&j){const Y=L[0]*(w.maximumTiltAngle-w.minimumTiltAngle)+w.minimumTiltAngle,O=L[1]*(w.maximumInterRowSpacing-w.minimumInterRowSpacing)+w.minimumInterRowSpacing,_=Math.floor(L[2]*(w.maximumRowsPerRack-w.minimumRowsPerRack)+w.minimumRowsPerRack);t(G=>{G.solarPanelArrayLayoutParams.tiltAngle=Y,G.solarPanelArrayLayoutParams.interRowSpacing=O,G.solarPanelArrayLayoutParams.rowsPerRack=_,G.solarPanelArrayLayoutParams.orientation=w.orientation,G.solarPanelArrayLayoutParams.poleHeight=w.poleHeight}),e&&t(G=>{var Q,oe;G.actionInfo={name:"Particle Swarm Optimization for Solar Panel Array Layout Completed",result:(Q=v.current)==null?void 0:Q.particleToString(L,j),steps:(oe=v.current)==null?void 0:oe.outsideStepCounter,timestamp:new Date().getTime()}})}}return}u(l.id,!1),setTimeout(()=>{v.current&&(R.current=v.current.translateParticleByIndex(b.current%y.swarmSize)),F(!1)},100)}},F=L=>{dt.getState().set(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:L?j.runDailySimulationForSolarPanelsLastStep=!0:j.runDailySimulationForSolarPanels=!0;break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:L?j.runYearlySimulationForSolarPanelsLastStep=!0:j.runYearlySimulationForSolarPanels=!0;break}}),t(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:j.graphState&&(j.graphState.dailyPvIndividualOutputs=!1);break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:j.graphState&&(j.graphState.yearlyPvIndividualOutputs=!1);break}j.elements.push(...R.current)}),L&&dt.getState().set(j=>{j.runEvolution=!1,j.evolutionInProgress=!1,j.objectiveEvaluationIndex=0})},E=()=>{if(!v.current)return;const L=[];for(let j=0;j0){const G=v.current.swarmOfSteps[j-1];if(G){let Q=0;for(let oe=0;oe0&&L.push(Y)}d(L)};return h.jsx(h.Fragment,{})}),wzo=xe.memo(()=>{const t=H(bQ),e=H(TQ),n=H(PQ),{gl:o}=ti();return o.domElement.style.cursor=t!==z.None||n||e?"crosshair":"default",null}),py=()=>{dt.getState().set(t=>{t.showSolarRadiationHeatmap=!1,t.showHeatFluxes=!1})},xzo=xe.memo(({width:t=400,height:e=400})=>{const n=H(pn),o=H(Fn),r=H(tu),i=H(TS),a=H(X2e),l=H(uSt),s=H(WGe),[c,u]=g.useState(null),d=100,f=g.useCallback(P=>{u(P)},[]),p=g.useCallback(function(){u(null)},[]),m=()=>{const P=new google.maps.LatLng(r,i);new google.maps.Geocoder().geocode({location:P},function(A,S){if(S===google.maps.GeocoderStatus.OK&&A&&A[0].address_components){n(v=>{v.world.address=A[0].formatted_address});for(const v of A[0].address_components)if(v.types[0]==="country"){n(b=>{b.world.countryCode=v.short_name});break}}})},y=A3.throttle(()=>{if(c){const P=c.getCenter();if(P){const A=P.lat(),S=P.lng();if(A!==r||S!==i){m();const v={name:"Set Location",timestamp:Date.now(),oldLatitude:r,newLatitude:A,oldLongitude:i,newLongitude:S,undo:()=>{py(),n(b=>{b.world.latitude=v.oldLatitude,b.world.longitude=v.oldLongitude})},redo:()=>{py(),n(b=>{b.world.latitude=v.newLatitude,b.world.longitude=v.newLongitude})}};o(v),py(),n(b=>{b.world.latitude=A,b.world.longitude=S})}}}},d,{leading:!1,trailing:!0}),w=A3.throttle(()=>{if(c){const P=c.getZoom();if(P!==void 0&&P!==a){m();const A={name:"Zoom Map",timestamp:Date.now(),oldValue:a,newValue:P,undo:()=>{n(S=>{S.viewState.mapZoom=A.oldValue})},redo:()=>{n(S=>{S.viewState.mapZoom=A.newValue})}};o(A),n(S=>{S.viewState.mapZoom=P})}}},d,{leading:!1,trailing:!0}),x=()=>{if(c){const P=c.getTilt();if(P!==void 0&&P!==l){const A={name:"Tilt Map",timestamp:Date.now(),oldValue:l,newValue:P,undo:()=>{n(S=>{S.viewState.mapTilt=A.oldValue})},redo:()=>{n(S=>{S.viewState.mapTilt=A.newValue})}};o(A),n(S=>{S.viewState.mapTilt=P})}}},C=()=>{if(c){const P=c.getMapTypeId();if(P!==void 0&&P!==s){const A={name:"Change Map Type",timestamp:Date.now(),oldValue:s,newValue:P,undo:()=>{n(S=>{S.viewState.mapType=A.oldValue,S.viewState.groundImageType=S.viewState.mapType})},redo:()=>{n(S=>{S.viewState.mapType=A.newValue,S.viewState.groundImageType=S.viewState.mapType})}};o(A),n(S=>{S.viewState.mapType=P,S.viewState.groundImageType=P})}}};return h.jsx(r0t,{mapContainerStyle:{border:"1px solid",width:t+"px",height:e+"px"},mapTypeId:s,center:{lat:r,lng:i},zoom:a,tilt:l,onLoad:f,onUnmount:p,onCenterChanged:y,onZoomChanged:w,onTiltChanged:x,onMapTypeIdChanged:C})}),vzo=["places"],bzo=ko.div` +`+(T.current?B.t("message.ConvergenceThresholdHasBeenReached",D):B.t("message.MaximumNumberOfStepsHasBeenReached",D))),v.current){const L=v.current.swarm.bestPositionOfSwarm,j=v.current.swarm.bestFitness;if(L&&j){const Y=L[0]*(w.maximumTiltAngle-w.minimumTiltAngle)+w.minimumTiltAngle,O=L[1]*(w.maximumInterRowSpacing-w.minimumInterRowSpacing)+w.minimumInterRowSpacing,_=Math.floor(L[2]*(w.maximumRowsPerRack-w.minimumRowsPerRack)+w.minimumRowsPerRack);t(G=>{G.solarPanelArrayLayoutParams.tiltAngle=Y,G.solarPanelArrayLayoutParams.interRowSpacing=O,G.solarPanelArrayLayoutParams.rowsPerRack=_,G.solarPanelArrayLayoutParams.orientation=w.orientation,G.solarPanelArrayLayoutParams.poleHeight=w.poleHeight}),e&&t(G=>{var Q,oe;G.actionInfo={name:"Particle Swarm Optimization for Solar Panel Array Layout Completed",result:(Q=v.current)==null?void 0:Q.particleToString(L,j),steps:(oe=v.current)==null?void 0:oe.outsideStepCounter,timestamp:new Date().getTime()}})}}return}u(l.id,!1),setTimeout(()=>{v.current&&(R.current=v.current.translateParticleByIndex(b.current%y.swarmSize)),F(!1)},100)}},F=L=>{dt.getState().set(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:L?j.runDailySimulationForSolarPanelsLastStep=!0:j.runDailySimulationForSolarPanels=!0;break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:L?j.runYearlySimulationForSolarPanelsLastStep=!0:j.runYearlySimulationForSolarPanels=!0;break}}),t(j=>{switch(y.objectiveFunctionType){case Mo.DAILY_TOTAL_OUTPUT:case Mo.DAILY_AVERAGE_OUTPUT:case Mo.DAILY_PROFIT:j.graphState&&(j.graphState.dailyPvIndividualOutputs=!1);break;case Mo.YEARLY_TOTAL_OUTPUT:case Mo.YEARLY_AVERAGE_OUTPUT:case Mo.YEARLY_PROFIT:j.graphState&&(j.graphState.yearlyPvIndividualOutputs=!1);break}j.elements.push(...R.current)}),L&&dt.getState().set(j=>{j.runEvolution=!1,j.evolutionInProgress=!1,j.objectiveEvaluationIndex=0})},E=()=>{if(!v.current)return;const L=[];for(let j=0;j0){const G=v.current.swarmOfSteps[j-1];if(G){let Q=0;for(let oe=0;oe0&&L.push(Y)}d(L)};return h.jsx(h.Fragment,{})}),wzo=xe.memo(()=>{const t=H(bQ),e=H(TQ),n=H(PQ),{gl:o}=ti();return o.domElement.style.cursor=t!==z.None||n||e?"crosshair":"default",null}),py=()=>{dt.getState().set(t=>{t.showSolarRadiationHeatmap=!1,t.showHeatFluxes=!1})},xzo=xe.memo(({width:t=400,height:e=400})=>{const n=H(pn),o=H(Fn),r=H(tu),i=H(TS),a=H(X2e),l=H(uSt),s=H(WGe),[c,u]=g.useState(null),d=100,f=g.useCallback(P=>{u(P)},[]),p=g.useCallback(function(){u(null)},[]),m=()=>{const P=new google.maps.LatLng(r,i);new google.maps.Geocoder().geocode({location:P},function(A,S){if(S===google.maps.GeocoderStatus.OK&&A&&A[0].address_components){n(v=>{v.world.address=A[0].formatted_address});for(const v of A[0].address_components)if(v.types[0]==="country"){n(b=>{b.world.countryCode=v.short_name});break}}})},y=A3.throttle(()=>{if(c){const P=c.getCenter();if(P){const A=P.lat(),S=P.lng();if(A!==r||S!==i){m();const v={name:"Set Location",timestamp:Date.now(),oldLatitude:r,newLatitude:A,oldLongitude:i,newLongitude:S,undo:()=>{py(),n(b=>{b.world.latitude=v.oldLatitude,b.world.longitude=v.oldLongitude})},redo:()=>{py(),n(b=>{b.world.latitude=v.newLatitude,b.world.longitude=v.newLongitude})}};o(v),py(),n(b=>{b.world.latitude=A,b.world.longitude=S})}}}},d,{leading:!1,trailing:!0}),w=A3.throttle(()=>{if(c){const P=c.getZoom();if(P!==void 0&&P!==a){m();const A={name:"Zoom Map",timestamp:Date.now(),oldValue:a,newValue:P,undo:()=>{n(S=>{S.viewState.mapZoom=A.oldValue})},redo:()=>{n(S=>{S.viewState.mapZoom=A.newValue})}};o(A),n(S=>{S.viewState.mapZoom=P})}}},d,{leading:!1,trailing:!0}),x=()=>{if(c){const P=c.getTilt();if(P!==void 0&&P!==l){const A={name:"Tilt Map",timestamp:Date.now(),oldValue:l,newValue:P,undo:()=>{n(S=>{S.viewState.mapTilt=A.oldValue})},redo:()=>{n(S=>{S.viewState.mapTilt=A.newValue})}};o(A),n(S=>{S.viewState.mapTilt=P})}}},C=()=>{if(c){const P=c.getMapTypeId();if(P!==void 0&&P!==s){const A={name:"Change Map Type",timestamp:Date.now(),oldValue:s,newValue:P,undo:()=>{n(S=>{S.viewState.mapType=A.oldValue,S.viewState.groundImageType=S.viewState.mapType})},redo:()=>{n(S=>{S.viewState.mapType=A.newValue,S.viewState.groundImageType=S.viewState.mapType})}};o(A),n(S=>{S.viewState.mapType=P,S.viewState.groundImageType=P})}}};return h.jsx(r0t,{mapContainerStyle:{border:"1px solid",width:t+"px",height:e+"px"},mapTypeId:s,center:{lat:r,lng:i},zoom:a,tilt:l,onLoad:f,onUnmount:p,onCenterChanged:y,onZoomChanged:w,onTiltChanged:x,onMapTypeIdChanged:C})}),vzo=["places"],bzo=ko.div` position: fixed; top: 40px; left: 10px; @@ -8801,7 +8801,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,W,F,a,s,u,d,n);var E=!Array.isArray(p)&&xge.isElement(p)&&UA(p.type).endsWith("Chart");return xe.Children.map(p,function(L){return xge.isElement(L)?g.cloneElement(L,mV({width:W,height:F},E?{style:mV({height:"100%",width:"100%",maxHeight:F,maxWidth:W},L.props.style)}:{})):L})},[n,p,s,f,d,u,R,a]);return xe.createElement("div",{id:w?"".concat(w):void 0,className:gl("recharts-responsive-container",x),style:mV(mV({},A),{},{width:a,height:s,minWidth:u,minHeight:d,maxHeight:f}),ref:S},k)}),Dwe=function(e){return null};Dwe.displayName="Cell";function FW(t){"@babel/helpers - typeof";return FW=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},FW(t)}function QLe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Yge(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||G7.isSsr)return{width:0,height:0};var o=yWo(n),r=JSON.stringify({text:e,copyStyle:o});if(tC.widthCache[r])return tC.widthCache[r];try{var i=document.getElementById(ZLe);i||(i=document.createElement("span"),i.setAttribute("id",ZLe),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var a=Yge(Yge({},mWo),o);Object.assign(i.style,a),i.textContent="".concat(e);var l=i.getBoundingClientRect(),s={width:l.width,height:l.height};return tC.widthCache[r]=s,++tC.cacheCount>gWo&&(tC.cacheCount=0,tC.widthCache={}),s}catch{return{width:0,height:0}}},AWo=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function LW(t){"@babel/helpers - typeof";return LW=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},LW(t)}function u$(t,e){return bWo(t)||vWo(t,e)||xWo(t,e)||wWo()}function wWo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xWo(t,e){if(t){if(typeof t=="string")return eWe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eWe(t,e)}}function eWe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function LWo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function aWe(t,e){return jWo(t)||UWo(t,e)||NWo(t,e)||WWo()}function WWo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NWo(t,e){if(t){if(typeof t=="string")return lWe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lWe(t,e)}}function lWe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return W.reduce(function(F,E){var L=E.word,j=E.width,Y=F[F.length-1];if(Y&&(r==null||i||Y.width+j+oE.width?F:E})};if(!u)return p;for(var y="…",w=function(W){var F=d.slice(0,W),E=Qft({breakAll:c,style:s,children:F+y}).wordsWithComputedWidth,L=f(E),j=L.length>a||m(L).width>Number(r);return[j,L]},x=0,C=d.length-1,P=0,A;x<=C&&P<=d.length-1;){var S=Math.floor((x+C)/2),v=S-1,b=w(v),T=aWe(b,2),R=T[0],M=T[1],D=w(S),k=aWe(D,1),N=k[0];if(!R&&!N&&(x=S+1),R&&N&&(C=S-1),!R&&N){A=M;break}P++}return A||p},sWe=function(e){var n=ca(e)?[]:e.toString().split(qft);return[{words:n}]},YWo=function(e){var n=e.width,o=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,l=e.maxLines;if((n||o)&&!G7.isSsr){var s,c,u=Qft({breakAll:a,children:r,style:i});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;s=d,c=f}else return sWe(r);return BWo({breakAll:a,children:r,maxLines:l,style:i},s,c,n,o)}return sWe(r)},cWe="#808080",d$=function(e){var n=e.x,o=n===void 0?0:n,r=e.y,i=r===void 0?0:r,a=e.lineHeight,l=a===void 0?"1em":a,s=e.capHeight,c=s===void 0?"0.71em":s,u=e.scaleToFit,d=u===void 0?!1:u,f=e.textAnchor,p=f===void 0?"start":f,m=e.verticalAnchor,y=m===void 0?"end":m,w=e.fill,x=w===void 0?cWe:w,C=iWe(e,kWo),P=g.useMemo(function(){return YWo({breakAll:C.breakAll,children:C.children,maxLines:C.maxLines,scaleToFit:d,style:C.style,width:C.width})},[C.breakAll,C.children,C.maxLines,d,C.style,C.width]),A=C.dx,S=C.dy,v=C.angle,b=C.className,T=C.breakAll,R=iWe(C,FWo);if(!J0(o)||!J0(i))return null;var M=o+(pr(A)?A:0),D=i+(pr(S)?S:0),k;switch(y){case"start":k=pue("calc(".concat(c,")"));break;case"middle":k=pue("calc(".concat((P.length-1)/2," * -").concat(l," + (").concat(c," / 2))"));break;default:k=pue("calc(".concat(P.length-1," * -").concat(l,")"));break}var N=[];if(d){var U=P[0].width,W=C.width;N.push("scale(".concat((pr(W)?W/U:1)/U,")"))}return v&&N.push("rotate(".concat(v,", ").concat(M,", ").concat(D,")")),N.length&&(R.transform=N.join(" ")),xe.createElement("text",Oge({},sa(R,!0),{x:M,y:D,className:gl("recharts-text",b),textAnchor:p,fill:x.includes("url")?cWe:x}),P.map(function(F,E){var L=F.words.join(T?"":" ");return xe.createElement("tspan",{x:M,dy:E===0?k:l,key:L},L)}))};function j8(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function OWo(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function Ewe(t){let e,n,o;t.length!==2?(e=j8,n=(l,s)=>j8(t(l),s),o=(l,s)=>t(l)-s):(e=t===j8||t===OWo?t:_Wo,n=t,o=t);function r(l,s,c=0,u=l.length){if(c>>1;n(l[d],s)<0?c=d+1:u=d}while(c>>1;n(l[d],s)<=0?c=d+1:u=d}while(cc&&o(l[d-1],s)>-o(l[d],s)?d-1:d}return{left:r,center:a,right:i}}function _Wo(){return 0}function Zft(t){return t===null?NaN:+t}function*VWo(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const GWo=Ewe(j8),Ij=GWo.right;Ewe(Zft).center;class uWe extends Map{constructor(e,n=KWo){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[o,r]of e)this.set(o,r)}get(e){return super.get(dWe(this,e))}has(e){return super.has(dWe(this,e))}set(e,n){return super.set(XWo(this,e),n)}delete(e){return super.delete(JWo(this,e))}}function dWe({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):n}function XWo({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):(t.set(o,n),n)}function JWo({_intern:t,_key:e},n){const o=e(n);return t.has(o)&&(n=t.get(o),t.delete(o)),n}function KWo(t){return t!==null&&typeof t=="object"?t.valueOf():t}function $Wo(t=j8){if(t===j8)return eht;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const o=t(e,n);return o||o===0?o:(t(n,n)===0)-(t(e,e)===0)}}function eht(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const qWo=Math.sqrt(50),QWo=Math.sqrt(10),ZWo=Math.sqrt(2);function f$(t,e,n){const o=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(o)),i=o/Math.pow(10,r),a=i>=qWo?10:i>=QWo?5:i>=ZWo?2:1;let l,s,c;return r<0?(c=Math.pow(10,-r)/a,l=Math.round(t*c),s=Math.round(e*c),l/ce&&--s,c=-c):(c=Math.pow(10,r)*a,l=Math.round(t/c),s=Math.round(e/c),l*ce&&--s),s0))return[];if(t===e)return[t];const o=e=r))return[];const l=i-r+1,s=new Array(l);if(o)if(a<0)for(let c=0;c=o)&&(n=o);return n}function hWe(t,e){let n;for(const o of t)o!=null&&(n>o||n===void 0&&o>=o)&&(n=o);return n}function tht(t,e,n=0,o=1/0,r){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(t.length-1,o)),!(n<=e&&e<=o))return t;for(r=r===void 0?eht:$Wo(r);o>n;){if(o-n>600){const s=o-n+1,c=e-n+1,u=Math.log(s),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(s-d)/s)*(c-s/2<0?-1:1),p=Math.max(n,Math.floor(e-c*d/s+f)),m=Math.min(o,Math.floor(e+(s-c)*d/s+f));tht(t,e,p,m,r)}const i=t[e];let a=n,l=o;for(ME(t,n,e),r(t[o],i)>0&&ME(t,n,o);a0;)--l}r(t[n],i)===0?ME(t,n,l):(++l,ME(t,l,o)),l<=e&&(n=l+1),e<=l&&(o=l-1)}return t}function ME(t,e,n){const o=t[e];t[e]=t[n],t[n]=o}function eNo(t,e,n){if(t=Float64Array.from(VWo(t)),!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return hWe(t);if(e>=1)return fWe(t);var o,r=(o-1)*e,i=Math.floor(r),a=fWe(tht(t,i).subarray(0,i+1)),l=hWe(t.subarray(i+1));return a+(l-a)*(r-i)}}function tNo(t,e,n=Zft){if(!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return+n(t[0],0,t);if(e>=1)return+n(t[o-1],o-1,t);var o,r=(o-1)*e,i=Math.floor(r),a=+n(t[i],i,t),l=+n(t[i+1],i+1,t);return a+(l-a)*(r-i)}}function nNo(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var o=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(r);++o>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?AV(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?AV(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=rNo.exec(t))?new R1(e[1],e[2],e[3],1):(e=iNo.exec(t))?new R1(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=aNo.exec(t))?AV(e[1],e[2],e[3],e[4]):(e=lNo.exec(t))?AV(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=sNo.exec(t))?xWe(e[1],e[2]/100,e[3]/100,1):(e=cNo.exec(t))?xWe(e[1],e[2]/100,e[3]/100,e[4]):pWe.hasOwnProperty(t)?yWe(pWe[t]):t==="transparent"?new R1(NaN,NaN,NaN,0):null}function yWe(t){return new R1(t>>16&255,t>>8&255,t&255,1)}function AV(t,e,n,o){return o<=0&&(t=e=n=NaN),new R1(t,e,n,o)}function fNo(t){return t instanceof zj||(t=jW(t)),t?(t=t.rgb(),new R1(t.r,t.g,t.b,t.opacity)):new R1}function Jge(t,e,n,o){return arguments.length===1?fNo(t):new R1(t,e,n,o??1)}function R1(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}kwe(R1,Jge,oht(zj,{brighter(t){return t=t==null?h$:Math.pow(h$,t),new R1(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?NW:Math.pow(NW,t),new R1(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new R1(Mb(this.r),Mb(this.g),Mb(this.b),p$(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:AWe,formatHex:AWe,formatHex8:hNo,formatRgb:wWe,toString:wWe}));function AWe(){return`#${tb(this.r)}${tb(this.g)}${tb(this.b)}`}function hNo(){return`#${tb(this.r)}${tb(this.g)}${tb(this.b)}${tb((isNaN(this.opacity)?1:this.opacity)*255)}`}function wWe(){const t=p$(this.opacity);return`${t===1?"rgb(":"rgba("}${Mb(this.r)}, ${Mb(this.g)}, ${Mb(this.b)}${t===1?")":`, ${t})`}`}function p$(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Mb(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function tb(t){return t=Mb(t),(t<16?"0":"")+t.toString(16)}function xWe(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new s5(t,e,n,o)}function rht(t){if(t instanceof s5)return new s5(t.h,t.s,t.l,t.opacity);if(t instanceof zj||(t=jW(t)),!t)return new s5;if(t instanceof s5)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,l=i-r,s=(i+r)/2;return l?(e===i?a=(n-o)/l+(n0&&s<1?0:a,new s5(a,l,s,t.opacity)}function pNo(t,e,n,o){return arguments.length===1?rht(t):new s5(t,e,n,o??1)}function s5(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}kwe(s5,pNo,oht(zj,{brighter(t){return t=t==null?h$:Math.pow(h$,t),new s5(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?NW:Math.pow(NW,t),new s5(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new R1(gue(t>=240?t-240:t+120,r,o),gue(t,r,o),gue(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new s5(vWe(this.h),wV(this.s),wV(this.l),p$(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=p$(this.opacity);return`${t===1?"hsl(":"hsla("}${vWe(this.h)}, ${wV(this.s)*100}%, ${wV(this.l)*100}%${t===1?")":`, ${t})`}`}}));function vWe(t){return t=(t||0)%360,t<0?t+360:t}function wV(t){return Math.max(0,Math.min(1,t||0))}function gue(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Fwe=t=>()=>t;function gNo(t,e){return function(n){return t+n*e}}function mNo(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function yNo(t){return(t=+t)==1?iht:function(e,n){return n-e?mNo(e,n,t):Fwe(isNaN(e)?n:e)}}function iht(t,e){var n=e-t;return n?gNo(t,n):Fwe(isNaN(t)?e:t)}const bWe=function t(e){var n=yNo(e);function o(r,i){var a=n((r=Jge(r)).r,(i=Jge(i)).r),l=n(r.g,i.g),s=n(r.b,i.b),c=iht(r.opacity,i.opacity);return function(u){return r.r=a(u),r.g=l(u),r.b=s(u),r.opacity=c(u),r+""}}return o.gamma=t,o}(1);function ANo(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),r;return function(i){for(r=0;rn&&(i=e.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(o=o[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,s.push({i:a,x:g$(o,r)})),n=mue.lastIndex;return ne&&(n=t,t=e,e=n),function(o){return Math.max(t,Math.min(e,o))}}function MNo(t,e,n){var o=t[0],r=t[1],i=e[0],a=e[1];return r2?INo:MNo,s=c=null,d}function d(f){return f==null||isNaN(f=+f)?i:(s||(s=l(t.map(o),e,n)))(o(a(f)))}return d.invert=function(f){return a(r((c||(c=l(e,t.map(o),g$)))(f)))},d.domain=function(f){return arguments.length?(t=Array.from(f,m$),u()):t.slice()},d.range=function(f){return arguments.length?(e=Array.from(f),u()):e.slice()},d.rangeRound=function(f){return e=Array.from(f),n=Lwe,u()},d.clamp=function(f){return arguments.length?(a=f?!0:Wp,u()):a!==Wp},d.interpolate=function(f){return arguments.length?(n=f,u()):n},d.unknown=function(f){return arguments.length?(i=f,d):i},function(f,p){return o=f,r=p,u()}}function Wwe(){return Poe()(Wp,Wp)}function zNo(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function y$(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,o=t.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+t.slice(n+1)]}function dM(t){return t=y$(Math.abs(t)),t?t[1]:NaN}function DNo(t,e){return function(n,o){for(var r=n.length,i=[],a=0,l=t[0],s=0;r>0&&l>0&&(s+l+1>o&&(l=Math.max(1,o-s)),i.push(n.substring(r-=l,r+l)),!((s+=l+1)>o));)l=t[a=(a+1)%t.length];return i.reverse().join(e)}}function ENo(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var kNo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function BW(t){if(!(e=kNo.exec(t)))throw new Error("invalid format: "+t);var e;return new Nwe({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}BW.prototype=Nwe.prototype;function Nwe(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Nwe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function FNo(t){e:for(var e=t.length,n=1,o=-1,r;n0&&(o=0);break}return o>0?t.slice(0,o)+t.slice(r+1):t}var aht;function LNo(t,e){var n=y$(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(aht=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=o.length;return i===a?o:i>a?o+new Array(i-a+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+y$(t,Math.max(0,e+i-1))[0]}function TWe(t,e){var n=y$(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}const PWe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:zNo,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>TWe(t*100,e),r:TWe,s:LNo,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function CWe(t){return t}var RWe=Array.prototype.map,HWe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function WNo(t){var e=t.grouping===void 0||t.thousands===void 0?CWe:DNo(RWe.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",o=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?CWe:ENo(RWe.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",s=t.nan===void 0?"NaN":t.nan+"";function c(d){d=BW(d);var f=d.fill,p=d.align,m=d.sign,y=d.symbol,w=d.zero,x=d.width,C=d.comma,P=d.precision,A=d.trim,S=d.type;S==="n"?(C=!0,S="g"):PWe[S]||(P===void 0&&(P=12),A=!0,S="g"),(w||f==="0"&&p==="=")&&(w=!0,f="0",p="=");var v=y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",b=y==="$"?o:/[%p]/.test(S)?a:"",T=PWe[S],R=/[defgprs%]/.test(S);P=P===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function M(D){var k=v,N=b,U,W,F;if(S==="c")N=T(D)+N,D="";else{D=+D;var E=D<0||1/D<0;if(D=isNaN(D)?s:T(Math.abs(D),P),A&&(D=FNo(D)),E&&+D==0&&m!=="+"&&(E=!1),k=(E?m==="("?m:l:m==="-"||m==="("?"":m)+k,N=(S==="s"?HWe[8+aht/3]:"")+N+(E&&m==="("?")":""),R){for(U=-1,W=D.length;++UF||F>57){N=(F===46?r+D.slice(U+1):D.slice(U))+N,D=D.slice(0,U);break}}}C&&!w&&(D=e(D,1/0));var L=k.length+D.length+N.length,j=L>1)+k+D+N+j.slice(L);break;default:D=j+k+D+N;break}return i(D)}return M.toString=function(){return d+""},M}function u(d,f){var p=c((d=BW(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(dM(f)/3)))*3,y=Math.pow(10,-m),w=HWe[8+m/3];return function(x){return p(y*x)+w}}return{format:c,formatPrefix:u}}var xV,Uwe,lht;NNo({thousands:",",grouping:[3],currency:["$",""]});function NNo(t){return xV=WNo(t),Uwe=xV.format,lht=xV.formatPrefix,xV}function UNo(t){return Math.max(0,-dM(Math.abs(t)))}function jNo(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(dM(e)/3)))*3-dM(Math.abs(t)))}function BNo(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,dM(e)-dM(t))+1}function sht(t,e,n,o){var r=Gge(t,e,n),i;switch(o=BW(o??",f"),o.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return o.precision==null&&!isNaN(i=jNo(r,a))&&(o.precision=i),lht(o,a)}case"":case"e":case"g":case"p":case"r":{o.precision==null&&!isNaN(i=BNo(r,Math.max(Math.abs(t),Math.abs(e))))&&(o.precision=i-(o.type==="e"));break}case"f":case"%":{o.precision==null&&!isNaN(i=UNo(r))&&(o.precision=i-(o.type==="%")*2);break}}return Uwe(o)}function X7(t){var e=t.domain;return t.ticks=function(n){var o=e();return _ge(o[0],o[o.length-1],n??10)},t.tickFormat=function(n,o){var r=e();return sht(r[0],r[r.length-1],n??10,o)},t.nice=function(n){n==null&&(n=10);var o=e(),r=0,i=o.length-1,a=o[r],l=o[i],s,c,u=10;for(l0;){if(c=Vge(a,l,n),c===s)return o[r]=a,o[i]=l,e(o);if(c>0)a=Math.floor(a/c)*c,l=Math.ceil(l/c)*c;else if(c<0)a=Math.ceil(a*c)/c,l=Math.floor(l*c)/c;else break;s=c}return t},t}function YW(){var t=Wwe();return t.copy=function(){return Dj(t,YW())},u2.apply(t,arguments),X7(t)}function cht(t){var e;function n(o){return o==null||isNaN(o=+o)?e:o}return n.invert=n,n.domain=n.range=function(o){return arguments.length?(t=Array.from(o,m$),n):t.slice()},n.unknown=function(o){return arguments.length?(e=o,n):e},n.copy=function(){return cht(t).unknown(e)},t=arguments.length?Array.from(t,m$):[0,1],X7(n)}function uht(t,e){t=t.slice();var n=0,o=t.length-1,r=t[n],i=t[o],a;return iMath.pow(t,e)}function GNo(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function zWe(t){return(e,n)=>-t(-e,n)}function jwe(t){const e=t(MWe,IWe),n=e.domain;let o=10,r,i;function a(){return r=GNo(o),i=VNo(o),n()[0]<0?(r=zWe(r),i=zWe(i),t(YNo,ONo)):t(MWe,IWe),e}return e.base=function(l){return arguments.length?(o=+l,a()):o},e.domain=function(l){return arguments.length?(n(l),a()):n()},e.ticks=l=>{const s=n();let c=s[0],u=s[s.length-1];const d=u0){for(;f<=p;++f)for(m=1;mu)break;x.push(y)}}else for(;f<=p;++f)for(m=o-1;m>=1;--m)if(y=f>0?m/i(-f):m*i(f),!(yu)break;x.push(y)}x.length*2{if(l==null&&(l=10),s==null&&(s=o===10?"s":","),typeof s!="function"&&(!(o%1)&&(s=BW(s)).precision==null&&(s.trim=!0),s=Uwe(s)),l===1/0)return s;const c=Math.max(1,o*l/e.ticks().length);return u=>{let d=u/i(Math.round(r(u)));return d*on(uht(n(),{floor:l=>i(Math.floor(r(l))),ceil:l=>i(Math.ceil(r(l)))})),e}function dht(){const t=jwe(Poe()).domain([1,10]);return t.copy=()=>Dj(t,dht()).base(t.base()),u2.apply(t,arguments),t}function DWe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function EWe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Bwe(t){var e=1,n=t(DWe(e),EWe(e));return n.constant=function(o){return arguments.length?t(DWe(e=+o),EWe(e)):e},X7(n)}function fht(){var t=Bwe(Poe());return t.copy=function(){return Dj(t,fht()).constant(t.constant())},u2.apply(t,arguments)}function kWe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function XNo(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function JNo(t){return t<0?-t*t:t*t}function Ywe(t){var e=t(Wp,Wp),n=1;function o(){return n===1?t(Wp,Wp):n===.5?t(XNo,JNo):t(kWe(n),kWe(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,o()):n},X7(e)}function Owe(){var t=Ywe(Poe());return t.copy=function(){return Dj(t,Owe()).exponent(t.exponent())},u2.apply(t,arguments),t}function KNo(){return Owe.apply(null,arguments).exponent(.5)}function FWe(t){return Math.sign(t)*t*t}function $No(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function hht(){var t=Wwe(),e=[0,1],n=!1,o;function r(i){var a=$No(t(i));return isNaN(a)?o:n?Math.round(a):a}return r.invert=function(i){return t.invert(FWe(i))},r.domain=function(i){return arguments.length?(t.domain(i),r):t.domain()},r.range=function(i){return arguments.length?(t.range((e=Array.from(i,m$)).map(FWe)),r):e.slice()},r.rangeRound=function(i){return r.range(i).round(!0)},r.round=function(i){return arguments.length?(n=!!i,r):n},r.clamp=function(i){return arguments.length?(t.clamp(i),r):t.clamp()},r.unknown=function(i){return arguments.length?(o=i,r):o},r.copy=function(){return hht(t.domain(),e).round(n).clamp(t.clamp()).unknown(o)},u2.apply(r,arguments),X7(r)}function pht(){var t=[],e=[],n=[],o;function r(){var a=0,l=Math.max(1,e.length);for(n=new Array(l-1);++a0?n[l-1]:t[0],l=n?[o[n-1],e]:[o[c-1],o[c]]},a.unknown=function(s){return arguments.length&&(i=s),a},a.thresholds=function(){return o.slice()},a.copy=function(){return ght().domain([t,e]).range(r).unknown(i)},u2.apply(X7(a),arguments)}function mht(){var t=[.5],e=[0,1],n,o=1;function r(i){return i!=null&&i<=i?e[Ij(t,i,0,o)]:n}return r.domain=function(i){return arguments.length?(t=Array.from(i),o=Math.min(t.length,e.length-1),r):t.slice()},r.range=function(i){return arguments.length?(e=Array.from(i),o=Math.min(t.length,e.length-1),r):e.slice()},r.invertExtent=function(i){var a=e.indexOf(i);return[t[a-1],t[a]]},r.unknown=function(i){return arguments.length?(n=i,r):n},r.copy=function(){return mht().domain(t).range(e).unknown(n)},u2.apply(r,arguments)}const yue=new Date,Aue=new Date;function cd(t,e,n,o){function r(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return r.floor=i=>(t(i=new Date(+i)),i),r.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),r.round=i=>{const a=r(i),l=r.ceil(i);return i-a(e(i=new Date(+i),a==null?1:Math.floor(a)),i),r.range=(i,a,l)=>{const s=[];if(i=r.ceil(i),l=l==null?1:Math.floor(l),!(i0))return s;let c;do s.push(c=new Date(+i)),e(i,l),t(i);while(ccd(a=>{if(a>=a)for(;t(a),!i(a);)a.setTime(a-1)},(a,l)=>{if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!i(a););else for(;--l>=0;)for(;e(a,1),!i(a););}),n&&(r.count=(i,a)=>(yue.setTime(+i),Aue.setTime(+a),t(yue),t(Aue),Math.floor(n(yue,Aue))),r.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?r.filter(o?a=>o(a)%i===0:a=>r.count(0,a)%i===0):r)),r}const A$=cd(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);A$.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?cd(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):A$);A$.range;const bA=1e3,Iy=bA*60,SA=Iy*60,a4=SA*24,_we=a4*7,LWe=a4*30,wue=a4*365,nb=cd(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*bA)},(t,e)=>(e-t)/bA,t=>t.getUTCSeconds());nb.range;const Vwe=cd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*bA)},(t,e)=>{t.setTime(+t+e*Iy)},(t,e)=>(e-t)/Iy,t=>t.getMinutes());Vwe.range;const Gwe=cd(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Iy)},(t,e)=>(e-t)/Iy,t=>t.getUTCMinutes());Gwe.range;const Xwe=cd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*bA-t.getMinutes()*Iy)},(t,e)=>{t.setTime(+t+e*SA)},(t,e)=>(e-t)/SA,t=>t.getHours());Xwe.range;const Jwe=cd(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*SA)},(t,e)=>(e-t)/SA,t=>t.getUTCHours());Jwe.range;const Ej=cd(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Iy)/a4,t=>t.getDate()-1);Ej.range;const Coe=cd(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/a4,t=>t.getUTCDate()-1);Coe.range;const yht=cd(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/a4,t=>Math.floor(t/a4));yht.range;function hT(t){return cd(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Iy)/_we)}const Roe=hT(0),w$=hT(1),qNo=hT(2),QNo=hT(3),fM=hT(4),ZNo=hT(5),eUo=hT(6);Roe.range;w$.range;qNo.range;QNo.range;fM.range;ZNo.range;eUo.range;function pT(t){return cd(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/_we)}const Hoe=pT(0),x$=pT(1),tUo=pT(2),nUo=pT(3),hM=pT(4),oUo=pT(5),rUo=pT(6);Hoe.range;x$.range;tUo.range;nUo.range;hM.range;oUo.range;rUo.range;const Kwe=cd(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Kwe.range;const $we=cd(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());$we.range;const l4=cd(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());l4.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:cd(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});l4.range;const s4=cd(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());s4.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:cd(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});s4.range;function Aht(t,e,n,o,r,i){const a=[[nb,1,bA],[nb,5,5*bA],[nb,15,15*bA],[nb,30,30*bA],[i,1,Iy],[i,5,5*Iy],[i,15,15*Iy],[i,30,30*Iy],[r,1,SA],[r,3,3*SA],[r,6,6*SA],[r,12,12*SA],[o,1,a4],[o,2,2*a4],[n,1,_we],[e,1,LWe],[e,3,3*LWe],[t,1,wue]];function l(c,u,d){const f=uw).right(a,f);if(p===a.length)return t.every(Gge(c/wue,u/wue,d));if(p===0)return A$.every(Math.max(Gge(c,u,d),1));const[m,y]=a[f/a[p-1][2]53)return null;"w"in $||($.w=1),"Z"in $?(de=vue(IE($.y,0,1)),he=de.getUTCDay(),de=he>4||he===0?x$.ceil(de):x$(de),de=Coe.offset(de,($.V-1)*7),$.y=de.getUTCFullYear(),$.m=de.getUTCMonth(),$.d=de.getUTCDate()+($.w+6)%7):(de=xue(IE($.y,0,1)),he=de.getDay(),de=he>4||he===0?w$.ceil(de):w$(de),de=Ej.offset(de,($.V-1)*7),$.y=de.getFullYear(),$.m=de.getMonth(),$.d=de.getDate()+($.w+6)%7)}else("W"in $||"U"in $)&&("w"in $||($.w="u"in $?$.u%7:"W"in $?1:0),he="Z"in $?vue(IE($.y,0,1)).getUTCDay():xue(IE($.y,0,1)).getDay(),$.m=0,$.d="W"in $?($.w+6)%7+$.W*7-(he+5)%7:$.w+$.U*7-(he+6)%7);return"Z"in $?($.H+=$.Z/100|0,$.M+=$.Z%100,vue($)):xue($)}}function T(Z,ne,te,$){for(var le=0,de=ne.length,he=te.length,me,ce;le=he)return-1;if(me=ne.charCodeAt(le++),me===37){if(me=ne.charAt(le++),ce=S[me in WWe?ne.charAt(le++):me],!ce||($=ce(Z,te,$))<0)return-1}else if(me!=te.charCodeAt($++))return-1}return $}function R(Z,ne,te){var $=c.exec(ne.slice(te));return $?(Z.p=u.get($[0].toLowerCase()),te+$[0].length):-1}function M(Z,ne,te){var $=p.exec(ne.slice(te));return $?(Z.w=m.get($[0].toLowerCase()),te+$[0].length):-1}function D(Z,ne,te){var $=d.exec(ne.slice(te));return $?(Z.w=f.get($[0].toLowerCase()),te+$[0].length):-1}function k(Z,ne,te){var $=x.exec(ne.slice(te));return $?(Z.m=C.get($[0].toLowerCase()),te+$[0].length):-1}function N(Z,ne,te){var $=y.exec(ne.slice(te));return $?(Z.m=w.get($[0].toLowerCase()),te+$[0].length):-1}function U(Z,ne,te){return T(Z,e,ne,te)}function W(Z,ne,te){return T(Z,n,ne,te)}function F(Z,ne,te){return T(Z,o,ne,te)}function E(Z){return a[Z.getDay()]}function L(Z){return i[Z.getDay()]}function j(Z){return s[Z.getMonth()]}function Y(Z){return l[Z.getMonth()]}function O(Z){return r[+(Z.getHours()>=12)]}function _(Z){return 1+~~(Z.getMonth()/3)}function G(Z){return a[Z.getUTCDay()]}function Q(Z){return i[Z.getUTCDay()]}function oe(Z){return s[Z.getUTCMonth()]}function ee(Z){return l[Z.getUTCMonth()]}function q(Z){return r[+(Z.getUTCHours()>=12)]}function ae(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var ne=v(Z+="",P);return ne.toString=function(){return Z},ne},parse:function(Z){var ne=b(Z+="",!1);return ne.toString=function(){return Z},ne},utcFormat:function(Z){var ne=v(Z+="",A);return ne.toString=function(){return Z},ne},utcParse:function(Z){var ne=b(Z+="",!0);return ne.toString=function(){return Z},ne}}}var WWe={"-":"",_:" ",0:"0"},_d=/^\s*\d+/,uUo=/^%/,dUo=/[\\^$*+?|[\]().{}]/g;function Xl(t,e,n){var o=t<0?"-":"",r=(o?-t:t)+"",i=r.length;return o+(i[e.toLowerCase(),n]))}function hUo(t,e,n){var o=_d.exec(e.slice(n,n+1));return o?(t.w=+o[0],n+o[0].length):-1}function pUo(t,e,n){var o=_d.exec(e.slice(n,n+1));return o?(t.u=+o[0],n+o[0].length):-1}function gUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.U=+o[0],n+o[0].length):-1}function mUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.V=+o[0],n+o[0].length):-1}function yUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.W=+o[0],n+o[0].length):-1}function NWe(t,e,n){var o=_d.exec(e.slice(n,n+4));return o?(t.y=+o[0],n+o[0].length):-1}function UWe(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.y=+o[0]+(+o[0]>68?1900:2e3),n+o[0].length):-1}function AUo(t,e,n){var o=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return o?(t.Z=o[1]?0:-(o[2]+(o[3]||"00")),n+o[0].length):-1}function wUo(t,e,n){var o=_d.exec(e.slice(n,n+1));return o?(t.q=o[0]*3-3,n+o[0].length):-1}function xUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.m=o[0]-1,n+o[0].length):-1}function jWe(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.d=+o[0],n+o[0].length):-1}function vUo(t,e,n){var o=_d.exec(e.slice(n,n+3));return o?(t.m=0,t.d=+o[0],n+o[0].length):-1}function BWe(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.H=+o[0],n+o[0].length):-1}function bUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.M=+o[0],n+o[0].length):-1}function SUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.S=+o[0],n+o[0].length):-1}function TUo(t,e,n){var o=_d.exec(e.slice(n,n+3));return o?(t.L=+o[0],n+o[0].length):-1}function PUo(t,e,n){var o=_d.exec(e.slice(n,n+6));return o?(t.L=Math.floor(o[0]/1e3),n+o[0].length):-1}function CUo(t,e,n){var o=uUo.exec(e.slice(n,n+1));return o?n+o[0].length:-1}function RUo(t,e,n){var o=_d.exec(e.slice(n));return o?(t.Q=+o[0],n+o[0].length):-1}function HUo(t,e,n){var o=_d.exec(e.slice(n));return o?(t.s=+o[0],n+o[0].length):-1}function YWe(t,e){return Xl(t.getDate(),e,2)}function MUo(t,e){return Xl(t.getHours(),e,2)}function IUo(t,e){return Xl(t.getHours()%12||12,e,2)}function zUo(t,e){return Xl(1+Ej.count(l4(t),t),e,3)}function wht(t,e){return Xl(t.getMilliseconds(),e,3)}function DUo(t,e){return wht(t,e)+"000"}function EUo(t,e){return Xl(t.getMonth()+1,e,2)}function kUo(t,e){return Xl(t.getMinutes(),e,2)}function FUo(t,e){return Xl(t.getSeconds(),e,2)}function LUo(t){var e=t.getDay();return e===0?7:e}function WUo(t,e){return Xl(Roe.count(l4(t)-1,t),e,2)}function xht(t){var e=t.getDay();return e>=4||e===0?fM(t):fM.ceil(t)}function NUo(t,e){return t=xht(t),Xl(fM.count(l4(t),t)+(l4(t).getDay()===4),e,2)}function UUo(t){return t.getDay()}function jUo(t,e){return Xl(w$.count(l4(t)-1,t),e,2)}function BUo(t,e){return Xl(t.getFullYear()%100,e,2)}function YUo(t,e){return t=xht(t),Xl(t.getFullYear()%100,e,2)}function OUo(t,e){return Xl(t.getFullYear()%1e4,e,4)}function _Uo(t,e){var n=t.getDay();return t=n>=4||n===0?fM(t):fM.ceil(t),Xl(t.getFullYear()%1e4,e,4)}function VUo(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Xl(e/60|0,"0",2)+Xl(e%60,"0",2)}function OWe(t,e){return Xl(t.getUTCDate(),e,2)}function GUo(t,e){return Xl(t.getUTCHours(),e,2)}function XUo(t,e){return Xl(t.getUTCHours()%12||12,e,2)}function JUo(t,e){return Xl(1+Coe.count(s4(t),t),e,3)}function vht(t,e){return Xl(t.getUTCMilliseconds(),e,3)}function KUo(t,e){return vht(t,e)+"000"}function $Uo(t,e){return Xl(t.getUTCMonth()+1,e,2)}function qUo(t,e){return Xl(t.getUTCMinutes(),e,2)}function QUo(t,e){return Xl(t.getUTCSeconds(),e,2)}function ZUo(t){var e=t.getUTCDay();return e===0?7:e}function ejo(t,e){return Xl(Hoe.count(s4(t)-1,t),e,2)}function bht(t){var e=t.getUTCDay();return e>=4||e===0?hM(t):hM.ceil(t)}function tjo(t,e){return t=bht(t),Xl(hM.count(s4(t),t)+(s4(t).getUTCDay()===4),e,2)}function njo(t){return t.getUTCDay()}function ojo(t,e){return Xl(x$.count(s4(t)-1,t),e,2)}function rjo(t,e){return Xl(t.getUTCFullYear()%100,e,2)}function ijo(t,e){return t=bht(t),Xl(t.getUTCFullYear()%100,e,2)}function ajo(t,e){return Xl(t.getUTCFullYear()%1e4,e,4)}function ljo(t,e){var n=t.getUTCDay();return t=n>=4||n===0?hM(t):hM.ceil(t),Xl(t.getUTCFullYear()%1e4,e,4)}function sjo(){return"+0000"}function _We(){return"%"}function VWe(t){return+t}function GWe(t){return Math.floor(+t/1e3)}var nC,Sht,Tht;cjo({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function cjo(t){return nC=cUo(t),Sht=nC.format,nC.parse,Tht=nC.utcFormat,nC.utcParse,nC}function ujo(t){return new Date(t)}function djo(t){return t instanceof Date?+t:+new Date(+t)}function qwe(t,e,n,o,r,i,a,l,s,c){var u=Wwe(),d=u.invert,f=u.domain,p=c(".%L"),m=c(":%S"),y=c("%I:%M"),w=c("%I %p"),x=c("%a %d"),C=c("%b %d"),P=c("%B"),A=c("%Y");function S(v){return(s(v)e(r/(t.length-1)))},n.quantiles=function(o){return Array.from({length:o+1},(r,i)=>eNo(t,i/o))},n.copy=function(){return Hht(e).domain(t)},C4.apply(n,arguments)}function Ioe(){var t=0,e=.5,n=1,o=1,r,i,a,l,s,c=Wp,u,d=!1,f;function p(y){return isNaN(y=+y)?f:(y=.5+((y=+u(y))-i)*(o*ye}var wjo=Ajo,xjo=Dht,vjo=wjo,bjo=eT;function Sjo(t){return t&&t.length?xjo(t,bjo,vjo):void 0}var Tjo=Sjo;const A8=ji(Tjo);function Pjo(t,e){return tt.e^i.s<0?1:-1;for(o=i.d.length,r=t.d.length,e=0,n=ot.d[e]^i.s<0?1:-1;return o===r?0:o>r^i.s<0?1:-1};_r.decimalPlaces=_r.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Pc;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};_r.dividedBy=_r.div=function(t){return BA(this,new this.constructor(t))};_r.dividedToIntegerBy=_r.idiv=function(t){var e=this,n=e.constructor;return Os(BA(e,new n(t),0,1),n.precision)};_r.equals=_r.eq=function(t){return!this.cmp(t)};_r.exponent=function(){return T0(this)};_r.greaterThan=_r.gt=function(t){return this.cmp(t)>0};_r.greaterThanOrEqualTo=_r.gte=function(t){return this.cmp(t)>=0};_r.isInteger=_r.isint=function(){return this.e>this.d.length-2};_r.isNegative=_r.isneg=function(){return this.s<0};_r.isPositive=_r.ispos=function(){return this.s>0};_r.isZero=function(){return this.s===0};_r.lessThan=_r.lt=function(t){return this.cmp(t)<0};_r.lessThanOrEqualTo=_r.lte=function(t){return this.cmp(t)<1};_r.logarithm=_r.log=function(t){var e,n=this,o=n.constructor,r=o.precision,i=r+5;if(t===void 0)t=new o(10);else if(t=new o(t),t.s<1||t.eq(em))throw Error(Jy+"NaN");if(n.s<1)throw Error(Jy+(n.s?"NaN":"-Infinity"));return n.eq(em)?new o(0):(eu=!1,e=BA(OW(n,i),OW(t,i),i),eu=!0,Os(e,r))};_r.minus=_r.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Lht(e,t):kht(e,(t.s=-t.s,t))};_r.modulo=_r.mod=function(t){var e,n=this,o=n.constructor,r=o.precision;if(t=new o(t),!t.s)throw Error(Jy+"NaN");return n.s?(eu=!1,e=BA(n,t,0,1).times(t),eu=!0,n.minus(e)):Os(new o(n),r)};_r.naturalExponential=_r.exp=function(){return Fht(this)};_r.naturalLogarithm=_r.ln=function(){return OW(this)};_r.negated=_r.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};_r.plus=_r.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?kht(e,t):Lht(e,(t.s=-t.s,t))};_r.precision=_r.sd=function(t){var e,n,o,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Ib+t);if(e=T0(r)+1,o=r.d.length-1,n=o*Pc+1,o=r.d[o],o){for(;o%10==0;o/=10)n--;for(o=r.d[0];o>=10;o/=10)n++}return t&&e>n?e:n};_r.squareRoot=_r.sqrt=function(){var t,e,n,o,r,i,a,l=this,s=l.constructor;if(l.s<1){if(!l.s)return new s(0);throw Error(Jy+"NaN")}for(t=T0(l),eu=!1,r=Math.sqrt(+l),r==0||r==1/0?(e=c3(l.d),(e.length+t)%2==0&&(e+="0"),r=Math.sqrt(e),t=$I((t+1)/2)-(t<0||t%2),r==1/0?e="5e"+t:(e=r.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),o=new s(e)):o=new s(r.toString()),n=s.precision,r=a=n+3;;)if(i=o,o=i.plus(BA(l,i,a+2)).times(.5),c3(i.d).slice(0,a)===(e=c3(o.d)).slice(0,a)){if(e=e.slice(a-3,a+1),r==a&&e=="4999"){if(Os(i,n+1,0),i.times(i).eq(l)){o=i;break}}else if(e!="9999")break;a+=4}return eu=!0,Os(o,n)};_r.times=_r.mul=function(t){var e,n,o,r,i,a,l,s,c,u=this,d=u.constructor,f=u.d,p=(t=new d(t)).d;if(!u.s||!t.s)return new d(0);for(t.s*=u.s,n=u.e+t.e,s=f.length,c=p.length,s=0;){for(e=0,r=s+o;r>o;)l=i[r]+p[o]*f[r-o-1]+e,i[r--]=l%Hd|0,e=l/Hd|0;i[r]=(i[r]+e)%Hd|0}for(;!i[--a];)i.pop();return e?++n:i.shift(),t.d=i,t.e=n,eu?Os(t,d.precision):t};_r.toDecimalPlaces=_r.todp=function(t,e){var n=this,o=n.constructor;return n=new o(n),t===void 0?n:(B3(t,0,KI),e===void 0?e=o.rounding:B3(e,0,8),Os(n,t+T0(n)+1,e))};_r.toExponential=function(t,e){var n,o=this,r=o.constructor;return t===void 0?n=pS(o,!0):(B3(t,0,KI),e===void 0?e=r.rounding:B3(e,0,8),o=Os(new r(o),t+1,e),n=pS(o,!0,t+1)),n};_r.toFixed=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?pS(r):(B3(t,0,KI),e===void 0?e=i.rounding:B3(e,0,8),o=Os(new i(r),t+T0(r)+1,e),n=pS(o.abs(),!1,t+T0(o)+1),r.isneg()&&!r.isZero()?"-"+n:n)};_r.toInteger=_r.toint=function(){var t=this,e=t.constructor;return Os(new e(t),T0(t)+1,e.rounding)};_r.toNumber=function(){return+this};_r.toPower=_r.pow=function(t){var e,n,o,r,i,a,l=this,s=l.constructor,c=12,u=+(t=new s(t));if(!t.s)return new s(em);if(l=new s(l),!l.s){if(t.s<1)throw Error(Jy+"Infinity");return l}if(l.eq(em))return l;if(o=s.precision,t.eq(em))return Os(l,o);if(e=t.e,n=t.d.length-1,a=e>=n,i=l.s,a){if((n=u<0?-u:u)<=Eht){for(r=new s(em),e=Math.ceil(o/Pc+4),eu=!1;n%2&&(r=r.times(l),KWe(r.d,e)),n=$I(n/2),n!==0;)l=l.times(l),KWe(l.d,e);return eu=!0,t.s<0?new s(em).div(r):Os(r,o)}}else if(i<0)throw Error(Jy+"NaN");return i=i<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,eu=!1,r=t.times(OW(l,o+c)),eu=!0,r=Fht(r),r.s=i,r};_r.toPrecision=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?(n=T0(r),o=pS(r,n<=i.toExpNeg||n>=i.toExpPos)):(B3(t,1,KI),e===void 0?e=i.rounding:B3(e,0,8),r=Os(new i(r),t,e),n=T0(r),o=pS(r,t<=n||n<=i.toExpNeg,t)),o};_r.toSignificantDigits=_r.tosd=function(t,e){var n=this,o=n.constructor;return t===void 0?(t=o.precision,e=o.rounding):(B3(t,1,KI),e===void 0?e=o.rounding:B3(e,0,8)),Os(new o(n),t,e)};_r.toString=_r.valueOf=_r.val=_r.toJSON=_r[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=T0(t),n=t.constructor;return pS(t,e<=n.toExpNeg||e>=n.toExpPos)};function kht(t,e){var n,o,r,i,a,l,s,c,u=t.constructor,d=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),eu?Os(e,d):e;if(s=t.d,c=e.d,a=t.e,r=e.e,s=s.slice(),i=a-r,i){for(i<0?(o=s,i=-i,l=c.length):(o=c,r=a,l=s.length),a=Math.ceil(d/Pc),l=a>l?a+1:l+1,i>l&&(i=l,o.length=1),o.reverse();i--;)o.push(0);o.reverse()}for(l=s.length,i=c.length,l-i<0&&(i=l,o=c,c=s,s=o),n=0;i;)n=(s[--i]=s[i]+c[i]+n)/Hd|0,s[i]%=Hd;for(n&&(s.unshift(n),++r),l=s.length;s[--l]==0;)s.pop();return e.d=s,e.e=r,eu?Os(e,d):e}function B3(t,e,n){if(t!==~~t||tn)throw Error(Ib+t)}function c3(t){var e,n,o,r=t.length-1,i="",a=t[0];if(r>0){for(i+=a,e=1;ea?1:-1;else for(l=s=0;lr[l]?1:-1;break}return s}function n(o,r,i){for(var a=0;i--;)o[i]-=a,a=o[i]1;)o.shift()}return function(o,r,i,a){var l,s,c,u,d,f,p,m,y,w,x,C,P,A,S,v,b,T,R=o.constructor,M=o.s==r.s?1:-1,D=o.d,k=r.d;if(!o.s)return new R(o);if(!r.s)throw Error(Jy+"Division by zero");for(s=o.e-r.e,b=k.length,S=D.length,p=new R(M),m=p.d=[],c=0;k[c]==(D[c]||0);)++c;if(k[c]>(D[c]||0)&&--s,i==null?C=i=R.precision:a?C=i+(T0(o)-T0(r))+1:C=i,C<0)return new R(0);if(C=C/Pc+2|0,c=0,b==1)for(u=0,k=k[0],C++;(c1&&(k=t(k,u),D=t(D,u),b=k.length,S=D.length),A=b,y=D.slice(0,b),w=y.length;w=Hd/2&&++v;do u=0,l=e(k,y,b,w),l<0?(x=y[0],b!=w&&(x=x*Hd+(y[1]||0)),u=x/v|0,u>1?(u>=Hd&&(u=Hd-1),d=t(k,u),f=d.length,w=y.length,l=e(d,y,f,w),l==1&&(u--,n(d,b16)throw Error(e8e+T0(t));if(!t.s)return new u(em);for(eu=!1,l=d,a=new u(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(o=Math.log(Av(2,c))/Math.LN10*2+5|0,l+=o,n=r=i=new u(em),u.precision=l;;){if(r=Os(r.times(t),l),n=n.times(++s),a=i.plus(BA(r,n,l)),c3(a.d).slice(0,l)===c3(i.d).slice(0,l)){for(;c--;)i=Os(i.times(i),l);return u.precision=d,e==null?(eu=!0,Os(i,d)):i}i=a}}function T0(t){for(var e=t.e*Pc,n=t.d[0];n>=10;n/=10)e++;return e}function bue(t,e,n){if(e>t.LN10.sd())throw eu=!0,n&&(t.precision=n),Error(Jy+"LN10 precision limit exceeded");return Os(new t(t.LN10),e)}function Vw(t){for(var e="";t--;)e+="0";return e}function OW(t,e){var n,o,r,i,a,l,s,c,u,d=1,f=10,p=t,m=p.d,y=p.constructor,w=y.precision;if(p.s<1)throw Error(Jy+(p.s?"NaN":"-Infinity"));if(p.eq(em))return new y(0);if(e==null?(eu=!1,c=w):c=e,p.eq(10))return e==null&&(eu=!0),bue(y,c);if(c+=f,y.precision=c,n=c3(m),o=n.charAt(0),i=T0(p),Math.abs(i)<15e14){for(;o<7&&o!=1||o==1&&n.charAt(1)>3;)p=p.times(t),n=c3(p.d),o=n.charAt(0),d++;i=T0(p),o>1?(p=new y("0."+n),i++):p=new y(o+"."+n.slice(1))}else return s=bue(y,c+2,w).times(i+""),p=OW(new y(o+"."+n.slice(1)),c-f).plus(s),y.precision=w,e==null?(eu=!0,Os(p,w)):p;for(l=a=p=BA(p.minus(em),p.plus(em),c),u=Os(p.times(p),c),r=3;;){if(a=Os(a.times(u),c),s=l.plus(BA(a,new y(r),c)),c3(s.d).slice(0,c)===c3(l.d).slice(0,c))return l=l.times(2),i!==0&&(l=l.plus(bue(y,c+2,w).times(i+""))),l=BA(l,new y(d),c),y.precision=w,e==null?(eu=!0,Os(l,w)):l;l=s,r+=2}}function JWe(t,e){var n,o,r;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(o=e.search(/e/i))>0?(n<0&&(n=o),n+=+e.slice(o+1),e=e.substring(0,o)):n<0&&(n=e.length),o=0;e.charCodeAt(o)===48;)++o;for(r=e.length;e.charCodeAt(r-1)===48;)--r;if(e=e.slice(o,r),e){if(r-=o,n=n-o-1,t.e=$I(n/Pc),t.d=[],o=(n+1)%Pc,n<0&&(o+=Pc),ov$||t.e<-v$))throw Error(e8e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Os(t,e,n){var o,r,i,a,l,s,c,u,d=t.d;for(a=1,i=d[0];i>=10;i/=10)a++;if(o=e-a,o<0)o+=Pc,r=e,c=d[u=0];else{if(u=Math.ceil((o+1)/Pc),i=d.length,u>=i)return t;for(c=i=d[u],a=1;i>=10;i/=10)a++;o%=Pc,r=o-Pc+a}if(n!==void 0&&(i=Av(10,a-r-1),l=c/i%10|0,s=e<0||d[u+1]!==void 0||c%i,s=n<4?(l||s)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||s||n==6&&(o>0?r>0?c/Av(10,a-r):0:d[u-1])%10&1||n==(t.s<0?8:7))),e<1||!d[0])return s?(i=T0(t),d.length=1,e=e-i-1,d[0]=Av(10,(Pc-e%Pc)%Pc),t.e=$I(-e/Pc)||0):(d.length=1,d[0]=t.e=t.s=0),t;if(o==0?(d.length=u,i=1,u--):(d.length=u+1,i=Av(10,Pc-o),d[u]=r>0?(c/Av(10,a-r)%Av(10,r)|0)*i:0),s)for(;;)if(u==0){(d[0]+=i)==Hd&&(d[0]=1,++t.e);break}else{if(d[u]+=i,d[u]!=Hd)break;d[u--]=0,i=1}for(o=d.length;d[--o]===0;)d.pop();if(eu&&(t.e>v$||t.e<-v$))throw Error(e8e+T0(t));return t}function Lht(t,e){var n,o,r,i,a,l,s,c,u,d,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),eu?Os(e,p):e;if(s=t.d,d=e.d,o=e.e,c=t.e,s=s.slice(),a=c-o,a){for(u=a<0,u?(n=s,a=-a,l=d.length):(n=d,o=c,l=s.length),r=Math.max(Math.ceil(p/Pc),l)+2,a>r&&(a=r,n.length=1),n.reverse(),r=a;r--;)n.push(0);n.reverse()}else{for(r=s.length,l=d.length,u=r0;--r)s[l++]=0;for(r=d.length;r>a;){if(s[--r]0?i=i.charAt(0)+"."+i.slice(1)+Vw(o):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r<0?"e":"e+")+r):r<0?(i="0."+Vw(-r-1)+i,n&&(o=n-a)>0&&(i+=Vw(o))):r>=a?(i+=Vw(r+1-a),n&&(o=n-r-1)>0&&(i=i+"."+Vw(o))):((o=r+1)0&&(r+1===a&&(i+="."),i+=Vw(o))),t.s<0?"-"+i:i}function KWe(t,e){if(t.length>e)return t.length=e,!0}function Wht(t){var e,n,o;function r(i){var a=this;if(!(a instanceof r))return new r(i);if(a.constructor=r,i instanceof r){a.s=i.s,a.e=i.e,a.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Ib+i);if(i>0)a.s=1;else if(i<0)i=-i,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(i===~~i&&i<1e7){a.e=0,a.d=[i];return}return JWe(a,i.toString())}else if(typeof i!="string")throw Error(Ib+i);if(i.charCodeAt(0)===45?(i=i.slice(1),a.s=-1):a.s=1,Bjo.test(i))JWe(a,i);else throw Error(Ib+i)}if(r.prototype=_r,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.clone=Wht,r.config=r.set=Yjo,t===void 0&&(t={}),t)for(o=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=r[e+1]&&o<=r[e+2])this[n]=o;else throw Error(Ib+n+": "+o);if((o=t[n="LN10"])!==void 0)if(o==Math.LN10)this[n]=new this(o);else throw Error(Ib+n+": "+o);return this}var t8e=Wht(jjo);em=new t8e(1);const Ms=t8e;function Ojo(t){return Xjo(t)||Gjo(t)||Vjo(t)||_jo()}function _jo(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NWo(t,e){if(t){if(typeof t=="string")return lWe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lWe(t,e)}}function lWe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return W.reduce(function(F,E){var L=E.word,j=E.width,Y=F[F.length-1];if(Y&&(r==null||i||Y.width+j+oE.width?F:E})};if(!u)return p;for(var y="…",w=function(W){var F=d.slice(0,W),E=Qft({breakAll:c,style:s,children:F+y}).wordsWithComputedWidth,L=f(E),j=L.length>a||m(L).width>Number(r);return[j,L]},x=0,C=d.length-1,P=0,A;x<=C&&P<=d.length-1;){var S=Math.floor((x+C)/2),v=S-1,b=w(v),T=aWe(b,2),R=T[0],M=T[1],D=w(S),k=aWe(D,1),N=k[0];if(!R&&!N&&(x=S+1),R&&N&&(C=S-1),!R&&N){A=M;break}P++}return A||p},sWe=function(e){var n=ca(e)?[]:e.toString().split(qft);return[{words:n}]},YWo=function(e){var n=e.width,o=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,l=e.maxLines;if((n||o)&&!G7.isSsr){var s,c,u=Qft({breakAll:a,children:r,style:i});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;s=d,c=f}else return sWe(r);return BWo({breakAll:a,children:r,maxLines:l,style:i},s,c,n,o)}return sWe(r)},cWe="#808080",d$=function(e){var n=e.x,o=n===void 0?0:n,r=e.y,i=r===void 0?0:r,a=e.lineHeight,l=a===void 0?"1em":a,s=e.capHeight,c=s===void 0?"0.71em":s,u=e.scaleToFit,d=u===void 0?!1:u,f=e.textAnchor,p=f===void 0?"start":f,m=e.verticalAnchor,y=m===void 0?"end":m,w=e.fill,x=w===void 0?cWe:w,C=iWe(e,kWo),P=g.useMemo(function(){return YWo({breakAll:C.breakAll,children:C.children,maxLines:C.maxLines,scaleToFit:d,style:C.style,width:C.width})},[C.breakAll,C.children,C.maxLines,d,C.style,C.width]),A=C.dx,S=C.dy,v=C.angle,b=C.className,T=C.breakAll,R=iWe(C,FWo);if(!J0(o)||!J0(i))return null;var M=o+(pr(A)?A:0),D=i+(pr(S)?S:0),k;switch(y){case"start":k=pue("calc(".concat(c,")"));break;case"middle":k=pue("calc(".concat((P.length-1)/2," * -").concat(l," + (").concat(c," / 2))"));break;default:k=pue("calc(".concat(P.length-1," * -").concat(l,")"));break}var N=[];if(d){var U=P[0].width,W=C.width;N.push("scale(".concat((pr(W)?W/U:1)/U,")"))}return v&&N.push("rotate(".concat(v,", ").concat(M,", ").concat(D,")")),N.length&&(R.transform=N.join(" ")),xe.createElement("text",Oge({},sa(R,!0),{x:M,y:D,className:gl("recharts-text",b),textAnchor:p,fill:x.includes("url")?cWe:x}),P.map(function(F,E){var L=F.words.join(T?"":" ");return xe.createElement("tspan",{x:M,dy:E===0?k:l,key:L},L)}))};function j8(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function OWo(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function Ewe(t){let e,n,o;t.length!==2?(e=j8,n=(l,s)=>j8(t(l),s),o=(l,s)=>t(l)-s):(e=t===j8||t===OWo?t:_Wo,n=t,o=t);function r(l,s,c=0,u=l.length){if(c>>1;n(l[d],s)<0?c=d+1:u=d}while(c>>1;n(l[d],s)<=0?c=d+1:u=d}while(cc&&o(l[d-1],s)>-o(l[d],s)?d-1:d}return{left:r,center:a,right:i}}function _Wo(){return 0}function Zft(t){return t===null?NaN:+t}function*VWo(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const GWo=Ewe(j8),Ij=GWo.right;Ewe(Zft).center;class uWe extends Map{constructor(e,n=KWo){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[o,r]of e)this.set(o,r)}get(e){return super.get(dWe(this,e))}has(e){return super.has(dWe(this,e))}set(e,n){return super.set(XWo(this,e),n)}delete(e){return super.delete(JWo(this,e))}}function dWe({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):n}function XWo({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):(t.set(o,n),n)}function JWo({_intern:t,_key:e},n){const o=e(n);return t.has(o)&&(n=t.get(o),t.delete(o)),n}function KWo(t){return t!==null&&typeof t=="object"?t.valueOf():t}function $Wo(t=j8){if(t===j8)return eht;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const o=t(e,n);return o||o===0?o:(t(n,n)===0)-(t(e,e)===0)}}function eht(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const qWo=Math.sqrt(50),QWo=Math.sqrt(10),ZWo=Math.sqrt(2);function f$(t,e,n){const o=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(o)),i=o/Math.pow(10,r),a=i>=qWo?10:i>=QWo?5:i>=ZWo?2:1;let l,s,c;return r<0?(c=Math.pow(10,-r)/a,l=Math.round(t*c),s=Math.round(e*c),l/ce&&--s,c=-c):(c=Math.pow(10,r)*a,l=Math.round(t/c),s=Math.round(e/c),l*ce&&--s),s0))return[];if(t===e)return[t];const o=e=r))return[];const l=i-r+1,s=new Array(l);if(o)if(a<0)for(let c=0;c=o)&&(n=o);return n}function hWe(t,e){let n;for(const o of t)o!=null&&(n>o||n===void 0&&o>=o)&&(n=o);return n}function tht(t,e,n=0,o=1/0,r){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(t.length-1,o)),!(n<=e&&e<=o))return t;for(r=r===void 0?eht:$Wo(r);o>n;){if(o-n>600){const s=o-n+1,c=e-n+1,u=Math.log(s),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(s-d)/s)*(c-s/2<0?-1:1),p=Math.max(n,Math.floor(e-c*d/s+f)),m=Math.min(o,Math.floor(e+(s-c)*d/s+f));tht(t,e,p,m,r)}const i=t[e];let a=n,l=o;for(ME(t,n,e),r(t[o],i)>0&&ME(t,n,o);a0;)--l}r(t[n],i)===0?ME(t,n,l):(++l,ME(t,l,o)),l<=e&&(n=l+1),e<=l&&(o=l-1)}return t}function ME(t,e,n){const o=t[e];t[e]=t[n],t[n]=o}function eNo(t,e,n){if(t=Float64Array.from(VWo(t)),!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return hWe(t);if(e>=1)return fWe(t);var o,r=(o-1)*e,i=Math.floor(r),a=fWe(tht(t,i).subarray(0,i+1)),l=hWe(t.subarray(i+1));return a+(l-a)*(r-i)}}function tNo(t,e,n=Zft){if(!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return+n(t[0],0,t);if(e>=1)return+n(t[o-1],o-1,t);var o,r=(o-1)*e,i=Math.floor(r),a=+n(t[i],i,t),l=+n(t[i+1],i+1,t);return a+(l-a)*(r-i)}}function nNo(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var o=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(r);++o>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?AV(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?AV(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=rNo.exec(t))?new R1(e[1],e[2],e[3],1):(e=iNo.exec(t))?new R1(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=aNo.exec(t))?AV(e[1],e[2],e[3],e[4]):(e=lNo.exec(t))?AV(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=sNo.exec(t))?xWe(e[1],e[2]/100,e[3]/100,1):(e=cNo.exec(t))?xWe(e[1],e[2]/100,e[3]/100,e[4]):pWe.hasOwnProperty(t)?yWe(pWe[t]):t==="transparent"?new R1(NaN,NaN,NaN,0):null}function yWe(t){return new R1(t>>16&255,t>>8&255,t&255,1)}function AV(t,e,n,o){return o<=0&&(t=e=n=NaN),new R1(t,e,n,o)}function fNo(t){return t instanceof zj||(t=jW(t)),t?(t=t.rgb(),new R1(t.r,t.g,t.b,t.opacity)):new R1}function Jge(t,e,n,o){return arguments.length===1?fNo(t):new R1(t,e,n,o??1)}function R1(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}kwe(R1,Jge,oht(zj,{brighter(t){return t=t==null?h$:Math.pow(h$,t),new R1(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?NW:Math.pow(NW,t),new R1(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new R1(Mb(this.r),Mb(this.g),Mb(this.b),p$(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:AWe,formatHex:AWe,formatHex8:hNo,formatRgb:wWe,toString:wWe}));function AWe(){return`#${tb(this.r)}${tb(this.g)}${tb(this.b)}`}function hNo(){return`#${tb(this.r)}${tb(this.g)}${tb(this.b)}${tb((isNaN(this.opacity)?1:this.opacity)*255)}`}function wWe(){const t=p$(this.opacity);return`${t===1?"rgb(":"rgba("}${Mb(this.r)}, ${Mb(this.g)}, ${Mb(this.b)}${t===1?")":`, ${t})`}`}function p$(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Mb(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function tb(t){return t=Mb(t),(t<16?"0":"")+t.toString(16)}function xWe(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new s5(t,e,n,o)}function rht(t){if(t instanceof s5)return new s5(t.h,t.s,t.l,t.opacity);if(t instanceof zj||(t=jW(t)),!t)return new s5;if(t instanceof s5)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,l=i-r,s=(i+r)/2;return l?(e===i?a=(n-o)/l+(n0&&s<1?0:a,new s5(a,l,s,t.opacity)}function pNo(t,e,n,o){return arguments.length===1?rht(t):new s5(t,e,n,o??1)}function s5(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}kwe(s5,pNo,oht(zj,{brighter(t){return t=t==null?h$:Math.pow(h$,t),new s5(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?NW:Math.pow(NW,t),new s5(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new R1(gue(t>=240?t-240:t+120,r,o),gue(t,r,o),gue(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new s5(vWe(this.h),wV(this.s),wV(this.l),p$(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=p$(this.opacity);return`${t===1?"hsl(":"hsla("}${vWe(this.h)}, ${wV(this.s)*100}%, ${wV(this.l)*100}%${t===1?")":`, ${t})`}`}}));function vWe(t){return t=(t||0)%360,t<0?t+360:t}function wV(t){return Math.max(0,Math.min(1,t||0))}function gue(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Fwe=t=>()=>t;function gNo(t,e){return function(n){return t+n*e}}function mNo(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function yNo(t){return(t=+t)==1?iht:function(e,n){return n-e?mNo(e,n,t):Fwe(isNaN(e)?n:e)}}function iht(t,e){var n=e-t;return n?gNo(t,n):Fwe(isNaN(t)?e:t)}const bWe=function t(e){var n=yNo(e);function o(r,i){var a=n((r=Jge(r)).r,(i=Jge(i)).r),l=n(r.g,i.g),s=n(r.b,i.b),c=iht(r.opacity,i.opacity);return function(u){return r.r=a(u),r.g=l(u),r.b=s(u),r.opacity=c(u),r+""}}return o.gamma=t,o}(1);function ANo(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),r;return function(i){for(r=0;rn&&(i=e.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(o=o[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,s.push({i:a,x:g$(o,r)})),n=mue.lastIndex;return ne&&(n=t,t=e,e=n),function(o){return Math.max(t,Math.min(e,o))}}function MNo(t,e,n){var o=t[0],r=t[1],i=e[0],a=e[1];return r2?INo:MNo,s=c=null,d}function d(f){return f==null||isNaN(f=+f)?i:(s||(s=l(t.map(o),e,n)))(o(a(f)))}return d.invert=function(f){return a(r((c||(c=l(e,t.map(o),g$)))(f)))},d.domain=function(f){return arguments.length?(t=Array.from(f,m$),u()):t.slice()},d.range=function(f){return arguments.length?(e=Array.from(f),u()):e.slice()},d.rangeRound=function(f){return e=Array.from(f),n=Lwe,u()},d.clamp=function(f){return arguments.length?(a=f?!0:Wp,u()):a!==Wp},d.interpolate=function(f){return arguments.length?(n=f,u()):n},d.unknown=function(f){return arguments.length?(i=f,d):i},function(f,p){return o=f,r=p,u()}}function Wwe(){return Poe()(Wp,Wp)}function zNo(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function y$(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,o=t.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+t.slice(n+1)]}function dM(t){return t=y$(Math.abs(t)),t?t[1]:NaN}function DNo(t,e){return function(n,o){for(var r=n.length,i=[],a=0,l=t[0],s=0;r>0&&l>0&&(s+l+1>o&&(l=Math.max(1,o-s)),i.push(n.substring(r-=l,r+l)),!((s+=l+1)>o));)l=t[a=(a+1)%t.length];return i.reverse().join(e)}}function ENo(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var kNo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function BW(t){if(!(e=kNo.exec(t)))throw new Error("invalid format: "+t);var e;return new Nwe({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}BW.prototype=Nwe.prototype;function Nwe(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Nwe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function FNo(t){e:for(var e=t.length,n=1,o=-1,r;n0&&(o=0);break}return o>0?t.slice(0,o)+t.slice(r+1):t}var aht;function LNo(t,e){var n=y$(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(aht=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=o.length;return i===a?o:i>a?o+new Array(i-a+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+y$(t,Math.max(0,e+i-1))[0]}function TWe(t,e){var n=y$(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}const PWe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:zNo,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>TWe(t*100,e),r:TWe,s:LNo,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function CWe(t){return t}var RWe=Array.prototype.map,HWe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function WNo(t){var e=t.grouping===void 0||t.thousands===void 0?CWe:DNo(RWe.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",o=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?CWe:ENo(RWe.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",s=t.nan===void 0?"NaN":t.nan+"";function c(d){d=BW(d);var f=d.fill,p=d.align,m=d.sign,y=d.symbol,w=d.zero,x=d.width,C=d.comma,P=d.precision,A=d.trim,S=d.type;S==="n"?(C=!0,S="g"):PWe[S]||(P===void 0&&(P=12),A=!0,S="g"),(w||f==="0"&&p==="=")&&(w=!0,f="0",p="=");var v=y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",b=y==="$"?o:/[%p]/.test(S)?a:"",T=PWe[S],R=/[defgprs%]/.test(S);P=P===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function M(D){var k=v,N=b,U,W,F;if(S==="c")N=T(D)+N,D="";else{D=+D;var E=D<0||1/D<0;if(D=isNaN(D)?s:T(Math.abs(D),P),A&&(D=FNo(D)),E&&+D==0&&m!=="+"&&(E=!1),k=(E?m==="("?m:l:m==="-"||m==="("?"":m)+k,N=(S==="s"?HWe[8+aht/3]:"")+N+(E&&m==="("?")":""),R){for(U=-1,W=D.length;++UF||F>57){N=(F===46?r+D.slice(U+1):D.slice(U))+N,D=D.slice(0,U);break}}}C&&!w&&(D=e(D,1/0));var L=k.length+D.length+N.length,j=L>1)+k+D+N+j.slice(L);break;default:D=j+k+D+N;break}return i(D)}return M.toString=function(){return d+""},M}function u(d,f){var p=c((d=BW(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(dM(f)/3)))*3,y=Math.pow(10,-m),w=HWe[8+m/3];return function(x){return p(y*x)+w}}return{format:c,formatPrefix:u}}var xV,Uwe,lht;NNo({thousands:",",grouping:[3],currency:["$",""]});function NNo(t){return xV=WNo(t),Uwe=xV.format,lht=xV.formatPrefix,xV}function UNo(t){return Math.max(0,-dM(Math.abs(t)))}function jNo(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(dM(e)/3)))*3-dM(Math.abs(t)))}function BNo(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,dM(e)-dM(t))+1}function sht(t,e,n,o){var r=Gge(t,e,n),i;switch(o=BW(o??",f"),o.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return o.precision==null&&!isNaN(i=jNo(r,a))&&(o.precision=i),lht(o,a)}case"":case"e":case"g":case"p":case"r":{o.precision==null&&!isNaN(i=BNo(r,Math.max(Math.abs(t),Math.abs(e))))&&(o.precision=i-(o.type==="e"));break}case"f":case"%":{o.precision==null&&!isNaN(i=UNo(r))&&(o.precision=i-(o.type==="%")*2);break}}return Uwe(o)}function X7(t){var e=t.domain;return t.ticks=function(n){var o=e();return _ge(o[0],o[o.length-1],n??10)},t.tickFormat=function(n,o){var r=e();return sht(r[0],r[r.length-1],n??10,o)},t.nice=function(n){n==null&&(n=10);var o=e(),r=0,i=o.length-1,a=o[r],l=o[i],s,c,u=10;for(l0;){if(c=Vge(a,l,n),c===s)return o[r]=a,o[i]=l,e(o);if(c>0)a=Math.floor(a/c)*c,l=Math.ceil(l/c)*c;else if(c<0)a=Math.ceil(a*c)/c,l=Math.floor(l*c)/c;else break;s=c}return t},t}function YW(){var t=Wwe();return t.copy=function(){return Dj(t,YW())},u2.apply(t,arguments),X7(t)}function cht(t){var e;function n(o){return o==null||isNaN(o=+o)?e:o}return n.invert=n,n.domain=n.range=function(o){return arguments.length?(t=Array.from(o,m$),n):t.slice()},n.unknown=function(o){return arguments.length?(e=o,n):e},n.copy=function(){return cht(t).unknown(e)},t=arguments.length?Array.from(t,m$):[0,1],X7(n)}function uht(t,e){t=t.slice();var n=0,o=t.length-1,r=t[n],i=t[o],a;return iMath.pow(t,e)}function GNo(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function zWe(t){return(e,n)=>-t(-e,n)}function jwe(t){const e=t(MWe,IWe),n=e.domain;let o=10,r,i;function a(){return r=GNo(o),i=VNo(o),n()[0]<0?(r=zWe(r),i=zWe(i),t(YNo,ONo)):t(MWe,IWe),e}return e.base=function(l){return arguments.length?(o=+l,a()):o},e.domain=function(l){return arguments.length?(n(l),a()):n()},e.ticks=l=>{const s=n();let c=s[0],u=s[s.length-1];const d=u0){for(;f<=p;++f)for(m=1;mu)break;x.push(y)}}else for(;f<=p;++f)for(m=o-1;m>=1;--m)if(y=f>0?m/i(-f):m*i(f),!(yu)break;x.push(y)}x.length*2{if(l==null&&(l=10),s==null&&(s=o===10?"s":","),typeof s!="function"&&(!(o%1)&&(s=BW(s)).precision==null&&(s.trim=!0),s=Uwe(s)),l===1/0)return s;const c=Math.max(1,o*l/e.ticks().length);return u=>{let d=u/i(Math.round(r(u)));return d*on(uht(n(),{floor:l=>i(Math.floor(r(l))),ceil:l=>i(Math.ceil(r(l)))})),e}function dht(){const t=jwe(Poe()).domain([1,10]);return t.copy=()=>Dj(t,dht()).base(t.base()),u2.apply(t,arguments),t}function DWe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function EWe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Bwe(t){var e=1,n=t(DWe(e),EWe(e));return n.constant=function(o){return arguments.length?t(DWe(e=+o),EWe(e)):e},X7(n)}function fht(){var t=Bwe(Poe());return t.copy=function(){return Dj(t,fht()).constant(t.constant())},u2.apply(t,arguments)}function kWe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function XNo(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function JNo(t){return t<0?-t*t:t*t}function Ywe(t){var e=t(Wp,Wp),n=1;function o(){return n===1?t(Wp,Wp):n===.5?t(XNo,JNo):t(kWe(n),kWe(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,o()):n},X7(e)}function Owe(){var t=Ywe(Poe());return t.copy=function(){return Dj(t,Owe()).exponent(t.exponent())},u2.apply(t,arguments),t}function KNo(){return Owe.apply(null,arguments).exponent(.5)}function FWe(t){return Math.sign(t)*t*t}function $No(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function hht(){var t=Wwe(),e=[0,1],n=!1,o;function r(i){var a=$No(t(i));return isNaN(a)?o:n?Math.round(a):a}return r.invert=function(i){return t.invert(FWe(i))},r.domain=function(i){return arguments.length?(t.domain(i),r):t.domain()},r.range=function(i){return arguments.length?(t.range((e=Array.from(i,m$)).map(FWe)),r):e.slice()},r.rangeRound=function(i){return r.range(i).round(!0)},r.round=function(i){return arguments.length?(n=!!i,r):n},r.clamp=function(i){return arguments.length?(t.clamp(i),r):t.clamp()},r.unknown=function(i){return arguments.length?(o=i,r):o},r.copy=function(){return hht(t.domain(),e).round(n).clamp(t.clamp()).unknown(o)},u2.apply(r,arguments),X7(r)}function pht(){var t=[],e=[],n=[],o;function r(){var a=0,l=Math.max(1,e.length);for(n=new Array(l-1);++a0?n[l-1]:t[0],l=n?[o[n-1],e]:[o[c-1],o[c]]},a.unknown=function(s){return arguments.length&&(i=s),a},a.thresholds=function(){return o.slice()},a.copy=function(){return ght().domain([t,e]).range(r).unknown(i)},u2.apply(X7(a),arguments)}function mht(){var t=[.5],e=[0,1],n,o=1;function r(i){return i!=null&&i<=i?e[Ij(t,i,0,o)]:n}return r.domain=function(i){return arguments.length?(t=Array.from(i),o=Math.min(t.length,e.length-1),r):t.slice()},r.range=function(i){return arguments.length?(e=Array.from(i),o=Math.min(t.length,e.length-1),r):e.slice()},r.invertExtent=function(i){var a=e.indexOf(i);return[t[a-1],t[a]]},r.unknown=function(i){return arguments.length?(n=i,r):n},r.copy=function(){return mht().domain(t).range(e).unknown(n)},u2.apply(r,arguments)}const yue=new Date,Aue=new Date;function cd(t,e,n,o){function r(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return r.floor=i=>(t(i=new Date(+i)),i),r.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),r.round=i=>{const a=r(i),l=r.ceil(i);return i-a(e(i=new Date(+i),a==null?1:Math.floor(a)),i),r.range=(i,a,l)=>{const s=[];if(i=r.ceil(i),l=l==null?1:Math.floor(l),!(i0))return s;let c;do s.push(c=new Date(+i)),e(i,l),t(i);while(ccd(a=>{if(a>=a)for(;t(a),!i(a);)a.setTime(a-1)},(a,l)=>{if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!i(a););else for(;--l>=0;)for(;e(a,1),!i(a););}),n&&(r.count=(i,a)=>(yue.setTime(+i),Aue.setTime(+a),t(yue),t(Aue),Math.floor(n(yue,Aue))),r.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?r.filter(o?a=>o(a)%i===0:a=>r.count(0,a)%i===0):r)),r}const A$=cd(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);A$.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?cd(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):A$);A$.range;const bA=1e3,Iy=bA*60,SA=Iy*60,a4=SA*24,_we=a4*7,LWe=a4*30,wue=a4*365,nb=cd(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*bA)},(t,e)=>(e-t)/bA,t=>t.getUTCSeconds());nb.range;const Vwe=cd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*bA)},(t,e)=>{t.setTime(+t+e*Iy)},(t,e)=>(e-t)/Iy,t=>t.getMinutes());Vwe.range;const Gwe=cd(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Iy)},(t,e)=>(e-t)/Iy,t=>t.getUTCMinutes());Gwe.range;const Xwe=cd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*bA-t.getMinutes()*Iy)},(t,e)=>{t.setTime(+t+e*SA)},(t,e)=>(e-t)/SA,t=>t.getHours());Xwe.range;const Jwe=cd(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*SA)},(t,e)=>(e-t)/SA,t=>t.getUTCHours());Jwe.range;const Ej=cd(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Iy)/a4,t=>t.getDate()-1);Ej.range;const Coe=cd(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/a4,t=>t.getUTCDate()-1);Coe.range;const yht=cd(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/a4,t=>Math.floor(t/a4));yht.range;function hT(t){return cd(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Iy)/_we)}const Roe=hT(0),w$=hT(1),qNo=hT(2),QNo=hT(3),fM=hT(4),ZNo=hT(5),eUo=hT(6);Roe.range;w$.range;qNo.range;QNo.range;fM.range;ZNo.range;eUo.range;function pT(t){return cd(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/_we)}const Hoe=pT(0),x$=pT(1),tUo=pT(2),nUo=pT(3),hM=pT(4),oUo=pT(5),rUo=pT(6);Hoe.range;x$.range;tUo.range;nUo.range;hM.range;oUo.range;rUo.range;const Kwe=cd(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Kwe.range;const $we=cd(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());$we.range;const l4=cd(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());l4.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:cd(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});l4.range;const s4=cd(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());s4.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:cd(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});s4.range;function Aht(t,e,n,o,r,i){const a=[[nb,1,bA],[nb,5,5*bA],[nb,15,15*bA],[nb,30,30*bA],[i,1,Iy],[i,5,5*Iy],[i,15,15*Iy],[i,30,30*Iy],[r,1,SA],[r,3,3*SA],[r,6,6*SA],[r,12,12*SA],[o,1,a4],[o,2,2*a4],[n,1,_we],[e,1,LWe],[e,3,3*LWe],[t,1,wue]];function l(c,u,d){const f=uw).right(a,f);if(p===a.length)return t.every(Gge(c/wue,u/wue,d));if(p===0)return A$.every(Math.max(Gge(c,u,d),1));const[m,y]=a[f/a[p-1][2]53)return null;"w"in q||(q.w=1),"Z"in q?(de=vue(IE(q.y,0,1)),he=de.getUTCDay(),de=he>4||he===0?x$.ceil(de):x$(de),de=Coe.offset(de,(q.V-1)*7),q.y=de.getUTCFullYear(),q.m=de.getUTCMonth(),q.d=de.getUTCDate()+(q.w+6)%7):(de=xue(IE(q.y,0,1)),he=de.getDay(),de=he>4||he===0?w$.ceil(de):w$(de),de=Ej.offset(de,(q.V-1)*7),q.y=de.getFullYear(),q.m=de.getMonth(),q.d=de.getDate()+(q.w+6)%7)}else("W"in q||"U"in q)&&("w"in q||(q.w="u"in q?q.u%7:"W"in q?1:0),he="Z"in q?vue(IE(q.y,0,1)).getUTCDay():xue(IE(q.y,0,1)).getDay(),q.m=0,q.d="W"in q?(q.w+6)%7+q.W*7-(he+5)%7:q.w+q.U*7-(he+6)%7);return"Z"in q?(q.H+=q.Z/100|0,q.M+=q.Z%100,vue(q)):xue(q)}}function T(Z,ne,te,q){for(var le=0,de=ne.length,he=te.length,me,ce;le=he)return-1;if(me=ne.charCodeAt(le++),me===37){if(me=ne.charAt(le++),ce=S[me in WWe?ne.charAt(le++):me],!ce||(q=ce(Z,te,q))<0)return-1}else if(me!=te.charCodeAt(q++))return-1}return q}function R(Z,ne,te){var q=c.exec(ne.slice(te));return q?(Z.p=u.get(q[0].toLowerCase()),te+q[0].length):-1}function M(Z,ne,te){var q=p.exec(ne.slice(te));return q?(Z.w=m.get(q[0].toLowerCase()),te+q[0].length):-1}function D(Z,ne,te){var q=d.exec(ne.slice(te));return q?(Z.w=f.get(q[0].toLowerCase()),te+q[0].length):-1}function k(Z,ne,te){var q=x.exec(ne.slice(te));return q?(Z.m=C.get(q[0].toLowerCase()),te+q[0].length):-1}function N(Z,ne,te){var q=y.exec(ne.slice(te));return q?(Z.m=w.get(q[0].toLowerCase()),te+q[0].length):-1}function U(Z,ne,te){return T(Z,e,ne,te)}function W(Z,ne,te){return T(Z,n,ne,te)}function F(Z,ne,te){return T(Z,o,ne,te)}function E(Z){return a[Z.getDay()]}function L(Z){return i[Z.getDay()]}function j(Z){return s[Z.getMonth()]}function Y(Z){return l[Z.getMonth()]}function O(Z){return r[+(Z.getHours()>=12)]}function _(Z){return 1+~~(Z.getMonth()/3)}function G(Z){return a[Z.getUTCDay()]}function Q(Z){return i[Z.getUTCDay()]}function oe(Z){return s[Z.getUTCMonth()]}function ee(Z){return l[Z.getUTCMonth()]}function $(Z){return r[+(Z.getUTCHours()>=12)]}function ae(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var ne=v(Z+="",P);return ne.toString=function(){return Z},ne},parse:function(Z){var ne=b(Z+="",!1);return ne.toString=function(){return Z},ne},utcFormat:function(Z){var ne=v(Z+="",A);return ne.toString=function(){return Z},ne},utcParse:function(Z){var ne=b(Z+="",!0);return ne.toString=function(){return Z},ne}}}var WWe={"-":"",_:" ",0:"0"},_d=/^\s*\d+/,uUo=/^%/,dUo=/[\\^$*+?|[\]().{}]/g;function Xl(t,e,n){var o=t<0?"-":"",r=(o?-t:t)+"",i=r.length;return o+(i[e.toLowerCase(),n]))}function hUo(t,e,n){var o=_d.exec(e.slice(n,n+1));return o?(t.w=+o[0],n+o[0].length):-1}function pUo(t,e,n){var o=_d.exec(e.slice(n,n+1));return o?(t.u=+o[0],n+o[0].length):-1}function gUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.U=+o[0],n+o[0].length):-1}function mUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.V=+o[0],n+o[0].length):-1}function yUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.W=+o[0],n+o[0].length):-1}function NWe(t,e,n){var o=_d.exec(e.slice(n,n+4));return o?(t.y=+o[0],n+o[0].length):-1}function UWe(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.y=+o[0]+(+o[0]>68?1900:2e3),n+o[0].length):-1}function AUo(t,e,n){var o=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return o?(t.Z=o[1]?0:-(o[2]+(o[3]||"00")),n+o[0].length):-1}function wUo(t,e,n){var o=_d.exec(e.slice(n,n+1));return o?(t.q=o[0]*3-3,n+o[0].length):-1}function xUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.m=o[0]-1,n+o[0].length):-1}function jWe(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.d=+o[0],n+o[0].length):-1}function vUo(t,e,n){var o=_d.exec(e.slice(n,n+3));return o?(t.m=0,t.d=+o[0],n+o[0].length):-1}function BWe(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.H=+o[0],n+o[0].length):-1}function bUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.M=+o[0],n+o[0].length):-1}function SUo(t,e,n){var o=_d.exec(e.slice(n,n+2));return o?(t.S=+o[0],n+o[0].length):-1}function TUo(t,e,n){var o=_d.exec(e.slice(n,n+3));return o?(t.L=+o[0],n+o[0].length):-1}function PUo(t,e,n){var o=_d.exec(e.slice(n,n+6));return o?(t.L=Math.floor(o[0]/1e3),n+o[0].length):-1}function CUo(t,e,n){var o=uUo.exec(e.slice(n,n+1));return o?n+o[0].length:-1}function RUo(t,e,n){var o=_d.exec(e.slice(n));return o?(t.Q=+o[0],n+o[0].length):-1}function HUo(t,e,n){var o=_d.exec(e.slice(n));return o?(t.s=+o[0],n+o[0].length):-1}function YWe(t,e){return Xl(t.getDate(),e,2)}function MUo(t,e){return Xl(t.getHours(),e,2)}function IUo(t,e){return Xl(t.getHours()%12||12,e,2)}function zUo(t,e){return Xl(1+Ej.count(l4(t),t),e,3)}function wht(t,e){return Xl(t.getMilliseconds(),e,3)}function DUo(t,e){return wht(t,e)+"000"}function EUo(t,e){return Xl(t.getMonth()+1,e,2)}function kUo(t,e){return Xl(t.getMinutes(),e,2)}function FUo(t,e){return Xl(t.getSeconds(),e,2)}function LUo(t){var e=t.getDay();return e===0?7:e}function WUo(t,e){return Xl(Roe.count(l4(t)-1,t),e,2)}function xht(t){var e=t.getDay();return e>=4||e===0?fM(t):fM.ceil(t)}function NUo(t,e){return t=xht(t),Xl(fM.count(l4(t),t)+(l4(t).getDay()===4),e,2)}function UUo(t){return t.getDay()}function jUo(t,e){return Xl(w$.count(l4(t)-1,t),e,2)}function BUo(t,e){return Xl(t.getFullYear()%100,e,2)}function YUo(t,e){return t=xht(t),Xl(t.getFullYear()%100,e,2)}function OUo(t,e){return Xl(t.getFullYear()%1e4,e,4)}function _Uo(t,e){var n=t.getDay();return t=n>=4||n===0?fM(t):fM.ceil(t),Xl(t.getFullYear()%1e4,e,4)}function VUo(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Xl(e/60|0,"0",2)+Xl(e%60,"0",2)}function OWe(t,e){return Xl(t.getUTCDate(),e,2)}function GUo(t,e){return Xl(t.getUTCHours(),e,2)}function XUo(t,e){return Xl(t.getUTCHours()%12||12,e,2)}function JUo(t,e){return Xl(1+Coe.count(s4(t),t),e,3)}function vht(t,e){return Xl(t.getUTCMilliseconds(),e,3)}function KUo(t,e){return vht(t,e)+"000"}function $Uo(t,e){return Xl(t.getUTCMonth()+1,e,2)}function qUo(t,e){return Xl(t.getUTCMinutes(),e,2)}function QUo(t,e){return Xl(t.getUTCSeconds(),e,2)}function ZUo(t){var e=t.getUTCDay();return e===0?7:e}function ejo(t,e){return Xl(Hoe.count(s4(t)-1,t),e,2)}function bht(t){var e=t.getUTCDay();return e>=4||e===0?hM(t):hM.ceil(t)}function tjo(t,e){return t=bht(t),Xl(hM.count(s4(t),t)+(s4(t).getUTCDay()===4),e,2)}function njo(t){return t.getUTCDay()}function ojo(t,e){return Xl(x$.count(s4(t)-1,t),e,2)}function rjo(t,e){return Xl(t.getUTCFullYear()%100,e,2)}function ijo(t,e){return t=bht(t),Xl(t.getUTCFullYear()%100,e,2)}function ajo(t,e){return Xl(t.getUTCFullYear()%1e4,e,4)}function ljo(t,e){var n=t.getUTCDay();return t=n>=4||n===0?hM(t):hM.ceil(t),Xl(t.getUTCFullYear()%1e4,e,4)}function sjo(){return"+0000"}function _We(){return"%"}function VWe(t){return+t}function GWe(t){return Math.floor(+t/1e3)}var nC,Sht,Tht;cjo({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function cjo(t){return nC=cUo(t),Sht=nC.format,nC.parse,Tht=nC.utcFormat,nC.utcParse,nC}function ujo(t){return new Date(t)}function djo(t){return t instanceof Date?+t:+new Date(+t)}function qwe(t,e,n,o,r,i,a,l,s,c){var u=Wwe(),d=u.invert,f=u.domain,p=c(".%L"),m=c(":%S"),y=c("%I:%M"),w=c("%I %p"),x=c("%a %d"),C=c("%b %d"),P=c("%B"),A=c("%Y");function S(v){return(s(v)e(r/(t.length-1)))},n.quantiles=function(o){return Array.from({length:o+1},(r,i)=>eNo(t,i/o))},n.copy=function(){return Hht(e).domain(t)},C4.apply(n,arguments)}function Ioe(){var t=0,e=.5,n=1,o=1,r,i,a,l,s,c=Wp,u,d=!1,f;function p(y){return isNaN(y=+y)?f:(y=.5+((y=+u(y))-i)*(o*ye}var wjo=Ajo,xjo=Dht,vjo=wjo,bjo=eT;function Sjo(t){return t&&t.length?xjo(t,bjo,vjo):void 0}var Tjo=Sjo;const A8=ji(Tjo);function Pjo(t,e){return tt.e^i.s<0?1:-1;for(o=i.d.length,r=t.d.length,e=0,n=ot.d[e]^i.s<0?1:-1;return o===r?0:o>r^i.s<0?1:-1};_r.decimalPlaces=_r.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Pc;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};_r.dividedBy=_r.div=function(t){return BA(this,new this.constructor(t))};_r.dividedToIntegerBy=_r.idiv=function(t){var e=this,n=e.constructor;return Os(BA(e,new n(t),0,1),n.precision)};_r.equals=_r.eq=function(t){return!this.cmp(t)};_r.exponent=function(){return T0(this)};_r.greaterThan=_r.gt=function(t){return this.cmp(t)>0};_r.greaterThanOrEqualTo=_r.gte=function(t){return this.cmp(t)>=0};_r.isInteger=_r.isint=function(){return this.e>this.d.length-2};_r.isNegative=_r.isneg=function(){return this.s<0};_r.isPositive=_r.ispos=function(){return this.s>0};_r.isZero=function(){return this.s===0};_r.lessThan=_r.lt=function(t){return this.cmp(t)<0};_r.lessThanOrEqualTo=_r.lte=function(t){return this.cmp(t)<1};_r.logarithm=_r.log=function(t){var e,n=this,o=n.constructor,r=o.precision,i=r+5;if(t===void 0)t=new o(10);else if(t=new o(t),t.s<1||t.eq(em))throw Error(Jy+"NaN");if(n.s<1)throw Error(Jy+(n.s?"NaN":"-Infinity"));return n.eq(em)?new o(0):(eu=!1,e=BA(OW(n,i),OW(t,i),i),eu=!0,Os(e,r))};_r.minus=_r.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Lht(e,t):kht(e,(t.s=-t.s,t))};_r.modulo=_r.mod=function(t){var e,n=this,o=n.constructor,r=o.precision;if(t=new o(t),!t.s)throw Error(Jy+"NaN");return n.s?(eu=!1,e=BA(n,t,0,1).times(t),eu=!0,n.minus(e)):Os(new o(n),r)};_r.naturalExponential=_r.exp=function(){return Fht(this)};_r.naturalLogarithm=_r.ln=function(){return OW(this)};_r.negated=_r.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};_r.plus=_r.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?kht(e,t):Lht(e,(t.s=-t.s,t))};_r.precision=_r.sd=function(t){var e,n,o,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Ib+t);if(e=T0(r)+1,o=r.d.length-1,n=o*Pc+1,o=r.d[o],o){for(;o%10==0;o/=10)n--;for(o=r.d[0];o>=10;o/=10)n++}return t&&e>n?e:n};_r.squareRoot=_r.sqrt=function(){var t,e,n,o,r,i,a,l=this,s=l.constructor;if(l.s<1){if(!l.s)return new s(0);throw Error(Jy+"NaN")}for(t=T0(l),eu=!1,r=Math.sqrt(+l),r==0||r==1/0?(e=c3(l.d),(e.length+t)%2==0&&(e+="0"),r=Math.sqrt(e),t=$I((t+1)/2)-(t<0||t%2),r==1/0?e="5e"+t:(e=r.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),o=new s(e)):o=new s(r.toString()),n=s.precision,r=a=n+3;;)if(i=o,o=i.plus(BA(l,i,a+2)).times(.5),c3(i.d).slice(0,a)===(e=c3(o.d)).slice(0,a)){if(e=e.slice(a-3,a+1),r==a&&e=="4999"){if(Os(i,n+1,0),i.times(i).eq(l)){o=i;break}}else if(e!="9999")break;a+=4}return eu=!0,Os(o,n)};_r.times=_r.mul=function(t){var e,n,o,r,i,a,l,s,c,u=this,d=u.constructor,f=u.d,p=(t=new d(t)).d;if(!u.s||!t.s)return new d(0);for(t.s*=u.s,n=u.e+t.e,s=f.length,c=p.length,s=0;){for(e=0,r=s+o;r>o;)l=i[r]+p[o]*f[r-o-1]+e,i[r--]=l%Hd|0,e=l/Hd|0;i[r]=(i[r]+e)%Hd|0}for(;!i[--a];)i.pop();return e?++n:i.shift(),t.d=i,t.e=n,eu?Os(t,d.precision):t};_r.toDecimalPlaces=_r.todp=function(t,e){var n=this,o=n.constructor;return n=new o(n),t===void 0?n:(B3(t,0,KI),e===void 0?e=o.rounding:B3(e,0,8),Os(n,t+T0(n)+1,e))};_r.toExponential=function(t,e){var n,o=this,r=o.constructor;return t===void 0?n=pS(o,!0):(B3(t,0,KI),e===void 0?e=r.rounding:B3(e,0,8),o=Os(new r(o),t+1,e),n=pS(o,!0,t+1)),n};_r.toFixed=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?pS(r):(B3(t,0,KI),e===void 0?e=i.rounding:B3(e,0,8),o=Os(new i(r),t+T0(r)+1,e),n=pS(o.abs(),!1,t+T0(o)+1),r.isneg()&&!r.isZero()?"-"+n:n)};_r.toInteger=_r.toint=function(){var t=this,e=t.constructor;return Os(new e(t),T0(t)+1,e.rounding)};_r.toNumber=function(){return+this};_r.toPower=_r.pow=function(t){var e,n,o,r,i,a,l=this,s=l.constructor,c=12,u=+(t=new s(t));if(!t.s)return new s(em);if(l=new s(l),!l.s){if(t.s<1)throw Error(Jy+"Infinity");return l}if(l.eq(em))return l;if(o=s.precision,t.eq(em))return Os(l,o);if(e=t.e,n=t.d.length-1,a=e>=n,i=l.s,a){if((n=u<0?-u:u)<=Eht){for(r=new s(em),e=Math.ceil(o/Pc+4),eu=!1;n%2&&(r=r.times(l),KWe(r.d,e)),n=$I(n/2),n!==0;)l=l.times(l),KWe(l.d,e);return eu=!0,t.s<0?new s(em).div(r):Os(r,o)}}else if(i<0)throw Error(Jy+"NaN");return i=i<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,eu=!1,r=t.times(OW(l,o+c)),eu=!0,r=Fht(r),r.s=i,r};_r.toPrecision=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?(n=T0(r),o=pS(r,n<=i.toExpNeg||n>=i.toExpPos)):(B3(t,1,KI),e===void 0?e=i.rounding:B3(e,0,8),r=Os(new i(r),t,e),n=T0(r),o=pS(r,t<=n||n<=i.toExpNeg,t)),o};_r.toSignificantDigits=_r.tosd=function(t,e){var n=this,o=n.constructor;return t===void 0?(t=o.precision,e=o.rounding):(B3(t,1,KI),e===void 0?e=o.rounding:B3(e,0,8)),Os(new o(n),t,e)};_r.toString=_r.valueOf=_r.val=_r.toJSON=_r[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=T0(t),n=t.constructor;return pS(t,e<=n.toExpNeg||e>=n.toExpPos)};function kht(t,e){var n,o,r,i,a,l,s,c,u=t.constructor,d=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),eu?Os(e,d):e;if(s=t.d,c=e.d,a=t.e,r=e.e,s=s.slice(),i=a-r,i){for(i<0?(o=s,i=-i,l=c.length):(o=c,r=a,l=s.length),a=Math.ceil(d/Pc),l=a>l?a+1:l+1,i>l&&(i=l,o.length=1),o.reverse();i--;)o.push(0);o.reverse()}for(l=s.length,i=c.length,l-i<0&&(i=l,o=c,c=s,s=o),n=0;i;)n=(s[--i]=s[i]+c[i]+n)/Hd|0,s[i]%=Hd;for(n&&(s.unshift(n),++r),l=s.length;s[--l]==0;)s.pop();return e.d=s,e.e=r,eu?Os(e,d):e}function B3(t,e,n){if(t!==~~t||tn)throw Error(Ib+t)}function c3(t){var e,n,o,r=t.length-1,i="",a=t[0];if(r>0){for(i+=a,e=1;ea?1:-1;else for(l=s=0;lr[l]?1:-1;break}return s}function n(o,r,i){for(var a=0;i--;)o[i]-=a,a=o[i]1;)o.shift()}return function(o,r,i,a){var l,s,c,u,d,f,p,m,y,w,x,C,P,A,S,v,b,T,R=o.constructor,M=o.s==r.s?1:-1,D=o.d,k=r.d;if(!o.s)return new R(o);if(!r.s)throw Error(Jy+"Division by zero");for(s=o.e-r.e,b=k.length,S=D.length,p=new R(M),m=p.d=[],c=0;k[c]==(D[c]||0);)++c;if(k[c]>(D[c]||0)&&--s,i==null?C=i=R.precision:a?C=i+(T0(o)-T0(r))+1:C=i,C<0)return new R(0);if(C=C/Pc+2|0,c=0,b==1)for(u=0,k=k[0],C++;(c1&&(k=t(k,u),D=t(D,u),b=k.length,S=D.length),A=b,y=D.slice(0,b),w=y.length;w=Hd/2&&++v;do u=0,l=e(k,y,b,w),l<0?(x=y[0],b!=w&&(x=x*Hd+(y[1]||0)),u=x/v|0,u>1?(u>=Hd&&(u=Hd-1),d=t(k,u),f=d.length,w=y.length,l=e(d,y,f,w),l==1&&(u--,n(d,b16)throw Error(e8e+T0(t));if(!t.s)return new u(em);for(eu=!1,l=d,a=new u(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(o=Math.log(Av(2,c))/Math.LN10*2+5|0,l+=o,n=r=i=new u(em),u.precision=l;;){if(r=Os(r.times(t),l),n=n.times(++s),a=i.plus(BA(r,n,l)),c3(a.d).slice(0,l)===c3(i.d).slice(0,l)){for(;c--;)i=Os(i.times(i),l);return u.precision=d,e==null?(eu=!0,Os(i,d)):i}i=a}}function T0(t){for(var e=t.e*Pc,n=t.d[0];n>=10;n/=10)e++;return e}function bue(t,e,n){if(e>t.LN10.sd())throw eu=!0,n&&(t.precision=n),Error(Jy+"LN10 precision limit exceeded");return Os(new t(t.LN10),e)}function Vw(t){for(var e="";t--;)e+="0";return e}function OW(t,e){var n,o,r,i,a,l,s,c,u,d=1,f=10,p=t,m=p.d,y=p.constructor,w=y.precision;if(p.s<1)throw Error(Jy+(p.s?"NaN":"-Infinity"));if(p.eq(em))return new y(0);if(e==null?(eu=!1,c=w):c=e,p.eq(10))return e==null&&(eu=!0),bue(y,c);if(c+=f,y.precision=c,n=c3(m),o=n.charAt(0),i=T0(p),Math.abs(i)<15e14){for(;o<7&&o!=1||o==1&&n.charAt(1)>3;)p=p.times(t),n=c3(p.d),o=n.charAt(0),d++;i=T0(p),o>1?(p=new y("0."+n),i++):p=new y(o+"."+n.slice(1))}else return s=bue(y,c+2,w).times(i+""),p=OW(new y(o+"."+n.slice(1)),c-f).plus(s),y.precision=w,e==null?(eu=!0,Os(p,w)):p;for(l=a=p=BA(p.minus(em),p.plus(em),c),u=Os(p.times(p),c),r=3;;){if(a=Os(a.times(u),c),s=l.plus(BA(a,new y(r),c)),c3(s.d).slice(0,c)===c3(l.d).slice(0,c))return l=l.times(2),i!==0&&(l=l.plus(bue(y,c+2,w).times(i+""))),l=BA(l,new y(d),c),y.precision=w,e==null?(eu=!0,Os(l,w)):l;l=s,r+=2}}function JWe(t,e){var n,o,r;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(o=e.search(/e/i))>0?(n<0&&(n=o),n+=+e.slice(o+1),e=e.substring(0,o)):n<0&&(n=e.length),o=0;e.charCodeAt(o)===48;)++o;for(r=e.length;e.charCodeAt(r-1)===48;)--r;if(e=e.slice(o,r),e){if(r-=o,n=n-o-1,t.e=$I(n/Pc),t.d=[],o=(n+1)%Pc,n<0&&(o+=Pc),ov$||t.e<-v$))throw Error(e8e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Os(t,e,n){var o,r,i,a,l,s,c,u,d=t.d;for(a=1,i=d[0];i>=10;i/=10)a++;if(o=e-a,o<0)o+=Pc,r=e,c=d[u=0];else{if(u=Math.ceil((o+1)/Pc),i=d.length,u>=i)return t;for(c=i=d[u],a=1;i>=10;i/=10)a++;o%=Pc,r=o-Pc+a}if(n!==void 0&&(i=Av(10,a-r-1),l=c/i%10|0,s=e<0||d[u+1]!==void 0||c%i,s=n<4?(l||s)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||s||n==6&&(o>0?r>0?c/Av(10,a-r):0:d[u-1])%10&1||n==(t.s<0?8:7))),e<1||!d[0])return s?(i=T0(t),d.length=1,e=e-i-1,d[0]=Av(10,(Pc-e%Pc)%Pc),t.e=$I(-e/Pc)||0):(d.length=1,d[0]=t.e=t.s=0),t;if(o==0?(d.length=u,i=1,u--):(d.length=u+1,i=Av(10,Pc-o),d[u]=r>0?(c/Av(10,a-r)%Av(10,r)|0)*i:0),s)for(;;)if(u==0){(d[0]+=i)==Hd&&(d[0]=1,++t.e);break}else{if(d[u]+=i,d[u]!=Hd)break;d[u--]=0,i=1}for(o=d.length;d[--o]===0;)d.pop();if(eu&&(t.e>v$||t.e<-v$))throw Error(e8e+T0(t));return t}function Lht(t,e){var n,o,r,i,a,l,s,c,u,d,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),eu?Os(e,p):e;if(s=t.d,d=e.d,o=e.e,c=t.e,s=s.slice(),a=c-o,a){for(u=a<0,u?(n=s,a=-a,l=d.length):(n=d,o=c,l=s.length),r=Math.max(Math.ceil(p/Pc),l)+2,a>r&&(a=r,n.length=1),n.reverse(),r=a;r--;)n.push(0);n.reverse()}else{for(r=s.length,l=d.length,u=r0;--r)s[l++]=0;for(r=d.length;r>a;){if(s[--r]0?i=i.charAt(0)+"."+i.slice(1)+Vw(o):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r<0?"e":"e+")+r):r<0?(i="0."+Vw(-r-1)+i,n&&(o=n-a)>0&&(i+=Vw(o))):r>=a?(i+=Vw(r+1-a),n&&(o=n-r-1)>0&&(i=i+"."+Vw(o))):((o=r+1)0&&(r+1===a&&(i+="."),i+=Vw(o))),t.s<0?"-"+i:i}function KWe(t,e){if(t.length>e)return t.length=e,!0}function Wht(t){var e,n,o;function r(i){var a=this;if(!(a instanceof r))return new r(i);if(a.constructor=r,i instanceof r){a.s=i.s,a.e=i.e,a.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Ib+i);if(i>0)a.s=1;else if(i<0)i=-i,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(i===~~i&&i<1e7){a.e=0,a.d=[i];return}return JWe(a,i.toString())}else if(typeof i!="string")throw Error(Ib+i);if(i.charCodeAt(0)===45?(i=i.slice(1),a.s=-1):a.s=1,Bjo.test(i))JWe(a,i);else throw Error(Ib+i)}if(r.prototype=_r,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.clone=Wht,r.config=r.set=Yjo,t===void 0&&(t={}),t)for(o=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=r[e+1]&&o<=r[e+2])this[n]=o;else throw Error(Ib+n+": "+o);if((o=t[n="LN10"])!==void 0)if(o==Math.LN10)this[n]=new this(o);else throw Error(Ib+n+": "+o);return this}var t8e=Wht(jjo);em=new t8e(1);const Ms=t8e;function Ojo(t){return Xjo(t)||Gjo(t)||Vjo(t)||_jo()}function _jo(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vjo(t,e){if(t){if(typeof t=="string")return qge(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qge(t,e)}}function Gjo(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function Xjo(t){if(Array.isArray(t))return qge(t)}function qge(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n=e?n.apply(void 0,r):t(e-a,$We(function(){for(var l=arguments.length,s=new Array(l),c=0;ct.length)&&(e=t.length);for(var n=0,o=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],o=!0,r=!1,i=void 0;try{for(var a=t[Symbol.iterator](),l;!(o=(l=a.next()).done)&&(n.push(l.value),!(e&&n.length===e));o=!0);}catch(s){r=!0,i=s}finally{try{!o&&a.return!=null&&a.return()}finally{if(r)throw i}}return n}}function sBo(t){if(Array.isArray(t))return t}function Yht(t){var e=_W(t,2),n=e[0],o=e[1],r=n,i=o;return n>o&&(r=o,i=n),[r,i]}function Oht(t,e,n){if(t.lte(0))return new Ms(0);var o=Eoe.getDigitCount(t.toNumber()),r=new Ms(10).pow(o),i=t.div(r),a=o!==1?.05:.1,l=new Ms(Math.ceil(i.div(a).toNumber())).add(n).mul(a),s=l.mul(r);return e?s:new Ms(Math.ceil(s))}function cBo(t,e,n){var o=1,r=new Ms(t);if(!r.isint()&&n){var i=Math.abs(t);i<1?(o=new Ms(10).pow(Eoe.getDigitCount(t)-1),r=new Ms(Math.floor(r.div(o).toNumber())).mul(o)):i>1&&(r=new Ms(Math.floor(t)))}else t===0?r=new Ms(Math.floor((e-1)/2)):n||(r=new Ms(Math.floor(t)));var a=Math.floor((e-1)/2),l=qjo($jo(function(s){return r.add(new Ms(s-a).mul(o)).toNumber()}),Qge);return l(0,e)}function _ht(t,e,n,o){var r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new Ms(0),tickMin:new Ms(0),tickMax:new Ms(0)};var i=Oht(new Ms(e).sub(t).div(n-1),o,r),a;t<=0&&e>=0?a=new Ms(0):(a=new Ms(t).add(e).div(2),a=a.sub(new Ms(a).mod(i)));var l=Math.ceil(a.sub(t).div(i).toNumber()),s=Math.ceil(new Ms(e).sub(a).div(i).toNumber()),c=l+s+1;return c>n?_ht(t,e,n,o,r+1):(c0?s+(n-c):s,l=e>0?l:l+(n-c)),{step:i,tickMin:a.sub(new Ms(l).mul(i)),tickMax:a.add(new Ms(s).mul(i))})}function uBo(t){var e=_W(t,2),n=e[0],o=e[1],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Math.max(r,2),l=Yht([n,o]),s=_W(l,2),c=s[0],u=s[1];if(c===-1/0||u===1/0){var d=u===1/0?[c].concat(eme(Qge(0,r-1).map(function(){return 1/0}))):[].concat(eme(Qge(0,r-1).map(function(){return-1/0})),[u]);return n>o?Zge(d):d}if(c===u)return cBo(c,r,i);var f=_ht(c,u,a,i),p=f.step,m=f.tickMin,y=f.tickMax,w=Eoe.rangeStep(m,y.add(new Ms(.1).mul(p)),p);return n>o?Zge(w):w}function dBo(t,e){var n=_W(t,2),o=n[0],r=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Yht([o,r]),l=_W(a,2),s=l[0],c=l[1];if(s===-1/0||c===1/0)return[o,r];if(s===c)return[s];var u=Math.max(e,2),d=Oht(new Ms(c).sub(s).div(u-1),i,0),f=[].concat(eme(Eoe.rangeStep(new Ms(s),new Ms(c).sub(new Ms(.99).mul(d)),d)),[c]);return o>r?Zge(f):f}var fBo=jht(uBo),hBo=jht(dBo),pBo="Invariant failed";function gS(t,e){throw new Error(pBo)}var gBo=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function b$(){return b$=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);nd){p=[].concat(rC(s.slice(0,m)),[d-y]);break}var w=p.length%2===0?[0,f]:[f];return[].concat(rC(e.repeat(s,u)),rC(p),w).map(function(x){return"".concat(x,"px")}).join(", ")}),o5(Lw(n),"id",fT("recharts-line-")),o5(Lw(n),"pathRef",function(a){n.mainCurve=a}),o5(Lw(n),"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),o5(Lw(n),"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return pJo(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var o=this.getTotalLength();this.setState({totalLength:o})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var o=this.getTotalLength();o!==this.state.totalLength&&this.setState({totalLength:o})}}},{key:"getTotalLength",value:function(){var o=this.mainCurve;try{return o&&o.getTotalLength&&o.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(o,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.points,l=i.xAxis,s=i.yAxis,c=i.layout,u=i.children,d=E1(u,qI);if(!d)return null;var f=function(y,w){return{x:y.x,y:y.y,value:y.value,errorVal:Q0(y.payload,w)}},p={clipPath:o?"url(#clipPath-".concat(r,")"):null};return xe.createElement(ns,p,d.map(function(m){return xe.cloneElement(m,{key:"bar-".concat(m.props.dataKey),data:a,xAxis:l,yAxis:s,layout:c,dataPointFormatter:f})}))}},{key:"renderDots",value:function(o,r,i){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var l=this.props,s=l.dot,c=l.points,u=l.dataKey,d=sa(this.props,!1),f=sa(s,!0),p=c.map(function(y,w){var x=Ng(Ng(Ng({key:"dot-".concat(w),r:3},d),f),{},{value:y.value,dataKey:u,cx:y.x,cy:y.y,index:w,payload:y.payload});return e.renderDotItem(s,x)}),m={clipPath:o?"url(#clipPath-".concat(r?"":"dots-").concat(i,")"):null};return xe.createElement(ns,yF({className:"recharts-line-dots",key:"dots"},m),p)}},{key:"renderCurveStatically",value:function(o,r,i,a){var l=this.props,s=l.type,c=l.layout,u=l.connectNulls;l.ref;var d=lJo(l,aJo),f=Ng(Ng(Ng({},sa(d,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:r?"url(#clipPath-".concat(i,")"):null,points:o},a),{},{type:s,layout:c,connectNulls:u});return xe.createElement(zb,yF({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(o,r){var i=this,a=this.props,l=a.points,s=a.strokeDasharray,c=a.isAnimationActive,u=a.animationBegin,d=a.animationDuration,f=a.animationEasing,p=a.animationId,m=a.animateNewValues,y=a.width,w=a.height,x=this.state,C=x.prevPoints,P=x.totalLength;return xe.createElement(L5,{begin:u,duration:d,isActive:c,easing:f,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(A){var S=A.t;if(C){var v=C.length/l.length,b=l.map(function(k,N){var U=Math.floor(N*v);if(C[U]){var W=C[U],F=t0(W.x,k.x),E=t0(W.y,k.y);return Ng(Ng({},k),{},{x:F(S),y:E(S)})}if(m){var L=t0(y*2,k.x),j=t0(w/2,k.y);return Ng(Ng({},k),{},{x:L(S),y:j(S)})}return Ng(Ng({},k),{},{x:k.x,y:k.y})});return i.renderCurveStatically(b,o,r)}var T=t0(0,P),R=T(S),M;if(s){var D="".concat(s).split(/[,\s]+/gim).map(function(k){return parseFloat(k)});M=i.getStrokeDasharray(R,P,D)}else M=i.generateSimpleStrokeDasharray(P,R);return i.renderCurveStatically(l,o,r,{strokeDasharray:M})})}},{key:"renderCurve",value:function(o,r){var i=this.props,a=i.points,l=i.isAnimationActive,s=this.state,c=s.prevPoints,u=s.totalLength;return l&&a&&a.length&&(!c&&u>0||!hS(c,a))?this.renderCurveWithAnimation(o,r):this.renderCurveStatically(a,o,r)}},{key:"render",value:function(){var o,r=this.props,i=r.hide,a=r.dot,l=r.points,s=r.className,c=r.xAxis,u=r.yAxis,d=r.top,f=r.left,p=r.width,m=r.height,y=r.isAnimationActive,w=r.id;if(i||!l||!l.length)return null;var x=this.state.isAnimationFinished,C=l.length===1,P=gl("recharts-line",s),A=c&&c.allowDataOverflow,S=u&&u.allowDataOverflow,v=A||S,b=ca(w)?this.id:w,T=(o=sa(a,!1))!==null&&o!==void 0?o:{r:3,strokeWidth:2},R=T.r,M=R===void 0?3:R,D=T.strokeWidth,k=D===void 0?2:D,N=uft(a)?a:{},U=N.clipDot,W=U===void 0?!0:U,F=M*2+k;return xe.createElement(ns,{className:P},A||S?xe.createElement("defs",null,xe.createElement("clipPath",{id:"clipPath-".concat(b)},xe.createElement("rect",{x:A?f:f-p/2,y:S?d:d-m/2,width:A?p:p*2,height:S?m:m*2})),!W&&xe.createElement("clipPath",{id:"clipPath-dots-".concat(b)},xe.createElement("rect",{x:f-F/2,y:d-F/2,width:p+F,height:m+F}))):null,!C&&this.renderCurve(v,b),this.renderErrorBar(v,b),(C||a)&&this.renderDots(v,W,b),(!y||x)&&T3.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.animationId!==r.prevAnimationId?{prevAnimationId:o.animationId,curPoints:o.points,prevPoints:r.curPoints}:o.points!==r.curPoints?{curPoints:o.points}:null}},{key:"repeat",value:function(o,r){for(var i=o.length%2!==0?[].concat(rC(o),[0]):o,a=[],l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function vJo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function rb(){return rb=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!hS(u,a)||!hS(d,l))?this.renderAreaWithAnimation(o,r):this.renderAreaStatically(a,l,o,r)}},{key:"render",value:function(){var o,r=this.props,i=r.hide,a=r.dot,l=r.points,s=r.className,c=r.top,u=r.left,d=r.xAxis,f=r.yAxis,p=r.width,m=r.height,y=r.isAnimationActive,w=r.id;if(i||!l||!l.length)return null;var x=this.state.isAnimationFinished,C=l.length===1,P=gl("recharts-area",s),A=d&&d.allowDataOverflow,S=f&&f.allowDataOverflow,v=A||S,b=ca(w)?this.id:w,T=(o=sa(a,!1))!==null&&o!==void 0?o:{r:3,strokeWidth:2},R=T.r,M=R===void 0?3:R,D=T.strokeWidth,k=D===void 0?2:D,N=uft(a)?a:{},U=N.clipDot,W=U===void 0?!0:U,F=M*2+k;return xe.createElement(ns,{className:P},A||S?xe.createElement("defs",null,xe.createElement("clipPath",{id:"clipPath-".concat(b)},xe.createElement("rect",{x:A?u:u-p/2,y:S?c:c-m/2,width:A?p:p*2,height:S?m:m*2})),!W&&xe.createElement("clipPath",{id:"clipPath-dots-".concat(b)},xe.createElement("rect",{x:u-F/2,y:c-F/2,width:p+F,height:m+F}))):null,C?null:this.renderArea(v,b),(a||C)&&this.renderDots(v,W,b),(!y||x)&&T3.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.animationId!==r.prevAnimationId?{prevAnimationId:o.animationId,curPoints:o.points,curBaseLine:o.baseLine,prevPoints:r.curPoints,prevBaseLine:r.curBaseLine}:o.points!==r.curPoints||o.baseLine!==r.curBaseLine?{curPoints:o.points,curBaseLine:o.baseLine}:null}}]),e}(g.PureComponent);Ept=R4;u3(R4,"displayName","Area");u3(R4,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!G7.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});u3(R4,"getBaseValue",function(t,e,n,o){var r=t.layout,i=t.baseValue,a=e.props.baseValue,l=a??i;if(pr(l)&&typeof l=="number")return l;var s=r==="horizontal"?o:n,c=s.scale.domain();if(s.type==="number"){var u=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return l==="dataMin"?d:l==="dataMax"||u<0?u:Math.max(Math.min(c[0],c[1]),0)}return l==="dataMin"?c[0]:l==="dataMax"?c[1]:c[0]});u3(R4,"getComposedData",function(t){var e=t.props,n=t.item,o=t.xAxis,r=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,l=t.bandSize,s=t.dataKey,c=t.stackedData,u=t.dataStartIndex,d=t.displayedData,f=t.offset,p=e.layout,m=c&&c.length,y=Ept.getBaseValue(e,n,o,r),w=p==="horizontal",x=!1,C=d.map(function(A,S){var v;m?v=c[u+S]:(v=Q0(A,s),Array.isArray(v)?x=!0:v=[y,v]);var b=v[1]==null||m&&Q0(A,s)==null;return w?{x:pM({axis:o,ticks:i,bandSize:l,entry:A,index:S}),y:b?null:r.scale(v[1]),value:v,payload:A}:{x:b?null:o.scale(v[1]),y:pM({axis:r,ticks:a,bandSize:l,entry:A,index:S}),value:v,payload:A}}),P;return m||x?P=C.map(function(A){var S=Array.isArray(A.value)?A.value[0]:null;return w?{x:A.x,y:S!=null&&A.y!=null?r.scale(S):null}:{x:S!=null?o.scale(S):null,y:A.y}}):P=w?r.scale(y):o.scale(y),Ww({points:C,baseLine:P,layout:p,isRange:x},f)});u3(R4,"renderDotItem",function(t,e){var n;if(xe.isValidElement(t))n=xe.cloneElement(t,e);else if(Ta(t))n=t(e);else{var o=gl("recharts-area-dot",typeof t!="boolean"?t.className:"");n=xe.createElement(kj,rb({},e,{className:o}))}return n});var Nj=function(){return null};Nj.displayName="ZAxis";Nj.defaultProps={zAxisId:0,range:[64,64],scale:"auto",type:"number"};var HJo=["option","isActive"];function AF(){return AF=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function IJo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function zJo(t){var e=t.option,n=t.isActive,o=MJo(t,HJo);return typeof e=="string"?xe.createElement(wme,AF({option:xe.createElement(voe,AF({type:e},o)),isActive:n,shapeType:"symbols"},o)):xe.createElement(wme,AF({option:e,isActive:n,shapeType:"symbols"},o))}function bM(t){"@babel/helpers - typeof";return bM=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bM(t)}function wF(){return wF=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function lKo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function sKo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cKo(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n0?a:e&&e.length&&pr(r)&&pr(i)?e.slice(r,i+1):[]};function Vpt(t){return t==="number"?[0,"auto"]:void 0}var Wme=function(e,n,o,r){var i=e.graphicalItems,a=e.tooltipAxis,l=Woe(n,e);return o<0||!i||!i.length||o>=l.length?null:i.reduce(function(s,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:n;d&&e.dataStartIndex+e.dataEndIndex!==0&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(a.dataKey&&!a.allowDuplicatedCategory){var p=d===void 0?l:d;f=ZK(p,a.dataKey,r)}else f=d&&d[o]||l[o];return f?[].concat(TM(s),[qht(c,f)]):s},[])},HUe=function(e,n,o,r){var i=r||{x:e.chartX,y:e.chartY},a=xKo(i,o),l=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,u=DBo(a,l,c,s);if(u>=0&&c){var d=c[u]&&c[u].value,f=Wme(e,n,u,d),p=vKo(o,l,u,i);return{activeTooltipIndex:u,activeLabel:d,activePayload:f,activeCoordinate:p}}return null},bKo=function(e,n){var o=n.axes,r=n.graphicalItems,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=e.stackOffset,p=Jht(u,i);return o.reduce(function(m,y){var w,x=y.props,C=x.type,P=x.dataKey,A=x.allowDataOverflow,S=x.allowDuplicatedCategory,v=x.scale,b=x.ticks,T=x.includeHidden,R=y.props[a];if(m[R])return m;var M=Woe(e.data,{graphicalItems:r.filter(function(_){return _.props[a]===R}),dataStartIndex:s,dataEndIndex:c}),D=M.length,k,N,U;KJo(y.props.domain,A,C)&&(k=ome(y.props.domain,null,A),p&&(C==="number"||v!=="auto")&&(U=gF(M,P,"category")));var W=Vpt(C);if(!k||k.length===0){var F,E=(F=y.props.domain)!==null&&F!==void 0?F:W;if(P){if(k=gF(M,P,C),C==="category"&&p){var L=Gzo(k);S&&L?(N=k,k=D$(0,D)):S||(k=iNe(E,k,y).reduce(function(_,G){return _.indexOf(G)>=0?_:[].concat(TM(_),[G])},[]))}else if(C==="category")S?k=k.filter(function(_){return _!==""&&!ca(_)}):k=iNe(E,k,y).reduce(function(_,G){return _.indexOf(G)>=0||G===""||ca(G)?_:[].concat(TM(_),[G])},[]);else if(C==="number"){var j=WBo(M,r.filter(function(_){return _.props[a]===R&&(T||!_.props.hide)}),P,i,u);j&&(k=j)}p&&(C==="number"||v!=="auto")&&(U=gF(M,P,"category"))}else p?k=D$(0,D):l&&l[R]&&l[R].hasStack&&C==="number"?k=f==="expand"?[0,1]:$ht(l[R].stackGroups,s,c):k=Xht(M,r.filter(function(_){return _.props[a]===R&&(T||!_.props.hide)}),C,u,!0);if(C==="number")k=kme(d,k,R,i,b),E&&(k=ome(E,k,A));else if(C==="category"&&E){var Y=E,O=k.every(function(_){return Y.indexOf(_)>=0});O&&(k=Y)}}return Io(Io({},m),{},Yi({},R,Io(Io({},y.props),{},{axisType:i,domain:k,categoricalDomain:U,duplicateDomain:N,originalDomain:(w=y.props.domain)!==null&&w!==void 0?w:W,isCategorical:p,layout:u})))},{})},SKo=function(e,n){var o=n.graphicalItems,r=n.Axis,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=Woe(e.data,{graphicalItems:o,dataStartIndex:s,dataEndIndex:c}),p=f.length,m=Jht(u,i),y=-1;return o.reduce(function(w,x){var C=x.props[a],P=Vpt("number");if(!w[C]){y++;var A;return m?A=D$(0,p):l&&l[C]&&l[C].hasStack?(A=$ht(l[C].stackGroups,s,c),A=kme(d,A,C,i)):(A=ome(P,Xht(f,o.filter(function(S){return S.props[a]===C&&!S.props.hide}),"number",u),r.defaultProps.allowDataOverflow),A=kme(d,A,C,i)),Io(Io({},w),{},Yi({},C,Io(Io({axisType:i},r.defaultProps),{},{hide:!0,orientation:Ey(AKo,"".concat(i,".").concat(y%2),null),domain:A,originalDomain:P,isCategorical:m,layout:u})))}return w},{})},TKo=function(e,n){var o=n.axisType,r=o===void 0?"xAxis":o,i=n.AxisComp,a=n.graphicalItems,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.children,d="".concat(r,"Id"),f=E1(u,i),p={};return f&&f.length?p=bKo(e,{axes:f,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(p=SKo(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c})),p},PKo=function(e){var n=t8(e),o=TA(n,!1,!0);return{tooltipTicks:o,orderedTooltipTicks:Iwe(o,function(r){return r.coordinate}),tooltipAxis:n,tooltipAxisBandSize:S$(n,o)}},MUe=function(e){var n=e.children,o=e.defaultShowTooltip,r=_g(n,yM),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!o}},CKo=function(e){return!e||!e.length?!1:e.some(function(n){var o=UA(n&&n.type);return o&&o.indexOf("Bar")>=0})},IUe=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},RKo=function(e,n){var o=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,l=e.yAxisMap,s=l===void 0?{}:l,c=o.width,u=o.height,d=o.children,f=o.margin||{},p=_g(d,yM),m=_g(d,F5),y=Object.keys(s).reduce(function(S,v){var b=s[v],T=b.orientation;return!b.mirror&&!b.hide?Io(Io({},S),{},Yi({},T,S[T]+b.width)):S},{left:f.left||0,right:f.right||0}),w=Object.keys(a).reduce(function(S,v){var b=a[v],T=b.orientation;return!b.mirror&&!b.hide?Io(Io({},S),{},Yi({},T,Ey(S,"".concat(T))+b.height)):S},{top:f.top||0,bottom:f.bottom||0}),x=Io(Io({},w),y),C=x.bottom;p&&(x.bottom+=p.props.height||yM.defaultProps.height),m&&n&&(x=FBo(x,r,o,n));var P=c-x.left-x.right,A=u-x.top-x.bottom;return Io(Io({brushBottom:C},x),{},{width:Math.max(P,0),height:Math.max(A,0)})},HKo=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Uj=function(e){var n,o=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,l=e.validateTooltipEventTypes,s=l===void 0?["axis"]:l,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,p=function(w,x){var C=x.graphicalItems,P=x.stackGroups,A=x.offset,S=x.updateId,v=x.dataStartIndex,b=x.dataEndIndex,T=w.barSize,R=w.layout,M=w.barGap,D=w.barCategoryGap,k=w.maxBarSize,N=IUe(R),U=N.numericAxisName,W=N.cateAxisName,F=CKo(C),E=[];return C.forEach(function(L,j){var Y=Woe(w.data,{graphicalItems:[L],dataStartIndex:v,dataEndIndex:b}),O=L.props,_=O.dataKey,G=O.maxBarSize,Q=L.props["".concat(U,"Id")],oe=L.props["".concat(W,"Id")],ee={},q=c.reduce(function(Ie,ve){var ze=x["".concat(ve.axisType,"Map")],Ae=L.props["".concat(ve.axisType,"Id")];ze&&ze[Ae]||ve.axisType==="zAxis"||gS();var se=ze[Ae];return Io(Io({},Ie),{},Yi(Yi({},ve.axisType,se),"".concat(ve.axisType,"Ticks"),TA(se)))},ee),ae=q[W],Z=q["".concat(W,"Ticks")],ne=P&&P[Q]&&P[Q].hasStack&&KBo(L,P[Q].stackGroups),te=UA(L.type).indexOf("Bar")>=0,$=S$(ae,Z),le=[],de=F&&EBo({barSize:T,stackGroups:P,totalSize:HKo(q,W)});if(te){var he,me,ce=ca(G)?k:G,Pe=(he=(me=S$(ae,Z,!0))!==null&&me!==void 0?me:ce)!==null&&he!==void 0?he:0;le=kBo({barGap:M,barCategoryGap:D,bandSize:Pe!==$?Pe:$,sizeList:de[oe],maxBarSize:ce}),Pe!==$&&(le=le.map(function(Ie){return Io(Io({},Ie),{},{position:Io(Io({},Ie.position),{},{offset:Ie.position.offset-Pe/2})})}))}var pe=L&&L.type&&L.type.getComposedData;pe&&E.push({props:Io(Io({},pe(Io(Io({},q),{},{displayedData:Y,props:w,dataKey:_,item:L,bandSize:$,barPosition:le,offset:A,stackedData:ne,layout:R,dataStartIndex:v,dataEndIndex:b}))),{},Yi(Yi(Yi({key:L.key||"item-".concat(j)},U,q[U]),W,q[W]),"animationId",S)),childIndex:rDo(L,w.children),item:L})}),E},m=function(w,x){var C=w.props,P=w.dataStartIndex,A=w.dataEndIndex,S=w.updateId;if(!wLe({props:C}))return null;var v=C.children,b=C.layout,T=C.stackOffset,R=C.data,M=C.reverseStackOrder,D=IUe(b),k=D.numericAxisName,N=D.cateAxisName,U=E1(v,r),W=GBo(R,U,"".concat(k,"Id"),"".concat(N,"Id"),T,M),F=c.reduce(function(O,_){var G="".concat(_.axisType,"Map");return Io(Io({},O),{},Yi({},G,TKo(C,Io(Io({},_),{},{graphicalItems:U,stackGroups:_.axisType===k&&W,dataStartIndex:P,dataEndIndex:A}))))},{}),E=RKo(Io(Io({},F),{},{props:C,graphicalItems:U}),x==null?void 0:x.legendBBox);Object.keys(F).forEach(function(O){F[O]=d(C,F[O],E,O.replace("Map",""),o)});var L=F["".concat(N,"Map")],j=PKo(L),Y=p(C,Io(Io({},F),{},{dataStartIndex:P,dataEndIndex:A,updateId:S,graphicalItems:U,stackGroups:W,offset:E}));return Io(Io({formattedGraphicalItems:Y,graphicalItems:U,offset:E,stackGroups:W},j),F)};return n=function(y){hKo(w,y);function w(x){var C,P,A;return sKo(this,w),A=dKo(this,w,[x]),Yi(Tl(A),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Yi(Tl(A),"accessibilityManager",new JJo),Yi(Tl(A),"handleLegendBBoxUpdate",function(S){if(S){var v=A.state,b=v.dataStartIndex,T=v.dataEndIndex,R=v.updateId;A.setState(Io({legendBBox:S},m({props:A.props,dataStartIndex:b,dataEndIndex:T,updateId:R},Io(Io({},A.state),{},{legendBBox:S}))))}}),Yi(Tl(A),"handleReceiveSyncEvent",function(S,v,b){if(A.props.syncId===S){if(b===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(v)}}),Yi(Tl(A),"handleBrushChange",function(S){var v=S.startIndex,b=S.endIndex;if(v!==A.state.dataStartIndex||b!==A.state.dataEndIndex){var T=A.state.updateId;A.setState(function(){return Io({dataStartIndex:v,dataEndIndex:b},m({props:A.props,dataStartIndex:v,dataEndIndex:b,updateId:T},A.state))}),A.triggerSyncEvent({dataStartIndex:v,dataEndIndex:b})}}),Yi(Tl(A),"handleMouseEnter",function(S){var v=A.getMouseInfo(S);if(v){var b=Io(Io({},v),{},{isTooltipActive:!0});A.setState(b),A.triggerSyncEvent(b);var T=A.props.onMouseEnter;Ta(T)&&T(b,S)}}),Yi(Tl(A),"triggeredAfterMouseMove",function(S){var v=A.getMouseInfo(S),b=v?Io(Io({},v),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(b),A.triggerSyncEvent(b);var T=A.props.onMouseMove;Ta(T)&&T(b,S)}),Yi(Tl(A),"handleItemMouseEnter",function(S){A.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),Yi(Tl(A),"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),Yi(Tl(A),"handleMouseMove",function(S){S.persist(),A.throttleTriggeredAfterMouseMove(S)}),Yi(Tl(A),"handleMouseLeave",function(S){A.throttleTriggeredAfterMouseMove.cancel();var v={isTooltipActive:!1};A.setState(v),A.triggerSyncEvent(v);var b=A.props.onMouseLeave;Ta(b)&&b(v,S)}),Yi(Tl(A),"handleOuterEvent",function(S){var v=oDo(S),b=Ey(A.props,"".concat(v));if(v&&Ta(b)){var T,R;/.*touch.*/i.test(v)?R=A.getMouseInfo(S.changedTouches[0]):R=A.getMouseInfo(S),b((T=R)!==null&&T!==void 0?T:{},S)}}),Yi(Tl(A),"handleClick",function(S){var v=A.getMouseInfo(S);if(v){var b=Io(Io({},v),{},{isTooltipActive:!0});A.setState(b),A.triggerSyncEvent(b);var T=A.props.onClick;Ta(T)&&T(b,S)}}),Yi(Tl(A),"handleMouseDown",function(S){var v=A.props.onMouseDown;if(Ta(v)){var b=A.getMouseInfo(S);v(b,S)}}),Yi(Tl(A),"handleMouseUp",function(S){var v=A.props.onMouseUp;if(Ta(v)){var b=A.getMouseInfo(S);v(b,S)}}),Yi(Tl(A),"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),Yi(Tl(A),"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&A.handleMouseDown(S.changedTouches[0])}),Yi(Tl(A),"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&A.handleMouseUp(S.changedTouches[0])}),Yi(Tl(A),"triggerSyncEvent",function(S){A.props.syncId!==void 0&&Mue.emit(Iue,A.props.syncId,S,A.eventEmitterSymbol)}),Yi(Tl(A),"applySyncEvent",function(S){var v=A.props,b=v.layout,T=v.syncMethod,R=A.state.updateId,M=S.dataStartIndex,D=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)A.setState(Io({dataStartIndex:M,dataEndIndex:D},m({props:A.props,dataStartIndex:M,dataEndIndex:D,updateId:R},A.state)));else if(S.activeTooltipIndex!==void 0){var k=S.chartX,N=S.chartY,U=S.activeTooltipIndex,W=A.state,F=W.offset,E=W.tooltipTicks;if(!F)return;if(typeof T=="function")U=T(E,S);else if(T==="value"){U=-1;for(var L=0;L=0){var ne,te;if(k.dataKey&&!k.allowDuplicatedCategory){var $=typeof k.dataKey=="function"?Z:"payload.".concat(k.dataKey.toString());ne=ZK(L,$,U),te=j&&Y&&ZK(Y,$,U)}else ne=L==null?void 0:L[N],te=j&&Y&&Y[N];if(oe||Q){var le=S.props.activeIndex!==void 0?S.props.activeIndex:N;return[g.cloneElement(S,Io(Io(Io({},T.props),q),{},{activeIndex:le})),null,null]}if(!ca(ne))return[ae].concat(TM(A.renderActivePoints({item:T,activePoint:ne,basePoint:te,childIndex:N,isRange:j})))}else{var de,he=(de=A.getItemByXY(A.state.activeCoordinate))!==null&&de!==void 0?de:{graphicalItem:ae},me=he.graphicalItem,ce=me.item,Pe=ce===void 0?S:ce,pe=me.childIndex,Ie=Io(Io(Io({},T.props),q),{},{activeIndex:pe});return[g.cloneElement(Pe,Ie),null,null]}return j?[ae,null,null]:[ae,null]}),Yi(Tl(A),"renderCustomized",function(S,v,b){return g.cloneElement(S,Io(Io({key:"recharts-customized-".concat(b)},A.props),A.state))}),Yi(Tl(A),"renderMap",{CartesianGrid:{handler:CV,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:CV},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:CV},YAxis:{handler:CV},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((C=x.id)!==null&&C!==void 0?C:fT("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=Jft(A.triggeredAfterMouseMove,(P=x.throttleDelay)!==null&&P!==void 0?P:1e3/60),A.state={},A}return uKo(w,[{key:"componentDidMount",value:function(){var C,P;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(P=this.props.margin.top)!==null&&P!==void 0?P:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,P=C.children,A=C.data,S=C.height,v=C.layout,b=_g(P,yh);if(b){var T=b.props.defaultIndex;if(!(typeof T!="number"||T<0||T>this.state.tooltipTicks.length)){var R=this.state.tooltipTicks[T]&&this.state.tooltipTicks[T].value,M=Wme(this.state,A,T,R),D=this.state.tooltipTicks[T].coordinate,k=(this.state.offset.top+S)/2,N=v==="horizontal",U=N?{x:D,y:k}:{y:D,x:k},W=this.state.formattedGraphicalItems.find(function(E){var L=E.item;return L.type.name==="Scatter"});W&&(U=Io(Io({},U),W.props.points[T].tooltipPosition),M=W.props.points[T].tooltipPayload);var F={activeTooltipIndex:T,isTooltipActive:!0,activeLabel:R,activePayload:M,activeCoordinate:U};this.setState(F),this.renderCursor(b),this.accessibilityManager.setIndex(T)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,P){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==P.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var A,S;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(C){Sge([_g(C.children,yh)],[_g(this.props.children,yh)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=_g(this.props.children,yh);if(C&&typeof C.props.shared=="boolean"){var P=C.props.shared?"axis":"item";return s.indexOf(P)>=0?P:a}return a}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var P=this.container,A=P.getBoundingClientRect(),S=AWo(A),v={chartX:Math.round(C.pageX-S.left),chartY:Math.round(C.pageY-S.top)},b=A.width/P.offsetWidth||1,T=this.inRange(v.chartX,v.chartY,b);if(!T)return null;var R=this.state,M=R.xAxisMap,D=R.yAxisMap,k=this.getTooltipEventType();if(k!=="axis"&&M&&D){var N=t8(M).scale,U=t8(D).scale,W=N&&N.invert?N.invert(v.chartX):null,F=U&&U.invert?U.invert(v.chartY):null;return Io(Io({},v),{},{xValue:W,yValue:F})}var E=HUe(this.state,this.props.data,this.props.layout,T);return E?Io(Io({},v),E):null}},{key:"inRange",value:function(C,P){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,v=C/A,b=P/A;if(S==="horizontal"||S==="vertical"){var T=this.state.offset,R=v>=T.left&&v<=T.left+T.width&&b>=T.top&&b<=T.top+T.height;return R?{x:v,y:b}:null}var M=this.state,D=M.angleAxisMap,k=M.radiusAxisMap;if(D&&k){var N=t8(D);return sNe({x:v,y:b},N)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,P=this.getTooltipEventType(),A=_g(C,yh),S={};A&&P==="axis"&&(A.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var v=e$(this.props,this.handleOuterEvent);return Io(Io({},v),S)}},{key:"addListener",value:function(){Mue.on(Iue,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Mue.removeListener(Iue,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,P,A){for(var S=this.state.formattedGraphicalItems,v=0,b=S.length;v{const r=Kt(),[i,a]=g.useState(!1),l=()=>{n==null||n(!t)},s=()=>{o==null||o(!e)};return h.jsx(zl,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(c7,{checked:t,onClick:l,children:B.t("menu.graph.ShowHorizontalGridLines",r)}),h.jsx(c7,{checked:e,onClick:s,children:B.t("menu.graph.ShowHorizontalGridLines",r)})]}),children:h.jsx(I9e,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:i?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{a(!0)},onMouseOut:()=>{a(!1)}})})}),Gpt=xe.memo(({type:t,dataSource:e,height:n,dataKeyAxisX:o,labelX:r,labelY:i,unitX:a,unitY:l,yMin:s="auto",yMax:c="auto",fractionDigits:u=2,referenceX:d,color:f})=>{const[p,m]=g.useState(0),[y,w]=g.useState(!0),[x,C]=g.useState(!0),[P,A]=g.useState(null);g.useEffect(()=>{if(!e||e.length===0)return;const R=Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1;p!==R&&m(R)},[e]);const S=g.useMemo(()=>{const R=[];for(let M=0;M{},b=R=>{A(R.dataKey)},T=()=>{A(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"bar-graph-"+r+"-"+i,style:{width:"100%",height:`${n}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(Mj,{width:"100%",height:"100%",children:h.jsxs(MKo,{data:e,onMouseDown:v,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:R=>R.toFixed(u)+" "+l}),h.jsx(A7,{vertical:x,horizontal:y,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:d,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:o??r,fontSize:"10px",children:h.jsx(ds,{value:r+(a?" ("+a+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[s,c],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:i+(l?" ("+l+")":""),offset:0,angle:-90,position:"center"})}),S,p>1&&h.jsx(F5,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:T,onMouseEnter:b})]})}),h.jsx(EKo,{horizontalGrid:y,verticalGrid:x,changeHorizontalGrid:R=>{w(R)},changeVerticalGrid:R=>{C(R)}})]})})})}),ez=1,kKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,numberOfPoints:a,numberOfSymbols:l,scale:s,fillColor:c}=t,u=a?Math.round(a/l):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*s,y:n-10*s,width:20*s,height:20*s,viewBox:"-10 -10 20 20",children:h.jsx("circle",{cx:"0",cy:"0",r:"3",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})}):null},FKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("rect",{x:"-3",y:"-3",width:"6",height:"6",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})}):null},RV=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,direction:c,fillColor:u}=t,d=l?Math.round(l/s):1;if(e&&n&&i>0&&i%d===0){let f;switch(c){case 1:f="-4,2.5,4,2.5,0,-3.5";break;case 2:f="2.5,4,2.5,-4,-3.5,0";break;case 3:f="-2.5,4,-2.5,-4,3.5,0";break;default:f="-4,-2.5,4,-2.5,0,3.5"}return h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:f,style:{opacity:o,stroke:r,fill:u??"white",strokeWidth:ez}})})}return null},LKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:"-3,0,0,5,3,0,0,-5",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})}):null},WKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.05*a;return h.jsx("svg",{x:e-100*d,y:n-100*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{points:"100,10 40,180 190,60 10,60 160,180",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})})}return null},NKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.02*a;return h.jsx("svg",{x:e-150*d,y:n-150*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{className:"hex",points:"300,150 225,280 75,280 0,150 75,20 225,20",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})})}return null},Db=(t,e,n,o,r,i)=>{switch(t){case"circle":return h.jsx(kKo,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"square":return h.jsx(FKo,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"triangle up":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:1,opacity:r,fillColor:i});case"triangle down":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:0,opacity:r,fillColor:i});case"triangle right":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:3,opacity:r,fillColor:i});case"triangle left":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:2,opacity:r,fillColor:i});case"star":return h.jsx(WKo,{scale:1.25*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"diamond":return h.jsx(LKo,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"hexagon":return h.jsx(NKo,{scale:1.3*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i})}},UKo=xe.memo(({horizontalGrid:t,verticalGrid:e,lineCount:n,lineWidth:o,symbolSize:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s})=>{const c=Kt(),[u,d]=g.useState(!1),f=()=>{i==null||i(!t)},p=()=>{a==null||a(!e)},m=w=>{l==null||l(w/2)},y=w=>{s==null||s(w/5)};return h.jsx(zl,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(NR,{min:0,max:10,value:o*2,onChange:m,children:B.t("menu.graph.LineWidth",c)+":"}),h.jsx(NR,{min:2,max:12,value:r*5,onChange:y,children:B.t("menu.graph.SymbolSize",c)+":"}),h.jsx(c7,{checked:t,onClick:f,children:B.t("menu.graph.ShowHorizontalGridLines",c)}),h.jsx(c7,{checked:e,onClick:p,children:B.t("menu.graph.ShowHorizontalGridLines",c)})]}),children:h.jsx(I9e,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:u?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{d(!0)},onMouseOut:()=>{d(!1)}})})}),Eb=["circle","square","triangle up","triangle down","triangle right","triangle left","star","diamond","hexagon"],zf=({type:t,chartType:e=Dl.Line,selectedIndex:n,dataSource:o,labels:r,height:i,dataKeyAxisX:a,labelX:l,labelY:s,unitX:c,unitY:u,yMin:d="auto",yMax:f="auto",curveType:p="linear",referenceX:m,fractionDigits:y=2,symbolCount:w=12})=>{const[x,C]=g.useState(0),[P,A]=g.useState(!0),[S,v]=g.useState(!0),[b,T]=g.useState(null),[R,M]=g.useState(2),[D,k]=g.useState(1);g.useEffect(()=>{if(!o||o.length===0){C(0);return}const E=Array.isArray(o)?Object.keys(o[0]).length-1:Object.keys(o).length-1;x!==E&&C(E)},[x,o]);const N=g.useMemo(()=>{const E=[];let L;for(let j=0;j0?_||L:!1,isAnimationActive:!1},j))}return E},[t,e,n,p,r,x,R,w,D,b]),U=()=>{},W=E=>{T(E.dataKey)},F=()=>{T(null)};return h.jsx(h.Fragment,{children:o&&h.jsx("div",{id:"line-graph-"+l+"-"+s,style:{width:"100%",height:`${i}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(Mj,{width:"100%",height:"100%",children:e===Dl.Area?h.jsxs(zKo,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:E=>E.toFixed(y)+" "+u}),h.jsx(A7,{vertical:S,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:m,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:a??l,fontSize:"10px",children:h.jsx(ds,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[d,f],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,x>1&&h.jsx(F5,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:F,onMouseEnter:W})]}):h.jsxs(d8e,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:E=>E.toFixed(y)+" "+u}),h.jsx(A7,{vertical:S,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:m,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:a??l,fontSize:"10px",children:h.jsx(ds,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[d,f],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,x>1&&h.jsx(F5,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:F,onMouseEnter:W})]})}),h.jsx(UKo,{lineCount:x,symbolSize:D,lineWidth:R,horizontalGrid:P,verticalGrid:S,changeHorizontalGrid:E=>{A(E)},changeVerticalGrid:E=>{v(E)},changeLineWidth:E=>{M(E)},changeSymbolSize:E=>{k(E)}})]})})})},jKo=ko.div` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ypt(t,e){if(t){if(typeof t=="string")return Lme(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lme(t,e)}}function gKo(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function mKo(t){if(Array.isArray(t))return Lme(t)}function Lme(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n0?a:e&&e.length&&pr(r)&&pr(i)?e.slice(r,i+1):[]};function Vpt(t){return t==="number"?[0,"auto"]:void 0}var Wme=function(e,n,o,r){var i=e.graphicalItems,a=e.tooltipAxis,l=Woe(n,e);return o<0||!i||!i.length||o>=l.length?null:i.reduce(function(s,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:n;d&&e.dataStartIndex+e.dataEndIndex!==0&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(a.dataKey&&!a.allowDuplicatedCategory){var p=d===void 0?l:d;f=ZK(p,a.dataKey,r)}else f=d&&d[o]||l[o];return f?[].concat(TM(s),[qht(c,f)]):s},[])},HUe=function(e,n,o,r){var i=r||{x:e.chartX,y:e.chartY},a=xKo(i,o),l=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,u=DBo(a,l,c,s);if(u>=0&&c){var d=c[u]&&c[u].value,f=Wme(e,n,u,d),p=vKo(o,l,u,i);return{activeTooltipIndex:u,activeLabel:d,activePayload:f,activeCoordinate:p}}return null},bKo=function(e,n){var o=n.axes,r=n.graphicalItems,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=e.stackOffset,p=Jht(u,i);return o.reduce(function(m,y){var w,x=y.props,C=x.type,P=x.dataKey,A=x.allowDataOverflow,S=x.allowDuplicatedCategory,v=x.scale,b=x.ticks,T=x.includeHidden,R=y.props[a];if(m[R])return m;var M=Woe(e.data,{graphicalItems:r.filter(function(_){return _.props[a]===R}),dataStartIndex:s,dataEndIndex:c}),D=M.length,k,N,U;KJo(y.props.domain,A,C)&&(k=ome(y.props.domain,null,A),p&&(C==="number"||v!=="auto")&&(U=gF(M,P,"category")));var W=Vpt(C);if(!k||k.length===0){var F,E=(F=y.props.domain)!==null&&F!==void 0?F:W;if(P){if(k=gF(M,P,C),C==="category"&&p){var L=Gzo(k);S&&L?(N=k,k=D$(0,D)):S||(k=iNe(E,k,y).reduce(function(_,G){return _.indexOf(G)>=0?_:[].concat(TM(_),[G])},[]))}else if(C==="category")S?k=k.filter(function(_){return _!==""&&!ca(_)}):k=iNe(E,k,y).reduce(function(_,G){return _.indexOf(G)>=0||G===""||ca(G)?_:[].concat(TM(_),[G])},[]);else if(C==="number"){var j=WBo(M,r.filter(function(_){return _.props[a]===R&&(T||!_.props.hide)}),P,i,u);j&&(k=j)}p&&(C==="number"||v!=="auto")&&(U=gF(M,P,"category"))}else p?k=D$(0,D):l&&l[R]&&l[R].hasStack&&C==="number"?k=f==="expand"?[0,1]:$ht(l[R].stackGroups,s,c):k=Xht(M,r.filter(function(_){return _.props[a]===R&&(T||!_.props.hide)}),C,u,!0);if(C==="number")k=kme(d,k,R,i,b),E&&(k=ome(E,k,A));else if(C==="category"&&E){var Y=E,O=k.every(function(_){return Y.indexOf(_)>=0});O&&(k=Y)}}return Io(Io({},m),{},Yi({},R,Io(Io({},y.props),{},{axisType:i,domain:k,categoricalDomain:U,duplicateDomain:N,originalDomain:(w=y.props.domain)!==null&&w!==void 0?w:W,isCategorical:p,layout:u})))},{})},SKo=function(e,n){var o=n.graphicalItems,r=n.Axis,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=Woe(e.data,{graphicalItems:o,dataStartIndex:s,dataEndIndex:c}),p=f.length,m=Jht(u,i),y=-1;return o.reduce(function(w,x){var C=x.props[a],P=Vpt("number");if(!w[C]){y++;var A;return m?A=D$(0,p):l&&l[C]&&l[C].hasStack?(A=$ht(l[C].stackGroups,s,c),A=kme(d,A,C,i)):(A=ome(P,Xht(f,o.filter(function(S){return S.props[a]===C&&!S.props.hide}),"number",u),r.defaultProps.allowDataOverflow),A=kme(d,A,C,i)),Io(Io({},w),{},Yi({},C,Io(Io({axisType:i},r.defaultProps),{},{hide:!0,orientation:Ey(AKo,"".concat(i,".").concat(y%2),null),domain:A,originalDomain:P,isCategorical:m,layout:u})))}return w},{})},TKo=function(e,n){var o=n.axisType,r=o===void 0?"xAxis":o,i=n.AxisComp,a=n.graphicalItems,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.children,d="".concat(r,"Id"),f=E1(u,i),p={};return f&&f.length?p=bKo(e,{axes:f,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(p=SKo(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c})),p},PKo=function(e){var n=t8(e),o=TA(n,!1,!0);return{tooltipTicks:o,orderedTooltipTicks:Iwe(o,function(r){return r.coordinate}),tooltipAxis:n,tooltipAxisBandSize:S$(n,o)}},MUe=function(e){var n=e.children,o=e.defaultShowTooltip,r=_g(n,yM),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!o}},CKo=function(e){return!e||!e.length?!1:e.some(function(n){var o=UA(n&&n.type);return o&&o.indexOf("Bar")>=0})},IUe=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},RKo=function(e,n){var o=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,l=e.yAxisMap,s=l===void 0?{}:l,c=o.width,u=o.height,d=o.children,f=o.margin||{},p=_g(d,yM),m=_g(d,F5),y=Object.keys(s).reduce(function(S,v){var b=s[v],T=b.orientation;return!b.mirror&&!b.hide?Io(Io({},S),{},Yi({},T,S[T]+b.width)):S},{left:f.left||0,right:f.right||0}),w=Object.keys(a).reduce(function(S,v){var b=a[v],T=b.orientation;return!b.mirror&&!b.hide?Io(Io({},S),{},Yi({},T,Ey(S,"".concat(T))+b.height)):S},{top:f.top||0,bottom:f.bottom||0}),x=Io(Io({},w),y),C=x.bottom;p&&(x.bottom+=p.props.height||yM.defaultProps.height),m&&n&&(x=FBo(x,r,o,n));var P=c-x.left-x.right,A=u-x.top-x.bottom;return Io(Io({brushBottom:C},x),{},{width:Math.max(P,0),height:Math.max(A,0)})},HKo=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Uj=function(e){var n,o=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,l=e.validateTooltipEventTypes,s=l===void 0?["axis"]:l,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,p=function(w,x){var C=x.graphicalItems,P=x.stackGroups,A=x.offset,S=x.updateId,v=x.dataStartIndex,b=x.dataEndIndex,T=w.barSize,R=w.layout,M=w.barGap,D=w.barCategoryGap,k=w.maxBarSize,N=IUe(R),U=N.numericAxisName,W=N.cateAxisName,F=CKo(C),E=[];return C.forEach(function(L,j){var Y=Woe(w.data,{graphicalItems:[L],dataStartIndex:v,dataEndIndex:b}),O=L.props,_=O.dataKey,G=O.maxBarSize,Q=L.props["".concat(U,"Id")],oe=L.props["".concat(W,"Id")],ee={},$=c.reduce(function(Ie,ve){var ze=x["".concat(ve.axisType,"Map")],Ae=L.props["".concat(ve.axisType,"Id")];ze&&ze[Ae]||ve.axisType==="zAxis"||gS();var se=ze[Ae];return Io(Io({},Ie),{},Yi(Yi({},ve.axisType,se),"".concat(ve.axisType,"Ticks"),TA(se)))},ee),ae=$[W],Z=$["".concat(W,"Ticks")],ne=P&&P[Q]&&P[Q].hasStack&&KBo(L,P[Q].stackGroups),te=UA(L.type).indexOf("Bar")>=0,q=S$(ae,Z),le=[],de=F&&EBo({barSize:T,stackGroups:P,totalSize:HKo($,W)});if(te){var he,me,ce=ca(G)?k:G,Pe=(he=(me=S$(ae,Z,!0))!==null&&me!==void 0?me:ce)!==null&&he!==void 0?he:0;le=kBo({barGap:M,barCategoryGap:D,bandSize:Pe!==q?Pe:q,sizeList:de[oe],maxBarSize:ce}),Pe!==q&&(le=le.map(function(Ie){return Io(Io({},Ie),{},{position:Io(Io({},Ie.position),{},{offset:Ie.position.offset-Pe/2})})}))}var pe=L&&L.type&&L.type.getComposedData;pe&&E.push({props:Io(Io({},pe(Io(Io({},$),{},{displayedData:Y,props:w,dataKey:_,item:L,bandSize:q,barPosition:le,offset:A,stackedData:ne,layout:R,dataStartIndex:v,dataEndIndex:b}))),{},Yi(Yi(Yi({key:L.key||"item-".concat(j)},U,$[U]),W,$[W]),"animationId",S)),childIndex:rDo(L,w.children),item:L})}),E},m=function(w,x){var C=w.props,P=w.dataStartIndex,A=w.dataEndIndex,S=w.updateId;if(!wLe({props:C}))return null;var v=C.children,b=C.layout,T=C.stackOffset,R=C.data,M=C.reverseStackOrder,D=IUe(b),k=D.numericAxisName,N=D.cateAxisName,U=E1(v,r),W=GBo(R,U,"".concat(k,"Id"),"".concat(N,"Id"),T,M),F=c.reduce(function(O,_){var G="".concat(_.axisType,"Map");return Io(Io({},O),{},Yi({},G,TKo(C,Io(Io({},_),{},{graphicalItems:U,stackGroups:_.axisType===k&&W,dataStartIndex:P,dataEndIndex:A}))))},{}),E=RKo(Io(Io({},F),{},{props:C,graphicalItems:U}),x==null?void 0:x.legendBBox);Object.keys(F).forEach(function(O){F[O]=d(C,F[O],E,O.replace("Map",""),o)});var L=F["".concat(N,"Map")],j=PKo(L),Y=p(C,Io(Io({},F),{},{dataStartIndex:P,dataEndIndex:A,updateId:S,graphicalItems:U,stackGroups:W,offset:E}));return Io(Io({formattedGraphicalItems:Y,graphicalItems:U,offset:E,stackGroups:W},j),F)};return n=function(y){hKo(w,y);function w(x){var C,P,A;return sKo(this,w),A=dKo(this,w,[x]),Yi(Tl(A),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Yi(Tl(A),"accessibilityManager",new JJo),Yi(Tl(A),"handleLegendBBoxUpdate",function(S){if(S){var v=A.state,b=v.dataStartIndex,T=v.dataEndIndex,R=v.updateId;A.setState(Io({legendBBox:S},m({props:A.props,dataStartIndex:b,dataEndIndex:T,updateId:R},Io(Io({},A.state),{},{legendBBox:S}))))}}),Yi(Tl(A),"handleReceiveSyncEvent",function(S,v,b){if(A.props.syncId===S){if(b===A.eventEmitterSymbol&&typeof A.props.syncMethod!="function")return;A.applySyncEvent(v)}}),Yi(Tl(A),"handleBrushChange",function(S){var v=S.startIndex,b=S.endIndex;if(v!==A.state.dataStartIndex||b!==A.state.dataEndIndex){var T=A.state.updateId;A.setState(function(){return Io({dataStartIndex:v,dataEndIndex:b},m({props:A.props,dataStartIndex:v,dataEndIndex:b,updateId:T},A.state))}),A.triggerSyncEvent({dataStartIndex:v,dataEndIndex:b})}}),Yi(Tl(A),"handleMouseEnter",function(S){var v=A.getMouseInfo(S);if(v){var b=Io(Io({},v),{},{isTooltipActive:!0});A.setState(b),A.triggerSyncEvent(b);var T=A.props.onMouseEnter;Ta(T)&&T(b,S)}}),Yi(Tl(A),"triggeredAfterMouseMove",function(S){var v=A.getMouseInfo(S),b=v?Io(Io({},v),{},{isTooltipActive:!0}):{isTooltipActive:!1};A.setState(b),A.triggerSyncEvent(b);var T=A.props.onMouseMove;Ta(T)&&T(b,S)}),Yi(Tl(A),"handleItemMouseEnter",function(S){A.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),Yi(Tl(A),"handleItemMouseLeave",function(){A.setState(function(){return{isTooltipActive:!1}})}),Yi(Tl(A),"handleMouseMove",function(S){S.persist(),A.throttleTriggeredAfterMouseMove(S)}),Yi(Tl(A),"handleMouseLeave",function(S){A.throttleTriggeredAfterMouseMove.cancel();var v={isTooltipActive:!1};A.setState(v),A.triggerSyncEvent(v);var b=A.props.onMouseLeave;Ta(b)&&b(v,S)}),Yi(Tl(A),"handleOuterEvent",function(S){var v=oDo(S),b=Ey(A.props,"".concat(v));if(v&&Ta(b)){var T,R;/.*touch.*/i.test(v)?R=A.getMouseInfo(S.changedTouches[0]):R=A.getMouseInfo(S),b((T=R)!==null&&T!==void 0?T:{},S)}}),Yi(Tl(A),"handleClick",function(S){var v=A.getMouseInfo(S);if(v){var b=Io(Io({},v),{},{isTooltipActive:!0});A.setState(b),A.triggerSyncEvent(b);var T=A.props.onClick;Ta(T)&&T(b,S)}}),Yi(Tl(A),"handleMouseDown",function(S){var v=A.props.onMouseDown;if(Ta(v)){var b=A.getMouseInfo(S);v(b,S)}}),Yi(Tl(A),"handleMouseUp",function(S){var v=A.props.onMouseUp;if(Ta(v)){var b=A.getMouseInfo(S);v(b,S)}}),Yi(Tl(A),"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&A.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),Yi(Tl(A),"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&A.handleMouseDown(S.changedTouches[0])}),Yi(Tl(A),"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&A.handleMouseUp(S.changedTouches[0])}),Yi(Tl(A),"triggerSyncEvent",function(S){A.props.syncId!==void 0&&Mue.emit(Iue,A.props.syncId,S,A.eventEmitterSymbol)}),Yi(Tl(A),"applySyncEvent",function(S){var v=A.props,b=v.layout,T=v.syncMethod,R=A.state.updateId,M=S.dataStartIndex,D=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)A.setState(Io({dataStartIndex:M,dataEndIndex:D},m({props:A.props,dataStartIndex:M,dataEndIndex:D,updateId:R},A.state)));else if(S.activeTooltipIndex!==void 0){var k=S.chartX,N=S.chartY,U=S.activeTooltipIndex,W=A.state,F=W.offset,E=W.tooltipTicks;if(!F)return;if(typeof T=="function")U=T(E,S);else if(T==="value"){U=-1;for(var L=0;L=0){var ne,te;if(k.dataKey&&!k.allowDuplicatedCategory){var q=typeof k.dataKey=="function"?Z:"payload.".concat(k.dataKey.toString());ne=ZK(L,q,U),te=j&&Y&&ZK(Y,q,U)}else ne=L==null?void 0:L[N],te=j&&Y&&Y[N];if(oe||Q){var le=S.props.activeIndex!==void 0?S.props.activeIndex:N;return[g.cloneElement(S,Io(Io(Io({},T.props),$),{},{activeIndex:le})),null,null]}if(!ca(ne))return[ae].concat(TM(A.renderActivePoints({item:T,activePoint:ne,basePoint:te,childIndex:N,isRange:j})))}else{var de,he=(de=A.getItemByXY(A.state.activeCoordinate))!==null&&de!==void 0?de:{graphicalItem:ae},me=he.graphicalItem,ce=me.item,Pe=ce===void 0?S:ce,pe=me.childIndex,Ie=Io(Io(Io({},T.props),$),{},{activeIndex:pe});return[g.cloneElement(Pe,Ie),null,null]}return j?[ae,null,null]:[ae,null]}),Yi(Tl(A),"renderCustomized",function(S,v,b){return g.cloneElement(S,Io(Io({key:"recharts-customized-".concat(b)},A.props),A.state))}),Yi(Tl(A),"renderMap",{CartesianGrid:{handler:CV,once:!0},ReferenceArea:{handler:A.renderReferenceElement},ReferenceLine:{handler:CV},ReferenceDot:{handler:A.renderReferenceElement},XAxis:{handler:CV},YAxis:{handler:CV},Brush:{handler:A.renderBrush,once:!0},Bar:{handler:A.renderGraphicChild},Line:{handler:A.renderGraphicChild},Area:{handler:A.renderGraphicChild},Radar:{handler:A.renderGraphicChild},RadialBar:{handler:A.renderGraphicChild},Scatter:{handler:A.renderGraphicChild},Pie:{handler:A.renderGraphicChild},Funnel:{handler:A.renderGraphicChild},Tooltip:{handler:A.renderCursor,once:!0},PolarGrid:{handler:A.renderPolarGrid,once:!0},PolarAngleAxis:{handler:A.renderPolarAxis},PolarRadiusAxis:{handler:A.renderPolarAxis},Customized:{handler:A.renderCustomized}}),A.clipPathId="".concat((C=x.id)!==null&&C!==void 0?C:fT("recharts"),"-clip"),A.throttleTriggeredAfterMouseMove=Jft(A.triggeredAfterMouseMove,(P=x.throttleDelay)!==null&&P!==void 0?P:1e3/60),A.state={},A}return uKo(w,[{key:"componentDidMount",value:function(){var C,P;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(P=this.props.margin.top)!==null&&P!==void 0?P:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,P=C.children,A=C.data,S=C.height,v=C.layout,b=_g(P,yh);if(b){var T=b.props.defaultIndex;if(!(typeof T!="number"||T<0||T>this.state.tooltipTicks.length)){var R=this.state.tooltipTicks[T]&&this.state.tooltipTicks[T].value,M=Wme(this.state,A,T,R),D=this.state.tooltipTicks[T].coordinate,k=(this.state.offset.top+S)/2,N=v==="horizontal",U=N?{x:D,y:k}:{y:D,x:k},W=this.state.formattedGraphicalItems.find(function(E){var L=E.item;return L.type.name==="Scatter"});W&&(U=Io(Io({},U),W.props.points[T].tooltipPosition),M=W.props.points[T].tooltipPayload);var F={activeTooltipIndex:T,isTooltipActive:!0,activeLabel:R,activePayload:M,activeCoordinate:U};this.setState(F),this.renderCursor(b),this.accessibilityManager.setIndex(T)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,P){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==P.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var A,S;this.accessibilityManager.setDetails({offset:{left:(A=this.props.margin.left)!==null&&A!==void 0?A:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(C){Sge([_g(C.children,yh)],[_g(this.props.children,yh)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=_g(this.props.children,yh);if(C&&typeof C.props.shared=="boolean"){var P=C.props.shared?"axis":"item";return s.indexOf(P)>=0?P:a}return a}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var P=this.container,A=P.getBoundingClientRect(),S=AWo(A),v={chartX:Math.round(C.pageX-S.left),chartY:Math.round(C.pageY-S.top)},b=A.width/P.offsetWidth||1,T=this.inRange(v.chartX,v.chartY,b);if(!T)return null;var R=this.state,M=R.xAxisMap,D=R.yAxisMap,k=this.getTooltipEventType();if(k!=="axis"&&M&&D){var N=t8(M).scale,U=t8(D).scale,W=N&&N.invert?N.invert(v.chartX):null,F=U&&U.invert?U.invert(v.chartY):null;return Io(Io({},v),{},{xValue:W,yValue:F})}var E=HUe(this.state,this.props.data,this.props.layout,T);return E?Io(Io({},v),E):null}},{key:"inRange",value:function(C,P){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,v=C/A,b=P/A;if(S==="horizontal"||S==="vertical"){var T=this.state.offset,R=v>=T.left&&v<=T.left+T.width&&b>=T.top&&b<=T.top+T.height;return R?{x:v,y:b}:null}var M=this.state,D=M.angleAxisMap,k=M.radiusAxisMap;if(D&&k){var N=t8(D);return sNe({x:v,y:b},N)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,P=this.getTooltipEventType(),A=_g(C,yh),S={};A&&P==="axis"&&(A.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var v=e$(this.props,this.handleOuterEvent);return Io(Io({},v),S)}},{key:"addListener",value:function(){Mue.on(Iue,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Mue.removeListener(Iue,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,P,A){for(var S=this.state.formattedGraphicalItems,v=0,b=S.length;v{const r=Kt(),[i,a]=g.useState(!1),l=()=>{n==null||n(!t)},s=()=>{o==null||o(!e)};return h.jsx(zl,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(c7,{checked:t,onClick:l,children:B.t("menu.graph.ShowHorizontalGridLines",r)}),h.jsx(c7,{checked:e,onClick:s,children:B.t("menu.graph.ShowHorizontalGridLines",r)})]}),children:h.jsx(I9e,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:i?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{a(!0)},onMouseOut:()=>{a(!1)}})})}),Gpt=xe.memo(({type:t,dataSource:e,height:n,dataKeyAxisX:o,labelX:r,labelY:i,unitX:a,unitY:l,yMin:s="auto",yMax:c="auto",fractionDigits:u=2,referenceX:d,color:f})=>{const[p,m]=g.useState(0),[y,w]=g.useState(!0),[x,C]=g.useState(!0),[P,A]=g.useState(null);g.useEffect(()=>{if(!e||e.length===0)return;const R=Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1;p!==R&&m(R)},[e]);const S=g.useMemo(()=>{const R=[];for(let M=0;M{},b=R=>{A(R.dataKey)},T=()=>{A(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"bar-graph-"+r+"-"+i,style:{width:"100%",height:`${n}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(Mj,{width:"100%",height:"100%",children:h.jsxs(MKo,{data:e,onMouseDown:v,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:R=>R.toFixed(u)+" "+l}),h.jsx(A7,{vertical:x,horizontal:y,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:d,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:o??r,fontSize:"10px",children:h.jsx(ds,{value:r+(a?" ("+a+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[s,c],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:i+(l?" ("+l+")":""),offset:0,angle:-90,position:"center"})}),S,p>1&&h.jsx(F5,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:T,onMouseEnter:b})]})}),h.jsx(EKo,{horizontalGrid:y,verticalGrid:x,changeHorizontalGrid:R=>{w(R)},changeVerticalGrid:R=>{C(R)}})]})})})}),ez=1,kKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,numberOfPoints:a,numberOfSymbols:l,scale:s,fillColor:c}=t,u=a?Math.round(a/l):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*s,y:n-10*s,width:20*s,height:20*s,viewBox:"-10 -10 20 20",children:h.jsx("circle",{cx:"0",cy:"0",r:"3",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})}):null},FKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("rect",{x:"-3",y:"-3",width:"6",height:"6",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})}):null},RV=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,direction:c,fillColor:u}=t,d=l?Math.round(l/s):1;if(e&&n&&i>0&&i%d===0){let f;switch(c){case 1:f="-4,2.5,4,2.5,0,-3.5";break;case 2:f="2.5,4,2.5,-4,-3.5,0";break;case 3:f="-2.5,4,-2.5,-4,3.5,0";break;default:f="-4,-2.5,4,-2.5,0,3.5"}return h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:f,style:{opacity:o,stroke:r,fill:u??"white",strokeWidth:ez}})})}return null},LKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:"-3,0,0,5,3,0,0,-5",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})}):null},WKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.05*a;return h.jsx("svg",{x:e-100*d,y:n-100*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{points:"100,10 40,180 190,60 10,60 160,180",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})})}return null},NKo=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.02*a;return h.jsx("svg",{x:e-150*d,y:n-150*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{className:"hex",points:"300,150 225,280 75,280 0,150 75,20 225,20",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:ez}})})}return null},Db=(t,e,n,o,r,i)=>{switch(t){case"circle":return h.jsx(kKo,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"square":return h.jsx(FKo,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"triangle up":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:1,opacity:r,fillColor:i});case"triangle down":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:0,opacity:r,fillColor:i});case"triangle right":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:3,opacity:r,fillColor:i});case"triangle left":return h.jsx(RV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:2,opacity:r,fillColor:i});case"star":return h.jsx(WKo,{scale:1.25*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"diamond":return h.jsx(LKo,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"hexagon":return h.jsx(NKo,{scale:1.3*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i})}},UKo=xe.memo(({horizontalGrid:t,verticalGrid:e,lineCount:n,lineWidth:o,symbolSize:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s})=>{const c=Kt(),[u,d]=g.useState(!1),f=()=>{i==null||i(!t)},p=()=>{a==null||a(!e)},m=w=>{l==null||l(w/2)},y=w=>{s==null||s(w/5)};return h.jsx(zl,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(NR,{min:0,max:10,value:o*2,onChange:m,children:B.t("menu.graph.LineWidth",c)+":"}),h.jsx(NR,{min:2,max:12,value:r*5,onChange:y,children:B.t("menu.graph.SymbolSize",c)+":"}),h.jsx(c7,{checked:t,onClick:f,children:B.t("menu.graph.ShowHorizontalGridLines",c)}),h.jsx(c7,{checked:e,onClick:p,children:B.t("menu.graph.ShowHorizontalGridLines",c)})]}),children:h.jsx(I9e,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:u?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{d(!0)},onMouseOut:()=>{d(!1)}})})}),Eb=["circle","square","triangle up","triangle down","triangle right","triangle left","star","diamond","hexagon"],zf=({type:t,chartType:e=Dl.Line,selectedIndex:n,dataSource:o,labels:r,height:i,dataKeyAxisX:a,labelX:l,labelY:s,unitX:c,unitY:u,yMin:d="auto",yMax:f="auto",curveType:p="linear",referenceX:m,fractionDigits:y=2,symbolCount:w=12})=>{const[x,C]=g.useState(0),[P,A]=g.useState(!0),[S,v]=g.useState(!0),[b,T]=g.useState(null),[R,M]=g.useState(2),[D,k]=g.useState(1);g.useEffect(()=>{if(!o||o.length===0){C(0);return}const E=Array.isArray(o)?Object.keys(o[0]).length-1:Object.keys(o).length-1;x!==E&&C(E)},[x,o]);const N=g.useMemo(()=>{const E=[];let L;for(let j=0;j0?_||L:!1,isAnimationActive:!1},j))}return E},[t,e,n,p,r,x,R,w,D,b]),U=()=>{},W=E=>{T(E.dataKey)},F=()=>{T(null)};return h.jsx(h.Fragment,{children:o&&h.jsx("div",{id:"line-graph-"+l+"-"+s,style:{width:"100%",height:`${i}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(Mj,{width:"100%",height:"100%",children:e===Dl.Area?h.jsxs(zKo,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:E=>E.toFixed(y)+" "+u}),h.jsx(A7,{vertical:S,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:m,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:a??l,fontSize:"10px",children:h.jsx(ds,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[d,f],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,x>1&&h.jsx(F5,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:F,onMouseEnter:W})]}):h.jsxs(d8e,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:E=>E.toFixed(y)+" "+u}),h.jsx(A7,{vertical:S,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:m,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:a??l,fontSize:"10px",children:h.jsx(ds,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[d,f],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,x>1&&h.jsx(F5,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:F,onMouseEnter:W})]})}),h.jsx(UKo,{lineCount:x,symbolSize:D,lineWidth:R,horizontalGrid:P,verticalGrid:S,changeHorizontalGrid:E=>{A(E)},changeVerticalGrid:E=>{v(E)},changeLineWidth:E=>{M(E)},changeSymbolSize:E=>{k(E)}})]})})})},jKo=ko.div` position: fixed; top: 80px; left: 50px; @@ -9076,7 +9076,7 @@ vr.version="2.29.4";JKo(Dc);vr.fn=nr;vr.min=Fqo;vr.max=Lqo;vr.now=Wqo;vr.utc=f6; justify-content: space-between; align-items: center; cursor: move; -`,cer=xe.memo(({city:t})=>{const e=H(Qi),n=H(I0)??Lu,o=H(pn),r=H(UM)??6,i=new Date(H(ml)),a=In(NCt),l=H(oJe),s=In(rJe),c=H(Pm),u=H(DSt),d=dt(_5),f=H.getState().economicsParams,p=dt(Ef),m=H(kc),y=xe.useRef(null),w=g.useRef(null),x=w.current?w.current.clientWidth+40:640,C=w.current?w.current.clientHeight+100:500,[P,A]=g.useState({x:u?Math.max(u.x,x-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-C):0}),[S,v]=g.useState(0),[b,T]=g.useState(!1),R=g.useRef(new Map),M=g.useRef(),D=Bs[i.getMonth()],k=Kt(),N=c(z.SolarPanel);g.useEffect(()=>{let q=0;R.current.clear();for(const ae of a)for(const Z in ae)Object.hasOwn(ae,Z)&&Z!=="Month"&&(q+=ae[Z],R.current.set(Z,(R.current.get(Z)??0)+ae[Z]));v(q),T(!b)},[a]),g.useEffect(()=>{A({x:Math.max(u==null?void 0:u.x,x-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})},[u,x,C]),g.useEffect(()=>{const q=()=>{A({x:Math.max(u==null?void 0:u.x,x-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})};return window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q)}},[u,x,C]),g.useEffect(()=>(w.current&&(M.current||(M.current=new ResizeObserver(()=>{o(q=>{w.current&&(q.viewState.yearlyPvYieldPanelRect||(q.viewState.yearlyPvYieldPanelRect=new fr(0,0,600,400)),q.viewState.yearlyPvYieldPanelRect.width=w.current.offsetWidth,q.viewState.yearlyPvYieldPanelRect.height=w.current.offsetHeight)})})),M.current.observe(w.current)),()=>{var q;(q=M.current)==null||q.disconnect()}),[]);const U=(q,ae)=>{A({x:Math.max(ae.x,x-window.innerWidth),y:Math.min(ae.y,window.innerHeight-C)})},W=(q,ae)=>{o(Z=>{Z.viewState.yearlyPvYieldPanelRect||(Z.viewState.yearlyPvYieldPanelRect=new fr(0,0,600,400)),Z.viewState.yearlyPvYieldPanelRect.x=Math.max(ae.x,x-window.innerWidth),Z.viewState.yearlyPvYieldPanelRect.y=Math.min(ae.y,window.innerHeight-C)})},F=()=>{o(q=>{q.viewState.showYearlyPvYieldPanel=!1,e&&(q.actionInfo={name:"Close Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()})})};g.useEffect(()=>{N<2&&l&&o(q=>{q.graphState&&(q.graphState.yearlyPvIndividualOutputs=!1)})},[N,l]);const{t:E}=Jl(),L=E("word.Month",k),j=E("solarPanelYieldPanel.Yield",k),Y=ye.countAllSolarPanels(),O=12/r,_=S*O,G=Y*f.operationalCostPerUnit*365,Q=_*f.electricitySellingPrice,oe=Q-G,ee=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Vi,{nodeRef:y,handle:".handle",bounds:"parent",axis:"both",position:P,onDrag:U,onStop:W,onMouseDown:()=>{o(q=>{q.selectedFloatingWindow="yearlyPvYieldPanel"})},children:h.jsx(aer,{ref:y,style:{zIndex:m==="yearlyPvYieldPanel"?Ec:9},children:h.jsxs(ler,{ref:w,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(ser,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[E("solarPanelYieldPanel.SolarPanelYearlyYield",k)+": ",h.jsx("span",{style:{fontSize:"10px"},children:E("sensorPanel.WeatherDataFrom",k)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:E("word.Close",k)})]}),h.jsx(zf,{type:bi.YearlyPvYield,chartType:l?Dl.Line:Dl.Area,dataSource:a.map(({Daylight:q,Clearness:ae,...Z})=>Z),labels:s,height:100,dataKeyAxisX:"Month",labelX:L,labelY:j,unitY:E("word.kWh",k),yMin:0,curveType:"linear",fractionDigits:2,referenceX:D}),!p&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[l&&N>1&&R.current.size>0?h.jsx(zl,{title:E("shared.OutputBreakdown",k),content:[...R.current.entries()].map((q,ae)=>h.jsxs(xe.Fragment,{children:[h.jsxs(Qt,{style:{textAlign:"right"},children:[h.jsx(Ge,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:q[0]+": "}),h.jsx(Ge,{span:8,children:(q[1]*O).toFixed(2)})]}),ae===R.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:E("word.Total",k)+": "+_.toFixed(2)+" "+E("word.kWh",k)})]})]},ae)),children:h.jsx(Jt,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:E("shared.OutputBreakdown",k)})}):h.jsxs(h.Fragment,{children:[_>0&&h.jsx(Jt,{children:E("solarPanelYieldPanel.YearlyTotal",k)+": "+_.toFixed(2)+" "+E("word.kWh",k)}),_>0&&h.jsx(zl,{title:E("shared.MoreResults",k),content:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.ModuleCount",k)+": "}),h.jsx(Ge,{span:10,children:Y})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.MeanYield",k)+": "}),h.jsxs(Ge,{span:10,children:[(_/Y).toFixed(2)," kWh"]})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.TotalCost",k)+": "}),h.jsxs(Ge,{span:10,children:["$",G.toFixed(2)]})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.TotalRevenue",k)+": "}),h.jsxs(Ge,{span:10,children:["$",Q.toFixed(2)]})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.Profit",k)+": "}),h.jsx(Ge,{span:10,children:(oe>0?"$":"-$")+Math.abs(oe).toFixed(2)})]})]}),children:h.jsx(oo,{type:"default",children:E("shared.MoreResults",k)})})]}),!d&&h.jsxs(h.Fragment,{children:[N>1&&h.jsx(zc,{title:E("solarPanelYieldPanel.ShowOutputsOfIndividualSolarPanels",k),checkedChildren:h.jsx(R0,{}),unCheckedChildren:h.jsx(R0,{}),checked:l,onChange:q=>{if(N===0){yn(E("analysisManager.NoSolarPanelForAnalysis",k));return}yn(E("message.SimulationStarted",k)),setTimeout(()=>{o(ae=>{ae.graphState&&(ae.graphState.yearlyPvIndividualOutputs=q),e&&(ae.actionInfo={name:"Run Yearly Simulation For Solar Panels: "+(q?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(ae=>{ae.simulationInProgress=!0,ae.runYearlySimulationForSolarPanels=!0,ae.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(oo,{type:"default",icon:ee?h.jsx(Bh,{}):h.jsx(Lf,{}),title:E(ee?"word.Run":"word.Update",k),onClick:()=>{if(N===0){yn(E("analysisManager.NoSolarPanelForAnalysis",k));return}yn(E("message.SimulationStarted",k)),setTimeout(()=>{o(q=>{e&&(q.actionInfo={name:"Run Yearly Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(q=>{q.simulationInProgress=!0,q.runYearlySimulationForSolarPanels=!0,q.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:E("word.SaveAsImage",k),onClick:()=>{Yd("line-graph-"+L+"-"+j,"yearly-pv-yield").then(()=>{yn(E("message.ScreenshotSaved",k)),e&&o(q=>{q.actionInfo={name:"Take Screenshot of Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(oo,{type:"default",icon:h.jsx(Wf,{}),title:E("word.SaveAsCsv",k),onClick:()=>{Yh(a,"yearly-pv-yield.csv"),yn(E("message.CsvFileSaved",k)),e&&o(q=>{q.actionInfo={name:"Export Solar Panel Yearly Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})}),uer=ko.div` +`,cer=xe.memo(({city:t})=>{const e=H(Qi),n=H(I0)??Lu,o=H(pn),r=H(UM)??6,i=new Date(H(ml)),a=In(NCt),l=H(oJe),s=In(rJe),c=H(Pm),u=H(DSt),d=dt(_5),f=H.getState().economicsParams,p=dt(Ef),m=H(kc),y=xe.useRef(null),w=g.useRef(null),x=w.current?w.current.clientWidth+40:640,C=w.current?w.current.clientHeight+100:500,[P,A]=g.useState({x:u?Math.max(u.x,x-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-C):0}),[S,v]=g.useState(0),[b,T]=g.useState(!1),R=g.useRef(new Map),M=g.useRef(),D=Bs[i.getMonth()],k=Kt(),N=c(z.SolarPanel);g.useEffect(()=>{let $=0;R.current.clear();for(const ae of a)for(const Z in ae)Object.hasOwn(ae,Z)&&Z!=="Month"&&($+=ae[Z],R.current.set(Z,(R.current.get(Z)??0)+ae[Z]));v($),T(!b)},[a]),g.useEffect(()=>{A({x:Math.max(u==null?void 0:u.x,x-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})},[u,x,C]),g.useEffect(()=>{const $=()=>{A({x:Math.max(u==null?void 0:u.x,x-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})};return window.addEventListener("resize",$),()=>{window.removeEventListener("resize",$)}},[u,x,C]),g.useEffect(()=>(w.current&&(M.current||(M.current=new ResizeObserver(()=>{o($=>{w.current&&($.viewState.yearlyPvYieldPanelRect||($.viewState.yearlyPvYieldPanelRect=new fr(0,0,600,400)),$.viewState.yearlyPvYieldPanelRect.width=w.current.offsetWidth,$.viewState.yearlyPvYieldPanelRect.height=w.current.offsetHeight)})})),M.current.observe(w.current)),()=>{var $;($=M.current)==null||$.disconnect()}),[]);const U=($,ae)=>{A({x:Math.max(ae.x,x-window.innerWidth),y:Math.min(ae.y,window.innerHeight-C)})},W=($,ae)=>{o(Z=>{Z.viewState.yearlyPvYieldPanelRect||(Z.viewState.yearlyPvYieldPanelRect=new fr(0,0,600,400)),Z.viewState.yearlyPvYieldPanelRect.x=Math.max(ae.x,x-window.innerWidth),Z.viewState.yearlyPvYieldPanelRect.y=Math.min(ae.y,window.innerHeight-C)})},F=()=>{o($=>{$.viewState.showYearlyPvYieldPanel=!1,e&&($.actionInfo={name:"Close Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()})})};g.useEffect(()=>{N<2&&l&&o($=>{$.graphState&&($.graphState.yearlyPvIndividualOutputs=!1)})},[N,l]);const{t:E}=Jl(),L=E("word.Month",k),j=E("solarPanelYieldPanel.Yield",k),Y=ye.countAllSolarPanels(),O=12/r,_=S*O,G=Y*f.operationalCostPerUnit*365,Q=_*f.electricitySellingPrice,oe=Q-G,ee=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Vi,{nodeRef:y,handle:".handle",bounds:"parent",axis:"both",position:P,onDrag:U,onStop:W,onMouseDown:()=>{o($=>{$.selectedFloatingWindow="yearlyPvYieldPanel"})},children:h.jsx(aer,{ref:y,style:{zIndex:m==="yearlyPvYieldPanel"?Ec:9},children:h.jsxs(ler,{ref:w,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(ser,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[E("solarPanelYieldPanel.SolarPanelYearlyYield",k)+": ",h.jsx("span",{style:{fontSize:"10px"},children:E("sensorPanel.WeatherDataFrom",k)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:E("word.Close",k)})]}),h.jsx(zf,{type:bi.YearlyPvYield,chartType:l?Dl.Line:Dl.Area,dataSource:a.map(({Daylight:$,Clearness:ae,...Z})=>Z),labels:s,height:100,dataKeyAxisX:"Month",labelX:L,labelY:j,unitY:E("word.kWh",k),yMin:0,curveType:"linear",fractionDigits:2,referenceX:D}),!p&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[l&&N>1&&R.current.size>0?h.jsx(zl,{title:E("shared.OutputBreakdown",k),content:[...R.current.entries()].map(($,ae)=>h.jsxs(xe.Fragment,{children:[h.jsxs(Qt,{style:{textAlign:"right"},children:[h.jsx(Ge,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:$[0]+": "}),h.jsx(Ge,{span:8,children:($[1]*O).toFixed(2)})]}),ae===R.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:E("word.Total",k)+": "+_.toFixed(2)+" "+E("word.kWh",k)})]})]},ae)),children:h.jsx(Jt,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:E("shared.OutputBreakdown",k)})}):h.jsxs(h.Fragment,{children:[_>0&&h.jsx(Jt,{children:E("solarPanelYieldPanel.YearlyTotal",k)+": "+_.toFixed(2)+" "+E("word.kWh",k)}),_>0&&h.jsx(zl,{title:E("shared.MoreResults",k),content:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.ModuleCount",k)+": "}),h.jsx(Ge,{span:10,children:Y})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.MeanYield",k)+": "}),h.jsxs(Ge,{span:10,children:[(_/Y).toFixed(2)," kWh"]})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.TotalCost",k)+": "}),h.jsxs(Ge,{span:10,children:["$",G.toFixed(2)]})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.TotalRevenue",k)+": "}),h.jsxs(Ge,{span:10,children:["$",Q.toFixed(2)]})]}),h.jsxs(Qt,{style:{width:"200px"},children:[h.jsx(Ge,{span:14,children:E("solarPanelYieldPanel.Profit",k)+": "}),h.jsx(Ge,{span:10,children:(oe>0?"$":"-$")+Math.abs(oe).toFixed(2)})]})]}),children:h.jsx(oo,{type:"default",children:E("shared.MoreResults",k)})})]}),!d&&h.jsxs(h.Fragment,{children:[N>1&&h.jsx(zc,{title:E("solarPanelYieldPanel.ShowOutputsOfIndividualSolarPanels",k),checkedChildren:h.jsx(R0,{}),unCheckedChildren:h.jsx(R0,{}),checked:l,onChange:$=>{if(N===0){yn(E("analysisManager.NoSolarPanelForAnalysis",k));return}yn(E("message.SimulationStarted",k)),setTimeout(()=>{o(ae=>{ae.graphState&&(ae.graphState.yearlyPvIndividualOutputs=$),e&&(ae.actionInfo={name:"Run Yearly Simulation For Solar Panels: "+($?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(ae=>{ae.simulationInProgress=!0,ae.runYearlySimulationForSolarPanels=!0,ae.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(oo,{type:"default",icon:ee?h.jsx(Bh,{}):h.jsx(Lf,{}),title:E(ee?"word.Run":"word.Update",k),onClick:()=>{if(N===0){yn(E("analysisManager.NoSolarPanelForAnalysis",k));return}yn(E("message.SimulationStarted",k)),setTimeout(()=>{o($=>{e&&($.actionInfo={name:"Run Yearly Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set($=>{$.simulationInProgress=!0,$.runYearlySimulationForSolarPanels=!0,$.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:E("word.SaveAsImage",k),onClick:()=>{Yd("line-graph-"+L+"-"+j,"yearly-pv-yield").then(()=>{yn(E("message.ScreenshotSaved",k)),e&&o($=>{$.actionInfo={name:"Take Screenshot of Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(oo,{type:"default",icon:h.jsx(Wf,{}),title:E("word.SaveAsCsv",k),onClick:()=>{Yh(a,"yearly-pv-yield.csv"),yn(E("message.CsvFileSaved",k)),e&&o($=>{$.actionInfo={name:"Export Solar Panel Yearly Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})}),uer=ko.div` position: fixed; top: 80px; right: 24px; @@ -9693,7 +9693,7 @@ vr.version="2.29.4";JKo(Dc);vr.fn=nr;vr.min=Fqo;vr.max=Lqo;vr.now=Wqo;vr.utc=f6; justify-content: space-between; align-items: center; cursor: move; -`,Htr=xe.memo(()=>{const t=H(Qi),e=H(I0)??Lu,n=H(pn),o=H(QRt),r=H(eU),i=H(qSt),a=H(q3),l=H(_M),s=H.getState().evolutionaryAlgorithmState,c=dt(Ef),u=dt(GXe),d=H(kc),f=xe.useRef(null),p=g.useRef(null),m=g.useRef(),y=p.current?p.current.clientWidth+40:i?i.width+40:680,w=p.current?p.current.clientHeight+100:i?i.height+100:500,[x,C]=g.useState({x:i?Math.max(i.x,y-window.innerWidth):0,y:i?Math.min(i.y,window.innerHeight-w):0}),P=Kt();g.useEffect(()=>{C({x:Math.max(i==null?void 0:i.x,y-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-w)})},[i,y,w]),g.useEffect(()=>{const F=()=>{C({x:Math.max(i==null?void 0:i.x,y-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-w)})};return window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F)}},[i,y,w]),g.useEffect(()=>(p.current&&(m.current||(m.current=new ResizeObserver(()=>{n(F=>{p.current&&(F.viewState.evolutionPanelRect||(F.viewState.evolutionPanelRect=new fr(0,0,640,400)),F.viewState.evolutionPanelRect.width=p.current.offsetWidth,F.viewState.evolutionPanelRect.height=p.current.offsetHeight)})})),m.current.observe(p.current)),()=>{var F;(F=m.current)==null||F.disconnect()}),[]);const A=(F,E)=>{C({x:Math.max(E.x,y-window.innerWidth),y:Math.min(E.y,window.innerHeight-w)})},S=(F,E)=>{n(L=>{L.viewState.evolutionPanelRect||(L.viewState.evolutionPanelRect=new fr(0,0,640,400)),L.viewState.evolutionPanelRect.x=Math.max(E.x,y-window.innerWidth),L.viewState.evolutionPanelRect.y=Math.min(E.y,window.innerHeight-w)})},v=()=>{n(F=>{F.viewState.showEvolutionPanel=!1,t&&(F.actionInfo={name:"Close Solar Panel Optimization Graph",timestamp:new Date().getTime()})})},b=g.useMemo(()=>!l||l===ec.GENETIC_ALGORITHM?s.geneticAlgorithmParams:s.particleSwarmOptimizationParams,[l,s]),T=g.useMemo(()=>B.t(l===ec.GENETIC_ALGORITHM?"optimizationMenu.Generation":"optimizationMenu.Step",P),[l,P]),R=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_TILT_ANGLE?B.t("solarPanelMenu.TiltAngle",P):B.t("optimizationMenu.NormalizedVariables",P),[b.problem,P]),M=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_TILT_ANGLE?"°":"",[b.problem]),D=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_ARRAY&&(b.objectiveFunctionType===Mo.DAILY_PROFIT||b.objectiveFunctionType===Mo.YEARLY_PROFIT)?B.t("word.dollar",P):B.t("word.kWh",P),[b.problem,b.objectiveFunctionType,P]),k=g.useMemo(()=>{switch(b.objectiveFunctionType){case Mo.DAILY_PROFIT:return B.t("optimizationMenu.ObjectiveFunctionDailyProfit",P);case Mo.YEARLY_PROFIT:return B.t("optimizationMenu.ObjectiveFunctionYearlyProfit",P);case Mo.DAILY_AVERAGE_OUTPUT:return B.t("optimizationMenu.ObjectiveFunctionDailyMeanYield",P);case Mo.YEARLY_AVERAGE_OUTPUT:return B.t("optimizationMenu.ObjectiveFunctionYearlyMeanYield",P);case Mo.DAILY_TOTAL_OUTPUT:return B.t("optimizationMenu.ObjectiveFunctionDailyTotalYield",P)}return B.t("optimizationMenu.ObjectiveFunctionYearlyTotalYield",P)},[b.objectiveFunctionType,P]),N=g.useMemo(()=>a?b.problem===Pi.SOLAR_PANEL_TILT_ANGLE?a.type===z.Foundation:b.problem===Pi.SOLAR_PANEL_ARRAY?a.type===z.Polygon:!1:!1,[b.problem,a]),U=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_ARRAY?B.t("optimizationMenu.ClickTargetPolygonToActivate",P):B.t("optimizationMenu.ClickTargetFoundationToActivate",P),[b.problem,P]),W=g.useMemo(()=>{let F="";return b.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&(F+=B.t("optimizationMenu.SolarPanelTiltAngleOptimization",P)),b.problem===Pi.SOLAR_PANEL_ARRAY&&(F+=B.t("optimizationMenu.SolarPanelArrayLayout",P)),F+=": ",F+=l===ec.GENETIC_ALGORITHM?B.t("optimizationMenu.GeneticAlgorithm",P):B.t("optimizationMenu.ParticleSwarmOptimization",P),F},[b.problem,l,P]);return h.jsx(Vi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:x,onDrag:A,onStop:S,onMouseDown:()=>{n(F=>{F.selectedFloatingWindow="solarPanelOptimizationResult"})},children:h.jsx(Ptr,{ref:f,style:{zIndex:d==="solarPanelOptimizationResult"?Ec:9},children:h.jsxs(Ctr,{ref:p,style:{opacity:e,width:(i?i.width:640)+"px",height:(i?i.height:400)+"px"},children:[h.jsxs(Rtr,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:W}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{v()},onMouseDown:()=>{v()},children:`${B.t("word.Close",P)}`})]}),h.jsx(Ttr,{dataSource:o,labels:r,height:100,dataKeyAxisX:"Step",labelX:T,labelY1:R,labelY2:k,unitY1:M,unitY2:D,curveType:"linear",fractionDigits:2}),!c&&!u&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[N&&h.jsx(oo,{type:"default",icon:h.jsx(mtt,{}),title:B.t("word.Run",P),onClick:()=>{yn(B.t("message.EvolutionStarted",P)),setTimeout(()=>{dt.getState().set(F=>{F.runEvolution=!0,F.pauseEvolution=!1,F.evolutionInProgress=!0}),t&&n(F=>{let E;b.problem===Pi.SOLAR_PANEL_ARRAY?l===ec.GENETIC_ALGORITHM?E="Run Genetic Algorithm for Solar Panel Array Layout":l===ec.PARTICLE_SWARM_OPTIMIZATION&&(E="Run Particle Swarm Optimization for Solar Panel Array Layout"):b.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&(l===ec.GENETIC_ALGORITHM?E="Run Genetic Algorithm for Solar Panel Tilt Angle":l===ec.PARTICLE_SWARM_OPTIMIZATION&&(E="Run Particle Swarm Optimization for Solar Panel Tilt Angle")),E&&(F.actionInfo={name:E,timestamp:new Date().getTime()})})},100)}}),!N&&h.jsx("span",{children:U}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:B.t("word.SaveAsImage",P),onClick:()=>{Yd("biaxial-line-graph-"+T+"-"+R+"-"+k,"solar-panel-tilt-angle-evolution").then(()=>{yn(B.t("message.ScreenshotSaved",P))})}})]})]})})})}),Mtr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(CQ),o=H(Fn),[r,i]=g.useState(!1),[a,l]=g.useState(!1),[s,c]=g.useState({left:0,top:0,bottom:0,right:0}),u=g.useRef(null),d=g.useRef(null),f=g.useRef(n.electricitySellingPrice),p=g.useRef(n.operationalCostPerUnit),m=Kt();g.useEffect(()=>{var P;(P=d.current)==null||P.focus()},[]);const y=(P,A)=>{if(u.current){const{clientWidth:S,clientHeight:v}=window.document.documentElement,b=u.current.getBoundingClientRect();c({left:-b.left+A.x,right:S-(b.right-A.x),top:-b.top+A.y,bottom:v-((b==null?void 0:b.bottom)-A.y)})}},w=()=>{const P=n.electricitySellingPrice,A=f.current;if(P!==A){const b={name:"Electricity Selling Price",timestamp:Date.now(),oldValue:P,newValue:A,undo:()=>{e(T=>{T.economicsParams.electricitySellingPrice=b.oldValue})},redo:()=>{e(T=>{T.economicsParams.electricitySellingPrice=b.newValue})}};o(b),e(T=>{T.economicsParams.electricitySellingPrice=A})}const S=n.operationalCostPerUnit,v=p.current;if(S!==v){const b={name:"Operational Cost per Unit",timestamp:Date.now(),oldValue:S,newValue:v,undo:()=>{e(T=>{T.economicsParams.operationalCostPerUnit=b.oldValue})},redo:()=>{e(T=>{T.economicsParams.operationalCostPerUnit=b.newValue})}};o(b),e(T=>{T.economicsParams.operationalCostPerUnit=v})}},x=()=>{t(!1)},C=()=>{w(),t(!1)};return h.jsxs(li,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>l(!0),onMouseOut:()=>l(!1),children:B.t("economicsPanel.EconomicsParameters",m)}),footer:[h.jsx(oo,{onClick:x,children:B.t("word.Cancel",m)},"Cancel"),h.jsx(oo,{type:"primary",ref:d,onClick:C,children:B.t("word.OK",m)},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:P=>h.jsx(Vi,{disabled:!a,bounds:s,onStart:(A,S)=>y(A,S),children:h.jsx("div",{ref:u,children:P})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("economicsPanel.ElectricitySellingPrice",m)+" ([0.1, 1]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:.1,max:1,style:{width:"100%"},precision:2,value:f.current,step:.01,formatter:P=>`$${P}/kWh`,onChange:P=>{P!==null&&(f.current=P,i(!r))},onBlur:P=>{const A=P.target.value.replace("$","").replace("/kWh",""),S=parseFloat(A);f.current=Number.isNaN(S)?.1:S,i(!r)},onPressEnter:P=>{const A=P.target.value.replace("$","").replace("/kWh",""),S=parseFloat(A);f.current=Number.isNaN(S)?.1:S,i(!r)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("economicsPanel.OperationalCostPerUnit",m)+" ([0.1, 1]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:.1,max:1,style:{width:"100%"},precision:2,value:p.current,step:.01,formatter:P=>`$${P}/day`,onChange:P=>{P!==null&&(p.current=P,i(!r))},onBlur:P=>{const A=P.target.value.replace("$","").replace("/day",""),S=parseFloat(A);p.current=Number.isNaN(S)?.1:S,i(!r)},onPressEnter:P=>{const A=P.target.value.replace("$","").replace("/day",""),S=parseFloat(A);p.current=Number.isNaN(S)?.1:S,i(!r)}})})]})]})}),N1t=(t,e,n)=>{const o=H.getState().elements,r=H(p4),i=H(Jn),a=dt(t5e),l=In(PS),s=In(bTt),c=In(TTt),u=[],d=[],f=g.useRef(new Map),p=g.useRef(new Map),m=g.useRef(new Map);return g.useEffect(()=>{var w,x,C,P,A,S;if(!e)return;const y=eS(t,e.lowestTemperatures,e.highestTemperatures);f.current.clear(),p.current.clear(),m.current.clear();for(let v=0;v<24;v++){const b={},T=new Map;for(const R of o)if(ye.onBuildingEnvelope(R)){const M=l.get(R.id);if(M){const D=R.type===z.Foundation?R:r(R);if(D&&!D.notBuilding&&ye.getBuildingCompletionStatus(D,o)===$c.COMPLETE){let k=T.get(D.id);k||(k=n?{heater:0,ac:0,geothermal:0,solarPanel:0,label:(w=D.label)==null?void 0:w.trim()}:{heater:0,ac:0,geothermal:0,label:(x=D.label)==null?void 0:x.trim()},T.set(D.id,k),(C=D.hvacSystem)!=null&&C.id?D.hvacSystem.id&&D.hvacSystem.id.length>0&&!d.includes(D.hvacSystem.id)&&d.push(D.hvacSystem.id):D.label&&D.label.length>0&&!d.includes(D.label)&&d.push(D.label)),R.type===z.Foundation?k.geothermal+=M[v]:M[v]<0?k.heater+=M[v]:k.ac+=M[v]}}}for(const R of o)if(R.type===z.Foundation){const M=R;if(!M.notBuilding&&ye.getBuildingCompletionStatus(M,o)!==$c.COMPLETE)continue;const D=T.get(R.id);if(D){const k=s.get(R.id);if(k&&(D.heater<0?(D.heater+=k[v],D.heater>0&&(D.heater=0)):D.ac>0&&(D.ac+=k[v])),D.solarPanel!==void 0){const N=c.get(R.id);N&&(D.solarPanel+=N[v])}}}if(T.size>1){let R=1;for(const M of T.keys()){b.Hour=v;const D=T.get(M);if(D){const k=i(M);if(k&&k.type===z.Foundation){const N=k;if(!N.notBuilding&&ye.getBuildingCompletionStatus(N,o)===$c.COMPLETE){const U=ye.getHeatingSetpoint(t,N.hvacSystem),W=ye.getCoolingSetpoint(t,N.hvacSystem),F=((P=N.hvacSystem)==null?void 0:P.temperatureThreshold)??3,E=((A=N.hvacSystem)==null?void 0:A.id)??(D.label&&D.label!==""?D.label:R.toString());E===R.toString()&&R++;let L=Math.abs(B_(y,D.heater,U,F)),j=B_(y,D.ac,W,F);L>0?(L-=D.geothermal,L<0&&(L=0)):j>0&&(j+=D.geothermal,j<0&&(j=0));const Y="Heater "+E;b[Y]?b[Y]=b[Y]+L:b[Y]=L;const O="AC "+E;if(b[O]?b[O]=b[O]+j:b[O]=j,D.solarPanel!==void 0){const Q="Solar "+E;b[Q]?b[Q]=b[Q]-D.solarPanel:b[Q]=-D.solarPanel}const _="Net "+E;b[_]?b[_]=b[_]+L+j-(D.solarPanel??0):b[_]=L+j-(D.solarPanel??0);let G=f.current.get(E);G===void 0&&(G=0),G+=L,f.current.set(E,G),G=p.current.get(E),G===void 0&&(G=0),G+=j,p.current.set(E,G),n&&(G=m.current.get(E),G===void 0&&(G=0),G+=D.solarPanel,m.current.set(E,G))}}}}}else for(const R of T.keys()){b.Hour=v;const M=T.get(R);if(M){const D=i(R);if(D&&D.type===z.Foundation){const k=D;if(!k.notBuilding&&ye.getBuildingCompletionStatus(k,o)===$c.COMPLETE){const N=ye.getHeatingSetpoint(t,k.hvacSystem),U=ye.getCoolingSetpoint(t,k.hvacSystem),W=((S=k.hvacSystem)==null?void 0:S.temperatureThreshold)??3;let F=Math.abs(B_(y,M.heater,N,W)),E=B_(y,M.ac,U,W);F>0?(F-=M.geothermal,F<0&&(F=0)):E>0&&(E+=M.geothermal,E<0&&(E=0)),b.Heater=F,b.AC=E,M.solarPanel!==void 0&&(b.Solar=-M.solarPanel),b.Net=F+E-(M.solarPanel??0);const L="default";let j=f.current.get(L);j===void 0&&(j=0),j+=F,f.current.set(L,j),j=p.current.get(L),j===void 0&&(j=0),j+=E,p.current.set(L,j),n&&(j=m.current.get(L),j===void 0&&(j=0),j+=M.solarPanel,m.current.set(L,j))}}}}u.push(b)}},[a,e]),{sum:u,sumHeaterMap:f.current,sumAcMap:p.current,sumSolarPanelMap:m.current,dataLabels:d}},Itr=xe.memo(({horizontalGrid:t,verticalGrid:e,lineWidth:n,symbolSize:o,barCategoryGap:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s,changeBarCategoryGap:c})=>{const u=Kt(),[d,f]=g.useState(!1),p=()=>{i==null||i(!t)},m=()=>{a==null||a(!e)},y=C=>{l==null||l(C/2)},w=C=>{s==null||s(C/5)},x=C=>{c==null||c(C)};return h.jsx(zl,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(NR,{min:0,max:10,value:n*2,onChange:y,children:B.t("menu.graph.LineWidth",u)+":"}),h.jsx(NR,{min:2,max:12,value:o*5,onChange:w,children:B.t("menu.graph.SymbolSize",u)+":"}),h.jsx(NR,{min:0,max:20,value:r,onChange:x,children:B.t("menu.graph.BarCategoryGap",u)+":"}),h.jsx(c7,{checked:t,onClick:p,children:B.t("menu.graph.ShowHorizontalGridLines",u)}),h.jsx(c7,{checked:e,onClick:m,children:B.t("menu.graph.ShowHorizontalGridLines",u)})]}),children:h.jsx(I9e,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:d?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{f(!0)},onMouseOut:()=>{f(!1)}})})}),U1t=({type:t,dataSource:e,hasSolarPanels:n,labels:o,height:r,dataKeyAxisX:i,labelX:a,labelY:l,unitX:s,unitY:c,yMin:u="auto",yMax:d="auto",curveType:f="linear",referenceX:p,fractionDigits:m=2,symbolCount:y=12})=>{const[w,x]=g.useState(0),[C,P]=g.useState(),[A,S]=g.useState(!0),[v,b]=g.useState(!0),[T,R]=g.useState(null),[M,D]=g.useState(2),[k,N]=g.useState(1),[U,W]=g.useState(2);g.useEffect(()=>{if(!e||e.length===0)return;const Y=n?4:3,O=(Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1)/Y;if(w!==O&&x(O),O===1&&e[0]){for(const _ in e[0])if(_.startsWith("Heater")){P(_.length>6?_.substring(6).trim():void 0);break}}},[e]);const F=g.useMemo(()=>{const Y=[],O=n?4:3;let _;const G="gray",Q=1;for(let ee=0;ee1?o[ee*O]:C?"Heater "+C:"Heater";Y.push(h.jsx(M5,{name:q,dataKey:q,stroke:G,fill:"#FA8072",opacity:T===null||T===q?1:.25,strokeWidth:Q,isAnimationActive:!1,stackId:"stack"+ee},ee*O)),q=w>1?o[ee*O+1]:C?"AC "+C:"AC",Y.push(h.jsx(M5,{name:q,dataKey:q,stroke:G,fill:"#00BFFF",opacity:T===null||T===q?1:.25,strokeWidth:Q,isAnimationActive:!1,stackId:"stack"+ee},ee*O+1)),n&&(q=w>1?o[ee*O+2]:C?"Solar "+C:"Solar",Y.push(h.jsx(M5,{name:q,dataKey:q,stroke:G,fill:"#3CB371",opacity:T===null||T===q?1:.25,strokeWidth:Q,isAnimationActive:!1,stackId:"stack"+ee},ee*O+2)))}const oe=O-1;for(let ee=0;ee1?o[ee*O+oe]:C?"Net "+C:"Net",ae=T===null||T===q?1:.25,Z=Db(Eb[ee],k,e.length,y,ae);ee===0&&(_=Z),Y.push(h.jsx(hm,{type:f,name:q,dataKey:q,stroke:Vg[ee],opacity:T===null||T===q?1:.25,strokeWidth:M,dot:y>0?Z||_:!1,isAnimationActive:!1},ee*O+oe))}return Y},[t,f,o,w,C,M,y,k,T]),E=()=>{},L=Y=>{R(Y.dataKey)},j=()=>{R(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"line-graph-"+a+"-"+l,style:{width:"100%",height:`${r}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(Mj,{width:"100%",height:"100%",children:h.jsxs(DKo,{data:e,stackOffset:"sign",barGap:0,barCategoryGap:U,onMouseDown:E,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:Y=>Y.toFixed(m)+" "+c}),h.jsx(A7,{vertical:v,horizontal:A,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:p,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:i??a,fontSize:"10px",children:h.jsx(ds,{value:a+(s?" ("+s+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[u,d],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:l+(c?" ("+c+")":""),offset:0,angle:-90,position:"center"})}),F,h.jsx(Y3,{y:0,stroke:"#888"}),w>0&&h.jsx(F5,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:j,onMouseEnter:L})]})}),h.jsx(Itr,{symbolSize:k,lineWidth:M,barCategoryGap:U,horizontalGrid:A,verticalGrid:v,changeHorizontalGrid:Y=>{S(Y)},changeVerticalGrid:Y=>{b(Y)},changeLineWidth:Y=>{D(Y)},changeSymbolSize:Y=>{N(Y)},changeBarCategoryGap:Y=>{W(Y)}})]})})})},ztr=ko.div` +`,Htr=xe.memo(()=>{const t=H(Qi),e=H(I0)??Lu,n=H(pn),o=H(QRt),r=H(eU),i=H(qSt),a=H(q3),l=H(_M),s=H.getState().evolutionaryAlgorithmState,c=dt(Ef),u=dt(GXe),d=H(kc),f=xe.useRef(null),p=g.useRef(null),m=g.useRef(),y=p.current?p.current.clientWidth+40:i?i.width+40:680,w=p.current?p.current.clientHeight+100:i?i.height+100:500,[x,C]=g.useState({x:i?Math.max(i.x,y-window.innerWidth):0,y:i?Math.min(i.y,window.innerHeight-w):0}),P=Kt();g.useEffect(()=>{C({x:Math.max(i==null?void 0:i.x,y-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-w)})},[i,y,w]),g.useEffect(()=>{const F=()=>{C({x:Math.max(i==null?void 0:i.x,y-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-w)})};return window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F)}},[i,y,w]),g.useEffect(()=>(p.current&&(m.current||(m.current=new ResizeObserver(()=>{n(F=>{p.current&&(F.viewState.evolutionPanelRect||(F.viewState.evolutionPanelRect=new fr(0,0,640,400)),F.viewState.evolutionPanelRect.width=p.current.offsetWidth,F.viewState.evolutionPanelRect.height=p.current.offsetHeight)})})),m.current.observe(p.current)),()=>{var F;(F=m.current)==null||F.disconnect()}),[]);const A=(F,E)=>{C({x:Math.max(E.x,y-window.innerWidth),y:Math.min(E.y,window.innerHeight-w)})},S=(F,E)=>{n(L=>{L.viewState.evolutionPanelRect||(L.viewState.evolutionPanelRect=new fr(0,0,640,400)),L.viewState.evolutionPanelRect.x=Math.max(E.x,y-window.innerWidth),L.viewState.evolutionPanelRect.y=Math.min(E.y,window.innerHeight-w)})},v=()=>{n(F=>{F.viewState.showEvolutionPanel=!1,t&&(F.actionInfo={name:"Close Solar Panel Optimization Graph",timestamp:new Date().getTime()})})},b=g.useMemo(()=>!l||l===ec.GENETIC_ALGORITHM?s.geneticAlgorithmParams:s.particleSwarmOptimizationParams,[l,s]),T=g.useMemo(()=>B.t(l===ec.GENETIC_ALGORITHM?"optimizationMenu.Generation":"optimizationMenu.Step",P),[l,P]),R=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_TILT_ANGLE?B.t("solarPanelMenu.TiltAngle",P):B.t("optimizationMenu.NormalizedVariables",P),[b.problem,P]),M=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_TILT_ANGLE?"°":"",[b.problem]),D=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_ARRAY&&(b.objectiveFunctionType===Mo.DAILY_PROFIT||b.objectiveFunctionType===Mo.YEARLY_PROFIT)?B.t("word.dollar",P):B.t("word.kWh",P),[b.problem,b.objectiveFunctionType,P]),k=g.useMemo(()=>{switch(b.objectiveFunctionType){case Mo.DAILY_PROFIT:return B.t("optimizationMenu.ObjectiveFunctionDailyProfit",P);case Mo.YEARLY_PROFIT:return B.t("optimizationMenu.ObjectiveFunctionYearlyProfit",P);case Mo.DAILY_AVERAGE_OUTPUT:return B.t("optimizationMenu.ObjectiveFunctionDailyMeanYield",P);case Mo.YEARLY_AVERAGE_OUTPUT:return B.t("optimizationMenu.ObjectiveFunctionYearlyMeanYield",P);case Mo.DAILY_TOTAL_OUTPUT:return B.t("optimizationMenu.ObjectiveFunctionDailyTotalYield",P)}return B.t("optimizationMenu.ObjectiveFunctionYearlyTotalYield",P)},[b.objectiveFunctionType,P]),N=g.useMemo(()=>a?b.problem===Pi.SOLAR_PANEL_TILT_ANGLE?a.type===z.Foundation:b.problem===Pi.SOLAR_PANEL_ARRAY?a.type===z.Polygon:!1:!1,[b.problem,a]),U=g.useMemo(()=>b.problem===Pi.SOLAR_PANEL_ARRAY?B.t("optimizationMenu.ClickTargetPolygonToActivate",P):B.t("optimizationMenu.ClickTargetFoundationToActivate",P),[b.problem,P]),W=g.useMemo(()=>{let F="";return b.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&(F+=B.t("optimizationMenu.SolarPanelTiltAngleOptimization",P)),b.problem===Pi.SOLAR_PANEL_ARRAY&&(F+=B.t("optimizationMenu.SolarPanelArrayLayout",P)),F+=": ",F+=l===ec.GENETIC_ALGORITHM?B.t("optimizationMenu.GeneticAlgorithm",P):B.t("optimizationMenu.ParticleSwarmOptimization",P),F},[b.problem,l,P]);return h.jsx(Vi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:x,onDrag:A,onStop:S,onMouseDown:()=>{n(F=>{F.selectedFloatingWindow="solarPanelOptimizationResult"})},children:h.jsx(Ptr,{ref:f,style:{zIndex:d==="solarPanelOptimizationResult"?Ec:9},children:h.jsxs(Ctr,{ref:p,style:{opacity:e,width:(i?i.width:640)+"px",height:(i?i.height:400)+"px"},children:[h.jsxs(Rtr,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:W}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{v()},onMouseDown:()=>{v()},children:`${B.t("word.Close",P)}`})]}),h.jsx(Ttr,{dataSource:o,labels:r,height:100,dataKeyAxisX:"Step",labelX:T,labelY1:R,labelY2:k,unitY1:M,unitY2:D,curveType:"linear",fractionDigits:2}),!c&&!u&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[N&&h.jsx(oo,{type:"default",icon:h.jsx(mtt,{}),title:B.t("word.Run",P),onClick:()=>{yn(B.t("message.EvolutionStarted",P)),setTimeout(()=>{dt.getState().set(F=>{F.runEvolution=!0,F.pauseEvolution=!1,F.evolutionInProgress=!0}),t&&n(F=>{let E;b.problem===Pi.SOLAR_PANEL_ARRAY?l===ec.GENETIC_ALGORITHM?E="Run Genetic Algorithm for Solar Panel Array Layout":l===ec.PARTICLE_SWARM_OPTIMIZATION&&(E="Run Particle Swarm Optimization for Solar Panel Array Layout"):b.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&(l===ec.GENETIC_ALGORITHM?E="Run Genetic Algorithm for Solar Panel Tilt Angle":l===ec.PARTICLE_SWARM_OPTIMIZATION&&(E="Run Particle Swarm Optimization for Solar Panel Tilt Angle")),E&&(F.actionInfo={name:E,timestamp:new Date().getTime()})})},100)}}),!N&&h.jsx("span",{children:U}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:B.t("word.SaveAsImage",P),onClick:()=>{Yd("biaxial-line-graph-"+T+"-"+R+"-"+k,"solar-panel-tilt-angle-evolution").then(()=>{yn(B.t("message.ScreenshotSaved",P))})}})]})]})})})}),Mtr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(CQ),o=H(Fn),[r,i]=g.useState(!1),[a,l]=g.useState(!1),[s,c]=g.useState({left:0,top:0,bottom:0,right:0}),u=g.useRef(null),d=g.useRef(null),f=g.useRef(n.electricitySellingPrice),p=g.useRef(n.operationalCostPerUnit),m=Kt();g.useEffect(()=>{var P;(P=d.current)==null||P.focus()},[]);const y=(P,A)=>{if(u.current){const{clientWidth:S,clientHeight:v}=window.document.documentElement,b=u.current.getBoundingClientRect();c({left:-b.left+A.x,right:S-(b.right-A.x),top:-b.top+A.y,bottom:v-((b==null?void 0:b.bottom)-A.y)})}},w=()=>{const P=n.electricitySellingPrice,A=f.current;if(P!==A){const b={name:"Electricity Selling Price",timestamp:Date.now(),oldValue:P,newValue:A,undo:()=>{e(T=>{T.economicsParams.electricitySellingPrice=b.oldValue})},redo:()=>{e(T=>{T.economicsParams.electricitySellingPrice=b.newValue})}};o(b),e(T=>{T.economicsParams.electricitySellingPrice=A})}const S=n.operationalCostPerUnit,v=p.current;if(S!==v){const b={name:"Operational Cost per Unit",timestamp:Date.now(),oldValue:S,newValue:v,undo:()=>{e(T=>{T.economicsParams.operationalCostPerUnit=b.oldValue})},redo:()=>{e(T=>{T.economicsParams.operationalCostPerUnit=b.newValue})}};o(b),e(T=>{T.economicsParams.operationalCostPerUnit=v})}},x=()=>{t(!1)},C=()=>{w(),t(!1)};return h.jsxs(li,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>l(!0),onMouseOut:()=>l(!1),children:B.t("economicsPanel.EconomicsParameters",m)}),footer:[h.jsx(oo,{onClick:x,children:B.t("word.Cancel",m)},"Cancel"),h.jsx(oo,{type:"primary",ref:d,onClick:C,children:B.t("word.OK",m)},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:P=>h.jsx(Vi,{disabled:!a,bounds:s,onStart:(A,S)=>y(A,S),children:h.jsx("div",{ref:u,children:P})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("economicsPanel.ElectricitySellingPrice",m)+" ([0.1, 1]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:.1,max:1,style:{width:"100%"},precision:2,value:f.current,step:.01,formatter:P=>`$${P}/kWh`,onChange:P=>{P!==null&&(f.current=P,i(!r))},onBlur:P=>{const A=P.target.value.replace("$","").replace("/kWh",""),S=parseFloat(A);f.current=Number.isNaN(S)?.1:S,i(!r)},onPressEnter:P=>{const A=P.target.value.replace("$","").replace("/kWh",""),S=parseFloat(A);f.current=Number.isNaN(S)?.1:S,i(!r)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("economicsPanel.OperationalCostPerUnit",m)+" ([0.1, 1]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:.1,max:1,style:{width:"100%"},precision:2,value:p.current,step:.01,formatter:P=>`$${P}/day`,onChange:P=>{P!==null&&(p.current=P,i(!r))},onBlur:P=>{const A=P.target.value.replace("$","").replace("/day",""),S=parseFloat(A);p.current=Number.isNaN(S)?.1:S,i(!r)},onPressEnter:P=>{const A=P.target.value.replace("$","").replace("/day",""),S=parseFloat(A);p.current=Number.isNaN(S)?.1:S,i(!r)}})})]})]})}),N1t=(t,e,n)=>{const o=H.getState().elements,r=H(p4),i=H(Jn),a=dt(t5e),l=In(PS),s=In(bTt),c=In(TTt),u=[],d=[],f=g.useRef(new Map),p=g.useRef(new Map),m=g.useRef(new Map);return g.useEffect(()=>{var w,x,C,P,A,S;if(!e)return;const y=eS(t,e.lowestTemperatures,e.highestTemperatures);f.current.clear(),p.current.clear(),m.current.clear();for(let v=0;v<24;v++){const b={},T=new Map;for(const R of o)if(ye.onBuildingEnvelope(R)){const M=l.get(R.id);if(M){const D=R.type===z.Foundation?R:r(R);if(D&&!D.notBuilding&&ye.getBuildingCompletionStatus(D,o)===$c.COMPLETE){let k=T.get(D.id);k||(k=n?{heater:0,ac:0,geothermal:0,solarPanel:0,label:(w=D.label)==null?void 0:w.trim()}:{heater:0,ac:0,geothermal:0,label:(x=D.label)==null?void 0:x.trim()},T.set(D.id,k),(C=D.hvacSystem)!=null&&C.id?D.hvacSystem.id&&D.hvacSystem.id.length>0&&!d.includes(D.hvacSystem.id)&&d.push(D.hvacSystem.id):D.label&&D.label.length>0&&!d.includes(D.label)&&d.push(D.label)),R.type===z.Foundation?k.geothermal+=M[v]:M[v]<0?k.heater+=M[v]:k.ac+=M[v]}}}for(const R of o)if(R.type===z.Foundation){const M=R;if(!M.notBuilding&&ye.getBuildingCompletionStatus(M,o)!==$c.COMPLETE)continue;const D=T.get(R.id);if(D){const k=s.get(R.id);if(k&&(D.heater<0?(D.heater+=k[v],D.heater>0&&(D.heater=0)):D.ac>0&&(D.ac+=k[v])),D.solarPanel!==void 0){const N=c.get(R.id);N&&(D.solarPanel+=N[v])}}}if(T.size>1){let R=1;for(const M of T.keys()){b.Hour=v;const D=T.get(M);if(D){const k=i(M);if(k&&k.type===z.Foundation){const N=k;if(!N.notBuilding&&ye.getBuildingCompletionStatus(N,o)===$c.COMPLETE){const U=ye.getHeatingSetpoint(t,N.hvacSystem),W=ye.getCoolingSetpoint(t,N.hvacSystem),F=((P=N.hvacSystem)==null?void 0:P.temperatureThreshold)??3,E=((A=N.hvacSystem)==null?void 0:A.id)??(D.label&&D.label!==""?D.label:R.toString());E===R.toString()&&R++;let L=Math.abs(B_(y,D.heater,U,F)),j=B_(y,D.ac,W,F);L>0?(L-=D.geothermal,L<0&&(L=0)):j>0&&(j+=D.geothermal,j<0&&(j=0));const Y="Heater "+E;b[Y]?b[Y]=b[Y]+L:b[Y]=L;const O="AC "+E;if(b[O]?b[O]=b[O]+j:b[O]=j,D.solarPanel!==void 0){const Q="Solar "+E;b[Q]?b[Q]=b[Q]-D.solarPanel:b[Q]=-D.solarPanel}const _="Net "+E;b[_]?b[_]=b[_]+L+j-(D.solarPanel??0):b[_]=L+j-(D.solarPanel??0);let G=f.current.get(E);G===void 0&&(G=0),G+=L,f.current.set(E,G),G=p.current.get(E),G===void 0&&(G=0),G+=j,p.current.set(E,G),n&&(G=m.current.get(E),G===void 0&&(G=0),G+=D.solarPanel,m.current.set(E,G))}}}}}else for(const R of T.keys()){b.Hour=v;const M=T.get(R);if(M){const D=i(R);if(D&&D.type===z.Foundation){const k=D;if(!k.notBuilding&&ye.getBuildingCompletionStatus(k,o)===$c.COMPLETE){const N=ye.getHeatingSetpoint(t,k.hvacSystem),U=ye.getCoolingSetpoint(t,k.hvacSystem),W=((S=k.hvacSystem)==null?void 0:S.temperatureThreshold)??3;let F=Math.abs(B_(y,M.heater,N,W)),E=B_(y,M.ac,U,W);F>0?(F-=M.geothermal,F<0&&(F=0)):E>0&&(E+=M.geothermal,E<0&&(E=0)),b.Heater=F,b.AC=E,M.solarPanel!==void 0&&(b.Solar=-M.solarPanel),b.Net=F+E-(M.solarPanel??0);const L="default";let j=f.current.get(L);j===void 0&&(j=0),j+=F,f.current.set(L,j),j=p.current.get(L),j===void 0&&(j=0),j+=E,p.current.set(L,j),n&&(j=m.current.get(L),j===void 0&&(j=0),j+=M.solarPanel,m.current.set(L,j))}}}}u.push(b)}},[a,e]),{sum:u,sumHeaterMap:f.current,sumAcMap:p.current,sumSolarPanelMap:m.current,dataLabels:d}},Itr=xe.memo(({horizontalGrid:t,verticalGrid:e,lineWidth:n,symbolSize:o,barCategoryGap:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s,changeBarCategoryGap:c})=>{const u=Kt(),[d,f]=g.useState(!1),p=()=>{i==null||i(!t)},m=()=>{a==null||a(!e)},y=C=>{l==null||l(C/2)},w=C=>{s==null||s(C/5)},x=C=>{c==null||c(C)};return h.jsx(zl,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(NR,{min:0,max:10,value:n*2,onChange:y,children:B.t("menu.graph.LineWidth",u)+":"}),h.jsx(NR,{min:2,max:12,value:o*5,onChange:w,children:B.t("menu.graph.SymbolSize",u)+":"}),h.jsx(NR,{min:0,max:20,value:r,onChange:x,children:B.t("menu.graph.BarCategoryGap",u)+":"}),h.jsx(c7,{checked:t,onClick:p,children:B.t("menu.graph.ShowHorizontalGridLines",u)}),h.jsx(c7,{checked:e,onClick:m,children:B.t("menu.graph.ShowHorizontalGridLines",u)})]}),children:h.jsx(I9e,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:d?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{f(!0)},onMouseOut:()=>{f(!1)}})})}),U1t=({type:t,dataSource:e,hasSolarPanels:n,labels:o,height:r,dataKeyAxisX:i,labelX:a,labelY:l,unitX:s,unitY:c,yMin:u="auto",yMax:d="auto",curveType:f="linear",referenceX:p,fractionDigits:m=2,symbolCount:y=12})=>{const[w,x]=g.useState(0),[C,P]=g.useState(),[A,S]=g.useState(!0),[v,b]=g.useState(!0),[T,R]=g.useState(null),[M,D]=g.useState(2),[k,N]=g.useState(1),[U,W]=g.useState(2);g.useEffect(()=>{if(!e||e.length===0)return;const Y=n?4:3,O=(Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1)/Y;if(w!==O&&x(O),O===1&&e[0]){for(const _ in e[0])if(_.startsWith("Heater")){P(_.length>6?_.substring(6).trim():void 0);break}}},[e]);const F=g.useMemo(()=>{const Y=[],O=n?4:3;let _;const G="gray",Q=1;for(let ee=0;ee1?o[ee*O]:C?"Heater "+C:"Heater";Y.push(h.jsx(M5,{name:$,dataKey:$,stroke:G,fill:"#FA8072",opacity:T===null||T===$?1:.25,strokeWidth:Q,isAnimationActive:!1,stackId:"stack"+ee},ee*O)),$=w>1?o[ee*O+1]:C?"AC "+C:"AC",Y.push(h.jsx(M5,{name:$,dataKey:$,stroke:G,fill:"#00BFFF",opacity:T===null||T===$?1:.25,strokeWidth:Q,isAnimationActive:!1,stackId:"stack"+ee},ee*O+1)),n&&($=w>1?o[ee*O+2]:C?"Solar "+C:"Solar",Y.push(h.jsx(M5,{name:$,dataKey:$,stroke:G,fill:"#3CB371",opacity:T===null||T===$?1:.25,strokeWidth:Q,isAnimationActive:!1,stackId:"stack"+ee},ee*O+2)))}const oe=O-1;for(let ee=0;ee1?o[ee*O+oe]:C?"Net "+C:"Net",ae=T===null||T===$?1:.25,Z=Db(Eb[ee],k,e.length,y,ae);ee===0&&(_=Z),Y.push(h.jsx(hm,{type:f,name:$,dataKey:$,stroke:Vg[ee],opacity:T===null||T===$?1:.25,strokeWidth:M,dot:y>0?Z||_:!1,isAnimationActive:!1},ee*O+oe))}return Y},[t,f,o,w,C,M,y,k,T]),E=()=>{},L=Y=>{R(Y.dataKey)},j=()=>{R(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"line-graph-"+a+"-"+l,style:{width:"100%",height:`${r}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(Mj,{width:"100%",height:"100%",children:h.jsxs(DKo,{data:e,stackOffset:"sign",barGap:0,barCategoryGap:U,onMouseDown:E,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(yh,{formatter:Y=>Y.toFixed(m)+" "+c}),h.jsx(A7,{vertical:v,horizontal:A,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Y3,{x:p,stroke:"orange",strokeWidth:2}),h.jsx(B1,{dataKey:i??a,fontSize:"10px",children:h.jsx(ds,{value:a+(s?" ("+s+")":""),offset:0,position:"bottom"})}),h.jsx(Lh,{domain:[u,d],fontSize:"10px",children:h.jsx(ds,{dx:-15,value:l+(c?" ("+c+")":""),offset:0,angle:-90,position:"center"})}),F,h.jsx(Y3,{y:0,stroke:"#888"}),w>0&&h.jsx(F5,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:j,onMouseEnter:L})]})}),h.jsx(Itr,{symbolSize:k,lineWidth:M,barCategoryGap:U,horizontalGrid:A,verticalGrid:v,changeHorizontalGrid:Y=>{S(Y)},changeVerticalGrid:Y=>{b(Y)},changeLineWidth:Y=>{D(Y)},changeSymbolSize:Y=>{N(Y)},changeBarCategoryGap:Y=>{W(Y)}})]})})})},ztr=ko.div` position: fixed; top: 80px; right: 24px; @@ -9731,7 +9731,7 @@ vr.version="2.29.4";JKo(Dc);vr.fn=nr;vr.min=Fqo;vr.max=Lqo;vr.now=Wqo;vr.utc=f6; justify-content: space-between; align-items: center; cursor: move; -`,ktr=xe.memo(({city:t})=>{const e=H(Qi),n=H(I0)??Lu,o=H(pn),r=H(qN),i=new Date(H(ml)),a=H(bSt),l=dt(t5e),s=dt(jN),c=dt(fPt),u=dt(Ef),d=ye.hasSolarPanels(H.getState().elements),f=In(iJe),p=In(aJe),m=In(lJe),y=H(kc),w=xe.useRef(null),x=g.useRef(null),C=g.useRef(),P=x.current?x.current.clientWidth+40:a?a.width+40:640,A=x.current?x.current.clientHeight+100:a?a.height+100:460,[S,v]=g.useState({x:a?Math.max(a.x,P-window.innerWidth):0,y:a?Math.min(a.y,window.innerHeight-A):0}),[b,T]=g.useState([]),[R,M]=g.useState(0),[D,k]=g.useState(0),[N,U]=g.useState(0),[W,F]=g.useState(0),[E,L]=g.useState(["Heater","AC","Net"]),j=Kt(),Y=_1(t),O=g.useRef([]),_=g.useRef([]),G=g.useRef([]),Q=g.useRef([]);g.useEffect(()=>{s&&oe()},[s]),g.useEffect(()=>{oe()},[c]);const oe=()=>{T([]),M(0),k(0),U(0),F(0),L([])},{sum:ee,sumHeaterMap:q,sumAcMap:ae,sumSolarPanelMap:Z,dataLabels:ne}=N1t(i,Y,d);g.useEffect(()=>{T(ee);let ce=0,Pe=0,pe=0;const Ie=q.size>1;if(q){O.current=[];for(const ze of q.keys()){const Ae=q.get(ze);Ae&&(ce+=Ae,Ie&&O.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j)))}}if(ae){_.current=[];for(const ze of ae.keys()){const Ae=ae.get(ze);Ae&&(Pe+=Ae,Ie&&_.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j)))}}if(Z&&Z.size>0){G.current=[];for(const ze of Z.keys()){const Ae=Z.get(ze);Ae&&(pe+=Ae,Ie&&G.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j)))}}if(q&&ae&&Z){Q.current=[];for(const ze of q.keys()){let Ae=0;const se=q.get(ze),ge=ae.get(ze),we=Z.get(ze);se&&(Ae+=se),ge&&(Ae+=ge),we&&(Ae-=we),Ie&&Q.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j))}}M(ce),k(Pe),U(pe),F(ce+Pe-pe),f(ce),p(Pe),m(pe);const ve=(Object.keys(ee[0]).length-1)/(d?4:3);if(ve>1){const ze=[];let Ae=0;for(let se=0;se{v({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-A)})},[a,P,A]),g.useEffect(()=>{const ce=()=>{v({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-A)})};return window.addEventListener("resize",ce),()=>{window.removeEventListener("resize",ce)}},[a,P,A]),g.useEffect(()=>(x.current&&(C.current||(C.current=new ResizeObserver(()=>{o(ce=>{x.current&&(ce.viewState.dailyBuildingEnergyPanelRect||(ce.viewState.dailyBuildingEnergyPanelRect=new fr(0,0,600,360)),ce.viewState.dailyBuildingEnergyPanelRect.width=x.current.offsetWidth,ce.viewState.dailyBuildingEnergyPanelRect.height=x.current.offsetHeight)})})),C.current.observe(x.current)),()=>{var ce;(ce=C.current)==null||ce.disconnect()}),[]);const te=(ce,Pe)=>{v({x:Math.max(Pe.x,P-window.innerWidth),y:Math.min(Pe.y,window.innerHeight-A)})},$=(ce,Pe)=>{o(pe=>{pe.viewState.dailyBuildingEnergyPanelRect||(pe.viewState.dailyBuildingEnergyPanelRect=new fr(0,0,600,360)),pe.viewState.dailyBuildingEnergyPanelRect.x=Math.max(Pe.x,P-window.innerWidth),pe.viewState.dailyBuildingEnergyPanelRect.y=Math.min(Pe.y,window.innerHeight-A)})},le=()=>{o(ce=>{ce.viewState.showDailyBuildingEnergyPanel=!1,e&&(ce.actionInfo={name:"Close Daily Building Energy Graph",timestamp:new Date().getTime()})})},de=B.t("word.Hour",j),he=B.t("word.Energy",j),me=b&&b[0]?Object.keys(b[0]).length===0:!0;return h.jsx(Vi,{nodeRef:w,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:te,onStop:$,onMouseDown:()=>{o(ce=>{ce.selectedFloatingWindow="dailyBuildingEnergyPanel"})},children:h.jsx(ztr,{ref:w,style:{zIndex:y==="dailyBuildingEnergyPanel"?Ec:9},children:h.jsxs(Dtr,{ref:x,style:{opacity:n,width:(a?a.width:600)+"px",height:(a?a.height:360)+"px"},children:[h.jsxs(Etr,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[B.t("buildingEnergyPanel.DailyBuildingEnergy",j)+": ",h.jsx("span",{style:{fontSize:"10px"},children:B.t("sensorPanel.WeatherDataFrom",j)+" "+t+" | "+vr(i).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{le()},onMouseDown:()=>{le()},children:`${B.t("word.Close",j)}`})]}),h.jsx(U1t,{type:bi.DailyBuildingEnergy,dataSource:b,hasSolarPanels:d,labels:E,height:100,dataKeyAxisX:"Hour",labelX:de,labelY:he,unitY:B.t("word.kWh",j),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:i.getHours()}),!u&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[O.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)}):h.jsx(zl,{content:O.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)})}),_.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.AC",j)+": "+D.toFixed(1)}):h.jsx(zl,{content:_.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.AC",j)+": "+D.toFixed(1)})}),N!==0&&h.jsx(h.Fragment,{children:G.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)}):h.jsx(zl,{content:G.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)})})}),Q.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)}):h.jsx(zl,{content:Q.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)})}),h.jsx(oo,{type:"default",icon:me?h.jsx(Bh,{}):h.jsx(Lf,{}),title:B.t(me?"word.Run":"word.Update",j),onClick:()=>{const ce=H.getState().elements,Pe=H.getState().countElementsByType,pe=H.getState().getChildrenOfType,Ie=jJ(ce,Pe,pe);if(Ie.status===Xg.NO_BUILDING){yn(B.t("analysisManager.NoBuildingForAnalysis",j));return}if(Ie.status===Xg.AT_LEAST_ONE_BAD_NO_GOOD){let ve;switch(Ie.buildingCompletion){case $c.WALL_DISJOINED:ve=B.t("message.WallsAreNotConnected",j);break;case $c.WALL_EMPTY:ve=B.t("message.BuildingContainsEmptyWall",j);break;case $c.ROOF_MISSING:ve=B.t("message.BuildingRoofMissing",j);break;default:ve=B.t("message.UnknownErrors",j)}co(B.t("message.SimulationWillNotStartDueToErrors",j)+": "+ve);return}Ie.status===Xg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&RH(B.t("message.SimulationWillStartDespiteWarnings",j)),yn(B.t("message.SimulationStarted",j)),setTimeout(()=>{r(),dt.getState().set(ve=>{ve.runDailyThermalSimulation=!0,ve.pauseDailyThermalSimulation=!1,ve.simulationInProgress=!0}),o(ve=>{e&&(ve.actionInfo={name:"Run Daily Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:B.t("word.SaveAsImage",j),onClick:()=>{Yd("line-graph-"+de+"-"+he,"daily-building-energy").then(()=>{yn(B.t("message.ScreenshotSaved",j)),e&&o(ce=>{ce.actionInfo={name:"Take Screenshot of Daily Building Energy Graph",timestamp:new Date().getTime()}})})}}),b&&b.length>0&&h.jsx(oo,{type:"default",icon:h.jsx(Wf,{}),title:B.t("word.SaveAsCsv",j),onClick:()=>{Yh(b,"daily-building-energy.csv"),yn(B.t("message.CsvFileSaved",j)),e&&o(ce=>{ce.actionInfo={name:"Export Daily Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Ftr=ko.div` +`,ktr=xe.memo(({city:t})=>{const e=H(Qi),n=H(I0)??Lu,o=H(pn),r=H(qN),i=new Date(H(ml)),a=H(bSt),l=dt(t5e),s=dt(jN),c=dt(fPt),u=dt(Ef),d=ye.hasSolarPanels(H.getState().elements),f=In(iJe),p=In(aJe),m=In(lJe),y=H(kc),w=xe.useRef(null),x=g.useRef(null),C=g.useRef(),P=x.current?x.current.clientWidth+40:a?a.width+40:640,A=x.current?x.current.clientHeight+100:a?a.height+100:460,[S,v]=g.useState({x:a?Math.max(a.x,P-window.innerWidth):0,y:a?Math.min(a.y,window.innerHeight-A):0}),[b,T]=g.useState([]),[R,M]=g.useState(0),[D,k]=g.useState(0),[N,U]=g.useState(0),[W,F]=g.useState(0),[E,L]=g.useState(["Heater","AC","Net"]),j=Kt(),Y=_1(t),O=g.useRef([]),_=g.useRef([]),G=g.useRef([]),Q=g.useRef([]);g.useEffect(()=>{s&&oe()},[s]),g.useEffect(()=>{oe()},[c]);const oe=()=>{T([]),M(0),k(0),U(0),F(0),L([])},{sum:ee,sumHeaterMap:$,sumAcMap:ae,sumSolarPanelMap:Z,dataLabels:ne}=N1t(i,Y,d);g.useEffect(()=>{T(ee);let ce=0,Pe=0,pe=0;const Ie=$.size>1;if($){O.current=[];for(const ze of $.keys()){const Ae=$.get(ze);Ae&&(ce+=Ae,Ie&&O.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j)))}}if(ae){_.current=[];for(const ze of ae.keys()){const Ae=ae.get(ze);Ae&&(Pe+=Ae,Ie&&_.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j)))}}if(Z&&Z.size>0){G.current=[];for(const ze of Z.keys()){const Ae=Z.get(ze);Ae&&(pe+=Ae,Ie&&G.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j)))}}if($&&ae&&Z){Q.current=[];for(const ze of $.keys()){let Ae=0;const se=$.get(ze),ge=ae.get(ze),we=Z.get(ze);se&&(Ae+=se),ge&&(Ae+=ge),we&&(Ae-=we),Ie&&Q.current.push(ze+": "+Ae.toFixed(2)+" "+B.t("word.kWh",j))}}M(ce),k(Pe),U(pe),F(ce+Pe-pe),f(ce),p(Pe),m(pe);const ve=(Object.keys(ee[0]).length-1)/(d?4:3);if(ve>1){const ze=[];let Ae=0;for(let se=0;se{v({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-A)})},[a,P,A]),g.useEffect(()=>{const ce=()=>{v({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-A)})};return window.addEventListener("resize",ce),()=>{window.removeEventListener("resize",ce)}},[a,P,A]),g.useEffect(()=>(x.current&&(C.current||(C.current=new ResizeObserver(()=>{o(ce=>{x.current&&(ce.viewState.dailyBuildingEnergyPanelRect||(ce.viewState.dailyBuildingEnergyPanelRect=new fr(0,0,600,360)),ce.viewState.dailyBuildingEnergyPanelRect.width=x.current.offsetWidth,ce.viewState.dailyBuildingEnergyPanelRect.height=x.current.offsetHeight)})})),C.current.observe(x.current)),()=>{var ce;(ce=C.current)==null||ce.disconnect()}),[]);const te=(ce,Pe)=>{v({x:Math.max(Pe.x,P-window.innerWidth),y:Math.min(Pe.y,window.innerHeight-A)})},q=(ce,Pe)=>{o(pe=>{pe.viewState.dailyBuildingEnergyPanelRect||(pe.viewState.dailyBuildingEnergyPanelRect=new fr(0,0,600,360)),pe.viewState.dailyBuildingEnergyPanelRect.x=Math.max(Pe.x,P-window.innerWidth),pe.viewState.dailyBuildingEnergyPanelRect.y=Math.min(Pe.y,window.innerHeight-A)})},le=()=>{o(ce=>{ce.viewState.showDailyBuildingEnergyPanel=!1,e&&(ce.actionInfo={name:"Close Daily Building Energy Graph",timestamp:new Date().getTime()})})},de=B.t("word.Hour",j),he=B.t("word.Energy",j),me=b&&b[0]?Object.keys(b[0]).length===0:!0;return h.jsx(Vi,{nodeRef:w,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:te,onStop:q,onMouseDown:()=>{o(ce=>{ce.selectedFloatingWindow="dailyBuildingEnergyPanel"})},children:h.jsx(ztr,{ref:w,style:{zIndex:y==="dailyBuildingEnergyPanel"?Ec:9},children:h.jsxs(Dtr,{ref:x,style:{opacity:n,width:(a?a.width:600)+"px",height:(a?a.height:360)+"px"},children:[h.jsxs(Etr,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[B.t("buildingEnergyPanel.DailyBuildingEnergy",j)+": ",h.jsx("span",{style:{fontSize:"10px"},children:B.t("sensorPanel.WeatherDataFrom",j)+" "+t+" | "+vr(i).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{le()},onMouseDown:()=>{le()},children:`${B.t("word.Close",j)}`})]}),h.jsx(U1t,{type:bi.DailyBuildingEnergy,dataSource:b,hasSolarPanels:d,labels:E,height:100,dataKeyAxisX:"Hour",labelX:de,labelY:he,unitY:B.t("word.kWh",j),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:i.getHours()}),!u&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[O.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)}):h.jsx(zl,{content:O.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)})}),_.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.AC",j)+": "+D.toFixed(1)}):h.jsx(zl,{content:_.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.AC",j)+": "+D.toFixed(1)})}),N!==0&&h.jsx(h.Fragment,{children:G.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)}):h.jsx(zl,{content:G.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)})})}),Q.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)}):h.jsx(zl,{content:Q.current.map((ce,Pe)=>h.jsx("div",{children:ce},Pe)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)})}),h.jsx(oo,{type:"default",icon:me?h.jsx(Bh,{}):h.jsx(Lf,{}),title:B.t(me?"word.Run":"word.Update",j),onClick:()=>{const ce=H.getState().elements,Pe=H.getState().countElementsByType,pe=H.getState().getChildrenOfType,Ie=jJ(ce,Pe,pe);if(Ie.status===Xg.NO_BUILDING){yn(B.t("analysisManager.NoBuildingForAnalysis",j));return}if(Ie.status===Xg.AT_LEAST_ONE_BAD_NO_GOOD){let ve;switch(Ie.buildingCompletion){case $c.WALL_DISJOINED:ve=B.t("message.WallsAreNotConnected",j);break;case $c.WALL_EMPTY:ve=B.t("message.BuildingContainsEmptyWall",j);break;case $c.ROOF_MISSING:ve=B.t("message.BuildingRoofMissing",j);break;default:ve=B.t("message.UnknownErrors",j)}co(B.t("message.SimulationWillNotStartDueToErrors",j)+": "+ve);return}Ie.status===Xg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&RH(B.t("message.SimulationWillStartDespiteWarnings",j)),yn(B.t("message.SimulationStarted",j)),setTimeout(()=>{r(),dt.getState().set(ve=>{ve.runDailyThermalSimulation=!0,ve.pauseDailyThermalSimulation=!1,ve.simulationInProgress=!0}),o(ve=>{e&&(ve.actionInfo={name:"Run Daily Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:B.t("word.SaveAsImage",j),onClick:()=>{Yd("line-graph-"+de+"-"+he,"daily-building-energy").then(()=>{yn(B.t("message.ScreenshotSaved",j)),e&&o(ce=>{ce.actionInfo={name:"Take Screenshot of Daily Building Energy Graph",timestamp:new Date().getTime()}})})}}),b&&b.length>0&&h.jsx(oo,{type:"default",icon:h.jsx(Wf,{}),title:B.t("word.SaveAsCsv",j),onClick:()=>{Yh(b,"daily-building-energy.csv"),yn(B.t("message.CsvFileSaved",j)),e&&o(ce=>{ce.actionInfo={name:"Export Daily Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Ftr=ko.div` position: fixed; top: 80px; right: 24px; @@ -9769,12 +9769,12 @@ vr.version="2.29.4";JKo(Dc);vr.fn=nr;vr.min=Fqo;vr.max=Lqo;vr.now=Wqo;vr.utc=f6; justify-content: space-between; align-items: center; cursor: move; -`,Ntr=xe.memo(({city:t})=>{const e=H.getState().world,n=H(Qi),o=H(I0)??Lu,r=H(pn),i=H(qN),a=new Date(H(ml)),l=H(TSt),s=dt(t5e),c=dt(dQ),u=dt(hPt),d=dt(Ef),f=ye.hasSolarPanels(H.getState().elements),p=In(iJe),m=In(aJe),y=In(lJe),w=H(kc),x=g.useRef(null),C=g.useRef(),P=x.current?x.current.clientWidth+40:l?l.width+40:640,A=x.current?x.current.clientHeight+100:l?l.height+100:600,[S,v]=g.useState({x:l?Math.max(l.x,P-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-A):0}),b=xe.useRef(null),T=Kt(),R=_1(t),M=Bs[a.getMonth()],D=e.daysPerYear??6,k=12/D,[N,U]=g.useState(0),[W,F]=g.useState(0),[E,L]=g.useState(0),[j,Y]=g.useState(0),[O,_]=g.useState(["Heater","AC","Solar","Net"]),[G,Q]=g.useState([]),{sum:oe,sumHeaterMap:ee,sumAcMap:q,sumSolarPanelMap:ae,dataLabels:Z}=N1t(a,R,f),ne=g.useRef(new Array(D).fill({})),te=g.useRef(new Array(D).fill(0)),$=g.useRef(new Array(D).fill(0)),le=g.useRef(new Array(D).fill(0)),de=g.useRef(new Array(D).fill(0)),he=g.useRef([]),me=g.useRef([]),ce=g.useRef([]),Pe=g.useRef([]);g.useEffect(()=>{pe()},[D,u]),g.useEffect(()=>{c&&pe()},[c]);const pe=()=>{ne.current=new Array(D).fill({}),te.current=new Array(D).fill(0),$.current=new Array(D).fill(0),le.current=new Array(D).fill(0),de.current=new Array(D).fill(0),Q([]),U(0),F(0),L(0),Y(0),_([])};g.useEffect(()=>{const we=Math.floor(a.getMonth()/k),Se=(Object.keys(oe[0]).length-1)/(f?4:3);if(he.current=[],me.current=[],Pe.current=[],ce.current=[],Se>1){const Ue=new Map,qe=new Map,Fe=new Map,He=new Map;for(const Oe of oe){let ut=0;for(let ht=0;ht6&&(He=" "+Oe.substring(6).trim());break}const Le="Heater"+He,Ye="AC"+He,lt="Net"+He;if(f){const Oe="Solar"+He;let ut=0;_([Le,Ye,Oe,lt]);for(const Qe of oe)Ue+=Qe[Le],qe+=Qe[Ye],ut+=Qe[Oe],Fe+=Qe[lt];const ht={};ht.Month=Bs[a.getMonth()],ht[Le]=30*Ue,ht[Ye]=30*qe,ht[Oe]=30*ut,ht[lt]=30*Fe,ne.current[we]=ht}else{_([Le,Ye,lt]);for(const ut of oe)Ue+=ut[Le],qe+=ut[Ye],Fe+=ut[lt];const Oe={};Oe.Month=Bs[a.getMonth()],Oe[Le]=30*Ue,Oe[Ye]=30*qe,Oe[lt]=30*Fe,ne.current[we]=Oe}}Q([...ne.current]);let Me=0;if(ee)for(const Ue of ee.keys())Me+=ee.get(Ue)??0;let Ce=0;if(q)for(const Ue of q.keys())Ce+=q.get(Ue)??0;let Te=0;if(ae&&f)for(const Ue of ae.keys())Te+=ae.get(Ue)??0;te.current[we]=Me*k*30,$.current[we]=Ce*k*30,le.current[we]=Te*k*30,de.current[we]=te.current[we]+$.current[we]-le.current[we];const Re=te.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0);U(Re);const Ne=$.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0);F(Ne);const _e=le.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0);L(_e),Y(de.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0)),p(Re),m(Ne),y(_e),dt.getState().showSolarRadiationHeatmap||In.getState().clearDataStore()},[s]),g.useEffect(()=>{v({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-A)})},[l,P,A]),g.useEffect(()=>{const we=()=>{v({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-A)})};return window.addEventListener("resize",we),()=>{window.removeEventListener("resize",we)}},[l,P,A]),g.useEffect(()=>(x.current&&(C.current||(C.current=new ResizeObserver(()=>{r(we=>{x.current&&(we.viewState.yearlyBuildingEnergyPanelRect||(we.viewState.yearlyBuildingEnergyPanelRect=new fr(0,0,600,500)),we.viewState.yearlyBuildingEnergyPanelRect.width=x.current.offsetWidth,we.viewState.yearlyBuildingEnergyPanelRect.height=x.current.offsetHeight)})})),C.current.observe(x.current)),()=>{var we;(we=C.current)==null||we.disconnect()}),[]);const Ie=(we,Se)=>{v({x:Math.max(Se.x,P-window.innerWidth),y:Math.min(Se.y,window.innerHeight-A)})},ve=(we,Se)=>{r(Me=>{Me.viewState.yearlyBuildingEnergyPanelRect||(Me.viewState.yearlyBuildingEnergyPanelRect=new fr(0,0,600,360)),Me.viewState.yearlyBuildingEnergyPanelRect.x=Math.max(Se.x,P-window.innerWidth),Me.viewState.yearlyBuildingEnergyPanelRect.y=Math.min(Se.y,window.innerHeight-A)})},ze=()=>{r(we=>{we.viewState.showYearlyBuildingEnergyPanel=!1,n&&(we.actionInfo={name:"Close Yearly Building Energy Graph",timestamp:new Date().getTime()})})},Ae=B.t("word.Month",T),se=B.t("word.Energy",T),ge=G&&G[0]?Object.keys(G[0]).length===0:!0;return h.jsx(Vi,{nodeRef:b,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:Ie,onStop:ve,onMouseDown:()=>{r(we=>{we.selectedFloatingWindow="yearlyBuildingEnergyPanel"})},children:h.jsx(Ftr,{ref:b,style:{zIndex:w==="yearlyBuildingEnergyPanel"?Ec:9},children:h.jsxs(Ltr,{ref:x,style:{opacity:o,width:(l?l.width:600)+"px",height:(l?l.height:400)+"px"},children:[h.jsxs(Wtr,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[B.t("buildingEnergyPanel.YearlyBuildingEnergy",T)+": ",h.jsx("span",{style:{fontSize:"10px"},children:B.t("sensorPanel.WeatherDataFrom",T)+" "+t+" | "+a.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{ze()},onMouseDown:()=>{ze()},children:`${B.t("word.Close",T)}`})]}),h.jsx(U1t,{type:bi.YearlyBuildingEnergy,dataSource:G,hasSolarPanels:f,labels:O,height:100,dataKeyAxisX:"Month",labelX:Ae,labelY:se,unitY:B.t("word.kWh",T),yMin:0,curveType:"linear",fractionDigits:2,referenceX:M}),!d&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[he.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Heater",T)+": "+N.toFixed(0)}):h.jsx(zl,{content:he.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Heater",T)+": "+N.toFixed(0)})}),me.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.AC",T)+": "+W.toFixed(0)}):h.jsx(zl,{content:me.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.AC",T)+": "+W.toFixed(0)})}),E!==0&&h.jsx(h.Fragment,{children:ce.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.SolarPanel",T)+": "+E.toFixed(0)}):h.jsx(zl,{content:ce.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.SolarPanel",T)+": "+E.toFixed(0)})})}),Pe.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Net",T)+": "+j.toFixed(0)}):h.jsx(zl,{content:Pe.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Net",T)+": "+j.toFixed(0)})}),h.jsx(oo,{type:"default",icon:ge?h.jsx(Bh,{}):h.jsx(Lf,{}),title:B.t(ge?"word.Run":"word.Update",T),onClick:()=>{const we=H.getState().elements,Se=H.getState().countElementsByType,Me=H.getState().getChildrenOfType,Ce=jJ(we,Se,Me);if(Ce.status===Xg.NO_BUILDING){yn(B.t("analysisManager.NoBuildingForAnalysis",T));return}if(Ce.status===Xg.AT_LEAST_ONE_BAD_NO_GOOD){let Te;switch(Ce.buildingCompletion){case $c.WALL_DISJOINED:Te=B.t("message.WallsAreNotConnected",T);break;case $c.WALL_EMPTY:Te=B.t("message.BuildingContainsEmptyWall",T);break;case $c.ROOF_MISSING:Te=B.t("message.BuildingRoofMissing",T);break;default:Te=B.t("message.UnknownErrors",T)}co(B.t("message.SimulationWillNotStartDueToErrors",T)+": "+Te);return}Ce.status===Xg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&RH(B.t("message.SimulationWillStartDespiteWarnings",T)),yn(B.t("message.SimulationStarted",T)),setTimeout(()=>{i(),dt.getState().set(Te=>{Te.runYearlyThermalSimulation=!0,Te.pauseYearlyThermalSimulation=!1,Te.simulationInProgress=!0}),r(Te=>{n&&(Te.actionInfo={name:"Run Yearly Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:B.t("word.SaveAsImage",T),onClick:()=>{Yd("line-graph-"+Ae+"-"+se,"yearly-building-energy").then(()=>{yn(B.t("message.ScreenshotSaved",T)),n&&r(we=>{we.actionInfo={name:"Take Screenshot of Yearly Building Energy Graph",timestamp:new Date().getTime()}})})}}),ne.current&&ne.current.length>0&&h.jsx(oo,{type:"default",icon:h.jsx(Wf,{}),title:B.t("word.SaveAsCsv",T),onClick:()=>{Yh(ne.current,"yearly-building-energy.csv"),yn(B.t("message.CsvFileSaved",T)),n&&r(we=>{we.actionInfo={name:"Export Yearly Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Utr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(Fn),o=H(yTt),r=H(ATt),[i,a]=g.useState(!1),[l,s]=g.useState(!1),[c,u]=g.useState({left:0,top:0,bottom:0,right:0}),d=g.useRef(null),f=g.useRef(null),p=g.useRef(o),m=g.useRef(r),y=Kt();g.useEffect(()=>{var v;(v=f.current)==null||v.focus()},[]);const w=(v,b)=>{if(d.current){const{clientWidth:T,clientHeight:R}=window.document.documentElement,M=d.current.getBoundingClientRect();u({left:-M.left+b.x,right:T-(M.right-b.x),top:-M.top+b.y,bottom:R-((M==null?void 0:M.bottom)-b.y)})}},x=v=>{e(b=>{b.minimumNavigationMoveSpeed=v}),dt.getState().set(b=>{b.navigationMoveSpeed=v})},C=v=>{e(b=>{b.minimumNavigationTurnSpeed=v}),dt.getState().set(b=>{b.navigationTurnSpeed=v})},P=()=>{const v=o,b=p.current;if(v!==b){const M={name:"Minimum Navigation Move Speed",timestamp:Date.now(),oldValue:v,newValue:b,undo:()=>{x(M.oldValue)},redo:()=>{x(M.newValue)}};n(M),x(b)}const T=r,R=m.current;if(T!==R){const M={name:"Minimum Navigation Turn Speed",timestamp:Date.now(),oldValue:T,newValue:R,undo:()=>{C(M.oldValue)},redo:()=>{C(M.newValue)}};n(M),C(R)}},A=()=>{t(!1)},S=()=>{P(),t(!1)};return h.jsxs(li,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:`${B.t("navigationPanel.NavigationParameters",y)}`}),footer:[h.jsx(oo,{onClick:A,children:`${B.t("word.Cancel",y)}`},"Cancel"),h.jsx(oo,{type:"primary",ref:f,onClick:S,children:`${B.t("word.OK",y)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:v=>h.jsx(Vi,{disabled:!l,bounds:c,onStart:(b,T)=>w(b,T),children:h.jsx("div",{ref:d,children:v})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("navigationPanel.MinimumMoveSpeed",y)+" ([1, 10]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:10,style:{width:"100%"},precision:0,value:p.current,step:1,onChange:v=>{p.current=Number(v),a(!i)},onBlur:v=>{const b=v.target.value,T=parseFloat(b);p.current=Number.isNaN(T)?3:T,a(!i)},onPressEnter:v=>{const b=v.target.value,T=parseFloat(b);p.current=Number.isNaN(T)?3:T,a(!i)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("navigationPanel.MinimumTurnSpeed",y)+" ([1, 5]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:5,style:{width:"100%"},precision:0,value:m.current,step:1,onChange:v=>{m.current=Number(v),a(!i)},onBlur:v=>{const b=v.target.value,T=parseFloat(b);m.current=Number.isNaN(T)?3:T,a(!i)},onPressEnter:v=>{const b=v.target.value,T=parseFloat(b);m.current=Number.isNaN(T)?3:T,a(!i)}})})]})]})}),jtr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(Fn),o=H(aQ),r=ye.getShadowMapSize(),i=4096,a=1e4,[l,s]=g.useState(!1),[c,u]=g.useState(!1),[d,f]=g.useState({left:0,top:0,bottom:0,right:0}),p=g.useRef(null),m=g.useRef(null),y=g.useRef(o?Math.round(o)/a:1),w=g.useRef(r?Math.round(r/i):1),x=Kt();g.useEffect(()=>{var T;(T=m.current)==null||T.focus()},[]);const C=(T,R)=>{if(p.current){const{clientWidth:M,clientHeight:D}=window.document.documentElement,k=p.current.getBoundingClientRect();f({left:-k.left+R.x,right:M-(k.right-R.x),top:-k.top+R.y,bottom:D-((k==null?void 0:k.bottom)-R.y)})}},P=T=>{e(R=>{R.viewState.shadowCameraFar=T})},A=T=>{localStorage.setItem("aladdin-shadow-map-size",T.toString())},S=()=>{const T=o,R=y.current*a;if(T!==R){const k={name:"Shadow Camera Far Distance",timestamp:Date.now(),oldValue:T,newValue:R,undo:()=>{P(k.oldValue)},redo:()=>{P(k.newValue)}};n(k),P(R)}const M=r,D=w.current*i;if(M!==D){const k={name:"Shadow Map Size",timestamp:Date.now(),oldValue:M,newValue:D,undo:()=>{A(k.oldValue)},redo:()=>{A(k.newValue)}};n(k),A(D)}},v=()=>{t(!1)},b=()=>{S(),t(!1),window.location.reload()};return h.jsxs(li,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>u(!0),onMouseOut:()=>u(!1),children:`${B.t("shadowSettingsPanel.ShadowSettings",x)}`}),footer:[h.jsx(oo,{onClick:v,children:`${B.t("word.Cancel",x)}`},"Cancel"),h.jsx(oo,{type:"primary",ref:m,onClick:b,children:`${B.t("word.OK",x)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:T=>h.jsx(Vi,{disabled:!c,bounds:d,onStart:(R,M)=>C(R,M),children:h.jsx("div",{ref:p,children:T})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:18,children:B.t("shadowSettingsPanel.ShadowCameraFarDistance",x)+" ([1, 1000]×"+a+"): "}),h.jsx(Ge,{span:6,children:h.jsx(mn,{min:1,max:1e3,style:{width:"100%"},precision:0,value:y.current,step:1,onChange:T=>{y.current=Number(T),s(!l)},onBlur:T=>{const R=T.target.value,M=parseFloat(R);y.current=Number.isNaN(M)?1:M,s(!l)},onPressEnter:T=>{const R=T.target.value,M=parseFloat(R);y.current=Number.isNaN(M)?1:M,s(!l)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"10px"},children:[h.jsx(Ge,{span:18,children:B.t("shadowSettingsPanel.ShadowMapSize",x)+" ([1, 4]×"+i+"): "}),h.jsx(Ge,{span:6,children:h.jsx(mn,{min:1,max:4,style:{width:"100%"},precision:0,value:w.current,step:1,onChange:T=>{w.current=Number(T),s(!l)},onBlur:T=>{const R=T.target.value,M=parseFloat(R);w.current=Number.isNaN(M)?1:M,s(!l)},onPressEnter:T=>{const R=T.target.value,M=parseFloat(R);w.current=Number.isNaN(M)?1:M,s(!l)}})})]}),h.jsx(Qt,{style:{fontSize:"10px"},children:h.jsxs(Ge,{span:24,children:[B.t("shadowSettingsPanel.Notes",x),":",h.jsx("br",{}),h.jsxs("ul",{children:[h.jsx("li",{children:B.t("shadowSettingsPanel.RefreshPageNote",x)}),h.jsx("li",{children:B.t("shadowSettingsPanel.MapSizeWarning",x)})]})]})})]})}),{Option:UE}=Ko,Btr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(i5e),o=H(Fn),r=H(Qi),i=H(jM),a=H(BM),l=H(zTt),[s,c]=g.useState(!1),[u,d]=g.useState(!1),[f,p]=g.useState({left:0,top:0,bottom:0,right:0}),m=g.useRef(null),y=g.useRef("Unknown"),w=g.useRef("Unknown"),x=g.useRef("Monocrystalline"),C=g.useRef(12),P=g.useRef(8),A=g.useRef("Black"),S=g.useRef(1),v=g.useRef(1.5),b=g.useRef(0),T=g.useRef(.2),R=g.useRef(45),M=g.useRef(300),D=g.useRef(-.002),k=g.useRef(.005),N=g.useRef(30),U=g.useRef(30),W=g.useRef(10),F=g.useRef(40),E=g.useRef(15),L=Kt();g.useEffect(()=>{const te=document.getElementsByClassName("ant-modal-wrap");if(te)for(const $ of te)$.style["pointer-events"]="none"},[]);const j=(te,$)=>{if(m.current){const{clientWidth:le,clientHeight:de}=window.document.documentElement,he=m.current.getBoundingClientRect();p({left:-he.left+$.x,right:le-(he.right-$.x),top:-he.top+$.y,bottom:de-((he==null?void 0:he.bottom)-$.y)})}},Y=g.useMemo(()=>{const te=[];for(const $ in a)te.push($);return te},[a]),O=()=>({name:y.current.trim(),brand:w.current.trim(),cellType:x.current,efficiency:T.current,length:v.current,nominalLength:v.current,width:S.current,nominalWidth:S.current,thickness:k.current,m:C.current,n:P.current,pmax:M.current,vmpp:U.current,impp:W.current,voc:F.current,isc:E.current,pmaxTC:D.current,noct:R.current,weight:N.current,color:A.current,shadeTolerance:i8.PARTIAL,bifacialityFactor:b.current}),_=te=>{y.current=te.name,w.current=te.brand,x.current=te.cellType,T.current=te.efficiency,v.current=te.length,S.current=te.width,k.current=te.thickness,C.current=te.m,P.current=te.n,M.current=te.pmax,U.current=te.vmpp,W.current=te.impp,F.current=te.voc,E.current=te.isc,D.current=te.pmaxTC,R.current=te.noct,N.current=te.weight,A.current=te.color,b.current=te.bifacialityFactor},G=()=>{if(y.current.trim()===""){li.info({title:B.t("pvModelPanel.CannotAddCustomSolarPanel",L),content:B.t("pvModelPanel.CustomSolarPanelMustHaveModelName",L)+"."});return}if(i[y.current.trim()]){li.info({title:B.t("pvModelPanel.NoNeedToAddThisCustomSolarPanel",L),content:B.t("pvModelPanel.SolarPanelModelAlreadyProvidedBySystem",L)+" ("+y.current+")."});return}if(Y.includes(y.current))li.info({title:B.t("pvModelPanel.CannotAddCustomSolarPanel",L),content:B.t("pvModelPanel.CustomSolarPanelExists",L)+': "'+y.current+'"'});else{const te=O(),$={name:"Add Custom Solar Panel",timestamp:Date.now(),pvModel:te,undo:()=>{ee(y.current.trim())},redo:()=>{l(te)}};o($),l(te)}},Q=te=>{try{const $=JSON.parse(te);if(!$.cellType||!$.pmax){co(B.t("pvModelPanel.FailInImportingDataFromClipboard",L));return}_($),c(le=>!le)}catch($){co(B.t("pvModelPanel.FailInImportingDataFromClipboard",L)+":"+$)}},oe=()=>{li.confirm({title:B.t("pvModelPanel.DoYouReallyWantToImportCustomSolarPanel",L)+"?",content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(a7,{style:{marginRight:"6px"}}),B.t("word.Warning",L)+": "+B.t("pvModelPanel.ExistingSettingsWillBeOverwritten",L)+"."]}),icon:h.jsx(t4,{}),onOk:()=>{navigator.clipboard.readText().then(te=>{const $={name:"Import Custom Solar Panel",timestamp:Date.now(),pvModel:O(),info:te,undo:()=>{_($.pvModel),c(le=>!le)},redo:()=>{$.info&&Q($.info)}};o($),Q(te)}).catch(te=>{co(B.t("pvModelPanel.FailInImportingDataFromClipboard",L)+":"+te)})}})},ee=te=>{e($=>{delete $.customPvModules[te]})},q=te=>{e($=>{let le=!1;for(const de of $.elements)if(de.type===z.SolarPanel&&de.pvModelName===te){le=!0;break}if(le)co(B.t("pvModelPanel.ThisCustomSolarPanelIsUsed",{lng:$.language}));else{const de={...$.customPvModules[te]},he={name:"Remove Custom Solar Panel",timestamp:Date.now(),pvModel:de,undo:()=>{l(de)},redo:()=>{ee(te)}};o(he),delete $.customPvModules[te]}})},ae=te=>{li.confirm({title:B.t("pvModelPanel.DoYouReallyWantToRemoveThisCustomSolarPanel",L)+' "'+te+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(a7,{style:{marginRight:"6px"}}),B.t("word.Warning",L)+": "+B.t("pvModelPanel.MakeSureThisCustomSolarPanelIsNotUsed",L)+"."]}),icon:h.jsx(t4,{}),onOk:()=>{q(te)}})},Z=[{key:"1",label:B.t("pvModelPanel.General",L),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.Model",L)+": "}),h.jsx(Ge,{span:10,children:h.jsx(Vl,{style:{width:"100%"},value:y.current,onChange:te=>{y.current=te.target.value,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.BrandName",L)+": "}),h.jsx(Ge,{span:10,children:h.jsx(Vl,{style:{width:"100%"},value:w.current,onChange:te=>{w.current=te.target.value,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.CellType",L)+":"}),h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"100%"},value:x.current,onChange:te=>{x.current=te,c(!s)},children:[h.jsx(UE,{value:"Monocrystalline",children:B.t("pvModelPanel.Monocrystalline",L)},"Monocrystalline"),h.jsx(UE,{value:"Polycrystalline",children:B.t("pvModelPanel.Polycrystalline",L)},"Polycrystalline"),h.jsx(UE,{value:"Thin Film",children:B.t("pvModelPanel.ThinFilm",L)},"Thin Film")]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Length",L)+" ([0.1, 3]"+B.t("word.MeterAbbreviation",L)+"): "}),h.jsx(Ge,{span:10,children:h.jsx(mn,{min:.1,max:3,style:{width:"100%"},precision:3,value:v.current,step:.01,onChange:te=>{te!==null&&(v.current=te,c(!s))},onBlur:te=>{const $=parseFloat(te.target.value);v.current=Number.isNaN($)?1:$,c(!s)},onPressEnter:te=>{const $=parseFloat(te.target.value);v.current=Number.isNaN($)?1:$,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Width",L)+" ([0.1, 3]"+B.t("word.MeterAbbreviation",L)+"): "}),h.jsx(Ge,{span:10,children:h.jsx(mn,{min:.1,max:3,style:{width:"100%"},precision:3,value:S.current,step:.01,onChange:te=>{te!==null&&(S.current=te,c(!s))},onBlur:te=>{const $=parseFloat(te.target.value);S.current=Number.isNaN($)?1:$,c(!s)},onPressEnter:te=>{const $=parseFloat(te.target.value);S.current=Number.isNaN($)?1:$,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.PowerBifaciality",L)+" ([0, 1]):"}),h.jsx(Ge,{span:10,children:h.jsx(mn,{style:{width:"100%"},precision:2,step:.01,value:b.current,onChange:te=>{te!==null&&(b.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.Weight",L)+" ("+B.t("pvModelPanel.Kilogram",L)+"):"}),h.jsx(Ge,{span:10,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:N.current,onChange:te=>{te!==null&&(N.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Thickness",L)+" ("+B.t("word.MeterAbbreviation",L)+"):"}),h.jsx(Ge,{span:10,children:h.jsx(mn,{style:{width:"100%"},precision:4,step:1e-4,value:k.current,onChange:te=>{te!==null&&(k.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Color",L)+":"}),h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"100%"},value:A.current,onChange:te=>{A.current=te,c(!s)},children:[h.jsx(UE,{value:"Black",children:B.t("pvModelPanel.Black",L)},"Black"),h.jsx(UE,{value:"Blue",children:B.t("pvModelPanel.Blue",L)},"Blue")]})})]})]})},{key:"2",label:B.t("pvModelPanel.Electrical",L),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.SolarCellEfficiency",L)+" (%):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:100*T.current,onChange:te=>{te!==null&&(T.current=te*.01,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.CellCountInXDirection",L)+": "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:36,style:{width:"100%"},precision:0,value:C.current,step:1,onChange:te=>{te!==null&&(C.current=te,c(!s))},onBlur:te=>{const $=parseFloat(te.target.value);C.current=Number.isNaN($)?1:$,c(!s)},onPressEnter:te=>{const $=parseFloat(te.target.value);C.current=Number.isNaN($)?1:$,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.CellCountInYDirection",L)+": "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:36,style:{width:"100%"},precision:0,value:P.current,step:1,onChange:te=>{te!==null&&(P.current=te,c(!s))},onBlur:te=>{const $=parseFloat(te.target.value);P.current=Number.isNaN($)?1:$,c(!s)},onPressEnter:te=>{const $=parseFloat(te.target.value);P.current=Number.isNaN($)?1:$,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.MaximumRatedPower",L)+" Pmax ("+B.t("word.WattAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:1,value:M.current,onChange:te=>{te!==null&&(M.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.TemperatureCoefficientOfPmax",L)+" (%/°C):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},step:1e-4,value:D.current,onChange:te=>{te!==null&&(D.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.NominalOperatingCellTemperature",L)+" (°C):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},step:1,precision:1,value:R.current,onChange:te=>{te!==null&&(R.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.RatedVoltage",L)+" Vmpp ("+B.t("word.VoltAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:U.current,onChange:te=>{te!==null&&(U.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.RatedCurrent",L)+" Impp ("+B.t("word.AmpereAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:2,step:.1,value:W.current,onChange:te=>{te!==null&&(W.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.OpenCircuitVoltage",L)+" Voc ("+B.t("word.VoltAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:F.current,onChange:te=>{te!==null&&(F.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.ShortCircuitCurrent",L)+" Isc ("+B.t("word.AmpereAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:2,step:.1,value:E.current,onChange:te=>{te!==null&&(E.current=te,c(!s))}})})]})]})}],ne=te=>{switch(te){case"ctrl+z":case"meta+z":if(n.hasUndo()){const $=n.undo();$&&yn(B.t("menu.edit.Undo",L)+": "+$,Ob),r&&e(le=>{le.actionInfo={name:"Undo",timestamp:new Date().getTime()}})}break;case"ctrl+y":case"meta+y":if(n.hasRedo()){const $=n.redo();$&&yn(B.t("menu.edit.Redo",L)+": "+$,Ob),r&&e(le=>{le.actionInfo={name:"Redo",timestamp:new Date().getTime()}})}break}};return h.jsxs(li,{width:720,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>d(!0),onMouseOut:()=>d(!1),children:B.t("menu.settings.CustomizeSolarPanel",L)}),footer:[h.jsx(oo,{onClick:()=>t(!1),children:B.t("word.Close",L)},"Close")],onCancel:()=>t(!1),maskClosable:!1,mask:!1,destroyOnClose:!1,modalRender:te=>h.jsx(Vi,{disabled:!u,bounds:f,onStart:($,le)=>j($,le),children:h.jsx("div",{ref:m,children:te})}),children:[h.jsxs(Qt,{style:{justifyContent:"space-between"},children:[h.jsx(Ge,{flex:3,children:h.jsx(dee,{defaultActiveKey:"1",type:"card",items:Z})}),h.jsx(Ge,{flex:.5,children:h.jsxs(Jt,{style:{height:"100%",justifyContent:"center",marginLeft:"12px"},direction:"vertical",children:[h.jsx(hZt,{title:B.t("word.Add",L),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>G()}),h.jsx(pJ,{style:{marginTop:"12px",marginBottom:"12px"}}),h.jsx(uZt,{title:B.t("pvModelPanel.ImportCustomSolarPanelFromClipboard",L),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>{oe()}})]})}),h.jsx(Ge,{flex:2,children:h.jsx(WL,{style:{marginTop:"56px",marginLeft:"8px"},size:"small",header:h.jsx("div",{style:{fontWeight:"bold"},children:B.t("pvModelPanel.AddedCustomSolarPanels",L)}),bordered:!0,dataSource:Y,renderItem:te=>h.jsxs(WL.Item,{children:[h.jsx(aen,{title:B.t("pvModelPanel.ExportThisCustomSolarPanel",L),style:{paddingRight:"4px",cursor:"pointer"},onClick:()=>{const $=a[te];navigator.clipboard.writeText(JSON.stringify($)).then(()=>{yn(B.t("pvModelPanel.CustomSolarPanelExportedToClipboard",L)+" ("+te+").")})}}),h.jsx(ftt,{title:B.t("word.Delete",L),style:{paddingRight:"6px",cursor:"pointer"},onClick:()=>ae(te)}),te]},te)})})]}),h.jsx(mge,{handleFocusableElements:!0,handleKeys:["ctrl+z","meta+z","ctrl+y","meta+y"],handleEventType:"keydown",onKeyEvent:(te,$)=>{$.preventDefault(),ne(te)}})]})}),Ytr=xe.memo(()=>{const t=H(J2e),e=H(lQ),n=H(NGe),o=H(hSt),r=H(UGe),i=H(jGe),a=H(mSt),l=H(ASt),s=dt(hTt),c=dt(pTt),u=dt(gTt),d=dt(mTt),f=dt(vs),p=H(BGe),m=H(CSt),y=H(YGe),w=H(zSt),x=H(ESt),C=H(OGe),P=H(LSt),A=H(_Ge),S=H(USt),v=H(VGe),b=H(YSt),T=H(GGe),R=H(VSt),M=H(XGe),D=H(JSt),k=H(vSt),N=H(SSt),U=H($St),W=H(QN),F=H(tu),E=H(TS),L=H(ZXe),j=H(QXe),Y=H(x5e),O=H(iQ)??!1,[_,G]=g.useState("Boston MA, USA");return g.useEffect(()=>{if(Object.keys(Y).length===0)return;const Q=L(F,E)??"Boston MA, USA";G(Q),j(Q)},[F,E,Y]),h.jsxs(h.Fragment,{children:[o&&h.jsx(Pzo,{}),r&&h.jsx(Mzo,{}),i&&h.jsx(ner,{}),t&&h.jsx(Per,{}),e&&h.jsx(wer,{}),(n||O)&&!W&&h.jsx(ier,{}),a&&h.jsx(OKo,{city:_,graphs:[bi.MonthlyTemperatures,bi.SunshineHours]}),l&&h.jsx(wtr,{city:_}),s&&h.jsx(Btr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showSolarPanelCustomizationPanel=Q})}}),c&&h.jsx(Mtr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showEconomicsPanel=Q})}}),u&&h.jsx(Utr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showNavigationPanel=Q})}}),d&&h.jsx(jtr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showShadowSettings=Q})}}),m&&h.jsx(XKo,{city:_}),p&&h.jsx(qZo,{city:_}),w&&h.jsx(cer,{city:_}),y&&h.jsx(her,{city:_}),x&&h.jsx(Der,{}),P&&h.jsx(Ler,{city:_}),C&&h.jsx(jer,{city:_}),S&&h.jsx(Jer,{city:_}),A&&h.jsx(_er,{city:_}),v&&h.jsx(Qer,{city:_}),b&&h.jsx(ntr,{city:_}),T&&h.jsx(atr,{city:_}),R&&h.jsx(utr,{city:_}),M&&h.jsx(gtr,{city:_}),D&&h.jsx(Str,{city:_}),k&&h.jsx(ktr,{city:_}),N&&h.jsx(Ntr,{city:_}),f&&h.jsx(Her,{}),U&&h.jsx(Htr,{})]})});class fl{static computeSolarPanelOutput(e,n,o,r,i,a,l,s,c){const u=i.parentType===z.Roof,d=i.parentType===z.Wall;u&&(a=l);const f=d?ye.absoluteCoordinates(i.cx,i.cy,i.cz,a,l,i.lz):ye.absoluteCoordinates(i.cx,i.cy,i.cz,a,void 0,void 0,!0),p=a.rotation[2];let m=i.tiltAngle,y=p+i.relativeAzimuth,w=!0;if(u&&(f.z=i.cz+i.lz+.02+a.cz,ye.isZero(i.rotation[0])?f.z+=i.poleHeight:(m=i.rotation[0],y=p,w=!1)),d&&!ye.isZero(i.tiltAngle)){const oe=a,q=(l?l.rotation[2]+oe.relativeAngle:oe.relativeAngle)-$t,ae=i.ly*Math.abs(Math.sin(i.tiltAngle))/2;f.x+=ae*Math.cos(q),f.y+=ae*Math.sin(q)}const x=new ue().fromArray(i.normal),C=e.getMonth(),P=ye.dayOfYear(e),A=n.solarRadiationHeatmapGridCellSize??.5;let S,v,b,T,R;n.discretization===Ay.EXACT?(S=i.lx,v=i.ly,i.orientation===br.portrait?(b=Math.max(1,Math.round(i.lx/r.width)),T=Math.max(1,Math.round(i.ly/r.length)),b*=r.n,T*=r.m):(b=Math.max(1,Math.round(i.lx/r.length)),T=Math.max(1,Math.round(i.ly/r.width)),b*=r.m,T*=r.n),R=i.lx/b):(S=i.lx,v=i.ly,b=Math.max(2,Math.round(i.lx/A)),T=Math.max(2,Math.round(i.ly/A)),b%2!==0&&(b+=1),T%2!==0&&(T+=1),R=A);const M=S/b,D=v/T,k=f.x-(S-R)/2,N=f.y-(v-R)/2,U=u||d?f.z:a.lz+i.poleHeight+i.lz,W=new _t(f.x,f.y),F=new ue,E=Array.from(Array(b),()=>new Array(T));let L=new cn(u&&!w?0:m,0,y,"ZYX");if(i.trackerType!==Bl.NO_TRACKER){const oe=p?o.clone().applyAxisAngle(Oo,-p):o.clone();switch(i.trackerType){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const ee=new zs().setFromUnitVectors(Oo,oe);L=new cn().setFromQuaternion(ee),L.z+=y;break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const ee=new zs().setFromUnitVectors(Oo,new ue(oe.x,0,oe.z).normalize());L=new cn().setFromQuaternion(ee),L.z+=y;break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{const ee=new ue(oe.x,-oe.y,0).normalize(),q=Math.acos(Zc.dot(ee))*Math.sign(ee.x);L=new cn(i.tiltAngle,0,q+p,"ZYX");break}case Bl.TILTED_SINGLE_AXIS_TRACKER:break}}x.applyEuler(L),u&&!w&&(L.x=i.rotation[0],L.z=i.rotation[2]+p),d&&(L.x=$t+i.tiltAngle,L.z=a.relativeAngle+p);const j=Si(o,P,s,hi.SPHERE_MODEL),Y=ei(n.ground,C,x,j),O=x.dot(o),_=new _t,G=new ue;for(let oe=0;oe0&&(_.set(k+oe*M,N+ee*D),G.set(_.x-W.x,_.y-W.y,0),G.applyEuler(L),F.set(f.x+G.x,f.y+G.y,U+G.z),c(i.id,F,o)<0&&(E[oe][ee]+=O*j));let Q=0;switch(r.shadeTolerance){case i8.NONE:{let oe=Number.MAX_VALUE;for(let ee=0;eeArray(x).fill(0)),E=Array(w).fill(0).map(()=>Array(x).fill(0));let L;for(let j=0;j0)for(const oe of a){if(oe.type!==z.Window)continue;const ee=oe.cx*r.lx,q=oe.cz*r.lz,ae=oe.lx*r.lx/2,Z=oe.lz*r.lz/2,ne=oe;if(ne.windowType===Ti.Arched){const te=S.clone().add(new ue(ne.cx*r.lx,0,ne.cz*r.lz));fl.pointWithinArch(R,ne.lx,ne.lz,ne.archHeight,te)&&(L=!1)}else if(G.x>=ee-ae&&G.x=q-Z&&G.y0)for(const oe of l){if(oe.type!==z.Door)continue;const ee=oe.cx*r.lx,q=oe.cz*r.lz,ae=oe.lx*r.lx/2,Z=oe.lz*r.lz/2,ne=oe;if(ne.doorType===Wd.Arched){const te=S.clone().add(new ue(ne.cx*r.lx,0,ne.cz*r.lz));fl.pointWithinArch(R,ne.lx,ne.lz,ne.archHeight,te)&&(L=!1)}else if(G.x>=ee-ae&&G.x=q-Z&&G.y0)for(const oe of s){const ee=oe.cx*r.lx,q=oe.cz*r.lz,ae=oe.lx/2,Z=oe.ly/2;if(G.x>=ee-ae&&G.x=q-Z&&G.ytA||ee<0)&&oe&&(F[j][Y]+=U),W>0&&ee<0&&(E[j][Y]+=W*N,oe&&(F[j][Y]+=W*N))}}}return{intensity:F,unitArea:C*P,heatmap:E}}static computeDoorSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=ye.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx*i.lx,f=r.lz*i.lz,p=Math.max(2,Math.round(d/u)),m=Math.max(2,Math.round(f/u)),y=d/p,w=f/m,x=a.rotation[2]+i.relativeAngle,P=ye.wallAbsolutePosition(new ue(i.cx,i.cy,i.cz),a).setZ(i.lz/2+a.lz).clone().add(new ue(r.cx*i.lx,0,r.cz*i.lz)),A=new ue(Math.cos(x-$t),Math.sin(x-$t),0),S=y*Math.cos(x),v=y*Math.sin(x),b=new ue,T=Si(o,c,l,hi.SPHERE_MODEL),R=ei(n.ground,e.getMonth(),A,T),M=A.dot(o),D=Array(p).fill(0).map(()=>Array(m).fill(0));if(r.doorType===Wd.Arched)for(let k=0;k0&&s(r.id,b,o)<0&&(D[k][N]+=M*T))}else for(let k=0;k0){const U=k-p/2+.5,W=N-m/2+.5;b.set(P.x+U*S,P.y+U*v,P.z+W*w),s(r.id,b,o)<0&&(D[k][N]+=M*T)}return{intensity:D,unitArea:y*w}}static pointWithinArch(e,n,o,r,i){if(r>0){const a=.5*n,l=Math.min(r,o,a),s=.5*(l+a*a/l),c=e.x-i.x,u=e.y-i.y,d=c*c+u*u;let f=e.z-i.z;return d-o/2?!0:(f=e.z-(o-s),d+f*fArray(m).fill(0));if(r.windowType===Ti.Arched)for(let k=0;k0&&s(r.id,b,o)<0&&(D[k][N]+=M*T))}else for(let k=0;k0){const U=k-p/2+.5,W=N-m/2+.5;b.set(P.x+U*S,P.y+U*v,P.z+W*w),s(r.id,b,o)<0&&(D[k][N]+=M*T)}return{intensity:D,unitArea:y*w}}static computeRoofWindowSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=ye.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx,f=r.lz,p=Math.max(2,Math.round(d/u)),m=Math.max(2,Math.round(f/u)),y=d/p,w=f/m,x=new ue(r.cx,r.cy,r.cz).applyEuler(new cn(0,0,a.rotation[2]));x.x+=a.cx,x.y+=a.cy,x.z+=a.lz;const C=new cn(r.rotation[0],r.rotation[1],r.rotation[2]+a.rotation[2],"ZXY"),P=new ue(0,0,1).applyEuler(C),A=new ue,S=Si(o,c,l,hi.SPHERE_MODEL),v=ei(n.ground,e.getMonth(),P,S),b=P.dot(o),T=Array(p).fill(0).map(()=>Array(m).fill(0));if(r.windowType===Ti.Arched)for(let R=0;R0&&s(r.id,A,o)<0&&(T[R][M]+=b*S))}else for(let R=0;R0){const D=R-p/2+.5,k=M-m/2+.5,N=new ue(D,k,0);N.applyEuler(C),A.set(x.x+N.x,x.y+N.y,x.z+N.z),s(r.id,A,o)<0&&(T[R][M]+=b*S)}return{intensity:T,unitArea:y*w}}static computePyramidRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=n.solarRadiationHeatmapGridCellSize??.5,m=ye.dayOfYear(e),y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,m,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P,v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/p)),W=Math.max(2,Math.round(N/p)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize();const E=U*M.dot(R)/k;M.normalize(),D.normalize();const L=new ue().crossVectors(M,D).normalize(),j=R.multiplyScalar(.5*k/U),Y=new ue().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));O.add(j).add(Y),j.multiplyScalar(2),Y.multiplyScalar(2),C.push(j.length()*Y.length());const _=new ue,G=[],Q=.01;G.push({x:-.01,y:-.01}),G.push({x:U+Q,y:-.01}),G.push({x:E,y:W+Q});const oe=ei(n.ground,e.getMonth(),L,w),ee=L.dot(o);for(let q=0;qtA||te<0)&&(F[q][Z]+=oe),ee>0&&te<0&&(F[q][Z]+=ee*w)}}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeHipRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),m=n.solarRadiationHeatmapGridCellSize??.5,y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,p,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P,v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/m)),W=Math.max(2,Math.round(N/m)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize();const E=U*M.dot(R)/k;M.normalize(),D.normalize();const L=new ue().crossVectors(M,D).normalize(),j=R.multiplyScalar(.5*k/U),Y=new ue().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new ue,_=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));_.add(j).add(Y),j.multiplyScalar(2),Y.multiplyScalar(2),C.push(j.length()*Y.length());const G=ei(n.ground,e.getMonth(),L,w),Q=L.dot(o),oe=[];for(const ee of A)oe.push({x:ee.x,y:ee.y});if(P%2===0)for(let ee=0;eetA||ne<0)&&(F[ee][ae]+=G),Q>0&&ne<0&&(F[ee][ae]+=Q*w)}}}else{const ee=[];ee.push({x:-.01,y:-.01}),ee.push({x:U+.01,y:-.01}),ee.push({x:E,y:W+.01});for(let ae=0;aetA||$<0)&&(F[ae][ne]+=G),Q>0&&$<0&&(F[ae][ne]+=Q*w)}}}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeGambrelRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),m=n.solarRadiationHeatmapGridCellSize??.5,y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,p,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P,v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/m)),W=Math.max(2,Math.round(N/m)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize(),M.normalize(),D.normalize();const E=new ue().crossVectors(M,D).normalize(),L=R.multiplyScalar(.5*k/U),j=new ue().crossVectors(E,R).normalize().multiplyScalar(.5*N/W),Y=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));Y.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new ue,_=ei(n.ground,e.getMonth(),E,w),G=E.dot(o);for(let Q=0;QtA||q<0)&&(F[Q][ee]+=_),G>0&&q<0&&(F[Q][ee]+=G*w)}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeMansardRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),m=n.solarRadiationHeatmapGridCellSize??.5,y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,p,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P;if(P===l.length-1){let v=Number.MAX_VALUE,b=Number.MAX_VALUE,T=-Number.MAX_VALUE,R=-Number.MAX_VALUE;for(const Y of A){const O=Y.clone().applyEuler(y);O.x>T&&(T=O.x),O.xR&&(R=O.y),O.yArray(k).fill(0));x.push(W);const F=new ue(v+m/2,b+m/2,s.lz+M+Zu+(a?r.thickness:0)),E=new ue(0,0,F.z),L=ei(n.ground,e.getMonth(),Oo,w),j=Oo.dot(o);for(let Y=0;YtA||_<0)&&(W[Y][O]+=L),j>0&&_<0&&(W[Y][O]+=j*w)}}}else{const v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/m)),W=Math.max(2,Math.round(N/m)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize(),M.normalize(),D.normalize();const E=new ue().crossVectors(M,D).normalize(),L=R.multiplyScalar(.5*k/U),j=new ue().crossVectors(E,R).normalize().multiplyScalar(.5*N/W),Y=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));Y.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new ue,_=ei(n.ground,e.getMonth(),E,w),G=E.dot(o);for(let Q=0;QtA||q<0)&&(F[Q][ee]+=_),G>0&&q<0&&(F[Q][ee]+=G*w)}}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeFlatRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=ye.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,m=new cn(0,0,l.rotation[2],"ZYX"),y=Si(o,f,u,hi.SPHERE_MODEL),w=[],x=[];let C=Number.MAX_VALUE,P=Number.MAX_VALUE,A=-Number.MAX_VALUE,S=-Number.MAX_VALUE;for(const F of a)for(const E of F){const L=E.clone().applyEuler(m);L.x>A&&(A=L.x),L.xS&&(S=L.y),L.yArray(b).fill(0));w.push(M),x.push(T*R);const D=a[0][0].z,k=new ue(C+p/2,P+p/2,l.lz+D+Zu+(i?r.thickness:0)),N=new ue(0,0,k.z),U=ei(n.ground,e.getMonth(),Oo,y),W=Oo.dot(o);for(let F=0;FtA||L<0)&&(M[F][E]+=U),W>0&&L<0&&(M[F][E]+=W*y)}}return{segmentIntensities:w,segmentUnitArea:x}}static computeGableRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=ye.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,m=new cn(0,0,l.rotation[2],"ZYX"),y=Si(o,f,u,hi.SPHERE_MODEL),w=[],x=[];for(const[C,P]of a.entries()){const A=r.id+"-"+C,S=P[0].clone().applyEuler(m),v=P[1].clone().applyEuler(m),b=P[2].clone().applyEuler(m),T=new ue().subVectors(v,S),R=new ue().subVectors(b,S),M=new ue().subVectors(b,v),D=T.length(),k=new ue().crossVectors(R,M).length()/D,N=Math.max(2,Math.round(D/p)),U=Math.max(2,Math.round(k/p)),W=Array(N).fill(0).map(()=>Array(U).fill(0));w.push(W),T.normalize(),R.normalize(),M.normalize();const F=new ue().crossVectors(R,M).normalize(),E=T.multiplyScalar(.5*D/N),L=new ue().crossVectors(F,T).normalize().multiplyScalar(.5*k/U),j=new ue(l.cx+S.x,l.cy+S.y,l.lz+S.z+Zu+(i?r.thickness:0));j.add(E).add(L),E.multiplyScalar(2),L.multiplyScalar(2),x.push(E.length()*L.length());const Y=new ue,O=ei(n.ground,e.getMonth(),F,y),_=F.dot(o);for(let G=0;GtA||ee<0)&&(W[G][oe]+=O),_>0&&ee<0&&(W[G][oe]+=_*y)}}}return{segmentIntensities:w,segmentUnitArea:x}}static isPointRoof(e,n,o,r){if(n&&n.length>0)for(const i of n){const a=Rn.getAbsoluteWindowVerticesOnRoof(i,r),l=ye.getPoints(a);if(ye.isPointInside(e.x,e.y,l))return!1}if(o&&o.length>0)for(const i of o){const a=Rn.getAbsoluteSolarPanelVerticesOnRoof(i,r),l=ye.getPoints(a);if(ye.isPointInside(e.x,e.y,l))return!1}return!0}}const Otr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(p4),r=H($r),i=H($3),a=H(O5),l=In(e5e),s=In(UN),c=In(n5e),u=In(vTt),d=In(STt),f=In(PTt),p=H(Qi),m=dt(jN),y=dt(uPt),w=dt(dQ),x=dt(dPt),C=H.getState().world,P=H.getState().elements,A=C.noAnimationForThermalSimulation,S=C.highestTemperatureTimeInMinutes??900,v=g.useRef(0),b=g.useRef(!1),T=g.useRef(new Date(C.date)),R=g.useRef(0),M=g.useRef(!1),D=g.useRef(new Date(C.date)),k=g.useRef(0),N=g.useRef({high:20,low:0}),U=g.useRef(20),W=g.useRef(20),F=g.useRef(new Map),E=g.useRef(new Map),L=g.useRef(new Map),j=g.useRef([]),Y=g.useRef([]),O=g.useRef(),_=g.useRef(),G=g.useRef(0),Q=g.useRef(new Map),oe=Kt(),ee=_1(t),q=new Date(C.date),ae=t?ee==null?void 0:ee.elevation:0,Z=C.monthlyIrradianceLosses??new Array(12).fill(.05),ne=C.timesPerHour??4,te=60/ne,$=C.daysPerYear??6,le=12/$,{scene:de}=ti(),he=g.useMemo(()=>new yu,[]),me=()=>_9(1,Y3e(q),FU(q),ye.toRadians(C.latitude)).normalize(),ce=(je,et,bt)=>{if(j.current.length>1){Y.current.length=0,he.set(et,bt);const St=j.current.filter(Pt=>Pt.uuid!==je);if(he.intersectObjects(St,!1,Y.current),Y.current.length>0)return Y.current[0].distance}return-1},Pe=()=>{const je=de.children.filter(et=>et.name==="Content");if(je.length>0){const et=je[0].children;j.current.length=0;for(const bt of et)ye.fetchSimulationElements(bt,j.current)}},pe=je=>{if(ee){N.current=eS(q,ee.lowestTemperatures,ee.highestTemperatures);const et=ye.minutesIntoDay(je);U.current=Zb(N.current.high,N.current.low,C.diurnalTemperatureModel??a5.Sinusoidal,S,pl(je,C.latitude),et),W.current=Uit(C.latitude,ye.dayOfYear(q),et,ee.lowestTemperatures,ee.highestTemperatures,S,.5*(N.current.high-N.current.low),C.ground.thermalDiffusivity??.05,sVe)}},Ie=(je,et)=>{let bt=F.current.get(je);bt||(bt=new Array(24).fill(0),F.current.set(je,bt)),bt[q.getHours()]+=et},ve=(je,et)=>{let bt=E.current.get(je);bt||(bt=new Array(24).fill(0),E.current.set(je,bt)),bt[q.getHours()]+=et},ze=(je,et)=>{let bt=L.current.get(je);bt||(bt=new Array(24).fill(0),L.current.set(je,bt)),bt[q.getHours()]+=et},Ae=()=>{var je,et,bt,St;for(const Pt of P){if(ye.onBuildingEnvelope(Pt)&&((je=F.current.get(Pt.id))==null||je.fill(0)),Pt.type===z.Roof)for(const Yt of F.current.keys())Yt!==Pt.id&&Yt.startsWith(Pt.id)&&((et=F.current.get(Yt))==null||et.fill(0));Pt.type===z.Foundation&&((bt=E.current.get(Pt.id))==null||bt.fill(0),(St=L.current.get(Pt.id))==null||St.fill(0))}},se=()=>{Q.current.clear()};g.useEffect(()=>{if(m)if(A&&!ye.hasMovingParts(P))ge();else return Pe(),we(),v.current=requestAnimationFrame(Me),()=>{cancelAnimationFrame(v.current),b.current||(yn(B.t("message.SimulationAborted",oe)),e(je=>{je.world.date=T.current.toLocaleString("en-US")}),dt.getState().set(je=>{je.simulationInProgress=!1,je.simulationPaused=!1})),M.current=!1}},[m]),g.useEffect(()=>{M.current=y,y?(D.current=new Date(q.getTime()),cancelAnimationFrame(v.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",oe))):(n("simulationPaused",!1),q.setHours(q.getHours(),q.getMinutes()+te),Me())},[y]);const ge=()=>{_e()},we=()=>{M.current?(q.setTime(D.current.getTime()),M.current=!1):(T.current=new Date(C.date),k.current=ye.dayOfYear(q),q.setHours(0,te/2)),b.current=!1,Ae(),se()},Se=()=>{for(const je of P){if(ye.onBuildingEnvelope(je)||je.type===z.SolarPanel){const et=F.current.get(je.id);et&&u(je.id,[...et]);const bt=Q.current.get(je.id);bt&&l(je.id,bt.map(St=>[...St]))}if(je.type===z.Roof){for(const et of F.current.keys())if(et!==je.id&&et.startsWith(je.id)){const bt=F.current.get(et);bt&&u(et,[...bt]);const St=Q.current.get(et);St&&l(et,St.map(Pt=>[...Pt]))}}if(je.type===z.Foundation){let et=E.current.get(je.id);et&&d(je.id,[...et]),et=L.current.get(je.id),et&&f(je.id,[...et])}}dt.getState().set(je=>{je.flagOfDailySimulation=!je.flagOfDailySimulation,je.runYearlyThermalSimulation||(je.showSolarRadiationHeatmap=!0,je.showHeatFluxes=!0)}),p&&!w&&setTimeout(()=>{e(je=>{const et=In.getState().totalBuildingHeater,bt=In.getState().totalBuildingAc,St=In.getState().totalBuildingSolarPanel;je.actionInfo={name:"Daily Building Energy Analysis Completed",result:{Heater:et.toFixed(2),AC:bt.toFixed(2),SolarPanel:St.toFixed(2),Net:(et+bt-St).toFixed(2)},timestamp:new Date().getTime()}})},10)},Me=()=>{if(m&&!M.current){if(q.getMinutes()+q.getHours()*60+(ye.dayOfYear(q)-k.current)*f5+te>f5){_e(),cancelAnimationFrame(v.current),e(et=>{et.world.date=T.current.toLocaleString("en-US"),et.viewState.showDailyBuildingEnergyPanel=!0,et.selectedFloatingWindow="dailyBuildingEnergyPanel"}),dt.getState().set(et=>{et.runDailyThermalSimulation=!1,et.simulationPaused=!1,et.simulationInProgress=!1}),yn(B.t("message.SimulationCompleted",oe)),b.current=!0,Se();return}e(et=>{et.world.date=q.toLocaleString("en-US")}),_e(),v.current=requestAnimationFrame(Me),q.setHours(q.getHours(),q.getMinutes()+te)}},[Ce,Te]=g.useState(q.getMonth());g.useEffect(()=>{setTimeout(()=>{Pe()},200)},[Ce]),g.useEffect(()=>{if(w)if(dt.getState().set(je=>{je.showSolarRadiationHeatmap=!1,je.showHeatFluxes=!1}),A&&!ye.hasMovingParts(P))setTimeout(()=>{},50);else return Re(),Te(q.getMonth()),Pe(),v.current=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(v.current),b.current||(yn(B.t("message.SimulationAborted",oe)),e(je=>{je.world.date=T.current.toLocaleString("en-US")}),dt.getState().set(je=>{je.simulationInProgress=!1,je.simulationPaused=!1})),M.current=!1}},[w]),g.useEffect(()=>{M.current=x,x?(D.current=new Date(q.getTime()),cancelAnimationFrame(v.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",oe))):(n("simulationPaused",!1),q.setHours(q.getHours(),q.getMinutes()+te),Ne())},[x]);const Re=()=>{M.current?(q.setTime(D.current.getTime()),M.current=!1):(T.current=new Date(C.date),R.current=0,q.setMonth(0,22),k.current=ye.dayOfYear(q),q.setHours(0,te/2),e(je=>{je.viewState.showYearlyBuildingEnergyPanel=!0,je.selectedFloatingWindow="yearlyBuildingEnergyPanel",je.world.date=q.toLocaleString("en-US")})),Ae(),se(),b.current=!1},Ne=()=>{w&&!M.current&&(q.getMinutes()+q.getHours()*60+(ye.dayOfYear(q)-k.current)*f5{et.world.date=q.toLocaleString("en-US")}),_e(),q.setHours(q.getHours(),q.getMinutes()+te),v.current=requestAnimationFrame(Ne)):(Se(),R.current++,R.current===$?(cancelAnimationFrame(v.current),setTimeout(()=>{e(et=>{et.world.date=T.current.toLocaleString("en-US")})},10),dt.getState().set(et=>{et.runYearlyThermalSimulation=!1,et.simulationInProgress=!1,et.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",oe)),b.current=!0,p&&setTimeout(()=>{e(et=>{const bt=In.getState().totalBuildingHeater,St=In.getState().totalBuildingAc,Pt=In.getState().totalBuildingSolarPanel;et.actionInfo={name:"Yearly Building Energy Analysis Completed",result:{Heater:bt.toFixed(2),AC:St.toFixed(2),SolarPanel:Pt.toFixed(2),Net:(bt+St-Pt).toFixed(2)},timestamp:new Date().getTime()}})},10)):(q.setMonth(R.current*le,22),q.setHours(0,te/2),Te(q.getMonth()),k.current=ye.dayOfYear(q),Ae(),se(),v.current=requestAnimationFrame(Ne))))},_e=()=>{pe(q),_.current=pl(q,C.latitude);const je=_.current.daylight()/60;G.current=je>Ht?ee.sunshineHours[q.getMonth()]/(30*je*ne):0,O.current=me();for(const et of P)switch(et.type){case z.Door:{lt(et);break}case z.Window:{Le(et),Ye(et);break}case z.Wall:{Oe(et);break}case z.Roof:{const bt=et;Qe(bt),ut(bt);break}case z.SolarPanel:{He(et);break}}},Ue=(je,et)=>{let bt=et.efficiency;return et.cellType==="Monocrystalline"&&(bt*=.95),bt*(1+et.pmaxTC*(je-25))},qe=()=>{if(!_.current)throw new Error("sun minutes not set");const je=_.current.daylight()/60;return je>Ht?ee.sunshineHours[q.getMonth()]/(30*je*ne):0},Fe=je=>{if(!a(je.pvModelName))throw new Error("PV model not found");return je.lx*je.ly*(je.inverterEfficiency??.95)*(1-Z[q.getMonth()])},He=je=>{const et=o(je);if(et){const bt=r(je);if(bt){const St=a(je.pvModelName);if(O.current&&O.current.z>0){const Pt=fl.computeSolarPanelOutput(q,C,O.current,St,je,bt,et,ae,ce),Yt=Ue(U.current,St)*qe()*Fe(je);if(ze(et.id,Pt.average*Yt),m){for(let Rt=0;Rt{if(je.interior)return;const et=o(je);if(et){const bt=r(je);if(bt){const St=ye.getHeatingSetpoint(q,et.hvacSystem),Pt=ye.getCoolingSetpoint(q,et.hvacSystem),Yt=ye.getWindowArea(je,je.parentType===z.Roof?void 0:bt);let zt=0;U.currentPt&&(zt=U.current-Pt),zt!==0&&(je.empty?Ie(je.id,zt*Yt*j_*.001/ne):Ie(je.id,zt*Yt*(je.uValue??X9)*.001/ne))}}},Ye=je=>{if(je.interior)return;const et=o(je);if(et){const bt=r(je);if(bt){let St=0;if(je.parentType===z.Roof){const Pt=s(bt.id);if(!Pt)return;for(let Yt=0;Yt0){const zt=fl.computeRoofWindowSolarRadiationEnergy(q,C,O.current,je,bt,et,ae,ce);for(let Rt=0;Rt0){const Pt=fl.computeWallWindowSolarRadiationEnergy(q,C,O.current,je,bt,et,ae,ce);for(let Yt=0;Yt{if(je.interior)return;const et=o(je);if(et){const bt=r(je);if(bt){const St=ye.getHeatingSetpoint(q,et.hvacSystem),Pt=ye.getCoolingSetpoint(q,et.hvacSystem),Yt=U.currentPt;if(Yt||zt){const Rt=Yt?St:Pt,Ct=ye.getDoorArea(je,bt);if(je.filled){const yt=Kx(je);let at=0;if(O.current&&O.current.z>0){const Je=fl.computeDoorSolarRadiationEnergy(q,C,O.current,je,bt,et,ae,ce);for(let st=0;st{const et=o(je);if(et){const bt=je.fill!==Ul.Empty&&je.wallStructure===Tc.Default,St=ye.getHeatingSetpoint(q,et.hvacSystem),Pt=ye.getCoolingSetpoint(q,et.hvacSystem),Yt=U.currentPt;if(Yt||zt){const Rt=Yt?St:Pt;if(bt){const Ct=je.fill===Ul.Partial&&!ye.isPartialWallFull(je),yt=ye.getWallVertices(je,0),at=Ct?ye.getPartialWallVertices(je,0):yt,Et=ye.getPolygonArea(yt);let Lt=Ct?ye.getPolygonArea(at):Et;const Je=i(z.Window,je.id),st=i(z.Door,je.id),It=Kx(je);let ot=0;if(O.current&&O.current.z>0){const ct=(Ct?at.length:yt.length)===4,Xe=i(z.SolarPanel,je.id),ft=fl.computeWallSolarRadiationEnergy(q,C,O.current,je,et,Je,st,Xe,ct?0:1,ae,ce);for(let wt=0;wt0)for(const ct of Je)Lt-=ye.getWindowArea(ct,je);if(st&&st.length>0)for(const ct of st)Lt-=ct.lx*ct.lz*je.lx*je.lz;const it=ye.isZero(ot)||ye.isZero(It)?0:ot*It/((je.volumetricHeatCapacity??.5)*Lt*je.ly);let pt=(U.current+it-Rt)*Lt/(je.rValue??U9)*.001/ne;Ct&&je.openToOutside&&(pt+=(U.current-Rt)*(Et-Lt)*j_*.001/ne),Ie(je.id,pt)}else if(je.openToOutside){const Ct=ye.getWallVertices(je,0),yt=ye.getPolygonArea(Ct),at=U.current-Rt;Ie(je.id,at*yt*j_*.001/ne)}}}},ut=je=>{const et=o(je);if(!et)return;const bt=ye.getHeatingSetpoint(q,et.hvacSystem),St=ye.getCoolingSetpoint(q,et.hvacSystem),Pt=U.currentSt;if(Pt||Yt){const zt=Pt?bt:St,Rt=ye.calculateBuildingArea(je),Ct=W.current-zt;Ie(et.id,Ct*Rt/(et.rValue??Kw)*.001/ne)}},ht=(je,et,bt)=>{const St=1/(je.rValue??pA),Pt=1/(je.ceilingRValue??dA);return(St*et+Pt*bt)/(St+Pt)},Qe=je=>{const et=o(je);if(!et)return;const bt=s(je.id);if(!bt)return;let St;switch(je.roofType){case Zo.Pyramid:St=nt(je,bt,et);break;case Zo.Hip:St=mt(je,bt,et);break;case Zo.Gable:St=Ve(je,bt,et);break;case Zo.Gambrel:St=tt(je,bt,et);break;case Zo.Mansard:St=gt(je,bt,et);break}if(St){const Pt=ye.getHeatingSetpoint(q,et.hvacSystem),Yt=ye.getCoolingSetpoint(q,et.hvacSystem),zt=U.currentYt;if(zt||Rt){const Ct=zt?Pt:Yt;let yt=0;for(const[at,Et]of St.entries()){const Je=(Et.surfaceTemperature-(je.ceiling?ht(je,Et.surfaceTemperature,Ct):Ct))*Et.totalArea/(je.rValue??pA)*.001/ne;Ie(je.id+"-"+at,Je),yt+=Je}Ie(je.id,yt)}}},nt=(je,et,bt)=>{if(je.roofType!==Zo.Pyramid)throw new Error("roof is not pyramid");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const Je of et)for(const st of Je)if(Math.abs(st.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=i(z.Window,je.id),Ct=[];if(Pt){let Je=0;for(const st of et){const It=[];for(const ot of st)It.push(ye.mapVector3ToPoint2(ot));Je+=ye.getPolygonArea(It)}if(Rt.length>0){for(const st of Rt)Je-=st.lx*st.lz;Je<0&&(Je=0)}Ct.push(Je)}else for(const Je of et){let st=ye.getTriangleArea(Je[0],Je[1],Je[2]);if(Rt.length>0){for(const It of Rt)Rn.onSegment(Je,It.cx,It.cy)&&(st-=It.lx*It.lz);st<0&&(st=0)}Ct.push(st)}const yt=Kx(je),at=Array(zt).fill(0);if(O.current&&O.current.z>0){const Je=i(z.SolarPanel,je.id),st=fl.computePyramidRoofSolarRadiationEnergy(q,C,O.current,je,Pt,!0,et,bt,Rt,Je,ae,ce);for(let It=0;It{if(je.roofType!==Zo.Hip)throw new Error("roof is not hip");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const st of et)for(const It of st)if(Math.abs(It.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=[],Ct=i(z.Window,je.id);for(const st of et){let It=0;if(st.length===3?It=ye.getTriangleArea(st[0],st[1],st[2]):st.length===4&&(It=ye.getTriangleArea(st[0],st[1],st[2])+ye.getTriangleArea(st[2],st[3],st[0])),Ct.length>0){for(const ot of Ct)Rn.onSegment(st,ot.cx,ot.cy)&&(It-=ot.lx*ot.lz);It<0&&(It=0)}Rt.push(It)}const yt=Pt?[Rt.reduce((st,It)=>st+It,0)]:Rt,at=Kx(je),Et=Array(zt).fill(0);if(O.current&&O.current.z>0){const st=i(z.SolarPanel,je.id),It=fl.computeHipRoofSolarRadiationEnergy(q,C,O.current,je,Pt,!0,et,bt,Ct,st,ae,ce);for(let ot=0;ot{if(je.roofType!==Zo.Gambrel)throw new Error("roof is not gambrel");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const st of et)for(const It of st)if(Math.abs(It.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=[],Ct=i(z.Window,je.id);for(const st of et){let It=ye.getTriangleArea(st[0],st[1],st[2])+ye.getTriangleArea(st[2],st[3],st[0]);if(Ct.length>0){for(const ot of Ct)Rn.onSegment(st,ot.cx,ot.cy)&&(It-=ot.lx*ot.lz);It<0&&(It=0)}Rt.push(It)}const yt=Pt?[Rt.reduce((st,It)=>st+It,0)]:Rt,at=Kx(je),Et=Array(zt).fill(0);if(O.current&&O.current.z>0){const st=i(z.SolarPanel,je.id),It=fl.computeGambrelRoofSolarRadiationEnergy(q,C,O.current,je,Pt,!0,et,bt,Ct,st,ae,ce);for(let ot=0;ot{if(je.roofType!==Zo.Mansard)throw new Error("roof is not mansard");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const it of et)for(const Be of it)if(Math.abs(Be.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=[],Ct=i(z.Window,je.id);for(let it=0;it0){for(const ct of Ct)Rn.onSegment(Be,ct.cx,ct.cy)&&(pt-=ct.lx*ct.lz);pt<0&&(pt=0)}Rt.push(pt)}const yt=et[St-1],at=new Array;for(const it of yt)at.push({x:it.x,y:it.y});let Et=ye.getPolygonArea(at);if(Ct.length>0){for(let it=Ct.length-1;it>=0;it--){const Be=Ct[it];Rn.onSegment(yt,Be.cx,Be.cy)&&(Et-=Be.lx*Be.lz,Ct.splice(it,1))}Et<0&&(Et=0)}Rt.push(Et);const Lt=Pt?[Rt.reduce((it,Be)=>it+Be,0)]:Rt,Je=Kx(je),st=Array(zt).fill(0);if(O.current&&O.current.z>0){const it=i(z.SolarPanel,je.id),Be=fl.computeMansardRoofSolarRadiationEnergy(q,C,O.current,je,Pt,!0,et,bt,Ct,it,ae,ce);for(let pt=0;pt{if(je.roofType!==Zo.Gable)throw new Error("roof is not gable");const St=et.length;if(St===0)return;const Pt=i(z.Window,je.id),Yt=[];for(const at of et){let Et=ye.getTriangleArea(at[0],at[1],at[2])+ye.getTriangleArea(at[2],at[3],at[0]);if(Pt.length>0){for(const Lt of Pt)Rn.onSegment(at,Lt.cx,Lt.cy)&&(Et-=Lt.lx*Lt.lz);Et<0&&(Et=0)}Yt.push(Et)}const zt=Kx(je),Rt=Array(St).fill(0);if(O.current&&O.current.z>0){const at=i(z.SolarPanel,je.id),Et=fl.computeGableRoofSolarRadiationEnergy(q,C,O.current,je,!0,et,bt,Pt,at,ae,ce);for(let Lt=0;Lt{const e=H.getState().world,n=H.getState().elements,o=H($r),r=H(p4),i=In(e5e),a=In(QGe),l=dt(l5e),s=In(n5e),{scene:c}=ti(),u=Kt(),d=_1(t),f=new Date(e.date),p=t?d==null?void 0:d.elevation:0,m=60/e.timesPerHour,y=g.useMemo(()=>new yu,[]),w=e.solarRadiationHeatmapGridCellSize??.5,x=g.useRef([]),C=g.useRef([]);g.useEffect(()=>{l&&n&&n.length>0&&(a(),S(),dt.getState().set(Y=>{Y.runStaticSimulation=!1,Y.simulationInProgress=!1,Y.showSolarRadiationHeatmap=!0}),yn(B.t("message.SimulationCompleted",u)))},[l]);const P=(Y,O,_)=>{if(x.current.length>1){C.current.length=0,y.set(O,_);const G=x.current.filter(Q=>Q.uuid!==Y);return y.intersectObjects(G,!1,C.current),C.current.length>0}return!1},A=()=>{const Y=c.children.filter(O=>O.name==="Content");if(Y.length>0){const O=Y[0].children;x.current.length=0;for(const _ of O)ye.fetchSimulationElements(_,x.current)}},S=()=>{A();for(const Y of n)switch(Y.type){case z.Foundation:{const O=Y;b(O),O.solarStructure===Nn.UpdraftTower&&T(O);break}case z.Cuboid:{v(Y);break}case z.SolarPanel:{R(Y);break}case z.SolarWaterHeater:{M(Y);break}case z.Wall:{D(Y);break}case z.Door:{k(Y);break}case z.Roof:{const O=Y;switch(O.roofType){case Zo.Pyramid:N(O);break;case Zo.Gable:L(O);break;case Zo.Gambrel:W(O);break;case Zo.Mansard:U(O);break;case Zo.Hip:F(O);break}break}}},v=Y=>{const O=f.getFullYear(),_=f.getMonth(),G=f.getDate(),Q=ye.dayOfYear(f),oe=Y.lx,ee=Y.ly,q=Y.lz,ae=Math.max(2,Math.round(oe/w)),Z=Math.max(2,Math.round(ee/w)),ne=Math.max(2,Math.round(q/w)),te=oe/ae,$=ee/Z,le=q/ne,de=o(Y);let he=Y.cx,me=Y.cy,ce=Y.cz;if(de&&de.type===z.Cuboid){const Le=ye.getWorldDataById(Y.id);he=Le.pos.x,me=Le.pos.y,ce=Le.pos.z}const Pe=Array(ae).fill(0).map(()=>Array(Z).fill(0)),pe=Array(ae).fill(0).map(()=>Array(ne).fill(0)),Ie=Array(ae).fill(0).map(()=>Array(ne).fill(0));let ve=Array(Z).fill(0).map(()=>Array(ne).fill(0)),ze=Array(Z).fill(0).map(()=>Array(ne).fill(0));const Ae=Oo,se=T1.clone().applyAxisAngle(Oo,Y.rotation[2]),ge=Zc.clone().applyAxisAngle(Oo,Y.rotation[2]),we=S1.clone().applyAxisAngle(Oo,Y.rotation[2]),Se=b1.clone().applyAxisAngle(Oo,Y.rotation[2]),Me=new ue;let Ce=0;const Te=new _t(he,me),Re=new _t,Ne=me-ee/2,_e=me+ee/2,Ue=he-oe/2,qe=he+oe/2;for(let Le=0;Le<24;Le++)for(let Ye=0;Ye0){Ce++;const ut=Si(Oe,Q,p,hi.SPHERE_MODEL);let ht=ei(e.ground,_,Ae,ut),Qe=Ae.dot(Oe),nt=he-oe/2,mt=me-ee/2;const tt=ce+q/2;for(let gt=0;gt0&&(Re.set(nt+(gt+.5)*te,mt+(Ve+.5)*$),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,tt),P(Y.id,Me,Oe)||(Pe[gt][Ve]+=Qe*ut));nt=he-oe/2,mt=ce-q/2,ht=ei(e.ground,_,se,ut),Qe=se.dot(Oe);for(let gt=0;gt0&&(Re.set(nt+(gt+.5)*te,Ne),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(Ve+.5)*le),P(Y.id,Me,Oe)||(pe[gt][Ve]+=Qe*ut));ht=ei(e.ground,_,ge,ut),Qe=ge.dot(Oe);for(let gt=0;gt0&&(Re.set(nt+(gt+.5)*te,_e),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(ne-(Ve+.5))*le),P(Y.id,Me,Oe)||(Ie[gt][Ve]+=Qe*ut));nt=me-ee/2,mt=ce-q/2,ht=ei(e.ground,_,we,ut),Qe=we.dot(Oe);for(let gt=0;gt0&&(Re.set(Ue,nt+(gt+.5)*$),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(Ve+.5)*le),P(Y.id,Me,Oe)||(ve[gt][Ve]+=Qe*ut));ht=ei(e.ground,_,Se,ut),Qe=Se.dot(Oe);for(let gt=0;gt0&&(Re.set(qe,nt+(gt+.5)*$),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(Ve+.5)*le),P(Y.id,Me,Oe)||(ze[gt][Ve]+=Qe*ut))}}ve=ye.transpose(ve),ze=ye.transpose(ze);const Fe=Ce*m/60,He=Fe>Ht?d.sunshineHours[_]/(30*Fe*e.timesPerHour):0;j(Pe,He),j(pe,He),j(Ie,He),j(ve,He),j(ze,He),i(Y.id+"-top",Pe),i(Y.id+"-south",pe),i(Y.id+"-north",Ie),i(Y.id+"-west",ve),i(Y.id+"-east",ze)},b=Y=>{const O=f.getFullYear(),_=f.getMonth(),G=f.getDate(),Q=ye.dayOfYear(f),oe=Y.lx,ee=Y.ly,q=Y.lz,ae=Math.max(2,Math.round(oe/w)),Z=Math.max(2,Math.round(ee/w)),ne=oe/ae,te=ee/Z,$=Y.cx-oe/2,le=Y.cy-ee/2,de=new _t(Y.cx,Y.cy),he=new ue,me=Array(ae).fill(0).map(()=>Array(Z).fill(0));let ce=0;for(let Ie=0;Ie<24;Ie++)for(let ve=0;ve0){ce++;const se=Si(Ae,Q,p,hi.SPHERE_MODEL),ge=ei(e.ground,_,Oo,se),we=Oo.dot(Ae),Se=new _t;for(let Me=0;Me0&&(Se.set($+(Me+.5)*ne,le+(Ce+.5)*te),Se.rotateAround(de,Y.rotation[2]),he.set(Se.x,Se.y,q),P(Y.id,he,Ae)||(me[Me][Ce]+=we*se))}}const Pe=ce*m/60,pe=Pe>Ht?d.sunshineHours[_]/(30*Pe*e.timesPerHour):0;j(me,pe),i(Y.id,me)},T=Y=>{const O=Y.solarUpdraftTower;if(!O)return;const _=f.getFullYear(),G=f.getMonth(),Q=f.getDate(),oe=ye.dayOfYear(f),ee=O.collectorRadius,q=Math.max(2,Math.round(ee*2/w)),ae=Y.cx-ee+w/2,Z=Y.cy-ee+w/2,ne=Y.lz+O.collectorHeight,te=Array(q).fill(0).map(()=>Array(q).fill(0)),$=new ue(0,0,ne),le=ee*ee;let de=0,he,me;for(let pe=0;pe<24;pe++)for(let Ie=0;Ie0){de++;const Ae=Si(ze,oe,p,hi.SPHERE_MODEL),se=ei(e.ground,G,Oo,Ae),ge=Oo.dot(ze);for(let we=0;wele)&&(te[we][Se]+=se,ge>0&&(P(Y.id+"-sut",$,ze)||(te[we][Se]+=ge*Ae)))}}}const ce=de*m/60,Pe=ce>Ht?d.sunshineHours[G]/(30*ce*e.timesPerHour):0;j(te,Pe),i(Y.id+"-sut",te)},R=Y=>{if(Y.trackerType!==Bl.NO_TRACKER)throw new Error("trackers cannot use static simulation");let O=o(Y);if(!O)throw new Error("parent of solar panel does not exist");const _=Y.parentType===z.Roof,G=Y.parentType===z.Wall;if(_&&(O=r(O),!O))throw new Error("foundation of solar panel does not exist");const Q=G?ye.absoluteCoordinates(Y.cx,Y.cy,Y.cz,O,r(Y),Y.lz):ye.absoluteCoordinates(Y.cx,Y.cy,Y.cz,O,void 0,void 0,!0),oe=new ue().fromArray(Y.normal);G&&oe.applyEuler(new cn(0,0,O.relativeAngle));const ee=O.rotation[2];let q=ee+(G?0:Y.relativeAzimuth),ae=Y.tiltAngle,Z=!0;if(_&&(Q.z=Y.cz+Y.lz+.02+O.cz,ye.isZero(Y.rotation[0])?Q.z+=Y.poleHeight:(ae=Y.rotation[0],q=ee,Z=!1)),G&&!ye.isZero(Y.tiltAngle)){const Te=O,Re=r(O),_e=(Re?Re.rotation[2]+Te.relativeAngle:Te.relativeAngle)-$t,Ue=Y.ly*Math.abs(Math.sin(Y.tiltAngle))/2;Q.x+=Ue*Math.cos(_e),Q.y+=Ue*Math.sin(_e)}const ne=new cn(_&&!Z?0:ae,0,q,"ZYX");oe.applyEuler(ne);const te=f.getFullYear(),$=f.getMonth(),le=f.getDate(),de=ye.dayOfYear(f),he=Y.lx,me=Y.ly,ce=Math.max(2,Math.round(Y.lx/w)),Pe=Math.max(2,Math.round(Y.ly/w)),pe=he/ce,Ie=me/Pe,ve=Q.x-(he-w)/2,ze=Q.y-(me-w)/2,Ae=_||G?Q.z:O.lz+Y.poleHeight+Y.lz,se=new _t(Q.x,Q.y),ge=new ue,we=Array(ce).fill(0).map(()=>Array(Pe).fill(0));let Se=0;if(_&&!Z&&(ne.x=Y.rotation[0],ne.z=Y.rotation[2]+ee),G){const Te=o(Y);Te&&(ne.x=$t+Y.tiltAngle,ne.z=O.relativeAngle+Te.rotation[2])}for(let Te=0;Te<24;Te++)for(let Re=0;Re0){Se++;const Ue=Si(_e,de,p,hi.SPHERE_MODEL),qe=ei(e.ground,$,oe,Ue),Fe=oe.dot(_e),He=new _t,Le=new ue;for(let Ye=0;Ye0&&(He.set(ve+Ye*pe,ze+lt*Ie),Le.set(He.x-se.x,He.y-se.y,0),Le.applyEuler(ne),ge.set(Q.x+Le.x,Q.y+Le.y,Ae+Le.z),P(Y.id,ge,_e)||(we[Ye][lt]+=Fe*Ue))}}const Me=Se*m/60,Ce=Me>Ht?d.sunshineHours[$]/(30*Me*e.timesPerHour):0;j(we,Ce),i(Y.id,we)},M=Y=>{const O=o(Y);if(!O)throw new Error("parent of solar water heater does not exist");const _=r(O);if(!_)throw new Error("foundation of solar water heater does not exist");const G=ye.absoluteCoordinates(Y.cx,Y.cy,Y.cz,_,void 0,void 0,!0),Q=new cn,oe=(Y.lz-Y.waterTankRadius)/2,ee=Math.atan2(Y.lz-Y.waterTankRadius,Y.ly);ye.isZero(Y.rotation[0])?(Q.set(ee,0,Y.relativeAzimuth+_.rotation[2],"ZXY"),G.z+=oe):(Q.set(Y.rotation[0]+ee,0,Y.rotation[2]+_.rotation[2],"ZXY"),G.add(new ue(0,0,oe).applyEuler(Q)));const ae=new ue(0,0,1).applyEuler(Q),Z=f.getFullYear(),ne=f.getMonth(),te=f.getDate(),$=ye.dayOfYear(f),le=Y.lx,de=Math.hypot(Y.ly,Y.lz-Y.waterTankRadius),he=Math.max(2,Math.round(Y.lx/w)),me=Math.max(2,Math.round(Y.ly/w)),ce=le/he,Pe=de/me,pe=-(le-w)/2,Ie=-(de-w)/2,ve=Array(he).fill(0).map(()=>Array(me).fill(0));let ze=0;for(let ge=0;ge<24;ge++)for(let we=0;we0){ze++;const Ce=Si(Me,$,p,hi.SPHERE_MODEL),Te=ei(e.ground,ne,ae,Ce),Re=ae.dot(Me),Ne=new _t,_e=new ue;for(let Ue=0;Ue0&&(Ne.set(pe+Ue*ce,Ie+qe*Pe),_e.set(Ne.x,Ne.y,0).applyEuler(Q).add(G),P(Y.id,_e,Me)||(ve[Ue][qe]+=Re*Ce))}}const Ae=ze*m/60,se=Ae>Ht?d.sunshineHours[ne]/(30*Ae*e.timesPerHour):0;j(ve,se),i(Y.id,ve)},D=Y=>{const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=f.getFullYear(),G=f.getMonth(),Q=f.getDate(),oe=ye.dayOfYear(f),ee=Y.lx,q=ye.getHighestPointOfWall(Y),ae=Math.max(2,Math.round(ee/w)),Z=Math.max(2,Math.round(q/w)),ne=ee/ae,te=q/Z,$=O.rotation[2]+Y.relativeAngle,le=ye.wallAbsolutePosition(new ue(Y.cx,Y.cy,q/2),O).setZ(q/2+O.lz),de=new ue(Math.cos($-$t),Math.sin($-$t),0),he=new ue,me=Array(ae).fill(0).map(()=>Array(Z).fill(0));let ce=0;const Pe=ne*Math.cos($),pe=ne*Math.sin($),Ie=ye.getWallVertices(Y,2),ve=(q-Y.lz)/2;for(let se=0;se<24;se++)for(let ge=0;ge0){ce++;const Me=Si(Se,oe,p,hi.SPHERE_MODEL),Ce=ei(e.ground,G,de,Me),Te=de.dot(Se);for(let Re=0;Re0&&(he.set(le.x+_e*Pe,le.y+_e*pe,le.z+Ue*te),P(Y.id,he,Se)||(me[Re][Ne]+=Te*Me)))}}}const ze=ce*m/60,Ae=ze>Ht?d.sunshineHours[G]/(30*ze*e.timesPerHour):0;j(me,Ae),i(Y.id,me)},k=Y=>{const O=r(Y);if(!O)throw new Error("foundation of door not found");const _=o(Y);if(!_)throw new Error("parent of door not found");const G=_,Q=f.getFullYear(),oe=f.getMonth(),ee=f.getDate(),q=ye.dayOfYear(f),ae=Y.lx*G.lx,Z=Y.lz*G.lz,ne=Math.max(2,Math.round(ae/w)),te=Math.max(2,Math.round(Z/w)),$=ae/ne,le=Z/te,de=O.rotation[2]+G.relativeAngle,me=ye.wallAbsolutePosition(new ue(G.cx,G.cy,G.cz),O).setZ(G.lz/2+O.lz).clone().add(new ue(Y.cx*G.lx,0,Y.cz*G.lz)),ce=new ue(Math.cos(de-$t),Math.sin(de-$t),0),Pe=new ue,pe=Array(ne).fill(0).map(()=>Array(te).fill(0));let Ie=0;const ve=$*Math.cos(de),ze=$*Math.sin(de);for(let ge=0;ge<24;ge++)for(let we=0;we0){Ie++;const Ce=Si(Me,q,p,hi.SPHERE_MODEL),Te=ei(e.ground,oe,ce,Ce),Re=ce.dot(Me);if(Y.doorType===Wd.Arched)for(let Ne=0;Ne0&&(P(Y.id,Pe,Me)||(pe[Ne][_e]+=Re*Ce)))}else for(let Ne=0;Ne0&&(Pe.set(me.x+Ue*ve,me.y+Ue*ze,me.z+qe*le),P(Y.id,Pe,Me)||(pe[Ne][_e]+=Re*Ce))}}}const Ae=Ie*m/60,se=Ae>Ht?d.sunshineHours[oe]/(30*Ae*e.timesPerHour):0;j(pe,se),i(Y.id,pe)},N=Y=>{if(Y.roofType!==Zo.Pyramid)throw new Error("roof is not pyramid");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),q=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const $=Y.id+"-"+ne,le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze),Se=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);Se.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2);let Me=0;const Ce=new ue;for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Me++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Ce.copy(Se).add(lt).add(we.clone().multiplyScalar(Oe)),P($,Ce,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Me*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i($,Ae)}}},U=Y=>{if(Y.roofType!==Zo.Mansard)throw new Error("roof is not mansard");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),q=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const $=Y.id+"-"+ne;if(ne===_.length-1){let le=Number.MAX_VALUE,de=Number.MAX_VALUE,he=-Number.MAX_VALUE,me=-Number.MAX_VALUE;for(const Me of te){const Ce=Me.clone().applyEuler(Z);Ce.x>he&&(he=Ce.x),Ce.xme&&(me=Ce.y),Ce.yArray(pe).fill(0)),Ae=new ue(le+w/2,de+w/2,O.lz+ce+Zu);let se=0;const ge=new ue(0,0,Ae.z);for(let Me=0;Me<24;Me++)for(let Ce=0;Ce0){se++;const Ne=Si(Re,ae,p,hi.SPHERE_MODEL),_e=ei(e.ground,ee,Oo,Ne),Ue=Oo.dot(Re);for(let qe=0;qe0&&(ge.y=Ae.y+Fe*ve,P($,ge,Re)||(ze[qe][Fe]+=Ue*Ne))}}}const we=se*m/60,Se=we>Ht?d.sunshineHours[ee]/(30*we*e.timesPerHour):0;j(ze,Se),i($,ze)}else{const le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze),Se=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);Se.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2);let Me=0;const Ce=new ue;for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Me++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Ce.copy(Se).add(lt).add(we.clone().multiplyScalar(Oe)),P($,Ce,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Me*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i($,Ae)}}}},W=Y=>{if(Y.roofType!==Zo.Gambrel)throw new Error("roof is not gambrel");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),q=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const $=Y.id+"-"+ne,le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze),Se=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);Se.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2);let Me=0;const Ce=new ue;for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Me++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Ce.copy(Se).add(lt).add(we.clone().multiplyScalar(Oe)),P($,Ce,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Me*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i($,Ae)}}},F=Y=>{if(Y.roofType!==Zo.Hip)throw new Error("roof is not hip");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),q=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const $=Y.id+"-"+ne,le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze);let Se=0;const Me=new ue,Ce=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);if(Ce.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2),ne%2===0)for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Se++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Me.copy(Ce).add(lt).add(we.clone().multiplyScalar(Oe)),P($,Me,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}else for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Se++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Me.copy(Ce).add(lt).add(we.clone().multiplyScalar(Oe)),P($,Me,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Se*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i($,Ae)}}},E=(Y,O,_)=>{const G=f.getFullYear(),Q=f.getMonth(),oe=f.getDate(),ee=ye.dayOfYear(f),q=new cn(0,0,O.rotation[2],"ZYX"),ae=_[0][0].z;let Z=Number.MAX_VALUE,ne=Number.MAX_VALUE,te=-Number.MAX_VALUE,$=-Number.MAX_VALUE;for(const Ae of _)for(const se of Ae){const ge=se.clone().applyEuler(q);ge.x>te&&(te=ge.x),ge.x$&&($=ge.y),ge.yArray(de).fill(0)),Pe=new ue(Z+w/2,ne+w/2,O.lz+ae+Zu);let pe=0;const Ie=new ue(0,0,Pe.z);for(let Ae=0;Ae<24;Ae++)for(let se=0;se0){pe++;const Se=Si(we,ee,p,hi.SPHERE_MODEL),Me=ei(e.ground,Q,Oo,Se),Ce=Oo.dot(we);for(let Te=0;Te0&&(Ie.y=Pe.y+Re*me,P(Y.id,Ie,we)||(ce[Te][Re]+=Ce*Se))}}}const ve=pe*m/60,ze=ve>Ht?d.sunshineHours[Q]/(30*ve*e.timesPerHour):0;j(ce,ze),i(Y.id,ce)},L=Y=>{if(Y.roofType!==Zo.Gable)throw new Error("roof is not gable");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;const G=f.getFullYear(),Q=f.getMonth(),oe=f.getDate(),ee=ye.dayOfYear(f),q=new cn(0,0,O.rotation[2],"ZYX");for(const[ae,Z]of _.entries()){const ne=Y.id+"-"+ae,te=Z[0].clone().applyEuler(q),$=Z[1].clone().applyEuler(q),le=Z[2].clone().applyEuler(q),de=new ue().subVectors($,te),he=new ue().subVectors(le,te),me=new ue().subVectors(le,$),ce=de.length(),Pe=new ue().crossVectors(he,me).length()/ce,pe=Math.max(2,Math.round(ce/w)),Ie=Math.max(2,Math.round(Pe/w)),ve=Array(pe).fill(0).map(()=>Array(Ie).fill(0));de.normalize(),he.normalize(),me.normalize();const ze=new ue().crossVectors(he,me).normalize(),Ae=de.multiplyScalar(.5*ce/pe),se=new ue().crossVectors(ze,de).normalize().multiplyScalar(.5*Pe/Ie),ge=new ue(O.cx+te.x,O.cy+te.y,O.lz+te.z+Zu);ge.add(Ae).add(se),Ae.multiplyScalar(2),se.multiplyScalar(2);let we=0;const Se=new ue;for(let Te=0;Te<24;Te++)for(let Re=0;Re0){we++;const Ue=Si(_e,ee,p,hi.SPHERE_MODEL),qe=ei(e.ground,Q,ze,Ue),Fe=ze.dot(_e);for(let He=0;He0&&(Se.copy(ge).add(Le).add(se.clone().multiplyScalar(Ye)),P(ne,Se,_e)||(ve[He][Ye]+=Fe*Ue))}}}const Me=we*m/60,Ce=Me>Ht?d.sunshineHours[Q]/(30*Me*e.timesPerHour):0;j(ve,Ce),i(ne,ve)}},j=(Y,O)=>{for(let _=0;_{const e=H(pn),n=dt(kf),o=H.getState().world,r=H.getState().elements,i=H($r),a=H(p4),l=In(e5e),s=In(QGe),c=dt(BN),u=dt(pPt),d=H(V2e),f=In(n5e),{scene:p}=ti(),m=Kt(),y=_1(t),w=new Date(o.date),x=t?y==null?void 0:y.elevation:0,C=60/o.timesPerHour,P=g.useMemo(()=>new yu,[]),A=o.solarRadiationHeatmapGridCellSize??.5,S=g.useRef([]),v=g.useRef([]),b=g.useRef(0),T=g.useRef(!1),R=g.useRef(new Date(o.date)),M=g.useRef(new Map),D=g.useRef(!1),k=g.useRef(new Date(o.date)),N=g.useMemo(()=>pl(w,o.latitude),[o.date,o.latitude]);g.useEffect(()=>{if(c)return U(),b.current=requestAnimationFrame(E),()=>{cancelAnimationFrame(b.current),T.current||(yn(B.t("message.SimulationAborted",m)),e(ce=>{ce.world.date=R.current.toLocaleString("en-US")}),n("simulationInProgress",!1))}},[c]),g.useEffect(()=>{D.current=u,u?(k.current=new Date(w.getTime()),cancelAnimationFrame(b.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",m))):(n("simulationPaused",!1),E())},[u]);const U=()=>{n("simulationInProgress",!0),w.setHours(Math.floor(N.sunrise/60),N.sunrise%60),R.current=new Date(o.date),T.current=!1,j();for(const ce of r)switch(ce.type){case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{M.current.delete(ce.id);break}case z.Cuboid:{M.current.delete(ce.id+"-top"),M.current.delete(ce.id+"-north"),M.current.delete(ce.id+"-south"),M.current.delete(ce.id+"-west"),M.current.delete(ce.id+"-east");break}case z.Roof:{const Pe=ce,pe=f(Pe.id);if(pe){const Ie=pe.length;for(let ve=0;ve{s();const ce=N.daylight()/60,Pe=ce>Ht?y.sunshineHours[w.getMonth()]/(30*ce*o.timesPerHour):0;for(const pe of r){switch(pe.type){case z.Foundation:case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{const Ie=M.current.get(pe.id);if(Ie){for(let ve=0;ve[...ve]))}break}case z.Cuboid:{F(pe.id,"top",Pe),F(pe.id,"south",Pe),F(pe.id,"north",Pe),F(pe.id,"west",Pe),F(pe.id,"east",Pe);break}case z.Roof:{const Ie=pe,ve=f(Ie.id);if(ve&&ve.length>0){if(Ie.roofType===Zo.Pyramid||Ie.roofType===Zo.Mansard||Ie.roofType===Zo.Gambrel||Ie.roofType===Zo.Hip){let ze=!0;const Ae=ve[0][0].z;for(const se of ve)for(const ge of se)if(Math.abs(ge.z-Ae)>.01){ze=!1;break}if(ze){const se=M.current.get(Ie.id);if(se){for(let ge=0;ge[...ge]))}break}}for(let ze=0;ze[...ge]))}}}break}}if(pe.type===z.Foundation){const Ie=pe;if(Ie.solarStructure===Nn.UpdraftTower&&Ie.solarUpdraftTower){const ve=pe.id+"-sut",ze=M.current.get(ve);if(ze){for(let Ae=0;Ae[...Ae]))}}}}},F=(ce,Pe,pe)=>{const Ie=M.current.get(ce+"-"+Pe);if(Ie){for(let ve=0;ve{if(c&&!D.current){if(w.getMinutes()+w.getHours()*60>=N.sunset){cancelAnimationFrame(b.current),dt.getState().set(Pe=>{Pe.runDynamicSimulation=!1}),e(Pe=>{Pe.world.date=R.current.toLocaleString("en-US")}),yn(B.t("message.SimulationCompleted",m)),T.current=!0,W(),setTimeout(()=>{n("simulationInProgress",!1),n("showSolarRadiationHeatmap",!0)},10);return}if(w.setHours(w.getHours(),w.getMinutes()+C),e(Pe=>{Pe.world.date=w.toLocaleString("en-US")}),d)for(const Pe of r)switch(Pe.type){case z.FresnelReflector:de(Pe);break;case z.Heliostat:he(Pe);break}else for(const Pe of r)switch(Pe.type){case z.Foundation:{const pe=Pe;O(pe),pe.solarStructure===Nn.UpdraftTower&&me(pe);break}case z.Cuboid:{Y(Pe);break}case z.SolarPanel:{ne(Pe);break}case z.SolarWaterHeater:{te(Pe);break}case z.ParabolicTrough:{$(Pe);break}case z.ParabolicDish:{le(Pe);break}case z.FresnelReflector:{de(Pe);break}case z.Heliostat:{he(Pe);break}case z.Wall:{_(Pe);break}case z.Door:{G(Pe);break}case z.Roof:{const pe=Pe;switch(pe.roofType){case Zo.Pyramid:oe(pe);break;case Zo.Gable:Z(pe);break;case Zo.Gambrel:q(pe);break;case Zo.Mansard:ee(pe);break;case Zo.Hip:ae(pe);break}break}}b.current=requestAnimationFrame(E)}},L=(ce,Pe,pe)=>{if(S.current.length>1){v.current.length=0,P.set(Pe,pe);const Ie=S.current.filter(ve=>ve.uuid!==ce);return P.intersectObjects(Ie,!1,v.current),v.current.length>0}return!1},j=()=>{const ce=p.children.filter(Pe=>Pe.name==="Content");if(ce.length>0){const Pe=ce[0].children;S.current.length=0;for(const pe of Pe)ye.fetchSimulationElements(pe,S.current)}},Y=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=ye.dayOfYear(w),Ie=ce.lx,ve=ce.ly,ze=ce.lz,Ae=Math.max(2,Math.round(Ie/A)),se=Math.max(2,Math.round(ve/A)),ge=Math.max(2,Math.round(ze/A)),we=Ie/Ae,Se=ve/se,Me=ze/ge;let Ce=M.current.get(ce.id+"-top");(!Ce||Ce.length!==Ae||Ce[0].length!==se)&&(Ce=Array(Ae).fill(0).map(()=>Array(se).fill(0)),M.current.set(ce.id+"-top",Ce));let Te=M.current.get(ce.id+"-south");(!Te||Te.length!==Ae||Te[0].length!==ge)&&(Te=Array(Ae).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-south",Te));let Re=M.current.get(ce.id+"-north");(!Re||Re.length!==Ae||Re[0].length!==ge)&&(Re=Array(Ae).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-north",Re));let Ne=M.current.get(ce.id+"-west");(!Ne||Ne.length!==se||Ne[0].length!==ge)&&(Ne=Array(se).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-west",Ne));let _e=M.current.get(ce.id+"-east");(!_e||_e.length!==se||_e[0].length!==ge)&&(_e=Array(se).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-east",_e));const Ue=Oo,qe=T1.clone().applyAxisAngle(Oo,ce.rotation[2]),Fe=Zc.clone().applyAxisAngle(Oo,ce.rotation[2]),He=S1.clone().applyAxisAngle(Oo,ce.rotation[2]),Le=b1.clone().applyAxisAngle(Oo,ce.rotation[2]),Ye=i(ce);let lt=ce.cx,Oe=ce.cy,ut=ce.cz;if(Ye&&Ye.type===z.Cuboid){const zt=ye.getWorldDataById(ce.id);lt=zt.pos.x,Oe=zt.pos.y,ut=zt.pos.z}const ht=new ue,Qe=new _t(lt,Oe),nt=new _t,mt=Oe-ve/2,tt=Oe+ve/2,gt=lt-Ie/2,Ve=lt+Ie/2,je=Si(Pe,pe,x,hi.SPHERE_MODEL);let et=ei(o.ground,w.getMonth(),Ue,je),bt=Ue.dot(Pe),St=lt-Ie/2,Pt=Oe-ve/2;const Yt=ut+ze/2;for(let zt=0;zt0&&(nt.set(St+(zt+.5)*we,Pt+(Rt+.5)*Se),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Yt),L(ce.id,ht,Pe)||(Ce[zt][Rt]+=bt*je));St=lt-Ie/2,Pt=ut-ze/2,et=ei(o.ground,w.getMonth(),qe,je),bt=qe.dot(Pe);for(let zt=0;zt0&&(nt.set(St+(zt+.5)*we,mt),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(Rt+.5)*Me),L(ce.id,ht,Pe)||(Te[zt][Rt]+=bt*je));et=ei(o.ground,w.getMonth(),Fe,je),bt=Fe.dot(Pe);for(let zt=0;zt0&&(nt.set(St+(zt+.5)*we,tt),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(ge-(Rt+.5))*Me),L(ce.id,ht,Pe)||(Re[zt][Rt]+=bt*je));St=Oe-ve/2,Pt=ut-ze/2,et=ei(o.ground,w.getMonth(),He,je),bt=He.dot(Pe);for(let zt=0;zt0&&(nt.set(gt,St+(zt+.5)*Se),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(Rt+.5)*Me),L(ce.id,ht,Pe)||(Ne[zt][Rt]+=bt*je));et=ei(o.ground,w.getMonth(),Le,je),bt=Le.dot(Pe);for(let zt=0;zt0&&(nt.set(Ve,St+(zt+.5)*Se),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(Rt+.5)*Me),L(ce.id,ht,Pe)||(_e[zt][Rt]+=bt*je))},O=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=ye.dayOfYear(w),Ie=ce.lx,ve=ce.ly,ze=ce.lz,Ae=Math.max(2,Math.round(Ie/A)),se=Math.max(2,Math.round(ve/A)),ge=Ie/Ae,we=ve/se,Se=ce.cx-Ie/2,Me=ce.cy-ve/2,Ce=new _t(ce.cx,ce.cy),Te=new ue;let Re=M.current.get(ce.id);(!Re||Re.length!==Ae||Re[0].length!==se)&&(Re=Array(Ae).fill(0).map(()=>Array(se).fill(0)),M.current.set(ce.id,Re));const Ne=Si(Pe,pe,x,hi.SPHERE_MODEL),_e=ei(o.ground,w.getMonth(),Oo,Ne),Ue=Oo.dot(Pe),qe=new _t;for(let Fe=0;Fe0&&(qe.set(Se+(Fe+.5)*ge,Me+(He+.5)*we),qe.rotateAround(Ce,ce.rotation[2]),Te.set(qe.x,qe.y,ze),L(ce.id,Te,Pe)||(Re[Fe][He]+=Ue*Ne))},_=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=ye.dayOfYear(w),ve=ce.lx,ze=ye.getHighestPointOfWall(ce),Ae=Math.max(2,Math.round(ve/A)),se=Math.max(2,Math.round(ze/A)),ge=ve/Ae,we=ze/se,Se=pe.rotation[2]+ce.relativeAngle,Me=ye.wallAbsolutePosition(new ue(ce.cx,ce.cy,ce.cz),pe).setZ(ze/2+pe.lz),Ce=new ue(Math.cos(Se-$t),Math.sin(Se-$t),0),Te=ge*Math.cos(Se),Re=ge*Math.sin(Se),Ne=new ue;let _e=M.current.get(ce.id);(!_e||_e.length!==Ae||_e[0].length!==se)&&(_e=Array(Ae).fill(0).map(()=>Array(se).fill(0)),M.current.set(ce.id,_e));const Ue=ye.getWallVertices(ce,1),qe=(ze-ce.lz)/2,Fe=Si(Pe,Ie,x,hi.SPHERE_MODEL),He=ei(o.ground,w.getMonth(),Ce,Fe),Le=Ce.dot(Pe);for(let Ye=0;Ye0&&(Ne.set(Me.x+Oe*Te,Me.y+Oe*Re,Me.z+ut*we),L(ce.id,Ne,Pe)||(_e[Ye][lt]+=Le*Fe)))}},G=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of door not found");const Ie=i(ce);if(!Ie)throw new Error("parent of door not found");const ve=ye.dayOfYear(w),ze=Ie,Ae=ce.lx*ze.lx,se=ce.lz*ze.lz,ge=Math.max(2,Math.round(Ae/A)),we=Math.max(2,Math.round(se/A)),Se=Ae/ge,Me=se/we,Ce=pe.rotation[2]+ze.relativeAngle,Re=ye.wallAbsolutePosition(new ue(ze.cx,ze.cy,ze.cz),pe).setZ(ze.lz/2+pe.lz).clone().add(new ue(ce.cx*ze.lx,0,ce.cz*ze.lz)),Ne=new ue(Math.cos(Ce-$t),Math.sin(Ce-$t),0),_e=Se*Math.cos(Ce),Ue=Se*Math.sin(Ce),qe=new ue;let Fe=M.current.get(ce.id);(!Fe||Fe.length!==ge||Fe[0].length!==we)&&(Fe=Array(ge).fill(0).map(()=>Array(we).fill(0)),M.current.set(ce.id,Fe));const He=Si(Pe,ve,x,hi.SPHERE_MODEL),Le=ei(o.ground,w.getMonth(),Ne,He),Ye=Ne.dot(Pe);if(ce.doorType===Wd.Arched)for(let lt=0;lt0&&(L(ce.id,qe,Pe)||(Fe[lt][Oe]+=Ye*He)))}else for(let lt=0;lt0){const ut=lt-ge/2+.5,ht=Oe-we/2+.5;qe.set(Re.x+ut*_e,Re.y+ut*Ue,Re.z+ht*Me),L(ce.id,qe,Pe)||(Fe[lt][Oe]+=Ye*He)}},Q=(ce,Pe,pe,Ie)=>{const ve=Ie[0][0].z,ze=ye.dayOfYear(w),Ae=Si(ce,ze,x,hi.SPHERE_MODEL),se=new cn(0,0,pe.rotation[2],"ZYX");let ge=Number.MAX_VALUE,we=Number.MAX_VALUE,Se=-Number.MAX_VALUE,Me=-Number.MAX_VALUE;for(const Le of Ie)for(const Ye of Le){const lt=Ye.clone().applyEuler(se);lt.x>Se&&(Se=lt.x),lt.xMe&&(Me=lt.y),lt.yArray(Te).fill(0)),M.current.set(Pe.id,_e));const Ue=new ue(ge+A/2,we+A/2,pe.lz+ve+Zu),qe=new ue(0,0,Ue.z),Fe=ei(o.ground,w.getMonth(),Oo,Ae),He=Oo.dot(ce);for(let Le=0;Le0&&(qe.y=Ue.y+Ye*Ne,L(Pe.id,qe,ce)||(_e[Le][Ye]+=He*Ae))}},oe=ce=>{if(ce.roofType!==Zo.Pyramid)throw new Error("roof is not pyramid");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we,Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);ht.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const Qe=new ue,nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(Qe.copy(ht).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,Qe,Pe)||(Ye[tt][Ve]+=mt*ge))}}}},ee=ce=>{if(ce.roofType!==Zo.Mansard)throw new Error("roof is not mansard");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we;if(we===Ie.length-1){let Ce=Number.MAX_VALUE,Te=Number.MAX_VALUE,Re=-Number.MAX_VALUE,Ne=-Number.MAX_VALUE;for(const ht of Se){const Qe=ht.clone().applyEuler(se);Qe.x>Re&&(Re=Qe.x),Qe.xNe&&(Ne=Qe.y),Qe.yArray(qe).fill(0)),M.current.set(Me,Le));const Ye=new ue(Ce+A/2,Te+A/2,pe.lz+_e+Zu),lt=new ue(0,0,Ye.z),Oe=ei(o.ground,w.getMonth(),Oo,ge),ut=Oo.dot(Pe);for(let ht=0;ht0&&(lt.y=Ye.y+Qe*He,L(Me,lt,Pe)||(Le[ht][Qe]+=ut*ge))}}else{const Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);ht.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const Qe=new ue,nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(Qe.copy(ht).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,Qe,Pe)||(Ye[tt][Ve]+=mt*ge))}}}}},q=ce=>{if(ce.roofType!==Zo.Gambrel)throw new Error("roof is not gambrel");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we,Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);ht.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const Qe=new ue,nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(Qe.copy(ht).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,Qe,Pe)||(Ye[tt][Ve]+=mt*ge))}}}},ae=ce=>{if(ce.roofType!==Zo.Hip)throw new Error("roof is not hip");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we,Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue,Qe=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);Qe.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(ht.copy(Qe).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,ht,Pe)||(Ye[tt][Ve]+=mt*ge))}}}},Z=ce=>{if(ce.roofType!==Zo.Gable)throw new Error("roof is not gable");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;const ve=ye.dayOfYear(w),ze=new cn(0,0,pe.rotation[2],"ZYX"),Ae=Si(Pe,ve,x,hi.SPHERE_MODEL);for(const[se,ge]of Ie.entries()){const we=ce.id+"-"+se,Se=ge[0].clone().applyEuler(ze),Me=ge[1].clone().applyEuler(ze),Ce=ge[2].clone().applyEuler(ze),Te=new ue().subVectors(Me,Se),Re=new ue().subVectors(Ce,Se),Ne=new ue().subVectors(Ce,Me),_e=Te.length(),Ue=new ue().crossVectors(Re,Ne).length()/_e,qe=Math.max(2,Math.round(_e/A)),Fe=Math.max(2,Math.round(Ue/A));let He=M.current.get(we);(!He||He.length!==qe||He[0].length!==Fe)&&(He=Array(qe).fill(0).map(()=>Array(Fe).fill(0)),M.current.set(we,He)),Te.normalize(),Re.normalize(),Ne.normalize();const Le=new ue().crossVectors(Re,Ne).normalize(),Ye=Te.multiplyScalar(.5*_e/qe),lt=new ue().crossVectors(Le,Te).normalize().multiplyScalar(.5*Ue/Fe),Oe=new ue(pe.cx+Se.x,pe.cy+Se.y,pe.lz+Se.z+Zu);Oe.add(Ye).add(lt),Ye.multiplyScalar(2),lt.multiplyScalar(2);const ut=new ue,ht=ei(o.ground,w.getMonth(),Le,Ae),Qe=Le.dot(Pe);for(let nt=0;nt0&&(ut.copy(Oe).add(mt).add(lt.clone().multiplyScalar(tt)),L(we,ut,Pe)||(He[nt][tt]+=Qe*Ae))}}},ne=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;let pe=i(ce);if(!pe)throw new Error("parent of solar panel does not exist");const Ie=ce.parentType===z.Roof,ve=ce.parentType===z.Wall;if(Ie&&(pe=a(pe),!pe))throw new Error("foundation of solar panel does not exist");const ze=ye.dayOfYear(w),Ae=ve?ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe,a(ce),ce.lz):ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe,void 0,void 0,!0),se=pe.rotation[2];let ge=se+(ve?0:ce.relativeAzimuth),we=ce.tiltAngle,Se=!0;if(Ie&&(Ae.z=ce.cz+ce.lz+.02+pe.cz,ye.isZero(ce.rotation[0])?Ae.z+=ce.poleHeight:(we=ce.rotation[0],ge=se,Se=!1)),ve&&!ye.isZero(ce.tiltAngle)){const tt=pe,gt=a(pe),je=(gt?gt.rotation[2]+tt.relativeAngle:tt.relativeAngle)-$t,et=ce.ly*Math.abs(Math.sin(ce.tiltAngle))/2;Ae.x+=et*Math.cos(je),Ae.y+=et*Math.sin(je)}const Me=new ue().fromArray(ce.normal),Ce=ce.lx,Te=ce.ly,Re=Math.max(2,Math.round(ce.lx/A)),Ne=Math.max(2,Math.round(ce.ly/A)),_e=Ce/Re,Ue=Te/Ne,qe=Ae.x-(Ce-A)/2,Fe=Ae.y-(Te-A)/2,He=Ie||ve?Ae.z:pe.lz+ce.poleHeight+ce.lz,Le=new _t(Ae.x,Ae.y),Ye=new ue;let lt=M.current.get(ce.id);(!lt||lt.length!==Re||lt[0].length!==Ne)&&(lt=Array(Re).fill(0).map(()=>Array(Ne).fill(0)),M.current.set(ce.id,lt));let Oe=new cn(Ie&&!Se?0:we,0,ge,"ZYX");if(ce.trackerType!==Bl.NO_TRACKER){const tt=se?Pe.clone().applyAxisAngle(Oo,-se):Pe.clone();switch(ce.trackerType){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const gt=new zs().setFromUnitVectors(Oo,tt);Oe=new cn().setFromQuaternion(gt),Oe.z+=ge;break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const gt=new zs().setFromUnitVectors(Oo,new ue(tt.x,0,tt.z).normalize());Oe=new cn().setFromQuaternion(gt),Oe.z+=ge;break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{if(Math.abs(ce.tiltAngle)>.001){const gt=new ue(tt.x,-tt.y,0).normalize(),Ve=Math.acos(Zc.dot(gt))*Math.sign(gt.x);Oe=new cn(ce.tiltAngle,0,Ve+se,"ZYX")}break}case Bl.TILTED_SINGLE_AXIS_TRACKER:break}}if(ve&&Me.applyEuler(new cn(0,0,pe.relativeAngle)),Me.applyEuler(Oe),Ie&&!Se&&(Oe.x=ce.rotation[0],Oe.z=ce.rotation[2]+se),ve){const tt=i(ce);tt&&(Oe.x=$t+ce.tiltAngle,Oe.z=pe.relativeAngle+tt.rotation[2])}const ut=Si(Pe,ze,x,hi.SPHERE_MODEL),ht=ei(o.ground,w.getMonth(),Me,ut),Qe=Me.dot(Pe),nt=new _t,mt=new ue;for(let tt=0;tt0&&(nt.set(qe+tt*_e,Fe+gt*Ue),mt.set(nt.x-Le.x,nt.y-Le.y,0),mt.applyEuler(Oe),Ye.set(Ae.x+mt.x,Ae.y+mt.y,He+mt.z),L(ce.id,Ye,Pe)||(lt[tt][gt]+=Qe*ut))},te=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=i(ce);if(!pe)throw new Error("parent of solar water heater does not exist");const Ie=a(pe);if(!Ie)throw new Error("foundation of solar water heater does not exist");const ve=ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,Ie,void 0,void 0,!0),ze=new cn,Ae=(ce.lz-ce.waterTankRadius)/2,se=Math.atan2(ce.lz-ce.waterTankRadius,ce.ly);ye.isZero(ce.rotation[0])?(ze.set(se,0,ce.relativeAzimuth+Ie.rotation[2],"ZXY"),ve.z+=Ae):(ze.set(ce.rotation[0]+se,0,ce.rotation[2]+Ie.rotation[2],"ZXY"),ve.add(new ue(0,0,Ae).applyEuler(ze)));const we=ce.lx,Se=Math.hypot(ce.ly,ce.lz-ce.waterTankRadius),Me=Math.max(2,Math.round(we/A)),Ce=Math.max(2,Math.round(Se/A)),Te=we/Me,Re=Se/Ce,Ne=-(we-A)/2,_e=-(Se-A)/2;let Ue=M.current.get(ce.id);(!Ue||Ue.length!==Me||Ue[0].length!==Ce)&&(Ue=Array(Me).fill(0).map(()=>Array(Ce).fill(0)),M.current.set(ce.id,Ue));const qe=new ue(0,0,1).applyEuler(ze),Fe=Si(Pe,ye.dayOfYear(w),x,hi.SPHERE_MODEL),He=ei(o.ground,w.getMonth(),qe,Fe),Le=qe.dot(Pe),Ye=new _t,lt=new ue;for(let Oe=0;Oe0&&(Ye.set(Ne+Oe*Te,_e+ut*Re),lt.set(Ye.x,Ye.y,0).applyEuler(ze).add(ve),L(ce.id,lt,Pe)||(Ue[Oe][ut]+=Le*Fe))},$=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=i(ce);if(!pe)throw new Error("parent of parabolic trough does not exist");const Ie=ye.dayOfYear(w),ve=ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe),ze=new ue().fromArray(ce.normal),Ae=ze.clone(),se=ce.lx,ge=ce.ly,we=se*se/(4*ce.latusRectum),Se=ce.poleHeight+se/2,Me=Math.max(2,Math.round(ce.lx/A)),Ce=Math.max(2,Math.round(ce.ly/A)),Te=se/Me,Re=ge/Ce,Ne=ve.x-(se-A)/2,_e=ve.y-(ge-A)/2,Ue=pe.lz+Se+ce.lz+we,qe=new _t(ve.x,ve.y),Fe=new ue;let He=M.current.get(ce.id);(!He||He.length!==Me||He[0].length!==Ce)&&(He=Array(Me).fill(0).map(()=>Array(Ce).fill(0)),M.current.set(ce.id,He));const Le=pe.rotation[2],Ye=Le+ce.relativeAzimuth,lt=ye.isZero(Ye),Oe=lt?1:Math.cos(Ye),ut=lt?0:Math.sin(Ye),ht=Le?Pe.clone().applyAxisAngle(Oo,-Le):Pe.clone(),Qe=new zs().setFromUnitVectors(Oo,new ue(ht.x*Oe,ht.x*ut,ht.z).normalize()),nt=new cn().setFromQuaternion(Qe);ze.copy(Ae.clone().applyEuler(nt));const mt=Si(Pe,Ie,x,hi.SPHERE_MODEL),tt=ei(o.ground,w.getMonth(),ze,mt),gt=ze.dot(Pe),Ve=new _t,je=new ue;let et=0,bt=0,St=1;const Pt=4/(ce.latusRectum*ce.latusRectum);for(let Yt=0;Yt0&&(Ve.set(et,_e+zt*Re),lt||Ve.rotateAround(qe,Ye),je.set(Ve.x-qe.x,Ve.y-qe.y,0),je.applyEuler(nt),Fe.set(ve.x+je.x,ve.y+je.y,Ue+je.z),L(ce.id,Fe,Pe)||(He[Yt][zt]+=gt*mt*St))}},le=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=i(ce);if(!pe)throw new Error("parent of parabolic dish does not exist");const Ie=ye.dayOfYear(w),ve=ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe),ze=new ue().fromArray(ce.normal),Ae=ze.clone(),se=ce.lx,ge=ce.ly,we=se*se/(4*ce.latusRectum),Se=ce.poleHeight+se/2,Me=Math.max(2,Math.round(ce.lx/A)),Ce=Math.max(2,Math.round(ce.ly/A)),Te=se/Me,Re=ge/Ce,Ne=ve.x-(se-A)/2,_e=ve.y-(ge-A)/2,Ue=pe.lz+Se+ce.lz+we,qe=new _t(ve.x,ve.y),Fe=new ue;let He=M.current.get(ce.id);(!He||He.length!==Me||He[0].length!==Ce)&&(He=Array(Me).fill(0).map(()=>Array(Ce).fill(0)),M.current.set(ce.id,He));const Le=pe.rotation[2],Ye=Le+ce.relativeAzimuth,lt=ye.isZero(Ye),Oe=Le?Pe.clone().applyAxisAngle(Oo,-Le):Pe.clone(),ut=new zs().setFromUnitVectors(Oo,Oe),ht=new cn().setFromQuaternion(ut);ze.copy(Ae.clone().applyEuler(ht));const Qe=Si(Pe,Ie,x,hi.SPHERE_MODEL),nt=ei(o.ground,w.getMonth(),ze,Qe),mt=ze.dot(Pe),tt=new _t,gt=new ue;let Ve=0,je=0,et=0,bt=0,St=1;const Pt=4/(ce.latusRectum*ce.latusRectum);for(let Yt=0;Ytse/2))for(let zt=0;ztge/2)&&(He[Yt][zt]+=nt,mt>0&&(tt.set(Ve,je),lt||tt.rotateAround(qe,Ye),gt.set(tt.x-qe.x,tt.y-qe.y,0),gt.applyEuler(ht),Fe.set(ve.x+gt.x,ve.y+gt.y,Ue+gt.z),L(ce.id,Fe,Pe)||(St=1/Math.sqrt(1+(et*et+bt*bt)*Pt),He[Yt][zt]+=mt*Qe*St)))},de=ce=>{const Pe=zi(w,o.latitude);if(Pe.zArray(Te).fill(0)),M.current.set(ce.id,Le));const lt=pe.rotation[2]+ce.relativeAzimuth,Oe=ye.isZero(lt),ut=Oe?1:Math.cos(lt),ht=Oe?0:Math.sin(lt),Qe=Ie.solarStructure===Nn.FocusPipe?new ue((Ie.cx-Ae.x)*ut,(Ie.cy-Ae.y)*ht,Ie.cz-Ae.z+Ie.lz/2+(ve.absorberHeight??10)):void 0,nt=new ue(ht,ut,0),mt=new ue;let tt,gt;if(Qe){mt.set(Qe.x,Qe.y,Qe.z);const Yt=-Qe.z*(Pe.y*nt.y+Pe.x*nt.x)/Pe.z;mt.x+=Yt*nt.x,mt.y-=Yt*nt.y,gt=mt.clone().normalize();let zt=gt.add(Pe).normalize();ye.isSame(zt,Oo)&&(zt=new ue(-.001,0,1).normalize()),Oe||zt.applyAxisAngle(Oo,-lt),tt=new cn(0,Math.atan2(zt.x,zt.z),lt,"ZXY"),se.copy(ge.clone().applyEuler(tt))}else gt=new ue(0,0,1),tt=new cn;const Ve=Si(Pe,ze,x,hi.SPHERE_MODEL),je=ei(o.ground,w.getMonth(),se,Ve),et=se.dot(Pe),bt=new _t,St=new ue;let Pt=0;if(d)for(let Yt=0;Yt0&&(bt.set(Pt,Ue+zt*Ne),St.set(bt.x-Fe.x,bt.y-Fe.y,0),St.applyEuler(tt),He.set(Ae.x+St.x,Ae.y+St.y,qe+St.z),!L(ce.id,He,Pe)&&!L(ce.id,He,gt)&&(Le[Yt][zt]+=et*Ve))}else for(let Yt=0;Yt0&&(bt.set(Pt,Ue+zt*Ne),St.set(bt.x-Fe.x,bt.y-Fe.y,0),St.applyEuler(tt),He.set(Ae.x+St.x,Ae.y+St.y,qe+St.z),L(ce.id,He,Pe)||(Le[Yt][zt]+=et*Ve))}},he=ce=>{const Pe=zi(w,o.latitude);if(Pe.zArray(Te).fill(0)),M.current.set(ce.id,Le));const Ye=pe.rotation[2],lt=Ie.solarStructure===Nn.FocusTower?new ue(Ie.cx-Ae.x,Ie.cy-Ae.y,Ie.cz-Ae.z+(ve.towerHeight??20)):void 0;let Oe,ut;if(lt){Oe=lt.clone().normalize();let Ve=Oe.clone().add(Pe).normalize();ye.isSame(Ve,Oo)&&(Ve=new ue(-.001,0,1).normalize()),Ye&&Ve.applyAxisAngle(Oo,-Ye);const je=Math.hypot(Ve.x,Ve.y);ut=new cn(Math.atan2(je,Ve.z),0,Math.atan2(Ve.y,Ve.x)+$t,"ZXY"),se.copy(ge.clone().applyEuler(ut))}else Oe=new ue(0,0,1),ut=new cn;const ht=Si(Pe,ze,x,hi.SPHERE_MODEL),Qe=ei(o.ground,w.getMonth(),se,ht),nt=se.dot(Pe),mt=new _t,tt=new ue;let gt=0;if(d)for(let Ve=0;Ve0&&(mt.set(gt,Ue+je*Ne),tt.set(mt.x-Fe.x,mt.y-Fe.y,0),tt.applyEuler(ut),He.set(Ae.x+tt.x,Ae.y+tt.y,qe+tt.z),!L(ce.id,He,Pe)&&!L(ce.id,He,Oe)&&(Le[Ve][je]+=nt*ht))}else for(let Ve=0;Ve0&&(mt.set(gt,Ue+je*Ne),tt.set(mt.x-Fe.x,mt.y-Fe.y,0),tt.applyEuler(ut),He.set(Ae.x+tt.x,Ae.y+tt.y,qe+tt.z),L(ce.id,He,Pe)||(Le[Ve][je]+=nt*ht))}},me=ce=>{const Pe=ce.solarUpdraftTower;if(!Pe)return;const pe=zi(w,o.latitude);if(pe.z<=0)return;const Ie=ye.dayOfYear(w),ve=new ue().fromArray(ce.normal),ze=Pe.collectorRadius,Ae=Math.max(2,Math.round(ze*2/A)),se=ce.cx-ze+A/2,ge=ce.cy-ze+A/2,we=ce.lz+Pe.collectorHeight,Se=ce.id+"-sut";let Me=M.current.get(Se);(!Me||Me.length!==Ae||Me[0].length!==Ae)&&(Me=Array(Ae).fill(0).map(()=>Array(Ae).fill(0)),M.current.set(Se,Me));const Ce=Si(pe,Ie,x,hi.SPHERE_MODEL),Te=ei(o.ground,w.getMonth(),ve,Ce),Re=new ue(0,0,we),Ne=ve.dot(pe),_e=ze*ze;let Ue,qe;for(let Fe=0;Fe_e)&&(Me[Fe][He]+=Te,Ne>0&&(L(Se,Re,pe)||(Me[Fe][He]+=Ne*Ce)))}};return h.jsx(h.Fragment,{})}),Gtr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(GCt),s=H(GN),c=In(JCt),u=H(XN),d=H(sJe),f=H(cJe),p=In(KCt),m=dt(BCt),y=dt(YCt),w=dt(OCt),x=dt(_Ct),C=H(OGe),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),q=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyParabolicTroughYieldPanel=!0,ge.selectedFloatingWindow="dailyParabolicTroughYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForParabolicTroughs=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyParabolicTroughYield();ge.actionInfo={name:"Daily Simulation for Parabolic Troughs Completed",result:{totalYield:we},details:In.getState().dailyParabolicTroughYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicTrough&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.ParabolicTrough){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(d){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.ParabolicTrough){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Trough"+Se,Re),Me.push(Te.label??"Trough"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Trough"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.ParabolicTrough){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return $(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const $=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicTrough&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyParabolicTroughYieldPanel=!0,ge.selectedFloatingWindow="yearlyParabolicTroughYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForParabolicTroughs=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyParabolicTroughYield();ge.actionInfo={name:"Yearly Simulation for Parabolic Troughs Completed",result:{totalYield:we},details:In.getState().yearlyParabolicTroughYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.ParabolicTrough){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.ParabolicTrough){const Ce=O.current.get(Me.id);Ce&&(u(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*q),se.push(Ce),we++,ge.push(Me.label??"Trough"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*q;Se.push(Ce)}c(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.ParabolicTrough){const Se=O.current.get(we.id);Se&&(u(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*q),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*q})}c(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(Pt.set(Oe+Ct*He,ut+yt*Le),Ne||Pt.rotateAround(Qe,Re),Yt.set(Pt.x-Qe.x,Pt.y-Qe.y,0),Yt.applyEuler(et),nt.set(Me.x+Yt.x,Me.y+Yt.y,ht+Yt.z),Ie(se.id,nt,ge)||(zt+=St*bt));const Rt=Y.current.get(se.id);if(Rt){const Ct=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Rt[Ct]+=zt/(qe*Fe)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>se.lx*se.ly*se.opticalEfficiency*se.thermalEfficiency*se.absorptance*se.reflectance*(1-N[v.getMonth()]),Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.ParabolicTrough){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.ParabolicTrough){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),Xtr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(IRt),s=H(GN),c=In(DRt),u=H(XN),d=H(xJe),f=H(vJe),p=In(ERt),m=dt(PRt),y=dt(CRt),w=dt(RRt),x=dt(HRt),C=H(_Ge),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),q=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyParabolicDishYieldPanel=!0,ge.selectedFloatingWindow="dailyParabolicDishYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForParabolicDishes=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyParabolicDishYield();ge.actionInfo={name:"Daily Simulation for Parabolic Dishes Completed",result:{totalYield:we},details:In.getState().dailyParabolicDishYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicDish&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.ParabolicDish){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(d){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.ParabolicDish){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Dish"+Se,Re),Me.push(Te.label??"Dish"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Dish"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.ParabolicDish){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return $(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const $=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicDish&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyParabolicDishYieldPanel=!0,ge.selectedFloatingWindow="yearlyParabolicDishYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForParabolicDishes=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyParabolicDishYield();ge.actionInfo={name:"Yearly Simulation for Parabolic Dishes Completed",result:{totalYield:we},details:In.getState().yearlyParabolicDishYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.ParabolicDish){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.ParabolicDish){const Ce=O.current.get(Me.id);Ce&&(u(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*q),se.push(Ce),we++,ge.push(Me.label??"Dish"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*q;Se.push(Ce)}c(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.ParabolicDish){const Se=O.current.get(we.id);Se&&(u(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*q),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*q})}c(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(bt.set(Ye+zt*qe,lt+Rt*Fe),mt||bt.rotateAround(ut,nt),St.set(bt.x-ut.x,bt.y-ut.y,0),St.applyEuler(Ve),ht.set(Me.x+St.x,Me.y+St.y,Oe+St.z),Ie(se.id,ht,ge)||(Pt+=et*je));const Yt=Y.current.get(se.id);if(Yt){const zt=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Yt[zt]+=Pt/(_e*Ue)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>se.lx*se.ly*se.opticalEfficiency*se.thermalEfficiency*se.absorptance*se.reflectance*(1-N[v.getMonth()]),Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.ParabolicDish){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.ParabolicDish){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),Jtr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(tRt),s=H(GN),c=H(dJe),u=In(oRt),d=H(XN),f=H(fJe),p=In(rRt),m=dt($Ct),y=dt(qCt),w=dt(QCt),x=dt(ZCt),C=H(VGe),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),q=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyFresnelReflectorYieldPanel=!0,ge.selectedFloatingWindow="dailyFresnelReflectorYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForFresnelReflectors=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyFresnelReflectorYield();ge.actionInfo={name:"Daily Simulation for Fresnel Reflectors Completed",result:{totalYield:we},details:In.getState().dailyFresnelReflectorYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.FresnelReflector&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.FresnelReflector){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(c){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.FresnelReflector){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Reflector"+Se,Re),Me.push(Te.label??"Reflector"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Reflector"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.FresnelReflector){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return $(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const $=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.FresnelReflector&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyFresnelReflectorYieldPanel=!0,ge.selectedFloatingWindow="yearlyFresnelReflectorYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForFresnelReflectors=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyFresnelReflectorYield();ge.actionInfo={name:"Yearly Simulation for Fresnel Reflectors Completed",result:{totalYield:we},details:In.getState().yearlyFresnelReflectorYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.FresnelReflector){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.FresnelReflector){const Ce=O.current.get(Me.id);Ce&&(d(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*q),se.push(Ce),we++,ge.push(Me.label??"Reflector"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*q;Se.push(Ce)}u(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.FresnelReflector){const Se=O.current.get(we.id);Se&&(d(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*q),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*q})}u(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(Rt.set(at,Oe+Je*Ye),Ct.set(Rt.x-ht.x,Rt.y-ht.y,0),Ct.applyEuler(St),Qe.set(Te.x+Ct.x,Te.y+Ct.y,ut+Ct.z),!Ie(se.id,Qe,ge)&&!Ie(se.id,Qe,Pt)&&(yt+=zt*Yt))}const Et=Y.current.get(se.id);if(Et){const Lt=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Et[Lt]+=yt/(Fe*He)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>{const ge=a(se);if(!ge)throw new Error("parent of Fresnel reflector does not exist");let we=1;if(ge.type===z.Foundation){const Me=ge.solarAbsorberPipe;we*=((Me==null?void 0:Me.absorberOpticalEfficiency)??.7)*((Me==null?void 0:Me.absorberThermalEfficiency)??.3)*((Me==null?void 0:Me.absorberAbsorptance)??.95)}return se.lx*se.ly*se.reflectance*we*(1-N[v.getMonth()])},Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.FresnelReflector){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.FresnelReflector){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),Ktr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(uRt),s=H(GN),c=H(pJe),u=In(fRt),d=H(XN),f=H(gJe),p=In(hRt),m=dt(iRt),y=dt(aRt),w=dt(lRt),x=dt(sRt),C=H(GGe),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),q=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyHeliostatYieldPanel=!0,ge.selectedFloatingWindow="dailyHeliostatYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForHeliostats=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyHeliostatYield();ge.actionInfo={name:"Daily Simulation for Heliostats Completed",result:{totalYield:we},details:In.getState().dailyHeliostatYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.Heliostat&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.Heliostat){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(c){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.Heliostat){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Heliostat"+Se,Re),Me.push(Te.label??"Heliostat"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Heliostat"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.Heliostat){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return $(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const $=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.Heliostat&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyHeliostatYieldPanel=!0,ge.selectedFloatingWindow="yearlyHeliostatYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForHeliostats=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyHeliostatYield();ge.actionInfo={name:"Yearly Simulation for Heliostats Completed",result:{totalYield:we},details:In.getState().yearlyHeliostatYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.Heliostat){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.Heliostat){const Ce=O.current.get(Me.id);Ce&&(d(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*q),se.push(Ce),we++,ge.push(Me.label??"Heliostat"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*q;Se.push(Ce)}u(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.Heliostat){const Se=O.current.get(we.id);Se&&(d(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*q),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*q})}u(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(et.set(Pt,Oe+Rt*Ye),bt.set(et.x-ht.x,et.y-ht.y,0),bt.applyEuler(gt),Qe.set(Te.x+bt.x,Te.y+bt.y,ut+bt.z),!Ie(se.id,Qe,ge)&&!Ie(se.id,Qe,tt)&&(St+=je*Ve))}const Yt=Y.current.get(se.id);if(Yt){const zt=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Yt[zt]+=St/(Fe*He)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>{const ge=a(se);if(!ge)throw new Error("parent of heliostat does not exist");let we=1;if(ge.type===z.Foundation){const Me=ge.solarPowerTower;we*=((Me==null?void 0:Me.receiverOpticalEfficiency)??.7)*((Me==null?void 0:Me.receiverThermalEfficiency)??.3)*((Me==null?void 0:Me.receiverAbsorptance)??.95)}return se.lx*se.ly*se.reflectance*we*(1-N[v.getMonth()])},Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.Heliostat){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.Heliostat){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),$tr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=In(TRt),l=In(wRt),s=In(xRt),c=In(SRt),u=dt(yJe),d=dt(pRt),f=dt(AJe),p=dt(gRt),m=H(XGe),y=H(qGe),w=H(WN)??900,x=r.sutGridCellSize??1,{scene:C}=ti(),P=Kt(),A=_1(t),S=new Date(r.date),v=A?A.elevation:0,b=r.sutTimesPerHour??4,T=60/b,R=r.sutDaysPerYear??6,M=12/R,D=g.useMemo(()=>new yu,[]),k=g.useRef([]),N=g.useRef([]),U=g.useRef(0),W=g.useRef(!1),F=g.useRef(new Date(r.date)),E=g.useRef(new Array(24).fill(0)),L=g.useRef(new Map),j=g.useRef(new Map),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useRef(0),ee=g.useMemo(()=>pl(S,r.latitude),[r.date,r.latitude]),q=g.useRef(ee),ae=ye.daysInYear(S)/12;g.useEffect(()=>{if(u)if(y&&!ye.hasMovingParts(i))Z();else return ne(),U.current=requestAnimationFrame(te),()=>{cancelAnimationFrame(U.current),W.current||(yn(B.t("message.SimulationAborted",P)),e(Se=>{Se.world.date=F.current.toLocaleString("en-US")}),dt.getState().set(Se=>{Se.simulationInProgress=!1,Se.simulationPaused=!1})),G.current=!1}},[u]),g.useEffect(()=>{G.current=d,d?(Q.current=new Date(S.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",P))):(n("simulationPaused",!1),te())},[d]);const Z=()=>{ge(),pe();for(const Se of i)if(Se.type===z.Foundation){const Me=Se;Me.solarStructure===Nn.UpdraftTower&&Me.solarUpdraftTower&&ze(Me)}e(Se=>{Se.viewState.showDailyUpdraftTowerYieldPanel=!0,Se.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(Se=>{Se.runDailySimulationForUpdraftTower=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,$(),o&&e(Se=>{const Me=In.getState().sumDailyUpdraftTowerYield();Se.actionInfo={name:"Static Daily Simulation for Updraft Tower Completed",result:{totalYield:Me},details:In.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}})},ne=()=>{G.current?(S.setTime(Q.current.getTime()),G.current=!1):(F.current=new Date(r.date),oe.current=S.getDay(),S.setHours(Math.floor(ee.sunrise/60),-T/2)),W.current=!1,ge(),pe()},te=()=>{if(u&&!G.current){if(S.getMinutes()+S.getHours()*60+(S.getDay()-oe.current)*f5+T>=ee.sunset){cancelAnimationFrame(U.current),e(Me=>{Me.world.date=F.current.toLocaleString("en-US"),Me.viewState.showDailyUpdraftTowerYieldPanel=!0,Me.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(Me=>{Me.runDailySimulationForUpdraftTower=!1,Me.simulationInProgress=!1,Me.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,$(),o&&e(Me=>{const Ce=In.getState().sumDailyUpdraftTowerYield();Me.actionInfo={name:"Dynamic Daily Simulation for Updraft Tower Completed",result:{totalYield:Ce},details:In.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}});return}S.setHours(S.getHours(),S.getMinutes()+T),e(Me=>{Me.world.date=S.toLocaleString("en-US")});for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower&&ve(Ce)}U.current=requestAnimationFrame(te)}},$=()=>{const Se=Ae();for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;if(Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower){const Te=Ce.solarUpdraftTower.collectorTransmissivity??.9,Re=Ce.solarUpdraftTower.turbineEfficiency??.3,Ne=Ce.solarUpdraftTower.dischargeCoefficient??.65,_e=Math.PI*Ce.solarUpdraftTower.chimneyRadius*Ce.solarUpdraftTower.chimneyRadius,Ue=Math.PI*Ce.solarUpdraftTower.collectorRadius*Ce.solarUpdraftTower.collectorRadius,qe=D_*eMe*_e,Fe=2*ZHe*Ce.solarUpdraftTower.chimneyHeight,He=L.current.get(Me.id+"-sut"),Le=j.current.get(Me.id+"-sut"),Ye=Y.current.get(Me.id+"-sut");if(Ye&&He&&Le){const lt=.5*Ne*Re*D_*_e,Oe=new Date(r.date);let ut;A&&(ut=eS(Oe,A.lowestTemperatures,A.highestTemperatures));for(let ht=0;ht0&&ht>0&&He[ht-1]>Qe){const Ve=(He[ht-1]+Qe)/2,je=(r.airConvectiveCoefficient??5)*Ue*(Ve-Qe),et=Ve+Aw,bt=et*et*et*et,St=nt*nt*nt*nt,Pt=(Ce.solarUpdraftTower.collectorEmissivity??.95)*tMe*Ue*(bt-St);Ye[ht]-=je+Pt,Ye[ht]<0&&(Ye[ht]=0)}const mt=Ye[ht]/(qe*nt),tt=nt*(1+Math.cbrt(mt*mt/Fe))-Aw,gt=tt>Qe?Math.sqrt(Fe*((tt+Aw)/nt-1)):0;Ye[ht]=lt*gt*gt*gt*.001,He[ht]=tt,Le[ht]=gt}}}}le()},le=()=>{var Ne,_e,Ue;const Se=new Map;let Me=0;const Ce=[];for(const qe of i)if(qe.type===z.Foundation){const Fe=qe;if(Fe.solarStructure===Nn.UpdraftTower&&Fe.solarUpdraftTower){Me++;const He=L.current.get(qe.id+"-sut");He&&Se.set("Temperature Tower"+Me,He);const Le=j.current.get(qe.id+"-sut");Le&&Se.set("Wind Speed Tower"+Me,Le);const Ye=Y.current.get(qe.id+"-sut");Ye&&(Se.set("Tower"+Me,Ye),Ce.push(qe.label?qe.label:"Tower"+Me))}}const Te=[];for(let qe=0;qe<24;qe++){const Fe={};Fe.Hour=qe;for(let He=1;He<=Me;He++){const Le="Tower"+He;Fe[Ce[He-1]]=(Ne=Se.get(Le))==null?void 0:Ne[qe]}Te.push(Fe)}s(Te);const Re=[];for(let qe=0;qe<24;qe++){const Fe={};Fe.Hour=qe,Fe.T_Ambient=E.current[qe];for(let He=1;He<=Me;He++){let Le="Temperature Tower"+He;Fe["T_"+Ce[He-1]]=(_e=Se.get(Le))==null?void 0:_e[qe],Le="Wind Speed Tower"+He,Fe["V_"+Ce[He-1]]=(Ue=Se.get(Le))==null?void 0:Ue[qe]}Re.push(Fe)}l(Re),a(Ce)};g.useEffect(()=>{if(f)if(y&&!ye.hasMovingParts(i))he();else return de(),U.current=requestAnimationFrame(me),()=>{cancelAnimationFrame(U.current),W.current||(yn(B.t("message.SimulationAborted",P)),e(Se=>{Se.world.date=F.current.toLocaleString("en-US")}),dt.getState().set(Se=>{Se.simulationInProgress=!1,Se.simulationPaused=!1})),G.current=!1}},[f]),g.useEffect(()=>{G.current=p,p?(Q.current=new Date(S.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",P))):(n("simulationPaused",!1),me())},[p]);const de=()=>{G.current?(S.setTime(Q.current.getTime()),G.current=!1):(F.current=new Date(r.date),_.current=0,S.setMonth(0,22),oe.current=S.getDay(),q.current=pl(S,r.latitude),S.setHours(Math.floor(q.current.sunrise/60),-T/2),e(Se=>{Se.world.date=S.toLocaleString("en-US")})),W.current=!1,ge(),pe(),Ie()},he=()=>{ge(),pe(),Ie(),F.current=new Date(r.date),_.current=0;for(let Se=0;Se<12;Se+=M){S.setMonth(Se,22),q.current=pl(S,r.latitude),pe();for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower&&ze(Ce)}ce(),_.current++}e(Se=>{Se.world.date=F.current.toLocaleString("en-US"),Se.viewState.showYearlyUpdraftTowerYieldPanel=!0,Se.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(Se=>{Se.runYearlySimulationForUpdraftTower=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,Pe(),o&&e(Se=>{const Me=In.getState().sumYearlyUpdraftTowerYield();Se.actionInfo={name:"Static Yearly Simulation for Updraft Tower Completed",result:{totalYield:Me},details:In.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}})},me=()=>{if(f&&!G.current)if(S.getMinutes()+S.getHours()*60+(S.getDay()-oe.current)*f5+T{Me.world.date=S.toLocaleString("en-US")});for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower&&ve(Ce)}U.current=requestAnimationFrame(me)}else{if(ce(),_.current++,_.current===R){cancelAnimationFrame(U.current),e(Me=>{Me.world.date=F.current.toLocaleString("en-US"),Me.viewState.showYearlyUpdraftTowerYieldPanel=!0,Me.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(Me=>{Me.runYearlySimulationForUpdraftTower=!1,Me.simulationInProgress=!1,Me.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,Pe(),o&&e(Me=>{const Ce=In.getState().sumYearlyUpdraftTowerYield();Me.actionInfo={name:"Dynamic Yearly Simulation for Updraft Tower Completed",result:{totalYield:Ce},details:In.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}});return}S.setMonth(_.current*M,22),oe.current=S.getDay(),q.current=pl(S,r.latitude),S.setHours(Math.floor(q.current.sunrise/60),-T/2),pe(),U.current=requestAnimationFrame(me)}},ce=()=>{const Se=se();for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;if(Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower){const Te=Y.current.get(Ce.id+"-sut"),Re=L.current.get(Me.id+"-sut"),Ne=j.current.get(Me.id+"-sut");if(Te&&Re&&Ne){const _e=Ce.solarUpdraftTower.collectorTransmissivity??.9,Ue=Ce.solarUpdraftTower.turbineEfficiency??.3,qe=Ce.solarUpdraftTower.dischargeCoefficient??.65,Fe=Math.PI*Ce.solarUpdraftTower.chimneyRadius*Ce.solarUpdraftTower.chimneyRadius,He=Math.PI*Ce.solarUpdraftTower.collectorRadius*Ce.solarUpdraftTower.collectorRadius,Le=D_*eMe*Fe,Ye=2*ZHe*Ce.solarUpdraftTower.chimneyHeight,lt=.5*qe*Ue*D_*Fe;let Oe;A&&(Oe=eS(S,A.lowestTemperatures,A.highestTemperatures));for(let ht=0;ht0&&ht>0&&Re[ht-1]>Qe){const Ve=(Re[ht-1]+Qe)/2,je=(r.airConvectiveCoefficient??5)*He*(Ve-Qe),et=Ve+Aw,bt=et*et*et*et,St=nt*nt*nt*nt,Pt=(Ce.solarUpdraftTower.collectorEmissivity??.95)*tMe*He*(bt-St);Te[ht]-=je+Pt,Te[ht]<0&&(Te[ht]=0)}const mt=Te[ht]/(Le*nt),tt=nt*(1+Math.cbrt(mt*mt/Ye))-Aw,gt=tt>Qe?Math.sqrt(Ye*((tt+Aw)/nt-1)):0;Te[ht]=lt*gt*gt*gt*.001,Re[ht]=tt,Ne[ht]=gt}const ut=O.current.get(Ce.id+"-sut");if(ut){const ht=Te.reduce((Qe,nt)=>Qe+nt,0);ut[_.current]+=ht}}}}m&&le()},Pe=()=>{const Se=[],Me=[];let Ce=0;for(const Re of i)if(Re.type===z.Foundation){const Ne=Re;if(Ne.solarStructure===Nn.UpdraftTower&&Ne.solarUpdraftTower){const _e=O.current.get(Re.id+"-sut");_e&&(Se.push(_e),Me.push(Re.label?Re.label:"Tower"+ ++Ce))}}const Te=[];for(let Re=0;Re<12;Re+=M){const Ne={};Ne.Month=Bs[Re];for(const[_e,Ue]of Se.entries())Ne[Me[_e]]=Ue[Re/M]*ae;Te.push(Ne)}c(Te),a(Me)},pe=()=>{for(const Se of i)if(Se.type===z.Foundation){const Me=Se;if(Me.solarStructure===Nn.UpdraftTower&&Me.solarUpdraftTower){const Ce=L.current.get(Se.id+"-sut");Ce?Ce.fill(0):L.current.set(Se.id+"-sut",new Array(24).fill(0));const Te=j.current.get(Se.id+"-sut");Te?Te.fill(0):j.current.set(Se.id+"-sut",new Array(24).fill(0));const Re=Y.current.get(Se.id+"-sut");Re?Re.fill(0):Y.current.set(Se.id+"-sut",new Array(24).fill(0))}}},Ie=()=>{for(const Se of i)if(Se.type===z.Foundation){const Me=Se;if(Me.solarStructure===Nn.UpdraftTower&&Me.solarUpdraftTower){const Ce=O.current.get(Se.id+"-sut");Ce&&Ce.length===R?Ce.fill(0):O.current.set(Se.id+"-sut",new Array(R).fill(0))}}},ve=Se=>{const Me=Se.solarUpdraftTower;if(!Me)return;const Ce=zi(S,r.latitude);if(Ce.zut)&&(Qe++,ht+=Ye,Oe>0&&(we(Se.id+"-sut",lt,Ce)||(ht+=Oe*Le)))}Qe&&(ht/=Qe);const tt=S.getMinutes()>=30?S.getHours()+1===24?0:S.getHours()+1:S.getHours(),gt=Math.PI*Me.collectorRadius*Me.collectorRadius;Te[tt]+=ht*gt}},ze=Se=>{const Me=Se.solarUpdraftTower;if(!Me)return;const Ce=Y.current.get(Se.id+"-sut");if(!Ce)return;const Te=new ue().fromArray(Se.normal),Re=S.getFullYear(),Ne=S.getMonth(),_e=S.getDate(),Ue=ye.dayOfYear(S),qe=Me.collectorRadius,Fe=Math.max(2,Math.round(qe*2/x)),He=Se.cx-qe+x/2,Le=Se.cy-qe+x/2,Ye=Se.lz+Me.collectorHeight,lt=new ue(0,0,Ye),Oe=qe*qe;let ut=0,ht,Qe;const nt=Math.PI*Me.collectorRadius*Me.collectorRadius;for(let mt=0;mt<24;mt++){for(let tt=0;tt0){const je=Si(Ve,Ue,v,hi.SPHERE_MODEL),et=ei(r.ground,Ne,Oo,je),bt=Te.dot(Ve);ut=0;for(let St=0;StOe)&&(ut++,Ce[mt]+=et,bt>0&&(we(Se.id+"-sut",lt,Ve)||(Ce[mt]+=bt*je)))}}}ut&&(Ce[mt]/=ut),Ce[mt]*=nt}},Ae=()=>{const Se=ee.daylight()/60;return Se>Ht?A.sunshineHours[S.getMonth()]/(30*Se*b):0},se=()=>{const Se=S.getMonth(),Me=q.current.daylight()/60;return Me>Ht?A.sunshineHours[Se]/(30*Me*b):0},ge=()=>{const Se=C.children.filter(Me=>Me.name==="Content");if(Se.length>0){const Me=Se[0].children;k.current.length=0;for(const Ce of Me)ye.fetchSimulationElements(Ce,k.current)}},we=(Se,Me,Ce)=>{if(k.current.length>1){N.current.length=0,D.set(Me,Ce);const Te=k.current.filter(Re=>Re.uuid!==Se);return D.intersectObjects(Te,!1,N.current),N.current.length>0}return!1};return h.jsx(h.Fragment,{})});class qtr{constructor(e,n){this.position=e,this.observer=n}}const Qtr=xe.memo(()=>{const t=H.getState().world,e=H.getState().elements,n=H(pn),o=dt(kf),r=H($r),i=H(p4),a=dt(ICt),{scene:l}=ti(),s=Kt(),c=g.useMemo(()=>new yu,[]),u=t.solarPanelVisibilityGridCellSize??.2,d=g.useRef([]),f=g.useRef([]),p=g.useRef([]);g.useEffect(()=>{a&&e&&e.length>0&&(w(),o("runSolarPanelVisibilityAnalysis",!1),n(P=>{P.viewState.showSolarPanelVisibilityResultsPanel=!0,P.selectedFloatingWindow="visibilityResultsPanel"}),yn(B.t("message.SimulationCompleted",s))),o("simulationInProgress",!1)},[a]);const m=()=>{const P=l.children.filter(A=>A.name==="Content");if(P.length>0){const A=P[0].children;f.current.length=0;for(const S of A)ye.fetchSimulationElements(S,f.current)}},y=()=>{d.current=[];for(const P of e)if(P.type===z.Human){const A=P;if(A.observer){const S=r(A),v=S?ye.absoluteHumanOrTreeCoordinates(A.cx,A.cy,A.cz,S):new ue(A.cx,A.cy,A.cz);v.z+=A.lz,d.current.push(new qtr(v,A))}}},w=()=>{if(In.getState().clearSolarPanelVisibilityResults(),y(),d.current.length!==0){m();for(const P of d.current){const A=new Map;for(const S of e)if(S.type===z.SolarPanel){const v=S;A.set(v.parentId,0)}for(const S of e)if(S.type===z.SolarPanel){const v=S;let b=A.get(v.parentId)??0;b+=x(v,P.position)*100,A.set(v.parentId,b)}In.getState().setSolarPanelVisibilityResult(P,A)}}},x=(P,A)=>{let S=r(P);if(!S)throw new Error("parent of solar panel does not exist");let v=!1;const b=P.parentType===z.Wall;if(S.type===z.Roof){if(S=i(S),!S)throw new Error("foundation of solar panel does not exist");v=!0}const T=b?ye.absoluteCoordinates(P.cx,P.cy,P.cz,S,i(P),P.lz):ye.absoluteCoordinates(P.cx,P.cy,P.cz,S,void 0,void 0,!0);v&&(T.z=P.cz+S.cz);const R=new ue().fromArray(P.normal);b&&R.applyEuler(new cn(0,0,S.relativeAngle));const M=S.rotation[2]+P.relativeAzimuth;Math.abs(P.tiltAngle)>.001&&R.applyEuler(new cn(P.tiltAngle,0,M,"ZYX"));const D=P.lx,k=P.ly*Math.cos(P.tiltAngle),N=P.ly*Math.abs(Math.sin(P.tiltAngle)),U=Math.max(2,Math.round(P.lx/u)),W=Math.max(2,Math.round(P.ly/u)),F=D/U,E=k/W,L=N/W,j=T.x-D/2,Y=T.y-k/2,O=(v?T.z:P.poleHeight+T.z)-N/2,_=new _t(T.x,T.y);let G=0;const Q=new ue,oe=new ue;let ee;const q=new _t,ae=ye.isZero(M);for(let Z=0;Z{if(f.current.length>1){p.current.length=0,c.set(A,S);const v=f.current.filter(b=>b.uuid!==P);if(c.intersectObjects(v,!1,p.current),p.current.length===0)return!0;for(const[b,T]of p.current.entries())if(T.object.name.endsWith("eyeball")&&b===0)return!0;return!1}return!0};return h.jsx(h.Fragment,{})}),Ztr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=H(p4),s=H(PCt),c=H(RCt),u=In(jRt),d=In(WRt),f=In(URt),p=dt(SJe),m=dt(kRt),y=dt(TJe),w=dt(FRt),x=H(BGe),C=H(Q2e),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=g.useMemo(()=>s(t??"Boston MA, USA"),[t]),T=g.useMemo(()=>c(t??"Boston MA, USA"),[t]),R=t?S==null?void 0:S.elevation:0,M=r.timesPerHour??4,D=60/M,k=g.useMemo(()=>new yu,[]),N=g.useRef([]),U=g.useRef([]),W=g.useRef(0),F=g.useRef(!1),E=g.useRef(new Date(r.date)),L=g.useRef(new Map),j=g.useRef(new Map),Y=g.useRef(new Array(12).fill(0)),O=g.useRef(new Array(12).fill(0)),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useRef(0),ee=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),q=g.useRef(ee);g.useEffect(()=>{if(p)if(C&&!ye.hasMovingParts(i))ae();else return Z(),W.current=requestAnimationFrame(ne),()=>{cancelAnimationFrame(W.current),F.current||(yn(B.t("message.SimulationAborted",A)),e(we=>{we.world.date=E.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[p]),g.useEffect(()=>{G.current=m,m?(Q.current=new Date(v.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),ne())},[m]);const ae=()=>{se(),Pe();for(const we of i)we.type===z.Sensor&&ve(we);e(we=>{we.viewState.showDailyLightSensorPanel=!0,we.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(we=>{we.runDailyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,te(),o&&e(we=>{we.actionInfo={name:"Static Daily Simulation for Sensors Completed",details:In.getState().dailyLightSensorData,timestamp:new Date().getTime()}})},Z=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(E.current=new Date(r.date),oe.current=v.getDay(),v.setHours(Math.floor(ee.sunrise/60),-D/2)),F.current=!1,se(),Pe()},ne=()=>{if(p&&!G.current){if(v.getMinutes()+v.getHours()*60+(v.getDay()-oe.current)*f5+D>=ee.sunset){cancelAnimationFrame(W.current),e(Se=>{Se.world.date=E.current.toLocaleString("en-US"),Se.viewState.showDailyLightSensorPanel=!0,Se.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(Se=>{Se.runDailyLightSensor=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,te(),o&&e(Se=>{Se.actionInfo={name:"Dynamic Daily Simulation for Sensors Completed",details:In.getState().dailyLightSensorData,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+D),e(Se=>{Se.world.date=v.toLocaleString("en-US")});for(const Se of i)Se.type===z.Sensor&&Ie(Se);W.current=requestAnimationFrame(ne)}},te=()=>{const we=ze();for(const Se of i)if(Se.type===z.Sensor){const Me=L.current.get(Se.id);if(Me)for(let Ce=0;Ce{var Te;const we=new Map;let Se=0;const Me=[];for(const Re of i)if(Re.type===z.Sensor){const Ne=L.current.get(Re.id);Ne&&(we.set("Radiation"+ ++Se,Ne),Me.push(Re.label?Re.label:"Radiation"+Se))}const Ce=[];for(let Re=0;Re<24;Re++){const Ne={};Ne.Hour=Re;for(let _e=1;_e<=Se;_e++){const Ue="Radiation"+_e;Ne[Me[_e-1]]=(Te=we.get(Ue))==null?void 0:Te[Re]}Ce.push(Ne)}d(Ce),u(Me)};g.useEffect(()=>{if(y)if(C&&!ye.hasMovingParts(i))de();else return le(),W.current=requestAnimationFrame(he),()=>{cancelAnimationFrame(W.current),F.current||(yn(B.t("message.SimulationAborted",A)),e(we=>{we.world.date=E.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),he())},[w]);const le=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(E.current=new Date(r.date),_.current=0,v.setMonth(0,22),oe.current=v.getDay(),q.current=pl(v,r.latitude),v.setHours(Math.floor(q.current.sunrise/60),-D/2),e(we=>{we.world.date=v.toLocaleString("en-US")})),F.current=!1,se(),Pe(),pe()},de=()=>{se(),Pe(),pe(),E.current=new Date(r.date),_.current=0;for(let we=0;we<12;we++){v.setMonth(we,22),q.current=pl(v,r.latitude),Pe();for(const Se of i)Se.type===z.Sensor&&ve(Se);me(),_.current++}e(we=>{we.world.date=E.current.toLocaleString("en-US"),we.viewState.showYearlyLightSensorPanel=!0,we.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(we=>{we.runYearlyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,ce(),o&&e(we=>{we.actionInfo={name:"Static Yearly Simulation for Sensors Completed",details:In.getState().yearlyLightSensorData,timestamp:new Date().getTime()}})},he=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60+(v.getDay()-oe.current)*f5+D{Se.world.date=v.toLocaleString("en-US")});for(const Se of i)Se.type===z.Sensor&&Ie(Se);W.current=requestAnimationFrame(he)}else{if(me(),_.current++,_.current===12){cancelAnimationFrame(W.current),e(Se=>{Se.world.date=E.current.toLocaleString("en-US"),Se.viewState.showYearlyLightSensorPanel=!0,Se.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(Se=>{Se.runYearlyLightSensor=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,ce(),o&&e(Se=>{Se.actionInfo={name:"Dynamic Yearly Simulation for Sensors Completed",details:In.getState().yearlyLightSensorData,timestamp:new Date().getTime()}});return}v.setMonth(_.current,22),oe.current=v.getDay(),q.current=pl(v,r.latitude),v.setHours(Math.floor(q.current.sunrise/60),-D/2),Pe(),W.current=requestAnimationFrame(he)}},me=()=>{const we=Ae();for(const Se of i)if(Se.type===z.Sensor){const Me=L.current.get(Se.id);if(Me){const Ce=j.current.get(Se.id);if(Ce){const Te=Me.reduce((Re,Ne)=>Re+Ne,0);Ce[_.current]+=Te*we}}}x&&te()},ce=()=>{const we=[],Se=[];let Me=0,Ce=!1,Te=!1;for(const Ue of i)if(Ue.type===z.Sensor){const qe=j.current.get(Ue.id);qe&&(we.push(qe),Se.push(Ue.label?Ue.label:"Radiation"+ ++Me),!Ce&&ye.isIdentical(Ue.normal,fs)&&(Ce=!0),!Te&&ye.isIdentical(Ue.normal,Uvt)&&(Te=!0))}const Re=Ce&&b;Re&&Se.push("Measured (Hor.)");const Ne=Te&&T;Ne&&Se.push("Measured (Ver.)");const _e=[];for(let Ue=0;Ue<12;Ue++){const qe={};qe.Month=Bs[Ue];for(const[Fe,He]of we.entries())qe.Daylight=Y.current[Ue],qe.Clearness=O.current[Ue]*100,Re&&(qe["Measured (Hor.)"]=b.data[Ue]),Ne&&(qe["Measured (Ver.)"]=T.data[Ue]),qe[Se[Fe]]=He[Ue];_e.push(qe)}f(_e),u(Se)},Pe=()=>{for(const we of i)if(we.type===z.Sensor){const Se=L.current.get(we.id);Se?Se.fill(0):L.current.set(we.id,new Array(24).fill(0))}},pe=()=>{for(const we of i)if(we.type===z.Sensor){const Se=j.current.get(we.id);Se?Se.fill(0):j.current.set(we.id,new Array(12).fill(0))}},Ie=we=>{const Se=zi(v,r.latitude);if(Se.z0&&(ge(we.id,Te,Se)||(qe+=Ue*_e));const Fe=L.current.get(we.id);if(Fe){const He=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Fe[He]+=qe}},ve=we=>{const Se=a(we);if(!Se)throw new Error("parent of sensor does not exist");const Me=L.current.get(we.id);if(!Me)return;let Ce=null;Se.type===z.Wall&&(Ce=l(we));const Te=ye.absoluteCoordinates(we.cx,we.cy,we.cz,Se,Ce||void 0),Re=new ue().fromArray(we.normal);Re.applyAxisAngle(Oo,Se.rotation[2]);const Ne=v.getFullYear(),_e=v.getMonth(),Ue=v.getDate(),qe=ye.dayOfYear(v);for(let Fe=0;Fe<24;Fe++)for(let He=0;He0){const lt=Si(Ye,qe,R,hi.SPHERE_MODEL),Oe=Re.dot(Ye);Oe>0&&(ge(we.id,Te,Ye)||(Me[Fe]+=Oe*lt)),Me[Fe]+=ei(r.ground,_e,Re,lt)}}},ze=()=>{const we=ee.daylight()/60;return we>Ht?S.sunshineHours[v.getMonth()]/(30*we*M):0},Ae=()=>{const we=v.getMonth(),Se=q.current.daylight()/60;return Se>Ht?(Y.current[we]=Se,O.current[we]=S.sunshineHours[we]/(30*Se),O.current[we]/M):(Y.current[we]=0,O.current[we]=0,0)},se=()=>{const we=P.children.filter(Se=>Se.name==="Content");if(we.length>0){const Se=we[0].children;N.current.length=0;for(const Me of Se)ye.fetchSimulationElements(Me,N.current)}},ge=(we,Se,Me)=>{if(N.current.length>1){U.current.length=0,k.set(Se,Me);const Ce=N.current.filter(Te=>Te.uuid!==we);return k.intersectObjects(Ce,!1,U.current),U.current.length>0}return!1};return h.jsx(h.Fragment,{})}),LUe=(t,e)=>{let n=e.efficiency;return e.cellType==="Monocrystalline"&&(n*=.95),n*(1+e.pmaxTC*(t-25))},enr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H(O5),l=H($r),s=H(p4),c=In(WCt),u=H(GN),d=In(UCt),f=H(XN),p=H(nJe),m=H(oJe),y=In(jCt),w=dt(eJe),x=dt(DCt),C=dt(kCt),P=dt(tJe),A=dt(ECt),S=dt(FCt),v=H(YGe),b=H(Z2e),T=H(WN)??900,R=dt(_5),{scene:M}=ti(),D=Kt(),k=_1(t),N=new Date(r.date),U=t?k==null?void 0:k.elevation:0,W=r.timesPerHour??4,F=60/W,E=r.daysPerYear??6,L=12/E,j=g.useMemo(()=>new yu,[]),Y=r.monthlyIrradianceLosses??new Array(12).fill(.05),O=r.pvGridCellSize??.25,_=g.useRef([]),G=g.useRef([]),Q=g.useRef(0),oe=g.useRef(!1),ee=g.useRef(new Date(r.date)),q=g.useRef(new Map),ae=g.useRef(new Map),Z=g.useRef(0),ne=g.useRef(!1),te=g.useRef(new Date(r.date)),$=g.useRef(0),le=g.useRef(20),de=g.useMemo(()=>pl(N,r.latitude),[r.date,r.latitude]),he=g.useRef(de),me=ye.daysInYear(N)/12;g.useEffect(()=>{if(w)if(b&&!ye.hasMovingParts(i))setTimeout(()=>{ce(!1)},50);else return Pe(),Q.current=requestAnimationFrame(pe),()=>{cancelAnimationFrame(Q.current),oe.current||(yn(B.t("message.SimulationAborted",D)),e(He=>{He.world.date=ee.current.toLocaleString("en-US")}),dt.getState().set(He=>{He.simulationInProgress=!1,He.simulationPaused=!1})),ne.current=!1}},[w]),g.useEffect(()=>{x&&b&&!ye.hasMovingParts(i)&&setTimeout(()=>{ce(!0)},50)},[x]),g.useEffect(()=>{ne.current=C,C?(te.current=new Date(N.getTime()),cancelAnimationFrame(Q.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",D))):(n("simulationPaused",!1),pe())},[C]);const ce=He=>{Fe(),Ce();for(const Le of i)Le.type===z.SolarPanel&&Se(Le);if(e(Le=>{!R&&!He&&(Le.viewState.showDailyPvYieldPanel=!0,Le.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(Le=>{He?Le.runDailySimulationForSolarPanelsLastStep=!1:Le.runDailySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,Ie(),!R&&!He&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumDailyPvYield(),Ye=In.getState().getDailyPvProfit(),lt=In.getState().dailyPvYield;e(Oe=>{Oe.actionInfo={name:"Static Daily Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}},Pe=()=>{ne.current?(N.setTime(te.current.getTime()),ne.current=!1):(ee.current=new Date(r.date),$.current=N.getDay(),N.setHours(Math.floor(de.sunrise/60),-F/2)),oe.current=!1,Fe(),Ce()},pe=()=>{if(w&&!ne.current){if(N.getMinutes()+N.getHours()*60+(N.getDay()-$.current)*f5+F>=de.sunset){if(cancelAnimationFrame(Q.current),e(Le=>{Le.world.date=ee.current.toLocaleString("en-US"),R||(Le.viewState.showDailyPvYieldPanel=!0,Le.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(Le=>{Le.runDailySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,Ie(),!R&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumDailyPvYield(),Ye=In.getState().getDailyPvProfit(),lt=In.getState().dailyPvYield;e(Oe=>{Oe.actionInfo={name:"Dynamic Daily Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}return}N.setHours(N.getHours(),N.getMinutes()+F),e(Le=>{Le.world.date=N.toLocaleString("en-US")});for(const Le of i)Le.type===z.SolarPanel&&Me(Le);Q.current=requestAnimationFrame(pe)}},Ie=()=>{const He=Re();for(const Le of i)if(Le.type===z.SolarPanel){const Ye=Le,lt=q.current.get(Le.id);if(lt){const Oe=_e(Ye)*He;for(let ut=0;ut{var He;if(p){const Le=new Array(24).fill(0),Ye=new Map;let lt=0;const Oe=[];for(const ht of i)if(ht.type===z.SolarPanel){const Qe=q.current.get(ht.id);if(Qe){u(ht.id,Qe.reduce((nt,mt)=>nt+mt,0)),lt++,Ye.set("Panel"+lt,Qe),Oe.push(ht.label?ht.label:"Panel"+lt);for(let nt=0;nt<24;nt++)Le[nt]+=Qe[nt]}}const ut=[];for(let ht=0;ht<24;ht++){const Qe={};Qe.Hour=ht;for(let nt=1;nt<=lt;nt++){const mt="Panel"+nt;Qe[Oe[nt-1]]=(He=Ye.get(mt))==null?void 0:He[ht]}ut.push(Qe)}c(ut),y(Oe)}else{const Le=new Array(24).fill(0);for(const lt of i)if(lt.type===z.SolarPanel){const Oe=q.current.get(lt.id);if(Oe){u(lt.id,Oe.reduce((ut,ht)=>ut+ht,0));for(let ut=0;ut<24;ut++)Le[ut]+=Oe[ut]}}const Ye=[];for(let lt=0;lt<24;lt++)Ye.push({Hour:lt,Total:Le[lt]});c(Ye)}};g.useEffect(()=>{if(P)if(b&&!ye.hasMovingParts(i))setTimeout(()=>{Ae(!1)},50);else return ze(),Q.current=requestAnimationFrame(se),()=>{cancelAnimationFrame(Q.current),oe.current||(yn(B.t("message.SimulationAborted",D)),e(He=>{He.world.date=ee.current.toLocaleString("en-US")}),dt.getState().set(He=>{He.simulationInProgress=!1,He.simulationPaused=!1})),ne.current=!1}},[P]),g.useEffect(()=>{A&&b&&!ye.hasMovingParts(i)&&setTimeout(()=>{Ae(!0)},50)},[A]),g.useEffect(()=>{ne.current=S,S?(te.current=new Date(N.getTime()),cancelAnimationFrame(Q.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",D))):(n("simulationPaused",!1),se())},[S]);const ze=()=>{ne.current?(N.setTime(te.current.getTime()),ne.current=!1):(ee.current=new Date(r.date),Z.current=0,N.setMonth(0,22),$.current=N.getDay(),he.current=pl(N,r.latitude),N.setHours(Math.floor(he.current.sunrise/60),-F/2),e(He=>{He.world.date=N.toLocaleString("en-US")})),oe.current=!1,Fe(),Ce(),Te()},Ae=He=>{Fe(),Ce(),Te(),ee.current=new Date(r.date),Z.current=0;for(let Le=0;Le<12;Le+=L){N.setMonth(Le,22),he.current=pl(N,r.latitude),Ce();for(const Ye of i)Ye.type===z.SolarPanel&&Se(Ye);ge(),Z.current++}if(e(Le=>{Le.world.date=ee.current.toLocaleString("en-US"),!R&&!He&&(Le.viewState.showYearlyPvYieldPanel=!0,Le.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(Le=>{He?Le.runYearlySimulationForSolarPanelsLastStep=!1:Le.runYearlySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,we(),!R&&!He&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumYearlyPvYield(),Ye=In.getState().getYearlyPvProfit(),lt=In.getState().yearlyPvYield;e(Oe=>{Oe.actionInfo={name:"Static Yearly Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}},se=()=>{if(P&&!ne.current)if(N.getMinutes()+N.getHours()*60+(N.getDay()-$.current)*f5+F{Le.world.date=N.toLocaleString("en-US")});for(const Le of i)Le.type===z.SolarPanel&&Me(Le);Q.current=requestAnimationFrame(se)}else{if(ge(),Z.current++,Z.current===E){if(cancelAnimationFrame(Q.current),e(Le=>{Le.world.date=ee.current.toLocaleString("en-US"),R||(Le.viewState.showYearlyPvYieldPanel=!0,Le.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(Le=>{Le.runYearlySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,we(),!R&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumYearlyPvYield(),Ye=In.getState().getYearlyPvProfit(),lt=In.getState().yearlyPvYield;e(Oe=>{Oe.actionInfo={name:"Dynamic Yearly Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}return}N.setMonth(Z.current*L,22),$.current=N.getDay(),he.current=pl(N,r.latitude),N.setHours(Math.floor(he.current.sunrise/60),-F/2),Ce(),Q.current=requestAnimationFrame(se)}},ge=()=>{const He=Ne();for(const Le of i)if(Le.type===z.SolarPanel){const Ye=Le,lt=q.current.get(Le.id);if(lt){const Oe=ae.current.get(Le.id);if(Oe){const ut=lt.reduce((ht,Qe)=>ht+Qe,0);Oe[Z.current]+=ut*He*_e(Ye)}}}!R&&v&&Ie()},we=()=>{if(m){const He=[],Le=[];let Ye=0;for(const Oe of i)if(Oe.type===z.SolarPanel){const ut=ae.current.get(Oe.id);ut&&(f(Oe.id,ut.reduce((ht,Qe)=>ht+Qe,0)*L*me),He.push(ut),Ye++,Le.push(Oe.label??"Panel"+Ye))}const lt=[];for(let Oe=0;Oe<12;Oe+=L){const ut={};ut.Month=Bs[Oe];for(const[ht,Qe]of He.entries())ut[Le[ht]]=Qe[Oe/L]*me;lt.push(ut)}d(lt),y(Le)}else{const He=[];for(const Ye of i)if(Ye.type===z.SolarPanel){const lt=ae.current.get(Ye.id);lt&&(f(Ye.id,lt.reduce((Oe,ut)=>Oe+ut,0)*L*me),He.push(lt))}const Le=[];for(let Ye=0;Ye<12;Ye+=L){let lt=0;for(const Oe of He)lt+=Oe[Ye/L];Le.push({Month:Bs[Ye],Total:lt*me})}d(Le)}},Se=He=>{if(He.trackerType!==Bl.NO_TRACKER)throw new Error("static simulation is not for solar panel with tracker");let Le=l(He);if(!Le)throw new Error("parent of solar panel does not exist");const Ye=He.parentType===z.Roof,lt=He.parentType===z.Wall;if(Ye&&(Le=s(Le),!Le))throw new Error("foundation of solar panel does not exist");const Oe=a(He.pvModelName);if(!Oe)throw new Error("PV model not found");const ut=q.current.get(He.id);if(!ut)return;const ht=lt?ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,s(He),He.lz):ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,void 0,void 0,!0),Qe=Le.rotation[2];let nt=Qe+He.relativeAzimuth,mt=He.tiltAngle,tt=!0;if(Ye&&(ht.z=He.cz+He.lz+.02+Le.cz,ye.isZero(He.rotation[0])?ht.z+=He.poleHeight:(mt=He.rotation[0],nt=Qe,tt=!1)),lt&&!ye.isZero(He.tiltAngle)){const it=Le,Be=s(Le),ct=(Be?Be.rotation[2]+it.relativeAngle:it.relativeAngle)-$t,Xe=He.ly*Math.abs(Math.sin(He.tiltAngle))/2;ht.x+=Xe*Math.cos(ct),ht.y+=Xe*Math.sin(ct)}const gt=new ue().fromArray(He.normal),Ve=new cn(Ye&&!tt?0:mt,0,nt,"ZYX");gt.applyEuler(Ve);const je=N.getFullYear(),et=N.getMonth(),bt=N.getDate(),St=ye.dayOfYear(N);let Pt,Yt,zt,Rt,Ct;r.discretization===Ay.EXACT?(Pt=He.lx,Yt=He.ly,He.orientation===br.portrait?(zt=Math.max(1,Math.round(He.lx/Oe.width)),Rt=Math.max(1,Math.round(He.ly/Oe.length)),zt*=Oe.n,Rt*=Oe.m):(zt=Math.max(1,Math.round(He.lx/Oe.length)),Rt=Math.max(1,Math.round(He.ly/Oe.width)),zt*=Oe.m,Rt*=Oe.n),Ct=He.lx/zt):(Pt=He.lx,Yt=He.ly,zt=Math.max(2,Math.round(He.lx/O)),Rt=Math.max(2,Math.round(He.ly/O)),zt%2!==0&&(zt+=1),Rt%2!==0&&(Rt+=1),Ct=O);const yt=Pt/zt,at=Yt/Rt,Et=ht.x-(Pt-Ct)/2,Lt=ht.y-(Yt-Ct)/2,Je=Ye||lt?ht.z:Le.lz+He.poleHeight+He.lz,st=new _t(ht.x,ht.y),It=new ue,ot=Array.from(Array(zt),()=>new Array(Rt));Ye&&!tt&&(Ve.x=He.rotation[0],Ve.z=He.rotation[2]+Qe),lt&&(Ve.x=$t+He.tiltAngle,Ve.z=Le.relativeAngle+Qe);for(let it=0;it<24;it++)for(let Be=0;Be0){const Xe=Si(ct,St,U,hi.SPHERE_MODEL),ft=ei(r.ground,et,gt,Xe),wt=gt.dot(ct),kt=new _t,Zt=new ue;if(Oe.bifacialityFactor>0){const qt=gt.clone().negate(),rn=ei(r.ground,et,qt,Xe),Pn=ft+rn*Oe.bifacialityFactor;for(let fo=0;fo0?wt:-wt*Oe.bifacialityFactor)*Xe)}else for(let qt=0;qt0&&(kt.set(Et+qt*yt,Lt+rn*at),Zt.set(kt.x-st.x,kt.y-st.y,0),Zt.applyEuler(Ve),It.set(ht.x+Zt.x,ht.y+Zt.y,Je+Zt.z),qe(He.id,It,ct)||(ot[qt][rn]+=wt*Xe));let Ot=0;Ue(pt);const on=LUe(le.current,Oe);switch(Oe.shadeTolerance){case i8.NONE:{let qt=Number.MAX_VALUE;for(let rn=0;rn{let Le=l(He);if(!Le)throw new Error("parent of solar panel does not exist");const Ye=He.parentType===z.Roof,lt=He.parentType===z.Wall;if(Ye&&(Le=s(Le),!Le))throw new Error("foundation of solar panel does not exist");const Oe=a(He.pvModelName);if(!Oe)throw new Error("PV model not found");const ut=zi(N,r.latitude);if(ut.z<=0)return;const ht=lt?ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,s(He),He.lz):ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,void 0,void 0,!0),Qe=Le.rotation[2];let nt=He.tiltAngle,mt=Qe+(lt?0:He.relativeAzimuth),tt=!0;if(Ye&&(ht.z=He.cz+He.lz+.02+Le.cz,ye.isZero(He.rotation[0])?ht.z+=He.poleHeight:(nt=He.rotation[0],mt=Qe,tt=!1)),lt&&!ye.isZero(He.tiltAngle)){const ft=Le,wt=s(Le),Zt=(wt?wt.rotation[2]+ft.relativeAngle:ft.relativeAngle)-$t,Ot=He.ly*Math.abs(Math.sin(He.tiltAngle))/2;ht.x+=Ot*Math.cos(Zt),ht.y+=Ot*Math.sin(Zt)}const gt=new ue().fromArray(He.normal),Ve=N.getMonth(),je=ye.dayOfYear(N);let et,bt,St,Pt,Yt;r.discretization===Ay.EXACT?(et=He.lx,bt=He.ly,He.orientation===br.portrait?(St=Math.max(1,Math.round(He.lx/Oe.width)),Pt=Math.max(1,Math.round(He.ly/Oe.length)),St*=Oe.n,Pt*=Oe.m):(St=Math.max(1,Math.round(He.lx/Oe.length)),Pt=Math.max(1,Math.round(He.ly/Oe.width)),St*=Oe.m,Pt*=Oe.n),Yt=He.lx/St):(et=He.lx,bt=He.ly,St=Math.max(2,Math.round(He.lx/O)),Pt=Math.max(2,Math.round(He.ly/O)),St%2!==0&&(St+=1),Pt%2!==0&&(Pt+=1),Yt=O);const zt=et/St,Rt=bt/Pt,Ct=ht.x-(et-Yt)/2,yt=ht.y-(bt-Yt)/2,at=Ye||lt?ht.z:Le.lz+He.poleHeight+He.lz,Et=new _t(ht.x,ht.y),Lt=new ue,Je=Array.from(Array(St),()=>new Array(Pt));let st=new cn(Ye&&!tt?0:nt,0,mt,"ZYX");if(He.trackerType!==Bl.NO_TRACKER){const ft=Qe?ut.clone().applyAxisAngle(Oo,-Qe):ut.clone();switch(He.trackerType){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const wt=new zs().setFromUnitVectors(Oo,ft);st=new cn().setFromQuaternion(wt),st.z+=mt;break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const wt=new zs().setFromUnitVectors(Oo,new ue(ft.x,0,ft.z).normalize());st=new cn().setFromQuaternion(wt),st.z+=mt;break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{const wt=new ue(ft.x,-ft.y,0).normalize(),kt=Math.acos(Zc.dot(wt))*Math.sign(wt.x);st=new cn(He.tiltAngle,0,kt+Qe,"ZYX");break}case Bl.TILTED_SINGLE_AXIS_TRACKER:break}}if(lt&>.applyEuler(new cn(0,0,Le.relativeAngle)),gt.applyEuler(st),Ye&&!tt&&(st.x=He.rotation[0],st.z=He.rotation[2]+Qe),lt){const ft=l(He);ft&&(st.x=$t+He.tiltAngle,st.z=Le.relativeAngle+ft.rotation[2])}const It=Si(ut,je,U,hi.SPHERE_MODEL),ot=ei(r.ground,Ve,gt,It),it=gt.dot(ut),Be=new _t,pt=new ue;if(Oe.bifacialityFactor>0){const ft=gt.clone().negate(),wt=ei(r.ground,Ve,ft,It),kt=ot+wt*Oe.bifacialityFactor;for(let Zt=0;Zt0?it:-it*Oe.bifacialityFactor)*It)}else for(let ft=0;ft0&&(Be.set(Ct+ft*zt,yt+wt*Rt),pt.set(Be.x-Et.x,Be.y-Et.y,0),pt.applyEuler(st),Lt.set(ht.x+pt.x,ht.y+pt.y,at+pt.z),qe(He.id,Lt,ut)||(Je[ft][wt]+=it*It));let ct=0;switch(Oe.shadeTolerance){case i8.NONE:{let ft=Number.MAX_VALUE;for(let wt=0;wt=30?N.getHours()+1===24?0:N.getHours()+1:N.getHours();Xe[wt]+=ft*ct/(St*Pt)}},Ce=()=>{for(const He of i)if(He.type===z.SolarPanel){const Le=q.current.get(He.id);Le?Le.fill(0):q.current.set(He.id,new Array(24).fill(0))}},Te=()=>{for(const He of i)if(He.type===z.SolarPanel){const Le=ae.current.get(He.id);Le&&Le.length===E?Le.fill(0):ae.current.set(He.id,new Array(E).fill(0))}},Re=()=>{const He=de.daylight()/60;return He>Ht?k.sunshineHours[N.getMonth()]/(30*He*W):0},Ne=()=>{const He=he.current.daylight()/60;return He>Ht?k.sunshineHours[N.getMonth()]/(30*He*W):0},_e=He=>{if(!a(He.pvModelName))throw new Error("PV model not found");return He.lx*He.ly*(He.inverterEfficiency??.95)*(1-Y[N.getMonth()])},Ue=He=>{if(k){const Le=eS(He,k.lowestTemperatures,k.highestTemperatures);le.current=Zb(Le.high,Le.low,r.diurnalTemperatureModel,T,pl(He,r.latitude),ye.minutesIntoDay(He))}},qe=(He,Le,Ye)=>{if(_.current.length>1){G.current.length=0,j.set(Le,Ye);const lt=_.current.filter(Oe=>Oe.uuid!==He);return j.intersectObjects(lt,!1,G.current),G.current.length>0}return!1},Fe=()=>{const He=M.children.filter(Le=>Le.name==="Content");if(He.length>0){const Le=He[0].children;_.current.length=0;for(const Ye of Le)ye.fetchSimulationElements(Ye,_.current)}};return h.jsx(h.Fragment,{})}),tnr=xe.memo(()=>{const t=H(tu),e=H(TS),n=H(ZXe),o=H(QXe),r=H(x5e),[i,a]=g.useState("Boston MA, USA");return g.useEffect(()=>{if(Object.keys(r).length===0)return;const l=n(t,e)??"Boston MA, USA";a(l),o(l)},[t,e,r]),h.jsxs(h.Fragment,{children:[h.jsx(Otr,{city:i}),h.jsx(_tr,{city:i}),h.jsx(Vtr,{city:i}),h.jsx(Ztr,{city:i}),h.jsx(enr,{city:i}),h.jsx(Qtr,{}),h.jsx(Gtr,{city:i}),h.jsx(Xtr,{city:i}),h.jsx(Jtr,{city:i}),h.jsx(Ktr,{city:i}),h.jsx($tr,{city:i})]})}),zV="/aladdin/assets/image_fail_try_again-CaxVXMjm.png";var AN=(t=>(t[t.None=0]="None",t[t.Equal=1]="Equal",t[t.LessThan=2]="LessThan",t[t.GreaterThan=3]="GreaterThan",t[t.Between=4]="Between",t))(AN||{});const nnr=xe.memo(({yScale:t,tickLength:e,tickIntegers:n,variable:o,name:r,unit:i,type:a,digits:l,min:s,max:c,step:u,value:d,filter:f,hover:p})=>{const m=H(pn),y=H(Xp),w=H(Fn),x=H(Au),C=H(JXe),P=H(w5e),A=H(KXe),S=H(Qi),[v,b]=g.useState(!1),T=g.useRef(s),R=g.useRef(c);g.useEffect(()=>{T.current=s},[s]),g.useEffect(()=>{R.current=c},[c]);const M={lng:x},D=y.uid===C,k=t.range(),N=t(s)-t(c),U=40,W=g.useMemo(()=>{const Z=k[0]-k[1],ne=a==="number"?Math.floor(Z/e):1;return(n?t.ticks(ne).filter($=>Number.isInteger($)):t.ticks(ne)).map($=>({value:$,yOffset:t($)}))},[t,e,a,n,k]),F=()=>{m(Z=>{Z.projectState.selectedProperty=Z.projectState.selectedProperty!==o?o:null,S&&(Z.actionInfo={name:"Select Property",timestamp:new Date().getTime(),details:Z.projectState.selectedProperty})}),dt.getState().set(Z=>{Z.updateProjectsFlag=!0})},E=()=>{D&&C&&P?Vio(C,P,A!==o?o:null).then(()=>{F()}):F()},L=(Z,ne)=>h.jsx("span",{style:{display:"block",width:ne+"px"},children:Z}),j=()=>h.jsx("text",{onClick:E,x:0,y:-20,style:{fontSize:"10px",textAnchor:"middle",fill:"dimgray",cursor:"pointer",fontWeight:A===o?"bold":"normal"},children:r}),Y=g.useMemo(()=>o==="yearlyProfit"||o==="unitCost"||o==="sellingPrice"||o==="totalYearlyCost",[o]),O=()=>o==="totalYearlyCost"||o==="totalYearlyYield"||o==="meanYearlyYield"||o==="unitCost"||o==="poleHeight"||o==="interRowSpacing"?0:o==="tiltAngle"||o==="latitude"?-90:o==="rowWidth"?1:Number.MIN_SAFE_INTEGER,_=()=>o==="tiltAngle"||o==="latitude"?90:Number.MAX_SAFE_INTEGER,G=Z=>{if(Z===null)return;const ne=T.current,te={name:"Set Minimum: "+r,timestamp:Date.now(),oldValue:ne,newValue:Z,undo:()=>{Q(ne)},redo:()=>{Q(Z)}};w(te),Q(Z)},Q=Z=>{m(ne=>{if(ne.projectState.ranges){let te=-1,$=null;for(const[le,de]of ne.projectState.ranges.entries())if(de.variable===o){te=le,$=de;break}if(te>=0&&$)ne.projectState.ranges[te]={variable:$.variable,minimum:Z,maximum:$.maximum},D&&C&&y.uid&&ne.projectState.title&&Fze(y.uid,ne.projectState.title,ne.projectState.ranges).then(()=>{});else{const le={variable:o,minimum:Z,maximum:c};ne.projectState.ranges.push(le),D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,le).then(()=>{})}}else{const te={variable:o,minimum:Z,maximum:c};ne.projectState.ranges=[te],D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,te).then(()=>{})}}),T.current=Number(Z),b(!v)},oe=Z=>{if(Z===null)return;const ne=R.current,te={name:"Set Maximum: "+r,timestamp:Date.now(),oldValue:ne,newValue:Z,undo:()=>{ee(ne)},redo:()=>{ee(Z)}};w(te),ee(Z)},ee=Z=>{m(ne=>{if(ne.projectState.ranges){let te=-1,$=null;for(const[le,de]of ne.projectState.ranges.entries())if(de.variable===o){te=le,$=de;break}if(te>=0&&$)ne.projectState.ranges[te]={variable:$.variable,minimum:$.minimum,maximum:Z},D&&C&&y.uid&&ne.projectState.title&&Fze(y.uid,ne.projectState.title,ne.projectState.ranges).then(()=>{});else{const le={variable:o,minimum:s,maximum:Z};ne.projectState.ranges.push(le),D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,le).then(()=>{})}}else{const te={variable:o,minimum:s,maximum:Z};ne.projectState.ranges=[te],D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,te).then(()=>{})}}),R.current=Number(Z),b(!v)},q=Z=>{if(!f)return;const ne=[f.lowerBound,f.upperBound],te={name:"Set Filter: "+r,timestamp:Date.now(),oldValue:ne,newValue:Z,undo:()=>{ae(ne)},redo:()=>{ae(Z)}};w(te),ae(Z)},ae=Z=>{f&&(f.lowerBound=Z[0],f.upperBound=Z[1],p&&p(-1),m(ne=>{if(ne.projectState.filters){let te=-1;for(const[$,le]of ne.projectState.filters.entries())if(le.variable===o){te=$;break}if(te>=0)ne.projectState.filters[te]={variable:f.variable,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound},D&&C&&y.uid&&ne.projectState.title&&Yio(y.uid,ne.projectState.title,ne.projectState.filters).then(()=>{});else{const $={variable:o,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound};ne.projectState.filters.push($),D&&C&&y.uid&&ne.projectState.title&&Bio(y.uid,ne.projectState.title,$).then(()=>{})}}}),b(!v))};return h.jsxs(h.Fragment,{children:[o!=="orientation"?h.jsx(zl,{content:h.jsxs("div",{children:[h.jsx(mn,{style:{width:"240px"},addonBefore:L(B.t("word.Minimum",M)+(Y?" $":""),80),addonAfter:i,min:O(),max:R.current-u,step:u,value:T.current,onPressEnter:Z=>G(Number.parseFloat(Z.target.value)),onStep:Z=>G(Z)}),h.jsx("br",{}),h.jsx(mn,{style:{width:"240px"},addonBefore:L(B.t("word.Maximum",M)+(Y?" $":""),80),addonAfter:i,min:T.current+u,max:_(),step:u,value:R.current,onPressEnter:Z=>oe(Number.parseFloat(Z.target.value)),onStep:Z=>oe(Z)})]}),children:j()}):h.jsx(h.Fragment,{children:j()}),d!==void 0&&h.jsx("text",{x:0,y:-8,style:{fontSize:"9px",textAnchor:"middle",fill:"dimgray"},children:Y?d.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:l})+(o==="yearlyProfit"||o==="totalYearlyCost"?"K":""):(o==="orientation"?B.t(d===0?"solarPanelMenu.Landscape":"solarPanelMenu.Portrait",M)+(d===0?" (▭)":" (▯)"):d.toFixed(l))+(i!==""?i:"")}),f&&f.type===AN.Between&&h.jsx("rect",{x:-5,y:t(f.upperBound??c),width:10,height:t((f==null?void 0:f.lowerBound)??s)-t((f==null?void 0:f.upperBound)??c),fill:"lightgray"}),h.jsx("rect",{x:-40/2,y:0,width:U,height:N,fill:"gold",fillOpacity:A===o?.25:0}),W.map(({value:Z,yOffset:ne})=>h.jsxs("g",{transform:`translate(0, ${ne})`,shapeRendering:"crispEdges",children:[h.jsx("line",{x1:-5,x2:0,stroke:"black",strokeWidth:1}),h.jsx("text",{style:{fontSize:"10px",textAnchor:"start",alignmentBaseline:"central",transform:"translateX(-25px)"},children:o==="orientation"?Z===0?"▭":"▯":Z},Z)]},Z)),h.jsx("line",{x1:0,x2:0,y1:t(s),y2:t(c),stroke:"black",strokeWidth:2}),f&&f.type===AN.Between&&h.jsx("foreignObject",{x:-40/2,y:4,width:U,height:N-3,children:h.jsx(n2,{theme:{components:{Slider:{railBg:"black",railSize:0,handleSize:8}}},children:h.jsx(B0,{style:{marginLeft:U/2+"px"},min:s,max:c,step:(c-s)/100,value:[f.lowerBound??s,f.upperBound??c],onChange:Z=>ae(Z),onChangeComplete:Z=>q(Z),range:!0,vertical:!0})})})]})}),aC={top:30,right:55,bottom:36,left:55},onr=["#e0ac2b","#e85252","#6689c6","#9a6fb0","#a53253","#69b3a2","#556b2f","#8b008b","#ff1493","#d2691e","#2f4f4f","#dc143c"],rnr=xe.memo(({id:t,width:e,height:n,data:o,types:r,minima:i,maxima:a,filters:l,steps:s,variables:c,titles:u,units:d,digits:f,tickIntegers:p,hover:m,hoveredIndex:y,selectedIndex:w})=>{const x=e-aC.right-aC.left,C=n-aC.top-aC.bottom,P=g.useMemo(()=>[...new Set(o.map(M=>M.group))],[o]),A=g.useMemo(()=>VR().range([0,x]).domain(c).padding(0),[c,x]),S=g.useMemo(()=>{const M={};return c.forEach((D,k)=>{M[D]=YW().range([C,0]).domain([i[k]??0,a[k]??1])}),M},[c,i,a,C]),v=g.useMemo(()=>Toe().domain(P).range(onr),[P]),b=Rwe(),T=g.useMemo(()=>o.map((M,D)=>{if(M.invisible)return null;const k=c.map(U=>{const W=S[U],F=A(U)??0,E=W(M[U]);return[F,E]}),N=b(k);if(N)return h.jsx("path",{onMouseOver:()=>{m(D)},d:N,stroke:M.hovered?"red":v(M.group),fill:"none",strokeWidth:M.excluded?.25:M.selected?3:1,strokeDasharray:M.hovered?"3,3":"none"},D)}),[o,c,A,S,v]),R=g.useMemo(()=>c.map((M,D)=>{const k=S[M];return h.jsx("g",{transform:"translate("+A(M)+",0)",children:h.jsx(nnr,{yScale:k,tickLength:40,tickIntegers:p[D],type:r[D]??"number",variable:c[D],name:u[D],unit:d[D],digits:f[D],min:i[D],max:a[D],step:s[D],value:y>=0&&!o[y].invisible?o[y][M]:w>=0&&!o[w].invisible?o[w][M]:void 0,filter:l[D],hover:m})},D)}),[c,o,A,S,p,r,u,d,f,i,a,s,l,w,y]);return h.jsx("svg",{id:t,width:e,height:n,onMouseLeave:()=>{m&&m(-1)},onContextMenu:M=>{M.stopPropagation()},children:h.jsxs("g",{width:x,height:C,transform:`translate(${[aC.left,aC.top].join(",")})`,children:[T,R]})})});var Vme={};(function(t){(function(){var e=t||!1||this||window;e.default=e;var n="http://www.w3.org/2000/xmlns/",o="http://www.w3.org/1999/xhtml",r="http://www.w3.org/2000/svg",i=']>',a=/url\(["']?(.+?)["']?\)/,l={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},s=function(k){return k instanceof HTMLElement||k instanceof SVGElement},c=function(k){if(!s(k))throw new Error("an HTMLElement or SVGElement is required; got "+k)},u=function(k){return new Promise(function(N,U){s(k)?N(k):U(new Error("an HTMLElement or SVGElement is required; got "+k))})},d=function(k){return k&&k.lastIndexOf("http",0)===0&&k.lastIndexOf(window.location.host)===-1},f=function(k){var N=Object.keys(l).filter(function(U){return k.indexOf("."+U)>0}).map(function(U){return l[U]});return N?N[0]:(console.error("Unknown font format for "+k+". Fonts may not be working correctly."),"application/octet-stream")},p=function(k){for(var N="",U=new Uint8Array(k),W=0;W"u"||W===null||isNaN(parseFloat(W))?0:W},y=function(k,N,U,W){if(k.tagName==="svg")return{width:U||m(k,N,"width"),height:W||m(k,N,"height")};if(k.getBBox){var F=k.getBBox(),E=F.x,L=F.y,j=F.width,Y=F.height;return{width:E+j,height:L+Y}}},w=function(k){return decodeURIComponent(encodeURIComponent(k).replace(/%([0-9A-F]{2})/g,function(N,U){var W=String.fromCharCode("0x"+U);return W==="%"?"%25":W}))},x=function(k){for(var N=window.atob(k.split(",")[1]),U=k.split(",")[0].split(":")[1].split(";")[0],W=new ArrayBuffer(N.length),F=new Uint8Array(W),E=0;E"u",G=L||[];return T().forEach(function(Q){var oe=Q.rules,ee=Q.href;oe&&Array.from(oe).forEach(function(q){if(typeof q.style<"u")if(C(k,q.selectorText))O.push(Y(q.selectorText,q.style.cssText));else if(_&&q.cssText.match(/^@font-face/)){var ae=P(q,ee);ae&&G.push(ae)}else j||O.push(q.cssText)})}),v(G).then(function(Q){return O.join(` -`)+Q})},M=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};e.prepareSvg=function(D,k,N){c(D);var U=k||{},W=U.left,F=W===void 0?0:W,E=U.top,L=E===void 0?0:E,j=U.width,Y=U.height,O=U.scale,_=O===void 0?1:O,G=U.responsive,Q=G===void 0?!1:G,oe=U.excludeCss,ee=oe===void 0?!1:oe;return A(D).then(function(){var q=D.cloneNode(!0);q.style.backgroundColor=(k||{}).backgroundColor||D.style.backgroundColor;var ae=y(D,q,j,Y),Z=ae.width,ne=ae.height;if(D.tagName!=="svg")if(D.getBBox){q.getAttribute("transform")!=null&&q.setAttribute("transform",q.getAttribute("transform").replace(/translate\(.*?\)/,""));var te=document.createElementNS("http://www.w3.org/2000/svg","svg");te.appendChild(q),q=te}else{console.error("Attempted to render non-SVG element",D);return}if(q.setAttribute("version","1.1"),q.setAttribute("viewBox",[F,L,Z,ne].join(" ")),q.getAttribute("xmlns")||q.setAttributeNS(n,"xmlns",r),q.getAttribute("xmlns:xlink")||q.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink"),Q?(q.removeAttribute("width"),q.removeAttribute("height"),q.setAttribute("preserveAspectRatio","xMinYMin meet")):(q.setAttribute("width",Z*_),q.setAttribute("height",ne*_)),Array.from(q.querySelectorAll("foreignObject > *")).forEach(function(de){de.setAttributeNS(n,"xmlns",de.tagName==="svg"?r:o)}),ee){var $=document.createElement("div");$.appendChild(q);var le=$.innerHTML;if(typeof N=="function")N(le,Z,ne);else return{src:le,width:Z,height:ne}}else return R(D,k).then(function(de){var he=document.createElement("style");he.setAttribute("type","text/css"),he.innerHTML=`{const e=H.getState().world,n=H(Qi),o=H(I0)??Lu,r=H(pn),i=H(qN),a=new Date(H(ml)),l=H(TSt),s=dt(t5e),c=dt(dQ),u=dt(hPt),d=dt(Ef),f=ye.hasSolarPanels(H.getState().elements),p=In(iJe),m=In(aJe),y=In(lJe),w=H(kc),x=g.useRef(null),C=g.useRef(),P=x.current?x.current.clientWidth+40:l?l.width+40:640,A=x.current?x.current.clientHeight+100:l?l.height+100:600,[S,v]=g.useState({x:l?Math.max(l.x,P-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-A):0}),b=xe.useRef(null),T=Kt(),R=_1(t),M=Bs[a.getMonth()],D=e.daysPerYear??6,k=12/D,[N,U]=g.useState(0),[W,F]=g.useState(0),[E,L]=g.useState(0),[j,Y]=g.useState(0),[O,_]=g.useState(["Heater","AC","Solar","Net"]),[G,Q]=g.useState([]),{sum:oe,sumHeaterMap:ee,sumAcMap:$,sumSolarPanelMap:ae,dataLabels:Z}=N1t(a,R,f),ne=g.useRef(new Array(D).fill({})),te=g.useRef(new Array(D).fill(0)),q=g.useRef(new Array(D).fill(0)),le=g.useRef(new Array(D).fill(0)),de=g.useRef(new Array(D).fill(0)),he=g.useRef([]),me=g.useRef([]),ce=g.useRef([]),Pe=g.useRef([]);g.useEffect(()=>{pe()},[D,u]),g.useEffect(()=>{c&&pe()},[c]);const pe=()=>{ne.current=new Array(D).fill({}),te.current=new Array(D).fill(0),q.current=new Array(D).fill(0),le.current=new Array(D).fill(0),de.current=new Array(D).fill(0),Q([]),U(0),F(0),L(0),Y(0),_([])};g.useEffect(()=>{const we=Math.floor(a.getMonth()/k),Se=(Object.keys(oe[0]).length-1)/(f?4:3);if(he.current=[],me.current=[],Pe.current=[],ce.current=[],Se>1){const Ue=new Map,qe=new Map,Fe=new Map,He=new Map;for(const Oe of oe){let ut=0;for(let ht=0;ht6&&(He=" "+Oe.substring(6).trim());break}const Le="Heater"+He,Ye="AC"+He,lt="Net"+He;if(f){const Oe="Solar"+He;let ut=0;_([Le,Ye,Oe,lt]);for(const Qe of oe)Ue+=Qe[Le],qe+=Qe[Ye],ut+=Qe[Oe],Fe+=Qe[lt];const ht={};ht.Month=Bs[a.getMonth()],ht[Le]=30*Ue,ht[Ye]=30*qe,ht[Oe]=30*ut,ht[lt]=30*Fe,ne.current[we]=ht}else{_([Le,Ye,lt]);for(const ut of oe)Ue+=ut[Le],qe+=ut[Ye],Fe+=ut[lt];const Oe={};Oe.Month=Bs[a.getMonth()],Oe[Le]=30*Ue,Oe[Ye]=30*qe,Oe[lt]=30*Fe,ne.current[we]=Oe}}Q([...ne.current]);let Me=0;if(ee)for(const Ue of ee.keys())Me+=ee.get(Ue)??0;let Ce=0;if($)for(const Ue of $.keys())Ce+=$.get(Ue)??0;let Te=0;if(ae&&f)for(const Ue of ae.keys())Te+=ae.get(Ue)??0;te.current[we]=Me*k*30,q.current[we]=Ce*k*30,le.current[we]=Te*k*30,de.current[we]=te.current[we]+q.current[we]-le.current[we];const Re=te.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0);U(Re);const Ne=q.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0);F(Ne);const _e=le.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0);L(_e),Y(de.current.slice(0,we+1).reduce((Ue,qe)=>Ue+qe,0)),p(Re),m(Ne),y(_e),dt.getState().showSolarRadiationHeatmap||In.getState().clearDataStore()},[s]),g.useEffect(()=>{v({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-A)})},[l,P,A]),g.useEffect(()=>{const we=()=>{v({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-A)})};return window.addEventListener("resize",we),()=>{window.removeEventListener("resize",we)}},[l,P,A]),g.useEffect(()=>(x.current&&(C.current||(C.current=new ResizeObserver(()=>{r(we=>{x.current&&(we.viewState.yearlyBuildingEnergyPanelRect||(we.viewState.yearlyBuildingEnergyPanelRect=new fr(0,0,600,500)),we.viewState.yearlyBuildingEnergyPanelRect.width=x.current.offsetWidth,we.viewState.yearlyBuildingEnergyPanelRect.height=x.current.offsetHeight)})})),C.current.observe(x.current)),()=>{var we;(we=C.current)==null||we.disconnect()}),[]);const Ie=(we,Se)=>{v({x:Math.max(Se.x,P-window.innerWidth),y:Math.min(Se.y,window.innerHeight-A)})},ve=(we,Se)=>{r(Me=>{Me.viewState.yearlyBuildingEnergyPanelRect||(Me.viewState.yearlyBuildingEnergyPanelRect=new fr(0,0,600,360)),Me.viewState.yearlyBuildingEnergyPanelRect.x=Math.max(Se.x,P-window.innerWidth),Me.viewState.yearlyBuildingEnergyPanelRect.y=Math.min(Se.y,window.innerHeight-A)})},ze=()=>{r(we=>{we.viewState.showYearlyBuildingEnergyPanel=!1,n&&(we.actionInfo={name:"Close Yearly Building Energy Graph",timestamp:new Date().getTime()})})},Ae=B.t("word.Month",T),se=B.t("word.Energy",T),ge=G&&G[0]?Object.keys(G[0]).length===0:!0;return h.jsx(Vi,{nodeRef:b,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:Ie,onStop:ve,onMouseDown:()=>{r(we=>{we.selectedFloatingWindow="yearlyBuildingEnergyPanel"})},children:h.jsx(Ftr,{ref:b,style:{zIndex:w==="yearlyBuildingEnergyPanel"?Ec:9},children:h.jsxs(Ltr,{ref:x,style:{opacity:o,width:(l?l.width:600)+"px",height:(l?l.height:400)+"px"},children:[h.jsxs(Wtr,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[B.t("buildingEnergyPanel.YearlyBuildingEnergy",T)+": ",h.jsx("span",{style:{fontSize:"10px"},children:B.t("sensorPanel.WeatherDataFrom",T)+" "+t+" | "+a.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{ze()},onMouseDown:()=>{ze()},children:`${B.t("word.Close",T)}`})]}),h.jsx(U1t,{type:bi.YearlyBuildingEnergy,dataSource:G,hasSolarPanels:f,labels:O,height:100,dataKeyAxisX:"Month",labelX:Ae,labelY:se,unitY:B.t("word.kWh",T),yMin:0,curveType:"linear",fractionDigits:2,referenceX:M}),!d&&h.jsxs(Jt,{style:{alignSelf:"center",direction:"ltr"},children:[he.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Heater",T)+": "+N.toFixed(0)}):h.jsx(zl,{content:he.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Heater",T)+": "+N.toFixed(0)})}),me.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.AC",T)+": "+W.toFixed(0)}):h.jsx(zl,{content:me.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.AC",T)+": "+W.toFixed(0)})}),E!==0&&h.jsx(h.Fragment,{children:ce.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.SolarPanel",T)+": "+E.toFixed(0)}):h.jsx(zl,{content:ce.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.SolarPanel",T)+": "+E.toFixed(0)})})}),Pe.current.length===0?h.jsx(Jt,{style:{cursor:"default"},children:B.t("buildingEnergyPanel.Net",T)+": "+j.toFixed(0)}):h.jsx(zl,{content:Pe.current.map((we,Se)=>h.jsx("div",{children:we},Se)),children:h.jsx(Jt,{style:{cursor:"help"},children:B.t("buildingEnergyPanel.Net",T)+": "+j.toFixed(0)})}),h.jsx(oo,{type:"default",icon:ge?h.jsx(Bh,{}):h.jsx(Lf,{}),title:B.t(ge?"word.Run":"word.Update",T),onClick:()=>{const we=H.getState().elements,Se=H.getState().countElementsByType,Me=H.getState().getChildrenOfType,Ce=jJ(we,Se,Me);if(Ce.status===Xg.NO_BUILDING){yn(B.t("analysisManager.NoBuildingForAnalysis",T));return}if(Ce.status===Xg.AT_LEAST_ONE_BAD_NO_GOOD){let Te;switch(Ce.buildingCompletion){case $c.WALL_DISJOINED:Te=B.t("message.WallsAreNotConnected",T);break;case $c.WALL_EMPTY:Te=B.t("message.BuildingContainsEmptyWall",T);break;case $c.ROOF_MISSING:Te=B.t("message.BuildingRoofMissing",T);break;default:Te=B.t("message.UnknownErrors",T)}co(B.t("message.SimulationWillNotStartDueToErrors",T)+": "+Te);return}Ce.status===Xg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&RH(B.t("message.SimulationWillStartDespiteWarnings",T)),yn(B.t("message.SimulationStarted",T)),setTimeout(()=>{i(),dt.getState().set(Te=>{Te.runYearlyThermalSimulation=!0,Te.pauseYearlyThermalSimulation=!1,Te.simulationInProgress=!0}),r(Te=>{n&&(Te.actionInfo={name:"Run Yearly Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(oo,{type:"default",icon:h.jsx(nd,{}),title:B.t("word.SaveAsImage",T),onClick:()=>{Yd("line-graph-"+Ae+"-"+se,"yearly-building-energy").then(()=>{yn(B.t("message.ScreenshotSaved",T)),n&&r(we=>{we.actionInfo={name:"Take Screenshot of Yearly Building Energy Graph",timestamp:new Date().getTime()}})})}}),ne.current&&ne.current.length>0&&h.jsx(oo,{type:"default",icon:h.jsx(Wf,{}),title:B.t("word.SaveAsCsv",T),onClick:()=>{Yh(ne.current,"yearly-building-energy.csv"),yn(B.t("message.CsvFileSaved",T)),n&&r(we=>{we.actionInfo={name:"Export Yearly Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Utr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(Fn),o=H(yTt),r=H(ATt),[i,a]=g.useState(!1),[l,s]=g.useState(!1),[c,u]=g.useState({left:0,top:0,bottom:0,right:0}),d=g.useRef(null),f=g.useRef(null),p=g.useRef(o),m=g.useRef(r),y=Kt();g.useEffect(()=>{var v;(v=f.current)==null||v.focus()},[]);const w=(v,b)=>{if(d.current){const{clientWidth:T,clientHeight:R}=window.document.documentElement,M=d.current.getBoundingClientRect();u({left:-M.left+b.x,right:T-(M.right-b.x),top:-M.top+b.y,bottom:R-((M==null?void 0:M.bottom)-b.y)})}},x=v=>{e(b=>{b.minimumNavigationMoveSpeed=v}),dt.getState().set(b=>{b.navigationMoveSpeed=v})},C=v=>{e(b=>{b.minimumNavigationTurnSpeed=v}),dt.getState().set(b=>{b.navigationTurnSpeed=v})},P=()=>{const v=o,b=p.current;if(v!==b){const M={name:"Minimum Navigation Move Speed",timestamp:Date.now(),oldValue:v,newValue:b,undo:()=>{x(M.oldValue)},redo:()=>{x(M.newValue)}};n(M),x(b)}const T=r,R=m.current;if(T!==R){const M={name:"Minimum Navigation Turn Speed",timestamp:Date.now(),oldValue:T,newValue:R,undo:()=>{C(M.oldValue)},redo:()=>{C(M.newValue)}};n(M),C(R)}},A=()=>{t(!1)},S=()=>{P(),t(!1)};return h.jsxs(li,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:`${B.t("navigationPanel.NavigationParameters",y)}`}),footer:[h.jsx(oo,{onClick:A,children:`${B.t("word.Cancel",y)}`},"Cancel"),h.jsx(oo,{type:"primary",ref:f,onClick:S,children:`${B.t("word.OK",y)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:v=>h.jsx(Vi,{disabled:!l,bounds:c,onStart:(b,T)=>w(b,T),children:h.jsx("div",{ref:d,children:v})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("navigationPanel.MinimumMoveSpeed",y)+" ([1, 10]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:10,style:{width:"100%"},precision:0,value:p.current,step:1,onChange:v=>{p.current=Number(v),a(!i)},onBlur:v=>{const b=v.target.value,T=parseFloat(b);p.current=Number.isNaN(T)?3:T,a(!i)},onPressEnter:v=>{const b=v.target.value,T=parseFloat(b);p.current=Number.isNaN(T)?3:T,a(!i)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("navigationPanel.MinimumTurnSpeed",y)+" ([1, 5]): "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:5,style:{width:"100%"},precision:0,value:m.current,step:1,onChange:v=>{m.current=Number(v),a(!i)},onBlur:v=>{const b=v.target.value,T=parseFloat(b);m.current=Number.isNaN(T)?3:T,a(!i)},onPressEnter:v=>{const b=v.target.value,T=parseFloat(b);m.current=Number.isNaN(T)?3:T,a(!i)}})})]})]})}),jtr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(Fn),o=H(aQ),r=ye.getShadowMapSize(),i=4096,a=1e4,[l,s]=g.useState(!1),[c,u]=g.useState(!1),[d,f]=g.useState({left:0,top:0,bottom:0,right:0}),p=g.useRef(null),m=g.useRef(null),y=g.useRef(o?Math.round(o)/a:1),w=g.useRef(r?Math.round(r/i):1),x=Kt();g.useEffect(()=>{var T;(T=m.current)==null||T.focus()},[]);const C=(T,R)=>{if(p.current){const{clientWidth:M,clientHeight:D}=window.document.documentElement,k=p.current.getBoundingClientRect();f({left:-k.left+R.x,right:M-(k.right-R.x),top:-k.top+R.y,bottom:D-((k==null?void 0:k.bottom)-R.y)})}},P=T=>{e(R=>{R.viewState.shadowCameraFar=T})},A=T=>{localStorage.setItem("aladdin-shadow-map-size",T.toString())},S=()=>{const T=o,R=y.current*a;if(T!==R){const k={name:"Shadow Camera Far Distance",timestamp:Date.now(),oldValue:T,newValue:R,undo:()=>{P(k.oldValue)},redo:()=>{P(k.newValue)}};n(k),P(R)}const M=r,D=w.current*i;if(M!==D){const k={name:"Shadow Map Size",timestamp:Date.now(),oldValue:M,newValue:D,undo:()=>{A(k.oldValue)},redo:()=>{A(k.newValue)}};n(k),A(D)}},v=()=>{t(!1)},b=()=>{S(),t(!1),window.location.reload()};return h.jsxs(li,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>u(!0),onMouseOut:()=>u(!1),children:`${B.t("shadowSettingsPanel.ShadowSettings",x)}`}),footer:[h.jsx(oo,{onClick:v,children:`${B.t("word.Cancel",x)}`},"Cancel"),h.jsx(oo,{type:"primary",ref:m,onClick:b,children:`${B.t("word.OK",x)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:T=>h.jsx(Vi,{disabled:!c,bounds:d,onStart:(R,M)=>C(R,M),children:h.jsx("div",{ref:p,children:T})}),children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:18,children:B.t("shadowSettingsPanel.ShadowCameraFarDistance",x)+" ([1, 1000]×"+a+"): "}),h.jsx(Ge,{span:6,children:h.jsx(mn,{min:1,max:1e3,style:{width:"100%"},precision:0,value:y.current,step:1,onChange:T=>{y.current=Number(T),s(!l)},onBlur:T=>{const R=T.target.value,M=parseFloat(R);y.current=Number.isNaN(M)?1:M,s(!l)},onPressEnter:T=>{const R=T.target.value,M=parseFloat(R);y.current=Number.isNaN(M)?1:M,s(!l)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"10px"},children:[h.jsx(Ge,{span:18,children:B.t("shadowSettingsPanel.ShadowMapSize",x)+" ([1, 4]×"+i+"): "}),h.jsx(Ge,{span:6,children:h.jsx(mn,{min:1,max:4,style:{width:"100%"},precision:0,value:w.current,step:1,onChange:T=>{w.current=Number(T),s(!l)},onBlur:T=>{const R=T.target.value,M=parseFloat(R);w.current=Number.isNaN(M)?1:M,s(!l)},onPressEnter:T=>{const R=T.target.value,M=parseFloat(R);w.current=Number.isNaN(M)?1:M,s(!l)}})})]}),h.jsx(Qt,{style:{fontSize:"10px"},children:h.jsxs(Ge,{span:24,children:[B.t("shadowSettingsPanel.Notes",x),":",h.jsx("br",{}),h.jsxs("ul",{children:[h.jsx("li",{children:B.t("shadowSettingsPanel.RefreshPageNote",x)}),h.jsx("li",{children:B.t("shadowSettingsPanel.MapSizeWarning",x)})]})]})})]})}),{Option:UE}=Ko,Btr=xe.memo(({setDialogVisible:t})=>{const e=H(pn),n=H(i5e),o=H(Fn),r=H(Qi),i=H(jM),a=H(BM),l=H(zTt),[s,c]=g.useState(!1),[u,d]=g.useState(!1),[f,p]=g.useState({left:0,top:0,bottom:0,right:0}),m=g.useRef(null),y=g.useRef("Unknown"),w=g.useRef("Unknown"),x=g.useRef("Monocrystalline"),C=g.useRef(12),P=g.useRef(8),A=g.useRef("Black"),S=g.useRef(1),v=g.useRef(1.5),b=g.useRef(0),T=g.useRef(.2),R=g.useRef(45),M=g.useRef(300),D=g.useRef(-.002),k=g.useRef(.005),N=g.useRef(30),U=g.useRef(30),W=g.useRef(10),F=g.useRef(40),E=g.useRef(15),L=Kt();g.useEffect(()=>{const te=document.getElementsByClassName("ant-modal-wrap");if(te)for(const q of te)q.style["pointer-events"]="none"},[]);const j=(te,q)=>{if(m.current){const{clientWidth:le,clientHeight:de}=window.document.documentElement,he=m.current.getBoundingClientRect();p({left:-he.left+q.x,right:le-(he.right-q.x),top:-he.top+q.y,bottom:de-((he==null?void 0:he.bottom)-q.y)})}},Y=g.useMemo(()=>{const te=[];for(const q in a)te.push(q);return te},[a]),O=()=>({name:y.current.trim(),brand:w.current.trim(),cellType:x.current,efficiency:T.current,length:v.current,nominalLength:v.current,width:S.current,nominalWidth:S.current,thickness:k.current,m:C.current,n:P.current,pmax:M.current,vmpp:U.current,impp:W.current,voc:F.current,isc:E.current,pmaxTC:D.current,noct:R.current,weight:N.current,color:A.current,shadeTolerance:i8.PARTIAL,bifacialityFactor:b.current}),_=te=>{y.current=te.name,w.current=te.brand,x.current=te.cellType,T.current=te.efficiency,v.current=te.length,S.current=te.width,k.current=te.thickness,C.current=te.m,P.current=te.n,M.current=te.pmax,U.current=te.vmpp,W.current=te.impp,F.current=te.voc,E.current=te.isc,D.current=te.pmaxTC,R.current=te.noct,N.current=te.weight,A.current=te.color,b.current=te.bifacialityFactor},G=()=>{if(y.current.trim()===""){li.info({title:B.t("pvModelPanel.CannotAddCustomSolarPanel",L),content:B.t("pvModelPanel.CustomSolarPanelMustHaveModelName",L)+"."});return}if(i[y.current.trim()]){li.info({title:B.t("pvModelPanel.NoNeedToAddThisCustomSolarPanel",L),content:B.t("pvModelPanel.SolarPanelModelAlreadyProvidedBySystem",L)+" ("+y.current+")."});return}if(Y.includes(y.current))li.info({title:B.t("pvModelPanel.CannotAddCustomSolarPanel",L),content:B.t("pvModelPanel.CustomSolarPanelExists",L)+': "'+y.current+'"'});else{const te=O(),q={name:"Add Custom Solar Panel",timestamp:Date.now(),pvModel:te,undo:()=>{ee(y.current.trim())},redo:()=>{l(te)}};o(q),l(te)}},Q=te=>{try{const q=JSON.parse(te);if(!q.cellType||!q.pmax){co(B.t("pvModelPanel.FailInImportingDataFromClipboard",L));return}_(q),c(le=>!le)}catch(q){co(B.t("pvModelPanel.FailInImportingDataFromClipboard",L)+":"+q)}},oe=()=>{li.confirm({title:B.t("pvModelPanel.DoYouReallyWantToImportCustomSolarPanel",L)+"?",content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(a7,{style:{marginRight:"6px"}}),B.t("word.Warning",L)+": "+B.t("pvModelPanel.ExistingSettingsWillBeOverwritten",L)+"."]}),icon:h.jsx(t4,{}),onOk:()=>{navigator.clipboard.readText().then(te=>{const q={name:"Import Custom Solar Panel",timestamp:Date.now(),pvModel:O(),info:te,undo:()=>{_(q.pvModel),c(le=>!le)},redo:()=>{q.info&&Q(q.info)}};o(q),Q(te)}).catch(te=>{co(B.t("pvModelPanel.FailInImportingDataFromClipboard",L)+":"+te)})}})},ee=te=>{e(q=>{delete q.customPvModules[te]})},$=te=>{e(q=>{let le=!1;for(const de of q.elements)if(de.type===z.SolarPanel&&de.pvModelName===te){le=!0;break}if(le)co(B.t("pvModelPanel.ThisCustomSolarPanelIsUsed",{lng:q.language}));else{const de={...q.customPvModules[te]},he={name:"Remove Custom Solar Panel",timestamp:Date.now(),pvModel:de,undo:()=>{l(de)},redo:()=>{ee(te)}};o(he),delete q.customPvModules[te]}})},ae=te=>{li.confirm({title:B.t("pvModelPanel.DoYouReallyWantToRemoveThisCustomSolarPanel",L)+' "'+te+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(a7,{style:{marginRight:"6px"}}),B.t("word.Warning",L)+": "+B.t("pvModelPanel.MakeSureThisCustomSolarPanelIsNotUsed",L)+"."]}),icon:h.jsx(t4,{}),onOk:()=>{$(te)}})},Z=[{key:"1",label:B.t("pvModelPanel.General",L),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.Model",L)+": "}),h.jsx(Ge,{span:10,children:h.jsx(Vl,{style:{width:"100%"},value:y.current,onChange:te=>{y.current=te.target.value,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.BrandName",L)+": "}),h.jsx(Ge,{span:10,children:h.jsx(Vl,{style:{width:"100%"},value:w.current,onChange:te=>{w.current=te.target.value,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.CellType",L)+":"}),h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"100%"},value:x.current,onChange:te=>{x.current=te,c(!s)},children:[h.jsx(UE,{value:"Monocrystalline",children:B.t("pvModelPanel.Monocrystalline",L)},"Monocrystalline"),h.jsx(UE,{value:"Polycrystalline",children:B.t("pvModelPanel.Polycrystalline",L)},"Polycrystalline"),h.jsx(UE,{value:"Thin Film",children:B.t("pvModelPanel.ThinFilm",L)},"Thin Film")]})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Length",L)+" ([0.1, 3]"+B.t("word.MeterAbbreviation",L)+"): "}),h.jsx(Ge,{span:10,children:h.jsx(mn,{min:.1,max:3,style:{width:"100%"},precision:3,value:v.current,step:.01,onChange:te=>{te!==null&&(v.current=te,c(!s))},onBlur:te=>{const q=parseFloat(te.target.value);v.current=Number.isNaN(q)?1:q,c(!s)},onPressEnter:te=>{const q=parseFloat(te.target.value);v.current=Number.isNaN(q)?1:q,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Width",L)+" ([0.1, 3]"+B.t("word.MeterAbbreviation",L)+"): "}),h.jsx(Ge,{span:10,children:h.jsx(mn,{min:.1,max:3,style:{width:"100%"},precision:3,value:S.current,step:.01,onChange:te=>{te!==null&&(S.current=te,c(!s))},onBlur:te=>{const q=parseFloat(te.target.value);S.current=Number.isNaN(q)?1:q,c(!s)},onPressEnter:te=>{const q=parseFloat(te.target.value);S.current=Number.isNaN(q)?1:q,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.PowerBifaciality",L)+" ([0, 1]):"}),h.jsx(Ge,{span:10,children:h.jsx(mn,{style:{width:"100%"},precision:2,step:.01,value:b.current,onChange:te=>{te!==null&&(b.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("pvModelPanel.Weight",L)+" ("+B.t("pvModelPanel.Kilogram",L)+"):"}),h.jsx(Ge,{span:10,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:N.current,onChange:te=>{te!==null&&(N.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Thickness",L)+" ("+B.t("word.MeterAbbreviation",L)+"):"}),h.jsx(Ge,{span:10,children:h.jsx(mn,{style:{width:"100%"},precision:4,step:1e-4,value:k.current,onChange:te=>{te!==null&&(k.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,children:B.t("word.Color",L)+":"}),h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"100%"},value:A.current,onChange:te=>{A.current=te,c(!s)},children:[h.jsx(UE,{value:"Black",children:B.t("pvModelPanel.Black",L)},"Black"),h.jsx(UE,{value:"Blue",children:B.t("pvModelPanel.Blue",L)},"Blue")]})})]})]})},{key:"2",label:B.t("pvModelPanel.Electrical",L),children:h.jsxs(h.Fragment,{children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.SolarCellEfficiency",L)+" (%):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:100*T.current,onChange:te=>{te!==null&&(T.current=te*.01,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.CellCountInXDirection",L)+": "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:36,style:{width:"100%"},precision:0,value:C.current,step:1,onChange:te=>{te!==null&&(C.current=te,c(!s))},onBlur:te=>{const q=parseFloat(te.target.value);C.current=Number.isNaN(q)?1:q,c(!s)},onPressEnter:te=>{const q=parseFloat(te.target.value);C.current=Number.isNaN(q)?1:q,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.CellCountInYDirection",L)+": "}),h.jsx(Ge,{span:8,children:h.jsx(mn,{min:1,max:36,style:{width:"100%"},precision:0,value:P.current,step:1,onChange:te=>{te!==null&&(P.current=te,c(!s))},onBlur:te=>{const q=parseFloat(te.target.value);P.current=Number.isNaN(q)?1:q,c(!s)},onPressEnter:te=>{const q=parseFloat(te.target.value);P.current=Number.isNaN(q)?1:q,c(!s)}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.MaximumRatedPower",L)+" Pmax ("+B.t("word.WattAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:1,value:M.current,onChange:te=>{te!==null&&(M.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.TemperatureCoefficientOfPmax",L)+" (%/°C):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},step:1e-4,value:D.current,onChange:te=>{te!==null&&(D.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.NominalOperatingCellTemperature",L)+" (°C):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},step:1,precision:1,value:R.current,onChange:te=>{te!==null&&(R.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.RatedVoltage",L)+" Vmpp ("+B.t("word.VoltAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:U.current,onChange:te=>{te!==null&&(U.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.RatedCurrent",L)+" Impp ("+B.t("word.AmpereAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:2,step:.1,value:W.current,onChange:te=>{te!==null&&(W.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.OpenCircuitVoltage",L)+" Voc ("+B.t("word.VoltAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:1,step:.1,value:F.current,onChange:te=>{te!==null&&(F.current=te,c(!s))}})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:16,children:B.t("pvModelPanel.ShortCircuitCurrent",L)+" Isc ("+B.t("word.AmpereAbbreviation",L)+"):"}),h.jsx(Ge,{span:8,children:h.jsx(mn,{style:{width:"100%"},precision:2,step:.1,value:E.current,onChange:te=>{te!==null&&(E.current=te,c(!s))}})})]})]})}],ne=te=>{switch(te){case"ctrl+z":case"meta+z":if(n.hasUndo()){const q=n.undo();q&&yn(B.t("menu.edit.Undo",L)+": "+q,Ob),r&&e(le=>{le.actionInfo={name:"Undo",timestamp:new Date().getTime()}})}break;case"ctrl+y":case"meta+y":if(n.hasRedo()){const q=n.redo();q&&yn(B.t("menu.edit.Redo",L)+": "+q,Ob),r&&e(le=>{le.actionInfo={name:"Redo",timestamp:new Date().getTime()}})}break}};return h.jsxs(li,{width:720,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>d(!0),onMouseOut:()=>d(!1),children:B.t("menu.settings.CustomizeSolarPanel",L)}),footer:[h.jsx(oo,{onClick:()=>t(!1),children:B.t("word.Close",L)},"Close")],onCancel:()=>t(!1),maskClosable:!1,mask:!1,destroyOnClose:!1,modalRender:te=>h.jsx(Vi,{disabled:!u,bounds:f,onStart:(q,le)=>j(q,le),children:h.jsx("div",{ref:m,children:te})}),children:[h.jsxs(Qt,{style:{justifyContent:"space-between"},children:[h.jsx(Ge,{flex:3,children:h.jsx(dee,{defaultActiveKey:"1",type:"card",items:Z})}),h.jsx(Ge,{flex:.5,children:h.jsxs(Jt,{style:{height:"100%",justifyContent:"center",marginLeft:"12px"},direction:"vertical",children:[h.jsx(hZt,{title:B.t("word.Add",L),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>G()}),h.jsx(pJ,{style:{marginTop:"12px",marginBottom:"12px"}}),h.jsx(uZt,{title:B.t("pvModelPanel.ImportCustomSolarPanelFromClipboard",L),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>{oe()}})]})}),h.jsx(Ge,{flex:2,children:h.jsx(WL,{style:{marginTop:"56px",marginLeft:"8px"},size:"small",header:h.jsx("div",{style:{fontWeight:"bold"},children:B.t("pvModelPanel.AddedCustomSolarPanels",L)}),bordered:!0,dataSource:Y,renderItem:te=>h.jsxs(WL.Item,{children:[h.jsx(aen,{title:B.t("pvModelPanel.ExportThisCustomSolarPanel",L),style:{paddingRight:"4px",cursor:"pointer"},onClick:()=>{const q=a[te];navigator.clipboard.writeText(JSON.stringify(q)).then(()=>{yn(B.t("pvModelPanel.CustomSolarPanelExportedToClipboard",L)+" ("+te+").")})}}),h.jsx(ftt,{title:B.t("word.Delete",L),style:{paddingRight:"6px",cursor:"pointer"},onClick:()=>ae(te)}),te]},te)})})]}),h.jsx(mge,{handleFocusableElements:!0,handleKeys:["ctrl+z","meta+z","ctrl+y","meta+y"],handleEventType:"keydown",onKeyEvent:(te,q)=>{q.preventDefault(),ne(te)}})]})}),Ytr=xe.memo(()=>{const t=H(J2e),e=H(lQ),n=H(NGe),o=H(hSt),r=H(UGe),i=H(jGe),a=H(mSt),l=H(ASt),s=dt(hTt),c=dt(pTt),u=dt(gTt),d=dt(mTt),f=dt(vs),p=H(BGe),m=H(CSt),y=H(YGe),w=H(zSt),x=H(ESt),C=H(OGe),P=H(LSt),A=H(_Ge),S=H(USt),v=H(VGe),b=H(YSt),T=H(GGe),R=H(VSt),M=H(XGe),D=H(JSt),k=H(vSt),N=H(SSt),U=H($St),W=H(QN),F=H(tu),E=H(TS),L=H(ZXe),j=H(QXe),Y=H(x5e),O=H(iQ)??!1,[_,G]=g.useState("Boston MA, USA");return g.useEffect(()=>{if(Object.keys(Y).length===0)return;const Q=L(F,E)??"Boston MA, USA";G(Q),j(Q)},[F,E,Y]),h.jsxs(h.Fragment,{children:[o&&h.jsx(Pzo,{}),r&&h.jsx(Mzo,{}),i&&h.jsx(ner,{}),t&&h.jsx(Per,{}),e&&h.jsx(wer,{}),(n||O)&&!W&&h.jsx(ier,{}),a&&h.jsx(OKo,{city:_,graphs:[bi.MonthlyTemperatures,bi.SunshineHours]}),l&&h.jsx(wtr,{city:_}),s&&h.jsx(Btr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showSolarPanelCustomizationPanel=Q})}}),c&&h.jsx(Mtr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showEconomicsPanel=Q})}}),u&&h.jsx(Utr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showNavigationPanel=Q})}}),d&&h.jsx(jtr,{setDialogVisible:Q=>{dt.getState().set(oe=>{oe.showShadowSettings=Q})}}),m&&h.jsx(XKo,{city:_}),p&&h.jsx(qZo,{city:_}),w&&h.jsx(cer,{city:_}),y&&h.jsx(her,{city:_}),x&&h.jsx(Der,{}),P&&h.jsx(Ler,{city:_}),C&&h.jsx(jer,{city:_}),S&&h.jsx(Jer,{city:_}),A&&h.jsx(_er,{city:_}),v&&h.jsx(Qer,{city:_}),b&&h.jsx(ntr,{city:_}),T&&h.jsx(atr,{city:_}),R&&h.jsx(utr,{city:_}),M&&h.jsx(gtr,{city:_}),D&&h.jsx(Str,{city:_}),k&&h.jsx(ktr,{city:_}),N&&h.jsx(Ntr,{city:_}),f&&h.jsx(Her,{}),U&&h.jsx(Htr,{})]})});class fl{static computeSolarPanelOutput(e,n,o,r,i,a,l,s,c){const u=i.parentType===z.Roof,d=i.parentType===z.Wall;u&&(a=l);const f=d?ye.absoluteCoordinates(i.cx,i.cy,i.cz,a,l,i.lz):ye.absoluteCoordinates(i.cx,i.cy,i.cz,a,void 0,void 0,!0),p=a.rotation[2];let m=i.tiltAngle,y=p+i.relativeAzimuth,w=!0;if(u&&(f.z=i.cz+i.lz+.02+a.cz,ye.isZero(i.rotation[0])?f.z+=i.poleHeight:(m=i.rotation[0],y=p,w=!1)),d&&!ye.isZero(i.tiltAngle)){const oe=a,$=(l?l.rotation[2]+oe.relativeAngle:oe.relativeAngle)-$t,ae=i.ly*Math.abs(Math.sin(i.tiltAngle))/2;f.x+=ae*Math.cos($),f.y+=ae*Math.sin($)}const x=new ue().fromArray(i.normal),C=e.getMonth(),P=ye.dayOfYear(e),A=n.solarRadiationHeatmapGridCellSize??.5;let S,v,b,T,R;n.discretization===Ay.EXACT?(S=i.lx,v=i.ly,i.orientation===br.portrait?(b=Math.max(1,Math.round(i.lx/r.width)),T=Math.max(1,Math.round(i.ly/r.length)),b*=r.n,T*=r.m):(b=Math.max(1,Math.round(i.lx/r.length)),T=Math.max(1,Math.round(i.ly/r.width)),b*=r.m,T*=r.n),R=i.lx/b):(S=i.lx,v=i.ly,b=Math.max(2,Math.round(i.lx/A)),T=Math.max(2,Math.round(i.ly/A)),b%2!==0&&(b+=1),T%2!==0&&(T+=1),R=A);const M=S/b,D=v/T,k=f.x-(S-R)/2,N=f.y-(v-R)/2,U=u||d?f.z:a.lz+i.poleHeight+i.lz,W=new _t(f.x,f.y),F=new ue,E=Array.from(Array(b),()=>new Array(T));let L=new cn(u&&!w?0:m,0,y,"ZYX");if(i.trackerType!==Bl.NO_TRACKER){const oe=p?o.clone().applyAxisAngle(Oo,-p):o.clone();switch(i.trackerType){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const ee=new zs().setFromUnitVectors(Oo,oe);L=new cn().setFromQuaternion(ee),L.z+=y;break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const ee=new zs().setFromUnitVectors(Oo,new ue(oe.x,0,oe.z).normalize());L=new cn().setFromQuaternion(ee),L.z+=y;break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{const ee=new ue(oe.x,-oe.y,0).normalize(),$=Math.acos(Zc.dot(ee))*Math.sign(ee.x);L=new cn(i.tiltAngle,0,$+p,"ZYX");break}case Bl.TILTED_SINGLE_AXIS_TRACKER:break}}x.applyEuler(L),u&&!w&&(L.x=i.rotation[0],L.z=i.rotation[2]+p),d&&(L.x=$t+i.tiltAngle,L.z=a.relativeAngle+p);const j=Si(o,P,s,hi.SPHERE_MODEL),Y=ei(n.ground,C,x,j),O=x.dot(o),_=new _t,G=new ue;for(let oe=0;oe0&&(_.set(k+oe*M,N+ee*D),G.set(_.x-W.x,_.y-W.y,0),G.applyEuler(L),F.set(f.x+G.x,f.y+G.y,U+G.z),c(i.id,F,o)<0&&(E[oe][ee]+=O*j));let Q=0;switch(r.shadeTolerance){case i8.NONE:{let oe=Number.MAX_VALUE;for(let ee=0;eeArray(x).fill(0)),E=Array(w).fill(0).map(()=>Array(x).fill(0));let L;for(let j=0;j0)for(const oe of a){if(oe.type!==z.Window)continue;const ee=oe.cx*r.lx,$=oe.cz*r.lz,ae=oe.lx*r.lx/2,Z=oe.lz*r.lz/2,ne=oe;if(ne.windowType===Ti.Arched){const te=S.clone().add(new ue(ne.cx*r.lx,0,ne.cz*r.lz));fl.pointWithinArch(R,ne.lx,ne.lz,ne.archHeight,te)&&(L=!1)}else if(G.x>=ee-ae&&G.x=$-Z&&G.y<$+Z){L=!1;break}}if(l&&l.length>0)for(const oe of l){if(oe.type!==z.Door)continue;const ee=oe.cx*r.lx,$=oe.cz*r.lz,ae=oe.lx*r.lx/2,Z=oe.lz*r.lz/2,ne=oe;if(ne.doorType===Wd.Arched){const te=S.clone().add(new ue(ne.cx*r.lx,0,ne.cz*r.lz));fl.pointWithinArch(R,ne.lx,ne.lz,ne.archHeight,te)&&(L=!1)}else if(G.x>=ee-ae&&G.x=$-Z&&G.y<$+Z){L=!1;break}}if(s&&s.length>0)for(const oe of s){const ee=oe.cx*r.lx,$=oe.cz*r.lz,ae=oe.lx/2,Z=oe.ly/2;if(G.x>=ee-ae&&G.x=$-Z&&G.y<$+Z){L=!1;break}}if(L){const oe=D===null?!0:ye.isPointInside(G.x,G.y,D),ee=d(r.id,R,o);E[j][Y]+=U,(ee>tA||ee<0)&&oe&&(F[j][Y]+=U),W>0&&ee<0&&(E[j][Y]+=W*N,oe&&(F[j][Y]+=W*N))}}}return{intensity:F,unitArea:C*P,heatmap:E}}static computeDoorSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=ye.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx*i.lx,f=r.lz*i.lz,p=Math.max(2,Math.round(d/u)),m=Math.max(2,Math.round(f/u)),y=d/p,w=f/m,x=a.rotation[2]+i.relativeAngle,P=ye.wallAbsolutePosition(new ue(i.cx,i.cy,i.cz),a).setZ(i.lz/2+a.lz).clone().add(new ue(r.cx*i.lx,0,r.cz*i.lz)),A=new ue(Math.cos(x-$t),Math.sin(x-$t),0),S=y*Math.cos(x),v=y*Math.sin(x),b=new ue,T=Si(o,c,l,hi.SPHERE_MODEL),R=ei(n.ground,e.getMonth(),A,T),M=A.dot(o),D=Array(p).fill(0).map(()=>Array(m).fill(0));if(r.doorType===Wd.Arched)for(let k=0;k0&&s(r.id,b,o)<0&&(D[k][N]+=M*T))}else for(let k=0;k0){const U=k-p/2+.5,W=N-m/2+.5;b.set(P.x+U*S,P.y+U*v,P.z+W*w),s(r.id,b,o)<0&&(D[k][N]+=M*T)}return{intensity:D,unitArea:y*w}}static pointWithinArch(e,n,o,r,i){if(r>0){const a=.5*n,l=Math.min(r,o,a),s=.5*(l+a*a/l),c=e.x-i.x,u=e.y-i.y,d=c*c+u*u;let f=e.z-i.z;return d-o/2?!0:(f=e.z-(o-s),d+f*fArray(m).fill(0));if(r.windowType===Ti.Arched)for(let k=0;k0&&s(r.id,b,o)<0&&(D[k][N]+=M*T))}else for(let k=0;k0){const U=k-p/2+.5,W=N-m/2+.5;b.set(P.x+U*S,P.y+U*v,P.z+W*w),s(r.id,b,o)<0&&(D[k][N]+=M*T)}return{intensity:D,unitArea:y*w}}static computeRoofWindowSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=ye.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx,f=r.lz,p=Math.max(2,Math.round(d/u)),m=Math.max(2,Math.round(f/u)),y=d/p,w=f/m,x=new ue(r.cx,r.cy,r.cz).applyEuler(new cn(0,0,a.rotation[2]));x.x+=a.cx,x.y+=a.cy,x.z+=a.lz;const C=new cn(r.rotation[0],r.rotation[1],r.rotation[2]+a.rotation[2],"ZXY"),P=new ue(0,0,1).applyEuler(C),A=new ue,S=Si(o,c,l,hi.SPHERE_MODEL),v=ei(n.ground,e.getMonth(),P,S),b=P.dot(o),T=Array(p).fill(0).map(()=>Array(m).fill(0));if(r.windowType===Ti.Arched)for(let R=0;R0&&s(r.id,A,o)<0&&(T[R][M]+=b*S))}else for(let R=0;R0){const D=R-p/2+.5,k=M-m/2+.5,N=new ue(D,k,0);N.applyEuler(C),A.set(x.x+N.x,x.y+N.y,x.z+N.z),s(r.id,A,o)<0&&(T[R][M]+=b*S)}return{intensity:T,unitArea:y*w}}static computePyramidRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=n.solarRadiationHeatmapGridCellSize??.5,m=ye.dayOfYear(e),y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,m,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P,v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/p)),W=Math.max(2,Math.round(N/p)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize();const E=U*M.dot(R)/k;M.normalize(),D.normalize();const L=new ue().crossVectors(M,D).normalize(),j=R.multiplyScalar(.5*k/U),Y=new ue().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));O.add(j).add(Y),j.multiplyScalar(2),Y.multiplyScalar(2),C.push(j.length()*Y.length());const _=new ue,G=[],Q=.01;G.push({x:-.01,y:-.01}),G.push({x:U+Q,y:-.01}),G.push({x:E,y:W+Q});const oe=ei(n.ground,e.getMonth(),L,w),ee=L.dot(o);for(let $=0;$tA||te<0)&&(F[$][Z]+=oe),ee>0&&te<0&&(F[$][Z]+=ee*w)}}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeHipRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),m=n.solarRadiationHeatmapGridCellSize??.5,y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,p,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P,v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/m)),W=Math.max(2,Math.round(N/m)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize();const E=U*M.dot(R)/k;M.normalize(),D.normalize();const L=new ue().crossVectors(M,D).normalize(),j=R.multiplyScalar(.5*k/U),Y=new ue().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new ue,_=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));_.add(j).add(Y),j.multiplyScalar(2),Y.multiplyScalar(2),C.push(j.length()*Y.length());const G=ei(n.ground,e.getMonth(),L,w),Q=L.dot(o),oe=[];for(const ee of A)oe.push({x:ee.x,y:ee.y});if(P%2===0)for(let ee=0;eetA||ne<0)&&(F[ee][ae]+=G),Q>0&&ne<0&&(F[ee][ae]+=Q*w)}}}else{const ee=[];ee.push({x:-.01,y:-.01}),ee.push({x:U+.01,y:-.01}),ee.push({x:E,y:W+.01});for(let ae=0;aetA||q<0)&&(F[ae][ne]+=G),Q>0&&q<0&&(F[ae][ne]+=Q*w)}}}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeGambrelRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),m=n.solarRadiationHeatmapGridCellSize??.5,y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,p,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P,v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/m)),W=Math.max(2,Math.round(N/m)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize(),M.normalize(),D.normalize();const E=new ue().crossVectors(M,D).normalize(),L=R.multiplyScalar(.5*k/U),j=new ue().crossVectors(E,R).normalize().multiplyScalar(.5*N/W),Y=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));Y.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new ue,_=ei(n.ground,e.getMonth(),E,w),G=E.dot(o);for(let Q=0;QtA||$<0)&&(F[Q][ee]+=_),G>0&&$<0&&(F[Q][ee]+=G*w)}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeMansardRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return fl.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),m=n.solarRadiationHeatmapGridCellSize??.5,y=new cn(0,0,s.rotation[2],"ZYX"),w=Si(o,p,d,hi.SPHERE_MODEL),x=[],C=[];for(const[P,A]of l.entries()){const S=r.id+"-"+P;if(P===l.length-1){let v=Number.MAX_VALUE,b=Number.MAX_VALUE,T=-Number.MAX_VALUE,R=-Number.MAX_VALUE;for(const Y of A){const O=Y.clone().applyEuler(y);O.x>T&&(T=O.x),O.xR&&(R=O.y),O.yArray(k).fill(0));x.push(W);const F=new ue(v+m/2,b+m/2,s.lz+M+Zu+(a?r.thickness:0)),E=new ue(0,0,F.z),L=ei(n.ground,e.getMonth(),Oo,w),j=Oo.dot(o);for(let Y=0;YtA||_<0)&&(W[Y][O]+=L),j>0&&_<0&&(W[Y][O]+=j*w)}}}else{const v=A[0].clone().applyEuler(y),b=A[1].clone().applyEuler(y),T=A[2].clone().applyEuler(y),R=new ue().subVectors(b,v),M=new ue().subVectors(T,v),D=new ue().subVectors(T,b),k=R.length(),N=new ue().crossVectors(M,D).length()/k,U=Math.max(2,Math.round(k/m)),W=Math.max(2,Math.round(N/m)),F=Array(U).fill(0).map(()=>Array(W).fill(0));x.push(F),R.normalize(),M.normalize(),D.normalize();const E=new ue().crossVectors(M,D).normalize(),L=R.multiplyScalar(.5*k/U),j=new ue().crossVectors(E,R).normalize().multiplyScalar(.5*N/W),Y=new ue(s.cx+v.x,s.cy+v.y,s.lz+v.z+Zu+(a?r.thickness:0));Y.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new ue,_=ei(n.ground,e.getMonth(),E,w),G=E.dot(o);for(let Q=0;QtA||$<0)&&(F[Q][ee]+=_),G>0&&$<0&&(F[Q][ee]+=G*w)}}}}return{segmentIntensities:x,segmentUnitArea:C}}static computeFlatRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=ye.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,m=new cn(0,0,l.rotation[2],"ZYX"),y=Si(o,f,u,hi.SPHERE_MODEL),w=[],x=[];let C=Number.MAX_VALUE,P=Number.MAX_VALUE,A=-Number.MAX_VALUE,S=-Number.MAX_VALUE;for(const F of a)for(const E of F){const L=E.clone().applyEuler(m);L.x>A&&(A=L.x),L.xS&&(S=L.y),L.yArray(b).fill(0));w.push(M),x.push(T*R);const D=a[0][0].z,k=new ue(C+p/2,P+p/2,l.lz+D+Zu+(i?r.thickness:0)),N=new ue(0,0,k.z),U=ei(n.ground,e.getMonth(),Oo,y),W=Oo.dot(o);for(let F=0;FtA||L<0)&&(M[F][E]+=U),W>0&&L<0&&(M[F][E]+=W*y)}}return{segmentIntensities:w,segmentUnitArea:x}}static computeGableRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=ye.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,m=new cn(0,0,l.rotation[2],"ZYX"),y=Si(o,f,u,hi.SPHERE_MODEL),w=[],x=[];for(const[C,P]of a.entries()){const A=r.id+"-"+C,S=P[0].clone().applyEuler(m),v=P[1].clone().applyEuler(m),b=P[2].clone().applyEuler(m),T=new ue().subVectors(v,S),R=new ue().subVectors(b,S),M=new ue().subVectors(b,v),D=T.length(),k=new ue().crossVectors(R,M).length()/D,N=Math.max(2,Math.round(D/p)),U=Math.max(2,Math.round(k/p)),W=Array(N).fill(0).map(()=>Array(U).fill(0));w.push(W),T.normalize(),R.normalize(),M.normalize();const F=new ue().crossVectors(R,M).normalize(),E=T.multiplyScalar(.5*D/N),L=new ue().crossVectors(F,T).normalize().multiplyScalar(.5*k/U),j=new ue(l.cx+S.x,l.cy+S.y,l.lz+S.z+Zu+(i?r.thickness:0));j.add(E).add(L),E.multiplyScalar(2),L.multiplyScalar(2),x.push(E.length()*L.length());const Y=new ue,O=ei(n.ground,e.getMonth(),F,y),_=F.dot(o);for(let G=0;GtA||ee<0)&&(W[G][oe]+=O),_>0&&ee<0&&(W[G][oe]+=_*y)}}}return{segmentIntensities:w,segmentUnitArea:x}}static isPointRoof(e,n,o,r){if(n&&n.length>0)for(const i of n){const a=Rn.getAbsoluteWindowVerticesOnRoof(i,r),l=ye.getPoints(a);if(ye.isPointInside(e.x,e.y,l))return!1}if(o&&o.length>0)for(const i of o){const a=Rn.getAbsoluteSolarPanelVerticesOnRoof(i,r),l=ye.getPoints(a);if(ye.isPointInside(e.x,e.y,l))return!1}return!0}}const Otr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(p4),r=H($r),i=H($3),a=H(O5),l=In(e5e),s=In(UN),c=In(n5e),u=In(vTt),d=In(STt),f=In(PTt),p=H(Qi),m=dt(jN),y=dt(uPt),w=dt(dQ),x=dt(dPt),C=H.getState().world,P=H.getState().elements,A=C.noAnimationForThermalSimulation,S=C.highestTemperatureTimeInMinutes??900,v=g.useRef(0),b=g.useRef(!1),T=g.useRef(new Date(C.date)),R=g.useRef(0),M=g.useRef(!1),D=g.useRef(new Date(C.date)),k=g.useRef(0),N=g.useRef({high:20,low:0}),U=g.useRef(20),W=g.useRef(20),F=g.useRef(new Map),E=g.useRef(new Map),L=g.useRef(new Map),j=g.useRef([]),Y=g.useRef([]),O=g.useRef(),_=g.useRef(),G=g.useRef(0),Q=g.useRef(new Map),oe=Kt(),ee=_1(t),$=new Date(C.date),ae=t?ee==null?void 0:ee.elevation:0,Z=C.monthlyIrradianceLosses??new Array(12).fill(.05),ne=C.timesPerHour??4,te=60/ne,q=C.daysPerYear??6,le=12/q,{scene:de}=ti(),he=g.useMemo(()=>new yu,[]),me=()=>_9(1,Y3e($),FU($),ye.toRadians(C.latitude)).normalize(),ce=(je,et,bt)=>{if(j.current.length>1){Y.current.length=0,he.set(et,bt);const St=j.current.filter(Pt=>Pt.uuid!==je);if(he.intersectObjects(St,!1,Y.current),Y.current.length>0)return Y.current[0].distance}return-1},Pe=()=>{const je=de.children.filter(et=>et.name==="Content");if(je.length>0){const et=je[0].children;j.current.length=0;for(const bt of et)ye.fetchSimulationElements(bt,j.current)}},pe=je=>{if(ee){N.current=eS($,ee.lowestTemperatures,ee.highestTemperatures);const et=ye.minutesIntoDay(je);U.current=Zb(N.current.high,N.current.low,C.diurnalTemperatureModel??a5.Sinusoidal,S,pl(je,C.latitude),et),W.current=Uit(C.latitude,ye.dayOfYear($),et,ee.lowestTemperatures,ee.highestTemperatures,S,.5*(N.current.high-N.current.low),C.ground.thermalDiffusivity??.05,sVe)}},Ie=(je,et)=>{let bt=F.current.get(je);bt||(bt=new Array(24).fill(0),F.current.set(je,bt)),bt[$.getHours()]+=et},ve=(je,et)=>{let bt=E.current.get(je);bt||(bt=new Array(24).fill(0),E.current.set(je,bt)),bt[$.getHours()]+=et},ze=(je,et)=>{let bt=L.current.get(je);bt||(bt=new Array(24).fill(0),L.current.set(je,bt)),bt[$.getHours()]+=et},Ae=()=>{var je,et,bt,St;for(const Pt of P){if(ye.onBuildingEnvelope(Pt)&&((je=F.current.get(Pt.id))==null||je.fill(0)),Pt.type===z.Roof)for(const Yt of F.current.keys())Yt!==Pt.id&&Yt.startsWith(Pt.id)&&((et=F.current.get(Yt))==null||et.fill(0));Pt.type===z.Foundation&&((bt=E.current.get(Pt.id))==null||bt.fill(0),(St=L.current.get(Pt.id))==null||St.fill(0))}},se=()=>{Q.current.clear()};g.useEffect(()=>{if(m)if(A&&!ye.hasMovingParts(P))ge();else return Pe(),we(),v.current=requestAnimationFrame(Me),()=>{cancelAnimationFrame(v.current),b.current||(yn(B.t("message.SimulationAborted",oe)),e(je=>{je.world.date=T.current.toLocaleString("en-US")}),dt.getState().set(je=>{je.simulationInProgress=!1,je.simulationPaused=!1})),M.current=!1}},[m]),g.useEffect(()=>{M.current=y,y?(D.current=new Date($.getTime()),cancelAnimationFrame(v.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",oe))):(n("simulationPaused",!1),$.setHours($.getHours(),$.getMinutes()+te),Me())},[y]);const ge=()=>{_e()},we=()=>{M.current?($.setTime(D.current.getTime()),M.current=!1):(T.current=new Date(C.date),k.current=ye.dayOfYear($),$.setHours(0,te/2)),b.current=!1,Ae(),se()},Se=()=>{for(const je of P){if(ye.onBuildingEnvelope(je)||je.type===z.SolarPanel){const et=F.current.get(je.id);et&&u(je.id,[...et]);const bt=Q.current.get(je.id);bt&&l(je.id,bt.map(St=>[...St]))}if(je.type===z.Roof){for(const et of F.current.keys())if(et!==je.id&&et.startsWith(je.id)){const bt=F.current.get(et);bt&&u(et,[...bt]);const St=Q.current.get(et);St&&l(et,St.map(Pt=>[...Pt]))}}if(je.type===z.Foundation){let et=E.current.get(je.id);et&&d(je.id,[...et]),et=L.current.get(je.id),et&&f(je.id,[...et])}}dt.getState().set(je=>{je.flagOfDailySimulation=!je.flagOfDailySimulation,je.runYearlyThermalSimulation||(je.showSolarRadiationHeatmap=!0,je.showHeatFluxes=!0)}),p&&!w&&setTimeout(()=>{e(je=>{const et=In.getState().totalBuildingHeater,bt=In.getState().totalBuildingAc,St=In.getState().totalBuildingSolarPanel;je.actionInfo={name:"Daily Building Energy Analysis Completed",result:{Heater:et.toFixed(2),AC:bt.toFixed(2),SolarPanel:St.toFixed(2),Net:(et+bt-St).toFixed(2)},timestamp:new Date().getTime()}})},10)},Me=()=>{if(m&&!M.current){if($.getMinutes()+$.getHours()*60+(ye.dayOfYear($)-k.current)*f5+te>f5){_e(),cancelAnimationFrame(v.current),e(et=>{et.world.date=T.current.toLocaleString("en-US"),et.viewState.showDailyBuildingEnergyPanel=!0,et.selectedFloatingWindow="dailyBuildingEnergyPanel"}),dt.getState().set(et=>{et.runDailyThermalSimulation=!1,et.simulationPaused=!1,et.simulationInProgress=!1}),yn(B.t("message.SimulationCompleted",oe)),b.current=!0,Se();return}e(et=>{et.world.date=$.toLocaleString("en-US")}),_e(),v.current=requestAnimationFrame(Me),$.setHours($.getHours(),$.getMinutes()+te)}},[Ce,Te]=g.useState($.getMonth());g.useEffect(()=>{setTimeout(()=>{Pe()},200)},[Ce]),g.useEffect(()=>{if(w)if(dt.getState().set(je=>{je.showSolarRadiationHeatmap=!1,je.showHeatFluxes=!1}),A&&!ye.hasMovingParts(P))setTimeout(()=>{},50);else return Re(),Te($.getMonth()),Pe(),v.current=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(v.current),b.current||(yn(B.t("message.SimulationAborted",oe)),e(je=>{je.world.date=T.current.toLocaleString("en-US")}),dt.getState().set(je=>{je.simulationInProgress=!1,je.simulationPaused=!1})),M.current=!1}},[w]),g.useEffect(()=>{M.current=x,x?(D.current=new Date($.getTime()),cancelAnimationFrame(v.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",oe))):(n("simulationPaused",!1),$.setHours($.getHours(),$.getMinutes()+te),Ne())},[x]);const Re=()=>{M.current?($.setTime(D.current.getTime()),M.current=!1):(T.current=new Date(C.date),R.current=0,$.setMonth(0,22),k.current=ye.dayOfYear($),$.setHours(0,te/2),e(je=>{je.viewState.showYearlyBuildingEnergyPanel=!0,je.selectedFloatingWindow="yearlyBuildingEnergyPanel",je.world.date=$.toLocaleString("en-US")})),Ae(),se(),b.current=!1},Ne=()=>{w&&!M.current&&($.getMinutes()+$.getHours()*60+(ye.dayOfYear($)-k.current)*f5{et.world.date=$.toLocaleString("en-US")}),_e(),$.setHours($.getHours(),$.getMinutes()+te),v.current=requestAnimationFrame(Ne)):(Se(),R.current++,R.current===q?(cancelAnimationFrame(v.current),setTimeout(()=>{e(et=>{et.world.date=T.current.toLocaleString("en-US")})},10),dt.getState().set(et=>{et.runYearlyThermalSimulation=!1,et.simulationInProgress=!1,et.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",oe)),b.current=!0,p&&setTimeout(()=>{e(et=>{const bt=In.getState().totalBuildingHeater,St=In.getState().totalBuildingAc,Pt=In.getState().totalBuildingSolarPanel;et.actionInfo={name:"Yearly Building Energy Analysis Completed",result:{Heater:bt.toFixed(2),AC:St.toFixed(2),SolarPanel:Pt.toFixed(2),Net:(bt+St-Pt).toFixed(2)},timestamp:new Date().getTime()}})},10)):($.setMonth(R.current*le,22),$.setHours(0,te/2),Te($.getMonth()),k.current=ye.dayOfYear($),Ae(),se(),v.current=requestAnimationFrame(Ne))))},_e=()=>{pe($),_.current=pl($,C.latitude);const je=_.current.daylight()/60;G.current=je>Ht?ee.sunshineHours[$.getMonth()]/(30*je*ne):0,O.current=me();for(const et of P)switch(et.type){case z.Door:{lt(et);break}case z.Window:{Le(et),Ye(et);break}case z.Wall:{Oe(et);break}case z.Roof:{const bt=et;Qe(bt),ut(bt);break}case z.SolarPanel:{He(et);break}}},Ue=(je,et)=>{let bt=et.efficiency;return et.cellType==="Monocrystalline"&&(bt*=.95),bt*(1+et.pmaxTC*(je-25))},qe=()=>{if(!_.current)throw new Error("sun minutes not set");const je=_.current.daylight()/60;return je>Ht?ee.sunshineHours[$.getMonth()]/(30*je*ne):0},Fe=je=>{if(!a(je.pvModelName))throw new Error("PV model not found");return je.lx*je.ly*(je.inverterEfficiency??.95)*(1-Z[$.getMonth()])},He=je=>{const et=o(je);if(et){const bt=r(je);if(bt){const St=a(je.pvModelName);if(O.current&&O.current.z>0){const Pt=fl.computeSolarPanelOutput($,C,O.current,St,je,bt,et,ae,ce),Yt=Ue(U.current,St)*qe()*Fe(je);if(ze(et.id,Pt.average*Yt),m){for(let Rt=0;Rt{if(je.interior)return;const et=o(je);if(et){const bt=r(je);if(bt){const St=ye.getHeatingSetpoint($,et.hvacSystem),Pt=ye.getCoolingSetpoint($,et.hvacSystem),Yt=ye.getWindowArea(je,je.parentType===z.Roof?void 0:bt);let zt=0;U.currentPt&&(zt=U.current-Pt),zt!==0&&(je.empty?Ie(je.id,zt*Yt*j_*.001/ne):Ie(je.id,zt*Yt*(je.uValue??X9)*.001/ne))}}},Ye=je=>{if(je.interior)return;const et=o(je);if(et){const bt=r(je);if(bt){let St=0;if(je.parentType===z.Roof){const Pt=s(bt.id);if(!Pt)return;for(let Yt=0;Yt0){const zt=fl.computeRoofWindowSolarRadiationEnergy($,C,O.current,je,bt,et,ae,ce);for(let Rt=0;Rt0){const Pt=fl.computeWallWindowSolarRadiationEnergy($,C,O.current,je,bt,et,ae,ce);for(let Yt=0;Yt{if(je.interior)return;const et=o(je);if(et){const bt=r(je);if(bt){const St=ye.getHeatingSetpoint($,et.hvacSystem),Pt=ye.getCoolingSetpoint($,et.hvacSystem),Yt=U.currentPt;if(Yt||zt){const Rt=Yt?St:Pt,Ct=ye.getDoorArea(je,bt);if(je.filled){const yt=Kx(je);let at=0;if(O.current&&O.current.z>0){const Je=fl.computeDoorSolarRadiationEnergy($,C,O.current,je,bt,et,ae,ce);for(let st=0;st{const et=o(je);if(et){const bt=je.fill!==Ul.Empty&&je.wallStructure===Tc.Default,St=ye.getHeatingSetpoint($,et.hvacSystem),Pt=ye.getCoolingSetpoint($,et.hvacSystem),Yt=U.currentPt;if(Yt||zt){const Rt=Yt?St:Pt;if(bt){const Ct=je.fill===Ul.Partial&&!ye.isPartialWallFull(je),yt=ye.getWallVertices(je,0),at=Ct?ye.getPartialWallVertices(je,0):yt,Et=ye.getPolygonArea(yt);let Lt=Ct?ye.getPolygonArea(at):Et;const Je=i(z.Window,je.id),st=i(z.Door,je.id),It=Kx(je);let ot=0;if(O.current&&O.current.z>0){const ct=(Ct?at.length:yt.length)===4,Xe=i(z.SolarPanel,je.id),ft=fl.computeWallSolarRadiationEnergy($,C,O.current,je,et,Je,st,Xe,ct?0:1,ae,ce);for(let wt=0;wt0)for(const ct of Je)Lt-=ye.getWindowArea(ct,je);if(st&&st.length>0)for(const ct of st)Lt-=ct.lx*ct.lz*je.lx*je.lz;const it=ye.isZero(ot)||ye.isZero(It)?0:ot*It/((je.volumetricHeatCapacity??.5)*Lt*je.ly);let pt=(U.current+it-Rt)*Lt/(je.rValue??U9)*.001/ne;Ct&&je.openToOutside&&(pt+=(U.current-Rt)*(Et-Lt)*j_*.001/ne),Ie(je.id,pt)}else if(je.openToOutside){const Ct=ye.getWallVertices(je,0),yt=ye.getPolygonArea(Ct),at=U.current-Rt;Ie(je.id,at*yt*j_*.001/ne)}}}},ut=je=>{const et=o(je);if(!et)return;const bt=ye.getHeatingSetpoint($,et.hvacSystem),St=ye.getCoolingSetpoint($,et.hvacSystem),Pt=U.currentSt;if(Pt||Yt){const zt=Pt?bt:St,Rt=ye.calculateBuildingArea(je),Ct=W.current-zt;Ie(et.id,Ct*Rt/(et.rValue??Kw)*.001/ne)}},ht=(je,et,bt)=>{const St=1/(je.rValue??pA),Pt=1/(je.ceilingRValue??dA);return(St*et+Pt*bt)/(St+Pt)},Qe=je=>{const et=o(je);if(!et)return;const bt=s(je.id);if(!bt)return;let St;switch(je.roofType){case Zo.Pyramid:St=nt(je,bt,et);break;case Zo.Hip:St=mt(je,bt,et);break;case Zo.Gable:St=Ve(je,bt,et);break;case Zo.Gambrel:St=tt(je,bt,et);break;case Zo.Mansard:St=gt(je,bt,et);break}if(St){const Pt=ye.getHeatingSetpoint($,et.hvacSystem),Yt=ye.getCoolingSetpoint($,et.hvacSystem),zt=U.currentYt;if(zt||Rt){const Ct=zt?Pt:Yt;let yt=0;for(const[at,Et]of St.entries()){const Je=(Et.surfaceTemperature-(je.ceiling?ht(je,Et.surfaceTemperature,Ct):Ct))*Et.totalArea/(je.rValue??pA)*.001/ne;Ie(je.id+"-"+at,Je),yt+=Je}Ie(je.id,yt)}}},nt=(je,et,bt)=>{if(je.roofType!==Zo.Pyramid)throw new Error("roof is not pyramid");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const Je of et)for(const st of Je)if(Math.abs(st.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=i(z.Window,je.id),Ct=[];if(Pt){let Je=0;for(const st of et){const It=[];for(const ot of st)It.push(ye.mapVector3ToPoint2(ot));Je+=ye.getPolygonArea(It)}if(Rt.length>0){for(const st of Rt)Je-=st.lx*st.lz;Je<0&&(Je=0)}Ct.push(Je)}else for(const Je of et){let st=ye.getTriangleArea(Je[0],Je[1],Je[2]);if(Rt.length>0){for(const It of Rt)Rn.onSegment(Je,It.cx,It.cy)&&(st-=It.lx*It.lz);st<0&&(st=0)}Ct.push(st)}const yt=Kx(je),at=Array(zt).fill(0);if(O.current&&O.current.z>0){const Je=i(z.SolarPanel,je.id),st=fl.computePyramidRoofSolarRadiationEnergy($,C,O.current,je,Pt,!0,et,bt,Rt,Je,ae,ce);for(let It=0;It{if(je.roofType!==Zo.Hip)throw new Error("roof is not hip");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const st of et)for(const It of st)if(Math.abs(It.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=[],Ct=i(z.Window,je.id);for(const st of et){let It=0;if(st.length===3?It=ye.getTriangleArea(st[0],st[1],st[2]):st.length===4&&(It=ye.getTriangleArea(st[0],st[1],st[2])+ye.getTriangleArea(st[2],st[3],st[0])),Ct.length>0){for(const ot of Ct)Rn.onSegment(st,ot.cx,ot.cy)&&(It-=ot.lx*ot.lz);It<0&&(It=0)}Rt.push(It)}const yt=Pt?[Rt.reduce((st,It)=>st+It,0)]:Rt,at=Kx(je),Et=Array(zt).fill(0);if(O.current&&O.current.z>0){const st=i(z.SolarPanel,je.id),It=fl.computeHipRoofSolarRadiationEnergy($,C,O.current,je,Pt,!0,et,bt,Ct,st,ae,ce);for(let ot=0;ot{if(je.roofType!==Zo.Gambrel)throw new Error("roof is not gambrel");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const st of et)for(const It of st)if(Math.abs(It.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=[],Ct=i(z.Window,je.id);for(const st of et){let It=ye.getTriangleArea(st[0],st[1],st[2])+ye.getTriangleArea(st[2],st[3],st[0]);if(Ct.length>0){for(const ot of Ct)Rn.onSegment(st,ot.cx,ot.cy)&&(It-=ot.lx*ot.lz);It<0&&(It=0)}Rt.push(It)}const yt=Pt?[Rt.reduce((st,It)=>st+It,0)]:Rt,at=Kx(je),Et=Array(zt).fill(0);if(O.current&&O.current.z>0){const st=i(z.SolarPanel,je.id),It=fl.computeGambrelRoofSolarRadiationEnergy($,C,O.current,je,Pt,!0,et,bt,Ct,st,ae,ce);for(let ot=0;ot{if(je.roofType!==Zo.Mansard)throw new Error("roof is not mansard");const St=et.length;if(St===0)return;let Pt=!0;const Yt=et[0][0].z;for(const it of et)for(const Be of it)if(Math.abs(Be.z-Yt)>.01){Pt=!1;break}const zt=Pt?1:St,Rt=[],Ct=i(z.Window,je.id);for(let it=0;it0){for(const ct of Ct)Rn.onSegment(Be,ct.cx,ct.cy)&&(pt-=ct.lx*ct.lz);pt<0&&(pt=0)}Rt.push(pt)}const yt=et[St-1],at=new Array;for(const it of yt)at.push({x:it.x,y:it.y});let Et=ye.getPolygonArea(at);if(Ct.length>0){for(let it=Ct.length-1;it>=0;it--){const Be=Ct[it];Rn.onSegment(yt,Be.cx,Be.cy)&&(Et-=Be.lx*Be.lz,Ct.splice(it,1))}Et<0&&(Et=0)}Rt.push(Et);const Lt=Pt?[Rt.reduce((it,Be)=>it+Be,0)]:Rt,Je=Kx(je),st=Array(zt).fill(0);if(O.current&&O.current.z>0){const it=i(z.SolarPanel,je.id),Be=fl.computeMansardRoofSolarRadiationEnergy($,C,O.current,je,Pt,!0,et,bt,Ct,it,ae,ce);for(let pt=0;pt{if(je.roofType!==Zo.Gable)throw new Error("roof is not gable");const St=et.length;if(St===0)return;const Pt=i(z.Window,je.id),Yt=[];for(const at of et){let Et=ye.getTriangleArea(at[0],at[1],at[2])+ye.getTriangleArea(at[2],at[3],at[0]);if(Pt.length>0){for(const Lt of Pt)Rn.onSegment(at,Lt.cx,Lt.cy)&&(Et-=Lt.lx*Lt.lz);Et<0&&(Et=0)}Yt.push(Et)}const zt=Kx(je),Rt=Array(St).fill(0);if(O.current&&O.current.z>0){const at=i(z.SolarPanel,je.id),Et=fl.computeGableRoofSolarRadiationEnergy($,C,O.current,je,!0,et,bt,Pt,at,ae,ce);for(let Lt=0;Lt{const e=H.getState().world,n=H.getState().elements,o=H($r),r=H(p4),i=In(e5e),a=In(QGe),l=dt(l5e),s=In(n5e),{scene:c}=ti(),u=Kt(),d=_1(t),f=new Date(e.date),p=t?d==null?void 0:d.elevation:0,m=60/e.timesPerHour,y=g.useMemo(()=>new yu,[]),w=e.solarRadiationHeatmapGridCellSize??.5,x=g.useRef([]),C=g.useRef([]);g.useEffect(()=>{l&&n&&n.length>0&&(a(),S(),dt.getState().set(Y=>{Y.runStaticSimulation=!1,Y.simulationInProgress=!1,Y.showSolarRadiationHeatmap=!0}),yn(B.t("message.SimulationCompleted",u)))},[l]);const P=(Y,O,_)=>{if(x.current.length>1){C.current.length=0,y.set(O,_);const G=x.current.filter(Q=>Q.uuid!==Y);return y.intersectObjects(G,!1,C.current),C.current.length>0}return!1},A=()=>{const Y=c.children.filter(O=>O.name==="Content");if(Y.length>0){const O=Y[0].children;x.current.length=0;for(const _ of O)ye.fetchSimulationElements(_,x.current)}},S=()=>{A();for(const Y of n)switch(Y.type){case z.Foundation:{const O=Y;b(O),O.solarStructure===Nn.UpdraftTower&&T(O);break}case z.Cuboid:{v(Y);break}case z.SolarPanel:{R(Y);break}case z.SolarWaterHeater:{M(Y);break}case z.Wall:{D(Y);break}case z.Door:{k(Y);break}case z.Roof:{const O=Y;switch(O.roofType){case Zo.Pyramid:N(O);break;case Zo.Gable:L(O);break;case Zo.Gambrel:W(O);break;case Zo.Mansard:U(O);break;case Zo.Hip:F(O);break}break}}},v=Y=>{const O=f.getFullYear(),_=f.getMonth(),G=f.getDate(),Q=ye.dayOfYear(f),oe=Y.lx,ee=Y.ly,$=Y.lz,ae=Math.max(2,Math.round(oe/w)),Z=Math.max(2,Math.round(ee/w)),ne=Math.max(2,Math.round($/w)),te=oe/ae,q=ee/Z,le=$/ne,de=o(Y);let he=Y.cx,me=Y.cy,ce=Y.cz;if(de&&de.type===z.Cuboid){const Le=ye.getWorldDataById(Y.id);he=Le.pos.x,me=Le.pos.y,ce=Le.pos.z}const Pe=Array(ae).fill(0).map(()=>Array(Z).fill(0)),pe=Array(ae).fill(0).map(()=>Array(ne).fill(0)),Ie=Array(ae).fill(0).map(()=>Array(ne).fill(0));let ve=Array(Z).fill(0).map(()=>Array(ne).fill(0)),ze=Array(Z).fill(0).map(()=>Array(ne).fill(0));const Ae=Oo,se=T1.clone().applyAxisAngle(Oo,Y.rotation[2]),ge=Zc.clone().applyAxisAngle(Oo,Y.rotation[2]),we=S1.clone().applyAxisAngle(Oo,Y.rotation[2]),Se=b1.clone().applyAxisAngle(Oo,Y.rotation[2]),Me=new ue;let Ce=0;const Te=new _t(he,me),Re=new _t,Ne=me-ee/2,_e=me+ee/2,Ue=he-oe/2,qe=he+oe/2;for(let Le=0;Le<24;Le++)for(let Ye=0;Ye0){Ce++;const ut=Si(Oe,Q,p,hi.SPHERE_MODEL);let ht=ei(e.ground,_,Ae,ut),Qe=Ae.dot(Oe),nt=he-oe/2,mt=me-ee/2;const tt=ce+$/2;for(let gt=0;gt0&&(Re.set(nt+(gt+.5)*te,mt+(Ve+.5)*q),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,tt),P(Y.id,Me,Oe)||(Pe[gt][Ve]+=Qe*ut));nt=he-oe/2,mt=ce-$/2,ht=ei(e.ground,_,se,ut),Qe=se.dot(Oe);for(let gt=0;gt0&&(Re.set(nt+(gt+.5)*te,Ne),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(Ve+.5)*le),P(Y.id,Me,Oe)||(pe[gt][Ve]+=Qe*ut));ht=ei(e.ground,_,ge,ut),Qe=ge.dot(Oe);for(let gt=0;gt0&&(Re.set(nt+(gt+.5)*te,_e),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(ne-(Ve+.5))*le),P(Y.id,Me,Oe)||(Ie[gt][Ve]+=Qe*ut));nt=me-ee/2,mt=ce-$/2,ht=ei(e.ground,_,we,ut),Qe=we.dot(Oe);for(let gt=0;gt0&&(Re.set(Ue,nt+(gt+.5)*q),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(Ve+.5)*le),P(Y.id,Me,Oe)||(ve[gt][Ve]+=Qe*ut));ht=ei(e.ground,_,Se,ut),Qe=Se.dot(Oe);for(let gt=0;gt0&&(Re.set(qe,nt+(gt+.5)*q),Re.rotateAround(Te,Y.rotation[2]),Me.set(Re.x,Re.y,mt+(Ve+.5)*le),P(Y.id,Me,Oe)||(ze[gt][Ve]+=Qe*ut))}}ve=ye.transpose(ve),ze=ye.transpose(ze);const Fe=Ce*m/60,He=Fe>Ht?d.sunshineHours[_]/(30*Fe*e.timesPerHour):0;j(Pe,He),j(pe,He),j(Ie,He),j(ve,He),j(ze,He),i(Y.id+"-top",Pe),i(Y.id+"-south",pe),i(Y.id+"-north",Ie),i(Y.id+"-west",ve),i(Y.id+"-east",ze)},b=Y=>{const O=f.getFullYear(),_=f.getMonth(),G=f.getDate(),Q=ye.dayOfYear(f),oe=Y.lx,ee=Y.ly,$=Y.lz,ae=Math.max(2,Math.round(oe/w)),Z=Math.max(2,Math.round(ee/w)),ne=oe/ae,te=ee/Z,q=Y.cx-oe/2,le=Y.cy-ee/2,de=new _t(Y.cx,Y.cy),he=new ue,me=Array(ae).fill(0).map(()=>Array(Z).fill(0));let ce=0;for(let Ie=0;Ie<24;Ie++)for(let ve=0;ve0){ce++;const se=Si(Ae,Q,p,hi.SPHERE_MODEL),ge=ei(e.ground,_,Oo,se),we=Oo.dot(Ae),Se=new _t;for(let Me=0;Me0&&(Se.set(q+(Me+.5)*ne,le+(Ce+.5)*te),Se.rotateAround(de,Y.rotation[2]),he.set(Se.x,Se.y,$),P(Y.id,he,Ae)||(me[Me][Ce]+=we*se))}}const Pe=ce*m/60,pe=Pe>Ht?d.sunshineHours[_]/(30*Pe*e.timesPerHour):0;j(me,pe),i(Y.id,me)},T=Y=>{const O=Y.solarUpdraftTower;if(!O)return;const _=f.getFullYear(),G=f.getMonth(),Q=f.getDate(),oe=ye.dayOfYear(f),ee=O.collectorRadius,$=Math.max(2,Math.round(ee*2/w)),ae=Y.cx-ee+w/2,Z=Y.cy-ee+w/2,ne=Y.lz+O.collectorHeight,te=Array($).fill(0).map(()=>Array($).fill(0)),q=new ue(0,0,ne),le=ee*ee;let de=0,he,me;for(let pe=0;pe<24;pe++)for(let Ie=0;Ie0){de++;const Ae=Si(ze,oe,p,hi.SPHERE_MODEL),se=ei(e.ground,G,Oo,Ae),ge=Oo.dot(ze);for(let we=0;we<$;we++){q.x=ae+(we+.5)*w,he=q.x-Y.cx;for(let Se=0;Se<$;Se++)q.y=Z+(Se+.5)*w,me=q.y-Y.cy,!(he*he+me*me>le)&&(te[we][Se]+=se,ge>0&&(P(Y.id+"-sut",q,ze)||(te[we][Se]+=ge*Ae)))}}}const ce=de*m/60,Pe=ce>Ht?d.sunshineHours[G]/(30*ce*e.timesPerHour):0;j(te,Pe),i(Y.id+"-sut",te)},R=Y=>{if(Y.trackerType!==Bl.NO_TRACKER)throw new Error("trackers cannot use static simulation");let O=o(Y);if(!O)throw new Error("parent of solar panel does not exist");const _=Y.parentType===z.Roof,G=Y.parentType===z.Wall;if(_&&(O=r(O),!O))throw new Error("foundation of solar panel does not exist");const Q=G?ye.absoluteCoordinates(Y.cx,Y.cy,Y.cz,O,r(Y),Y.lz):ye.absoluteCoordinates(Y.cx,Y.cy,Y.cz,O,void 0,void 0,!0),oe=new ue().fromArray(Y.normal);G&&oe.applyEuler(new cn(0,0,O.relativeAngle));const ee=O.rotation[2];let $=ee+(G?0:Y.relativeAzimuth),ae=Y.tiltAngle,Z=!0;if(_&&(Q.z=Y.cz+Y.lz+.02+O.cz,ye.isZero(Y.rotation[0])?Q.z+=Y.poleHeight:(ae=Y.rotation[0],$=ee,Z=!1)),G&&!ye.isZero(Y.tiltAngle)){const Te=O,Re=r(O),_e=(Re?Re.rotation[2]+Te.relativeAngle:Te.relativeAngle)-$t,Ue=Y.ly*Math.abs(Math.sin(Y.tiltAngle))/2;Q.x+=Ue*Math.cos(_e),Q.y+=Ue*Math.sin(_e)}const ne=new cn(_&&!Z?0:ae,0,$,"ZYX");oe.applyEuler(ne);const te=f.getFullYear(),q=f.getMonth(),le=f.getDate(),de=ye.dayOfYear(f),he=Y.lx,me=Y.ly,ce=Math.max(2,Math.round(Y.lx/w)),Pe=Math.max(2,Math.round(Y.ly/w)),pe=he/ce,Ie=me/Pe,ve=Q.x-(he-w)/2,ze=Q.y-(me-w)/2,Ae=_||G?Q.z:O.lz+Y.poleHeight+Y.lz,se=new _t(Q.x,Q.y),ge=new ue,we=Array(ce).fill(0).map(()=>Array(Pe).fill(0));let Se=0;if(_&&!Z&&(ne.x=Y.rotation[0],ne.z=Y.rotation[2]+ee),G){const Te=o(Y);Te&&(ne.x=$t+Y.tiltAngle,ne.z=O.relativeAngle+Te.rotation[2])}for(let Te=0;Te<24;Te++)for(let Re=0;Re0){Se++;const Ue=Si(_e,de,p,hi.SPHERE_MODEL),qe=ei(e.ground,q,oe,Ue),Fe=oe.dot(_e),He=new _t,Le=new ue;for(let Ye=0;Ye0&&(He.set(ve+Ye*pe,ze+lt*Ie),Le.set(He.x-se.x,He.y-se.y,0),Le.applyEuler(ne),ge.set(Q.x+Le.x,Q.y+Le.y,Ae+Le.z),P(Y.id,ge,_e)||(we[Ye][lt]+=Fe*Ue))}}const Me=Se*m/60,Ce=Me>Ht?d.sunshineHours[q]/(30*Me*e.timesPerHour):0;j(we,Ce),i(Y.id,we)},M=Y=>{const O=o(Y);if(!O)throw new Error("parent of solar water heater does not exist");const _=r(O);if(!_)throw new Error("foundation of solar water heater does not exist");const G=ye.absoluteCoordinates(Y.cx,Y.cy,Y.cz,_,void 0,void 0,!0),Q=new cn,oe=(Y.lz-Y.waterTankRadius)/2,ee=Math.atan2(Y.lz-Y.waterTankRadius,Y.ly);ye.isZero(Y.rotation[0])?(Q.set(ee,0,Y.relativeAzimuth+_.rotation[2],"ZXY"),G.z+=oe):(Q.set(Y.rotation[0]+ee,0,Y.rotation[2]+_.rotation[2],"ZXY"),G.add(new ue(0,0,oe).applyEuler(Q)));const ae=new ue(0,0,1).applyEuler(Q),Z=f.getFullYear(),ne=f.getMonth(),te=f.getDate(),q=ye.dayOfYear(f),le=Y.lx,de=Math.hypot(Y.ly,Y.lz-Y.waterTankRadius),he=Math.max(2,Math.round(Y.lx/w)),me=Math.max(2,Math.round(Y.ly/w)),ce=le/he,Pe=de/me,pe=-(le-w)/2,Ie=-(de-w)/2,ve=Array(he).fill(0).map(()=>Array(me).fill(0));let ze=0;for(let ge=0;ge<24;ge++)for(let we=0;we0){ze++;const Ce=Si(Me,q,p,hi.SPHERE_MODEL),Te=ei(e.ground,ne,ae,Ce),Re=ae.dot(Me),Ne=new _t,_e=new ue;for(let Ue=0;Ue0&&(Ne.set(pe+Ue*ce,Ie+qe*Pe),_e.set(Ne.x,Ne.y,0).applyEuler(Q).add(G),P(Y.id,_e,Me)||(ve[Ue][qe]+=Re*Ce))}}const Ae=ze*m/60,se=Ae>Ht?d.sunshineHours[ne]/(30*Ae*e.timesPerHour):0;j(ve,se),i(Y.id,ve)},D=Y=>{const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=f.getFullYear(),G=f.getMonth(),Q=f.getDate(),oe=ye.dayOfYear(f),ee=Y.lx,$=ye.getHighestPointOfWall(Y),ae=Math.max(2,Math.round(ee/w)),Z=Math.max(2,Math.round($/w)),ne=ee/ae,te=$/Z,q=O.rotation[2]+Y.relativeAngle,le=ye.wallAbsolutePosition(new ue(Y.cx,Y.cy,$/2),O).setZ($/2+O.lz),de=new ue(Math.cos(q-$t),Math.sin(q-$t),0),he=new ue,me=Array(ae).fill(0).map(()=>Array(Z).fill(0));let ce=0;const Pe=ne*Math.cos(q),pe=ne*Math.sin(q),Ie=ye.getWallVertices(Y,2),ve=($-Y.lz)/2;for(let se=0;se<24;se++)for(let ge=0;ge0){ce++;const Me=Si(Se,oe,p,hi.SPHERE_MODEL),Ce=ei(e.ground,G,de,Me),Te=de.dot(Se);for(let Re=0;Re0&&(he.set(le.x+_e*Pe,le.y+_e*pe,le.z+Ue*te),P(Y.id,he,Se)||(me[Re][Ne]+=Te*Me)))}}}const ze=ce*m/60,Ae=ze>Ht?d.sunshineHours[G]/(30*ze*e.timesPerHour):0;j(me,Ae),i(Y.id,me)},k=Y=>{const O=r(Y);if(!O)throw new Error("foundation of door not found");const _=o(Y);if(!_)throw new Error("parent of door not found");const G=_,Q=f.getFullYear(),oe=f.getMonth(),ee=f.getDate(),$=ye.dayOfYear(f),ae=Y.lx*G.lx,Z=Y.lz*G.lz,ne=Math.max(2,Math.round(ae/w)),te=Math.max(2,Math.round(Z/w)),q=ae/ne,le=Z/te,de=O.rotation[2]+G.relativeAngle,me=ye.wallAbsolutePosition(new ue(G.cx,G.cy,G.cz),O).setZ(G.lz/2+O.lz).clone().add(new ue(Y.cx*G.lx,0,Y.cz*G.lz)),ce=new ue(Math.cos(de-$t),Math.sin(de-$t),0),Pe=new ue,pe=Array(ne).fill(0).map(()=>Array(te).fill(0));let Ie=0;const ve=q*Math.cos(de),ze=q*Math.sin(de);for(let ge=0;ge<24;ge++)for(let we=0;we0){Ie++;const Ce=Si(Me,$,p,hi.SPHERE_MODEL),Te=ei(e.ground,oe,ce,Ce),Re=ce.dot(Me);if(Y.doorType===Wd.Arched)for(let Ne=0;Ne0&&(P(Y.id,Pe,Me)||(pe[Ne][_e]+=Re*Ce)))}else for(let Ne=0;Ne0&&(Pe.set(me.x+Ue*ve,me.y+Ue*ze,me.z+qe*le),P(Y.id,Pe,Me)||(pe[Ne][_e]+=Re*Ce))}}}const Ae=Ie*m/60,se=Ae>Ht?d.sunshineHours[oe]/(30*Ae*e.timesPerHour):0;j(pe,se),i(Y.id,pe)},N=Y=>{if(Y.roofType!==Zo.Pyramid)throw new Error("roof is not pyramid");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),$=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const q=Y.id+"-"+ne,le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze),Se=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);Se.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2);let Me=0;const Ce=new ue;for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Me++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Ce.copy(Se).add(lt).add(we.clone().multiplyScalar(Oe)),P(q,Ce,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Me*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i(q,Ae)}}},U=Y=>{if(Y.roofType!==Zo.Mansard)throw new Error("roof is not mansard");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),$=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const q=Y.id+"-"+ne;if(ne===_.length-1){let le=Number.MAX_VALUE,de=Number.MAX_VALUE,he=-Number.MAX_VALUE,me=-Number.MAX_VALUE;for(const Me of te){const Ce=Me.clone().applyEuler(Z);Ce.x>he&&(he=Ce.x),Ce.xme&&(me=Ce.y),Ce.yArray(pe).fill(0)),Ae=new ue(le+w/2,de+w/2,O.lz+ce+Zu);let se=0;const ge=new ue(0,0,Ae.z);for(let Me=0;Me<24;Me++)for(let Ce=0;Ce0){se++;const Ne=Si(Re,ae,p,hi.SPHERE_MODEL),_e=ei(e.ground,ee,Oo,Ne),Ue=Oo.dot(Re);for(let qe=0;qe0&&(ge.y=Ae.y+Fe*ve,P(q,ge,Re)||(ze[qe][Fe]+=Ue*Ne))}}}const we=se*m/60,Se=we>Ht?d.sunshineHours[ee]/(30*we*e.timesPerHour):0;j(ze,Se),i(q,ze)}else{const le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze),Se=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);Se.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2);let Me=0;const Ce=new ue;for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Me++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Ce.copy(Se).add(lt).add(we.clone().multiplyScalar(Oe)),P(q,Ce,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Me*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i(q,Ae)}}}},W=Y=>{if(Y.roofType!==Zo.Gambrel)throw new Error("roof is not gambrel");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),$=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const q=Y.id+"-"+ne,le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze),Se=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);Se.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2);let Me=0;const Ce=new ue;for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Me++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Ce.copy(Se).add(lt).add(we.clone().multiplyScalar(Oe)),P(q,Ce,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Me*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i(q,Ae)}}},F=Y=>{if(Y.roofType!==Zo.Hip)throw new Error("roof is not hip");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;let G=!0;const Q=_[0][0].z;for(const oe of _)for(const ee of oe)if(Math.abs(ee.z-Q)>.01){G=!1;break}if(G)E(Y,O,_);else{const oe=f.getFullYear(),ee=f.getMonth(),$=f.getDate(),ae=ye.dayOfYear(f),Z=new cn(0,0,O.rotation[2],"ZYX");for(const[ne,te]of _.entries()){const q=Y.id+"-"+ne,le=te[0].clone().applyEuler(Z),de=te[1].clone().applyEuler(Z),he=te[2].clone().applyEuler(Z),me=new ue().subVectors(de,le),ce=new ue().subVectors(he,le),Pe=new ue().subVectors(he,de),pe=me.length(),Ie=new ue().crossVectors(ce,Pe).length()/pe,ve=Math.max(2,Math.round(pe/w)),ze=Math.max(2,Math.round(Ie/w)),Ae=Array(ve).fill(0).map(()=>Array(ze).fill(0));me.normalize(),ce.normalize(),Pe.normalize();const se=new ue().crossVectors(ce,Pe).normalize(),ge=me.multiplyScalar(.5*pe/ve),we=new ue().crossVectors(se,me).normalize().multiplyScalar(.5*Ie/ze);let Se=0;const Me=new ue,Ce=new ue(O.cx+le.x,O.cy+le.y,O.lz+le.z+Zu);if(Ce.add(ge).add(we),ge.multiplyScalar(2),we.multiplyScalar(2),ne%2===0)for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Se++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Me.copy(Ce).add(lt).add(we.clone().multiplyScalar(Oe)),P(q,Me,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}else for(let Ne=0;Ne<24;Ne++)for(let _e=0;_e0){Se++;const Fe=Si(qe,ae,p,hi.SPHERE_MODEL),He=ei(e.ground,ee,se,Fe),Le=se.dot(qe);for(let Ye=0;Ye0&&(Me.copy(Ce).add(lt).add(we.clone().multiplyScalar(Oe)),P(q,Me,qe)||(Ae[Ye][Oe]+=Le*Fe))}}}const Te=Se*m/60,Re=Te>Ht?d.sunshineHours[ee]/(30*Te*e.timesPerHour):0;j(Ae,Re),i(q,Ae)}}},E=(Y,O,_)=>{const G=f.getFullYear(),Q=f.getMonth(),oe=f.getDate(),ee=ye.dayOfYear(f),$=new cn(0,0,O.rotation[2],"ZYX"),ae=_[0][0].z;let Z=Number.MAX_VALUE,ne=Number.MAX_VALUE,te=-Number.MAX_VALUE,q=-Number.MAX_VALUE;for(const Ae of _)for(const se of Ae){const ge=se.clone().applyEuler($);ge.x>te&&(te=ge.x),ge.xq&&(q=ge.y),ge.yArray(de).fill(0)),Pe=new ue(Z+w/2,ne+w/2,O.lz+ae+Zu);let pe=0;const Ie=new ue(0,0,Pe.z);for(let Ae=0;Ae<24;Ae++)for(let se=0;se0){pe++;const Se=Si(we,ee,p,hi.SPHERE_MODEL),Me=ei(e.ground,Q,Oo,Se),Ce=Oo.dot(we);for(let Te=0;Te0&&(Ie.y=Pe.y+Re*me,P(Y.id,Ie,we)||(ce[Te][Re]+=Ce*Se))}}}const ve=pe*m/60,ze=ve>Ht?d.sunshineHours[Q]/(30*ve*e.timesPerHour):0;j(ce,ze),i(Y.id,ce)},L=Y=>{if(Y.roofType!==Zo.Gable)throw new Error("roof is not gable");const O=r(Y);if(!O)throw new Error("foundation of wall not found");const _=s(Y.id);if(!_||_.length===0)return;const G=f.getFullYear(),Q=f.getMonth(),oe=f.getDate(),ee=ye.dayOfYear(f),$=new cn(0,0,O.rotation[2],"ZYX");for(const[ae,Z]of _.entries()){const ne=Y.id+"-"+ae,te=Z[0].clone().applyEuler($),q=Z[1].clone().applyEuler($),le=Z[2].clone().applyEuler($),de=new ue().subVectors(q,te),he=new ue().subVectors(le,te),me=new ue().subVectors(le,q),ce=de.length(),Pe=new ue().crossVectors(he,me).length()/ce,pe=Math.max(2,Math.round(ce/w)),Ie=Math.max(2,Math.round(Pe/w)),ve=Array(pe).fill(0).map(()=>Array(Ie).fill(0));de.normalize(),he.normalize(),me.normalize();const ze=new ue().crossVectors(he,me).normalize(),Ae=de.multiplyScalar(.5*ce/pe),se=new ue().crossVectors(ze,de).normalize().multiplyScalar(.5*Pe/Ie),ge=new ue(O.cx+te.x,O.cy+te.y,O.lz+te.z+Zu);ge.add(Ae).add(se),Ae.multiplyScalar(2),se.multiplyScalar(2);let we=0;const Se=new ue;for(let Te=0;Te<24;Te++)for(let Re=0;Re0){we++;const Ue=Si(_e,ee,p,hi.SPHERE_MODEL),qe=ei(e.ground,Q,ze,Ue),Fe=ze.dot(_e);for(let He=0;He0&&(Se.copy(ge).add(Le).add(se.clone().multiplyScalar(Ye)),P(ne,Se,_e)||(ve[He][Ye]+=Fe*Ue))}}}const Me=we*m/60,Ce=Me>Ht?d.sunshineHours[Q]/(30*Me*e.timesPerHour):0;j(ve,Ce),i(ne,ve)}},j=(Y,O)=>{for(let _=0;_{const e=H(pn),n=dt(kf),o=H.getState().world,r=H.getState().elements,i=H($r),a=H(p4),l=In(e5e),s=In(QGe),c=dt(BN),u=dt(pPt),d=H(V2e),f=In(n5e),{scene:p}=ti(),m=Kt(),y=_1(t),w=new Date(o.date),x=t?y==null?void 0:y.elevation:0,C=60/o.timesPerHour,P=g.useMemo(()=>new yu,[]),A=o.solarRadiationHeatmapGridCellSize??.5,S=g.useRef([]),v=g.useRef([]),b=g.useRef(0),T=g.useRef(!1),R=g.useRef(new Date(o.date)),M=g.useRef(new Map),D=g.useRef(!1),k=g.useRef(new Date(o.date)),N=g.useMemo(()=>pl(w,o.latitude),[o.date,o.latitude]);g.useEffect(()=>{if(c)return U(),b.current=requestAnimationFrame(E),()=>{cancelAnimationFrame(b.current),T.current||(yn(B.t("message.SimulationAborted",m)),e(ce=>{ce.world.date=R.current.toLocaleString("en-US")}),n("simulationInProgress",!1))}},[c]),g.useEffect(()=>{D.current=u,u?(k.current=new Date(w.getTime()),cancelAnimationFrame(b.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",m))):(n("simulationPaused",!1),E())},[u]);const U=()=>{n("simulationInProgress",!0),w.setHours(Math.floor(N.sunrise/60),N.sunrise%60),R.current=new Date(o.date),T.current=!1,j();for(const ce of r)switch(ce.type){case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{M.current.delete(ce.id);break}case z.Cuboid:{M.current.delete(ce.id+"-top"),M.current.delete(ce.id+"-north"),M.current.delete(ce.id+"-south"),M.current.delete(ce.id+"-west"),M.current.delete(ce.id+"-east");break}case z.Roof:{const Pe=ce,pe=f(Pe.id);if(pe){const Ie=pe.length;for(let ve=0;ve{s();const ce=N.daylight()/60,Pe=ce>Ht?y.sunshineHours[w.getMonth()]/(30*ce*o.timesPerHour):0;for(const pe of r){switch(pe.type){case z.Foundation:case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{const Ie=M.current.get(pe.id);if(Ie){for(let ve=0;ve[...ve]))}break}case z.Cuboid:{F(pe.id,"top",Pe),F(pe.id,"south",Pe),F(pe.id,"north",Pe),F(pe.id,"west",Pe),F(pe.id,"east",Pe);break}case z.Roof:{const Ie=pe,ve=f(Ie.id);if(ve&&ve.length>0){if(Ie.roofType===Zo.Pyramid||Ie.roofType===Zo.Mansard||Ie.roofType===Zo.Gambrel||Ie.roofType===Zo.Hip){let ze=!0;const Ae=ve[0][0].z;for(const se of ve)for(const ge of se)if(Math.abs(ge.z-Ae)>.01){ze=!1;break}if(ze){const se=M.current.get(Ie.id);if(se){for(let ge=0;ge[...ge]))}break}}for(let ze=0;ze[...ge]))}}}break}}if(pe.type===z.Foundation){const Ie=pe;if(Ie.solarStructure===Nn.UpdraftTower&&Ie.solarUpdraftTower){const ve=pe.id+"-sut",ze=M.current.get(ve);if(ze){for(let Ae=0;Ae[...Ae]))}}}}},F=(ce,Pe,pe)=>{const Ie=M.current.get(ce+"-"+Pe);if(Ie){for(let ve=0;ve{if(c&&!D.current){if(w.getMinutes()+w.getHours()*60>=N.sunset){cancelAnimationFrame(b.current),dt.getState().set(Pe=>{Pe.runDynamicSimulation=!1}),e(Pe=>{Pe.world.date=R.current.toLocaleString("en-US")}),yn(B.t("message.SimulationCompleted",m)),T.current=!0,W(),setTimeout(()=>{n("simulationInProgress",!1),n("showSolarRadiationHeatmap",!0)},10);return}if(w.setHours(w.getHours(),w.getMinutes()+C),e(Pe=>{Pe.world.date=w.toLocaleString("en-US")}),d)for(const Pe of r)switch(Pe.type){case z.FresnelReflector:de(Pe);break;case z.Heliostat:he(Pe);break}else for(const Pe of r)switch(Pe.type){case z.Foundation:{const pe=Pe;O(pe),pe.solarStructure===Nn.UpdraftTower&&me(pe);break}case z.Cuboid:{Y(Pe);break}case z.SolarPanel:{ne(Pe);break}case z.SolarWaterHeater:{te(Pe);break}case z.ParabolicTrough:{q(Pe);break}case z.ParabolicDish:{le(Pe);break}case z.FresnelReflector:{de(Pe);break}case z.Heliostat:{he(Pe);break}case z.Wall:{_(Pe);break}case z.Door:{G(Pe);break}case z.Roof:{const pe=Pe;switch(pe.roofType){case Zo.Pyramid:oe(pe);break;case Zo.Gable:Z(pe);break;case Zo.Gambrel:$(pe);break;case Zo.Mansard:ee(pe);break;case Zo.Hip:ae(pe);break}break}}b.current=requestAnimationFrame(E)}},L=(ce,Pe,pe)=>{if(S.current.length>1){v.current.length=0,P.set(Pe,pe);const Ie=S.current.filter(ve=>ve.uuid!==ce);return P.intersectObjects(Ie,!1,v.current),v.current.length>0}return!1},j=()=>{const ce=p.children.filter(Pe=>Pe.name==="Content");if(ce.length>0){const Pe=ce[0].children;S.current.length=0;for(const pe of Pe)ye.fetchSimulationElements(pe,S.current)}},Y=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=ye.dayOfYear(w),Ie=ce.lx,ve=ce.ly,ze=ce.lz,Ae=Math.max(2,Math.round(Ie/A)),se=Math.max(2,Math.round(ve/A)),ge=Math.max(2,Math.round(ze/A)),we=Ie/Ae,Se=ve/se,Me=ze/ge;let Ce=M.current.get(ce.id+"-top");(!Ce||Ce.length!==Ae||Ce[0].length!==se)&&(Ce=Array(Ae).fill(0).map(()=>Array(se).fill(0)),M.current.set(ce.id+"-top",Ce));let Te=M.current.get(ce.id+"-south");(!Te||Te.length!==Ae||Te[0].length!==ge)&&(Te=Array(Ae).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-south",Te));let Re=M.current.get(ce.id+"-north");(!Re||Re.length!==Ae||Re[0].length!==ge)&&(Re=Array(Ae).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-north",Re));let Ne=M.current.get(ce.id+"-west");(!Ne||Ne.length!==se||Ne[0].length!==ge)&&(Ne=Array(se).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-west",Ne));let _e=M.current.get(ce.id+"-east");(!_e||_e.length!==se||_e[0].length!==ge)&&(_e=Array(se).fill(0).map(()=>Array(ge).fill(0)),M.current.set(ce.id+"-east",_e));const Ue=Oo,qe=T1.clone().applyAxisAngle(Oo,ce.rotation[2]),Fe=Zc.clone().applyAxisAngle(Oo,ce.rotation[2]),He=S1.clone().applyAxisAngle(Oo,ce.rotation[2]),Le=b1.clone().applyAxisAngle(Oo,ce.rotation[2]),Ye=i(ce);let lt=ce.cx,Oe=ce.cy,ut=ce.cz;if(Ye&&Ye.type===z.Cuboid){const zt=ye.getWorldDataById(ce.id);lt=zt.pos.x,Oe=zt.pos.y,ut=zt.pos.z}const ht=new ue,Qe=new _t(lt,Oe),nt=new _t,mt=Oe-ve/2,tt=Oe+ve/2,gt=lt-Ie/2,Ve=lt+Ie/2,je=Si(Pe,pe,x,hi.SPHERE_MODEL);let et=ei(o.ground,w.getMonth(),Ue,je),bt=Ue.dot(Pe),St=lt-Ie/2,Pt=Oe-ve/2;const Yt=ut+ze/2;for(let zt=0;zt0&&(nt.set(St+(zt+.5)*we,Pt+(Rt+.5)*Se),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Yt),L(ce.id,ht,Pe)||(Ce[zt][Rt]+=bt*je));St=lt-Ie/2,Pt=ut-ze/2,et=ei(o.ground,w.getMonth(),qe,je),bt=qe.dot(Pe);for(let zt=0;zt0&&(nt.set(St+(zt+.5)*we,mt),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(Rt+.5)*Me),L(ce.id,ht,Pe)||(Te[zt][Rt]+=bt*je));et=ei(o.ground,w.getMonth(),Fe,je),bt=Fe.dot(Pe);for(let zt=0;zt0&&(nt.set(St+(zt+.5)*we,tt),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(ge-(Rt+.5))*Me),L(ce.id,ht,Pe)||(Re[zt][Rt]+=bt*je));St=Oe-ve/2,Pt=ut-ze/2,et=ei(o.ground,w.getMonth(),He,je),bt=He.dot(Pe);for(let zt=0;zt0&&(nt.set(gt,St+(zt+.5)*Se),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(Rt+.5)*Me),L(ce.id,ht,Pe)||(Ne[zt][Rt]+=bt*je));et=ei(o.ground,w.getMonth(),Le,je),bt=Le.dot(Pe);for(let zt=0;zt0&&(nt.set(Ve,St+(zt+.5)*Se),nt.rotateAround(Qe,ce.rotation[2]),ht.set(nt.x,nt.y,Pt+(Rt+.5)*Me),L(ce.id,ht,Pe)||(_e[zt][Rt]+=bt*je))},O=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=ye.dayOfYear(w),Ie=ce.lx,ve=ce.ly,ze=ce.lz,Ae=Math.max(2,Math.round(Ie/A)),se=Math.max(2,Math.round(ve/A)),ge=Ie/Ae,we=ve/se,Se=ce.cx-Ie/2,Me=ce.cy-ve/2,Ce=new _t(ce.cx,ce.cy),Te=new ue;let Re=M.current.get(ce.id);(!Re||Re.length!==Ae||Re[0].length!==se)&&(Re=Array(Ae).fill(0).map(()=>Array(se).fill(0)),M.current.set(ce.id,Re));const Ne=Si(Pe,pe,x,hi.SPHERE_MODEL),_e=ei(o.ground,w.getMonth(),Oo,Ne),Ue=Oo.dot(Pe),qe=new _t;for(let Fe=0;Fe0&&(qe.set(Se+(Fe+.5)*ge,Me+(He+.5)*we),qe.rotateAround(Ce,ce.rotation[2]),Te.set(qe.x,qe.y,ze),L(ce.id,Te,Pe)||(Re[Fe][He]+=Ue*Ne))},_=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=ye.dayOfYear(w),ve=ce.lx,ze=ye.getHighestPointOfWall(ce),Ae=Math.max(2,Math.round(ve/A)),se=Math.max(2,Math.round(ze/A)),ge=ve/Ae,we=ze/se,Se=pe.rotation[2]+ce.relativeAngle,Me=ye.wallAbsolutePosition(new ue(ce.cx,ce.cy,ce.cz),pe).setZ(ze/2+pe.lz),Ce=new ue(Math.cos(Se-$t),Math.sin(Se-$t),0),Te=ge*Math.cos(Se),Re=ge*Math.sin(Se),Ne=new ue;let _e=M.current.get(ce.id);(!_e||_e.length!==Ae||_e[0].length!==se)&&(_e=Array(Ae).fill(0).map(()=>Array(se).fill(0)),M.current.set(ce.id,_e));const Ue=ye.getWallVertices(ce,1),qe=(ze-ce.lz)/2,Fe=Si(Pe,Ie,x,hi.SPHERE_MODEL),He=ei(o.ground,w.getMonth(),Ce,Fe),Le=Ce.dot(Pe);for(let Ye=0;Ye0&&(Ne.set(Me.x+Oe*Te,Me.y+Oe*Re,Me.z+ut*we),L(ce.id,Ne,Pe)||(_e[Ye][lt]+=Le*Fe)))}},G=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of door not found");const Ie=i(ce);if(!Ie)throw new Error("parent of door not found");const ve=ye.dayOfYear(w),ze=Ie,Ae=ce.lx*ze.lx,se=ce.lz*ze.lz,ge=Math.max(2,Math.round(Ae/A)),we=Math.max(2,Math.round(se/A)),Se=Ae/ge,Me=se/we,Ce=pe.rotation[2]+ze.relativeAngle,Re=ye.wallAbsolutePosition(new ue(ze.cx,ze.cy,ze.cz),pe).setZ(ze.lz/2+pe.lz).clone().add(new ue(ce.cx*ze.lx,0,ce.cz*ze.lz)),Ne=new ue(Math.cos(Ce-$t),Math.sin(Ce-$t),0),_e=Se*Math.cos(Ce),Ue=Se*Math.sin(Ce),qe=new ue;let Fe=M.current.get(ce.id);(!Fe||Fe.length!==ge||Fe[0].length!==we)&&(Fe=Array(ge).fill(0).map(()=>Array(we).fill(0)),M.current.set(ce.id,Fe));const He=Si(Pe,ve,x,hi.SPHERE_MODEL),Le=ei(o.ground,w.getMonth(),Ne,He),Ye=Ne.dot(Pe);if(ce.doorType===Wd.Arched)for(let lt=0;lt0&&(L(ce.id,qe,Pe)||(Fe[lt][Oe]+=Ye*He)))}else for(let lt=0;lt0){const ut=lt-ge/2+.5,ht=Oe-we/2+.5;qe.set(Re.x+ut*_e,Re.y+ut*Ue,Re.z+ht*Me),L(ce.id,qe,Pe)||(Fe[lt][Oe]+=Ye*He)}},Q=(ce,Pe,pe,Ie)=>{const ve=Ie[0][0].z,ze=ye.dayOfYear(w),Ae=Si(ce,ze,x,hi.SPHERE_MODEL),se=new cn(0,0,pe.rotation[2],"ZYX");let ge=Number.MAX_VALUE,we=Number.MAX_VALUE,Se=-Number.MAX_VALUE,Me=-Number.MAX_VALUE;for(const Le of Ie)for(const Ye of Le){const lt=Ye.clone().applyEuler(se);lt.x>Se&&(Se=lt.x),lt.xMe&&(Me=lt.y),lt.yArray(Te).fill(0)),M.current.set(Pe.id,_e));const Ue=new ue(ge+A/2,we+A/2,pe.lz+ve+Zu),qe=new ue(0,0,Ue.z),Fe=ei(o.ground,w.getMonth(),Oo,Ae),He=Oo.dot(ce);for(let Le=0;Le0&&(qe.y=Ue.y+Ye*Ne,L(Pe.id,qe,ce)||(_e[Le][Ye]+=He*Ae))}},oe=ce=>{if(ce.roofType!==Zo.Pyramid)throw new Error("roof is not pyramid");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we,Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);ht.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const Qe=new ue,nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(Qe.copy(ht).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,Qe,Pe)||(Ye[tt][Ve]+=mt*ge))}}}},ee=ce=>{if(ce.roofType!==Zo.Mansard)throw new Error("roof is not mansard");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we;if(we===Ie.length-1){let Ce=Number.MAX_VALUE,Te=Number.MAX_VALUE,Re=-Number.MAX_VALUE,Ne=-Number.MAX_VALUE;for(const ht of Se){const Qe=ht.clone().applyEuler(se);Qe.x>Re&&(Re=Qe.x),Qe.xNe&&(Ne=Qe.y),Qe.yArray(qe).fill(0)),M.current.set(Me,Le));const Ye=new ue(Ce+A/2,Te+A/2,pe.lz+_e+Zu),lt=new ue(0,0,Ye.z),Oe=ei(o.ground,w.getMonth(),Oo,ge),ut=Oo.dot(Pe);for(let ht=0;ht0&&(lt.y=Ye.y+Qe*He,L(Me,lt,Pe)||(Le[ht][Qe]+=ut*ge))}}else{const Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);ht.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const Qe=new ue,nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(Qe.copy(ht).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,Qe,Pe)||(Ye[tt][Ve]+=mt*ge))}}}}},$=ce=>{if(ce.roofType!==Zo.Gambrel)throw new Error("roof is not gambrel");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we,Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);ht.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const Qe=new ue,nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(Qe.copy(ht).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,Qe,Pe)||(Ye[tt][Ve]+=mt*ge))}}}},ae=ce=>{if(ce.roofType!==Zo.Hip)throw new Error("roof is not hip");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;let ve=!0;const ze=Ie[0][0].z;for(const Ae of Ie)for(const se of Ae)if(Math.abs(se.z-ze)>.01){ve=!1;break}if(ve)Q(Pe,ce,pe,Ie);else{const Ae=ye.dayOfYear(w),se=new cn(0,0,pe.rotation[2],"ZYX"),ge=Si(Pe,Ae,x,hi.SPHERE_MODEL);for(const[we,Se]of Ie.entries()){const Me=ce.id+"-"+we,Ce=Se[0].clone().applyEuler(se),Te=Se[1].clone().applyEuler(se),Re=Se[2].clone().applyEuler(se),Ne=new ue().subVectors(Te,Ce),_e=new ue().subVectors(Re,Ce),Ue=new ue().subVectors(Re,Te),qe=Ne.length(),Fe=new ue().crossVectors(_e,Ue).length()/qe,He=Math.max(2,Math.round(qe/A)),Le=Math.max(2,Math.round(Fe/A));let Ye=M.current.get(Me);(!Ye||Ye.length!==He||Ye[0].length!==Le)&&(Ye=Array(He).fill(0).map(()=>Array(Le).fill(0)),M.current.set(Me,Ye)),Ne.normalize(),_e.normalize(),Ue.normalize();const lt=new ue().crossVectors(_e,Ue).normalize(),Oe=Ne.multiplyScalar(.5*qe/He),ut=new ue().crossVectors(lt,Ne).normalize().multiplyScalar(.5*Fe/Le),ht=new ue,Qe=new ue(pe.cx+Ce.x,pe.cy+Ce.y,pe.lz+Ce.z+Zu);Qe.add(Oe).add(ut),Oe.multiplyScalar(2),ut.multiplyScalar(2);const nt=ei(o.ground,w.getMonth(),lt,ge),mt=lt.dot(Pe);for(let tt=0;tt0&&(ht.copy(Qe).add(gt).add(ut.clone().multiplyScalar(Ve)),L(Me,ht,Pe)||(Ye[tt][Ve]+=mt*ge))}}}},Z=ce=>{if(ce.roofType!==Zo.Gable)throw new Error("roof is not gable");const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=a(ce);if(!pe)throw new Error("foundation of wall not found");const Ie=f(ce.id);if(!Ie||Ie.length===0)return;const ve=ye.dayOfYear(w),ze=new cn(0,0,pe.rotation[2],"ZYX"),Ae=Si(Pe,ve,x,hi.SPHERE_MODEL);for(const[se,ge]of Ie.entries()){const we=ce.id+"-"+se,Se=ge[0].clone().applyEuler(ze),Me=ge[1].clone().applyEuler(ze),Ce=ge[2].clone().applyEuler(ze),Te=new ue().subVectors(Me,Se),Re=new ue().subVectors(Ce,Se),Ne=new ue().subVectors(Ce,Me),_e=Te.length(),Ue=new ue().crossVectors(Re,Ne).length()/_e,qe=Math.max(2,Math.round(_e/A)),Fe=Math.max(2,Math.round(Ue/A));let He=M.current.get(we);(!He||He.length!==qe||He[0].length!==Fe)&&(He=Array(qe).fill(0).map(()=>Array(Fe).fill(0)),M.current.set(we,He)),Te.normalize(),Re.normalize(),Ne.normalize();const Le=new ue().crossVectors(Re,Ne).normalize(),Ye=Te.multiplyScalar(.5*_e/qe),lt=new ue().crossVectors(Le,Te).normalize().multiplyScalar(.5*Ue/Fe),Oe=new ue(pe.cx+Se.x,pe.cy+Se.y,pe.lz+Se.z+Zu);Oe.add(Ye).add(lt),Ye.multiplyScalar(2),lt.multiplyScalar(2);const ut=new ue,ht=ei(o.ground,w.getMonth(),Le,Ae),Qe=Le.dot(Pe);for(let nt=0;nt0&&(ut.copy(Oe).add(mt).add(lt.clone().multiplyScalar(tt)),L(we,ut,Pe)||(He[nt][tt]+=Qe*Ae))}}},ne=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;let pe=i(ce);if(!pe)throw new Error("parent of solar panel does not exist");const Ie=ce.parentType===z.Roof,ve=ce.parentType===z.Wall;if(Ie&&(pe=a(pe),!pe))throw new Error("foundation of solar panel does not exist");const ze=ye.dayOfYear(w),Ae=ve?ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe,a(ce),ce.lz):ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe,void 0,void 0,!0),se=pe.rotation[2];let ge=se+(ve?0:ce.relativeAzimuth),we=ce.tiltAngle,Se=!0;if(Ie&&(Ae.z=ce.cz+ce.lz+.02+pe.cz,ye.isZero(ce.rotation[0])?Ae.z+=ce.poleHeight:(we=ce.rotation[0],ge=se,Se=!1)),ve&&!ye.isZero(ce.tiltAngle)){const tt=pe,gt=a(pe),je=(gt?gt.rotation[2]+tt.relativeAngle:tt.relativeAngle)-$t,et=ce.ly*Math.abs(Math.sin(ce.tiltAngle))/2;Ae.x+=et*Math.cos(je),Ae.y+=et*Math.sin(je)}const Me=new ue().fromArray(ce.normal),Ce=ce.lx,Te=ce.ly,Re=Math.max(2,Math.round(ce.lx/A)),Ne=Math.max(2,Math.round(ce.ly/A)),_e=Ce/Re,Ue=Te/Ne,qe=Ae.x-(Ce-A)/2,Fe=Ae.y-(Te-A)/2,He=Ie||ve?Ae.z:pe.lz+ce.poleHeight+ce.lz,Le=new _t(Ae.x,Ae.y),Ye=new ue;let lt=M.current.get(ce.id);(!lt||lt.length!==Re||lt[0].length!==Ne)&&(lt=Array(Re).fill(0).map(()=>Array(Ne).fill(0)),M.current.set(ce.id,lt));let Oe=new cn(Ie&&!Se?0:we,0,ge,"ZYX");if(ce.trackerType!==Bl.NO_TRACKER){const tt=se?Pe.clone().applyAxisAngle(Oo,-se):Pe.clone();switch(ce.trackerType){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const gt=new zs().setFromUnitVectors(Oo,tt);Oe=new cn().setFromQuaternion(gt),Oe.z+=ge;break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const gt=new zs().setFromUnitVectors(Oo,new ue(tt.x,0,tt.z).normalize());Oe=new cn().setFromQuaternion(gt),Oe.z+=ge;break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{if(Math.abs(ce.tiltAngle)>.001){const gt=new ue(tt.x,-tt.y,0).normalize(),Ve=Math.acos(Zc.dot(gt))*Math.sign(gt.x);Oe=new cn(ce.tiltAngle,0,Ve+se,"ZYX")}break}case Bl.TILTED_SINGLE_AXIS_TRACKER:break}}if(ve&&Me.applyEuler(new cn(0,0,pe.relativeAngle)),Me.applyEuler(Oe),Ie&&!Se&&(Oe.x=ce.rotation[0],Oe.z=ce.rotation[2]+se),ve){const tt=i(ce);tt&&(Oe.x=$t+ce.tiltAngle,Oe.z=pe.relativeAngle+tt.rotation[2])}const ut=Si(Pe,ze,x,hi.SPHERE_MODEL),ht=ei(o.ground,w.getMonth(),Me,ut),Qe=Me.dot(Pe),nt=new _t,mt=new ue;for(let tt=0;tt0&&(nt.set(qe+tt*_e,Fe+gt*Ue),mt.set(nt.x-Le.x,nt.y-Le.y,0),mt.applyEuler(Oe),Ye.set(Ae.x+mt.x,Ae.y+mt.y,He+mt.z),L(ce.id,Ye,Pe)||(lt[tt][gt]+=Qe*ut))},te=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=i(ce);if(!pe)throw new Error("parent of solar water heater does not exist");const Ie=a(pe);if(!Ie)throw new Error("foundation of solar water heater does not exist");const ve=ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,Ie,void 0,void 0,!0),ze=new cn,Ae=(ce.lz-ce.waterTankRadius)/2,se=Math.atan2(ce.lz-ce.waterTankRadius,ce.ly);ye.isZero(ce.rotation[0])?(ze.set(se,0,ce.relativeAzimuth+Ie.rotation[2],"ZXY"),ve.z+=Ae):(ze.set(ce.rotation[0]+se,0,ce.rotation[2]+Ie.rotation[2],"ZXY"),ve.add(new ue(0,0,Ae).applyEuler(ze)));const we=ce.lx,Se=Math.hypot(ce.ly,ce.lz-ce.waterTankRadius),Me=Math.max(2,Math.round(we/A)),Ce=Math.max(2,Math.round(Se/A)),Te=we/Me,Re=Se/Ce,Ne=-(we-A)/2,_e=-(Se-A)/2;let Ue=M.current.get(ce.id);(!Ue||Ue.length!==Me||Ue[0].length!==Ce)&&(Ue=Array(Me).fill(0).map(()=>Array(Ce).fill(0)),M.current.set(ce.id,Ue));const qe=new ue(0,0,1).applyEuler(ze),Fe=Si(Pe,ye.dayOfYear(w),x,hi.SPHERE_MODEL),He=ei(o.ground,w.getMonth(),qe,Fe),Le=qe.dot(Pe),Ye=new _t,lt=new ue;for(let Oe=0;Oe0&&(Ye.set(Ne+Oe*Te,_e+ut*Re),lt.set(Ye.x,Ye.y,0).applyEuler(ze).add(ve),L(ce.id,lt,Pe)||(Ue[Oe][ut]+=Le*Fe))},q=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=i(ce);if(!pe)throw new Error("parent of parabolic trough does not exist");const Ie=ye.dayOfYear(w),ve=ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe),ze=new ue().fromArray(ce.normal),Ae=ze.clone(),se=ce.lx,ge=ce.ly,we=se*se/(4*ce.latusRectum),Se=ce.poleHeight+se/2,Me=Math.max(2,Math.round(ce.lx/A)),Ce=Math.max(2,Math.round(ce.ly/A)),Te=se/Me,Re=ge/Ce,Ne=ve.x-(se-A)/2,_e=ve.y-(ge-A)/2,Ue=pe.lz+Se+ce.lz+we,qe=new _t(ve.x,ve.y),Fe=new ue;let He=M.current.get(ce.id);(!He||He.length!==Me||He[0].length!==Ce)&&(He=Array(Me).fill(0).map(()=>Array(Ce).fill(0)),M.current.set(ce.id,He));const Le=pe.rotation[2],Ye=Le+ce.relativeAzimuth,lt=ye.isZero(Ye),Oe=lt?1:Math.cos(Ye),ut=lt?0:Math.sin(Ye),ht=Le?Pe.clone().applyAxisAngle(Oo,-Le):Pe.clone(),Qe=new zs().setFromUnitVectors(Oo,new ue(ht.x*Oe,ht.x*ut,ht.z).normalize()),nt=new cn().setFromQuaternion(Qe);ze.copy(Ae.clone().applyEuler(nt));const mt=Si(Pe,Ie,x,hi.SPHERE_MODEL),tt=ei(o.ground,w.getMonth(),ze,mt),gt=ze.dot(Pe),Ve=new _t,je=new ue;let et=0,bt=0,St=1;const Pt=4/(ce.latusRectum*ce.latusRectum);for(let Yt=0;Yt0&&(Ve.set(et,_e+zt*Re),lt||Ve.rotateAround(qe,Ye),je.set(Ve.x-qe.x,Ve.y-qe.y,0),je.applyEuler(nt),Fe.set(ve.x+je.x,ve.y+je.y,Ue+je.z),L(ce.id,Fe,Pe)||(He[Yt][zt]+=gt*mt*St))}},le=ce=>{const Pe=zi(w,o.latitude);if(Pe.z<=0)return;const pe=i(ce);if(!pe)throw new Error("parent of parabolic dish does not exist");const Ie=ye.dayOfYear(w),ve=ye.absoluteCoordinates(ce.cx,ce.cy,ce.cz,pe),ze=new ue().fromArray(ce.normal),Ae=ze.clone(),se=ce.lx,ge=ce.ly,we=se*se/(4*ce.latusRectum),Se=ce.poleHeight+se/2,Me=Math.max(2,Math.round(ce.lx/A)),Ce=Math.max(2,Math.round(ce.ly/A)),Te=se/Me,Re=ge/Ce,Ne=ve.x-(se-A)/2,_e=ve.y-(ge-A)/2,Ue=pe.lz+Se+ce.lz+we,qe=new _t(ve.x,ve.y),Fe=new ue;let He=M.current.get(ce.id);(!He||He.length!==Me||He[0].length!==Ce)&&(He=Array(Me).fill(0).map(()=>Array(Ce).fill(0)),M.current.set(ce.id,He));const Le=pe.rotation[2],Ye=Le+ce.relativeAzimuth,lt=ye.isZero(Ye),Oe=Le?Pe.clone().applyAxisAngle(Oo,-Le):Pe.clone(),ut=new zs().setFromUnitVectors(Oo,Oe),ht=new cn().setFromQuaternion(ut);ze.copy(Ae.clone().applyEuler(ht));const Qe=Si(Pe,Ie,x,hi.SPHERE_MODEL),nt=ei(o.ground,w.getMonth(),ze,Qe),mt=ze.dot(Pe),tt=new _t,gt=new ue;let Ve=0,je=0,et=0,bt=0,St=1;const Pt=4/(ce.latusRectum*ce.latusRectum);for(let Yt=0;Ytse/2))for(let zt=0;ztge/2)&&(He[Yt][zt]+=nt,mt>0&&(tt.set(Ve,je),lt||tt.rotateAround(qe,Ye),gt.set(tt.x-qe.x,tt.y-qe.y,0),gt.applyEuler(ht),Fe.set(ve.x+gt.x,ve.y+gt.y,Ue+gt.z),L(ce.id,Fe,Pe)||(St=1/Math.sqrt(1+(et*et+bt*bt)*Pt),He[Yt][zt]+=mt*Qe*St)))},de=ce=>{const Pe=zi(w,o.latitude);if(Pe.zArray(Te).fill(0)),M.current.set(ce.id,Le));const lt=pe.rotation[2]+ce.relativeAzimuth,Oe=ye.isZero(lt),ut=Oe?1:Math.cos(lt),ht=Oe?0:Math.sin(lt),Qe=Ie.solarStructure===Nn.FocusPipe?new ue((Ie.cx-Ae.x)*ut,(Ie.cy-Ae.y)*ht,Ie.cz-Ae.z+Ie.lz/2+(ve.absorberHeight??10)):void 0,nt=new ue(ht,ut,0),mt=new ue;let tt,gt;if(Qe){mt.set(Qe.x,Qe.y,Qe.z);const Yt=-Qe.z*(Pe.y*nt.y+Pe.x*nt.x)/Pe.z;mt.x+=Yt*nt.x,mt.y-=Yt*nt.y,gt=mt.clone().normalize();let zt=gt.add(Pe).normalize();ye.isSame(zt,Oo)&&(zt=new ue(-.001,0,1).normalize()),Oe||zt.applyAxisAngle(Oo,-lt),tt=new cn(0,Math.atan2(zt.x,zt.z),lt,"ZXY"),se.copy(ge.clone().applyEuler(tt))}else gt=new ue(0,0,1),tt=new cn;const Ve=Si(Pe,ze,x,hi.SPHERE_MODEL),je=ei(o.ground,w.getMonth(),se,Ve),et=se.dot(Pe),bt=new _t,St=new ue;let Pt=0;if(d)for(let Yt=0;Yt0&&(bt.set(Pt,Ue+zt*Ne),St.set(bt.x-Fe.x,bt.y-Fe.y,0),St.applyEuler(tt),He.set(Ae.x+St.x,Ae.y+St.y,qe+St.z),!L(ce.id,He,Pe)&&!L(ce.id,He,gt)&&(Le[Yt][zt]+=et*Ve))}else for(let Yt=0;Yt0&&(bt.set(Pt,Ue+zt*Ne),St.set(bt.x-Fe.x,bt.y-Fe.y,0),St.applyEuler(tt),He.set(Ae.x+St.x,Ae.y+St.y,qe+St.z),L(ce.id,He,Pe)||(Le[Yt][zt]+=et*Ve))}},he=ce=>{const Pe=zi(w,o.latitude);if(Pe.zArray(Te).fill(0)),M.current.set(ce.id,Le));const Ye=pe.rotation[2],lt=Ie.solarStructure===Nn.FocusTower?new ue(Ie.cx-Ae.x,Ie.cy-Ae.y,Ie.cz-Ae.z+(ve.towerHeight??20)):void 0;let Oe,ut;if(lt){Oe=lt.clone().normalize();let Ve=Oe.clone().add(Pe).normalize();ye.isSame(Ve,Oo)&&(Ve=new ue(-.001,0,1).normalize()),Ye&&Ve.applyAxisAngle(Oo,-Ye);const je=Math.hypot(Ve.x,Ve.y);ut=new cn(Math.atan2(je,Ve.z),0,Math.atan2(Ve.y,Ve.x)+$t,"ZXY"),se.copy(ge.clone().applyEuler(ut))}else Oe=new ue(0,0,1),ut=new cn;const ht=Si(Pe,ze,x,hi.SPHERE_MODEL),Qe=ei(o.ground,w.getMonth(),se,ht),nt=se.dot(Pe),mt=new _t,tt=new ue;let gt=0;if(d)for(let Ve=0;Ve0&&(mt.set(gt,Ue+je*Ne),tt.set(mt.x-Fe.x,mt.y-Fe.y,0),tt.applyEuler(ut),He.set(Ae.x+tt.x,Ae.y+tt.y,qe+tt.z),!L(ce.id,He,Pe)&&!L(ce.id,He,Oe)&&(Le[Ve][je]+=nt*ht))}else for(let Ve=0;Ve0&&(mt.set(gt,Ue+je*Ne),tt.set(mt.x-Fe.x,mt.y-Fe.y,0),tt.applyEuler(ut),He.set(Ae.x+tt.x,Ae.y+tt.y,qe+tt.z),L(ce.id,He,Pe)||(Le[Ve][je]+=nt*ht))}},me=ce=>{const Pe=ce.solarUpdraftTower;if(!Pe)return;const pe=zi(w,o.latitude);if(pe.z<=0)return;const Ie=ye.dayOfYear(w),ve=new ue().fromArray(ce.normal),ze=Pe.collectorRadius,Ae=Math.max(2,Math.round(ze*2/A)),se=ce.cx-ze+A/2,ge=ce.cy-ze+A/2,we=ce.lz+Pe.collectorHeight,Se=ce.id+"-sut";let Me=M.current.get(Se);(!Me||Me.length!==Ae||Me[0].length!==Ae)&&(Me=Array(Ae).fill(0).map(()=>Array(Ae).fill(0)),M.current.set(Se,Me));const Ce=Si(pe,Ie,x,hi.SPHERE_MODEL),Te=ei(o.ground,w.getMonth(),ve,Ce),Re=new ue(0,0,we),Ne=ve.dot(pe),_e=ze*ze;let Ue,qe;for(let Fe=0;Fe_e)&&(Me[Fe][He]+=Te,Ne>0&&(L(Se,Re,pe)||(Me[Fe][He]+=Ne*Ce)))}};return h.jsx(h.Fragment,{})}),Gtr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(GCt),s=H(GN),c=In(JCt),u=H(XN),d=H(sJe),f=H(cJe),p=In(KCt),m=dt(BCt),y=dt(YCt),w=dt(OCt),x=dt(_Ct),C=H(OGe),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),$=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyParabolicTroughYieldPanel=!0,ge.selectedFloatingWindow="dailyParabolicTroughYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForParabolicTroughs=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyParabolicTroughYield();ge.actionInfo={name:"Daily Simulation for Parabolic Troughs Completed",result:{totalYield:we},details:In.getState().dailyParabolicTroughYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicTrough&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.ParabolicTrough){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(d){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.ParabolicTrough){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Trough"+Se,Re),Me.push(Te.label??"Trough"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Trough"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.ParabolicTrough){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return q(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const q=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicTrough&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyParabolicTroughYieldPanel=!0,ge.selectedFloatingWindow="yearlyParabolicTroughYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForParabolicTroughs=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyParabolicTroughYield();ge.actionInfo={name:"Yearly Simulation for Parabolic Troughs Completed",result:{totalYield:we},details:In.getState().yearlyParabolicTroughYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.ParabolicTrough){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.ParabolicTrough){const Ce=O.current.get(Me.id);Ce&&(u(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*$),se.push(Ce),we++,ge.push(Me.label??"Trough"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*$;Se.push(Ce)}c(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.ParabolicTrough){const Se=O.current.get(we.id);Se&&(u(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*$),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*$})}c(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(Pt.set(Oe+Ct*He,ut+yt*Le),Ne||Pt.rotateAround(Qe,Re),Yt.set(Pt.x-Qe.x,Pt.y-Qe.y,0),Yt.applyEuler(et),nt.set(Me.x+Yt.x,Me.y+Yt.y,ht+Yt.z),Ie(se.id,nt,ge)||(zt+=St*bt));const Rt=Y.current.get(se.id);if(Rt){const Ct=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Rt[Ct]+=zt/(qe*Fe)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>se.lx*se.ly*se.opticalEfficiency*se.thermalEfficiency*se.absorptance*se.reflectance*(1-N[v.getMonth()]),Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.ParabolicTrough){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.ParabolicTrough){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),Xtr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(IRt),s=H(GN),c=In(DRt),u=H(XN),d=H(xJe),f=H(vJe),p=In(ERt),m=dt(PRt),y=dt(CRt),w=dt(RRt),x=dt(HRt),C=H(_Ge),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),$=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyParabolicDishYieldPanel=!0,ge.selectedFloatingWindow="dailyParabolicDishYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForParabolicDishes=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyParabolicDishYield();ge.actionInfo={name:"Daily Simulation for Parabolic Dishes Completed",result:{totalYield:we},details:In.getState().dailyParabolicDishYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicDish&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.ParabolicDish){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(d){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.ParabolicDish){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Dish"+Se,Re),Me.push(Te.label??"Dish"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Dish"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.ParabolicDish){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return q(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const q=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.ParabolicDish&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyParabolicDishYieldPanel=!0,ge.selectedFloatingWindow="yearlyParabolicDishYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForParabolicDishes=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyParabolicDishYield();ge.actionInfo={name:"Yearly Simulation for Parabolic Dishes Completed",result:{totalYield:we},details:In.getState().yearlyParabolicDishYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.ParabolicDish){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.ParabolicDish){const Ce=O.current.get(Me.id);Ce&&(u(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*$),se.push(Ce),we++,ge.push(Me.label??"Dish"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*$;Se.push(Ce)}c(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.ParabolicDish){const Se=O.current.get(we.id);Se&&(u(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*$),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*$})}c(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(bt.set(Ye+zt*qe,lt+Rt*Fe),mt||bt.rotateAround(ut,nt),St.set(bt.x-ut.x,bt.y-ut.y,0),St.applyEuler(Ve),ht.set(Me.x+St.x,Me.y+St.y,Oe+St.z),Ie(se.id,ht,ge)||(Pt+=et*je));const Yt=Y.current.get(se.id);if(Yt){const zt=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Yt[zt]+=Pt/(_e*Ue)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>se.lx*se.ly*se.opticalEfficiency*se.thermalEfficiency*se.absorptance*se.reflectance*(1-N[v.getMonth()]),Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.ParabolicDish){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.ParabolicDish){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),Jtr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(tRt),s=H(GN),c=H(dJe),u=In(oRt),d=H(XN),f=H(fJe),p=In(rRt),m=dt($Ct),y=dt(qCt),w=dt(QCt),x=dt(ZCt),C=H(VGe),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),$=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyFresnelReflectorYieldPanel=!0,ge.selectedFloatingWindow="dailyFresnelReflectorYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForFresnelReflectors=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyFresnelReflectorYield();ge.actionInfo={name:"Daily Simulation for Fresnel Reflectors Completed",result:{totalYield:we},details:In.getState().dailyFresnelReflectorYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.FresnelReflector&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.FresnelReflector){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(c){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.FresnelReflector){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Reflector"+Se,Re),Me.push(Te.label??"Reflector"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Reflector"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.FresnelReflector){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return q(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const q=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.FresnelReflector&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyFresnelReflectorYieldPanel=!0,ge.selectedFloatingWindow="yearlyFresnelReflectorYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForFresnelReflectors=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyFresnelReflectorYield();ge.actionInfo={name:"Yearly Simulation for Fresnel Reflectors Completed",result:{totalYield:we},details:In.getState().yearlyFresnelReflectorYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.FresnelReflector){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.FresnelReflector){const Ce=O.current.get(Me.id);Ce&&(d(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*$),se.push(Ce),we++,ge.push(Me.label??"Reflector"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*$;Se.push(Ce)}u(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.FresnelReflector){const Se=O.current.get(we.id);Se&&(d(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*$),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*$})}u(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(Rt.set(at,Oe+Je*Ye),Ct.set(Rt.x-ht.x,Rt.y-ht.y,0),Ct.applyEuler(St),Qe.set(Te.x+Ct.x,Te.y+Ct.y,ut+Ct.z),!Ie(se.id,Qe,ge)&&!Ie(se.id,Qe,Pt)&&(yt+=zt*Yt))}const Et=Y.current.get(se.id);if(Et){const Lt=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Et[Lt]+=yt/(Fe*He)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>{const ge=a(se);if(!ge)throw new Error("parent of Fresnel reflector does not exist");let we=1;if(ge.type===z.Foundation){const Me=ge.solarAbsorberPipe;we*=((Me==null?void 0:Me.absorberOpticalEfficiency)??.7)*((Me==null?void 0:Me.absorberThermalEfficiency)??.3)*((Me==null?void 0:Me.absorberAbsorptance)??.95)}return se.lx*se.ly*se.reflectance*we*(1-N[v.getMonth()])},Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.FresnelReflector){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.FresnelReflector){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),Ktr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=In(uRt),s=H(GN),c=H(pJe),u=In(fRt),d=H(XN),f=H(gJe),p=In(hRt),m=dt(iRt),y=dt(aRt),w=dt(lRt),x=dt(sRt),C=H(GGe),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=t?S==null?void 0:S.elevation:0,T=r.cspTimesPerHour??4,R=60/T,M=r.cspDaysPerYear??6,D=12/M,k=g.useMemo(()=>new yu,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=g.useRef([]),F=g.useRef([]),E=g.useRef(0),L=g.useRef(!1),j=g.useRef(new Date(r.date)),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),ee=g.useRef(oe),$=ye.daysInYear(v)/12;g.useEffect(()=>{if(m)return ae(),E.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[m]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),Z())},[w]);const ae=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),v.setHours(Math.floor(oe.sunrise/60),R/2-30)),L.current=!1,ve(),ze()},Z=()=>{if(m&&!G.current){if(v.getMinutes()+v.getHours()*60>=oe.sunset){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showDailyHeliostatYieldPanel=!0,ge.selectedFloatingWindow="dailyHeliostatYieldPanel"}),dt.getState().set(ge=>{ge.runDailySimulationForHeliostats=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,ne(),o&&e(ge=>{const we=In.getState().sumDailyHeliostatYield();ge.actionInfo={name:"Daily Simulation for Heliostats Completed",result:{totalYield:we},details:In.getState().dailyHeliostatYield,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+R),e(ge=>{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.Heliostat&&me(ge);E.current=requestAnimationFrame(Z)}},ne=()=>{const se=ce();for(const ge of i)if(ge.type===z.Heliostat){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=pe(we)*se;for(let Ce=0;Ce{var se;if(c){const ge=new Array(24).fill(0),we=new Map;let Se=0;const Me=[];for(const Te of i)if(Te.type===z.Heliostat){const Re=Y.current.get(Te.id);if(Re){s(Te.id,Re.reduce((Ne,_e)=>Ne+_e,0)),Se++,we.set("Heliostat"+Se,Re),Me.push(Te.label??"Heliostat"+Se);for(let Ne=0;Ne<24;Ne++)ge[Ne]+=Re[Ne]}}const Ce=[];for(let Te=0;Te<24;Te++){const Re={};Re.Hour=Te;for(let Ne=1;Ne<=Se;Ne++){const _e="Heliostat"+Ne;Re[Me[Ne-1]]=(se=we.get(_e))==null?void 0:se[Te]}Ce.push(Re)}l(Ce),p(Me)}else{const ge=new Array(24).fill(0);for(const Se of i)if(Se.type===z.Heliostat){const Me=Y.current.get(Se.id);if(Me){s(Se.id,Me.reduce((Ce,Te)=>Ce+Te,0));for(let Ce=0;Ce<24;Ce++)ge[Ce]+=Me[Ce]}}const we=[];for(let Se=0;Se<24;Se++)we.push({Hour:Se,Total:ge[Se]});l(we)}};g.useEffect(()=>{if(y)return q(),E.current=requestAnimationFrame(le),()=>{cancelAnimationFrame(E.current),L.current||(yn(B.t("message.SimulationAborted",A)),e(se=>{se.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(se=>{se.simulationInProgress=!1,se.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=x,x?(Q.current=new Date(v.getTime()),cancelAnimationFrame(E.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),le())},[x]);const q=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(j.current=new Date(r.date),_.current=0,v.setMonth(0,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),e(se=>{se.world.date=v.toLocaleString("en-US")})),L.current=!1,ve(),ze(),Ae()},le=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60{ge.world.date=v.toLocaleString("en-US")});for(const ge of i)ge.type===z.Heliostat&&me(ge);E.current=requestAnimationFrame(le)}else{if(de(),_.current++,_.current===M){cancelAnimationFrame(E.current),e(ge=>{ge.world.date=j.current.toLocaleString("en-US"),ge.viewState.showYearlyHeliostatYieldPanel=!0,ge.selectedFloatingWindow="yearlyHeliostatYieldPanel"}),dt.getState().set(ge=>{ge.runYearlySimulationForHeliostats=!1,ge.simulationInProgress=!1,ge.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),L.current=!0,he(),o&&e(ge=>{const we=In.getState().sumYearlyHeliostatYield();ge.actionInfo={name:"Yearly Simulation for Heliostats Completed",result:{totalYield:we},details:In.getState().yearlyHeliostatYield,timestamp:new Date().getTime()}});return}v.setMonth(_.current*D,22),ee.current=pl(v,r.latitude),v.setHours(Math.floor(ee.current.sunrise/60),R/2-30),ze(),E.current=requestAnimationFrame(le)}},de=()=>{const se=Pe();for(const ge of i)if(ge.type===z.Heliostat){const we=ge,Se=Y.current.get(we.id);if(Se){const Me=O.current.get(we.id);if(Me){const Ce=Se.reduce((Te,Re)=>Te+Re,0);Me[_.current]+=Ce*se*pe(we)}}}C&&ne()},he=()=>{if(f){const se=[],ge=[];let we=0;for(const Me of i)if(Me.type===z.Heliostat){const Ce=O.current.get(Me.id);Ce&&(d(Me.id,Ce.reduce((Te,Re)=>Te+Re,0)*D*$),se.push(Ce),we++,ge.push(Me.label??"Heliostat"+we))}const Se=[];for(let Me=0;Me<12;Me+=D){const Ce={};Ce.Month=Bs[Me];for(const[Te,Re]of se.entries())Ce[ge[Te]]=Re[Me/D]*$;Se.push(Ce)}u(Se),p(ge)}else{const se=[];for(const we of i)if(we.type===z.Heliostat){const Se=O.current.get(we.id);Se&&(d(we.id,Se.reduce((Me,Ce)=>Me+Ce,0)*D*$),se.push(Se))}const ge=[];for(let we=0;we<12;we+=D){let Se=0;for(const Me of se)Se+=Me[we/D];ge.push({Month:Bs[we],Total:Se*$})}u(ge)}},me=se=>{const ge=zi(v,r.latitude);if(ge.z0&&(et.set(Pt,Oe+Rt*Ye),bt.set(et.x-ht.x,et.y-ht.y,0),bt.applyEuler(gt),Qe.set(Te.x+bt.x,Te.y+bt.y,ut+bt.z),!Ie(se.id,Qe,ge)&&!Ie(se.id,Qe,tt)&&(St+=je*Ve))}const Yt=Y.current.get(se.id);if(Yt){const zt=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Yt[zt]+=St/(Fe*He)}},ce=()=>{const se=oe.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},Pe=()=>{const se=ee.current.daylight()/60;return se>Ht?S.sunshineHours[v.getMonth()]/(30*se*T):0},pe=se=>{const ge=a(se);if(!ge)throw new Error("parent of heliostat does not exist");let we=1;if(ge.type===z.Foundation){const Me=ge.solarPowerTower;we*=((Me==null?void 0:Me.receiverOpticalEfficiency)??.7)*((Me==null?void 0:Me.receiverThermalEfficiency)??.3)*((Me==null?void 0:Me.receiverAbsorptance)??.95)}return se.lx*se.ly*se.reflectance*we*(1-N[v.getMonth()])},Ie=(se,ge,we)=>{if(W.current.length>1){F.current.length=0,k.set(ge,we);const Se=W.current.filter(Me=>Me.uuid!==se);return k.intersectObjects(Se,!1,F.current),F.current.length>0}return!1},ve=()=>{const se=P.children.filter(ge=>ge.name==="Content");if(se.length>0){const ge=se[0].children;W.current.length=0;for(const we of ge)ye.fetchSimulationElements(we,W.current)}},ze=()=>{for(const se of i)if(se.type===z.Heliostat){const ge=Y.current.get(se.id);ge?ge.fill(0):Y.current.set(se.id,new Array(24).fill(0))}},Ae=()=>{for(const se of i)if(se.type===z.Heliostat){const ge=O.current.get(se.id);ge&&ge.length===M?ge.fill(0):O.current.set(se.id,new Array(M).fill(0))}};return h.jsx(h.Fragment,{})}),$tr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=In(TRt),l=In(wRt),s=In(xRt),c=In(SRt),u=dt(yJe),d=dt(pRt),f=dt(AJe),p=dt(gRt),m=H(XGe),y=H(qGe),w=H(WN)??900,x=r.sutGridCellSize??1,{scene:C}=ti(),P=Kt(),A=_1(t),S=new Date(r.date),v=A?A.elevation:0,b=r.sutTimesPerHour??4,T=60/b,R=r.sutDaysPerYear??6,M=12/R,D=g.useMemo(()=>new yu,[]),k=g.useRef([]),N=g.useRef([]),U=g.useRef(0),W=g.useRef(!1),F=g.useRef(new Date(r.date)),E=g.useRef(new Array(24).fill(0)),L=g.useRef(new Map),j=g.useRef(new Map),Y=g.useRef(new Map),O=g.useRef(new Map),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useRef(0),ee=g.useMemo(()=>pl(S,r.latitude),[r.date,r.latitude]),$=g.useRef(ee),ae=ye.daysInYear(S)/12;g.useEffect(()=>{if(u)if(y&&!ye.hasMovingParts(i))Z();else return ne(),U.current=requestAnimationFrame(te),()=>{cancelAnimationFrame(U.current),W.current||(yn(B.t("message.SimulationAborted",P)),e(Se=>{Se.world.date=F.current.toLocaleString("en-US")}),dt.getState().set(Se=>{Se.simulationInProgress=!1,Se.simulationPaused=!1})),G.current=!1}},[u]),g.useEffect(()=>{G.current=d,d?(Q.current=new Date(S.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",P))):(n("simulationPaused",!1),te())},[d]);const Z=()=>{ge(),pe();for(const Se of i)if(Se.type===z.Foundation){const Me=Se;Me.solarStructure===Nn.UpdraftTower&&Me.solarUpdraftTower&&ze(Me)}e(Se=>{Se.viewState.showDailyUpdraftTowerYieldPanel=!0,Se.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(Se=>{Se.runDailySimulationForUpdraftTower=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,q(),o&&e(Se=>{const Me=In.getState().sumDailyUpdraftTowerYield();Se.actionInfo={name:"Static Daily Simulation for Updraft Tower Completed",result:{totalYield:Me},details:In.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}})},ne=()=>{G.current?(S.setTime(Q.current.getTime()),G.current=!1):(F.current=new Date(r.date),oe.current=S.getDay(),S.setHours(Math.floor(ee.sunrise/60),-T/2)),W.current=!1,ge(),pe()},te=()=>{if(u&&!G.current){if(S.getMinutes()+S.getHours()*60+(S.getDay()-oe.current)*f5+T>=ee.sunset){cancelAnimationFrame(U.current),e(Me=>{Me.world.date=F.current.toLocaleString("en-US"),Me.viewState.showDailyUpdraftTowerYieldPanel=!0,Me.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(Me=>{Me.runDailySimulationForUpdraftTower=!1,Me.simulationInProgress=!1,Me.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,q(),o&&e(Me=>{const Ce=In.getState().sumDailyUpdraftTowerYield();Me.actionInfo={name:"Dynamic Daily Simulation for Updraft Tower Completed",result:{totalYield:Ce},details:In.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}});return}S.setHours(S.getHours(),S.getMinutes()+T),e(Me=>{Me.world.date=S.toLocaleString("en-US")});for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower&&ve(Ce)}U.current=requestAnimationFrame(te)}},q=()=>{const Se=Ae();for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;if(Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower){const Te=Ce.solarUpdraftTower.collectorTransmissivity??.9,Re=Ce.solarUpdraftTower.turbineEfficiency??.3,Ne=Ce.solarUpdraftTower.dischargeCoefficient??.65,_e=Math.PI*Ce.solarUpdraftTower.chimneyRadius*Ce.solarUpdraftTower.chimneyRadius,Ue=Math.PI*Ce.solarUpdraftTower.collectorRadius*Ce.solarUpdraftTower.collectorRadius,qe=D_*eMe*_e,Fe=2*ZHe*Ce.solarUpdraftTower.chimneyHeight,He=L.current.get(Me.id+"-sut"),Le=j.current.get(Me.id+"-sut"),Ye=Y.current.get(Me.id+"-sut");if(Ye&&He&&Le){const lt=.5*Ne*Re*D_*_e,Oe=new Date(r.date);let ut;A&&(ut=eS(Oe,A.lowestTemperatures,A.highestTemperatures));for(let ht=0;ht0&&ht>0&&He[ht-1]>Qe){const Ve=(He[ht-1]+Qe)/2,je=(r.airConvectiveCoefficient??5)*Ue*(Ve-Qe),et=Ve+Aw,bt=et*et*et*et,St=nt*nt*nt*nt,Pt=(Ce.solarUpdraftTower.collectorEmissivity??.95)*tMe*Ue*(bt-St);Ye[ht]-=je+Pt,Ye[ht]<0&&(Ye[ht]=0)}const mt=Ye[ht]/(qe*nt),tt=nt*(1+Math.cbrt(mt*mt/Fe))-Aw,gt=tt>Qe?Math.sqrt(Fe*((tt+Aw)/nt-1)):0;Ye[ht]=lt*gt*gt*gt*.001,He[ht]=tt,Le[ht]=gt}}}}le()},le=()=>{var Ne,_e,Ue;const Se=new Map;let Me=0;const Ce=[];for(const qe of i)if(qe.type===z.Foundation){const Fe=qe;if(Fe.solarStructure===Nn.UpdraftTower&&Fe.solarUpdraftTower){Me++;const He=L.current.get(qe.id+"-sut");He&&Se.set("Temperature Tower"+Me,He);const Le=j.current.get(qe.id+"-sut");Le&&Se.set("Wind Speed Tower"+Me,Le);const Ye=Y.current.get(qe.id+"-sut");Ye&&(Se.set("Tower"+Me,Ye),Ce.push(qe.label?qe.label:"Tower"+Me))}}const Te=[];for(let qe=0;qe<24;qe++){const Fe={};Fe.Hour=qe;for(let He=1;He<=Me;He++){const Le="Tower"+He;Fe[Ce[He-1]]=(Ne=Se.get(Le))==null?void 0:Ne[qe]}Te.push(Fe)}s(Te);const Re=[];for(let qe=0;qe<24;qe++){const Fe={};Fe.Hour=qe,Fe.T_Ambient=E.current[qe];for(let He=1;He<=Me;He++){let Le="Temperature Tower"+He;Fe["T_"+Ce[He-1]]=(_e=Se.get(Le))==null?void 0:_e[qe],Le="Wind Speed Tower"+He,Fe["V_"+Ce[He-1]]=(Ue=Se.get(Le))==null?void 0:Ue[qe]}Re.push(Fe)}l(Re),a(Ce)};g.useEffect(()=>{if(f)if(y&&!ye.hasMovingParts(i))he();else return de(),U.current=requestAnimationFrame(me),()=>{cancelAnimationFrame(U.current),W.current||(yn(B.t("message.SimulationAborted",P)),e(Se=>{Se.world.date=F.current.toLocaleString("en-US")}),dt.getState().set(Se=>{Se.simulationInProgress=!1,Se.simulationPaused=!1})),G.current=!1}},[f]),g.useEffect(()=>{G.current=p,p?(Q.current=new Date(S.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",P))):(n("simulationPaused",!1),me())},[p]);const de=()=>{G.current?(S.setTime(Q.current.getTime()),G.current=!1):(F.current=new Date(r.date),_.current=0,S.setMonth(0,22),oe.current=S.getDay(),$.current=pl(S,r.latitude),S.setHours(Math.floor($.current.sunrise/60),-T/2),e(Se=>{Se.world.date=S.toLocaleString("en-US")})),W.current=!1,ge(),pe(),Ie()},he=()=>{ge(),pe(),Ie(),F.current=new Date(r.date),_.current=0;for(let Se=0;Se<12;Se+=M){S.setMonth(Se,22),$.current=pl(S,r.latitude),pe();for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower&&ze(Ce)}ce(),_.current++}e(Se=>{Se.world.date=F.current.toLocaleString("en-US"),Se.viewState.showYearlyUpdraftTowerYieldPanel=!0,Se.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(Se=>{Se.runYearlySimulationForUpdraftTower=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,Pe(),o&&e(Se=>{const Me=In.getState().sumYearlyUpdraftTowerYield();Se.actionInfo={name:"Static Yearly Simulation for Updraft Tower Completed",result:{totalYield:Me},details:In.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}})},me=()=>{if(f&&!G.current)if(S.getMinutes()+S.getHours()*60+(S.getDay()-oe.current)*f5+T<$.current.sunset){S.setHours(S.getHours(),S.getMinutes()+T),e(Me=>{Me.world.date=S.toLocaleString("en-US")});for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower&&ve(Ce)}U.current=requestAnimationFrame(me)}else{if(ce(),_.current++,_.current===R){cancelAnimationFrame(U.current),e(Me=>{Me.world.date=F.current.toLocaleString("en-US"),Me.viewState.showYearlyUpdraftTowerYieldPanel=!0,Me.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(Me=>{Me.runYearlySimulationForUpdraftTower=!1,Me.simulationInProgress=!1,Me.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",P)),W.current=!0,Pe(),o&&e(Me=>{const Ce=In.getState().sumYearlyUpdraftTowerYield();Me.actionInfo={name:"Dynamic Yearly Simulation for Updraft Tower Completed",result:{totalYield:Ce},details:In.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}});return}S.setMonth(_.current*M,22),oe.current=S.getDay(),$.current=pl(S,r.latitude),S.setHours(Math.floor($.current.sunrise/60),-T/2),pe(),U.current=requestAnimationFrame(me)}},ce=()=>{const Se=se();for(const Me of i)if(Me.type===z.Foundation){const Ce=Me;if(Ce.solarStructure===Nn.UpdraftTower&&Ce.solarUpdraftTower){const Te=Y.current.get(Ce.id+"-sut"),Re=L.current.get(Me.id+"-sut"),Ne=j.current.get(Me.id+"-sut");if(Te&&Re&&Ne){const _e=Ce.solarUpdraftTower.collectorTransmissivity??.9,Ue=Ce.solarUpdraftTower.turbineEfficiency??.3,qe=Ce.solarUpdraftTower.dischargeCoefficient??.65,Fe=Math.PI*Ce.solarUpdraftTower.chimneyRadius*Ce.solarUpdraftTower.chimneyRadius,He=Math.PI*Ce.solarUpdraftTower.collectorRadius*Ce.solarUpdraftTower.collectorRadius,Le=D_*eMe*Fe,Ye=2*ZHe*Ce.solarUpdraftTower.chimneyHeight,lt=.5*qe*Ue*D_*Fe;let Oe;A&&(Oe=eS(S,A.lowestTemperatures,A.highestTemperatures));for(let ht=0;ht0&&ht>0&&Re[ht-1]>Qe){const Ve=(Re[ht-1]+Qe)/2,je=(r.airConvectiveCoefficient??5)*He*(Ve-Qe),et=Ve+Aw,bt=et*et*et*et,St=nt*nt*nt*nt,Pt=(Ce.solarUpdraftTower.collectorEmissivity??.95)*tMe*He*(bt-St);Te[ht]-=je+Pt,Te[ht]<0&&(Te[ht]=0)}const mt=Te[ht]/(Le*nt),tt=nt*(1+Math.cbrt(mt*mt/Ye))-Aw,gt=tt>Qe?Math.sqrt(Ye*((tt+Aw)/nt-1)):0;Te[ht]=lt*gt*gt*gt*.001,Re[ht]=tt,Ne[ht]=gt}const ut=O.current.get(Ce.id+"-sut");if(ut){const ht=Te.reduce((Qe,nt)=>Qe+nt,0);ut[_.current]+=ht}}}}m&&le()},Pe=()=>{const Se=[],Me=[];let Ce=0;for(const Re of i)if(Re.type===z.Foundation){const Ne=Re;if(Ne.solarStructure===Nn.UpdraftTower&&Ne.solarUpdraftTower){const _e=O.current.get(Re.id+"-sut");_e&&(Se.push(_e),Me.push(Re.label?Re.label:"Tower"+ ++Ce))}}const Te=[];for(let Re=0;Re<12;Re+=M){const Ne={};Ne.Month=Bs[Re];for(const[_e,Ue]of Se.entries())Ne[Me[_e]]=Ue[Re/M]*ae;Te.push(Ne)}c(Te),a(Me)},pe=()=>{for(const Se of i)if(Se.type===z.Foundation){const Me=Se;if(Me.solarStructure===Nn.UpdraftTower&&Me.solarUpdraftTower){const Ce=L.current.get(Se.id+"-sut");Ce?Ce.fill(0):L.current.set(Se.id+"-sut",new Array(24).fill(0));const Te=j.current.get(Se.id+"-sut");Te?Te.fill(0):j.current.set(Se.id+"-sut",new Array(24).fill(0));const Re=Y.current.get(Se.id+"-sut");Re?Re.fill(0):Y.current.set(Se.id+"-sut",new Array(24).fill(0))}}},Ie=()=>{for(const Se of i)if(Se.type===z.Foundation){const Me=Se;if(Me.solarStructure===Nn.UpdraftTower&&Me.solarUpdraftTower){const Ce=O.current.get(Se.id+"-sut");Ce&&Ce.length===R?Ce.fill(0):O.current.set(Se.id+"-sut",new Array(R).fill(0))}}},ve=Se=>{const Me=Se.solarUpdraftTower;if(!Me)return;const Ce=zi(S,r.latitude);if(Ce.zut)&&(Qe++,ht+=Ye,Oe>0&&(we(Se.id+"-sut",lt,Ce)||(ht+=Oe*Le)))}Qe&&(ht/=Qe);const tt=S.getMinutes()>=30?S.getHours()+1===24?0:S.getHours()+1:S.getHours(),gt=Math.PI*Me.collectorRadius*Me.collectorRadius;Te[tt]+=ht*gt}},ze=Se=>{const Me=Se.solarUpdraftTower;if(!Me)return;const Ce=Y.current.get(Se.id+"-sut");if(!Ce)return;const Te=new ue().fromArray(Se.normal),Re=S.getFullYear(),Ne=S.getMonth(),_e=S.getDate(),Ue=ye.dayOfYear(S),qe=Me.collectorRadius,Fe=Math.max(2,Math.round(qe*2/x)),He=Se.cx-qe+x/2,Le=Se.cy-qe+x/2,Ye=Se.lz+Me.collectorHeight,lt=new ue(0,0,Ye),Oe=qe*qe;let ut=0,ht,Qe;const nt=Math.PI*Me.collectorRadius*Me.collectorRadius;for(let mt=0;mt<24;mt++){for(let tt=0;tt0){const je=Si(Ve,Ue,v,hi.SPHERE_MODEL),et=ei(r.ground,Ne,Oo,je),bt=Te.dot(Ve);ut=0;for(let St=0;StOe)&&(ut++,Ce[mt]+=et,bt>0&&(we(Se.id+"-sut",lt,Ve)||(Ce[mt]+=bt*je)))}}}ut&&(Ce[mt]/=ut),Ce[mt]*=nt}},Ae=()=>{const Se=ee.daylight()/60;return Se>Ht?A.sunshineHours[S.getMonth()]/(30*Se*b):0},se=()=>{const Se=S.getMonth(),Me=$.current.daylight()/60;return Me>Ht?A.sunshineHours[Se]/(30*Me*b):0},ge=()=>{const Se=C.children.filter(Me=>Me.name==="Content");if(Se.length>0){const Me=Se[0].children;k.current.length=0;for(const Ce of Me)ye.fetchSimulationElements(Ce,k.current)}},we=(Se,Me,Ce)=>{if(k.current.length>1){N.current.length=0,D.set(Me,Ce);const Te=k.current.filter(Re=>Re.uuid!==Se);return D.intersectObjects(Te,!1,N.current),N.current.length>0}return!1};return h.jsx(h.Fragment,{})});class qtr{constructor(e,n){this.position=e,this.observer=n}}const Qtr=xe.memo(()=>{const t=H.getState().world,e=H.getState().elements,n=H(pn),o=dt(kf),r=H($r),i=H(p4),a=dt(ICt),{scene:l}=ti(),s=Kt(),c=g.useMemo(()=>new yu,[]),u=t.solarPanelVisibilityGridCellSize??.2,d=g.useRef([]),f=g.useRef([]),p=g.useRef([]);g.useEffect(()=>{a&&e&&e.length>0&&(w(),o("runSolarPanelVisibilityAnalysis",!1),n(P=>{P.viewState.showSolarPanelVisibilityResultsPanel=!0,P.selectedFloatingWindow="visibilityResultsPanel"}),yn(B.t("message.SimulationCompleted",s))),o("simulationInProgress",!1)},[a]);const m=()=>{const P=l.children.filter(A=>A.name==="Content");if(P.length>0){const A=P[0].children;f.current.length=0;for(const S of A)ye.fetchSimulationElements(S,f.current)}},y=()=>{d.current=[];for(const P of e)if(P.type===z.Human){const A=P;if(A.observer){const S=r(A),v=S?ye.absoluteHumanOrTreeCoordinates(A.cx,A.cy,A.cz,S):new ue(A.cx,A.cy,A.cz);v.z+=A.lz,d.current.push(new qtr(v,A))}}},w=()=>{if(In.getState().clearSolarPanelVisibilityResults(),y(),d.current.length!==0){m();for(const P of d.current){const A=new Map;for(const S of e)if(S.type===z.SolarPanel){const v=S;A.set(v.parentId,0)}for(const S of e)if(S.type===z.SolarPanel){const v=S;let b=A.get(v.parentId)??0;b+=x(v,P.position)*100,A.set(v.parentId,b)}In.getState().setSolarPanelVisibilityResult(P,A)}}},x=(P,A)=>{let S=r(P);if(!S)throw new Error("parent of solar panel does not exist");let v=!1;const b=P.parentType===z.Wall;if(S.type===z.Roof){if(S=i(S),!S)throw new Error("foundation of solar panel does not exist");v=!0}const T=b?ye.absoluteCoordinates(P.cx,P.cy,P.cz,S,i(P),P.lz):ye.absoluteCoordinates(P.cx,P.cy,P.cz,S,void 0,void 0,!0);v&&(T.z=P.cz+S.cz);const R=new ue().fromArray(P.normal);b&&R.applyEuler(new cn(0,0,S.relativeAngle));const M=S.rotation[2]+P.relativeAzimuth;Math.abs(P.tiltAngle)>.001&&R.applyEuler(new cn(P.tiltAngle,0,M,"ZYX"));const D=P.lx,k=P.ly*Math.cos(P.tiltAngle),N=P.ly*Math.abs(Math.sin(P.tiltAngle)),U=Math.max(2,Math.round(P.lx/u)),W=Math.max(2,Math.round(P.ly/u)),F=D/U,E=k/W,L=N/W,j=T.x-D/2,Y=T.y-k/2,O=(v?T.z:P.poleHeight+T.z)-N/2,_=new _t(T.x,T.y);let G=0;const Q=new ue,oe=new ue;let ee;const $=new _t,ae=ye.isZero(M);for(let Z=0;Z{if(f.current.length>1){p.current.length=0,c.set(A,S);const v=f.current.filter(b=>b.uuid!==P);if(c.intersectObjects(v,!1,p.current),p.current.length===0)return!0;for(const[b,T]of p.current.entries())if(T.object.name.endsWith("eyeball")&&b===0)return!0;return!1}return!0};return h.jsx(h.Fragment,{})}),Ztr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H($r),l=H(p4),s=H(PCt),c=H(RCt),u=In(jRt),d=In(WRt),f=In(URt),p=dt(SJe),m=dt(kRt),y=dt(TJe),w=dt(FRt),x=H(BGe),C=H(Q2e),{scene:P}=ti(),A=Kt(),S=_1(t),v=new Date(r.date),b=g.useMemo(()=>s(t??"Boston MA, USA"),[t]),T=g.useMemo(()=>c(t??"Boston MA, USA"),[t]),R=t?S==null?void 0:S.elevation:0,M=r.timesPerHour??4,D=60/M,k=g.useMemo(()=>new yu,[]),N=g.useRef([]),U=g.useRef([]),W=g.useRef(0),F=g.useRef(!1),E=g.useRef(new Date(r.date)),L=g.useRef(new Map),j=g.useRef(new Map),Y=g.useRef(new Array(12).fill(0)),O=g.useRef(new Array(12).fill(0)),_=g.useRef(0),G=g.useRef(!1),Q=g.useRef(new Date(r.date)),oe=g.useRef(0),ee=g.useMemo(()=>pl(v,r.latitude),[r.date,r.latitude]),$=g.useRef(ee);g.useEffect(()=>{if(p)if(C&&!ye.hasMovingParts(i))ae();else return Z(),W.current=requestAnimationFrame(ne),()=>{cancelAnimationFrame(W.current),F.current||(yn(B.t("message.SimulationAborted",A)),e(we=>{we.world.date=E.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[p]),g.useEffect(()=>{G.current=m,m?(Q.current=new Date(v.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),ne())},[m]);const ae=()=>{se(),Pe();for(const we of i)we.type===z.Sensor&&ve(we);e(we=>{we.viewState.showDailyLightSensorPanel=!0,we.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(we=>{we.runDailyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,te(),o&&e(we=>{we.actionInfo={name:"Static Daily Simulation for Sensors Completed",details:In.getState().dailyLightSensorData,timestamp:new Date().getTime()}})},Z=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(E.current=new Date(r.date),oe.current=v.getDay(),v.setHours(Math.floor(ee.sunrise/60),-D/2)),F.current=!1,se(),Pe()},ne=()=>{if(p&&!G.current){if(v.getMinutes()+v.getHours()*60+(v.getDay()-oe.current)*f5+D>=ee.sunset){cancelAnimationFrame(W.current),e(Se=>{Se.world.date=E.current.toLocaleString("en-US"),Se.viewState.showDailyLightSensorPanel=!0,Se.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(Se=>{Se.runDailyLightSensor=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,te(),o&&e(Se=>{Se.actionInfo={name:"Dynamic Daily Simulation for Sensors Completed",details:In.getState().dailyLightSensorData,timestamp:new Date().getTime()}});return}v.setHours(v.getHours(),v.getMinutes()+D),e(Se=>{Se.world.date=v.toLocaleString("en-US")});for(const Se of i)Se.type===z.Sensor&&Ie(Se);W.current=requestAnimationFrame(ne)}},te=()=>{const we=ze();for(const Se of i)if(Se.type===z.Sensor){const Me=L.current.get(Se.id);if(Me)for(let Ce=0;Ce{var Te;const we=new Map;let Se=0;const Me=[];for(const Re of i)if(Re.type===z.Sensor){const Ne=L.current.get(Re.id);Ne&&(we.set("Radiation"+ ++Se,Ne),Me.push(Re.label?Re.label:"Radiation"+Se))}const Ce=[];for(let Re=0;Re<24;Re++){const Ne={};Ne.Hour=Re;for(let _e=1;_e<=Se;_e++){const Ue="Radiation"+_e;Ne[Me[_e-1]]=(Te=we.get(Ue))==null?void 0:Te[Re]}Ce.push(Ne)}d(Ce),u(Me)};g.useEffect(()=>{if(y)if(C&&!ye.hasMovingParts(i))de();else return le(),W.current=requestAnimationFrame(he),()=>{cancelAnimationFrame(W.current),F.current||(yn(B.t("message.SimulationAborted",A)),e(we=>{we.world.date=E.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[y]),g.useEffect(()=>{G.current=w,w?(Q.current=new Date(v.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",A))):(n("simulationPaused",!1),he())},[w]);const le=()=>{G.current?(v.setTime(Q.current.getTime()),G.current=!1):(E.current=new Date(r.date),_.current=0,v.setMonth(0,22),oe.current=v.getDay(),$.current=pl(v,r.latitude),v.setHours(Math.floor($.current.sunrise/60),-D/2),e(we=>{we.world.date=v.toLocaleString("en-US")})),F.current=!1,se(),Pe(),pe()},de=()=>{se(),Pe(),pe(),E.current=new Date(r.date),_.current=0;for(let we=0;we<12;we++){v.setMonth(we,22),$.current=pl(v,r.latitude),Pe();for(const Se of i)Se.type===z.Sensor&&ve(Se);me(),_.current++}e(we=>{we.world.date=E.current.toLocaleString("en-US"),we.viewState.showYearlyLightSensorPanel=!0,we.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(we=>{we.runYearlyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,ce(),o&&e(we=>{we.actionInfo={name:"Static Yearly Simulation for Sensors Completed",details:In.getState().yearlyLightSensorData,timestamp:new Date().getTime()}})},he=()=>{if(y&&!G.current)if(v.getMinutes()+v.getHours()*60+(v.getDay()-oe.current)*f5+D<$.current.sunset){v.setHours(v.getHours(),v.getMinutes()+D),e(Se=>{Se.world.date=v.toLocaleString("en-US")});for(const Se of i)Se.type===z.Sensor&&Ie(Se);W.current=requestAnimationFrame(he)}else{if(me(),_.current++,_.current===12){cancelAnimationFrame(W.current),e(Se=>{Se.world.date=E.current.toLocaleString("en-US"),Se.viewState.showYearlyLightSensorPanel=!0,Se.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(Se=>{Se.runYearlyLightSensor=!1,Se.simulationInProgress=!1,Se.simulationPaused=!1}),yn(B.t("message.SimulationCompleted",A)),F.current=!0,ce(),o&&e(Se=>{Se.actionInfo={name:"Dynamic Yearly Simulation for Sensors Completed",details:In.getState().yearlyLightSensorData,timestamp:new Date().getTime()}});return}v.setMonth(_.current,22),oe.current=v.getDay(),$.current=pl(v,r.latitude),v.setHours(Math.floor($.current.sunrise/60),-D/2),Pe(),W.current=requestAnimationFrame(he)}},me=()=>{const we=Ae();for(const Se of i)if(Se.type===z.Sensor){const Me=L.current.get(Se.id);if(Me){const Ce=j.current.get(Se.id);if(Ce){const Te=Me.reduce((Re,Ne)=>Re+Ne,0);Ce[_.current]+=Te*we}}}x&&te()},ce=()=>{const we=[],Se=[];let Me=0,Ce=!1,Te=!1;for(const Ue of i)if(Ue.type===z.Sensor){const qe=j.current.get(Ue.id);qe&&(we.push(qe),Se.push(Ue.label?Ue.label:"Radiation"+ ++Me),!Ce&&ye.isIdentical(Ue.normal,fs)&&(Ce=!0),!Te&&ye.isIdentical(Ue.normal,Uvt)&&(Te=!0))}const Re=Ce&&b;Re&&Se.push("Measured (Hor.)");const Ne=Te&&T;Ne&&Se.push("Measured (Ver.)");const _e=[];for(let Ue=0;Ue<12;Ue++){const qe={};qe.Month=Bs[Ue];for(const[Fe,He]of we.entries())qe.Daylight=Y.current[Ue],qe.Clearness=O.current[Ue]*100,Re&&(qe["Measured (Hor.)"]=b.data[Ue]),Ne&&(qe["Measured (Ver.)"]=T.data[Ue]),qe[Se[Fe]]=He[Ue];_e.push(qe)}f(_e),u(Se)},Pe=()=>{for(const we of i)if(we.type===z.Sensor){const Se=L.current.get(we.id);Se?Se.fill(0):L.current.set(we.id,new Array(24).fill(0))}},pe=()=>{for(const we of i)if(we.type===z.Sensor){const Se=j.current.get(we.id);Se?Se.fill(0):j.current.set(we.id,new Array(12).fill(0))}},Ie=we=>{const Se=zi(v,r.latitude);if(Se.z0&&(ge(we.id,Te,Se)||(qe+=Ue*_e));const Fe=L.current.get(we.id);if(Fe){const He=v.getMinutes()>=30?v.getHours()+1===24?0:v.getHours()+1:v.getHours();Fe[He]+=qe}},ve=we=>{const Se=a(we);if(!Se)throw new Error("parent of sensor does not exist");const Me=L.current.get(we.id);if(!Me)return;let Ce=null;Se.type===z.Wall&&(Ce=l(we));const Te=ye.absoluteCoordinates(we.cx,we.cy,we.cz,Se,Ce||void 0),Re=new ue().fromArray(we.normal);Re.applyAxisAngle(Oo,Se.rotation[2]);const Ne=v.getFullYear(),_e=v.getMonth(),Ue=v.getDate(),qe=ye.dayOfYear(v);for(let Fe=0;Fe<24;Fe++)for(let He=0;He0){const lt=Si(Ye,qe,R,hi.SPHERE_MODEL),Oe=Re.dot(Ye);Oe>0&&(ge(we.id,Te,Ye)||(Me[Fe]+=Oe*lt)),Me[Fe]+=ei(r.ground,_e,Re,lt)}}},ze=()=>{const we=ee.daylight()/60;return we>Ht?S.sunshineHours[v.getMonth()]/(30*we*M):0},Ae=()=>{const we=v.getMonth(),Se=$.current.daylight()/60;return Se>Ht?(Y.current[we]=Se,O.current[we]=S.sunshineHours[we]/(30*Se),O.current[we]/M):(Y.current[we]=0,O.current[we]=0,0)},se=()=>{const we=P.children.filter(Se=>Se.name==="Content");if(we.length>0){const Se=we[0].children;N.current.length=0;for(const Me of Se)ye.fetchSimulationElements(Me,N.current)}},ge=(we,Se,Me)=>{if(N.current.length>1){U.current.length=0,k.set(Se,Me);const Ce=N.current.filter(Te=>Te.uuid!==we);return k.intersectObjects(Ce,!1,U.current),U.current.length>0}return!1};return h.jsx(h.Fragment,{})}),LUe=(t,e)=>{let n=e.efficiency;return e.cellType==="Monocrystalline"&&(n*=.95),n*(1+e.pmaxTC*(t-25))},enr=xe.memo(({city:t})=>{const e=H(pn),n=dt(kf),o=H(Qi),r=H.getState().world,i=H.getState().elements,a=H(O5),l=H($r),s=H(p4),c=In(WCt),u=H(GN),d=In(UCt),f=H(XN),p=H(nJe),m=H(oJe),y=In(jCt),w=dt(eJe),x=dt(DCt),C=dt(kCt),P=dt(tJe),A=dt(ECt),S=dt(FCt),v=H(YGe),b=H(Z2e),T=H(WN)??900,R=dt(_5),{scene:M}=ti(),D=Kt(),k=_1(t),N=new Date(r.date),U=t?k==null?void 0:k.elevation:0,W=r.timesPerHour??4,F=60/W,E=r.daysPerYear??6,L=12/E,j=g.useMemo(()=>new yu,[]),Y=r.monthlyIrradianceLosses??new Array(12).fill(.05),O=r.pvGridCellSize??.25,_=g.useRef([]),G=g.useRef([]),Q=g.useRef(0),oe=g.useRef(!1),ee=g.useRef(new Date(r.date)),$=g.useRef(new Map),ae=g.useRef(new Map),Z=g.useRef(0),ne=g.useRef(!1),te=g.useRef(new Date(r.date)),q=g.useRef(0),le=g.useRef(20),de=g.useMemo(()=>pl(N,r.latitude),[r.date,r.latitude]),he=g.useRef(de),me=ye.daysInYear(N)/12;g.useEffect(()=>{if(w)if(b&&!ye.hasMovingParts(i))setTimeout(()=>{ce(!1)},50);else return Pe(),Q.current=requestAnimationFrame(pe),()=>{cancelAnimationFrame(Q.current),oe.current||(yn(B.t("message.SimulationAborted",D)),e(He=>{He.world.date=ee.current.toLocaleString("en-US")}),dt.getState().set(He=>{He.simulationInProgress=!1,He.simulationPaused=!1})),ne.current=!1}},[w]),g.useEffect(()=>{x&&b&&!ye.hasMovingParts(i)&&setTimeout(()=>{ce(!0)},50)},[x]),g.useEffect(()=>{ne.current=C,C?(te.current=new Date(N.getTime()),cancelAnimationFrame(Q.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",D))):(n("simulationPaused",!1),pe())},[C]);const ce=He=>{Fe(),Ce();for(const Le of i)Le.type===z.SolarPanel&&Se(Le);if(e(Le=>{!R&&!He&&(Le.viewState.showDailyPvYieldPanel=!0,Le.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(Le=>{He?Le.runDailySimulationForSolarPanelsLastStep=!1:Le.runDailySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,Ie(),!R&&!He&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumDailyPvYield(),Ye=In.getState().getDailyPvProfit(),lt=In.getState().dailyPvYield;e(Oe=>{Oe.actionInfo={name:"Static Daily Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}},Pe=()=>{ne.current?(N.setTime(te.current.getTime()),ne.current=!1):(ee.current=new Date(r.date),q.current=N.getDay(),N.setHours(Math.floor(de.sunrise/60),-F/2)),oe.current=!1,Fe(),Ce()},pe=()=>{if(w&&!ne.current){if(N.getMinutes()+N.getHours()*60+(N.getDay()-q.current)*f5+F>=de.sunset){if(cancelAnimationFrame(Q.current),e(Le=>{Le.world.date=ee.current.toLocaleString("en-US"),R||(Le.viewState.showDailyPvYieldPanel=!0,Le.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(Le=>{Le.runDailySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,Ie(),!R&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumDailyPvYield(),Ye=In.getState().getDailyPvProfit(),lt=In.getState().dailyPvYield;e(Oe=>{Oe.actionInfo={name:"Dynamic Daily Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}return}N.setHours(N.getHours(),N.getMinutes()+F),e(Le=>{Le.world.date=N.toLocaleString("en-US")});for(const Le of i)Le.type===z.SolarPanel&&Me(Le);Q.current=requestAnimationFrame(pe)}},Ie=()=>{const He=Re();for(const Le of i)if(Le.type===z.SolarPanel){const Ye=Le,lt=$.current.get(Le.id);if(lt){const Oe=_e(Ye)*He;for(let ut=0;ut{var He;if(p){const Le=new Array(24).fill(0),Ye=new Map;let lt=0;const Oe=[];for(const ht of i)if(ht.type===z.SolarPanel){const Qe=$.current.get(ht.id);if(Qe){u(ht.id,Qe.reduce((nt,mt)=>nt+mt,0)),lt++,Ye.set("Panel"+lt,Qe),Oe.push(ht.label?ht.label:"Panel"+lt);for(let nt=0;nt<24;nt++)Le[nt]+=Qe[nt]}}const ut=[];for(let ht=0;ht<24;ht++){const Qe={};Qe.Hour=ht;for(let nt=1;nt<=lt;nt++){const mt="Panel"+nt;Qe[Oe[nt-1]]=(He=Ye.get(mt))==null?void 0:He[ht]}ut.push(Qe)}c(ut),y(Oe)}else{const Le=new Array(24).fill(0);for(const lt of i)if(lt.type===z.SolarPanel){const Oe=$.current.get(lt.id);if(Oe){u(lt.id,Oe.reduce((ut,ht)=>ut+ht,0));for(let ut=0;ut<24;ut++)Le[ut]+=Oe[ut]}}const Ye=[];for(let lt=0;lt<24;lt++)Ye.push({Hour:lt,Total:Le[lt]});c(Ye)}};g.useEffect(()=>{if(P)if(b&&!ye.hasMovingParts(i))setTimeout(()=>{Ae(!1)},50);else return ze(),Q.current=requestAnimationFrame(se),()=>{cancelAnimationFrame(Q.current),oe.current||(yn(B.t("message.SimulationAborted",D)),e(He=>{He.world.date=ee.current.toLocaleString("en-US")}),dt.getState().set(He=>{He.simulationInProgress=!1,He.simulationPaused=!1})),ne.current=!1}},[P]),g.useEffect(()=>{A&&b&&!ye.hasMovingParts(i)&&setTimeout(()=>{Ae(!0)},50)},[A]),g.useEffect(()=>{ne.current=S,S?(te.current=new Date(N.getTime()),cancelAnimationFrame(Q.current),n("simulationPaused",!0),yn(B.t("message.SimulationPaused",D))):(n("simulationPaused",!1),se())},[S]);const ze=()=>{ne.current?(N.setTime(te.current.getTime()),ne.current=!1):(ee.current=new Date(r.date),Z.current=0,N.setMonth(0,22),q.current=N.getDay(),he.current=pl(N,r.latitude),N.setHours(Math.floor(he.current.sunrise/60),-F/2),e(He=>{He.world.date=N.toLocaleString("en-US")})),oe.current=!1,Fe(),Ce(),Te()},Ae=He=>{Fe(),Ce(),Te(),ee.current=new Date(r.date),Z.current=0;for(let Le=0;Le<12;Le+=L){N.setMonth(Le,22),he.current=pl(N,r.latitude),Ce();for(const Ye of i)Ye.type===z.SolarPanel&&Se(Ye);ge(),Z.current++}if(e(Le=>{Le.world.date=ee.current.toLocaleString("en-US"),!R&&!He&&(Le.viewState.showYearlyPvYieldPanel=!0,Le.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(Le=>{He?Le.runYearlySimulationForSolarPanelsLastStep=!1:Le.runYearlySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,we(),!R&&!He&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumYearlyPvYield(),Ye=In.getState().getYearlyPvProfit(),lt=In.getState().yearlyPvYield;e(Oe=>{Oe.actionInfo={name:"Static Yearly Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}},se=()=>{if(P&&!ne.current)if(N.getMinutes()+N.getHours()*60+(N.getDay()-q.current)*f5+F{Le.world.date=N.toLocaleString("en-US")});for(const Le of i)Le.type===z.SolarPanel&&Me(Le);Q.current=requestAnimationFrame(se)}else{if(ge(),Z.current++,Z.current===E){if(cancelAnimationFrame(Q.current),e(Le=>{Le.world.date=ee.current.toLocaleString("en-US"),R||(Le.viewState.showYearlyPvYieldPanel=!0,Le.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(Le=>{Le.runYearlySimulationForSolarPanels=!1,Le.simulationInProgress=!1,Le.simulationPaused=!1}),oe.current=!0,we(),!R&&(yn(B.t("message.SimulationCompleted",D)),o)){const Le=In.getState().sumYearlyPvYield(),Ye=In.getState().getYearlyPvProfit(),lt=In.getState().yearlyPvYield;e(Oe=>{Oe.actionInfo={name:"Dynamic Yearly Simulation for Solar Panels Completed",result:{totalYield:Le.toFixed(2),profit:Ye.toFixed(2)},details:lt,timestamp:new Date().getTime()}})}return}N.setMonth(Z.current*L,22),q.current=N.getDay(),he.current=pl(N,r.latitude),N.setHours(Math.floor(he.current.sunrise/60),-F/2),Ce(),Q.current=requestAnimationFrame(se)}},ge=()=>{const He=Ne();for(const Le of i)if(Le.type===z.SolarPanel){const Ye=Le,lt=$.current.get(Le.id);if(lt){const Oe=ae.current.get(Le.id);if(Oe){const ut=lt.reduce((ht,Qe)=>ht+Qe,0);Oe[Z.current]+=ut*He*_e(Ye)}}}!R&&v&&Ie()},we=()=>{if(m){const He=[],Le=[];let Ye=0;for(const Oe of i)if(Oe.type===z.SolarPanel){const ut=ae.current.get(Oe.id);ut&&(f(Oe.id,ut.reduce((ht,Qe)=>ht+Qe,0)*L*me),He.push(ut),Ye++,Le.push(Oe.label??"Panel"+Ye))}const lt=[];for(let Oe=0;Oe<12;Oe+=L){const ut={};ut.Month=Bs[Oe];for(const[ht,Qe]of He.entries())ut[Le[ht]]=Qe[Oe/L]*me;lt.push(ut)}d(lt),y(Le)}else{const He=[];for(const Ye of i)if(Ye.type===z.SolarPanel){const lt=ae.current.get(Ye.id);lt&&(f(Ye.id,lt.reduce((Oe,ut)=>Oe+ut,0)*L*me),He.push(lt))}const Le=[];for(let Ye=0;Ye<12;Ye+=L){let lt=0;for(const Oe of He)lt+=Oe[Ye/L];Le.push({Month:Bs[Ye],Total:lt*me})}d(Le)}},Se=He=>{if(He.trackerType!==Bl.NO_TRACKER)throw new Error("static simulation is not for solar panel with tracker");let Le=l(He);if(!Le)throw new Error("parent of solar panel does not exist");const Ye=He.parentType===z.Roof,lt=He.parentType===z.Wall;if(Ye&&(Le=s(Le),!Le))throw new Error("foundation of solar panel does not exist");const Oe=a(He.pvModelName);if(!Oe)throw new Error("PV model not found");const ut=$.current.get(He.id);if(!ut)return;const ht=lt?ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,s(He),He.lz):ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,void 0,void 0,!0),Qe=Le.rotation[2];let nt=Qe+He.relativeAzimuth,mt=He.tiltAngle,tt=!0;if(Ye&&(ht.z=He.cz+He.lz+.02+Le.cz,ye.isZero(He.rotation[0])?ht.z+=He.poleHeight:(mt=He.rotation[0],nt=Qe,tt=!1)),lt&&!ye.isZero(He.tiltAngle)){const it=Le,Be=s(Le),ct=(Be?Be.rotation[2]+it.relativeAngle:it.relativeAngle)-$t,Xe=He.ly*Math.abs(Math.sin(He.tiltAngle))/2;ht.x+=Xe*Math.cos(ct),ht.y+=Xe*Math.sin(ct)}const gt=new ue().fromArray(He.normal),Ve=new cn(Ye&&!tt?0:mt,0,nt,"ZYX");gt.applyEuler(Ve);const je=N.getFullYear(),et=N.getMonth(),bt=N.getDate(),St=ye.dayOfYear(N);let Pt,Yt,zt,Rt,Ct;r.discretization===Ay.EXACT?(Pt=He.lx,Yt=He.ly,He.orientation===br.portrait?(zt=Math.max(1,Math.round(He.lx/Oe.width)),Rt=Math.max(1,Math.round(He.ly/Oe.length)),zt*=Oe.n,Rt*=Oe.m):(zt=Math.max(1,Math.round(He.lx/Oe.length)),Rt=Math.max(1,Math.round(He.ly/Oe.width)),zt*=Oe.m,Rt*=Oe.n),Ct=He.lx/zt):(Pt=He.lx,Yt=He.ly,zt=Math.max(2,Math.round(He.lx/O)),Rt=Math.max(2,Math.round(He.ly/O)),zt%2!==0&&(zt+=1),Rt%2!==0&&(Rt+=1),Ct=O);const yt=Pt/zt,at=Yt/Rt,Et=ht.x-(Pt-Ct)/2,Lt=ht.y-(Yt-Ct)/2,Je=Ye||lt?ht.z:Le.lz+He.poleHeight+He.lz,st=new _t(ht.x,ht.y),It=new ue,ot=Array.from(Array(zt),()=>new Array(Rt));Ye&&!tt&&(Ve.x=He.rotation[0],Ve.z=He.rotation[2]+Qe),lt&&(Ve.x=$t+He.tiltAngle,Ve.z=Le.relativeAngle+Qe);for(let it=0;it<24;it++)for(let Be=0;Be0){const Xe=Si(ct,St,U,hi.SPHERE_MODEL),ft=ei(r.ground,et,gt,Xe),wt=gt.dot(ct),kt=new _t,Zt=new ue;if(Oe.bifacialityFactor>0){const qt=gt.clone().negate(),rn=ei(r.ground,et,qt,Xe),Pn=ft+rn*Oe.bifacialityFactor;for(let fo=0;fo0?wt:-wt*Oe.bifacialityFactor)*Xe)}else for(let qt=0;qt0&&(kt.set(Et+qt*yt,Lt+rn*at),Zt.set(kt.x-st.x,kt.y-st.y,0),Zt.applyEuler(Ve),It.set(ht.x+Zt.x,ht.y+Zt.y,Je+Zt.z),qe(He.id,It,ct)||(ot[qt][rn]+=wt*Xe));let Ot=0;Ue(pt);const on=LUe(le.current,Oe);switch(Oe.shadeTolerance){case i8.NONE:{let qt=Number.MAX_VALUE;for(let rn=0;rn{let Le=l(He);if(!Le)throw new Error("parent of solar panel does not exist");const Ye=He.parentType===z.Roof,lt=He.parentType===z.Wall;if(Ye&&(Le=s(Le),!Le))throw new Error("foundation of solar panel does not exist");const Oe=a(He.pvModelName);if(!Oe)throw new Error("PV model not found");const ut=zi(N,r.latitude);if(ut.z<=0)return;const ht=lt?ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,s(He),He.lz):ye.absoluteCoordinates(He.cx,He.cy,He.cz,Le,void 0,void 0,!0),Qe=Le.rotation[2];let nt=He.tiltAngle,mt=Qe+(lt?0:He.relativeAzimuth),tt=!0;if(Ye&&(ht.z=He.cz+He.lz+.02+Le.cz,ye.isZero(He.rotation[0])?ht.z+=He.poleHeight:(nt=He.rotation[0],mt=Qe,tt=!1)),lt&&!ye.isZero(He.tiltAngle)){const ft=Le,wt=s(Le),Zt=(wt?wt.rotation[2]+ft.relativeAngle:ft.relativeAngle)-$t,Ot=He.ly*Math.abs(Math.sin(He.tiltAngle))/2;ht.x+=Ot*Math.cos(Zt),ht.y+=Ot*Math.sin(Zt)}const gt=new ue().fromArray(He.normal),Ve=N.getMonth(),je=ye.dayOfYear(N);let et,bt,St,Pt,Yt;r.discretization===Ay.EXACT?(et=He.lx,bt=He.ly,He.orientation===br.portrait?(St=Math.max(1,Math.round(He.lx/Oe.width)),Pt=Math.max(1,Math.round(He.ly/Oe.length)),St*=Oe.n,Pt*=Oe.m):(St=Math.max(1,Math.round(He.lx/Oe.length)),Pt=Math.max(1,Math.round(He.ly/Oe.width)),St*=Oe.m,Pt*=Oe.n),Yt=He.lx/St):(et=He.lx,bt=He.ly,St=Math.max(2,Math.round(He.lx/O)),Pt=Math.max(2,Math.round(He.ly/O)),St%2!==0&&(St+=1),Pt%2!==0&&(Pt+=1),Yt=O);const zt=et/St,Rt=bt/Pt,Ct=ht.x-(et-Yt)/2,yt=ht.y-(bt-Yt)/2,at=Ye||lt?ht.z:Le.lz+He.poleHeight+He.lz,Et=new _t(ht.x,ht.y),Lt=new ue,Je=Array.from(Array(St),()=>new Array(Pt));let st=new cn(Ye&&!tt?0:nt,0,mt,"ZYX");if(He.trackerType!==Bl.NO_TRACKER){const ft=Qe?ut.clone().applyAxisAngle(Oo,-Qe):ut.clone();switch(He.trackerType){case Bl.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const wt=new zs().setFromUnitVectors(Oo,ft);st=new cn().setFromQuaternion(wt),st.z+=mt;break}case Bl.HORIZONTAL_SINGLE_AXIS_TRACKER:{const wt=new zs().setFromUnitVectors(Oo,new ue(ft.x,0,ft.z).normalize());st=new cn().setFromQuaternion(wt),st.z+=mt;break}case Bl.VERTICAL_SINGLE_AXIS_TRACKER:{const wt=new ue(ft.x,-ft.y,0).normalize(),kt=Math.acos(Zc.dot(wt))*Math.sign(wt.x);st=new cn(He.tiltAngle,0,kt+Qe,"ZYX");break}case Bl.TILTED_SINGLE_AXIS_TRACKER:break}}if(lt&>.applyEuler(new cn(0,0,Le.relativeAngle)),gt.applyEuler(st),Ye&&!tt&&(st.x=He.rotation[0],st.z=He.rotation[2]+Qe),lt){const ft=l(He);ft&&(st.x=$t+He.tiltAngle,st.z=Le.relativeAngle+ft.rotation[2])}const It=Si(ut,je,U,hi.SPHERE_MODEL),ot=ei(r.ground,Ve,gt,It),it=gt.dot(ut),Be=new _t,pt=new ue;if(Oe.bifacialityFactor>0){const ft=gt.clone().negate(),wt=ei(r.ground,Ve,ft,It),kt=ot+wt*Oe.bifacialityFactor;for(let Zt=0;Zt0?it:-it*Oe.bifacialityFactor)*It)}else for(let ft=0;ft0&&(Be.set(Ct+ft*zt,yt+wt*Rt),pt.set(Be.x-Et.x,Be.y-Et.y,0),pt.applyEuler(st),Lt.set(ht.x+pt.x,ht.y+pt.y,at+pt.z),qe(He.id,Lt,ut)||(Je[ft][wt]+=it*It));let ct=0;switch(Oe.shadeTolerance){case i8.NONE:{let ft=Number.MAX_VALUE;for(let wt=0;wt=30?N.getHours()+1===24?0:N.getHours()+1:N.getHours();Xe[wt]+=ft*ct/(St*Pt)}},Ce=()=>{for(const He of i)if(He.type===z.SolarPanel){const Le=$.current.get(He.id);Le?Le.fill(0):$.current.set(He.id,new Array(24).fill(0))}},Te=()=>{for(const He of i)if(He.type===z.SolarPanel){const Le=ae.current.get(He.id);Le&&Le.length===E?Le.fill(0):ae.current.set(He.id,new Array(E).fill(0))}},Re=()=>{const He=de.daylight()/60;return He>Ht?k.sunshineHours[N.getMonth()]/(30*He*W):0},Ne=()=>{const He=he.current.daylight()/60;return He>Ht?k.sunshineHours[N.getMonth()]/(30*He*W):0},_e=He=>{if(!a(He.pvModelName))throw new Error("PV model not found");return He.lx*He.ly*(He.inverterEfficiency??.95)*(1-Y[N.getMonth()])},Ue=He=>{if(k){const Le=eS(He,k.lowestTemperatures,k.highestTemperatures);le.current=Zb(Le.high,Le.low,r.diurnalTemperatureModel,T,pl(He,r.latitude),ye.minutesIntoDay(He))}},qe=(He,Le,Ye)=>{if(_.current.length>1){G.current.length=0,j.set(Le,Ye);const lt=_.current.filter(Oe=>Oe.uuid!==He);return j.intersectObjects(lt,!1,G.current),G.current.length>0}return!1},Fe=()=>{const He=M.children.filter(Le=>Le.name==="Content");if(He.length>0){const Le=He[0].children;_.current.length=0;for(const Ye of Le)ye.fetchSimulationElements(Ye,_.current)}};return h.jsx(h.Fragment,{})}),tnr=xe.memo(()=>{const t=H(tu),e=H(TS),n=H(ZXe),o=H(QXe),r=H(x5e),[i,a]=g.useState("Boston MA, USA");return g.useEffect(()=>{if(Object.keys(r).length===0)return;const l=n(t,e)??"Boston MA, USA";a(l),o(l)},[t,e,r]),h.jsxs(h.Fragment,{children:[h.jsx(Otr,{city:i}),h.jsx(_tr,{city:i}),h.jsx(Vtr,{city:i}),h.jsx(Ztr,{city:i}),h.jsx(enr,{city:i}),h.jsx(Qtr,{}),h.jsx(Gtr,{city:i}),h.jsx(Xtr,{city:i}),h.jsx(Jtr,{city:i}),h.jsx(Ktr,{city:i}),h.jsx($tr,{city:i})]})}),zV="/aladdin/assets/image_fail_try_again-CaxVXMjm.png";var AN=(t=>(t[t.None=0]="None",t[t.Equal=1]="Equal",t[t.LessThan=2]="LessThan",t[t.GreaterThan=3]="GreaterThan",t[t.Between=4]="Between",t))(AN||{});const nnr=xe.memo(({yScale:t,tickLength:e,tickIntegers:n,variable:o,name:r,unit:i,type:a,digits:l,min:s,max:c,step:u,value:d,filter:f,hover:p})=>{const m=H(pn),y=H(Xp),w=H(Fn),x=H(Au),C=H(JXe),P=H(w5e),A=H(KXe),S=H(Qi),[v,b]=g.useState(!1),T=g.useRef(s),R=g.useRef(c);g.useEffect(()=>{T.current=s},[s]),g.useEffect(()=>{R.current=c},[c]);const M={lng:x},D=y.uid===C,k=t.range(),N=t(s)-t(c),U=40,W=g.useMemo(()=>{const Z=k[0]-k[1],ne=a==="number"?Math.floor(Z/e):1;return(n?t.ticks(ne).filter(q=>Number.isInteger(q)):t.ticks(ne)).map(q=>({value:q,yOffset:t(q)}))},[t,e,a,n,k]),F=()=>{m(Z=>{Z.projectState.selectedProperty=Z.projectState.selectedProperty!==o?o:null,S&&(Z.actionInfo={name:"Select Property",timestamp:new Date().getTime(),details:Z.projectState.selectedProperty})}),dt.getState().set(Z=>{Z.updateProjectsFlag=!0})},E=()=>{D&&C&&P?Vio(C,P,A!==o?o:null).then(()=>{F()}):F()},L=(Z,ne)=>h.jsx("span",{style:{display:"block",width:ne+"px"},children:Z}),j=()=>h.jsx("text",{onClick:E,x:0,y:-20,style:{fontSize:"10px",textAnchor:"middle",fill:"dimgray",cursor:"pointer",fontWeight:A===o?"bold":"normal"},children:r}),Y=g.useMemo(()=>o==="yearlyProfit"||o==="unitCost"||o==="sellingPrice"||o==="totalYearlyCost",[o]),O=()=>o==="totalYearlyCost"||o==="totalYearlyYield"||o==="meanYearlyYield"||o==="unitCost"||o==="poleHeight"||o==="interRowSpacing"?0:o==="tiltAngle"||o==="latitude"?-90:o==="rowWidth"?1:Number.MIN_SAFE_INTEGER,_=()=>o==="tiltAngle"||o==="latitude"?90:Number.MAX_SAFE_INTEGER,G=Z=>{if(Z===null)return;const ne=T.current,te={name:"Set Minimum: "+r,timestamp:Date.now(),oldValue:ne,newValue:Z,undo:()=>{Q(ne)},redo:()=>{Q(Z)}};w(te),Q(Z)},Q=Z=>{m(ne=>{if(ne.projectState.ranges){let te=-1,q=null;for(const[le,de]of ne.projectState.ranges.entries())if(de.variable===o){te=le,q=de;break}if(te>=0&&q)ne.projectState.ranges[te]={variable:q.variable,minimum:Z,maximum:q.maximum},D&&C&&y.uid&&ne.projectState.title&&Fze(y.uid,ne.projectState.title,ne.projectState.ranges).then(()=>{});else{const le={variable:o,minimum:Z,maximum:c};ne.projectState.ranges.push(le),D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,le).then(()=>{})}}else{const te={variable:o,minimum:Z,maximum:c};ne.projectState.ranges=[te],D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,te).then(()=>{})}}),T.current=Number(Z),b(!v)},oe=Z=>{if(Z===null)return;const ne=R.current,te={name:"Set Maximum: "+r,timestamp:Date.now(),oldValue:ne,newValue:Z,undo:()=>{ee(ne)},redo:()=>{ee(Z)}};w(te),ee(Z)},ee=Z=>{m(ne=>{if(ne.projectState.ranges){let te=-1,q=null;for(const[le,de]of ne.projectState.ranges.entries())if(de.variable===o){te=le,q=de;break}if(te>=0&&q)ne.projectState.ranges[te]={variable:q.variable,minimum:q.minimum,maximum:Z},D&&C&&y.uid&&ne.projectState.title&&Fze(y.uid,ne.projectState.title,ne.projectState.ranges).then(()=>{});else{const le={variable:o,minimum:s,maximum:Z};ne.projectState.ranges.push(le),D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,le).then(()=>{})}}else{const te={variable:o,minimum:s,maximum:Z};ne.projectState.ranges=[te],D&&C&&y.uid&&ne.projectState.title&&tV(y.uid,ne.projectState.title,te).then(()=>{})}}),R.current=Number(Z),b(!v)},$=Z=>{if(!f)return;const ne=[f.lowerBound,f.upperBound],te={name:"Set Filter: "+r,timestamp:Date.now(),oldValue:ne,newValue:Z,undo:()=>{ae(ne)},redo:()=>{ae(Z)}};w(te),ae(Z)},ae=Z=>{f&&(f.lowerBound=Z[0],f.upperBound=Z[1],p&&p(-1),m(ne=>{if(ne.projectState.filters){let te=-1;for(const[q,le]of ne.projectState.filters.entries())if(le.variable===o){te=q;break}if(te>=0)ne.projectState.filters[te]={variable:f.variable,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound},D&&C&&y.uid&&ne.projectState.title&&Yio(y.uid,ne.projectState.title,ne.projectState.filters).then(()=>{});else{const q={variable:o,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound};ne.projectState.filters.push(q),D&&C&&y.uid&&ne.projectState.title&&Bio(y.uid,ne.projectState.title,q).then(()=>{})}}}),b(!v))};return h.jsxs(h.Fragment,{children:[o!=="orientation"?h.jsx(zl,{content:h.jsxs("div",{children:[h.jsx(mn,{style:{width:"240px"},addonBefore:L(B.t("word.Minimum",M)+(Y?" $":""),80),addonAfter:i,min:O(),max:R.current-u,step:u,value:T.current,onPressEnter:Z=>G(Number.parseFloat(Z.target.value)),onStep:Z=>G(Z)}),h.jsx("br",{}),h.jsx(mn,{style:{width:"240px"},addonBefore:L(B.t("word.Maximum",M)+(Y?" $":""),80),addonAfter:i,min:T.current+u,max:_(),step:u,value:R.current,onPressEnter:Z=>oe(Number.parseFloat(Z.target.value)),onStep:Z=>oe(Z)})]}),children:j()}):h.jsx(h.Fragment,{children:j()}),d!==void 0&&h.jsx("text",{x:0,y:-8,style:{fontSize:"9px",textAnchor:"middle",fill:"dimgray"},children:Y?d.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:l})+(o==="yearlyProfit"||o==="totalYearlyCost"?"K":""):(o==="orientation"?B.t(d===0?"solarPanelMenu.Landscape":"solarPanelMenu.Portrait",M)+(d===0?" (▭)":" (▯)"):d.toFixed(l))+(i!==""?i:"")}),f&&f.type===AN.Between&&h.jsx("rect",{x:-5,y:t(f.upperBound??c),width:10,height:t((f==null?void 0:f.lowerBound)??s)-t((f==null?void 0:f.upperBound)??c),fill:"lightgray"}),h.jsx("rect",{x:-40/2,y:0,width:U,height:N,fill:"gold",fillOpacity:A===o?.25:0}),W.map(({value:Z,yOffset:ne})=>h.jsxs("g",{transform:`translate(0, ${ne})`,shapeRendering:"crispEdges",children:[h.jsx("line",{x1:-5,x2:0,stroke:"black",strokeWidth:1}),h.jsx("text",{style:{fontSize:"10px",textAnchor:"start",alignmentBaseline:"central",transform:"translateX(-25px)"},children:o==="orientation"?Z===0?"▭":"▯":Z},Z)]},Z)),h.jsx("line",{x1:0,x2:0,y1:t(s),y2:t(c),stroke:"black",strokeWidth:2}),f&&f.type===AN.Between&&h.jsx("foreignObject",{x:-40/2,y:4,width:U,height:N-3,children:h.jsx(n2,{theme:{components:{Slider:{railBg:"black",railSize:0,handleSize:8}}},children:h.jsx(B0,{style:{marginLeft:U/2+"px"},min:s,max:c,step:(c-s)/100,value:[f.lowerBound??s,f.upperBound??c],onChange:Z=>ae(Z),onChangeComplete:Z=>$(Z),range:!0,vertical:!0})})})]})}),aC={top:30,right:55,bottom:36,left:55},onr=["#e0ac2b","#e85252","#6689c6","#9a6fb0","#a53253","#69b3a2","#556b2f","#8b008b","#ff1493","#d2691e","#2f4f4f","#dc143c"],rnr=xe.memo(({id:t,width:e,height:n,data:o,types:r,minima:i,maxima:a,filters:l,steps:s,variables:c,titles:u,units:d,digits:f,tickIntegers:p,hover:m,hoveredIndex:y,selectedIndex:w})=>{const x=e-aC.right-aC.left,C=n-aC.top-aC.bottom,P=g.useMemo(()=>[...new Set(o.map(M=>M.group))],[o]),A=g.useMemo(()=>VR().range([0,x]).domain(c).padding(0),[c,x]),S=g.useMemo(()=>{const M={};return c.forEach((D,k)=>{M[D]=YW().range([C,0]).domain([i[k]??0,a[k]??1])}),M},[c,i,a,C]),v=g.useMemo(()=>Toe().domain(P).range(onr),[P]),b=Rwe(),T=g.useMemo(()=>o.map((M,D)=>{if(M.invisible)return null;const k=c.map(U=>{const W=S[U],F=A(U)??0,E=W(M[U]);return[F,E]}),N=b(k);if(N)return h.jsx("path",{onMouseOver:()=>{m(D)},d:N,stroke:M.hovered?"red":v(M.group),fill:"none",strokeWidth:M.excluded?.25:M.selected?3:1,strokeDasharray:M.hovered?"3,3":"none"},D)}),[o,c,A,S,v]),R=g.useMemo(()=>c.map((M,D)=>{const k=S[M];return h.jsx("g",{transform:"translate("+A(M)+",0)",children:h.jsx(nnr,{yScale:k,tickLength:40,tickIntegers:p[D],type:r[D]??"number",variable:c[D],name:u[D],unit:d[D],digits:f[D],min:i[D],max:a[D],step:s[D],value:y>=0&&!o[y].invisible?o[y][M]:w>=0&&!o[w].invisible?o[w][M]:void 0,filter:l[D],hover:m})},D)}),[c,o,A,S,p,r,u,d,f,i,a,s,l,w,y]);return h.jsx("svg",{id:t,width:e,height:n,onMouseLeave:()=>{m&&m(-1)},onContextMenu:M=>{M.stopPropagation()},children:h.jsxs("g",{width:x,height:C,transform:`translate(${[aC.left,aC.top].join(",")})`,children:[T,R]})})});var Vme={};(function(t){(function(){var e=t||!1||this||window;e.default=e;var n="http://www.w3.org/2000/xmlns/",o="http://www.w3.org/1999/xhtml",r="http://www.w3.org/2000/svg",i=']>',a=/url\(["']?(.+?)["']?\)/,l={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},s=function(k){return k instanceof HTMLElement||k instanceof SVGElement},c=function(k){if(!s(k))throw new Error("an HTMLElement or SVGElement is required; got "+k)},u=function(k){return new Promise(function(N,U){s(k)?N(k):U(new Error("an HTMLElement or SVGElement is required; got "+k))})},d=function(k){return k&&k.lastIndexOf("http",0)===0&&k.lastIndexOf(window.location.host)===-1},f=function(k){var N=Object.keys(l).filter(function(U){return k.indexOf("."+U)>0}).map(function(U){return l[U]});return N?N[0]:(console.error("Unknown font format for "+k+". Fonts may not be working correctly."),"application/octet-stream")},p=function(k){for(var N="",U=new Uint8Array(k),W=0;W"u"||W===null||isNaN(parseFloat(W))?0:W},y=function(k,N,U,W){if(k.tagName==="svg")return{width:U||m(k,N,"width"),height:W||m(k,N,"height")};if(k.getBBox){var F=k.getBBox(),E=F.x,L=F.y,j=F.width,Y=F.height;return{width:E+j,height:L+Y}}},w=function(k){return decodeURIComponent(encodeURIComponent(k).replace(/%([0-9A-F]{2})/g,function(N,U){var W=String.fromCharCode("0x"+U);return W==="%"?"%25":W}))},x=function(k){for(var N=window.atob(k.split(",")[1]),U=k.split(",")[0].split(":")[1].split(";")[0],W=new ArrayBuffer(N.length),F=new Uint8Array(W),E=0;E"u",G=L||[];return T().forEach(function(Q){var oe=Q.rules,ee=Q.href;oe&&Array.from(oe).forEach(function($){if(typeof $.style<"u")if(C(k,$.selectorText))O.push(Y($.selectorText,$.style.cssText));else if(_&&$.cssText.match(/^@font-face/)){var ae=P($,ee);ae&&G.push(ae)}else j||O.push($.cssText)})}),v(G).then(function(Q){return O.join(` +`)+Q})},M=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};e.prepareSvg=function(D,k,N){c(D);var U=k||{},W=U.left,F=W===void 0?0:W,E=U.top,L=E===void 0?0:E,j=U.width,Y=U.height,O=U.scale,_=O===void 0?1:O,G=U.responsive,Q=G===void 0?!1:G,oe=U.excludeCss,ee=oe===void 0?!1:oe;return A(D).then(function(){var $=D.cloneNode(!0);$.style.backgroundColor=(k||{}).backgroundColor||D.style.backgroundColor;var ae=y(D,$,j,Y),Z=ae.width,ne=ae.height;if(D.tagName!=="svg")if(D.getBBox){$.getAttribute("transform")!=null&&$.setAttribute("transform",$.getAttribute("transform").replace(/translate\(.*?\)/,""));var te=document.createElementNS("http://www.w3.org/2000/svg","svg");te.appendChild($),$=te}else{console.error("Attempted to render non-SVG element",D);return}if($.setAttribute("version","1.1"),$.setAttribute("viewBox",[F,L,Z,ne].join(" ")),$.getAttribute("xmlns")||$.setAttributeNS(n,"xmlns",r),$.getAttribute("xmlns:xlink")||$.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink"),Q?($.removeAttribute("width"),$.removeAttribute("height"),$.setAttribute("preserveAspectRatio","xMinYMin meet")):($.setAttribute("width",Z*_),$.setAttribute("height",ne*_)),Array.from($.querySelectorAll("foreignObject > *")).forEach(function(de){de.setAttributeNS(n,"xmlns",de.tagName==="svg"?r:o)}),ee){var q=document.createElement("div");q.appendChild($);var le=q.innerHTML;if(typeof N=="function")N(le,Z,ne);else return{src:le,width:Z,height:ne}}else return R(D,k).then(function(de){var he=document.createElement("style");he.setAttribute("type","text/css"),he.innerHTML=``;var me=document.createElement("defs");me.appendChild(he),q.insertBefore(me,q.firstChild);var ce=document.createElement("div");ce.appendChild(q);var Pe=ce.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if(typeof N=="function")N(Pe,Z,ne);else return{src:Pe,width:Z,height:ne}})})},e.svgAsDataUri=function(D,k,N){return c(D),e.prepareSvg(D,k).then(function(U){var W=U.src,F=U.width,E=U.height,L="data:image/svg+xml;base64,"+window.btoa(w(i+W));return typeof N=="function"&&N(L,F,E),L})},e.svgAsPngUri=function(D,k,N){c(D);var U=k||{},W=U.encoderType,F=W===void 0?"image/png":W,E=U.encoderOptions,L=E===void 0?.8:E,j=U.canvg,Y=function(_){var G=_.src,Q=_.width,oe=_.height,ee=document.createElement("canvas"),q=ee.getContext("2d"),ae=window.devicePixelRatio||1;ee.width=Q*ae,ee.height=oe*ae,ee.style.width=ee.width+"px",ee.style.height=ee.height+"px",q.setTransform(ae,0,0,ae,0,0),j?j(ee,G):q.drawImage(G,0,0);var Z=void 0;try{Z=ee.toDataURL(F,L)}catch(ne){if(typeof SecurityError<"u"&&ne instanceof SecurityError||ne.name==="SecurityError"){console.error("Rendered SVG images cannot be downloaded in this browser.");return}else throw ne}return typeof N=="function"&&N(Z,ee.width,ee.height),Promise.resolve(Z)};return j?e.prepareSvg(D,k).then(Y):e.svgAsDataUri(D,k).then(function(O){return new Promise(function(_,G){var Q=new Image;Q.onload=function(){return _(Y({src:Q,width:Q.width,height:Q.height}))},Q.onerror=function(){G(`There was an error loading the data URI as an image on the following SVG +]]>`;var me=document.createElement("defs");me.appendChild(he),$.insertBefore(me,$.firstChild);var ce=document.createElement("div");ce.appendChild($);var Pe=ce.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if(typeof N=="function")N(Pe,Z,ne);else return{src:Pe,width:Z,height:ne}})})},e.svgAsDataUri=function(D,k,N){return c(D),e.prepareSvg(D,k).then(function(U){var W=U.src,F=U.width,E=U.height,L="data:image/svg+xml;base64,"+window.btoa(w(i+W));return typeof N=="function"&&N(L,F,E),L})},e.svgAsPngUri=function(D,k,N){c(D);var U=k||{},W=U.encoderType,F=W===void 0?"image/png":W,E=U.encoderOptions,L=E===void 0?.8:E,j=U.canvg,Y=function(_){var G=_.src,Q=_.width,oe=_.height,ee=document.createElement("canvas"),$=ee.getContext("2d"),ae=window.devicePixelRatio||1;ee.width=Q*ae,ee.height=oe*ae,ee.style.width=ee.width+"px",ee.style.height=ee.height+"px",$.setTransform(ae,0,0,ae,0,0),j?j(ee,G):$.drawImage(G,0,0);var Z=void 0;try{Z=ee.toDataURL(F,L)}catch(ne){if(typeof SecurityError<"u"&&ne instanceof SecurityError||ne.name==="SecurityError"){console.error("Rendered SVG images cannot be downloaded in this browser.");return}else throw ne}return typeof N=="function"&&N(Z,ee.width,ee.height),Promise.resolve(Z)};return j?e.prepareSvg(D,k).then(Y):e.svgAsDataUri(D,k).then(function(O){return new Promise(function(_,G){var Q=new Image;Q.onload=function(){return _(Y({src:Q,width:Q.width,height:Q.height}))},Q.onerror=function(){G(`There was an error loading the data URI as an image on the following SVG `+window.atob(O.slice(26))+`Open the following link to see browser's diagnosis `+O)},Q.src=O})})},e.download=function(D,k,N){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(x(k),D);else{var U=document.createElement("a");if("download"in U){U.download=D,U.style.display="none",document.body.appendChild(U);try{var W=x(k),F=URL.createObjectURL(W);U.href=F,U.onclick=function(){return requestAnimationFrame(function(){return URL.revokeObjectURL(F)})}}catch(E){console.error(E),console.warn("Error while getting object URL. Falling back to string URL."),U.href=k}U.click(),document.body.removeChild(U)}else N&&N.popup&&(N.popup.document.title=D,N.popup.location.replace(k))}},e.saveSvg=function(D,k,N){var U=M();return u(D).then(function(W){return e.svgAsDataUri(W,N||{})}).then(function(W){return e.download(k,W,U)})},e.saveSvgAsPng=function(D,k,N){var U=M();return u(D).then(function(W){return e.svgAsPngUri(W,N||{})}).then(function(W){return e.download(k,W,U)})}})()})(Vme);const inr=xe.memo(({horizontalGrid:t,verticalGrid:e,symbolSize:n,changeHorizontalGrid:o,changeVerticalGrid:r,changeSymbolSize:i})=>{const a=Kt(),[l,s]=g.useState(!1),c=()=>{o==null||o(!t)},u=()=>{r==null||r(!e)},d=f=>{i==null||i(f)};return h.jsx(zl,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(NR,{min:1,max:8,value:n,onChange:d,children:B.t("menu.graph.SymbolSize",a)+":"}),h.jsx(c7,{checked:t,onClick:c,children:B.t("menu.graph.ShowHorizontalGridLines",a)}),h.jsx(c7,{checked:e,onClick:u,children:B.t("menu.graph.ShowHorizontalGridLines",a)})]}),children:h.jsx(ken,{style:{position:"absolute",fontSize:"20px",top:"10px",right:"10px",transition:"0.5s",color:l?"black":"darkgray",cursor:"pointer"},onMouseOver:()=>{s(!0)},onMouseOut:()=>{s(!1)}})})}),{TextArea:anr}=Vl,{Option:gp}=Ko,lnr=ko.div` position: relative; @@ -9835,5 +9835,5 @@ vr.version="2.29.4";JKo(Dc);vr.fn=nr;vr.min=Fqo;vr.max=Lqo;vr.now=Wqo;vr.utc=f6; justify-content: space-between; align-items: flex-start; background: white; -`,hnr=xe.memo(({relativeWidth:t,canvas:e})=>{const n=H(pn),o=H(Xp),r=dt(o5e),i=dt($Tt),a=H(Qi),l=H(Fn),s=H(CS),c=H(w5e),u=H(JXe),d=H(iCt),f=H(aCt),p=H(KXe),m=H(rCt),y=H(lCt),w=H(sCt),x=H(gCt),C=H(fCt),P=H(pCt),A=H(hCt),S=H(cCt),v=H(uCt),b=H(dCt),T=H(MQ),R=H(CQ),M=H($Xe),D=H(qXe),[k,N]=g.useState(),[U,W]=g.useState(),[F,E]=g.useState(!1),[L,j]=g.useState(!1),Y=g.useRef(!1),O=g.useRef(m??null),_=g.useRef(!1),G=g.useRef(!1),Q=g.useRef(y??$9.ALL),oe=g.useRef(!1),ee=g.useRef(d??[]),q=g.useRef(w??200),ae=g.useRef(S??"rowWidth"),Z=g.useRef(v??"rowWidth"),ne=g.useRef(b??5),te=g.useRef(!0),$=g.useRef(!0),le=g.useRef(0);g.useEffect(()=>{ae.current=S??"rowWidth"},[S]),g.useEffect(()=>{Z.current=v??"rowWidth"},[v]),g.useEffect(()=>{ne.current=b??5},[b]),g.useEffect(()=>{q.current=w??200},[w]);const{t:de}=Jl(),he=Kt(),me=o.uid===u;g.useEffect(()=>{if(ee.current=[],d){for(const fn of d)ee.current.push(fn);const Dt=p;if(Dt){const fn=C?1:-1;ee.current.sort((kn,yo)=>Dt?Dt==="rowWidth"&&"rowsPerRack"in kn&&"rowsPerRack"in yo?fn*(kn.rowsPerRack-yo.rowsPerRack):Dt==="orientation"?fn*((kn[Dt]==="Landscape"?0:1)-(yo[Dt]==="Landscape"?0:1)):Dt==="totalYearlyYield"&&"yearlyYield"in kn&&"yearlyYield"in yo?fn*(kn.yearlyYield-yo.yearlyYield):Dt==="meanYearlyYield"&&"yearlyYield"in kn&&"yearlyYield"in yo?fn*(kn.yearlyYield/kn.panelCount-yo.yearlyYield/yo.panelCount):Dt==="totalYearlyCost"?fn*(ye.calculateCost(kn)-ye.calculateCost(yo)):Dt==="yearlyProfit"?fn*(ye.calculateProfit(kn)-ye.calculateProfit(yo)):Dt in kn&&Dt in yo?fn*(kn[Dt]-yo[Dt]):0:0)}E(!F)}},[d,C,p]),g.useEffect(()=>{if(N(void 0),d){for(const Dt of d)if(Dt.title===s){N(Dt);break}}},[s,d]),g.useEffect(()=>{const Dt=()=>{E(!F)};return window.addEventListener("resize",Dt),()=>{window.removeEventListener("resize",Dt)}},[F]);const ce=()=>{dt.getState().set(Dt=>{Dt.curateDesignToProjectFlag=!0}),a&&n(Dt=>{Dt.actionInfo={name:"Curate Current Design",timestamp:new Date().getTime()}})},Pe=()=>{o.uid&&c&&k&&Uio(o.uid,c,k).then(()=>{n(Dt=>{if(Dt.projectState.designs){let fn=-1;for(const[kn,yo]of Dt.projectState.designs.entries())if(yo.title===k.title){fn=kn;break}fn>=0&&(Dt.projectState.designs.splice(fn,1),a&&(Dt.actionInfo={name:"Remove Selected Design",timestamp:new Date().getTime(),details:k.title}))}})})},pe=Dt=>{e&&o.uid&&c&&s&&Zio(o.uid,f,c,w??200,s,e).then(()=>{Dt&&Dt(),E(!F),a&&n(fn=>{fn.actionInfo={name:"Update Selected Design",timestamp:new Date().getTime(),details:{design:s}}})})},Ie=window.innerHeight,ve=Math.round(800/q.current),ze=48/ve,Ae=Math.round(t*window.innerWidth/ve-ze),[se,ge,we,Se,Me,Ce]=g.useMemo(()=>[Td.getVariables(f,x??[]),Td.getTitles(f,he,x??[]),Td.getUnits(f,he,x??[]),Td.getDigits(f,x??[]),Td.getTickIntegers(f,x??[]),Td.getTypes(f,x??[])],[f,x,L,he]),Te=g.useMemo(()=>{const Dt=[];if(d&&f===Pi.SOLAR_PANEL_ARRAY)for(const fn of d){const kn={};if(x!=null&&x.includes("rowWidth")||(kn.rowWidth=fn.rowsPerRack),x!=null&&x.includes("tiltAngle")||(kn.tiltAngle=ye.toDegrees(fn.tiltAngle)),x!=null&&x.includes("interRowSpacing")||(kn.interRowSpacing=fn.interRowSpacing),x!=null&&x.includes("latitude")||(kn.latitude=fn.latitude??42),x!=null&&x.includes("orientation")||(kn.orientation=fn.orientation===br.landscape?0:1),x!=null&&x.includes("poleHeight")||(kn.poleHeight=fn.poleHeight),x!=null&&x.includes("unitCost")||(kn.unitCost=fn.unitCost),x!=null&&x.includes("sellingPrice")||(kn.sellingPrice=fn.sellingPrice),x!=null&&x.includes("")||(kn.totalYearlyCost=ye.calculateCost(fn)),x!=null&&x.includes("totalYearlyYield")||(kn.totalYearlyYield=fn.yearlyYield*.001),x!=null&&x.includes("meanYearlyYield")||(kn.meanYearlyYield=fn.yearlyYield/fn.panelCount),x!=null&&x.includes("yearlyProfit")||(kn.yearlyProfit=ye.calculateProfit(fn)),kn.group=y===$9.INDIVIDUALS?fn.title:"default",kn.selected=k===fn,kn.hovered=U===fn,kn.invisible=fn.invisible,kn.excluded=!1,A){for(const yo of A)if(yo.type===AN.Between&&yo.upperBound!==void 0&&yo.lowerBound!==void 0){const ur=kn[yo.variable];if(typeof ur=="number"&&(ur>yo.upperBound||ur{n(Dt=>{if(Dt.projectState.designs)for(const[fn,kn]of Dt.projectState.designs.entries())kn.excluded=Te[fn].excluded})},[Te]);const Re=(Dt,fn)=>{let kn=fn;if(P){for(const yo of P)if(yo.variable===Dt){kn=yo.minimum??fn;break}}return kn},Ne=(Dt,fn)=>{let kn=fn;if(P){for(const yo of P)if(yo.variable===Dt){kn=yo.maximum??fn;break}}return kn},_e=g.useMemo(()=>{if(f===Pi.SOLAR_PANEL_ARRAY&&T){const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(Re("rowWidth",T.minimumRowsPerRack)),x!=null&&x.includes("tiltAngle")||Dt.push(Re("tiltAngle",ye.toDegrees(T.minimumTiltAngle))),x!=null&&x.includes("interRowSpacing")||Dt.push(Re("interRowSpacing",T.minimumInterRowSpacing)),x!=null&&x.includes("latitude")||Dt.push(Re("latitude",-90)),x!=null&&x.includes("orientation")||Dt.push(0),x!=null&&x.includes("poleHeight")||Dt.push(Re("poleHeight",0)),x!=null&&x.includes("unitCost")||Dt.push(Re("unitCost",.1)),x!=null&&x.includes("sellingPrice")||Dt.push(Re("sellingPrice",.1)),x!=null&&x.includes("totalYearlyCost")||Dt.push(Re("totalYearlyCost",0)),x!=null&&x.includes("totalYearlyYield")||Dt.push(Re("totalYearlyYield",0)),x!=null&&x.includes("meanYearlyYield")||Dt.push(Re("meanYearlyYield",0)),x!=null&&x.includes("yearlyProfit")||Dt.push(Re("yearlyProfit",-10)),Dt}return[]},[T,f,P,x,L]),Ue=g.useMemo(()=>{if(f===Pi.SOLAR_PANEL_ARRAY&&T){const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(Ne("rowWidth",T.maximumRowsPerRack)),x!=null&&x.includes("tiltAngle")||Dt.push(Ne("tiltAngle",ye.toDegrees(T.maximumTiltAngle))),x!=null&&x.includes("interRowSpacing")||Dt.push(Ne("interRowSpacing",T.maximumInterRowSpacing)),x!=null&&x.includes("latitude")||Dt.push(Ne("latitude",90)),x!=null&&x.includes("orientation")||Dt.push(1),x!=null&&x.includes("poleHeight")||Dt.push(Ne("poleHeight",5)),x!=null&&x.includes("unitCost")||Dt.push(Ne("unitCost",1)),x!=null&&x.includes("sellingPrice")||Dt.push(Ne("sellingPrice",.5)),x!=null&&x.includes("totalYearlyCost")||Dt.push(Ne("totalYearlyCost",100)),x!=null&&x.includes("totalYearlyYield")||Dt.push(Ne("totalYearlyYield",100)),x!=null&&x.includes("meanYearlyYield")||Dt.push(Ne("meanYearlyYield",1e3)),x!=null&&x.includes("yearlyProfit")||Dt.push(Ne("yearlyProfit",10)),Dt}return[]},[T,f,P,x,L]),qe=(Dt,fn)=>{let kn=fn;if(A){for(const yo of A)if(yo.variable===Dt){kn=yo.lowerBound??fn;break}}return kn},Fe=(Dt,fn)=>{let kn=fn;if(A){for(const yo of A)if(yo.variable===Dt){kn=yo.upperBound??fn;break}}return kn},He=(Dt,fn,kn)=>({variable:Dt,type:AN.Between,upperBound:Fe(Dt,fn),lowerBound:qe(Dt,kn)}),Le=g.useMemo(()=>{const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(He("rowWidth",T.maximumRowsPerRack,T.minimumRowsPerRack)),x!=null&&x.includes("tiltAngle")||Dt.push(He("tiltAngle",ye.toDegrees(T.maximumTiltAngle),ye.toDegrees(T.minimumTiltAngle))),x!=null&&x.includes("interRowSpacing")||Dt.push(He("interRowSpacing",T.maximumInterRowSpacing,T.minimumInterRowSpacing)),x!=null&&x.includes("latitude")||Dt.push(He("latitude",90,-90)),x!=null&&x.includes("orientation")||Dt.push(He("orientation",1,0)),x!=null&&x.includes("poleHeight")||Dt.push(He("poleHeight",5,0)),x!=null&&x.includes("unitCost")||Dt.push(He("unitCost",1,.1)),x!=null&&x.includes("sellingPrice")||Dt.push(He("sellingPrice",.5,.1)),x!=null&&x.includes("totalYearlyCost")||Dt.push(He("totalYearlyCost",100,0)),x!=null&&x.includes("totalYearlyYield")||Dt.push(He("totalYearlyYield",100,0)),x!=null&&x.includes("meanYearlyYield")||Dt.push(He("meanYearlyYield",1e3,0)),x!=null&&x.includes("yearlyProfit")||Dt.push(He("yearlyProfit",10,-10)),Dt},[L,A,x]),Ye=g.useMemo(()=>{if(f===Pi.SOLAR_PANEL_ARRAY&&T){const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(1),x!=null&&x.includes("tiltAngle")||Dt.push(.1),x!=null&&x.includes("interRowSpacing")||Dt.push(.1),x!=null&&x.includes("latitude")||Dt.push(.1),x!=null&&x.includes("orientation")||Dt.push(1),x!=null&&x.includes("poleHeight")||Dt.push(.1),x!=null&&x.includes("unitCost")||Dt.push(.01),x!=null&&x.includes("sellingPrice")||Dt.push(.01),x!=null&&x.includes("totalYearlyCost")||Dt.push(.1),x!=null&&x.includes("totalYearlyYield")||Dt.push(1),x!=null&&x.includes("meanYearlyYield")||Dt.push(1),x!=null&&x.includes("yearlyProfit")||Dt.push(.1),Dt}return[]},[f,x,L]),lt=g.useRef(!(x!=null&&x.includes("rowWidth"))),Oe=g.useRef(!(x!=null&&x.includes("tiltAngle"))),ut=g.useRef(!(x!=null&&x.includes("interRowSpacing"))),ht=g.useRef(!(x!=null&&x.includes("latitude"))),Qe=g.useRef(!(x!=null&&x.includes("orientation"))),nt=g.useRef(!(x!=null&&x.includes("poleHeight"))),mt=g.useRef(!(x!=null&&x.includes("unitCost"))),tt=g.useRef(!(x!=null&&x.includes("sellingPrice"))),gt=g.useRef(!(x!=null&&x.includes("totalYearlyCost"))),Ve=g.useRef(!(x!=null&&x.includes("totalYearlyYield"))),je=g.useRef(!(x!=null&&x.includes("meanYearlyYield"))),et=g.useRef(!(x!=null&&x.includes("yearlyProfit")));g.useEffect(()=>{lt.current=!(x!=null&&x.includes("rowWidth")),Oe.current=!(x!=null&&x.includes("tiltAngle")),ut.current=!(x!=null&&x.includes("interRowSpacing")),ht.current=!(x!=null&&x.includes("latitude")),Qe.current=!(x!=null&&x.includes("orientation")),nt.current=!(x!=null&&x.includes("poleHeight")),mt.current=!(x!=null&&x.includes("unitCost")),tt.current=!(x!=null&&x.includes("sellingPrice")),gt.current=!(x!=null&&x.includes("totalYearlyCost")),Ve.current=!(x!=null&&x.includes("totalYearlyYield")),je.current=!(x!=null&&x.includes("meanYearlyYield")),et.current=!(x!=null&&x.includes("yearlyProfit")),E(!F)},[x]),g.useEffect(()=>{O.current=m},[m]);const bt=Dt=>{d&&(Dt>=0&&Dt{n(fn=>{if(fn.projectState.designs){for(const kn of fn.projectState.designs)if(kn.title===Dt){kn.invisible=!kn.invisible;break}}})},Pt=Dt=>{me?o.uid&&c&&Qio(o.uid,c,Dt).then(()=>{St(Dt.title)}):St(Dt.title)},Yt=Dt=>{const fn={name:"Select Design Visibility",timestamp:Date.now(),checked:!!Dt.invisible,property:Dt.title,undo:()=>{Pt(Dt)},redo:()=>{Pt(Dt)}};l(fn),Pt(Dt)},zt=(Dt,fn)=>{n(kn=>{kn.projectState.hiddenParameters&&(Dt?kn.projectState.hiddenParameters.includes(fn)&&kn.projectState.hiddenParameters.splice(kn.projectState.hiddenParameters.indexOf(fn),1):kn.projectState.hiddenParameters.includes(fn)||kn.projectState.hiddenParameters.push(fn))})},Rt=(Dt,fn)=>{oe.current=!0,me?o.uid&&c&&jio(o.uid,c,fn,!Dt).then(()=>{zt(Dt,fn)}):zt(Dt,fn)},Ct=(Dt,fn)=>{const kn={name:"Select Parameter",timestamp:Date.now(),checked:Dt,property:fn,undo:()=>{Rt(!Dt,fn)},redo:()=>{Rt(Dt,fn)}};l(kn),Rt(Dt,fn)},yt=()=>{n(Dt=>{Dt.projectState.dataColoring=Q.current}),dt.getState().set(Dt=>{Dt.updateProjectsFlag=!0}),E(!F)},at=Dt=>{Q.current=Dt,me?o.uid&&c&&_io(o.uid,c,Q.current).then(()=>{yt()}):yt()},Et=Dt=>{const fn={name:"Select Data Coloring",timestamp:Date.now(),oldValue:y,newValue:Dt,undo:()=>{at(y)},redo:()=>{at(Dt)}};l(fn),at(Dt)},Lt=()=>h.jsxs("div",{children:[h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{lt.current=Dt.target.checked,Ct(lt.current,"rowWidth"),j(!L)},checked:lt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowWidth",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{Oe.current=Dt.target.checked,Ct(Oe.current,"tiltAngle"),j(!L)},checked:Oe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTiltAngle",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{ut.current=Dt.target.checked,Ct(ut.current,"interRowSpacing"),j(!L)},checked:ut.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowSpacing",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{ht.current=Dt.target.checked,Ct(ht.current,"latitude"),j(!L)},checked:ht.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Latitude",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{Qe.current=Dt.target.checked,Ct(Qe.current,"orientation"),j(!L)},checked:Qe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayOrientation",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{nt.current=Dt.target.checked,Ct(nt.current,"poleHeight"),j(!L)},checked:nt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayPoleHeight",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{mt.current=Dt.target.checked,Ct(mt.current,"unitCost"),j(!L)},checked:mt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.UnitCost",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{tt.current=Dt.target.checked,Ct(tt.current,"sellingPrice"),j(!L)},checked:tt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.SellingPrice",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{gt.current=Dt.target.checked,Ct(gt.current,"totalYearlyCost"),j(!L)},checked:gt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyCost",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{Ve.current=Dt.target.checked,Ct(Ve.current,"totalYearlyYield"),j(!L)},checked:Ve.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyYield",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{je.current=Dt.target.checked,Ct(je.current,"meanYearlyYield"),j(!L)},checked:je.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayMeanYearlyYield",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{et.current=Dt.target.checked,Ct(et.current,"yearlyProfit"),j(!L)},checked:et.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayYearlyProfit",he)})})]}),Je=()=>h.jsxs(h.Fragment,{children:[h.jsx(gp,{value:"rowWidth",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowWidth",he)})},"rowWidth"),h.jsx(gp,{value:"tiltAngle",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTiltAngle",he)})},"tiltAngle"),h.jsx(gp,{value:"interRowSpacing",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowSpacing",he)})},"interRowSpacing"),h.jsx(gp,{value:"latitude",children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Latitude",he)})},"latitude"),h.jsx(gp,{value:"orientation",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayOrientation",he)})},"orientation"),h.jsx(gp,{value:"poleHeight",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayPoleHeight",he)})},"poleHeight"),h.jsx(gp,{value:"unitCost",children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.UnitCost",he)})},"unitCost"),h.jsx(gp,{value:"sellingPrice",children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.SellingPrice",he)})},"sellingPrice"),h.jsx(gp,{value:"totalYearlyCost",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyCost",he)})},"totalYearlyCost"),h.jsx(gp,{value:"totalYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyYield",he)})},"totalYearlyYield"),h.jsx(gp,{value:"meanYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayMeanYearlyYield",he)})},"meanYearlyYield"),h.jsx(gp,{value:"yearlyProfit",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayYearlyProfit",he)})},"yearlyProfit")]}),st=g.useMemo(()=>{const Dt=[];if(d&&f===Pi.SOLAR_PANEL_ARRAY)for(const fn of d){if(fn.invisible||fn===k)continue;const kn={};Td.setScatterData(ae.current,"x",kn,fn),Td.setScatterData(Z.current,"y",kn,fn),Dt.push(kn)}return Dt},[ae.current,Z.current,d,f,k]),It=g.useMemo(()=>{const Dt=[];if(d&&f===Pi.SOLAR_PANEL_ARRAY)for(const fn of d){if(fn!==k)continue;const kn={};Td.setScatterData(ae.current,"x",kn,fn),Td.setScatterData(Z.current,"y",kn,fn),Dt.push(kn)}return Dt},[ae.current,Z.current,d,f,k]),ot=Dt=>{const fn={min:0,max:1};if(f===Pi.SOLAR_PANEL_ARRAY&&T)switch(Dt){case"rowWidth":fn.min=Re("rowWidth",T.minimumRowsPerRack),fn.max=Ne("rowWidth",T.maximumRowsPerRack);break;case"tiltAngle":fn.min=Re("tiltAngle",ye.toDegrees(T.minimumTiltAngle)),fn.max=Ne("tiltAngle",ye.toDegrees(T.maximumTiltAngle));break;case"interRowSpacing":fn.min=Re("interRowSpacing",T.minimumInterRowSpacing),fn.max=Ne("interRowSpacing",T.maximumInterRowSpacing);break;case"latitude":fn.min=Re("latitude",-90),fn.max=Ne("latitude",90);break;case"orientation":fn.min=0,fn.max=1;break;case"poleHeight":fn.min=Re("poleHeight",0),fn.max=Ne("poleHeight",5);break;case"unitCost":fn.min=Re("unitCost",.1),fn.max=Ne("unitCost",1);break;case"sellingPrice":fn.min=Re("sellingPrice",.1),fn.max=Ne("sellingPrice",.5);break;case"totalYearlyCost":fn.min=Re("totalYearlyCost",0),fn.max=Ne("totalYearlyCost",100);break;case"totalYearlyYield":fn.min=Re("totalYearlyYield",0),fn.max=Ne("totalYearlyYield",100);break;case"meanYearlyYield":fn.min=Re("meanYearlyYield",0),fn.max=Ne("meanYearlyYield",1e3);break;case"yearlyProfit":fn.min=Re("yearlyProfit",-10),fn.max=Ne("yearlyProfit",10);break}return fn},it=g.useMemo(()=>ot(ae.current),[ae.current,P]),Be=g.useMemo(()=>ot(Z.current),[Z.current,P]),pt=g.useMemo(()=>Td.getUnit(ae.current,he),[ae.current,he]),ct=g.useMemo(()=>Td.getUnit(Z.current,he),[Z.current,he]),Xe=Dt=>{const fn=ae.current,kn={name:"Change X Axis",timestamp:Date.now(),oldValue:fn,newValue:Dt,undo:()=>{ft(fn)},redo:()=>{ft(Dt)}};l(kn),ft(Dt)},ft=Dt=>{ae.current=Dt,me&&o.uid&&c&&Gio(o.uid,c,Dt).then(()=>{}),E(!F)},wt=Dt=>{const fn=Z.current,kn={name:"Change Y Axis",timestamp:Date.now(),oldValue:fn,newValue:Dt,undo:()=>{kt(fn)},redo:()=>{kt(Dt)}};l(kn),kt(Dt)},kt=Dt=>{Z.current=Dt,me&&o.uid&&c&&Xio(o.uid,c,Dt).then(()=>{}),E(!F)},Zt=()=>h.jsxs("div",{style:{width:"280px"},children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[de("projectPanel.SelectXAxis",he),": "]})}),h.jsx(Ge,{span:16,children:h.jsx(Ko,{style:{width:"100%"},value:ae.current,onChange:Dt=>Xe(Dt),children:Je()})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ge,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[de("projectPanel.SelectYAxis",he),": "]})}),h.jsx(Ge,{span:16,children:h.jsx(Ko,{style:{width:"100%"},value:Z.current,onChange:Dt=>wt(Dt),children:Je()})})]}),h.jsx(Qt,{style:{paddingBottom:"8px"},children:h.jsxs("div",{children:[h.jsxs(IKo,{id:"scatter-chart",width:280,height:240,margin:{top:0,right:0,bottom:-10,left:-10},children:[h.jsx(A7,{strokeWidth:"1",stroke:"gray",horizontal:te.current,vertical:$.current}),h.jsx(B1,{dataKey:"x",fontSize:10,type:"number",domain:[it.min,it.max],name:"x",unit:pt,strokeWidth:1,stroke:"gray",tickFormatter:(Dt,fn)=>ae.current==="yearlyProfit"||ae.current==="unitCost"||ae.current==="sellingPrice"?"$"+Dt:Dt}),h.jsx(Lh,{dataKey:"y",fontSize:10,type:"number",domain:[Be.min,Be.max],name:"y",unit:ct,strokeWidth:1,stroke:"gray",tickFormatter:(Dt,fn)=>Z.current==="yearlyProfit"||Z.current==="unitCost"||Z.current==="sellingPrice"?"$"+Dt:Dt}),h.jsx(yh,{cursor:{strokeDasharray:"3 3"},formatter:Dt=>Dt.toFixed(2)}),h.jsx(yS,{name:"All",data:st,fill:"#8884d8",shape:h.jsx(kj,{fill:"#8884d8",r:ne.current})}),k&&h.jsx(yS,{name:"Selected",data:It,fill:"red",shape:"star"})]}),h.jsx(inr,{symbolSize:ne.current,horizontalGrid:te.current,verticalGrid:$.current,changeHorizontalGrid:Dt=>{te.current=Dt,E(!F)},changeVerticalGrid:Dt=>{$.current=Dt,E(!F)},changeSymbolSize:Dt=>{ne.current=Dt,me&&o.uid&&c&&Jio(o.uid,c,Dt).then(()=>{}),E(!F)}})]})}),h.jsx(Qt,{children:h.jsx("span",{style:{width:"100%",textAlign:"center"},children:h.jsx(nd,{style:{fontSize:"18px",color:"gray",paddingRight:"8px"},title:de("projectPanel.ScatterPlotScreenshot",he),onClick:()=>{const Dt=document.getElementById("scatter-chart");Dt&&Vme.saveSvgAsPng(Dt,"scatter-chart-"+c+".png").then(()=>{yn(de("message.ScreenshotSaved",he)),a&&n(fn=>{fn.actionInfo={name:"Scatter chart screenshot",timestamp:new Date().getTime(),details:{image:"scatter-chart-"+c+".png"}}})})}})})})]}),Ot=()=>h.jsx("div",{children:h.jsxs(We.Group,{onChange:Dt=>{Et(Dt.target.value)},value:y??$9.ALL,children:[h.jsx(We,{style:{fontSize:"12px",width:"100%"},value:$9.ALL,children:de("projectPanel.SameColorForAllDesigns",he)}),h.jsx("br",{}),h.jsx(We,{style:{fontSize:"12px",width:"100%"},value:$9.INDIVIDUALS,children:de("projectPanel.OneColorForEachDesign",he)})]})}),on=()=>h.jsx("div",{style:{width:"250px"},onClick:Dt=>Dt.stopPropagation(),children:h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[de("projectPanel.ThumbnailImageSize",he),": "]})}),h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"100%"},value:q.current,onChange:Dt=>{q.current=Dt,me?o.uid&&c&&Kio(o.uid,c,Dt).then(()=>{n(fn=>{fn.projectState.thumbnailWidth=q.current})}):n(fn=>{fn.projectState.thumbnailWidth=q.current}),E(!F)},children:[h.jsx(gp,{value:100,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Small",he)})},"small-thumbnail"),h.jsx(gp,{value:125,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Medium",he)})},"medium-thumbnail"),h.jsx(gp,{value:200,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Large",he)})},"large-thumbnail")]})})]})}),qt=[{key:"1",label:h.jsxs(unr,{children:[h.jsx("span",{children:de("projectPanel.ProjectDescription",he)+" | "+de("projectPanel.ProjectType",he)+": "+f}),h.jsxs("span",{children:[me&&h.jsxs(h.Fragment,{children:[G.current&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),Y.current=!Y.current,E(!F)},children:Y.current?h.jsx($Zt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.MakeDescriptionNonEditable",he)}):h.jsx(htt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.MakeDescriptionEditable",he)})}),h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),ce()},children:h.jsx(ben,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.CurateCurrentDesign",he)})}),k&&k.title===s&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),pe()},children:h.jsx(WZt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.UpdateSelectedDesign",he)})}),k&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),Pe(),N(void 0)},children:h.jsx(ftt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.RemoveSelectedDesign",he)})}),k&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{if(Dt.stopPropagation(),c){let fn=k1+"?client=web&userid="+o.uid+"&project="+encodeURIComponent(c);k&&(fn+="&title="+encodeURIComponent(k.title)),navigator.clipboard.writeText(fn).then(()=>d5(de("projectListPanel.ProjectLinkGeneratedInClipBoard",he)+".")),a&&n(kn=>{kn.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:fn}})}},children:h.jsx(Hen,{style:{fontSize:"24px",color:"gray"},title:de("projectListPanel.GenerateProjectLink",he)})})]}),d&&d.length>1&&p&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),n(fn=>{fn.projectState.sortDescending=!fn.projectState.sortDescending,a&&(fn.actionInfo={name:"Sort Design",timestamp:new Date().getTime(),details:{descending:!fn.projectState.sortDescending}})})},children:C?h.jsx(etn,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.ClickToFlipSortingOrder",he)}):h.jsx(otn,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.ClickToFlipSortingOrder",he)})}),h.jsx(zl,{title:h.jsx("div",{onClick:Dt=>Dt.stopPropagation(),children:de("projectPanel.ProjectSettings",he)}),content:on,children:h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>Dt.stopPropagation(),children:h.jsx(qen,{style:{fontSize:"24px",color:"gray"}})})})]})]}),children:h.jsx(anr,{title:Y.current?void 0:de("projectPanel.DoubleClickToMakeDescriptionEditable",he),readOnly:!Y.current,value:O.current??void 0,onDoubleClick:()=>{Y.current=!Y.current,E(!F)},onChange:Dt=>{O.current=Dt.target.value,_.current=!0,n(fn=>{fn.projectState.description=Dt.target.value}),E(!F)},onBlur:()=>{Y.current=!1,_.current&&o.uid&&me&&c&&Oio(o.uid,c,O.current).then(()=>{_.current=!1,E(!F)})},style:{paddingLeft:"10px",textAlign:"left",resize:Y.current?"vertical":"none",border:Y.current?"1px solid gray":"none"}})}],rn=Dt=>{N(Dt),u&&mK(u,Dt.title,!0,!0).then(()=>{a&&n(fn=>{fn.actionInfo={name:"Open Design",timestamp:new Date().getTime(),details:Dt.title}})})},Pn=Dt=>{if(r&&i)if(M()){const fn=li.confirm({title:de("message.DoYouWantToUpdateDesign",he),icon:h.jsx(t4,{}),footer:h.jsxs(Jt,{direction:"horizontal",style:{marginTop:"10px",width:"100%",justifyContent:"end"},children:[h.jsx(oo,{onClick:()=>{pe(()=>{rn(Dt),fn.destroy()})},children:de("word.Yes",he)},"Yes"),h.jsx(oo,{onClick:()=>{rn(Dt),dt.getState().set(kn=>{kn.confirmOpeningDesign=!1}),fn.destroy()},children:de("word.NoAndDoNotAskAgain",he)},"NoAndDoNotShowAgain"),h.jsx(oo,{type:"primary",onClick:()=>{rn(Dt),fn.destroy()},children:de("word.No",he)},"No")]})})}else li.confirm({title:de("message.DoYouWantToSaveChanges",he),icon:h.jsx(t4,{}),onOk:()=>{s?dt.getState().setSaveCloudFileFlag(!0):n(fn=>{fn.showCloudFileTitleDialogFlag=!fn.showCloudFileTitleDialogFlag,fn.showCloudFileTitleDialog=!0})},onCancel:()=>{rn(Dt)},okText:de("word.Yes",he),cancelText:de("word.No",he)});else rn(Dt)},fo=(Dt,fn)=>{const kn=Dt.target;kn.src===zV&&(kn.src=fn.thumbnailUrl),N(fn!==k?fn:void 0),a&&n(yo=>{yo.actionInfo={name:fn!==k?"Select Design":"Deselect Design",timestamp:new Date().getTime(),details:fn==null?void 0:fn.title}})},to=(Dt,fn)=>{const kn=Dt.target;kn.src===zV&&(kn.src=fn.thumbnailUrl),Pn(fn)};return h.jsx(lnr,{onContextMenu:Dt=>{Dt.stopPropagation()},children:h.jsxs(snr,{children:[h.jsxs(cnr,{children:[h.jsx("span",{children:de(me?"projectPanel.Project":"projectPanel.ProjectByOtherPeople",he)+": "+c+(me?"":" ("+de("word.Owner",he)+": "+(u==null?void 0:u.substring(0,4))+"***)")+" ("+ee.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{D(),N(void 0)},onTouchStart:()=>{D(),N(void 0)},children:h.jsx(i6,{title:de("word.Close",he)})})]}),h.jsx(r9e,{items:qt,style:{backgroundColor:"white",border:"none"},onChange:Dt=>{G.current=Dt.length>0,E(!F)}}),ee.current.length>0&&h.jsxs(fnr,{children:[h.jsx(WL,{style:{width:"100%",height:Ie/2-(G.current?160:80),paddingLeft:"4px",paddingRight:"4px",overflowX:"hidden",overflowY:"auto"},grid:{column:ve,gutter:1},dataSource:ee.current,renderItem:Dt=>{var yo;const fn=Dt.title.lastIndexOf(" "),kn=w===100?8:w===125?12:30;return h.jsxs(WL.Item,{style:{marginBottom:"-28px"},onMouseOver:()=>{W(Dt)},onMouseLeave:()=>{W(void 0)},children:[h.jsx("img",{loading:"eager",width:Ae+"px",height:"auto",onError:ur=>{ur.target.src=zV},onLoad:ur=>{n(lr=>{lr.projectImages.set(Dt.title,ur.target)}),dt.getState().set(lr=>{lr.projectImagesUpdateFlag=!lr.projectImagesUpdateFlag})},alt:Dt.title,title:(Dt.timestamp?de("word.LastUpdate",he)+": "+il(new Date(Dt.timestamp)).format("MM-DD-YYYY hh:mm A")+` -`:"")+de(k===Dt?"projectPanel.SingleClickToDeselectDoubleClickToOpen":"projectPanel.SingleClickToSelectDoubleClickToOpen",he),src:(yo=Dt.thumbnail)!=null&&yo.startsWith("data:image/png;base64")?Dt.thumbnail:zV,style:{transition:".5s ease",opacity:Dt.excluded?.25:U===Dt?.5:1,padding:"1px",cursor:"pointer",borderRadius:k===Dt?"0":"10px",border:k===Dt?"2px solid red":"none"},onClick:ur=>{ur.detail===1&&setTimeout(()=>{Date.now()-le.current>=300&&fo(ur,Dt)},300),ur.detail===2&&(le.current=Date.now(),to(ur,Dt))}}),h.jsx("div",{style:{position:"relative",left:"10px",textAlign:"left",bottom:"18px",color:"white",fontSize:"8px",fontWeight:Dt.title===s?"bold":"normal"},children:Dt.title?Dt.title.length>kn?Dt.title.substring(0,Math.min(kn,fn))+"..."+Dt.title.substring(fn):Dt.title:"Unknown"}),h.jsxs("div",{style:{position:"relative",right:"10px",textAlign:"right",bottom:"36px",color:"white"},children:[Dt.title===s&&h.jsx(gtt,{style:{paddingRight:"4px",fontSize:"16px"}}),Dt.invisible?h.jsx(kZt,{onClick:()=>{Yt(Dt)},style:{fontSize:"16px"},title:de("projectPanel.DesignNotShownInSolutionSpaceClickToShow",he)}):h.jsx(K5e,{onClick:()=>{Yt(Dt)},style:{fontSize:"16px"},title:de("projectPanel.DesignShownInSolutionSpaceClickToHide",he)})]})]})}}),h.jsxs(dnr,{children:[h.jsx("span",{style:{paddingLeft:"20px"},children:de("projectPanel.SolutionSpace",he)}),h.jsxs("span",{children:[f===Pi.SOLAR_PANEL_ARRAY&&h.jsx(zl,{title:de("projectPanel.ChooseSolutionSpace",he),onOpenChange:Dt=>{oe.current&&(Dt||dt.getState().set(fn=>{fn.updateProjectsFlag=!0}),oe.current=!1)},content:Lt(),children:h.jsx(oo,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(zZt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(zl,{title:de("projectPanel.ChooseDataColoring",he),content:Ot(),children:h.jsx(oo,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(mZt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(zl,{title:de("projectPanel.GenerateScatterPlot",he),content:Zt(),children:h.jsx(oo,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(_Zt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(oo,{style:{border:"none",paddingRight:"20px",background:"white"},onClick:()=>{const Dt=document.getElementById("design-space");Dt&&Vme.saveSvgAsPng(Dt,"design-space-"+c+".png").then(()=>{yn(de("message.ScreenshotSaved",he)),a&&n(fn=>{fn.actionInfo={name:"Solution space screenshot",timestamp:new Date().getTime(),details:{image:"design-space-"+c+".png"}}})})},children:h.jsx(nd,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.SolutionSpaceScreenshot",he)})})]})]}),h.jsx(rnr,{id:"design-space",width:t*window.innerWidth,height:Ie/2-120,data:Te,types:Ce,minima:_e,maxima:Ue,filters:Le,steps:Ye,variables:se,titles:ge,units:we,digits:Se,tickIntegers:Me,hover:bt,hoveredIndex:d&&U?d.indexOf(U):-1,selectedIndex:d&&k?d.indexOf(k):-1})]})]})})}),pnr=new _t,Hw=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=g.useState(ll);return h.jsx(di,{name:e,args:[i,i,i],position:[n,o,r],onPointerOver:()=>l(Aa),onPointerOut:()=>l(ll),children:h.jsx("meshStandardMaterial",{color:a})})},DV=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=g.useState(ll);return h.jsx(Ys,{name:e,args:[i],position:[n,o,r],onPointerOver:()=>l(Aa),onPointerOut:()=>l(ll),children:h.jsx("meshStandardMaterial",{color:a})})},WUe=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=g.useState(ll),s=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]);return h.jsxs("group",{name:e,position:[n,o,r],rotation:[$t,0,0],onPointerOver:()=>l(Aa),onPointerOut:()=>l(ll),scale:i*4,children:[h.jsxs("group",{children:[h.jsx(O2e,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[$t,0,$t],children:s}),h.jsx(Rf,{args:[.1,.1,6],rotation:[$t,0,0],position:[.15,0,.05],children:s}),h.jsx(fH,{args:[.05,6],rotation:[0,$t,0],position:[0,0,.15],children:s})]}),h.jsx(yi,{name:e,args:[.35,.35],position:[0,.05,0],rotation:[-$t,0,0],visible:!1})]})},gnr=xe.memo(({groupedElementsIdSet:t,childCuboidSet:e,initialPosition:n,initialDimension:o,initialRotation:r})=>{const[i,a,l]=n,[s,c,u]=o,d=s===0?1:c/s,f=t.size>1||e.size>0,p=g.useRef(null),m=g.useRef(new ue),y=g.useRef(new cn),w=g.useRef(new _t),x=g.useRef(new Map),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new ue),M=g.useRef(!1),D=g.useRef(new Map),k=g.useRef(new Map),N=g.useRef(new Map),U=g.useRef(new Map),W=g.useRef(new Map),[F,E]=g.useState(new ue(i,a,l)),[L,j]=g.useState(r),[Y,O]=g.useState(s/2),[_,G]=g.useState(c/2),[Q,oe]=g.useState(u),[ee,q]=g.useState(!1),[ae,Z]=g.useState("Null"),{get:ne}=ti(),te=g.useMemo(()=>new yu,[]),$=g.useMemo(()=>new _t,[]),le=H(M0),de=H(Jn),he=H(s5e),me=H(pn),ce=H(Fn);g.useEffect(()=>{oe(u)},[u]),g.useEffect(()=>{E(new ue(i,a,l)),pe(s,c),j(r)},[n,o,r]);const Pe=Qe=>{$.x=Qe.offsetX/ne().gl.domElement.clientWidth*2-1,$.y=-(Qe.offsetY/ne().gl.domElement.clientHeight)*2+1,te.setFromCamera($,ne().camera)},pe=(Qe,nt)=>{O(Qe/2),G(nt/2)},Ie=Qe=>{q(!0),jn.getState().setEnableOrbitController(!1),M.current=!0,m.current.set(0,0,0),y.current.set(0,0,0),Se(Ho.Default),Qe.stopPropagation()},ve=(Qe,nt,mt)=>{me(tt=>{for(const gt of tt.elements)if(Cd(gt)&&Qe.has(gt.id))[gt.cx,gt.cy,gt.lx,gt.ly]=Qe.get(gt.id);else if(gt.foundationId&&Qe.has(gt.foundationId))switch(gt.type){case z.Wall:{const Ve=nt.get(gt.id);if(!Ve)continue;const je=gt,et=Ve.slice(0,3),bt=Ve.slice(3);je.cx=(et[0]+bt[0])/2,je.cy=(et[1]+bt[1])/2,je.lx=Math.hypot(et[0]-bt[0]+(et[1]-bt[1])),je.relativeAngle=Math.atan2(bt[1]-et[1],bt[0]-et[0]),je.leftPoint=[...et],je.rightPoint=[...bt];break}case z.Window:{const Ve=gt;if(Ve.parentType!==z.Roof)continue;const je=mt.get(gt.id);if(!je)continue;[Ve.cx,Ve.cy]=je;break}case z.SolarPanel:{const Ve=mt.get(gt.id);if(!Ve)continue;[gt.cx,gt.cy]=Ve;break}}tt.groupActionUpdateFlag=!tt.groupActionUpdateFlag,tt.updateElementOnRoofFlag=!0})},ze=(Qe,nt)=>{me(mt=>{for(const tt of mt.elements){if(Qe.has(tt.id)){const gt=Qe.get(tt.id);gt!==void 0&&(tt.type===z.Roof?tt.rise=gt:tt.type===z.SolarPanel?tt.cz=gt:tt.lz=gt)}if(tt.type===z.Wall&&nt.has(tt.id)){const gt=tt,Ve=nt.get(gt.id);Ve&&(gt.leftTopPartialHeight=Ve.upperLeft,gt.rightTopPartialHeight=Ve.upperRight,gt.leftUnfilledHeight=Ve.lowerLeft,gt.rightUnfilledHeight=Ve.lowerRight)}}mt.groupActionUpdateFlag=!mt.groupActionUpdateFlag,mt.updateElementOnRoofFlag=!0})},Ae=Qe=>{me(nt=>{for(const mt of nt.elements)if(Qe.has(mt.id)){const tt=Qe.get(mt.id);tt&&(mt.cx=tt[0],mt.cy=tt[1],mt.cz=tt[2],mt.rotation[2]=tt[3])}nt.groupActionUpdateFlag=!nt.groupActionUpdateFlag})},se=()=>{const Qe=new Map;for(const tt of H.getState().elements)(Cd(tt)&&t.has(tt.id)||t.has(tt.parentId))&&Qe.set(tt.id,[tt.cx,tt.cy,tt.cz,tt.rotation[2]]);const mt={name:`${ae==="Move"?"Move":"Rotate"} Foundation Group`,timestamp:Date.now(),oldPositionMap:new Map(D.current),newPositionMap:new Map(Qe),undo:()=>{Ae(mt.oldPositionMap)},redo:()=>{Ae(mt.newPositionMap)}};ce(mt)},ge=()=>{const Qe=new Map,nt=new Map,mt=new Map;for(const gt of H.getState().elements)if(Cd(gt)&&D.current.has(gt.id))Qe.set(gt.id,[gt.cx,gt.cy,gt.lx,gt.ly]);else if(k.current.has(gt.id)){const Ve=gt;nt.set(gt.id,[...Ve.leftPoint,...Ve.rightPoint])}else if(W.current.has(gt.id))if(gt.type===z.Window){const Ve=gt;if(Ve.parentType!==z.Roof)continue;mt.set(Ve.id,[Ve.cx,Ve.cy])}else gt.type===z.SolarPanel&&mt.set(gt.id,[gt.cx,gt.cy]);const tt={name:"Resize Building XY",timestamp:Date.now(),oldFoundationDataMap:new Map(D.current),newFoundationDataMap:new Map(Qe),oldWallPointsMap:new Map(k.current),newWallPointsMap:new Map(nt),oldSkylightPosMap:new Map(W.current),newSkylightPosMap:new Map(mt),undo:()=>{ve(tt.oldFoundationDataMap,tt.oldWallPointsMap,tt.oldSkylightPosMap)},redo:()=>{ve(tt.newFoundationDataMap,tt.newWallPointsMap,tt.newSkylightPosMap)}};ce(tt)},we=()=>{const Qe=new Map,nt=new Map;for(const tt of H.getState().elements)if(N.current.has(tt.id)&&(tt.type===z.Roof?Qe.set(tt.id,tt.rise):tt.type===z.SolarPanel?Qe.set(tt.id,tt.cz):Qe.set(tt.id,tt.lz)),tt.type===z.Wall&&U.current.has(tt.id)){const gt=tt;nt.set(gt.id,{lowerLeft:gt.leftUnfilledHeight,lowerRight:gt.rightUnfilledHeight,upperLeft:gt.leftTopPartialHeight,upperRight:gt.rightTopPartialHeight})}const mt={name:"Resize Building Z",timestamp:Date.now(),oldElementHeightMap:new Map(N.current),newElementHeightMap:new Map(Qe),oldPartialWallHeightMap:new Map(U.current),newPartialWallHeightMap:new Map(nt),undo:()=>{ze(mt.oldElementHeightMap,mt.oldPartialWallHeightMap)},redo:()=>{ze(mt.newElementHeightMap,mt.newPartialWallHeightMap)}};ce(mt)},Se=Qe=>{me(nt=>{nt.moveHandleType=Qe})},Me=Qe=>{const nt=new _t(Qe.x,Qe.y),mt=w.current.clone();if(f){const tt=new _t().subVectors(nt,mt),gt=Math.max(1,tt.length()),Ve=Math.sqrt(Math.pow(gt,2)/(Math.pow(d,2)+1)),je=Ve*d,et=new _t(Ve*Math.sign(tt.x),je*Math.sign(tt.y)).normalize().multiplyScalar(gt/2).add(mt);E(new ue(et.x,et.y)),pe(Ve,je),me(bt=>{const St=new Map;for(const Pt of bt.elements)if(Cd(Pt)&&(t.has(Pt.id)||e.has(Pt.id))){const Yt=b.current.get(Pt.id),zt=T.current.get(Pt.id);if(Yt&&zt){const Rt=zt[0]*Ve,Ct=zt[1]*je;if(Pt.lx=Rt,Pt.ly=Ct,Pt.parentId!==rr){const yt=St.get(Pt.parentId);if(yt){const{pos:at,rot:Et}=yt,Lt=new ue(Yt[0]*Ve+et.x,Yt[1]*je+et.y),Je=Lt.clone().sub(at).applyEuler(new cn(0,0,-Et));Pt.cx=Je.x,Pt.cy=Je.y,St.set(Pt.id,{pos:Lt.clone(),rot:Pt.rotation[2]+Et})}}else{const yt=Yt[0]*Ve+et.x,at=Yt[1]*je+et.y;Pt.cx=yt,Pt.cy=at,St.set(Pt.id,{pos:new ue(yt,at),rot:Pt.rotation[2]})}for(const yt of bt.elements)if(yt.foundationId===Pt.id)switch(yt.type){case z.Wall:{const at=yt,Et=C.current.get(at.id);if(!Et)continue;const[Lt,Je]=Et,st=[Lt.x*Rt,Lt.y*Ct,Pt.lz],It=[Je.x*Rt,Je.y*Ct,Pt.lz];at.cx=(st[0]+It[0])/2,at.cy=(st[1]+It[1])/2,at.lx=Math.hypot(st[0]-It[0]+(st[1]-It[1])),at.relativeAngle=Math.atan2(It[1]-st[1],It[0]-st[0]),at.leftPoint=[...st],at.rightPoint=[...It];break}case z.SolarPanel:{const at=yt,Et=A.current.get(at.id);if(!Et)continue;const Lt=at.parentType,[Je,st,It]=at.normal;Lt===z.Foundation||Lt===z.Roof||Lt===z.Cuboid&&ye.isEqual(It,1)?(at.cx=Et[0]*Rt,at.cy=Et[1]*Ct):Lt===z.Cuboid&&(ye.isEqual(Je,0)&&ye.isEqual(st,1)?(at.cx=Et[0]*Rt,at.cy=Ct/2):ye.isEqual(Je,0)&&ye.isEqual(st,-1)?(at.cx=Et[0]*Rt,at.cy=-Ct/2):ye.isEqual(Je,-1)&&ye.isEqual(st,0)?(at.cx=-Rt/2,at.cy=Et[1]*Ct):ye.isEqual(Je,1)&&ye.isEqual(st,0)&&(at.cx=Rt/2,at.cy=Et[1]*Ct));break}case z.Window:{const at=yt;if(at.parentType!==z.Roof)continue;const Et=A.current.get(at.id);if(!Et)continue;at.cx=Et[0]*Rt,at.cy=Et[1]*Ct;break}}}}})}else{const tt=mt.distanceTo(nt),gt=Math.atan2(nt.x-mt.x,nt.y-mt.y)+L,Ve=Math.abs(tt*Math.sin(gt)),je=Math.abs(tt*Math.cos(gt)),et=new _t().addVectors(nt,mt).multiplyScalar(.5);E(new ue(et.x,et.y)),pe(Ve,je),me(bt=>{for(const St of bt.elements)if(t.has(St.id))St.lx=Ve,St.ly=je,St.cx=et.x,St.cy=et.y;else if(St.foundationId&&t.has(St.foundationId))switch(St.type){case z.Wall:{const Pt=St,Yt=C.current.get(Pt.id);if(!Yt)continue;const[zt,Rt]=Yt,Ct=[zt.x*Ve,zt.y*je,0],yt=[Rt.x*Ve,Rt.y*je,0];Pt.cx=(Ct[0]+yt[0])/2,Pt.cy=(Ct[1]+yt[1])/2,Pt.lx=Math.hypot(Ct[0]-yt[0],Ct[1]-yt[1]),Pt.relativeAngle=Math.atan2(yt[1]-Ct[1],yt[0]-Ct[0]),Pt.leftPoint=[...Ct],Pt.rightPoint=[...yt];break}case z.SolarPanel:{const Pt=St,Yt=A.current.get(Pt.id);if(!Yt)continue;const zt=Pt.parentType,[Rt,Ct,yt]=Pt.normal;zt===z.Foundation||zt===z.Roof||zt===z.Cuboid&&ye.isEqual(yt,1)?(Pt.cx=Yt[0]*Ve,Pt.cy=Yt[1]*je):zt===z.Cuboid&&(ye.isEqual(Rt,0)&&ye.isEqual(Ct,1)?(Pt.cx=Yt[0]*Ve,Pt.cy=je/2):ye.isEqual(Rt,0)&&ye.isEqual(Ct,-1)?(Pt.cx=Yt[0]*Ve,Pt.cy=-je/2):ye.isEqual(Rt,-1)&&ye.isEqual(Ct,0)?(Pt.cx=-Ve/2,Pt.cy=Yt[1]*je):ye.isEqual(Rt,1)&&ye.isEqual(Ct,0)&&(Pt.cx=Ve/2,Pt.cy=Yt[1]*je));break}case z.Window:{const Pt=St;if(Pt.parentType!==z.Roof)continue;const Yt=A.current.get(Pt.id);if(!Yt)continue;Pt.cx=Yt[0]*Ve,Pt.cy=Yt[1]*je}}})}H.getState().updateElementOnRoofFn()},Ce=Qe=>{if(Qe.z<.1)return;const nt=Qe.z;oe(nt),me(mt=>{for(const tt of mt.elements)if(x.current.has(tt.id)){if(tt.type===z.Wall){tt.lz=nt*x.current.get(tt.id);const gt=tt;if(gt.fill===Ul.Partial){const Ve=P.current.get(gt.id);Ve&&(gt.leftTopPartialHeight=nt*Ve.upperLeft,gt.rightTopPartialHeight=nt*Ve.upperRight,gt.leftUnfilledHeight=nt*Ve.lowerLeft,gt.rightUnfilledHeight=nt*Ve.lowerRight)}}else if(tt.type===z.Roof)tt.rise=nt*x.current.get(tt.id);else if(tt.type===z.Cuboid){const gt=x.current.get(tt.id);if(gt){const Ve=gt*nt;tt.lz=Ve,tt.cz=Ve/2}}else if(tt.type===z.SolarPanel&&tt.parentType===z.Cuboid&&x.current.has(tt.parentId)){const gt=x.current.get(tt.parentId);if(gt){const Ve=gt*nt;if(ye.isEqual(tt.normal[2],1))tt.cz=Ve/2;else{const je=x.current.get(tt.id);je&&(tt.cz=je*Ve)}}}}mt.updateElementOnRoofFlag=!0})},Te=Qe=>{const nt=new ue(F.x,F.y),mt=Math.atan2(nt.x-Qe.x,Qe.y-nt.y)+(ae==="Rotate Upper"?0:Math.PI),tt=Math.abs(mt)>Math.PI?-fa:0,gt=mt+tt,Ve=new cn(0,0,gt),je=v.current.size;me(et=>{for(const bt of et.elements){if(Cd(bt)&&t.has(bt.id)&&!e.has(bt.id)){const St=S.current.get(bt.id),Pt=je!==1?v.current.get(bt.id):0;if(St&&Pt!==void 0){const Yt=St.clone().applyEuler(Ve);bt.cx=nt.x+Yt.x,bt.cy=nt.y+Yt.y,bt.rotation=[0,0,Pt+gt]}}if(bt.type!==z.Cuboid&&t.has(bt.parentId)){const St=je!==1?v.current.get(bt.parentId):0;St!==void 0&&(bt.rotation=[0,0,St+gt])}}}),j(gt)},Re=(Qe,nt)=>{const mt=new _t(F.x,F.y);w.current.set(Qe,nt).rotateAround(pnr,L).add(mt),Z("Resize XY"),b.current.clear(),T.current.clear(),C.current.clear(),D.current.clear(),k.current.clear(),A.current.clear(),W.current.clear();const[tt,gt]=[Y*2,_*2];for(const Ve of H.getState().elements)if(Cd(Ve)&&(t.has(Ve.id)||e.has(Ve.id))){const{pos:je}=ye.getWorldDataById(Ve.id);b.current.set(Ve.id,[(je.x-F.x)/tt,(je.y-F.y)/gt]),T.current.set(Ve.id,[Ve.lx/tt,Ve.ly/gt]),D.current.set(Ve.id,[Ve.cx,Ve.cy,Ve.lx,Ve.ly])}else if(Ve.foundationId&&(t.has(Ve.foundationId)||e.has(Ve.foundationId))){const je=de(Ve.foundationId);if(!je)continue;switch(Ve.type){case z.Wall:{const et=Ve,bt=new _t(et.leftPoint[0]/je.lx,et.leftPoint[1]/je.ly),St=new _t(et.rightPoint[0]/je.lx,et.rightPoint[1]/je.ly);C.current.set(et.id,[bt,St]),k.current.set(et.id,[...et.leftPoint,...et.rightPoint]);break}case z.SolarPanel:case z.Window:{const et=Ve;A.current.set(et.id,[et.cx/je.lx,et.cy/je.ly]),W.current.set(et.id,[et.cx,et.cy]);break}}}},Ne=(Qe,nt,mt)=>{const{x:tt,y:gt}=he();m.current.set(Qe,nt,mt),y.current.set(-$t,0,-Math.atan2(tt,gt)-L,"ZXY"),Z("Resize Z"),x.current.clear(),N.current.clear(),P.current.clear(),U.current.clear();for(const Ve of H.getState().elements)if(Ve.foundationId&&(t.has(Ve.foundationId)||e.has(Ve.parentId))){if(Ve.type===z.Wall){x.current.set(Ve.id,Ve.lz/Q),N.current.set(Ve.id,Ve.lz);const je=Ve;je.fill===Ul.Partial&&(U.current.set(je.id,{upperLeft:je.leftTopPartialHeight,upperRight:je.rightTopPartialHeight,lowerLeft:je.leftUnfilledHeight,lowerRight:je.rightUnfilledHeight}),P.current.set(je.id,{upperLeft:je.leftTopPartialHeight/Q,upperRight:je.rightTopPartialHeight/Q,lowerLeft:je.leftUnfilledHeight/Q,lowerRight:je.rightUnfilledHeight/Q}))}else if(Ve.type===z.Roof)x.current.set(Ve.id,Ve.rise/Q),N.current.set(Ve.id,Ve.rise);else if(Ve.type===z.SolarPanel&&Ve.parentType===z.Cuboid){const je=H.getState().elements.find(et=>et.id===Ve.parentId);je&&(x.current.set(Ve.id,Ve.cz/je.lz),N.current.set(Ve.id,Ve.cz))}}else(t.has(Ve.id)||e.has(Ve.id))&&(x.current.set(Ve.id,Ve.lz/Q),N.current.set(Ve.id,Ve.lz))},_e=Qe=>{switch(Ie(Qe),Qe.object.name){case xt.UpperLeft:{Re(Y,-_);break}case xt.UpperRight:{Re(-Y,-_);break}case xt.LowerLeft:{Re(Y,_);break}case xt.LowerRight:{Re(-Y,_);break}case xt.UpperLeftTop:{Ne(-Y,_,Q);break}case xt.UpperRightTop:{Ne(Y,_,Q);break}case xt.LowerLeftTop:{Ne(-Y,-_,Q);break}case xt.LowerRightTop:{Ne(Y,-_,Q);break}}},Ue=Qe=>{if(Ie(Qe),Z("Move"),Qe.intersections.length>0){const nt=Qe.intersections[0].point.clone().setZ(0);R.current.subVectors(F,nt);for(const mt of H.getState().elements)if(Cd(mt)&&t.has(mt.id)){const tt=new ue(mt.cx,mt.cy),gt=new ue().subVectors(tt,nt);S.current.set(mt.id,gt),D.current.set(mt.id,[mt.cx,mt.cy,mt.cz,mt.rotation[2]])}}},qe=Qe=>{if(Ie(Qe),Qe.object.name===ai.Lower?Z("Rotate Lower"):Qe.object.name===ai.Upper&&Z("Rotate Upper"),Qe.intersections.length>0){const nt=new ue(F.x,F.y);for(const mt of H.getState().elements){if(Cd(mt)&&t.has(mt.id)){const tt=new ue(mt.cx,mt.cy),gt=new ue().subVectors(tt,nt);S.current.set(mt.id,gt),v.current.set(mt.id,mt.rotation[2]),D.current.set(mt.id,[mt.cx,mt.cy,mt.cz,mt.rotation[2]])}t.has(mt.parentId)&&D.current.set(mt.id,[mt.cx,mt.cy,mt.cz,mt.rotation[2]])}}},Fe=()=>{switch(ae){case"Move":case"Rotate Lower":case"Rotate Upper":se();break;case"Resize XY":ge();break;case"Resize Z":we();break}q(!1),jn.getState().setEnableOrbitController(!0),M.current=!1,Z("Null"),Se(null),me(Qe=>{Qe.groupActionUpdateFlag=!Qe.groupActionUpdateFlag,Qe.updateWallMapOnFoundationFlag=!Qe.updateWallMapOnFoundationFlag,Qe.updateElementOnRoofFlag=!0})},He=Qe=>{if(!p.current||!M.current)return;Pe(Qe);const nt=te.intersectObjects([p.current]);if(nt.length>0){const mt=nt[0].point;switch(ae){case"Resize XY":Me(mt);break;case"Resize Z":Ce(mt);break;case"Rotate Lower":case"Rotate Upper":Te(mt);break;case"Move":E(new ue().addVectors(mt.clone().setZ(0),R.current)),me(tt=>{for(const gt of tt.elements)if(Cd(gt)&&t.has(gt.id)&&!e.has(gt.id)){const Ve=S.current.get(gt.id);Ve&&(gt.cx=mt.x+Ve.x,gt.cy=mt.y+Ve.y)}});break}}},Le=l2(),Ye=Le/2,lt=Q+Ye-Le/2,Oe=Y+Le,ut=_+Le,ht=_+Le*4;return h.jsxs("group",{name:"Group Master",position:F,rotation:[0,0,L],children:[h.jsxs("group",{name:"Resize Handle Group",onPointerDown:_e,children:[h.jsx(Hw,{args:[Y,_,Ye,Le],handleType:xt.UpperRight}),h.jsx(Hw,{args:[-Y,_,Ye,Le],handleType:xt.UpperLeft}),h.jsx(Hw,{args:[Y,-_,Ye,Le],handleType:xt.LowerRight}),h.jsx(Hw,{args:[-Y,-_,Ye,Le],handleType:xt.LowerLeft}),!le&&h.jsxs(h.Fragment,{children:[h.jsx(Hw,{args:[Y,_,lt,Le],handleType:xt.UpperRightTop}),h.jsx(Hw,{args:[-Y,_,lt,Le],handleType:xt.UpperLeftTop}),h.jsx(Hw,{args:[Y,-_,lt,Le],handleType:xt.LowerRightTop}),h.jsx(Hw,{args:[-Y,-_,lt,Le],handleType:xt.LowerLeftTop})]})]}),h.jsxs("group",{name:"Move Handle Group",onPointerDown:Ue,children:[h.jsx(DV,{args:[0,ut,Ye,Le],handleType:Ho.Upper}),h.jsx(DV,{args:[0,-ut,Ye,Le],handleType:Ho.Lower}),h.jsx(DV,{args:[Oe,0,Ye,Le],handleType:Ho.Right}),h.jsx(DV,{args:[-Oe,0,Ye,Le],handleType:Ho.Left})]}),h.jsxs("group",{name:"Rotate Handle Group",onPointerDown:qe,children:[h.jsx(WUe,{args:[0,ht,Ye,Le],handleType:ai.Upper}),h.jsx(WUe,{args:[0,-ht,Ye,Le],handleType:ai.Lower})]}),ee&&h.jsx(yi,{name:"Intersection Plane",ref:p,args:[Math.max(Y*2.4,1e3),Math.max(Y*2.4,1e3)],visible:!1,position:m.current,rotation:y.current,onPointerMove:He,onPointerUp:Fe}),h.jsx("group",{name:"Wireframe Group",position:[0,0,Q/2],children:h.jsx(o4,{hx:Y,hy:_,hz:Q/2,lineColor:"white"})})]})}),mnr=t=>t.parentId===rr&&(t.type===z.Foundation||t.type===z.Cuboid),ynr=xe.memo(()=>{H(XRt);const t=H(yPt),e=d();if(e.length===0)return null;const{allBaseElements:n,allBaseElementsVerticesMap:o,cuboidParentIdMap:r}=f(),i=new Set(e.map(w=>w.id)),a=[...e];for(const w of e)w.enableGroupMaster&&p(w);const{position:l,dimension:s,rotation:c,childCuboidIdSet:u}=m();function d(){const w=new Set;for(const x of H.getState().elements)t.has(x.id)&&(x.parentId===rr&&Cd(x)?w.add(x.id):x.foundationId&&w.add(x.foundationId));return w.size===0?[]:H.getState().elements.filter(x=>w.has(x.id))}function f(){const w=[],x=new Map,C=new Map;for(const P of H.getState().elements){if(mnr(P)){const A=ye.fetchFoundationVertexCoordinates(P);w.push(P),x.set(P.id,A)}P.type===z.Cuboid&&P.parentId!==rr&&C.set(P.id,P.parentId)}return{allBaseElements:w,allBaseElementsVerticesMap:x,cuboidParentIdMap:C}}function p(w){for(const x of n)!i.has(x.id)&&ye.areBasesOverlapped(w.id,x.id,o)&&(i.add(x.id),a.push(x),x.enableGroupMaster&&p(x))}function m(){const w=a.map(R=>ye.fetchFoundationVertexCoordinates(R)).flat(),x=new Set,C=ye.calculatePolygonBounds(w);let P=1,A=1;const S=new Map;for(const R of H.getState().elements)if(R.foundationId&&i.has(R.foundationId))if(R.type===z.Wall){const M=R;P=Math.max(P,M.lz),M.roofId&&(S.get(M.roofId)??0)H(MJe)?h.jsx(ynr,{}):null),Lue=72,NUe=xe.memo(({viewOnly:t=!1})=>{const e=H(Xp),n=dt(CTt),o=H(Qi),r=H(pn),i=dt(o5e),a=H(M0)??!1,l=H(aQ)??pL,s=H(CS),c=H(QN),u=H(G2e),d=H(RGe),f=H(h4),p=H(aSt)??"roadmap",m=dt(uQ),y=H(_M),w=H(w4),x=H($Xe),C=H(YM),P=H(qXe),A=H(mCt),S=H(Qn),v=H(sQ),b=dt(fTt),T=H(vQ),[R,M]=g.useState(!0),[D,k]=g.useState(!1),N=g.useRef(null),U=g.useRef(null),W=Kt();g.useEffect(()=>{var ee;U.current&&b.length>0&&((ee=U.current)==null||ee.scrollTo({key:b[b.length-1]}))},[b]),g.useEffect(()=>{M(!1)},[]),g.useEffect(()=>{n&&k(HR.localeCompare(n)<0)},[n]),g.useEffect(()=>{r(ee=>{var q;ee.loggable=e&&e.uid?!((q=e.email)!=null&&q.endsWith("@intofuture.org")):!1,e&&(e.noLogging||!e.schoolID||e.schoolID==="UNKNOWN SCHOOL"||!e.classID||e.classID==="UNKNOWN CLASS")&&(ee.loggable=!1)})},[e]),console.log("x");const F=e.uid&&new URLSearchParams(window.location.search).get("userid")===e.uid,E=ee=>{jn.setState(q=>{if(!N.current)return q;const ae=q.pointer,Z=(100-A)*.01*window.innerWidth;return ae.x=(ee.clientX-Z)/N.current.clientWidth*2-1,ae.y=-((ee.clientY-Lue)/N.current.clientHeight)*2+1,{pointer:ae}})},L=ee=>{E(ee)},j=()=>h.jsxs(Gxt,{ref:N,shadows:!0,gl:{preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0},frameloop:"demand",style:{height:"100%",width:"100%",backgroundColor:"black"},camera:{fov:uVe,far:l,up:[0,0,1]},onPointerMove:L,children:[h.jsx(wzo,{}),h.jsx(EMo,{}),h.jsx(TMo,{}),h.jsx(n1n,{}),h.jsx(CMo,{}),h.jsxs(g.Suspense,{fallback:null,children:[h.jsx(e1n,{}),h.jsx(Anr,{})]}),h.jsxs(g.Suspense,{fallback:null,children:[u&&h.jsx(Whn,{}),h.jsx(Lhn,{theme:d}),h.jsx(a1n,{}),f&&h.jsx(wao,{})]}),h.jsx(DMo,{}),h.jsx(tnr,{}),y===ec.GENETIC_ALGORITHM&&w.geneticAlgorithmParams.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&h.jsx(fzo,{}),y===ec.GENETIC_ALGORITHM&&w.geneticAlgorithmParams.problem===Pi.SOLAR_PANEL_ARRAY&&h.jsx(pzo,{}),y===ec.PARTICLE_SWARM_OPTIMIZATION&&w.particleSwarmOptimizationParams.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&h.jsx(mzo,{}),y===ec.PARTICLE_SWARM_OPTIMIZATION&&w.particleSwarmOptimizationParams.problem===Pi.SOLAR_PANEL_ARRAY&&h.jsx(Azo,{})]}),Y=g.useMemo(()=>new _t,[]),O=ee=>{r(ae=>{ae.canvasPercentWidth=Math.round(ee/window.innerWidth*100)});const q=jn.getState().canvas;if(q){const{gl:ae,camera:Z}=q,ne=ee;ae.getSize(Y),ae.setSize(ne,Y.y),Z instanceof A0&&(Z.aspect=ne/Y.y,Z.updateProjectionMatrix(),Ip())}},_=lan(),G=()=>{r(ee=>{ee.viewState.showModelTree=!1,ee.canvasPercentWidth=100})},Q=()=>{const ee={name:"Close Model Tree",timestamp:Date.now(),undo:()=>{r(q=>{q.viewState.showModelTree=!0,q.canvasPercentWidth=75})},redo:()=>{G()}};H.getState().addUndoable(ee),G()},oe=()=>t?h.jsxs("div",{style:{position:"absolute",bottom:"6px",left:"6px",zIndex:997,fontSize:"8px",userSelect:"none",color:f||c||v?p!=="roadmap"?"antiquewhite":"darkslategrey":"antiquewhite"},children:[h.jsx("img",{alt:"IFI Logo",src:_Me,height:"30px",style:{verticalAlign:"bottom"}})," V "+HR]}):h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"IFI Logo",src:_Me,height:c?"24px":"40px",style:{position:"absolute",bottom:"6px",left:"6px",zIndex:997,userSelect:"none"}}),h.jsxs("div",{style:{position:"absolute",bottom:"4px",left:c?"24px":"44px",zIndex:997,fontSize:"10px",userSelect:"none",pointerEvents:"none",color:f?p!=="roadmap"?"antiquewhite":"darkslategrey":c?"darkslategrey":"antiquewhite"},children:["   ©",new Date().getFullYear()," ",`${B.t("name.IFI",W)}`," ",B.t("word.VersionInitial",W)+HR+". "+B.t("word.AllRightsReserved",W)+". "]})]});return h.jsxs("div",{className:"App",style:{position:"relative",overflow:"hidden"},onContextMenu:ee=>ee.preventDefault(),children:[h.jsx(qpn,{initializing:R}),h.jsxs("div",{style:{backgroundColor:"lightblue",height:Lue+"px",paddingTop:"10px",textAlign:"start",userSelect:"none",fontSize:"30px"},children:[h.jsx(MQe,{offset:["10px","0px"],count:D?h.jsx(lZt,{style:{color:"red",cursor:"pointer"},title:B.t("message.NewVersionAvailable",W)}):void 0,children:h.jsx(Jt,{style:{marginLeft:"120px",verticalAlign:"middle",cursor:"pointer",userSelect:"none",fontSize:"30px"},title:B.t("tooltip.visitAladdinHomePage",W),onClick:ndn,children:`${B.t("name.Aladdin",W)}`})}),s&&!m&&h.jsxs("span",{style:{marginLeft:"20px",fontSize:"14px",verticalAlign:"center",userSelect:"text",color:F?"black":"gray"},children:[h.jsx("img",{title:B.t("toolbar.CloudFile",W),alt:"Cloud",src:zMo,height:32,width:32,style:{paddingRight:"8px"}}),s+(F&&i?" *":""),!t&&F&&i&&!x()&&h.jsx(oo,{type:"primary",size:"small",style:{marginLeft:"10px"},title:B.t("menu.file.SaveCloudFile",W),onClick:()=>{dt.getState().setSaveCloudFileFlag(!0),o&&C("Save Cloud File")},children:`${B.t("word.Save",W)}`})]})]}),!v&&oe(),!t&&h.jsx(dzo,{size:16,round:!0,margin:"2px",style:{position:"absolute",right:"0",top:"80px"}}),h.jsx(aao,{viewOnly:t,canvas:N.current}),h.jsx(FSo,{viewOnly:t,canvas:N.current}),h.jsx(Ytr,{}),h.jsx(Gxo,{children:h.jsxs("div",{style:{height:`calc(100vh - ${Lue}px)`},children:[c?h.jsxs(fv,{onResizeEnd:ee=>{ee[0]===0&&P(),O(ee[1])},children:[h.jsx(fv.Panel,{collapsible:!0,defaultSize:c?window.innerWidth*(1-A*.01):0,children:h.jsx(hnr,{canvas:N.current,relativeWidth:1-A*.01})}),h.jsx(fv.Panel,{children:j()})]}):h.jsx(h.Fragment,{children:v?h.jsxs(fv,{onResizeEnd:ee=>{ee[0]===0&&Q(),O(ee[1])},children:[h.jsxs(fv.Panel,{defaultSize:Math.max(200,window.innerWidth*(1-A*.01)),style:{overflow:"auto",zIndex:9},children:[h.jsxs(Jt,{style:{width:"100%",height:"36px",background:"#e8e8e8",color:"#888",alignItems:"center",display:"flex",justifyContent:"space-between",paddingLeft:"6px",paddingRight:"10px",paddingTop:"10px",paddingBottom:"10px",fontSize:"16px"},onContextMenu:ee=>{ee.preventDefault(),ee.stopPropagation()},children:[h.jsx("span",{children:B.t("menu.view.ModelTree",W)}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>Q(),onTouchStart:()=>Q(),children:h.jsx(i6,{title:B.t("word.Close",W)})})]}),S.length===0?h.jsx(w1,{style:{paddingTop:"20px"}}):h.jsx(Yee,{ref:U,virtual:!1,checkable:!0,defaultExpandAll:!0,autoExpandParent:!0,showLine:!0,showIcon:!0,expandedKeys:b,selectedKeys:b,onCheck:()=>{},onSelect:ee=>{T(ee[0])},onExpand:(ee,q)=>{q.expanded?T(ee[0],!0):T("none",!0),dt.getState().set(ae=>{ae.modelTreeExpandedKeys=[...ee]})},treeData:_,onContextMenu:ee=>{ee.preventDefault(),ee.stopPropagation()}})]}),h.jsx(fv.Panel,{children:j()})]}):h.jsx(h.Fragment,{children:j()})}),h.jsx(IMo,{canvas:N.current})]})}),h.jsx(RMo,{visible:!a}),!t&&h.jsx(gao,{}),!t&&o&&h.jsx(eHo,{})]})}),wnr=xe.memo(({viewOnly:t=!1})=>{const e=H(pn),n=H(lXe),o=H(a5e),r=H(sXe),i=dt(aXe),a=dt(iPt),l=dt(aPt),s=H(CS),c=dt(rPt),u=H(Xp),d=H(Au),[f,p]=g.useState(!1),[m,y]=g.useState(!1),[w,x]=g.useState({left:0,top:0,bottom:0,right:0}),C=g.useRef(null),{t:P}=Jl(),A=g.useMemo(()=>({lng:d}),[d]);g.useEffect(()=>{a&&(S(),dt.getState().setCreateNewFileFlag(!1))},[a]),g.useEffect(()=>{l&&(v(),dt.getState().setOpenLocalFileFlag(!1))},[l]);const S=()=>{li.confirm({title:`${P("message.DoYouWantToSaveChanges",A)}`,icon:h.jsx(_y,{}),okText:`${P("word.Yes",A)}`,cancelText:`${P("word.No",A)}`,onOk:()=>{u.uid?s?(e(N=>{N.localContentToImportAfterCloudFileUpdate="CREATE_NEW_FILE"}),dt.getState().setSaveCloudFileFlag(!0)):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):yn(P("menu.file.ToSaveYourWorkPleaseSignIn",A))},onCancel:()=>{r()}})},v=()=>{!t&&dt.getState().changed?li.confirm({title:P("message.DoYouWantToSaveChanges",A),icon:h.jsx(_y,{}),onOk:()=>{u.uid?s?b(!0):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):yn(P("menu.file.ToSaveYourWorkPleaseSignIn",A))},onCancel:()=>b(!1),okText:P("word.Yes",A),cancelText:P("word.No",A)}):b(!1)},b=N=>{document.body.onfocus=()=>{e(W=>{W.localFileDialogRequested=!1})};const U=document.getElementById("file-dialog");U.onchange=()=>{if(U.files&&U.files.length>0){dt.getState().set(E=>{E.waiting=!0});const W=new FileReader;W.readAsText(U.files[0]);const F=U.files[0].name;dt.getState().set(E=>{E.localFileName=F}),W.onload=()=>{if(W.result){const E=JSON.parse(W.result.toString());N?s&&(e(L=>{L.localContentToImportAfterCloudFileUpdate=E}),dt.getState().setSaveCloudFileFlag(!0)):o(E)}U.value=""}}},U.click()},T=()=>{let N=c.trim();if(N.length>0){N.endsWith(".ala")||(N+=".ala");const U=new Blob([JSON.stringify(n())],{type:"application/json"});return Tot.saveAs(U,N),dt.getState().set(W=>{W.localFileName=N}),e(W=>{W.cloudFile=void 0}),!0}else return co(P("menu.file.SavingAbortedMustHaveValidFileName",A)+"."),!1},R=(N,U)=>{if(C.current){const{clientWidth:W,clientHeight:F}=window.document.documentElement,E=C.current.getBoundingClientRect();x({left:-E.left+U.x,right:W-(E.right-U.x),top:-E.top+U.y,bottom:F-((E==null?void 0:E.bottom)-U.y)})}},M=()=>{p(!0),T()&&dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1}),p(!1)},D=()=>{dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1})},k=()=>{s&&dt.getState().set(N=>{N.localFileName=s,N.localFileName.endsWith(".ala")||(N.localFileName+=".ala")})};return h.jsx(h.Fragment,{children:h.jsx(li,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>y(!0),onMouseOut:()=>y(!1),children:P("menu.file.SaveAsLocalFile",A)}),footer:s?[h.jsx(oo,{onClick:k,children:P("menu.file.UseCloudFileName",A)},"Apply"),h.jsx(oo,{onClick:D,children:P("word.Cancel",A)},"Cancel"),h.jsx(oo,{type:"primary",onClick:M,disabled:!c,children:P("word.OK",A)},"OK")]:[h.jsx(oo,{onClick:D,children:P("word.Cancel",A)},"Cancel"),h.jsx(oo,{type:"primary",onClick:M,disabled:!c,children:P("word.OK",A)},"OK")],open:i,confirmLoading:f,onCancel:D,modalRender:N=>h.jsx(Vi,{disabled:!m,bounds:w,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:C,children:N})}),children:h.jsx(Vl,{placeholder:"File name",value:c,onPressEnter:M,onChange:N=>{dt.getState().set(U=>{U.localFileName=N.target.value})}})})})}),xnr=()=>{const t=H(DTt),e=H(w=>w.world),n=H(w=>w.elements),o=H(w=>w.viewState),r=H(w=>w.notes),i=dt(vs),a=dt(n6),l=dt(RTt),s=dt(HTt),c=H(SCt),u=H(TCt),d=H(CCt),f=H(ITt),p=new URLSearchParams(window.location.search),m=p.get("viewonly")==="true",y=p.get("map")==="true";return g.useEffect(()=>{c(),u(),d(),f(),dt.getState().set(w=>{w.openModelsMap=y,y&&(w.modelsMapFlag=!0,w.modelsMapWeatherStations=!1,w.leaderboardFlag=!0,w.showLeaderboard=!0)})},[]),g.useEffect(()=>{dt.getState().skipChange?s(!1):dt.getState().changed||l(!0)},[e,o,n,r]),g.useEffect(()=>{i&&dt.getState().set(w=>{w.showSolarRadiationHeatmap=!1}),a&&dt.getState().set(w=>{w.showHeatFluxes=!1})},[n]),h.jsx(n2,{locale:t,children:h.jsxs(Phn,{children:[m?h.jsx(NUe,{viewOnly:!0}):h.jsx(vnr,{children:h.jsx(NUe,{viewOnly:!1})}),h.jsx(wnr,{viewOnly:m})]})})},vnr=xe.memo(({children:t})=>(["iir3sv1kW1Vzbj9sOA46RfLWKCU2"].find(n=>n===H.getState().user.uid),h.jsx(Rhn,{onBeforeunload:()=>"",children:t}))),bnr=eYe(document.getElementById("root"));bnr.render(h.jsx(xnr,{}))});export default Snr(); +`,hnr=xe.memo(({relativeWidth:t,canvas:e})=>{const n=H(pn),o=H(Xp),r=dt(o5e),i=dt($Tt),a=H(Qi),l=H(Fn),s=H(CS),c=H(w5e),u=H(JXe),d=H(iCt),f=H(aCt),p=H(KXe),m=H(rCt),y=H(lCt),w=H(sCt),x=H(gCt),C=H(fCt),P=H(pCt),A=H(hCt),S=H(cCt),v=H(uCt),b=H(dCt),T=H(MQ),R=H(CQ),M=H($Xe),D=H(qXe),[k,N]=g.useState(),[U,W]=g.useState(),[F,E]=g.useState(!1),[L,j]=g.useState(!1),Y=g.useRef(!1),O=g.useRef(m??null),_=g.useRef(!1),G=g.useRef(!1),Q=g.useRef(y??$9.ALL),oe=g.useRef(!1),ee=g.useRef(d??[]),$=g.useRef(w??200),ae=g.useRef(S??"rowWidth"),Z=g.useRef(v??"rowWidth"),ne=g.useRef(b??5),te=g.useRef(!0),q=g.useRef(!0),le=g.useRef(0);g.useEffect(()=>{ae.current=S??"rowWidth"},[S]),g.useEffect(()=>{Z.current=v??"rowWidth"},[v]),g.useEffect(()=>{ne.current=b??5},[b]),g.useEffect(()=>{$.current=w??200},[w]);const{t:de}=Jl(),he=Kt(),me=o.uid===u;g.useEffect(()=>{if(ee.current=[],d){for(const fn of d)ee.current.push(fn);const Dt=p;if(Dt){const fn=C?1:-1;ee.current.sort((kn,yo)=>Dt?Dt==="rowWidth"&&"rowsPerRack"in kn&&"rowsPerRack"in yo?fn*(kn.rowsPerRack-yo.rowsPerRack):Dt==="orientation"?fn*((kn[Dt]==="Landscape"?0:1)-(yo[Dt]==="Landscape"?0:1)):Dt==="totalYearlyYield"&&"yearlyYield"in kn&&"yearlyYield"in yo?fn*(kn.yearlyYield-yo.yearlyYield):Dt==="meanYearlyYield"&&"yearlyYield"in kn&&"yearlyYield"in yo?fn*(kn.yearlyYield/kn.panelCount-yo.yearlyYield/yo.panelCount):Dt==="totalYearlyCost"?fn*(ye.calculateCost(kn)-ye.calculateCost(yo)):Dt==="yearlyProfit"?fn*(ye.calculateProfit(kn)-ye.calculateProfit(yo)):Dt in kn&&Dt in yo?fn*(kn[Dt]-yo[Dt]):0:0)}E(!F)}},[d,C,p]),g.useEffect(()=>{if(N(void 0),d){for(const Dt of d)if(Dt.title===s){N(Dt);break}}},[s,d]),g.useEffect(()=>{const Dt=()=>{E(!F)};return window.addEventListener("resize",Dt),()=>{window.removeEventListener("resize",Dt)}},[F]);const ce=()=>{dt.getState().set(Dt=>{Dt.curateDesignToProjectFlag=!0}),a&&n(Dt=>{Dt.actionInfo={name:"Curate Current Design",timestamp:new Date().getTime()}})},Pe=()=>{o.uid&&c&&k&&Uio(o.uid,c,k).then(()=>{n(Dt=>{if(Dt.projectState.designs){let fn=-1;for(const[kn,yo]of Dt.projectState.designs.entries())if(yo.title===k.title){fn=kn;break}fn>=0&&(Dt.projectState.designs.splice(fn,1),a&&(Dt.actionInfo={name:"Remove Selected Design",timestamp:new Date().getTime(),details:k.title}))}})})},pe=Dt=>{e&&o.uid&&c&&s&&Zio(o.uid,f,c,w??200,s,e).then(()=>{Dt&&Dt(),E(!F),a&&n(fn=>{fn.actionInfo={name:"Update Selected Design",timestamp:new Date().getTime(),details:{design:s}}})})},Ie=window.innerHeight,ve=Math.round(800/$.current),ze=48/ve,Ae=Math.round(t*window.innerWidth/ve-ze),[se,ge,we,Se,Me,Ce]=g.useMemo(()=>[Td.getVariables(f,x??[]),Td.getTitles(f,he,x??[]),Td.getUnits(f,he,x??[]),Td.getDigits(f,x??[]),Td.getTickIntegers(f,x??[]),Td.getTypes(f,x??[])],[f,x,L,he]),Te=g.useMemo(()=>{const Dt=[];if(d&&f===Pi.SOLAR_PANEL_ARRAY)for(const fn of d){const kn={};if(x!=null&&x.includes("rowWidth")||(kn.rowWidth=fn.rowsPerRack),x!=null&&x.includes("tiltAngle")||(kn.tiltAngle=ye.toDegrees(fn.tiltAngle)),x!=null&&x.includes("interRowSpacing")||(kn.interRowSpacing=fn.interRowSpacing),x!=null&&x.includes("latitude")||(kn.latitude=fn.latitude??42),x!=null&&x.includes("orientation")||(kn.orientation=fn.orientation===br.landscape?0:1),x!=null&&x.includes("poleHeight")||(kn.poleHeight=fn.poleHeight),x!=null&&x.includes("unitCost")||(kn.unitCost=fn.unitCost),x!=null&&x.includes("sellingPrice")||(kn.sellingPrice=fn.sellingPrice),x!=null&&x.includes("")||(kn.totalYearlyCost=ye.calculateCost(fn)),x!=null&&x.includes("totalYearlyYield")||(kn.totalYearlyYield=fn.yearlyYield*.001),x!=null&&x.includes("meanYearlyYield")||(kn.meanYearlyYield=fn.yearlyYield/fn.panelCount),x!=null&&x.includes("yearlyProfit")||(kn.yearlyProfit=ye.calculateProfit(fn)),kn.group=y===$9.INDIVIDUALS?fn.title:"default",kn.selected=k===fn,kn.hovered=U===fn,kn.invisible=fn.invisible,kn.excluded=!1,A){for(const yo of A)if(yo.type===AN.Between&&yo.upperBound!==void 0&&yo.lowerBound!==void 0){const ur=kn[yo.variable];if(typeof ur=="number"&&(ur>yo.upperBound||ur{n(Dt=>{if(Dt.projectState.designs)for(const[fn,kn]of Dt.projectState.designs.entries())kn.excluded=Te[fn].excluded})},[Te]);const Re=(Dt,fn)=>{let kn=fn;if(P){for(const yo of P)if(yo.variable===Dt){kn=yo.minimum??fn;break}}return kn},Ne=(Dt,fn)=>{let kn=fn;if(P){for(const yo of P)if(yo.variable===Dt){kn=yo.maximum??fn;break}}return kn},_e=g.useMemo(()=>{if(f===Pi.SOLAR_PANEL_ARRAY&&T){const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(Re("rowWidth",T.minimumRowsPerRack)),x!=null&&x.includes("tiltAngle")||Dt.push(Re("tiltAngle",ye.toDegrees(T.minimumTiltAngle))),x!=null&&x.includes("interRowSpacing")||Dt.push(Re("interRowSpacing",T.minimumInterRowSpacing)),x!=null&&x.includes("latitude")||Dt.push(Re("latitude",-90)),x!=null&&x.includes("orientation")||Dt.push(0),x!=null&&x.includes("poleHeight")||Dt.push(Re("poleHeight",0)),x!=null&&x.includes("unitCost")||Dt.push(Re("unitCost",.1)),x!=null&&x.includes("sellingPrice")||Dt.push(Re("sellingPrice",.1)),x!=null&&x.includes("totalYearlyCost")||Dt.push(Re("totalYearlyCost",0)),x!=null&&x.includes("totalYearlyYield")||Dt.push(Re("totalYearlyYield",0)),x!=null&&x.includes("meanYearlyYield")||Dt.push(Re("meanYearlyYield",0)),x!=null&&x.includes("yearlyProfit")||Dt.push(Re("yearlyProfit",-10)),Dt}return[]},[T,f,P,x,L]),Ue=g.useMemo(()=>{if(f===Pi.SOLAR_PANEL_ARRAY&&T){const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(Ne("rowWidth",T.maximumRowsPerRack)),x!=null&&x.includes("tiltAngle")||Dt.push(Ne("tiltAngle",ye.toDegrees(T.maximumTiltAngle))),x!=null&&x.includes("interRowSpacing")||Dt.push(Ne("interRowSpacing",T.maximumInterRowSpacing)),x!=null&&x.includes("latitude")||Dt.push(Ne("latitude",90)),x!=null&&x.includes("orientation")||Dt.push(1),x!=null&&x.includes("poleHeight")||Dt.push(Ne("poleHeight",5)),x!=null&&x.includes("unitCost")||Dt.push(Ne("unitCost",1)),x!=null&&x.includes("sellingPrice")||Dt.push(Ne("sellingPrice",.5)),x!=null&&x.includes("totalYearlyCost")||Dt.push(Ne("totalYearlyCost",100)),x!=null&&x.includes("totalYearlyYield")||Dt.push(Ne("totalYearlyYield",100)),x!=null&&x.includes("meanYearlyYield")||Dt.push(Ne("meanYearlyYield",1e3)),x!=null&&x.includes("yearlyProfit")||Dt.push(Ne("yearlyProfit",10)),Dt}return[]},[T,f,P,x,L]),qe=(Dt,fn)=>{let kn=fn;if(A){for(const yo of A)if(yo.variable===Dt){kn=yo.lowerBound??fn;break}}return kn},Fe=(Dt,fn)=>{let kn=fn;if(A){for(const yo of A)if(yo.variable===Dt){kn=yo.upperBound??fn;break}}return kn},He=(Dt,fn,kn)=>({variable:Dt,type:AN.Between,upperBound:Fe(Dt,fn),lowerBound:qe(Dt,kn)}),Le=g.useMemo(()=>{const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(He("rowWidth",T.maximumRowsPerRack,T.minimumRowsPerRack)),x!=null&&x.includes("tiltAngle")||Dt.push(He("tiltAngle",ye.toDegrees(T.maximumTiltAngle),ye.toDegrees(T.minimumTiltAngle))),x!=null&&x.includes("interRowSpacing")||Dt.push(He("interRowSpacing",T.maximumInterRowSpacing,T.minimumInterRowSpacing)),x!=null&&x.includes("latitude")||Dt.push(He("latitude",90,-90)),x!=null&&x.includes("orientation")||Dt.push(He("orientation",1,0)),x!=null&&x.includes("poleHeight")||Dt.push(He("poleHeight",5,0)),x!=null&&x.includes("unitCost")||Dt.push(He("unitCost",1,.1)),x!=null&&x.includes("sellingPrice")||Dt.push(He("sellingPrice",.5,.1)),x!=null&&x.includes("totalYearlyCost")||Dt.push(He("totalYearlyCost",100,0)),x!=null&&x.includes("totalYearlyYield")||Dt.push(He("totalYearlyYield",100,0)),x!=null&&x.includes("meanYearlyYield")||Dt.push(He("meanYearlyYield",1e3,0)),x!=null&&x.includes("yearlyProfit")||Dt.push(He("yearlyProfit",10,-10)),Dt},[L,A,x]),Ye=g.useMemo(()=>{if(f===Pi.SOLAR_PANEL_ARRAY&&T){const Dt=[];return x!=null&&x.includes("rowWidth")||Dt.push(1),x!=null&&x.includes("tiltAngle")||Dt.push(.1),x!=null&&x.includes("interRowSpacing")||Dt.push(.1),x!=null&&x.includes("latitude")||Dt.push(.1),x!=null&&x.includes("orientation")||Dt.push(1),x!=null&&x.includes("poleHeight")||Dt.push(.1),x!=null&&x.includes("unitCost")||Dt.push(.01),x!=null&&x.includes("sellingPrice")||Dt.push(.01),x!=null&&x.includes("totalYearlyCost")||Dt.push(.1),x!=null&&x.includes("totalYearlyYield")||Dt.push(1),x!=null&&x.includes("meanYearlyYield")||Dt.push(1),x!=null&&x.includes("yearlyProfit")||Dt.push(.1),Dt}return[]},[f,x,L]),lt=g.useRef(!(x!=null&&x.includes("rowWidth"))),Oe=g.useRef(!(x!=null&&x.includes("tiltAngle"))),ut=g.useRef(!(x!=null&&x.includes("interRowSpacing"))),ht=g.useRef(!(x!=null&&x.includes("latitude"))),Qe=g.useRef(!(x!=null&&x.includes("orientation"))),nt=g.useRef(!(x!=null&&x.includes("poleHeight"))),mt=g.useRef(!(x!=null&&x.includes("unitCost"))),tt=g.useRef(!(x!=null&&x.includes("sellingPrice"))),gt=g.useRef(!(x!=null&&x.includes("totalYearlyCost"))),Ve=g.useRef(!(x!=null&&x.includes("totalYearlyYield"))),je=g.useRef(!(x!=null&&x.includes("meanYearlyYield"))),et=g.useRef(!(x!=null&&x.includes("yearlyProfit")));g.useEffect(()=>{lt.current=!(x!=null&&x.includes("rowWidth")),Oe.current=!(x!=null&&x.includes("tiltAngle")),ut.current=!(x!=null&&x.includes("interRowSpacing")),ht.current=!(x!=null&&x.includes("latitude")),Qe.current=!(x!=null&&x.includes("orientation")),nt.current=!(x!=null&&x.includes("poleHeight")),mt.current=!(x!=null&&x.includes("unitCost")),tt.current=!(x!=null&&x.includes("sellingPrice")),gt.current=!(x!=null&&x.includes("totalYearlyCost")),Ve.current=!(x!=null&&x.includes("totalYearlyYield")),je.current=!(x!=null&&x.includes("meanYearlyYield")),et.current=!(x!=null&&x.includes("yearlyProfit")),E(!F)},[x]),g.useEffect(()=>{O.current=m},[m]);const bt=Dt=>{d&&(Dt>=0&&Dt{n(fn=>{if(fn.projectState.designs){for(const kn of fn.projectState.designs)if(kn.title===Dt){kn.invisible=!kn.invisible;break}}})},Pt=Dt=>{me?o.uid&&c&&Qio(o.uid,c,Dt).then(()=>{St(Dt.title)}):St(Dt.title)},Yt=Dt=>{const fn={name:"Select Design Visibility",timestamp:Date.now(),checked:!!Dt.invisible,property:Dt.title,undo:()=>{Pt(Dt)},redo:()=>{Pt(Dt)}};l(fn),Pt(Dt)},zt=(Dt,fn)=>{n(kn=>{kn.projectState.hiddenParameters&&(Dt?kn.projectState.hiddenParameters.includes(fn)&&kn.projectState.hiddenParameters.splice(kn.projectState.hiddenParameters.indexOf(fn),1):kn.projectState.hiddenParameters.includes(fn)||kn.projectState.hiddenParameters.push(fn))})},Rt=(Dt,fn)=>{oe.current=!0,me?o.uid&&c&&jio(o.uid,c,fn,!Dt).then(()=>{zt(Dt,fn)}):zt(Dt,fn)},Ct=(Dt,fn)=>{const kn={name:"Select Parameter",timestamp:Date.now(),checked:Dt,property:fn,undo:()=>{Rt(!Dt,fn)},redo:()=>{Rt(Dt,fn)}};l(kn),Rt(Dt,fn)},yt=()=>{n(Dt=>{Dt.projectState.dataColoring=Q.current}),dt.getState().set(Dt=>{Dt.updateProjectsFlag=!0}),E(!F)},at=Dt=>{Q.current=Dt,me?o.uid&&c&&_io(o.uid,c,Q.current).then(()=>{yt()}):yt()},Et=Dt=>{const fn={name:"Select Data Coloring",timestamp:Date.now(),oldValue:y,newValue:Dt,undo:()=>{at(y)},redo:()=>{at(Dt)}};l(fn),at(Dt)},Lt=()=>h.jsxs("div",{children:[h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{lt.current=Dt.target.checked,Ct(lt.current,"rowWidth"),j(!L)},checked:lt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowWidth",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{Oe.current=Dt.target.checked,Ct(Oe.current,"tiltAngle"),j(!L)},checked:Oe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTiltAngle",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{ut.current=Dt.target.checked,Ct(ut.current,"interRowSpacing"),j(!L)},checked:ut.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowSpacing",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{ht.current=Dt.target.checked,Ct(ht.current,"latitude"),j(!L)},checked:ht.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Latitude",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{Qe.current=Dt.target.checked,Ct(Qe.current,"orientation"),j(!L)},checked:Qe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayOrientation",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{nt.current=Dt.target.checked,Ct(nt.current,"poleHeight"),j(!L)},checked:nt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayPoleHeight",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{mt.current=Dt.target.checked,Ct(mt.current,"unitCost"),j(!L)},checked:mt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.UnitCost",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{tt.current=Dt.target.checked,Ct(tt.current,"sellingPrice"),j(!L)},checked:tt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.SellingPrice",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{gt.current=Dt.target.checked,Ct(gt.current,"totalYearlyCost"),j(!L)},checked:gt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyCost",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{Ve.current=Dt.target.checked,Ct(Ve.current,"totalYearlyYield"),j(!L)},checked:Ve.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyYield",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{je.current=Dt.target.checked,Ct(je.current,"meanYearlyYield"),j(!L)},checked:je.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayMeanYearlyYield",he)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:Dt=>{et.current=Dt.target.checked,Ct(et.current,"yearlyProfit"),j(!L)},checked:et.current,children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayYearlyProfit",he)})})]}),Je=()=>h.jsxs(h.Fragment,{children:[h.jsx(gp,{value:"rowWidth",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowWidth",he)})},"rowWidth"),h.jsx(gp,{value:"tiltAngle",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTiltAngle",he)})},"tiltAngle"),h.jsx(gp,{value:"interRowSpacing",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayRowSpacing",he)})},"interRowSpacing"),h.jsx(gp,{value:"latitude",children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Latitude",he)})},"latitude"),h.jsx(gp,{value:"orientation",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayOrientation",he)})},"orientation"),h.jsx(gp,{value:"poleHeight",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayPoleHeight",he)})},"poleHeight"),h.jsx(gp,{value:"unitCost",children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.UnitCost",he)})},"unitCost"),h.jsx(gp,{value:"sellingPrice",children:h.jsx("span",{style:{fontSize:"12px"},children:de("economicsPanel.SellingPrice",he)})},"sellingPrice"),h.jsx(gp,{value:"totalYearlyCost",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyCost",he)})},"totalYearlyCost"),h.jsx(gp,{value:"totalYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayTotalYearlyYield",he)})},"totalYearlyYield"),h.jsx(gp,{value:"meanYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayMeanYearlyYield",he)})},"meanYearlyYield"),h.jsx(gp,{value:"yearlyProfit",children:h.jsx("span",{style:{fontSize:"12px"},children:de("polygonMenu.SolarPanelArrayYearlyProfit",he)})},"yearlyProfit")]}),st=g.useMemo(()=>{const Dt=[];if(d&&f===Pi.SOLAR_PANEL_ARRAY)for(const fn of d){if(fn.invisible||fn===k)continue;const kn={};Td.setScatterData(ae.current,"x",kn,fn),Td.setScatterData(Z.current,"y",kn,fn),Dt.push(kn)}return Dt},[ae.current,Z.current,d,f,k]),It=g.useMemo(()=>{const Dt=[];if(d&&f===Pi.SOLAR_PANEL_ARRAY)for(const fn of d){if(fn!==k)continue;const kn={};Td.setScatterData(ae.current,"x",kn,fn),Td.setScatterData(Z.current,"y",kn,fn),Dt.push(kn)}return Dt},[ae.current,Z.current,d,f,k]),ot=Dt=>{const fn={min:0,max:1};if(f===Pi.SOLAR_PANEL_ARRAY&&T)switch(Dt){case"rowWidth":fn.min=Re("rowWidth",T.minimumRowsPerRack),fn.max=Ne("rowWidth",T.maximumRowsPerRack);break;case"tiltAngle":fn.min=Re("tiltAngle",ye.toDegrees(T.minimumTiltAngle)),fn.max=Ne("tiltAngle",ye.toDegrees(T.maximumTiltAngle));break;case"interRowSpacing":fn.min=Re("interRowSpacing",T.minimumInterRowSpacing),fn.max=Ne("interRowSpacing",T.maximumInterRowSpacing);break;case"latitude":fn.min=Re("latitude",-90),fn.max=Ne("latitude",90);break;case"orientation":fn.min=0,fn.max=1;break;case"poleHeight":fn.min=Re("poleHeight",0),fn.max=Ne("poleHeight",5);break;case"unitCost":fn.min=Re("unitCost",.1),fn.max=Ne("unitCost",1);break;case"sellingPrice":fn.min=Re("sellingPrice",.1),fn.max=Ne("sellingPrice",.5);break;case"totalYearlyCost":fn.min=Re("totalYearlyCost",0),fn.max=Ne("totalYearlyCost",100);break;case"totalYearlyYield":fn.min=Re("totalYearlyYield",0),fn.max=Ne("totalYearlyYield",100);break;case"meanYearlyYield":fn.min=Re("meanYearlyYield",0),fn.max=Ne("meanYearlyYield",1e3);break;case"yearlyProfit":fn.min=Re("yearlyProfit",-10),fn.max=Ne("yearlyProfit",10);break}return fn},it=g.useMemo(()=>ot(ae.current),[ae.current,P]),Be=g.useMemo(()=>ot(Z.current),[Z.current,P]),pt=g.useMemo(()=>Td.getUnit(ae.current,he),[ae.current,he]),ct=g.useMemo(()=>Td.getUnit(Z.current,he),[Z.current,he]),Xe=Dt=>{const fn=ae.current,kn={name:"Change X Axis",timestamp:Date.now(),oldValue:fn,newValue:Dt,undo:()=>{ft(fn)},redo:()=>{ft(Dt)}};l(kn),ft(Dt)},ft=Dt=>{ae.current=Dt,me&&o.uid&&c&&Gio(o.uid,c,Dt).then(()=>{}),E(!F)},wt=Dt=>{const fn=Z.current,kn={name:"Change Y Axis",timestamp:Date.now(),oldValue:fn,newValue:Dt,undo:()=>{kt(fn)},redo:()=>{kt(Dt)}};l(kn),kt(Dt)},kt=Dt=>{Z.current=Dt,me&&o.uid&&c&&Xio(o.uid,c,Dt).then(()=>{}),E(!F)},Zt=()=>h.jsxs("div",{style:{width:"280px"},children:[h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[de("projectPanel.SelectXAxis",he),": "]})}),h.jsx(Ge,{span:16,children:h.jsx(Ko,{style:{width:"100%"},value:ae.current,onChange:Dt=>Xe(Dt),children:Je()})})]}),h.jsxs(Qt,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ge,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[de("projectPanel.SelectYAxis",he),": "]})}),h.jsx(Ge,{span:16,children:h.jsx(Ko,{style:{width:"100%"},value:Z.current,onChange:Dt=>wt(Dt),children:Je()})})]}),h.jsx(Qt,{style:{paddingBottom:"8px"},children:h.jsxs("div",{children:[h.jsxs(IKo,{id:"scatter-chart",width:280,height:240,margin:{top:0,right:0,bottom:-10,left:-10},children:[h.jsx(A7,{strokeWidth:"1",stroke:"gray",horizontal:te.current,vertical:q.current}),h.jsx(B1,{dataKey:"x",fontSize:10,type:"number",domain:[it.min,it.max],name:"x",unit:pt,strokeWidth:1,stroke:"gray",tickFormatter:(Dt,fn)=>ae.current==="yearlyProfit"||ae.current==="unitCost"||ae.current==="sellingPrice"?"$"+Dt:Dt}),h.jsx(Lh,{dataKey:"y",fontSize:10,type:"number",domain:[Be.min,Be.max],name:"y",unit:ct,strokeWidth:1,stroke:"gray",tickFormatter:(Dt,fn)=>Z.current==="yearlyProfit"||Z.current==="unitCost"||Z.current==="sellingPrice"?"$"+Dt:Dt}),h.jsx(yh,{cursor:{strokeDasharray:"3 3"},formatter:Dt=>Dt.toFixed(2)}),h.jsx(yS,{name:"All",data:st,fill:"#8884d8",shape:h.jsx(kj,{fill:"#8884d8",r:ne.current})}),k&&h.jsx(yS,{name:"Selected",data:It,fill:"red",shape:"star"})]}),h.jsx(inr,{symbolSize:ne.current,horizontalGrid:te.current,verticalGrid:q.current,changeHorizontalGrid:Dt=>{te.current=Dt,E(!F)},changeVerticalGrid:Dt=>{q.current=Dt,E(!F)},changeSymbolSize:Dt=>{ne.current=Dt,me&&o.uid&&c&&Jio(o.uid,c,Dt).then(()=>{}),E(!F)}})]})}),h.jsx(Qt,{children:h.jsx("span",{style:{width:"100%",textAlign:"center"},children:h.jsx(nd,{style:{fontSize:"18px",color:"gray",paddingRight:"8px"},title:de("projectPanel.ScatterPlotScreenshot",he),onClick:()=>{const Dt=document.getElementById("scatter-chart");Dt&&Vme.saveSvgAsPng(Dt,"scatter-chart-"+c+".png").then(()=>{yn(de("message.ScreenshotSaved",he)),a&&n(fn=>{fn.actionInfo={name:"Scatter chart screenshot",timestamp:new Date().getTime(),details:{image:"scatter-chart-"+c+".png"}}})})}})})})]}),Ot=()=>h.jsx("div",{children:h.jsxs(We.Group,{onChange:Dt=>{Et(Dt.target.value)},value:y??$9.ALL,children:[h.jsx(We,{style:{fontSize:"12px",width:"100%"},value:$9.ALL,children:de("projectPanel.SameColorForAllDesigns",he)}),h.jsx("br",{}),h.jsx(We,{style:{fontSize:"12px",width:"100%"},value:$9.INDIVIDUALS,children:de("projectPanel.OneColorForEachDesign",he)})]})}),on=()=>h.jsx("div",{style:{width:"250px"},onClick:Dt=>Dt.stopPropagation(),children:h.jsxs(Qt,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ge,{span:14,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[de("projectPanel.ThumbnailImageSize",he),": "]})}),h.jsx(Ge,{span:10,children:h.jsxs(Ko,{style:{width:"100%"},value:$.current,onChange:Dt=>{$.current=Dt,me?o.uid&&c&&Kio(o.uid,c,Dt).then(()=>{n(fn=>{fn.projectState.thumbnailWidth=$.current})}):n(fn=>{fn.projectState.thumbnailWidth=$.current}),E(!F)},children:[h.jsx(gp,{value:100,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Small",he)})},"small-thumbnail"),h.jsx(gp,{value:125,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Medium",he)})},"medium-thumbnail"),h.jsx(gp,{value:200,children:h.jsx("span",{style:{fontSize:"12px"},children:de("word.Large",he)})},"large-thumbnail")]})})]})}),qt=[{key:"1",label:h.jsxs(unr,{children:[h.jsx("span",{children:de("projectPanel.ProjectDescription",he)+" | "+de("projectPanel.ProjectType",he)+": "+f}),h.jsxs("span",{children:[me&&h.jsxs(h.Fragment,{children:[G.current&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),Y.current=!Y.current,E(!F)},children:Y.current?h.jsx($Zt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.MakeDescriptionNonEditable",he)}):h.jsx(htt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.MakeDescriptionEditable",he)})}),h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),ce()},children:h.jsx(ben,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.CurateCurrentDesign",he)})}),k&&k.title===s&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),pe()},children:h.jsx(WZt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.UpdateSelectedDesign",he)})}),k&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),Pe(),N(void 0)},children:h.jsx(ftt,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.RemoveSelectedDesign",he)})}),k&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{if(Dt.stopPropagation(),c){let fn=k1+"?client=web&userid="+o.uid+"&project="+encodeURIComponent(c);k&&(fn+="&title="+encodeURIComponent(k.title)),navigator.clipboard.writeText(fn).then(()=>d5(de("projectListPanel.ProjectLinkGeneratedInClipBoard",he)+".")),a&&n(kn=>{kn.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:fn}})}},children:h.jsx(Hen,{style:{fontSize:"24px",color:"gray"},title:de("projectListPanel.GenerateProjectLink",he)})})]}),d&&d.length>1&&p&&h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>{Dt.stopPropagation(),n(fn=>{fn.projectState.sortDescending=!fn.projectState.sortDescending,a&&(fn.actionInfo={name:"Sort Design",timestamp:new Date().getTime(),details:{descending:!fn.projectState.sortDescending}})})},children:C?h.jsx(etn,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.ClickToFlipSortingOrder",he)}):h.jsx(otn,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.ClickToFlipSortingOrder",he)})}),h.jsx(zl,{title:h.jsx("div",{onClick:Dt=>Dt.stopPropagation(),children:de("projectPanel.ProjectSettings",he)}),content:on,children:h.jsx(oo,{style:{border:"none",padding:"4px"},onClick:Dt=>Dt.stopPropagation(),children:h.jsx(qen,{style:{fontSize:"24px",color:"gray"}})})})]})]}),children:h.jsx(anr,{title:Y.current?void 0:de("projectPanel.DoubleClickToMakeDescriptionEditable",he),readOnly:!Y.current,value:O.current??void 0,onDoubleClick:()=>{Y.current=!Y.current,E(!F)},onChange:Dt=>{O.current=Dt.target.value,_.current=!0,n(fn=>{fn.projectState.description=Dt.target.value}),E(!F)},onBlur:()=>{Y.current=!1,_.current&&o.uid&&me&&c&&Oio(o.uid,c,O.current).then(()=>{_.current=!1,E(!F)})},style:{paddingLeft:"10px",textAlign:"left",resize:Y.current?"vertical":"none",border:Y.current?"1px solid gray":"none"}})}],rn=Dt=>{N(Dt),u&&mK(u,Dt.title,!0,!0).then(()=>{a&&n(fn=>{fn.actionInfo={name:"Open Design",timestamp:new Date().getTime(),details:Dt.title}})})},Pn=Dt=>{if(r&&i)if(M()){const fn=li.confirm({title:de("message.DoYouWantToUpdateDesign",he),icon:h.jsx(t4,{}),footer:h.jsxs(Jt,{direction:"horizontal",style:{marginTop:"10px",width:"100%",justifyContent:"end"},children:[h.jsx(oo,{onClick:()=>{pe(()=>{rn(Dt),fn.destroy()})},children:de("word.Yes",he)},"Yes"),h.jsx(oo,{onClick:()=>{rn(Dt),dt.getState().set(kn=>{kn.confirmOpeningDesign=!1}),fn.destroy()},children:de("word.NoAndDoNotAskAgain",he)},"NoAndDoNotShowAgain"),h.jsx(oo,{type:"primary",onClick:()=>{rn(Dt),fn.destroy()},children:de("word.No",he)},"No")]})})}else li.confirm({title:de("message.DoYouWantToSaveChanges",he),icon:h.jsx(t4,{}),onOk:()=>{s?dt.getState().setSaveCloudFileFlag(!0):n(fn=>{fn.showCloudFileTitleDialogFlag=!fn.showCloudFileTitleDialogFlag,fn.showCloudFileTitleDialog=!0})},onCancel:()=>{rn(Dt)},okText:de("word.Yes",he),cancelText:de("word.No",he)});else rn(Dt)},fo=(Dt,fn)=>{const kn=Dt.target;kn.src===zV&&(kn.src=fn.thumbnailUrl),N(fn!==k?fn:void 0),a&&n(yo=>{yo.actionInfo={name:fn!==k?"Select Design":"Deselect Design",timestamp:new Date().getTime(),details:fn==null?void 0:fn.title}})},to=(Dt,fn)=>{const kn=Dt.target;kn.src===zV&&(kn.src=fn.thumbnailUrl),Pn(fn)};return h.jsx(lnr,{onContextMenu:Dt=>{Dt.stopPropagation()},children:h.jsxs(snr,{children:[h.jsxs(cnr,{children:[h.jsx("span",{children:de(me?"projectPanel.Project":"projectPanel.ProjectByOtherPeople",he)+": "+c+(me?"":" ("+de("word.Owner",he)+": "+(u==null?void 0:u.substring(0,4))+"***)")+" ("+ee.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{D(),N(void 0)},onTouchStart:()=>{D(),N(void 0)},children:h.jsx(i6,{title:de("word.Close",he)})})]}),h.jsx(r9e,{items:qt,style:{backgroundColor:"white",border:"none"},onChange:Dt=>{G.current=Dt.length>0,E(!F)}}),ee.current.length>0&&h.jsxs(fnr,{children:[h.jsx(WL,{style:{width:"100%",height:Ie/2-(G.current?160:80),paddingLeft:"4px",paddingRight:"4px",overflowX:"hidden",overflowY:"auto"},grid:{column:ve,gutter:1},dataSource:ee.current,renderItem:Dt=>{var yo;const fn=Dt.title.lastIndexOf(" "),kn=w===100?8:w===125?12:30;return h.jsxs(WL.Item,{style:{marginBottom:"-28px"},onMouseOver:()=>{W(Dt)},onMouseLeave:()=>{W(void 0)},children:[h.jsx("img",{loading:"eager",width:Ae+"px",height:"auto",onError:ur=>{ur.target.src=zV},onLoad:ur=>{n(lr=>{lr.projectImages.set(Dt.title,ur.target)}),dt.getState().set(lr=>{lr.projectImagesUpdateFlag=!lr.projectImagesUpdateFlag})},alt:Dt.title,title:(Dt.timestamp?de("word.LastUpdate",he)+": "+il(new Date(Dt.timestamp)).format("MM-DD-YYYY hh:mm A")+` +`:"")+de(k===Dt?"projectPanel.SingleClickToDeselectDoubleClickToOpen":"projectPanel.SingleClickToSelectDoubleClickToOpen",he),src:(yo=Dt.thumbnail)!=null&&yo.startsWith("data:image/png;base64")?Dt.thumbnail:zV,style:{transition:".5s ease",opacity:Dt.excluded?.25:U===Dt?.5:1,padding:"1px",cursor:"pointer",borderRadius:k===Dt?"0":"10px",border:k===Dt?"2px solid red":"none"},onClick:ur=>{ur.detail===1&&setTimeout(()=>{Date.now()-le.current>=300&&fo(ur,Dt)},300),ur.detail===2&&(le.current=Date.now(),to(ur,Dt))}}),h.jsx("div",{style:{position:"relative",left:"10px",textAlign:"left",bottom:"18px",color:"white",fontSize:"8px",fontWeight:Dt.title===s?"bold":"normal"},children:Dt.title?Dt.title.length>kn?Dt.title.substring(0,Math.min(kn,fn))+"..."+Dt.title.substring(fn):Dt.title:"Unknown"}),h.jsxs("div",{style:{position:"relative",right:"10px",textAlign:"right",bottom:"36px",color:"white"},children:[Dt.title===s&&h.jsx(gtt,{style:{paddingRight:"4px",fontSize:"16px"}}),Dt.invisible?h.jsx(kZt,{onClick:()=>{Yt(Dt)},style:{fontSize:"16px"},title:de("projectPanel.DesignNotShownInSolutionSpaceClickToShow",he)}):h.jsx(K5e,{onClick:()=>{Yt(Dt)},style:{fontSize:"16px"},title:de("projectPanel.DesignShownInSolutionSpaceClickToHide",he)})]})]})}}),h.jsxs(dnr,{children:[h.jsx("span",{style:{paddingLeft:"20px"},children:de("projectPanel.SolutionSpace",he)}),h.jsxs("span",{children:[f===Pi.SOLAR_PANEL_ARRAY&&h.jsx(zl,{title:de("projectPanel.ChooseSolutionSpace",he),onOpenChange:Dt=>{oe.current&&(Dt||dt.getState().set(fn=>{fn.updateProjectsFlag=!0}),oe.current=!1)},content:Lt(),children:h.jsx(oo,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(zZt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(zl,{title:de("projectPanel.ChooseDataColoring",he),content:Ot(),children:h.jsx(oo,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(mZt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(zl,{title:de("projectPanel.GenerateScatterPlot",he),content:Zt(),children:h.jsx(oo,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(_Zt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(oo,{style:{border:"none",paddingRight:"20px",background:"white"},onClick:()=>{const Dt=document.getElementById("design-space");Dt&&Vme.saveSvgAsPng(Dt,"design-space-"+c+".png").then(()=>{yn(de("message.ScreenshotSaved",he)),a&&n(fn=>{fn.actionInfo={name:"Solution space screenshot",timestamp:new Date().getTime(),details:{image:"design-space-"+c+".png"}}})})},children:h.jsx(nd,{style:{fontSize:"24px",color:"gray"},title:de("projectPanel.SolutionSpaceScreenshot",he)})})]})]}),h.jsx(rnr,{id:"design-space",width:t*window.innerWidth,height:Ie/2-120,data:Te,types:Ce,minima:_e,maxima:Ue,filters:Le,steps:Ye,variables:se,titles:ge,units:we,digits:Se,tickIntegers:Me,hover:bt,hoveredIndex:d&&U?d.indexOf(U):-1,selectedIndex:d&&k?d.indexOf(k):-1})]})]})})}),pnr=new _t,Hw=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=g.useState(ll);return h.jsx(di,{name:e,args:[i,i,i],position:[n,o,r],onPointerOver:()=>l(Aa),onPointerOut:()=>l(ll),children:h.jsx("meshStandardMaterial",{color:a})})},DV=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=g.useState(ll);return h.jsx(Ys,{name:e,args:[i],position:[n,o,r],onPointerOver:()=>l(Aa),onPointerOut:()=>l(ll),children:h.jsx("meshStandardMaterial",{color:a})})},WUe=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=g.useState(ll),s=g.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]);return h.jsxs("group",{name:e,position:[n,o,r],rotation:[$t,0,0],onPointerOver:()=>l(Aa),onPointerOut:()=>l(ll),scale:i*4,children:[h.jsxs("group",{children:[h.jsx(O2e,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[$t,0,$t],children:s}),h.jsx(Rf,{args:[.1,.1,6],rotation:[$t,0,0],position:[.15,0,.05],children:s}),h.jsx(fH,{args:[.05,6],rotation:[0,$t,0],position:[0,0,.15],children:s})]}),h.jsx(yi,{name:e,args:[.35,.35],position:[0,.05,0],rotation:[-$t,0,0],visible:!1})]})},gnr=xe.memo(({groupedElementsIdSet:t,childCuboidSet:e,initialPosition:n,initialDimension:o,initialRotation:r})=>{const[i,a,l]=n,[s,c,u]=o,d=s===0?1:c/s,f=t.size>1||e.size>0,p=g.useRef(null),m=g.useRef(new ue),y=g.useRef(new cn),w=g.useRef(new _t),x=g.useRef(new Map),C=g.useRef(new Map),P=g.useRef(new Map),A=g.useRef(new Map),S=g.useRef(new Map),v=g.useRef(new Map),b=g.useRef(new Map),T=g.useRef(new Map),R=g.useRef(new ue),M=g.useRef(!1),D=g.useRef(new Map),k=g.useRef(new Map),N=g.useRef(new Map),U=g.useRef(new Map),W=g.useRef(new Map),[F,E]=g.useState(new ue(i,a,l)),[L,j]=g.useState(r),[Y,O]=g.useState(s/2),[_,G]=g.useState(c/2),[Q,oe]=g.useState(u),[ee,$]=g.useState(!1),[ae,Z]=g.useState("Null"),{get:ne}=ti(),te=g.useMemo(()=>new yu,[]),q=g.useMemo(()=>new _t,[]),le=H(M0),de=H(Jn),he=H(s5e),me=H(pn),ce=H(Fn);g.useEffect(()=>{oe(u)},[u]),g.useEffect(()=>{E(new ue(i,a,l)),pe(s,c),j(r)},[n,o,r]);const Pe=Qe=>{q.x=Qe.offsetX/ne().gl.domElement.clientWidth*2-1,q.y=-(Qe.offsetY/ne().gl.domElement.clientHeight)*2+1,te.setFromCamera(q,ne().camera)},pe=(Qe,nt)=>{O(Qe/2),G(nt/2)},Ie=Qe=>{$(!0),jn.getState().setEnableOrbitController(!1),M.current=!0,m.current.set(0,0,0),y.current.set(0,0,0),Se(Ho.Default),Qe.stopPropagation()},ve=(Qe,nt,mt)=>{me(tt=>{for(const gt of tt.elements)if(Cd(gt)&&Qe.has(gt.id))[gt.cx,gt.cy,gt.lx,gt.ly]=Qe.get(gt.id);else if(gt.foundationId&&Qe.has(gt.foundationId))switch(gt.type){case z.Wall:{const Ve=nt.get(gt.id);if(!Ve)continue;const je=gt,et=Ve.slice(0,3),bt=Ve.slice(3);je.cx=(et[0]+bt[0])/2,je.cy=(et[1]+bt[1])/2,je.lx=Math.hypot(et[0]-bt[0]+(et[1]-bt[1])),je.relativeAngle=Math.atan2(bt[1]-et[1],bt[0]-et[0]),je.leftPoint=[...et],je.rightPoint=[...bt];break}case z.Window:{const Ve=gt;if(Ve.parentType!==z.Roof)continue;const je=mt.get(gt.id);if(!je)continue;[Ve.cx,Ve.cy]=je;break}case z.SolarPanel:{const Ve=mt.get(gt.id);if(!Ve)continue;[gt.cx,gt.cy]=Ve;break}}tt.groupActionUpdateFlag=!tt.groupActionUpdateFlag,tt.updateElementOnRoofFlag=!0})},ze=(Qe,nt)=>{me(mt=>{for(const tt of mt.elements){if(Qe.has(tt.id)){const gt=Qe.get(tt.id);gt!==void 0&&(tt.type===z.Roof?tt.rise=gt:tt.type===z.SolarPanel?tt.cz=gt:tt.lz=gt)}if(tt.type===z.Wall&&nt.has(tt.id)){const gt=tt,Ve=nt.get(gt.id);Ve&&(gt.leftTopPartialHeight=Ve.upperLeft,gt.rightTopPartialHeight=Ve.upperRight,gt.leftUnfilledHeight=Ve.lowerLeft,gt.rightUnfilledHeight=Ve.lowerRight)}}mt.groupActionUpdateFlag=!mt.groupActionUpdateFlag,mt.updateElementOnRoofFlag=!0})},Ae=Qe=>{me(nt=>{for(const mt of nt.elements)if(Qe.has(mt.id)){const tt=Qe.get(mt.id);tt&&(mt.cx=tt[0],mt.cy=tt[1],mt.cz=tt[2],mt.rotation[2]=tt[3])}nt.groupActionUpdateFlag=!nt.groupActionUpdateFlag})},se=()=>{const Qe=new Map;for(const tt of H.getState().elements)(Cd(tt)&&t.has(tt.id)||t.has(tt.parentId))&&Qe.set(tt.id,[tt.cx,tt.cy,tt.cz,tt.rotation[2]]);const mt={name:`${ae==="Move"?"Move":"Rotate"} Foundation Group`,timestamp:Date.now(),oldPositionMap:new Map(D.current),newPositionMap:new Map(Qe),undo:()=>{Ae(mt.oldPositionMap)},redo:()=>{Ae(mt.newPositionMap)}};ce(mt)},ge=()=>{const Qe=new Map,nt=new Map,mt=new Map;for(const gt of H.getState().elements)if(Cd(gt)&&D.current.has(gt.id))Qe.set(gt.id,[gt.cx,gt.cy,gt.lx,gt.ly]);else if(k.current.has(gt.id)){const Ve=gt;nt.set(gt.id,[...Ve.leftPoint,...Ve.rightPoint])}else if(W.current.has(gt.id))if(gt.type===z.Window){const Ve=gt;if(Ve.parentType!==z.Roof)continue;mt.set(Ve.id,[Ve.cx,Ve.cy])}else gt.type===z.SolarPanel&&mt.set(gt.id,[gt.cx,gt.cy]);const tt={name:"Resize Building XY",timestamp:Date.now(),oldFoundationDataMap:new Map(D.current),newFoundationDataMap:new Map(Qe),oldWallPointsMap:new Map(k.current),newWallPointsMap:new Map(nt),oldSkylightPosMap:new Map(W.current),newSkylightPosMap:new Map(mt),undo:()=>{ve(tt.oldFoundationDataMap,tt.oldWallPointsMap,tt.oldSkylightPosMap)},redo:()=>{ve(tt.newFoundationDataMap,tt.newWallPointsMap,tt.newSkylightPosMap)}};ce(tt)},we=()=>{const Qe=new Map,nt=new Map;for(const tt of H.getState().elements)if(N.current.has(tt.id)&&(tt.type===z.Roof?Qe.set(tt.id,tt.rise):tt.type===z.SolarPanel?Qe.set(tt.id,tt.cz):Qe.set(tt.id,tt.lz)),tt.type===z.Wall&&U.current.has(tt.id)){const gt=tt;nt.set(gt.id,{lowerLeft:gt.leftUnfilledHeight,lowerRight:gt.rightUnfilledHeight,upperLeft:gt.leftTopPartialHeight,upperRight:gt.rightTopPartialHeight})}const mt={name:"Resize Building Z",timestamp:Date.now(),oldElementHeightMap:new Map(N.current),newElementHeightMap:new Map(Qe),oldPartialWallHeightMap:new Map(U.current),newPartialWallHeightMap:new Map(nt),undo:()=>{ze(mt.oldElementHeightMap,mt.oldPartialWallHeightMap)},redo:()=>{ze(mt.newElementHeightMap,mt.newPartialWallHeightMap)}};ce(mt)},Se=Qe=>{me(nt=>{nt.moveHandleType=Qe})},Me=Qe=>{const nt=new _t(Qe.x,Qe.y),mt=w.current.clone();if(f){const tt=new _t().subVectors(nt,mt),gt=Math.max(1,tt.length()),Ve=Math.sqrt(Math.pow(gt,2)/(Math.pow(d,2)+1)),je=Ve*d,et=new _t(Ve*Math.sign(tt.x),je*Math.sign(tt.y)).normalize().multiplyScalar(gt/2).add(mt);E(new ue(et.x,et.y)),pe(Ve,je),me(bt=>{const St=new Map;for(const Pt of bt.elements)if(Cd(Pt)&&(t.has(Pt.id)||e.has(Pt.id))){const Yt=b.current.get(Pt.id),zt=T.current.get(Pt.id);if(Yt&&zt){const Rt=zt[0]*Ve,Ct=zt[1]*je;if(Pt.lx=Rt,Pt.ly=Ct,Pt.parentId!==rr){const yt=St.get(Pt.parentId);if(yt){const{pos:at,rot:Et}=yt,Lt=new ue(Yt[0]*Ve+et.x,Yt[1]*je+et.y),Je=Lt.clone().sub(at).applyEuler(new cn(0,0,-Et));Pt.cx=Je.x,Pt.cy=Je.y,St.set(Pt.id,{pos:Lt.clone(),rot:Pt.rotation[2]+Et})}}else{const yt=Yt[0]*Ve+et.x,at=Yt[1]*je+et.y;Pt.cx=yt,Pt.cy=at,St.set(Pt.id,{pos:new ue(yt,at),rot:Pt.rotation[2]})}for(const yt of bt.elements)if(yt.foundationId===Pt.id)switch(yt.type){case z.Wall:{const at=yt,Et=C.current.get(at.id);if(!Et)continue;const[Lt,Je]=Et,st=[Lt.x*Rt,Lt.y*Ct,Pt.lz],It=[Je.x*Rt,Je.y*Ct,Pt.lz];at.cx=(st[0]+It[0])/2,at.cy=(st[1]+It[1])/2,at.lx=Math.hypot(st[0]-It[0]+(st[1]-It[1])),at.relativeAngle=Math.atan2(It[1]-st[1],It[0]-st[0]),at.leftPoint=[...st],at.rightPoint=[...It];break}case z.SolarPanel:{const at=yt,Et=A.current.get(at.id);if(!Et)continue;const Lt=at.parentType,[Je,st,It]=at.normal;Lt===z.Foundation||Lt===z.Roof||Lt===z.Cuboid&&ye.isEqual(It,1)?(at.cx=Et[0]*Rt,at.cy=Et[1]*Ct):Lt===z.Cuboid&&(ye.isEqual(Je,0)&&ye.isEqual(st,1)?(at.cx=Et[0]*Rt,at.cy=Ct/2):ye.isEqual(Je,0)&&ye.isEqual(st,-1)?(at.cx=Et[0]*Rt,at.cy=-Ct/2):ye.isEqual(Je,-1)&&ye.isEqual(st,0)?(at.cx=-Rt/2,at.cy=Et[1]*Ct):ye.isEqual(Je,1)&&ye.isEqual(st,0)&&(at.cx=Rt/2,at.cy=Et[1]*Ct));break}case z.Window:{const at=yt;if(at.parentType!==z.Roof)continue;const Et=A.current.get(at.id);if(!Et)continue;at.cx=Et[0]*Rt,at.cy=Et[1]*Ct;break}}}}})}else{const tt=mt.distanceTo(nt),gt=Math.atan2(nt.x-mt.x,nt.y-mt.y)+L,Ve=Math.abs(tt*Math.sin(gt)),je=Math.abs(tt*Math.cos(gt)),et=new _t().addVectors(nt,mt).multiplyScalar(.5);E(new ue(et.x,et.y)),pe(Ve,je),me(bt=>{for(const St of bt.elements)if(t.has(St.id))St.lx=Ve,St.ly=je,St.cx=et.x,St.cy=et.y;else if(St.foundationId&&t.has(St.foundationId))switch(St.type){case z.Wall:{const Pt=St,Yt=C.current.get(Pt.id);if(!Yt)continue;const[zt,Rt]=Yt,Ct=[zt.x*Ve,zt.y*je,0],yt=[Rt.x*Ve,Rt.y*je,0];Pt.cx=(Ct[0]+yt[0])/2,Pt.cy=(Ct[1]+yt[1])/2,Pt.lx=Math.hypot(Ct[0]-yt[0],Ct[1]-yt[1]),Pt.relativeAngle=Math.atan2(yt[1]-Ct[1],yt[0]-Ct[0]),Pt.leftPoint=[...Ct],Pt.rightPoint=[...yt];break}case z.SolarPanel:{const Pt=St,Yt=A.current.get(Pt.id);if(!Yt)continue;const zt=Pt.parentType,[Rt,Ct,yt]=Pt.normal;zt===z.Foundation||zt===z.Roof||zt===z.Cuboid&&ye.isEqual(yt,1)?(Pt.cx=Yt[0]*Ve,Pt.cy=Yt[1]*je):zt===z.Cuboid&&(ye.isEqual(Rt,0)&&ye.isEqual(Ct,1)?(Pt.cx=Yt[0]*Ve,Pt.cy=je/2):ye.isEqual(Rt,0)&&ye.isEqual(Ct,-1)?(Pt.cx=Yt[0]*Ve,Pt.cy=-je/2):ye.isEqual(Rt,-1)&&ye.isEqual(Ct,0)?(Pt.cx=-Ve/2,Pt.cy=Yt[1]*je):ye.isEqual(Rt,1)&&ye.isEqual(Ct,0)&&(Pt.cx=Ve/2,Pt.cy=Yt[1]*je));break}case z.Window:{const Pt=St;if(Pt.parentType!==z.Roof)continue;const Yt=A.current.get(Pt.id);if(!Yt)continue;Pt.cx=Yt[0]*Ve,Pt.cy=Yt[1]*je}}})}H.getState().updateElementOnRoofFn()},Ce=Qe=>{if(Qe.z<.1)return;const nt=Qe.z;oe(nt),me(mt=>{for(const tt of mt.elements)if(x.current.has(tt.id)){if(tt.type===z.Wall){tt.lz=nt*x.current.get(tt.id);const gt=tt;if(gt.fill===Ul.Partial){const Ve=P.current.get(gt.id);Ve&&(gt.leftTopPartialHeight=nt*Ve.upperLeft,gt.rightTopPartialHeight=nt*Ve.upperRight,gt.leftUnfilledHeight=nt*Ve.lowerLeft,gt.rightUnfilledHeight=nt*Ve.lowerRight)}}else if(tt.type===z.Roof)tt.rise=nt*x.current.get(tt.id);else if(tt.type===z.Cuboid){const gt=x.current.get(tt.id);if(gt){const Ve=gt*nt;tt.lz=Ve,tt.cz=Ve/2}}else if(tt.type===z.SolarPanel&&tt.parentType===z.Cuboid&&x.current.has(tt.parentId)){const gt=x.current.get(tt.parentId);if(gt){const Ve=gt*nt;if(ye.isEqual(tt.normal[2],1))tt.cz=Ve/2;else{const je=x.current.get(tt.id);je&&(tt.cz=je*Ve)}}}}mt.updateElementOnRoofFlag=!0})},Te=Qe=>{const nt=new ue(F.x,F.y),mt=Math.atan2(nt.x-Qe.x,Qe.y-nt.y)+(ae==="Rotate Upper"?0:Math.PI),tt=Math.abs(mt)>Math.PI?-fa:0,gt=mt+tt,Ve=new cn(0,0,gt),je=v.current.size;me(et=>{for(const bt of et.elements){if(Cd(bt)&&t.has(bt.id)&&!e.has(bt.id)){const St=S.current.get(bt.id),Pt=je!==1?v.current.get(bt.id):0;if(St&&Pt!==void 0){const Yt=St.clone().applyEuler(Ve);bt.cx=nt.x+Yt.x,bt.cy=nt.y+Yt.y,bt.rotation=[0,0,Pt+gt]}}if(bt.type!==z.Cuboid&&t.has(bt.parentId)){const St=je!==1?v.current.get(bt.parentId):0;St!==void 0&&(bt.rotation=[0,0,St+gt])}}}),j(gt)},Re=(Qe,nt)=>{const mt=new _t(F.x,F.y);w.current.set(Qe,nt).rotateAround(pnr,L).add(mt),Z("Resize XY"),b.current.clear(),T.current.clear(),C.current.clear(),D.current.clear(),k.current.clear(),A.current.clear(),W.current.clear();const[tt,gt]=[Y*2,_*2];for(const Ve of H.getState().elements)if(Cd(Ve)&&(t.has(Ve.id)||e.has(Ve.id))){const{pos:je}=ye.getWorldDataById(Ve.id);b.current.set(Ve.id,[(je.x-F.x)/tt,(je.y-F.y)/gt]),T.current.set(Ve.id,[Ve.lx/tt,Ve.ly/gt]),D.current.set(Ve.id,[Ve.cx,Ve.cy,Ve.lx,Ve.ly])}else if(Ve.foundationId&&(t.has(Ve.foundationId)||e.has(Ve.foundationId))){const je=de(Ve.foundationId);if(!je)continue;switch(Ve.type){case z.Wall:{const et=Ve,bt=new _t(et.leftPoint[0]/je.lx,et.leftPoint[1]/je.ly),St=new _t(et.rightPoint[0]/je.lx,et.rightPoint[1]/je.ly);C.current.set(et.id,[bt,St]),k.current.set(et.id,[...et.leftPoint,...et.rightPoint]);break}case z.SolarPanel:case z.Window:{const et=Ve;A.current.set(et.id,[et.cx/je.lx,et.cy/je.ly]),W.current.set(et.id,[et.cx,et.cy]);break}}}},Ne=(Qe,nt,mt)=>{const{x:tt,y:gt}=he();m.current.set(Qe,nt,mt),y.current.set(-$t,0,-Math.atan2(tt,gt)-L,"ZXY"),Z("Resize Z"),x.current.clear(),N.current.clear(),P.current.clear(),U.current.clear();for(const Ve of H.getState().elements)if(Ve.foundationId&&(t.has(Ve.foundationId)||e.has(Ve.parentId))){if(Ve.type===z.Wall){x.current.set(Ve.id,Ve.lz/Q),N.current.set(Ve.id,Ve.lz);const je=Ve;je.fill===Ul.Partial&&(U.current.set(je.id,{upperLeft:je.leftTopPartialHeight,upperRight:je.rightTopPartialHeight,lowerLeft:je.leftUnfilledHeight,lowerRight:je.rightUnfilledHeight}),P.current.set(je.id,{upperLeft:je.leftTopPartialHeight/Q,upperRight:je.rightTopPartialHeight/Q,lowerLeft:je.leftUnfilledHeight/Q,lowerRight:je.rightUnfilledHeight/Q}))}else if(Ve.type===z.Roof)x.current.set(Ve.id,Ve.rise/Q),N.current.set(Ve.id,Ve.rise);else if(Ve.type===z.SolarPanel&&Ve.parentType===z.Cuboid){const je=H.getState().elements.find(et=>et.id===Ve.parentId);je&&(x.current.set(Ve.id,Ve.cz/je.lz),N.current.set(Ve.id,Ve.cz))}}else(t.has(Ve.id)||e.has(Ve.id))&&(x.current.set(Ve.id,Ve.lz/Q),N.current.set(Ve.id,Ve.lz))},_e=Qe=>{switch(Ie(Qe),Qe.object.name){case xt.UpperLeft:{Re(Y,-_);break}case xt.UpperRight:{Re(-Y,-_);break}case xt.LowerLeft:{Re(Y,_);break}case xt.LowerRight:{Re(-Y,_);break}case xt.UpperLeftTop:{Ne(-Y,_,Q);break}case xt.UpperRightTop:{Ne(Y,_,Q);break}case xt.LowerLeftTop:{Ne(-Y,-_,Q);break}case xt.LowerRightTop:{Ne(Y,-_,Q);break}}},Ue=Qe=>{if(Ie(Qe),Z("Move"),Qe.intersections.length>0){const nt=Qe.intersections[0].point.clone().setZ(0);R.current.subVectors(F,nt);for(const mt of H.getState().elements)if(Cd(mt)&&t.has(mt.id)){const tt=new ue(mt.cx,mt.cy),gt=new ue().subVectors(tt,nt);S.current.set(mt.id,gt),D.current.set(mt.id,[mt.cx,mt.cy,mt.cz,mt.rotation[2]])}}},qe=Qe=>{if(Ie(Qe),Qe.object.name===ai.Lower?Z("Rotate Lower"):Qe.object.name===ai.Upper&&Z("Rotate Upper"),Qe.intersections.length>0){const nt=new ue(F.x,F.y);for(const mt of H.getState().elements){if(Cd(mt)&&t.has(mt.id)){const tt=new ue(mt.cx,mt.cy),gt=new ue().subVectors(tt,nt);S.current.set(mt.id,gt),v.current.set(mt.id,mt.rotation[2]),D.current.set(mt.id,[mt.cx,mt.cy,mt.cz,mt.rotation[2]])}t.has(mt.parentId)&&D.current.set(mt.id,[mt.cx,mt.cy,mt.cz,mt.rotation[2]])}}},Fe=()=>{switch(ae){case"Move":case"Rotate Lower":case"Rotate Upper":se();break;case"Resize XY":ge();break;case"Resize Z":we();break}$(!1),jn.getState().setEnableOrbitController(!0),M.current=!1,Z("Null"),Se(null),me(Qe=>{Qe.groupActionUpdateFlag=!Qe.groupActionUpdateFlag,Qe.updateWallMapOnFoundationFlag=!Qe.updateWallMapOnFoundationFlag,Qe.updateElementOnRoofFlag=!0})},He=Qe=>{if(!p.current||!M.current)return;Pe(Qe);const nt=te.intersectObjects([p.current]);if(nt.length>0){const mt=nt[0].point;switch(ae){case"Resize XY":Me(mt);break;case"Resize Z":Ce(mt);break;case"Rotate Lower":case"Rotate Upper":Te(mt);break;case"Move":E(new ue().addVectors(mt.clone().setZ(0),R.current)),me(tt=>{for(const gt of tt.elements)if(Cd(gt)&&t.has(gt.id)&&!e.has(gt.id)){const Ve=S.current.get(gt.id);Ve&&(gt.cx=mt.x+Ve.x,gt.cy=mt.y+Ve.y)}});break}}},Le=l2(),Ye=Le/2,lt=Q+Ye-Le/2,Oe=Y+Le,ut=_+Le,ht=_+Le*4;return h.jsxs("group",{name:"Group Master",position:F,rotation:[0,0,L],children:[h.jsxs("group",{name:"Resize Handle Group",onPointerDown:_e,children:[h.jsx(Hw,{args:[Y,_,Ye,Le],handleType:xt.UpperRight}),h.jsx(Hw,{args:[-Y,_,Ye,Le],handleType:xt.UpperLeft}),h.jsx(Hw,{args:[Y,-_,Ye,Le],handleType:xt.LowerRight}),h.jsx(Hw,{args:[-Y,-_,Ye,Le],handleType:xt.LowerLeft}),!le&&h.jsxs(h.Fragment,{children:[h.jsx(Hw,{args:[Y,_,lt,Le],handleType:xt.UpperRightTop}),h.jsx(Hw,{args:[-Y,_,lt,Le],handleType:xt.UpperLeftTop}),h.jsx(Hw,{args:[Y,-_,lt,Le],handleType:xt.LowerRightTop}),h.jsx(Hw,{args:[-Y,-_,lt,Le],handleType:xt.LowerLeftTop})]})]}),h.jsxs("group",{name:"Move Handle Group",onPointerDown:Ue,children:[h.jsx(DV,{args:[0,ut,Ye,Le],handleType:Ho.Upper}),h.jsx(DV,{args:[0,-ut,Ye,Le],handleType:Ho.Lower}),h.jsx(DV,{args:[Oe,0,Ye,Le],handleType:Ho.Right}),h.jsx(DV,{args:[-Oe,0,Ye,Le],handleType:Ho.Left})]}),h.jsxs("group",{name:"Rotate Handle Group",onPointerDown:qe,children:[h.jsx(WUe,{args:[0,ht,Ye,Le],handleType:ai.Upper}),h.jsx(WUe,{args:[0,-ht,Ye,Le],handleType:ai.Lower})]}),ee&&h.jsx(yi,{name:"Intersection Plane",ref:p,args:[Math.max(Y*2.4,1e3),Math.max(Y*2.4,1e3)],visible:!1,position:m.current,rotation:y.current,onPointerMove:He,onPointerUp:Fe}),h.jsx("group",{name:"Wireframe Group",position:[0,0,Q/2],children:h.jsx(o4,{hx:Y,hy:_,hz:Q/2,lineColor:"white"})})]})}),mnr=t=>t.parentId===rr&&(t.type===z.Foundation||t.type===z.Cuboid),ynr=xe.memo(()=>{H(XRt);const t=H(yPt),e=d();if(e.length===0)return null;const{allBaseElements:n,allBaseElementsVerticesMap:o,cuboidParentIdMap:r}=f(),i=new Set(e.map(w=>w.id)),a=[...e];for(const w of e)w.enableGroupMaster&&p(w);const{position:l,dimension:s,rotation:c,childCuboidIdSet:u}=m();function d(){const w=new Set;for(const x of H.getState().elements)t.has(x.id)&&(x.parentId===rr&&Cd(x)?w.add(x.id):x.foundationId&&w.add(x.foundationId));return w.size===0?[]:H.getState().elements.filter(x=>w.has(x.id))}function f(){const w=[],x=new Map,C=new Map;for(const P of H.getState().elements){if(mnr(P)){const A=ye.fetchFoundationVertexCoordinates(P);w.push(P),x.set(P.id,A)}P.type===z.Cuboid&&P.parentId!==rr&&C.set(P.id,P.parentId)}return{allBaseElements:w,allBaseElementsVerticesMap:x,cuboidParentIdMap:C}}function p(w){for(const x of n)!i.has(x.id)&&ye.areBasesOverlapped(w.id,x.id,o)&&(i.add(x.id),a.push(x),x.enableGroupMaster&&p(x))}function m(){const w=a.map(R=>ye.fetchFoundationVertexCoordinates(R)).flat(),x=new Set,C=ye.calculatePolygonBounds(w);let P=1,A=1;const S=new Map;for(const R of H.getState().elements)if(R.foundationId&&i.has(R.foundationId))if(R.type===z.Wall){const M=R;P=Math.max(P,M.lz),M.roofId&&(S.get(M.roofId)??0)H(MJe)?h.jsx(ynr,{}):null),Lue=72,NUe=xe.memo(({viewOnly:t=!1})=>{const e=H(Xp),n=dt(CTt),o=H(Qi),r=H(pn),i=dt(o5e),a=H(M0)??!1,l=H(aQ)??pL,s=H(CS),c=H(QN),u=H(G2e),d=H(RGe),f=H(h4),p=H(aSt)??"roadmap",m=dt(uQ),y=H(_M),w=H(w4),x=H($Xe),C=H(YM),P=H(qXe),A=H(mCt),S=H(Qn),v=H(sQ),b=dt(fTt),T=H(vQ),[R,M]=g.useState(!0),[D,k]=g.useState(!1),N=g.useRef(null),U=g.useRef(null),W=Kt();g.useEffect(()=>{var ee;U.current&&b.length>0&&((ee=U.current)==null||ee.scrollTo({key:b[b.length-1]}))},[b]),g.useEffect(()=>{M(!1)},[]),g.useEffect(()=>{n&&k(HR.localeCompare(n)<0)},[n]),g.useEffect(()=>{r(ee=>{var $;ee.loggable=e&&e.uid?!(($=e.email)!=null&&$.endsWith("@intofuture.org")):!1,e&&(e.noLogging||!e.schoolID||e.schoolID==="UNKNOWN SCHOOL"||!e.classID||e.classID==="UNKNOWN CLASS")&&(ee.loggable=!1)})},[e]),console.log("x");const F=e.uid&&new URLSearchParams(window.location.search).get("userid")===e.uid,E=ee=>{jn.setState($=>{if(!N.current)return $;const ae=$.pointer,Z=(100-A)*.01*window.innerWidth;return ae.x=(ee.clientX-Z)/N.current.clientWidth*2-1,ae.y=-((ee.clientY-Lue)/N.current.clientHeight)*2+1,{pointer:ae}})},L=ee=>{E(ee)},j=()=>h.jsxs(Gxt,{ref:N,shadows:!0,gl:{preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0},frameloop:"demand",style:{height:"100%",width:"100%",backgroundColor:"black"},camera:{fov:uVe,far:l,up:[0,0,1]},onPointerMove:L,children:[h.jsx(wzo,{}),h.jsx(EMo,{}),h.jsx(TMo,{}),h.jsx(n1n,{}),h.jsx(CMo,{}),h.jsxs(g.Suspense,{fallback:null,children:[h.jsx(e1n,{}),h.jsx(Anr,{})]}),h.jsxs(g.Suspense,{fallback:null,children:[u&&h.jsx(Whn,{}),h.jsx(Lhn,{theme:d}),h.jsx(a1n,{}),f&&h.jsx(wao,{})]}),h.jsx(DMo,{}),h.jsx(tnr,{}),y===ec.GENETIC_ALGORITHM&&w.geneticAlgorithmParams.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&h.jsx(fzo,{}),y===ec.GENETIC_ALGORITHM&&w.geneticAlgorithmParams.problem===Pi.SOLAR_PANEL_ARRAY&&h.jsx(pzo,{}),y===ec.PARTICLE_SWARM_OPTIMIZATION&&w.particleSwarmOptimizationParams.problem===Pi.SOLAR_PANEL_TILT_ANGLE&&h.jsx(mzo,{}),y===ec.PARTICLE_SWARM_OPTIMIZATION&&w.particleSwarmOptimizationParams.problem===Pi.SOLAR_PANEL_ARRAY&&h.jsx(Azo,{})]}),Y=g.useMemo(()=>new _t,[]),O=ee=>{r(ae=>{ae.canvasPercentWidth=Math.round(ee/window.innerWidth*100)});const $=jn.getState().canvas;if($){const{gl:ae,camera:Z}=$,ne=ee;ae.getSize(Y),ae.setSize(ne,Y.y),Z instanceof A0&&(Z.aspect=ne/Y.y,Z.updateProjectionMatrix(),Ip())}},_=lan(),G=()=>{r(ee=>{ee.viewState.showModelTree=!1,ee.canvasPercentWidth=100})},Q=()=>{const ee={name:"Close Model Tree",timestamp:Date.now(),undo:()=>{r($=>{$.viewState.showModelTree=!0,$.canvasPercentWidth=75})},redo:()=>{G()}};H.getState().addUndoable(ee),G()},oe=()=>t?h.jsxs("div",{style:{position:"absolute",bottom:"6px",left:"6px",zIndex:997,fontSize:"8px",userSelect:"none",color:f||c||v?p!=="roadmap"?"antiquewhite":"darkslategrey":"antiquewhite"},children:[h.jsx("img",{alt:"IFI Logo",src:_Me,height:"30px",style:{verticalAlign:"bottom"}})," V "+HR]}):h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"IFI Logo",src:_Me,height:c?"24px":"40px",style:{position:"absolute",bottom:"6px",left:"6px",zIndex:997,userSelect:"none"}}),h.jsxs("div",{style:{position:"absolute",bottom:"4px",left:c?"24px":"44px",zIndex:997,fontSize:"10px",userSelect:"none",pointerEvents:"none",color:f?p!=="roadmap"?"antiquewhite":"darkslategrey":c?"darkslategrey":"antiquewhite"},children:["   ©",new Date().getFullYear()," ",`${B.t("name.IFI",W)}`," ",B.t("word.VersionInitial",W)+HR+". "+B.t("word.AllRightsReserved",W)+". "]})]});return h.jsxs("div",{className:"App",style:{position:"relative",overflow:"hidden"},onContextMenu:ee=>ee.preventDefault(),children:[h.jsx(qpn,{initializing:R}),h.jsxs("div",{style:{backgroundColor:"lightblue",height:Lue+"px",paddingTop:"10px",textAlign:"start",userSelect:"none",fontSize:"30px"},children:[h.jsx(MQe,{offset:["10px","0px"],count:D?h.jsx(lZt,{style:{color:"red",cursor:"pointer"},title:B.t("message.NewVersionAvailable",W)}):void 0,children:h.jsx(Jt,{style:{marginLeft:"120px",verticalAlign:"middle",cursor:"pointer",userSelect:"none",fontSize:"30px"},title:B.t("tooltip.visitAladdinHomePage",W),onClick:ndn,children:`${B.t("name.Aladdin",W)}`})}),s&&!m&&h.jsxs("span",{style:{marginLeft:"20px",fontSize:"14px",verticalAlign:"center",userSelect:"text",color:F?"black":"gray"},children:[h.jsx("img",{title:B.t("toolbar.CloudFile",W),alt:"Cloud",src:zMo,height:32,width:32,style:{paddingRight:"8px"}}),s+(F&&i?" *":""),!t&&F&&i&&!x()&&h.jsx(oo,{type:"primary",size:"small",style:{marginLeft:"10px"},title:B.t("menu.file.SaveCloudFile",W),onClick:()=>{dt.getState().setSaveCloudFileFlag(!0),o&&C("Save Cloud File")},children:`${B.t("word.Save",W)}`})]})]}),!v&&oe(),!t&&h.jsx(dzo,{size:16,round:!0,margin:"2px",style:{position:"absolute",right:"0",top:"80px"}}),h.jsx(aao,{viewOnly:t,canvas:N.current}),h.jsx(FSo,{viewOnly:t,canvas:N.current}),h.jsx(Ytr,{}),h.jsx(Gxo,{children:h.jsxs("div",{style:{height:`calc(100vh - ${Lue}px)`},children:[c?h.jsxs(fv,{onResizeEnd:ee=>{ee[0]===0&&P(),O(ee[1])},children:[h.jsx(fv.Panel,{collapsible:!0,defaultSize:c?window.innerWidth*(1-A*.01):0,children:h.jsx(hnr,{canvas:N.current,relativeWidth:1-A*.01})}),h.jsx(fv.Panel,{children:j()})]}):h.jsx(h.Fragment,{children:v?h.jsxs(fv,{onResizeEnd:ee=>{ee[0]===0&&Q(),O(ee[1])},children:[h.jsxs(fv.Panel,{defaultSize:Math.max(200,window.innerWidth*(1-A*.01)),style:{overflow:"auto",zIndex:9},children:[h.jsxs(Jt,{style:{width:"100%",height:"36px",background:"#e8e8e8",color:"#888",alignItems:"center",display:"flex",justifyContent:"space-between",paddingLeft:"6px",paddingRight:"10px",paddingTop:"10px",paddingBottom:"10px",fontSize:"16px"},onContextMenu:ee=>{ee.preventDefault(),ee.stopPropagation()},children:[h.jsx("span",{children:B.t("menu.view.ModelTree",W)}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>Q(),onTouchStart:()=>Q(),children:h.jsx(i6,{title:B.t("word.Close",W)})})]}),S.length===0?h.jsx(w1,{style:{paddingTop:"20px"}}):h.jsx(Yee,{ref:U,virtual:!1,checkable:!1,defaultExpandAll:!0,autoExpandParent:!0,showLine:!0,showIcon:!0,expandedKeys:b,selectedKeys:b,onCheck:()=>{},onSelect:ee=>{const $=ee[0];$&&!$.includes(" ")&&T($)},onExpand:(ee,$)=>{$.expanded?T(ee[0],!0):T("none"),dt.getState().set(ae=>{ae.modelTreeExpandedKeys=[...ee]})},treeData:_,onContextMenu:ee=>{ee.preventDefault(),ee.stopPropagation()}})]}),h.jsx(fv.Panel,{children:j()})]}):h.jsx(h.Fragment,{children:j()})}),h.jsx(IMo,{canvas:N.current})]})}),h.jsx(RMo,{visible:!a}),!t&&h.jsx(gao,{}),!t&&o&&h.jsx(eHo,{})]})}),wnr=xe.memo(({viewOnly:t=!1})=>{const e=H(pn),n=H(lXe),o=H(a5e),r=H(sXe),i=dt(aXe),a=dt(iPt),l=dt(aPt),s=H(CS),c=dt(rPt),u=H(Xp),d=H(Au),[f,p]=g.useState(!1),[m,y]=g.useState(!1),[w,x]=g.useState({left:0,top:0,bottom:0,right:0}),C=g.useRef(null),{t:P}=Jl(),A=g.useMemo(()=>({lng:d}),[d]);g.useEffect(()=>{a&&(S(),dt.getState().setCreateNewFileFlag(!1))},[a]),g.useEffect(()=>{l&&(v(),dt.getState().setOpenLocalFileFlag(!1))},[l]);const S=()=>{li.confirm({title:`${P("message.DoYouWantToSaveChanges",A)}`,icon:h.jsx(_y,{}),okText:`${P("word.Yes",A)}`,cancelText:`${P("word.No",A)}`,onOk:()=>{u.uid?s?(e(N=>{N.localContentToImportAfterCloudFileUpdate="CREATE_NEW_FILE"}),dt.getState().setSaveCloudFileFlag(!0)):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):yn(P("menu.file.ToSaveYourWorkPleaseSignIn",A))},onCancel:()=>{r()}})},v=()=>{!t&&dt.getState().changed?li.confirm({title:P("message.DoYouWantToSaveChanges",A),icon:h.jsx(_y,{}),onOk:()=>{u.uid?s?b(!0):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):yn(P("menu.file.ToSaveYourWorkPleaseSignIn",A))},onCancel:()=>b(!1),okText:P("word.Yes",A),cancelText:P("word.No",A)}):b(!1)},b=N=>{document.body.onfocus=()=>{e(W=>{W.localFileDialogRequested=!1})};const U=document.getElementById("file-dialog");U.onchange=()=>{if(U.files&&U.files.length>0){dt.getState().set(E=>{E.waiting=!0});const W=new FileReader;W.readAsText(U.files[0]);const F=U.files[0].name;dt.getState().set(E=>{E.localFileName=F}),W.onload=()=>{if(W.result){const E=JSON.parse(W.result.toString());N?s&&(e(L=>{L.localContentToImportAfterCloudFileUpdate=E}),dt.getState().setSaveCloudFileFlag(!0)):o(E)}U.value=""}}},U.click()},T=()=>{let N=c.trim();if(N.length>0){N.endsWith(".ala")||(N+=".ala");const U=new Blob([JSON.stringify(n())],{type:"application/json"});return Tot.saveAs(U,N),dt.getState().set(W=>{W.localFileName=N}),e(W=>{W.cloudFile=void 0}),!0}else return co(P("menu.file.SavingAbortedMustHaveValidFileName",A)+"."),!1},R=(N,U)=>{if(C.current){const{clientWidth:W,clientHeight:F}=window.document.documentElement,E=C.current.getBoundingClientRect();x({left:-E.left+U.x,right:W-(E.right-U.x),top:-E.top+U.y,bottom:F-((E==null?void 0:E.bottom)-U.y)})}},M=()=>{p(!0),T()&&dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1}),p(!1)},D=()=>{dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1})},k=()=>{s&&dt.getState().set(N=>{N.localFileName=s,N.localFileName.endsWith(".ala")||(N.localFileName+=".ala")})};return h.jsx(h.Fragment,{children:h.jsx(li,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>y(!0),onMouseOut:()=>y(!1),children:P("menu.file.SaveAsLocalFile",A)}),footer:s?[h.jsx(oo,{onClick:k,children:P("menu.file.UseCloudFileName",A)},"Apply"),h.jsx(oo,{onClick:D,children:P("word.Cancel",A)},"Cancel"),h.jsx(oo,{type:"primary",onClick:M,disabled:!c,children:P("word.OK",A)},"OK")]:[h.jsx(oo,{onClick:D,children:P("word.Cancel",A)},"Cancel"),h.jsx(oo,{type:"primary",onClick:M,disabled:!c,children:P("word.OK",A)},"OK")],open:i,confirmLoading:f,onCancel:D,modalRender:N=>h.jsx(Vi,{disabled:!m,bounds:w,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:C,children:N})}),children:h.jsx(Vl,{placeholder:"File name",value:c,onPressEnter:M,onChange:N=>{dt.getState().set(U=>{U.localFileName=N.target.value})}})})})}),xnr=()=>{const t=H(DTt),e=H(w=>w.world),n=H(w=>w.elements),o=H(w=>w.viewState),r=H(w=>w.notes),i=dt(vs),a=dt(n6),l=dt(RTt),s=dt(HTt),c=H(SCt),u=H(TCt),d=H(CCt),f=H(ITt),p=new URLSearchParams(window.location.search),m=p.get("viewonly")==="true",y=p.get("map")==="true";return g.useEffect(()=>{c(),u(),d(),f(),dt.getState().set(w=>{w.openModelsMap=y,y&&(w.modelsMapFlag=!0,w.modelsMapWeatherStations=!1,w.leaderboardFlag=!0,w.showLeaderboard=!0)})},[]),g.useEffect(()=>{dt.getState().skipChange?s(!1):dt.getState().changed||l(!0)},[e,o,n,r]),g.useEffect(()=>{i&&dt.getState().set(w=>{w.showSolarRadiationHeatmap=!1}),a&&dt.getState().set(w=>{w.showHeatFluxes=!1})},[n]),h.jsx(n2,{locale:t,children:h.jsxs(Phn,{children:[m?h.jsx(NUe,{viewOnly:!0}):h.jsx(vnr,{children:h.jsx(NUe,{viewOnly:!1})}),h.jsx(wnr,{viewOnly:m})]})})},vnr=xe.memo(({children:t})=>(["iir3sv1kW1Vzbj9sOA46RfLWKCU2"].find(n=>n===H.getState().user.uid),h.jsx(Rhn,{onBeforeunload:()=>"",children:t}))),bnr=eYe(document.getElementById("root"));bnr.render(h.jsx(xnr,{}))});export default Snr(); diff --git a/index.html b/index.html index 1d4699fc..52c85288 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@ } Aladdin - +