@sanity/client 6.2.0-fetch.6 → 6.2.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/dist/index.browser.cjs +7 -9
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +7 -9
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +8 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +93 -93
- package/dist/index.js +8 -10
- package/dist/index.js.map +1 -1
- package/package.json +23 -19
- package/src/SanityClient.ts +83 -83
- package/src/assets/AssetsClient.ts +13 -13
- package/src/config.ts +3 -4
- package/src/data/dataMethods.ts +20 -21
- package/src/data/listen.ts +3 -3
- package/src/data/patch.ts +11 -11
- package/src/data/transaction.ts +13 -13
- package/src/datasets/DatasetsClient.ts +4 -4
- package/src/http/request.ts +1 -1
- package/src/http/requestOptions.ts +1 -1
- package/src/index.browser.ts +1 -1
- package/src/index.ts +1 -1
- package/src/projects/ProjectsClient.ts +2 -2
- package/src/users/UsersClient.ts +4 -4
- package/src/validators.ts +2 -2
- package/src/warnings.ts +1 -1
- package/umd/sanityClient.js +51 -20
- package/umd/sanityClient.min.js +3 -3
package/src/warnings.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const printCdnWarning = createWarningPrinter([
|
|
|
15
15
|
export const printBrowserTokenWarning = createWarningPrinter([
|
|
16
16
|
'You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.',
|
|
17
17
|
`See ${generateHelpUrl(
|
|
18
|
-
'js-client-browser-token'
|
|
18
|
+
'js-client-browser-token',
|
|
19
19
|
)} for more information and how to hide this warning.`,
|
|
20
20
|
])
|
|
21
21
|
|
package/umd/sanityClient.js
CHANGED
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
const validUrl = /^https?:\/\//i;
|
|
54
54
|
const validateOptions = function validateOptions2(options) {
|
|
55
55
|
if (!validUrl.test(options.url)) {
|
|
56
|
-
throw new Error("
|
|
56
|
+
throw new Error('"'.concat(options.url, '" is not a valid URL'));
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -143,9 +143,7 @@
|
|
|
143
143
|
}, {
|
|
144
144
|
processOptions: [processOptions],
|
|
145
145
|
validateOptions: [validateOptions]
|
|
146
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
147
146
|
});
|
|
148
|
-
|
|
149
147
|
function request(opts) {
|
|
150
148
|
const onResponse = (reqErr, res, ctx) => {
|
|
151
149
|
let error = reqErr;
|
|
@@ -215,6 +213,17 @@
|
|
|
215
213
|
initMiddleware.forEach(request.use);
|
|
216
214
|
return request;
|
|
217
215
|
}
|
|
216
|
+
var __defProp$5 = Object.defineProperty;
|
|
217
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
configurable: true,
|
|
220
|
+
writable: true,
|
|
221
|
+
value
|
|
222
|
+
}) : obj[key] = value;
|
|
223
|
+
var __publicField$5 = (obj, key, value) => {
|
|
224
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
225
|
+
return value;
|
|
226
|
+
};
|
|
218
227
|
var __accessCheck$7 = (obj, member, msg) => {
|
|
219
228
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
220
229
|
};
|
|
@@ -234,11 +243,23 @@
|
|
|
234
243
|
var _method, _url, _resHeaders, _headers, _controller, _init;
|
|
235
244
|
class FetchXhr {
|
|
236
245
|
constructor() {
|
|
246
|
+
/**
|
|
247
|
+
* Public interface, interop with real XMLHttpRequest
|
|
248
|
+
*/
|
|
249
|
+
__publicField$5(this, "onabort");
|
|
250
|
+
__publicField$5(this, "onerror");
|
|
251
|
+
__publicField$5(this, "onreadystatechange");
|
|
252
|
+
__publicField$5(this, "ontimeout");
|
|
237
253
|
/**
|
|
238
254
|
* https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState
|
|
239
255
|
*/
|
|
240
|
-
this
|
|
241
|
-
this
|
|
256
|
+
__publicField$5(this, "readyState", 0);
|
|
257
|
+
__publicField$5(this, "response");
|
|
258
|
+
__publicField$5(this, "responseText");
|
|
259
|
+
__publicField$5(this, "responseType", "");
|
|
260
|
+
__publicField$5(this, "status");
|
|
261
|
+
__publicField$5(this, "statusText");
|
|
262
|
+
__publicField$5(this, "withCredentials");
|
|
242
263
|
/**
|
|
243
264
|
* Private implementation details
|
|
244
265
|
*/
|
|
@@ -1333,17 +1354,31 @@
|
|
|
1333
1354
|
}
|
|
1334
1355
|
};
|
|
1335
1356
|
}
|
|
1357
|
+
var __defProp$4 = Object.defineProperty;
|
|
1358
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, {
|
|
1359
|
+
enumerable: true,
|
|
1360
|
+
configurable: true,
|
|
1361
|
+
writable: true,
|
|
1362
|
+
value
|
|
1363
|
+
}) : obj[key] = value;
|
|
1364
|
+
var __publicField$4 = (obj, key, value) => {
|
|
1365
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1366
|
+
return value;
|
|
1367
|
+
};
|
|
1336
1368
|
class Cancel {
|
|
1337
1369
|
constructor(message) {
|
|
1338
|
-
this
|
|
1370
|
+
__publicField$4(this, "__CANCEL__", true);
|
|
1371
|
+
__publicField$4(this, "message");
|
|
1339
1372
|
this.message = message;
|
|
1340
1373
|
}
|
|
1341
1374
|
toString() {
|
|
1342
1375
|
return "Cancel".concat(this.message ? ": ".concat(this.message) : "");
|
|
1343
1376
|
}
|
|
1344
1377
|
}
|
|
1345
|
-
const _CancelToken = class {
|
|
1378
|
+
const _CancelToken = class _CancelToken {
|
|
1346
1379
|
constructor(executor) {
|
|
1380
|
+
__publicField$4(this, "promise");
|
|
1381
|
+
__publicField$4(this, "reason");
|
|
1347
1382
|
if (typeof executor !== "function") {
|
|
1348
1383
|
throw new TypeError("executor must be a function.");
|
|
1349
1384
|
}
|
|
@@ -1360,18 +1395,16 @@
|
|
|
1360
1395
|
});
|
|
1361
1396
|
}
|
|
1362
1397
|
};
|
|
1363
|
-
|
|
1364
|
-
CancelToken.source = () => {
|
|
1398
|
+
__publicField$4(_CancelToken, "source", () => {
|
|
1365
1399
|
let cancel;
|
|
1366
1400
|
const token = new _CancelToken(can => {
|
|
1367
1401
|
cancel = can;
|
|
1368
1402
|
});
|
|
1369
1403
|
return {
|
|
1370
1404
|
token,
|
|
1371
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know from the implementation that it's assigned during `constructor`
|
|
1372
1405
|
cancel
|
|
1373
1406
|
};
|
|
1374
|
-
};
|
|
1407
|
+
});
|
|
1375
1408
|
var defaultShouldRetry = (err, attempt, options) => {
|
|
1376
1409
|
if (options.method !== "GET" && options.method !== "HEAD") {
|
|
1377
1410
|
return false;
|
|
@@ -2304,26 +2337,26 @@
|
|
|
2304
2337
|
};
|
|
2305
2338
|
const validateDocumentId = (op, id) => {
|
|
2306
2339
|
if (typeof id !== "string" || !/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(id) || id.includes("..")) {
|
|
2307
|
-
throw new Error("".concat(op,
|
|
2340
|
+
throw new Error("".concat(op, '(): "').concat(id, '" is not a valid document ID'));
|
|
2308
2341
|
}
|
|
2309
2342
|
};
|
|
2310
2343
|
const requireDocumentId = (op, doc) => {
|
|
2311
2344
|
if (!doc._id) {
|
|
2312
|
-
throw new Error("".concat(op,
|
|
2345
|
+
throw new Error("".concat(op, '() requires that the document contains an ID ("_id" property)'));
|
|
2313
2346
|
}
|
|
2314
2347
|
validateDocumentId(op, doc._id);
|
|
2315
2348
|
};
|
|
2316
2349
|
const validateInsert = (at, selector, items) => {
|
|
2317
2350
|
const signature = "insert(at, selector, items)";
|
|
2318
2351
|
if (VALID_INSERT_LOCATIONS.indexOf(at) === -1) {
|
|
2319
|
-
const valid = VALID_INSERT_LOCATIONS.map(loc => "
|
|
2320
|
-
throw new Error("".concat(signature,
|
|
2352
|
+
const valid = VALID_INSERT_LOCATIONS.map(loc => '"'.concat(loc, '"')).join(", ");
|
|
2353
|
+
throw new Error("".concat(signature, ' takes an "at"-argument which is one of: ').concat(valid));
|
|
2321
2354
|
}
|
|
2322
2355
|
if (typeof selector !== "string") {
|
|
2323
|
-
throw new Error("".concat(signature,
|
|
2356
|
+
throw new Error("".concat(signature, ' takes a "selector"-argument which must be a string'));
|
|
2324
2357
|
}
|
|
2325
2358
|
if (!Array.isArray(items)) {
|
|
2326
|
-
throw new Error("".concat(signature,
|
|
2359
|
+
throw new Error("".concat(signature, ' takes an "items"-argument which must be an array'));
|
|
2327
2360
|
}
|
|
2328
2361
|
};
|
|
2329
2362
|
const hasDataset = config => {
|
|
@@ -3008,9 +3041,7 @@
|
|
|
3008
3041
|
const reqOptions = requestOptions(config, Object.assign({}, options, {
|
|
3009
3042
|
url: _getUrl(client, uri, useCdn)
|
|
3010
3043
|
}));
|
|
3011
|
-
const request = new Observable(subscriber =>
|
|
3012
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the typings thinks it's optional because it's not required to specify it when calling createClient, but it's always defined in practice since SanityClient provides a default
|
|
3013
|
-
httpRequest(reqOptions, config.requester).subscribe(subscriber));
|
|
3044
|
+
const request = new Observable(subscriber => httpRequest(reqOptions, config.requester).subscribe(subscriber));
|
|
3014
3045
|
return options.signal ? request.pipe(_withAbortSignal(options.signal)) : request;
|
|
3015
3046
|
}
|
|
3016
3047
|
function _request(client, httpRequest, options) {
|
package/umd/sanityClient.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";const t={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4},r=function(e){const r={...t,..."string"==typeof e?{url:e}:e},o=new URL(r.url,"http://localhost");if(r.timeout=n(r.timeout),r.query)for(const[e,t]of Object.entries(r.query))if(void 0!==t)if(Array.isArray(t))for(const r of t)o.searchParams.append(e,r);else o.searchParams.append(e,t);return r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r.url="http://localhost"===o.origin?"".concat(o.pathname,"?").concat(o.searchParams):o.toString(),r};function n(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const r=Number(e);return isNaN(r)?n(t.timeout):{connect:r,socket:r}}const o=/^https?:\/\//i,s=function(e){if(!o.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=a((function(e){if(!e)return{};for(var t,r={},n=c(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=c(s.slice(0,i)).toLowerCase(),u=c(s.slice(i+1));void 0===r[a]?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r}));const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(e,t){const n=[],o=h.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s]});function i(e){const r=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const r in e)e[r](t)},subscribe:function(r){const n=t++;return e[n]=r,function(){delete e[n]}}}}(),e)),{}),n=(e=>function(t,r){const n="onError"===t;let o=r;for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(let r=0;r<e[t].length&&(o=(0,e[t][r])(o,...i),!n||o);r++);return o})(o),s=n("processOptions",e);n("validateOptions",s);const i={options:s,channels:r,applyMiddleware:n};let a;const c=r.request.subscribe((e=>{a=t(e,((t,o)=>((e,t,o)=>{let s=e,i=t;if(!s)try{i=n("onResponse",t,o)}catch(e){i=null,s=e}s=s&&n("onError",s,o),s?r.error.publish(s):i&&r.response.publish(i)})(t,o,e)))}));r.abort.subscribe((()=>{c(),a&&a.abort()}));const u=n("onReturn",r,i);return u===r&&r.request.publish(i),u}return i.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return h.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),i},i.clone=()=>d(n,t),e.forEach(i.use),i}var p,f,y,g,m,v,b=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},w=(e,t,r)=>(b(e,t,"read from private field"),r?r.call(e):t.get(e)),C=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},E=(e,t,r,n)=>(b(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class x{constructor(){this.readyState=0,this.responseType="",C(this,p,void 0),C(this,f,void 0),C(this,y,void 0),C(this,g,{}),C(this,m,void 0),C(this,v,{})}open(e,t,r){E(this,p,e),E(this,f,t),E(this,y,""),this.readyState=1,this.onreadystatechange(),E(this,m,void 0)}abort(){w(this,m)&&w(this,m).abort()}getAllResponseHeaders(){return w(this,y)}setRequestHeader(e,t){w(this,g)[e]=t}setInit(e){E(this,v,e)}send(e){const t="arraybuffer"!==this.responseType,r={...w(this,v),method:w(this,p),headers:w(this,g),body:e};"function"==typeof AbortController&&(E(this,m,new AbortController),"undefined"!=typeof EventTarget&&w(this,m).signal instanceof EventTarget&&(r.signal=w(this,m).signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(w(this,f),r).then((e=>(e.headers.forEach(((e,t)=>{E(this,y,w(this,y)+"".concat(t,": ").concat(e,"\r\n"))})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}p=new WeakMap,f=new WeakMap,y=new WeakMap,g=new WeakMap,m=new WeakMap,v=new WeakMap;const T="function"==typeof XMLHttpRequest?"xhr":"fetch",O="xhr"===T?XMLHttpRequest:x,_=(e,t)=>{const r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},s=e.applyMiddleware("interceptRequest",void 0,{adapter:T,context:e});if(s){const e=setTimeout(t,0,null,s);return{abort:()=>clearTimeout(e)}}let i=new O;i instanceof x&&"object"==typeof n.fetch&&i.setInit(n.fetch);const a=n.headers,c=n.timeout;let l=!1,h=!1,d=!1;if(i.onerror=e=>{y(new Error("Request error while attempting to reach ".concat(n.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},i.ontimeout=e=>{y(new Error("Request timeout while attempting to reach ".concat(n.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},i.onabort=()=>{f(!0),l=!0},i.onreadystatechange=()=>{!function(){if(!c)return;f(),o.socket=setTimeout((()=>p("ESOCKETTIMEDOUT")),c.socket)}(),l||4!==i.readyState||0!==i.status&&function(){if(l||h||d)return;if(0===i.status)return void y(new Error("Unknown XHR error"));f(),h=!0,t(null,{body:i.response||(""===i.responseType||"text"===i.responseType?i.responseText:""),url:n.url,method:n.method,headers:u(i.getAllResponseHeaders()),statusCode:i.status,statusMessage:i.statusText})}()},i.open(n.method,n.url,!0),i.withCredentials=!!n.withCredentials,a&&i.setRequestHeader)for(const e in a)a.hasOwnProperty(e)&&i.setRequestHeader(e,a[e]);return n.rawBody&&(i.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:T,request:i,context:e}),i.send(n.body||null),c&&(o.connect=setTimeout((()=>p("ETIMEDOUT")),c.connect)),{abort:function(){l=!0,i&&i.abort()}};function p(t){d=!0,i.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(n.url):"Connection timed out on request to ".concat(n.url));r.code=t,e.channels.error.publish(r)}function f(e){(e||l||i.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function y(e){if(h)return;f(!0),h=!0,i=null;const r=e||new Error("Network error while attempting to reach ".concat(n.url));r.isNetworkError=!0,r.request=n,t(r)}};var j,S,A={exports:{}};function k(){if(S)return j;S=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,s=365.25*n;function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return j=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var s=Math.abs(o);if(s>=n)return i(o,s,n,"day");if(s>=r)return i(o,s,r,"hour");if(s>=t)return i(o,s,t,"minute");if(s>=e)return i(o,s,e,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=n)return Math.round(o/n)+"d";if(s>=r)return Math.round(o/r)+"h";if(s>=t)return Math.round(o/t)+"m";if(s>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var R=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=k(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";const t={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4},r=function(e){const r={...t,..."string"==typeof e?{url:e}:e},o=new URL(r.url,"http://localhost");if(r.timeout=n(r.timeout),r.query)for(const[e,t]of Object.entries(r.query))if(void 0!==t)if(Array.isArray(t))for(const r of t)o.searchParams.append(e,r);else o.searchParams.append(e,t);return r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r.url="http://localhost"===o.origin?"".concat(o.pathname,"?").concat(o.searchParams):o.toString(),r};function n(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const r=Number(e);return isNaN(r)?n(t.timeout):{connect:r,socket:r}}const o=/^https?:\/\//i,s=function(e){if(!o.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=a((function(e){if(!e)return{};for(var t,r={},n=c(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=c(s.slice(0,i)).toLowerCase(),u=c(s.slice(i+1));void 0===r[a]?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r}));const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(e,t){const n=[],o=h.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s]});function i(e){const r=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const r in e)e[r](t)},subscribe:function(r){const n=t++;return e[n]=r,function(){delete e[n]}}}}(),e)),{}),n=(e=>function(t,r){const n="onError"===t;let o=r;for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(let r=0;r<e[t].length&&(o=(0,e[t][r])(o,...i),!n||o);r++);return o})(o),s=n("processOptions",e);n("validateOptions",s);const i={options:s,channels:r,applyMiddleware:n};let a;const c=r.request.subscribe((e=>{a=t(e,((t,o)=>((e,t,o)=>{let s=e,i=t;if(!s)try{i=n("onResponse",t,o)}catch(e){i=null,s=e}s=s&&n("onError",s,o),s?r.error.publish(s):i&&r.response.publish(i)})(t,o,e)))}));r.abort.subscribe((()=>{c(),a&&a.abort()}));const u=n("onReturn",r,i);return u===r&&r.request.publish(i),u}return i.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return h.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),i},i.clone=()=>d(n,t),e.forEach(i.use),i}var p,f,y,m,g,v,b=Object.defineProperty,w=(e,t,r)=>(((e,t,r)=>{t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),C=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},E=(e,t,r)=>(C(e,t,"read from private field"),r?r.call(e):t.get(e)),x=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},T=(e,t,r,n)=>(C(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class O{constructor(){w(this,"onabort"),w(this,"onerror"),w(this,"onreadystatechange"),w(this,"ontimeout"),w(this,"readyState",0),w(this,"response"),w(this,"responseText"),w(this,"responseType",""),w(this,"status"),w(this,"statusText"),w(this,"withCredentials"),x(this,p,void 0),x(this,f,void 0),x(this,y,void 0),x(this,m,{}),x(this,g,void 0),x(this,v,{})}open(e,t,r){T(this,p,e),T(this,f,t),T(this,y,""),this.readyState=1,this.onreadystatechange(),T(this,g,void 0)}abort(){E(this,g)&&E(this,g).abort()}getAllResponseHeaders(){return E(this,y)}setRequestHeader(e,t){E(this,m)[e]=t}setInit(e){T(this,v,e)}send(e){const t="arraybuffer"!==this.responseType,r={...E(this,v),method:E(this,p),headers:E(this,m),body:e};"function"==typeof AbortController&&(T(this,g,new AbortController),"undefined"!=typeof EventTarget&&E(this,g).signal instanceof EventTarget&&(r.signal=E(this,g).signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(E(this,f),r).then((e=>(e.headers.forEach(((e,t)=>{T(this,y,E(this,y)+"".concat(t,": ").concat(e,"\r\n"))})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}p=new WeakMap,f=new WeakMap,y=new WeakMap,m=new WeakMap,g=new WeakMap,v=new WeakMap;const _="function"==typeof XMLHttpRequest?"xhr":"fetch",j="xhr"===_?XMLHttpRequest:O,S=(e,t)=>{const r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},s=e.applyMiddleware("interceptRequest",void 0,{adapter:_,context:e});if(s){const e=setTimeout(t,0,null,s);return{abort:()=>clearTimeout(e)}}let i=new j;i instanceof O&&"object"==typeof n.fetch&&i.setInit(n.fetch);const a=n.headers,c=n.timeout;let l=!1,h=!1,d=!1;if(i.onerror=e=>{y(new Error("Request error while attempting to reach ".concat(n.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},i.ontimeout=e=>{y(new Error("Request timeout while attempting to reach ".concat(n.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},i.onabort=()=>{f(!0),l=!0},i.onreadystatechange=()=>{!function(){if(!c)return;f(),o.socket=setTimeout((()=>p("ESOCKETTIMEDOUT")),c.socket)}(),l||4!==i.readyState||0!==i.status&&function(){if(l||h||d)return;if(0===i.status)return void y(new Error("Unknown XHR error"));f(),h=!0,t(null,{body:i.response||(""===i.responseType||"text"===i.responseType?i.responseText:""),url:n.url,method:n.method,headers:u(i.getAllResponseHeaders()),statusCode:i.status,statusMessage:i.statusText})}()},i.open(n.method,n.url,!0),i.withCredentials=!!n.withCredentials,a&&i.setRequestHeader)for(const e in a)a.hasOwnProperty(e)&&i.setRequestHeader(e,a[e]);return n.rawBody&&(i.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:_,request:i,context:e}),i.send(n.body||null),c&&(o.connect=setTimeout((()=>p("ETIMEDOUT")),c.connect)),{abort:function(){l=!0,i&&i.abort()}};function p(t){d=!0,i.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(n.url):"Connection timed out on request to ".concat(n.url));r.code=t,e.channels.error.publish(r)}function f(e){(e||l||i.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function y(e){if(h)return;f(!0),h=!0,i=null;const r=e||new Error("Network error while attempting to reach ".concat(n.url));r.isNetworkError=!0,r.request=n,t(r)}};var A,k,R={exports:{}};function F(){if(k)return A;k=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,s=365.25*n;function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return A=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var s=Math.abs(o);if(s>=n)return i(o,s,n,"day");if(s>=r)return i(o,s,r,"hour");if(s>=t)return i(o,s,t,"minute");if(s>=e)return i(o,s,e,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=n)return Math.round(o/n)+"d";if(s>=r)return Math.round(o/r)+"h";if(s>=t)return Math.round(o/t)+"m";if(s>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var P=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=F(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};
|
|
2
2
|
/*!
|
|
3
3
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
function F(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=R(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(A,A.exports);const I="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),P=["boolean","string","number"];function M(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!I(t)&&(-1!==P.indexOf(typeof t)||Array.isArray(t)||!1!==F(r=t)&&(void 0===(n=r.constructor)||!1!==F(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function D(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let q={};"undefined"!=typeof globalThis?q=globalThis:"undefined"!=typeof window?q=window:"undefined"!=typeof global?q=global:"undefined"!=typeof self&&(q=self);var N=q;function H(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||N.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,r)=>new e((e=>(t.error.subscribe((t=>e.error(t))),t.progress.subscribe((t=>e.next(Object.assign({type:"progress"},t)))),t.response.subscribe((t=>{e.next(Object.assign({type:"response"},t)),e.complete()})),t.request.publish(r),()=>t.abort.publish())))}}class W{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const z=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new W(e),t(this.reason))}))}};z.source=()=>{let e;return{token:new z((t=>{e=t})),cancel:e}};var U=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function L(e){return 100*Math.pow(2,e)+100*Math.random()}const B=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||L,n=e.shouldRetry;return{onError:(e,o)=>{const s=o.options,i=s.maxRetries||t,a=s.shouldRetry||n,c=s.attemptNumber||0;if(null!==(u=s.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,s)||c>=i)return e;const l=Object.assign({},o,{options:Object.assign({},s,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),r(c)),null}}})({shouldRetry:U,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};B.shouldRetry=U;var $=function(e,t){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},$(e,t)};function G(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}$(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function V(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function J(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function X(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function Y(e){return"function"==typeof e}function K(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var Z=K((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function Q(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ee=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=V(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(Y(c))try{c()}catch(e){o=e instanceof Z?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=V(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{re(d)}catch(e){o=null!=o?o:[],e instanceof Z?o=X(X([],J(o)),J(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new Z(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)re(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Q(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&Q(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function te(e){return e instanceof ee||e&&"closed"in e&&Y(e.remove)&&Y(e.add)&&Y(e.unsubscribe)}function re(e){Y(e)?e():e.unsubscribe()}ee.EMPTY;var ne={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},oe={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=oe.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,X([e,t],J(r))):setTimeout.apply(void 0,X([e,t],J(r)))},clearTimeout:function(e){var t=oe.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function se(){}var ie=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,te(t)&&t.add(r)):r.destination=de,r}return G(t,e),t.create=function(e,t,r){return new le(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(ee),ae=Function.prototype.bind;function ce(e,t){return ae.call(e,t)}var ue=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){he(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){he(e)}else he(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){he(e)}},e}(),le=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;Y(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&ne.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&ce(t.next,s),error:t.error&&ce(t.error,s),complete:t.complete&&ce(t.complete,s)}):o=t;return i.destination=new ue(o),i}return G(t,e),t}(ie);function he(e){var t;t=e,oe.setTimeout((function(){throw t}))}var de={closed:!0,next:se,error:function(e){throw e},complete:se},pe="function"==typeof Symbol&&Symbol.observable||"@@observable";function fe(e){return e}var ye=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof ie||function(e){return e&&Y(e.next)&&Y(e.error)&&Y(e.complete)}(n)&&te(n)?e:new le(e,t,r);return function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}(),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=ge(t))((function(t,n){var o=new le({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[pe]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?fe:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ge(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function ge(e){var t;return null!==(t=null!=e?e:ne.Promise)&&void 0!==t?t:Promise}function me(e){return function(t){if(function(e){return Y(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function ve(e,t,r,n,o){return new be(e,t,r,n,o)}var be=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return G(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(ie),we=K((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ce(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new we)}})}))}function Ee(e,t){return me((function(r,n){var o=0;r.subscribe(ve(n,(function(r){n.next(e.call(t,r,o++))})))}))}function xe(e,t){return me((function(r,n){var o=0;r.subscribe(ve(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}var Te=[],Oe=Object.defineProperty,_e=(e,t,r)=>(((e,t,r)=>{t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class je extends Error{constructor(e){const t=Ae(e);super(t.message),_e(this,"response"),_e(this,"statusCode",400),_e(this,"responseBody"),_e(this,"details"),Object.assign(this,t)}}class Se extends Error{constructor(e){const t=Ae(e);super(t.message),_e(this,"response"),_e(this,"statusCode",500),_e(this,"responseBody"),_e(this,"details"),Object.assign(this,t)}}function Ae(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:Re(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message="".concat(t.error," - ").concat(t.message),r;if(function(e){return ke(e)&&ke(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?":\n- ".concat(n.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),r.message="".concat(t.error.description).concat(o),r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function ke(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Re(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Fe={onResponse:e=>{if(e.statusCode>=500)throw new Se(e);if(e.statusCode>=400)throw new je(e);return e}},Ie={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function Pe(e,t){let{maxRetries:r=5,retryDelay:n}=t;const o=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:_)}([r>0?B({retryDelay:n,maxRetries:r,shouldRetry:Me}):{},...e,Ie,M(),D(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},Fe,H({implementation:ye})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function Me(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||B.shouldRetry(e,t,r)}const De="X-Sanity-Project-ID";function qe(e){if("string"==typeof e||Array.isArray(e))return{id:e};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const Ne=["image","file"],He=["before","after","replace"],We=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},ze=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},Ue=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},Le=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));Ue(e,t._id)},Be=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},$e=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e},Ge=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.set("tag",s),o.set("query",t);for(const[e,t]of Object.entries(r))o.set("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.set(e,"".concat(t));return"?".concat(o)};var Ve,Je,Xe=Object.defineProperty,Ye=(e,t,r)=>(((e,t,r)=>{t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Ke=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ze=(e,t,r)=>(Ke(e,t,"read from private field"),r?r.call(e):t.get(e)),Qe=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},et=(e,t,r,n)=>(Ke(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class tt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye(this,"selection"),Ye(this,"operations"),this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return ze("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===He.indexOf(e)){const e=He.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...qe(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return ze(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}Ve=new WeakMap;let rt=class e extends tt{constructor(e,t,r){super(e,t),Qe(this,Ve,void 0),et(this,Ve,r)}clone(){return new e(this.selection,{...this.operations},Ze(this,Ve))}commit(e){if(!Ze(this,Ve))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Ze(this,Ve).mutate({patch:this.serialize()},r)}};Je=new WeakMap;let nt=class e extends tt{constructor(e,t,r){super(e,t),Qe(this,Je,void 0),et(this,Je,r)}clone(){return new e(this.selection,{...this.operations},Ze(this,Je))}commit(e){if(!Ze(this,Je))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return Ze(this,Je).mutate({patch:this.serialize()},r)}};var ot,st,it=Object.defineProperty,at=(e,t,r)=>(((e,t,r)=>{t in e?it(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),ct=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ut=(e,t,r)=>(ct(e,t,"read from private field"),r?r.call(e):t.get(e)),lt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ht=(e,t,r,n)=>(ct(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const dt={returnDocuments:!1};class pt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;at(this,"operations"),at(this,"trxId"),this.operations=e,this.trxId=t}create(e){return ze("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return ze(t,e),Le(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return ze(t,e),Le(t,e),this._add({[t]:e})}delete(e){return Ue("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}ot=new WeakMap;let ft=class e extends pt{constructor(e,t,r){super(e,r),lt(this,ot,void 0),ht(this,ot,t)}clone(){return new e([...this.operations],ut(this,ot),this.trxId)}commit(e){if(!ut(this,ot))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return ut(this,ot).mutate(this.serialize(),Object.assign({transactionId:this.trxId},dt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof nt)return this._add({patch:e.serialize()});if(r){const r=t(new nt(e,{},ut(this,ot)));if(!(r instanceof nt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};st=new WeakMap;let yt=class e extends pt{constructor(e,t,r){super(e,r),lt(this,st,void 0),ht(this,st,t)}clone(){return new e([...this.operations],ut(this,st),this.trxId)}commit(e){if(!ut(this,st))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return ut(this,st).mutate(this.serialize(),Object.assign({transactionId:this.trxId},dt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof rt)return this._add({patch:e.serialize()});if(r){const r=t(new rt(e,{},ut(this,st)));if(!(r instanceof rt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};const gt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},mt=e=>"response"===e.type,vt=e=>e.body,bt=11264;function wt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?e=>e:e=>e.result,{cache:i,next:a,...c}=o;return jt(e,t,"query",{query:r,params:n},void 0!==i||void 0!==a?{...c,fetch:{cache:i,next:a}}:c).pipe(Ee(s))}function Ct(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return At(e,t,{uri:Rt(e,"doc",r),json:!0,tag:n.tag}).pipe(xe(mt),Ee((e=>e.body.documents&&e.body.documents[0])))}function Et(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return At(e,t,{uri:Rt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(xe(mt),Ee((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function xt(e,t,r,n){return Le("createIfNotExists",r),St(e,t,r,"createIfNotExists",n)}function Tt(e,t,r,n){return Le("createOrReplace",r),St(e,t,r,"createOrReplace",n)}function Ot(e,t,r,n){return jt(e,t,"mutate",{mutations:[{delete:qe(r)}]},n)}function _t(e,t,r,n){let o;o=r instanceof nt||r instanceof rt?{patch:r.serialize()}:r instanceof ft||r instanceof yt?r.serialize():r;return jt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function jt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":Ge(n),c=!s&&a.length<bt,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o;return At(e,t,{method:c?"GET":"POST",uri:Rt(e,r,u),json:!0,body:c?void 0:n,query:s&>(o),timeout:h,headers:f,token:d,tag:p,canUseCdn:i,signal:o.signal,fetch:o.fetch}).pipe(xe(mt),Ee(vt),Ee((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function St(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return jt(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function At(e,t,r){const n=r.url||r.uri,o=e.config(),s=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn,i=o.useCdn&&s,a=r.tag&&o.requestTagPrefix?[o.requestTagPrefix,r.tag].join("."):r.tag||o.requestTagPrefix;a&&(r.query={tag:$e(a),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/query/")&&(o.resultSourceMap&&(r.query={resultSourceMap:!0,...r.query}),"string"==typeof o.perspective&&"raw"!==o.perspective&&(r.query={perspective:o.perspective,...r.query}));const c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[De]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(o,Object.assign({},r,{url:Ft(e,n,i)})),u=new ye((e=>t(c,o.requester).subscribe(e)));return r.signal?u.pipe((l=r.signal,e=>new ye((t=>{const r=()=>t.error(function(e){var t,r;if(It)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(l));if(l&&l.aborted)return void r();const n=e.subscribe(t);return l.addEventListener("abort",r),()=>{l.removeEventListener("abort",r),n.unsubscribe()}})))):u;var l}function kt(e,t,r){return At(e,t,r).pipe(xe((e=>"response"===e.type)),Ee((e=>e.body)))}function Rt(e,t,r){const n=e.config(),o=Be(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Ft(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=e.config();return"".concat(r?o:n,"/").concat(t.replace(/^\//,""))}const It=Boolean(globalThis.DOMException);var Pt,Mt,Dt,qt,Nt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ht=(e,t,r)=>(Nt(e,t,"read from private field"),r?r.call(e):t.get(e)),Wt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},zt=(e,t,r,n)=>(Nt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Ut{constructor(e,t){Wt(this,Pt,void 0),Wt(this,Mt,void 0),zt(this,Pt,e),zt(this,Mt,t)}upload(e,t,r){return Bt(Ht(this,Pt),Ht(this,Mt),e,t,r)}}Pt=new WeakMap,Mt=new WeakMap;class Lt{constructor(e,t){Wt(this,Dt,void 0),Wt(this,qt,void 0),zt(this,Dt,e),zt(this,qt,t)}upload(e,t,r){return Ce(Bt(Ht(this,Dt),Ht(this,qt),e,t,r).pipe(xe((e=>"response"===e.type)),Ee((e=>e.body.document))))}}function Bt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Ne.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Ne.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Be(e.config()),a="image"===r?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,g={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),At(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:n})}Dt=new WeakMap,qt=new WeakMap;function $t(e){return"https://www.sanity.io/help/"+e}const Gt=e=>function(e){let t,r=!1;return function(){return r||(t=e(...arguments),r=!0),t}}((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return console.warn(e.join(" "),...r)})),Vt=Gt(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Jt=Gt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat($t("js-client-browser-token")," for more information and how to hide this warning.")]),Xt=Gt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat($t("js-client-api-version"))]),Yt=Gt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Kt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Zt=["localhost","127.0.0.1","0.0.0.0"],Qt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||Xt();const n=Object.assign({},Kt,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=$t("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}}(n.perspective),"encodeSourceMapAtPath"in n||"encodeSourceMap"in n||"studioUrl"in n||"logger"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import.");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==Zt.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?Jt():void 0===n.useCdn&&Vt(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&We(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?$e(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===Kt.apiHost,n.useCdn=!1!==n.useCdn&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n};var er=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const tr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],rr={includeResult:!0};function nr(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={...er(r,rr),tag:a},u=(l=c,tr.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=Ge({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(Rt(this,"listen",h));if(d.length>14800)return new ye((e=>e.error(new Error("Query too large for listener"))));const p=c.events?c.events:["mutation"],f=-1!==p.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new ye((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(f&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(c(),clearTimeout(r),r=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=or(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function i(t){const r=or(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",s),t.removeEventListener("disconnect",a),p.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Zr})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),p.forEach((e=>t.addEventListener(e,i))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){n=!0,c()}return h}))}function or(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var sr,ir,ar,cr,ur=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},lr=(e,t,r)=>(ur(e,t,"read from private field"),r?r.call(e):t.get(e)),hr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},dr=(e,t,r,n)=>(ur(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class pr{constructor(e,t){hr(this,sr,void 0),hr(this,ir,void 0),dr(this,sr,e),dr(this,ir,t)}create(e,t){return yr(lr(this,sr),lr(this,ir),"PUT",e,t)}edit(e,t){return yr(lr(this,sr),lr(this,ir),"PATCH",e,t)}delete(e){return yr(lr(this,sr),lr(this,ir),"DELETE",e)}list(){return kt(lr(this,sr),lr(this,ir),{uri:"/datasets"})}}sr=new WeakMap,ir=new WeakMap;class fr{constructor(e,t){hr(this,ar,void 0),hr(this,cr,void 0),dr(this,ar,e),dr(this,cr,t)}create(e,t){return Ce(yr(lr(this,ar),lr(this,cr),"PUT",e,t))}edit(e,t){return Ce(yr(lr(this,ar),lr(this,cr),"PATCH",e,t))}delete(e){return Ce(yr(lr(this,ar),lr(this,cr),"DELETE",e))}list(){return Ce(kt(lr(this,ar),lr(this,cr),{uri:"/datasets"}))}}function yr(e,t,r,n,o){return We(n),kt(e,t,{method:r,uri:"/datasets/".concat(n),body:o})}ar=new WeakMap,cr=new WeakMap;var gr,mr,vr,br,wr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Cr=(e,t,r)=>(wr(e,t,"read from private field"),r?r.call(e):t.get(e)),Er=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},xr=(e,t,r,n)=>(wr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Tr{constructor(e,t){Er(this,gr,void 0),Er(this,mr,void 0),xr(this,gr,e),xr(this,mr,t)}list(){return kt(Cr(this,gr),Cr(this,mr),{uri:"/projects"})}getById(e){return kt(Cr(this,gr),Cr(this,mr),{uri:"/projects/".concat(e)})}}gr=new WeakMap,mr=new WeakMap;class Or{constructor(e,t){Er(this,vr,void 0),Er(this,br,void 0),xr(this,vr,e),xr(this,br,t)}list(){return Ce(kt(Cr(this,vr),Cr(this,br),{uri:"/projects"}))}getById(e){return Ce(kt(Cr(this,vr),Cr(this,br),{uri:"/projects/".concat(e)}))}}vr=new WeakMap,br=new WeakMap;var _r,jr,Sr,Ar,kr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Rr=(e,t,r)=>(kr(e,t,"read from private field"),r?r.call(e):t.get(e)),Fr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ir=(e,t,r,n)=>(kr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Pr{constructor(e,t){Fr(this,_r,void 0),Fr(this,jr,void 0),Ir(this,_r,e),Ir(this,jr,t)}getById(e){return kt(Rr(this,_r),Rr(this,jr),{uri:"/users/".concat(e)})}}_r=new WeakMap,jr=new WeakMap;class Mr{constructor(e,t){Fr(this,Sr,void 0),Fr(this,Ar,void 0),Ir(this,Sr,e),Ir(this,Ar,t)}getById(e){return Ce(kt(Rr(this,Sr),Rr(this,Ar),{uri:"/users/".concat(e)}))}}Sr=new WeakMap,Ar=new WeakMap;var Dr,qr,Nr,Hr,Wr=Object.defineProperty,zr=(e,t,r)=>(((e,t,r)=>{t in e?Wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Ur=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Lr=(e,t,r)=>(Ur(e,t,"read from private field"),r?r.call(e):t.get(e)),Br=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},$r=(e,t,r,n)=>(Ur(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Dr=new WeakMap,qr=new WeakMap;let Gr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kt;zr(this,"assets"),zr(this,"datasets"),zr(this,"projects"),zr(this,"users"),Br(this,Dr,void 0),Br(this,qr,void 0),zr(this,"listen",nr),this.config(t),$r(this,qr,e),this.assets=new Ut(this,Lr(this,qr)),this.datasets=new pr(this,Lr(this,qr)),this.projects=new Tr(this,Lr(this,qr)),this.users=new Pr(this,Lr(this,qr))}clone(){return new e(Lr(this,qr),this.config())}config(e){if(void 0===e)return{...Lr(this,Dr)};if(Lr(this,Dr)&&!1===Lr(this,Dr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return $r(this,Dr,Qt(e,Lr(this,Dr)||{})),this}withConfig(t){return new e(Lr(this,qr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return wt(this,Lr(this,qr),e,t,r)}getDocument(e,t){return Ct(this,Lr(this,qr),e,t)}getDocuments(e,t){return Et(this,Lr(this,qr),e,t)}create(e,t){return St(this,Lr(this,qr),e,"create",t)}createIfNotExists(e,t){return xt(this,Lr(this,qr),e,t)}createOrReplace(e,t){return Tt(this,Lr(this,qr),e,t)}delete(e,t){return Ot(this,Lr(this,qr),e,t)}mutate(e,t){return _t(this,Lr(this,qr),e,t)}patch(e,t){return new rt(e,t,this)}transaction(e){return new yt(e,this)}request(e){return kt(this,Lr(this,qr),e)}getUrl(e,t){return Ft(this,e,t)}getDataUrl(e,t){return Rt(this,e,t)}};Nr=new WeakMap,Hr=new WeakMap;let Vr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kt;zr(this,"assets"),zr(this,"datasets"),zr(this,"projects"),zr(this,"users"),zr(this,"observable"),Br(this,Nr,void 0),Br(this,Hr,void 0),zr(this,"listen",nr),this.config(t),$r(this,Hr,e),this.assets=new Lt(this,Lr(this,Hr)),this.datasets=new fr(this,Lr(this,Hr)),this.projects=new Or(this,Lr(this,Hr)),this.users=new Mr(this,Lr(this,Hr)),this.observable=new Gr(e,t)}clone(){return new e(Lr(this,Hr),this.config())}config(e){if(void 0===e)return{...Lr(this,Nr)};if(Lr(this,Nr)&&!1===Lr(this,Nr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),$r(this,Nr,Qt(e,Lr(this,Nr)||{})),this}withConfig(t){return new e(Lr(this,Hr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Ce(wt(this,Lr(this,Hr),e,t,r))}getDocument(e,t){return Ce(Ct(this,Lr(this,Hr),e,t))}getDocuments(e,t){return Ce(Et(this,Lr(this,Hr),e,t))}create(e,t){return Ce(St(this,Lr(this,Hr),e,"create",t))}createIfNotExists(e,t){return Ce(xt(this,Lr(this,Hr),e,t))}createOrReplace(e,t){return Ce(Tt(this,Lr(this,Hr),e,t))}delete(e,t){return Ce(Ot(this,Lr(this,Hr),e,t))}mutate(e,t){return Ce(_t(this,Lr(this,Hr),e,t))}patch(e,t){return new nt(e,t,this)}transaction(e){return new ft(e,this)}request(e){return Ce(kt(this,Lr(this,Hr),e))}dataRequest(e,t,r){return Ce(jt(this,Lr(this,Hr),e,t,r))}getUrl(e,t){return Ft(this,e,t)}getDataUrl(e,t){return Rt(this,e,t)}};const Jr=Pe(Te,{}),Xr=Jr.defaultRequester;var Yr={exports:{}};
|
|
8
|
+
function I(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=P(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(R,R.exports);const M="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),D=["boolean","string","number"];function q(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!M(t)&&(-1!==D.indexOf(typeof t)||Array.isArray(t)||!1!==I(r=t)&&(void 0===(n=r.constructor)||!1!==I(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function N(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let H={};"undefined"!=typeof globalThis?H=globalThis:"undefined"!=typeof window?H=window:"undefined"!=typeof global?H=global:"undefined"!=typeof self&&(H=self);var W=H;function z(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||W.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,r)=>new e((e=>(t.error.subscribe((t=>e.error(t))),t.progress.subscribe((t=>e.next(Object.assign({type:"progress"},t)))),t.response.subscribe((t=>{e.next(Object.assign({type:"response"},t)),e.complete()})),t.request.publish(r),()=>t.abort.publish())))}}var U=Object.defineProperty,L=(e,t,r)=>(((e,t,r)=>{t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class B{constructor(e){L(this,"__CANCEL__",!0),L(this,"message"),this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const $=class{constructor(e){if(L(this,"promise"),L(this,"reason"),"function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new B(e),t(this.reason))}))}};L($,"source",(()=>{let e;return{token:new $((t=>{e=t})),cancel:e}}));var G=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function V(e){return 100*Math.pow(2,e)+100*Math.random()}const J=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||V,n=e.shouldRetry;return{onError:(e,o)=>{const s=o.options,i=s.maxRetries||t,a=s.shouldRetry||n,c=s.attemptNumber||0;if(null!==(u=s.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,s)||c>=i)return e;const l=Object.assign({},o,{options:Object.assign({},s,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),r(c)),null}}})({shouldRetry:G,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};J.shouldRetry=G;var X=function(e,t){return X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},X(e,t)};function Y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}X(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function K(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Z(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function Q(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function ee(e){return"function"==typeof e}function te(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var re=te((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function ne(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var oe=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=K(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(ee(c))try{c()}catch(e){o=e instanceof re?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=K(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{ie(d)}catch(e){o=null!=o?o:[],e instanceof re?o=Q(Q([],Z(o)),Z(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new re(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ie(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ne(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&ne(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function se(e){return e instanceof oe||e&&"closed"in e&&ee(e.remove)&&ee(e.add)&&ee(e.unsubscribe)}function ie(e){ee(e)?e():e.unsubscribe()}oe.EMPTY;var ae={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ce={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ce.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,Q([e,t],Z(r))):setTimeout.apply(void 0,Q([e,t],Z(r)))},clearTimeout:function(e){var t=ce.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ue(){}var le=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,se(t)&&t.add(r)):r.destination=me,r}return Y(t,e),t.create=function(e,t,r){return new fe(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(oe),he=Function.prototype.bind;function de(e,t){return he.call(e,t)}var pe=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ye(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ye(e)}else ye(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ye(e)}},e}(),fe=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;ee(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&ae.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&de(t.next,s),error:t.error&&de(t.error,s),complete:t.complete&&de(t.complete,s)}):o=t;return i.destination=new pe(o),i}return Y(t,e),t}(le);function ye(e){var t;t=e,ce.setTimeout((function(){throw t}))}var me={closed:!0,next:ue,error:function(e){throw e},complete:ue},ge="function"==typeof Symbol&&Symbol.observable||"@@observable";function ve(e){return e}var be=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof le||function(e){return e&&ee(e.next)&&ee(e.error)&&ee(e.complete)}(n)&&se(n)?e:new fe(e,t,r);return function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}(),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=we(t))((function(t,n){var o=new fe({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[ge]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?ve:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=we(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function we(e){var t;return null!==(t=null!=e?e:ae.Promise)&&void 0!==t?t:Promise}function Ce(e){return function(t){if(function(e){return ee(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Ee(e,t,r,n,o){return new xe(e,t,r,n,o)}var xe=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return Y(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(le),Te=te((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Oe(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Te)}})}))}function _e(e,t){return Ce((function(r,n){var o=0;r.subscribe(Ee(n,(function(r){n.next(e.call(t,r,o++))})))}))}function je(e,t){return Ce((function(r,n){var o=0;r.subscribe(Ee(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}var Se=[],Ae=Object.defineProperty,ke=(e,t,r)=>(((e,t,r)=>{t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class Re extends Error{constructor(e){const t=Pe(e);super(t.message),ke(this,"response"),ke(this,"statusCode",400),ke(this,"responseBody"),ke(this,"details"),Object.assign(this,t)}}class Fe extends Error{constructor(e){const t=Pe(e);super(t.message),ke(this,"response"),ke(this,"statusCode",500),ke(this,"responseBody"),ke(this,"details"),Object.assign(this,t)}}function Pe(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:Me(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message="".concat(t.error," - ").concat(t.message),r;if(function(e){return Ie(e)&&Ie(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?":\n- ".concat(n.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),r.message="".concat(t.error.description).concat(o),r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function Ie(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Me(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const De={onResponse:e=>{if(e.statusCode>=500)throw new Fe(e);if(e.statusCode>=400)throw new Re(e);return e}},qe={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function Ne(e,t){let{maxRetries:r=5,retryDelay:n}=t;const o=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:S)}([r>0?J({retryDelay:n,maxRetries:r,shouldRetry:He}):{},...e,qe,q(),N(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},De,z({implementation:be})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function He(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||J.shouldRetry(e,t,r)}const We="X-Sanity-Project-ID";function ze(e){if("string"==typeof e||Array.isArray(e))return{id:e};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const Ue=["image","file"],Le=["before","after","replace"],Be=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},$e=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},Ge=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},Ve=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));Ge(e,t._id)},Je=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},Xe=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e},Ye=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.set("tag",s),o.set("query",t);for(const[e,t]of Object.entries(r))o.set("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.set(e,"".concat(t));return"?".concat(o)};var Ke,Ze,Qe=Object.defineProperty,et=(e,t,r)=>(((e,t,r)=>{t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),tt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},rt=(e,t,r)=>(tt(e,t,"read from private field"),r?r.call(e):t.get(e)),nt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ot=(e,t,r,n)=>(tt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class st{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};et(this,"selection"),et(this,"operations"),this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return $e("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===Le.indexOf(e)){const e=Le.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...ze(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return $e(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}Ke=new WeakMap;let it=class e extends st{constructor(e,t,r){super(e,t),nt(this,Ke,void 0),ot(this,Ke,r)}clone(){return new e(this.selection,{...this.operations},rt(this,Ke))}commit(e){if(!rt(this,Ke))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return rt(this,Ke).mutate({patch:this.serialize()},r)}};Ze=new WeakMap;let at=class e extends st{constructor(e,t,r){super(e,t),nt(this,Ze,void 0),ot(this,Ze,r)}clone(){return new e(this.selection,{...this.operations},rt(this,Ze))}commit(e){if(!rt(this,Ze))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return rt(this,Ze).mutate({patch:this.serialize()},r)}};var ct,ut,lt=Object.defineProperty,ht=(e,t,r)=>(((e,t,r)=>{t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),dt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},pt=(e,t,r)=>(dt(e,t,"read from private field"),r?r.call(e):t.get(e)),ft=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},yt=(e,t,r,n)=>(dt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const mt={returnDocuments:!1};class gt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;ht(this,"operations"),ht(this,"trxId"),this.operations=e,this.trxId=t}create(e){return $e("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return $e(t,e),Ve(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return $e(t,e),Ve(t,e),this._add({[t]:e})}delete(e){return Ge("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}ct=new WeakMap;let vt=class e extends gt{constructor(e,t,r){super(e,r),ft(this,ct,void 0),yt(this,ct,t)}clone(){return new e([...this.operations],pt(this,ct),this.trxId)}commit(e){if(!pt(this,ct))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return pt(this,ct).mutate(this.serialize(),Object.assign({transactionId:this.trxId},mt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof at)return this._add({patch:e.serialize()});if(r){const r=t(new at(e,{},pt(this,ct)));if(!(r instanceof at))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};ut=new WeakMap;let bt=class e extends gt{constructor(e,t,r){super(e,r),ft(this,ut,void 0),yt(this,ut,t)}clone(){return new e([...this.operations],pt(this,ut),this.trxId)}commit(e){if(!pt(this,ut))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return pt(this,ut).mutate(this.serialize(),Object.assign({transactionId:this.trxId},mt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof it)return this._add({patch:e.serialize()});if(r){const r=t(new it(e,{},pt(this,ut)));if(!(r instanceof it))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};const wt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},Ct=e=>"response"===e.type,Et=e=>e.body,xt=11264;function Tt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?e=>e:e=>e.result,{cache:i,next:a,...c}=o;return Rt(e,t,"query",{query:r,params:n},void 0!==i||void 0!==a?{...c,fetch:{cache:i,next:a}}:c).pipe(_e(s))}function Ot(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Pt(e,t,{uri:Mt(e,"doc",r),json:!0,tag:n.tag}).pipe(je(Ct),_e((e=>e.body.documents&&e.body.documents[0])))}function _t(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Pt(e,t,{uri:Mt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(je(Ct),_e((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function jt(e,t,r,n){return Ve("createIfNotExists",r),Ft(e,t,r,"createIfNotExists",n)}function St(e,t,r,n){return Ve("createOrReplace",r),Ft(e,t,r,"createOrReplace",n)}function At(e,t,r,n){return Rt(e,t,"mutate",{mutations:[{delete:ze(r)}]},n)}function kt(e,t,r,n){let o;o=r instanceof at||r instanceof it?{patch:r.serialize()}:r instanceof vt||r instanceof bt?r.serialize():r;return Rt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function Rt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":Ye(n),c=!s&&a.length<xt,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o;return Pt(e,t,{method:c?"GET":"POST",uri:Mt(e,r,u),json:!0,body:c?void 0:n,query:s&&wt(o),timeout:h,headers:f,token:d,tag:p,canUseCdn:i,signal:o.signal,fetch:o.fetch}).pipe(je(Ct),_e(Et),_e((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function Ft(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Rt(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Pt(e,t,r){const n=r.url||r.uri,o=e.config(),s=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn,i=o.useCdn&&s,a=r.tag&&o.requestTagPrefix?[o.requestTagPrefix,r.tag].join("."):r.tag||o.requestTagPrefix;a&&(r.query={tag:Xe(a),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/query/")&&(o.resultSourceMap&&(r.query={resultSourceMap:!0,...r.query}),"string"==typeof o.perspective&&"raw"!==o.perspective&&(r.query={perspective:o.perspective,...r.query}));const c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[We]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(o,Object.assign({},r,{url:Dt(e,n,i)})),u=new be((e=>t(c,o.requester).subscribe(e)));return r.signal?u.pipe((l=r.signal,e=>new be((t=>{const r=()=>t.error(function(e){var t,r;if(qt)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(l));if(l&&l.aborted)return void r();const n=e.subscribe(t);return l.addEventListener("abort",r),()=>{l.removeEventListener("abort",r),n.unsubscribe()}})))):u;var l}function It(e,t,r){return Pt(e,t,r).pipe(je((e=>"response"===e.type)),_e((e=>e.body)))}function Mt(e,t,r){const n=e.config(),o=Je(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Dt(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=e.config();return"".concat(r?o:n,"/").concat(t.replace(/^\//,""))}const qt=Boolean(globalThis.DOMException);var Nt,Ht,Wt,zt,Ut=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Lt=(e,t,r)=>(Ut(e,t,"read from private field"),r?r.call(e):t.get(e)),Bt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},$t=(e,t,r,n)=>(Ut(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Gt{constructor(e,t){Bt(this,Nt,void 0),Bt(this,Ht,void 0),$t(this,Nt,e),$t(this,Ht,t)}upload(e,t,r){return Jt(Lt(this,Nt),Lt(this,Ht),e,t,r)}}Nt=new WeakMap,Ht=new WeakMap;class Vt{constructor(e,t){Bt(this,Wt,void 0),Bt(this,zt,void 0),$t(this,Wt,e),$t(this,zt,t)}upload(e,t,r){return Oe(Jt(Lt(this,Wt),Lt(this,zt),e,t,r).pipe(je((e=>"response"===e.type)),_e((e=>e.body.document))))}}function Jt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Ue.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Ue.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Je(e.config()),a="image"===r?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,m={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(m.sourceId=y.id,m.sourceName=y.name,m.sourceUrl=y.url),Pt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:m,body:n})}Wt=new WeakMap,zt=new WeakMap;function Xt(e){return"https://www.sanity.io/help/"+e}const Yt=e=>function(e){let t,r=!1;return function(){return r||(t=e(...arguments),r=!0),t}}((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return console.warn(e.join(" "),...r)})),Kt=Yt(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Zt=Yt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Xt("js-client-browser-token")," for more information and how to hide this warning.")]),Qt=Yt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Xt("js-client-api-version"))]),er=Yt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),tr={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},rr=["localhost","127.0.0.1","0.0.0.0"],nr=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||Qt();const n=Object.assign({},tr,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=Xt("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}}(n.perspective),"encodeSourceMapAtPath"in n||"encodeSourceMap"in n||"studioUrl"in n||"logger"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import.");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==rr.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?Zt():void 0===n.useCdn&&Kt(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&Be(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?Xe(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===tr.apiHost,n.useCdn=!1!==n.useCdn&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n};var or=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const sr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],ir={includeResult:!0};function ar(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={...or(r,ir),tag:a},u=(l=c,sr.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=Ye({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(Mt(this,"listen",h));if(d.length>14800)return new be((e=>e.error(new Error("Query too large for listener"))));const p=c.events?c.events:["mutation"],f=-1!==p.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new be((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(f&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(c(),clearTimeout(r),r=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=cr(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function i(t){const r=cr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",s),t.removeEventListener("disconnect",a),p.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return rn})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),p.forEach((e=>t.addEventListener(e,i))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){n=!0,c()}return h}))}function cr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var ur,lr,hr,dr,pr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},fr=(e,t,r)=>(pr(e,t,"read from private field"),r?r.call(e):t.get(e)),yr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},mr=(e,t,r,n)=>(pr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class gr{constructor(e,t){yr(this,ur,void 0),yr(this,lr,void 0),mr(this,ur,e),mr(this,lr,t)}create(e,t){return br(fr(this,ur),fr(this,lr),"PUT",e,t)}edit(e,t){return br(fr(this,ur),fr(this,lr),"PATCH",e,t)}delete(e){return br(fr(this,ur),fr(this,lr),"DELETE",e)}list(){return It(fr(this,ur),fr(this,lr),{uri:"/datasets"})}}ur=new WeakMap,lr=new WeakMap;class vr{constructor(e,t){yr(this,hr,void 0),yr(this,dr,void 0),mr(this,hr,e),mr(this,dr,t)}create(e,t){return Oe(br(fr(this,hr),fr(this,dr),"PUT",e,t))}edit(e,t){return Oe(br(fr(this,hr),fr(this,dr),"PATCH",e,t))}delete(e){return Oe(br(fr(this,hr),fr(this,dr),"DELETE",e))}list(){return Oe(It(fr(this,hr),fr(this,dr),{uri:"/datasets"}))}}function br(e,t,r,n,o){return Be(n),It(e,t,{method:r,uri:"/datasets/".concat(n),body:o})}hr=new WeakMap,dr=new WeakMap;var wr,Cr,Er,xr,Tr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Or=(e,t,r)=>(Tr(e,t,"read from private field"),r?r.call(e):t.get(e)),_r=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},jr=(e,t,r,n)=>(Tr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Sr{constructor(e,t){_r(this,wr,void 0),_r(this,Cr,void 0),jr(this,wr,e),jr(this,Cr,t)}list(){return It(Or(this,wr),Or(this,Cr),{uri:"/projects"})}getById(e){return It(Or(this,wr),Or(this,Cr),{uri:"/projects/".concat(e)})}}wr=new WeakMap,Cr=new WeakMap;class Ar{constructor(e,t){_r(this,Er,void 0),_r(this,xr,void 0),jr(this,Er,e),jr(this,xr,t)}list(){return Oe(It(Or(this,Er),Or(this,xr),{uri:"/projects"}))}getById(e){return Oe(It(Or(this,Er),Or(this,xr),{uri:"/projects/".concat(e)}))}}Er=new WeakMap,xr=new WeakMap;var kr,Rr,Fr,Pr,Ir=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Mr=(e,t,r)=>(Ir(e,t,"read from private field"),r?r.call(e):t.get(e)),Dr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},qr=(e,t,r,n)=>(Ir(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Nr{constructor(e,t){Dr(this,kr,void 0),Dr(this,Rr,void 0),qr(this,kr,e),qr(this,Rr,t)}getById(e){return It(Mr(this,kr),Mr(this,Rr),{uri:"/users/".concat(e)})}}kr=new WeakMap,Rr=new WeakMap;class Hr{constructor(e,t){Dr(this,Fr,void 0),Dr(this,Pr,void 0),qr(this,Fr,e),qr(this,Pr,t)}getById(e){return Oe(It(Mr(this,Fr),Mr(this,Pr),{uri:"/users/".concat(e)}))}}Fr=new WeakMap,Pr=new WeakMap;var Wr,zr,Ur,Lr,Br=Object.defineProperty,$r=(e,t,r)=>(((e,t,r)=>{t in e?Br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Gr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Vr=(e,t,r)=>(Gr(e,t,"read from private field"),r?r.call(e):t.get(e)),Jr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Xr=(e,t,r,n)=>(Gr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Wr=new WeakMap,zr=new WeakMap;let Yr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tr;$r(this,"assets"),$r(this,"datasets"),$r(this,"projects"),$r(this,"users"),Jr(this,Wr,void 0),Jr(this,zr,void 0),$r(this,"listen",ar),this.config(t),Xr(this,zr,e),this.assets=new Gt(this,Vr(this,zr)),this.datasets=new gr(this,Vr(this,zr)),this.projects=new Sr(this,Vr(this,zr)),this.users=new Nr(this,Vr(this,zr))}clone(){return new e(Vr(this,zr),this.config())}config(e){if(void 0===e)return{...Vr(this,Wr)};if(Vr(this,Wr)&&!1===Vr(this,Wr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Xr(this,Wr,nr(e,Vr(this,Wr)||{})),this}withConfig(t){return new e(Vr(this,zr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Tt(this,Vr(this,zr),e,t,r)}getDocument(e,t){return Ot(this,Vr(this,zr),e,t)}getDocuments(e,t){return _t(this,Vr(this,zr),e,t)}create(e,t){return Ft(this,Vr(this,zr),e,"create",t)}createIfNotExists(e,t){return jt(this,Vr(this,zr),e,t)}createOrReplace(e,t){return St(this,Vr(this,zr),e,t)}delete(e,t){return At(this,Vr(this,zr),e,t)}mutate(e,t){return kt(this,Vr(this,zr),e,t)}patch(e,t){return new it(e,t,this)}transaction(e){return new bt(e,this)}request(e){return It(this,Vr(this,zr),e)}getUrl(e,t){return Dt(this,e,t)}getDataUrl(e,t){return Mt(this,e,t)}};Ur=new WeakMap,Lr=new WeakMap;let Kr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tr;$r(this,"assets"),$r(this,"datasets"),$r(this,"projects"),$r(this,"users"),$r(this,"observable"),Jr(this,Ur,void 0),Jr(this,Lr,void 0),$r(this,"listen",ar),this.config(t),Xr(this,Lr,e),this.assets=new Vt(this,Vr(this,Lr)),this.datasets=new vr(this,Vr(this,Lr)),this.projects=new Ar(this,Vr(this,Lr)),this.users=new Hr(this,Vr(this,Lr)),this.observable=new Yr(e,t)}clone(){return new e(Vr(this,Lr),this.config())}config(e){if(void 0===e)return{...Vr(this,Ur)};if(Vr(this,Ur)&&!1===Vr(this,Ur).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),Xr(this,Ur,nr(e,Vr(this,Ur)||{})),this}withConfig(t){return new e(Vr(this,Lr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Oe(Tt(this,Vr(this,Lr),e,t,r))}getDocument(e,t){return Oe(Ot(this,Vr(this,Lr),e,t))}getDocuments(e,t){return Oe(_t(this,Vr(this,Lr),e,t))}create(e,t){return Oe(Ft(this,Vr(this,Lr),e,"create",t))}createIfNotExists(e,t){return Oe(jt(this,Vr(this,Lr),e,t))}createOrReplace(e,t){return Oe(St(this,Vr(this,Lr),e,t))}delete(e,t){return Oe(At(this,Vr(this,Lr),e,t))}mutate(e,t){return Oe(kt(this,Vr(this,Lr),e,t))}patch(e,t){return new at(e,t,this)}transaction(e){return new vt(e,this)}request(e){return Oe(It(this,Vr(this,Lr),e))}dataRequest(e,t,r){return Oe(Rt(this,Vr(this,Lr),e,t,r))}getUrl(e,t){return Dt(this,e,t)}getDataUrl(e,t){return Mt(this,e,t)}};const Zr=Ne(Se,{}),Qr=Zr.defaultRequester;var en={exports:{}};
|
|
9
9
|
/** @license
|
|
10
10
|
* eventsource.js
|
|
11
11
|
* Available under MIT License (MIT)
|
|
12
12
|
* https://github.com/Yaffle/EventSource/
|
|
13
|
-
*/!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,s=r.XMLHttpRequest,i=r.XDomainRequest,a=r.ActiveXObject,c=r.EventSource,u=r.document,l=r.Promise,h=r.fetch,d=r.Response,p=r.TextDecoder,f=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=h;h=function(e,t){var r=t.signal;return g(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==s&&(c<128||c>191||!t(i<<6|63&c,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(c>=0&&c<=127?(s=0,i=c):c>=192&&c<=223?(s=6,i=31&c):c>=224&&c<=239?(s=12,i=15&c):c>=240&&c<=247?(s=18,i=7&c):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&c),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=m);var v=function(){};function b(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");t[w(s)]=i}this._map=t}function E(){}function x(e){this._headers=e}function T(){}function O(){this._listeners=Object.create(null)}function _(e){n((function(){throw e}),0)}function j(e){this.type=e,this.target=void 0}function S(e,t){j.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){j.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,c=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==c&&(o(c),c=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in i)e=200,t="OK",n=i.contentType;else try{e=i.status,t=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},d=function(){c=n((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(c=n((function(){d()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(r,n,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,r,n,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},O.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===t&&(o=!0);o||n.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==t&&o.push(n[s]);0===o.length?delete r[e]:r[e]=o}},S.prototype=Object.create(j.prototype),A.prototype=Object.create(j.prototype),k.prototype=Object.create(j.prototype);var R=-1,F=0,I=1,P=2,M=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),U(r)},U=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){_(e)}};function B(e,t){O.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,r){t=String(t);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(r.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=r.headers||{},g=r.Transport,m=$&&null==g?void 0:new b(null!=g?new g:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=g&&"string"!=typeof g?new g:null==m?new T:new E,w=void 0,C=0,x=R,O="",_="",j="",B="",G=D,V=0,J=0,X=function(t,r,n,o){if(x===F)if(200===t&&null!=n&&W.test(n)){x=I,p=Date.now(),d=u,e.readyState=I;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onopen,s)}else{var i="";200!==t?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",Z();s=new A("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onerror,s),console.error(i)}},Y=function(t){if(x===I){for(var r=-1,s=0;s<t.length;s+=1){(c=t.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?B:"")+t.slice(0,r+1);B=(-1===r?B:"")+t.slice(r+1),""!==t&&(p=Date.now(),f+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(G===M&&c==="\n".charCodeAt(0))G=D;else if(G===M&&(G=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(G!==D){G===q&&(J=a+1);var y=i.slice(V,J-1),g=i.slice(J+(J<a&&i.charCodeAt(J)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=g):"id"===y?_=g:"event"===y?j=g:"retry"===y?(u=z(g,u),d=u):"heartbeatTimeout"===y&&(l=z(g,l),0!==C&&(o(C),C=n((function(){Q()}),l)))}if(G===D){if(""!==O){h=_,""===j&&(j="message");var m=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===j?L(e,e.onopen,m):"message"===j?L(e,e.onmessage,m):"error"===j&&L(e,e.onerror,m),x===P)return}O="",j=""}G=c==="\r".charCodeAt(0)?M:D}else G===D&&(V=a,G=q),G===q?c===":".charCodeAt(0)&&(J=a+1,G=N):G===N&&(G=H)}}},K=function(t){if(x===I||x===F){x=R,0!==C&&(o(C),C=0),C=n((function(){Q()}),d),d=U(Math.min(16*u,2*d)),e.readyState=F;var r=new k("error",{error:t});e.dispatchEvent(r),L(e,e.onerror,r),null!=t&&console.error(t)}},Z=function(){x=P,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=P},Q=function(){if(C=0,x===R){p=!1,f=0,C=n((function(){Q()}),l),x=F,O="",j="",_=h,B="",V=0,J=0,G=D;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u]);try{w=v.open(m,X,Y,K,r,s,i)}catch(e){throw Z(),e}}else if(p||null==w){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(x===F?"No response received.":f+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=F,e.withCredentials=a,e.headers=y,e._close=Z,Q()}(this,e,t)}var $=null!=h&&null!=d&&"body"in d.prototype;B.prototype=Object.create(O.prototype),B.prototype.CONNECTING=F,B.prototype.OPEN=I,B.prototype.CLOSED=P,B.prototype.close=function(){this._close()},B.CONNECTING=F,B.OPEN=I,B.CLOSED=P,B.prototype.withCredentials=void 0;var G,V=c;null==s||null!=c&&"withCredentials"in c.prototype||(V=B),G=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=c,e.EventSource=V}(t),void 0!==G&&(e.exports=G)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}(Yr,Yr.exports);var Kr=a(Yr.exports.EventSourcePolyfill),Zr=Object.freeze({__proto__:null,default:Kr});e.BasePatch=tt,e.BaseTransaction=pt,e.ClientError=je,e.ObservablePatch=rt,e.ObservableSanityClient=Gr,e.ObservableTransaction=yt,e.Patch=nt,e.SanityClient=Vr,e.ServerError=Se,e.Transaction=ft,e.createClient=e=>new Vr(Pe(Te,{maxRetries:e.maxRetries,retryDelay:e.retryDelay}),e),e.default=function(e){return Yt(),new Vr(Jr,e)},e.requester=Xr,e.unstable__adapter=T,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
13
|
+
*/!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,s=r.XMLHttpRequest,i=r.XDomainRequest,a=r.ActiveXObject,c=r.EventSource,u=r.document,l=r.Promise,h=r.fetch,d=r.Response,p=r.TextDecoder,f=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var m=h;h=function(e,t){var r=t.signal;return m(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==s&&(c<128||c>191||!t(i<<6|63&c,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(c>=0&&c<=127?(s=0,i=c):c>=192&&c<=223?(s=6,i=31&c):c>=224&&c<=239?(s=12,i=15&c):c>=240&&c<=247?(s=18,i=7&c):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&c),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=g);var v=function(){};function b(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");t[w(s)]=i}this._map=t}function E(){}function x(e){this._headers=e}function T(){}function O(){this._listeners=Object.create(null)}function _(e){n((function(){throw e}),0)}function j(e){this.type=e,this.target=void 0}function S(e,t){j.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){j.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,c=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==c&&(o(c),c=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in i)e=200,t="OK",n=i.contentType;else try{e=i.status,t=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},d=function(){c=n((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(c=n((function(){d()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(r,n,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,r,n,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},O.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===t&&(o=!0);o||n.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==t&&o.push(n[s]);0===o.length?delete r[e]:r[e]=o}},S.prototype=Object.create(j.prototype),A.prototype=Object.create(j.prototype),k.prototype=Object.create(j.prototype);var R=-1,F=0,P=1,I=2,M=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),U(r)},U=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){_(e)}};function B(e,t){O.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,r){t=String(t);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(r.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=r.headers||{},m=r.Transport,g=$&&null==m?void 0:new b(null!=m?new m:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=m&&"string"!=typeof m?new m:null==g?new T:new E,w=void 0,C=0,x=R,O="",_="",j="",B="",G=D,V=0,J=0,X=function(t,r,n,o){if(x===F)if(200===t&&null!=n&&W.test(n)){x=P,p=Date.now(),d=u,e.readyState=P;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onopen,s)}else{var i="";200!==t?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",Z();s=new A("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onerror,s),console.error(i)}},Y=function(t){if(x===P){for(var r=-1,s=0;s<t.length;s+=1){(c=t.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?B:"")+t.slice(0,r+1);B=(-1===r?B:"")+t.slice(r+1),""!==t&&(p=Date.now(),f+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(G===M&&c==="\n".charCodeAt(0))G=D;else if(G===M&&(G=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(G!==D){G===q&&(J=a+1);var y=i.slice(V,J-1),m=i.slice(J+(J<a&&i.charCodeAt(J)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=m):"id"===y?_=m:"event"===y?j=m:"retry"===y?(u=z(m,u),d=u):"heartbeatTimeout"===y&&(l=z(m,l),0!==C&&(o(C),C=n((function(){Q()}),l)))}if(G===D){if(""!==O){h=_,""===j&&(j="message");var g=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(g),"open"===j?L(e,e.onopen,g):"message"===j?L(e,e.onmessage,g):"error"===j&&L(e,e.onerror,g),x===I)return}O="",j=""}G=c==="\r".charCodeAt(0)?M:D}else G===D&&(V=a,G=q),G===q?c===":".charCodeAt(0)&&(J=a+1,G=N):G===N&&(G=H)}}},K=function(t){if(x===P||x===F){x=R,0!==C&&(o(C),C=0),C=n((function(){Q()}),d),d=U(Math.min(16*u,2*d)),e.readyState=F;var r=new k("error",{error:t});e.dispatchEvent(r),L(e,e.onerror,r),null!=t&&console.error(t)}},Z=function(){x=I,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=I},Q=function(){if(C=0,x===R){p=!1,f=0,C=n((function(){Q()}),l),x=F,O="",j="",_=h,B="",V=0,J=0,G=D;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u]);try{w=v.open(g,X,Y,K,r,s,i)}catch(e){throw Z(),e}}else if(p||null==w){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(x===F?"No response received.":f+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=F,e.withCredentials=a,e.headers=y,e._close=Z,Q()}(this,e,t)}var $=null!=h&&null!=d&&"body"in d.prototype;B.prototype=Object.create(O.prototype),B.prototype.CONNECTING=F,B.prototype.OPEN=P,B.prototype.CLOSED=I,B.prototype.close=function(){this._close()},B.CONNECTING=F,B.OPEN=P,B.CLOSED=I,B.prototype.withCredentials=void 0;var G,V=c;null==s||null!=c&&"withCredentials"in c.prototype||(V=B),G=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=c,e.EventSource=V}(t),void 0!==G&&(e.exports=G)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}(en,en.exports);var tn=a(en.exports.EventSourcePolyfill),rn=Object.freeze({__proto__:null,default:tn});e.BasePatch=st,e.BaseTransaction=gt,e.ClientError=Re,e.ObservablePatch=it,e.ObservableSanityClient=Yr,e.ObservableTransaction=bt,e.Patch=at,e.SanityClient=Kr,e.ServerError=Fe,e.Transaction=vt,e.createClient=e=>new Kr(Ne(Se,{maxRetries:e.maxRetries,retryDelay:e.retryDelay}),e),e.default=function(e){return er(),new Kr(Zr,e)},e.requester=Qr,e.unstable__adapter=_,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|