@osamash/floor-planner 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/floor-planner.es.js
CHANGED
|
@@ -38503,7 +38503,7 @@ function $8(n, e, t, r, i, s, o, a, l, c) {
|
|
|
38503
38503
|
}
|
|
38504
38504
|
function lh(n, e) {
|
|
38505
38505
|
n.traverse((t) => {
|
|
38506
|
-
t instanceof wn && (t.interact = e);
|
|
38506
|
+
(t instanceof wn || t.isMesh) && (t.interact = e);
|
|
38507
38507
|
});
|
|
38508
38508
|
}
|
|
38509
38509
|
function ch(n, e) {
|
|
@@ -45916,7 +45916,7 @@ function qC({ catalog: n, has3dView: e }) {
|
|
|
45916
45916
|
selectToolDrawingLine: a
|
|
45917
45917
|
} = Wt(), { mode: l, alterate: c } = t, [h, f] = un(null);
|
|
45918
45918
|
return /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
|
|
45919
|
-
/* @__PURE__ */ C.jsxs("aside", { className: "floor_planner-toolbar -mt-[
|
|
45919
|
+
/* @__PURE__ */ C.jsxs("aside", { className: "floor_planner-toolbar -mt-[20px] absolute left-2 !pt-3 top-1/2 -translate-y-1/2 z-[1] rounded max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]", children: [
|
|
45920
45920
|
/* @__PURE__ */ C.jsx(
|
|
45921
45921
|
Ar,
|
|
45922
45922
|
{
|
|
@@ -3919,7 +3919,7 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
|
|
|
3919
3919
|
\r
|
|
3920
3920
|
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r
|
|
3921
3921
|
\r
|
|
3922
|
-
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};function M6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Xe([t.properties.get("color")]):t.properties.get("colors"),o=new qt;o.name="streak";let a=0;for(let l=0;l<=e;l+=i){const c=[new G(0,0,-l),new G(n,0,-l)],h=new tr().setFromPoints(c),f=s.get(a%s.size),p=new vu({color:f}),d=new vl(h,p);o.add(d),o.add(new vl(h,p)),a++}return o}function w6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Xe([t.properties.get("color")]):t.properties.get("colors"),o=new qt;o.name="streak";let a=0;for(let l=0;l<=n;l+=i){const c=[new G(l,0,0),new G(l,0,-e)],h=new tr().setFromPoints(c),f=s.get(a%s.size),p=new vu({color:f});o.add(new vl(h,p)),a++}return o}function T6(n){const e=new qt;e.name="grid",new x6().parse(b6);const{grids:r,width:i,height:s}=n;return r.forEach(o=>{switch(o.type){case"horizontal-streak":e.add(M6(i,s,o));break;case"vertical-streak":e.add(w6(i,s,o));break}}),e.position.y=-1,e}function A6(n){n&&n.dispose&&n.dispose()}function C6(n){n&&n.dispose&&n.dispose()}function Dv(n){if(n){if(Array.isArray(n)){n.forEach(e=>Dv(e));return}for(const e in n){const t=n[e];t instanceof Dn&&C6(t)}n.dispose()}}function Nv(n){(n instanceof Tn||n instanceof d4||n instanceof vl)&&(A6(n.geometry),Dv(n.material),n.geometry=null,n.material=null)}function R6(n){n.traverse(e=>{Nv(e)})}function Ou(n){n.traverse(e=>{Nv(e)})}function P6(n,e,t){const r={sceneGraph:{unit:n.unit,layers:{},busyResources:{layers:{}},width:n.width,height:n.height,LODs:{}},plan:new qt,grid:T6(n),boundingBox:new bi};r.plan.name="plan",r.grid.name="grid",r.boundingBox.setFromObject(r.grid);let i=[];return n.layers.forEach(s=>{(s.id===n.selectedLayer||s.visible)&&(i=i.concat(qu(s,r,n,e,t)))}),Promise.all(i).then(()=>$i(r)),r}function qu(n,e,t,r,i){const s=[];return e.sceneGraph.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{},visible:n.visible,altitude:n.altitude},e.sceneGraph.busyResources.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{}},n.lines.forEach(o=>{s.push(io(t,e,n,o.id,i,r.linesActions)),o.holes.forEach(a=>{s.push(ha(t,e,n,a,i,r.holesActions))})}),n.areas.forEach(o=>{s.push(Rl(t,e,n,o.id,i,r.areaActions))}),n.items.forEach(o=>{s.push(Du(t,e,n,o.id,i,r.itemsActions))}),s}function I6(n,e,t,r,i,s){const o=r.map(l=>({op:l.op,path:l.path.split("/"),value:l.value}));let a=z6(o,e,t);return a=a.filter(({path:l})=>l[3]!=="selected"),a=a.filter(({path:l})=>l[1]!=="groups"),a.forEach(({op:l,path:c,value:h})=>{if(c[1]==="layers"){const f=e.getIn(["layers",c[2]]);if(c.length===3&&l==="remove")O6(c[2],n);else if(c.length>3)switch(l){case"replace":Cl(c,f,n,i,e,t,s);break;case"add":q6(c,f,n,i,e,t,s);break;case"remove":L6(c,f,n,i,e,t,s);break}}else if(c[1]==="selectedLayer"){const f=h,p=e.getIn(["layers",f]);if(!p.visible){const m=qu(p,n,e,i,s);Promise.all(m).then(()=>$i(n))}const d=n.sceneGraph.layers[(t==null?void 0:t.selectedLayer)??""];if(d&&!d.visible){for(let m in d.lines)Xi(n,d.id,m);for(let m in d.areas)Ss(n,d.id,m);for(let m in d.items)Es(n,d.id,m);for(let m in d.holes)ji(n,d.id,m)}}}),n}function Cl(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"vertices":if(n[5]!=="selected"){const d=e.getIn(["vertices",n[4]]);if((n[5]==="x"||n[5]==="y")&&(d.lines.forEach(m=>{const x=s.getIn(["layers",e.id,"lines",m,"holes"]);return x&&x.forEach(v=>{Cl([0,0,0,"holes",v,"selected"],e,t,r,i,s,o)}),Cl([0,0,0,"lines",m],e,t,r,i,s,o)}),d.areas.forEach(m=>Cl([0,0,0,"areas",m],e,t,r,i,s,o))),n[5]==="areas"){let m=d.getIn(["areas",~~n[6]]);Cl([0,0,0,"areas",m],e,t,r,i,s,o)}}break;case"holes":const l=e.getIn(["holes",n[4]]);if(o.getElement(l.type).updateRender3D)a.push(D6(i,s,t,e,n[4],n.slice(5),o,r.holesActions,()=>ji(t,e.id,l.id),()=>ha(i,t,e,l.id,o,r.holesActions)));else{let d=l.line;n[5]==="selected"?(ji(t,e.id,l.id),a.push(ha(i,t,e,l.id,o,r.holesActions))):(e.getIn(["lines",d,"holes"]).forEach(m=>{ji(t,e.id,m)}),Xi(t,e.id,d),a.push(io(i,t,e,d,o,r.linesActions)),e.getIn(["lines",d,"holes"]).forEach(m=>{a.push(ha(i,t,e,m,o,r.holesActions))}))}break;case"lines":const c=e.getIn(["lines",n[4]]);o.getElement(c.type).updateRender3D?a.push(N6(i,s,t,e,n[4],n.slice(5),o,r.linesActions,()=>Xi(t,e.id,n[4]),()=>io(i,t,e,n[4],o,r.linesActions))):(Xi(t,e.id,n[4]),a.push(io(i,t,e,n[4],o,r.linesActions)));break;case"areas":const h=e.getIn(["areas",n[4]]);o.getElement(h.type).updateRender3D?a.push(U6(i,s,t,e,n[4],n.slice(5),o,r.areaActions,()=>Ss(t,e.id,n[4]),()=>Rl(i,t,e,n[4],o,r.areaActions))):(t.sceneGraph.layers[e.id].areas[n[4]]&&Ss(t,e.id,n[4]),a.push(Rl(i,t,e,n[4],o,r.areaActions)));break;case"items":const f=e.getIn(["items",n[4]]);o.getElement(f.type).updateRender3D?a.push(F6(i,s,t,e,n[4],n.slice(5),o,r.itemsActions,()=>Es(t,e.id,n[4]),()=>Du(i,t,e,n[4],o,r.itemsActions))):(Es(t,e.id,n[4]),a.push(Du(i,t,e,n[4],o,r.itemsActions)));break;case"visible":if(e.visible)a=a.concat(qu(e,t,i,r,o));else{let d=t.sceneGraph.layers[e.id];for(let m in d.lines)Xi(t,e.id,m);for(let m in d.areas)Ss(t,e.id,m);for(let m in d.items)Es(t,e.id,m);for(let m in d.holes)ji(t,e.id,m)}break;case"opacity":case"altitude":let p=t.sceneGraph.layers[e.id];for(let d in p.lines)Xi(t,e.id,d);for(let d in p.areas)Ss(t,e.id,d);for(let d in p.items)Es(t,e.id,d);for(let d in p.holes)ji(t,e.id,d);a=a.concat(qu(e,t,i,r,o))}Promise.all(a).then(()=>$i(t))}function L6(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"lines":const l=n[4];s.getIn(["layers",e.id,"lines",l,"holes"]).forEach(c=>{ji(t,e.id,c)}),Xi(t,e.id,l),n.length>5&&(a.push(io(i,t,e,l,o,r.linesActions)),e.getIn(["lines",l,"holes"]).forEach(c=>{a.push(ha(i,t,e,c,o,r.holesActions))}));break;case"areas":n.length===5&&Ss(t,e.id,n[4]);break;case"items":n.length===5&&Es(t,e.id,n[4]);break}Promise.all(a).then(()=>$i(t))}function O6(n,e){let t=e.sceneGraph.layers[n];for(let r in t.lines)Xi(e,n,r);for(let r in t.areas)Ss(e,n,r);for(let r in t.items)Es(e,n,r);for(let r in t.holes)ji(e,n,r);delete e.sceneGraph.layers[n]}function ji(n,e,t){if(n.sceneGraph.busyResources.layers[e].holes[t]){setTimeout(()=>ji(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].holes[t]=!0;let r=n.sceneGraph.layers[e].holes[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].holes[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].holes[t]=!1}function Xi(n,e,t){if(n.sceneGraph.busyResources.layers[e].lines[t]){setTimeout(()=>Xi(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].lines[t]=!0;let r=n.sceneGraph.layers[e].lines[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].lines[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].lines[t]=!1}function Ss(n,e,t){if(n.sceneGraph.busyResources.layers[e].areas[t]){setTimeout(()=>Ss(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].areas[t]=!0;let r=n.sceneGraph.layers[e].areas[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].areas[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].areas[t]=!1}function Es(n,e,t){if(n.sceneGraph.busyResources.layers[e].items[t]){setTimeout(()=>Es(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].items[t]=!0;let r=n.sceneGraph.layers[e].items[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].items[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].items[t]=!1}function q6(n,e,t,r,i,s,o){if(n.length===5){let a=null,l=null;switch(n[3]){case"lines":a=io,l=r.linesActions;break;case"areas":a=Rl,l=r.areaActions;break;case"items":a=Du,l=r.itemsActions;break;case"holes":a=ha,l=r.holesActions;break}a&&a(i,t,e,n[4],o,l).then(()=>$i(t))}}function ha(n,e,t,r,i,s){const o=t.getIn(["holes",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof gu&&(e.sceneGraph.LODs[r]=a);const l=new qt;l.name="pivot",l.add(a);const c=t.getIn(["lines",o.line]);let h=t.vertices.get(c.vertices.get(0)),f=t.vertices.get(c.vertices.get(1)),p=o.offset;if(h.x>f.x){const E=h;h=f,f=E,p=1-p}let d=Math.sqrt(Math.pow(h.x-f.x,2)+Math.pow(h.y-f.y,2)),m=Math.asin((f.y-h.y)/d),x=new bi().setFromObject(l),v=[(x.max.x-x.min.x)/2+x.min.x,(x.max.y-x.min.y)/2+x.min.y,(x.max.z-x.min.z)/2+x.min.z],_=o.properties.getIn(["altitude","length"]),b=o.properties.getIn(["height","length"]);l.rotation.y=m,l.position.x=h.x+d*p*Math.cos(m)-v[2]*Math.sin(m),l.position.y=_+b/2-v[1]+t.altitude,l.position.z=-h.y-d*p*Math.sin(m)-v[2]*Math.cos(m),e.plan.add(l),e.sceneGraph.layers[t.id].holes[o.id]=l,Nu(l,()=>s.selectHole(t.id,o.id));let M=t.opacity;o.selected&&(M=1),Uu(l,M)})}function D6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["holes",i]),f=e.getIn(["layers",r.id,"holes",i]),p=t.sceneGraph.layers[r.id].holes[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function io(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].lines[r]){setTimeout(()=>io(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].lines[r]=!0;const o=t.getIn(["lines",r]);let a=t.vertices.get(o.vertices.get(0)),l=t.vertices.get(o.vertices.get(1));if(a.x>l.x){let c=a;a=l,l=c}return i.getElement(o.type).render3D(o,t,n).then(c=>{c instanceof gu&&(e.sceneGraph.LODs[o.id]=c);let h=new qt;h.name="pivot",h.add(c),h.position.x=a.x,h.position.y=t.altitude,h.position.z=-a.y,e.plan.add(h),e.sceneGraph.layers[t.id].lines[r]=h,Nu(h,()=>s.selectLine(t.id,o.id));let f=t.opacity;o.selected&&(f=1),Uu(h,f),e.sceneGraph.busyResources.layers[t.id].lines[r]=!1})}function N6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["lines",i]),f=e.getIn(["layers",r.id,"lines",i]),p=t.sceneGraph.layers[r.id].lines[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Rl(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].areas[r]){setTimeout(()=>Rl(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].areas[r]=!0;const o=t.getIn(["areas",r]),a=()=>s.selectArea(t.id,r);return i.getElement(o.type).render3D(o,t,n).then(l=>{l instanceof gu&&(e.sceneGraph.LODs[r]=l);let c=new qt;c.name="pivot",c.add(l),c.position.y=t.altitude,e.plan.add(c),e.sceneGraph.layers[t.id].areas[r]=c,Nu(c,a);let h=t.opacity;o.selected&&(h=1),Uu(c,h),e.sceneGraph.busyResources.layers[t.id].areas[r]=!1})}function U6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["areas",i]),f=e.getIn(["layers",r.id,"areas",i]),p=t.sceneGraph.layers[r.id].areas[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Du(n,e,t,r,i,s){const o=t.getIn(["items",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof gu&&(e.sceneGraph.LODs[r]=a);const l=new qt;l.name="pivot",l.add(a),l.rotation.y=o.rotation*Math.PI/180,l.position.x=o.x,l.position.y=t.altitude,l.position.z=-o.y,Nu(a,()=>{s.selectItem(t.id,o.id)});let c=t.opacity;o.selected&&(c=1),Uu(l,c),e.plan.add(l),e.sceneGraph.layers[t.id].items[o.id]=l})}function F6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["items",i]),f=e.getIn(["layers",r.id,"items",i]),p=t.sceneGraph.layers[r.id].items[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Nu(n,e){n.traverse(t=>{t instanceof Tn&&(t.interact=e)})}function Uu(n,e){n.traverse(t=>{t instanceof Tn&&(t.material instanceof Array?t.material.forEach(r=>{r.transparent=!0,r.maxOpacity?r.opacity=Math.min(r.maxOpacity,e):r.opacity&&r.opacity>e&&(r.maxOpacity=r.opacity,r.opacity=e)}):(t.material.transparent=!0,t.material.maxOpacity?t.material.opacity=Math.min(t.material.maxOpacity,e):t.material.opacity&&t.material.opacity>e&&(t.material.maxOpacity=t.material.opacity,t.material.opacity=e)))})}function $i(n){let e=new bi().setFromObject(n.plan);if(isFinite(e.max.x)&&isFinite(e.min.x)&&isFinite(e.max.y)&&isFinite(e.min.y)&&isFinite(e.max.z)&&isFinite(e.min.z)){let t=new G((e.max.x-e.min.x)/2+e.min.x,(e.max.y-e.min.y)/2+e.min.y,(e.max.z-e.min.z)/2+e.min.z);n.plan.position.sub(t),n.grid.position.sub(t),e.min.sub(t),e.max.sub(t),n.boundingBox=e}}function z6(n,e,t){return k6(B6(V6(n)),e,t)}function k6(n,e,t){let r,i;for(i=0;i<n.length&&!r;i++)n[i].path[1]==="selectedLayer"&&(r=n[i]);return r&&!e.getIn(["layers",t.selectedLayer,"visible"])?n.filter(({op:s,path:o})=>!(o[o.length-1]==="selected"&&o[1]==="layers"&&o[2]===t.selectedLayer)&&!(s==="remove"&&o.indexOf(t.selectedLayer)!==-1)):n}function B6(n,e,t){const r={};return n.forEach(({path:i})=>{i[5]==="selected"&&(r[i[4]]=i[4])}),n.filter(({path:i})=>i[5]==="properties"?!r[i[4]]:!0)}function V6(n,e,t){const r={};return n.filter(({path:i})=>i[5]==="properties"?r[i[4]]?!1:r[i[4]]=!0:i[5]!=="misc")}const Uv={type:"change"},Gp={type:"start"},Fv={type:"end"},Fu=new ru,zv=new ys,H6=Math.cos(70*Vb.DEG2RAD),xn=new G,nr=2*Math.PI,zt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Wp=1e-6;class G6 extends m4{constructor(e,t=null){super(e,t),this.state=zt.NONE,this.target=new G,this.cursor=new G,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=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.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qo.ROTATE,MIDDLE:qo.DOLLY,RIGHT:qo.PAN},this.touches={ONE:Do.ROTATE,TWO:Do.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new G,this._lastQuaternion=new fs,this._lastTargetPosition=new G,this._quat=new fs().setFromUnitVectors(e.up,new G(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new rv,this._sphericalDelta=new rv,this._scale=1,this._panOffset=new G,this._rotateStart=new Fe,this._rotateEnd=new Fe,this._rotateDelta=new Fe,this._panStart=new Fe,this._panEnd=new Fe,this._panDelta=new Fe,this._dollyStart=new Fe,this._dollyEnd=new Fe,this._dollyDelta=new Fe,this._dollyDirection=new G,this._mouse=new Fe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=j6.bind(this),this._onPointerDown=W6.bind(this),this._onPointerUp=X6.bind(this),this._onContextMenu=e8.bind(this),this._onMouseWheel=K6.bind(this),this._onKeyDown=Z6.bind(this),this._onTouchStart=J6.bind(this),this._onTouchMove=Q6.bind(this),this._onMouseDown=$6.bind(this),this._onMouseMove=Y6.bind(this),this._interceptControlDown=t8.bind(this),this._interceptControlUp=n8.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Uv),this.update(),this.state=zt.NONE}update(e=null){const t=this.object.position;xn.copy(t).sub(this.target),xn.applyQuaternion(this._quat),this._spherical.setFromVector3(xn),this.autoRotate&&this.state===zt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let r=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(r)&&isFinite(i)&&(r<-Math.PI?r+=nr:r>Math.PI&&(r-=nr),i<-Math.PI?i+=nr:i>Math.PI&&(i-=nr),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(xn.setFromSpherical(this._spherical),xn.applyQuaternion(this._quatInverse),t.copy(this.target).add(xn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=xn.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new G(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new G(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=xn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Fu.origin.copy(this.object.position),Fu.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Fu.direction))<H6?this.object.lookAt(this.target):(zv.setFromNormalAndCoplanarPoint(this.object.up,this.target),Fu.intersectPlane(zv,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Wp||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Wp||this._lastTargetPosition.distanceToSquared(this.target)>Wp?(this.dispatchEvent(Uv),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?nr/60*this.autoRotateSpeed*e:nr/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){xn.setFromMatrixColumn(t,0),xn.multiplyScalar(-e),this._panOffset.add(xn)}_panUp(e,t){this.screenSpacePanning===!0?xn.setFromMatrixColumn(t,1):(xn.setFromMatrixColumn(t,0),xn.crossVectors(this.object.up,xn)),xn.multiplyScalar(e),this._panOffset.add(xn)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;xn.copy(i).sub(this.target);let s=xn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(nr*this._rotateDelta.x/t.clientHeight),this._rotateUp(nr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(nr*this._rotateDelta.x/t.clientHeight),this._rotateUp(nr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Fe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,r={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:r.deltaY*=16;break;case 2:r.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(r.deltaY*=10),r}}function W6(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n)))}function j6(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function X6(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Fv),this.state=zt.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function $6(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qo.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=zt.DOLLY;break;case qo.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}break;case qo.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Y6(n){switch(this.state){case zt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case zt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case zt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function K6(n){this.enabled===!1||this.enableZoom===!1||this.state!==zt.NONE||(n.preventDefault(),this.dispatchEvent(Gp),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Fv))}function Z6(n){this.enabled!==!1&&this._handleKeyDown(n)}function J6(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case Do.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=zt.TOUCH_ROTATE;break;case Do.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=zt.TOUCH_PAN;break;default:this.state=zt.NONE}break;case 2:switch(this.touches.TWO){case Do.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=zt.TOUCH_DOLLY_PAN;break;case Do.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=zt.TOUCH_DOLLY_ROTATE;break;default:this.state=zt.NONE}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Q6(n){switch(this._trackPointer(n),this.state){case zt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case zt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case zt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case zt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=zt.NONE}}function e8(n){this.enabled!==!1&&n.preventDefault()}function t8(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function n8(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const fa=n=>Bt(n),da=n=>Bn(n),pa=n=>mt.isRecord(n),Yi=(n,e,t)=>n==="remove"?{op:n,path:e}:{op:n,path:e,value:t},r8=(n,e,t)=>{const r=[];for(let i=0;i<n;i++){r[i]=new Array(e);for(let s=0;s<e;s++)r[i][s]=t}return r},jp=mt({op:"=",val:null}),i8=mt({op:"!=",val:null,newVal:null}),s8=(n,e)=>{const t=o8(n,e);return a8(t,n,e,n.size??0,e.size??0)},o8=(n,e)=>{const t=n.size??0,r=e.size??0,i=r8(t+1,r+1,0);for(let s=0;s<t;s++)for(let o=0;o<r;o++)Kt(n.get(s),e.get(o))?i[s+1][o+1]=i[s][o]+1:i[s+1][o+1]=Math.max(i[s+1][o],i[s][o+1]);return i},a8=(n,e,t,r,i)=>{const s=[];let o=r-1,a=i-1;for(;o>=0||a>=0;)o>=0&&a>=0&&Kt(e.get(o),t.get(a))?(s.push(new jp({op:"=",val:e.get(o)})),o--,a--):o>=0&&a>=0&&o===a&&!Kt(e.get(o),t.get(a))?(s.push(new i8({val:e.get(o),newVal:t.get(o)})),o--,a--):a>=0&&(o===-1||n[o+1][a]>=n[o][a+1])?(s.push(new jp({op:"+",val:t.get(a)})),a--):o>=0&&(a===-1||n[o+1][a]<n[o][a+1])&&(s.push(new jp({op:"-",val:e.get(o)})),o--);return s.reverse()},l8=/\//g,c8=/~/g,so=n=>{if(typeof n=="number")return n.toString();if(typeof n!="string")throw new Error(`param str (${String(n)}) is not a string`);return n.replace(c8,"~0").replace(l8,"~1")},vr=(n,e)=>`${n}/${e}`,Pl=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;const i=da(n)&&da(e);let s=null,o=null;return n.forEach&&n.forEach((a,l)=>{if(e.has(l))if(pa(a)&&pa(e.get(l)))r=r.concat(Xp(a,e.get(l),vr(t,so(l))));else if(fa(a)&&fa(e.get(l)))r=r.concat(Pl(a,e.get(l),vr(t,so(l))));else if(da(a)&&da(e.get(l)))r=r.concat(kv(a,e.get(l),vr(t,so(l))));else{const c=e.get?e.get(l):e;a!==c&&r.push(Yi("replace",vr(t,so(l)),c))}else i?(o=s!=null&&Number(s)+1===l?o:l,r.push(Yi("remove",vr(t,so(o)))),s=l):r.push(Yi("remove",vr(t,so(l))))}),e.forEach((a,l)=>{n.has&&!n.has(l)&&r.push(Yi("add",vr(t,so(l)),a))}),r},Xp=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;const i=n.toSeq().toMap(),s=e.toSeq().toMap();return r=r.concat(Pl(i,s,t)),r},kv=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;if((n.count()+1)*(e.count()+1)>=1e4)return Pl(n,e,t);const i=s8(n,e);let s=0;return i.forEach(o=>{if(o.op==="=")s++;else if(o.op==="!="){if(pa(o.val)&&pa(o.newVal)){const a=Xp(o.val,o.newVal,vr(t,String(s)));r=r.concat(a)}else if(fa(o.val)&&fa(o.newVal)){const a=Pl(o.val,o.newVal,vr(t,String(s)));r=r.concat(a)}else r.push(Yi("replace",vr(t,String(s)),o.newVal));s++}else o.op==="+"?(r.push(Yi("add",vr(t,String(s)),o.val)),s++):o.op==="-"&&r.push(Yi("remove",vr(t,String(s))))}),r},u8=(n,e,t="")=>n===e?[]:[Yi("replace",vr(t,""),e)],h8=(n,e,t="")=>Kt(n,e)?Xe():n!=e&&(n==null||e==null)?At([Yi("replace","/",e)]):da(n)&&da(e)?At(kv(n,e)):pa(n)&&pa(e)?At(Xp(n,e)):fa(n)&&fa(e)?At(Pl(n,e)):At(u8(n,e,t));class f8 extends se.Component{constructor(t){super(t);ut(this,"canvasWrapperRef",se.createRef());ut(this,"renderer");ut(this,"scene3D",null);ut(this,"camera",null);ut(this,"orbitControls",null);ut(this,"planData");ut(this,"renderingID",0);ut(this,"width");ut(this,"height");ut(this,"lastMousePosition",{});ut(this,"mouseDownEvent");ut(this,"mouseUpEvent");this.width=t.width,this.height=t.height,this.renderer=new v6({preserveDrawingBuffer:!0,antialias:!0})}componentDidMount(){const{state:t,actions:r}=this.props,i={areaActions:r.areaActions,holesActions:r.holesActions,itemsActions:r.itemsActions,linesActions:r.linesActions,projectActions:r.projectActions},s=t.scene,o=this.canvasWrapperRef.current,a=new mM;this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.outputColorSpace=pr,this.renderer.useLegacyLights=!1,this.renderer.setClearColor(new St(Fc.white));const l=P6(s,i,this.props.catalog);a.add(l.plan),a.add(l.grid);const c=this.width/this.height,h=new _r(45,c,1,3e5);a.add(h);const f=-(l.boundingBox.max.x-l.boundingBox.min.x)/2,p=(l.boundingBox.max.y-l.boundingBox.min.y)/2*10,d=(l.boundingBox.max.z-l.boundingBox.min.z)/2;h.position.set(f,p,d),h.up.set(0,1,0);const m=new l4(Fc.white,.3);m.position.set(f,p,d),a.add(m),a.add(new ev(11513775)),a.add(new ev(16777215,.7));const x=new u4(16777215,.6);x.position.set(100,200,100),x.castShadow=!0,a.add(x);const v=[l.plan],_=new Fe,b=new f4;this.mouseDownEvent=T=>{this.lastMousePosition.x=T.offsetX/this.width*2-1,this.lastMousePosition.y=-T.offsetY/this.height*2+1},this.mouseUpEvent=T=>{var q,O;if(T.preventDefault(),_.x=T.offsetX/this.width*2-1,_.y=-(T.offsetY/this.height)*2+1,Math.abs(_.x-(this.lastMousePosition.x??0))<=.02&&Math.abs(_.y-(this.lastMousePosition.y??0))<=.02){b.setFromCamera(_,h);const A=b.intersectObjects(v,!0);A.length>0&&!isNaN(A[0].distance)?(O=(q=A[0].object).interact)==null||O.call(q):this.props.actions.projectActions.unselectAll()}},this.renderer.domElement.addEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.addEventListener("mouseup",this.mouseUpEvent),o&&o.appendChild(this.renderer.domElement);const M=new G6(h,this.renderer.domElement);M.enableDamping=!0,M.dampingFactor=.05;const E=new qt;E.name="spotLightTarget",E.position.copy(M.target),a.add(E),m.target=E;const S=()=>{M.update(),m.position.copy(h.position),E.position.copy(M.target);for(const T in l.sceneGraph.LODs)l.sceneGraph.LODs[T].update(h);this.renderer.render(a,h),this.renderingID=requestAnimationFrame(S)};S(),this.orbitControls=M,this.camera=h,this.scene3D=a,this.planData=l}componentWillUnmount(){var t;cancelAnimationFrame(this.renderingID),(t=this.orbitControls)==null||t.dispose(),this.renderer.domElement.removeEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.removeEventListener("mouseup",this.mouseUpEvent),this.scene3D&&(R6(this.scene3D),this.scene3D.remove(this.planData.plan),this.scene3D.remove(this.planData.grid)),this.scene3D=null,this.planData=null,this.camera=null,this.orbitControls=null,this.renderer.renderLists.dispose()}componentDidUpdate(t){const{width:r,height:i}=this.props;if(this.width=r,this.height=i,this.camera&&(this.camera.aspect=r/i,this.camera.updateProjectionMatrix()),t.state.scene!==this.props.state.scene){const s=h8(t.state.scene,this.props.state.scene),o={areaActions:this.props.actions.areaActions,holesActions:this.props.actions.holesActions,itemsActions:this.props.actions.itemsActions,linesActions:this.props.actions.linesActions,projectActions:this.props.actions.projectActions};I6(this.planData,this.props.state.scene,t.state.scene,s.toJS(),o,this.props.catalog)}this.renderer.setSize(r,i)}render(){return se.createElement("div",{ref:this.canvasWrapperRef})}}const d8={color:Ut.PRIMARY_COLOR.alt,fontWeight:300};function p8({children:n,style:e={},...t}){return R.jsx("h1",{style:{...d8,...e},...t,children:n})}const m8={padding:"0 20px",overflowY:"auto"};function g8({children:n,width:e,height:t,style:r={}}){return R.jsx("div",{style:{width:e,height:t,...m8,...r},onWheel:i=>i.stopPropagation(),children:n})}var Bv={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Vv=se.createContext&&se.createContext(Bv),_8=["attr","size","title"];function v8(n,e){if(n==null)return{};var t=x8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function x8(n,e){if(n==null)return{};var t={};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(e.indexOf(r)>=0)continue;t[r]=n[r]}return t}function zu(){return zu=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},zu.apply(this,arguments)}function Hv(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ku(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hv(Object(t),!0).forEach(function(r){y8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hv(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function y8(n,e,t){return e=S8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function S8(n){var e=E8(n,"string");return typeof e=="symbol"?e:e+""}function E8(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Gv(n){return n&&n.map((e,t)=>se.createElement(e.tag,ku({key:t},e.attr),Gv(e.child)))}function yn(n){return e=>se.createElement(b8,zu({attr:ku({},n.attr)},e),Gv(n.child))}function b8(n){var e=t=>{var{attr:r,size:i,title:s}=n,o=v8(n,_8),a=i||t.size||"1em",l;return t.className&&(l=t.className),n.className&&(l=(l?l+" ":"")+n.className),se.createElement("svg",zu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,o,{className:l,style:ku(ku({color:n.color||t.color},t.style),n.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&se.createElement("title",null,s),n.children)};return Vv!==void 0?se.createElement(Vv.Consumer,null,t=>e(t)):e(Bv)}function M8(n){return yn({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"},child:[]}]})(n)}function w8(n){return yn({attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"},child:[]}]})(n)}function T8(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"},child:[]}]})(n)}function A8(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"},child:[]}]})(n)}function C8(n){return yn({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"},child:[]}]})(n)}function R8(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304.083 405.907c4.686 4.686 4.686 12.284 0 16.971l-44.674 44.674c-59.263 59.262-155.693 59.266-214.961 0-59.264-59.265-59.264-155.696 0-214.96l44.675-44.675c4.686-4.686 12.284-4.686 16.971 0l39.598 39.598c4.686 4.686 4.686 12.284 0 16.971l-44.675 44.674c-28.072 28.073-28.072 73.75 0 101.823 28.072 28.072 73.75 28.073 101.824 0l44.674-44.674c4.686-4.686 12.284-4.686 16.971 0l39.597 39.598zm-56.568-260.216c4.686 4.686 12.284 4.686 16.971 0l44.674-44.674c28.072-28.075 73.75-28.073 101.824 0 28.072 28.073 28.072 73.75 0 101.823l-44.675 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.598 39.598c4.686 4.686 12.284 4.686 16.971 0l44.675-44.675c59.265-59.265 59.265-155.695 0-214.96-59.266-59.264-155.695-59.264-214.961 0l-44.674 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.597 39.598zm234.828 359.28l22.627-22.627c9.373-9.373 9.373-24.569 0-33.941L63.598 7.029c-9.373-9.373-24.569-9.373-33.941 0L7.029 29.657c-9.373 9.373-9.373 24.569 0 33.941l441.373 441.373c9.373 9.372 24.569 9.372 33.941 0z"},child:[]}]})(n)}const Wv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .15s ease-in-out",WebkitTransition:"all .15s ease-in-out",alignSelf:"center",justifySelf:"center"},P8={...Wv,background:Ut.SECONDARY_COLOR.main},jv={width:"100%",textAlign:"center",display:"block",marginBottom:".5em",textTransform:"capitalize"},I8={...jv,color:Ut.COLORS.white},L8={width:"100%",height:"8em",position:"relative",overflow:"hidden",border:"solid 1px #e6e6e6",padding:0,margin:0,marginBottom:"5px"},Xv={position:"absolute",background:"#222",width:"100%",height:"100%",backgroundSize:"contain",backgroundPosition:"50% 50%",backgroundColor:Ut.COLORS.white,backgroundRepeat:"no-repeat",transition:"all .2s ease-in-out"},O8={...Xv,transform:"scale(1.2)"},q8={marginTop:"1.5em",color:Ut.SECONDARY_COLOR.main,fontSize:"2em",opacity:"0.7",width:"100%"},D8={display:"block",height:"2em",margin:"0 auto",fontSize:"0.75em",fontStyle:"italic",lineHeight:"1em",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},N8={listStyle:"none",margin:"0px",padding:"0px",fontSize:"11px",marginBottom:"3px"},U8={display:"inline-block",background:"#337ab7",color:Ut.COLORS.white,padding:"1px 4px",marginRight:"3px",borderRadius:"3px"},$v=({element:n})=>{const[e,t]=se.useState(!1),{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=Ht(),a=()=>{switch(n.prototype){case"lines":r(n.name);break;case"items":i(n.name);break;case"holes":s(n.name);break}o(n)};return R.jsxs("div",{style:e?P8:Wv,onClick:a,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:[R.jsx("b",{style:e?I8:jv,children:n.info.title}),R.jsx("div",{style:L8,children:R.jsx("div",{style:{...e?O8:Xv,backgroundImage:"url("+n.info.image+")"},children:e?R.jsx(A8,{style:q8}):null})}),R.jsx("ul",{style:N8,children:n.info.tag.map((l,c)=>R.jsx("li",{style:U8,children:l},c))}),R.jsx("div",{style:D8,children:n.info.description})]})};function F8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3v7.12zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8h1.5z"},child:[]}]})(n)}function z8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"},child:[]}]})(n)}function k8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"},child:[]}]})(n)}function B8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(n)}function Yv(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(n)}function V8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 8h-6V5h6v6zm-8-6v6H5V5h6zm-6 8h6v6H5v-6zm8 6v-6h6v6h-6z"},child:[]}]})(n)}const H8={margin:"1.5em",display:"flex"},Kv={fontSize:"20px",cursor:"pointer"},G8={...Kv,fontWeight:"bolder",color:Ut.SECONDARY_COLOR.main},W8={fill:Ut.COLORS.black,fontSize:"24px",marginLeft:"10px",marginRight:"10px"},j8=({names:n})=>{let e=n.map((t,r)=>{let i=r===n.length-1;return R.jsxs("div",{style:{display:"flex"},children:[R.jsx("div",{style:i?G8:Kv,onClick:t.action||null,children:t.name}),i?null:R.jsx(Yv,{style:W8})]},r)});return R.jsx("div",{style:H8,children:e})},Zv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",margin:"0.3em",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out"},X8={...Zv,background:Ut.SECONDARY_COLOR.main},Jv={position:"absolute",color:Ut.COLORS.black,fontSize:"5em",width:"100%"},$8={...Jv,color:Ut.SECONDARY_COLOR.main},Y8={background:Ut.COLORS.white,marginBottom:"5px",border:"solid 1px #e6e6e6",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},K8=({page:n})=>{const[e,t]=se.useState(!1),{goBackToCatalogPage:r}=Ht(),i=s=>{r(s)};return R.jsx("div",{style:e?X8:Zv,onClick:()=>i(n.name),onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:R.jsx("div",{style:Y8,children:R.jsx(B8,{style:e?$8:Jv})})})},Z8={position:"fixed",width:"calc( 100% - 51px)",height:"calc( 100% - 20px)",backgroundColor:"#FFF",padding:"1em",left:50,overflowY:"auto",overflowX:"hidden",zIndex:10},J8={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(14em, 1fr))",gridGap:"10px",marginTop:"1em"},Qv={width:"100%",height:"3em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out",marginBottom:"1em"},Q8={width:"8em",display:"inline-block"},eA={width:"calc( 100% - 10em )",height:"2em",margin:"0",padding:"0 1em",border:"1px solid #EEE"},tA={...Qv,padding:"0.2em 0.625em"},nA={width:"auto",height:"2em",lineHeight:"2em",textAlign:"center",borderRadius:"1em",display:"inline-block",cursor:"pointer",backgroundColor:Ut.PRIMARY_COLOR.alt,color:Ut.PRIMARY_COLOR.text_main,textTransform:"capitalize",margin:"0.25em",padding:"0 1em"},rA=({width:n,height:e,style:t,catalog:r})=>{const{planner:i,goBackToCatalogPage:s,selectToolDrawingHole:o,selectToolDrawingItem:a,selectToolDrawingLine:l,pushLastSelectedCatalogElementToHistory:c}=Ht();let h=i.catalog.page;const f=r.getCategory(h);let p=f.elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);const[d,m]=se.useState(""),[x,v]=se.useState([]);let _=null;if(h!=="root"){let A=[];i.catalog.path.forEach(L=>{A.push({name:r.getCategory(L).label,action:()=>s(L)})}),A.push({name:f.label,action:""}),_=R.jsx(j8,{names:A})}let b=i.catalog.path.size,M=b>0?R.jsx(K8,{page:r.categories[i.catalog.path.get(b-1)]},b):null,E=i.get("selectedElementsHistory"),S=E.map((A,L)=>R.jsx("div",{style:nA,title:A.name,onClick:()=>O(A),children:A.name},L));const T=A=>{let L=[];for(let N=0;N<A.length;N++){let Z=A[N];L=L.concat(Z.elements),Z.categories.length&&(L=L.concat(T(Z.categories)))}return L},q=A=>{let L=p.concat(T(f.categories)),N=[];if(A!=""){let Z=new RegExp(A,"i");for(let K=0;K<L.length;K++)Z.test(L[K].info.title)&&N.push(L[K])}m(A),v(N)},O=A=>{switch(A.prototype){case"lines":l(A.name);break;case"items":a(A.name);break;case"holes":o(A.name);break}c(A)};return R.jsxs(g8,{width:n,height:e,style:{...Z8,...t},children:[R.jsx(p8,{children:"Catalog"}),_,R.jsxs("div",{style:Qv,children:[R.jsx("span",{style:Q8,children:"Search Element"}),R.jsx("input",{type:"text",style:eA,onChange:A=>{q(A.target.value)}})]}),E.size?R.jsxs("div",{style:tA,children:[R.jsx("span",{children:"Last Selected"}),S]}):null,R.jsx("div",{style:J8,children:d===""?[M,p.map(A=>R.jsx($v,{element:A},A.name))]:x.map(A=>R.jsx($v,{element:A},A.name))})]})},iA={MODE_IDLE:rn,MODE_2D_ZOOM_IN:qs,MODE_2D_ZOOM_OUT:Ds,MODE_2D_PAN:Ns,MODE_WAITING_DRAWING_LINE:Fr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_HOLE:Vr,MODE_ROTATING_ITEM:qi};function sA({width:n,height:e,catalog:t}){const r=Ht(),{planner:i}=r,{mode:s}=i;return s===Oi?R.jsx(f8,{width:n,height:e,state:i,catalog:t,actions:{areaActions:{selectArea:r.selectArea},holesActions:{selectHole:r.selectHole,selectToolDrawingHole:r.selectToolDrawingHole,updateDrawingHole:r.updateDrawingHole,endDrawingHole:r.endDrawingHole,beginDraggingHole:r.beginDraggingHole,updateDraggingHole:r.updateDraggingHole,endDraggingHole:r.endDraggingHole},itemsActions:{selectItem:r.selectItem,selectToolDrawingItem:r.selectToolDrawingItem,updateDrawingItem:r.updateDrawingItem,endDrawingItem:r.endDrawingItem,beginDraggingItem:r.beginDraggingItem,updateDraggingItem:r.updateDraggingItem,endDraggingItem:r.endDraggingItem,beginRotatingItem:r.beginRotatingItem,updateRotatingItem:r.updateRotatingItem,endRotatingItem:r.endRotatingItem},linesActions:{selectLine:r.selectLine,selectToolDrawingLine:r.selectToolDrawingLine,beginDrawingLine:r.beginDrawingLine,updateDrawingLine:r.updateDrawingLine,endDrawingLine:r.endDrawingLine,beginDraggingLine:r.beginDraggingLine,updateDraggingLine:r.updateDraggingLine,endDraggingLine:r.endDraggingLine},projectActions:{loadProject:r.loadProject,newProject:r.newProject,openCatalog:r.openCatalog,changeCatalogPage:r.changeCatalogPage,goBackToCatalogPage:r.goBackToCatalogPage,selectToolEdit:r.selectToolEdit,unselectAll:r.unselectAll,setProperties:r.setProperties,setItemsAttributes:r.setItemsAttributes,setLinesAttributes:r.setLinesAttributes,setHolesAttributes:r.setHolesAttributes,remove:r.remove,undo:r.undo,rollback:r.rollback,openProjectConfigurator:r.openProjectConfigurator,initCatalog:r.initCatalog,updateMouseCoord:r.updateMouseCoord,updateZoomScale:r.updateZoomScale,toggleSnap:r.toggleSnap,copyProperties:r.copyProperties,pasteProperties:r.pasteProperties,pushLastSelectedCatalogElementToHistory:r.pushLastSelectedCatalogElementToHistory,setAlterateState:r.setAlterateState,setMode:r.setMode,addHorizontalGuide:r.addHorizontalGuide,addVerticalGuide:r.addVerticalGuide,removeHorizontalGuide:r.removeHorizontalGuide,removeVerticalGuide:r.removeVerticalGuide}}}):s===Mo?R.jsx(R.Fragment,{}):s===sf?R.jsx(rA,{width:n,height:e,catalog:t}):iA[s]?R.jsx(QE,{width:n,height:e,catalog:t}):s===$0?R.jsx(R.Fragment,{}):null}function oA(n){return yn({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"},child:[]}]})(n)}function aA(n){return yn({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM10.5 7.5v6m3-3h-6"},child:[]}]})(n)}const lA=(n,e,t,r,i)=>r+(i-r)*(n-e)/(t-e),cA=({sidebarWidth:n})=>{const{planner:e,viewer:t}=Ht(),{mode:r,mouse:i,zoom:s}=e,o=a=>{const l=parseInt(z1(s).toFixed());if(l===0&&a==="out"||l===100&&a==="in"||!t)return;const c=t==null?void 0:t.getValue(),h=c.viewerWidth/2,f=c.viewerHeight/2,p=a==="in"?-1:1,d=1.06,m=Math.max(-1,Math.min(1,p)),x=lA(m,-1,1,d,1/d);t.zoom(h,f,x)};if(of.includes(r))return R.jsx("div",{className:"floor_planner-footerbar absolute rounded-tl w-auto z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] h-5 select-none cursor-default bottom-0 leading-[14px] text-white m-0",style:{right:n},children:R.jsx("div",{className:"relative float-left inline-block",title:"Scene Zoom Level",children:R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx(oA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("out")})," ",R.jsxs("span",{children:[z1(s).toFixed(),"%"]})," ",R.jsx(aA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("in")})]})})})};function ex(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=ex(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function uA(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=ex(n))&&(r&&(r+=" "),r+=e);return r}const $p="-",hA=n=>{const e=dA(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split($p);return a[0]===""&&a.length!==1&&a.shift(),tx(a,e)||fA(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},tx=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?tx(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join($p);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},nx=/^\[(.+)\]$/,fA=n=>{if(nx.test(n)){const e=nx.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},dA=n=>{const{theme:e,classGroups:t}=n,r={nextPart:new Map,validators:[]};for(const i in t)Yp(t[i],r,i,e);return r},Yp=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:rx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(pA(i)){Yp(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Yp(o,rx(e,s),t,r)})})},rx=(n,e)=>{let t=n;return e.split($p).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},pA=n=>n.isThemeGetter,mA=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},Kp="!",Zp=":",gA=Zp.length,_A=n=>{const{prefix:e,experimentalParseClassName:t}=n;let r=i=>{const s=[];let o=0,a=0,l=0,c;for(let m=0;m<i.length;m++){let x=i[m];if(o===0&&a===0){if(x===Zp){s.push(i.slice(l,m)),l=m+gA;continue}if(x==="/"){c=m;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=s.length===0?i:i.substring(l),f=vA(h),p=f!==h,d=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:d}};if(e){const i=e+Zp,s=r;r=o=>o.startsWith(i)?s(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(t){const i=r;r=s=>t({className:s,parseClassName:i})}return r},vA=n=>n.endsWith(Kp)?n.substring(0,n.length-1):n.startsWith(Kp)?n.substring(1):n,xA=n=>{const e=Object.fromEntries(n.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let s=[];return r.forEach(o=>{o[0]==="["||e[o]?(i.push(...s.sort(),o),s=[]):s.push(o)}),i.push(...s.sort()),i}},yA=n=>({cache:mA(n.cacheSize),parseClassName:_A(n),sortModifiers:xA(n),...hA(n)}),SA=/\s+/,EA=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=n.trim().split(SA);let l="";for(let c=a.length-1;c>=0;c-=1){const h=a[c],{isExternal:f,modifiers:p,hasImportantModifier:d,baseClassName:m,maybePostfixModifierPosition:x}=t(h);if(f){l=h+(l.length>0?" "+l:l);continue}let v=!!x,_=r(v?m.substring(0,x):m);if(!_){if(!v){l=h+(l.length>0?" "+l:l);continue}if(_=r(m),!_){l=h+(l.length>0?" "+l:l);continue}v=!1}const b=s(p).join(":"),M=d?b+Kp:b,E=M+_;if(o.includes(E))continue;o.push(E);const S=i(_,v);for(let T=0;T<S.length;++T){const q=S[T];o.push(M+q)}l=h+(l.length>0?" "+l:l)}return l};function bA(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=ix(e))&&(r&&(r+=" "),r+=t);return r}const ix=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=ix(n[r]))&&(t&&(t+=" "),t+=e);return t};function MA(n,...e){let t,r,i,s=o;function o(l){const c=e.reduce((h,f)=>f(h),n());return t=yA(c),r=t.cache.get,i=t.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const h=EA(l,t);return i(l,h),h}return function(){return s(bA.apply(null,arguments))}}const Sn=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},sx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ox=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wA=/^\d+\/\d+$/,TA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ma=n=>wA.test(n),vt=n=>!!n&&!Number.isNaN(Number(n)),bs=n=>!!n&&Number.isInteger(Number(n)),Jp=n=>n.endsWith("%")&&vt(n.slice(0,-1)),Ki=n=>TA.test(n),IA=()=>!0,LA=n=>AA.test(n)&&!CA.test(n),ax=()=>!1,OA=n=>RA.test(n),qA=n=>PA.test(n),DA=n=>!et(n)&&!tt(n),NA=n=>ga(n,fx,ax),et=n=>sx.test(n),oo=n=>ga(n,dx,LA),Qp=n=>ga(n,BA,vt),lx=n=>ga(n,ux,ax),UA=n=>ga(n,hx,qA),Bu=n=>ga(n,px,OA),tt=n=>ox.test(n),Il=n=>_a(n,dx),FA=n=>_a(n,VA),cx=n=>_a(n,ux),zA=n=>_a(n,fx),kA=n=>_a(n,hx),Vu=n=>_a(n,px,!0),ga=(n,e,t)=>{const r=sx.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},_a=(n,e,t=!1)=>{const r=ox.exec(n);return r?r[1]?e(r[1]):t:!1},ux=n=>n==="position"||n==="percentage",hx=n=>n==="image"||n==="url",fx=n=>n==="length"||n==="size"||n==="bg-size",dx=n=>n==="length",BA=n=>n==="number",VA=n=>n==="family-name",px=n=>n==="shadow",HA=MA(()=>{const n=Sn("color"),e=Sn("font"),t=Sn("text"),r=Sn("font-weight"),i=Sn("tracking"),s=Sn("leading"),o=Sn("breakpoint"),a=Sn("container"),l=Sn("spacing"),c=Sn("radius"),h=Sn("shadow"),f=Sn("inset-shadow"),p=Sn("text-shadow"),d=Sn("drop-shadow"),m=Sn("blur"),x=Sn("perspective"),v=Sn("aspect"),_=Sn("ease"),b=Sn("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...E(),tt,et],T=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto","contain","none"],O=()=>[tt,et,l],A=()=>[ma,"full","auto",...O()],L=()=>[bs,"none","subgrid",tt,et],N=()=>["auto",{span:["full",bs,tt,et]},bs,tt,et],Z=()=>[bs,"auto",tt,et],K=()=>["auto","min","max","fr",tt,et],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ce=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...O()],oe=()=>[ma,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],B=()=>[n,tt,et],xe=()=>[...E(),cx,lx,{position:[tt,et]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",zA,NA,{size:[tt,et]}],pe=()=>[Jp,Il,oo],Se=()=>["","none","full",c,tt,et],be=()=>["",vt,Il,oo],V=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[vt,Jp,cx,lx],ue=()=>["","none",m,tt,et],ye=()=>["none",vt,tt,et],Q=()=>["none",vt,tt,et],Le=()=>[vt,tt,et],le=()=>[ma,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ki],breakpoint:[Ki],color:[IA],container:[Ki],"drop-shadow":[Ki],ease:["in","out","in-out"],font:[DA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ki],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ki],shadow:[Ki],spacing:["px",vt],text:[Ki],"text-shadow":[Ki],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ma,et,tt,v]}],container:["container"],columns:[{columns:[vt,et,tt,a]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[bs,"auto",tt,et]}],basis:[{basis:[ma,"full","auto",a,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[vt,ma,"auto","initial","none",et]}],grow:[{grow:["",vt,tt,et]}],shrink:[{shrink:["",vt,tt,et]}],order:[{order:[bs,"first","last","none",tt,et]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...ce()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...ce(),"baseline"]}],"place-self":[{"place-self":["auto",...ce()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:oe()}],w:[{w:[a,"screen",...oe()]}],"min-w":[{"min-w":[a,"screen","none",...oe()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...oe()]}],h:[{h:["screen","lh",...oe()]}],"min-h":[{"min-h":["screen","lh","none",...oe()]}],"max-h":[{"max-h":["screen","lh",...oe()]}],"font-size":[{text:["base",t,Il,oo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tt,Qp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jp,et]}],"font-family":[{font:[FA,et,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,tt,et]}],"line-clamp":[{"line-clamp":[vt,"none",tt,Qp]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",tt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[vt,"from-font","auto",tt,oo]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[vt,"auto",tt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",tt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:xe()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},bs,tt,et],radial:["",tt,et],conic:[bs,tt,et]},kA,UA]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:Se()}],"rounded-s":[{"rounded-s":Se()}],"rounded-e":[{"rounded-e":Se()}],"rounded-t":[{"rounded-t":Se()}],"rounded-r":[{"rounded-r":Se()}],"rounded-b":[{"rounded-b":Se()}],"rounded-l":[{"rounded-l":Se()}],"rounded-ss":[{"rounded-ss":Se()}],"rounded-se":[{"rounded-se":Se()}],"rounded-ee":[{"rounded-ee":Se()}],"rounded-es":[{"rounded-es":Se()}],"rounded-tl":[{"rounded-tl":Se()}],"rounded-tr":[{"rounded-tr":Se()}],"rounded-br":[{"rounded-br":Se()}],"rounded-bl":[{"rounded-bl":Se()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[vt,tt,et]}],"outline-w":[{outline:["",vt,Il,oo]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",h,Vu,Bu]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,Vu,Bu]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[vt,oo]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",p,Vu,Bu]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[vt,tt,et]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[vt]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[tt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[vt]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:xe()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tt,et]}],filter:[{filter:["","none",tt,et]}],blur:[{blur:ue()}],brightness:[{brightness:[vt,tt,et]}],contrast:[{contrast:[vt,tt,et]}],"drop-shadow":[{"drop-shadow":["","none",d,Vu,Bu]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",vt,tt,et]}],"hue-rotate":[{"hue-rotate":[vt,tt,et]}],invert:[{invert:["",vt,tt,et]}],saturate:[{saturate:[vt,tt,et]}],sepia:[{sepia:["",vt,tt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",tt,et]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[vt,tt,et]}],"backdrop-contrast":[{"backdrop-contrast":[vt,tt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",vt,tt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[vt,tt,et]}],"backdrop-invert":[{"backdrop-invert":["",vt,tt,et]}],"backdrop-opacity":[{"backdrop-opacity":[vt,tt,et]}],"backdrop-saturate":[{"backdrop-saturate":[vt,tt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",vt,tt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[vt,"initial",tt,et]}],ease:[{ease:["linear","initial",_,tt,et]}],delay:[{delay:[vt,tt,et]}],animate:[{animate:["none",b,tt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,tt,et]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Q()}],"scale-x":[{"scale-x":Q()}],"scale-y":[{"scale-y":Q()}],"scale-z":[{"scale-z":Q()}],"scale-3d":["scale-3d"],skew:[{skew:Le()}],"skew-x":[{"skew-x":Le()}],"skew-y":[{"skew-y":Le()}],transform:[{transform:[tt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",tt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",tt,et]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[vt,Il,oo,Qp]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ti(...n){return HA(uA(n))}const mx=({children:n,name:e,...t})=>{const[r,i]=se.useState(t.opened||!1);return R.jsxs("div",{className:"select-none",style:{borderBottom:"1px solid #5e5e5e"},children:[R.jsxs("div",{className:"flex px-4 pt-2.5 pb-3 items-center gap-1 bg-[#2b2b2b] text-white cursor-pointer",onClick:()=>i(!r),children:[r?R.jsx(M8,{size:16}):R.jsx(w8,{size:16}),R.jsx("span",{className:"text-sm leading-none",children:e})]}),R.jsx("div",{className:Ti("text-[11px] text-[#EBEBEB] border border-[#222222] bg-[#424242]",r?"block":"hidden"),children:n})]})};function ti({children:n,style:e,className:t,...r}){return R.jsx("label",{className:Ti("mb-1 text-xs capitalize font-bold text-white block",t),style:e,...r,children:n})}const Zi=({value:n,min:e,max:t,precision:r,onChange:i,onValid:s,onInvalid:o,style:a,placeholder:l})=>{const[c,h]=se.useState(!0),[f,p]=se.useState(n);let d=new RegExp(`^-?([0-9]+)?\\.?([0-9]{0,${r}})?$`);se.useEffect(()=>{e!==void 0&&!isNaN(e)&&isFinite(e)&&Number(f)<e&&p(e),t&&!isNaN(t)&&isFinite(t)&&Number(f)>t&&p(t)},[e,t,f]);const m=se.useMemo(()=>parseFloat(String(n)).toFixed(r)!==parseFloat(String(f)).toFixed(r),[n,f,r]),x=v=>{if(v.stopPropagation(),c){let _=f!==""&&f!=="-"?parseFloat(String(f)):0;p(_),i({target:{value:_}})}};return R.jsxs("div",{className:"relative w-full",children:[R.jsx("input",{type:"text",value:d.test(String(f))?f:parseFloat(String(f)).toFixed(r),className:"block text-[13px] text-white h-[35px] w-full px-2 leading-5 rounded border border-[#5e5e5e] bg-[#2b2b2b] outline-none focus:outline-none",style:{...a},onChange:v=>{let _=d.test(v.target.value);_?(p(v.target.value),s&&s(v.nativeEvent)):o&&o(v.nativeEvent),h(_)},onKeyDown:v=>{var _=v.keyCode||v.which;(_==Tr.ENTER||_==Tr.TAB)&&m&&x(v)},placeholder:l}),R.jsx("div",{onClick:v=>{m&&x(v)},title:"Confirm",className:"absolute cursor-pointer w-[2em] h-[2em] text-white top-[0.35em] right-[0.35em] bg-dark-blue",style:{transition:"all 0.1s linear",visibility:m?"visible":"hidden",opacity:m?"1":"0"},children:R.jsx(F8,{style:{width:"100%",height:"100%",padding:"0.2em",color:"#FFF"}})})]})},GA={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}},WA={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}},jA={metric:GA,imperial:WA,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},XA={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}},$A={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}},YA={metric:XA,imperial:$A,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},KA={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}},ZA={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}},JA={metric:KA,imperial:ZA,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},QA={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}},e7={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}},t7={metric:QA,imperial:e7,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},n7={metric:{ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}},imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},r7={metric:{C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}},imperial:{F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}},_anchors:{metric:{unit:"C",transform:function(n){return n/(5/9)+32}},imperial:{unit:"F",transform:function(n){return(n-32)*(5/9)}}}},gx=365.25,i7={metric:{ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:3600},d:{name:{singular:"Day",plural:"Days"},to_anchor:3600*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:3600*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:3600*24*gx/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:3600*24*gx}},_anchors:{metric:{unit:"s",ratio:1}}},s7={bits:{b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}},bytes:{B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}},_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},o7={metric:{ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}},imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},a7={metric:{"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}},imperial:{"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}},_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},l7={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}},c7={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}},u7={metric:l7,imperial:c7,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},h7={metric:{A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}},_anchors:{metric:{unit:"A",ratio:1}}},f7={metric:{V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}},_anchors:{metric:{unit:"V",ratio:1}}},d7={metric:{W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}},_anchors:{metric:{unit:"W",ratio:1}}},p7={metric:{VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}},_anchors:{metric:{unit:"VAR",ratio:1}}},m7={metric:{VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}},_anchors:{metric:{unit:"VA",ratio:1}}},g7={metric:{Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}},_anchors:{metric:{unit:"J",ratio:1}}},_7={metric:{VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}},_anchors:{metric:{unit:"VARh",ratio:1}}},v7={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}},x7={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}},y7={metric:v7,imperial:x7,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},S7={metric:{lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}},imperial:{"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}},_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},E7={metric:{mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}},_anchors:{frequency:{unit:"hz",ratio:1}}},Ms={length:jA,area:YA,mass:JA,volume:t7,each:n7,temperature:r7,time:i7,digital:s7,partsPer:o7,speed:a7,pressure:u7,current:h7,voltage:f7,power:d7,reactivePower:p7,apparentPower:m7,energy:g7,reactiveEnergy:_7,volumeFlowRate:y7,illuminance:S7,frequency:E7};function Ll(n){return Object.keys(n)}function _x(n){return{abbr:n.abbr,measure:n.measure,system:n.system,singular:n.unit.name.singular,plural:n.unit.name.plural}}function Lr(n,e){if(Array.isArray(n))for(let t=0;t<n.length;t++)e(n[t],t,n);else if(n&&typeof n=="object")for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(n[t],t,n)}class b7{constructor(e,t){ut(this,"val");ut(this,"destination");ut(this,"origin");this.val=t?e/t:e}from(e){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(e),this.origin||this.throwUnsupportedUnitError(e),this}to(e){if(!this.origin)throw new Error(".to must be called after .from");if(this.destination=this.getUnit(e),this.destination||this.throwUnsupportedUnitError(e),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!==this.origin.measure)throw new Error(`Cannot convert incompatible measures of ${this.destination.measure} and ${this.origin.measure}`);let t=this.val*this.origin.unit.to_anchor;if(this.origin.unit.anchor_shift&&(t-=this.origin.unit.anchor_shift),this.origin.system!==this.destination.system){const r=Ms[this.origin.measure]._anchors[this.origin.system];t=typeof r.transform=="function"?r.transform(t):t*r.ratio}return this.destination.unit.anchor_shift&&(t+=this.destination.unit.anchor_shift),t/this.destination.unit.to_anchor}toBest(e){if(!this.origin)throw new Error(".toBest must be called after .from");const t={exclude:[],cutOffNumber:1,...e};let r=null;return Lr(this.possibilities(),i=>{if(t.exclude.includes(i))return;const s=this.describe(i);if(s.system!==this.origin.system)return;const o=this.to(i);(!r||o>=t.cutOffNumber&&o<r.val)&&(r={val:o,unit:i,singular:s.singular,plural:s.plural})}),r}getUnit(e){let t=null;return Lr(Ms,(r,i)=>{Lr(r,(s,o)=>{o!=="_anchors"&&Lr(s,(a,l)=>{l===e&&(t={abbr:e,measure:i,system:o,unit:a})})})}),t}describe(e){const t=this.getUnit(e);return t||this.throwUnsupportedUnitError(e),_x(t)}list(e){const t=[];return Lr(Ms,(r,i)=>{e&&e!==i||Lr(r,(s,o)=>{o!=="_anchors"&&Lr(s,(a,l)=>{t.push(_x({abbr:l,measure:i,system:o,unit:a}))})})}),t}throwUnsupportedUnitError(e){const t=[];throw Lr(Ms,r=>{Lr(r,(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})}),new Error(`Unsupported unit ${e}, use one of: ${t.join(", ")}`)}possibilities(e){const t=[];if(!this.origin&&!e)Lr(Ll(Ms),r=>{Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})});else{const r=e||this.origin.measure;Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})}return t}measures(){return Ll(Ms)}}function ni(n){return new b7(n)}const M7={fontSize:"13px",WebkitAppearance:"none"};function em({children:n,style:e,...t}){return R.jsx("select",{className:"w-full cursor-pointer block px-2 outline-none rounded h-[35px] text-white bg-[#5e5e5e]",style:{...M7,...e},...t,children:n})}const tm=({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s})=>{const{planner:o}=Ht(),a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r,d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},onChange:m=>d(m.target.value,c),onValid:t,...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.jsx("option",{value:m,children:m},m))})})]})]})},Ol=({style:n,...e})=>R.jsx("input",{className:"block w-full px-2 text-sm leading-5 bg-[#2b2b2b] rounded border border-[#5e5e5e] outline-none h-[35px] text-white",style:{...n},type:"text",...e}),w7=({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i})=>{const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{value:n,onChange:a=>o(a.target.value)})]})},T7=({element:n,attributeFormData:e,onUpdate:t,...r})=>{let i=e.has("name")?e.get("name"):n.name,s=e.has("offsetA")?e.get("offsetA"):n.offsetA,o=e.has("offsetB")?e.get("offsetB"):n.offsetA;return R.jsxs("div",{children:[R.jsx(w7,{value:i,onUpdate:a=>t("name",a),configs:{label:"Nome"},...r}),R.jsx(tm,{value:s,onUpdate:a=>t("offsetA",a),configs:{label:"Offset 1",min:0,max:1/0,precision:2},...r}),R.jsx(tm,{value:o,onUpdate:a=>t("offsetB",a),configs:{label:"Offset 2",min:0,max:1/0,precision:2},...r})]})},A7=({element:n,onUpdate:e,attributeFormData:t,...r})=>{let i=t.has("name")?t.get("name"):n.name,s=t.has("x")?t.get("x"):n.x,o=t.has("y")?t.get("y"):n.y,a=t.has("rotation")?t.get("rotation"):n.rotation;return R.jsx("table",{className:"w-full",children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:i,onChange:l=>e("name",l.target.value),style:{textAlign:"left"}})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:s,onChange:l=>e("x",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:o,onChange:l=>e("y",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Rotation"}),R.jsx("td",{children:R.jsx(Zi,{value:a,onChange:l=>e("rotation",l.target.value),style:{textAlign:"left"},precision:2,...r})})]})]})})},C7=({element:n,onUpdate:e,attributeFormData:t})=>{let r=t.has("name")?t.get("name"):n.name,i=t.has("lineLength")?t.get("lineLength"):null;return R.jsxs("div",{children:[R.jsxs("div",{className:"w-full mb-2",children:[R.jsx(ti,{children:"Name"}),R.jsx(Ol,{value:r,onChange:s=>e("name",s.target.value),style:{textAlign:"left"}})]}),R.jsx(tm,{value:i,onUpdate:s=>e("lineLength",s),configs:{label:"Length",min:0,max:1/0,precision:2}})]})},R7=({element:n,onUpdate:e,onValid:t,attributeFormData:r,...i})=>n.prototype==="items"?R.jsx(A7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="lines"?R.jsx(C7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="holes"?R.jsx(T7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):null,ri=2,P7=(n,e,t)=>{switch(n=typeof n.misc=="object"?n.set("misc",Pe(n.misc)):n,n.prototype){case"items":return Pe(n);case"lines":{let r=e.vertices.get(n.vertices.get(0)),i=e.vertices.get(n.vertices.get(1)),s=Ln(r.x,r.y,i.x,i.y),o=n.misc.get("_unitLength")||t.unit,a=ni(s).from(t.unit).to(o);return Pe({vertexOne:r,vertexTwo:i,lineLength:Pe({length:s,_length:a,_unit:o})})}case"holes":{let r=e.lines.get(n.line),{x:i,y:s}=e.vertices.get(r.vertices.get(0)),{x:o,y:a}=e.vertices.get(r.vertices.get(1)),l=Ln(i,s,o,a),c=l*n.offset-n.properties.get("width").get("length")/2,h=n.misc.get("_unitA")||t.unit,f=ni(c).from(t.unit).to(h),p=l-l*n.offset-n.properties.get("width").get("length")/2,d=n.misc.get("_unitB")||t.unit,m=ni(p).from(t.unit).to(d);return Pe({offset:n.offset,offsetA:Pe({length:Jn(c,ri),_length:Jn(f,ri),_unit:h}),offsetB:Pe({length:Jn(p,ri),_length:Jn(m,ri),_unit:d})})}case"areas":return Pe({});default:return null}},I7=(n,e)=>{const t=e.getElement(n.type),r={};for(const i in t.properties)r[i]=Pe({currentValue:n.properties.has(i)?n.properties.get(i):At(t.properties[i].defaultValue),configs:t.properties[i]});return Pe(r)},L7=({element:n,layer:e,catalog:t})=>{const{planner:r,setItemsAttributes:i,setProperties:s,setLinesAttributes:o,setHolesAttributes:a}=Ht(),[l,c]=se.useState(P7(n,e,t)),[h,f]=se.useState(I7(n,t)),p=({propertiesFormData:x,attributesFormData:v})=>{if(x){let _=x.map(b=>b.get("currentValue"));s(_)}if(v)switch(n.prototype){case"items":{i(v);break}case"lines":{o(v);break}case"holes":{a(v);break}}},d=(x,v)=>{if(!l)return;let _;switch(n.prototype){case"items":{_=l.set(x,v);break}case"lines":{switch(x){case"lineLength":{let b=l.get("vertexOne"),M=l.get("vertexTwo"),[E,S]=Qa([b,M]),T=mc(E.x,E.y,S.x,S.y,v.get("length"),ri);_=l.withMutations(q=>{q.set(b===E?"vertexTwo":"vertexOne",S.merge(T)),q.set("lineLength",v)});break}case"vertexOne":case"vertexTwo":{_=l.withMutations(b=>{b.set(x,b.get(x).merge(v));let M=fc(b.get("vertexOne"),b.get("vertexTwo"));b.mergeIn(["lineLength"],b.get("lineLength").merge({length:M,_length:ni(M).from(t.unit).to(b.get("lineLength").get("_unit"))}))});break}default:{_=l.set(x,v);break}}break}case"holes":{switch(x){case"offsetA":{let b=e.lines.get(n.line),M=Qa([e.vertices.get(b.vertices.get(0)),e.vertices.get(b.vertices.get(1))]),[{x:E,y:S},{x:T,y:q}]=M,O=cf(E,S,T,q),A=Ln(E,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let K=(Z+N)*Math.cos(O)+E,ne=(Z+N)*Math.sin(O)+S,ce=On(E,S,T,q,K,ne),J=Jn(A-A*ce-N,ri),oe=l.getIn(["offsetB","_unit"]),B=Pe({length:J,_length:ni(J).from(t.unit).to(oe),_unit:oe});_=l.set("offsetB",B).set("offset",ce);let xe=Pe({length:Jn(Z,ri),_unit:v.get("_unit"),_length:Jn(ni(Z).from(t.unit).to(v.get("_unit")),ri)});_=l.set(x,xe);break}case"offsetB":{let b=e.lines.get(n.line),M=Qa([e.vertices.get(b.vertices.get(0)),e.vertices.get(b.vertices.get(1))]),[{x:E,y:S},{x:T,y:q}]=M,O=cf(E,S,T,q),A=Ln(E,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let K=T-(Z+N)*Math.cos(O),ne=q-(Z+N)*Math.sin(O),ce=On(E,S,T,q,K,ne),J=Jn(A*ce-N,ri),oe=l.getIn(["offsetA","_unit"]),B=Pe({length:J,_length:ni(J).from(t.unit).to(oe),_unit:oe});_=l.set("offsetA",B).set("offset",ce);let xe=Pe({length:Jn(Z,ri),_unit:v.get("_unit"),_length:Jn(ni(Z).from(t.unit).to(v.get("_unit")),ri)});_=l.set(x,xe);break}default:{_=l.set(x,v);break}}break}}_&&(c(_),p({attributesFormData:_,propertiesFormData:h}))},m=(x,v)=>{const _=h.setIn([x,"currentValue"],v);f(_),p({propertiesFormData:_,attributesFormData:l})};return R.jsxs("div",{children:[R.jsx(R7,{element:n,onValid:()=>{},onUpdate:d,attributeFormData:l}),h.entrySeq().map(([x,v])=>{let _=v.get("currentValue"),b=v.get("configs"),{Editor:M}=t.getPropertyType(b.type);return R.jsx(M,{propertyName:x,value:_,configs:b,onUpdate:E=>m(x,E),state:r,sourceElement:n,internalState:{attributesFormData:l,propertiesFormData:h}},x)})]})},O7=()=>R.jsx("div",{className:"h-full flex flex-col gap-4 justify-center items-center",children:R.jsx("p",{className:"mx-4 text-white text-sm text-center",children:"Select an element on the canvas to edit its properties."})}),q7=[rn,qs,Ds,Ns,Oi,Mo,Fr,cr,ur,wr,zr,kr,Br,Vr,qi,nf,rf],D7=({catalog:n})=>{const{planner:e}=Ht(),{scene:t,mode:r}=e;return q7.includes(r)?t.layers.valueSeq().flatMap(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>({element:o,layer:s}))).toArray().length===0?R.jsx(O7,{}):R.jsx("div",{children:t.layers.valueSeq().map(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>R.jsx(mx,{name:"Properties",opened:!0,children:R.jsx("div",{style:{padding:"5px 15px"},children:R.jsx(L7,{element:o,layer:s,catalog:n})})},o.id)).valueSeq())}):null},N7={MODE_IDLE:rn,MODE_2D_ZOOM_IN:qs,MODE_2D_ZOOM_OUT:Ds,MODE_2D_PAN:Ns,MODE_3D_VIEW:Oi,MODE_3D_FIRST_PERSON:Mo,MODE_WAITING_DRAWING_LINE:Fr,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAGGING_HOLE:Vr,MODE_FITTING_IMAGE:rf,MODE_UPLOADING_IMAGE:nf,MODE_ROTATING_ITEM:qi},U7={width:"100%"},Hu={width:"6em"},Gu={textAlign:"left"},F7={marginLeft:"5px",border:"0px",background:"none",color:"#FFFFFF",fontSize:"14px",outline:"0px"},z7={width:"100%",cursor:"pointer",maxHeight:"20em",marginLeft:"1px",marginTop:"1em"},vx={width:"2em"},k7=({groupID:n})=>{const{planner:e,setGroupAttributes:t,groupTranslate:r,groupRotate:i,removeFromGroup:s}=Ht(),{mode:o}=e;if(!n||!N7[o])return null;const a=e.getIn(["scene","groups",n]),l=a.get("elements");return R.jsx(mx,{name:`Group [${a.get("name")}]`,opened:!0,children:R.jsxs("div",{style:{padding:"5px 15px"},children:[R.jsx("table",{style:U7,children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:a.get("name"),onChange:c=>t(n,Pe({name:c.target.value})),style:Gu})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("x"),onChange:c=>r(n,c.target.value,a.get("y")),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("y"),onChange:c=>r(n,a.get("x"),c.target.value),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Rotation"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("rotation"),onChange:c=>i(n,c.target.value),style:Gu,precision:2})})]})]})}),l.size?R.jsxs("div",{children:[R.jsx("p",{style:{textAlign:"center",borderBottom:"1px solid #555",paddingBottom:"1em"},children:"Group's Elements"}),R.jsxs("table",{style:z7,children:[R.jsx("thead",{children:R.jsxs("tr",{children:[R.jsx("th",{style:vx}),R.jsx("th",{children:"Layer"}),R.jsx("th",{children:"Prototype"}),R.jsx("th",{children:"Name"})]})}),R.jsx("tbody",{children:l.entrySeq().map(([c,h])=>h.entrySeq().map(([f,p])=>p.valueSeq().map(d=>{let m=e.getIn(["scene","layers",c,f,d]);return R.jsxs("tr",{children:[R.jsx("td",{style:vx,title:"Un-chain Element from Group",children:R.jsx(R8,{onClick:()=>s(n,c,f,d),style:F7})}),R.jsx("td",{style:{textAlign:"center"},children:c}),R.jsx("td",{style:{textAlign:"center",textTransform:"capitalize"},children:f}),R.jsx("td",{style:{textAlign:"center"},children:m.name})]},d)})))})]})]}):null]})})},B7=({catalog:n,width:e=280})=>{const{planner:t}=Ht(),r=t.getIn(["scene","selectedLayer"]),i=t.getIn(["scene","layers",r,"selected"]),s=t.getIn(["scene","groups"]).findEntry(a=>a.get("selected")),o=i.lines.size>1||i.items.size>1||i.holes.size>1||i.areas.size>1||i.lines.size+i.items.size+i.holes.size+i.areas.size>1;return R.jsxs("aside",{onKeyDown:a=>a.stopPropagation(),onKeyUp:a=>a.stopPropagation(),className:"floor_planner-sidebar bg-[#424242] h-full block overflow-y-auto overflow-x-hidden pb-5",style:{width:e},children:[!o&&R.jsx(D7,{catalog:n}),!!s&&R.jsx(k7,{groupID:s?s[0]:null})]})},Or=({active:n,tooltip:e,onClick:t,children:r,className:i})=>{const[s,o]=se.useState(!1),a=n||s?"text-dark-blue":"text-[#C2C2C2]",l=c=>{t(c),o(!1)};return R.jsxs("div",{className:Ti("w-[30px] h-[30px] flex items-center justify-center text-[25px] relative cursor-pointer",i),onClick:l,onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:[R.jsx("div",{className:a,onClick:l,children:r}),s&&R.jsxs("div",{onClick:c=>{c.preventDefault(),c.stopPropagation()},className:"absolute w-[140px] text-white bg-black h-[30px] leading-[30px] text-center rounded-md opacity-80 left-full top-1/2 -mt-[15px] ml-[15px] z-[999] text-[12px]",children:[R.jsx("span",{className:"absolute top-1/2 right-full -mt-[8px] w-0 h-0 border-r-[8px] border-r-black border-t-[8px] border-t-transparent border-b-[8px] border-b-transparent"}),e]})]})},xx=()=>new Promise(async n=>{const e=document.getElementsByTagName("svg");if(!e.length)return;let t=e[0];for(let p=1;p<e.length;p++)e[p].width.baseVal.value>t.width.baseVal.value&&(t=e[p]);const r=t.cloneNode(!0),i=r.querySelectorAll("image");await Promise.all(Array.from(i).map(async p=>{const d=p.getAttribute("href")||p.getAttribute("xlink:href");if(d)try{const x=await(await fetch(d)).blob(),v=new FileReader;await new Promise(_=>{v.onloadend=()=>{p.setAttribute("href",v.result),_()},v.readAsDataURL(x)})}catch(m){console.warn("⚠️ Could not inline image:",d,m)}}));const o=new XMLSerializer().serializeToString(r),a=t.width.baseVal.value,l=t.height.baseVal.value,c=document.createElement("canvas");c.width=a,c.height=l;const h=c.getContext("2d");h.fillStyle="white",h.fillRect(0,0,a,l);const f=new Image;f.src=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(o)))}`,f.onload=()=>{h.drawImage(f,0,0,a,l),n(c.toDataURL("image/png"))}});function yx(n){return yn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 19a2 2 0 0 1 -2 -2"},child:[]},{tag:"path",attr:{d:"M5 13v-2"},child:[]},{tag:"path",attr:{d:"M5 7a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M11 5h2"},child:[]},{tag:"path",attr:{d:"M17 5a2 2 0 0 1 2 2"},child:[]},{tag:"path",attr:{d:"M19 11v2"},child:[]},{tag:"path",attr:{d:"M19 17v4"},child:[]},{tag:"path",attr:{d:"M21 19h-4"},child:[]},{tag:"path",attr:{d:"M13 19h-2"},child:[]}]})(n)}const Sx=n=>{let e=document.createElement("a"),t="output"+Date.now()+".png";t=window.prompt("Insert output filename",t),t&&(e.setAttribute("download",t),e.href=n,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e))};function V7({mode:n}){const e=r=>{r.preventDefault();const i=document.getElementsByTagName("canvas")[0];Sx(i.toDataURL())},t=async r=>{r.preventDefault(),xx().then(Sx)};return[Mo,Oi].includes(n)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:e,children:R.jsx(yx,{size:28})}):[rn,qs,Ds,Ns,Fr,zr,kr,Br,cr,ur,wr,Vr,qi].includes(n)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:t,children:R.jsx(yx,{size:28})}):null}function H7(n){return yn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M12 9v6"},child:[]},{tag:"path",attr:{d:"M16 15v6"},child:[]},{tag:"path",attr:{d:"M16 3v6"},child:[]},{tag:"path",attr:{d:"M3 15h18"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"M8 15v6"},child:[]},{tag:"path",attr:{d:"M8 3v6"},child:[]}]})(n)}const G7=/^.*$/;function W7({onChange:n,...e}){const[t,r]=se.useState(""),i=se.useRef(null);se.useEffect(()=>{r(e.value)},[e.value]);const s=a=>{if(!a)return;const l=a.target.value;G7.test(l)&&n&&n(a)},o=a=>{(!a.key||a.key==="Enter")&&s({target:{value:t}})};return R.jsxs("div",{className:"color-field flex-1 flex pr-3 mt-1 cursor-pointer",children:[R.jsx("div",{className:"colorBox relative w-[22px] h-[22px]",style:{background:e.value},onClick:()=>{i.current&&i.current.click()},children:R.jsx("input",{ref:i,type:"color",onChange:s,value:e.value,className:"absolute invisible h-full w-full"})}),R.jsx("div",{className:"flex-1 pl-2",children:R.jsx("input",{className:"colorFieldInput min-w-[90px] cursor-pointer",type:"text",value:t,onKeyDown:o,onChange:a=>r(a.target.value),onBlur:o})})]})}function Ex({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyColor w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(W7,{value:n,onChange:a=>o(a.target.value)})]})}function bx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyEnum w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(em,{value:n,onChange:a=>o(a.target.value),children:mn(t.values).entrySeq().map(([a,l])=>R.jsx("option",{value:a,children:l},a))})]})}function Mx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht();let o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{value:n,onChange:a=>o(a.target.value)})]})}function wx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=Ht(),a=l=>{let c=parseFloat(l);return isNaN(c)&&(c=0),r.hook?r.hook(c,i,s,o).then(h=>e(h)):e(c)};return R.jsxs("div",{className:"PropertyNumber w-full mb-2",children:[R.jsx(ti,{children:r.label}),R.jsx(Zi,{value:n,onChange:l=>a(l.target.value),onValid:t,min:r.min,max:r.max})]})}function Tx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=Ht();let a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r;const d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,onChange:m=>d(m.target.value,c),onValid:t,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.jsx("option",{value:m,children:m},m))})})]})]})}function j7({type:n="button",size:e="normal",style:t,styleHover:r,children:i,...s}){const[o,a]=se.useState(!1),l="inline-block font-normal leading-[1.25] text-center whitespace-nowrap align-middle cursor-pointer select-none outline-none border border-solid w-full transition-colors duration-175 ease-linear rounded-[2px]",c=e==="small"?"text-[12px] px-2 py-[3px]":e==="large"?"px-5 py-2":"text-[14px] px-3 py-[5px]",h={backgroundColor:"#e6e6e6",borderColor:"#adadad"},f={backgroundColor:"#d4d4d4",borderColor:"#8c8c8c"};return R.jsx("button",{type:n,className:`${l} ${c}`,style:{...o?{...f,...r}:{...h,...t}},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),...s,children:i})}const Wu={tableStyle:{width:"100%",borderSpacing:"2px 0",marginBottom:"2px"},firstTdStyle:{width:"6em",textTransform:"capitalize"}};function Ax({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsx("table",{className:"PropertyToggle",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:t.label})}),R.jsx("td",{children:R.jsx(j7,{onClick:()=>o(!n),size:"small",children:t.actionName})})]})})})}function Cx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyCheckbox w-full flex items-center gap-2 mb-2",children:[R.jsx("input",{className:"m-0 mt-0.5",type:"checkbox",checked:n,onChange:()=>o(!n)}),R.jsx(ti,{className:"mb-0",children:t.label})]})}function Rx(){return null}function Px({value:n,configs:e}){return R.jsx("table",{className:"PropertyReadOnly",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:e.label})}),R.jsx("td",{children:R.jsx("div",{children:n})})]})})})}class X7{constructor(e=hi){ut(this,"elements");ut(this,"categories");ut(this,"propertyTypes");ut(this,"unit");this.elements={},this.categories={root:{name:"root",label:"/",elements:[],categories:[]}},this.propertyTypes={},this.unit=e,this.registerMultiplePropertyType([["color",Ex,Ex],["enum",bx,bx],["string",Mx,Mx],["number",wx,wx],["length-measure",Tx,Tx],["toggle",Ax,Ax],["checkbox",Cx,Cx],["hidden",Rx,Rx],["read-only",Px,Px]])}getElement(e){if(this.hasElement(e))return this.elements[e];throw new Error(`Element ${e} does not exist in catalog`)}getCategory(e){if(this.hasCategory(e))return this.categories[e];throw new Error(`Category ${e} does not exist in catalog`)}getPropertyType(e){if(this.propertyTypes.hasOwnProperty(e))return this.propertyTypes[e];throw new Error(`Element ${e} does not exist in catalog`)}registerElement(e){e.properties=e.properties||{},this.validateElement(e)&&(this.elements[e.name]=e,this.categories.root.elements.push(this.elements[e.name]))}registerMultipleElements(e){e.forEach(t=>this.registerElement(t))}registerPropertyType(e,t,r){this.propertyTypes[e]={type:e,Viewer:t,Editor:r}}registerMultiplePropertyType(e){e.forEach(t=>this.registerPropertyType(...t))}validateElement(e){if(!e.hasOwnProperty("name"))throw new Error("Element not valid");let t=e.name;if(!e.hasOwnProperty("prototype"))throw new Error(`Element ${t} doesn't have prototype`);if(!e.hasOwnProperty("info"))throw new Error(`Element ${t} doesn't have info`);if(!e.info.hasOwnProperty("tag"))throw new Error(`Element ${t} doesn't have tag`);if(!e.info.hasOwnProperty("description"))throw new Error(`Element ${t} doesn't have description`);if(!e.info.hasOwnProperty("image"))throw new Error(`Element ${t} doesn't have image`);if(!e.hasOwnProperty("render2D"))throw new Error(`Element ${t} doesn't have render2D handler`);if(!e.hasOwnProperty("render3D"))throw new Error(`Element ${t} doesn't have render3D handler`);if(!e.hasOwnProperty("properties"))throw new Error(`Element ${t} doesn't have properties`);for(let r in e.properties){let i=e.properties[r];if(!i.hasOwnProperty("type"))throw new Error(`Element ${t}, Property ${r} doesn't have type`);if(!i.hasOwnProperty("defaultValue"))throw new Error(`Element ${t}, Property ${r} doesn't have defaultValue`)}return!0}hasElement(e){return this.elements.hasOwnProperty(e)}registerCategory(e,t,r){return this.validateCategory(e,t)?(this.categories[e]={name:e,label:t,categories:[],elements:[]},this.categories.root.categories.push(this.categories[e]),r&&r.length&&r.forEach(i=>this.addToCategory(e,i)),this.categories[e]):null}addToCategory(e,t){if(this.hasElement(t.name))this.categories[e].elements.push(t),this.categories.root.elements.splice(this.categories.root.elements.indexOf(t),1);else if(this.hasCategory(t.name))this.categories[e].categories.push(t),this.categories.root.categories.splice(this.categories.root.categories.indexOf(t),1);else throw new Error(`child ${t} is either category nor element`)}categoryHasElement(e,t){return this.hasCategory(e)&&this.categories[e].elements.some(r=>r.name===t)}validateCategory(e,t){if(!e)throw new Error("Category has undefined name");if(e==="")throw new Error("Category has empty name");if(this.hasCategory(e))throw new Error("Category has already been registered");return!0}hasCategory(e){return this.categories.hasOwnProperty(e)}}function $7(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"},child:[]}]})(n)}const Y7=({term:n="",placeholder:e="Search",noSpacing:t=!1,onClick:r=()=>!1,isStatic:i=!1,hasDropDown:s=!1,onSearch:o,className:a})=>{const[l,c]=se.useState("");return R.jsxs("div",{className:Ti(`relative w-full ${t?"mt-1":"mt-2"}`,a),onClick:r??(()=>!1),children:[R.jsx("span",{className:`absolute left-0 top-2 text-[#637381] ${t?"":"ml-2"}`,style:{zIndex:2},children:R.jsx($7,{size:18})}),i?R.jsx("div",{className:"w-full rounded border border-gray-300 bg-white px-3 py-1.5 text-xs font-normal cursor-pointer",style:{marginTop:3},children:n}):R.jsx("input",{className:"w-full rounded pl-[30px] focus:outline-none border border-gray-300 bg-white pr-3 py-1.5 text-sm text-gray-900",type:"text",placeholder:e,onChange:h=>{o(h.target.value,h),c(h.target.value)},value:l,onClick:r??(()=>!1)}),r!==null&&s&&R.jsx("span",{className:`absolute right-2 top-1/2 -translate-y-1/2 ${t?"":"ml-2"}`,style:{zIndex:1},children:R.jsx(C8,{className:"-mb-1"})})]})},Ix=0,Lx=58,K7=n=>{const e=[{label:"All Categories",value:"all"}],t=n.map(r=>r.info.tag);for(const r of t){let i=e;for(let s=0;s<r.length;s++){const o=r[s];let a=i.find(l=>l.label===o);a||(a={label:o,value:o},s<r.length-1&&(a.options=[{label:"All Categories",value:"all"}]),i.push(a)),s<r.length-1&&a.options&&(i=a.options)}}return e},Ox=({options:n,selections:e,level:t,onChange:r})=>{var i,s;return R.jsxs(R.Fragment,{children:[R.jsx("select",{className:"w-full rounded capitalize cursor-pointer focus:outline-none border border-gray-300 bg-white pr-3 pl-1.5 py-1.5 text-sm text-gray-900",value:e[t]||"all",onChange:o=>r(t,o.target.value),children:n.map(o=>R.jsx("option",{className:"capitalize",value:o.value,children:o.label},o.value))}),e[t]&&e[t]!=="all"&&((i=n.find(o=>o.value===e[t]))==null?void 0:i.options)&&R.jsx(Ox,{options:((s=n.find(o=>o.value===e[t]))==null?void 0:s.options)||[],level:t+1,selections:e,onChange:r})]})},Z7=({catalog:n,popupEvent:e,onClose:t})=>{const{setToast:r,selectToolDrawingLine:i,selectToolDrawingItem:s,selectToolDrawingHole:o,pushLastSelectedCatalogElementToHistory:a}=Ht(),[l,c]=se.useState([]),[h,f]=se.useState(["all"]),[p,d]=se.useState([]),[m,x]=se.useState(""),v=se.useRef(null),_=se.useRef(null);se.useEffect(()=>{if(e){const T=n.getCategory(e.page).elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);v.current=e.page,d(T);const{x:q,y:O}=e.rect;_.current={top:O+Ix,left:q+Lx},e.page==="objects"&&c(K7(T))}},[e]);const b=()=>{t()},M=S=>{b(),e&&r({text:`Cancel placing ${e.page}`}),setTimeout(()=>{switch(S.prototype){case"lines":i(S.name);break;case"items":s(S.name);break;case"holes":o(S.name);break}a(S)},0)},E=(S,T)=>{const q=[...h.slice(0,S),T];f(q)};return R.jsxs(R.Fragment,{children:[e&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:b}),R.jsxs("div",{style:e&&e.rect?{top:e.rect.y+Ix,left:e.rect.x+Lx}:_.current?_.current:{},className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[250px] !min-w-[330px] max-w-[330px] !max-h-[510px] transition-all duration-200 ease-out transform",e?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsxs("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:[R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:(e==null?void 0:e.page)??v.current})})}),R.jsxs("div",{className:Ti("fp-highlight"),children:[R.jsx(Ox,{options:l,level:0,selections:h,onChange:E}),R.jsx(Y7,{className:"mt-0",placeholder:"Search",onSearch:(S,T)=>{T.preventDefault(),T.stopPropagation(),x(S)}})]})]}),p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).length>0?R.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 pb-5 overflow-auto w-full pt-[18px] px-4",onWheel:S=>S.stopPropagation(),children:p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).map(S=>R.jsxs("div",{className:"w-full space-y-1.5",children:[R.jsx("div",{className:"fp-aspect-ratio-container",children:R.jsx("div",{className:"fp-aspect-ratio-content",onMouseDown:()=>M(S),children:R.jsx("img",{draggable:!1,className:"fp-item-image",alt:S.info.title,src:S.info.image})})}),R.jsx("p",{className:"text-xs font-semibold capitalize",children:S.info.description})]},S.name.replace(/\s+/g,"_")))}):R.jsx("div",{className:"min-h-28 w-full flex items-center justify-center",children:R.jsx("p",{className:"text-sm font-medium text-gray-400 text-center",children:"No records found"})})]})]})};function J7(n){return yn({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M320 32c0-9.9-4.5-19.2-12.3-25.2S289.8-1.4 280.2 1l-179.9 45C79 51.3 64 70.5 64 92.5L64 448l-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 192 0 32 0 0-32 0-448zM256 256c0 17.7-10.7 32-24 32s-24-14.3-24-32s10.7-32 24-32s24 14.3 24 32zm96-128l96 0 0 352c0 17.7 14.3 32 32 32l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320c0-35.3-28.7-64-64-64l-96 0 0 64z"},child:[]}]})(n)}function Q7(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M112 73c-13.75 0-24.214 4.87-33.047 13.271-8.832 8.402-15.755 20.6-20.414 34.575-5.887 17.661-7.953 38.064-6.887 56.111a57.246 57.246 0 0 1 2.461-.187c8.38-.405 16.317 1.094 23.494 4.234 14.355 6.28 25.436 18.27 34.057 32.28 15.104 24.543 23.187 55.746 24.96 80.585 114.097-14.223 124.655-14.223 238.753 0 1.772-24.84 9.855-56.042 24.959-80.586 8.62-14.009 19.702-25.999 34.057-32.28 7.875-3.444 16.67-4.898 25.955-4.046 1.066-18.047-1-38.45-6.887-56.111-4.659-13.976-11.582-26.173-20.414-34.575C424.214 77.87 413.75 73 400 73zM56.969 194.502c-.686-.008-1.38.006-2.082.04-5.621.284-11.8 1.978-18.862 5.509-23.413 11.707-26.349 65.687 14.82 79.41l4.505 1.502L86.79 391h338.42l31.44-110.037 4.504-1.502c41.17-13.723 38.234-67.703 14.82-79.41-14.121-7.061-24.722-6.775-34.367-2.555-9.645 4.22-18.564 13.23-25.943 25.22C400.906 246.7 393 282 393 304v10.195l-10.117-1.265c-128-16-125.766-16-253.766 0L119 314.195V304c0-22-7.906-57.3-22.664-81.283-7.38-11.991-16.298-21.001-25.943-25.22-4.22-1.847-8.624-2.94-13.424-2.995zM83.727 409l-23.272 23.271c11.994 3.239 33.75 3.763 42.545-1.666 3.272-4.695 6.903-14.536 10.438-21.605zm314.836 0c1.494 6.017 6.952 19.12 10.437 21.605 13.2 5.463 29.904 5.774 42.545 1.666L428.273 409z"},child:[]}]})(n)}const qx={fontSize:"19px",textDecoration:"none",fontWeight:"bold",margin:"0px",userSelect:"none"},eC=({style:n})=>R.jsx("p",{style:{...qx,...n},children:"2D"}),tC=({style:n})=>R.jsx("p",{style:{...qx,...n},children:"3D"});function nC({catalog:n,has3dView:e}){const{planner:t,setMode:r,setToast:i,selectTool3DView:s,unselectAll:o,selectToolDrawingLine:a}=Ht(),{mode:l,alterate:c}=t,[h,f]=se.useState(null);return R.jsxs(R.Fragment,{children:[R.jsxs("aside",{className:"floor_planner-toolbar -mt-[30px] absolute left-2 !pt-3 top-1/2 -translate-y-1/2 z-[1] rounded max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]",children:[R.jsx(Or,{active:[Fr,cr].includes(l),tooltip:"Draw wall",onClick:()=>{i({text:"Cancel drawing"}),a("wall")},children:R.jsx(H7,{})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="windows"),tooltip:"Place windows",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"windows"})},children:R.jsx(V8,{size:26})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="doors"),tooltip:"Place doors",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"doors"})},children:R.jsx(J7,{size:26})}),R.jsx(Or,{active:!!([wr].includes(l)&&h&&h.page==="objects"),tooltip:"Place objects",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"objects"})},children:R.jsx(Q7,{size:26})}),e?[Oi].includes(l)?R.jsx(Or,{active:[rn].includes(l),tooltip:"2D View",onClick:()=>{o(),setTimeout(()=>{r(rn)},0)},children:R.jsx(eC,{style:{color:c?"#FF9800":""}})}):R.jsx(Or,{active:[Oi].includes(l),tooltip:"3D View",onClick:s,children:R.jsx(tC,{})}):null,R.jsx(V7,{mode:l})]}),R.jsx(Z7,{catalog:n,popupEvent:h,onClose:()=>f(null)})]})}const ql=window.hasOwnProperty("localStorage")?window.localStorage:!1,rC=500;let nm=null;function iC(n,e){return(t,r,i)=>{let s;if(e=e||rC,!!n&&ql){if(r){t.setPlan(r);const o=r.floors[0].floorDesign;s=JSON.parse(o)}else if(ql.getItem(n)!==null){const o=ql.getItem(n);s=JSON.parse(o)}s&&t.loadProject(s),Ht.subscribe(o=>{nm&&clearTimeout(nm),nm=setTimeout(()=>{const a=ql.getItem(n),l=Ot.unselectAll(o.planner).updatedState,c=JSON.stringify(l.scene.toJS());if(a!==c&&(ql.setItem(n,c),o.plan))try{const h=o.plan.floors[o.activeFloor];i&&i({floor:{floorID:h.floorID,title:h.floorTitle,description:h.floorDescription,design:c}})}catch{}},e)})}}}function sC(){return n=>{window.addEventListener("keydown",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Tr.BACKSPACE:case Tr.DELETE:{[rn,Mo,Oi].includes(r)&&n.remove();break}case Tr.ESC:{n.rollback();break}case Tr.Z:{(e.getModifierState("Control")||e.getModifierState("Meta"))&&(e.getModifierState("Shift")?n.redo():n.undo());break}case Tr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge({SNAP_POINT:!1,SNAP_LINE:!1,SNAP_SEGMENT:!1,SNAP_GRID:!1,SNAP_GUIDE:!1,tempSnapConfiguartion:t.snapMask.toJS()}));break}case Tr.C:{let i=t.getIn(["scene","selectedLayer"]),s=t.getIn(["scene","layers",i,"selected"]);if((r===rn||r===Oi)&&(s.holes.size||s.areas.size||s.items.size||s.lines.size)){if(s.holes.size){let o=t.getIn(["scene","layers",i,"holes",s.holes.get(0)]);n.copyProperties(o.get("properties"))}else if(s.areas.size){const o=t.getIn(["scene","layers",i,"areas",s.areas.get(0)]);n.copyProperties(o.properties)}else if(s.items.size){const o=t.getIn(["scene","layers",i,"items",s.items.get(0)]);n.copyProperties(o.properties)}else if(s.lines.size){const o=t.getIn(["scene","layers",i,"lines",s.lines.get(0)]);n.copyProperties(o.properties)}}break}case Tr.V:{n.pasteProperties();break}case Tr.CTRL:{n.setAlterateState();break}}}),window.addEventListener("keyup",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Tr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge(t.snapMask.get("tempSnapConfiguartion")));break}case Tr.CTRL:{n.setAlterateState();break}}})}}const Dx=38,Nx=-220,Dl=({title:n,toggleState:e,toggleOn:t,toggleOff:r})=>{const[i,s]=se.useState(e||!1),o=()=>{s(!i),i?r():t()};return R.jsxs("div",{className:"flex items-center",children:[R.jsx("div",{className:"fp__onoffswitch",onClick:o,children:R.jsxs("div",{className:Ti("fp__onoffswitch_label",i?"fp__onoffswitch_label-checked":""),children:[R.jsx("span",{className:"fp__onoffswitch_inner"}),R.jsx("span",{className:"fp__onoffswitch_switch"})]})}),R.jsx("div",{className:"fp__onoffswitch_caption",children:n})]})},oC=({popupEvent:n,onClose:e})=>{const{planner:t,toggleSnap:r}=Ht(),{snapMask:i}=t,s=se.useRef(null);se.useEffect(()=>{if(n){const{x:l,y:c}=n.rect;s.current={top:c+Dx,left:l+Nx}}},[n]);const o=()=>{e()},a=l=>r(i.merge(l));return R.jsxs(R.Fragment,{children:[n&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:o}),R.jsxs("div",{style:n&&n.rect?{top:n.rect.y+Dx,left:n.rect.x+Nx}:s.current?s.current:{},id:"headerbar-popup",className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[200px] !min-w-[250px] max-w-[250px] !max-h-[300px] transition-all duration-200 ease-out transform",n?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsx("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:"Settings"})})})}),R.jsxs("div",{className:"min-h-28 w-full space-y-2.5 px-2 py-4",children:[R.jsx(Dl,{title:"Snap to Point",toggleState:i.get(uf),toggleOn:()=>{a({SNAP_POINT:!0})},toggleOff:()=>{a({SNAP_POINT:!1})}}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_LINE:!0})},toggleOff:()=>{a({SNAP_LINE:!1})},toggleState:i.get(hf),title:"Snap to Line"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_SEGMENT:!0})},toggleOff:()=>{a({SNAP_SEGMENT:!1})},toggleState:i.get(ff),title:"Snap to Segment"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GRID:!0})},toggleOff:()=>{a({SNAP_GRID:!1})},toggleState:i.get(df),title:"Snap to Grid"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GUIDE:!0})},toggleOff:()=>{a({SNAP_GUIDE:!1})},toggleState:i.get(J0),title:"Snap to Guide"})]})]})]})},aC=({onBack:n,onSave:e})=>{const{undo:t,redo:r,plan:i,setPlan:s}=Ht(),[o,a]=se.useState(!1),[l,c]=se.useState(null),h=()=>{a(!0)},f=p=>{if(!i)return;a(!1);const d=p.target.value.trim();if(d&&d!==(i==null?void 0:i.planTitle)){s({...i,planTitle:d});try{e&&e({title:d,description:""})}catch{}}};return R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"floor_planner-headerbar border-b border-b-[#5e5e5e] absolute flex items-center justify-between z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] w-full select-none cursor-default top-0 leading-[14px] text-white m-0",children:[R.jsx(Or,{className:"border border-white rounded -ml-1",active:!1,tooltip:"Go Back",onClick:()=>{n&&n()},children:R.jsx(Yv,{})}),R.jsx("div",{className:"flex flex-col items-center justify-center",children:o?R.jsx("input",{autoFocus:!0,type:"text",defaultValue:i==null?void 0:i.planTitle,onBlur:f,onKeyDown:p=>{(p.key==="Enter"||p.key==="Escape")&&f(p)},className:"bg-transparent border-b border-gray-400 outline-none text-lg text-center"}):R.jsx("span",{onDoubleClick:h,className:"projectName__fp text-lg",title:(i==null?void 0:i.planTitle)??"Example House",children:(i==null?void 0:i.planTitle)??"Example House"})}),R.jsxs("div",{className:"flex items-center gap-2 relative",children:[R.jsx(Or,{active:!1,tooltip:"Undo (CTRL-Z)",onClick:t,children:R.jsx(k8,{})}),R.jsx(Or,{active:!1,tooltip:"Redo (CTRL-SHIFT-Z)",onClick:r,children:R.jsx(z8,{})}),R.jsx("div",{className:"ml-8",children:R.jsx(Or,{active:!1,tooltip:"Settings",onClick:p=>{c({rect:p.currentTarget.getBoundingClientRect()})},children:R.jsx(T8,{size:17})})})]})]}),R.jsx(oC,{popupEvent:l,onClose:()=>c(null)})]})};var rm={exports:{}},Ux;function Fx(){if(Ux)return rm.exports;Ux=1;var n=rm.exports={};return n.forEach=function(e,t){for(var r=0;r<e.length;r++){var i=t(e[r]);if(i)return i}},rm.exports}var im,zx;function lC(){return zx||(zx=1,im=function(n){var e=n.stateHandler.getState;function t(o){var a=e(o);return a&&!!a.isDetectable}function r(o){e(o).isDetectable=!0}function i(o){return!!e(o).busy}function s(o,a){e(o).busy=!!a}return{isDetectable:t,markAsDetectable:r,isBusy:i,markBusy:s}}),im}var sm,kx;function cC(){return kx||(kx=1,sm=function(n){var e={};function t(o){var a=n.get(o);return a===void 0?[]:e[a]||[]}function r(o,a){var l=n.get(o);e[l]||(e[l]=[]),e[l].push(a)}function i(o,a){for(var l=t(o),c=0,h=l.length;c<h;++c)if(l[c]===a){l.splice(c,1);break}}function s(o){var a=t(o);a&&(a.length=0)}return{get:t,add:r,removeListener:i,removeAllListeners:s}}),sm}var om,Bx;function uC(){return Bx||(Bx=1,om=function(){var n=1;function e(){return n++}return{generate:e}}),om}var am,Vx;function hC(){return Vx||(Vx=1,am=function(n){var e=n.idGenerator,t=n.stateHandler.getState;function r(s){var o=t(s);return o&&o.id!==void 0?o.id:null}function i(s){var o=t(s);if(!o)throw new Error("setId required the element to have a resize detection state.");var a=e.generate();return o.id=a,a}return{get:r,set:i}}),am}var lm,Hx;function fC(){return Hx||(Hx=1,lm=function(n){function e(){}var t={log:e,warn:e,error:e};if(!n&&window.console){var r=function(i,s){i[s]=function(){var a=console[s];if(a.apply)a.apply(console,arguments);else for(var l=0;l<arguments.length;l++)a(arguments[l])}};r(t,"log"),r(t,"warn"),r(t,"error")}return t}),lm}var cm={exports:{}},Gx;function Wx(){if(Gx)return cm.exports;Gx=1;var n=cm.exports={};return n.isIE=function(e){function t(){var i=navigator.userAgent.toLowerCase();return i.indexOf("msie")!==-1||i.indexOf("trident")!==-1||i.indexOf(" edge/")!==-1}if(!t())return!1;if(!e)return!0;var r=(function(){var i,s=3,o=document.createElement("div"),a=o.getElementsByTagName("i");do o.innerHTML="<!--[if gt IE "+ ++s+"]><i></i><![endif]-->";while(a[0]);return s>4?s:i})();return e===r},n.isLegacyOpera=function(){return!!window.opera},cm.exports}var um={exports:{}},jx;function dC(){if(jx)return um.exports;jx=1;var n=um.exports={};n.getOption=e;function e(t,r,i){var s=t[r];return s==null&&i!==void 0?i:s}return um.exports}var hm,Xx;function pC(){if(Xx)return hm;Xx=1;var n=dC();hm=function(r){r=r||{};var i=r.reporter,s=n.getOption(r,"async",!0),o=n.getOption(r,"auto",!0);o&&!s&&(i&&i.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),s=!0);var a=e(),l,c=!1;function h(v,_){!c&&o&&s&&a.size()===0&&d(),a.add(v,_)}function f(){for(c=!0;a.size();){var v=a;a=e(),v.process()}c=!1}function p(v){c||(v===void 0&&(v=s),l&&(m(l),l=null),v?d():f())}function d(){l=x(f)}function m(v){var _=clearTimeout;return _(v)}function x(v){var _=function(b){return setTimeout(b,0)};return _(v)}return{add:h,force:p}};function e(){var t={},r=0,i=0,s=0;function o(c,h){h||(h=c,c=0),c>i?i=c:c<s&&(s=c),t[c]||(t[c]=[]),t[c].push(h),r++}function a(){for(var c=s;c<=i;c++)for(var h=t[c],f=0;f<h.length;f++){var p=h[f];p()}}function l(){return r}return{add:o,process:a,size:l}}return hm}var fm,$x;function mC(){if($x)return fm;$x=1;var n="_erd";function e(i){return i[n]={},t(i)}function t(i){return i[n]}function r(i){delete i[n]}return fm={initState:e,getState:t,cleanState:r},fm}var dm,Yx;function gC(){if(Yx)return dm;Yx=1;var n=Wx();return dm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;if(!t)throw new Error("Missing required dependency: reporter.");function s(h,f){function p(){f(h)}if(n.isIE(8))i(h).object={proxy:p},h.attachEvent("onresize",p);else{var d=l(h);if(!d)throw new Error("Element is not detectable by this strategy.");d.contentDocument.defaultView.addEventListener("resize",p)}}function o(h){var f=e.important?" !important; ":"; ";return(h.join(f)+f).trim()}function a(h,f,p){p||(p=f,f=h,h=null),h=h||{},h.debug;function d(m,x){var v=o(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),_=!1,b=window.getComputedStyle(m),M=m.offsetWidth,E=m.offsetHeight;i(m).startSize={width:M,height:E};function S(){function T(){if(b.position==="static"){m.style.setProperty("position","relative",h.important?"important":"");var A=function(L,N,Z,K){function ne(J){return J.replace(/[^-\d\.]/g,"")}var ce=Z[K];ce!=="auto"&&ne(ce)!=="0"&&(L.warn("An element that is positioned static has style."+K+"="+ce+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+K+" will be set to 0. Element: ",N),N.style.setProperty(K,"0",h.important?"important":""))};A(t,m,b,"top"),A(t,m,b,"right"),A(t,m,b,"bottom"),A(t,m,b,"left")}}function q(){_||T();function A(N,Z){if(!N.contentDocument){var K=i(N);K.checkForObjectDocumentTimeoutId&&window.clearTimeout(K.checkForObjectDocumentTimeoutId),K.checkForObjectDocumentTimeoutId=setTimeout(function(){K.checkForObjectDocumentTimeoutId=0,A(N,Z)},100);return}Z(N.contentDocument)}var L=this;A(L,function(Z){x(m)})}b.position!==""&&(T(),_=!0);var O=document.createElement("object");O.style.cssText=v,O.tabIndex=-1,O.type="text/html",O.setAttribute("aria-hidden","true"),O.onload=q,n.isIE()||(O.data="about:blank"),i(m)&&(m.appendChild(O),i(m).object=O,n.isIE()&&(O.data="about:blank"))}r?r.add(S):S()}n.isIE(8)?p(f):d(f,p)}function l(h){return i(h).object}function c(h){if(i(h)){var f=l(h);f&&(n.isIE(8)?h.detachEvent("onresize",f.proxy):h.removeChild(f),i(h).checkForObjectDocumentTimeoutId&&window.clearTimeout(i(h).checkForObjectDocumentTimeoutId),delete i(h).object)}}return{makeDetectable:a,addListener:s,uninstall:c}},dm}var pm,Kx;function _C(){if(Kx)return pm;Kx=1;var n=Fx().forEach;return pm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;e.stateHandler.hasState;var s=e.idHandler;if(!r)throw new Error("Missing required dependency: batchProcessor");if(!t)throw new Error("Missing required dependency: reporter.");var o=f(),a="erd_scroll_detection_scrollbar_style",l="erd_scroll_detection_container";function c(S){p(S,a,l)}c(window.document);function h(S){var T=e.important?" !important; ":"; ";return(S.join(T)+T).trim()}function f(){var S=500,T=500,q=document.createElement("div");q.style.cssText=h(["position: absolute","width: "+S*2+"px","height: "+T*2+"px","visibility: hidden","margin: 0","padding: 0"]);var O=document.createElement("div");O.style.cssText=h(["position: absolute","width: "+S+"px","height: "+T+"px","overflow: scroll","visibility: none","top: "+-S*3+"px","left: "+-T*3+"px","visibility: hidden","margin: 0","padding: 0"]),O.appendChild(q),document.body.insertBefore(O,document.body.firstChild);var A=S-O.clientWidth,L=T-O.clientHeight;return document.body.removeChild(O),{width:A,height:L}}function p(S,T,q){function O(Z,K){K=K||function(ce){S.head.appendChild(ce)};var ne=S.createElement("style");return ne.innerHTML=Z,ne.id=T,K(ne),ne}if(!S.getElementById(T)){var A=q+"_animation",L=q+"_animation_active",N=`/* Created by the element-resize-detector library. */
|
|
3922
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};function M6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Xe([t.properties.get("color")]):t.properties.get("colors"),o=new qt;o.name="streak";let a=0;for(let l=0;l<=e;l+=i){const c=[new G(0,0,-l),new G(n,0,-l)],h=new tr().setFromPoints(c),f=s.get(a%s.size),p=new vu({color:f}),d=new vl(h,p);o.add(d),o.add(new vl(h,p)),a++}return o}function w6(n,e,t,r){const i=t.properties.get("step"),s=t.properties.has("color")?Xe([t.properties.get("color")]):t.properties.get("colors"),o=new qt;o.name="streak";let a=0;for(let l=0;l<=n;l+=i){const c=[new G(l,0,0),new G(l,0,-e)],h=new tr().setFromPoints(c),f=s.get(a%s.size),p=new vu({color:f});o.add(new vl(h,p)),a++}return o}function T6(n){const e=new qt;e.name="grid",new x6().parse(b6);const{grids:r,width:i,height:s}=n;return r.forEach(o=>{switch(o.type){case"horizontal-streak":e.add(M6(i,s,o));break;case"vertical-streak":e.add(w6(i,s,o));break}}),e.position.y=-1,e}function A6(n){n&&n.dispose&&n.dispose()}function C6(n){n&&n.dispose&&n.dispose()}function Dv(n){if(n){if(Array.isArray(n)){n.forEach(e=>Dv(e));return}for(const e in n){const t=n[e];t instanceof Dn&&C6(t)}n.dispose()}}function Nv(n){(n instanceof Tn||n instanceof d4||n instanceof vl)&&(A6(n.geometry),Dv(n.material),n.geometry=null,n.material=null)}function R6(n){n.traverse(e=>{Nv(e)})}function Ou(n){n.traverse(e=>{Nv(e)})}function P6(n,e,t){const r={sceneGraph:{unit:n.unit,layers:{},busyResources:{layers:{}},width:n.width,height:n.height,LODs:{}},plan:new qt,grid:T6(n),boundingBox:new bi};r.plan.name="plan",r.grid.name="grid",r.boundingBox.setFromObject(r.grid);let i=[];return n.layers.forEach(s=>{(s.id===n.selectedLayer||s.visible)&&(i=i.concat(qu(s,r,n,e,t)))}),Promise.all(i).then(()=>$i(r)),r}function qu(n,e,t,r,i){const s=[];return e.sceneGraph.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{},visible:n.visible,altitude:n.altitude},e.sceneGraph.busyResources.layers[n.id]={id:n.id,lines:{},holes:{},areas:{},items:{}},n.lines.forEach(o=>{s.push(io(t,e,n,o.id,i,r.linesActions)),o.holes.forEach(a=>{s.push(ha(t,e,n,a,i,r.holesActions))})}),n.areas.forEach(o=>{s.push(Rl(t,e,n,o.id,i,r.areaActions))}),n.items.forEach(o=>{s.push(Du(t,e,n,o.id,i,r.itemsActions))}),s}function I6(n,e,t,r,i,s){const o=r.map(l=>({op:l.op,path:l.path.split("/"),value:l.value}));let a=z6(o,e,t);return a=a.filter(({path:l})=>l[3]!=="selected"),a=a.filter(({path:l})=>l[1]!=="groups"),a.forEach(({op:l,path:c,value:h})=>{if(c[1]==="layers"){const f=e.getIn(["layers",c[2]]);if(c.length===3&&l==="remove")O6(c[2],n);else if(c.length>3)switch(l){case"replace":Cl(c,f,n,i,e,t,s);break;case"add":q6(c,f,n,i,e,t,s);break;case"remove":L6(c,f,n,i,e,t,s);break}}else if(c[1]==="selectedLayer"){const f=h,p=e.getIn(["layers",f]);if(!p.visible){const m=qu(p,n,e,i,s);Promise.all(m).then(()=>$i(n))}const d=n.sceneGraph.layers[(t==null?void 0:t.selectedLayer)??""];if(d&&!d.visible){for(let m in d.lines)Xi(n,d.id,m);for(let m in d.areas)Ss(n,d.id,m);for(let m in d.items)Es(n,d.id,m);for(let m in d.holes)ji(n,d.id,m)}}}),n}function Cl(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"vertices":if(n[5]!=="selected"){const d=e.getIn(["vertices",n[4]]);if((n[5]==="x"||n[5]==="y")&&(d.lines.forEach(m=>{const x=s.getIn(["layers",e.id,"lines",m,"holes"]);return x&&x.forEach(v=>{Cl([0,0,0,"holes",v,"selected"],e,t,r,i,s,o)}),Cl([0,0,0,"lines",m],e,t,r,i,s,o)}),d.areas.forEach(m=>Cl([0,0,0,"areas",m],e,t,r,i,s,o))),n[5]==="areas"){let m=d.getIn(["areas",~~n[6]]);Cl([0,0,0,"areas",m],e,t,r,i,s,o)}}break;case"holes":const l=e.getIn(["holes",n[4]]);if(o.getElement(l.type).updateRender3D)a.push(D6(i,s,t,e,n[4],n.slice(5),o,r.holesActions,()=>ji(t,e.id,l.id),()=>ha(i,t,e,l.id,o,r.holesActions)));else{let d=l.line;n[5]==="selected"?(ji(t,e.id,l.id),a.push(ha(i,t,e,l.id,o,r.holesActions))):(e.getIn(["lines",d,"holes"]).forEach(m=>{ji(t,e.id,m)}),Xi(t,e.id,d),a.push(io(i,t,e,d,o,r.linesActions)),e.getIn(["lines",d,"holes"]).forEach(m=>{a.push(ha(i,t,e,m,o,r.holesActions))}))}break;case"lines":const c=e.getIn(["lines",n[4]]);o.getElement(c.type).updateRender3D?a.push(N6(i,s,t,e,n[4],n.slice(5),o,r.linesActions,()=>Xi(t,e.id,n[4]),()=>io(i,t,e,n[4],o,r.linesActions))):(Xi(t,e.id,n[4]),a.push(io(i,t,e,n[4],o,r.linesActions)));break;case"areas":const h=e.getIn(["areas",n[4]]);o.getElement(h.type).updateRender3D?a.push(U6(i,s,t,e,n[4],n.slice(5),o,r.areaActions,()=>Ss(t,e.id,n[4]),()=>Rl(i,t,e,n[4],o,r.areaActions))):(t.sceneGraph.layers[e.id].areas[n[4]]&&Ss(t,e.id,n[4]),a.push(Rl(i,t,e,n[4],o,r.areaActions)));break;case"items":const f=e.getIn(["items",n[4]]);o.getElement(f.type).updateRender3D?a.push(F6(i,s,t,e,n[4],n.slice(5),o,r.itemsActions,()=>Es(t,e.id,n[4]),()=>Du(i,t,e,n[4],o,r.itemsActions))):(Es(t,e.id,n[4]),a.push(Du(i,t,e,n[4],o,r.itemsActions)));break;case"visible":if(e.visible)a=a.concat(qu(e,t,i,r,o));else{let d=t.sceneGraph.layers[e.id];for(let m in d.lines)Xi(t,e.id,m);for(let m in d.areas)Ss(t,e.id,m);for(let m in d.items)Es(t,e.id,m);for(let m in d.holes)ji(t,e.id,m)}break;case"opacity":case"altitude":let p=t.sceneGraph.layers[e.id];for(let d in p.lines)Xi(t,e.id,d);for(let d in p.areas)Ss(t,e.id,d);for(let d in p.items)Es(t,e.id,d);for(let d in p.holes)ji(t,e.id,d);a=a.concat(qu(e,t,i,r,o))}Promise.all(a).then(()=>$i(t))}function L6(n,e,t,r,i,s,o){let a=[];switch(n[3]){case"lines":const l=n[4];s.getIn(["layers",e.id,"lines",l,"holes"]).forEach(c=>{ji(t,e.id,c)}),Xi(t,e.id,l),n.length>5&&(a.push(io(i,t,e,l,o,r.linesActions)),e.getIn(["lines",l,"holes"]).forEach(c=>{a.push(ha(i,t,e,c,o,r.holesActions))}));break;case"areas":n.length===5&&Ss(t,e.id,n[4]);break;case"items":n.length===5&&Es(t,e.id,n[4]);break}Promise.all(a).then(()=>$i(t))}function O6(n,e){let t=e.sceneGraph.layers[n];for(let r in t.lines)Xi(e,n,r);for(let r in t.areas)Ss(e,n,r);for(let r in t.items)Es(e,n,r);for(let r in t.holes)ji(e,n,r);delete e.sceneGraph.layers[n]}function ji(n,e,t){if(n.sceneGraph.busyResources.layers[e].holes[t]){setTimeout(()=>ji(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].holes[t]=!0;let r=n.sceneGraph.layers[e].holes[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].holes[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].holes[t]=!1}function Xi(n,e,t){if(n.sceneGraph.busyResources.layers[e].lines[t]){setTimeout(()=>Xi(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].lines[t]=!0;let r=n.sceneGraph.layers[e].lines[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].lines[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].lines[t]=!1}function Ss(n,e,t){if(n.sceneGraph.busyResources.layers[e].areas[t]){setTimeout(()=>Ss(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].areas[t]=!0;let r=n.sceneGraph.layers[e].areas[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].areas[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].areas[t]=!1}function Es(n,e,t){if(n.sceneGraph.busyResources.layers[e].items[t]){setTimeout(()=>Es(n,e,t),100);return}n.sceneGraph.busyResources.layers[e].items[t]=!0;let r=n.sceneGraph.layers[e].items[t];r&&(n.plan.remove(r),Ou(r),delete n.sceneGraph.layers[e].items[t],delete n.sceneGraph.LODs[t],r=null,$i(n)),n.sceneGraph.busyResources.layers[e].items[t]=!1}function q6(n,e,t,r,i,s,o){if(n.length===5){let a=null,l=null;switch(n[3]){case"lines":a=io,l=r.linesActions;break;case"areas":a=Rl,l=r.areaActions;break;case"items":a=Du,l=r.itemsActions;break;case"holes":a=ha,l=r.holesActions;break}a&&a(i,t,e,n[4],o,l).then(()=>$i(t))}}function ha(n,e,t,r,i,s){const o=t.getIn(["holes",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof gu&&(e.sceneGraph.LODs[r]=a);const l=new qt;l.name="pivot",l.add(a);const c=t.getIn(["lines",o.line]);let h=t.vertices.get(c.vertices.get(0)),f=t.vertices.get(c.vertices.get(1)),p=o.offset;if(h.x>f.x){const E=h;h=f,f=E,p=1-p}let d=Math.sqrt(Math.pow(h.x-f.x,2)+Math.pow(h.y-f.y,2)),m=Math.asin((f.y-h.y)/d),x=new bi().setFromObject(l),v=[(x.max.x-x.min.x)/2+x.min.x,(x.max.y-x.min.y)/2+x.min.y,(x.max.z-x.min.z)/2+x.min.z],_=o.properties.getIn(["altitude","length"]),b=o.properties.getIn(["height","length"]);l.rotation.y=m,l.position.x=h.x+d*p*Math.cos(m)-v[2]*Math.sin(m),l.position.y=_+b/2-v[1]+t.altitude,l.position.z=-h.y-d*p*Math.sin(m)-v[2]*Math.cos(m),e.plan.add(l),e.sceneGraph.layers[t.id].holes[o.id]=l,Nu(l,()=>s.selectHole(t.id,o.id));let M=t.opacity;o.selected&&(M=1),Uu(l,M)})}function D6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["holes",i]),f=e.getIn(["layers",r.id,"holes",i]),p=t.sceneGraph.layers[r.id].holes[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function io(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].lines[r]){setTimeout(()=>io(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].lines[r]=!0;const o=t.getIn(["lines",r]);let a=t.vertices.get(o.vertices.get(0)),l=t.vertices.get(o.vertices.get(1));if(a.x>l.x){let c=a;a=l,l=c}return i.getElement(o.type).render3D(o,t,n).then(c=>{c instanceof gu&&(e.sceneGraph.LODs[o.id]=c);let h=new qt;h.name="pivot",h.add(c),h.position.x=a.x,h.position.y=t.altitude,h.position.z=-a.y,e.plan.add(h),e.sceneGraph.layers[t.id].lines[r]=h,Nu(h,()=>s.selectLine(t.id,o.id));let f=t.opacity;o.selected&&(f=1),Uu(h,f),e.sceneGraph.busyResources.layers[t.id].lines[r]=!1})}function N6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["lines",i]),f=e.getIn(["layers",r.id,"lines",i]),p=t.sceneGraph.layers[r.id].lines[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Rl(n,e,t,r,i,s){if(e.sceneGraph.busyResources.layers[t.id].areas[r]){setTimeout(()=>Rl(n,e,t,r,i,s),100);return}e.sceneGraph.busyResources.layers[t.id].areas[r]=!0;const o=t.getIn(["areas",r]),a=()=>s.selectArea(t.id,r);return i.getElement(o.type).render3D(o,t,n).then(l=>{l instanceof gu&&(e.sceneGraph.LODs[r]=l);let c=new qt;c.name="pivot",c.add(l),c.position.y=t.altitude,e.plan.add(c),e.sceneGraph.layers[t.id].areas[r]=c,Nu(c,a);let h=t.opacity;o.selected&&(h=1),Uu(c,h),e.sceneGraph.busyResources.layers[t.id].areas[r]=!1})}function U6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["areas",i]),f=e.getIn(["layers",r.id,"areas",i]),p=t.sceneGraph.layers[r.id].areas[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Du(n,e,t,r,i,s){const o=t.getIn(["items",r]);return i.getElement(o.type).render3D(o,t,n).then(a=>{a instanceof gu&&(e.sceneGraph.LODs[r]=a);const l=new qt;l.name="pivot",l.add(a),l.rotation.y=o.rotation*Math.PI/180,l.position.x=o.x,l.position.y=t.altitude,l.position.z=-o.y,Nu(a,()=>{s.selectItem(t.id,o.id)});let c=t.opacity;o.selected&&(c=1),Uu(l,c),e.plan.add(l),e.sceneGraph.layers[t.id].items[o.id]=l})}function F6(n,e,t,r,i,s,o,a,l,c){const h=r.getIn(["items",i]),f=e.getIn(["layers",r.id,"items",i]),p=t.sceneGraph.layers[r.id].items[i];return p?o.getElement(h.type).updateRender3D(h,r,n,p,f,s,l,c):null}function Nu(n,e){n.traverse(t=>{(t instanceof Tn||t.isMesh)&&(t.interact=e)})}function Uu(n,e){n.traverse(t=>{t instanceof Tn&&(t.material instanceof Array?t.material.forEach(r=>{r.transparent=!0,r.maxOpacity?r.opacity=Math.min(r.maxOpacity,e):r.opacity&&r.opacity>e&&(r.maxOpacity=r.opacity,r.opacity=e)}):(t.material.transparent=!0,t.material.maxOpacity?t.material.opacity=Math.min(t.material.maxOpacity,e):t.material.opacity&&t.material.opacity>e&&(t.material.maxOpacity=t.material.opacity,t.material.opacity=e)))})}function $i(n){let e=new bi().setFromObject(n.plan);if(isFinite(e.max.x)&&isFinite(e.min.x)&&isFinite(e.max.y)&&isFinite(e.min.y)&&isFinite(e.max.z)&&isFinite(e.min.z)){let t=new G((e.max.x-e.min.x)/2+e.min.x,(e.max.y-e.min.y)/2+e.min.y,(e.max.z-e.min.z)/2+e.min.z);n.plan.position.sub(t),n.grid.position.sub(t),e.min.sub(t),e.max.sub(t),n.boundingBox=e}}function z6(n,e,t){return k6(B6(V6(n)),e,t)}function k6(n,e,t){let r,i;for(i=0;i<n.length&&!r;i++)n[i].path[1]==="selectedLayer"&&(r=n[i]);return r&&!e.getIn(["layers",t.selectedLayer,"visible"])?n.filter(({op:s,path:o})=>!(o[o.length-1]==="selected"&&o[1]==="layers"&&o[2]===t.selectedLayer)&&!(s==="remove"&&o.indexOf(t.selectedLayer)!==-1)):n}function B6(n,e,t){const r={};return n.forEach(({path:i})=>{i[5]==="selected"&&(r[i[4]]=i[4])}),n.filter(({path:i})=>i[5]==="properties"?!r[i[4]]:!0)}function V6(n,e,t){const r={};return n.filter(({path:i})=>i[5]==="properties"?r[i[4]]?!1:r[i[4]]=!0:i[5]!=="misc")}const Uv={type:"change"},Gp={type:"start"},Fv={type:"end"},Fu=new ru,zv=new ys,H6=Math.cos(70*Vb.DEG2RAD),xn=new G,nr=2*Math.PI,zt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Wp=1e-6;class G6 extends m4{constructor(e,t=null){super(e,t),this.state=zt.NONE,this.target=new G,this.cursor=new G,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=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.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qo.ROTATE,MIDDLE:qo.DOLLY,RIGHT:qo.PAN},this.touches={ONE:Do.ROTATE,TWO:Do.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new G,this._lastQuaternion=new fs,this._lastTargetPosition=new G,this._quat=new fs().setFromUnitVectors(e.up,new G(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new rv,this._sphericalDelta=new rv,this._scale=1,this._panOffset=new G,this._rotateStart=new Fe,this._rotateEnd=new Fe,this._rotateDelta=new Fe,this._panStart=new Fe,this._panEnd=new Fe,this._panDelta=new Fe,this._dollyStart=new Fe,this._dollyEnd=new Fe,this._dollyDelta=new Fe,this._dollyDirection=new G,this._mouse=new Fe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=j6.bind(this),this._onPointerDown=W6.bind(this),this._onPointerUp=X6.bind(this),this._onContextMenu=e8.bind(this),this._onMouseWheel=K6.bind(this),this._onKeyDown=Z6.bind(this),this._onTouchStart=J6.bind(this),this._onTouchMove=Q6.bind(this),this._onMouseDown=$6.bind(this),this._onMouseMove=Y6.bind(this),this._interceptControlDown=t8.bind(this),this._interceptControlUp=n8.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Uv),this.update(),this.state=zt.NONE}update(e=null){const t=this.object.position;xn.copy(t).sub(this.target),xn.applyQuaternion(this._quat),this._spherical.setFromVector3(xn),this.autoRotate&&this.state===zt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let r=this.minAzimuthAngle,i=this.maxAzimuthAngle;isFinite(r)&&isFinite(i)&&(r<-Math.PI?r+=nr:r>Math.PI&&(r-=nr),i<-Math.PI?i+=nr:i>Math.PI&&(i-=nr),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(xn.setFromSpherical(this._spherical),xn.applyQuaternion(this._quatInverse),t.copy(this.target).add(xn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=xn.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new G(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new G(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=xn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Fu.origin.copy(this.object.position),Fu.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Fu.direction))<H6?this.object.lookAt(this.target):(zv.setFromNormalAndCoplanarPoint(this.object.up,this.target),Fu.intersectPlane(zv,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Wp||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Wp||this._lastTargetPosition.distanceToSquared(this.target)>Wp?(this.dispatchEvent(Uv),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?nr/60*this.autoRotateSpeed*e:nr/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){xn.setFromMatrixColumn(t,0),xn.multiplyScalar(-e),this._panOffset.add(xn)}_panUp(e,t){this.screenSpacePanning===!0?xn.setFromMatrixColumn(t,1):(xn.setFromMatrixColumn(t,0),xn.crossVectors(this.object.up,xn)),xn.multiplyScalar(e),this._panOffset.add(xn)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;xn.copy(i).sub(this.target);let s=xn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(nr*this._rotateDelta.x/t.clientHeight),this._rotateUp(nr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-nr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(nr*this._rotateDelta.x/t.clientHeight),this._rotateUp(nr*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Fe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,r={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:r.deltaY*=16;break;case 2:r.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(r.deltaY*=10),r}}function W6(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n)))}function j6(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function X6(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Fv),this.state=zt.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function $6(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qo.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=zt.DOLLY;break;case qo.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}break;case qo.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=zt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=zt.PAN}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Y6(n){switch(this.state){case zt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case zt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case zt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function K6(n){this.enabled===!1||this.enableZoom===!1||this.state!==zt.NONE||(n.preventDefault(),this.dispatchEvent(Gp),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(Fv))}function Z6(n){this.enabled!==!1&&this._handleKeyDown(n)}function J6(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case Do.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=zt.TOUCH_ROTATE;break;case Do.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=zt.TOUCH_PAN;break;default:this.state=zt.NONE}break;case 2:switch(this.touches.TWO){case Do.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=zt.TOUCH_DOLLY_PAN;break;case Do.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=zt.TOUCH_DOLLY_ROTATE;break;default:this.state=zt.NONE}break;default:this.state=zt.NONE}this.state!==zt.NONE&&this.dispatchEvent(Gp)}function Q6(n){switch(this._trackPointer(n),this.state){case zt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case zt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case zt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case zt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=zt.NONE}}function e8(n){this.enabled!==!1&&n.preventDefault()}function t8(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function n8(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const fa=n=>Bt(n),da=n=>Bn(n),pa=n=>mt.isRecord(n),Yi=(n,e,t)=>n==="remove"?{op:n,path:e}:{op:n,path:e,value:t},r8=(n,e,t)=>{const r=[];for(let i=0;i<n;i++){r[i]=new Array(e);for(let s=0;s<e;s++)r[i][s]=t}return r},jp=mt({op:"=",val:null}),i8=mt({op:"!=",val:null,newVal:null}),s8=(n,e)=>{const t=o8(n,e);return a8(t,n,e,n.size??0,e.size??0)},o8=(n,e)=>{const t=n.size??0,r=e.size??0,i=r8(t+1,r+1,0);for(let s=0;s<t;s++)for(let o=0;o<r;o++)Kt(n.get(s),e.get(o))?i[s+1][o+1]=i[s][o]+1:i[s+1][o+1]=Math.max(i[s+1][o],i[s][o+1]);return i},a8=(n,e,t,r,i)=>{const s=[];let o=r-1,a=i-1;for(;o>=0||a>=0;)o>=0&&a>=0&&Kt(e.get(o),t.get(a))?(s.push(new jp({op:"=",val:e.get(o)})),o--,a--):o>=0&&a>=0&&o===a&&!Kt(e.get(o),t.get(a))?(s.push(new i8({val:e.get(o),newVal:t.get(o)})),o--,a--):a>=0&&(o===-1||n[o+1][a]>=n[o][a+1])?(s.push(new jp({op:"+",val:t.get(a)})),a--):o>=0&&(a===-1||n[o+1][a]<n[o][a+1])&&(s.push(new jp({op:"-",val:e.get(o)})),o--);return s.reverse()},l8=/\//g,c8=/~/g,so=n=>{if(typeof n=="number")return n.toString();if(typeof n!="string")throw new Error(`param str (${String(n)}) is not a string`);return n.replace(c8,"~0").replace(l8,"~1")},vr=(n,e)=>`${n}/${e}`,Pl=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;const i=da(n)&&da(e);let s=null,o=null;return n.forEach&&n.forEach((a,l)=>{if(e.has(l))if(pa(a)&&pa(e.get(l)))r=r.concat(Xp(a,e.get(l),vr(t,so(l))));else if(fa(a)&&fa(e.get(l)))r=r.concat(Pl(a,e.get(l),vr(t,so(l))));else if(da(a)&&da(e.get(l)))r=r.concat(kv(a,e.get(l),vr(t,so(l))));else{const c=e.get?e.get(l):e;a!==c&&r.push(Yi("replace",vr(t,so(l)),c))}else i?(o=s!=null&&Number(s)+1===l?o:l,r.push(Yi("remove",vr(t,so(o)))),s=l):r.push(Yi("remove",vr(t,so(l))))}),e.forEach((a,l)=>{n.has&&!n.has(l)&&r.push(Yi("add",vr(t,so(l)),a))}),r},Xp=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;const i=n.toSeq().toMap(),s=e.toSeq().toMap();return r=r.concat(Pl(i,s,t)),r},kv=(n,e,t="")=>{let r=[];if(Kt(n,e)||n==e&&n==null)return r;if((n.count()+1)*(e.count()+1)>=1e4)return Pl(n,e,t);const i=s8(n,e);let s=0;return i.forEach(o=>{if(o.op==="=")s++;else if(o.op==="!="){if(pa(o.val)&&pa(o.newVal)){const a=Xp(o.val,o.newVal,vr(t,String(s)));r=r.concat(a)}else if(fa(o.val)&&fa(o.newVal)){const a=Pl(o.val,o.newVal,vr(t,String(s)));r=r.concat(a)}else r.push(Yi("replace",vr(t,String(s)),o.newVal));s++}else o.op==="+"?(r.push(Yi("add",vr(t,String(s)),o.val)),s++):o.op==="-"&&r.push(Yi("remove",vr(t,String(s))))}),r},u8=(n,e,t="")=>n===e?[]:[Yi("replace",vr(t,""),e)],h8=(n,e,t="")=>Kt(n,e)?Xe():n!=e&&(n==null||e==null)?At([Yi("replace","/",e)]):da(n)&&da(e)?At(kv(n,e)):pa(n)&&pa(e)?At(Xp(n,e)):fa(n)&&fa(e)?At(Pl(n,e)):At(u8(n,e,t));class f8 extends se.Component{constructor(t){super(t);ut(this,"canvasWrapperRef",se.createRef());ut(this,"renderer");ut(this,"scene3D",null);ut(this,"camera",null);ut(this,"orbitControls",null);ut(this,"planData");ut(this,"renderingID",0);ut(this,"width");ut(this,"height");ut(this,"lastMousePosition",{});ut(this,"mouseDownEvent");ut(this,"mouseUpEvent");this.width=t.width,this.height=t.height,this.renderer=new v6({preserveDrawingBuffer:!0,antialias:!0})}componentDidMount(){const{state:t,actions:r}=this.props,i={areaActions:r.areaActions,holesActions:r.holesActions,itemsActions:r.itemsActions,linesActions:r.linesActions,projectActions:r.projectActions},s=t.scene,o=this.canvasWrapperRef.current,a=new mM;this.renderer.setSize(this.width,this.height),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.outputColorSpace=pr,this.renderer.useLegacyLights=!1,this.renderer.setClearColor(new St(Fc.white));const l=P6(s,i,this.props.catalog);a.add(l.plan),a.add(l.grid);const c=this.width/this.height,h=new _r(45,c,1,3e5);a.add(h);const f=-(l.boundingBox.max.x-l.boundingBox.min.x)/2,p=(l.boundingBox.max.y-l.boundingBox.min.y)/2*10,d=(l.boundingBox.max.z-l.boundingBox.min.z)/2;h.position.set(f,p,d),h.up.set(0,1,0);const m=new l4(Fc.white,.3);m.position.set(f,p,d),a.add(m),a.add(new ev(11513775)),a.add(new ev(16777215,.7));const x=new u4(16777215,.6);x.position.set(100,200,100),x.castShadow=!0,a.add(x);const v=[l.plan],_=new Fe,b=new f4;this.mouseDownEvent=T=>{this.lastMousePosition.x=T.offsetX/this.width*2-1,this.lastMousePosition.y=-T.offsetY/this.height*2+1},this.mouseUpEvent=T=>{var q,O;if(T.preventDefault(),_.x=T.offsetX/this.width*2-1,_.y=-(T.offsetY/this.height)*2+1,Math.abs(_.x-(this.lastMousePosition.x??0))<=.02&&Math.abs(_.y-(this.lastMousePosition.y??0))<=.02){b.setFromCamera(_,h);const A=b.intersectObjects(v,!0);A.length>0&&!isNaN(A[0].distance)?(O=(q=A[0].object).interact)==null||O.call(q):this.props.actions.projectActions.unselectAll()}},this.renderer.domElement.addEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.addEventListener("mouseup",this.mouseUpEvent),o&&o.appendChild(this.renderer.domElement);const M=new G6(h,this.renderer.domElement);M.enableDamping=!0,M.dampingFactor=.05;const E=new qt;E.name="spotLightTarget",E.position.copy(M.target),a.add(E),m.target=E;const S=()=>{M.update(),m.position.copy(h.position),E.position.copy(M.target);for(const T in l.sceneGraph.LODs)l.sceneGraph.LODs[T].update(h);this.renderer.render(a,h),this.renderingID=requestAnimationFrame(S)};S(),this.orbitControls=M,this.camera=h,this.scene3D=a,this.planData=l}componentWillUnmount(){var t;cancelAnimationFrame(this.renderingID),(t=this.orbitControls)==null||t.dispose(),this.renderer.domElement.removeEventListener("mousedown",this.mouseDownEvent),this.renderer.domElement.removeEventListener("mouseup",this.mouseUpEvent),this.scene3D&&(R6(this.scene3D),this.scene3D.remove(this.planData.plan),this.scene3D.remove(this.planData.grid)),this.scene3D=null,this.planData=null,this.camera=null,this.orbitControls=null,this.renderer.renderLists.dispose()}componentDidUpdate(t){const{width:r,height:i}=this.props;if(this.width=r,this.height=i,this.camera&&(this.camera.aspect=r/i,this.camera.updateProjectionMatrix()),t.state.scene!==this.props.state.scene){const s=h8(t.state.scene,this.props.state.scene),o={areaActions:this.props.actions.areaActions,holesActions:this.props.actions.holesActions,itemsActions:this.props.actions.itemsActions,linesActions:this.props.actions.linesActions,projectActions:this.props.actions.projectActions};I6(this.planData,this.props.state.scene,t.state.scene,s.toJS(),o,this.props.catalog)}this.renderer.setSize(r,i)}render(){return se.createElement("div",{ref:this.canvasWrapperRef})}}const d8={color:Ut.PRIMARY_COLOR.alt,fontWeight:300};function p8({children:n,style:e={},...t}){return R.jsx("h1",{style:{...d8,...e},...t,children:n})}const m8={padding:"0 20px",overflowY:"auto"};function g8({children:n,width:e,height:t,style:r={}}){return R.jsx("div",{style:{width:e,height:t,...m8,...r},onWheel:i=>i.stopPropagation(),children:n})}var Bv={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Vv=se.createContext&&se.createContext(Bv),_8=["attr","size","title"];function v8(n,e){if(n==null)return{};var t=x8(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function x8(n,e){if(n==null)return{};var t={};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(e.indexOf(r)>=0)continue;t[r]=n[r]}return t}function zu(){return zu=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},zu.apply(this,arguments)}function Hv(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ku(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hv(Object(t),!0).forEach(function(r){y8(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hv(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function y8(n,e,t){return e=S8(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function S8(n){var e=E8(n,"string");return typeof e=="symbol"?e:e+""}function E8(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Gv(n){return n&&n.map((e,t)=>se.createElement(e.tag,ku({key:t},e.attr),Gv(e.child)))}function yn(n){return e=>se.createElement(b8,zu({attr:ku({},n.attr)},e),Gv(n.child))}function b8(n){var e=t=>{var{attr:r,size:i,title:s}=n,o=v8(n,_8),a=i||t.size||"1em",l;return t.className&&(l=t.className),n.className&&(l=(l?l+" ":"")+n.className),se.createElement("svg",zu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,o,{className:l,style:ku(ku({color:n.color||t.color},t.style),n.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&se.createElement("title",null,s),n.children)};return Vv!==void 0?se.createElement(Vv.Consumer,null,t=>e(t)):e(Bv)}function M8(n){return yn({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"},child:[]}]})(n)}function w8(n){return yn({attr:{viewBox:"0 0 192 512"},child:[{tag:"path",attr:{d:"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"},child:[]}]})(n)}function T8(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"},child:[]}]})(n)}function A8(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"},child:[]}]})(n)}function C8(n){return yn({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"},child:[]}]})(n)}function R8(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304.083 405.907c4.686 4.686 4.686 12.284 0 16.971l-44.674 44.674c-59.263 59.262-155.693 59.266-214.961 0-59.264-59.265-59.264-155.696 0-214.96l44.675-44.675c4.686-4.686 12.284-4.686 16.971 0l39.598 39.598c4.686 4.686 4.686 12.284 0 16.971l-44.675 44.674c-28.072 28.073-28.072 73.75 0 101.823 28.072 28.072 73.75 28.073 101.824 0l44.674-44.674c4.686-4.686 12.284-4.686 16.971 0l39.597 39.598zm-56.568-260.216c4.686 4.686 12.284 4.686 16.971 0l44.674-44.674c28.072-28.075 73.75-28.073 101.824 0 28.072 28.073 28.072 73.75 0 101.823l-44.675 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.598 39.598c4.686 4.686 12.284 4.686 16.971 0l44.675-44.675c59.265-59.265 59.265-155.695 0-214.96-59.266-59.264-155.695-59.264-214.961 0l-44.674 44.674c-4.686 4.686-4.686 12.284 0 16.971l39.597 39.598zm234.828 359.28l22.627-22.627c9.373-9.373 9.373-24.569 0-33.941L63.598 7.029c-9.373-9.373-24.569-9.373-33.941 0L7.029 29.657c-9.373 9.373-9.373 24.569 0 33.941l441.373 441.373c9.373 9.372 24.569 9.372 33.941 0z"},child:[]}]})(n)}const Wv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .15s ease-in-out",WebkitTransition:"all .15s ease-in-out",alignSelf:"center",justifySelf:"center"},P8={...Wv,background:Ut.SECONDARY_COLOR.main},jv={width:"100%",textAlign:"center",display:"block",marginBottom:".5em",textTransform:"capitalize"},I8={...jv,color:Ut.COLORS.white},L8={width:"100%",height:"8em",position:"relative",overflow:"hidden",border:"solid 1px #e6e6e6",padding:0,margin:0,marginBottom:"5px"},Xv={position:"absolute",background:"#222",width:"100%",height:"100%",backgroundSize:"contain",backgroundPosition:"50% 50%",backgroundColor:Ut.COLORS.white,backgroundRepeat:"no-repeat",transition:"all .2s ease-in-out"},O8={...Xv,transform:"scale(1.2)"},q8={marginTop:"1.5em",color:Ut.SECONDARY_COLOR.main,fontSize:"2em",opacity:"0.7",width:"100%"},D8={display:"block",height:"2em",margin:"0 auto",fontSize:"0.75em",fontStyle:"italic",lineHeight:"1em",WebkitLineClamp:"2",WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},N8={listStyle:"none",margin:"0px",padding:"0px",fontSize:"11px",marginBottom:"3px"},U8={display:"inline-block",background:"#337ab7",color:Ut.COLORS.white,padding:"1px 4px",marginRight:"3px",borderRadius:"3px"},$v=({element:n})=>{const[e,t]=se.useState(!1),{selectToolDrawingLine:r,selectToolDrawingItem:i,selectToolDrawingHole:s,pushLastSelectedCatalogElementToHistory:o}=Ht(),a=()=>{switch(n.prototype){case"lines":r(n.name);break;case"items":i(n.name);break;case"holes":s(n.name);break}o(n)};return R.jsxs("div",{style:e?P8:Wv,onClick:a,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:[R.jsx("b",{style:e?I8:jv,children:n.info.title}),R.jsx("div",{style:L8,children:R.jsx("div",{style:{...e?O8:Xv,backgroundImage:"url("+n.info.image+")"},children:e?R.jsx(A8,{style:q8}):null})}),R.jsx("ul",{style:N8,children:n.info.tag.map((l,c)=>R.jsx("li",{style:U8,children:l},c))}),R.jsx("div",{style:D8,children:n.info.description})]})};function F8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3v7.12zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8h1.5z"},child:[]}]})(n)}function z8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"},child:[]}]})(n)}function k8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"},child:[]}]})(n)}function B8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"},child:[]}]})(n)}function Yv(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},child:[]}]})(n)}function V8(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 8h-6V5h6v6zm-8-6v6H5V5h6zm-6 8h6v6H5v-6zm8 6v-6h6v6h-6z"},child:[]}]})(n)}const H8={margin:"1.5em",display:"flex"},Kv={fontSize:"20px",cursor:"pointer"},G8={...Kv,fontWeight:"bolder",color:Ut.SECONDARY_COLOR.main},W8={fill:Ut.COLORS.black,fontSize:"24px",marginLeft:"10px",marginRight:"10px"},j8=({names:n})=>{let e=n.map((t,r)=>{let i=r===n.length-1;return R.jsxs("div",{style:{display:"flex"},children:[R.jsx("div",{style:i?G8:Kv,onClick:t.action||null,children:t.name}),i?null:R.jsx(Yv,{style:W8})]},r)});return R.jsx("div",{style:H8,children:e})},Zv={width:"14em",height:"14em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",margin:"0.3em",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out"},X8={...Zv,background:Ut.SECONDARY_COLOR.main},Jv={position:"absolute",color:Ut.COLORS.black,fontSize:"5em",width:"100%"},$8={...Jv,color:Ut.SECONDARY_COLOR.main},Y8={background:Ut.COLORS.white,marginBottom:"5px",border:"solid 1px #e6e6e6",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},K8=({page:n})=>{const[e,t]=se.useState(!1),{goBackToCatalogPage:r}=Ht(),i=s=>{r(s)};return R.jsx("div",{style:e?X8:Zv,onClick:()=>i(n.name),onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),children:R.jsx("div",{style:Y8,children:R.jsx(B8,{style:e?$8:Jv})})})},Z8={position:"fixed",width:"calc( 100% - 51px)",height:"calc( 100% - 20px)",backgroundColor:"#FFF",padding:"1em",left:50,overflowY:"auto",overflowX:"hidden",zIndex:10},J8={display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(14em, 1fr))",gridGap:"10px",marginTop:"1em"},Qv={width:"100%",height:"3em",padding:"0.625em",background:"#f7f7f9",border:"1px solid #e1e1e8",cursor:"pointer",position:"relative",boxShadow:"0 1px 6px 0 rgba(0, 0, 0, 0.11), 0 1px 4px 0 rgba(0, 0, 0, 0.11)",borderRadius:"2px",transition:"all .2s ease-in-out",WebkitTransition:"all .2s ease-in-out",marginBottom:"1em"},Q8={width:"8em",display:"inline-block"},eA={width:"calc( 100% - 10em )",height:"2em",margin:"0",padding:"0 1em",border:"1px solid #EEE"},tA={...Qv,padding:"0.2em 0.625em"},nA={width:"auto",height:"2em",lineHeight:"2em",textAlign:"center",borderRadius:"1em",display:"inline-block",cursor:"pointer",backgroundColor:Ut.PRIMARY_COLOR.alt,color:Ut.PRIMARY_COLOR.text_main,textTransform:"capitalize",margin:"0.25em",padding:"0 1em"},rA=({width:n,height:e,style:t,catalog:r})=>{const{planner:i,goBackToCatalogPage:s,selectToolDrawingHole:o,selectToolDrawingItem:a,selectToolDrawingLine:l,pushLastSelectedCatalogElementToHistory:c}=Ht();let h=i.catalog.page;const f=r.getCategory(h);let p=f.elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);const[d,m]=se.useState(""),[x,v]=se.useState([]);let _=null;if(h!=="root"){let A=[];i.catalog.path.forEach(L=>{A.push({name:r.getCategory(L).label,action:()=>s(L)})}),A.push({name:f.label,action:""}),_=R.jsx(j8,{names:A})}let b=i.catalog.path.size,M=b>0?R.jsx(K8,{page:r.categories[i.catalog.path.get(b-1)]},b):null,E=i.get("selectedElementsHistory"),S=E.map((A,L)=>R.jsx("div",{style:nA,title:A.name,onClick:()=>O(A),children:A.name},L));const T=A=>{let L=[];for(let N=0;N<A.length;N++){let Z=A[N];L=L.concat(Z.elements),Z.categories.length&&(L=L.concat(T(Z.categories)))}return L},q=A=>{let L=p.concat(T(f.categories)),N=[];if(A!=""){let Z=new RegExp(A,"i");for(let K=0;K<L.length;K++)Z.test(L[K].info.title)&&N.push(L[K])}m(A),v(N)},O=A=>{switch(A.prototype){case"lines":l(A.name);break;case"items":a(A.name);break;case"holes":o(A.name);break}c(A)};return R.jsxs(g8,{width:n,height:e,style:{...Z8,...t},children:[R.jsx(p8,{children:"Catalog"}),_,R.jsxs("div",{style:Qv,children:[R.jsx("span",{style:Q8,children:"Search Element"}),R.jsx("input",{type:"text",style:eA,onChange:A=>{q(A.target.value)}})]}),E.size?R.jsxs("div",{style:tA,children:[R.jsx("span",{children:"Last Selected"}),S]}):null,R.jsx("div",{style:J8,children:d===""?[M,p.map(A=>R.jsx($v,{element:A},A.name))]:x.map(A=>R.jsx($v,{element:A},A.name))})]})},iA={MODE_IDLE:rn,MODE_2D_ZOOM_IN:qs,MODE_2D_ZOOM_OUT:Ds,MODE_2D_PAN:Ns,MODE_WAITING_DRAWING_LINE:Fr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_HOLE:Vr,MODE_ROTATING_ITEM:qi};function sA({width:n,height:e,catalog:t}){const r=Ht(),{planner:i}=r,{mode:s}=i;return s===Oi?R.jsx(f8,{width:n,height:e,state:i,catalog:t,actions:{areaActions:{selectArea:r.selectArea},holesActions:{selectHole:r.selectHole,selectToolDrawingHole:r.selectToolDrawingHole,updateDrawingHole:r.updateDrawingHole,endDrawingHole:r.endDrawingHole,beginDraggingHole:r.beginDraggingHole,updateDraggingHole:r.updateDraggingHole,endDraggingHole:r.endDraggingHole},itemsActions:{selectItem:r.selectItem,selectToolDrawingItem:r.selectToolDrawingItem,updateDrawingItem:r.updateDrawingItem,endDrawingItem:r.endDrawingItem,beginDraggingItem:r.beginDraggingItem,updateDraggingItem:r.updateDraggingItem,endDraggingItem:r.endDraggingItem,beginRotatingItem:r.beginRotatingItem,updateRotatingItem:r.updateRotatingItem,endRotatingItem:r.endRotatingItem},linesActions:{selectLine:r.selectLine,selectToolDrawingLine:r.selectToolDrawingLine,beginDrawingLine:r.beginDrawingLine,updateDrawingLine:r.updateDrawingLine,endDrawingLine:r.endDrawingLine,beginDraggingLine:r.beginDraggingLine,updateDraggingLine:r.updateDraggingLine,endDraggingLine:r.endDraggingLine},projectActions:{loadProject:r.loadProject,newProject:r.newProject,openCatalog:r.openCatalog,changeCatalogPage:r.changeCatalogPage,goBackToCatalogPage:r.goBackToCatalogPage,selectToolEdit:r.selectToolEdit,unselectAll:r.unselectAll,setProperties:r.setProperties,setItemsAttributes:r.setItemsAttributes,setLinesAttributes:r.setLinesAttributes,setHolesAttributes:r.setHolesAttributes,remove:r.remove,undo:r.undo,rollback:r.rollback,openProjectConfigurator:r.openProjectConfigurator,initCatalog:r.initCatalog,updateMouseCoord:r.updateMouseCoord,updateZoomScale:r.updateZoomScale,toggleSnap:r.toggleSnap,copyProperties:r.copyProperties,pasteProperties:r.pasteProperties,pushLastSelectedCatalogElementToHistory:r.pushLastSelectedCatalogElementToHistory,setAlterateState:r.setAlterateState,setMode:r.setMode,addHorizontalGuide:r.addHorizontalGuide,addVerticalGuide:r.addVerticalGuide,removeHorizontalGuide:r.removeHorizontalGuide,removeVerticalGuide:r.removeVerticalGuide}}}):s===Mo?R.jsx(R.Fragment,{}):s===sf?R.jsx(rA,{width:n,height:e,catalog:t}):iA[s]?R.jsx(QE,{width:n,height:e,catalog:t}):s===$0?R.jsx(R.Fragment,{}):null}function oA(n){return yn({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"},child:[]}]})(n)}function aA(n){return yn({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM10.5 7.5v6m3-3h-6"},child:[]}]})(n)}const lA=(n,e,t,r,i)=>r+(i-r)*(n-e)/(t-e),cA=({sidebarWidth:n})=>{const{planner:e,viewer:t}=Ht(),{mode:r,mouse:i,zoom:s}=e,o=a=>{const l=parseInt(z1(s).toFixed());if(l===0&&a==="out"||l===100&&a==="in"||!t)return;const c=t==null?void 0:t.getValue(),h=c.viewerWidth/2,f=c.viewerHeight/2,p=a==="in"?-1:1,d=1.06,m=Math.max(-1,Math.min(1,p)),x=lA(m,-1,1,d,1/d);t.zoom(h,f,x)};if(of.includes(r))return R.jsx("div",{className:"floor_planner-footerbar absolute rounded-tl w-auto z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] h-5 select-none cursor-default bottom-0 leading-[14px] text-white m-0",style:{right:n},children:R.jsx("div",{className:"relative float-left inline-block",title:"Scene Zoom Level",children:R.jsxs("div",{className:"flex items-center gap-2",children:[R.jsx(oA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("out")})," ",R.jsxs("span",{children:[z1(s).toFixed(),"%"]})," ",R.jsx(aA,{className:"inline-block cursor-pointer",size:16,onClick:()=>o("in")})]})})})};function ex(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=ex(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function uA(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=ex(n))&&(r&&(r+=" "),r+=e);return r}const $p="-",hA=n=>{const e=dA(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split($p);return a[0]===""&&a.length!==1&&a.shift(),tx(a,e)||fA(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},tx=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?tx(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join($p);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},nx=/^\[(.+)\]$/,fA=n=>{if(nx.test(n)){const e=nx.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},dA=n=>{const{theme:e,classGroups:t}=n,r={nextPart:new Map,validators:[]};for(const i in t)Yp(t[i],r,i,e);return r},Yp=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:rx(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(pA(i)){Yp(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{Yp(o,rx(e,s),t,r)})})},rx=(n,e)=>{let t=n;return e.split($p).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},pA=n=>n.isThemeGetter,mA=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},Kp="!",Zp=":",gA=Zp.length,_A=n=>{const{prefix:e,experimentalParseClassName:t}=n;let r=i=>{const s=[];let o=0,a=0,l=0,c;for(let m=0;m<i.length;m++){let x=i[m];if(o===0&&a===0){if(x===Zp){s.push(i.slice(l,m)),l=m+gA;continue}if(x==="/"){c=m;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=s.length===0?i:i.substring(l),f=vA(h),p=f!==h,d=c&&c>l?c-l:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:d}};if(e){const i=e+Zp,s=r;r=o=>o.startsWith(i)?s(o.substring(i.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(t){const i=r;r=s=>t({className:s,parseClassName:i})}return r},vA=n=>n.endsWith(Kp)?n.substring(0,n.length-1):n.startsWith(Kp)?n.substring(1):n,xA=n=>{const e=Object.fromEntries(n.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const i=[];let s=[];return r.forEach(o=>{o[0]==="["||e[o]?(i.push(...s.sort(),o),s=[]):s.push(o)}),i.push(...s.sort()),i}},yA=n=>({cache:mA(n.cacheSize),parseClassName:_A(n),sortModifiers:xA(n),...hA(n)}),SA=/\s+/,EA=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=n.trim().split(SA);let l="";for(let c=a.length-1;c>=0;c-=1){const h=a[c],{isExternal:f,modifiers:p,hasImportantModifier:d,baseClassName:m,maybePostfixModifierPosition:x}=t(h);if(f){l=h+(l.length>0?" "+l:l);continue}let v=!!x,_=r(v?m.substring(0,x):m);if(!_){if(!v){l=h+(l.length>0?" "+l:l);continue}if(_=r(m),!_){l=h+(l.length>0?" "+l:l);continue}v=!1}const b=s(p).join(":"),M=d?b+Kp:b,E=M+_;if(o.includes(E))continue;o.push(E);const S=i(_,v);for(let T=0;T<S.length;++T){const q=S[T];o.push(M+q)}l=h+(l.length>0?" "+l:l)}return l};function bA(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=ix(e))&&(r&&(r+=" "),r+=t);return r}const ix=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=ix(n[r]))&&(t&&(t+=" "),t+=e);return t};function MA(n,...e){let t,r,i,s=o;function o(l){const c=e.reduce((h,f)=>f(h),n());return t=yA(c),r=t.cache.get,i=t.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const h=EA(l,t);return i(l,h),h}return function(){return s(bA.apply(null,arguments))}}const Sn=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},sx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ox=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wA=/^\d+\/\d+$/,TA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ma=n=>wA.test(n),vt=n=>!!n&&!Number.isNaN(Number(n)),bs=n=>!!n&&Number.isInteger(Number(n)),Jp=n=>n.endsWith("%")&&vt(n.slice(0,-1)),Ki=n=>TA.test(n),IA=()=>!0,LA=n=>AA.test(n)&&!CA.test(n),ax=()=>!1,OA=n=>RA.test(n),qA=n=>PA.test(n),DA=n=>!et(n)&&!tt(n),NA=n=>ga(n,fx,ax),et=n=>sx.test(n),oo=n=>ga(n,dx,LA),Qp=n=>ga(n,BA,vt),lx=n=>ga(n,ux,ax),UA=n=>ga(n,hx,qA),Bu=n=>ga(n,px,OA),tt=n=>ox.test(n),Il=n=>_a(n,dx),FA=n=>_a(n,VA),cx=n=>_a(n,ux),zA=n=>_a(n,fx),kA=n=>_a(n,hx),Vu=n=>_a(n,px,!0),ga=(n,e,t)=>{const r=sx.exec(n);return r?r[1]?e(r[1]):t(r[2]):!1},_a=(n,e,t=!1)=>{const r=ox.exec(n);return r?r[1]?e(r[1]):t:!1},ux=n=>n==="position"||n==="percentage",hx=n=>n==="image"||n==="url",fx=n=>n==="length"||n==="size"||n==="bg-size",dx=n=>n==="length",BA=n=>n==="number",VA=n=>n==="family-name",px=n=>n==="shadow",HA=MA(()=>{const n=Sn("color"),e=Sn("font"),t=Sn("text"),r=Sn("font-weight"),i=Sn("tracking"),s=Sn("leading"),o=Sn("breakpoint"),a=Sn("container"),l=Sn("spacing"),c=Sn("radius"),h=Sn("shadow"),f=Sn("inset-shadow"),p=Sn("text-shadow"),d=Sn("drop-shadow"),m=Sn("blur"),x=Sn("perspective"),v=Sn("aspect"),_=Sn("ease"),b=Sn("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...E(),tt,et],T=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto","contain","none"],O=()=>[tt,et,l],A=()=>[ma,"full","auto",...O()],L=()=>[bs,"none","subgrid",tt,et],N=()=>["auto",{span:["full",bs,tt,et]},bs,tt,et],Z=()=>[bs,"auto",tt,et],K=()=>["auto","min","max","fr",tt,et],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ce=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...O()],oe=()=>[ma,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],B=()=>[n,tt,et],xe=()=>[...E(),cx,lx,{position:[tt,et]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",zA,NA,{size:[tt,et]}],pe=()=>[Jp,Il,oo],Se=()=>["","none","full",c,tt,et],be=()=>["",vt,Il,oo],V=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[vt,Jp,cx,lx],ue=()=>["","none",m,tt,et],ye=()=>["none",vt,tt,et],Q=()=>["none",vt,tt,et],Le=()=>[vt,tt,et],le=()=>[ma,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ki],breakpoint:[Ki],color:[IA],container:[Ki],"drop-shadow":[Ki],ease:["in","out","in-out"],font:[DA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ki],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ki],shadow:[Ki],spacing:["px",vt],text:[Ki],"text-shadow":[Ki],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ma,et,tt,v]}],container:["container"],columns:[{columns:[vt,et,tt,a]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:q()}],"overscroll-x":[{"overscroll-x":q()}],"overscroll-y":[{"overscroll-y":q()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[bs,"auto",tt,et]}],basis:[{basis:[ma,"full","auto",a,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[vt,ma,"auto","initial","none",et]}],grow:[{grow:["",vt,tt,et]}],shrink:[{shrink:["",vt,tt,et]}],order:[{order:[bs,"first","last","none",tt,et]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:N()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:N()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...ce()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...ce(),"baseline"]}],"place-self":[{"place-self":["auto",...ce()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:oe()}],w:[{w:[a,"screen",...oe()]}],"min-w":[{"min-w":[a,"screen","none",...oe()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...oe()]}],h:[{h:["screen","lh",...oe()]}],"min-h":[{"min-h":["screen","lh","none",...oe()]}],"max-h":[{"max-h":["screen","lh",...oe()]}],"font-size":[{text:["base",t,Il,oo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tt,Qp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jp,et]}],"font-family":[{font:[FA,et,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,tt,et]}],"line-clamp":[{"line-clamp":[vt,"none",tt,Qp]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",tt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[vt,"from-font","auto",tt,oo]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[vt,"auto",tt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",tt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:xe()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},bs,tt,et],radial:["",tt,et],conic:[bs,tt,et]},kA,UA]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:Se()}],"rounded-s":[{"rounded-s":Se()}],"rounded-e":[{"rounded-e":Se()}],"rounded-t":[{"rounded-t":Se()}],"rounded-r":[{"rounded-r":Se()}],"rounded-b":[{"rounded-b":Se()}],"rounded-l":[{"rounded-l":Se()}],"rounded-ss":[{"rounded-ss":Se()}],"rounded-se":[{"rounded-se":Se()}],"rounded-ee":[{"rounded-ee":Se()}],"rounded-es":[{"rounded-es":Se()}],"rounded-tl":[{"rounded-tl":Se()}],"rounded-tr":[{"rounded-tr":Se()}],"rounded-br":[{"rounded-br":Se()}],"rounded-bl":[{"rounded-bl":Se()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[vt,tt,et]}],"outline-w":[{outline:["",vt,Il,oo]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",h,Vu,Bu]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,Vu,Bu]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[vt,oo]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",p,Vu,Bu]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[vt,tt,et]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[vt]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[tt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[vt]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:xe()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tt,et]}],filter:[{filter:["","none",tt,et]}],blur:[{blur:ue()}],brightness:[{brightness:[vt,tt,et]}],contrast:[{contrast:[vt,tt,et]}],"drop-shadow":[{"drop-shadow":["","none",d,Vu,Bu]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",vt,tt,et]}],"hue-rotate":[{"hue-rotate":[vt,tt,et]}],invert:[{invert:["",vt,tt,et]}],saturate:[{saturate:[vt,tt,et]}],sepia:[{sepia:["",vt,tt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",tt,et]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[vt,tt,et]}],"backdrop-contrast":[{"backdrop-contrast":[vt,tt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",vt,tt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[vt,tt,et]}],"backdrop-invert":[{"backdrop-invert":["",vt,tt,et]}],"backdrop-opacity":[{"backdrop-opacity":[vt,tt,et]}],"backdrop-saturate":[{"backdrop-saturate":[vt,tt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",vt,tt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[vt,"initial",tt,et]}],ease:[{ease:["linear","initial",_,tt,et]}],delay:[{delay:[vt,tt,et]}],animate:[{animate:["none",b,tt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,tt,et]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Q()}],"scale-x":[{"scale-x":Q()}],"scale-y":[{"scale-y":Q()}],"scale-z":[{"scale-z":Q()}],"scale-3d":["scale-3d"],skew:[{skew:Le()}],"skew-x":[{"skew-x":Le()}],"skew-y":[{"skew-y":Le()}],transform:[{transform:[tt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",tt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",tt,et]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[vt,Il,oo,Qp]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ti(...n){return HA(uA(n))}const mx=({children:n,name:e,...t})=>{const[r,i]=se.useState(t.opened||!1);return R.jsxs("div",{className:"select-none",style:{borderBottom:"1px solid #5e5e5e"},children:[R.jsxs("div",{className:"flex px-4 pt-2.5 pb-3 items-center gap-1 bg-[#2b2b2b] text-white cursor-pointer",onClick:()=>i(!r),children:[r?R.jsx(M8,{size:16}):R.jsx(w8,{size:16}),R.jsx("span",{className:"text-sm leading-none",children:e})]}),R.jsx("div",{className:Ti("text-[11px] text-[#EBEBEB] border border-[#222222] bg-[#424242]",r?"block":"hidden"),children:n})]})};function ti({children:n,style:e,className:t,...r}){return R.jsx("label",{className:Ti("mb-1 text-xs capitalize font-bold text-white block",t),style:e,...r,children:n})}const Zi=({value:n,min:e,max:t,precision:r,onChange:i,onValid:s,onInvalid:o,style:a,placeholder:l})=>{const[c,h]=se.useState(!0),[f,p]=se.useState(n);let d=new RegExp(`^-?([0-9]+)?\\.?([0-9]{0,${r}})?$`);se.useEffect(()=>{e!==void 0&&!isNaN(e)&&isFinite(e)&&Number(f)<e&&p(e),t&&!isNaN(t)&&isFinite(t)&&Number(f)>t&&p(t)},[e,t,f]);const m=se.useMemo(()=>parseFloat(String(n)).toFixed(r)!==parseFloat(String(f)).toFixed(r),[n,f,r]),x=v=>{if(v.stopPropagation(),c){let _=f!==""&&f!=="-"?parseFloat(String(f)):0;p(_),i({target:{value:_}})}};return R.jsxs("div",{className:"relative w-full",children:[R.jsx("input",{type:"text",value:d.test(String(f))?f:parseFloat(String(f)).toFixed(r),className:"block text-[13px] text-white h-[35px] w-full px-2 leading-5 rounded border border-[#5e5e5e] bg-[#2b2b2b] outline-none focus:outline-none",style:{...a},onChange:v=>{let _=d.test(v.target.value);_?(p(v.target.value),s&&s(v.nativeEvent)):o&&o(v.nativeEvent),h(_)},onKeyDown:v=>{var _=v.keyCode||v.which;(_==Tr.ENTER||_==Tr.TAB)&&m&&x(v)},placeholder:l}),R.jsx("div",{onClick:v=>{m&&x(v)},title:"Confirm",className:"absolute cursor-pointer w-[2em] h-[2em] text-white top-[0.35em] right-[0.35em] bg-dark-blue",style:{transition:"all 0.1s linear",visibility:m?"visible":"hidden",opacity:m?"1":"0"},children:R.jsx(F8,{style:{width:"100%",height:"100%",padding:"0.2em",color:"#FFF"}})})]})},GA={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}},WA={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}},jA={metric:GA,imperial:WA,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},XA={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}},$A={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}},YA={metric:XA,imperial:$A,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},KA={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}},ZA={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}},JA={metric:KA,imperial:ZA,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},QA={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}},e7={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}},t7={metric:QA,imperial:e7,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},n7={metric:{ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}},imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},r7={metric:{C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}},imperial:{F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}},_anchors:{metric:{unit:"C",transform:function(n){return n/(5/9)+32}},imperial:{unit:"F",transform:function(n){return(n-32)*(5/9)}}}},gx=365.25,i7={metric:{ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:3600},d:{name:{singular:"Day",plural:"Days"},to_anchor:3600*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:3600*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:3600*24*gx/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:3600*24*gx}},_anchors:{metric:{unit:"s",ratio:1}}},s7={bits:{b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}},bytes:{B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}},_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},o7={metric:{ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}},imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},a7={metric:{"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}},imperial:{"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}},_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},l7={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}},c7={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}},u7={metric:l7,imperial:c7,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},h7={metric:{A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}},_anchors:{metric:{unit:"A",ratio:1}}},f7={metric:{V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}},_anchors:{metric:{unit:"V",ratio:1}}},d7={metric:{W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}},_anchors:{metric:{unit:"W",ratio:1}}},p7={metric:{VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}},_anchors:{metric:{unit:"VAR",ratio:1}}},m7={metric:{VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}},_anchors:{metric:{unit:"VA",ratio:1}}},g7={metric:{Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}},_anchors:{metric:{unit:"J",ratio:1}}},_7={metric:{VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}},_anchors:{metric:{unit:"VARh",ratio:1}}},v7={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}},x7={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}},y7={metric:v7,imperial:x7,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},S7={metric:{lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}},imperial:{"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}},_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},E7={metric:{mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}},_anchors:{frequency:{unit:"hz",ratio:1}}},Ms={length:jA,area:YA,mass:JA,volume:t7,each:n7,temperature:r7,time:i7,digital:s7,partsPer:o7,speed:a7,pressure:u7,current:h7,voltage:f7,power:d7,reactivePower:p7,apparentPower:m7,energy:g7,reactiveEnergy:_7,volumeFlowRate:y7,illuminance:S7,frequency:E7};function Ll(n){return Object.keys(n)}function _x(n){return{abbr:n.abbr,measure:n.measure,system:n.system,singular:n.unit.name.singular,plural:n.unit.name.plural}}function Lr(n,e){if(Array.isArray(n))for(let t=0;t<n.length;t++)e(n[t],t,n);else if(n&&typeof n=="object")for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(n[t],t,n)}class b7{constructor(e,t){ut(this,"val");ut(this,"destination");ut(this,"origin");this.val=t?e/t:e}from(e){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(e),this.origin||this.throwUnsupportedUnitError(e),this}to(e){if(!this.origin)throw new Error(".to must be called after .from");if(this.destination=this.getUnit(e),this.destination||this.throwUnsupportedUnitError(e),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!==this.origin.measure)throw new Error(`Cannot convert incompatible measures of ${this.destination.measure} and ${this.origin.measure}`);let t=this.val*this.origin.unit.to_anchor;if(this.origin.unit.anchor_shift&&(t-=this.origin.unit.anchor_shift),this.origin.system!==this.destination.system){const r=Ms[this.origin.measure]._anchors[this.origin.system];t=typeof r.transform=="function"?r.transform(t):t*r.ratio}return this.destination.unit.anchor_shift&&(t+=this.destination.unit.anchor_shift),t/this.destination.unit.to_anchor}toBest(e){if(!this.origin)throw new Error(".toBest must be called after .from");const t={exclude:[],cutOffNumber:1,...e};let r=null;return Lr(this.possibilities(),i=>{if(t.exclude.includes(i))return;const s=this.describe(i);if(s.system!==this.origin.system)return;const o=this.to(i);(!r||o>=t.cutOffNumber&&o<r.val)&&(r={val:o,unit:i,singular:s.singular,plural:s.plural})}),r}getUnit(e){let t=null;return Lr(Ms,(r,i)=>{Lr(r,(s,o)=>{o!=="_anchors"&&Lr(s,(a,l)=>{l===e&&(t={abbr:e,measure:i,system:o,unit:a})})})}),t}describe(e){const t=this.getUnit(e);return t||this.throwUnsupportedUnitError(e),_x(t)}list(e){const t=[];return Lr(Ms,(r,i)=>{e&&e!==i||Lr(r,(s,o)=>{o!=="_anchors"&&Lr(s,(a,l)=>{t.push(_x({abbr:l,measure:i,system:o,unit:a}))})})}),t}throwUnsupportedUnitError(e){const t=[];throw Lr(Ms,r=>{Lr(r,(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})}),new Error(`Unsupported unit ${e}, use one of: ${t.join(", ")}`)}possibilities(e){const t=[];if(!this.origin&&!e)Lr(Ll(Ms),r=>{Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})});else{const r=e||this.origin.measure;Lr(Ms[r],(i,s)=>{s!=="_anchors"&&t.push(...Ll(i))})}return t}measures(){return Ll(Ms)}}function ni(n){return new b7(n)}const M7={fontSize:"13px",WebkitAppearance:"none"};function em({children:n,style:e,...t}){return R.jsx("select",{className:"w-full cursor-pointer block px-2 outline-none rounded h-[35px] text-white bg-[#5e5e5e]",style:{...M7,...e},...t,children:n})}const tm=({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s})=>{const{planner:o}=Ht(),a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r,d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},onChange:m=>d(m.target.value,c),onValid:t,...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.jsx("option",{value:m,children:m},m))})})]})]})},Ol=({style:n,...e})=>R.jsx("input",{className:"block w-full px-2 text-sm leading-5 bg-[#2b2b2b] rounded border border-[#5e5e5e] outline-none h-[35px] text-white",style:{...n},type:"text",...e}),w7=({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i})=>{const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{value:n,onChange:a=>o(a.target.value)})]})},T7=({element:n,attributeFormData:e,onUpdate:t,...r})=>{let i=e.has("name")?e.get("name"):n.name,s=e.has("offsetA")?e.get("offsetA"):n.offsetA,o=e.has("offsetB")?e.get("offsetB"):n.offsetA;return R.jsxs("div",{children:[R.jsx(w7,{value:i,onUpdate:a=>t("name",a),configs:{label:"Nome"},...r}),R.jsx(tm,{value:s,onUpdate:a=>t("offsetA",a),configs:{label:"Offset 1",min:0,max:1/0,precision:2},...r}),R.jsx(tm,{value:o,onUpdate:a=>t("offsetB",a),configs:{label:"Offset 2",min:0,max:1/0,precision:2},...r})]})},A7=({element:n,onUpdate:e,attributeFormData:t,...r})=>{let i=t.has("name")?t.get("name"):n.name,s=t.has("x")?t.get("x"):n.x,o=t.has("y")?t.get("y"):n.y,a=t.has("rotation")?t.get("rotation"):n.rotation;return R.jsx("table",{className:"w-full",children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:i,onChange:l=>e("name",l.target.value),style:{textAlign:"left"}})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:s,onChange:l=>e("x",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:o,onChange:l=>e("y",l.target.value),style:{textAlign:"left"},precision:2,...r})})]}),R.jsxs("tr",{children:[R.jsx("td",{className:"w-[6em]",children:"Rotation"}),R.jsx("td",{children:R.jsx(Zi,{value:a,onChange:l=>e("rotation",l.target.value),style:{textAlign:"left"},precision:2,...r})})]})]})})},C7=({element:n,onUpdate:e,attributeFormData:t})=>{let r=t.has("name")?t.get("name"):n.name,i=t.has("lineLength")?t.get("lineLength"):null;return R.jsxs("div",{children:[R.jsxs("div",{className:"w-full mb-2",children:[R.jsx(ti,{children:"Name"}),R.jsx(Ol,{value:r,onChange:s=>e("name",s.target.value),style:{textAlign:"left"}})]}),R.jsx(tm,{value:i,onUpdate:s=>e("lineLength",s),configs:{label:"Length",min:0,max:1/0,precision:2}})]})},R7=({element:n,onUpdate:e,onValid:t,attributeFormData:r,...i})=>n.prototype==="items"?R.jsx(A7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="lines"?R.jsx(C7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):n.prototype==="holes"?R.jsx(T7,{element:n,onUpdate:e,onValid:t,attributeFormData:r,...i}):null,ri=2,P7=(n,e,t)=>{switch(n=typeof n.misc=="object"?n.set("misc",Pe(n.misc)):n,n.prototype){case"items":return Pe(n);case"lines":{let r=e.vertices.get(n.vertices.get(0)),i=e.vertices.get(n.vertices.get(1)),s=Ln(r.x,r.y,i.x,i.y),o=n.misc.get("_unitLength")||t.unit,a=ni(s).from(t.unit).to(o);return Pe({vertexOne:r,vertexTwo:i,lineLength:Pe({length:s,_length:a,_unit:o})})}case"holes":{let r=e.lines.get(n.line),{x:i,y:s}=e.vertices.get(r.vertices.get(0)),{x:o,y:a}=e.vertices.get(r.vertices.get(1)),l=Ln(i,s,o,a),c=l*n.offset-n.properties.get("width").get("length")/2,h=n.misc.get("_unitA")||t.unit,f=ni(c).from(t.unit).to(h),p=l-l*n.offset-n.properties.get("width").get("length")/2,d=n.misc.get("_unitB")||t.unit,m=ni(p).from(t.unit).to(d);return Pe({offset:n.offset,offsetA:Pe({length:Jn(c,ri),_length:Jn(f,ri),_unit:h}),offsetB:Pe({length:Jn(p,ri),_length:Jn(m,ri),_unit:d})})}case"areas":return Pe({});default:return null}},I7=(n,e)=>{const t=e.getElement(n.type),r={};for(const i in t.properties)r[i]=Pe({currentValue:n.properties.has(i)?n.properties.get(i):At(t.properties[i].defaultValue),configs:t.properties[i]});return Pe(r)},L7=({element:n,layer:e,catalog:t})=>{const{planner:r,setItemsAttributes:i,setProperties:s,setLinesAttributes:o,setHolesAttributes:a}=Ht(),[l,c]=se.useState(P7(n,e,t)),[h,f]=se.useState(I7(n,t)),p=({propertiesFormData:x,attributesFormData:v})=>{if(x){let _=x.map(b=>b.get("currentValue"));s(_)}if(v)switch(n.prototype){case"items":{i(v);break}case"lines":{o(v);break}case"holes":{a(v);break}}},d=(x,v)=>{if(!l)return;let _;switch(n.prototype){case"items":{_=l.set(x,v);break}case"lines":{switch(x){case"lineLength":{let b=l.get("vertexOne"),M=l.get("vertexTwo"),[E,S]=Qa([b,M]),T=mc(E.x,E.y,S.x,S.y,v.get("length"),ri);_=l.withMutations(q=>{q.set(b===E?"vertexTwo":"vertexOne",S.merge(T)),q.set("lineLength",v)});break}case"vertexOne":case"vertexTwo":{_=l.withMutations(b=>{b.set(x,b.get(x).merge(v));let M=fc(b.get("vertexOne"),b.get("vertexTwo"));b.mergeIn(["lineLength"],b.get("lineLength").merge({length:M,_length:ni(M).from(t.unit).to(b.get("lineLength").get("_unit"))}))});break}default:{_=l.set(x,v);break}}break}case"holes":{switch(x){case"offsetA":{let b=e.lines.get(n.line),M=Qa([e.vertices.get(b.vertices.get(0)),e.vertices.get(b.vertices.get(1))]),[{x:E,y:S},{x:T,y:q}]=M,O=cf(E,S,T,q),A=Ln(E,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let K=(Z+N)*Math.cos(O)+E,ne=(Z+N)*Math.sin(O)+S,ce=On(E,S,T,q,K,ne),J=Jn(A-A*ce-N,ri),oe=l.getIn(["offsetB","_unit"]),B=Pe({length:J,_length:ni(J).from(t.unit).to(oe),_unit:oe});_=l.set("offsetB",B).set("offset",ce);let xe=Pe({length:Jn(Z,ri),_unit:v.get("_unit"),_length:Jn(ni(Z).from(t.unit).to(v.get("_unit")),ri)});_=l.set(x,xe);break}case"offsetB":{let b=e.lines.get(n.line),M=Qa([e.vertices.get(b.vertices.get(0)),e.vertices.get(b.vertices.get(1))]),[{x:E,y:S},{x:T,y:q}]=M,O=cf(E,S,T,q),A=Ln(E,S,T,q),L=n.properties.get("width").get("length"),N=L/2,Z=v.get("length");Z=Math.max(Z,0),Z=Math.min(Z,A-L);let K=T-(Z+N)*Math.cos(O),ne=q-(Z+N)*Math.sin(O),ce=On(E,S,T,q,K,ne),J=Jn(A*ce-N,ri),oe=l.getIn(["offsetA","_unit"]),B=Pe({length:J,_length:ni(J).from(t.unit).to(oe),_unit:oe});_=l.set("offsetA",B).set("offset",ce);let xe=Pe({length:Jn(Z,ri),_unit:v.get("_unit"),_length:Jn(ni(Z).from(t.unit).to(v.get("_unit")),ri)});_=l.set(x,xe);break}default:{_=l.set(x,v);break}}break}}_&&(c(_),p({attributesFormData:_,propertiesFormData:h}))},m=(x,v)=>{const _=h.setIn([x,"currentValue"],v);f(_),p({propertiesFormData:_,attributesFormData:l})};return R.jsxs("div",{children:[R.jsx(R7,{element:n,onValid:()=>{},onUpdate:d,attributeFormData:l}),h.entrySeq().map(([x,v])=>{let _=v.get("currentValue"),b=v.get("configs"),{Editor:M}=t.getPropertyType(b.type);return R.jsx(M,{propertyName:x,value:_,configs:b,onUpdate:E=>m(x,E),state:r,sourceElement:n,internalState:{attributesFormData:l,propertiesFormData:h}},x)})]})},O7=()=>R.jsx("div",{className:"h-full flex flex-col gap-4 justify-center items-center",children:R.jsx("p",{className:"mx-4 text-white text-sm text-center",children:"Select an element on the canvas to edit its properties."})}),q7=[rn,qs,Ds,Ns,Oi,Mo,Fr,cr,ur,wr,zr,kr,Br,Vr,qi,nf,rf],D7=({catalog:n})=>{const{planner:e}=Ht(),{scene:t,mode:r}=e;return q7.includes(r)?t.layers.valueSeq().flatMap(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>({element:o,layer:s}))).toArray().length===0?R.jsx(O7,{}):R.jsx("div",{children:t.layers.valueSeq().map(s=>mn().concat(s.lines,s.holes,s.areas,s.items).filter(o=>o.selected).map(o=>R.jsx(mx,{name:"Properties",opened:!0,children:R.jsx("div",{style:{padding:"5px 15px"},children:R.jsx(L7,{element:o,layer:s,catalog:n})})},o.id)).valueSeq())}):null},N7={MODE_IDLE:rn,MODE_2D_ZOOM_IN:qs,MODE_2D_ZOOM_OUT:Ds,MODE_2D_PAN:Ns,MODE_3D_VIEW:Oi,MODE_3D_FIRST_PERSON:Mo,MODE_WAITING_DRAWING_LINE:Fr,MODE_DRAWING_LINE:cr,MODE_DRAWING_HOLE:ur,MODE_DRAWING_ITEM:wr,MODE_DRAGGING_LINE:zr,MODE_DRAGGING_VERTEX:kr,MODE_DRAGGING_ITEM:Br,MODE_DRAGGING_HOLE:Vr,MODE_FITTING_IMAGE:rf,MODE_UPLOADING_IMAGE:nf,MODE_ROTATING_ITEM:qi},U7={width:"100%"},Hu={width:"6em"},Gu={textAlign:"left"},F7={marginLeft:"5px",border:"0px",background:"none",color:"#FFFFFF",fontSize:"14px",outline:"0px"},z7={width:"100%",cursor:"pointer",maxHeight:"20em",marginLeft:"1px",marginTop:"1em"},vx={width:"2em"},k7=({groupID:n})=>{const{planner:e,setGroupAttributes:t,groupTranslate:r,groupRotate:i,removeFromGroup:s}=Ht(),{mode:o}=e;if(!n||!N7[o])return null;const a=e.getIn(["scene","groups",n]),l=a.get("elements");return R.jsx(mx,{name:`Group [${a.get("name")}]`,opened:!0,children:R.jsxs("div",{style:{padding:"5px 15px"},children:[R.jsx("table",{style:U7,children:R.jsxs("tbody",{children:[R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Name"}),R.jsx("td",{children:R.jsx(Ol,{value:a.get("name"),onChange:c=>t(n,Pe({name:c.target.value})),style:Gu})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"X"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("x"),onChange:c=>r(n,c.target.value,a.get("y")),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Y"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("y"),onChange:c=>r(n,a.get("x"),c.target.value),style:Gu,precision:2})})]}),R.jsxs("tr",{children:[R.jsx("td",{style:Hu,children:"Rotation"}),R.jsx("td",{children:R.jsx(Zi,{value:a.get("rotation"),onChange:c=>i(n,c.target.value),style:Gu,precision:2})})]})]})}),l.size?R.jsxs("div",{children:[R.jsx("p",{style:{textAlign:"center",borderBottom:"1px solid #555",paddingBottom:"1em"},children:"Group's Elements"}),R.jsxs("table",{style:z7,children:[R.jsx("thead",{children:R.jsxs("tr",{children:[R.jsx("th",{style:vx}),R.jsx("th",{children:"Layer"}),R.jsx("th",{children:"Prototype"}),R.jsx("th",{children:"Name"})]})}),R.jsx("tbody",{children:l.entrySeq().map(([c,h])=>h.entrySeq().map(([f,p])=>p.valueSeq().map(d=>{let m=e.getIn(["scene","layers",c,f,d]);return R.jsxs("tr",{children:[R.jsx("td",{style:vx,title:"Un-chain Element from Group",children:R.jsx(R8,{onClick:()=>s(n,c,f,d),style:F7})}),R.jsx("td",{style:{textAlign:"center"},children:c}),R.jsx("td",{style:{textAlign:"center",textTransform:"capitalize"},children:f}),R.jsx("td",{style:{textAlign:"center"},children:m.name})]},d)})))})]})]}):null]})})},B7=({catalog:n,width:e=280})=>{const{planner:t}=Ht(),r=t.getIn(["scene","selectedLayer"]),i=t.getIn(["scene","layers",r,"selected"]),s=t.getIn(["scene","groups"]).findEntry(a=>a.get("selected")),o=i.lines.size>1||i.items.size>1||i.holes.size>1||i.areas.size>1||i.lines.size+i.items.size+i.holes.size+i.areas.size>1;return R.jsxs("aside",{onKeyDown:a=>a.stopPropagation(),onKeyUp:a=>a.stopPropagation(),className:"floor_planner-sidebar bg-[#424242] h-full block overflow-y-auto overflow-x-hidden pb-5",style:{width:e},children:[!o&&R.jsx(D7,{catalog:n}),!!s&&R.jsx(k7,{groupID:s?s[0]:null})]})},Or=({active:n,tooltip:e,onClick:t,children:r,className:i})=>{const[s,o]=se.useState(!1),a=n||s?"text-dark-blue":"text-[#C2C2C2]",l=c=>{t(c),o(!1)};return R.jsxs("div",{className:Ti("w-[30px] h-[30px] flex items-center justify-center text-[25px] relative cursor-pointer",i),onClick:l,onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:[R.jsx("div",{className:a,onClick:l,children:r}),s&&R.jsxs("div",{onClick:c=>{c.preventDefault(),c.stopPropagation()},className:"absolute w-[140px] text-white bg-black h-[30px] leading-[30px] text-center rounded-md opacity-80 left-full top-1/2 -mt-[15px] ml-[15px] z-[999] text-[12px]",children:[R.jsx("span",{className:"absolute top-1/2 right-full -mt-[8px] w-0 h-0 border-r-[8px] border-r-black border-t-[8px] border-t-transparent border-b-[8px] border-b-transparent"}),e]})]})},xx=()=>new Promise(async n=>{const e=document.getElementsByTagName("svg");if(!e.length)return;let t=e[0];for(let p=1;p<e.length;p++)e[p].width.baseVal.value>t.width.baseVal.value&&(t=e[p]);const r=t.cloneNode(!0),i=r.querySelectorAll("image");await Promise.all(Array.from(i).map(async p=>{const d=p.getAttribute("href")||p.getAttribute("xlink:href");if(d)try{const x=await(await fetch(d)).blob(),v=new FileReader;await new Promise(_=>{v.onloadend=()=>{p.setAttribute("href",v.result),_()},v.readAsDataURL(x)})}catch(m){console.warn("⚠️ Could not inline image:",d,m)}}));const o=new XMLSerializer().serializeToString(r),a=t.width.baseVal.value,l=t.height.baseVal.value,c=document.createElement("canvas");c.width=a,c.height=l;const h=c.getContext("2d");h.fillStyle="white",h.fillRect(0,0,a,l);const f=new Image;f.src=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(o)))}`,f.onload=()=>{h.drawImage(f,0,0,a,l),n(c.toDataURL("image/png"))}});function yx(n){return yn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 19a2 2 0 0 1 -2 -2"},child:[]},{tag:"path",attr:{d:"M5 13v-2"},child:[]},{tag:"path",attr:{d:"M5 7a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M11 5h2"},child:[]},{tag:"path",attr:{d:"M17 5a2 2 0 0 1 2 2"},child:[]},{tag:"path",attr:{d:"M19 11v2"},child:[]},{tag:"path",attr:{d:"M19 17v4"},child:[]},{tag:"path",attr:{d:"M21 19h-4"},child:[]},{tag:"path",attr:{d:"M13 19h-2"},child:[]}]})(n)}const Sx=n=>{let e=document.createElement("a"),t="output"+Date.now()+".png";t=window.prompt("Insert output filename",t),t&&(e.setAttribute("download",t),e.href=n,e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e))};function V7({mode:n}){const e=r=>{r.preventDefault();const i=document.getElementsByTagName("canvas")[0];Sx(i.toDataURL())},t=async r=>{r.preventDefault(),xx().then(Sx)};return[Mo,Oi].includes(n)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:e,children:R.jsx(yx,{size:28})}):[rn,qs,Ds,Ns,Fr,zr,kr,Br,cr,ur,wr,Vr,qi].includes(n)?R.jsx(Or,{active:!1,tooltip:"Get Screenshot",onClick:t,children:R.jsx(yx,{size:28})}):null}function H7(n){return yn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M12 9v6"},child:[]},{tag:"path",attr:{d:"M16 15v6"},child:[]},{tag:"path",attr:{d:"M16 3v6"},child:[]},{tag:"path",attr:{d:"M3 15h18"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"M8 15v6"},child:[]},{tag:"path",attr:{d:"M8 3v6"},child:[]}]})(n)}const G7=/^.*$/;function W7({onChange:n,...e}){const[t,r]=se.useState(""),i=se.useRef(null);se.useEffect(()=>{r(e.value)},[e.value]);const s=a=>{if(!a)return;const l=a.target.value;G7.test(l)&&n&&n(a)},o=a=>{(!a.key||a.key==="Enter")&&s({target:{value:t}})};return R.jsxs("div",{className:"color-field flex-1 flex pr-3 mt-1 cursor-pointer",children:[R.jsx("div",{className:"colorBox relative w-[22px] h-[22px]",style:{background:e.value},onClick:()=>{i.current&&i.current.click()},children:R.jsx("input",{ref:i,type:"color",onChange:s,value:e.value,className:"absolute invisible h-full w-full"})}),R.jsx("div",{className:"flex-1 pl-2",children:R.jsx("input",{className:"colorFieldInput min-w-[90px] cursor-pointer",type:"text",value:t,onKeyDown:o,onChange:a=>r(a.target.value),onBlur:o})})]})}function Ex({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyColor w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(W7,{value:n,onChange:a=>o(a.target.value)})]})}function bx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyEnum w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(em,{value:n,onChange:a=>o(a.target.value),children:mn(t.values).entrySeq().map(([a,l])=>R.jsx("option",{value:a,children:l},a))})]})}function Mx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht();let o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyString w-full mb-2",children:[R.jsx(ti,{children:t.label}),R.jsx(Ol,{value:n,onChange:a=>o(a.target.value)})]})}function wx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=Ht(),a=l=>{let c=parseFloat(l);return isNaN(c)&&(c=0),r.hook?r.hook(c,i,s,o).then(h=>e(h)):e(c)};return R.jsxs("div",{className:"PropertyNumber w-full mb-2",children:[R.jsx(ti,{children:r.label}),R.jsx(Zi,{value:n,onChange:l=>a(l.target.value),onValid:t,min:r.min,max:r.max})]})}function Tx({value:n,onUpdate:e,onValid:t,configs:r,sourceElement:i,internalState:s}){const{planner:o}=Ht();let a=n.get("length")||0,l=n.get("_length")||a,c=n.get("_unit")||hi,{hook:h,label:f,...p}=r;const d=(m,x)=>{let v=Jn(m),_=n.merge({length:x!==hi?ni(v).from(x).to(hi):v,_length:m,_unit:x});return h?h(_,i,s,o).then(b=>e(b)):e(_)};return R.jsxs("div",{className:"PropertyLengthMeasure w-full mb-2",children:[R.jsx(ti,{children:f}),R.jsxs("div",{className:"w-full flex",children:[R.jsx(Zi,{value:l,onChange:m=>d(m.target.value,c),onValid:t,style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderRightWidth:0},...p}),R.jsx("div",{className:"w-1/4 [&>*:first-child]:text-center",children:R.jsx(em,{style:{borderTopLeftRadius:"0px",borderBottomLeftRadius:"0px"},value:c,onChange:m=>d(l,m.target.value),children:Y0.map(m=>R.jsx("option",{value:m,children:m},m))})})]})]})}function j7({type:n="button",size:e="normal",style:t,styleHover:r,children:i,...s}){const[o,a]=se.useState(!1),l="inline-block font-normal leading-[1.25] text-center whitespace-nowrap align-middle cursor-pointer select-none outline-none border border-solid w-full transition-colors duration-175 ease-linear rounded-[2px]",c=e==="small"?"text-[12px] px-2 py-[3px]":e==="large"?"px-5 py-2":"text-[14px] px-3 py-[5px]",h={backgroundColor:"#e6e6e6",borderColor:"#adadad"},f={backgroundColor:"#d4d4d4",borderColor:"#8c8c8c"};return R.jsx("button",{type:n,className:`${l} ${c}`,style:{...o?{...f,...r}:{...h,...t}},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),...s,children:i})}const Wu={tableStyle:{width:"100%",borderSpacing:"2px 0",marginBottom:"2px"},firstTdStyle:{width:"6em",textTransform:"capitalize"}};function Ax({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsx("table",{className:"PropertyToggle",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:t.label})}),R.jsx("td",{children:R.jsx(j7,{onClick:()=>o(!n),size:"small",children:t.actionName})})]})})})}function Cx({value:n,onUpdate:e,configs:t,sourceElement:r,internalState:i}){const{planner:s}=Ht(),o=a=>t.hook?t.hook(a,r,i,s).then(l=>e(l)):e(a);return R.jsxs("div",{className:"PropertyCheckbox w-full flex items-center gap-2 mb-2",children:[R.jsx("input",{className:"m-0 mt-0.5",type:"checkbox",checked:n,onChange:()=>o(!n)}),R.jsx(ti,{className:"mb-0",children:t.label})]})}function Rx(){return null}function Px({value:n,configs:e}){return R.jsx("table",{className:"PropertyReadOnly",style:Wu.tableStyle,children:R.jsx("tbody",{children:R.jsxs("tr",{children:[R.jsx("td",{style:Wu.firstTdStyle,children:R.jsx(ti,{children:e.label})}),R.jsx("td",{children:R.jsx("div",{children:n})})]})})})}class X7{constructor(e=hi){ut(this,"elements");ut(this,"categories");ut(this,"propertyTypes");ut(this,"unit");this.elements={},this.categories={root:{name:"root",label:"/",elements:[],categories:[]}},this.propertyTypes={},this.unit=e,this.registerMultiplePropertyType([["color",Ex,Ex],["enum",bx,bx],["string",Mx,Mx],["number",wx,wx],["length-measure",Tx,Tx],["toggle",Ax,Ax],["checkbox",Cx,Cx],["hidden",Rx,Rx],["read-only",Px,Px]])}getElement(e){if(this.hasElement(e))return this.elements[e];throw new Error(`Element ${e} does not exist in catalog`)}getCategory(e){if(this.hasCategory(e))return this.categories[e];throw new Error(`Category ${e} does not exist in catalog`)}getPropertyType(e){if(this.propertyTypes.hasOwnProperty(e))return this.propertyTypes[e];throw new Error(`Element ${e} does not exist in catalog`)}registerElement(e){e.properties=e.properties||{},this.validateElement(e)&&(this.elements[e.name]=e,this.categories.root.elements.push(this.elements[e.name]))}registerMultipleElements(e){e.forEach(t=>this.registerElement(t))}registerPropertyType(e,t,r){this.propertyTypes[e]={type:e,Viewer:t,Editor:r}}registerMultiplePropertyType(e){e.forEach(t=>this.registerPropertyType(...t))}validateElement(e){if(!e.hasOwnProperty("name"))throw new Error("Element not valid");let t=e.name;if(!e.hasOwnProperty("prototype"))throw new Error(`Element ${t} doesn't have prototype`);if(!e.hasOwnProperty("info"))throw new Error(`Element ${t} doesn't have info`);if(!e.info.hasOwnProperty("tag"))throw new Error(`Element ${t} doesn't have tag`);if(!e.info.hasOwnProperty("description"))throw new Error(`Element ${t} doesn't have description`);if(!e.info.hasOwnProperty("image"))throw new Error(`Element ${t} doesn't have image`);if(!e.hasOwnProperty("render2D"))throw new Error(`Element ${t} doesn't have render2D handler`);if(!e.hasOwnProperty("render3D"))throw new Error(`Element ${t} doesn't have render3D handler`);if(!e.hasOwnProperty("properties"))throw new Error(`Element ${t} doesn't have properties`);for(let r in e.properties){let i=e.properties[r];if(!i.hasOwnProperty("type"))throw new Error(`Element ${t}, Property ${r} doesn't have type`);if(!i.hasOwnProperty("defaultValue"))throw new Error(`Element ${t}, Property ${r} doesn't have defaultValue`)}return!0}hasElement(e){return this.elements.hasOwnProperty(e)}registerCategory(e,t,r){return this.validateCategory(e,t)?(this.categories[e]={name:e,label:t,categories:[],elements:[]},this.categories.root.categories.push(this.categories[e]),r&&r.length&&r.forEach(i=>this.addToCategory(e,i)),this.categories[e]):null}addToCategory(e,t){if(this.hasElement(t.name))this.categories[e].elements.push(t),this.categories.root.elements.splice(this.categories.root.elements.indexOf(t),1);else if(this.hasCategory(t.name))this.categories[e].categories.push(t),this.categories.root.categories.splice(this.categories.root.categories.indexOf(t),1);else throw new Error(`child ${t} is either category nor element`)}categoryHasElement(e,t){return this.hasCategory(e)&&this.categories[e].elements.some(r=>r.name===t)}validateCategory(e,t){if(!e)throw new Error("Category has undefined name");if(e==="")throw new Error("Category has empty name");if(this.hasCategory(e))throw new Error("Category has already been registered");return!0}hasCategory(e){return this.categories.hasOwnProperty(e)}}function $7(n){return yn({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"},child:[]}]})(n)}const Y7=({term:n="",placeholder:e="Search",noSpacing:t=!1,onClick:r=()=>!1,isStatic:i=!1,hasDropDown:s=!1,onSearch:o,className:a})=>{const[l,c]=se.useState("");return R.jsxs("div",{className:Ti(`relative w-full ${t?"mt-1":"mt-2"}`,a),onClick:r??(()=>!1),children:[R.jsx("span",{className:`absolute left-0 top-2 text-[#637381] ${t?"":"ml-2"}`,style:{zIndex:2},children:R.jsx($7,{size:18})}),i?R.jsx("div",{className:"w-full rounded border border-gray-300 bg-white px-3 py-1.5 text-xs font-normal cursor-pointer",style:{marginTop:3},children:n}):R.jsx("input",{className:"w-full rounded pl-[30px] focus:outline-none border border-gray-300 bg-white pr-3 py-1.5 text-sm text-gray-900",type:"text",placeholder:e,onChange:h=>{o(h.target.value,h),c(h.target.value)},value:l,onClick:r??(()=>!1)}),r!==null&&s&&R.jsx("span",{className:`absolute right-2 top-1/2 -translate-y-1/2 ${t?"":"ml-2"}`,style:{zIndex:1},children:R.jsx(C8,{className:"-mb-1"})})]})},Ix=0,Lx=58,K7=n=>{const e=[{label:"All Categories",value:"all"}],t=n.map(r=>r.info.tag);for(const r of t){let i=e;for(let s=0;s<r.length;s++){const o=r[s];let a=i.find(l=>l.label===o);a||(a={label:o,value:o},s<r.length-1&&(a.options=[{label:"All Categories",value:"all"}]),i.push(a)),s<r.length-1&&a.options&&(i=a.options)}}return e},Ox=({options:n,selections:e,level:t,onChange:r})=>{var i,s;return R.jsxs(R.Fragment,{children:[R.jsx("select",{className:"w-full rounded capitalize cursor-pointer focus:outline-none border border-gray-300 bg-white pr-3 pl-1.5 py-1.5 text-sm text-gray-900",value:e[t]||"all",onChange:o=>r(t,o.target.value),children:n.map(o=>R.jsx("option",{className:"capitalize",value:o.value,children:o.label},o.value))}),e[t]&&e[t]!=="all"&&((i=n.find(o=>o.value===e[t]))==null?void 0:i.options)&&R.jsx(Ox,{options:((s=n.find(o=>o.value===e[t]))==null?void 0:s.options)||[],level:t+1,selections:e,onChange:r})]})},Z7=({catalog:n,popupEvent:e,onClose:t})=>{const{setToast:r,selectToolDrawingLine:i,selectToolDrawingItem:s,selectToolDrawingHole:o,pushLastSelectedCatalogElementToHistory:a}=Ht(),[l,c]=se.useState([]),[h,f]=se.useState(["all"]),[p,d]=se.useState([]),[m,x]=se.useState(""),v=se.useRef(null),_=se.useRef(null);se.useEffect(()=>{if(e){const T=n.getCategory(e.page).elements.filter(A=>A.info.visibility?A.info.visibility.catalog:!0);v.current=e.page,d(T);const{x:q,y:O}=e.rect;_.current={top:O+Ix,left:q+Lx},e.page==="objects"&&c(K7(T))}},[e]);const b=()=>{t()},M=S=>{b(),e&&r({text:`Cancel placing ${e.page}`}),setTimeout(()=>{switch(S.prototype){case"lines":i(S.name);break;case"items":s(S.name);break;case"holes":o(S.name);break}a(S)},0)},E=(S,T)=>{const q=[...h.slice(0,S),T];f(q)};return R.jsxs(R.Fragment,{children:[e&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:b}),R.jsxs("div",{style:e&&e.rect?{top:e.rect.y+Ix,left:e.rect.x+Lx}:_.current?_.current:{},className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[250px] !min-w-[330px] max-w-[330px] !max-h-[510px] transition-all duration-200 ease-out transform",e?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsxs("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:[R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:(e==null?void 0:e.page)??v.current})})}),R.jsxs("div",{className:Ti("fp-highlight"),children:[R.jsx(Ox,{options:l,level:0,selections:h,onChange:E}),R.jsx(Y7,{className:"mt-0",placeholder:"Search",onSearch:(S,T)=>{T.preventDefault(),T.stopPropagation(),x(S)}})]})]}),p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).length>0?R.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 pb-5 overflow-auto w-full pt-[18px] px-4",onWheel:S=>S.stopPropagation(),children:p.filter(S=>S.info.title.toLowerCase().includes(m.toLowerCase())&&h.every(T=>T==="all"||S.info.tag.includes(T))).map(S=>R.jsxs("div",{className:"w-full space-y-1.5",children:[R.jsx("div",{className:"fp-aspect-ratio-container",children:R.jsx("div",{className:"fp-aspect-ratio-content",onMouseDown:()=>M(S),children:R.jsx("img",{draggable:!1,className:"fp-item-image",alt:S.info.title,src:S.info.image})})}),R.jsx("p",{className:"text-xs font-semibold capitalize",children:S.info.description})]},S.name.replace(/\s+/g,"_")))}):R.jsx("div",{className:"min-h-28 w-full flex items-center justify-center",children:R.jsx("p",{className:"text-sm font-medium text-gray-400 text-center",children:"No records found"})})]})]})};function J7(n){return yn({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M320 32c0-9.9-4.5-19.2-12.3-25.2S289.8-1.4 280.2 1l-179.9 45C79 51.3 64 70.5 64 92.5L64 448l-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 192 0 32 0 0-32 0-448zM256 256c0 17.7-10.7 32-24 32s-24-14.3-24-32s10.7-32 24-32s24 14.3 24 32zm96-128l96 0 0 352c0 17.7 14.3 32 32 32l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320c0-35.3-28.7-64-64-64l-96 0 0 64z"},child:[]}]})(n)}function Q7(n){return yn({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M112 73c-13.75 0-24.214 4.87-33.047 13.271-8.832 8.402-15.755 20.6-20.414 34.575-5.887 17.661-7.953 38.064-6.887 56.111a57.246 57.246 0 0 1 2.461-.187c8.38-.405 16.317 1.094 23.494 4.234 14.355 6.28 25.436 18.27 34.057 32.28 15.104 24.543 23.187 55.746 24.96 80.585 114.097-14.223 124.655-14.223 238.753 0 1.772-24.84 9.855-56.042 24.959-80.586 8.62-14.009 19.702-25.999 34.057-32.28 7.875-3.444 16.67-4.898 25.955-4.046 1.066-18.047-1-38.45-6.887-56.111-4.659-13.976-11.582-26.173-20.414-34.575C424.214 77.87 413.75 73 400 73zM56.969 194.502c-.686-.008-1.38.006-2.082.04-5.621.284-11.8 1.978-18.862 5.509-23.413 11.707-26.349 65.687 14.82 79.41l4.505 1.502L86.79 391h338.42l31.44-110.037 4.504-1.502c41.17-13.723 38.234-67.703 14.82-79.41-14.121-7.061-24.722-6.775-34.367-2.555-9.645 4.22-18.564 13.23-25.943 25.22C400.906 246.7 393 282 393 304v10.195l-10.117-1.265c-128-16-125.766-16-253.766 0L119 314.195V304c0-22-7.906-57.3-22.664-81.283-7.38-11.991-16.298-21.001-25.943-25.22-4.22-1.847-8.624-2.94-13.424-2.995zM83.727 409l-23.272 23.271c11.994 3.239 33.75 3.763 42.545-1.666 3.272-4.695 6.903-14.536 10.438-21.605zm314.836 0c1.494 6.017 6.952 19.12 10.437 21.605 13.2 5.463 29.904 5.774 42.545 1.666L428.273 409z"},child:[]}]})(n)}const qx={fontSize:"19px",textDecoration:"none",fontWeight:"bold",margin:"0px",userSelect:"none"},eC=({style:n})=>R.jsx("p",{style:{...qx,...n},children:"2D"}),tC=({style:n})=>R.jsx("p",{style:{...qx,...n},children:"3D"});function nC({catalog:n,has3dView:e}){const{planner:t,setMode:r,setToast:i,selectTool3DView:s,unselectAll:o,selectToolDrawingLine:a}=Ht(),{mode:l,alterate:c}=t,[h,f]=se.useState(null);return R.jsxs(R.Fragment,{children:[R.jsxs("aside",{className:"floor_planner-toolbar -mt-[20px] absolute left-2 !pt-3 top-1/2 -translate-y-1/2 z-[1] rounded max-h-full max-w-[50px] p-2.5 space-y-4 bg-[#2b2b2b]",children:[R.jsx(Or,{active:[Fr,cr].includes(l),tooltip:"Draw wall",onClick:()=>{i({text:"Cancel drawing"}),a("wall")},children:R.jsx(H7,{})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="windows"),tooltip:"Place windows",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"windows"})},children:R.jsx(V8,{size:26})}),R.jsx(Or,{active:!!([ur].includes(l)&&h&&h.page==="doors"),tooltip:"Place doors",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"doors"})},children:R.jsx(J7,{size:26})}),R.jsx(Or,{active:!!([wr].includes(l)&&h&&h.page==="objects"),tooltip:"Place objects",onClick:p=>{f({rect:(p.currentTarget.parentElement??p.currentTarget).getBoundingClientRect(),page:"objects"})},children:R.jsx(Q7,{size:26})}),e?[Oi].includes(l)?R.jsx(Or,{active:[rn].includes(l),tooltip:"2D View",onClick:()=>{o(),setTimeout(()=>{r(rn)},0)},children:R.jsx(eC,{style:{color:c?"#FF9800":""}})}):R.jsx(Or,{active:[Oi].includes(l),tooltip:"3D View",onClick:s,children:R.jsx(tC,{})}):null,R.jsx(V7,{mode:l})]}),R.jsx(Z7,{catalog:n,popupEvent:h,onClose:()=>f(null)})]})}const ql=window.hasOwnProperty("localStorage")?window.localStorage:!1,rC=500;let nm=null;function iC(n,e){return(t,r,i)=>{let s;if(e=e||rC,!!n&&ql){if(r){t.setPlan(r);const o=r.floors[0].floorDesign;s=JSON.parse(o)}else if(ql.getItem(n)!==null){const o=ql.getItem(n);s=JSON.parse(o)}s&&t.loadProject(s),Ht.subscribe(o=>{nm&&clearTimeout(nm),nm=setTimeout(()=>{const a=ql.getItem(n),l=Ot.unselectAll(o.planner).updatedState,c=JSON.stringify(l.scene.toJS());if(a!==c&&(ql.setItem(n,c),o.plan))try{const h=o.plan.floors[o.activeFloor];i&&i({floor:{floorID:h.floorID,title:h.floorTitle,description:h.floorDescription,design:c}})}catch{}},e)})}}}function sC(){return n=>{window.addEventListener("keydown",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Tr.BACKSPACE:case Tr.DELETE:{[rn,Mo,Oi].includes(r)&&n.remove();break}case Tr.ESC:{n.rollback();break}case Tr.Z:{(e.getModifierState("Control")||e.getModifierState("Meta"))&&(e.getModifierState("Shift")?n.redo():n.undo());break}case Tr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge({SNAP_POINT:!1,SNAP_LINE:!1,SNAP_SEGMENT:!1,SNAP_GRID:!1,SNAP_GUIDE:!1,tempSnapConfiguartion:t.snapMask.toJS()}));break}case Tr.C:{let i=t.getIn(["scene","selectedLayer"]),s=t.getIn(["scene","layers",i,"selected"]);if((r===rn||r===Oi)&&(s.holes.size||s.areas.size||s.items.size||s.lines.size)){if(s.holes.size){let o=t.getIn(["scene","layers",i,"holes",s.holes.get(0)]);n.copyProperties(o.get("properties"))}else if(s.areas.size){const o=t.getIn(["scene","layers",i,"areas",s.areas.get(0)]);n.copyProperties(o.properties)}else if(s.items.size){const o=t.getIn(["scene","layers",i,"items",s.items.get(0)]);n.copyProperties(o.properties)}else if(s.lines.size){const o=t.getIn(["scene","layers",i,"lines",s.lines.get(0)]);n.copyProperties(o.properties)}}break}case Tr.V:{n.pasteProperties();break}case Tr.CTRL:{n.setAlterateState();break}}}),window.addEventListener("keyup",e=>{const t=n.planner,r=t.get("mode");switch(e.keyCode){case Tr.ALT:{of.includes(r)&&n.toggleSnap(t.snapMask.merge(t.snapMask.get("tempSnapConfiguartion")));break}case Tr.CTRL:{n.setAlterateState();break}}})}}const Dx=38,Nx=-220,Dl=({title:n,toggleState:e,toggleOn:t,toggleOff:r})=>{const[i,s]=se.useState(e||!1),o=()=>{s(!i),i?r():t()};return R.jsxs("div",{className:"flex items-center",children:[R.jsx("div",{className:"fp__onoffswitch",onClick:o,children:R.jsxs("div",{className:Ti("fp__onoffswitch_label",i?"fp__onoffswitch_label-checked":""),children:[R.jsx("span",{className:"fp__onoffswitch_inner"}),R.jsx("span",{className:"fp__onoffswitch_switch"})]})}),R.jsx("div",{className:"fp__onoffswitch_caption",children:n})]})},oC=({popupEvent:n,onClose:e})=>{const{planner:t,toggleSnap:r}=Ht(),{snapMask:i}=t,s=se.useRef(null);se.useEffect(()=>{if(n){const{x:l,y:c}=n.rect;s.current={top:c+Dx,left:l+Nx}}},[n]);const o=()=>{e()},a=l=>r(i.merge(l));return R.jsxs(R.Fragment,{children:[n&&R.jsx("div",{className:"fixed inset-0 bg-black/30 z-10",onClick:o}),R.jsxs("div",{style:n&&n.rect?{top:n.rect.y+Dx,left:n.rect.x+Nx}:s.current?s.current:{},id:"headerbar-popup",className:Ti("fixed select-none z-10 shadow-md !gap-0 rounded-lg pt-4 fp_side-bar !min-h-[200px] !min-w-[250px] max-w-[250px] !max-h-[300px] transition-all duration-200 ease-out transform",n?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[R.jsx("header",{className:"px-[18px] sticky top-0 left-0 gap-3 flex flex-col",children:R.jsx("div",{className:"flex items-center gap-1",children:R.jsx("span",{className:Ti("flex flex-col gap-0.5"),children:R.jsx("span",{className:"fp-sidebar-label capitalize",children:"Settings"})})})}),R.jsxs("div",{className:"min-h-28 w-full space-y-2.5 px-2 py-4",children:[R.jsx(Dl,{title:"Snap to Point",toggleState:i.get(uf),toggleOn:()=>{a({SNAP_POINT:!0})},toggleOff:()=>{a({SNAP_POINT:!1})}}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_LINE:!0})},toggleOff:()=>{a({SNAP_LINE:!1})},toggleState:i.get(hf),title:"Snap to Line"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_SEGMENT:!0})},toggleOff:()=>{a({SNAP_SEGMENT:!1})},toggleState:i.get(ff),title:"Snap to Segment"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GRID:!0})},toggleOff:()=>{a({SNAP_GRID:!1})},toggleState:i.get(df),title:"Snap to Grid"}),R.jsx(Dl,{toggleOn:()=>{a({SNAP_GUIDE:!0})},toggleOff:()=>{a({SNAP_GUIDE:!1})},toggleState:i.get(J0),title:"Snap to Guide"})]})]})]})},aC=({onBack:n,onSave:e})=>{const{undo:t,redo:r,plan:i,setPlan:s}=Ht(),[o,a]=se.useState(!1),[l,c]=se.useState(null),h=()=>{a(!0)},f=p=>{if(!i)return;a(!1);const d=p.target.value.trim();if(d&&d!==(i==null?void 0:i.planTitle)){s({...i,planTitle:d});try{e&&e({title:d,description:""})}catch{}}};return R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"floor_planner-headerbar border-b border-b-[#5e5e5e] absolute flex items-center justify-between z-[9001] py-[3px] px-[1em] text-xs bg-[#2b2b2b] w-full select-none cursor-default top-0 leading-[14px] text-white m-0",children:[R.jsx(Or,{className:"border border-white rounded -ml-1",active:!1,tooltip:"Go Back",onClick:()=>{n&&n()},children:R.jsx(Yv,{})}),R.jsx("div",{className:"flex flex-col items-center justify-center",children:o?R.jsx("input",{autoFocus:!0,type:"text",defaultValue:i==null?void 0:i.planTitle,onBlur:f,onKeyDown:p=>{(p.key==="Enter"||p.key==="Escape")&&f(p)},className:"bg-transparent border-b border-gray-400 outline-none text-lg text-center"}):R.jsx("span",{onDoubleClick:h,className:"projectName__fp text-lg",title:(i==null?void 0:i.planTitle)??"Example House",children:(i==null?void 0:i.planTitle)??"Example House"})}),R.jsxs("div",{className:"flex items-center gap-2 relative",children:[R.jsx(Or,{active:!1,tooltip:"Undo (CTRL-Z)",onClick:t,children:R.jsx(k8,{})}),R.jsx(Or,{active:!1,tooltip:"Redo (CTRL-SHIFT-Z)",onClick:r,children:R.jsx(z8,{})}),R.jsx("div",{className:"ml-8",children:R.jsx(Or,{active:!1,tooltip:"Settings",onClick:p=>{c({rect:p.currentTarget.getBoundingClientRect()})},children:R.jsx(T8,{size:17})})})]})]}),R.jsx(oC,{popupEvent:l,onClose:()=>c(null)})]})};var rm={exports:{}},Ux;function Fx(){if(Ux)return rm.exports;Ux=1;var n=rm.exports={};return n.forEach=function(e,t){for(var r=0;r<e.length;r++){var i=t(e[r]);if(i)return i}},rm.exports}var im,zx;function lC(){return zx||(zx=1,im=function(n){var e=n.stateHandler.getState;function t(o){var a=e(o);return a&&!!a.isDetectable}function r(o){e(o).isDetectable=!0}function i(o){return!!e(o).busy}function s(o,a){e(o).busy=!!a}return{isDetectable:t,markAsDetectable:r,isBusy:i,markBusy:s}}),im}var sm,kx;function cC(){return kx||(kx=1,sm=function(n){var e={};function t(o){var a=n.get(o);return a===void 0?[]:e[a]||[]}function r(o,a){var l=n.get(o);e[l]||(e[l]=[]),e[l].push(a)}function i(o,a){for(var l=t(o),c=0,h=l.length;c<h;++c)if(l[c]===a){l.splice(c,1);break}}function s(o){var a=t(o);a&&(a.length=0)}return{get:t,add:r,removeListener:i,removeAllListeners:s}}),sm}var om,Bx;function uC(){return Bx||(Bx=1,om=function(){var n=1;function e(){return n++}return{generate:e}}),om}var am,Vx;function hC(){return Vx||(Vx=1,am=function(n){var e=n.idGenerator,t=n.stateHandler.getState;function r(s){var o=t(s);return o&&o.id!==void 0?o.id:null}function i(s){var o=t(s);if(!o)throw new Error("setId required the element to have a resize detection state.");var a=e.generate();return o.id=a,a}return{get:r,set:i}}),am}var lm,Hx;function fC(){return Hx||(Hx=1,lm=function(n){function e(){}var t={log:e,warn:e,error:e};if(!n&&window.console){var r=function(i,s){i[s]=function(){var a=console[s];if(a.apply)a.apply(console,arguments);else for(var l=0;l<arguments.length;l++)a(arguments[l])}};r(t,"log"),r(t,"warn"),r(t,"error")}return t}),lm}var cm={exports:{}},Gx;function Wx(){if(Gx)return cm.exports;Gx=1;var n=cm.exports={};return n.isIE=function(e){function t(){var i=navigator.userAgent.toLowerCase();return i.indexOf("msie")!==-1||i.indexOf("trident")!==-1||i.indexOf(" edge/")!==-1}if(!t())return!1;if(!e)return!0;var r=(function(){var i,s=3,o=document.createElement("div"),a=o.getElementsByTagName("i");do o.innerHTML="<!--[if gt IE "+ ++s+"]><i></i><![endif]-->";while(a[0]);return s>4?s:i})();return e===r},n.isLegacyOpera=function(){return!!window.opera},cm.exports}var um={exports:{}},jx;function dC(){if(jx)return um.exports;jx=1;var n=um.exports={};n.getOption=e;function e(t,r,i){var s=t[r];return s==null&&i!==void 0?i:s}return um.exports}var hm,Xx;function pC(){if(Xx)return hm;Xx=1;var n=dC();hm=function(r){r=r||{};var i=r.reporter,s=n.getOption(r,"async",!0),o=n.getOption(r,"auto",!0);o&&!s&&(i&&i.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),s=!0);var a=e(),l,c=!1;function h(v,_){!c&&o&&s&&a.size()===0&&d(),a.add(v,_)}function f(){for(c=!0;a.size();){var v=a;a=e(),v.process()}c=!1}function p(v){c||(v===void 0&&(v=s),l&&(m(l),l=null),v?d():f())}function d(){l=x(f)}function m(v){var _=clearTimeout;return _(v)}function x(v){var _=function(b){return setTimeout(b,0)};return _(v)}return{add:h,force:p}};function e(){var t={},r=0,i=0,s=0;function o(c,h){h||(h=c,c=0),c>i?i=c:c<s&&(s=c),t[c]||(t[c]=[]),t[c].push(h),r++}function a(){for(var c=s;c<=i;c++)for(var h=t[c],f=0;f<h.length;f++){var p=h[f];p()}}function l(){return r}return{add:o,process:a,size:l}}return hm}var fm,$x;function mC(){if($x)return fm;$x=1;var n="_erd";function e(i){return i[n]={},t(i)}function t(i){return i[n]}function r(i){delete i[n]}return fm={initState:e,getState:t,cleanState:r},fm}var dm,Yx;function gC(){if(Yx)return dm;Yx=1;var n=Wx();return dm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;if(!t)throw new Error("Missing required dependency: reporter.");function s(h,f){function p(){f(h)}if(n.isIE(8))i(h).object={proxy:p},h.attachEvent("onresize",p);else{var d=l(h);if(!d)throw new Error("Element is not detectable by this strategy.");d.contentDocument.defaultView.addEventListener("resize",p)}}function o(h){var f=e.important?" !important; ":"; ";return(h.join(f)+f).trim()}function a(h,f,p){p||(p=f,f=h,h=null),h=h||{},h.debug;function d(m,x){var v=o(["display: block","position: absolute","top: 0","left: 0","width: 100%","height: 100%","border: none","padding: 0","margin: 0","opacity: 0","z-index: -1000","pointer-events: none"]),_=!1,b=window.getComputedStyle(m),M=m.offsetWidth,E=m.offsetHeight;i(m).startSize={width:M,height:E};function S(){function T(){if(b.position==="static"){m.style.setProperty("position","relative",h.important?"important":"");var A=function(L,N,Z,K){function ne(J){return J.replace(/[^-\d\.]/g,"")}var ce=Z[K];ce!=="auto"&&ne(ce)!=="0"&&(L.warn("An element that is positioned static has style."+K+"="+ce+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+K+" will be set to 0. Element: ",N),N.style.setProperty(K,"0",h.important?"important":""))};A(t,m,b,"top"),A(t,m,b,"right"),A(t,m,b,"bottom"),A(t,m,b,"left")}}function q(){_||T();function A(N,Z){if(!N.contentDocument){var K=i(N);K.checkForObjectDocumentTimeoutId&&window.clearTimeout(K.checkForObjectDocumentTimeoutId),K.checkForObjectDocumentTimeoutId=setTimeout(function(){K.checkForObjectDocumentTimeoutId=0,A(N,Z)},100);return}Z(N.contentDocument)}var L=this;A(L,function(Z){x(m)})}b.position!==""&&(T(),_=!0);var O=document.createElement("object");O.style.cssText=v,O.tabIndex=-1,O.type="text/html",O.setAttribute("aria-hidden","true"),O.onload=q,n.isIE()||(O.data="about:blank"),i(m)&&(m.appendChild(O),i(m).object=O,n.isIE()&&(O.data="about:blank"))}r?r.add(S):S()}n.isIE(8)?p(f):d(f,p)}function l(h){return i(h).object}function c(h){if(i(h)){var f=l(h);f&&(n.isIE(8)?h.detachEvent("onresize",f.proxy):h.removeChild(f),i(h).checkForObjectDocumentTimeoutId&&window.clearTimeout(i(h).checkForObjectDocumentTimeoutId),delete i(h).object)}}return{makeDetectable:a,addListener:s,uninstall:c}},dm}var pm,Kx;function _C(){if(Kx)return pm;Kx=1;var n=Fx().forEach;return pm=function(e){e=e||{};var t=e.reporter,r=e.batchProcessor,i=e.stateHandler.getState;e.stateHandler.hasState;var s=e.idHandler;if(!r)throw new Error("Missing required dependency: batchProcessor");if(!t)throw new Error("Missing required dependency: reporter.");var o=f(),a="erd_scroll_detection_scrollbar_style",l="erd_scroll_detection_container";function c(S){p(S,a,l)}c(window.document);function h(S){var T=e.important?" !important; ":"; ";return(S.join(T)+T).trim()}function f(){var S=500,T=500,q=document.createElement("div");q.style.cssText=h(["position: absolute","width: "+S*2+"px","height: "+T*2+"px","visibility: hidden","margin: 0","padding: 0"]);var O=document.createElement("div");O.style.cssText=h(["position: absolute","width: "+S+"px","height: "+T+"px","overflow: scroll","visibility: none","top: "+-S*3+"px","left: "+-T*3+"px","visibility: hidden","margin: 0","padding: 0"]),O.appendChild(q),document.body.insertBefore(O,document.body.firstChild);var A=S-O.clientWidth,L=T-O.clientHeight;return document.body.removeChild(O),{width:A,height:L}}function p(S,T,q){function O(Z,K){K=K||function(ce){S.head.appendChild(ce)};var ne=S.createElement("style");return ne.innerHTML=Z,ne.id=T,K(ne),ne}if(!S.getElementById(T)){var A=q+"_animation",L=q+"_animation_active",N=`/* Created by the element-resize-detector library. */
|
|
3923
3923
|
`;N+="."+q+" > div::-webkit-scrollbar { "+h(["display: none"])+` }
|
|
3924
3924
|
|
|
3925
3925
|
`,N+="."+L+" { "+h(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+A,"animation-name: "+A])+` }
|