@rebasepro/server-core 0.0.1-canary.892f711 → 0.0.1-canary.a6becfb

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