var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  return value;
};
const SPLIT = "%";
class Entity {
  constructor(instanceId) {
    __publicField(this, "instanceId");
    /** @private Internal cache map. Do not access this directly */
    __publicField(this, "cache", /* @__PURE__ */ new Map());
    this.instanceId = instanceId;
  }
  get(keys) {
    return this.cache.get(Array.isArray(keys) ? keys.join(SPLIT) : keys) || null;
  }
  update(keys, valueFn) {
    const path = Array.isArray(keys) ? keys.join(SPLIT) : keys;
    const prevValue = this.cache.get(path);
    const nextValue = valueFn(prevValue);
    if (nextValue === null)
      this.cache.delete(path);
    else
      this.cache.set(path, nextValue);
  }
}

export { Entity as default };
//# sourceMappingURL=Cache.mjs.map
