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 { ChangeDetectionStrategy, ChangeDetectorRef, Component, inject } from '@angular/core';
import { RegisterClass } from '@memberjunction/global';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { PSResourceBase } from './ps-resource-base';
import { MODELS_SECTIONS, sectionGroups, sectionsInGroup, sectionLabel, sectionIcon, hasSection } from '../predictive-studio.nav';
import * as i0 from "@angular/core";
import * as i1 from "@memberjunction/ng-ui-components";
import * as i2 from "@memberjunction/ng-shared-generic";
import * as i3 from "../components/ps-registry.component";
import * as i4 from "../components/ps-production.component";
const _forTrack0 = ($index, $item) => $item.key;
function PSModelsResourceComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "mj-loading", 1);
} }
function PSModelsResourceComponent_Conditional_3_For_3_Conditional_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 7);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const group_r1 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(group_r1);
} }
function PSModelsResourceComponent_Conditional_3_For_3_For_2_Template(rf, ctx) { if (rf & 1) {
    const _r2 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 9);
    i0.ɵɵlistener("click", function PSModelsResourceComponent_Conditional_3_For_3_For_2_Template_button_click_0_listener() { const item_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r3 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r3.selectSection(item_r3.key)); });
    i0.ɵɵelement(1, "i");
    i0.ɵɵelementStart(2, "span");
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const item_r3 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(3);
    i0.ɵɵclassProp("active", ctx_r3.activeSection === item_r3.key);
    i0.ɵɵattribute("data-testid", "ps-nav-" + item_r3.key);
    i0.ɵɵadvance();
    i0.ɵɵclassMap(item_r3.icon);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(item_r3.label);
} }
function PSModelsResourceComponent_Conditional_3_For_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵconditionalCreate(0, PSModelsResourceComponent_Conditional_3_For_3_Conditional_0_Template, 2, 1, "div", 7);
    i0.ɵɵrepeaterCreate(1, PSModelsResourceComponent_Conditional_3_For_3_For_2_Template, 4, 6, "button", 8, _forTrack0);
} if (rf & 2) {
    const group_r1 = ctx.$implicit;
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵconditional(group_r1 ? 0 : -1);
    i0.ɵɵadvance();
    i0.ɵɵrepeater(ctx_r3.itemsForGroup(group_r1));
} }
function PSModelsResourceComponent_Conditional_3_Case_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "ps-registry", 5);
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("engine", ctx_r3.engine)("provider", ctx_r3.ProviderToUse)("currentUser", ctx_r3.ProviderToUse.CurrentUser);
} }
function PSModelsResourceComponent_Conditional_3_Case_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "ps-production", 6);
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("engine", ctx_r3.engine);
} }
function PSModelsResourceComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 2)(1, "aside", 3);
    i0.ɵɵrepeaterCreate(2, PSModelsResourceComponent_Conditional_3_For_3_Template, 3, 1, null, null, i0.ɵɵrepeaterTrackByIdentity);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "section", 4);
    i0.ɵɵconditionalCreate(5, PSModelsResourceComponent_Conditional_3_Case_5_Template, 1, 3, "ps-registry", 5)(6, PSModelsResourceComponent_Conditional_3_Case_6_Template, 1, 1, "ps-production", 6);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    let tmp_3_0;
    const ctx_r3 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵrepeater(ctx_r3.groups);
    i0.ɵɵadvance(2);
    i0.ɵɵattribute("data-testid", "ps-panel-" + ctx_r3.activeSection);
    i0.ɵɵadvance();
    i0.ɵɵconditional((tmp_3_0 = ctx_r3.activeSection) === "registry" ? 5 : tmp_3_0 === "production" ? 6 : -1);
} }
/**
 * **Models** — the trained-model lifecycle door (one of Predictive Studio's three consolidated nav
 * items, alongside `Predictions` and `Studio`). Hosts the registry + production section panels
 * (`ps-registry`, `ps-production`) behind an internal left-nav. The active section round-trips through
 * the `section` query param, so the `Overview` panel's cross-door "view in production" links (and any
 * deep link) can land directly on the right section. No docked copilot here — these are read/manage
 * surfaces; model creation + the Model Dev Agent live in the `Studio` and `Predictions` doors.
 */
