var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { consume } from '@lit-labs/context';
import { LitElement, css, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { Bubble } from '../bubble.js';
import { penCtx } from './play-pen-context.js';
import './play-button.js';
import './play-icon.js';
import './play-resizable-text-input.js';
let PlayPenHeader = class PlayPenHeader extends LitElement {
    constructor() {
        super(...arguments);
        this.name = '';
    }
    render() {
        return html `<div class="wrapper">
      <div class="titling">
        <div class="avatar">
          <play-icon icon="devvit-outline" size="28px"></play-icon>
        </div>
        <play-resizable-text-input
          @edit-text=${(ev) => this.dispatchEvent(Bubble('play-pen-set-name', ev.detail))}
          placeholder="Untitled pen"
          .text=${this.name}
        ></play-resizable-text-input>
      </div>
      <div class="actions">
        <play-button
          @click=${() => this.dispatchEvent(Bubble('new', undefined))}
          appearance="plain"
          label="New"
          icon="add-outline"
          title="Reset Program Template"
        ></play-button>
        <play-button
          @click=${() => globalThis.open('https://developers.reddit.com/docs', '_blank', 'noopener,noreferrer')}
          appearance="plain"
          label="Docs"
          icon="info-outline"
          title="Open Documentation"
        ></play-button>
        <play-button
          @click=${() => this.dispatchEvent(Bubble('share', undefined))}
          appearance="brand"
          label="Share"
          icon="share-new-outline"
          title="Copy Program to URL"
        ></play-button>
      </div>
    </div>`;
    }
};
PlayPenHeader.styles = css `
    .wrapper {
      padding: 24px;
      display: flex;
      flex-direction: row;
      gap: 16px;
      justify-content: space-between;
      align-items: center;
    }

    .titling {
      width: 100%;
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 8px;
    }

    .avatar {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      background-color: var(--rpl-global-orangered);
      color: var(--rpl-brand-onBackground);
      border-radius: 8px;
      padding: 0;
      flex-shrink: 0;
    }

    .actions {
      display: flex;
      flex-direction: row;
      gap: 8px;
      align-items: center;
    }
  `;
__decorate([
    consume({ context: penCtx.name, subscribe: true }),
    property({ attribute: false })
], PlayPenHeader.prototype, "name", void 0);
PlayPenHeader = __decorate([
    customElement('play-pen-header')
], PlayPenHeader);
export { PlayPenHeader };
