/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{a as s,b as n,c as d}from"./ZIVKAX4G.js";import{b as y}from"./2I5LGZNX.js";import{E as i,F as c,G as m,h as o,i as t,q as p}from"./FFF5HUPM.js";import"./EXBEKVP5.js";var b=o`:host{display:block;--calcite-label-margin-bottom: 0}.label-display{display:block;padding-bottom:1rem}`,r=class extends m{constructor(){super(...arguments),this._densityElement=i(),this._typeElement=i(),this._severityElement=i(),this._types=Object.keys(n).filter(e=>!Number.isNaN(Number(n[e]))),this.deductValueComplete=p()}static{this.styles=b}render(){return t`<div class="label-display"><calcite-label class="label-display">\r\n            Density %${this._getDensityInput()}</calcite-label><calcite-label class="label-display">\r\n            Type${this._getTypeInput()}</calcite-label><calcite-label class="label-display">\r\n            Severity${this._getSeverityInput()}</calcite-label></div><div>${this._getCalculateInput()}</div>`}_getDensityInput(){return t`<calcite-input max=100 min=0 type=number ${c(this._densityElement)}></calcite-input>`}_getTypeInput(){return t`<calcite-select label=Type ${c(this._typeElement)}>${this._types.map((e,l)=>t`<calcite-option .value=${n[e].toString()}>${`${e} (${l+1})`}</calcite-option>`)}</calcite-select>`}_getSeverityInput(){return t`<calcite-select label=Severity ${c(this._severityElement)}><calcite-option .value=${s.H}>\r\n          High</calcite-option><calcite-option .value=${s.M}>\r\n          Medium</calcite-option><calcite-option .value=${s.L}>\r\n          Low</calcite-option></calcite-select>`}_getCalculateInput(){let e=this._typeElement.value&&Number.parseFloat(this._typeElement.value.value),l=this._severityElement.value&&this._severityElement.value.value,a=this._densityElement.value&&Number.parseFloat(this._densityElement.value.value);return t`<calcite-button @click=${()=>this._calculateDeduct(e,l,a)}>\r\n        Calculate Deduct Value</calcite-button>`}_calculateDeduct(e,l,a){if(e&&l&&!Number.isNaN(a)){let u=d(e.toString(),l.toString(),a.toString(),!0);this.deductValueComplete.emit(u),alert(u)}else alert("Type, severity, and a density number are required")}};y("deduct-calculator",r);export{r as DeductCalculator};
