class TwitterEmbedVanilla extends HTMLElement{static get tag(){return"twitter-embed-vanilla"}constructor(){super(),globalThis.document&&globalThis.document.body?this.lang=globalThis.document.body.getAttribute("xml:lang")||globalThis.document.body.getAttribute("lang")||globalThis.document.documentElement.getAttribute("xml:lang")||globalThis.document.documentElement.getAttribute("lang")||globalThis.navigator.language||"en":this.lang="en",this.dataWidth=this.getAttribute("data-width")?this.getAttribute("data-width"):"550px",this.dataTheme=this.getAttribute("data-theme")?this.getAttribute("data-theme"):"light",this.tweet=this.getAttribute("tweet")?this.getAttribute("tweet"):null,this.tweetId=this.getAttribute("tweet-id")?this.getAttribute("tweet-id"):null,this.allowPopups=this.getAttribute("no-popups")?"":"allow-popups"}static get observedAttributes(){return["lang","tweet","data-width","data-theme","tweet-id","no-popups"]}attributeChangedCallback(t,e,i){"tweet"==t&&i&&(i.includes("twitter.com")||i.includes("x.com"))&&(this.tweetId=i.split("/").pop()),"no-popups"==t&&(this.allowPopups="no-popups"!=i&&""!=i&&i&&null!=i&&"null"!=i?"allow-popups":""),["lang","no-popups","tweet-id","data-width","data-theme"].includes(t)&&(this.innerHTML=this.html)}get dataWidth(){return this.getAttribute("data-width")}set dataWidth(t){null!=t&&t?this.setAttribute("data-width",t):this.removeAttribute("data-width")}get dataTheme(){return this.getAttribute("data-theme")}set dataTheme(t){t&&["dark","light"].includes(t)?this.setAttribute("data-theme",t):this.dataTheme="light"}get lang(){return this.getAttribute("lang")}set lang(t){""==t||null==t?this.removeAttribute("lang"):this.setAttribute("lang",t)}get tweetId(){return this.getAttribute("tweet-id")}set tweetId(t){null==t?this.removeAttribute("tweet-id"):this.setAttribute("tweet-id",t)}get tweet(){return this.getAttribute("tweet")}set tweet(t){null==t?this.removeAttribute("tweet"):this.setAttribute("tweet",t)}get html(){return`\n    <div\n      class="twitter-tweet twitter-tweet-rendered"\n      style="display: flex; max-width: ${this.dataWidth}; width: 100%; margin-top: 10px; margin-bottom: 10px;">\n      <iframe\n        sandbox="allow-same-origin allow-scripts ${this.allowPopups}"\n        scrolling="no"\n        frameborder="0"\n        loading="lazy"\n        allowtransparency="true"\n        allow="autoplay; encrypted-media; fullscreen"\n        style="position: static; visibility: visible; width: ${this.dataWidth}; height: 498px; display: block; flex-grow: 1;"\n        title="Twitter Tweet"\n        src="https://platform.twitter.com/embed/index.html?dnt=true&amp&amp;frame=false&amp;hideCard=false&amp;hideThread=false&amp;id=${this.tweetId}&amp;lang=${this.lang}&amp;theme=${this.dataTheme}&amp;widgetsVersion=223fc1c4%3A1596143124634&amp;width=${this.dataWidth}"\n        data-tweet-id="${this.tweetId}">\n      </iframe>\n    </div>`}}customElements.define(TwitterEmbedVanilla.tag,TwitterEmbedVanilla);export{TwitterEmbedVanilla};