1import{__decorate as e}from"../node_modules/tslib/tslib.es6.js";import{css as t,LitElement as n,html as i}from"https://cdn.jsdelivr.net/gh/lit/dist@2/core/lit-core.min.js";import{property as o,customElement as s}from"https://cdn.skypack.dev/pin/lit@v2.5.0-jYRq0AKQogjUdUh7SCAE/mode=imports/optimized/lit/decorators.js";let c=class extends n{constructor(){super(),this.viewMode="main",this.version="",this.handleChangeModeEvent=e=>{const{detail:t}=e;this.viewMode=t.mode},this.invokeGetVersion()}invokeGetVersion(){fetch("./version",{method:"GET"}).then((e=>e.json())).then((e=>{this.version=e.version})).catch((e=>{console.log("Cannot connect to netsim web server",e)}))}connectedCallback(){super.connectedCallback(),window.addEventListener("changeModeEvent",this.handleChangeModeEvent),window.addEventListener("reset-button-clicked",this.handleReset),window.addEventListener("bumble-button-clicked",this.handleBumbleHive)}disconnectedCallback(){window.removeEventListener("bumble-button-clicked",this.handleBumbleHive),window.removeEventListener("reset-button-clicked",this.handleReset),window.removeEventListener("changeModeEvent",this.handleChangeModeEvent),super.disconnectedCallback()}handleReset(){fetch("./v1/devices",{method:"PUT"}).catch((e=>{console.log("Cannot connect to netsim web server:",e)}))}handleBumbleHive(){window.open("https://google.github.io/bumble/hive/index.html","_blank")}render(){let e=i``;return"main"===this.viewMode?e=i` 2 <ns-customize-button eventName="map-button-clicked" class="primary" aria-label="Change background of the device map">Change Background</ns-customize-button> 3 <ns-customize-button eventName="isometric-button-clicked" class="primary" aria-label="Toggle view of the device map">Toggle View</ns-customize-button> 4 <ns-customize-button eventName="reset-button-clicked" class="primary" aria-label="Reset device information">Reset</ns-customize-button> 5 <ns-customize-button eventName="bumble-button-clicked" class="primary" aria-label="Bumble Hive Webpage">Bumble Hive</ns-customize-button> 6 <div class="container"> 7 <div class="contentA"> 8 <ns-device-map></ns-device-map> 9 <ns-device-list></ns-device-list> 10 </div> 11 <div class="contentB"> 12 <ns-device-info></ns-device-info> 13 </div> 14 </div> 15 `:"trace"===this.viewMode?e=i` 16 <ns-packet-info></ns-packet-info> 17 `:"oslib"===this.viewMode&&(e=i` 18 <ns-license-info></ns-license-info> 19 `),i` 20 <div id="bottom">version: ${this.version}</div> 21 <ns-navigation-bar></ns-navigation-bar> 22 ${e} 23 `}};c.styles=t` 24 .container { 25 display: flex; 26 width: 100%; 27 } 28 29 .contentA { 30 flex: 2; 31 } 32 33 .contentB { 34 flex: 2; 35 } 36 37 #bottom { 38 position: relative; 39 bottom: 0; 40 left: 0; 41 font-size: 20px; 42 } 43 `,e([o()],c.prototype,"viewMode",void 0),e([o()],c.prototype,"version",void 0),c=e([s("netsim-app")],c);export{c as NetsimApp}; 44