import*as t from"lit/decorators.js";var e,r,o={3273(t,e,r){r.d(e,{X:()=>m,s:()=>c}),r(1821);var o=r(9609),s=r(4084),a=r(2927),i=r(8899),l=r(4955),n=r(6897),p=r(1928),d=function(t,e,r,o){var s,a=arguments.length,i=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i};const c=["number","default"];var m;!function(t){let e=class extends a.LitElement{constructor(){super(...arguments),this.tabledata="",this.zebra=!1,this.clean=!1,this.sorting=!1,this.nodata="No data Loaded",this.stickheader=!1,this.label="Table",this.noBorders=!1,this.format="default",this.warning=[],this.errors=[],this.sort={columnName:"",sortting:!1},this.csvData=void 0,this.config={quoteChar:'"',escapeChar:'""',header:!1,preview:0,comments:!1,step:void 0,complete:void 0}}connectedCallback(){super.connectedCallback(),this.results=n.default.parse(this.tabledata,this.config),this.headerRow=this.results.data[0],this.csvData=this.results.data.slice(1,this.results.data.length)}get rowItem(){return this.rowTable}linkCellItems(){const t=this.rowTable;null==t||t.forEach((t,e)=>{this.warning.forEach(r=>{e+1===r.row&&t.querySelectorAll('td[role="cell"').forEach((t,e)=>{e+1===r.col&&(t.classList.add("warning"),t.insertAdjacentHTML("beforeend",'<md-icon name="warning-regular" size="24" iconSet="momentumDesign" color="var(--md-alert-warning-text-color)"></md-icon>'))})}),this.errors.forEach(r=>{e+1===r.row&&t.querySelectorAll('td[role="cell"').forEach((t,e)=>{e+1===r.col&&(t.classList.add("error"),t.insertAdjacentHTML("beforeend",'<md-icon name="clear-bold" size="24" iconSet="momentumDesign" color="var(--md-alert-error-text-color)"></md-icon>'))})})})}sortTab(t,e){const r=t.target,o=Array.from(this.csvData),s=this.headerRow.indexOf(e);e!==this.sort.columnName||!0!==this.sort.sortting?(o.sort(function(t,e){const r=t[s].toLowerCase(),o=e[s].toLowerCase();return r>o?1:r<o?-1:0}),this.sort.sortting=!0,r.classList.remove("sortedZyx"),r.classList.add("sortedAbc")):(o.reverse(),this.sort.sortting=!1,r.classList.remove("sortedAbc"),r.classList.add("sortedZyx")),this.sort.columnName=e,this.csvData=o,this.requestUpdate("csvData")}willUpdate(t){super.willUpdate(t),t.has("tabledata")&&(this.results=n.default.parse(this.tabledata,this.config),this.headerRow=this.results.data[0],this.csvData=this.results.data.slice(1,this.results.data.length))}updated(t){super.updated(t),t.has("tabledata")&&this.linkCellItems()}static get styles(){return[s.A,p.A]}get tableClassMap(){return{"md-table--clean":this.clean,"md-table--no-borders":this.noBorders,"md-table--stripped":this.zebra,"md-table--sorting":this.sorting}}getSortTemplate(t){return this.sort.columnName!==t?a.nothing:a.html`
        <md-icon
          name=${this.sort.sortting?"sort-descending-bold":"sort-ascending-bold"}
          iconSet="momentumDesign"
          size="16"
        ></md-icon>
      `}render(){return a.html`
        <div class=${"md-table-container "+(this.stickheader?"md-table-container_stickly":"")}>
          ${0!=this.csvData.length?a.html`
                <table
                  class="md-table ${(0,l.classMap)(this.tableClassMap)}"
                  tabindex="0"
                  role="table"
                  aria-label="${this.label}"
                >
                  <thead class="md-table__header" role="rowgroup" tabindex="0">
                    <tr role="row">
                      ${this.headerRow.map(t=>a.html`
                          <th role="columnheader">
                            ${this.sorting?a.html`
                                  <a @click=${e=>this.sortTab(e,t)}>
                                    ${t}${this.getSortTemplate(t)}
                                  </a>
                                `:a.html` ${t}`}
                          </th>
                        `)}
                    </tr>
                  </thead>
                  <tbody class="md-table__body" role="rowgroup">
                    ${this.csvData.map((t,e)=>a.html`
                        <tr tabindex="0" role="row" part=${0===e?"first-row":"row"}>
                          ${t.map((t,e)=>{const r="number"===this.format&&0!==e?Number(t).toLocaleString():t;return a.html`
                              <td part=${0===e?"left-cell":"cell"} role="cell">
                                <span>${r}</span>
                              </td>
                            `})}
                        </tr>
                      `)}
                  </tbody>
                </table>
              `:a.html` <p>${this.nodata}</p> `}
        </div>
      `}};d([(0,i.property)({type:String})],e.prototype,"tabledata",void 0),d([(0,i.property)({type:Boolean})],e.prototype,"zebra",void 0),d([(0,i.property)({type:Boolean})],e.prototype,"clean",void 0),d([(0,i.property)({type:Boolean})],e.prototype,"sorting",void 0),d([(0,i.property)({type:String})],e.prototype,"nodata",void 0),d([(0,i.property)({type:Boolean})],e.prototype,"stickheader",void 0),d([(0,i.property)({type:String})],e.prototype,"label",void 0),d([(0,i.property)({type:Boolean,attribute:"no-borders"})],e.prototype,"noBorders",void 0),d([(0,i.property)({type:String})],e.prototype,"format",void 0),d([(0,i.property)({type:Array})],e.prototype,"warning",void 0),d([(0,i.property)({type:Array})],e.prototype,"errors",void 0),d([(0,i.state)()],e.prototype,"sort",void 0),d([(0,i.state)()],e.prototype,"csvData",void 0),d([(0,i.queryAll)('.md-table__body tr[role="row"]')],e.prototype,"rowTable",void 0),e=d([(0,o.w)("md-table")],e),t.ELEMENT=e}(m||(m={}))},8899(e,r,o){var s,a;e.exports=(s={property:()=>t.property,query:()=>t.query,queryAll:()=>t.queryAll,state:()=>t.state},a={},o.d(a,s),a)}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return o[t](r,r.exports,a),r.exports}a.m=o,e=[],a.O=(t,r,o,s)=>{if(!r){var i=1/0;for(d=0;d<e.length;d++){for(var[r,o,s]=e[d],l=!0,n=0;n<r.length;n++)(!1&s||i>=s)&&Object.keys(a.O).every(t=>a.O[t](r[n]))?r.splice(n--,1):(l=!1,s<i&&(i=s));if(l){e.splice(d--,1);var p=o();void 0!==p&&(t=p)}}return t}s=s||0;for(var d=e.length;d>0&&e[d-1][2]>s;d--)e[d]=e[d-1];e[d]=[r,o,s]},a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);export{a as __webpack_require__};r={1280:0,1756:0,4137:0,4613:0,6518:0,6994:0,8510:0,8899:0,9375:0},a.C=t=>{var e,o,{__webpack_esm_ids__:s,__webpack_esm_modules__:i,__webpack_esm_runtime__:l}=t,n=0;for(e in i)a.o(i,e)&&(a.m[e]=i[e]);for(l&&l(a);n<s.length;n++)o=s[n],a.o(r,o)&&r[o]&&r[o][0](),r[s[n]]=0;a.O()},a.O.j=t=>0===r[t];import*as i from"../9609.js";a.C(i);import*as l from"../4084.js";a.C(l);import*as n from"../4955.js";a.C(n);import*as p from"../3517.js";a.C(p);import*as d from"../1156.js";a.C(d);import*as c from"../3305.js";a.C(c);import*as m from"../4739.js";a.C(m);import*as h from"../7154.js";a.C(h);import*as b from"../9773.js";a.C(b);import*as y from"../5983.js";a.C(y);import*as f from"../7755.js";a.C(f);import*as u from"../1821.js";a.C(u);import*as v from"../4980.js";a.C(v);import*as g from"../9500.js";a.C(g);import*as w from"../519.js";a.C(w);import*as C from"../8165.js";a.C(C);import*as j from"../6897.js";a.C(j);import*as _ from"../1928.js";a.C(_);var $=a.O(void 0,[9609,4084,4955,3517,1156,3305,4739,7154,9773,5983,7755,1821,4980,9500,519,8165,6897,1928],()=>a(3273));const x=($=a.O($)).X,O=$.s;export{x as Table,O as formatType};