@rebasepro/server-core 0.0.1-canary.f81da60 → 0.1.2

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.es.js CHANGED
@@ -1020,13 +1020,30 @@ var object_hash = { exports: {} };
1020
1020
  }, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
1021
1021
  });
1022
1022
  })(object_hash);
1023
- const snakeCaseRegex = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g;
1023
+ const tokenizeRegex = /[A-Z]{2,}(?=[A-Z][a-z]|\b)|[A-Z]?[a-z]+|[0-9]+(?:[a-z](?![a-z]))?|[A-Z]/g;
1024
+ const snakeCaseRegex = tokenizeRegex;
1024
1025
  const toSnakeCase = (str) => {
1025
1026
  const regExpMatchArray = str.match(snakeCaseRegex);
1026
1027
  if (!regExpMatchArray) return "";
1027
1028
  return regExpMatchArray.map((x) => x.toLowerCase()).join("_");
1028
1029
  };
1029
- function isObject$a(item) {
1030
+ function deepClone(value) {
1031
+ if (value === null || value === void 0) return value;
1032
+ if (typeof value === "function") return value;
1033
+ if (typeof value !== "object") return value;
1034
+ if (Array.isArray(value)) {
1035
+ return value.map((item) => deepClone(item));
1036
+ }
1037
+ if (Object.getPrototypeOf(value) !== Object.prototype) {
1038
+ return value;
1039
+ }
1040
+ const result = {};
1041
+ for (const key of Object.keys(value)) {
1042
+ result[key] = deepClone(value[key]);
1043
+ }
1044
+ return result;
1045
+ }
1046
+ function isObject$4(item) {
1030
1047
  return !!item && typeof item === "object" && !Array.isArray(item);
1031
1048
  }
1032
1049
  function isPlainObject$3(obj) {
@@ -1037,13 +1054,13 @@ function isPlainObject$3(obj) {
1037
1054
  return proto === Object.prototype;
1038
1055
  }
1039
1056
  function mergeDeep(target, source, ignoreUndefined = false) {
1040
- if (!isObject$a(target)) {
1057
+ if (!isObject$4(target)) {
1041
1058
  return target;
1042
1059
  }
1043
1060
  const output = {
1044
1061
  ...target
1045
1062
  };
1046
- if (!isObject$a(source)) {
1063
+ if (!isObject$4(source)) {
1047
1064
  return output;
1048
1065
  }
1049
1066
  for (const key in source) {
@@ -1084,7 +1101,7 @@ function mergeDeep(target, source, ignoreUndefined = false) {
1084
1101
  } else {
1085
1102
  output[key] = sourceValue;
1086
1103
  }
1087
- } else if (isObject$a(sourceValue)) {
1104
+ } else if (isObject$4(sourceValue)) {
1088
1105
  output[key] = sourceValue;
1089
1106
  } else {
1090
1107
  output[key] = sourceValue;
@@ -1354,7 +1371,7 @@ function findRelation(resolvedRelations, key) {
1354
1371
  }
1355
1372
  var logic = { exports: {} };
1356
1373
  (function(module, exports$1) {
1357
- (function(root2, factory) {
1374
+ (function(root, factory) {
1358
1375
  {
1359
1376
  module.exports = factory();
1360
1377
  }
@@ -1722,7 +1739,7 @@ var logic = { exports: {} };
1722
1739
  });
1723
1740
  })(logic);
1724
1741
  const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
1725
- const { hasOwnProperty: hasOwnProperty$d } = Object.prototype;
1742
+ const { hasOwnProperty: hasOwnProperty$3 } = Object.prototype;
1726
1743
  function combineComparators(comparatorA, comparatorB) {
1727
1744
  return function isEqual(a2, b, state) {
1728
1745
  return comparatorA(a2, b, state) && comparatorB(a2, b, state);
@@ -1752,12 +1769,12 @@ function getStrictProperties(object) {
1752
1769
  }
1753
1770
  const hasOwn$1 = (
1754
1771
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1755
- Object.hasOwn || ((object, property) => hasOwnProperty$d.call(object, property))
1772
+ Object.hasOwn || ((object, property) => hasOwnProperty$3.call(object, property))
1756
1773
  );
1757
1774
  const PREACT_VNODE = "__v";
1758
1775
  const PREACT_OWNER = "__o";
1759
1776
  const REACT_OWNER = "_owner";
1760
- const { getOwnPropertyDescriptor, keys: keys$5 } = Object;
1777
+ const { getOwnPropertyDescriptor, keys: keys$1 } = Object;
1761
1778
  const sameValueEqual = (
1762
1779
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1763
1780
  Object.is || function sameValueEqual2(a2, b) {
@@ -1835,9 +1852,9 @@ function areMapsEqual(a2, b, state) {
1835
1852
  return true;
1836
1853
  }
1837
1854
  function areObjectsEqual(a2, b, state) {
1838
- const properties = keys$5(a2);
1855
+ const properties = keys$1(a2);
1839
1856
  let index = properties.length;
1840
- if (keys$5(b).length !== index) {
1857
+ if (keys$1(b).length !== index) {
1841
1858
  return false;
1842
1859
  }
1843
1860
  while (index-- > 0) {
@@ -2140,982 +2157,6 @@ function createCustomEqual(options2 = {}) {
2140
2157
  const equals = createCustomInternalComparator ? createCustomInternalComparator(comparator2) : createInternalEqualityComparator(comparator2);
2141
2158
  return createIsEqual({ circular, comparator: comparator2, createState, equals, strict });
2142
2159
  }
2143
- function listCacheClear$1() {
2144
- this.__data__ = [];
2145
- this.size = 0;
2146
- }
2147
- var _listCacheClear = listCacheClear$1;
2148
- function eq$5(value, other) {
2149
- return value === other || value !== value && other !== other;
2150
- }
2151
- var eq_1$1 = eq$5;
2152
- var eq$4 = eq_1$1;
2153
- function assocIndexOf$4(array, key) {
2154
- var length = array.length;
2155
- while (length--) {
2156
- if (eq$4(array[length][0], key)) {
2157
- return length;
2158
- }
2159
- }
2160
- return -1;
2161
- }
2162
- var _assocIndexOf = assocIndexOf$4;
2163
- var assocIndexOf$3 = _assocIndexOf;
2164
- var arrayProto = Array.prototype;
2165
- var splice = arrayProto.splice;
2166
- function listCacheDelete$1(key) {
2167
- var data = this.__data__, index = assocIndexOf$3(data, key);
2168
- if (index < 0) {
2169
- return false;
2170
- }
2171
- var lastIndex = data.length - 1;
2172
- if (index == lastIndex) {
2173
- data.pop();
2174
- } else {
2175
- splice.call(data, index, 1);
2176
- }
2177
- --this.size;
2178
- return true;
2179
- }
2180
- var _listCacheDelete = listCacheDelete$1;
2181
- var assocIndexOf$2 = _assocIndexOf;
2182
- function listCacheGet$1(key) {
2183
- var data = this.__data__, index = assocIndexOf$2(data, key);
2184
- return index < 0 ? void 0 : data[index][1];
2185
- }
2186
- var _listCacheGet = listCacheGet$1;
2187
- var assocIndexOf$1 = _assocIndexOf;
2188
- function listCacheHas$1(key) {
2189
- return assocIndexOf$1(this.__data__, key) > -1;
2190
- }
2191
- var _listCacheHas = listCacheHas$1;
2192
- var assocIndexOf = _assocIndexOf;
2193
- function listCacheSet$1(key, value) {
2194
- var data = this.__data__, index = assocIndexOf(data, key);
2195
- if (index < 0) {
2196
- ++this.size;
2197
- data.push([key, value]);
2198
- } else {
2199
- data[index][1] = value;
2200
- }
2201
- return this;
2202
- }
2203
- var _listCacheSet = listCacheSet$1;
2204
- var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
2205
- function ListCache$4(entries) {
2206
- var index = -1, length = entries == null ? 0 : entries.length;
2207
- this.clear();
2208
- while (++index < length) {
2209
- var entry = entries[index];
2210
- this.set(entry[0], entry[1]);
2211
- }
2212
- }
2213
- ListCache$4.prototype.clear = listCacheClear;
2214
- ListCache$4.prototype["delete"] = listCacheDelete;
2215
- ListCache$4.prototype.get = listCacheGet;
2216
- ListCache$4.prototype.has = listCacheHas;
2217
- ListCache$4.prototype.set = listCacheSet;
2218
- var _ListCache = ListCache$4;
2219
- var ListCache$3 = _ListCache;
2220
- function stackClear$1() {
2221
- this.__data__ = new ListCache$3();
2222
- this.size = 0;
2223
- }
2224
- var _stackClear = stackClear$1;
2225
- function stackDelete$1(key) {
2226
- var data = this.__data__, result = data["delete"](key);
2227
- this.size = data.size;
2228
- return result;
2229
- }
2230
- var _stackDelete = stackDelete$1;
2231
- function stackGet$1(key) {
2232
- return this.__data__.get(key);
2233
- }
2234
- var _stackGet = stackGet$1;
2235
- function stackHas$1(key) {
2236
- return this.__data__.has(key);
2237
- }
2238
- var _stackHas = stackHas$1;
2239
- var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2240
- var _freeGlobal = freeGlobal$1;
2241
- var freeGlobal = _freeGlobal;
2242
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
2243
- var root$8 = freeGlobal || freeSelf || Function("return this")();
2244
- var _root = root$8;
2245
- var root$7 = _root;
2246
- var Symbol$4 = root$7.Symbol;
2247
- var _Symbol = Symbol$4;
2248
- var Symbol$3 = _Symbol;
2249
- var objectProto$j = Object.prototype;
2250
- var hasOwnProperty$c = objectProto$j.hasOwnProperty;
2251
- var nativeObjectToString$1 = objectProto$j.toString;
2252
- var symToStringTag$1 = Symbol$3 ? Symbol$3.toStringTag : void 0;
2253
- function getRawTag$1(value) {
2254
- var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
2255
- try {
2256
- value[symToStringTag$1] = void 0;
2257
- var unmasked = true;
2258
- } catch (e) {
2259
- }
2260
- var result = nativeObjectToString$1.call(value);
2261
- if (unmasked) {
2262
- if (isOwn) {
2263
- value[symToStringTag$1] = tag;
2264
- } else {
2265
- delete value[symToStringTag$1];
2266
- }
2267
- }
2268
- return result;
2269
- }
2270
- var _getRawTag = getRawTag$1;
2271
- var objectProto$i = Object.prototype;
2272
- var nativeObjectToString = objectProto$i.toString;
2273
- function objectToString$8(value) {
2274
- return nativeObjectToString.call(value);
2275
- }
2276
- var _objectToString = objectToString$8;
2277
- var Symbol$2 = _Symbol, getRawTag = _getRawTag, objectToString$7 = _objectToString;
2278
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
2279
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
2280
- function baseGetTag$4(value) {
2281
- if (value == null) {
2282
- return value === void 0 ? undefinedTag : nullTag;
2283
- }
2284
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$7(value);
2285
- }
2286
- var _baseGetTag = baseGetTag$4;
2287
- function isObject$9(value) {
2288
- var type = typeof value;
2289
- return value != null && (type == "object" || type == "function");
2290
- }
2291
- var isObject_1 = isObject$9;
2292
- var baseGetTag$3 = _baseGetTag, isObject$8 = isObject_1;
2293
- var asyncTag = "[object AsyncFunction]", funcTag$3 = "[object Function]", genTag$2 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
2294
- function isFunction$3(value) {
2295
- if (!isObject$8(value)) {
2296
- return false;
2297
- }
2298
- var tag = baseGetTag$3(value);
2299
- return tag == funcTag$3 || tag == genTag$2 || tag == asyncTag || tag == proxyTag;
2300
- }
2301
- var isFunction_1 = isFunction$3;
2302
- var root$6 = _root;
2303
- var coreJsData$1 = root$6["__core-js_shared__"];
2304
- var _coreJsData = coreJsData$1;
2305
- var coreJsData = _coreJsData;
2306
- var maskSrcKey = function() {
2307
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
2308
- return uid ? "Symbol(src)_1." + uid : "";
2309
- }();
2310
- function isMasked$1(func) {
2311
- return !!maskSrcKey && maskSrcKey in func;
2312
- }
2313
- var _isMasked = isMasked$1;
2314
- var funcProto$2 = Function.prototype;
2315
- var funcToString$2 = funcProto$2.toString;
2316
- function toSource$2(func) {
2317
- if (func != null) {
2318
- try {
2319
- return funcToString$2.call(func);
2320
- } catch (e) {
2321
- }
2322
- try {
2323
- return func + "";
2324
- } catch (e) {
2325
- }
2326
- }
2327
- return "";
2328
- }
2329
- var _toSource = toSource$2;
2330
- var isFunction$2 = isFunction_1, isMasked = _isMasked, isObject$7 = isObject_1, toSource$1 = _toSource;
2331
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
2332
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
2333
- var funcProto$1 = Function.prototype, objectProto$h = Object.prototype;
2334
- var funcToString$1 = funcProto$1.toString;
2335
- var hasOwnProperty$b = objectProto$h.hasOwnProperty;
2336
- var reIsNative = RegExp(
2337
- "^" + funcToString$1.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2338
- );
2339
- function baseIsNative$1(value) {
2340
- if (!isObject$7(value) || isMasked(value)) {
2341
- return false;
2342
- }
2343
- var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
2344
- return pattern.test(toSource$1(value));
2345
- }
2346
- var _baseIsNative = baseIsNative$1;
2347
- function getValue$1(object, key) {
2348
- return object == null ? void 0 : object[key];
2349
- }
2350
- var _getValue = getValue$1;
2351
- var baseIsNative = _baseIsNative, getValue = _getValue;
2352
- function getNative$7(object, key) {
2353
- var value = getValue(object, key);
2354
- return baseIsNative(value) ? value : void 0;
2355
- }
2356
- var _getNative = getNative$7;
2357
- var getNative$6 = _getNative, root$5 = _root;
2358
- var Map$4 = getNative$6(root$5, "Map");
2359
- var _Map = Map$4;
2360
- var getNative$5 = _getNative;
2361
- var nativeCreate$4 = getNative$5(Object, "create");
2362
- var _nativeCreate = nativeCreate$4;
2363
- var nativeCreate$3 = _nativeCreate;
2364
- function hashClear$1() {
2365
- this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
2366
- this.size = 0;
2367
- }
2368
- var _hashClear = hashClear$1;
2369
- function hashDelete$1(key) {
2370
- var result = this.has(key) && delete this.__data__[key];
2371
- this.size -= result ? 1 : 0;
2372
- return result;
2373
- }
2374
- var _hashDelete = hashDelete$1;
2375
- var nativeCreate$2 = _nativeCreate;
2376
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
2377
- var objectProto$g = Object.prototype;
2378
- var hasOwnProperty$a = objectProto$g.hasOwnProperty;
2379
- function hashGet$1(key) {
2380
- var data = this.__data__;
2381
- if (nativeCreate$2) {
2382
- var result = data[key];
2383
- return result === HASH_UNDEFINED$1 ? void 0 : result;
2384
- }
2385
- return hasOwnProperty$a.call(data, key) ? data[key] : void 0;
2386
- }
2387
- var _hashGet = hashGet$1;
2388
- var nativeCreate$1 = _nativeCreate;
2389
- var objectProto$f = Object.prototype;
2390
- var hasOwnProperty$9 = objectProto$f.hasOwnProperty;
2391
- function hashHas$1(key) {
2392
- var data = this.__data__;
2393
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$9.call(data, key);
2394
- }
2395
- var _hashHas = hashHas$1;
2396
- var nativeCreate = _nativeCreate;
2397
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
2398
- function hashSet$1(key, value) {
2399
- var data = this.__data__;
2400
- this.size += this.has(key) ? 0 : 1;
2401
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
2402
- return this;
2403
- }
2404
- var _hashSet = hashSet$1;
2405
- var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
2406
- function Hash$1(entries) {
2407
- var index = -1, length = entries == null ? 0 : entries.length;
2408
- this.clear();
2409
- while (++index < length) {
2410
- var entry = entries[index];
2411
- this.set(entry[0], entry[1]);
2412
- }
2413
- }
2414
- Hash$1.prototype.clear = hashClear;
2415
- Hash$1.prototype["delete"] = hashDelete;
2416
- Hash$1.prototype.get = hashGet;
2417
- Hash$1.prototype.has = hashHas;
2418
- Hash$1.prototype.set = hashSet;
2419
- var _Hash = Hash$1;
2420
- var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map;
2421
- function mapCacheClear$1() {
2422
- this.size = 0;
2423
- this.__data__ = {
2424
- "hash": new Hash(),
2425
- "map": new (Map$3 || ListCache$2)(),
2426
- "string": new Hash()
2427
- };
2428
- }
2429
- var _mapCacheClear = mapCacheClear$1;
2430
- function isKeyable$1(value) {
2431
- var type = typeof value;
2432
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
2433
- }
2434
- var _isKeyable = isKeyable$1;
2435
- var isKeyable = _isKeyable;
2436
- function getMapData$4(map2, key) {
2437
- var data = map2.__data__;
2438
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
2439
- }
2440
- var _getMapData = getMapData$4;
2441
- var getMapData$3 = _getMapData;
2442
- function mapCacheDelete$1(key) {
2443
- var result = getMapData$3(this, key)["delete"](key);
2444
- this.size -= result ? 1 : 0;
2445
- return result;
2446
- }
2447
- var _mapCacheDelete = mapCacheDelete$1;
2448
- var getMapData$2 = _getMapData;
2449
- function mapCacheGet$1(key) {
2450
- return getMapData$2(this, key).get(key);
2451
- }
2452
- var _mapCacheGet = mapCacheGet$1;
2453
- var getMapData$1 = _getMapData;
2454
- function mapCacheHas$1(key) {
2455
- return getMapData$1(this, key).has(key);
2456
- }
2457
- var _mapCacheHas = mapCacheHas$1;
2458
- var getMapData = _getMapData;
2459
- function mapCacheSet$1(key, value) {
2460
- var data = getMapData(this, key), size = data.size;
2461
- data.set(key, value);
2462
- this.size += data.size == size ? 0 : 1;
2463
- return this;
2464
- }
2465
- var _mapCacheSet = mapCacheSet$1;
2466
- var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
2467
- function MapCache$1(entries) {
2468
- var index = -1, length = entries == null ? 0 : entries.length;
2469
- this.clear();
2470
- while (++index < length) {
2471
- var entry = entries[index];
2472
- this.set(entry[0], entry[1]);
2473
- }
2474
- }
2475
- MapCache$1.prototype.clear = mapCacheClear;
2476
- MapCache$1.prototype["delete"] = mapCacheDelete;
2477
- MapCache$1.prototype.get = mapCacheGet;
2478
- MapCache$1.prototype.has = mapCacheHas;
2479
- MapCache$1.prototype.set = mapCacheSet;
2480
- var _MapCache = MapCache$1;
2481
- var ListCache$1 = _ListCache, Map$2 = _Map, MapCache = _MapCache;
2482
- var LARGE_ARRAY_SIZE = 200;
2483
- function stackSet$1(key, value) {
2484
- var data = this.__data__;
2485
- if (data instanceof ListCache$1) {
2486
- var pairs = data.__data__;
2487
- if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
2488
- pairs.push([key, value]);
2489
- this.size = ++data.size;
2490
- return this;
2491
- }
2492
- data = this.__data__ = new MapCache(pairs);
2493
- }
2494
- data.set(key, value);
2495
- this.size = data.size;
2496
- return this;
2497
- }
2498
- var _stackSet = stackSet$1;
2499
- var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
2500
- function Stack$1(entries) {
2501
- var data = this.__data__ = new ListCache(entries);
2502
- this.size = data.size;
2503
- }
2504
- Stack$1.prototype.clear = stackClear;
2505
- Stack$1.prototype["delete"] = stackDelete;
2506
- Stack$1.prototype.get = stackGet;
2507
- Stack$1.prototype.has = stackHas;
2508
- Stack$1.prototype.set = stackSet;
2509
- var _Stack = Stack$1;
2510
- function arrayEach$1(array, iteratee) {
2511
- var index = -1, length = array == null ? 0 : array.length;
2512
- while (++index < length) {
2513
- if (iteratee(array[index], index, array) === false) {
2514
- break;
2515
- }
2516
- }
2517
- return array;
2518
- }
2519
- var _arrayEach = arrayEach$1;
2520
- var getNative$4 = _getNative;
2521
- var defineProperty$2 = function() {
2522
- try {
2523
- var func = getNative$4(Object, "defineProperty");
2524
- func({}, "", {});
2525
- return func;
2526
- } catch (e) {
2527
- }
2528
- }();
2529
- var _defineProperty = defineProperty$2;
2530
- var defineProperty$1 = _defineProperty;
2531
- function baseAssignValue$2(object, key, value) {
2532
- if (key == "__proto__" && defineProperty$1) {
2533
- defineProperty$1(object, key, {
2534
- "configurable": true,
2535
- "enumerable": true,
2536
- "value": value,
2537
- "writable": true
2538
- });
2539
- } else {
2540
- object[key] = value;
2541
- }
2542
- }
2543
- var _baseAssignValue = baseAssignValue$2;
2544
- var baseAssignValue$1 = _baseAssignValue, eq$3 = eq_1$1;
2545
- var objectProto$e = Object.prototype;
2546
- var hasOwnProperty$8 = objectProto$e.hasOwnProperty;
2547
- function assignValue$2(object, key, value) {
2548
- var objValue = object[key];
2549
- if (!(hasOwnProperty$8.call(object, key) && eq$3(objValue, value)) || value === void 0 && !(key in object)) {
2550
- baseAssignValue$1(object, key, value);
2551
- }
2552
- }
2553
- var _assignValue = assignValue$2;
2554
- var assignValue$1 = _assignValue, baseAssignValue = _baseAssignValue;
2555
- function copyObject$4(source, props, object, customizer) {
2556
- var isNew = !object;
2557
- object || (object = {});
2558
- var index = -1, length = props.length;
2559
- while (++index < length) {
2560
- var key = props[index];
2561
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
2562
- if (newValue === void 0) {
2563
- newValue = source[key];
2564
- }
2565
- if (isNew) {
2566
- baseAssignValue(object, key, newValue);
2567
- } else {
2568
- assignValue$1(object, key, newValue);
2569
- }
2570
- }
2571
- return object;
2572
- }
2573
- var _copyObject = copyObject$4;
2574
- function baseTimes$2(n, iteratee) {
2575
- var index = -1, result = Array(n);
2576
- while (++index < n) {
2577
- result[index] = iteratee(index);
2578
- }
2579
- return result;
2580
- }
2581
- var _baseTimes = baseTimes$2;
2582
- function isObjectLike$d(value) {
2583
- return value != null && typeof value == "object";
2584
- }
2585
- var isObjectLike_1 = isObjectLike$d;
2586
- var baseGetTag$2 = _baseGetTag, isObjectLike$c = isObjectLike_1;
2587
- var argsTag$3 = "[object Arguments]";
2588
- function baseIsArguments$1(value) {
2589
- return isObjectLike$c(value) && baseGetTag$2(value) == argsTag$3;
2590
- }
2591
- var _baseIsArguments = baseIsArguments$1;
2592
- var baseIsArguments = _baseIsArguments, isObjectLike$b = isObjectLike_1;
2593
- var objectProto$d = Object.prototype;
2594
- var hasOwnProperty$7 = objectProto$d.hasOwnProperty;
2595
- var propertyIsEnumerable$2 = objectProto$d.propertyIsEnumerable;
2596
- var isArguments$2 = baseIsArguments(/* @__PURE__ */ function() {
2597
- return arguments;
2598
- }()) ? baseIsArguments : function(value) {
2599
- return isObjectLike$b(value) && hasOwnProperty$7.call(value, "callee") && !propertyIsEnumerable$2.call(value, "callee");
2600
- };
2601
- var isArguments_1 = isArguments$2;
2602
- var isArray$6 = Array.isArray;
2603
- var isArray_1 = isArray$6;
2604
- var isBuffer$2 = { exports: {} };
2605
- function stubFalse() {
2606
- return false;
2607
- }
2608
- var stubFalse_1 = stubFalse;
2609
- isBuffer$2.exports;
2610
- (function(module, exports$1) {
2611
- var root2 = _root, stubFalse2 = stubFalse_1;
2612
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2613
- var freeModule = freeExports && true && module && !module.nodeType && module;
2614
- var moduleExports = freeModule && freeModule.exports === freeExports;
2615
- var Buffer2 = moduleExports ? root2.Buffer : void 0;
2616
- var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
2617
- var isBuffer2 = nativeIsBuffer || stubFalse2;
2618
- module.exports = isBuffer2;
2619
- })(isBuffer$2, isBuffer$2.exports);
2620
- var isBufferExports = isBuffer$2.exports;
2621
- var MAX_SAFE_INTEGER$4 = 9007199254740991;
2622
- var reIsUint$1 = /^(?:0|[1-9]\d*)$/;
2623
- function isIndex$2(value, length) {
2624
- var type = typeof value;
2625
- length = length == null ? MAX_SAFE_INTEGER$4 : length;
2626
- return !!length && (type == "number" || type != "symbol" && reIsUint$1.test(value)) && (value > -1 && value % 1 == 0 && value < length);
2627
- }
2628
- var _isIndex = isIndex$2;
2629
- var MAX_SAFE_INTEGER$3 = 9007199254740991;
2630
- function isLength$3(value) {
2631
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$3;
2632
- }
2633
- var isLength_1 = isLength$3;
2634
- var baseGetTag$1 = _baseGetTag, isLength$2 = isLength_1, isObjectLike$a = isObjectLike_1;
2635
- var argsTag$2 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$2 = "[object Date]", errorTag$1 = "[object Error]", funcTag$2 = "[object Function]", mapTag$4 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$2 = "[object RegExp]", setTag$4 = "[object Set]", stringTag$4 = "[object String]", weakMapTag$2 = "[object WeakMap]";
2636
- var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$3 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
2637
- var typedArrayTags = {};
2638
- typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
2639
- typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$2] = typedArrayTags[mapTag$4] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$2] = typedArrayTags[setTag$4] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$2] = false;
2640
- function baseIsTypedArray$1(value) {
2641
- return isObjectLike$a(value) && isLength$2(value.length) && !!typedArrayTags[baseGetTag$1(value)];
2642
- }
2643
- var _baseIsTypedArray = baseIsTypedArray$1;
2644
- function baseUnary$3(func) {
2645
- return function(value) {
2646
- return func(value);
2647
- };
2648
- }
2649
- var _baseUnary = baseUnary$3;
2650
- var _nodeUtil = { exports: {} };
2651
- _nodeUtil.exports;
2652
- (function(module, exports$1) {
2653
- var freeGlobal2 = _freeGlobal;
2654
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2655
- var freeModule = freeExports && true && module && !module.nodeType && module;
2656
- var moduleExports = freeModule && freeModule.exports === freeExports;
2657
- var freeProcess = moduleExports && freeGlobal2.process;
2658
- var nodeUtil2 = function() {
2659
- try {
2660
- var types2 = freeModule && freeModule.require && freeModule.require("util").types;
2661
- if (types2) {
2662
- return types2;
2663
- }
2664
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
2665
- } catch (e) {
2666
- }
2667
- }();
2668
- module.exports = nodeUtil2;
2669
- })(_nodeUtil, _nodeUtil.exports);
2670
- var _nodeUtilExports = _nodeUtil.exports;
2671
- var baseIsTypedArray = _baseIsTypedArray, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
2672
- var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
2673
- var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
2674
- var isTypedArray_1 = isTypedArray$1;
2675
- var baseTimes$1 = _baseTimes, isArguments$1 = isArguments_1, isArray$5 = isArray_1, isBuffer$1 = isBufferExports, isIndex$1 = _isIndex, isTypedArray = isTypedArray_1;
2676
- var objectProto$c = Object.prototype;
2677
- var hasOwnProperty$6 = objectProto$c.hasOwnProperty;
2678
- function arrayLikeKeys$3(value, inherited) {
2679
- var isArr = isArray$5(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType2 = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType2, result = skipIndexes ? baseTimes$1(value.length, String) : [], length = result.length;
2680
- for (var key in value) {
2681
- if ((inherited || hasOwnProperty$6.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
2682
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2683
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2684
- isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
2685
- isIndex$1(key, length)))) {
2686
- result.push(key);
2687
- }
2688
- }
2689
- return result;
2690
- }
2691
- var _arrayLikeKeys = arrayLikeKeys$3;
2692
- var objectProto$b = Object.prototype;
2693
- function isPrototype$4(value) {
2694
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$b;
2695
- return value === proto;
2696
- }
2697
- var _isPrototype = isPrototype$4;
2698
- function overArg$4(func, transform) {
2699
- return function(arg) {
2700
- return func(transform(arg));
2701
- };
2702
- }
2703
- var _overArg = overArg$4;
2704
- var overArg$3 = _overArg;
2705
- var nativeKeys$2 = overArg$3(Object.keys, Object);
2706
- var _nativeKeys = nativeKeys$2;
2707
- var isPrototype$3 = _isPrototype, nativeKeys$1 = _nativeKeys;
2708
- var objectProto$a = Object.prototype;
2709
- var hasOwnProperty$5 = objectProto$a.hasOwnProperty;
2710
- function baseKeys$2(object) {
2711
- if (!isPrototype$3(object)) {
2712
- return nativeKeys$1(object);
2713
- }
2714
- var result = [];
2715
- for (var key in Object(object)) {
2716
- if (hasOwnProperty$5.call(object, key) && key != "constructor") {
2717
- result.push(key);
2718
- }
2719
- }
2720
- return result;
2721
- }
2722
- var _baseKeys = baseKeys$2;
2723
- var isFunction$1 = isFunction_1, isLength$1 = isLength_1;
2724
- function isArrayLike$3(value) {
2725
- return value != null && isLength$1(value.length) && !isFunction$1(value);
2726
- }
2727
- var isArrayLike_1 = isArrayLike$3;
2728
- var arrayLikeKeys$2 = _arrayLikeKeys, baseKeys$1 = _baseKeys, isArrayLike$2 = isArrayLike_1;
2729
- function keys$4(object) {
2730
- return isArrayLike$2(object) ? arrayLikeKeys$2(object) : baseKeys$1(object);
2731
- }
2732
- var keys_1 = keys$4;
2733
- var copyObject$3 = _copyObject, keys$3 = keys_1;
2734
- function baseAssign$1(object, source) {
2735
- return object && copyObject$3(source, keys$3(source), object);
2736
- }
2737
- var _baseAssign = baseAssign$1;
2738
- function nativeKeysIn$1(object) {
2739
- var result = [];
2740
- if (object != null) {
2741
- for (var key in Object(object)) {
2742
- result.push(key);
2743
- }
2744
- }
2745
- return result;
2746
- }
2747
- var _nativeKeysIn = nativeKeysIn$1;
2748
- var isObject$6 = isObject_1, isPrototype$2 = _isPrototype, nativeKeysIn = _nativeKeysIn;
2749
- var objectProto$9 = Object.prototype;
2750
- var hasOwnProperty$4 = objectProto$9.hasOwnProperty;
2751
- function baseKeysIn$1(object) {
2752
- if (!isObject$6(object)) {
2753
- return nativeKeysIn(object);
2754
- }
2755
- var isProto = isPrototype$2(object), result = [];
2756
- for (var key in object) {
2757
- if (!(key == "constructor" && (isProto || !hasOwnProperty$4.call(object, key)))) {
2758
- result.push(key);
2759
- }
2760
- }
2761
- return result;
2762
- }
2763
- var _baseKeysIn = baseKeysIn$1;
2764
- var arrayLikeKeys$1 = _arrayLikeKeys, baseKeysIn = _baseKeysIn, isArrayLike$1 = isArrayLike_1;
2765
- function keysIn$3(object) {
2766
- return isArrayLike$1(object) ? arrayLikeKeys$1(object, true) : baseKeysIn(object);
2767
- }
2768
- var keysIn_1 = keysIn$3;
2769
- var copyObject$2 = _copyObject, keysIn$2 = keysIn_1;
2770
- function baseAssignIn$1(object, source) {
2771
- return object && copyObject$2(source, keysIn$2(source), object);
2772
- }
2773
- var _baseAssignIn = baseAssignIn$1;
2774
- var _cloneBuffer = { exports: {} };
2775
- _cloneBuffer.exports;
2776
- (function(module, exports$1) {
2777
- var root2 = _root;
2778
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
2779
- var freeModule = freeExports && true && module && !module.nodeType && module;
2780
- var moduleExports = freeModule && freeModule.exports === freeExports;
2781
- var Buffer2 = moduleExports ? root2.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
2782
- function cloneBuffer2(buffer, isDeep) {
2783
- if (isDeep) {
2784
- return buffer.slice();
2785
- }
2786
- var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
2787
- buffer.copy(result);
2788
- return result;
2789
- }
2790
- module.exports = cloneBuffer2;
2791
- })(_cloneBuffer, _cloneBuffer.exports);
2792
- var _cloneBufferExports = _cloneBuffer.exports;
2793
- function copyArray$1(source, array) {
2794
- var index = -1, length = source.length;
2795
- array || (array = Array(length));
2796
- while (++index < length) {
2797
- array[index] = source[index];
2798
- }
2799
- return array;
2800
- }
2801
- var _copyArray = copyArray$1;
2802
- function arrayFilter$1(array, predicate) {
2803
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
2804
- while (++index < length) {
2805
- var value = array[index];
2806
- if (predicate(value, index, array)) {
2807
- result[resIndex++] = value;
2808
- }
2809
- }
2810
- return result;
2811
- }
2812
- var _arrayFilter = arrayFilter$1;
2813
- function stubArray$2() {
2814
- return [];
2815
- }
2816
- var stubArray_1 = stubArray$2;
2817
- var arrayFilter = _arrayFilter, stubArray$1 = stubArray_1;
2818
- var objectProto$8 = Object.prototype;
2819
- var propertyIsEnumerable$1 = objectProto$8.propertyIsEnumerable;
2820
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2821
- var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
2822
- if (object == null) {
2823
- return [];
2824
- }
2825
- object = Object(object);
2826
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2827
- return propertyIsEnumerable$1.call(object, symbol);
2828
- });
2829
- };
2830
- var _getSymbols = getSymbols$3;
2831
- var copyObject$1 = _copyObject, getSymbols$2 = _getSymbols;
2832
- function copySymbols$1(source, object) {
2833
- return copyObject$1(source, getSymbols$2(source), object);
2834
- }
2835
- var _copySymbols = copySymbols$1;
2836
- function arrayPush$2(array, values2) {
2837
- var index = -1, length = values2.length, offset = array.length;
2838
- while (++index < length) {
2839
- array[offset + index] = values2[index];
2840
- }
2841
- return array;
2842
- }
2843
- var _arrayPush = arrayPush$2;
2844
- var overArg$2 = _overArg;
2845
- var getPrototype$3 = overArg$2(Object.getPrototypeOf, Object);
2846
- var _getPrototype = getPrototype$3;
2847
- var arrayPush$1 = _arrayPush, getPrototype$2 = _getPrototype, getSymbols$1 = _getSymbols, stubArray = stubArray_1;
2848
- var nativeGetSymbols = Object.getOwnPropertySymbols;
2849
- var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
2850
- var result = [];
2851
- while (object) {
2852
- arrayPush$1(result, getSymbols$1(object));
2853
- object = getPrototype$2(object);
2854
- }
2855
- return result;
2856
- };
2857
- var _getSymbolsIn = getSymbolsIn$2;
2858
- var copyObject = _copyObject, getSymbolsIn$1 = _getSymbolsIn;
2859
- function copySymbolsIn$1(source, object) {
2860
- return copyObject(source, getSymbolsIn$1(source), object);
2861
- }
2862
- var _copySymbolsIn = copySymbolsIn$1;
2863
- var arrayPush = _arrayPush, isArray$4 = isArray_1;
2864
- function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
2865
- var result = keysFunc(object);
2866
- return isArray$4(object) ? result : arrayPush(result, symbolsFunc(object));
2867
- }
2868
- var _baseGetAllKeys = baseGetAllKeys$2;
2869
- var baseGetAllKeys$1 = _baseGetAllKeys, getSymbols = _getSymbols, keys$2 = keys_1;
2870
- function getAllKeys$1(object) {
2871
- return baseGetAllKeys$1(object, keys$2, getSymbols);
2872
- }
2873
- var _getAllKeys = getAllKeys$1;
2874
- var baseGetAllKeys = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$1 = keysIn_1;
2875
- function getAllKeysIn$1(object) {
2876
- return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
2877
- }
2878
- var _getAllKeysIn = getAllKeysIn$1;
2879
- var getNative$3 = _getNative, root$4 = _root;
2880
- var DataView$1 = getNative$3(root$4, "DataView");
2881
- var _DataView = DataView$1;
2882
- var getNative$2 = _getNative, root$3 = _root;
2883
- var Promise$2 = getNative$2(root$3, "Promise");
2884
- var _Promise = Promise$2;
2885
- var getNative$1 = _getNative, root$2 = _root;
2886
- var Set$2 = getNative$1(root$2, "Set");
2887
- var _Set = Set$2;
2888
- var getNative = _getNative, root$1 = _root;
2889
- var WeakMap$2 = getNative(root$1, "WeakMap");
2890
- var _WeakMap = WeakMap$2;
2891
- var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap$1 = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
2892
- var mapTag$3 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$3 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
2893
- var dataViewTag$2 = "[object DataView]";
2894
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
2895
- var getTag$3 = baseGetTag;
2896
- if (DataView && getTag$3(new DataView(new ArrayBuffer(1))) != dataViewTag$2 || Map$1 && getTag$3(new Map$1()) != mapTag$3 || Promise$1 && getTag$3(Promise$1.resolve()) != promiseTag || Set$1 && getTag$3(new Set$1()) != setTag$3 || WeakMap$1 && getTag$3(new WeakMap$1()) != weakMapTag$1) {
2897
- getTag$3 = function(value) {
2898
- var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
2899
- if (ctorString) {
2900
- switch (ctorString) {
2901
- case dataViewCtorString:
2902
- return dataViewTag$2;
2903
- case mapCtorString:
2904
- return mapTag$3;
2905
- case promiseCtorString:
2906
- return promiseTag;
2907
- case setCtorString:
2908
- return setTag$3;
2909
- case weakMapCtorString:
2910
- return weakMapTag$1;
2911
- }
2912
- }
2913
- return result;
2914
- };
2915
- }
2916
- var _getTag = getTag$3;
2917
- var objectProto$7 = Object.prototype;
2918
- var hasOwnProperty$3 = objectProto$7.hasOwnProperty;
2919
- function initCloneArray$1(array) {
2920
- var length = array.length, result = new array.constructor(length);
2921
- if (length && typeof array[0] == "string" && hasOwnProperty$3.call(array, "index")) {
2922
- result.index = array.index;
2923
- result.input = array.input;
2924
- }
2925
- return result;
2926
- }
2927
- var _initCloneArray = initCloneArray$1;
2928
- var root = _root;
2929
- var Uint8Array$2 = root.Uint8Array;
2930
- var _Uint8Array = Uint8Array$2;
2931
- var Uint8Array$1 = _Uint8Array;
2932
- function cloneArrayBuffer$3(arrayBuffer) {
2933
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2934
- new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
2935
- return result;
2936
- }
2937
- var _cloneArrayBuffer = cloneArrayBuffer$3;
2938
- var cloneArrayBuffer$2 = _cloneArrayBuffer;
2939
- function cloneDataView$1(dataView, isDeep) {
2940
- var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
2941
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2942
- }
2943
- var _cloneDataView = cloneDataView$1;
2944
- var reFlags = /\w*$/;
2945
- function cloneRegExp$1(regexp) {
2946
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
2947
- result.lastIndex = regexp.lastIndex;
2948
- return result;
2949
- }
2950
- var _cloneRegExp = cloneRegExp$1;
2951
- var Symbol$1 = _Symbol;
2952
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
2953
- function cloneSymbol$1(symbol) {
2954
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
2955
- }
2956
- var _cloneSymbol = cloneSymbol$1;
2957
- var cloneArrayBuffer$1 = _cloneArrayBuffer;
2958
- function cloneTypedArray$1(typedArray, isDeep) {
2959
- var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
2960
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
2961
- }
2962
- var _cloneTypedArray = cloneTypedArray$1;
2963
- var cloneArrayBuffer = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray = _cloneTypedArray;
2964
- var boolTag$2 = "[object Boolean]", dateTag$1 = "[object Date]", mapTag$2 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$3 = "[object String]", symbolTag$4 = "[object Symbol]";
2965
- var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
2966
- function initCloneByTag$1(object, tag, isDeep) {
2967
- var Ctor = object.constructor;
2968
- switch (tag) {
2969
- case arrayBufferTag$1:
2970
- return cloneArrayBuffer(object);
2971
- case boolTag$2:
2972
- case dateTag$1:
2973
- return new Ctor(+object);
2974
- case dataViewTag$1:
2975
- return cloneDataView(object, isDeep);
2976
- case float32Tag$1:
2977
- case float64Tag$1:
2978
- case int8Tag$1:
2979
- case int16Tag$1:
2980
- case int32Tag$1:
2981
- case uint8Tag$1:
2982
- case uint8ClampedTag$1:
2983
- case uint16Tag$1:
2984
- case uint32Tag$1:
2985
- return cloneTypedArray(object, isDeep);
2986
- case mapTag$2:
2987
- return new Ctor();
2988
- case numberTag$2:
2989
- case stringTag$3:
2990
- return new Ctor(object);
2991
- case regexpTag$1:
2992
- return cloneRegExp(object);
2993
- case setTag$2:
2994
- return new Ctor();
2995
- case symbolTag$4:
2996
- return cloneSymbol(object);
2997
- }
2998
- }
2999
- var _initCloneByTag = initCloneByTag$1;
3000
- var isObject$5 = isObject_1;
3001
- var objectCreate = Object.create;
3002
- var baseCreate$1 = /* @__PURE__ */ function() {
3003
- function object() {
3004
- }
3005
- return function(proto) {
3006
- if (!isObject$5(proto)) {
3007
- return {};
3008
- }
3009
- if (objectCreate) {
3010
- return objectCreate(proto);
3011
- }
3012
- object.prototype = proto;
3013
- var result = new object();
3014
- object.prototype = void 0;
3015
- return result;
3016
- };
3017
- }();
3018
- var _baseCreate = baseCreate$1;
3019
- var baseCreate = _baseCreate, getPrototype$1 = _getPrototype, isPrototype$1 = _isPrototype;
3020
- function initCloneObject$1(object) {
3021
- return typeof object.constructor == "function" && !isPrototype$1(object) ? baseCreate(getPrototype$1(object)) : {};
3022
- }
3023
- var _initCloneObject = initCloneObject$1;
3024
- var getTag$2 = _getTag, isObjectLike$9 = isObjectLike_1;
3025
- var mapTag$1 = "[object Map]";
3026
- function baseIsMap$1(value) {
3027
- return isObjectLike$9(value) && getTag$2(value) == mapTag$1;
3028
- }
3029
- var _baseIsMap = baseIsMap$1;
3030
- var baseIsMap = _baseIsMap, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports;
3031
- var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
3032
- var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
3033
- var isMap_1 = isMap$1;
3034
- var getTag$1 = _getTag, isObjectLike$8 = isObjectLike_1;
3035
- var setTag$1 = "[object Set]";
3036
- function baseIsSet$1(value) {
3037
- return isObjectLike$8(value) && getTag$1(value) == setTag$1;
3038
- }
3039
- var _baseIsSet = baseIsSet$1;
3040
- var baseIsSet = _baseIsSet, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
3041
- var nodeIsSet = nodeUtil && nodeUtil.isSet;
3042
- var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
3043
- var isSet_1 = isSet$1;
3044
- var Stack = _Stack, arrayEach = _arrayEach, assignValue = _assignValue, baseAssign = _baseAssign, baseAssignIn = _baseAssignIn, cloneBuffer = _cloneBufferExports, copyArray = _copyArray, copySymbols = _copySymbols, copySymbolsIn = _copySymbolsIn, getAllKeys = _getAllKeys, getAllKeysIn = _getAllKeysIn, getTag = _getTag, initCloneArray = _initCloneArray, initCloneByTag = _initCloneByTag, initCloneObject = _initCloneObject, isArray$3 = isArray_1, isBuffer = isBufferExports, isMap = isMap_1, isObject$4 = isObject_1, isSet = isSet_1, keys$1 = keys_1, keysIn = keysIn_1;
3045
- var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
3046
- var argsTag$1 = "[object Arguments]", arrayTag = "[object Array]", boolTag$1 = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag$1 = "[object Function]", genTag$1 = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag$2 = "[object String]", symbolTag$3 = "[object Symbol]", weakMapTag = "[object WeakMap]";
3047
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
3048
- var cloneableTags = {};
3049
- cloneableTags[argsTag$1] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag$1] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$3] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
3050
- cloneableTags[errorTag] = cloneableTags[funcTag$1] = cloneableTags[weakMapTag] = false;
3051
- function baseClone$1(value, bitmask, customizer, key, object, stack) {
3052
- var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
3053
- if (customizer) {
3054
- result = object ? customizer(value, key, object, stack) : customizer(value);
3055
- }
3056
- if (result !== void 0) {
3057
- return result;
3058
- }
3059
- if (!isObject$4(value)) {
3060
- return value;
3061
- }
3062
- var isArr = isArray$3(value);
3063
- if (isArr) {
3064
- result = initCloneArray(value);
3065
- if (!isDeep) {
3066
- return copyArray(value, result);
3067
- }
3068
- } else {
3069
- var tag = getTag(value), isFunc = tag == funcTag$1 || tag == genTag$1;
3070
- if (isBuffer(value)) {
3071
- return cloneBuffer(value, isDeep);
3072
- }
3073
- if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
3074
- result = isFlat || isFunc ? {} : initCloneObject(value);
3075
- if (!isDeep) {
3076
- return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
3077
- }
3078
- } else {
3079
- if (!cloneableTags[tag]) {
3080
- return object ? value : {};
3081
- }
3082
- result = initCloneByTag(value, tag, isDeep);
3083
- }
3084
- }
3085
- stack || (stack = new Stack());
3086
- var stacked = stack.get(value);
3087
- if (stacked) {
3088
- return stacked;
3089
- }
3090
- stack.set(value, result);
3091
- if (isSet(value)) {
3092
- value.forEach(function(subValue) {
3093
- result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
3094
- });
3095
- } else if (isMap(value)) {
3096
- value.forEach(function(subValue, key2) {
3097
- result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
3098
- });
3099
- }
3100
- var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys$1;
3101
- var props = isArr ? void 0 : keysFunc(value);
3102
- arrayEach(props || value, function(subValue, key2) {
3103
- if (props) {
3104
- key2 = subValue;
3105
- subValue = value[key2];
3106
- }
3107
- assignValue(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
3108
- });
3109
- return result;
3110
- }
3111
- var _baseClone = baseClone$1;
3112
- var baseClone = _baseClone;
3113
- var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
3114
- function cloneDeep(value) {
3115
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
3116
- }
3117
- var cloneDeep_1 = cloneDeep;
3118
- const cloneDeep$1 = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1);
3119
2160
  class CollectionRegistry {
3120
2161
  // Normalized runtime layer (used by Data Grid / UI)
3121
2162
  collectionsByTableName = /* @__PURE__ */ new Map();
@@ -3163,7 +2204,7 @@ class CollectionRegistry {
3163
2204
  ...c
3164
2205
  }));
3165
2206
  normalizedCollections.forEach((c, index) => {
3166
- const raw = cloneDeep$1(collections[index]);
2207
+ const raw = deepClone(collections[index]);
3167
2208
  this.rootCollections.push(c);
3168
2209
  this.rawRootCollections.push(raw);
3169
2210
  const normalized2 = this.normalizeCollection(c);
@@ -3183,7 +2224,7 @@ class CollectionRegistry {
3183
2224
  if (!subCollection) return;
3184
2225
  this._registerRecursively(this.normalizeCollection({
3185
2226
  ...subCollection
3186
- }), cloneDeep$1(subCollection));
2227
+ }), deepClone(subCollection));
3187
2228
  });
