!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js"),require("lit/directives/if-defined.js"),require("highlight.js/lib/core"));else if("function"==typeof define&&define.amd)define(["lit","lit/decorators.js","lit/directives/class-map.js","lit/directives/style-map.js","lit/directives/if-defined.js","highlight.js/lib/core"],t);else{var i="object"==typeof exports?t(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js"),require("lit/directives/if-defined.js"),require("highlight.js/lib/core")):t(e.lit,e["lit/decorators.js"],e["lit/directives/class-map.js"],e["lit/directives/style-map.js"],e["lit/directives/if-defined.js"],e["highlight.js/lib/core"]);for(var r in i)("object"==typeof exports?exports:e)[r]=i[r]}}(self,(e,t,i,r,o,n)=>(()=>{"use strict";var s,a={6436(e,t,i){i.r(t),i.d(t,{InputFile:()=>r}),i(5983);var r,o=i(7704),n=i(4084),s=i(5001),a=i.n(s),l=i(7161),c=i(429),p=i(291),u=i(3241),d=function(e,t,i,r){var o,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,i,s):o(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},f=function(e,t,i,r){return new(i||(i=Promise))(function(o,n){function s(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})};!function(e){let t=class extends l.LitElement{constructor(){super(...arguments),this.acceptLanguage="javascript",this.getLocalization="Input File",this.acceptTypes="",this.fileName=""}static get styles(){return[n.A,u.A]}triggerFileLoad(e){e.preventDefault(),this.input.click()}handleFile(e){return f(this,void 0,void 0,function*(){e.preventDefault();const t=this.input.files;if(t&&0!==t.length)for(const e of t){this.fileName=e.name;try{yield this.readFile(e)}catch(e){console.error("Error reading file",e)}}})}readFile(e){return new Promise((t,i)=>{const r=new FileReader;r.onload=e=>{t(e.target.result)},r.onerror=e=>i(e),r.readAsText(e)})}importLanguage(e){return f(this,void 0,void 0,function*(){try{const{default:t}=yield import(`highlight.js/lib/languages/${e}`);a().registerLanguage(`${e}`,t),this.setAcceptTypes()}catch(e){console.warn("Please set correct language name")}})}getAllAcceptTypes(){const e=a().listLanguages();return e.length?e.map(e=>a().getLanguage(`${e}`).aliases).map(e=>e.map(e=>`.${e}`)).join(","):""}setAcceptTypes(){this.acceptTypes=this.getAllAcceptTypes()}updated(e){super.updated(e),e.has("acceptLanguage")&&this.importLanguage(this.acceptLanguage)}render(){return l.html`
        <div class="md-input-file">
          <label for="file-input">
            <md-button color="blue" class="md-input-file-btn" @click=${this.triggerFileLoad}>
              ${this.getLocalization.trim()}
            </md-button>
            ${this.fileName.length?this.fileName:l.nothing}
          </label>
          <input
            type="file"
            id="file-input"
            name="file-input"
            accept=${(0,p.ifDefined)(this.acceptTypes||void 0)}
            @change=${e=>this.handleFile(e)}
          />
        </div>
      `}};d([(0,c.property)({type:String,attribute:"accept-language"})],t.prototype,"acceptLanguage",void 0),d([(0,c.property)({type:String})],t.prototype,"getLocalization",void 0),d([(0,c.query)("input[type='file']")],t.prototype,"input",void 0),d([(0,c.state)()],t.prototype,"acceptTypes",void 0),d([(0,c.state)()],t.prototype,"fileName",void 0),t=d([(0,o.wW)("md-input-file")],t),e.ELEMENT=t}(r||(r={}))},2364(e,t,i){new WeakMap},7704(e,t,i){i.d(t,{wW:()=>r.w}),i(2364),i(3203),i(9938),i(5201),i(4781),i(608);var r=i(9609)},5001(e){e.exports=n},7161(t){t.exports=e},429(e){e.exports=t},5125(e){e.exports=i},291(e){e.exports=o},318(e){e.exports=r}},l={};function c(e){var t=l[e];if(void 0!==t)return t.exports;var i=l[e]={exports:{}};return a[e](i,i.exports,c),i.exports}c.m=a,s=[],c.O=(e,t,i,r)=>{if(!t){var o=1/0;for(p=0;p<s.length;p++){for(var[t,i,r]=s[p],n=!0,a=0;a<t.length;a++)(!1&r||o>=r)&&Object.keys(c.O).every(e=>c.O[e](t[a]))?t.splice(a--,1):(n=!1,r<o&&(o=r));if(n){s.splice(p--,1);var l=i();void 0!==l&&(e=l)}}return e}r=r||0;for(var p=s.length;p>0&&s[p-1][2]>r;p--)s[p]=s[p-1];s[p]=[t,i,r]},c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var i in t)c.o(t,i)&&!c.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={561:0,2364:0,2942:0,5323:0,7032:0,7704:0,8180:0,9983:0};c.O.j=t=>0===e[t];var t=(t,i)=>{var r,o,[n,s,a]=i,l=0;if(n.some(t=>0!==e[t])){for(r in s)c.o(s,r)&&(c.m[r]=s[r]);if(a)var p=a(c)}for(t&&t(i);l<n.length;l++)o=n[l],c.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return c.O(p)},i=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var p=c.O(void 0,[9609,4084,3305,4739,7154,9773,5983,9938,4781,5201,8227,2900,3203,3241],()=>c(6436));return c.O(p)})());