var e,t,r={6436(e,t,r){r.d(t,{b:()=>i}),r(5983);var i,o=r(7704),a=r(4084),n=r(6579),s=r(2927),p=r(8899),c=r(3517),l=r(3241),f=function(e,t,r,i){var o,a=arguments.length,n=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(n=(a<3?o(n):a>3?o(t,r,n):o(t,r))||n);return a>3&&n&&Object.defineProperty(t,r,n),n},u=function(e,t,r,i){return new(r||(r=Promise))(function(o,a){function n(e){try{p(i.next(e))}catch(e){a(e)}}function s(e){try{p(i.throw(e))}catch(e){a(e)}}function p(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(n,s)}p((i=i.apply(e,t||[])).next())})};!function(e){let t=class extends s.LitElement{constructor(){super(...arguments),this.acceptLanguage="javascript",this.getLocalization="Input File",this.acceptTypes="",this.fileName=""}static get styles(){return[a.A,l.A]}triggerFileLoad(e){e.preventDefault(),this.input.click()}handleFile(e){return u(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,r)=>{const i=new FileReader;i.onload=e=>{t(e.target.result)},i.onerror=e=>r(e),i.readAsText(e)})}importLanguage(e){return u(this,void 0,void 0,function*(){try{const{default:t}=yield import(`highlight.js/lib/languages/${e}`);n.default.registerLanguage(`${e}`,t),this.setAcceptTypes()}catch(e){console.warn("Please set correct language name")}})}getAllAcceptTypes(){const e=n.default.listLanguages();return e.length?e.map(e=>n.default.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 s.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:s.nothing}
          </label>
          <input
            type="file"
            id="file-input"
            name="file-input"
            accept=${(0,c.ifDefined)(this.acceptTypes||void 0)}
            @change=${e=>this.handleFile(e)}
          />
        </div>
      `}};f([(0,p.property)({type:String,attribute:"accept-language"})],t.prototype,"acceptLanguage",void 0),f([(0,p.property)({type:String})],t.prototype,"getLocalization",void 0),f([(0,p.query)("input[type='file']")],t.prototype,"input",void 0),f([(0,p.state)()],t.prototype,"acceptTypes",void 0),f([(0,p.state)()],t.prototype,"fileName",void 0),t=f([(0,o.wW)("md-input-file")],t),e.ELEMENT=t}(i||(i={}))},2364(e,t,r){new WeakMap},7704(e,t,r){r.d(t,{wW:()=>i.w}),r(2364),r(3203),r(9938),r(5201),r(4781),r(608);var i=r(9609)}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var a=i[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,e=[],o.O=(t,r,i,a)=>{if(!r){var n=1/0;for(l=0;l<e.length;l++){for(var[r,i,a]=e[l],s=!0,p=0;p<r.length;p++)(!1&a||n>=a)&&Object.keys(o.O).every(e=>o.O[e](r[p]))?r.splice(p--,1):(s=!1,a<n&&(n=a));if(s){e.splice(l--,1);var c=i();void 0!==c&&(t=c)}}return t}a=a||0;for(var l=e.length;l>0&&e[l-1][2]>a;l--)e[l]=e[l-1];e[l]=[r,i,a]},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);export{o as __webpack_require__};t={561:0,2364:0,2942:0,5323:0,7032:0,7704:0,8180:0,9983:0},o.C=e=>{var r,i,{__webpack_esm_ids__:a,__webpack_esm_modules__:n,__webpack_esm_runtime__:s}=e,p=0;for(r in n)o.o(n,r)&&(o.m[r]=n[r]);for(s&&s(o);p<a.length;p++)i=a[p],o.o(t,i)&&t[i]&&t[i][0](),t[a[p]]=0;o.O()},o.O.j=e=>0===t[e];import*as a from"../9609.js";o.C(a);import*as n from"../4084.js";o.C(n);import*as s from"../4955.js";o.C(s);import*as p from"../3517.js";o.C(p);import*as c from"../1156.js";o.C(c);import*as l from"../3305.js";o.C(l);import*as f from"../4739.js";o.C(f);import*as u from"../7154.js";o.C(u);import*as m from"../9773.js";o.C(m);import*as g from"../5983.js";o.C(g);import*as d from"../5308.js";o.C(d);import*as h from"../9938.js";o.C(h);import*as y from"../4781.js";o.C(y);import*as v from"../5201.js";o.C(v);import*as j from"../8227.js";o.C(j);import*as b from"../2900.js";o.C(b);import*as C from"../1280.js";o.C(C);import*as _ from"../3203.js";o.C(_);import*as L from"../3051.js";o.C(L);var w=o.O(void 0,[9609,4084,4955,3517,1156,3305,4739,7154,9773,5983,5308,9938,4781,5201,8227,2900,1280,3203,3051],()=>o(6436));const O=(w=o.O(w)).b;export{O as InputFile};