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 * as plugins from '../../plugins.js';
import { DeesElement, property, html, customElement, css, cssManager, unsafeCSS, state, } from '@design.estate/dees-element';
import * as sharedStyles from '../../styles/shared.styles.js';
import { demoFunc } from './upladmin-incident-list.demo.js';
let UpladminIncidentList = (() => {
    let _classDecorators = [customElement('upladmin-incident-list')];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = DeesElement;
    let _incidents_decorators;
    let _incidents_initializers = [];
    let _incidents_extraInitializers = [];
    let _loading_decorators;
    let _loading_initializers = [];
    let _loading_extraInitializers = [];
    let _tabFilter_decorators;
    let _tabFilter_initializers = [];
    let _tabFilter_extraInitializers = [];
    let _severityFilter_decorators;
    let _severityFilter_initializers = [];
    let _severityFilter_extraInitializers = [];
    let _expandedIncidents_decorators;
    let _expandedIncidents_initializers = [];
    let _expandedIncidents_extraInitializers = [];
    var UpladminIncidentList = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _incidents_decorators = [property({ type: Array })];
            _loading_decorators = [property({ type: Boolean })];
            _tabFilter_decorators = [state()];
            _severityFilter_decorators = [state()];
            _expandedIncidents_decorators = [state()];
            __esDecorate(this, null, _incidents_decorators, { kind: "accessor", name: "incidents", static: false, private: false, access: { has: obj => "incidents" in obj, get: obj => obj.incidents, set: (obj, value) => { obj.incidents = value; } }, metadata: _metadata }, _incidents_initializers, _incidents_extraInitializers);
            __esDecorate(this, null, _loading_decorators, { kind: "accessor", name: "loading", static: false, private: false, access: { has: obj => "loading" in obj, get: obj => obj.loading, set: (obj, value) => { obj.loading = value; } }, metadata: _metadata }, _loading_initializers, _loading_extraInitializers);
            __esDecorate(this, null, _tabFilter_decorators, { kind: "accessor", name: "tabFilter", static: false, private: false, access: { has: obj => "tabFilter" in obj, get: obj => obj.tabFilter, set: (obj, value) => { obj.tabFilter = value; } }, metadata: _metadata }, _tabFilter_initializers, _tabFilter_extraInitializers);
            __esDecorate(this, null, _severityFilter_decorators, { kind: "accessor", name: "severityFilter", static: false, private: false, access: { has: obj => "severityFilter" in obj, get: obj => obj.severityFilter, set: (obj, value) => { obj.severityFilter = value; } }, metadata: _metadata }, _severityFilter_initializers, _severityFilter_extraInitializers);
            __esDecorate(this, null, _expandedIncidents_decorators, { kind: "accessor", name: "expandedIncidents", static: false, private: false, access: { has: obj => "expandedIncidents" in obj, get: obj => obj.expandedIncidents, set: (obj, value) => { obj.expandedIncidents = value; } }, metadata: _metadata }, _expandedIncidents_initializers, _expandedIncidents_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            UpladminIncidentList = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        static demo = demoFunc;
        #incidents_accessor_storage = __runInitializers(this, _incidents_initializers, []);
        get incidents() { return this.#incidents_accessor_storage; }
        set incidents(value) { this.#incidents_accessor_storage = value; }
        #loading_accessor_storage = (__runInitializers(this, _incidents_extraInitializers), __runInitializers(this, _loading_initializers, false));
        get loading() { return this.#loading_accessor_storage; }
        set loading(value) { this.#loading_accessor_storage = value; }
        #tabFilter_accessor_storage = (__runInitializers(this, _loading_extraInitializers), __runInitializers(this, _tabFilter_initializers, 'current'));
        get tabFilter() { return this.#tabFilter_accessor_storage; }
        set tabFilter(value) { this.#tabFilter_accessor_storage = value; }
        #severityFilter_accessor_storage = (__runInitializers(this, _tabFilter_extraInitializers), __runInitializers(this, _severityFilter_initializers, 'all'));
        get severityFilter() { return this.#severityFilter_accessor_storage; }
        set severityFilter(value) { this.#severityFilter_accessor_storage = value; }
        #expandedIncidents_accessor_storage = (__runInitializers(this, _severityFilter_extraInitializers), __runInitializers(this, _expandedIncidents_initializers, new Set()));
        get expandedIncidents() { return this.#expandedIncidents_accessor_storage; }
        set expandedIncidents(value) { this.#expandedIncidents_accessor_storage = value; }
        statusIcons = (__runInitializers(this, _expandedIncidents_extraInitializers), {
            investigating: 'lucide:Search',
            identified: 'lucide:Target',
            monitoring: 'lucide:Eye',
            resolved: 'lucide:CheckCircle',
            postmortem: 'lucide:FileText',
        });
        statusLabels = {
            investigating: 'Investigating',
            identified: 'Identified',
            monitoring: 'Monitoring',
            resolved: 'Resolved',
            postmortem: 'Postmortem',
        };
        static styles = [
            plugins.domtools.elementBasic.staticStyles,
            sharedStyles.commonStyles,
            css `
      :host {
        display: block;
        font-family: ${unsafeCSS(sharedStyles.fonts.base)};
      }

      .list-container {
        background: ${sharedStyles.colors.background.secondary};
        border: 1px solid ${sharedStyles.colors.border.default};
        border-radius: ${unsafeCSS(sharedStyles.borderRadius.lg)};
        overflow: hidden;
      }

      .list-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: ${unsafeCSS(sharedStyles.spacing.md)};
        padding: ${unsafeCSS(sharedStyles.spacing.md)} ${unsafeCSS(sharedStyles.spacing.lg)};
        border-bottom: 1px solid ${sharedStyles.colors.border.default};
        flex-wrap: wrap;
      }

      .tabs {
        display: flex;
        gap: 4px;
        background: ${sharedStyles.colors.background.muted};
        padding: 4px;
        border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
      }

      .tab {
        padding: 10px 16px;
        font-size: 13px;
        font-weight: 500;
        color: ${sharedStyles.colors.text.secondary};
        background: transparent;
        border: none;
        border-radius: ${unsafeCSS(sharedStyles.borderRadius.sm)};
        cursor: pointer;
        transition: all ${unsafeCSS(sharedStyles.durations.fast)} ${unsafeCSS(sharedStyles.easings.default)};
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .tab:hover {
        color: ${sharedStyles.colors.text.primary};
      }

      .tab.active {
        background: ${sharedStyles.colors.background.primary};
        color: ${sharedStyles.colors.text.primary};
        box-shadow: ${unsafeCSS(sharedStyles.shadows.sm)};
      }

      .tab-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        font-size: 11px;
        font-weight: 600;
        background: ${sharedStyles.colors.background.muted};
        border-radius: 11px;
      }

      .tab.active .tab-count {
        background: ${sharedStyles.colors.accent.primary};
        color: white;
      }

      .list-controls {
        display: flex;
        align-items: center;
        gap: ${unsafeCSS(sharedStyles.spacing.sm)};
      }

      .filter-select {
        padding: 10px 32px 10px 12px;
        font-size: 13px;
        font-family: ${unsafeCSS(sharedStyles.fonts.base)};
        color: ${sharedStyles.colors.text.primary};
        background: ${sharedStyles.colors.background.primary};
        border: 1px solid ${sharedStyles.colors.border.default};
        border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
      }

      .incidents-list {
        padding: ${unsafeCSS(sharedStyles.spacing.sm)};
      }

      .incident-card {
        background: ${sharedStyles.colors.background.primary};
        border: 1px solid ${sharedStyles.colors.border.default};
        border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
        margin-bottom: ${unsafeCSS(sharedStyles.spacing.sm)};
        overflow: hidden;
        transition: box-shadow ${unsafeCSS(sharedStyles.durations.fast)} ${unsafeCSS(sharedStyles.easings.default)};
      }

      .incident-card:last-child {
        margin-bottom: 0;
      }

      .incident-card:hover {
        box-shadow: ${unsafeCSS(sharedStyles.shadows.sm)};
      }

      .incident-header {
        display: flex;
        align-items: flex-start;
        gap: ${unsafeCSS(sharedStyles.spacing.md)};
        padding: ${unsafeCSS(sharedStyles.spacing.md)};
        cursor: pointer;
      }

      .incident-severity {
        width: 4px;
        align-self: stretch;
        border-radius: 2px;
        flex-shrink: 0;
      }

      .incident-severity.critical { background: ${sharedStyles.colors.status.majorOutage}; }
      .incident-severity.major { background: ${sharedStyles.colors.status.partialOutage}; }
      .incident-severity.minor { background: ${sharedStyles.colors.status.degraded}; }
      .incident-severity.maintenance { background: ${sharedStyles.colors.status.maintenance}; }

      .incident-main {
        flex: 1;
        min-width: 0;
      }

      .incident-title-row {
        display: flex;
        align-items: center;
        gap: ${unsafeCSS(sharedStyles.spacing.sm)};
        margin-bottom: 6px;
        flex-wrap: wrap;
      }

      .incident-title {
        font-size: 15px;
        font-weight: 600;
        color: ${sharedStyles.colors.text.primary};
        margin: 0;
      }

      .incident-status {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 10px;
        font-size: 11px;
        font-weight: 500;
        border-radius: 9999px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
      }

      .incident-status dees-icon {
        font-size: 12px;
      }

      .incident-status.investigating {
        background: ${cssManager.bdTheme('rgba(249, 115, 22, 0.1)', 'rgba(249, 115, 22, 0.2)')};
        color: ${sharedStyles.colors.status.partialOutage};
        --icon-color: ${sharedStyles.colors.status.partialOutage};
      }

      .incident-status.identified {
        background: ${cssManager.bdTheme('rgba(234, 179, 8, 0.1)', 'rgba(234, 179, 8, 0.2)')};
        color: ${sharedStyles.colors.status.degraded};
        --icon-color: ${sharedStyles.colors.status.degraded};
      }

      .incident-status.monitoring {
        background: ${cssManager.bdTheme('rgba(59, 130, 246, 0.1)', 'rgba(59, 130, 246, 0.2)')};
        color: ${sharedStyles.colors.status.maintenance};
        --icon-color: ${sharedStyles.colors.status.maintenance};
      }

      .incident-status.resolved {
        background: ${cssManager.bdTheme('rgba(34, 197, 94, 0.1)', 'rgba(34, 197, 94, 0.2)')};
        color: ${sharedStyles.colors.status.operational};
        --icon-color: ${sharedStyles.colors.status.operational};
      }

      .incident-status.postmortem {
        background: ${cssManager.bdTheme('rgba(168, 85, 247, 0.1)', 'rgba(168, 85, 247, 0.2)')};
        color: #a855f7;
        --icon-color: #a855f7;
      }

      .incident-meta {
        display: flex;
        align-items: center;
        gap: ${unsafeCSS(sharedStyles.spacing.md)};
        font-size: 12px;
        color: ${sharedStyles.colors.text.muted};
        flex-wrap: wrap;
      }

      .incident-meta-item {
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .incident-meta-item dees-icon {
        --icon-color: ${sharedStyles.colors.text.muted};
        opacity: 0.7;
      }

      .incident-actions {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
      }

      .incident-expand {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        padding: 0;
        color: ${sharedStyles.colors.text.muted};
        background: transparent;
        border: none;
        border-radius: ${unsafeCSS(sharedStyles.borderRadius.sm)};
        cursor: pointer;
        transition: all ${unsafeCSS(sharedStyles.durations.fast)} ${unsafeCSS(sharedStyles.easings.default)};
      }

      .incident-expand:hover {
        background: ${sharedStyles.colors.background.muted};
        color: ${sharedStyles.colors.text.primary};
      }

      .incident-expand.expanded dees-icon {
        transform: rotate(180deg);
      }

      .incident-expand dees-icon {
        transition: transform ${unsafeCSS(sharedStyles.durations.fast)} ${unsafeCSS(sharedStyles.easings.default)};
        --icon-color: currentColor;
      }

      .incident-details {
        padding: 0 ${unsafeCSS(sharedStyles.spacing.md)} ${unsafeCSS(sharedStyles.spacing.md)};
        padding-left: calc(${unsafeCSS(sharedStyles.spacing.md)} + 4px + ${unsafeCSS(sharedStyles.spacing.md)});
        border-top: 1px solid ${sharedStyles.colors.border.light};
      }

      .detail-section {
        margin-top: ${unsafeCSS(sharedStyles.spacing.md)};
      }

      .detail-label {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: ${sharedStyles.colors.text.muted};
        margin-bottom: 8px;
      }

      .detail-text {
        font-size: 13px;
        color: ${sharedStyles.colors.text.primary};
        line-height: 1.6;
      }

      .services-list {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
      }

      .service-tag {
        display: inline-block;
        padding: 4px 10px;
        font-size: 11px;
        font-weight: 500;
        background: ${sharedStyles.colors.background.muted};
        color: ${sharedStyles.colors.text.secondary};
        border-radius: ${unsafeCSS(sharedStyles.borderRadius.sm)};
      }

      .updates-timeline {
        position: relative;
        padding-left: 24px;
      }

      .updates-timeline::before {
        content: '';
        position: absolute;
        left: 7px;
        top: 8px;
        bottom: 8px;
        width: 2px;
        background: ${sharedStyles.colors.border.default};
        border-radius: 1px;
      }

      .update-item {
        position: relative;
        padding-bottom: ${unsafeCSS(sharedStyles.spacing.md)};
      }

      .update-item:last-child {
        padding-bottom: 0;
      }

      .update-item::before {
        content: '';
        position: absolute;
        left: -17px;
        top: 6px;
        width: 10px;
        height: 10px;
        background: ${sharedStyles.colors.background.secondary};
        border: 2px solid ${sharedStyles.colors.accent.primary};
        border-radius: 50%;
      }

      .update-header {
        display: flex;
        align-items: center;
        gap: ${unsafeCSS(sharedStyles.spacing.sm)};
        margin-bottom: 6px;
      }

      .update-status {
        font-size: 13px;
        font-weight: 600;
        text-transform: capitalize;
        color: ${sharedStyles.colors.text.primary};
      }

      .update-time {
        font-size: 11px;
        color: ${sharedStyles.colors.text.muted};
      }

      .update-message {
        font-size: 13px;
        color: ${sharedStyles.colors.text.secondary};
        line-height: 1.6;
      }

      .update-author {
        font-size: 11px;
        color: ${sharedStyles.colors.text.muted};
        margin-top: 6px;
        font-style: italic;
      }

      .empty-state {
        padding: 64px 24px;
        text-align: center;
      }

      .empty-state dees-icon {
        --icon-color: ${sharedStyles.colors.status.operational};
        opacity: 0.6;
        margin-bottom: 20px;
      }

      .empty-title {
        font-size: 16px;
        font-weight: 600;
        color: ${sharedStyles.colors.text.primary};
        margin-bottom: 8px;
      }

      .empty-text {
        font-size: 14px;
        color: ${sharedStyles.colors.text.muted};
      }

      .loading-overlay {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: ${cssManager.bdTheme('rgba(255,255,255,0.9)', 'rgba(0,0,0,0.7)')};
        z-index: 10;
        backdrop-filter: blur(2px);
      }
    `
        ];
        render() {
            const filteredIncidents = this.getFilteredIncidents();
            const currentCount = this.incidents.filter(i => !['resolved', 'postmortem'].includes(i.status)).length;
            const pastCount = this.incidents.filter(i => ['resolved', 'postmortem'].includes(i.status)).length;
            return html `
      <div class="list-container" style="position: relative;">
        ${this.loading ? html `
          <div class="loading-overlay">
            <dees-spinner></dees-spinner>
          </div>
        ` : ''}

        <div class="list-header">
          <div class="tabs">
            <button
              class="tab ${this.tabFilter === 'current' ? 'active' : ''}"
              @click="${() => this.tabFilter = 'current'}"
            >
              Current
              <span class="tab-count">${currentCount}</span>
            </button>
            <button
              class="tab ${this.tabFilter === 'past' ? 'active' : ''}"
              @click="${() => this.tabFilter = 'past'}"
            >
              Past
              <span class="tab-count">${pastCount}</span>
            </button>
            <button
              class="tab ${this.tabFilter === 'all' ? 'active' : ''}"
              @click="${() => this.tabFilter = 'all'}"
            >
              All
              <span class="tab-count">${this.incidents.length}</span>
            </button>
          </div>

          <div class="list-controls">
            <select class="filter-select" @change="${this.handleSeverityFilter}">
              <option value="all" ?selected="${this.severityFilter === 'all'}">All Severities</option>
              <option value="critical" ?selected="${this.severityFilter === 'critical'}">Critical</option>
              <option value="major" ?selected="${this.severityFilter === 'major'}">Major</option>
              <option value="minor" ?selected="${this.severityFilter === 'minor'}">Minor</option>
              <option value="maintenance" ?selected="${this.severityFilter === 'maintenance'}">Maintenance</option>
            </select>

            <dees-button type="highlighted" @click="${this.handleAddClick}">
              <dees-icon .icon=${'lucide:Plus'} .iconSize=${16}></dees-icon>
              New Incident
            </dees-button>
          </div>
        </div>

        ${filteredIncidents.length > 0 ? html `
          <div class="incidents-list">
            ${filteredIncidents.map(incident => this.renderIncidentCard(incident))}
          </div>
        ` : html `
          <div class="empty-state">
            <dees-icon .icon=${'lucide:PartyPopper'} .iconSize=${48}></dees-icon>
            <div class="empty-title">
              ${this.tabFilter === 'current' ? 'No active incidents' : 'No incidents found'}
            </div>
            <div class="empty-text">
              ${this.tabFilter === 'current'
                ? 'All systems are operating normally'
                : 'Try adjusting your filters'}
            </div>
          </div>
        `}
      </div>
    `;
        }
        renderIncidentCard(incident) {
            const isExpanded = this.expandedIncidents.has(incident.id);
            const formatTime = (timestamp) => {
                const date = new Date(timestamp);
                return date.toLocaleString();
            };
            const formatDuration = (start, end) => {
                const duration = (end || Date.now()) - start;
                const hours = Math.floor(duration / (1000 * 60 * 60));
                const minutes = Math.floor((duration % (1000 * 60 * 60)) / (1000 * 60));
                if (hours > 0)
                    return `${hours}h ${minutes}m`;
                return `${minutes}m`;
            };
            return html `
      <div class="incident-card">
        <div class="incident-header" @click="${() => this.toggleExpanded(incident.id)}">
          <div class="incident-severity ${incident.severity}"></div>

          <div class="incident-main">
            <div class="incident-title-row">
              <h3 class="incident-title">${incident.title}</h3>
              <span class="incident-status ${incident.status}">
                <dees-icon .icon=${this.statusIcons[incident.status]} .iconSize=${12}></dees-icon>
                ${this.statusLabels[incident.status]}
              </span>
            </div>
            <div class="incident-meta">
              <span class="incident-meta-item">
                <dees-icon .icon=${'lucide:Calendar'} .iconSize=${12}></dees-icon>
                ${formatTime(incident.startTime)}
              </span>
              <span class="incident-meta-item">
                <dees-icon .icon=${'lucide:Clock'} .iconSize=${12}></dees-icon>
                ${formatDuration(incident.startTime, incident.endTime)}
              </span>
              <span class="incident-meta-item">
                <dees-icon .icon=${'lucide:Server'} .iconSize=${12}></dees-icon>
                ${incident.affectedServices.length} services
              </span>
              <span class="incident-meta-item">
                <dees-icon .icon=${'lucide:MessageSquare'} .iconSize=${12}></dees-icon>
                ${incident.updates.length} updates
              </span>
            </div>
          </div>

          <div class="incident-actions" @click="${(e) => e.stopPropagation()}">
            ${!['resolved', 'postmortem'].includes(incident.status) ? html `
              <dees-button type="highlighted" @click="${() => this.handleAddUpdate(incident)}">
                <dees-icon .icon=${'lucide:Plus'} .iconSize=${14}></dees-icon>
                Update
              </dees-button>
            ` : ''}
            <dees-button type="discreet" @click="${() => this.handleEdit(incident)}">
              <dees-icon .icon=${'lucide:Pencil'} .iconSize=${14}></dees-icon>
            </dees-button>
          </div>

          <button class="incident-expand ${isExpanded ? 'expanded' : ''}">
            <dees-icon .icon=${'lucide:ChevronDown'} .iconSize=${16}></dees-icon>
          </button>
        </div>

        ${isExpanded ? html `
          <div class="incident-details">
            <div class="detail-section">
              <div class="detail-label">Impact</div>
              <div class="detail-text">${incident.impact}</div>
            </div>

            <div class="detail-section">
              <div class="detail-label">Affected Services</div>
              <div class="services-list">
                ${incident.affectedServices.map(service => html `
                  <span class="service-tag">${service}</span>
                `)}
              </div>
            </div>

            ${incident.rootCause ? html `
              <div class="detail-section">
                <div class="detail-label">Root Cause</div>
                <div class="detail-text">${incident.rootCause}</div>
              </div>
            ` : ''}

            ${incident.resolution ? html `
              <div class="detail-section">
                <div class="detail-label">Resolution</div>
                <div class="detail-text">${incident.resolution}</div>
              </div>
            ` : ''}

            ${incident.updates.length > 0 ? html `
              <div class="detail-section">
                <div class="detail-label">Updates Timeline</div>
                <div class="updates-timeline">
                  ${incident.updates.slice().reverse().map(update => html `
                    <div class="update-item">
                      <div class="update-header">
                        <span class="update-status">${update.status}</span>
                        <span class="update-time">${formatTime(update.timestamp)}</span>
                      </div>
                      <div class="update-message">${update.message}</div>
                      ${update.author ? html `<div class="update-author">— ${update.author}</div>` : ''}
                    </div>
                  `)}
                </div>
              </div>
            ` : ''}
          </div>
        ` : ''}
      </div>
    `;
        }
        getFilteredIncidents() {
            let result = [...this.incidents];
            // Tab filter
            switch (this.tabFilter) {
                case 'current':
                    result = result.filter(i => !['resolved', 'postmortem'].includes(i.status));
                    break;
                case 'past':
                    result = result.filter(i => ['resolved', 'postmortem'].includes(i.status));
                    break;
            }
            // Severity filter
            if (this.severityFilter !== 'all') {
                result = result.filter(i => i.severity === this.severityFilter);
            }
            // Sort by start time descending
            result.sort((a, b) => b.startTime - a.startTime);
            return result;
        }
        handleSeverityFilter(e) {
            this.severityFilter = e.target.value;
        }
        toggleExpanded(incidentId) {
            const newSet = new Set(this.expandedIncidents);
            if (newSet.has(incidentId)) {
                newSet.delete(incidentId);
            }
            else {
                newSet.add(incidentId);
            }
            this.expandedIncidents = newSet;
        }
        handleAddClick() {
            this.dispatchEvent(new CustomEvent('incidentAdd', {
                bubbles: true,
                composed: true
            }));
        }
        handleEdit(incident) {
            this.dispatchEvent(new CustomEvent('incidentEdit', {
                detail: { incident },
                bubbles: true,
                composed: true
            }));
        }
        handleAddUpdate(incident) {
            this.dispatchEvent(new CustomEvent('incidentAddUpdate', {
                detail: { incident },
                bubbles: true,
                composed: true
            }));
        }
        static {
            __runInitializers(_classThis, _classExtraInitializers);
        }
    };
    return UpladminIncidentList = _classThis;
})();
export { UpladminIncidentList };
//# sourceMappingURL=data:application/json;base64, 