@rpgjs/server 5.0.0-alpha.22 → 5.0.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4297,8 +4297,8 @@ const z = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
4297
4297
  void: voidType
4298
4298
  }, Symbol.toStringTag, { value: 'Module' }));
4299
4299
 
4300
- var __defProp$7 = Object.defineProperty;
4301
- var __name$5 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
4300
+ var __defProp$8 = Object.defineProperty;
4301
+ var __name$6 = (target, value) => __defProp$8(target, "name", { value, configurable: true });
4302
4302
 
4303
4303
  /******************************************************************************
4304
4304
  Copyright (c) Microsoft Corporation.
@@ -5673,11 +5673,11 @@ function finalize$1(callback) {
5673
5673
  });
5674
5674
  }
5675
5675
 
5676
- var __defProp$6 = Object.defineProperty;
5677
- var __name$4 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
5678
- var ArraySubject$1 = class ArraySubject extends BehaviorSubject$1 {
5676
+ var __defProp$7 = Object.defineProperty;
5677
+ var __name$5 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
5678
+ var ArraySubject$2 = class ArraySubject extends BehaviorSubject$1 {
5679
5679
  static {
5680
- __name$4(this, "ArraySubject");
5680
+ __name$5(this, "ArraySubject");
5681
5681
  }
5682
5682
  _items = [];
5683
5683
  constructor(items = []) {
@@ -5689,7 +5689,7 @@ var ArraySubject$1 = class ArraySubject extends BehaviorSubject$1 {
5689
5689
  }
5690
5690
  createProxy(items) {
5691
5691
  this._items = new Proxy(items, {
5692
- get: /* @__PURE__ */ __name$4((target, prop, receiver) => {
5692
+ get: /* @__PURE__ */ __name$5((target, prop, receiver) => {
5693
5693
  const origMethod = target[prop];
5694
5694
  if (typeof origMethod === "function") {
5695
5695
  return (...args) => {
@@ -5757,7 +5757,7 @@ var ArraySubject$1 = class ArraySubject extends BehaviorSubject$1 {
5757
5757
  }
5758
5758
  return Reflect.get(target, prop, receiver);
5759
5759
  }, "get"),
5760
- set: /* @__PURE__ */ __name$4((target, prop, value) => {
5760
+ set: /* @__PURE__ */ __name$5((target, prop, value) => {
5761
5761
  const index = !isNaN(Number(prop)) ? Number(prop) : void 0;
5762
5762
  target[prop] = value;
5763
5763
  this.next({
@@ -5782,12 +5782,12 @@ var ArraySubject$1 = class ArraySubject extends BehaviorSubject$1 {
5782
5782
  });
5783
5783
  }
5784
5784
  };
5785
- var isArraySubject$1 = /* @__PURE__ */ __name$4((value) => {
5785
+ var isArraySubject$1 = /* @__PURE__ */ __name$5((value) => {
5786
5786
  return "_items" in value;
5787
5787
  }, "isArraySubject");
5788
- var ObjectSubject$1 = class ObjectSubject extends BehaviorSubject$1 {
5788
+ var ObjectSubject$2 = class ObjectSubject extends BehaviorSubject$1 {
5789
5789
  static {
5790
- __name$4(this, "ObjectSubject");
5790
+ __name$5(this, "ObjectSubject");
5791
5791
  }
5792
5792
  _obj;
5793
5793
  constructor(obj = {}) {
@@ -5799,10 +5799,10 @@ var ObjectSubject$1 = class ObjectSubject extends BehaviorSubject$1 {
5799
5799
  }
5800
5800
  createProxy(obj) {
5801
5801
  this._obj = new Proxy(obj, {
5802
- get: /* @__PURE__ */ __name$4((target, prop, receiver) => {
5802
+ get: /* @__PURE__ */ __name$5((target, prop, receiver) => {
5803
5803
  return Reflect.get(target, prop, receiver);
5804
5804
  }, "get"),
5805
- set: /* @__PURE__ */ __name$4((target, prop, value, receiver) => {
5805
+ set: /* @__PURE__ */ __name$5((target, prop, value, receiver) => {
5806
5806
  const key = prop;
5807
5807
  const changeType = key in target ? "update" : "add";
5808
5808
  target[key] = value;
@@ -5813,7 +5813,7 @@ var ObjectSubject$1 = class ObjectSubject extends BehaviorSubject$1 {
5813
5813
  });
5814
5814
  return true;
5815
5815
  }, "set"),
5816
- deleteProperty: /* @__PURE__ */ __name$4((target, prop) => {
5816
+ deleteProperty: /* @__PURE__ */ __name$5((target, prop) => {
5817
5817
  const key = prop;
5818
5818
  if (key in target) {
5819
5819
  const value = target[key];
@@ -5840,10 +5840,10 @@ var ObjectSubject$1 = class ObjectSubject extends BehaviorSubject$1 {
5840
5840
  });
5841
5841
  }
5842
5842
  };
5843
- var isObjectSubject$1 = /* @__PURE__ */ __name$4((value) => {
5843
+ var isObjectSubject$1 = /* @__PURE__ */ __name$5((value) => {
5844
5844
  return "_obj" in value;
5845
5845
  }, "isObjectSubject");
5846
- var getGlobalReactiveStore$1 = /* @__PURE__ */ __name$4(() => {
5846
+ var getGlobalReactiveStore$2 = /* @__PURE__ */ __name$5(() => {
5847
5847
  const globalKey = "__REACTIVE_STORE__";
5848
5848
  if (typeof globalThis !== "undefined") {
5849
5849
  if (!globalThis[globalKey]) {
@@ -5876,40 +5876,49 @@ var getGlobalReactiveStore$1 = /* @__PURE__ */ __name$4(() => {
5876
5876
  }
5877
5877
  return globalObj[globalKey];
5878
5878
  }, "getGlobalReactiveStore");
5879
- var reactiveStore$1 = getGlobalReactiveStore$1();
5880
- var trackDependency$1 = /* @__PURE__ */ __name$4((signal2) => {
5881
- if (reactiveStore$1.currentDependencyTracker) {
5882
- reactiveStore$1.currentDependencyTracker(signal2);
5879
+ var reactiveStore$2 = getGlobalReactiveStore$2();
5880
+ var trackDependency$2 = /* @__PURE__ */ __name$5((signal2) => {
5881
+ if (reactiveStore$2.currentDependencyTracker) {
5882
+ reactiveStore$2.currentDependencyTracker(signal2);
5883
5883
  }
5884
5884
  }, "trackDependency");
5885
- function signal$1(defaultValue) {
5885
+ function signal$2(defaultValue, options) {
5886
5886
  let subject;
5887
5887
  if (Array.isArray(defaultValue)) {
5888
- subject = new ArraySubject$1(defaultValue);
5888
+ subject = new ArraySubject$2(defaultValue);
5889
5889
  } else if (typeof defaultValue === "object" && defaultValue !== null) {
5890
- subject = new ObjectSubject$1(defaultValue);
5890
+ subject = new ObjectSubject$2(defaultValue);
5891
5891
  } else {
5892
5892
  subject = new BehaviorSubject$1(defaultValue);
5893
5893
  }
5894
- const getValue = /* @__PURE__ */ __name$4(() => {
5895
- if (subject instanceof ArraySubject$1) {
5894
+ const getValue = /* @__PURE__ */ __name$5(() => {
5895
+ if (subject instanceof ArraySubject$2) {
5896
5896
  return subject.items;
5897
- } else if (subject instanceof ObjectSubject$1) {
5897
+ } else if (subject instanceof ObjectSubject$2) {
5898
5898
  return subject.obj;
5899
5899
  }
5900
5900
  return subject.value;
5901
5901
  }, "getValue");
5902
- const fn = /* @__PURE__ */ __name$4(function() {
5903
- trackDependency$1(fn);
5902
+ const fn = /* @__PURE__ */ __name$5(function() {
5903
+ trackDependency$2(fn);
5904
5904
  return getValue();
5905
5905
  }, "fn");
5906
5906
  fn.set = (value) => {
5907
- if (subject instanceof ArraySubject$1) {
5908
- subject.items = value;
5909
- } else if (subject instanceof ObjectSubject$1) {
5910
- subject.obj = value;
5907
+ const currentValue = getValue();
5908
+ let shouldEmit = true;
5909
+ if (options?.equal) {
5910
+ shouldEmit = !options.equal(currentValue, value);
5911
5911
  } else {
5912
- subject.next(value);
5912
+ shouldEmit = currentValue !== value;
5913
+ }
5914
+ if (shouldEmit) {
5915
+ if (subject instanceof ArraySubject$2) {
5916
+ subject.items = value;
5917
+ } else if (subject instanceof ObjectSubject$2) {
5918
+ subject.obj = value;
5919
+ } else {
5920
+ subject.next(value);
5921
+ }
5913
5922
  }
5914
5923
  };
5915
5924
  fn._isFrozen = false;
@@ -5918,12 +5927,12 @@ function signal$1(defaultValue) {
5918
5927
  };
5919
5928
  fn.unfreeze = () => {
5920
5929
  fn._isFrozen = false;
5921
- if (subject instanceof ArraySubject$1) {
5930
+ if (subject instanceof ArraySubject$2) {
5922
5931
  subject.next({
5923
5932
  type: "init",
5924
5933
  items: subject.items
5925
5934
  });
5926
- } else if (subject instanceof ObjectSubject$1) {
5935
+ } else if (subject instanceof ObjectSubject$2) {
5927
5936
  subject.next({
5928
5937
  type: "init",
5929
5938
  value: subject.obj
@@ -5944,33 +5953,42 @@ function signal$1(defaultValue) {
5944
5953
  fn._subject = subject;
5945
5954
  return fn;
5946
5955
  }
5947
- __name$4(signal$1, "signal");
5948
- function isSignal$1(value) {
5956
+ __name$5(signal$2, "signal");
5957
+ function isSignal$2(value) {
5949
5958
  return !!(value && value.observable);
5950
5959
  }
5951
- __name$4(isSignal$1, "isSignal");
5952
- function isComputed$1(value) {
5953
- return isSignal$1(value) && !!value.dependencies;
5960
+ __name$5(isSignal$2, "isSignal");
5961
+ function isComputed$2(value) {
5962
+ return isSignal$2(value) && !!value.dependencies;
5954
5963
  }
5955
- __name$4(isComputed$1, "isComputed");
5956
- function computed$1(computeFunction, disposableFn) {
5964
+ __name$5(isComputed$2, "isComputed");
5965
+ function computed$2(computeFunction, disposableFn) {
5957
5966
  const dependencies = /* @__PURE__ */ new Set();
5958
5967
  let init = true;
5959
5968
  let lastComputedValue;
5960
- const previousTracker = reactiveStore$1.currentDependencyTracker;
5961
- reactiveStore$1.currentDependencyTracker = (signal2) => {
5969
+ const previousTracker = reactiveStore$2.currentDependencyTracker;
5970
+ reactiveStore$2.currentDependencyTracker = (signal2) => {
5962
5971
  dependencies.add(signal2);
5963
5972
  };
5964
5973
  lastComputedValue = computeFunction();
5965
5974
  if (computeFunction["isEffect"]) {
5966
5975
  disposableFn = lastComputedValue;
5967
5976
  }
5968
- reactiveStore$1.currentDependencyTracker = previousTracker;
5969
- const computedObservable = combineLatest$1([
5977
+ reactiveStore$2.currentDependencyTracker = previousTracker;
5978
+ const observables = [
5970
5979
  ...dependencies
5971
- ].map((signal2) => signal2.observable)).pipe(filter$1(() => !init), map$1(() => computeFunction()), finalize$1(() => disposableFn?.()));
5972
- const fn = /* @__PURE__ */ __name$4(function() {
5973
- trackDependency$1(fn);
5980
+ ].map((dep) => {
5981
+ if (isComputed$2(dep) && "dependencies" in dep) {
5982
+ const computedDep = dep;
5983
+ if (computedDep.dependencies.size === 0) {
5984
+ return new BehaviorSubject$1(computedDep()).asObservable();
5985
+ }
5986
+ }
5987
+ return dep.observable;
5988
+ });
5989
+ const computedObservable = combineLatest$1(observables).pipe(filter$1(() => !init), map$1(() => computeFunction()), finalize$1(() => disposableFn?.()));
5990
+ const fn = /* @__PURE__ */ __name$5(function() {
5991
+ trackDependency$2(fn);
5974
5992
  return lastComputedValue;
5975
5993
  }, "fn");
5976
5994
  fn.observable = computedObservable;
@@ -5978,49 +5996,236 @@ function computed$1(computeFunction, disposableFn) {
5978
5996
  lastComputedValue = value;
5979
5997
  });
5980
5998
  fn.dependencies = dependencies;
5981
- reactiveStore$1.currentSubscriptionsTracker?.(fn.subscription);
5999
+ reactiveStore$2.currentSubscriptionsTracker?.(fn.subscription);
5982
6000
  init = false;
5983
6001
  return fn;
5984
6002
  }
5985
- __name$4(computed$1, "computed");
5986
- function untracked$1(fn) {
5987
- const prevDepTracker = reactiveStore$1.currentDependencyTracker;
5988
- const prevSubTracker = reactiveStore$1.currentSubscriptionsTracker;
5989
- reactiveStore$1.currentDependencyTracker = null;
5990
- reactiveStore$1.currentSubscriptionsTracker = null;
6003
+ __name$5(computed$2, "computed");
6004
+ function linkedSignal(computationOrOptions, simpleOptions) {
6005
+ const dependencies = /* @__PURE__ */ new Set();
6006
+ let init = true;
6007
+ let lastComputedValue;
6008
+ let computeFunction;
6009
+ let sourceSignal;
6010
+ let computationFn;
6011
+ let equalFn;
6012
+ let previousValue;
6013
+ let isOverridden = false;
6014
+ let overriddenValue;
6015
+ let depVersion = 0;
6016
+ let overrideDepVersion = null;
6017
+ if (typeof computationOrOptions === "function") {
6018
+ computeFunction = computationOrOptions;
6019
+ equalFn = simpleOptions?.equal;
6020
+ } else {
6021
+ const options = computationOrOptions;
6022
+ sourceSignal = options.source;
6023
+ computationFn = options.computation;
6024
+ equalFn = options.equal;
6025
+ if (typeof sourceSignal === "function" && !isSignal$2(sourceSignal)) {
6026
+ const sourceFn = sourceSignal;
6027
+ computeFunction = /* @__PURE__ */ __name$5(() => {
6028
+ const sourceValue = sourceFn();
6029
+ if (computationFn.length > 1) {
6030
+ const result = computationFn(sourceValue, previousValue);
6031
+ previousValue = {
6032
+ source: sourceValue,
6033
+ value: result
6034
+ };
6035
+ return result;
6036
+ } else {
6037
+ const result = computationFn(sourceValue);
6038
+ previousValue = {
6039
+ source: sourceValue,
6040
+ value: result
6041
+ };
6042
+ return result;
6043
+ }
6044
+ }, "computeFunction");
6045
+ } else {
6046
+ const source = typeof sourceSignal === "function" ? sourceSignal : sourceSignal;
6047
+ computeFunction = /* @__PURE__ */ __name$5(() => {
6048
+ const sourceValue = source();
6049
+ if (computationFn.length > 1) {
6050
+ const result = computationFn(sourceValue, previousValue);
6051
+ previousValue = {
6052
+ source: sourceValue,
6053
+ value: result
6054
+ };
6055
+ return result;
6056
+ } else {
6057
+ const result = computationFn(sourceValue);
6058
+ previousValue = {
6059
+ source: sourceValue,
6060
+ value: result
6061
+ };
6062
+ return result;
6063
+ }
6064
+ }, "computeFunction");
6065
+ }
6066
+ }
6067
+ const previousTracker = reactiveStore$2.currentDependencyTracker;
6068
+ reactiveStore$2.currentDependencyTracker = (signal2) => {
6069
+ dependencies.add(signal2);
6070
+ };
6071
+ if (sourceSignal && typeof sourceSignal === "function" && !isSignal$2(sourceSignal)) {
6072
+ lastComputedValue = computeFunction();
6073
+ } else if (sourceSignal && isSignal$2(sourceSignal)) {
6074
+ dependencies.add(sourceSignal);
6075
+ lastComputedValue = computeFunction();
6076
+ } else {
6077
+ lastComputedValue = computeFunction();
6078
+ }
6079
+ reactiveStore$2.currentDependencyTracker = previousTracker;
6080
+ const subject = new BehaviorSubject$1(lastComputedValue);
6081
+ const observables = [
6082
+ ...dependencies
6083
+ ].map((dep) => {
6084
+ if (isComputed$2(dep) && "dependencies" in dep) {
6085
+ const computedDep = dep;
6086
+ if (computedDep.dependencies.size === 0) {
6087
+ return new BehaviorSubject$1(computedDep()).asObservable();
6088
+ }
6089
+ }
6090
+ return dep.observable;
6091
+ });
6092
+ let linkedObservable;
6093
+ if (observables.length > 0) {
6094
+ linkedObservable = combineLatest$1(observables).pipe(filter$1(() => !init), map$1(() => {
6095
+ const computed2 = computeFunction();
6096
+ if (equalFn) {
6097
+ if (!equalFn(lastComputedValue, computed2)) {
6098
+ lastComputedValue = computed2;
6099
+ isOverridden = false;
6100
+ }
6101
+ } else {
6102
+ if (lastComputedValue !== computed2) {
6103
+ lastComputedValue = computed2;
6104
+ isOverridden = false;
6105
+ }
6106
+ }
6107
+ return lastComputedValue;
6108
+ }));
6109
+ } else {
6110
+ linkedObservable = subject.asObservable().pipe(filter$1(() => !init));
6111
+ }
6112
+ const fn = /* @__PURE__ */ __name$5(function() {
6113
+ trackDependency$2(fn);
6114
+ if (isOverridden && dependencies.size > 0) {
6115
+ if (overrideDepVersion !== depVersion) {
6116
+ const computed2 = computeFunction();
6117
+ isOverridden = false;
6118
+ overriddenValue = void 0;
6119
+ lastComputedValue = computed2;
6120
+ overrideDepVersion = null;
6121
+ return computed2;
6122
+ }
6123
+ return overriddenValue;
6124
+ }
6125
+ if (isOverridden) {
6126
+ return overriddenValue;
6127
+ }
6128
+ if (dependencies.size === 0) {
6129
+ const computed2 = computeFunction();
6130
+ lastComputedValue = computed2;
6131
+ }
6132
+ return lastComputedValue;
6133
+ }, "fn");
6134
+ fn.observable = new Observable$1((observer) => {
6135
+ const depSubscription = linkedObservable.subscribe((value) => {
6136
+ if (dependencies.size > 0) {
6137
+ depVersion++;
6138
+ isOverridden = false;
6139
+ overrideDepVersion = null;
6140
+ lastComputedValue = value;
6141
+ } else {
6142
+ lastComputedValue = value;
6143
+ }
6144
+ observer.next(value);
6145
+ });
6146
+ let subjectSubscription;
6147
+ if (dependencies.size === 0) {
6148
+ subjectSubscription = subject.pipe(filter$1(() => !init)).subscribe((value) => {
6149
+ observer.next(value);
6150
+ });
6151
+ }
6152
+ observer.next(lastComputedValue);
6153
+ return () => {
6154
+ depSubscription.unsubscribe();
6155
+ if (subjectSubscription) {
6156
+ subjectSubscription.unsubscribe();
6157
+ }
6158
+ };
6159
+ });
6160
+ fn.subscription = fn.observable.subscribe(() => {
6161
+ });
6162
+ fn.dependencies = dependencies;
6163
+ fn._subject = subject;
6164
+ fn.set = (value) => {
6165
+ if (!isOverridden) {
6166
+ overrideDepVersion = depVersion;
6167
+ if (computationFn && sourceSignal) {
6168
+ const sourceValue = untracked$2(() => {
6169
+ if (typeof sourceSignal === "function") {
6170
+ const source = sourceSignal;
6171
+ return isSignal$2(source) ? source() : sourceSignal();
6172
+ }
6173
+ return sourceSignal();
6174
+ });
6175
+ previousValue = {
6176
+ source: sourceValue,
6177
+ value
6178
+ };
6179
+ }
6180
+ }
6181
+ isOverridden = true;
6182
+ overriddenValue = value;
6183
+ lastComputedValue = value;
6184
+ subject.next(value);
6185
+ };
6186
+ reactiveStore$2.currentSubscriptionsTracker?.(fn.subscription);
6187
+ init = false;
6188
+ return fn;
6189
+ }
6190
+ __name$5(linkedSignal, "linkedSignal");
6191
+ function untracked$2(fn) {
6192
+ const prevDepTracker = reactiveStore$2.currentDependencyTracker;
6193
+ const prevSubTracker = reactiveStore$2.currentSubscriptionsTracker;
6194
+ reactiveStore$2.currentDependencyTracker = null;
6195
+ reactiveStore$2.currentSubscriptionsTracker = null;
5991
6196
  try {
5992
6197
  return fn();
5993
6198
  } finally {
5994
- reactiveStore$1.currentDependencyTracker = prevDepTracker;
5995
- reactiveStore$1.currentSubscriptionsTracker = prevSubTracker;
6199
+ reactiveStore$2.currentDependencyTracker = prevDepTracker;
6200
+ reactiveStore$2.currentSubscriptionsTracker = prevSubTracker;
5996
6201
  }
5997
6202
  }
5998
- __name$4(untracked$1, "untracked");
6203
+ __name$5(untracked$2, "untracked");
5999
6204
 
6000
6205
  // src/effect.ts
6001
- function effect$1(fn) {
6206
+ function effect$2(fn) {
6002
6207
  fn["isEffect"] = true;
6003
- return computed$1(fn);
6208
+ return computed$2(fn);
6004
6209
  }
6005
- __name$4(effect$1, "effect");
6210
+ __name$5(effect$2, "effect");
6006
6211
 
6007
6212
  // src/utils.ts
6008
6213
  function isFunction$3(val) {
6009
6214
  return {}.toString.call(val) === "[object Function]";
6010
6215
  }
6011
- __name$5(isFunction$3, "isFunction");
6216
+ __name$6(isFunction$3, "isFunction");
6012
6217
  function isClass$2(obj) {
6013
6218
  return typeof obj === "function" && obj.prototype && obj.prototype.constructor === obj;
6014
6219
  }
6015
- __name$5(isClass$2, "isClass");
6016
- var isObject$2 = /* @__PURE__ */ __name$5((item) => item && typeof item === "object" && !Array.isArray(item) && item !== null, "isObject");
6220
+ __name$6(isClass$2, "isClass");
6221
+ var isObject$2 = /* @__PURE__ */ __name$6((item) => item && typeof item === "object" && !Array.isArray(item) && item !== null, "isObject");
6017
6222
  function isInstanceOfClass$1(value) {
6018
6223
  if (value === null || typeof value !== "object" || value === void 0 || Array.isArray(value)) {
6019
6224
  return false;
6020
6225
  }
6021
6226
  return Object.getPrototypeOf(value) !== Object.prototype;
6022
6227
  }
6023
- __name$5(isInstanceOfClass$1, "isInstanceOfClass");
6228
+ __name$6(isInstanceOfClass$1, "isInstanceOfClass");
6024
6229
  function generateShortUUID$2() {
6025
6230
  const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
6026
6231
  let uuid = "";
@@ -6030,27 +6235,27 @@ function generateShortUUID$2() {
6030
6235
  }
6031
6236
  return uuid;
6032
6237
  }
6033
- __name$5(generateShortUUID$2, "generateShortUUID");
6238
+ __name$6(generateShortUUID$2, "generateShortUUID");
6034
6239
 
6035
6240
  // src/core.ts
6036
6241
  var DELETE_TOKEN$1 = "$delete";
6037
- var syncClass = /* @__PURE__ */ __name$5((instance, options = {}) => {
6242
+ var syncClass = /* @__PURE__ */ __name$6((instance, options = {}) => {
6038
6243
  const cacheSync = /* @__PURE__ */ new Map();
6039
6244
  const cachePersist = /* @__PURE__ */ new Map();
6040
6245
  instance.$valuesChanges = {
6041
- set: /* @__PURE__ */ __name$5((path, value) => {
6246
+ set: /* @__PURE__ */ __name$6((path, value) => {
6042
6247
  cacheSync.set(path, value);
6043
6248
  options.onSync?.(cacheSync);
6044
6249
  }, "set"),
6045
- setPersist: /* @__PURE__ */ __name$5((path, value) => {
6250
+ setPersist: /* @__PURE__ */ __name$6((path, value) => {
6046
6251
  if (path == "") path = ".";
6047
6252
  cachePersist.set(path, value);
6048
6253
  options.onPersist?.(cachePersist);
6049
6254
  }, "setPersist"),
6050
- has: /* @__PURE__ */ __name$5((path) => {
6255
+ has: /* @__PURE__ */ __name$6((path) => {
6051
6256
  return cacheSync.has(path);
6052
6257
  }, "has"),
6053
- get: /* @__PURE__ */ __name$5((path) => {
6258
+ get: /* @__PURE__ */ __name$6((path) => {
6054
6259
  return cacheSync.get(path);
6055
6260
  }, "get")
6056
6261
  };
@@ -6073,20 +6278,20 @@ function createStatesSnapshot$1(instance) {
6073
6278
  }
6074
6279
  return persistObject;
6075
6280
  }
6076
- __name$5(createStatesSnapshot$1, "createStatesSnapshot");
6281
+ __name$6(createStatesSnapshot$1, "createStatesSnapshot");
6077
6282
  function setMetadata$1(target, key, value) {
6078
6283
  const meta = target.constructor._propertyMetadata;
6079
6284
  const propId = meta?.get(key);
6080
6285
  if (propId) {
6081
- if (isSignal$1(target[propId])) {
6286
+ if (isSignal$2(target[propId])) {
6082
6287
  target[propId].set(value);
6083
6288
  } else {
6084
6289
  target[propId] = value;
6085
6290
  }
6086
6291
  }
6087
6292
  }
6088
- __name$5(setMetadata$1, "setMetadata");
6089
- var createSyncClass$1 = /* @__PURE__ */ __name$5((currentClass, parentKey = null, parentClass = null, path = "") => {
6293
+ __name$6(setMetadata$1, "setMetadata");
6294
+ var createSyncClass$1 = /* @__PURE__ */ __name$6((currentClass, parentKey = null, parentClass = null, path = "") => {
6090
6295
  currentClass.$path = path;
6091
6296
  if (parentClass) {
6092
6297
  currentClass.$valuesChanges = parentClass.$valuesChanges;
@@ -6117,7 +6322,7 @@ var createSyncClass$1 = /* @__PURE__ */ __name$5((currentClass, parentKey = null
6117
6322
  if (persist2) {
6118
6323
  if (parentClass) currentClass.$valuesChanges.setPersist(path, transformedValue);
6119
6324
  }
6120
- if (isComputed$1(signal)) {
6325
+ if (isComputed$2(signal)) {
6121
6326
  signal.observable.subscribe((newValue) => {
6122
6327
  if (syncToClient) {
6123
6328
  const transformedNewValue = transform ? transform(newValue) : newValue;
@@ -6128,10 +6333,10 @@ var createSyncClass$1 = /* @__PURE__ */ __name$5((currentClass, parentKey = null
6128
6333
  }
6129
6334
  }
6130
6335
  }, "createSyncClass");
6131
- var type$1 = /* @__PURE__ */ __name$5((_signal, path, options = {}, currentInstance) => {
6336
+ var type$1 = /* @__PURE__ */ __name$6((_signal, path, options = {}, currentInstance) => {
6132
6337
  const { syncToClient = true, persist: persist2 = true, transform } = options;
6133
6338
  let init = true;
6134
- const handleObjectSubject = /* @__PURE__ */ __name$5((value, propPath) => {
6339
+ const handleObjectSubject = /* @__PURE__ */ __name$6((value, propPath) => {
6135
6340
  const newPath = `${propPath}${value.key ? `.${value.key}` : ""}`;
6136
6341
  if ([
6137
6342
  "add",
@@ -6149,7 +6354,7 @@ var type$1 = /* @__PURE__ */ __name$5((_signal, path, options = {}, currentInsta
6149
6354
  savePath(newPath, DELETE_TOKEN$1);
6150
6355
  }
6151
6356
  }, "handleObjectSubject");
6152
- const handleArraySubject = /* @__PURE__ */ __name$5((value, propPath) => {
6357
+ const handleArraySubject = /* @__PURE__ */ __name$6((value, propPath) => {
6153
6358
  if (value.type === "reset" && Array.isArray(value.items)) {
6154
6359
  value.items.forEach((item, index) => {
6155
6360
  const newPath2 = `${propPath}.${index}`;
@@ -6178,7 +6383,7 @@ var type$1 = /* @__PURE__ */ __name$5((_signal, path, options = {}, currentInsta
6178
6383
  savePath(newPath, DELETE_TOKEN$1);
6179
6384
  }
6180
6385
  }, "handleArraySubject");
6181
- const savePath = /* @__PURE__ */ __name$5((propPath, value) => {
6386
+ const savePath = /* @__PURE__ */ __name$6((propPath, value) => {
6182
6387
  const transformedValue = transform && value !== DELETE_TOKEN$1 ? transform(value) : value;
6183
6388
  if (syncToClient) {
6184
6389
  currentInstance.$valuesChanges.set(propPath, transformedValue);
@@ -6187,8 +6392,8 @@ var type$1 = /* @__PURE__ */ __name$5((_signal, path, options = {}, currentInsta
6187
6392
  currentInstance.$valuesChanges.setPersist(transformedValue == DELETE_TOKEN$1 ? propPath : currentInstance.$path, transformedValue);
6188
6393
  }
6189
6394
  }, "savePath");
6190
- const setupSubscription = /* @__PURE__ */ __name$5((signal, signalPath) => {
6191
- if (!isSignal$1(signal)) return;
6395
+ const setupSubscription = /* @__PURE__ */ __name$6((signal, signalPath) => {
6396
+ if (!isSignal$2(signal)) return;
6192
6397
  if (syncToClient && currentInstance.$valuesChanges) {
6193
6398
  const initialValue = signal();
6194
6399
  const transformedInitialValue = transform ? transform(initialValue) : initialValue;
@@ -6199,7 +6404,7 @@ var type$1 = /* @__PURE__ */ __name$5((_signal, path, options = {}, currentInsta
6199
6404
  if (init) return;
6200
6405
  if (currentInstance.$path !== void 0) {
6201
6406
  const fullPath = `${currentInstance.$path ? currentInstance.$path + "." : ""}${signalPath}`;
6202
- if (isComputed$1(signal)) {
6407
+ if (isComputed$2(signal)) {
6203
6408
  savePath(fullPath, value);
6204
6409
  } else if (isObjectSubject$1(signal._subject)) {
6205
6410
  handleObjectSubject(value, fullPath);
@@ -6215,13 +6420,13 @@ var type$1 = /* @__PURE__ */ __name$5((_signal, path, options = {}, currentInsta
6215
6420
  }
6216
6421
  currentInstance.$snapshot.set(path, signal);
6217
6422
  }, "setupSubscription");
6218
- if (!isSignal$1(_signal)) {
6423
+ if (!isSignal$2(_signal)) {
6219
6424
  if (_signal && typeof _signal === "object" && !Array.isArray(_signal)) {
6220
6425
  for (const key in _signal) {
6221
6426
  if (Object.prototype.hasOwnProperty.call(_signal, key)) {
6222
6427
  const value = _signal[key];
6223
6428
  const propertyPath = `${path}.${key}`;
6224
- if (isSignal$1(value)) {
6429
+ if (isSignal$2(value)) {
6225
6430
  setupSubscription(value, propertyPath);
6226
6431
  } else if (value && typeof value === "object" && !Array.isArray(value)) {
6227
6432
  type$1(value, propertyPath, options, currentInstance);
@@ -6259,10 +6464,10 @@ function sync$1(options) {
6259
6464
  }
6260
6465
  return function(target, propertyKey) {
6261
6466
  const privatePropertyKey = `__${propertyKey}`;
6262
- const getter = /* @__PURE__ */ __name$5(function() {
6467
+ const getter = /* @__PURE__ */ __name$6(function() {
6263
6468
  return this[privatePropertyKey];
6264
6469
  }, "getter");
6265
- const setter = /* @__PURE__ */ __name$5(function(newVal) {
6470
+ const setter = /* @__PURE__ */ __name$6(function(newVal) {
6266
6471
  this[privatePropertyKey] = type$1(newVal, propertyKey, {
6267
6472
  classType,
6268
6473
  persist: persist2,
@@ -6278,7 +6483,7 @@ function sync$1(options) {
6278
6483
  });
6279
6484
  };
6280
6485
  }
6281
- __name$5(sync$1, "sync");
6486
+ __name$6(sync$1, "sync");
6282
6487
  function id$1() {
6283
6488
  return function(target, propertyKey) {
6284
6489
  if (!target.constructor._propertyMetadata) {
@@ -6287,7 +6492,7 @@ function id$1() {
6287
6492
  target.constructor._propertyMetadata.set("id", propertyKey);
6288
6493
  };
6289
6494
  }
6290
- __name$5(id$1, "id");
6495
+ __name$6(id$1, "id");
6291
6496
  function users$1(options) {
6292
6497
  return function(target, propertyKey) {
6293
6498
  if (!target.constructor._propertyMetadata) {
@@ -6297,14 +6502,14 @@ function users$1(options) {
6297
6502
  sync$1(options)(target, propertyKey);
6298
6503
  };
6299
6504
  }
6300
- __name$5(users$1, "users");
6505
+ __name$6(users$1, "users");
6301
6506
  function persist$1() {
6302
6507
  return sync$1({
6303
6508
  persist: true,
6304
6509
  syncToClient: false
6305
6510
  });
6306
6511
  }
6307
- __name$5(persist$1, "persist");
6512
+ __name$6(persist$1, "persist");
6308
6513
  function connected$1() {
6309
6514
  return function(target, propertyKey) {
6310
6515
  if (!target.constructor._propertyMetadata) {
@@ -6316,7 +6521,7 @@ function connected$1() {
6316
6521
  })(target, propertyKey);
6317
6522
  };
6318
6523
  }
6319
- __name$5(connected$1, "connected");
6524
+ __name$6(connected$1, "connected");
6320
6525
  function load$1(rootInstance, values, valueIsObject) {
6321
6526
  if (valueIsObject) {
6322
6527
  loadFromObject$1(rootInstance, values);
@@ -6324,14 +6529,14 @@ function load$1(rootInstance, values, valueIsObject) {
6324
6529
  loadFromPaths$1(rootInstance, values);
6325
6530
  }
6326
6531
  }
6327
- __name$5(load$1, "load");
6532
+ __name$6(load$1, "load");
6328
6533
  function loadFromPaths$1(rootInstance, values) {
6329
6534
  for (const [path, value] of Object.entries(values)) {
6330
6535
  const parts = path.split(".");
6331
6536
  loadValue$1(rootInstance, parts, value);
6332
6537
  }
6333
6538
  }
6334
- __name$5(loadFromPaths$1, "loadFromPaths");
6539
+ __name$6(loadFromPaths$1, "loadFromPaths");
6335
6540
  function loadFromObject$1(rootInstance, values, currentPath = "") {
6336
6541
  for (let key in values) {
6337
6542
  const value = values[key];
@@ -6344,26 +6549,26 @@ function loadFromObject$1(rootInstance, values, currentPath = "") {
6344
6549
  }
6345
6550
  }
6346
6551
  }
6347
- __name$5(loadFromObject$1, "loadFromObject");
6552
+ __name$6(loadFromObject$1, "loadFromObject");
6348
6553
  function loadValue$1(rootInstance, parts, value) {
6349
6554
  let current = rootInstance;
6350
6555
  for (let i = 0; i < parts.length; i++) {
6351
6556
  const part = parts[i];
6352
6557
  if (i === parts.length - 1) {
6353
6558
  if (value == DELETE_TOKEN$1) {
6354
- if (isSignal$1(current)) {
6559
+ if (isSignal$2(current)) {
6355
6560
  current = current();
6356
6561
  }
6357
6562
  Reflect.deleteProperty(current, part);
6358
6563
  } else if (current[part]?._subject) {
6359
6564
  current[part].set(value);
6360
- } else if (isSignal$1(current) && Array.isArray(current()) && !isNaN(Number(part))) {
6565
+ } else if (isSignal$2(current) && Array.isArray(current()) && !isNaN(Number(part))) {
6361
6566
  current()[Number(part)] = value;
6362
6567
  } else {
6363
6568
  current[part] = value;
6364
6569
  }
6365
6570
  } else {
6366
- if (isSignal$1(current)) {
6571
+ if (isSignal$2(current)) {
6367
6572
  current = current();
6368
6573
  }
6369
6574
  const currentValue = current[part];
@@ -6381,12 +6586,12 @@ function loadValue$1(rootInstance, parts, value) {
6381
6586
  }
6382
6587
  }
6383
6588
  }
6384
- __name$5(loadValue$1, "loadValue");
6589
+ __name$6(loadValue$1, "loadValue");
6385
6590
  function getByPath$1(root, path) {
6386
6591
  const parts = path.split(".");
6387
6592
  let current = root;
6388
6593
  for (const part of parts) {
6389
- if (isSignal$1(current)) {
6594
+ if (isSignal$2(current)) {
6390
6595
  current = current();
6391
6596
  }
6392
6597
  if (current[part]) {
@@ -6397,7 +6602,332 @@ function getByPath$1(root, path) {
6397
6602
  }
6398
6603
  return current;
6399
6604
  }
6400
- __name$5(getByPath$1, "getByPath");
6605
+ __name$6(getByPath$1, "getByPath");
6606
+
6607
+ var __defProp$6 = Object.defineProperty;
6608
+ var __name$4 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
6609
+ var ArraySubject$1 = class ArraySubject extends BehaviorSubject$1 {
6610
+ static {
6611
+ __name$4(this, "ArraySubject");
6612
+ }
6613
+ _items = [];
6614
+ constructor(items = []) {
6615
+ super({
6616
+ type: "init",
6617
+ items
6618
+ });
6619
+ this.createProxy(items);
6620
+ }
6621
+ createProxy(items) {
6622
+ this._items = new Proxy(items, {
6623
+ get: /* @__PURE__ */ __name$4((target, prop, receiver) => {
6624
+ const origMethod = target[prop];
6625
+ if (typeof origMethod === "function") {
6626
+ return (...args) => {
6627
+ let changeType = "update";
6628
+ let index = void 0;
6629
+ let isMutateFn = false;
6630
+ let itemsToEmit = [];
6631
+ let changeSplice = true;
6632
+ switch (prop) {
6633
+ case "push":
6634
+ index = target.length;
6635
+ changeType = "add";
6636
+ isMutateFn = true;
6637
+ break;
6638
+ case "pop":
6639
+ index = target.length - 1;
6640
+ changeType = "remove";
6641
+ isMutateFn = true;
6642
+ break;
6643
+ case "unshift":
6644
+ index = 0;
6645
+ changeType = "add";
6646
+ isMutateFn = true;
6647
+ break;
6648
+ case "shift":
6649
+ index = 0;
6650
+ changeType = "remove";
6651
+ isMutateFn = true;
6652
+ break;
6653
+ case "splice":
6654
+ index = args[0];
6655
+ const deleteCount = args[1];
6656
+ const newItems = args.slice(2);
6657
+ itemsToEmit = newItems;
6658
+ if (deleteCount > 0 && newItems.length === 0) {
6659
+ changeType = "remove";
6660
+ } else if (deleteCount === 0 && newItems.length > 0) {
6661
+ changeType = "add";
6662
+ } else if (deleteCount === 0 && newItems.length === 0) {
6663
+ changeSplice = false;
6664
+ } else {
6665
+ changeType = "update";
6666
+ }
6667
+ isMutateFn = true;
6668
+ break;
6669
+ }
6670
+ const result = origMethod.apply(target, args);
6671
+ if (isMutateFn && changeSplice) {
6672
+ if (prop === "splice") {
6673
+ this.next({
6674
+ type: changeType,
6675
+ index,
6676
+ items: itemsToEmit
6677
+ });
6678
+ } else {
6679
+ this.next({
6680
+ type: changeType,
6681
+ index,
6682
+ items: args
6683
+ });
6684
+ }
6685
+ }
6686
+ return result;
6687
+ };
6688
+ }
6689
+ return Reflect.get(target, prop, receiver);
6690
+ }, "get"),
6691
+ set: /* @__PURE__ */ __name$4((target, prop, value) => {
6692
+ const index = !isNaN(Number(prop)) ? Number(prop) : void 0;
6693
+ target[prop] = value;
6694
+ this.next({
6695
+ type: "update",
6696
+ index,
6697
+ items: [
6698
+ value
6699
+ ]
6700
+ });
6701
+ return true;
6702
+ }, "set")
6703
+ });
6704
+ }
6705
+ get items() {
6706
+ return this._items;
6707
+ }
6708
+ set items(newItems) {
6709
+ this.createProxy(newItems);
6710
+ this.next({
6711
+ type: "reset",
6712
+ items: newItems
6713
+ });
6714
+ }
6715
+ };
6716
+ var ObjectSubject$1 = class ObjectSubject extends BehaviorSubject$1 {
6717
+ static {
6718
+ __name$4(this, "ObjectSubject");
6719
+ }
6720
+ _obj;
6721
+ constructor(obj = {}) {
6722
+ super({
6723
+ type: "init",
6724
+ value: obj
6725
+ });
6726
+ this.createProxy(obj);
6727
+ }
6728
+ createProxy(obj) {
6729
+ this._obj = new Proxy(obj, {
6730
+ get: /* @__PURE__ */ __name$4((target, prop, receiver) => {
6731
+ return Reflect.get(target, prop, receiver);
6732
+ }, "get"),
6733
+ set: /* @__PURE__ */ __name$4((target, prop, value, receiver) => {
6734
+ const key = prop;
6735
+ const changeType = key in target ? "update" : "add";
6736
+ target[key] = value;
6737
+ this.next({
6738
+ type: changeType,
6739
+ key,
6740
+ value
6741
+ });
6742
+ return true;
6743
+ }, "set"),
6744
+ deleteProperty: /* @__PURE__ */ __name$4((target, prop) => {
6745
+ const key = prop;
6746
+ if (key in target) {
6747
+ const value = target[key];
6748
+ delete target[key];
6749
+ this.next({
6750
+ type: "remove",
6751
+ key,
6752
+ value
6753
+ });
6754
+ return true;
6755
+ }
6756
+ return false;
6757
+ }, "deleteProperty")
6758
+ });
6759
+ }
6760
+ get obj() {
6761
+ return this._obj;
6762
+ }
6763
+ set obj(newObj) {
6764
+ this.createProxy(newObj);
6765
+ this.next({
6766
+ type: "reset",
6767
+ value: newObj
6768
+ });
6769
+ }
6770
+ };
6771
+ var getGlobalReactiveStore$1 = /* @__PURE__ */ __name$4(() => {
6772
+ const globalKey = "__REACTIVE_STORE__";
6773
+ if (typeof globalThis !== "undefined") {
6774
+ if (!globalThis[globalKey]) {
6775
+ globalThis[globalKey] = {
6776
+ currentDependencyTracker: null,
6777
+ currentSubscriptionsTracker: null
6778
+ };
6779
+ }
6780
+ return globalThis[globalKey];
6781
+ }
6782
+ let globalObj;
6783
+ if (typeof window !== "undefined") {
6784
+ globalObj = window;
6785
+ } else if (typeof process !== "undefined" && process.versions && process.versions.node) {
6786
+ globalObj = Function("return this")();
6787
+ } else if (typeof self !== "undefined") {
6788
+ globalObj = self;
6789
+ } else {
6790
+ console.warn("Unable to find global object, using local instance");
6791
+ return {
6792
+ currentDependencyTracker: null,
6793
+ currentSubscriptionsTracker: null
6794
+ };
6795
+ }
6796
+ if (!globalObj[globalKey]) {
6797
+ globalObj[globalKey] = {
6798
+ currentDependencyTracker: null,
6799
+ currentSubscriptionsTracker: null
6800
+ };
6801
+ }
6802
+ return globalObj[globalKey];
6803
+ }, "getGlobalReactiveStore");
6804
+ var reactiveStore$1 = getGlobalReactiveStore$1();
6805
+ var trackDependency$1 = /* @__PURE__ */ __name$4((signal2) => {
6806
+ if (reactiveStore$1.currentDependencyTracker) {
6807
+ reactiveStore$1.currentDependencyTracker(signal2);
6808
+ }
6809
+ }, "trackDependency");
6810
+ function signal$1(defaultValue) {
6811
+ let subject;
6812
+ if (Array.isArray(defaultValue)) {
6813
+ subject = new ArraySubject$1(defaultValue);
6814
+ } else if (typeof defaultValue === "object" && defaultValue !== null) {
6815
+ subject = new ObjectSubject$1(defaultValue);
6816
+ } else {
6817
+ subject = new BehaviorSubject$1(defaultValue);
6818
+ }
6819
+ const getValue = /* @__PURE__ */ __name$4(() => {
6820
+ if (subject instanceof ArraySubject$1) {
6821
+ return subject.items;
6822
+ } else if (subject instanceof ObjectSubject$1) {
6823
+ return subject.obj;
6824
+ }
6825
+ return subject.value;
6826
+ }, "getValue");
6827
+ const fn = /* @__PURE__ */ __name$4(function() {
6828
+ trackDependency$1(fn);
6829
+ return getValue();
6830
+ }, "fn");
6831
+ fn.set = (value) => {
6832
+ if (subject instanceof ArraySubject$1) {
6833
+ subject.items = value;
6834
+ } else if (subject instanceof ObjectSubject$1) {
6835
+ subject.obj = value;
6836
+ } else {
6837
+ subject.next(value);
6838
+ }
6839
+ };
6840
+ fn._isFrozen = false;
6841
+ fn.freeze = () => {
6842
+ fn._isFrozen = true;
6843
+ };
6844
+ fn.unfreeze = () => {
6845
+ fn._isFrozen = false;
6846
+ if (subject instanceof ArraySubject$1) {
6847
+ subject.next({
6848
+ type: "init",
6849
+ items: subject.items
6850
+ });
6851
+ } else if (subject instanceof ObjectSubject$1) {
6852
+ subject.next({
6853
+ type: "init",
6854
+ value: subject.obj
6855
+ });
6856
+ } else {
6857
+ subject.next(subject.value);
6858
+ }
6859
+ };
6860
+ fn.mutate = (mutateFn) => {
6861
+ const value = getValue();
6862
+ mutateFn(value);
6863
+ };
6864
+ fn.update = (updateFn) => {
6865
+ const updatedValue = updateFn(getValue());
6866
+ fn.set(updatedValue);
6867
+ };
6868
+ fn.observable = subject.asObservable().pipe(filter$1(() => !fn._isFrozen));
6869
+ fn._subject = subject;
6870
+ return fn;
6871
+ }
6872
+ __name$4(signal$1, "signal");
6873
+ function isSignal$1(value) {
6874
+ return !!(value && value.observable);
6875
+ }
6876
+ __name$4(isSignal$1, "isSignal");
6877
+ function isComputed$1(value) {
6878
+ return isSignal$1(value) && !!value.dependencies;
6879
+ }
6880
+ __name$4(isComputed$1, "isComputed");
6881
+ function computed$1(computeFunction, disposableFn) {
6882
+ const dependencies = /* @__PURE__ */ new Set();
6883
+ let init = true;
6884
+ let lastComputedValue;
6885
+ const previousTracker = reactiveStore$1.currentDependencyTracker;
6886
+ reactiveStore$1.currentDependencyTracker = (signal2) => {
6887
+ dependencies.add(signal2);
6888
+ };
6889
+ lastComputedValue = computeFunction();
6890
+ if (computeFunction["isEffect"]) {
6891
+ disposableFn = lastComputedValue;
6892
+ }
6893
+ reactiveStore$1.currentDependencyTracker = previousTracker;
6894
+ const computedObservable = combineLatest$1([
6895
+ ...dependencies
6896
+ ].map((signal2) => signal2.observable)).pipe(filter$1(() => !init), map$1(() => computeFunction()), finalize$1(() => disposableFn?.()));
6897
+ const fn = /* @__PURE__ */ __name$4(function() {
6898
+ trackDependency$1(fn);
6899
+ return lastComputedValue;
6900
+ }, "fn");
6901
+ fn.observable = computedObservable;
6902
+ fn.subscription = computedObservable.subscribe((value) => {
6903
+ lastComputedValue = value;
6904
+ });
6905
+ fn.dependencies = dependencies;
6906
+ reactiveStore$1.currentSubscriptionsTracker?.(fn.subscription);
6907
+ init = false;
6908
+ return fn;
6909
+ }
6910
+ __name$4(computed$1, "computed");
6911
+ function untracked$1(fn) {
6912
+ const prevDepTracker = reactiveStore$1.currentDependencyTracker;
6913
+ const prevSubTracker = reactiveStore$1.currentSubscriptionsTracker;
6914
+ reactiveStore$1.currentDependencyTracker = null;
6915
+ reactiveStore$1.currentSubscriptionsTracker = null;
6916
+ try {
6917
+ return fn();
6918
+ } finally {
6919
+ reactiveStore$1.currentDependencyTracker = prevDepTracker;
6920
+ reactiveStore$1.currentSubscriptionsTracker = prevSubTracker;
6921
+ }
6922
+ }
6923
+ __name$4(untracked$1, "untracked");
6924
+
6925
+ // src/effect.ts
6926
+ function effect$1(fn) {
6927
+ fn["isEffect"] = true;
6928
+ return computed$1(fn);
6929
+ }
6930
+ __name$4(effect$1, "effect");
6401
6931
 
6402
6932
  var __defProp$5 = Object.defineProperty;
6403
6933
  var __name$3 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
@@ -20572,14 +21102,14 @@ function WithParameterManager(Base) {
20572
21102
  * console.log(player.param[MAXHP]); // Updated value
20573
21103
  * ```
20574
21104
  */
20575
- this._paramsModifierSignal = signal$1({});
21105
+ this._paramsModifierSignal = signal$2({});
20576
21106
  /**
20577
21107
  * Signal for base parameters configuration
20578
21108
  *
20579
21109
  * Stores the start and end values for each parameter's level curve.
20580
21110
  * Changes to this signal trigger recalculation of all parameter values.
20581
21111
  */
20582
- this._parametersSignal = signal$1({});
21112
+ this._parametersSignal = signal$2({});
20583
21113
  /**
20584
21114
  * Computed signal for all parameter values
20585
21115
  *
@@ -20596,7 +21126,7 @@ function WithParameterManager(Base) {
20596
21126
  * console.log(player.param[MAXHP]); // New calculated value
20597
21127
  * ```
20598
21128
  */
20599
- this._param = type$1(computed$1(() => {
21129
+ this._param = type$1(computed$2(() => {
20600
21130
  const obj = {};
20601
21131
  const parameters = this._parametersSignal();
20602
21132
  const level = this._level();
@@ -21609,7 +22139,7 @@ function WithStateManager(Base) {
21609
22139
  return class extends Base {
21610
22140
  constructor() {
21611
22141
  super(...arguments);
21612
- this._statesEfficiency = signal$1([]);
22142
+ this._statesEfficiency = signal$2([]);
21613
22143
  }
21614
22144
  get statesDefense() {
21615
22145
  return this.getFeature("statesDefense", "state");
@@ -21725,7 +22255,7 @@ const _RpgPlayer = class _RpgPlayer extends BasicPlayerMixins(RpgCommonPlayer) {
21725
22255
  /** Last processed client input frame for reconciliation with server tick */
21726
22256
  this._lastFramePositions = null;
21727
22257
  this.frames = [];
21728
- this.events = signal$1([]);
22258
+ this.events = signal$2([]);
21729
22259
  this.expCurve = {
21730
22260
  basis: 30,
21731
22261
  extra: 20,
@@ -22551,7 +23081,7 @@ const _RpgPlayer = class _RpgPlayer extends BasicPlayerMixins(RpgCommonPlayer) {
22551
23081
  */
22552
23082
  setSync(schema) {
22553
23083
  for (let key in schema) {
22554
- this[key] = type$1(signal$1(null), key, {
23084
+ this[key] = type$1(signal$2(null), key, {
22555
23085
  syncWithClient: schema[key]?.$syncWithClient,
22556
23086
  persist: schema[key]?.$permanent
22557
23087
  }, this);
@@ -26096,8 +26626,8 @@ const MapUpdateSchema = object({
26096
26626
  let RpgMap = class extends RpgCommonMap {
26097
26627
  constructor() {
26098
26628
  super();
26099
- this.players = signal$1({});
26100
- this.events = signal$1({});
26629
+ this.players = signal$2({});
26630
+ this.events = signal$2({});
26101
26631
  /**
26102
26632
  * Signal containing the map's database of items, classes, and other game data
26103
26633
  *
@@ -26114,7 +26644,7 @@ let RpgMap = class extends RpgCommonMap {
26114
26644
  * const potion = map.database()['Potion'];
26115
26645
  * ```
26116
26646
  */
26117
- this.database = signal$1({});
26647
+ this.database = signal$2({});
26118
26648
  /**
26119
26649
  * Array of map configurations - can contain MapOptions objects or instances of map classes
26120
26650
  *
@@ -27287,7 +27817,7 @@ let RpgMap = class extends RpgCommonMap {
27287
27817
  for (let key in schema) {
27288
27818
  const initial = typeof schema[key]?.$initial !== "undefined" ? schema[key].$initial : null;
27289
27819
  const holder = {};
27290
- this[key] = type$1(signal$1(initial), key, {
27820
+ this[key] = type$1(signal$2(initial), key, {
27291
27821
  syncToClient: schema[key]?.$syncWithClient,
27292
27822
  persist: schema[key]?.$permanent
27293
27823
  }, holder);
@@ -27671,7 +28201,7 @@ var __decorateClass = (decorators, target, key, kind) => {
27671
28201
  };
27672
28202
  let LobbyRoom = class {
27673
28203
  constructor() {
27674
- this.players = signal$1({});
28204
+ this.players = signal$2({});
27675
28205
  }
27676
28206
  onJoin(player, conn) {
27677
28207
  player.map = this;
@@ -28075,5 +28605,5 @@ function MapData(options) {
28075
28605
  };
28076
28606
  }
28077
28607
 
28078
- export { AGI, AGI_CURVE, ATK, ArraySubject$1 as ArraySubject, COEFFICIENT_ELEMENTS, Components, DAMAGE_CRITICAL, DAMAGE_GUARD, DAMAGE_PHYSIC, DAMAGE_SKILL, DEX, DEX_CURVE, DialogGui, DialogPosition, EventData, EventMode, Frequency, Gui, INT, INT_CURVE, MAXHP, MAXHP_CURVE, MAXSP, MAXSP_CURVE, MapData, MenuGui, Move, NotificationGui, ObjectSubject$1 as ObjectSubject, PDEF, RpgEvent, RpgMap, RpgModule, RpgPlayer, RpgServerEngine, RpgShape, SDEF, STR, STR_CURVE, ShopGui, Speed, WithMoveManager, clearInject, computed$1 as computed, context, createServer, effect$1 as effect, inject, isArraySubject$1 as isArraySubject, isComputed$1 as isComputed, isObjectSubject$1 as isObjectSubject, isSignal$1 as isSignal, provideServerModules, setInject, signal$1 as signal, untracked$1 as untracked };
28608
+ export { AGI, AGI_CURVE, ATK, ArraySubject$2 as ArraySubject, COEFFICIENT_ELEMENTS, Components, DAMAGE_CRITICAL, DAMAGE_GUARD, DAMAGE_PHYSIC, DAMAGE_SKILL, DEX, DEX_CURVE, DialogGui, DialogPosition, EventData, EventMode, Frequency, Gui, INT, INT_CURVE, MAXHP, MAXHP_CURVE, MAXSP, MAXSP_CURVE, MapData, MenuGui, Move, NotificationGui, ObjectSubject$2 as ObjectSubject, PDEF, RpgEvent, RpgMap, RpgModule, RpgPlayer, RpgServerEngine, RpgShape, SDEF, STR, STR_CURVE, ShopGui, Speed, WithMoveManager, clearInject, computed$2 as computed, context, createServer, effect$2 as effect, inject, isArraySubject$1 as isArraySubject, isComputed$2 as isComputed, isObjectSubject$1 as isObjectSubject, isSignal$2 as isSignal, linkedSignal, provideServerModules, setInject, signal$2 as signal, untracked$2 as untracked };
28079
28609
  //# sourceMappingURL=index.js.map