msw 0.24.0 → 0.24.4
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/lib/esm/errors-deps.js +6 -1
- package/lib/esm/fetch-deps.js +25 -9
- package/lib/esm/graphql.js +33 -1
- package/lib/esm/index.js +17 -11
- package/lib/esm/rest-deps.js +61 -0
- package/lib/esm/xml-deps.js +14 -10
- package/lib/iife/index.js +21 -0
- package/lib/iife/mockServiceWorker.js +241 -0
- package/lib/types/context/body.d.ts +4 -2
- package/lib/types/context/cookie.d.ts +2 -3
- package/lib/types/context/data.d.ts +5 -3
- package/lib/types/context/delay.d.ts +4 -3
- package/lib/types/context/errors.d.ts +2 -0
- package/lib/types/context/fetch.d.ts +4 -3
- package/lib/types/context/json.d.ts +6 -3
- package/lib/types/context/set.d.ts +4 -0
- package/lib/types/context/status.d.ts +7 -0
- package/lib/types/context/text.d.ts +4 -3
- package/lib/types/context/xml.d.ts +4 -2
- package/lib/types/graphql.d.ts +67 -11
- package/lib/types/index.d.ts +1 -1
- package/lib/types/node/glossary.d.ts +11 -5
- package/lib/types/node/setupServer.d.ts +5 -0
- package/lib/types/rest.d.ts +87 -157
- package/lib/types/setupWorker/glossary.d.ts +19 -2
- package/lib/types/setupWorker/setupWorker.d.ts +6 -0
- package/lib/umd/index.js +156 -32
- package/native/index.js +30 -24
- package/node/index.js +35 -24
- package/package.json +21 -20
package/lib/esm/errors-deps.js
CHANGED
|
@@ -28,7 +28,10 @@ function mergeRight(left, right) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Sets a given payload as a GraphQL response body.
|
|
32
|
+
* @example
|
|
33
|
+
* res(ctx.data({ user: { firstName: 'John' }}))
|
|
34
|
+
* @see {@link https://mswjs.io/docs/api/context/data `ctx.data()`}
|
|
32
35
|
*/
|
|
33
36
|
const data = (payload) => {
|
|
34
37
|
return (res) => {
|
|
@@ -40,6 +43,8 @@ const data = (payload) => {
|
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
45
|
* Sets a given list of GraphQL errors on the mocked response.
|
|
46
|
+
* @example res(ctx.errors([{ message: 'Unauthorized' }]))
|
|
47
|
+
* @see {@link https://mswjs.io/docs/api/context/errors}
|
|
43
48
|
*/
|
|
44
49
|
const errors = (errorsList) => {
|
|
45
50
|
return (res) => {
|
package/lib/esm/fetch-deps.js
CHANGED
|
@@ -64,6 +64,13 @@ var statuses = {
|
|
|
64
64
|
"511": "Network Authentication Required"
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Sets a response status code and text.
|
|
69
|
+
* @example
|
|
70
|
+
* res(ctx.status(301))
|
|
71
|
+
* res(ctx.status(400, 'Custom status text'))
|
|
72
|
+
* @see {@link https://mswjs.io/docs/api/context/status `ctx.status()`}
|
|
73
|
+
*/
|
|
67
74
|
const status = (statusCode, statusText) => {
|
|
68
75
|
return (res) => {
|
|
69
76
|
res.status = statusCode;
|
|
@@ -327,6 +334,10 @@ exports.flattenHeadersList = flattenHeadersList_1.flattenHeadersList;
|
|
|
327
334
|
exports.flattenHeadersObject = flattenHeadersObject_1.flattenHeadersObject;
|
|
328
335
|
});
|
|
329
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Sets one or multiple response headers.
|
|
339
|
+
* @see {@link https://mswjs.io/docs/api/context/set `ctx.set()`}
|
|
340
|
+
*/
|
|
330
341
|
function set(...args) {
|
|
331
342
|
return (res) => {
|
|
332
343
|
const [name, value] = args;
|
|
@@ -358,10 +369,13 @@ function jsonParse(str) {
|
|
|
358
369
|
|
|
359
370
|
/**
|
|
360
371
|
* Sets the given value as the JSON body of the response.
|
|
372
|
+
* Appends a `Content-Type: application/json` header on the
|
|
373
|
+
* mocked response.
|
|
361
374
|
* @example
|
|
362
|
-
* res(json(
|
|
363
|
-
* res(json('
|
|
364
|
-
* res(json([1, '2', false, { ok: true }]))
|
|
375
|
+
* res(ctx.json('Some string'))
|
|
376
|
+
* res(ctx.json({ key: 'value' }))
|
|
377
|
+
* res(ctx.json([1, '2', false, { ok: true }]))
|
|
378
|
+
* @see {@link https://mswjs.io/docs/api/context/json `ctx.json()`}
|
|
365
379
|
*/
|
|
366
380
|
const json = (body) => {
|
|
367
381
|
return (res) => {
|
|
@@ -398,10 +412,11 @@ const getRandomServerResponseTime = () => {
|
|
|
398
412
|
MIN_SERVER_RESPONSE_TIME);
|
|
399
413
|
};
|
|
400
414
|
/**
|
|
401
|
-
* Delays the
|
|
415
|
+
* Delays the response by the given duration (ms).
|
|
402
416
|
* @example
|
|
403
|
-
* res(delay()) // realistic server response time
|
|
404
|
-
* res(delay(
|
|
417
|
+
* res(ctx.delay()) // realistic server response time
|
|
418
|
+
* res(ctx.delay(1200))
|
|
419
|
+
* @see {@link https://mswjs.io/docs/api/context/delay `ctx.delay()`}
|
|
405
420
|
*/
|
|
406
421
|
const delay = (durationMs) => {
|
|
407
422
|
return (res) => {
|
|
@@ -427,9 +442,10 @@ const createFetchRequestParameters = (input) => {
|
|
|
427
442
|
return requestParameters;
|
|
428
443
|
};
|
|
429
444
|
/**
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
445
|
+
* Performs a bypassed request inside a request handler.
|
|
446
|
+
* @example
|
|
447
|
+
* const originalResponse = await ctx.fetch(req)
|
|
448
|
+
* @see {@link https://mswjs.io/docs/api/context/fetch `ctx.fetch()`}
|
|
433
449
|
*/
|
|
434
450
|
const fetch = (input, requestInit = {}) => {
|
|
435
451
|
// Keep the default `window.fetch()` call signature
|
package/lib/esm/graphql.js
CHANGED
|
@@ -3171,7 +3171,7 @@ function graphQLRequestHandler(expectedOperationType, expectedOperationName, mas
|
|
|
3171
3171
|
if (!((_a = req.body) === null || _a === void 0 ? void 0 : _a.query)) {
|
|
3172
3172
|
return null;
|
|
3173
3173
|
}
|
|
3174
|
-
const { query, variables } = req.body;
|
|
3174
|
+
const { query, variables, } = req.body;
|
|
3175
3175
|
const { operationType, operationName } = parseQuery(query, expectedOperationType);
|
|
3176
3176
|
return {
|
|
3177
3177
|
operationType,
|
|
@@ -3239,10 +3239,42 @@ const createGraphQLOperationHandler = (mask) => {
|
|
|
3239
3239
|
};
|
|
3240
3240
|
};
|
|
3241
3241
|
const graphqlStandardHandlers = {
|
|
3242
|
+
/**
|
|
3243
|
+
* Captures any GraphQL operation, regardless of its name, under the current scope.
|
|
3244
|
+
* @example
|
|
3245
|
+
* graphql.operation((req, res, ctx) => {
|
|
3246
|
+
* return res(ctx.data({ name: 'John' }))
|
|
3247
|
+
* })
|
|
3248
|
+
* @see {@link https://mswjs.io/docs/api/graphql/operation `graphql.operation()`}
|
|
3249
|
+
*/
|
|
3242
3250
|
operation: createGraphQLOperationHandler('*'),
|
|
3251
|
+
/**
|
|
3252
|
+
* Captures a GraphQL query by a given name.
|
|
3253
|
+
* @example
|
|
3254
|
+
* graphql.query('GetUser', (req, res, ctx) => {
|
|
3255
|
+
* return res(ctx.data({ user: { name: 'John' } }))
|
|
3256
|
+
* })
|
|
3257
|
+
* @see {@link https://mswjs.io/docs/api/graphql/query `graphql.query()`}
|
|
3258
|
+
*/
|
|
3243
3259
|
query: createGraphQLScopedHandler('query', '*'),
|
|
3260
|
+
/**
|
|
3261
|
+
* Captures a GraphQL mutation by a given name.
|
|
3262
|
+
* @example
|
|
3263
|
+
* graphql.mutation('SavePost', (req, res, ctx) => {
|
|
3264
|
+
* return res(ctx.data({ post: { id: 'abc-123' } }))
|
|
3265
|
+
* })
|
|
3266
|
+
* @see {@link https://mswjs.io/docs/api/graphql/mutation `graphql.mutation()`}
|
|
3267
|
+
*/
|
|
3244
3268
|
mutation: createGraphQLScopedHandler('mutation', '*'),
|
|
3245
3269
|
};
|
|
3270
|
+
/**
|
|
3271
|
+
* Creates a GraphQL mocking API scoped to the given endpoint.
|
|
3272
|
+
* @param uri Endpoint URL, or path.
|
|
3273
|
+
* @example
|
|
3274
|
+
* const api = graphql.link('https://api.site.com/graphql)
|
|
3275
|
+
* api.query('GetUser', resolver)
|
|
3276
|
+
* @see {@link https://mswjs.io/docs/api/graphql/link `graphql.link()`}
|
|
3277
|
+
*/
|
|
3246
3278
|
function createGraphQLLink(uri) {
|
|
3247
3279
|
return {
|
|
3248
3280
|
operation: createGraphQLOperationHandler(uri),
|
package/lib/esm/index.js
CHANGED
|
@@ -9,18 +9,18 @@ export { m as matchRequestUrl } from './getCallFrame-deps.js';
|
|
|
9
9
|
export { graphql, graphqlContext } from './graphql.js';
|
|
10
10
|
|
|
11
11
|
/*! *****************************************************************************
|
|
12
|
-
Copyright (c) Microsoft Corporation.
|
|
13
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
14
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
15
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
Copyright (c) Microsoft Corporation.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
20
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
14
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
15
|
+
purpose with or without fee is hereby granted.
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
18
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
22
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
24
24
|
***************************************************************************** */
|
|
25
25
|
|
|
26
26
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
@@ -142,7 +142,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
142
142
|
return null;
|
|
143
143
|
}
|
|
144
144
|
// Fallback error message for any other registration errors.
|
|
145
|
-
console.error(`[MSW] Failed to register a Service Worker:\n\
|
|
145
|
+
console.error(`[MSW] Failed to register a Service Worker:\n\n${error.message}`);
|
|
146
146
|
return null;
|
|
147
147
|
}
|
|
148
148
|
return instance;
|
|
@@ -618,6 +618,12 @@ function resetHandlers(initialHandlers, ...nextHandlers) {
|
|
|
618
618
|
// Declare the list of event handlers on the module's scope
|
|
619
619
|
// so it persists between Fash refreshes of the application's code.
|
|
620
620
|
let listeners = [];
|
|
621
|
+
/**
|
|
622
|
+
* Creates a new mock Service Worker registration
|
|
623
|
+
* with the given request handlers.
|
|
624
|
+
* @param {RequestHandler[]} requestHandlers List of request handlers
|
|
625
|
+
* @see {@link https://mswjs.io/docs/api/setup-worker `setupWorker`}
|
|
626
|
+
*/
|
|
621
627
|
function setupWorker(...requestHandlers) {
|
|
622
628
|
requestHandlers.forEach((handler) => {
|
|
623
629
|
if (Array.isArray(handler))
|
package/lib/esm/rest-deps.js
CHANGED
|
@@ -1451,12 +1451,73 @@ ${queryParams
|
|
|
1451
1451
|
};
|
|
1452
1452
|
};
|
|
1453
1453
|
const rest = {
|
|
1454
|
+
/**
|
|
1455
|
+
* Captures a HEAD request by a given path.
|
|
1456
|
+
* @example
|
|
1457
|
+
* rest.head('/numbers', (req, res, ctx) => {
|
|
1458
|
+
* return res(ctx.status(302))
|
|
1459
|
+
* })
|
|
1460
|
+
* @see {@link https://mswjs.io/docs/api/rest `rest`}
|
|
1461
|
+
*/
|
|
1454
1462
|
head: createRestHandler(RESTMethods.HEAD),
|
|
1463
|
+
/**
|
|
1464
|
+
* Captures a GET request by a given path.
|
|
1465
|
+
* @example
|
|
1466
|
+
* rest.get('/numbers', (req, res, ctx) => {
|
|
1467
|
+
* return res(ctx.json([1, 2, 3]))
|
|
1468
|
+
* })
|
|
1469
|
+
* @see {@link https://mswjs.io/docs/api/rest `rest`}
|
|
1470
|
+
*/
|
|
1455
1471
|
get: createRestHandler(RESTMethods.GET),
|
|
1472
|
+
/**
|
|
1473
|
+
* Captures a POST request by a given path.
|
|
1474
|
+
* @example
|
|
1475
|
+
* rest.post('/numbers', (req, res, ctx) => {
|
|
1476
|
+
* return res(ctx.text('success'))
|
|
1477
|
+
* })
|
|
1478
|
+
* @see {@link https://mswjs.io/docs/api/rest `rest`}
|
|
1479
|
+
*/
|
|
1456
1480
|
post: createRestHandler(RESTMethods.POST),
|
|
1481
|
+
/**
|
|
1482
|
+
* Captures a PUT request by a given path.
|
|
1483
|
+
* @example
|
|
1484
|
+
* rest.put('/numbers', (req, res, ctx) => {
|
|
1485
|
+
* const { numbers } = req.body
|
|
1486
|
+
* return res(ctx.json(numbers))
|
|
1487
|
+
* })
|
|
1488
|
+
* @see {@link https://mswjs.io/docs/api/rest `rest`}
|
|
1489
|
+
*/
|
|
1457
1490
|
put: createRestHandler(RESTMethods.PUT),
|
|
1491
|
+
/**
|
|
1492
|
+
* Captures a DELETE request by a given path.
|
|
1493
|
+
* @example
|
|
1494
|
+
* rest.delete('/numbers', (req, res, ctx) => {
|
|
1495
|
+
* const index = req.url.searchParams.get('index')
|
|
1496
|
+
* prevNumbers.splice(index, 1)
|
|
1497
|
+
* return res(ctx.json(nextNumbers))
|
|
1498
|
+
* })
|
|
1499
|
+
* @see {@link https://mswjs.io/docs/api/rest `rest`}
|
|
1500
|
+
*/
|
|
1458
1501
|
delete: createRestHandler(RESTMethods.DELETE),
|
|
1502
|
+
/**
|
|
1503
|
+
* Captures a PATCH request by a given path.
|
|
1504
|
+
* @example
|
|
1505
|
+
* rest.patch('/numbers', (req, res, ctx) => {
|
|
1506
|
+
* const { numbers } = req.body
|
|
1507
|
+
* const nextNumbers = prevNumbers.concat(number)
|
|
1508
|
+
* return res(ctx.json(nextNumbers))
|
|
1509
|
+
* })
|
|
1510
|
+
* @see {@link https://mswjs.io/docs/api/rest `rest`}
|
|
1511
|
+
*/
|
|
1459
1512
|
patch: createRestHandler(RESTMethods.PATCH),
|
|
1513
|
+
/**
|
|
1514
|
+
* Captures an OPTIONS request by a given path.
|
|
1515
|
+
* @example
|
|
1516
|
+
* rest.options('/numbers', (req, res, ctx) => {
|
|
1517
|
+
* return res(ctx.set('Allow', 'GET,HEAD,POST'))
|
|
1518
|
+
* })
|
|
1519
|
+
* @see {@link https://mswjs.io/docs/api/rest `rest`}
|
|
1520
|
+
*/
|
|
1460
1521
|
options: createRestHandler(RESTMethods.OPTIONS),
|
|
1461
1522
|
};
|
|
1462
1523
|
|
package/lib/esm/xml-deps.js
CHANGED
|
@@ -200,9 +200,8 @@ function tryDecode(str, decode) {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
* Sets a given cookie on the response.
|
|
204
|
-
* @example
|
|
205
|
-
* res(cookie('name', 'value'))
|
|
203
|
+
* Sets a given cookie on the mocked response.
|
|
204
|
+
* @example res(ctx.cookie('name', 'value'))
|
|
206
205
|
*/
|
|
207
206
|
const cookie = (name, value, options) => {
|
|
208
207
|
return (res) => {
|
|
@@ -216,9 +215,11 @@ const cookie = (name, value, options) => {
|
|
|
216
215
|
};
|
|
217
216
|
|
|
218
217
|
/**
|
|
219
|
-
* Sets
|
|
218
|
+
* Sets a raw response body. Does not append any `Content-Type` headers.
|
|
220
219
|
* @example
|
|
221
|
-
* res(body('
|
|
220
|
+
* res(ctx.body('Successful response'))
|
|
221
|
+
* res(ctx.body(JSON.stringify({ key: 'value' })))
|
|
222
|
+
* @see {@link https://mswjs.io/docs/api/context/body `ctx.body()`}
|
|
222
223
|
*/
|
|
223
224
|
const body = (value) => {
|
|
224
225
|
return (res) => {
|
|
@@ -228,9 +229,10 @@ const body = (value) => {
|
|
|
228
229
|
};
|
|
229
230
|
|
|
230
231
|
/**
|
|
231
|
-
* Sets a
|
|
232
|
-
*
|
|
233
|
-
* res(text('
|
|
232
|
+
* Sets a textual response body. Appends a `Content-Type: text/plain`
|
|
233
|
+
* header on the mocked response.
|
|
234
|
+
* @example res(ctx.text('Successful response'))
|
|
235
|
+
* @see {@link https://mswjs.io/docs/api/context/text `ctx.text()`}
|
|
234
236
|
*/
|
|
235
237
|
const text = (body) => {
|
|
236
238
|
return (res) => {
|
|
@@ -241,9 +243,11 @@ const text = (body) => {
|
|
|
241
243
|
};
|
|
242
244
|
|
|
243
245
|
/**
|
|
244
|
-
* Sets
|
|
246
|
+
* Sets an XML response body. Appends a `Content-Type: text/xml` header
|
|
247
|
+
* on the mocked response.
|
|
245
248
|
* @example
|
|
246
|
-
* res(xml('<key>
|
|
249
|
+
* res(ctx.xml('<node key="value">Content</node>'))
|
|
250
|
+
* @see {@link https://mswjs.io/docs/api/context/xml `ctx.xml()`}
|
|
247
251
|
*/
|
|
248
252
|
const xml = (body) => {
|
|
249
253
|
return (res) => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var MockServiceWorker=function(e){"use strict";var t={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};const n=(e,n)=>r=>(r.status=e,r.statusText=n||t[String(e)],r);var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var o=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=/[^a-z0-9\-#$%&'*+.^_`|~]/i,r=function(){function e(e){var t=this;this.map={},"Headers"===(null==e?void 0:e.constructor.name)?e.forEach((function(e,n){t.append(n,e)}),this):Array.isArray(e)?e.forEach((function(e){var n=e[0],r=e[1];t.append(n,Array.isArray(r)?r.join(", "):r)})):e&&Object.getOwnPropertyNames(e).forEach((function(n){t.append(n,e[n])}))}return e.prototype.set=function(e,t){this.map[this.normalizeName(e)]=this.normalizeValue(t)},e.prototype.append=function(e,t){e=this.normalizeName(e),t=this.normalizeValue(t),this.map[e]=this.has(e)?this.map[e]+", "+t:t},e.prototype.delete=function(e){return delete this.map[this.normalizeName(e)],this},e.prototype.get=function(e){return this.map[this.normalizeName(e)]||null},e.prototype.getAllHeaders=function(){return this.map},e.prototype.has=function(e){return this.map.hasOwnProperty(this.normalizeName(e))},e.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},e.prototype.normalizeName=function(e){if("string"!=typeof e&&(e=String(e)),n.test(e)||""===e.trim())throw new TypeError("Invalid character in header field name");return e.toLowerCase()},e.prototype.normalizeValue=function(e){return"string"!=typeof e&&(e=String(e)),e},e}();t.Headers=r})),s=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.headersToList=function(e){var t=[];return e.forEach((function(e,n){var r=e.includes(",")?e.split(",").map((function(e){return e.trim()})):e;t.push([n,r])})),t}})),a=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=["user-agent"];t.headersToObject=function(e){var t={};return e.forEach((function(e,r){var i=!n.includes(r.toLowerCase())&&e.includes(",");t[r]=i?e.split(",").map((function(e){return e.trim()})):e})),t}})),c=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.stringToHeaders=function(e){return e.trim().split(/[\r\n]+/).reduce((function(e,t){var n=t.split(": "),r=n.shift(),i=n.join(": ");return e.append(r,i),e}),new Headers)}})),u=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.listToHeaders=function(e){var t=new Headers;return e.forEach((function(e){var n=e[0],r=e[1];[].concat(r).forEach((function(e){t.append(n,e)}))})),t}})),l=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reduceHeadersObject=function(e,t,n){return Object.keys(e).reduce((function(n,r){return t(n,r,e[r])}),n)}})),h=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.objectToHeaders=function(e){return l.reduceHeadersObject(e,(function(e,t,n){return[].concat(n).forEach((function(n){e.append(t,n)})),e}),new Headers)}})),p=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.flattenHeadersList=function(e){return e.map((function(e){var t=e[0],n=e[1];return[t,[].concat(n).join("; ")]}))}})),d=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.flattenHeadersObject=function(e){return l.reduceHeadersObject(e,(function(e,t,n){return e[t]=[].concat(n).join("; "),e}),{})}})),f=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Headers=o.Headers,t.headersToList=s.headersToList,t.headersToObject=a.headersToObject,t.stringToHeaders=c.stringToHeaders,t.listToHeaders=u.listToHeaders,t.objectToHeaders=h.objectToHeaders,t.reduceHeadersObject=l.reduceHeadersObject,t.flattenHeadersList=p.flattenHeadersList,t.flattenHeadersObject=d.flattenHeadersObject}));function v(...e){return t=>{const[n,r]=e;if("string"==typeof n)t.headers.append(n,r);else{f.objectToHeaders(n).forEach(((e,n)=>{t.headers.append(n,e)}))}return t}}
|
|
2
|
+
/*!
|
|
3
|
+
* cookie
|
|
4
|
+
* Copyright(c) 2012-2014 Roman Shtylman
|
|
5
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
*/var m=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},r=t||{},i=e.split(g),o=r.decode||E,s=0;s<i.length;s++){var a=i[s],c=a.indexOf("=");if(!(c<0)){var u=a.substr(0,c).trim(),l=a.substr(++c,a.length).trim();'"'==l[0]&&(l=l.slice(1,-1)),null==n[u]&&(n[u]=O(l,o))}}return n},y=function(e,t,n){var r=n||{},i=r.encode||T;if("function"!=typeof i)throw new TypeError("option encode is invalid");if(!N.test(e))throw new TypeError("argument name is invalid");var o=i(t);if(o&&!N.test(o))throw new TypeError("argument val is invalid");var s=e+"="+o;if(null!=r.maxAge){var a=r.maxAge-0;if(isNaN(a)||!isFinite(a))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+Math.floor(a)}if(r.domain){if(!N.test(r.domain))throw new TypeError("option domain is invalid");s+="; Domain="+r.domain}if(r.path){if(!N.test(r.path))throw new TypeError("option path is invalid");s+="; Path="+r.path}if(r.expires){if("function"!=typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");s+="; Expires="+r.expires.toUTCString()}r.httpOnly&&(s+="; HttpOnly");r.secure&&(s+="; Secure");if(r.sameSite){switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},E=decodeURIComponent,T=encodeURIComponent,g=/; */,N=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function O(e,t){try{return t(e)}catch(t){return e}}const I=(e,t,n)=>r=>{const i=y(e,t,n);return r.headers.set("Set-Cookie",i),"undefined"!=typeof document&&(document.cookie=i),r},b=e=>t=>(t.body=e,t);function _(e){try{return JSON.parse(e)}catch(e){return}}function k(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function A(e,t){return Object.entries(t).reduce(((e,[t,n])=>{const r=e[t];return Array.isArray(r)&&Array.isArray(n)?(e[t]=r.concat(n),e):k(r)&&k(n)?(e[t]=A(r,n),e):(e[t]=n,e)}),Object.assign({},e))}const x=e=>t=>(t.headers.set("Content-Type","application/json"),t.body=JSON.stringify(e),t),w=e=>t=>{const n=A(_(t.body)||{},{data:e});return x(n)(t)};function S(){return"object"==typeof global&&("[object process]"===Object.prototype.toString.call(global.process)||"ReactNative"===navigator.product||void 0)}const R=e=>t=>(t.delay=null!=e?e:S()?5:Math.floor(300*Math.random()+100),t),C=e=>t=>{if(null==e)return t;const n=A(_(t.body)||{},{errors:e});return x(n)(t)},D=S()?require("node-fetch"):window.fetch,L=e=>{const t=new f.Headers(e.headers);return t.set("x-msw-bypass","true"),Object.assign(Object.assign({},e),{headers:t.getAllHeaders()})},M=(e,t={})=>{if("string"==typeof e)return D(e,L(t));const n=(e=>{const{body:t,method:n}=e,r=Object.assign(Object.assign({},e),{body:void 0});return["GET","HEAD"].includes(n)||(r.body="object"==typeof t?JSON.stringify(t):t),r})(e),r=L(n);return D(e.url.href,r)},P=e=>t=>(t.headers.set("Content-Type","text/plain"),t.body=e,t),F=e=>t=>(t.headers.set("Content-Type","text/xml"),t.body=e,t);var j=Object.freeze({__proto__:null,status:n,set:v,cookie:I,body:b,data:w,delay:R,errors:C,fetch:M,json:x,text:P,xml:F});
|
|
8
|
+
/*! *****************************************************************************
|
|
9
|
+
Copyright (c) Microsoft Corporation.
|
|
10
|
+
|
|
11
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
+
purpose with or without fee is hereby granted.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
+
***************************************************************************** */function U(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}var q=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.until=async e=>{try{return[null,await e().catch((e=>{throw e}))]}catch(e){return[e,null]}}})),B=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.until=q.until}));const H=(e,t,n)=>[e.active,e.installing,e.waiting].filter(Boolean).find((e=>n(e.scriptURL,t)))||null;const V=(e,t={},n)=>U(void 0,void 0,void 0,(function*(){const r=new URL(e,location.origin).href;const[,i]=yield B.until((()=>U(void 0,void 0,void 0,(function*(){return(yield navigator.serviceWorker.getRegistrations()).filter((e=>H(e,r,n)))}))));!navigator.serviceWorker.controller&&i.length>0&&location.reload();const[o]=i;if(o)return o.update().then((()=>[H(o,r,n),o]));const[s,a]=yield B.until((()=>U(void 0,void 0,void 0,(function*(){const i=yield navigator.serviceWorker.register(e,t);return[H(i,r,n),i]}))));if(s){if(s.message.includes("(404)")){const e=new URL((null==t?void 0:t.scope)||"/",location.href);return console.error(`[MSW] Failed to register a Service Worker for scope ('${e.href}') with script ('${r}'): Service Worker script does not exist at the given path.\n\nDid you forget to run "npx msw init <PUBLIC_DIR>"?\n\nLearn more about creating the Service Worker script: https://mswjs.io/docs/cli/init`),null}return console.error(`[MSW] Failed to register a Service Worker:\n\n${s.message}`),null}return a})),K={status:n,set:v,delay:R,fetch:M};function W(...e){return(...t)=>e.reduceRight(((e,t)=>e instanceof Promise?Promise.resolve(e).then(t):t(e)),t[0])}class $ extends Error{constructor(e){super(e),this.name="NetworkError"}}const G={status:200,statusText:"OK",body:null,delay:0,once:!1},Y=[];function J(e,t=Y){return(...n)=>U(this,void 0,void 0,(function*(){const r=Object.assign({},G,{headers:new f.Headers({"x-powered-by":"msw"})},e),i=[...t,...n].filter(Boolean);return i.length>0?W(...i)(r):r}))}const z=Object.assign(J(),{once:J({once:!0}),networkError(e){throw new $(e)}}),X=(e,t)=>U(void 0,void 0,void 0,(function*(){const n=t.filter((e=>!e.shouldSkip)).map((t=>{const n=t.parse?t.parse(e):null;return[t,n]})).filter((([t,n])=>t.predicate(e,n)));if(0==n.length)return{handler:null,response:null};const{requestHandler:r,parsedRequest:i,mockedResponse:o,publicRequest:s}=yield n.reduce(((t,[n,r])=>U(void 0,void 0,void 0,(function*(){const i=yield t;if(i.requestHandler)return i;const{getPublicRequest:o,defineContext:s,resolver:a}=n,c=o?o(e,r):e,u=s?s(c):K,l=yield a(c,z,u);return l?(l&&l.once&&(n.shouldSkip=!0),{requestHandler:n,parsedRequest:r,mockedResponse:l,publicRequest:c}):i}))),Promise.resolve({mockedResponse:null}));return r?{handler:r,response:o,publicRequest:s,parsedRequest:i}:{handler:null,response:null}}));var Q=i((function(e,t){!function(n){var i=t&&!t.nodeType&&t,o=e&&!e.nodeType&&e,s="object"==typeof r&&r;s.global!==s&&s.window!==s&&s.self!==s||(n=s);var a,c,u=2147483647,l=36,h=/^xn--/,p=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=Math.floor,m=String.fromCharCode;function y(e){throw RangeError(f[e])}function E(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function T(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+E((e=e.replace(d,".")).split("."),t).join(".")}function g(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function N(e){return E(e,(function(e){var t="";return e>65535&&(t+=m((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=m(e)})).join("")}function O(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,n){var r=0;for(e=n?v(e/700):e>>1,e+=v(e/t);e>455;r+=l)e=v(e/35);return v(r+36*e/(e+38))}function b(e){var t,n,r,i,o,s,a,c,h,p,d,f=[],m=e.length,E=0,T=128,g=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&y("not-basic"),f.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<m;){for(o=E,s=1,a=l;i>=m&&y("invalid-input"),((c=(d=e.charCodeAt(i++))-48<10?d-22:d-65<26?d-65:d-97<26?d-97:l)>=l||c>v((u-E)/s))&&y("overflow"),E+=c*s,!(c<(h=a<=g?1:a>=g+26?26:a-g));a+=l)s>v(u/(p=l-h))&&y("overflow"),s*=p;g=I(E-o,t=f.length+1,0==o),v(E/t)>u-T&&y("overflow"),T+=v(E/t),E%=t,f.splice(E++,0,T)}return N(f)}function _(e){var t,n,r,i,o,s,a,c,h,p,d,f,E,T,N,b=[];for(f=(e=g(e)).length,t=128,n=0,o=72,s=0;s<f;++s)(d=e[s])<128&&b.push(m(d));for(r=i=b.length,i&&b.push("-");r<f;){for(a=u,s=0;s<f;++s)(d=e[s])>=t&&d<a&&(a=d);for(a-t>v((u-n)/(E=r+1))&&y("overflow"),n+=(a-t)*E,t=a,s=0;s<f;++s)if((d=e[s])<t&&++n>u&&y("overflow"),d==t){for(c=n,h=l;!(c<(p=h<=o?1:h>=o+26?26:h-o));h+=l)N=c-p,T=l-p,b.push(m(O(p+N%T,0))),c=v(N/T);b.push(m(O(c,0))),o=I(n,E,r==i),n=0,++r}++n,++t}return b.join("")}if(a={version:"1.3.2",ucs2:{decode:g,encode:N},decode:b,encode:_,toASCII:function(e){return T(e,(function(e){return p.test(e)?"xn--"+_(e):e}))},toUnicode:function(e){return T(e,(function(e){return h.test(e)?b(e.slice(4).toLowerCase()):e}))}},i&&o)if(e.exports==i)o.exports=a;else for(c in a)a.hasOwnProperty(c)&&(i[c]=a[c]);else n.punycode=a}(r)})),Z=function(e){return"string"==typeof e},ee=function(e){return"object"==typeof e&&null!==e},te=function(e){return null===e},ne=function(e){return null==e};function re(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var ie=function(e,t,n,r){t=t||"&",n=n||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var s=1e3;r&&"number"==typeof r.maxKeys&&(s=r.maxKeys);var a=e.length;s>0&&a>s&&(a=s);for(var c=0;c<a;++c){var u,l,h,p,d=e[c].replace(o,"%20"),f=d.indexOf(n);f>=0?(u=d.substr(0,f),l=d.substr(f+1)):(u=d,l=""),h=decodeURIComponent(u),p=decodeURIComponent(l),re(i,h)?Array.isArray(i[h])?i[h].push(p):i[h]=[i[h],p]:i[h]=p}return i},oe=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},se=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(r){var i=encodeURIComponent(oe(r))+n;return Array.isArray(e[r])?e[r].map((function(e){return i+encodeURIComponent(oe(e))})).join(t):i+encodeURIComponent(oe(e[r]))})).join(t):r?encodeURIComponent(oe(r))+n+encodeURIComponent(oe(e)):""},ae=i((function(e,t){t.decode=t.parse=ie,t.encode=t.stringify=se})),ce=function(e){Z(e)&&(e=Oe(e));return e instanceof ue?e.format():ue.prototype.format.call(e)};function ue(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var le=/^([a-z0-9.+-]+:)/i,he=/:[0-9]*$/,pe=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,de=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),fe=["'"].concat(de),ve=["%","/","?",";","#"].concat(fe),me=["/","?","#"],ye=/^[+a-z0-9A-Z_-]{0,63}$/,Ee=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Te={javascript:!0,"javascript:":!0},ge={javascript:!0,"javascript:":!0},Ne={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Oe(e,t,n){if(e&&ee(e)&&e instanceof ue)return e;var r=new ue;return r.parse(e,t,n),r}ue.prototype.parse=function(e,t,n){if(!Z(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),i=-1!==r&&r<e.indexOf("#")?"?":"#",o=e.split(i);o[0]=o[0].replace(/\\/g,"/");var s=e=o.join(i);if(s=s.trim(),!n&&1===e.split("#").length){var a=pe.exec(s);if(a)return this.path=s,this.href=s,this.pathname=a[1],a[2]?(this.search=a[2],this.query=t?ae.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var c=le.exec(s);if(c){var u=(c=c[0]).toLowerCase();this.protocol=u,s=s.substr(c.length)}if(n||c||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var l="//"===s.substr(0,2);!l||c&&ge[c]||(s=s.substr(2),this.slashes=!0)}if(!ge[c]&&(l||c&&!Ne[c])){for(var h,p,d=-1,f=0;f<me.length;f++){-1!==(v=s.indexOf(me[f]))&&(-1===d||v<d)&&(d=v)}-1!==(p=-1===d?s.lastIndexOf("@"):s.lastIndexOf("@",d))&&(h=s.slice(0,p),s=s.slice(p+1),this.auth=decodeURIComponent(h)),d=-1;for(f=0;f<ve.length;f++){var v;-1!==(v=s.indexOf(ve[f]))&&(-1===d||v<d)&&(d=v)}-1===d&&(d=s.length),this.host=s.slice(0,d),s=s.slice(d),this.parseHost(),this.hostname=this.hostname||"";var m="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!m)for(var y=this.hostname.split(/\./),E=(f=0,y.length);f<E;f++){var T=y[f];if(T&&!T.match(ye)){for(var g="",N=0,O=T.length;N<O;N++)T.charCodeAt(N)>127?g+="x":g+=T[N];if(!g.match(ye)){var I=y.slice(0,f),b=y.slice(f+1),_=T.match(Ee);_&&(I.push(_[1]),b.unshift(_[2])),b.length&&(s="/"+b.join(".")+s),this.hostname=I.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),m||(this.hostname=Q.toASCII(this.hostname));var k=this.port?":"+this.port:"",A=this.hostname||"";this.host=A+k,this.href+=this.host,m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!Te[u])for(f=0,E=fe.length;f<E;f++){var x=fe[f];if(-1!==s.indexOf(x)){var w=encodeURIComponent(x);w===x&&(w=escape(x)),s=s.split(x).join(w)}}var S=s.indexOf("#");-1!==S&&(this.hash=s.substr(S),s=s.slice(0,S));var R=s.indexOf("?");if(-1!==R?(this.search=s.substr(R),this.query=s.substr(R+1),t&&(this.query=ae.parse(this.query)),s=s.slice(0,R)):t&&(this.search="",this.query={}),s&&(this.pathname=s),Ne[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){k=this.pathname||"";var C=this.search||"";this.path=k+C}return this.href=this.format(),this},ue.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",i=!1,o="";this.host?i=e+this.host:this.hostname&&(i=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&ee(this.query)&&Object.keys(this.query).length&&(o=ae.stringify(this.query));var s=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||Ne[t])&&!1!==i?(i="//"+(i||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):i||(i=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),t+i+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(s=s.replace("#","%23"))+r},ue.prototype.resolve=function(e){return this.resolveObject(Oe(e,!1,!0)).format()},ue.prototype.resolveObject=function(e){if(Z(e)){var t=new ue;t.parse(e,!1,!0),e=t}for(var n=new ue,r=Object.keys(this),i=0;i<r.length;i++){var o=r[i];n[o]=this[o]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),a=0;a<s.length;a++){var c=s[a];"protocol"!==c&&(n[c]=e[c])}return Ne[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!Ne[e.protocol]){for(var u=Object.keys(e),l=0;l<u.length;l++){var h=u[l];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||ge[e.protocol])n.pathname=e.pathname;else{for(var p=(e.pathname||"").split("/");p.length&&!(e.host=p.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var d=n.pathname||"",f=n.search||"";n.path=d+f}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),m=e.host||e.pathname&&"/"===e.pathname.charAt(0),y=m||v||n.host&&e.pathname,E=y,T=n.pathname&&n.pathname.split("/")||[],g=(p=e.pathname&&e.pathname.split("/")||[],n.protocol&&!Ne[n.protocol]);if(g&&(n.hostname="",n.port=null,n.host&&(""===T[0]?T[0]=n.host:T.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===p[0]?p[0]=e.host:p.unshift(e.host)),e.host=null),y=y&&(""===p[0]||""===T[0])),m)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,T=p;else if(p.length)T||(T=[]),T.pop(),T=T.concat(p),n.search=e.search,n.query=e.query;else if(!ne(e.search)){if(g)n.hostname=n.host=T.shift(),(_=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=_.shift(),n.host=n.hostname=_.shift());return n.search=e.search,n.query=e.query,te(n.pathname)&&te(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!T.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var N=T.slice(-1)[0],O=(n.host||e.host||T.length>1)&&("."===N||".."===N)||""===N,I=0,b=T.length;b>=0;b--)"."===(N=T[b])?T.splice(b,1):".."===N?(T.splice(b,1),I++):I&&(T.splice(b,1),I--);if(!y&&!E)for(;I--;I)T.unshift("..");!y||""===T[0]||T[0]&&"/"===T[0].charAt(0)||T.unshift(""),O&&"/"!==T.join("/").substr(-1)&&T.push("");var _,k=""===T[0]||T[0]&&"/"===T[0].charAt(0);g&&(n.hostname=n.host=k?"":T.length?T.shift():"",(_=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=_.shift(),n.host=n.hostname=_.shift()));return(y=y||n.host&&T.length)&&!k&&T.unshift(""),T.length?n.pathname=T.join("/"):(n.pathname=null,n.path=null),te(n.pathname)&&te(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},ue.prototype.parseHost=function(){var e=this.host,t=he.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};const Ie=e=>e.referrer.startsWith(e.url.origin)?e.url.pathname:ce({protocol:e.url.protocol,host:e.url.host,pathname:e.url.pathname});function be(e,t){var n;if(e){return(null===(n=null==t?void 0:t.get("content-type"))||void 0===n?void 0:n.includes("json"))&&"object"!=typeof e&&_(e)||e}return e}function _e(){return m(document.cookie)}function ke(e,t){return e.toLowerCase()===t.toLowerCase()}const Ae=(e,t)=>n=>U(void 0,void 0,void 0,(function*(){const r=(e=>{const t=e.ports[0];return{send(e){t&&t.postMessage(e)}}})(n);try{const i=JSON.parse(n.data,(function(e,t){return"url"===e?new URL(t):"headers"===e?new f.Headers(t):this.method&&ke(this.method,"GET")&&"body"===e&&""===t?void 0:t})),{type:o,payload:s}=i;if("REQUEST"!==o)return null;s.body=be(s.body,s.headers),s.cookies=function(e){switch(e.credentials){case"same-origin":return location.origin===e.url.origin?_e():{};case"include":return _e();default:return{}}}(s);const{response:a,handler:c,publicRequest:u,parsedRequest:l}=yield X(s,e.requestHandlers);if(!c)return function(e,t="bypass"){if("function"==typeof t)return void t(e);const n=Ie(e),r=`captured a ${e.method} ${e.url} request without a corresponding request handler.\n\n If you wish to intercept this request, consider creating a request handler for it:\n\n rest.${e.method.toLowerCase()}('${n}', (req, res, ctx) => {\n return res(ctx.text('body'))\n })`;switch(t){case"error":throw new Error(`[MSW] Error: ${r}`);case"warn":console.warn(`[MSW] Warning: ${r}`);default:;}}(s,t.onUnhandledRequest),r.send({type:"MOCK_NOT_FOUND"});if(!a)return console.warn("[MSW] Expected a mocking resolver function to return a mocked response Object, but got: %s. Original response is going to be used instead.",a),r.send({type:"MOCK_NOT_FOUND"});const h=Object.assign(Object.assign({},a),{headers:f.headersToList(a.headers)});t.quiet||setTimeout((()=>{c.log(u,h,c,l)}),a.delay),r.send({type:"MOCK_SUCCESS",payload:h})}catch(e){if(e instanceof $)return r.send({type:"NETWORK_ERROR",payload:{name:e.name,message:e.message}});r.send({type:"INTERNAL_ERROR",payload:{status:500,body:JSON.stringify({errorType:e.constructor.name,message:e.message,location:e.stack})}})}}));const xe={serviceWorker:{url:"/mockServiceWorker.js",options:null},quiet:!1,waitUntilReady:!0,onUnhandledRequest:"bypass",findWorker:(e,t)=>e===t},we=e=>function(t){const n=A(xe,t||{}),r=(()=>U(this,void 0,void 0,(function*(){if(!("serviceWorker"in navigator))return console.error("[MSW] Failed to register a Service Worker: this browser does not support Service Workers (see https://caniuse.com/serviceworkers), or your application is running on an insecure host (consider using HTTPS for custom hostnames)."),null;e.events.removeAllListeners(),e.events.addListener(navigator.serviceWorker,"message",Ae(e,n));const[,r]=yield B.until((()=>V(n.serviceWorker.url,n.serviceWorker.options,n.findWorker)));if(!r)return null;const[i,o]=r;if(!i)return(null==t?void 0:t.findWorker)?console.error(`[MSW] Failed to locate the Service Worker registration using a custom "findWorker" predicate.\n\nPlease ensure that the custom predicate properly locates the Service Worker registration at "${n.serviceWorker.url}".\nMore details: https://mswjs.io/docs/api/setup-worker/start#findworker\n`):console.error(`[MSW] Failed to locate the Service Worker registration.\n\nThis most likely means that the worker script URL "${n.serviceWorker.url}" cannot resolve against the actual public hostname (${location.host}). This may happen if your application runs behind a proxy, or has a dynamic hostname.\n\nPlease consider using a custom "serviceWorker.url" option to point to the actual worker script location, or a custom "findWorker" option to resolve the Service Worker registration manually. More details: https://mswjs.io/docs/api/setup-worker/start`),null;e.worker=i,e.registration=o,e.events.addListener(window,"beforeunload",(()=>{"redundant"!==i.state&&i.postMessage("CLIENT_CLOSED"),window.clearInterval(e.keepAliveInterval)}));const[s]=yield B.until((()=>function(e,t){return U(this,void 0,void 0,(function*(){t.postMessage("INTEGRITY_CHECK_REQUEST");const{payload:n}=yield e.events.once("INTEGRITY_CHECK_RESPONSE");if("65d33ca82955e1c5928aed19d1bdf3f9"!==n)throw new Error(`Currently active Service Worker (${n}) is behind the latest published one (65d33ca82955e1c5928aed19d1bdf3f9).`);return t}))}(e,i)));s&&console.error(`[MSW] Detected outdated Service Worker: ${s.message}\n\nThe mocking is still enabled, but it's highly recommended that you update your Service Worker by running:\n\n$ npx msw init <PUBLIC_DIR>\n\nThis is necessary to ensure that the Service Worker is in sync with the library to guarantee its stability.\nIf this message still persists after updating, please report an issue: https://github.com/open-draft/msw/issues `);const[a]=yield B.until((()=>((e,t)=>U(void 0,void 0,void 0,(function*(){var n;return null===(n=e.worker)||void 0===n||n.postMessage("MOCK_ACTIVATE"),e.events.once("MOCKING_ENABLED").then((()=>{(null==t?void 0:t.quiet)||(console.groupCollapsed("%c[MSW] Mocking enabled.","color:orangered;font-weight:bold;"),console.log("%cDocumentation: %chttps://mswjs.io/docs","font-weight:bold","font-weight:normal"),console.log("Found an issue? https://github.com/mswjs/msw/issues"),console.groupEnd())}))})))(e,t)));return a?(console.error("Failed to enable mocking",a),null):(e.keepAliveInterval=window.setInterval((()=>i.postMessage("KEEPALIVE_REQUEST")),5e3),o)})))();return n.waitUntilReady&&function(e){const t=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(...n){B.until((()=>e)).then((()=>{window.XMLHttpRequest.prototype.send=t,this.send(...n)}))};const n=window.fetch;window.fetch=(...t)=>U(this,void 0,void 0,(function*(){return yield B.until((()=>e)),window.fetch=n,window.fetch(...t)}))}(r),r},Se=e=>function(){var t;null===(t=e.worker)||void 0===t||t.postMessage("MOCK_DEACTIVATE"),e.events.removeAllListeners(),window.clearInterval(e.keepAliveInterval)};let Re=[];function Ce(e){return Object.assign(Object.assign({},e),{headers:e.headers.getAllHeaders()})}function De(e){const t=f.listToHeaders(e.headers);return Object.assign(Object.assign({},e),{body:be(e.body,t)})}function Le(){const e=new Date;return[e.getHours(),e.getMinutes(),e.getSeconds()].map(String).map((e=>e.slice(0,2))).map((e=>e.padStart(2,"0"))).join(":")}function Me(e){return e<300?"#69AB32":e<400?"#F0BB4B":"#E95F5D"}const Pe=(e,t)=>{const n=(e instanceof RegExp?e:(e=>{const t=e.replace(/\./g,"\\.").replace(/\//g,"/").replace(/\?/g,"\\?").replace(/\/+$/,"").replace(/\*+/g,".*").replace(/:([^\d|^\/][a-zA-Z0-9_]*(?=(?:\/|\\.)|$))/g,((e,t)=>`(?<${t}>[^/]+?)`)).concat("(\\/|$)");return new RegExp(t,"gi")})(e)).exec(t)||!1,r=e instanceof RegExp?!!n:!!n&&n[0]===n.input;return{matches:r,params:n&&r&&n.groups||null}};var Fe=i((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCleanUrl=void 0,t.getCleanUrl=function(e,t){return void 0===t&&(t=!0),[t&&e.origin,e.pathname].filter(Boolean).join("")}}));const je=e=>{const t="undefined"!=typeof location;return"string"==typeof e&&e.startsWith("/")?`${t?location.origin:""}${e}`:e};function Ue(e){if(e instanceof RegExp||e.includes("*"))return e;try{return new URL(je(e))}catch(t){return e}}function qe(e,t){const n=function(e){return e instanceof URL?Fe.getCleanUrl(e):e instanceof RegExp?e:je(e)}(Ue(t)),r=Fe.getCleanUrl(e);return Pe(n,r)}function Be(){try{const e=new Error;throw e.name="Inspection Error",e}catch(e){const t=e.stack.split("\n").slice(1).find((e=>!/(node_modules)?\/lib\/(umd|esm)\//.test(e)));if(!t)return;const[,n]=t.match(/\((.+?)\)$/)||[];return n}}var He;(He=e.RESTMethods||(e.RESTMethods={})).HEAD="HEAD",He.GET="GET",He.POST="POST",He.PUT="PUT",He.PATCH="PATCH",He.OPTIONS="OPTIONS",He.DELETE="DELETE";const Ve={set:v,status:n,cookie:I,body:b,text:P,json:x,xml:F,delay:R,fetch:M},Ke=e=>(t,n)=>{const r=Ue(t),i=Be();return{parse:e=>({match:qe(e.url,t)}),predicate:(t,n)=>ke(e,t.method)&&n.match.matches,getPublicRequest(e,n){const r=t&&n.match.params||{};return Object.assign(Object.assign({},e),{params:r})},resolver:n,defineContext:()=>Ve,log(n,i,o){if(r instanceof URL&&""!==r.search){const n=[];r.searchParams.forEach(((e,t)=>n.push(t))),console.warn(`[MSW] Found a redundant usage of query parameters in the request handler URL for "${e} ${t}". Please match against a path instead, and access query parameters in the response resolver function:\n\nrest.${e.toLowerCase()}("${r.pathname}", (req, res, ctx) => {\n const query = req.url.searchParams\n${n.map((e=>` const ${e} = query.get("${e}")`)).join("\n")}\n})`)}const s=Ie(n),a=Ce(n),c=De(i);console.groupCollapsed("[MSW] %s %s %s (%c%s%c)",Le(),n.method,s,`color:${Me(i.status)}`,i.status,"color:inherit"),console.log("Request",a),console.log("Handler:",{mask:t,resolver:o.resolver}),console.log("Response",c),console.groupEnd()},getMetaInfo:()=>({type:"rest",header:`[rest] ${e} ${t.toString()}`,mask:t,callFrame:i})}},We={head:Ke(e.RESTMethods.HEAD),get:Ke(e.RESTMethods.GET),post:Ke(e.RESTMethods.POST),put:Ke(e.RESTMethods.PUT),delete:Ke(e.RESTMethods.DELETE),patch:Ke(e.RESTMethods.PATCH),options:Ke(e.RESTMethods.OPTIONS)};function $e(e){return($e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Ge="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";function Ye(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index<t;)i+=1,o=t+1-(n.index+n[0].length);return{line:i,column:o}}function Je(e){return ze(e.source,Ye(e.source,e.start))}function ze(e,t){var n=e.locationOffset.column-1,r=Qe(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?n:0,c=t.column+a,u="".concat(e.name,":").concat(s,":").concat(c,"\n"),l=r.split(/\r\n|[\n\r]/g),h=l[i];if(h.length>120){for(var p=Math.floor(c/80),d=c%80,f=[],v=0;v<h.length;v+=80)f.push(h.slice(v,v+80));return u+Xe([["".concat(s),f[0]]].concat(f.slice(1,p+1).map((function(e){return["",e]})),[[" ",Qe(d-1)+"^"],["",f[p+1]]]))}return u+Xe([["".concat(s-1),l[i-1]],["".concat(s),h],["",Qe(c-1)+"^"],["".concat(s+1),l[i+1]]])}function Xe(e){var t=e.filter((function(e){e[0];return void 0!==e[1]})),n=Math.max.apply(Math,t.map((function(e){return e[0].length})));return t.map((function(e){var t,r=e[0],i=e[1];return Qe(n-(t=r).length)+t+(i?" | "+i:" |")})).join("\n")}function Qe(e){return Array(e+1).join(" ")}function Ze(e){return(Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function et(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tt(e,t){return!t||"object"!==Ze(t)&&"function"!=typeof t?nt(e):t}function nt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rt(e){var t="function"==typeof Map?new Map:void 0;return(rt=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return it(e,arguments,at(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),st(r,e)})(e)}function it(e,t,n){return(it=ot()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&st(i,n.prototype),i}).apply(null,arguments)}function ot(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function st(e,t){return(st=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function at(e){return(at=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ct=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&st(e,t)}(a,e);var t,n,r,i,o,s=(t=a,n=ot(),function(){var e,r=at(t);if(n){var i=at(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return tt(this,e)});function a(e,t,n,r,i,o,c){var u,l,h,p,d;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),d=s.call(this,e);var f,v=Array.isArray(t)?0!==t.length?t:void 0:t?[t]:void 0,m=n;!m&&v&&(m=null===(f=v[0].loc)||void 0===f?void 0:f.source);var y,E=r;!E&&v&&(E=v.reduce((function(e,t){return t.loc&&e.push(t.loc.start),e}),[])),E&&0===E.length&&(E=void 0),r&&n?y=r.map((function(e){return Ye(n,e)})):v&&(y=v.reduce((function(e,t){return t.loc&&e.push(Ye(t.loc.source,t.loc.start)),e}),[]));var T,g=c;if(null==g&&null!=o){var N=o.extensions;"object"==$e(T=N)&&null!==T&&(g=N)}return Object.defineProperties(nt(d),{name:{value:"GraphQLError"},message:{value:e,enumerable:!0,writable:!0},locations:{value:null!==(u=y)&&void 0!==u?u:void 0,enumerable:null!=y},path:{value:null!=i?i:void 0,enumerable:null!=i},nodes:{value:null!=v?v:void 0},source:{value:null!==(l=m)&&void 0!==l?l:void 0},positions:{value:null!==(h=E)&&void 0!==h?h:void 0},originalError:{value:o},extensions:{value:null!==(p=g)&&void 0!==p?p:void 0,enumerable:null!=g}}),(null==o?void 0:o.stack)?(Object.defineProperty(nt(d),"stack",{value:o.stack,writable:!0,configurable:!0}),tt(d)):(Error.captureStackTrace?Error.captureStackTrace(nt(d),a):Object.defineProperty(nt(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return r=a,(i=[{key:"toString",value:function(){return function(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var i=r[n];i.loc&&(t+="\n\n"+Je(i.loc))}else if(e.source&&e.locations)for(var o=0,s=e.locations;o<s.length;o++){var a=s[o];t+="\n\n"+ze(e.source,a)}return t}(this)}},{key:Ge,get:function(){return"Object"}}])&&et(r.prototype,i),o&&et(r,o),a}(rt(Error));function ut(e,t,n){return new ct("Syntax Error: ".concat(n),void 0,e,[t])}var lt=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});var ht="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function pt(e){var t=e.prototype.toJSON;"function"==typeof t||function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}(0),e.prototype.inspect=t,ht&&(e.prototype[ht]=t)}var dt=function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();pt(dt);var ft=function(){function e(e,t,n,r,i,o,s){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=s,this.prev=o,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();pt(ft);var vt=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function mt(e){return(mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yt(e){return Et(e,[])}function Et(e,t){switch(mt(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(ht)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:Et(i,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],o=0;o<n;++o)i.push(Et(e[o],t));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+Et(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}function Tt(e,t){if(!Boolean(e))throw new Error(t)}function gt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Nt=function(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||Tt(0,"Body must be a string. Received: ".concat(yt(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Tt(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Tt(0,"column in locationOffset is 1-indexed and must be positive.")}var t,n,r;return t=e,(n=[{key:Ge,get:function(){return"Source"}}])&>(t.prototype,n),r&>(t,r),e}();var Ot=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function It(e){var t=e.split(/\r\n|[\n\r]/g),n=function(e){for(var t,n=!0,r=!0,i=0,o=null,s=0;s<e.length;++s)switch(e.charCodeAt(s)){case 13:10===e.charCodeAt(s+1)&&++s;case 10:n=!1,r=!0,i=0;break;case 9:case 32:++i;break;default:r&&!n&&(null===o||i<o)&&(o=i),r=!1}return null!==(t=o)&&void 0!==t?t:0}(e);if(0!==n)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var i=0;i<t.length&&bt(t[i]);)++i;for(var o=t.length;o>i&&bt(t[o-1]);)--o;return t.slice(i,o).join("\n")}function bt(e){for(var t=0;t<e.length;++t)if(" "!==e[t]&&"\t"!==e[t])return!1;return!0}var _t=function(){function e(e){var t=new ft(vt.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==vt.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=At(this,e)}while(e.kind===vt.COMMENT);return e},e}();function kt(e){return isNaN(e)?vt.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function At(e,t){for(var n=e.source,r=n.body,i=r.length,o=t.end;o<i;){var s=r.charCodeAt(o),a=e.line,c=1+o-e.lineStart;switch(s){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++e.line,e.lineStart=o;continue;case 13:10===r.charCodeAt(o+1)?o+=2:++o,++e.line,e.lineStart=o;continue;case 33:return new ft(vt.BANG,o,o+1,a,c,t);case 35:return wt(n,o,a,c,t);case 36:return new ft(vt.DOLLAR,o,o+1,a,c,t);case 38:return new ft(vt.AMP,o,o+1,a,c,t);case 40:return new ft(vt.PAREN_L,o,o+1,a,c,t);case 41:return new ft(vt.PAREN_R,o,o+1,a,c,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new ft(vt.SPREAD,o,o+3,a,c,t);break;case 58:return new ft(vt.COLON,o,o+1,a,c,t);case 61:return new ft(vt.EQUALS,o,o+1,a,c,t);case 64:return new ft(vt.AT,o,o+1,a,c,t);case 91:return new ft(vt.BRACKET_L,o,o+1,a,c,t);case 93:return new ft(vt.BRACKET_R,o,o+1,a,c,t);case 123:return new ft(vt.BRACE_L,o,o+1,a,c,t);case 124:return new ft(vt.PIPE,o,o+1,a,c,t);case 125:return new ft(vt.BRACE_R,o,o+1,a,c,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?Dt(n,o,a,c,t,e):Ct(n,o,a,c,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return St(n,o,s,a,c,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return Mt(n,o,a,c,t)}throw ut(n,o,xt(s))}var u=e.line,l=1+o-e.lineStart;return new ft(vt.EOF,i,i,u,l,t)}function xt(e){return e<32&&9!==e&&10!==e&&13!==e?"Cannot contain the invalid character ".concat(kt(e),"."):39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":"Cannot parse the unexpected character ".concat(kt(e),".")}function wt(e,t,n,r,i){var o,s=e.body,a=t;do{o=s.charCodeAt(++a)}while(!isNaN(o)&&(o>31||9===o));return new ft(vt.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function St(e,t,n,r,i,o){var s=e.body,a=n,c=t,u=!1;if(45===a&&(a=s.charCodeAt(++c)),48===a){if((a=s.charCodeAt(++c))>=48&&a<=57)throw ut(e,c,"Invalid number, unexpected digit after 0: ".concat(kt(a),"."))}else c=Rt(e,c,a),a=s.charCodeAt(c);if(46===a&&(u=!0,a=s.charCodeAt(++c),c=Rt(e,c,a),a=s.charCodeAt(c)),69!==a&&101!==a||(u=!0,43!==(a=s.charCodeAt(++c))&&45!==a||(a=s.charCodeAt(++c)),c=Rt(e,c,a),a=s.charCodeAt(c)),46===a||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(a))throw ut(e,c,"Invalid number, expected digit but got: ".concat(kt(a),"."));return new ft(u?vt.FLOAT:vt.INT,t,c,r,i,o,s.slice(t,c))}function Rt(e,t,n){var r=e.body,i=t,o=n;if(o>=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw ut(e,i,"Invalid number, expected digit but got: ".concat(kt(o),"."))}function Ct(e,t,n,r,i){for(var o,s,a,c,u=e.body,l=t+1,h=l,p=0,d="";l<u.length&&!isNaN(p=u.charCodeAt(l))&&10!==p&&13!==p;){if(34===p)return d+=u.slice(h,l),new ft(vt.STRING,t,l+1,n,r,i,d);if(p<32&&9!==p)throw ut(e,l,"Invalid character within String: ".concat(kt(p),"."));if(++l,92===p){switch(d+=u.slice(h,l-1),p=u.charCodeAt(l)){case 34:d+='"';break;case 47:d+="/";break;case 92:d+="\\";break;case 98:d+="\b";break;case 102:d+="\f";break;case 110:d+="\n";break;case 114:d+="\r";break;case 116:d+="\t";break;case 117:var f=(o=u.charCodeAt(l+1),s=u.charCodeAt(l+2),a=u.charCodeAt(l+3),c=u.charCodeAt(l+4),Lt(o)<<12|Lt(s)<<8|Lt(a)<<4|Lt(c));if(f<0){var v=u.slice(l+1,l+5);throw ut(e,l,"Invalid character escape sequence: \\u".concat(v,"."))}d+=String.fromCharCode(f),l+=4;break;default:throw ut(e,l,"Invalid character escape sequence: \\".concat(String.fromCharCode(p),"."))}h=++l}}throw ut(e,l,"Unterminated string.")}function Dt(e,t,n,r,i,o){for(var s=e.body,a=t+3,c=a,u=0,l="";a<s.length&&!isNaN(u=s.charCodeAt(a));){if(34===u&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2))return l+=s.slice(c,a),new ft(vt.BLOCK_STRING,t,a+3,n,r,i,It(l));if(u<32&&9!==u&&10!==u&&13!==u)throw ut(e,a,"Invalid character within String: ".concat(kt(u),"."));10===u?(++a,++o.line,o.lineStart=a):13===u?(10===s.charCodeAt(a+1)?a+=2:++a,++o.line,o.lineStart=a):92===u&&34===s.charCodeAt(a+1)&&34===s.charCodeAt(a+2)&&34===s.charCodeAt(a+3)?(l+=s.slice(c,a)+'"""',c=a+=4):++a}throw ut(e,a,"Unterminated string.")}function Lt(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Mt(e,t,n,r,i){for(var o=e.body,s=o.length,a=t+1,c=0;a!==s&&!isNaN(c=o.charCodeAt(a))&&(95===c||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++a;return new ft(vt.NAME,t,a,n,r,i,o.slice(t,a))}var Pt=function(){function e(e,t){var n=function(e){return e instanceof Nt}(e)?e:new Nt(e);this._lexer=new _t(n),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(vt.NAME);return{kind:lt.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:lt.DOCUMENT,definitions:this.many(vt.SOF,this.parseDefinition,vt.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(vt.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(vt.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(vt.BRACE_L))return{kind:lt.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,n=this.parseOperationType();return this.peek(vt.NAME)&&(t=this.parseName()),{kind:lt.OPERATION_DEFINITION,operation:n,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(vt.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(vt.PAREN_L,this.parseVariableDefinition,vt.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:lt.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(vt.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(vt.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(vt.DOLLAR),{kind:lt.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:lt.SELECTION_SET,selections:this.many(vt.BRACE_L,this.parseSelection,vt.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(vt.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,n=this._lexer.token,r=this.parseName();return this.expectOptionalToken(vt.COLON)?(e=r,t=this.parseName()):t=r,{kind:lt.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(vt.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(vt.PAREN_L,t,vt.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(vt.COLON),{kind:lt.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:lt.ARGUMENT,name:this.parseName(),value:(this.expectToken(vt.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(vt.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(vt.NAME)?{kind:lt.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:lt.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:lt.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:lt.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case vt.BRACKET_L:return this.parseList(e);case vt.BRACE_L:return this.parseObject(e);case vt.INT:return this._lexer.advance(),{kind:lt.INT,value:t.value,loc:this.loc(t)};case vt.FLOAT:return this._lexer.advance(),{kind:lt.FLOAT,value:t.value,loc:this.loc(t)};case vt.STRING:case vt.BLOCK_STRING:return this.parseStringLiteral();case vt.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:lt.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:lt.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:lt.NULL,loc:this.loc(t)};default:return{kind:lt.ENUM,value:t.value,loc:this.loc(t)}}case vt.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:lt.STRING,value:e.value,block:e.kind===vt.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,n=this._lexer.token;return{kind:lt.LIST,values:this.any(vt.BRACKET_L,(function(){return t.parseValueLiteral(e)}),vt.BRACKET_R),loc:this.loc(n)}},t.parseObject=function(e){var t=this,n=this._lexer.token;return{kind:lt.OBJECT,fields:this.any(vt.BRACE_L,(function(){return t.parseObjectField(e)}),vt.BRACE_R),loc:this.loc(n)}},t.parseObjectField=function(e){var t=this._lexer.token,n=this.parseName();return this.expectToken(vt.COLON),{kind:lt.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(vt.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(vt.AT),{kind:lt.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(vt.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(vt.BRACKET_R),e={kind:lt.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(vt.BANG)?{kind:lt.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:lt.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===vt.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(vt.STRING)||this.peek(vt.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var n=this.parseDirectives(!0),r=this.many(vt.BRACE_L,this.parseOperationTypeDefinition,vt.BRACE_R);return{kind:lt.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(vt.COLON);var n=this.parseNamedType();return{kind:lt.OPERATION_TYPE_DEFINITION,operation:t,type:n,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var n=this.parseName(),r=this.parseDirectives(!0);return{kind:lt.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:lt.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(vt.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(vt.AMP)||this.peek(vt.NAME));return t}return this.delimitedMany(vt.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(vt.BRACE_L)&&this._lexer.lookahead().kind===vt.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(vt.BRACE_L,this.parseFieldDefinition,vt.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(vt.COLON);var i=this.parseTypeReference(),o=this.parseDirectives(!0);return{kind:lt.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(vt.PAREN_L,this.parseInputValueDef,vt.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(vt.COLON);var r,i=this.parseTypeReference();this.expectOptionalToken(vt.EQUALS)&&(r=this.parseValueLiteral(!0));var o=this.parseDirectives(!0);return{kind:lt.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:lt.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseUnionMemberTypes();return{kind:lt.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(vt.EQUALS)?this.delimitedMany(vt.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseEnumValuesDefinition();return{kind:lt.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(vt.BRACE_L,this.parseEnumValueDefinition,vt.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseDirectives(!0);return{kind:lt.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var n=this.parseName(),r=this.parseDirectives(!0),i=this.parseInputFieldsDefinition();return{kind:lt.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(vt.BRACE_L,this.parseInputValueDef,vt.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===vt.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),n=this.optionalMany(vt.BRACE_L,this.parseOperationTypeDefinition,vt.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return{kind:lt.SCHEMA_EXTENSION,directives:t,operationTypes:n,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),n=this.parseDirectives(!0);if(0===n.length)throw this.unexpected();return{kind:lt.SCALAR_TYPE_EXTENSION,name:t,directives:n,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:lt.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseDirectives(!0),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return{kind:lt.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:lt.UNION_TYPE_EXTENSION,name:t,directives:n,types:r,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:lt.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),n=this.parseDirectives(!0),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return{kind:lt.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(vt.AT);var n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var o=this.parseDirectiveLocations();return{kind:lt.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(vt.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==Ot[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new dt(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw ut(this._lexer.source,t.start,"Expected ".concat(jt(e),", found ").concat(Ft(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==vt.NAME||t.value!==e)throw ut(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(Ft(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===vt.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return ut(this._lexer.source,t.start,"Unexpected ".concat(Ft(t),"."))},t.any=function(e,t,n){this.expectToken(e);for(var r=[];!this.expectOptionalToken(n);)r.push(t.call(this));return r},t.optionalMany=function(e,t,n){if(this.expectOptionalToken(e)){var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}return[]},t.many=function(e,t,n){this.expectToken(e);var r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n},e}();function Ft(e){var t=e.value;return jt(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function jt(e){return function(e){return e===vt.BANG||e===vt.DOLLAR||e===vt.AMP||e===vt.PAREN_L||e===vt.PAREN_R||e===vt.SPREAD||e===vt.COLON||e===vt.EQUALS||e===vt.AT||e===vt.BRACKET_L||e===vt.BRACKET_R||e===vt.BRACE_L||e===vt.PIPE||e===vt.BRACE_R}(e)?'"'.concat(e,'"'):e}const Ut={set:v,status:n,delay:R,fetch:M,data:w,errors:C};function qt(e,t="query"){var n;var r;const i=new Pt(e,r).parseDocument().definitions.find((e=>"OperationDefinition"===e.kind&&("all"===t||e.operation===t)));return{operationType:null==i?void 0:i.operation,operationName:null===(n=null==i?void 0:i.name)||void 0===n?void 0:n.value}}function Bt(e,t,n,r){const i=Be();return{resolver:r,parse(t){var n;switch(t.method){case"GET":{const n=t.url.searchParams.get("query"),r=t.url.searchParams.get("variables")||"";if(!n)return null;const i=r?_(r):{},{operationType:o,operationName:s}=qt(n,e);return{operationType:o,operationName:s,variables:i}}case"POST":{if(!(null===(n=t.body)||void 0===n?void 0:n.query))return null;const{query:r,variables:i}=t.body,{operationType:o,operationName:s}=qt(r,e);return{operationType:o,operationName:s,variables:i}}default:return null}},getPublicRequest:(e,t)=>Object.assign(Object.assign({},e),{variables:t.variables||{}}),predicate(e,r){if(!r||!r.operationName)return!1;const i=qe(e.url,n),o=t instanceof RegExp?t.test(r.operationName):t===r.operationName;return i.matches&&o},defineContext:()=>Ut,log(e,n,r,i){const{operationType:o,operationName:s}=i,a=Ce(e),c=De(n);console.groupCollapsed("[MSW] %s %s (%c%s%c)",Le(),s,`color:${Me(n.status)}`,n.status,"color:inherit"),console.log("Request:",a),console.log("Handler:",{operationType:o,operationName:t,predicate:r.predicate}),console.log("Response:",c),console.groupEnd()},getMetaInfo:()=>({type:"graphql",header:"all"===e?`[graphql] ${e} (origin: ${n.toString()})`:`[graphql] ${e} ${t} (origin: ${n.toString()})`,mask:n,callFrame:i})}}const Ht=(e,t)=>(n,r)=>Bt(e,n,t,r),Vt=e=>t=>Bt("all",new RegExp(".*"),e,t),Kt={operation:Vt("*"),query:Ht("query","*"),mutation:Ht("mutation","*")};const Wt=Object.assign(Object.assign({},Kt),{link:function(e){return{operation:Vt(e),query:Ht("query",e),mutation:Ht("mutation",e)}}});return e.compose=W,e.context=j,e.createResponseComposition=J,e.defaultContext=K,e.defaultResponse=G,e.graphql=Wt,e.graphqlContext=Ut,e.matchRequestUrl=qe,e.response=z,e.rest=We,e.restContext=Ve,e.setupWorker=function(...e){e.forEach((e=>{if(Array.isArray(e))throw new Error('[MSW] Failed to call "setupWorker" given an Array of request handlers (setupWorker([a, b])), expected to receive each handler individually: setupWorker(a, b).')}));const t={worker:null,registration:null,requestHandlers:[...e],events:{addListener:(e,t,n)=>(e.addEventListener(t,n),Re.push({event:t,target:e,callback:n}),()=>{e.removeEventListener(t,n)}),removeAllListeners(){for(const{target:e,event:t,callback:n}of Re)e.removeEventListener(t,n);Re=[]},once(e){const n=[];return new Promise(((r,i)=>{n.push(t.events.addListener(navigator.serviceWorker,"message",(t=>{try{const n=JSON.parse(t.data);n.type===e&&r(n)}catch(e){i(e)}})),t.events.addListener(navigator.serviceWorker,"messageerror",i))})).finally((()=>{n.forEach((e=>e()))}))}}};if(S())throw new Error("[MSW] Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for NodeJS environment instead.");return{start:we(t),stop:Se(t),use(...e){!function(e,...t){e.unshift(...t)}(t.requestHandlers,...e)},restoreHandlers(){t.requestHandlers.forEach((e=>{"shouldSkip"in e&&(e.shouldSkip=!1)}))},resetHandlers(...n){t.requestHandlers=function(e,...t){return t.length>0?[...t]:[...e]}(e,...n)},printHandlers(){t.requestHandlers.forEach((e=>{const t=e.getMetaInfo();console.groupCollapsed(t.header),console.log(`Declaration: ${t.callFrame}`),console.log("Resolver: %s",e.resolver),["rest"].includes(t.type)&&console.log("Match:",`https://mswjs.io/repl?path=${t.mask}`),console.groupEnd()}))}}},e}({});
|