/**
 * Copyright 2023
 * @license , see License.md for full text.
 */
import{LitElement as e,html as t,css as s}from"../../lit/index.js";import"../iframe-loader/iframe-loader.js";class DiscordEmbed extends e{constructor(){super(),this.source="",this.height=500,this.width="100%"}static get styles(){return[s`
        :host {
          display: block;
        }
      `]}static get properties(){return{height:{type:String},width:{type:String},source:{type:String,reflect:!0}}}static get haxProperties(){return new URL(`./lib/${this.tag}.haxProperties.json`,import.meta.url).href}static get tag(){return"discord-embed"}render(){return t`${this.source&&(this.source.includes("discord.com")||this.source.includes("e.widgetbot.io"))?t`
          <iframe-loader>
            <iframe
              src="${this.source}"
              height="${this.height}"
              width="${this.width}"
            ></iframe>
          </iframe-loader>
        `:t`<div>Invalid Discord share link</div>`}`}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"source"===t&&this.source&&(this.source.includes("https://discord.com/channels")?this.source=this.source.replace("https://discord.com/channels/","https://e.widgetbot.io/channels/"):this.source.includes("https://discordapp.com/channels")&&(this.source=this.source.replace("https://discordapp.com/channels/","https://e.widgetbot.io/channels/")))}))}}customElements.define(DiscordEmbed.tag,DiscordEmbed);export{DiscordEmbed};