import {
  InternalsController
} from "/node_modules/.vite/deps/chunk-NT42JCZG.js?v=bff2a436";
import {
  state
} from "/node_modules/.vite/deps/chunk-4EMZI4EH.js?v=bff2a436";
import {
  Logger
} from "/node_modules/.vite/deps/chunk-CAYODABQ.js?v=bff2a436";
import {
  Directive,
  LitElement,
  PartType,
  __classPrivateFieldGet,
  __classPrivateFieldSet,
  __decorate,
  classMap,
  css,
  customElement,
  directive,
  html,
  isServer,
  noChange,
  notEqual,
  nothing,
  property
} from "/node_modules/.vite/deps/chunk-F6B56SAQ.js?v=bff2a436";

// node_modules/lit-html/development/directives/unsafe-html.js
var HTML_RESULT = 1;
var UnsafeHTMLDirective = class extends Directive {
  constructor(partInfo) {
    super(partInfo);
    this._value = nothing;
    if (partInfo.type !== PartType.CHILD) {
      throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
    }
  }
  render(value) {
    if (value === nothing || value == null) {
      this._templateResult = void 0;
      return this._value = value;
    }
    if (value === noChange) {
      return value;
    }
    if (typeof value != "string") {
      throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
    }
    if (value === this._value) {
      return this._templateResult;
    }
    this._value = value;
    const strings = [value];
    strings.raw = strings;
    return this._templateResult = {
      // Cast to a known set of integers that satisfy ResultType so that we
      // don't have to export ResultType and possibly encourage this pattern.
      // This property needs to remain unminified.
      ["_$litType$"]: this.constructor.resultType,
      strings,
      values: []
    };
  }
};
UnsafeHTMLDirective.directiveName = "unsafeHTML";
UnsafeHTMLDirective.resultType = HTML_RESULT;
var unsafeHTML = directive(UnsafeHTMLDirective);

// node_modules/@patternfly/pfe-core/controllers/property-observer-controller.js
var _PropertyObserverController_instances;
var _PropertyObserverController_neverRan;
var _PropertyObserverController_init;
var UNINITIALIZED = Symbol("uninitialized");
var PropertyObserverController = class {
  constructor(host, options) {
    _PropertyObserverController_instances.add(this);
    this.host = host;
    this.options = options;
    this.oldVal = UNINITIALIZED;
    _PropertyObserverController_neverRan.set(this, true);
  }
  hostConnected() {
    __classPrivateFieldGet(this, _PropertyObserverController_instances, "m", _PropertyObserverController_init).call(this);
  }
  /** Set any cached valued accumulated between constructor and connectedCallback */
  async hostUpdate() {
    __classPrivateFieldGet(this, _PropertyObserverController_instances, "m", _PropertyObserverController_init).call(this);
    const { oldVal, options: { waitFor, propertyName, callback } } = this;
    if (!callback) {
      throw new Error(`no callback for ${propertyName}`);
    }
    const newVal = this.host[propertyName];
    this.oldVal = newVal;
    if (newVal !== oldVal) {
      switch (waitFor) {
        case "connected":
          if (!this.host.isConnected) {
            const origConnected = this.host.connectedCallback;
            await new Promise((resolve) => {
              this.host.connectedCallback = function() {
                resolve(origConnected?.call(this));
              };
            });
          }
          break;
        case "firstUpdated":
          if (!this.host.hasUpdated) {
            await this.host.updateComplete;
          }
          break;
        case "updated":
          await this.host.updateComplete;
          break;
      }
    }
    const Class = this.host.constructor;
    const hasChanged = Class.getPropertyOptions(this.options.propertyName).hasChanged ?? notEqual;
    if (__classPrivateFieldGet(this, _PropertyObserverController_neverRan, "f") || hasChanged(oldVal, newVal)) {
      callback.call(this.host, oldVal, newVal);
      __classPrivateFieldSet(this, _PropertyObserverController_neverRan, false, "f");
    }
  }
};
_PropertyObserverController_neverRan = /* @__PURE__ */ new WeakMap(), _PropertyObserverController_instances = /* @__PURE__ */ new WeakSet(), _PropertyObserverController_init = function _PropertyObserverController_init2() {
  if (this.oldVal === UNINITIALIZED) {
    this.oldVal = this.host[this.options.propertyName];
  }
};

