import { camelize, Fragment, effectScope, onScopeDispose, defineComponent, h, getCurrentInstance as getCurrentInstance$1, isRef, ref } from "vue";
function wrapInArray(val) {
  return val == null ? [] : Array.isArray(val) ? val : [val];
}
function arrayDiff(a, b) {
  const diff = [];
  for (let i = 0; i < b.length; i++) {
    if (!a.includes(b[i]))
      diff.push(b[i]);
  }
  return diff;
}
function fillArray(length, fillable) {
  return Array(length).fill(fillable);
}
function createRange(length, start = 0) {
  return Array.from({ length }, (v, k) => start + k);
}
function parseAnchor(anchor) {
  let [side, align] = anchor.split(" ");
  if (!align) {
    align = side === "top" || side === "bottom" ? "start" : side === "start" || side === "end" ? "top" : "center";
  }
  return {
    side,
    align
  };
}
function oppositeAnchor(anchor) {
  return {
    side: {
      center: "center",
      top: "bottom",
      bottom: "top",
      start: "end",
      end: "start"
    }[anchor.side],
    align: anchor.align
  };
}
function physicalAnchor(anchor, el) {
  var _a, _b;
  const { side, align } = anchor;
  const { direction } = window.getComputedStyle(el);
  const map = direction === "ltr" ? { start: "left", end: "right" } : { start: "right", end: "left" };
  return `${(_a = map[side]) != null ? _a : side} ${(_b = map[align]) != null ? _b : align}`;
}
class Box {
  constructor({ x, y, width, height }) {
    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;
  }
  get top() {
    return this.y;
  }
  get bottom() {
    return this.y + this.height;
  }
  get left() {
    return this.x;
  }
  get right() {
    return this.x + this.width;
  }
}
function nullifyTransforms(el) {
  const rect = el.getBoundingClientRect();
  const style = getComputedStyle(el);
  const tx = style.transform;
  if (tx) {
    let ta, sx, sy, dx, dy;
    if (tx.startsWith("matrix3d(")) {
      ta = tx.slice(9, -1).split(/, /);
      sx = +ta[0];
      sy = +ta[5];
      dx = +ta[12];
      dy = +ta[13];
    } else if (tx.startsWith("matrix(")) {
      ta = tx.slice(7, -1).split(/, /);
      sx = +ta[0];
      sy = +ta[3];
      dx = +ta[4];
      dy = +ta[5];
    } else {
      return new Box(rect);
    }
    const to = style.transformOrigin;
    const x = rect.x - dx - (1 - sx) * parseFloat(to);
    const y = rect.y - dy - (1 - sy) * parseFloat(to.slice(to.indexOf(" ") + 1));
    const w = sx ? rect.width / sx : el.offsetWidth;
    const h2 = sy ? rect.height / sy : el.offsetHeight;
    return new Box({ x, y, width: w, height: h2 });
  } else {
    return new Box(rect);
  }
}
function isObject(objectable) {
  return objectable !== null && typeof objectable === "object" && !Array.isArray(objectable);
}
function keys(obj) {
  return Object.keys(obj);
}
function getNestedValue(obj, path, fallback) {
  const last = path.length - 1;
  if (last < 0)
    return obj === void 0 ? fallback : obj;
  for (let i = 0; i < last; i++) {
    if (obj == null) {
      return fallback;
    }
    obj = obj[path[i]];
  }
  if (obj == null)
    return fallback;
  return obj[path[last]] === void 0 ? fallback : obj[path[last]];
}
function setNestedValue(obj, path, value) {
  const last = path.length - 1;
  for (let i = 0; i < last; i++) {
    if (typeof obj[path[i]] !== "object")
      obj[path[i]] = {};
    obj = obj[path[i]];
  }
  obj[path[last]] = value;
}
function filterObjectOnKeys(obj, keys2) {
  const filtered = {};
  for (let i = 0; i < keys2.length; i++) {
    const key = keys2[i];
    if (typeof obj[key] !== "undefined") {
      filtered[key] = obj[key];
    }
  }
  return filtered;
}
function getObjectValueByPath(obj, path, fallback) {
  if (obj == null || !path || typeof path !== "string")
    return fallback;
  if (obj[path] !== void 0)
    return obj[path];
  path = path.replace(/\[(\w+)\]/g, ".$1");
  path = path.replace(/^\./, "");
  return getNestedValue(obj, path.split("."), fallback);
}
function setObjectValueByPath(obj, path, value) {
  if (typeof obj !== "object" || !path)
    return;
  path = path.replace(/\[(\w+)\]/g, ".$1");
  path = path.replace(/^\./, "");
  return setNestedValue(obj, path.split("."), value);
}
function getPropertyFromItem(item, property, fallback) {
  if (property == null)
    return item === void 0 ? fallback : item;
  if (item !== Object(item))
    return fallback === void 0 ? item : fallback;
  if (typeof property === "string")
    return getObjectValueByPath(item, property, fallback);
  if (Array.isArray(property))
    return getNestedValue(item, property, fallback);
  if (typeof property !== "function")
    return fallback;
  const value = property(item, fallback);
  return typeof value === "undefined" ? fallback : value;
}
function deepMerge(source = {}, target = {}, out = {}) {
  for (const key in source) {
    out[key] = source[key];
  }
  for (const key in target) {
    const sourceProperty = source[key];
    const targetProperty = target[key];
    if (isObject(sourceProperty) && isObject(targetProperty)) {
      out[key] = deepMerge(sourceProperty, targetProperty);
      continue;
    }
    out[key] = targetProperty;
  }
  return out;
}
var __accessCheck = (obj, member, msg) => {
  if (!member.has(obj))
    throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
  __accessCheck(obj, member, "read from private field");
  return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
  if (member.has(obj))
    throw TypeError("Cannot add the same private member more than once");
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
  __accessCheck(obj, member, "write to private field");
  setter ? setter.call(obj, value) : member.set(obj, value);
  return value;
};
var _arr, _pointer;
function deepEqual(a, b) {
  if (a === b)
    return true;
  if (a instanceof Date && b instanceof Date && a.getTime() !== b.getTime()) {
    return false;
  }
  if (a !== Object(a) || b !== Object(b)) {
    return false;
  }
  const props = Object.keys(a);
  if (props.length !== Object.keys(b).length) {
    return false;
  }
  return props.every((p) => deepEqual(a[p], b[p]));
}
function getZIndex(el) {
  if (!el || el.nodeType !== Node.ELEMENT_NODE)
    return 0;
  const index = +window.getComputedStyle(el).getPropertyValue("z-index");
  if (!index)
    return getZIndex(el.parentNode);
  return index;
}
function convertToUnit(str, unit = "px") {
  if (str == null || str === "") {
    return void 0;
  } else if (isNaN(+str)) {
    return String(str);
  } else if (!isFinite(+str)) {
    return void 0;
  } else {
    return `${Number(str)}${unit}`;
  }
}
function isComponentInstance(obj) {
  return obj == null ? void 0 : obj.$el;
}
function groupItems(items, groupBy, _groupDesc) {
  const key = groupBy[0];
  const groups = [];
  let current;
  for (let i = 0; i < items.length; i++) {
    const item = items[i];
    const val = getObjectValueByPath(item, key, null);
    if (current !== val) {
      current = val;
      groups.push({
        name: val != null ? val : "",
        items: []
      });
    }
    groups[groups.length - 1].items.push(item);
  }
  return groups;
}
function sortItems(items, sortBy, sortDesc, locale, customSorters) {
  if (sortBy === null || !sortBy.length)
    return items;
  const stringCollator = new Intl.Collator(locale, { sensitivity: "accent", usage: "sort" });
  return items.sort((a, b) => {
    for (let i = 0; i < sortBy.length; i++) {
      const sortKey = sortBy[i];
      let sortA = getObjectValueByPath(a, sortKey);
      let sortB = getObjectValueByPath(b, sortKey);
      if (sortDesc[i]) {
        [sortA, sortB] = [sortB, sortA];
      }
      if (customSorters == null ? void 0 : customSorters[sortKey]) {
        const customResult = customSorters[sortKey](sortA, sortB);
        if (!customResult)
          continue;
        return customResult;
      }
      if (sortA === null && sortB === null) {
        continue;
      }
      if (sortA instanceof Date && sortB instanceof Date) {
        return sortA.getTime() - sortB.getTime();
      }
      [sortA, sortB] = [sortA, sortB].map((s) => (s || "").toString().toLocaleLowerCase());
      if (sortA !== sortB) {
        if (!isNaN(sortA) && !isNaN(sortB))
          return Number(sortA) - Number(sortB);
        return stringCollator.compare(sortA, sortB);
      }
    }
    return 0;
  });
}
function defaultFilter(value, search, _item) {
  return value != null && search != null && typeof value !== "boolean" && value.toString().toLocaleLowerCase().includes(search.toLocaleLowerCase());
}
function searchItems(items, search) {
  if (!search)
    return items;
  search = search.toString().toLowerCase();
  if (search.trim() === "")
    return items;
  return items.filter((item) => Object.keys(item).some((key) => defaultFilter(getObjectValueByPath(item, key), search)));
}
function debounce(fn, delay) {
  let timeoutId = 0;
  return (...args) => {
    clearTimeout(timeoutId);
    timeoutId = setTimeout(() => fn(...args), delay);
  };
}
function throttle(fn, limit) {
  let throttling = false;
  return (...args) => {
    if (!throttling) {
      throttling = true;
      setTimeout(() => throttling = false, limit);
      return fn(...args);
    }
  };
}
function getPrefixedSlots(prefix, slots) {
  return Object.keys(slots).filter((k) => k.startsWith(prefix)).reduce((obj, k) => {
    obj[k.replace(prefix, "")] = slots[k];
    return obj;
  }, {});
}
function clamp(value, min = 0, max = 1) {
  return Math.max(min, Math.min(max, value));
}
function padEnd(str, length, char = "0") {
  return str + char.repeat(Math.max(0, length - str.length));
}
function chunk(str, size = 1) {
  const chunked = [];
  let index = 0;
  while (index < str.length) {
    chunked.push(str.substr(index, size));
    index += size;
  }
  return chunked;
}
function humanReadableFileSize(bytes, base = 1e3) {
  if (bytes < base) {
    return `${bytes} B`;
  }
  const prefix = base === 1024 ? ["Ki", "Mi", "Gi"] : ["k", "M", "G"];
  let unit = -1;
  while (Math.abs(bytes) >= base && unit < prefix.length - 1) {
    bytes /= base;
    ++unit;
  }
  return `${bytes.toFixed(1)} ${prefix[unit]}B`;
}
function camelizeObjectKeys(obj) {
  if (!obj)
    return {};
  return Object.keys(obj).reduce((o, key) => {
    o[camelize(key)] = obj[key];
    return o;
  }, {});
}
function getUid() {
  return getUid._uid++;
}
getUid._uid = 0;
function flattenFragments(nodes) {
  return nodes.map((node) => {
    if (node.type === Fragment) {
      return flattenFragments(node.children);
    } else {
      return node;
    }
  }).flat();
}
const randomHexColor = () => {
  const n = (Math.random() * 1048575 * 1e6).toString(16);
  return `#${n.slice(0, 6)}`;
};
class CircularBuffer {
  constructor(size) {
    this.size = size;
    __privateAdd(this, _arr, []);
    __privateAdd(this, _pointer, 0);
  }
  push(val) {
    __privateGet(this, _arr)[__privateGet(this, _pointer)] = val;
    __privateSet(this, _pointer, (__privateGet(this, _pointer) + 1) % this.size);
  }
  values() {
    return __privateGet(this, _arr).slice(__privateGet(this, _pointer)).concat(__privateGet(this, _arr).slice(0, __privateGet(this, _pointer)));
  }
}
_arr = /* @__PURE__ */ new WeakMap();
_pointer = /* @__PURE__ */ new WeakMap();
function padNumber(x, length) {
  let padded = String(x);
  if (padded.length > length) {
    padded.substring(padded.length - length);
  }
  while (padded.length < length) {
    padded = `0${padded}`;
  }
  return padded;
}
const mainTRC = 2.4;
const Rco = 0.2126729;
const Gco = 0.7151522;
const Bco = 0.072175;
const normBG = 0.55;
const normTXT = 0.58;
const revTXT = 0.57;
const revBG = 0.62;
const blkThrs = 0.03;
const blkClmp = 1.45;
const deltaYmin = 5e-4;
const scaleBoW = 1.25;
const scaleWoB = 1.25;
const loConThresh = 0.078;
const loConFactor = 12.82051282051282;
const loConOffset = 0.06;
const loClip = 1e-3;
function APCAcontrast(text, background) {
  const Rtxt = ((text >> 16 & 255) / 255) ** mainTRC;
  const Gtxt = ((text >> 8 & 255) / 255) ** mainTRC;
  const Btxt = ((text >> 0 & 255) / 255) ** mainTRC;
  const Rbg = ((background >> 16 & 255) / 255) ** mainTRC;
  const Gbg = ((background >> 8 & 255) / 255) ** mainTRC;
  const Bbg = ((background >> 0 & 255) / 255) ** mainTRC;
  let Ytxt = Rtxt * Rco + Gtxt * Gco + Btxt * Bco;
  let Ybg = Rbg * Rco + Gbg * Gco + Bbg * Bco;
  if (Ytxt <= blkThrs)
    Ytxt += (blkThrs - Ytxt) ** blkClmp;
  if (Ybg <= blkThrs)
    Ybg += (blkThrs - Ybg) ** blkClmp;
  if (Math.abs(Ybg - Ytxt) < deltaYmin)
    return 0;
  let outputContrast;
  if (Ybg > Ytxt) {
    const SAPC = (Ybg ** normBG - Ytxt ** normTXT) * scaleBoW;
    outputContrast = SAPC < loClip ? 0 : SAPC < loConThresh ? SAPC - SAPC * loConFactor * loConOffset : SAPC - loConOffset;
  } else {
    const SAPC = (Ybg ** revBG - Ytxt ** revTXT) * scaleWoB;
    outputContrast = SAPC > -loClip ? 0 : SAPC > -loConThresh ? SAPC - SAPC * loConFactor * loConOffset : SAPC + loConOffset;
  }
  return outputContrast * 100;
}
const srgbForwardMatrix = [
  [3.2406, -1.5372, -0.4986],
  [-0.9689, 1.8758, 0.0415],
  [0.0557, -0.204, 1.057]
];
const srgbForwardTransform = (C) => C <= 31308e-7 ? C * 12.92 : 1.055 * C ** (1 / 2.4) - 0.055;
const srgbReverseMatrix = [
  [0.4124, 0.3576, 0.1805],
  [0.2126, 0.7152, 0.0722],
  [0.0193, 0.1192, 0.9505]
];
const srgbReverseTransform = (C) => C <= 0.04045 ? C / 12.92 : ((C + 0.055) / 1.055) ** 2.4;
function fromXYZ$1(xyz) {
  const rgb = Array(3);
  const transform = srgbForwardTransform;
  const matrix = srgbForwardMatrix;
  for (let i = 0; i < 3; ++i) {
    rgb[i] = Math.round(clamp(transform(
      matrix[i][0] * xyz[0] + matrix[i][1] * xyz[1] + matrix[i][2] * xyz[2]
    )) * 255);
  }
  return (rgb[0] << 16) + (rgb[1] << 8) + (rgb[2] << 0);
}
function toXYZ$1(rgb) {
  const xyz = [0, 0, 0];
  const transform = srgbReverseTransform;
  const matrix = srgbReverseMatrix;
  const r = transform((rgb >> 16 & 255) / 255);
  const g = transform((rgb >> 8 & 255) / 255);
  const b = transform((rgb >> 0 & 255) / 255);
  for (let i = 0; i < 3; ++i) {
    xyz[i] = matrix[i][0] * r + matrix[i][1] * g + matrix[i][2] * b;
  }
  return xyz;
}
const delta = 0.20689655172413793;
const cielabForwardTransform = (t) => t > delta ** 3 ? Math.cbrt(t) : t / (3 * delta ** 2) + 4 / 29;
const cielabReverseTransform = (t) => t > delta ? t ** 3 : 3 * delta ** 2 * (t - 4 / 29);
function fromXYZ(xyz) {
  const transform = cielabForwardTransform;
  const transformedY = transform(xyz[1]);
  return [
    116 * transformedY - 16,
    500 * (transform(xyz[0] / 0.95047) - transformedY),
    200 * (transformedY - transform(xyz[2] / 1.08883))
  ];
}
function toXYZ(lab) {
  const transform = cielabReverseTransform;
  const Ln = (lab[0] + 16) / 116;
  return [
    transform(Ln + lab[1] / 500) * 0.95047,
    transform(Ln),
    transform(Ln - lab[2] / 200) * 1.08883
  ];
}
function isDarkColor(int) {
  const blackContrast = Math.abs(APCAcontrast(0, int));
  const whiteContrast = Math.abs(APCAcontrast(16777215, int));
  return whiteContrast > Math.min(blackContrast, 50);
}
function colorToOnColorHex(color) {
  return isDarkColor(colorToInt(color)) ? "#FFF" : "#000";
}
function isCssColor(color) {
  return !!color && /^(#|inherit|var\(--|(rgb|hsl)a?\()/.test(color);
}
function colorToInt(color) {
  let rgb;
  if (typeof color === "number") {
    rgb = color;
  } else if (typeof color === "string") {
    let c = color.startsWith("#") ? color.substring(1) : color;
    if (c.length === 3) {
      c = c.split("").map((char) => char + char).join("");
    }
    if (c.length !== 6) {
      console.warn(`'${color}' is not a valid rgb color`);
    }
    rgb = parseInt(c, 16);
  } else {
    throw new TypeError(`Colors can only be numbers or strings, recieved ${color} instead`);
  }
  if (rgb < 0) {
    console.warn(`Colors cannot be negative: '${color}'`);
    rgb = 0;
  } else if (rgb > 16777215 || isNaN(rgb)) {
    console.warn(`'${color}' is not a valid rgb color`);
    rgb = 16777215;
  }
  return rgb;
}
function intToHex(color) {
  let hexColor = color.toString(16);
  if (hexColor.length < 6)
    hexColor = "0".repeat(6 - hexColor.length) + hexColor;
  return `#${hexColor}`;
}
function colorToHex(color) {
  return intToHex(colorToInt(color));
}
function HSVAtoRGBA(hsva) {
  const { h: h2, s, v, a } = hsva;
  const f = (n) => {
    const k = (n + h2 / 60) % 6;
    return v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);
  };
  const rgb = [f(5), f(3), f(1)].map((v2) => Math.round(v2 * 255));
  return { r: rgb[0], g: rgb[1], b: rgb[2], a };
}
function RGBAtoHSVA(rgba) {
  if (!rgba)
    return { h: 0, s: 1, v: 1, a: 1 };
  const r = rgba.r / 255;
  const g = rgba.g / 255;
  const b = rgba.b / 255;
  const max = Math.max(r, g, b);
  const min = Math.min(r, g, b);
  let h2 = 0;
  if (max !== min) {
    if (max === r) {
      h2 = 60 * (0 + (g - b) / (max - min));
    } else if (max === g) {
      h2 = 60 * (2 + (b - r) / (max - min));
    } else if (max === b) {
      h2 = 60 * (4 + (r - g) / (max - min));
    }
  }
  if (h2 < 0)
    h2 = h2 + 360;
  const s = max === 0 ? 0 : (max - min) / max;
  const hsv = [h2, s, max];
  return { h: hsv[0], s: hsv[1], v: hsv[2], a: rgba.a };
}
function HSVAtoHSLA(hsva) {
  const { h: h2, s, v, a } = hsva;
  const l = v - v * s / 2;
  const sprime = l === 1 || l === 0 ? 0 : (v - l) / Math.min(l, 1 - l);
  return { h: h2, s: sprime, l, a };
}
function HSLAtoHSVA(hsl) {
  const { h: h2, s, l, a } = hsl;
  const v = l + s * Math.min(l, 1 - l);
  const sprime = v === 0 ? 0 : 2 - 2 * l / v;
  return { h: h2, s: sprime, v, a };
}
function RGBAtoCSS(rgba) {
  return `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`;
}
function RGBtoCSS(rgba) {
  return RGBAtoCSS({ ...rgba, a: 1 });
}
function RGBAtoHex(rgba) {
  const toHex = (v) => {
    const h2 = Math.round(v).toString(16);
    return ("00".substr(0, 2 - h2.length) + h2).toUpperCase();
  };
  return `#${[
    toHex(rgba.r),
    toHex(rgba.g),
    toHex(rgba.b),
    toHex(Math.round(rgba.a * 255))
  ].join("")}`;
}
function RGBtoHex(rgba) {
  const toHex = (v) => {
    const h2 = Math.round(v).toString(16);
    return ("00".substr(0, 2 - h2.length) + h2).toUpperCase();
  };
  return `#${[
    toHex(rgba.r),
    toHex(rgba.g),
    toHex(rgba.b)
  ].join("")}`;
}
function HexToRGBA(hex) {
  const rgba = chunk(hex.slice(1), 2).map((c) => parseInt(c, 16));
  return {
    r: rgba[0],
    g: rgba[1],
    b: rgba[2],
    a: rgba[3] === void 0 ? 1 : Math.round(rgba[3] / 255 * 100) / 100
  };
}
function HexToHSVA(hex) {
  const rgb = HexToRGBA(hex);
  return RGBAtoHSVA(rgb);
}
function HSVAtoHex(hsva) {
  return RGBAtoHex(HSVAtoRGBA(hsva));
}
function parseHex(hex) {
  if (hex.startsWith("#")) {
    hex = hex.slice(1);
  }
  hex = hex.replace(/([^0-9a-f])/gi, "F");
  if (hex.length === 3 || hex.length === 4) {
    hex = hex.split("").map((x) => x + x).join("");
  }
  if (hex.length === 6) {
    hex = padEnd(hex, 8, "F");
  } else {
    hex = padEnd(padEnd(hex, 6), 8, "F");
  }
  return `#${hex}`.toUpperCase().substr(0, 9);
}
function RGBtoInt(rgba) {
  return (rgba.r << 16) + (rgba.g << 8) + rgba.b;
}
function colorIntToRGBString(int) {
  const rgb = colorIntToRGB(int);
  return `${rgb.r},${rgb.g},${rgb.b}`;
}
function colorIntToRGB(int) {
  return {
    r: (int & 16711680) >> 16,
    g: (int & 65280) >> 8,
    b: int & 255
  };
}
function colorToRGB(color) {
  return colorIntToRGB(colorToInt(color));
}
function lighten(value, amount) {
  const lab = fromXYZ(toXYZ$1(value));
  lab[0] = lab[0] + amount * 10;
  return fromXYZ$1(toXYZ(lab));
}
function darken(value, amount) {
  return lighten(value, -amount);
}
function getLuma(color) {
  const rgb = colorToInt(color);
  return toXYZ$1(rgb)[1];
}
function getContrast(first, second) {
  const l1 = getLuma(first);
  const l2 = getLuma(second);
  const light = Math.max(l1, l2);
  const dark = Math.min(l1, l2);
  return (light + 0.05) / (dark + 0.05);
}
function createSharedComposable(composable) {
  let subscribers = 0;
  let scope;
  let state;
  return () => {
    subscribers++;
    if (state === void 0) {
      scope = effectScope(true);
      state = scope.run(composable);
    }
    onScopeDispose(() => {
      if (scope && --subscribers <= 0) {
        scope == null ? void 0 : scope.stop();
        state = scope = void 0;
      }
    });
    return state;
  };
}
function toKebabCase(str) {
  return str.replace(/[^a-z0-9]/gi, "-").replace(/\B([A-Z])/g, "-$1").toLowerCase();
}
function toSnakeCase(str) {
  return toKebabCase(str).replace(/-/g, "_");
}
function toCameCase(str) {
  return str.replace(/-(\w)/g, (match, part) => part.toLocaleUpperCase());
}
function toPascalCase(str) {
  return toCameCase(
    str.replace(/^[a-z]/, (match) => match.toLocaleUpperCase())
  );
}
function createSimpleFunctional(klass, tag = "div", name) {
  return defineComponent({
    name: name != null ? name : toKebabCase(klass.replace(/__/g, "-")),
    props: {
      tag: {
        type: String,
        default: tag
      }
    },
    setup(props, { slots }) {
      return () => {
        var _a;
        return h(props.tag, { class: klass }, (_a = slots.default) == null ? void 0 : _a.call(slots));
      };
    }
  });
}
function downloadCSV(name, headers, rows, charset = "utf-8") {
  const csv = [
    headers.map((header) => {
      var _a;
      return typeof header === "object" ? (_a = header.text) != null ? _a : header.value : header;
    }).join(","),
    ...rows.map((row) => {
      return headers.map((header) => typeof header === "object" ? row[header.value] : row[header]).join(",");
    })
  ];
  const blob = new Blob([
    `\uFEFF${csv.join("\n")}`
  ], {
    type: `text/csv;charset=${charset}`
  });
  const link = document.createElement("a");
  link.setAttribute("href", window.URL.createObjectURL(blob));
  link.setAttribute("download", `${name}.csv`);
  link.click();
}
const classifyRE = /(?:^|[-_])(\w)/g;
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
function formatComponentName(vm, includeFile) {
  if (vm.$root === vm) {
    return "<Root>";
  }
  const options = typeof vm === "function" && vm.cid != null ? vm.options : vm._isVue ? vm.$options || vm.constructor.options : vm || {};
  let name = options.name || options._componentTag;
  const file = options.__file;
  if (!name && file) {
    const match = file.match(/([^/\\]+)\.vue$/);
    name = match == null ? void 0 : match[1];
  }
  return (name ? `<${classify(name)}>` : "<Anonymous>") + (file && includeFile !== false ? ` at ${file}` : "");
}
function generateComponentTrace(vm) {
  if (vm._isVue && vm.$parent) {
    const tree = [];
    let currentRecursiveSequence = 0;
    while (vm) {
      if (tree.length > 0) {
        const last = tree[tree.length - 1];
        if (last.constructor === vm.constructor) {
          currentRecursiveSequence++;
          vm = vm.$parent;
          continue;
        } else if (currentRecursiveSequence > 0) {
          tree[tree.length - 1] = [last, currentRecursiveSequence];
          currentRecursiveSequence = 0;
        }
      }
      tree.push(vm);
      vm = vm.$parent;
    }
    return `

found in

${tree.map((vm2, i) => `${i === 0 ? "---> " : " ".repeat(5 + i * 2)}${Array.isArray(vm2) ? `${formatComponentName(vm2[0])}... (${vm2[1]} recursive calls)` : formatComponentName(vm2)}`).join("\n")}`;
  } else {
    return `

(found in ${formatComponentName(vm)})`;
  }
}
function attachedRoot(node) {
  if (typeof node.getRootNode !== "function") {
    while (node.parentNode)
      node = node.parentNode;
    if (node !== document)
      return null;
    return document;
  }
  const root = node.getRootNode();
  if (root !== document && root.getRootNode({ composed: true }) !== document)
    return null;
  return root;
}
const standardEasing = "cubic-bezier(0.4, 0, 0.2, 1)";
const deceleratedEasing = "cubic-bezier(0.0, 0, 0.2, 1)";
const acceleratedEasing = "cubic-bezier(0.4, 0, 1, 1)";
function createFilter(include, exclude) {
  const getMatcher = (id) => id instanceof RegExp ? id : new RegExp(id);
  const includeMatchers = wrapInArray(include).map(getMatcher);
  const excludeMatchers = wrapInArray(exclude).map(getMatcher);
  return (id) => {
    if (typeof id !== "string")
      return false;
    return !includeMatchers.length || !excludeMatchers.some((v) => v.test(id)) && includeMatchers.some((v) => v.test(id));
  };
}
function pick(obj, paths) {
  const found = /* @__PURE__ */ Object.create({});
  const rest = /* @__PURE__ */ Object.create({});
  for (const key in obj) {
    if (paths.some(
      (path) => path instanceof RegExp ? path.test(key) : path === key
    )) {
      found[key] = obj[key];
    } else {
      rest[key] = obj[key];
    }
  }
  return [found, rest];
}
function filterInputAttrs(attrs) {
  return pick(attrs, ["class", "style", "id", /^data-/]);
}
function getCurrentInstance(errorName, errorMessage) {
  const vm = getCurrentInstance$1();
  if (!vm) {
    throw new Error(
      `${errorName} ${errorMessage || "must be called from inside a setup function"}`
    );
  }
  return vm;
}
function getCurrentInstanceName(errorName = "getCurrentInstanceName") {
  var _a, _b;
  return toKebabCase((_b = (_a = getCurrentInstance(errorName).type) == null ? void 0 : _a.name) != null ? _b : "");
}
const IS_NODE = typeof process !== "undefined";
const IN_BROWSER = typeof window !== "undefined";
const IS_DEBUG = IS_NODE && process.env.DEBUG === "true";
const IS_PROD = IS_NODE && process.env.NODE_ENV === "production";
const SUPPORTS_INTERSECTION_OBSERVER = IN_BROWSER && "IntersectionObserver" in window;
const SUPPORTS_RESIZE_OBSERVER = IN_BROWSER && "ResizeObserver" in window;
const SUPPORTS_TOUCH = IN_BROWSER && ("ontouchstart" in window || window.navigator.maxTouchPoints > 0);
const SUPPORTS_FOCUS_VISIBLE = IN_BROWSER && CSS.supports("selector(:focus-visible)");
const keyCodes = Object.freeze({
  enter: 13,
  tab: 9,
  delete: 46,
  esc: 27,
  space: 32,
  up: 38,
  down: 40,
  left: 37,
  right: 39,
  end: 35,
  home: 36,
  del: 46,
  backspace: 8,
  insert: 45,
  pageup: 33,
  pagedown: 34,
  shift: 16
});
const keyValues = Object.freeze({
  enter: "Enter",
  tab: "Tab",
  delete: "Delete",
  esc: "Escape",
  space: "Space",
  up: "ArrowUp",
  down: "ArrowDown",
  left: "ArrowLeft",
  right: "ArrowRight",
  end: "End",
  home: "Home",
  del: "Delete",
  backspace: "Backspace",
  insert: "Insert",
  pageup: "PageUp",
  pagedown: "PageDown",
  shift: "Shift"
});
const tagsToReplace = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;"
};
function escapeHTML(str) {
  return str.replace(/[&<>]/g, (tag) => tagsToReplace[tag] || tag);
}
function isFixedPosition(el) {
  while (el) {
    if (window.getComputedStyle(el).position === "fixed") {
      return true;
    }
    el = el.offsetParent;
  }
  return false;
}
function elementToViewport(point, offset) {
  return {
    x: point.x + offset.x,
    y: point.y + offset.y
  };
}
function viewportToElement(point, offset) {
  return {
    x: point.x - offset.x,
    y: point.y - offset.y
  };
}
function getOffset(a, b) {
  return {
    x: a.x - b.x,
    y: a.y - b.y
  };
}
function anchorToPoint(anchor, box) {
  const { side, align } = anchor;
  let x;
  let y = 0;
  if (side === "top" || side === "bottom") {
    switch (side) {
      case "top":
        y = 0;
        break;
      case "bottom":
        y = box.height;
        break;
    }
    switch (align) {
      case "start":
        x = 0;
        break;
      case "center":
        x = box.width / 2;
        break;
      case "end":
        x = box.width;
        break;
    }
  } else if (side === "start" || side === "end") {
    switch (side) {
      case "start":
        x = 0;
        break;
      case "end":
        x = box.width;
        break;
    }
    switch (align) {
      case "top":
        y = 0;
        break;
      case "center":
        y = box.height / 2;
        break;
      case "bottom":
        y = box.height;
        break;
    }
  } else {
    x = box.width / 2;
    y = box.height / 2;
  }
  return elementToViewport({ x, y }, box);
}
function propsFactory(props, source) {
  return (defaults) => {
    return Object.keys(props).reduce((obj, prop) => {
      const isObjectDefinition = typeof props[prop] === "object" && props[prop] != null && !Array.isArray(props[prop]);
      const definition = isObjectDefinition ? props[prop] : { type: props[prop] };
      if (defaults && prop in defaults) {
        obj[prop] = {
          ...definition,
          default: defaults[prop]
        };
      } else {
        obj[prop] = definition;
      }
      if (source) {
        obj[prop].source = source;
      }
      return obj;
    }, {});
  };
}
function querySelector(selector, vm) {
  var _a, _b;
  let el;
  if (selector === "parent") {
    el = (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$el) == null ? void 0 : _b.parentNode;
  } else if (typeof selector === "string") {
    el = document.querySelector(selector);
  } else if ("$el" in selector) {
    el = selector.$el;
  } else if (selector) {
    el = selector;
  }
  return (el == null ? void 0 : el.nodeType) === Node.ELEMENT_NODE ? el : void 0;
}
function wrapInRef(val) {
  return isRef(val) ? val : ref(val);
}
let clean = true;
const frames = [];
function requestNewFrame(cb) {
  if (!clean || frames.length) {
    frames.push(cb);
    run();
  } else {
    clean = false;
    cb();
    run();
  }
}
let raf = -1;
function run() {
  cancelAnimationFrame(raf);
  raf = requestAnimationFrame(() => {
    const frame = frames.shift();
    if (frame)
      frame();
    if (frames.length)
      run();
    else
      clean = true;
  });
}
function getScrollParent(el) {
  while (el) {
    if (hasScrollbar(el))
      return el;
    el = el.parentElement;
  }
  return document.scrollingElement;
}
function getScrollParents(el) {
  const elements = [];
  while (el) {
    if (hasScrollbar(el))
      elements.push(el);
    el = el.parentElement;
  }
  return elements;
}
function hasScrollbar(el) {
  if (!el || el.nodeType !== Node.ELEMENT_NODE)
    return false;
  const style = window.getComputedStyle(el);
  return style.overflowY === "scroll" || (style.overflowY === "auto" || style.overflowY === "overlay") && el.scrollHeight > el.clientHeight;
}
function getScrollbarWidth(el) {
  if (!el || el.nodeType !== Node.ELEMENT_NODE)
    return 0;
  if (el.tagName === "HTML") {
    return window.innerWidth - document.documentElement.offsetWidth;
  }
  const style = window.getComputedStyle(el);
  return el.offsetWidth - el.clientWidth - parseFloat(style.borderLeftWidth) - parseFloat(style.borderRightWidth);
}
function useRender(render) {
  const vm = getCurrentInstance("useRender");
  vm.render = render;
}
export {
  Box,
  CircularBuffer,
  HSLAtoHSVA,
  HSVAtoHSLA,
  HSVAtoHex,
  HSVAtoRGBA,
  HexToHSVA,
  HexToRGBA,
  IN_BROWSER,
  IS_DEBUG,
  IS_NODE,
  IS_PROD,
  RGBAtoCSS,
  RGBAtoHSVA,
  RGBAtoHex,
  RGBtoCSS,
  RGBtoHex,
  RGBtoInt,
  SUPPORTS_FOCUS_VISIBLE,
  SUPPORTS_INTERSECTION_OBSERVER,
  SUPPORTS_RESIZE_OBSERVER,
  SUPPORTS_TOUCH,
  acceleratedEasing,
  anchorToPoint,
  arrayDiff,
  attachedRoot,
  camelizeObjectKeys,
  chunk,
  clamp,
  colorIntToRGB,
  colorIntToRGBString,
  colorToHex,
  colorToInt,
  colorToOnColorHex,
  colorToRGB,
  convertToUnit,
  createFilter,
  createRange,
  createSharedComposable,
  createSimpleFunctional,
  darken,
  debounce,
  deceleratedEasing,
  deepEqual,
  deepMerge,
  defaultFilter,
  downloadCSV,
  elementToViewport,
  escapeHTML,
  fillArray,
  filterInputAttrs,
  filterObjectOnKeys,
  flattenFragments,
  generateComponentTrace,
  getContrast,
  getCurrentInstance,
  getCurrentInstanceName,
  getLuma,
  getNestedValue,
  getObjectValueByPath,
  getOffset,
  getPrefixedSlots,
  getPropertyFromItem,
  getScrollParent,
  getScrollParents,
  getScrollbarWidth,
  getUid,
  getZIndex,
  groupItems,
  hasScrollbar,
  humanReadableFileSize,
  intToHex,
  isComponentInstance,
  isCssColor,
  isDarkColor,
  isFixedPosition,
  isObject,
  keyCodes,
  keyValues,
  keys,
  lighten,
  nullifyTransforms,
  oppositeAnchor,
  padEnd,
  padNumber,
  parseAnchor,
  parseHex,
  physicalAnchor,
  pick,
  propsFactory,
  querySelector,
  randomHexColor,
  requestNewFrame,
  searchItems,
  setNestedValue,
  setObjectValueByPath,
  sortItems,
  standardEasing,
  throttle,
  toCameCase,
  toKebabCase,
  toPascalCase,
  toSnakeCase,
  useRender,
  viewportToElement,
  wrapInArray,
  wrapInRef
};
//# sourceMappingURL=index.mjs.map
