@data-client/rest 0.15.6 → 0.16.0

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/index.js +61 -18
  3. package/dist/index.umd.min.js +1 -1
  4. package/legacy/NetworkError.js +16 -1
  5. package/legacy/RestEndpoint.js +17 -4
  6. package/legacy/RestEndpointTypes.js +1 -1
  7. package/legacy/RestHelpers.js +29 -16
  8. package/legacy/pathTypes.js +1 -1
  9. package/legacy/resource.js +3 -1
  10. package/legacy/resourceTypes.js +1 -1
  11. package/lib/NetworkError.d.ts +12 -0
  12. package/lib/NetworkError.d.ts.map +1 -1
  13. package/lib/NetworkError.js +16 -1
  14. package/lib/RestEndpoint.js +17 -4
  15. package/lib/RestEndpointTypes.d.ts +43 -9
  16. package/lib/RestEndpointTypes.d.ts.map +1 -1
  17. package/lib/RestEndpointTypes.js +1 -1
  18. package/lib/RestHelpers.d.ts +2 -2
  19. package/lib/RestHelpers.d.ts.map +1 -1
  20. package/lib/RestHelpers.js +29 -16
  21. package/lib/pathTypes.d.ts +14 -13
  22. package/lib/pathTypes.d.ts.map +1 -1
  23. package/lib/pathTypes.js +1 -1
  24. package/lib/resource.d.ts.map +1 -1
  25. package/lib/resource.js +3 -1
  26. package/lib/resourceTypes.d.ts +5 -1
  27. package/lib/resourceTypes.d.ts.map +1 -1
  28. package/lib/resourceTypes.js +1 -1
  29. package/package.json +5 -5
  30. package/src/NetworkError.ts +15 -0
  31. package/src/RestEndpoint.js +21 -3
  32. package/src/RestEndpointTypes.ts +33 -9
  33. package/src/RestHelpers.ts +34 -26
  34. package/src/__tests__/Resource.test.ts +131 -0
  35. package/src/__tests__/RestEndpoint.ts +212 -4
  36. package/src/__tests__/__snapshots__/RestEndpoint.ts.snap +2 -0
  37. package/src/__tests__/__snapshots__/resource-construction.test.ts.snap +1 -1
  38. package/src/__tests__/hookifyResource.ts +7 -0
  39. package/src/__tests__/resource-construction.test.ts +543 -0
  40. package/src/pathTypes.ts +35 -23
  41. package/src/resource.ts +2 -0
  42. package/src/resourceTypes.ts +3 -1
  43. package/ts4.0/NetworkError.d.ts +12 -0
  44. package/ts4.0/RestEndpointTypes.d.ts +61 -9
  45. package/ts4.0/RestHelpers.d.ts +2 -2
  46. package/ts4.0/pathTypes.d.ts +1 -1
  47. package/ts4.0/resourceExtendable.d.ts +1 -1
  48. package/ts4.0/resourceTypes.d.ts +7 -1
  49. package/ts4.1/NetworkError.d.ts +12 -0
  50. package/ts4.1/RestEndpointTypes.d.ts +61 -9
  51. package/ts4.1/RestHelpers.d.ts +2 -2
  52. package/ts4.1/pathTypes.d.ts +14 -13
  53. package/ts4.1/resourceExtendable.d.ts +1 -1
  54. package/ts4.1/resourceTypes.d.ts +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,123 @@
