import {
  ReactiveElement,
  __classPrivateFieldGet,
  __classPrivateFieldSet,
  css,
  getCompatibleStyle,
  isServer,
  supportsAdoptingStyleSheets
} from "/node_modules/.vite/deps/chunk-F6B56SAQ.js?v=bff2a436";

// node_modules/@patternfly/pfe-core/controllers/style-controller.js
var StyleController = class {
  constructor(host, styles) {
    this.host = host;
    this.styles = styles;
    this.stylesAdopted = false;
    host.addController(this);
  }
  hostConnected() {
    if (this.stylesAdopted || !(this.host.renderRoot instanceof ShadowRoot)) {
      return;
    }
    const styles = [this.styles].flatMap((x) => getCompatibleStyle(x)).filter((x) => !!x);
    if (supportsAdoptingStyleSheets) {
      this.host.renderRoot.adoptedStyleSheets = [
        ...styles.map((x) => x instanceof CSSStyleSheet ? x : x.styleSheet),
        ...this.host.renderRoot.adoptedStyleSheets ?? []
      ];
    } else {
      styles.forEach((s) => {
        const style = document.createElement("style");
        const nonce = window["litNonce"];
        if (nonce !== void 0) {
          style.setAttribute("nonce", nonce);
        }
        style.textContent = s.cssText;
        this.host.renderRoot.appendChild(style);
      });
    }
    this.stylesAdopted = true;
  }
};

// node_modules/@rhds/elements/lib/context/event.js
function createContext(key) {
  return key;
}
var ContextRequestEvent = class extends Event {
  constructor(context, callback, subscribe) {
    super("context-request", { bubbles: true, composed: true });
    this.context = context;
    this.callback = callback;
    this.subscribe = subscribe;
  }
};

// node_modules/@rhds/elements/lib/context/color/controller.js
var contextEvents = /* @__PURE__ */ new Map();
var ColorContextController = class {
  constructor(host, styles) {
    this.host = host;
    this.last = null;
    new StyleController(host, styles);
    if (this.host instanceof ReactiveElement) {
      const Class = this.host.constructor;
      Class.styles = [Class.styles].flat().filter((x) => !!x).concat([styles]);
    }
    host.addController(this);
  }
};
ColorContextController.context = createContext(Symbol("rh-color-context"));

