{"version":3,"sources":["jsdelivr-header.js","/npm/@damienmortini/element-input-file@0.0.117/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNO,WAAY,wCAEJ,MAAM,yBAAyB,YAC5C,6BAAW,GACT,MAAO,CAAC,QAAS,WACnB,CAEA,WAAA,GACE,QAEA,KAAK,aAAa,CAAE,KAAM,SAAU,UAAY,qLAYhD,KAAK,OAAS,KAAK,WAAW,cAAc,SAE5C,KAAK,OAAO,iBAAiB,SAAU,IACrC,EAAM,kBACN,OAAO,KAAK,CACV,IAAK,OAAO,IAAI,gBAAgB,KAAK,OAAO,MAAM,IAClD,KAAM,KAAK,OAAO,MAAM,GAAG,MAAQ,eAClC,MAAM,IACP,KAAK,MAAQ,IACd,GAEL,CAEA,wBAAA,CAAyB,EAAM,EAAU,GACvC,OAAQ,GACN,IAAK,QACH,IACE,KAAK,MAAQ,IAAI,SAAS,UAAU,KAAY,MAAM,KACxD,CAAE,MAAO,GACP,KAAK,MAAQ,CACf,CACA,MACF,IAAK,WACH,KAAK,OAAO,SAAW,KAAK,SAGlC,CAEA,YAAI,GACF,OAAO,KAAK,aAAa,WAC3B,CAEA,YAAI,CAAS,GACP,EACF,KAAK,aAAa,WAAY,IAE9B,KAAK,gBAAgB,WAEzB,CAEA,SAAI,GACF,OAAO,KAAK,MACd,CAEA,SAAI,CAAM,GACR,KAAK,OAAS,EACd,KAAK,cAAc,IAAI,MAAM,QAAS,CACpC,SAAS,IAEb,EAGG,eAAe,IAAI,oBACtB,eAAe,OAAO,kBAAmB,cAAc","file":"/npm/@damienmortini/element-input-file@0.0.117/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@damienmortini/element-input-file@0.0.117/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import Loader from '../core/util/Loader.js'\n\nexport default class FileInputElement extends HTMLElement {\n  static get observedAttributes() {\n    return ['value', 'disabled']\n  }\n\n  constructor() {\n    super()\n\n    this.attachShadow({ mode: 'open' }).innerHTML = `\n      <style>\n        :host {\n          display: inline-block;\n        }\n        input {\n          width: 100%;\n        }\n      </style>\n      <input type=\"file\">\n    `\n\n    this._input = this.shadowRoot.querySelector('input')\n\n    this._input.addEventListener('input', (event) => {\n      event.stopPropagation()\n      Loader.load({\n        src: window.URL.createObjectURL(this._input.files[0]),\n        type: this._input.files[0].type || 'text/plain',\n      }).then((data) => {\n        this.value = data\n      })\n    })\n  }\n\n  attributeChangedCallback(name, oldValue, newValue) {\n    switch (name) {\n      case 'value':\n        try {\n          this.value = new Function(`return ${newValue}`).apply(this)\n        } catch (error) {\n          this.value = newValue\n        }\n        break\n      case 'disabled':\n        this._input.disabled = this.disabled\n        break\n    }\n  }\n\n  get disabled() {\n    return this.hasAttribute('disabled')\n  }\n\n  set disabled(value) {\n    if (value) {\n      this.setAttribute('disabled', '')\n    } else {\n      this.removeAttribute('disabled')\n    }\n  }\n\n  get value() {\n    return this._value\n  }\n\n  set value(value) {\n    this._value = value\n    this.dispatchEvent(new Event('input', {\n      bubbles: true,\n    }))\n  }\n}\n\nif (!customElements.get('damo-input-file')) {\n  customElements.define('damo-input-file', class extends FileInputElement { })\n}\n"]}