// node_modules/@patternfly/pfe-core/decorators/observes.js
function observes(propertyName, options) {
  return function(proto, methodName) {
    const callback = proto[methodName];
    if (typeof callback !== "function") {
      throw new Error("@observes must decorate a class method");
    }
    const klass = proto.constructor;
    klass.addInitializer((instance) => {
      instance.addController(new PropertyObserverController(instance, {
        ...options,
        propertyName,
        callback
      }));
    });
  };
}

// node_modules/@rhds/elements/elements/rh-icon/rh-icon.js
var _RhIcon_instances;
var _a;
var _RhIcon_intersecting;
var _RhIcon_logger;
var _RhIcon_internals;
var _RhIcon_getContent;
var _RhIcon_lazyLoad;
var _RhIcon_dispatchLoad;
var _RhIcon_load;
var RhIcon_1;
var style = css`:host{line-height:0;aspect-ratio:1/1;display:inline-flex;place-content:center}#container{display:contents}svg{width:var(--rh-icon-size,var(--rh-size-icon-01,16px));fill:currentcolor;aspect-ratio:1/1}.standard svg{width:var(--rh-icon-size,var(--rh-size-icon-04,40px))}.microns svg{width:12px}`;
if (isServer) {
  await import("/node_modules/.vite/deps/ssr-4LIFPUZM.js?v=bff2a436");
}
var ric = globalThis.requestIdleCallback ?? globalThis.requestAnimationFrame ?? (async (f) => Promise.resolve().then(f));
var IconResolveErrorEvent = class extends ErrorEvent {
  constructor(set, icon, originalError) {
    super("error", { message: `Could not load icon "${icon}" from set "${set}".` });
    this.originalError = originalError;
  }
};
var RhIcon = RhIcon_1 = _a = class RhIcon2 extends LitElement {
  constructor() {
    super(...arguments);
    _RhIcon_instances.add(this);
    this.loading = "lazy";
    _RhIcon_intersecting.set(this, false);
    _RhIcon_logger.set(this, new Logger(this));
    _RhIcon_internals.set(this, InternalsController.of(this));
  }
  connectedCallback() {
    super.connectedCallback();
    RhIcon_1.instances.add(this);
  }
  render() {
    const { set = "standard" } = this;
    const content = __classPrivateFieldGet(this, _RhIcon_instances, "m", _RhIcon_getContent).call(this);
    return html`
      <div id="container"
           aria-hidden="${String(!!content)}"
           class="${classMap({ [set]: set })}">${!isServer ? content : unsafeHTML(content)}<span part="fallback" ?hidden="${content}"><slot></slot></span>
      </div>
    `;
  }
  updated() {
    const [, ...duplicateContainers] = this.shadowRoot?.querySelectorAll("#container") ?? [];
    for (const dupe of duplicateContainers) {
      dupe.remove();
    }
  }
  disconnectedCallback() {
    super.disconnectedCallback();
    RhIcon_1.io.unobserve(this);
    RhIcon_1.instances.delete(this);
  }
  iconChanged() {
    __classPrivateFieldGet(this, _RhIcon_instances, "m", _RhIcon_dispatchLoad).call(this);
  }
  accessibleLabelChanged() {
    __classPrivateFieldGet(this, _RhIcon_internals, "f").ariaLabel = this.accessibleLabel ?? null;
    if (this.accessibleLabel) {
      __classPrivateFieldGet(this, _RhIcon_internals, "f").role = "img";
    } else {
      __classPrivateFieldGet(this, _RhIcon_internals, "f").role = "presentation";
    }
  }
  async contentChanged(old) {
    if (old !== this.content) {
      await this.updateComplete;
      this.dispatchEvent(new Event("load", { bubbles: true }));
    }
  }
};
_RhIcon_intersecting = /* @__PURE__ */ new WeakMap();
_RhIcon_logger = /* @__PURE__ */ new WeakMap();
_RhIcon_internals = /* @__PURE__ */ new WeakMap();
_RhIcon_instances = /* @__PURE__ */ new WeakSet();
_RhIcon_getContent = function _RhIcon_getContent2() {
  if (isServer) {
    const { set = "standard", icon } = this;
    return globalThis.RH_ICONS.get(set)?.get(icon) ?? "";
  } else {
    return this.content ?? "";
  }
};
_RhIcon_lazyLoad = function _RhIcon_lazyLoad2(shouldObserve = true) {
  if (shouldObserve) {
    RhIcon_1.io.observe(this);
  }
  if (__classPrivateFieldGet(this, _RhIcon_intersecting, "f")) {
    __classPrivateFieldGet(this, _RhIcon_instances, "m", _RhIcon_load).call(this);
  }
};
_RhIcon_dispatchLoad = function _RhIcon_dispatchLoad2(shouldObserve = true) {
  switch (this.loading) {
    case "idle":
      return void ric(() => __classPrivateFieldGet(this, _RhIcon_instances, "m", _RhIcon_load).call(this));
    case "lazy":
      return void __classPrivateFieldGet(this, _RhIcon_instances, "m", _RhIcon_lazyLoad).call(this, shouldObserve);
    case "eager":
      return void __classPrivateFieldGet(this, _RhIcon_instances, "m", _RhIcon_load).call(this);
  }
};
_RhIcon_load = async function _RhIcon_load2() {
  const { set = "standard", icon } = this;
  if (set && icon) {
    try {
      this.content = await RhIcon_1.resolve?.(set, icon);
    } catch (error) {
      if (error instanceof Error) {
        __classPrivateFieldGet(this, _RhIcon_logger, "f").error(error.message);
        this.dispatchEvent(new IconResolveErrorEvent(set, icon, error));
      }
    }
  }
};
RhIcon.styles = [style];
RhIcon.onIntersect = (records) => records.forEach(({ isIntersecting, target }) => {
  const icon = target;
  __classPrivateFieldSet(icon, _RhIcon_intersecting, isIntersecting, "f");
  __classPrivateFieldGet(icon, _RhIcon_instances, "m", _RhIcon_dispatchLoad).call(icon, false);
});
RhIcon.io = new IntersectionObserver(RhIcon_1.onIntersect);
RhIcon.instances = /* @__PURE__ */ new Set();
RhIcon.resolve = (set, icon) => import(`@rhds/icons/${set}/${icon}.js`).then((mod) => mod.default.cloneNode(true));
__decorate([
  property({ type: String, reflect: true })
], RhIcon.prototype, "set", void 0);
__decorate([
  property({ type: String, reflect: true })
], RhIcon.prototype, "icon", void 0);
__decorate([
  property({ attribute: "accessible-label" })
], RhIcon.prototype, "accessibleLabel", void 0);
__decorate([
  property()
], RhIcon.prototype, "loading", void 0);
__decorate([
  state()
], RhIcon.prototype, "content", void 0);
__decorate([
  observes("icon"),
  observes("set")
], RhIcon.prototype, "iconChanged", null);
__decorate([
  observes("accessibleLabel")
], RhIcon.prototype, "accessibleLabelChanged", null);
__decorate([
  observes("content")
], RhIcon.prototype, "contentChanged", null);
RhIcon = RhIcon_1 = __decorate([
  customElement("rh-icon")
], RhIcon);

export {
  observes,
  IconResolveErrorEvent,
  RhIcon
};
/*! Bundled license information:

lit-html/development/directives/unsafe-html.js:
  (**
   * @license
   * Copyright 2017 Google LLC
   * SPDX-License-Identifier: BSD-3-Clause
   *)
*/
//# sourceMappingURL=chunk-4BSEK2PW.js.map
