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>
  `;
        static demoGroups = ['Auth & Settings'];
        #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;
      }

      dees-tile {
        display: block;
        margin-bottom: 24px;
      }

      .section-header {
        height: 36px;
        display: flex;
        align-items: center;
        padding: 0 16px;
        width: 100%;
        box-sizing: border-box;
      }

      .section-heading {
        flex: 1;
        display: flex;
        align-items: baseline;
        gap: 8px;
        min-width: 0;
      }

      .section-title {
        font-weight: 500;
        font-size: 13px;
        letter-spacing: -0.01em;
        color: var(--dees-color-text-secondary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .section-subtitle {
        font-size: 12px;
        color: var(--dees-color-text-muted);
        letter-spacing: -0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .section-footer {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 0;
        height: 36px;
        width: 100%;
        box-sizing: border-box;
      }

      .tile-button {
        padding: 0 16px;
        height: 100%;
        text-align: center;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        user-select: none;
        transition: all 0.15s ease;
        background: transparent;
        border: none;
        border-left: 1px solid var(--dees-color-border-subtle);
        color: var(--dees-color-text-muted);
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .tile-button:first-child {
        border-left: none;
      }

      .tile-button:hover {
        background: var(--dees-color-hover);
        color: var(--dees-color-text-primary);
      }

      .tile-button.primary {
        color: ${cssManager.bdTheme('hsl(217.2 91.2% 59.8%)', 'hsl(213.1 93.9% 67.8%)')};
        font-weight: 600;
      }

      .tile-button.primary:hover {
        background: ${cssManager.bdTheme('hsl(217.2 91.2% 59.8% / 0.08)', 'hsl(213.1 93.9% 67.8% / 0.08)')};
        color: ${cssManager.bdTheme('hsl(217.2 91.2% 50%)', 'hsl(213.1 93.9% 75%)')};
      }

      .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')};
      }
    `,
        ];
        render() {
            return html `
      <dees-tile>
        <div slot="header" class="section-header">
          <div class="section-heading">
            <span class="section-title">Global Tokens</span>
            <span class="section-subtitle">Tokens that can push images to multiple services</span>
          </div>
        </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>
          </div>
        `}
        <div slot="footer" class="section-footer">
          <button class="tile-button primary" @click=${() => this.handleCreate('global')}>
            <svg width="12" height="12" 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>
      </dees-tile>

      <dees-tile>
        <div slot="header" class="section-header">
          <div class="section-heading">
            <span class="section-title">CI Tokens (Service-specific)</span>
            <span class="section-subtitle">Tokens tied to individual services for CI/CD pipelines</span>
          </div>
        </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>
          </div>
        `}
        <div slot="footer" class="section-footer">
          <button class="tile-button primary" @click=${() => this.handleCreate('ci')}>
            <svg width="12" height="12" 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>
      </dees-tile>
    `;
        }
        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, 