3188
2229
  }
3189
2230
  });
@@ -3191,7 +2232,7 @@ class CollectionRegistry {
3191
2232
  return true;
3192
2233
  }
3193
2234
  register(collection, rawCollection) {
3194
- const raw = rawCollection ? cloneDeep$1(rawCollection) : cloneDeep$1(collection);
2235
+ const raw = rawCollection ? deepClone(rawCollection) : deepClone(collection);
3195
2236
  this.rootCollections.push(collection);
3196
2237
  this.rawRootCollections.push(raw);
3197
2238
  this._registerRecursively(collection, raw);
@@ -3215,7 +2256,7 @@ class CollectionRegistry {
3215
2256
  if (!subCollection) return;
3216
2257
  this._registerRecursively(this.normalizeCollection({
3217
2258
  ...subCollection
3218
- }), cloneDeep$1(subCollection));
2259
+ }), deepClone(subCollection));
3219
2260
  });
3220
2261
  }
3221
2262
  }
@@ -3474,8 +2515,7 @@ async function loadCollectionsFromDirectory(directory) {
3474
2515
  const filePath = path$3.join(directory, file);
3475
2516
  try {
3476
2517
  const fileUrl = pathToFileURL(filePath).href;
3477
- const dynamicImport = new Function("url", "return import(url)");
3478
- const module = await dynamicImport(fileUrl);
2518
+ const module = await import(fileUrl);
3479
2519
  if (module && module.default) {
3480
2520
  collections.push(module.default);
3481
2521
  } else {
@@ -3633,7 +2673,8 @@ const errorHandler = (err, c) => {
3633
2673
  console.error(`❌ [API] ${c.req.method} ${c.req.path} → ${statusCode} ${code2}: ${logMessage}`);
3634
2674
  const causePg = error2.cause && typeof error2.cause === "object" ? error2.cause : void 0;
3635
2675
  const pgErrorCode = causePg?.code || error2.code;
3636
- if (pgErrorCode !== "42703" && pgErrorCode !== "42P01") {
2676
+ const suppressStack = pgErrorCode === "42703" || pgErrorCode === "42P01" || statusCode < 500 && code2 === "BAD_REQUEST";
2677
+ if (!suppressStack) {
3637
2678
  console.error(error2.stack || error2);
3638
2679
  }
3639
2680
  let clientMessage = "An unexpected error occurred";
@@ -21632,15 +20673,19 @@ ZodEnum.create;
21632
20673
  ZodPromise.create;
21633
20674
  ZodOptional.create;
21634
20675
  ZodNullable.create;
21635
- function createGoogleProvider(clientId) {
21636
- const googleClient = new src$4.OAuth2Client(clientId);
20676
+ function createGoogleProvider(config) {
20677
+ const clientId = typeof config === "string" ? config : config.clientId;
20678
+ const clientSecret = typeof config === "string" ? void 0 : config.clientSecret;
20679
+ const googleClient = new src$4.OAuth2Client(clientId, clientSecret);
21637
20680
  return {
21638
20681
  id: "google",
21639
20682
  schema: objectType({
21640
20683
  idToken: stringType().min(1).optional(),
21641
- accessToken: stringType().min(1).optional()
21642
- }).refine((data) => data.idToken || data.accessToken, {
21643
- message: "Either idToken or accessToken is required"
20684
+ accessToken: stringType().min(1).optional(),
20685
+ code: stringType().min(1).optional(),
20686
+ redirectUri: stringType().min(1).optional()
20687
+ }).refine((data) => data.idToken || data.accessToken || data.code && data.redirectUri, {
20688
+ message: "One of idToken, accessToken, or code+redirectUri is required"
21644
20689
  }),
21645
20690
  verify: async (payload) => {
21646
20691
  try {
@@ -21651,7 +20696,7 @@ function createGoogleProvider(clientId) {
21651
20696
  });
21652
20697
  const content = ticket.getPayload();
21653
20698
  if (!content) {
21654
- return null;
20699
+ throw new Error("Google ID token payload was empty");
21655
20700
  }
21656
20701
  return {
21657
20702
  providerId: content.sub,
@@ -21667,12 +20712,11 @@ function createGoogleProvider(clientId) {
21667
20712
  }
21668
20713
  });
21669
20714
  if (!res.ok) {
21670
- console.error("Google userinfo request failed:", res.status);
21671
- return null;
20715
+ throw new Error(`Google userinfo request failed with status ${res.status}`);
21672
20716
  }
21673
20717
  const info = await res.json();
21674
20718
  if (!info.sub || !info.email) {
21675
- return null;
20719
+ throw new Error("Google userinfo response missing sub or email");
21676
20720
  }
21677
20721
  return {
21678
20722
  providerId: info.sub,
@@ -21681,10 +20725,73 @@ function createGoogleProvider(clientId) {
21681
20725
  photoUrl: info.picture || null
21682
20726
  };
21683
20727
  }
21684
- return null;
20728
+ if (payload.code && payload.redirectUri) {
20729
+ if (!clientSecret) {
20730
+ throw new Error("Google authorization code flow requires clientSecret. Configure GOOGLE_CLIENT_SECRET in your environment.");
20731
+ }
20732
+ const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
20733
+ method: "POST",
20734
+ headers: {
20735
+ "Content-Type": "application/x-www-form-urlencoded"
20736
+ },
20737
+ body: new URLSearchParams({
20738
+ code: payload.code,
20739
+ client_id: clientId,
20740
+ client_secret: clientSecret,
20741
+ redirect_uri: payload.redirectUri,
20742
+ grant_type: "authorization_code"
20743
+ })
20744
+ });
20745
+ if (!tokenResponse.ok) {
20746
+ const errorBody = await tokenResponse.text();
20747
+ throw new Error(`Google token exchange failed (${tokenResponse.status}): ${errorBody}`);
20748
+ }
20749
+ const tokenData = await tokenResponse.json();
20750
+ if (tokenData.error) {
20751
+ throw new Error(`Google token exchange error: ${tokenData.error} – ${tokenData.error_description || "no details"}`);
20752
+ }
20753
+ if (tokenData.id_token) {
20754
+ const ticket = await googleClient.verifyIdToken({
20755
+ idToken: tokenData.id_token,
20756
+ audience: clientId
20757
+ });
20758
+ const content = ticket.getPayload();
20759
+ if (!content) {
20760
+ throw new Error("Google ID token payload was empty after code exchange");
20761
+ }
20762
+ return {
20763
+ providerId: content.sub,
20764
+ email: content.email || "",
20765
+ displayName: content.name || null,
20766
+ photoUrl: content.picture || null
20767
+ };
20768
+ }
20769
+ if (tokenData.access_token) {
20770
+ const userInfoRes = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
20771
+ headers: {
20772
+ Authorization: `Bearer ${tokenData.access_token}`
20773
+ }
20774
+ });
20775
+ if (!userInfoRes.ok) {
20776
+ throw new Error(`Google userinfo request failed after code exchange (${userInfoRes.status})`);
20777
+ }
20778
+ const info = await userInfoRes.json();
20779
+ if (!info.sub || !info.email) {
20780
+ return null;
20781
+ }
20782
+ return {
20783
+ providerId: info.sub,
20784
+ email: info.email,
20785
+ displayName: info.name || null,
20786
+ photoUrl: info.picture || null
20787
+ };
20788
+ }
20789
+ throw new Error("Google token exchange returned neither id_token nor access_token");
20790
+ }
20791
+ throw new Error("No valid Google credential provided (expected idToken, accessToken, or code+redirectUri)");
21685
20792
  } catch (error2) {
21686
- console.error("Failed to verify Google token:", error2);
21687
- return null;
20793
+ console.error("Google OAuth verification failed:", error2);
20794
+ throw error2;
21688
20795
  }
21689
20796
  }
21690
20797
  };
@@ -22892,7 +21999,11 @@ function createAuthRoutes(config) {
22892
21999
  passwordHash,
22893
22000
  displayName: displayName || void 0
22894
22001
  });
