var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};
import { DeesElement, customElement, html, css, cssManager, property, } from '@design.estate/dees-element';
let SzTokensView = (() => {
    let _classDecorators = [customElement('sz-tokens-view')];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = DeesElement;
    let _globalTokens_decorators;
    let _globalTokens_initializers = [];
    let _globalTokens_extraInitializers = [];
    let _ciTokens_decorators;
    let _ciTokens_initializers = [];
    let _ciTokens_extraInitializers = [];
    var SzTokensView = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _globalTokens_decorators = [property({ type: Array })];
            _ciTokens_decorators = [property({ type: Array })];
            __esDecorate(this, null, _globalTokens_decorators, { kind: "accessor", name: "globalTokens", static: false, private: false, access: { has: obj => "globalTokens" in obj, get: obj => obj.globalTokens, set: (obj, value) => { obj.globalTokens = value; } }, metadata: _metadata }, _globalTokens_initializers, _globalTokens_extraInitializers);
            __esDecorate(this, null, _ciTokens_decorators, { kind: "accessor", name: "ciTokens", static: false, private: false, access: { has: obj => "ciTokens" in obj, get: obj => obj.ciTokens, set: (obj, value) => { obj.ciTokens = value; } }, metadata: _metadata }, _ciTokens_initializers, _ciTokens_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            SzTokensView = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        static demo = () => html `
    <div style="padding: 24px; max-width: 1000px;">
      <sz-tokens-view
        .globalTokens=${[
            { id: '1', name: 'CI/CD Pipeline', type: 'global', createdAt: '2024-01-15', lastUsed: '2024-01-20' },
            { id: '2', name: 'Development', type: 'global', createdAt: '2024-01-10' },
        ]}
        .ciTokens=${[
            { id: '3', name: 'hello-world-ci', type: 'ci', service: 'hello-world', createdAt: '2024-01-18' },
            { id: '4', name: 'api-service-ci', type: 'ci', service: 'api-service', createdAt: '2024-01-12', lastUsed: '2024-01-19' },
        ]}
      ></sz-tokens-view>
    </div>
  `;
        #globalTokens_accessor_storage = __runInitializers(this, _globalTokens_initializers, []);
        get globalTokens() { return this.#globalTokens_accessor_storage; }
        set globalTokens(value) { this.#globalTokens_accessor_storage = value; }
        #ciTokens_accessor_storage = (__runInitializers(this, _globalTokens_extraInitializers), __runInitializers(this, _ciTokens_initializers, []));
        get ciTokens() { return this.#ciTokens_accessor_storage; }
        set ciTokens(value) { this.#ciTokens_accessor_storage = value; }
        static styles = [
            cssManager.defaultStyles,
            css `
      :host {
        display: block;
      }

      .section {
        background: ${cssManager.bdTheme('#ffffff', '#09090b')};
        border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        border-radius: 8px;
        margin-bottom: 24px;
        overflow: hidden;
      }

      .section-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 16px;
        border-bottom: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
      }

      .section-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
      }

      .section-title {
        font-size: 16px;
        font-weight: 600;
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
      }

      .section-subtitle {
        font-size: 13px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .create-button {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        background: ${cssManager.bdTheme('#18181b', '#fafafa')};
        border: none;
        border-radius: 6px;
        font-size: 13px;
        font-weight: 500;
        color: ${cssManager.bdTheme('#fafafa', '#18181b')};
        cursor: pointer;
        transition: all 200ms ease;
      }

      .create-button:hover {
        opacity: 0.9;
      }

      .token-list {
        padding: 16px;
      }

      .token-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
        border-radius: 6px;
        margin-bottom: 8px;
      }

      .token-item:last-child {
        margin-bottom: 0;
      }

      .token-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
      }

      .token-name {
        font-size: 14px;
        font-weight: 500;
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
      }

      .token-meta {
        font-size: 12px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
      }

      .token-service {
        display: inline-flex;
        align-items: center;
        padding: 2px 8px;
        background: ${cssManager.bdTheme('#dbeafe', 'rgba(59, 130, 246, 0.2)')};
        color: ${cssManager.bdTheme('#2563eb', '#60a5fa')};
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
        margin-right: 8px;
      }

      .token-actions {
        display: flex;
        gap: 8px;
      }

      .action-button {
        padding: 6px 12px;
        background: transparent;
        border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        border-radius: 4px;
        font-size: 12px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
        cursor: pointer;
        transition: all 200ms ease;
      }

      .action-button:hover {
        background: ${cssManager.bdTheme('#ffffff', '#09090b')};
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
      }

      .action-button.delete {
        color: ${cssManager.bdTheme('#dc2626', '#ef4444')};
        border-color: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.3)')};
      }

      .action-button.delete:hover {
        background: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.2)')};
      }

      .empty-state {
        padding: 32px 16px;
        text-align: center;
      }

      .empty-text {
        font-size: 14px;
        color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
        margin-bottom: 16px;
      }

      .empty-button {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        background: ${cssManager.bdTheme('#ffffff', '#09090b')};
        border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
        border-radius: 6px;
        font-size: 13px;
        font-weight: 500;
        color: ${cssManager.bdTheme('#18181b', '#fafafa')};
        cursor: pointer;
        transition: all 200ms ease;
      }

      .empty-button:hover {
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
      }
    `,
        ];
        render() {
            return html `
      <div class="section">
        <div class="section-header">
          <div class="section-info">
            <div class="section-title">Global Tokens</div>
            <div class="section-subtitle">Tokens that can push images to multiple services</div>
          </div>
          <button class="create-button" @click=${() => this.handleCreate('global')}>
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <line x1="12" y1="5" x2="12" y2="19"></line>
              <line x1="5" y1="12" x2="19" y2="12"></line>
            </svg>
            Create Token
          </button>
        </div>
        ${this.globalTokens.length > 0 ? html `
          <div class="token-list">
            ${this.globalTokens.map(token => this.renderToken(token))}
          </div>
        ` : html `
          <div class="empty-state">
            <div class="empty-text">No global tokens created</div>
            <button class="empty-button" @click=${() => this.handleCreate('global')}>Create Global Token</button>
          </div>
        `}
      </div>

      <div class="section">
        <div class="section-header">
          <div class="section-info">
            <div class="section-title">CI Tokens (Service-specific)</div>
            <div class="section-subtitle">Tokens tied to individual services for CI/CD pipelines</div>
          </div>
          <button class="create-button" @click=${() => this.handleCreate('ci')}>
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <line x1="12" y1="5" x2="12" y2="19"></line>
              <line x1="5" y1="12" x2="19" y2="12"></line>
            </svg>
            Create Token
          </button>
        </div>
        ${this.ciTokens.length > 0 ? html `
          <div class="token-list">
            ${this.ciTokens.map(token => this.renderToken(token))}
          </div>
        ` : html `
          <div class="empty-state">
            <div class="empty-text">No CI tokens created</div>
            <button class="empty-button" @click=${() => this.handleCreate('ci')}>Create CI Token</button>
          </div>
        `}
      </div>
    `;
        }
        renderToken(token) {
            return html `
      <div class="token-item">
        <div class="token-info">
          <div class="token-name">${token.name}</div>
          <div class="token-meta">
            ${token.service ? html `<span class="token-service">${token.service}</span>` : ''}
            Created ${token.createdAt}
            ${token.lastUsed ? html ` · Last used ${token.lastUsed}` : ''}
          </div>
        </div>
        <div class="token-actions">
          <button class="action-button" @click=${() => this.handleCopy(token)}>Copy</button>
          <button class="action-button" @click=${() => this.handleRegenerate(token)}>Regenerate</button>
          <button class="action-button delete" @click=${() => this.handleDelete(token)}>Delete</button>
        </div>
      </div>
    `;
        }
        handleCreate(type) {
            this.dispatchEvent(new CustomEvent('create', { detail: { type }, bubbles: true, composed: true }));
        }
        handleCopy(token) {
            this.dispatchEvent(new CustomEvent('copy', { detail: token, bubbles: true, composed: true }));
        }
        handleRegenerate(token) {
            this.dispatchEvent(new CustomEvent('regenerate', { detail: token, bubbles: true, composed: true }));
        }
        handleDelete(token) {
            this.dispatchEvent(new CustomEvent('delete', { detail: token, bubbles: true, composed: true }));
        }
        constructor() {
            super(...arguments);
            __runInitializers(this, _ciTokens_extraInitializers);
        }
        static {
            __runInitializers(_classThis, _classExtraInitializers);
        }
    };
    return SzTokensView = _classThis;
})();
export { SzTokensView };
//# sourceMappingURL=data:application/json;base64, 