// node_modules/@rhds/tokens/css/color-context-consumer.css.js
var color_context_consumer_css_default = css`
.on,
.on.light {
  --rh-color-accent-base: var(--rh-color-accent-base-on-light, #0066cc);
  --rh-color-accent-brand: var(--rh-color-accent-brand-on-light, #ee0000);
  --rh-color-border-strong: var(--rh-color-border-strong-on-light, #151515);
  --rh-color-border-subtle: var(--rh-color-border-subtle-on-light, #c7c7c7);
  --rh-color-border-interactive: var(--rh-color-border-interactive-on-light, #0066cc);
  --rh-color-border-destructive: var(--rh-color-border-destructive-on-light, #b1380b);
  --rh-color-border-status-danger: var(--rh-color-border-status-danger-on-light, #b1380b);
  --rh-color-border-status-caution: var(--rh-color-border-status-caution-on-light, #ca6c0f);
  --rh-color-border-status-warning: var(--rh-color-border-status-warning-on-light, #dca614);
  --rh-color-border-status-neutral: var(--rh-color-border-status-neutral-on-light, #4d4d4d);
  --rh-color-border-status-info: var(--rh-color-border-status-info-on-light, #5e40be);
  --rh-color-border-status-success: var(--rh-color-border-status-success-on-light, #3d7317);
  --rh-color-brand-red: var(--rh-color-brand-red-on-light, #ee0000);
  --rh-color-icon-primary: var(--rh-color-icon-primary-on-light, #ee0000);
  --rh-color-icon-secondary: var(--rh-color-icon-secondary-on-light, #151515);
  --rh-color-icon-status-danger: var(--rh-color-icon-status-danger-on-light, #b1380b);
  --rh-color-icon-status-caution: var(--rh-color-icon-status-caution-on-light, #ca6c0f);
  --rh-color-icon-status-warning: var(--rh-color-icon-status-warning-on-light, #dca614);
  --rh-color-icon-status-default: var(--rh-color-icon-status-default-on-light, #4d4d4d);
  --rh-color-icon-status-neutral: var(--rh-color-icon-status-neutral-on-light, #4d4d4d);
  --rh-color-icon-status-info: var(--rh-color-icon-status-info-on-light, #5e40be);
  --rh-color-icon-status-success: var(--rh-color-icon-status-success-on-light, #3d7317);
  --rh-color-interactive-primary-default: var(--rh-color-interactive-primary-default-on-light, #0066cc);
  --rh-color-interactive-primary-hover: var(--rh-color-interactive-primary-hover-on-light, #003366);
  --rh-color-interactive-primary-active: var(--rh-color-interactive-primary-active-on-light, #003366);
  --rh-color-interactive-primary-focus: var(--rh-color-interactive-primary-focus-on-light, #003366);
  --rh-color-interactive-primary-visited-default: var(--rh-color-interactive-primary-visited-default-on-light, #5e40be);
  --rh-color-interactive-primary-visited-hover: var(--rh-color-interactive-primary-visited-hover-on-light, #21134d);
  --rh-color-interactive-primary-visited-active: var(--rh-color-interactive-primary-visited-active-on-light, #21134d);
  --rh-color-interactive-primary-visited-focus: var(--rh-color-interactive-primary-visited-focus-on-light, #21134d);
  --rh-color-interactive-secondary-default: var(--rh-color-interactive-secondary-default-on-light, #4d4d4d);
  --rh-color-interactive-secondary-hover: var(--rh-color-interactive-secondary-hover-on-light, #4d4d4d);
  --rh-color-interactive-secondary-active: var(--rh-color-interactive-secondary-active-on-light, #4d4d4d);
  --rh-color-interactive-secondary-focus: var(--rh-color-interactive-secondary-focus-on-light, #4d4d4d);
  --rh-color-interactive-secondary-visited-default: var(--rh-color-interactive-secondary-visited-default-on-light, #4d4d4d);
  --rh-color-interactive-secondary-visited-hover: var(--rh-color-interactive-secondary-visited-hover-on-light, #4d4d4d);
  --rh-color-interactive-secondary-visited-active: var(--rh-color-interactive-secondary-visited-active-on-light, #4d4d4d);
  --rh-color-interactive-secondary-visited-focus: var(--rh-color-interactive-secondary-visited-focus-on-light, #4d4d4d);
  --rh-color-status-danger: var(--rh-color-status-danger-on-light, #b1380b);
  --rh-color-status-caution: var(--rh-color-status-caution-on-light, #ca6c0f);
  --rh-color-status-warning: var(--rh-color-status-warning-on-light, #dca614);
  --rh-color-status-neutral: var(--rh-color-status-neutral-on-light, #4d4d4d);
  --rh-color-status-note: var(--rh-color-status-note-on-light, #5e40be);
  --rh-color-status-info: var(--rh-color-status-info-on-light, #5e40be);
  --rh-color-status-success: var(--rh-color-status-success-on-light, #3d7317);
  --rh-color-surface-status-danger: var(--rh-color-surface-status-danger-on-light, #ffe3d9);
  --rh-color-surface-status-caution: var(--rh-color-surface-status-caution-on-light, #ffe8cc);
  --rh-color-surface-status-warning: var(--rh-color-surface-status-warning-on-light, #fff4cc);
  --rh-color-surface-status-default: var(--rh-color-surface-status-default-on-light, #f2f2f2);
  --rh-color-surface-status-neutral: var(--rh-color-surface-status-neutral-on-light, #f2f2f2);
  --rh-color-surface-status-info: var(--rh-color-surface-status-info-on-light, #ece6ff);
  --rh-color-surface-status-success: var(--rh-color-surface-status-success-on-light, #e9f7df);
  --rh-color-text-primary: var(--rh-color-text-primary-on-light, #151515);
  --rh-color-text-secondary: var(--rh-color-text-secondary-on-light, #4d4d4d);
  --rh-color-text-brand: var(--rh-color-text-brand-on-light, #ee0000);

}

.on.dark {
  --rh-color-accent-base: var(--rh-color-accent-base-on-dark, #92c5f9);
  --rh-color-accent-brand: var(--rh-color-accent-brand-on-dark, #ee0000);
  --rh-color-border-strong: var(--rh-color-border-strong-on-dark, #ffffff);
  --rh-color-border-subtle: var(--rh-color-border-subtle-on-dark, #707070);
  --rh-color-border-interactive: var(--rh-color-border-interactive-on-dark, #92c5f9);
  --rh-color-border-destructive: var(--rh-color-border-destructive-on-dark, #f0561d);
  --rh-color-border-status-danger: var(--rh-color-border-status-danger-on-dark, #f0561d);
  --rh-color-border-status-caution: var(--rh-color-border-status-caution-on-dark, #f5921b);
  --rh-color-border-status-warning: var(--rh-color-border-status-warning-on-dark, #ffcc17);
  --rh-color-border-status-neutral: var(--rh-color-border-status-neutral-on-dark, #c7c7c7);
  --rh-color-border-status-info: var(--rh-color-border-status-info-on-dark, #b6a6e9);
  --rh-color-border-status-success: var(--rh-color-border-status-success-on-dark, #87bb62);
  --rh-color-brand-red: var(--rh-color-brand-red-on-dark, #ee0000);
  --rh-color-icon-primary: var(--rh-color-icon-primary-on-dark, #ee0000);
  --rh-color-icon-secondary: var(--rh-color-icon-secondary-on-dark, #ffffff);
  --rh-color-icon-status-danger: var(--rh-color-icon-status-danger-on-dark, #f0561d);
  --rh-color-icon-status-caution: var(--rh-color-icon-status-caution-on-dark, #f5921b);
  --rh-color-icon-status-warning: var(--rh-color-icon-status-warning-on-dark, #ffcc17);
  --rh-color-icon-status-default: var(--rh-color-icon-status-default-on-dark, #4d4d4d);
  --rh-color-icon-status-neutral: var(--rh-color-icon-status-neutral-on-dark, #c7c7c7);
  --rh-color-icon-status-info: var(--rh-color-icon-status-info-on-dark, #b6a6e9);
  --rh-color-icon-status-success: var(--rh-color-icon-status-success-on-dark, #87bb62);
  --rh-color-interactive-primary-default: var(--rh-color-interactive-primary-default-on-dark, #92c5f9);
  --rh-color-interactive-primary-hover: var(--rh-color-interactive-primary-hover-on-dark, #b9dafc);
  --rh-color-interactive-primary-active: var(--rh-color-interactive-primary-active-on-dark, #b9dafc);
  --rh-color-interactive-primary-focus: var(--rh-color-interactive-primary-focus-on-dark, #b9dafc);
  --rh-color-interactive-primary-visited-default: var(--rh-color-interactive-primary-visited-default-on-dark, #b6a6e9);
  --rh-color-interactive-primary-visited-hover: var(--rh-color-interactive-primary-visited-hover-on-dark, #ece6ff);
  --rh-color-interactive-primary-visited-active: var(--rh-color-interactive-primary-visited-active-on-dark, #ece6ff);
  --rh-color-interactive-primary-visited-focus: var(--rh-color-interactive-primary-visited-focus-on-dark, #ece6ff);
  --rh-color-interactive-secondary-default: var(--rh-color-interactive-secondary-default-on-dark, #c7c7c7);
  --rh-color-interactive-secondary-hover: var(--rh-color-interactive-secondary-hover-on-dark, #c7c7c7);
  --rh-color-interactive-secondary-active: var(--rh-color-interactive-secondary-active-on-dark, #c7c7c7);
  --rh-color-interactive-secondary-focus: var(--rh-color-interactive-secondary-focus-on-dark, #c7c7c7);
  --rh-color-interactive-secondary-visited-default: var(--rh-color-interactive-secondary-visited-default-on-dark, #c7c7c7);
  --rh-color-interactive-secondary-visited-hover: var(--rh-color-interactive-secondary-visited-hover-on-dark, #c7c7c7);
  --rh-color-interactive-secondary-visited-active: var(--rh-color-interactive-secondary-visited-active-on-dark, #c7c7c7);
  --rh-color-interactive-secondary-visited-focus: var(--rh-color-interactive-secondary-visited-focus-on-dark, #c7c7c7);
  --rh-color-status-danger: var(--rh-color-status-danger-on-dark, #f0561d);
  --rh-color-status-caution: var(--rh-color-status-caution-on-dark, #f5921b);
  --rh-color-status-warning: var(--rh-color-status-warning-on-dark, #ffcc17);
  --rh-color-status-neutral: var(--rh-color-status-neutral-on-dark, #c7c7c7);
  --rh-color-status-note: var(--rh-color-status-note-on-dark, #b6a6e9);
  --rh-color-status-info: var(--rh-color-status-info-on-dark, #b6a6e9);
  --rh-color-status-success: var(--rh-color-status-success-on-dark, #87bb62);
  --rh-color-surface-status-danger: var(--rh-color-surface-status-danger-on-dark, #ffe3d9);
  --rh-color-surface-status-caution: var(--rh-color-surface-status-caution-on-dark, #ffe8cc);
  --rh-color-surface-status-warning: var(--rh-color-surface-status-warning-on-dark, #73480b);
  --rh-color-surface-status-default: var(--rh-color-surface-status-default-on-dark, #f2f2f2);
  --rh-color-surface-status-neutral: var(--rh-color-surface-status-neutral-on-dark, #f2f2f2);
  --rh-color-surface-status-info: var(--rh-color-surface-status-info-on-dark, #ece6ff);
  --rh-color-surface-status-success: var(--rh-color-surface-status-success-on-dark, #e9f7df);
  --rh-color-text-primary: var(--rh-color-text-primary-on-dark, #ffffff);
  --rh-color-text-secondary: var(--rh-color-text-secondary-on-dark, #c7c7c7);
  --rh-color-text-brand: var(--rh-color-text-brand-on-dark, #ee0000);

}`;

