@ifc-lite/viewer 1.18.0 → 1.19.1
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/.turbo/turbo-build.log +19 -16
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +444 -0
- package/dist/assets/basketViewActivator-CA2CTcVo.js +71 -0
- package/dist/assets/{bcf-DOG9_WPX.js → bcf-4K724hw0.js} +18 -18
- package/dist/assets/decode-worker-Collf_X_.js +1320 -0
- package/dist/assets/{exporters-B_OBqIyD.js → exporters-xbXqEDlO.js} +2547 -1958
- package/dist/assets/{geometry.worker-xHHy-9DV.js → geometry.worker-DQEZB2rB.js} +1 -1
- package/dist/assets/ids-2WdONLlu.js +2033 -0
- package/dist/assets/ifc-lite_bg-4yUkDRD8.wasm +0 -0
- package/dist/assets/index-BXeEKqJG.css +1 -0
- package/dist/assets/{index-BKq-M3Mk.js → index-D8Epw-e7.js} +51781 -32599
- package/dist/assets/index-XwKzDuw6.js +22 -0
- package/dist/assets/{native-bridge-SHXiQwFW.js → native-bridge-DKmx1z95.js} +2 -2
- package/dist/assets/{sandbox-jez21HtV.js → sandbox-tccwm5Bo.js} +1402 -1329
- package/dist/assets/{server-client-ncOQVNso.js → server-client-LoWPK1N2.js} +1 -1
- package/dist/assets/three-CDRZThFA.js +4057 -0
- package/dist/assets/{wasm-bridge-DyfBSB8z.js → wasm-bridge-BsJGgPMs.js} +1 -1
- package/dist/index.html +8 -7
- package/dist/samples/building-architecture.ifc +453 -0
- package/dist/samples/hello-wall.ifc +1054 -0
- package/dist/samples/infra-bridge.ifc +962 -0
- package/package.json +13 -7
- package/public/samples/building-architecture.ifc +453 -0
- package/public/samples/hello-wall.ifc +1054 -0
- package/public/samples/infra-bridge.ifc +962 -0
- package/src/App.tsx +37 -3
- package/src/components/mcp/HeroScene.tsx +876 -0
- package/src/components/mcp/McpLanding.tsx +1318 -0
- package/src/components/mcp/McpPlayground.tsx +524 -0
- package/src/components/mcp/PlaygroundChat.tsx +1097 -0
- package/src/components/mcp/PlaygroundViewer.tsx +815 -0
- package/src/components/mcp/README.md +171 -0
- package/src/components/mcp/data.ts +659 -0
- package/src/components/mcp/playground-dispatcher.ts +1649 -0
- package/src/components/mcp/playground-files.ts +107 -0
- package/src/components/mcp/playground-uploads.ts +122 -0
- package/src/components/mcp/types.ts +65 -0
- package/src/components/mcp/use-mcp-page.ts +109 -0
- package/src/components/viewer/MainToolbar.tsx +23 -2
- package/src/components/viewer/PointCloudPanel.tsx +174 -0
- package/src/components/viewer/Viewport.tsx +18 -1
- package/src/components/viewer/ViewportContainer.tsx +78 -9
- package/src/components/viewer/ViewportOverlays.tsx +13 -2
- package/src/components/viewer/tools/AddElementOverlay.tsx +43 -2
- package/src/components/viewer/usePointCloudLifecycle.ts +64 -0
- package/src/components/viewer/usePointCloudSync.ts +98 -0
- package/src/generated/mcp-catalog.json +82 -0
- package/src/hooks/ingest/pointCloudIngest.ts +391 -0
- package/src/hooks/ingest/viewerModelIngest.ts +32 -3
- package/src/hooks/useIfcFederation.ts +72 -3
- package/src/hooks/useIfcLoader.ts +67 -3
- package/src/services/file-dialog.ts +4 -2
- package/src/store/index.ts +10 -1
- package/src/store/slices/pointCloudSlice.ts +102 -0
- package/src/store/types.ts +7 -0
- package/vite.config.ts +7 -0
- package/dist/assets/basketViewActivator-Cm1QEk_R.js +0 -1
- package/dist/assets/ids-DQ5jY0E8.js +0 -1
- package/dist/assets/ifc-lite_bg-ADjKXSms.wasm +0 -0
- package/dist/assets/index-COnQRuqY.css +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{J as Y}from"./zip-DBEtpeu6.js";function j(t){if(!t||typeof t!="string")return t;let e="",i=0;for(;i<t.length;){if(t[i]!=="\\"){e+=t[i],i+=1;continue}if(t[i+1]==="P"&&t[i+3]==="\\"){i+=4;continue}if(t[i+1]==="S"&&t[i+2]==="\\"&&i+3<t.length){e+=String.fromCharCode(t.charCodeAt(i+3)+128),i+=4;continue}if(t[i+1]==="X"&&t[i+2]==="\\"&&i+5<=t.length){const n=t.slice(i+3,i+5);if(/^[0-9A-Fa-f]{2}$/.test(n)){e+=String.fromCharCode(parseInt(n,16)),i+=5;continue}}if(t.startsWith("\\X2\\",i)){const n=t.indexOf("\\X0\\",i+4);if(n!==-1){const o=t.slice(i+4,n);if(o.length%4===0&&/^[0-9A-Fa-f]+$/.test(o)){for(let s=0;s<o.length;s+=4)e+=String.fromCharCode(parseInt(o.slice(s,s+4),16));i=n+4;continue}}}if(t.startsWith("\\X4\\",i)){const n=t.indexOf("\\X0\\",i+4);if(n!==-1){const o=t.slice(i+4,n);if(o.length%8===0&&/^[0-9A-Fa-f]+$/.test(o)){for(let s=0;s<o.length;s+=8)e+=String.fromCodePoint(parseInt(o.slice(s,s+8),16));i=n+4;continue}}}e+=t[i],i+=1}return e}const M="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$";function nt(t){const e=t.replace(/-/g,"").toUpperCase();if(e.length!==32)throw new Error(`Invalid UUID: expected 32 hex characters, got ${e.length}`);const i=new Uint8Array(16);for(let o=0;o<16;o++)i[o]=parseInt(e.substring(o*2,o*2+2),16);let n="";n+=M[i[0]>>6&3],n+=M[i[0]&63];for(let o=1;o<16;o+=3){const s=i[o]||0,c=i[o+1]||0,r=i[o+2]||0;n+=M[s>>2&63],n+=M[(s&3)<<4|c>>4&15],n+=M[(c&15)<<2|r>>6&3],n+=M[r&63]}return n}function se(){return nt(C())}function C(){if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let i=0;i<16;i++)t[i]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e="";for(const i of t)e+=i.toString(16).padStart(2,"0");return`${e.substring(0,8)}-${e.substring(8,12)}-${e.substring(12,16)}-${e.substring(16,20)}-${e.substring(20,32)}`}const A={".T.":"True",".F.":"False",".U.":"Unknown"},X={IFCBOOLEAN:"Boolean",IFCLOGICAL:"Logical",IFCIDENTIFIER:"Identifier",IFCLABEL:"Label",IFCTEXT:"Text",IFCREAL:"Real",IFCINTEGER:"Integer",IFCPOSITIVELENGTHMEASURE:"Length",IFCLENGTHMEASURE:"Length",IFCAREAMEASURE:"Area",IFCVOLUMEMEASURE:"Volume",IFCMASSMEASURE:"Mass",IFCTHERMALTRANSMITTANCEMEASURE:"Thermal Transmittance",IFCPRESSUREMEASURE:"Pressure",IFCFORCEMEASURE:"Force",IFCPLANEANGLEMEASURE:"Angle",IFCTIMEMEASURE:"Time",IFCNORMALISEDRATIOMEASURE:"Ratio",IFCRATIOMEASURE:"Ratio",IFCPOSITIVERATIOMEASURE:"Ratio",IFCCOUNTMEASURE:"Count",IFCMONETARYMEASURE:"Currency"};function ot(t){if(t==null)return{displayValue:"—"};if(Array.isArray(t)&&t.length===2&&typeof t[0]=="string"){const[e,i]=t,n=e.toUpperCase(),o=X[n]||n.replace(/^IFC/,"");return{displayValue:ot(i).displayValue,ifcType:o}}if(typeof t=="string"){const e=t.toUpperCase();if(A[e])return{displayValue:A[e],ifcType:"Boolean"};const i=t.match(/^(IFC[A-Z0-9_]+),(.*)$/i);if(i){const[,n,o]=i,s=n.toUpperCase(),c=X[s]||s.replace(/^IFC/,"");if(!o||o.trim()==="")return{displayValue:"—",ifcType:c};const r=o.toUpperCase().trim();return A[r]?{displayValue:A[r],ifcType:c}:{displayValue:j(o),ifcType:c}}return{displayValue:j(t)}}return typeof t=="boolean"?{displayValue:t?"True":"False",ifcType:"Boolean"}:typeof t=="number"?{displayValue:Number.isInteger(t)?t.toLocaleString():t.toLocaleString(void 0,{maximumFractionDigits:6})}:{displayValue:String(t)}}async function ce(t){const e=await Y.loadAsync(t),i=await st(e),{projectId:n,name:o,extensions:s}=await ct(e),c=await at(e);return{version:i.versionId,projectId:n,name:o,topics:c,extensions:s}}async function st(t){const e=t.file("bcf.version");if(!e)throw new Error("Invalid BCF file: missing bcf.version");const n=(await e.async("string")).match(/VersionId="([^"]+)"/);if(!n)throw new Error("Invalid BCF version file: could not parse VersionId");const o=n[1];return o!=="2.1"&&o!=="3.0"&&console.warn(`Unsupported BCF version: ${o}, treating as 2.1`),{versionId:o==="3.0"?"3.0":"2.1",detailedVersion:n[1]}}async function ct(t){const e=t.file("project.bcfp");if(!e)return{};const i=await e.async("string"),n=i.match(/ProjectId="([^"]+)"/),o=i.match(/<Name>([^<]+)<\/Name>/);return{projectId:n?.[1],name:o?.[1]}}async function at(t){const e=new Map,i=new Set;t.forEach(n=>{const o=n.match(/^([^/]+)\/markup\.bcf$/i);o&&i.add(o[1])});for(const n of i)try{const o=await rt(t,n);o&&e.set(o.guid,o)}catch(o){console.warn(`Failed to parse topic ${n}:`,o)}return e}async function rt(t,e){const i=t.file(`${e}/markup.bcf`);if(!i)return null;const n=await i.async("string"),o=n.match(/<Topic\s+Guid="([^"]+)"[^>]*>([\s\S]*?)<\/Topic>/);if(!o)return console.warn(`Invalid markup.bcf in ${e}: missing Topic element`),null;const s=o[1],c=o[2],r=n.match(/<Topic[^>]*TopicType="([^"]+)"/),a=n.match(/<Topic[^>]*TopicStatus="([^"]+)"/),l=h(c,"Title")||"Untitled",p=h(c,"Description"),f=h(c,"Priority"),m=h(c,"Index"),u=h(c,"CreationDate")||new Date().toISOString(),g=h(c,"CreationAuthor")||"Unknown",d=h(c,"ModifiedDate"),x=h(c,"ModifiedAuthor"),w=h(c,"DueDate"),T=h(c,"AssignedTo"),S=h(c,"Stage"),v=[],K=c.matchAll(/<Labels>([^<]+)<\/Labels>/g);for(const z of K)v.push(z[1]);const Q=lt(c),O=pt(c),F=[],tt=c.matchAll(/<RelatedTopic\s+Guid="([^"]+)"/g);for(const z of tt)F.push(z[1]);const et=ft(n),it=await ut(t,e,n);return{guid:s,title:l,description:p,topicType:r?.[1],topicStatus:a?.[1],priority:f,index:m?parseInt(m,10):void 0,creationDate:u,creationAuthor:g,modifiedDate:d,modifiedAuthor:x,dueDate:w,assignedTo:T,stage:S,labels:v.length>0?v:void 0,bimSnippet:Q,documentReferences:O.length>0?O:void 0,relatedTopics:F.length>0?F:void 0,comments:et,viewpoints:it}}function h(t,e){return t.match(new RegExp(`<${e}>([^<]*)<\\/${e}>`))?.[1]}function lt(t){const e=t.match(/<BimSnippet\s+SnippetType="([^"]+)"[^>]*>([\s\S]*?)<\/BimSnippet>/);if(!e)return;const i=e[0].match(/isExternal="([^"]+)"/),n=h(e[2],"Reference"),o=h(e[2],"ReferenceSchema");return{snippetType:e[1],isExternal:i?.[1]==="true",reference:n||"",referenceSchema:o}}function pt(t){const e=[],i=t.matchAll(/<DocumentReference[^>]*>([\s\S]*?)<\/DocumentReference>/g);for(const n of i){const o=n[0].match(/Guid="([^"]+)"/),s=n[0].match(/isExternal="([^"]+)"/),c=h(n[1],"ReferencedDocument"),r=h(n[1],"Description");c&&e.push({guid:o?.[1],isExternal:s?.[1]==="true",referencedDocument:c,description:r})}return e}function ft(t){const e=[],i=t.matchAll(/<Comment\s+Guid="([^"]+)"[^>]*>([\s\S]*?)<\/Comment>/g);for(const n of i){const o=n[1],s=n[2],c=h(s,"Date")||new Date().toISOString(),r=h(s,"Author")||"Unknown",a=h(s,"Comment")||"",l=h(s,"ModifiedDate"),p=h(s,"ModifiedAuthor"),f=s.match(/<Viewpoint\s+Guid="([^"]+)"/);e.push({guid:o,date:c,author:r,comment:a,viewpointGuid:f?.[1],modifiedDate:l,modifiedAuthor:p})}return e}async function ut(t,e,i){const n=[],o=new Map,s=/<Viewpoint\s+Guid="([^"]+)"[^>]*>([\s\S]*?)<\/Viewpoint>/g;for(const a of i.matchAll(s)){const l=a[1],p=a[2],f=p.match(/<Viewpoint>([^<]+)<\/Viewpoint>/),m=p.match(/<Snapshot>([^<]+)<\/Snapshot>/);o.set(l,{viewpointFile:f?.[1],snapshotFile:m?.[1]})}const c=i.matchAll(/<Viewpoint\s+Guid="([^"]+)"[^>]*\/>/g);for(const a of c)o.has(a[1])||o.set(a[1],{});const r=[];t.forEach(a=>{a.startsWith(`${e}/`)&&a.endsWith(".bcfv")&&r.push(a)});for(const a of r)try{const l=t.file(a);if(!l)continue;const p=await l.async("string"),f=mt(p);if(f){const m=o.get(f.guid);let u=null,g="png";if(m?.snapshotFile){const d=`${e}/${m.snapshotFile}`;u=t.file(d),(m.snapshotFile.toLowerCase().endsWith(".jpg")||m.snapshotFile.toLowerCase().endsWith(".jpeg"))&&(g="jpeg")}if(!u){const d=a.replace(".bcfv",""),x=d.replace(/Viewpoint_/i,"Snapshot_"),w=d.replace(/_viewpoint$/i,"_snapshot"),T=[`${x}.png`,`${w}.png`,`${d}.png`,`${e}/snapshot.png`,`${x}.jpg`,`${w}.jpg`,`${d}.jpg`,`${e}/snapshot.jpg`];for(const S of T)if(u=t.file(S),u){(S.toLowerCase().endsWith(".jpg")||S.toLowerCase().endsWith(".jpeg"))&&(g="jpeg");break}}if(u){const d=await u.async("uint8array");f.snapshotData=d,f.snapshot=`data:image/${g};base64,${B(d)}`}n.push(f)}}catch(l){console.warn(`Failed to parse viewpoint ${a}:`,l)}if(n.length===0){const a=t.file(`${e}/snapshot.png`)||t.file(`${e}/snapshot.jpg`);if(a){const l=a.name.toLowerCase().endsWith(".jpg"),p=await a.async("uint8array");n.push({guid:e,snapshot:`data:image/${l?"jpeg":"png"};base64,${B(p)}`,snapshotData:p})}}return n}function mt(t){const i=t.match(/<VisualizationInfo[^>]+Guid="([^"]+)"/)?.[1]||crypto.randomUUID?.()||`vp-${Date.now()}`,n=dt(t),o=ht(t),s=gt(t),c=Ct(t),r=wt(t),a=St(t);return{guid:i,perspectiveCamera:n,orthogonalCamera:o,components:s,lines:c.length>0?c:void 0,clippingPlanes:r.length>0?r:void 0,bitmaps:a.length>0?a:void 0}}function dt(t){const e=t.match(/<PerspectiveCamera>([\s\S]*?)<\/PerspectiveCamera>/);if(!e)return;const i=e[1],n=V(i,"CameraViewPoint"),o=I(i,"CameraDirection"),s=I(i,"CameraUpVector"),c=h(i,"FieldOfView");if(!(!n||!o||!s||!c))return{cameraViewPoint:n,cameraDirection:o,cameraUpVector:s,fieldOfView:parseFloat(c)}}function ht(t){const e=t.match(/<OrthogonalCamera>([\s\S]*?)<\/OrthogonalCamera>/);if(!e)return;const i=e[1],n=V(i,"CameraViewPoint"),o=I(i,"CameraDirection"),s=I(i,"CameraUpVector"),c=h(i,"ViewToWorldScale");if(!(!n||!o||!s||!c))return{cameraViewPoint:n,cameraDirection:o,cameraUpVector:s,viewToWorldScale:parseFloat(c)}}function V(t,e){const i=t.match(new RegExp(`<${e}>([\\s\\S]*?)<\\/${e}>`));if(!i)return;const n=h(i[1],"X"),o=h(i[1],"Y"),s=h(i[1],"Z");if(!(n===void 0||o===void 0||s===void 0))return{x:parseFloat(n),y:parseFloat(o),z:parseFloat(s)}}function I(t,e){return V(t,e)}function gt(t){const e=t.match(/<Components>([\s\S]*?)<\/Components>/);if(!e)return;const i=e[1],n=Z(i,"Selection"),o=yt(i),s=xt(i);if(!(!n&&!o&&!s))return{selection:n?.length?n:void 0,visibility:o,coloring:s?.length?s:void 0}}function Z(t,e){const i=t.match(new RegExp(`<${e}>([\\s\\S]*?)<\\/${e}>`));if(!i)return;const n=[],o=i[1].matchAll(/<Component[^>]*(?:\/>|>[\s\S]*?<\/Component>)/g);for(const s of o){const c=H(s[0]);c&&n.push(c)}return n.length>0?n:void 0}function H(t){const e=t.match(/IfcGuid="([^"]+)"/),i=t.match(/AuthoringToolId="([^"]+)"/),n=t.match(/OriginatingSystem="([^"]+)"/);if(!(!e&&!i))return{ifcGuid:e?.[1],authoringToolId:i?.[1],originatingSystem:n?.[1]}}function yt(t){const e=t.match(/<Visibility[^>]*>([\s\S]*?)<\/Visibility>/);if(!e)return;const n=t.match(/DefaultVisibility="([^"]+)"/)?.[1]!=="false",o=Z(e[1],"Exceptions");return{defaultVisibility:n,exceptions:o}}function xt(t){const e=t.match(/<Coloring>([\s\S]*?)<\/Coloring>/);if(!e)return;const i=[],n=e[1].matchAll(/<Color\s+Color="([^"]+)"[^>]*>([\s\S]*?)<\/Color>/g);for(const o of n){const s=o[1],c=[],r=o[2].matchAll(/<Component[^>]*(?:\/>|>[\s\S]*?<\/Component>)/g);for(const a of r){const l=H(a[0]);l&&c.push(l)}c.length>0&&i.push({color:s,components:c})}return i.length>0?i:void 0}function Ct(t){const e=[],i=t.match(/<Lines>([\s\S]*?)<\/Lines>/);if(!i)return e;const n=i[1].matchAll(/<Line>([\s\S]*?)<\/Line>/g);for(const o of n){const s=V(o[1],"StartPoint"),c=V(o[1],"EndPoint");s&&c&&e.push({startPoint:s,endPoint:c})}return e}function wt(t){const e=[],i=t.match(/<ClippingPlanes>([\s\S]*?)<\/ClippingPlanes>/);if(!i)return e;const n=i[1].matchAll(/<ClippingPlane>([\s\S]*?)<\/ClippingPlane>/g);for(const o of n){const s=V(o[1],"Location"),c=I(o[1],"Direction");s&&c&&e.push({location:s,direction:c})}return e}function St(t){const e=[],i=t.match(/<Bitmaps>([\s\S]*?)<\/Bitmaps>/);if(!i)return e;const n=i[1].matchAll(/<Bitmap>([\s\S]*?)<\/Bitmap>/g);for(const o of n){const s=h(o[1],"Format")||h(o[1],"Bitmap"),c=h(o[1],"Reference"),r=V(o[1],"Location"),a=I(o[1],"Normal"),l=I(o[1],"Up"),p=h(o[1],"Height");s&&c&&r&&a&&l&&p&&e.push({format:s.toUpperCase()==="JPG"?"JPG":"PNG",reference:c,location:r,normal:a,up:l,height:parseFloat(p)})}return e}function B(t){let e="";for(let i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return btoa(e)}async function ae(t){const e=new Y;$t(e,t.version),(t.projectId||t.name)&&bt(e,t);for(const[i,n]of t.topics)await Tt(e,n);return e.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}})}function $t(t,e){const i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
1
|
+
import{J as Y}from"./zip-DBEtpeu6.js";function j(t){if(!t||typeof t!="string")return t;let e="",i=0;for(;i<t.length;){if(t[i]!=="\\"){e+=t[i],i+=1;continue}if(t[i+1]==="P"&&t[i+3]==="\\"){i+=4;continue}if(t[i+1]==="S"&&t[i+2]==="\\"&&i+3<t.length){e+=String.fromCharCode(t.charCodeAt(i+3)+128),i+=4;continue}if(t[i+1]==="X"&&t[i+2]==="\\"&&i+5<=t.length){const n=t.slice(i+3,i+5);if(/^[0-9A-Fa-f]{2}$/.test(n)){e+=String.fromCharCode(parseInt(n,16)),i+=5;continue}}if(t.startsWith("\\X2\\",i)){const n=t.indexOf("\\X0\\",i+4);if(n!==-1){const o=t.slice(i+4,n);if(o.length%4===0&&/^[0-9A-Fa-f]+$/.test(o)){for(let s=0;s<o.length;s+=4)e+=String.fromCharCode(parseInt(o.slice(s,s+4),16));i=n+4;continue}}}if(t.startsWith("\\X4\\",i)){const n=t.indexOf("\\X0\\",i+4);if(n!==-1){const o=t.slice(i+4,n);if(o.length%8===0&&/^[0-9A-Fa-f]+$/.test(o)){for(let s=0;s<o.length;s+=8)e+=String.fromCodePoint(parseInt(o.slice(s,s+8),16));i=n+4;continue}}}e+=t[i],i+=1}return e}const M="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$";function nt(t){const e=t.replace(/-/g,"").toUpperCase();if(e.length!==32)throw new Error(`Invalid UUID: expected 32 hex characters, got ${e.length}`);const i=new Uint8Array(16);for(let o=0;o<16;o++)i[o]=parseInt(e.substring(o*2,o*2+2),16);let n="";n+=M[i[0]>>6&3],n+=M[i[0]&63];for(let o=1;o<16;o+=3){const s=i[o]||0,c=i[o+1]||0,r=i[o+2]||0;n+=M[s>>2&63],n+=M[(s&3)<<4|c>>4&15],n+=M[(c&15)<<2|r>>6&3],n+=M[r&63]}return n}function se(){return nt(C())}function C(){if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let i=0;i<16;i++)t[i]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e="";for(const i of t)e+=i.toString(16).padStart(2,"0");return`${e.substring(0,8)}-${e.substring(8,12)}-${e.substring(12,16)}-${e.substring(16,20)}-${e.substring(20,32)}`}const A={".T.":"True",".F.":"False",".U.":"Unknown"},X={IFCBOOLEAN:"Boolean",IFCLOGICAL:"Logical",IFCIDENTIFIER:"Identifier",IFCLABEL:"Label",IFCTEXT:"Text",IFCREAL:"Real",IFCINTEGER:"Integer",IFCPOSITIVELENGTHMEASURE:"Length",IFCLENGTHMEASURE:"Length",IFCAREAMEASURE:"Area",IFCVOLUMEMEASURE:"Volume",IFCMASSMEASURE:"Mass",IFCTHERMALTRANSMITTANCEMEASURE:"Thermal Transmittance",IFCPRESSUREMEASURE:"Pressure",IFCFORCEMEASURE:"Force",IFCPLANEANGLEMEASURE:"Angle",IFCTIMEMEASURE:"Time",IFCNORMALISEDRATIOMEASURE:"Ratio",IFCRATIOMEASURE:"Ratio",IFCPOSITIVERATIOMEASURE:"Ratio",IFCCOUNTMEASURE:"Count",IFCMONETARYMEASURE:"Currency"};function ot(t){if(t==null)return{displayValue:"—"};if(Array.isArray(t)&&t.length===2&&typeof t[0]=="string"){const[e,i]=t,n=e.toUpperCase(),o=X[n]||n.replace(/^IFC/,"");return{displayValue:ot(i).displayValue,ifcType:o}}if(typeof t=="string"){const e=t.toUpperCase();if(A[e])return{displayValue:A[e],ifcType:"Boolean"};const i=t.match(/^(IFC[A-Z0-9_]+),(.*)$/i);if(i){const[,n,o]=i,s=n.toUpperCase(),c=X[s]||s.replace(/^IFC/,"");if(!o||o.trim()==="")return{displayValue:"—",ifcType:c};const r=o.toUpperCase().trim();return A[r]?{displayValue:A[r],ifcType:c}:{displayValue:j(o),ifcType:c}}return{displayValue:j(t)}}return typeof t=="boolean"?{displayValue:t?"True":"False",ifcType:"Boolean"}:typeof t=="number"?{displayValue:Number.isInteger(t)?t.toLocaleString():t.toLocaleString(void 0,{maximumFractionDigits:6})}:{displayValue:String(t)}}async function ce(t){const e=await Y.loadAsync(t),i=await st(e),{projectId:n,name:o,extensions:s}=await ct(e),c=await at(e);return{version:i.versionId,projectId:n,name:o,topics:c,extensions:s}}async function st(t){const e=t.file("bcf.version");if(!e)throw new Error("Invalid BCF file: missing bcf.version");const n=(await e.async("string")).match(/VersionId="([^"]+)"/);if(!n)throw new Error("Invalid BCF version file: could not parse VersionId");const o=n[1];return o!=="2.1"&&o!=="3.0"&&console.warn(`Unsupported BCF version: ${o}, treating as 2.1`),{versionId:o==="3.0"?"3.0":"2.1",detailedVersion:n[1]}}async function ct(t){const e=t.file("project.bcfp");if(!e)return{};const i=await e.async("string"),n=i.match(/ProjectId="([^"]+)"/),o=i.match(/<Name>([^<]+)<\/Name>/);return{projectId:n?.[1],name:o?.[1]}}async function at(t){const e=new Map,i=new Set;t.forEach(n=>{const o=n.match(/^([^/]+)\/markup\.bcf$/i);o&&i.add(o[1])});for(const n of i)try{const o=await rt(t,n);o&&e.set(o.guid,o)}catch(o){console.warn(`Failed to parse topic ${n}:`,o)}return e}async function rt(t,e){const i=t.file(`${e}/markup.bcf`);if(!i)return null;const n=await i.async("string"),o=n.match(/<Topic\s+Guid="([^"]+)"[^>]*>([\s\S]*?)<\/Topic>/);if(!o)return console.warn(`Invalid markup.bcf in ${e}: missing Topic element`),null;const s=o[1],c=o[2],r=n.match(/<Topic[^>]*TopicType="([^"]+)"/),a=n.match(/<Topic[^>]*TopicStatus="([^"]+)"/),l=h(c,"Title")||"Untitled",p=h(c,"Description"),f=h(c,"Priority"),m=h(c,"Index"),u=h(c,"CreationDate")||new Date().toISOString(),g=h(c,"CreationAuthor")||"Unknown",d=h(c,"ModifiedDate"),x=h(c,"ModifiedAuthor"),w=h(c,"DueDate"),b=h(c,"AssignedTo"),S=h(c,"Stage"),v=[],K=c.matchAll(/<Labels>([^<]+)<\/Labels>/g);for(const z of K)v.push(z[1]);const Q=lt(c),O=pt(c),F=[],tt=c.matchAll(/<RelatedTopic\s+Guid="([^"]+)"/g);for(const z of tt)F.push(z[1]);const et=ft(n),it=await ut(t,e,n);return{guid:s,title:l,description:p,topicType:r?.[1],topicStatus:a?.[1],priority:f,index:m?parseInt(m,10):void 0,creationDate:u,creationAuthor:g,modifiedDate:d,modifiedAuthor:x,dueDate:w,assignedTo:b,stage:S,labels:v.length>0?v:void 0,bimSnippet:Q,documentReferences:O.length>0?O:void 0,relatedTopics:F.length>0?F:void 0,comments:et,viewpoints:it}}function h(t,e){return t.match(new RegExp(`<${e}>([^<]*)<\\/${e}>`))?.[1]}function lt(t){const e=t.match(/<BimSnippet\s+SnippetType="([^"]+)"[^>]*>([\s\S]*?)<\/BimSnippet>/);if(!e)return;const i=e[0].match(/isExternal="([^"]+)"/),n=h(e[2],"Reference"),o=h(e[2],"ReferenceSchema");return{snippetType:e[1],isExternal:i?.[1]==="true",reference:n||"",referenceSchema:o}}function pt(t){const e=[],i=t.matchAll(/<DocumentReference[^>]*>([\s\S]*?)<\/DocumentReference>/g);for(const n of i){const o=n[0].match(/Guid="([^"]+)"/),s=n[0].match(/isExternal="([^"]+)"/),c=h(n[1],"ReferencedDocument"),r=h(n[1],"Description");c&&e.push({guid:o?.[1],isExternal:s?.[1]==="true",referencedDocument:c,description:r})}return e}function ft(t){const e=[],i=t.matchAll(/<Comment\s+Guid="([^"]+)"[^>]*>([\s\S]*?)<\/Comment>/g);for(const n of i){const o=n[1],s=n[2],c=h(s,"Date")||new Date().toISOString(),r=h(s,"Author")||"Unknown",a=h(s,"Comment")||"",l=h(s,"ModifiedDate"),p=h(s,"ModifiedAuthor"),f=s.match(/<Viewpoint\s+Guid="([^"]+)"/);e.push({guid:o,date:c,author:r,comment:a,viewpointGuid:f?.[1],modifiedDate:l,modifiedAuthor:p})}return e}async function ut(t,e,i){const n=[],o=new Map,s=/<Viewpoint\s+Guid="([^"]+)"[^>]*>([\s\S]*?)<\/Viewpoint>/g;for(const a of i.matchAll(s)){const l=a[1],p=a[2],f=p.match(/<Viewpoint>([^<]+)<\/Viewpoint>/),m=p.match(/<Snapshot>([^<]+)<\/Snapshot>/);o.set(l,{viewpointFile:f?.[1],snapshotFile:m?.[1]})}const c=i.matchAll(/<Viewpoint\s+Guid="([^"]+)"[^>]*\/>/g);for(const a of c)o.has(a[1])||o.set(a[1],{});const r=[];t.forEach(a=>{a.startsWith(`${e}/`)&&a.endsWith(".bcfv")&&r.push(a)});for(const a of r)try{const l=t.file(a);if(!l)continue;const p=await l.async("string"),f=mt(p);if(f){const m=o.get(f.guid);let u=null,g="png";if(m?.snapshotFile){const d=`${e}/${m.snapshotFile}`;u=t.file(d),(m.snapshotFile.toLowerCase().endsWith(".jpg")||m.snapshotFile.toLowerCase().endsWith(".jpeg"))&&(g="jpeg")}if(!u){const d=a.replace(".bcfv",""),x=d.replace(/Viewpoint_/i,"Snapshot_"),w=d.replace(/_viewpoint$/i,"_snapshot"),b=[`${x}.png`,`${w}.png`,`${d}.png`,`${e}/snapshot.png`,`${x}.jpg`,`${w}.jpg`,`${d}.jpg`,`${e}/snapshot.jpg`];for(const S of b)if(u=t.file(S),u){(S.toLowerCase().endsWith(".jpg")||S.toLowerCase().endsWith(".jpeg"))&&(g="jpeg");break}}if(u){const d=await u.async("uint8array");f.snapshotData=d,f.snapshot=`data:image/${g};base64,${B(d)}`}n.push(f)}}catch(l){console.warn(`Failed to parse viewpoint ${a}:`,l)}if(n.length===0){const a=t.file(`${e}/snapshot.png`)||t.file(`${e}/snapshot.jpg`);if(a){const l=a.name.toLowerCase().endsWith(".jpg"),p=await a.async("uint8array");n.push({guid:e,snapshot:`data:image/${l?"jpeg":"png"};base64,${B(p)}`,snapshotData:p})}}return n}function mt(t){const i=t.match(/<VisualizationInfo[^>]+Guid="([^"]+)"/)?.[1]||crypto.randomUUID?.()||`vp-${Date.now()}`,n=dt(t),o=ht(t),s=gt(t),c=Ct(t),r=wt(t),a=St(t);return{guid:i,perspectiveCamera:n,orthogonalCamera:o,components:s,lines:c.length>0?c:void 0,clippingPlanes:r.length>0?r:void 0,bitmaps:a.length>0?a:void 0}}function dt(t){const e=t.match(/<PerspectiveCamera>([\s\S]*?)<\/PerspectiveCamera>/);if(!e)return;const i=e[1],n=V(i,"CameraViewPoint"),o=I(i,"CameraDirection"),s=I(i,"CameraUpVector"),c=h(i,"FieldOfView");if(!(!n||!o||!s||!c))return{cameraViewPoint:n,cameraDirection:o,cameraUpVector:s,fieldOfView:parseFloat(c)}}function ht(t){const e=t.match(/<OrthogonalCamera>([\s\S]*?)<\/OrthogonalCamera>/);if(!e)return;const i=e[1],n=V(i,"CameraViewPoint"),o=I(i,"CameraDirection"),s=I(i,"CameraUpVector"),c=h(i,"ViewToWorldScale");if(!(!n||!o||!s||!c))return{cameraViewPoint:n,cameraDirection:o,cameraUpVector:s,viewToWorldScale:parseFloat(c)}}function V(t,e){const i=t.match(new RegExp(`<${e}>([\\s\\S]*?)<\\/${e}>`));if(!i)return;const n=h(i[1],"X"),o=h(i[1],"Y"),s=h(i[1],"Z");if(!(n===void 0||o===void 0||s===void 0))return{x:parseFloat(n),y:parseFloat(o),z:parseFloat(s)}}function I(t,e){return V(t,e)}function gt(t){const e=t.match(/<Components>([\s\S]*?)<\/Components>/);if(!e)return;const i=e[1],n=Z(i,"Selection"),o=yt(i),s=xt(i);if(!(!n&&!o&&!s))return{selection:n?.length?n:void 0,visibility:o,coloring:s?.length?s:void 0}}function Z(t,e){const i=t.match(new RegExp(`<${e}>([\\s\\S]*?)<\\/${e}>`));if(!i)return;const n=[],o=i[1].matchAll(/<Component[^>]*(?:\/>|>[\s\S]*?<\/Component>)/g);for(const s of o){const c=H(s[0]);c&&n.push(c)}return n.length>0?n:void 0}function H(t){const e=t.match(/IfcGuid="([^"]+)"/),i=t.match(/AuthoringToolId="([^"]+)"/),n=t.match(/OriginatingSystem="([^"]+)"/);if(!(!e&&!i))return{ifcGuid:e?.[1],authoringToolId:i?.[1],originatingSystem:n?.[1]}}function yt(t){const e=t.match(/<Visibility[^>]*>([\s\S]*?)<\/Visibility>/);if(!e)return;const n=t.match(/DefaultVisibility="([^"]+)"/)?.[1]!=="false",o=Z(e[1],"Exceptions");return{defaultVisibility:n,exceptions:o}}function xt(t){const e=t.match(/<Coloring>([\s\S]*?)<\/Coloring>/);if(!e)return;const i=[],n=e[1].matchAll(/<Color\s+Color="([^"]+)"[^>]*>([\s\S]*?)<\/Color>/g);for(const o of n){const s=o[1],c=[],r=o[2].matchAll(/<Component[^>]*(?:\/>|>[\s\S]*?<\/Component>)/g);for(const a of r){const l=H(a[0]);l&&c.push(l)}c.length>0&&i.push({color:s,components:c})}return i.length>0?i:void 0}function Ct(t){const e=[],i=t.match(/<Lines>([\s\S]*?)<\/Lines>/);if(!i)return e;const n=i[1].matchAll(/<Line>([\s\S]*?)<\/Line>/g);for(const o of n){const s=V(o[1],"StartPoint"),c=V(o[1],"EndPoint");s&&c&&e.push({startPoint:s,endPoint:c})}return e}function wt(t){const e=[],i=t.match(/<ClippingPlanes>([\s\S]*?)<\/ClippingPlanes>/);if(!i)return e;const n=i[1].matchAll(/<ClippingPlane>([\s\S]*?)<\/ClippingPlane>/g);for(const o of n){const s=V(o[1],"Location"),c=I(o[1],"Direction");s&&c&&e.push({location:s,direction:c})}return e}function St(t){const e=[],i=t.match(/<Bitmaps>([\s\S]*?)<\/Bitmaps>/);if(!i)return e;const n=i[1].matchAll(/<Bitmap>([\s\S]*?)<\/Bitmap>/g);for(const o of n){const s=h(o[1],"Format")||h(o[1],"Bitmap"),c=h(o[1],"Reference"),r=V(o[1],"Location"),a=I(o[1],"Normal"),l=I(o[1],"Up"),p=h(o[1],"Height");s&&c&&r&&a&&l&&p&&e.push({format:s.toUpperCase()==="JPG"?"JPG":"PNG",reference:c,location:r,normal:a,up:l,height:parseFloat(p)})}return e}function B(t){let e="";for(let i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return btoa(e)}async function ae(t){const e=new Y;$t(e,t.version),(t.projectId||t.name)&&Tt(e,t);for(const[i,n]of t.topics)await bt(e,n);return e.generateAsync({type:"blob",compression:"DEFLATE",compressionOptions:{level:6}})}function $t(t,e){const i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<Version xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" VersionId="${e}">
|
|
3
3
|
<DetailedVersion>${e}</DetailedVersion>
|
|
4
|
-
</Version>`;t.file("bcf.version",i)}function
|
|
4
|
+
</Version>`;t.file("bcf.version",i)}function Tt(t,e){const i=e.projectId||C(),n=e.name?`
|
|
5
5
|
<Name>${y(e.name)}</Name>`:"",o=`<?xml version="1.0" encoding="UTF-8"?>
|
|
6
6
|
<ProjectExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
7
7
|
<Project ProjectId="${i}">${n}
|
|
8
8
|
</Project>
|
|
9
|
-
</ProjectExtension>`;t.file("project.bcfp",o)}async function
|
|
9
|
+
</ProjectExtension>`;t.file("project.bcfp",o)}async function bt(t,e){const i=t.folder(e.guid);if(i){vt(i,e);for(let n=0;n<e.viewpoints.length;n++){const o=e.viewpoints[n];await Vt(i,o)}}}function vt(t,e){let i=`<?xml version="1.0" encoding="UTF-8"?>
|
|
10
10
|
<Markup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
11
11
|
<Topic Guid="${e.guid}"${e.topicType?` TopicType="${y(e.topicType)}"`:""}${e.topicStatus?` TopicStatus="${y(e.topicStatus)}"`:""}>
|
|
12
12
|
<Title>${y(e.title)}</Title>`;if(e.description&&(i+=`
|
|
@@ -36,7 +36,7 @@ import{J as Y}from"./zip-DBEtpeu6.js";function j(t){if(!t||typeof t!="string")re
|
|
|
36
36
|
<ModifiedAuthor>${y(n.modifiedAuthor)}</ModifiedAuthor>`),i+=`
|
|
37
37
|
</Comment>`;i+=`
|
|
38
38
|
</Markup>`,t.file("markup.bcf",i)}async function Vt(t,e,i){const n=`Viewpoint_${e.guid}.bcfv`,o=`Snapshot_${e.guid}.png`;let s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
39
|
-
<VisualizationInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="${e.guid}">`;if(e.components&&(s+=It(e.components)),e.perspectiveCamera&&(s+=
|
|
39
|
+
<VisualizationInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="${e.guid}">`;if(e.components&&(s+=It(e.components)),e.perspectiveCamera&&(s+=Et(e.perspectiveCamera)),e.orthogonalCamera&&(s+=At(e.orthogonalCamera)),e.lines&&e.lines.length>0){s+=`
|
|
40
40
|
<Lines>`;for(const c of e.lines)s+=Dt(c);s+=`
|
|
41
41
|
</Lines>`}if(e.clippingPlanes&&e.clippingPlanes.length>0){s+=`
|
|
42
42
|
<ClippingPlanes>`;for(const c of e.clippingPlanes)s+=Ft(c);s+=`
|
|
@@ -46,21 +46,21 @@ import{J as Y}from"./zip-DBEtpeu6.js";function j(t){if(!t||typeof t!="string")re
|
|
|
46
46
|
</VisualizationInfo>`,t.file(n,s),e.snapshotData)t.file(o,e.snapshotData);else if(e.snapshot&&e.snapshot.startsWith("data:")){const c=e.snapshot.split(",")[1],r=atob(c),a=new Uint8Array(r.length);for(let l=0;l<r.length;l++)a[l]=r.charCodeAt(l);t.file(o,a)}}function It(t){let e=`
|
|
47
47
|
<Components>`;if(t.visibility?.viewSetupHints){const i=t.visibility.viewSetupHints;e+=`
|
|
48
48
|
<ViewSetupHints`,i.spacesVisible!==void 0&&(e+=` SpacesVisible="${i.spacesVisible}"`),i.spaceBoundariesVisible!==void 0&&(e+=` SpaceBoundariesVisible="${i.spaceBoundariesVisible}"`),i.openingsVisible!==void 0&&(e+=` OpeningsVisible="${i.openingsVisible}"`),e+="/>"}if(t.selection&&t.selection.length>0){e+=`
|
|
49
|
-
<Selection>`;for(const i of t.selection)e+=
|
|
49
|
+
<Selection>`;for(const i of t.selection)e+=U(i);e+=`
|
|
50
50
|
</Selection>`}if(e+=Mt(t.visibility),t.coloring&&t.coloring.length>0){e+=`
|
|
51
|
-
<Coloring>`;for(const i of t.coloring)e+=
|
|
51
|
+
<Coloring>`;for(const i of t.coloring)e+=Pt(i);e+=`
|
|
52
52
|
</Coloring>`}return e+=`
|
|
53
53
|
</Components>`,e}function Mt(t){let i=`
|
|
54
54
|
<Visibility DefaultVisibility="${t?.defaultVisibility??!0}">`;if(t?.exceptions&&t.exceptions.length>0){i+=`
|
|
55
|
-
<Exceptions>`;for(const n of t.exceptions)i+=
|
|
55
|
+
<Exceptions>`;for(const n of t.exceptions)i+=U(n," ");i+=`
|
|
56
56
|
</Exceptions>`}return i+=`
|
|
57
|
-
</Visibility>`,i}function
|
|
57
|
+
</Visibility>`,i}function U(t,e=" "){const i=t.originatingSystem||t.authoringToolId;let n=`
|
|
58
58
|
${e}<Component`;return t.ifcGuid&&(n+=` IfcGuid="${t.ifcGuid}"`),i?(n+=">",t.originatingSystem&&(n+=`
|
|
59
59
|
${e} <OriginatingSystem>${y(t.originatingSystem)}</OriginatingSystem>`),t.authoringToolId&&(n+=`
|
|
60
60
|
${e} <AuthoringToolId>${y(t.authoringToolId)}</AuthoringToolId>`),n+=`
|
|
61
|
-
${e}</Component>`):n+="/>",n}function
|
|
62
|
-
<Color Color="${t.color}">`;for(const i of t.components)e+=
|
|
63
|
-
</Color>`,e}function
|
|
61
|
+
${e}</Component>`):n+="/>",n}function Pt(t){let e=`
|
|
62
|
+
<Color Color="${t.color}">`;for(const i of t.components)e+=U(i," ");return e+=`
|
|
63
|
+
</Color>`,e}function Et(t){return`
|
|
64
64
|
<PerspectiveCamera>
|
|
65
65
|
<CameraViewPoint>
|
|
66
66
|
<X>${t.cameraViewPoint.x}</X>
|
|
@@ -140,11 +140,11 @@ ${e}</Component>`):n+="/>",n}function Et(t){let e=`
|
|
|
140
140
|
<Z>${t.up.z}</Z>
|
|
141
141
|
</Up>
|
|
142
142
|
<Height>${t.height}</Height>
|
|
143
|
-
</Bitmap>`}function y(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $(t){return{x:t.x,y:-t.z,z:t.y}}function b(t){return{x:t.x,y:t.z,z:-t.y}}function Lt(t){const e=$(t.position),i=$(t.target),n=$(t.up),o=i.x-e.x,s=i.y-e.y,c=i.z-e.z,r=Math.sqrt(o*o+s*s+c*c),a=r>1e-4?{x:o/r,y:s/r,z:c/r}:{x:0,y:1,z:0},l=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z),p=l>1e-4?{x:n.x/l,y:n.y/l,z:n.z/l}:{x:0,y:0,z:1},f=t.fov*180/Math.PI;return{cameraViewPoint:e,cameraDirection:a,cameraUpVector:p,fieldOfView:Math.max(1,Math.min(179,f))}}function Gt(t,e){const i=$(t.position),n=$(t.target),o=$(t.up),s=n.x-i.x,c=n.y-i.y,r=n.z-i.z,a=Math.sqrt(s*s+c*c+r*r),l=a>1e-4?{x:s/a,y:c/a,z:r/a}:{x:0,y:1,z:0},p=Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z),f=p>1e-4?{x:o.x/p,y:o.y/p,z:o.z/p}:{x:0,y:0,z:1};return{cameraViewPoint:i,cameraDirection:l,cameraUpVector:f,viewToWorldScale:e}}function Ut(t,e=10){const i={x:t.cameraViewPoint.x+t.cameraDirection.x*e,y:t.cameraViewPoint.y+t.cameraDirection.y*e,z:t.cameraViewPoint.z+t.cameraDirection.z*e},n=b(t.cameraViewPoint),o=b(i),s=b(t.cameraUpVector),c=t.fieldOfView*Math.PI/180;return{position:n,target:o,up:s,fov:c,isOrthographic:!1}}function kt(t,e=10){const i={x:t.cameraViewPoint.x+t.cameraDirection.x*e,y:t.cameraViewPoint.y+t.cameraDirection.y*e,z:t.cameraViewPoint.z+t.cameraDirection.z*e},n=b(t.cameraViewPoint),o=b(i),s=b(t.cameraUpVector);return{position:n,target:o,up:s,fov:Math.PI/4,isOrthographic:!0,orthoScale:t.viewToWorldScale}}function Rt(t,e){if(!t.enabled)return null;const i=t.position/100;let n,o;switch(t.axis){case"down":n={x:(e.min.x+e.max.x)/2,y:e.min.y+i*(e.max.y-e.min.y),z:(e.min.z+e.max.z)/2},o=t.flipped?{x:0,y:1,z:0}:{x:0,y:-1,z:0};break;case"front":n={x:(e.min.x+e.max.x)/2,y:(e.min.y+e.max.y)/2,z:e.min.z+i*(e.max.z-e.min.z)},o=t.flipped?{x:0,y:0,z:1}:{x:0,y:0,z:-1};break;case"side":n={x:e.min.x+i*(e.max.x-e.min.x),y:(e.min.y+e.max.y)/2,z:(e.min.z+e.max.z)/2},o=t.flipped?{x:1,y:0,z:0}:{x:-1,y:0,z:0};break}return{location:$(n),direction:$(o)}}function Ot(t,e){const i=b(t.location),n=b(t.direction),o=Math.abs(n.x),s=Math.abs(n.y),c=Math.abs(n.z);let r,a,l;if(s>=o&&s>=c){r="down";const p=e.max.y-e.min.y;a=p>0?(i.y-e.min.y)/p*100:50,l=n.y>0}else if(c>=o){r="front";const p=e.max.z-e.min.z;a=p>0?(i.z-e.min.z)/p*100:50,l=n.z>0}else{r="side";const p=e.max.x-e.min.x;a=p>0?(i.x-e.min.x)/p*100:50,l=n.x>0}return a=Math.max(0,Math.min(100,a)),{axis:r,position:a,enabled:!0,flipped:l}}function re(t){const{camera:e,sectionPlane:i,bounds:n,snapshot:o,snapshotData:s,selectedGuids:c,hiddenGuids:r,visibleGuids:a,coloredGuids:l}=t,p={guid:C()};if(e.isOrthographic&&e.orthoScale!==void 0?p.orthogonalCamera=Gt(e,e.orthoScale):p.perspectiveCamera=Lt(e),i?.enabled&&n){const d=Rt(i,n);d&&(p.clippingPlanes=[d])}o&&(p.snapshot=o),s&&(p.snapshotData=s);const f=c&&c.length>0,m=r&&r.length>0,u=a&&a.length>0,g=l&&l.length>0;return(f||m||u||g)&&(p.components={},f&&(p.components.selection=c.map(d=>({ifcGuid:d}))),u?p.components.visibility={defaultVisibility:!1,exceptions:a.map(d=>({ifcGuid:d}))}:m&&(p.components.visibility={defaultVisibility:!0,exceptions:r.map(d=>({ifcGuid:d}))}),g&&(p.components.coloring=l.map(({color:d,guids:x})=>({color:d,components:x.map(w=>({ifcGuid:w}))})))),p}function le(t,e,i=10){let n,o;t.perspectiveCamera?n=Ut(t.perspectiveCamera,i):t.orthogonalCamera&&(n=kt(t.orthogonalCamera,i)),t.clippingPlanes&&t.clippingPlanes.length>0&&e&&(o=Ot(t.clippingPlanes[0],e));const s=[];if(t.components?.selection)for(const l of t.components.selection)l.ifcGuid&&s.push(l.ifcGuid);const c=[],r=[];if(t.components?.visibility){const{defaultVisibility:l,exceptions:p}=t.components.visibility;if(p)for(const f of p)f.ifcGuid&&(l===!1?r.push(f.ifcGuid):c.push(f.ifcGuid))}const a=[];if(t.components?.coloring)for(const l of t.components.coloring){const p=[];for(const f of l.components)f.ifcGuid&&p.push(f.ifcGuid);p.length>0&&a.push({color:l.color,guids:p})}return{camera:n,sectionPlane:o,selectedGuids:s,hiddenGuids:c,visibleGuids:r,coloredGuids:a}}function G(t){return{x:t.x,y:t.z,z:-t.y}}function jt(t,e){const i=t.perspectiveCamera??t.orthogonalCamera;if(!i)return null;const n=G(i.cameraViewPoint),o=G(i.cameraDirection),s=Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z);if(s<1e-6)return null;const c=o.x/s,r=o.y/s,a=o.z/s;return{x:n.x+c*e,y:n.y+r*e,z:n.z+a*e}}function N(t){const e=(t.min.x+t.max.x)/2,i=(t.min.z+t.max.z)/2,n=t.max.y,o=t.max.y-t.min.y,s=Math.max(o*.3,.5);return{position:{x:e,y:n+s,z:i},connectorAnchor:{x:e,y:n,z:i}}}function Xt(t,e,i){const n=t.components?.selection;if(n&&n.length>0)for(const r of n){if(!r.ifcGuid)continue;const a=e(r.ifcGuid);if(a)return{...N(a),source:"component"}}const o=t.components?.visibility;if(o&&!o.defaultVisibility&&o.exceptions&&o.exceptions.length>0)for(const r of o.exceptions){if(!r.ifcGuid)continue;const a=e(r.ifcGuid);if(a)return{...N(a),source:"component"}}const s=jt(t,i);if(s)return{position:s,source:"camera-target"};const c=t.perspectiveCamera??t.orthogonalCamera;return c?{position:G(c.cameraViewPoint),source:"camera-position"}:null}function pe(t,e,i){const{targetDistance:n=50,statusFilter:o}=i??{},s=[];for(let c=0;c<t.length;c++){const r=t[c];if(o&&o.length>0){const p=(r.topicStatus??"").toLowerCase();if(!o.some(f=>f.toLowerCase()===p))continue}let a=null;for(const p of r.viewpoints)if(a=Xt(p,e,n),a)break;if(!a)continue;const l=r.viewpoints[0];s.push({topicGuid:r.guid,position:a.position,connectorAnchor:a.connectorAnchor,title:r.title,status:r.topicStatus??"Open",priority:r.priority??"Normal",topicType:r.topicType??"Issue",commentCount:r.comments.length,hasViewpoint:r.viewpoints.length>0,snapshot:l?.snapshot,positionSource:a.source,index:r.index??c+1})}return s}const L="bcf-overlay-marker",_="bcf-overlay-connector",E="bcf-overlay-active",P="bcf-overlay-tooltip",Bt={high:"#f7768e",critical:"#f7768e",medium:"#ff9e64",normal:"#ff9e64",low:"#9ece6a"},Nt={open:"●","in progress":"◐",resolved:"✓",closed:"○"};class U{container;svgLayer;markerElements=new Map;connectorElements=new Map;markers=[];activeMarkerId=null;projection;unsubCamera=null;clickCallbacks=[];hoverCallbacks=[];opts;_visible=!0;_disposed=!1;constructor(e,i,n){this.projection=i,this.opts={showConnectors:n?.showConnectors??!0,showTooltips:n?.showTooltips??!0,minScale:n?.minScale??.65,maxScale:n?.maxScale??1,verticalOffset:n?.verticalOffset??36},this.container=document.createElement("div"),this.container.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:20;",e.appendChild(this.container),this.svgLayer=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svgLayer.style.cssText="position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;",this.container.appendChild(this.svgLayer),this.injectStyles(),this.unsubCamera=i.onCameraChange(()=>this.updatePositions())}setMarkers(e){this.markers=e;const i=new Set(e.map(n=>n.topicGuid));for(const[n,o]of this.markerElements)i.has(n)||(o.remove(),this.markerElements.delete(n));for(const[n,o]of this.connectorElements)i.has(n)||(o.remove(),this.connectorElements.delete(n));for(const n of e)this.markerElements.has(n.topicGuid)?this.updateMarkerContent(n):this.createMarkerElement(n);this.updatePositions()}setActiveMarker(e){if(this.activeMarkerId){const i=this.markerElements.get(this.activeMarkerId);i&&i.classList.remove(E)}if(this.activeMarkerId=e,e){const i=this.markerElements.get(e);i&&i.classList.add(E)}}setVisible(e){this._visible=e,this.container.style.display=e?"":"none"}onMarkerClick(e){return this.clickCallbacks.push(e),()=>{this.clickCallbacks=this.clickCallbacks.filter(i=>i!==e)}}onMarkerHover(e){return this.hoverCallbacks.push(e),()=>{this.hoverCallbacks=this.hoverCallbacks.filter(i=>i!==e)}}updatePositions(){if(this._disposed||!this._visible)return;const{width:e,height:i}=this.projection.getCanvasSize();if(e===0||i===0)return;const n=this.projection.getCameraPosition?.();for(const o of this.markers){const s=this.markerElements.get(o.topicGuid);if(!s)continue;const c=this.projection.projectToScreen(o.position);if(!c||c.x<-80||c.y<-80||c.x>e+80||c.y>i+80){s.style.display="none";const f=this.connectorElements.get(o.topicGuid);f&&(f.style.display="none");continue}s.style.display="";let r=1;if(n){const f=o.position.x-n.x,m=o.position.y-n.y,u=o.position.z-n.z,g=Math.sqrt(f*f+m*m+u*u),d=Math.max(0,Math.min(1,(g-20)/180));r=this.opts.maxScale+d*(this.opts.minScale-this.opts.maxScale)}const a=c.x,l=c.y;s.style.transform=`translate(${a}px, ${l}px) translate(-50%, -100%) scale(${r.toFixed(3)})`;const p=n?.6+(1-Math.max(0,Math.min(1,(Math.sqrt((o.position.x-n.x)**2+(o.position.y-n.y)**2+(o.position.z-n.z)**2)-20)/250)))*.4:1;if(s.style.opacity=p.toFixed(2),this.opts.showConnectors){const f=o.connectorAnchor??o.position,m=this.projection.projectToScreen(f);let u=this.connectorElements.get(o.topicGuid);if(u||(u=document.createElementNS("http://www.w3.org/2000/svg","line"),u.classList.add(_),this.svgLayer.appendChild(u),this.connectorElements.set(o.topicGuid,u)),!m){u.style.display="none";continue}u.style.display="";const g=this.getPriorityColor(o.priority);u.setAttribute("x1",String(a)),u.setAttribute("y1",String(l)),u.setAttribute("x2",String(m.x)),u.setAttribute("y2",String(m.y)),u.setAttribute("stroke",g),u.setAttribute("stroke-width","1.5"),u.setAttribute("stroke-dasharray","3 2"),u.setAttribute("stroke-opacity",String((p*.5).toFixed(2)))}}}dispose(){this._disposed=!0,this.unsubCamera&&this.unsubCamera(),this.container.remove(),this.markerElements.clear(),this.connectorElements.clear(),this.clickCallbacks=[],this.hoverCallbacks=[]}createMarkerElement(e){const i=document.createElement("div");i.className=L,i.dataset.topicGuid=e.topicGuid,this.updateMarkerInnerHTML(i,e),i.addEventListener("click",n=>{n.stopPropagation();for(const o of this.clickCallbacks)o(e.topicGuid)}),i.addEventListener("mouseenter",()=>{for(const o of this.hoverCallbacks)o(e.topicGuid);const n=i.querySelector(`.${P}`);n&&(n.style.display="")}),i.addEventListener("mouseleave",()=>{for(const o of this.hoverCallbacks)o(null);const n=i.querySelector(`.${P}`);n&&(n.style.display="none")}),e.topicGuid===this.activeMarkerId&&i.classList.add(E),this.container.appendChild(i),this.markerElements.set(e.topicGuid,i)}updateMarkerContent(e){const i=this.markerElements.get(e.topicGuid);i&&(this.updateMarkerInnerHTML(i,e),e.topicGuid===this.activeMarkerId?i.classList.add(E):i.classList.remove(E))}updateMarkerInnerHTML(e,i){const n=this.getPriorityColor(i.priority),o=Nt[i.status.toLowerCase()]??"●";e.innerHTML=`
|
|
143
|
+
</Bitmap>`}function y(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $(t){return{x:t.x,y:-t.z,z:t.y}}function T(t){return{x:t.x,y:t.z,z:-t.y}}function Lt(t){const e=$(t.position),i=$(t.target),n=$(t.up),o=i.x-e.x,s=i.y-e.y,c=i.z-e.z,r=Math.sqrt(o*o+s*s+c*c),a=r>1e-4?{x:o/r,y:s/r,z:c/r}:{x:0,y:1,z:0},l=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z),p=l>1e-4?{x:n.x/l,y:n.y/l,z:n.z/l}:{x:0,y:0,z:1},f=t.fov*180/Math.PI;return{cameraViewPoint:e,cameraDirection:a,cameraUpVector:p,fieldOfView:Math.max(1,Math.min(179,f))}}function Gt(t,e){const i=$(t.position),n=$(t.target),o=$(t.up),s=n.x-i.x,c=n.y-i.y,r=n.z-i.z,a=Math.sqrt(s*s+c*c+r*r),l=a>1e-4?{x:s/a,y:c/a,z:r/a}:{x:0,y:1,z:0},p=Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z),f=p>1e-4?{x:o.x/p,y:o.y/p,z:o.z/p}:{x:0,y:0,z:1};return{cameraViewPoint:i,cameraDirection:l,cameraUpVector:f,viewToWorldScale:e}}function kt(t,e=10){const i={x:t.cameraViewPoint.x+t.cameraDirection.x*e,y:t.cameraViewPoint.y+t.cameraDirection.y*e,z:t.cameraViewPoint.z+t.cameraDirection.z*e},n=T(t.cameraViewPoint),o=T(i),s=T(t.cameraUpVector),c=t.fieldOfView*Math.PI/180;return{position:n,target:o,up:s,fov:c,isOrthographic:!1}}function Ut(t,e=10){const i={x:t.cameraViewPoint.x+t.cameraDirection.x*e,y:t.cameraViewPoint.y+t.cameraDirection.y*e,z:t.cameraViewPoint.z+t.cameraDirection.z*e},n=T(t.cameraViewPoint),o=T(i),s=T(t.cameraUpVector);return{position:n,target:o,up:s,fov:Math.PI/4,isOrthographic:!0,orthoScale:t.viewToWorldScale}}function Rt(t,e){if(!t.enabled)return null;const i=t.position/100;let n,o;switch(t.axis){case"down":n={x:(e.min.x+e.max.x)/2,y:e.min.y+i*(e.max.y-e.min.y),z:(e.min.z+e.max.z)/2},o=t.flipped?{x:0,y:1,z:0}:{x:0,y:-1,z:0};break;case"front":n={x:(e.min.x+e.max.x)/2,y:(e.min.y+e.max.y)/2,z:e.min.z+i*(e.max.z-e.min.z)},o=t.flipped?{x:0,y:0,z:1}:{x:0,y:0,z:-1};break;case"side":n={x:e.min.x+i*(e.max.x-e.min.x),y:(e.min.y+e.max.y)/2,z:(e.min.z+e.max.z)/2},o=t.flipped?{x:1,y:0,z:0}:{x:-1,y:0,z:0};break}return{location:$(n),direction:$(o)}}function Ot(t,e){const i=T(t.location),n=T(t.direction),o=Math.abs(n.x),s=Math.abs(n.y),c=Math.abs(n.z);let r,a,l;if(s>=o&&s>=c){r="down";const p=e.max.y-e.min.y;a=p>0?(i.y-e.min.y)/p*100:50,l=n.y>0}else if(c>=o){r="front";const p=e.max.z-e.min.z;a=p>0?(i.z-e.min.z)/p*100:50,l=n.z>0}else{r="side";const p=e.max.x-e.min.x;a=p>0?(i.x-e.min.x)/p*100:50,l=n.x>0}return a=Math.max(0,Math.min(100,a)),{axis:r,position:a,enabled:!0,flipped:l}}function re(t){const{camera:e,sectionPlane:i,bounds:n,snapshot:o,snapshotData:s,selectedGuids:c,hiddenGuids:r,visibleGuids:a,coloredGuids:l}=t,p={guid:C()};if(e.isOrthographic&&e.orthoScale!==void 0?p.orthogonalCamera=Gt(e,e.orthoScale):p.perspectiveCamera=Lt(e),i?.enabled&&n){const d=Rt(i,n);d&&(p.clippingPlanes=[d])}o&&(p.snapshot=o),s&&(p.snapshotData=s);const f=c&&c.length>0,m=r&&r.length>0,u=a&&a.length>0,g=l&&l.length>0;return(f||m||u||g)&&(p.components={},f&&(p.components.selection=c.map(d=>({ifcGuid:d}))),u?p.components.visibility={defaultVisibility:!1,exceptions:a.map(d=>({ifcGuid:d}))}:m&&(p.components.visibility={defaultVisibility:!0,exceptions:r.map(d=>({ifcGuid:d}))}),g&&(p.components.coloring=l.map(({color:d,guids:x})=>({color:d,components:x.map(w=>({ifcGuid:w}))})))),p}function le(t,e,i=10){let n,o;t.perspectiveCamera?n=kt(t.perspectiveCamera,i):t.orthogonalCamera&&(n=Ut(t.orthogonalCamera,i)),t.clippingPlanes&&t.clippingPlanes.length>0&&e&&(o=Ot(t.clippingPlanes[0],e));const s=[];if(t.components?.selection)for(const l of t.components.selection)l.ifcGuid&&s.push(l.ifcGuid);const c=[],r=[];if(t.components?.visibility){const{defaultVisibility:l,exceptions:p}=t.components.visibility;if(p)for(const f of p)f.ifcGuid&&(l===!1?r.push(f.ifcGuid):c.push(f.ifcGuid))}const a=[];if(t.components?.coloring)for(const l of t.components.coloring){const p=[];for(const f of l.components)f.ifcGuid&&p.push(f.ifcGuid);p.length>0&&a.push({color:l.color,guids:p})}return{camera:n,sectionPlane:o,selectedGuids:s,hiddenGuids:c,visibleGuids:r,coloredGuids:a}}function G(t){return{x:t.x,y:t.z,z:-t.y}}function jt(t,e){const i=t.perspectiveCamera??t.orthogonalCamera;if(!i)return null;const n=G(i.cameraViewPoint),o=G(i.cameraDirection),s=Math.sqrt(o.x*o.x+o.y*o.y+o.z*o.z);if(s<1e-6)return null;const c=o.x/s,r=o.y/s,a=o.z/s;return{x:n.x+c*e,y:n.y+r*e,z:n.z+a*e}}function N(t){const e=(t.min.x+t.max.x)/2,i=(t.min.z+t.max.z)/2,n=t.max.y,o=t.max.y-t.min.y,s=Math.max(o*.3,.5);return{position:{x:e,y:n+s,z:i},connectorAnchor:{x:e,y:n,z:i}}}function Xt(t,e,i){const n=t.components?.selection;if(n&&n.length>0)for(const r of n){if(!r.ifcGuid)continue;const a=e(r.ifcGuid);if(a)return{...N(a),source:"component"}}const o=t.components?.visibility;if(o&&!o.defaultVisibility&&o.exceptions&&o.exceptions.length>0)for(const r of o.exceptions){if(!r.ifcGuid)continue;const a=e(r.ifcGuid);if(a)return{...N(a),source:"component"}}const s=jt(t,i);if(s)return{position:s,source:"camera-target"};const c=t.perspectiveCamera??t.orthogonalCamera;return c?{position:G(c.cameraViewPoint),source:"camera-position"}:null}function pe(t,e,i){const{targetDistance:n=50,statusFilter:o}=i??{},s=[];for(let c=0;c<t.length;c++){const r=t[c];if(o&&o.length>0){const p=(r.topicStatus??"").toLowerCase();if(!o.some(f=>f.toLowerCase()===p))continue}let a=null;for(const p of r.viewpoints)if(a=Xt(p,e,n),a)break;if(!a)continue;const l=r.viewpoints[0];s.push({topicGuid:r.guid,position:a.position,connectorAnchor:a.connectorAnchor,title:r.title,status:r.topicStatus??"Open",priority:r.priority??"Normal",topicType:r.topicType??"Issue",commentCount:r.comments.length,hasViewpoint:r.viewpoints.length>0,snapshot:l?.snapshot,positionSource:a.source,index:r.index??c+1})}return s}const L="bcf-overlay-marker",_="bcf-overlay-connector",P="bcf-overlay-active",E="bcf-overlay-tooltip",Bt={high:"#f7768e",critical:"#f7768e",medium:"#ff9e64",normal:"#ff9e64",low:"#9ece6a"},Nt={open:"●","in progress":"◐",resolved:"✓",closed:"○"};class k{container;svgLayer;markerElements=new Map;connectorElements=new Map;markers=[];activeMarkerId=null;projection;unsubCamera=null;clickCallbacks=[];hoverCallbacks=[];opts;_visible=!0;_disposed=!1;constructor(e,i,n){this.projection=i,this.opts={showConnectors:n?.showConnectors??!0,showTooltips:n?.showTooltips??!0,minScale:n?.minScale??.65,maxScale:n?.maxScale??1,verticalOffset:n?.verticalOffset??36},this.container=document.createElement("div"),this.container.style.cssText="position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:20;",e.appendChild(this.container),this.svgLayer=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svgLayer.style.cssText="position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;",this.container.appendChild(this.svgLayer),this.injectStyles(),this.unsubCamera=i.onCameraChange(()=>this.updatePositions())}setMarkers(e){this.markers=e;const i=new Set(e.map(n=>n.topicGuid));for(const[n,o]of this.markerElements)i.has(n)||(o.remove(),this.markerElements.delete(n));for(const[n,o]of this.connectorElements)i.has(n)||(o.remove(),this.connectorElements.delete(n));for(const n of e)this.markerElements.has(n.topicGuid)?this.updateMarkerContent(n):this.createMarkerElement(n);this.updatePositions()}setActiveMarker(e){if(this.activeMarkerId){const i=this.markerElements.get(this.activeMarkerId);i&&i.classList.remove(P)}if(this.activeMarkerId=e,e){const i=this.markerElements.get(e);i&&i.classList.add(P)}}setVisible(e){this._visible=e,this.container.style.display=e?"":"none"}onMarkerClick(e){return this.clickCallbacks.push(e),()=>{this.clickCallbacks=this.clickCallbacks.filter(i=>i!==e)}}onMarkerHover(e){return this.hoverCallbacks.push(e),()=>{this.hoverCallbacks=this.hoverCallbacks.filter(i=>i!==e)}}updatePositions(){if(this._disposed||!this._visible)return;const{width:e,height:i}=this.projection.getCanvasSize();if(e===0||i===0)return;const n=this.projection.getCameraPosition?.();for(const o of this.markers){const s=this.markerElements.get(o.topicGuid);if(!s)continue;const c=this.projection.projectToScreen(o.position);if(!c||c.x<-80||c.y<-80||c.x>e+80||c.y>i+80){s.style.display="none";const f=this.connectorElements.get(o.topicGuid);f&&(f.style.display="none");continue}s.style.display="";let r=1;if(n){const f=o.position.x-n.x,m=o.position.y-n.y,u=o.position.z-n.z,g=Math.sqrt(f*f+m*m+u*u),d=Math.max(0,Math.min(1,(g-20)/180));r=this.opts.maxScale+d*(this.opts.minScale-this.opts.maxScale)}const a=c.x,l=c.y;s.style.transform=`translate(${a}px, ${l}px) translate(-50%, -100%) scale(${r.toFixed(3)})`;const p=n?.6+(1-Math.max(0,Math.min(1,(Math.sqrt((o.position.x-n.x)**2+(o.position.y-n.y)**2+(o.position.z-n.z)**2)-20)/250)))*.4:1;if(s.style.opacity=p.toFixed(2),this.opts.showConnectors){const f=o.connectorAnchor??o.position,m=this.projection.projectToScreen(f);let u=this.connectorElements.get(o.topicGuid);if(u||(u=document.createElementNS("http://www.w3.org/2000/svg","line"),u.classList.add(_),this.svgLayer.appendChild(u),this.connectorElements.set(o.topicGuid,u)),!m){u.style.display="none";continue}u.style.display="";const g=this.getPriorityColor(o.priority);u.setAttribute("x1",String(a)),u.setAttribute("y1",String(l)),u.setAttribute("x2",String(m.x)),u.setAttribute("y2",String(m.y)),u.setAttribute("stroke",g),u.setAttribute("stroke-width","1.5"),u.setAttribute("stroke-dasharray","3 2"),u.setAttribute("stroke-opacity",String((p*.5).toFixed(2)))}}}dispose(){this._disposed=!0,this.unsubCamera&&this.unsubCamera(),this.container.remove(),this.markerElements.clear(),this.connectorElements.clear(),this.clickCallbacks=[],this.hoverCallbacks=[]}createMarkerElement(e){const i=document.createElement("div");i.className=L,i.dataset.topicGuid=e.topicGuid,this.updateMarkerInnerHTML(i,e),i.addEventListener("click",n=>{n.stopPropagation();for(const o of this.clickCallbacks)o(e.topicGuid)}),i.addEventListener("mouseenter",()=>{for(const o of this.hoverCallbacks)o(e.topicGuid);const n=i.querySelector(`.${E}`);n&&(n.style.display="")}),i.addEventListener("mouseleave",()=>{for(const o of this.hoverCallbacks)o(null);const n=i.querySelector(`.${E}`);n&&(n.style.display="none")}),e.topicGuid===this.activeMarkerId&&i.classList.add(P),this.container.appendChild(i),this.markerElements.set(e.topicGuid,i)}updateMarkerContent(e){const i=this.markerElements.get(e.topicGuid);i&&(this.updateMarkerInnerHTML(i,e),e.topicGuid===this.activeMarkerId?i.classList.add(P):i.classList.remove(P))}updateMarkerInnerHTML(e,i){const n=this.getPriorityColor(i.priority),o=Nt[i.status.toLowerCase()]??"●";e.innerHTML=`
|
|
144
144
|
<div class="bcf-marker-pin" style="--marker-color:${n};">
|
|
145
145
|
<span class="bcf-marker-index">${i.index}</span>
|
|
146
146
|
</div>
|
|
147
|
-
<div class="${
|
|
147
|
+
<div class="${E}" style="display:none;">
|
|
148
148
|
<div class="bcf-tooltip-header">
|
|
149
149
|
<span class="bcf-tooltip-status" style="color:${n}">${o}</span>
|
|
150
150
|
<span class="bcf-tooltip-title">${this.escapeHtml(i.title)}</span>
|
|
@@ -153,7 +153,7 @@ ${e}</Component>`):n+="/>",n}function Et(t){let e=`
|
|
|
153
153
|
${this.escapeHtml(i.status)}${i.commentCount>0?` · ${i.commentCount} comment${i.commentCount!==1?"s":""}`:""}
|
|
154
154
|
</div>
|
|
155
155
|
</div>
|
|
156
|
-
`}getPriorityColor(e){return Bt[e.toLowerCase()]??"#7aa2f7"}escapeHtml(e){const i=document.createElement("div");return i.textContent=e,i.innerHTML}static stylesInjected=!1;injectStyles(){if(
|
|
156
|
+
`}getPriorityColor(e){return Bt[e.toLowerCase()]??"#7aa2f7"}escapeHtml(e){const i=document.createElement("div");return i.textContent=e,i.innerHTML}static stylesInjected=!1;injectStyles(){if(k.stylesInjected)return;k.stylesInjected=!0;const e=document.createElement("style");e.textContent=`
|
|
157
157
|
/* BCF 3D Overlay Markers */
|
|
158
158
|
|
|
159
159
|
.${L} {
|
|
@@ -187,7 +187,7 @@ ${e}</Component>`):n+="/>",n}function Et(t){let e=`
|
|
|
187
187
|
box-shadow: 0 4px 16px rgba(0,0,0,0.4);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
.${
|
|
190
|
+
.${P} .bcf-marker-pin {
|
|
191
191
|
transform: rotate(-45deg) scale(1.25);
|
|
192
192
|
box-shadow: 0 0 0 4px rgba(122,162,247,0.35), 0 4px 16px rgba(0,0,0,0.4);
|
|
193
193
|
animation: bcf-pulse 1.8s ease-in-out infinite;
|
|
@@ -204,7 +204,7 @@ ${e}</Component>`):n+="/>",n}function Et(t){let e=`
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/* Tooltip */
|
|
207
|
-
.${
|
|
207
|
+
.${E} {
|
|
208
208
|
position: absolute;
|
|
209
209
|
bottom: calc(100% + 6px);
|
|
210
210
|
left: 50%;
|
|
@@ -224,7 +224,7 @@ ${e}</Component>`):n+="/>",n}function Et(t){let e=`
|
|
|
224
224
|
box-shadow: 0 4px 16px rgba(0,0,0,0.5);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
.${
|
|
227
|
+
.${E}::after {
|
|
228
228
|
content: '';
|
|
229
229
|
position: absolute;
|
|
230
230
|
top: 100%;
|
|
@@ -278,4 +278,4 @@ Requirement: ${c.checkedDescription}${s.globalId?`
|
|
|
278
278
|
GlobalId: ${s.globalId}`:""}`,author:i.author,topicType:i.failureTopicType,topicStatus:"Open",labels:["IDS",o.specification.name]});let l;if(s.globalId){const f=`${s.modelId}:${s.expressId}`,m=i.entityBounds?.get(f),u=i.entitySnapshots?.get(f),g=J(s.globalId,i.failureColor,m,u);a.viewpoints.push(g),l=g.guid}const p=D({author:i.author,comment:W(c),viewpointGuid:l});a.comments.push(p),t.topics.set(a.guid,a),n++}}}function te(t,e,i,n){const o=[];return e.passed?o.push("IDS Validation Passed — all requirements satisfied"):o.push(`IDS Validation Failure — ${i} of ${n} requirements failed`),o.push(""),o.push(`Specification: ${t.specification.name}`),t.specification.description&&o.push(`Description: ${t.specification.description}`),o.push(`Entity Type: ${e.entityType}`),e.globalId&&o.push(`GlobalId: ${e.globalId}`),e.entityName&&o.push(`Name: ${e.entityName}`),o.join(`
|
|
279
279
|
`)}function ee(t){const e=[];return e.push(`IDS Specification Failure — ${t.failedCount} of ${t.applicableCount} entities failed`),t.specification.description&&(e.push(""),e.push(t.specification.description)),e.push(""),e.push(`Applicable: ${t.applicableCount}`),e.push(`Passed: ${t.passedCount}`),e.push(`Failed: ${t.failedCount}`),e.join(`
|
|
280
280
|
`)}function W(t){const e=[];return e.push(`[${t.facetType}] ${t.checkedDescription}`),t.failureReason&&e.push(`Failure: ${t.failureReason}`),t.expectedValue&&e.push(`Expected: ${t.expectedValue}`),t.actualValue&&e.push(`Actual: ${t.actualValue}`),e.join(`
|
|
281
|
-
`)}function ie(t){const e=(t.min.x+t.max.x)/2,i=(t.min.y+t.max.y)/2,n=(t.min.z+t.max.z)/2,o=t.max.x-t.min.x,s=t.max.y-t.min.y,c=t.max.z-t.min.z,r=Math.max(o,s,c,.1),a=60*Math.PI/180,l=r/2/Math.tan(a/2)*1.5,p=Math.sqrt(.6*.6+.5*.5+.6*.6),f=.6/p*l,m=.5/p*l,u=.6/p*l,g=e+f,d=i+m,x=n+u,w=e-g,
|
|
281
|
+
`)}function ie(t){const e=(t.min.x+t.max.x)/2,i=(t.min.y+t.max.y)/2,n=(t.min.z+t.max.z)/2,o=t.max.x-t.min.x,s=t.max.y-t.min.y,c=t.max.z-t.min.z,r=Math.max(o,s,c,.1),a=60*Math.PI/180,l=r/2/Math.tan(a/2)*1.5,p=Math.sqrt(.6*.6+.5*.5+.6*.6),f=.6/p*l,m=.5/p*l,u=.6/p*l,g=e+f,d=i+m,x=n+u,w=e-g,b=i-d,S=n-x,v=Math.sqrt(w*w+b*b+S*S);return{cameraViewPoint:{x:g,y:-x,z:d},cameraDirection:{x:w/v,y:-S/v,z:b/v},cameraUpVector:{x:0,y:0,z:1},fieldOfView:60}}function J(t,e,i,n){const o={guid:C(),components:{selection:[{ifcGuid:t}],visibility:{defaultVisibility:!1,exceptions:[{ifcGuid:t}]}}};return e&&(o.components.coloring=[{color:e,components:[{ifcGuid:t}]}]),i&&(o.perspectiveCamera=ie(i)),n&&(o.snapshot=n),o}function ne(t,e){const i={guid:C(),components:{selection:t.map(n=>({ifcGuid:n})),visibility:{defaultVisibility:!1,exceptions:t.map(n=>({ifcGuid:n}))}}};return e&&(i.components.coloring=[{color:e,components:t.map(n=>({ifcGuid:n}))}]),i}function ue(t){return{version:t?.version??"2.1",projectId:C(),name:t?.name,topics:new Map}}function me(t){return{guid:C(),title:t.title,description:t.description,topicType:t.topicType??"Issue",topicStatus:t.topicStatus??"Open",priority:t.priority,creationDate:new Date().toISOString(),creationAuthor:t.author,assignedTo:t.assignedTo,dueDate:t.dueDate,labels:t.labels,comments:[],viewpoints:[]}}function de(t){return{guid:C(),date:new Date().toISOString(),author:t.author,comment:t.comment,viewpointGuid:t.viewpointGuid}}function he(t,e){t.topics.set(e.guid,e)}function ge(t,e){t.comments.push(e),t.modifiedDate=new Date().toISOString()}function ye(t,e){t.viewpoints.push(e),t.modifiedDate=new Date().toISOString()}function xe(t,e,i){t.topicStatus=e,t.modifiedDate=new Date().toISOString(),t.modifiedAuthor=i}export{k as B,pe as a,ue as b,re as c,j as d,le as e,me as f,se as g,de as h,fe as i,ye as j,ge as k,he as l,ot as p,ce as r,xe as u,ae as w};
|