let PSModelsResourceComponent = class PSModelsResourceComponent extends PSResourceBase {
    SectionKey = 'models';
    SectionLabel = 'Models';
    SectionIcon = 'fa-solid fa-cubes';
    cdrLocal = inject(ChangeDetectorRef);
    activeSection = 'registry';
    sections = MODELS_SECTIONS;
    ngOnInit() {
        super.ngOnInit();
        const initial = this.GetQueryParams()['section'];
        if (initial && hasSection(this.sections, initial))
            this.activeSection = initial;
    }
    OnQueryParamsChanged(params, _source) {
        const next = params['section'];
        if (next && next !== this.activeSection && hasSection(this.sections, next)) {
            this.activeSection = next;
            this.cdrLocal.detectChanges();
        }
    }
    extraAgentContext() {
        return { ActiveSection: sectionLabel(this.sections, this.activeSection) };
    }
    get groups() { return sectionGroups(this.sections); }
    itemsForGroup(group) { return sectionsInGroup(this.sections, group); }
    get activeLabel() { return sectionLabel(this.sections, this.activeSection); }
    get activeIcon() { return sectionIcon(this.sections, this.activeSection); }
    selectSection(key) {
        if (this.activeSection === key)
            return;
        this.activeSection = key;
        this.UpdateQueryParams({ section: key });
        this.publishAgentContext();
        this.cdrLocal.detectChanges();
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵPSModelsResourceComponent_BaseFactory; return function PSModelsResourceComponent_Factory(__ngFactoryType__) { return (ɵPSModelsResourceComponent_BaseFactory || (ɵPSModelsResourceComponent_BaseFactory = i0.ɵɵgetInheritedFactory(PSModelsResourceComponent)))(__ngFactoryType__ || PSModelsResourceComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PSModelsResourceComponent, selectors: [["mj-ps-models-resource"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 2, consts: [["Subtitle", "Versioned trained models and what's live in production", 3, "Title"], ["text", "Loading Models\u2026", "size", "medium"], ["data-testid", "ps-models-shell", 1, "ps-models-host"], [1, "ps-leftnav"], [1, "ps-content"], [3, "engine", "provider", "currentUser"], [3, "engine"], [1, "ps-nav-group"], [1, "ps-nav-item", 3, "active"], [1, "ps-nav-item", 3, "click"]], template: function PSModelsResourceComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelement(0, "mj-page-header-interior", 0);
            i0.ɵɵelementStart(1, "mj-page-body-interior");
            i0.ɵɵconditionalCreate(2, PSModelsResourceComponent_Conditional_2_Template, 1, 0, "mj-loading", 1)(3, PSModelsResourceComponent_Conditional_3_Template, 7, 2, "div", 2);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵproperty("Title", ctx.activeLabel);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.isLoading ? 2 : 3);
        } }, dependencies: [i1.MJPageHeaderInteriorComponent, i1.MJPageBodyInteriorComponent, i2.LoadingComponent, i3.PSRegistryComponent, i4.PSProductionComponent], styles: ["[_nghost-%COMP%] { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }\n      .ps-models-host[_ngcontent-%COMP%] { display: flex; flex: 1; min-height: 0; overflow: hidden; }\n      .ps-leftnav[_ngcontent-%COMP%] { width: 210px; flex: none; border-right: 1px solid var(--mj-border-default); background: var(--mj-bg-surface-card); overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }\n      .ps-nav-group[_ngcontent-%COMP%] { font-size: var(--mj-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-text-muted); padding: 12px 10px 4px; }\n      .ps-nav-item[_ngcontent-%COMP%] { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent; border-radius: var(--mj-radius-md); cursor: pointer; color: var(--mj-text-secondary); font-size: var(--mj-text-sm); font-weight: 500; transition: background .12s, color .12s; }\n      .ps-nav-item[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { width: 18px; text-align: center; color: var(--mj-text-muted); }\n      .ps-nav-item[_ngcontent-%COMP%]:hover { background: var(--mj-bg-surface-hover); color: var(--mj-text-primary); }\n      .ps-nav-item.active[_ngcontent-%COMP%] { background: color-mix(in srgb, var(--mj-brand-primary) 12%, transparent); color: var(--mj-brand-primary); font-weight: 600; }\n      .ps-nav-item.active[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] { color: var(--mj-brand-primary); }\n      .ps-content[_ngcontent-%COMP%] { flex: 1; min-width: 0; overflow-y: auto; padding: 8px 14px 24px; }"], changeDetection: 0 });
};
PSModelsResourceComponent = __decorate([
    RegisterClass(BaseResourceComponent, 'PredictiveStudioModelsResource')
], PSModelsResourceComponent);
export { PSModelsResourceComponent };
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PSModelsResourceComponent, [{
        type: Component,
        args: [{ standalone: false, selector: 'mj-ps-models-resource', template: `
    <mj-page-header-interior [Title]="activeLabel"
      Subtitle="Versioned trained models and what's live in production">
    </mj-page-header-interior>
    <mj-page-body-interior>
      @if (isLoading) {
        <mj-loading text="Loading Models…" size="medium"></mj-loading>
      } @else {
        <div class="ps-models-host" data-testid="ps-models-shell">
          <aside class="ps-leftnav">
            @for (group of groups; track group) {
              @if (group) { <div class="ps-nav-group">{{ group }}</div> }
              @for (item of itemsForGroup(group); track item.key) {
                <button class="ps-nav-item" [class.active]="activeSection === item.key"
                  [attr.data-testid]="'ps-nav-' + item.key" (click)="selectSection(item.key)">
                  <i [class]="item.icon"></i> <span>{{ item.label }}</span>
                </button>
              }
            }
          </aside>

          <section class="ps-content" [attr.data-testid]="'ps-panel-' + activeSection">
            @switch (activeSection) {
              @case ('registry') { <ps-registry [engine]="engine" [provider]="ProviderToUse" [currentUser]="ProviderToUse.CurrentUser"></ps-registry> }
              @case ('production') { <ps-production [engine]="engine"></ps-production> }
            }
          </section>
        </div>
      }
    </mj-page-body-interior>
  `, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["\n      :host { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }\n      .ps-models-host { display: flex; flex: 1; min-height: 0; overflow: hidden; }\n      .ps-leftnav { width: 210px; flex: none; border-right: 1px solid var(--mj-border-default); background: var(--mj-bg-surface-card); overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }\n      .ps-nav-group { font-size: var(--mj-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--mj-text-muted); padding: 12px 10px 4px; }\n      .ps-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: none; background: transparent; border-radius: var(--mj-radius-md); cursor: pointer; color: var(--mj-text-secondary); font-size: var(--mj-text-sm); font-weight: 500; transition: background .12s, color .12s; }\n      .ps-nav-item i { width: 18px; text-align: center; color: var(--mj-text-muted); }\n      .ps-nav-item:hover { background: var(--mj-bg-surface-hover); color: var(--mj-text-primary); }\n      .ps-nav-item.active { background: color-mix(in srgb, var(--mj-brand-primary) 12%, transparent); color: var(--mj-brand-primary); font-weight: 600; }\n      .ps-nav-item.active i { color: var(--mj-brand-primary); }\n      .ps-content { flex: 1; min-width: 0; overflow-y: auto; padding: 8px 14px 24px; }\n    "] }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PSModelsResourceComponent, { className: "PSModelsResourceComponent", filePath: "src/PredictiveStudio/resources/ps-models-resource.component.ts", lineNumber: 67 }); })();
/** Tree-shaking prevention — called from the subpath module so the @RegisterClass survives bundling. */
export function LoadPSModelsResource() {
    // intentionally empty
}
//# sourceMappingURL=ps-models-resource.component.js.map