// node_modules/@rhds/elements/lib/context/color/consumer.js
var _ColorContextConsumer_instances;
var _ColorContextConsumer_propertyName;
var _ColorContextConsumer_propertyValue_get;
var _ColorContextConsumer_propertyValue_set;
var _ColorContextConsumer_dispose;
var _ColorContextConsumer_override;
var _ColorContextConsumer_contextCallback;
var ColorContextConsumer = class extends ColorContextController {
  get value() {
    return __classPrivateFieldGet(this, _ColorContextConsumer_instances, "a", _ColorContextConsumer_propertyValue_get);
  }
  constructor(host, options) {
    super(host, color_context_consumer_css_default);
    _ColorContextConsumer_instances.add(this);
    this.options = options;
    _ColorContextConsumer_propertyName.set(this, void 0);
    _ColorContextConsumer_dispose.set(this, void 0);
    _ColorContextConsumer_override.set(this, null);
    __classPrivateFieldSet(this, _ColorContextConsumer_propertyName, options?.propertyName ?? "on", "f");
  }
  /** When a consumer connects, it requests colour context from the closest provider. */
  async hostConnected() {
    const { context } = ColorContextController;
    const event = new ContextRequestEvent(context, (e) => __classPrivateFieldGet(this, _ColorContextConsumer_instances, "m", _ColorContextConsumer_contextCallback).call(this, e), true);
    __classPrivateFieldSet(this, _ColorContextConsumer_override, __classPrivateFieldGet(this, _ColorContextConsumer_instances, "a", _ColorContextConsumer_propertyValue_get), "f");
    contextEvents.set(this.host, event);
    await this.host.updateComplete;
    this.host.dispatchEvent(event);
    __classPrivateFieldSet(this, _ColorContextConsumer_override, null, "f");
  }
  async hostUpdated() {
    if (!isServer && !this.host.hasUpdated) {
      const original = __classPrivateFieldGet(this, _ColorContextConsumer_instances, "a", _ColorContextConsumer_propertyValue_get);
      if (original) {
        await this.host.updateComplete;
        __classPrivateFieldSet(this, _ColorContextConsumer_instances, "__LIT_SSR_WORKAROUND__", "a", _ColorContextConsumer_propertyValue_set);
        await this.host.updateComplete;
        __classPrivateFieldSet(this, _ColorContextConsumer_instances, original, "a", _ColorContextConsumer_propertyValue_set);
      }
    }
  }
  /** When a consumer disconnects, it's removed from the list of consumers. */
  hostDisconnected() {
    __classPrivateFieldGet(this, _ColorContextConsumer_dispose, "f")?.call(this);
    __classPrivateFieldSet(this, _ColorContextConsumer_dispose, void 0, "f");
    contextEvents.delete(this.host);
  }
  /**
   * Sets the `on` attribute on the host and any children that requested multiple updates
   * @param next the color theme
   */
  update(next) {
    const { last } = this;
    if (!__classPrivateFieldGet(this, _ColorContextConsumer_override, "f") && next !== last) {
      this.last = next;
      __classPrivateFieldSet(this, _ColorContextConsumer_instances, next ?? void 0, "a", _ColorContextConsumer_propertyValue_set);
    }
    this.options?.callback?.(__classPrivateFieldGet(this, _ColorContextConsumer_instances, "a", _ColorContextConsumer_propertyValue_get));
  }
};
_ColorContextConsumer_propertyName = /* @__PURE__ */ new WeakMap(), _ColorContextConsumer_dispose = /* @__PURE__ */ new WeakMap(), _ColorContextConsumer_override = /* @__PURE__ */ new WeakMap(), _ColorContextConsumer_instances = /* @__PURE__ */ new WeakSet(), _ColorContextConsumer_propertyValue_get = function _ColorContextConsumer_propertyValue_get2() {
  return this.host[__classPrivateFieldGet(this, _ColorContextConsumer_propertyName, "f")];
}, _ColorContextConsumer_propertyValue_set = function _ColorContextConsumer_propertyValue_set2(x) {
  this.host[__classPrivateFieldGet(this, _ColorContextConsumer_propertyName, "f")] = x;
  this.host.requestUpdate();
}, _ColorContextConsumer_contextCallback = function _ColorContextConsumer_contextCallback2(value, dispose) {
  if (dispose && dispose !== __classPrivateFieldGet(this, _ColorContextConsumer_dispose, "f")) {
    __classPrivateFieldGet(this, _ColorContextConsumer_dispose, "f")?.call(this);
    __classPrivateFieldSet(this, _ColorContextConsumer_dispose, dispose, "f");
  }
  this.update(value);
};
function colorContextConsumer(options) {
  return function(proto, _propertyName) {
    const propertyName = _propertyName;
    proto.constructor.addInitializer((instance) => {
      const controller = new ColorContextConsumer(instance, { propertyName, ...options });
      instance.__DEBUG_colorContextConsumer = controller;
    });
  };
}

export {
  contextEvents,
  ColorContextController,
  ColorContextConsumer,
  colorContextConsumer
};
/*! Bundled license information:

@rhds/tokens/css/color-context-consumer.css.js:
  (**
   * Do not edit directly, this file was auto-generated.
   *
   * @license Copyright (c) 2022 Red Hat UX MIT License
   *)
*/
//# sourceMappingURL=chunk-KBYEGRCV.js.map
