microcms-js-sdk 2.5.0 → 2.6.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.
- package/README.md +89 -15
- package/dist/esm/microcms-js-sdk.js +1 -2
- package/dist/esm/microcms-js-sdk.js.map +1 -0
- package/dist/iife/microcms-js-sdk.js +1 -0
- package/dist/iife/microcms-js-sdk.js.map +1 -0
- package/dist/microcms-js-sdk.d.mts +148 -0
- package/dist/microcms-js-sdk.d.ts +148 -0
- package/dist/microcms-js-sdk.js +1 -0
- package/dist/microcms-js-sdk.js.map +1 -0
- package/dist/umd/microcms-js-sdk.js +1 -15
- package/dist/umd/microcms-js-sdk.js.map +1 -0
- package/package.json +20 -24
- package/dist/cjs/createClient.d.ts +0 -13
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/lib/fetch.d.ts +0 -7
- package/dist/cjs/microcms-js-sdk.js +0 -2
- package/dist/cjs/types.d.ts +0 -120
- package/dist/cjs/utils/constants.d.ts +0 -4
- package/dist/cjs/utils/isCheckValue.d.ts +0 -14
- package/dist/cjs/utils/parseQuery.d.ts +0 -2
- package/dist/esm/createClient.d.ts +0 -13
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/lib/fetch.d.ts +0 -7
- package/dist/esm/types.d.ts +0 -120
- package/dist/esm/utils/constants.d.ts +0 -4
- package/dist/esm/utils/isCheckValue.d.ts +0 -14
- package/dist/esm/utils/parseQuery.d.ts +0 -2
- package/dist/umd/createClient.d.ts +0 -13
- package/dist/umd/index.d.ts +0 -2
- package/dist/umd/lib/fetch.d.ts +0 -7
- package/dist/umd/types.d.ts +0 -120
- package/dist/umd/utils/constants.d.ts +0 -4
- package/dist/umd/utils/isCheckValue.d.ts +0 -14
- package/dist/umd/utils/parseQuery.d.ts +0 -2
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
type Fetch = typeof fetch;
|
|
2
|
+
/**
|
|
3
|
+
* microCMS createClient params
|
|
4
|
+
*/
|
|
5
|
+
interface MicroCMSClient {
|
|
6
|
+
serviceDomain: string;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
customFetch?: Fetch;
|
|
9
|
+
retry?: boolean;
|
|
10
|
+
}
|
|
11
|
+
type depthNumber = 0 | 1 | 2 | 3;
|
|
12
|
+
/**
|
|
13
|
+
* microCMS queries
|
|
14
|
+
* https://document.microcms.io/content-api/get-list-contents#h9ce528688c
|
|
15
|
+
* https://document.microcms.io/content-api/get-content#h9ce528688c
|
|
16
|
+
*/
|
|
17
|
+
interface MicroCMSQueries {
|
|
18
|
+
draftKey?: string;
|
|
19
|
+
limit?: number;
|
|
20
|
+
offset?: number;
|
|
21
|
+
orders?: string;
|
|
22
|
+
fields?: string | string[];
|
|
23
|
+
q?: string;
|
|
24
|
+
depth?: depthNumber;
|
|
25
|
+
ids?: string | string[];
|
|
26
|
+
filters?: string;
|
|
27
|
+
richEditorFormat?: 'html' | 'object';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* microCMS contentId
|
|
31
|
+
* https://document.microcms.io/manual/content-id-setting
|
|
32
|
+
*/
|
|
33
|
+
interface MicroCMSContentId {
|
|
34
|
+
id: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* microCMS content common date
|
|
38
|
+
*/
|
|
39
|
+
interface MicroCMSDate {
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
publishedAt?: string;
|
|
43
|
+
revisedAt?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* microCMS image
|
|
47
|
+
*/
|
|
48
|
+
interface MicroCMSImage {
|
|
49
|
+
url: string;
|
|
50
|
+
width?: number;
|
|
51
|
+
height?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* microCMS list api Response
|
|
55
|
+
*/
|
|
56
|
+
interface MicroCMSListResponse<T> {
|
|
57
|
+
contents: (T & MicroCMSListContent)[];
|
|
58
|
+
totalCount: number;
|
|
59
|
+
limit: number;
|
|
60
|
+
offset: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* microCMS list content common types
|
|
64
|
+
*/
|
|
65
|
+
type MicroCMSListContent = MicroCMSContentId & MicroCMSDate;
|
|
66
|
+
/**
|
|
67
|
+
* microCMS object content common types
|
|
68
|
+
*/
|
|
69
|
+
type MicroCMSObjectContent = MicroCMSDate;
|
|
70
|
+
interface MakeRequest {
|
|
71
|
+
endpoint: string;
|
|
72
|
+
contentId?: string;
|
|
73
|
+
queries?: MicroCMSQueries & Record<string, any>;
|
|
74
|
+
requestInit?: RequestInit;
|
|
75
|
+
}
|
|
76
|
+
type CustomRequestInit = Omit<RequestInit, 'method' | 'headers' | 'body'>;
|
|
77
|
+
interface GetRequest {
|
|
78
|
+
endpoint: string;
|
|
79
|
+
contentId?: string;
|
|
80
|
+
queries?: MicroCMSQueries;
|
|
81
|
+
customRequestInit?: CustomRequestInit;
|
|
82
|
+
}
|
|
83
|
+
interface GetListDetailRequest {
|
|
84
|
+
endpoint: string;
|
|
85
|
+
contentId: string;
|
|
86
|
+
queries?: MicroCMSQueries;
|
|
87
|
+
customRequestInit?: CustomRequestInit;
|
|
88
|
+
}
|
|
89
|
+
interface GetListRequest {
|
|
90
|
+
endpoint: string;
|
|
91
|
+
queries?: MicroCMSQueries;
|
|
92
|
+
customRequestInit?: CustomRequestInit;
|
|
93
|
+
}
|
|
94
|
+
interface GetObjectRequest {
|
|
95
|
+
endpoint: string;
|
|
96
|
+
queries?: MicroCMSQueries;
|
|
97
|
+
customRequestInit?: CustomRequestInit;
|
|
98
|
+
}
|
|
99
|
+
interface GetAllContentIdsRequest {
|
|
100
|
+
endpoint: string;
|
|
101
|
+
/**
|
|
102
|
+
* @type {string} alternateField
|
|
103
|
+
* @example 'url'
|
|
104
|
+
* If you are using a URL other than the content ID, for example, you can specify that value in the `alternateField` field.
|
|
105
|
+
*/
|
|
106
|
+
alternateField?: string;
|
|
107
|
+
draftKey?: string;
|
|
108
|
+
filters?: string;
|
|
109
|
+
orders?: string;
|
|
110
|
+
customRequestInit?: CustomRequestInit;
|
|
111
|
+
}
|
|
112
|
+
interface WriteApiRequestResult {
|
|
113
|
+
id: string;
|
|
114
|
+
}
|
|
115
|
+
interface CreateRequest<T> {
|
|
116
|
+
endpoint: string;
|
|
117
|
+
contentId?: string;
|
|
118
|
+
content: T;
|
|
119
|
+
isDraft?: boolean;
|
|
120
|
+
customRequestInit?: CustomRequestInit;
|
|
121
|
+
}
|
|
122
|
+
interface UpdateRequest<T> {
|
|
123
|
+
endpoint: string;
|
|
124
|
+
contentId?: string;
|
|
125
|
+
content: Partial<T>;
|
|
126
|
+
customRequestInit?: CustomRequestInit;
|
|
127
|
+
}
|
|
128
|
+
interface DeleteRequest {
|
|
129
|
+
endpoint: string;
|
|
130
|
+
contentId: string;
|
|
131
|
+
customRequestInit?: CustomRequestInit;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Initialize SDK Client
|
|
136
|
+
*/
|
|
137
|
+
declare const createClient: ({ serviceDomain, apiKey, customFetch, retry: retryOption, }: MicroCMSClient) => {
|
|
138
|
+
get: <T = any>({ endpoint, contentId, queries, customRequestInit, }: GetRequest) => Promise<T>;
|
|
139
|
+
getList: <T_1 = any>({ endpoint, queries, customRequestInit, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
|
|
140
|
+
getListDetail: <T_2 = any>({ endpoint, contentId, queries, customRequestInit, }: GetListDetailRequest) => Promise<T_2 & MicroCMSContentId & MicroCMSDate>;
|
|
141
|
+
getObject: <T_3 = any>({ endpoint, queries, customRequestInit, }: GetObjectRequest) => Promise<T_3 & MicroCMSDate>;
|
|
142
|
+
getAllContentIds: ({ endpoint, alternateField, draftKey, filters, orders, customRequestInit, }: GetAllContentIdsRequest) => Promise<string[]>;
|
|
143
|
+
create: <T_4 extends Record<string | number, any>>({ endpoint, contentId, content, isDraft, customRequestInit, }: CreateRequest<T_4>) => Promise<WriteApiRequestResult>;
|
|
144
|
+
update: <T_5 extends Record<string | number, any>>({ endpoint, contentId, content, customRequestInit, }: UpdateRequest<T_5>) => Promise<WriteApiRequestResult>;
|
|
145
|
+
delete: ({ endpoint, contentId, customRequestInit, }: DeleteRequest) => Promise<void>;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export { CreateRequest, CustomRequestInit, DeleteRequest, Fetch, GetAllContentIdsRequest, GetListDetailRequest, GetListRequest, GetObjectRequest, GetRequest, MakeRequest, MicroCMSClient, MicroCMSContentId, MicroCMSDate, MicroCMSImage, MicroCMSListContent, MicroCMSListResponse, MicroCMSObjectContent, MicroCMSQueries, UpdateRequest, WriteApiRequestResult, createClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(t){if(Array.isArray(t))return e(t)}function r(e,t,r,n,i,o,u){try{var c=e[o](u);var a=c.value}catch(e){r(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(n,i)}}function n(e){return function(){var t=this,n=arguments;return new Promise(function(i,o){var u=e.apply(t,n);function c(e){r(u,i,o,c,a,"next",e)}function a(e){r(u,i,o,c,a,"throw",e)}c(undefined)})}}function i(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){i(e,t,r[t])})}return e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function s(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{a(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function f(e){return t(e)||o(e)||d(e)||u()}function l(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function p(e,t){var r,n,i,o,u={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return(o={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o);function c(e){return function(t){return a([e,t])}}function a(o){if(r)throw new TypeError("Generator is already executing.");while(u)try{if(r=1,n&&(i=o[0]&2?n["return"]:o[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;if(n=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:u.label++;return{value:o[1],done:false};case 5:u.label++;n=o[1];o=[0];continue;case 7:o=u.ops.pop();u.trys.pop();continue;default:if(!(i=u.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){u=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){u.label=o[1];break}if(o[0]===6&&u.label<i[1]){u.label=i[1];i=o;break}if(i&&u.label<i[2]){u.label=i[2];u.ops.push(o);break}if(i[2])u.ops.pop();u.trys.pop();continue}o=t.call(e,u)}catch(e){o=[6,e];n=0}finally{r=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var y=Object.create;var v=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var g=function(e,t){for(var r in t)v(e,r,{get:t[r],enumerable:!0})},q=function(e,t,r,n){var i=true,o=false,u=undefined;if(t&&typeof t=="object"||typeof t=="function")try{var c=function(){var i=s.value;!w.call(e,i)&&i!==r&&v(e,i,{get:function(){return t[i]},enumerable:!(n=h(t,i))||n.enumerable})};for(var a=b(t)[Symbol.iterator](),s;!(i=(s=a.next()).done);i=true)c()}catch(e){o=true;u=e}finally{try{if(!i&&a.return!=null){a.return()}}finally{if(o){throw u}}}return e};var j=function(e,t,r){return r=e!=null?y(m(e)):{},q(t||!e||!e.__esModule?v(r,"default",{value:e,enumerable:!0}):r,e)},O=function(e){return q(v({},"__esModule",{value:!0}),e)};var I={};g(I,{createClient:function(){return K}});module.exports=O(I);var P=j(require("qs"));var E=function(e){return e!==null&&typeof e=="object"},S=function(e){return typeof e=="string"};var A=function(e){if(!E(e))throw new Error("queries is not object");return P.default.stringify(e,{arrayFormat:"comma"})};var C="microcms.io",D="v1";var T=j(require("cross-fetch")),R=function(e){var t;return e?t=e:(typeof fetch==="undefined"?"undefined":l(fetch))>"u"?t=T.default:t=fetch,function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++){r[n]=arguments[n]}return t.apply(void 0,f(r))}},k=function(){return(typeof Headers==="undefined"?"undefined":l(Headers))>"u"?T.Headers:Headers},x=function(e,t){var r=R(t),i=k();return function(){var t=n(function(t,n){var o,u;return p(this,function(a){u=new i((o=n)===null||o===void 0?void 0:o.headers);return[2,(u.has("X-MICROCMS-API-KEY")||u.set("X-MICROCMS-API-KEY",e),r(t,s(c({},n),{headers:u})))]})});return function(e,r){return t.apply(this,arguments)}}()};var M=j(require("async-retry")),K=function(e){var t=e.serviceDomain,r=e.apiKey,i=e.customFetch,o=e.retry;if(!t||!r)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!S(t)||!S(r))throw new Error("parameter is not string");var u="https://".concat(t,".").concat(C,"/api/").concat(D),a=function(){var e=n(function(e){var t,a,f,l,d,y,v,h,b;return p(this,function(m){switch(m.label){case 0:t=e.endpoint,a=e.contentId,f=e.queries,l=f===void 0?{}:f,d=e.requestInit;y=x(r,i),v=A(l),h="".concat(u,"/").concat(t).concat(a?"/".concat(a):"").concat(v?"?".concat(v):""),b=function(){var e=n(function(e){var t,r,n;return p(this,function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,e.json()];case 1:t=i.sent(),r=t.message;return[2,r!==null&&r!==void 0?r:null];case 2:n=i.sent();return[2,null];case 3:return[2]}})});return function t(t){return e.apply(this,arguments)}}();return[4,(0,M.default)(function(){var e=n(function(e){var t,r,n,i,o,u,a,f;return p(this,function(l){switch(l.label){case 0:l.trys.push([0,6,,7]);return[4,y(h,s(c({},d),{method:(n=(t=d)===null||t===void 0?void 0:t.method)!==null&&n!==void 0?n:"GET"}))];case 1:i=l.sent();if(!(i.status!==429&&i.status>=400&&i.status<500))return[3,3];return[4,b(i)];case 2:o=l.sent();return[2,e(new Error("fetch API response status: ".concat(i.status).concat(o?"\n message is `".concat(o,"`"):"")))];case 3:if(!!i.ok)return[3,5];return[4,b(i)];case 4:u=l.sent();return[2,Promise.reject(new Error("fetch API response status: ".concat(i.status).concat(u?"\n message is `".concat(u,"`"):"")))];case 5:return[2,((r=d)===null||r===void 0?void 0:r.method)==="DELETE"?void 0:i.json()];case 6:a=l.sent();if(a.data)throw a.data;if((f=a.response)===null||f===void 0?void 0:f.data)throw a.response.data;return[2,Promise.reject(new Error("Network Error.\n Details: ".concat(a)))];case 7:return[2]}})});return function(t){return e.apply(this,arguments)}}(),{retries:o?2:0,onRetry:function(e,t){console.log(e),console.log("Waiting for retry (".concat(t,"/",2,")"))},minTimeout:5e3})];case 1:return[2,m.sent()]}})});return function t(t){return e.apply(this,arguments)}}();return{get:function(){var e=n(function(e){var t,r,n,i,o,u;return p(this,function(c){switch(c.label){case 0:t=e.endpoint,r=e.contentId,n=e.queries,i=n===void 0?{}:n,o=e.customRequestInit;if(!t)return[3,2];return[4,a({endpoint:t,contentId:r,queries:i,requestInit:o})];case 1:u=c.sent();return[3,3];case 2:u=Promise.reject(new Error("endpoint is required"));c.label=3;case 3:return[2,u]}})});return function(t){return e.apply(this,arguments)}}(),getList:function(){var e=n(function(e){var t,r,n,i,o;return p(this,function(u){switch(u.label){case 0:t=e.endpoint,r=e.queries,n=r===void 0?{}:r,i=e.customRequestInit;if(!t)return[3,2];return[4,a({endpoint:t,queries:n,requestInit:i})];case 1:o=u.sent();return[3,3];case 2:o=Promise.reject(new Error("endpoint is required"));u.label=3;case 3:return[2,o]}})});return function(t){return e.apply(this,arguments)}}(),getListDetail:function(){var e=n(function(e){var t,r,n,i,o,u;return p(this,function(c){switch(c.label){case 0:t=e.endpoint,r=e.contentId,n=e.queries,i=n===void 0?{}:n,o=e.customRequestInit;if(!t)return[3,2];return[4,a({endpoint:t,contentId:r,queries:i,requestInit:o})];case 1:u=c.sent();return[3,3];case 2:u=Promise.reject(new Error("endpoint is required"));c.label=3;case 3:return[2,u]}})});return function(t){return e.apply(this,arguments)}}(),getObject:function(){var e=n(function(e){var t,r,n,i,o;return p(this,function(u){switch(u.label){case 0:t=e.endpoint,r=e.queries,n=r===void 0?{}:r,i=e.customRequestInit;if(!t)return[3,2];return[4,a({endpoint:t,queries:n,requestInit:i})];case 1:o=u.sent();return[3,3];case 2:o=Promise.reject(new Error("endpoint is required"));u.label=3;case 3:return[2,o]}})});return function(t){return e.apply(this,arguments)}}(),getAllContentIds:function(){var e=n(function(e){var t,r,n,i,o,u,l,d,y,v,h,b,m,w,g,q,j;return p(this,function(p){switch(p.label){case 0:t=e.endpoint,r=e.alternateField,n=e.draftKey,i=e.filters,o=e.orders,u=e.customRequestInit;l={draftKey:n,filters:i,orders:o,limit:100,fields:r!==null&&r!==void 0?r:"id",depth:0};return[4,a({endpoint:t,queries:s(c({},l),{limit:0}),requestInit:u})];case 1:d=p.sent(),y=d.totalCount,v=[],h=0,b=function(e){return new Promise(function(t){return setTimeout(t,e)})},m=function(e){return e.every(function(e){return typeof e=="string"})};p.label=2;case 2:if(!(v.length<y))return[3,7];return[4,a({endpoint:t,queries:s(c({},l),{offset:h}),requestInit:u})];case 3:w=p.sent(),g=w.contents,q=g.map(function(e){return e[r!==null&&r!==void 0?r:"id"]});if(!m(q))throw new Error("The value of the field specified by `alternateField` is not a string.");v=f(v).concat(f(q)),h+=100;j=v.length<y;if(!j)return[3,5];return[4,b(1e3)];case 4:j=p.sent();p.label=5;case 5:j;p.label=6;case 6:return[3,2];case 7:return[2,v]}})});return function(t){return e.apply(this,arguments)}}(),create:function(){var e=n(function(e){var t,r,n,i,o,u,f,l;return p(this,function(d){t=e.endpoint,r=e.contentId,n=e.content,i=e.isDraft,o=i===void 0?!1:i,u=e.customRequestInit;if(!t)return[2,Promise.reject(new Error("endpoint is required"))];f=o?{status:"draft"}:{},l=s(c({},u),{method:r?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,a({endpoint:t,contentId:r,queries:f,requestInit:l})]})});return function(t){return e.apply(this,arguments)}}(),update:function(){var e=n(function(e){var t,r,n,i,o;return p(this,function(u){t=e.endpoint,r=e.contentId,n=e.content,i=e.customRequestInit;if(!t)return[2,Promise.reject(new Error("endpoint is required"))];o=s(c({},i),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,a({endpoint:t,contentId:r,requestInit:o})]})});return function(t){return e.apply(this,arguments)}}(),delete:function(){var e=n(function(e){var t,r,n,i;return p(this,function(o){switch(o.label){case 0:t=e.endpoint,r=e.contentId,n=e.customRequestInit;if(!t)return[2,Promise.reject(new Error("endpoint is required"))];if(!r)return[2,Promise.reject(new Error("contentId is required"))];i=s(c({},n),{method:"DELETE",headers:{},body:void 0});return[4,a({endpoint:t,contentId:r,requestInit:i})];case 1:o.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}()}};0&&(module.exports={createClient:createClient});//# sourceMappingURL=microcms-js-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils/parseQuery.ts","../src/utils/isCheckValue.ts","../src/utils/constants.ts","../src/lib/fetch.ts","../src/createClient.ts"],"names":["src_exports","__export","createClient","__toCommonJS","import_qs","isObject","value","isString","parseQuery","queries","qs","BASE_DOMAIN","API_VERSION","import_cross_fetch","resolveFetch","customFetch","_fetch","crossFetch","args","resolveHeadersConstructor","CrossFetchHeaders","generateFetchClient","apiKey","fetch","HeadersConstructor","req","init","headers","import_async_retry","serviceDomain","retryOption","baseUrl","makeRequest","endpoint","contentId","requestInit","fetchClient","queryString","url","getMessageFromResponse","response","message","retry","bail","error","err","num","customRequestInit","alternateField","draftKey","filters","orders","defaultQueries","totalCount","contentIds","offset","sleep","ms","resolve","isStringArray","arr","item","contents","ids","content","isDraft"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GCMA,IAAAI,EAAe,iBCAR,IAAMC,EAAYC,GAChBA,IAAU,MAAQ,OAAOA,GAAU,SAS/BC,EAAYD,GAChB,OAAOA,GAAU,SDPnB,IAAME,EAAcC,GAAqC,CAC9D,GAAI,CAACJ,EAASI,CAAO,EACnB,MAAM,IAAI,MAAM,uBAAuB,EAIzC,OAFoB,EAAAC,QAAG,UAAUD,EAAS,CAAE,YAAa,OAAQ,CAAC,CAGpE,EEjBO,IAAME,EAAc,cACdC,EAAc,KCD3B,IAAAC,EAAyD,0BAG5CC,EAAgBC,GAA+B,CAC1D,IAAIC,EACJ,OAAID,EACFC,EAASD,EACA,OAAO,MAAU,IAC1BC,EAAU,EAAAC,QAEVD,EAAS,MAEJ,IAAIE,IAASF,EAAO,GAAGE,CAAI,CACpC,EAEaC,EAA4B,IACnC,OAAO,QAAY,IACd,EAAAC,QAGF,QAGIC,EAAsB,CACjCC,EACAP,IACU,CACV,IAAMQ,EAAQT,EAAaC,CAAW,EAChCS,EAAqBL,EAA0B,EAErD,MAAO,OAAOM,EAAKC,IAAS,CAC1B,IAAMC,EAAU,IAAIH,EAAmBE,GAAM,OAAO,EAEpD,OAAKC,EAAQ,IAAI,oBAAoB,GACnCA,EAAQ,IAAI,qBAAsBL,CAAM,EAGnCC,EAAME,EAAK,CAAE,GAAGC,EAAM,QAAAC,CAAQ,CAAC,CACxC,CACF,ECTA,IAAAC,EAAkB,0BAKL1B,EAAe,CAAC,CAC3B,cAAA2B,EACA,OAAAP,EACA,YAAAP,EACA,MAAOe,CACT,IAAsB,CACpB,GAAI,CAACD,GAAiB,CAACP,EACrB,MAAM,IAAI,MAAM,wDAAwD,EAG1E,GAAI,CAACf,EAASsB,CAAa,GAAK,CAACtB,EAASe,CAAM,EAC9C,MAAM,IAAI,MAAM,yBAAyB,EAM3C,IAAMS,EAAU,WAAWF,CAAa,IAAIlB,CAAW,QAAQC,CAAW,GAKpEoB,EAAc,MAAO,CACzB,SAAAC,EACA,UAAAC,EACA,QAAAzB,EAAU,CAAC,EACX,YAAA0B,CACF,IAAmB,CACjB,IAAMC,EAAcf,EAAoBC,EAAQP,CAAW,EACrDsB,EAAc7B,EAAWC,CAAO,EAChC6B,EAAM,GAAGP,CAAO,IAAIE,CAAQ,GAAGC,EAAY,IAAIA,CAAS,GAAK,EAAE,GACnEG,EAAc,IAAIA,CAAW,GAAK,EACpC,GAEME,EAAyB,MAAOC,GAAuB,CAG3D,GAAI,CACF,GAAM,CAAE,QAAAC,CAAQ,EAAI,MAAMD,EAAS,KAAK,EACxC,OAAOC,GAAW,IACpB,MAAY,CACV,OAAO,IACT,CACF,EAEA,OAAO,QAAM,EAAAC,SACX,MAAOC,GAAS,CACd,GAAI,CACF,IAAMH,EAAW,MAAMJ,EAAYE,EAAK,CACtC,GAAGH,EACH,OAAQA,GAAa,QAAU,KACjC,CAAC,EAGD,GACEK,EAAS,SAAW,KACpBA,EAAS,QAAU,KACnBA,EAAS,OAAS,IAClB,CACA,IAAMC,EAAU,MAAMF,EAAuBC,CAAQ,EAErD,OAAOG,EACL,IAAI,MACF,8BAA8BH,EAAS,MAAM,GAC3CC,EAAU;AAAA,iBAAoBA,CAAO,KAAO,EAC9C,EACF,CACF,CACF,CAGA,GAAI,CAACD,EAAS,GAAI,CAChB,IAAMC,EAAU,MAAMF,EAAuBC,CAAQ,EAErD,OAAO,QAAQ,OACb,IAAI,MACF,8BAA8BA,EAAS,MAAM,GAC3CC,EAAU;AAAA,iBAAoBA,CAAO,KAAO,EAC9C,EACF,CACF,CACF,CAEA,OAAIN,GAAa,SAAW,SAAU,OAE/BK,EAAS,KAAK,CACvB,OAASI,EAAO,CACd,GAAIA,EAAM,KACR,MAAMA,EAAM,KAGd,GAAIA,EAAM,UAAU,KAClB,MAAMA,EAAM,SAAS,KAGvB,OAAO,QAAQ,OACb,IAAI,MAAM;AAAA,aAA8BA,CAAK,EAAE,CACjD,CACF,CACF,EACA,CACE,QAASd,EAAc,EAAkB,EACzC,QAAS,CAACe,EAAKC,IAAQ,CACrB,QAAQ,IAAID,CAAG,EACf,QAAQ,IAAI,sBAAsBC,CAAG,IAAI,CAAe,GAAG,CAC7D,EACA,WAAY,GACd,CACF,CACF,EA+NA,MAAO,CACL,IA3NU,MAAgB,CAC1B,SAAAb,EACA,UAAAC,EACA,QAAAzB,EAAU,CAAC,EACX,kBAAAsC,CACF,IACOd,EAGE,MAAMD,EAAY,CACvB,SAAAC,EACA,UAAAC,EACA,QAAAzB,EACA,YAAasC,CACf,CAAC,EAPQ,QAAQ,OAAO,IAAI,MAAM,sBAAsB,CAAC,EAqNzD,QAxMc,MAAgB,CAC9B,SAAAd,EACA,QAAAxB,EAAU,CAAC,EACX,kBAAAsC,CACF,IACOd,EAGE,MAAMD,EAAY,CACvB,SAAAC,EACA,QAAAxB,EACA,YAAasC,CACf,CAAC,EANQ,QAAQ,OAAO,IAAI,MAAM,sBAAsB,CAAC,EAmMzD,cAvLoB,MAAgB,CACpC,SAAAd,EACA,UAAAC,EACA,QAAAzB,EAAU,CAAC,EACX,kBAAAsC,CACF,IACOd,EAGE,MAAMD,EAAY,CACvB,SAAAC,EACA,UAAAC,EACA,QAAAzB,EACA,YAAasC,CACf,CAAC,EAPQ,QAAQ,OAAO,IAAI,MAAM,sBAAsB,CAAC,EAiLzD,UApKgB,MAAgB,CAChC,SAAAd,EACA,QAAAxB,EAAU,CAAC,EACX,kBAAAsC,CACF,IACOd,EAGE,MAAMD,EAAY,CACvB,SAAAC,EACA,QAAAxB,EACA,YAAasC,CACf,CAAC,EANQ,QAAQ,OAAO,IAAI,MAAM,sBAAsB,CAAC,EA+JzD,iBAtJuB,MAAO,CAC9B,SAAAd,EACA,eAAAe,EACA,SAAAC,EACA,QAAAC,EACA,OAAAC,EACA,kBAAAJ,CACF,IAAkD,CAEhD,IAAMK,EAAkC,CACtC,SAAAH,EACA,QAAAC,EACA,OAAAC,EACA,UACA,OAAQH,GAAkB,KAC1B,MAAO,CACT,EAEM,CAAE,WAAAK,CAAW,EAAI,MAAMrB,EAAY,CACvC,SAAAC,EACA,QAAS,CAAE,GAAGmB,EAAgB,MAAO,CAAE,EACvC,YAAaL,CACf,CAAC,EAEGO,EAAuB,CAAC,EACxBC,EAAS,EAEPC,EAASC,GACb,IAAI,QAASC,GAAY,WAAWA,EAASD,CAAE,CAAC,EAC5CE,EAAiBC,GACrBA,EAAI,MAAOC,GAAS,OAAOA,GAAS,QAAQ,EAE9C,KAAOP,EAAW,OAASD,GAAY,CACrC,GAAM,CAAE,SAAAS,CAAS,EAAK,MAAM9B,EAAY,CACtC,SAAAC,EACA,QAAS,CAAE,GAAGmB,EAAgB,OAAAG,CAAO,EACrC,YAAaR,CACf,CAAC,EAEKgB,EAAMD,EAAS,IAAKE,GAAYA,EAAQhB,GAAkB,IAAI,CAAC,EAErE,GAAI,CAACW,EAAcI,CAAG,EACpB,MAAM,IAAI,MACR,uEACF,EAGFT,EAAa,CAAC,GAAGA,EAAY,GAAGS,CAAG,EAEnCR,GAAU,IACND,EAAW,OAASD,GACtB,MAAMG,EAAM,GAAI,CAEpB,CAEA,OAAOF,CACT,EA+FE,OA1Fa,MAA+C,CAC5D,SAAArB,EACA,UAAAC,EACA,QAAA8B,EACA,QAAAC,EAAU,GACV,kBAAAlB,CACF,IAAwD,CACtD,GAAI,CAACd,EACH,OAAO,QAAQ,OAAO,IAAI,MAAM,sBAAsB,CAAC,EAGzD,IAAMxB,EAAkCwD,EAAU,CAAE,OAAQ,OAAQ,EAAI,CAAC,EACnE9B,EAA0C,CAC9C,GAAGY,EACH,OAAQb,EAAY,MAAQ,OAC5B,QAAS,CACP,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAU8B,CAAO,CAC9B,EAEA,OAAOhC,EAAY,CACjB,SAAAC,EACA,UAAAC,EACA,QAAAzB,EACA,YAAA0B,CACF,CAAC,CACH,EAgEE,OA3Da,MAA+C,CAC5D,SAAAF,EACA,UAAAC,EACA,QAAA8B,EACA,kBAAAjB,CACF,IAAwD,CACtD,GAAI,CAACd,EACH,OAAO,QAAQ,OAAO,IAAI,MAAM,sBAAsB,CAAC,EAGzD,IAAME,EAA0C,CAC9C,GAAGY,EACH,OAAQ,QACR,QAAS,CACP,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAUiB,CAAO,CAC9B,EAEA,OAAOhC,EAAY,CACjB,SAAAC,EACA,UAAAC,EACA,YAAAC,CACF,CAAC,CACH,EAoCE,OA/Bc,MAAO,CACrB,SAAAF,EACA,UAAAC,EACA,kBAAAa,CACF,IAAoC,CAClC,GAAI,CAACd,EACH,OAAO,QAAQ,OAAO,IAAI,MAAM,sBAAsB,CAAC,EAGzD,GAAI,CAACC,EACH,OAAO,QAAQ,OAAO,IAAI,MAAM,uBAAuB,CAAC,EAG1D,IAAMC,EAA0C,CAC9C,GAAGY,EACH,OAAQ,SACR,QAAS,CAAC,EACV,KAAM,MACR,EAEA,MAAMf,EAAY,CAAE,SAAAC,EAAU,UAAAC,EAAW,YAAAC,CAAY,CAAC,CACxD,CAWA,CACF","sourcesContent":["export { createClient } from './createClient';\nexport * from './types';\n","/**\n * Parse query.\n *\n * @param {object} queries\n * @return {string} queryString\n */\nimport qs from 'qs';\nimport { isObject } from './isCheckValue';\nimport { MicroCMSQueries } from '../types';\n\nexport const parseQuery = (queries: MicroCMSQueries): string => {\n if (!isObject(queries)) {\n throw new Error('queries is not object');\n }\n const queryString = qs.stringify(queries, { arrayFormat: 'comma' });\n\n return queryString;\n};\n","/**\n * Check object\n *\n * @param {unknown} value\n * @returns {boolean}\n */\nexport const isObject = (value: unknown): value is Record<string, unknown> => {\n return value !== null && typeof value === 'object';\n};\n\n/**\n * Check string\n *\n * @param {unknown} value\n * @returns {boolean}\n */\nexport const isString = (value: unknown): value is string => {\n return typeof value === 'string';\n};\n","export const BASE_DOMAIN = 'microcms.io';\nexport const API_VERSION = 'v1';\nexport const MAX_RETRY_COUNT = 2;\nexport const MIN_TIMEOUT_MS = 5000;\n","import crossFetch, { Headers as CrossFetchHeaders } from 'cross-fetch';\nimport { Fetch } from 'src/types';\n\nexport const resolveFetch = (customFetch?: Fetch): Fetch => {\n let _fetch: Fetch;\n if (customFetch) {\n _fetch = customFetch;\n } else if (typeof fetch === 'undefined') {\n _fetch = (crossFetch as unknown) as Fetch;\n } else {\n _fetch = fetch;\n }\n return (...args) => _fetch(...args);\n};\n\nexport const resolveHeadersConstructor = () => {\n if (typeof Headers === 'undefined') {\n return CrossFetchHeaders;\n }\n\n return Headers;\n};\n\nexport const generateFetchClient = (\n apiKey: string,\n customFetch?: Fetch\n): Fetch => {\n const fetch = resolveFetch(customFetch);\n const HeadersConstructor = resolveHeadersConstructor();\n\n return async (req, init) => {\n const headers = new HeadersConstructor(init?.headers);\n\n if (!headers.has('X-MICROCMS-API-KEY')) {\n headers.set('X-MICROCMS-API-KEY', apiKey);\n }\n\n return fetch(req, { ...init, headers });\n };\n};\n","/**\n * microCMS API SDK\n * https://github.com/microcmsio/microcms-js-sdk\n */\nimport { parseQuery } from './utils/parseQuery';\nimport { isString } from './utils/isCheckValue';\nimport {\n MicroCMSClient,\n MakeRequest,\n GetRequest,\n GetListRequest,\n GetListDetailRequest,\n GetObjectRequest,\n WriteApiRequestResult,\n CreateRequest,\n MicroCMSListResponse,\n MicroCMSListContent,\n MicroCMSObjectContent,\n UpdateRequest,\n DeleteRequest,\n GetAllContentIdsRequest,\n MicroCMSQueries,\n} from './types';\nimport {\n API_VERSION,\n BASE_DOMAIN,\n MAX_RETRY_COUNT,\n MIN_TIMEOUT_MS,\n} from './utils/constants';\nimport { generateFetchClient } from './lib/fetch';\nimport retry from 'async-retry';\n\n/**\n * Initialize SDK Client\n */\nexport const createClient = ({\n serviceDomain,\n apiKey,\n customFetch,\n retry: retryOption,\n}: MicroCMSClient) => {\n if (!serviceDomain || !apiKey) {\n throw new Error('parameter is required (check serviceDomain and apiKey)');\n }\n\n if (!isString(serviceDomain) || !isString(apiKey)) {\n throw new Error('parameter is not string');\n }\n\n /**\n * Defined microCMS base URL\n */\n const baseUrl = `https://${serviceDomain}.${BASE_DOMAIN}/api/${API_VERSION}`;\n\n /**\n * Make request\n */\n const makeRequest = async ({\n endpoint,\n contentId,\n queries = {},\n requestInit,\n }: MakeRequest) => {\n const fetchClient = generateFetchClient(apiKey, customFetch);\n const queryString = parseQuery(queries);\n const url = `${baseUrl}/${endpoint}${contentId ? `/${contentId}` : ''}${\n queryString ? `?${queryString}` : ''\n }`;\n\n const getMessageFromResponse = async (response: Response) => {\n // Enclose `response.json()` in a try since it may throw an error\n // Only return the `message` if there is a `message`\n try {\n const { message } = await response.json();\n return message ?? null;\n } catch (_) {\n return null;\n }\n };\n\n return await retry(\n async (bail) => {\n try {\n const response = await fetchClient(url, {\n ...requestInit,\n method: requestInit?.method ?? 'GET',\n });\n\n // If a status code in the 400 range other than 429 is returned, do not retry.\n if (\n response.status !== 429 &&\n response.status >= 400 &&\n response.status < 500\n ) {\n const message = await getMessageFromResponse(response);\n\n return bail(\n new Error(\n `fetch API response status: ${response.status}${\n message ? `\\n message is \\`${message}\\`` : ''\n }`,\n ),\n );\n }\n\n // If the response fails with any other status code, retry until the set number of attempts is reached.\n if (!response.ok) {\n const message = await getMessageFromResponse(response);\n\n return Promise.reject(\n new Error(\n `fetch API response status: ${response.status}${\n message ? `\\n message is \\`${message}\\`` : ''\n }`,\n ),\n );\n }\n\n if (requestInit?.method === 'DELETE') return;\n\n return response.json();\n } catch (error) {\n if (error.data) {\n throw error.data;\n }\n\n if (error.response?.data) {\n throw error.response.data;\n }\n\n return Promise.reject(\n new Error(`Network Error.\\n Details: ${error}`),\n );\n }\n },\n {\n retries: retryOption ? MAX_RETRY_COUNT : 0,\n onRetry: (err, num) => {\n console.log(err);\n console.log(`Waiting for retry (${num}/${MAX_RETRY_COUNT})`);\n },\n minTimeout: MIN_TIMEOUT_MS,\n },\n );\n };\n\n /**\n * Get list and object API data for microCMS\n */\n const get = async <T = any>({\n endpoint,\n contentId,\n queries = {},\n customRequestInit,\n }: GetRequest): Promise<T> => {\n if (!endpoint) {\n return Promise.reject(new Error('endpoint is required'));\n }\n return await makeRequest({\n endpoint,\n contentId,\n queries,\n requestInit: customRequestInit,\n });\n };\n\n /**\n * Get list API data for microCMS\n */\n const getList = async <T = any>({\n endpoint,\n queries = {},\n customRequestInit,\n }: GetListRequest): Promise<MicroCMSListResponse<T>> => {\n if (!endpoint) {\n return Promise.reject(new Error('endpoint is required'));\n }\n return await makeRequest({\n endpoint,\n queries,\n requestInit: customRequestInit,\n });\n };\n\n /**\n * Get list API detail data for microCMS\n */\n const getListDetail = async <T = any>({\n endpoint,\n contentId,\n queries = {},\n customRequestInit,\n }: GetListDetailRequest): Promise<T & MicroCMSListContent> => {\n if (!endpoint) {\n return Promise.reject(new Error('endpoint is required'));\n }\n return await makeRequest({\n endpoint,\n contentId,\n queries,\n requestInit: customRequestInit,\n });\n };\n\n /**\n * Get object API data for microCMS\n */\n const getObject = async <T = any>({\n endpoint,\n queries = {},\n customRequestInit,\n }: GetObjectRequest): Promise<T & MicroCMSObjectContent> => {\n if (!endpoint) {\n return Promise.reject(new Error('endpoint is required'));\n }\n return await makeRequest({\n endpoint,\n queries,\n requestInit: customRequestInit,\n });\n };\n\n const getAllContentIds = async ({\n endpoint,\n alternateField,\n draftKey,\n filters,\n orders,\n customRequestInit,\n }: GetAllContentIdsRequest): Promise<string[]> => {\n const limit = 100;\n const defaultQueries: MicroCMSQueries = {\n draftKey,\n filters,\n orders,\n limit,\n fields: alternateField ?? 'id',\n depth: 0,\n };\n\n const { totalCount } = await makeRequest({\n endpoint,\n queries: { ...defaultQueries, limit: 0 },\n requestInit: customRequestInit,\n });\n\n let contentIds: string[] = [];\n let offset = 0;\n\n const sleep = (ms: number) =>\n new Promise((resolve) => setTimeout(resolve, ms));\n const isStringArray = (arr: unknown[]): arr is string[] =>\n arr.every((item) => typeof item === 'string');\n\n while (contentIds.length < totalCount) {\n const { contents } = (await makeRequest({\n endpoint,\n queries: { ...defaultQueries, offset },\n requestInit: customRequestInit,\n })) as MicroCMSListResponse<Record<string, unknown>>;\n\n const ids = contents.map((content) => content[alternateField ?? 'id']);\n\n if (!isStringArray(ids)) {\n throw new Error(\n 'The value of the field specified by `alternateField` is not a string.',\n );\n }\n\n contentIds = [...contentIds, ...ids];\n\n offset += limit;\n if (contentIds.length < totalCount) {\n await sleep(1000); // sleep for 1 second before the next request\n }\n }\n\n return contentIds;\n };\n\n /**\n * Create new content in the microCMS list API data\n */\n const create = async <T extends Record<string | number, any>>({\n endpoint,\n contentId,\n content,\n isDraft = false,\n customRequestInit,\n }: CreateRequest<T>): Promise<WriteApiRequestResult> => {\n if (!endpoint) {\n return Promise.reject(new Error('endpoint is required'));\n }\n\n const queries: MakeRequest['queries'] = isDraft ? { status: 'draft' } : {};\n const requestInit: MakeRequest['requestInit'] = {\n ...customRequestInit,\n method: contentId ? 'PUT' : 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(content),\n };\n\n return makeRequest({\n endpoint,\n contentId,\n queries,\n requestInit,\n });\n };\n\n /**\n * Update content in their microCMS list and object API data\n */\n const update = async <T extends Record<string | number, any>>({\n endpoint,\n contentId,\n content,\n customRequestInit,\n }: UpdateRequest<T>): Promise<WriteApiRequestResult> => {\n if (!endpoint) {\n return Promise.reject(new Error('endpoint is required'));\n }\n\n const requestInit: MakeRequest['requestInit'] = {\n ...customRequestInit,\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(content),\n };\n\n return makeRequest({\n endpoint,\n contentId,\n requestInit,\n });\n };\n\n /**\n * Delete content in their microCMS list and object API data\n */\n const _delete = async ({\n endpoint,\n contentId,\n customRequestInit,\n }: DeleteRequest): Promise<void> => {\n if (!endpoint) {\n return Promise.reject(new Error('endpoint is required'));\n }\n\n if (!contentId) {\n return Promise.reject(new Error('contentId is required'));\n }\n\n const requestInit: MakeRequest['requestInit'] = {\n ...customRequestInit,\n method: 'DELETE',\n headers: {},\n body: undefined,\n };\n\n await makeRequest({ endpoint, contentId, requestInit });\n };\n\n return {\n get,\n getList,\n getListDetail,\n getObject,\n getAllContentIds,\n create,\n update,\n delete: _delete,\n };\n};\n"]}
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).microcms={})}(this,(function(t){"use strict";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var e=function(){return e=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},e.apply(this,arguments)};function r(t,e,r,o){return new(r||(r=Promise))((function(n,i){function a(t){try{s(o.next(t))}catch(t){i(t)}}function u(t){try{s(o.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}s((o=o.apply(t,e||[])).next())}))}function o(t,e){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{r=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function a(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return t[r]}})})),e}var u,s="undefined"!=typeof Symbol&&Symbol,c=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0},p=Array.prototype.slice,f=Object.prototype.toString,l=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==f.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r,o=p.call(arguments,1),n=Math.max(0,e.length-o.length),i=[],a=0;a<n;a++)i.push("$"+a);if(r=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var n=e.apply(this,o.concat(p.call(arguments)));return Object(n)===n?n:this}return e.apply(t,o.concat(p.call(arguments)))})),e.prototype){var u=function(){};u.prototype=e.prototype,r.prototype=new u,u.prototype=null}return r},y=Function.prototype.bind||l,d=y.call(Function.call,Object.prototype.hasOwnProperty),h=SyntaxError,m=Function,b=TypeError,v=function(t){try{return m('"use strict"; return ('+t+").constructor;")()}catch(t){}},g=Object.getOwnPropertyDescriptor;if(g)try{g({},"")}catch(t){g=null}var w=function(){throw new b},j=g?function(){try{return w}catch(t){try{return g(arguments,"callee").get}catch(t){return w}}}():w,O="function"==typeof s&&"function"==typeof Symbol&&"symbol"==typeof s("foo")&&"symbol"==typeof Symbol("bar")&&c(),S=Object.getPrototypeOf||function(t){return t.__proto__},A={},P="undefined"==typeof Uint8Array?u:S(Uint8Array),E={"%AggregateError%":"undefined"==typeof AggregateError?u:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?u:ArrayBuffer,"%ArrayIteratorPrototype%":O?S([][Symbol.iterator]()):u,"%AsyncFromSyncIteratorPrototype%":u,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":"undefined"==typeof Atomics?u:Atomics,"%BigInt%":"undefined"==typeof BigInt?u:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?u:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?u:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?u:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?u:FinalizationRegistry,"%Function%":m,"%GeneratorFunction%":A,"%Int8Array%":"undefined"==typeof Int8Array?u:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?u:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?u:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":O?S(S([][Symbol.iterator]())):u,"%JSON%":"object"==typeof JSON?JSON:u,"%Map%":"undefined"==typeof Map?u:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&O?S((new Map)[Symbol.iterator]()):u,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?u:Promise,"%Proxy%":"undefined"==typeof Proxy?u:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?u:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?u:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&O?S((new Set)[Symbol.iterator]()):u,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?u:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":O?S(""[Symbol.iterator]()):u,"%Symbol%":O?Symbol:u,"%SyntaxError%":h,"%ThrowTypeError%":j,"%TypedArray%":P,"%TypeError%":b,"%Uint8Array%":"undefined"==typeof Uint8Array?u:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?u:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?u:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?u:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?u:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?u:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?u:WeakSet},_=function t(e){var r;if("%AsyncFunction%"===e)r=v("async function () {}");else if("%GeneratorFunction%"===e)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=v("async function* () {}");else if("%AsyncGenerator%"===e){var o=t("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&(r=S(n.prototype))}return E[e]=r,r},x={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},T=y,I=d,R=T.call(Function.call,Array.prototype.concat),D=T.call(Function.apply,Array.prototype.splice),F=T.call(Function.call,String.prototype.replace),k=T.call(Function.call,String.prototype.slice),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,U=/\\(\\)?/g,N=function(t,e){var r,o=t;if(I(x,o)&&(o="%"+(r=x[o])[0]+"%"),I(E,o)){var n=E[o];if(n===A&&(n=_(o)),void 0===n&&!e)throw new b("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:o,value:n}}throw new h("intrinsic "+t+" does not exist!")},B=function(t,e){if("string"!=typeof t||0===t.length)throw new b("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new b('"allowMissing" argument must be a boolean');var r=function(t){var e=k(t,0,1),r=k(t,-1);if("%"===e&&"%"!==r)throw new h("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new h("invalid intrinsic syntax, expected opening `%`");var o=[];return F(t,M,(function(t,e,r,n){o[o.length]=r?F(n,U,"$1"):e||t})),o}(t),o=r.length>0?r[0]:"",n=N("%"+o+"%",e),i=n.name,a=n.value,u=!1,s=n.alias;s&&(o=s[0],D(r,R([0,1],s)));for(var c=1,p=!0;c<r.length;c+=1){var f=r[c],l=k(f,0,1),y=k(f,-1);if(('"'===l||"'"===l||"`"===l||'"'===y||"'"===y||"`"===y)&&l!==y)throw new h("property names with quotes must have matching quotes");if("constructor"!==f&&p||(u=!0),I(E,i="%"+(o+="."+f)+"%"))a=E[i];else if(null!=a){if(!(f in a)){if(!e)throw new b("base intrinsic for "+t+" exists, but the property is not available.");return}if(g&&c+1>=r.length){var d=g(a,f);a=(p=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:a[f]}else p=I(a,f),a=a[f];p&&!u&&(E[i]=a)}}return a},q={exports:{}};!function(t){var e=y,r=B,o=r("%Function.prototype.apply%"),n=r("%Function.prototype.call%"),i=r("%Reflect.apply%",!0)||e.call(n,o),a=r("%Object.getOwnPropertyDescriptor%",!0),u=r("%Object.defineProperty%",!0),s=r("%Math.max%");if(u)try{u({},"a",{value:1})}catch(t){u=null}t.exports=function(t){var r=i(e,n,arguments);a&&u&&(a(r,"length").configurable&&u(r,"length",{value:1+s(0,t.length-(arguments.length-1))}));return r};var c=function(){return i(e,o,arguments)};u?u(t.exports,"apply",{value:c}):t.exports.apply=c}(q);var C=B,L=q.exports,W=L(C("String.prototype.indexOf")),H=a(Object.freeze({__proto__:null,default:{}})),G="function"==typeof Map&&Map.prototype,z=Object.getOwnPropertyDescriptor&&G?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,V=G&&z&&"function"==typeof z.get?z.get:null,J=G&&Map.prototype.forEach,Q="function"==typeof Set&&Set.prototype,$=Object.getOwnPropertyDescriptor&&Q?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,K=Q&&$&&"function"==typeof $.get?$.get:null,X=Q&&Set.prototype.forEach,Y="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Z="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,tt="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,et=Boolean.prototype.valueOf,rt=Object.prototype.toString,ot=Function.prototype.toString,nt=String.prototype.match,it="function"==typeof BigInt?BigInt.prototype.valueOf:null,at=Object.getOwnPropertySymbols,ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,st=Object.prototype.propertyIsEnumerable,ct=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),pt=H.custom,ft=pt&&mt(pt)?pt:null,lt="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag?Symbol.toStringTag:null;function yt(t,e,r){var o="double"===(r.quoteStyle||e)?'"':"'";return o+t+o}function dt(t){return String(t).replace(/"/g,""")}function ht(t){return!("[object Array]"!==gt(t)||lt&&"object"==typeof t&< in t)}function mt(t){if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!ut)return!1;try{return ut.call(t),!0}catch(t){}return!1}var bt=Object.prototype.hasOwnProperty||function(t){return t in this};function vt(t,e){return bt.call(t,e)}function gt(t){return rt.call(t)}function wt(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,o=t.length;r<o;r++)if(t[r]===e)return r;return-1}function jt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,o="... "+r+" more character"+(r>1?"s":"");return jt(t.slice(0,e.maxStringLength),e)+o}return yt(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,Ot),"single",e)}function Ot(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+e.toString(16).toUpperCase()}function St(t){return"Object("+t+")"}function At(t){return t+" { ? }"}function Pt(t,e,r,o){return t+" ("+e+") {"+(o?Et(r,o):r.join(", "))+"}"}function Et(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+t.join(","+r)+"\n"+e.prev}function _t(t,e){var r=ht(t),o=[];if(r){o.length=t.length;for(var n=0;n<t.length;n++)o[n]=vt(t,n)?e(t[n],t):""}for(var i in t)vt(t,i)&&(r&&String(Number(i))===i&&i<t.length||(/[^\w$]/.test(i)?o.push(e(i,t)+": "+e(t[i],t)):o.push(i+": "+e(t[i],t))));if("function"==typeof at)for(var a=at(t),u=0;u<a.length;u++)st.call(t,a[u])&&o.push("["+e(a[u])+"]: "+e(t[a[u]],t));return o}var xt=B,Tt=function(t,e){var r=C(t,!!e);return"function"==typeof r&&W(t,".prototype.")>-1?L(r):r},It=function t(e,r,o,n){var i=r||{};if(vt(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(vt(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&i.maxStringLength!==1/0:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!vt(i,"customInspect")||i.customInspect;if("boolean"!=typeof a)throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(vt(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return jt(e,i);if("number"==typeof e)return 0===e?1/0/e>0?"0":"-0":String(e);if("bigint"==typeof e)return String(e)+"n";var u=void 0===i.depth?5:i.depth;if(void 0===o&&(o=0),o>=u&&u>0&&"object"==typeof e)return ht(e)?"[Array]":"[Object]";var s=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=Array(t.indent+1).join(" ")}return{base:r,prev:Array(e+1).join(r)}}(i,o);if(void 0===n)n=[];else if(wt(n,e)>=0)return"[Circular]";function c(e,r,a){if(r&&(n=n.slice()).push(r),a){var u={depth:i.depth};return vt(i,"quoteStyle")&&(u.quoteStyle=i.quoteStyle),t(e,u,o+1,n)}return t(e,i,o+1,n)}if("function"==typeof e){var p=function(t){if(t.name)return t.name;var e=nt.call(ot.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),f=_t(e,c);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(f.length>0?" { "+f.join(", ")+" }":"")}if(mt(e)){var l=ut.call(e);return"object"==typeof e?St(l):l}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var y="<"+String(e.nodeName).toLowerCase(),d=e.attributes||[],h=0;h<d.length;h++)y+=" "+d[h].name+"="+yt(dt(d[h].value),"double",i);return y+=">",e.childNodes&&e.childNodes.length&&(y+="..."),y+="</"+String(e.nodeName).toLowerCase()+">"}if(ht(e)){if(0===e.length)return"[]";var m=_t(e,c);return s&&!function(t){for(var e=0;e<t.length;e++)if(wt(t[e],"\n")>=0)return!1;return!0}(m)?"["+Et(m,s)+"]":"[ "+m.join(", ")+" ]"}if(function(t){return!("[object Error]"!==gt(t)||lt&&"object"==typeof t&< in t)}(e)){var b=_t(e,c);return 0===b.length?"["+String(e)+"]":"{ ["+String(e)+"] "+b.join(", ")+" }"}if("object"==typeof e&&a){if(ft&&"function"==typeof e[ft])return e[ft]();if("function"==typeof e.inspect)return e.inspect()}if(function(t){if(!V||!t||"object"!=typeof t)return!1;try{V.call(t);try{K.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var v=[];return J.call(e,(function(t,r){v.push(c(r,e,!0)+" => "+c(t,e))})),Pt("Map",V.call(e),v,s)}if(function(t){if(!K||!t||"object"!=typeof t)return!1;try{K.call(t);try{V.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var g=[];return X.call(e,(function(t){g.push(c(t,e))})),Pt("Set",K.call(e),g,s)}if(function(t){if(!Y||!t||"object"!=typeof t)return!1;try{Y.call(t,Y);try{Z.call(t,Z)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return At("WeakMap");if(function(t){if(!Z||!t||"object"!=typeof t)return!1;try{Z.call(t,Z);try{Y.call(t,Y)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return At("WeakSet");if(function(t){if(!tt||!t||"object"!=typeof t)return!1;try{return tt.call(t),!0}catch(t){}return!1}(e))return At("WeakRef");if(function(t){return!("[object Number]"!==gt(t)||lt&&"object"==typeof t&< in t)}(e))return St(c(Number(e)));if(function(t){if(!t||"object"!=typeof t||!it)return!1;try{return it.call(t),!0}catch(t){}return!1}(e))return St(c(it.call(e)));if(function(t){return!("[object Boolean]"!==gt(t)||lt&&"object"==typeof t&< in t)}(e))return St(et.call(e));if(function(t){return!("[object String]"!==gt(t)||lt&&"object"==typeof t&< in t)}(e))return St(c(String(e)));if(!function(t){return!("[object Date]"!==gt(t)||lt&&"object"==typeof t&< in t)}(e)&&!function(t){return!("[object RegExp]"!==gt(t)||lt&&"object"==typeof t&< in t)}(e)){var w=_t(e,c),j=ct?ct(e)===Object.prototype:e instanceof Object||e.constructor===Object,O=e instanceof Object?"":"null prototype",S=!j&<&&Object(e)===e&< in e?gt(e).slice(8,-1):O?"Object":"",A=(j||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(S||O?"["+[].concat(S||[],O||[]).join(": ")+"] ":"");return 0===w.length?A+"{}":s?A+"{"+Et(w,s)+"}":A+"{ "+w.join(", ")+" }"}return String(e)},Rt=xt("%TypeError%"),Dt=xt("%WeakMap%",!0),Ft=xt("%Map%",!0),kt=Tt("WeakMap.prototype.get",!0),Mt=Tt("WeakMap.prototype.set",!0),Ut=Tt("WeakMap.prototype.has",!0),Nt=Tt("Map.prototype.get",!0),Bt=Tt("Map.prototype.set",!0),qt=Tt("Map.prototype.has",!0),Ct=function(t,e){for(var r,o=t;null!==(r=o.next);o=r)if(r.key===e)return o.next=r.next,r.next=t.next,t.next=r,r},Lt=String.prototype.replace,Wt=/%20/g,Ht="RFC3986",Gt={default:Ht,formatters:{RFC1738:function(t){return Lt.call(t,Wt,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:Ht},zt=Gt,Vt=Object.prototype.hasOwnProperty,Jt=Array.isArray,Qt=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),$t=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},o=0;o<t.length;++o)void 0!==t[o]&&(r[o]=t[o]);return r},Kt={arrayToObject:$t,assign:function(t,e){return Object.keys(e).reduce((function(t,r){return t[r]=e[r],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],o=0;o<e.length;++o)for(var n=e[o],i=n.obj[n.prop],a=Object.keys(i),u=0;u<a.length;++u){var s=a[u],c=i[s];"object"==typeof c&&null!==c&&-1===r.indexOf(c)&&(e.push({obj:i,prop:s}),r.push(c))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(Jt(r)){for(var o=[],n=0;n<r.length;++n)void 0!==r[n]&&o.push(r[n]);e.obj[e.prop]=o}}}(e),t},decode:function(t,e,r){var o=t.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(t){return o}},encode:function(t,e,r,o,n){if(0===t.length)return t;var i=t;if("symbol"==typeof t?i=Symbol.prototype.toString.call(t):"string"!=typeof t&&(i=String(t)),"iso-8859-1"===r)return escape(i).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var a="",u=0;u<i.length;++u){var s=i.charCodeAt(u);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||n===zt.RFC1738&&(40===s||41===s)?a+=i.charAt(u):s<128?a+=Qt[s]:s<2048?a+=Qt[192|s>>6]+Qt[128|63&s]:s<55296||s>=57344?a+=Qt[224|s>>12]+Qt[128|s>>6&63]+Qt[128|63&s]:(u+=1,s=65536+((1023&s)<<10|1023&i.charCodeAt(u)),a+=Qt[240|s>>18]+Qt[128|s>>12&63]+Qt[128|s>>6&63]+Qt[128|63&s])}return a},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(Jt(t)){for(var r=[],o=0;o<t.length;o+=1)r.push(e(t[o]));return r}return e(t)},merge:function t(e,r,o){if(!r)return e;if("object"!=typeof r){if(Jt(e))e.push(r);else{if(!e||"object"!=typeof e)return[e,r];(o&&(o.plainObjects||o.allowPrototypes)||!Vt.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(r);var n=e;return Jt(e)&&!Jt(r)&&(n=$t(e,o)),Jt(e)&&Jt(r)?(r.forEach((function(r,n){if(Vt.call(e,n)){var i=e[n];i&&"object"==typeof i&&r&&"object"==typeof r?e[n]=t(i,r,o):e.push(r)}else e[n]=r})),e):Object.keys(r).reduce((function(e,n){var i=r[n];return Vt.call(e,n)?e[n]=t(e[n],i,o):e[n]=i,e}),n)}},Xt=function(){var t,e,r,o={assert:function(t){if(!o.has(t))throw new Rt("Side channel does not contain "+It(t))},get:function(o){if(Dt&&o&&("object"==typeof o||"function"==typeof o)){if(t)return kt(t,o)}else if(Ft){if(e)return Nt(e,o)}else if(r)return function(t,e){var r=Ct(t,e);return r&&r.value}(r,o)},has:function(o){if(Dt&&o&&("object"==typeof o||"function"==typeof o)){if(t)return Ut(t,o)}else if(Ft){if(e)return qt(e,o)}else if(r)return function(t,e){return!!Ct(t,e)}(r,o);return!1},set:function(o,n){Dt&&o&&("object"==typeof o||"function"==typeof o)?(t||(t=new Dt),Mt(t,o,n)):Ft?(e||(e=new Ft),Bt(e,o,n)):(r||(r={key:{},next:null}),function(t,e,r){var o=Ct(t,e);o?o.value=r:t.next={key:e,next:t.next,value:r}}(r,o,n))}};return o},Yt=Kt,Zt=Gt,te=Object.prototype.hasOwnProperty,ee={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},re=Array.isArray,oe=Array.prototype.push,ne=function(t,e){oe.apply(t,re(e)?e:[e])},ie=Date.prototype.toISOString,ae=Zt.default,ue={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Yt.encode,encodeValuesOnly:!1,format:ae,formatter:Zt.formatters[ae],indices:!1,serializeDate:function(t){return ie.call(t)},skipNulls:!1,strictNullHandling:!1},se=function t(e,r,o,n,i,a,u,s,c,p,f,l,y,d,h){var m,b=e;if(h.has(e))throw new RangeError("Cyclic object value");if("function"==typeof u?b=u(r,b):b instanceof Date?b=p(b):"comma"===o&&re(b)&&(b=Yt.maybeMap(b,(function(t){return t instanceof Date?p(t):t}))),null===b){if(n)return a&&!y?a(r,ue.encoder,d,"key",f):r;b=""}if("string"==typeof(m=b)||"number"==typeof m||"boolean"==typeof m||"symbol"==typeof m||"bigint"==typeof m||Yt.isBuffer(b))return a?[l(y?r:a(r,ue.encoder,d,"key",f))+"="+l(a(b,ue.encoder,d,"value",f))]:[l(r)+"="+l(String(b))];var v,g=[];if(void 0===b)return g;if("comma"===o&&re(b))v=[{value:b.length>0?b.join(",")||null:void 0}];else if(re(u))v=u;else{var w=Object.keys(b);v=s?w.sort(s):w}for(var j=0;j<v.length;++j){var O=v[j],S="object"==typeof O&&void 0!==O.value?O.value:b[O];if(!i||null!==S){var A=re(b)?"function"==typeof o?o(r,O):r:r+(c?"."+O:"["+O+"]");h.set(e,!0);var P=Xt();ne(g,t(S,A,o,n,i,a,u,s,c,p,f,l,y,d,P))}}return g},ce=Kt,pe=Object.prototype.hasOwnProperty,fe=Array.isArray,le={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:ce.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},ye=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},de=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},he=function(t,e,r,o){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,a=r.depth>0&&/(\[[^[\]]*])/.exec(n),u=a?n.slice(0,a.index):n,s=[];if(u){if(!r.plainObjects&&pe.call(Object.prototype,u)&&!r.allowPrototypes)return;s.push(u)}for(var c=0;r.depth>0&&null!==(a=i.exec(n))&&c<r.depth;){if(c+=1,!r.plainObjects&&pe.call(Object.prototype,a[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(a[1])}return a&&s.push("["+n.slice(a.index)+"]"),function(t,e,r,o){for(var n=o?e:de(e,r),i=t.length-1;i>=0;--i){var a,u=t[i];if("[]"===u&&r.parseArrays)a=[].concat(n);else{a=r.plainObjects?Object.create(null):{};var s="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,c=parseInt(s,10);r.parseArrays||""!==s?!isNaN(c)&&u!==s&&String(c)===s&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(a=[])[c]=n:a[s]=n:a={0:n}}n=a}return n}(s,e,r,o)}},me=function(t,e){var r,o=t,n=function(t){if(!t)return ue;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||ue.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=Zt.default;if(void 0!==t.format){if(!te.call(Zt.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var o=Zt.formatters[r],n=ue.filter;return("function"==typeof t.filter||re(t.filter))&&(n=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:ue.addQueryPrefix,allowDots:void 0===t.allowDots?ue.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:ue.charsetSentinel,delimiter:void 0===t.delimiter?ue.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:ue.encode,encoder:"function"==typeof t.encoder?t.encoder:ue.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:ue.encodeValuesOnly,filter:n,format:r,formatter:o,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:ue.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:ue.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:ue.strictNullHandling}}(e);"function"==typeof n.filter?o=(0,n.filter)("",o):re(n.filter)&&(r=n.filter);var i,a=[];if("object"!=typeof o||null===o)return"";i=e&&e.arrayFormat in ee?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var u=ee[i];r||(r=Object.keys(o)),n.sort&&r.sort(n.sort);for(var s=Xt(),c=0;c<r.length;++c){var p=r[c];n.skipNulls&&null===o[p]||ne(a,se(o[p],p,u,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,s))}var f=a.join(n.delimiter),l=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?l+="utf8=%26%2310003%3B&":l+="utf8=%E2%9C%93&"),f.length>0?l+f:""},be={formats:Gt,parse:function(t,e){var r=function(t){if(!t)return le;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?le.charset:t.charset;return{allowDots:void 0===t.allowDots?le.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:le.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:le.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:le.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:le.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:le.comma,decoder:"function"==typeof t.decoder?t.decoder:le.decoder,delimiter:"string"==typeof t.delimiter||ce.isRegExp(t.delimiter)?t.delimiter:le.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:le.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:le.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:le.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:le.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:le.strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof t?function(t,e){var r,o={},n=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,i=e.parameterLimit===1/0?void 0:e.parameterLimit,a=n.split(e.delimiter,i),u=-1,s=e.charset;if(e.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?s="utf-8":"utf8=%26%2310003%3B"===a[r]&&(s="iso-8859-1"),u=r,r=a.length);for(r=0;r<a.length;++r)if(r!==u){var c,p,f=a[r],l=f.indexOf("]="),y=-1===l?f.indexOf("="):l+1;-1===y?(c=e.decoder(f,le.decoder,s,"key"),p=e.strictNullHandling?null:""):(c=e.decoder(f.slice(0,y),le.decoder,s,"key"),p=ce.maybeMap(de(f.slice(y+1),e),(function(t){return e.decoder(t,le.decoder,s,"value")}))),p&&e.interpretNumericEntities&&"iso-8859-1"===s&&(p=ye(p)),f.indexOf("[]=")>-1&&(p=fe(p)?[p]:p),pe.call(o,c)?o[c]=ce.combine(o[c],p):o[c]=p}return o}(t,r):t,n=r.plainObjects?Object.create(null):{},i=Object.keys(o),a=0;a<i.length;++a){var u=i[a],s=he(u,o[u],r,"string"==typeof t);n=ce.merge(n,s,r)}return!0===r.allowSparse?n:ce.compact(n)},stringify:me},ve=function(t){return"string"==typeof t},ge={exports:{}};!function(t,e){var r="undefined"!=typeof self?self:n,o=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,o="Symbol"in t&&"iterator"in Symbol,n="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,a="ArrayBuffer"in t;if(a)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function p(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function y(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function h(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&n&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||s(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n&&(this.blob=function(){var t=y(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?y(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t,e,r,o=y(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=d(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),o=0;o<e.length;o++)r[o]=String.fromCharCode(e[o]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=c(t),e=p(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[c(t)]},l.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},l.prototype.set=function(t,e){this.map[c(t)]=p(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),f(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(t)},o&&(l.prototype[Symbol.iterator]=l.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var r,o,n=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=e.method||this.method||"GET",o=r.toUpperCase(),v.indexOf(o)>-1?o:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),o=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(n))}})),e}function j(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},b.call(g.prototype),b.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},j.error=function(){var t=new j(null,{status:0,statusText:""});return t.type="error",t};var O=[301,302,303,307,308];j.redirect=function(t,e){if(-1===O.indexOf(e))throw new RangeError("Invalid status code");return new j(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function S(t,r){return new Promise((function(o,i){var a=new g(t,r);if(a.signal&&a.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function s(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),o=r.shift().trim();if(o){var n=r.join(":").trim();e.append(o,n)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var n="response"in u?u.response:u.responseText;o(new j(n,r))},u.onerror=function(){i(new TypeError("Network request failed"))},u.ontimeout=function(){i(new TypeError("Network request failed"))},u.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},u.open(a.method,a.url,!0),"include"===a.credentials?u.withCredentials=!0:"omit"===a.credentials&&(u.withCredentials=!1),"responseType"in u&&n&&(u.responseType="blob"),a.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",s),u.onreadystatechange=function(){4===u.readyState&&a.signal.removeEventListener("abort",s)}),u.send(void 0===a._bodyInit?null:a._bodyInit)}))}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=l,t.Request=g,t.Response=j),e.Headers=l,e.Request=g,e.Response=j,e.fetch=S,Object.defineProperty(e,"__esModule",{value:!0})}({})}(o),o.fetch.ponyfill=!0,delete o.fetch.polyfill;var i=o;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(ge,ge.exports);var we=i(ge.exports),je=function(t){var e;return e=t||("undefined"==typeof fetch?we:fetch),function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.apply(void 0,t)}},Oe=function(t,n){var i=je(n),a="undefined"==typeof Headers?ge.exports.Headers:Headers;return function(n,u){return r(void 0,void 0,void 0,(function(){var r;return o(this,(function(o){return(r=new a(null==u?void 0:u.headers)).has("X-MICROCMS-API-KEY")||r.set("X-MICROCMS-API-KEY",t),[2,i(n,e(e({},u),{headers:r}))]}))}))}},Se={};function Ae(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var Pe=Ae;Ae.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},Ae.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},Ae.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var o=this;return this._timer=setTimeout((function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout((function(){o._operationTimeoutCb(o._attempts)}),o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)}),r),this._options.unref&&this._timer.unref(),!0},Ae.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},Ae.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},Ae.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},Ae.prototype.start=Ae.prototype.try,Ae.prototype.errors=function(){return this._errors},Ae.prototype.attempts=function(){return this._attempts},Ae.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,o=0;o<this._errors.length;o++){var n=this._errors[o],i=n.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=n,r=a)}return e},function(t){var e=Pe;t.operation=function(r){var o=t.timeouts(r);return new e(o,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],n=0;n<e.retries;n++)o.push(this.createTimeout(n,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(n,e)),o.sort((function(t,e){return t-e})),o},t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,o=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout)},t.wrap=function(e,r,o){if(r instanceof Array&&(o=r,r=null),!o)for(var n in o=[],e)"function"==typeof e[n]&&o.push(n);for(var i=0;i<o.length;i++){var a=o[i],u=e[a];e[a]=function(o){var n=t.operation(r),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(t){n.retry(t)||(t&&(arguments[0]=n.mainError()),a.apply(this,arguments))})),n.attempt((function(){o.apply(e,i)}))}.bind(e,u),e[a].options=r}}}(Se);var Ee=Se;var _e=function(t,e){return new Promise((function(r,o){var n,i=e||{};function a(t){o(t||new Error("Aborted"))}function u(t,e){t.bail?a(t):n.retry(t)?i.onRetry&&i.onRetry(t,e):o(n.mainError())}"randomize"in i||(i.randomize=!0),(n=Ee.operation(i)).attempt((function(e){var o;try{o=t(a,e)}catch(t){return void u(t,e)}Promise.resolve(o).then(r).catch((function(t){u(t,e)}))}))}))};t.createClient=function(t){var n=t.serviceDomain,i=t.apiKey,a=t.customFetch,u=t.retry;if(!n||!i)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!ve(n)||!ve(i))throw new Error("parameter is not string");var s="https://".concat(n,".").concat("microcms.io","/api/").concat("v1"),c=function(t){var n=t.endpoint,c=t.contentId,p=t.queries,f=void 0===p?{}:p,l=t.requestInit;return r(void 0,void 0,void 0,(function(){var t,p,y,d;return o(this,(function(h){switch(h.label){case 0:return t=Oe(i,a),p=function(t){if(null===(e=t)||"object"!=typeof e)throw new Error("queries is not object");var e;return be.stringify(t,{arrayFormat:"comma"})}(f),y="".concat(s,"/").concat(n).concat(c?"/".concat(c):"").concat(p?"?".concat(p):""),d=function(t){return r(void 0,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.json()];case 1:return[2,null!=(e=r.sent().message)?e:null];case 2:return r.sent(),[2,null];case 3:return[2]}}))}))},[4,_e((function(n){return r(void 0,void 0,void 0,(function(){var r,i,a,u,s;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),[4,t(y,e(e({},l),{method:null!==(u=null==l?void 0:l.method)&&void 0!==u?u:"GET"}))];case 1:return 429!==(r=o.sent()).status&&r.status>=400&&r.status<500?[4,d(r)]:[3,3];case 2:return i=o.sent(),[2,n(new Error("fetch API response status: ".concat(r.status).concat(i?"\n message is `".concat(i,"`"):"")))];case 3:return r.ok?[3,5]:[4,d(r)];case 4:return i=o.sent(),[2,Promise.reject(new Error("fetch API response status: ".concat(r.status).concat(i?"\n message is `".concat(i,"`"):"")))];case 5:return"DELETE"===(null==l?void 0:l.method)?[2]:[2,r.json()];case 6:if((a=o.sent()).data)throw a.data;if(null===(s=a.response)||void 0===s?void 0:s.data)throw a.response.data;return[2,Promise.reject(new Error("Network Error.\n Details: ".concat(a)))];case 7:return[2]}}))}))}),{retries:u?2:0,onRetry:function(t,e){console.log(t),console.log("Waiting for retry (".concat(e,"/").concat(2,")"))},minTimeout:5e3})];case 1:return[2,h.sent()]}}))}))};return{get:function(t){var e=t.endpoint,n=t.contentId,i=t.queries,a=void 0===i?{}:i,u=t.customRequestInit;return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return e?[4,c({endpoint:e,contentId:n,queries:a,requestInit:u})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,t.sent()]}}))}))},getList:function(t){var e=t.endpoint,n=t.queries,i=void 0===n?{}:n,a=t.customRequestInit;return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return e?[4,c({endpoint:e,queries:i,requestInit:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,t.sent()]}}))}))},getListDetail:function(t){var e=t.endpoint,n=t.contentId,i=t.queries,a=void 0===i?{}:i,u=t.customRequestInit;return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return e?[4,c({endpoint:e,contentId:n,queries:a,requestInit:u})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,t.sent()]}}))}))},getObject:function(t){var e=t.endpoint,n=t.queries,i=void 0===n?{}:n,a=t.customRequestInit;return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return e?[4,c({endpoint:e,queries:i,requestInit:a})]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return[2,t.sent()]}}))}))},create:function(t){var n=t.endpoint,i=t.contentId,a=t.content,u=t.isDraft,s=void 0!==u&&u,p=t.customRequestInit;return r(void 0,void 0,void 0,(function(){var t,r;return o(this,(function(o){return n?(t=s?{status:"draft"}:{},r=e(e({},p),{method:i?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),[2,c({endpoint:n,contentId:i,queries:t,requestInit:r})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},update:function(t){var n=t.endpoint,i=t.contentId,a=t.content,u=t.customRequestInit;return r(void 0,void 0,void 0,(function(){var t;return o(this,(function(r){return n?(t=e(e({},u),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),[2,c({endpoint:n,contentId:i,requestInit:t})]):[2,Promise.reject(new Error("endpoint is required"))]}))}))},delete:function(t){var n=t.endpoint,i=t.contentId,a=t.customRequestInit;return r(void 0,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:return n?i?(t=e(e({},a),{method:"DELETE",headers:{},body:void 0}),[4,c({endpoint:n,contentId:i,requestInit:t})]):[2,Promise.reject(new Error("contentId is required"))]:[2,Promise.reject(new Error("endpoint is required"))];case 1:return r.sent(),[2]}}))}))}}},Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
1
|
+
"use strict";function t(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function e(e){if(Array.isArray(e))return t(e)}function r(t,e,r,n,o,i,a){try{var u=t[i](a);var s=u.value}catch(t){r(t);return}if(u.done){e(s)}else{Promise.resolve(s).then(n,o)}}function n(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var a=t.apply(e,n);function u(t){r(a,o,i,u,s,"next",t)}function s(t){r(a,o,i,u,s,"throw",t)}u(undefined)})}}function o(t,e,r){if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function i(t,e){if(e!=null&&typeof Symbol!=="undefined"&&e[Symbol.hasInstance]){return!!e[Symbol.hasInstance](t)}else{return t instanceof e}}function a(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))}n.forEach(function(e){o(t,e,r[e])})}return t}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);if(e){n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})}r.push.apply(r,n)}return r}function f(t,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}else{c(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function p(t){return e(t)||a(t)||y(t)||u()}function l(t){"@swc/helpers - typeof";return t&&typeof Symbol!=="undefined"&&t.constructor===Symbol?"symbol":typeof t}function y(e,r){if(!e)return;if(typeof e==="string")return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}function d(t,e){var r,n,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return(i={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i);function u(t){return function(e){return s([t,e])}}function s(i){if(r)throw new TypeError("Generator is already executing.");while(a)try{if(r=1,n&&(o=i[0]&2?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;if(n=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;n=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t];n=0}finally{r=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var microcms=function(){var t=Object.create;var e=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var c=function(t,e){return function(){return e||t((e={exports:{}}).exports,e),e.exports}},y=function(t,r){for(var n in r)e(t,n,{get:r[n],enumerable:!0})},h=function(t,n,i,a){var s=true,c=false,f=undefined;if(n&&typeof n=="object"||typeof n=="function")try{var p=function(){var o=y.value;!u.call(t,o)&&o!==i&&e(t,o,{get:function(){return n[o]},enumerable:!(a=r(n,o))||a.enumerable})};for(var l=o(n)[Symbol.iterator](),y;!(s=(y=l.next()).done);s=true)p()}catch(t){c=true;f=t}finally{try{if(!s&&l.return!=null){l.return()}}finally{if(c){throw f}}}return t};var m=function(r,n,o){return o=r!=null?t(a(r)):{},h(n||!r||!r.__esModule?e(o,"default",{value:r,enumerable:!0}):o,r)},b=function(t){return h(e({},"__esModule",{value:!0}),t)};var v=c(function(t,e){"use strict";e.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(l(Symbol.iterator)=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var n=42;t[e]=n;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(t,e);if(i.value!==n||i.enumerable!==!0)return!1}return!0}});var g=c(function(t,e){"use strict";var r=(typeof Symbol==="undefined"?"undefined":l(Symbol))<"u"&&Symbol,n=v();e.exports=function(){return typeof r!="function"||typeof Symbol!="function"||l(r("foo"))!="symbol"||l(Symbol("bar"))!="symbol"?!1:n()}});var w=c(function(t,e){"use strict";var r={foo:{}},n=Object;e.exports=function(){return({__proto__:r}).foo===r.foo&&!i({__proto__:null},n)}});var A=c(function(t,e){"use strict";var r="Function.prototype.bind called on incompatible ",n=Array.prototype.slice,o=Object.prototype.toString,a="[object Function]";e.exports=function(t){var e=this;if(typeof e!="function"||o.call(e)!==a)throw new TypeError(r+e);for(var u=n.call(arguments,1),s,c=function r(){if(i(this,s)){var r=e.apply(this,u.concat(n.call(arguments)));return Object(r)===r?r:this}else return e.apply(t,u.concat(n.call(arguments)))},f=Math.max(0,e.length-u.length),p=[],l=0;l<f;l++)p.push("$"+l);if(s=Function("binder","return function ("+p.join(",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var y=function t(){};y.prototype=e.prototype,s.prototype=new y,y.prototype=null}return s}});var O=c(function(t,e){"use strict";var r=A();e.exports=Function.prototype.bind||r});var j=c(function(t,e){"use strict";var r=O();e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)});var S=c(function(t,e){"use strict";var r,n=SyntaxError,o=Function,i=TypeError,a=function t(t){try{return o('"use strict"; return ('+t+").constructor;")()}catch(t){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(t){u=null}var s=function t(){throw new i},c=u?function(){try{return arguments.callee,s}catch(t){try{return u(arguments,"callee").get}catch(t){return s}}}():s,f=g()(),p=w()(),y=Object.getPrototypeOf||(p?function(t){return t.__proto__}:null),d={},h=(typeof Uint8Array==="undefined"?"undefined":l(Uint8Array))>"u"||!y?r:y(Uint8Array),m={"%AggregateError%":(typeof AggregateError==="undefined"?"undefined":l(AggregateError))>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":(typeof ArrayBuffer==="undefined"?"undefined":l(ArrayBuffer))>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":f&&y?y([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":(typeof Atomics==="undefined"?"undefined":l(Atomics))>"u"?r:Atomics,"%BigInt%":(typeof BigInt==="undefined"?"undefined":l(BigInt))>"u"?r:BigInt,"%BigInt64Array%":(typeof BigInt64Array==="undefined"?"undefined":l(BigInt64Array))>"u"?r:BigInt64Array,"%BigUint64Array%":(typeof BigUint64Array==="undefined"?"undefined":l(BigUint64Array))>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":(typeof DataView==="undefined"?"undefined":l(DataView))>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":(typeof Float32Array==="undefined"?"undefined":l(Float32Array))>"u"?r:Float32Array,"%Float64Array%":(typeof Float64Array==="undefined"?"undefined":l(Float64Array))>"u"?r:Float64Array,"%FinalizationRegistry%":(typeof FinalizationRegistry==="undefined"?"undefined":l(FinalizationRegistry))>"u"?r:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":d,"%Int8Array%":(typeof Int8Array==="undefined"?"undefined":l(Int8Array))>"u"?r:Int8Array,"%Int16Array%":(typeof Int16Array==="undefined"?"undefined":l(Int16Array))>"u"?r:Int16Array,"%Int32Array%":(typeof Int32Array==="undefined"?"undefined":l(Int32Array))>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f&&y?y(y([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":(typeof Map==="undefined"?"undefined":l(Map))>"u"?r:Map,"%MapIteratorPrototype%":(typeof Map==="undefined"?"undefined":l(Map))>"u"||!f||!y?r:y(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":(typeof Promise==="undefined"?"undefined":l(Promise))>"u"?r:Promise,"%Proxy%":(typeof Proxy==="undefined"?"undefined":l(Proxy))>"u"?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":(typeof Reflect==="undefined"?"undefined":l(Reflect))>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":(typeof Set==="undefined"?"undefined":l(Set))>"u"?r:Set,"%SetIteratorPrototype%":(typeof Set==="undefined"?"undefined":l(Set))>"u"||!f||!y?r:y(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":(typeof SharedArrayBuffer==="undefined"?"undefined":l(SharedArrayBuffer))>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f&&y?y(""[Symbol.iterator]()):r,"%Symbol%":f?Symbol:r,"%SyntaxError%":n,"%ThrowTypeError%":c,"%TypedArray%":h,"%TypeError%":i,"%Uint8Array%":(typeof Uint8Array==="undefined"?"undefined":l(Uint8Array))>"u"?r:Uint8Array,"%Uint8ClampedArray%":(typeof Uint8ClampedArray==="undefined"?"undefined":l(Uint8ClampedArray))>"u"?r:Uint8ClampedArray,"%Uint16Array%":(typeof Uint16Array==="undefined"?"undefined":l(Uint16Array))>"u"?r:Uint16Array,"%Uint32Array%":(typeof Uint32Array==="undefined"?"undefined":l(Uint32Array))>"u"?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":(typeof WeakMap==="undefined"?"undefined":l(WeakMap))>"u"?r:WeakMap,"%WeakRef%":(typeof WeakRef==="undefined"?"undefined":l(WeakRef))>"u"?r:WeakRef,"%WeakSet%":(typeof WeakSet==="undefined"?"undefined":l(WeakSet))>"u"?r:WeakSet};if(y)try{null.error}catch(t){b=y(y(t)),m["%Error.prototype%"]=b}var b,v=function t(e){var r;if(e==="%AsyncFunction%")r=a("async function () {}");else if(e==="%GeneratorFunction%")r=a("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=a("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&y&&(r=y(o.prototype))}return m[e]=r,r},A={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},S=O(),P=j(),E=S.call(Function.call,Array.prototype.concat),x=S.call(Function.apply,Array.prototype.splice),_=S.call(Function.call,String.prototype.replace),I=S.call(Function.call,String.prototype.slice),T=S.call(Function.call,RegExp.prototype.exec),R=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,F=/\\(\\)?/g,D=function t(t){var e=I(t,0,1),r=I(t,-1);if(e==="%"&&r!=="%")throw new n("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new n("invalid intrinsic syntax, expected opening `%`");var o=[];return _(t,R,function(t,e,r,n){o[o.length]=r?_(n,F,"$1"):e||t}),o},k=function t(t,e){var r=t,o;if(P(A,r)&&(o=A[r],r="%"+o[0]+"%"),P(m,r)){var a=m[r];if(a===d&&(a=v(r)),(typeof a==="undefined"?"undefined":l(a))>"u"&&!e)throw new i("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:r,value:a}}throw new n("intrinsic "+t+" does not exist!")};e.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new i('"allowMissing" argument must be a boolean');if(T(/^%?[^%]*%?$/,t)===null)throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=D(t),o=r.length>0?r[0]:"",a=k("%"+o+"%",e),s=a.name,c=a.value,f=!1,p=a.alias;p&&(o=p[0],x(r,E([0,1],p)));for(var l=1,y=!0;l<r.length;l+=1){var d=r[l],h=I(d,0,1),b=I(d,-1);if((h==='"'||h==="'"||h==="`"||b==='"'||b==="'"||b==="`")&&h!==b)throw new n("property names with quotes must have matching quotes");if((d==="constructor"||!y)&&(f=!0),o+="."+d,s="%"+o+"%",P(m,s))c=m[s];else if(c!=null){if(!(d in c)){if(!e)throw new i("base intrinsic for "+t+" exists, but the property is not available.");return}if(u&&l+1>=r.length){var v=u(c,d);y=!!v,y&&"get"in v&&!("originalValue"in v.get)?c=v.get:c=c[d]}else y=P(c,d),c=c[d];y&&!f&&(m[s]=c)}}return c}});var P=c(function(t,e){"use strict";var r=O(),n=S(),o=n("%Function.prototype.apply%"),i=n("%Function.prototype.call%"),a=n("%Reflect.apply%",!0)||r.call(i,o),u=n("%Object.getOwnPropertyDescriptor%",!0),s=n("%Object.defineProperty%",!0),c=n("%Math.max%");if(s)try{s({},"a",{value:1})}catch(t){s=null}e.exports=function(t){var e=a(r,i,arguments);if(u&&s){var n=u(e,"length");n.configurable&&s(e,"length",{value:1+c(0,t.length-(arguments.length-1))})}return e};var f=function t(){return a(r,o,arguments)};s?s(e.exports,"apply",{value:f}):e.exports.apply=f});var E=c(function(t,e){"use strict";var r=S(),n=P(),o=n(r("String.prototype.indexOf"));e.exports=function(t,e){var i=r(t,!!e);return typeof i=="function"&&o(t,".prototype.")>-1?n(i):i}});var x=c(function(){"use strict"});var _=c(function(t,e){"use strict";var r=function t(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n};var n=function t(t){return String(t).replace(/"/g,""")};var o=function t(t){return m(t)==="[object Array]"&&(!ti||!(typeof t=="object"&&ti in t))};var a=function t(t){return m(t)==="[object Date]"&&(!ti||!(typeof t=="object"&&ti in t))};var u=function t(t){return m(t)==="[object RegExp]"&&(!ti||!(typeof t=="object"&&ti in t))};var s=function t(t){return m(t)==="[object Error]"&&(!ti||!(typeof t=="object"&&ti in t))};var c=function t(t){return m(t)==="[object String]"&&(!ti||!(typeof t=="object"&&ti in t))};var f=function t(t){return m(t)==="[object Number]"&&(!ti||!(typeof t=="object"&&ti in t))};var p=function t(t){return m(t)==="[object Boolean]"&&(!ti||!(typeof t=="object"&&ti in t))};var y=function t(t){if((typeof t==="undefined"?"undefined":l(t))=="symbol")return!0;if(!t||typeof t!="object"||!tt)return!1;try{return tt.call(t),!0}catch(t){}return!1};var d=function t(t){if(!t||typeof t!="object"||!Y)return!1;try{return Y.call(t),!0}catch(t){}return!1};var h=function t(t,e){return ta.call(t,e)};var m=function t(t){return $.call(t)};var b=function t(t){if(t.name)return t.name;var e=X.call(K.call(t),/^function\s*([\w$]+)/);return e?e[1]:null};var v=function t(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1};var g=function t(t){if(!U||!t||typeof t!="object")return!1;try{U.call(t);try{q.call(t)}catch(t){return!0}return i(t,Map)}catch(t){}return!1};var w=function t(t){if(!H||!t||typeof t!="object")return!1;try{H.call(t,H);try{z.call(t,z)}catch(t){return!0}return i(t,WeakMap)}catch(t){}return!1};var A=function t(t){if(!J||!t||typeof t!="object")return!1;try{return J.call(t),!0}catch(t){}return!1};var O=function t(t){if(!q||!t||typeof t!="object")return!1;try{q.call(t);try{U.call(t)}catch(t){return!0}return i(t,Set)}catch(t){}return!1};var j=function t(t){if(!z||!t||typeof t!="object")return!1;try{z.call(t,z);try{H.call(t,H)}catch(t){return!0}return i(t,WeakSet)}catch(t){}return!1};var S=function t(t){return!t||typeof t!="object"?!1:(typeof HTMLElement==="undefined"?"undefined":l(HTMLElement))<"u"&&i(t,HTMLElement)?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"};var P=function t(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+e.toString(16).toUpperCase()};var E=function t(t){return"Object("+t+")"};var _=function t(t){return t+" { ? }"};var I=function t(t,e,r,n){var o=n?F(r,n):r.join(", ");return t+" ("+e+") {"+o+"}"};var T=function t(t){for(var e=0;e<t.length;e++)if(v(t[e],"\n")>=0)return!1;return!0};var R=function t(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Array(t.indent+1).join(" ");else return null;return{base:r,prev:Array(e+1).join(r)}};var F=function t(t,e){if(t.length===0)return"";var r="\n"+e.prev+e.base;return r+t.join(","+r)+"\n"+e.prev};var D=function t(t,e){var r=o(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=h(t,i)?e(t[i],t):""}for(var a in t)h(t,a)&&(r&&String(Number(a))===a&&a<t.length||(/[^\w$]/.test(a)?n.push(e(a,t)+": "+e(t[a],t)):n.push(a+": "+e(t[a],t))));if(typeof Z=="function")for(var u=Z(t),s=0;s<u.length;s++)te.call(t,u[s])&&n.push("["+e(u[s])+"]: "+e(t[u[s]],t));return n};var k=typeof Map=="function"&&Map.prototype,B=Object.getOwnPropertyDescriptor&&k?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,U=k&&B&&typeof B.get=="function"?B.get:null,M=k&&Map.prototype.forEach,N=typeof Set=="function"&&Set.prototype,C=Object.getOwnPropertyDescriptor&&N?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,q=N&&C&&typeof C.get=="function"?C.get:null,L=N&&Set.prototype.forEach,W=typeof WeakMap=="function"&&WeakMap.prototype,H=W?WeakMap.prototype.has:null,G=typeof WeakSet=="function"&&WeakSet.prototype,z=G?WeakSet.prototype.has:null,V=typeof WeakRef=="function"&&WeakRef.prototype,J=V?WeakRef.prototype.deref:null,Q=Boolean.prototype.valueOf,$=Object.prototype.toString,K=Function.prototype.toString,X=String.prototype.match,Y=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Z=Object.getOwnPropertySymbols,tt=typeof Symbol=="function"&&l(Symbol.iterator)=="symbol"?Symbol.prototype.toString:null,te=Object.prototype.propertyIsEnumerable,tr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null),tn=x().custom,to=tn&&y(tn)?tn:null,ti=typeof Symbol=="function"&&l(Symbol.toStringTag)=="symbol"?Symbol.toStringTag:null;e.exports=function t(e,P,x,k){var B=function e(e,r,n){if(r&&(k=k.slice(),k.push(r)),n){var o={depth:N.depth};return h(N,"quoteStyle")&&(o.quoteStyle=N.quoteStyle),t(e,o,x+1,k)}return t(e,N,x+1,k)};var N=P||{};if(h(N,"quoteStyle")&&N.quoteStyle!=="single"&&N.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(h(N,"maxStringLength")&&(typeof N.maxStringLength=="number"?N.maxStringLength<0&&N.maxStringLength!==1/0:N.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var C=h(N,"customInspect")?N.customInspect:!0;if(typeof C!="boolean")throw new TypeError('option "customInspect", if provided, must be `true` or `false`');if(h(N,"indent")&&N.indent!==null&&N.indent!==" "&&!(parseInt(N.indent,10)===N.indent&&N.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if((typeof e==="undefined"?"undefined":l(e))>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return tu(e,N);if(typeof e=="number")return e===0?1/0/e>0?"0":"-0":String(e);if((typeof e==="undefined"?"undefined":l(e))=="bigint")return String(e)+"n";var W=l(N.depth)>"u"?5:N.depth;if((typeof x==="undefined"?"undefined":l(x))>"u"&&(x=0),x>=W&&W>0&&typeof e=="object")return o(e)?"[Array]":"[Object]";var H=R(N,x);if((typeof k==="undefined"?"undefined":l(k))>"u")k=[];else if(v(k,e)>=0)return"[Circular]";if(typeof e=="function"){var G=b(e),z=D(e,B);return"[Function"+(G?": "+G:" (anonymous)")+"]"+(z.length>0?" { "+z.join(", ")+" }":"")}if(y(e)){var V=tt.call(e);return typeof e=="object"?E(V):V}if(S(e)){for(var J="<"+String(e.nodeName).toLowerCase(),$=e.attributes||[],K=0;K<$.length;K++)J+=" "+$[K].name+"="+r(n($[K].value),"double",N);return J+=">",e.childNodes&&e.childNodes.length&&(J+="..."),J+="</"+String(e.nodeName).toLowerCase()+">",J}if(o(e)){if(e.length===0)return"[]";var X=D(e,B);return H&&!T(X)?"["+F(X,H)+"]":"[ "+X.join(", ")+" ]"}if(s(e)){var Z=D(e,B);return Z.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Z.join(", ")+" }"}if(typeof e=="object"&&C){if(to&&typeof e[to]=="function")return e[to]();if(typeof e.inspect=="function")return e.inspect()}if(g(e)){var te=[];return M.call(e,function(t,r){te.push(B(r,e,!0)+" => "+B(t,e))}),I("Map",U.call(e),te,H)}if(O(e)){var tn=[];return L.call(e,function(t){tn.push(B(t,e))}),I("Set",q.call(e),tn,H)}if(w(e))return _("WeakMap");if(j(e))return _("WeakSet");if(A(e))return _("WeakRef");if(f(e))return E(B(Number(e)));if(d(e))return E(B(Y.call(e)));if(p(e))return E(Q.call(e));if(c(e))return E(B(String(e)));if(!a(e)&&!u(e)){var ta=D(e,B),ts=tr?tr(e)===Object.prototype:i(e,Object)||e.constructor===Object,tc=i(e,Object)?"":"null prototype",tf=!ts&&ti&&Object(e)===e&&ti in e?m(e).slice(8,-1):tc?"Object":"",tp=ts||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",tl=tp+(tf||tc?"["+[].concat(tf||[],tc||[]).join(": ")+"] ":"");return ta.length===0?tl+"{}":H?tl+"{"+F(ta,H)+"}":tl+"{ "+ta.join(", ")+" }"}return String(e)};var ta=Object.prototype.hasOwnProperty||function(t){return t in this};function tu(t,e){if(t.length>e.maxStringLength){var n=t.length-e.maxStringLength,o="... "+n+" more character"+(n>1?"s":"");return tu(t.slice(0,e.maxStringLength),e)+o}var i=t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,P);return r(i,"single",e)}});var I=c(function(t,e){"use strict";var r=S(),n=E(),o=_(),i=r("%TypeError%"),a=r("%WeakMap%",!0),u=r("%Map%",!0),s=n("WeakMap.prototype.get",!0),c=n("WeakMap.prototype.set",!0),f=n("WeakMap.prototype.has",!0),p=n("Map.prototype.get",!0),l=n("Map.prototype.set",!0),y=n("Map.prototype.has",!0),d=function t(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},h=function t(t,e){var r=d(t,e);return r&&r.value},m=function t(t,e,r){var n=d(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},b=function t(t,e){return!!d(t,e)};e.exports=function(){var t,e,r,n={assert:function t(t){if(!n.has(t))throw new i("Side channel does not contain "+o(t))},get:function n(n){if(a&&n&&(typeof n=="object"||typeof n=="function")){if(t)return s(t,n)}else if(u){if(e)return p(e,n)}else if(r)return h(r,n)},has:function n(n){if(a&&n&&(typeof n=="object"||typeof n=="function")){if(t)return f(t,n)}else if(u){if(e)return y(e,n)}else if(r)return b(r,n);return!1},set:function n(n,o){a&&n&&(typeof n=="object"||typeof n=="function")?(t||(t=new a),c(t,n,o)):u?(e||(e=new u),l(e,n,o)):(r||(r={key:{},next:null}),m(r,n,o))}};return n}});var T=c(function(t,e){"use strict";var r=String.prototype.replace,n=/%20/g,o={RFC1738:"RFC1738",RFC3986:"RFC3986"};e.exports={default:o.RFC3986,formatters:{RFC1738:function t(t){return r.call(t,n,"+")},RFC3986:function t(t){return String(t)}},RFC1738:o.RFC1738,RFC3986:o.RFC3986}});var R=c(function(t,e){"use strict";var r=T(),n=Object.prototype.hasOwnProperty,o=Array.isArray,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function t(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(o(r)){for(var n=[],i=0;i<r.length;++i)l(r[i])<"u"&&n.push(r[i]);e.obj[e.prop]=n}}},u=function t(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)l(t[n])<"u"&&(r[n]=t[n]);return r},s=function t(e,r,i){if(!r)return e;if(typeof r!="object"){if(o(e))e.push(r);else if(e&&typeof e=="object")(i&&(i.plainObjects||i.allowPrototypes)||!n.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var a=e;return o(e)&&!o(r)&&(a=u(e,i)),o(e)&&o(r)?(r.forEach(function(r,o){if(n.call(e,o)){var a=e[o];a&&typeof a=="object"&&r&&typeof r=="object"?e[o]=t(a,r,i):e.push(r)}else e[o]=r}),e):Object.keys(r).reduce(function(e,o){var a=r[o];return n.call(e,o)?e[o]=t(e[o],a,i):e[o]=a,e},a)},c=function t(t,e){return Object.keys(e).reduce(function(t,r){return t[r]=e[r],t},t)},f=function t(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(t){return n}},p=function t(t,e,n,o,a){if(t.length===0)return t;var u=t;if((typeof t==="undefined"?"undefined":l(t))=="symbol"?u=Symbol.prototype.toString.call(t):typeof t!="string"&&(u=String(t)),n==="iso-8859-1")return escape(u).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var s="",c=0;c<u.length;++c){var f=u.charCodeAt(c);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||a===r.RFC1738&&(f===40||f===41)){s+=u.charAt(c);continue}if(f<128){s=s+i[f];continue}if(f<2048){s=s+(i[192|f>>6]+i[128|f&63]);continue}if(f<55296||f>=57344){s=s+(i[224|f>>12]+i[128|f>>6&63]+i[128|f&63]);continue}c+=1,f=65536+((f&1023)<<10|u.charCodeAt(c)&1023),s+=i[240|f>>18]+i[128|f>>12&63]+i[128|f>>6&63]+i[128|f&63]}return s},y=function t(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var o=e[n],i=o.obj[o.prop],u=Object.keys(i),s=0;s<u.length;++s){var c=u[s],f=i[c];typeof f=="object"&&f!==null&&r.indexOf(f)===-1&&(e.push({obj:i,prop:c}),r.push(f))}return a(e),t},d=function t(t){return Object.prototype.toString.call(t)==="[object RegExp]"},h=function t(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},m=function t(t,e){return[].concat(t,e)},b=function t(t,e){if(o(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)};e.exports={arrayToObject:u,assign:c,combine:m,compact:y,decode:f,encode:p,isBuffer:h,isRegExp:d,maybeMap:b,merge:s}});var F=c(function(t,e){"use strict";var r=I(),n=R(),o=T(),a=Object.prototype.hasOwnProperty,u={brackets:function t(t){return t+"[]"},comma:"comma",indices:function t(t,e){return t+"["+e+"]"},repeat:function t(t){return t}},s=Array.isArray,c=Array.prototype.push,f=function t(t,e){c.apply(t,s(e)?e:[e])},p=Date.prototype.toISOString,y=o.default,d={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,format:y,formatter:o.formatters[y],indices:!1,serializeDate:function t(t){return p.call(t)},skipNulls:!1,strictNullHandling:!1},h=function t(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||(typeof t==="undefined"?"undefined":l(t))=="symbol"||(typeof t==="undefined"?"undefined":l(t))=="bigint"},m=function t(e,o,a,u,c,p,y,m,b,v,g,w,A,O,j){var S=e;if(j.has(e))throw new RangeError("Cyclic object value");if(typeof y=="function"?S=y(o,S):i(S,Date)?S=v(S):a==="comma"&&s(S)&&(S=n.maybeMap(S,function(t){return i(t,Date)?v(t):t})),S===null){if(u)return p&&!A?p(o,d.encoder,O,"key",g):o;S=""}if(h(S)||n.isBuffer(S)){if(p){var P=A?o:p(o,d.encoder,O,"key",g);return[w(P)+"="+w(p(S,d.encoder,O,"value",g))]}return[w(o)+"="+w(String(S))]}var E=[];if((typeof S==="undefined"?"undefined":l(S))>"u")return E;var x;if(a==="comma"&&s(S))x=[{value:S.length>0?S.join(",")||null:void 0}];else if(s(y))x=y;else{var _=Object.keys(S);x=m?_.sort(m):_}for(var I=0;I<x.length;++I){var T=x[I],R=typeof T=="object"&&T.value!==void 0?T.value:S[T];if(!(c&&R===null)){var F=s(S)?typeof a=="function"?a(o,T):o:o+(b?"."+T:"["+T+"]");j.set(e,!0);var D=r();f(E,t(R,F,a,u,c,p,y,m,b,v,g,w,A,O,D))}}return E},b=function t(t){if(!t)return d;if(t.encoder!==null&&t.encoder!==void 0&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||d.charset;if(l(t.charset)<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=o.default;if(l(t.format)<"u"){if(!a.call(o.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=o.formatters[r],i=d.filter;return(typeof t.filter=="function"||s(t.filter))&&(i=t.filter),{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:d.addQueryPrefix,allowDots:l(t.allowDots)>"u"?d.allowDots:!!t.allowDots,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:d.charsetSentinel,delimiter:l(t.delimiter)>"u"?d.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:d.encode,encoder:typeof t.encoder=="function"?t.encoder:d.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:d.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:d.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:d.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:d.strictNullHandling}};e.exports=function(t,e){var n=t,o=b(e),i,a;typeof o.filter=="function"?(a=o.filter,n=a("",n)):s(o.filter)&&(a=o.filter,i=a);var c=[];if(typeof n!="object"||n===null)return"";var p;e&&e.arrayFormat in u?p=e.arrayFormat:e&&"indices"in e?p=e.indices?"indices":"repeat":p="indices";var l=u[p];i||(i=Object.keys(n)),o.sort&&i.sort(o.sort);for(var y=r(),d=0;d<i.length;++d){var h=i[d];o.skipNulls&&n[h]===null||f(c,m(n[h],h,l,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset,y))}var v=c.join(o.delimiter),g=o.addQueryPrefix===!0?"?":"";return o.charsetSentinel&&(o.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),v.length>0?g+v:""}});var D=c(function(t,e){"use strict";var r=R(),n=Object.prototype.hasOwnProperty,o=Array.isArray,i={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function t(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},u=function t(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},s="utf8=%26%2310003%3B",c="utf8=%E2%9C%93",f=function t(t,e){var f={},p=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,l=e.parameterLimit===1/0?void 0:e.parameterLimit,y=p.split(e.delimiter,l),d=-1,h,m=e.charset;if(e.charsetSentinel)for(h=0;h<y.length;++h)y[h].indexOf("utf8=")===0&&(y[h]===c?m="utf-8":y[h]===s&&(m="iso-8859-1"),d=h,h=y.length);for(h=0;h<y.length;++h)if(h!==d){var b=y[h],v=b.indexOf("]="),g=v===-1?b.indexOf("="):v+1,w,A;g===-1?(w=e.decoder(b,i.decoder,m,"key"),A=e.strictNullHandling?null:""):(w=e.decoder(b.slice(0,g),i.decoder,m,"key"),A=r.maybeMap(u(b.slice(g+1),e),function(t){return e.decoder(t,i.decoder,m,"value")})),A&&e.interpretNumericEntities&&m==="iso-8859-1"&&(A=a(A)),b.indexOf("[]=")>-1&&(A=o(A)?[A]:A),n.call(f,w)?f[w]=r.combine(f[w],A):f[w]=A}return f},p=function t(t,e,r,n){for(var o=n?e:u(e,r),i=t.length-1;i>=0;--i){var a,s=t[i];if(s==="[]"&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var c=s.charAt(0)==="["&&s.charAt(s.length-1)==="]"?s.slice(1,-1):s,f=parseInt(c,10);!r.parseArrays&&c===""?a={0:o}:!isNaN(f)&&s!==c&&String(f)===c&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(a=[],a[f]=o):a[c]=o}o=a}return o},y=function t(t,e,r,o){if(t){var i=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,u=/(\[[^[\]]*])/g,s=r.depth>0&&a.exec(i),c=s?i.slice(0,s.index):i,f=[];if(c){if(!r.plainObjects&&n.call(Object.prototype,c)&&!r.allowPrototypes)return;f.push(c)}for(var l=0;r.depth>0&&(s=u.exec(i))!==null&&l<r.depth;){if(l+=1,!r.plainObjects&&n.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;f.push(s[1])}return s&&f.push("["+i.slice(s.index)+"]"),p(f,e,r,o)}},d=function t(t){if(!t)return i;if(t.decoder!==null&&t.decoder!==void 0&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(l(t.charset)<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=l(t.charset)>"u"?i.charset:t.charset;return{allowDots:l(t.allowDots)>"u"?i.allowDots:!!t.allowDots,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:i.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:i.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:i.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:i.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:i.comma,decoder:typeof t.decoder=="function"?t.decoder:i.decoder,delimiter:typeof t.delimiter=="string"||r.isRegExp(t.delimiter)?t.delimiter:i.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:i.depth,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:i.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:i.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:i.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:i.strictNullHandling}};e.exports=function(t,e){var n=d(e);if(t===""||t===null||(typeof t==="undefined"?"undefined":l(t))>"u")return n.plainObjects?Object.create(null):{};for(var o=typeof t=="string"?f(t,n):t,i=n.plainObjects?Object.create(null):{},a=Object.keys(o),u=0;u<a.length;++u){var s=a[u],c=y(s,o[s],n,typeof t=="string");i=r.merge(i,c,n)}return n.allowSparse===!0?i:r.compact(i)}});var k=c(function(t,e){"use strict";var r=F(),n=D(),o=T();e.exports={formats:o,parse:n,stringify:r}});var B=c(function(t,e){"use strict";var r=(typeof self==="undefined"?"undefined":l(self))<"u"?self:t,n=function(){var t=function t(){this.fetch=!1,this.DOMException=r.DOMException};return t.prototype=r,new t}();(function(t){var e=function(e){var r=function t(t){return t&&DataView.prototype.isPrototypeOf(t)};var n=function t(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()};var o=function t(t){return typeof t!="string"&&(t=String(t)),t};var a=function t(t){var e={next:function e(){var e=t.shift();return{done:e===void 0,value:e}}};return w.iterable&&(e[Symbol.iterator]=function(){return e}),e};var u=function t(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0};var s=function t(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})};var c=function t(t){var e=new FileReader,r=s(e);return e.readAsArrayBuffer(t),r};var f=function t(t){var e=new FileReader,r=s(e);return e.readAsText(t),r};var p=function t(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")};var y=function t(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer};var d=function t(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:w.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:w.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:w.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():w.arrayBuffer&&w.blob&&r(t)?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):w.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||O(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):w.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},w.blob&&(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(c)}),this.text=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return f(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(p(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},w.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this};var h=function t(t){var e=t.toUpperCase();return S.indexOf(e)>-1?e:t};var m=function t(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e};var b=function t(t){var e=new j,r=t.replace(/\r?\n[\t ]+/g," ");return r.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e};var v=function t(t,e){e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new j(e.headers),this.url=e.url||"",this._initBody(t)};var g=function t(t,r){return new Promise(function(n,o){var i=new P(t,r);if(i.signal&&i.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t={status:a.status,statusText:a.statusText,headers:b(a.getAllResponseHeaders()||"")};t.url="responseURL"in a?a.responseURL:t.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;n(new v(e,t))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(i.method,i.url,!0),i.credentials==="include"?a.withCredentials=!0:i.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&w.blob&&(a.responseType="blob"),i.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),i.signal&&(i.signal.addEventListener("abort",u),a.onreadystatechange=function(){a.readyState===4&&i.signal.removeEventListener("abort",u)}),a.send(l(i._bodyInit)>"u"?null:i._bodyInit)})};var w={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(w.arrayBuffer)var A=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],O=ArrayBuffer.isView||function(t){return t&&A.indexOf(Object.prototype.toString.call(t))>-1};function j(t){this.map={},i(t,j)?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}j.prototype.append=function(t,e){t=n(t),e=o(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},j.prototype.delete=function(t){delete this.map[n(t)]},j.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},j.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},j.prototype.set=function(t,e){this.map[n(t)]=o(e)},j.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},j.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),a(t)},j.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),a(t)},j.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),a(t)},w.iterable&&(j.prototype[Symbol.iterator]=j.prototype.entries);var S=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function P(t,e){e=e||{};var r=e.body;if(i(t,P)){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new j(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new j(e.headers)),this.method=h(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};d.call(P.prototype);d.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new j(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];v.redirect=function(t,e){if(E.indexOf(e)===-1)throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}return g.polyfill=!0,t.fetch||(t.fetch=g,t.Headers=j,t.Request=P,t.Response=v),e.Headers=j,e.Request=P,e.Response=v,e.fetch=g,Object.defineProperty(e,"__esModule",{value:!0}),e}({})})(n);n.fetch.ponyfill=!0;delete n.fetch.polyfill;var o=n;t=o.fetch;t.default=o.fetch;t.fetch=o.fetch;t.Headers=o.Headers;t.Request=o.Request;t.Response=o.Response;e.exports=t});var U=c(function(t,e){"use strict";var r=function t(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))};e.exports=r;r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};r.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};r.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};r.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};r.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};r.prototype.start=r.prototype.try;r.prototype.errors=function(){return this._errors};r.prototype.attempts=function(){return this._attempts};r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var M=c(function(t){"use strict";var e=U();t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};t.timeouts=function(t){if(i(t,Array))return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(t,e){return t-e}),n};t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};t.wrap=function(e,r,n){if(i(r,Array)&&(n=r,r=null),!n){n=[];for(var o in e)typeof e[o]=="function"&&n.push(o)}for(var a=0;a<n.length;a++){var u=n[a],s=e[u];e[u]=(function(n){var o=t.operation(r),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push(function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),a.apply(this,arguments))}),o.attempt(function(){n.apply(e,i)})}).bind(e,s),e[u].options=r}}});var N=c(function(t,e){"use strict";e.exports=M()});var C=c(function(t,e){"use strict";var r=function t(t,e){function r(r,o){var i=e||{},a;"randomize"in i||(i.randomize=!0),a=n.operation(i);function u(t){o(t||new Error("Aborted"))}function s(t,e){if(t.bail){u(t);return}a.retry(t)?i.onRetry&&i.onRetry(t,e):o(a.mainError())}function c(e){var n;try{n=t(u,e)}catch(t){s(t,e);return}Promise.resolve(n).then(r).catch(function(t){s(t,e)})}a.attempt(c)}return new Promise(r)};var n=N();e.exports=r});var q={};y(q,{createClient:function(){return Y}});var L=m(k());var W=function(t){return t!==null&&typeof t=="object"},H=function(t){return typeof t=="string"};var G=function(t){if(!W(t))throw new Error("queries is not object");return L.default.stringify(t,{arrayFormat:"comma"})};var z="microcms.io",V="v1";var J=m(B()),Q=function(t){var e;return t?e=t:(typeof fetch==="undefined"?"undefined":l(fetch))>"u"?e=J.default:e=fetch,function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++){r[n]=arguments[n]}return e.apply(void 0,p(r))}},$=function(){return(typeof Headers==="undefined"?"undefined":l(Headers))>"u"?J.Headers:Headers},K=function(t,e){var r=Q(e),o=$();return function(){var e=n(function(e,n){var i,a;return d(this,function(u){a=new o((i=n)===null||i===void 0?void 0:i.headers);return[2,(a.has("X-MICROCMS-API-KEY")||a.set("X-MICROCMS-API-KEY",t),r(e,f(s({},n),{headers:a})))]})});return function(t,r){return e.apply(this,arguments)}}()};var X=m(C()),Y=function(t){var e=t.serviceDomain,r=t.apiKey,o=t.customFetch,i=t.retry;if(!e||!r)throw new Error("parameter is required (check serviceDomain and apiKey)");if(!H(e)||!H(r))throw new Error("parameter is not string");var a="https://".concat(e,".").concat(z,"/api/").concat(V),u=function(){var t=n(function(t){var e,u,c,p,l,y,h,m,b;return d(this,function(v){switch(v.label){case 0:e=t.endpoint,u=t.contentId,c=t.queries,p=c===void 0?{}:c,l=t.requestInit;y=K(r,o),h=G(p),m="".concat(a,"/").concat(e).concat(u?"/".concat(u):"").concat(h?"?".concat(h):""),b=function(){var t=n(function(t){var e,r,n;return d(this,function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t.json()];case 1:e=o.sent(),r=e.message;return[2,r!==null&&r!==void 0?r:null];case 2:n=o.sent();return[2,null];case 3:return[2]}})});return function e(e){return t.apply(this,arguments)}}();return[4,(0,X.default)(function(){var t=n(function(t){var e,r,n,o,i,a,u,c;return d(this,function(p){switch(p.label){case 0:p.trys.push([0,6,,7]);return[4,y(m,f(s({},l),{method:(n=(e=l)===null||e===void 0?void 0:e.method)!==null&&n!==void 0?n:"GET"}))];case 1:o=p.sent();if(!(o.status!==429&&o.status>=400&&o.status<500))return[3,3];return[4,b(o)];case 2:i=p.sent();return[2,t(new Error("fetch API response status: ".concat(o.status).concat(i?"\n message is `".concat(i,"`"):"")))];case 3:if(!!o.ok)return[3,5];return[4,b(o)];case 4:a=p.sent();return[2,Promise.reject(new Error("fetch API response status: ".concat(o.status).concat(a?"\n message is `".concat(a,"`"):"")))];case 5:return[2,((r=l)===null||r===void 0?void 0:r.method)==="DELETE"?void 0:o.json()];case 6:u=p.sent();if(u.data)throw u.data;if((c=u.response)===null||c===void 0?void 0:c.data)throw u.response.data;return[2,Promise.reject(new Error("Network Error.\n Details: ".concat(u)))];case 7:return[2]}})});return function(e){return t.apply(this,arguments)}}(),{retries:i?2:0,onRetry:function(t,e){console.log(t),console.log("Waiting for retry (".concat(e,"/",2,")"))},minTimeout:5e3})];case 1:return[2,v.sent()]}})});return function e(e){return t.apply(this,arguments)}}();return{get:function(){var t=n(function(t){var e,r,n,o,i,a;return d(this,function(s){switch(s.label){case 0:e=t.endpoint,r=t.contentId,n=t.queries,o=n===void 0?{}:n,i=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,contentId:r,queries:o,requestInit:i})];case 1:a=s.sent();return[3,3];case 2:a=Promise.reject(new Error("endpoint is required"));s.label=3;case 3:return[2,a]}})});return function(e){return t.apply(this,arguments)}}(),getList:function(){var t=n(function(t){var e,r,n,o,i;return d(this,function(a){switch(a.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,o=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,queries:n,requestInit:o})];case 1:i=a.sent();return[3,3];case 2:i=Promise.reject(new Error("endpoint is required"));a.label=3;case 3:return[2,i]}})});return function(e){return t.apply(this,arguments)}}(),getListDetail:function(){var t=n(function(t){var e,r,n,o,i,a;return d(this,function(s){switch(s.label){case 0:e=t.endpoint,r=t.contentId,n=t.queries,o=n===void 0?{}:n,i=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,contentId:r,queries:o,requestInit:i})];case 1:a=s.sent();return[3,3];case 2:a=Promise.reject(new Error("endpoint is required"));s.label=3;case 3:return[2,a]}})});return function(e){return t.apply(this,arguments)}}(),getObject:function(){var t=n(function(t){var e,r,n,o,i;return d(this,function(a){switch(a.label){case 0:e=t.endpoint,r=t.queries,n=r===void 0?{}:r,o=t.customRequestInit;if(!e)return[3,2];return[4,u({endpoint:e,queries:n,requestInit:o})];case 1:i=a.sent();return[3,3];case 2:i=Promise.reject(new Error("endpoint is required"));a.label=3;case 3:return[2,i]}})});return function(e){return t.apply(this,arguments)}}(),getAllContentIds:function(){var t=n(function(t){var e,r,n,o,i,a,c,l,y,h,m,b,v,g,w,A,O;return d(this,function(d){switch(d.label){case 0:e=t.endpoint,r=t.alternateField,n=t.draftKey,o=t.filters,i=t.orders,a=t.customRequestInit;c={draftKey:n,filters:o,orders:i,limit:100,fields:r!==null&&r!==void 0?r:"id",depth:0};return[4,u({endpoint:e,queries:f(s({},c),{limit:0}),requestInit:a})];case 1:l=d.sent(),y=l.totalCount,h=[],m=0,b=function(t){return new Promise(function(e){return setTimeout(e,t)})},v=function(t){return t.every(function(t){return typeof t=="string"})};d.label=2;case 2:if(!(h.length<y))return[3,7];return[4,u({endpoint:e,queries:f(s({},c),{offset:m}),requestInit:a})];case 3:g=d.sent(),w=g.contents,A=w.map(function(t){return t[r!==null&&r!==void 0?r:"id"]});if(!v(A))throw new Error("The value of the field specified by `alternateField` is not a string.");h=p(h).concat(p(A)),m+=100;O=h.length<y;if(!O)return[3,5];return[4,b(1e3)];case 4:O=d.sent();d.label=5;case 5:O;d.label=6;case 6:return[3,2];case 7:return[2,h]}})});return function(e){return t.apply(this,arguments)}}(),create:function(){var t=n(function(t){var e,r,n,o,i,a,c,p;return d(this,function(l){e=t.endpoint,r=t.contentId,n=t.content,o=t.isDraft,i=o===void 0?!1:o,a=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];c=i?{status:"draft"}:{},p=f(s({},a),{method:r?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,u({endpoint:e,contentId:r,queries:c,requestInit:p})]})});return function(e){return t.apply(this,arguments)}}(),update:function(){var t=n(function(t){var e,r,n,o,i;return d(this,function(a){e=t.endpoint,r=t.contentId,n=t.content,o=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];i=f(s({},o),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return[2,u({endpoint:e,contentId:r,requestInit:i})]})});return function(e){return t.apply(this,arguments)}}(),delete:function(){var t=n(function(t){var e,r,n,o;return d(this,function(i){switch(i.label){case 0:e=t.endpoint,r=t.contentId,n=t.customRequestInit;if(!e)return[2,Promise.reject(new Error("endpoint is required"))];if(!r)return[2,Promise.reject(new Error("contentId is required"))];o=f(s({},n),{method:"DELETE",headers:{},body:void 0});return[4,u({endpoint:e,contentId:r,requestInit:o})];case 1:i.sent();return[2]}})});return function(e){return t.apply(this,arguments)}}()}};return b(q)}();//# sourceMappingURL=microcms-js-sdk.js.map
|