@sanity/client 4.0.0 → 4.0.1-1
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/sanityClient.browser.mjs +781 -932
- package/dist/sanityClient.browser.mjs.map +4 -4
- package/lib/assets/assetsClient.js +5 -4
- package/lib/data/dataMethods.js +10 -12
- package/lib/data/listen.js +3 -3
- package/lib/http/request.js +2 -2
- package/lib/sanityClient.js +6 -8
- package/package.json +7 -7
- package/sanityClient.d.ts +6 -6
- package/umd/sanityClient.js +5454 -188
- package/umd/sanityClient.min.js +14 -1
- package/lib/util/observable.js +0 -26
package/umd/sanityClient.min.js
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SanityClient=e()}}((function(){return function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return o(t[s][1][e]||e)}),l,l.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o,i=e("../util/observable"),s=(o=e("../http/queryString"))&&o.__esModule?o:{default:o},a=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(o,s,a):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}(e("../validators"));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,s,a=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(){return(f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e){this.client=e}function p(e,t){return"undefined"!=typeof window&&t instanceof window.File?f({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}f(d.prototype,{upload:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a.validateAssetType(e);var n=r.extract||void 0;n&&!n.length&&(n=["none"]);var o=a.hasDataset(this.client.clientConfig),s="image"===e?"images":"files",u=p(r,t),c=u.tag,l=u.label,f=u.title,d=u.description,h=u.creditLine,y=u.filename,b=u.source,v={label:l,title:f,description:d,filename:y,meta:n,creditLine:h};b&&(v.sourceId=b.id,v.sourceName=b.name,v.sourceUrl=b.url);var g=this.client._requestObservable({tag:c,method:"POST",timeout:u.timeout||0,uri:"/assets/".concat(s,"/").concat(o),headers:u.contentType?{"Content-Type":u.contentType}:{},query:v,body:t});return this.client.isPromiseAPI()?g.pipe((0,i.filter)((function(e){return"response"===e.type})),(0,i.map)((function(e){return e.body.document}))).toPromise():g},delete:function(e,t){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");var r=t||"";return/^(image|file)-/.test(r)?e._id&&(r=e._id):r="".concat(e,"-").concat(r),a.hasDataset(this.client.clientConfig),this.client.delete(r)},getImageUrl:function(e,t){var r=e._ref||e;if("string"!=typeof r)throw new Error("getImageUrl() needs either an object with a _ref, or a string with an asset document ID");if(!/^image-[A-Za-z0-9_]+-\d+x\d+-[a-z]{1,5}$/.test(r))throw new Error('Unsupported asset ID "'.concat(r,'". URL generation only works for auto-generated IDs.'));var n=c(r.split("-"),4),o=n[1],i=n[2],u=n[3];a.hasDataset(this.client.clientConfig);var l=this.client.clientConfig,f=l.projectId,d=l.dataset,p=t?(0,s.default)(t):"";return"https://cdn.sanity.io/images/".concat(f,"/").concat(d,"/").concat(o,"-").concat(i,".").concat(u).concat(p)}});var h=d;r.default=h,t.exports=r.default},{"../http/queryString":13,"../util/observable":21,"../validators":24}],2:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e){this.client=e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,n(o.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout",method:"POST"})}});var i=o;r.default=i,t.exports=r.default},{}],3:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.validateApiVersion=r.initConfig=r.defaultConfig=void 0;var o,i=(o=e("./generateHelpUrl"))&&o.__esModule?o:{default:o},s=c(e("./validators")),a=c(e("./warnings"));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(o,s,a):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var f={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0};r.defaultConfig=f;var d=["localhost","127.0.0.1","0.0.0.0"],p=function(e){if("1"!==e&&"X"!==e){var 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`")}};r.validateApiVersion=p;r.initConfig=function(e,t){var r=l({},t,e);r.apiVersion||a.printNoApiVersionSpecifiedWarning();var n=l({},f,r),o=n.useProjectHostname;if("undefined"==typeof Promise){var u=(0,i.default)("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(u))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");var c="undefined"!=typeof window&&window.location&&window.location.hostname,h=c&&function(e){return-1!==d.indexOf(e)}(window.location.hostname);c&&h&&n.token&&!0!==n.ignoreBrowserTokenWarning?a.printBrowserTokenWarning():void 0===n.useCdn&&a.printCdnWarning(),o&&s.projectId(n.projectId),n.dataset&&s.dataset(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?s.requestTag(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===f.apiHost,n.useCdn=Boolean(n.useCdn)&&!n.withCredentials,p(n.apiVersion);var y=n.apiHost.split("://",2),b=y[0],v=y[1],g=n.isDefaultApi?"apicdn.sanity.io":v;return n.useProjectHostname?(n.url="".concat(b,"://").concat(n.projectId,".").concat(v,"/v").concat(n.apiVersion),n.cdnUrl="".concat(b,"://").concat(n.projectId,".").concat(g,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n}},{"./generateHelpUrl":10,"./validators":24,"./warnings":25}],4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("../util/observable"),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==d(e)&&"function"!=typeof e)return{default:e};var r=f(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}(e("../validators")),i=l(e("../util/getSelection")),s=l(e("./encodeQueryString")),a=l(e("./transaction")),u=l(e("./patch")),c=l(e("./listen"));function l(e){return e&&e.__esModule?e:{default:e}}function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(f=function(e){return e?r:t})(e)}function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(){return(p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function h(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==d(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===d(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var y=function(e,t){return!1===e?void 0:void 0===e?t:e},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:y(e.returnDocuments,!0),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}},v=function(e){return"response"===e.type},g=function(e){return e.body},m=function(e,t){return e.reduce((function(e,r){return e[t(r)]=r,e}),Object.create(null))},w=function(e){return e.toPromise()},O={listen:c.default,getDataUrl:function(e,t){var r=this.clientConfig,n=o.hasDataset(r),i="/".concat(e,"/").concat(n),s=t?"".concat(i,"/").concat(t):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")},fetch:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=!1===r.filterResponse?function(e){return e}:function(e){return e.result},i=this._dataRequest("query",{query:e,params:t},r).pipe((0,n.map)(o));return this.isPromiseAPI()?w(i):i},getDocument:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",e),json:!0,tag:t.tag},o=this._requestObservable(r).pipe((0,n.filter)(v),(0,n.map)((function(e){return e.body.documents&&e.body.documents[0]})));return this.isPromiseAPI()?w(o):o},getDocuments:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",e.join(",")),json:!0,tag:t.tag},o=this._requestObservable(r).pipe((0,n.filter)(v),(0,n.map)((function(t){var r=m(t.body.documents||[],(function(e){return e._id}));return e.map((function(e){return r[e]||null}))})));return this.isPromiseAPI()?w(o):o},create:function(e,t){return this._create(e,"create",t)},createIfNotExists:function(e,t){return o.requireDocumentId("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace:function(e,t){return o.requireDocumentId("createOrReplace",e),this._create(e,"createOrReplace",t)},patch:function(e,t){return new u.default(e,t,this)},delete:function(e,t){return this.dataRequest("mutate",{mutations:[{delete:(0,i.default)(e)}]},t)},mutate:function(e,t){var r=e instanceof u.default||e instanceof a.default?e.serialize():e,n=Array.isArray(r)?r:[r],o=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},t)},transaction:function(e){return new a.default(e,this)},dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(e,t,r);return this.isPromiseAPI()?w(n):n},_dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="mutate"===e,i="query"===e,a=!o&&(0,s.default)(t),u=!o&&a.length<11264,c=u?a:"",l=r.returnFirst,f=r.timeout,d=r.token,p=r.tag,y=r.headers,m={method:u?"GET":"POST",uri:this.getDataUrl(e,c),json:!0,body:u?void 0:t,query:o&&b(r),timeout:f,headers:y,token:d,tag:p,canUseCdn:i};return this._requestObservable(m).pipe((0,n.filter)(v),(0,n.map)(g),(0,n.map)((function(e){if(!o)return e;var t=e.results||[];if(r.returnDocuments)return l?t[0]&&t[0].document:t.map((function(e){return e.document}));var n=l?"documentId":"documentIds",i=l?t[0]&&t[0].id:t.map((function(e){return e.id}));return h({transactionId:e.transactionId,results:t},n,i)})))},_create:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=h({},t,e),o=p({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},o)}};r.default=O,t.exports=r.default},{"../util/getSelection":20,"../util/observable":21,"../validators":24,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=["tag"];function o(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=encodeURIComponent;r.default=function(e){var t=e.query,r=e.params,s=void 0===r?{}:r,a=e.options,u=void 0===a?{}:a,c=u.tag,l=o(u,n),f="query=".concat(i(t)),d=c?"?tag=".concat(i(c),"&").concat(f):"?".concat(f),p=Object.keys(s).reduce((function(e,t){return"".concat(e,"&").concat(i("$".concat(t)),"=").concat(i(JSON.stringify(s[t])))}),d);return Object.keys(l).reduce((function(e,t){return u[t]?"".concat(e,"&").concat(i(t),"=").concat(i(u[t])):e}),p)},t.exports=r.default},{}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=this.clientConfig,u=o.url,c=o.token,l=o.withCredentials,f=o.requestTagPrefix,p=r.tag&&f?[f,r.tag].join("."):r.tag,m=d(d({},(0,s.default)(r,b)),{},{tag:p}),w=(0,i.default)(m,y),O=(0,a.default)({query:e,params:t,options:w,tag:p}),_="".concat(u).concat(this.getDataUrl("listen",O));if(_.length>14800)return new n.Observable((function(e){return e.error(new Error("Query too large for listener"))}));var j=m.events?m.events:["mutation"],C=-1!==j.indexOf("reconnect"),P={};return(c||l)&&(P.withCredentials=!0),c&&(P.headers={Authorization:"Bearer ".concat(c)}),new n.Observable((function(e){var t,r=c(),n=!1;function o(){n||(C&&e.next({type:"reconnect"}),n||r.readyState===h.CLOSED&&(u(),clearTimeout(t),t=setTimeout(l,100)))}function i(t){e.error(g(t))}function s(t){var r=v(t);return r instanceof Error?e.error(r):e.next(r)}function a(t){n=!0,u(),e.complete()}function u(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",i,!1),r.removeEventListener("disconnect",a,!1),j.forEach((function(e){return r.removeEventListener(e,s,!1)})),r.close()}function c(){var e=new h(_,P);return e.addEventListener("error",o,!1),e.addEventListener("channelError",i,!1),e.addEventListener("disconnect",a,!1),j.forEach((function(t){return e.addEventListener(t,s,!1)})),e}function l(){r=c()}return function(){n=!0,u()}}))};var n=e("../util/observable"),o=u(e("@sanity/eventsource")),i=u(e("../util/pick")),s=u(e("../util/defaults")),a=u(e("./encodeQueryString"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==c(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===c(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var h=o.default,y=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],b={includeResult:!0};function v(e){try{var t=e.data&&JSON.parse(e.data)||{};return l({type:e.type},t)}catch(e){return e}}function g(e){if(e instanceof Error)return e;var t=v(e);return t instanceof Error?t:new Error(function(e){return e.error?e.error.description?e.error.description:"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2):e.message||"Unknown listener error"}(t))}t.exports=r.default},{"../util/defaults":19,"../util/observable":21,"../util/pick":23,"./encodeQueryString":5,"@sanity/eventsource":26}],7:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o,i=(o=e("../util/getSelection"))&&o.__esModule?o:{default:o},s=e("../validators");function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=e,this.operations=u({},t),this.client=r}u(c.prototype,{clone:function(){return new c(this.selection,u({},this.operations),this.client)},set:function(e){return this.assign("set",e)},diffMatchPatch:function(e){return(0,s.validateObject)("diffMatchPatch",e),this.assign("diffMatchPatch",e)},unset:function(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=u({},this.operations,{unset:e}),this},setIfMissing:function(e){return this.assign("setIfMissing",e)},replace:function(e){return(0,s.validateObject)("replace",e),this._set("set",{$:e})},inc:function(e){return this.assign("inc",e)},dec:function(e){return this.assign("dec",e)},insert:function(e,t,r){var n;return(0,s.validateInsert)(e,t,r),this.assign("insert",(a(n={},e,t),a(n,"items",r),n))},append:function(e,t){return this.insert("after","".concat(e,"[-1]"),t)},prepend:function(e,t){return this.insert("before","".concat(e,"[0]"),t)},splice:function(e,t,r,n){var o=t<0?t-1:t,i=void 0===r||-1===r?-1:Math.max(0,t+r),s=o<0&&i>=0?"":i,a="".concat(e,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,n||[])},ifRevisionId:function(e){return this.operations.ifRevisionID=e,this},serialize:function(){return u((0,i.default)(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");var t=u({returnFirst:"string"==typeof this.selection,returnDocuments:!0},e);return this.client.mutate({patch:this.serialize()},t)},reset:function(){return this.operations={},this},_set:function(e,t){return this.assign(e,t,!1)},assign:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(0,s.validateObject)(e,t),this.operations=u({},this.operations,a({},e,u({},r&&this.operations[e]||{},t))),this}});var l=c;r.default=l,t.exports=r.default},{"../util/getSelection":20,"../validators":24}],8:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o,i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=i?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(o,s,u):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}(e("../validators")),s=(o=e("./patch"))&&o.__esModule?o:{default:o};function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}function u(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var l={returnDocuments:!1};function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.trxId=r,this.operations=e,this.client=t}c(f.prototype,{clone:function(){return new f(this.operations.slice(0),this.client,this.trxId)},create:function(e){return i.validateObject("create",e),this._add({create:e})},createIfNotExists:function(e){var t="createIfNotExists";return i.validateObject(t,e),i.requireDocumentId(t,e),this._add(u({},t,e))},createOrReplace:function(e){var t="createOrReplace";return i.validateObject(t,e),i.requireDocumentId(t,e),this._add(u({},t,e))},delete:function(e){return i.validateDocumentId("delete",e),this._add({delete:{id:e}})},patch:function(e,t){var r="function"==typeof t;if(e instanceof s.default)return this._add({patch:e.serialize()});if(r){var n=t(new s.default(e,{},this.client));if(!(n instanceof s.default))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:c({id:e},t)})},transactionId:function(e){return e?(this.trxId=e,this):this.trxId},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(e){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),c({transactionId:this.trxId},l,e||{}))},reset:function(){return this.operations=[],this},_add:function(e){return this.operations.push(e),this}});var d=f;r.default=d,t.exports=r.default},{"../validators":24,"./patch":7}],9:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var u=s?Object.getOwnPropertyDescriptor(e,a):null;u&&(u.get||u.set)?Object.defineProperty(o,a,u):o[a]=e[a]}return o.default=e,r&&r.set(e,o),o}(e("../validators"));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e){this.request=e.request.bind(e)}s(a.prototype,{create:function(e,t){return this._modify("PUT",e,t)},edit:function(e,t){return this._modify("PATCH",e,t)},delete:function(e){return this._modify("DELETE",e)},list:function(){return this.request({uri:"/datasets"})},_modify:function(e,t,r){return o.dataset(t),this.request({method:e,uri:"/datasets/".concat(t),body:r})}});var u=a;r.default=u,t.exports=r.default},{"../validators":24}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return"https://docs.sanity.io/help/"+e};t.exports=r.default},{}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=[],t.exports=r.default},{}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ClientError=s,r.ServerError=a;var n,o=(n=e("make-error"))&&n.__esModule?n:{default:n};function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function s(e){var t=u(e);s.super.call(this,t.message),i(this,t)}function a(e){var t=u(e);a.super.call(this,t.message),i(this,t)}function u(e){var t=e.body,r={response:e,statusCode:e.statusCode,responseBody:c(t,e)};return t.error&&t.message?(r.message="".concat(t.error," - ").concat(t.message),r):t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){var 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 c(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}(0,o.default)(s),(0,o.default)(a)},{"make-error":63}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(e[r])));return t.length>0?"?".concat(t.join("&")):""},t.exports=r.default},{}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=a(e("get-it")),o=e("get-it/middleware"),i=e("../util/observable"),s=e("./errors");function a(e){return e&&e.__esModule?e:{default:e}}function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var c={onResponse:function(e){if(e.statusCode>=500)throw new s.ServerError(e);if(e.statusCode>=400)throw new s.ClientError(e);return e}},l={onResponse:function(e){var t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((function(e){return console.warn(e)})),e}},f=a(e("./nodeMiddleware")).default.concat([l,(0,o.jsonRequest)(),(0,o.jsonResponse)(),(0,o.progress)(),c,(0,o.observable)({implementation:i.Observable})]),d=(0,n.default)(f);function p(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:d)(u({maxRedirects:0},e))}p.defaultRequester=d,p.ClientError=s.ClientError,p.ServerError=s.ServerError;var h=p;r.default=h,t.exports=r.default},{"../util/observable":21,"./errors":12,"./nodeMiddleware":11,"get-it":33,"get-it/middleware":43}],15:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o="X-Sanity-Project-ID";r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=t.token||e.token;i&&(r.Authorization="Bearer ".concat(i)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[o]=e.projectId);var s=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),a=void 0===t.timeout?e.timeout:t.timeout;return n({},t,{headers:n({},r,t.headers||{}),timeout:void 0===a?3e5:a,proxy:t.proxy||e.proxy,json:!0,withCredentials:s})},t.exports=r.default},{}],16:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e){this.client=e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,n(o.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(e){return this.client.request({uri:"/projects/".concat(e)})}});var i=o;r.default=i,t.exports=r.default},{}],17:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=e("./util/observable"),i=g(e("./data/patch")),s=g(e("./data/transaction")),a=g(e("./data/dataMethods")),u=g(e("./datasets/datasetsClient")),c=g(e("./projects/projectsClient")),l=g(e("./assets/assetsClient")),f=g(e("./users/usersClient")),d=g(e("./auth/authClient")),p=g(e("./http/request")),h=g(e("./http/requestOptions")),y=e("./config"),b=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=v(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(o,s,a):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}(e("./validators"));function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(v=function(e){return e?r:t})(e)}function g(e){return e&&e.__esModule?e:{default:e}}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function O(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function j(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y.defaultConfig;if(!(this instanceof j))return new j(e);if(this.config(e),this.assets=new l.default(this),this.datasets=new u.default(this),this.projects=new c.default(this),this.users=new f.default(this),this.auth=new d.default(this),this.clientConfig.isPromiseAPI){var t=_({},this.clientConfig,{isPromiseAPI:!1});this.observable=new j(t)}}_(j.prototype,a.default),_(j.prototype,{clone:function(){return new j(this.config())},config:function(e){if(void 0===e)return _({},this.clientConfig);if(this.clientConfig&&!1===this.clientConfig.allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");if(this.observable){var t=_({},e,{isPromiseAPI:!1});this.observable.config(t)}return this.clientConfig=(0,y.initConfig)(e,this.clientConfig||{}),this},withConfig:function(e){return new j(w(w({},this.config()),e))},getUrl:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.clientConfig.cdnUrl:this.clientConfig.url;return"".concat(t,"/").concat(e.replace(/^\//,""))},isPromiseAPI:function(){return this.clientConfig.isPromiseAPI},_requestObservable:function(e){var t=this,r=e.url||e.uri,n=void 0===e.canUseCdn?["GET","HEAD"].indexOf(e.method||"GET")>=0&&0===r.indexOf("/data/"):e.canUseCdn,i=this.clientConfig.useCdn&&n,s=e.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,e.tag].join("."):e.tag||this.clientConfig.requestTagPrefix;s&&(e.query=w({tag:b.requestTag(s)},e.query));var a=(0,h.default)(this.clientConfig,_({},e,{url:this.getUrl(r,i)}));return new o.Observable((function(e){return(0,p.default)(a,t.clientConfig.requester).subscribe(e)}))},request:function(e){var t=this._requestObservable(e).pipe((0,o.filter)((function(e){return"response"===e.type})),(0,o.map)((function(e){return e.body})));return this.isPromiseAPI()?function(e){return e.toPromise()}(t):t}}),j.Patch=i.default,j.Transaction=s.default,j.ClientError=p.default.ClientError,j.ServerError=p.default.ServerError,j.requester=p.default.defaultRequester;var C=j;r.default=C,t.exports=r.default},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":14,"./http/requestOptions":15,"./projects/projectsClient":16,"./users/usersClient":18,"./util/observable":21,"./validators":24}],18:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e){this.client=e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,n(o.prototype,{getById:function(e){return this.client.request({uri:"/users/".concat(e)})}});var i=o;r.default=i,t.exports=r.default},{}],19:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e,t){return Object.keys(t).concat(Object.keys(e)).reduce((function(r,n){return r[n]=void 0===e[n]?t[n]:e[n],r}),{})},t.exports=r.default},{}],20:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){if("string"==typeof e||Array.isArray(e))return{id:e};if(e&&e.query)return"params"in e?{query:e.query,params:e.params}:{query:e.query};var 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))},t.exports=r.default},{}],21:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"Observable",{enumerable:!0,get:function(){return n.Observable}}),Object.defineProperty(r,"filter",{enumerable:!0,get:function(){return o.filter}}),Object.defineProperty(r,"map",{enumerable:!0,get:function(){return i.map}});var n=e("rxjs/internal/Observable"),o=e("rxjs/internal/operators/filter"),i=e("rxjs/internal/operators/map")},{"rxjs/internal/Observable":70,"rxjs/internal/operators/filter":75,"rxjs/internal/operators/map":76}],22:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e){var t,r=!1;return function(){return r||(t=e.apply(void 0,arguments),r=!0),t}},t.exports=r.default},{}],23:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e,t){return t.reduce((function(t,r){return void 0===e[r]||(t[r]=e[r]),t}),{})},t.exports=r.default},{}],24:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.validateObject=r.validateInsert=r.validateDocumentId=r.validateAssetType=r.requireDocumentId=r.requestTag=r.projectId=r.hasDataset=r.dataset=void 0;var o=["image","file"],i=["before","after","replace"];r.dataset=function(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")};r.projectId=function(e){if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")};r.validateAssetType=function(e){if(-1===o.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(o.join(", ")))};r.validateObject=function(e,t){if(null===t||"object"!==n(t)||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))};var s=function(e,t){if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))};r.validateDocumentId=s;r.requireDocumentId=function(e,t){if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));s(e,t._id)};r.validateInsert=function(e,t,r){var n="insert(at, selector, items)";if(-1===i.indexOf(e)){var o=i.map((function(e){return'"'.concat(e,'"')})).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(o))}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'))};r.hasDataset=function(e){if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""};r.requestTag=function(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}},{}],25:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.printNoApiVersionSpecifiedWarning=r.printCdnWarning=r.printBrowserTokenWarning=void 0;var n=i(e("./generateHelpUrl")),o=i(e("./util/once"));function i(e){return e&&e.__esModule?e:{default:e}}var s=function(e){return(0,o.default)((function(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=console).warn.apply(t,[e.join(" ")].concat(n))}))},a=s(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat((0,n.default)("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]);r.printCdnWarning=a;var u=s(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat((0,n.default)("js-client-browser-token")," for more information and how to hide this warning.")]);r.printBrowserTokenWarning=u;var c=s(["Using the Sanity client without specifying an API version is deprecated.","See ".concat((0,n.default)("js-client-api-version"))]);r.printNoApiVersionSpecifiedWarning=c},{"./generateHelpUrl":10,"./util/once":22}],26:[function(e,t,r){var n=e("event-source-polyfill");t.exports=n.EventSourcePolyfill},{"event-source-polyfill":31}],27:[function(e,t,r){"use strict";t.exports=Error.captureStackTrace||function(e){var t=new Error;Object.defineProperty(e,"stack",{configurable:!0,get:function(){var e=t.stack;return Object.defineProperty(this,"stack",{value:e}),e}})}},{}],28:[function(e,t,r){"use strict";var n=e("capture-stack-trace");t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(e))throw new Error("className contains invalid characters");t=t||function(e){this.message=e};var r=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),n(this,this.constructor),t.apply(this,arguments)};return function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}(r,Error),r}},{"capture-stack-trace":27}],29:[function(e,t,r){(function(n){(function(){r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e},r.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("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+)/))},r.storage=function(){try{return localStorage}catch(e){}}(),r.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`."))}})(),r.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"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:o}=t.exports;o.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":30,_process:67}],30:[function(e,t,r){t.exports=function(t){function r(e){let t,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(t||o);n.diff=i,n.prev=t,n.curr=o,t=o,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,o)=>{if("%%"===t)return"%";s++;const i=r.formatters[o];if("function"==typeof i){const r=e[s];t=i.call(n,r),e.splice(s,1),s--}return t})),r.formatArgs.call(n,e),(n.log||r.log).apply(n,e)}return a.namespace=e,a.useColors=r.useColors(),a.color=r.selectColor(e),a.extend=n,a.destroy=r.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==r.namespaces&&(o=r.namespaces,i=r.enabled(e)),i),set:e=>{s=e}}),"function"==typeof r.init&&r.init(a),a}function n(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(o),...r.skips.map(o).map((e=>"-"+e))].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.namespaces=e,r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.slice(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.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(t).forEach((e=>{r[e]=t[e]})),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:64}],31:[function(e,t,r){!function(e){"use strict";var n=e.setTimeout,o=e.clearTimeout,i=e.XMLHttpRequest,s=e.XDomainRequest,a=e.ActiveXObject,u=e.EventSource,c=e.document,l=e.Promise,f=e.fetch,d=e.Response,p=e.TextDecoder,h=e.TextEncoder,y=e.AbortController;if("undefined"==typeof window||void 0===c||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==i&&null!=a&&(i=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 b=f;f=function(e,t){var r=t.signal;return b(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 v(){this.bitsNeeded=0,this.codePoint=0}v.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="",o=this.bitsNeeded,i=this.codePoint,s=0;s<e.length;s+=1){var a=e[s];0!==o&&(a<128||a>191||!t(i<<6|63&a,o-6,r(o,i)))&&(o=0,i=65533,n+=String.fromCharCode(i)),0===o?(a>=0&&a<=127?(o=0,i=a):a>=192&&a<=223?(o=6,i=31&a):a>=224&&a<=239?(o=12,i=15&a):a>=240&&a<=247?(o=18,i=7&a):(o=0,i=65533),0===o||t(i,o,r(o,i))||(o=0,i=65533)):(o-=6,i=i<<6|63&a),0===o&&(i<=65535?n+=String.fromCharCode(i):(n+=String.fromCharCode(55296+(i-65535-1>>10)),n+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=o,this.codePoint=i,n},null!=p&&null!=h&&function(){try{return"test"===(new p).decode((new h).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=v);var g=function(){};function m(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=g,this.onload=g,this.onerror=g,this.onreadystatechange=g,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=g}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function O(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),i=o.shift(),s=o.join(": ");t[w(i)]=s}this._map=t}function _(){}function j(e){this._headers=e}function C(){}function P(){this._listeners=Object.create(null)}function E(e){n((function(){throw e}),0)}function S(e){this.type=e,this.target=void 0}function x(e,t){S.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function T(e,t){S.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function M(e,t){S.call(this,e),this.error=t.error}m.prototype.open=function(e,t){this._abort(!0);var r=this,s=this._xhr,a=1,u=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=g,s.onerror=g,s.onabort=g,s.onprogress=g,s.onreadystatechange=g,s.abort(),0!==u&&(o(u),u=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in s)e=200,t="OK",n=s.contentType;else try{e=s.status,t=s.statusText,n=s.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(c(),2===a||3===a){a=3;var e="";try{e=s.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},f=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:g}),l(),1===a||2===a||3===a){if(a=4,0!==u&&(o(u),u=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(){u=n((function(){d()}),500),3===s.readyState&&l()};"onload"in s&&(s.onload=function(e){f("load",e)}),"onerror"in s&&(s.onerror=function(e){f("error",e)}),"onabort"in s&&(s.onabort=function(e){f("abort",e)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||f(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||l():2===s.readyState&&c())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(u=n((function(){d()}),0))},m.prototype.abort=function(){this._abort(!1)},m.prototype.getResponseHeader=function(e){return this._contentType},m.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},m.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},m.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==c||null==c.readyState||"complete"===c.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)}},O.prototype.get=function(e){return this._map[w(e)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),_.prototype.open=function(e,t,r,n,o,s,a){e.open("GET",o);var u=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(u);u+=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===i.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(r,n,o,new O(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},j.prototype.get=function(e){return this._headers.get(e)},C.prototype.open=function(e,t,r,n,o,i,s){var a=null,u=new y,c=u.signal,d=new p;return f(o,{headers:s,credentials:i?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new j(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(),u.abort()}}},P.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(e)}}},P.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,i=0;i<n.length;i+=1)n[i]===t&&(o=!0);o||n.push(t)},P.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],i=0;i<n.length;i+=1)n[i]!==t&&o.push(n[i]);0===o.length?delete r[e]:r[e]=o}},x.prototype=Object.create(S.prototype),T.prototype=Object.create(S.prototype),M.prototype=Object.create(S.prototype);var R=/^text\/event\-stream(;.*)?$/i,q=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),A(r)},A=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){E(e)}};function I(e,t){P.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),u=r.lastEventIdQueryParameterName||"lastEventId",c=A(1e3),l=q(r.heartbeatTimeout,45e3),f="",d=c,p=!1,h=0,y=r.headers||{},b=r.Transport,v=k&&null==b?void 0:new m(null!=b?new b:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),g=null!=b&&"string"!=typeof b?new b:null==v?new C:new _,w=void 0,O=0,j=-1,P="",E="",S="",I="",F=0,U=0,N=0,H=function(t,r,n,o){if(0===j)if(200===t&&null!=n&&R.test(n)){j=1,p=Date.now(),d=c,e.readyState=1;var i=new T("open",{status:t,statusText:r,headers:o});e.dispatchEvent(i),D(e,e.onopen,i)}else{var s="";200!==t?(r&&(r=r.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",B();i=new T("error",{status:t,statusText:r,headers:o});e.dispatchEvent(i),D(e,e.onerror,i),console.error(s)}},L=function(t){if(1===j){for(var r=-1,i=0;i<t.length;i+=1){(u=t.charCodeAt(i))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(r=i)}var s=(-1!==r?I:"")+t.slice(0,r+1);I=(-1===r?I:"")+t.slice(r+1),""!==t&&(p=Date.now(),h+=t.length);for(var a=0;a<s.length;a+=1){var u=s.charCodeAt(a);if(-1===F&&u==="\n".charCodeAt(0))F=0;else if(-1===F&&(F=0),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(0!==F){1===F&&(N=a+1);var y=s.slice(U,N-1),b=s.slice(N+(N<a&&s.charCodeAt(N)===" ".charCodeAt(0)?1:0),a);"data"===y?(P+="\n",P+=b):"id"===y?E=b:"event"===y?S=b:"retry"===y?(c=q(b,c),d=c):"heartbeatTimeout"===y&&(l=q(b,l),0!==O&&(o(O),O=n((function(){W()}),l)))}if(0===F){if(""!==P){f=E,""===S&&(S="message");var v=new x(S,{data:P.slice(1),lastEventId:E});if(e.dispatchEvent(v),"open"===S?D(e,e.onopen,v):"message"===S?D(e,e.onmessage,v):"error"===S&&D(e,e.onerror,v),2===j)return}P="",S=""}F=u==="\r".charCodeAt(0)?-1:0}else 0===F&&(U=a,F=1),1===F?u===":".charCodeAt(0)&&(N=a+1,F=2):2===F&&(F=3)}}},z=function(t){if(1===j||0===j){j=-1,0!==O&&(o(O),O=0),O=n((function(){W()}),d),d=A(Math.min(16*c,2*d)),e.readyState=0;var r=new M("error",{error:t});e.dispatchEvent(r),D(e,e.onerror,r),null!=t&&console.error(t)}},B=function(){j=2,null!=w&&(w.abort(),w=void 0),0!==O&&(o(O),O=0),e.readyState=2},W=function(){if(O=0,-1===j){p=!1,h=0,O=n((function(){W()}),l),j=0,P="",S="",E=f,I="",U=0,N=0,F=0;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==f){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===u?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+u+"="+encodeURIComponent(f)}var i=e.withCredentials,s={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(s[c]=a[c]);try{w=g.open(v,H,L,z,r,i,s)}catch(e){throw B(),e}}else if(p||null==w){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,O=n((function(){W()}),d)}else z(new Error("No activity within "+l+" milliseconds. "+(0===j?"No response received.":h+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=B,W()}(this,e,t)}var k=null!=f&&null!=d&&"body"in d.prototype;I.prototype=Object.create(P.prototype),I.prototype.CONNECTING=0,I.prototype.OPEN=1,I.prototype.CLOSED=2,I.prototype.close=function(){this._close()},I.CONNECTING=0,I.OPEN=1,I.CLOSED=2,I.prototype.withCredentials=void 0;var F=u;null==i||null!=u&&"withCredentials"in u.prototype||(F=I),function(n){if("object"==typeof t&&"object"==typeof t.exports){var o=n(r);void 0!==o&&(t.exports=o)}else n(e)}((function(e){e.EventSourcePolyfill=I,e.NativeEventSource=u,e.EventSource=F}))}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:this:globalThis)},{}],32:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Boolean(t.sorted),o=Boolean(t.skipIndex),i=Boolean(t.ignorenull),s=function(e){return String(e).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,(function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()}))},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(e);return r?t.sort():t},u=function(e){return e.filter((function(e){return e})).join("&")},c=function(e,t){return u(a(t).map((function(r){return f(e+"["+r+"]",t[r])})))},l=function(e,t){return t.length?u(t.map((function(t,r){return f(o?e+"[]":e+"["+r+"]",t)}))):s(e+"[]")},f=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0===t?"undefined":n(t),o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t===o?o=i?o:s(e)+"="+o:/string|number|boolean/.test(r)?o=s(e)+"="+s(t):Array.isArray(t)?o=l(e,t):"object"===r&&(o=c(e,t)),o};return e&&u(a(e).map((function(t){return f(t,e[t])})))}},{}],33:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.default,n=[],u=f.reduce((function(e,t){return e[t]=e[t]||[],e}),{processOptions:[i.default],validateOptions:[s.default]});function d(e){var t=l.reduce((function(e,t){return e[t]=c(),e}),{}),n=(0,o.default)(u),i=n("processOptions",e);n("validateOptions",i);var s={options:i,channels:t,applyMiddleware:n},a=null,f=t.request.subscribe((function(e){a=r(e,(function(r,o){return function(e,r,o){var i=e,s=r;if(!i)try{s=n("onResponse",r,o)}catch(e){s=null,i=e}(i=i&&n("onError",i,o))?t.error.publish(i):s&&t.response.publish(s)}(r,o,e)}))}));t.abort.subscribe((function(){f(),a&&a.abort()}));var d=n("onReturn",t,s);return d===t&&t.request.publish(s),d}return d.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&&u.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 f.forEach((function(t){e[t]&&u[t].push(e[t])})),n.push(e),d},d.clone=function(){return e(n)},t.forEach(d.use),d};var n=u(e("nano-pubsub")),o=u(e("./util/middlewareReducer")),i=u(e("./middleware/defaultOptionsProcessor")),s=u(e("./middleware/defaultOptionsValidator")),a=u(e("./request"));function u(e){return e&&e.__esModule?e:{default:e}}var c="default"in n.default?n.default.default:n.default,l=["request","response","progress","error","abort"],f=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];t.exports=r.default},{"./middleware/defaultOptionsProcessor":39,"./middleware/defaultOptionsValidator":40,"./request":58,"./util/middlewareReducer":61,"nano-pubsub":65}],34:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=/^\//,i=/\/$/;r.default=function(e){var t=e.replace(i,"");return{processOptions:function(e){if(/^https?:\/\//i.test(e.url))return e;var r=[t,e.url.replace(o,"")].join("/");return n({},e,{url:r})}}},t.exports=r.default},{}],35:[function(e,t,r){"use strict";function n(e){this.message=e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,n.prototype.toString=function(){return"Cancel".concat(this.message?": ".concat(this.message):"")},n.prototype.__CANCEL__=!0;var o=n;r.default=o,t.exports=r.default},{}],36:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("./Cancel");function o(e){var t=this;if("function"!=typeof e)throw new TypeError("executor must be a function.");var r=null;this.promise=new Promise((function(e){r=e})),e((function(e){t.reason||(t.reason=new n(e),r(t.reason))}))}o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}};var i=o;r.default=i,t.exports=r.default},{"./Cancel":35}],37:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e){return!(!e||!e.__CANCEL__)},t.exports=r.default},{}],38:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,o=(n=e("debug"))&&n.__esModule?n:{default:n};var i=["cookie","authorization"],s=Object.prototype.hasOwnProperty,a=function(e,t){var r={};for(var n in e)s.call(e,n)&&(r[n]=t.indexOf(n.toLowerCase())>-1?"<redacted>":e[n]);return r};function u(e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?function(e){try{var t="string"==typeof e?JSON.parse(e):e;return JSON.stringify(t,null,2)}catch(t){return e}}(e.body):e.body}r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.verbose,r=e.namespace||"get-it",n=(0,o.default)(r),s=e.log||n,c=s===n&&!o.default.enabled(r),l=0;return{processOptions:function(e){return e.debug=s,e.requestId=e.requestId||++l,e},onRequest:function(r){if(c||!r)return r;var n=r.options;if(s("[%s] HTTP %s %s",n.requestId,n.method,n.url),t&&n.body&&"string"==typeof n.body&&s("[%s] Request body: %s",n.requestId,n.body),t&&n.headers){var o=!1===e.redactSensitiveHeaders?n.headers:a(n.headers,i);s("[%s] Request headers: %s",n.requestId,JSON.stringify(o,null,2))}return r},onResponse:function(e,r){if(c||!e)return e;var n=r.options.requestId;return s("[%s] Response code: %s %s",n,e.statusCode,e.statusMessage),t&&e.body&&s("[%s] Response body: %s",n,u(e)),e},onError:function(e,t){var r=t.options.requestId;return e?(s("[%s] ERROR: %s",r,e.message),e):(s("[%s] Error encountered, but handled by an earlier middleware",r),e)}}},t.exports=r.default},{debug:29}],39:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,o=(n=e("url-parse"))&&n.__esModule?n:{default:n};function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var s="undefined"!=typeof navigator&&"ReactNative"===navigator.product,a=Object.prototype.hasOwnProperty,u={timeout:s?6e4:12e4};function c(e){var t=[];for(var r in e)a.call(e,r)&&n(r,e[r]);return t.length?t.join("&"):"";function n(e,r){Array.isArray(r)?r.forEach((function(t){return n(e,t)})):t.push([e,r].map(encodeURIComponent).join("="))}}function l(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?l(u.timeout):{connect:t,socket:t}}r.default=function(e){var t="string"==typeof e?i({url:e},u):i({},u,e),r=(0,o.default)(t.url,{},!0);return t.timeout=l(t.timeout),t.query&&(r.query=i({},r.query,function(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(c),t},t.exports=r.default},{"url-parse":90}],40:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=/^https?:\/\//i;r.default=function(e){if(!n.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))},t.exports=r.default},{}],41:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{processOptions:function(r){var o=r.headers||{};return r.headers=t.override?n({},o,e):n({},e,o),r}}},t.exports=r.default},{}],42:[function(e,t,r){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=(0,((n=e("create-error-class"))&&n.__esModule?n:{default:n}).default)("HttpError",(function(e,t){var r=e.url.length>400?"".concat(e.url.slice(0,399),"…"):e.url,n="".concat(e.method,"-request to ").concat(r," resulted in ");n+="HTTP ".concat(e.statusCode," ").concat(e.statusMessage),this.message=n.trim(),this.response=e,this.request=t.options}));r.default=function(){return{onResponse:function(e,t){if(!(e.statusCode>=400))return e;throw new o(e,t)}}},t.exports=r.default},{"create-error-class":28}],43:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"base",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"debug",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(r,"headers",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(r,"httpErrors",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"injectResponse",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(r,"jsonRequest",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"jsonResponse",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"keepAlive",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(r,"mtls",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(r,"observable",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"progress",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(r,"promise",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"proxy",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(r,"retry",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"urlEncoded",{enumerable:!0,get:function(){return h.default}});var n=g(e("./base")),o=g(e("./debug")),i=g(e("./jsonRequest")),s=g(e("./jsonResponse")),a=g(e("./httpErrors")),u=g(e("./retry")),c=g(e("./promise")),l=g(e("./observable")),f=g(e("./progress")),d=g(e("./headers")),p=g(e("./injectResponse")),h=g(e("./urlEncoded")),y=g(e("./proxy")),b=g(e("./keepAlive")),v=g(e("./mtls"));function g(e){return e&&e.__esModule?e:{default:e}}},{"./base":34,"./debug":38,"./headers":41,"./httpErrors":42,"./injectResponse":44,"./jsonRequest":45,"./jsonResponse":46,"./keepAlive":47,"./mtls":48,"./observable":49,"./progress":51,"./promise":52,"./proxy":53,"./retry":54,"./urlEncoded":55}],44:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("function"!=typeof e.inject)throw new Error("`injectResponse` middleware requires a `inject` function");return{interceptRequest:function(t,r){var o=e.inject(r,t);if(!o)return t;var i=r.context.options;return n({},{body:"",url:i.url,method:i.method,headers:{},statusCode:200,statusMessage:"OK"},o)}}},t.exports=r.default},{}],45:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("is-plain-object");function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s=["boolean","string","number"];r.default=function(){return{processOptions:function(e){var t=e.body;return t&&"function"!=typeof t.pipe&&!function(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}(t)&&(-1!==s.indexOf(i(t))||Array.isArray(t)||(0,n.isPlainObject)(t))?o({},e,{body:JSON.stringify(e.body),headers:o({},e.headers,{"Content-Type":"application/json"})}):e}}},t.exports=r.default},{"is-plain-object":62}],46:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;function o(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}r.default=function(e){return{onResponse:function(t){var r=t.headers["content-type"]||"",i=e&&e.force||-1!==r.indexOf("application/json");return t.body&&r&&i?n({},t,{body:o(t.body)}):t},processOptions:function(e){return n({},e,{headers:n({Accept:"application/json"},e.headers)})}}},t.exports=r.default},{}],47:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){},t.exports=r.default},{}],48:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.ca)throw new Error('Required mtls option "ca" is missing');if(!e.cert)throw new Error('Required mtls option "cert" is missing');if(!e.key)throw new Error('Required mtls option "key" is missing');return{finalizeOptions:function(t){return n({},t,{cert:e.cert,key:e.key,ca:e.ca})}}},t.exports=r.default},{}],49:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,o=(n=e("../util/global"))&&n.__esModule?n:{default:n};function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.default=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||o.default.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(t,r){return new e((function(e){return t.error.subscribe((function(t){return e.error(t)})),t.progress.subscribe((function(t){return e.next(i({type:"progress"},t))})),t.response.subscribe((function(t){e.next(i({type:"response"},t)),e.complete()})),t.request.publish(r),function(){return t.abort.publish()}}))}}},t.exports=r.default},{"../util/global":60}],50:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){return{onRequest:function(e){if("xhr"===e.adapter){var t=e.request,r=e.context;"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}function n(e){return function(t){var 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})}}}}},t.exports=r.default},{}],51:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return o.default}});var n,o=(n=e("./node-progress"))&&n.__esModule?n:{default:n};t.exports=r.default},{"./node-progress":50}],52:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=s(e("./cancel/Cancel")),o=s(e("./cancel/CancelToken")),i=s(e("./cancel/isCancel"));function s(e){return e&&e.__esModule?e:{default:e}}var a="function"==typeof Promise&&Promise,u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.implementation||a;if(!t)throw new Error("`Promise` is not available in global scope, and no implementation was passed");return{onReturn:function(r,n){return new t((function(t,o){var i=n.options.cancelToken;i&&i.promise.then((function(e){r.abort.publish(e),o(e)})),r.error.subscribe(o),r.response.subscribe((function(r){t(e.onlyBody?r.body:r)})),setTimeout((function(){try{r.request.publish(n)}catch(e){o(e)}}),0)}))}}};u.Cancel=n.default,u.CancelToken=o.default,u.isCancel=i.default;var c=u;r.default=c,t.exports=r.default},{"./cancel/Cancel":35,"./cancel/CancelToken":36,"./cancel/isCancel":37}],53:[function(e,t,r){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e){if(!(!1===e||e&&e.host))throw new Error("Proxy middleware takes an object of host, port and auth properties");return{processOptions:function(t){return n({proxy:e},t)}}},t.exports=r.default},{}],54:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,o=(n=e("../util/node-shouldRetry"))&&n.__esModule?n:{default:n};function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=function(e){return null!==e&&"object"===s(e)&&"function"==typeof e.pipe},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxRetries||5,r=e.retryDelay||l,n=e.shouldRetry||o.default;return{onError:function(e,o){var s=o.options,u=s.maxRetries||t,c=s.shouldRetry||n,l=s.attemptNumber||0;if(a(s.body))return e;if(!c(e,l,s)||l>=u)return e;var f=i({},o,{options:i({},s,{attemptNumber:l+1})});return setTimeout((function(){return o.channels.request.publish(f)}),r(l)),null}}};u.shouldRetry=o.default;var c=u;function l(e){return 100*Math.pow(2,e)+100*Math.random()}r.default=c,t.exports=r.default},{"../util/node-shouldRetry":59}],55:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,o=e("is-plain-object"),i=(n=e("form-urlencoded"))&&n.__esModule?n:{default:n};function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var a=i.default.default||i.default;r.default=function(){return{processOptions:function(e){var t=e.body;return t&&"function"!=typeof t.pipe&&!function(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}(t)&&(0,o.isPlainObject)(t)?s({},e,{body:a(e.body),headers:s({},e.headers,{"Content-Type":"application/x-www-form-urlencoded"})}):e}}},t.exports=r.default},{"form-urlencoded":32,"is-plain-object":62}],56:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=s(e("same-origin")),o=s(e("parse-headers")),i=s(e("./browser/fetchXhr"));function s(e){return e&&e.__esModule?e:{default:e}}var a="undefined"==typeof document||"undefined"==typeof window?void 0:window,u=a?"xhr":"fetch",c="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},l="withCredentials"in new c,f="undefined"==typeof XDomainRequest?void 0:XDomainRequest,d=l?c:f;a||(c=i.default,d=i.default);r.default=function(e,t){var r=e.options,i=e.applyMiddleware("finalizeOptions",r),s={},l=a&&a.location&&!(0,n.default)(a.location.href,i.url),f=e.applyMiddleware("interceptRequest",void 0,{adapter:u,context:e});if(f){var p=setTimeout(t,0,null,f);return{abort:function(){return clearTimeout(p)}}}var h=l?new d:new c,y=a&&a.XDomainRequest&&h instanceof a.XDomainRequest,b=i.headers,v=i.timeout,g=!1,m=!1,w=!1;if(h.onerror=C,h.ontimeout=C,h.onabort=function(){j(!0),g=!0},h.onprogress=function(){},h[y?"onload":"onreadystatechange"]=function(){v&&(j(),s.socket=setTimeout((function(){return _("ESOCKETTIMEDOUT")}),v.socket)),g||4!==h.readyState&&!y||0!==h.status&&(g||m||w||(0!==h.status?(j(),m=!0,t(null,function(){var e=h.status,t=h.statusText;if(y&&void 0===e)e=200;else{if(e>12e3&&e<12156)return C();e=1223===h.status?204:h.status,t=1223===h.status?"No Content":t}return{body:h.response||h.responseText,url:i.url,method:i.method,headers:y?{}:(0,o.default)(h.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())):C(new Error("Unknown XHR error"))))},h.open(i.method,i.url,!0),h.withCredentials=!!i.withCredentials,b&&h.setRequestHeader)for(var O in b)b.hasOwnProperty(O)&&h.setRequestHeader(O,b[O]);else if(b&&y)throw new Error("Headers cannot be set on an XDomainRequest object");return i.rawBody&&(h.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:i,adapter:u,request:h,context:e}),h.send(i.body||null),v&&(s.connect=setTimeout((function(){return _("ETIMEDOUT")}),v.connect)),{abort:function(){g=!0,h&&h.abort()}};function _(t){w=!0,h.abort();var r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(i.url):"Connection timed out on request to ".concat(i.url));r.code=t,e.channels.error.publish(r)}function j(e){(e||g||h.readyState>=2&&s.connect)&&clearTimeout(s.connect),s.socket&&clearTimeout(s.socket)}function C(e){if(!m){j(!0),m=!0,h=null;var r=e||new Error("Network error while attempting to reach ".concat(i.url));r.isNetworkError=!0,r.request=i,t(r)}}},t.exports=r.default},{"./browser/fetchXhr":57,"parse-headers":66,"same-origin":88}],57:[function(e,t,r){"use strict";function n(){this.readyState=0}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,n.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},n.prototype.abort=function(){this._controller&&this._controller.abort()},n.prototype.getAllResponseHeaders=function(){return this._resHeaders},n.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},n.prototype.send=function(e){var t=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal||void 0,body:e};"undefined"!=typeof document&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(e){return e.headers.forEach((function(e,r){t._resHeaders+="".concat(r,": ").concat(e,"\r\n")})),t.status=e.status,t.statusText=e.statusText,t.readyState=3,n?e.text():e.arrayBuffer()})).then((function(e){n?t.responseText=e:t.response=e,t.readyState=4,t.onreadystatechange()})).catch((function(e){"AbortError"!==e.name?t.onerror(e):t.onabort()}))};var o=n;r.default=o,t.exports=r.default},{}],58:[function(e,t,r){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=((n=e("./node-request"))&&n.__esModule?n:{default:n}).default;r.default=o,t.exports=r.default},{"./node-request":56}],59:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e,t,r){return("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1)},t.exports=r.default},{}],60:[function(e,t,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};r.default=n,t.exports=r.default}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],61:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(e){return function(t,r){for(var n="onError"===t,o=r,i=arguments.length,s=new Array(i>2?i-2:0),a=2;a<i;a++)s[a-2]=arguments[a];for(var u=0;u<e[t].length&&(o=e[t][u].apply(void 0,[o].concat(s)),!n||o);u++);return o}},t.exports=r.default},{}],62:[function(e,t,r){"use strict";function n(e){return"[object Object]"===Object.prototype.toString.call(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.isPlainObject=function(e){var t,r;return!1!==n(e)&&(void 0===(t=e.constructor)||!1!==n(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}},{}],63:[function(e,t,r){"use strict";var n="undefined"!=typeof Reflect?Reflect.construct:void 0,o=Object.defineProperty,i=Error.captureStackTrace;function s(e){void 0!==e&&o(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&o(this,"name",{configurable:!0,value:t,writable:!0}),i(this,this.constructor)}void 0===i&&(i=function(e){var t=new Error;o(e,"stack",{configurable:!0,get:function(){var e=t.stack;return o(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){o(e,"stack",{configurable:!0,value:t,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var a=function(){function e(e,t){return o(e,"name",{configurable:!0,value:t})}try{var t=function(){};if(e(t,"foo"),"foo"===t.name)return e}catch(e){}}();r=t.exports=function(e,t){if(null==t||t===Error)t=s;else if("function"!=typeof t)throw new TypeError("super_ should be a function");var r;if("string"==typeof e)r=e,e=void 0!==n?function(){return n(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==a&&(a(e,r),r=void 0);else if("function"!=typeof e)throw new TypeError("constructor should be either a string or a function");e.super_=e.super=t;var o={constructor:{configurable:!0,value:e,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),e.prototype=Object.create(t.prototype,o),e},r.BaseError=s},{}],64:[function(e,t,r){var n=1e3,o=60*n,i=60*o,s=24*i;function a(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*i;case"minutes":case"minute":case"mins":case"min":case"m":return r*o;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function u(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=i?Math.round(e/i)+"h":t>=o?Math.round(e/o)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function c(e){var t=Math.abs(e);return t>=s?l(e,t,s,"day"):t>=i?l(e,t,i,"hour"):t>=o?l(e,t,o,"minute"):t>=n?l(e,t,n,"second"):e+" ms"}function l(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return a(e);if("number"===r&&isFinite(e))return t.long?c(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],65:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){var e=Object.create(null),t=0;return{publish:function(t){for(var r in e)e[r](t)},subscribe:function(r){var n=t++;return e[n]=r,function(){delete e[n]}}}}},{}],66:[function(e,t,r){var n=function(e){return e.replace(/^\s+|\s+$/g,"")},o=function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.exports=function(e){if(!e)return{};for(var t={},r=n(e).split("\n"),i=0;i<r.length;i++){var s=r[i],a=s.indexOf(":"),u=n(s.slice(0,a)).toLowerCase(),c=n(s.slice(a+1));void 0===t[u]?t[u]=c:o(t[u])?t[u].push(c):t[u]=[t[u],c]}return t}},{}],67:[function(e,t,r){var n,o,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var c,l=[],f=!1,d=-1;function p(){f&&c&&(f=!1,c.length?l=c.concat(l):d=-1,l.length&&h())}function h(){if(!f){var e=u(p);f=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,f=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function y(e,t){this.fun=e,this.array=t}function b(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new y(e,t)),1!==l.length||f||u(h)},y.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=b,i.addListener=b,i.once=b,i.off=b,i.removeListener=b,i.removeAllListeners=b,i.emit=b,i.prependListener=b,i.prependOnceListener=b,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],68:[function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function i(e){try{return encodeURIComponent(e)}catch(e){return null}}r.stringify=function(e,t){t=t||"";var r,o,s=[];for(o in"string"!=typeof t&&(t="?"),e)if(n.call(e,o)){if((r=e[o])||null!=r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;s.push(o+"="+r)}return s.length?t+s.join("&"):""},r.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var i=o(t[1]),s=o(t[2]);null===i||null===s||i in n||(n[i]=s)}return n}},{}],69:[function(e,t,r){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}],70:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./util/canReportError"),o=e("./util/toSubscriber"),i=e("./symbol/observable"),s=e("./util/pipe"),a=e("./config"),u=function(){function e(e){this._isScalar=!1,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=this.operator,i=o.toSubscriber(e,t,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||a.config.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),a.config.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){a.config.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),n.canReportError(e)?e.error(t):console.warn(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=c(t))((function(t,n){var o;o=r.subscribe((function(t){try{e(t)}catch(e){n(e),o&&o.unsubscribe()}}),n,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[i.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:s.pipeFromArray(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=c(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 c(e){if(e||(e=a.config.Promise||Promise),!e)throw new Error("no Promise impl found");return e}r.Observable=u},{"./config":74,"./symbol/observable":77,"./util/canReportError":80,"./util/pipe":86,"./util/toSubscriber":87}],71:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./config"),o=e("./util/hostReportError");r.empty={closed:!0,next:function(e){},error:function(e){if(n.config.useDeprecatedSynchronousErrorHandling)throw e;o.hostReportError(e)},complete:function(){}}},{"./config":74,"./util/hostReportError":81}],72:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("./util/isFunction"),s=e("./Observer"),a=e("./Subscription"),u=e("../internal/symbol/rxSubscriber"),c=e("./config"),l=e("./util/hostReportError"),f=function(e){function t(r,n,o){var i=e.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=s.empty;break;case 1:if(!r){i.destination=s.empty;break}if("object"==typeof r){r instanceof t?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new d(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new d(i,r,n,o)}return i}return o(t,e),t.prototype[u.rxSubscriber]=function(){return this},t.create=function(e,r,n){var o=new t(e,r,n);return o.syncErrorThrowable=!1,o},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))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},t}(a.Subscription);r.Subscriber=f;var d=function(e){function t(t,r,n,o){var a,u=e.call(this)||this;u._parentSubscriber=t;var c=u;return i.isFunction(r)?a=r:r&&(a=r.next,n=r.error,o=r.complete,r!==s.empty&&(c=Object.create(r),i.isFunction(c.unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=a,u._error=n,u._complete=o,u}return o(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;c.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,r=c.config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)r?(t.syncErrorValue=e,t.syncErrorThrown=!0):l.hostReportError(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;l.hostReportError(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};c.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),c.config.useDeprecatedSynchronousErrorHandling)throw e;l.hostReportError(e)}},t.prototype.__tryOrSetError=function(e,t,r){if(!c.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,r)}catch(t){return c.config.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(l.hostReportError(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(f);r.SafeSubscriber=d},{"../internal/symbol/rxSubscriber":78,"./Observer":71,"./Subscription":73,"./config":74,"./util/hostReportError":81,"./util/isFunction":84}],73:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./util/isArray"),o=e("./util/isObject"),i=e("./util/isFunction"),s=e("./util/UnsubscriptionError"),a=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}var t;return e.prototype.unsubscribe=function(){var t;if(!this.closed){var r=this._parentOrParents,a=this._ctorUnsubscribe,c=this._unsubscribe,l=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof e)r.remove(this);else if(null!==r)for(var f=0;f<r.length;++f)r[f].remove(this);if(i.isFunction(c)){a&&(this._unsubscribe=void 0);try{c.call(this)}catch(e){t=e instanceof s.UnsubscriptionError?u(e.errors):[e]}}if(n.isArray(l)){f=-1;for(var d=l.length;++f<d;){var p=l[f];if(o.isObject(p))try{p.unsubscribe()}catch(e){t=t||[],e instanceof s.UnsubscriptionError?t=t.concat(u(e.errors)):t.push(e)}}}if(t)throw new s.UnsubscriptionError(t)}},e.prototype.add=function(t){var r=t;if(!t)return e.EMPTY;switch(typeof t){case"function":r=new e(t);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof e)){var n=r;(r=new e)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof e){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}},e.EMPTY=((t=new e).closed=!0,t),e}();function u(e){return e.reduce((function(e,t){return e.concat(t instanceof s.UnsubscriptionError?t.errors:t)}),[])}r.Subscription=a},{"./util/UnsubscriptionError":79,"./util/isArray":83,"./util/isFunction":84,"./util/isObject":85}],74:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1;r.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){if(e){var t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else n&&console.log("RxJS: Back to a better error behavior. Thank you. <3");n=e},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],75:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.filter=function(e,t){return function(r){return r.lift(new s(e,t))}};var s=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate,this.thisArg))},e}(),a=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return o(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(i.Subscriber)},{"../Subscriber":72}],76:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.map=function(e,t){return function(r){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new s(e,t))}};var s=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.project,this.thisArg))},e}();r.MapOperator=s;var a=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return o(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(i.Subscriber)},{"../Subscriber":72}],77:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],78:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),r.$$rxSubscriber=r.rxSubscriber},{}],79:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}();r.UnsubscriptionError=n},{}],80:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Subscriber");r.canReportError=function(e){for(;e;){var t=e,r=t.closed,o=t.destination,i=t.isStopped;if(r||i)return!1;e=o&&o instanceof n.Subscriber?o:null}return!0}},{"../Subscriber":72}],81:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hostReportError=function(e){setTimeout((function(){throw e}),0)}},{}],82:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(e){return e}},{}],83:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArray=Array.isArray||function(e){return e&&"number"==typeof e.length}},{}],84:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFunction=function(e){return"function"==typeof e}},{}],85:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isObject=function(e){return null!==e&&"object"==typeof e}},{}],86:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./identity");function o(e){return 0===e.length?n.identity:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}r.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o(e)},r.pipeFromArray=o},{"./identity":82}],87:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Subscriber"),o=e("../symbol/rxSubscriber"),i=e("../Observer");r.toSubscriber=function(e,t,r){if(e){if(e instanceof n.Subscriber)return e;if(e[o.rxSubscriber])return e[o.rxSubscriber]()}return e||t||r?new n.Subscriber(e,t,r):new n.Subscriber(i.empty)}},{"../Observer":71,"../Subscriber":72,"../symbol/rxSubscriber":78}],88:[function(e,t,r){"use strict";var n=e("url");t.exports=function(e,t,r){if(e===t)return!0;var o=n.parse(e,!1,!0),i=n.parse(t,!1,!0),s=0|o.port||("https"===o.protocol?443:80),a=0|i.port||("https"===i.protocol?443:80),u={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===a};return u.proto&&u.hostname&&(u.port||r)}},{url:89}],89:[function(e,t,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;t.exports={regex:n,parse:function(e){var t=n.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}}},{}],90:[function(e,t,r){(function(r){(function(){"use strict";var n=e("requires-port"),o=e("querystringify"),i=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s=/[\n\r\t]/g,a=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,u=/:\d+$/,c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,l=/^[a-zA-Z]:/;function f(e){return(e||"").toString().replace(i,"")}var d=[["#","hash"],["?","query"],function(e,t){return y(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],p={hash:1,query:1};function h(e){var t,n=("undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{}).location||{},o={},i=typeof(e=e||n);if("blob:"===e.protocol)o=new v(unescape(e.pathname),{});else if("string"===i)for(t in o=new v(e,{}),p)delete o[t];else if("object"===i){for(t in e)t in p||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=a.test(e.href))}return o}function y(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function b(e,t){e=(e=f(e)).replace(s,""),t=t||{};var r,n=c.exec(e),o=n[1]?n[1].toLowerCase():"",i=!!n[2],a=!!n[3],u=0;return i?a?(r=n[2]+n[3]+n[4],u=n[2].length+n[3].length):(r=n[2]+n[4],u=n[2].length):a?(r=n[3]+n[4],u=n[3].length):r=n[4],"file:"===o?u>=2&&(r=r.slice(2)):y(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&y(t.protocol)&&(r=n[4]),{protocol:o,slashes:i||y(o),slashesCount:u,rest:r}}function v(e,t,r){if(e=(e=f(e)).replace(s,""),!(this instanceof v))return new v(e,t,r);var i,a,u,c,p,g,m=d.slice(),w=typeof t,O=this,_=0;for("object"!==w&&"string"!==w&&(r=t,t=null),r&&"function"!=typeof r&&(r=o.parse),i=!(a=b(e||"",t=h(t))).protocol&&!a.slashes,O.slashes=a.slashes||i&&t.slashes,O.protocol=a.protocol||t.protocol||"",e=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||l.test(e))||!a.slashes&&(a.protocol||a.slashesCount<2||!y(O.protocol)))&&(m[3]=[/(.*)/,"pathname"]);_<m.length;_++)"function"!=typeof(c=m[_])?(u=c[0],g=c[1],u!=u?O[g]=e:"string"==typeof u?~(p="@"===u?e.lastIndexOf(u):e.indexOf(u))&&("number"==typeof c[2]?(O[g]=e.slice(0,p),e=e.slice(p+c[2])):(O[g]=e.slice(p),e=e.slice(0,p))):(p=u.exec(e))&&(O[g]=p[1],e=e.slice(0,p.index)),O[g]=O[g]||i&&c[3]&&t[g]||"",c[4]&&(O[g]=O[g].toLowerCase())):e=c(e,O);r&&(O.query=r(O.query)),i&&t.slashes&&"/"!==O.pathname.charAt(0)&&(""!==O.pathname||""!==t.pathname)&&(O.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(O.pathname,t.pathname)),"/"!==O.pathname.charAt(0)&&y(O.protocol)&&(O.pathname="/"+O.pathname),n(O.port,O.protocol)||(O.host=O.hostname,O.port=""),O.username=O.password="",O.auth&&(~(p=O.auth.indexOf(":"))?(O.username=O.auth.slice(0,p),O.username=encodeURIComponent(decodeURIComponent(O.username)),O.password=O.auth.slice(p+1),O.password=encodeURIComponent(decodeURIComponent(O.password))):O.username=encodeURIComponent(decodeURIComponent(O.auth)),O.auth=O.password?O.username+":"+O.password:O.username),O.origin="file:"!==O.protocol&&y(O.protocol)&&O.host?O.protocol+"//"+O.host:"null",O.href=O.toString()}v.prototype={set:function(e,t,r){var i=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||o.parse)(t)),i[e]=t;break;case"port":i[e]=t,n(t,i.protocol)?t&&(i.host=i.hostname+":"+t):(i.host=i.hostname,i[e]="");break;case"hostname":i[e]=t,i.port&&(t+=":"+i.port),i.host=t;break;case"host":i[e]=t,u.test(t)?(t=t.split(":"),i.port=t.pop(),i.hostname=t.join(":")):(i.hostname=t,i.port="");break;case"protocol":i.protocol=t.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(t){var s="pathname"===e?"/":"#";i[e]=t.charAt(0)!==s?s+t:t}else i[e]=t;break;case"username":case"password":i[e]=encodeURIComponent(t);break;case"auth":var a=t.indexOf(":");~a?(i.username=t.slice(0,a),i.username=encodeURIComponent(decodeURIComponent(i.username)),i.password=t.slice(a+1),i.password=encodeURIComponent(decodeURIComponent(i.password))):i.username=encodeURIComponent(decodeURIComponent(t))}for(var c=0;c<d.length;c++){var l=d[c];l[4]&&(i[l[1]]=i[l[1]].toLowerCase())}return i.auth=i.password?i.username+":"+i.password:i.username,i.origin="file:"!==i.protocol&&y(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(e){e&&"function"==typeof e||(e=o.stringify);var t,r=this,n=r.host,i=r.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var s=i+(r.protocol&&r.slashes||y(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&y(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||u.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(s+=r.hash),s}},v.extractProtocol=b,v.location=h,v.trimLeft=f,v.qs=o,t.exports=v}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:68,"requires-port":69}]},{},[17])(17)}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient=t()}(this,(function(){"use strict";function e(e){if("string"==typeof e||Array.isArray(e))return{id:e};if(e&&e.query)return"params"in e?{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${t}`)}const t=["image","file"],r=["before","after","replace"],n=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")},o=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error(`${e}() takes an object of properties`)},s=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error(`${e}(): "${t}" is not a valid document ID`)},i=(e,t)=>{if(!t._id)throw new Error(`${e}() requires that the document contains an ID ("_id" property)`);s(e,t._id)},a=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},u=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};function c(e,t={},r=null){this.selection=e,this.operations=Object.assign({},t),this.client=r}Object.assign(c.prototype,{clone(){return new c(this.selection,Object.assign({},this.operations),this.client)},set(e){return this.assign("set",e)},diffMatchPatch(e){return o("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},setIfMissing(e){return this.assign("setIfMissing",e)},replace(e){return o("replace",e),this._set("set",{$:e})},inc(e){return this.assign("inc",e)},dec(e){return this.assign("dec",e)},insert(e,t,n){return((e,t,n)=>{const o="insert(at, selector, items)";if(-1===r.indexOf(e)){const e=r.map((e=>`"${e}"`)).join(", ");throw new Error(`${o} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw new Error(`${o} takes a "selector"-argument which must be a string`);if(!Array.isArray(n))throw new Error(`${o} takes an "items"-argument which must be an array`)})(e,t,n),this.assign("insert",{[e]:t,items:n})},append(e,t){return this.insert("after",`${e}[-1]`,t)},prepend(e,t){return this.insert("before",`${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=`${e}[${o}:${o<0&&s>=0?"":s}]`;return this.insert("replace",i,n||[])},ifRevisionId(e){return this.operations.ifRevisionID=e,this},serialize(){return Object.assign(e(this.selection),this.operations)},toJSON(){return this.serialize()},commit(e={}){if(!this.client)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 this.client.mutate({patch:this.serialize()},r)},reset(){return this.operations={},this},_set(e,t){return this.assign(e,t,!1)},assign(e,t,r=!0){return o(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}});const l={returnDocuments:!1};function d(e=[],t,r){this.trxId=r,this.operations=e,this.client=t}Object.assign(d.prototype,{clone(){return new d(this.operations.slice(0),this.client,this.trxId)},create(e){return o("create",e),this._add({create:e})},createIfNotExists(e){const t="createIfNotExists";return o(t,e),i(t,e),this._add({[t]:e})},createOrReplace(e){const t="createOrReplace";return o(t,e),i(t,e),this._add({[t]:e})},delete(e){return s("delete",e),this._add({delete:{id:e}})},patch(e,t){const r="function"==typeof t;if(e instanceof c)return this._add({patch:e.serialize()});if(r){const r=t(new c(e,{},this.client));if(!(r instanceof c))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:Object.assign({id:e},t)})},transactionId(e){return e?(this.trxId=e,this):this.trxId},serialize(){return this.operations.slice()},toJSON(){return this.serialize()},commit(e){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),Object.assign({transactionId:this.trxId},l,e||{}))},reset(){return this.operations=[],this},_add(e){return this.operations.push(e),this}});const f=encodeURIComponent;var p=({query:e,params:t={},options:r={}})=>{const{tag:n,...o}=r,s=`query=${f(e)}`,i=n?`?tag=${f(n)}&${s}`:`?${s}`,a=Object.keys(t).reduce(((e,r)=>`${e}&${f(`$${r}`)}=${f(JSON.stringify(t[r]))}`),i);return Object.keys(o).reduce(((e,t)=>r[t]?`${e}&${f(t)}=${f(r[t])}`:e),a)},h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function g(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];r.push.apply(r,arguments);var n=Function.bind.apply(t,r);return new n}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var m={};
|
|
2
|
+
/** @license
|
|
3
|
+
* eventsource.js
|
|
4
|
+
* Available under MIT License (MIT)
|
|
5
|
+
* https://github.com/Yaffle/EventSource/
|
|
6
|
+
*/
|
|
7
|
+
!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,s=r.XMLHttpRequest,i=r.XDomainRequest,a=r.ActiveXObject,u=r.EventSource,c=r.document,l=r.Promise,d=r.fetch,f=r.Response,p=r.TextDecoder,h=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===c||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.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=d;d=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 u=e[a];0!==s&&(u<128||u>191||!t(i<<6|63&u,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(u>=0&&u<=127?(s=0,i=u):u>=192&&u<=223?(s=6,i=31&u):u>=224&&u<=239?(s=12,i=15&u):u>=240&&u<=247?(s=18,i=7&u):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&u),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!=h&&function(){try{return"test"===(new p).decode((new h).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 O(){}function _(e){this._headers=e}function x(){}function E(){this._listeners=Object.create(null)}function j(e){n((function(){throw e}),0)}function T(e){this.type=e,this.target=void 0}function S(e,t){T.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){T.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function P(e,t){T.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,u=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!==u&&(o(u),u=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var c=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(c(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},d=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==u&&(o(u),u=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()}},f=function(){u=n((function(){f()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){d("load",e)}),"onerror"in i&&(i.onerror=function(e){d("error",e)}),"onabort"in i&&(i.onabort=function(e){d("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||d(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&c())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(u=n((function(){f()}),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==c||null==c.readyState||"complete"===c.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),O.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var u=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(u);u+=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,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},_.prototype.get=function(e){return this._headers.get(e)},x.prototype.open=function(e,t,r,n,o,s,i){var a=null,u=new y,c=u.signal,f=new p;return d(o,{headers:i,credentials:s?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new _(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=f.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(),u.abort()}}},E.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){j(e)}}},E.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)},E.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(T.prototype),A.prototype=Object.create(T.prototype),P.prototype=Object.create(T.prototype);var F=-1,I=-1,R=/^text\/event\-stream(;.*)?$/i,$=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),q(r)},q=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){j(e)}};function k(e,t){E.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),u=r.lastEventIdQueryParameterName||"lastEventId",c=q(1e3),l=$(r.heartbeatTimeout,45e3),d="",f=c,p=!1,h=0,y=r.headers||{},g=r.Transport,m=N&&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 x:new O,w=void 0,C=0,_=F,E="",j="",T="",k="",U=0,M=0,H=0,z=function(t,r,n,o){if(0===_)if(200===t&&null!=n&&R.test(n)){_=1,p=Date.now(),f=c,e.readyState=1;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(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.",V();s=new A("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(e,e.onerror,s),console.error(i)}},L=function(t){if(1===_){for(var r=-1,s=0;s<t.length;s+=1){(u=t.charCodeAt(s))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?k:"")+t.slice(0,r+1);k=(-1===r?k:"")+t.slice(r+1),""!==t&&(p=Date.now(),h+=t.length);for(var a=0;a<i.length;a+=1){var u=i.charCodeAt(a);if(U===I&&u==="\n".charCodeAt(0))U=0;else if(U===I&&(U=0),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(0!==U){1===U&&(H=a+1);var y=i.slice(M,H-1),g=i.slice(H+(H<a&&i.charCodeAt(H)===" ".charCodeAt(0)?1:0),a);"data"===y?(E+="\n",E+=g):"id"===y?j=g:"event"===y?T=g:"retry"===y?(c=$(g,c),f=c):"heartbeatTimeout"===y&&(l=$(g,l),0!==C&&(o(C),C=n((function(){X()}),l)))}if(0===U){if(""!==E){d=j,""===T&&(T="message");var m=new S(T,{data:E.slice(1),lastEventId:j});if(e.dispatchEvent(m),"open"===T?D(e,e.onopen,m):"message"===T?D(e,e.onmessage,m):"error"===T&&D(e,e.onerror,m),2===_)return}E="",T=""}U=u==="\r".charCodeAt(0)?I:0}else 0===U&&(M=a,U=1),1===U?u===":".charCodeAt(0)&&(H=a+1,U=2):2===U&&(U=3)}}},B=function(t){if(1===_||0===_){_=F,0!==C&&(o(C),C=0),C=n((function(){X()}),f),f=q(Math.min(16*c,2*f)),e.readyState=0;var r=new P("error",{error:t});e.dispatchEvent(r),D(e,e.onerror,r),null!=t&&console.error(t)}},V=function(){_=2,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=2},X=function(){if(C=0,_===F){p=!1,h=0,C=n((function(){X()}),l),_=0,E="",T="",j=d,k="",M=0,H=0,U=0;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==d){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===u?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+u+"="+encodeURIComponent(d)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(i[c]=a[c]);try{w=v.open(m,z,L,B,r,s,i)}catch(e){throw V(),e}}else if(p||null==w){var f=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){X()}),f)}else B(new Error("No activity within "+l+" milliseconds. "+(0===_?"No response received.":h+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=V,X()}(this,e,t)}var N=null!=d&&null!=f&&"body"in f.prototype;k.prototype=Object.create(E.prototype),k.prototype.CONNECTING=0,k.prototype.OPEN=1,k.prototype.CLOSED=2,k.prototype.close=function(){this._close()},k.CONNECTING=0,k.OPEN=1,k.CLOSED=2,k.prototype.withCredentials=void 0;var U,M=u;null==s||null!=u&&"withCredentials"in u.prototype||(M=k),U=function(e){e.EventSourcePolyfill=k,e.NativeEventSource=u,e.EventSource=M}(t),void 0!==U&&(e.exports=U)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:h:globalThis)}({get exports(){return m},set exports(e){m=e}},m);var v=m.EventSourcePolyfill,b=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{}),w=function(e,t){return w=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])},w(e,t)};function C(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}w(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function O(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 _(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 E(e){return"function"==typeof e}function j(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}var T=j((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 S(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var A=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=O(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 u=this.initialTeardown;if(E(u))try{u()}catch(e){o=e instanceof T?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=O(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{F(f)}catch(e){o=null!=o?o:[],e instanceof T?o=x(x([],_(o)),_(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new T(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)F(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)&&S(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&S(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function P(e){return e instanceof A||e&&"closed"in e&&E(e.remove)&&E(e.add)&&E(e.unsubscribe)}function F(e){E(e)?e():e.unsubscribe()}A.EMPTY;var I={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},R={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=R.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,x([e,t],_(r))):setTimeout.apply(void 0,x([e,t],_(r)))},clearTimeout:function(e){var t=R.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function $(){}var q=null;var D=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,P(t)&&t.add(r)):r.destination=z,r}return C(t,e),t.create=function(e,t,r){return new M(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}(A),k=Function.prototype.bind;function N(e,t){return k.call(e,t)}var U=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){H(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){H(e)}else H(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){H(e)}},e}(),M=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;E(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&I.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&N(t.next,s),error:t.error&&N(t.error,s),complete:t.complete&&N(t.complete,s)}):o=t;return i.destination=new U(o),i}return C(t,e),t}(D);function H(e){var t;t=e,R.setTimeout((function(){throw t}))}var z={closed:!0,next:$,error:function(e){throw e},complete:$},L="function"==typeof Symbol&&Symbol.observable||"@@observable";function B(e){return e}function V(e){return 0===e.length?B:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var X=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 D||function(e){return e&&E(e.next)&&E(e.error)&&E(e.complete)}(n)&&P(n)?e:new M(e,t,r);return function(e){if(I.useDeprecatedSynchronousErrorHandling){var t=!q;if(t&&(q={errorThrown:!1,error:null}),e(),t){var r=q,n=r.errorThrown,o=r.error;if(q=null,n)throw o}}else e()}((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=J(t))((function(t,n){var o=new M({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[L]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return V(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=J(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 J(e){var t;return null!==(t=null!=e?e:I.Promise)&&void 0!==t?t:Promise}function G(e){return function(t){if(function(e){return E(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 Y(e,t,r,n,o){return new Z(e,t,r,n,o)}var Z=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 C(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}(D),K=j((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Q(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 K)}})}))}function W(e,t){return G((function(r,n){var o=0;r.subscribe(Y(n,(function(r){n.next(e.call(t,r,o++))})))}))}function ee(e,t){return G((function(r,n){var o=0;r.subscribe(Y(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}const te=v,re=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],ne={includeResult:!0};function oe(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}const se=(e={})=>{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},ie=e=>"response"===e.type,ae=e=>e.body;var ue={listen:function(e,t,r={}){const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.clientConfig,a=r.tag&&i?[i,r.tag].join("."):r.tag,u={...b(r,ne),tag:a},c=(l=u,re.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const d=p({query:e,params:t,options:c,tag:a}),f=`${n}${this.getDataUrl("listen",d)}`;if(f.length>14800)return new X((e=>e.error(new Error("Query too large for listener"))));const h=u.events?u.events:["mutation"],y=-1!==h.indexOf("reconnect"),g={};return(o||s)&&(g.withCredentials=!0),o&&(g.headers={Authorization:`Bearer ${o}`}),new X((e=>{let t,r=c(),n=!1;function o(){n||(y&&e.next({type:"reconnect"}),n||r.readyState===te.CLOSED&&(u(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=oe(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=oe(t);return r instanceof Error?e.error(r):e.next(r)}function a(t){n=!0,u(),e.complete()}function u(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",s,!1),r.removeEventListener("disconnect",a,!1),h.forEach((e=>r.removeEventListener(e,i,!1))),r.close()}function c(){const e=new te(f,g);return e.addEventListener("error",o,!1),e.addEventListener("channelError",s,!1),e.addEventListener("disconnect",a,!1),h.forEach((t=>e.addEventListener(t,i,!1))),e}function l(){r=c()}return function(){n=!0,u()}}))},getDataUrl(e,t){const r=this.clientConfig,n=`/${e}/${a(r)}`;return`/data${t?`${n}/${t}`:n}`.replace(/\/($|\?)/,"$1")},fetch(e,t,r={}){const n=!1===r.filterResponse?e=>e:e=>e.result,o=this._dataRequest("query",{query:e,params:t},r).pipe(W(n));return this.isPromiseAPI()?Q(o):o},getDocument(e,t={}){const r={uri:this.getDataUrl("doc",e),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(ee(ie),W((e=>e.body.documents&&e.body.documents[0])));return this.isPromiseAPI()?Q(n):n},getDocuments(e,t={}){const r={uri:this.getDataUrl("doc",e.join(",")),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(ee(ie),W((t=>{const r=(n=t.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return e.map((e=>r[e]||null))})));return this.isPromiseAPI()?Q(n):n},create(e,t){return this._create(e,"create",t)},createIfNotExists(e,t){return i("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace(e,t){return i("createOrReplace",e),this._create(e,"createOrReplace",t)},patch(e,t){return new c(e,t,this)},delete(t,r){return this.dataRequest("mutate",{mutations:[{delete:e(t)}]},r)},mutate(e,t){const r=e instanceof c||e instanceof d?e.serialize():e,n=Array.isArray(r)?r:[r],o=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},t)},transaction(e){return new d(e,this)},dataRequest(e,t,r={}){const n=this._dataRequest(e,t,r);return this.isPromiseAPI()?Q(n):n},_dataRequest(e,t,r={}){const n="mutate"===e,o="query"===e,s=!n&&p(t),i=!n&&s.length<11264,a=i?s:"",u=r.returnFirst,{timeout:c,token:l,tag:d,headers:f}=r,h={method:i?"GET":"POST",uri:this.getDataUrl(e,a),json:!0,body:i?void 0:t,query:n&&se(r),timeout:c,headers:f,token:l,tag:d,canUseCdn:o};return this._requestObservable(h).pipe(ee(ie),W(ae),W((e=>{if(!n)return e;const t=e.results||[];if(r.returnDocuments)return u?t[0]&&t[0].document:t.map((e=>e.document));const o=u?"documentId":"documentIds",s=u?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[o]:s}})))},_create(e,t,r={}){const n={[t]:e},o=Object.assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},o)}};function ce(e){this.request=e.request.bind(e)}function le(e){this.client=e}Object.assign(ce.prototype,{create(e,t){return this._modify("PUT",e,t)},edit(e,t){return this._modify("PATCH",e,t)},delete(e){return this._modify("DELETE",e)},list(){return this.request({uri:"/datasets"})},_modify(e,t,r){return n(t),this.request({method:e,uri:`/datasets/${t}`,body:r})}}),Object.assign(le.prototype,{list(){return this.client.request({uri:"/projects"})},getById(e){return this.client.request({uri:`/projects/${e}`})}});function de(e){this.client=e}function fe(e){this.client=e}function pe(e){this.client=e}Object.assign(de.prototype,{upload(e,r,n={}){(e=>{if(-1===t.indexOf(e))throw new Error(`Invalid asset type: ${e}. Must be one of ${t.join(", ")}`)})(e);let o=n.extract||void 0;o&&!o.length&&(o=["none"]);const s=a(this.client.clientConfig),i="image"===e?"images":"files",u=function(e,t){return"undefined"!=typeof window&&t instanceof window.File?Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}(n,r),{tag:c,label:l,title:d,description:f,creditLine:p,filename:h,source:y}=u,g={label:l,title:d,description:f,filename:h,meta:o,creditLine:p};y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url);const m=this.client._requestObservable({tag:c,method:"POST",timeout:u.timeout||0,uri:`/assets/${i}/${s}`,headers:u.contentType?{"Content-Type":u.contentType}:{},query:g,body:r});return this.client.isPromiseAPI()?Q(m.pipe(ee((e=>"response"===e.type)),W((e=>e.body.document)))):m},delete(e,t){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");let r=t||"";return/^(image|file)-/.test(r)?e._id&&(r=e._id):r=`${e}-${r}`,a(this.client.clientConfig),this.client.delete(r)},getImageUrl(e,t){const r=e._ref||e;if("string"!=typeof r)throw new Error("getImageUrl() needs either an object with a _ref, or a string with an asset document ID");if(!/^image-[A-Za-z0-9_]+-\d+x\d+-[a-z]{1,5}$/.test(r))throw new Error(`Unsupported asset ID "${r}". URL generation only works for auto-generated IDs.`);const[,n,o,s]=r.split("-");a(this.client.clientConfig);const{projectId:i,dataset:u}=this.client.clientConfig;return`https://cdn.sanity.io/images/${i}/${u}/${n}-${o}.${s}${t?(e=>{const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`);return t.length>0?`?${t.join("&")}`:""})(t):""}`}}),Object.assign(fe.prototype,{getById(e){return this.client.request({uri:`/users/${e}`})}}),Object.assign(pe.prototype,{getLoginProviders(){return this.client.request({uri:"/auth/providers"})},logout(){return this.client.request({uri:"/auth/logout",method:"POST"})}});var he={},ye={get exports(){return he},set exports(e){he=e}};var ge=g(Object.freeze({__proto__:null,default:function(){var e=Object.create(null),t=0;return{publish:function(t){for(var r in e)e[r](t)},subscribe:function(r){var n=t++;return e[n]=r,function(){delete e[n]}}}}})),me={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){return function(t,r){for(var n="onError"===t,o=r,s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(var u=0;u<e[t].length;u++){var c=e[t][u];if(o=c.apply(void 0,[o].concat(i)),n&&!o)break}return o}},e.exports=t.default}({get exports(){return me},set exports(e){me=e}},me);var ve={},be={get exports(){return ve},set exports(e){ve=e}},we={},Ce=Object.prototype.hasOwnProperty;function Oe(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function _e(e){try{return encodeURIComponent(e)}catch(e){return null}}we.stringify=function(e,t){t=t||"";var r,n,o=[];for(n in"string"!=typeof t&&(t="?"),e)if(Ce.call(e,n)){if((r=e[n])||null!=r&&!isNaN(r)||(r=""),n=_e(n),r=_e(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?t+o.join("&"):""},we.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var o=Oe(t[1]),s=Oe(t[2]);null===o||null===s||o in n||(n[o]=s)}return n};var xe=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},Ee=we,je=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Te=/[\n\r\t]/g,Se=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Ae=/:\d+$/,Pe=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Fe=/^[a-zA-Z]:/;function Ie(e){return(e||"").toString().replace(je,"")}var Re=[["#","hash"],["?","query"],function(e,t){return De(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],$e={hash:1,query:1};function qe(e){var t,r=("undefined"!=typeof window?window:void 0!==h?h:"undefined"!=typeof self?self:{}).location||{},n={},o=typeof(e=e||r);if("blob:"===e.protocol)n=new Ne(unescape(e.pathname),{});else if("string"===o)for(t in n=new Ne(e,{}),$e)delete n[t];else if("object"===o){for(t in e)t in $e||(n[t]=e[t]);void 0===n.slashes&&(n.slashes=Se.test(e.href))}return n}function De(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function ke(e,t){e=(e=Ie(e)).replace(Te,""),t=t||{};var r,n=Pe.exec(e),o=n[1]?n[1].toLowerCase():"",s=!!n[2],i=!!n[3],a=0;return s?i?(r=n[2]+n[3]+n[4],a=n[2].length+n[3].length):(r=n[2]+n[4],a=n[2].length):i?(r=n[3]+n[4],a=n[3].length):r=n[4],"file:"===o?a>=2&&(r=r.slice(2)):De(o)?r=n[4]:o?s&&(r=r.slice(2)):a>=2&&De(t.protocol)&&(r=n[4]),{protocol:o,slashes:s||De(o),slashesCount:a,rest:r}}function Ne(e,t,r){if(e=(e=Ie(e)).replace(Te,""),!(this instanceof Ne))return new Ne(e,t,r);var n,o,s,i,a,u,c=Re.slice(),l=typeof t,d=this,f=0;for("object"!==l&&"string"!==l&&(r=t,t=null),r&&"function"!=typeof r&&(r=Ee.parse),n=!(o=ke(e||"",t=qe(t))).protocol&&!o.slashes,d.slashes=o.slashes||n&&t.slashes,d.protocol=o.protocol||t.protocol||"",e=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||Fe.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!De(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);f<c.length;f++)"function"!=typeof(i=c[f])?(s=i[0],u=i[1],s!=s?d[u]=e:"string"==typeof s?~(a="@"===s?e.lastIndexOf(s):e.indexOf(s))&&("number"==typeof i[2]?(d[u]=e.slice(0,a),e=e.slice(a+i[2])):(d[u]=e.slice(a),e=e.slice(0,a))):(a=s.exec(e))&&(d[u]=a[1],e=e.slice(0,a.index)),d[u]=d[u]||n&&i[3]&&t[u]||"",i[4]&&(d[u]=d[u].toLowerCase())):e=i(e,d);r&&(d.query=r(d.query)),n&&t.slashes&&"/"!==d.pathname.charAt(0)&&(""!==d.pathname||""!==t.pathname)&&(d.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],s=!1,i=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),i++):i&&(0===n&&(s=!0),r.splice(n,1),i--);return s&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(d.pathname,t.pathname)),"/"!==d.pathname.charAt(0)&&De(d.protocol)&&(d.pathname="/"+d.pathname),xe(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(~(a=d.auth.indexOf(":"))?(d.username=d.auth.slice(0,a),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(a+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin="file:"!==d.protocol&&De(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}Ne.prototype={set:function(e,t,r){var n=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||Ee.parse)(t)),n[e]=t;break;case"port":n[e]=t,xe(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,Ae.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var o="pathname"===e?"/":"#";n[e]=t.charAt(0)!==o?o+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var i=0;i<Re.length;i++){var a=Re[i];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&De(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(e){e&&"function"==typeof e||(e=Ee.stringify);var t,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(r.protocol&&r.slashes||De(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&De(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||Ae.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(s+=r.hash),s}},Ne.extractProtocol=ke,Ne.location=qe,Ne.trimLeft=Ie,Ne.qs=Ee;var Ue=Ne;!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=Ue)&&r.__esModule?r:{default:r};function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}var s="undefined"!=typeof navigator&&"ReactNative"===navigator.product,i=Object.prototype.hasOwnProperty,a={timeout:s?6e4:12e4};function u(e){var t=[];for(var r in e)i.call(e,r)&&n(r,e[r]);return t.length?t.join("&"):"";function n(e,r){Array.isArray(r)?r.forEach((function(t){return n(e,t)})):t.push([e,r].map(encodeURIComponent).join("="))}}function c(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?c(a.timeout):{connect:t,socket:t}}t.default=function(e){var t="string"==typeof e?o({url:e},a):o({},a,e),r=(0,n.default)(t.url,{},!0);return t.timeout=c(t.timeout),t.query&&(r.query=o({},r.query,function(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(u),t},e.exports=t.default}(be,ve);var Me={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=/^https?:\/\//i;t.default=function(e){if(!r.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))},e.exports=t.default}({get exports(){return Me},set exports(e){Me=e}},Me);var He={},ze={get exports(){return He},set exports(e){He=e}},Le={},Be={get exports(){return Le},set exports(e){Le=e}},Ve=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/,Xe={regex:Ve,parse:function(e){var t=Ve.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}},Je=Xe,Ge=function(e,t,r){if(e===t)return!0;var n=Je.parse(e,!1,!0),o=Je.parse(t,!1,!0),s=0|n.port||("https"===n.protocol?443:80),i=0|o.port||("https"===o.protocol?443:80),a={proto:n.protocol===o.protocol,hostname:n.hostname===o.hostname,port:s===i};return a.proto&&a.hostname&&(a.port||r)},Ye=function(e){return e.replace(/^\s+|\s+$/g,"")},Ze=function(e){if(!e)return{};for(var t,r={},n=Ye(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=Ye(s.slice(0,i)).toLowerCase(),u=Ye(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},Ke={};!function(e,t){function r(){this.readyState=0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},r.prototype.abort=function(){this._controller&&this._controller.abort()},r.prototype.getAllResponseHeaders=function(){return this._resHeaders},r.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},r.prototype.send=function(e){var t=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal||void 0,body:e};"undefined"!=typeof document&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(e){return e.headers.forEach((function(e,r){t._resHeaders+="".concat(r,": ").concat(e,"\r\n")})),t.status=e.status,t.statusText=e.statusText,t.readyState=3,n?e.text():e.arrayBuffer()})).then((function(e){n?t.responseText=e:t.response=e,t.readyState=4,t.onreadystatechange()})).catch((function(e){"AbortError"!==e.name?t.onerror(e):t.onabort()}))};var n=r;t.default=n,e.exports=t.default}({get exports(){return Ke},set exports(e){Ke=e}},Ke),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(Ge),n=s(Ze),o=s(Ke);function s(e){return e&&e.__esModule?e:{default:e}}var i="undefined"==typeof document||"undefined"==typeof window?void 0:window,a=i?"xhr":"fetch",u="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},c="withCredentials"in new u,l="undefined"==typeof XDomainRequest?void 0:XDomainRequest,d=c?u:l;i||(u=o.default,d=o.default);t.default=function(e,t){var o=e.options,s=e.applyMiddleware("finalizeOptions",o),c={},l=i&&i.location&&!(0,r.default)(i.location.href,s.url),f=e.applyMiddleware("interceptRequest",void 0,{adapter:a,context:e});if(f){var p=setTimeout(t,0,null,f);return{abort:function(){return clearTimeout(p)}}}var h=l?new d:new u,y=i&&i.XDomainRequest&&h instanceof i.XDomainRequest,g=s.headers,m=s.timeout,v=!1,b=!1,w=!1;if(h.onerror=x,h.ontimeout=x,h.onabort=function(){_(!0),v=!0},h.onprogress=function(){},h[y?"onload":"onreadystatechange"]=function(){!function(){if(!m)return;_(),c.socket=setTimeout((function(){return O("ESOCKETTIMEDOUT")}),m.socket)}(),v||4!==h.readyState&&!y||0!==h.status&&function(){if(v||b||w)return;if(0===h.status)return void x(new Error("Unknown XHR error"));_(),b=!0,t(null,function(){var e=h.status,t=h.statusText;if(y&&void 0===e)e=200;else{if(e>12e3&&e<12156)return x();e=1223===h.status?204:h.status,t=1223===h.status?"No Content":t}return{body:h.response||h.responseText,url:s.url,method:s.method,headers:y?{}:(0,n.default)(h.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},h.open(s.method,s.url,!0),h.withCredentials=!!s.withCredentials,g&&h.setRequestHeader)for(var C in g)g.hasOwnProperty(C)&&h.setRequestHeader(C,g[C]);else if(g&&y)throw new Error("Headers cannot be set on an XDomainRequest object");return s.rawBody&&(h.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:s,adapter:a,request:h,context:e}),h.send(s.body||null),m&&(c.connect=setTimeout((function(){return O("ETIMEDOUT")}),m.connect)),{abort:function(){v=!0,h&&h.abort()}};function O(t){w=!0,h.abort();var r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(s.url):"Connection timed out on request to ".concat(s.url));r.code=t,e.channels.error.publish(r)}function _(e){(e||v||h.readyState>=2&&c.connect)&&clearTimeout(c.connect),c.socket&&clearTimeout(c.socket)}function x(e){if(!b){_(!0),b=!0,h=null;var r=e||new Error("Network error while attempting to reach ".concat(s.url));r.isNetworkError=!0,r.request=s,t(r)}}},e.exports=t.default}(Be,Le),function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=((r=Le)&&r.__esModule?r:{default:r}).default;t.default=n,e.exports=t.default}(ze,He),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.default,a=[],d=l.reduce((function(e,t){return e[t]=e[t]||[],e}),{processOptions:[o.default],validateOptions:[s.default]});function f(e){var t=c.reduce((function(e,t){return e[t]=u(),e}),{}),o=(0,n.default)(d),s=o("processOptions",e);o("validateOptions",s);var i={options:s,channels:t,applyMiddleware:o},a=null,l=t.request.subscribe((function(e){a=r(e,(function(r,n){return function(e,r,n){var s=e,i=r;if(!s)try{i=o("onResponse",r,n)}catch(e){i=null,s=e}s=s&&o("onError",s,n),s?t.error.publish(s):i&&t.response.publish(i)}(r,n,e)}))}));t.abort.subscribe((function(){l(),a&&a.abort()}));var f=o("onReturn",t,i);return f===t&&t.request.publish(i),f}return f.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&&d.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 l.forEach((function(t){e[t]&&d[t].push(e[t])})),a.push(e),f},f.clone=function(){return e(a)},t.forEach(f.use),f};var r=a(ge),n=a(me),o=a(ve),s=a(Me),i=a(He);function a(e){return e&&e.__esModule?e:{default:e}}var u="default"in r.default?r.default.default:r.default,c=["request","response","progress","error","abort"],l=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=t.default}(ye,he);var Qe=y(he);function We(e){return"[object Object]"===Object.prototype.toString.call(e)}
|
|
8
|
+
/*!
|
|
9
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
12
|
+
* Released under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
var et=Object.create,tt=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,nt=Object.getOwnPropertyNames,ot=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty,it=(e,t)=>function(){return t||(0,e[nt(e)[0]])((t={exports:{}}).exports,t),t.exports},at=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of nt(t))st.call(e,o)||o===r||tt(e,o,{get:()=>t[o],enumerable:!(n=rt(t,o))||n.enumerable});return e},ut=(e,t,r)=>(r=null!=e?et(ot(e)):{},at(!t&&e&&e.__esModule?r:tt(r,"default",{value:e,enumerable:!0}),e)),ct=it({"node_modules/form-urlencoded/dist/form-urlencoded.js"(e,t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Boolean(t.sorted),o=Boolean(t.skipIndex),s=Boolean(t.ignorenull),i=function(e){return String(e).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,(function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()}))},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(e);return n?t.sort():t},u=function(e){return e.filter((function(e){return e})).join("&")},c=function(e,t){return u(a(t).map((function(r){return d(e+"["+r+"]",t[r])})))},l=function(e,t){return t.length?u(t.map((function(t,r){return d(o?e+"[]":e+"["+r+"]",t)}))):i(e+"[]")},d=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0===t?"undefined":r(t),o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t===o?o=s?o:i(e)+"="+o:/string|number|boolean/.test(n)?o=i(e)+"="+i(t):Array.isArray(t)?o=l(e,t):"object"===n&&(o=c(e,t)),o};return e&&u(a(e).map((function(t){return d(t,e[t])})))}}}),lt=ut(ct());lt.default.default||lt.default;var dt=["boolean","string","number"];function ft(e){try{return JSON.parse(e)}catch(e){throw e.message=`Failed to parsed response body as JSON: ${e.message}`,e}}var pt,ht="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},yt={};function gt(e){this.message=e}((e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})})(yt,{default:()=>pt});var mt,vt,bt=(mt={"src/middleware/cancel/Cancel.js"(){gt.prototype.toString=function(){return"Cancel"+(this.message?`: ${this.message}`:"")},gt.prototype.__CANCEL__=!0,pt=gt}},function(){return mt&&(vt=(0,mt[nt(mt)[0]])(mt=0)),vt});bt();var wt,Ct=(bt(),wt=yt,at(tt({},"__esModule",{value:!0}),wt));function Ot(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 Ct(e),t(this.reason))}))}Ot.source=function(){let e;return{token:new Ot((t=>{e=t})),cancel:e}};var _t=it({"node_modules/ms/index.js"(e,t){var r=1e3,n=60*r,o=60*n,s=24*o,i=7*s,a=365.25*s;function u(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}t.exports=function(e,t){t=t||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*i;case"days":case"day":case"d":return u*s;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*n;case"seconds":case"second":case"secs":case"sec":case"s":return u*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(e);if("number"===c&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return u(e,t,s,"day");if(t>=o)return u(e,t,o,"hour");if(t>=n)return u(e,t,n,"minute");if(t>=r)return u(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=n)return Math.round(e/n)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),xt=it({"node_modules/debug/src/common.js"(e,t){t.exports=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=_t(),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}}});ut(it({"node_modules/debug/src/browser.js"(e,t){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(e){}0;return t},e.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+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.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`."))}})(),e.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"],e.log=console.debug||console.log||(()=>{}),t.exports=xt()(e);var{formatters:r}=t.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}})());var Et=it({"node_modules/capture-stack-trace/index.js"(e,t){t.exports=Error.captureStackTrace||function(e){var t=new Error;Object.defineProperty(e,"stack",{configurable:!0,get:function(){var e=t.stack;return Object.defineProperty(this,"stack",{value:e}),e}})}}}),jt=it({"node_modules/create-error-class/index.js"(e,t){var r=Et();t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(e))throw new Error("className contains invalid characters");t=t||function(e){this.message=e};var n,o,s=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),r(this,this.constructor),t.apply(this,arguments)};return n=s,o=Error,n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s}}});(0,ut(jt()).default)("HttpError",(function(e,t){const r=e.url.length>400?`${e.url.slice(0,399)}…`:e.url;let n=`${e.method}-request to ${r} resulted in `;n+=`HTTP ${e.statusCode} ${e.statusMessage}`,this.message=n.trim(),this.response=e,this.request=t.options}));var Tt={};!function(e,t){var r="undefined"!=typeof Reflect?Reflect.construct:void 0,n=Object.defineProperty,o=Error.captureStackTrace;function s(e){void 0!==e&&n(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&n(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor)}void 0===o&&(o=function(e){var t=new Error;n(e,"stack",{configurable:!0,get:function(){var e=t.stack;return n(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){n(e,"stack",{configurable:!0,value:t,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var i=function(){function e(e,t){return n(e,"name",{configurable:!0,value:t})}try{var t=function(){};if(e(t,"foo"),"foo"===t.name)return e}catch(e){}}();t=e.exports=function(e,t){if(null==t||t===Error)t=s;else if("function"!=typeof t)throw new TypeError("super_ should be a function");var n;if("string"==typeof e)n=e,e=void 0!==r?function(){return r(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==i&&(i(e,n),n=void 0);else if("function"!=typeof e)throw new TypeError("constructor should be either a string or a function");e.super_=e.super=t;var o={constructor:{configurable:!0,value:e,writable:!0}};return void 0!==n&&(o.name={configurable:!0,value:n,writable:!0}),e.prototype=Object.create(t.prototype,o),e},t.BaseError=s}({get exports(){return Tt},set exports(e){Tt=e}},Tt);var St=Tt;function At(e){const t=Ft(e);At.super.call(this,t.message),Object.assign(this,t)}function Pt(e){const t=Ft(e);Pt.super.call(this,t.message),Object.assign(this,t)}function Ft(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:It(t,e)};return t.error&&t.message?(r.message=`${t.error} - ${t.message}`,r):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?` ${e.statusMessage}`:"";return`${e.method}-request to ${e.url} resulted in HTTP ${e.statusCode}${t}`}(e),r)}function It(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}St(At),St(Pt);const Rt={onResponse:e=>{if(e.statusCode>=500)throw new Pt(e);if(e.statusCode>=400)throw new At(e);return e}},$t={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}},qt=[].concat([$t,{processOptions:e=>{const t=e.body;return t?"function"==typeof t.pipe||(s=t).constructor&&"function"==typeof s.constructor.isBuffer&&s.constructor.isBuffer(s)||!(-1!==dt.indexOf(typeof t)||Array.isArray(t)||!1!==We(r=t)&&(void 0===(n=r.constructor)||!1!==We(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?e:Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e;var r,n,o,s}},{onResponse:e=>{const t=e.headers["content-type"]||"",r=Dt&&Dt.force||-1!==t.indexOf("application/json");return e.body&&t&&r?Object.assign({},e,{body:ft(e.body)}):e},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})},{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"))}},Rt,((e={})=>{const t=e.implementation||ht.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,r)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(r),()=>e.abort.publish())))}})({implementation:X})]);var Dt;const kt=Qe(qt);function Nt(e,t=kt){return t(Object.assign({maxRedirects:0},e))}Nt.defaultRequester=kt,Nt.ClientError=At,Nt.ServerError=Pt;function Ut(e){return"https://docs.sanity.io/help/"+e}const Mt=e=>(e=>{let t,r=!1;return(...n)=>(r||(t=e(...n),r=!0),t)})(((...t)=>console.warn(e.join(" "),...t))),Ht=Mt(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and",`cheaper. Think about it! For more info, see ${Ut("js-client-cdn-configuration")}.`,"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),zt=Mt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${Ut("js-client-browser-token")} for more information and how to hide this warning.`]),Lt=Mt(["Using the Sanity client without specifying an API version is deprecated.",`See ${Ut("js-client-api-version")}`]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0},Vt=["localhost","127.0.0.1","0.0.0.0"],Xt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||Lt();const o=Object.assign({},Bt,r),s=o.useProjectHostname;if("undefined"==typeof Promise){const e=Ut("js-client-promise-polyfill");throw new Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(s&&!o.projectId)throw new Error("Configuration must contain `projectId`");const i="undefined"!=typeof window&&window.location&&window.location.hostname,a=i&&(e=>-1!==Vt.indexOf(e))(window.location.hostname);i&&a&&o.token&&!0!==o.ignoreBrowserTokenWarning?zt():void 0===o.useCdn&&Ht(),s&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(o.projectId),o.dataset&&n(o.dataset),"requestTagPrefix"in o&&(o.requestTagPrefix=o.requestTagPrefix?u(o.requestTagPrefix).replace(/\.+$/,""):void 0),o.apiVersion=`${o.apiVersion}`.replace(/^v/,""),o.isDefaultApi=o.apiHost===Bt.apiHost,o.useCdn=Boolean(o.useCdn)&&!o.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`")}(o.apiVersion);const c=o.apiHost.split("://",2),l=c[0],d=c[1],f=o.isDefaultApi?"apicdn.sanity.io":d;return o.useProjectHostname?(o.url=`${l}://${o.projectId}.${d}/v${o.apiVersion}`,o.cdnUrl=`${l}://${o.projectId}.${f}/v${o.apiVersion}`):(o.url=`${o.apiHost}/v${o.apiVersion}`,o.cdnUrl=o.url),o};function Jt(e=Bt){if(!(this instanceof Jt))return new Jt(e);if(this.config(e),this.assets=new de(this),this.datasets=new ce(this),this.projects=new le(this),this.users=new fe(this),this.auth=new pe(this),this.clientConfig.isPromiseAPI){const e=Object.assign({},this.clientConfig,{isPromiseAPI:!1});this.observable=new Jt(e)}}return Object.assign(Jt.prototype,ue),Object.assign(Jt.prototype,{clone(){return new Jt(this.config())},config(e){if(void 0===e)return Object.assign({},this.clientConfig);if(this.clientConfig&&!1===this.clientConfig.allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");if(this.observable){const t=Object.assign({},e,{isPromiseAPI:!1});this.observable.config(t)}return this.clientConfig=Xt(e,this.clientConfig||{}),this},withConfig(e){return new Jt({...this.config(),...e})},getUrl(e,t=!1){return`${t?this.clientConfig.cdnUrl:this.clientConfig.url}/${e.replace(/^\//,"")}`},isPromiseAPI(){return this.clientConfig.isPromiseAPI},_requestObservable(e){const t=e.url||e.uri,r=void 0===e.canUseCdn?["GET","HEAD"].indexOf(e.method||"GET")>=0&&0===t.indexOf("/data/"):e.canUseCdn,n=this.clientConfig.useCdn&&r,o=e.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,e.tag].join("."):e.tag||this.clientConfig.requestTagPrefix;o&&(e.query={tag:u(o),...e.query});const s=((e,t={})=>{const r={},n=t.token||e.token;n&&(r.Authorization=`Bearer ${n}`),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r["X-Sanity-Project-ID"]=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})})(this.clientConfig,Object.assign({},e,{url:this.getUrl(t,n)}));return new X((e=>Nt(s,this.clientConfig.requester).subscribe(e)))},request(e){const t=this._requestObservable(e).pipe(ee((e=>"response"===e.type)),W((e=>e.body)));return this.isPromiseAPI()?Q(t):t}}),Jt.Patch=c,Jt.Transaction=d,Jt.ClientError=Nt.ClientError,Jt.ServerError=Nt.ServerError,Jt.requester=Nt.defaultRequester,Jt}));
|
package/lib/util/observable.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Observable", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Observable.Observable;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "filter", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _filter.filter;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "map", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _map.map;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _Observable = require("rxjs/internal/Observable");
|
|
25
|
-
var _filter = require("rxjs/internal/operators/filter");
|
|
26
|
-
var _map = require("rxjs/internal/operators/map");
|