toposync-ext-structural 0.4.2__tar.gz → 0.4.3__tar.gz
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.
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/PKG-INFO +1 -1
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/pyproject.toml +1 -1
- toposync_ext_structural-0.4.3/src/toposync_ext_structural/static/449.js +2 -0
- toposync_ext_structural-0.4.3/src/toposync_ext_structural/static/remoteEntry.js +1 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/package.json +2 -1
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/activate.tsx +2 -2
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/elements/WallElementType.tsx +185 -61
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/textures.ts +3 -3
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/tools/structuralTools.ts +15 -4
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/translations.ts +2 -0
- toposync_ext_structural-0.4.3/ui/src/wallGeometry.test.ts +226 -0
- toposync_ext_structural-0.4.3/ui/src/wallGeometry.ts +368 -0
- toposync_ext_structural-0.4.3/ui/tsconfig.wall-geometry-test.json +16 -0
- toposync_ext_structural-0.4.2/src/toposync_ext_structural/static/12.js +0 -2
- toposync_ext_structural-0.4.2/src/toposync_ext_structural/static/remoteEntry.js +0 -1
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/.gitignore +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/LICENSE +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/README.md +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/src/toposync_ext_structural/__init__.py +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/src/toposync_ext_structural/extension.json +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/src/toposync_ext_structural/plugin.py +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/src/toposync_ext_structural/static/326.js +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/src/toposync_ext_structural/static/326.js.LICENSE.txt +0 -0
- /toposync_ext_structural-0.4.2/src/toposync_ext_structural/static/12.js.LICENSE.txt → /toposync_ext_structural-0.4.3/src/toposync_ext_structural/static/449.js.LICENSE.txt +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/src/toposync_ext_structural/static/main.js +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/colors.ts +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/constants.ts +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/elements/AreaElementType.tsx +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/elements/PoolElementType.tsx +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/entry.ts +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/geometry.ts +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/parsing.ts +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/src/wallOpenings.ts +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/tsconfig.json +0 -0
- {toposync_ext_structural-0.4.2 → toposync_ext_structural-0.4.3}/ui/webpack.config.js +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 449.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.webpackChunk_toposync_extension_structural_ui=self.webpackChunk_toposync_extension_structural_ui||[]).push([[449],{94(t,e,n){var o=n(496),r=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(t,e,n){var o,l={},c=null,u=null;for(o in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(u=e.ref),e)a.call(e,o)&&!s.hasOwnProperty(o)&&(l[o]=e[o]);if(t&&t.defaultProps)for(o in e=t.defaultProps)void 0===l[o]&&(l[o]=e[o]);return{$$typeof:r,type:t,key:c,ref:u,props:l,_owner:i.current}}e.jsx=l,e.jsxs=l},449(t,e,n){n.r(e),n.d(e,{activate:()=>le});var o=n(870),r=n(496);function a(t){const e=t.trim().replace(/^#/,"");return/^[0-9a-fA-F]{6}$/.test(e)?{r:Number.parseInt(e.slice(0,2),16),g:Number.parseInt(e.slice(2,4),16),b:Number.parseInt(e.slice(4,6),16)}:null}function i(t,e){const n=a(t),o=Math.max(0,Math.min(1,e));return n?`rgba(${n.r},${n.g},${n.b},${o})`:`rgba(99,102,241,${o})`}function s(t,e,n){const o=a(t),r=a(e);if(!o||!r)return t;const i=Math.max(0,Math.min(1,n));return function(t){const e=t=>Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}({r:o.r+(r.r-o.r)*i,g:o.g+(r.g-o.g)*i,b:o.b+(r.b-o.b)*i})}function l(t,e){return e>=0?s(t,"#ffffff",e):s(t,"#000000",Math.abs(e))}const c="com.toposync.structural.wall",u="com.toposync.structural.area",d="com.toposync.structural.pool",p="#dcddda",m=.12,h="#dcddda",x="toposync.structural.area.fill.v1";function f(t,e){return"number"==typeof t&&Number.isFinite(t)?t:e}function g(t,e){return"string"==typeof t?t:e}function w(t){return/^#[0-9a-fA-F]{6}$/.test(t)}function y(t){try{if(!w(t))return;localStorage.setItem(x,t)}catch{}}function M(t,e){if(!t||"object"!=typeof t||Array.isArray(t))return e;const n=t;return{x:f(n.x,e.x),z:f(n.z,e.z)}}function _(t){return Array.isArray(t)?t.map(t=>M(t,{x:0,z:0})).filter(t=>Number.isFinite(t.x)&&Number.isFinite(t.z)):[]}function b(t){const e=document.createElement("canvas");return e.width=t,e.height=t,e}function v(t,e){return t+Math.floor(Math.random()*(e-t+1))}function k(t,e,n,o){t.save(),t.globalAlpha=o;for(let o=0;o<n;o++){const n=Math.random()*e,o=Math.random()*e,r=1+2*Math.random(),a=1+2*Math.random(),i=v(0,255);t.fillStyle=`rgb(${i},${i},${i})`,t.fillRect(n,o,r,a)}t.restore()}function z(t){const e=b(t),n=e.getContext("2d");if(!n)return e;n.fillStyle="#6b7280",n.fillRect(0,0,t,t);const o=t/10,r=2.2*o,a=Math.max(1,Math.round(.01*t));for(let e=0;e<10;e++){const i=e*o;for(let s=-(e%2==0?0:r/2);s<t+r;s+=r){const t=Math.floor(s+a),e=Math.floor(i+a),l=Math.ceil(r-2*a),c=Math.ceil(o-2*a),u=v(86,140);n.fillStyle=`rgb(${u},${u},${u})`,n.fillRect(t,e,l,c)}}n.strokeStyle="#111827",n.lineWidth=a,n.globalAlpha=.85;for(let e=0;e<=10;e++){const r=e*o;n.beginPath(),n.moveTo(0,r+.5),n.lineTo(t,r+.5),n.stroke()}for(let e=0;e<10;e++){const a=e*o;for(let i=-(e%2==0?0:r/2);i<t+r;i+=r){const t=i;n.beginPath(),n.moveTo(t+.5,a),n.lineTo(t+.5,a+o),n.stroke()}}return k(n,t,Math.floor(t*t/10),.06),e}function S(t){const e=b(t),n=e.getContext("2d");if(!n)return e;n.fillStyle="#7c5d3a",n.fillRect(0,0,t,t),n.save(),n.globalAlpha=.35;for(let e=0;e<t;e+=1){const o=e/t,r=Math.sin(o*Math.PI*8+1.2*Math.sin(o*Math.PI*2)),a=Math.round(88+20*r+12*Math.random());n.fillStyle=`rgb(${a},${Math.round(.72*a)},${Math.round(.45*a)})`,n.fillRect(0,e,t,1)}n.restore(),n.save(),n.globalAlpha=.18,n.strokeStyle="#3f2f1f",n.lineWidth=1;for(let e=0;e<48;e++){const e=Math.random()*t,o=Math.random()*t,r=2+6*Math.random(),a=1+3*Math.random();n.beginPath(),n.ellipse(e,o,r,a,Math.random()*Math.PI,0,2*Math.PI),n.stroke()}return n.restore(),k(n,t,Math.floor(t*t/4),.06),e}function N(t){const e=b(t),n=e.getContext("2d");return n?(n.fillStyle="#9ca3af",n.fillRect(0,0,t,t),k(n,t,Math.floor(t*t/2),.08),k(n,t,Math.floor(t*t/3),.06),e):e}function j(t){const e=b(t),n=e.getContext("2d");if(!n)return e;n.fillStyle="#166534",n.fillRect(0,0,t,t),k(n,t,Math.floor(t*t/2),.1),n.save(),n.globalAlpha=.2,n.strokeStyle="#052e16",n.lineWidth=1;for(let e=0;e<360;e++){const e=Math.random()*t,o=Math.random()*t,r=4+10*Math.random(),a=-Math.PI/2+.8*(Math.random()-.5);n.beginPath(),n.moveTo(e,o),n.lineTo(e+Math.cos(a)*r,o+Math.sin(a)*r),n.stroke()}n.globalAlpha=.14,n.strokeStyle="#4ade80";for(let e=0;e<180;e++){const e=Math.random()*t,o=Math.random()*t,r=3+8*Math.random(),a=-Math.PI/2+.9*(Math.random()-.5);n.beginPath(),n.moveTo(e,o),n.lineTo(e+Math.cos(a)*r,o+Math.sin(a)*r),n.stroke()}return n.restore(),e}function W(t){const e=b(t),n=e.getContext("2d");if(!n)return e;n.fillStyle="#14532d",n.fillRect(0,0,t,t),k(n,t,Math.floor(t*t/2),.08),k(n,t,Math.floor(t*t/3),.06),n.save(),n.globalAlpha=.18,n.strokeStyle="#052e16",n.lineWidth=1;for(let e=0;e<900;e++){const e=Math.random()*t,o=Math.random()*t,r=4+12*Math.random(),a=-Math.PI/2+.9*(Math.random()-.5);n.beginPath(),n.moveTo(e,o),n.lineTo(e+Math.cos(a)*r,o+Math.sin(a)*r),n.stroke()}n.globalAlpha=.12,n.strokeStyle="#86efac";for(let e=0;e<520;e++){const e=Math.random()*t,o=Math.random()*t,r=3+10*Math.random(),a=-Math.PI/2+1*(Math.random()-.5);n.beginPath(),n.moveTo(e,o),n.lineTo(e+Math.cos(a)*r,o+Math.sin(a)*r),n.stroke()}return n.restore(),e}const T=new Map;function P(t,e,n,o){const r=T.get(e);if(r)return r;const a=n(o?.size??256),i=new t.CanvasTexture(a);return i.wrapS=t.RepeatWrapping,i.wrapT=t.RepeatWrapping,i.colorSpace=t.SRGBColorSpace,i.anisotropy=o?.anisotropy??4,T.set(e,i),i}function D(t,e){return"none"===t||"brick"===t||"concrete"===t?t:e}function C(t,e){return"none"===t||"grass"===t||"concrete"===t?t:e}function A(t,e){return"none"===t||"wood"===t||"concrete"===t||"glass"===t||"transparent"===t?t:e}function F(t,e){return"none"===e||"glass"===e||"transparent"===e?null:"wood"===e?P(t,"opening:wood",S,{size:256,anisotropy:4}):"concrete"===e?P(t,"opening:concrete",N,{size:256,anisotropy:4}):null}let E=null;function I(t){const e=Math.random(),n=Math.random(),o=Math.sqrt(e),r=1-o,a=n*o,i=1-r-a;return{x:t.ax*r+t.bx*a+t.cx*i,z:t.az*r+t.bz*a+t.cz*i}}function R(t){return{type:u,layerGroup:"areas",name:{key:"ext.structural.area.name",fallback:"Area"},description:{key:"ext.structural.area.desc",fallback:"Area (polygon) in 2D."},defaultProps:{fill:h,opacity:1,texture:"none",vertices:[{x:-1,z:-1},{x:1,z:-1},{x:1,z:1},{x:-1,z:1}]},getMain2DBounds:t=>function(t){if(0===t.length)return null;let e=t[0].x,n=t[0].x,o=t[0].z,r=t[0].z;for(let a=1;a<t.length;a+=1){const i=t[a];e=Math.min(e,i.x),n=Math.max(n,i.x),o=Math.min(o,i.z),r=Math.max(r,i.z)}return{minX:e,maxX:n,minZ:o,maxZ:r}}(_(t.props.vertices)),renderMain2DVector:({element:t})=>{const e=_(t.props.vertices);if(e.length<3)return null;const n=g(t.props.fill,h),r=f(t.props.opacity,1),a=r<.001?0:r;if(a<=0)return null;const s=C(t.props.texture,"none"),c=function(t){return t.map(t=>`${t.x},${t.z}`).join(" ")}(e),u=i(l(n,"grass"===s?-.24:-.16),Math.min(.34,.34*a)),d=i(l(n,.42),Math.min(.2,.2*a)),p="grass"===s?"mainVector2dGrassPattern":"concrete"===s?"mainVector2dConcretePattern":"";return(0,o.jsxs)("g",{className:"mainVector2dArea",children:[(0,o.jsx)("polygon",{points:c,fill:i(n,Math.min(.92,Math.max(0,a))),stroke:u,strokeWidth:.026,vectorEffect:"non-scaling-stroke",filter:"url(#mainVector2dSoftShadow)"}),p?(0,o.jsx)("polygon",{points:c,fill:`url(#${p})`,opacity:Math.min(.42,.38*a)}):null,(0,o.jsx)("polygon",{points:c,fill:"none",stroke:d,strokeWidth:.01,vectorEffect:"non-scaling-stroke"})]})},create3D:({THREE:t,view:e},n)=>{const o=new t.Group,r=new t.MeshStandardMaterial({color:h,roughness:.95,metalness:0,side:t.DoubleSide,transparent:!1,opacity:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1});r.stencilWrite=!0,r.stencilRef=1,r.stencilFunc=t.NotEqualStencilFunc,r.stencilFail=t.KeepStencilOp,r.stencilZFail=t.KeepStencilOp,r.stencilZPass=t.KeepStencilOp,r.stencilWriteMask=0,r.stencilFuncMask=255;let a=null,i="",s=null,l=null,c="";function u(e,n,r){if(s&&(o.remove(s),s.geometry.dispose(),s=null),!(n>0))return;const a=new t.PlaneGeometry(1,1,1,4);a.translate(0,.5,0);const i=a,c=new t.InstancedBufferAttribute(new Float32Array(n),1);i.setAttribute("instanceSeed",c);const u=function(){if(l)return l;const e=function(t){if(E)return E;const e=64,n=document.createElement("canvas");n.width=e,n.height=e;const o=n.getContext("2d");if(o){o.clearRect(0,0,e,e),o.fillStyle="black",o.fillRect(0,0,e,e);const t=o.createLinearGradient(0,e,0,0);t.addColorStop(0,"rgba(255,255,255,0)"),t.addColorStop(.18,"rgba(255,255,255,1)"),t.addColorStop(1,"rgba(255,255,255,1)"),o.fillStyle=t,o.beginPath(),o.moveTo(32,1.28),o.quadraticCurveTo(37.12,28.8,39.68,62.72),o.quadraticCurveTo(32,57.6,24.32,62.72),o.quadraticCurveTo(26.88,28.8,32,1.28),o.closePath(),o.fill(),o.globalCompositeOperation="destination-in";const n=o.createRadialGradient(32,51.2,0,32,51.2,35.2);n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(1,"rgba(255,255,255,0)"),o.fillStyle=n,o.fillRect(0,0,e,e)}const r=new t.CanvasTexture(n);return r.wrapS=t.ClampToEdgeWrapping,r.wrapT=t.ClampToEdgeWrapping,r.magFilter=t.LinearFilter,r.minFilter=t.LinearMipmapLinearFilter,r.colorSpace=t.NoColorSpace??t.LinearSRGBColorSpace,E=r,r}(t),n=new t.MeshStandardMaterial({color:1483594,roughness:.88,metalness:0,side:t.DoubleSide,alphaMap:e,alphaTest:.35});return n.stencilWrite=!0,n.stencilRef=1,n.stencilFunc=t.NotEqualStencilFunc,n.stencilFail=t.KeepStencilOp,n.stencilZFail=t.KeepStencilOp,n.stencilZPass=t.KeepStencilOp,n.stencilWriteMask=0,n.stencilFuncMask=255,n.onBeforeCompile=t=>{t.uniforms.uTime={value:0},t.vertexShader=t.vertexShader.replace("#include <common>","#include <common>\nuniform float uTime;\nattribute float instanceSeed;").replace("#include <begin_vertex>","#include <begin_vertex>\nfloat h01 = clamp(position.y, 0.0, 1.0);\nfloat wind = sin(uTime * 1.2 + instanceSeed + position.x * 2.4) * 0.12;\nfloat wind2 = cos(uTime * 0.9 + instanceSeed * 1.7) * 0.08;\ntransformed.x += (wind + wind2) * h01 * h01;\ntransformed.z += sin(uTime * 1.1 + instanceSeed * 0.7) * 0.06 * h01 * h01;"),n.userData.shader=t},l=n,n}();u.color.set(r);const d=new t.InstancedMesh(i,u,n);d.frustumCulled=!1,d.renderOrder=5;const p=function(t){const e=t.getAttribute("position"),n=t.getIndex(),o=[],r=[];let a=0;function i(t,n,i){const s=e.getX(t),l=e.getZ(t),c=e.getX(n),u=e.getZ(n),d=e.getX(i),p=e.getZ(i),m=.5*Math.abs((c-s)*(p-l)-(d-s)*(u-l));m>1e-9&&(a+=m,o.push({ax:s,az:l,bx:c,bz:u,cx:d,cz:p,area:m}),r.push(a))}if(n)for(let t=0;t<n.count;t+=3)i(n.getX(t),n.getX(t+1),n.getX(t+2));else for(let t=0;t<e.count;t+=3)i(t,t+1,t+2);return{triangles:o,cdf:r,totalArea:a}}(e);if(!(p.totalArea>1e-9)||0===p.triangles.length)return void i.dispose();const m=new t.Matrix4,h=new t.Quaternion,x=new t.Vector3,f=new t.Vector3,g=new t.Vector3(0,1,0);for(let t=0;t<n;t+=1){const e=Math.random()*p.totalArea;let n=0,o=p.cdf.length-1;for(;n<o;){const t=n+o>>1;e<=p.cdf[t]?o=t:n=t+1}const r=I(p.triangles[n]),a=Math.random()*Math.PI*2;h.setFromAxisAngle(g,a);const i=.1+.2*Math.random(),s=i*(.12+.1*Math.random());f.set(s,i,1),x.set(r.x,.012,r.z),m.compose(x,h,f),d.setMatrixAt(t,m),c.setX(t,1e3*Math.random())}d.instanceMatrix.needsUpdate=!0,c.needsUpdate=!0,s=d,o.add(d)}function d(n){const d=_(n.props.vertices),p=JSON.stringify(d.map(t=>({x:Math.round(1e3*(t.x-n.position.x))/1e3,z:Math.round(1e3*(t.z-n.position.z))/1e3})));if(p!==i){i=p;const e=function(e){const n=_(e.props.vertices);if(n.length<3)return null;const o=n.map(t=>({x:t.x-e.position.x,z:t.z-e.position.z})),r=new t.Shape;r.moveTo(o[0].x,-o[0].z);for(let t=1;t<o.length;t++)r.lineTo(o[t].x,-o[t].z);r.closePath();const a=new t.ShapeGeometry(r);a.rotateX(-Math.PI/2);const i=a.getAttribute("position"),s=new t.BufferAttribute(new Float32Array(2*i.count),2);for(let t=0;t<i.count;t++){const n=i.getX(t)+e.position.x,o=i.getZ(t)+e.position.z;s.setXY(t,n,o)}return a.setAttribute("uv",s),a}(n);e?a?(a.geometry.dispose(),a.geometry=e):(a=new t.Mesh(e,r),a.receiveShadow=!0,o.add(a)):a&&(o.remove(a),a.geometry.dispose(),a=null)}const m=g(n.props.fill,h),x=Math.max(0,Math.min(1,f(n.props.opacity,1)))<.001,w=x?0:1,y=C(n.props.texture,"none"),M=e.graphicsQuality??"simplified",b=function(t,e,n="simplified"){return"none"===e?null:"grass"===e?"detailed"===n?P(t,"floor:grass:detailed",W,{size:512,anisotropy:8}):P(t,"floor:grass:simplified",j,{size:256,anisotropy:4}):"concrete"===e?P(t,"floor:concrete",N,{size:256,anisotropy:4}):null}(t,y,M);if(r.color.set(m),r.map!==b&&(r.map=b,r.needsUpdate=!0),r.roughness="grass"===y?.98:.95,r.metalness=0,r.opacity=w,r.transparent=x,r.depthWrite=!x,a&&(a.visible=!x,a.position.y=.01),x||"grass"!==y||"detailed"!==M||!Boolean(a&&a.geometry))return void(s&&(s.visible=!1));s&&(s.visible=!0);const v=function(t){if(t.length<3)return 0;let e=0;for(let n=0;n<t.length;n+=1){const o=t[n],r=t[(n+1)%t.length];e+=o.x*r.z-r.x*o.z}return Math.abs(e)/2}(d),k=Math.max(240,Math.min(1800,Math.floor(35*v))),z=`${p}:${k}`;z!==c&&a?(c=z,u(a.geometry,k,m)):l&&l.color.set(m)}return d(n),{object:o,update:d,tick:()=>{if(!l||!s?.visible)return!1;const t=l.userData.shader;return!!t&&(t.uniforms.uTime.value=performance.now()/1e3,!0)},dispose:()=>{a&&a.geometry.dispose(),r.dispose(),s&&s.geometry.dispose(),l?.dispose()}}},render2D:({ctx:t,element:e,viewport:n})=>{const o=_(e.props.vertices);if(o.length<3)return;const r=g(e.props.fill,h),a=f(e.props.opacity,1)<.001?0:1,s=o.map(t=>n.worldToScreen(t));t.save(),t.beginPath(),t.moveTo(s[0].x,s[0].y);for(let e=1;e<s.length;e++)t.lineTo(s[e].x,s[e].y);t.closePath(),t.fillStyle=i(r,a),t.fill(),t.strokeStyle=i("#e6e8f2",.22),t.lineWidth=2,t.stroke(),t.restore()},renderEditorModal:({element:e,update:n,remove:r,close:a})=>(0,o.jsx)(B,{element:e,update:n,remove:r,close:a,i18n:t})}}function B({element:t,update:e,remove:n,close:r,i18n:a}){const{t:i}=a.useI18n(),s=g(t.props.fill,h),l=f(t.props.opacity,1)<.001,c=C(t.props.texture,"none");return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"field",children:[(0,o.jsx)("div",{className:"label",children:i("ext.structural.editor.area_name")}),(0,o.jsx)("input",{className:"input",value:t.name,onChange:t=>e({name:t.target.value})})]}),(0,o.jsxs)("div",{className:"rowWrap",children:[(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:160},children:[(0,o.jsx)("div",{className:"label",children:i("ext.structural.editor.area_color")}),(0,o.jsx)("input",{className:"input",type:"color",value:s,onChange:t=>{const n=t.target.value;y(n),e({props:{fill:n}})}})]}),(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:160},children:[(0,o.jsx)("div",{className:"label",children:i("ext.structural.editor.floor_texture")}),(0,o.jsxs)("select",{className:"input",value:c,onChange:t=>{const n=C(t.target.value,c),o="grass"===n?"#16a34a":"concrete"===n?h:s;y(o),e({props:{texture:n,fill:o}})},children:[(0,o.jsx)("option",{value:"none",children:i("ext.structural.editor.texture.none")}),(0,o.jsx)("option",{value:"grass",children:i("ext.structural.editor.texture.grass")}),(0,o.jsx)("option",{value:"concrete",children:i("ext.structural.editor.texture.concrete")})]})]}),(0,o.jsxs)("label",{className:"chipButton",style:{display:"inline-flex",alignItems:"center",gap:10},children:[(0,o.jsx)("input",{type:"checkbox",checked:l,onChange:t=>e({props:{opacity:t.target.checked?0:1}})}),(0,o.jsx)("span",{children:i("ext.structural.editor.transparent")})]})]}),(0,o.jsx)("div",{className:"sectionDivider"}),(0,o.jsxs)("div",{className:"rowWrap",children:[(0,o.jsx)("button",{className:"dangerButton",type:"button",onClick:n,children:i("core.actions.delete")}),(0,o.jsx)("button",{className:"chipButton",type:"button",onClick:r,children:i("core.actions.close")})]})]})}let G=null,O=null;function $(t,e,n){return Math.max(e,Math.min(n,t))}function q(t){return{depth_m:$(f(t.depth_m,1.4),.1,20),vertices:_(t.vertices)}}function L(t){return{type:d,layerGroup:"areas",name:{key:"ext.structural.pool.name",fallback:"Pool"},description:{key:"ext.structural.pool.desc",fallback:"Swimming pool (hole) in 2D."},defaultProps:{depth_m:1.4,vertices:[{x:-1,z:-1},{x:1,z:-1},{x:1,z:1},{x:-1,z:1}]},getMain2DBounds:t=>function(t){if(0===t.length)return null;let e=t[0].x,n=t[0].x,o=t[0].z,r=t[0].z;for(let a=1;a<t.length;a+=1){const i=t[a];e=Math.min(e,i.x),n=Math.max(n,i.x),o=Math.min(o,i.z),r=Math.max(r,i.z)}return{minX:e,maxX:n,minZ:o,maxZ:r}}(q(t.props).vertices),renderMain2DVector:({element:t})=>{const e=q(t.props);if(e.vertices.length<3)return null;const n=function(t){return t.map(t=>`${t.x},${t.z}`).join(" ")}(e.vertices),r=$(e.depth_m/4.5,.16,.42);return(0,o.jsxs)("g",{className:"mainVector2dPool",children:[(0,o.jsx)("polygon",{points:n,fill:`rgba(8,47,73,${r})`,stroke:"rgba(125,211,252,0.60)",strokeWidth:.045,vectorEffect:"non-scaling-stroke",filter:"url(#mainVector2dSoftShadow)"}),(0,o.jsx)("polygon",{points:n,fill:"url(#mainVector2dWaterGradient)",opacity:"0.86"}),(0,o.jsx)("polygon",{points:n,fill:"url(#mainVector2dWaterPattern)",opacity:"0.46"}),(0,o.jsx)("polygon",{points:n,fill:"none",stroke:"rgba(224,242,254,0.58)",strokeWidth:.016,vectorEffect:"non-scaling-stroke"})]})},create3D:({THREE:t,view:e},n)=>{const o=new t.Group,r=new t.BufferGeometry,a=new t.MeshBasicMaterial({color:0});a.colorWrite=!1,a.depthWrite=!1,a.depthTest=!1,a.stencilWrite=!0,a.stencilRef=1,a.stencilFunc=t.AlwaysStencilFunc,a.stencilZPass=t.ReplaceStencilOp;const i=function(t){if(G)return G;const e=function(t){const e=document.createElement("canvas");e.width=t,e.height=t;const n=e.getContext("2d");if(!n)return e;n.fillStyle="rgb(128,128,128)",n.fillRect(0,0,t,t),n.save(),n.globalAlpha=.14,n.fillStyle="rgb(150,150,150)";for(let e=0;e<220;e++){const e=Math.random()*t,o=Math.random()*t,r=6+26*Math.random();n.beginPath(),n.arc(e,o,r,0,2*Math.PI),n.fill()}n.globalAlpha=.1,n.fillStyle="rgb(100,100,100)";for(let e=0;e<160;e++){const e=Math.random()*t,o=Math.random()*t,r=4+20*Math.random();n.beginPath(),n.arc(e,o,r,0,2*Math.PI),n.fill()}return n.restore(),e}(256),n=new t.CanvasTexture(e);return n.wrapS=t.RepeatWrapping,n.wrapT=t.RepeatWrapping,n.repeat.set(2,2),n.anisotropy=4,n.colorSpace=t.NoColorSpace??t.LinearSRGBColorSpace,G=n,n}(t),s=function(t){if(O)return O;const e=function(t){const e=document.createElement("canvas");e.width=t,e.height=t;const n=e.getContext("2d");if(!n)return e;const o=n.createImageData(t,t),r=o.data,a=2*Math.PI,i=[{dirX:.92,dirY:.39,freq:3,amp:.7,phase:Math.random()*a},{dirX:-.16,dirY:.99,freq:5,amp:.5,phase:Math.random()*a},{dirX:.68,dirY:-.73,freq:8,amp:.35,phase:Math.random()*a},{dirX:-.91,dirY:-.41,freq:12,amp:.22,phase:Math.random()*a}];for(let e=0;e<t;e+=1){const n=e/t;for(let o=0;o<t;o+=1){const s=o/t;let l=0,c=0;for(const t of i){const e=a*(t.dirX*s+t.dirY*n)*t.freq+t.phase,o=Math.cos(e),r=t.amp*t.freq*a;l+=o*r*t.dirX,c+=o*r*t.dirY}let u=.085*-l,d=1,p=.085*-c;const m=1/Math.sqrt(u*u+d*d+p*p);u*=m,d*=m,p*=m;const h=4*(e*t+o);r[h+0]=Math.round(255*(.5*u+.5)),r[h+1]=Math.round(255*(.5*d+.5)),r[h+2]=Math.round(255*(.5*p+.5)),r[h+3]=255}}return n.putImageData(o,0,0),e}(256),n=new t.CanvasTexture(e);return n.wrapS=t.RepeatWrapping,n.wrapT=t.RepeatWrapping,n.repeat.set(2,2),n.anisotropy=8,n.colorSpace=t.NoColorSpace??t.LinearSRGBColorSpace,O=n,n}(t),l=new t.MeshStandardMaterial({color:959977,roughness:.18,metalness:.02,transparent:!0,opacity:.68,side:t.DoubleSide,depthWrite:!1,emissive:new t.Color(402490),emissiveIntensity:.1});l.bumpMap=i,l.bumpScale=0;const c=new t.MeshPhysicalMaterial({color:959977,roughness:.12,metalness:0,transmission:.92,thickness:.18,ior:1.33,transparent:!0,opacity:1,side:t.DoubleSide,depthWrite:!1,clearcoat:.62,clearcoatRoughness:.08});c.normalMap=s,c.normalScale=new t.Vector2(.55,.55),c.attenuationColor=new t.Color(402490),c.attenuationDistance=.8;const u=new t.MeshStandardMaterial({color:988970,roughness:.95,metalness:.02,side:t.DoubleSide}),d=new t.MeshStandardMaterial({color:728888,roughness:.98,metalness:0,side:t.DoubleSide}),p=new t.Mesh(r,a);p.renderOrder=-20;const m=new t.Mesh(r,l);m.renderOrder=10;const h=new t.Mesh(r,u),x=new t.Mesh(r,d);o.add(p),o.add(h),o.add(x),o.add(m);let f=null,g=null,w="";function y(n){const o=q(n.props),a="detailed"===(e.graphicsQuality??"simplified"),i=JSON.stringify({v:o.vertices.map(t=>({x:Math.round(1e3*(t.x-n.position.x))/1e3,z:Math.round(1e3*(t.z-n.position.z))/1e3})),d:Math.round(1e3*o.depth_m)/1e3});if(i!==w){w=i;const e=function(t,e,n){if(n.length<3)return null;const o=n.map(t=>({x:t.x-e.position.x,z:t.z-e.position.z})),r=new t.Shape;r.moveTo(o[0].x,-o[0].z);for(let t=1;t<o.length;t++)r.lineTo(o[t].x,-o[t].z);r.closePath();const a=new t.ShapeGeometry(r);return a.rotateX(-Math.PI/2),a}(t,n,o.vertices),a=function(t,e,n,o){if(n.length<2)return null;const r=n.map(t=>({x:t.x-e.position.x,z:t.z-e.position.z})),a=-Math.abs(o),i=r.length,s=new Float32Array(4*i*3),l=[];for(let t=0;t<i;t++){const e=r[t],n=r[(t+1)%i],o=4*t;s[3*(o+0)+0]=e.x,s[3*(o+0)+1]=0,s[3*(o+0)+2]=e.z,s[3*(o+1)+0]=n.x,s[3*(o+1)+1]=0,s[3*(o+1)+2]=n.z,s[3*(o+2)+0]=n.x,s[3*(o+2)+1]=a,s[3*(o+2)+2]=n.z,s[3*(o+3)+0]=e.x,s[3*(o+3)+1]=a,s[3*(o+3)+2]=e.z,l.push(o+0,o+1,o+2,o+0,o+2,o+3)}const c=new t.BufferGeometry;return c.setAttribute("position",new t.BufferAttribute(s,3)),c.setIndex(l),c.computeVertexNormals(),c}(t,n,o.vertices,o.depth_m);f&&f.dispose(),g&&g.dispose(),f=e,g=a,p.geometry=f??r,m.geometry=f??r,x.geometry=f??r,h.geometry=g??r}const s=Boolean(f&&g);if(p.visible=s,m.visible=s,x.visible=s,h.visible=s,!s)return;p.position.y=.01,h.position.y=0,x.position.y=0-o.depth_m;const u=Math.min(.06,Math.max(.02,.3*o.depth_m));m.position.y=0-u,m.material=a?c:l,a?(c.roughness=.1,c.transmission=.92,c.clearcoat=.65,c.clearcoatRoughness=.08,c.attenuationDistance=.8+.35*$(o.depth_m,.2,2.5)):(l.roughness=.22,l.opacity=.66,l.emissiveIntensity=.06,l.bumpScale=0)}return y(n),{object:o,update:y,tick:t=>{if("detailed"!==(e.graphicsQuality??"simplified")||!m.visible)return!1;const n=performance.now(),o=s.userData??={};return n-("number"==typeof o.lastOffsetUpdateMs?o.lastOffsetUpdateMs:0)<4||(o.lastOffsetUpdateMs=n,s.offset.x=(s.offset.x+.022*t)%1,s.offset.y=(s.offset.y+.022*t*.7)%1),!0},dispose:()=>{f&&f.dispose(),g&&g.dispose(),r.dispose(),a.dispose(),u.dispose(),d.dispose(),l.dispose(),c.dispose()}}},render2D:({ctx:t,element:e,viewport:n})=>{const o=q(e.props);if(o.vertices.length<3)return;const r=o.vertices.map(t=>n.worldToScreen(t));t.save(),t.beginPath(),t.moveTo(r[0].x,r[0].y);for(let e=1;e<r.length;e++)t.lineTo(r[e].x,r[e].y);t.closePath(),t.fillStyle=i("#0ea5e9",.14),t.fill(),t.strokeStyle=i("#38bdf8",.65),t.lineWidth=2,t.stroke(),t.restore()},renderEditorModal:({element:e,update:n,remove:r,close:a})=>(0,o.jsx)(K,{element:e,update:n,remove:r,close:a,i18n:t})}}function K({element:t,update:e,remove:n,close:a,i18n:i}){const{t:s,locale:l}=i.useI18n(),c=q(t.props),u=(0,r.useMemo)(()=>new Intl.NumberFormat(l,{minimumFractionDigits:2,maximumFractionDigits:2}),[l]);return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"card",children:[(0,o.jsxs)("div",{className:"cardHeaderRow",children:[(0,o.jsx)("div",{className:"cardTitle",children:s("ext.structural.pool.name")}),(0,o.jsxs)("div",{className:"cardMeta",children:[u.format(c.depth_m)," m"]})]}),(0,o.jsx)("div",{className:"cardBody",children:s("ext.structural.pool.desc")})]}),(0,o.jsx)("div",{className:"sectionDivider"}),(0,o.jsxs)("div",{className:"field",children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.pool_name")}),(0,o.jsx)("input",{className:"input",value:t.name,onChange:t=>e({name:t.target.value})})]}),(0,o.jsx)("div",{className:"rowWrap",children:(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:160},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.pool_depth")}),(0,o.jsx)("input",{className:"input",type:"number",inputMode:"decimal",min:.1,max:20,step:.1,value:c.depth_m,onChange:t=>{const n=Number.parseFloat(t.target.value);Number.isFinite(n)&&e({props:{depth_m:$(n,.1,20)}})}})]})}),(0,o.jsx)("div",{className:"sectionDivider"}),(0,o.jsxs)("div",{className:"rowWrap",children:[(0,o.jsx)("button",{className:"dangerButton",type:"button",onClick:n,children:s("core.actions.delete")}),(0,o.jsx)("button",{className:"chipButton",type:"button",onClick:a,children:s("core.actions.close")})]})]})}function X(t,e){const n=t.x-e.x,o=t.z-e.z;return Math.hypot(n,o)}function V(t,e){return{x:t.x+e.x,z:t.z+e.z}}function Z(t,e){return{x:t.x-e.x,z:t.z-e.z}}function U(t,e){return{x:t.x*e,z:t.z*e}}function H(t){const e=Math.hypot(t.x,t.z);return e<=1e-9?{x:1,z:0}:{x:t.x/e,z:t.z/e}}function Y(t){return{x:-t.z,z:t.x}}function J(t){if(0===t.length)return{x:0,z:0};const e=t.reduce((t,e)=>({x:t.x+e.x,z:t.z+e.z}),{x:0,z:0});return{x:e.x/t.length,z:e.z/t.length}}function Q(t,e){return`${t.elementId}:${e}`}function tt(t,e){return"a"===e?t.a:t.b}function et(t,e){return"a"===e?t.direction:U(t.direction,-1)}function nt(t,e){return t.x*e.x+t.z*e.z}function ot(t,e){return t.x*e.z-t.z*e.x}function rt(t){return Number.isFinite(t.x)&&Number.isFinite(t.z)}function at(t){if(0===t.length)return{x:0,z:0};let e=0,n=0;for(const o of t)e+=o.x,n+=o.z;return{x:e/t.length,z:n/t.length}}function it(t,e,n){return V(t,U(e.normal,n*e.halfWidth))}function st(t,e,n,o){const r=e.wall,a=n.wall,i=et(r,e.endpoint),s=et(a,n.endpoint);if(Math.abs(ot(i,s))<1e-8)return it(t.point,r,o);const l=function(t,e,n,o){const r=ot(e,o);return Math.abs(r)<1e-9?null:V(t,U(e,ot(Z(n,t),o)/r))}(it(t.point,r,o),i,V(t.point,U(a.normal,o*a.halfWidth)),s);if(!l||!rt(l))return it(t.point,r,o);const c=Math.max(2*Math.min(r.halfWidth,a.halfWidth),1e-6);return X(l,t.point)>c+1e-9?it(t.point,r,o):l}function lt(t,e){if(2!==t.refs.length)return{left:it(t.point,e.wall,1),right:it(t.point,e.wall,-1)};const n=t.refs[0]===e?t.refs[1]:t.refs[0];return{left:st(t,e,n,1),right:st(t,e,n,-1)}}function ct(t,e){return V(t.a,U(t.direction,e))}function ut(t,e,n){return Math.max(e,Math.min(n,t))}function dt(t,e){return Math.min(Math.min(t.width,e.width)/2,.06)}function pt(t){const e=[];for(const n of t){if(n.type!==c)continue;const t=M(n.props.a,{x:n.position.x,z:n.position.z}),o=M(n.props.b,{x:n.position.x+1,z:n.position.z}),r=X(t,o);if(!Number.isFinite(r)||r<=1e-6)continue;const a=Math.max(.04,f(n.props.width,m)),i=H(Z(o,t));e.push({element:n,elementId:n.id,a:t,b:o,width:a,halfWidth:a/2,length:r,direction:i,normal:Y(i)})}return e}function mt(t,e){return function(t){const e=function(t){const e=pt(t),n=[];for(const t of e)n.push({wall:t,endpoint:"a",point:t.a}),n.push({wall:t,endpoint:"b",point:t.b});const o=function(t){const e=Array.from({length:t},(t,e)=>e);function n(t){let n=t;for(;e[n]!==n;)e[n]=e[e[n]],n=e[n];return n}return{find:n,union:function(t,o){const r=n(t),a=n(o);r!==a&&(e[a]=r)}}}(n.length);for(let t=0;t<n.length;t+=1)for(let e=t+1;e<n.length;e+=1){const r=n[t],a=n[e];if(r.wall.elementId===a.wall.elementId)continue;const i=dt(r.wall,a.wall);X(r.point,a.point)<=i+1e-9&&o.union(t,e)}const r=new Map;for(let t=0;t<n.length;t+=1){const e=o.find(t),a=r.get(e)??[];a.push(n[t]),r.set(e,a)}const a=[],i=new Map;let s=0;for(const t of r.values()){const e={id:`wall-node:${s}`,point:at(t.map(t=>t.point)),refs:t};s+=1,a.push(e);for(const n of t)i.set(Q(n.wall,n.endpoint),e)}return{walls:e,nodes:a,endpointNodes:i}}(t),n=new Map;for(const t of e.walls){const o=e.endpointNodes.get(Q(t,"a")),r=e.endpointNodes.get(Q(t,"b"));if(!o||!r)continue;const a=o.refs.find(e=>e.wall.elementId===t.elementId&&"a"===e.endpoint),i=r.refs.find(e=>e.wall.elementId===t.elementId&&"b"===e.endpoint);if(!a||!i)continue;const s=lt(o,a),l=lt(r,i),c=[s.left,l.left,l.right,s.right];c.every(rt)&&n.set(t.elementId,{wall:t,startNode:o,endNode:r,startLeft:s.left,startRight:s.right,endLeft:l.left,endRight:l.right,polygon:c})}return n}(e.some(e=>e.id===t.id)?e:[...e,t]).get(t.id)??null}function ht(t,e,n){const o=t.wall,r=ut(Math.min(e,n),0,o.length),a=ut(Math.max(e,n),0,o.length);if(a-r<=1e-6)return null;const i=ct(o,r),s=ct(o,a),l=r<=1e-6,c=a>=o.length-1e-6,u=l?t.startLeft:V(i,U(o.normal,o.halfWidth)),d=l?t.startRight:V(i,U(o.normal,-o.halfWidth)),p=[u,c?t.endLeft:V(s,U(o.normal,o.halfWidth)),c?t.endRight:V(s,U(o.normal,-o.halfWidth)),d];return p.every(rt)?{start:r,end:a,points:p}:null}const xt=.25,ft=/^#[0-9a-fA-F]{6}$/;function gt(t,e,n){return Math.max(e,Math.min(n,t))}function wt(t,e){return"number"==typeof t&&Number.isFinite(t)?t:e}function yt(t){return"number"==typeof t&&Number.isFinite(t)?t:void 0}function Mt(t){if("string"!=typeof t)return;const e=t.trim();return e.length>0?e:void 0}function _t(t){return"door"===t?.9:"window"===t?1.2:1}function bt(t){return"door"===t?"#8f806a":"window"===t?"#b9d8f4":void 0}function vt(t){return"door"===t?"wood":"window"===t?"glass":"none"}function kt(){const t=crypto;return t.randomUUID?.()??`opening-${Date.now()}-${Math.random().toString(16).slice(2)}`}function zt(t){if(!t||"object"!=typeof t||Array.isArray(t))return null;const e=t,n=function(t){return"opening"===t||"door"===t||"window"===t}(e.kind)?e.kind:"opening",o=Math.max(xt,wt(e.width_m,_t(n))),r=Mt(e.color),a=Mt(e.texture);return{id:Mt(e.id)??kt(),kind:n,center_m:wt(e.center_m,0),width_m:o,y_min_m:yt(e.y_min_m),y_max_m:yt(e.y_max_m),color:r&&ft.test(r)?r:void 0,texture:a}}function St(t){if(!Array.isArray(t))return[];const e=[],n=new Set;for(const o of t){const t=zt(o);if(t){for(;n.has(t.id);)t.id=kt();n.add(t.id),e.push(t)}}return e}function Nt(t,e){const n=Math.max(.15,e);if("opening"===t)return{yMin:0,yMax:n};if("door"===t)return{yMin:0,yMax:Math.min(n,2.1)};const o=Math.min(.9,Math.max(0,n-.3));return{yMin:o,yMax:Math.min(n,Math.max(o+.25,2))}}function jt(t){const e=Math.max(xt,t.width_m);return{id:kt(),kind:t.kind,center_m:t.center_m,width_m:e,color:bt(t.kind),texture:vt(t.kind)}}function Wt(t,e,n){const o=Math.max(.001,e),r=Math.max(.15,n),a=[];for(const e of t){const t=Math.min(xt,o),n=gt(Number.isFinite(e.width_m)?e.width_m:_t(e.kind),t,o),i=gt(Number.isFinite(e.center_m)?e.center_m:o/2,n/2,o-n/2),s=i-n/2,l=i+n/2;if(l-s<t-1e-6)continue;const c=Nt(e.kind,r);let u,d;if("opening"===e.kind?(u=0,d=r):(u=Number.isFinite(e.y_min_m??NaN)?e.y_min_m:c.yMin,d=Number.isFinite(e.y_max_m??NaN)?e.y_max_m:c.yMax),u=gt(u,0,r),d=gt(d,0,r),d<u){const t=d;d=u,u=t}d-u<.08||a.push({id:e.id,kind:e.kind,center_m:i,width_m:n,start_m:s,end_m:l,y_min_m:u,y_max_m:d,color:e.color,texture:e.texture})}return a.sort((t,e)=>t.start_m-e.start_m||t.id.localeCompare(e.id)),a}function Tt(t){return t.map(t=>{const e={id:t.id,kind:t.kind,center_m:t.center_m,width_m:t.width_m};return"number"==typeof t.y_min_m&&Number.isFinite(t.y_min_m)&&(e.y_min_m=t.y_min_m),"number"==typeof t.y_max_m&&Number.isFinite(t.y_max_m)&&(e.y_max_m=t.y_max_m),t.color&&(e.color=t.color),t.texture&&(e.texture=t.texture),e})}function Pt(t,e,n){return Math.max(e,Math.min(n,t))}function Dt(t){return Math.round(1e3*t)/1e3}function Ct(t,e){const n=function(t,e,n){const o=t.map(t=>({start:Pt(Math.min(t.start,t.end),0,n),end:Pt(Math.max(t.start,t.end),0,n)})).filter(t=>t.end-t.start>1e-6).sort((t,e)=>t.start-e.start),r=[];for(const t of o){const e=r[r.length-1];!e||t.start>e.end+1e-6?r.push(t):e.end=Math.max(e.end,t.end)}return r}(e,0,t),o=[];let r=0;for(const t of n)t.start>r+1e-6&&o.push({start:r,end:t.start}),r=Math.max(r,t.end);return r<t-1e-6&&o.push({start:r,end:t}),o}function At(t,e,n){return V(t,U(e,n))}function Ft(t){const e=M(t.props.a,{x:t.position.x,z:t.position.z}),n=M(t.props.b,{x:t.position.x+1,z:t.position.z}),o=Math.max(.04,f(t.props.width,m));return{minX:Math.min(e.x,n.x)-o,maxX:Math.max(e.x,n.x)+o,minZ:Math.min(e.z,n.z)-o,maxZ:Math.max(e.z,n.z)+o}}function Et(t){return t.map(t=>`${t.x},${t.z}`).join(" ")}function It(t,e,n,o,r,a){const i=At(t,e,r),s=At(t,e,a);return[V(i,U(n,o)),V(s,U(n,o)),V(s,U(n,-o)),V(i,U(n,-o))]}function Rt(t,e,n,o){const r=new t.BufferGeometry,a=[],i=[],s=[];function l(t,e,n,o){const r=a.length/3;return a.push(t.x,e,t.z),i.push(n,o),r}function c(t,e,a,i,c){const u=s.length,d=l(t,n,t.x,n),p=l(e,n,e.x,n),m=l(a,o,a.x,o),h=l(i,o,i.x,o);s.push(d,p,m,d,m,h),r.addGroup(u,6,c)}const[u,d,p,m]=e;c(u,d,d,u,0),c(p,m,m,p,0),c(m,u,u,m,1),c(d,p,p,d,1);const h=s.length,x=l(u,o,u.x,u.z),f=l(d,o,d.x,d.z),g=l(p,o,p.x,p.z),w=l(m,o,m.x,m.z);s.push(x,f,g,x,g,w),r.addGroup(h,6,1);const y=s.length,M=l(m,n,m.x,m.z),_=l(p,n,p.x,p.z),b=l(d,n,d.x,d.z),v=l(u,n,u.x,u.z);return s.push(M,_,b,M,b,v),r.addGroup(y,6,1),r.setAttribute("position",new t.Float32BufferAttribute(a,3)),r.setAttribute("uv",new t.Float32BufferAttribute(i,2)),r.setIndex(s),r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}function Bt(t,e){if(Array.isArray(t))for(const n of t)e.has(n)||(e.add(n),n.dispose());else e.has(t)||(e.add(t),t.dispose())}function Gt(t,e){const n=new Set;for(const o of[...t.children]){const r=o;r.geometry&&"dispose"in r.geometry&&r.geometry.dispose(),e&&r.material&&Bt(r.material,n),t.remove(o)}}function Ot(t){return"door"===t?{fill:"rgba(251,146,60,0.20)",stroke:"rgba(251,146,60,0.92)",dash:[7,4]}:"window"===t?{fill:"rgba(56,189,248,0.18)",stroke:"rgba(56,189,248,0.92)",dash:[5,4]}:{fill:"rgba(251,191,36,0.12)",stroke:"rgba(251,191,36,0.92)",dash:[9,5]}}function $t(t,e){const n=A(e,vt(t));return"window"!==t&&"transparent"===n?vt(t):n}function qt(t,e,n,o){const r=n.y_max_m-n.y_min_m;if(n.width_m<=.12||r<=.12)return;const a=Pt(.11*Math.min(n.width_m,r),.03,.09),i=.48*o,s=.34*o,l=F(t,$t("door",n.texture)),c=new t.MeshStandardMaterial({color:"#5b5044",roughness:.82,metalness:.05,map:l}),u=new t.MeshStandardMaterial({color:n.color??bt("door")??"#8f806a",roughness:.74,metalness:.08,map:l}),d=new t.BoxGeometry(a,r,i),p=new t.BoxGeometry(a,r,i),m=new t.BoxGeometry(n.width_m,a,i),h=new t.Mesh(d,c),x=new t.Mesh(p,c),f=new t.Mesh(m,c);for(const t of[h,x,f])t.userData.__toposyncAllowPickWhenGhostWalls=!0;const g=0+n.y_min_m+r/2;h.position.set(n.start_m+a/2,g,0),x.position.set(n.end_m-a/2,g,0),f.position.set(n.center_m,0+n.y_max_m-a/2,0);const w=Pt(.02*a,.001,.004),y=n.width_m-2*a-2*w,M=r-a-w;if(y>.08&&M>.2){const o=new t.BoxGeometry(y,M,s),r=new t.Mesh(o,u);r.userData.__toposyncAllowPickWhenGhostWalls=!0,r.position.set(n.center_m,0+n.y_min_m+M/2,0),r.castShadow=!0,r.receiveShadow=!0,e.add(r)}else u.dispose();for(const t of[h,x,f])t.castShadow=!0,t.receiveShadow=!0,e.add(t)}function Lt(t,e,n,o){const r=n.y_max_m-n.y_min_m;if(n.width_m<=.12||r<=.12)return;const a=Pt(.09*Math.min(n.width_m,r),.025,.07),i=.35*o,s=.14*o,l=$t("window",n.texture),c=F(t,l),u=new t.MeshStandardMaterial({color:n.color??bt("window")??"#b9d8f4",roughness:.55,metalness:.18,map:c}),d=new t.BoxGeometry(n.width_m,a,i),p=new t.BoxGeometry(n.width_m,a,i),m=new t.BoxGeometry(a,r,i),h=new t.BoxGeometry(a,r,i),x=new t.Mesh(d,u),f=new t.Mesh(p,u),g=new t.Mesh(m,u),w=new t.Mesh(h,u);for(const t of[x,f,g,w])t.userData.__toposyncAllowPickWhenGhostWalls=!0;const y=0+n.y_min_m+r/2;x.position.set(n.center_m,0+n.y_max_m-a/2,0),f.position.set(n.center_m,0+n.y_min_m+a/2,0),g.position.set(n.start_m+a/2,y,0),w.position.set(n.end_m-a/2,y,0);for(const t of[x,f,g,w])t.castShadow=!0,t.receiveShadow=!0,e.add(t);const M=n.width_m-2.2*a,_=r-2.2*a;if("transparent"===l)return;if(M<=.08||_<=.08)return;const b=new t.BoxGeometry(M,_,s);let v;v="glass"===l?new t.MeshPhysicalMaterial({color:n.color??bt("window")??"#b9d8f4",roughness:.1,metalness:0,transmission:.88,thickness:.05,transparent:!0,opacity:.55,depthWrite:!1,side:t.DoubleSide}):new t.MeshStandardMaterial({color:n.color??bt("window")??"#b9d8f4",roughness:.42,metalness:.12,map:c});const k=new t.Mesh(b,v);k.userData.__toposyncAllowPickWhenGhostWalls=!0,k.position.set(n.center_m,y,0),"glass"===l&&(k.renderOrder=12),k.castShadow=!1,k.receiveShadow="glass"!==l,e.add(k)}function Kt({element:t,update:e,remove:n,close:a,i18n:i}){const{t:s,locale:l}=i.useI18n(),c=g(t.props.color,p),u=D(t.props.texture,"none"),d=(0,r.useMemo)(()=>St(t.props.openings),[t.props.openings]),m=(0,r.useMemo)(()=>new Intl.NumberFormat(l,{minimumFractionDigits:2,maximumFractionDigits:2}),[l]),h=(0,r.useMemo)(()=>X(M(t.props.a,{x:t.position.x,z:t.position.z}),M(t.props.b,{x:t.position.x+1,z:t.position.z})),[t]),x=(0,r.useMemo)(()=>[...d].sort((t,e)=>t.center_m-e.center_m||t.id.localeCompare(e.id)),[d]),f=(0,r.useMemo)(()=>{const t=Wt(d,h,3.2),e=new Map;for(const n of t)e.set(n.id,n);return e},[d,h]);function w(t){e({props:{openings:Tt(t)}})}function y(t,e){w(d.map(n=>n.id===t?{...n,...e}:n))}function _(t){const e="door"===t?.9:"window"===t?1.2:1,n=Math.max(0,h),o=Pt(e,Math.min(xt,n),n),r=jt({kind:t,center_m:h/2,width_m:o});w([...d,r])}return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"card",children:[(0,o.jsxs)("div",{className:"cardHeaderRow",children:[(0,o.jsx)("div",{className:"cardTitle",children:s("ext.structural.wall.name")}),(0,o.jsxs)("div",{className:"cardMeta",children:[m.format(h)," m"]})]}),(0,o.jsxs)("div",{className:"cardBody",children:[s("ext.structural.editor.preview")," • ",x.length," ",s("ext.structural.editor.openings")]})]}),(0,o.jsx)("div",{className:"sectionDivider"}),(0,o.jsxs)("div",{className:"rowWrap",children:[(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:160},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.wall_color")}),(0,o.jsx)("input",{className:"input",type:"color",value:c,onChange:t=>e({props:{color:t.target.value}})})]}),(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:160},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.wall_texture")}),(0,o.jsxs)("select",{className:"input",value:u,onChange:t=>e({props:{texture:D(t.target.value,u)}}),children:[(0,o.jsx)("option",{value:"none",children:s("ext.structural.editor.texture.none")}),(0,o.jsx)("option",{value:"brick",children:s("ext.structural.editor.texture.brick")}),(0,o.jsx)("option",{value:"concrete",children:s("ext.structural.editor.texture.concrete")})]})]})]}),(0,o.jsx)("div",{className:"sectionDivider"}),(0,o.jsxs)("div",{className:"rowWrap",style:{alignItems:"center",justifyContent:"space-between"},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.openings")}),(0,o.jsxs)("div",{className:"rowWrap",style:{gap:8},children:[(0,o.jsxs)("button",{className:"chipButton",type:"button",onClick:()=>_("opening"),children:["+ ",s("ext.structural.tools.wall_opening")]}),(0,o.jsxs)("button",{className:"chipButton",type:"button",onClick:()=>_("door"),children:["+ ",s("ext.structural.tools.wall_door")]}),(0,o.jsxs)("button",{className:"chipButton",type:"button",onClick:()=>_("window"),children:["+ ",s("ext.structural.tools.wall_window")]})]})]}),0===x.length?(0,o.jsx)("div",{className:"cardBody",children:s("ext.structural.editor.openings_empty")}):null,x.map(t=>{const e=t.kind,n=$t(e,t.texture),r=t.color??bt(e)??"#8f806a",a=f.get(t.id)??null,i="opening"===e?s("ext.structural.editor.opening_height_full"):a?s("ext.structural.editor.opening_height_range",{yMin:m.format(a.y_min_m),yMax:m.format(a.y_max_m)}):null,l=Math.max(0,h),c=Math.min(xt,l),u=Pt(t.width_m,c,Math.max(c,l)),p=u/2,x=Math.max(p,l-u/2),g=Pt(t.center_m,p,x);return(0,o.jsxs)("div",{className:"card",style:{marginTop:10},children:[(0,o.jsxs)("div",{className:"cardHeaderRow",children:[(0,o.jsx)("div",{className:"cardTitle",children:s(`ext.structural.editor.kind.${e}`)}),(0,o.jsxs)("div",{className:"cardMeta",children:[m.format(u)," m"]})]}),i?(0,o.jsx)("div",{className:"cardMeta",style:{marginTop:6},children:i}):null,(0,o.jsxs)("div",{className:"rowWrap",children:[(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:120},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.opening_kind")}),(0,o.jsxs)("select",{className:"input",value:e,onChange:n=>{const o="opening"===(r=n.target.value)||"door"===r||"window"===r?r:e;var r;const a={kind:o};!t.color&&bt(o)&&(a.color=bt(o)),t.texture&&t.texture!==vt(e)||(a.texture=vt(o)),y(t.id,a)},children:[(0,o.jsx)("option",{value:"opening",children:s("ext.structural.editor.kind.opening")}),(0,o.jsx)("option",{value:"door",children:s("ext.structural.editor.kind.door")}),(0,o.jsx)("option",{value:"window",children:s("ext.structural.editor.kind.window")})]})]}),(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:120},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.opening_center")}),(0,o.jsx)("input",{className:"input",type:"number",step:.05,value:g,onChange:e=>{const n=Number(e.target.value);Number.isFinite(n)&&y(t.id,{center_m:Pt(n,p,x)})}}),(0,o.jsx)("div",{className:"cardMeta",children:s("ext.structural.editor.opening_center_hint",{start:m.format(0),end:m.format(h)})})]}),(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:120},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.opening_width")}),(0,o.jsx)("input",{className:"input",type:"number",step:.05,min:c,max:Math.max(c,l),value:u,onChange:e=>{const n=Number(e.target.value);if(!Number.isFinite(n))return;const o=Pt(n,c,Math.max(c,l)),r=o/2,a=Math.max(r,l-o/2);y(t.id,{width_m:o,center_m:Pt(t.center_m,r,a)})}})]})]}),"opening"!==e?(0,o.jsxs)("div",{className:"rowWrap",children:[(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:120},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.opening_color")}),(0,o.jsx)("input",{className:"input",type:"color",value:r,onChange:e=>y(t.id,{color:e.target.value})})]}),(0,o.jsxs)("div",{className:"field",style:{flex:1,minWidth:120},children:[(0,o.jsx)("div",{className:"label",children:s("ext.structural.editor.opening_texture")}),(0,o.jsxs)("select",{className:"input",value:n,onChange:e=>y(t.id,{texture:A(e.target.value,n)}),children:[(0,o.jsx)("option",{value:"none",children:s("ext.structural.editor.texture.none")}),(0,o.jsx)("option",{value:"wood",children:s("ext.structural.editor.texture.wood")}),(0,o.jsx)("option",{value:"concrete",children:s("ext.structural.editor.texture.concrete")}),(0,o.jsx)("option",{value:"glass",children:s("ext.structural.editor.texture.glass")}),"window"===e?(0,o.jsx)("option",{value:"transparent",children:s("ext.structural.editor.texture.transparent_cutout")}):null]})]})]}):null,(0,o.jsx)("div",{className:"rowWrap",children:(0,o.jsx)("button",{className:"dangerButton",type:"button",onClick:()=>{return e=t.id,void w(d.filter(t=>t.id!==e));var e},children:s("core.actions.delete")})})]},t.id)}),(0,o.jsx)("div",{className:"sectionDivider"}),(0,o.jsxs)("div",{className:"rowWrap",children:[(0,o.jsx)("button",{className:"dangerButton",type:"button",onClick:n,children:s("core.actions.delete")}),(0,o.jsx)("button",{className:"chipButton",type:"button",onClick:a,children:s("core.actions.close")})]})]})}const Xt={id:"structure",name:{key:"core.ui.tools.group.structure",fallback:"Structure"},order:20},Vt={id:"areas",name:{key:"core.ui.tools.group.areas",fallback:"Areas"},order:30};function Zt(t,e,n){const o={x:(e.x+n.x)/2,z:(e.z+n.z)/2};return t.createElement(c,{name:"",position:{x:o.x,y:0,z:o.z},props:{a:e,b:n,color:p,width:m,openings:[]}})}function Ut(t,e){const n=J(e),o=function(){try{const t=localStorage.getItem(x);if(t&&w(t))return t}catch{}return h}();return t.createElement(u,{name:"",position:{x:n.x,y:0,z:n.z},props:{vertices:e,fill:o,opacity:1}})}function Ht(t,e){const n=J(e);return t.createElement(d,{name:"",position:{x:n.x,y:0,z:n.z},props:{vertices:e,depth_m:1.4}})}function Yt(t,e){const n=e.length;if(!(n<2))for(let o=0;o<n;o++)Zt(t,e[o],e[(o+1)%n])}function Jt(t,e,n){return Math.max(e,Math.min(n,t))}function Qt(t,e){return{x:t.x+e.x,z:t.z+e.z}}function te(t,e){return{x:t.x*e,z:t.z*e}}function ee(t,e,n,o){const r=function(t,e){return t.x*e.x+t.z*e.z}(function(t,e){return{x:t.x-e.x,z:t.z-e.z}}(t,e),n),a=Math.max(0,Math.min(o,r));return{point:Qt(e,te(n,a)),scalar:a}}function ne(t,e,n){const o=X(e,n);return X(t,o<=1e-6?e:ee(t,e,{x:(n.x-e.x)/o,z:(n.z-e.z)/o},o).point)}function oe(t,e){const n="door"===(o=e.kind)?{stroke:i("#fb923c",.92),fill:i("#fb923c",.22),dash:[8,6],labelKey:"ext.structural.tools.wall_door",fallback:"Door",descriptionKey:"ext.structural.tools.wall_door_desc",descriptionFallback:"Place a door cutout on a wall.",icon:"door-open",order:20}:"window"===o?{stroke:i("#38bdf8",.92),fill:i("#38bdf8",.22),dash:[5,5],labelKey:"ext.structural.tools.wall_window",fallback:"Window",descriptionKey:"ext.structural.tools.wall_window_desc",descriptionFallback:"Place a window cutout on a wall.",icon:"window-maximize",order:30}:{stroke:i("#fbbf24",.92),fill:i("#fbbf24",.22),dash:[9,4],labelKey:"ext.structural.tools.wall_opening",fallback:"Opening",descriptionKey:"ext.structural.tools.wall_opening_desc",descriptionFallback:"Hover a wall, click and drag to size. Click to place default width.",icon:"crop-simple",order:40};var o;return{id:"door"===e.kind?"com.toposync.structural.tool.door":"window"===e.kind?"com.toposync.structural.tool.window":"com.toposync.structural.tool.opening",name:{key:n.labelKey,fallback:n.fallback},description:{key:n.descriptionKey,fallback:n.descriptionFallback},icon:n.icon,group:Xt,order:n.order,createSession:t=>{let o=null,r=null,a=null,i=null,s=null,l=!1;function u(){a=null,i=null,s=null,l=!1}function d(t,n,o,r){const a=Math.min(Math.max(xt,.2),t),i=Math.abs(o-n);let s=i,l=(n+o)/2;return r?(s=2*i,l=n):i<.04&&(s=Math.min(t,Math.max(a,function(t){return"door"===t?.9:"window"===t?1.2:1}(e.kind))),l=n),s=Jt(s,a,t),l=Jt(l,s/2,t-s/2),{start:l-s/2,end:l+s/2,center:l,width:s}}function p(e){if(a)return;const n=function(t){const e=[];for(const n of t.getElements()){if(n.type!==c)continue;const t=M(n.props.a,{x:n.position.x-.5,z:n.position.z}),o=M(n.props.b,{x:n.position.x+.5,z:n.position.z}),r=X(t,o);if(r<=1e-6)continue;const a={x:(o.x-t.x)/r,z:(o.z-t.z)/r},i={x:-a.z,z:a.x};e.push({id:n.id,a:t,b:o,dir:a,normal:i,length:r,width:Math.max(.04,f(n.props.width,m)),props:n.props})}return e}(t),i=function(t,e){let n=null,o=Number.POSITIVE_INFINITY;for(const r of t){const t=ne(e,r.a,r.b);t>Math.max(.45,3.5*r.width)||t<o&&(o=t,n=r)}return n}(n,e);o=i,r=i?ee(e,i.a,i.dir,i.length).scalar:null}function h(t,e,n){const o=e.worldToScreen(n.a),r=e.worldToScreen(n.b);t.beginPath(),t.moveTo(o.x,o.y),t.lineTo(r.x,r.y),t.strokeStyle="rgba(255,255,255,0.55)",t.lineWidth=2.25,t.setLineDash([6,6]),t.stroke()}function x(t,e,o,r,a,i){const s=d(o.length,r,a,i),l=Qt(o.a,te(o.dir,s.start)),c=Qt(o.a,te(o.dir,s.end)),u=Math.max(.09,o.width/2),p=[Qt(l,te(o.normal,u)),Qt(c,te(o.normal,u)),Qt(c,te(o.normal,-u)),Qt(l,te(o.normal,-u))].map(t=>e.worldToScreen(t));t.beginPath(),t.moveTo(p[0].x,p[0].y);for(let e=1;e<p.length;e++)t.lineTo(p[e].x,p[e].y);t.closePath(),t.fillStyle=n.fill,t.fill(),t.strokeStyle=n.stroke,t.lineWidth=2,t.setLineDash(n.dash),t.stroke(),t.setLineDash([]);const m=e.worldToScreen(Qt(o.a,te(o.dir,s.center))),h=`${s.width.toFixed(2)} m`;t.font="12px ui-sans-serif, system-ui";const x=t.measureText(h).width+16,f=m.x-x/2,g=m.y-Math.max(28,24+12/Math.max(1,e.scale));t.fillStyle="rgba(8,12,26,0.86)",t.fillRect(f,g,x,20),t.strokeStyle="rgba(255,255,255,0.18)",t.lineWidth=1,t.strokeRect(f+.5,g+.5,x-1,19),t.fillStyle="rgba(230,232,242,0.95)",t.textAlign="center",t.textBaseline="middle",t.fillText(h,m.x,g+10)}return{onPointerEvent:n=>{if("cancel"!==n.kind){if("move"===n.kind)return a?(l=n.shiftKey,void(s=ee(n.world,a.a,a.dir,a.length).scalar)):void p(n.world);if("down"===n.kind){if(0!==n.button)return;return p(n.world),o&&null!=r?(a=o,i=r,s=r,void(l=n.shiftKey)):void u()}if("up"===n.kind){if(0!==n.button)return;if(!a||null==i)return;l=n.shiftKey,s=ee(n.world,a.a,a.dir,a.length).scalar,function(){if(!a||null==i||null==s)return;const n=d(a.length,i,s,l),o=t.getElements().find(t=>t.id===a?.id),r=St(o?.props.openings??a.props.openings),c=jt({kind:e.kind,center_m:n.center,width_m:n.width});t.updateElement(a.id,{props:{openings:Tt([...r,c])}}),t.openEditor(a.id)}(),u(),p(n.world)}}else u()},onKeyDown:t=>{"Escape"===t.key&&u()},renderOverlay2D:({ctx:t,viewport:e})=>{t.save(),a&&null!=i&&null!=s?(h(t,e,a),x(t,e,a,i,s,l)):o&&null!=r&&(h(t,e,o),x(t,e,o,r,r,!1)),t.restore()},getCursor:()=>o?"copy":"crosshair"}}}}function re(t,e){return{id:e.withWalls?"com.toposync.structural.tool.area_square_walls":"com.toposync.structural.tool.area_square",name:{key:e.withWalls?"ext.structural.tools.area_square_walls":"ext.structural.tools.area_square",fallback:e.withWalls?"Rectangular room":"Rectangular area"},icon:e.withWalls?"border-all":"vector-square",group:Vt,order:e.withWalls?10:30,createSession:t=>{let n=null,o=null;function r(){n=null,o=null}return{onPointerEvent:a=>{if("cancel"!==a.kind)if("move"!==a.kind){if("down"===a.kind&&0===a.button)return n?void function(o){if(!n)return;const a=function(t,e){const n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),r=Math.min(t.z,e.z),a=Math.max(t.z,e.z);return[{x:n,z:r},{x:o,z:r},{x:o,z:a},{x:n,z:a}]}(n,o);if(X(a[0],a[2])<.12)return void r();const i=Ut(t,a);e.withWalls&&Yt(t,a),i&&t.openEditor(i),r()}(a.world):(n=a.world,void(o=a.world))}else n&&(o=a.world);else r()},onKeyDown:t=>{"Escape"===t.key&&r()},renderOverlay2D:({ctx:t,viewport:e})=>{if(!n||!o)return;const r=[n,{x:o.x,z:n.z},o,{x:n.x,z:o.z}].map(t=>e.worldToScreen(t));t.save(),t.beginPath(),t.moveTo(r[0].x,r[0].y);for(let e=1;e<r.length;e++)t.lineTo(r[e].x,r[e].y);t.closePath(),t.fillStyle=i("#fbbf24",.12),t.fill(),t.strokeStyle=i("#fbbf24",.8),t.lineWidth=2,t.setLineDash([6,6]),t.stroke(),t.restore()},getCursor:()=>"crosshair"}}}}function ae(t){return{id:"com.toposync.structural.tool.pool_square",name:{key:"ext.structural.tools.pool_square",fallback:"Rectangular pool"},icon:"water-ladder",group:Vt,order:50,createSession:t=>{let e=null,n=null;function o(){e=null,n=null}return{onPointerEvent:r=>{if("cancel"!==r.kind)if("move"!==r.kind){if("down"===r.kind&&0===r.button)return e?void function(n){if(!e)return;const r=function(t,e){const n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),r=Math.min(t.z,e.z),a=Math.max(t.z,e.z);return[{x:n,z:r},{x:o,z:r},{x:o,z:a},{x:n,z:a}]}(e,n);if(X(r[0],r[2])<.12)return void o();const a=Ht(t,r);a&&t.openEditor(a),o()}(r.world):(e=r.world,void(n=r.world))}else e&&(n=r.world);else o()},onKeyDown:t=>{"Escape"===t.key&&o()},renderOverlay2D:({ctx:t,viewport:o})=>{if(!e||!n)return;const r=[e,{x:n.x,z:e.z},n,{x:e.x,z:n.z}].map(t=>o.worldToScreen(t));t.save(),t.beginPath(),t.moveTo(r[0].x,r[0].y);for(let e=1;e<r.length;e++)t.lineTo(r[e].x,r[e].y);t.closePath(),t.fillStyle=i("#0ea5e9",.12),t.fill(),t.strokeStyle=i("#38bdf8",.8),t.lineWidth=2,t.setLineDash([6,6]),t.stroke(),t.restore()},getCursor:()=>"crosshair"}}}}function ie(t,e){return{id:e.withWalls?"com.toposync.structural.tool.area_polygon_walls":"com.toposync.structural.tool.area_polygon",name:{key:e.withWalls?"ext.structural.tools.area_polygon_walls":"ext.structural.tools.area_polygon",fallback:e.withWalls?"Freeform room":"Freeform area"},icon:e.withWalls?"object-group":"draw-polygon",group:Vt,order:e.withWalls?20:40,createSession:t=>{const n=[];let o=null;function r(){n.splice(0,n.length),o=null}function a(){if(n.length<3)return void r();const o=Ut(t,[...n]);e.withWalls&&Yt(t,n),o&&t.openEditor(o),r()}return{onPointerEvent:t=>{"cancel"!==t.kind?"move"!==t.kind?"dblclick"!==t.kind?"down"===t.kind&&0===t.button&&(function(t){if(n.length<3)return!1;const e=n[0];return X(t.world,e)<.22}(t)?a():(n.push(t.world),o=t.world)):a():o=t.world:r()},onKeyDown:t=>{"Escape"===t.key&&r(),"Enter"===t.key&&a(),("Backspace"===t.key||"Delete"===t.key)&&n.length>0&&n.pop()},renderOverlay2D:({ctx:t,viewport:e})=>{if(0===n.length)return;const r=n.map(t=>e.worldToScreen(t)),a=o?e.worldToScreen(o):null;if(t.save(),n.length>=2){t.beginPath(),t.moveTo(r[0].x,r[0].y);for(let e=1;e<r.length;e++)t.lineTo(r[e].x,r[e].y);a&&t.lineTo(a.x,a.y),t.strokeStyle=i("#fbbf24",.85),t.lineWidth=2,t.setLineDash([6,6]),t.stroke()}for(let e=0;e<r.length;e++){const o=r[e],a=0===e&&n.length>=3;t.beginPath(),t.arc(o.x,o.y,a?6:5,0,2*Math.PI),t.fillStyle=i(a?"#22c55e":"#fbbf24",.85),t.fill(),t.strokeStyle="rgba(0,0,0,0.35)",t.lineWidth=2,t.stroke()}t.restore()},getCursor:()=>"crosshair"}}}}const se={en:{"ext.structural.wall.name":"Wall","ext.structural.wall.desc":"Simple wall (line) in 2D.","ext.structural.area.name":"Area","ext.structural.area.desc":"Area (polygon) in 2D.","ext.structural.pool.name":"Pool","ext.structural.pool.desc":"Swimming pool (hole) in 2D.","ext.structural.tools.wall":"Wall","ext.structural.tools.wall_opening":"Opening","ext.structural.tools.wall_opening_desc":"Floor-to-ceiling wall cutout. Hover a wall, click and drag to size. Click to place default width. Hold Shift for symmetric sizing.","ext.structural.tools.wall_door":"Door","ext.structural.tools.wall_door_desc":"Place a door cutout on a wall.","ext.structural.tools.wall_window":"Window","ext.structural.tools.wall_window_desc":"Place a window cutout on a wall.","ext.structural.tools.area_square":"Rectangular area","ext.structural.tools.area_polygon":"Freeform area","ext.structural.tools.area_square_walls":"Rectangular room","ext.structural.tools.area_polygon_walls":"Freeform room","ext.structural.tools.pool_square":"Rectangular pool","ext.structural.tools.pool_polygon":"Freeform pool","ext.structural.editor.wall_color":"Wall color","ext.structural.editor.wall_texture":"Wall texture","ext.structural.editor.openings":"Openings","ext.structural.editor.openings_empty":"No openings yet. Use tools or add one here.","ext.structural.editor.opening_kind":"Type","ext.structural.editor.opening_center":"Position (m)","ext.structural.editor.opening_center_hint":"Along the wall: {{start}} m = start (1st point), {{end}} m = end (2nd point).","ext.structural.editor.opening_width":"Width (m)","ext.structural.editor.opening_height_full":"Height: floor to ceiling.","ext.structural.editor.opening_height_range":"Height: {{yMin}} - {{yMax}} m.","ext.structural.editor.opening_color":"Color","ext.structural.editor.opening_texture":"Texture","ext.structural.editor.kind.opening":"Opening","ext.structural.editor.kind.door":"Door","ext.structural.editor.kind.window":"Window","ext.structural.editor.area_name":"Area name (optional)","ext.structural.editor.area_color":"Area color","ext.structural.editor.floor_texture":"Floor texture","ext.structural.editor.transparent":"Transparent","ext.structural.editor.texture.none":"None","ext.structural.editor.texture.brick":"Brick","ext.structural.editor.texture.concrete":"Concrete","ext.structural.editor.texture.wood":"Wood","ext.structural.editor.texture.glass":"Glass","ext.structural.editor.texture.transparent_cutout":"Transparent cutout","ext.structural.editor.texture.grass":"Grass","ext.structural.editor.pool_name":"Pool name (optional)","ext.structural.editor.pool_depth":"Depth (m)","ext.structural.editor.preview":"Preview"},"pt-BR":{"ext.structural.wall.name":"Parede","ext.structural.wall.desc":"Parede simples (linha) em 2D.","ext.structural.area.name":"Área","ext.structural.area.desc":"Área (polígono) em 2D.","ext.structural.pool.name":"Piscina","ext.structural.pool.desc":"Piscina (buraco) em 2D.","ext.structural.tools.wall":"Parede","ext.structural.tools.wall_opening":"Abertura","ext.structural.tools.wall_opening_desc":"Recorte do piso ao teto. Passe sobre a parede, clique e arraste para dimensionar. Clique para largura padrão. Segure Shift para simetria.","ext.structural.tools.wall_door":"Porta","ext.structural.tools.wall_door_desc":"Adiciona um recorte de porta na parede.","ext.structural.tools.wall_window":"Janela","ext.structural.tools.wall_window_desc":"Adiciona um recorte de janela na parede.","ext.structural.tools.area_square":"Área retangular","ext.structural.tools.area_polygon":"Área livre","ext.structural.tools.area_square_walls":"Ambiente retangular","ext.structural.tools.area_polygon_walls":"Ambiente livre","ext.structural.tools.pool_square":"Piscina retangular","ext.structural.tools.pool_polygon":"Piscina livre","ext.structural.editor.wall_color":"Cor da parede","ext.structural.editor.wall_texture":"Textura da parede","ext.structural.editor.openings":"Aberturas","ext.structural.editor.openings_empty":"Sem aberturas ainda. Use as ferramentas ou adicione aqui.","ext.structural.editor.opening_kind":"Tipo","ext.structural.editor.opening_center":"Posição (m)","ext.structural.editor.opening_center_hint":"Ao longo da parede: {{start}} m = início (1º ponto), {{end}} m = fim (2º ponto).","ext.structural.editor.opening_width":"Largura (m)","ext.structural.editor.opening_height_full":"Altura: piso ao teto.","ext.structural.editor.opening_height_range":"Altura: {{yMin}} - {{yMax}} m.","ext.structural.editor.opening_color":"Cor","ext.structural.editor.opening_texture":"Textura","ext.structural.editor.kind.opening":"Abertura","ext.structural.editor.kind.door":"Porta","ext.structural.editor.kind.window":"Janela","ext.structural.editor.area_name":"Nome da área (opcional)","ext.structural.editor.area_color":"Cor da área","ext.structural.editor.floor_texture":"Textura do chão","ext.structural.editor.transparent":"Transparente","ext.structural.editor.texture.none":"Nenhuma","ext.structural.editor.texture.brick":"Tijolo","ext.structural.editor.texture.concrete":"Concreto","ext.structural.editor.texture.wood":"Madeira","ext.structural.editor.texture.glass":"Vidro","ext.structural.editor.texture.transparent_cutout":"Recorte transparente","ext.structural.editor.texture.grass":"Grama","ext.structural.editor.pool_name":"Nome da piscina (opcional)","ext.structural.editor.pool_depth":"Profundidade (m)","ext.structural.editor.preview":"Prévia"}};function le(t){var e;t.i18n.registerTranslations(se),t.registerElementType((e=t.i18n,{type:c,layerGroup:"walls",name:{key:"ext.structural.wall.name",fallback:"Wall"},description:{key:"ext.structural.wall.desc",fallback:"Simple wall (line) in 2D."},defaultProps:{color:p,texture:"none",width:m,a:{x:0,z:0},b:{x:1,z:0},openings:[]},getMain2DBounds:Ft,renderMain2DVector:({element:t,elements:e})=>{const n=mt(t,e),r=M(t.props.a,{x:t.position.x,z:t.position.z}),a=M(t.props.b,{x:t.position.x+1,z:t.position.z}),s=g(t.props.color,p),c=D(t.props.texture,"none"),u=n?.wall.width??Math.max(.04,f(t.props.width,m)),d=n?.wall.length??Math.max(.001,X(r,a)),h=n?.wall.direction??H(Z(a,r)),x=n?.wall.normal??Y(h),w=Wt(St(t.props.openings),d,3.2),y=Ct(d,w.map(t=>({start:t.start_m,end:t.end_m}))),_=Math.max(u/2,.09),b=i(l(s,"brick"===c?-.16:"concrete"===c?-.1:-.12),.98);return(0,o.jsxs)("g",{className:"mainVector2dWall",children:[y.map((t,e)=>{const a=Math.max(u/2,.02),i=n?ht(n,t.start,t.end):null,s=i?.points??It(r,h,x,a,t.start,t.end);return(0,o.jsx)("polygon",{points:Et(s),fill:b},`solid:${e}`)}),w.map(t=>{const e=At(r,h,t.start_m),n=At(r,h,t.end_m),a=V(e,U(x,_)),s=V(n,U(x,_)),c=V(n,U(x,-_)),d=V(e,U(x,-_)),p=function(t){const e=bt(t.kind)??"#cbd5e1",n=t.color??e,o=$t(t.kind,t.texture);if("window"===t.kind){if("transparent"===o)return{fill:"rgba(255,255,255,0.02)",stroke:i(l(n,-.08),.34),accent:"rgba(255,255,255,0.08)",highlight:"rgba(255,255,255,0.10)"};const t="glass"===o?n:"#b9d8f4";return{fill:i(t,.3),stroke:i(l(t,-.16),.56),accent:i(l(t,.34),.82),highlight:"rgba(255,255,255,0.38)"}}return"door"===t.kind?{fill:i(n,"wood"===o?.5:.38),stroke:i(l(n,-.28),.52),accent:i(l(n,.26),.42),highlight:"rgba(255,255,255,0.16)"}:{fill:"rgba(255,255,255,0.08)",stroke:i(n,.26),accent:i(l(n,.2),.22),highlight:"rgba(255,255,255,0.10)"}}(t),m=At(r,h,t.start_m+.18*t.width_m),f=At(r,h,t.end_m-.18*t.width_m);return(0,o.jsxs)("g",{className:`mainVector2dWallOpening mainVector2dWallOpening-${t.kind}`,children:[(0,o.jsx)("polygon",{points:Et([a,s,c,d]),fill:p.fill,stroke:p.stroke,strokeWidth:.018,vectorEffect:"non-scaling-stroke"}),(0,o.jsx)("line",{x1:m.x,y1:m.z,x2:f.x,y2:f.z,stroke:p.accent,strokeWidth:Math.max(.008,"window"===t.kind?.32*u:.18*u),strokeLinecap:"round"}),"window"===t.kind?(0,o.jsx)("line",{x1:V(m,U(x,.46*-_)).x,y1:V(m,U(x,.46*-_)).z,x2:V(f,U(x,.46*-_)).x,y2:V(f,U(x,.46*-_)).z,stroke:p.highlight,strokeWidth:.01,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"}):null]},t.id)})]})},create3D:({THREE:t,view:e,elements:n},o)=>{const r=new t.Group,a=new t.Group,i=new t.Group,s=new t.Group,l=new t.Group;a.add(i),a.add(s),a.add(l),r.add(a);const c=new t.MeshStandardMaterial({color:p,roughness:.82,metalness:.05,flatShading:!0,side:t.DoubleSide}),u=new t.MeshStandardMaterial({color:p,roughness:.86,metalness:.04,flatShading:!0,side:t.DoubleSide}),d=new t.MeshBasicMaterial({color:"#000000",transparent:!0,opacity:0,depthWrite:!1});d.colorWrite=!1;let h="",x=n;function w(n,o){x=o?.elements??x;const r=mt(n,x),w=r?.wall.a??M(n.props.a,{x:n.position.x-.5,z:n.position.z}),y=r?.wall.b??M(n.props.b,{x:n.position.x+.5,z:n.position.z}),_=r?.wall.direction??H(Z(y,w)),b=r?.wall.normal??Y(_),v=r?.wall.width??Math.max(.04,f(n.props.width,m)),k=Math.max(.15,e.wallHeight),S=r?.wall.length??Math.max(.001,X(w,y)),j=g(n.props.color,p),W=D(n.props.texture,"none"),T=function(t,e){if("none"===e)return null;if("brick"===e){const e=P(t,"wall:brick",z,{size:256,anisotropy:4});return e.repeat.set(1,1),e}if("concrete"===e){const e=P(t,"wall:concrete",N,{size:256,anisotropy:4});return e.repeat.set(.5,.5),e}return null}(t,W);a.position.set(w.x-n.position.x,0,w.z-n.position.z),a.rotation.set(0,Math.atan2(-_.z,_.x),0);const C=Wt(St(n.props.openings),S,k),A=function(t,e,n){const o=[0,e];for(const t of n)o.push(Pt(t.y_min_m,0,e)),o.push(Pt(t.y_max_m,0,e));o.sort((t,e)=>t-e);const r=[];for(const t of o)(0===r.length||Math.abs(t-r[r.length-1])>1e-6)&&r.push(t);const a=[];for(let e=0;e<r.length-1;e++){const o=r[e],i=r[e+1];if(i-o<=1e-6)continue;const s=[];for(const t of n)t.y_min_m>=i-1e-6||t.y_max_m<=o+1e-6||s.push({start:t.start_m,end:t.end_m});const l=Ct(t,s);for(const t of l)t.end-t.start<=1e-6||a.push({x0:t.start,x1:t.end,y0:o,y1:i})}return a}(S,k,C),F=A.filter(t=>t.x1-t.x0>1e-6&&t.y1-t.y0>1e-6).map(t=>{const e=Math.max(v/2,.02),n=r?ht(r,t.x0,t.x1):null,o=n?.points??It(w,_,b,e,t.x0,t.x1);return{rect:t,localPoints:r?o.map(t=>function(t,e){const n=Z(e,t.a);return{x:nt(n,t.direction),z:nt(n,t.normal)}}(r.wall,t)):[{x:t.x0,z:e},{x:t.x1,z:e},{x:t.x1,z:-e},{x:t.x0,z:-e}]}}),E=JSON.stringify({length:Dt(S),thickness:Dt(v),height:Dt(k),footprint:F.map(t=>t.localPoints.map(t=>({x:Dt(t.x),z:Dt(t.z)}))),openings:C.map(t=>({id:t.id,kind:t.kind,start:Dt(t.start_m),end:Dt(t.end_m),y0:Dt(t.y_min_m),y1:Dt(t.y_max_m),color:t.color??"",texture:t.texture??""}))});if(E!==h){h=E,Gt(i,!1),Gt(s,!0),Gt(l,!1);for(const e of F){const n=Rt(t,e.localPoints,0+e.rect.y0,0+e.rect.y1),o=[c,u],r=new t.Mesh(n,o);r.castShadow=!0,r.receiveShadow=!0,i.add(r)}for(const e of C)"door"!==e.kind?"window"===e.kind&&Lt(t,s,e,v):qt(t,s,e,v);for(const e of C){const n=e.y_max_m-e.y_min_m;if(e.width_m<=.08||n<=.08)continue;const o=new t.BoxGeometry(e.width_m,n,1.06*v),r=new t.Mesh(o,d);r.userData.__toposyncAllowPickWhenGhostWalls=!0,r.position.set(e.center_m,0+e.y_min_m+n/2,0),r.castShadow=!1,r.receiveShadow=!1,l.add(r)}}c.color.set(j),u.color.set(j),c.map!==T&&(c.map=T,c.needsUpdate=!0),c.roughness="brick"===W?.9:.82,c.metalness="brick"===W?.02:.05}return w(o),{object:r,update:w,dispose:()=>{Gt(i,!1),Gt(s,!0),Gt(l,!1),c.dispose(),u.dispose(),d.dispose()}}},render2D:({ctx:t,element:e,elements:n,viewport:o})=>{const r=mt(e,n),a=M(e.props.a,{x:e.position.x,z:e.position.z}),i=M(e.props.b,{x:e.position.x+1,z:e.position.z}),s=g(e.props.color,p),l=r?.wall.width??Math.max(.04,f(e.props.width,m)),c=r?.wall.length??Math.max(.001,X(a,i)),u=r?.wall.direction??H(Z(i,a)),d=r?.wall.normal??Y(u),h=Wt(St(e.props.openings),c,3.2),x=Ct(c,h.map(t=>({start:t.start_m,end:t.end_m})));t.save(),t.lineJoin="miter";for(const e of x){const n=Math.max(l/2,.02),i=r?ht(r,e.start,e.end):null,c=(i?.points??It(a,u,d,n,e.start,e.end)).map(t=>o.worldToScreen(t));t.beginPath(),t.moveTo(c[0].x,c[0].y);for(let e=1;e<c.length;e+=1)t.lineTo(c[e].x,c[e].y);t.closePath(),t.strokeStyle="rgba(0,0,0,0.35)",t.lineWidth=3,t.stroke(),t.fillStyle=s,t.fill()}const w=Math.max(l/2,.09);for(const e of h){const n=At(a,u,e.start_m),r=At(a,u,e.end_m),i=o.worldToScreen(V(n,U(d,w))),s=o.worldToScreen(V(r,U(d,w))),l=o.worldToScreen(V(r,U(d,-w))),c=o.worldToScreen(V(n,U(d,-w))),p=Ot(e.kind);t.beginPath(),t.moveTo(i.x,i.y),t.lineTo(s.x,s.y),t.lineTo(l.x,l.y),t.lineTo(c.x,c.y),t.closePath(),t.fillStyle=p.fill,t.fill(),t.strokeStyle=p.stroke,t.lineWidth=1.8,t.setLineDash(p.dash),t.stroke(),t.setLineDash([])}t.restore()},hitTest2D:({element:t,world:e,viewport:n})=>{const o=M(t.props.a,{x:t.position.x,z:t.position.z}),r=M(t.props.b,{x:t.position.x+1,z:t.position.z}),a=Math.max(.04,f(t.props.width,m)),i=Math.max(a/2,.09,10/Math.max(1,n.scale));return function(t,e,n){const o=Z(n,e),r=Z(t,e),a=o.x*o.x+o.z*o.z;return a<=1e-9?Math.hypot(r.x,r.z):X(t,V(e,U(o,Pt((r.x*o.x+r.z*o.z)/a,0,1))))}(e,o,r)<=i},renderEditorModal:({element:t,update:n,remove:r,close:a})=>(0,o.jsx)(Kt,{element:t,update:n,remove:r,close:a,i18n:e})})),t.registerElementType(R(t.i18n)),t.registerElementType(L(t.i18n));for(const e of(t.i18n,[{id:"com.toposync.structural.tool.wall",name:{key:"ext.structural.tools.wall",fallback:"Wall"},icon:"grip-lines",group:Xt,order:10,createSession:t=>{let e=null,n=null,o=0;function r(){e=null,n=null}function a(e){if(e.altKey)return e.rawWorld;const n=Math.max(.08,o>0?12/o:0),r=function(t,e,n,o={}){const r=Math.max(0,n);let a=null;for(const n of pt(t))if(!o.excludeElementId||n.elementId!==o.excludeElementId)for(const t of["a","b"]){const o=tt(n,t),i=X(e,o);i>r||(!a||i<a.distance)&&(a={elementId:n.elementId,endpoint:t,point:o,distance:i})}return a}(t.getElements(),e.rawWorld,n);return r?.point??e.world}return{onPointerEvent:o=>{if("cancel"!==o.kind)if("move"!==o.kind){if("down"===o.kind&&0===o.button){if(!e){const t=a(o);return e=t,void(n=t)}var i;i=a(o),e&&(X(e,i)<.05||Zt(t,e,i),r())}}else e&&(n=a(o));else r()},onKeyDown:t=>{"Escape"===t.key&&r()},renderOverlay2D:({ctx:t,viewport:r})=>{if(o=r.scale,!e||!n)return;const a=r.worldToScreen(e),s=r.worldToScreen(n),l=Math.max(2,m*r.scale);t.save(),t.setLineDash([8,6]),t.lineCap="round",t.strokeStyle=i("#fbbf24",.85),t.lineWidth=l,t.beginPath(),t.moveTo(a.x,a.y),t.lineTo(s.x,s.y),t.stroke(),t.restore()},getCursor:()=>"crosshair"}}},oe(0,{kind:"door"}),oe(0,{kind:"window"}),oe(0,{kind:"opening"}),re(0,{withWalls:!0}),ie(0,{withWalls:!0}),re(0,{withWalls:!1}),ie(0,{withWalls:!1}),ae(),{id:"com.toposync.structural.tool.pool_polygon",name:{key:"ext.structural.tools.pool_polygon",fallback:"Freeform pool"},icon:"water",group:Vt,order:60,createSession:t=>{const e=[];let n=null;function o(){e.splice(0,e.length),n=null}function r(){if(e.length<3)return void o();const n=Ht(t,[...e]);n&&t.openEditor(n),o()}return{onPointerEvent:t=>{"cancel"!==t.kind?"move"!==t.kind?"dblclick"!==t.kind?"down"===t.kind&&0===t.button&&(function(t){if(e.length<3)return!1;const n=e[0];return X(t.world,n)<.22}(t)?r():(e.push(t.world),n=t.world)):r():n=t.world:o()},onKeyDown:t=>{"Escape"===t.key&&o(),"Enter"===t.key&&r(),("Backspace"===t.key||"Delete"===t.key)&&e.length>0&&e.pop()},renderOverlay2D:({ctx:t,viewport:o})=>{if(0===e.length)return;const r=e.map(t=>o.worldToScreen(t)),a=n?o.worldToScreen(n):null;if(t.save(),e.length>=2){t.beginPath(),t.moveTo(r[0].x,r[0].y);for(let e=1;e<r.length;e++)t.lineTo(r[e].x,r[e].y);a&&t.lineTo(a.x,a.y),t.strokeStyle=i("#38bdf8",.85),t.lineWidth=2,t.setLineDash([6,6]),t.stroke()}for(let n=0;n<r.length;n++){const o=r[n],a=0===n&&e.length>=3;t.beginPath(),t.arc(o.x,o.y,a?6:5,0,2*Math.PI),t.fillStyle=i(a?"#22c55e":"#38bdf8",.85),t.fill(),t.strokeStyle="rgba(0,0,0,0.35)",t.lineWidth=2,t.stroke()}t.restore()},getCursor:()=>"crosshair"}}}]))t.registerEditorTool(e)}},870(t,e,n){t.exports=n(94)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var structural;(()=>{"use strict";var e,r,t,n,o,a,i,u,s,l,c,p,d,f,h,v={863(e,r,t){var n={"./activate":()=>t.e(449).then(()=>()=>t(449))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},g={};function m(e){var r=g[e];if(void 0!==r)return r.exports;var t=g[e]={exports:{}};return v[e](t,t.exports,m),t.exports}m.m=v,m.c=g,m.d=(e,r)=>{for(var t in r)m.o(r,t)&&!m.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},m.f={},m.e=e=>Promise.all(Object.keys(m.f).reduce((r,t)=>(m.f[t](e,r),r),[])),m.u=e=>e+".js",m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="@toposync/extension-structural-ui:",m.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,u;if(void 0!==o)for(var s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var c=s[l];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==r+o){i=c;break}}i||(u=!0,(i=document.createElement("script")).charset="utf-8",m.nc&&i.setAttribute("nonce",m.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var p=(r,n)=>{i.onerror=i.onload=null,clearTimeout(d);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(n)),r)return r(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),u&&document.head.appendChild(i)}},m.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{m.S={};var e={},r={};m.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];m.o(m.S,t)||(m.S[t]={});var a=m.S[t],i="@toposync/extension-structural-ui",u=[];return"default"===t&&((e,r,t,n)=>{var o=a[e]=a[e]||{},u=o[r];(!u||!u.loaded&&(1!=!u.eager?n:i>u.from))&&(o[r]={get:()=>m.e(326).then(()=>()=>m(326)),from:i,eager:!1})})("react","18.3.1"),e[t]=u.length?Promise.all(u).then(()=>e[t]=1):1}}})(),(()=>{var e;m.g.importScripts&&(e=m.g.location+"");var r=m.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),m.p=e})(),t=e=>{var r=e=>e.split(".").map(e=>+e==e?+e:e),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],u=(typeof i)[0];if(a!=u)return"o"==a&&"n"==u||"s"==u||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=(e,r)=>e&&m.o(e,r),a=e=>(e.loaded=1,e.get()),i=e=>Object.keys(e).reduce((r,t)=>(e[t].eager&&(r[t]=e[t]),r),{}),u=(e,r,t)=>{var o=t?i(e[r]):e[r];return Object.keys(o).reduce((e,r)=>!e||!o[e].loaded&&n(e,r)?r:e,0)},s=e=>{throw new Error(e)},l=(e,r,t)=>t?t():((e,r)=>s("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),c=(e=>function(r,t,n,o,a){var i=m.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,m.S[r],t,!1,o,a)):e(r,m.S[r],t,n,o)})((e,r,t,n,i)=>{if(!o(r,t))return l(e,t,i);var s=u(r,t,n);return a(r[t][s])}),p={},d={496:()=>c("default","react",!1,()=>m.e(326).then(()=>()=>m(326)))},f={449:[496]},h={},m.f.consumes=(e,r)=>{m.o(f,e)&&f[e].forEach(e=>{if(m.o(p,e))return r.push(p[e]);if(!h[e]){var t=r=>{p[e]=0,m.m[e]=t=>{delete m.c[e],t.exports=r()}};h[e]=!0;var n=r=>{delete p[e],m.m[e]=t=>{throw delete m.c[e],r}};try{var o=d[e]();o.then?r.push(p[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}})},(()=>{var e={870:0};m.f.j=(r,t)=>{var n=m.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var a=m.p+m.u(r),i=new Error;m.l(a,t=>{if(m.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,u]=t,s=0;if(a.some(r=>0!==e[r])){for(n in i)m.o(i,n)&&(m.m[n]=i[n]);u&&u(m)}for(r&&r(t);s<a.length;s++)o=a[s],m.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunk_toposync_extension_structural_ui=self.webpackChunk_toposync_extension_structural_ui||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var b=m(863);structural=b})();
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "webpack --mode production"
|
|
6
|
+
"build": "webpack --mode production",
|
|
7
|
+
"test:wall-geometry": "rm -rf .test-dist && tsc -p tsconfig.wall-geometry-test.json && node --test .test-dist/wallGeometry.test.js && rm -rf .test-dist"
|
|
7
8
|
},
|
|
8
9
|
"dependencies": {
|
|
9
10
|
"@toposync/plugin-api": "^0.3.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ToposyncHost } from "@toposync/plugin-api";
|
|
2
2
|
|
|
3
3
|
import { createAreaElementType } from "./elements/AreaElementType";
|
|
4
4
|
import { createPoolElementType } from "./elements/PoolElementType";
|
|
@@ -6,7 +6,7 @@ import { createWallElementType } from "./elements/WallElementType";
|
|
|
6
6
|
import { createStructuralTools } from "./tools/structuralTools";
|
|
7
7
|
import { structuralTranslations } from "./translations";
|
|
8
8
|
|
|
9
|
-
export function activate(host:
|
|
9
|
+
export function activate(host: ToposyncHost): void {
|
|
10
10
|
host.i18n.registerTranslations(structuralTranslations);
|
|
11
11
|
host.registerElementType(createWallElementType(host.i18n));
|
|
12
12
|
host.registerElementType(createAreaElementType(host.i18n));
|