1
1
  # @data-client/rest
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#3829](https://github.com/reactive/data-client/pull/3829) [`63633c7`](https://github.com/reactive/data-client/commit/63633c714b5c041e04891255683e5a899c3d3f22) - Add [schema.Lazy](https://dataclient.io/rest/api/Lazy) for deferred relationship denormalization.
8
+
9
+ `schema.Lazy` wraps a relationship field so denormalization returns raw primary keys
10
+ instead of resolved entities. Use `.query` with [useQuery](/docs/api/useQuery) to
11
+ resolve on demand in a separate memo/GC scope.
12
+
13
+ New exports: `schema.Lazy`, `Lazy`
14
+
15
+ ```ts
16
+ class Department extends Entity {
17
+ buildings: string[] = [];
18
+ static schema = {
19
+ buildings: new schema.Lazy([Building]),
20
+ };
21
+ }
22
+
23
+ // dept.buildings = ['bldg-1', 'bldg-2'] (raw PKs)
24
+ const buildings = useQuery(Department.schema.buildings.query, dept.buildings);
25
+ ```
26
+
27
+ - [#3783](https://github.com/reactive/data-client/pull/3783) [`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758) - Add `Collection.moveWith()` for custom move schemas
28
+
29
+ Analogous to [`addWith()`](https://dataclient.io/rest/api/Collection#addWith), `moveWith()` constructs a custom move schema that controls how entities are added to their destination collection. The remove behavior is automatically derived from the collection type (Array or Values).
30
+
31
+ New exports: `unshift` merge function for convenience.
32
+
33
+ ```ts
34
+ import { Collection, unshift } from '@data-client/rest';
35
+
36
+ class MyCollection extends Collection {
37
+ constructor(schema, options) {
38
+ super(schema, options);
39
+ this.move = this.moveWith(unshift);
40
+ }
41
+ }
42
+ ```
43
+
44
+ - [#3757](https://github.com/reactive/data-client/pull/3757) [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14) - RestEndpoint.path and Resource.path syntax updated
45
+
46
+ Upgrading path-to-regexp from 6 to 8.
47
+ - https://github.com/pillarjs/path-to-regexp/releases/tag/v8.0.0
48
+ - https://github.com/pillarjs/path-to-regexp/releases/tag/v7.0.0
49
+
50
+ BREAKING CHANGES:
51
+ - /:optional? -> {/:optional}
52
+ - /:repeating+ -> /\*repeating (typed as string[])
53
+ - /:repeating* -> {/*repeating} (typed as string[])
54
+ - /:id(\d+) -> /:id (custom regex removed)
55
+ - /:with-dash -> /:"with-dash"
56
+ - `(`, `)`, `[`, `]`, `+`, `?`, `!` must be escaped `"\\("`
57
+ - `{}()[]+?!:*\` are all characters that need escaping
58
+
59
+ Migrate using:
60
+ `npx skills add https://github.com/reactive/data-client --skill path-to-regexp-v8-migration`
61
+
62
+ ### Patch Changes
63
+
64
+ - [#3782](https://github.com/reactive/data-client/pull/3782) [`3b85c82`](https://github.com/reactive/data-client/commit/3b85c820f8046a056d9180ff5d2fe1a883b6998c) - Fix `searchParams: undefined` being widened to `any` in TypeScript 6 non-strict mode
65
+
66
+ TypeScript 6.0 widens `undefined` to `any` during generic inference when `strictNullChecks` is off.
67
+ This caused `RestEndpoint` with `searchParams: undefined` to incorrectly accept arbitrary arguments.
68
+
69
+ - [#3757](https://github.com/reactive/data-client/pull/3757) [`02555a2`](https://github.com/reactive/data-client/commit/02555a23ef11c0a6c829d795067b634c0594fe14) - Fix `undefined` optional path params being interpolated as literal `"undefined"` in URLs
70
+
71
+ - Updated dependencies [[`63633c7`](https://github.com/reactive/data-client/commit/63633c714b5c041e04891255683e5a899c3d3f22), [`1f34136`](https://github.com/reactive/data-client/commit/1f34136f1d0902ee5456089f2d2f9f35c9f4a758), [`869f28f`](https://github.com/reactive/data-client/commit/869f28fc651ca5e8b0f935089fc0b8d8ce8585cb)]:
72
+ - @data-client/endpoint@0.16.0
73
+
74
+ ## 0.15.7
75
+
76
+ ### Patch Changes
77
+
78
+ - [#3738](https://github.com/reactive/data-client/pull/3738) [`4425a37`](https://github.com/reactive/data-client/commit/4425a371484d3eaed66240ea8c9c1c8874e220f1) - Add `Collection.move` schema and `RestEndpoint.move` extender for moving entities between collections.
79
+
80
+ `move` removes from collections matching the entity's existing state and adds to collections
81
+ matching the new values (from the body/last arg). Works for both Array and Values collections.
82
+
83
+ Path parameters filter collections by URL segments:
84
+
85
+ ```ts
86
+ const UserResource = resource({
87
+ path: '/groups/:group/users/:id',
88
+ schema: User,
89
+ });
90
+
91
+ // PATCH /groups/five/users/2 - moves user 2 from 'five' group to 'ten' group
92
+ await ctrl.fetch(
93
+ UserResource.getList.move,
94
+ { group: 'five', id: '2' },
95
+ { id: '2', group: 'ten' },
96
+ );
97
+ ```
98
+
99
+ Search parameters filter collections by query args:
100
+
101
+ ```ts
102
+ const TaskResource = resource({
103
+ path: '/tasks/:id',
104
+ searchParams: {} as { status: string },
105
+ schema: Task,
106
+ });
107
+
108
+ // PATCH /tasks/3 - moves task 3 from 'backlog' to 'in-progress'
109
+ await ctrl.fetch(
110
+ TaskResource.getList.move,
111
+ { id: '3' },
112
+ { id: '3', status: 'in-progress' },
113
+ );
114
+ ```
115
+
116
+ - [#3739](https://github.com/reactive/data-client/pull/3739) [`b301d4c`](https://github.com/reactive/data-client/commit/b301d4c65cd720cfe321b02162550ba758f47192) Thanks [@Dark-Brain07](https://github.com/Dark-Brain07)! - Add `toJSON()` to `NetworkError` for structured serialization in devtools and logging
117
+
118
+ - Updated dependencies [[`4425a37`](https://github.com/reactive/data-client/commit/4425a371484d3eaed66240ea8c9c1c8874e220f1)]:
119
+ - @data-client/endpoint@0.15.7
120
+
3
121
  ## 0.15.6
4
122
 
5
123
  ### Patch Changes
package/dist/index.js CHANGED
@@ -44,6 +44,21 @@ class NetworkError extends Error {
44
44
  this.status = response.status;
45
45
  this.response = response;
46
46
  }
47
+
48
+ /** Serialize the error for logging and debugging.
49
+ *
50
+ * Error properties are non-enumerable by default, so `JSON.stringify()`
51
+ * on a plain Error produces `{}`. This ensures status, message, and the
52
+ * request URL are always included in serialized output.
53
+ */
54
+ toJSON() {
55
+ return {
56
+ name: this.name,
57
+ status: this.status,
58
+ message: this.message,
59
+ url: this.response.url
60
+ };
61
+ }
47
62
  }
48
63
 
49
64
  function paginatedMerge(existing, incoming) {
@@ -76,22 +91,36 @@ function paramsToString(searchParams) {
76
91
  return params.toString();
77
92
  }
78
93
 
79
- const urlBaseCache = new Map();
94
+ const urlBaseCache = Object.create(null);
80
95
  function getUrlBase(path) {
81
- if (!urlBaseCache.has(path)) {
82
- urlBaseCache.set(path, pathToRegexp.compile(path, {
83
- encode: encodeURIComponent,
84
- validate: false
85
- }));
96
+ if (!(path in urlBaseCache)) {
97
+ urlBaseCache[path] = pathToRegexp.compile(path);
86
98
  }
87
- return urlBaseCache.get(path);
99
+ return urlBaseCache[path];
88
100
  }
89
- const urlTokensCache = new Map();
101
+ const urlTokensCache = Object.create(null);
90
102
  function getUrlTokens(path) {
91
- if (!urlTokensCache.has(path)) {
92
- urlTokensCache.set(path, new Set(pathToRegexp.parse(path).map(t => typeof t === 'string' ? t : `${t['name']}`)));
103
+ if (!(path in urlTokensCache)) {
104
+ urlTokensCache[path] = tokenMap(pathToRegexp.parse(path).tokens);
93
105
  }
94
- return urlTokensCache.get(path);
106
+ return urlTokensCache[path];
107
+ }
108
+ function tokenMap(tokens) {
109
+ const tokenNames = new Set();
110
+ for (const token of tokens) {
111
+ switch (token.type) {
112
+ case 'param':
113
+ case 'wildcard':
114
+ tokenNames.add(token.name);
115
+ break;
116
+ case 'group':
117
+ for (const name of tokenMap(token.tokens)) {
118
+ tokenNames.add(name);
119
+ }
120
+ break;
121
+ }
122
+ }
123
+ return tokenNames;
95
124
  }
96
125
  const proto = Object.prototype;
97
126
  const gpo = Object.getPrototypeOf;
@@ -102,10 +131,9 @@ function isPojo(obj) {
102
131
  return gpo(obj) === proto;
103
132
  }
104
133
  function shortenPath(path) {
105
- const lastColonIndex = path.lastIndexOf(':');
106
- if (lastColonIndex === -1) throw new Error('Resource path requires at least one :parameter');
107
- // this is for when not specifying a specific item like create/list
108
- let shortUrlRoot = path.substring(0, lastColonIndex);
134
+ const lastTokenIndex = Math.max(path.lastIndexOf(':'), path.lastIndexOf('*'));
135
+ if (lastTokenIndex === -1) throw new Error('Resource path requires at least one :parameter or *wildcard');
136
+ let shortUrlRoot = path.substring(0, lastTokenIndex);
109
137
  if (shortUrlRoot[shortUrlRoot.length - 1] === '/') shortUrlRoot = shortUrlRoot.substring(0, shortUrlRoot.length - 1);
110
138
  return shortUrlRoot;
111
139
  }
@@ -148,14 +176,17 @@ class RestEndpoint extends endpoint.Endpoint {
148
176
 
149
177
  /** Get the url */
150
178
  url(urlParams = {}) {
151
- const urlBase = getUrlBase(this.path)(urlParams);
152
179
  const tokens = getUrlTokens(this.path);
180
+ const pathParams = {};
153
181
  const searchParams = {};
154
182
  Object.keys(urlParams).forEach(k => {
155
- if (!tokens.has(k)) {
183
+ if (tokens.has(k)) {
184
+ if (urlParams[k] !== undefined) pathParams[k] = Array.isArray(urlParams[k]) ? urlParams[k].map(String) : String(urlParams[k]);
185
+ } else {
156
186
  searchParams[k] = urlParams[k];
157
187
  }
158
188
  });
189
+ const urlBase = getUrlBase(this.path)(pathParams);
159
190
  if (Object.keys(searchParams).length) {
160
191
  return `${this.urlPrefix}${urlBase}?${this.searchToString(searchParams)}`;
161
192
  }
@@ -254,7 +285,7 @@ Response (first 300 characters): ${text.substring(0, 300)}`;
254
285
  return error.status >= 500 ? 'soft' : undefined;
255
286
  }
256
287
  get pathRegex() {
257
- return pathToRegexp.pathToRegexp(this.path);
288
+ return pathToRegexp.pathToRegexp(this.path).regexp;
258
289
  }
259
290
  testKey(key) {
260
291
  const prefix = this.method + ' ' + this.urlPrefix;
@@ -332,6 +363,16 @@ Response (first 300 characters): ${text.substring(0, 300)}`;
332
363
  name: this.name + '.remove'
333
364
  });
334
365
  }
366
+ get move() {
367
+ const options = {
368
+ method: 'PATCH',
369
+ schema: extractCollection(this.schema, s => s.move),
370
+ searchParams: undefined,
371
+ name: this.name + '.partialUpdate'
372
+ };
373
+ if (this.movePath) options.path = this.movePath;
374
+ return this.extend(options);
375
+ }
335
376
  }
336
377
  const tryParse = input => {
337
378
  try {
@@ -403,6 +444,7 @@ This warning will not show in production.`);
403
444
  const getList = new Endpoint({
404
445
  ...extraMutateOptions,
405
446
  paginationField: paginationField,
447
+ movePath: path,
406
448
  path: shortenedPath,
407
449
  schema: new Collection([schema]),
408
450
  name: getName('getList')
@@ -421,6 +463,7 @@ This warning will not show in production.`);
421
463
  method: 'PUT',
422
464
  name: getName('update')
423
465
  }),
466
+ // TODO(breaking): Move to getList.move
424
467
  partialUpdate: new Endpoint({
425
468
  ...extraPartialOptions,
426
469
  path,
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Rest={})}(this,(function(e){"use strict";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(null,arguments)}function n(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var r=0;function i(e){return"__private_"+r+++"_"+e}function s(e){return!("function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}class o{constructor(e,t){this.schema=void 0,t&&(this._schemaAttribute="string"==typeof t?e=>e[t]:t),this.define(e)}get isSingleSchema(){return!this._schemaAttribute}define(e){e._hoistable&&!this._schemaAttribute?(this.schema=e.schema,this._schemaAttribute=e._schemaAttribute):this.schema=e}getSchemaAttribute(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)}inferSchema(e,t,n){if(this.isSingleSchema)return this.schema;const r=this.getSchemaAttribute(e,t,n);return this.schema[r]}schemaKey(){return this.isSingleSchema?this.schema.key:Object.values(this.schema).join(";")}normalizeValue(e,t,n,r,i){if(!e)return e;const s=this.isSingleSchema,o=s?this.schema:this.schema[this._schemaAttribute(e,t,n)];if(!o)return e;const a=i(o,e,t,n,r);return s||null==a?a:{id:a,schema:this._schemaAttribute(e,t,n)}}denormalizeValue(e,t){const n=this.isSingleSchema,r=!n&&e&&(s(e)?e.get("schema"):e.schema);if(!n&&!r){if("object"==typeof e&&null!==e){const n=this.inferSchema(e,void 0,void 0);if(n)return t(n,e)}return e}const i=n?void 0:s(e)?e.get("id"):e.id;return t(n?this.schema:this.schema[r],i||e)}}class a extends o{constructor(e,t){if(!t)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(e,t),this._hoistable=!0}normalize(e,t,n,r,i){return this.normalizeValue(e,t,n,r,i)}denormalize(e,t,n){return this.denormalizeValue(e,n)}queryKey(e,t){if(!e[0])return;const n=this.getSchemaAttribute(e[0],void 0,""),r=this.schema[n];if(r){const i=t(r,e);if(void 0===i)return;return{id:i,schema:n}}for(const n in this.schema){const r=t(this.schema[n],e);if(void 0!==r)return{id:r,schema:n}}}}class c extends o{normalize(e,t,n,r,i,s){const o={},a=Object.keys(e);for(let t=0;t<a.length;t++){const n=a[t],s=e[n];null!=s&&(o[n]=this.normalizeValue(s,e,n,r,i))}return o}denormalize(e,t,n){const r={},i=Object.keys(e);for(let t=0;t<i.length;t++){const s=i[t],o=e[s],a=this.denormalizeValue(o,n);a&&"symbol"!=typeof a&&(r[s]=a)}return r}queryKey(e,t,n){}}const h=e=>void 0!==e&&"symbol"!=typeof e;class u extends o{normalize(e,t,n,r,i){const s=(e=>Array.isArray(e)?e:Object.keys(e).map((t=>e[t])))(e);return s.map((e=>this.normalizeValue(e,t,n,r,i)))}denormalize(e,t,n){return e.map?e.map((e=>this.denormalizeValue(e,n))).filter(h):e}queryKey(e,t,n){}toJSON(){return[this.schema]}}class l extends u{constructor(e,t){super(e,t)}normalize(e,t,n,r,i){super.normalize(e,t,n,r,i)}queryKey(e,t,n){if(this.isSingleSchema){const e=n.getEntities(this.schema.key);return e?[...e.keys()]:n.INVALID}let r=!1;const i=Object.values(this.schema).flatMap((e=>{const t=n.getEntities(e.key);if(!t)return[];r=!0;const i=[];for(const[n,r]of t.entries())r&&"symbol"!=typeof r&&i.push({id:e.pk(r,void 0,n,[]),schema:this.getSchemaAttribute(r,void 0,n)});return i}));return r?i:n.INVALID}}function f(e,n,r,i){if(s(n))return function(e,t,n){let r;const i=Object.keys(e).reduce(((t,i)=>{const s=`${i}`,o=n(e[s],t.get(s));return"symbol"==typeof o&&(r=o),t.has(s)?t.set(s,o):t}),t);return null!=r?r:i}(e,n,i);const o=t({},n),a=Object.keys(e);for(let t=0;t<a.length;t++){const n=a[t],r=i(e[n],o[n]);if(void 0!==o[n]&&(o[n]=r),"symbol"==typeof r)return r}return o}class m{constructor(e){this.schema=void 0,this.define(e)}define(e){this.schema=Object.keys(e).reduce(((n,r)=>{const i=e[r];return t({},n,{[r]:i})}),this.schema||{})}normalize(...e){return((e,n,r,i,s,o)=>{const a=t({},n),c=Object.keys(e);for(let t=0;t<c.length;t++){const r=c[t],i=o(e[r],n[r],n,r,s);void 0===i?delete a[r]:a[r]=i}return a})(this.schema,...e)}denormalize(e,t,n){return f(this.schema,e,0,n)}queryKey(e,t){return function(e,t,n){const r={},i=Object.keys(e);for(let s=0;s<i.length;s++){const o=i[s];r[o]=n(e[o],t)}return r}(this.schema,e,t)}}let d=class extends o{constructor(e,t){super(e,t)}get key(){return this.schemaKey()}normalize(e,t,n,r,i,s){const o=this.inferSchema(e,t,n);if(!o)return e;let a;if("string"==typeof e||"number"==typeof e)a=e;else{const i=o.process(e,t,n,r);a=o.pk(null!=i?i:e,t,n,r)}return a=`${a}`,s.invalidate(o,a),this.isSingleSchema?a:{id:a,schema:this.getSchemaAttribute(e,t,n)}}queryKey(e,t,n){}denormalize(e,t,n){return this.denormalizeValue(e,n)}_denormalizeNullable(){return{}}_normalizeNullable(){return{}}};const p=(e,t)=>[...e,...t],y=(e,t)=>[...t,...e],g=(e,n)=>t({},e,n),v=(e,t)=>e.filter((e=>!t.some((t=>{return r=t,"object"==typeof(n=e)&&"object"==typeof r?n.id===r.id&&n.schema===r.schema:n===r;var n,r})))),b=e=>[...e],E=e=>t({},e);class w{addWith(e,t){return O(this,e,t)}createCollectionFilter(...e){return t=>Object.entries(t).every((([t,n])=>{var r;return this.nonFilterArgumentKeys(t)||`${e[0][t]}`===n||`${null==(r=e[1])?void 0:r[t]}`===n}))}nonFilterArgumentKeys(e){return e.startsWith("order")}constructor(e,n){if(this.schema=Array.isArray(e)?new u(e[0]):e,n?"nestKey"in n?this.nestKey=n.nestKey:this.argsKey="argsKey"in n?n.argsKey:e=>t({},e):this.argsKey=e=>t({},e),this.key=function(e){if(e instanceof u)return`[${e.schemaKey()}]`;if(e instanceof c)return`{${e.schemaKey()}}`;return`(${e.schemaKey()})`}(this.schema),null!=n&&n.nonFilterArgumentKeys){const{nonFilterArgumentKeys:e}=n;"function"==typeof e?this.nonFilterArgumentKeys=e:e instanceof RegExp?this.nonFilterArgumentKeys=t=>e.test(t):this.nonFilterArgumentKeys=t=>e.includes(t)}else null!=n&&n.createCollectionFilter&&(this.createCollectionFilter=n.createCollectionFilter.bind(this));this.schema instanceof u?(this.createIfValid=b,this.push=O(this,p),this.unshift=O(this,y),this.remove=O(this,v)):e instanceof c&&(this.createIfValid=E,this.assign=O(this,g))}get cacheWith(){return this.schema.schema}toString(){return this.key}toJSON(){return{key:this.key,schema:this.schema.schema}}pk(e,t,n,r){const i=this.argsKey?this.argsKey(...r):this.nestKey(t,n);for(const e in i)["number","boolean"].includes(typeof i[e])&&(i[e]=`${i[e]}`);return function(e){const t=Object.keys(e).sort(),n={};for(const r of t)n[r]=e[r];return JSON.stringify(n)}(i)}normalize(e,t,n,r,i,s){const o=this.schema.normalize(e,t,n,r,i,s),a=this.pk(o,t,n,r);return s.mergeEntity(this,a,o),a}merge(e,t){return t}shouldReorder(e,t,n,r){return t.fetchedAt<e.fetchedAt}mergeWithStore(e,t,n,r){return this.shouldReorder(e,t,n,r)?this.merge(r,n):this.merge(n,r)}mergeMetaWithStore(e,t,n,r){return this.shouldReorder(e,t,n,r)?e:t}queryKey(e,t,n){if(this.argsKey){const t=this.pk(void 0,void 0,"",e);if(n.getEntity(this.key,t))return t}}denormalize(e,t,n){return this.schema.denormalize(e,t,n)}}function O(e,t,n){const r={merge:{value:t},normalize:{value:k},queryKey:{value:x}};return e.schema instanceof u&&(r.createIfValid={value:A},r.denormalize={value:S}),n&&(r.createCollectionFilter={value:n}),Object.create(e,r)}function x(){}function k(e,t,n,r,i,s){const o=this.schema.normalize(this.schema instanceof u&&!Array.isArray(e)?[e]:e,t,n,r,i,s),a=this.createCollectionFilter(...r),c=s.getEntities(this.key);if(c)for(const e of c.keys())a(JSON.parse(e))&&s.mergeEntity(this,e,o);return o}function A(e){return Array.isArray(e)?[...e]:t({},e)}function S(e,t,n){return Array.isArray(e)?this.schema.denormalize(e,t,n):this.schema.denormalize([e],t,n)[0]}function j(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}const _=["pk","schema","key"];function P(e,n={}){class r extends e{static toString(){return this.key}static toJSON(){return{key:this.key,schema:this.schema}}static pk(e,t,n,r){return this.prototype.pk.call(e,t,n,r)}static shouldUpdate(e,t,n,r){return!0}static shouldReorder(e,t,n,r){return t.fetchedAt<e.fetchedAt}static merge(e,n){return t({},e,n)}static mergeWithStore(e,t,n,r){return this.shouldUpdate(e,t,n,r)?typeof r!=typeof n?r:this.shouldReorder(e,t,n,r)?this.merge(r,n):this.merge(n,r):n}static mergeMetaWithStore(e,t,n,r){return this.shouldReorder(e,t,n,r)?e:t}static fromJS(e={}){const t=new this(e);return Object.assign(t,e),t}static createIfValid(e){if(!this.validate(e))return this.fromJS(e)}static process(e,n,r,i){return t({},e)}static normalize(e,t,n,r,i,s){const o=this.process(e,t,n,r);let a;if(void 0===o)return a=`${this.pk(e,t,n,r)}`,s.invalidate(this,a),a;if(a=this.pk(o,t,n,r),a=void 0===a||""===a||"undefined"===a?`MISS-${Math.random()}`:`${a}`,s.checkLoop(this.key,a,e))return a;!function(e){if(e){const t=new Error(e);throw t.status=400,t}}(this.validate(o));const c=Object.keys(this.schema);for(let e=0;e<c.length;e++){const t=c[e];Object.hasOwn(o,t)&&(o[t]=i(this.schema[t],o[t],o,t,r))}return s.mergeEntity(this,a,o),a}static validate(e){}static queryKey(e,t,n){if(!e[0])return;const r=function(e,t,n){if(["string","number"].includes(typeof t[0]))return`${t[0]}`;const r=e.pk(t[0],void 0,"",t);if(void 0!==r&&""!==r)return r;const i=(s=t[0],o=e.indexes,o?o.find((e=>Object.hasOwn(s,e))):void 0);var s,o;if(!i)return;const a=t[0][i];return n.getIndex(e.key,i,a)}(this,e,n);return r&&n.getEntity(this.key,r)?r:void 0}static denormalize(e,t,n){if("symbol"==typeof e)return e;for(const t of Object.keys(this.schema)){const r=n(this.schema[t],e[t]);if("symbol"==typeof r){if(this.defaults[t])return r;e[t]=void 0}else e[t]=r}return e}static get defaults(){return Object.hasOwn(this,"__defaults")||Object.defineProperty(this,"__defaults",{value:new this,writable:!0,configurable:!0}),this.__defaults}}const i=j(n,_);if(Object.assign(r,i),"schema"in n?r.schema=n.schema:e.schema||(r.schema={}),"pk"in n?"function"==typeof n.pk?r.prototype.pk=function(e,t){return n.pk(this,e,t)}:r.prototype.pk=function(){return this[n.pk]}:"function"!=typeof e.prototype.pk&&(r.prototype.pk=function(){return this.id}),"key"in n)Object.defineProperty(r,"key",{value:n.key,configurable:!0,writable:!0,enumerable:!0});else if(!("key"in e)){function s(e){Object.defineProperty(this,"key",{value:e,writable:!0,enumerable:!0,configurable:!0})}const o=function(){return"EntityMixin"===this.name?e.name:this.name},a="undefined"!=typeof document&&document.CLS_MANGLE?function(){return null==document.CLS_MANGLE||document.CLS_MANGLE(this),Object.defineProperty(r,"key",{get:o,set:s,enumerable:!0,configurable:!0}),o.call(this)}:o;Object.defineProperty(r,"key",{get:a,set:s,enumerable:!0,configurable:!0})}return r}class R{constructor(e,t){this.schema=e,this.process=t}normalize(...e){return this.schema.normalize(...e)}denormalize(e,t,n){const r=n(this.schema,e);return"symbol"==typeof r?r:this.process(r,...t)}queryKey(e,t){return t(this.schema,e)}}var T=Object.freeze({__proto__:null,All:l,Array:u,Collection:w,Entity:P,EntityMixin:P,Invalidate:d,Object:m,Query:R,Union:a,Values:c});const C=class{};class z extends(P(C)){static process(e,t,n,r){return super.process(e,t,n,r)}}var $;const K="undefined"!=typeof document;let N=K&&!(null!=($=document.querySelector("meta[http-equiv='Content-Security-Policy']"))&&$.getAttribute("content"));try{N||Function()}catch(e){N=!0,K&&console.error("Content Security Policy: The previous CSP log can be safely ignored - @data-client/endpoint will use setPrototypeOf instead")}var I;class M extends Function{constructor(e,t){let n,r;return N?(n=(...e)=>n.fetch(...e),Object.setPrototypeOf(n,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),n=this),e&&(n.fetch=e),t&&"name"in t||!e||!e.name||"anonymous"===e.name||(r=e.name),Object.defineProperty(n,"name",{get(){return r||this.__name},set(e){this.__name=e}}),Object.assign(n,t),n}key(...e){return`${this.name} ${JSON.stringify(e)}`}testKey(e){return e.startsWith(this.name)}bind(e,...t){const n=this.fetch,r=this.key;return this.extend({fetch(){return n.apply(null!=e?e:this,t)},key(){return r.apply(this,t)}})}extend(e){class t extends this.constructor{}return Object.assign(t.prototype,this),new t(e.fetch,e)}}I=M,(()=>{if("undefined"!=typeof document&&document.FUNC_MANGLE){const e=I.prototype.key;I.prototype.key=function(...t){return null==document.FUNC_MANGLE||document.FUNC_MANGLE(this),this.prototype.key=e,e.call(this,...t)}}})();const F=M;function L(e,t){void 0===t&&(t={});for(var n=function(e){for(var t=[],n=0;n<e.length;){var r=e[n];if("*"!==r&&"+"!==r&&"?"!==r)if("\\"!==r)if("{"!==r)if("}"!==r)if(":"!==r)if("("!==r)t.push({type:"CHAR",index:n,value:e[n++]});else{var i=1,s="";if("?"===e[a=n+1])throw new TypeError('Pattern cannot start with "?" at '.concat(a));for(;a<e.length;)if("\\"!==e[a]){if(")"===e[a]){if(0==--i){a++;break}}else if("("===e[a]&&(i++,"?"!==e[a+1]))throw new TypeError("Capturing groups are not allowed at ".concat(a));s+=e[a++]}else s+=e[a++]+e[a++];if(i)throw new TypeError("Unbalanced pattern at ".concat(n));if(!s)throw new TypeError("Missing pattern at ".concat(n));t.push({type:"PATTERN",index:n,value:s}),n=a}else{for(var o="",a=n+1;a<e.length;){var c=e.charCodeAt(a);if(!(c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||95===c))break;o+=e[a++]}if(!o)throw new TypeError("Missing parameter name at ".concat(n));t.push({type:"NAME",index:n,value:o}),n=a}else t.push({type:"CLOSE",index:n,value:e[n++]});else t.push({type:"OPEN",index:n,value:e[n++]});else t.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});else t.push({type:"MODIFIER",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),t}(e),r=t.prefixes,i=void 0===r?"./":r,s=t.delimiter,o=void 0===s?"/#?":s,a=[],c=0,h=0,u="",l=function(e){if(h<n.length&&n[h].type===e)return n[h++].value},f=function(e){var t=l(e);if(void 0!==t)return t;var r=n[h],i=r.type,s=r.index;throw new TypeError("Unexpected ".concat(i," at ").concat(s,", expected ").concat(e))},m=function(){for(var e,t="";e=l("CHAR")||l("ESCAPED_CHAR");)t+=e;return t},d=function(e){var t=a[a.length-1],n=e||(t&&"string"==typeof t?t:"");if(t&&!n)throw new TypeError('Must have text between two parameters, missing text after "'.concat(t.name,'"'));return!n||function(e){for(var t=0,n=o;t<n.length;t++){var r=n[t];if(e.indexOf(r)>-1)return!0}return!1}(n)?"[^".concat(q(o),"]+?"):"(?:(?!".concat(q(n),")[^").concat(q(o),"])+?")};h<n.length;){var p=l("CHAR"),y=l("NAME"),g=l("PATTERN");if(y||g){var v=p||"";-1===i.indexOf(v)&&(u+=v,v=""),u&&(a.push(u),u=""),a.push({name:y||c++,prefix:v,suffix:"",pattern:g||d(v),modifier:l("MODIFIER")||""})}else{var b=p||l("ESCAPED_CHAR");if(b)u+=b;else if(u&&(a.push(u),u=""),l("OPEN")){v=m();var E=l("NAME")||"",w=l("PATTERN")||"",O=m();f("CLOSE"),a.push({name:E||(w?c++:""),pattern:E&&!w?d(v):w,prefix:v,suffix:O,modifier:l("MODIFIER")||""})}else f("END")}}return a}function U(e,t){return function(e,t){void 0===t&&(t={});var n=V(t),r=t.encode,i=void 0===r?function(e){return e}:r,s=t.validate,o=void 0===s||s,a=e.map((function(e){if("object"==typeof e)return new RegExp("^(?:".concat(e.pattern,")$"),n)}));return function(t){for(var n="",r=0;r<e.length;r++){var s=e[r];if("string"!=typeof s){var c=t?t[s.name]:void 0,h="?"===s.modifier||"*"===s.modifier,u="*"===s.modifier||"+"===s.modifier;if(Array.isArray(c)){if(!u)throw new TypeError('Expected "'.concat(s.name,'" to not repeat, but got an array'));if(0===c.length){if(h)continue;throw new TypeError('Expected "'.concat(s.name,'" to not be empty'))}for(var l=0;l<c.length;l++){var f=i(c[l],s);if(o&&!a[r].test(f))throw new TypeError('Expected all "'.concat(s.name,'" to match "').concat(s.pattern,'", but got "').concat(f,'"'));n+=s.prefix+f+s.suffix}}else if("string"!=typeof c&&"number"!=typeof c){if(!h){var m=u?"an array":"a string";throw new TypeError('Expected "'.concat(s.name,'" to be ').concat(m))}}else{f=i(String(c),s);if(o&&!a[r].test(f))throw new TypeError('Expected "'.concat(s.name,'" to match "').concat(s.pattern,'", but got "').concat(f,'"'));n+=s.prefix+f+s.suffix}}else n+=s}return n}}(L(e,t),t)}function q(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function V(e){return e&&e.sensitive?"":"i"}function D(e,t,n){return function(e,t,n){void 0===n&&(n={});for(var r=n.strict,i=void 0!==r&&r,s=n.start,o=void 0===s||s,a=n.end,c=void 0===a||a,h=n.encode,u=void 0===h?function(e){return e}:h,l=n.delimiter,f=void 0===l?"/#?":l,m=n.endsWith,d="[".concat(q(void 0===m?"":m),"]|$"),p="[".concat(q(f),"]"),y=o?"^":"",g=0,v=e;g<v.length;g++){var b=v[g];if("string"==typeof b)y+=q(u(b));else{var E=q(u(b.prefix)),w=q(u(b.suffix));if(b.pattern)if(E||w)if("+"===b.modifier||"*"===b.modifier){var O="*"===b.modifier?"?":"";y+="(?:".concat(E,"((?:").concat(b.pattern,")(?:").concat(w).concat(E,"(?:").concat(b.pattern,"))*)").concat(w,")").concat(O)}else y+="(?:".concat(E,"(").concat(b.pattern,")").concat(w,")").concat(b.modifier);else{if("+"===b.modifier||"*"===b.modifier)throw new TypeError('Can not repeat "'.concat(b.name,'" without a prefix and suffix'));y+="(".concat(b.pattern,")").concat(b.modifier)}else y+="(?:".concat(E).concat(w,")").concat(b.modifier)}}if(c)i||(y+="".concat(p,"?")),y+=n.endsWith?"(?=".concat(d,")"):"$";else{var x=e[e.length-1],k="string"==typeof x?p.indexOf(x[x.length-1])>-1:void 0===x;i||(y+="(?:".concat(p,"(?=").concat(d,"))?")),k||(y+="(?=".concat(p,"|").concat(d,")"))}return new RegExp(y,V(n))}(L(e,n),0,n)}function W(e,t,n){return e instanceof RegExp?function(e){return e}(e):Array.isArray(e)?function(e,t,n){var r=e.map((function(e){return W(e,t,n).source}));return new RegExp("(?:".concat(r.join("|"),")"),V(n))}(e,t,n):D(e,0,n)}function H(e,n){if("object"!=typeof e||void 0===e||Array.isArray(e))return;if(e instanceof w)return n(e);const r=t({},e instanceof m?e.schema:e);for(const e in r){if(!r[e])continue;const t=H(r[e],n);if(t)return t}}function G(e,n){if("object"!=typeof e||void 0===e)return e;if(e instanceof w)return n(e);const r=t({},e instanceof m?e.schema:e);for(const e in r)r[e]&&(r[e]=G(r[e],n));return r}Object.hasOwn=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};class J extends Error{constructor(e){super(`${e.url}: ${e.statusText||`Status not 'ok': ${e.status}`}`),this.name="NetworkError",this.status=e.status,this.response=e}}function B(e,t){const n=new Set(e),r=[...e];for(const e of t)n.has(e)||r.push(e);return r}const Q=new Map;function X(e){return Q.has(e)||Q.set(e,U(e,{encode:encodeURIComponent,validate:!1})),Q.get(e)}const Y=new Map;function Z(e){return Y.has(e)||Y.set(e,new Set(L(e).map((e=>"string"==typeof e?e:`${e.name}`)))),Y.get(e)}const ee=Object.prototype,te=Object.getPrototypeOf;var ne=i("hasBody");class re extends M{constructor(e){var t;super(null!=(t=e.fetch)?t:async function(...e){const t=n(this,ne)[ne]&&e.length<2?{}:e[0]||{},r=n(this,ne)[ne]?e[e.length-1]:void 0;return this.fetchResponse(this.url(t),await this.getRequestInit(r)).then((e=>this.parseResponse(e))).then((t=>this.process(t,...e)))},e),Object.defineProperty(this,ne,{writable:!0,value:void 0}),(!("sideEffect"in this)||"method"in e&&!("sideEffect"in e))&&(this.sideEffect="GET"!==e.method&&void 0!==e.method||void 0),void 0===this.method&&(this.method=this.sideEffect?"POST":"GET"),void 0===this.urlPrefix&&(this.urlPrefix=""),n(this,ne)[ne]=!("body"in this&&void 0===this.body||["GET","DELETE"].includes(this.method)),Object.defineProperty(this,"name",{get(){return"__name"in this?this.__name:this.urlPrefix+this.path}})}key(...e){return`${this.method} ${this.url(n(this,ne)[ne]&&e.length<2?{}:e[0]||{})}`}url(e={}){const t=X(this.path)(e),n=Z(this.path),r={};return Object.keys(e).forEach((t=>{n.has(t)||(r[t]=e[t])})),Object.keys(r).length?`${this.urlPrefix}${t}?${this.searchToString(r)}`:`${this.urlPrefix}${t}`}searchToString(e){return function(e){const t=new URLSearchParams(e);return t.sort(),t.toString()}(e)}getHeaders(e){return e}async getRequestInit(e){const n=null!==(r=e)&&"object"==typeof r&&te(r)===ee;var r;n&&(e=JSON.stringify(e));const i=t({},this.requestInit,{method:this.method,signal:this.signal,body:e});return e&&!n||(i.headers=t({"Content-Type":"application/json"},i.headers)),i.headers=await this.getHeaders(i.headers),i}fetchResponse(e,t){return fetch(e,t).then((e=>{if(!e.ok)throw new J(e);return e})).catch((e=>{throw e instanceof TypeError&&(e.status=500),e}))}parseResponse(e){var t;return 204===e.status?Promise.resolve(null):null!=(t=e.headers.get("content-type"))&&t.includes("json")?e.json().catch((e=>{throw e.status=400,e})):e.text().then((t=>{if(["string","undefined"].includes(typeof this.schema)||null===this.schema||this.process!==re.prototype.process)return t;const n=new J(e);throw n.status=404,n.message=`Unexpected text response for schema ${this.schema}`,n}))}process(e){return e}errorPolicy(e){return e.status>=500?"soft":void 0}get pathRegex(){return W(this.path)}testKey(e){const t=this.method+" "+this.urlPrefix;if(!e.startsWith(t))return!1;let n=e.lastIndexOf("?");return-1===n&&(n=void 0),this.pathRegex.test(e.substring(t.length,n))}extend(e){class n extends this.constructor{}return Object.assign(n.prototype,this),new n(t({fetch:this.fetch},e))}paginated(e){if("string"==typeof e){const n=e;e=e=>{let r=t({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e),e));return delete r[n],[r]}}let n=!1;const r=G(this.schema,(t=>(n=!0,function(e,t){return Object.create(t,{name:{value:`Pagination(${t.schema})`},merge:{value:B},pk:{value:function(n,r,i,s){return t.pk.call(this,n,r,i,e(...s))}}})}(e,t))));if(!n)throw new Error("Missing Collection");const i=this;return this.extend({schema:r,key(...t){return i.key.call(this,...e(...t))},name:this.name+".getPage"})}get getPage(){return this.paginated(this.paginationField)}get push(){return this.extend({method:"POST",schema:H(this.schema,(e=>e.push)),name:this.name+".create"})}get unshift(){return this.extend({method:"POST",schema:H(this.schema,(e=>e.unshift)),name:this.name+".create"})}get assign(){return this.extend({method:"POST",schema:H(this.schema,(e=>e.assign)),name:this.name+".create"})}get remove(){return this.extend({method:"PATCH",schema:H(this.schema,(e=>e.remove)),name:this.name+".remove"})}}const ie=["path","schema","Endpoint","Collection","optimistic","paginationField"],{Invalidate:se,Collection:oe}=T;function ae(e){let{path:n,schema:r,Endpoint:i=re,Collection:s=oe,optimistic:o,paginationField:a}=e,c=j(e,ie);const h=function(e){const t=e.lastIndexOf(":");if(-1===t)throw new Error("Resource path requires at least one :parameter");let n=e.substring(0,t);return"/"===n[n.length-1]&&(n=n.substring(0,n.length-1)),n}(n),u=e=>`${null==r?void 0:r.name}.${e}`;function l(e,t,n){e[t]=e[t].extend(n)}const f=t({},c),m=t({},c),d=new i(t({},c,{path:n,schema:r,name:u("get")}));o&&(f.getOptimisticResponse=ce,m.getOptimisticResponse=function(e){return function(n,r,i){const s=n.get(e,r);if(!s)throw n.abort;return t({},r,s,ue(i))}}(r));const p=new i(t({},f,{paginationField:a,path:h,schema:new s([r]),name:u("getList")}));return{get:d,getList:p,create:p.push.extend({name:u("create")}),update:new i(t({},f,{path:n,schema:r,method:"PUT",name:u("update")})),partialUpdate:new i(t({},m,{path:n,schema:r,method:"PATCH",name:u("partialUpdate")})),delete:new i(t({},f,{path:n,schema:r.process||r._hoistable?new se(r):r,method:"DELETE",name:u("delete"),process:(e,t)=>e&&Object.keys(e).length?e:t,getOptimisticResponse:o?he:void 0})),extend(...e){if("string"==typeof e[0]){const[n,r]=e;if(n in this){const e=t({},this);return l(e,n,r),e}return t({},this,{[n]:this.get.extend(r)})}if("function"==typeof e[0]){return t({},this,e[0](this))}const n=e[0],r=t({},this);for(const e in n)l(r,e,n[e]);return r}}}function ce(e,n,r){return t({},n,ue(r))}function he(e,t){return t}function ue(e){return e instanceof FormData?Object.fromEntries(e.entries()):e}e.All=l,e.Collection=w,e.Endpoint=M,e.Entity=z,e.EntityMixin=P,e.ExtendableEndpoint=F,e.Invalidate=d,e.NetworkError=J,e.Query=R,e.RestEndpoint=re,e.Union=a,e.Values=c,e.createResource=ae,e.getUrlBase=X,e.getUrlTokens=Z,e.hookifyResource=function(e,t){const n={};return Object.keys(e).forEach((r=>{const i=e[r];var s;void 0!==i.extend&&(n[`use${s=r,s.charAt(0).toUpperCase()+s.slice(1)}`]=()=>{const e=t();return i.extend({requestInit:e})})})),n},e.resource=ae,e.schema=T,e.validateRequired=function(e,t){let n="";if(Object.keys(t).some((t=>!Object.hasOwn(e,t)&&(n=t,!0))))return`Missing key ${n}`}}));
1
+ !function(u,D){"object"==typeof exports&&"undefined"!=typeof module?D(exports):"function"==typeof define&&define.amd?define(["exports"],D):D((u="undefined"!=typeof globalThis?globalThis:u||self).Rest={})}(this,(function(u){"use strict";function D(){return D=Object.assign?Object.assign.bind():function(u){for(var D=1;D<arguments.length;D++){var F=arguments[D];for(var e in F)({}).hasOwnProperty.call(F,e)&&(u[e]=F[e])}return u},D.apply(null,arguments)}function F(u,D){if(!{}.hasOwnProperty.call(u,D))throw new TypeError("attempted to use private field on non-instance");return u}var e=0;function t(u){return"__private_"+e+++"_"+u}function C(u){return!("function"!=typeof u.hasOwnProperty||!(Object.hasOwnProperty.call(u,"__ownerID")||u._map&&Object.hasOwnProperty.call(u._map,"__ownerID")))}class E{constructor(u,D){this.schema=void 0,D&&(this._schemaAttribute="string"==typeof D?u=>u[D]:D),this.define(u)}get isSingleSchema(){return!this._schemaAttribute}define(u){u._hoistable&&!this._schemaAttribute?(this.schema=u.schema,this._schemaAttribute=u._schemaAttribute):this.schema=u}getSchemaAttribute(u,D,F){return!this.isSingleSchema&&this._schemaAttribute(u,D,F)}inferSchema(u,D,F){if(this.isSingleSchema)return this.schema;const e=this.getSchemaAttribute(u,D,F);return this.schema[e]}schemaKey(){return this.isSingleSchema?this.schema.key:Object.values(this.schema).join(";")}normalizeValue(u,D,F,e,t){if(!u)return u;const C=this.isSingleSchema,E=C?this.schema:this.schema[this._schemaAttribute(u,D,F)];if(!E)return u;const A=t(E,u,D,F,e);return C||null==A?A:{id:A,schema:this._schemaAttribute(u,D,F)}}denormalizeValue(u,D){const F=this.isSingleSchema,e=!F&&u&&(C(u)?u.get("schema"):u.schema);if(!F&&!e){if("object"==typeof u&&null!==u){const F=this.inferSchema(u,void 0,void 0);if(F)return D(F,u)}return u}const t=F?void 0:C(u)?u.get("id"):u.id;return D(F?this.schema:this.schema[e],t||u)}}class A extends E{constructor(u,D){if(!D)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(u,D),this._hoistable=!0}normalize(u,D,F,e,t){return this.normalizeValue(u,D,F,e,t)}denormalize(u,D,F){return this.denormalizeValue(u,F)}queryKey(u,D){if(!u[0])return;const F=this.getSchemaAttribute(u[0],void 0,""),e=this.schema[F];if(e){const t=D(e,u);if(void 0===t)return;return{id:t,schema:F}}for(const F in this.schema){const e=D(this.schema[F],u);if(void 0!==e)return{id:e,schema:F}}}}class n extends E{normalize(u,D,F,e,t,C){const E={},A=Object.keys(u);for(let D=0;D<A.length;D++){const F=A[D],C=u[F];null!=C&&(E[F]=this.normalizeValue(C,u,F,e,t))}return E}denormalize(u,D,F){const e={},t=Object.keys(u);for(let D=0;D<t.length;D++){const C=t[D],E=u[C],A=this.denormalizeValue(E,F);A&&"symbol"!=typeof A&&(e[C]=A)}return e}queryKey(u,D,F){}}const r=u=>void 0!==u&&"symbol"!=typeof u;class s extends E{normalize(u,D,F,e,t){const C=(u=>Array.isArray(u)?u:Object.keys(u).map((D=>u[D])))(u);return C.map((u=>this.normalizeValue(u,D,F,e,t)))}denormalize(u,D,F){return u.map?u.map((u=>this.denormalizeValue(u,F))).filter(r):u}queryKey(u,D,F){}toJSON(){return[this.schema]}}class i extends s{constructor(u,D){super(u,D)}normalize(u,D,F,e,t){super.normalize(u,D,F,e,t)}queryKey(u,D,F){if(this.isSingleSchema){const u=F.getEntities(this.schema.key);return u?[...u.keys()]:F.INVALID}let e=!1;const t=Object.values(this.schema).flatMap((u=>{const D=F.getEntities(u.key);if(!D)return[];e=!0;const t=[];for(const[F,e]of D.entries())e&&"symbol"!=typeof e&&t.push({id:u.pk(e,void 0,F,[]),schema:this.getSchemaAttribute(e,void 0,F)});return t}));return e?t:F.INVALID}}function B(u,F,e,t){if(C(F))return function(u,D,F){let e;const t=Object.keys(u).reduce(((D,t)=>{const C=`${t}`,E=F(u[C],D.get(C));return"symbol"==typeof E&&(e=E),D.has(C)?D.set(C,E):D}),D);return null!=e?e:t}(u,F,t);const E=D({},F),A=Object.keys(u);for(let D=0;D<A.length;D++){const F=A[D],e=t(u[F],E[F]);if(void 0!==E[F]&&(E[F]=e),"symbol"==typeof e)return e}return E}class o{constructor(u){this.schema=void 0,this.define(u)}define(u){this.schema=Object.keys(u).reduce(((F,e)=>{const t=u[e];return D({},F,{[e]:t})}),this.schema||{})}normalize(...u){return((u,F,e,t,C,E)=>{const A=D({},F),n=Object.keys(u);for(let D=0;D<n.length;D++){const e=n[D],t=E(u[e],F[e],F,e,C);void 0===t?delete A[e]:A[e]=t}return A})(this.schema,...u)}denormalize(u,D,F){return B(this.schema,u,0,F)}queryKey(u,D){return function(u,D,F){const e={},t=Object.keys(u);for(let C=0;C<t.length;C++){const E=t[C];e[E]=F(u[E],D)}return e}(this.schema,u,D)}}let a=class extends E{constructor(u,D){super(u,D)}get key(){return this.schemaKey()}normalize(u,D,F,e,t,C){const E=this.inferSchema(u,D,F);if(!E)return u;let A;if("string"==typeof u||"number"==typeof u)A=u;else{const t=E.process(u,D,F,e);A=E.pk(null!=t?t:u,D,F,e)}return A=`${A}`,C.invalidate(E,A),this.isSingleSchema?A:{id:A,schema:this.getSchemaAttribute(u,D,F)}}queryKey(u,D,F){}denormalize(u,D,F){return this.denormalizeValue(u,F)}_denormalizeNullable(){return{}}_normalizeNullable(){return{}}};const c=(u,D)=>[...u,...D],h=(u,D)=>[...D,...u],l=(u,F)=>D({},u,F),f=(u,D)=>"object"==typeof u&&"object"==typeof D?u.id===D.id&&u.schema===D.schema:u===D,m=(u,D)=>u.filter((u=>!D.some((D=>f(u,D))))),p=(u,D)=>{const F=Object.values(D),e={};for(const[D,t]of Object.entries(u))F.some((u=>f(t,u)))||(e[D]=t);return e},d=u=>[...u],y=u=>D({},u);class g{addWith(u,D){return v(this,u,D)}moveWith(u){return O(this,u,this.schema instanceof s?m:p)}createCollectionFilter(...u){return D=>Object.entries(D).every((([D,F])=>{var e;return this.nonFilterArgumentKeys(D)||`${u[0][D]}`===F||`${null==(e=u[1])?void 0:e[D]}`===F}))}nonFilterArgumentKeys(u){return u.startsWith("order")}constructor(u,F){if(this.schema=Array.isArray(u)?new s(u[0]):u,F?"nestKey"in F?this.nestKey=F.nestKey:this.argsKey="argsKey"in F?F.argsKey:u=>D({},u):this.argsKey=u=>D({},u),this.key=function(u){if(u instanceof s)return`[${u.schemaKey()}]`;if(u instanceof n)return`{${u.schemaKey()}}`;return`(${u.schemaKey()})`}(this.schema),null!=F&&F.nonFilterArgumentKeys){const{nonFilterArgumentKeys:u}=F;"function"==typeof u?this.nonFilterArgumentKeys=u:u instanceof RegExp?this.nonFilterArgumentKeys=D=>u.test(D):this.nonFilterArgumentKeys=D=>u.includes(D)}else null!=F&&F.createCollectionFilter&&(this.createCollectionFilter=F.createCollectionFilter.bind(this));this.schema instanceof s?(this.createIfValid=d,this.push=v(this,c),this.unshift=v(this,h),this.remove=v(this,m),this.move=O(this,c,m)):u instanceof n&&(this.createIfValid=y,this.assign=v(this,l),this.remove=v(this,p),this.move=O(this,l,p))}get cacheWith(){return this.schema.schema}toString(){return this.key}toJSON(){return{key:this.key,schema:this.schema.schema}}pk(u,D,F,e){const t=this.argsKey?this.argsKey(...e):this.nestKey(D,F);for(const u in t)["number","boolean"].includes(typeof t[u])&&(t[u]=`${t[u]}`);return function(u){const D=Object.keys(u).sort(),F={};for(const e of D)F[e]=u[e];return JSON.stringify(F)}(t)}normalize(u,D,F,e,t,C){const E=this.schema.normalize(u,D,F,e,t,C),A=this.pk(E,D,F,e);return C.mergeEntity(this,A,E),A}merge(u,D){return D}shouldReorder(u,D,F,e){return D.fetchedAt<u.fetchedAt}mergeWithStore(u,D,F,e){return this.shouldReorder(u,D,F,e)?this.merge(e,F):this.merge(F,e)}mergeMetaWithStore(u,D,F,e){return this.shouldReorder(u,D,F,e)?u:D}queryKey(u,D,F){if(this.argsKey){const D=this.pk(void 0,void 0,"",u);if(F.getEntity(this.key,D))return D}}denormalize(u,D,F){return this.schema.denormalize(u,D,F)}}function b(u,D,F){const e={merge:{value:D},normalize:{value:F},queryKey:{value:x}};return u.schema instanceof s&&(e.createIfValid={value:j},e.denormalize={value:$}),e}function v(u,D,F){const e=b(u,D,k);return F&&(e.createCollectionFilter={value:F}),Object.create(u,e)}function x(){}function k(u,D,F,e,t,C){const E=this.schema.normalize(this.schema instanceof s&&!Array.isArray(u)?[u]:u,D,F,e,t,C),A=this.createCollectionFilter(...e),n=C.getEntities(this.key);if(n)for(const u of n.keys())A(JSON.parse(u))&&C.mergeEntity(this,u,E);return E}function O(u,D,F){return Object.create(u,b(u,D,(function(u,e,t,C,E,A){return w.call(this,D,F,u,e,t,C,E,A)})))}function w(u,F,e,t,C,E,A,n){const r=this.schema instanceof s,i=this.schema.schema,B=(r&&Array.isArray(e)?e:[e]).map((u=>{const D=i.process(u,t,C,E),F=`${i.pk(D,t,C,E)}`;return{pk:F,processed:D,existingEntity:F?n.getEntity(i.key,F):void 0}})),o=r?Array.isArray(e)?e:[e]:B[0].pk?{[B[0].pk]:e}:e,a=this.schema.normalize(o,t,C,E,A,n),c=E[E.length-1],h=Object.create(this,{merge:{value:u}}),l=Object.create(this,{merge:{value:F}}),f=n.getEntities(this.key);if(f)for(let u=0;u<B.length;u++){const{processed:F,existingEntity:e}=B[u],t=r?[a[u]]:a,C=r?D({},c,F):c,A=e?D({},e,C):C,s=e?this.createCollectionFilter(D({},E[0],e),e):void 0,i=this.createCollectionFilter(D({},E[0],C),A);for(const u of f.keys()){const D=JSON.parse(u),F=null==s?void 0:s(D),e=i(D);F&&!e?n.mergeEntity(l,u,t):e&&!F&&n.mergeEntity(h,u,t)}}return a}function j(u){return Array.isArray(u)?[...u]:D({},u)}function $(u,D,F){return Array.isArray(u)?this.schema.denormalize(u,D,F):this.schema.denormalize([u],D,F)[0]}function S(u,D){if(null==u)return{};var F={};for(var e in u)if({}.hasOwnProperty.call(u,e)){if(-1!==D.indexOf(e))continue;F[e]=u[e]}return F}const _=["pk","schema","key"];function P(u,F={}){class e extends u{static toString(){return this.key}static toJSON(){return{key:this.key,schema:this.schema}}static pk(u,D,F,e){return this.prototype.pk.call(u,D,F,e)}static shouldUpdate(u,D,F,e){return!0}static shouldReorder(u,D,F,e){return D.fetchedAt<u.fetchedAt}static merge(u,F){return D({},u,F)}static mergeWithStore(u,D,F,e){return this.shouldUpdate(u,D,F,e)?typeof e!=typeof F?e:this.shouldReorder(u,D,F,e)?this.merge(e,F):this.merge(F,e):F}static mergeMetaWithStore(u,D,F,e){return this.shouldReorder(u,D,F,e)?u:D}static fromJS(u={}){const D=new this(u);return Object.assign(D,u),D}static createIfValid(u){if(!this.validate(u))return this.fromJS(u)}static process(u,F,e,t){return D({},u)}static normalize(u,D,F,e,t,C){const E=this.process(u,D,F,e);let A;if(void 0===E)return A=`${this.pk(u,D,F,e)}`,C.invalidate(this,A),A;if(A=this.pk(E,D,F,e),A=void 0===A||""===A||"undefined"===A?`MISS-${Math.random()}`:`${A}`,C.checkLoop(this.key,A,u))return A;!function(u){if(u){const D=new Error(u);throw D.status=400,D}}(this.validate(E));const n=Object.keys(this.schema);for(let u=0;u<n.length;u++){const D=n[u];Object.hasOwn(E,D)&&(E[D]=t(this.schema[D],E[D],E,D,e))}return C.mergeEntity(this,A,E),A}static validate(u){}static queryKey(u,D,F){if(!u[0])return;const e=function(u,D,F){if(["string","number"].includes(typeof D[0]))return`${D[0]}`;const e=u.pk(D[0],void 0,"",D);if(void 0!==e&&""!==e)return e;const t=(C=D[0],E=u.indexes,E?E.find((u=>Object.hasOwn(C,u))):void 0);var C,E;if(!t)return;const A=D[0][t];return F.getIndex(u.key,t,A)}(this,u,F);return e&&F.getEntity(this.key,e)?e:void 0}static denormalize(u,D,F){if("symbol"==typeof u)return u;for(const D of Object.keys(this.schema)){const e=F(this.schema[D],u[D]);if("symbol"==typeof e){if(this.defaults[D])return e;u[D]=void 0}else u[D]=e}return u}static get defaults(){return Object.hasOwn(this,"__defaults")||Object.defineProperty(this,"__defaults",{value:new this,writable:!0,configurable:!0}),this.__defaults}}const t=S(F,_);if(Object.assign(e,t),"schema"in F?e.schema=F.schema:u.schema||(e.schema={}),"pk"in F?"function"==typeof F.pk?e.prototype.pk=function(u,D){return F.pk(this,u,D)}:e.prototype.pk=function(){return this[F.pk]}:"function"!=typeof u.prototype.pk&&(e.prototype.pk=function(){return this.id}),"key"in F)Object.defineProperty(e,"key",{value:F.key,configurable:!0,writable:!0,enumerable:!0});else if(!("key"in u)){function C(u){Object.defineProperty(this,"key",{value:u,writable:!0,enumerable:!0,configurable:!0})}const E=function(){return"EntityMixin"===this.name?u.name:this.name},A="undefined"!=typeof document&&document.CLS_MANGLE?function(){return null==document.CLS_MANGLE||document.CLS_MANGLE(this),Object.defineProperty(e,"key",{get:E,set:C,enumerable:!0,configurable:!0}),E.call(this)}:E;Object.defineProperty(e,"key",{get:A,set:C,enumerable:!0,configurable:!0})}return e}class z{constructor(u,D){this.schema=u,this.process=D}normalize(...u){return this.schema.normalize(...u)}denormalize(u,D,F){const e=F(this.schema,u);return"symbol"==typeof e?e:this.process(e,...D)}queryKey(u,D){return D(this.schema,u)}}class K{constructor(u){this._query=void 0,this.schema=u}normalize(u,D,F,e,t,C){return t(this.schema,u,D,F,e)}denormalize(u,D,F){return u}queryKey(u,D,F){}get query(){return this._query||(this._query=new T(this.schema)),this._query}}class T{constructor(u){this.schema=u}denormalize(u,D,F){return F(this.schema,u)}queryKey(u,D,F){const e=this.schema;return"function"==typeof e.queryKey&&e.key?e.queryKey(u,D,F):u[0]}}var R=Object.freeze({__proto__:null,All:i,Array:s,Collection:g,Entity:P,EntityMixin:P,Invalidate:a,Lazy:K,Object:o,Query:z,Union:A,Values:n,unshift:h});const q=class{};class N extends(P(q)){static process(u,D,F,e){return super.process(u,D,F,e)}}var I;const U="undefined"!=typeof document;let M=U&&!(null!=(I=document.querySelector("meta[http-equiv='Content-Security-Policy']"))&&I.getAttribute("content"));try{M||Function()}catch(u){M=!0,U&&console.error("Content Security Policy: The previous CSP log can be safely ignored - @data-client/endpoint will use setPrototypeOf instead")}var L;class V extends Function{constructor(u,D){let F,e;return M?(F=(...u)=>F.fetch(...u),Object.setPrototypeOf(F,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),F=this),u&&(F.fetch=u),D&&"name"in D||!u||!u.name||"anonymous"===u.name||(e=u.name),Object.defineProperty(F,"name",{get(){return e||this.__name},set(u){this.__name=u}}),Object.assign(F,D),F}key(...u){return`${this.name} ${JSON.stringify(u)}`}testKey(u){return u.startsWith(this.name)}bind(u,...D){const F=this.fetch,e=this.key;return this.extend({fetch(){return F.apply(null!=u?u:this,D)},key(){return e.apply(this,D)}})}extend(u){class D extends this.constructor{}return Object.assign(D.prototype,this),new D(u.fetch,u)}}L=V,(()=>{if("undefined"!=typeof document&&document.FUNC_MANGLE){const u=L.prototype.key;L.prototype.key=function(...D){return null==document.FUNC_MANGLE||document.FUNC_MANGLE(this),this.prototype.key=u,u.call(this,...D)}}})();const J=V;Object.hasOwn=Object.hasOwn||function(u,D){return Object.prototype.hasOwnProperty.call(u,D)};var W,G={};var H=function(){if(W)return G;W=1,Object.defineProperty(G,"__esModule",{value:!0}),G.PathError=G.TokenData=void 0,G.parse=r,G.compile=function(D,F={}){const{encode:e=encodeURIComponent,delimiter:t=u}=F,C=s(("object"==typeof D?D:r(D,F)).tokens,t,e);return function(u={}){const[D,...F]=C(u);if(F.length)throw new TypeError(`Missing parameters: ${F.join(", ")}`);return D}},G.match=function(F,e={}){const{decode:t=decodeURIComponent,delimiter:C=u}=e,{regexp:E,keys:A}=i(F,e),n=A.map((u=>!1===t?D:"param"===u.type?t:u=>u.split(C).map(t)));return function(u){const D=E.exec(u);if(!D)return!1;const F=D[0],e=Object.create(null);for(let u=1;u<D.length;u++){if(void 0===D[u])continue;const F=A[u-1],t=n[u-1];e[F.name]=t(D[u])}return{path:F,params:e}}},G.pathToRegexp=i,G.stringify=function(u){return l(u.tokens,0)};const u="/",D=u=>u,F=/^(?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC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DE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A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FEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])$/,e=/^(?:[\$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u0870-\u0887\u0889-\u088F\u0897-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5C\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDC-\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1715\u171F-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B4C\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA827\uA82C\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF65-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\u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-\uDDA9\uDDB0-\uDDDB\uDDE0-\uDDE9\uDEE0-\uDEF6\uDF00-\uDF10\uDF12-\uDF3A\uDF3E-\uDF42\uDF50-\uDF5A\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC40-\uDC55\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD39]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDD70-\uDD79\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C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3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]|\uDB40[\uDD00-\uDDEF])$/,t=/^(?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uD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E\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-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00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])(?:[\$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u0870-\u0887\u0889-\u088F\u0897-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u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0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1715\u171F-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B4C\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\u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F3E-\uDF42\uDF50-\uDF5A\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC40-\uDC55\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD39]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDD70-\uDD79\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0-\uDFF6]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD833[\uDCF0-\uDCF9\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uD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-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]|\uDB40[\uDD00-\uDDEF])*$/,C="{}()[]+?!";function E(u){return u.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class A{constructor(u,D){this.tokens=u,this.originalPath=D}}G.TokenData=A;class n extends TypeError{constructor(u,D){let F=u;D&&(F+=`: ${D}`),F+="; visit https://git.new/pathToRegexpError for info",super(F),this.originalPath=D}}function r(u,t={}){const{encodePath:E=D}=t,r=[...u],s=[];let i=0,B=0;function o(){let D="";if(F.test(r[i]))do{D+=r[i++]}while(e.test(r[i]));else if('"'===r[i]){let F=i;for(;i<r.length;){if('"'===r[++i]){i++,F=0;break}"\\"===r[i]&&i++,D+=r[i]}if(F)throw new n(`Unterminated quote at index ${F}`,u)}if(!D)throw new n(`Missing parameter name at index ${i}`,u);return D}for(;i<r.length;){const u=r[i++];C.includes(u)?s.push({type:u,index:i,value:u}):"\\"===u?s.push({type:"escape",index:i,value:r[i++]}):":"===u?s.push({type:"param",index:i,value:o()}):"*"===u?s.push({type:"wildcard",index:i,value:o()}):s.push({type:"char",index:i,value:u})}return s.push({type:"end",index:i,value:""}),new A(function D(F){const e=[];for(;;){const t=s[B++];if(t.type===F)break;if("char"!==t.type&&"escape"!==t.type)if("param"!==t.type&&"wildcard"!==t.type){if("{"!==t.type)throw new n(`Unexpected ${t.type} at index ${t.index}, expected ${F}`,u);e.push({type:"group",tokens:D("}")})}else e.push({type:t.type,name:t.value});else{let u=t.value,D=s[B];for(;"char"===D.type||"escape"===D.type;)u+=D.value,D=s[++B];e.push({type:"text",value:E(u)})}}return e}("end"),u)}function s(u,F,e){const t=u.map((u=>function(u,F,e){if("text"===u.type)return()=>[u.value];if("group"===u.type){const D=s(u.tokens,F,e);return u=>{const[F,...e]=D(u);return e.length?[""]:[F]}}const t=e||D;if("wildcard"===u.type&&!1!==e)return D=>{const e=D[u.name];if(null==e)return["",u.name];if(!Array.isArray(e)||0===e.length)throw new TypeError(`Expected "${u.name}" to be a non-empty array`);return[e.map(((D,F)=>{if("string"!=typeof D)throw new TypeError(`Expected "${u.name}/${F}" to be a string`);return t(D)})).join(F)]};return D=>{const F=D[u.name];if(null==F)return["",u.name];if("string"!=typeof F)throw new TypeError(`Expected "${u.name}" to be a string`);return[t(F)]}}(u,F,e)));return u=>{const D=[""];for(const F of t){const[e,...t]=F(u);D[0]+=e,D.push(...t)}return D}}function i(D,F={}){const{delimiter:e=u,end:t=!0,sensitive:C=!1,trailing:A=!0}=F,s=new o("^"),i=[D];let h=0;for(;i.length;){const u=i.shift();if(Array.isArray(u)){i.push(...u);continue}const D="object"==typeof u?u:r(u,F);a(D.tokens,0,[],(u=>{if(h++>=256)throw new n("Too many path combinations",D.originalPath);let F=s;for(const t of c(u,e,D.originalPath))F=F.add(t.source,t.key);F.add("")}))}const l=[];let f=B(s,l);return A&&(f+="(?:"+E(e)+"$)?"),f+=t?"$":"(?="+E(e)+"|$)",{regexp:new RegExp(f,C?"":"i"),keys:l}}function B(u,D){u.key&&D.push(u.key);const F=Object.keys(u.children),e=F.map((F=>B(u.children[F],D))).join("|");return u.source+(F.length<2?e:`(?:${e})`)}G.PathError=n;class o{constructor(u,D){this.source=u,this.key=D,this.children=Object.create(null)}add(u,D){var F;const e=u+":"+(D?D.name:"");return(F=this.children)[e]||(F[e]=new o(u,D))}}function a(u,D,F,e){for(;D<u.length;){const t=u[D++];"group"!==t.type?F.push(t):a(t.tokens,0,F.slice(),(F=>a(u,D,F,e)))}e(F)}function c(u,D,F){let e=[],t="",C="",A=0,r=0,s=0;function i(F,e){for(;F<u.length;){const t=u[F++];if(t.type===e)return!0;if("text"===t.type&&t.value.includes(D))break}return!1}function B(D){let F="";for(;D<u.length;){const e=u[D++];if("text"!==e.type)break;F+=e.value}return F}for(;s<u.length;){const o=u[s++];if("text"!==o.type){if("param"!==o.type&&"wildcard"!==o.type)throw new TypeError(`Unknown token type: ${o.type}`);if(A&&!t)throw new n(`Missing text before "${o.name}" ${o.type}`,F);"param"===o.type?(e.push({source:r?`(${h(D,t)}+?)`:i(s,"wildcard")?`(${h(D,B(s))}+?)`:`(${h(D,"")}+?)`,key:o}),r|=A=1):(e.push({source:2&r?`(${h(t,"")}+?)`:1&r?`(${h(C,"")}+?)`:C?`(${h(C,"")}+?|${h(D,"")}+?)`:"([^]+?)",key:o}),C="",r|=A=2),t=""}else e.push({source:E(o.value)}),t+=o.value,2===A&&(C+=o.value),o.value.includes(D)&&(r=0)}return e}function h(u,D){return D.length>u.length?h(D,u):(u===D&&(D=""),D.length>1?`(?:(?!${E(u)}|${E(D)})[^])`:u.length>1?`(?:(?!${E(u)})[^${E(D)}])`:`[^${E(u+D)}]`)}function l(u,D){let F="";for(;D<u.length;){const e=u[D++];if("text"!==e.type)if("group"!==e.type)if("param"!==e.type){if("wildcard"!==e.type)throw new TypeError(`Unknown token type: ${e.type}`);F+="*"+f(e.name,u[D])}else F+=":"+f(e.name,u[D]);else F+="{"+l(e.tokens,0)+"}";else F+=e.value.replace(/[{}()\[\]+?!:*\\]/g,"\\$&")}return F}function f(u,D){return t.test(u)?"text"===(null==D?void 0:D.type)&&e.test(D.value[0])?JSON.stringify(u):u:JSON.stringify(u)}return G}();function Z(u,F){if("object"!=typeof u||void 0===u||Array.isArray(u))return;if(u instanceof g)return F(u);const e=D({},u instanceof o?u.schema:u);for(const u in e){if(!e[u])continue;const D=Z(e[u],F);if(D)return D}}function Q(u,F){if("object"!=typeof u||void 0===u)return u;if(u instanceof g)return F(u);const e=D({},u instanceof o?u.schema:u);for(const u in e)e[u]&&(e[u]=Q(e[u],F));return e}class X extends Error{constructor(u){super(`${u.url}: ${u.statusText||`Status not 'ok': ${u.status}`}`),this.name="NetworkError",this.status=u.status,this.response=u}toJSON(){return{name:this.name,status:this.status,message:this.message,url:this.response.url}}}function Y(u,D){const F=new Set(u),e=[...u];for(const u of D)F.has(u)||e.push(u);return e}const uu=Object.create(null);function Du(u){return u in uu||(uu[u]=H.compile(u)),uu[u]}const Fu=Object.create(null);function eu(u){return u in Fu||(Fu[u]=tu(H.parse(u).tokens)),Fu[u]}function tu(u){const D=new Set;for(const F of u)switch(F.type){case"param":case"wildcard":D.add(F.name);break;case"group":for(const u of tu(F.tokens))D.add(u)}return D}const Cu=Object.prototype,Eu=Object.getPrototypeOf;var Au=t("hasBody");class nu extends V{constructor(u){var D;super(null!=(D=u.fetch)?D:async function(...u){const D=F(this,Au)[Au]&&u.length<2?{}:u[0]||{},e=F(this,Au)[Au]?u[u.length-1]:void 0;return this.fetchResponse(this.url(D),await this.getRequestInit(e)).then((u=>this.parseResponse(u))).then((D=>this.process(D,...u)))},u),Object.defineProperty(this,Au,{writable:!0,value:void 0}),(!("sideEffect"in this)||"method"in u&&!("sideEffect"in u))&&(this.sideEffect="GET"!==u.method&&void 0!==u.method||void 0),void 0===this.method&&(this.method=this.sideEffect?"POST":"GET"),void 0===this.urlPrefix&&(this.urlPrefix=""),F(this,Au)[Au]=!("body"in this&&void 0===this.body||["GET","DELETE"].includes(this.method)),Object.defineProperty(this,"name",{get(){return"__name"in this?this.__name:this.urlPrefix+this.path}})}key(...u){return`${this.method} ${this.url(F(this,Au)[Au]&&u.length<2?{}:u[0]||{})}`}url(u={}){const D=eu(this.path),F={},e={};Object.keys(u).forEach((t=>{D.has(t)?void 0!==u[t]&&(F[t]=Array.isArray(u[t])?u[t].map(String):String(u[t])):e[t]=u[t]}));const t=Du(this.path)(F);return Object.keys(e).length?`${this.urlPrefix}${t}?${this.searchToString(e)}`:`${this.urlPrefix}${t}`}searchToString(u){return function(u){const D=new URLSearchParams(u);return D.sort(),D.toString()}(u)}getHeaders(u){return u}async getRequestInit(u){const F=null!==(e=u)&&"object"==typeof e&&Eu(e)===Cu;var e;F&&(u=JSON.stringify(u));const t=D({},this.requestInit,{method:this.method,signal:this.signal,body:u});return u&&!F||(t.headers=D({"Content-Type":"application/json"},t.headers)),t.headers=await this.getHeaders(t.headers),t}fetchResponse(u,D){return fetch(u,D).then((u=>{if(!u.ok)throw new X(u);return u})).catch((u=>{throw u instanceof TypeError&&(u.status=500),u}))}parseResponse(u){var D;return 204===u.status?Promise.resolve(null):null!=(D=u.headers.get("content-type"))&&D.includes("json")?u.json().catch((u=>{throw u.status=400,u})):u.text().then((D=>{if(["string","undefined"].includes(typeof this.schema)||null===this.schema||this.process!==nu.prototype.process)return D;const F=new X(u);throw F.status=404,F.message=`Unexpected text response for schema ${this.schema}`,F}))}process(u){return u}errorPolicy(u){return u.status>=500?"soft":void 0}get pathRegex(){return H.pathToRegexp(this.path).regexp}testKey(u){const D=this.method+" "+this.urlPrefix;if(!u.startsWith(D))return!1;let F=u.lastIndexOf("?");return-1===F&&(F=void 0),this.pathRegex.test(u.substring(D.length,F))}extend(u){class F extends this.constructor{}return Object.assign(F.prototype,this),new F(D({fetch:this.fetch},u))}paginated(u){if("string"==typeof u){const F=u;u=u=>{let e=D({},(function(u){if(null==u)throw new TypeError("Cannot destructure "+u)}(u),u));return delete e[F],[e]}}let F=!1;const e=Q(this.schema,(D=>(F=!0,function(u,D){return Object.create(D,{name:{value:`Pagination(${D.schema})`},merge:{value:Y},pk:{value:function(F,e,t,C){return D.pk.call(this,F,e,t,u(...C))}}})}(u,D))));if(!F)throw new Error("Missing Collection");const t=this;return this.extend({schema:e,key(...D){return t.key.call(this,...u(...D))},name:this.name+".getPage"})}get getPage(){return this.paginated(this.paginationField)}get push(){return this.extend({method:"POST",schema:Z(this.schema,(u=>u.push)),name:this.name+".create"})}get unshift(){return this.extend({method:"POST",schema:Z(this.schema,(u=>u.unshift)),name:this.name+".create"})}get assign(){return this.extend({method:"POST",schema:Z(this.schema,(u=>u.assign)),name:this.name+".create"})}get remove(){return this.extend({method:"PATCH",schema:Z(this.schema,(u=>u.remove)),name:this.name+".remove"})}get move(){const u={method:"PATCH",schema:Z(this.schema,(u=>u.move)),searchParams:void 0,name:this.name+".partialUpdate"};return this.movePath&&(u.path=this.movePath),this.extend(u)}}const ru=["path","schema","Endpoint","Collection","optimistic","paginationField"],{Invalidate:su,Collection:iu}=R;function Bu(u){let{path:F,schema:e,Endpoint:t=nu,Collection:C=iu,optimistic:E,paginationField:A}=u,n=S(u,ru);const r=function(u){const D=Math.max(u.lastIndexOf(":"),u.lastIndexOf("*"));if(-1===D)throw new Error("Resource path requires at least one :parameter or *wildcard");let F=u.substring(0,D);return"/"===F[F.length-1]&&(F=F.substring(0,F.length-1)),F}(F),s=u=>`${null==e?void 0:e.name}.${u}`;function i(u,D,F){u[D]=u[D].extend(F)}const B=D({},n),o=D({},n),a=new t(D({},n,{path:F,schema:e,name:s("get")}));E&&(B.getOptimisticResponse=ou,o.getOptimisticResponse=function(u){return function(F,e,t){const C=F.get(u,e);if(!C)throw F.abort;return D({},e,C,cu(t))}}(e));const c=new t(D({},B,{paginationField:A,movePath:F,path:r,schema:new C([e]),name:s("getList")}));return{get:a,getList:c,create:c.push.extend({name:s("create")}),update:new t(D({},B,{path:F,schema:e,method:"PUT",name:s("update")})),partialUpdate:new t(D({},o,{path:F,schema:e,method:"PATCH",name:s("partialUpdate")})),delete:new t(D({},B,{path:F,schema:e.process||e._hoistable?new su(e):e,method:"DELETE",name:s("delete"),process:(u,D)=>u&&Object.keys(u).length?u:D,getOptimisticResponse:E?au:void 0})),extend(...u){if("string"==typeof u[0]){const[F,e]=u;if(F in this){const u=D({},this);return i(u,F,e),u}return D({},this,{[F]:this.get.extend(e)})}if("function"==typeof u[0]){return D({},this,u[0](this))}const F=u[0],e=D({},this);for(const u in F)i(e,u,F[u]);return e}}}function ou(u,F,e){return D({},F,cu(e))}function au(u,D){return D}function cu(u){return u instanceof FormData?Object.fromEntries(u.entries()):u}u.All=i,u.Collection=g,u.Endpoint=V,u.Entity=N,u.EntityMixin=P,u.ExtendableEndpoint=J,u.Invalidate=a,u.Lazy=K,u.NetworkError=X,u.Query=z,u.RestEndpoint=nu,u.Union=A,u.Values=n,u.createResource=Bu,u.getUrlBase=Du,u.getUrlTokens=eu,u.hookifyResource=function(u,D){const F={};return Object.keys(u).forEach((e=>{const t=u[e];var C;void 0!==t.extend&&(F[`use${C=e,C.charAt(0).toUpperCase()+C.slice(1)}`]=()=>{const u=D();return t.extend({requestInit:u})})})),F},u.resource=Bu,u.schema=R,u.unshift=h,u.validateRequired=function(u,D){let F="";if(Object.keys(D).some((D=>!Object.hasOwn(u,D)&&(F=D,!0))))return`Missing key ${F}`}}));
@@ -9,5 +9,20 @@ export default class NetworkError extends Error {
9
9
  this.status = response.status;
10
10
  this.response = response;
11
11
  }
12
+
13
+ /** Serialize the error for logging and debugging.
14
+ *
15
+ * Error properties are non-enumerable by default, so `JSON.stringify()`
16
+ * on a plain Error produces `{}`. This ensures status, message, and the
17
+ * request URL are always included in serialized output.
18
+ */
19
+ toJSON() {
20
+ return {
21
+ name: this.name,
22
+ status: this.status,
23
+ message: this.message,
24
+ url: this.response.url
25
+ };
26
+ }
12
27
  }
13
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJOZXR3b3JrRXJyb3IiLCJFcnJvciIsImNvbnN0cnVjdG9yIiwicmVzcG9uc2UiLCJ1cmwiLCJzdGF0dXNUZXh0Iiwic3RhdHVzIiwibmFtZSJdLCJzb3VyY2VzIjpbIi4uL3NyYy9OZXR3b3JrRXJyb3IudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqIEFuIGVycm9yIHdpdGggYSBSZXN0IEVuZHBvaW50IGZldGNoXG4gKlxuICogQHNlZSBodHRwczovL2RhdGFjbGllbnQuaW8vcmVzdC9hcGkvTmV0d29ya0Vycm9yXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIE5ldHdvcmtFcnJvciBleHRlbmRz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