22895
- if (config.defaultRole) {
22002
+ const existingUsers = await authRepo.listUsers();
22003
+ const isFirstUser = existingUsers.length === 1 && existingUsers[0].id === user.id;
22004
+ if (isFirstUser) {
22005
+ await authRepo.setUserRoles(user.id, ["admin"]);
22006
+ } else if (config.defaultRole) {
22896
22007
  await authRepo.assignDefaultRole(user.id, config.defaultRole);
22897
22008
  }
22898
22009
  const {
@@ -22933,7 +22044,13 @@ function createAuthRoutes(config) {
22933
22044
  for (const provider of config.oauthProviders) {
22934
22045
  router.post(`/${provider.id}`, defaultAuthLimiter, async (c) => {
22935
22046
  const payload = parseBody2(provider.schema, await c.req.json());
22936
- const externalUser = await provider.verify(payload);
22047
+ let externalUser;
22048
+ try {
22049
+ externalUser = await provider.verify(payload);
22050
+ } catch (err) {
22051
+ const msg = err instanceof Error ? err.message : String(err);
22052
+ throw ApiError.unauthorized(`${provider.id} login failed: ${msg}`, "OAUTH_ERROR");
22053
+ }
22937
22054
  if (!externalUser) {
22938
22055
  throw ApiError.unauthorized(`Invalid ${provider.id} credentials`, "INVALID_TOKEN");
22939
22056
  }
@@ -22957,7 +22074,11 @@ function createAuthRoutes(config) {
22957
22074
  await authRepo.linkUserIdentity(user.id, provider.id, externalUser.providerId, {
22958
22075
  email: externalUser.email
22959
22076
  });
22960
- if (config.defaultRole) {
22077
+ const allUsers = await authRepo.listUsers();
22078
+ const isFirstUser = allUsers.length === 1 && allUsers[0].id === user.id;
22079
+ if (isFirstUser) {
22080
+ await authRepo.setUserRoles(user.id, ["admin"]);
22081
+ } else if (config.defaultRole) {
22961
22082
  await authRepo.assignDefaultRole(user.id, config.defaultRole);
22962
22083
  }
22963
22084
  sendWelcomeEmail({
@@ -24950,20 +24071,21 @@ function createAuth(transport, options2) {
24950
24071
  refreshToken: session.refreshToken
24951
24072
  };
24952
24073
  }
24953
- async function signInWithGoogle(idToken) {
24074
+ async function signInWithGoogle(tokenOrPayload) {
24954
24075
  const fetchFn = getFetch();
24076
+ const body = typeof tokenOrPayload === "string" ? {
24077
+ idToken: tokenOrPayload
24078
+ } : tokenOrPayload;
24955
24079
  const res = await fetchFn(authUrl("/google"), {
24956
24080
  method: "POST",
24957
24081
  headers: {
24958
24082
  "Content-Type": "application/json"
24959
24083
  },
24960
- body: JSON.stringify({
24961
- idToken
24962
- })
24084
+ body: JSON.stringify(body)
24963
24085
  });
24964
- const body = await res.json().catch(() => ({}));
24965
- if (!res.ok) throwApiError(res.status, body, res.statusText);
24966
- const session = handleAuthResponse(body, "SIGNED_IN");
24086
+ const responseBody = await res.json().catch(() => ({}));
24087
+ if (!res.ok) throwApiError(res.status, responseBody, res.statusText);
24088
+ const session = handleAuthResponse(responseBody, "SIGNED_IN");
24967
24089
  return {
24968
24090
  user: session.user,
24969
24091
  accessToken: session.accessToken,
@@ -25625,6 +24747,25 @@ function createCollectionClient(transport, slug, ws) {
25625
24747
  };
25626
24748
  return client;
25627
24749
  }
24750
+ function createFunctionsClient(transport) {
24751
+ return {
24752
+ async invoke(name2, payload, options2) {
24753
+ const method = options2?.method ?? "POST";
24754
+ const subPath = options2?.path ? `/${options2.path.replace(/^\//, "")}` : "";
24755
+ const routePath = `/functions/${encodeURIComponent(name2)}${subPath}`;
24756
+ const init = {
24757
+ method
24758
+ };
24759
+ if (payload !== void 0 && method !== "GET") {
24760
+ init.body = JSON.stringify(payload);
24761
+ }
24762
+ if (options2?.headers) {
24763
+ init.headers = options2.headers;
24764
+ }
24765
+ return transport.request(routePath, init);
24766
+ }
24767
+ };
24768
+ }
25628
24769
  function createStorage(transport) {
25629
24770
  const urlsCache = /* @__PURE__ */ new Map();
25630
24771
  async function putObject({
@@ -25758,6 +24899,7 @@ function createRebaseClient(options2) {
25758
24899
  const admin = createAdmin(transport, options2.admin);
25759
24900
  const cron = createCron(transport, options2.cron);
25760
24901
  const storage = createStorage(transport);
24902
+ const functions = createFunctionsClient(transport);
25761
24903
  let ws;
25762
24904
  if (!options2.onUnauthorized) {
25763
24905
  transport.setOnUnauthorized(async () => {
@@ -25796,6 +24938,7 @@ function createRebaseClient(options2) {
25796
24938
  auth,
25797
24939
  admin,
25798
24940
  cron,
24941
+ functions,
25799
24942
  storage,
25800
24943
  ws,
25801
24944
  setToken: transport.setToken,
@@ -37123,7 +36266,7 @@ async function _initializeRebaseBackend(config) {
37123
36266
  const {
37124
36267
  createGoogleProvider: createGoogleProvider2
37125
36268
  } = await import("./index-DXVBFp5V.js");
37126
- oauthProviders.push(createGoogleProvider2(config.auth.google.clientId));
36269
+ oauthProviders.push(createGoogleProvider2(config.auth.google));
37127
36270
  }
37128
36271
  if (config.auth.linkedin?.clientId && config.auth.linkedin?.clientSecret) {
37129
36272
  const {
@@ -37324,6 +36467,13 @@ async function _initializeRebaseBackend(config) {
37324
36467
  }
37325
36468
  _initRebase(serverClient);
37326
36469
  logger.info("Rebase singleton initialized");
36470
+ if (defaultDriverResult.internals) {
36471
+ const internals = defaultDriverResult.internals;
36472
+ const driver = internals.driver;
36473
+ if (driver && "client" in driver) {
36474
+ driver.client = serverClient;
36475
+ }
36476
+ }
37327
36477
  if (config.functionsDir) {
37328
36478
  const {
37329
36479
  loadFunctionsFromDirectory: loadFunctionsFromDirectory2
@@ -40379,17 +39529,17 @@ const escapeSequences = [
40379
39529
  "\\u009F"
40380
39530
  ];
40381
39531
  const BREAK = Object.freeze({});
40382
- function visit(root2, visitor, visitorKeys = QueryDocumentKeys) {
39532
+ function visit(root, visitor, visitorKeys = QueryDocumentKeys) {
40383
39533
  const enterLeaveMap = /* @__PURE__ */ new Map();
40384
39534
  for (const kind of Object.values(Kind)) {
40385
39535
  enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));
40386
39536
  }
40387
39537
  let stack = void 0;
40388
- let inArray = Array.isArray(root2);
40389
- let keys2 = [root2];
39538
+ let inArray = Array.isArray(root);
39539
+ let keys2 = [root];
40390
39540
  let index = -1;
40391
39541
  let edits = [];
40392
- let node = root2;
39542
+ let node = root;
40393
39543
  let key = void 0;
40394
39544
  let parent = void 0;
40395
39545
  const path2 = [];
@@ -40488,7 +39638,7 @@ function visit(root2, visitor, visitorKeys = QueryDocumentKeys) {
40488
39638
  if (edits.length !== 0) {
40489
39639
  return edits[edits.length - 1][1];
40490
39640
  }
40491
- return root2;
39641
+ return root;
40492
39642
  }
40493
39643
  function visitInParallel(visitors) {
40494
39644
  const skipping = new Array(visitors.length).fill(null);
@@ -48194,7 +47344,9 @@ class RebaseApiServer {
48194
47344
  * Setup Hono middleware
48195
47345
  */
48196
47346
  setupMiddleware() {
48197
- this.router.use("/*", secureHeaders());
47347
+ this.router.use("/*", secureHeaders({
47348
+ crossOriginOpenerPolicy: "same-origin-allow-popups"
47349
+ }));
48198
47350
  if (this.config.cors) {
48199
47351
  const origin = this.config.cors.origin;
48200
47352
  this.router.use("/*", cors({