import{LitElement as t,html as e,css as i}from"../../../../../lit/index.js";import{store as r}from"../../core/haxcms-site-store.js";import{autorun as s,toJS as o}from"../../../../../mobx/dist/mobx.esm.js";import{varGet as c}from"../../../../utils/utils.js";import{HAXCMSThemeParts as n}from"../../core/utils/HAXCMSThemeParts.js";import{HAXCMSI18NMixin as a}from"../../core/utils/HAXCMSI18NMixin.js";class SiteGitCorner extends(a(n(t))){static get tag(){return"site-git-corner"}static get styles(){return[super.styles,i`
        :host {
          display: block;
          float: var(--site-git-corner-float);
        }
        :host([direction="right"]) {
          float: right;
        }
        :host([direction="left"]) {
          float: left;
        }
        git-corner {
          --github-corner-color: var(--site-git-corner-color);
          --github-corner-background: var(--site-git-corner-background);
        }
      `]}render(){return e`
      <git-corner
        .part="${this.editMode?"edit-mode-active":""}"
        size="${this.size}"
        ?circle="${this.circle}"
        id="git-corner"
        source="${this.activeGitFileLink}"
        alt="${this.t.seePageSource}"
      ></git-corner>
      <simple-tooltip for="git-corner" position="auto">
        ${this.t.seePageSource}
      </simple-tooltip>
    `}constructor(){super(),this.HAXCMSI18NMixinBase="../../../",this.t=this.t||{},this.t.seePageSource="See page source",this.circle=!1,this.direction="right",this.activeGitFileLink="",this.__disposer=[],s((t=>{""==c(r.manifest,"metadata.site.git.publicRepoUrl","")||globalThis.customElements.get("git-corner")||import("../../../../git-corner/git-corner.js"),this.__disposer.push(t)})),s((t=>{if(r.activeItem){let t=c(r.manifest,"metadata.site.git.publicRepoUrl","")+r.activeItem.location;"11ty"==globalThis.HAXCMSContext&&(t=t.replace("/src/./pages/","/src/content/")),this.activeGitFileLink=t}this.__disposer.push(t)}))}disconnectedCallback(){for(var t in this.__disposer)this.__disposer[t].dispose();super.disconnectedCallback()}static get properties(){return{circle:{type:Boolean},size:{type:String},activeGitFileLink:{type:String,attribute:"active-git-file-link"},direction:{type:String,reflect:!0},t:{type:Object}}}}customElements.define(SiteGitCorner.tag,SiteGitCorner);export{SiteGitCorner};