45 lines
88 KiB
JavaScript
45 lines
88 KiB
JavaScript
/*!
|
|
* LMV v7.99.1
|
|
*
|
|
* Copyright 2024 Autodesk, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This computer source code and related instructions and comments are the
|
|
* unpublished confidential and proprietary information of Autodesk, Inc.
|
|
* and are protected under Federal copyright and state trade secret law.
|
|
* They may not be disclosed to, copied or used by any third party without
|
|
* the prior written consent of Autodesk, Inc.
|
|
*
|
|
* Autodesk Viewer SDK Usage Limitations:
|
|
*
|
|
* The Autodesk Viewer SDK JavaScript must be delivered from an
|
|
* Autodesk-hosted URL.
|
|
*/(()=>{var t={5354:t=>{t.exports={MOUSE_HOVERING:"DATAVIZ_OBJECT_HOVERING",MOUSE_CLICK:"DATAVIZ_OBJECT_CLICK",MOUSE_CLICK_OUT:"DATAVIZ_CLICK_OUT"}},1048:(t,e,i)=>{const n=i(1897),s=65535;t.exports={SpriteMeshBuilder:class{constructor(t){this.meshCallback=t,this.dbIds=[],this.reset()}addPoint(t,e){this.vcount+1>s&&(this.flushBuffer(),this.reset());let i=this.vcount;if(this.ib[i]=i,this.vb[3*i]=t.position.x,this.vb[3*i+1]=t.position.y,this.vb[3*i+2]=t.position.z,this.idb[3*i]=255&t.dbId,this.idb[3*i+1]=t.dbId>>8&255,this.idb[3*i+2]=t.dbId>>16&255,this.colorb[3*i]=255*t.color.r,this.colorb[3*i+1]=255*t.color.g,this.colorb[3*i+2]=255*t.color.b,e){let n=e.spriteUV(t.style.url);n&&(this.uv[4*i]=n.x,this.uv[4*i+1]=n.y,this.uv[4*i+2]=n.w,this.uv[4*i+3]=n.h)}this.scale[i]=1,this.dbIds.push(t.dbId),this.vcount++}reset(){this.vcount=0,this.ib=new Uint16Array(s),this.idb=new Uint8Array(196605),this.vb=new Float32Array(196605),this.colorb=new Uint8Array(196605),this.scale=new Float32Array(s),this.uv=new Float32Array(262140)}flushBuffer(){let t=new n.BufferGeometry,e=new n.BufferAttribute(new Uint8Array(this.idb.slice(0,3*this.vcount)),3);e.bytesPerItem=1,e.normalized=!0;let i=new n.BufferAttribute(new Float32Array(this.vb.slice(0,3*this.vcount)),3);i.bytesPerItem=4;let s=new n.BufferAttribute(new Uint8Array(this.colorb.slice(0,3*this.vcount)),3);s.bytesPerItem=1,s.normalized=!0;let r=new n.BufferAttribute(new Uint16Array(this.ib.slice(0,this.vcount)),1),o=new n.BufferAttribute(new Float32Array(this.uv.slice(0,4*this.vcount)),4),a=new n.BufferAttribute(new Float32Array(this.scale.slice(0,this.vcount)),1);t.setAttribute("id",e),t.setIndex(r),t.setAttribute("position",i),t.setAttribute("color",s),t.setAttribute("uvp",o),t.setAttribute("pointScale",a),t.isPoints=!0,t.dbIds=this.dbIds.slice(0),this.dbIds.length=0,this.meshCallback&&this.meshCallback(t),this.vcount=0}}}},673:t=>{class e{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.id=t,this._children=[],this.isGroup=!0,this.name=e}get children(){return this._children}addChild(t){this.children.push(t)}update(t){this.children.forEach((e=>e.update(t)))}getLeafsById(t,e){e=e||[];for(let i=0;i<this.children.length;i++){let n=this.children[i];n.id===t?n.isLeaf?e.push(n):n.isGroup&&n.getChildLeafs(e):n.isGroup&&n.getLeafsById(t,e)}return e}getNodeById(t){for(let e=0;e<this.children.length;e++){let i=this.children[e];if(i.id===t)return i;if(i.isGroup){let e=i.getNodeById(t);if(e)return e}}}getChildLeafs(t){for(let e=0;e<this.children.length;e++){let i=this.children[e];i.isLeaf?t.push(i):i.isGroup&&i.getChildLeafs(t)}}}t.exports={SurfaceShadingData:class extends e{initialize(t){this.update(t)}},SurfaceShadingGroup:e,SurfaceShadingNode:class{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t;"number"==typeof e&&(e=[e]),this.dbIds=e,this.shadingPoints=i||[],this.isLeaf=!0,this.fragIds=[],this.id=t,this.name=n,this.bounds=new THREE.Box3}addPoint(t){this.shadingPoints.push(t)}update(t){const e=t.getData().instanceTree,i=new Set(this.fragIds),n=new THREE.Box3,s=t.getFragmentList();this.dbIds.forEach((t=>{e.enumNodeFragments(t,(t=>{i.has(t)||(this.fragIds.push(t),s.getWorldBounds(t,n),this.bounds.union(n))}),true)}))}},SurfaceShadingPoint:class{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};this.id=t,this.position=e,this.types=i,this.name=n,this.contextData=s,this.dbId=null}positionFromDBId(t,e){const i=t.getData().instanceTree,n=new THREE.Box3,s=new THREE.Box3,r=t.getFragmentList();this.dbId=e,i.enumNodeFragments(e,(t=>{r.getWorldBounds(t,s),n.union(s)}),!0),this.position=n.getCenter(new THREE.Vector3)||this.position}},filterShadingPointsByType:function(t,e){return(t=t||[]).filter((t=>t.types&&t.types.includes(e)))}}},1801:function(t,e,i){var n,s,r;r=function(){var t,e={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},i=function(){var t=function(t){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=t.xField||t.defaultXField,this._yField=t.yField||t.defaultYField,this._valueField=t.valueField||t.defaultValueField,t.radius&&(this._cfgRadius=t.radius)},i=e.defaultRadius;return t.prototype={_organiseData:function(t,e){var n=t[this._xField],s=t[this._yField],r=this._radi,o=this._data,a=this._max,h=this._min,l=t[this._valueField]||1,d=t.radius||this._cfgRadius||i;o[n]||(o[n]=[],r[n]=[]),o[n][s]?o[n][s]+=l:(o[n][s]=l,r[n][s]=d);var c=o[n][s];return c>a?(e?this.setDataMax(c):this._max=c,!1):c<h?(e?this.setDataMin(c):this._min=c,!1):{x:n,y:s,value:l,radius:d,min:h,max:a}},_unOrganizeData:function(){var t=[],e=this._data,i=this._radi;for(var n in e)for(var s in e[n])t.push({x:n,y:s,radius:i[n][s],value:e[n][s]});return{min:this._min,max:this._max,data:t}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var t=arguments[0],e=t.length;e--;)this.addData.call(this,t[e]);else{var i=this._organiseData(arguments[0],!0);i&&(0===this._data.length&&(this._min=this._max=i.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[i]}))}return this},setData:function(t){var e=t.data,i=e.length;this._data=[],this._radi=[];for(var n=0;n<i;n++)this._organiseData(e[n],!1);return this._max=t.max,this._min=t.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(t){return this._max=t,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(t){return this._min=t,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(t){this._coordinator=t},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},t}(),n=function(){var t=function(t){var e=t.gradient||t.defaultGradient,i=document.createElement("canvas"),n=i.getContext("2d");i.width=256,i.height=1;var s=n.createLinearGradient(0,0,256,1);for(var r in e)s.addColorStop(r,e[r]);return n.fillStyle=s,n.fillRect(0,0,256,1),n.getImageData(0,0,256,1).data},e=function(t,e){var i=document.createElement("canvas"),n=i.getContext("2d"),s=t,r=t;if(i.width=i.height=2*t,1==e)n.beginPath(),n.arc(s,r,t,0,2*Math.PI,!1),n.fillStyle="rgba(0,0,0,1)",n.fill();else{var o=n.createRadialGradient(s,r,t*e,s,r,t);o.addColorStop(0,"rgba(0,0,0,1)"),o.addColorStop(1,"rgba(0,0,0,0)"),n.fillStyle=o,n.fillRect(0,0,2*t,2*t)}return i};function i(e){var i=e.container,n=this.shadowCanvas=document.createElement("canvas"),s=this.canvas=e.canvas||document.createElement("canvas"),r=(this._renderBoundaries=[1e4,1e4,0,0],getComputedStyle(e.container)||{});s.className="heatmap-canvas",this._width=s.width=n.width=e.width||+r.width.replace(/px/,""),this._height=s.height=n.height=e.height||+r.height.replace(/px/,""),this.shadowCtx=n.getContext("2d"),this.ctx=s.getContext("2d"),s.style.cssText=n.style.cssText="position:absolute;left:0;top:0;",i.style.position="relative",i.appendChild(s),this._palette=t(e),this._templates={},this._setStyles(e)}return i.prototype={renderPartial:function(t){t.data.length>0&&(this._drawAlpha(t),this._colorize())},renderAll:function(t){this._clear(),t.data.length>0&&(this._drawAlpha(function(t){for(var e=[],i=t.min,n=t.max,s=t.radi,r=(t=t.data,Object.keys(t)),o=r.length;o--;)for(var a=r[o],h=Object.keys(t[a]),l=h.length;l--;){var d=h[l],c=t[a][d],u=s[a][d];e.push({x:a,y:d,value:c,radius:u})}return{min:i,max:n,data:e}}(t)),this._colorize())},_updateGradient:function(e){this._palette=t(e)},updateConfig:function(t){t.gradient&&this._updateGradient(t),this._setStyles(t)},setDimensions:function(t,e){this._width=t,this._height=e,this.canvas.width=this.shadowCanvas.width=t,this.canvas.height=this.shadowCanvas.height=e},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(t){this._blur=0==t.blur?0:t.blur||t.defaultBlur,t.backgroundColor&&(this.canvas.style.backgroundColor=t.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=t.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=t.height||this._height,this._opacity=255*(t.opacity||0),this._maxOpacity=255*(t.maxOpacity||t.defaultMaxOpacity),this._minOpacity=255*(t.minOpacity||t.defaultMinOpacity),this._useGradientOpacity=!!t.useGradientOpacity},_drawAlpha:function(t){for(var i=this._min=t.min,n=this._max=t.max,s=(t=t.data||[]).length,r=1-this._blur;s--;){var o,a=t[s],h=a.x,l=a.y,d=a.radius,c=Math.min(a.value,n),u=h-d,p=l-d,f=this.shadowCtx;this._templates[d]?o=this._templates[d]:this._templates[d]=o=e(d,r);var g=(c-i)/(n-i);f.globalAlpha=g<.01?.01:g,f.drawImage(o,u,p),u<this._renderBoundaries[0]&&(this._renderBoundaries[0]=u),p<this._renderBoundaries[1]&&(this._renderBoundaries[1]=p),u+2*d>this._renderBoundaries[2]&&(this._renderBoundaries[2]=u+2*d),p+2*d>this._renderBoundaries[3]&&(this._renderBoundaries[3]=p+2*d)}},_colorize:function(){var t=this._renderBoundaries[0],e=this._renderBoundaries[1],i=this._renderBoundaries[2]-t,n=this._renderBoundaries[3]-e,s=this._width,r=this._height,o=this._opacity,a=this._maxOpacity,h=this._minOpacity,l=this._useGradientOpacity;t<0&&(t=0),e<0&&(e=0),t+i>s&&(i=s-t),e+n>r&&(n=r-e);for(var d=this.shadowCtx.getImageData(t,e,i,n),c=d.data,u=c.length,p=this._palette,f=3;f<u;f+=4){var g,v=c[f],m=4*v;m&&(g=o>0?o:v<a?v<h?h:v:a,c[f-3]=p[m],c[f-2]=p[m+1],c[f-1]=p[m+2],c[f]=l?p[m+3]:g)}d.data=c,this.ctx.putImageData(d,t,e),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(t){var e=this.shadowCtx.getImageData(t.x,t.y,1,1).data[3],i=this._max,n=this._min;return Math.abs(i-n)*(e/255)|0},getDataURL:function(){return this.canvas.toDataURL()}},i}(),s=(t=!1,"canvas2d"===e.defaultRenderer&&(t=n),t),r=function(){for(var t={},e=arguments.length,i=0;i<e;i++){var n=arguments[i];for(var s in n)t[s]=n[s]}return t},o=function(){var t=function(){function t(){this.cStore={}}return t.prototype={on:function(t,e,i){var n=this.cStore;n[t]||(n[t]=[]),n[t].push((function(t){return e.call(i,t)}))},emit:function(t,e){var i=this.cStore;if(i[t])for(var n=i[t].length,s=0;s<n;s++)(0,i[t][s])(e)}},t}();function n(){var n,o,a,h,l=this._config=r(e,arguments[0]||{});if(this._coordinator=new t,l.plugin){var d=l.plugin;if(!e.plugins[d])throw new Error("Plugin '"+d+"' not found. Maybe it was not registered.");var c=e.plugins[d];this._renderer=new c.renderer(l),this._store=new c.store(l)}else this._renderer=new s(l),this._store=new i(l);o=(n=this)._renderer,a=n._coordinator,h=n._store,a.on("renderpartial",o.renderPartial,o),a.on("renderall",o.renderAll,o),a.on("extremachange",(function(t){n._config.onExtremaChange&&n._config.onExtremaChange({min:t.min,max:t.max,gradient:n._config.gradient||n._config.defaultGradient})})),h.setCoordinator(a)}return n.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(t){return this._config=r(this._config,t),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(t){return this._store.getValueAt?this._store.getValueAt(t):this._renderer.getValueAt?this._renderer.getValueAt(t):null}},n}();return{create:function(t){return new o(t)},register:function(t,i){e.plugins[t]=i}}},t.exports?t.exports=r():void 0===(s="function"==typeof(n=r)?n.call(e,i,e,t):n)||(t.exports=s)},6533:t=>{
|
|
/*!
|
|
*
|
|
* Copyright 2009-2017 Kris Kowal under the terms of the MIT
|
|
* license found at https://github.com/kriskowal/q/blob/v1/LICENSE
|
|
*
|
|
* With parts by Tyler Close
|
|
* Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
|
|
* at http://www.opensource.org/licenses/mit-license.html
|
|
* Forked at ref_send.js version: 2009-05-11
|
|
*
|
|
* With parts by Mark Miller
|
|
* Copyright (C) 2011 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
*/
|
|
!function(e){"use strict";"function"==typeof bootstrap?bootstrap("promise",e):t.exports=e()}((function(){"use strict";var t=!1;try{throw new Error}catch(e){t=!!e.stack}var e,i=x(),n=function(){},s=function(){var t={task:void 0,next:null},e=t,i=!1,n=void 0,r=!1,o=[];function a(){for(var e,n;t.next;)e=(t=t.next).task,t.task=void 0,(n=t.domain)&&(t.domain=void 0,n.enter()),h(e,n);for(;o.length;)h(e=o.pop());i=!1}function h(t,e){try{t()}catch(t){if(r)throw e&&e.exit(),setTimeout(a,0),e&&e.enter(),t;setTimeout((function(){throw t}),0)}e&&e.exit()}if(s=function(t){e=e.next={task:t,domain:r&&process.domain,next:null},i||(i=!0,n())},"object"==typeof process&&"[object process]"===process.toString()&&process.nextTick)r=!0,n=function(){process.nextTick(a)};else if("function"==typeof setImmediate)n="undefined"!=typeof window?setImmediate.bind(window,a):function(){setImmediate(a)};else if("undefined"!=typeof MessageChannel){var l=new MessageChannel;l.port1.onmessage=function(){n=d,l.port1.onmessage=a,a()};var d=function(){l.port2.postMessage(0)};n=function(){setTimeout(a,0),d()}}else n=function(){setTimeout(a,0)};return s.runAfter=function(t){o.push(t),i||(i=!0,n())},s}(),r=Function.call;function o(t){return function(){return r.apply(t,arguments)}}var a,h=o(Array.prototype.slice),l=o(Array.prototype.reduce||function(t,e){var i=0,n=this.length;if(1===arguments.length)for(;;){if(i in this){e=this[i++];break}if(++i>=n)throw new TypeError}for(;i<n;i++)i in this&&(e=t(e,this[i],i));return e}),d=o(Array.prototype.indexOf||function(t){for(var e=0;e<this.length;e++)if(this[e]===t)return e;return-1}),c=o(Array.prototype.map||function(t,e){var i=this,n=[];return l(i,(function(s,r,o){n.push(t.call(e,r,o,i))}),void 0),n}),u=Object.create||function(t){function e(){}return e.prototype=t,new e},p=Object.defineProperty||function(t,e,i){return t[e]=i.value,t},f=o(Object.prototype.hasOwnProperty),g=Object.keys||function(t){var e=[];for(var i in t)f(t,i)&&e.push(i);return e},v=o(Object.prototype.toString);a="undefined"!=typeof ReturnValue?ReturnValue:function(t){this.value=t};function m(e,i){if(t&&i.stack&&"object"==typeof e&&null!==e&&e.stack){for(var n=[],s=i;s;s=s.source)s.stack&&(!e.__minimumStackCounter__||e.__minimumStackCounter__>s.stackCounter)&&(p(e,"__minimumStackCounter__",{value:s.stackCounter,configurable:!0}),n.unshift(s.stack));n.unshift(e.stack);var r=function(t){for(var e=t.split("\n"),i=[],n=0;n<e.length;++n){var s=e[n];_(s)||y(s)||!s||i.push(s)}return i.join("\n")}(n.join("\nFrom previous event:\n"));p(e,"stack",{value:r,configurable:!0})}}function y(t){return-1!==t.indexOf("(module.js:")||-1!==t.indexOf("(node.js:")}function w(t){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);if(e)return[e[1],Number(e[2])];var i=/at ([^ ]+):(\d+):(?:\d+)$/.exec(t);if(i)return[i[1],Number(i[2])];var n=/.*@(.+):(\d+)$/.exec(t);return n?[n[1],Number(n[2])]:void 0}function _(t){var n=w(t);if(!n)return!1;var s=n[0],r=n[1];return s===e&&r>=i&&r<=X}function x(){if(t)try{throw new Error}catch(t){var i=t.stack.split("\n"),n=w(i[0].indexOf("@")>0?i[1]:i[2]);if(!n)return;return e=n[0],n[1]}}function b(t){return t instanceof M?t:D(t)?function(t){var e=T();return b.nextTick((function(){try{t.then(e.resolve,e.reject,e.notify)}catch(t){e.reject(t)}})),e.promise}(t):L(t)}b.resolve=b,b.nextTick=s,b.longStackSupport=!1;var E=1;function T(){var e,i=[],n=[],s=u(T.prototype),r=u(M.prototype);if(r.promiseDispatch=function(t,s,r){var o=h(arguments);i?(i.push(o),"when"===s&&r[1]&&n.push(r[1])):b.nextTick((function(){e.promiseDispatch.apply(e,o)}))},r.valueOf=function(){if(i)return r;var t=P(e);return A(t)&&(e=t),t},r.inspect=function(){return e?e.inspect():{state:"pending"}},b.longStackSupport&&t)try{throw new Error}catch(t){r.stack=t.stack.substring(t.stack.indexOf("\n")+1),r.stackCounter=E++}function o(s){e=s,b.longStackSupport&&t&&(r.source=s),l(i,(function(t,e){b.nextTick((function(){s.promiseDispatch.apply(s,e)}))}),void 0),i=void 0,n=void 0}return s.promise=r,s.resolve=function(t){e||o(b(t))},s.fulfill=function(t){e||o(L(t))},s.reject=function(t){e||o(F(t))},s.notify=function(t){e||l(n,(function(e,i){b.nextTick((function(){i(t)}))}),void 0)},s}function R(t){if("function"!=typeof t)throw new TypeError("resolver must be a function.");var e=T();try{t(e.resolve,e.reject,e.notify)}catch(t){e.reject(t)}return e.promise}function S(t){return R((function(e,i){for(var n=0,s=t.length;n<s;n++)b(t[n]).then(e,i)}))}function M(t,e,i){void 0===e&&(e=function(t){return F(new Error("Promise does not support operation: "+t))}),void 0===i&&(i=function(){return{state:"unknown"}});var n=u(M.prototype);if(n.promiseDispatch=function(i,s,r){var o;try{o=t[s]?t[s].apply(n,r):e.call(n,s,r)}catch(t){o=F(t)}i&&i(o)},n.inspect=i,i){var s=i();"rejected"===s.state&&(n.exception=s.reason),n.valueOf=function(){var t=i();return"pending"===t.state||"rejected"===t.state?n:t.value}}return n}function C(t,e,i,n){return b(t).then(e,i,n)}function P(t){if(A(t)){var e=t.inspect();if("fulfilled"===e.state)return e.value}return t}function A(t){return t instanceof M}function D(t){return(e=t)===Object(e)&&"function"==typeof t.then;var e}"object"==typeof process&&process&&process.env&&process.env.Q_DEBUG&&(b.longStackSupport=!0),b.defer=T,T.prototype.makeNodeResolver=function(){var t=this;return function(e,i){e?t.reject(e):arguments.length>2?t.resolve(h(arguments,1)):t.resolve(i)}},b.Promise=R,b.promise=R,R.race=S,R.all=W,R.reject=F,R.resolve=b,b.passByCopy=function(t){return t},M.prototype.passByCopy=function(){return this},b.join=function(t,e){return b(t).join(e)},M.prototype.join=function(t){return b([this,t]).spread((function(t,e){if(t===e)return t;throw new Error("Q can't join: not the same: "+t+" "+e)}))},b.race=S,M.prototype.race=function(){return this.then(b.race)},b.makePromise=M,M.prototype.toString=function(){return"[object Promise]"},M.prototype.then=function(t,e,i){var n=this,s=T(),r=!1;return b.nextTick((function(){n.promiseDispatch((function(e){r||(r=!0,s.resolve(function(e){try{return"function"==typeof t?t(e):e}catch(t){return F(t)}}(e)))}),"when",[function(t){r||(r=!0,s.resolve(function(t){if("function"==typeof e){m(t,n);try{return e(t)}catch(t){return F(t)}}return F(t)}(t)))}])})),n.promiseDispatch(void 0,"when",[void 0,function(t){var e,n=!1;try{e=function(t){return"function"==typeof i?i(t):t}(t)}catch(t){if(n=!0,!b.onerror)throw t;b.onerror(t)}n||s.notify(e)}]),s.promise},b.tap=function(t,e){return b(t).tap(e)},M.prototype.tap=function(t){return t=b(t),this.then((function(e){return t.fcall(e).thenResolve(e)}))},b.when=C,M.prototype.thenResolve=function(t){return this.then((function(){return t}))},b.thenResolve=function(t,e){return b(t).thenResolve(e)},M.prototype.thenReject=function(t){return this.then((function(){throw t}))},b.thenReject=function(t,e){return b(t).thenReject(e)},b.nearer=P,b.isPromise=A,b.isPromiseAlike=D,b.isPending=function(t){return A(t)&&"pending"===t.inspect().state},M.prototype.isPending=function(){return"pending"===this.inspect().state},b.isFulfilled=function(t){return!A(t)||"fulfilled"===t.inspect().state},M.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},b.isRejected=function(t){return A(t)&&"rejected"===t.inspect().state},M.prototype.isRejected=function(){return"rejected"===this.inspect().state};var I,O,k,H=[],V=[],B=[],j=!0;function U(){H.length=0,V.length=0,j||(j=!0)}function F(t){var e=M({when:function(e){return e&&function(t){if(j){var e=d(V,t);-1!==e&&("object"==typeof process&&"function"==typeof process.emit&&b.nextTick.runAfter((function(){var i=d(B,t);-1!==i&&(process.emit("rejectionHandled",H[e],t),B.splice(i,1))})),V.splice(e,1),H.splice(e,1))}}(this),e?e(t):this}},(function(){return this}),(function(){return{state:"rejected",reason:t}}));return function(t,e){j&&("object"==typeof process&&"function"==typeof process.emit&&b.nextTick.runAfter((function(){-1!==d(V,t)&&(process.emit("unhandledRejection",e,t),B.push(t))})),V.push(t),e&&void 0!==e.stack?H.push(e.stack):H.push("(no stack) "+e))}(e,t),e}function L(t){return M({when:function(){return t},get:function(e){return t[e]},set:function(e,i){t[e]=i},delete:function(e){delete t[e]},post:function(e,i){return null==e?t.apply(void 0,i):t[e].apply(t,i)},apply:function(e,i){return t.apply(e,i)},keys:function(){return g(t)}},void 0,(function(){return{state:"fulfilled",value:t}}))}function N(t,e,i){return b(t).spread(e,i)}function z(t,e,i){return b(t).dispatch(e,i)}function W(t){return C(t,(function(t){var e=0,i=T();return l(t,(function(n,s,r){var o;A(s)&&"fulfilled"===(o=s.inspect()).state?t[r]=o.value:(++e,C(s,(function(n){t[r]=n,0==--e&&i.resolve(t)}),i.reject,(function(t){i.notify({index:r,value:t})})))}),void 0),0===e&&i.resolve(t),i.promise}))}function G(t){if(0===t.length)return b.resolve();var e=b.defer(),i=0;return l(t,(function(n,s,r){var o=t[r];i++,C(o,(function(t){e.resolve(t)}),(function(t){if(0===--i){var n=t||new Error(""+t);n.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+n.message,e.reject(n)}}),(function(t){e.notify({index:r,value:t})}))}),void 0),e.promise}function $(t){return C(t,(function(t){return t=c(t,b),C(W(c(t,(function(t){return C(t,n,n)}))),(function(){return t}))}))}b.resetUnhandledRejections=U,b.getUnhandledReasons=function(){return H.slice()},b.stopUnhandledRejectionTracking=function(){U(),j=!1},U(),b.reject=F,b.fulfill=L,b.master=function(t){return M({isDef:function(){}},(function(e,i){return z(t,e,i)}),(function(){return b(t).inspect()}))},b.spread=N,M.prototype.spread=function(t,e){return this.all().then((function(e){return t.apply(void 0,e)}),e)},b.async=function(t){return function(){function e(t,e){var r;if("undefined"==typeof StopIteration){try{r=i[t](e)}catch(t){return F(t)}return r.done?b(r.value):C(r.value,n,s)}try{r=i[t](e)}catch(t){return function(t){return"[object StopIteration]"===v(t)||t instanceof a}(t)?b(t.value):F(t)}return C(r,n,s)}var i=t.apply(this,arguments),n=e.bind(e,"next"),s=e.bind(e,"throw");return n()}},b.spawn=function(t){b.done(b.async(t)())},b.return=function(t){throw new a(t)},b.promised=function(t){return function(){return N([this,W(arguments)],(function(e,i){return t.apply(e,i)}))}},b.dispatch=z,M.prototype.dispatch=function(t,e){var i=this,n=T();return b.nextTick((function(){i.promiseDispatch(n.resolve,t,e)})),n.promise},b.get=function(t,e){return b(t).dispatch("get",[e])},M.prototype.get=function(t){return this.dispatch("get",[t])},b.set=function(t,e,i){return b(t).dispatch("set",[e,i])},M.prototype.set=function(t,e){return this.dispatch("set",[t,e])},b.del=b.delete=function(t,e){return b(t).dispatch("delete",[e])},M.prototype.del=M.prototype.delete=function(t){return this.dispatch("delete",[t])},b.mapply=b.post=function(t,e,i){return b(t).dispatch("post",[e,i])},M.prototype.mapply=M.prototype.post=function(t,e){return this.dispatch("post",[t,e])},b.send=b.mcall=b.invoke=function(t,e){return b(t).dispatch("post",[e,h(arguments,2)])},M.prototype.send=M.prototype.mcall=M.prototype.invoke=function(t){return this.dispatch("post",[t,h(arguments,1)])},b.fapply=function(t,e){return b(t).dispatch("apply",[void 0,e])},M.prototype.fapply=function(t){return this.dispatch("apply",[void 0,t])},b.try=b.fcall=function(t){return b(t).dispatch("apply",[void 0,h(arguments,1)])},M.prototype.fcall=function(){return this.dispatch("apply",[void 0,h(arguments)])},b.fbind=function(t){var e=b(t),i=h(arguments,1);return function(){return e.dispatch("apply",[this,i.concat(h(arguments))])}},M.prototype.fbind=function(){var t=this,e=h(arguments);return function(){return t.dispatch("apply",[this,e.concat(h(arguments))])}},b.keys=function(t){return b(t).dispatch("keys",[])},M.prototype.keys=function(){return this.dispatch("keys",[])},b.all=W,M.prototype.all=function(){return W(this)},b.any=G,M.prototype.any=function(){return G(this)},b.allResolved=(I=$,O="allResolved",k="allSettled",function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(O+" is deprecated, use "+k+" instead.",new Error("").stack),I.apply(I,arguments)}),M.prototype.allResolved=function(){return $(this)},b.allSettled=function(t){return b(t).allSettled()},M.prototype.allSettled=function(){return this.then((function(t){return W(c(t,(function(t){function e(){return t.inspect()}return(t=b(t)).then(e,e)})))}))},b.fail=b.catch=function(t,e){return b(t).then(void 0,e)},M.prototype.fail=M.prototype.catch=function(t){return this.then(void 0,t)},b.progress=function(t,e){return b(t).then(void 0,void 0,e)},M.prototype.progress=function(t){return this.then(void 0,void 0,t)},b.fin=b.finally=function(t,e){return b(t).finally(e)},M.prototype.fin=M.prototype.finally=function(t){if(!t||"function"!=typeof t.apply)throw new Error("Q can't apply finally callback");return t=b(t),this.then((function(e){return t.fcall().then((function(){return e}))}),(function(e){return t.fcall().then((function(){throw e}))}))},b.done=function(t,e,i,n){return b(t).done(e,i,n)},M.prototype.done=function(t,e,i){var n=function(t){b.nextTick((function(){if(m(t,s),!b.onerror)throw t;b.onerror(t)}))},s=t||e||i?this.then(t,e,i):this;"object"==typeof process&&process&&process.domain&&(n=process.domain.bind(n)),s.then(void 0,n)},b.timeout=function(t,e,i){return b(t).timeout(e,i)},M.prototype.timeout=function(t,e){var i=T(),n=setTimeout((function(){e&&"string"!=typeof e||((e=new Error(e||"Timed out after "+t+" ms")).code="ETIMEDOUT"),i.reject(e)}),t);return this.then((function(t){clearTimeout(n),i.resolve(t)}),(function(t){clearTimeout(n),i.reject(t)}),i.notify),i.promise},b.delay=function(t,e){return void 0===e&&(e=t,t=void 0),b(t).delay(e)},M.prototype.delay=function(t){return this.then((function(e){var i=T();return setTimeout((function(){i.resolve(e)}),t),i.promise}))},b.nfapply=function(t,e){return b(t).nfapply(e)},M.prototype.nfapply=function(t){var e=T(),i=h(t);return i.push(e.makeNodeResolver()),this.fapply(i).fail(e.reject),e.promise},b.nfcall=function(t){var e=h(arguments,1);return b(t).nfapply(e)},M.prototype.nfcall=function(){var t=h(arguments),e=T();return t.push(e.makeNodeResolver()),this.fapply(t).fail(e.reject),e.promise},b.nfbind=b.denodeify=function(t){if(void 0===t)throw new Error("Q can't wrap an undefined function");var e=h(arguments,1);return function(){var i=e.concat(h(arguments)),n=T();return i.push(n.makeNodeResolver()),b(t).fapply(i).fail(n.reject),n.promise}},M.prototype.nfbind=M.prototype.denodeify=function(){var t=h(arguments);return t.unshift(this),b.denodeify.apply(void 0,t)},b.nbind=function(t,e){var i=h(arguments,2);return function(){var n=i.concat(h(arguments)),s=T();return n.push(s.makeNodeResolver()),b((function(){return t.apply(e,arguments)})).fapply(n).fail(s.reject),s.promise}},M.prototype.nbind=function(){var t=h(arguments,0);return t.unshift(this),b.nbind.apply(void 0,t)},b.nmapply=b.npost=function(t,e,i){return b(t).npost(e,i)},M.prototype.nmapply=M.prototype.npost=function(t,e){var i=h(e||[]),n=T();return i.push(n.makeNodeResolver()),this.dispatch("post",[t,i]).fail(n.reject),n.promise},b.nsend=b.nmcall=b.ninvoke=function(t,e){var i=h(arguments,2),n=T();return i.push(n.makeNodeResolver()),b(t).dispatch("post",[e,i]).fail(n.reject),n.promise},M.prototype.nsend=M.prototype.nmcall=M.prototype.ninvoke=function(t){var e=h(arguments,1),i=T();return e.push(i.makeNodeResolver()),this.dispatch("post",[t,e]).fail(i.reject),i.promise},b.nodeify=function(t,e){return b(t).nodeify(e)},M.prototype.nodeify=function(t){if(!t)return this;this.then((function(e){b.nextTick((function(){t(null,e)}))}),(function(e){b.nextTick((function(){t(e)}))}))},b.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var X=x();return b}))},1897:t=>{"use strict";t.exports=THREE}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n].call(r.exports,r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";i.r(n);var t={};i.r(t),i.d(t,{CustomViewable:()=>b,SpriteViewable:()=>E,ViewableData:()=>T,ViewableStyle:()=>x,ViewableType:()=>_});var e=i(5354),s=i.n(e),r=Autodesk.Viewing;const o=r.GlobalManagerMixin;class a extends r.ToolInterface{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.names=["HyperionTool"],this.options=e,this.setGlobalManager(t.globalManager),this.viewer=t,this.delegate=e.delegate,this.init(),this.hoveringDbId=0,this.selectedDbId=0}init(){let t=this.viewer.impl;this.activate=t=>{this.active=!0},this.deactivate=t=>{this.clearMarkedObject(),this.active=!1},this.handleSingleClick=(i,n)=>{let s=!1;if(0===n){var r;const n=[],o=t.clientToViewport(i.canvasX,i.canvasY),a=t.renderer(),h=null===(r=a.getOverlayIdTarget)||void 0===r?void 0:r.call(a);if(!h)return!1;const l=a.idAtPixel(o.x,o.y,n,[h]);if(this.selectedDbId!=l||0==this.selectedDbId){if(this.selectedDbId){const t={type:e.MOUSE_CLICK_OUT,dbId:this.selectedDbId,originalEvent:i};this.viewer.dispatchEvent(t),t.hasStopped||(this.clearMarkedObject(),this.viewer.impl.invalidate(!1,!1,!0))}this.selectedDbId=l;const n=t.hitTestViewport(o.clone(),!1),r={type:e.MOUSE_CLICK,dbId:l,clickInfo:n,originalEvent:i};this.viewer.dispatchEvent(r),r.hasStopped||(this.markObject([l]),this.viewer.impl.invalidate(!1,!1,!0)),this.selectedDbId&&(s=!0)}}return s},this.handleSingleTap=t=>this.handleSingleClick(t,0),this.handleDoubleClick=(t,e)=>!1,this.handleButtonDown=t=>(this.buttonDown=!0,!1),this.handleButtonUp=t=>(this.buttonDown=!1,!1),this.handleMouseMove=i=>{if(!this.buttonDown){var n,s;const r=t.clientToViewport(i.canvasX,i.canvasY),o=null===(n=(s=t.renderer()).getOverlayIdTarget)||void 0===n?void 0:n.call(s);if(!o)return!1;const a=[],h=t.renderer().idAtPixel(r.x,r.y,a,[o]);if(this.hoveringDbId!=h){const t=0!=h?h:this.hoveringDbId;this.hoveringDbId=h;const n=0!=h;return this.viewer.dispatchEvent({type:e.MOUSE_HOVERING,dbId:t,hovering:n,originalEvent:i}),!0}}},this.markObject=t=>{if(t instanceof Array||(t=[t]),!this.delegate.hasViewables)return;let e=this.delegate.mapDbIdsToGeometries(t),i=new Set(t);e.map((t=>{if(t&&t.attributes.id&&t.attributes.pointScale){let e=t.attributes.pointScale.array,n=t.attributes.uvp.array,s=t.attributes.color.array,r=t.attributes.id.array;for(let t=0;t<r.length;t+=3){let o=r[t]+(r[t+1]<<8)+(r[t+2]<<16),a=t/3;const h=i.has(o);e[a]=h?1.5:1;let l=this.delegate.viewableData.getViewableUV(o,h);l&&(n[4*a]=l.x,n[4*a+1]=l.y,n[4*a+2]=l.w,n[4*a+3]=l.h);let d=this.delegate.viewableData.getViewableColor(o,h);d&&(s[3*a]=255*d.r,s[3*a+1]=255*d.g,s[3*a+2]=255*d.b)}t.attributes.pointScale.needsUpdate=!0,t.attributes.uvp.needsUpdate=!0,t.attributes.color.needsUpdate=!0}})),this.markedFragments=e},this.clearMarkedObject=()=>{if(!this.delegate.hasViewables)return void(this.markedFragments=[]);const t=this.markedFragments||[];this.markedFragments=[],t&&(t.map((t=>{if(t&&t.attributes.pointScale){let e=t.attributes.pointScale.array,i=t.attributes.uvp.array,n=t.attributes.color.array,s=t.attributes.id.array;for(let t=0;t<s.length;t+=3){let r=s[t]+(s[t+1]<<8)+(s[t+2]<<16),o=t/3;e[o]=1;let a=this.delegate.viewableData.getViewableUV(r,!1);a&&(i[4*o]=a.x,i[4*o+1]=a.y,i[4*o+2]=a.w,i[4*o+3]=a.h);let h=this.delegate.viewableData.getViewableColor(r,!1);h&&(n[3*o]=255*h.r,n[3*o+1]=255*h.g,n[3*o+2]=255*h.b)}t.attributes.pointScale.needsUpdate=!0,t.attributes.uvp.needsUpdate=!0,t.attributes.color.needsUpdate=!0}})),this.viewer.impl.invalidate(!1,!1,!0))},this.invalidateViewablesDirect=(t,e,i,n)=>{if(!t||!e||!n)throw new Error("Parameters of 'invalidateViewables' are mandatory");t instanceof Array||(t=[t]);const s=new Set(t),r=new Map;i.viewables.forEach((t=>r.set(t.dbId,t)));let o=!1;const a=e[0].geometry,h=a.attributes.id.array;for(let t=0;t<h.length;t+=3){const e=h[t]+(h[t+1]<<8)+(h[t+2]<<16);if(!s.has(e))continue;const l=n(r.get(e));if(!l)continue;const d=t/3;if(l.position){const t=a.attributes.position.array;a.attributes.position.needsUpdate=!0,t[3*d+0]=l.position.x,t[3*d+1]=l.position.y,t[3*d+2]=l.position.z,o=!0}if(l.url){const t=i.getSpriteUV(l.url);if(t){const e=a.attributes.uvp.array;a.attributes.uvp.needsUpdate=!0,e[4*d+0]=t.x,e[4*d+1]=t.y,e[4*d+2]=t.w,e[4*d+3]=t.h,o=!0}}if(l.color){const t=a.attributes.color.array;a.attributes.color.needsUpdate=!0,t[3*d+0]=255*l.color.r,t[3*d+1]=255*l.color.g,t[3*d+2]=255*l.color.b,o=!0}if(void 0!==l.scale){if(l.scale>2||l.scale<0){const t=`invalidateViewables: 'scale' of '${l.scale}' out of range [0, 2]`;console.warn(t)}const t=a.attributes.pointScale.array;a.attributes.pointScale.needsUpdate=!0,t[d]=l.scale,o=!0}}o&&this.viewer.impl.invalidate(!1,!1,!0)}}}o.call(a.prototype);var h=i(1048);class l{constructor(t=0,e=0,i=0,n=0,s=!1,r=void 0){this.oversized=!1,this._rot=!1,this._allowRotation=void 0,this._dirty=0,this._width=t,this._height=e,this._x=i,this._y=n,this._data={},this._rot=s,this._allowRotation=r}static Collide(t,e){return t.collide(e)}static Contain(t,e){return t.contain(e)}area(){return this.width*this.height}collide(t){return t.x<this.x+this.width&&t.x+t.width>this.x&&t.y<this.y+this.height&&t.y+t.height>this.y}contain(t){return t.x>=this.x&&t.y>=this.y&&t.x+t.width<=this.x+this.width&&t.y+t.height<=this.y+this.height}get width(){return this._width}set width(t){t!==this._width&&(this._width=t,this._dirty++)}get height(){return this._height}set height(t){t!==this._height&&(this._height=t,this._dirty++)}get x(){return this._x}set x(t){t!==this._x&&(this._x=t,this._dirty++)}get y(){return this._y}set y(t){t!==this._y&&(this._y=t,this._dirty++)}get rot(){return this._rot}set rot(t){if(!1!==this._allowRotation&&this._rot!==t){const e=this.width;this.width=this.height,this.height=e,this._rot=t,this._dirty++}}get allowRotation(){return this._allowRotation}set allowRotation(t){this._allowRotation!==t&&(this._allowRotation=t,this._dirty++)}get data(){return this._data}set data(t){null!==t&&t!==this._data&&(this._data=t,"object"==typeof t&&t.hasOwnProperty("allowRotation")&&(this._allowRotation=t.allowRotation),this._dirty++)}get dirty(){return this._dirty>0}setDirty(t=!0){this._dirty=t?this._dirty+1:0}}class d{constructor(){this._dirty=0}get dirty(){return this._dirty>0||this.rects.some((t=>t.dirty))}setDirty(t=!0){if(this._dirty=t?this._dirty+1:0,!t)for(let t of this.rects)t.setDirty&&t.setDirty(!1)}}class c extends d{constructor(t=p,e=p,i=0,n={}){super(),this.maxWidth=t,this.maxHeight=e,this.padding=i,this.freeRects=[],this.rects=[],this.verticalExpand=!1,this.options={smart:!0,pot:!0,square:!0,allowRotation:!1,tag:!1,exclusiveTag:!0,border:0,logic:f.MAX_EDGE},this.options=Object.assign(Object.assign({},this.options),n),this.width=this.options.smart?0:t,this.height=this.options.smart?0:e,this.border=this.options.border?this.options.border:0,this.freeRects.push(new l(this.maxWidth+this.padding-2*this.border,this.maxHeight+this.padding-2*this.border,this.border,this.border)),this.stage=new l(this.width,this.height)}add(...t){let e,i;if(1===t.length){if("object"!=typeof t[0])throw new Error("MacrectsBin.add(): Wrong parameters");i=t[0];let e=i.data&&i.data.tag?i.data.tag:i.tag?i.tag:void 0;if(this.options.tag&&this.options.exclusiveTag&&this.tag!==e)return}else{if(e=t.length>2?t[2]:null,this.options.tag&&this.options.exclusiveTag){if(e&&this.tag!==e.tag)return;if(!e&&this.tag)return}i=new l(t[0],t[1]),i.data=e,i.setDirty(!1)}const n=this.place(i);return n&&this.rects.push(n),n}repack(){let t=[];this.reset(),this.rects.sort(((t,e)=>{const i=Math.max(e.width,e.height)-Math.max(t.width,t.height);return 0===i&&t.hash&&e.hash?t.hash>e.hash?-1:1:i}));for(let e of this.rects)this.place(e)||t.push(e);for(let e of t)this.rects.splice(this.rects.indexOf(e),1);return t.length>0?t:void 0}reset(t=!1,e=!1){t&&(this.data&&delete this.data,this.tag&&delete this.tag,this.rects=[],e&&(this.options={smart:!0,pot:!0,square:!0,allowRotation:!1,tag:!1,border:0})),this.width=this.options.smart?0:this.maxWidth,this.height=this.options.smart?0:this.maxHeight,this.border=this.options.border?this.options.border:0,this.freeRects=[new l(this.maxWidth+this.padding-2*this.border,this.maxHeight+this.padding-2*this.border,this.border,this.border)],this.stage=new l(this.width,this.height),this._dirty=0}clone(){let t=new c(this.maxWidth,this.maxHeight,this.padding,this.options);for(let e of this.rects)t.add(e);return t}place(t){let e,i,n=t.data&&t.data.tag?t.data.tag:t.tag?t.tag:void 0;if(!this.options.tag||!this.options.exclusiveTag||this.tag===n){if(i=t.hasOwnProperty("_allowRotation")&&void 0!==t.allowRotation?t.allowRotation:this.options.allowRotation,e=this.findNode(t.width+this.padding,t.height+this.padding,i),e){this.updateBinSize(e);let i=this.freeRects.length,n=0;for(;n<i;)this.splitNode(this.freeRects[n],e)&&(this.freeRects.splice(n,1),i--,n--),n++;return this.pruneFreeList(),this.verticalExpand=this.width>this.height,t.x=e.x,t.y=e.y,void 0===t.rot&&(t.rot=!1),t.rot=e.rot?!t.rot:t.rot,this._dirty++,t}if(this.verticalExpand){if(this.updateBinSize(new l(t.width+this.padding,t.height+this.padding,this.border,this.height+this.padding-this.border))||this.updateBinSize(new l(t.width+this.padding,t.height+this.padding,this.width+this.padding-this.border,this.border)))return this.place(t)}else if(this.updateBinSize(new l(t.width+this.padding,t.height+this.padding,this.width+this.padding-this.border,this.border))||this.updateBinSize(new l(t.width+this.padding,t.height+this.padding,this.border,this.height+this.padding-this.border)))return this.place(t)}}findNode(t,e,i){let n,s,r,o=Number.MAX_VALUE;for(let a in this.freeRects)s=this.freeRects[a],s.width>=t&&s.height>=e&&(n=this.options.logic===f.MAX_AREA?s.width*s.height-t*e:Math.min(s.width-t,s.height-e),n<o&&(r=new l(t,e,s.x,s.y),o=n)),i&&s.width>=e&&s.height>=t&&(n=this.options.logic===f.MAX_AREA?s.width*s.height-e*t:Math.min(s.height-t,s.width-e),n<o&&(r=new l(e,t,s.x,s.y,!0),o=n));return r}splitNode(t,e){if(!t.collide(e))return!1;if(e.x<t.x+t.width&&e.x+e.width>t.x){if(e.y>t.y&&e.y<t.y+t.height){let i=new l(t.width,e.y-t.y,t.x,t.y);this.freeRects.push(i)}if(e.y+e.height<t.y+t.height){let i=new l(t.width,t.y+t.height-(e.y+e.height),t.x,e.y+e.height);this.freeRects.push(i)}}if(e.y<t.y+t.height&&e.y+e.height>t.y){if(e.x>t.x&&e.x<t.x+t.width){let i=new l(e.x-t.x,t.height,t.x,t.y);this.freeRects.push(i)}if(e.x+e.width<t.x+t.width){let i=new l(t.x+t.width-(e.x+e.width),t.height,e.x+e.width,t.y);this.freeRects.push(i)}}return!0}pruneFreeList(){let t=0,e=0,i=this.freeRects.length;for(;t<i;){e=t+1;let n=this.freeRects[t];for(;e<i;){let s=this.freeRects[e];if(s.contain(n)){this.freeRects.splice(t,1),t--,i--;break}n.contain(s)&&(this.freeRects.splice(e,1),e--,i--),e++}t++}}updateBinSize(t){if(!this.options.smart)return!1;if(this.stage.contain(t))return!1;let e=Math.max(this.width,t.x+t.width-this.padding+this.border),i=Math.max(this.height,t.y+t.height-this.padding+this.border);if(this.options.allowRotation){const n=Math.max(this.width,t.x+t.height-this.padding+this.border),s=Math.max(this.height,t.y+t.width-this.padding+this.border);n*s<e*i&&(e=n,i=s)}return this.options.pot&&(e=Math.pow(2,Math.ceil(Math.log(e)*Math.LOG2E)),i=Math.pow(2,Math.ceil(Math.log(i)*Math.LOG2E))),this.options.square&&(e=i=Math.max(e,i)),!(e>this.maxWidth+this.padding||i>this.maxHeight+this.padding)&&(this.expandFreeRects(e+this.padding,i+this.padding),this.width=this.stage.width=e,this.height=this.stage.height=i,!0)}expandFreeRects(t,e){this.freeRects.forEach(((i,n)=>{i.x+i.width>=Math.min(this.width+this.padding-this.border,t)&&(i.width=t-i.x-this.border),i.y+i.height>=Math.min(this.height+this.padding-this.border,e)&&(i.height=e-i.y-this.border)}),this),this.freeRects.push(new l(t-this.width-this.padding,e-2*this.border,this.width+this.padding-this.border,this.border)),this.freeRects.push(new l(t-2*this.border,e-this.height-this.padding,this.border,this.height+this.padding-this.border)),this.freeRects=this.freeRects.filter((t=>!(t.width<=0||t.height<=0||t.x<this.border||t.y<this.border))),this.pruneFreeList()}}class u extends d{constructor(...t){if(super(),this.rects=[],1===t.length){if("object"!=typeof t[0])throw new Error("OversizedElementBin: Wrong parameters");const e=t[0];this.rects=[e],this.width=e.width,this.height=e.height,this.data=e.data,e.oversized=!0}else{this.width=t[0],this.height=t[1],this.data=t.length>2?t[2]:null;const e=new l(this.width,this.height);e.oversized=!0,e.data=this.data,this.rects.push(e)}this.freeRects=[],this.maxWidth=this.width,this.maxHeight=this.height,this.options={smart:!1,pot:!1,square:!1}}add(){}reset(t=!1){}repack(){}clone(){return new u(this.rects[0])}}const p=4096;var f;!function(t){t[t.MAX_AREA=0]="MAX_AREA",t[t.MAX_EDGE=1]="MAX_EDGE"}(f||(f={}));class g{constructor(t=p,e=p,i=0,n={}){this.width=t,this.height=e,this.padding=i,this.options={smart:!0,pot:!0,square:!1,allowRotation:!1,tag:!1,exclusiveTag:!0,border:0,logic:f.MAX_EDGE},this._currentBinIndex=0,this.bins=[],this.options=Object.assign(Object.assign({},this.options),n)}add(...t){if(1===t.length){if("object"!=typeof t[0])throw new Error("MacrectsPacker.add(): Wrong parameters");const e=t[0];if(e.width>this.width||e.height>this.height)this.bins.push(new u(e));else{if(!this.bins.slice(this._currentBinIndex).find((t=>void 0!==t.add(e)))){let t=new c(this.width,this.height,this.padding,this.options),i=e.data&&e.data.tag?e.data.tag:e.tag?e.tag:void 0;this.options.tag&&i&&(t.tag=i),t.add(e),this.bins.push(t)}}return e}{const e=new l(t[0],t[1]);if(t.length>2&&(e.data=t[2]),e.width>this.width||e.height>this.height)this.bins.push(new u(e));else{if(!this.bins.slice(this._currentBinIndex).find((t=>void 0!==t.add(e)))){let t=new c(this.width,this.height,this.padding,this.options);this.options.tag&&e.data.tag&&(t.tag=e.data.tag),t.add(e),this.bins.push(t)}}return e}}addArray(t){if(!this.options.tag||this.options.exclusiveTag)this.sort(t,this.options.logic).forEach((t=>this.add(t)));else{if(0===t.length)return;let e;t.sort(((t,e)=>{const i=t.data&&t.data.tag?t.data.tag:t.tag?t.tag:void 0,n=e.data&&e.data.tag?e.data.tag:e.tag?e.tag:void 0;return void 0===n?-1:void 0===i?1:n>i?-1:1}));let i=0;if(!this.bins.slice(this._currentBinIndex).find(((n,s)=>{let r=n.clone();for(let s=i;s<t.length;s++){const o=t[s],a=o.data&&o.data.tag?o.data.tag:o.tag?o.tag:void 0;if(0===s&&(e=a),a!==e)return e=a,this.sort(t.slice(i,s),this.options.logic).forEach((t=>n.add(t))),i=s,this.addArray(t.slice(s)),!0;if(void 0===a)return this.sort(t.slice(s),this.options.logic).forEach((t=>this.add(t))),i=t.length,!0;if(void 0===r.add(o))return this.sort(t.slice(i,s),this.options.logic).forEach((t=>n.add(t))),i=s,!1}return this.sort(t.slice(i),this.options.logic).forEach((t=>n.add(t))),!0}))){const e=t[i],n=new c(this.width,this.height,this.padding,this.options),s=e.data&&e.data.tag?e.data.tag:e.tag?e.tag:void 0;this.options.tag&&this.options.exclusiveTag&&s&&(n.tag=s),this.bins.push(n),n.add(e),i++,this.addArray(t.slice(i))}}}reset(){this.bins=[],this._currentBinIndex=0}repack(t=!0){if(t){let t=[];for(let e of this.bins)if(e.dirty){let i=e.repack();i&&t.push(...i)}return void this.addArray(t)}if(!this.dirty)return;const e=this.rects;this.reset(),this.addArray(e)}next(){return this._currentBinIndex=this.bins.length,this._currentBinIndex}load(t){t.forEach(((t,e)=>{if(t.maxWidth>this.width||t.maxHeight>this.height)this.bins.push(new u(t.width,t.height,{}));else{let i=new c(this.width,this.height,this.padding,t.options);i.freeRects.splice(0),t.freeRects.forEach(((t,e)=>{i.freeRects.push(new l(t.width,t.height,t.x,t.y))})),i.width=t.width,i.height=t.height,t.tag&&(i.tag=t.tag),this.bins[e]=i}}),this)}save(){let t=[];return this.bins.forEach((e=>{let i={width:e.width,height:e.height,maxWidth:e.maxWidth,maxHeight:e.maxHeight,freeRects:[],rects:[],options:e.options};e.tag&&(i=Object.assign(Object.assign({},i),{tag:e.tag})),e.freeRects.forEach((t=>{i.freeRects.push({x:t.x,y:t.y,width:t.width,height:t.height})})),t.push(i)})),t}sort(t,e=f.MAX_EDGE){return t.slice().sort(((t,i)=>{const n=e===f.MAX_EDGE?Math.max(i.width,i.height)-Math.max(t.width,t.height):i.width*i.height-t.width*t.height;return 0===n&&t.hash&&i.hash?t.hash>i.hash?-1:1:n}))}get currentBinIndex(){return this._currentBinIndex}get dirty(){return this.bins.some((t=>t.dirty))}get rects(){let t=[];for(let e of this.bins)t.push(...e.rects);return t}}var v=i(6533),m=i.n(v);const y=Autodesk.Viewing.Private;class w{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1920,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1080,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;this.width=t,this.height=e,this.padding=i,this.spritesMap={},this.pending=[],this.images=[],this.logger=y.logger,this.packer=new g(this.width,this.height,this.padding,{smart:!0,pot:!1,square:!1,allowRotation:!1,tag:!1,border:0}),this.canvas=document.createElement("canvas"),this.hasContent=!1}addSprite(t){if(null==this.spritesMap[t]){let e=m().defer(),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{this.images.push({url:t,image:i,width:i.width,height:i.height}),e.resolve()},i.onerror=t=>{this.logger.error(t),e.resolve()},i.src=t,this.spritesMap[t]=1,this.pending.push(e.promise)}}get canvasWidth(){return this.canvas.width}get canvasHeight(){return this.canvas.height}async finish(){await m().all(this.pending);let t=this.canvas;this.packer.addArray(this.images),this.images.length=0,this.packer.bins.forEach((e=>{t.width=e.width,t.height=e.height;let i=t.getContext("2d");e.rects.forEach((t=>{t.image&&(i.drawImage(t.image,t.x,t.y),t.image=void 0,this.spritesMap[t.url]=t,t.url=void 0)}))}))}spriteUV(t){let e=this.spritesMap[t];return e?{x:e.x/this.canvasWidth,y:e.y/this.canvasHeight,w:(e.x+e.width)/this.canvasWidth,h:(e.y+e.height)/this.canvasHeight}:{x:0,y:0,w:1,h:1}}}const _={SPRITE:1,GEOMETRY:2};class x{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_.SPRITE,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new THREE.Color(16777215),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new THREE.Color(16777215),s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];this.type=t,this.color=e,this.url=i,this.highlightedColor=n,this.highlightedUrl=s,this.spriteUrls=new Set(r)}get preloadedSprites(){return[...this.spriteUrls.values()]}preloadSprite(t){this.spriteUrls.add(t)}}class b{constructor(t,e,i){this._style=e,this._position=t,this._dbId=i}get style(){return this._style}get position(){return this._position}get dbId(){return this._dbId}}class E extends b{constructor(t,e,i){console.assert(e.type==_.SPRITE),super(t,e,i)}get type(){return _.SPRITE}get color(){return this.style.color}get highlightedColor(){return this.style.highlightedColor}}class T{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._styleMap=new Map,this._viewablesMap=new Map,this._spriteAtlas=new w(t.atlasWidth||1920,t.atlasHeight||1080,2)}get viewables(){return[...this._viewablesMap.values()]}get spriteAtlas(){return this._spriteAtlas}addViewable(t){if(t.type==_.SPRITE){let e=new Set;e.add(t.style.url),t.style.highlightedUrl&&e.add(t.style.highlightedUrl),t.style.preloadedSprites.forEach((t=>e.add(t))),e.forEach((t=>this.spriteAtlas.addSprite(t)))}this._viewablesMap.set(t.dbId,t)}getSpriteUV(t){return this._spriteAtlas.spriteUV(t)}getViewableUV(t,e){let i=this._viewablesMap.get(t).style;return e&&i.highlightedUrl?this._spriteAtlas.spriteUV(i.highlightedUrl):this._spriteAtlas.spriteUV(i.url)}getViewableColor(t,e){let i=this._viewablesMap.get(t).style;return e?i.highlightedColor:i.color}async finish(){await this._spriteAtlas.finish()}}var R=i(673);class S{constructor(t,e,i){this._id=t,this._name=e,this._bounds=i,this._devices=[]}set info(t){this._info=t}get id(){return this._id}get name(){return this._name}get bounds(){return this._bounds}get devices(){return this._devices}get info(){return this._info}addDevice(t){this._devices.push(t)}}class M{addRoomToLevel(t,e){this[t]||(this[t]=[]),this[t].push(e)}getRoomsOnLevel(t,e){const i=this[t]||[];return e?i.filter((t=>t.devices.length>0)):i}}class C extends THREE.ShaderMaterial{constructor(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(e.length<2||e.length!=i.length)throw new Error("Heatmap requires at least two colors to work");if(n<0)throw new Error("Heatmap 'confidence' must be a positive number");if(s<0)throw new Error("Heatmap 'powerParameter' must be a positive number");if(r<0||r>1)throw new Error("Heatmap 'alpha' must range between 0.0 and 1.0");const o={uPower:{type:"f",value:s},uAlpha:{type:"f",value:r},uConfidence:{type:"f",value:n},uSensors:{type:"v4v",value:t.map((t=>t))},uStops:{type:"fv1",value:i},uColors:{type:"v3v",value:e}},a=THREE.UniformsUtils.merge([Autodesk.Viewing.Private.ShaderChunks.CutPlanesUniforms,o]),h=e.length,l=t.length;super({uniforms:a,vertexShader:"\n varying vec4 worldCoord;\n\n #if NUM_CUTPLANES > 0\n varying highp vec3 vWorldPosition;\n #endif\n\n void main()\n {\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n worldCoord = modelMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n #if NUM_CUTPLANES > 0\n vWorldPosition = worldCoord.xyz;\n #endif\n }\n ",fragmentShader:`\n varying vec4 worldCoord;\n uniform float uPower;\n uniform float uAlpha;\n uniform float uConfidence;\n uniform vec4 uSensors [${l}];\n uniform float uStops[${h}];\n uniform vec3 uColors[${h}];\n\n #if NUM_CUTPLANES > 0\n varying highp vec3 vWorldPosition;\n #endif\n\n #include <cutplanes>\n\n const float dotSize = 6.0;\n const float h_var1 = 0.4;\n const float h_var2 = 0.25;\n const float two_pi = 2.0 * 3.1415927;\n \n float lmap(float value, float inMin, float inMax, float outMin, float outMax)\n {\n return clamp(outMin + ((outMax - outMin) * (value - inMin)) / (inMax - inMin), outMin, outMax);\n }\n\n // Gradient with multiple colors in non-equal intervals\n vec3 colormap(float x)\n {\n for (int i = 1; i < ${h}; i++) {\n if (x <= uStops[i]) {\n float stopPct = lmap(x, uStops[i-1], uStops[i], 0.0, 1.0);\n return mix(uColors[i-1], uColors[i], stopPct);\n }\n }\n \n // In case 'x' goes beyond upper bound.\n return uColors[${h} - 1];\n }\n\n vec2 get_pix(float angle) {\n float rad = radians(angle);\n float c = cos(rad);\n float s = sin(rad);\n mat2 R = mat2(vec2(c, -s), vec2(s, c));\n return R * gl_FragCoord.xy;\n }\n\n vec3 halftone(float tone, vec3 dotColor, vec3 backgroundColor) {\n vec2 u = get_pix(-45.0) / (dotSize);\n float h = (h_var1 + h_var2 * cos(u.x*two_pi));\n const float e = 0.05;\n float gradient = smoothstep(-e, e, h - tone);\n return mix(dotColor, backgroundColor, gradient);\n }\n\n void main(void) {\n vec3 fragPos = vec3(worldCoord.x, worldCoord.y, worldCoord.z);\n float result = 0.0;\n float sum = 0.0;\n float wsum = 0.000001;\n float minDist = 999999999.0;\n bool found = false; // at exact location of the sensor\n int validSensors = 0;\n\n for (int i=0; i < ${l}; i++) {\n float mydist = distance(fragPos, vec3(uSensors[i][0], uSensors[i][1], uSensors[i][2]));\n if (uSensors[i][3] >= 0.0) {\n if (mydist < 0.00001) {\n result = uSensors[i][3];\n found = true;\n } else {\n float w = (1.0 / (pow(mydist, uPower)));\n sum += (uSensors[i][3] * w);\n wsum += w;\n }\n validSensors += 1;\n if (mydist < minDist) {\n minDist = mydist;\n }\n }\n }\n\n if (validSensors == 0) {\n result = -1.0;\n } else if (!found) {\n result = sum / wsum;\n }\n\n // Defaults without influence from any sensor\n float confidence = 0.0;\n vec3 sensorColor = vec3(0.5, 0.5, 0.5);\n\n if (result >= 0.0) {\n result = clamp(result, 0.0, 1.0);\n confidence = 1.0 - clamp(minDist / uConfidence, 0.0, 1.0);\n sensorColor = colormap(result);\n }\n\n vec3 confidenceColor = halftone(clamp(confidence, 0.3, 0.9), vec3(0.7, 0.7, 0.7), vec3(1.0, 1.0, 1.0));\n gl_FragColor = vec4(mix(confidenceColor, sensorColor, clamp(confidence, 0.0, 1.0)), uAlpha);\n\n\n #if NUM_CUTPLANES > 0\n checkCutPlanes(vWorldPosition);\n #endif\n }\n `,side:THREE.DoubleSide,depthTest:!0,depthWrite:!1}),this.disableEnvMap=!0,this.type="HeatMapMaterial"}update(t,e,i,n){super.update(),isNaN(e)||null===e||(this.uniforms.uConfidence.value=e),isNaN(i)||null===i||(this.uniforms.uPower.value=i),isNaN(n)||null===n||(this.uniforms.uAlpha.value=n),t&&(this.uniforms.uSensors.value=t)}}function P(t){const e=[],i=1/(t-1);for(let n=0;n<t;n++)e.push(i*n);return e}const A="DataVizSurfaceShading",D=9999999.9,I=Autodesk.Viewing.Private;class O{constructor(t,e,i){this.viewer=t,this.model=e,this.shadingData=i,this.activeShadingPoints=[],this.settings={},this._meshes=[],this.registerSensorColors("hatchPattern",[16777215,16777215],.7),this.registerSensorColors("__defaultSensor__",[255,65280,16776960,16711680],.7)}removeShading(){this.viewer.impl.removeMultipleOverlays(A,this._meshes),this._meshes.map((t=>{t.geometry.dispose(),t.material.dispose(),t=null})),this._meshes=[],this.viewer.impl.invalidate(!1,!1,!0)}cleanUp(){this.removeShading(),this._clearActiveShadingPoints(),this.hatchMaterial&&(this.hatchMaterial.dispose(),delete this.hatchMaterial)}_clearActiveShadingPoints(){this.activeShadingPoints.forEach((t=>t.heatmapMaterial.dispose())),this.activeShadingPoints=[]}_createHatchMaterial(){let t=this.settings.hatchPattern;return new C([new THREE.Vector4(D,D,D,-1)],t.colors,t.stops,60,2,t.alpha)}registerSensorColors(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.7;this.settings[t]={stops:P(e.length),colors:e.map((t=>new THREE.Color(t))).map((t=>new THREE.Vector3(t.r,t.g,t.b))),alpha:i}}getSetting(t){return this.settings[t]?this.settings[t]:this.settings.__defaultSensor__}render(t,e,i,n){let s=n?n.confidence:0;s=isNaN(s)?0:Math.abs(s);let r=2;n&&"number"==typeof n.powerParameter&&(r=n.powerParameter);let o=[];t instanceof Array?t.forEach((t=>this.shadingData.getLeafsById(t,o))):o=this.shadingData.getLeafsById(t);let a=this.model.getInstanceTree();this._clearActiveShadingPoints();let h=this._meshes;const l=this.viewer.impl,d=this.activeShadingPoints;function c(t,e){let i=a.fragList.getGeometry(t);if(!i)return void I.logger.error("Geometry for the fragment is empty, FragId:",t);let n=new THREE.Mesh(i,e),s=new THREE.Matrix4;a.fragList.getWorldMatrix(t,s),n.matrix.copy(s),n.matrixWorldNeedsUpdate=!0,n.matrixAutoUpdate=!1,n.frustumCulled=!1,h.push(n),l.addOverlay(A,n)}l.overlayScenes[A]||l.createOverlayScene(A),this.hatchMaterial||(this.hatchMaterial=this._createHatchMaterial(),l.matman().addMaterial("heatmap_hatchMaterial",this.hatchMaterial,!0));const u=this.getSetting(e);for(let t=0;o&&t<o.length;t++){const n=o[t],a=(0,R.filterShadingPointsByType)(n.shadingPoints,e);let p=this.hatchMaterial;if(a.length>0){let o=s;if(n.bounds&&!s){const t=n.bounds.max,e=n.bounds.min;o=t.x-e.x+(t.y-e.y)+(t.z-e.z)}o=o||160;const h=[];a.forEach((t=>{const n=t.position,s=i(t,e),r=new THREE.Vector4(n.x,n.y,n.z,s);h.push(r)})),p=new C(h,u.colors,u.stops,o,r,u.alpha),l.matman().addMaterial("heatmap_Material_"+t,p,!0),d.push({shadingPoints:a,sensorType:e,heatmapMaterial:p})}n.fragIds.forEach((t=>c(t,p))),this._meshes=h}}updateShading(t,e){let i,n,s;e&&(i=e.confidence,n=e.powerParameter,s=e.alpha);for(var r=0;r<this.activeShadingPoints.length;r++){const{shadingPoints:e,sensorType:o,heatmapMaterial:a}=this.activeShadingPoints[r],h=[];for(let i of e){const e=i.position,n=t(i,o);h.push(new THREE.Vector4(e.x,e.y,e.z,n))}a.update(h,i,n,s)}this.viewer.impl.invalidate(!1,!1,!0)}}var k=i(1801),H=i.n(k);const V="DataVizPlanarHeatmap";class B{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n=this._handleLegacyOptions(n);const{width:s,height:r,minOpacity:o,maxOpacity:a}=n;this.options=n;let h=document.createElement("canvas");h.width=s,h.height=r,this.config={canvas:h,width:s,height:r,minOpacity:o,maxOpacity:a,radius:20},this.model=e,this.viewer=t,this.shadingData=i;let l=new THREE.Texture(h,THREE.UVMapping);l.minFilter=THREE.LinearFilter,l.flipY=!1,this.material=new THREE.MeshBasicMaterial({map:l,depthTest:!0,depthWrite:!1,transparent:!0,side:THREE.DoubleSide}),this.gradientMap={},this._mesh=null}_handleLegacyOptions(t){if("string"==typeof(t=Object.assign({width:1024,height:1024,slicingEnabled:!0},t)).position){const e={min:0,middle:.5,max:1};t.slicingPosition=e[t.position]}if("string"==typeof t.placePosition){const e={min:0,max:1};t.placementPosition=e[t.placePosition]}function e(t,e){return null==t||"number"!=typeof t?e:t<0?0:t>1?1:t}return delete t.position,delete t.placePosition,t.slicingPosition=e(t.slicingPosition,.5),t.placementPosition=e(t.placementPosition,0),t}_setup(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,{model:n,shadingData:s}=this,r=new THREE.Box3,o=n.getInstanceTree(),a=[],h={},l=[],d={};this.gradientMap[e]&&(this.config.gradient=this.gradientMap[e]),this.config.radius=i,t.forEach((t=>s.getLeafsById(t,a)));for(let t=0;t<a.length;t++)null==(c=a[t]).shadingPoints||c.shadingPoints&&0==c.shadingPoints.length||null==c.shadingPoints.find((t=>t.types.find((t=>t==e))))||a[t].dbIds.forEach((t=>{if(o.getNodeBox(t,l),l[0]!=1/0){let e=new THREE.Box3(new THREE.Vector3(l[0],l[1],l[2]),new THREE.Vector3(l[3],l[4],l[5]));r.union(e),h[t]=e}}));var c;const u=r.min.x,p=r.min.y,f=r.max.x-u,g=r.max.y-p;let{slicingEnabled:v,width:m,height:y}=this.options;if(f>g?y=m/f*g:m=y/g*f,this.config.canvas.width=m,this.config.canvas.height=y,this.config.width=m,this.config.height=y,this.heatmapInstance)this.heatmapInstance.configure(this.config);else{let t=document.createElement("div");t.width=m,t.height=y,this.config.container=t,this.heatmapInstance=H().create(this.config),t.removeChild(this.config.canvas),delete this.config.container}let w=[],_=[],x=[];const b=Autodesk.Viewing.Extensions.CompGeom,E=this.options.slicingPosition,T=this.options.placementPosition;var S=n.getFragmentList();for(let t=0;t<a.length;t++){let i=a[t];const n=(0,R.filterShadingPointsByType)(i.shadingPoints,e);if(!(n.length<=0)){if(v){let t=new THREE.Vector3(0,0,1);var M=[];i.dbIds.forEach((e=>{const i=h[e],{min:n,max:s}=i,r=n.z+(s.z-n.z)*E,a=n.z+(s.z-n.z)*T,l=new THREE.Plane(t,-r);var d=b.makePlaneBasis(l);o.enumNodeFragments(e,(t=>{const e=S.getGeometry(t),i=S.getMaterial(t),n=new THREE.Matrix4;S.getWorldMatrix(t,n),e&&!e.is2d&&!e.isLines&&i.cutplanes&&b.xMeshPlane(l,{geometry:e,matrixWorld:n,fragId:t},M)}),!0);var c=new THREE.Box3;b.convertToPlaneCoords(d,M,c);var v=new b.EdgeSet(M,c,1e-6*c.getSize(new THREE.Vector3).length());v.snapEdges(),v.sanitizeEdges(),v.stitchContours();var m=v.triangulate();if(m&&!m.triangulationFailed){var y=m.toPolygonMesh();let t=w.length/3,e=y.attributes.position.array;for(let t=0,i=e.length;t<i;t+=3)w.push(e[t],e[t+1],a),_.push((e[t]-u)/f,(e[t+1]-p)/g);let i=y.index.array;for(let e=0,n=i.length;e<n;e++)x.push(i[e]+t)}}))}else i.dbIds.forEach((t=>{let e=h[t];if(!e.isEmpty()){const{min:t,max:i}=e,n=t.z+(i.z-t.z)*T;let s=w.length/3;x.push(s,s+2,s+1,s,s+3,s+2),w.push(t.x,t.y,n,t.x,i.y,n,i.x,i.y,n,i.x,t.y,n),_.push((t.x-u)/f,(t.y-p)/g,(t.x-u)/f,(i.y-p)/g,(i.x-u)/f,(i.y-p)/g,(i.x-u)/f,(t.y-p)/g)}}));for(let t of n){let e={x:Math.round((t.position.x-u)/f*m),y:Math.round((t.position.y-p)/g*y),value:0};d[t.id]={data:e,shadingPoint:t}}}}w=new Float32Array(w),_=new Float32Array(_),x=new Uint16Array(x);let C=new THREE.BufferGeometry,P=new THREE.BufferAttribute(w,3);P.bytesPerItem=4;let A=new THREE.BufferAttribute(_,2);A.bytesPerItem=4;let D=new THREE.BufferAttribute(x,1);C.setIndex(D),C.setAttribute("position",P),C.setAttribute("uv",A),this.geometry=C;let I=this.viewer.impl;I.overlayScenes[V]||I.createOverlayScene(V);let O=new THREE.Mesh(C,this.material);I.addOverlay(V,O),this.totalBounds=r,this.pointDataMap=d,this.currentSensorType=e,this._mesh=O}render(t,e,i,n){let s=200;"number"==typeof n?s=Math.abs(n):"object"==typeof n&&n.confidence&&(s=n.confidence),this.geometry&&(this.geometry.dispose(),this.geometry=null),t=t instanceof Array?t:[t],this._setup(t,e,s),this.updateShading(i)}updateShading(t){const e=[];for(let i in this.pointDataMap){const n=this.pointDataMap[i],s=t(n.shadingPoint,this.currentSensorType,n.data);n.data.value=0===s?1e-4:s,isNaN(n.data.value)||e.push(n.data)}this.heatmapInstance.setData({data:e,min:0,max:1}),this.material.map.needsUpdate=!0,this.viewer.impl.invalidate(!1,!1,!0)}cleanUp(){this.removeShading(),this.geometry&&(this.geometry.dispose(),this.geometry=null),this.material&&(this.material.dispose(),this.material=null)}removeShading(){this._mesh&&(this.viewer.impl.removeOverlay(V,this._mesh),this._mesh.geometry.dispose(),this._mesh.material.dispose(),this._mesh=null),this.viewer.impl.invalidate(!1,!1,!0)}registerSensorColors(t,e){let i={},n=e.length-1;for(let t=0;t<e.length;t++)i[(t/n).toFixed(3)]=`rgb(${(s=e[t])>>16&255}, ${s>>8&255}, ${255&s})`;var s;this.gradientMap[t]=i}}class j{constructor(t){this.viewer=t,this._textures={},this._colors={},this._excluded=["__defaultMaterial__","__fadeMaterial__","__highlightMaterial__","__dataVizSpriteMaterial__"]}show(){return this.hideTextures(),this.regen(),!0}hide(){return this.showTextures(),this.regen(),!0}regen(){this.viewer.refresh(!0)}hideTextures(){const t=0===Object.keys(this._textures).length,e=new THREE.Color(1,1,1),i=this.viewer.impl.matman()._materials;for(const n in i)if(-1===this._excluded.indexOf(n)){const s=i[n];t&&(this._textures[n]=s.map,this._colors[n]=s.color),s.map=null,s.color=e,s.needsUpdate=!0}this.regen()}showTextures(){if(Object.keys(this._textures).length>0){const t=this.viewer.impl.matman()._materials;for(const e in t)if(-1===this._excluded.indexOf(e)){const i=t[e],n=this._textures[e];n&&(i.map=n);const s=this._colors[e];s&&(i.color=s),i.needsUpdate=!0}}this.regen()}}class U extends THREE.ShaderMaterial{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;n=parseFloat(n).toFixed(3);super({uniforms:{dataTexture:{type:"t",value:null},vertexTexture:{type:"t",value:null},uPower:{type:"f",value:n},uDataCount:{type:"i",value:i},uDataTextureWidth:{type:"i",value:1}},vertexShader:"\n varying vec2 vUV;\n\n void main()\n {\n vUV = uv;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;\n }\n ",fragmentShader:"\n varying vec2 vUV;\n\n uniform float uPower;\n uniform int uDataCount;\n uniform int uDataTextureWidth;\n \n uniform sampler2D dataTexture;\n uniform sampler2D vertexTexture;\n \n void main(void) {\n // The position of the vertex whose value is to be determined.\n vec4 vertex = texture2D(vertexTexture, vUV);\n \n if (vertex.w < 0.) {\n // This is an invalid vertex, mark as transparent.\n gl_FragColor = vec4(0., 0., 0., 1.);\n return;\n }\n \n float sum = 0.;\n float wsum = 0.;\n float factor = 1. / float(uDataTextureWidth);\n float textureWidth = float(uDataTextureWidth);\n \n // Compute weighted influence from all the data points.\n for (int index = 0; index < uDataCount; index++)\n {\n float i = float(index);\n float y = floor(i / textureWidth);\n float x = mod(i, textureWidth);\n \n vec2 dUV = vec2((x + 0.5) * factor, (y + 0.5) * factor);\n vec4 dataPoint = texture2D(dataTexture, dUV);\n \n float dist = distance(vertex.xyz, dataPoint.xyz);\n \n if (dist < 0.0001) {\n gl_FragColor = vec4(dataPoint.w, 0., 0., 1.);\n return;\n }\n \n float w = 1. / dist;\n w = pow(w, uPower);\n \n sum += dataPoint.w * w;\n wsum += w;\n }\n \n gl_FragColor = vec4(sum/wsum , 0., 0., 1.);\n }\n ",side:THREE.DoubleSide,depthTest:!0,depthWrite:!0}),this.vertexTexture=t,this.dataTexture=e}set vertexTexture(t){t&&(this.uniforms.vertexTexture.value=t)}set dataTexture(t){t&&(this.uniforms.dataTexture.value=t,this.uniforms.uDataTextureWidth.value=t.image.width)}}function F(t,e,i,n,s){if(t=t.subarray||t.slice?t:t.buffer,i=i.subarray||i.slice?i:i.buffer,t=e?t.subarray?t.subarray(e,s&&e+s):t.slice(e,s&&e+s):t,i.set)i.set(t,n);else for(let e=0;e<t.length;e++)i[e+n]=t[e];return i}class L{constructor(){this._position=[],this._prev=[],this._next=[],this._side=[],this._width=[],this._index=[],this._widthCallback=null,this._geometry=null}get geometry(){return this._geometry}dispose(){this._geometry&&(this._geometry.dispose(),this._geometry=null)}setPoints(t,e){if(!(t instanceof Float32Array)||0===t.length)throw new Error("Input points must be of Float32Array type");this._widthCallback=e,this._position=[];for(let e=0;e<t.length;e+=3)this._position.push(t[e],t[e+1],t[e+2]),this._position.push(t[e],t[e+1],t[e+2]);this.process()}compareV3(t,e){const i=6*t,n=6*e;return this._position[i]===this._position[n]&&this._position[i+1]===this._position[n+1]&&this._position[i+2]===this._position[n+2]}copyV3(t){const e=6*t;return{x:this._position[e],y:this._position[e+1],z:this._position[e+2]}}updateAttribute(t,e){t.set(e),t.needsUpdate=!0}process(){const t=this._position.length/6;this._prev=[],this._next=[],this._side=[],this._width=[],this._index=[];const e=this.compareV3(0,t-1);{const i=e?t-2:0,{x:n,y:s,z:r}=this.copyV3(i);this._prev.push(n,s,r),this._prev.push(n,s,r)}for(var i=0;i<t;i++){this._side.push(1),this._side.push(-1);let e=1;if(this._widthCallback&&(e=this._widthCallback(i/(t-1))),this._width.push(e),this._width.push(e),i<t-1){const{x:t,y:e,z:s}=this.copyV3(i);this._prev.push(t,e,s),this._prev.push(t,e,s);var n=2*i;this._index.push(n,n+1,n+2),this._index.push(n+2,n+1,n+3)}if(i>0){const{x:t,y:e,z:n}=this.copyV3(i);this._next.push(t,e,n),this._next.push(t,e,n)}}{const i=e?1:t-1,{x:n,y:s,z:r}=this.copyV3(i);this._next.push(n,s,r),this._next.push(n,s,r)}const s=new Float32Array(this._position),r=new Float32Array(this._prev),o=new Float32Array(this._next),a=new Float32Array(this._side),h=new Float32Array(this._width),l=new Uint16Array(this._index);this._attributes&&this._attributes.position.length===this._position.length?(this.updateAttribute(this._attributes.position,s),this.updateAttribute(this._attributes.prev,r),this.updateAttribute(this._attributes.next,o),this.updateAttribute(this._attributes.side,a),this.updateAttribute(this._attributes.width,h),this.updateAttribute(this._attributes.index,l)):this._attributes={position:new THREE.BufferAttribute(s,3),prev:new THREE.BufferAttribute(r,3),next:new THREE.BufferAttribute(o,3),side:new THREE.BufferAttribute(a,1),width:new THREE.BufferAttribute(h,1),index:new THREE.BufferAttribute(l,1)},this._geometry||(this._geometry=new THREE.BufferGeometry),this._geometry.setAttribute("position",this._attributes.position),this._geometry.setAttribute("prev",this._attributes.prev),this._geometry.setAttribute("next",this._attributes.next),this._geometry.setAttribute("side",this._attributes.side),this._geometry.setAttribute("width",this._attributes.width),this._geometry.setIndex(this._attributes.index),this._geometry.computeBoundingSphere(),this._geometry.computeBoundingBox(),this._geometry.visible=!0}advance(t){var e=this._attributes.position.array,i=this._attributes.prev.array,n=this._attributes.next.array,s=e.length;F(e,0,i,0,s),F(e,6,e,0,s-6),e[s-6]=t.x,e[s-5]=t.y,e[s-4]=t.z,e[s-3]=t.x,e[s-2]=t.y,e[s-1]=t.z,F(e,6,n,0,s-6),n[s-6]=t.x,n[s-5]=t.y,n[s-4]=t.z,n[s-3]=t.x,n[s-2]=t.y,n[s-1]=t.z,this._attributes.position.needsUpdate=!0,this._attributes.prev.needsUpdate=!0,this._attributes.next.needsUpdate=!0}}function N(t){function e(t,e){return void 0===t?e:t}THREE.Material.call(this),t=t||{},t=Object.assign(t,{side:THREE.DoubleSide,depthTest:!0,depthWrite:!1}),this.lineColor=e(t.lineColor,new THREE.Color(16777215)),this.opacity=e(t.opacity,1),this.lineWidth=e(t.lineWidth,6),delete t.lineColor,delete t.opacity,delete t.lineWidth;const i=new THREE.RawShaderMaterial({uniforms:{lineWidth:{type:"f",value:this.lineWidth},color:{type:"c",value:this.lineColor},opacity:{type:"f",value:this.opacity},resolution:{type:"v2",value:new THREE.Vector2(1920,1080)},sizeAttenuation:{type:"f",value:0}},attributes:{position:{type:"v3",value:new THREE.Vector3},prev:{type:"v3",value:new THREE.Vector3},next:{type:"v3",value:new THREE.Vector3},side:{type:"f",value:0},width:{type:"f",value:0}},vertexShader:"\n attribute vec3 position;\n attribute vec3 prev;\n attribute vec3 next;\n attribute float side;\n attribute float width;\n\n uniform mat4 projectionMatrix;\n uniform mat4 modelViewMatrix;\n uniform vec2 resolution;\n uniform float lineWidth;\n uniform vec3 color;\n uniform float opacity;\n uniform float sizeAttenuation;\n\n varying vec4 vColor;\n\n vec2 fix( vec4 i, float aspect ) {\n\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n\n void main() {\n float aspect = resolution.x / resolution.y;\n\n vColor = vec4( color, opacity );\n\n mat4 m = projectionMatrix * modelViewMatrix;\n vec4 finalPosition = m * vec4( position, 1.0 );\n vec4 prevPos = m * vec4( prev, 1.0 );\n vec4 nextPos = m * vec4( next, 1.0 );\n\n vec2 currP = fix( finalPosition, aspect );\n vec2 prevP = fix( prevPos, aspect );\n vec2 nextP = fix( nextPos, aspect );\n\n float w = lineWidth * width;\n\n vec2 dir;\n if ( nextP == currP ) {\n dir = normalize( currP - prevP );\n }\n else if( prevP == currP ) {\n dir = normalize( nextP - currP );\n }\n else {\n vec2 dir1 = normalize( currP - prevP );\n vec2 dir2 = normalize( nextP - currP );\n dir = normalize( dir1 + dir2 );\n\n vec2 perp = vec2( -dir1.y, dir1.x );\n vec2 miter = vec2( -dir.y, dir.x );\n w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );\n }\n\n vec4 normal = vec4( -dir.y, dir.x, 0., 1. );\n normal.xy *= .5 * w;\n normal *= projectionMatrix;\n\n if ( sizeAttenuation == 0. ) {\n normal.xy *= finalPosition.w;\n normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;\n }\n\n finalPosition.xy += normal.xy * side;\n gl_Position = finalPosition;\n }\n",fragmentShader:"\n varying vec4 vColor;\n\n void main() {\n gl_FragColor = vColor;\n }\n"});return i.type="StreamLineMaterial",i.setValues(t),i}N.prototype=Object.create(THREE.Material.prototype),N.prototype.constructor=N,N.prototype.copy=function(t){return THREE.Material.prototype.copy.call(this,t),this},N.prototype.id=function(){return N.generateId(this.lineColor,this.opacity,this.lineWidth)},N.generateId=function(t,e,i){return`${t.getHexString()}-${e.toFixed(4)}-${i.toFixed(4)}`};const z="StreamLineOverlay";class W{constructor(t){this._viewer=t,this._overlayCreated=!1,this._streamLines=[],this._cachedMaterials={}}dispose(){this._streamLines.forEach((t=>{let{streamLine:e,mesh:i}=t;this._removeMeshFromScene(i),e.dispose()})),this._streamLines=[];Object.values(this._cachedMaterials).forEach((t=>t.dispose())),this._cachedMaterials={},this._overlayCreated&&(this._overlayCreated=!1,this._viewer.impl.removeOverlayScene(z))}createStreamLine(t){const e=new L;e.setPoints(new Float32Array(t.lineData.points));const i=this._getOrCreateMaterial(t),n=new THREE.Mesh(e.geometry,i);return this._addMeshToScene(n),this._streamLines.push({streamLine:e,mesh:n}),e}destroyStreamLine(t){const e=this._streamLines.findIndex((e=>e.streamLine===t));if(e>=0){const t=this._streamLines.splice(e,1);this._removeMeshFromScene(t[0].mesh),t[0].streamLine.dispose()}}_addMeshToScene(t){this._overlayCreated||(this._overlayCreated=!0,this._viewer.impl.createOverlayScene(z)),this._viewer.impl.addOverlay(z,t)}_removeMeshFromScene(t){this._overlayCreated&&this._viewer.impl.removeOverlay(z,t)}_getOrCreateMaterial(t){const e=t.lineColor,i=t.opacity,n=t.lineWidth,s=N.generateId(e,i,n);let r=this._cachedMaterials[s];return r||(r=new N({lineColor:e,opacity:i,lineWidth:n}),this._cachedMaterials[s]=r),r}}const G="Autodesk.DataVisualization";var $=AutodeskNamespace(G+".Core");$=Object.assign($,t),$=Object.assign($,s()),($=Object.assign($,R)).Room=S,$.LevelRoomsMap=M,$.ModelStructureInfo=class{constructor(t){this.model=t,this.rooms=null}getImmediateChildNodesByName(t,e){const i=this.model.getInstanceTree(),n=[];return i&&(e=null==e?i.getRootId():e,i.enumNodeChildren(e,(e=>{const s=i.getNodeName(e,!0);s&&s.indexOf&&s.indexOf(t)>=0&&n.push(e)}),!1)),n}async getLevelRoomsMap(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1?arguments[1]:void 0;if(!this.levelRoomsMap){const i=new M;(await this.getRoomList(e)).forEach((e=>{const n=this.getLevel(e);t||(e.info=void 0),null!=n&&i.addRoomToLevel(n,e)})),this.levelRoomsMap=i}return this.levelRoomsMap}getLevel(t){if(t&&t.info&&t.info.properties){const e=t.info.properties.find((t=>20==t.type&&"Level"==t.attributeName));return e?e.displayValue:void 0}}async getRoomList(t){if(!this.rooms){t=t||"Rooms";const e=this.getImmediateChildNodesByName(t),i=this.model,n=[];if(e&&e.length>0){const t=e[0],s=i.getInstanceTree();s&&s.enumNodeChildren(t,(t=>{const e=s.getNodeName(t,!0),i=this.getRoomBounds(t);n.push(new S(t,e,i))}),!1)}const s=n.map((t=>new Promise(((e,n)=>{i.getProperties2(t.id,(i=>{t.info=i,e(t)}),(i=>{e(t)}))}))));await Promise.all(s),this.rooms=n}return this.rooms}getRoomBounds(t){const e=new THREE.Box3,i=new THREE.Box3,n=this.model.getInstanceTree(),s=this.model.getFragmentList();return n&&n.enumNodeFragments(t,(t=>{s.getWorldBounds(t,i),e.union(i)}),!0),e}async mapDevicesInRoom(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;const i=await this.getRoomList(e);t=t.slice(0);for(let e=0;t.length>0&&e<i.length;e++){const n=i[e];for(let e=0;e<t.length;e++){const i=t[e];this.roomGeomContainsPoint(n,i.position)&&(i.roomId=n.id,n.addDevice(i),t.splice(e,1),e--)}}if(t.length>0){const e=t.map((t=>`${t.id} (${t.name})`));console.warn(`Some devices did not map to a room: ${e.join(", ")}`)}}async generateSurfaceShadingData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;e||(e=await this.getLevelRoomsMap(!1,i),await this.mapDevicesInRoom(t,i));const n=new R.SurfaceShadingData;for(let t in e){const i=e[t],s=new R.SurfaceShadingGroup(t);i.forEach((t=>{const e=new R.SurfaceShadingNode(t.name,t.id);t.devices.forEach((t=>{let i=t.deviceModel?t.deviceModel.id:t.type;e.addPoint(new R.SurfaceShadingPoint(t.id,t.position,t.sensorTypes,t.name,{styleId:i}))})),s.addChild(e)})),n.addChild(s)}return n.initialize(this.model),n}roomGeomContainsPoint(t,e){return t.bounds&&t.bounds.containsPoint(e)}},$.SurfaceShading=O,$.PlanarHeatmap=B,$.IDWDataProcessor=class{constructor(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.viewer=t,this.min=n.min,this.max=n.max;let{colors:s}=n;s?this.setColors(s):this.setColors([255,65535,65280,16776960,16711680]),this.setVertices(e),this.setDataPoints(i),this.initializeRender()}setVertices(t){this.vertexTexture&&(this.vertexTexture.dispose(),this.vertexTexture=null);const e=Math.ceil(Math.sqrt(t.length/3)),i=new Float32Array(e*e*4);i.fill(-1);for(let e=0,n=t.length/3;e<n;e++)i[4*e]=t[3*e],i[4*e+1]=t[3*e+1],i[4*e+2]=t[3*e+2],i[4*e+3]=1;const n=new THREE.DataTexture(i,e,e,THREE.RGBAFormat,THREE.FloatType,THREE.UVMapping,THREE.ClampToEdgeWrapping,THREE.ClampToEdgeWrapping,THREE.NearestFilter,THREE.NearestFilter);n.generateMipmaps=!1,n.needsUpdate=!0,this.vertexTexture=n,this.verticesLength=t.length,this.vertexValues=new Uint8Array(e*e*4)}setDataPoints(t){this.dataTexture&&(this.dataTexture.dispose(),this.dataTexture=null);const e=Math.ceil(Math.sqrt(t.length/4)),i=new Float32Array(e*e*4);let{min:n,max:s}=this;if(null==n||null==s){n=1/0,s=-1/0;for(let e=0;e<t.length;e+=4)n=Math.min(n,t[e+3]),s=Math.max(s,t[e+3])}const r=s-n||1;for(let e=0;e<t.length;e+=4)i[e]=t[e],i[e+1]=t[e+1],i[e+2]=t[e+2],i[e+3]=(t[e+3]-n)/r;const o=new THREE.DataTexture(i,e,e,THREE.RGBAFormat,THREE.FloatType,THREE.UVMapping,THREE.ClampToEdgeWrapping,THREE.ClampToEdgeWrapping,THREE.NearestFilter,THREE.NearestFilter);o.generateMipmaps=!1,o.needsUpdate=!0,this.dataTexture=o,this.dataCount=t.length/4}initializeRender(){const t=new U(this.vertexTexture,this.dataTexture,this.dataCount),e=new THREE.PlaneBufferGeometry(2,2,1,1),i=new THREE.OrthographicCamera(-1,1,-1,1,0,1),n=this.vertexTexture.image.width,s=new THREE.WebGLRenderTarget(n,n,{minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat,stencilBuffer:!1,depthBuffer:!1}),r=new THREE.Mesh(e,t);r.frustumCulled=!1,this.scene=new THREE.Scene,this.scene.add(r),this.material=t,this.renderTarget=s,this.planeGeometry=e,this.camera=i}setColors(t){if(t){this.colors=t.map((t=>new THREE.Color(t))),this.stops=this._createColorStops(t.length),this.colorMapData=[];for(let t=0;t<256;t++)this.colorMapData.push(this._mapValueToColor(t/255))}}_createColorStops(t){const e=[],i=1/(t-1);for(let n=0;n<t;n++)e.push(i*n);return e}_mapValueToColor(t){let{colors:e,stops:i}=this;function n(t,e,i){return t*(1-i)+e*i}function s(t,e,i){let s=new THREE.Color;return s.r=n(t.r,e.r,i),s.g=n(t.g,e.g,i),s.b=n(t.b,e.b,i),s}let r=e[i.length-1];for(let n=1;n<i.length;n++)if(t<=i[n]){let o=(t-i[n-1])/(i[n]-i[n-1]);r=s(e[n-1],e[n],o);break}return{r:Math.round(255*r.r),g:Math.round(255*r.g),b:Math.round(255*r.b)}}process(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{colors:e,power:i,outputTarget:n}=t;e&&this.setColors(e),null==i&&(i=1),this.material.uniforms.uPower.value=i;const s=this.vertexTexture.image.width;this.renderTarget.width!=s&&this.renderTarget.setSize(s,s);const r=this.viewer.impl.glrenderer();return r.setRenderTarget(this.renderTarget),r.render(this.scene,this.camera,!0),r.readRenderTargetPixels(this.renderTarget,0,0,s,s,this.vertexValues),this._getColorValues(n)}_getColorValues(t){let e;e=t&&t.length==this.verticesLength?t:new Uint8Array(this.verticesLength);const i=this.vertexValues;for(let t=0,n=this.verticesLength/3;t<n;t++){const n=4*t;if(i[n+3]<128)continue;const s=i[n],r=this.colorMapData[s];e[3*t]=r.r,e[3*t+1]=r.g,e[3*t+2]=r.b}return e}cleanUp(){setTimeout((()=>{this.vertexTexture&&(this.vertexTexture.dispose(),this.vertexTexture=null),this.dataTexture&&(this.dataTexture.dispose(),this.dataTexture=null),this.renderTarget&&(this.renderTarget.dispose(),this.renderTarget=null),this.material&&(this.material.dispose(),this.material=null),this.planeGeometry&&(this.planeGeometry.dispose(),this.planeGeometry=null)}),32)}},$.IDWProcessMaterial=U;const X=Autodesk.Viewing,q=X.Private,Q="DataVizDots";class Y extends X.Extension{constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),this.textureUtility=new j(t),this.pointMeshes=[],this._streamLineBuilder=null,this._onInstanceTreeReady=this._onInstanceTreeReady.bind(this),this.model=null}async load(){return this.tool=new a(this.viewer,{delegate:this}),this.viewer.toolController.registerTool(this.tool),this.activate(),this.instanceTreeReadyPromise=new Promise(((t,e)=>{this.instanceTreeReadyPromiseResolve=t,this.instanceTreeReadyPromiseReject=e})),this.datavizDotOverlay=this.viewer.impl.createOverlayScene(Q,null,null,null,!0,!0),this.viewer.addEventListener(Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT,this._onInstanceTreeReady),this.deviceDepthOcclusion=!1,this.surfaceShading={},!0}unload(){return this.viewer.toolController.deregisterTool(this.tool),this.viewer.removeEventListener(Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT,this._onInstanceTreeReady),this.removeSurfaceShading(),this.surfaceShading=null,this.model=null,this.showTextures(),this.removeAllViewables(),this._streamLineBuilder&&(this._streamLineBuilder.dispose(),this._streamLineBuilder=null),this.deactivate(),!0}activate(){return this.viewer.toolController.activateTool(this.tool.getName()),!0}deactivate(){return this.viewer.toolController.deactivateTool(this.tool.getName()),!0}_onInstanceTreeReady(t){this.instanceTreeReadyPromiseResolve&&this.instanceTreeReadyPromiseResolve()}async waitForInstanceTree(t){t.getInstanceTree()?this.instanceTreeReadyPromiseResolve():await this.instanceTreeReadyPromise}get hasViewables(){return this.pointMeshes&&this.pointMeshes.length>0&&this.viewableData}get streamLineBuilder(){return this._streamLineBuilder||(this._streamLineBuilder=new W(this.viewer)),this._streamLineBuilder}mapDbIdsToGeometries(t){const e=this.dbId2Geometry||{};let i=new Set;return t.map((t=>{const n=e[t];n&&i.add(n)})),Array.from(i)}addViewables(t){const e=THREE.ImageUtils.loadTexture(t.spriteAtlas.canvas.toDataURL());e.minFilter=THREE.LinearFilter,e.maxFilter=THREE.LinearFilter,e.flipY=!1;const i=new THREE.PointCloudMaterial({size:t.spriteSize*this.getWindow().devicePixelRatio,map:e,vertexColors:THREE.VertexColors,alphaTest:.5,transparent:!0,occlusion:1,depthTest:!0,depthWrite:!0});function n(t,e){const i=t.impl.renderer().getDepthTarget();if(i){const t=new THREE.Vector2(1/i.width,1/i.height);e.uniforms=Object.assign(e.uniforms||{},{tDepthTest:{type:"t",value:i},tDepthResolution:{type:"v2",value:t}})}}i.skipMrtNormals=!0,n(this.viewer,i),i.defines=Object.assign(i.defines||{},{PARTICLE_FRAGMENT:1,USE_VERTEX_ID:1,DEPTH_OCCLUSION:this.deviceDepthOcclusion?1:0,PARTICLE_UV:1,PARTICLE_FLAGS:""});const s=this.viewer.impl;s.matman().addMaterial("__dataVizSpriteMaterial__",i,!0),this.pointMaterial=i,this.viewableData=t,this.dbId2Geometry={},this.viewer.addEventListener(X.VIEWER_RESIZE_EVENT,(()=>{n(this.viewer,i)}));const r=this;let o=new h.SpriteMeshBuilder((function(t){t.dbIds.forEach((e=>{r.dbId2Geometry[e]=t}));const e=new THREE.Mesh(t,i);s.addOverlay(Q,e),r.pointMeshes.push(e),setTimeout((()=>{s.invalidate(!1,!1,!0)}),16)}));t.viewables.map((e=>{e.position&&o.addPoint(e,t.spriteAtlas)})),o.flushBuffer()}removeAllViewables(){if(this.pointMeshes&&this.pointMeshes.length>0){let t=this.viewer.impl;this.pointMeshes.forEach((e=>{t.removeOverlay(Q,e),e.geometry.dispose(),e.material.dispose()})),t.invalidate(!1,!1,!0)}this.pointMeshes=[],delete this.dbId2Geometry,delete this.viewableData}changeOcclusion(t){if(this.deviceDepthOcclusion!=t){this.deviceDepthOcclusion=t;let e=t?1:0;this.pointMaterial&&this.pointMaterial.program&&(this.pointMaterial.defines.DEPTH_OCCLUSION=e,this.pointMaterial.needsUpdate=!0),this.viewer.impl.invalidate(!1,!1,!0)}}showHideViewables(t,e){this.changeOcclusion(e),this.pointMaterial&&(this.pointMaterial.visible=t,this.pointMaterial.needsUpdate=!0),this.viewer.impl.invalidate(!1,!1,!0)}highlightViewables(t){this.tool&&this.tool.markObject(t)}clearHighlightedViewables(){this.tool&&this.tool.clearMarkedObject()}invalidateViewables(t,e){!t||t.length<=0?console.warn("All parameters of 'invalidateViewables' are mandatory"):!this.pointMeshes||this.pointMeshes.length<=0||!this.viewableData?console.warn("'addViewables' must be called before 'invalidateViewables'"):this.tool&&this.tool.invalidateViewablesDirect(t,this.pointMeshes,this.viewableData,e)}showTextures(){this.textureUtility.showTextures()}hideTextures(){this.textureUtility.hideTextures()}async setupSurfaceShading(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return await this.waitForInstanceTree(t),(async()=>{Object.keys(this.surfaceShading).length&&Object.prototype.hasOwnProperty.call(this.surfaceShading,t.id)&&this.surfaceShading[t.id].cleanUp(),this.model=t,"PlanarHeatmap"==i.type?(await this.viewer.loadExtension("Autodesk.CompGeom"),this.surfaceShading[t.id]=new B(this.viewer,t,e,i)):this.surfaceShading[t.id]=new O(this.viewer,t,e)})()}renderSurfaceShading(t,e,i){let n,s,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};"number"==typeof r?n={confidence:Math.abs(r)}:(n=r.heatmapConfig,s=r.model),null==n&&(n={confidence:160}),null==s&&(s=this.model),s&&this.surfaceShading[s.id]?this.surfaceShading[s.id].render(t,e,i,n):q.logger.error("Please call setupSurfaceShading first")}updateSurfaceShading(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!Object.keys(n).length||Object.prototype.hasOwnProperty.call(n,"heatmapConfig")||Object.prototype.hasOwnProperty.call(n,"model")?(e=n.heatmapConfig,i=n.model):e=n,null==i&&(i=this.model),i&&Object.prototype.hasOwnProperty.call(this.surfaceShading,i.id)?this.surfaceShading[i.id].updateShading(t,e):q.logger.error("Please call setupSurfaceShading for the model first")}registerSurfaceShadingColors(t,e){let i,n,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"number"==typeof s?i=s:(i=s.alpha,n=s.model),null==i&&(i=.7),null==n&&(n=this.model),n&&Object.prototype.hasOwnProperty.call(this.surfaceShading,n.id)?this.surfaceShading[n.id].registerSensorColors(t,e,i):q.logger.error("Please call setupSurfaceShading for the model first")}removeSurfaceShading(t){Object.keys(this.surfaceShading).length&&(null==t&&(t=this.model),Object.prototype.hasOwnProperty.call(this.surfaceShading,t.id)&&this.surfaceShading[t.id].removeShading())}}X.theExtensionManager.registerExtension(G,Y)})(),Autodesk.Extensions.DataVisualization=n})();
|
|
//# sourceMappingURL=DataVisualization.min.js.map
|