[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> theme.js (source)

   1  (function() {
   2  var wp;
   3  (wp ||= {}).theme = (() => {
   4    var __create = Object.create;
   5    var __defProp = Object.defineProperty;
   6    var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   7    var __getOwnPropNames = Object.getOwnPropertyNames;
   8    var __getProtoOf = Object.getPrototypeOf;
   9    var __hasOwnProp = Object.prototype.hasOwnProperty;
  10    var __commonJS = (cb, mod) => function __require() {
  11      return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  12    };
  13    var __export = (target, all) => {
  14      for (var name in all)
  15        __defProp(target, name, { get: all[name], enumerable: true });
  16    };
  17    var __copyProps = (to2, from, except, desc) => {
  18      if (from && typeof from === "object" || typeof from === "function") {
  19        for (let key of __getOwnPropNames(from))
  20          if (!__hasOwnProp.call(to2, key) && key !== except)
  21            __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  22      }
  23      return to2;
  24    };
  25    var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  26      // If the importer is in node compatibility mode or this is not an ESM
  27      // file that has been converted to a CommonJS file using a Babel-
  28      // compatible transform (i.e. "__esModule" has not been set), then set
  29      // "default" to the CommonJS "module.exports" for node compatibility.
  30      isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  31      mod
  32    ));
  33    var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  34  
  35    // package-external:@wordpress/deprecated
  36    var require_deprecated = __commonJS({
  37      "package-external:@wordpress/deprecated"(exports, module) {
  38        module.exports = window.wp.deprecated;
  39      }
  40    });
  41  
  42    // package-external:@wordpress/private-apis
  43    var require_private_apis = __commonJS({
  44      "package-external:@wordpress/private-apis"(exports, module) {
  45        module.exports = window.wp.privateApis;
  46      }
  47    });
  48  
  49    // package-external:@wordpress/element
  50    var require_element = __commonJS({
  51      "package-external:@wordpress/element"(exports, module) {
  52        module.exports = window.wp.element;
  53      }
  54    });
  55  
  56    // package-external:@wordpress/compose
  57    var require_compose = __commonJS({
  58      "package-external:@wordpress/compose"(exports, module) {
  59        module.exports = window.wp.compose;
  60      }
  61    });
  62  
  63    // vendor-external:react/jsx-runtime
  64    var require_jsx_runtime = __commonJS({
  65      "vendor-external:react/jsx-runtime"(exports, module) {
  66        module.exports = window.ReactJSXRuntime;
  67      }
  68    });
  69  
  70    // packages/theme/build-module/index.mjs
  71    var index_exports = {};
  72    __export(index_exports, {
  73      ThemeProvider: () => ThemeProvider,
  74      privateApis: () => privateApis
  75    });
  76  
  77    // packages/theme/build-module/private-apis.mjs
  78    var import_deprecated = __toESM(require_deprecated(), 1);
  79  
  80    // packages/theme/build-module/lock-unlock.mjs
  81    var import_private_apis = __toESM(require_private_apis(), 1);
  82    var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
  83      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
  84      "@wordpress/theme"
  85    );
  86  
  87    // packages/theme/build-module/theme-provider.mjs
  88    var import_element3 = __toESM(require_element(), 1);
  89    var import_compose = __toESM(require_compose(), 1);
  90  
  91    // packages/theme/build-module/context.mjs
  92    var import_element = __toESM(require_element(), 1);
  93    var ThemeContext = (0, import_element.createContext)({
  94      resolvedSettings: {
  95        color: {},
  96        cursor: void 0,
  97        cornerRadius: void 0
  98      }
  99    });
 100  
 101    // packages/theme/node_modules/colorjs.io/src/multiply-matrices.js
 102    function dot3(a, b2) {
 103      return a[0] * b2[0] + a[1] * b2[1] + a[2] * b2[2];
 104    }
 105    function multiply_v3_m3x3(input, matrix, out = [0, 0, 0]) {
 106      const x = dot3(input, matrix[0]);
 107      const y = dot3(input, matrix[1]);
 108      const z = dot3(input, matrix[2]);
 109      out[0] = x;
 110      out[1] = y;
 111      out[2] = z;
 112      return out;
 113    }
 114  
 115    // packages/theme/node_modules/colorjs.io/src/util.js
 116    function isString(str) {
 117      return type(str) === "string";
 118    }
 119    function type(o) {
 120      let str = Object.prototype.toString.call(o);
 121      return (str.match(/^\[object\s+(.*?)\]$/)[1] || "").toLowerCase();
 122    }
 123    function serializeNumber(n2, { precision = 16, unit }) {
 124      if (isNone(n2)) {
 125        return "none";
 126      }
 127      n2 = +toPrecision(n2, precision);
 128      return n2 + (unit ?? "");
 129    }
 130    function isNone(n2) {
 131      return n2 === null;
 132    }
 133    function toPrecision(n2, precision) {
 134      if (n2 === 0) {
 135        return 0;
 136      }
 137      let integer = ~~n2;
 138      let digits = 0;
 139      if (integer && precision) {
 140        digits = ~~Math.log10(Math.abs(integer)) + 1;
 141      }
 142      const multiplier = 10 ** (precision - digits);
 143      return Math.floor(n2 * multiplier + 0.5) / multiplier;
 144    }
 145    function interpolate(start, end, p2) {
 146      if (isNaN(start)) {
 147        return end;
 148      }
 149      if (isNaN(end)) {
 150        return start;
 151      }
 152      return start + (end - start) * p2;
 153    }
 154    function interpolateInv(start, end, value) {
 155      return (value - start) / (end - start);
 156    }
 157    function mapRange(from, to2, value) {
 158      if (!from || !to2 || from === to2 || from[0] === to2[0] && from[1] === to2[1] || isNaN(value) || value === null) {
 159        return value;
 160      }
 161      return interpolate(to2[0], to2[1], interpolateInv(from[0], from[1], value));
 162    }
 163    function clamp(min, val, max) {
 164      return Math.max(Math.min(max, val), min);
 165    }
 166    function copySign(to2, from) {
 167      return Math.sign(to2) === Math.sign(from) ? to2 : -to2;
 168    }
 169    function spow(base, exp) {
 170      return copySign(Math.abs(base) ** exp, base);
 171    }
 172    function zdiv(n2, d2) {
 173      return d2 === 0 ? 0 : n2 / d2;
 174    }
 175    function bisectLeft(arr, value, lo = 0, hi = arr.length) {
 176      while (lo < hi) {
 177        const mid = lo + hi >> 1;
 178        if (arr[mid] < value) {
 179          lo = mid + 1;
 180        } else {
 181          hi = mid;
 182        }
 183      }
 184      return lo;
 185    }
 186    function isInstance(arg, constructor) {
 187      if (arg instanceof constructor) {
 188        return true;
 189      }
 190      const targetName = constructor.name;
 191      while (arg) {
 192        const proto = Object.getPrototypeOf(arg);
 193        const constructorName = proto?.constructor?.name;
 194        if (constructorName === targetName) {
 195          return true;
 196        }
 197        if (!constructorName || constructorName === "Object") {
 198          return false;
 199        }
 200        arg = proto;
 201      }
 202      return false;
 203    }
 204  
 205    // packages/theme/node_modules/colorjs.io/src/Type.js
 206    var Type = class {
 207      // Class properties - declared here so that type inference works
 208      type;
 209      coordMeta;
 210      coordRange;
 211      /** @type {[number, number]} */
 212      range;
 213      /**
 214       * @param {any} type
 215       * @param {import("./types.js").CoordMeta} coordMeta
 216       */
 217      constructor(type2, coordMeta) {
 218        if (typeof type2 === "object") {
 219          this.coordMeta = type2;
 220        }
 221        if (coordMeta) {
 222          this.coordMeta = coordMeta;
 223          this.coordRange = coordMeta.range ?? coordMeta.refRange;
 224        }
 225        if (typeof type2 === "string") {
 226          let params = type2.trim().match(/^(?<type><[a-z]+>)(\[(?<min>-?[.\d]+),\s*(?<max>-?[.\d]+)\])?$/);
 227          if (!params) {
 228            throw new TypeError(`Cannot parse $type2} as a type definition.`);
 229          }
 230          this.type = params.groups.type;
 231          let { min, max } = params.groups;
 232          if (min || max) {
 233            this.range = [+min, +max];
 234          }
 235        }
 236      }
 237      /** @returns {[number, number]} */
 238      get computedRange() {
 239        if (this.range) {
 240          return this.range;
 241        }
 242        if (this.type === "<percentage>") {
 243          return this.percentageRange();
 244        } else if (this.type === "<angle>") {
 245          return [0, 360];
 246        }
 247        return null;
 248      }
 249      get unit() {
 250        if (this.type === "<percentage>") {
 251          return "%";
 252        } else if (this.type === "<angle>") {
 253          return "deg";
 254        }
 255        return "";
 256      }
 257      /**
 258       * Map a number to the internal representation
 259       * @param {number} number
 260       */
 261      resolve(number) {
 262        if (this.type === "<angle>") {
 263          return number;
 264        }
 265        let fromRange = this.computedRange;
 266        let toRange = this.coordRange;
 267        if (this.type === "<percentage>") {
 268          toRange ??= this.percentageRange();
 269        }
 270        return mapRange(fromRange, toRange, number);
 271      }
 272      /**
 273       * Serialize a number from the internal representation to a string
 274       * @param {number} number
 275       * @param {number} [precision]
 276       */
 277      serialize(number, precision) {
 278        let toRange = this.type === "<percentage>" ? this.percentageRange(100) : this.computedRange;
 279        let unit = this.unit;
 280        number = mapRange(this.coordRange, toRange, number);
 281        return serializeNumber(number, { unit, precision });
 282      }
 283      toString() {
 284        let ret = this.type;
 285        if (this.range) {
 286          let [min = "", max = ""] = this.range;
 287          ret += `[$min},$max}]`;
 288        }
 289        return ret;
 290      }
 291      /**
 292       * Returns a percentage range for values of this type
 293       * @param {number} scale
 294       * @returns {[number, number]}
 295       */
 296      percentageRange(scale = 1) {
 297        let range;
 298        if (this.coordMeta && this.coordMeta.range || this.coordRange && this.coordRange[0] >= 0) {
 299          range = [0, 1];
 300        } else {
 301          range = [-1, 1];
 302        }
 303        return [range[0] * scale, range[1] * scale];
 304      }
 305      static get(type2, coordMeta) {
 306        if (isInstance(type2, this)) {
 307          return type2;
 308        }
 309        return new this(type2, coordMeta);
 310      }
 311    };
 312  
 313    // packages/theme/node_modules/colorjs.io/src/Format.js
 314    var instance = /* @__PURE__ */ Symbol("instance");
 315    var Format = class _Format {
 316      // Class properties - declared here so that type inference works
 317      type;
 318      name;
 319      spaceCoords;
 320      /** @type {Type[][]} */
 321      coords;
 322      /** @type {string | undefined} */
 323      id;
 324      /** @type {boolean | undefined} */
 325      alpha;
 326      /**
 327       * @param {FormatInterface} format
 328       * @param {ColorSpace} space
 329       */
 330      constructor(format, space = format.space) {
 331        format[instance] = this;
 332        this.type = "function";
 333        this.name = "color";
 334        Object.assign(this, format);
 335        this.space = space;
 336        if (this.type === "custom") {
 337          return;
 338        }
 339        this.spaceCoords = Object.values(space.coords);
 340        if (!this.coords) {
 341          this.coords = this.spaceCoords.map((coordMeta) => {
 342            let ret = ["<number>", "<percentage>"];
 343            if (coordMeta.type === "angle") {
 344              ret.push("<angle>");
 345            }
 346            return ret;
 347          });
 348        }
 349        this.coords = this.coords.map(
 350          /** @param {string | string[] | Type[]} types */
 351          (types, i) => {
 352            let coordMeta = this.spaceCoords[i];
 353            if (typeof types === "string") {
 354              types = types.trim().split(/\s*\|\s*/);
 355            }
 356            return types.map((type2) => Type.get(type2, coordMeta));
 357          }
 358        );
 359      }
 360      /**
 361       * @param {Coords} coords
 362       * @param {number} precision
 363       * @param {Type[]} types
 364       */
 365      serializeCoords(coords, precision, types) {
 366        types = coords.map((_, i) => Type.get(types?.[i] ?? this.coords[i][0], this.spaceCoords[i]));
 367        return coords.map((c, i) => types[i].serialize(c, precision));
 368      }
 369      /**
 370       * Validates the coordinates of a color against a format's coord grammar and
 371       * maps the coordinates to the range or refRange of the coordinates.
 372       * @param {Coords} coords
 373       * @param {[string, string, string]} types
 374       */
 375      coerceCoords(coords, types) {
 376        return Object.entries(this.space.coords).map(([id, coordMeta], i) => {
 377          let arg = coords[i];
 378          if (isNone(arg) || isNaN(arg)) {
 379            return arg;
 380          }
 381          let providedType = types[i];
 382          let type2 = this.coords[i].find((c) => c.type == providedType);
 383          if (!type2) {
 384            let coordName = coordMeta.name || id;
 385            throw new TypeError(
 386              `$providedType ?? /** @type {any} */
 387              arg?.raw ?? arg} not allowed for $coordName} in $this.name}()`
 388            );
 389          }
 390          arg = type2.resolve(arg);
 391          if (type2.range) {
 392            types[i] = type2.toString();
 393          }
 394          return arg;
 395        });
 396      }
 397      /**
 398       * @returns {boolean | Required<FormatInterface>["serialize"]}
 399       */
 400      canSerialize() {
 401        return this.type === "function" || /** @type {any} */
 402        this.serialize;
 403      }
 404      /**
 405       * @param {string} str
 406       * @returns {(import("./types.js").ColorConstructor) | undefined | null}
 407       */
 408      parse(str) {
 409        return null;
 410      }
 411      /**
 412       * @param {Format | FormatInterface} format
 413       * @param {RemoveFirstElement<ConstructorParameters<typeof Format>>} args
 414       * @returns {Format}
 415       */
 416      static get(format, ...args) {
 417        if (!format || isInstance(format, this)) {
 418          return (
 419            /** @type {Format} */
 420            format
 421          );
 422        }
 423        if (format[instance]) {
 424          return format[instance];
 425        }
 426        return new _Format(format, ...args);
 427      }
 428    };
 429  
 430    // packages/theme/node_modules/colorjs.io/src/hooks.js
 431    var Hooks = class {
 432      add(name, callback, first) {
 433        if (typeof arguments[0] != "string") {
 434          for (var name in arguments[0]) {
 435            this.add(name, arguments[0][name], arguments[1]);
 436          }
 437          return;
 438        }
 439        (Array.isArray(name) ? name : [name]).forEach(function(name2) {
 440          this[name2] = this[name2] || [];
 441          if (callback) {
 442            this[name2][first ? "unshift" : "push"](callback);
 443          }
 444        }, this);
 445      }
 446      run(name, env) {
 447        this[name] = this[name] || [];
 448        this[name].forEach(function(callback) {
 449          callback.call(env && env.context ? env.context : env, env);
 450        });
 451      }
 452    };
 453    var hooks = new Hooks();
 454    var hooks_default = hooks;
 455  
 456    // packages/theme/node_modules/colorjs.io/src/adapt.js
 457    var WHITES = {
 458      // for compatibility, the four-digit chromaticity-derived ones everyone else uses
 459      D50: [0.3457 / 0.3585, 1, (1 - 0.3457 - 0.3585) / 0.3585],
 460      D65: [0.3127 / 0.329, 1, (1 - 0.3127 - 0.329) / 0.329]
 461    };
 462    function getWhite(name) {
 463      if (Array.isArray(name)) {
 464        return name;
 465      }
 466      return WHITES[name];
 467    }
 468    function adapt(W1, W2, XYZ, options = {}) {
 469      W1 = getWhite(W1);
 470      W2 = getWhite(W2);
 471      if (!W1 || !W2) {
 472        throw new TypeError(
 473          `Missing white point to convert ${!W1 ? "from" : ""}${!W1 && !W2 ? "/" : ""}${!W2 ? "to" : ""}`
 474        );
 475      }
 476      if (W1 === W2) {
 477        return XYZ;
 478      }
 479      let env = { W1, W2, XYZ, options };
 480      hooks_default.run("chromatic-adaptation-start", env);
 481      if (!env.M) {
 482        if (env.W1 === WHITES.D65 && env.W2 === WHITES.D50) {
 483          env.M = [
 484            [1.0479297925449969, 0.022946870601609652, -0.05019226628920524],
 485            [0.02962780877005599, 0.9904344267538799, -0.017073799063418826],
 486            [-0.009243040646204504, 0.015055191490298152, 0.7518742814281371]
 487          ];
 488        } else if (env.W1 === WHITES.D50 && env.W2 === WHITES.D65) {
 489          env.M = [
 490            [0.955473421488075, -0.02309845494876471, 0.06325924320057072],
 491            [-0.0283697093338637, 1.0099953980813041, 0.021041441191917323],
 492            [0.012314014864481998, -0.020507649298898964, 1.330365926242124]
 493          ];
 494        }
 495      }
 496      hooks_default.run("chromatic-adaptation-end", env);
 497      if (env.M) {
 498        return multiply_v3_m3x3(env.XYZ, env.M);
 499      } else {
 500        throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.");
 501      }
 502    }
 503  
 504    // packages/theme/node_modules/colorjs.io/src/defaults.js
 505    var defaults_default = {
 506      gamut_mapping: "css",
 507      precision: 5,
 508      deltaE: "76",
 509      // Default deltaE method
 510      verbose: globalThis?.process?.env?.NODE_ENV?.toLowerCase() !== "test",
 511      warn: function warn(msg) {
 512        if (this.verbose) {
 513          globalThis?.console?.warn?.(msg);
 514        }
 515      }
 516    };
 517  
 518    // packages/theme/node_modules/colorjs.io/src/parse.js
 519    function parse(str, options) {
 520      let env = {
 521        str: String(str)?.trim(),
 522        options
 523      };
 524      hooks_default.run("parse-start", env);
 525      if (env.color) {
 526        return env.color;
 527      }
 528      env.parsed = parseFunction(env.str);
 529      let ret;
 530      let meta = env.options ? env.options.parseMeta ?? env.options.meta : null;
 531      if (env.parsed) {
 532        let name = env.parsed.name;
 533        let format;
 534        let space;
 535        let coords = env.parsed.args;
 536        let types = coords.map((c, i) => env.parsed.argMeta[i]?.type);
 537        if (name === "color") {
 538          let id = coords.shift();
 539          types.shift();
 540          let alternateId = id.startsWith("--") ? id.substring(2) : `--$id}`;
 541          let ids = [id, alternateId];
 542          format = ColorSpace.findFormat({ name, id: ids, type: "function" });
 543          if (!format) {
 544            let didYouMean;
 545            let registryId = id in ColorSpace.registry ? id : alternateId;
 546            if (registryId in ColorSpace.registry) {
 547              let cssId = ColorSpace.registry[registryId].formats?.color?.id;
 548              if (cssId) {
 549                let altColor = str.replace("color(" + id, "color(" + cssId);
 550                didYouMean = `Did you mean $altColor}?`;
 551              }
 552            }
 553            throw new TypeError(
 554              `Cannot parse $env.str}. ` + (didYouMean ?? "Missing a plugin?")
 555            );
 556          }
 557          space = format.space;
 558          if (format.id.startsWith("--") && !id.startsWith("--")) {
 559            defaults_default.warn(
 560              `$space.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color($format.id}) instead of color($id}).`
 561            );
 562          }
 563          if (id.startsWith("--") && !format.id.startsWith("--")) {
 564            defaults_default.warn(
 565              `$space.name} is a standard space and supported in the CSS spec. Use color($format.id}) instead of prefixed color($id}).`
 566            );
 567          }
 568        } else {
 569          format = ColorSpace.findFormat({ name, type: "function" });
 570          space = format.space;
 571        }
 572        if (meta) {
 573          Object.assign(meta, {
 574            format,
 575            formatId: format.name,
 576            types,
 577            commas: env.parsed.commas
 578          });
 579        }
 580        let alpha = 1;
 581        if (env.parsed.lastAlpha) {
 582          alpha = env.parsed.args.pop();
 583          if (meta) {
 584            meta.alphaType = types.pop();
 585          }
 586        }
 587        let coordCount = format.coords.length;
 588        if (coords.length !== coordCount) {
 589          throw new TypeError(
 590            `Expected $coordCount} coordinates for $space.id} in $env.str}), got $coords.length}`
 591          );
 592        }
 593        coords = format.coerceCoords(coords, types);
 594        ret = { spaceId: space.id, coords, alpha };
 595      } else {
 596        spaceloop: for (let space of ColorSpace.all) {
 597          for (let formatId in space.formats) {
 598            let format = space.formats[formatId];
 599            if (format.type !== "custom") {
 600              continue;
 601            }
 602            if (format.test && !format.test(env.str)) {
 603              continue;
 604            }
 605            let formatObject = space.getFormat(format);
 606            let color = formatObject.parse(env.str);
 607            if (color) {
 608              if (meta) {
 609                Object.assign(meta, { format: formatObject, formatId });
 610              }
 611              ret = color;
 612              break spaceloop;
 613            }
 614          }
 615        }
 616      }
 617      if (!ret) {
 618        throw new TypeError(`Could not parse $str} as a color. Missing a plugin?`);
 619      }
 620      ret.alpha = isNone(ret.alpha) ? ret.alpha : ret.alpha === void 0 ? 1 : clamp(0, ret.alpha, 1);
 621      return ret;
 622    }
 623    var units = {
 624      "%": 0.01,
 625      deg: 1,
 626      grad: 0.9,
 627      rad: 180 / Math.PI,
 628      turn: 360
 629    };
 630    var regex = {
 631      // Need to list calc(NaN) explicitly as otherwise its ending paren would terminate the function call
 632      function: /^([a-z]+)\(((?:calc\(NaN\)|.)+?)\)$/i,
 633      number: /^([-+]?(?:[0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?)$/i,
 634      unitValue: RegExp(`($Object.keys(units).join("|")})$`),
 635      // NOTE The -+ are not just for prefix, but also for idents, and e+N notation!
 636      singleArgument: /\/?\s*(none|NaN|calc\(NaN\)|[-+\w.]+(?:%|deg|g?rad|turn)?)/g
 637    };
 638    function parseArgument(rawArg) {
 639      let meta = {};
 640      let unit = rawArg.match(regex.unitValue)?.[0];
 641      let value = meta.raw = rawArg;
 642      if (unit) {
 643        meta.type = unit === "%" ? "<percentage>" : "<angle>";
 644        meta.unit = unit;
 645        meta.unitless = Number(value.slice(0, -unit.length));
 646        value = meta.unitless * units[unit];
 647      } else if (regex.number.test(value)) {
 648        value = Number(value);
 649        meta.type = "<number>";
 650      } else if (value === "none") {
 651        value = null;
 652      } else if (value === "NaN" || value === "calc(NaN)") {
 653        value = NaN;
 654        meta.type = "<number>";
 655      } else {
 656        meta.type = "<ident>";
 657      }
 658      return { value: (
 659        /** @type {number} */
 660        value
 661      ), meta: (
 662        /** @type {ArgumentMeta} */
 663        meta
 664      ) };
 665    }
 666    function parseFunction(str) {
 667      if (!str) {
 668        return;
 669      }
 670      str = str.trim();
 671      let parts = str.match(regex.function);
 672      if (parts) {
 673        let args = [];
 674        let argMeta = [];
 675        let lastAlpha = false;
 676        let name = parts[1].toLowerCase();
 677        let separators = parts[2].replace(regex.singleArgument, ($0, rawArg) => {
 678          let { value, meta } = parseArgument(rawArg);
 679          if (
 680            // If there's a slash here, it's modern syntax
 681            $0.startsWith("/") || // If there's still elements to process after there's already 3 in `args` (and the we're not dealing with "color()"), it's likely to be a legacy color like "hsl(0, 0%, 0%, 0.5)"
 682            name !== "color" && args.length === 3
 683          ) {
 684            lastAlpha = true;
 685          }
 686          args.push(value);
 687          argMeta.push(meta);
 688          return "";
 689        });
 690        return {
 691          name,
 692          args,
 693          argMeta,
 694          lastAlpha,
 695          commas: separators.includes(","),
 696          rawName: parts[1],
 697          rawArgs: parts[2]
 698        };
 699      }
 700    }
 701  
 702    // packages/theme/node_modules/colorjs.io/src/getColor.js
 703    function getColor(color, options) {
 704      if (Array.isArray(color)) {
 705        return color.map((c) => getColor(c, options));
 706      }
 707      if (!color) {
 708        throw new TypeError("Empty color reference");
 709      }
 710      if (isString(color)) {
 711        color = parse(color, options);
 712      }
 713      let space = color.space || color.spaceId;
 714      if (typeof space === "string") {
 715        color.space = ColorSpace.get(space);
 716      }
 717      if (color.alpha === void 0) {
 718        color.alpha = 1;
 719      }
 720      return color;
 721    }
 722  
 723    // packages/theme/node_modules/colorjs.io/src/ColorSpace.js
 724    var \u03B5 = 75e-6;
 725    var ColorSpace = class _ColorSpace {
 726      constructor(options) {
 727        this.id = options.id;
 728        this.name = options.name;
 729        this.base = options.base ? _ColorSpace.get(options.base) : null;
 730        this.aliases = options.aliases;
 731        if (this.base) {
 732          this.fromBase = options.fromBase;
 733          this.toBase = options.toBase;
 734        }
 735        let coords = options.coords ?? this.base.coords;
 736        for (let name in coords) {
 737          if (!("name" in coords[name])) {
 738            coords[name].name = name;
 739          }
 740        }
 741        this.coords = coords;
 742        let white4 = options.white ?? this.base.white ?? "D65";
 743        this.white = getWhite(white4);
 744        this.formats = options.formats ?? {};
 745        for (let name in this.formats) {
 746          let format = this.formats[name];
 747          format.type ||= "function";
 748          format.name ||= name;
 749        }
 750        if (!this.formats.color?.id) {
 751          this.formats.color = {
 752            ...this.formats.color ?? {},
 753            id: options.cssId || this.id
 754          };
 755        }
 756        if (options.gamutSpace) {
 757          this.gamutSpace = options.gamutSpace === "self" ? this : _ColorSpace.get(options.gamutSpace);
 758        } else {
 759          if (this.isPolar) {
 760            this.gamutSpace = this.base;
 761          } else {
 762            this.gamutSpace = this;
 763          }
 764        }
 765        if (this.gamutSpace.isUnbounded) {
 766          this.inGamut = (coords2, options2) => {
 767            return true;
 768          };
 769        }
 770        this.referred = options.referred;
 771        Object.defineProperty(this, "path", {
 772          value: getPath(this).reverse(),
 773          writable: false,
 774          enumerable: true,
 775          configurable: true
 776        });
 777        hooks_default.run("colorspace-init-end", this);
 778      }
 779      inGamut(coords, { epsilon = \u03B5 } = {}) {
 780        if (!this.equals(this.gamutSpace)) {
 781          coords = this.to(this.gamutSpace, coords);
 782          return this.gamutSpace.inGamut(coords, { epsilon });
 783        }
 784        let coordMeta = Object.values(this.coords);
 785        return coords.every((c, i) => {
 786          let meta = coordMeta[i];
 787          if (meta.type !== "angle" && meta.range) {
 788            if (isNone(c)) {
 789              return true;
 790            }
 791            let [min, max] = meta.range;
 792            return (min === void 0 || c >= min - epsilon) && (max === void 0 || c <= max + epsilon);
 793          }
 794          return true;
 795        });
 796      }
 797      get isUnbounded() {
 798        return Object.values(this.coords).every((coord) => !("range" in coord));
 799      }
 800      get cssId() {
 801        return this.formats?.color?.id || this.id;
 802      }
 803      get isPolar() {
 804        for (let id in this.coords) {
 805          if (this.coords[id].type === "angle") {
 806            return true;
 807          }
 808        }
 809        return false;
 810      }
 811      /**
 812       * Lookup a format in this color space
 813       * @param {string | object | Format} format - Format id if string. If object, it's converted to a `Format` object and returned.
 814       * @returns {Format}
 815       */
 816      getFormat(format) {
 817        if (!format) {
 818          return null;
 819        }
 820        if (format === "default") {
 821          format = Object.values(this.formats)[0];
 822        } else if (typeof format === "string") {
 823          format = this.formats[format];
 824        }
 825        let ret = Format.get(format, this);
 826        if (ret !== format && format.name in this.formats) {
 827          this.formats[format.name] = ret;
 828        }
 829        return ret;
 830      }
 831      /**
 832       * Check if this color space is the same as another color space reference.
 833       * Allows proxying color space objects and comparing color spaces with ids.
 834       * @param {string | ColorSpace} space ColorSpace object or id to compare to
 835       * @returns {boolean}
 836       */
 837      equals(space) {
 838        if (!space) {
 839          return false;
 840        }
 841        return this === space || this.id === space || this.id === space.id;
 842      }
 843      to(space, coords) {
 844        if (arguments.length === 1) {
 845          const color = getColor(space);
 846          [space, coords] = [color.space, color.coords];
 847        }
 848        space = _ColorSpace.get(space);
 849        if (this.equals(space)) {
 850          return coords;
 851        }
 852        coords = coords.map((c) => isNone(c) ? 0 : c);
 853        let myPath = this.path;
 854        let otherPath = space.path;
 855        let connectionSpace, connectionSpaceIndex;
 856        for (let i = 0; i < myPath.length; i++) {
 857          if (myPath[i].equals(otherPath[i])) {
 858            connectionSpace = myPath[i];
 859            connectionSpaceIndex = i;
 860          } else {
 861            break;
 862          }
 863        }
 864        if (!connectionSpace) {
 865          throw new Error(
 866            `Cannot convert between color spaces $this} and $space}: no connection space was found`
 867          );
 868        }
 869        for (let i = myPath.length - 1; i > connectionSpaceIndex; i--) {
 870          coords = myPath[i].toBase(coords);
 871        }
 872        for (let i = connectionSpaceIndex + 1; i < otherPath.length; i++) {
 873          coords = otherPath[i].fromBase(coords);
 874        }
 875        return coords;
 876      }
 877      from(space, coords) {
 878        if (arguments.length === 1) {
 879          const color = getColor(space);
 880          [space, coords] = [color.space, color.coords];
 881        }
 882        space = _ColorSpace.get(space);
 883        return space.to(this, coords);
 884      }
 885      toString() {
 886        return `$this.name} ($this.id})`;
 887      }
 888      getMinCoords() {
 889        let ret = [];
 890        for (let id in this.coords) {
 891          let meta = this.coords[id];
 892          let range = meta.range || meta.refRange;
 893          ret.push(range?.min ?? 0);
 894        }
 895        return ret;
 896      }
 897      static registry = {};
 898      // Returns array of unique color spaces
 899      static get all() {
 900        return [...new Set(Object.values(_ColorSpace.registry))];
 901      }
 902      static register(id, space) {
 903        if (arguments.length === 1) {
 904          space = arguments[0];
 905          id = space.id;
 906        }
 907        space = this.get(space);
 908        if (this.registry[id] && this.registry[id] !== space) {
 909          throw new Error(`Duplicate color space registration: '$id}'`);
 910        }
 911        this.registry[id] = space;
 912        if (arguments.length === 1 && space.aliases) {
 913          for (let alias of space.aliases) {
 914            this.register(alias, space);
 915          }
 916        }
 917        return space;
 918      }
 919      /**
 920       * Lookup ColorSpace object by name
 921       * @param {ColorSpace | string} name
 922       */
 923      static get(space, ...alternatives) {
 924        if (!space || isInstance(space, this)) {
 925          return space;
 926        }
 927        let argType = type(space);
 928        if (argType === "string") {
 929          let ret = _ColorSpace.registry[space.toLowerCase()];
 930          if (!ret) {
 931            throw new TypeError(`No color space found with id = "$space}"`);
 932          }
 933          return ret;
 934        }
 935        if (alternatives.length) {
 936          return _ColorSpace.get(...alternatives);
 937        }
 938        throw new TypeError(`$space} is not a valid color space`);
 939      }
 940      /**
 941       * Look up all color spaces for a format that matches certain criteria
 942       * @param {object | string} filters
 943       * @param {Array<ColorSpace>} [spaces=ColorSpace.all]
 944       * @returns {Format | null}
 945       */
 946      static findFormat(filters, spaces = _ColorSpace.all) {
 947        if (!filters) {
 948          return null;
 949        }
 950        if (typeof filters === "string") {
 951          filters = { name: filters };
 952        }
 953        for (let space of spaces) {
 954          for (let [name, format] of Object.entries(space.formats)) {
 955            format.name ??= name;
 956            format.type ??= "function";
 957            let matches = (!filters.name || format.name === filters.name) && (!filters.type || format.type === filters.type);
 958            if (filters.id) {
 959              let ids = format.ids || [format.id];
 960              let filterIds = Array.isArray(filters.id) ? filters.id : [filters.id];
 961              matches &&= filterIds.some((id) => ids.includes(id));
 962            }
 963            if (matches) {
 964              let ret = Format.get(format, space);
 965              if (ret !== format) {
 966                space.formats[format.name] = ret;
 967              }
 968              return ret;
 969            }
 970          }
 971        }
 972        return null;
 973      }
 974      /**
 975       * Get metadata about a coordinate of a color space
 976       *
 977       * @static
 978       * @param {Array | string} ref
 979       * @param {ColorSpace | string} [workingSpace]
 980       * @return {Object}
 981       */
 982      static resolveCoord(ref, workingSpace) {
 983        let coordType = type(ref);
 984        let space, coord;
 985        if (coordType === "string") {
 986          if (ref.includes(".")) {
 987            [space, coord] = ref.split(".");
 988          } else {
 989            [space, coord] = [, ref];
 990          }
 991        } else if (Array.isArray(ref)) {
 992          [space, coord] = ref;
 993        } else {
 994          space = ref.space;
 995          coord = ref.coordId;
 996        }
 997        space = _ColorSpace.get(space);
 998        if (!space) {
 999          space = workingSpace;
1000        }
1001        if (!space) {
1002          throw new TypeError(
1003            `Cannot resolve coordinate reference $ref}: No color space specified and relative references are not allowed here`
1004          );
1005        }
1006        coordType = type(coord);
1007        if (coordType === "number" || coordType === "string" && coord >= 0) {
1008          let meta = Object.entries(space.coords)[coord];
1009          if (meta) {
1010            return { space, id: meta[0], index: coord, ...meta[1] };
1011          }
1012        }
1013        space = _ColorSpace.get(space);
1014        let normalizedCoord = coord.toLowerCase();
1015        let i = 0;
1016        for (let id in space.coords) {
1017          let meta = space.coords[id];
1018          if (id.toLowerCase() === normalizedCoord || meta.name?.toLowerCase() === normalizedCoord) {
1019            return { space, id, index: i, ...meta };
1020          }
1021          i++;
1022        }
1023        throw new TypeError(
1024          `No "$coord}" coordinate found in $space.name}. Its coordinates are: $Object.keys(space.coords).join(", ")}`
1025        );
1026      }
1027      static DEFAULT_FORMAT = {
1028        type: "functions",
1029        name: "color"
1030      };
1031    };
1032    function getPath(space) {
1033      let ret = [space];
1034      for (let s = space; s = s.base; ) {
1035        ret.push(s);
1036      }
1037      return ret;
1038    }
1039  
1040    // packages/theme/node_modules/colorjs.io/src/spaces/xyz-d65.js
1041    var xyz_d65_default = new ColorSpace({
1042      id: "xyz-d65",
1043      name: "XYZ D65",
1044      coords: {
1045        x: {
1046          refRange: [0, 1],
1047          name: "X"
1048        },
1049        y: {
1050          refRange: [0, 1],
1051          name: "Y"
1052        },
1053        z: {
1054          refRange: [0, 1],
1055          name: "Z"
1056        }
1057      },
1058      white: "D65",
1059      formats: {
1060        color: {
1061          ids: ["xyz-d65", "xyz"]
1062        }
1063      },
1064      aliases: ["xyz"]
1065    });
1066  
1067    // packages/theme/node_modules/colorjs.io/src/RGBColorSpace.js
1068    var RGBColorSpace = class extends ColorSpace {
1069      /**
1070       * Creates a new RGB ColorSpace.
1071       * If coords are not specified, they will use the default RGB coords.
1072       * Instead of `fromBase()` and `toBase()` functions,
1073       * you can specify to/from XYZ matrices and have `toBase()` and `fromBase()` automatically generated.
1074       * @param {RGBOptions} options
1075       */
1076      constructor(options) {
1077        if (!options.coords) {
1078          options.coords = {
1079            r: {
1080              range: [0, 1],
1081              name: "Red"
1082            },
1083            g: {
1084              range: [0, 1],
1085              name: "Green"
1086            },
1087            b: {
1088              range: [0, 1],
1089              name: "Blue"
1090            }
1091          };
1092        }
1093        if (!options.base) {
1094          options.base = xyz_d65_default;
1095        }
1096        if (options.toXYZ_M && options.fromXYZ_M) {
1097          options.toBase ??= (rgb) => {
1098            let xyz = multiply_v3_m3x3(rgb, options.toXYZ_M);
1099            if (this.white !== this.base.white) {
1100              xyz = adapt(this.white, this.base.white, xyz);
1101            }
1102            return xyz;
1103          };
1104          options.fromBase ??= (xyz) => {
1105            xyz = adapt(this.base.white, this.white, xyz);
1106            return multiply_v3_m3x3(xyz, options.fromXYZ_M);
1107          };
1108        }
1109        options.referred ??= "display";
1110        super(options);
1111      }
1112    };
1113  
1114    // packages/theme/node_modules/colorjs.io/src/getAll.js
1115    function getAll(color, options) {
1116      color = getColor(color);
1117      let space = ColorSpace.get(options, options?.space);
1118      let precision = options?.precision;
1119      let coords;
1120      if (!space || color.space.equals(space)) {
1121        coords = color.coords.slice();
1122      } else {
1123        coords = space.from(color);
1124      }
1125      return precision === void 0 ? coords : coords.map((coord) => toPrecision(coord, precision));
1126    }
1127  
1128    // packages/theme/node_modules/colorjs.io/src/get.js
1129    function get(color, prop) {
1130      color = getColor(color);
1131      if (prop === "alpha") {
1132        return color.alpha ?? 1;
1133      }
1134      let { space, index } = ColorSpace.resolveCoord(prop, color.space);
1135      let coords = getAll(color, space);
1136      return coords[index];
1137    }
1138  
1139    // packages/theme/node_modules/colorjs.io/src/setAll.js
1140    function setAll(color, space, coords, alpha) {
1141      color = getColor(color);
1142      if (Array.isArray(space)) {
1143        [space, coords, alpha] = [color.space, space, coords];
1144      }
1145      space = ColorSpace.get(space);
1146      color.coords = space === color.space ? coords.slice() : space.to(color.space, coords);
1147      if (alpha !== void 0) {
1148        color.alpha = alpha;
1149      }
1150      return color;
1151    }
1152    setAll.returns = "color";
1153  
1154    // packages/theme/node_modules/colorjs.io/src/set.js
1155    function set(color, prop, value) {
1156      color = getColor(color);
1157      if (arguments.length === 2 && type(arguments[1]) === "object") {
1158        let object = arguments[1];
1159        for (let p2 in object) {
1160          set(color, p2, object[p2]);
1161        }
1162      } else {
1163        if (typeof value === "function") {
1164          value = value(get(color, prop));
1165        }
1166        if (prop === "alpha") {
1167          color.alpha = value;
1168        } else {
1169          let { space, index } = ColorSpace.resolveCoord(prop, color.space);
1170          let coords = getAll(color, space);
1171          coords[index] = value;
1172          setAll(color, space, coords);
1173        }
1174      }
1175      return color;
1176    }
1177    set.returns = "color";
1178  
1179    // packages/theme/node_modules/colorjs.io/src/spaces/xyz-d50.js
1180    var xyz_d50_default = new ColorSpace({
1181      id: "xyz-d50",
1182      name: "XYZ D50",
1183      white: "D50",
1184      base: xyz_d65_default,
1185      fromBase: (coords) => adapt(xyz_d65_default.white, "D50", coords),
1186      toBase: (coords) => adapt("D50", xyz_d65_default.white, coords)
1187    });
1188  
1189    // packages/theme/node_modules/colorjs.io/src/spaces/lab.js
1190    var \u03B52 = 216 / 24389;
1191    var \u03B53 = 24 / 116;
1192    var \u03BA = 24389 / 27;
1193    var white = WHITES.D50;
1194    var lab_default = new ColorSpace({
1195      id: "lab",
1196      name: "Lab",
1197      coords: {
1198        l: {
1199          refRange: [0, 100],
1200          name: "Lightness"
1201        },
1202        a: {
1203          refRange: [-125, 125]
1204        },
1205        b: {
1206          refRange: [-125, 125]
1207        }
1208      },
1209      // Assuming XYZ is relative to D50, convert to CIE Lab
1210      // from CIE standard, which now defines these as a rational fraction
1211      white,
1212      base: xyz_d50_default,
1213      // Convert D50-adapted XYX to Lab
1214      // CIE 15.3:2004 section 8.2.1.1
1215      fromBase(XYZ) {
1216        let xyz = XYZ.map((value, i) => value / white[i]);
1217        let f = xyz.map((value) => value > \u03B52 ? Math.cbrt(value) : (\u03BA * value + 16) / 116);
1218        let L = 116 * f[1] - 16;
1219        let a = 500 * (f[0] - f[1]);
1220        let b2 = 200 * (f[1] - f[2]);
1221        return [L, a, b2];
1222      },
1223      // Convert Lab to D50-adapted XYZ
1224      // Same result as CIE 15.3:2004 Appendix D although the derivation is different
1225      // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
1226      toBase(Lab) {
1227        let [L, a, b2] = Lab;
1228        let f = [];
1229        f[1] = (L + 16) / 116;
1230        f[0] = a / 500 + f[1];
1231        f[2] = f[1] - b2 / 200;
1232        let xyz = [
1233          f[0] > \u03B53 ? Math.pow(f[0], 3) : (116 * f[0] - 16) / \u03BA,
1234          Lab[0] > 8 ? Math.pow((Lab[0] + 16) / 116, 3) : Lab[0] / \u03BA,
1235          f[2] > \u03B53 ? Math.pow(f[2], 3) : (116 * f[2] - 16) / \u03BA
1236        ];
1237        return xyz.map((value, i) => value * white[i]);
1238      },
1239      formats: {
1240        lab: {
1241          coords: [
1242            "<percentage> | <number>",
1243            "<number> | <percentage>",
1244            "<number> | <percentage>"
1245          ]
1246        }
1247      }
1248    });
1249  
1250    // packages/theme/node_modules/colorjs.io/src/angles.js
1251    function constrain(angle) {
1252      if (typeof angle !== "number") {
1253        return angle;
1254      }
1255      return (angle % 360 + 360) % 360;
1256    }
1257  
1258    // packages/theme/node_modules/colorjs.io/src/spaces/lch.js
1259    var lch_default = new ColorSpace({
1260      id: "lch",
1261      name: "LCH",
1262      coords: {
1263        l: {
1264          refRange: [0, 100],
1265          name: "Lightness"
1266        },
1267        c: {
1268          refRange: [0, 150],
1269          name: "Chroma"
1270        },
1271        h: {
1272          refRange: [0, 360],
1273          type: "angle",
1274          name: "Hue"
1275        }
1276      },
1277      base: lab_default,
1278      fromBase(Lab) {
1279        if (this.\u03B5 === void 0) {
1280          let range = Object.values(this.base.coords)[1].refRange;
1281          let extent = range[1] - range[0];
1282          this.\u03B5 = extent / 1e5;
1283        }
1284        let [L, a, b2] = Lab;
1285        let isAchromatic = Math.abs(a) < this.\u03B5 && Math.abs(b2) < this.\u03B5;
1286        let h = isAchromatic ? null : constrain(Math.atan2(b2, a) * 180 / Math.PI);
1287        let C = isAchromatic ? 0 : Math.sqrt(a ** 2 + b2 ** 2);
1288        return [L, C, h];
1289      },
1290      toBase(lch) {
1291        let [L, C, h] = lch;
1292        let a = null, b2 = null;
1293        if (!isNone(h)) {
1294          C = C < 0 ? 0 : C;
1295          a = C * Math.cos(h * Math.PI / 180);
1296          b2 = C * Math.sin(h * Math.PI / 180);
1297        }
1298        return [L, a, b2];
1299      },
1300      formats: {
1301        lch: {
1302          coords: ["<percentage> | <number>", "<number> | <percentage>", "<number> | <angle>"]
1303        }
1304      }
1305    });
1306  
1307    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaE2000.js
1308    var Gfactor = 25 ** 7;
1309    var \u03C0 = Math.PI;
1310    var r2d = 180 / \u03C0;
1311    var d2r = \u03C0 / 180;
1312    function pow7(x) {
1313      const x2 = x * x;
1314      const x7 = x2 * x2 * x2 * x;
1315      return x7;
1316    }
1317    function deltaE2000_default(color, sample, { kL = 1, kC = 1, kH = 1 } = {}) {
1318      [color, sample] = getColor([color, sample]);
1319      let [L1, a1, b1] = lab_default.from(color);
1320      let C1 = lch_default.from(lab_default, [L1, a1, b1])[1];
1321      let [L2, a2, b2] = lab_default.from(sample);
1322      let C2 = lch_default.from(lab_default, [L2, a2, b2])[1];
1323      if (C1 < 0) {
1324        C1 = 0;
1325      }
1326      if (C2 < 0) {
1327        C2 = 0;
1328      }
1329      let Cbar = (C1 + C2) / 2;
1330      let C7 = pow7(Cbar);
1331      let G = 0.5 * (1 - Math.sqrt(C7 / (C7 + Gfactor)));
1332      let adash1 = (1 + G) * a1;
1333      let adash2 = (1 + G) * a2;
1334      let Cdash1 = Math.sqrt(adash1 ** 2 + b1 ** 2);
1335      let Cdash2 = Math.sqrt(adash2 ** 2 + b2 ** 2);
1336      let h1 = adash1 === 0 && b1 === 0 ? 0 : Math.atan2(b1, adash1);
1337      let h2 = adash2 === 0 && b2 === 0 ? 0 : Math.atan2(b2, adash2);
1338      if (h1 < 0) {
1339        h1 += 2 * \u03C0;
1340      }
1341      if (h2 < 0) {
1342        h2 += 2 * \u03C0;
1343      }
1344      h1 *= r2d;
1345      h2 *= r2d;
1346      let \u0394L = L2 - L1;
1347      let \u0394C = Cdash2 - Cdash1;
1348      let hdiff = h2 - h1;
1349      let hsum = h1 + h2;
1350      let habs = Math.abs(hdiff);
1351      let \u0394h;
1352      if (Cdash1 * Cdash2 === 0) {
1353        \u0394h = 0;
1354      } else if (habs <= 180) {
1355        \u0394h = hdiff;
1356      } else if (hdiff > 180) {
1357        \u0394h = hdiff - 360;
1358      } else if (hdiff < -180) {
1359        \u0394h = hdiff + 360;
1360      } else {
1361        defaults_default.warn("the unthinkable has happened");
1362      }
1363      let \u0394H = 2 * Math.sqrt(Cdash2 * Cdash1) * Math.sin(\u0394h * d2r / 2);
1364      let Ldash = (L1 + L2) / 2;
1365      let Cdash = (Cdash1 + Cdash2) / 2;
1366      let Cdash7 = pow7(Cdash);
1367      let hdash;
1368      if (Cdash1 * Cdash2 === 0) {
1369        hdash = hsum;
1370      } else if (habs <= 180) {
1371        hdash = hsum / 2;
1372      } else if (hsum < 360) {
1373        hdash = (hsum + 360) / 2;
1374      } else {
1375        hdash = (hsum - 360) / 2;
1376      }
1377      let lsq = (Ldash - 50) ** 2;
1378      let SL = 1 + 0.015 * lsq / Math.sqrt(20 + lsq);
1379      let SC = 1 + 0.045 * Cdash;
1380      let T = 1;
1381      T -= 0.17 * Math.cos((hdash - 30) * d2r);
1382      T += 0.24 * Math.cos(2 * hdash * d2r);
1383      T += 0.32 * Math.cos((3 * hdash + 6) * d2r);
1384      T -= 0.2 * Math.cos((4 * hdash - 63) * d2r);
1385      let SH = 1 + 0.015 * Cdash * T;
1386      let \u0394\u03B8 = 30 * Math.exp(-1 * ((hdash - 275) / 25) ** 2);
1387      let RC = 2 * Math.sqrt(Cdash7 / (Cdash7 + Gfactor));
1388      let RT = -1 * Math.sin(2 * \u0394\u03B8 * d2r) * RC;
1389      let dE = (\u0394L / (kL * SL)) ** 2;
1390      dE += (\u0394C / (kC * SC)) ** 2;
1391      dE += (\u0394H / (kH * SH)) ** 2;
1392      dE += RT * (\u0394C / (kC * SC)) * (\u0394H / (kH * SH));
1393      return Math.sqrt(dE);
1394    }
1395  
1396    // packages/theme/node_modules/colorjs.io/src/spaces/oklab.js
1397    var XYZtoLMS_M = [
1398      [0.819022437996703, 0.3619062600528904, -0.1288737815209879],
1399      [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],
1400      [0.0481771893596242, 0.2642395317527308, 0.6335478284694309]
1401    ];
1402    var LMStoXYZ_M = [
1403      [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],
1404      [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],
1405      [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816]
1406    ];
1407    var LMStoLab_M = [
1408      [0.210454268309314, 0.7936177747023054, -0.0040720430116193],
1409      [1.9779985324311684, -2.42859224204858, 0.450593709617411],
1410      [0.0259040424655478, 0.7827717124575296, -0.8086757549230774]
1411    ];
1412    var LabtoLMS_M = [
1413      [1, 0.3963377773761749, 0.2158037573099136],
1414      [1, -0.1055613458156586, -0.0638541728258133],
1415      [1, -0.0894841775298119, -1.2914855480194092]
1416    ];
1417    var oklab_default = new ColorSpace({
1418      id: "oklab",
1419      name: "Oklab",
1420      coords: {
1421        l: {
1422          refRange: [0, 1],
1423          name: "Lightness"
1424        },
1425        a: {
1426          refRange: [-0.4, 0.4]
1427        },
1428        b: {
1429          refRange: [-0.4, 0.4]
1430        }
1431      },
1432      // Note that XYZ is relative to D65
1433      white: "D65",
1434      base: xyz_d65_default,
1435      fromBase(XYZ) {
1436        let LMS = multiply_v3_m3x3(XYZ, XYZtoLMS_M);
1437        LMS[0] = Math.cbrt(LMS[0]);
1438        LMS[1] = Math.cbrt(LMS[1]);
1439        LMS[2] = Math.cbrt(LMS[2]);
1440        return multiply_v3_m3x3(LMS, LMStoLab_M, LMS);
1441      },
1442      toBase(OKLab) {
1443        let LMSg = multiply_v3_m3x3(OKLab, LabtoLMS_M);
1444        LMSg[0] = LMSg[0] ** 3;
1445        LMSg[1] = LMSg[1] ** 3;
1446        LMSg[2] = LMSg[2] ** 3;
1447        return multiply_v3_m3x3(LMSg, LMStoXYZ_M, LMSg);
1448      },
1449      formats: {
1450        oklab: {
1451          coords: [
1452            "<percentage> | <number>",
1453            "<number> | <percentage>",
1454            "<number> | <percentage>"
1455          ]
1456        }
1457      }
1458    });
1459  
1460    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaEOK.js
1461    function deltaEOK_default(color, sample) {
1462      [color, sample] = getColor([color, sample]);
1463      let [L1, a1, b1] = oklab_default.from(color);
1464      let [L2, a2, b2] = oklab_default.from(sample);
1465      let \u0394L = L1 - L2;
1466      let \u0394a = a1 - a2;
1467      let \u0394b = b1 - b2;
1468      return Math.sqrt(\u0394L ** 2 + \u0394a ** 2 + \u0394b ** 2);
1469    }
1470  
1471    // packages/theme/node_modules/colorjs.io/src/inGamut.js
1472    var \u03B54 = 75e-6;
1473    function inGamut(color, space, { epsilon = \u03B54 } = {}) {
1474      color = getColor(color);
1475      if (!space) {
1476        space = color.space;
1477      }
1478      space = ColorSpace.get(space);
1479      let coords = color.coords;
1480      if (space !== color.space) {
1481        coords = space.from(color);
1482      }
1483      return space.inGamut(coords, { epsilon });
1484    }
1485  
1486    // packages/theme/node_modules/colorjs.io/src/clone.js
1487    function clone(color) {
1488      return {
1489        space: color.space,
1490        coords: (
1491          /** @type {Coords} */
1492          color.coords.slice()
1493        ),
1494        alpha: color.alpha
1495      };
1496    }
1497  
1498    // packages/theme/node_modules/colorjs.io/src/distance.js
1499    function distance(color1, color2, space = "lab") {
1500      space = ColorSpace.get(space);
1501      let coords1 = space.from(color1);
1502      let coords2 = space.from(color2);
1503      return Math.sqrt(
1504        coords1.reduce((acc, c13, i) => {
1505          let c23 = coords2[i];
1506          if (isNone(c13) || isNone(c23)) {
1507            return acc;
1508          }
1509          return acc + (c23 - c13) ** 2;
1510        }, 0)
1511      );
1512    }
1513  
1514    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaE76.js
1515    function deltaE76(color, sample) {
1516      return distance(color, sample, "lab");
1517    }
1518  
1519    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaECMC.js
1520    var \u03C02 = Math.PI;
1521    var d2r2 = \u03C02 / 180;
1522    function deltaECMC_default(color, sample, { l = 2, c = 1 } = {}) {
1523      [color, sample] = getColor([color, sample]);
1524      let [L1, a1, b1] = lab_default.from(color);
1525      let [, C1, H1] = lch_default.from(lab_default, [L1, a1, b1]);
1526      let [L2, a2, b2] = lab_default.from(sample);
1527      let C2 = lch_default.from(lab_default, [L2, a2, b2])[1];
1528      if (C1 < 0) {
1529        C1 = 0;
1530      }
1531      if (C2 < 0) {
1532        C2 = 0;
1533      }
1534      let \u0394L = L1 - L2;
1535      let \u0394C = C1 - C2;
1536      let \u0394a = a1 - a2;
1537      let \u0394b = b1 - b2;
1538      let H2 = \u0394a ** 2 + \u0394b ** 2 - \u0394C ** 2;
1539      let SL = 0.511;
1540      if (L1 >= 16) {
1541        SL = 0.040975 * L1 / (1 + 0.01765 * L1);
1542      }
1543      let SC = 0.0638 * C1 / (1 + 0.0131 * C1) + 0.638;
1544      let T;
1545      if (isNone(H1)) {
1546        H1 = 0;
1547      }
1548      if (H1 >= 164 && H1 <= 345) {
1549        T = 0.56 + Math.abs(0.2 * Math.cos((H1 + 168) * d2r2));
1550      } else {
1551        T = 0.36 + Math.abs(0.4 * Math.cos((H1 + 35) * d2r2));
1552      }
1553      let C4 = Math.pow(C1, 4);
1554      let F = Math.sqrt(C4 / (C4 + 1900));
1555      let SH = SC * (F * T + 1 - F);
1556      let dE = (\u0394L / (l * SL)) ** 2;
1557      dE += (\u0394C / (c * SC)) ** 2;
1558      dE += H2 / SH ** 2;
1559      return Math.sqrt(dE);
1560    }
1561  
1562    // packages/theme/node_modules/colorjs.io/src/spaces/xyz-abs-d65.js
1563    var Yw = 203;
1564    var xyz_abs_d65_default = new ColorSpace({
1565      // Absolute CIE XYZ, with a D65 whitepoint,
1566      // as used in most HDR colorspaces as a starting point.
1567      // SDR spaces are converted per BT.2048
1568      // so that diffuse, media white is 203 cd/m²
1569      id: "xyz-abs-d65",
1570      cssId: "--xyz-abs-d65",
1571      name: "Absolute XYZ D65",
1572      coords: {
1573        x: {
1574          refRange: [0, 9504.7],
1575          name: "Xa"
1576        },
1577        y: {
1578          refRange: [0, 1e4],
1579          name: "Ya"
1580        },
1581        z: {
1582          refRange: [0, 10888.3],
1583          name: "Za"
1584        }
1585      },
1586      base: xyz_d65_default,
1587      fromBase(XYZ) {
1588        return XYZ.map((v) => v * Yw);
1589      },
1590      toBase(AbsXYZ) {
1591        return AbsXYZ.map((v) => v / Yw);
1592      }
1593    });
1594  
1595    // packages/theme/node_modules/colorjs.io/src/spaces/jzazbz.js
1596    var b = 1.15;
1597    var g = 0.66;
1598    var n = 2610 / 2 ** 14;
1599    var ninv = 2 ** 14 / 2610;
1600    var c1 = 3424 / 2 ** 12;
1601    var c2 = 2413 / 2 ** 7;
1602    var c3 = 2392 / 2 ** 7;
1603    var p = 1.7 * 2523 / 2 ** 5;
1604    var pinv = 2 ** 5 / (1.7 * 2523);
1605    var d = -0.56;
1606    var d0 = 16295499532821565e-27;
1607    var XYZtoCone_M = [
1608      [0.41478972, 0.579999, 0.014648],
1609      [-0.20151, 1.120649, 0.0531008],
1610      [-0.0166008, 0.2648, 0.6684799]
1611    ];
1612    var ConetoXYZ_M = [
1613      [1.9242264357876067, -1.0047923125953657, 0.037651404030618],
1614      [0.35031676209499907, 0.7264811939316552, -0.06538442294808501],
1615      [-0.09098281098284752, -0.3127282905230739, 1.5227665613052603]
1616    ];
1617    var ConetoIab_M = [
1618      [0.5, 0.5, 0],
1619      [3.524, -4.066708, 0.542708],
1620      [0.199076, 1.096799, -1.295875]
1621    ];
1622    var IabtoCone_M = [
1623      [1, 0.13860504327153927, 0.05804731615611883],
1624      [1, -0.1386050432715393, -0.058047316156118904],
1625      [1, -0.09601924202631895, -0.811891896056039]
1626    ];
1627    var jzazbz_default = new ColorSpace({
1628      id: "jzazbz",
1629      name: "Jzazbz",
1630      coords: {
1631        jz: {
1632          refRange: [0, 1],
1633          name: "Jz"
1634        },
1635        az: {
1636          refRange: [-0.21, 0.21]
1637        },
1638        bz: {
1639          refRange: [-0.21, 0.21]
1640        }
1641      },
1642      base: xyz_abs_d65_default,
1643      fromBase(XYZ) {
1644        let [Xa, Ya, Za] = XYZ;
1645        let Xm = b * Xa - (b - 1) * Za;
1646        let Ym = g * Ya - (g - 1) * Xa;
1647        let LMS = multiply_v3_m3x3([Xm, Ym, Za], XYZtoCone_M);
1648        let PQLMS = (
1649          /** @type {Vector3} } */
1650          LMS.map(function(val) {
1651            let num = c1 + c2 * spow(val / 1e4, n);
1652            let denom = 1 + c3 * spow(val / 1e4, n);
1653            return spow(num / denom, p);
1654          })
1655        );
1656        let [Iz, az, bz] = multiply_v3_m3x3(PQLMS, ConetoIab_M);
1657        let Jz = (1 + d) * Iz / (1 + d * Iz) - d0;
1658        return [Jz, az, bz];
1659      },
1660      toBase(Jzazbz) {
1661        let [Jz, az, bz] = Jzazbz;
1662        let Iz = (Jz + d0) / (1 + d - d * (Jz + d0));
1663        let PQLMS = multiply_v3_m3x3([Iz, az, bz], IabtoCone_M);
1664        let LMS = (
1665          /** @type {Vector3} } */
1666          PQLMS.map(function(val) {
1667            let num = c1 - spow(val, pinv);
1668            let denom = c3 * spow(val, pinv) - c2;
1669            let x = 1e4 * spow(num / denom, ninv);
1670            return x;
1671          })
1672        );
1673        let [Xm, Ym, Za] = multiply_v3_m3x3(LMS, ConetoXYZ_M);
1674        let Xa = (Xm + (b - 1) * Za) / b;
1675        let Ya = (Ym + (g - 1) * Xa) / g;
1676        return [Xa, Ya, Za];
1677      },
1678      formats: {
1679        // https://drafts.csswg.org/css-color-hdr/#Jzazbz
1680        jzazbz: {
1681          coords: [
1682            "<percentage> | <number>",
1683            "<number> | <percentage>",
1684            "<number> | <percentage>"
1685          ]
1686        }
1687      }
1688    });
1689  
1690    // packages/theme/node_modules/colorjs.io/src/spaces/jzczhz.js
1691    var jzczhz_default = new ColorSpace({
1692      id: "jzczhz",
1693      name: "JzCzHz",
1694      coords: {
1695        jz: {
1696          refRange: [0, 1],
1697          name: "Jz"
1698        },
1699        cz: {
1700          refRange: [0, 0.26],
1701          name: "Chroma"
1702        },
1703        hz: {
1704          refRange: [0, 360],
1705          type: "angle",
1706          name: "Hue"
1707        }
1708      },
1709      base: jzazbz_default,
1710      fromBase: lch_default.fromBase,
1711      toBase: lch_default.toBase,
1712      formats: {
1713        // https://drafts.csswg.org/css-color-hdr/#JzCzhz
1714        jzczhz: {
1715          coords: ["<percentage> | <number>", "<number> | <percentage>", "<number> | <angle>"]
1716        }
1717      }
1718    });
1719  
1720    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaEJz.js
1721    function deltaEJz_default(color, sample) {
1722      [color, sample] = getColor([color, sample]);
1723      let [Jz1, Cz1, Hz1] = jzczhz_default.from(color);
1724      let [Jz2, Cz2, Hz2] = jzczhz_default.from(sample);
1725      let \u0394J = Jz1 - Jz2;
1726      let \u0394C = Cz1 - Cz2;
1727      if (isNone(Hz1) && isNone(Hz2)) {
1728        Hz1 = 0;
1729        Hz2 = 0;
1730      } else if (isNone(Hz1)) {
1731        Hz1 = Hz2;
1732      } else if (isNone(Hz2)) {
1733        Hz2 = Hz1;
1734      }
1735      let \u0394h = Hz1 - Hz2;
1736      let \u0394H = 2 * Math.sqrt(Cz1 * Cz2) * Math.sin(\u0394h / 2 * (Math.PI / 180));
1737      return Math.sqrt(\u0394J ** 2 + \u0394C ** 2 + \u0394H ** 2);
1738    }
1739  
1740    // packages/theme/node_modules/colorjs.io/src/spaces/ictcp.js
1741    var c12 = 3424 / 4096;
1742    var c22 = 2413 / 128;
1743    var c32 = 2392 / 128;
1744    var m1 = 2610 / 16384;
1745    var m2 = 2523 / 32;
1746    var im1 = 16384 / 2610;
1747    var im2 = 32 / 2523;
1748    var XYZtoLMS_M2 = [
1749      [0.3592832590121217, 0.6976051147779502, -0.035891593232029],
1750      [-0.1920808463704993, 1.100476797037432, 0.0753748658519118],
1751      [0.0070797844607479, 0.0748396662186362, 0.8433265453898765]
1752    ];
1753    var LMStoIPT_M = [
1754      [2048 / 4096, 2048 / 4096, 0],
1755      [6610 / 4096, -13613 / 4096, 7003 / 4096],
1756      [17933 / 4096, -17390 / 4096, -543 / 4096]
1757    ];
1758    var IPTtoLMS_M = [
1759      [0.9999999999999998, 0.0086090370379328, 0.111029625003026],
1760      [0.9999999999999998, -0.0086090370379328, -0.1110296250030259],
1761      [0.9999999999999998, 0.5600313357106791, -0.3206271749873188]
1762    ];
1763    var LMStoXYZ_M2 = [
1764      [2.0701522183894223, -1.3263473389671563, 0.2066510476294053],
1765      [0.3647385209748072, 0.6805660249472273, -0.0453045459220347],
1766      [-0.0497472075358123, -0.0492609666966131, 1.1880659249923042]
1767    ];
1768    var ictcp_default = new ColorSpace({
1769      id: "ictcp",
1770      name: "ICTCP",
1771      // From BT.2100-2 page 7:
1772      // During production, signal values are expected to exceed the
1773      // range E′ = [0.0 : 1.0]. This provides processing headroom and avoids
1774      // signal degradation during cascaded processing. Such values of E′,
1775      // below 0.0 or exceeding 1.0, should not be clipped during production
1776      // and exchange.
1777      // Values below 0.0 should not be clipped in reference displays (even
1778      // though they represent “negative” light) to allow the black level of
1779      // the signal (LB) to be properly set using test signals known as “PLUGE”
1780      coords: {
1781        i: {
1782          refRange: [0, 1],
1783          // Constant luminance,
1784          name: "I"
1785        },
1786        ct: {
1787          refRange: [-0.5, 0.5],
1788          // Full BT.2020 gamut in range [-0.5, 0.5]
1789          name: "CT"
1790        },
1791        cp: {
1792          refRange: [-0.5, 0.5],
1793          name: "CP"
1794        }
1795      },
1796      base: xyz_abs_d65_default,
1797      fromBase(XYZ) {
1798        let LMS = multiply_v3_m3x3(XYZ, XYZtoLMS_M2);
1799        return LMStoICtCp(LMS);
1800      },
1801      toBase(ICtCp) {
1802        let LMS = ICtCptoLMS(ICtCp);
1803        return multiply_v3_m3x3(LMS, LMStoXYZ_M2);
1804      },
1805      formats: {
1806        ictcp: {
1807          coords: [
1808            "<percentage> | <number>",
1809            "<number> | <percentage>",
1810            "<number> | <percentage>"
1811          ]
1812        }
1813      }
1814    });
1815    function LMStoICtCp(LMS) {
1816      let PQLMS = (
1817        /** @type {Vector3} */
1818        LMS.map(function(val) {
1819          let num = c12 + c22 * (val / 1e4) ** m1;
1820          let denom = 1 + c32 * (val / 1e4) ** m1;
1821          return (num / denom) ** m2;
1822        })
1823      );
1824      return multiply_v3_m3x3(PQLMS, LMStoIPT_M);
1825    }
1826    function ICtCptoLMS(ICtCp) {
1827      let PQLMS = multiply_v3_m3x3(ICtCp, IPTtoLMS_M);
1828      let LMS = (
1829        /** @type {Vector3} */
1830        PQLMS.map(function(val) {
1831          let num = Math.max(val ** im2 - c12, 0);
1832          let denom = c22 - c32 * val ** im2;
1833          return 1e4 * (num / denom) ** im1;
1834        })
1835      );
1836      return LMS;
1837    }
1838  
1839    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaEITP.js
1840    function deltaEITP_default(color, sample) {
1841      [color, sample] = getColor([color, sample]);
1842      let [I1, T1, P1] = ictcp_default.from(color);
1843      let [I2, T2, P2] = ictcp_default.from(sample);
1844      return 720 * Math.sqrt((I1 - I2) ** 2 + 0.25 * (T1 - T2) ** 2 + (P1 - P2) ** 2);
1845    }
1846  
1847    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaEOK2.js
1848    function deltaEOK2_default(color, sample) {
1849      [color, sample] = getColor([color, sample]);
1850      let abscale = 2;
1851      let [L1, a1, b1] = oklab_default.from(color);
1852      let [L2, a2, b2] = oklab_default.from(sample);
1853      let \u0394L = L1 - L2;
1854      let \u0394a = abscale * (a1 - a2);
1855      let \u0394b = abscale * (b1 - b2);
1856      return Math.sqrt(\u0394L ** 2 + \u0394a ** 2 + \u0394b ** 2);
1857    }
1858  
1859    // packages/theme/node_modules/colorjs.io/src/spaces/cam16.js
1860    var white2 = WHITES.D65;
1861    var adaptedCoef = 0.42;
1862    var adaptedCoefInv = 1 / adaptedCoef;
1863    var tau = 2 * Math.PI;
1864    var cat16 = [
1865      [0.401288, 0.650173, -0.051461],
1866      [-0.250268, 1.204414, 0.045854],
1867      [-2079e-6, 0.048952, 0.953127]
1868    ];
1869    var cat16Inv = [
1870      [1.8620678550872327, -1.0112546305316843, 0.14918677544445175],
1871      [0.38752654323613717, 0.6214474419314753, -0.008973985167612518],
1872      [-0.015841498849333856, -0.03412293802851557, 1.0499644368778496]
1873    ];
1874    var m12 = [
1875      [460, 451, 288],
1876      [460, -891, -261],
1877      [460, -220, -6300]
1878    ];
1879    var surroundMap = {
1880      dark: [0.8, 0.525, 0.8],
1881      dim: [0.9, 0.59, 0.9],
1882      average: [1, 0.69, 1]
1883    };
1884    var hueQuadMap = {
1885      // Red, Yellow, Green, Blue, Red
1886      h: [20.14, 90, 164.25, 237.53, 380.14],
1887      e: [0.8, 0.7, 1, 1.2, 0.8],
1888      H: [0, 100, 200, 300, 400]
1889    };
1890    var rad2deg = 180 / Math.PI;
1891    var deg2rad = Math.PI / 180;
1892    function adapt2(coords, fl) {
1893      const temp = (
1894        /** @type {[number, number, number]} */
1895        coords.map((c) => {
1896          const x = spow(fl * Math.abs(c) * 0.01, adaptedCoef);
1897          return 400 * copySign(x, c) / (x + 27.13);
1898        })
1899      );
1900      return temp;
1901    }
1902    function unadapt(adapted, fl) {
1903      const constant = 100 / fl * 27.13 ** adaptedCoefInv;
1904      return (
1905        /** @type {[number, number, number]} */
1906        adapted.map((c) => {
1907          const cabs = Math.abs(c);
1908          return copySign(constant * spow(cabs / (400 - cabs), adaptedCoefInv), c);
1909        })
1910      );
1911    }
1912    function hueQuadrature(h) {
1913      let hp = constrain(h);
1914      if (hp <= hueQuadMap.h[0]) {
1915        hp += 360;
1916      }
1917      const i = bisectLeft(hueQuadMap.h, hp) - 1;
1918      const [hi, hii] = hueQuadMap.h.slice(i, i + 2);
1919      const [ei, eii] = hueQuadMap.e.slice(i, i + 2);
1920      const Hi = hueQuadMap.H[i];
1921      const t = (hp - hi) / ei;
1922      return Hi + 100 * t / (t + (hii - hp) / eii);
1923    }
1924    function invHueQuadrature(H) {
1925      let Hp = (H % 400 + 400) % 400;
1926      const i = Math.floor(0.01 * Hp);
1927      Hp = Hp % 100;
1928      const [hi, hii] = hueQuadMap.h.slice(i, i + 2);
1929      const [ei, eii] = hueQuadMap.e.slice(i, i + 2);
1930      return constrain((Hp * (eii * hi - ei * hii) - 100 * hi * eii) / (Hp * (eii - ei) - 100 * eii));
1931    }
1932    function environment(refWhite, adaptingLuminance, backgroundLuminance, surround, discounting) {
1933      const env = {};
1934      env.discounting = discounting;
1935      env.refWhite = refWhite;
1936      env.surround = surround;
1937      const xyzW = (
1938        /** @type {Vector3} */
1939        refWhite.map((c) => {
1940          return c * 100;
1941        })
1942      );
1943      env.la = adaptingLuminance;
1944      env.yb = backgroundLuminance;
1945      const yw = xyzW[1];
1946      const rgbW = multiply_v3_m3x3(xyzW, cat16);
1947      let values = surroundMap[env.surround];
1948      const f = values[0];
1949      env.c = values[1];
1950      env.nc = values[2];
1951      const k = 1 / (5 * env.la + 1);
1952      const k4 = k ** 4;
1953      env.fl = k4 * env.la + 0.1 * (1 - k4) * (1 - k4) * Math.cbrt(5 * env.la);
1954      env.flRoot = env.fl ** 0.25;
1955      env.n = env.yb / yw;
1956      env.z = 1.48 + Math.sqrt(env.n);
1957      env.nbb = 0.725 * env.n ** -0.2;
1958      env.ncb = env.nbb;
1959      const d2 = discounting ? 1 : Math.max(Math.min(f * (1 - 1 / 3.6 * Math.exp((-env.la - 42) / 92)), 1), 0);
1960      env.dRgb = /** @type {[number, number, number]} */
1961      rgbW.map((c) => {
1962        return interpolate(1, yw / c, d2);
1963      });
1964      env.dRgbInv = /** @type {[number, number, number]} */
1965      env.dRgb.map((c) => {
1966        return 1 / c;
1967      });
1968      const rgbCW = (
1969        /** @type {[number, number, number]} */
1970        rgbW.map((c, i) => {
1971          return c * env.dRgb[i];
1972        })
1973      );
1974      const rgbAW = adapt2(rgbCW, env.fl);
1975      env.aW = env.nbb * (2 * rgbAW[0] + rgbAW[1] + 0.05 * rgbAW[2]);
1976      return env;
1977    }
1978    var viewingConditions = environment(white2, 64 / Math.PI * 0.2, 20, "average", false);
1979    function fromCam16(cam16, env) {
1980      if (!(cam16.J !== void 0 ^ cam16.Q !== void 0)) {
1981        throw new Error("Conversion requires one and only one: 'J' or 'Q'");
1982      }
1983      if (!(cam16.C !== void 0 ^ cam16.M !== void 0 ^ cam16.s !== void 0)) {
1984        throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");
1985      }
1986      if (!(cam16.h !== void 0 ^ cam16.H !== void 0)) {
1987        throw new Error("Conversion requires one and only one: 'h' or 'H'");
1988      }
1989      if (cam16.J === 0 || cam16.Q === 0) {
1990        return [0, 0, 0];
1991      }
1992      let hRad = 0;
1993      if (cam16.h !== void 0) {
1994        hRad = constrain(cam16.h) * deg2rad;
1995      } else {
1996        hRad = invHueQuadrature(cam16.H) * deg2rad;
1997      }
1998      const cosh = Math.cos(hRad);
1999      const sinh = Math.sin(hRad);
2000      let Jroot = 0;
2001      if (cam16.J !== void 0) {
2002        Jroot = spow(cam16.J, 1 / 2) * 0.1;
2003      } else if (cam16.Q !== void 0) {
2004        Jroot = 0.25 * env.c * cam16.Q / ((env.aW + 4) * env.flRoot);
2005      }
2006      let alpha = 0;
2007      if (cam16.C !== void 0) {
2008        alpha = cam16.C / Jroot;
2009      } else if (cam16.M !== void 0) {
2010        alpha = cam16.M / env.flRoot / Jroot;
2011      } else if (cam16.s !== void 0) {
2012        alpha = 4e-4 * cam16.s ** 2 * (env.aW + 4) / env.c;
2013      }
2014      const t = spow(alpha * Math.pow(1.64 - Math.pow(0.29, env.n), -0.73), 10 / 9);
2015      const et = 0.25 * (Math.cos(hRad + 2) + 3.8);
2016      const A = env.aW * spow(Jroot, 2 / env.c / env.z);
2017      const p1 = 5e4 / 13 * env.nc * env.ncb * et;
2018      const p2 = A / env.nbb;
2019      const r = 23 * (p2 + 0.305) * zdiv(t, 23 * p1 + t * (11 * cosh + 108 * sinh));
2020      const a = r * cosh;
2021      const b2 = r * sinh;
2022      const rgb_c = unadapt(
2023        /** @type {Vector3} */
2024        multiply_v3_m3x3([p2, a, b2], m12).map((c) => {
2025          return c * 1 / 1403;
2026        }),
2027        env.fl
2028      );
2029      return (
2030        /** @type {Vector3} */
2031        multiply_v3_m3x3(
2032          /** @type {Vector3} */
2033          rgb_c.map((c, i) => {
2034            return c * env.dRgbInv[i];
2035          }),
2036          cat16Inv
2037        ).map((c) => {
2038          return c / 100;
2039        })
2040      );
2041    }
2042    function toCam16(xyzd65, env) {
2043      const xyz100 = (
2044        /** @type {Vector3} */
2045        xyzd65.map((c) => {
2046          return c * 100;
2047        })
2048      );
2049      const rgbA = adapt2(
2050        /** @type {[number, number, number]} */
2051        multiply_v3_m3x3(xyz100, cat16).map((c, i) => {
2052          return c * env.dRgb[i];
2053        }),
2054        env.fl
2055      );
2056      const a = rgbA[0] + (-12 * rgbA[1] + rgbA[2]) / 11;
2057      const b2 = (rgbA[0] + rgbA[1] - 2 * rgbA[2]) / 9;
2058      const hRad = (Math.atan2(b2, a) % tau + tau) % tau;
2059      const et = 0.25 * (Math.cos(hRad + 2) + 3.8);
2060      const t = 5e4 / 13 * env.nc * env.ncb * zdiv(et * Math.sqrt(a ** 2 + b2 ** 2), rgbA[0] + rgbA[1] + 1.05 * rgbA[2] + 0.305);
2061      const alpha = spow(t, 0.9) * Math.pow(1.64 - Math.pow(0.29, env.n), 0.73);
2062      const A = env.nbb * (2 * rgbA[0] + rgbA[1] + 0.05 * rgbA[2]);
2063      const Jroot = spow(A / env.aW, 0.5 * env.c * env.z);
2064      const J = 100 * spow(Jroot, 2);
2065      const Q = 4 / env.c * Jroot * (env.aW + 4) * env.flRoot;
2066      const C = alpha * Jroot;
2067      const M = C * env.flRoot;
2068      const h = constrain(hRad * rad2deg);
2069      const H = hueQuadrature(h);
2070      const s = 50 * spow(env.c * alpha / (env.aW + 4), 1 / 2);
2071      return { J, C, h, s, Q, M, H };
2072    }
2073    var cam16_default = new ColorSpace({
2074      id: "cam16-jmh",
2075      cssId: "--cam16-jmh",
2076      name: "CAM16-JMh",
2077      coords: {
2078        j: {
2079          refRange: [0, 100],
2080          name: "J"
2081        },
2082        m: {
2083          refRange: [0, 105],
2084          name: "Colorfulness"
2085        },
2086        h: {
2087          refRange: [0, 360],
2088          type: "angle",
2089          name: "Hue"
2090        }
2091      },
2092      base: xyz_d65_default,
2093      fromBase(xyz) {
2094        if (this.\u03B5 === void 0) {
2095          this.\u03B5 = Object.values(this.coords)[1].refRange[1] / 1e5;
2096        }
2097        const cam16 = toCam16(xyz, viewingConditions);
2098        const isAchromatic = Math.abs(cam16.M) < this.\u03B5;
2099        return [cam16.J, isAchromatic ? 0 : cam16.M, isAchromatic ? null : cam16.h];
2100      },
2101      toBase(cam16) {
2102        return fromCam16({ J: cam16[0], M: cam16[1], h: cam16[2] }, viewingConditions);
2103      }
2104    });
2105  
2106    // packages/theme/node_modules/colorjs.io/src/spaces/hct.js
2107    var white3 = WHITES.D65;
2108    var \u03B55 = 216 / 24389;
2109    var \u03BA2 = 24389 / 27;
2110    function toLstar(y) {
2111      const fy = y > \u03B55 ? Math.cbrt(y) : (\u03BA2 * y + 16) / 116;
2112      return 116 * fy - 16;
2113    }
2114    function fromLstar(lstar) {
2115      return lstar > 8 ? Math.pow((lstar + 16) / 116, 3) : lstar / \u03BA2;
2116    }
2117    function fromHct(coords, env) {
2118      let [h, c, t] = coords;
2119      let xyz = [];
2120      let j = 0;
2121      if (t === 0) {
2122        return [0, 0, 0];
2123      }
2124      let y = fromLstar(t);
2125      if (t > 0) {
2126        j = 0.00379058511492914 * t ** 2 + 0.608983189401032 * t + 0.9155088574762233;
2127      } else {
2128        j = 9514440756550361e-21 * t ** 2 + 0.08693057439788597 * t - 21.928975842194614;
2129      }
2130      const threshold = 2e-12;
2131      const max_attempts = 15;
2132      let attempt = 0;
2133      let last = Infinity;
2134      let best = j;
2135      while (attempt <= max_attempts) {
2136        xyz = fromCam16({ J: j, C: c, h }, env);
2137        const delta = Math.abs(xyz[1] - y);
2138        if (delta < last) {
2139          if (delta <= threshold) {
2140            return xyz;
2141          }
2142          best = j;
2143          last = delta;
2144        }
2145        j = j - (xyz[1] - y) * j / (2 * xyz[1]);
2146        attempt += 1;
2147      }
2148      return fromCam16({ J: j, C: c, h }, env);
2149    }
2150    function toHct(xyz, env) {
2151      const t = toLstar(xyz[1]);
2152      if (t === 0) {
2153        return [0, 0, 0];
2154      }
2155      const cam16 = toCam16(xyz, viewingConditions2);
2156      return [constrain(cam16.h), cam16.C, t];
2157    }
2158    var viewingConditions2 = environment(
2159      white3,
2160      200 / Math.PI * fromLstar(50),
2161      fromLstar(50) * 100,
2162      "average",
2163      false
2164    );
2165    var hct_default = new ColorSpace({
2166      id: "hct",
2167      name: "HCT",
2168      coords: {
2169        h: {
2170          refRange: [0, 360],
2171          type: "angle",
2172          name: "Hue"
2173        },
2174        c: {
2175          refRange: [0, 145],
2176          name: "Colorfulness"
2177        },
2178        t: {
2179          refRange: [0, 100],
2180          name: "Tone"
2181        }
2182      },
2183      base: xyz_d65_default,
2184      fromBase(xyz) {
2185        if (this.\u03B5 === void 0) {
2186          this.\u03B5 = Object.values(this.coords)[1].refRange[1] / 1e5;
2187        }
2188        let hct = toHct(xyz, viewingConditions2);
2189        if (hct[1] < this.\u03B5) {
2190          hct[1] = 0;
2191          hct[0] = null;
2192        }
2193        return hct;
2194      },
2195      toBase(hct) {
2196        return fromHct(hct, viewingConditions2);
2197      },
2198      formats: {
2199        color: {
2200          id: "--hct",
2201          coords: ["<number> | <angle>", "<percentage> | <number>", "<percentage> | <number>"]
2202        }
2203      }
2204    });
2205  
2206    // packages/theme/node_modules/colorjs.io/src/deltaE/deltaEHCT.js
2207    var rad2deg2 = 180 / Math.PI;
2208    var deg2rad2 = Math.PI / 180;
2209    var ucsCoeff = [1, 7e-3, 0.0228];
2210    function convertUcsAb(coords) {
2211      if (coords[1] < 0) {
2212        coords = hct_default.fromBase(hct_default.toBase(coords));
2213      }
2214      const M = Math.log(Math.max(1 + ucsCoeff[2] * coords[1] * viewingConditions2.flRoot, 1)) / ucsCoeff[2];
2215      const hrad = coords[0] * deg2rad2;
2216      const a = M * Math.cos(hrad);
2217      const b2 = M * Math.sin(hrad);
2218      return [coords[2], a, b2];
2219    }
2220    function deltaEHCT_default(color, sample) {
2221      [color, sample] = getColor([color, sample]);
2222      let [t1, a1, b1] = convertUcsAb(hct_default.from(color));
2223      let [t2, a2, b2] = convertUcsAb(hct_default.from(sample));
2224      return Math.sqrt((t1 - t2) ** 2 + (a1 - a2) ** 2 + (b1 - b2) ** 2);
2225    }
2226  
2227    // packages/theme/node_modules/colorjs.io/src/deltaE/index.js
2228    var deltaE_default = {
2229      deltaE76,
2230      deltaECMC: deltaECMC_default,
2231      deltaE2000: deltaE2000_default,
2232      deltaEJz: deltaEJz_default,
2233      deltaEITP: deltaEITP_default,
2234      deltaEOK: deltaEOK_default,
2235      deltaEOK2: deltaEOK2_default,
2236      deltaEHCT: deltaEHCT_default
2237    };
2238  
2239    // packages/theme/node_modules/colorjs.io/src/toGamut.js
2240    function calcEpsilon(jnd) {
2241      const order = !jnd ? 0 : Math.floor(Math.log10(Math.abs(jnd)));
2242      return Math.max(parseFloat(`1e$order - 2}`), 1e-6);
2243    }
2244    var GMAPPRESET = {
2245      hct: {
2246        method: "hct.c",
2247        jnd: 2,
2248        deltaEMethod: "hct",
2249        blackWhiteClamp: {}
2250      },
2251      "hct-tonal": {
2252        method: "hct.c",
2253        jnd: 0,
2254        deltaEMethod: "hct",
2255        blackWhiteClamp: { channel: "hct.t", min: 0, max: 100 }
2256      }
2257    };
2258    function toGamut(color, {
2259      method = defaults_default.gamut_mapping,
2260      space = void 0,
2261      deltaEMethod = "",
2262      jnd = 2,
2263      blackWhiteClamp = void 0
2264    } = {}) {
2265      color = getColor(color);
2266      if (isString(arguments[1])) {
2267        space = arguments[1];
2268      } else if (!space) {
2269        space = color.space;
2270      }
2271      space = ColorSpace.get(space);
2272      if (inGamut(color, space, { epsilon: 0 })) {
2273        return (
2274          /** @type {PlainColorObject} */
2275          color
2276        );
2277      }
2278      let spaceColor;
2279      if (method === "css") {
2280        spaceColor = toGamutCSS(color, { space });
2281      } else {
2282        if (method !== "clip" && !inGamut(color, space)) {
2283          if (Object.prototype.hasOwnProperty.call(GMAPPRESET, method)) {
2284            ({ method, jnd, deltaEMethod, blackWhiteClamp } = GMAPPRESET[method]);
2285          }
2286          let de = deltaE2000_default;
2287          if (deltaEMethod !== "") {
2288            for (let m in deltaE_default) {
2289              if ("deltae" + deltaEMethod.toLowerCase() === m.toLowerCase()) {
2290                de = deltaE_default[m];
2291                break;
2292              }
2293            }
2294          }
2295          if (jnd === 0) {
2296            jnd = 1e-16;
2297          }
2298          let clipped = toGamut(to(color, space), { method: "clip", space });
2299          if (de(color, clipped) > jnd) {
2300            if (blackWhiteClamp && Object.keys(blackWhiteClamp).length === 3) {
2301              let channelMeta = ColorSpace.resolveCoord(blackWhiteClamp.channel);
2302              let channel = get(to(color, channelMeta.space), channelMeta.id);
2303              if (isNone(channel)) {
2304                channel = 0;
2305              }
2306              if (channel >= blackWhiteClamp.max) {
2307                return to({ space: "xyz-d65", coords: WHITES["D65"] }, color.space);
2308              } else if (channel <= blackWhiteClamp.min) {
2309                return to({ space: "xyz-d65", coords: [0, 0, 0] }, color.space);
2310              }
2311            }
2312            let coordMeta = ColorSpace.resolveCoord(method);
2313            let mapSpace = coordMeta.space;
2314            let coordId = coordMeta.id;
2315            let mappedColor = to(color, mapSpace);
2316            mappedColor.coords.forEach((c, i) => {
2317              if (isNone(c)) {
2318                mappedColor.coords[i] = 0;
2319              }
2320            });
2321            let bounds = coordMeta.range || coordMeta.refRange;
2322            let min = bounds[0];
2323            let \u03B56 = calcEpsilon(jnd);
2324            let low = min;
2325            let high = get(mappedColor, coordId);
2326            while (high - low > \u03B56) {
2327              let clipped2 = clone(mappedColor);
2328              clipped2 = toGamut(clipped2, { space, method: "clip" });
2329              let deltaE = de(mappedColor, clipped2);
2330              if (deltaE - jnd < \u03B56) {
2331                low = get(mappedColor, coordId);
2332              } else {
2333                high = get(mappedColor, coordId);
2334              }
2335              set(mappedColor, coordId, (low + high) / 2);
2336            }
2337            spaceColor = to(mappedColor, space);
2338          } else {
2339            spaceColor = clipped;
2340          }
2341        } else {
2342          spaceColor = to(color, space);
2343        }
2344        if (method === "clip" || // Dumb coord clipping
2345        // finish off smarter gamut mapping with clip to get rid of ε, see #17
2346        !inGamut(spaceColor, space, { epsilon: 0 })) {
2347          let bounds = Object.values(space.coords).map((c) => c.range || []);
2348          spaceColor.coords = /** @type {[number, number, number]} */
2349          spaceColor.coords.map((c, i) => {
2350            let [min, max] = bounds[i];
2351            if (min !== void 0) {
2352              c = Math.max(min, c);
2353            }
2354            if (max !== void 0) {
2355              c = Math.min(c, max);
2356            }
2357            return c;
2358          });
2359        }
2360      }
2361      if (space !== color.space) {
2362        spaceColor = to(spaceColor, color.space);
2363      }
2364      color.coords = spaceColor.coords;
2365      return (
2366        /** @type {PlainColorObject} */
2367        color
2368      );
2369    }
2370    toGamut.returns = "color";
2371    var COLORS = {
2372      WHITE: { space: oklab_default, coords: [1, 0, 0], alpha: 1 },
2373      BLACK: { space: oklab_default, coords: [0, 0, 0], alpha: 1 }
2374    };
2375    function toGamutCSS(origin, { space } = {}) {
2376      const JND = 0.02;
2377      const \u03B56 = 1e-4;
2378      origin = getColor(origin);
2379      if (!space) {
2380        space = origin.space;
2381      }
2382      space = ColorSpace.get(space);
2383      const oklchSpace = ColorSpace.get("oklch");
2384      if (space.isUnbounded) {
2385        return to(origin, space);
2386      }
2387      const origin_OKLCH = to(origin, oklchSpace);
2388      let L = origin_OKLCH.coords[0];
2389      if (L >= 1) {
2390        const white4 = to(COLORS.WHITE, space);
2391        white4.alpha = origin.alpha;
2392        return to(white4, space);
2393      }
2394      if (L <= 0) {
2395        const black = to(COLORS.BLACK, space);
2396        black.alpha = origin.alpha;
2397        return to(black, space);
2398      }
2399      if (inGamut(origin_OKLCH, space, { epsilon: 0 })) {
2400        return to(origin_OKLCH, space);
2401      }
2402      function clip(_color) {
2403        const destColor = to(_color, space);
2404        const spaceCoords = Object.values(
2405          /** @type {ColorSpace} */
2406          space.coords
2407        );
2408        destColor.coords = /** @type {[number, number, number]} */
2409        destColor.coords.map((coord, index) => {
2410          if ("range" in spaceCoords[index]) {
2411            const [min2, max2] = spaceCoords[index].range;
2412            return clamp(min2, coord, max2);
2413          }
2414          return coord;
2415        });
2416        return destColor;
2417      }
2418      let min = 0;
2419      let max = origin_OKLCH.coords[1];
2420      let min_inGamut = true;
2421      let current = clone(origin_OKLCH);
2422      let clipped = clip(current);
2423      let E = deltaEOK_default(clipped, current);
2424      if (E < JND) {
2425        return clipped;
2426      }
2427      while (max - min > \u03B56) {
2428        const chroma = (min + max) / 2;
2429        current.coords[1] = chroma;
2430        if (min_inGamut && inGamut(current, space, { epsilon: 0 })) {
2431          min = chroma;
2432        } else {
2433          clipped = clip(current);
2434          E = deltaEOK_default(clipped, current);
2435          if (E < JND) {
2436            if (JND - E < \u03B56) {
2437              break;
2438            } else {
2439              min_inGamut = false;
2440              min = chroma;
2441            }
2442          } else {
2443            max = chroma;
2444          }
2445        }
2446      }
2447      return clipped;
2448    }
2449  
2450    // packages/theme/node_modules/colorjs.io/src/to.js
2451    function to(color, space, { inGamut: inGamut2 } = {}) {
2452      color = getColor(color);
2453      space = ColorSpace.get(space);
2454      let coords = space.from(color);
2455      let ret = { space, coords, alpha: color.alpha };
2456      if (inGamut2) {
2457        ret = toGamut(ret, inGamut2 === true ? void 0 : inGamut2);
2458      }
2459      return ret;
2460    }
2461    to.returns = "color";
2462  
2463    // packages/theme/node_modules/colorjs.io/src/serialize.js
2464    function serialize(color, options = {}) {
2465      let {
2466        precision = defaults_default.precision,
2467        format,
2468        inGamut: inGamut2 = true,
2469        coords: coordFormat,
2470        alpha: alphaFormat,
2471        commas
2472      } = options;
2473      let ret;
2474      let colorWithMeta = (
2475        /** @type {PlainColorObject & ParseOptions} */
2476        getColor(color)
2477      );
2478      let formatId = format;
2479      let parseMeta = colorWithMeta.parseMeta;
2480      if (parseMeta && !format) {
2481        if (parseMeta.format.canSerialize()) {
2482          format = parseMeta.format;
2483          formatId = parseMeta.formatId;
2484        }
2485        coordFormat ??= parseMeta.types;
2486        alphaFormat ??= parseMeta.alphaType;
2487        commas ??= parseMeta.commas;
2488      }
2489      if (formatId) {
2490        format = colorWithMeta.space.getFormat(format) ?? ColorSpace.findFormat(formatId);
2491      }
2492      if (!format) {
2493        format = colorWithMeta.space.getFormat("default") ?? ColorSpace.DEFAULT_FORMAT;
2494        formatId = format.name;
2495      }
2496      if (format && format.space && format.space !== colorWithMeta.space) {
2497        colorWithMeta = to(colorWithMeta, format.space);
2498      }
2499      let coords = colorWithMeta.coords.slice();
2500      inGamut2 ||= format.toGamut;
2501      if (inGamut2 && !inGamut(colorWithMeta)) {
2502        coords = toGamut(clone(colorWithMeta), inGamut2 === true ? void 0 : inGamut2).coords;
2503      }
2504      if (format.type === "custom") {
2505        if (format.serialize) {
2506          ret = format.serialize(coords, colorWithMeta.alpha, options);
2507        } else {
2508          throw new TypeError(
2509            `format $formatId} can only be used to parse colors, not for serialization`
2510          );
2511        }
2512      } else {
2513        let name = format.name || "color";
2514        let args = format.serializeCoords(coords, precision, coordFormat);
2515        if (name === "color") {
2516          let cssId = format.id || format.ids?.[0] || colorWithMeta.space.cssId || colorWithMeta.space.id;
2517          args.unshift(cssId);
2518        }
2519        let alpha = colorWithMeta.alpha;
2520        if (alphaFormat !== void 0 && !(typeof alphaFormat === "object")) {
2521          alphaFormat = typeof alphaFormat === "string" ? { type: alphaFormat } : { include: alphaFormat };
2522        }
2523        let alphaType = alphaFormat?.type ?? "<number>";
2524        let serializeAlpha = alphaFormat?.include === true || format.alpha === true || alphaFormat?.include !== false && format.alpha !== false && alpha < 1;
2525        let strAlpha = "";
2526        commas ??= format.commas;
2527        if (serializeAlpha) {
2528          if (precision !== null) {
2529            let unit;
2530            if (alphaType === "<percentage>") {
2531              unit = "%";
2532              alpha *= 100;
2533            }
2534            alpha = serializeNumber(alpha, { precision, unit });
2535          }
2536          strAlpha = `$commas ? "," : " /"} $alpha}`;
2537        }
2538        ret = `$name}($args.join(commas ? ", " : " ")}$strAlpha})`;
2539      }
2540      return ret;
2541    }
2542  
2543    // packages/theme/node_modules/colorjs.io/src/spaces/srgb-linear.js
2544    var toXYZ_M = [
2545      [0.41239079926595934, 0.357584339383878, 0.1804807884018343],
2546      [0.21263900587151027, 0.715168678767756, 0.07219231536073371],
2547      [0.01933081871559182, 0.11919477979462598, 0.9505321522496607]
2548    ];
2549    var fromXYZ_M = [
2550      [3.2409699419045226, -1.537383177570094, -0.4986107602930034],
2551      [-0.9692436362808796, 1.8759675015077202, 0.04155505740717559],
2552      [0.05563007969699366, -0.20397695888897652, 1.0569715142428786]
2553    ];
2554    var srgb_linear_default = new RGBColorSpace({
2555      id: "srgb-linear",
2556      name: "Linear sRGB",
2557      white: "D65",
2558      toXYZ_M,
2559      fromXYZ_M
2560    });
2561  
2562    // packages/theme/node_modules/colorjs.io/src/keywords.js
2563    var keywords_default = {
2564      aliceblue: [240 / 255, 248 / 255, 1],
2565      antiquewhite: [250 / 255, 235 / 255, 215 / 255],
2566      aqua: [0, 1, 1],
2567      aquamarine: [127 / 255, 1, 212 / 255],
2568      azure: [240 / 255, 1, 1],
2569      beige: [245 / 255, 245 / 255, 220 / 255],
2570      bisque: [1, 228 / 255, 196 / 255],
2571      black: [0, 0, 0],
2572      blanchedalmond: [1, 235 / 255, 205 / 255],
2573      blue: [0, 0, 1],
2574      blueviolet: [138 / 255, 43 / 255, 226 / 255],
2575      brown: [165 / 255, 42 / 255, 42 / 255],
2576      burlywood: [222 / 255, 184 / 255, 135 / 255],
2577      cadetblue: [95 / 255, 158 / 255, 160 / 255],
2578      chartreuse: [127 / 255, 1, 0],
2579      chocolate: [210 / 255, 105 / 255, 30 / 255],
2580      coral: [1, 127 / 255, 80 / 255],
2581      cornflowerblue: [100 / 255, 149 / 255, 237 / 255],
2582      cornsilk: [1, 248 / 255, 220 / 255],
2583      crimson: [220 / 255, 20 / 255, 60 / 255],
2584      cyan: [0, 1, 1],
2585      darkblue: [0, 0, 139 / 255],
2586      darkcyan: [0, 139 / 255, 139 / 255],
2587      darkgoldenrod: [184 / 255, 134 / 255, 11 / 255],
2588      darkgray: [169 / 255, 169 / 255, 169 / 255],
2589      darkgreen: [0, 100 / 255, 0],
2590      darkgrey: [169 / 255, 169 / 255, 169 / 255],
2591      darkkhaki: [189 / 255, 183 / 255, 107 / 255],
2592      darkmagenta: [139 / 255, 0, 139 / 255],
2593      darkolivegreen: [85 / 255, 107 / 255, 47 / 255],
2594      darkorange: [1, 140 / 255, 0],
2595      darkorchid: [153 / 255, 50 / 255, 204 / 255],
2596      darkred: [139 / 255, 0, 0],
2597      darksalmon: [233 / 255, 150 / 255, 122 / 255],
2598      darkseagreen: [143 / 255, 188 / 255, 143 / 255],
2599      darkslateblue: [72 / 255, 61 / 255, 139 / 255],
2600      darkslategray: [47 / 255, 79 / 255, 79 / 255],
2601      darkslategrey: [47 / 255, 79 / 255, 79 / 255],
2602      darkturquoise: [0, 206 / 255, 209 / 255],
2603      darkviolet: [148 / 255, 0, 211 / 255],
2604      deeppink: [1, 20 / 255, 147 / 255],
2605      deepskyblue: [0, 191 / 255, 1],
2606      dimgray: [105 / 255, 105 / 255, 105 / 255],
2607      dimgrey: [105 / 255, 105 / 255, 105 / 255],
2608      dodgerblue: [30 / 255, 144 / 255, 1],
2609      firebrick: [178 / 255, 34 / 255, 34 / 255],
2610      floralwhite: [1, 250 / 255, 240 / 255],
2611      forestgreen: [34 / 255, 139 / 255, 34 / 255],
2612      fuchsia: [1, 0, 1],
2613      gainsboro: [220 / 255, 220 / 255, 220 / 255],
2614      ghostwhite: [248 / 255, 248 / 255, 1],
2615      gold: [1, 215 / 255, 0],
2616      goldenrod: [218 / 255, 165 / 255, 32 / 255],
2617      gray: [128 / 255, 128 / 255, 128 / 255],
2618      green: [0, 128 / 255, 0],
2619      greenyellow: [173 / 255, 1, 47 / 255],
2620      grey: [128 / 255, 128 / 255, 128 / 255],
2621      honeydew: [240 / 255, 1, 240 / 255],
2622      hotpink: [1, 105 / 255, 180 / 255],
2623      indianred: [205 / 255, 92 / 255, 92 / 255],
2624      indigo: [75 / 255, 0, 130 / 255],
2625      ivory: [1, 1, 240 / 255],
2626      khaki: [240 / 255, 230 / 255, 140 / 255],
2627      lavender: [230 / 255, 230 / 255, 250 / 255],
2628      lavenderblush: [1, 240 / 255, 245 / 255],
2629      lawngreen: [124 / 255, 252 / 255, 0],
2630      lemonchiffon: [1, 250 / 255, 205 / 255],
2631      lightblue: [173 / 255, 216 / 255, 230 / 255],
2632      lightcoral: [240 / 255, 128 / 255, 128 / 255],
2633      lightcyan: [224 / 255, 1, 1],
2634      lightgoldenrodyellow: [250 / 255, 250 / 255, 210 / 255],
2635      lightgray: [211 / 255, 211 / 255, 211 / 255],
2636      lightgreen: [144 / 255, 238 / 255, 144 / 255],
2637      lightgrey: [211 / 255, 211 / 255, 211 / 255],
2638      lightpink: [1, 182 / 255, 193 / 255],
2639      lightsalmon: [1, 160 / 255, 122 / 255],
2640      lightseagreen: [32 / 255, 178 / 255, 170 / 255],
2641      lightskyblue: [135 / 255, 206 / 255, 250 / 255],
2642      lightslategray: [119 / 255, 136 / 255, 153 / 255],
2643      lightslategrey: [119 / 255, 136 / 255, 153 / 255],
2644      lightsteelblue: [176 / 255, 196 / 255, 222 / 255],
2645      lightyellow: [1, 1, 224 / 255],
2646      lime: [0, 1, 0],
2647      limegreen: [50 / 255, 205 / 255, 50 / 255],
2648      linen: [250 / 255, 240 / 255, 230 / 255],
2649      magenta: [1, 0, 1],
2650      maroon: [128 / 255, 0, 0],
2651      mediumaquamarine: [102 / 255, 205 / 255, 170 / 255],
2652      mediumblue: [0, 0, 205 / 255],
2653      mediumorchid: [186 / 255, 85 / 255, 211 / 255],
2654      mediumpurple: [147 / 255, 112 / 255, 219 / 255],
2655      mediumseagreen: [60 / 255, 179 / 255, 113 / 255],
2656      mediumslateblue: [123 / 255, 104 / 255, 238 / 255],
2657      mediumspringgreen: [0, 250 / 255, 154 / 255],
2658      mediumturquoise: [72 / 255, 209 / 255, 204 / 255],
2659      mediumvioletred: [199 / 255, 21 / 255, 133 / 255],
2660      midnightblue: [25 / 255, 25 / 255, 112 / 255],
2661      mintcream: [245 / 255, 1, 250 / 255],
2662      mistyrose: [1, 228 / 255, 225 / 255],
2663      moccasin: [1, 228 / 255, 181 / 255],
2664      navajowhite: [1, 222 / 255, 173 / 255],
2665      navy: [0, 0, 128 / 255],
2666      oldlace: [253 / 255, 245 / 255, 230 / 255],
2667      olive: [128 / 255, 128 / 255, 0],
2668      olivedrab: [107 / 255, 142 / 255, 35 / 255],
2669      orange: [1, 165 / 255, 0],
2670      orangered: [1, 69 / 255, 0],
2671      orchid: [218 / 255, 112 / 255, 214 / 255],
2672      palegoldenrod: [238 / 255, 232 / 255, 170 / 255],
2673      palegreen: [152 / 255, 251 / 255, 152 / 255],
2674      paleturquoise: [175 / 255, 238 / 255, 238 / 255],
2675      palevioletred: [219 / 255, 112 / 255, 147 / 255],
2676      papayawhip: [1, 239 / 255, 213 / 255],
2677      peachpuff: [1, 218 / 255, 185 / 255],
2678      peru: [205 / 255, 133 / 255, 63 / 255],
2679      pink: [1, 192 / 255, 203 / 255],
2680      plum: [221 / 255, 160 / 255, 221 / 255],
2681      powderblue: [176 / 255, 224 / 255, 230 / 255],
2682      purple: [128 / 255, 0, 128 / 255],
2683      rebeccapurple: [102 / 255, 51 / 255, 153 / 255],
2684      red: [1, 0, 0],
2685      rosybrown: [188 / 255, 143 / 255, 143 / 255],
2686      royalblue: [65 / 255, 105 / 255, 225 / 255],
2687      saddlebrown: [139 / 255, 69 / 255, 19 / 255],
2688      salmon: [250 / 255, 128 / 255, 114 / 255],
2689      sandybrown: [244 / 255, 164 / 255, 96 / 255],
2690      seagreen: [46 / 255, 139 / 255, 87 / 255],
2691      seashell: [1, 245 / 255, 238 / 255],
2692      sienna: [160 / 255, 82 / 255, 45 / 255],
2693      silver: [192 / 255, 192 / 255, 192 / 255],
2694      skyblue: [135 / 255, 206 / 255, 235 / 255],
2695      slateblue: [106 / 255, 90 / 255, 205 / 255],
2696      slategray: [112 / 255, 128 / 255, 144 / 255],
2697      slategrey: [112 / 255, 128 / 255, 144 / 255],
2698      snow: [1, 250 / 255, 250 / 255],
2699      springgreen: [0, 1, 127 / 255],
2700      steelblue: [70 / 255, 130 / 255, 180 / 255],
2701      tan: [210 / 255, 180 / 255, 140 / 255],
2702      teal: [0, 128 / 255, 128 / 255],
2703      thistle: [216 / 255, 191 / 255, 216 / 255],
2704      tomato: [1, 99 / 255, 71 / 255],
2705      turquoise: [64 / 255, 224 / 255, 208 / 255],
2706      violet: [238 / 255, 130 / 255, 238 / 255],
2707      wheat: [245 / 255, 222 / 255, 179 / 255],
2708      white: [1, 1, 1],
2709      whitesmoke: [245 / 255, 245 / 255, 245 / 255],
2710      yellow: [1, 1, 0],
2711      yellowgreen: [154 / 255, 205 / 255, 50 / 255]
2712    };
2713  
2714    // packages/theme/node_modules/colorjs.io/src/spaces/srgb.js
2715    var coordGrammar = Array(3).fill("<percentage> | <number>[0, 255]");
2716    var coordGrammarNumber = Array(3).fill("<number>[0, 255]");
2717    var srgb_default = new RGBColorSpace({
2718      id: "srgb",
2719      name: "sRGB",
2720      base: srgb_linear_default,
2721      fromBase: (rgb) => {
2722        return rgb.map((val) => {
2723          let sign = val < 0 ? -1 : 1;
2724          let abs = val * sign;
2725          if (abs > 31308e-7) {
2726            return sign * (1.055 * abs ** (1 / 2.4) - 0.055);
2727          }
2728          return 12.92 * val;
2729        });
2730      },
2731      toBase: (rgb) => {
2732        return rgb.map((val) => {
2733          let sign = val < 0 ? -1 : 1;
2734          let abs = val * sign;
2735          if (abs <= 0.04045) {
2736            return val / 12.92;
2737          }
2738          return sign * ((abs + 0.055) / 1.055) ** 2.4;
2739        });
2740      },
2741      formats: {
2742        rgb: {
2743          coords: coordGrammar
2744        },
2745        rgb_number: {
2746          name: "rgb",
2747          commas: true,
2748          coords: coordGrammarNumber,
2749          alpha: false
2750        },
2751        color: {
2752          /* use defaults */
2753        },
2754        rgba: {
2755          coords: coordGrammar,
2756          commas: true,
2757          alpha: true
2758        },
2759        rgba_number: {
2760          name: "rgba",
2761          commas: true,
2762          coords: coordGrammarNumber
2763        },
2764        hex: {
2765          type: "custom",
2766          toGamut: true,
2767          test: (str) => /^#(([a-f0-9]{2}){3,4}|[a-f0-9]{3,4})$/i.test(str),
2768          parse(str) {
2769            if (str.length <= 5) {
2770              str = str.replace(/[a-f0-9]/gi, "$&$&");
2771            }
2772            let rgba = [];
2773            str.replace(/[a-f0-9]{2}/gi, (component) => {
2774              rgba.push(parseInt(component, 16) / 255);
2775            });
2776            return {
2777              spaceId: "srgb",
2778              coords: (
2779                /** @type {Coords} */
2780                rgba.slice(0, 3)
2781              ),
2782              alpha: (
2783                /** @type {number} */
2784                rgba.slice(3)[0]
2785              )
2786            };
2787          },
2788          serialize: (coords, alpha, {
2789            collapse = true,
2790            // collapse to 3-4 digit hex when possible?
2791            alpha: alphaFormat
2792          } = {}) => {
2793            if (alphaFormat !== false && alpha < 1 || alphaFormat === true) {
2794              coords.push(alpha);
2795            }
2796            coords = /** @type {[number, number, number]} */
2797            coords.map((c) => Math.round(c * 255));
2798            let collapsible = collapse && coords.every((c) => c % 17 === 0);
2799            let hex = coords.map((c) => {
2800              if (collapsible) {
2801                return (c / 17).toString(16);
2802              }
2803              return c.toString(16).padStart(2, "0");
2804            }).join("");
2805            return "#" + hex;
2806          }
2807        },
2808        keyword: {
2809          type: "custom",
2810          test: (str) => /^[a-z]+$/i.test(str),
2811          parse(str) {
2812            str = str.toLowerCase();
2813            let ret = { spaceId: "srgb", coords: null, alpha: 1 };
2814            if (str === "transparent") {
2815              ret.coords = keywords_default.black;
2816              ret.alpha = 0;
2817            } else {
2818              ret.coords = keywords_default[str];
2819            }
2820            if (ret.coords) {
2821              return ret;
2822            }
2823          }
2824        }
2825      }
2826    });
2827  
2828    // packages/theme/node_modules/colorjs.io/src/luminance.js
2829    function getLuminance(color) {
2830      return get(color, [xyz_d65_default, "y"]);
2831    }
2832  
2833    // packages/theme/node_modules/colorjs.io/src/contrast/WCAG21.js
2834    function contrastWCAG21(color1, color2) {
2835      color1 = getColor(color1);
2836      color2 = getColor(color2);
2837      let Y1 = Math.max(getLuminance(color1), 0);
2838      let Y2 = Math.max(getLuminance(color2), 0);
2839      if (Y2 > Y1) {
2840        [Y1, Y2] = [Y2, Y1];
2841      }
2842      return (Y1 + 0.05) / (Y2 + 0.05);
2843    }
2844  
2845    // packages/theme/node_modules/colorjs.io/src/spaces/hsl.js
2846    var hsl_default = new ColorSpace({
2847      id: "hsl",
2848      name: "HSL",
2849      coords: {
2850        h: {
2851          refRange: [0, 360],
2852          type: "angle",
2853          name: "Hue"
2854        },
2855        s: {
2856          range: [0, 100],
2857          name: "Saturation"
2858        },
2859        l: {
2860          range: [0, 100],
2861          name: "Lightness"
2862        }
2863      },
2864      base: srgb_default,
2865      // Adapted from https://drafts.csswg.org/css-color-4/better-rgbToHsl.js
2866      fromBase: (rgb) => {
2867        let max = Math.max(...rgb);
2868        let min = Math.min(...rgb);
2869        let [r, g2, b2] = rgb;
2870        let [h, s, l] = [null, 0, (min + max) / 2];
2871        let d2 = max - min;
2872        if (d2 !== 0) {
2873          s = l === 0 || l === 1 ? 0 : (max - l) / Math.min(l, 1 - l);
2874          switch (max) {
2875            case r:
2876              h = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
2877              break;
2878            case g2:
2879              h = (b2 - r) / d2 + 2;
2880              break;
2881            case b2:
2882              h = (r - g2) / d2 + 4;
2883          }
2884          h = h * 60;
2885        }
2886        if (s < 0) {
2887          h += 180;
2888          s = Math.abs(s);
2889        }
2890        if (h >= 360) {
2891          h -= 360;
2892        }
2893        return [h, s * 100, l * 100];
2894      },
2895      // Adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative
2896      toBase: (hsl) => {
2897        let [h, s, l] = hsl;
2898        h = h % 360;
2899        if (h < 0) {
2900          h += 360;
2901        }
2902        s /= 100;
2903        l /= 100;
2904        function f(n2) {
2905          let k = (n2 + h / 30) % 12;
2906          let a = s * Math.min(l, 1 - l);
2907          return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));
2908        }
2909        return [f(0), f(8), f(4)];
2910      },
2911      formats: {
2912        hsl: {
2913          coords: ["<number> | <angle>", "<percentage> | <number>", "<percentage> | <number>"]
2914        },
2915        hsla: {
2916          coords: ["<number> | <angle>", "<percentage> | <number>", "<percentage> | <number>"],
2917          commas: true,
2918          alpha: true
2919        }
2920      }
2921    });
2922  
2923    // packages/theme/node_modules/colorjs.io/src/spaces/oklch.js
2924    var oklch_default = new ColorSpace({
2925      id: "oklch",
2926      name: "OkLCh",
2927      coords: {
2928        l: {
2929          refRange: [0, 1],
2930          name: "Lightness"
2931        },
2932        c: {
2933          refRange: [0, 0.4],
2934          name: "Chroma"
2935        },
2936        h: {
2937          refRange: [0, 360],
2938          type: "angle",
2939          name: "Hue"
2940        }
2941      },
2942      white: "D65",
2943      base: oklab_default,
2944      fromBase: lch_default.fromBase,
2945      toBase: lch_default.toBase,
2946      formats: {
2947        oklch: {
2948          coords: ["<percentage> | <number>", "<number> | <percentage>", "<number> | <angle>"]
2949        }
2950      }
2951    });
2952  
2953    // node_modules/memize/dist/index.js
2954    function memize(fn, options) {
2955      var size = 0;
2956      var head;
2957      var tail;
2958      options = options || {};
2959      function memoized() {
2960        var node = head, len = arguments.length, args, i;
2961        searchCache: while (node) {
2962          if (node.args.length !== arguments.length) {
2963            node = node.next;
2964            continue;
2965          }
2966          for (i = 0; i < len; i++) {
2967            if (node.args[i] !== arguments[i]) {
2968              node = node.next;
2969              continue searchCache;
2970            }
2971          }
2972          if (node !== head) {
2973            if (node === tail) {
2974              tail = node.prev;
2975            }
2976            node.prev.next = node.next;
2977            if (node.next) {
2978              node.next.prev = node.prev;
2979            }
2980            node.next = head;
2981            node.prev = null;
2982            head.prev = node;
2983            head = node;
2984          }
2985          return node.val;
2986        }
2987        args = new Array(len);
2988        for (i = 0; i < len; i++) {
2989          args[i] = arguments[i];
2990        }
2991        node = {
2992          args,
2993          // Generate the result from original function
2994          val: fn.apply(null, args)
2995        };
2996        if (head) {
2997          head.prev = node;
2998          node.next = head;
2999        } else {
3000          tail = node;
3001        }
3002        if (size === /** @type {MemizeOptions} */
3003        options.maxSize) {
3004          tail = /** @type {MemizeCacheNode} */
3005          tail.prev;
3006          tail.next = null;
3007        } else {
3008          size++;
3009        }
3010        head = node;
3011        return node.val;
3012      }
3013      memoized.clear = function() {
3014        head = null;
3015        tail = null;
3016        size = 0;
3017      };
3018      return memoized;
3019    }
3020  
3021    // packages/theme/build-module/use-theme-provider-styles.mjs
3022    var import_element2 = __toESM(require_element(), 1);
3023  
3024    // packages/theme/build-module/prebuilt/ts/color-tokens.mjs
3025    var color_tokens_default = {
3026      transparent: [
3027        "background-interactive-brand-weak",
3028        "background-interactive-brand-weak-disabled",
3029        "background-interactive-error",
3030        "background-interactive-error-disabled",
3031        "background-interactive-error-weak",
3032        "background-interactive-error-weak-disabled",
3033        "background-interactive-neutral-weak",
3034        "background-interactive-neutral-weak-disabled"
3035      ],
3036      "primary-bgFill1": ["background-interactive-brand-strong"],
3037      "primary-fgFill": [
3038        "foreground-interactive-brand-strong",
3039        "foreground-interactive-brand-strong-active"
3040      ],
3041      "primary-bgFill2": ["background-interactive-brand-strong-active"],
3042      "primary-surface4": ["background-interactive-brand-weak-active"],
3043      "primary-fgSurface4": ["foreground-interactive-brand-active"],
3044      "primary-fgSurface3": ["foreground-interactive-brand"],
3045      "primary-stroke3": [
3046        "background-thumb-brand",
3047        "background-thumb-brand-active",
3048        "stroke-focus",
3049        "stroke-interactive-brand",
3050        "stroke-surface-brand-strong"
3051      ],
3052      "primary-stroke4": ["stroke-interactive-brand-active"],
3053      "primary-stroke1": ["stroke-surface-brand"],
3054      "primary-surface1": ["background-surface-brand"],
3055      "info-surface2": ["background-surface-info-weak"],
3056      "info-surface4": ["background-surface-info"],
3057      "info-fgSurface4": ["foreground-content-info"],
3058      "info-fgSurface3": ["foreground-content-info-weak"],
3059      "info-stroke3": ["stroke-surface-info-strong"],
3060      "info-stroke1": ["stroke-surface-info"],
3061      "success-surface2": ["background-surface-success-weak"],
3062      "success-surface4": ["background-surface-success"],
3063      "success-fgSurface4": ["foreground-content-success"],
3064      "success-fgSurface3": ["foreground-content-success-weak"],
3065      "success-stroke3": ["stroke-surface-success-strong"],
3066      "success-stroke1": ["stroke-surface-success"],
3067      "warning-surface2": ["background-surface-warning-weak"],
3068      "warning-surface4": ["background-surface-warning"],
3069      "warning-fgSurface4": ["foreground-content-warning"],
3070      "warning-fgSurface3": ["foreground-content-warning-weak"],
3071      "warning-stroke3": ["stroke-surface-warning-strong"],
3072      "warning-stroke1": ["stroke-surface-warning"],
3073      "error-bgFill1": ["background-interactive-error-strong"],
3074      "error-fgFill": [
3075        "foreground-interactive-error-strong",
3076        "foreground-interactive-error-strong-active"
3077      ],
3078      "error-bgFill2": ["background-interactive-error-strong-active"],
3079      "error-surface2": [
3080        "background-interactive-error-active",
3081        "background-surface-error-weak"
3082      ],
3083      "error-surface4": [
3084        "background-interactive-error-weak-active",
3085        "background-surface-error"
3086      ],
3087      "error-fgSurface4": [
3088        "foreground-content-error",
3089        "foreground-interactive-error-active"
3090      ],
3091      "error-fgSurface3": [
3092        "foreground-content-error-weak",
3093        "foreground-interactive-error"
3094      ],
3095      "error-stroke3": [
3096        "stroke-interactive-error",
3097        "stroke-interactive-error-strong",
3098        "stroke-surface-error-strong"
3099      ],
3100      "error-stroke4": ["stroke-interactive-error-active"],
3101      "error-stroke1": ["stroke-surface-error"],
3102      "bg-surface2": ["background-surface-neutral"],
3103      "bg-surface5": [
3104        "background-interactive-brand-strong-disabled",
3105        "background-interactive-error-strong-disabled",
3106        "background-interactive-neutral-strong-disabled"
3107      ],
3108      "bg-surface4": ["background-interactive-neutral-weak-active"],
3109      "bg-surface3": ["background-surface-neutral-strong"],
3110      "bg-fgSurface4": [
3111        "foreground-content-neutral",
3112        "foreground-interactive-neutral",
3113        "foreground-interactive-neutral-active",
3114        "foreground-interactive-neutral-weak-active"
3115      ],
3116      "bg-fgSurface3": [
3117        "foreground-content-neutral-weak",
3118        "foreground-interactive-neutral-weak"
3119      ],
3120      "bg-fgSurface2": [
3121        "foreground-interactive-brand-disabled",
3122        "foreground-interactive-brand-strong-disabled",
3123        "foreground-interactive-error-disabled",
3124        "foreground-interactive-error-strong-disabled",
3125        "foreground-interactive-neutral-disabled",
3126        "foreground-interactive-neutral-strong-disabled",
3127        "foreground-interactive-neutral-weak-disabled"
3128      ],
3129      "bg-stroke3": [
3130        "background-thumb-neutral-weak",
3131        "stroke-interactive-neutral",
3132        "stroke-surface-neutral-strong"
3133      ],
3134      "bg-stroke4": [
3135        "background-thumb-neutral-weak-active",
3136        "stroke-interactive-neutral-active",
3137        "stroke-interactive-neutral-strong"
3138      ],
3139      "bg-stroke2": [
3140        "background-thumb-brand-disabled",
3141        "background-thumb-neutral-weak-disabled",
3142        "background-track-neutral",
3143        "stroke-interactive-brand-disabled",
3144        "stroke-interactive-error-disabled",
3145        "stroke-interactive-neutral-disabled",
3146        "stroke-surface-neutral"
3147      ],
3148      "bg-stroke1": [
3149        "background-track-neutral-weak",
3150        "stroke-surface-neutral-weak"
3151      ],
3152      "bg-bgFillInverted2": ["background-interactive-neutral-strong-active"],
3153      "bg-bgFillInverted1": ["background-interactive-neutral-strong"],
3154      "bg-fgFillInverted": [
3155        "foreground-interactive-neutral-strong",
3156        "foreground-interactive-neutral-strong-active"
3157      ],
3158      "bg-surface1": ["background-surface-neutral-weak"],
3159      "caution-surface2": ["background-surface-caution-weak"],
3160      "caution-surface4": ["background-surface-caution"],
3161      "caution-fgSurface4": ["foreground-content-caution"],
3162      "caution-fgSurface3": ["foreground-content-caution-weak"],
3163      "caution-stroke3": ["stroke-surface-caution-strong"],
3164      "caution-stroke1": ["stroke-surface-caution"]
3165    };
3166  
3167    // packages/theme/build-module/color-ramps/lib/color-utils.mjs
3168    var ALLOWED_SEED_COLOR_SPACES = [srgb_default];
3169    function getColorString(color) {
3170      ColorSpace.register(srgb_default);
3171      const rgbRounded = serialize(to(color, srgb_default));
3172      return serialize(rgbRounded, { format: "hex" });
3173    }
3174    function getContrast(colorA, colorB) {
3175      ColorSpace.register(srgb_default);
3176      return contrastWCAG21(colorA, colorB);
3177    }
3178    function assertValidSeedColor(seed) {
3179      ALLOWED_SEED_COLOR_SPACES.forEach(
3180        (space) => ColorSpace.register(space)
3181      );
3182      let parsedColor;
3183      try {
3184        parsedColor = parse(seed);
3185      } catch {
3186        throw new Error(
3187          `Unsupported seed color "$seed}": expected a fully opaque hex value, an \`rgb()\`/\`rgba()\` string, or a CSS named color.`
3188        );
3189      }
3190      const { alpha = 1, spaceId } = parsedColor;
3191      if (!ALLOWED_SEED_COLOR_SPACES.some((space) => space.id === spaceId)) {
3192        throw new Error(
3193          `Unsupported seed color "$seed}": expected a fully opaque hex value, an \`rgb()\`/\`rgba()\` string, or a CSS named color, but received a \`$spaceId}\` color.`
3194        );
3195      }
3196      if (alpha !== 1) {
3197        throw new Error(
3198          `Unsupported seed color "$seed}": expected a fully opaque color.`
3199        );
3200      }
3201    }
3202    function clampToGamut(c) {
3203      ColorSpace.register(srgb_default);
3204      ColorSpace.register(oklch_default);
3205      return to(toGamut(c, { space: srgb_default, method: "css" }), oklch_default);
3206    }
3207  
3208    // packages/theme/build-module/color-ramps/lib/constants.mjs
3209    var WHITE = {
3210      space: oklch_default,
3211      coords: [1, 0, 0],
3212      alpha: 1
3213    };
3214    var BLACK = {
3215      space: oklch_default,
3216      coords: [0, 0, 0],
3217      alpha: 1
3218    };
3219    var UNIVERSAL_CONTRAST_TOPUP = 0.02;
3220    var WHITE_TEXT_CONTRAST_MARGIN = 3.1;
3221    var ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS = {
3222      lighter: { min: 0.2, max: 0.4 },
3223      darker: { min: 0.75, max: 0.98 }
3224    };
3225    var CONTRAST_EPSILON = 4e-3;
3226    var MAX_BISECTION_ITERATIONS = 10;
3227    var DEFAULT_SEED_COLORS = {
3228      background: "#fcfcfc",
3229      primary: "#3858e9",
3230      info: "#0090ff",
3231      success: "#4ab866",
3232      caution: "#f0d149",
3233      warning: "#f0b849",
3234      error: "#cc1818"
3235    };
3236  
3237    // packages/theme/build-module/color-ramps/lib/utils.mjs
3238    function buildDependencyGraph(config) {
3239      const dependencies = /* @__PURE__ */ new Map();
3240      const dependents = /* @__PURE__ */ new Map();
3241      Object.keys(config).forEach((step) => {
3242        dependencies.set(step, []);
3243      });
3244      dependents.set("seed", []);
3245      Object.keys(config).forEach((step) => {
3246        dependents.set(step, []);
3247      });
3248      Object.entries(config).forEach(([stepName, stepConfig]) => {
3249        const step = stepName;
3250        const reference = stepConfig.contrast.reference;
3251        dependencies.get(step).push(reference);
3252        dependents.get(reference).push(step);
3253        if (stepConfig.sameAsIfPossible) {
3254          dependencies.get(step).push(stepConfig.sameAsIfPossible);
3255          dependents.get(stepConfig.sameAsIfPossible).push(step);
3256        }
3257      });
3258      return { dependencies, dependents };
3259    }
3260    function sortByDependency(config) {
3261      const { dependents } = buildDependencyGraph(config);
3262      const result = [];
3263      const visited = /* @__PURE__ */ new Set();
3264      const visiting = /* @__PURE__ */ new Set();
3265      function visit(node) {
3266        if (visiting.has(node)) {
3267          throw new Error(
3268            `Circular dependency detected involving step: $String(
3269              node
3270            )}`
3271          );
3272        }
3273        if (visited.has(node)) {
3274          return;
3275        }
3276        visiting.add(node);
3277        const nodeDependents = dependents.get(node) || [];
3278        nodeDependents.forEach((dependent) => {
3279          visit(dependent);
3280        });
3281        visiting.delete(node);
3282        visited.add(node);
3283        if (node !== "seed") {
3284          result.unshift(node);
3285        }
3286      }
3287      visit("seed");
3288      return result;
3289    }
3290    function stepsForStep(stepName, config) {
3291      const result = /* @__PURE__ */ new Set();
3292      function visit(step) {
3293        if (step === "seed" || result.has(step)) {
3294          return;
3295        }
3296        const stepConfig = config[step];
3297        if (!stepConfig) {
3298          return;
3299        }
3300        visit(stepConfig.contrast.reference);
3301        if (stepConfig.sameAsIfPossible) {
3302          visit(stepConfig.sameAsIfPossible);
3303        }
3304        result.add(step);
3305      }
3306      visit(stepName);
3307      return Array.from(result);
3308    }
3309    function computeBetterFgColorDirection(seed, preferLighter) {
3310      const contrastAgainstBlack = getContrast(seed, BLACK);
3311      const contrastAgainstWhite = getContrast(seed, WHITE);
3312      return contrastAgainstBlack > contrastAgainstWhite + (preferLighter ? WHITE_TEXT_CONTRAST_MARGIN : 0) ? { better: "darker", worse: "lighter" } : { better: "lighter", worse: "darker" };
3313    }
3314    function adjustContrastTarget(target) {
3315      if (target === 1) {
3316        return 1;
3317      }
3318      return target + UNIVERSAL_CONTRAST_TOPUP;
3319    }
3320    function clampAccentScaleReferenceLightness(rawLightness, direction) {
3321      const thresholds = ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS[direction];
3322      return Math.max(thresholds.min, Math.min(thresholds.max, rawLightness));
3323    }
3324    function solveWithBisect(calculateC, calculateValue, initLowerL, initLowerValue, initUpperL, initUpperValue) {
3325      let lowerL = initLowerL;
3326      let lowerValue = initLowerValue;
3327      let lowerReplaced = false;
3328      let upperL = initUpperL;
3329      let upperValue = initUpperValue;
3330      let upperReplaced = false;
3331      let bestC;
3332      let bestValue;
3333      let iterations = 0;
3334      while (true) {
3335        iterations++;
3336        const newL = (lowerL * upperValue - upperL * lowerValue) / (upperValue - lowerValue);
3337        bestC = calculateC(newL);
3338        bestValue = calculateValue(bestC);
3339        if (Math.abs(bestValue) <= CONTRAST_EPSILON || iterations >= MAX_BISECTION_ITERATIONS) {
3340          break;
3341        }
3342        if (bestValue <= 0) {
3343          lowerL = newL;
3344          lowerValue = bestValue;
3345          if (lowerReplaced) {
3346            upperValue /= 2;
3347          }
3348          lowerReplaced = true;
3349          upperReplaced = false;
3350        } else {
3351          upperL = newL;
3352          upperValue = bestValue;
3353          if (upperReplaced) {
3354            lowerValue /= 2;
3355          }
3356          upperReplaced = true;
3357          lowerReplaced = false;
3358        }
3359      }
3360      return bestC;
3361    }
3362  
3363    // packages/theme/build-module/color-ramps/lib/taper-chroma.mjs
3364    function taperChroma(seed, lTarget, options = {}) {
3365      ColorSpace.register(oklch_default);
3366      const gamut = options.gamut ?? srgb_default;
3367      const alpha = options.alpha ?? 0.65;
3368      const carry = options.carry ?? 0.5;
3369      const cUpperBound = options.cUpperBound ?? 0.45;
3370      const radiusLight = options.radiusLight ?? 0.2;
3371      const radiusDark = options.radiusDark ?? 0.2;
3372      const kLight = options.kLight ?? 0.85;
3373      const kDark = options.kDark ?? 0.85;
3374      const achromaEpsilon = options.achromaEpsilon ?? 5e-3;
3375      const cSeed = Math.max(0, get(seed, [oklch_default, "c"]));
3376      let hSeed = get(seed, [oklch_default, "h"]);
3377      const chromaIsTiny = cSeed < achromaEpsilon;
3378      const hueIsInvalid = hSeed === null || !Number.isFinite(hSeed);
3379      if (chromaIsTiny || hueIsInvalid) {
3380        if (typeof options.hueFallback === "number") {
3381          hSeed = normalizeHue(options.hueFallback);
3382        } else {
3383          return {
3384            space: oklch_default,
3385            coords: [clamp01(lTarget), 0, 0],
3386            alpha: 1
3387          };
3388        }
3389      }
3390      const lSeed = clamp01(get(seed, [oklch_default, "l"]));
3391      const cmaxSeed = getCachedMaxChromaAtLH(lSeed, hSeed, gamut, cUpperBound);
3392      const cmaxTarget = getCachedMaxChromaAtLH(
3393        clamp01(lTarget),
3394        hSeed,
3395        gamut,
3396        cUpperBound
3397      );
3398      let seedRelative = 0;
3399      const denom = cmaxSeed > 0 ? cmaxSeed : 1e-6;
3400      seedRelative = clamp01(cSeed / denom);
3401      const cIntendedBase = alpha * cmaxTarget;
3402      const cWithCarry = cIntendedBase * Math.pow(seedRelative, clamp01(carry));
3403      const t = continuousTaper(lSeed, lTarget, {
3404        radiusLight,
3405        radiusDark,
3406        kLight,
3407        kDark
3408      });
3409      const cPlanned = cWithCarry * t;
3410      const lOut = clamp01(lTarget);
3411      return { l: lOut, c: cPlanned };
3412    }
3413    function clamp01(x) {
3414      if (x < 0) {
3415        return 0;
3416      }
3417      if (x > 1) {
3418        return 1;
3419      }
3420      return x;
3421    }
3422    function normalizeHue(h) {
3423      let hue = h % 360;
3424      if (hue < 0) {
3425        hue += 360;
3426      }
3427      return hue;
3428    }
3429    function raisedCosine(u) {
3430      const x = clamp01(u);
3431      return 0.5 - 0.5 * Math.cos(Math.PI * x);
3432    }
3433    function continuousTaper(seedL, targetL, opts) {
3434      const d2 = targetL - seedL;
3435      if (d2 >= 0) {
3436        const u2 = opts.radiusLight > 0 ? Math.abs(d2) / opts.radiusLight : 1;
3437        const w2 = raisedCosine(u2 > 1 ? 1 : u2);
3438        return 1 - (1 - opts.kLight) * w2;
3439      }
3440      const u = opts.radiusDark > 0 ? Math.abs(d2) / opts.radiusDark : 1;
3441      const w = raisedCosine(u > 1 ? 1 : u);
3442      return 1 - (1 - opts.kDark) * w;
3443    }
3444    var maxChromaCache = /* @__PURE__ */ new Map();
3445    function keyMax(l, h, gamut, cap) {
3446      const lq = quantize(l, 0.05);
3447      const hq = quantize(normalizeHue(h), 10);
3448      const cq = quantize(cap, 0.05);
3449      return `$gamut}|L:$lq}|H:$hq}|cap:$cq}`;
3450    }
3451    function quantize(x, step) {
3452      const k = Math.round(x / step);
3453      return k * step;
3454    }
3455    function getCachedMaxChromaAtLH(l, h, gamutSpace, cap) {
3456      const gamut = gamutSpace.id;
3457      const key = keyMax(l, h, gamut, cap);
3458      const hit = maxChromaCache.get(key);
3459      if (typeof hit === "number") {
3460        return hit;
3461      }
3462      const computed = maxInGamutChromaAtLH(l, h, gamutSpace, cap);
3463      maxChromaCache.set(key, computed);
3464      return computed;
3465    }
3466    function maxInGamutChromaAtLH(l, h, gamutSpace, cap) {
3467      const probe = {
3468        space: oklch_default,
3469        coords: [l, cap, h],
3470        alpha: 1
3471      };
3472      const clamped = toGamut(probe, { space: gamutSpace, method: "css" });
3473      return get(clamped, [oklch_default, "c"]);
3474    }
3475  
3476    // packages/theme/build-module/color-ramps/lib/find-color-with-constraints.mjs
3477    function cdiff(c13, c23) {
3478      return Math.log(c13 / c23);
3479    }
3480    function findColorMeetingRequirements(reference, seed, target, direction, {
3481      lightnessConstraint,
3482      taperChromaOptions
3483    } = {}) {
3484      if (target <= 1) {
3485        return {
3486          color: reference,
3487          reached: true,
3488          achieved: 1
3489        };
3490      }
3491      function getColorForL(l) {
3492        let newL = l;
3493        let newC = get(seed, [oklch_default, "c"]);
3494        if (taperChromaOptions) {
3495          const tapered = taperChroma(seed, newL, taperChromaOptions);
3496          if ("l" in tapered && "c" in tapered) {
3497            newL = tapered.l;
3498            newC = tapered.c;
3499          } else {
3500            return tapered;
3501          }
3502        }
3503        return clampToGamut({
3504          space: oklch_default,
3505          coords: [newL, newC, get(seed, [oklch_default, "h"])],
3506          alpha: seed.alpha
3507        });
3508      }
3509      const mostContrastingL = direction === "lighter" ? 1 : 0;
3510      const mostContrastingColor = direction === "lighter" ? WHITE : BLACK;
3511      const highestContrast = getContrast(reference, mostContrastingColor);
3512      if (lightnessConstraint) {
3513        const colorWithExactL = getColorForL(lightnessConstraint.value);
3514        const exactLContrast = getContrast(reference, colorWithExactL);
3515        const exactLContrastMeetsTarget = cdiff(exactLContrast, target) >= -CONTRAST_EPSILON;
3516        if (exactLContrastMeetsTarget || lightnessConstraint.type === "force") {
3517          return {
3518            color: colorWithExactL,
3519            reached: exactLContrastMeetsTarget,
3520            achieved: exactLContrast,
3521            deficit: exactLContrastMeetsTarget ? cdiff(exactLContrast, highestContrast) : cdiff(target, exactLContrast)
3522          };
3523        }
3524      }
3525      if (cdiff(highestContrast, target) <= CONTRAST_EPSILON) {
3526        return {
3527          color: mostContrastingColor,
3528          reached: cdiff(highestContrast, target) >= -CONTRAST_EPSILON,
3529          achieved: highestContrast,
3530          deficit: cdiff(target, highestContrast)
3531        };
3532      }
3533      const lowerL = get(reference, [oklch_default, "l"]);
3534      const lowerContrast = cdiff(1, target);
3535      const upperL = mostContrastingL;
3536      const upperContrast = cdiff(highestContrast, target);
3537      const bestColor = solveWithBisect(
3538        getColorForL,
3539        (c) => cdiff(getContrast(reference, c), target),
3540        lowerL,
3541        lowerContrast,
3542        upperL,
3543        upperContrast
3544      );
3545      return {
3546        color: bestColor,
3547        reached: true,
3548        achieved: target,
3549        // Negative number that specifies how much room we have.
3550        deficit: cdiff(target, highestContrast)
3551      };
3552    }
3553  
3554    // packages/theme/build-module/color-ramps/lib/index.mjs
3555    function calculateRamp({
3556      seed,
3557      sortedSteps,
3558      config,
3559      mainDir,
3560      oppDir,
3561      pinLightness
3562    }) {
3563      const rampResults = {};
3564      let warnings;
3565      let maxDeficit = -Infinity;
3566      let maxDeficitDirection = "lighter";
3567      let maxDeficitStep;
3568      const calculatedColors = /* @__PURE__ */ new Map();
3569      calculatedColors.set("seed", seed);
3570      for (const stepName of sortedSteps) {
3571        let computeDirection = function(color, followDirection) {
3572          if (followDirection === "main") {
3573            return mainDir;
3574          }
3575          if (followDirection === "opposite") {
3576            return oppDir;
3577          }
3578          if (followDirection === "best") {
3579            return computeBetterFgColorDirection(
3580              color,
3581              contrast.preferLighter
3582            ).better;
3583          }
3584          return followDirection;
3585        };
3586        const {
3587          contrast,
3588          lightness: stepLightnessConstraint,
3589          taperChromaOptions,
3590          sameAsIfPossible
3591        } = config[stepName];
3592        const referenceColor = calculatedColors.get(contrast.reference);
3593        if (!referenceColor) {
3594          throw new Error(
3595            `Reference color for step $stepName} not found: $contrast.reference}`
3596          );
3597        }
3598        if (sameAsIfPossible) {
3599          const candidateColor = calculatedColors.get(sameAsIfPossible);
3600          if (!candidateColor) {
3601            throw new Error(
3602              `Same-as color for step $stepName} not found: $sameAsIfPossible}`
3603            );
3604          }
3605          const candidateContrast = getContrast(
3606            referenceColor,
3607            candidateColor
3608          );
3609          const adjustedTarget2 = adjustContrastTarget(contrast.target);
3610          if (candidateContrast >= adjustedTarget2) {
3611            calculatedColors.set(stepName, candidateColor);
3612            rampResults[stepName] = getColorString(candidateColor);
3613            continue;
3614          }
3615        }
3616        const computedDir = computeDirection(
3617          referenceColor,
3618          contrast.followDirection
3619        );
3620        const adjustedTarget = adjustContrastTarget(contrast.target);
3621        let lightnessConstraint;
3622        if (pinLightness?.stepName === stepName) {
3623          lightnessConstraint = {
3624            value: pinLightness.value,
3625            type: "force"
3626          };
3627        } else if (stepLightnessConstraint) {
3628          lightnessConstraint = {
3629            value: stepLightnessConstraint(computedDir),
3630            type: "onlyIfSucceeds"
3631          };
3632        }
3633        const searchResults = findColorMeetingRequirements(
3634          referenceColor,
3635          seed,
3636          adjustedTarget,
3637          computedDir,
3638          {
3639            lightnessConstraint,
3640            taperChromaOptions
3641          }
3642        );
3643        if (!contrast.ignoreWhenAdjustingSeed && searchResults.deficit && searchResults.deficit > maxDeficit) {
3644          maxDeficit = searchResults.deficit;
3645          maxDeficitDirection = computedDir;
3646          maxDeficitStep = stepName;
3647        }
3648        calculatedColors.set(stepName, searchResults.color);
3649        rampResults[stepName] = getColorString(searchResults.color);
3650        if (!searchResults.reached && !contrast.ignoreWhenAdjustingSeed) {
3651          warnings ??= [];
3652          warnings.push(stepName);
3653        }
3654      }
3655      return {
3656        rampResults,
3657        warnings,
3658        maxDeficit,
3659        maxDeficitDirection,
3660        maxDeficitStep
3661      };
3662    }
3663    function buildRamp(seedArg, config, {
3664      mainDirection,
3665      pinLightness,
3666      rescaleToFitContrastTargets = true
3667    } = {}) {
3668      assertValidSeedColor(seedArg);
3669      let seed;
3670      try {
3671        seed = clampToGamut(seedArg);
3672      } catch (error) {
3673        throw new Error(
3674          `Invalid seed color "$seedArg}": $error instanceof Error ? error.message : "Unknown error"}`
3675        );
3676      }
3677      let mainDir = "lighter";
3678      let oppDir = "darker";
3679      if (mainDirection) {
3680        mainDir = mainDirection;
3681        oppDir = mainDirection === "darker" ? "lighter" : "darker";
3682      } else {
3683        const { better, worse } = computeBetterFgColorDirection(seed);
3684        mainDir = better;
3685        oppDir = worse;
3686      }
3687      const sortedSteps = sortByDependency(config);
3688      const {
3689        rampResults,
3690        warnings,
3691        maxDeficit,
3692        maxDeficitDirection,
3693        maxDeficitStep
3694      } = calculateRamp({
3695        seed,
3696        sortedSteps,
3697        config,
3698        mainDir,
3699        oppDir,
3700        pinLightness
3701      });
3702      let bestRamp = rampResults;
3703      if (maxDeficit > CONTRAST_EPSILON && rescaleToFitContrastTargets) {
3704        let getSeedForL = function(l) {
3705          return clampToGamut(set(clone(seed), [oklch_default, "l"], l));
3706        }, getDeficitForSeed = function(s) {
3707          const iterationResults = calculateRamp({
3708            seed: s,
3709            sortedSteps: iterSteps,
3710            config,
3711            mainDir,
3712            oppDir,
3713            pinLightness
3714          });
3715          return iterationResults.maxDeficitDirection === maxDeficitDirection ? iterationResults.maxDeficit : -maxDeficit;
3716        };
3717        const iterSteps = stepsForStep(maxDeficitStep, config);
3718        const lowerSeedL = maxDeficitDirection === "lighter" ? 0 : 1;
3719        const lowerDeficit = -maxDeficit;
3720        const upperSeedL = get(seed, [oklch_default, "l"]);
3721        const upperDeficit = maxDeficit;
3722        const bestSeed = solveWithBisect(
3723          getSeedForL,
3724          getDeficitForSeed,
3725          lowerSeedL,
3726          lowerDeficit,
3727          upperSeedL,
3728          upperDeficit
3729        );
3730        bestRamp = calculateRamp({
3731          seed: bestSeed,
3732          sortedSteps,
3733          config,
3734          mainDir,
3735          oppDir,
3736          pinLightness
3737        }).rampResults;
3738      }
3739      if (mainDir === "darker") {
3740        const tmpSurface1 = bestRamp.surface1;
3741        bestRamp.surface1 = bestRamp.surface3;
3742        bestRamp.surface3 = tmpSurface1;
3743      }
3744      return {
3745        ramp: bestRamp,
3746        warnings,
3747        direction: mainDir
3748      };
3749    }
3750  
3751    // packages/theme/build-module/color-ramps/lib/ramp-configs.mjs
3752    var lightnessConstraintForegroundHighContrast = (direction) => direction === "lighter" ? 0.9551 : 0.235;
3753    var lightnessConstraintForegroundMediumContrast = (direction) => direction === "lighter" ? 0.77 : 0.56;
3754    var lightnessConstraintBgFill = (direction) => direction === "lighter" ? 0.67 : 0.45;
3755    var BG_SURFACE_TAPER_CHROMA = {
3756      alpha: 0.7
3757    };
3758    var FG_TAPER_CHROMA = {
3759      alpha: 0.6,
3760      kLight: 0.2,
3761      kDark: 0.2
3762    };
3763    var STROKE_TAPER_CHROMA = {
3764      alpha: 0.6,
3765      radiusDark: 0.01,
3766      radiusLight: 0.01,
3767      kLight: 0.8,
3768      kDark: 0.8
3769    };
3770    var ACCENT_SURFACE_TAPER_CHROMA = {
3771      alpha: 0.75,
3772      radiusDark: 0.01,
3773      radiusLight: 0.01
3774    };
3775    var fgSurface4Config = {
3776      contrast: {
3777        reference: "surface3",
3778        followDirection: "main",
3779        target: 7,
3780        preferLighter: true
3781      },
3782      lightness: lightnessConstraintForegroundHighContrast,
3783      taperChromaOptions: FG_TAPER_CHROMA
3784    };
3785    var BG_RAMP_CONFIG = {
3786      // Surface
3787      surface1: {
3788        contrast: {
3789          reference: "surface2",
3790          followDirection: "opposite",
3791          target: 1.06,
3792          ignoreWhenAdjustingSeed: true
3793        },
3794        taperChromaOptions: BG_SURFACE_TAPER_CHROMA
3795      },
3796      surface2: {
3797        contrast: {
3798          reference: "seed",
3799          followDirection: "main",
3800          target: 1
3801        }
3802      },
3803      surface3: {
3804        contrast: {
3805          reference: "surface2",
3806          followDirection: "main",
3807          target: 1.06
3808        },
3809        taperChromaOptions: BG_SURFACE_TAPER_CHROMA
3810      },
3811      surface4: {
3812        contrast: {
3813          reference: "surface2",
3814          followDirection: "main",
3815          target: 1.12
3816        },
3817        taperChromaOptions: BG_SURFACE_TAPER_CHROMA
3818      },
3819      surface5: {
3820        contrast: {
3821          reference: "surface2",
3822          followDirection: "main",
3823          target: 1.2
3824        },
3825        taperChromaOptions: BG_SURFACE_TAPER_CHROMA
3826      },
3827      surface6: {
3828        contrast: {
3829          reference: "surface2",
3830          followDirection: "main",
3831          target: 1.4
3832        },
3833        taperChromaOptions: BG_SURFACE_TAPER_CHROMA
3834      },
3835      // Bg fill
3836      bgFill1: {
3837        contrast: {
3838          reference: "surface2",
3839          followDirection: "main",
3840          target: 4
3841        },
3842        lightness: lightnessConstraintBgFill
3843      },
3844      bgFill2: {
3845        contrast: {
3846          reference: "bgFill1",
3847          followDirection: "main",
3848          target: 1.2
3849        }
3850      },
3851      bgFillInverted1: {
3852        contrast: {
3853          reference: "bgFillInverted2",
3854          followDirection: "opposite",
3855          target: 1.2
3856        }
3857      },
3858      bgFillInverted2: fgSurface4Config,
3859      bgFillDark: {
3860        contrast: {
3861          reference: "surface3",
3862          followDirection: "darker",
3863          // This is what causes the token to be always dark
3864          target: 7,
3865          ignoreWhenAdjustingSeed: true
3866        },
3867        lightness: lightnessConstraintForegroundHighContrast,
3868        taperChromaOptions: FG_TAPER_CHROMA
3869      },
3870      // Stroke
3871      stroke1: {
3872        contrast: {
3873          reference: "stroke3",
3874          followDirection: "opposite",
3875          target: 2.9
3876        },
3877        taperChromaOptions: STROKE_TAPER_CHROMA
3878      },
3879      stroke2: {
3880        contrast: {
3881          reference: "stroke3",
3882          followDirection: "opposite",
3883          target: 2.4
3884        },
3885        taperChromaOptions: STROKE_TAPER_CHROMA
3886      },
3887      stroke3: {
3888        contrast: {
3889          reference: "surface3",
3890          followDirection: "main",
3891          target: 3
3892        },
3893        taperChromaOptions: STROKE_TAPER_CHROMA
3894      },
3895      stroke4: {
3896        contrast: {
3897          reference: "stroke3",
3898          followDirection: "main",
3899          target: 1.5
3900        },
3901        taperChromaOptions: STROKE_TAPER_CHROMA
3902      },
3903      // fgSurface
3904      fgSurface1: {
3905        contrast: {
3906          reference: "surface3",
3907          followDirection: "main",
3908          target: 2,
3909          preferLighter: true
3910        },
3911        taperChromaOptions: FG_TAPER_CHROMA
3912      },
3913      fgSurface2: {
3914        contrast: {
3915          reference: "surface3",
3916          followDirection: "main",
3917          target: 3,
3918          preferLighter: true
3919        },
3920        taperChromaOptions: FG_TAPER_CHROMA
3921      },
3922      fgSurface3: {
3923        contrast: {
3924          reference: "surface3",
3925          followDirection: "main",
3926          target: 4.5,
3927          preferLighter: true
3928        },
3929        lightness: lightnessConstraintForegroundMediumContrast,
3930        taperChromaOptions: FG_TAPER_CHROMA
3931      },
3932      fgSurface4: fgSurface4Config,
3933      // fgFill
3934      fgFill: {
3935        contrast: {
3936          reference: "bgFill1",
3937          followDirection: "best",
3938          target: 4.5,
3939          preferLighter: true
3940        },
3941        lightness: lightnessConstraintForegroundHighContrast,
3942        taperChromaOptions: FG_TAPER_CHROMA
3943      },
3944      fgFillInverted: {
3945        contrast: {
3946          reference: "bgFillInverted1",
3947          followDirection: "best",
3948          target: 4.5,
3949          preferLighter: true
3950        },
3951        lightness: lightnessConstraintForegroundHighContrast,
3952        taperChromaOptions: FG_TAPER_CHROMA
3953      },
3954      fgFillDark: {
3955        contrast: {
3956          reference: "bgFillDark",
3957          followDirection: "best",
3958          target: 4.5,
3959          preferLighter: true
3960        },
3961        lightness: lightnessConstraintForegroundHighContrast,
3962        taperChromaOptions: FG_TAPER_CHROMA
3963      }
3964    };
3965    var ACCENT_RAMP_CONFIG = {
3966      ...BG_RAMP_CONFIG,
3967      surface1: {
3968        ...BG_RAMP_CONFIG.surface1,
3969        taperChromaOptions: ACCENT_SURFACE_TAPER_CHROMA
3970      },
3971      surface2: {
3972        contrast: {
3973          reference: "bgFill1",
3974          followDirection: "opposite",
3975          target: BG_RAMP_CONFIG.bgFill1.contrast.target,
3976          ignoreWhenAdjustingSeed: true
3977        },
3978        taperChromaOptions: ACCENT_SURFACE_TAPER_CHROMA
3979      },
3980      surface3: {
3981        ...BG_RAMP_CONFIG.surface3,
3982        taperChromaOptions: ACCENT_SURFACE_TAPER_CHROMA
3983      },
3984      surface4: {
3985        ...BG_RAMP_CONFIG.surface4,
3986        taperChromaOptions: ACCENT_SURFACE_TAPER_CHROMA
3987      },
3988      surface5: {
3989        ...BG_RAMP_CONFIG.surface5,
3990        taperChromaOptions: ACCENT_SURFACE_TAPER_CHROMA
3991      },
3992      surface6: {
3993        ...BG_RAMP_CONFIG.surface6,
3994        taperChromaOptions: ACCENT_SURFACE_TAPER_CHROMA
3995      },
3996      bgFill1: {
3997        contrast: {
3998          reference: "seed",
3999          followDirection: "main",
4000          target: 1
4001        }
4002      },
4003      stroke1: {
4004        ...BG_RAMP_CONFIG.stroke1
4005      },
4006      stroke2: {
4007        ...BG_RAMP_CONFIG.stroke2
4008      },
4009      stroke3: {
4010        ...BG_RAMP_CONFIG.stroke3,
4011        sameAsIfPossible: "fgSurface3",
4012        taperChromaOptions: void 0
4013      },
4014      stroke4: {
4015        ...BG_RAMP_CONFIG.stroke4,
4016        taperChromaOptions: void 0
4017      },
4018      // fgSurface: do not de-saturate
4019      fgSurface1: {
4020        ...BG_RAMP_CONFIG.fgSurface1,
4021        taperChromaOptions: void 0
4022      },
4023      fgSurface2: {
4024        ...BG_RAMP_CONFIG.fgSurface2,
4025        taperChromaOptions: void 0
4026      },
4027      fgSurface3: {
4028        ...BG_RAMP_CONFIG.fgSurface3,
4029        taperChromaOptions: void 0,
4030        sameAsIfPossible: "bgFill1"
4031      },
4032      fgSurface4: {
4033        ...BG_RAMP_CONFIG.fgSurface4,
4034        taperChromaOptions: void 0
4035      }
4036    };
4037  
4038    // packages/theme/build-module/color-ramps/index.mjs
4039    function buildBgRamp(seed) {
4040      if (typeof seed !== "string" || seed.trim() === "") {
4041        throw new Error("Seed color must be a non-empty string");
4042      }
4043      return buildRamp(seed, BG_RAMP_CONFIG);
4044    }
4045    var STEP_TO_PIN = "surface2";
4046    function getBgRampInfo(ramp) {
4047      return {
4048        mainDirection: ramp.direction,
4049        pinLightness: {
4050          stepName: STEP_TO_PIN,
4051          value: clampAccentScaleReferenceLightness(
4052            get(ramp.ramp[STEP_TO_PIN], [oklch_default, "l"]),
4053            ramp.direction
4054          )
4055        }
4056      };
4057    }
4058    function buildAccentRamp(seed, bgRamp) {
4059      if (typeof seed !== "string" || seed.trim() === "") {
4060        throw new Error("Seed color must be a non-empty string");
4061      }
4062      const bgRampInfo = bgRamp ? getBgRampInfo(bgRamp) : void 0;
4063      return buildRamp(seed, ACCENT_RAMP_CONFIG, bgRampInfo);
4064    }
4065  
4066    // packages/theme/build-module/use-theme-provider-styles.mjs
4067    var getCachedBgRamp = memize(buildBgRamp, { maxSize: 10 });
4068    var getCachedAccentRamp = memize(buildAccentRamp, { maxSize: 10 });
4069    var legacyWpComponentsOverridesCSS = [
4070      ["--wp-components-color-accent", "var(--wp-admin-theme-color)"],
4071      [
4072        "--wp-components-color-accent-darker-10",
4073        "var(--wp-admin-theme-color-darker-10)"
4074      ],
4075      [
4076        "--wp-components-color-accent-darker-20",
4077        "var(--wp-admin-theme-color-darker-20)"
4078      ],
4079      [
4080        "--wp-components-color-accent-inverted",
4081        "var(--wpds-color-foreground-interactive-brand-strong, #fff)"
4082      ],
4083      [
4084        "--wp-components-color-background",
4085        "var(--wpds-color-background-surface-neutral-strong, #fff)"
4086      ],
4087      [
4088        "--wp-components-color-foreground",
4089        "var(--wpds-color-foreground-content-neutral, #1e1e1e)"
4090      ],
4091      [
4092        "--wp-components-color-foreground-inverted",
4093        "var(--wpds-color-background-surface-neutral, #fcfcfc)"
4094      ],
4095      [
4096        "--wp-components-color-gray-100",
4097        "var(--wpds-color-background-surface-neutral, #fcfcfc)"
4098      ],
4099      [
4100        "--wp-components-color-gray-200",
4101        "var(--wpds-color-stroke-surface-neutral, #dbdbdb)"
4102      ],
4103      [
4104        "--wp-components-color-gray-300",
4105        "var(--wpds-color-stroke-surface-neutral, #dbdbdb)"
4106      ],
4107      [
4108        "--wp-components-color-gray-400",
4109        "var(--wpds-color-stroke-interactive-neutral, #8d8d8d)"
4110      ],
4111      [
4112        "--wp-components-color-gray-600",
4113        "var(--wpds-color-stroke-interactive-neutral, #8d8d8d)"
4114      ],
4115      [
4116        "--wp-components-color-gray-700",
4117        "var(--wpds-color-foreground-content-neutral-weak, #707070)"
4118      ],
4119      [
4120        "--wp-components-color-gray-800",
4121        "var(--wpds-color-foreground-content-neutral, #1e1e1e)"
4122      ]
4123    ];
4124    function customRgbFormat(color) {
4125      const rgb = to(color, srgb_default);
4126      return rgb.coords.map((n2) => Math.round((n2 ?? 0) * 255)).join(", ");
4127    }
4128    function legacyWpAdminThemeOverridesCSS(accent) {
4129      ColorSpace.register(srgb_default);
4130      const parsedAccent = to(accent, hsl_default);
4131      const parsedL = parsedAccent.coords[2] ?? 0;
4132      const darker10 = set(
4133        clone(parsedAccent),
4134        [hsl_default, "l"],
4135        Math.max(0, parsedL - 5)
4136        // L reduced by 5%
4137      );
4138      const darker20 = set(
4139        clone(parsedAccent),
4140        [hsl_default, "l"],
4141        Math.max(0, parsedL - 10)
4142        // L reduced by 10%
4143      );
4144      return [
4145        ["--wp-admin-theme-color", getColorString(parsedAccent)],
4146        ["--wp-admin-theme-color--rgb", customRgbFormat(parsedAccent)],
4147        ["--wp-admin-theme-color-darker-10", getColorString(darker10)],
4148        [
4149          "--wp-admin-theme-color-darker-10--rgb",
4150          customRgbFormat(darker10)
4151        ],
4152        ["--wp-admin-theme-color-darker-20", getColorString(darker20)],
4153        [
4154          "--wp-admin-theme-color-darker-20--rgb",
4155          customRgbFormat(darker20)
4156        ]
4157      ];
4158    }
4159    function colorTokensCSS(computedColorRamps) {
4160      const entries = [];
4161      for (const [rampName, { ramp }] of computedColorRamps) {
4162        for (const [tokenName, tokenValue] of Object.entries(ramp)) {
4163          const key = `$rampName}-$tokenName}`;
4164          const aliasedBy = color_tokens_default[key] ?? [];
4165          for (const aliasedId of aliasedBy) {
4166            entries.push([`--wpds-color-$aliasedId}`, tokenValue]);
4167          }
4168        }
4169      }
4170      return entries;
4171    }
4172    function generateStyles({
4173      primary,
4174      computedColorRamps
4175    }) {
4176      return Object.fromEntries(
4177        [
4178          // Semantic color tokens
4179          colorTokensCSS(computedColorRamps),
4180          // Legacy overrides
4181          legacyWpAdminThemeOverridesCSS(primary),
4182          legacyWpComponentsOverridesCSS
4183        ].flat()
4184      );
4185    }
4186    function useThemeProviderStyles({
4187      color = {},
4188      cursor,
4189      cornerRadius
4190    } = {}) {
4191      const { resolvedSettings: inheritedSettings } = (0, import_element2.useContext)(ThemeContext);
4192      const hasColor = color.primary !== void 0 || color.background !== void 0 || inheritedSettings.color?.primary !== void 0 || inheritedSettings.color?.background !== void 0;
4193      const primary = hasColor ? color.primary ?? inheritedSettings.color?.primary ?? DEFAULT_SEED_COLORS.primary : void 0;
4194      const background = hasColor ? color.background ?? inheritedSettings.color?.background ?? DEFAULT_SEED_COLORS.background : void 0;
4195      const cursorControl = cursor?.control ?? inheritedSettings.cursor?.control;
4196      const cornerRadiusPreset = cornerRadius ?? inheritedSettings.cornerRadius ?? "subtle";
4197      const resolvedSettings = (0, import_element2.useMemo)(
4198        () => ({
4199          color: {
4200            primary,
4201            background
4202          },
4203          cursor: cursorControl ? { control: cursorControl } : void 0,
4204          cornerRadius: cornerRadiusPreset
4205        }),
4206        [primary, background, cursorControl, cornerRadiusPreset]
4207      );
4208      const colorStyles = (0, import_element2.useMemo)(() => {
4209        if (primary === void 0 || background === void 0) {
4210          return {};
4211        }
4212        const seeds = {
4213          ...DEFAULT_SEED_COLORS,
4214          background,
4215          primary
4216        };
4217        const computedColorRamps = /* @__PURE__ */ new Map();
4218        const bgRamp = getCachedBgRamp(seeds.background);
4219        Object.entries(seeds).forEach(([rampName, seed]) => {
4220          if (rampName === "background") {
4221            computedColorRamps.set("bg", bgRamp);
4222          } else {
4223            computedColorRamps.set(
4224              rampName,
4225              getCachedAccentRamp(seed, bgRamp)
4226            );
4227          }
4228        });
4229        return generateStyles({
4230          primary: seeds.primary,
4231          computedColorRamps
4232        });
4233      }, [primary, background]);
4234      const themeProviderStyles = (0, import_element2.useMemo)(
4235        () => ({
4236          ...colorStyles,
4237          ...cursorControl && {
4238            "--wpds-cursor-control": cursorControl
4239          }
4240        }),
4241        [colorStyles, cursorControl]
4242      );
4243      return {
4244        resolvedSettings,
4245        themeProviderStyles
4246      };
4247    }
4248  
4249    // packages/theme/build-module/theme-provider.mjs
4250    var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
4251    var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
4252    function getRuntime() {
4253      const globalScope = globalThis;
4254      if (globalScope.__wpStyleRuntime) {
4255        return globalScope.__wpStyleRuntime;
4256      }
4257      globalScope.__wpStyleRuntime = {
4258        documents: /* @__PURE__ */ new Map(),
4259        styles: /* @__PURE__ */ new Map(),
4260        injectedStyles: /* @__PURE__ */ new WeakMap()
4261      };
4262      if (typeof document !== "undefined") {
4263        registerDocument(document);
4264      }
4265      return globalScope.__wpStyleRuntime;
4266    }
4267    function documentContainsStyleHash(targetDocument, hash) {
4268      if (!targetDocument.head) {
4269        return false;
4270      }
4271      for (const style of targetDocument.head.querySelectorAll(
4272        `style[$STYLE_HASH_ATTRIBUTE}]`
4273      )) {
4274        if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
4275          return true;
4276        }
4277      }
4278      return false;
4279    }
4280    function injectStyle(targetDocument, hash, css) {
4281      if (!targetDocument.head) {
4282        return;
4283      }
4284      const runtime = getRuntime();
4285      let injectedStyles = runtime.injectedStyles.get(targetDocument);
4286      if (!injectedStyles) {
4287        injectedStyles = /* @__PURE__ */ new Set();
4288        runtime.injectedStyles.set(targetDocument, injectedStyles);
4289      }
4290      if (injectedStyles.has(hash)) {
4291        return;
4292      }
4293      if (documentContainsStyleHash(targetDocument, hash)) {
4294        injectedStyles.add(hash);
4295        return;
4296      }
4297      const style = targetDocument.createElement("style");
4298      style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
4299      style.appendChild(targetDocument.createTextNode(css));
4300      targetDocument.head.appendChild(style);
4301      injectedStyles.add(hash);
4302    }
4303    function registerDocument(targetDocument) {
4304      const runtime = getRuntime();
4305      runtime.documents.set(
4306        targetDocument,
4307        (runtime.documents.get(targetDocument) ?? 0) + 1
4308      );
4309      for (const [hash, css] of runtime.styles) {
4310        injectStyle(targetDocument, hash, css);
4311      }
4312      return () => {
4313        const count = runtime.documents.get(targetDocument);
4314        if (count === void 0) {
4315          return;
4316        }
4317        if (count <= 1) {
4318          runtime.documents.delete(targetDocument);
4319          return;
4320        }
4321        runtime.documents.set(targetDocument, count - 1);
4322      };
4323    }
4324    function registerStyle(hash, css) {
4325      const runtime = getRuntime();
4326      runtime.styles.set(hash, css);
4327      for (const targetDocument of runtime.documents.keys()) {
4328        injectStyle(targetDocument, hash, css);
4329      }
4330    }
4331    if (typeof process === "undefined" || true) {
4332      registerStyle("f4e6e06c6a", ".dba930ea7a9438fd__root{display:contents}");
4333    }
4334    var style_default = { "root": "dba930ea7a9438fd__root" };
4335    var rootProviderCountByDocument = /* @__PURE__ */ new WeakMap();
4336    var ThemeProvider = ({
4337      children,
4338      color = {},
4339      cursor,
4340      cornerRadius,
4341      isRoot = false
4342    }) => {
4343      const { themeProviderStyles, resolvedSettings } = useThemeProviderStyles({
4344        color,
4345        cursor,
4346        cornerRadius
4347      });
4348      const cornerRadiusPreset = resolvedSettings.cornerRadius ?? "subtle";
4349      const contextValue = (0, import_element3.useMemo)(
4350        () => ({
4351          resolvedSettings
4352        }),
4353        [resolvedSettings]
4354      );
4355      const wrapperRef = (0, import_element3.useRef)(null);
4356      (0, import_compose.useIsomorphicLayoutEffect)(() => {
4357        if (!isRoot) {
4358          return;
4359        }
4360        const doc = wrapperRef.current?.ownerDocument;
4361        if (!doc) {
4362          return;
4363        }
4364        const root = doc.documentElement;
4365        if (true) {
4366          const active = rootProviderCountByDocument.get(doc) ?? 0;
4367          if (active > 0) {
4368            console.warn(
4369              "ThemeProvider: More than one root provider (`isRoot`) is mounted on the same document. Their forwarded document-level styles conflict, and unmounting one can reset the others. Render a single root provider per document."
4370            );
4371          }
4372          rootProviderCountByDocument.set(doc, active + 1);
4373        }
4374        const previous = /* @__PURE__ */ new Map();
4375        const applied = [];
4376        for (const [rawKey, rawValue] of Object.entries(
4377          themeProviderStyles
4378        )) {
4379          if (!rawKey.startsWith("--") || rawValue === null || rawValue === void 0) {
4380            continue;
4381          }
4382          previous.set(rawKey, root.style.getPropertyValue(rawKey));
4383          root.style.setProperty(rawKey, String(rawValue));
4384          applied.push(rawKey);
4385        }
4386        return () => {
4387          if (true) {
4388            const active = rootProviderCountByDocument.get(doc) ?? 1;
4389            if (active <= 1) {
4390              rootProviderCountByDocument.delete(doc);
4391            } else {
4392              rootProviderCountByDocument.set(doc, active - 1);
4393            }
4394          }
4395          for (const key of applied) {
4396            const prev = previous.get(key);
4397            if (prev) {
4398              root.style.setProperty(key, prev);
4399            } else {
4400              root.style.removeProperty(key);
4401            }
4402          }
4403        };
4404      }, [isRoot, themeProviderStyles]);
4405      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4406        "div",
4407        {
4408          ref: wrapperRef,
4409          "data-wpds-root-provider": isRoot || void 0,
4410          "data-wpds-corner-radius": cornerRadiusPreset,
4411          className: style_default.root,
4412          style: themeProviderStyles,
4413          children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value: contextValue, children })
4414        }
4415      );
4416    };
4417  
4418    // packages/theme/build-module/private-apis.mjs
4419    function warnPrivateApi(apiName, options = {}) {
4420      (0, import_deprecated.default)(`\`privateApis.$apiName}\` from \`@wordpress/theme\``, {
4421        since: "7.1",
4422        version: "7.3",
4423        ...options
4424      });
4425    }
4426    var privateApis = {};
4427    lock(privateApis, {
4428      get ThemeProvider() {
4429        warnPrivateApi("ThemeProvider", {
4430          alternative: "`ThemeProvider` from `@wordpress/theme`"
4431        });
4432        return ThemeProvider;
4433      },
4434      get useThemeProviderStyles() {
4435        warnPrivateApi("useThemeProviderStyles", {
4436          alternative: "`ThemeProvider` from `@wordpress/theme` for supported theming use cases",
4437          hint: "`useThemeProviderStyles` has no public replacement."
4438        });
4439        return useThemeProviderStyles;
4440      }
4441    });
4442    return __toCommonJS(index_exports);
4443  })();
4444  (window.wp ||= {}).theme = wp.theme;
4445  })();


Generated : Fri Aug 14 08:20:23 2026 Cross-referenced by PHPXref